From: Cris Di Sclafani Date: Fri, 29 Jan 2021 11:37:30 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=a4d16ea93ef1455e69997226863f63a05ee7d6c3;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index eae4637..63e0970 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T11:30:03.132Z", "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 d6e0255..0e5b235 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 _0x3c3c=['INTEGER','exports'];(function(_0x593f80,_0x4db9f6){var _0xad2a20=function(_0x1c684f){while(--_0x1c684f){_0x593f80['push'](_0x593f80['shift']());}};_0xad2a20(++_0x4db9f6);}(_0x3c3c,0x1c3));var _0xc3c3=function(_0xfcb070,_0x130a50){_0xfcb070=_0xfcb070-0x0;var _0x5289c4=_0x3c3c[_0xfcb070];return _0x5289c4;};'use strict';var Sequelize=require('sequelize');module[_0xc3c3('0x0')]={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xc3c3('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xfdc7=['INTEGER'];(function(_0x140f1d,_0x222c14){var _0xe94183=function(_0x1410da){while(--_0x1410da){_0x140f1d['push'](_0x140f1d['shift']());}};_0xe94183(++_0x222c14);}(_0xfdc7,0x1b7));var _0x7fdc=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0xfdc7[_0xbd3a05];return _0x101f90;};'use strict';var Sequelize=require('sequelize');module['exports']={'ChatInteractionId':{'type':Sequelize[_0x7fdc('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7fdc('0x0')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index f2fa254..62709ac 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 _0x89a4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserChatInteractions','UserProfileResource','error','name','index','map','UserChatInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x89a4,0x1e4));var _0x489a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x89a4[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x489a('0x0'));var rimraf=require(_0x489a('0x1'));var zipdir=require(_0x489a('0x2'));var jsonpatch=require(_0x489a('0x3'));var rp=require('request-promise');var moment=require(_0x489a('0x4'));var BPromise=require(_0x489a('0x5'));var Mustache=require(_0x489a('0x6'));var util=require(_0x489a('0x7'));var path=require(_0x489a('0x8'));var sox=require('sox');var csv=require(_0x489a('0x9'));var ejs=require(_0x489a('0xa'));var fs=require('fs');var _=require(_0x489a('0xb'));var squel=require(_0x489a('0xc'));var crypto=require(_0x489a('0xd'));var jsforce=require(_0x489a('0xe'));var deskjs=require(_0x489a('0xf'));var toCsv=require(_0x489a('0x9'));var querystring=require(_0x489a('0x10'));var Papa=require(_0x489a('0x11'));var Redis=require(_0x489a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x489a('0x13'));var as=require(_0x489a('0x14'));var hardwareService=require(_0x489a('0x15'));var logger=require(_0x489a('0x16'))(_0x489a('0x17'));var utils=require(_0x489a('0x18'));var config=require(_0x489a('0x19'));var licenseUtil=require(_0x489a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bb703,_0x62e0d4){_0x62e0d4=_0x62e0d4||0xcc;return function(_0x263120){if(_0x263120){return _0x3bb703[_0x489a('0x1b')](_0x62e0d4);}return _0x3bb703[_0x489a('0x1c')](_0x62e0d4)[_0x489a('0x1d')]();};}function respondWithResult(_0x544a1b,_0x388bb6){_0x388bb6=_0x388bb6||0xc8;return function(_0x479b4b){if(_0x479b4b){return _0x544a1b['status'](_0x388bb6)[_0x489a('0x1e')](_0x479b4b);}};}function respondWithFilteredResult(_0x244695,_0x50fba0){return function(_0xa28784){if(_0xa28784){var _0x4387d0=_0xa28784[_0x489a('0x1f')],_0x5e3660=_0x50fba0[_0x489a('0x20')],_0x48e78a=_0x50fba0[_0x489a('0x20')]+_0x50fba0[_0x489a('0x21')],_0x539bda;if(_0x48e78a>=_0x4387d0){_0x48e78a=_0x4387d0;_0x539bda=0xc8;}else{_0x539bda=0xce;}_0x244695[_0x489a('0x1c')](_0x539bda);return _0x244695[_0x489a('0x22')](_0x489a('0x23'),_0x5e3660+'-'+_0x48e78a+'/'+_0x4387d0)['json'](_0xa28784);}return null;};}function patchUpdates(_0x2fbe7f){return function(_0x4295cd){try{jsonpatch[_0x489a('0x24')](_0x4295cd,_0x2fbe7f,!![]);}catch(_0x24f1cd){return BPromise[_0x489a('0x25')](_0x24f1cd);}return _0x4295cd[_0x489a('0x26')]();};}function saveUpdates(_0x48077d,_0x3d06dc){return function(_0x412d51){if(_0x412d51){return _0x412d51[_0x489a('0x27')](_0x48077d)['then'](function(_0x48d1ed){return _0x48d1ed;});}return null;};}function removeEntity(_0x2c723f,_0x551ed3){return function(_0x508584){if(_0x508584){return _0x508584[_0x489a('0x28')]()[_0x489a('0x29')](function(){var _0x5b73e0=_0x508584[_0x489a('0x2a')]({'plain':!![]});var _0x4b9ced=_0x489a('0x2b');return db[_0x489a('0x2c')][_0x489a('0x28')]({'where':{'type':_0x4b9ced,'resourceId':_0x5b73e0['id']}})[_0x489a('0x29')](function(){return _0x508584;});})[_0x489a('0x29')](function(){_0x2c723f[_0x489a('0x1c')](0xcc)[_0x489a('0x1d')]();});}};}function handleEntityNotFound(_0x32740c,_0x482768){return function(_0x5ea922){if(!_0x5ea922){_0x32740c['sendStatus'](0x194);}return _0x5ea922;};}function handleError(_0x142388,_0x5557cd){_0x5557cd=_0x5557cd||0x1f4;return function(_0x268d03){logger[_0x489a('0x2d')](_0x268d03['stack']);if(_0x268d03[_0x489a('0x2e')]){delete _0x268d03[_0x489a('0x2e')];}_0x142388[_0x489a('0x1c')](_0x5557cd)['send'](_0x268d03);};}exports[_0x489a('0x2f')]=function(_0x588518,_0x2aed14){var _0x2efb9d={},_0xe1b5c2={},_0x4346f5={'count':0x0,'rows':[]};var _0x185598=_[_0x489a('0x30')](db[_0x489a('0x31')][_0x489a('0x32')],function(_0x249523){return{'name':_0x249523[_0x489a('0x33')],'type':_0x249523[_0x489a('0x34')]['key']};});_0xe1b5c2['model']=_['map'](_0x185598,_0x489a('0x2e'));_0xe1b5c2[_0x489a('0x35')]=_[_0x489a('0x36')](_0x588518[_0x489a('0x35')]);_0xe1b5c2[_0x489a('0x37')]=_[_0x489a('0x38')](_0xe1b5c2[_0x489a('0x39')],_0xe1b5c2['query']);_0x2efb9d[_0x489a('0x3a')]=_[_0x489a('0x38')](_0xe1b5c2[_0x489a('0x39')],qs[_0x489a('0x3b')](_0x588518[_0x489a('0x35')][_0x489a('0x3b')]));_0x2efb9d['attributes']=_0x2efb9d[_0x489a('0x3a')][_0x489a('0x3c')]?_0x2efb9d[_0x489a('0x3a')]:_0xe1b5c2['model'];if(!_0x588518[_0x489a('0x35')][_0x489a('0x3d')](_0x489a('0x3e'))){_0x2efb9d[_0x489a('0x21')]=qs[_0x489a('0x21')](_0x588518[_0x489a('0x35')][_0x489a('0x21')]);_0x2efb9d['offset']=qs['offset'](_0x588518['query'][_0x489a('0x20')]);}_0x2efb9d[_0x489a('0x3f')]=qs[_0x489a('0x40')](_0x588518['query'][_0x489a('0x40')]);_0x2efb9d[_0x489a('0x41')]=qs[_0x489a('0x37')](_['pick'](_0x588518[_0x489a('0x35')],_0xe1b5c2[_0x489a('0x37')]),_0x185598);if(_0x588518[_0x489a('0x35')][_0x489a('0x42')]){_0x2efb9d[_0x489a('0x41')]=_[_0x489a('0x43')](_0x2efb9d[_0x489a('0x41')],{'$or':_['map'](_0x185598,function(_0x1de917){if(_0x1de917[_0x489a('0x34')]!==_0x489a('0x44')){var _0x3d9e70={};_0x3d9e70[_0x1de917[_0x489a('0x2e')]]={'$like':'%'+_0x588518[_0x489a('0x35')][_0x489a('0x42')]+'%'};return _0x3d9e70;}})});}_0x2efb9d=_['merge']({},_0x2efb9d,_0x588518[_0x489a('0x45')]);var _0x11cefb={'where':_0x2efb9d['where']};return db[_0x489a('0x31')][_0x489a('0x1f')](_0x11cefb)[_0x489a('0x29')](function(_0x2da3ed){_0x4346f5[_0x489a('0x1f')]=_0x2da3ed;if(_0x588518[_0x489a('0x35')]['includeAll']){_0x2efb9d[_0x489a('0x46')]=[{'all':!![]}];}return db[_0x489a('0x31')][_0x489a('0x47')](_0x2efb9d);})['then'](function(_0x23fd09){_0x4346f5[_0x489a('0x48')]=_0x23fd09;return _0x4346f5;})[_0x489a('0x29')](respondWithFilteredResult(_0x2aed14,_0x2efb9d))['catch'](handleError(_0x2aed14,null));};exports[_0x489a('0x49')]=function(_0x31fcc1,_0x3ca557){var _0x183c3f={'raw':!![],'where':{'id':_0x31fcc1[_0x489a('0x4a')]['id']}},_0x398e9a={};_0x398e9a[_0x489a('0x39')]=_[_0x489a('0x36')](db[_0x489a('0x31')]['rawAttributes']);_0x398e9a[_0x489a('0x35')]=_[_0x489a('0x36')](_0x31fcc1[_0x489a('0x35')]);_0x398e9a[_0x489a('0x37')]=_[_0x489a('0x38')](_0x398e9a[_0x489a('0x39')],_0x398e9a[_0x489a('0x35')]);_0x183c3f[_0x489a('0x3a')]=_[_0x489a('0x38')](_0x398e9a[_0x489a('0x39')],qs['fields'](_0x31fcc1['query'][_0x489a('0x3b')]));_0x183c3f[_0x489a('0x3a')]=_0x183c3f[_0x489a('0x3a')][_0x489a('0x3c')]?_0x183c3f[_0x489a('0x3a')]:_0x398e9a[_0x489a('0x39')];if(_0x31fcc1[_0x489a('0x35')]['includeAll']){_0x183c3f[_0x489a('0x46')]=[{'all':!![]}];}_0x183c3f=_['merge']({},_0x183c3f,_0x31fcc1[_0x489a('0x45')]);return db[_0x489a('0x31')][_0x489a('0x4b')](_0x183c3f)['then'](handleEntityNotFound(_0x3ca557,null))[_0x489a('0x29')](respondWithResult(_0x3ca557,null))['catch'](handleError(_0x3ca557,null));};exports['create']=function(_0xf44740,_0x37a037){return db[_0x489a('0x31')][_0x489a('0x4c')](_0xf44740['body'],{})[_0x489a('0x29')](function(_0x58c323){var _0x272b86=_0xf44740['user'][_0x489a('0x2a')]({'plain':!![]});if(!_0x272b86)throw new Error(_0x489a('0x4d'));if(_0x272b86[_0x489a('0x4e')]==='user'){var _0x535c80=_0x58c323[_0x489a('0x2a')]({'plain':!![]});var _0x1aba8f=_0x489a('0x2b');return db['UserProfileSection'][_0x489a('0x4b')]({'where':{'name':_0x1aba8f,'userProfileId':_0x272b86[_0x489a('0x4f')]},'raw':!![]})['then'](function(_0x5885be){if(_0x5885be&&_0x5885be[_0x489a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x535c80[_0x489a('0x2e')],'resourceId':_0x535c80['id'],'type':_0x5885be[_0x489a('0x2e')],'sectionId':_0x5885be['id']},{})[_0x489a('0x29')](function(){return _0x58c323;});}else{return _0x58c323;}})[_0x489a('0x51')](function(_0x3653a2){logger[_0x489a('0x2d')](_0x489a('0x52'),_0x3653a2);throw _0x3653a2;});}return _0x58c323;})[_0x489a('0x29')](respondWithResult(_0x37a037,0xc9))[_0x489a('0x51')](handleError(_0x37a037,null));};exports[_0x489a('0x27')]=function(_0x3d3b14,_0x4b4511){if(_0x3d3b14['body']['id']){delete _0x3d3b14['body']['id'];}return db[_0x489a('0x31')]['find']({'where':{'id':_0x3d3b14['params']['id']}})['then'](handleEntityNotFound(_0x4b4511,null))[_0x489a('0x29')](saveUpdates(_0x3d3b14['body'],null))[_0x489a('0x29')](respondWithResult(_0x4b4511,null))[_0x489a('0x51')](handleError(_0x4b4511,null));};exports['destroy']=function(_0x1953ee,_0x3ea4b3){return db[_0x489a('0x31')]['find']({'where':{'id':_0x1953ee[_0x489a('0x4a')]['id']}})[_0x489a('0x29')](handleEntityNotFound(_0x3ea4b3,null))[_0x489a('0x29')](removeEntity(_0x3ea4b3,null))['catch'](handleError(_0x3ea4b3,null));}; \ No newline at end of file +var _0x9b03=['includeAll','options','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','UserChatInteractions','error','name','send','index','map','UserChatInteraction','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','params','rawAttributes'];(function(_0xf464f2,_0x157270){var _0x2a934d=function(_0x49578c){while(--_0x49578c){_0xf464f2['push'](_0xf464f2['shift']());}};_0x2a934d(++_0x157270);}(_0x9b03,0x102));var _0x39b0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9b03[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0x39b0('0x0'));var emlformat=require(_0x39b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x39b0('0x2'));var jsonpatch=require(_0x39b0('0x3'));var rp=require(_0x39b0('0x4'));var moment=require(_0x39b0('0x5'));var BPromise=require(_0x39b0('0x6'));var Mustache=require('mustache');var util=require(_0x39b0('0x7'));var path=require('path');var sox=require(_0x39b0('0x8'));var csv=require(_0x39b0('0x9'));var ejs=require(_0x39b0('0xa'));var fs=require('fs');var _=require(_0x39b0('0xb'));var squel=require(_0x39b0('0xc'));var crypto=require(_0x39b0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x39b0('0xe'));var toCsv=require(_0x39b0('0x9'));var querystring=require(_0x39b0('0xf'));var Papa=require(_0x39b0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39b0('0x11'));var as=require(_0x39b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39b0('0x13'))(_0x39b0('0x14'));var utils=require(_0x39b0('0x15'));var config=require(_0x39b0('0x16'));var licenseUtil=require(_0x39b0('0x17'));var db=require(_0x39b0('0x18'))['db'];function respondWithStatusCode(_0x32656c,_0x307115){_0x307115=_0x307115||0xcc;return function(_0x15796c){if(_0x15796c){return _0x32656c[_0x39b0('0x19')](_0x307115);}return _0x32656c[_0x39b0('0x1a')](_0x307115)[_0x39b0('0x1b')]();};}function respondWithResult(_0x3decc5,_0xaa4557){_0xaa4557=_0xaa4557||0xc8;return function(_0x2a3b2c){if(_0x2a3b2c){return _0x3decc5['status'](_0xaa4557)[_0x39b0('0x1c')](_0x2a3b2c);}};}function respondWithFilteredResult(_0x5f2e5b,_0x5c47f1){return function(_0x2824d4){if(_0x2824d4){var _0x28e53a=_0x2824d4['count'],_0xfb0468=_0x5c47f1[_0x39b0('0x1d')],_0x2207a4=_0x5c47f1[_0x39b0('0x1d')]+_0x5c47f1[_0x39b0('0x1e')],_0x159543;if(_0x2207a4>=_0x28e53a){_0x2207a4=_0x28e53a;_0x159543=0xc8;}else{_0x159543=0xce;}_0x5f2e5b[_0x39b0('0x1a')](_0x159543);return _0x5f2e5b[_0x39b0('0x1f')](_0x39b0('0x20'),_0xfb0468+'-'+_0x2207a4+'/'+_0x28e53a)['json'](_0x2824d4);}return null;};}function patchUpdates(_0x1ed3ec){return function(_0x4558b3){try{jsonpatch[_0x39b0('0x21')](_0x4558b3,_0x1ed3ec,!![]);}catch(_0x15bde6){return BPromise['reject'](_0x15bde6);}return _0x4558b3['save']();};}function saveUpdates(_0x84c2cf,_0x5d80b7){return function(_0x1558b1){if(_0x1558b1){return _0x1558b1[_0x39b0('0x22')](_0x84c2cf)[_0x39b0('0x23')](function(_0x394c38){return _0x394c38;});}return null;};}function removeEntity(_0xbc1976,_0x2a30f7){return function(_0x43d701){if(_0x43d701){return _0x43d701[_0x39b0('0x24')]()['then'](function(){var _0x18095f=_0x43d701['get']({'plain':!![]});var _0x2d1560=_0x39b0('0x25');return db['UserProfileResource'][_0x39b0('0x24')]({'where':{'type':_0x2d1560,'resourceId':_0x18095f['id']}})['then'](function(){return _0x43d701;});})[_0x39b0('0x23')](function(){_0xbc1976[_0x39b0('0x1a')](0xcc)[_0x39b0('0x1b')]();});}};}function handleEntityNotFound(_0x32102e,_0x33f6be){return function(_0x2e4412){if(!_0x2e4412){_0x32102e['sendStatus'](0x194);}return _0x2e4412;};}function handleError(_0x15b47f,_0x3572f8){_0x3572f8=_0x3572f8||0x1f4;return function(_0x5b4a24){logger[_0x39b0('0x26')](_0x5b4a24['stack']);if(_0x5b4a24[_0x39b0('0x27')]){delete _0x5b4a24[_0x39b0('0x27')];}_0x15b47f[_0x39b0('0x1a')](_0x3572f8)[_0x39b0('0x28')](_0x5b4a24);};}exports[_0x39b0('0x29')]=function(_0xe0a811,_0x23a58a){var _0x1552e1={},_0x591f68={},_0x892b58={'count':0x0,'rows':[]};var _0x5a778a=_[_0x39b0('0x2a')](db[_0x39b0('0x2b')]['rawAttributes'],function(_0x1f9658){return{'name':_0x1f9658[_0x39b0('0x2c')],'type':_0x1f9658[_0x39b0('0x2d')][_0x39b0('0x2e')]};});_0x591f68['model']=_['map'](_0x5a778a,_0x39b0('0x27'));_0x591f68['query']=_[_0x39b0('0x2f')](_0xe0a811[_0x39b0('0x30')]);_0x591f68[_0x39b0('0x31')]=_['intersection'](_0x591f68[_0x39b0('0x32')],_0x591f68['query']);_0x1552e1[_0x39b0('0x33')]=_[_0x39b0('0x34')](_0x591f68[_0x39b0('0x32')],qs[_0x39b0('0x35')](_0xe0a811['query'][_0x39b0('0x35')]));_0x1552e1['attributes']=_0x1552e1['attributes'][_0x39b0('0x36')]?_0x1552e1[_0x39b0('0x33')]:_0x591f68[_0x39b0('0x32')];if(!_0xe0a811[_0x39b0('0x30')][_0x39b0('0x37')](_0x39b0('0x38'))){_0x1552e1[_0x39b0('0x1e')]=qs[_0x39b0('0x1e')](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x1e')]);_0x1552e1[_0x39b0('0x1d')]=qs['offset'](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x1d')]);}_0x1552e1[_0x39b0('0x39')]=qs[_0x39b0('0x3a')](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3a')]);_0x1552e1['where']=qs[_0x39b0('0x31')](_[_0x39b0('0x3b')](_0xe0a811['query'],_0x591f68[_0x39b0('0x31')]),_0x5a778a);if(_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3c')]){_0x1552e1['where']=_[_0x39b0('0x3d')](_0x1552e1[_0x39b0('0x3e')],{'$or':_[_0x39b0('0x2a')](_0x5a778a,function(_0x149fe6){if(_0x149fe6['type']!==_0x39b0('0x3f')){var _0xa18991={};_0xa18991[_0x149fe6[_0x39b0('0x27')]]={'$like':'%'+_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3c')]+'%'};return _0xa18991;}})});}_0x1552e1=_[_0x39b0('0x3d')]({},_0x1552e1,_0xe0a811['options']);var _0x1e671b={'where':_0x1552e1['where']};return db[_0x39b0('0x2b')]['count'](_0x1e671b)[_0x39b0('0x23')](function(_0x5b95b7){_0x892b58['count']=_0x5b95b7;if(_0xe0a811['query']['includeAll']){_0x1552e1[_0x39b0('0x40')]=[{'all':!![]}];}return db[_0x39b0('0x2b')][_0x39b0('0x41')](_0x1552e1);})['then'](function(_0x3c737f){_0x892b58[_0x39b0('0x42')]=_0x3c737f;return _0x892b58;})[_0x39b0('0x23')](respondWithFilteredResult(_0x23a58a,_0x1552e1))[_0x39b0('0x43')](handleError(_0x23a58a,null));};exports['show']=function(_0x43b687,_0x480f76){var _0x2d214f={'raw':!![],'where':{'id':_0x43b687[_0x39b0('0x44')]['id']}},_0xac38d4={};_0xac38d4[_0x39b0('0x32')]=_[_0x39b0('0x2f')](db['UserChatInteraction'][_0x39b0('0x45')]);_0xac38d4[_0x39b0('0x30')]=_[_0x39b0('0x2f')](_0x43b687[_0x39b0('0x30')]);_0xac38d4[_0x39b0('0x31')]=_[_0x39b0('0x34')](_0xac38d4[_0x39b0('0x32')],_0xac38d4[_0x39b0('0x30')]);_0x2d214f['attributes']=_[_0x39b0('0x34')](_0xac38d4[_0x39b0('0x32')],qs[_0x39b0('0x35')](_0x43b687['query']['fields']));_0x2d214f[_0x39b0('0x33')]=_0x2d214f[_0x39b0('0x33')]['length']?_0x2d214f[_0x39b0('0x33')]:_0xac38d4[_0x39b0('0x32')];if(_0x43b687[_0x39b0('0x30')][_0x39b0('0x46')]){_0x2d214f[_0x39b0('0x40')]=[{'all':!![]}];}_0x2d214f=_[_0x39b0('0x3d')]({},_0x2d214f,_0x43b687[_0x39b0('0x47')]);return db[_0x39b0('0x2b')]['find'](_0x2d214f)[_0x39b0('0x23')](handleEntityNotFound(_0x480f76,null))[_0x39b0('0x23')](respondWithResult(_0x480f76,null))['catch'](handleError(_0x480f76,null));};exports['create']=function(_0x43493b,_0x38c901){return db[_0x39b0('0x2b')]['create'](_0x43493b[_0x39b0('0x48')],{})[_0x39b0('0x23')](function(_0x4a05d7){var _0x4c7c34=_0x43493b[_0x39b0('0x49')][_0x39b0('0x4a')]({'plain':!![]});if(!_0x4c7c34)throw new Error(_0x39b0('0x4b'));if(_0x4c7c34[_0x39b0('0x4c')]===_0x39b0('0x49')){var _0x3b8e6d=_0x4a05d7['get']({'plain':!![]});var _0x49be1d='UserChatInteractions';return db[_0x39b0('0x4d')][_0x39b0('0x4e')]({'where':{'name':_0x49be1d,'userProfileId':_0x4c7c34[_0x39b0('0x4f')]},'raw':!![]})[_0x39b0('0x23')](function(_0x4e9dce){if(_0x4e9dce&&_0x4e9dce['autoAssociation']===0x0){return db['UserProfileResource'][_0x39b0('0x50')]({'name':_0x3b8e6d[_0x39b0('0x27')],'resourceId':_0x3b8e6d['id'],'type':_0x4e9dce['name'],'sectionId':_0x4e9dce['id']},{})[_0x39b0('0x23')](function(){return _0x4a05d7;});}else{return _0x4a05d7;}})[_0x39b0('0x43')](function(_0x1bdb2b){logger[_0x39b0('0x26')](_0x39b0('0x51'),_0x1bdb2b);throw _0x1bdb2b;});}return _0x4a05d7;})[_0x39b0('0x23')](respondWithResult(_0x38c901,0xc9))['catch'](handleError(_0x38c901,null));};exports[_0x39b0('0x22')]=function(_0x357e50,_0x434845){if(_0x357e50['body']['id']){delete _0x357e50['body']['id'];}return db['UserChatInteraction'][_0x39b0('0x4e')]({'where':{'id':_0x357e50[_0x39b0('0x44')]['id']}})[_0x39b0('0x23')](handleEntityNotFound(_0x434845,null))[_0x39b0('0x23')](saveUpdates(_0x357e50[_0x39b0('0x48')],null))['then'](respondWithResult(_0x434845,null))[_0x39b0('0x43')](handleError(_0x434845,null));};exports['destroy']=function(_0x61c47c,_0x4f0bfe){return db[_0x39b0('0x2b')][_0x39b0('0x4e')]({'where':{'id':_0x61c47c[_0x39b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f0bfe,null))[_0x39b0('0x23')](removeEntity(_0x4f0bfe,null))[_0x39b0('0x43')](handleError(_0x4f0bfe,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index f9f30cb..d7c3ce3 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 _0x4309=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0x4309,0x1c4));var _0x9430=function(_0x39d20c,_0x7456ee){_0x39d20c=_0x39d20c-0x0;var _0x5f585b=_0x4309[_0x39d20c];return _0x5f585b;};'use strict';var _=require(_0x9430('0x0'));var util=require(_0x9430('0x1'));var logger=require(_0x9430('0x2'))(_0x9430('0x3'));var moment=require(_0x9430('0x4'));var BPromise=require('bluebird');var rp=require(_0x9430('0x5'));var fs=require('fs');var path=require(_0x9430('0x6'));var rimraf=require(_0x9430('0x7'));var config=require(_0x9430('0x8'));var attributes=require('./UserChatInteraction.attributes');module[_0x9430('0x9')]=function(_0x32a6c3,_0x4da31c){return _0x32a6c3[_0x9430('0xa')](_0x9430('0xb'),attributes,{'tableName':_0x9430('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa80f=['user_has_chat_interactions','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','UserChatInteraction'];(function(_0x453ff1,_0x51d06b){var _0x36f097=function(_0x5af956){while(--_0x5af956){_0x453ff1['push'](_0x453ff1['shift']());}};_0x36f097(++_0x51d06b);}(_0xa80f,0x1e5));var _0xfa80=function(_0x1e1962,_0x5a2061){_0x1e1962=_0x1e1962-0x0;var _0x3c06be=_0xa80f[_0x1e1962];return _0x3c06be;};'use strict';var _=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var logger=require(_0xfa80('0x2'))(_0xfa80('0x3'));var moment=require(_0xfa80('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa80('0x6'));var config=require(_0xfa80('0x7'));var attributes=require('./UserChatInteraction.attributes');module['exports']=function(_0x36599d,_0x317fe0){return _0x36599d[_0xfa80('0x8')](_0xfa80('0x9'),attributes,{'tableName':_0xfa80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index 39abc12..cbe608a 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 _0xfe56=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xfe56,0x190));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6fe5('0x0'));var moment=require('moment');var BPromise=require(_0x6fe5('0x1'));var rs=require(_0x6fe5('0x2'));var fs=require('fs');var Redis=require(_0x6fe5('0x3'));var db=require(_0x6fe5('0x4'))['db'];var utils=require(_0x6fe5('0x5'));var logger=require('../../config/logger')(_0x6fe5('0x6'));var config=require(_0x6fe5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6fe5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14b8c9,_0x3208e6,_0x38f909){return new BPromise(function(_0x40c32c,_0xb05a84){return client[_0x6fe5('0x9')](_0x14b8c9,_0x38f909)[_0x6fe5('0xa')](function(_0x4cd16d){logger[_0x6fe5('0xb')](_0x6fe5('0xc'),_0x3208e6,_0x6fe5('0xd'));logger['debug']('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x3208e6,_0x6fe5('0xd'),JSON[_0x6fe5('0xe')](_0x4cd16d));if(_0x4cd16d['error']){if(_0x4cd16d[_0x6fe5('0xf')][_0x6fe5('0x10')]===0x1f4){logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x4cd16d[_0x6fe5('0xf')][_0x6fe5('0x11')]);return _0xb05a84(_0x4cd16d[_0x6fe5('0xf')]['message']);}logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x4cd16d['error'][_0x6fe5('0x11')]);return _0x40c32c(_0x4cd16d['error'][_0x6fe5('0x11')]);}else{logger[_0x6fe5('0xb')](_0x6fe5('0xc'),_0x3208e6,_0x6fe5('0xd'));_0x40c32c(_0x4cd16d[_0x6fe5('0x12')][_0x6fe5('0x11')]);}})[_0x6fe5('0x13')](function(_0x25497c){logger[_0x6fe5('0xf')](_0x6fe5('0xc'),_0x3208e6,_0x25497c);_0xb05a84(_0x25497c);});});} \ No newline at end of file +var _0xa7ca=['UserChatInteraction,\x20%s,\x20%s,\x20%s','error','code','UserChatInteraction,\x20%s,\x20%s','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xa7ca,0xfe));var _0xaa7c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa7ca[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa7c('0x0'));var BPromise=require('bluebird');var rs=require(_0xaa7c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa7c('0x2'))['db'];var utils=require(_0xaa7c('0x3'));var logger=require(_0xaa7c('0x4'))(_0xaa7c('0x5'));var config=require(_0xaa7c('0x6'));var jayson=require(_0xaa7c('0x7'));var client=jayson['client'][_0xaa7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eafa6,_0x1e6407,_0x3d9c42){return new BPromise(function(_0x454eba,_0x34b2e3){return client[_0xaa7c('0x9')](_0x1eafa6,_0x3d9c42)['then'](function(_0x1b49ac){logger[_0xaa7c('0xa')]('UserChatInteraction,\x20%s,\x20%s',_0x1e6407,'request\x20sent');logger[_0xaa7c('0xb')](_0xaa7c('0xc'),_0x1e6407,'request\x20sent',JSON['stringify'](_0x1b49ac));if(_0x1b49ac[_0xaa7c('0xd')]){if(_0x1b49ac['error'][_0xaa7c('0xe')]===0x1f4){logger['error'](_0xaa7c('0xf'),_0x1e6407,_0x1b49ac[_0xaa7c('0xd')]['message']);return _0x34b2e3(_0x1b49ac[_0xaa7c('0xd')][_0xaa7c('0x10')]);}logger[_0xaa7c('0xd')](_0xaa7c('0xf'),_0x1e6407,_0x1b49ac[_0xaa7c('0xd')][_0xaa7c('0x10')]);return _0x454eba(_0x1b49ac[_0xaa7c('0xd')]['message']);}else{logger[_0xaa7c('0xa')](_0xaa7c('0xf'),_0x1e6407,'request\x20sent');_0x454eba(_0x1b49ac[_0xaa7c('0x11')][_0xaa7c('0x10')]);}})[_0xaa7c('0x12')](function(_0xc6827c){logger[_0xaa7c('0xd')](_0xaa7c('0xf'),_0x1e6407,_0xc6827c);_0x34b2e3(_0xc6827c);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index ffdd4e6..1f80da9 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 _0x655c=['../../components/interaction/service','./UserChatInteraction.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xc6d25f,_0x11195a){var _0x3f3a93=function(_0x321811){while(--_0x321811){_0xc6d25f['push'](_0xc6d25f['shift']());}};_0x3f3a93(++_0x11195a);}(_0x655c,0x1c1));var _0xc655=function(_0x2e2015,_0x59be18){_0x2e2015=_0x2e2015-0x0;var _0x541dad=_0x655c[_0x2e2015];return _0x541dad;};'use strict';var multer=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var path=require(_0xc655('0x2'));var timeout=require(_0xc655('0x3'));var express=require(_0xc655('0x4'));var router=express[_0xc655('0x5')]();var auth=require(_0xc655('0x6'));var interaction=require(_0xc655('0x7'));var config=require('../../config/environment');var controller=require(_0xc655('0x8'));router[_0xc655('0x9')]('/',auth['isAuthenticated'](),controller[_0xc655('0xa')]);router[_0xc655('0x9')](_0xc655('0xb'),auth[_0xc655('0xc')](),controller[_0xc655('0xd')]);router[_0xc655('0xe')]('/',auth[_0xc655('0xc')](),controller['create']);router[_0xc655('0xf')]('/:id',auth[_0xc655('0xc')](),controller[_0xc655('0x10')]);router['delete']('/:id',auth[_0xc655('0xc')](),controller[_0xc655('0x11')]);module[_0xc655('0x12')]=router; \ No newline at end of file +var _0xf717=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserChatInteraction.controller','get','isAuthenticated','index','show','put','/:id','update','delete'];(function(_0x15e2a4,_0x399f42){var _0x3d8cde=function(_0x113e34){while(--_0x113e34){_0x15e2a4['push'](_0x15e2a4['shift']());}};_0x3d8cde(++_0x399f42);}(_0xf717,0xfe));var _0x7f71=function(_0x3a16a8,_0x29c536){_0x3a16a8=_0x3a16a8-0x0;var _0x2ab7b6=_0xf717[_0x3a16a8];return _0x2ab7b6;};'use strict';var multer=require(_0x7f71('0x0'));var util=require('util');var path=require(_0x7f71('0x1'));var timeout=require(_0x7f71('0x2'));var express=require('express');var router=express[_0x7f71('0x3')]();var auth=require(_0x7f71('0x4'));var interaction=require(_0x7f71('0x5'));var config=require(_0x7f71('0x6'));var controller=require(_0x7f71('0x7'));router[_0x7f71('0x8')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xa')]);router[_0x7f71('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7f71('0xb')]);router['post']('/',auth[_0x7f71('0x9')](),controller['create']);router[_0x7f71('0xc')](_0x7f71('0xd'),auth[_0x7f71('0x9')](),controller[_0x7f71('0xe')]);router[_0x7f71('0xf')]('/:id',auth[_0x7f71('0x9')](),controller[_0x7f71('0x10')]);module[_0x7f71('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index f2b93c5..2724480 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 _0x225d=['INTEGER','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x225d,0x12a));var _0xd225=function(_0x13bc34,_0x3d9a38){_0x13bc34=_0x13bc34-0x0;var _0x5898b0=_0x225d[_0x13bc34];return _0x5898b0;};'use strict';var Sequelize=require(_0xd225('0x0'));module[_0xd225('0x1')]={'FaxInteractionId':{'type':Sequelize[_0xd225('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd225('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xfa5c=['exports','INTEGER','sequelize'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xfa5c,0xcb));var _0xcfa5=function(_0xc9a8fd,_0x300263){_0xc9a8fd=_0xc9a8fd-0x0;var _0x4fb369=_0xfa5c[_0xc9a8fd];return _0x4fb369;};'use strict';var Sequelize=require(_0xcfa5('0x0'));module[_0xcfa5('0x1')]={'FaxInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xcfa5('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 b54bbc8..71723ce 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 _0x9b8c=['attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserFaxInteractions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','UserFaxInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9b8c,0x100));var _0xc9b8=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0x9b8c[_0x548d7d];return _0xb1c878;};'use strict';var pdf=require(_0xc9b8('0x0'));var emlformat=require(_0xc9b8('0x1'));var rimraf=require(_0xc9b8('0x2'));var zipdir=require(_0xc9b8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9b8('0x4'));var moment=require(_0xc9b8('0x5'));var BPromise=require(_0xc9b8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9b8('0x7'));var sox=require(_0xc9b8('0x8'));var csv=require(_0xc9b8('0x9'));var ejs=require(_0xc9b8('0xa'));var fs=require('fs');var _=require(_0xc9b8('0xb'));var squel=require(_0xc9b8('0xc'));var crypto=require(_0xc9b8('0xd'));var jsforce=require(_0xc9b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc9b8('0x9'));var querystring=require('querystring');var Papa=require(_0xc9b8('0xf'));var Redis=require(_0xc9b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc9b8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9b8('0x12'));var logger=require(_0xc9b8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc9b8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9b8('0x15'))['db'];function respondWithStatusCode(_0x56296f,_0x395d84){_0x395d84=_0x395d84||0xcc;return function(_0x3dd659){if(_0x3dd659){return _0x56296f['sendStatus'](_0x395d84);}return _0x56296f[_0xc9b8('0x16')](_0x395d84)[_0xc9b8('0x17')]();};}function respondWithResult(_0x12449b,_0x41b675){_0x41b675=_0x41b675||0xc8;return function(_0x4da533){if(_0x4da533){return _0x12449b['status'](_0x41b675)[_0xc9b8('0x18')](_0x4da533);}};}function respondWithFilteredResult(_0x58d1f6,_0x3a9b9a){return function(_0x17ff73){if(_0x17ff73){var _0x1f398b=_0x17ff73[_0xc9b8('0x19')],_0x577472=_0x3a9b9a[_0xc9b8('0x1a')],_0x3cf4de=_0x3a9b9a['offset']+_0x3a9b9a[_0xc9b8('0x1b')],_0x3778bf;if(_0x3cf4de>=_0x1f398b){_0x3cf4de=_0x1f398b;_0x3778bf=0xc8;}else{_0x3778bf=0xce;}_0x58d1f6[_0xc9b8('0x16')](_0x3778bf);return _0x58d1f6[_0xc9b8('0x1c')](_0xc9b8('0x1d'),_0x577472+'-'+_0x3cf4de+'/'+_0x1f398b)[_0xc9b8('0x18')](_0x17ff73);}return null;};}function patchUpdates(_0x2ee8a6){return function(_0x37cb46){try{jsonpatch[_0xc9b8('0x1e')](_0x37cb46,_0x2ee8a6,!![]);}catch(_0x55d8c9){return BPromise[_0xc9b8('0x1f')](_0x55d8c9);}return _0x37cb46[_0xc9b8('0x20')]();};}function saveUpdates(_0x5e8ce7,_0x33c6ed){return function(_0x5adccf){if(_0x5adccf){return _0x5adccf[_0xc9b8('0x21')](_0x5e8ce7)[_0xc9b8('0x22')](function(_0x5395a8){return _0x5395a8;});}return null;};}function removeEntity(_0x2e4594,_0x187acc){return function(_0x566692){if(_0x566692){return _0x566692[_0xc9b8('0x23')]()[_0xc9b8('0x22')](function(){var _0x2b6fe3=_0x566692['get']({'plain':!![]});var _0x294bca='UserFaxInteractions';return db[_0xc9b8('0x24')][_0xc9b8('0x23')]({'where':{'type':_0x294bca,'resourceId':_0x2b6fe3['id']}})[_0xc9b8('0x22')](function(){return _0x566692;});})[_0xc9b8('0x22')](function(){_0x2e4594[_0xc9b8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a4dd,_0xce6a2d){return function(_0x5ba638){if(!_0x5ba638){_0x49a4dd['sendStatus'](0x194);}return _0x5ba638;};}function handleError(_0x5dbb3e,_0x5aa1ac){_0x5aa1ac=_0x5aa1ac||0x1f4;return function(_0x2ec8a6){logger[_0xc9b8('0x25')](_0x2ec8a6[_0xc9b8('0x26')]);if(_0x2ec8a6['name']){delete _0x2ec8a6[_0xc9b8('0x27')];}_0x5dbb3e[_0xc9b8('0x16')](_0x5aa1ac)[_0xc9b8('0x28')](_0x2ec8a6);};}exports['index']=function(_0x270b07,_0x252d1d){var _0x3e1ef0={},_0x3f8e41={},_0x2bfd86={'count':0x0,'rows':[]};var _0xc85f7b=_[_0xc9b8('0x29')](db[_0xc9b8('0x2a')][_0xc9b8('0x2b')],function(_0x8a2e98){return{'name':_0x8a2e98[_0xc9b8('0x2c')],'type':_0x8a2e98[_0xc9b8('0x2d')][_0xc9b8('0x2e')]};});_0x3f8e41['model']=_['map'](_0xc85f7b,_0xc9b8('0x27'));_0x3f8e41['query']=_[_0xc9b8('0x2f')](_0x270b07[_0xc9b8('0x30')]);_0x3f8e41[_0xc9b8('0x31')]=_[_0xc9b8('0x32')](_0x3f8e41[_0xc9b8('0x33')],_0x3f8e41[_0xc9b8('0x30')]);_0x3e1ef0[_0xc9b8('0x34')]=_['intersection'](_0x3f8e41[_0xc9b8('0x33')],qs['fields'](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x35')]));_0x3e1ef0['attributes']=_0x3e1ef0['attributes'][_0xc9b8('0x36')]?_0x3e1ef0[_0xc9b8('0x34')]:_0x3f8e41[_0xc9b8('0x33')];if(!_0x270b07[_0xc9b8('0x30')]['hasOwnProperty'](_0xc9b8('0x37'))){_0x3e1ef0[_0xc9b8('0x1b')]=qs[_0xc9b8('0x1b')](_0x270b07['query']['limit']);_0x3e1ef0[_0xc9b8('0x1a')]=qs[_0xc9b8('0x1a')](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x1a')]);}_0x3e1ef0['order']=qs[_0xc9b8('0x38')](_0x270b07[_0xc9b8('0x30')][_0xc9b8('0x38')]);_0x3e1ef0[_0xc9b8('0x39')]=qs[_0xc9b8('0x31')](_['pick'](_0x270b07[_0xc9b8('0x30')],_0x3f8e41[_0xc9b8('0x31')]),_0xc85f7b);if(_0x270b07[_0xc9b8('0x30')]['filter']){_0x3e1ef0[_0xc9b8('0x39')]=_[_0xc9b8('0x3a')](_0x3e1ef0[_0xc9b8('0x39')],{'$or':_[_0xc9b8('0x29')](_0xc85f7b,function(_0x4f93bb){if(_0x4f93bb['type']!==_0xc9b8('0x3b')){var _0x57c12f={};_0x57c12f[_0x4f93bb[_0xc9b8('0x27')]]={'$like':'%'+_0x270b07[_0xc9b8('0x30')]['filter']+'%'};return _0x57c12f;}})});}_0x3e1ef0=_[_0xc9b8('0x3a')]({},_0x3e1ef0,_0x270b07[_0xc9b8('0x3c')]);var _0x560ae0={'where':_0x3e1ef0[_0xc9b8('0x39')]};return db['UserFaxInteraction'][_0xc9b8('0x19')](_0x560ae0)[_0xc9b8('0x22')](function(_0x41fe06){_0x2bfd86[_0xc9b8('0x19')]=_0x41fe06;if(_0x270b07['query'][_0xc9b8('0x3d')]){_0x3e1ef0[_0xc9b8('0x3e')]=[{'all':!![]}];}return db[_0xc9b8('0x2a')][_0xc9b8('0x3f')](_0x3e1ef0);})[_0xc9b8('0x22')](function(_0x4934a8){_0x2bfd86['rows']=_0x4934a8;return _0x2bfd86;})[_0xc9b8('0x22')](respondWithFilteredResult(_0x252d1d,_0x3e1ef0))[_0xc9b8('0x40')](handleError(_0x252d1d,null));};exports[_0xc9b8('0x41')]=function(_0x44fd97,_0x273ceb){var _0xce57c5={'raw':!![],'where':{'id':_0x44fd97[_0xc9b8('0x42')]['id']}},_0x33ac53={};_0x33ac53[_0xc9b8('0x33')]=_['keys'](db[_0xc9b8('0x2a')][_0xc9b8('0x2b')]);_0x33ac53['query']=_['keys'](_0x44fd97[_0xc9b8('0x30')]);_0x33ac53[_0xc9b8('0x31')]=_['intersection'](_0x33ac53[_0xc9b8('0x33')],_0x33ac53[_0xc9b8('0x30')]);_0xce57c5[_0xc9b8('0x34')]=_[_0xc9b8('0x32')](_0x33ac53['model'],qs[_0xc9b8('0x35')](_0x44fd97[_0xc9b8('0x30')][_0xc9b8('0x35')]));_0xce57c5[_0xc9b8('0x34')]=_0xce57c5[_0xc9b8('0x34')]['length']?_0xce57c5[_0xc9b8('0x34')]:_0x33ac53[_0xc9b8('0x33')];if(_0x44fd97[_0xc9b8('0x30')]['includeAll']){_0xce57c5['include']=[{'all':!![]}];}_0xce57c5=_['merge']({},_0xce57c5,_0x44fd97[_0xc9b8('0x3c')]);return db[_0xc9b8('0x2a')][_0xc9b8('0x43')](_0xce57c5)[_0xc9b8('0x22')](handleEntityNotFound(_0x273ceb,null))[_0xc9b8('0x22')](respondWithResult(_0x273ceb,null))[_0xc9b8('0x40')](handleError(_0x273ceb,null));};exports[_0xc9b8('0x44')]=function(_0x505e83,_0x4ff7a){return db[_0xc9b8('0x2a')][_0xc9b8('0x44')](_0x505e83[_0xc9b8('0x45')],{})[_0xc9b8('0x22')](function(_0xc13008){var _0x55cd0d=_0x505e83[_0xc9b8('0x46')][_0xc9b8('0x47')]({'plain':!![]});if(!_0x55cd0d)throw new Error(_0xc9b8('0x48'));if(_0x55cd0d['role']===_0xc9b8('0x46')){var _0xc0e9d1=_0xc13008['get']({'plain':!![]});var _0x39003b=_0xc9b8('0x49');return db[_0xc9b8('0x4a')][_0xc9b8('0x43')]({'where':{'name':_0x39003b,'userProfileId':_0x55cd0d['userProfileId']},'raw':!![]})[_0xc9b8('0x22')](function(_0x1c1ab5){if(_0x1c1ab5&&_0x1c1ab5[_0xc9b8('0x4b')]===0x0){return db[_0xc9b8('0x24')][_0xc9b8('0x44')]({'name':_0xc0e9d1[_0xc9b8('0x27')],'resourceId':_0xc0e9d1['id'],'type':_0x1c1ab5[_0xc9b8('0x27')],'sectionId':_0x1c1ab5['id']},{})[_0xc9b8('0x22')](function(){return _0xc13008;});}else{return _0xc13008;}})[_0xc9b8('0x40')](function(_0x24fc51){logger[_0xc9b8('0x25')](_0xc9b8('0x4c'),_0x24fc51);throw _0x24fc51;});}return _0xc13008;})[_0xc9b8('0x22')](respondWithResult(_0x4ff7a,0xc9))[_0xc9b8('0x40')](handleError(_0x4ff7a,null));};exports['update']=function(_0x4bf501,_0xe68ccb){if(_0x4bf501[_0xc9b8('0x45')]['id']){delete _0x4bf501['body']['id'];}return db[_0xc9b8('0x2a')][_0xc9b8('0x43')]({'where':{'id':_0x4bf501[_0xc9b8('0x42')]['id']}})['then'](handleEntityNotFound(_0xe68ccb,null))[_0xc9b8('0x22')](saveUpdates(_0x4bf501[_0xc9b8('0x45')],null))[_0xc9b8('0x22')](respondWithResult(_0xe68ccb,null))[_0xc9b8('0x40')](handleError(_0xe68ccb,null));};exports['destroy']=function(_0x424eee,_0x2b8fb7){return db['UserFaxInteraction'][_0xc9b8('0x43')]({'where':{'id':_0x424eee[_0xc9b8('0x42')]['id']}})[_0xc9b8('0x22')](handleEntityNotFound(_0x2b8fb7,null))['then'](removeEntity(_0x2b8fb7,null))[_0xc9b8('0x40')](handleError(_0x2b8fb7,null));}; \ No newline at end of file +var _0x2691=['UserFaxInteractions','destroy','error','stack','name','send','index','map','UserFaxInteraction','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','update','params','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','get'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x2691,0x79));var _0x1269=function(_0x113888,_0x741ec7){_0x113888=_0x113888-0x0;var _0x548a9b=_0x2691[_0x113888];return _0x548a9b;};'use strict';var pdf=require(_0x1269('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1269('0x1'));var rp=require(_0x1269('0x2'));var moment=require('moment');var BPromise=require(_0x1269('0x3'));var Mustache=require(_0x1269('0x4'));var util=require(_0x1269('0x5'));var path=require(_0x1269('0x6'));var sox=require('sox');var csv=require(_0x1269('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1269('0x8'));var squel=require(_0x1269('0x9'));var crypto=require(_0x1269('0xa'));var jsforce=require(_0x1269('0xb'));var deskjs=require(_0x1269('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1269('0xd'));var Papa=require(_0x1269('0xe'));var Redis=require(_0x1269('0xf'));var authService=require(_0x1269('0x10'));var qs=require(_0x1269('0x11'));var as=require(_0x1269('0x12'));var hardwareService=require(_0x1269('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1269('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1269('0x15'));var db=require(_0x1269('0x16'))['db'];function respondWithStatusCode(_0x4b319b,_0x544dbf){_0x544dbf=_0x544dbf||0xcc;return function(_0x1a4859){if(_0x1a4859){return _0x4b319b[_0x1269('0x17')](_0x544dbf);}return _0x4b319b[_0x1269('0x18')](_0x544dbf)[_0x1269('0x19')]();};}function respondWithResult(_0x43e5fd,_0x486ba3){_0x486ba3=_0x486ba3||0xc8;return function(_0x13451d){if(_0x13451d){return _0x43e5fd['status'](_0x486ba3)['json'](_0x13451d);}};}function respondWithFilteredResult(_0x2f1159,_0x598456){return function(_0x2a1781){if(_0x2a1781){var _0x3d7a02=_0x2a1781[_0x1269('0x1a')],_0x2001fc=_0x598456[_0x1269('0x1b')],_0x10a4a9=_0x598456[_0x1269('0x1b')]+_0x598456[_0x1269('0x1c')],_0x21b0db;if(_0x10a4a9>=_0x3d7a02){_0x10a4a9=_0x3d7a02;_0x21b0db=0xc8;}else{_0x21b0db=0xce;}_0x2f1159['status'](_0x21b0db);return _0x2f1159['set'](_0x1269('0x1d'),_0x2001fc+'-'+_0x10a4a9+'/'+_0x3d7a02)[_0x1269('0x1e')](_0x2a1781);}return null;};}function patchUpdates(_0x4d38b1){return function(_0xa0efa5){try{jsonpatch['apply'](_0xa0efa5,_0x4d38b1,!![]);}catch(_0x52b76a){return BPromise[_0x1269('0x1f')](_0x52b76a);}return _0xa0efa5[_0x1269('0x20')]();};}function saveUpdates(_0x3c4dac,_0x58aff3){return function(_0x275db0){if(_0x275db0){return _0x275db0['update'](_0x3c4dac)[_0x1269('0x21')](function(_0x4b694a){return _0x4b694a;});}return null;};}function removeEntity(_0x4ed5eb,_0x3bd4ba){return function(_0x43d09e){if(_0x43d09e){return _0x43d09e['destroy']()['then'](function(){var _0x55a17f=_0x43d09e[_0x1269('0x22')]({'plain':!![]});var _0x5d8c9e=_0x1269('0x23');return db['UserProfileResource'][_0x1269('0x24')]({'where':{'type':_0x5d8c9e,'resourceId':_0x55a17f['id']}})['then'](function(){return _0x43d09e;});})[_0x1269('0x21')](function(){_0x4ed5eb[_0x1269('0x18')](0xcc)[_0x1269('0x19')]();});}};}function handleEntityNotFound(_0x3d29e4,_0x130675){return function(_0x42fd97){if(!_0x42fd97){_0x3d29e4[_0x1269('0x17')](0x194);}return _0x42fd97;};}function handleError(_0x388021,_0x514432){_0x514432=_0x514432||0x1f4;return function(_0x30b1de){logger[_0x1269('0x25')](_0x30b1de[_0x1269('0x26')]);if(_0x30b1de[_0x1269('0x27')]){delete _0x30b1de[_0x1269('0x27')];}_0x388021[_0x1269('0x18')](_0x514432)[_0x1269('0x28')](_0x30b1de);};}exports[_0x1269('0x29')]=function(_0xd25055,_0x5d932c){var _0x151342={},_0x41f232={},_0x1e43e5={'count':0x0,'rows':[]};var _0x3879aa=_[_0x1269('0x2a')](db[_0x1269('0x2b')]['rawAttributes'],function(_0x352f98){return{'name':_0x352f98[_0x1269('0x2c')],'type':_0x352f98[_0x1269('0x2d')][_0x1269('0x2e')]};});_0x41f232[_0x1269('0x2f')]=_[_0x1269('0x2a')](_0x3879aa,_0x1269('0x27'));_0x41f232['query']=_[_0x1269('0x30')](_0xd25055[_0x1269('0x31')]);_0x41f232[_0x1269('0x32')]=_['intersection'](_0x41f232[_0x1269('0x2f')],_0x41f232[_0x1269('0x31')]);_0x151342[_0x1269('0x33')]=_[_0x1269('0x34')](_0x41f232[_0x1269('0x2f')],qs[_0x1269('0x35')](_0xd25055[_0x1269('0x31')][_0x1269('0x35')]));_0x151342[_0x1269('0x33')]=_0x151342[_0x1269('0x33')][_0x1269('0x36')]?_0x151342['attributes']:_0x41f232[_0x1269('0x2f')];if(!_0xd25055['query'][_0x1269('0x37')](_0x1269('0x38'))){_0x151342[_0x1269('0x1c')]=qs[_0x1269('0x1c')](_0xd25055['query'][_0x1269('0x1c')]);_0x151342[_0x1269('0x1b')]=qs[_0x1269('0x1b')](_0xd25055[_0x1269('0x31')][_0x1269('0x1b')]);}_0x151342['order']=qs['sort'](_0xd25055[_0x1269('0x31')]['sort']);_0x151342[_0x1269('0x39')]=qs[_0x1269('0x32')](_[_0x1269('0x3a')](_0xd25055['query'],_0x41f232[_0x1269('0x32')]),_0x3879aa);if(_0xd25055['query']['filter']){_0x151342[_0x1269('0x39')]=_[_0x1269('0x3b')](_0x151342[_0x1269('0x39')],{'$or':_[_0x1269('0x2a')](_0x3879aa,function(_0x25ae94){if(_0x25ae94[_0x1269('0x2d')]!==_0x1269('0x3c')){var _0x29de1e={};_0x29de1e[_0x25ae94[_0x1269('0x27')]]={'$like':'%'+_0xd25055[_0x1269('0x31')][_0x1269('0x3d')]+'%'};return _0x29de1e;}})});}_0x151342=_[_0x1269('0x3b')]({},_0x151342,_0xd25055[_0x1269('0x3e')]);var _0x1bee51={'where':_0x151342[_0x1269('0x39')]};return db['UserFaxInteraction'][_0x1269('0x1a')](_0x1bee51)[_0x1269('0x21')](function(_0x2d2ef6){_0x1e43e5['count']=_0x2d2ef6;if(_0xd25055[_0x1269('0x31')][_0x1269('0x3f')]){_0x151342[_0x1269('0x40')]=[{'all':!![]}];}return db['UserFaxInteraction'][_0x1269('0x41')](_0x151342);})[_0x1269('0x21')](function(_0x15fba6){_0x1e43e5[_0x1269('0x42')]=_0x15fba6;return _0x1e43e5;})['then'](respondWithFilteredResult(_0x5d932c,_0x151342))[_0x1269('0x43')](handleError(_0x5d932c,null));};exports['show']=function(_0x37f08f,_0x9a8e6a){var _0x35308a={'raw':!![],'where':{'id':_0x37f08f['params']['id']}},_0x153275={};_0x153275[_0x1269('0x2f')]=_[_0x1269('0x30')](db[_0x1269('0x2b')][_0x1269('0x44')]);_0x153275[_0x1269('0x31')]=_['keys'](_0x37f08f[_0x1269('0x31')]);_0x153275[_0x1269('0x32')]=_[_0x1269('0x34')](_0x153275[_0x1269('0x2f')],_0x153275[_0x1269('0x31')]);_0x35308a[_0x1269('0x33')]=_[_0x1269('0x34')](_0x153275['model'],qs[_0x1269('0x35')](_0x37f08f['query'][_0x1269('0x35')]));_0x35308a[_0x1269('0x33')]=_0x35308a['attributes'][_0x1269('0x36')]?_0x35308a['attributes']:_0x153275['model'];if(_0x37f08f[_0x1269('0x31')][_0x1269('0x3f')]){_0x35308a['include']=[{'all':!![]}];}_0x35308a=_['merge']({},_0x35308a,_0x37f08f[_0x1269('0x3e')]);return db[_0x1269('0x2b')][_0x1269('0x45')](_0x35308a)[_0x1269('0x21')](handleEntityNotFound(_0x9a8e6a,null))[_0x1269('0x21')](respondWithResult(_0x9a8e6a,null))[_0x1269('0x43')](handleError(_0x9a8e6a,null));};exports[_0x1269('0x46')]=function(_0x46458a,_0x578f41){return db[_0x1269('0x2b')][_0x1269('0x46')](_0x46458a[_0x1269('0x47')],{})[_0x1269('0x21')](function(_0x244bba){var _0x517d88=_0x46458a[_0x1269('0x48')][_0x1269('0x22')]({'plain':!![]});if(!_0x517d88)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517d88['role']==='user'){var _0x3298c2=_0x244bba['get']({'plain':!![]});var _0x5b1833=_0x1269('0x23');return db[_0x1269('0x49')][_0x1269('0x45')]({'where':{'name':_0x5b1833,'userProfileId':_0x517d88[_0x1269('0x4a')]},'raw':!![]})['then'](function(_0xacff1){if(_0xacff1&&_0xacff1['autoAssociation']===0x0){return db[_0x1269('0x4b')][_0x1269('0x46')]({'name':_0x3298c2[_0x1269('0x27')],'resourceId':_0x3298c2['id'],'type':_0xacff1[_0x1269('0x27')],'sectionId':_0xacff1['id']},{})[_0x1269('0x21')](function(){return _0x244bba;});}else{return _0x244bba;}})[_0x1269('0x43')](function(_0x330a1c){logger[_0x1269('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x330a1c);throw _0x330a1c;});}return _0x244bba;})[_0x1269('0x21')](respondWithResult(_0x578f41,0xc9))['catch'](handleError(_0x578f41,null));};exports[_0x1269('0x4c')]=function(_0xb711ab,_0x21c190){if(_0xb711ab[_0x1269('0x47')]['id']){delete _0xb711ab['body']['id'];}return db[_0x1269('0x2b')][_0x1269('0x45')]({'where':{'id':_0xb711ab[_0x1269('0x4d')]['id']}})[_0x1269('0x21')](handleEntityNotFound(_0x21c190,null))[_0x1269('0x21')](saveUpdates(_0xb711ab[_0x1269('0x47')],null))[_0x1269('0x21')](respondWithResult(_0x21c190,null))['catch'](handleError(_0x21c190,null));};exports['destroy']=function(_0x1c9c94,_0x238c19){return db[_0x1269('0x2b')][_0x1269('0x45')]({'where':{'id':_0x1c9c94[_0x1269('0x4d')]['id']}})['then'](handleEntityNotFound(_0x238c19,null))[_0x1269('0x21')](removeEntity(_0x238c19,null))[_0x1269('0x43')](handleError(_0x238c19,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index ffbdc22..004642e 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 _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['user_has_fax_interactions','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','UserFaxInteraction'];(function(_0x337ea3,_0x39dec5){var _0x19e033=function(_0xf4785f){while(--_0xf4785f){_0x337ea3['push'](_0x337ea3['shift']());}};_0x19e033(++_0x39dec5);}(_0x2032,0xd9));var _0x2203=function(_0x259007,_0x548a53){_0x259007=_0x259007-0x0;var _0x2466d1=_0x2032[_0x259007];return _0x2466d1;};'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 diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 3deaf4d..277c71a 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 _0x294e=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x422a71,_0x37d9bf){var _0x552a4e=function(_0x5a5c33){while(--_0x5a5c33){_0x422a71['push'](_0x422a71['shift']());}};_0x552a4e(++_0x37d9bf);}(_0x294e,0x1e5));var _0xe294=function(_0x15ea72,_0x49b8f3){_0x15ea72=_0x15ea72-0x0;var _0x2efd3e=_0x294e[_0x15ea72];return _0x2efd3e;};'use strict';var _=require(_0xe294('0x0'));var util=require(_0xe294('0x1'));var moment=require(_0xe294('0x2'));var BPromise=require(_0xe294('0x3'));var rs=require(_0xe294('0x4'));var fs=require('fs');var Redis=require(_0xe294('0x5'));var db=require(_0xe294('0x6'))['db'];var utils=require(_0xe294('0x7'));var logger=require('../../config/logger')(_0xe294('0x8'));var config=require(_0xe294('0x9'));var jayson=require(_0xe294('0xa'));var client=jayson[_0xe294('0xb')][_0xe294('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x446f51,_0x5c4854,_0x396e25){return new BPromise(function(_0x265313,_0x12958c){return client[_0xe294('0xd')](_0x446f51,_0x396e25)[_0xe294('0xe')](function(_0xd94730){logger[_0xe294('0xf')]('UserFaxInteraction,\x20%s,\x20%s',_0x5c4854,_0xe294('0x10'));logger[_0xe294('0x11')](_0xe294('0x12'),_0x5c4854,_0xe294('0x10'),JSON[_0xe294('0x13')](_0xd94730));if(_0xd94730[_0xe294('0x14')]){if(_0xd94730[_0xe294('0x14')][_0xe294('0x15')]===0x1f4){logger['error'](_0xe294('0x16'),_0x5c4854,_0xd94730[_0xe294('0x14')][_0xe294('0x17')]);return _0x12958c(_0xd94730[_0xe294('0x14')][_0xe294('0x17')]);}logger[_0xe294('0x14')](_0xe294('0x16'),_0x5c4854,_0xd94730[_0xe294('0x14')]['message']);return _0x265313(_0xd94730['error'][_0xe294('0x17')]);}else{logger['info']('UserFaxInteraction,\x20%s,\x20%s',_0x5c4854,'request\x20sent');_0x265313(_0xd94730[_0xe294('0x18')][_0xe294('0x17')]);}})[_0xe294('0x19')](function(_0x29f08a){logger[_0xe294('0x14')](_0xe294('0x16'),_0x5c4854,_0x29f08a);_0x12958c(_0x29f08a);});});} \ No newline at end of file +var _0x0f57=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','UserFaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3a77c9,_0x426b79){var _0x1de22e=function(_0x4ae6ac){while(--_0x4ae6ac){_0x3a77c9['push'](_0x3a77c9['shift']());}};_0x1de22e(++_0x426b79);}(_0x0f57,0xba));var _0x70f5=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x0f57[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x70f5('0x0'));var util=require(_0x70f5('0x1'));var moment=require(_0x70f5('0x2'));var BPromise=require(_0x70f5('0x3'));var rs=require(_0x70f5('0x4'));var fs=require('fs');var Redis=require(_0x70f5('0x5'));var db=require(_0x70f5('0x6'))['db'];var utils=require(_0x70f5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x70f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13db35,_0x34afaf,_0xe2fec8){return new BPromise(function(_0x7b539d,_0x73fb74){return client[_0x70f5('0xa')](_0x13db35,_0xe2fec8)[_0x70f5('0xb')](function(_0x59856b){logger['info'](_0x70f5('0xc'),_0x34afaf,_0x70f5('0xd'));logger['debug']('UserFaxInteraction,\x20%s,\x20%s,\x20%s',_0x34afaf,_0x70f5('0xd'),JSON[_0x70f5('0xe')](_0x59856b));if(_0x59856b[_0x70f5('0xf')]){if(_0x59856b[_0x70f5('0xf')][_0x70f5('0x10')]===0x1f4){logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0x59856b[_0x70f5('0xf')][_0x70f5('0x11')]);return _0x73fb74(_0x59856b[_0x70f5('0xf')]['message']);}logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0x59856b[_0x70f5('0xf')][_0x70f5('0x11')]);return _0x7b539d(_0x59856b[_0x70f5('0xf')]['message']);}else{logger[_0x70f5('0x12')](_0x70f5('0xc'),_0x34afaf,_0x70f5('0xd'));_0x7b539d(_0x59856b['result'][_0x70f5('0x11')]);}})[_0x70f5('0x13')](function(_0xed3d5c){logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0xed3d5c);_0x73fb74(_0xed3d5c);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 79ed0dc..666cb01 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 _0x3e8f=['../../components/interaction/service','./UserFaxInteraction.controller','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x28fe74,_0x455459){var _0xc09d36=function(_0x4a975a){while(--_0x4a975a){_0x28fe74['push'](_0x28fe74['shift']());}};_0xc09d36(++_0x455459);}(_0x3e8f,0x1a2));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf3e8('0x0'));var util=require(_0xf3e8('0x1'));var path=require(_0xf3e8('0x2'));var timeout=require(_0xf3e8('0x3'));var express=require(_0xf3e8('0x4'));var router=express[_0xf3e8('0x5')]();var auth=require(_0xf3e8('0x6'));var interaction=require(_0xf3e8('0x7'));var config=require('../../config/environment');var controller=require(_0xf3e8('0x8'));router[_0xf3e8('0x9')]('/',auth[_0xf3e8('0xa')](),controller['index']);router['get'](_0xf3e8('0xb'),auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xc')]);router['post']('/',auth[_0xf3e8('0xa')](),controller['create']);router['put']('/:id',auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xd')]);router[_0xf3e8('0xe')](_0xf3e8('0xb'),auth[_0xf3e8('0xa')](),controller[_0xf3e8('0xf')]);module[_0xf3e8('0x10')]=router; \ No newline at end of file +var _0x72ea=['util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','post','put','update','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72ea,0x109));var _0xa72e=function(_0x11b409,_0x5ab032){_0x11b409=_0x11b409-0x0;var _0x3df1c1=_0x72ea[_0x11b409];return _0x3df1c1;};'use strict';var multer=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var path=require(_0xa72e('0x2'));var timeout=require(_0xa72e('0x3'));var express=require('express');var router=express[_0xa72e('0x4')]();var auth=require(_0xa72e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0xa72e('0x6')]('/',auth[_0xa72e('0x7')](),controller[_0xa72e('0x8')]);router[_0xa72e('0x6')](_0xa72e('0x9'),auth[_0xa72e('0x7')](),controller['show']);router[_0xa72e('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa72e('0xb')](_0xa72e('0x9'),auth['isAuthenticated'](),controller[_0xa72e('0xc')]);router['delete'](_0xa72e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa72e('0xd')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 4d68f80..6e35b79 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 _0x0107=['exports','INTEGER','sequelize'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0107,0x137));var _0x7010=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x0107[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x7010('0x0'));module[_0x7010('0x1')]={'MailInteractionId':{'type':Sequelize[_0x7010('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7010('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x800b=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x800b,0xb9));var _0xb800=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x800b[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0xb800('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xb800('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb800('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 3d3f322..8a64bb8 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 _0x29f5=['Content-Range','apply','reject','then','destroy','get','error','stack','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserMailInteractions','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x279988,_0x3449ef){var _0xd82b05=function(_0x51df2f){while(--_0x51df2f){_0x279988['push'](_0x279988['shift']());}};_0xd82b05(++_0x3449ef);}(_0x29f5,0xe2));var _0x529f=function(_0x2322b1,_0x18f0dc){_0x2322b1=_0x2322b1-0x0;var _0x57dd72=_0x29f5[_0x2322b1];return _0x57dd72;};'use strict';var pdf=require(_0x529f('0x0'));var emlformat=require(_0x529f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x529f('0x2'));var jsonpatch=require(_0x529f('0x3'));var rp=require(_0x529f('0x4'));var moment=require(_0x529f('0x5'));var BPromise=require(_0x529f('0x6'));var Mustache=require('mustache');var util=require(_0x529f('0x7'));var path=require(_0x529f('0x8'));var sox=require(_0x529f('0x9'));var csv=require(_0x529f('0xa'));var ejs=require(_0x529f('0xb'));var fs=require('fs');var _=require(_0x529f('0xc'));var squel=require(_0x529f('0xd'));var crypto=require(_0x529f('0xe'));var jsforce=require(_0x529f('0xf'));var deskjs=require(_0x529f('0x10'));var toCsv=require(_0x529f('0xa'));var querystring=require(_0x529f('0x11'));var Papa=require(_0x529f('0x12'));var Redis=require(_0x529f('0x13'));var authService=require(_0x529f('0x14'));var qs=require(_0x529f('0x15'));var as=require(_0x529f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x529f('0x17'))('api');var utils=require(_0x529f('0x18'));var config=require(_0x529f('0x19'));var licenseUtil=require(_0x529f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20f499,_0x188721){_0x188721=_0x188721||0xcc;return function(_0x39cf21){if(_0x39cf21){return _0x20f499[_0x529f('0x1b')](_0x188721);}return _0x20f499['status'](_0x188721)[_0x529f('0x1c')]();};}function respondWithResult(_0x29dae5,_0x43a837){_0x43a837=_0x43a837||0xc8;return function(_0x8bfbe1){if(_0x8bfbe1){return _0x29dae5[_0x529f('0x1d')](_0x43a837)[_0x529f('0x1e')](_0x8bfbe1);}};}function respondWithFilteredResult(_0x59cacd,_0x2432de){return function(_0x2b2222){if(_0x2b2222){var _0x16a0e8=_0x2b2222[_0x529f('0x1f')],_0x1687bc=_0x2432de[_0x529f('0x20')],_0x14d3be=_0x2432de['offset']+_0x2432de[_0x529f('0x21')],_0x1ea02d;if(_0x14d3be>=_0x16a0e8){_0x14d3be=_0x16a0e8;_0x1ea02d=0xc8;}else{_0x1ea02d=0xce;}_0x59cacd[_0x529f('0x1d')](_0x1ea02d);return _0x59cacd[_0x529f('0x22')](_0x529f('0x23'),_0x1687bc+'-'+_0x14d3be+'/'+_0x16a0e8)[_0x529f('0x1e')](_0x2b2222);}return null;};}function patchUpdates(_0x24dc80){return function(_0x578cae){try{jsonpatch[_0x529f('0x24')](_0x578cae,_0x24dc80,!![]);}catch(_0x2cc303){return BPromise[_0x529f('0x25')](_0x2cc303);}return _0x578cae['save']();};}function saveUpdates(_0x4bb7f0,_0xc83cbc){return function(_0x22da7f){if(_0x22da7f){return _0x22da7f['update'](_0x4bb7f0)[_0x529f('0x26')](function(_0x84dbf8){return _0x84dbf8;});}return null;};}function removeEntity(_0x721cc7,_0x40e8f0){return function(_0x14f725){if(_0x14f725){return _0x14f725[_0x529f('0x27')]()[_0x529f('0x26')](function(){var _0x4071b6=_0x14f725[_0x529f('0x28')]({'plain':!![]});var _0x5e1d7f='UserMailInteractions';return db['UserProfileResource'][_0x529f('0x27')]({'where':{'type':_0x5e1d7f,'resourceId':_0x4071b6['id']}})[_0x529f('0x26')](function(){return _0x14f725;});})[_0x529f('0x26')](function(){_0x721cc7[_0x529f('0x1d')](0xcc)[_0x529f('0x1c')]();});}};}function handleEntityNotFound(_0x4d26bb,_0x5ccfa7){return function(_0x467382){if(!_0x467382){_0x4d26bb[_0x529f('0x1b')](0x194);}return _0x467382;};}function handleError(_0x52f0cb,_0x12ad2c){_0x12ad2c=_0x12ad2c||0x1f4;return function(_0x393a19){logger[_0x529f('0x29')](_0x393a19[_0x529f('0x2a')]);if(_0x393a19['name']){delete _0x393a19['name'];}_0x52f0cb[_0x529f('0x1d')](_0x12ad2c)[_0x529f('0x2b')](_0x393a19);};}exports[_0x529f('0x2c')]=function(_0x52c2cb,_0x27f3fe){var _0x5489ab={},_0x59a8fc={},_0x320dd3={'count':0x0,'rows':[]};var _0x438102=_['map'](db[_0x529f('0x2d')][_0x529f('0x2e')],function(_0x1e004f){return{'name':_0x1e004f[_0x529f('0x2f')],'type':_0x1e004f[_0x529f('0x30')][_0x529f('0x31')]};});_0x59a8fc[_0x529f('0x32')]=_[_0x529f('0x33')](_0x438102,'name');_0x59a8fc[_0x529f('0x34')]=_[_0x529f('0x35')](_0x52c2cb['query']);_0x59a8fc[_0x529f('0x36')]=_[_0x529f('0x37')](_0x59a8fc[_0x529f('0x32')],_0x59a8fc[_0x529f('0x34')]);_0x5489ab[_0x529f('0x38')]=_[_0x529f('0x37')](_0x59a8fc[_0x529f('0x32')],qs['fields'](_0x52c2cb[_0x529f('0x34')][_0x529f('0x39')]));_0x5489ab['attributes']=_0x5489ab[_0x529f('0x38')][_0x529f('0x3a')]?_0x5489ab['attributes']:_0x59a8fc[_0x529f('0x32')];if(!_0x52c2cb[_0x529f('0x34')][_0x529f('0x3b')](_0x529f('0x3c'))){_0x5489ab[_0x529f('0x21')]=qs[_0x529f('0x21')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x21')]);_0x5489ab[_0x529f('0x20')]=qs[_0x529f('0x20')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x20')]);}_0x5489ab[_0x529f('0x3d')]=qs[_0x529f('0x3e')](_0x52c2cb[_0x529f('0x34')][_0x529f('0x3e')]);_0x5489ab[_0x529f('0x3f')]=qs[_0x529f('0x36')](_[_0x529f('0x40')](_0x52c2cb[_0x529f('0x34')],_0x59a8fc[_0x529f('0x36')]),_0x438102);if(_0x52c2cb[_0x529f('0x34')][_0x529f('0x41')]){_0x5489ab[_0x529f('0x3f')]=_['merge'](_0x5489ab[_0x529f('0x3f')],{'$or':_[_0x529f('0x33')](_0x438102,function(_0x30c8cc){if(_0x30c8cc[_0x529f('0x30')]!==_0x529f('0x42')){var _0x352ed1={};_0x352ed1[_0x30c8cc[_0x529f('0x43')]]={'$like':'%'+_0x52c2cb[_0x529f('0x34')][_0x529f('0x41')]+'%'};return _0x352ed1;}})});}_0x5489ab=_['merge']({},_0x5489ab,_0x52c2cb['options']);var _0x29920c={'where':_0x5489ab[_0x529f('0x3f')]};return db[_0x529f('0x2d')]['count'](_0x29920c)[_0x529f('0x26')](function(_0x5a7abc){_0x320dd3[_0x529f('0x1f')]=_0x5a7abc;if(_0x52c2cb[_0x529f('0x34')][_0x529f('0x44')]){_0x5489ab[_0x529f('0x45')]=[{'all':!![]}];}return db[_0x529f('0x2d')][_0x529f('0x46')](_0x5489ab);})[_0x529f('0x26')](function(_0x6f23d4){_0x320dd3[_0x529f('0x47')]=_0x6f23d4;return _0x320dd3;})[_0x529f('0x26')](respondWithFilteredResult(_0x27f3fe,_0x5489ab))[_0x529f('0x48')](handleError(_0x27f3fe,null));};exports[_0x529f('0x49')]=function(_0x2e6928,_0x7515f4){var _0x35a242={'raw':!![],'where':{'id':_0x2e6928[_0x529f('0x4a')]['id']}},_0x1310ec={};_0x1310ec[_0x529f('0x32')]=_[_0x529f('0x35')](db['UserMailInteraction'][_0x529f('0x2e')]);_0x1310ec['query']=_[_0x529f('0x35')](_0x2e6928[_0x529f('0x34')]);_0x1310ec[_0x529f('0x36')]=_[_0x529f('0x37')](_0x1310ec['model'],_0x1310ec[_0x529f('0x34')]);_0x35a242[_0x529f('0x38')]=_['intersection'](_0x1310ec[_0x529f('0x32')],qs['fields'](_0x2e6928[_0x529f('0x34')]['fields']));_0x35a242[_0x529f('0x38')]=_0x35a242[_0x529f('0x38')][_0x529f('0x3a')]?_0x35a242['attributes']:_0x1310ec[_0x529f('0x32')];if(_0x2e6928[_0x529f('0x34')][_0x529f('0x44')]){_0x35a242[_0x529f('0x45')]=[{'all':!![]}];}_0x35a242=_['merge']({},_0x35a242,_0x2e6928[_0x529f('0x4b')]);return db['UserMailInteraction']['find'](_0x35a242)[_0x529f('0x26')](handleEntityNotFound(_0x7515f4,null))[_0x529f('0x26')](respondWithResult(_0x7515f4,null))[_0x529f('0x48')](handleError(_0x7515f4,null));};exports['create']=function(_0x18ad4f,_0x4fe681){return db['UserMailInteraction'][_0x529f('0x4c')](_0x18ad4f[_0x529f('0x4d')],{})[_0x529f('0x26')](function(_0x55221f){var _0x67eb7f=_0x18ad4f['user']['get']({'plain':!![]});if(!_0x67eb7f)throw new Error(_0x529f('0x4e'));if(_0x67eb7f['role']===_0x529f('0x4f')){var _0x15b43a=_0x55221f['get']({'plain':!![]});var _0x33efc5=_0x529f('0x50');return db[_0x529f('0x51')]['find']({'where':{'name':_0x33efc5,'userProfileId':_0x67eb7f[_0x529f('0x52')]},'raw':!![]})[_0x529f('0x26')](function(_0x20d0d9){if(_0x20d0d9&&_0x20d0d9['autoAssociation']===0x0){return db[_0x529f('0x53')][_0x529f('0x4c')]({'name':_0x15b43a[_0x529f('0x43')],'resourceId':_0x15b43a['id'],'type':_0x20d0d9[_0x529f('0x43')],'sectionId':_0x20d0d9['id']},{})[_0x529f('0x26')](function(){return _0x55221f;});}else{return _0x55221f;}})['catch'](function(_0xb0e96d){logger[_0x529f('0x29')](_0x529f('0x54'),_0xb0e96d);throw _0xb0e96d;});}return _0x55221f;})['then'](respondWithResult(_0x4fe681,0xc9))['catch'](handleError(_0x4fe681,null));};exports[_0x529f('0x55')]=function(_0x567a3,_0x405213){if(_0x567a3[_0x529f('0x4d')]['id']){delete _0x567a3[_0x529f('0x4d')]['id'];}return db[_0x529f('0x2d')][_0x529f('0x56')]({'where':{'id':_0x567a3[_0x529f('0x4a')]['id']}})[_0x529f('0x26')](handleEntityNotFound(_0x405213,null))['then'](saveUpdates(_0x567a3[_0x529f('0x4d')],null))[_0x529f('0x26')](respondWithResult(_0x405213,null))[_0x529f('0x48')](handleError(_0x405213,null));};exports[_0x529f('0x27')]=function(_0x401161,_0x50382e){return db[_0x529f('0x2d')]['find']({'where':{'id':_0x401161['params']['id']}})[_0x529f('0x26')](handleEntityNotFound(_0x50382e,null))[_0x529f('0x26')](removeEntity(_0x50382e,null))['catch'](handleError(_0x50382e,null));}; \ No newline at end of file +var _0xa5ab=['update','destroy','get','UserMailInteractions','UserProfileResource','sendStatus','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','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','status','end','json','count','offset','limit','Content-Range','save'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0xa5ab,0x1d2));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xba5a('0x0'));var emlformat=require(_0xba5a('0x1'));var rimraf=require(_0xba5a('0x2'));var zipdir=require(_0xba5a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba5a('0x4'));var Mustache=require(_0xba5a('0x5'));var util=require(_0xba5a('0x6'));var path=require(_0xba5a('0x7'));var sox=require(_0xba5a('0x8'));var csv=require('to-csv');var ejs=require(_0xba5a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xba5a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xba5a('0xc'));var Papa=require(_0xba5a('0xd'));var Redis=require('ioredis');var authService=require(_0xba5a('0xe'));var qs=require(_0xba5a('0xf'));var as=require(_0xba5a('0x10'));var hardwareService=require(_0xba5a('0x11'));var logger=require(_0xba5a('0x12'))(_0xba5a('0x13'));var utils=require(_0xba5a('0x14'));var config=require(_0xba5a('0x15'));var licenseUtil=require(_0xba5a('0x16'));var db=require(_0xba5a('0x17'))['db'];function respondWithStatusCode(_0x20b7d4,_0x4c153e){_0x4c153e=_0x4c153e||0xcc;return function(_0x4eb034){if(_0x4eb034){return _0x20b7d4['sendStatus'](_0x4c153e);}return _0x20b7d4[_0xba5a('0x18')](_0x4c153e)[_0xba5a('0x19')]();};}function respondWithResult(_0x464c0c,_0x2807f4){_0x2807f4=_0x2807f4||0xc8;return function(_0x3a2d4a){if(_0x3a2d4a){return _0x464c0c['status'](_0x2807f4)[_0xba5a('0x1a')](_0x3a2d4a);}};}function respondWithFilteredResult(_0x17a0cf,_0x1b5239){return function(_0x457262){if(_0x457262){var _0x3b4f8f=_0x457262[_0xba5a('0x1b')],_0x3f4b6a=_0x1b5239[_0xba5a('0x1c')],_0x1d167b=_0x1b5239[_0xba5a('0x1c')]+_0x1b5239[_0xba5a('0x1d')],_0x85f071;if(_0x1d167b>=_0x3b4f8f){_0x1d167b=_0x3b4f8f;_0x85f071=0xc8;}else{_0x85f071=0xce;}_0x17a0cf[_0xba5a('0x18')](_0x85f071);return _0x17a0cf['set'](_0xba5a('0x1e'),_0x3f4b6a+'-'+_0x1d167b+'/'+_0x3b4f8f)['json'](_0x457262);}return null;};}function patchUpdates(_0x220a64){return function(_0x5b0284){try{jsonpatch['apply'](_0x5b0284,_0x220a64,!![]);}catch(_0x4d24d4){return BPromise['reject'](_0x4d24d4);}return _0x5b0284[_0xba5a('0x1f')]();};}function saveUpdates(_0x29f506,_0x1612ae){return function(_0x2eb1b6){if(_0x2eb1b6){return _0x2eb1b6[_0xba5a('0x20')](_0x29f506)['then'](function(_0x1f095c){return _0x1f095c;});}return null;};}function removeEntity(_0x4fcd1e,_0x5f4bb7){return function(_0x12b0b4){if(_0x12b0b4){return _0x12b0b4[_0xba5a('0x21')]()['then'](function(){var _0x11d521=_0x12b0b4[_0xba5a('0x22')]({'plain':!![]});var _0x49c217=_0xba5a('0x23');return db[_0xba5a('0x24')][_0xba5a('0x21')]({'where':{'type':_0x49c217,'resourceId':_0x11d521['id']}})['then'](function(){return _0x12b0b4;});})['then'](function(){_0x4fcd1e[_0xba5a('0x18')](0xcc)[_0xba5a('0x19')]();});}};}function handleEntityNotFound(_0x1a0a3e,_0x514163){return function(_0x23d5ce){if(!_0x23d5ce){_0x1a0a3e[_0xba5a('0x25')](0x194);}return _0x23d5ce;};}function handleError(_0x30a45c,_0x5c7a42){_0x5c7a42=_0x5c7a42||0x1f4;return function(_0x397e0e){logger[_0xba5a('0x26')](_0x397e0e[_0xba5a('0x27')]);if(_0x397e0e[_0xba5a('0x28')]){delete _0x397e0e['name'];}_0x30a45c[_0xba5a('0x18')](_0x5c7a42)[_0xba5a('0x29')](_0x397e0e);};}exports[_0xba5a('0x2a')]=function(_0x184a83,_0x83da11){var _0x637a1e={},_0x372a93={},_0x1a7bb0={'count':0x0,'rows':[]};var _0x314e12=_['map'](db[_0xba5a('0x2b')][_0xba5a('0x2c')],function(_0x388a1e){return{'name':_0x388a1e[_0xba5a('0x2d')],'type':_0x388a1e[_0xba5a('0x2e')][_0xba5a('0x2f')]};});_0x372a93[_0xba5a('0x30')]=_[_0xba5a('0x31')](_0x314e12,_0xba5a('0x28'));_0x372a93[_0xba5a('0x32')]=_[_0xba5a('0x33')](_0x184a83[_0xba5a('0x32')]);_0x372a93[_0xba5a('0x34')]=_[_0xba5a('0x35')](_0x372a93[_0xba5a('0x30')],_0x372a93[_0xba5a('0x32')]);_0x637a1e[_0xba5a('0x36')]=_[_0xba5a('0x35')](_0x372a93[_0xba5a('0x30')],qs['fields'](_0x184a83[_0xba5a('0x32')][_0xba5a('0x37')]));_0x637a1e[_0xba5a('0x36')]=_0x637a1e[_0xba5a('0x36')][_0xba5a('0x38')]?_0x637a1e[_0xba5a('0x36')]:_0x372a93[_0xba5a('0x30')];if(!_0x184a83['query'][_0xba5a('0x39')](_0xba5a('0x3a'))){_0x637a1e[_0xba5a('0x1d')]=qs[_0xba5a('0x1d')](_0x184a83[_0xba5a('0x32')][_0xba5a('0x1d')]);_0x637a1e[_0xba5a('0x1c')]=qs['offset'](_0x184a83[_0xba5a('0x32')]['offset']);}_0x637a1e[_0xba5a('0x3b')]=qs['sort'](_0x184a83[_0xba5a('0x32')][_0xba5a('0x3c')]);_0x637a1e[_0xba5a('0x3d')]=qs[_0xba5a('0x34')](_[_0xba5a('0x3e')](_0x184a83[_0xba5a('0x32')],_0x372a93[_0xba5a('0x34')]),_0x314e12);if(_0x184a83[_0xba5a('0x32')][_0xba5a('0x3f')]){_0x637a1e[_0xba5a('0x3d')]=_[_0xba5a('0x40')](_0x637a1e[_0xba5a('0x3d')],{'$or':_[_0xba5a('0x31')](_0x314e12,function(_0x1eab99){if(_0x1eab99[_0xba5a('0x2e')]!==_0xba5a('0x41')){var _0x354a48={};_0x354a48[_0x1eab99['name']]={'$like':'%'+_0x184a83[_0xba5a('0x32')]['filter']+'%'};return _0x354a48;}})});}_0x637a1e=_[_0xba5a('0x40')]({},_0x637a1e,_0x184a83[_0xba5a('0x42')]);var _0x3097db={'where':_0x637a1e[_0xba5a('0x3d')]};return db[_0xba5a('0x2b')]['count'](_0x3097db)[_0xba5a('0x43')](function(_0x254b6e){_0x1a7bb0[_0xba5a('0x1b')]=_0x254b6e;if(_0x184a83[_0xba5a('0x32')][_0xba5a('0x44')]){_0x637a1e[_0xba5a('0x45')]=[{'all':!![]}];}return db[_0xba5a('0x2b')]['findAll'](_0x637a1e);})[_0xba5a('0x43')](function(_0x3959dc){_0x1a7bb0[_0xba5a('0x46')]=_0x3959dc;return _0x1a7bb0;})[_0xba5a('0x43')](respondWithFilteredResult(_0x83da11,_0x637a1e))[_0xba5a('0x47')](handleError(_0x83da11,null));};exports[_0xba5a('0x48')]=function(_0x4bcde0,_0x5962ab){var _0x5917ea={'raw':!![],'where':{'id':_0x4bcde0['params']['id']}},_0x3f899e={};_0x3f899e[_0xba5a('0x30')]=_['keys'](db[_0xba5a('0x2b')][_0xba5a('0x2c')]);_0x3f899e[_0xba5a('0x32')]=_['keys'](_0x4bcde0[_0xba5a('0x32')]);_0x3f899e[_0xba5a('0x34')]=_[_0xba5a('0x35')](_0x3f899e['model'],_0x3f899e[_0xba5a('0x32')]);_0x5917ea[_0xba5a('0x36')]=_[_0xba5a('0x35')](_0x3f899e['model'],qs[_0xba5a('0x37')](_0x4bcde0[_0xba5a('0x32')][_0xba5a('0x37')]));_0x5917ea[_0xba5a('0x36')]=_0x5917ea[_0xba5a('0x36')][_0xba5a('0x38')]?_0x5917ea[_0xba5a('0x36')]:_0x3f899e[_0xba5a('0x30')];if(_0x4bcde0[_0xba5a('0x32')][_0xba5a('0x44')]){_0x5917ea[_0xba5a('0x45')]=[{'all':!![]}];}_0x5917ea=_['merge']({},_0x5917ea,_0x4bcde0[_0xba5a('0x42')]);return db[_0xba5a('0x2b')][_0xba5a('0x49')](_0x5917ea)[_0xba5a('0x43')](handleEntityNotFound(_0x5962ab,null))['then'](respondWithResult(_0x5962ab,null))[_0xba5a('0x47')](handleError(_0x5962ab,null));};exports[_0xba5a('0x4a')]=function(_0x3d3f3a,_0x2c880f){return db[_0xba5a('0x2b')][_0xba5a('0x4a')](_0x3d3f3a[_0xba5a('0x4b')],{})[_0xba5a('0x43')](function(_0x1fecc6){var _0x567834=_0x3d3f3a[_0xba5a('0x4c')][_0xba5a('0x22')]({'plain':!![]});if(!_0x567834)throw new Error(_0xba5a('0x4d'));if(_0x567834['role']===_0xba5a('0x4c')){var _0x5c3c0b=_0x1fecc6[_0xba5a('0x22')]({'plain':!![]});var _0x2ea016='UserMailInteractions';return db[_0xba5a('0x4e')]['find']({'where':{'name':_0x2ea016,'userProfileId':_0x567834[_0xba5a('0x4f')]},'raw':!![]})[_0xba5a('0x43')](function(_0x4ad193){if(_0x4ad193&&_0x4ad193[_0xba5a('0x50')]===0x0){return db['UserProfileResource'][_0xba5a('0x4a')]({'name':_0x5c3c0b[_0xba5a('0x28')],'resourceId':_0x5c3c0b['id'],'type':_0x4ad193['name'],'sectionId':_0x4ad193['id']},{})[_0xba5a('0x43')](function(){return _0x1fecc6;});}else{return _0x1fecc6;}})[_0xba5a('0x47')](function(_0x221c7c){logger['error'](_0xba5a('0x51'),_0x221c7c);throw _0x221c7c;});}return _0x1fecc6;})[_0xba5a('0x43')](respondWithResult(_0x2c880f,0xc9))[_0xba5a('0x47')](handleError(_0x2c880f,null));};exports[_0xba5a('0x20')]=function(_0x167410,_0x4bf308){if(_0x167410[_0xba5a('0x4b')]['id']){delete _0x167410[_0xba5a('0x4b')]['id'];}return db['UserMailInteraction'][_0xba5a('0x49')]({'where':{'id':_0x167410[_0xba5a('0x52')]['id']}})[_0xba5a('0x43')](handleEntityNotFound(_0x4bf308,null))[_0xba5a('0x43')](saveUpdates(_0x167410[_0xba5a('0x4b')],null))[_0xba5a('0x43')](respondWithResult(_0x4bf308,null))['catch'](handleError(_0x4bf308,null));};exports['destroy']=function(_0x4bbed5,_0x4d4daf){return db[_0xba5a('0x2b')][_0xba5a('0x49')]({'where':{'id':_0x4bbed5[_0xba5a('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d4daf,null))[_0xba5a('0x43')](removeEntity(_0x4d4daf,null))[_0xba5a('0x47')](handleError(_0x4d4daf,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 73b31ba..0c1004f 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 _0x7184=['../../config/environment','exports','UserMailInteraction','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x482020,_0x1ad206){var _0x337dc1=function(_0xe23d3){while(--_0xe23d3){_0x482020['push'](_0x482020['shift']());}};_0x337dc1(++_0x1ad206);}(_0x7184,0xd5));var _0x4718=function(_0x130b30,_0x3d45b6){_0x130b30=_0x130b30-0x0;var _0x1b9f34=_0x7184[_0x130b30];return _0x1b9f34;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var logger=require('../../config/logger')(_0x4718('0x2'));var moment=require('moment');var BPromise=require(_0x4718('0x3'));var rp=require(_0x4718('0x4'));var fs=require('fs');var path=require(_0x4718('0x5'));var rimraf=require(_0x4718('0x6'));var config=require(_0x4718('0x7'));var attributes=require('./UserMailInteraction.attributes');module[_0x4718('0x8')]=function(_0x3a47db,_0x41db3d){return _0x3a47db['define'](_0x4718('0x9'),attributes,{'tableName':'user_has_mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd2=['./UserMailInteraction.attributes','exports','define','UserMailInteraction','user_has_mail_interactions','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x287520,_0x3dea8e){var _0x58df35=function(_0xc72b88){while(--_0xc72b88){_0x287520['push'](_0x287520['shift']());}};_0x58df35(++_0x3dea8e);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require('../../config/logger')(_0x2cdd('0x2'));var moment=require('moment');var BPromise=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var fs=require('fs');var path=require(_0x2cdd('0x5'));var rimraf=require('rimraf');var config=require(_0x2cdd('0x6'));var attributes=require(_0x2cdd('0x7'));module[_0x2cdd('0x8')]=function(_0x1afa82,_0xc4bd9b){return _0x1afa82[_0x2cdd('0x9')](_0x2cdd('0xa'),attributes,{'tableName':_0x2cdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index f38b682..8ad2886 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 _0xfab0=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash'];(function(_0x1d4c5f,_0x51d3d6){var _0x505a59=function(_0x5eea33){while(--_0x5eea33){_0x1d4c5f['push'](_0x1d4c5f['shift']());}};_0x505a59(++_0x51d3d6);}(_0xfab0,0x1df));var _0x0fab=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xfab0[_0x15fc7a];return _0x3aa9f4;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var moment=require(_0x0fab('0x2'));var BPromise=require(_0x0fab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fab('0x4'));var db=require(_0x0fab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fab('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fab('0x7')][_0x0fab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5819af,_0x1c133c,_0x4bb6c5){return new BPromise(function(_0x56da66,_0x22aef6){return client[_0x0fab('0x9')](_0x5819af,_0x4bb6c5)[_0x0fab('0xa')](function(_0x1e1f18){logger[_0x0fab('0xb')](_0x0fab('0xc'),_0x1c133c,_0x0fab('0xd'));logger[_0x0fab('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x1c133c,'request\x20sent',JSON['stringify'](_0x1e1f18));if(_0x1e1f18['error']){if(_0x1e1f18['error'][_0x0fab('0xf')]===0x1f4){logger[_0x0fab('0x10')](_0x0fab('0xc'),_0x1c133c,_0x1e1f18['error'][_0x0fab('0x11')]);return _0x22aef6(_0x1e1f18[_0x0fab('0x10')]['message']);}logger['error']('UserMailInteraction,\x20%s,\x20%s',_0x1c133c,_0x1e1f18[_0x0fab('0x10')][_0x0fab('0x11')]);return _0x56da66(_0x1e1f18[_0x0fab('0x10')]['message']);}else{logger[_0x0fab('0xb')](_0x0fab('0xc'),_0x1c133c,_0x0fab('0xd'));_0x56da66(_0x1e1f18[_0x0fab('0x12')][_0x0fab('0x11')]);}})[_0x0fab('0x13')](function(_0x32096f){logger[_0x0fab('0x10')](_0x0fab('0xc'),_0x1c133c,_0x32096f);_0x22aef6(_0x32096f);});});} \ No newline at end of file +var _0x84a5=['http','request','then','info','UserMailInteraction,\x20%s,\x20%s','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x24b88f,_0x22ea38){var _0x34a652=function(_0xa0fb48){while(--_0xa0fb48){_0x24b88f['push'](_0x24b88f['shift']());}};_0x34a652(++_0x22ea38);}(_0x84a5,0x165));var _0x584a=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x84a5[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x584a('0x0'));var moment=require(_0x584a('0x1'));var BPromise=require(_0x584a('0x2'));var rs=require(_0x584a('0x3'));var fs=require('fs');var Redis=require(_0x584a('0x4'));var db=require(_0x584a('0x5'))['db'];var utils=require(_0x584a('0x6'));var logger=require(_0x584a('0x7'))(_0x584a('0x8'));var config=require(_0x584a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x584a('0xa')][_0x584a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194acd,_0x570bc1,_0x20f79d){return new BPromise(function(_0x26ede3,_0x24a33a){return client[_0x584a('0xc')](_0x194acd,_0x20f79d)[_0x584a('0xd')](function(_0x7fb568){logger[_0x584a('0xe')](_0x584a('0xf'),_0x570bc1,'request\x20sent');logger[_0x584a('0x10')](_0x584a('0x11'),_0x570bc1,_0x584a('0x12'),JSON['stringify'](_0x7fb568));if(_0x7fb568[_0x584a('0x13')]){if(_0x7fb568[_0x584a('0x13')]['code']===0x1f4){logger[_0x584a('0x13')]('UserMailInteraction,\x20%s,\x20%s',_0x570bc1,_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);return _0x24a33a(_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);}logger[_0x584a('0x13')](_0x584a('0xf'),_0x570bc1,_0x7fb568[_0x584a('0x13')]['message']);return _0x26ede3(_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);}else{logger[_0x584a('0xe')](_0x584a('0xf'),_0x570bc1,'request\x20sent');_0x26ede3(_0x7fb568[_0x584a('0x15')][_0x584a('0x14')]);}})[_0x584a('0x16')](function(_0x3c0aca){logger[_0x584a('0x13')](_0x584a('0xf'),_0x570bc1,_0x3c0aca);_0x24a33a(_0x3c0aca);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 804e099..db1bee6 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 _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0xa79875,_0x7fed99){var _0x5ef5a1=function(_0x5f311a){while(--_0x5f311a){_0xa79875['push'](_0xa79875['shift']());}};_0x5ef5a1(++_0x7fed99);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x749e18,_0x5a2155){_0x749e18=_0x749e18-0x0;var _0x561ddb=_0xbd51[_0x749e18];return _0x561ddb;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserMailInteraction.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0xf9e2e7,_0x5aa9dd){var _0x721206=function(_0xc736b){while(--_0xc736b){_0xf9e2e7['push'](_0xf9e2e7['shift']());}};_0x721206(++_0x5aa9dd);}(_0x7a54,0x106));var _0x47a5=function(_0x2cedb4,_0x16ca9d){_0x2cedb4=_0x2cedb4-0x0;var _0x3a2c6e=_0x7a54[_0x2cedb4];return _0x3a2c6e;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 08c6dde..1a158af 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 _0x7898=['sequelize','INTEGER'];(function(_0x183873,_0x4a3e41){var _0x310f03=function(_0x2aad40){while(--_0x2aad40){_0x183873['push'](_0x183873['shift']());}};_0x310f03(++_0x4a3e41);}(_0x7898,0x160));var _0x8789=function(_0x2f9849,_0x209c0e){_0x2f9849=_0x2f9849-0x0;var _0x1aefac=_0x7898[_0x2f9849];return _0x1aefac;};'use strict';var Sequelize=require(_0x8789('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0x8789('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x8789('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x8d39=['INTEGER'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8d39,0x108));var _0x98d3=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x8d39[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0x98d3('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x98d3('0x0')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 3a20e69..cc28e85 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 _0x9ef7=['params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','UserOpenchannelInteraction','UserProfileResource','stack','name','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x5789d2,_0x3dc359){var _0x168a71=function(_0x9a3d59){while(--_0x9a3d59){_0x5789d2['push'](_0x5789d2['shift']());}};_0x168a71(++_0x3dc359);}(_0x9ef7,0x151));var _0x79ef=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x9ef7[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0x79ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x79ef('0x1'));var zipdir=require(_0x79ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79ef('0x3'));var moment=require(_0x79ef('0x4'));var BPromise=require(_0x79ef('0x5'));var Mustache=require(_0x79ef('0x6'));var util=require('util');var path=require(_0x79ef('0x7'));var sox=require('sox');var csv=require(_0x79ef('0x8'));var ejs=require(_0x79ef('0x9'));var fs=require('fs');var _=require(_0x79ef('0xa'));var squel=require('squel');var crypto=require(_0x79ef('0xb'));var jsforce=require(_0x79ef('0xc'));var deskjs=require(_0x79ef('0xd'));var toCsv=require(_0x79ef('0x8'));var querystring=require(_0x79ef('0xe'));var Papa=require(_0x79ef('0xf'));var Redis=require(_0x79ef('0x10'));var authService=require(_0x79ef('0x11'));var qs=require(_0x79ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79ef('0x13'));var logger=require(_0x79ef('0x14'))(_0x79ef('0x15'));var utils=require(_0x79ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79ef('0x17'));var db=require(_0x79ef('0x18'))['db'];function respondWithStatusCode(_0x4c9ce3,_0x140e64){_0x140e64=_0x140e64||0xcc;return function(_0xfc4abc){if(_0xfc4abc){return _0x4c9ce3[_0x79ef('0x19')](_0x140e64);}return _0x4c9ce3[_0x79ef('0x1a')](_0x140e64)[_0x79ef('0x1b')]();};}function respondWithResult(_0x5b3942,_0x14f257){_0x14f257=_0x14f257||0xc8;return function(_0x380f54){if(_0x380f54){return _0x5b3942['status'](_0x14f257)[_0x79ef('0x1c')](_0x380f54);}};}function respondWithFilteredResult(_0x4fe831,_0x1a55a9){return function(_0x257430){if(_0x257430){var _0x45f653=_0x257430[_0x79ef('0x1d')],_0x2e2326=_0x1a55a9['offset'],_0x167d30=_0x1a55a9[_0x79ef('0x1e')]+_0x1a55a9[_0x79ef('0x1f')],_0x53550b;if(_0x167d30>=_0x45f653){_0x167d30=_0x45f653;_0x53550b=0xc8;}else{_0x53550b=0xce;}_0x4fe831[_0x79ef('0x1a')](_0x53550b);return _0x4fe831['set'](_0x79ef('0x20'),_0x2e2326+'-'+_0x167d30+'/'+_0x45f653)[_0x79ef('0x1c')](_0x257430);}return null;};}function patchUpdates(_0x3bcff4){return function(_0x422a4a){try{jsonpatch[_0x79ef('0x21')](_0x422a4a,_0x3bcff4,!![]);}catch(_0x2a95a0){return BPromise['reject'](_0x2a95a0);}return _0x422a4a['save']();};}function saveUpdates(_0x2da92d,_0x361539){return function(_0xaed950){if(_0xaed950){return _0xaed950[_0x79ef('0x22')](_0x2da92d)[_0x79ef('0x23')](function(_0x54132a){return _0x54132a;});}return null;};}function removeEntity(_0x49e3fe,_0x2c2716){return function(_0x14b32f){if(_0x14b32f){return _0x14b32f[_0x79ef('0x24')]()[_0x79ef('0x23')](function(){var _0x41eb86=_0x14b32f[_0x79ef('0x25')]({'plain':!![]});var _0x1e842f=_0x79ef('0x26');return db[_0x79ef('0x27')][_0x79ef('0x24')]({'where':{'type':_0x1e842f,'resourceId':_0x41eb86['id']}})[_0x79ef('0x23')](function(){return _0x14b32f;});})[_0x79ef('0x23')](function(){_0x49e3fe['status'](0xcc)[_0x79ef('0x1b')]();});}};}function handleEntityNotFound(_0x58071a,_0x5bbbc1){return function(_0x59a934){if(!_0x59a934){_0x58071a[_0x79ef('0x19')](0x194);}return _0x59a934;};}function handleError(_0x541657,_0x222d37){_0x222d37=_0x222d37||0x1f4;return function(_0x4b1a03){logger['error'](_0x4b1a03[_0x79ef('0x28')]);if(_0x4b1a03[_0x79ef('0x29')]){delete _0x4b1a03[_0x79ef('0x29')];}_0x541657['status'](_0x222d37)['send'](_0x4b1a03);};}exports['index']=function(_0x4bfaf2,_0x296e4d){var _0x53aadb={},_0x479dee={},_0x377be4={'count':0x0,'rows':[]};var _0x38bc23=_['map'](db[_0x79ef('0x26')][_0x79ef('0x2a')],function(_0x27e9ea){return{'name':_0x27e9ea[_0x79ef('0x2b')],'type':_0x27e9ea[_0x79ef('0x2c')][_0x79ef('0x2d')]};});_0x479dee['model']=_[_0x79ef('0x2e')](_0x38bc23,_0x79ef('0x29'));_0x479dee[_0x79ef('0x2f')]=_[_0x79ef('0x30')](_0x4bfaf2[_0x79ef('0x2f')]);_0x479dee['filters']=_[_0x79ef('0x31')](_0x479dee['model'],_0x479dee[_0x79ef('0x2f')]);_0x53aadb[_0x79ef('0x32')]=_[_0x79ef('0x31')](_0x479dee[_0x79ef('0x33')],qs[_0x79ef('0x34')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x34')]));_0x53aadb[_0x79ef('0x32')]=_0x53aadb[_0x79ef('0x32')]['length']?_0x53aadb[_0x79ef('0x32')]:_0x479dee[_0x79ef('0x33')];if(!_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x35')](_0x79ef('0x36'))){_0x53aadb[_0x79ef('0x1f')]=qs[_0x79ef('0x1f')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x1f')]);_0x53aadb[_0x79ef('0x1e')]=qs[_0x79ef('0x1e')](_0x4bfaf2['query'][_0x79ef('0x1e')]);}_0x53aadb[_0x79ef('0x37')]=qs[_0x79ef('0x38')](_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x38')]);_0x53aadb[_0x79ef('0x39')]=qs[_0x79ef('0x3a')](_['pick'](_0x4bfaf2[_0x79ef('0x2f')],_0x479dee[_0x79ef('0x3a')]),_0x38bc23);if(_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x3b')]){_0x53aadb[_0x79ef('0x39')]=_[_0x79ef('0x3c')](_0x53aadb[_0x79ef('0x39')],{'$or':_['map'](_0x38bc23,function(_0x447d73){if(_0x447d73['type']!==_0x79ef('0x3d')){var _0x533637={};_0x533637[_0x447d73[_0x79ef('0x29')]]={'$like':'%'+_0x4bfaf2['query'][_0x79ef('0x3b')]+'%'};return _0x533637;}})});}_0x53aadb=_['merge']({},_0x53aadb,_0x4bfaf2[_0x79ef('0x3e')]);var _0x39d140={'where':_0x53aadb[_0x79ef('0x39')]};return db[_0x79ef('0x26')][_0x79ef('0x1d')](_0x39d140)[_0x79ef('0x23')](function(_0x1fa1fd){_0x377be4[_0x79ef('0x1d')]=_0x1fa1fd;if(_0x4bfaf2[_0x79ef('0x2f')][_0x79ef('0x3f')]){_0x53aadb['include']=[{'all':!![]}];}return db[_0x79ef('0x26')][_0x79ef('0x40')](_0x53aadb);})['then'](function(_0x337370){_0x377be4[_0x79ef('0x41')]=_0x337370;return _0x377be4;})['then'](respondWithFilteredResult(_0x296e4d,_0x53aadb))[_0x79ef('0x42')](handleError(_0x296e4d,null));};exports[_0x79ef('0x43')]=function(_0x36536f,_0x3b2bcd){var _0x49f0b6={'raw':!![],'where':{'id':_0x36536f[_0x79ef('0x44')]['id']}},_0x5cb3db={};_0x5cb3db[_0x79ef('0x33')]=_['keys'](db[_0x79ef('0x26')][_0x79ef('0x2a')]);_0x5cb3db[_0x79ef('0x2f')]=_[_0x79ef('0x30')](_0x36536f[_0x79ef('0x2f')]);_0x5cb3db['filters']=_['intersection'](_0x5cb3db[_0x79ef('0x33')],_0x5cb3db[_0x79ef('0x2f')]);_0x49f0b6['attributes']=_[_0x79ef('0x31')](_0x5cb3db[_0x79ef('0x33')],qs[_0x79ef('0x34')](_0x36536f[_0x79ef('0x2f')][_0x79ef('0x34')]));_0x49f0b6[_0x79ef('0x32')]=_0x49f0b6[_0x79ef('0x32')]['length']?_0x49f0b6[_0x79ef('0x32')]:_0x5cb3db['model'];if(_0x36536f['query'][_0x79ef('0x3f')]){_0x49f0b6[_0x79ef('0x45')]=[{'all':!![]}];}_0x49f0b6=_[_0x79ef('0x3c')]({},_0x49f0b6,_0x36536f[_0x79ef('0x3e')]);return db[_0x79ef('0x26')][_0x79ef('0x46')](_0x49f0b6)['then'](handleEntityNotFound(_0x3b2bcd,null))[_0x79ef('0x23')](respondWithResult(_0x3b2bcd,null))['catch'](handleError(_0x3b2bcd,null));};exports[_0x79ef('0x47')]=function(_0x4087f2,_0x1d3aaa){return db['UserOpenchannelInteraction']['create'](_0x4087f2[_0x79ef('0x48')],{})['then'](function(_0x3d8715){var _0x1e4b90=_0x4087f2[_0x79ef('0x49')][_0x79ef('0x25')]({'plain':!![]});if(!_0x1e4b90)throw new Error(_0x79ef('0x4a'));if(_0x1e4b90[_0x79ef('0x4b')]==='user'){var _0x1f5775=_0x3d8715[_0x79ef('0x25')]({'plain':!![]});var _0x39d0be=_0x79ef('0x26');return db[_0x79ef('0x4c')]['find']({'where':{'name':_0x39d0be,'userProfileId':_0x1e4b90[_0x79ef('0x4d')]},'raw':!![]})[_0x79ef('0x23')](function(_0x1b178e){if(_0x1b178e&&_0x1b178e[_0x79ef('0x4e')]===0x0){return db[_0x79ef('0x27')][_0x79ef('0x47')]({'name':_0x1f5775[_0x79ef('0x29')],'resourceId':_0x1f5775['id'],'type':_0x1b178e[_0x79ef('0x29')],'sectionId':_0x1b178e['id']},{})[_0x79ef('0x23')](function(){return _0x3d8715;});}else{return _0x3d8715;}})[_0x79ef('0x42')](function(_0x1edd56){logger[_0x79ef('0x4f')](_0x79ef('0x50'),_0x1edd56);throw _0x1edd56;});}return _0x3d8715;})['then'](respondWithResult(_0x1d3aaa,0xc9))[_0x79ef('0x42')](handleError(_0x1d3aaa,null));};exports[_0x79ef('0x22')]=function(_0x3b7774,_0x4a4e7b){if(_0x3b7774['body']['id']){delete _0x3b7774['body']['id'];}return db[_0x79ef('0x26')]['find']({'where':{'id':_0x3b7774[_0x79ef('0x44')]['id']}})[_0x79ef('0x23')](handleEntityNotFound(_0x4a4e7b,null))[_0x79ef('0x23')](saveUpdates(_0x3b7774[_0x79ef('0x48')],null))[_0x79ef('0x23')](respondWithResult(_0x4a4e7b,null))[_0x79ef('0x42')](handleError(_0x4a4e7b,null));};exports[_0x79ef('0x24')]=function(_0x3d39ca,_0x1ad544){return db[_0x79ef('0x26')][_0x79ef('0x46')]({'where':{'id':_0x3d39ca['params']['id']}})[_0x79ef('0x23')](handleEntityNotFound(_0x1ad544,null))['then'](removeEntity(_0x1ad544,null))[_0x79ef('0x42')](handleError(_0x1ad544,null));}; \ No newline at end of file +var _0x89f7=['filter','merge','VIRTUAL','options','UserOpenchannelInteraction','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','json','reject','save','update','then','get','sendStatus','stack','name','send','index','map','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x5b7a8a,_0xb3bfe3){var _0xd2094e=function(_0x3547de){while(--_0x3547de){_0x5b7a8a['push'](_0x5b7a8a['shift']());}};_0xd2094e(++_0xb3bfe3);}(_0x89f7,0x105));var _0x789f=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x89f7[_0x7791d5];return _0x5ce288;};'use strict';var pdf=require(_0x789f('0x0'));var emlformat=require(_0x789f('0x1'));var rimraf=require(_0x789f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x789f('0x3'));var rp=require('request-promise');var moment=require(_0x789f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x789f('0x5'));var util=require(_0x789f('0x6'));var path=require(_0x789f('0x7'));var sox=require(_0x789f('0x8'));var csv=require('to-csv');var ejs=require(_0x789f('0x9'));var fs=require('fs');var _=require(_0x789f('0xa'));var squel=require(_0x789f('0xb'));var crypto=require(_0x789f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789f('0xd'));var querystring=require(_0x789f('0xe'));var Papa=require(_0x789f('0xf'));var Redis=require('ioredis');var authService=require(_0x789f('0x10'));var qs=require(_0x789f('0x11'));var as=require(_0x789f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x789f('0x13'));var licenseUtil=require(_0x789f('0x14'));var db=require(_0x789f('0x15'))['db'];function respondWithStatusCode(_0x137c31,_0x8819db){_0x8819db=_0x8819db||0xcc;return function(_0x3c9259){if(_0x3c9259){return _0x137c31['sendStatus'](_0x8819db);}return _0x137c31[_0x789f('0x16')](_0x8819db)[_0x789f('0x17')]();};}function respondWithResult(_0x103241,_0xe767ad){_0xe767ad=_0xe767ad||0xc8;return function(_0x4c16cb){if(_0x4c16cb){return _0x103241[_0x789f('0x16')](_0xe767ad)['json'](_0x4c16cb);}};}function respondWithFilteredResult(_0x7fd299,_0x511ca4){return function(_0x51207b){if(_0x51207b){var _0x264258=_0x51207b[_0x789f('0x18')],_0x1223ac=_0x511ca4[_0x789f('0x19')],_0x2d6055=_0x511ca4[_0x789f('0x19')]+_0x511ca4['limit'],_0x137f51;if(_0x2d6055>=_0x264258){_0x2d6055=_0x264258;_0x137f51=0xc8;}else{_0x137f51=0xce;}_0x7fd299[_0x789f('0x16')](_0x137f51);return _0x7fd299[_0x789f('0x1a')](_0x789f('0x1b'),_0x1223ac+'-'+_0x2d6055+'/'+_0x264258)[_0x789f('0x1c')](_0x51207b);}return null;};}function patchUpdates(_0x2d60b3){return function(_0xe4bb84){try{jsonpatch['apply'](_0xe4bb84,_0x2d60b3,!![]);}catch(_0xa3bcb4){return BPromise[_0x789f('0x1d')](_0xa3bcb4);}return _0xe4bb84[_0x789f('0x1e')]();};}function saveUpdates(_0x5f2999,_0x2b2ab0){return function(_0x3b4743){if(_0x3b4743){return _0x3b4743[_0x789f('0x1f')](_0x5f2999)[_0x789f('0x20')](function(_0x3bb029){return _0x3bb029;});}return null;};}function removeEntity(_0x590d01,_0x2611d8){return function(_0x162855){if(_0x162855){return _0x162855['destroy']()[_0x789f('0x20')](function(){var _0xf9781f=_0x162855[_0x789f('0x21')]({'plain':!![]});var _0x8e445f='UserOpenchannelInteraction';return db['UserProfileResource']['destroy']({'where':{'type':_0x8e445f,'resourceId':_0xf9781f['id']}})[_0x789f('0x20')](function(){return _0x162855;});})[_0x789f('0x20')](function(){_0x590d01['status'](0xcc)[_0x789f('0x17')]();});}};}function handleEntityNotFound(_0x435293,_0x726a09){return function(_0x509736){if(!_0x509736){_0x435293[_0x789f('0x22')](0x194);}return _0x509736;};}function handleError(_0x3a831d,_0x4307f7){_0x4307f7=_0x4307f7||0x1f4;return function(_0x4344ea){logger['error'](_0x4344ea[_0x789f('0x23')]);if(_0x4344ea[_0x789f('0x24')]){delete _0x4344ea[_0x789f('0x24')];}_0x3a831d[_0x789f('0x16')](_0x4307f7)[_0x789f('0x25')](_0x4344ea);};}exports[_0x789f('0x26')]=function(_0x5141e5,_0x33c4b8){var _0x3fe22b={},_0x6c6859={},_0x1dca2b={'count':0x0,'rows':[]};var _0x3a2a12=_[_0x789f('0x27')](db['UserOpenchannelInteraction']['rawAttributes'],function(_0x1e1421){return{'name':_0x1e1421['fieldName'],'type':_0x1e1421[_0x789f('0x28')]['key']};});_0x6c6859[_0x789f('0x29')]=_[_0x789f('0x27')](_0x3a2a12,_0x789f('0x24'));_0x6c6859[_0x789f('0x2a')]=_[_0x789f('0x2b')](_0x5141e5[_0x789f('0x2a')]);_0x6c6859[_0x789f('0x2c')]=_['intersection'](_0x6c6859[_0x789f('0x29')],_0x6c6859['query']);_0x3fe22b[_0x789f('0x2d')]=_['intersection'](_0x6c6859[_0x789f('0x29')],qs[_0x789f('0x2e')](_0x5141e5[_0x789f('0x2a')][_0x789f('0x2e')]));_0x3fe22b[_0x789f('0x2d')]=_0x3fe22b[_0x789f('0x2d')][_0x789f('0x2f')]?_0x3fe22b['attributes']:_0x6c6859[_0x789f('0x29')];if(!_0x5141e5[_0x789f('0x2a')][_0x789f('0x30')](_0x789f('0x31'))){_0x3fe22b[_0x789f('0x32')]=qs[_0x789f('0x32')](_0x5141e5['query']['limit']);_0x3fe22b[_0x789f('0x19')]=qs[_0x789f('0x19')](_0x5141e5['query'][_0x789f('0x19')]);}_0x3fe22b[_0x789f('0x33')]=qs['sort'](_0x5141e5[_0x789f('0x2a')][_0x789f('0x34')]);_0x3fe22b[_0x789f('0x35')]=qs['filters'](_[_0x789f('0x36')](_0x5141e5[_0x789f('0x2a')],_0x6c6859[_0x789f('0x2c')]),_0x3a2a12);if(_0x5141e5['query'][_0x789f('0x37')]){_0x3fe22b['where']=_[_0x789f('0x38')](_0x3fe22b['where'],{'$or':_[_0x789f('0x27')](_0x3a2a12,function(_0x20a414){if(_0x20a414[_0x789f('0x28')]!==_0x789f('0x39')){var _0x56ab24={};_0x56ab24[_0x20a414['name']]={'$like':'%'+_0x5141e5[_0x789f('0x2a')][_0x789f('0x37')]+'%'};return _0x56ab24;}})});}_0x3fe22b=_[_0x789f('0x38')]({},_0x3fe22b,_0x5141e5[_0x789f('0x3a')]);var _0x13710e={'where':_0x3fe22b[_0x789f('0x35')]};return db[_0x789f('0x3b')][_0x789f('0x18')](_0x13710e)[_0x789f('0x20')](function(_0x4b99c3){_0x1dca2b[_0x789f('0x18')]=_0x4b99c3;if(_0x5141e5[_0x789f('0x2a')]['includeAll']){_0x3fe22b[_0x789f('0x3c')]=[{'all':!![]}];}return db[_0x789f('0x3b')][_0x789f('0x3d')](_0x3fe22b);})['then'](function(_0x2f4ad9){_0x1dca2b[_0x789f('0x3e')]=_0x2f4ad9;return _0x1dca2b;})['then'](respondWithFilteredResult(_0x33c4b8,_0x3fe22b))[_0x789f('0x3f')](handleError(_0x33c4b8,null));};exports[_0x789f('0x40')]=function(_0x20a7d5,_0x2c43ee){var _0x4bc122={'raw':!![],'where':{'id':_0x20a7d5[_0x789f('0x41')]['id']}},_0x5c98df={};_0x5c98df['model']=_[_0x789f('0x2b')](db['UserOpenchannelInteraction'][_0x789f('0x42')]);_0x5c98df[_0x789f('0x2a')]=_['keys'](_0x20a7d5['query']);_0x5c98df[_0x789f('0x2c')]=_['intersection'](_0x5c98df['model'],_0x5c98df[_0x789f('0x2a')]);_0x4bc122[_0x789f('0x2d')]=_['intersection'](_0x5c98df['model'],qs['fields'](_0x20a7d5[_0x789f('0x2a')]['fields']));_0x4bc122['attributes']=_0x4bc122[_0x789f('0x2d')][_0x789f('0x2f')]?_0x4bc122[_0x789f('0x2d')]:_0x5c98df[_0x789f('0x29')];if(_0x20a7d5[_0x789f('0x2a')][_0x789f('0x43')]){_0x4bc122[_0x789f('0x3c')]=[{'all':!![]}];}_0x4bc122=_[_0x789f('0x38')]({},_0x4bc122,_0x20a7d5[_0x789f('0x3a')]);return db['UserOpenchannelInteraction'][_0x789f('0x44')](_0x4bc122)[_0x789f('0x20')](handleEntityNotFound(_0x2c43ee,null))[_0x789f('0x20')](respondWithResult(_0x2c43ee,null))['catch'](handleError(_0x2c43ee,null));};exports[_0x789f('0x45')]=function(_0x30fbc8,_0x292837){return db[_0x789f('0x3b')]['create'](_0x30fbc8[_0x789f('0x46')],{})[_0x789f('0x20')](function(_0x596c82){var _0x218c5d=_0x30fbc8[_0x789f('0x47')][_0x789f('0x21')]({'plain':!![]});if(!_0x218c5d)throw new Error(_0x789f('0x48'));if(_0x218c5d[_0x789f('0x49')]==='user'){var _0x3e1cb6=_0x596c82[_0x789f('0x21')]({'plain':!![]});var _0x48a4fa='UserOpenchannelInteraction';return db[_0x789f('0x4a')]['find']({'where':{'name':_0x48a4fa,'userProfileId':_0x218c5d[_0x789f('0x4b')]},'raw':!![]})[_0x789f('0x20')](function(_0x1cdb86){if(_0x1cdb86&&_0x1cdb86[_0x789f('0x4c')]===0x0){return db[_0x789f('0x4d')][_0x789f('0x45')]({'name':_0x3e1cb6[_0x789f('0x24')],'resourceId':_0x3e1cb6['id'],'type':_0x1cdb86[_0x789f('0x24')],'sectionId':_0x1cdb86['id']},{})[_0x789f('0x20')](function(){return _0x596c82;});}else{return _0x596c82;}})[_0x789f('0x3f')](function(_0x5a077e){logger['error'](_0x789f('0x4e'),_0x5a077e);throw _0x5a077e;});}return _0x596c82;})[_0x789f('0x20')](respondWithResult(_0x292837,0xc9))[_0x789f('0x3f')](handleError(_0x292837,null));};exports[_0x789f('0x1f')]=function(_0x4d5700,_0x37bdbf){if(_0x4d5700[_0x789f('0x46')]['id']){delete _0x4d5700['body']['id'];}return db['UserOpenchannelInteraction'][_0x789f('0x44')]({'where':{'id':_0x4d5700[_0x789f('0x41')]['id']}})[_0x789f('0x20')](handleEntityNotFound(_0x37bdbf,null))[_0x789f('0x20')](saveUpdates(_0x4d5700[_0x789f('0x46')],null))[_0x789f('0x20')](respondWithResult(_0x37bdbf,null))['catch'](handleError(_0x37bdbf,null));};exports['destroy']=function(_0x298cef,_0x434128){return db[_0x789f('0x3b')][_0x789f('0x44')]({'where':{'id':_0x298cef['params']['id']}})['then'](handleEntityNotFound(_0x434128,null))[_0x789f('0x20')](removeEntity(_0x434128,null))[_0x789f('0x3f')](handleError(_0x434128,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index bea13fa..58f61c6 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 _0xf6ac=['user_has_openchannel_interactions','lodash','util','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x4cbca0,_0x4107dc){var _0xf74ef5=function(_0x14f80a){while(--_0x14f80a){_0x4cbca0['push'](_0x4cbca0['shift']());}};_0xf74ef5(++_0x4107dc);}(_0xf6ac,0x160));var _0xcf6a=function(_0x329f22,_0xe1ba1d){_0x329f22=_0x329f22-0x0;var _0x3490b3=_0xf6ac[_0x329f22];return _0x3490b3;};'use strict';var _=require(_0xcf6a('0x0'));var util=require(_0xcf6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf6a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf6a('0x3'));var rimraf=require(_0xcf6a('0x4'));var config=require(_0xcf6a('0x5'));var attributes=require('./UserOpenchannelInteraction.attributes');module[_0xcf6a('0x6')]=function(_0x2a96ef,_0x38eb2d){return _0x2a96ef[_0xcf6a('0x7')]('UserOpenchannelInteraction',attributes,{'tableName':_0xcf6a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a7=['path','../../config/environment','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33e1d3,_0x1f7c57){var _0x4836=function(_0x48f88a){while(--_0x48f88a){_0x33e1d3['push'](_0x33e1d3['shift']());}};_0x4836(++_0x1f7c57);}(_0xe7a7,0x199));var _0x7e7a=function(_0x172250,_0x454614){_0x172250=_0x172250-0x0;var _0x5b2056=_0xe7a7[_0x172250];return _0x5b2056;};'use strict';var _=require(_0x7e7a('0x0'));var util=require(_0x7e7a('0x1'));var logger=require(_0x7e7a('0x2'))(_0x7e7a('0x3'));var moment=require(_0x7e7a('0x4'));var BPromise=require(_0x7e7a('0x5'));var rp=require(_0x7e7a('0x6'));var fs=require('fs');var path=require(_0x7e7a('0x7'));var rimraf=require('rimraf');var config=require(_0x7e7a('0x8'));var attributes=require(_0x7e7a('0x9'));module[_0x7e7a('0xa')]=function(_0x272dd7,_0x10dafb){return _0x272dd7[_0x7e7a('0xb')](_0x7e7a('0xc'),attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js index 2c0930d..6795608 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 _0x5b2e=['catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x3ac073,_0x507907){var _0x646059=function(_0x4f6524){while(--_0x4f6524){_0x3ac073['push'](_0x3ac073['shift']());}};_0x646059(++_0x507907);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x3a45e7,_0x9ac45){_0x3a45e7=_0x3a45e7-0x0;var _0x4d3e0f=_0x5b2e[_0x3a45e7];return _0x4d3e0f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5b2('0x0'));var rs=require(_0xe5b2('0x1'));var fs=require('fs');var Redis=require(_0xe5b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5b2('0x3'));var logger=require(_0xe5b2('0x4'))(_0xe5b2('0x5'));var config=require(_0xe5b2('0x6'));var jayson=require(_0xe5b2('0x7'));var client=jayson['client'][_0xe5b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23fdcb,_0x47a565,_0x109939){return new BPromise(function(_0x615ad,_0x4e13dc){return client[_0xe5b2('0x9')](_0x23fdcb,_0x109939)[_0xe5b2('0xa')](function(_0xaf13c4){logger[_0xe5b2('0xb')](_0xe5b2('0xc'),_0x47a565,'request\x20sent');logger[_0xe5b2('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x47a565,_0xe5b2('0xe'),JSON['stringify'](_0xaf13c4));if(_0xaf13c4[_0xe5b2('0xf')]){if(_0xaf13c4['error'][_0xe5b2('0x10')]===0x1f4){logger['error'](_0xe5b2('0xc'),_0x47a565,_0xaf13c4['error'][_0xe5b2('0x11')]);return _0x4e13dc(_0xaf13c4[_0xe5b2('0xf')]['message']);}logger[_0xe5b2('0xf')](_0xe5b2('0xc'),_0x47a565,_0xaf13c4[_0xe5b2('0xf')][_0xe5b2('0x11')]);return _0x615ad(_0xaf13c4[_0xe5b2('0xf')][_0xe5b2('0x11')]);}else{logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x47a565,_0xe5b2('0xe'));_0x615ad(_0xaf13c4['result'][_0xe5b2('0x11')]);}})[_0xe5b2('0x12')](function(_0x409235){logger[_0xe5b2('0xf')](_0xe5b2('0xc'),_0x47a565,_0x409235);_0x4e13dc(_0x409235);});});} \ No newline at end of file +var _0x49fe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis'];(function(_0x368502,_0x1b8bfb){var _0x44bc6e=function(_0x265af3){while(--_0x265af3){_0x368502['push'](_0x368502['shift']());}};_0x44bc6e(++_0x1b8bfb);}(_0x49fe,0x75));var _0xe49f=function(_0x47458b,_0x17fb1a){_0x47458b=_0x47458b-0x0;var _0x393cad=_0x49fe[_0x47458b];return _0x393cad;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe49f('0x1'));var fs=require('fs');var Redis=require(_0xe49f('0x2'));var db=require(_0xe49f('0x3'))['db'];var utils=require(_0xe49f('0x4'));var logger=require(_0xe49f('0x5'))(_0xe49f('0x6'));var config=require(_0xe49f('0x7'));var jayson=require(_0xe49f('0x8'));var client=jayson[_0xe49f('0x9')][_0xe49f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0591c,_0x2a7c98,_0x6f1120){return new BPromise(function(_0x574f52,_0x306059){return client[_0xe49f('0xb')](_0xe0591c,_0x6f1120)['then'](function(_0x1eefb2){logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));logger['debug'](_0xe49f('0xe'),_0x2a7c98,_0xe49f('0xd'),JSON[_0xe49f('0xf')](_0x1eefb2));if(_0x1eefb2[_0xe49f('0x10')]){if(_0x1eefb2[_0xe49f('0x10')]['code']===0x1f4){logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x306059(_0x1eefb2[_0xe49f('0x10')][_0xe49f('0x11')]);}logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x574f52(_0x1eefb2[_0xe49f('0x10')]['message']);}else{logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));_0x574f52(_0x1eefb2[_0xe49f('0x12')][_0xe49f('0x11')]);}})[_0xe49f('0x13')](function(_0x35e3ed){logger['error'](_0xe49f('0xc'),_0x2a7c98,_0x35e3ed);_0x306059(_0x35e3ed);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 1da53ab..69f1b7a 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 _0x138e=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x138e,0x102));var _0xe138=function(_0x448e04,_0x16ea2e){_0x448e04=_0x448e04-0x0;var _0x2cd368=_0x138e[_0x448e04];return _0x2cd368;};'use strict';var multer=require('multer');var util=require(_0xe138('0x0'));var path=require(_0xe138('0x1'));var timeout=require(_0xe138('0x2'));var express=require(_0xe138('0x3'));var router=express[_0xe138('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe138('0x5'));var config=require(_0xe138('0x6'));var controller=require(_0xe138('0x7'));router['get']('/',auth[_0xe138('0x8')](),controller[_0xe138('0x9')]);router[_0xe138('0xa')](_0xe138('0xb'),auth['isAuthenticated'](),controller[_0xe138('0xc')]);router[_0xe138('0xd')]('/',auth['isAuthenticated'](),controller[_0xe138('0xe')]);router[_0xe138('0xf')](_0xe138('0xb'),auth['isAuthenticated'](),controller[_0xe138('0x10')]);router[_0xe138('0x11')](_0xe138('0xb'),auth[_0xe138('0x8')](),controller['destroy']);module[_0xe138('0x12')]=router; \ No newline at end of file +var _0x25bf=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller','index','get','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path'];(function(_0x1eef1b,_0x1c71f2){var _0x4da0aa=function(_0x1d7d29){while(--_0x1d7d29){_0x1eef1b['push'](_0x1eef1b['shift']());}};_0x4da0aa(++_0x1c71f2);}(_0x25bf,0x177));var _0xf25b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x25bf[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf25b('0x0'));var util=require(_0xf25b('0x1'));var path=require(_0xf25b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf25b('0x3'));var router=express[_0xf25b('0x4')]();var auth=require(_0xf25b('0x5'));var interaction=require(_0xf25b('0x6'));var config=require(_0xf25b('0x7'));var controller=require(_0xf25b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf25b('0x9')]);router[_0xf25b('0xa')](_0xf25b('0xb'),auth[_0xf25b('0xc')](),controller[_0xf25b('0xd')]);router[_0xf25b('0xe')]('/',auth[_0xf25b('0xc')](),controller['create']);router['put']('/:id',auth[_0xf25b('0xc')](),controller[_0xf25b('0xf')]);router[_0xf25b('0x10')]('/:id',auth[_0xf25b('0xc')](),controller[_0xf25b('0x11')]);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 a0c9279..2937b42 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 _0xb69c=['exports','INTEGER'];(function(_0x592906,_0xa59c87){var _0x5cc0f0=function(_0x2b8ca6){while(--_0x2b8ca6){_0x592906['push'](_0x592906['shift']());}};_0x5cc0f0(++_0xa59c87);}(_0xb69c,0x126));var _0xcb69=function(_0x4b993c,_0x339641){_0x4b993c=_0x4b993c-0x0;var _0x3f6f95=_0xb69c[_0x4b993c];return _0x3f6f95;};'use strict';var Sequelize=require('sequelize');module[_0xcb69('0x0')]={'SmsInteractionId':{'type':Sequelize[_0xcb69('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xcb69('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x91da=['INTEGER','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91da,0x166));var _0xa91d=function(_0x1b02e9,_0x532963){_0x1b02e9=_0x1b02e9-0x0;var _0x5e7f61=_0x91da[_0x1b02e9];return _0x5e7f61;};'use strict';var Sequelize=require(_0xa91d('0x0'));module[_0xa91d('0x1')]={'SmsInteractionId':{'type':Sequelize[_0xa91d('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa91d('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 7ab829b..8cfedbb 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(_0x502678,_0x426bc2){var _0x278ef9=function(_0x5a2f93){while(--_0x5a2f93){_0x502678['push'](_0x502678['shift']());}};_0x278ef9(++_0x426bc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x3b6751,_0x41e393){var _0x4449f0=function(_0x25699a){while(--_0x25699a){_0x3b6751['push'](_0x3b6751['shift']());}};_0x4449f0(++_0x41e393);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 5d64692..0b78f0f 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 _0xe71d=['path','rimraf','./UserSmsInteraction.attributes','exports','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger','api','request-promise'];(function(_0x270c23,_0x9c0606){var _0x68e7e9=function(_0x5ee190){while(--_0x5ee190){_0x270c23['push'](_0x270c23['shift']());}};_0x68e7e9(++_0x9c0606);}(_0xe71d,0xf8));var _0xde71=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe71d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xde71('0x0'));var util=require(_0xde71('0x1'));var logger=require(_0xde71('0x2'))(_0xde71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde71('0x4'));var fs=require('fs');var path=require(_0xde71('0x5'));var rimraf=require(_0xde71('0x6'));var config=require('../../config/environment');var attributes=require(_0xde71('0x7'));module[_0xde71('0x8')]=function(_0x4e8892,_0x15cd7c){return _0x4e8892['define'](_0xde71('0x9'),attributes,{'tableName':_0xde71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb993=['define','user_has_sms_interactions','util','../../config/logger','api','bluebird','request-promise','./UserSmsInteraction.attributes','exports'];(function(_0x51c4ee,_0x113035){var _0x3421cb=function(_0x1db285){while(--_0x1db285){_0x51c4ee['push'](_0x51c4ee['shift']());}};_0x3421cb(++_0x113035);}(_0xb993,0x1bb));var _0x3b99=function(_0x3d1cdb,_0x3eca9f){_0x3d1cdb=_0x3d1cdb-0x0;var _0x225c13=_0xb993[_0x3d1cdb];return _0x225c13;};'use strict';var _=require('lodash');var util=require(_0x3b99('0x0'));var logger=require(_0x3b99('0x1'))(_0x3b99('0x2'));var moment=require('moment');var BPromise=require(_0x3b99('0x3'));var rp=require(_0x3b99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b99('0x5'));module[_0x3b99('0x6')]=function(_0x50caf3,_0x53188b){return _0x50caf3[_0x3b99('0x7')]('UserSmsInteraction',attributes,{'tableName':_0x3b99('0x8'),'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 0f12ca9..f8849d4 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 _0xf217=['info','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UserSmsInteraction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xf217,0x1a9));var _0x7f21=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xf217[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7f21('0x0'));var util=require(_0x7f21('0x1'));var moment=require(_0x7f21('0x2'));var BPromise=require(_0x7f21('0x3'));var rs=require(_0x7f21('0x4'));var fs=require('fs');var Redis=require(_0x7f21('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f21('0x6'));var logger=require(_0x7f21('0x7'))(_0x7f21('0x8'));var config=require(_0x7f21('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35a221,_0x534362,_0x33a95d){return new BPromise(function(_0x299f89,_0x55b1a3){return client[_0x7f21('0xb')](_0x35a221,_0x33a95d)['then'](function(_0x33ef1b){logger[_0x7f21('0xc')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,'request\x20sent');logger[_0x7f21('0xd')](_0x7f21('0xe'),_0x534362,_0x7f21('0xf'),JSON[_0x7f21('0x10')](_0x33ef1b));if(_0x33ef1b['error']){if(_0x33ef1b['error'][_0x7f21('0x11')]===0x1f4){logger[_0x7f21('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,_0x33ef1b[_0x7f21('0x12')][_0x7f21('0x13')]);return _0x55b1a3(_0x33ef1b['error'][_0x7f21('0x13')]);}logger['error'](_0x7f21('0x14'),_0x534362,_0x33ef1b[_0x7f21('0x12')][_0x7f21('0x13')]);return _0x299f89(_0x33ef1b['error'][_0x7f21('0x13')]);}else{logger[_0x7f21('0xc')]('UserSmsInteraction,\x20%s,\x20%s',_0x534362,'request\x20sent');_0x299f89(_0x33ef1b[_0x7f21('0x15')][_0x7f21('0x13')]);}})[_0x7f21('0x16')](function(_0x4053ce){logger[_0x7f21('0x12')](_0x7f21('0x14'),_0x534362,_0x4053ce);_0x55b1a3(_0x4053ce);});});} \ No newline at end of file +var _0x886a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x886a,0x164));var _0xa886=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x886a[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0xa886('0x0'));var util=require(_0xa886('0x1'));var moment=require(_0xa886('0x2'));var BPromise=require(_0xa886('0x3'));var rs=require(_0xa886('0x4'));var fs=require('fs');var Redis=require(_0xa886('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa886('0x6'));var logger=require(_0xa886('0x7'))(_0xa886('0x8'));var config=require(_0xa886('0x9'));var jayson=require(_0xa886('0xa'));var client=jayson['client'][_0xa886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab4a9,_0x24e9d2,_0x4a74a0){return new BPromise(function(_0x5850c8,_0xe5c31a){return client[_0xa886('0xc')](_0x5ab4a9,_0x4a74a0)['then'](function(_0x25f876){logger[_0xa886('0xd')](_0xa886('0xe'),_0x24e9d2,_0xa886('0xf'));logger[_0xa886('0x10')](_0xa886('0x11'),_0x24e9d2,_0xa886('0xf'),JSON[_0xa886('0x12')](_0x25f876));if(_0x25f876[_0xa886('0x13')]){if(_0x25f876['error'][_0xa886('0x14')]===0x1f4){logger[_0xa886('0x13')]('UserSmsInteraction,\x20%s,\x20%s',_0x24e9d2,_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);return _0xe5c31a(_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);}logger[_0xa886('0x13')](_0xa886('0xe'),_0x24e9d2,_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);return _0x5850c8(_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);}else{logger[_0xa886('0xd')](_0xa886('0xe'),_0x24e9d2,'request\x20sent');_0x5850c8(_0x25f876[_0xa886('0x16')][_0xa886('0x15')]);}})[_0xa886('0x17')](function(_0x3f5a09){logger['error'](_0xa886('0xe'),_0x24e9d2,_0x3f5a09);_0xe5c31a(_0x3f5a09);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 48f1768..862e902 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 _0xc685=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','post','create','put','update','/:id','destroy','exports','multer','util'];(function(_0x37e288,_0x397fdf){var _0x4a2d6e=function(_0x44f5fb){while(--_0x44f5fb){_0x37e288['push'](_0x37e288['shift']());}};_0x4a2d6e(++_0x397fdf);}(_0xc685,0xd6));var _0x5c68=function(_0x321648,_0x4f6001){_0x321648=_0x321648-0x0;var _0x464689=_0xc685[_0x321648];return _0x464689;};'use strict';var multer=require(_0x5c68('0x0'));var util=require(_0x5c68('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c68('0x2'));var router=express[_0x5c68('0x3')]();var auth=require(_0x5c68('0x4'));var interaction=require(_0x5c68('0x5'));var config=require(_0x5c68('0x6'));var controller=require(_0x5c68('0x7'));router[_0x5c68('0x8')]('/',auth[_0x5c68('0x9')](),controller[_0x5c68('0xa')]);router[_0x5c68('0x8')]('/:id',auth[_0x5c68('0x9')](),controller['show']);router[_0x5c68('0xb')]('/',auth['isAuthenticated'](),controller[_0x5c68('0xc')]);router[_0x5c68('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5c68('0xe')]);router['delete'](_0x5c68('0xf'),auth[_0x5c68('0x9')](),controller[_0x5c68('0x10')]);module[_0x5c68('0x11')]=router; \ No newline at end of file +var _0x388e=['delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x2f3e68,_0x42de33){var _0x332daf=function(_0x3febc4){while(--_0x3febc4){_0x2f3e68['push'](_0x2f3e68['shift']());}};_0x332daf(++_0x42de33);}(_0x388e,0x1b5));var _0xe388=function(_0x5d952a,_0x379b02){_0x5d952a=_0x5d952a-0x0;var _0x2d7019=_0x388e[_0x5d952a];return _0x2d7019;};'use strict';var multer=require('multer');var util=require(_0xe388('0x0'));var path=require(_0xe388('0x1'));var timeout=require('connect-timeout');var express=require(_0xe388('0x2'));var router=express['Router']();var auth=require(_0xe388('0x3'));var interaction=require(_0xe388('0x4'));var config=require('../../config/environment');var controller=require('./UserSmsInteraction.controller');router[_0xe388('0x5')]('/',auth[_0xe388('0x6')](),controller[_0xe388('0x7')]);router[_0xe388('0x5')](_0xe388('0x8'),auth['isAuthenticated'](),controller[_0xe388('0x9')]);router[_0xe388('0xa')]('/',auth[_0xe388('0x6')](),controller['create']);router[_0xe388('0xb')](_0xe388('0x8'),auth[_0xe388('0x6')](),controller[_0xe388('0xc')]);router[_0xe388('0xd')](_0xe388('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xe388('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 715a7b2..33c46b1 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 _0xa9e5=['sequelize','exports','INTEGER'];(function(_0x1a7a7d,_0x125c62){var _0xc6f97b=function(_0x18b77a){while(--_0x18b77a){_0x1a7a7d['push'](_0x1a7a7d['shift']());}};_0xc6f97b(++_0x125c62);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x550180,_0x146ffe){_0x550180=_0x550180-0x0;var _0x1a93d7=_0xa9e5[_0x550180];return _0x1a93d7;};'use strict';var Sequelize=require(_0x5a9e('0x0'));module[_0x5a9e('0x1')]={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x5a9e('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xbc8f=['exports','INTEGER'];(function(_0x107d60,_0x1d1078){var _0x287309=function(_0x41f357){while(--_0x41f357){_0x107d60['push'](_0x107d60['shift']());}};_0x287309(++_0x1d1078);}(_0xbc8f,0x154));var _0xfbc8=function(_0x1b4e62,_0x544a7c){_0x1b4e62=_0x1b4e62-0x0;var _0x5dd46f=_0xbc8f[_0x1b4e62];return _0x5dd46f;};'use strict';var Sequelize=require('sequelize');module[_0xfbc8('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0xfbc8('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xfbc8('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index a27615d..add7737 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 _0x4c23=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','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','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','UserWhatsappInteraction','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf'];(function(_0x36c174,_0xa233ec){var _0x4ec6c3=function(_0x3359f6){while(--_0x3359f6){_0x36c174['push'](_0x36c174['shift']());}};_0x4ec6c3(++_0xa233ec);}(_0x4c23,0xef));var _0x34c2=function(_0x5665ef,_0x80100f){_0x5665ef=_0x5665ef-0x0;var _0x5b13f0=_0x4c23[_0x5665ef];return _0x5b13f0;};'use strict';var pdf=require(_0x34c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34c2('0x1'));var zipdir=require(_0x34c2('0x2'));var jsonpatch=require(_0x34c2('0x3'));var rp=require(_0x34c2('0x4'));var moment=require(_0x34c2('0x5'));var BPromise=require(_0x34c2('0x6'));var Mustache=require('mustache');var util=require(_0x34c2('0x7'));var path=require(_0x34c2('0x8'));var sox=require(_0x34c2('0x9'));var csv=require(_0x34c2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34c2('0xb'));var squel=require(_0x34c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x34c2('0xd'));var toCsv=require(_0x34c2('0xa'));var querystring=require('querystring');var Papa=require(_0x34c2('0xe'));var Redis=require(_0x34c2('0xf'));var authService=require(_0x34c2('0x10'));var qs=require(_0x34c2('0x11'));var as=require(_0x34c2('0x12'));var hardwareService=require(_0x34c2('0x13'));var logger=require(_0x34c2('0x14'))(_0x34c2('0x15'));var utils=require('../../config/utils');var config=require(_0x34c2('0x16'));var licenseUtil=require(_0x34c2('0x17'));var db=require(_0x34c2('0x18'))['db'];function respondWithStatusCode(_0x26fb50,_0x23c927){_0x23c927=_0x23c927||0xcc;return function(_0x2e6b29){if(_0x2e6b29){return _0x26fb50[_0x34c2('0x19')](_0x23c927);}return _0x26fb50[_0x34c2('0x1a')](_0x23c927)[_0x34c2('0x1b')]();};}function respondWithResult(_0x2529d5,_0x2e4ba2){_0x2e4ba2=_0x2e4ba2||0xc8;return function(_0x9161be){if(_0x9161be){return _0x2529d5[_0x34c2('0x1a')](_0x2e4ba2)['json'](_0x9161be);}};}function respondWithFilteredResult(_0x14c1f9,_0x49af1c){return function(_0x296600){if(_0x296600){var _0x488aaf=_0x296600[_0x34c2('0x1c')],_0x16901a=_0x49af1c[_0x34c2('0x1d')],_0x5b37cf=_0x49af1c['offset']+_0x49af1c[_0x34c2('0x1e')],_0x5e2fad;if(_0x5b37cf>=_0x488aaf){_0x5b37cf=_0x488aaf;_0x5e2fad=0xc8;}else{_0x5e2fad=0xce;}_0x14c1f9[_0x34c2('0x1a')](_0x5e2fad);return _0x14c1f9[_0x34c2('0x1f')](_0x34c2('0x20'),_0x16901a+'-'+_0x5b37cf+'/'+_0x488aaf)[_0x34c2('0x21')](_0x296600);}return null;};}function patchUpdates(_0x34ec96){return function(_0x2a9e07){try{jsonpatch[_0x34c2('0x22')](_0x2a9e07,_0x34ec96,!![]);}catch(_0xdbb703){return BPromise[_0x34c2('0x23')](_0xdbb703);}return _0x2a9e07['save']();};}function saveUpdates(_0x565e8f,_0x3b2573){return function(_0x5abf2a){if(_0x5abf2a){return _0x5abf2a[_0x34c2('0x24')](_0x565e8f)[_0x34c2('0x25')](function(_0x16d58f){return _0x16d58f;});}return null;};}function removeEntity(_0x3ecfa0,_0x5f076d){return function(_0x1a55e9){if(_0x1a55e9){return _0x1a55e9[_0x34c2('0x26')]()[_0x34c2('0x25')](function(){var _0x2e5803=_0x1a55e9['get']({'plain':!![]});var _0x2a1b4d='UserWhatsappInteractions';return db['UserProfileResource'][_0x34c2('0x26')]({'where':{'type':_0x2a1b4d,'resourceId':_0x2e5803['id']}})['then'](function(){return _0x1a55e9;});})[_0x34c2('0x25')](function(){_0x3ecfa0[_0x34c2('0x1a')](0xcc)[_0x34c2('0x1b')]();});}};}function handleEntityNotFound(_0x99a0b9,_0x19e7c1){return function(_0x4ce7ab){if(!_0x4ce7ab){_0x99a0b9[_0x34c2('0x19')](0x194);}return _0x4ce7ab;};}function handleError(_0x19883e,_0x254985){_0x254985=_0x254985||0x1f4;return function(_0x15cc2e){logger[_0x34c2('0x27')](_0x15cc2e['stack']);if(_0x15cc2e[_0x34c2('0x28')]){delete _0x15cc2e[_0x34c2('0x28')];}_0x19883e[_0x34c2('0x1a')](_0x254985)[_0x34c2('0x29')](_0x15cc2e);};}exports[_0x34c2('0x2a')]=function(_0x9eacba,_0x3df53b){var _0x475028={},_0x2d5adf={},_0x8cbe79={'count':0x0,'rows':[]};var _0x1a0d6c=_[_0x34c2('0x2b')](db['UserWhatsappInteraction'][_0x34c2('0x2c')],function(_0x59772b){return{'name':_0x59772b[_0x34c2('0x2d')],'type':_0x59772b[_0x34c2('0x2e')]['key']};});_0x2d5adf[_0x34c2('0x2f')]=_[_0x34c2('0x2b')](_0x1a0d6c,'name');_0x2d5adf[_0x34c2('0x30')]=_[_0x34c2('0x31')](_0x9eacba[_0x34c2('0x30')]);_0x2d5adf[_0x34c2('0x32')]=_[_0x34c2('0x33')](_0x2d5adf[_0x34c2('0x2f')],_0x2d5adf[_0x34c2('0x30')]);_0x475028[_0x34c2('0x34')]=_[_0x34c2('0x33')](_0x2d5adf[_0x34c2('0x2f')],qs[_0x34c2('0x35')](_0x9eacba[_0x34c2('0x30')][_0x34c2('0x35')]));_0x475028['attributes']=_0x475028[_0x34c2('0x34')][_0x34c2('0x36')]?_0x475028[_0x34c2('0x34')]:_0x2d5adf[_0x34c2('0x2f')];if(!_0x9eacba['query']['hasOwnProperty'](_0x34c2('0x37'))){_0x475028[_0x34c2('0x1e')]=qs[_0x34c2('0x1e')](_0x9eacba['query']['limit']);_0x475028[_0x34c2('0x1d')]=qs['offset'](_0x9eacba[_0x34c2('0x30')]['offset']);}_0x475028[_0x34c2('0x38')]=qs['sort'](_0x9eacba[_0x34c2('0x30')][_0x34c2('0x39')]);_0x475028[_0x34c2('0x3a')]=qs['filters'](_[_0x34c2('0x3b')](_0x9eacba[_0x34c2('0x30')],_0x2d5adf[_0x34c2('0x32')]),_0x1a0d6c);if(_0x9eacba['query'][_0x34c2('0x3c')]){_0x475028[_0x34c2('0x3a')]=_[_0x34c2('0x3d')](_0x475028[_0x34c2('0x3a')],{'$or':_[_0x34c2('0x2b')](_0x1a0d6c,function(_0x186597){if(_0x186597[_0x34c2('0x2e')]!==_0x34c2('0x3e')){var _0x259e90={};_0x259e90[_0x186597[_0x34c2('0x28')]]={'$like':'%'+_0x9eacba[_0x34c2('0x30')]['filter']+'%'};return _0x259e90;}})});}_0x475028=_['merge']({},_0x475028,_0x9eacba[_0x34c2('0x3f')]);var _0x2b1d62={'where':_0x475028[_0x34c2('0x3a')]};return db['UserWhatsappInteraction']['count'](_0x2b1d62)[_0x34c2('0x25')](function(_0x3aa699){_0x8cbe79[_0x34c2('0x1c')]=_0x3aa699;if(_0x9eacba[_0x34c2('0x30')][_0x34c2('0x40')]){_0x475028[_0x34c2('0x41')]=[{'all':!![]}];}return db[_0x34c2('0x42')]['findAll'](_0x475028);})[_0x34c2('0x25')](function(_0x28c529){_0x8cbe79['rows']=_0x28c529;return _0x8cbe79;})[_0x34c2('0x25')](respondWithFilteredResult(_0x3df53b,_0x475028))['catch'](handleError(_0x3df53b,null));};exports[_0x34c2('0x43')]=function(_0x4743ee,_0xd932cb){var _0x24526a={'raw':!![],'where':{'id':_0x4743ee[_0x34c2('0x44')]['id']}},_0x1c55f9={};_0x1c55f9[_0x34c2('0x2f')]=_['keys'](db[_0x34c2('0x42')][_0x34c2('0x2c')]);_0x1c55f9[_0x34c2('0x30')]=_[_0x34c2('0x31')](_0x4743ee[_0x34c2('0x30')]);_0x1c55f9['filters']=_[_0x34c2('0x33')](_0x1c55f9[_0x34c2('0x2f')],_0x1c55f9[_0x34c2('0x30')]);_0x24526a[_0x34c2('0x34')]=_[_0x34c2('0x33')](_0x1c55f9[_0x34c2('0x2f')],qs[_0x34c2('0x35')](_0x4743ee['query'][_0x34c2('0x35')]));_0x24526a[_0x34c2('0x34')]=_0x24526a[_0x34c2('0x34')]['length']?_0x24526a['attributes']:_0x1c55f9['model'];if(_0x4743ee[_0x34c2('0x30')][_0x34c2('0x40')]){_0x24526a[_0x34c2('0x41')]=[{'all':!![]}];}_0x24526a=_[_0x34c2('0x3d')]({},_0x24526a,_0x4743ee[_0x34c2('0x3f')]);return db[_0x34c2('0x42')][_0x34c2('0x45')](_0x24526a)[_0x34c2('0x25')](handleEntityNotFound(_0xd932cb,null))[_0x34c2('0x25')](respondWithResult(_0xd932cb,null))[_0x34c2('0x46')](handleError(_0xd932cb,null));};exports[_0x34c2('0x47')]=function(_0x1e592d,_0x2071cc){return db[_0x34c2('0x42')][_0x34c2('0x47')](_0x1e592d['body'],{})['then'](function(_0x430e15){var _0x4e0048=_0x1e592d[_0x34c2('0x48')][_0x34c2('0x49')]({'plain':!![]});if(!_0x4e0048)throw new Error(_0x34c2('0x4a'));if(_0x4e0048[_0x34c2('0x4b')]===_0x34c2('0x48')){var _0x4bd769=_0x430e15[_0x34c2('0x49')]({'plain':!![]});var _0x4468b4='UserWhatsappInteractions';return db['UserProfileSection']['find']({'where':{'name':_0x4468b4,'userProfileId':_0x4e0048['userProfileId']},'raw':!![]})['then'](function(_0x57eb8e){if(_0x57eb8e&&_0x57eb8e[_0x34c2('0x4c')]===0x0){return db[_0x34c2('0x4d')][_0x34c2('0x47')]({'name':_0x4bd769[_0x34c2('0x28')],'resourceId':_0x4bd769['id'],'type':_0x57eb8e['name'],'sectionId':_0x57eb8e['id']},{})[_0x34c2('0x25')](function(){return _0x430e15;});}else{return _0x430e15;}})[_0x34c2('0x46')](function(_0x8350e6){logger[_0x34c2('0x27')](_0x34c2('0x4e'),_0x8350e6);throw _0x8350e6;});}return _0x430e15;})[_0x34c2('0x25')](respondWithResult(_0x2071cc,0xc9))[_0x34c2('0x46')](handleError(_0x2071cc,null));};exports[_0x34c2('0x24')]=function(_0x2b7b0d,_0x27056e){if(_0x2b7b0d['body']['id']){delete _0x2b7b0d[_0x34c2('0x4f')]['id'];}return db[_0x34c2('0x42')]['find']({'where':{'id':_0x2b7b0d['params']['id']}})['then'](handleEntityNotFound(_0x27056e,null))[_0x34c2('0x25')](saveUpdates(_0x2b7b0d['body'],null))[_0x34c2('0x25')](respondWithResult(_0x27056e,null))[_0x34c2('0x46')](handleError(_0x27056e,null));};exports[_0x34c2('0x26')]=function(_0x559408,_0x1c3c6e){return db['UserWhatsappInteraction']['find']({'where':{'id':_0x559408['params']['id']}})['then'](handleEntityNotFound(_0x1c3c6e,null))[_0x34c2('0x25')](removeEntity(_0x1c3c6e,null))[_0x34c2('0x46')](handleError(_0x1c3c6e,null));}; \ No newline at end of file +var _0xd497=['to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','UserWhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserWhatsappInteractions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xd497,0xe7));var _0x7d49=function(_0x10d6ca,_0x265cfe){_0x10d6ca=_0x10d6ca-0x0;var _0x44cfe1=_0xd497[_0x10d6ca];return _0x44cfe1;};'use strict';var pdf=require(_0x7d49('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d49('0x1'));var zipdir=require(_0x7d49('0x2'));var jsonpatch=require(_0x7d49('0x3'));var rp=require(_0x7d49('0x4'));var moment=require(_0x7d49('0x5'));var BPromise=require(_0x7d49('0x6'));var Mustache=require('mustache');var util=require(_0x7d49('0x7'));var path=require('path');var sox=require(_0x7d49('0x8'));var csv=require(_0x7d49('0x9'));var ejs=require(_0x7d49('0xa'));var fs=require('fs');var _=require(_0x7d49('0xb'));var squel=require('squel');var crypto=require(_0x7d49('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d49('0xd'));var toCsv=require(_0x7d49('0x9'));var querystring=require(_0x7d49('0xe'));var Papa=require(_0x7d49('0xf'));var Redis=require(_0x7d49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7d49('0x11'));var as=require(_0x7d49('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d49('0x13'))(_0x7d49('0x14'));var utils=require('../../config/utils');var config=require(_0x7d49('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d49('0x16'))['db'];function respondWithStatusCode(_0x1fc80f,_0x4f5339){_0x4f5339=_0x4f5339||0xcc;return function(_0x4857e1){if(_0x4857e1){return _0x1fc80f[_0x7d49('0x17')](_0x4f5339);}return _0x1fc80f[_0x7d49('0x18')](_0x4f5339)['end']();};}function respondWithResult(_0x50a29d,_0xc46baa){_0xc46baa=_0xc46baa||0xc8;return function(_0x2ba8bb){if(_0x2ba8bb){return _0x50a29d[_0x7d49('0x18')](_0xc46baa)['json'](_0x2ba8bb);}};}function respondWithFilteredResult(_0x370885,_0xf1a5cb){return function(_0x2f9080){if(_0x2f9080){var _0x4e50af=_0x2f9080[_0x7d49('0x19')],_0x1da438=_0xf1a5cb[_0x7d49('0x1a')],_0x292172=_0xf1a5cb['offset']+_0xf1a5cb[_0x7d49('0x1b')],_0x275252;if(_0x292172>=_0x4e50af){_0x292172=_0x4e50af;_0x275252=0xc8;}else{_0x275252=0xce;}_0x370885[_0x7d49('0x18')](_0x275252);return _0x370885[_0x7d49('0x1c')]('Content-Range',_0x1da438+'-'+_0x292172+'/'+_0x4e50af)[_0x7d49('0x1d')](_0x2f9080);}return null;};}function patchUpdates(_0x439a7c){return function(_0x5d755b){try{jsonpatch['apply'](_0x5d755b,_0x439a7c,!![]);}catch(_0x3bbb23){return BPromise[_0x7d49('0x1e')](_0x3bbb23);}return _0x5d755b[_0x7d49('0x1f')]();};}function saveUpdates(_0xe70f8b,_0x447322){return function(_0x4abafa){if(_0x4abafa){return _0x4abafa[_0x7d49('0x20')](_0xe70f8b)[_0x7d49('0x21')](function(_0x282d21){return _0x282d21;});}return null;};}function removeEntity(_0x551702,_0x58fa09){return function(_0x3b192b){if(_0x3b192b){return _0x3b192b[_0x7d49('0x22')]()[_0x7d49('0x21')](function(){var _0x136192=_0x3b192b[_0x7d49('0x23')]({'plain':!![]});var _0x2c357e='UserWhatsappInteractions';return db[_0x7d49('0x24')][_0x7d49('0x22')]({'where':{'type':_0x2c357e,'resourceId':_0x136192['id']}})[_0x7d49('0x21')](function(){return _0x3b192b;});})['then'](function(){_0x551702[_0x7d49('0x18')](0xcc)[_0x7d49('0x25')]();});}};}function handleEntityNotFound(_0x38717f,_0x4b21fc){return function(_0x5ca09f){if(!_0x5ca09f){_0x38717f[_0x7d49('0x17')](0x194);}return _0x5ca09f;};}function handleError(_0x2e2be2,_0x47acfa){_0x47acfa=_0x47acfa||0x1f4;return function(_0x3d8972){logger[_0x7d49('0x26')](_0x3d8972[_0x7d49('0x27')]);if(_0x3d8972[_0x7d49('0x28')]){delete _0x3d8972[_0x7d49('0x28')];}_0x2e2be2[_0x7d49('0x18')](_0x47acfa)['send'](_0x3d8972);};}exports['index']=function(_0x5a3ba4,_0x45ffa1){var _0x5b62ca={},_0x53b02c={},_0x3f5ed1={'count':0x0,'rows':[]};var _0x3d7bad=_['map'](db[_0x7d49('0x29')][_0x7d49('0x2a')],function(_0x15cf72){return{'name':_0x15cf72[_0x7d49('0x2b')],'type':_0x15cf72[_0x7d49('0x2c')][_0x7d49('0x2d')]};});_0x53b02c[_0x7d49('0x2e')]=_[_0x7d49('0x2f')](_0x3d7bad,_0x7d49('0x28'));_0x53b02c[_0x7d49('0x30')]=_['keys'](_0x5a3ba4[_0x7d49('0x30')]);_0x53b02c[_0x7d49('0x31')]=_[_0x7d49('0x32')](_0x53b02c[_0x7d49('0x2e')],_0x53b02c[_0x7d49('0x30')]);_0x5b62ca[_0x7d49('0x33')]=_[_0x7d49('0x32')](_0x53b02c[_0x7d49('0x2e')],qs['fields'](_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x34')]));_0x5b62ca[_0x7d49('0x33')]=_0x5b62ca[_0x7d49('0x33')][_0x7d49('0x35')]?_0x5b62ca[_0x7d49('0x33')]:_0x53b02c['model'];if(!_0x5a3ba4['query']['hasOwnProperty'](_0x7d49('0x36'))){_0x5b62ca[_0x7d49('0x1b')]=qs['limit'](_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x1b')]);_0x5b62ca[_0x7d49('0x1a')]=qs['offset'](_0x5a3ba4[_0x7d49('0x30')]['offset']);}_0x5b62ca[_0x7d49('0x37')]=qs[_0x7d49('0x38')](_0x5a3ba4['query'][_0x7d49('0x38')]);_0x5b62ca['where']=qs[_0x7d49('0x31')](_[_0x7d49('0x39')](_0x5a3ba4[_0x7d49('0x30')],_0x53b02c['filters']),_0x3d7bad);if(_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x3a')]){_0x5b62ca[_0x7d49('0x3b')]=_[_0x7d49('0x3c')](_0x5b62ca[_0x7d49('0x3b')],{'$or':_[_0x7d49('0x2f')](_0x3d7bad,function(_0x284e10){if(_0x284e10[_0x7d49('0x2c')]!==_0x7d49('0x3d')){var _0x4b84d9={};_0x4b84d9[_0x284e10[_0x7d49('0x28')]]={'$like':'%'+_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x3a')]+'%'};return _0x4b84d9;}})});}_0x5b62ca=_[_0x7d49('0x3c')]({},_0x5b62ca,_0x5a3ba4[_0x7d49('0x3e')]);var _0x198b52={'where':_0x5b62ca[_0x7d49('0x3b')]};return db[_0x7d49('0x29')][_0x7d49('0x19')](_0x198b52)[_0x7d49('0x21')](function(_0x821c1){_0x3f5ed1[_0x7d49('0x19')]=_0x821c1;if(_0x5a3ba4[_0x7d49('0x30')]['includeAll']){_0x5b62ca[_0x7d49('0x3f')]=[{'all':!![]}];}return db[_0x7d49('0x29')][_0x7d49('0x40')](_0x5b62ca);})['then'](function(_0x5c8add){_0x3f5ed1[_0x7d49('0x41')]=_0x5c8add;return _0x3f5ed1;})[_0x7d49('0x21')](respondWithFilteredResult(_0x45ffa1,_0x5b62ca))[_0x7d49('0x42')](handleError(_0x45ffa1,null));};exports['show']=function(_0x5ab558,_0x184cc2){var _0x1bb506={'raw':!![],'where':{'id':_0x5ab558[_0x7d49('0x43')]['id']}},_0x366e11={};_0x366e11['model']=_[_0x7d49('0x44')](db[_0x7d49('0x29')][_0x7d49('0x2a')]);_0x366e11[_0x7d49('0x30')]=_[_0x7d49('0x44')](_0x5ab558[_0x7d49('0x30')]);_0x366e11[_0x7d49('0x31')]=_[_0x7d49('0x32')](_0x366e11[_0x7d49('0x2e')],_0x366e11['query']);_0x1bb506[_0x7d49('0x33')]=_[_0x7d49('0x32')](_0x366e11['model'],qs[_0x7d49('0x34')](_0x5ab558['query'][_0x7d49('0x34')]));_0x1bb506['attributes']=_0x1bb506[_0x7d49('0x33')][_0x7d49('0x35')]?_0x1bb506['attributes']:_0x366e11[_0x7d49('0x2e')];if(_0x5ab558[_0x7d49('0x30')][_0x7d49('0x45')]){_0x1bb506[_0x7d49('0x3f')]=[{'all':!![]}];}_0x1bb506=_[_0x7d49('0x3c')]({},_0x1bb506,_0x5ab558[_0x7d49('0x3e')]);return db[_0x7d49('0x29')][_0x7d49('0x46')](_0x1bb506)['then'](handleEntityNotFound(_0x184cc2,null))[_0x7d49('0x21')](respondWithResult(_0x184cc2,null))['catch'](handleError(_0x184cc2,null));};exports[_0x7d49('0x47')]=function(_0x374b62,_0x4a9137){return db[_0x7d49('0x29')][_0x7d49('0x47')](_0x374b62[_0x7d49('0x48')],{})[_0x7d49('0x21')](function(_0x2c9b9b){var _0xe3cb72=_0x374b62['user'][_0x7d49('0x23')]({'plain':!![]});if(!_0xe3cb72)throw new Error(_0x7d49('0x49'));if(_0xe3cb72[_0x7d49('0x4a')]===_0x7d49('0x4b')){var _0x3c902c=_0x2c9b9b[_0x7d49('0x23')]({'plain':!![]});var _0x4c9724=_0x7d49('0x4c');return db[_0x7d49('0x4d')][_0x7d49('0x46')]({'where':{'name':_0x4c9724,'userProfileId':_0xe3cb72[_0x7d49('0x4e')]},'raw':!![]})[_0x7d49('0x21')](function(_0x239c70){if(_0x239c70&&_0x239c70['autoAssociation']===0x0){return db[_0x7d49('0x24')]['create']({'name':_0x3c902c[_0x7d49('0x28')],'resourceId':_0x3c902c['id'],'type':_0x239c70[_0x7d49('0x28')],'sectionId':_0x239c70['id']},{})[_0x7d49('0x21')](function(){return _0x2c9b9b;});}else{return _0x2c9b9b;}})['catch'](function(_0x4e9490){logger['error'](_0x7d49('0x4f'),_0x4e9490);throw _0x4e9490;});}return _0x2c9b9b;})['then'](respondWithResult(_0x4a9137,0xc9))[_0x7d49('0x42')](handleError(_0x4a9137,null));};exports[_0x7d49('0x20')]=function(_0x164c0b,_0x52a547){if(_0x164c0b[_0x7d49('0x48')]['id']){delete _0x164c0b[_0x7d49('0x48')]['id'];}return db[_0x7d49('0x29')]['find']({'where':{'id':_0x164c0b[_0x7d49('0x43')]['id']}})['then'](handleEntityNotFound(_0x52a547,null))[_0x7d49('0x21')](saveUpdates(_0x164c0b[_0x7d49('0x48')],null))[_0x7d49('0x21')](respondWithResult(_0x52a547,null))[_0x7d49('0x42')](handleError(_0x52a547,null));};exports[_0x7d49('0x22')]=function(_0x433068,_0x3d0108){return db[_0x7d49('0x29')][_0x7d49('0x46')]({'where':{'id':_0x433068[_0x7d49('0x43')]['id']}})[_0x7d49('0x21')](handleEntityNotFound(_0x3d0108,null))[_0x7d49('0x21')](removeEntity(_0x3d0108,null))['catch'](handleError(_0x3d0108,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index cadd40e..2ea0bfc 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 _0x5f05=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','lodash','util','../../config/logger','api'];(function(_0x4276ab,_0x4cd191){var _0x5417c2=function(_0xfead6d){while(--_0xfead6d){_0x4276ab['push'](_0x4276ab['shift']());}};_0x5417c2(++_0x4cd191);}(_0x5f05,0x1bc));var _0x55f0=function(_0x5e0cb4,_0x433832){_0x5e0cb4=_0x5e0cb4-0x0;var _0x547c2a=_0x5f05[_0x5e0cb4];return _0x547c2a;};'use strict';var _=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var logger=require(_0x55f0('0x2'))(_0x55f0('0x3'));var moment=require(_0x55f0('0x4'));var BPromise=require(_0x55f0('0x5'));var rp=require(_0x55f0('0x6'));var fs=require('fs');var path=require(_0x55f0('0x7'));var rimraf=require(_0x55f0('0x8'));var config=require(_0x55f0('0x9'));var attributes=require(_0x55f0('0xa'));module[_0x55f0('0xb')]=function(_0x14919e,_0x51481c){return _0x14919e[_0x55f0('0xc')](_0x55f0('0xd'),attributes,{'tableName':'user_has_whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3551=['user_has_whatsapp_interactions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','define','UserWhatsappInteraction'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3551,0x135));var _0x1355=function(_0x31e634,_0xdae36){_0x31e634=_0x31e634-0x0;var _0x4b2505=_0x3551[_0x31e634];return _0x4b2505;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1355('0x0'));var moment=require(_0x1355('0x1'));var BPromise=require(_0x1355('0x2'));var rp=require(_0x1355('0x3'));var fs=require('fs');var path=require(_0x1355('0x4'));var rimraf=require(_0x1355('0x5'));var config=require(_0x1355('0x6'));var attributes=require(_0x1355('0x7'));module['exports']=function(_0xd5ad25,_0x4321a8){return _0xd5ad25[_0x1355('0x8')](_0x1355('0x9'),attributes,{'tableName':_0x1355('0xa'),'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 f79120a..84c8a80 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 _0x55a5=['info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x2fb7a6,_0x185f4e){var _0x42e812=function(_0x5d30db){while(--_0x5d30db){_0x2fb7a6['push'](_0x2fb7a6['shift']());}};_0x42e812(++_0x185f4e);}(_0x55a5,0x16b));var _0x555a=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0x55a5[_0x349b5c];return _0x3efcac;};'use strict';var _=require(_0x555a('0x0'));var util=require('util');var moment=require(_0x555a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x555a('0x2'));var db=require(_0x555a('0x3'))['db'];var utils=require(_0x555a('0x4'));var logger=require(_0x555a('0x5'))('rpc');var config=require(_0x555a('0x6'));var jayson=require(_0x555a('0x7'));var client=jayson[_0x555a('0x8')][_0x555a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x214ffb,_0x49a78a,_0x34e96e){return new BPromise(function(_0x25e75a,_0x41b26d){return client['request'](_0x214ffb,_0x34e96e)[_0x555a('0xa')](function(_0x437eae){logger[_0x555a('0xb')](_0x555a('0xc'),_0x49a78a,_0x555a('0xd'));logger[_0x555a('0xe')](_0x555a('0xf'),_0x49a78a,_0x555a('0xd'),JSON[_0x555a('0x10')](_0x437eae));if(_0x437eae[_0x555a('0x11')]){if(_0x437eae[_0x555a('0x11')][_0x555a('0x12')]===0x1f4){logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);return _0x41b26d(_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);}logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x437eae['error'][_0x555a('0x13')]);return _0x25e75a(_0x437eae[_0x555a('0x11')][_0x555a('0x13')]);}else{logger['info'](_0x555a('0xc'),_0x49a78a,_0x555a('0xd'));_0x25e75a(_0x437eae[_0x555a('0x14')]['message']);}})[_0x555a('0x15')](function(_0x4e6c31){logger[_0x555a('0x11')](_0x555a('0xc'),_0x49a78a,_0x4e6c31);_0x41b26d(_0x4e6c31);});});} \ No newline at end of file +var _0xa5b6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x40aa59,_0x36b8bd){var _0x436c2c=function(_0x27b66c){while(--_0x27b66c){_0x40aa59['push'](_0x40aa59['shift']());}};_0x436c2c(++_0x36b8bd);}(_0xa5b6,0x149));var _0x6a5b=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0xa5b6[_0x29e2af];return _0x1ea06a;};'use strict';var _=require(_0x6a5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a5b('0x1'));var rs=require(_0x6a5b('0x2'));var fs=require('fs');var Redis=require(_0x6a5b('0x3'));var db=require(_0x6a5b('0x4'))['db'];var utils=require(_0x6a5b('0x5'));var logger=require(_0x6a5b('0x6'))(_0x6a5b('0x7'));var config=require(_0x6a5b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a5b('0x9')][_0x6a5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed665,_0xc08bfe,_0x32de2f){return new BPromise(function(_0x4b7649,_0x5aa864){return client[_0x6a5b('0xb')](_0x1ed665,_0x32de2f)[_0x6a5b('0xc')](function(_0x404b02){logger['info'](_0x6a5b('0xd'),_0xc08bfe,_0x6a5b('0xe'));logger[_0x6a5b('0xf')](_0x6a5b('0x10'),_0xc08bfe,'request\x20sent',JSON[_0x6a5b('0x11')](_0x404b02));if(_0x404b02[_0x6a5b('0x12')]){if(_0x404b02['error'][_0x6a5b('0x13')]===0x1f4){logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x404b02['error']['message']);return _0x5aa864(_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);}logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);return _0x4b7649(_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);}else{logger[_0x6a5b('0x15')](_0x6a5b('0xd'),_0xc08bfe,'request\x20sent');_0x4b7649(_0x404b02['result'][_0x6a5b('0x14')]);}})['catch'](function(_0x429ed4){logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x429ed4);_0x5aa864(_0x429ed4);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 0172ff3..10779fc 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 _0xdfe9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','Router'];(function(_0x5de944,_0x3d7621){var _0x24ce5a=function(_0x7cdd83){while(--_0x7cdd83){_0x5de944['push'](_0x5de944['shift']());}};_0x24ce5a(++_0x3d7621);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x260edf,_0x2a3230){_0x260edf=_0x260edf-0x0;var _0x4f2438=_0xdfe9[_0x260edf];return _0x4f2438;};'use strict';var multer=require(_0x9dfe('0x0'));var util=require('util');var path=require(_0x9dfe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9dfe('0x2')]();var auth=require(_0x9dfe('0x3'));var interaction=require(_0x9dfe('0x4'));var config=require(_0x9dfe('0x5'));var controller=require(_0x9dfe('0x6'));router[_0x9dfe('0x7')]('/',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0x9')]);router[_0x9dfe('0x7')](_0x9dfe('0xa'),auth[_0x9dfe('0x8')](),controller['show']);router[_0x9dfe('0xb')]('/',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0xc')]);router[_0x9dfe('0xd')](_0x9dfe('0xa'),auth[_0x9dfe('0x8')](),controller[_0x9dfe('0xe')]);router[_0x9dfe('0xf')]('/:id',auth[_0x9dfe('0x8')](),controller[_0x9dfe('0x10')]);module[_0x9dfe('0x11')]=router; \ No newline at end of file +var _0x2e54=['index','get','post','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','isAuthenticated'];(function(_0x124925,_0x3e58d7){var _0x44370b=function(_0xcd213a){while(--_0xcd213a){_0x124925['push'](_0x124925['shift']());}};_0x44370b(++_0x3e58d7);}(_0x2e54,0x1dd));var _0x42e5=function(_0x52de8a,_0x16092f){_0x52de8a=_0x52de8a-0x0;var _0x4dd3a9=_0x2e54[_0x52de8a];return _0x4dd3a9;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get']('/',auth[_0x42e5('0x8')](),controller[_0x42e5('0x9')]);router[_0x42e5('0xa')]('/:id',auth[_0x42e5('0x8')](),controller['show']);router[_0x42e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router[_0x42e5('0xd')](_0x42e5('0xe'),auth[_0x42e5('0x8')](),controller[_0x42e5('0xf')]);router[_0x42e5('0x10')](_0x42e5('0xe'),auth[_0x42e5('0x8')](),controller[_0x42e5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3a41618..8e7971c 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 _0xa510=['action','STRING','contactManager','integration','motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa510,0x6a));var _0x0a51=function(_0x29a5b6,_0x2d81a9){_0x29a5b6=_0x29a5b6-0x0;var _0x592375=_0xa510[_0x29a5b6];return _0x592375;};'use strict';var Sequelize=require(_0x0a51('0x0'));module[_0x0a51('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x238d84){return this['getDataValue'](_0x0a51('0x2'));}},'action':{'type':Sequelize[_0x0a51('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0a51('0x4'),_0x0a51('0x5'),_0x0a51('0x6'),'jscripty',_0x0a51('0x7'),_0x0a51('0x8'),'bot',_0x0a51('0x9')]],'msg':_0x0a51('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x0a51('0x3')](0x1000),'comment':_0x0a51('0xb')},'data4':{'type':Sequelize[_0x0a51('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xcadb=['getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL'];(function(_0x2cc14a,_0x1eb1f7){var _0x9534e3=function(_0xd86c85){while(--_0xd86c85){_0x2cc14a['push'](_0x2cc14a['shift']());}};_0x9534e3(++_0x1eb1f7);}(_0xcadb,0x11b));var _0xbcad=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xcadb[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0xbcad('0x0'));module['exports']={'name':{'type':Sequelize[_0xbcad('0x1')],'get':function(_0x7a9068){return this[_0xbcad('0x2')](_0xbcad('0x3'));}},'action':{'type':Sequelize[_0xbcad('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbcad('0x5'),'integration',_0xbcad('0x6'),_0xbcad('0x7'),_0xbcad('0x8'),_0xbcad('0x9'),_0xbcad('0xa'),_0xbcad('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xbcad('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0xbcad('0x4')](0x1000),'comment':_0xbcad('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xbcad('0xd')},'data4':{'type':Sequelize[_0xbcad('0x4')](0x1000)},'data5':{'type':Sequelize[_0xbcad('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xbcad('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4e8e86d..6dd93c0 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 _0xb091=['set','Content-Range','save','update','then','destroy','error','stack','name','send','body','Action','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x3d642f,_0x141b14){var _0x3a52b2=function(_0x430743){while(--_0x430743){_0x3d642f['push'](_0x3d642f['shift']());}};_0x3a52b2(++_0x141b14);}(_0xb091,0x16e));var _0x1b09=function(_0x7f4d6,_0x47ccaa){_0x7f4d6=_0x7f4d6-0x0;var _0x2f8e2f=_0xb091[_0x7f4d6];return _0x2f8e2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b09('0x0'));var rimraf=require(_0x1b09('0x1'));var zipdir=require(_0x1b09('0x2'));var jsonpatch=require(_0x1b09('0x3'));var rp=require('request-promise');var moment=require(_0x1b09('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b09('0x5'));var path=require(_0x1b09('0x6'));var sox=require('sox');var csv=require(_0x1b09('0x7'));var ejs=require(_0x1b09('0x8'));var fs=require('fs');var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0x7'));var querystring=require(_0x1b09('0xd'));var Papa=require(_0x1b09('0xe'));var Redis=require(_0x1b09('0xf'));var authService=require(_0x1b09('0x10'));var qs=require(_0x1b09('0x11'));var as=require(_0x1b09('0x12'));var hardwareService=require(_0x1b09('0x13'));var logger=require('../../config/logger')(_0x1b09('0x14'));var utils=require(_0x1b09('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x16'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x17')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0)[_0x1b09('0x19')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x18')](_0x37fdb2)[_0x1b09('0x1a')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=_0x10b7eb[_0x1b09('0x1b')],_0x64689a=_0x37673e[_0x1b09('0x1c')],_0x33129b=_0x37673e[_0x1b09('0x1c')]+_0x37673e[_0x1b09('0x1d')],_0x1196b2;if(_0x33129b>=_0x1dc96b){_0x33129b=_0x1dc96b;_0x1196b2=0xc8;}else{_0x1196b2=0xce;}_0x11ab46['status'](_0x1196b2);return _0x11ab46[_0x1b09('0x1e')](_0x1b09('0x1f'),_0x64689a+'-'+_0x33129b+'/'+_0x1dc96b)['json'](_0x10b7eb);}return null;};}function patchUpdates(_0x5cf855){return function(_0xe93ac4){try{jsonpatch['apply'](_0xe93ac4,_0x5cf855,!![]);}catch(_0x267b5e){return BPromise['reject'](_0x267b5e);}return _0xe93ac4[_0x1b09('0x20')]();};}function saveUpdates(_0x4b2eab,_0x2d6dba){return function(_0x1e8f97){if(_0x1e8f97){return _0x1e8f97[_0x1b09('0x21')](_0x4b2eab)[_0x1b09('0x22')](function(_0x363e78){return _0x363e78;});}return null;};}function removeEntity(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x23')]()[_0x1b09('0x22')](function(){_0x39e569['status'](0xcc)[_0x1b09('0x19')]();});}};}function handleEntityNotFound(_0x11d0d5,_0x6e132c){return function(_0xb22064){if(!_0xb22064){_0x11d0d5['sendStatus'](0x194);}return _0xb22064;};}function handleError(_0xe0d931,_0x15be49){_0x15be49=_0x15be49||0x1f4;return function(_0x4936d0){logger[_0x1b09('0x24')](_0x4936d0[_0x1b09('0x25')]);if(_0x4936d0['name']){delete _0x4936d0[_0x1b09('0x26')];}_0xe0d931[_0x1b09('0x18')](_0x15be49)[_0x1b09('0x27')](_0x4936d0);};}exports[_0x1b09('0x21')]=function(_0x547fbb,_0xb3cf07){if(_0x547fbb[_0x1b09('0x28')]['id']){delete _0x547fbb['body']['id'];}return db[_0x1b09('0x29')][_0x1b09('0x2a')]({'where':{'id':_0x547fbb[_0x1b09('0x2b')]['id']}})[_0x1b09('0x22')](handleEntityNotFound(_0xb3cf07,null))[_0x1b09('0x22')](saveUpdates(_0x547fbb[_0x1b09('0x28')],null))[_0x1b09('0x22')](respondWithResult(_0xb3cf07,null))['catch'](handleError(_0xb3cf07,null));};exports[_0x1b09('0x23')]=function(_0x3e6a4d,_0x4bf0ad){return db[_0x1b09('0x29')][_0x1b09('0x2a')]({'where':{'id':_0x3e6a4d[_0x1b09('0x2b')]['id']}})[_0x1b09('0x22')](handleEntityNotFound(_0x4bf0ad,null))[_0x1b09('0x22')](removeEntity(_0x4bf0ad,null))['catch'](handleError(_0x4bf0ad,null));}; \ No newline at end of file +var _0x81d4=['update','then','error','name','send','body','Action','catch','destroy','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','json','save'];(function(_0x13a36f,_0x5505bd){var _0x15cc2a=function(_0x1f8927){while(--_0x1f8927){_0x13a36f['push'](_0x13a36f['shift']());}};_0x15cc2a(++_0x5505bd);}(_0x81d4,0x197));var _0x481d=function(_0x570889,_0x2eab0e){_0x570889=_0x570889-0x0;var _0x1a500b=_0x81d4[_0x570889];return _0x1a500b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x481d('0x0'));var rimraf=require(_0x481d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x481d('0x2'));var rp=require(_0x481d('0x3'));var moment=require(_0x481d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x481d('0x5'));var path=require(_0x481d('0x6'));var sox=require(_0x481d('0x7'));var csv=require('to-csv');var ejs=require(_0x481d('0x8'));var fs=require('fs');var _=require(_0x481d('0x9'));var squel=require(_0x481d('0xa'));var crypto=require(_0x481d('0xb'));var jsforce=require(_0x481d('0xc'));var deskjs=require(_0x481d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x481d('0xe'));var Papa=require(_0x481d('0xf'));var Redis=require(_0x481d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x481d('0x11'));var as=require(_0x481d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x481d('0x13'))(_0x481d('0x14'));var utils=require(_0x481d('0x15'));var config=require(_0x481d('0x16'));var licenseUtil=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x9c7a08,_0x4e33fc){_0x4e33fc=_0x4e33fc||0xcc;return function(_0x3a751f){if(_0x3a751f){return _0x9c7a08['sendStatus'](_0x4e33fc);}return _0x9c7a08['status'](_0x4e33fc)[_0x481d('0x19')]();};}function respondWithResult(_0x18bd93,_0x2f32c8){_0x2f32c8=_0x2f32c8||0xc8;return function(_0x5cbe7e){if(_0x5cbe7e){return _0x18bd93[_0x481d('0x1a')](_0x2f32c8)['json'](_0x5cbe7e);}};}function respondWithFilteredResult(_0x1e3df6,_0x15bba7){return function(_0x222f72){if(_0x222f72){var _0x1bda12=_0x222f72[_0x481d('0x1b')],_0x879e29=_0x15bba7[_0x481d('0x1c')],_0x59c5d5=_0x15bba7['offset']+_0x15bba7[_0x481d('0x1d')],_0x63b8c1;if(_0x59c5d5>=_0x1bda12){_0x59c5d5=_0x1bda12;_0x63b8c1=0xc8;}else{_0x63b8c1=0xce;}_0x1e3df6['status'](_0x63b8c1);return _0x1e3df6[_0x481d('0x1e')]('Content-Range',_0x879e29+'-'+_0x59c5d5+'/'+_0x1bda12)[_0x481d('0x1f')](_0x222f72);}return null;};}function patchUpdates(_0x59cdbc){return function(_0x30ef03){try{jsonpatch['apply'](_0x30ef03,_0x59cdbc,!![]);}catch(_0x2c52bc){return BPromise['reject'](_0x2c52bc);}return _0x30ef03[_0x481d('0x20')]();};}function saveUpdates(_0x41a4de,_0x4d56ea){return function(_0x2d1daa){if(_0x2d1daa){return _0x2d1daa[_0x481d('0x21')](_0x41a4de)[_0x481d('0x22')](function(_0x48d0b1){return _0x48d0b1;});}return null;};}function removeEntity(_0x45745b,_0x4ab1e8){return function(_0x560b33){if(_0x560b33){return _0x560b33['destroy']()[_0x481d('0x22')](function(){_0x45745b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x280586,_0x237c02){return function(_0x10e8a1){if(!_0x10e8a1){_0x280586['sendStatus'](0x194);}return _0x10e8a1;};}function handleError(_0x100020,_0x469a86){_0x469a86=_0x469a86||0x1f4;return function(_0x51e3a){logger[_0x481d('0x23')](_0x51e3a['stack']);if(_0x51e3a[_0x481d('0x24')]){delete _0x51e3a[_0x481d('0x24')];}_0x100020['status'](_0x469a86)[_0x481d('0x25')](_0x51e3a);};}exports[_0x481d('0x21')]=function(_0x4001b9,_0x5173b2){if(_0x4001b9['body']['id']){delete _0x4001b9[_0x481d('0x26')]['id'];}return db[_0x481d('0x27')]['find']({'where':{'id':_0x4001b9['params']['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x5173b2,null))[_0x481d('0x22')](saveUpdates(_0x4001b9[_0x481d('0x26')],null))[_0x481d('0x22')](respondWithResult(_0x5173b2,null))[_0x481d('0x28')](handleError(_0x5173b2,null));};exports[_0x481d('0x29')]=function(_0x44c319,_0x1bfff7){return db[_0x481d('0x27')][_0x481d('0x2a')]({'where':{'id':_0x44c319[_0x481d('0x2b')]['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x1bfff7,null))['then'](removeEntity(_0x1bfff7,null))[_0x481d('0x28')](handleError(_0x1bfff7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 690e1a5..546e967 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 _0x9c56=['rimraf','../../config/environment','./action.attributes','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x387a94,_0x80a6a6){var _0x127502=function(_0x1f5a24){while(--_0x1f5a24){_0x387a94['push'](_0x387a94['shift']());}};_0x127502(++_0x80a6a6);}(_0x9c56,0x1e3));var _0x69c5=function(_0x44e016,_0x2a4ac3){_0x44e016=_0x44e016-0x0;var _0x5bc0a0=_0x9c56[_0x44e016];return _0x5bc0a0;};'use strict';var _=require(_0x69c5('0x0'));var util=require(_0x69c5('0x1'));var logger=require('../../config/logger')(_0x69c5('0x2'));var moment=require(_0x69c5('0x3'));var BPromise=require(_0x69c5('0x4'));var rp=require(_0x69c5('0x5'));var fs=require('fs');var path=require(_0x69c5('0x6'));var rimraf=require(_0x69c5('0x7'));var config=require(_0x69c5('0x8'));var attributes=require(_0x69c5('0x9'));module['exports']=function(_0x4ad12a,_0xeff164){return _0x4ad12a['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc954=['rimraf','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x36c97e,_0x41f0c3){var _0x41841b=function(_0x1e8dda){while(--_0x1e8dda){_0x36c97e['push'](_0x36c97e['shift']());}};_0x41841b(++_0x41f0c3);}(_0xc954,0xeb));var _0x4c95=function(_0x4a0332,_0x4a5358){_0x4a0332=_0x4a0332-0x0;var _0x845d4d=_0xc954[_0x4a0332];return _0x845d4d;};'use strict';var _=require(_0x4c95('0x0'));var util=require(_0x4c95('0x1'));var logger=require(_0x4c95('0x2'))('api');var moment=require(_0x4c95('0x3'));var BPromise=require(_0x4c95('0x4'));var rp=require(_0x4c95('0x5'));var fs=require('fs');var path=require(_0x4c95('0x6'));var rimraf=require(_0x4c95('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c95('0x8'));module[_0x4c95('0x9')]=function(_0x33e143,_0x4fd966){return _0x33e143['define']('Action',attributes,{'tableName':_0x4c95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 63fe47b..0d9c399 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(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x107c11,_0xbaba1d){var _0x1b07aa=function(_0x40eefc){while(--_0x40eefc){_0x107c11['push'](_0x107c11['shift']());}};_0x1b07aa(++_0xbaba1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0641248..26f9dc3 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 _0x283b=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update'];(function(_0x418f13,_0x4b40fe){var _0x4ee5cc=function(_0x2006b3){while(--_0x2006b3){_0x418f13['push'](_0x418f13['shift']());}};_0x4ee5cc(++_0x4b40fe);}(_0x283b,0xb9));var _0xb283=function(_0x4a40ce,_0x396eba){_0x4a40ce=_0x4a40ce-0x0;var _0x1919f0=_0x283b[_0x4a40ce];return _0x1919f0;};'use strict';var multer=require(_0xb283('0x0'));var util=require(_0xb283('0x1'));var path=require('path');var timeout=require(_0xb283('0x2'));var express=require(_0xb283('0x3'));var router=express[_0xb283('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb283('0x5'));var config=require(_0xb283('0x6'));var controller=require(_0xb283('0x7'));router[_0xb283('0x8')]('/:id',auth[_0xb283('0x9')](),controller[_0xb283('0xa')]);router['delete'](_0xb283('0xb'),auth[_0xb283('0x9')](),controller[_0xb283('0xc')]);module[_0xb283('0xd')]=router; \ No newline at end of file +var _0x3b60=['/:id','destroy','multer','util','path','express','Router','../../components/auth/service','put','update','delete'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0x3b60,0x86));var _0x03b6=function(_0x42f362,_0x25ff81){_0x42f362=_0x42f362-0x0;var _0x2caffc=_0x3b60[_0x42f362];return _0x2caffc;};'use strict';var multer=require(_0x03b6('0x0'));var util=require(_0x03b6('0x1'));var path=require(_0x03b6('0x2'));var timeout=require('connect-timeout');var express=require(_0x03b6('0x3'));var router=express[_0x03b6('0x4')]();var auth=require(_0x03b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x03b6('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x03b6('0x7')]);router[_0x03b6('0x8')](_0x03b6('0x9'),auth['isAuthenticated'](),controller[_0x03b6('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 9224e36..e1f5726 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 _0xe375=['sequelize','STRING','TEXT'];(function(_0x5b1636,_0x560a6e){var _0x2982d8=function(_0x303a5b){while(--_0x303a5b){_0x5b1636['push'](_0x5b1636['shift']());}};_0x2982d8(++_0x560a6e);}(_0xe375,0x8a));var _0x5e37=function(_0x44036f,_0x367150){_0x44036f=_0x44036f-0x0;var _0x55a334=_0xe375[_0x44036f];return _0x55a334;};'use strict';var Sequelize=require(_0x5e37('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e37('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5e37('0x1')]},'table':{'type':Sequelize[_0x5e37('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5e37('0x2')]}}; \ No newline at end of file +var _0xa93e=['STRING','TEXT','sequelize'];(function(_0x538124,_0x345055){var _0x5b43c3=function(_0x9bef80){while(--_0x9bef80){_0x538124['push'](_0x538124['shift']());}};_0x5b43c3(++_0x345055);}(_0xa93e,0x12b));var _0xea93=function(_0x153d1b,_0x19b066){_0x153d1b=_0x153d1b-0x0;var _0x43e1dc=_0xa93e[_0x153d1b];return _0x43e1dc;};'use strict';var Sequelize=require(_0xea93('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xea93('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xea93('0x2')]},'joins':{'type':Sequelize[_0xea93('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a6e479b..b11d5d2 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 _0x9865=['MIN(%s)','SEC_TO_TIME(%s)','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','count','offset','set','reject','save','update','then','CustomReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','MetricId','metric','replace','function','format','orderBy','DESC','field','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','value','AnalyticMetric','groupBy','alias','No\x20available\x20data','web','fullPath','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../components/export/','countTable','run','runReport','MAX(%s)'];(function(_0xa1c85c,_0x558def){var _0x1bec7f=function(_0x358fca){while(--_0x358fca){_0xa1c85c['push'](_0xa1c85c['shift']());}};_0x1bec7f(++_0x558def);}(_0x9865,0xab));var _0x5986=function(_0x4b034c,_0x337cfd){_0x4b034c=_0x4b034c-0x0;var _0x8b8dc6=_0x9865[_0x4b034c];return _0x8b8dc6;};'use strict';var pdf=require(_0x5986('0x0'));var emlformat=require(_0x5986('0x1'));var rimraf=require(_0x5986('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5986('0x3'));var rp=require('request-promise');var moment=require(_0x5986('0x4'));var BPromise=require(_0x5986('0x5'));var Mustache=require(_0x5986('0x6'));var util=require(_0x5986('0x7'));var path=require(_0x5986('0x8'));var sox=require(_0x5986('0x9'));var csv=require(_0x5986('0xa'));var ejs=require(_0x5986('0xb'));var fs=require('fs');var _=require(_0x5986('0xc'));var squel=require(_0x5986('0xd'));var crypto=require(_0x5986('0xe'));var jsforce=require(_0x5986('0xf'));var deskjs=require(_0x5986('0x10'));var toCsv=require(_0x5986('0xa'));var querystring=require(_0x5986('0x11'));var Papa=require(_0x5986('0x12'));var Redis=require(_0x5986('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5986('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5986('0x15'));var logger=require(_0x5986('0x16'))('api');var utils=require(_0x5986('0x17'));var config=require(_0x5986('0x18'));var licenseUtil=require(_0x5986('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5986('0x1a'))[_0x5986('0x1b')];function respondWithStatusCode(_0x5ba478,_0x6caa9e){_0x6caa9e=_0x6caa9e||0xcc;return function(_0x3d2a8f){if(_0x3d2a8f){return _0x5ba478['sendStatus'](_0x6caa9e);}return _0x5ba478['status'](_0x6caa9e)[_0x5986('0x1c')]();};}function respondWithResult(_0x304486,_0x27bb13){_0x27bb13=_0x27bb13||0xc8;return function(_0x26fd23){if(_0x26fd23){return _0x304486[_0x5986('0x1d')](_0x27bb13)['json'](_0x26fd23);}};}function respondWithFilteredResult(_0x133554,_0x47de55){return function(_0x23b38b){if(_0x23b38b){var _0x3297fb=_0x23b38b[_0x5986('0x1e')],_0x525deb=_0x47de55[_0x5986('0x1f')],_0x327619=_0x47de55[_0x5986('0x1f')]+_0x47de55['limit'],_0x5e55ab;if(_0x327619>=_0x3297fb){_0x327619=_0x3297fb;_0x5e55ab=0xc8;}else{_0x5e55ab=0xce;}_0x133554[_0x5986('0x1d')](_0x5e55ab);return _0x133554[_0x5986('0x20')]('Content-Range',_0x525deb+'-'+_0x327619+'/'+_0x3297fb)['json'](_0x23b38b);}return null;};}function patchUpdates(_0x579673){return function(_0x575ca8){try{jsonpatch['apply'](_0x575ca8,_0x579673,!![]);}catch(_0x15d56e){return BPromise[_0x5986('0x21')](_0x15d56e);}return _0x575ca8[_0x5986('0x22')]();};}function saveUpdates(_0x44bc96,_0x2af1b4){return function(_0x5f3afa){if(_0x5f3afa){return _0x5f3afa[_0x5986('0x23')](_0x44bc96)[_0x5986('0x24')](function(_0x665249){return _0x665249;});}return null;};}function removeEntity(_0x102d33,_0x2dc72a){return function(_0x4088b7){if(_0x4088b7){return _0x4088b7['destroy']()[_0x5986('0x24')](function(){var _0x28b2ae=_0x4088b7['get']({'plain':!![]});var _0x197d70=_0x5986('0x25');return db[_0x5986('0x26')][_0x5986('0x27')]({'where':{'type':_0x197d70,'resourceId':_0x28b2ae['id']}})['then'](function(){return _0x4088b7;});})[_0x5986('0x24')](function(){_0x102d33[_0x5986('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c280,_0x2b5d6b){return function(_0x5ec393){if(!_0x5ec393){_0x34c280[_0x5986('0x28')](0x194);}return _0x5ec393;};}function handleError(_0x34d2b1,_0x10a43a){_0x10a43a=_0x10a43a||0x1f4;return function(_0x3cd48e){logger['error'](_0x3cd48e[_0x5986('0x29')]);if(_0x3cd48e[_0x5986('0x2a')]){delete _0x3cd48e['name'];}_0x34d2b1['status'](_0x10a43a)[_0x5986('0x2b')](_0x3cd48e);};}exports[_0x5986('0x2c')]=function(_0x193eea,_0x2de574){var _0x3dd62e={},_0x438123={},_0x3c864e={'count':0x0,'rows':[]};var _0x51a002=_['map'](db[_0x5986('0x2d')][_0x5986('0x2e')],function(_0x1cee90){return{'name':_0x1cee90[_0x5986('0x2f')],'type':_0x1cee90[_0x5986('0x30')][_0x5986('0x31')]};});_0x438123[_0x5986('0x32')]=_['map'](_0x51a002,_0x5986('0x2a'));_0x438123[_0x5986('0x33')]=_[_0x5986('0x34')](_0x193eea[_0x5986('0x33')]);_0x438123[_0x5986('0x35')]=_[_0x5986('0x36')](_0x438123[_0x5986('0x32')],_0x438123[_0x5986('0x33')]);_0x3dd62e[_0x5986('0x37')]=_[_0x5986('0x36')](_0x438123[_0x5986('0x32')],qs[_0x5986('0x38')](_0x193eea[_0x5986('0x33')]['fields']));_0x3dd62e[_0x5986('0x37')]=_0x3dd62e[_0x5986('0x37')][_0x5986('0x39')]?_0x3dd62e[_0x5986('0x37')]:_0x438123[_0x5986('0x32')];if(!_0x193eea['query']['hasOwnProperty'](_0x5986('0x3a'))){_0x3dd62e['limit']=qs['limit'](_0x193eea[_0x5986('0x33')][_0x5986('0x3b')]);_0x3dd62e[_0x5986('0x1f')]=qs[_0x5986('0x1f')](_0x193eea[_0x5986('0x33')]['offset']);}_0x3dd62e[_0x5986('0x3c')]=qs[_0x5986('0x3d')](_0x193eea[_0x5986('0x33')]['sort']);_0x3dd62e['where']=qs[_0x5986('0x35')](_[_0x5986('0x3e')](_0x193eea['query'],_0x438123[_0x5986('0x35')]),_0x51a002);if(_0x193eea[_0x5986('0x33')][_0x5986('0x3f')]){_0x3dd62e[_0x5986('0x40')]=_['merge'](_0x3dd62e[_0x5986('0x40')],{'$or':_[_0x5986('0x41')](_0x51a002,function(_0xfd2142){if(_0xfd2142[_0x5986('0x30')]!=='VIRTUAL'){var _0x1dca35={};_0x1dca35[_0xfd2142['name']]={'$like':'%'+_0x193eea[_0x5986('0x33')][_0x5986('0x3f')]+'%'};return _0x1dca35;}})});}_0x3dd62e=_['merge']({},_0x3dd62e,_0x193eea[_0x5986('0x42')]);var _0x4fc921={'where':_0x3dd62e[_0x5986('0x40')]};return db['AnalyticCustomReport']['count'](_0x4fc921)[_0x5986('0x24')](function(_0x2459f4){_0x3c864e[_0x5986('0x1e')]=_0x2459f4;if(_0x193eea[_0x5986('0x33')][_0x5986('0x43')]){_0x3dd62e[_0x5986('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x5986('0x45')](_0x3dd62e);})[_0x5986('0x24')](function(_0x529ac1){_0x3c864e[_0x5986('0x46')]=_0x529ac1;return _0x3c864e;})['then'](respondWithFilteredResult(_0x2de574,_0x3dd62e))[_0x5986('0x47')](handleError(_0x2de574,null));};exports[_0x5986('0x48')]=function(_0x30f25b,_0x599165){var _0x427355={'raw':![],'where':{'id':_0x30f25b[_0x5986('0x49')]['id']}},_0x5ceeb8={};_0x5ceeb8['model']=_[_0x5986('0x34')](db['AnalyticCustomReport'][_0x5986('0x2e')]);_0x5ceeb8[_0x5986('0x33')]=_[_0x5986('0x34')](_0x30f25b[_0x5986('0x33')]);_0x5ceeb8[_0x5986('0x35')]=_[_0x5986('0x36')](_0x5ceeb8[_0x5986('0x32')],_0x5ceeb8[_0x5986('0x33')]);_0x427355[_0x5986('0x37')]=_['intersection'](_0x5ceeb8[_0x5986('0x32')],qs[_0x5986('0x38')](_0x30f25b[_0x5986('0x33')][_0x5986('0x38')]));_0x427355['attributes']=_0x427355[_0x5986('0x37')][_0x5986('0x39')]?_0x427355[_0x5986('0x37')]:_0x5ceeb8['model'];if(_0x30f25b[_0x5986('0x33')][_0x5986('0x43')]){_0x427355[_0x5986('0x44')]=[{'all':!![]}];}_0x427355=_[_0x5986('0x4a')]({},_0x427355,_0x30f25b['options']);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x427355)[_0x5986('0x24')](handleEntityNotFound(_0x599165,null))['then'](respondWithResult(_0x599165,null))[_0x5986('0x47')](handleError(_0x599165,null));};exports[_0x5986('0x4c')]=function(_0x20ead9,_0x21b341){return db[_0x5986('0x2d')][_0x5986('0x4c')](_0x20ead9[_0x5986('0x4d')],{})[_0x5986('0x24')](function(_0x536592){var _0x48251a=_0x20ead9[_0x5986('0x4e')][_0x5986('0x4f')]({'plain':!![]});if(!_0x48251a)throw new Error(_0x5986('0x50'));if(_0x48251a['role']===_0x5986('0x4e')){var _0x150873=_0x536592[_0x5986('0x4f')]({'plain':!![]});var _0x203d43=_0x5986('0x51');return db[_0x5986('0x52')][_0x5986('0x4b')]({'where':{'name':_0x203d43,'userProfileId':_0x48251a[_0x5986('0x53')]},'raw':!![]})[_0x5986('0x24')](function(_0x51fbe6){if(_0x51fbe6&&_0x51fbe6[_0x5986('0x54')]===0x0){return db[_0x5986('0x26')]['create']({'name':_0x150873[_0x5986('0x2a')],'resourceId':_0x150873['id'],'type':_0x5986('0x25'),'sectionId':_0x51fbe6['id']},{})['then'](function(){return _0x536592;});}else{return _0x536592;}})[_0x5986('0x47')](function(_0x5d9b4f){logger[_0x5986('0x55')](_0x5986('0x56'),_0x5d9b4f);throw _0x5d9b4f;});}return _0x536592;})[_0x5986('0x24')](respondWithResult(_0x21b341,0xc9))[_0x5986('0x47')](handleError(_0x21b341,null));};exports[_0x5986('0x23')]=function(_0x18c4e0,_0x229110){if(_0x18c4e0[_0x5986('0x4d')]['id']){delete _0x18c4e0['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x18c4e0[_0x5986('0x49')]['id']}})['then'](handleEntityNotFound(_0x229110,null))[_0x5986('0x24')](saveUpdates(_0x18c4e0[_0x5986('0x4d')],null))['then'](respondWithResult(_0x229110,null))[_0x5986('0x47')](handleError(_0x229110,null));};exports[_0x5986('0x27')]=function(_0x362873,_0x3cc633){return db[_0x5986('0x2d')][_0x5986('0x4b')]({'where':{'id':_0x362873['params']['id']}})['then'](handleEntityNotFound(_0x3cc633,null))['then'](removeEntity(_0x3cc633,null))['catch'](handleError(_0x3cc633,null));};exports['preview']=function(_0x15dc0f,_0x39aa92){var _0x543911=0xa;var _0x16b85b=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),_0x5986('0x5a')];var _0x493cfd={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5986('0x5e'),'GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xefb502={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5986('0x61'),'HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31469a=function(_0x191386){return!_[_0x5986('0x64')]([_0x5986('0x65'),_0x5986('0x66'),_0x5986('0x67'),'IS\x20NOT\x20EMPTY'],_0x191386);};var _0x2a11cd=function(_0x57c9f6){if(!_0x57c9f6||!_0x57c9f6[_0x5986('0x68')][_0x5986('0x39')]){return'';}for(var _0x3703fc='(',_0x45488d=0x0;_0x45488d<_0x57c9f6[_0x5986('0x68')][_0x5986('0x39')];_0x45488d+=0x1){_0x45488d>0x0&&(_0x3703fc+='\x20'+_0x57c9f6[_0x5986('0x69')]+'\x20');_0x3703fc+=_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6a')]?_0x2a11cd(_0x57c9f6[_0x5986('0x68')][_0x45488d]['group']):_0x57c9f6['rules'][_0x45488d]['field']+'\x20'+_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6b')]+(_0x31469a(_0x57c9f6[_0x5986('0x68')][_0x45488d][_0x5986('0x6b')])?'\x20'+_0x57c9f6[_0x5986('0x68')][_0x45488d]['value']:'');}return _0x3703fc+')';};var _0x36d034={'where':{'id':_0x15dc0f[_0x5986('0x49')]['id']}},_0x4bc446,_0x411872,_0x16b02a,_0x33d5e3,_0x3fb469;_0x36d034=_[_0x5986('0x4a')]({},_0x36d034,_0x15dc0f[_0x5986('0x42')]);return db['AnalyticCustomReport'][_0x5986('0x4b')](_0x36d034)[_0x5986('0x24')](function(_0x56ae80){if(_0x56ae80){_0x4bc446=_0x56ae80;return _0x56ae80[_0x5986('0x6c')]();}return null;})['then'](function(_0x2df2ef){if(_0x2df2ef){if(!_0x2df2ef['length']){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x411872=_0x2df2ef;return db['AnalyticMetric'][_0x5986('0x45')]({'raw':!![]});}return null;})[_0x5986('0x24')](function(_0x39da90){if(_0x39da90){_0x16b02a=_[_0x5986('0x6f')](_0x39da90,'id');var _0x1cf74d;var _0x439532=squel[_0x5986('0x70')]();_0x439532[_0x5986('0x71')](_0x4bc446['table']);for(var _0x1c9552=0x0;_0x1c9552<_0x411872[_0x5986('0x39')];_0x1c9552+=0x1){_0x1cf74d=_0x411872[_0x1c9552][_0x5986('0x72')]?_0x16b02a[_0x411872[_0x1c9552]['MetricId']][_0x5986('0x73')]:_0x411872[_0x1c9552]['field'];_0x1cf74d=_0x411872[_0x1c9552]['function']?_[_0x5986('0x74')](_0x493cfd[_0x411872[_0x1c9552][_0x5986('0x75')]],'%s',_0x1cf74d):_0x1cf74d;_0x1cf74d=_0x411872[_0x1c9552][_0x5986('0x76')]?_[_0x5986('0x74')](_0xefb502[_0x411872[_0x1c9552][_0x5986('0x76')]],'%s',_0x1cf74d):_0x1cf74d;if(_0x411872[_0x1c9552]['groupBy']){_0x439532[_0x5986('0x6a')](_0x1cf74d);}_0x411872[_0x1c9552][_0x5986('0x77')]&&_0x439532['order'](_0x1cf74d,_0x411872[_0x1c9552][_0x5986('0x77')]===_0x5986('0x78')?![]:!![]);_0x439532[_0x5986('0x79')](_0x1cf74d,_0x411872[_0x1c9552]['alias']||_0x1cf74d);}if(_0x4bc446['joins']){_0x4bc446[_0x5986('0x7a')]=JSON[_0x5986('0x7b')](_0x4bc446[_0x5986('0x7a')]);for(var _0x14382b=0x0;_0x14382b<_0x4bc446[_0x5986('0x7a')]['length'];_0x14382b+=0x1){if(_0x4bc446[_0x5986('0x7a')][_0x14382b]['type']&&_[_0x5986('0x64')](_0x16b85b,_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x30')])&&_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7c')]&&_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')]&&_0x4bc446[_0x5986('0x7a')][_0x14382b]['foreignKey']){_0x439532[_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x30')]](_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')],null,util[_0x5986('0x76')](_0x5986('0x7e'),_0x4bc446[_0x5986('0x7f')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7c')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x7d')],_0x4bc446[_0x5986('0x7a')][_0x14382b][_0x5986('0x80')]));}}}if(_0x4bc446['conditions']){_0x4bc446[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x4bc446[_0x5986('0x81')]);_0x439532['where'](_0x2a11cd(_0x4bc446['conditions'][_0x5986('0x6a')]));}_0x3fb469=_0x439532[_0x5986('0x82')]();_0x439532['limit'](_0x543911);_0x439532['offset'](0x0);logger[_0x5986('0x83')](_0x5986('0x84'),_0x439532['toString']());return db[_0x5986('0x85')][_0x5986('0x33')](_0x439532[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})[_0x5986('0x24')](respondWithResult(_0x39aa92,null))[_0x5986('0x47')](handleError(_0x39aa92,null));};function runReport(_0x449da5,_0x1395e,_0x3fb0dc){var _0x48b1ea=_0x1395e[_0x5986('0x2a')];var _0x223b95=0xa;var _0x3782f1=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),'cross_join'];var _0xd808d6={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5986('0x5e'),'GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':_0x5986('0x89')};var _0x4e6e76={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':_0x5986('0x8a')};var _0x25bd3a=function(_0x2b698c){return!_[_0x5986('0x64')]([_0x5986('0x65'),'IS\x20NOT\x20NULL',_0x5986('0x67'),_0x5986('0x8b')],_0x2b698c);};var _0x2fefde=function(_0x2af2b2){if(!_0x2af2b2||!_0x2af2b2['rules']['length']){return'';}for(var _0x728b87='(',_0x22c886=0x0;_0x22c886<_0x2af2b2[_0x5986('0x68')][_0x5986('0x39')];_0x22c886+=0x1){_0x22c886>0x0&&(_0x728b87+='\x20'+_0x2af2b2[_0x5986('0x69')]+'\x20');_0x728b87+=_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x6a')]?_0x2fefde(_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x6a')]):_0x2af2b2['rules'][_0x22c886][_0x5986('0x79')]+'\x20'+_0x2af2b2['rules'][_0x22c886][_0x5986('0x6b')]+(_0x25bd3a(_0x2af2b2['rules'][_0x22c886][_0x5986('0x6b')])?'\x20'+_0x2af2b2[_0x5986('0x68')][_0x22c886][_0x5986('0x8c')]:'');}return _0x728b87+')';};var _0x54a0db={'where':{'id':_0x449da5['id']}},_0x2e7ad5,_0x104017,_0x2429aa,_0x1ce58d,_0x171375;_0x54a0db=_[_0x5986('0x4a')]({},_0x54a0db,_0x3fb0dc);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x54a0db)[_0x5986('0x24')](function(_0x5a0945){if(_0x5a0945){_0x2e7ad5=_0x5a0945;return _0x5a0945[_0x5986('0x6c')]();}return null;})['then'](function(_0x4f33a3){if(_0x4f33a3){if(!_0x4f33a3[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x104017=_0x4f33a3;return db[_0x5986('0x8d')][_0x5986('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3ab806){if(_0x3ab806){_0x2429aa=_[_0x5986('0x6f')](_0x3ab806,'id');var _0xdbfe60;var _0x24d75a=squel[_0x5986('0x70')]();_0x24d75a[_0x5986('0x71')](_0x2e7ad5[_0x5986('0x7f')]);for(var _0x303255=0x0;_0x303255<_0x104017[_0x5986('0x39')];_0x303255+=0x1){_0xdbfe60=_0x104017[_0x303255][_0x5986('0x72')]?_0x2429aa[_0x104017[_0x303255]['MetricId']]['metric']:_0x104017[_0x303255][_0x5986('0x79')];_0xdbfe60=_0x104017[_0x303255][_0x5986('0x75')]?_[_0x5986('0x74')](_0xd808d6[_0x104017[_0x303255]['function']],'%s',_0xdbfe60):_0xdbfe60;_0xdbfe60=_0x104017[_0x303255]['format']?_[_0x5986('0x74')](_0x4e6e76[_0x104017[_0x303255][_0x5986('0x76')]],'%s',_0xdbfe60):_0xdbfe60;if(_0x104017[_0x303255][_0x5986('0x8e')]){_0x24d75a[_0x5986('0x6a')](_0xdbfe60);}_0x104017[_0x303255]['orderBy']&&_0x24d75a[_0x5986('0x3c')](_0xdbfe60,_0x104017[_0x303255]['orderBy']===_0x5986('0x78')?![]:!![]);_0x24d75a['field'](_0xdbfe60,_0x104017[_0x303255][_0x5986('0x8f')]||_0xdbfe60);}if(_0x2e7ad5[_0x5986('0x7a')]){_0x2e7ad5[_0x5986('0x7a')]=JSON['parse'](_0x2e7ad5['joins']);for(var _0x1bd417=0x0;_0x1bd417<_0x2e7ad5[_0x5986('0x7a')]['length'];_0x1bd417+=0x1){if(_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['type']&&_[_0x5986('0x64')](_0x3782f1,_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x30')])&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['parentKey']&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7d')]&&_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['foreignKey']){_0x24d75a[_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['type']](_0x2e7ad5[_0x5986('0x7a')][_0x1bd417]['foreignTable'],null,util['format'](_0x5986('0x7e'),_0x2e7ad5[_0x5986('0x7f')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7c')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x7d')],_0x2e7ad5[_0x5986('0x7a')][_0x1bd417][_0x5986('0x80')]));}}}if(_0x2e7ad5[_0x5986('0x81')]){_0x2e7ad5[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x2e7ad5[_0x5986('0x81')]);_0x24d75a[_0x5986('0x40')](_0x2fefde(_0x2e7ad5[_0x5986('0x81')][_0x5986('0x6a')]));}_0x171375=_0x24d75a[_0x5986('0x82')]();_0x24d75a[_0x5986('0x3b')](_0x223b95);_0x24d75a[_0x5986('0x1f')](0x0);logger[_0x5986('0x83')]('Limited\x20Query:',_0x24d75a[_0x5986('0x86')]());return db['sequelize'][_0x5986('0x33')](_0x24d75a[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})['then'](function(_0x50e0f7){if(!_0x50e0f7[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))](_0x5986('0x90'),0xcc);}if(_0x1395e['output']===_0x5986('0x91')){return null;}var _0x4ac5f2=_[_0x5986('0x4a')](_0x1395e,{'name':_0x1395e[_0x5986('0x92')]||_0x1395e[_0x5986('0x2a')]||_0x2e7ad5[_0x5986('0x2a')],'basename':_0x48b1ea,'savename':util['format']('%s-%s.%s',_0x1395e[_0x5986('0x2a')]||_0x2e7ad5[_0x5986('0x2a')],require(_0x5986('0x93'))[_0x5986('0x94')](0x4),_0x1395e[_0x5986('0x95')]||_0x5986('0x96')),'reportId':_0x2e7ad5['id'],'reportType':_0x5986('0x97')});return db[_0x5986('0x98')][_0x5986('0x4c')](_0x4ac5f2,{'raw':!![]});})[_0x5986('0x24')](function(_0x5a37a1){if(_0x2e7ad5[_0x5986('0x7f')]==='cdr'){_0x171375['where'](_0x2e7ad5[_0x5986('0x7f')]+_0x5986('0x99'),_0x1395e['startDate'],_0x1395e[_0x5986('0x9a')]);}else{_0x171375[_0x5986('0x40')](_0x2e7ad5[_0x5986('0x7f')]+_0x5986('0x9b'),_0x1395e[_0x5986('0x9c')],_0x1395e[_0x5986('0x9a')]);}if(_0x5a37a1){logger[_0x5986('0x9d')](_0x5986('0x9e'),_0x171375[_0x5986('0x86')]());require(_0x5986('0x9f'))['fork'](path[_0x5986('0x57')](__dirname,_0x5986('0xa0'),_0x5a37a1[_0x5986('0x95')]),[_0x5a37a1['id'],_0x171375[_0x5986('0x86')](),path['join'](__dirname,'../../files/reports',_0x5a37a1['savename']),_0x48b1ea]);return _0x5a37a1;}else{var _0x17bb05=squel[_0x5986('0x70')]();_0x17bb05[_0x5986('0x71')]('('+_0x171375[_0x5986('0x86')]()+')',_0x5986('0xa1'));_0x17bb05['field']('COUNT(*)',_0x5986('0x1e'));_0x171375[_0x5986('0x3b')](_0x1395e[_0x5986('0x3b')]||_0x223b95);_0x171375[_0x5986('0x1f')](_0x1395e[_0x5986('0x1f')]||0x0);return dbH[_0x5986('0x85')]['query'](_0x17bb05['toString'](),{'type':dbH[_0x5986('0x85')]['QueryTypes'][_0x5986('0x88')]})[_0x5986('0x24')](function(_0x24eca1){if(!_0x24eca1[_0x5986('0x39')]){_0x1ce58d=0x0;}else{_0x1ce58d=_0x24eca1[0x0]['count']||0x0;}return dbH[_0x5986('0x85')][_0x5986('0x33')](_0x171375['toString'](),{'type':dbH[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});})[_0x5986('0x24')](function(_0x9a01bc){return{'rows':_0x9a01bc||[],'count':_0x1ce58d};});}});}exports[_0x5986('0xa2')]=function(_0x258d20,_0x5acffc){return runReport(_0x258d20['params'],_0x258d20[_0x5986('0x33')],_0x258d20[_0x5986('0x42')])['then'](respondWithResult(_0x5acffc,null))[_0x5986('0x47')](handleError(_0x5acffc,null));};exports[_0x5986('0xa3')]=runReport;exports[_0x5986('0x33')]=function(_0xa625b,_0x27f845){var _0x227bb6=0xa;var _0x110f33=[_0x5986('0x57'),_0x5986('0x58'),_0x5986('0x59'),'cross_join'];var _0x19c7c4={'SUM':_0x5986('0x5b'),'COUNT':_0x5986('0x5c'),'COUNT DISTINCT':_0x5986('0x5d'),'MAX':_0x5986('0xa4'),'MIN':_0x5986('0xa5'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5986('0x5f'),'GROUP_CONCAT ASC':_0x5986('0x60'),'GROUP_CONCAT DESC':_0x5986('0x89')};var _0x273a37={'SEC_TO_TIME':_0x5986('0xa6'),'DATE':_0x5986('0x61'),'HOUR':_0x5986('0x62'),'ROUND':_0x5986('0x63'),'UNIX_TIMESTAMP':_0x5986('0x8a')};var _0x52e9a3=function(_0xc46e90){return!_[_0x5986('0x64')](['IS\x20NULL',_0x5986('0x66'),'IS\x20EMPTY',_0x5986('0x8b')],_0xc46e90);};var _0x4f370e=function(_0x1078ff){if(!_0x1078ff||!_0x1078ff[_0x5986('0x68')][_0x5986('0x39')]){return'';}for(var _0x309b59='(',_0x56ecbe=0x0;_0x56ecbe<_0x1078ff['rules'][_0x5986('0x39')];_0x56ecbe+=0x1){_0x56ecbe>0x0&&(_0x309b59+='\x20'+_0x1078ff['operator']+'\x20');_0x309b59+=_0x1078ff['rules'][_0x56ecbe][_0x5986('0x6a')]?_0x4f370e(_0x1078ff[_0x5986('0x68')][_0x56ecbe]['group']):_0x1078ff[_0x5986('0x68')][_0x56ecbe]['field']+'\x20'+_0x1078ff[_0x5986('0x68')][_0x56ecbe][_0x5986('0x6b')]+(_0x52e9a3(_0x1078ff['rules'][_0x56ecbe]['condition'])?'\x20'+_0x1078ff[_0x5986('0x68')][_0x56ecbe]['value']:'');}return _0x309b59+')';};var _0x472ade={'where':{'id':_0xa625b[_0x5986('0x49')]['id']}},_0x57891b,_0x4caa44,_0x45af1c,_0x16b144,_0x3a30bb;_0x472ade=_['merge']({},_0x472ade,_0xa625b['options']);return db[_0x5986('0x2d')][_0x5986('0x4b')](_0x472ade)['then'](function(_0x39827a){if(_0x39827a){_0x57891b=_0x39827a;return _0x39827a[_0x5986('0x6c')]();}return null;})['then'](function(_0x221584){if(_0x221584){if(!_0x221584[_0x5986('0x39')]){throw new db[(_0x5986('0x6d'))][(_0x5986('0x6e'))](_0x5986('0xa7'),0x193);}_0x4caa44=_0x221584;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x56559b){if(_0x56559b){_0x45af1c=_[_0x5986('0x6f')](_0x56559b,'id');var _0x5b1307;var _0x5018e4=squel[_0x5986('0x70')]();_0x5018e4[_0x5986('0x71')](_0x57891b['table']);for(var _0x24467d=0x0;_0x24467d<_0x4caa44[_0x5986('0x39')];_0x24467d+=0x1){_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x72')]?_0x45af1c[_0x4caa44[_0x24467d]['MetricId']][_0x5986('0x73')]:_0x4caa44[_0x24467d]['field'];_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x75')]?_['replace'](_0x19c7c4[_0x4caa44[_0x24467d][_0x5986('0x75')]],'%s',_0x5b1307):_0x5b1307;_0x5b1307=_0x4caa44[_0x24467d][_0x5986('0x76')]?_[_0x5986('0x74')](_0x273a37[_0x4caa44[_0x24467d][_0x5986('0x76')]],'%s',_0x5b1307):_0x5b1307;if(_0x4caa44[_0x24467d][_0x5986('0x8e')]){_0x5018e4[_0x5986('0x6a')](_0x5b1307);}_0x4caa44[_0x24467d][_0x5986('0x77')]&&_0x5018e4[_0x5986('0x3c')](_0x5b1307,_0x4caa44[_0x24467d]['orderBy']===_0x5986('0x78')?![]:!![]);_0x5018e4[_0x5986('0x79')](_0x5b1307,_0x4caa44[_0x24467d][_0x5986('0x8f')]||_0x5b1307);}if(_0x57891b[_0x5986('0x7a')]){_0x57891b[_0x5986('0x7a')]=JSON[_0x5986('0x7b')](_0x57891b[_0x5986('0x7a')]);for(var _0x28b022=0x0;_0x28b022<_0x57891b['joins'][_0x5986('0x39')];_0x28b022+=0x1){if(_0x57891b[_0x5986('0x7a')][_0x28b022]['type']&&_[_0x5986('0x64')](_0x110f33,_0x57891b['joins'][_0x28b022]['type'])&&_0x57891b['joins'][_0x28b022][_0x5986('0x7c')]&&_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7d')]&&_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x80')]){_0x5018e4[_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x30')]](_0x57891b['joins'][_0x28b022]['foreignTable'],null,util[_0x5986('0x76')](_0x5986('0x7e'),_0x57891b['table'],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7c')],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x7d')],_0x57891b[_0x5986('0x7a')][_0x28b022][_0x5986('0x80')]));}}}if(_0x57891b[_0x5986('0x81')]){_0x57891b[_0x5986('0x81')]=JSON[_0x5986('0x7b')](_0x57891b[_0x5986('0x81')]);_0x5018e4[_0x5986('0x40')](_0x4f370e(_0x57891b['conditions'][_0x5986('0x6a')]));}_0x3a30bb=_0x5018e4['clone']();_0x5018e4['limit'](_0x227bb6);_0x5018e4[_0x5986('0x1f')](0x0);logger['debug'](_0x5986('0x84'),_0x5018e4[_0x5986('0x86')]());return db[_0x5986('0x85')][_0x5986('0x33')](_0x5018e4[_0x5986('0x86')](),{'type':db[_0x5986('0x85')][_0x5986('0x87')][_0x5986('0x88')]});}})['then'](function(){return{'sql':_0x3a30bb['toString']()};})['then'](respondWithResult(_0x27f845,null))[_0x5986('0x47')](handleError(_0x27f845,null));}; \ No newline at end of file +var _0x26c6=['name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','preview','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','ValidationErrorItem','DESC','SELECT','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','count','limit','Content-Range','reject','save','then','CustomReports','UserProfileResource','error','stack'];(function(_0x294de8,_0x56ca77){var _0x2914e5=function(_0x2338a2){while(--_0x2338a2){_0x294de8['push'](_0x294de8['shift']());}};_0x2914e5(++_0x56ca77);}(_0x26c6,0x128));var _0x626c=function(_0x2cb89c,_0x2fd266){_0x2cb89c=_0x2cb89c-0x0;var _0x366213=_0x26c6[_0x2cb89c];return _0x366213;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x626c('0x0'));var rimraf=require(_0x626c('0x1'));var zipdir=require(_0x626c('0x2'));var jsonpatch=require(_0x626c('0x3'));var rp=require('request-promise');var moment=require(_0x626c('0x4'));var BPromise=require(_0x626c('0x5'));var Mustache=require(_0x626c('0x6'));var util=require(_0x626c('0x7'));var path=require(_0x626c('0x8'));var sox=require(_0x626c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x626c('0xa'));var crypto=require(_0x626c('0xb'));var jsforce=require(_0x626c('0xc'));var deskjs=require(_0x626c('0xd'));var toCsv=require(_0x626c('0xe'));var querystring=require(_0x626c('0xf'));var Papa=require(_0x626c('0x10'));var Redis=require(_0x626c('0x11'));var authService=require(_0x626c('0x12'));var qs=require(_0x626c('0x13'));var as=require(_0x626c('0x14'));var hardwareService=require(_0x626c('0x15'));var logger=require(_0x626c('0x16'))(_0x626c('0x17'));var utils=require(_0x626c('0x18'));var config=require(_0x626c('0x19'));var licenseUtil=require(_0x626c('0x1a'));var db=require(_0x626c('0x1b'))['db'];var dbH=require(_0x626c('0x1b'))[_0x626c('0x1c')];function respondWithStatusCode(_0x34005f,_0x55d748){_0x55d748=_0x55d748||0xcc;return function(_0x29c73d){if(_0x29c73d){return _0x34005f['sendStatus'](_0x55d748);}return _0x34005f[_0x626c('0x1d')](_0x55d748)[_0x626c('0x1e')]();};}function respondWithResult(_0x4cc04d,_0x1a79bb){_0x1a79bb=_0x1a79bb||0xc8;return function(_0x2f2d81){if(_0x2f2d81){return _0x4cc04d[_0x626c('0x1d')](_0x1a79bb)[_0x626c('0x1f')](_0x2f2d81);}};}function respondWithFilteredResult(_0x4c5d8b,_0x75c4bb){return function(_0x98e3c){if(_0x98e3c){var _0x29f5f6=_0x98e3c[_0x626c('0x20')],_0x47a8c4=_0x75c4bb['offset'],_0x5cbb36=_0x75c4bb['offset']+_0x75c4bb[_0x626c('0x21')],_0x2bfa2c;if(_0x5cbb36>=_0x29f5f6){_0x5cbb36=_0x29f5f6;_0x2bfa2c=0xc8;}else{_0x2bfa2c=0xce;}_0x4c5d8b[_0x626c('0x1d')](_0x2bfa2c);return _0x4c5d8b['set'](_0x626c('0x22'),_0x47a8c4+'-'+_0x5cbb36+'/'+_0x29f5f6)[_0x626c('0x1f')](_0x98e3c);}return null;};}function patchUpdates(_0x24e98e){return function(_0xec3cef){try{jsonpatch['apply'](_0xec3cef,_0x24e98e,!![]);}catch(_0x46dfaa){return BPromise[_0x626c('0x23')](_0x46dfaa);}return _0xec3cef[_0x626c('0x24')]();};}function saveUpdates(_0x3267ff,_0x3218f9){return function(_0x558789){if(_0x558789){return _0x558789['update'](_0x3267ff)[_0x626c('0x25')](function(_0x3a7faa){return _0x3a7faa;});}return null;};}function removeEntity(_0x200dde,_0x2500db){return function(_0x4eea75){if(_0x4eea75){return _0x4eea75['destroy']()[_0x626c('0x25')](function(){var _0x1f652b=_0x4eea75['get']({'plain':!![]});var _0x217fdc=_0x626c('0x26');return db[_0x626c('0x27')]['destroy']({'where':{'type':_0x217fdc,'resourceId':_0x1f652b['id']}})[_0x626c('0x25')](function(){return _0x4eea75;});})[_0x626c('0x25')](function(){_0x200dde['status'](0xcc)[_0x626c('0x1e')]();});}};}function handleEntityNotFound(_0x3f3444,_0x92e344){return function(_0x783b43){if(!_0x783b43){_0x3f3444['sendStatus'](0x194);}return _0x783b43;};}function handleError(_0x4601f1,_0x15fdfd){_0x15fdfd=_0x15fdfd||0x1f4;return function(_0x402398){logger[_0x626c('0x28')](_0x402398[_0x626c('0x29')]);if(_0x402398[_0x626c('0x2a')]){delete _0x402398[_0x626c('0x2a')];}_0x4601f1[_0x626c('0x1d')](_0x15fdfd)[_0x626c('0x2b')](_0x402398);};}exports[_0x626c('0x2c')]=function(_0x2434b9,_0xbf2418){var _0x50dfff={},_0x34e593={},_0xa1b61={'count':0x0,'rows':[]};var _0xf9dbaf=_['map'](db[_0x626c('0x2d')][_0x626c('0x2e')],function(_0xd03be7){return{'name':_0xd03be7[_0x626c('0x2f')],'type':_0xd03be7[_0x626c('0x30')][_0x626c('0x31')]};});_0x34e593[_0x626c('0x32')]=_[_0x626c('0x33')](_0xf9dbaf,_0x626c('0x2a'));_0x34e593[_0x626c('0x34')]=_[_0x626c('0x35')](_0x2434b9[_0x626c('0x34')]);_0x34e593[_0x626c('0x36')]=_[_0x626c('0x37')](_0x34e593[_0x626c('0x32')],_0x34e593[_0x626c('0x34')]);_0x50dfff[_0x626c('0x38')]=_[_0x626c('0x37')](_0x34e593[_0x626c('0x32')],qs[_0x626c('0x39')](_0x2434b9[_0x626c('0x34')]['fields']));_0x50dfff[_0x626c('0x38')]=_0x50dfff[_0x626c('0x38')][_0x626c('0x3a')]?_0x50dfff['attributes']:_0x34e593[_0x626c('0x32')];if(!_0x2434b9[_0x626c('0x34')][_0x626c('0x3b')](_0x626c('0x3c'))){_0x50dfff[_0x626c('0x21')]=qs['limit'](_0x2434b9['query'][_0x626c('0x21')]);_0x50dfff[_0x626c('0x3d')]=qs[_0x626c('0x3d')](_0x2434b9[_0x626c('0x34')][_0x626c('0x3d')]);}_0x50dfff[_0x626c('0x3e')]=qs['sort'](_0x2434b9[_0x626c('0x34')]['sort']);_0x50dfff[_0x626c('0x3f')]=qs[_0x626c('0x36')](_[_0x626c('0x40')](_0x2434b9[_0x626c('0x34')],_0x34e593[_0x626c('0x36')]),_0xf9dbaf);if(_0x2434b9[_0x626c('0x34')][_0x626c('0x41')]){_0x50dfff['where']=_[_0x626c('0x42')](_0x50dfff[_0x626c('0x3f')],{'$or':_[_0x626c('0x33')](_0xf9dbaf,function(_0x68fa7a){if(_0x68fa7a[_0x626c('0x30')]!==_0x626c('0x43')){var _0x5e7f8e={};_0x5e7f8e[_0x68fa7a['name']]={'$like':'%'+_0x2434b9[_0x626c('0x34')][_0x626c('0x41')]+'%'};return _0x5e7f8e;}})});}_0x50dfff=_[_0x626c('0x42')]({},_0x50dfff,_0x2434b9['options']);var _0x4fecec={'where':_0x50dfff['where']};return db[_0x626c('0x2d')]['count'](_0x4fecec)[_0x626c('0x25')](function(_0x283240){_0xa1b61[_0x626c('0x20')]=_0x283240;if(_0x2434b9[_0x626c('0x34')][_0x626c('0x44')]){_0x50dfff['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x50dfff);})[_0x626c('0x25')](function(_0x5ac5a2){_0xa1b61[_0x626c('0x45')]=_0x5ac5a2;return _0xa1b61;})[_0x626c('0x25')](respondWithFilteredResult(_0xbf2418,_0x50dfff))[_0x626c('0x46')](handleError(_0xbf2418,null));};exports['show']=function(_0x805cae,_0x20440d){var _0x587a6a={'raw':![],'where':{'id':_0x805cae[_0x626c('0x47')]['id']}},_0x4a4055={};_0x4a4055['model']=_[_0x626c('0x35')](db[_0x626c('0x2d')]['rawAttributes']);_0x4a4055['query']=_[_0x626c('0x35')](_0x805cae[_0x626c('0x34')]);_0x4a4055['filters']=_['intersection'](_0x4a4055[_0x626c('0x32')],_0x4a4055['query']);_0x587a6a[_0x626c('0x38')]=_[_0x626c('0x37')](_0x4a4055['model'],qs[_0x626c('0x39')](_0x805cae[_0x626c('0x34')]['fields']));_0x587a6a[_0x626c('0x38')]=_0x587a6a[_0x626c('0x38')][_0x626c('0x3a')]?_0x587a6a[_0x626c('0x38')]:_0x4a4055[_0x626c('0x32')];if(_0x805cae[_0x626c('0x34')][_0x626c('0x44')]){_0x587a6a[_0x626c('0x48')]=[{'all':!![]}];}_0x587a6a=_['merge']({},_0x587a6a,_0x805cae['options']);return db[_0x626c('0x2d')][_0x626c('0x49')](_0x587a6a)[_0x626c('0x25')](handleEntityNotFound(_0x20440d,null))[_0x626c('0x25')](respondWithResult(_0x20440d,null))[_0x626c('0x46')](handleError(_0x20440d,null));};exports[_0x626c('0x4a')]=function(_0x49e94c,_0x17ca1f){return db[_0x626c('0x2d')][_0x626c('0x4a')](_0x49e94c[_0x626c('0x4b')],{})[_0x626c('0x25')](function(_0x3292ed){var _0x48dd48=_0x49e94c[_0x626c('0x4c')][_0x626c('0x4d')]({'plain':!![]});if(!_0x48dd48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48dd48[_0x626c('0x4e')]===_0x626c('0x4c')){var _0x207c78=_0x3292ed['get']({'plain':!![]});var _0x82de15='Reports';return db[_0x626c('0x4f')][_0x626c('0x49')]({'where':{'name':_0x82de15,'userProfileId':_0x48dd48['userProfileId']},'raw':!![]})[_0x626c('0x25')](function(_0x40c03d){if(_0x40c03d&&_0x40c03d[_0x626c('0x50')]===0x0){return db[_0x626c('0x27')][_0x626c('0x4a')]({'name':_0x207c78[_0x626c('0x2a')],'resourceId':_0x207c78['id'],'type':_0x626c('0x26'),'sectionId':_0x40c03d['id']},{})[_0x626c('0x25')](function(){return _0x3292ed;});}else{return _0x3292ed;}})[_0x626c('0x46')](function(_0xf4833d){logger[_0x626c('0x28')](_0x626c('0x51'),_0xf4833d);throw _0xf4833d;});}return _0x3292ed;})['then'](respondWithResult(_0x17ca1f,0xc9))['catch'](handleError(_0x17ca1f,null));};exports[_0x626c('0x52')]=function(_0x22337a,_0x49cacf){if(_0x22337a[_0x626c('0x4b')]['id']){delete _0x22337a[_0x626c('0x4b')]['id'];}return db[_0x626c('0x2d')][_0x626c('0x49')]({'where':{'id':_0x22337a[_0x626c('0x47')]['id']}})[_0x626c('0x25')](handleEntityNotFound(_0x49cacf,null))[_0x626c('0x25')](saveUpdates(_0x22337a[_0x626c('0x4b')],null))[_0x626c('0x25')](respondWithResult(_0x49cacf,null))[_0x626c('0x46')](handleError(_0x49cacf,null));};exports[_0x626c('0x53')]=function(_0xa4e9cc,_0x361b6b){return db['AnalyticCustomReport'][_0x626c('0x49')]({'where':{'id':_0xa4e9cc['params']['id']}})[_0x626c('0x25')](handleEntityNotFound(_0x361b6b,null))['then'](removeEntity(_0x361b6b,null))[_0x626c('0x46')](handleError(_0x361b6b,null));};exports[_0x626c('0x54')]=function(_0x4d8d48,_0x28b59a){var _0x41c3e9=0xa;var _0x335ff1=['join',_0x626c('0x55'),_0x626c('0x56'),'cross_join'];var _0x3fe6a1={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':_0x626c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x516319={'SEC_TO_TIME':_0x626c('0x5e'),'DATE':_0x626c('0x5f'),'HOUR':_0x626c('0x60'),'ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x32a315=function(_0x2759cb){return!_[_0x626c('0x63')]([_0x626c('0x64'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x626c('0x65')],_0x2759cb);};var _0x1ef07b=function(_0x5d1c04){if(!_0x5d1c04||!_0x5d1c04[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x2e2445='(',_0x630cb8=0x0;_0x630cb8<_0x5d1c04[_0x626c('0x66')][_0x626c('0x3a')];_0x630cb8+=0x1){_0x630cb8>0x0&&(_0x2e2445+='\x20'+_0x5d1c04[_0x626c('0x67')]+'\x20');_0x2e2445+=_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x68')]?_0x1ef07b(_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x68')]):_0x5d1c04['rules'][_0x630cb8][_0x626c('0x69')]+'\x20'+_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x6a')]+(_0x32a315(_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x6a')])?'\x20'+_0x5d1c04['rules'][_0x630cb8][_0x626c('0x6b')]:'');}return _0x2e2445+')';};var _0xa1256b={'where':{'id':_0x4d8d48[_0x626c('0x47')]['id']}},_0x2dee6e,_0x3a4b75,_0x377904,_0x47026d,_0x7dea60;_0xa1256b=_[_0x626c('0x42')]({},_0xa1256b,_0x4d8d48[_0x626c('0x6c')]);return db[_0x626c('0x2d')][_0x626c('0x49')](_0xa1256b)[_0x626c('0x25')](function(_0x2b157a){if(_0x2b157a){_0x2dee6e=_0x2b157a;return _0x2b157a[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x3e49e0){if(_0x3e49e0){if(!_0x3e49e0[_0x626c('0x3a')]){throw new db[(_0x626c('0x6e'))]['ValidationErrorItem'](_0x626c('0x6f'),0x193);}_0x3a4b75=_0x3e49e0;return db[_0x626c('0x70')][_0x626c('0x71')]({'raw':!![]});}return null;})[_0x626c('0x25')](function(_0xc41e0e){if(_0xc41e0e){_0x377904=_[_0x626c('0x72')](_0xc41e0e,'id');var _0x1e8a31;var _0x198597=squel[_0x626c('0x73')]();_0x198597[_0x626c('0x74')](_0x2dee6e[_0x626c('0x75')]);for(var _0x43fd90=0x0;_0x43fd90<_0x3a4b75[_0x626c('0x3a')];_0x43fd90+=0x1){_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x76')]?_0x377904[_0x3a4b75[_0x43fd90]['MetricId']][_0x626c('0x77')]:_0x3a4b75[_0x43fd90][_0x626c('0x69')];_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x78')]?_['replace'](_0x3fe6a1[_0x3a4b75[_0x43fd90][_0x626c('0x78')]],'%s',_0x1e8a31):_0x1e8a31;_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x516319[_0x3a4b75[_0x43fd90][_0x626c('0x79')]],'%s',_0x1e8a31):_0x1e8a31;if(_0x3a4b75[_0x43fd90][_0x626c('0x7b')]){_0x198597[_0x626c('0x68')](_0x1e8a31);}_0x3a4b75[_0x43fd90][_0x626c('0x7c')]&&_0x198597[_0x626c('0x3e')](_0x1e8a31,_0x3a4b75[_0x43fd90][_0x626c('0x7c')]==='DESC'?![]:!![]);_0x198597[_0x626c('0x69')](_0x1e8a31,_0x3a4b75[_0x43fd90][_0x626c('0x7d')]||_0x1e8a31);}if(_0x2dee6e['joins']){_0x2dee6e[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x2dee6e[_0x626c('0x7e')]);for(var _0xd8a682=0x0;_0xd8a682<_0x2dee6e[_0x626c('0x7e')][_0x626c('0x3a')];_0xd8a682+=0x1){if(_0x2dee6e[_0x626c('0x7e')][_0xd8a682]['type']&&_[_0x626c('0x63')](_0x335ff1,_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x30')])&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x80')]&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x81')]&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x82')]){_0x198597[_0x2dee6e['joins'][_0xd8a682]['type']](_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x2dee6e[_0x626c('0x75')],_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x80')],_0x2dee6e[_0x626c('0x7e')][_0xd8a682]['foreignTable'],_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x82')]));}}}if(_0x2dee6e[_0x626c('0x84')]){_0x2dee6e[_0x626c('0x84')]=JSON[_0x626c('0x7f')](_0x2dee6e[_0x626c('0x84')]);_0x198597['where'](_0x1ef07b(_0x2dee6e[_0x626c('0x84')][_0x626c('0x68')]));}_0x7dea60=_0x198597[_0x626c('0x85')]();_0x198597[_0x626c('0x21')](_0x41c3e9);_0x198597[_0x626c('0x3d')](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x198597[_0x626c('0x88')]());return db['sequelize']['query'](_0x198597[_0x626c('0x88')](),{'type':db[_0x626c('0x89')][_0x626c('0x8a')]['SELECT']});}})['then'](respondWithResult(_0x28b59a,null))['catch'](handleError(_0x28b59a,null));};function runReport(_0x39e6f7,_0x57d838,_0x229b8c){var _0x2814c6=_0x57d838[_0x626c('0x2a')];var _0xd17036=0xa;var _0x14683b=[_0x626c('0x8b'),'left_join',_0x626c('0x56'),'cross_join'];var _0x594a76={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':_0x626c('0x8c'),'MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3c01fe={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x626c('0x60'),'ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x182f27=function(_0x496bee){return!_[_0x626c('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x626c('0x8d'),_0x626c('0x65')],_0x496bee);};var _0x517987=function(_0x4a8a46){if(!_0x4a8a46||!_0x4a8a46[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x18ebd6='(',_0x58928=0x0;_0x58928<_0x4a8a46[_0x626c('0x66')][_0x626c('0x3a')];_0x58928+=0x1){_0x58928>0x0&&(_0x18ebd6+='\x20'+_0x4a8a46[_0x626c('0x67')]+'\x20');_0x18ebd6+=_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x68')]?_0x517987(_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x68')]):_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x69')]+'\x20'+_0x4a8a46[_0x626c('0x66')][_0x58928]['condition']+(_0x182f27(_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x6a')])?'\x20'+_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x6b')]:'');}return _0x18ebd6+')';};var _0x15f04d={'where':{'id':_0x39e6f7['id']}},_0x5b0d72,_0x1c24f2,_0xc2771d,_0x3a904a,_0x1728c5;_0x15f04d=_[_0x626c('0x42')]({},_0x15f04d,_0x229b8c);return db[_0x626c('0x2d')][_0x626c('0x49')](_0x15f04d)['then'](function(_0x5777bb){if(_0x5777bb){_0x5b0d72=_0x5777bb;return _0x5777bb[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x4c1ce8){if(_0x4c1ce8){if(!_0x4c1ce8['length']){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))](_0x626c('0x6f'),0x193);}_0x1c24f2=_0x4c1ce8;return db[_0x626c('0x70')][_0x626c('0x71')]({'raw':!![]});}return null;})[_0x626c('0x25')](function(_0x42f03b){if(_0x42f03b){_0xc2771d=_[_0x626c('0x72')](_0x42f03b,'id');var _0x3a933c;var _0x397054=squel[_0x626c('0x73')]();_0x397054[_0x626c('0x74')](_0x5b0d72[_0x626c('0x75')]);for(var _0x3e3505=0x0;_0x3e3505<_0x1c24f2[_0x626c('0x3a')];_0x3e3505+=0x1){_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x76')]?_0xc2771d[_0x1c24f2[_0x3e3505][_0x626c('0x76')]]['metric']:_0x1c24f2[_0x3e3505][_0x626c('0x69')];_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x78')]?_[_0x626c('0x7a')](_0x594a76[_0x1c24f2[_0x3e3505]['function']],'%s',_0x3a933c):_0x3a933c;_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x3c01fe[_0x1c24f2[_0x3e3505]['format']],'%s',_0x3a933c):_0x3a933c;if(_0x1c24f2[_0x3e3505][_0x626c('0x7b')]){_0x397054[_0x626c('0x68')](_0x3a933c);}_0x1c24f2[_0x3e3505][_0x626c('0x7c')]&&_0x397054['order'](_0x3a933c,_0x1c24f2[_0x3e3505]['orderBy']===_0x626c('0x8f')?![]:!![]);_0x397054[_0x626c('0x69')](_0x3a933c,_0x1c24f2[_0x3e3505][_0x626c('0x7d')]||_0x3a933c);}if(_0x5b0d72[_0x626c('0x7e')]){_0x5b0d72[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x5b0d72[_0x626c('0x7e')]);for(var _0x1c994f=0x0;_0x1c994f<_0x5b0d72[_0x626c('0x7e')][_0x626c('0x3a')];_0x1c994f+=0x1){if(_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')]&&_['includes'](_0x14683b,_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')])&&_0x5b0d72['joins'][_0x1c994f][_0x626c('0x80')]&&_0x5b0d72[_0x626c('0x7e')][_0x1c994f]['foreignTable']&&_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x82')]){_0x397054[_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')]](_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x5b0d72['table'],_0x5b0d72['joins'][_0x1c994f][_0x626c('0x80')],_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x81')],_0x5b0d72['joins'][_0x1c994f][_0x626c('0x82')]));}}}if(_0x5b0d72[_0x626c('0x84')]){_0x5b0d72['conditions']=JSON[_0x626c('0x7f')](_0x5b0d72[_0x626c('0x84')]);_0x397054[_0x626c('0x3f')](_0x517987(_0x5b0d72['conditions'][_0x626c('0x68')]));}_0x1728c5=_0x397054[_0x626c('0x85')]();_0x397054[_0x626c('0x21')](_0xd17036);_0x397054['offset'](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x397054['toString']());return db[_0x626c('0x89')][_0x626c('0x34')](_0x397054[_0x626c('0x88')](),{'type':db['sequelize'][_0x626c('0x8a')][_0x626c('0x90')]});}})[_0x626c('0x25')](function(_0x40b37e){if(!_0x40b37e['length']){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))](_0x626c('0x91'),0xcc);}if(_0x57d838[_0x626c('0x92')]==='web'){return null;}var _0x390d57=_[_0x626c('0x42')](_0x57d838,{'name':_0x57d838['fullPath']||_0x57d838['name']||_0x5b0d72['name'],'basename':_0x2814c6,'savename':util[_0x626c('0x79')](_0x626c('0x93'),_0x57d838[_0x626c('0x2a')]||_0x5b0d72['name'],require(_0x626c('0x94'))[_0x626c('0x95')](0x4),_0x57d838['output']||_0x626c('0x96')),'reportId':_0x5b0d72['id'],'reportType':_0x626c('0x97')});return db[_0x626c('0x98')][_0x626c('0x4a')](_0x390d57,{'raw':!![]});})[_0x626c('0x25')](function(_0x49d8fe){if(_0x5b0d72[_0x626c('0x75')]===_0x626c('0x99')){_0x1728c5['where'](_0x5b0d72[_0x626c('0x75')]+_0x626c('0x9a'),_0x57d838[_0x626c('0x9b')],_0x57d838[_0x626c('0x9c')]);}else{_0x1728c5[_0x626c('0x3f')](_0x5b0d72['table']+_0x626c('0x9d'),_0x57d838[_0x626c('0x9b')],_0x57d838[_0x626c('0x9c')]);}if(_0x49d8fe){logger[_0x626c('0x9e')](_0x626c('0x9f'),_0x1728c5['toString']());require('child_process')[_0x626c('0xa0')](path[_0x626c('0x8b')](__dirname,_0x626c('0xa1'),_0x49d8fe['output']),[_0x49d8fe['id'],_0x1728c5[_0x626c('0x88')](),path[_0x626c('0x8b')](__dirname,_0x626c('0xa2'),_0x49d8fe[_0x626c('0xa3')]),_0x2814c6]);return _0x49d8fe;}else{var _0x4ff0cc=squel[_0x626c('0x73')]();_0x4ff0cc[_0x626c('0x74')]('('+_0x1728c5[_0x626c('0x88')]()+')','countTable');_0x4ff0cc[_0x626c('0x69')](_0x626c('0xa4'),_0x626c('0x20'));_0x1728c5[_0x626c('0x21')](_0x57d838[_0x626c('0x21')]||_0xd17036);_0x1728c5[_0x626c('0x3d')](_0x57d838[_0x626c('0x3d')]||0x0);return dbH[_0x626c('0x89')][_0x626c('0x34')](_0x4ff0cc[_0x626c('0x88')](),{'type':dbH['sequelize'][_0x626c('0x8a')][_0x626c('0x90')]})[_0x626c('0x25')](function(_0x4c2fd7){if(!_0x4c2fd7[_0x626c('0x3a')]){_0x3a904a=0x0;}else{_0x3a904a=_0x4c2fd7[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x1728c5[_0x626c('0x88')](),{'type':dbH[_0x626c('0x89')][_0x626c('0x8a')][_0x626c('0x90')]});})['then'](function(_0x4bd54e){return{'rows':_0x4bd54e||[],'count':_0x3a904a};});}});}exports[_0x626c('0xa5')]=function(_0x270626,_0x5cc5ad){return runReport(_0x270626[_0x626c('0x47')],_0x270626[_0x626c('0x34')],_0x270626[_0x626c('0x6c')])[_0x626c('0x25')](respondWithResult(_0x5cc5ad,null))[_0x626c('0x46')](handleError(_0x5cc5ad,null));};exports[_0x626c('0xa6')]=runReport;exports[_0x626c('0x34')]=function(_0x583f30,_0x1c071c){var _0x5dcb62=0xa;var _0x3b4d45=[_0x626c('0x8b'),_0x626c('0x55'),_0x626c('0x56'),_0x626c('0xa7')];var _0x1fa9f5={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':_0x626c('0x8c'),'MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':_0x626c('0x5d'),'GROUP_CONCAT DESC':_0x626c('0xa8')};var _0x48c5df={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x626c('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x12175b=function(_0x4df3b9){return!_[_0x626c('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4df3b9);};var _0x486d2b=function(_0x1416d9){if(!_0x1416d9||!_0x1416d9[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x3df467='(',_0xb71e6b=0x0;_0xb71e6b<_0x1416d9['rules'][_0x626c('0x3a')];_0xb71e6b+=0x1){_0xb71e6b>0x0&&(_0x3df467+='\x20'+_0x1416d9['operator']+'\x20');_0x3df467+=_0x1416d9['rules'][_0xb71e6b][_0x626c('0x68')]?_0x486d2b(_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x68')]):_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x69')]+'\x20'+_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x6a')]+(_0x12175b(_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x6a')])?'\x20'+_0x1416d9[_0x626c('0x66')][_0xb71e6b]['value']:'');}return _0x3df467+')';};var _0xa043fa={'where':{'id':_0x583f30[_0x626c('0x47')]['id']}},_0x134e16,_0x507f39,_0x34ae15,_0x3c2a7c,_0x3474a0;_0xa043fa=_['merge']({},_0xa043fa,_0x583f30[_0x626c('0x6c')]);return db['AnalyticCustomReport'][_0x626c('0x49')](_0xa043fa)[_0x626c('0x25')](function(_0x216de4){if(_0x216de4){_0x134e16=_0x216de4;return _0x216de4[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x52634d){if(_0x52634d){if(!_0x52634d[_0x626c('0x3a')]){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x507f39=_0x52634d;return db[_0x626c('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x873998){if(_0x873998){_0x34ae15=_[_0x626c('0x72')](_0x873998,'id');var _0x24eb8d;var _0x185038=squel['select']();_0x185038[_0x626c('0x74')](_0x134e16['table']);for(var _0x30b94b=0x0;_0x30b94b<_0x507f39[_0x626c('0x3a')];_0x30b94b+=0x1){_0x24eb8d=_0x507f39[_0x30b94b]['MetricId']?_0x34ae15[_0x507f39[_0x30b94b]['MetricId']][_0x626c('0x77')]:_0x507f39[_0x30b94b]['field'];_0x24eb8d=_0x507f39[_0x30b94b][_0x626c('0x78')]?_['replace'](_0x1fa9f5[_0x507f39[_0x30b94b]['function']],'%s',_0x24eb8d):_0x24eb8d;_0x24eb8d=_0x507f39[_0x30b94b][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x48c5df[_0x507f39[_0x30b94b][_0x626c('0x79')]],'%s',_0x24eb8d):_0x24eb8d;if(_0x507f39[_0x30b94b][_0x626c('0x7b')]){_0x185038[_0x626c('0x68')](_0x24eb8d);}_0x507f39[_0x30b94b][_0x626c('0x7c')]&&_0x185038[_0x626c('0x3e')](_0x24eb8d,_0x507f39[_0x30b94b][_0x626c('0x7c')]===_0x626c('0x8f')?![]:!![]);_0x185038[_0x626c('0x69')](_0x24eb8d,_0x507f39[_0x30b94b][_0x626c('0x7d')]||_0x24eb8d);}if(_0x134e16[_0x626c('0x7e')]){_0x134e16[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x134e16['joins']);for(var _0x58534a=0x0;_0x58534a<_0x134e16[_0x626c('0x7e')]['length'];_0x58534a+=0x1){if(_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x30')]&&_[_0x626c('0x63')](_0x3b4d45,_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x30')])&&_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x80')]&&_0x134e16[_0x626c('0x7e')][_0x58534a]['foreignTable']&&_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x82')]){_0x185038[_0x134e16['joins'][_0x58534a][_0x626c('0x30')]](_0x134e16['joins'][_0x58534a][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x134e16[_0x626c('0x75')],_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x80')],_0x134e16['joins'][_0x58534a][_0x626c('0x81')],_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x82')]));}}}if(_0x134e16[_0x626c('0x84')]){_0x134e16[_0x626c('0x84')]=JSON[_0x626c('0x7f')](_0x134e16[_0x626c('0x84')]);_0x185038[_0x626c('0x3f')](_0x486d2b(_0x134e16[_0x626c('0x84')][_0x626c('0x68')]));}_0x3474a0=_0x185038[_0x626c('0x85')]();_0x185038[_0x626c('0x21')](_0x5dcb62);_0x185038[_0x626c('0x3d')](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x185038[_0x626c('0x88')]());return db[_0x626c('0x89')]['query'](_0x185038[_0x626c('0x88')](),{'type':db[_0x626c('0x89')][_0x626c('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x3474a0[_0x626c('0x88')]()};})['then'](respondWithResult(_0x1c071c,null))[_0x626c('0x46')](handleError(_0x1c071c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8436020..dd4bc12 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 _0xeca9=['lodash','util','api','moment','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x5dbd62,_0x2579b0){var _0x4bfd3e=function(_0x252d45){while(--_0x252d45){_0x5dbd62['push'](_0x5dbd62['shift']());}};_0x4bfd3e(++_0x2579b0);}(_0xeca9,0x79));var _0x9eca=function(_0x59c69b,_0x5be2c4){_0x59c69b=_0x59c69b-0x0;var _0x12cbe6=_0xeca9[_0x59c69b];return _0x12cbe6;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require('../../config/logger')(_0x9eca('0x2'));var moment=require(_0x9eca('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eca('0x4'));var rimraf=require(_0x9eca('0x5'));var config=require(_0x9eca('0x6'));var attributes=require(_0x9eca('0x7'));module['exports']=function(_0x2de5e9,_0x191881){return _0x2de5e9[_0x9eca('0x8')](_0x9eca('0x9'),attributes,{'tableName':_0x9eca('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x732f=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x732f,0xf2));var _0xf732=function(_0x3accdb,_0x187888){_0x3accdb=_0x3accdb-0x0;var _0x4dab57=_0x732f[_0x3accdb];return _0x4dab57;};'use strict';var _=require(_0xf732('0x0'));var util=require(_0xf732('0x1'));var logger=require(_0xf732('0x2'))('api');var moment=require(_0xf732('0x3'));var BPromise=require(_0xf732('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf732('0x5'));var rimraf=require(_0xf732('0x6'));var config=require(_0xf732('0x7'));var attributes=require(_0xf732('0x8'));module['exports']=function(_0x573fba,_0x11295d){return _0x573fba['define'](_0xf732('0x9'),attributes,{'tableName':_0xf732('0xa'),'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 5baf891..08a1765 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 _0xb815=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x26f3ea,_0x21db54){var _0x99a77c=function(_0x5be3ca){while(--_0x5be3ca){_0x26f3ea['push'](_0x26f3ea['shift']());}};_0x99a77c(++_0x21db54);}(_0xb815,0xa0));var _0x5b81=function(_0x3e98d1,_0x45e559){_0x3e98d1=_0x3e98d1-0x0;var _0x2fcfb0=_0xb815[_0x3e98d1];return _0x2fcfb0;};'use strict';var _=require(_0x5b81('0x0'));var util=require(_0x5b81('0x1'));var moment=require(_0x5b81('0x2'));var BPromise=require(_0x5b81('0x3'));var rs=require(_0x5b81('0x4'));var fs=require('fs');var Redis=require(_0x5b81('0x5'));var db=require(_0x5b81('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b81('0x7'))(_0x5b81('0x8'));var config=require(_0x5b81('0x9'));var jayson=require(_0x5b81('0xa'));var client=jayson[_0x5b81('0xb')][_0x5b81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f30ab,_0x225465,_0xeb3a44){return new BPromise(function(_0x4fcf45,_0x3912f7){return client[_0x5b81('0xd')](_0x2f30ab,_0xeb3a44)[_0x5b81('0xe')](function(_0x5356e8){logger[_0x5b81('0xf')](_0x5b81('0x10'),_0x225465,_0x5b81('0x11'));logger['debug'](_0x5b81('0x12'),_0x225465,_0x5b81('0x11'),JSON['stringify'](_0x5356e8));if(_0x5356e8[_0x5b81('0x13')]){if(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x14')]===0x1f4){logger[_0x5b81('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);return _0x3912f7(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);}logger[_0x5b81('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5356e8[_0x5b81('0x13')]['message']);return _0x4fcf45(_0x5356e8[_0x5b81('0x13')][_0x5b81('0x15')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x225465,_0x5b81('0x11'));_0x4fcf45(_0x5356e8[_0x5b81('0x16')]['message']);}})['catch'](function(_0x5924af){logger[_0x5b81('0x13')](_0x5b81('0x10'),_0x225465,_0x5924af);_0x3912f7(_0x5924af);});});} \ No newline at end of file +var _0x9c11=['request\x20sent','debug','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x7101a5,_0x32ff66){var _0x258a99=function(_0x3c7298){while(--_0x3c7298){_0x7101a5['push'](_0x7101a5['shift']());}};_0x258a99(++_0x32ff66);}(_0x9c11,0xf1));var _0x19c1=function(_0x187b1b,_0x3b90c9){_0x187b1b=_0x187b1b-0x0;var _0x4e2087=_0x9c11[_0x187b1b];return _0x4e2087;};'use strict';var _=require(_0x19c1('0x0'));var util=require(_0x19c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19c1('0x2'));var fs=require('fs');var Redis=require(_0x19c1('0x3'));var db=require(_0x19c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x19c1('0x5'))(_0x19c1('0x6'));var config=require(_0x19c1('0x7'));var jayson=require(_0x19c1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36a0d3,_0x526c5d,_0xf0f02e){return new BPromise(function(_0x51df30,_0x27ba1a){return client['request'](_0x36a0d3,_0xf0f02e)[_0x19c1('0x9')](function(_0x1271dc){logger['info'](_0x19c1('0xa'),_0x526c5d,_0x19c1('0xb'));logger[_0x19c1('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x526c5d,_0x19c1('0xb'),JSON['stringify'](_0x1271dc));if(_0x1271dc[_0x19c1('0xd')]){if(_0x1271dc[_0x19c1('0xd')][_0x19c1('0xe')]===0x1f4){logger[_0x19c1('0xd')](_0x19c1('0xa'),_0x526c5d,_0x1271dc[_0x19c1('0xd')]['message']);return _0x27ba1a(_0x1271dc[_0x19c1('0xd')]['message']);}logger[_0x19c1('0xd')](_0x19c1('0xa'),_0x526c5d,_0x1271dc['error'][_0x19c1('0xf')]);return _0x51df30(_0x1271dc[_0x19c1('0xd')]['message']);}else{logger[_0x19c1('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x526c5d,_0x19c1('0xb'));_0x51df30(_0x1271dc[_0x19c1('0x11')][_0x19c1('0xf')]);}})['catch'](function(_0x6813b2){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x526c5d,_0x6813b2);_0x27ba1a(_0x6813b2);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 46b623e..a536651 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 _0x107d=['index','get','/:id','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','post','create','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x107d,0x173));var _0xd107=function(_0x4df998,_0x4f3540){_0x4df998=_0x4df998-0x0;var _0xf9deb8=_0x107d[_0x4df998];return _0xf9deb8;};'use strict';var multer=require('multer');var util=require(_0xd107('0x0'));var path=require('path');var timeout=require(_0xd107('0x1'));var express=require(_0xd107('0x2'));var router=express['Router']();var auth=require(_0xd107('0x3'));var interaction=require(_0xd107('0x4'));var config=require(_0xd107('0x5'));var controller=require(_0xd107('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd107('0x7')]);router[_0xd107('0x8')](_0xd107('0x9'),auth['isAuthenticated'](),controller[_0xd107('0xa')]);router[_0xd107('0x8')](_0xd107('0xb'),auth[_0xd107('0xc')](),controller[_0xd107('0xd')]);router[_0xd107('0x8')](_0xd107('0xe'),auth['isAuthenticated'](),controller[_0xd107('0xf')]);router[_0xd107('0x8')](_0xd107('0x10'),auth[_0xd107('0xc')](),controller['query']);router[_0xd107('0x11')]('/',auth[_0xd107('0xc')](),controller[_0xd107('0x12')]);router['put'](_0xd107('0x9'),auth[_0xd107('0xc')](),controller['update']);router[_0xd107('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd107('0x14')]=router; \ No newline at end of file +var _0xed66=['express','Router','./analyticCustomReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','run','query','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e6744,_0x495160){var _0x20ef10=function(_0x5540d6){while(--_0x5540d6){_0x2e6744['push'](_0x2e6744['shift']());}};_0x20ef10(++_0x495160);}(_0xed66,0x1a0));var _0x6ed6=function(_0x213295,_0x465d81){_0x213295=_0x213295-0x0;var _0x43a797=_0xed66[_0x213295];return _0x43a797;};'use strict';var multer=require(_0x6ed6('0x0'));var util=require(_0x6ed6('0x1'));var path=require(_0x6ed6('0x2'));var timeout=require(_0x6ed6('0x3'));var express=require(_0x6ed6('0x4'));var router=express[_0x6ed6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ed6('0x6'));router['get']('/',auth[_0x6ed6('0x7')](),controller['index']);router[_0x6ed6('0x8')]('/:id',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0x9')]);router['get'](_0x6ed6('0xa'),auth[_0x6ed6('0x7')](),controller['preview']);router[_0x6ed6('0x8')](_0x6ed6('0xb'),auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xc')]);router[_0x6ed6('0x8')]('/:id/query',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xd')]);router['post']('/',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xe')]);router[_0x6ed6('0xf')](_0x6ed6('0x10'),auth[_0x6ed6('0x7')](),controller['update']);router[_0x6ed6('0x11')](_0x6ed6('0x10'),auth[_0x6ed6('0x7')](),controller[_0x6ed6('0x12')]);module[_0x6ed6('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 1224e29..893c83e 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 _0xb3d1=['STRING','TEXT','sequelize','exports'];(function(_0x2c87fb,_0x3d584a){var _0x22cfd7=function(_0x2af648){while(--_0x2af648){_0x2c87fb['push'](_0x2c87fb['shift']());}};_0x22cfd7(++_0x3d584a);}(_0xb3d1,0x186));var _0x1b3d=function(_0x1e9bf5,_0x2b8466){_0x1e9bf5=_0x1e9bf5-0x0;var _0x3e43a0=_0xb3d1[_0x1e9bf5];return _0x3e43a0;};'use strict';var Sequelize=require(_0x1b3d('0x0'));module[_0x1b3d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b3d('0x2')]},'parent':{'type':Sequelize[_0x1b3d('0x2')]},'table':{'type':Sequelize[_0x1b3d('0x2')]},'conditions':{'type':Sequelize[_0x1b3d('0x3')]},'joins':{'type':Sequelize[_0x1b3d('0x3')]}}; \ No newline at end of file +var _0x8a59=['TEXT','exports','STRING'];(function(_0x378a9c,_0xb40ffb){var _0x319c46=function(_0xb2544f){while(--_0xb2544f){_0x378a9c['push'](_0x378a9c['shift']());}};_0x319c46(++_0xb40ffb);}(_0x8a59,0x160));var _0x98a5=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x8a59[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require('sequelize');module[_0x98a5('0x0')]={'name':{'type':Sequelize[_0x98a5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x98a5('0x1')]},'table':{'type':Sequelize[_0x98a5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x98a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 932d40a..3a7780c 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 _0x6e0d=['type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','preview','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','condition','getFields','Sequelize','keyBy','from','alias','%s.%s\x20=\x20%s.%s','debug','Limited\x20Query:','output','%s-%s.%s','randomstring','generate','csv','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x54d6bd,_0x2fafaf){var _0x3387e2=function(_0x234b2a){while(--_0x234b2a){_0x54d6bd['push'](_0x54d6bd['shift']());}};_0x3387e2(++_0x2fafaf);}(_0x6e0d,0x11c));var _0xd6e0=function(_0x79b695,_0x25ce22){_0x79b695=_0x79b695-0x0;var _0x49bd94=_0x6e0d[_0x79b695];return _0x49bd94;};'use strict';var pdf=require(_0xd6e0('0x0'));var emlformat=require(_0xd6e0('0x1'));var rimraf=require(_0xd6e0('0x2'));var zipdir=require(_0xd6e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6e0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6e0('0x6'));var fs=require('fs');var _=require(_0xd6e0('0x7'));var squel=require(_0xd6e0('0x8'));var crypto=require(_0xd6e0('0x9'));var jsforce=require(_0xd6e0('0xa'));var deskjs=require(_0xd6e0('0xb'));var toCsv=require(_0xd6e0('0xc'));var querystring=require(_0xd6e0('0xd'));var Papa=require('papaparse');var Redis=require(_0xd6e0('0xe'));var authService=require(_0xd6e0('0xf'));var qs=require(_0xd6e0('0x10'));var as=require(_0xd6e0('0x11'));var hardwareService=require(_0xd6e0('0x12'));var logger=require(_0xd6e0('0x13'))(_0xd6e0('0x14'));var utils=require(_0xd6e0('0x15'));var config=require(_0xd6e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6e0('0x17'))['db'];var dbH=require(_0xd6e0('0x17'))[_0xd6e0('0x18')];function respondWithStatusCode(_0x20900b,_0x4e12d9){_0x4e12d9=_0x4e12d9||0xcc;return function(_0x284d81){if(_0x284d81){return _0x20900b['sendStatus'](_0x4e12d9);}return _0x20900b[_0xd6e0('0x19')](_0x4e12d9)[_0xd6e0('0x1a')]();};}function respondWithResult(_0x5a8474,_0x14db3b){_0x14db3b=_0x14db3b||0xc8;return function(_0x351ea7){if(_0x351ea7){return _0x5a8474[_0xd6e0('0x19')](_0x14db3b)['json'](_0x351ea7);}};}function respondWithFilteredResult(_0x4ee253,_0x430454){return function(_0x12d6bc){if(_0x12d6bc){var _0x4d5698=_0x12d6bc[_0xd6e0('0x1b')],_0x152408=_0x430454[_0xd6e0('0x1c')],_0xc60e68=_0x430454[_0xd6e0('0x1c')]+_0x430454['limit'],_0x1e0c84;if(_0xc60e68>=_0x4d5698){_0xc60e68=_0x4d5698;_0x1e0c84=0xc8;}else{_0x1e0c84=0xce;}_0x4ee253[_0xd6e0('0x19')](_0x1e0c84);return _0x4ee253[_0xd6e0('0x1d')](_0xd6e0('0x1e'),_0x152408+'-'+_0xc60e68+'/'+_0x4d5698)['json'](_0x12d6bc);}return null;};}function patchUpdates(_0x40d3f8){return function(_0x1cbd3a){try{jsonpatch[_0xd6e0('0x1f')](_0x1cbd3a,_0x40d3f8,!![]);}catch(_0x214704){return BPromise[_0xd6e0('0x20')](_0x214704);}return _0x1cbd3a[_0xd6e0('0x21')]();};}function saveUpdates(_0x35ff86,_0x5424f2){return function(_0x2dc451){if(_0x2dc451){return _0x2dc451[_0xd6e0('0x22')](_0x35ff86)[_0xd6e0('0x23')](function(_0x3bf1a3){return _0x3bf1a3;});}return null;};}function removeEntity(_0x58d29a,_0x5afb0e){return function(_0x65da56){if(_0x65da56){return _0x65da56['destroy']()[_0xd6e0('0x23')](function(){var _0x21b610=_0x65da56[_0xd6e0('0x24')]({'plain':!![]});var _0x126a2e=_0xd6e0('0x25');return db[_0xd6e0('0x26')]['destroy']({'where':{'type':_0x126a2e,'resourceId':_0x21b610['id']}})['then'](function(){return _0x65da56;});})[_0xd6e0('0x23')](function(){_0x58d29a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7a71,_0x902721){return function(_0x49764e){if(!_0x49764e){_0x3e7a71[_0xd6e0('0x27')](0x194);}return _0x49764e;};}function handleError(_0x10d005,_0x4380e1){_0x4380e1=_0x4380e1||0x1f4;return function(_0x5c4367){logger[_0xd6e0('0x28')](_0x5c4367[_0xd6e0('0x29')]);if(_0x5c4367[_0xd6e0('0x2a')]){delete _0x5c4367[_0xd6e0('0x2a')];}_0x10d005[_0xd6e0('0x19')](_0x4380e1)[_0xd6e0('0x2b')](_0x5c4367);};}exports[_0xd6e0('0x2c')]=function(_0x58129e,_0x1674d5){var _0x3c1219={},_0x5715c2={},_0xc5d309={'count':0x0,'rows':[]};var _0x3bf92f=_[_0xd6e0('0x2d')](db['AnalyticDefaultReport'][_0xd6e0('0x2e')],function(_0x5d63c4){return{'name':_0x5d63c4[_0xd6e0('0x2f')],'type':_0x5d63c4[_0xd6e0('0x30')]['key']};});_0x5715c2['model']=_['map'](_0x3bf92f,_0xd6e0('0x2a'));_0x5715c2['query']=_['keys'](_0x58129e[_0xd6e0('0x31')]);_0x5715c2[_0xd6e0('0x32')]=_['intersection'](_0x5715c2[_0xd6e0('0x33')],_0x5715c2[_0xd6e0('0x31')]);_0x3c1219['attributes']=_['intersection'](_0x5715c2[_0xd6e0('0x33')],qs['fields'](_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x34')]));_0x3c1219['attributes']=_0x3c1219[_0xd6e0('0x35')][_0xd6e0('0x36')]?_0x3c1219[_0xd6e0('0x35')]:_0x5715c2[_0xd6e0('0x33')];if(!_0x58129e['query'][_0xd6e0('0x37')](_0xd6e0('0x38'))){_0x3c1219[_0xd6e0('0x39')]=qs[_0xd6e0('0x39')](_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x39')]);_0x3c1219[_0xd6e0('0x1c')]=qs['offset'](_0x58129e['query'][_0xd6e0('0x1c')]);}_0x3c1219[_0xd6e0('0x3a')]=qs[_0xd6e0('0x3b')](_0x58129e['query'][_0xd6e0('0x3b')]);_0x3c1219[_0xd6e0('0x3c')]=qs[_0xd6e0('0x32')](_[_0xd6e0('0x3d')](_0x58129e[_0xd6e0('0x31')],_0x5715c2[_0xd6e0('0x32')]),_0x3bf92f);if(_0x58129e['query'][_0xd6e0('0x3e')]){_0x3c1219[_0xd6e0('0x3c')]=_[_0xd6e0('0x3f')](_0x3c1219['where'],{'$or':_[_0xd6e0('0x2d')](_0x3bf92f,function(_0x3c3e70){if(_0x3c3e70[_0xd6e0('0x30')]!==_0xd6e0('0x40')){var _0x4b9bac={};_0x4b9bac[_0x3c3e70[_0xd6e0('0x2a')]]={'$like':'%'+_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x3e')]+'%'};return _0x4b9bac;}})});}_0x3c1219=_[_0xd6e0('0x3f')]({},_0x3c1219,_0x58129e['options']);var _0x5aafae={'where':_0x3c1219['where']};return db[_0xd6e0('0x41')]['count'](_0x5aafae)['then'](function(_0x13aba6){_0xc5d309[_0xd6e0('0x1b')]=_0x13aba6;if(_0x58129e[_0xd6e0('0x31')][_0xd6e0('0x42')]){_0x3c1219[_0xd6e0('0x43')]=[{'all':!![]}];}return db[_0xd6e0('0x41')][_0xd6e0('0x44')](_0x3c1219);})[_0xd6e0('0x23')](function(_0x3fbe5f){_0xc5d309[_0xd6e0('0x45')]=_0x3fbe5f;return _0xc5d309;})[_0xd6e0('0x23')](respondWithFilteredResult(_0x1674d5,_0x3c1219))[_0xd6e0('0x46')](handleError(_0x1674d5,null));};exports['show']=function(_0x1fe806,_0x4c102b){var _0x2ae689={'raw':!![],'where':{'id':_0x1fe806['params']['id']}},_0x256198={};_0x256198[_0xd6e0('0x33')]=_['keys'](db[_0xd6e0('0x41')][_0xd6e0('0x2e')]);_0x256198[_0xd6e0('0x31')]=_[_0xd6e0('0x47')](_0x1fe806[_0xd6e0('0x31')]);_0x256198[_0xd6e0('0x32')]=_[_0xd6e0('0x48')](_0x256198['model'],_0x256198['query']);_0x2ae689[_0xd6e0('0x35')]=_[_0xd6e0('0x48')](_0x256198[_0xd6e0('0x33')],qs['fields'](_0x1fe806[_0xd6e0('0x31')][_0xd6e0('0x34')]));_0x2ae689[_0xd6e0('0x35')]=_0x2ae689[_0xd6e0('0x35')][_0xd6e0('0x36')]?_0x2ae689[_0xd6e0('0x35')]:_0x256198[_0xd6e0('0x33')];if(_0x1fe806[_0xd6e0('0x31')]['includeAll']){_0x2ae689['include']=[{'all':!![]}];}_0x2ae689=_[_0xd6e0('0x3f')]({},_0x2ae689,_0x1fe806[_0xd6e0('0x49')]);return db['AnalyticDefaultReport'][_0xd6e0('0x4a')](_0x2ae689)[_0xd6e0('0x23')](handleEntityNotFound(_0x4c102b,null))[_0xd6e0('0x23')](respondWithResult(_0x4c102b,null))[_0xd6e0('0x46')](handleError(_0x4c102b,null));};exports['create']=function(_0x4d9e62,_0x1e5b9e){return db['AnalyticDefaultReport'][_0xd6e0('0x4b')](_0x4d9e62[_0xd6e0('0x4c')],{})[_0xd6e0('0x23')](function(_0x4e0446){var _0x1ac419=_0x4d9e62[_0xd6e0('0x4d')][_0xd6e0('0x24')]({'plain':!![]});if(!_0x1ac419)throw new Error(_0xd6e0('0x4e'));if(_0x1ac419[_0xd6e0('0x4f')]===_0xd6e0('0x4d')){var _0x4295d6=_0x4e0446[_0xd6e0('0x24')]({'plain':!![]});var _0x14efd6=_0xd6e0('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x14efd6,'userProfileId':_0x1ac419[_0xd6e0('0x51')]},'raw':!![]})[_0xd6e0('0x23')](function(_0x4bd18e){if(_0x4bd18e&&_0x4bd18e[_0xd6e0('0x52')]===0x0){return db[_0xd6e0('0x26')][_0xd6e0('0x4b')]({'name':_0x4295d6['name'],'resourceId':_0x4295d6['id'],'type':'DefaultReports','sectionId':_0x4bd18e['id']},{})['then'](function(){return _0x4e0446;});}else{return _0x4e0446;}})[_0xd6e0('0x46')](function(_0x1a6c12){logger[_0xd6e0('0x28')](_0xd6e0('0x53'),_0x1a6c12);throw _0x1a6c12;});}return _0x4e0446;})[_0xd6e0('0x23')](respondWithResult(_0x1e5b9e,0xc9))[_0xd6e0('0x46')](handleError(_0x1e5b9e,null));};exports[_0xd6e0('0x22')]=function(_0x18d5d4,_0x2add3d){if(_0x18d5d4[_0xd6e0('0x4c')]['id']){delete _0x18d5d4[_0xd6e0('0x4c')]['id'];}return db[_0xd6e0('0x41')]['find']({'where':{'id':_0x18d5d4['params']['id']}})[_0xd6e0('0x23')](handleEntityNotFound(_0x2add3d,null))[_0xd6e0('0x23')](saveUpdates(_0x18d5d4[_0xd6e0('0x4c')],null))[_0xd6e0('0x23')](respondWithResult(_0x2add3d,null))[_0xd6e0('0x46')](handleError(_0x2add3d,null));};exports[_0xd6e0('0x54')]=function(_0x3485d4,_0x5da95b){return db[_0xd6e0('0x41')]['find']({'where':{'id':_0x3485d4[_0xd6e0('0x55')]['id']}})[_0xd6e0('0x23')](handleEntityNotFound(_0x5da95b,null))['then'](removeEntity(_0x5da95b,null))[_0xd6e0('0x46')](handleError(_0x5da95b,null));};exports[_0xd6e0('0x56')]=function(_0x41a50b,_0x34d8fd){var _0x4142df=0xa;var _0x5bd8ec=['join',_0xd6e0('0x57'),_0xd6e0('0x58'),_0xd6e0('0x59')];var _0x54e7ff={'SUM':'SUM(%s)','COUNT':_0xd6e0('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd6e0('0x5b'),'MIN':_0xd6e0('0x5c'),'AVG':_0xd6e0('0x5d'),'GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x18e9c6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd6e0('0x60'),'HOUR':_0xd6e0('0x61'),'ROUND':_0xd6e0('0x62'),'UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x3fbe2b=function(_0x2fea38){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xd6e0('0x66')],_0x2fea38);};var _0x13dae3=function(_0x4b87f2){if(!_0x4b87f2||!_0x4b87f2['rules'][_0xd6e0('0x36')]){return'';}for(var _0x13cb04='(',_0x1ccd1a=0x0;_0x1ccd1a<_0x4b87f2[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x1ccd1a+=0x1){_0x1ccd1a>0x0&&(_0x13cb04+='\x20'+_0x4b87f2[_0xd6e0('0x68')]+'\x20');_0x13cb04+=_0x4b87f2['rules'][_0x1ccd1a]['group']?_0x13dae3(_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a][_0xd6e0('0x69')]):_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a]['field']+'\x20'+_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a]['condition']+(_0x3fbe2b(_0x4b87f2['rules'][_0x1ccd1a]['condition'])?'\x20'+_0x4b87f2[_0xd6e0('0x67')][_0x1ccd1a][_0xd6e0('0x6a')]:'');}return _0x13cb04+')';};var _0x39a547={'where':{'id':_0x41a50b[_0xd6e0('0x55')]['id']}},_0xdddaae,_0x20b09e,_0x13d38d,_0x34ae96,_0x288560;_0x39a547=_[_0xd6e0('0x3f')]({},_0x39a547,_0x41a50b[_0xd6e0('0x49')]);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x39a547)[_0xd6e0('0x23')](function(_0x623e5e){if(_0x623e5e){_0xdddaae=_0x623e5e;return _0x623e5e['getFields']();}return null;})['then'](function(_0x5f4915){if(_0x5f4915){if(!_0x5f4915[_0xd6e0('0x36')]){throw new db['Sequelize'][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0x20b09e=_0x5f4915;return db[_0xd6e0('0x6d')][_0xd6e0('0x44')]({'raw':!![]});}return null;})['then'](function(_0x361937){if(_0x361937){_0x13d38d=_['keyBy'](_0x361937,'id');var _0x5a69f7;var _0xd206ab=squel[_0xd6e0('0x6e')]();_0xd206ab['from'](_0xdddaae[_0xd6e0('0x6f')]);for(var _0x3b0479=0x0;_0x3b0479<_0x20b09e['length'];_0x3b0479+=0x1){_0x5a69f7=_0x20b09e[_0x3b0479]['MetricId']?_0x13d38d[_0x20b09e[_0x3b0479][_0xd6e0('0x70')]][_0xd6e0('0x71')]:_0x20b09e[_0x3b0479][_0xd6e0('0x72')];_0x5a69f7=_0x20b09e[_0x3b0479][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x54e7ff[_0x20b09e[_0x3b0479]['function']],'%s',_0x5a69f7):_0x5a69f7;_0x5a69f7=_0x20b09e[_0x3b0479]['format']?_[_0xd6e0('0x74')](_0x18e9c6[_0x20b09e[_0x3b0479][_0xd6e0('0x75')]],'%s',_0x5a69f7):_0x5a69f7;if(_0x20b09e[_0x3b0479][_0xd6e0('0x76')]){_0xd206ab[_0xd6e0('0x69')](_0x5a69f7);}_0x20b09e[_0x3b0479][_0xd6e0('0x77')]&&_0xd206ab[_0xd6e0('0x3a')](_0x5a69f7,_0x20b09e[_0x3b0479][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0xd206ab[_0xd6e0('0x72')](_0x5a69f7,_0x20b09e[_0x3b0479]['alias']||_0x5a69f7);}if(_0xdddaae[_0xd6e0('0x79')]){_0xdddaae['joins']=JSON[_0xd6e0('0x7a')](_0xdddaae[_0xd6e0('0x79')]);for(var _0x2dd03=0x0;_0x2dd03<_0xdddaae[_0xd6e0('0x79')]['length'];_0x2dd03+=0x1){if(_0xdddaae['joins'][_0x2dd03][_0xd6e0('0x30')]&&_['includes'](_0x5bd8ec,_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x30')])&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7b')]&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7c')]&&_0xdddaae[_0xd6e0('0x79')][_0x2dd03]['foreignKey']){_0xd206ab[_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x30')]](_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7c')],null,util[_0xd6e0('0x75')]('%s.%s\x20=\x20%s.%s',_0xdddaae['table'],_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7b')],_0xdddaae['joins'][_0x2dd03][_0xd6e0('0x7c')],_0xdddaae[_0xd6e0('0x79')][_0x2dd03][_0xd6e0('0x7d')]));}}}if(_0xdddaae['conditions']){_0xdddaae[_0xd6e0('0x7e')]=JSON[_0xd6e0('0x7a')](_0xdddaae[_0xd6e0('0x7e')]);_0xd206ab[_0xd6e0('0x3c')](_0x13dae3(_0xdddaae['conditions'][_0xd6e0('0x69')]));}_0x288560=_0xd206ab[_0xd6e0('0x7f')]();_0xd206ab[_0xd6e0('0x39')](_0x4142df);_0xd206ab['offset'](0x0);logger['debug']('Limited\x20Query:',_0xd206ab[_0xd6e0('0x80')]());return db[_0xd6e0('0x81')][_0xd6e0('0x31')](_0xd206ab[_0xd6e0('0x80')](),{'type':db['sequelize'][_0xd6e0('0x82')][_0xd6e0('0x83')]});}})[_0xd6e0('0x23')](respondWithResult(_0x34d8fd,null))[_0xd6e0('0x46')](handleError(_0x34d8fd,null));};function runReport(_0x2c416f,_0x487e2d,_0x26d07d){var _0x2d0a91=_0x487e2d[_0xd6e0('0x2a')];var _0x2b2d09=0xa;var _0x39026f=[_0xd6e0('0x84'),'left_join','right_join',_0xd6e0('0x59')];var _0x518fde={'SUM':_0xd6e0('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd6e0('0x86'),'MAX':_0xd6e0('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10b31e={'SEC_TO_TIME':_0xd6e0('0x87'),'DATE':_0xd6e0('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xd6e0('0x62'),'UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x298b82=function(_0x31f538){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),_0xd6e0('0x88'),_0xd6e0('0x89'),_0xd6e0('0x66')],_0x31f538);};var _0x1de95f=function(_0x31b919){if(!_0x31b919||!_0x31b919[_0xd6e0('0x67')][_0xd6e0('0x36')]){return'';}for(var _0x92b9a7='(',_0x745af=0x0;_0x745af<_0x31b919[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x745af+=0x1){_0x745af>0x0&&(_0x92b9a7+='\x20'+_0x31b919[_0xd6e0('0x68')]+'\x20');_0x92b9a7+=_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x69')]?_0x1de95f(_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x69')]):_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x72')]+'\x20'+_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x8a')]+(_0x298b82(_0x31b919[_0xd6e0('0x67')][_0x745af]['condition'])?'\x20'+_0x31b919[_0xd6e0('0x67')][_0x745af][_0xd6e0('0x6a')]:'');}return _0x92b9a7+')';};var _0x4770eb={'where':{'id':_0x2c416f['id']}},_0x28d2fc,_0xd8806b,_0x4e9155,_0x4b0f3d,_0xd855df;_0x4770eb=_['merge']({},_0x4770eb,_0x26d07d);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x4770eb)[_0xd6e0('0x23')](function(_0x103009){if(_0x103009){_0x28d2fc=_0x103009;return _0x103009[_0xd6e0('0x8b')]();}return null;})[_0xd6e0('0x23')](function(_0xd01f75){if(_0xd01f75){if(!_0xd01f75[_0xd6e0('0x36')]){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0xd8806b=_0xd01f75;return db[_0xd6e0('0x6d')][_0xd6e0('0x44')]({'raw':!![]});}return null;})['then'](function(_0x5ee1c6){if(_0x5ee1c6){_0x4e9155=_[_0xd6e0('0x8d')](_0x5ee1c6,'id');var _0x47c4a0;var _0x12b7b3=squel[_0xd6e0('0x6e')]();_0x12b7b3[_0xd6e0('0x8e')](_0x28d2fc[_0xd6e0('0x6f')]);for(var _0x230bb9=0x0;_0x230bb9<_0xd8806b['length'];_0x230bb9+=0x1){_0x47c4a0=_0xd8806b[_0x230bb9]['MetricId']?_0x4e9155[_0xd8806b[_0x230bb9]['MetricId']]['metric']:_0xd8806b[_0x230bb9][_0xd6e0('0x72')];_0x47c4a0=_0xd8806b[_0x230bb9][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x518fde[_0xd8806b[_0x230bb9][_0xd6e0('0x73')]],'%s',_0x47c4a0):_0x47c4a0;_0x47c4a0=_0xd8806b[_0x230bb9][_0xd6e0('0x75')]?_['replace'](_0x10b31e[_0xd8806b[_0x230bb9][_0xd6e0('0x75')]],'%s',_0x47c4a0):_0x47c4a0;if(_0xd8806b[_0x230bb9][_0xd6e0('0x76')]){_0x12b7b3[_0xd6e0('0x69')](_0x47c4a0);}_0xd8806b[_0x230bb9][_0xd6e0('0x77')]&&_0x12b7b3[_0xd6e0('0x3a')](_0x47c4a0,_0xd8806b[_0x230bb9][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0x12b7b3['field'](_0x47c4a0,_0xd8806b[_0x230bb9][_0xd6e0('0x8f')]||_0x47c4a0);}if(_0x28d2fc[_0xd6e0('0x79')]){_0x28d2fc['joins']=JSON[_0xd6e0('0x7a')](_0x28d2fc['joins']);for(var _0x1c77e9=0x0;_0x1c77e9<_0x28d2fc['joins']['length'];_0x1c77e9+=0x1){if(_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x30')]&&_[_0xd6e0('0x64')](_0x39026f,_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x30')])&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['parentKey']&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7c')]&&_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['foreignKey']){_0x12b7b3[_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9]['type']](_0x28d2fc['joins'][_0x1c77e9][_0xd6e0('0x7c')],null,util[_0xd6e0('0x75')](_0xd6e0('0x90'),_0x28d2fc['table'],_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7b')],_0x28d2fc[_0xd6e0('0x79')][_0x1c77e9][_0xd6e0('0x7c')],_0x28d2fc['joins'][_0x1c77e9][_0xd6e0('0x7d')]));}}}if(_0x28d2fc[_0xd6e0('0x7e')]){_0x28d2fc[_0xd6e0('0x7e')]=JSON['parse'](_0x28d2fc[_0xd6e0('0x7e')]);_0x12b7b3[_0xd6e0('0x3c')](_0x1de95f(_0x28d2fc[_0xd6e0('0x7e')][_0xd6e0('0x69')]));}_0xd855df=_0x12b7b3[_0xd6e0('0x7f')]();_0x12b7b3[_0xd6e0('0x39')](_0x2b2d09);_0x12b7b3[_0xd6e0('0x1c')](0x0);logger[_0xd6e0('0x91')](_0xd6e0('0x92'),_0x12b7b3['toString']());return db[_0xd6e0('0x81')]['query'](_0x12b7b3[_0xd6e0('0x80')](),{'type':db[_0xd6e0('0x81')]['QueryTypes'][_0xd6e0('0x83')]});}})['then'](function(_0xde8f01){if(!_0xde8f01['length']){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))]('No\x20available\x20data',0xcc);}if(_0x487e2d[_0xd6e0('0x93')]==='web'){return null;}var _0x344062=_[_0xd6e0('0x3f')](_0x487e2d,{'name':_0x487e2d['fullPath']||_0x487e2d[_0xd6e0('0x2a')]||_0x28d2fc[_0xd6e0('0x2a')],'basename':_0x2d0a91,'savename':util[_0xd6e0('0x75')](_0xd6e0('0x94'),_0x487e2d[_0xd6e0('0x2a')]||_0x28d2fc[_0xd6e0('0x2a')],require(_0xd6e0('0x95'))[_0xd6e0('0x96')](0x4),_0x487e2d[_0xd6e0('0x93')]||_0xd6e0('0x97')),'reportId':_0x28d2fc['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xd6e0('0x4b')](_0x344062,{'raw':!![]});})[_0xd6e0('0x23')](function(_0x52675e){if(_0x28d2fc[_0xd6e0('0x6f')]===_0xd6e0('0x98')){_0xd855df[_0xd6e0('0x3c')](_0x28d2fc[_0xd6e0('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x487e2d[_0xd6e0('0x99')],_0x487e2d[_0xd6e0('0x9a')]);}else{_0xd855df[_0xd6e0('0x3c')](_0x28d2fc[_0xd6e0('0x6f')]+_0xd6e0('0x9b'),_0x487e2d[_0xd6e0('0x99')],_0x487e2d[_0xd6e0('0x9a')]);}if(_0x52675e){logger[_0xd6e0('0x9c')](_0xd6e0('0x9d'),_0xd855df[_0xd6e0('0x80')]());require(_0xd6e0('0x9e'))[_0xd6e0('0x9f')](path['join'](__dirname,_0xd6e0('0xa0'),_0x52675e[_0xd6e0('0x93')]),[_0x52675e['id'],_0xd855df[_0xd6e0('0x80')](),path[_0xd6e0('0x84')](__dirname,_0xd6e0('0xa1'),_0x52675e[_0xd6e0('0xa2')]),_0x2d0a91]);return _0x52675e;}else{var _0x429851=squel['select']();_0x429851['from']('('+_0xd855df['toString']()+')',_0xd6e0('0xa3'));_0x429851[_0xd6e0('0x72')]('COUNT(*)','count');_0xd855df[_0xd6e0('0x39')](_0x487e2d[_0xd6e0('0x39')]||_0x2b2d09);_0xd855df[_0xd6e0('0x1c')](_0x487e2d[_0xd6e0('0x1c')]||0x0);return dbH[_0xd6e0('0x81')]['query'](_0x429851['toString'](),{'type':dbH[_0xd6e0('0x81')]['QueryTypes'][_0xd6e0('0x83')]})[_0xd6e0('0x23')](function(_0x28695f){if(!_0x28695f[_0xd6e0('0x36')]){_0x4b0f3d=0x0;}else{_0x4b0f3d=_0x28695f[0x0][_0xd6e0('0x1b')]||0x0;}return dbH['sequelize']['query'](_0xd855df[_0xd6e0('0x80')](),{'type':dbH['sequelize'][_0xd6e0('0x82')][_0xd6e0('0x83')]});})[_0xd6e0('0x23')](function(_0x4a49fc){return{'rows':_0x4a49fc||[],'count':_0x4b0f3d};});}});}exports[_0xd6e0('0xa4')]=function(_0x42c170,_0x5d821a){return runReport(_0x42c170[_0xd6e0('0x55')],_0x42c170['query'],_0x42c170[_0xd6e0('0x49')])[_0xd6e0('0x23')](respondWithResult(_0x5d821a,null))[_0xd6e0('0x46')](handleError(_0x5d821a,null));};exports[_0xd6e0('0xa5')]=runReport;exports[_0xd6e0('0x31')]=function(_0x1dabcb,_0x5610b2){var _0x1cd655=0xa;var _0x424caa=['join',_0xd6e0('0x57'),'right_join',_0xd6e0('0x59')];var _0x2feda4={'SUM':_0xd6e0('0x85'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd6e0('0x86'),'MAX':_0xd6e0('0x5b'),'MIN':_0xd6e0('0x5c'),'AVG':_0xd6e0('0x5d'),'GROUP_CONCAT':_0xd6e0('0x5e'),'GROUP_CONCAT ASC':_0xd6e0('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e41d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd6e0('0x60'),'HOUR':_0xd6e0('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd6e0('0x63')};var _0x429390=function(_0x41851f){return!_[_0xd6e0('0x64')]([_0xd6e0('0x65'),'IS\x20NOT\x20NULL',_0xd6e0('0x89'),_0xd6e0('0x66')],_0x41851f);};var _0x4a6634=function(_0x292977){if(!_0x292977||!_0x292977['rules'][_0xd6e0('0x36')]){return'';}for(var _0x45754c='(',_0x11e0e1=0x0;_0x11e0e1<_0x292977[_0xd6e0('0x67')][_0xd6e0('0x36')];_0x11e0e1+=0x1){_0x11e0e1>0x0&&(_0x45754c+='\x20'+_0x292977[_0xd6e0('0x68')]+'\x20');_0x45754c+=_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x69')]?_0x4a6634(_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x69')]):_0x292977['rules'][_0x11e0e1][_0xd6e0('0x72')]+'\x20'+_0x292977['rules'][_0x11e0e1][_0xd6e0('0x8a')]+(_0x429390(_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x8a')])?'\x20'+_0x292977[_0xd6e0('0x67')][_0x11e0e1][_0xd6e0('0x6a')]:'');}return _0x45754c+')';};var _0x429799={'where':{'id':_0x1dabcb[_0xd6e0('0x55')]['id']}},_0x5a98d8,_0x1cb3dc,_0x1208b1,_0x5ca320,_0x4e6aa9;_0x429799=_[_0xd6e0('0x3f')]({},_0x429799,_0x1dabcb['options']);return db[_0xd6e0('0x41')][_0xd6e0('0x4a')](_0x429799)[_0xd6e0('0x23')](function(_0x54fae1){if(_0x54fae1){_0x5a98d8=_0x54fae1;return _0x54fae1[_0xd6e0('0x8b')]();}return null;})[_0xd6e0('0x23')](function(_0x1cf891){if(_0x1cf891){if(!_0x1cf891['length']){throw new db[(_0xd6e0('0x8c'))][(_0xd6e0('0x6b'))](_0xd6e0('0x6c'),0x193);}_0x1cb3dc=_0x1cf891;return db[_0xd6e0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6e0('0x23')](function(_0x5eaa04){if(_0x5eaa04){_0x1208b1=_[_0xd6e0('0x8d')](_0x5eaa04,'id');var _0xfc88b;var _0x585d69=squel[_0xd6e0('0x6e')]();_0x585d69[_0xd6e0('0x8e')](_0x5a98d8[_0xd6e0('0x6f')]);for(var _0x24f160=0x0;_0x24f160<_0x1cb3dc['length'];_0x24f160+=0x1){_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x70')]?_0x1208b1[_0x1cb3dc[_0x24f160]['MetricId']]['metric']:_0x1cb3dc[_0x24f160]['field'];_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x73')]?_[_0xd6e0('0x74')](_0x2feda4[_0x1cb3dc[_0x24f160]['function']],'%s',_0xfc88b):_0xfc88b;_0xfc88b=_0x1cb3dc[_0x24f160][_0xd6e0('0x75')]?_['replace'](_0x3e41d2[_0x1cb3dc[_0x24f160][_0xd6e0('0x75')]],'%s',_0xfc88b):_0xfc88b;if(_0x1cb3dc[_0x24f160][_0xd6e0('0x76')]){_0x585d69[_0xd6e0('0x69')](_0xfc88b);}_0x1cb3dc[_0x24f160][_0xd6e0('0x77')]&&_0x585d69[_0xd6e0('0x3a')](_0xfc88b,_0x1cb3dc[_0x24f160][_0xd6e0('0x77')]===_0xd6e0('0x78')?![]:!![]);_0x585d69[_0xd6e0('0x72')](_0xfc88b,_0x1cb3dc[_0x24f160][_0xd6e0('0x8f')]||_0xfc88b);}if(_0x5a98d8['joins']){_0x5a98d8[_0xd6e0('0x79')]=JSON[_0xd6e0('0x7a')](_0x5a98d8[_0xd6e0('0x79')]);for(var _0x3b70b3=0x0;_0x3b70b3<_0x5a98d8[_0xd6e0('0x79')][_0xd6e0('0x36')];_0x3b70b3+=0x1){if(_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x30')]&&_[_0xd6e0('0x64')](_0x424caa,_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3]['type'])&&_0x5a98d8['joins'][_0x3b70b3]['parentKey']&&_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x7c')]&&_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7d')]){_0x585d69[_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3]['type']](_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7c')],null,util['format'](_0xd6e0('0x90'),_0x5a98d8[_0xd6e0('0x6f')],_0x5a98d8[_0xd6e0('0x79')][_0x3b70b3][_0xd6e0('0x7b')],_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7c')],_0x5a98d8['joins'][_0x3b70b3][_0xd6e0('0x7d')]));}}}if(_0x5a98d8['conditions']){_0x5a98d8[_0xd6e0('0x7e')]=JSON[_0xd6e0('0x7a')](_0x5a98d8[_0xd6e0('0x7e')]);_0x585d69[_0xd6e0('0x3c')](_0x4a6634(_0x5a98d8['conditions'][_0xd6e0('0x69')]));}_0x4e6aa9=_0x585d69[_0xd6e0('0x7f')]();_0x585d69['limit'](_0x1cd655);_0x585d69[_0xd6e0('0x1c')](0x0);logger[_0xd6e0('0x91')](_0xd6e0('0x92'),_0x585d69[_0xd6e0('0x80')]());return db[_0xd6e0('0x81')][_0xd6e0('0x31')](_0x585d69[_0xd6e0('0x80')](),{'type':db[_0xd6e0('0x81')][_0xd6e0('0x82')][_0xd6e0('0x83')]});}})[_0xd6e0('0x23')](function(){return{'sql':_0x4e6aa9['toString']()};})[_0xd6e0('0x23')](respondWithResult(_0x5610b2,null))['catch'](handleError(_0x5610b2,null));}; \ No newline at end of file +var _0x77a3=['join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','group','rules','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','ValidationErrorItem','clone','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview'];(function(_0x5a9514,_0x4e4ef4){var _0x22c8e2=function(_0x183160){while(--_0x183160){_0x5a9514['push'](_0x5a9514['shift']());}};_0x22c8e2(++_0x4e4ef4);}(_0x77a3,0xfc));var _0x377a=function(_0xbc5e8,_0x1ff5e4){_0xbc5e8=_0xbc5e8-0x0;var _0x364892=_0x77a3[_0xbc5e8];return _0x364892;};'use strict';var pdf=require(_0x377a('0x0'));var emlformat=require(_0x377a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x377a('0x2'));var rp=require(_0x377a('0x3'));var moment=require(_0x377a('0x4'));var BPromise=require(_0x377a('0x5'));var Mustache=require(_0x377a('0x6'));var util=require(_0x377a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x377a('0x8'));var ejs=require(_0x377a('0x9'));var fs=require('fs');var _=require(_0x377a('0xa'));var squel=require(_0x377a('0xb'));var crypto=require(_0x377a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x377a('0x8'));var querystring=require(_0x377a('0xd'));var Papa=require(_0x377a('0xe'));var Redis=require(_0x377a('0xf'));var authService=require(_0x377a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x377a('0x11'));var hardwareService=require(_0x377a('0x12'));var logger=require(_0x377a('0x13'))(_0x377a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x377a('0x15'))['db'];var dbH=require(_0x377a('0x15'))[_0x377a('0x16')];function respondWithStatusCode(_0x2353ab,_0x349a6f){_0x349a6f=_0x349a6f||0xcc;return function(_0x55fc27){if(_0x55fc27){return _0x2353ab[_0x377a('0x17')](_0x349a6f);}return _0x2353ab[_0x377a('0x18')](_0x349a6f)[_0x377a('0x19')]();};}function respondWithResult(_0xc15f34,_0x36ce14){_0x36ce14=_0x36ce14||0xc8;return function(_0x452ecf){if(_0x452ecf){return _0xc15f34[_0x377a('0x18')](_0x36ce14)['json'](_0x452ecf);}};}function respondWithFilteredResult(_0x191e3b,_0x214028){return function(_0x19c504){if(_0x19c504){var _0x39b986=_0x19c504[_0x377a('0x1a')],_0x3d609c=_0x214028[_0x377a('0x1b')],_0x2de49c=_0x214028[_0x377a('0x1b')]+_0x214028[_0x377a('0x1c')],_0x3c680c;if(_0x2de49c>=_0x39b986){_0x2de49c=_0x39b986;_0x3c680c=0xc8;}else{_0x3c680c=0xce;}_0x191e3b[_0x377a('0x18')](_0x3c680c);return _0x191e3b[_0x377a('0x1d')](_0x377a('0x1e'),_0x3d609c+'-'+_0x2de49c+'/'+_0x39b986)[_0x377a('0x1f')](_0x19c504);}return null;};}function patchUpdates(_0x38bc91){return function(_0x118141){try{jsonpatch['apply'](_0x118141,_0x38bc91,!![]);}catch(_0x411cfe){return BPromise[_0x377a('0x20')](_0x411cfe);}return _0x118141[_0x377a('0x21')]();};}function saveUpdates(_0x59485c,_0x111d1b){return function(_0x2bbaed){if(_0x2bbaed){return _0x2bbaed['update'](_0x59485c)['then'](function(_0x16170b){return _0x16170b;});}return null;};}function removeEntity(_0x11dd15,_0x23959a){return function(_0x108e81){if(_0x108e81){return _0x108e81[_0x377a('0x22')]()[_0x377a('0x23')](function(){var _0x3b278c=_0x108e81[_0x377a('0x24')]({'plain':!![]});var _0x53d913='DefaultReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x53d913,'resourceId':_0x3b278c['id']}})[_0x377a('0x23')](function(){return _0x108e81;});})[_0x377a('0x23')](function(){_0x11dd15[_0x377a('0x18')](0xcc)[_0x377a('0x19')]();});}};}function handleEntityNotFound(_0xe112e3,_0x206de0){return function(_0x3d1ff8){if(!_0x3d1ff8){_0xe112e3[_0x377a('0x17')](0x194);}return _0x3d1ff8;};}function handleError(_0x38cfee,_0x160790){_0x160790=_0x160790||0x1f4;return function(_0x3048a8){logger[_0x377a('0x25')](_0x3048a8[_0x377a('0x26')]);if(_0x3048a8[_0x377a('0x27')]){delete _0x3048a8[_0x377a('0x27')];}_0x38cfee[_0x377a('0x18')](_0x160790)[_0x377a('0x28')](_0x3048a8);};}exports[_0x377a('0x29')]=function(_0x29a0bf,_0x574226){var _0x3c0c93={},_0x352175={},_0x28bd91={'count':0x0,'rows':[]};var _0x3b8c84=_[_0x377a('0x2a')](db['AnalyticDefaultReport'][_0x377a('0x2b')],function(_0x241012){return{'name':_0x241012[_0x377a('0x2c')],'type':_0x241012['type'][_0x377a('0x2d')]};});_0x352175['model']=_[_0x377a('0x2a')](_0x3b8c84,_0x377a('0x27'));_0x352175[_0x377a('0x2e')]=_['keys'](_0x29a0bf[_0x377a('0x2e')]);_0x352175[_0x377a('0x2f')]=_[_0x377a('0x30')](_0x352175['model'],_0x352175[_0x377a('0x2e')]);_0x3c0c93[_0x377a('0x31')]=_[_0x377a('0x30')](_0x352175[_0x377a('0x32')],qs[_0x377a('0x33')](_0x29a0bf[_0x377a('0x2e')][_0x377a('0x33')]));_0x3c0c93[_0x377a('0x31')]=_0x3c0c93[_0x377a('0x31')][_0x377a('0x34')]?_0x3c0c93[_0x377a('0x31')]:_0x352175[_0x377a('0x32')];if(!_0x29a0bf['query'][_0x377a('0x35')](_0x377a('0x36'))){_0x3c0c93[_0x377a('0x1c')]=qs[_0x377a('0x1c')](_0x29a0bf['query']['limit']);_0x3c0c93[_0x377a('0x1b')]=qs[_0x377a('0x1b')](_0x29a0bf[_0x377a('0x2e')][_0x377a('0x1b')]);}_0x3c0c93[_0x377a('0x37')]=qs[_0x377a('0x38')](_0x29a0bf['query'][_0x377a('0x38')]);_0x3c0c93[_0x377a('0x39')]=qs[_0x377a('0x2f')](_[_0x377a('0x3a')](_0x29a0bf['query'],_0x352175[_0x377a('0x2f')]),_0x3b8c84);if(_0x29a0bf[_0x377a('0x2e')][_0x377a('0x3b')]){_0x3c0c93[_0x377a('0x39')]=_[_0x377a('0x3c')](_0x3c0c93[_0x377a('0x39')],{'$or':_[_0x377a('0x2a')](_0x3b8c84,function(_0x5b0b7b){if(_0x5b0b7b[_0x377a('0x3d')]!==_0x377a('0x3e')){var _0x9cf21f={};_0x9cf21f[_0x5b0b7b['name']]={'$like':'%'+_0x29a0bf[_0x377a('0x2e')][_0x377a('0x3b')]+'%'};return _0x9cf21f;}})});}_0x3c0c93=_['merge']({},_0x3c0c93,_0x29a0bf['options']);var _0x86998b={'where':_0x3c0c93[_0x377a('0x39')]};return db[_0x377a('0x3f')][_0x377a('0x1a')](_0x86998b)[_0x377a('0x23')](function(_0x17582a){_0x28bd91[_0x377a('0x1a')]=_0x17582a;if(_0x29a0bf[_0x377a('0x2e')][_0x377a('0x40')]){_0x3c0c93[_0x377a('0x41')]=[{'all':!![]}];}return db[_0x377a('0x3f')][_0x377a('0x42')](_0x3c0c93);})[_0x377a('0x23')](function(_0x141409){_0x28bd91[_0x377a('0x43')]=_0x141409;return _0x28bd91;})['then'](respondWithFilteredResult(_0x574226,_0x3c0c93))[_0x377a('0x44')](handleError(_0x574226,null));};exports['show']=function(_0x520dac,_0x490873){var _0xfe03e2={'raw':!![],'where':{'id':_0x520dac['params']['id']}},_0x333b02={};_0x333b02[_0x377a('0x32')]=_[_0x377a('0x45')](db[_0x377a('0x3f')][_0x377a('0x2b')]);_0x333b02[_0x377a('0x2e')]=_[_0x377a('0x45')](_0x520dac[_0x377a('0x2e')]);_0x333b02[_0x377a('0x2f')]=_[_0x377a('0x30')](_0x333b02[_0x377a('0x32')],_0x333b02[_0x377a('0x2e')]);_0xfe03e2['attributes']=_[_0x377a('0x30')](_0x333b02['model'],qs['fields'](_0x520dac[_0x377a('0x2e')]['fields']));_0xfe03e2[_0x377a('0x31')]=_0xfe03e2[_0x377a('0x31')][_0x377a('0x34')]?_0xfe03e2[_0x377a('0x31')]:_0x333b02[_0x377a('0x32')];if(_0x520dac[_0x377a('0x2e')][_0x377a('0x40')]){_0xfe03e2[_0x377a('0x41')]=[{'all':!![]}];}_0xfe03e2=_['merge']({},_0xfe03e2,_0x520dac[_0x377a('0x46')]);return db[_0x377a('0x3f')][_0x377a('0x47')](_0xfe03e2)[_0x377a('0x23')](handleEntityNotFound(_0x490873,null))[_0x377a('0x23')](respondWithResult(_0x490873,null))[_0x377a('0x44')](handleError(_0x490873,null));};exports[_0x377a('0x48')]=function(_0x10897c,_0x181e52){return db['AnalyticDefaultReport'][_0x377a('0x48')](_0x10897c[_0x377a('0x49')],{})[_0x377a('0x23')](function(_0x59d242){var _0x5aabe6=_0x10897c['user']['get']({'plain':!![]});if(!_0x5aabe6)throw new Error(_0x377a('0x4a'));if(_0x5aabe6['role']===_0x377a('0x4b')){var _0x462d34=_0x59d242[_0x377a('0x24')]({'plain':!![]});var _0x5f3805=_0x377a('0x4c');return db[_0x377a('0x4d')][_0x377a('0x47')]({'where':{'name':_0x5f3805,'userProfileId':_0x5aabe6[_0x377a('0x4e')]},'raw':!![]})[_0x377a('0x23')](function(_0x506f3c){if(_0x506f3c&&_0x506f3c[_0x377a('0x4f')]===0x0){return db[_0x377a('0x50')]['create']({'name':_0x462d34[_0x377a('0x27')],'resourceId':_0x462d34['id'],'type':_0x377a('0x51'),'sectionId':_0x506f3c['id']},{})[_0x377a('0x23')](function(){return _0x59d242;});}else{return _0x59d242;}})[_0x377a('0x44')](function(_0x3d57e1){logger[_0x377a('0x25')](_0x377a('0x52'),_0x3d57e1);throw _0x3d57e1;});}return _0x59d242;})[_0x377a('0x23')](respondWithResult(_0x181e52,0xc9))['catch'](handleError(_0x181e52,null));};exports[_0x377a('0x53')]=function(_0x15000b,_0x28ab26){if(_0x15000b[_0x377a('0x49')]['id']){delete _0x15000b[_0x377a('0x49')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x15000b[_0x377a('0x54')]['id']}})[_0x377a('0x23')](handleEntityNotFound(_0x28ab26,null))[_0x377a('0x23')](saveUpdates(_0x15000b[_0x377a('0x49')],null))[_0x377a('0x23')](respondWithResult(_0x28ab26,null))[_0x377a('0x44')](handleError(_0x28ab26,null));};exports[_0x377a('0x22')]=function(_0x55b527,_0x3b4f90){return db[_0x377a('0x3f')][_0x377a('0x47')]({'where':{'id':_0x55b527[_0x377a('0x54')]['id']}})[_0x377a('0x23')](handleEntityNotFound(_0x3b4f90,null))['then'](removeEntity(_0x3b4f90,null))[_0x377a('0x44')](handleError(_0x3b4f90,null));};exports[_0x377a('0x55')]=function(_0x173e02,_0x1b216f){var _0x194a41=0xa;var _0x5575bc=[_0x377a('0x56'),_0x377a('0x57'),_0x377a('0x58'),_0x377a('0x59')];var _0x5e630a={'SUM':_0x377a('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x377a('0x5b'),'MAX':_0x377a('0x5c'),'MIN':'MIN(%s)','AVG':_0x377a('0x5d'),'GROUP_CONCAT':_0x377a('0x5e'),'GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':_0x377a('0x60')};var _0x219eec={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':_0x377a('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x465fe5=function(_0x38ba14){return!_[_0x377a('0x65')]([_0x377a('0x66'),_0x377a('0x67'),_0x377a('0x68'),_0x377a('0x69')],_0x38ba14);};var _0x33ab18=function(_0x14e043){if(!_0x14e043||!_0x14e043['rules'][_0x377a('0x34')]){return'';}for(var _0x19f7f7='(',_0x2914e9=0x0;_0x2914e9<_0x14e043['rules'][_0x377a('0x34')];_0x2914e9+=0x1){_0x2914e9>0x0&&(_0x19f7f7+='\x20'+_0x14e043[_0x377a('0x6a')]+'\x20');_0x19f7f7+=_0x14e043['rules'][_0x2914e9][_0x377a('0x6b')]?_0x33ab18(_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6b')]):_0x14e043[_0x377a('0x6c')][_0x2914e9]['field']+'\x20'+_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6d')]+(_0x465fe5(_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6d')])?'\x20'+_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6e')]:'');}return _0x19f7f7+')';};var _0x5d375b={'where':{'id':_0x173e02[_0x377a('0x54')]['id']}},_0x59a11b,_0x3970e4,_0x298877,_0x1d9000,_0x5b2be8;_0x5d375b=_[_0x377a('0x3c')]({},_0x5d375b,_0x173e02[_0x377a('0x46')]);return db['AnalyticDefaultReport'][_0x377a('0x47')](_0x5d375b)['then'](function(_0x40a0ca){if(_0x40a0ca){_0x59a11b=_0x40a0ca;return _0x40a0ca[_0x377a('0x6f')]();}return null;})[_0x377a('0x23')](function(_0x538c8c){if(_0x538c8c){if(!_0x538c8c[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))]['ValidationErrorItem'](_0x377a('0x71'),0x193);}_0x3970e4=_0x538c8c;return db[_0x377a('0x72')][_0x377a('0x42')]({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x20412b){if(_0x20412b){_0x298877=_[_0x377a('0x73')](_0x20412b,'id');var _0x3e7b28;var _0x24c1b7=squel[_0x377a('0x74')]();_0x24c1b7[_0x377a('0x75')](_0x59a11b['table']);for(var _0x2ea26c=0x0;_0x2ea26c<_0x3970e4[_0x377a('0x34')];_0x2ea26c+=0x1){_0x3e7b28=_0x3970e4[_0x2ea26c]['MetricId']?_0x298877[_0x3970e4[_0x2ea26c][_0x377a('0x76')]][_0x377a('0x77')]:_0x3970e4[_0x2ea26c][_0x377a('0x78')];_0x3e7b28=_0x3970e4[_0x2ea26c][_0x377a('0x79')]?_[_0x377a('0x7a')](_0x5e630a[_0x3970e4[_0x2ea26c][_0x377a('0x79')]],'%s',_0x3e7b28):_0x3e7b28;_0x3e7b28=_0x3970e4[_0x2ea26c][_0x377a('0x7b')]?_[_0x377a('0x7a')](_0x219eec[_0x3970e4[_0x2ea26c][_0x377a('0x7b')]],'%s',_0x3e7b28):_0x3e7b28;if(_0x3970e4[_0x2ea26c][_0x377a('0x7c')]){_0x24c1b7[_0x377a('0x6b')](_0x3e7b28);}_0x3970e4[_0x2ea26c][_0x377a('0x7d')]&&_0x24c1b7[_0x377a('0x37')](_0x3e7b28,_0x3970e4[_0x2ea26c][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x24c1b7[_0x377a('0x78')](_0x3e7b28,_0x3970e4[_0x2ea26c][_0x377a('0x7f')]||_0x3e7b28);}if(_0x59a11b[_0x377a('0x80')]){_0x59a11b[_0x377a('0x80')]=JSON[_0x377a('0x81')](_0x59a11b[_0x377a('0x80')]);for(var _0x2de848=0x0;_0x2de848<_0x59a11b[_0x377a('0x80')][_0x377a('0x34')];_0x2de848+=0x1){if(_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')]&&_[_0x377a('0x65')](_0x5575bc,_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')])&&_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x82')]&&_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')]&&_0x59a11b[_0x377a('0x80')][_0x2de848]['foreignKey']){_0x24c1b7[_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')]](_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')],null,util[_0x377a('0x7b')](_0x377a('0x84'),_0x59a11b[_0x377a('0x85')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x82')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x86')]));}}}if(_0x59a11b[_0x377a('0x87')]){_0x59a11b[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x59a11b['conditions']);_0x24c1b7['where'](_0x33ab18(_0x59a11b['conditions'][_0x377a('0x6b')]));}_0x5b2be8=_0x24c1b7['clone']();_0x24c1b7[_0x377a('0x1c')](_0x194a41);_0x24c1b7['offset'](0x0);logger[_0x377a('0x88')](_0x377a('0x89'),_0x24c1b7[_0x377a('0x8a')]());return db[_0x377a('0x8b')]['query'](_0x24c1b7[_0x377a('0x8a')](),{'type':db[_0x377a('0x8b')][_0x377a('0x8c')][_0x377a('0x8d')]});}})[_0x377a('0x23')](respondWithResult(_0x1b216f,null))[_0x377a('0x44')](handleError(_0x1b216f,null));};function runReport(_0x51209d,_0x228624,_0x1db830){var _0x45a076=_0x228624[_0x377a('0x27')];var _0x14eb0d=0xa;var _0x5171c7=[_0x377a('0x56'),_0x377a('0x57'),'right_join',_0x377a('0x59')];var _0x5d69fe={'SUM':_0x377a('0x5a'),'COUNT':_0x377a('0x8e'),'COUNT DISTINCT':_0x377a('0x5b'),'MAX':'MAX(%s)','MIN':_0x377a('0x8f'),'AVG':_0x377a('0x5d'),'GROUP_CONCAT':_0x377a('0x5e'),'GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2898cc={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a89fa=function(_0x666a78){return!_[_0x377a('0x65')]([_0x377a('0x66'),_0x377a('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x666a78);};var _0x222883=function(_0x353572){if(!_0x353572||!_0x353572[_0x377a('0x6c')][_0x377a('0x34')]){return'';}for(var _0x2c7fbd='(',_0xd849aa=0x0;_0xd849aa<_0x353572['rules'][_0x377a('0x34')];_0xd849aa+=0x1){_0xd849aa>0x0&&(_0x2c7fbd+='\x20'+_0x353572[_0x377a('0x6a')]+'\x20');_0x2c7fbd+=_0x353572['rules'][_0xd849aa]['group']?_0x222883(_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x6b')]):_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x78')]+'\x20'+_0x353572['rules'][_0xd849aa][_0x377a('0x6d')]+(_0x5a89fa(_0x353572[_0x377a('0x6c')][_0xd849aa]['condition'])?'\x20'+_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x6e')]:'');}return _0x2c7fbd+')';};var _0x364c94={'where':{'id':_0x51209d['id']}},_0x28c5a9,_0x2e7d50,_0x4cbc19,_0x32a215,_0x3b3f88;_0x364c94=_[_0x377a('0x3c')]({},_0x364c94,_0x1db830);return db[_0x377a('0x3f')]['find'](_0x364c94)[_0x377a('0x23')](function(_0x4a91fc){if(_0x4a91fc){_0x28c5a9=_0x4a91fc;return _0x4a91fc[_0x377a('0x6f')]();}return null;})['then'](function(_0x2c4b76){if(_0x2c4b76){if(!_0x2c4b76[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))][(_0x377a('0x90'))](_0x377a('0x71'),0x193);}_0x2e7d50=_0x2c4b76;return db[_0x377a('0x72')][_0x377a('0x42')]({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x21938c){if(_0x21938c){_0x4cbc19=_[_0x377a('0x73')](_0x21938c,'id');var _0x598a12;var _0x33433a=squel[_0x377a('0x74')]();_0x33433a['from'](_0x28c5a9[_0x377a('0x85')]);for(var _0x11c11a=0x0;_0x11c11a<_0x2e7d50[_0x377a('0x34')];_0x11c11a+=0x1){_0x598a12=_0x2e7d50[_0x11c11a][_0x377a('0x76')]?_0x4cbc19[_0x2e7d50[_0x11c11a][_0x377a('0x76')]][_0x377a('0x77')]:_0x2e7d50[_0x11c11a][_0x377a('0x78')];_0x598a12=_0x2e7d50[_0x11c11a]['function']?_[_0x377a('0x7a')](_0x5d69fe[_0x2e7d50[_0x11c11a]['function']],'%s',_0x598a12):_0x598a12;_0x598a12=_0x2e7d50[_0x11c11a]['format']?_['replace'](_0x2898cc[_0x2e7d50[_0x11c11a][_0x377a('0x7b')]],'%s',_0x598a12):_0x598a12;if(_0x2e7d50[_0x11c11a]['groupBy']){_0x33433a[_0x377a('0x6b')](_0x598a12);}_0x2e7d50[_0x11c11a][_0x377a('0x7d')]&&_0x33433a['order'](_0x598a12,_0x2e7d50[_0x11c11a][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x33433a[_0x377a('0x78')](_0x598a12,_0x2e7d50[_0x11c11a][_0x377a('0x7f')]||_0x598a12);}if(_0x28c5a9['joins']){_0x28c5a9[_0x377a('0x80')]=JSON[_0x377a('0x81')](_0x28c5a9[_0x377a('0x80')]);for(var _0x2e63da=0x0;_0x2e63da<_0x28c5a9[_0x377a('0x80')][_0x377a('0x34')];_0x2e63da+=0x1){if(_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x3d')]&&_['includes'](_0x5171c7,_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x3d')])&&_0x28c5a9[_0x377a('0x80')][_0x2e63da]['parentKey']&&_0x28c5a9[_0x377a('0x80')][_0x2e63da]['foreignTable']&&_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x86')]){_0x33433a[_0x28c5a9[_0x377a('0x80')][_0x2e63da]['type']](_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x83')],null,util[_0x377a('0x7b')]('%s.%s\x20=\x20%s.%s',_0x28c5a9[_0x377a('0x85')],_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x82')],_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x83')],_0x28c5a9['joins'][_0x2e63da][_0x377a('0x86')]));}}}if(_0x28c5a9[_0x377a('0x87')]){_0x28c5a9[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x28c5a9[_0x377a('0x87')]);_0x33433a[_0x377a('0x39')](_0x222883(_0x28c5a9[_0x377a('0x87')][_0x377a('0x6b')]));}_0x3b3f88=_0x33433a[_0x377a('0x91')]();_0x33433a[_0x377a('0x1c')](_0x14eb0d);_0x33433a['offset'](0x0);logger['debug']('Limited\x20Query:',_0x33433a['toString']());return db[_0x377a('0x8b')][_0x377a('0x2e')](_0x33433a['toString'](),{'type':db[_0x377a('0x8b')]['QueryTypes'][_0x377a('0x8d')]});}})['then'](function(_0x166c03){if(!_0x166c03[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))][(_0x377a('0x90'))](_0x377a('0x92'),0xcc);}if(_0x228624[_0x377a('0x93')]===_0x377a('0x94')){return null;}var _0xeee50e=_[_0x377a('0x3c')](_0x228624,{'name':_0x228624[_0x377a('0x95')]||_0x228624[_0x377a('0x27')]||_0x28c5a9[_0x377a('0x27')],'basename':_0x45a076,'savename':util[_0x377a('0x7b')]('%s-%s.%s',_0x228624['name']||_0x28c5a9[_0x377a('0x27')],require(_0x377a('0x96'))[_0x377a('0x97')](0x4),_0x228624[_0x377a('0x93')]||_0x377a('0x98')),'reportId':_0x28c5a9['id'],'reportType':_0x377a('0x99')});return db[_0x377a('0x9a')]['create'](_0xeee50e,{'raw':!![]});})[_0x377a('0x23')](function(_0x4d8bf9){if(_0x28c5a9[_0x377a('0x85')]===_0x377a('0x9b')){_0x3b3f88[_0x377a('0x39')](_0x28c5a9['table']+_0x377a('0x9c'),_0x228624[_0x377a('0x9d')],_0x228624['endDate']);}else{_0x3b3f88[_0x377a('0x39')](_0x28c5a9[_0x377a('0x85')]+_0x377a('0x9e'),_0x228624['startDate'],_0x228624[_0x377a('0x9f')]);}if(_0x4d8bf9){logger[_0x377a('0xa0')](_0x377a('0xa1'),_0x3b3f88['toString']());require(_0x377a('0xa2'))[_0x377a('0xa3')](path['join'](__dirname,'../../components/export/',_0x4d8bf9[_0x377a('0x93')]),[_0x4d8bf9['id'],_0x3b3f88[_0x377a('0x8a')](),path['join'](__dirname,_0x377a('0xa4'),_0x4d8bf9[_0x377a('0xa5')]),_0x45a076]);return _0x4d8bf9;}else{var _0x5b6705=squel['select']();_0x5b6705[_0x377a('0x75')]('('+_0x3b3f88[_0x377a('0x8a')]()+')',_0x377a('0xa6'));_0x5b6705['field'](_0x377a('0xa7'),_0x377a('0x1a'));_0x3b3f88['limit'](_0x228624[_0x377a('0x1c')]||_0x14eb0d);_0x3b3f88[_0x377a('0x1b')](_0x228624[_0x377a('0x1b')]||0x0);return dbH[_0x377a('0x8b')]['query'](_0x5b6705['toString'](),{'type':dbH[_0x377a('0x8b')][_0x377a('0x8c')][_0x377a('0x8d')]})[_0x377a('0x23')](function(_0x20c2c0){if(!_0x20c2c0['length']){_0x32a215=0x0;}else{_0x32a215=_0x20c2c0[0x0][_0x377a('0x1a')]||0x0;}return dbH[_0x377a('0x8b')][_0x377a('0x2e')](_0x3b3f88[_0x377a('0x8a')](),{'type':dbH['sequelize'][_0x377a('0x8c')][_0x377a('0x8d')]});})['then'](function(_0x2e8015){return{'rows':_0x2e8015||[],'count':_0x32a215};});}});}exports[_0x377a('0xa8')]=function(_0x27f946,_0x562f29){return runReport(_0x27f946[_0x377a('0x54')],_0x27f946[_0x377a('0x2e')],_0x27f946[_0x377a('0x46')])['then'](respondWithResult(_0x562f29,null))[_0x377a('0x44')](handleError(_0x562f29,null));};exports['runReport']=runReport;exports[_0x377a('0x2e')]=function(_0x10ff7d,_0x5e5f26){var _0x1a5159=0xa;var _0x345292=[_0x377a('0x56'),'left_join',_0x377a('0x58'),_0x377a('0x59')];var _0x3c8293={'SUM':'SUM(%s)','COUNT':_0x377a('0x8e'),'COUNT DISTINCT':_0x377a('0x5b'),'MAX':_0x377a('0x5c'),'MIN':_0x377a('0x8f'),'AVG':_0x377a('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':_0x377a('0x60')};var _0x5ca149={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':_0x377a('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3a3ca2=function(_0x56908c){return!_[_0x377a('0x65')](['IS\x20NULL',_0x377a('0x67'),_0x377a('0x68'),_0x377a('0x69')],_0x56908c);};var _0x3f7222=function(_0x2247c0){if(!_0x2247c0||!_0x2247c0['rules'][_0x377a('0x34')]){return'';}for(var _0x5d5dde='(',_0x91cc13=0x0;_0x91cc13<_0x2247c0[_0x377a('0x6c')][_0x377a('0x34')];_0x91cc13+=0x1){_0x91cc13>0x0&&(_0x5d5dde+='\x20'+_0x2247c0[_0x377a('0x6a')]+'\x20');_0x5d5dde+=_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6b')]?_0x3f7222(_0x2247c0['rules'][_0x91cc13]['group']):_0x2247c0[_0x377a('0x6c')][_0x91cc13]['field']+'\x20'+_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6d')]+(_0x3a3ca2(_0x2247c0['rules'][_0x91cc13][_0x377a('0x6d')])?'\x20'+_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6e')]:'');}return _0x5d5dde+')';};var _0x24c067={'where':{'id':_0x10ff7d['params']['id']}},_0x501984,_0x5f0d2b,_0x37b0bb,_0x2d5c9b,_0x196985;_0x24c067=_[_0x377a('0x3c')]({},_0x24c067,_0x10ff7d[_0x377a('0x46')]);return db[_0x377a('0x3f')][_0x377a('0x47')](_0x24c067)[_0x377a('0x23')](function(_0x2b8351){if(_0x2b8351){_0x501984=_0x2b8351;return _0x2b8351[_0x377a('0x6f')]();}return null;})[_0x377a('0x23')](function(_0x594ed6){if(_0x594ed6){if(!_0x594ed6['length']){throw new db[(_0x377a('0x70'))]['ValidationErrorItem'](_0x377a('0x71'),0x193);}_0x5f0d2b=_0x594ed6;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x51c407){if(_0x51c407){_0x37b0bb=_['keyBy'](_0x51c407,'id');var _0x4dc220;var _0x319c20=squel[_0x377a('0x74')]();_0x319c20['from'](_0x501984[_0x377a('0x85')]);for(var _0xb6557b=0x0;_0xb6557b<_0x5f0d2b[_0x377a('0x34')];_0xb6557b+=0x1){_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x76')]?_0x37b0bb[_0x5f0d2b[_0xb6557b][_0x377a('0x76')]]['metric']:_0x5f0d2b[_0xb6557b][_0x377a('0x78')];_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x79')]?_[_0x377a('0x7a')](_0x3c8293[_0x5f0d2b[_0xb6557b][_0x377a('0x79')]],'%s',_0x4dc220):_0x4dc220;_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x7b')]?_[_0x377a('0x7a')](_0x5ca149[_0x5f0d2b[_0xb6557b]['format']],'%s',_0x4dc220):_0x4dc220;if(_0x5f0d2b[_0xb6557b][_0x377a('0x7c')]){_0x319c20['group'](_0x4dc220);}_0x5f0d2b[_0xb6557b][_0x377a('0x7d')]&&_0x319c20[_0x377a('0x37')](_0x4dc220,_0x5f0d2b[_0xb6557b][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x319c20[_0x377a('0x78')](_0x4dc220,_0x5f0d2b[_0xb6557b][_0x377a('0x7f')]||_0x4dc220);}if(_0x501984[_0x377a('0x80')]){_0x501984['joins']=JSON['parse'](_0x501984[_0x377a('0x80')]);for(var _0x46889e=0x0;_0x46889e<_0x501984[_0x377a('0x80')][_0x377a('0x34')];_0x46889e+=0x1){if(_0x501984['joins'][_0x46889e][_0x377a('0x3d')]&&_[_0x377a('0x65')](_0x345292,_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x3d')])&&_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x82')]&&_0x501984[_0x377a('0x80')][_0x46889e]['foreignTable']&&_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x86')]){_0x319c20[_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x3d')]](_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x83')],null,util[_0x377a('0x7b')]('%s.%s\x20=\x20%s.%s',_0x501984[_0x377a('0x85')],_0x501984['joins'][_0x46889e][_0x377a('0x82')],_0x501984['joins'][_0x46889e][_0x377a('0x83')],_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x86')]));}}}if(_0x501984[_0x377a('0x87')]){_0x501984[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x501984['conditions']);_0x319c20['where'](_0x3f7222(_0x501984[_0x377a('0x87')][_0x377a('0x6b')]));}_0x196985=_0x319c20[_0x377a('0x91')]();_0x319c20[_0x377a('0x1c')](_0x1a5159);_0x319c20[_0x377a('0x1b')](0x0);logger[_0x377a('0x88')](_0x377a('0x89'),_0x319c20[_0x377a('0x8a')]());return db['sequelize']['query'](_0x319c20[_0x377a('0x8a')](),{'type':db[_0x377a('0x8b')]['QueryTypes'][_0x377a('0x8d')]});}})[_0x377a('0x23')](function(){return{'sql':_0x196985['toString']()};})[_0x377a('0x23')](respondWithResult(_0x5e5f26,null))['catch'](handleError(_0x5e5f26,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 79aaac2..ee28866 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 _0x6640=['AnalyticDefaultReport','analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xc0ebb8,_0xe977bd){var _0x5f23dc=function(_0x24f053){while(--_0x24f053){_0xc0ebb8['push'](_0xc0ebb8['shift']());}};_0x5f23dc(++_0xe977bd);}(_0x6640,0x160));var _0x0664=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0x6640[_0x430095];return _0x115f8a;};'use strict';var _=require(_0x0664('0x0'));var util=require(_0x0664('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0664('0x2'));var BPromise=require(_0x0664('0x3'));var rp=require(_0x0664('0x4'));var fs=require('fs');var path=require(_0x0664('0x5'));var rimraf=require('rimraf');var config=require(_0x0664('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x0664('0x7')]=function(_0x25a2e9,_0x10d141){return _0x25a2e9['define'](_0x0664('0x8'),attributes,{'tableName':_0x0664('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0460=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x3683db,_0x589556){var _0x3b07c5=function(_0x29f856){while(--_0x29f856){_0x3683db['push'](_0x3683db['shift']());}};_0x3b07c5(++_0x589556);}(_0x0460,0xab));var _0x0046=function(_0xa4affe,_0x1d1398){_0xa4affe=_0xa4affe-0x0;var _0x402bab=_0x0460[_0xa4affe];return _0x402bab;};'use strict';var _=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var logger=require(_0x0046('0x2'))('api');var moment=require(_0x0046('0x3'));var BPromise=require(_0x0046('0x4'));var rp=require(_0x0046('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0046('0x6'));var config=require('../../config/environment');var attributes=require(_0x0046('0x7'));module[_0x0046('0x8')]=function(_0x21ec7c,_0x2aee0d){return _0x21ec7c[_0x0046('0x9')](_0x0046('0xa'),attributes,{'tableName':_0x0046('0xb'),'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 9490bfb..21c0728 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 _0xf81a=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1dfa5e,_0x1e4454){var _0x5ba663=function(_0x1a53ff){while(--_0x1a53ff){_0x1dfa5e['push'](_0x1dfa5e['shift']());}};_0x5ba663(++_0x1e4454);}(_0xf81a,0x16b));var _0xaf81=function(_0x4e856f,_0x46cd50){_0x4e856f=_0x4e856f-0x0;var _0xa634c0=_0xf81a[_0x4e856f];return _0xa634c0;};'use strict';var _=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf81('0x3'));var fs=require('fs');var Redis=require(_0xaf81('0x4'));var db=require(_0xaf81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf81('0x8'));var client=jayson[_0xaf81('0x9')][_0xaf81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd36,_0x268973,_0x365b31){return new BPromise(function(_0x4c3052,_0x3f0ac8){return client[_0xaf81('0xb')](_0x5cfd36,_0x365b31)[_0xaf81('0xc')](function(_0x3efaaf){logger['info'](_0xaf81('0xd'),_0x268973,_0xaf81('0xe'));logger[_0xaf81('0xf')](_0xaf81('0x10'),_0x268973,_0xaf81('0xe'),JSON[_0xaf81('0x11')](_0x3efaaf));if(_0x3efaaf['error']){if(_0x3efaaf['error'][_0xaf81('0x12')]===0x1f4){logger['error'](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x3f0ac8(_0x3efaaf[_0xaf81('0x13')]['message']);}logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x4c3052(_0x3efaaf[_0xaf81('0x13')]['message']);}else{logger[_0xaf81('0x15')](_0xaf81('0xd'),_0x268973,'request\x20sent');_0x4c3052(_0x3efaaf[_0xaf81('0x16')][_0xaf81('0x14')]);}})[_0xaf81('0x17')](function(_0x508df4){logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x508df4);_0x3f0ac8(_0x508df4);});});} \ No newline at end of file +var _0x5b05=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x27262a,_0x4de20c){var _0x514f44=function(_0x1a7132){while(--_0x1a7132){_0x27262a['push'](_0x27262a['shift']());}};_0x514f44(++_0x4de20c);}(_0x5b05,0x190));var _0x55b0=function(_0x2e36df,_0x455689){_0x2e36df=_0x2e36df-0x0;var _0x43bca3=_0x5b05[_0x2e36df];return _0x43bca3;};'use strict';var _=require('lodash');var util=require(_0x55b0('0x0'));var moment=require(_0x55b0('0x1'));var BPromise=require(_0x55b0('0x2'));var rs=require(_0x55b0('0x3'));var fs=require('fs');var Redis=require(_0x55b0('0x4'));var db=require(_0x55b0('0x5'))['db'];var utils=require(_0x55b0('0x6'));var logger=require(_0x55b0('0x7'))(_0x55b0('0x8'));var config=require(_0x55b0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0c407,_0x46c475,_0x355e20){return new BPromise(function(_0xdf375f,_0x598abf){return client[_0x55b0('0xb')](_0xe0c407,_0x355e20)[_0x55b0('0xc')](function(_0xc1d43){logger[_0x55b0('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,'request\x20sent');logger[_0x55b0('0xe')](_0x55b0('0xf'),_0x46c475,_0x55b0('0x10'),JSON[_0x55b0('0x11')](_0xc1d43));if(_0xc1d43[_0x55b0('0x12')]){if(_0xc1d43[_0x55b0('0x12')]['code']===0x1f4){logger[_0x55b0('0x12')](_0x55b0('0x13'),_0x46c475,_0xc1d43['error'][_0x55b0('0x14')]);return _0x598abf(_0xc1d43[_0x55b0('0x12')][_0x55b0('0x14')]);}logger[_0x55b0('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,_0xc1d43['error']['message']);return _0xdf375f(_0xc1d43[_0x55b0('0x12')]['message']);}else{logger[_0x55b0('0xd')](_0x55b0('0x13'),_0x46c475,'request\x20sent');_0xdf375f(_0xc1d43[_0x55b0('0x15')][_0x55b0('0x14')]);}})[_0x55b0('0x16')](function(_0x947f96){logger[_0x55b0('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,_0x947f96);_0x598abf(_0x947f96);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 89602ab..3b3a326 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 _0x767d=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','destroy','exports'];(function(_0x4cef35,_0x42dc26){var _0x4752bc=function(_0x54ea54){while(--_0x54ea54){_0x4cef35['push'](_0x4cef35['shift']());}};_0x4752bc(++_0x42dc26);}(_0x767d,0x17a));var _0xd767=function(_0x451224,_0xa75638){_0x451224=_0x451224-0x0;var _0x3b49c1=_0x767d[_0x451224];return _0x3b49c1;};'use strict';var multer=require('multer');var util=require(_0xd767('0x0'));var path=require(_0xd767('0x1'));var timeout=require(_0xd767('0x2'));var express=require('express');var router=express[_0xd767('0x3')]();var auth=require(_0xd767('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd767('0x5'));var controller=require(_0xd767('0x6'));router[_0xd767('0x7')]('/',auth[_0xd767('0x8')](),controller['index']);router['get'](_0xd767('0x9'),auth[_0xd767('0x8')](),controller['show']);router[_0xd767('0x7')](_0xd767('0xa'),auth[_0xd767('0x8')](),controller[_0xd767('0xb')]);router[_0xd767('0x7')](_0xd767('0xc'),auth['isAuthenticated'](),controller[_0xd767('0xd')]);router['get'](_0xd767('0xe'),auth['isAuthenticated'](),controller[_0xd767('0xf')]);router[_0xd767('0x10')]('/',auth[_0xd767('0x8')](),controller[_0xd767('0x11')]);router['put'](_0xd767('0x9'),auth['isAuthenticated'](),controller[_0xd767('0x12')]);router['delete'](_0xd767('0x9'),auth[_0xd767('0x8')](),controller[_0xd767('0x13')]);module[_0xd767('0x14')]=router; \ No newline at end of file +var _0x17a8=['/:id/run','run','/:id/query','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','/:id/preview'];(function(_0x33f3dd,_0x4d3df7){var _0x4a91b6=function(_0x295fd2){while(--_0x295fd2){_0x33f3dd['push'](_0x33f3dd['shift']());}};_0x4a91b6(++_0x4d3df7);}(_0x17a8,0x7b));var _0x817a=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0x17a8[_0x12c076];return _0x2ddd18;};'use strict';var multer=require(_0x817a('0x0'));var util=require(_0x817a('0x1'));var path=require(_0x817a('0x2'));var timeout=require(_0x817a('0x3'));var express=require(_0x817a('0x4'));var router=express[_0x817a('0x5')]();var auth=require(_0x817a('0x6'));var interaction=require(_0x817a('0x7'));var config=require(_0x817a('0x8'));var controller=require(_0x817a('0x9'));router[_0x817a('0xa')]('/',auth['isAuthenticated'](),controller[_0x817a('0xb')]);router[_0x817a('0xa')](_0x817a('0xc'),auth[_0x817a('0xd')](),controller['show']);router['get'](_0x817a('0xe'),auth[_0x817a('0xd')](),controller['preview']);router[_0x817a('0xa')](_0x817a('0xf'),auth[_0x817a('0xd')](),controller[_0x817a('0x10')]);router[_0x817a('0xa')](_0x817a('0x11'),auth[_0x817a('0xd')](),controller['query']);router[_0x817a('0x12')]('/',auth[_0x817a('0xd')](),controller[_0x817a('0x13')]);router[_0x817a('0x14')](_0x817a('0xc'),auth[_0x817a('0xd')](),controller['update']);router[_0x817a('0x15')]('/:id',auth[_0x817a('0xd')](),controller['destroy']);module[_0x817a('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 499abaa..9dfc560 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 _0x5482=['xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0x5482,0x14b));var _0x2548=function(_0x103965,_0x1b794e){_0x103965=_0x103965-0x0;var _0x40c90b=_0x5482[_0x103965];return _0x40c90b;};'use strict';var Sequelize=require(_0x2548('0x0'));var moment=require(_0x2548('0x1'));module[_0x2548('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x2548('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x2548('0x4')](_0x2548('0x5'),_0x2548('0x6'),_0x2548('0x7')),'allowNull':![],'defaultValue':_0x2548('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2548('0x8')]},'endDate':{'type':Sequelize[_0x2548('0x8')]},'status':{'type':Sequelize[_0x2548('0x3')],'defaultValue':_0x2548('0x9')},'type':{'type':Sequelize['ENUM'](_0x2548('0xa'),_0x2548('0xb')),'allowNull':![],'defaultValue':_0x2548('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2548('0xc')]},'reportType':{'type':Sequelize[_0x2548('0x3')]}}; \ No newline at end of file +var _0x932b=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','DATE'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x932b,0x10c));var _0xb932=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x932b[_0x5f36cd];return _0x49832a;};'use strict';var Sequelize=require(_0xb932('0x0'));var moment=require(_0xb932('0x1'));module['exports']={'name':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xb932('0x3')](_0xb932('0x4'),_0xb932('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xb932('0x4')},'savename':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb932('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb932('0x3')](_0xb932('0x7'),_0xb932('0x8')),'allowNull':![],'defaultValue':_0xb932('0x7')},'reportId':{'type':Sequelize[_0xb932('0x9')](0xb)[_0xb932('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2a68333..312da16 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 _0xcb29=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2f486c,_0x37162d){var _0x4c2e34=function(_0x41840b){while(--_0x41840b){_0x2f486c['push'](_0x2f486c['shift']());}};_0x4c2e34(++_0x37162d);}(_0xcb29,0x123));var _0x9cb2=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcb29[_0x5d7227];return _0x15ac55;};'use strict';var pdf=require(_0x9cb2('0x0'));var emlformat=require(_0x9cb2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9cb2('0x2'));var jsonpatch=require(_0x9cb2('0x3'));var rp=require(_0x9cb2('0x4'));var moment=require(_0x9cb2('0x5'));var BPromise=require(_0x9cb2('0x6'));var Mustache=require(_0x9cb2('0x7'));var util=require(_0x9cb2('0x8'));var path=require(_0x9cb2('0x9'));var sox=require(_0x9cb2('0xa'));var csv=require(_0x9cb2('0xb'));var ejs=require(_0x9cb2('0xc'));var fs=require('fs');var _=require(_0x9cb2('0xd'));var squel=require(_0x9cb2('0xe'));var crypto=require(_0x9cb2('0xf'));var jsforce=require(_0x9cb2('0x10'));var deskjs=require(_0x9cb2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9cb2('0x12'));var Papa=require(_0x9cb2('0x13'));var Redis=require(_0x9cb2('0x14'));var authService=require(_0x9cb2('0x15'));var qs=require(_0x9cb2('0x16'));var as=require(_0x9cb2('0x17'));var hardwareService=require(_0x9cb2('0x18'));var logger=require(_0x9cb2('0x19'))(_0x9cb2('0x1a'));var utils=require(_0x9cb2('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x9cb2('0x1c'));var db=require(_0x9cb2('0x1d'))['db'];function respondWithStatusCode(_0xb84017,_0x361349){_0x361349=_0x361349||0xcc;return function(_0x302e18){if(_0x302e18){return _0xb84017[_0x9cb2('0x1e')](_0x361349);}return _0xb84017[_0x9cb2('0x1f')](_0x361349)['end']();};}function respondWithResult(_0x5a54a7,_0x41676c){_0x41676c=_0x41676c||0xc8;return function(_0x1b3ce3){if(_0x1b3ce3){return _0x5a54a7[_0x9cb2('0x1f')](_0x41676c)['json'](_0x1b3ce3);}};}function respondWithFilteredResult(_0x4ca64e,_0x220ccd){return function(_0x5d1357){if(_0x5d1357){var _0x59b25e=_0x5d1357[_0x9cb2('0x20')],_0x7240d4=_0x220ccd[_0x9cb2('0x21')],_0x11d67a=_0x220ccd['offset']+_0x220ccd[_0x9cb2('0x22')],_0xb5f1cc;if(_0x11d67a>=_0x59b25e){_0x11d67a=_0x59b25e;_0xb5f1cc=0xc8;}else{_0xb5f1cc=0xce;}_0x4ca64e[_0x9cb2('0x1f')](_0xb5f1cc);return _0x4ca64e[_0x9cb2('0x23')](_0x9cb2('0x24'),_0x7240d4+'-'+_0x11d67a+'/'+_0x59b25e)[_0x9cb2('0x25')](_0x5d1357);}return null;};}function patchUpdates(_0x4d47d2){return function(_0x51ca8c){try{jsonpatch[_0x9cb2('0x26')](_0x51ca8c,_0x4d47d2,!![]);}catch(_0x390174){return BPromise[_0x9cb2('0x27')](_0x390174);}return _0x51ca8c[_0x9cb2('0x28')]();};}function saveUpdates(_0xe83b21,_0x5406d5){return function(_0x541407){if(_0x541407){return _0x541407[_0x9cb2('0x29')](_0xe83b21)[_0x9cb2('0x2a')](function(_0x14e328){return _0x14e328;});}return null;};}function removeEntity(_0x83248a,_0x18f2a4){return function(_0x1d88c2){if(_0x1d88c2){return _0x1d88c2[_0x9cb2('0x2b')]()[_0x9cb2('0x2a')](function(){var _0x587a1a=_0x1d88c2[_0x9cb2('0x2c')]({'plain':!![]});var _0x10562d=_0x9cb2('0x2d');return db[_0x9cb2('0x2e')]['destroy']({'where':{'type':_0x10562d,'resourceId':_0x587a1a['id']}})[_0x9cb2('0x2a')](function(){return _0x1d88c2;});})['then'](function(){_0x83248a[_0x9cb2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccdc0,_0x13848d){return function(_0x382364){if(!_0x382364){_0x5ccdc0['sendStatus'](0x194);}return _0x382364;};}function handleError(_0x5a8e17,_0x428d54){_0x428d54=_0x428d54||0x1f4;return function(_0x2e7910){logger[_0x9cb2('0x2f')](_0x2e7910[_0x9cb2('0x30')]);if(_0x2e7910[_0x9cb2('0x31')]){delete _0x2e7910[_0x9cb2('0x31')];}_0x5a8e17[_0x9cb2('0x1f')](_0x428d54)[_0x9cb2('0x32')](_0x2e7910);};}exports[_0x9cb2('0x33')]=function(_0x256139,_0x520a3a){var _0x334df7={},_0x962bf={},_0x3f49e0={'count':0x0,'rows':[]};var _0x22678d=_[_0x9cb2('0x34')](db[_0x9cb2('0x35')][_0x9cb2('0x36')],function(_0x209f8f){return{'name':_0x209f8f[_0x9cb2('0x37')],'type':_0x209f8f[_0x9cb2('0x38')][_0x9cb2('0x39')]};});_0x962bf[_0x9cb2('0x3a')]=_[_0x9cb2('0x34')](_0x22678d,_0x9cb2('0x31'));_0x962bf[_0x9cb2('0x3b')]=_['keys'](_0x256139['query']);_0x962bf[_0x9cb2('0x3c')]=_[_0x9cb2('0x3d')](_0x962bf[_0x9cb2('0x3a')],_0x962bf[_0x9cb2('0x3b')]);_0x334df7['attributes']=_[_0x9cb2('0x3d')](_0x962bf[_0x9cb2('0x3a')],qs[_0x9cb2('0x3e')](_0x256139['query'][_0x9cb2('0x3e')]));_0x334df7[_0x9cb2('0x3f')]=_0x334df7[_0x9cb2('0x3f')][_0x9cb2('0x40')]?_0x334df7[_0x9cb2('0x3f')]:_0x962bf[_0x9cb2('0x3a')];if(!_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x41')](_0x9cb2('0x42'))){_0x334df7[_0x9cb2('0x22')]=qs[_0x9cb2('0x22')](_0x256139['query'][_0x9cb2('0x22')]);_0x334df7[_0x9cb2('0x21')]=qs[_0x9cb2('0x21')](_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x21')]);}_0x334df7[_0x9cb2('0x43')]=qs['sort'](_0x256139[_0x9cb2('0x3b')]['sort']);_0x334df7['where']=qs[_0x9cb2('0x3c')](_['pick'](_0x256139[_0x9cb2('0x3b')],_0x962bf[_0x9cb2('0x3c')]),_0x22678d);if(_0x256139['query'][_0x9cb2('0x44')]){_0x334df7[_0x9cb2('0x45')]=_[_0x9cb2('0x46')](_0x334df7[_0x9cb2('0x45')],{'$or':_[_0x9cb2('0x34')](_0x22678d,function(_0x2be3b2){if(_0x2be3b2['type']!==_0x9cb2('0x47')){var _0x4d2dcb={};_0x4d2dcb[_0x2be3b2[_0x9cb2('0x31')]]={'$like':'%'+_0x256139[_0x9cb2('0x3b')][_0x9cb2('0x44')]+'%'};return _0x4d2dcb;}})});}_0x334df7=_[_0x9cb2('0x46')]({},_0x334df7,_0x256139[_0x9cb2('0x48')]);var _0x2da4cd={'where':_0x334df7['where']};return db['AnalyticExtractedReport']['count'](_0x2da4cd)[_0x9cb2('0x2a')](function(_0x4b789a){_0x3f49e0['count']=_0x4b789a;if(_0x256139['query'][_0x9cb2('0x49')]){_0x334df7[_0x9cb2('0x4a')]=[{'all':!![]}];}return db[_0x9cb2('0x35')][_0x9cb2('0x4b')](_0x334df7);})[_0x9cb2('0x2a')](function(_0x8b2cb4){_0x3f49e0[_0x9cb2('0x4c')]=_0x8b2cb4;return _0x3f49e0;})[_0x9cb2('0x2a')](respondWithFilteredResult(_0x520a3a,_0x334df7))['catch'](handleError(_0x520a3a,null));};exports['show']=function(_0x3fa5b1,_0x4e11e7){var _0x3556b5={'raw':!![],'where':{'id':_0x3fa5b1[_0x9cb2('0x4d')]['id']}},_0x203c8d={};_0x203c8d[_0x9cb2('0x3a')]=_['keys'](db[_0x9cb2('0x35')][_0x9cb2('0x36')]);_0x203c8d[_0x9cb2('0x3b')]=_[_0x9cb2('0x4e')](_0x3fa5b1[_0x9cb2('0x3b')]);_0x203c8d[_0x9cb2('0x3c')]=_[_0x9cb2('0x3d')](_0x203c8d[_0x9cb2('0x3a')],_0x203c8d['query']);_0x3556b5[_0x9cb2('0x3f')]=_[_0x9cb2('0x3d')](_0x203c8d[_0x9cb2('0x3a')],qs[_0x9cb2('0x3e')](_0x3fa5b1[_0x9cb2('0x3b')][_0x9cb2('0x3e')]));_0x3556b5[_0x9cb2('0x3f')]=_0x3556b5[_0x9cb2('0x3f')]['length']?_0x3556b5[_0x9cb2('0x3f')]:_0x203c8d[_0x9cb2('0x3a')];if(_0x3fa5b1[_0x9cb2('0x3b')][_0x9cb2('0x49')]){_0x3556b5[_0x9cb2('0x4a')]=[{'all':!![]}];}_0x3556b5=_['merge']({},_0x3556b5,_0x3fa5b1['options']);return db[_0x9cb2('0x35')]['find'](_0x3556b5)[_0x9cb2('0x2a')](handleEntityNotFound(_0x4e11e7,null))[_0x9cb2('0x2a')](respondWithResult(_0x4e11e7,null))[_0x9cb2('0x4f')](handleError(_0x4e11e7,null));};exports[_0x9cb2('0x50')]=function(_0x571d1d,_0x50cb91){return db['AnalyticExtractedReport']['create'](_0x571d1d[_0x9cb2('0x51')],{})[_0x9cb2('0x2a')](function(_0x498e63){var _0x277e9e=_0x571d1d[_0x9cb2('0x52')][_0x9cb2('0x2c')]({'plain':!![]});if(!_0x277e9e)throw new Error(_0x9cb2('0x53'));if(_0x277e9e[_0x9cb2('0x54')]==='user'){var _0x1b02c7=_0x498e63['get']({'plain':!![]});var _0x19680c=_0x9cb2('0x2d');return db['UserProfileSection'][_0x9cb2('0x55')]({'where':{'name':_0x19680c,'userProfileId':_0x277e9e[_0x9cb2('0x56')]},'raw':!![]})[_0x9cb2('0x2a')](function(_0x4f2178){if(_0x4f2178&&_0x4f2178['autoAssociation']===0x0){return db[_0x9cb2('0x2e')][_0x9cb2('0x50')]({'name':_0x1b02c7[_0x9cb2('0x31')],'resourceId':_0x1b02c7['id'],'type':_0x4f2178[_0x9cb2('0x31')],'sectionId':_0x4f2178['id']},{})[_0x9cb2('0x2a')](function(){return _0x498e63;});}else{return _0x498e63;}})[_0x9cb2('0x4f')](function(_0x407e10){logger['error'](_0x9cb2('0x57'),_0x407e10);throw _0x407e10;});}return _0x498e63;})[_0x9cb2('0x2a')](respondWithResult(_0x50cb91,0xc9))[_0x9cb2('0x4f')](handleError(_0x50cb91,null));};exports[_0x9cb2('0x29')]=function(_0x24369a,_0x67b1f3){if(_0x24369a[_0x9cb2('0x51')]['id']){delete _0x24369a[_0x9cb2('0x51')]['id'];}return db[_0x9cb2('0x35')]['find']({'where':{'id':_0x24369a[_0x9cb2('0x4d')]['id']}})[_0x9cb2('0x2a')](handleEntityNotFound(_0x67b1f3,null))['then'](saveUpdates(_0x24369a[_0x9cb2('0x51')],null))[_0x9cb2('0x2a')](respondWithResult(_0x67b1f3,null))['catch'](handleError(_0x67b1f3,null));};exports[_0x9cb2('0x2b')]=function(_0x281080,_0x4529f7){return db['AnalyticExtractedReport'][_0x9cb2('0x55')]({'where':{'id':_0x281080[_0x9cb2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4529f7,null))[_0x9cb2('0x2a')](removeEntity(_0x4529f7,null))[_0x9cb2('0x4f')](handleError(_0x4529f7,null));};exports[_0x9cb2('0x58')]=function(_0x37e930,_0x5020ea,_0x52f5c3){return db[_0x9cb2('0x35')][_0x9cb2('0x55')]({'where':{'id':_0x37e930[_0x9cb2('0x4d')]['id']},'attributes':[_0x9cb2('0x31'),'basename','savename',_0x9cb2('0x59')],'raw':!![]})[_0x9cb2('0x2a')](handleEntityNotFound(_0x5020ea,null))[_0x9cb2('0x2a')](function(_0x315068){if(_0x315068){if(!fs[_0x9cb2('0x5a')](path[_0x9cb2('0x5b')](config[_0x9cb2('0x5c')],_0x9cb2('0x5d'),_0x315068[_0x9cb2('0x5e')]))){throw new db[(_0x9cb2('0x5f'))]['ValidationError'](_0x9cb2('0x60'));}if(_0x37e930[_0x9cb2('0x3b')][_0x9cb2('0x61')]){return _0x5020ea[_0x9cb2('0x1e')](0xc8);}return _0x5020ea[_0x9cb2('0x58')](path['join'](config[_0x9cb2('0x5c')],_0x9cb2('0x5d'),_0x315068[_0x9cb2('0x5e')]),util[_0x9cb2('0x62')](_0x9cb2('0x63'),_0x315068['basename']||_0x315068['name'],_0x315068[_0x9cb2('0x59')][_0x9cb2('0x64')]()));}})[_0x9cb2('0x4f')](handleError(_0x5020ea,null));}; \ No newline at end of file +var _0xc3c2=['error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','rawAttributes','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource'];(function(_0x4f26c0,_0x241b6d){var _0x72e46=function(_0x538c5f){while(--_0x538c5f){_0x4f26c0['push'](_0x4f26c0['shift']());}};_0x72e46(++_0x241b6d);}(_0xc3c2,0x8e));var _0x2c3c=function(_0x19a26a,_0x34030b){_0x19a26a=_0x19a26a-0x0;var _0x405a27=_0xc3c2[_0x19a26a];return _0x405a27;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c3c('0x0'));var rimraf=require(_0x2c3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c3c('0x2'));var rp=require('request-promise');var moment=require(_0x2c3c('0x3'));var BPromise=require(_0x2c3c('0x4'));var Mustache=require(_0x2c3c('0x5'));var util=require(_0x2c3c('0x6'));var path=require(_0x2c3c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c3c('0x8'));var squel=require(_0x2c3c('0x9'));var crypto=require(_0x2c3c('0xa'));var jsforce=require(_0x2c3c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c3c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c3c('0xd'));var authService=require(_0x2c3c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2c3c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c3c('0x10'));var utils=require(_0x2c3c('0x11'));var config=require(_0x2c3c('0x12'));var licenseUtil=require(_0x2c3c('0x13'));var db=require(_0x2c3c('0x14'))['db'];function respondWithStatusCode(_0x4e520d,_0x11a9ce){_0x11a9ce=_0x11a9ce||0xcc;return function(_0x344d6b){if(_0x344d6b){return _0x4e520d[_0x2c3c('0x15')](_0x11a9ce);}return _0x4e520d[_0x2c3c('0x16')](_0x11a9ce)['end']();};}function respondWithResult(_0x571d19,_0x382936){_0x382936=_0x382936||0xc8;return function(_0x467903){if(_0x467903){return _0x571d19[_0x2c3c('0x16')](_0x382936)[_0x2c3c('0x17')](_0x467903);}};}function respondWithFilteredResult(_0x22c71e,_0x189e88){return function(_0x52b836){if(_0x52b836){var _0x112e96=_0x52b836[_0x2c3c('0x18')],_0x3854da=_0x189e88[_0x2c3c('0x19')],_0x1b81cf=_0x189e88['offset']+_0x189e88[_0x2c3c('0x1a')],_0x48cfc1;if(_0x1b81cf>=_0x112e96){_0x1b81cf=_0x112e96;_0x48cfc1=0xc8;}else{_0x48cfc1=0xce;}_0x22c71e[_0x2c3c('0x16')](_0x48cfc1);return _0x22c71e['set']('Content-Range',_0x3854da+'-'+_0x1b81cf+'/'+_0x112e96)['json'](_0x52b836);}return null;};}function patchUpdates(_0x44d4de){return function(_0x1046b5){try{jsonpatch[_0x2c3c('0x1b')](_0x1046b5,_0x44d4de,!![]);}catch(_0x3b010d){return BPromise[_0x2c3c('0x1c')](_0x3b010d);}return _0x1046b5[_0x2c3c('0x1d')]();};}function saveUpdates(_0x318f6d,_0xeb46b2){return function(_0x561f5c){if(_0x561f5c){return _0x561f5c[_0x2c3c('0x1e')](_0x318f6d)[_0x2c3c('0x1f')](function(_0x1a9337){return _0x1a9337;});}return null;};}function removeEntity(_0x56ad3d,_0x5e2dca){return function(_0x1b045a){if(_0x1b045a){return _0x1b045a[_0x2c3c('0x20')]()[_0x2c3c('0x1f')](function(){var _0x514654=_0x1b045a[_0x2c3c('0x21')]({'plain':!![]});var _0x4a9780=_0x2c3c('0x22');return db[_0x2c3c('0x23')][_0x2c3c('0x20')]({'where':{'type':_0x4a9780,'resourceId':_0x514654['id']}})[_0x2c3c('0x1f')](function(){return _0x1b045a;});})['then'](function(){_0x56ad3d[_0x2c3c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3610da,_0x100934){return function(_0x5ae651){if(!_0x5ae651){_0x3610da[_0x2c3c('0x15')](0x194);}return _0x5ae651;};}function handleError(_0x1d629d,_0x5777c8){_0x5777c8=_0x5777c8||0x1f4;return function(_0x834af2){logger[_0x2c3c('0x24')](_0x834af2[_0x2c3c('0x25')]);if(_0x834af2['name']){delete _0x834af2[_0x2c3c('0x26')];}_0x1d629d[_0x2c3c('0x16')](_0x5777c8)[_0x2c3c('0x27')](_0x834af2);};}exports[_0x2c3c('0x28')]=function(_0x362e35,_0x19e236){var _0x33a04d={},_0x1223a6={},_0x4433bf={'count':0x0,'rows':[]};var _0xff6218=_[_0x2c3c('0x29')](db[_0x2c3c('0x2a')]['rawAttributes'],function(_0xd31a21){return{'name':_0xd31a21[_0x2c3c('0x2b')],'type':_0xd31a21[_0x2c3c('0x2c')][_0x2c3c('0x2d')]};});_0x1223a6[_0x2c3c('0x2e')]=_[_0x2c3c('0x29')](_0xff6218,_0x2c3c('0x26'));_0x1223a6[_0x2c3c('0x2f')]=_[_0x2c3c('0x30')](_0x362e35[_0x2c3c('0x2f')]);_0x1223a6['filters']=_[_0x2c3c('0x31')](_0x1223a6[_0x2c3c('0x2e')],_0x1223a6[_0x2c3c('0x2f')]);_0x33a04d[_0x2c3c('0x32')]=_[_0x2c3c('0x31')](_0x1223a6[_0x2c3c('0x2e')],qs[_0x2c3c('0x33')](_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x33')]));_0x33a04d[_0x2c3c('0x32')]=_0x33a04d['attributes'][_0x2c3c('0x34')]?_0x33a04d[_0x2c3c('0x32')]:_0x1223a6[_0x2c3c('0x2e')];if(!_0x362e35[_0x2c3c('0x2f')]['hasOwnProperty'](_0x2c3c('0x35'))){_0x33a04d[_0x2c3c('0x1a')]=qs[_0x2c3c('0x1a')](_0x362e35[_0x2c3c('0x2f')]['limit']);_0x33a04d[_0x2c3c('0x19')]=qs['offset'](_0x362e35['query'][_0x2c3c('0x19')]);}_0x33a04d[_0x2c3c('0x36')]=qs[_0x2c3c('0x37')](_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x37')]);_0x33a04d[_0x2c3c('0x38')]=qs[_0x2c3c('0x39')](_[_0x2c3c('0x3a')](_0x362e35[_0x2c3c('0x2f')],_0x1223a6[_0x2c3c('0x39')]),_0xff6218);if(_0x362e35['query'][_0x2c3c('0x3b')]){_0x33a04d[_0x2c3c('0x38')]=_['merge'](_0x33a04d[_0x2c3c('0x38')],{'$or':_[_0x2c3c('0x29')](_0xff6218,function(_0x7c1a29){if(_0x7c1a29[_0x2c3c('0x2c')]!==_0x2c3c('0x3c')){var _0x3a3afc={};_0x3a3afc[_0x7c1a29[_0x2c3c('0x26')]]={'$like':'%'+_0x362e35[_0x2c3c('0x2f')]['filter']+'%'};return _0x3a3afc;}})});}_0x33a04d=_[_0x2c3c('0x3d')]({},_0x33a04d,_0x362e35['options']);var _0x22fc02={'where':_0x33a04d[_0x2c3c('0x38')]};return db[_0x2c3c('0x2a')]['count'](_0x22fc02)['then'](function(_0x124d95){_0x4433bf['count']=_0x124d95;if(_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x3e')]){_0x33a04d[_0x2c3c('0x3f')]=[{'all':!![]}];}return db[_0x2c3c('0x2a')]['findAll'](_0x33a04d);})[_0x2c3c('0x1f')](function(_0xf82b3){_0x4433bf[_0x2c3c('0x40')]=_0xf82b3;return _0x4433bf;})[_0x2c3c('0x1f')](respondWithFilteredResult(_0x19e236,_0x33a04d))[_0x2c3c('0x41')](handleError(_0x19e236,null));};exports[_0x2c3c('0x42')]=function(_0x1a9224,_0x73577b){var _0x33b727={'raw':!![],'where':{'id':_0x1a9224['params']['id']}},_0x5ae3ea={};_0x5ae3ea[_0x2c3c('0x2e')]=_[_0x2c3c('0x30')](db['AnalyticExtractedReport'][_0x2c3c('0x43')]);_0x5ae3ea[_0x2c3c('0x2f')]=_[_0x2c3c('0x30')](_0x1a9224[_0x2c3c('0x2f')]);_0x5ae3ea['filters']=_[_0x2c3c('0x31')](_0x5ae3ea[_0x2c3c('0x2e')],_0x5ae3ea[_0x2c3c('0x2f')]);_0x33b727['attributes']=_['intersection'](_0x5ae3ea[_0x2c3c('0x2e')],qs['fields'](_0x1a9224[_0x2c3c('0x2f')]['fields']));_0x33b727[_0x2c3c('0x32')]=_0x33b727['attributes'][_0x2c3c('0x34')]?_0x33b727[_0x2c3c('0x32')]:_0x5ae3ea['model'];if(_0x1a9224[_0x2c3c('0x2f')][_0x2c3c('0x3e')]){_0x33b727[_0x2c3c('0x3f')]=[{'all':!![]}];}_0x33b727=_[_0x2c3c('0x3d')]({},_0x33b727,_0x1a9224['options']);return db[_0x2c3c('0x2a')][_0x2c3c('0x44')](_0x33b727)[_0x2c3c('0x1f')](handleEntityNotFound(_0x73577b,null))['then'](respondWithResult(_0x73577b,null))['catch'](handleError(_0x73577b,null));};exports[_0x2c3c('0x45')]=function(_0x419b35,_0x6054d0){return db[_0x2c3c('0x2a')][_0x2c3c('0x45')](_0x419b35['body'],{})['then'](function(_0x1d5576){var _0x46705d=_0x419b35[_0x2c3c('0x46')][_0x2c3c('0x21')]({'plain':!![]});if(!_0x46705d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46705d['role']===_0x2c3c('0x46')){var _0x419ce8=_0x1d5576[_0x2c3c('0x21')]({'plain':!![]});var _0x41ed51='ExtractedReports';return db['UserProfileSection'][_0x2c3c('0x44')]({'where':{'name':_0x41ed51,'userProfileId':_0x46705d[_0x2c3c('0x47')]},'raw':!![]})[_0x2c3c('0x1f')](function(_0x9effef){if(_0x9effef&&_0x9effef[_0x2c3c('0x48')]===0x0){return db[_0x2c3c('0x23')]['create']({'name':_0x419ce8[_0x2c3c('0x26')],'resourceId':_0x419ce8['id'],'type':_0x9effef[_0x2c3c('0x26')],'sectionId':_0x9effef['id']},{})[_0x2c3c('0x1f')](function(){return _0x1d5576;});}else{return _0x1d5576;}})[_0x2c3c('0x41')](function(_0x396935){logger[_0x2c3c('0x24')](_0x2c3c('0x49'),_0x396935);throw _0x396935;});}return _0x1d5576;})[_0x2c3c('0x1f')](respondWithResult(_0x6054d0,0xc9))['catch'](handleError(_0x6054d0,null));};exports[_0x2c3c('0x1e')]=function(_0x40a8c5,_0x1c6573){if(_0x40a8c5[_0x2c3c('0x4a')]['id']){delete _0x40a8c5['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x40a8c5[_0x2c3c('0x4b')]['id']}})[_0x2c3c('0x1f')](handleEntityNotFound(_0x1c6573,null))[_0x2c3c('0x1f')](saveUpdates(_0x40a8c5[_0x2c3c('0x4a')],null))[_0x2c3c('0x1f')](respondWithResult(_0x1c6573,null))[_0x2c3c('0x41')](handleError(_0x1c6573,null));};exports['destroy']=function(_0x2ed858,_0x484731){return db[_0x2c3c('0x2a')]['find']({'where':{'id':_0x2ed858[_0x2c3c('0x4b')]['id']}})[_0x2c3c('0x1f')](handleEntityNotFound(_0x484731,null))['then'](removeEntity(_0x484731,null))['catch'](handleError(_0x484731,null));};exports[_0x2c3c('0x4c')]=function(_0x367837,_0x4af739,_0x1b51e7){return db['AnalyticExtractedReport'][_0x2c3c('0x44')]({'where':{'id':_0x367837[_0x2c3c('0x4b')]['id']},'attributes':[_0x2c3c('0x26'),_0x2c3c('0x4d'),_0x2c3c('0x4e'),'output'],'raw':!![]})[_0x2c3c('0x1f')](handleEntityNotFound(_0x4af739,null))[_0x2c3c('0x1f')](function(_0x2912ac){if(_0x2912ac){if(!fs[_0x2c3c('0x4f')](path[_0x2c3c('0x50')](config[_0x2c3c('0x51')],_0x2c3c('0x52'),_0x2912ac['savename']))){throw new db[(_0x2c3c('0x53'))]['ValidationError'](_0x2c3c('0x54'));}if(_0x367837[_0x2c3c('0x2f')][_0x2c3c('0x55')]){return _0x4af739[_0x2c3c('0x15')](0xc8);}return _0x4af739[_0x2c3c('0x4c')](path[_0x2c3c('0x50')](config[_0x2c3c('0x51')],_0x2c3c('0x52'),_0x2912ac[_0x2c3c('0x4e')]),util['format'](_0x2c3c('0x56'),_0x2912ac['basename']||_0x2912ac['name'],_0x2912ac[_0x2c3c('0x57')][_0x2c3c('0x58')]()));}})[_0x2c3c('0x41')](handleError(_0x4af739,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 6f3d023..3ba96b7 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 _0x9baf=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x31e387,_0x211c57){var _0x159e7e=function(_0x2763ec){while(--_0x2763ec){_0x31e387['push'](_0x31e387['shift']());}};_0x159e7e(++_0x211c57);}(_0x9baf,0x18b));var _0xf9ba=function(_0x49bc4f,_0x44adb1){_0x49bc4f=_0x49bc4f-0x0;var _0x4ff1a5=_0x9baf[_0x49bc4f];return _0x4ff1a5;};'use strict';var _=require(_0xf9ba('0x0'));var util=require(_0xf9ba('0x1'));var logger=require(_0xf9ba('0x2'))(_0xf9ba('0x3'));var moment=require(_0xf9ba('0x4'));var BPromise=require('bluebird');var rp=require(_0xf9ba('0x5'));var fs=require('fs');var path=require(_0xf9ba('0x6'));var rimraf=require(_0xf9ba('0x7'));var config=require(_0xf9ba('0x8'));var attributes=require(_0xf9ba('0x9'));module[_0xf9ba('0xa')]=function(_0x4beaf7,_0x44142b){return _0x4beaf7[_0xf9ba('0xb')](_0xf9ba('0xc'),attributes,{'tableName':_0xf9ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde45=['moment','bluebird','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api'];(function(_0x25d4c6,_0x2e4c65){var _0x24b07c=function(_0x571ed0){while(--_0x571ed0){_0x25d4c6['push'](_0x25d4c6['shift']());}};_0x24b07c(++_0x2e4c65);}(_0xde45,0x131));var _0x5de4=function(_0x395361,_0x277071){_0x395361=_0x395361-0x0;var _0x327f71=_0xde45[_0x395361];return _0x327f71;};'use strict';var _=require(_0x5de4('0x0'));var util=require('util');var logger=require(_0x5de4('0x1'))(_0x5de4('0x2'));var moment=require(_0x5de4('0x3'));var BPromise=require(_0x5de4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5de4('0x5'));var rimraf=require(_0x5de4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5de4('0x7'));module[_0x5de4('0x8')]=function(_0xa26a5b,_0x5ca968){return _0xa26a5b[_0x5de4('0x9')](_0x5de4('0xa'),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 52ffd2a..bd6c041 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 _0xc898=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd7117d,_0x39df47){var _0x4f0e04=function(_0x25999f){while(--_0x25999f){_0xd7117d['push'](_0xd7117d['shift']());}};_0x4f0e04(++_0x39df47);}(_0xc898,0xa2));var _0x8c89=function(_0x37f08d,_0x3aae9d){_0x37f08d=_0x37f08d-0x0;var _0x3432a5=_0xc898[_0x37f08d];return _0x3432a5;};'use strict';var _=require(_0x8c89('0x0'));var util=require(_0x8c89('0x1'));var moment=require(_0x8c89('0x2'));var BPromise=require(_0x8c89('0x3'));var rs=require(_0x8c89('0x4'));var fs=require('fs');var Redis=require(_0x8c89('0x5'));var db=require(_0x8c89('0x6'))['db'];var utils=require(_0x8c89('0x7'));var logger=require(_0x8c89('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c89('0x9'));var client=jayson['client'][_0x8c89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb28c,_0x239c7f,_0x40c352){return new BPromise(function(_0x2d36f8,_0x532755){return client['request'](_0x5eb28c,_0x40c352)['then'](function(_0x1c261f){logger[_0x8c89('0xb')](_0x8c89('0xc'),_0x239c7f,'request\x20sent');logger[_0x8c89('0xd')](_0x8c89('0xe'),_0x239c7f,_0x8c89('0xf'),JSON[_0x8c89('0x10')](_0x1c261f));if(_0x1c261f[_0x8c89('0x11')]){if(_0x1c261f[_0x8c89('0x11')]['code']===0x1f4){logger[_0x8c89('0x11')](_0x8c89('0xc'),_0x239c7f,_0x1c261f[_0x8c89('0x11')]['message']);return _0x532755(_0x1c261f[_0x8c89('0x11')]['message']);}logger[_0x8c89('0x11')](_0x8c89('0xc'),_0x239c7f,_0x1c261f[_0x8c89('0x11')]['message']);return _0x2d36f8(_0x1c261f['error'][_0x8c89('0x12')]);}else{logger[_0x8c89('0xb')](_0x8c89('0xc'),_0x239c7f,_0x8c89('0xf'));_0x2d36f8(_0x1c261f['result'][_0x8c89('0x12')]);}})[_0x8c89('0x13')](function(_0x291fd8){logger[_0x8c89('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x239c7f,_0x291fd8);_0x532755(_0x291fd8);});});} \ No newline at end of file +var _0xacac=['../../config/logger','client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31f538,_0x110cb9){var _0x399533=function(_0x13d66e){while(--_0x13d66e){_0x31f538['push'](_0x31f538['shift']());}};_0x399533(++_0x110cb9);}(_0xacac,0xdd));var _0xcaca=function(_0x33b020,_0x1d9776){_0x33b020=_0x33b020-0x0;var _0x4ba3f5=_0xacac[_0x33b020];return _0x4ba3f5;};'use strict';var _=require(_0xcaca('0x0'));var util=require(_0xcaca('0x1'));var moment=require(_0xcaca('0x2'));var BPromise=require('bluebird');var rs=require(_0xcaca('0x3'));var fs=require('fs');var Redis=require(_0xcaca('0x4'));var db=require(_0xcaca('0x5'))['db'];var utils=require(_0xcaca('0x6'));var logger=require(_0xcaca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcaca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300f50,_0x1815b7,_0x4bc239){return new BPromise(function(_0x4f5844,_0xb1846){return client['request'](_0x300f50,_0x4bc239)[_0xcaca('0x9')](function(_0x518038){logger[_0xcaca('0xa')](_0xcaca('0xb'),_0x1815b7,_0xcaca('0xc'));logger['debug'](_0xcaca('0xd'),_0x1815b7,_0xcaca('0xc'),JSON['stringify'](_0x518038));if(_0x518038['error']){if(_0x518038[_0xcaca('0xe')][_0xcaca('0xf')]===0x1f4){logger[_0xcaca('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1815b7,_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);return _0xb1846(_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);}logger['error'](_0xcaca('0xb'),_0x1815b7,_0x518038[_0xcaca('0xe')]['message']);return _0x4f5844(_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);}else{logger[_0xcaca('0xa')](_0xcaca('0xb'),_0x1815b7,'request\x20sent');_0x4f5844(_0x518038[_0xcaca('0x11')][_0xcaca('0x10')]);}})[_0xcaca('0x12')](function(_0x2e618b){logger['error'](_0xcaca('0xb'),_0x1815b7,_0x2e618b);_0xb1846(_0x2e618b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ef90f39..cf0c7f3 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 _0x87a2=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x1c0f5e,_0x47555b){var _0x256b90=function(_0xd129d3){while(--_0xd129d3){_0x1c0f5e['push'](_0x1c0f5e['shift']());}};_0x256b90(++_0x47555b);}(_0x87a2,0x113));var _0x287a=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x87a2[_0x46401e];return _0x447cba;};'use strict';var multer=require('multer');var util=require(_0x287a('0x0'));var path=require(_0x287a('0x1'));var timeout=require('connect-timeout');var express=require(_0x287a('0x2'));var router=express[_0x287a('0x3')]();var auth=require(_0x287a('0x4'));var interaction=require(_0x287a('0x5'));var config=require(_0x287a('0x6'));var controller=require(_0x287a('0x7'));router[_0x287a('0x8')]('/',auth[_0x287a('0x9')](),controller[_0x287a('0xa')]);router[_0x287a('0x8')](_0x287a('0xb'),auth['isAuthenticated'](),controller[_0x287a('0xc')]);router[_0x287a('0x8')](_0x287a('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x287a('0xe')]('/',auth[_0x287a('0x9')](),controller[_0x287a('0xf')]);router[_0x287a('0x10')](_0x287a('0xb'),auth[_0x287a('0x9')](),controller[_0x287a('0x11')]);router['delete'](_0x287a('0xb'),auth[_0x287a('0x9')](),controller[_0x287a('0x12')]);module[_0x287a('0x13')]=router; \ No newline at end of file +var _0x7008=['express','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','put','update','delete','exports','path'];(function(_0x16a9d9,_0x1fc64b){var _0x22a786=function(_0x3ef4d7){while(--_0x3ef4d7){_0x16a9d9['push'](_0x16a9d9['shift']());}};_0x22a786(++_0x1fc64b);}(_0x7008,0x1ec));var _0x8700=function(_0x3625bb,_0x58af09){_0x3625bb=_0x3625bb-0x0;var _0x225dfa=_0x7008[_0x3625bb];return _0x225dfa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8700('0x0'));var timeout=require('connect-timeout');var express=require(_0x8700('0x1'));var router=express['Router']();var auth=require(_0x8700('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8700('0x3'));var controller=require(_0x8700('0x4'));router['get']('/',auth[_0x8700('0x5')](),controller[_0x8700('0x6')]);router[_0x8700('0x7')](_0x8700('0x8'),auth['isAuthenticated'](),controller[_0x8700('0x9')]);router[_0x8700('0x7')](_0x8700('0xa'),auth[_0x8700('0x5')](),controller[_0x8700('0xb')]);router[_0x8700('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8700('0xd')](_0x8700('0x8'),auth[_0x8700('0x5')](),controller[_0x8700('0xe')]);router[_0x8700('0xf')](_0x8700('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x8700('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4e7c3cc..30d9880 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x120a99,_0x29e4ca){var _0x1a5701=function(_0x1b2b37){while(--_0x1b2b37){_0x120a99['push'](_0x120a99['shift']());}};_0x1a5701(++_0x29e4ca);}(_0xe14b,0x93));var _0xbe14=function(_0x1eca71,_0x4326f7){_0x1eca71=_0x1eca71-0x0;var _0x4cbdfd=_0xe14b[_0x1eca71];return _0x4cbdfd;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x122c5c,_0x3f9ee6){var _0xb9e7f=function(_0x7c219){while(--_0x7c219){_0x122c5c['push'](_0x122c5c['shift']());}};_0xb9e7f(++_0x3f9ee6);}(_0x7a54,0x106));var _0x47a5=function(_0x399c89,_0x5267ab){_0x399c89=_0x399c89-0x0;var _0x3eee38=_0x7a54[_0x399c89];return _0x3eee38;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('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 e8ba306..4459617 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 _0x8d55=['filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','update','then','destroy','end','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d55,0x6a));var _0x58d5=function(_0x480e3d,_0x5a3f9c){_0x480e3d=_0x480e3d-0x0;var _0x4eb9e4=_0x8d55[_0x480e3d];return _0x4eb9e4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x58d5('0x0'));var jsonpatch=require(_0x58d5('0x1'));var rp=require('request-promise');var moment=require(_0x58d5('0x2'));var BPromise=require(_0x58d5('0x3'));var Mustache=require(_0x58d5('0x4'));var util=require(_0x58d5('0x5'));var path=require(_0x58d5('0x6'));var sox=require(_0x58d5('0x7'));var csv=require(_0x58d5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58d5('0x9'));var squel=require(_0x58d5('0xa'));var crypto=require(_0x58d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x58d5('0xc'));var toCsv=require(_0x58d5('0x8'));var querystring=require(_0x58d5('0xd'));var Papa=require(_0x58d5('0xe'));var Redis=require(_0x58d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x58d5('0x10'));var as=require(_0x58d5('0x11'));var hardwareService=require(_0x58d5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x58d5('0x13'));var config=require(_0x58d5('0x14'));var licenseUtil=require(_0x58d5('0x15'));var db=require(_0x58d5('0x16'))['db'];function respondWithStatusCode(_0x58b735,_0x772bc7){_0x772bc7=_0x772bc7||0xcc;return function(_0x2dd847){if(_0x2dd847){return _0x58b735[_0x58d5('0x17')](_0x772bc7);}return _0x58b735[_0x58d5('0x18')](_0x772bc7)['end']();};}function respondWithResult(_0x406982,_0x5a4c33){_0x5a4c33=_0x5a4c33||0xc8;return function(_0x26748d){if(_0x26748d){return _0x406982['status'](_0x5a4c33)['json'](_0x26748d);}};}function respondWithFilteredResult(_0x56e4b2,_0x456c3d){return function(_0x3d84d0){if(_0x3d84d0){var _0x118d93=_0x3d84d0[_0x58d5('0x19')],_0x21939e=_0x456c3d['offset'],_0x2e8266=_0x456c3d[_0x58d5('0x1a')]+_0x456c3d['limit'],_0x38f7fd;if(_0x2e8266>=_0x118d93){_0x2e8266=_0x118d93;_0x38f7fd=0xc8;}else{_0x38f7fd=0xce;}_0x56e4b2['status'](_0x38f7fd);return _0x56e4b2[_0x58d5('0x1b')]('Content-Range',_0x21939e+'-'+_0x2e8266+'/'+_0x118d93)['json'](_0x3d84d0);}return null;};}function patchUpdates(_0x4d1900){return function(_0x4fca07){try{jsonpatch[_0x58d5('0x1c')](_0x4fca07,_0x4d1900,!![]);}catch(_0x18033f){return BPromise[_0x58d5('0x1d')](_0x18033f);}return _0x4fca07['save']();};}function saveUpdates(_0xf7622,_0x4de161){return function(_0x540115){if(_0x540115){return _0x540115[_0x58d5('0x1e')](_0xf7622)[_0x58d5('0x1f')](function(_0x439c3c){return _0x439c3c;});}return null;};}function removeEntity(_0x5f1471,_0x261363){return function(_0x448840){if(_0x448840){return _0x448840[_0x58d5('0x20')]()[_0x58d5('0x1f')](function(){_0x5f1471[_0x58d5('0x18')](0xcc)[_0x58d5('0x21')]();});}};}function handleEntityNotFound(_0x179e9f,_0x1c23c7){return function(_0xd44880){if(!_0xd44880){_0x179e9f[_0x58d5('0x17')](0x194);}return _0xd44880;};}function handleError(_0x29070a,_0x49fbb1){_0x49fbb1=_0x49fbb1||0x1f4;return function(_0x57c825){logger['error'](_0x57c825[_0x58d5('0x22')]);if(_0x57c825[_0x58d5('0x23')]){delete _0x57c825[_0x58d5('0x23')];}_0x29070a[_0x58d5('0x18')](_0x49fbb1)[_0x58d5('0x24')](_0x57c825);};}exports['index']=function(_0x499174,_0x8748af){var _0x39d27e={},_0x14698d={},_0x57daf1={'count':0x0,'rows':[]};var _0x44cfa4=_[_0x58d5('0x25')](db[_0x58d5('0x26')][_0x58d5('0x27')],function(_0x4ea9a7){return{'name':_0x4ea9a7[_0x58d5('0x28')],'type':_0x4ea9a7[_0x58d5('0x29')]['key']};});_0x14698d[_0x58d5('0x2a')]=_[_0x58d5('0x25')](_0x44cfa4,_0x58d5('0x23'));_0x14698d['query']=_[_0x58d5('0x2b')](_0x499174['query']);_0x14698d[_0x58d5('0x2c')]=_[_0x58d5('0x2d')](_0x14698d['model'],_0x14698d[_0x58d5('0x2e')]);_0x39d27e['attributes']=_[_0x58d5('0x2d')](_0x14698d[_0x58d5('0x2a')],qs[_0x58d5('0x2f')](_0x499174['query']['fields']));_0x39d27e[_0x58d5('0x30')]=_0x39d27e[_0x58d5('0x30')][_0x58d5('0x31')]?_0x39d27e['attributes']:_0x14698d[_0x58d5('0x2a')];if(!_0x499174[_0x58d5('0x2e')][_0x58d5('0x32')](_0x58d5('0x33'))){_0x39d27e[_0x58d5('0x34')]=qs['limit'](_0x499174[_0x58d5('0x2e')][_0x58d5('0x34')]);_0x39d27e['offset']=qs[_0x58d5('0x1a')](_0x499174[_0x58d5('0x2e')]['offset']);}_0x39d27e['order']=qs[_0x58d5('0x35')](_0x499174[_0x58d5('0x2e')][_0x58d5('0x35')]);_0x39d27e[_0x58d5('0x36')]=qs[_0x58d5('0x2c')](_[_0x58d5('0x37')](_0x499174['query'],_0x14698d[_0x58d5('0x2c')]),_0x44cfa4);if(_0x499174[_0x58d5('0x2e')]['filter']){_0x39d27e[_0x58d5('0x36')]=_[_0x58d5('0x38')](_0x39d27e[_0x58d5('0x36')],{'$or':_[_0x58d5('0x25')](_0x44cfa4,function(_0x55a65e){if(_0x55a65e[_0x58d5('0x29')]!==_0x58d5('0x39')){var _0x36f7cd={};_0x36f7cd[_0x55a65e[_0x58d5('0x23')]]={'$like':'%'+_0x499174['query'][_0x58d5('0x3a')]+'%'};return _0x36f7cd;}})});}_0x39d27e=_[_0x58d5('0x38')]({},_0x39d27e,_0x499174['options']);var _0x389072={'where':_0x39d27e[_0x58d5('0x36')]};return db[_0x58d5('0x26')]['count'](_0x389072)[_0x58d5('0x1f')](function(_0x3fc00a){_0x57daf1[_0x58d5('0x19')]=_0x3fc00a;if(_0x499174[_0x58d5('0x2e')][_0x58d5('0x3b')]){_0x39d27e[_0x58d5('0x3c')]=[{'all':!![]}];}return db[_0x58d5('0x26')][_0x58d5('0x3d')](_0x39d27e);})[_0x58d5('0x1f')](function(_0x4a65d4){_0x57daf1[_0x58d5('0x3e')]=_0x4a65d4;return _0x57daf1;})['then'](respondWithFilteredResult(_0x8748af,_0x39d27e))[_0x58d5('0x3f')](handleError(_0x8748af,null));};exports[_0x58d5('0x40')]=function(_0x2f4f38,_0x57c79e){var _0x228647={'raw':![],'where':{'id':_0x2f4f38[_0x58d5('0x41')]['id']}},_0x2102c1={};_0x2102c1[_0x58d5('0x2a')]=_[_0x58d5('0x2b')](db[_0x58d5('0x26')]['rawAttributes']);_0x2102c1['query']=_[_0x58d5('0x2b')](_0x2f4f38[_0x58d5('0x2e')]);_0x2102c1[_0x58d5('0x2c')]=_[_0x58d5('0x2d')](_0x2102c1[_0x58d5('0x2a')],_0x2102c1[_0x58d5('0x2e')]);_0x228647[_0x58d5('0x30')]=_['intersection'](_0x2102c1[_0x58d5('0x2a')],qs[_0x58d5('0x2f')](_0x2f4f38['query'][_0x58d5('0x2f')]));_0x228647[_0x58d5('0x30')]=_0x228647[_0x58d5('0x30')][_0x58d5('0x31')]?_0x228647[_0x58d5('0x30')]:_0x2102c1[_0x58d5('0x2a')];if(_0x2f4f38[_0x58d5('0x2e')][_0x58d5('0x3b')]){_0x228647[_0x58d5('0x3c')]=[{'all':!![]}];}_0x228647=_[_0x58d5('0x38')]({},_0x228647,_0x2f4f38['options']);return db[_0x58d5('0x26')][_0x58d5('0x42')](_0x228647)[_0x58d5('0x1f')](handleEntityNotFound(_0x57c79e,null))[_0x58d5('0x1f')](respondWithResult(_0x57c79e,null))[_0x58d5('0x3f')](handleError(_0x57c79e,null));};exports[_0x58d5('0x43')]=function(_0x413e43,_0x443e0c){return db[_0x58d5('0x26')][_0x58d5('0x43')](_0x413e43[_0x58d5('0x44')],{})[_0x58d5('0x1f')](respondWithResult(_0x443e0c,0xc9))['catch'](handleError(_0x443e0c,null));};exports['bulkCreate']=function(_0x28f9de,_0x388023){return db['AnalyticFieldReport'][_0x58d5('0x45')](_0x28f9de[_0x58d5('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x388023,0xc9))[_0x58d5('0x3f')](handleError(_0x388023,null));};exports['update']=function(_0x28121d,_0x24c670){if(_0x28121d[_0x58d5('0x44')]['id']){delete _0x28121d[_0x58d5('0x44')]['id'];}return db[_0x58d5('0x26')][_0x58d5('0x42')]({'where':{'id':_0x28121d['params']['id']}})['then'](handleEntityNotFound(_0x24c670,null))[_0x58d5('0x1f')](saveUpdates(_0x28121d[_0x58d5('0x44')],null))[_0x58d5('0x1f')](respondWithResult(_0x24c670,null))[_0x58d5('0x3f')](handleError(_0x24c670,null));};exports[_0x58d5('0x20')]=function(_0x300363,_0xab7ba8){return db['AnalyticFieldReport']['find']({'where':{'id':_0x300363[_0x58d5('0x41')]['id']}})[_0x58d5('0x1f')](handleEntityNotFound(_0xab7ba8,null))[_0x58d5('0x1f')](removeEntity(_0xab7ba8,null))[_0x58d5('0x3f')](handleError(_0xab7ba8,null));};exports[_0x58d5('0x46')]=function(_0x35c5d9,_0x2e75e4){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x35c5d9['query'][_0x58d5('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x58d5('0x1f')](respondWithResult(_0x2e75e4,0xcc))[_0x58d5('0x3f')](handleError(_0x2e75e4,null));};exports[_0x58d5('0x48')]=function(_0xe1e1b0,_0x256f34,_0x268983){return db[_0x58d5('0x49')]['findOne']({'where':{'id':_0xe1e1b0[_0x58d5('0x41')]['id']}})[_0x58d5('0x1f')](handleEntityNotFound(_0x256f34,null))[_0x58d5('0x1f')](function(_0x3a84f8){if(_0x3a84f8){return db[_0x58d5('0x4a')]['transaction'](function(_0x455c00){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xe1e1b0['params']['id']},'transaction':_0x455c00})[_0x58d5('0x1f')](function(_0x43e8f6){var _0x3d8544=_[_0x58d5('0x25')](_0xe1e1b0[_0x58d5('0x44')],function(_0x54e6e1){delete _0x54e6e1['id'];_0x54e6e1['CustomReportId']=_0xe1e1b0['params']['id'];return _0x54e6e1;});return db[_0x58d5('0x26')][_0x58d5('0x45')](_0x3d8544,{'transaction':_0x455c00});});})[_0x58d5('0x1f')](function(){return db[_0x58d5('0x26')][_0x58d5('0x3d')]({'where':{'CustomReportId':_0xe1e1b0[_0x58d5('0x41')]['id']}});});}})['then'](respondWithResult(_0x256f34,null))['catch'](handleError(_0x256f34,null));}; \ No newline at end of file +var _0xc5b4=['update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','query','intersection','attributes','model','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save'];(function(_0x473192,_0x2c416d){var _0x4aed1f=function(_0x4741bf){while(--_0x4741bf){_0x473192['push'](_0x473192['shift']());}};_0x4aed1f(++_0x2c416d);}(_0xc5b4,0x165));var _0x4c5b=function(_0x5e5241,_0x36a826){_0x5e5241=_0x5e5241-0x0;var _0x45c70c=_0xc5b4[_0x5e5241];return _0x45c70c;};'use strict';var pdf=require(_0x4c5b('0x0'));var emlformat=require(_0x4c5b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5b('0x3'));var moment=require(_0x4c5b('0x4'));var BPromise=require(_0x4c5b('0x5'));var Mustache=require(_0x4c5b('0x6'));var util=require(_0x4c5b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4c5b('0x8'));var ejs=require(_0x4c5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c5b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4c5b('0x8'));var querystring=require(_0x4c5b('0xb'));var Papa=require(_0x4c5b('0xc'));var Redis=require('ioredis');var authService=require(_0x4c5b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4c5b('0xe'));var hardwareService=require(_0x4c5b('0xf'));var logger=require(_0x4c5b('0x10'))(_0x4c5b('0x11'));var utils=require(_0x4c5b('0x12'));var config=require(_0x4c5b('0x13'));var licenseUtil=require(_0x4c5b('0x14'));var db=require(_0x4c5b('0x15'))['db'];function respondWithStatusCode(_0x4a3ed8,_0x4ba244){_0x4ba244=_0x4ba244||0xcc;return function(_0x8c3986){if(_0x8c3986){return _0x4a3ed8[_0x4c5b('0x16')](_0x4ba244);}return _0x4a3ed8[_0x4c5b('0x17')](_0x4ba244)[_0x4c5b('0x18')]();};}function respondWithResult(_0x461d6a,_0x7b1546){_0x7b1546=_0x7b1546||0xc8;return function(_0x35e96d){if(_0x35e96d){return _0x461d6a[_0x4c5b('0x17')](_0x7b1546)['json'](_0x35e96d);}};}function respondWithFilteredResult(_0x2ba9d0,_0x4c6522){return function(_0x122baa){if(_0x122baa){var _0x2c5ce9=_0x122baa[_0x4c5b('0x19')],_0x3f1ed9=_0x4c6522[_0x4c5b('0x1a')],_0x3cccb2=_0x4c6522[_0x4c5b('0x1a')]+_0x4c6522[_0x4c5b('0x1b')],_0x28ac34;if(_0x3cccb2>=_0x2c5ce9){_0x3cccb2=_0x2c5ce9;_0x28ac34=0xc8;}else{_0x28ac34=0xce;}_0x2ba9d0[_0x4c5b('0x17')](_0x28ac34);return _0x2ba9d0[_0x4c5b('0x1c')](_0x4c5b('0x1d'),_0x3f1ed9+'-'+_0x3cccb2+'/'+_0x2c5ce9)[_0x4c5b('0x1e')](_0x122baa);}return null;};}function patchUpdates(_0x46466c){return function(_0x34c45c){try{jsonpatch[_0x4c5b('0x1f')](_0x34c45c,_0x46466c,!![]);}catch(_0x566ba1){return BPromise['reject'](_0x566ba1);}return _0x34c45c[_0x4c5b('0x20')]();};}function saveUpdates(_0x9d9050,_0x33f332){return function(_0x1e472e){if(_0x1e472e){return _0x1e472e[_0x4c5b('0x21')](_0x9d9050)[_0x4c5b('0x22')](function(_0x43fcac){return _0x43fcac;});}return null;};}function removeEntity(_0x5a2d59,_0x268767){return function(_0x1618a5){if(_0x1618a5){return _0x1618a5['destroy']()['then'](function(){_0x5a2d59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f358b,_0x436c8e){return function(_0x4af3ff){if(!_0x4af3ff){_0x4f358b[_0x4c5b('0x16')](0x194);}return _0x4af3ff;};}function handleError(_0x1704d2,_0x519af9){_0x519af9=_0x519af9||0x1f4;return function(_0x181a2b){logger[_0x4c5b('0x23')](_0x181a2b[_0x4c5b('0x24')]);if(_0x181a2b[_0x4c5b('0x25')]){delete _0x181a2b['name'];}_0x1704d2[_0x4c5b('0x17')](_0x519af9)[_0x4c5b('0x26')](_0x181a2b);};}exports[_0x4c5b('0x27')]=function(_0x38ea70,_0x1f95f6){var _0x2d3975={},_0xbb6cfe={},_0x30ac06={'count':0x0,'rows':[]};var _0x17b62a=_[_0x4c5b('0x28')](db[_0x4c5b('0x29')][_0x4c5b('0x2a')],function(_0x2aec4b){return{'name':_0x2aec4b['fieldName'],'type':_0x2aec4b[_0x4c5b('0x2b')][_0x4c5b('0x2c')]};});_0xbb6cfe['model']=_['map'](_0x17b62a,_0x4c5b('0x25'));_0xbb6cfe[_0x4c5b('0x2d')]=_['keys'](_0x38ea70[_0x4c5b('0x2d')]);_0xbb6cfe['filters']=_[_0x4c5b('0x2e')](_0xbb6cfe['model'],_0xbb6cfe[_0x4c5b('0x2d')]);_0x2d3975[_0x4c5b('0x2f')]=_[_0x4c5b('0x2e')](_0xbb6cfe[_0x4c5b('0x30')],qs[_0x4c5b('0x31')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x31')]));_0x2d3975[_0x4c5b('0x2f')]=_0x2d3975[_0x4c5b('0x2f')][_0x4c5b('0x32')]?_0x2d3975['attributes']:_0xbb6cfe[_0x4c5b('0x30')];if(!_0x38ea70['query']['hasOwnProperty']('nolimit')){_0x2d3975['limit']=qs[_0x4c5b('0x1b')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x1b')]);_0x2d3975[_0x4c5b('0x1a')]=qs[_0x4c5b('0x1a')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x1a')]);}_0x2d3975[_0x4c5b('0x33')]=qs[_0x4c5b('0x34')](_0x38ea70[_0x4c5b('0x2d')]['sort']);_0x2d3975[_0x4c5b('0x35')]=qs['filters'](_['pick'](_0x38ea70['query'],_0xbb6cfe[_0x4c5b('0x36')]),_0x17b62a);if(_0x38ea70['query']['filter']){_0x2d3975['where']=_[_0x4c5b('0x37')](_0x2d3975[_0x4c5b('0x35')],{'$or':_[_0x4c5b('0x28')](_0x17b62a,function(_0x144e16){if(_0x144e16[_0x4c5b('0x2b')]!==_0x4c5b('0x38')){var _0x852211={};_0x852211[_0x144e16[_0x4c5b('0x25')]]={'$like':'%'+_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x39')]+'%'};return _0x852211;}})});}_0x2d3975=_[_0x4c5b('0x37')]({},_0x2d3975,_0x38ea70['options']);var _0x3aa537={'where':_0x2d3975['where']};return db[_0x4c5b('0x29')][_0x4c5b('0x19')](_0x3aa537)[_0x4c5b('0x22')](function(_0x1ab027){_0x30ac06[_0x4c5b('0x19')]=_0x1ab027;if(_0x38ea70['query'][_0x4c5b('0x3a')]){_0x2d3975[_0x4c5b('0x3b')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4c5b('0x3c')](_0x2d3975);})['then'](function(_0x35ed7d){_0x30ac06[_0x4c5b('0x3d')]=_0x35ed7d;return _0x30ac06;})['then'](respondWithFilteredResult(_0x1f95f6,_0x2d3975))[_0x4c5b('0x3e')](handleError(_0x1f95f6,null));};exports[_0x4c5b('0x3f')]=function(_0xcd807d,_0x57a376){var _0x1694af={'raw':![],'where':{'id':_0xcd807d[_0x4c5b('0x40')]['id']}},_0x394766={};_0x394766['model']=_[_0x4c5b('0x41')](db[_0x4c5b('0x29')][_0x4c5b('0x2a')]);_0x394766['query']=_['keys'](_0xcd807d[_0x4c5b('0x2d')]);_0x394766[_0x4c5b('0x36')]=_[_0x4c5b('0x2e')](_0x394766['model'],_0x394766['query']);_0x1694af[_0x4c5b('0x2f')]=_['intersection'](_0x394766[_0x4c5b('0x30')],qs[_0x4c5b('0x31')](_0xcd807d[_0x4c5b('0x2d')]['fields']));_0x1694af['attributes']=_0x1694af[_0x4c5b('0x2f')][_0x4c5b('0x32')]?_0x1694af[_0x4c5b('0x2f')]:_0x394766[_0x4c5b('0x30')];if(_0xcd807d[_0x4c5b('0x2d')]['includeAll']){_0x1694af['include']=[{'all':!![]}];}_0x1694af=_[_0x4c5b('0x37')]({},_0x1694af,_0xcd807d[_0x4c5b('0x42')]);return db[_0x4c5b('0x29')][_0x4c5b('0x43')](_0x1694af)[_0x4c5b('0x22')](handleEntityNotFound(_0x57a376,null))['then'](respondWithResult(_0x57a376,null))[_0x4c5b('0x3e')](handleError(_0x57a376,null));};exports['create']=function(_0x487954,_0x528492){return db[_0x4c5b('0x29')]['create'](_0x487954[_0x4c5b('0x44')],{})[_0x4c5b('0x22')](respondWithResult(_0x528492,0xc9))[_0x4c5b('0x3e')](handleError(_0x528492,null));};exports[_0x4c5b('0x45')]=function(_0xbb4f6c,_0x4d7c73){return db[_0x4c5b('0x29')][_0x4c5b('0x45')](_0xbb4f6c['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4d7c73,0xc9))[_0x4c5b('0x3e')](handleError(_0x4d7c73,null));};exports[_0x4c5b('0x21')]=function(_0x772203,_0x6e8127){if(_0x772203[_0x4c5b('0x44')]['id']){delete _0x772203[_0x4c5b('0x44')]['id'];}return db[_0x4c5b('0x29')]['find']({'where':{'id':_0x772203[_0x4c5b('0x40')]['id']}})['then'](handleEntityNotFound(_0x6e8127,null))[_0x4c5b('0x22')](saveUpdates(_0x772203['body'],null))[_0x4c5b('0x22')](respondWithResult(_0x6e8127,null))['catch'](handleError(_0x6e8127,null));};exports[_0x4c5b('0x46')]=function(_0x27b508,_0x5a8651){return db[_0x4c5b('0x29')][_0x4c5b('0x43')]({'where':{'id':_0x27b508[_0x4c5b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a8651,null))[_0x4c5b('0x22')](removeEntity(_0x5a8651,null))['catch'](handleError(_0x5a8651,null));};exports[_0x4c5b('0x47')]=function(_0x237dbf,_0x4359ce){return db[_0x4c5b('0x29')][_0x4c5b('0x46')]({'where':{'id':_0x237dbf['query'][_0x4c5b('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x4c5b('0x22')](respondWithResult(_0x4359ce,0xcc))[_0x4c5b('0x3e')](handleError(_0x4359ce,null));};exports[_0x4c5b('0x49')]=function(_0x32a9e0,_0x55ed41,_0x3cc95c){return db[_0x4c5b('0x4a')]['findOne']({'where':{'id':_0x32a9e0[_0x4c5b('0x40')]['id']}})[_0x4c5b('0x22')](handleEntityNotFound(_0x55ed41,null))[_0x4c5b('0x22')](function(_0x60521f){if(_0x60521f){return db[_0x4c5b('0x4b')][_0x4c5b('0x4c')](function(_0x378a3c){return db[_0x4c5b('0x29')][_0x4c5b('0x46')]({'where':{'CustomReportId':_0x32a9e0[_0x4c5b('0x40')]['id']},'transaction':_0x378a3c})[_0x4c5b('0x22')](function(_0x29d97d){var _0x5895ca=_[_0x4c5b('0x28')](_0x32a9e0[_0x4c5b('0x44')],function(_0x3c91d0){delete _0x3c91d0['id'];_0x3c91d0[_0x4c5b('0x4d')]=_0x32a9e0['params']['id'];return _0x3c91d0;});return db['AnalyticFieldReport'][_0x4c5b('0x45')](_0x5895ca,{'transaction':_0x378a3c});});})[_0x4c5b('0x22')](function(){return db[_0x4c5b('0x29')][_0x4c5b('0x3c')]({'where':{'CustomReportId':_0x32a9e0[_0x4c5b('0x40')]['id']}});});}})[_0x4c5b('0x22')](respondWithResult(_0x55ed41,null))[_0x4c5b('0x3e')](handleError(_0x55ed41,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 29c090c..ec15ecc 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 _0x37c0=['api','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x37c0,0xda));var _0x037c=function(_0x589495,_0x33aa81){_0x589495=_0x589495-0x0;var _0x5057d5=_0x37c0[_0x589495];return _0x5057d5;};'use strict';var _=require(_0x037c('0x0'));var util=require(_0x037c('0x1'));var logger=require('../../config/logger')(_0x037c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x037c('0x3'));var fs=require('fs');var path=require(_0x037c('0x4'));var rimraf=require(_0x037c('0x5'));var config=require(_0x037c('0x6'));var attributes=require(_0x037c('0x7'));module['exports']=function(_0x1a4aec,_0x3f20d6){return _0x1a4aec[_0x037c('0x8')](_0x037c('0x9'),attributes,{'tableName':_0x037c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x16cfb0,_0x28d646){var _0x3d8504=function(_0x415941){while(--_0x415941){_0x16cfb0['push'](_0x16cfb0['shift']());}};_0x3d8504(++_0x28d646);}(_0x8d3c,0x9b));var _0xc8d3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8d3c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc8d3('0x0'));var util=require('util');var logger=require(_0xc8d3('0x1'))(_0xc8d3('0x2'));var moment=require(_0xc8d3('0x3'));var BPromise=require(_0xc8d3('0x4'));var rp=require(_0xc8d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8d3('0x6'));var config=require(_0xc8d3('0x7'));var attributes=require(_0xc8d3('0x8'));module[_0xc8d3('0x9')]=function(_0x2f8e67,_0x5da8b5){return _0x2f8e67[_0xc8d3('0xa')](_0xc8d3('0xb'),attributes,{'tableName':_0xc8d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index eca68b8..114c2e2 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 _0x79bb=['error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x506a19,_0x1aa991){var _0x23f2b5=function(_0x29821c){while(--_0x29821c){_0x506a19['push'](_0x506a19['shift']());}};_0x23f2b5(++_0x1aa991);}(_0x79bb,0xca));var _0xb79b=function(_0x117554,_0x4a3ef6){_0x117554=_0x117554-0x0;var _0x189f20=_0x79bb[_0x117554];return _0x189f20;};'use strict';var _=require(_0xb79b('0x0'));var util=require('util');var moment=require(_0xb79b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb79b('0x2'))['db'];var utils=require(_0xb79b('0x3'));var logger=require(_0xb79b('0x4'))(_0xb79b('0x5'));var config=require(_0xb79b('0x6'));var jayson=require(_0xb79b('0x7'));var client=jayson[_0xb79b('0x8')][_0xb79b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29cf9e,_0x2f58e4,_0x4ce479){return new BPromise(function(_0x362dc1,_0x828be5){return client[_0xb79b('0xa')](_0x29cf9e,_0x4ce479)[_0xb79b('0xb')](function(_0x45880c){logger[_0xb79b('0xc')](_0xb79b('0xd'),_0x2f58e4,_0xb79b('0xe'));logger[_0xb79b('0xf')](_0xb79b('0x10'),_0x2f58e4,_0xb79b('0xe'),JSON[_0xb79b('0x11')](_0x45880c));if(_0x45880c[_0xb79b('0x12')]){if(_0x45880c[_0xb79b('0x12')][_0xb79b('0x13')]===0x1f4){logger[_0xb79b('0x12')](_0xb79b('0xd'),_0x2f58e4,_0x45880c[_0xb79b('0x12')]['message']);return _0x828be5(_0x45880c['error']['message']);}logger[_0xb79b('0x12')](_0xb79b('0xd'),_0x2f58e4,_0x45880c[_0xb79b('0x12')][_0xb79b('0x14')]);return _0x362dc1(_0x45880c[_0xb79b('0x12')][_0xb79b('0x14')]);}else{logger['info'](_0xb79b('0xd'),_0x2f58e4,_0xb79b('0xe'));_0x362dc1(_0x45880c['result'][_0xb79b('0x14')]);}})[_0xb79b('0x15')](function(_0x4d0854){logger['error'](_0xb79b('0xd'),_0x2f58e4,_0x4d0854);_0x828be5(_0x4d0854);});});} \ No newline at end of file +var _0x2434=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x2434,0x135));var _0x4243=function(_0x1184ce,_0x451bf7){_0x1184ce=_0x1184ce-0x0;var _0x303f3f=_0x2434[_0x1184ce];return _0x303f3f;};'use strict';var _=require(_0x4243('0x0'));var util=require(_0x4243('0x1'));var moment=require(_0x4243('0x2'));var BPromise=require(_0x4243('0x3'));var rs=require(_0x4243('0x4'));var fs=require('fs');var Redis=require(_0x4243('0x5'));var db=require(_0x4243('0x6'))['db'];var utils=require(_0x4243('0x7'));var logger=require(_0x4243('0x8'))('rpc');var config=require(_0x4243('0x9'));var jayson=require(_0x4243('0xa'));var client=jayson[_0x4243('0xb')][_0x4243('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x181117,_0x8e7aff,_0x53c804){return new BPromise(function(_0x3c0630,_0x2c512a){return client[_0x4243('0xd')](_0x181117,_0x53c804)[_0x4243('0xe')](function(_0x3151dd){logger[_0x4243('0xf')](_0x4243('0x10'),_0x8e7aff,_0x4243('0x11'));logger[_0x4243('0x12')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x8e7aff,_0x4243('0x11'),JSON[_0x4243('0x13')](_0x3151dd));if(_0x3151dd['error']){if(_0x3151dd['error'][_0x4243('0x14')]===0x1f4){logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x3151dd['error'][_0x4243('0x16')]);return _0x2c512a(_0x3151dd['error']['message']);}logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x3151dd['error'][_0x4243('0x16')]);return _0x3c0630(_0x3151dd[_0x4243('0x15')][_0x4243('0x16')]);}else{logger[_0x4243('0xf')](_0x4243('0x10'),_0x8e7aff,_0x4243('0x11'));_0x3c0630(_0x3151dd[_0x4243('0x17')]['message']);}})['catch'](function(_0x1cb7d5){logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x1cb7d5);_0x2c512a(_0x1cb7d5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7b99471..d31d589 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 _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x470df7,_0x18dd2b){var _0xeea7fb=function(_0x2cbad7){while(--_0x2cbad7){_0x470df7['push'](_0x470df7['shift']());}};_0xeea7fb(++_0x18dd2b);}(_0x3e74,0x175));var _0x43e7=function(_0x42f3d8,_0x1ba9a7){_0x42f3d8=_0x42f3d8-0x0;var _0x1a1440=_0x3e74[_0x42f3d8];return _0x1a1440;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x4e2b4c,_0x212abb){var _0x3947eb=function(_0x35e32f){while(--_0x35e32f){_0x4e2b4c['push'](_0x4e2b4c['shift']());}};_0x3947eb(++_0x212abb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x5fc3[_0x9b3efc];return _0x200f05;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 806540e..9ec9ea7 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 _0x88c8=['exports','STRING','sequelize'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x88c8,0x7a));var _0x888c=function(_0x22e244,_0x5dc5e2){_0x22e244=_0x22e244-0x0;var _0x3ab6a4=_0x88c8[_0x22e244];return _0x3ab6a4;};'use strict';var Sequelize=require(_0x888c('0x0'));module[_0x888c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x888c('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe027=['name','TEXT','sequelize','exports','STRING'];(function(_0x57f152,_0x34be17){var _0x283d82=function(_0x150b50){while(--_0x150b50){_0x57f152['push'](_0x57f152['shift']());}};_0x283d82(++_0x34be17);}(_0xe027,0x106));var _0x7e02=function(_0x2a3778,_0x3a9653){_0x2a3778=_0x2a3778-0x0;var _0x427785=_0xe027[_0x2a3778];return _0x427785;};'use strict';var Sequelize=require(_0x7e02('0x0'));module[_0x7e02('0x1')]={'name':{'type':Sequelize[_0x7e02('0x2')],'allowNull':![],'unique':_0x7e02('0x3')},'table':{'type':Sequelize[_0x7e02('0x2')]},'metric':{'type':Sequelize[_0x7e02('0x4')]},'description':{'type':Sequelize[_0x7e02('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d342163..70930ad 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 _0xa24b=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','squel','../../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','Content-Range','apply','reject','destroy','then','get','Metrics','UserProfileResource','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type'];(function(_0x786334,_0x14bb53){var _0x2bcc75=function(_0x566423){while(--_0x566423){_0x786334['push'](_0x786334['shift']());}};_0x2bcc75(++_0x14bb53);}(_0xa24b,0x19f));var _0xba24=function(_0x1ee65b,_0x1e9ea4){_0x1ee65b=_0x1ee65b-0x0;var _0x519e4a=_0xa24b[_0x1ee65b];return _0x519e4a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba24('0x0'));var rimraf=require(_0xba24('0x1'));var zipdir=require(_0xba24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba24('0x3'));var moment=require(_0xba24('0x4'));var BPromise=require(_0xba24('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba24('0x6'));var sox=require(_0xba24('0x7'));var csv=require(_0xba24('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xba24('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('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba24('0xa'));var as=require(_0xba24('0xb'));var hardwareService=require(_0xba24('0xc'));var logger=require(_0xba24('0xd'))(_0xba24('0xe'));var utils=require('../../config/utils');var config=require(_0xba24('0xf'));var licenseUtil=require(_0xba24('0x10'));var db=require(_0xba24('0x11'))['db'];function respondWithStatusCode(_0x3286fe,_0x497a0d){_0x497a0d=_0x497a0d||0xcc;return function(_0x5bb314){if(_0x5bb314){return _0x3286fe[_0xba24('0x12')](_0x497a0d);}return _0x3286fe['status'](_0x497a0d)[_0xba24('0x13')]();};}function respondWithResult(_0x4e0a9c,_0x301348){_0x301348=_0x301348||0xc8;return function(_0x4abf53){if(_0x4abf53){return _0x4e0a9c[_0xba24('0x14')](_0x301348)[_0xba24('0x15')](_0x4abf53);}};}function respondWithFilteredResult(_0x37be9f,_0x4f47dd){return function(_0x4e32a5){if(_0x4e32a5){var _0x195b52=_0x4e32a5[_0xba24('0x16')],_0x1aa694=_0x4f47dd[_0xba24('0x17')],_0x46e9c9=_0x4f47dd['offset']+_0x4f47dd['limit'],_0x369eac;if(_0x46e9c9>=_0x195b52){_0x46e9c9=_0x195b52;_0x369eac=0xc8;}else{_0x369eac=0xce;}_0x37be9f['status'](_0x369eac);return _0x37be9f[_0xba24('0x18')](_0xba24('0x19'),_0x1aa694+'-'+_0x46e9c9+'/'+_0x195b52)['json'](_0x4e32a5);}return null;};}function patchUpdates(_0x31946f){return function(_0x3c81dd){try{jsonpatch[_0xba24('0x1a')](_0x3c81dd,_0x31946f,!![]);}catch(_0x429008){return BPromise[_0xba24('0x1b')](_0x429008);}return _0x3c81dd['save']();};}function saveUpdates(_0x1037df,_0x9f0f80){return function(_0x5a6100){if(_0x5a6100){return _0x5a6100['update'](_0x1037df)['then'](function(_0x56547e){return _0x56547e;});}return null;};}function removeEntity(_0x536c38,_0x5778ce){return function(_0x9fe2cf){if(_0x9fe2cf){return _0x9fe2cf[_0xba24('0x1c')]()[_0xba24('0x1d')](function(){var _0x1b46d3=_0x9fe2cf[_0xba24('0x1e')]({'plain':!![]});var _0x1aee83=_0xba24('0x1f');return db[_0xba24('0x20')][_0xba24('0x1c')]({'where':{'type':_0x1aee83,'resourceId':_0x1b46d3['id']}})[_0xba24('0x1d')](function(){return _0x9fe2cf;});})[_0xba24('0x1d')](function(){_0x536c38[_0xba24('0x14')](0xcc)[_0xba24('0x13')]();});}};}function handleEntityNotFound(_0x3e9685,_0x289c13){return function(_0x4fbadf){if(!_0x4fbadf){_0x3e9685[_0xba24('0x12')](0x194);}return _0x4fbadf;};}function handleError(_0x5ada81,_0x4d5066){_0x4d5066=_0x4d5066||0x1f4;return function(_0x3f2960){logger['error'](_0x3f2960[_0xba24('0x21')]);if(_0x3f2960[_0xba24('0x22')]){delete _0x3f2960[_0xba24('0x22')];}_0x5ada81[_0xba24('0x14')](_0x4d5066)['send'](_0x3f2960);};}exports[_0xba24('0x23')]=function(_0x53d45e,_0x5b0658){var _0x23df05={},_0x4a908d={},_0x4ccce8={'count':0x0,'rows':[]};var _0x33c1c9=_[_0xba24('0x24')](db[_0xba24('0x25')][_0xba24('0x26')],function(_0x34b2e7){return{'name':_0x34b2e7[_0xba24('0x27')],'type':_0x34b2e7[_0xba24('0x28')]['key']};});_0x4a908d['model']=_[_0xba24('0x24')](_0x33c1c9,_0xba24('0x22'));_0x4a908d[_0xba24('0x29')]=_[_0xba24('0x2a')](_0x53d45e[_0xba24('0x29')]);_0x4a908d[_0xba24('0x2b')]=_[_0xba24('0x2c')](_0x4a908d[_0xba24('0x2d')],_0x4a908d[_0xba24('0x29')]);_0x23df05[_0xba24('0x2e')]=_[_0xba24('0x2c')](_0x4a908d[_0xba24('0x2d')],qs[_0xba24('0x2f')](_0x53d45e[_0xba24('0x29')]['fields']));_0x23df05[_0xba24('0x2e')]=_0x23df05[_0xba24('0x2e')][_0xba24('0x30')]?_0x23df05[_0xba24('0x2e')]:_0x4a908d[_0xba24('0x2d')];if(!_0x53d45e['query'][_0xba24('0x31')](_0xba24('0x32'))){_0x23df05[_0xba24('0x33')]=qs['limit'](_0x53d45e[_0xba24('0x29')]['limit']);_0x23df05[_0xba24('0x17')]=qs[_0xba24('0x17')](_0x53d45e[_0xba24('0x29')][_0xba24('0x17')]);}_0x23df05[_0xba24('0x34')]=qs['sort'](_0x53d45e[_0xba24('0x29')][_0xba24('0x35')]);_0x23df05[_0xba24('0x36')]=qs[_0xba24('0x2b')](_['pick'](_0x53d45e['query'],_0x4a908d['filters']),_0x33c1c9);if(_0x53d45e[_0xba24('0x29')][_0xba24('0x37')]){_0x23df05[_0xba24('0x36')]=_['merge'](_0x23df05['where'],{'$or':_['map'](_0x33c1c9,function(_0x335a2f){if(_0x335a2f[_0xba24('0x28')]!==_0xba24('0x38')){var _0xc725ce={};_0xc725ce[_0x335a2f[_0xba24('0x22')]]={'$like':'%'+_0x53d45e[_0xba24('0x29')][_0xba24('0x37')]+'%'};return _0xc725ce;}})});}_0x23df05=_[_0xba24('0x39')]({},_0x23df05,_0x53d45e[_0xba24('0x3a')]);var _0x1f5a2f={'where':_0x23df05['where']};return db[_0xba24('0x25')][_0xba24('0x16')](_0x1f5a2f)['then'](function(_0x8b2186){_0x4ccce8[_0xba24('0x16')]=_0x8b2186;if(_0x53d45e[_0xba24('0x29')][_0xba24('0x3b')]){_0x23df05[_0xba24('0x3c')]=[{'all':!![]}];}return db[_0xba24('0x25')][_0xba24('0x3d')](_0x23df05);})['then'](function(_0x30b6c1){_0x4ccce8[_0xba24('0x3e')]=_0x30b6c1;return _0x4ccce8;})[_0xba24('0x1d')](respondWithFilteredResult(_0x5b0658,_0x23df05))[_0xba24('0x3f')](handleError(_0x5b0658,null));};exports[_0xba24('0x40')]=function(_0x2d9b65,_0x132ceb){var _0x1b9b12={'raw':!![],'where':{'id':_0x2d9b65['params']['id']}},_0x504ec5={};_0x504ec5[_0xba24('0x2d')]=_[_0xba24('0x2a')](db[_0xba24('0x25')][_0xba24('0x26')]);_0x504ec5[_0xba24('0x29')]=_[_0xba24('0x2a')](_0x2d9b65[_0xba24('0x29')]);_0x504ec5[_0xba24('0x2b')]=_[_0xba24('0x2c')](_0x504ec5[_0xba24('0x2d')],_0x504ec5[_0xba24('0x29')]);_0x1b9b12['attributes']=_[_0xba24('0x2c')](_0x504ec5[_0xba24('0x2d')],qs[_0xba24('0x2f')](_0x2d9b65['query'][_0xba24('0x2f')]));_0x1b9b12['attributes']=_0x1b9b12[_0xba24('0x2e')]['length']?_0x1b9b12[_0xba24('0x2e')]:_0x504ec5[_0xba24('0x2d')];if(_0x2d9b65[_0xba24('0x29')][_0xba24('0x3b')]){_0x1b9b12[_0xba24('0x3c')]=[{'all':!![]}];}_0x1b9b12=_[_0xba24('0x39')]({},_0x1b9b12,_0x2d9b65[_0xba24('0x3a')]);return db[_0xba24('0x25')]['find'](_0x1b9b12)['then'](handleEntityNotFound(_0x132ceb,null))[_0xba24('0x1d')](respondWithResult(_0x132ceb,null))['catch'](handleError(_0x132ceb,null));};exports['create']=function(_0x289ace,_0x31b03d){return db[_0xba24('0x25')]['create'](_0x289ace['body'],{})[_0xba24('0x1d')](function(_0x2df0b5){var _0x8d7350=_0x289ace[_0xba24('0x41')][_0xba24('0x1e')]({'plain':!![]});if(!_0x8d7350)throw new Error(_0xba24('0x42'));if(_0x8d7350[_0xba24('0x43')]==='user'){var _0x1516ad=_0x2df0b5['get']({'plain':!![]});var _0x423f15=_0xba24('0x1f');return db[_0xba24('0x44')][_0xba24('0x45')]({'where':{'name':_0x423f15,'userProfileId':_0x8d7350[_0xba24('0x46')]},'raw':!![]})[_0xba24('0x1d')](function(_0x1a928f){if(_0x1a928f&&_0x1a928f['autoAssociation']===0x0){return db['UserProfileResource'][_0xba24('0x47')]({'name':_0x1516ad[_0xba24('0x22')],'resourceId':_0x1516ad['id'],'type':_0x1a928f[_0xba24('0x22')],'sectionId':_0x1a928f['id']},{})['then'](function(){return _0x2df0b5;});}else{return _0x2df0b5;}})['catch'](function(_0x2bfd3f){logger['error'](_0xba24('0x48'),_0x2bfd3f);throw _0x2bfd3f;});}return _0x2df0b5;})['then'](respondWithResult(_0x31b03d,0xc9))[_0xba24('0x3f')](handleError(_0x31b03d,null));};exports[_0xba24('0x49')]=function(_0x4cd6d6,_0x21551e){if(_0x4cd6d6[_0xba24('0x4a')]['id']){delete _0x4cd6d6[_0xba24('0x4a')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x4cd6d6['params']['id']}})[_0xba24('0x1d')](handleEntityNotFound(_0x21551e,null))[_0xba24('0x1d')](saveUpdates(_0x4cd6d6['body'],null))[_0xba24('0x1d')](respondWithResult(_0x21551e,null))[_0xba24('0x3f')](handleError(_0x21551e,null));};exports[_0xba24('0x1c')]=function(_0x3a6ea1,_0x41e072){return db[_0xba24('0x25')][_0xba24('0x45')]({'where':{'id':_0x3a6ea1[_0xba24('0x4b')]['id']}})[_0xba24('0x1d')](handleEntityNotFound(_0x41e072,null))['then'](removeEntity(_0x41e072,null))[_0xba24('0x3f')](handleError(_0x41e072,null));}; \ No newline at end of file +var _0x93d2=['nolimit','limit','sort','where','filter','merge','type','VIRTUAL','name','options','include','findAll','rows','catch','includeAll','find','create','user','get','role','Metrics','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x408c37,_0x52cfc2){var _0x417066=function(_0x3d0b63){while(--_0x3d0b63){_0x408c37['push'](_0x408c37['shift']());}};_0x417066(++_0x52cfc2);}(_0x93d2,0x1aa));var _0x293d=function(_0x41015c,_0x5aa973){_0x41015c=_0x41015c-0x0;var _0x44bb9f=_0x93d2[_0x41015c];return _0x44bb9f;};'use strict';var pdf=require(_0x293d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x293d('0x1'));var zipdir=require(_0x293d('0x2'));var jsonpatch=require(_0x293d('0x3'));var rp=require(_0x293d('0x4'));var moment=require(_0x293d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x293d('0x6'));var util=require(_0x293d('0x7'));var path=require(_0x293d('0x8'));var sox=require(_0x293d('0x9'));var csv=require(_0x293d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x293d('0xb'));var squel=require(_0x293d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x293d('0xd'));var toCsv=require(_0x293d('0xa'));var querystring=require('querystring');var Papa=require(_0x293d('0xe'));var Redis=require(_0x293d('0xf'));var authService=require(_0x293d('0x10'));var qs=require(_0x293d('0x11'));var as=require(_0x293d('0x12'));var hardwareService=require(_0x293d('0x13'));var logger=require(_0x293d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x293d('0x15'));var licenseUtil=require(_0x293d('0x16'));var db=require(_0x293d('0x17'))['db'];function respondWithStatusCode(_0x539d6a,_0x32d790){_0x32d790=_0x32d790||0xcc;return function(_0x32b0b7){if(_0x32b0b7){return _0x539d6a[_0x293d('0x18')](_0x32d790);}return _0x539d6a['status'](_0x32d790)[_0x293d('0x19')]();};}function respondWithResult(_0x39dda4,_0xc1a991){_0xc1a991=_0xc1a991||0xc8;return function(_0x5ce00d){if(_0x5ce00d){return _0x39dda4[_0x293d('0x1a')](_0xc1a991)[_0x293d('0x1b')](_0x5ce00d);}};}function respondWithFilteredResult(_0x331b11,_0x4d522a){return function(_0x2effa1){if(_0x2effa1){var _0x256ed9=_0x2effa1[_0x293d('0x1c')],_0x17ab13=_0x4d522a[_0x293d('0x1d')],_0x11af38=_0x4d522a['offset']+_0x4d522a['limit'],_0x3ca38b;if(_0x11af38>=_0x256ed9){_0x11af38=_0x256ed9;_0x3ca38b=0xc8;}else{_0x3ca38b=0xce;}_0x331b11[_0x293d('0x1a')](_0x3ca38b);return _0x331b11[_0x293d('0x1e')](_0x293d('0x1f'),_0x17ab13+'-'+_0x11af38+'/'+_0x256ed9)[_0x293d('0x1b')](_0x2effa1);}return null;};}function patchUpdates(_0x4dfb3b){return function(_0x4b2527){try{jsonpatch[_0x293d('0x20')](_0x4b2527,_0x4dfb3b,!![]);}catch(_0x288578){return BPromise[_0x293d('0x21')](_0x288578);}return _0x4b2527['save']();};}function saveUpdates(_0x2723cf,_0x258094){return function(_0x59ef6f){if(_0x59ef6f){return _0x59ef6f[_0x293d('0x22')](_0x2723cf)['then'](function(_0x4d9875){return _0x4d9875;});}return null;};}function removeEntity(_0x370f99,_0x46dda5){return function(_0x47a030){if(_0x47a030){return _0x47a030[_0x293d('0x23')]()[_0x293d('0x24')](function(){var _0x4cc871=_0x47a030['get']({'plain':!![]});var _0x55466b='Metrics';return db[_0x293d('0x25')][_0x293d('0x23')]({'where':{'type':_0x55466b,'resourceId':_0x4cc871['id']}})[_0x293d('0x24')](function(){return _0x47a030;});})[_0x293d('0x24')](function(){_0x370f99[_0x293d('0x1a')](0xcc)[_0x293d('0x19')]();});}};}function handleEntityNotFound(_0x2eec3d,_0x5c5feb){return function(_0x43b32f){if(!_0x43b32f){_0x2eec3d['sendStatus'](0x194);}return _0x43b32f;};}function handleError(_0x1ad7f0,_0x2fe5aa){_0x2fe5aa=_0x2fe5aa||0x1f4;return function(_0x7a9bdd){logger[_0x293d('0x26')](_0x7a9bdd[_0x293d('0x27')]);if(_0x7a9bdd['name']){delete _0x7a9bdd['name'];}_0x1ad7f0[_0x293d('0x1a')](_0x2fe5aa)['send'](_0x7a9bdd);};}exports['index']=function(_0x36c582,_0x1b9efd){var _0x235e93={},_0x1b485b={},_0x40bf44={'count':0x0,'rows':[]};var _0x34845d=_[_0x293d('0x28')](db[_0x293d('0x29')][_0x293d('0x2a')],function(_0x3fdb7b){return{'name':_0x3fdb7b[_0x293d('0x2b')],'type':_0x3fdb7b['type'][_0x293d('0x2c')]};});_0x1b485b[_0x293d('0x2d')]=_['map'](_0x34845d,'name');_0x1b485b[_0x293d('0x2e')]=_[_0x293d('0x2f')](_0x36c582[_0x293d('0x2e')]);_0x1b485b[_0x293d('0x30')]=_[_0x293d('0x31')](_0x1b485b[_0x293d('0x2d')],_0x1b485b[_0x293d('0x2e')]);_0x235e93['attributes']=_[_0x293d('0x31')](_0x1b485b[_0x293d('0x2d')],qs[_0x293d('0x32')](_0x36c582[_0x293d('0x2e')][_0x293d('0x32')]));_0x235e93[_0x293d('0x33')]=_0x235e93[_0x293d('0x33')][_0x293d('0x34')]?_0x235e93[_0x293d('0x33')]:_0x1b485b[_0x293d('0x2d')];if(!_0x36c582[_0x293d('0x2e')][_0x293d('0x35')](_0x293d('0x36'))){_0x235e93[_0x293d('0x37')]=qs[_0x293d('0x37')](_0x36c582[_0x293d('0x2e')][_0x293d('0x37')]);_0x235e93[_0x293d('0x1d')]=qs[_0x293d('0x1d')](_0x36c582[_0x293d('0x2e')][_0x293d('0x1d')]);}_0x235e93['order']=qs['sort'](_0x36c582[_0x293d('0x2e')][_0x293d('0x38')]);_0x235e93[_0x293d('0x39')]=qs[_0x293d('0x30')](_['pick'](_0x36c582[_0x293d('0x2e')],_0x1b485b[_0x293d('0x30')]),_0x34845d);if(_0x36c582[_0x293d('0x2e')][_0x293d('0x3a')]){_0x235e93['where']=_[_0x293d('0x3b')](_0x235e93['where'],{'$or':_[_0x293d('0x28')](_0x34845d,function(_0xbc64a2){if(_0xbc64a2[_0x293d('0x3c')]!==_0x293d('0x3d')){var _0x29d4fa={};_0x29d4fa[_0xbc64a2[_0x293d('0x3e')]]={'$like':'%'+_0x36c582['query']['filter']+'%'};return _0x29d4fa;}})});}_0x235e93=_[_0x293d('0x3b')]({},_0x235e93,_0x36c582[_0x293d('0x3f')]);var _0x1fa33a={'where':_0x235e93[_0x293d('0x39')]};return db['AnalyticMetric'][_0x293d('0x1c')](_0x1fa33a)[_0x293d('0x24')](function(_0x3c0400){_0x40bf44[_0x293d('0x1c')]=_0x3c0400;if(_0x36c582[_0x293d('0x2e')]['includeAll']){_0x235e93[_0x293d('0x40')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x293d('0x41')](_0x235e93);})[_0x293d('0x24')](function(_0x949d10){_0x40bf44[_0x293d('0x42')]=_0x949d10;return _0x40bf44;})[_0x293d('0x24')](respondWithFilteredResult(_0x1b9efd,_0x235e93))[_0x293d('0x43')](handleError(_0x1b9efd,null));};exports['show']=function(_0x5ecead,_0x4c57e6){var _0xdf965d={'raw':!![],'where':{'id':_0x5ecead['params']['id']}},_0x36d510={};_0x36d510[_0x293d('0x2d')]=_[_0x293d('0x2f')](db['AnalyticMetric'][_0x293d('0x2a')]);_0x36d510[_0x293d('0x2e')]=_[_0x293d('0x2f')](_0x5ecead[_0x293d('0x2e')]);_0x36d510[_0x293d('0x30')]=_[_0x293d('0x31')](_0x36d510[_0x293d('0x2d')],_0x36d510['query']);_0xdf965d[_0x293d('0x33')]=_[_0x293d('0x31')](_0x36d510['model'],qs[_0x293d('0x32')](_0x5ecead[_0x293d('0x2e')][_0x293d('0x32')]));_0xdf965d[_0x293d('0x33')]=_0xdf965d[_0x293d('0x33')][_0x293d('0x34')]?_0xdf965d['attributes']:_0x36d510['model'];if(_0x5ecead[_0x293d('0x2e')][_0x293d('0x44')]){_0xdf965d['include']=[{'all':!![]}];}_0xdf965d=_[_0x293d('0x3b')]({},_0xdf965d,_0x5ecead[_0x293d('0x3f')]);return db[_0x293d('0x29')][_0x293d('0x45')](_0xdf965d)[_0x293d('0x24')](handleEntityNotFound(_0x4c57e6,null))[_0x293d('0x24')](respondWithResult(_0x4c57e6,null))[_0x293d('0x43')](handleError(_0x4c57e6,null));};exports['create']=function(_0x42f15f,_0x29d87a){return db[_0x293d('0x29')][_0x293d('0x46')](_0x42f15f['body'],{})[_0x293d('0x24')](function(_0x5b6cd2){var _0x4facb0=_0x42f15f[_0x293d('0x47')][_0x293d('0x48')]({'plain':!![]});if(!_0x4facb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4facb0[_0x293d('0x49')]==='user'){var _0x347bfa=_0x5b6cd2[_0x293d('0x48')]({'plain':!![]});var _0x1e77f7=_0x293d('0x4a');return db[_0x293d('0x4b')]['find']({'where':{'name':_0x1e77f7,'userProfileId':_0x4facb0['userProfileId']},'raw':!![]})['then'](function(_0x1c5c7d){if(_0x1c5c7d&&_0x1c5c7d[_0x293d('0x4c')]===0x0){return db[_0x293d('0x25')][_0x293d('0x46')]({'name':_0x347bfa[_0x293d('0x3e')],'resourceId':_0x347bfa['id'],'type':_0x1c5c7d[_0x293d('0x3e')],'sectionId':_0x1c5c7d['id']},{})[_0x293d('0x24')](function(){return _0x5b6cd2;});}else{return _0x5b6cd2;}})[_0x293d('0x43')](function(_0x2dda10){logger[_0x293d('0x26')](_0x293d('0x4d'),_0x2dda10);throw _0x2dda10;});}return _0x5b6cd2;})['then'](respondWithResult(_0x29d87a,0xc9))[_0x293d('0x43')](handleError(_0x29d87a,null));};exports['update']=function(_0xde519a,_0x281262){if(_0xde519a[_0x293d('0x4e')]['id']){delete _0xde519a[_0x293d('0x4e')]['id'];}return db[_0x293d('0x29')][_0x293d('0x45')]({'where':{'id':_0xde519a[_0x293d('0x4f')]['id']}})[_0x293d('0x24')](handleEntityNotFound(_0x281262,null))[_0x293d('0x24')](saveUpdates(_0xde519a[_0x293d('0x4e')],null))[_0x293d('0x24')](respondWithResult(_0x281262,null))['catch'](handleError(_0x281262,null));};exports[_0x293d('0x23')]=function(_0x498718,_0x134df7){return db[_0x293d('0x29')][_0x293d('0x45')]({'where':{'id':_0x498718['params']['id']}})[_0x293d('0x24')](handleEntityNotFound(_0x134df7,null))[_0x293d('0x24')](removeEntity(_0x134df7,null))[_0x293d('0x43')](handleError(_0x134df7,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 89267ec..4bee585 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 _0x6996=['exports','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x148806,_0x5e76a0){var _0x1b1f87=function(_0x54afc0){while(--_0x54afc0){_0x148806['push'](_0x148806['shift']());}};_0x1b1f87(++_0x5e76a0);}(_0x6996,0x65));var _0x6699=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x6996[_0x22eb96];return _0x5e1adf;};'use strict';var _=require(_0x6699('0x0'));var util=require('util');var logger=require(_0x6699('0x1'))(_0x6699('0x2'));var moment=require(_0x6699('0x3'));var BPromise=require(_0x6699('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6699('0x5'));var rimraf=require(_0x6699('0x6'));var config=require(_0x6699('0x7'));var attributes=require(_0x6699('0x8'));module[_0x6699('0x9')]=function(_0x18aed7,_0x28eec4){return _0x18aed7['define']('AnalyticMetric',attributes,{'tableName':_0x6699('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12e5=['rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x12e5,0x102));var _0x512e=function(_0x3eaa7b,_0xe3ef2e){_0x3eaa7b=_0x3eaa7b-0x0;var _0x381a70=_0x12e5[_0x3eaa7b];return _0x381a70;};'use strict';var _=require(_0x512e('0x0'));var util=require(_0x512e('0x1'));var logger=require(_0x512e('0x2'))(_0x512e('0x3'));var moment=require(_0x512e('0x4'));var BPromise=require(_0x512e('0x5'));var rp=require(_0x512e('0x6'));var fs=require('fs');var path=require(_0x512e('0x7'));var rimraf=require(_0x512e('0x8'));var config=require('../../config/environment');var attributes=require(_0x512e('0x9'));module[_0x512e('0xa')]=function(_0x53f532,_0x1c234d){return _0x53f532[_0x512e('0xb')](_0x512e('0xc'),attributes,{'tableName':_0x512e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 7c23072..5fbf647 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 _0x3651=['request\x20sent','debug','stringify','error','code','message','info','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0xa62c0d,_0x2b4feb){var _0x5b62e4=function(_0x571fd3){while(--_0x571fd3){_0xa62c0d['push'](_0xa62c0d['shift']());}};_0x5b62e4(++_0x2b4feb);}(_0x3651,0x6e));var _0x1365=function(_0x2f7bab,_0x5ef284){_0x2f7bab=_0x2f7bab-0x0;var _0x450cae=_0x3651[_0x2f7bab];return _0x450cae;};'use strict';var _=require(_0x1365('0x0'));var util=require('util');var moment=require(_0x1365('0x1'));var BPromise=require(_0x1365('0x2'));var rs=require(_0x1365('0x3'));var fs=require('fs');var Redis=require(_0x1365('0x4'));var db=require(_0x1365('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1365('0x6'))(_0x1365('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1365('0x8')][_0x1365('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d279d,_0x13fafd,_0x584fb8){return new BPromise(function(_0x20e754,_0x3c2b45){return client['request'](_0x2d279d,_0x584fb8)['then'](function(_0x3d7ca7){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x1365('0xa'));logger[_0x1365('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x13fafd,'request\x20sent',JSON[_0x1365('0xc')](_0x3d7ca7));if(_0x3d7ca7['error']){if(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xe')]===0x1f4){logger[_0x1365('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x3d7ca7[_0x1365('0xd')]['message']);return _0x3c2b45(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xf')]);}logger[_0x1365('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x13fafd,_0x3d7ca7[_0x1365('0xd')]['message']);return _0x20e754(_0x3d7ca7[_0x1365('0xd')][_0x1365('0xf')]);}else{logger[_0x1365('0x10')](_0x1365('0x11'),_0x13fafd,_0x1365('0xa'));_0x20e754(_0x3d7ca7[_0x1365('0x12')][_0x1365('0xf')]);}})[_0x1365('0x13')](function(_0x1564fb){logger['error'](_0x1365('0x11'),_0x13fafd,_0x1564fb);_0x3c2b45(_0x1564fb);});});} \ No newline at end of file +var _0x66a0=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x66a0,0xe8));var _0x066a=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0x66a0[_0x143cfd];return _0x2cb5f5;};'use strict';var _=require(_0x066a('0x0'));var util=require(_0x066a('0x1'));var moment=require(_0x066a('0x2'));var BPromise=require(_0x066a('0x3'));var rs=require(_0x066a('0x4'));var fs=require('fs');var Redis=require(_0x066a('0x5'));var db=require(_0x066a('0x6'))['db'];var utils=require(_0x066a('0x7'));var logger=require('../../config/logger')(_0x066a('0x8'));var config=require(_0x066a('0x9'));var jayson=require(_0x066a('0xa'));var client=jayson['client'][_0x066a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23b5d6,_0x2ef87c,_0x194fcc){return new BPromise(function(_0x135989,_0x5dc9fe){return client[_0x066a('0xc')](_0x23b5d6,_0x194fcc)[_0x066a('0xd')](function(_0x49eeae){logger[_0x066a('0xe')](_0x066a('0xf'),_0x2ef87c,_0x066a('0x10'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2ef87c,_0x066a('0x10'),JSON[_0x066a('0x11')](_0x49eeae));if(_0x49eeae['error']){if(_0x49eeae['error'][_0x066a('0x12')]===0x1f4){logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x49eeae['error'][_0x066a('0x14')]);return _0x5dc9fe(_0x49eeae[_0x066a('0x13')]['message']);}logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x49eeae['error']['message']);return _0x135989(_0x49eeae['error']['message']);}else{logger[_0x066a('0xe')](_0x066a('0xf'),_0x2ef87c,_0x066a('0x10'));_0x135989(_0x49eeae[_0x066a('0x15')][_0x066a('0x14')]);}})[_0x066a('0x16')](function(_0x7a0df4){logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x7a0df4);_0x5dc9fe(_0x7a0df4);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f1c41f5..00e6f4b 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 _0x7a54=['Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0x4b319d,_0x1679a0){var _0x481c1b=function(_0xd6ef14){while(--_0xd6ef14){_0x4b319d['push'](_0x4b319d['shift']());}};_0x481c1b(++_0x1679a0);}(_0x7a54,0x106));var _0x47a5=function(_0x293b76,_0x4450c8){_0x293b76=_0x293b76-0x0;var _0x13a4ab=_0x7a54[_0x293b76];return _0x13a4ab;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x1261,0x144));var _0x1126=function(_0x16b994,_0x22872a){_0x16b994=_0x16b994-0x0;var _0xfc3e0f=_0x1261[_0x16b994];return _0xfc3e0f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);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 bbe90c7..6434a31 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 _0xb809=['TEXT','sequelize','exports'];(function(_0x10721d,_0x54acca){var _0x5b1286=function(_0x38bf5e){while(--_0x38bf5e){_0x10721d['push'](_0x10721d['shift']());}};_0x5b1286(++_0x54acca);}(_0xb809,0x1e7));var _0x9b80=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0xb809[_0x39ea42];return _0x33f5b7;};'use strict';var Sequelize=require(_0x9b80('0x0'));module[_0x9b80('0x1')]={'tree':{'type':Sequelize[_0x9b80('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0f8b=['TEXT','sequelize'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x0f8b,0xcf));var _0xb0f8=function(_0x56081c,_0xe70620){_0x56081c=_0x56081c-0x0;var _0x38c5ba=_0x0f8b[_0x56081c];return _0x38c5ba;};'use strict';var Sequelize=require(_0xb0f8('0x0'));module['exports']={'tree':{'type':Sequelize[_0xb0f8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8efbc7b..ca14dd1 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 _0x0c52=['index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','keys','length','includeAll','options','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x287131,_0x4f6fd3){var _0x344111=function(_0x4b9c66){while(--_0x4b9c66){_0x287131['push'](_0x287131['shift']());}};_0x344111(++_0x4f6fd3);}(_0x0c52,0x6b));var _0x20c5=function(_0x23d893,_0x59afd7){_0x23d893=_0x23d893-0x0;var _0x35edbc=_0x0c52[_0x23d893];return _0x35edbc;};'use strict';var pdf=require(_0x20c5('0x0'));var emlformat=require(_0x20c5('0x1'));var rimraf=require(_0x20c5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x20c5('0x3'));var moment=require(_0x20c5('0x4'));var BPromise=require(_0x20c5('0x5'));var Mustache=require(_0x20c5('0x6'));var util=require('util');var path=require(_0x20c5('0x7'));var sox=require(_0x20c5('0x8'));var csv=require(_0x20c5('0x9'));var ejs=require(_0x20c5('0xa'));var fs=require('fs');var _=require(_0x20c5('0xb'));var squel=require(_0x20c5('0xc'));var crypto=require(_0x20c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20c5('0xe'));var toCsv=require(_0x20c5('0x9'));var querystring=require(_0x20c5('0xf'));var Papa=require('papaparse');var Redis=require(_0x20c5('0x10'));var authService=require(_0x20c5('0x11'));var qs=require(_0x20c5('0x12'));var as=require(_0x20c5('0x13'));var hardwareService=require(_0x20c5('0x14'));var logger=require(_0x20c5('0x15'))(_0x20c5('0x16'));var utils=require(_0x20c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x20c5('0x18'));var db=require(_0x20c5('0x19'))['db'];function respondWithStatusCode(_0x175bf7,_0x135fff){_0x135fff=_0x135fff||0xcc;return function(_0x2cf4d6){if(_0x2cf4d6){return _0x175bf7[_0x20c5('0x1a')](_0x135fff);}return _0x175bf7[_0x20c5('0x1b')](_0x135fff)[_0x20c5('0x1c')]();};}function respondWithResult(_0x3d38b2,_0x570118){_0x570118=_0x570118||0xc8;return function(_0x489362){if(_0x489362){return _0x3d38b2['status'](_0x570118)[_0x20c5('0x1d')](_0x489362);}};}function respondWithFilteredResult(_0x31a4f7,_0x2956c3){return function(_0x348626){if(_0x348626){var _0x422503=_0x348626[_0x20c5('0x1e')],_0x3e889b=_0x2956c3[_0x20c5('0x1f')],_0x443e73=_0x2956c3['offset']+_0x2956c3[_0x20c5('0x20')],_0x46dce1;if(_0x443e73>=_0x422503){_0x443e73=_0x422503;_0x46dce1=0xc8;}else{_0x46dce1=0xce;}_0x31a4f7[_0x20c5('0x1b')](_0x46dce1);return _0x31a4f7[_0x20c5('0x21')]('Content-Range',_0x3e889b+'-'+_0x443e73+'/'+_0x422503)[_0x20c5('0x1d')](_0x348626);}return null;};}function patchUpdates(_0x2934e6){return function(_0x388413){try{jsonpatch['apply'](_0x388413,_0x2934e6,!![]);}catch(_0x47c053){return BPromise[_0x20c5('0x22')](_0x47c053);}return _0x388413[_0x20c5('0x23')]();};}function saveUpdates(_0x252a75,_0x2740f8){return function(_0x1acd1f){if(_0x1acd1f){return _0x1acd1f[_0x20c5('0x24')](_0x252a75)['then'](function(_0x5c50fb){return _0x5c50fb;});}return null;};}function removeEntity(_0x9054ff,_0x1a759a){return function(_0x1c35bd){if(_0x1c35bd){return _0x1c35bd[_0x20c5('0x25')]()[_0x20c5('0x26')](function(){_0x9054ff['status'](0xcc)[_0x20c5('0x1c')]();});}};}function handleEntityNotFound(_0x508d74,_0x268470){return function(_0x5078e2){if(!_0x5078e2){_0x508d74[_0x20c5('0x1a')](0x194);}return _0x5078e2;};}function handleError(_0x3dcc42,_0x211201){_0x211201=_0x211201||0x1f4;return function(_0x30fc1a){logger[_0x20c5('0x27')](_0x30fc1a[_0x20c5('0x28')]);if(_0x30fc1a[_0x20c5('0x29')]){delete _0x30fc1a[_0x20c5('0x29')];}_0x3dcc42[_0x20c5('0x1b')](_0x211201)[_0x20c5('0x2a')](_0x30fc1a);};}exports[_0x20c5('0x2b')]=function(_0x4421a6,_0xb7dc70){var _0xbae92={},_0x1c61d5={},_0x524148={'count':0x0,'rows':[]};var _0x5d332d=_[_0x20c5('0x2c')](db[_0x20c5('0x2d')][_0x20c5('0x2e')],function(_0x387385){return{'name':_0x387385[_0x20c5('0x2f')],'type':_0x387385[_0x20c5('0x30')][_0x20c5('0x31')]};});_0x1c61d5['model']=_['map'](_0x5d332d,_0x20c5('0x29'));_0x1c61d5[_0x20c5('0x32')]=_['keys'](_0x4421a6[_0x20c5('0x32')]);_0x1c61d5[_0x20c5('0x33')]=_[_0x20c5('0x34')](_0x1c61d5[_0x20c5('0x35')],_0x1c61d5['query']);_0xbae92[_0x20c5('0x36')]=_[_0x20c5('0x34')](_0x1c61d5[_0x20c5('0x35')],qs[_0x20c5('0x37')](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x37')]));_0xbae92[_0x20c5('0x36')]=_0xbae92[_0x20c5('0x36')]['length']?_0xbae92['attributes']:_0x1c61d5[_0x20c5('0x35')];if(!_0x4421a6[_0x20c5('0x32')]['hasOwnProperty'](_0x20c5('0x38'))){_0xbae92['limit']=qs['limit'](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x20')]);_0xbae92[_0x20c5('0x1f')]=qs[_0x20c5('0x1f')](_0x4421a6[_0x20c5('0x32')]['offset']);}_0xbae92[_0x20c5('0x39')]=qs[_0x20c5('0x3a')](_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3a')]);_0xbae92[_0x20c5('0x3b')]=qs[_0x20c5('0x33')](_[_0x20c5('0x3c')](_0x4421a6['query'],_0x1c61d5[_0x20c5('0x33')]),_0x5d332d);if(_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3d')]){_0xbae92[_0x20c5('0x3b')]=_[_0x20c5('0x3e')](_0xbae92['where'],{'$or':_[_0x20c5('0x2c')](_0x5d332d,function(_0x2dee9e){if(_0x2dee9e['type']!==_0x20c5('0x3f')){var _0x230481={};_0x230481[_0x2dee9e[_0x20c5('0x29')]]={'$like':'%'+_0x4421a6[_0x20c5('0x32')][_0x20c5('0x3d')]+'%'};return _0x230481;}})});}_0xbae92=_[_0x20c5('0x3e')]({},_0xbae92,_0x4421a6['options']);var _0x4b2fc8={'where':_0xbae92[_0x20c5('0x3b')]};return db['AnalyticTreeReport'][_0x20c5('0x1e')](_0x4b2fc8)['then'](function(_0x43eb81){_0x524148[_0x20c5('0x1e')]=_0x43eb81;if(_0x4421a6[_0x20c5('0x32')]['includeAll']){_0xbae92[_0x20c5('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0xbae92);})[_0x20c5('0x26')](function(_0x36dc31){_0x524148['rows']=_0x36dc31;return _0x524148;})[_0x20c5('0x26')](respondWithFilteredResult(_0xb7dc70,_0xbae92))[_0x20c5('0x41')](handleError(_0xb7dc70,null));};exports[_0x20c5('0x42')]=function(_0x1f8ee1,_0x50aa86){var _0x13e931={'raw':!![],'where':{'id':_0x1f8ee1[_0x20c5('0x43')]['id']}},_0x12d23c={};_0x12d23c[_0x20c5('0x35')]=_[_0x20c5('0x44')](db[_0x20c5('0x2d')][_0x20c5('0x2e')]);_0x12d23c['query']=_[_0x20c5('0x44')](_0x1f8ee1['query']);_0x12d23c[_0x20c5('0x33')]=_[_0x20c5('0x34')](_0x12d23c[_0x20c5('0x35')],_0x12d23c[_0x20c5('0x32')]);_0x13e931[_0x20c5('0x36')]=_['intersection'](_0x12d23c[_0x20c5('0x35')],qs[_0x20c5('0x37')](_0x1f8ee1[_0x20c5('0x32')]['fields']));_0x13e931[_0x20c5('0x36')]=_0x13e931['attributes'][_0x20c5('0x45')]?_0x13e931['attributes']:_0x12d23c[_0x20c5('0x35')];if(_0x1f8ee1[_0x20c5('0x32')][_0x20c5('0x46')]){_0x13e931[_0x20c5('0x40')]=[{'all':!![]}];}_0x13e931=_[_0x20c5('0x3e')]({},_0x13e931,_0x1f8ee1[_0x20c5('0x47')]);return db[_0x20c5('0x2d')]['find'](_0x13e931)[_0x20c5('0x26')](handleEntityNotFound(_0x50aa86,null))['then'](respondWithResult(_0x50aa86,null))[_0x20c5('0x41')](handleError(_0x50aa86,null));};exports['create']=function(_0x25a906,_0x54c5c3){return db[_0x20c5('0x2d')][_0x20c5('0x48')](_0x25a906[_0x20c5('0x49')],{})[_0x20c5('0x26')](respondWithResult(_0x54c5c3,0xc9))[_0x20c5('0x41')](handleError(_0x54c5c3,null));};exports[_0x20c5('0x24')]=function(_0x530fd0,_0x449d73){if(_0x530fd0['body']['id']){delete _0x530fd0[_0x20c5('0x49')]['id'];}return db[_0x20c5('0x2d')][_0x20c5('0x4a')]({'where':{'id':_0x530fd0[_0x20c5('0x43')]['id']}})[_0x20c5('0x26')](handleEntityNotFound(_0x449d73,null))[_0x20c5('0x26')](saveUpdates(_0x530fd0[_0x20c5('0x49')],null))['then'](respondWithResult(_0x449d73,null))[_0x20c5('0x41')](handleError(_0x449d73,null));};exports[_0x20c5('0x25')]=function(_0x3985dd,_0x1fc972){return db[_0x20c5('0x2d')]['find']({'where':{'id':_0x3985dd[_0x20c5('0x43')]['id']}})[_0x20c5('0x26')](handleEntityNotFound(_0x1fc972,null))[_0x20c5('0x26')](removeEntity(_0x1fc972,null))[_0x20c5('0x41')](handleError(_0x1fc972,null));}; \ No newline at end of file +var _0xe486=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','then','rows','show','params','keys','find','create','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x52b666,_0x25135a){var _0x619580=function(_0x299cc3){while(--_0x299cc3){_0x52b666['push'](_0x52b666['shift']());}};_0x619580(++_0x25135a);}(_0xe486,0x108));var _0x6e48=function(_0x2ce185,_0xc0446d){_0x2ce185=_0x2ce185-0x0;var _0x207213=_0xe486[_0x2ce185];return _0x207213;};'use strict';var pdf=require(_0x6e48('0x0'));var emlformat=require(_0x6e48('0x1'));var rimraf=require(_0x6e48('0x2'));var zipdir=require(_0x6e48('0x3'));var jsonpatch=require(_0x6e48('0x4'));var rp=require('request-promise');var moment=require(_0x6e48('0x5'));var BPromise=require(_0x6e48('0x6'));var Mustache=require(_0x6e48('0x7'));var util=require('util');var path=require(_0x6e48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e48('0x9'));var squel=require(_0x6e48('0xa'));var crypto=require('crypto');var jsforce=require(_0x6e48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e48('0xc'));var querystring=require('querystring');var Papa=require(_0x6e48('0xd'));var Redis=require('ioredis');var authService=require(_0x6e48('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6e48('0xf'));var hardwareService=require(_0x6e48('0x10'));var logger=require(_0x6e48('0x11'))(_0x6e48('0x12'));var utils=require('../../config/utils');var config=require(_0x6e48('0x13'));var licenseUtil=require(_0x6e48('0x14'));var db=require(_0x6e48('0x15'))['db'];function respondWithStatusCode(_0x10d2c8,_0x1ea9cf){_0x1ea9cf=_0x1ea9cf||0xcc;return function(_0x21dfe4){if(_0x21dfe4){return _0x10d2c8[_0x6e48('0x16')](_0x1ea9cf);}return _0x10d2c8['status'](_0x1ea9cf)[_0x6e48('0x17')]();};}function respondWithResult(_0x6d7b43,_0x33fed2){_0x33fed2=_0x33fed2||0xc8;return function(_0x256022){if(_0x256022){return _0x6d7b43[_0x6e48('0x18')](_0x33fed2)[_0x6e48('0x19')](_0x256022);}};}function respondWithFilteredResult(_0x29130a,_0x292a9c){return function(_0x258302){if(_0x258302){var _0x437277=_0x258302[_0x6e48('0x1a')],_0x290efa=_0x292a9c[_0x6e48('0x1b')],_0x2c21c4=_0x292a9c['offset']+_0x292a9c[_0x6e48('0x1c')],_0x5c9ae5;if(_0x2c21c4>=_0x437277){_0x2c21c4=_0x437277;_0x5c9ae5=0xc8;}else{_0x5c9ae5=0xce;}_0x29130a[_0x6e48('0x18')](_0x5c9ae5);return _0x29130a[_0x6e48('0x1d')](_0x6e48('0x1e'),_0x290efa+'-'+_0x2c21c4+'/'+_0x437277)[_0x6e48('0x19')](_0x258302);}return null;};}function patchUpdates(_0x65138){return function(_0x14ac4b){try{jsonpatch['apply'](_0x14ac4b,_0x65138,!![]);}catch(_0x1a3eb0){return BPromise[_0x6e48('0x1f')](_0x1a3eb0);}return _0x14ac4b['save']();};}function saveUpdates(_0x1ea93c,_0x1a741c){return function(_0x25f6b3){if(_0x25f6b3){return _0x25f6b3[_0x6e48('0x20')](_0x1ea93c)['then'](function(_0x2ae9a2){return _0x2ae9a2;});}return null;};}function removeEntity(_0x2646a1,_0x43424f){return function(_0x43abff){if(_0x43abff){return _0x43abff[_0x6e48('0x21')]()['then'](function(){_0x2646a1[_0x6e48('0x18')](0xcc)[_0x6e48('0x17')]();});}};}function handleEntityNotFound(_0x3584f1,_0x245881){return function(_0x1795e1){if(!_0x1795e1){_0x3584f1[_0x6e48('0x16')](0x194);}return _0x1795e1;};}function handleError(_0x597813,_0x3c2fbc){_0x3c2fbc=_0x3c2fbc||0x1f4;return function(_0x2184b9){logger[_0x6e48('0x22')](_0x2184b9[_0x6e48('0x23')]);if(_0x2184b9[_0x6e48('0x24')]){delete _0x2184b9['name'];}_0x597813['status'](_0x3c2fbc)[_0x6e48('0x25')](_0x2184b9);};}exports['index']=function(_0xc7eb6a,_0x363ff6){var _0x1aaca7={},_0x1b40e9={},_0x4d1791={'count':0x0,'rows':[]};var _0x4952b6=_[_0x6e48('0x26')](db['AnalyticTreeReport'][_0x6e48('0x27')],function(_0x4ba0ce){return{'name':_0x4ba0ce[_0x6e48('0x28')],'type':_0x4ba0ce[_0x6e48('0x29')]['key']};});_0x1b40e9[_0x6e48('0x2a')]=_[_0x6e48('0x26')](_0x4952b6,_0x6e48('0x24'));_0x1b40e9[_0x6e48('0x2b')]=_['keys'](_0xc7eb6a['query']);_0x1b40e9['filters']=_[_0x6e48('0x2c')](_0x1b40e9[_0x6e48('0x2a')],_0x1b40e9[_0x6e48('0x2b')]);_0x1aaca7[_0x6e48('0x2d')]=_[_0x6e48('0x2c')](_0x1b40e9[_0x6e48('0x2a')],qs['fields'](_0xc7eb6a['query'][_0x6e48('0x2e')]));_0x1aaca7[_0x6e48('0x2d')]=_0x1aaca7[_0x6e48('0x2d')][_0x6e48('0x2f')]?_0x1aaca7[_0x6e48('0x2d')]:_0x1b40e9['model'];if(!_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x30')](_0x6e48('0x31'))){_0x1aaca7[_0x6e48('0x1c')]=qs['limit'](_0xc7eb6a['query']['limit']);_0x1aaca7[_0x6e48('0x1b')]=qs[_0x6e48('0x1b')](_0xc7eb6a['query']['offset']);}_0x1aaca7[_0x6e48('0x32')]=qs[_0x6e48('0x33')](_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x33')]);_0x1aaca7[_0x6e48('0x34')]=qs[_0x6e48('0x35')](_[_0x6e48('0x36')](_0xc7eb6a[_0x6e48('0x2b')],_0x1b40e9[_0x6e48('0x35')]),_0x4952b6);if(_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x37')]){_0x1aaca7['where']=_[_0x6e48('0x38')](_0x1aaca7[_0x6e48('0x34')],{'$or':_[_0x6e48('0x26')](_0x4952b6,function(_0x4e46d0){if(_0x4e46d0[_0x6e48('0x29')]!==_0x6e48('0x39')){var _0x399f20={};_0x399f20[_0x4e46d0[_0x6e48('0x24')]]={'$like':'%'+_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x37')]+'%'};return _0x399f20;}})});}_0x1aaca7=_[_0x6e48('0x38')]({},_0x1aaca7,_0xc7eb6a[_0x6e48('0x3a')]);var _0x449c46={'where':_0x1aaca7[_0x6e48('0x34')]};return db[_0x6e48('0x3b')][_0x6e48('0x1a')](_0x449c46)['then'](function(_0x326991){_0x4d1791['count']=_0x326991;if(_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x3c')]){_0x1aaca7[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x3b')]['findAll'](_0x1aaca7);})[_0x6e48('0x3e')](function(_0x5205bc){_0x4d1791[_0x6e48('0x3f')]=_0x5205bc;return _0x4d1791;})[_0x6e48('0x3e')](respondWithFilteredResult(_0x363ff6,_0x1aaca7))['catch'](handleError(_0x363ff6,null));};exports[_0x6e48('0x40')]=function(_0x4d78c1,_0x26a801){var _0x6b706e={'raw':!![],'where':{'id':_0x4d78c1[_0x6e48('0x41')]['id']}},_0x3c161d={};_0x3c161d[_0x6e48('0x2a')]=_[_0x6e48('0x42')](db[_0x6e48('0x3b')]['rawAttributes']);_0x3c161d[_0x6e48('0x2b')]=_['keys'](_0x4d78c1['query']);_0x3c161d[_0x6e48('0x35')]=_[_0x6e48('0x2c')](_0x3c161d[_0x6e48('0x2a')],_0x3c161d[_0x6e48('0x2b')]);_0x6b706e[_0x6e48('0x2d')]=_['intersection'](_0x3c161d[_0x6e48('0x2a')],qs[_0x6e48('0x2e')](_0x4d78c1['query'][_0x6e48('0x2e')]));_0x6b706e[_0x6e48('0x2d')]=_0x6b706e[_0x6e48('0x2d')][_0x6e48('0x2f')]?_0x6b706e['attributes']:_0x3c161d[_0x6e48('0x2a')];if(_0x4d78c1[_0x6e48('0x2b')][_0x6e48('0x3c')]){_0x6b706e[_0x6e48('0x3d')]=[{'all':!![]}];}_0x6b706e=_['merge']({},_0x6b706e,_0x4d78c1[_0x6e48('0x3a')]);return db[_0x6e48('0x3b')][_0x6e48('0x43')](_0x6b706e)[_0x6e48('0x3e')](handleEntityNotFound(_0x26a801,null))[_0x6e48('0x3e')](respondWithResult(_0x26a801,null))['catch'](handleError(_0x26a801,null));};exports[_0x6e48('0x44')]=function(_0x46c1b1,_0x3e0c9b){return db[_0x6e48('0x3b')]['create'](_0x46c1b1['body'],{})[_0x6e48('0x3e')](respondWithResult(_0x3e0c9b,0xc9))[_0x6e48('0x45')](handleError(_0x3e0c9b,null));};exports[_0x6e48('0x20')]=function(_0x131173,_0x3b4a2d){if(_0x131173[_0x6e48('0x46')]['id']){delete _0x131173[_0x6e48('0x46')]['id'];}return db[_0x6e48('0x3b')][_0x6e48('0x43')]({'where':{'id':_0x131173[_0x6e48('0x41')]['id']}})[_0x6e48('0x3e')](handleEntityNotFound(_0x3b4a2d,null))[_0x6e48('0x3e')](saveUpdates(_0x131173[_0x6e48('0x46')],null))[_0x6e48('0x3e')](respondWithResult(_0x3b4a2d,null))[_0x6e48('0x45')](handleError(_0x3b4a2d,null));};exports['destroy']=function(_0x3fc5fa,_0x3aca77){return db[_0x6e48('0x3b')][_0x6e48('0x43')]({'where':{'id':_0x3fc5fa[_0x6e48('0x41')]['id']}})['then'](handleEntityNotFound(_0x3aca77,null))[_0x6e48('0x3e')](removeEntity(_0x3aca77,null))[_0x6e48('0x45')](handleError(_0x3aca77,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c5ee8c6..d639a54 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 _0x7a12=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util'];(function(_0x40f09a,_0x3743b6){var _0x2eb96c=function(_0xe6203d){while(--_0xe6203d){_0x40f09a['push'](_0x40f09a['shift']());}};_0x2eb96c(++_0x3743b6);}(_0x7a12,0xe8));var _0x27a1=function(_0x323d9c,_0x3414f5){_0x323d9c=_0x323d9c-0x0;var _0x9f86e7=_0x7a12[_0x323d9c];return _0x9f86e7;};'use strict';var _=require(_0x27a1('0x0'));var util=require(_0x27a1('0x1'));var logger=require(_0x27a1('0x2'))(_0x27a1('0x3'));var moment=require(_0x27a1('0x4'));var BPromise=require(_0x27a1('0x5'));var rp=require(_0x27a1('0x6'));var fs=require('fs');var path=require(_0x27a1('0x7'));var rimraf=require('rimraf');var config=require(_0x27a1('0x8'));var attributes=require(_0x27a1('0x9'));module[_0x27a1('0xa')]=function(_0x389116,_0x2ccadb){return _0x389116[_0x27a1('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x27a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ad=['exports','define','AnalyticTreeReport','analytics_report_trees','api','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x10ad,0xf4));var _0xd10a=function(_0x513012,_0x27a25d){_0x513012=_0x513012-0x0;var _0x54a0ae=_0x10ad[_0x513012];return _0x54a0ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd10a('0x0'));var moment=require('moment');var BPromise=require(_0xd10a('0x1'));var rp=require(_0xd10a('0x2'));var fs=require('fs');var path=require(_0xd10a('0x3'));var rimraf=require(_0xd10a('0x4'));var config=require('../../config/environment');var attributes=require(_0xd10a('0x5'));module[_0xd10a('0x6')]=function(_0x3658f5,_0x425715){return _0x3658f5[_0xd10a('0x7')](_0xd10a('0x8'),attributes,{'tableName':_0xd10a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8fec3ea..c1fa71d 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 _0xa696=['AnalyticTreeReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4973be,_0x4f971b){var _0x17c0da=function(_0x1d458a){while(--_0x1d458a){_0x4973be['push'](_0x4973be['shift']());}};_0x17c0da(++_0x4f971b);}(_0xa696,0x16b));var _0x6a69=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xa696[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x6a69('0x0'));var util=require(_0x6a69('0x1'));var moment=require(_0x6a69('0x2'));var BPromise=require(_0x6a69('0x3'));var rs=require(_0x6a69('0x4'));var fs=require('fs');var Redis=require(_0x6a69('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a69('0x6'));var logger=require(_0x6a69('0x7'))(_0x6a69('0x8'));var config=require('../../config/environment');var jayson=require(_0x6a69('0x9'));var client=jayson['client'][_0x6a69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x194368,_0x1d8c1a,_0x77f90f){return new BPromise(function(_0x51ec47,_0x559bfd){return client['request'](_0x194368,_0x77f90f)[_0x6a69('0xb')](function(_0x501bd4){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x1d8c1a,_0x6a69('0xc'));logger[_0x6a69('0xd')](_0x6a69('0xe'),_0x1d8c1a,_0x6a69('0xc'),JSON['stringify'](_0x501bd4));if(_0x501bd4[_0x6a69('0xf')]){if(_0x501bd4['error'][_0x6a69('0x10')]===0x1f4){logger[_0x6a69('0xf')](_0x6a69('0x11'),_0x1d8c1a,_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);return _0x559bfd(_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);}logger['error'](_0x6a69('0x11'),_0x1d8c1a,_0x501bd4[_0x6a69('0xf')][_0x6a69('0x12')]);return _0x51ec47(_0x501bd4[_0x6a69('0xf')]['message']);}else{logger['info'](_0x6a69('0x11'),_0x1d8c1a,'request\x20sent');_0x51ec47(_0x501bd4[_0x6a69('0x13')][_0x6a69('0x12')]);}})['catch'](function(_0x3e46b3){logger['error'](_0x6a69('0x11'),_0x1d8c1a,_0x3e46b3);_0x559bfd(_0x3e46b3);});});} \ No newline at end of file +var _0xb4b0=['http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb4b0,0x187));var _0x0b4b=function(_0x552b24,_0xa566c3){_0x552b24=_0x552b24-0x0;var _0x45bd92=_0xb4b0[_0x552b24];return _0x45bd92;};'use strict';var _=require(_0x0b4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b4b('0x1'));var rs=require(_0x0b4b('0x2'));var fs=require('fs');var Redis=require(_0x0b4b('0x3'));var db=require(_0x0b4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b4b('0x5'))(_0x0b4b('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b4b('0x7'));var client=jayson[_0x0b4b('0x8')][_0x0b4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c3d7a,_0x2d2280,_0x3ea74b){return new BPromise(function(_0x3dd5b6,_0xef2ea2){return client[_0x0b4b('0xa')](_0x5c3d7a,_0x3ea74b)[_0x0b4b('0xb')](function(_0x2f669f){logger[_0x0b4b('0xc')](_0x0b4b('0xd'),_0x2d2280,'request\x20sent');logger['debug'](_0x0b4b('0xe'),_0x2d2280,'request\x20sent',JSON['stringify'](_0x2f669f));if(_0x2f669f[_0x0b4b('0xf')]){if(_0x2f669f[_0x0b4b('0xf')]['code']===0x1f4){logger['error'](_0x0b4b('0xd'),_0x2d2280,_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);return _0xef2ea2(_0x2f669f['error'][_0x0b4b('0x10')]);}logger[_0x0b4b('0xf')](_0x0b4b('0xd'),_0x2d2280,_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);return _0x3dd5b6(_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);}else{logger[_0x0b4b('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2d2280,_0x0b4b('0x11'));_0x3dd5b6(_0x2f669f[_0x0b4b('0x12')][_0x0b4b('0x10')]);}})[_0x0b4b('0x13')](function(_0x3d0578){logger['error'](_0x0b4b('0xd'),_0x2d2280,_0x3d0578);_0xef2ea2(_0x3d0578);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 34b7ff8..b76c641 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 _0x8c82=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c82,0x1a7));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x28c8('0x0'));var util=require(_0x28c8('0x1'));var path=require('path');var timeout=require(_0x28c8('0x2'));var express=require(_0x28c8('0x3'));var router=express[_0x28c8('0x4')]();var auth=require(_0x28c8('0x5'));var interaction=require(_0x28c8('0x6'));var config=require(_0x28c8('0x7'));var controller=require(_0x28c8('0x8'));router['get']('/',auth[_0x28c8('0x9')](),controller['index']);router['get']('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xa')]);router[_0x28c8('0xb')]('/',auth[_0x28c8('0x9')](),controller[_0x28c8('0xc')]);router[_0x28c8('0xd')]('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xe')]);router[_0x28c8('0xf')](_0x28c8('0x10'),auth[_0x28c8('0x9')](),controller[_0x28c8('0x11')]);module[_0x28c8('0x12')]=router; \ No newline at end of file +var _0x1727=['post','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2c1bde,_0x3be150){var _0x571de0=function(_0x3a1c56){while(--_0x3a1c56){_0x2c1bde['push'](_0x2c1bde['shift']());}};_0x571de0(++_0x3be150);}(_0x1727,0x1db));var _0x7172=function(_0x2453a7,_0x324b18){_0x2453a7=_0x2453a7-0x0;var _0x48056a=_0x1727[_0x2453a7];return _0x48056a;};'use strict';var multer=require(_0x7172('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7172('0x1'));var express=require(_0x7172('0x2'));var router=express[_0x7172('0x3')]();var auth=require(_0x7172('0x4'));var interaction=require(_0x7172('0x5'));var config=require(_0x7172('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x7172('0x7')]('/',auth[_0x7172('0x8')](),controller[_0x7172('0x9')]);router[_0x7172('0x7')]('/:id',auth[_0x7172('0x8')](),controller[_0x7172('0xa')]);router[_0x7172('0xb')]('/',auth['isAuthenticated'](),controller[_0x7172('0xc')]);router['put'](_0x7172('0xd'),auth[_0x7172('0x8')](),controller[_0x7172('0xe')]);router[_0x7172('0xf')](_0x7172('0xd'),auth[_0x7172('0x8')](),controller[_0x7172('0x10')]);module[_0x7172('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a0f315a..2dd1486 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 _0xf2de=['exports','STRING','sequelize'];(function(_0x307a10,_0x181503){var _0x40b1a5=function(_0x166703){while(--_0x166703){_0x307a10['push'](_0x307a10['shift']());}};_0x40b1a5(++_0x181503);}(_0xf2de,0xc2));var _0xef2d=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf2de[_0x494d1f];return _0x457b6e;};'use strict';var Sequelize=require(_0xef2d('0x0'));module[_0xef2d('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xef2d('0x2')]},'type':{'type':Sequelize[_0xef2d('0x2')]}}; \ No newline at end of file +var _0xccb5=['STRING','sequelize'];(function(_0x27fb7e,_0x52a07b){var _0x3d9970=function(_0x1bd936){while(--_0x1bd936){_0x27fb7e['push'](_0x27fb7e['shift']());}};_0x3d9970(++_0x52a07b);}(_0xccb5,0xa9));var _0x5ccb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xccb5[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5ccb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x5ccb('0x1')]},'type':{'type':Sequelize[_0x5ccb('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a770114..1e574e2 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 _0x0cf6=['update','then','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','rows','params','fields','find','catch','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x41cfb9,_0x3a53f9){var _0x515941=function(_0x201b5d){while(--_0x201b5d){_0x41cfb9['push'](_0x41cfb9['shift']());}};_0x515941(++_0x3a53f9);}(_0x0cf6,0x1de));var _0x60cf=function(_0x4e437e,_0x3388e0){_0x4e437e=_0x4e437e-0x0;var _0x3eca24=_0x0cf6[_0x4e437e];return _0x3eca24;};'use strict';var pdf=require(_0x60cf('0x0'));var emlformat=require(_0x60cf('0x1'));var rimraf=require(_0x60cf('0x2'));var zipdir=require(_0x60cf('0x3'));var jsonpatch=require(_0x60cf('0x4'));var rp=require(_0x60cf('0x5'));var moment=require(_0x60cf('0x6'));var BPromise=require(_0x60cf('0x7'));var Mustache=require(_0x60cf('0x8'));var util=require('util');var path=require(_0x60cf('0x9'));var sox=require(_0x60cf('0xa'));var csv=require(_0x60cf('0xb'));var ejs=require(_0x60cf('0xc'));var fs=require('fs');var _=require(_0x60cf('0xd'));var squel=require('squel');var crypto=require(_0x60cf('0xe'));var jsforce=require(_0x60cf('0xf'));var deskjs=require(_0x60cf('0x10'));var toCsv=require(_0x60cf('0xb'));var querystring=require('querystring');var Papa=require(_0x60cf('0x11'));var Redis=require(_0x60cf('0x12'));var authService=require(_0x60cf('0x13'));var qs=require(_0x60cf('0x14'));var as=require(_0x60cf('0x15'));var hardwareService=require(_0x60cf('0x16'));var logger=require(_0x60cf('0x17'))(_0x60cf('0x18'));var utils=require(_0x60cf('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x60cf('0x1a'))['db'];function respondWithStatusCode(_0x30bc67,_0x59bd2e){_0x59bd2e=_0x59bd2e||0xcc;return function(_0x4a9bfb){if(_0x4a9bfb){return _0x30bc67[_0x60cf('0x1b')](_0x59bd2e);}return _0x30bc67[_0x60cf('0x1c')](_0x59bd2e)[_0x60cf('0x1d')]();};}function respondWithResult(_0x42dd0e,_0x2b21fa){_0x2b21fa=_0x2b21fa||0xc8;return function(_0x3238de){if(_0x3238de){return _0x42dd0e[_0x60cf('0x1c')](_0x2b21fa)['json'](_0x3238de);}};}function respondWithFilteredResult(_0x137a07,_0x21b269){return function(_0x2ed0d7){if(_0x2ed0d7){var _0x133e50=_0x2ed0d7[_0x60cf('0x1e')],_0x471d81=_0x21b269[_0x60cf('0x1f')],_0x3dc566=_0x21b269[_0x60cf('0x1f')]+_0x21b269[_0x60cf('0x20')],_0xdc6bfa;if(_0x3dc566>=_0x133e50){_0x3dc566=_0x133e50;_0xdc6bfa=0xc8;}else{_0xdc6bfa=0xce;}_0x137a07[_0x60cf('0x1c')](_0xdc6bfa);return _0x137a07[_0x60cf('0x21')](_0x60cf('0x22'),_0x471d81+'-'+_0x3dc566+'/'+_0x133e50)['json'](_0x2ed0d7);}return null;};}function patchUpdates(_0x2e68ba){return function(_0x44f31f){try{jsonpatch[_0x60cf('0x23')](_0x44f31f,_0x2e68ba,!![]);}catch(_0x156bf9){return BPromise[_0x60cf('0x24')](_0x156bf9);}return _0x44f31f[_0x60cf('0x25')]();};}function saveUpdates(_0x1e2026,_0x35138b){return function(_0x60d5c4){if(_0x60d5c4){return _0x60d5c4[_0x60cf('0x26')](_0x1e2026)[_0x60cf('0x27')](function(_0x3f5aa0){return _0x3f5aa0;});}return null;};}function removeEntity(_0x3324a4,_0x5397ba){return function(_0x46ed55){if(_0x46ed55){return _0x46ed55['destroy']()['then'](function(){_0x3324a4[_0x60cf('0x1c')](0xcc)[_0x60cf('0x1d')]();});}};}function handleEntityNotFound(_0x180068,_0x303114){return function(_0x697da5){if(!_0x697da5){_0x180068['sendStatus'](0x194);}return _0x697da5;};}function handleError(_0x3d03f3,_0x4f819e){_0x4f819e=_0x4f819e||0x1f4;return function(_0x48b70d){logger[_0x60cf('0x28')](_0x48b70d[_0x60cf('0x29')]);if(_0x48b70d[_0x60cf('0x2a')]){delete _0x48b70d[_0x60cf('0x2a')];}_0x3d03f3[_0x60cf('0x1c')](_0x4f819e)['send'](_0x48b70d);};}exports[_0x60cf('0x2b')]=function(_0x5d6581,_0x5374f6){var _0x11d432={},_0x3e6cfc={},_0x273c03={'count':0x0,'rows':[]};var _0x3d05c5=_[_0x60cf('0x2c')](db[_0x60cf('0x2d')][_0x60cf('0x2e')],function(_0x4e3080){return{'name':_0x4e3080[_0x60cf('0x2f')],'type':_0x4e3080[_0x60cf('0x30')][_0x60cf('0x31')]};});_0x3e6cfc['model']=_[_0x60cf('0x2c')](_0x3d05c5,'name');_0x3e6cfc[_0x60cf('0x32')]=_[_0x60cf('0x33')](_0x5d6581[_0x60cf('0x32')]);_0x3e6cfc[_0x60cf('0x34')]=_[_0x60cf('0x35')](_0x3e6cfc[_0x60cf('0x36')],_0x3e6cfc[_0x60cf('0x32')]);_0x11d432[_0x60cf('0x37')]=_['intersection'](_0x3e6cfc[_0x60cf('0x36')],qs['fields'](_0x5d6581[_0x60cf('0x32')]['fields']));_0x11d432[_0x60cf('0x37')]=_0x11d432[_0x60cf('0x37')][_0x60cf('0x38')]?_0x11d432[_0x60cf('0x37')]:_0x3e6cfc[_0x60cf('0x36')];if(!_0x5d6581[_0x60cf('0x32')][_0x60cf('0x39')]('nolimit')){_0x11d432['limit']=qs[_0x60cf('0x20')](_0x5d6581[_0x60cf('0x32')][_0x60cf('0x20')]);_0x11d432[_0x60cf('0x1f')]=qs[_0x60cf('0x1f')](_0x5d6581['query'][_0x60cf('0x1f')]);}_0x11d432[_0x60cf('0x3a')]=qs[_0x60cf('0x3b')](_0x5d6581['query'][_0x60cf('0x3b')]);_0x11d432['where']=qs[_0x60cf('0x34')](_['pick'](_0x5d6581['query'],_0x3e6cfc[_0x60cf('0x34')]),_0x3d05c5);if(_0x5d6581[_0x60cf('0x32')][_0x60cf('0x3c')]){_0x11d432[_0x60cf('0x3d')]=_[_0x60cf('0x3e')](_0x11d432['where'],{'$or':_['map'](_0x3d05c5,function(_0x41dc22){if(_0x41dc22[_0x60cf('0x30')]!=='VIRTUAL'){var _0x2a8b5d={};_0x2a8b5d[_0x41dc22[_0x60cf('0x2a')]]={'$like':'%'+_0x5d6581[_0x60cf('0x32')][_0x60cf('0x3c')]+'%'};return _0x2a8b5d;}})});}_0x11d432=_[_0x60cf('0x3e')]({},_0x11d432,_0x5d6581[_0x60cf('0x3f')]);var _0xfef15b={'where':_0x11d432['where']};return db[_0x60cf('0x2d')][_0x60cf('0x1e')](_0xfef15b)[_0x60cf('0x27')](function(_0x164990){_0x273c03[_0x60cf('0x1e')]=_0x164990;if(_0x5d6581[_0x60cf('0x32')][_0x60cf('0x40')]){_0x11d432[_0x60cf('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x11d432);})['then'](function(_0x1a14ae){_0x273c03[_0x60cf('0x42')]=_0x1a14ae;return _0x273c03;})['then'](respondWithFilteredResult(_0x5374f6,_0x11d432))['catch'](handleError(_0x5374f6,null));};exports['show']=function(_0x5d834a,_0x20fe9e){var _0x1cbdb6={'raw':!![],'where':{'id':_0x5d834a[_0x60cf('0x43')]['id']}},_0x3822b7={};_0x3822b7[_0x60cf('0x36')]=_[_0x60cf('0x33')](db[_0x60cf('0x2d')][_0x60cf('0x2e')]);_0x3822b7[_0x60cf('0x32')]=_[_0x60cf('0x33')](_0x5d834a['query']);_0x3822b7[_0x60cf('0x34')]=_[_0x60cf('0x35')](_0x3822b7[_0x60cf('0x36')],_0x3822b7[_0x60cf('0x32')]);_0x1cbdb6['attributes']=_['intersection'](_0x3822b7[_0x60cf('0x36')],qs['fields'](_0x5d834a[_0x60cf('0x32')][_0x60cf('0x44')]));_0x1cbdb6[_0x60cf('0x37')]=_0x1cbdb6['attributes'][_0x60cf('0x38')]?_0x1cbdb6[_0x60cf('0x37')]:_0x3822b7[_0x60cf('0x36')];if(_0x5d834a[_0x60cf('0x32')][_0x60cf('0x40')]){_0x1cbdb6['include']=[{'all':!![]}];}_0x1cbdb6=_['merge']({},_0x1cbdb6,_0x5d834a[_0x60cf('0x3f')]);return db[_0x60cf('0x2d')][_0x60cf('0x45')](_0x1cbdb6)[_0x60cf('0x27')](handleEntityNotFound(_0x20fe9e,null))[_0x60cf('0x27')](respondWithResult(_0x20fe9e,null))[_0x60cf('0x46')](handleError(_0x20fe9e,null));};exports[_0x60cf('0x47')]=function(_0x2d6712,_0x18d8a0){var _0x52c4f8={'where':{'id':_0x2d6712['params']['id']}},_0x718a68={};_0x718a68[_0x60cf('0x36')]=_[_0x60cf('0x33')](db['Attachment'][_0x60cf('0x2e')]);_0x52c4f8[_0x60cf('0x37')]=_['intersection'](_0x718a68[_0x60cf('0x36')],qs[_0x60cf('0x44')](_0x2d6712[_0x60cf('0x32')][_0x60cf('0x44')]));_0x52c4f8[_0x60cf('0x37')]=_0x52c4f8['attributes'][_0x60cf('0x38')]?_0x52c4f8['attributes']:_0x718a68[_0x60cf('0x36')];if(_0x2d6712[_0x60cf('0x32')][_0x60cf('0x40')]){_0x52c4f8[_0x60cf('0x41')]=[{'all':!![]}];}_0x52c4f8=_[_0x60cf('0x3e')]({},_0x52c4f8,_0x2d6712[_0x60cf('0x3f')]);return db[_0x60cf('0x2d')]['find'](_0x52c4f8)[_0x60cf('0x27')](handleEntityNotFound(_0x18d8a0,null))['then'](function(_0x404db5){if(_0x404db5){var _0x1de378=_0x404db5['get']({'plain':!![]});_0x1de378=qs[_0x60cf('0x48')](_0x1de378,['id',_0x60cf('0x49'),_0x60cf('0x4a')]);_0x2d6712['body']=_[_0x60cf('0x48')](_0x2d6712[_0x60cf('0x4b')],['id',_0x60cf('0x49'),_0x60cf('0x4a')]);return db[_0x60cf('0x2d')]['create'](_[_0x60cf('0x3e')](_0x1de378,_0x2d6712['body']),{'include':_0x2d6712['query'][_0x60cf('0x40')]?[{'all':!![]}]:undefined});}})[_0x60cf('0x27')](respondWithResult(_0x18d8a0,0xc9))[_0x60cf('0x46')](handleError(_0x18d8a0,null));};exports['update']=function(_0x17c407,_0x570d00){if(_0x17c407[_0x60cf('0x4b')]['id']){delete _0x17c407['body']['id'];}return db[_0x60cf('0x2d')][_0x60cf('0x45')]({'where':{'id':_0x17c407[_0x60cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x570d00,null))[_0x60cf('0x27')](saveUpdates(_0x17c407[_0x60cf('0x4b')],null))[_0x60cf('0x27')](respondWithResult(_0x570d00,null))[_0x60cf('0x46')](handleError(_0x570d00,null));};exports['destroy']=function(_0x5f50df,_0x1efdb2){return db[_0x60cf('0x2d')]['find']({'where':{'id':_0x5f50df[_0x60cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x1efdb2,null))[_0x60cf('0x27')](removeEntity(_0x1efdb2,null))[_0x60cf('0x46')](handleError(_0x1efdb2,null));};exports[_0x60cf('0x4c')]=function(_0x21e9b5,_0xd3f59,_0x20d953){_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x2a')]=_0x21e9b5[_0x60cf('0x4d')][_0x60cf('0x4e')];_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x4f')]=_0x21e9b5['file']['filename'];_0x21e9b5[_0x60cf('0x4b')][_0x60cf('0x30')]=_0x21e9b5['file'][_0x60cf('0x50')];return db[_0x60cf('0x2d')][_0x60cf('0x4c')](_0x21e9b5[_0x60cf('0x4b')])[_0x60cf('0x27')](respondWithResult(_0xd3f59,0xc9))[_0x60cf('0x46')](handleError(_0xd3f59,null));};exports['download']=function(_0x3f2986,_0x1dd745,_0xa86a81){return db[_0x60cf('0x2d')][_0x60cf('0x51')]({'where':{'id':_0x3f2986[_0x60cf('0x43')]['id']},'raw':!![]})[_0x60cf('0x27')](handleEntityNotFound(_0x1dd745,null))[_0x60cf('0x27')](function(_0x4ca999){if(_0x4ca999){return _0x1dd745[_0x60cf('0x52')](path[_0x60cf('0x53')](config[_0x60cf('0x54')],_0x60cf('0x55'),_0x4ca999['basename']));}})[_0x60cf('0x46')](handleError(_0x1dd745,null));}; \ No newline at end of file +var _0x98e0=['keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','clone','get','omit','createdAt','body','create','file','originalname','basename','filename','download','findOne','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','Attachment','rawAttributes','fieldName','type','key','map','query'];(function(_0x5a8fab,_0x59f5dd){var _0xa041b0=function(_0x350b06){while(--_0x350b06){_0x5a8fab['push'](_0x5a8fab['shift']());}};_0xa041b0(++_0x59f5dd);}(_0x98e0,0xc6));var _0x098e=function(_0x47ac9a,_0xb6a104){_0x47ac9a=_0x47ac9a-0x0;var _0x5f2aa0=_0x98e0[_0x47ac9a];return _0x5f2aa0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x098e('0x0'));var rimraf=require(_0x098e('0x1'));var zipdir=require(_0x098e('0x2'));var jsonpatch=require(_0x098e('0x3'));var rp=require(_0x098e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x098e('0x5'));var path=require(_0x098e('0x6'));var sox=require(_0x098e('0x7'));var csv=require(_0x098e('0x8'));var ejs=require(_0x098e('0x9'));var fs=require('fs');var _=require(_0x098e('0xa'));var squel=require(_0x098e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x098e('0xc'));var toCsv=require(_0x098e('0x8'));var querystring=require(_0x098e('0xd'));var Papa=require(_0x098e('0xe'));var Redis=require(_0x098e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x098e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x098e('0x11'));var logger=require(_0x098e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x098e('0x13'));var licenseUtil=require(_0x098e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dfdb4,_0x2c7159){_0x2c7159=_0x2c7159||0xcc;return function(_0x4a58af){if(_0x4a58af){return _0x4dfdb4[_0x098e('0x15')](_0x2c7159);}return _0x4dfdb4['status'](_0x2c7159)['end']();};}function respondWithResult(_0x37da3d,_0x51d299){_0x51d299=_0x51d299||0xc8;return function(_0x5a506a){if(_0x5a506a){return _0x37da3d[_0x098e('0x16')](_0x51d299)[_0x098e('0x17')](_0x5a506a);}};}function respondWithFilteredResult(_0x49a44f,_0x4ae134){return function(_0xe717ba){if(_0xe717ba){var _0x28656a=_0xe717ba[_0x098e('0x18')],_0x348267=_0x4ae134['offset'],_0x51ea48=_0x4ae134[_0x098e('0x19')]+_0x4ae134[_0x098e('0x1a')],_0x2427c8;if(_0x51ea48>=_0x28656a){_0x51ea48=_0x28656a;_0x2427c8=0xc8;}else{_0x2427c8=0xce;}_0x49a44f[_0x098e('0x16')](_0x2427c8);return _0x49a44f['set'](_0x098e('0x1b'),_0x348267+'-'+_0x51ea48+'/'+_0x28656a)[_0x098e('0x17')](_0xe717ba);}return null;};}function patchUpdates(_0x3e860f){return function(_0xc5c550){try{jsonpatch[_0x098e('0x1c')](_0xc5c550,_0x3e860f,!![]);}catch(_0x464c65){return BPromise[_0x098e('0x1d')](_0x464c65);}return _0xc5c550['save']();};}function saveUpdates(_0x36b8c4,_0x3e68ad){return function(_0x5e3c44){if(_0x5e3c44){return _0x5e3c44[_0x098e('0x1e')](_0x36b8c4)[_0x098e('0x1f')](function(_0x473646){return _0x473646;});}return null;};}function removeEntity(_0x450638,_0x267bc4){return function(_0x3961b2){if(_0x3961b2){return _0x3961b2[_0x098e('0x20')]()[_0x098e('0x1f')](function(){_0x450638[_0x098e('0x16')](0xcc)[_0x098e('0x21')]();});}};}function handleEntityNotFound(_0x4d8f01,_0x4624c6){return function(_0x521adc){if(!_0x521adc){_0x4d8f01[_0x098e('0x15')](0x194);}return _0x521adc;};}function handleError(_0x1283e0,_0x31c235){_0x31c235=_0x31c235||0x1f4;return function(_0x38e93e){logger[_0x098e('0x22')](_0x38e93e[_0x098e('0x23')]);if(_0x38e93e[_0x098e('0x24')]){delete _0x38e93e[_0x098e('0x24')];}_0x1283e0[_0x098e('0x16')](_0x31c235)[_0x098e('0x25')](_0x38e93e);};}exports['index']=function(_0x5cab6b,_0x1c8a83){var _0x138232={},_0x43ad4e={},_0x262207={'count':0x0,'rows':[]};var _0x6604f3=_['map'](db[_0x098e('0x26')][_0x098e('0x27')],function(_0x4e6e3a){return{'name':_0x4e6e3a[_0x098e('0x28')],'type':_0x4e6e3a[_0x098e('0x29')][_0x098e('0x2a')]};});_0x43ad4e['model']=_[_0x098e('0x2b')](_0x6604f3,_0x098e('0x24'));_0x43ad4e[_0x098e('0x2c')]=_[_0x098e('0x2d')](_0x5cab6b[_0x098e('0x2c')]);_0x43ad4e[_0x098e('0x2e')]=_[_0x098e('0x2f')](_0x43ad4e[_0x098e('0x30')],_0x43ad4e[_0x098e('0x2c')]);_0x138232['attributes']=_[_0x098e('0x2f')](_0x43ad4e[_0x098e('0x30')],qs[_0x098e('0x31')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x31')]));_0x138232[_0x098e('0x32')]=_0x138232[_0x098e('0x32')][_0x098e('0x33')]?_0x138232[_0x098e('0x32')]:_0x43ad4e[_0x098e('0x30')];if(!_0x5cab6b[_0x098e('0x2c')]['hasOwnProperty']('nolimit')){_0x138232[_0x098e('0x1a')]=qs[_0x098e('0x1a')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x1a')]);_0x138232[_0x098e('0x19')]=qs[_0x098e('0x19')](_0x5cab6b['query'][_0x098e('0x19')]);}_0x138232[_0x098e('0x34')]=qs[_0x098e('0x35')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x35')]);_0x138232[_0x098e('0x36')]=qs[_0x098e('0x2e')](_[_0x098e('0x37')](_0x5cab6b['query'],_0x43ad4e[_0x098e('0x2e')]),_0x6604f3);if(_0x5cab6b[_0x098e('0x2c')][_0x098e('0x38')]){_0x138232['where']=_[_0x098e('0x39')](_0x138232[_0x098e('0x36')],{'$or':_['map'](_0x6604f3,function(_0x3470bb){if(_0x3470bb[_0x098e('0x29')]!=='VIRTUAL'){var _0x22702d={};_0x22702d[_0x3470bb[_0x098e('0x24')]]={'$like':'%'+_0x5cab6b[_0x098e('0x2c')][_0x098e('0x38')]+'%'};return _0x22702d;}})});}_0x138232=_[_0x098e('0x39')]({},_0x138232,_0x5cab6b[_0x098e('0x3a')]);var _0x2615d6={'where':_0x138232[_0x098e('0x36')]};return db['Attachment'][_0x098e('0x18')](_0x2615d6)[_0x098e('0x1f')](function(_0x41a569){_0x262207[_0x098e('0x18')]=_0x41a569;if(_0x5cab6b[_0x098e('0x2c')][_0x098e('0x3b')]){_0x138232['include']=[{'all':!![]}];}return db[_0x098e('0x26')][_0x098e('0x3c')](_0x138232);})[_0x098e('0x1f')](function(_0x413fca){_0x262207[_0x098e('0x3d')]=_0x413fca;return _0x262207;})[_0x098e('0x1f')](respondWithFilteredResult(_0x1c8a83,_0x138232))[_0x098e('0x3e')](handleError(_0x1c8a83,null));};exports[_0x098e('0x3f')]=function(_0x53563e,_0x1742a0){var _0x45ef20={'raw':!![],'where':{'id':_0x53563e[_0x098e('0x40')]['id']}},_0x5bea38={};_0x5bea38[_0x098e('0x30')]=_[_0x098e('0x2d')](db['Attachment'][_0x098e('0x27')]);_0x5bea38[_0x098e('0x2c')]=_['keys'](_0x53563e['query']);_0x5bea38[_0x098e('0x2e')]=_['intersection'](_0x5bea38['model'],_0x5bea38[_0x098e('0x2c')]);_0x45ef20['attributes']=_[_0x098e('0x2f')](_0x5bea38[_0x098e('0x30')],qs[_0x098e('0x31')](_0x53563e[_0x098e('0x2c')][_0x098e('0x31')]));_0x45ef20[_0x098e('0x32')]=_0x45ef20[_0x098e('0x32')][_0x098e('0x33')]?_0x45ef20[_0x098e('0x32')]:_0x5bea38[_0x098e('0x30')];if(_0x53563e[_0x098e('0x2c')][_0x098e('0x3b')]){_0x45ef20[_0x098e('0x41')]=[{'all':!![]}];}_0x45ef20=_[_0x098e('0x39')]({},_0x45ef20,_0x53563e[_0x098e('0x3a')]);return db[_0x098e('0x26')][_0x098e('0x42')](_0x45ef20)['then'](handleEntityNotFound(_0x1742a0,null))[_0x098e('0x1f')](respondWithResult(_0x1742a0,null))[_0x098e('0x3e')](handleError(_0x1742a0,null));};exports[_0x098e('0x43')]=function(_0x27827a,_0x325b6f){var _0x50ed03={'where':{'id':_0x27827a['params']['id']}},_0x23083f={};_0x23083f[_0x098e('0x30')]=_['keys'](db['Attachment']['rawAttributes']);_0x50ed03[_0x098e('0x32')]=_[_0x098e('0x2f')](_0x23083f['model'],qs[_0x098e('0x31')](_0x27827a[_0x098e('0x2c')][_0x098e('0x31')]));_0x50ed03[_0x098e('0x32')]=_0x50ed03[_0x098e('0x32')][_0x098e('0x33')]?_0x50ed03[_0x098e('0x32')]:_0x23083f[_0x098e('0x30')];if(_0x27827a[_0x098e('0x2c')][_0x098e('0x3b')]){_0x50ed03['include']=[{'all':!![]}];}_0x50ed03=_[_0x098e('0x39')]({},_0x50ed03,_0x27827a[_0x098e('0x3a')]);return db['Attachment'][_0x098e('0x42')](_0x50ed03)[_0x098e('0x1f')](handleEntityNotFound(_0x325b6f,null))[_0x098e('0x1f')](function(_0x362c3c){if(_0x362c3c){var _0x5a5d32=_0x362c3c[_0x098e('0x44')]({'plain':!![]});_0x5a5d32=qs[_0x098e('0x45')](_0x5a5d32,['id',_0x098e('0x46'),'updatedAt']);_0x27827a[_0x098e('0x47')]=_[_0x098e('0x45')](_0x27827a['body'],['id','createdAt','updatedAt']);return db[_0x098e('0x26')][_0x098e('0x48')](_[_0x098e('0x39')](_0x5a5d32,_0x27827a[_0x098e('0x47')]),{'include':_0x27827a['query'][_0x098e('0x3b')]?[{'all':!![]}]:undefined});}})[_0x098e('0x1f')](respondWithResult(_0x325b6f,0xc9))[_0x098e('0x3e')](handleError(_0x325b6f,null));};exports[_0x098e('0x1e')]=function(_0x35c476,_0x286db0){if(_0x35c476[_0x098e('0x47')]['id']){delete _0x35c476[_0x098e('0x47')]['id'];}return db[_0x098e('0x26')]['find']({'where':{'id':_0x35c476[_0x098e('0x40')]['id']}})[_0x098e('0x1f')](handleEntityNotFound(_0x286db0,null))[_0x098e('0x1f')](saveUpdates(_0x35c476[_0x098e('0x47')],null))[_0x098e('0x1f')](respondWithResult(_0x286db0,null))[_0x098e('0x3e')](handleError(_0x286db0,null));};exports[_0x098e('0x20')]=function(_0x45d528,_0x4eeb8e){return db['Attachment'][_0x098e('0x42')]({'where':{'id':_0x45d528[_0x098e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4eeb8e,null))[_0x098e('0x1f')](removeEntity(_0x4eeb8e,null))['catch'](handleError(_0x4eeb8e,null));};exports['create']=function(_0x11b7f8,_0xc42211,_0x28aa9c){_0x11b7f8['body'][_0x098e('0x24')]=_0x11b7f8[_0x098e('0x49')][_0x098e('0x4a')];_0x11b7f8[_0x098e('0x47')][_0x098e('0x4b')]=_0x11b7f8[_0x098e('0x49')][_0x098e('0x4c')];_0x11b7f8[_0x098e('0x47')][_0x098e('0x29')]=_0x11b7f8['file']['mimetype'];return db[_0x098e('0x26')][_0x098e('0x48')](_0x11b7f8[_0x098e('0x47')])[_0x098e('0x1f')](respondWithResult(_0xc42211,0xc9))['catch'](handleError(_0xc42211,null));};exports[_0x098e('0x4d')]=function(_0x367135,_0x3af295,_0x38ddd0){return db[_0x098e('0x26')][_0x098e('0x4e')]({'where':{'id':_0x367135['params']['id']},'raw':!![]})[_0x098e('0x1f')](handleEntityNotFound(_0x3af295,null))[_0x098e('0x1f')](function(_0x2b551f){if(_0x2b551f){return _0x3af295[_0x098e('0x4d')](path[_0x098e('0x4f')](config['root'],_0x098e('0x50'),_0x2b551f[_0x098e('0x4b')]));}})[_0x098e('0x3e')](handleError(_0x3af295,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 910b762..7f4b42e 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 _0x8f1a=['moment','bluebird','request-promise','path','./attachment.attributes','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x31a3b8,_0x5a0fe9){var _0x17fbd8=function(_0x128ccc){while(--_0x128ccc){_0x31a3b8['push'](_0x31a3b8['shift']());}};_0x17fbd8(++_0x5a0fe9);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x14e4e0,_0x1fd9b4){_0x14e4e0=_0x14e4e0-0x0;var _0x4a8c67=_0x8f1a[_0x14e4e0];return _0x4a8c67;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var logger=require(_0xa8f1('0x2'))(_0xa8f1('0x3'));var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var rp=require(_0xa8f1('0x6'));var fs=require('fs');var path=require(_0xa8f1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8f1('0x8'));module['exports']=function(_0x1b067d,_0x3d62e4){return _0x1b067d['define'](_0xa8f1('0x9'),attributes,{'tableName':_0xa8f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf92=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','api','moment','bluebird','request-promise'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xdf92,0x10c));var _0x2df9=function(_0x4b1041,_0x3ec6a2){_0x4b1041=_0x4b1041-0x0;var _0x3f918e=_0xdf92[_0x4b1041];return _0x3f918e;};'use strict';var _=require(_0x2df9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2df9('0x1'));var moment=require(_0x2df9('0x2'));var BPromise=require(_0x2df9('0x3'));var rp=require(_0x2df9('0x4'));var fs=require('fs');var path=require(_0x2df9('0x5'));var rimraf=require(_0x2df9('0x6'));var config=require(_0x2df9('0x7'));var attributes=require(_0x2df9('0x8'));module[_0x2df9('0x9')]=function(_0x125317,_0x5b6e79){return _0x125317[_0x2df9('0xa')](_0x2df9('0xb'),attributes,{'tableName':_0x2df9('0xc'),'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 d0b4e86..b02b3cb 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 _0x9d6e=['CreateAttachment','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0x9d6e,0x1a1));var _0xe9d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d6e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe9d6('0x0'));var moment=require(_0xe9d6('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9d6('0x2'));var fs=require('fs');var Redis=require(_0xe9d6('0x3'));var db=require(_0xe9d6('0x4'))['db'];var utils=require(_0xe9d6('0x5'));var logger=require(_0xe9d6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe9d6('0x7'));var client=jayson[_0xe9d6('0x8')][_0xe9d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b62b,_0x3b1fd0,_0x40ee39){return new BPromise(function(_0x53162d,_0x55b32f){return client[_0xe9d6('0xa')](_0x19b62b,_0x40ee39)[_0xe9d6('0xb')](function(_0x52be38){logger[_0xe9d6('0xc')](_0xe9d6('0xd'),_0x3b1fd0,_0xe9d6('0xe'));logger['debug'](_0xe9d6('0xf'),_0x3b1fd0,_0xe9d6('0xe'),JSON[_0xe9d6('0x10')](_0x52be38));if(_0x52be38[_0xe9d6('0x11')]){if(_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x12')]===0x1f4){logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x13')]);return _0x55b32f(_0x52be38[_0xe9d6('0x11')][_0xe9d6('0x13')]);}logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x52be38['error']['message']);return _0x53162d(_0x52be38['error'][_0xe9d6('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x3b1fd0,'request\x20sent');_0x53162d(_0x52be38['result']['message']);}})[_0xe9d6('0x14')](function(_0x22380d){logger[_0xe9d6('0x11')](_0xe9d6('0xd'),_0x3b1fd0,_0x22380d);_0x55b32f(_0x22380d);});});}exports['CreateAttachment']=function(_0x51f98f){var _0x45390f=this;return new Promise(function(_0x3aee8c,_0x4d3405){return db['Attachment'][_0xe9d6('0x15')](_0x51f98f[_0xe9d6('0x16')],{'raw':_0x51f98f[_0xe9d6('0x17')]?_0x51f98f[_0xe9d6('0x17')][_0xe9d6('0x18')]===undefined?!![]:![]:!![]})[_0xe9d6('0xb')](function(_0x293402){logger[_0xe9d6('0xc')](_0xe9d6('0x19'),_0x51f98f);logger['debug'](_0xe9d6('0x19'),_0x51f98f,JSON[_0xe9d6('0x10')](_0x293402));_0x3aee8c(_0x293402);})[_0xe9d6('0x14')](function(_0x2fe1f4){logger['error']('CreateAttachment',_0x2fe1f4['message'],_0x51f98f);_0x4d3405(_0x45390f['error'](0x1f4,_0x2fe1f4[_0xe9d6('0x13')]));});});}; \ No newline at end of file +var _0xdabd=['options','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','body'];(function(_0x335af8,_0x56c707){var _0x4f7220=function(_0x27ccf9){while(--_0x27ccf9){_0x335af8['push'](_0x335af8['shift']());}};_0x4f7220(++_0x56c707);}(_0xdabd,0xbf));var _0xddab=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xdabd[_0x519756];return _0x37047e;};'use strict';var _=require(_0xddab('0x0'));var util=require(_0xddab('0x1'));var moment=require(_0xddab('0x2'));var BPromise=require(_0xddab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddab('0x5'));var logger=require(_0xddab('0x6'))(_0xddab('0x7'));var config=require(_0xddab('0x8'));var jayson=require(_0xddab('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54511d,_0x2074ac,_0x3de23d){return new BPromise(function(_0x137a88,_0x4ff608){return client[_0xddab('0xa')](_0x54511d,_0x3de23d)[_0xddab('0xb')](function(_0x197ea1){logger[_0xddab('0xc')](_0xddab('0xd'),_0x2074ac,_0xddab('0xe'));logger[_0xddab('0xf')](_0xddab('0x10'),_0x2074ac,_0xddab('0xe'),JSON['stringify'](_0x197ea1));if(_0x197ea1[_0xddab('0x11')]){if(_0x197ea1[_0xddab('0x11')][_0xddab('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x2074ac,_0x197ea1[_0xddab('0x11')][_0xddab('0x13')]);return _0x4ff608(_0x197ea1[_0xddab('0x11')]['message']);}logger[_0xddab('0x11')](_0xddab('0xd'),_0x2074ac,_0x197ea1[_0xddab('0x11')][_0xddab('0x13')]);return _0x137a88(_0x197ea1['error'][_0xddab('0x13')]);}else{logger[_0xddab('0xc')](_0xddab('0xd'),_0x2074ac,_0xddab('0xe'));_0x137a88(_0x197ea1[_0xddab('0x14')]['message']);}})['catch'](function(_0x4495ea){logger['error'](_0xddab('0xd'),_0x2074ac,_0x4495ea);_0x4ff608(_0x4495ea);});});}exports[_0xddab('0x15')]=function(_0x107701){var _0x634831=this;return new Promise(function(_0x3339b1,_0x2f306b){return db[_0xddab('0x16')][_0xddab('0x17')](_0x107701[_0xddab('0x18')],{'raw':_0x107701[_0xddab('0x19')]?_0x107701[_0xddab('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4ca67e){logger['info'](_0xddab('0x15'),_0x107701);logger[_0xddab('0xf')]('CreateAttachment',_0x107701,JSON['stringify'](_0x4ca67e));_0x3339b1(_0x4ca67e);})[_0xddab('0x1a')](function(_0x4199eb){logger[_0xddab('0x11')]('CreateAttachment',_0x4199eb[_0xddab('0x13')],_0x107701);_0x2f306b(_0x634831[_0xddab('0x11')](0x1f4,_0x4199eb[_0xddab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ffddcfc..09f9fde 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 _0xa19c=['single','file','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa19c,0xce));var _0xca19=function(_0xe3ca1f,_0x1e954e){_0xe3ca1f=_0xe3ca1f-0x0;var _0x3f1f9a=_0xa19c[_0xe3ca1f];return _0x3f1f9a;};'use strict';var multer=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var path=require(_0xca19('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca19('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xca19('0x4'));var config=require(_0xca19('0x5'));var controller=require(_0xca19('0x6'));router[_0xca19('0x7')]('/',auth['isAuthenticated'](),controller[_0xca19('0x8')]);router['get'](_0xca19('0x9'),auth['isAuthenticated'](),controller[_0xca19('0xa')]);router['get'](_0xca19('0xb'),auth[_0xca19('0xc')](),controller[_0xca19('0xd')]);router[_0xca19('0xe')](_0xca19('0xf'),auth['isAuthenticated'](),controller[_0xca19('0x10')]);var upload=multer({'storage':multer[_0xca19('0x11')]({'destination':function(_0x3ff87d,_0x32434a,_0x3c6e10){_0x3c6e10(null,path[_0xca19('0x12')](config[_0xca19('0x13')],_0xca19('0x14')));},'filename':function(_0x127e02,_0x1389ce,_0x274a91){_0x274a91(null,util['format'](_0xca19('0x15'),Date[_0xca19('0x16')](),_0x1389ce[_0xca19('0x17')][_0xca19('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca19('0xe')]('/',upload[_0xca19('0x19')](_0xca19('0x1a')),controller[_0xca19('0x1b')]);router[_0xca19('0x1c')](_0xca19('0x9'),auth[_0xca19('0xc')](),controller[_0xca19('0x1d')]);router[_0xca19('0x1e')]('/:id',auth[_0xca19('0xc')](),controller[_0xca19('0x1f')]);module[_0xca19('0x20')]=router; \ No newline at end of file +var _0x66d8=['/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','single','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','post'];(function(_0x1de85c,_0x2ba61c){var _0x3f4960=function(_0x117af3){while(--_0x117af3){_0x1de85c['push'](_0x1de85c['shift']());}};_0x3f4960(++_0x2ba61c);}(_0x66d8,0x1c1));var _0x866d=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x66d8[_0xf4d05];return _0x47c971;};'use strict';var multer=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var path=require(_0x866d('0x2'));var timeout=require(_0x866d('0x3'));var express=require(_0x866d('0x4'));var router=express[_0x866d('0x5')]();var auth=require(_0x866d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x866d('0x7'));var controller=require(_0x866d('0x8'));router[_0x866d('0x9')]('/',auth['isAuthenticated'](),controller[_0x866d('0xa')]);router['get'](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0xd')]);router[_0x866d('0x9')]('/:id/download',auth[_0x866d('0xc')](),controller[_0x866d('0xe')]);router[_0x866d('0xf')](_0x866d('0x10'),auth[_0x866d('0xc')](),controller[_0x866d('0x11')]);var upload=multer({'storage':multer[_0x866d('0x12')]({'destination':function(_0x2ad68f,_0x1da8d9,_0x709155){_0x709155(null,path[_0x866d('0x13')](config[_0x866d('0x14')],_0x866d('0x15')));},'filename':function(_0x317e0f,_0x501e56,_0x109fc4){_0x109fc4(null,util[_0x866d('0x16')](_0x866d('0x17'),Date[_0x866d('0x18')](),_0x501e56['originalname'][_0x866d('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x866d('0xf')]('/',upload[_0x866d('0x1a')]('file'),controller['create']);router[_0x866d('0x1b')](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0x1c')]);router['delete'](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0x1d')]);module[_0x866d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index cbb9a77..e9a2e2f 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 _0x490b=['User','find','map','value','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate','/login','profile','email','callback','google','clientID','clientSecret','callbackURL','allowedLoginAttempts'];(function(_0x53450e,_0x3417d4){var _0x4d6c5a=function(_0x2961a1){while(--_0x2961a1){_0x53450e['push'](_0x53450e['shift']());}};_0x4d6c5a(++_0x3417d4);}(_0x490b,0xde));var _0xb490=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x490b[_0x3c7d53];return _0x2c8387;};'use strict';var _=require(_0xb490('0x0'));var passport=require(_0xb490('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xb490('0x2')];var moment=require(_0xb490('0x3'));var db=require(_0xb490('0x4'))['db'];var config=require(_0xb490('0x5'));var signToken=require(_0xb490('0x6'))[_0xb490('0x7')];var utils=require('../../config/utils');exports['login']=passport[_0xb490('0x8')]('google',{'failureRedirect':_0xb490('0x9'),'scope':[_0xb490('0xa'),_0xb490('0xb')],'session':![]});exports[_0xb490('0xc')]=passport[_0xb490('0x8')](_0xb490('0xd'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0xb490('0xd')][_0xb490('0xe')]:'id','clientSecret':config[_0xb490('0xd')]?config[_0xb490('0xd')][_0xb490('0xf')]:'secret','callbackURL':config[_0xb490('0xd')]?config['google'][_0xb490('0x10')]:''},function(_0x6a288a,_0x54c63b,_0x339711,_0x50224a){var _0x4f40e2,_0x5521b2;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb490('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x31b114){_0x4f40e2=_0x31b114;return db[_0xb490('0x12')][_0xb490('0x13')]({'where':{'email':_[_0xb490('0x14')](_0x339711['emails'],_0xb490('0x15')),'role':{'$or':['admin',_0xb490('0x16'),'agent']}}});})[_0xb490('0x17')](function(_0x514875){_0x5521b2=_0x514875;if(_0x5521b2){if(_0x5521b2['disabled']){return _0x50224a(_0xb490('0x18'));}else if(_0x4f40e2[_0xb490('0x19')]>0x0){if(_0x5521b2['blocked']){if(moment(_0x5521b2[_0xb490('0x1a')])[_0xb490('0x1b')](_0x4f40e2[_0xb490('0x19')],'minutes')>moment()){return _0x50224a(_0xb490('0x18'));}else{return utils['clearBlockUser'](_0x5521b2,0x0,![],null)[_0xb490('0x17')](function(){return utils[_0xb490('0x1c')](_0x5521b2);})[_0xb490('0x17')](function(){return _0x50224a(null,_0x5521b2);});}}else{return utils[_0xb490('0x1c')](_0x5521b2)['then'](function(){return _0x50224a(null,_0x5521b2);});}}else{return utils[_0xb490('0x1c')](_0x5521b2)[_0xb490('0x17')](function(){return _0x50224a(null,_0x5521b2);});}}return _0x50224a(_0xb490('0x18'));})[_0xb490('0x1d')](function(_0x573891){_0x50224a(_0x573891);});})); \ No newline at end of file +var _0xc14a=['moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','profile','email','callback','authenticate','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','value','user','agent','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20'];(function(_0x4b52d6,_0x989c59){var _0x436cc4=function(_0x1e8fe6){while(--_0x1e8fe6){_0x4b52d6['push'](_0x4b52d6['shift']());}};_0x436cc4(++_0x989c59);}(_0xc14a,0x138));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xac14('0x0'));var passport=require(_0xac14('0x1'));var GoogleStrategy=require(_0xac14('0x2'))['Strategy'];var moment=require(_0xac14('0x3'));var db=require(_0xac14('0x4'))['db'];var config=require(_0xac14('0x5'));var signToken=require(_0xac14('0x6'))[_0xac14('0x7')];var utils=require(_0xac14('0x8'));exports[_0xac14('0x9')]=passport['authenticate'](_0xac14('0xa'),{'failureRedirect':'/login','scope':[_0xac14('0xb'),_0xac14('0xc')],'session':![]});exports[_0xac14('0xd')]=passport[_0xac14('0xe')](_0xac14('0xa'),{'failureRedirect':'/login','session':![]});passport[_0xac14('0xf')](new GoogleStrategy({'clientID':config[_0xac14('0xa')]?config['google'][_0xac14('0x10')]:'id','clientSecret':config[_0xac14('0xa')]?config['google']['clientSecret']:_0xac14('0x11'),'callbackURL':config[_0xac14('0xa')]?config[_0xac14('0xa')][_0xac14('0x12')]:''},function(_0x204199,_0x16e16b,_0xdf6cad,_0x48c50b){var _0x23706f,_0x5c0d95;return db[_0xac14('0x13')][_0xac14('0x14')]({'where':{'id':0x1},'attributes':[_0xac14('0x15'),_0xac14('0x16')],'raw':!![]})[_0xac14('0x17')](function(_0xcc2259){_0x23706f=_0xcc2259;return db[_0xac14('0x18')]['find']({'where':{'email':_[_0xac14('0x19')](_0xdf6cad['emails'],_0xac14('0x1a')),'role':{'$or':['admin',_0xac14('0x1b'),_0xac14('0x1c')]}}});})[_0xac14('0x17')](function(_0x3fdf86){_0x5c0d95=_0x3fdf86;if(_0x5c0d95){if(_0x5c0d95['disabled']){return _0x48c50b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x23706f['blockDuration']>0x0){if(_0x5c0d95['blocked']){if(moment(_0x5c0d95[_0xac14('0x1d')])[_0xac14('0x1e')](_0x23706f[_0xac14('0x16')],'minutes')>moment()){return _0x48c50b(_0xac14('0x1f'));}else{return utils[_0xac14('0x20')](_0x5c0d95,0x0,![],null)[_0xac14('0x17')](function(){return utils[_0xac14('0x21')](_0x5c0d95);})['then'](function(){return _0x48c50b(null,_0x5c0d95);});}}else{return utils['getLicense'](_0x5c0d95)[_0xac14('0x17')](function(){return _0x48c50b(null,_0x5c0d95);});}}else{return utils[_0xac14('0x21')](_0x5c0d95)[_0xac14('0x17')](function(){return _0x48c50b(null,_0x5c0d95);});}}return _0x48c50b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xac14('0x22')](function(_0x40dd6f){_0x48c50b(_0x40dd6f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 437b816..7efb899 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 _0x593e=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x82c14e,_0x333edc){var _0x201931=function(_0x255615){while(--_0x255615){_0x82c14e['push'](_0x82c14e['shift']());}};_0x201931(++_0x333edc);}(_0x593e,0xcb));var _0xe593=function(_0x4ea1da,_0x4afdd7){_0x4ea1da=_0x4ea1da-0x0;var _0x201ce4=_0x593e[_0x4ea1da];return _0x201ce4;};'use strict';var express=require(_0xe593('0x0'));var passport=require(_0xe593('0x1'));var router=express[_0xe593('0x2')]();var controller=require(_0xe593('0x3'));var userController=require(_0xe593('0x4'));var authService=require(_0xe593('0x5'));router[_0xe593('0x6')]('/',controller[_0xe593('0x7')]);router['get'](_0xe593('0x8'),controller[_0xe593('0x9')],authService[_0xe593('0xa')],userController[_0xe593('0x7')],authService[_0xe593('0xb')]);module[_0xe593('0xc')]=router; \ No newline at end of file +var _0x94b1=['../../components/auth/service','login','get','/callback','callback','setTokenCookie','passport','./authGoogle.controller','../user/user.controller.js'];(function(_0x2142fa,_0x1e9945){var _0x350983=function(_0x125657){while(--_0x125657){_0x2142fa['push'](_0x2142fa['shift']());}};_0x350983(++_0x1e9945);}(_0x94b1,0x102));var _0x194b=function(_0x1c85ef,_0x51e609){_0x1c85ef=_0x1c85ef-0x0;var _0x2ed48b=_0x94b1[_0x1c85ef];return _0x2ed48b;};'use strict';var express=require('express');var passport=require(_0x194b('0x0'));var router=express['Router']();var controller=require(_0x194b('0x1'));var userController=require(_0x194b('0x2'));var authService=require(_0x194b('0x3'));router['get']('/',controller[_0x194b('0x4')]);router[_0x194b('0x5')](_0x194b('0x6'),controller[_0x194b('0x7')],authService['isMiddleware'],userController[_0x194b('0x4')],authService[_0x194b('0x8')]);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 f5b5dac..d3bdc69 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 _0x3f8a=['authentication','auth','merge','\x22%s\x22\x20<%s>','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','status','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure'];(function(_0x5cfb28,_0x3e0693){var _0x5e6336=function(_0x2cbcc1){while(--_0x2cbcc1){_0x5cfb28['push'](_0x5cfb28['shift']());}};_0x5e6336(++_0x3e0693);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x394a2d,_0x460cf0){_0x394a2d=_0x394a2d-0x0;var _0x4a5274=_0x3f8a[_0x394a2d];return _0x4a5274;};'use strict';var util=require(_0xa3f8('0x0'));var passport=require(_0xa3f8('0x1'));var LocalStrategy=require(_0xa3f8('0x2'))[_0xa3f8('0x3')];var jayson=require('jayson/promise');var _=require(_0xa3f8('0x4'));var rs=require(_0xa3f8('0x5'));var moment=require(_0xa3f8('0x6'));var db=require(_0xa3f8('0x7'))['db'];var authService=require(_0xa3f8('0x8'));var utils=require(_0xa3f8('0x9'));var client=jayson[_0xa3f8('0xa')][_0xa3f8('0xb')]({'port':0x232b});function localAuthenticate(_0x1f160a,_0xf895d9,_0xcfea5,_0x268332){var _0x2faf2e,_0x2448de;return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'where':{'id':0x1},'attributes':[_0xa3f8('0xe'),'blockDuration'],'raw':!![]})[_0xa3f8('0xf')](function(_0x13a082){_0x2faf2e=_0x13a082;return _0x1f160a[_0xa3f8('0xd')]({'attributes':['id',_0xa3f8('0x10'),'password',_0xa3f8('0x11'),_0xa3f8('0x12'),_0xa3f8('0x13'),_0xa3f8('0x14'),_0xa3f8('0x15'),_0xa3f8('0x16')],'where':{'name':_0xf895d9,'role':{'$or':[_0xa3f8('0x17'),_0xa3f8('0x18'),_0xa3f8('0x19')]}}});})[_0xa3f8('0xf')](function(_0x21b88f){if(!_0x21b88f||_0x21b88f&&_0x21b88f[_0xa3f8('0x10')]!==_0xf895d9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2448de=_0x21b88f;return _0x2448de;}})[_0xa3f8('0xf')](function(){_0x2448de[_0xa3f8('0x1a')](_0xcfea5,function(_0x45014f,_0x21a170){var _0x5caebf=_0x2448de[_0xa3f8('0x16')]+0x1;if(_0x45014f){return _0x268332(_0x45014f);}else if(!_0x21a170){if(_0x2448de[_0xa3f8('0x13')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else if(_0x2faf2e[_0xa3f8('0xe')]>0x0){if(_0x2448de[_0xa3f8('0x14')]){if(_0x2faf2e[_0xa3f8('0x1c')]>0x0){if(moment(_0x2448de[_0xa3f8('0x15')])[_0xa3f8('0x1d')](_0x2faf2e[_0xa3f8('0x1c')],_0xa3f8('0x1e'))>moment()){return _0x268332(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa3f8('0x1f')](_0x2448de,_0x5caebf,![],null)['then'](function(){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});});}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{if(_0x5caebf>=_0x2faf2e[_0xa3f8('0xe')]){return utils[_0xa3f8('0x1f')](_0x2448de,0x0,!![],moment())['then'](function(){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});});}else{return utils['clearBlockUser'](_0x2448de,_0x5caebf,![],null)[_0xa3f8('0xf')](function(){return _0x268332(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{if(_0x2448de[_0xa3f8('0x13')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else if(_0x2faf2e[_0xa3f8('0xe')]>0x0){if(_0x2448de[_0xa3f8('0x14')]){if(_0x2faf2e[_0xa3f8('0x1c')]>0x0){if(moment(_0x2448de[_0xa3f8('0x15')])['add'](_0x2faf2e[_0xa3f8('0x1c')],'minutes')>moment()){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else{return utils[_0xa3f8('0x1f')](_0x2448de,0x0,![],null)[_0xa3f8('0xf')](function(){return utils[_0xa3f8('0x20')](_0x2448de);})[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);});}}else{return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}}else{return utils[_0xa3f8('0x1f')](_0x2448de,0x0,![],null)[_0xa3f8('0xf')](function(){return utils[_0xa3f8('0x20')](_0x2448de);})[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);})['catch'](function(_0x1c3358){return _0x268332(null,![],_0x1c3358);});}}else{if(_0x2448de[_0xa3f8('0x14')]){return _0x268332(null,![],{'message':_0xa3f8('0x1b')});}else{return utils['getLicense'](_0x2448de)[_0xa3f8('0xf')](function(){return _0x268332(null,_0x2448de);});}}}});})['catch'](function(_0xbad6a6){return _0x268332(null,![],_0xbad6a6);});}function sendServiceMail(_0x3a3746){return db[_0xa3f8('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xa3f8('0x10'),'email'],'include':[{'model':db[_0xa3f8('0x22')],'as':_0xa3f8('0x23')}]})[_0xa3f8('0xf')](function(_0x406140){if(!_0x406140){throw new Error(_0xa3f8('0x24'));}var _0x3bf3f8={'tls':{'rejectUnauthorized':![]}};if(_0x406140[_0xa3f8('0x23')][_0xa3f8('0x25')]){_0x3bf3f8[_0xa3f8('0x25')]=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x25')];}else{_0x3bf3f8['host']=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x26')];_0x3bf3f8[_0xa3f8('0x27')]=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x27')];_0x3bf3f8['secure']=_0x406140[_0xa3f8('0x23')][_0xa3f8('0x28')];}if(_0x406140['Smtp'][_0xa3f8('0x29')]){_0x3bf3f8[_0xa3f8('0x2a')]={'user':_0x406140['Smtp'][_0xa3f8('0x18')],'pass':_0x406140['Smtp']['pass']};}var _0x129190={'account':_0x3bf3f8,'message':_[_0xa3f8('0x2b')]({'from':util['format'](_0xa3f8('0x2c'),_0x406140['name'],_0x406140[_0xa3f8('0x2d')]||_0x406140[_0xa3f8('0x23')][_0xa3f8('0x18')])},_0x3a3746)};return client[_0xa3f8('0x2e')]('SendMail',_0x129190);})[_0xa3f8('0xf')](function(_0x53c7b2){if(_0x53c7b2[_0xa3f8('0x2f')]){throw new Error(util['format'](_0xa3f8('0x30'),_0x53c7b2['error']['message']||JSON['stringify'](_0x53c7b2[_0xa3f8('0x2f')])));}return!![];});}function handleError(_0x1674f1,_0x1acf4f,_0x2ffeb3){return _0x1674f1['status'](_0x1acf4f||0x1f4)[_0xa3f8('0x31')]({'message':_0x2ffeb3?_0x2ffeb3[_0xa3f8('0x32')]||_0x2ffeb3:''});}exports[_0xa3f8('0x33')]=function(_0x858f53,_0x238da1,_0x3655c0){passport['authenticate'](_0xa3f8('0x34'),function(_0x3dfb9,_0x38c75b,_0x51de10){var _0x941bde=_0x3dfb9||_0x51de10;if(_0x941bde){return handleError(_0x238da1,0x191,_0x941bde);}if(!_0x38c75b){return handleError(_0x238da1,0x194,{'message':_0xa3f8('0x35')});}else{var _0x5ce212={'payload':{'id':_0x38c75b['id'],'role':_0x38c75b[_0xa3f8('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5ce212)[_0xa3f8('0xf')](function(_0x5a077c){_0x238da1[_0xa3f8('0x36')]({'id':_0x38c75b['id'],'token':_0x5a077c,'statusCall':'','isAlreadyLogged':_0x38c75b[_0xa3f8('0x37')]});});}})(_0x858f53,_0x238da1,_0x3655c0);};exports[_0xa3f8('0x38')]=function(_0x2a77be,_0x10534b,_0x53fc38){if(!_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]){return handleError(_0x10534b,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x27c938=rs['generate']();_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]=_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')][_0xa3f8('0x3a')]()['toLowerCase']();var _0x180e87;return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'where':{'id':0x1},'attributes':[_0xa3f8('0xe'),_0xa3f8('0x1c')],'raw':!![]})['then'](function(_0x306f08){_0x180e87=_0x306f08;return db[_0xa3f8('0x3b')][_0xa3f8('0x3c')]({'where':{'email':_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')]}});})[_0xa3f8('0xf')](function(_0x497217){if(!_0x497217){throw new Error(_0xa3f8('0x3d'));}if(_0x497217[_0xa3f8('0x13')]){throw new Error(_0xa3f8('0x3e'));}if(_0x497217[_0xa3f8('0x14')]){if(moment(_0x497217[_0xa3f8('0x15')])[_0xa3f8('0x1d')](_0x180e87['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x497217[_0xa3f8('0x14')]=![];_0x497217[_0xa3f8('0x15')]=null;}}_0x497217[_0xa3f8('0x3f')]=_0x27c938;_0x497217[_0xa3f8('0x40')]=Date[_0xa3f8('0x41')]()+0x36ee80;return _0x497217[_0xa3f8('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x2a77be[_0xa3f8('0x39')][_0xa3f8('0x2d')],'subject':_0xa3f8('0x43'),'text':_0xa3f8('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xa3f8('0x45')+_0x2a77be[_0xa3f8('0x46')][_0xa3f8('0x26')]+'/reset/'+_0x27c938+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x10534b[_0xa3f8('0x47')](0xc8)[_0xa3f8('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0xa3f8('0x48')](function(_0x1f7af7){return handleError(_0x10534b,0x1f4,_0x1f7af7);});};exports[_0xa3f8('0x49')]=function(_0x142481,_0x14932f,_0x3c74b5){return db[_0xa3f8('0x3b')][_0xa3f8('0x3c')]({'where':{'resetPasswordToken':_0x142481[_0xa3f8('0x4a')][_0xa3f8('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xa3f8('0x41')]()}}})[_0xa3f8('0xf')](function(_0x23f44b){if(!_0x23f44b){throw new Error(_0xa3f8('0x4c'));}return db[_0xa3f8('0xc')][_0xa3f8('0xd')]({'attributes':['id',_0xa3f8('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa3f8('0xf')](function(_0x33fd07){if(_0x33fd07['securePassword'])authService[_0xa3f8('0x4e')](_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')]);if(!_0x33fd07[_0xa3f8('0x50')]||!_0x23f44b[_0xa3f8('0x51')])return _0x23f44b;authService[_0xa3f8('0x52')](_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')],_0x23f44b[_0xa3f8('0x51')],_0x33fd07[_0xa3f8('0x53')]);return _0x23f44b;})[_0xa3f8('0xf')](function(){_0x23f44b[_0xa3f8('0x4f')]=_0x142481[_0xa3f8('0x39')][_0xa3f8('0x4f')];_0x23f44b[_0xa3f8('0x3f')]=null;_0x23f44b[_0xa3f8('0x40')]=null;return _0x23f44b['save']();});})['then'](function(){_0x14932f[_0xa3f8('0x47')](0xc8)['send']({'message':_0xa3f8('0x54')});})[_0xa3f8('0x48')](function(_0x344083){return handleError(_0x14932f,0x1f4,_0x344083);});};passport['use'](new LocalStrategy({'usernameField':_0xa3f8('0x10'),'passwordField':_0xa3f8('0x4f')},function(_0x418be8,_0x1b221b,_0x572305){return localAuthenticate(db[_0xa3f8('0x3b')],_0x418be8,_0x1b221b,_0x572305);})); \ No newline at end of file +var _0x6a55=['clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','SendMail','error','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','jayson/promise','moment','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes'];(function(_0x149627,_0x37e919){var _0x24e317=function(_0x4fe691){while(--_0x4fe691){_0x149627['push'](_0x149627['shift']());}};_0x24e317(++_0x37e919);}(_0x6a55,0xdb));var _0x56a5=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x6a55[_0xfd495c];return _0x561dd8;};'use strict';var util=require(_0x56a5('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x56a5('0x1'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x56a5('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0x56a5('0x3'));var utils=require('../../config/utils');var client=jayson[_0x56a5('0x4')][_0x56a5('0x5')]({'port':0x232b});function localAuthenticate(_0x42d164,_0x293ea1,_0x444c65,_0x2272d9){var _0x2b8f57,_0x387dcb;return db['Setting'][_0x56a5('0x6')]({'where':{'id':0x1},'attributes':[_0x56a5('0x7'),_0x56a5('0x8')],'raw':!![]})[_0x56a5('0x9')](function(_0x3f4fe0){_0x2b8f57=_0x3f4fe0;return _0x42d164[_0x56a5('0x6')]({'attributes':['id',_0x56a5('0xa'),_0x56a5('0xb'),_0x56a5('0xc'),'role','disabled',_0x56a5('0xd'),_0x56a5('0xe'),_0x56a5('0xf')],'where':{'name':_0x293ea1,'role':{'$or':[_0x56a5('0x10'),_0x56a5('0x11'),_0x56a5('0x12')]}}});})['then'](function(_0x4a6dc5){if(!_0x4a6dc5||_0x4a6dc5&&_0x4a6dc5[_0x56a5('0xa')]!==_0x293ea1){throw new Error(_0x56a5('0x13'));}else{_0x387dcb=_0x4a6dc5;return _0x387dcb;}})[_0x56a5('0x9')](function(){_0x387dcb[_0x56a5('0x14')](_0x444c65,function(_0x310c32,_0x2db112){var _0xe3091f=_0x387dcb['loginAttempts']+0x1;if(_0x310c32){return _0x2272d9(_0x310c32);}else if(!_0x2db112){if(_0x387dcb[_0x56a5('0x15')]){return _0x2272d9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2b8f57[_0x56a5('0x7')]>0x0){if(_0x387dcb['blocked']){if(_0x2b8f57[_0x56a5('0x8')]>0x0){if(moment(_0x387dcb[_0x56a5('0xe')])[_0x56a5('0x16')](_0x2b8f57[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x18')](_0x387dcb,_0xe3091f,![],null)['then'](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{if(_0xe3091f>=_0x2b8f57[_0x56a5('0x7')]){return utils[_0x56a5('0x18')](_0x387dcb,0x0,!![],moment())['then'](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}else{return utils[_0x56a5('0x18')](_0x387dcb,_0xe3091f,![],null)[_0x56a5('0x9')](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{if(_0x387dcb['disabled']){return _0x2272d9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2b8f57[_0x56a5('0x7')]>0x0){if(_0x387dcb[_0x56a5('0xd')]){if(_0x2b8f57['blockDuration']>0x0){if(moment(_0x387dcb[_0x56a5('0xe')])[_0x56a5('0x16')](_0x2b8f57[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x18')](_0x387dcb,0x0,![],null)[_0x56a5('0x9')](function(){return utils[_0x56a5('0x19')](_0x387dcb);})[_0x56a5('0x9')](function(){return _0x2272d9(null,_0x387dcb);});}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{return utils[_0x56a5('0x18')](_0x387dcb,0x0,![],null)[_0x56a5('0x9')](function(){return utils[_0x56a5('0x19')](_0x387dcb);})['then'](function(){return _0x2272d9(null,_0x387dcb);})[_0x56a5('0x1a')](function(_0x2d8e68){return _0x2272d9(null,![],_0x2d8e68);});}}else{if(_0x387dcb[_0x56a5('0xd')]){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x19')](_0x387dcb)['then'](function(){return _0x2272d9(null,_0x387dcb);});}}}});})[_0x56a5('0x1a')](function(_0x54ec36){return _0x2272d9(null,![],_0x54ec36);});}function sendServiceMail(_0x2efde7){return db[_0x56a5('0x1b')][_0x56a5('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x56a5('0xa'),'email'],'include':[{'model':db[_0x56a5('0x1d')],'as':_0x56a5('0x1e')}]})[_0x56a5('0x9')](function(_0x51ef6f){if(!_0x51ef6f){throw new Error(_0x56a5('0x1f'));}var _0x29dbe7={'tls':{'rejectUnauthorized':![]}};if(_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x20')]){_0x29dbe7[_0x56a5('0x20')]=_0x51ef6f['Smtp'][_0x56a5('0x20')];}else{_0x29dbe7[_0x56a5('0x21')]=_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x21')];_0x29dbe7[_0x56a5('0x22')]=_0x51ef6f['Smtp']['port'];_0x29dbe7[_0x56a5('0x23')]=_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x23')];}if(_0x51ef6f['Smtp'][_0x56a5('0x24')]){_0x29dbe7[_0x56a5('0x25')]={'user':_0x51ef6f['Smtp']['user'],'pass':_0x51ef6f['Smtp']['pass']};}var _0x423e3a={'account':_0x29dbe7,'message':_[_0x56a5('0x26')]({'from':util[_0x56a5('0x27')]('\x22%s\x22\x20<%s>',_0x51ef6f[_0x56a5('0xa')],_0x51ef6f['email']||_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x11')])},_0x2efde7)};return client['request'](_0x56a5('0x28'),_0x423e3a);})['then'](function(_0x112e26){if(_0x112e26[_0x56a5('0x29')]){throw new Error(util[_0x56a5('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x112e26[_0x56a5('0x29')][_0x56a5('0x2a')]||JSON[_0x56a5('0x2b')](_0x112e26['error'])));}return!![];});}function handleError(_0x2ec273,_0x2b4fc7,_0xce6a1d){return _0x2ec273[_0x56a5('0x2c')](_0x2b4fc7||0x1f4)[_0x56a5('0x2d')]({'message':_0xce6a1d?_0xce6a1d['message']||_0xce6a1d:''});}exports['login']=function(_0xbbe90e,_0x84f99a,_0x2b4661){passport[_0x56a5('0x14')](_0x56a5('0x2e'),function(_0xaeda55,_0x16e747,_0x652028){var _0x1fe853=_0xaeda55||_0x652028;if(_0x1fe853){return handleError(_0x84f99a,0x191,_0x1fe853);}if(!_0x16e747){return handleError(_0x84f99a,0x194,{'message':_0x56a5('0x2f')});}else{var _0xbd9cab={'payload':{'id':_0x16e747['id'],'role':_0x16e747[_0x56a5('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x56a5('0x31')](_0xbd9cab)[_0x56a5('0x9')](function(_0x102242){_0x84f99a[_0x56a5('0x32')]({'id':_0x16e747['id'],'token':_0x102242,'statusCall':'','isAlreadyLogged':_0x16e747[_0x56a5('0x33')]});});}})(_0xbbe90e,_0x84f99a,_0x2b4661);};exports[_0x56a5('0x34')]=function(_0xf0f6c8,_0xa88ae1,_0x6a7b4c){if(!_0xf0f6c8[_0x56a5('0x35')]['email']){return handleError(_0xa88ae1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xe63fd5=rs['generate']();_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')]=_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')][_0x56a5('0x37')]()[_0x56a5('0x38')]();var _0x5618f9;return db['Setting'][_0x56a5('0x6')]({'where':{'id':0x1},'attributes':[_0x56a5('0x7'),_0x56a5('0x8')],'raw':!![]})[_0x56a5('0x9')](function(_0x29b3e7){_0x5618f9=_0x29b3e7;return db[_0x56a5('0x39')]['find']({'where':{'email':_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')]}});})['then'](function(_0x925f9b){if(!_0x925f9b){throw new Error(_0x56a5('0x3a'));}if(_0x925f9b[_0x56a5('0x15')]){throw new Error(_0x56a5('0x3b'));}if(_0x925f9b['blocked']){if(moment(_0x925f9b[_0x56a5('0xe')])['add'](_0x5618f9[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x925f9b[_0x56a5('0xd')]=![];_0x925f9b['blockedAt']=null;}}_0x925f9b[_0x56a5('0x3c')]=_0xe63fd5;_0x925f9b[_0x56a5('0x3d')]=Date['now']()+0x36ee80;return _0x925f9b[_0x56a5('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0xf0f6c8[_0x56a5('0x35')]['email'],'subject':_0x56a5('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x56a5('0x40')+_0x56a5('0x41')+_0xf0f6c8[_0x56a5('0x42')][_0x56a5('0x21')]+_0x56a5('0x43')+_0xe63fd5+'\x0a\x0a'+_0x56a5('0x44')});})[_0x56a5('0x9')](function(){_0xa88ae1['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x56a5('0x1a')](function(_0x1bec14){return handleError(_0xa88ae1,0x1f4,_0x1bec14);});};exports[_0x56a5('0x45')]=function(_0x55d2e2,_0x16ba8d,_0x38aa81){return db[_0x56a5('0x39')]['find']({'where':{'resetPasswordToken':_0x55d2e2[_0x56a5('0x46')][_0x56a5('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x56a5('0x9')](function(_0x1080f8){if(!_0x1080f8){throw new Error(_0x56a5('0x48'));}return db[_0x56a5('0x49')][_0x56a5('0x6')]({'attributes':['id','securePassword',_0x56a5('0x4a'),_0x56a5('0x4b')]})[_0x56a5('0x9')](function(_0x4444ed){if(_0x4444ed[_0x56a5('0x4c')])authService['validatePasswordPattern'](_0x55d2e2[_0x56a5('0x35')][_0x56a5('0xb')]);if(!_0x4444ed['enforcePasswordHistory']||!_0x1080f8[_0x56a5('0x4d')])return _0x1080f8;authService[_0x56a5('0x4e')](_0x55d2e2[_0x56a5('0x35')]['password'],_0x1080f8[_0x56a5('0x4d')],_0x4444ed['passwordHistoryLimit']);return _0x1080f8;})[_0x56a5('0x9')](function(){_0x1080f8['password']=_0x55d2e2[_0x56a5('0x35')][_0x56a5('0xb')];_0x1080f8[_0x56a5('0x3c')]=null;_0x1080f8[_0x56a5('0x3d')]=null;return _0x1080f8['save']();});})[_0x56a5('0x9')](function(){_0x16ba8d['status'](0xc8)[_0x56a5('0x2d')]({'message':_0x56a5('0x4f')});})[_0x56a5('0x1a')](function(_0x3d8b81){return handleError(_0x16ba8d,0x1f4,_0x3d8b81);});};passport[_0x56a5('0x50')](new LocalStrategy({'usernameField':_0x56a5('0xa'),'passwordField':_0x56a5('0xb')},function(_0x1c84e9,_0x331bbd,_0x76c6bb){return localAuthenticate(db['User'],_0x1c84e9,_0x331bbd,_0x76c6bb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a0f47d1..0edcb96 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 _0x7c1c=['/reset/:token','reset','exports','express','./authLocal.controller','post','login','/forgot'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x7c1c,0x1d3));var _0xc7c1=function(_0x73771f,_0x477a21){_0x73771f=_0x73771f-0x0;var _0xd52787=_0x7c1c[_0x73771f];return _0xd52787;};'use strict';var express=require(_0xc7c1('0x0'));var router=express['Router']();var controller=require(_0xc7c1('0x1'));router[_0xc7c1('0x2')]('/',controller[_0xc7c1('0x3')]);router[_0xc7c1('0x2')](_0xc7c1('0x4'),controller['forgot']);router[_0xc7c1('0x2')](_0xc7c1('0x5'),controller[_0xc7c1('0x6')]);module[_0xc7c1('0x7')]=router; \ No newline at end of file +var _0x7985=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x7985,0x1a3));var _0x5798=function(_0x2e5405,_0x42ec09){_0x2e5405=_0x2e5405-0x0;var _0x2f0270=_0x7985[_0x2e5405];return _0x2f0270;};'use strict';var express=require(_0x5798('0x0'));var router=express[_0x5798('0x1')]();var controller=require(_0x5798('0x2'));router[_0x5798('0x3')]('/',controller[_0x5798('0x4')]);router[_0x5798('0x3')](_0x5798('0x5'),controller[_0x5798('0x6')]);router[_0x5798('0x3')](_0x5798('0x7'),controller[_0x5798('0x8')]);module[_0x5798('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9ceffab..24f5755 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 _0xf594=['BOOLEAN','sequelize','exports','STRING'];(function(_0x354057,_0x350290){var _0x4f38c7=function(_0x4f2a8a){while(--_0x4f2a8a){_0x354057['push'](_0x354057['shift']());}};_0x4f38c7(++_0x350290);}(_0xf594,0x141));var _0x4f59=function(_0x5deb9a,_0x13417f){_0x5deb9a=_0x5deb9a-0x0;var _0x1f8d57=_0xf594[_0x5deb9a];return _0x1f8d57;};'use strict';var Sequelize=require(_0x4f59('0x0'));module[_0x4f59('0x1')]={'name':{'type':Sequelize[_0x4f59('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4f59('0x2')]},'description':{'type':Sequelize[_0x4f59('0x2')]},'status':{'type':Sequelize[_0x4f59('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x9be0=['sequelize','STRING','BOOLEAN'];(function(_0x214d54,_0x133c72){var _0x44ca46=function(_0xe42b02){while(--_0xe42b02){_0x214d54['push'](_0x214d54['shift']());}};_0x44ca46(++_0x133c72);}(_0x9be0,0xc3));var _0x09be=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9be0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x09be('0x0'));module['exports']={'name':{'type':Sequelize[_0x09be('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x09be('0x1')]},'status':{'type':Sequelize[_0x09be('0x2')],'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 8a0d930..7f694b7 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(_0x17281c,_0x442caa){var _0x25da6b=function(_0x10fbb2){while(--_0x10fbb2){_0x17281c['push'](_0x17281c['shift']());}};_0x25da6b(++_0x442caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x2cbc30,_0x3235e6){var _0x22ff4b=function(_0x1401ca){while(--_0x1401ca){_0x2cbc30['push'](_0x2cbc30['shift']());}};_0x22ff4b(++_0x3235e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 b9cf5b1..3e550fc 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 _0xe900=['./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xe900,0x89));var _0x0e90=function(_0x5e7cbd,_0x322cac){_0x5e7cbd=_0x5e7cbd-0x0;var _0xcdeed2=_0xe900[_0x5e7cbd];return _0xcdeed2;};'use strict';var _=require(_0x0e90('0x0'));var util=require('util');var logger=require(_0x0e90('0x1'))(_0x0e90('0x2'));var moment=require(_0x0e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e90('0x4'));var fs=require('fs');var path=require(_0x0e90('0x5'));var rimraf=require('rimraf');var config=require(_0x0e90('0x6'));var attributes=require(_0x0e90('0x7'));module[_0x0e90('0x8')]=function(_0x413d4b,_0x34a068){return _0x413d4b[_0x0e90('0x9')](_0x0e90('0xa'),attributes,{'tableName':_0x0e90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35ff=['../../config/logger','moment','bluebird','path','../../config/environment','./automation.attributes','exports','define','tools_automations','util'];(function(_0x12f1fe,_0x87aef0){var _0x26fc9d=function(_0x573f0c){while(--_0x573f0c){_0x12f1fe['push'](_0x12f1fe['shift']());}};_0x26fc9d(++_0x87aef0);}(_0x35ff,0xb3));var _0xf35f=function(_0x2ca7a2,_0xf1a332){_0x2ca7a2=_0x2ca7a2-0x0;var _0x308bcf=_0x35ff[_0x2ca7a2];return _0x308bcf;};'use strict';var _=require('lodash');var util=require(_0xf35f('0x0'));var logger=require(_0xf35f('0x1'))('api');var moment=require(_0xf35f('0x2'));var BPromise=require(_0xf35f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf35f('0x4'));var rimraf=require('rimraf');var config=require(_0xf35f('0x5'));var attributes=require(_0xf35f('0x6'));module[_0xf35f('0x7')]=function(_0x1f9847,_0x1821a6){return _0x1f9847[_0xf35f('0x8')]('Automation',attributes,{'tableName':_0xf35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 29f9fc8..c2054c4 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 _0xc95c=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x42db23,_0x112b01){var _0x2d1e4e=function(_0x96342f){while(--_0x96342f){_0x42db23['push'](_0x42db23['shift']());}};_0x2d1e4e(++_0x112b01);}(_0xc95c,0x18d));var _0xcc95=function(_0x447efa,_0x453712){_0x447efa=_0x447efa-0x0;var _0x591b57=_0xc95c[_0x447efa];return _0x591b57;};'use strict';var _=require(_0xcc95('0x0'));var util=require(_0xcc95('0x1'));var moment=require(_0xcc95('0x2'));var BPromise=require(_0xcc95('0x3'));var rs=require(_0xcc95('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc95('0x6'))(_0xcc95('0x7'));var config=require(_0xcc95('0x8'));var jayson=require(_0xcc95('0x9'));var client=jayson['client'][_0xcc95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14f31e,_0x1ae85b,_0x5254d0){return new BPromise(function(_0x5ed6ee,_0x22ee88){return client['request'](_0x14f31e,_0x5254d0)[_0xcc95('0xb')](function(_0x15c142){logger[_0xcc95('0xc')](_0xcc95('0xd'),_0x1ae85b,_0xcc95('0xe'));logger[_0xcc95('0xf')](_0xcc95('0x10'),_0x1ae85b,'request\x20sent',JSON[_0xcc95('0x11')](_0x15c142));if(_0x15c142[_0xcc95('0x12')]){if(_0x15c142[_0xcc95('0x12')][_0xcc95('0x13')]===0x1f4){logger[_0xcc95('0x12')]('Automation,\x20%s,\x20%s',_0x1ae85b,_0x15c142['error']['message']);return _0x22ee88(_0x15c142[_0xcc95('0x12')][_0xcc95('0x14')]);}logger[_0xcc95('0x12')](_0xcc95('0xd'),_0x1ae85b,_0x15c142[_0xcc95('0x12')][_0xcc95('0x14')]);return _0x5ed6ee(_0x15c142[_0xcc95('0x12')]['message']);}else{logger[_0xcc95('0xc')]('Automation,\x20%s,\x20%s',_0x1ae85b,_0xcc95('0xe'));_0x5ed6ee(_0x15c142[_0xcc95('0x15')]['message']);}})[_0xcc95('0x16')](function(_0x518254){logger[_0xcc95('0x12')](_0xcc95('0xd'),_0x1ae85b,_0x518254);_0x22ee88(_0x518254);});});} \ No newline at end of file +var _0x5a3b=['client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x452f70,_0x204445){var _0x44d233=function(_0x3be093){while(--_0x3be093){_0x452f70['push'](_0x452f70['shift']());}};_0x44d233(++_0x204445);}(_0x5a3b,0x14b));var _0xb5a3=function(_0x4540dc,_0x5c7be9){_0x4540dc=_0x4540dc-0x0;var _0x4ac018=_0x5a3b[_0x4540dc];return _0x4ac018;};'use strict';var _=require(_0xb5a3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb5a3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5a3('0x2'));var db=require(_0xb5a3('0x3'))['db'];var utils=require(_0xb5a3('0x4'));var logger=require(_0xb5a3('0x5'))(_0xb5a3('0x6'));var config=require(_0xb5a3('0x7'));var jayson=require(_0xb5a3('0x8'));var client=jayson[_0xb5a3('0x9')][_0xb5a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b563,_0x3572db,_0x5b2ab1){return new BPromise(function(_0xb6f0f0,_0x296401){return client[_0xb5a3('0xb')](_0x36b563,_0x5b2ab1)[_0xb5a3('0xc')](function(_0x2f93e5){logger[_0xb5a3('0xd')](_0xb5a3('0xe'),_0x3572db,'request\x20sent');logger['debug'](_0xb5a3('0xf'),_0x3572db,_0xb5a3('0x10'),JSON['stringify'](_0x2f93e5));if(_0x2f93e5['error']){if(_0x2f93e5['error'][_0xb5a3('0x11')]===0x1f4){logger['error'](_0xb5a3('0xe'),_0x3572db,_0x2f93e5['error']['message']);return _0x296401(_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);}logger[_0xb5a3('0x12')](_0xb5a3('0xe'),_0x3572db,_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);return _0xb6f0f0(_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);}else{logger[_0xb5a3('0xd')]('Automation,\x20%s,\x20%s',_0x3572db,_0xb5a3('0x10'));_0xb6f0f0(_0x2f93e5['result'][_0xb5a3('0x13')]);}})['catch'](function(_0x3ce9f8){logger['error'](_0xb5a3('0xe'),_0x3572db,_0x3ce9f8);_0x296401(_0x3ce9f8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 91c4c25..15ef6d5 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 _0x1ab2=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','/:id','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab2,0x198));var _0x21ab=function(_0x489b2e,_0xe9b2ff){_0x489b2e=_0x489b2e-0x0;var _0x83b43f=_0x1ab2[_0x489b2e];return _0x83b43f;};'use strict';var multer=require(_0x21ab('0x0'));var util=require(_0x21ab('0x1'));var path=require(_0x21ab('0x2'));var timeout=require(_0x21ab('0x3'));var express=require(_0x21ab('0x4'));var router=express['Router']();var auth=require(_0x21ab('0x5'));var interaction=require(_0x21ab('0x6'));var config=require(_0x21ab('0x7'));var controller=require(_0x21ab('0x8'));router['get']('/',auth[_0x21ab('0x9')](),controller[_0x21ab('0xa')]);router[_0x21ab('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x21ab('0xb')](_0x21ab('0xc'),auth[_0x21ab('0x9')](),controller[_0x21ab('0xd')]);router['get'](_0x21ab('0xe'),auth[_0x21ab('0x9')](),controller[_0x21ab('0xf')]);router[_0x21ab('0x10')]('/',auth['isAuthenticated'](),controller[_0x21ab('0x11')]);router[_0x21ab('0x10')](_0x21ab('0xc'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x12')]);router[_0x21ab('0x10')](_0x21ab('0xe'),auth[_0x21ab('0x9')](),controller['addActions']);router[_0x21ab('0x13')](_0x21ab('0x14'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x15')]);router['delete'](_0x21ab('0x14'),auth[_0x21ab('0x9')](),controller[_0x21ab('0x16')]);module[_0x21ab('0x17')]=router; \ No newline at end of file +var _0x5e0e=['getActions','post','create','addConditions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5e0e,0x1c3));var _0xe5e0=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0x5e0e[_0x89c40f];return _0x17acbb;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require(_0xe5e0('0x2'));var timeout=require(_0xe5e0('0x3'));var express=require(_0xe5e0('0x4'));var router=express[_0xe5e0('0x5')]();var auth=require(_0xe5e0('0x6'));var interaction=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var controller=require(_0xe5e0('0x9'));router[_0xe5e0('0xa')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xc')]);router['get'](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xa')](_0xe5e0('0xf'),auth[_0xe5e0('0xb')](),controller['getConditions']);router['get'](_0xe5e0('0x10'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0x12')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x13')]);router[_0xe5e0('0x12')](_0xe5e0('0xf'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x12')](_0xe5e0('0x10'),auth['isAuthenticated'](),controller['addActions']);router[_0xe5e0('0x15')]('/:id',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x18')]);module[_0xe5e0('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a25bb26..c7a7021 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 _0x55bb=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','STRING','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x3a35a7,_0xcb49ba){var _0x15b518=function(_0x5b67c9){while(--_0x5b67c9){_0x3a35a7['push'](_0x3a35a7['shift']());}};_0x15b518(++_0xcb49ba);}(_0x55bb,0x176));var _0xb55b=function(_0x2a99eb,_0x3c6d20){_0x2a99eb=_0x2a99eb-0x0;var _0xc55166=_0x55bb[_0x2a99eb];return _0xc55166;};'use strict';var Sequelize=require(_0xb55b('0x0'));module[_0xb55b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb55b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x4')),'allowNull':![],'defaultValue':_0xb55b('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb55b('0x5')},'limitCalls':{'type':Sequelize[_0xb55b('0x6')](0x4)[_0xb55b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb55b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb55b('0xe')},'dialTimezone':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':_0xb55b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x11'),_0xb55b('0x12'),_0xb55b('0x13')),'defaultValue':_0xb55b('0x11')},'dialAMDActive':{'type':Sequelize[_0xb55b('0x14')],'defaultValue':0x0,'comment':_0xb55b('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb55b('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb55b('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb55b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb55b('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb55b('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb55b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb55b('0x6')](0x9)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb55b('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb55b('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb55b('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb55b('0x3')](_0xb55b('0x1c'),'ASC'),'defaultValue':_0xb55b('0x1c')},'dialPrefix':{'type':Sequelize[_0xb55b('0xf')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb55b('0x1d')},'dialCutDigit':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb55b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)[_0xb55b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb55b('0x6')](0x3)[_0xb55b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb55b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb55b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb55b('0x24')}}; \ No newline at end of file +var _0xe476=['ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ivr','STRING','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*'];(function(_0x5db3b4,_0x54c36c){var _0x28ec4f=function(_0x3aafd4){while(--_0x3aafd4){_0x5db3b4['push'](_0x5db3b4['shift']());}};_0x28ec4f(++_0x54c36c);}(_0xe476,0x193));var _0x6e47=function(_0x598bf4,_0x18b713){_0x598bf4=_0x598bf4-0x0;var _0x2f8020=_0xe476[_0x598bf4];return _0x2f8020;};'use strict';var Sequelize=require(_0x6e47('0x0'));module[_0x6e47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e47('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6e47('0x3')),'allowNull':![],'defaultValue':_0x6e47('0x3')},'description':{'type':Sequelize[_0x6e47('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x6e47('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6e47('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6e47('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6e47('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x6e47('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':_0x6e47('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x6e47('0xf')](_0x6e47('0x10'),_0x6e47('0x11'),'onlyIfOpen'),'defaultValue':_0x6e47('0x10')},'dialAMDActive':{'type':Sequelize[_0x6e47('0x12')],'defaultValue':0x0,'comment':_0x6e47('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6e47('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x6e47('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6e47('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6e47('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e47('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6e47('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6e47('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6e47('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6e47('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e47('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6e47('0xf')](_0x6e47('0x1d'),'ASC'),'defaultValue':_0x6e47('0x1d')},'dialPrefix':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e47('0x1e')},'dialCutDigit':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e47('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4c35c41..6930991 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x4d6c8e,_0x32d100){var _0x28a3a7=function(_0x285270){while(--_0x285270){_0x4d6c8e['push'](_0x4d6c8e['shift']());}};_0x28a3a7(++_0x32d100);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x27828c,_0x150789){var _0x23786e=function(_0x299862){while(--_0x299862){_0x27828c['push'](_0x27828c['shift']());}};_0x23786e(++_0x150789);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index da1fad6..c069a1e 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 _0xcdb7=['request-promise','path','../../config/environment','./campaign.attributes','exports','Campaign','lodash','util','moment','bluebird'];(function(_0x40b5ce,_0xeb5c4d){var _0x141335=function(_0x1b73d9){while(--_0x1b73d9){_0x40b5ce['push'](_0x40b5ce['shift']());}};_0x141335(++_0xeb5c4d);}(_0xcdb7,0x146));var _0x7cdb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcdb7[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7cdb('0x0'));var util=require(_0x7cdb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cdb('0x2'));var BPromise=require(_0x7cdb('0x3'));var rp=require(_0x7cdb('0x4'));var fs=require('fs');var path=require(_0x7cdb('0x5'));var rimraf=require('rimraf');var config=require(_0x7cdb('0x6'));var attributes=require(_0x7cdb('0x7'));module[_0x7cdb('0x8')]=function(_0x4db8fa,_0x378c2d){return _0x4db8fa['define'](_0x7cdb('0x9'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd651=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','campaigns'];(function(_0x519628,_0x1f52f4){var _0x3e39c4=function(_0x19d881){while(--_0x19d881){_0x519628['push'](_0x519628['shift']());}};_0x3e39c4(++_0x1f52f4);}(_0xd651,0x82));var _0x1d65=function(_0x3883c8,_0x50ad6b){_0x3883c8=_0x3883c8-0x0;var _0x800e61=_0xd651[_0x3883c8];return _0x800e61;};'use strict';var _=require(_0x1d65('0x0'));var util=require(_0x1d65('0x1'));var logger=require(_0x1d65('0x2'))(_0x1d65('0x3'));var moment=require(_0x1d65('0x4'));var BPromise=require(_0x1d65('0x5'));var rp=require(_0x1d65('0x6'));var fs=require('fs');var path=require(_0x1d65('0x7'));var rimraf=require(_0x1d65('0x8'));var config=require(_0x1d65('0x9'));var attributes=require(_0x1d65('0xa'));module[_0x1d65('0xb')]=function(_0x5d9ac3,_0x42e51e){return _0x5d9ac3['define']('Campaign',attributes,{'tableName':_0x1d65('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 d20126a..a22ce80 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _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(_0x4a19ed,_0x352056){var _0x22c786=function(_0x153267){while(--_0x153267){_0x4a19ed['push'](_0x4a19ed['shift']());}};_0x22c786(++_0x352056);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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 a51f874..306be33 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 _0x22c4=['getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','delete','destroy','removeBlackLists','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_finals','/:id/hopper_black'];(function(_0x1534dd,_0x476702){var _0x2f392e=function(_0x1d6dd1){while(--_0x1d6dd1){_0x1534dd['push'](_0x1534dd['shift']());}};_0x2f392e(++_0x476702);}(_0x22c4,0xc4));var _0x422c=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x22c4[_0x5311e8];return _0x582ad8;};'use strict';var multer=require(_0x422c('0x0'));var util=require('util');var path=require(_0x422c('0x1'));var timeout=require('connect-timeout');var express=require(_0x422c('0x2'));var router=express[_0x422c('0x3')]();var auth=require(_0x422c('0x4'));var interaction=require(_0x422c('0x5'));var config=require('../../config/environment');var controller=require(_0x422c('0x6'));router[_0x422c('0x7')]('/',auth[_0x422c('0x8')](),controller[_0x422c('0x9')]);router[_0x422c('0x7')]('/:id',auth[_0x422c('0x8')](),controller[_0x422c('0xa')]);router[_0x422c('0x7')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x422c('0xb')]);router[_0x422c('0x7')]('/:id/hopper_histories',auth[_0x422c('0x8')](),controller['getHopperHistories']);router['get'](_0x422c('0xc'),auth[_0x422c('0x8')](),controller['getHopperFinals']);router[_0x422c('0x7')](_0x422c('0xd'),auth[_0x422c('0x8')](),controller[_0x422c('0xe')]);router['get'](_0x422c('0xf'),auth['isAuthenticated'](),controller[_0x422c('0x10')]);router[_0x422c('0x7')](_0x422c('0x11'),auth[_0x422c('0x8')](),controller[_0x422c('0x12')]);router[_0x422c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x422c('0x14'),auth[_0x422c('0x8')](),controller[_0x422c('0x15')]);router[_0x422c('0x13')](_0x422c('0xf'),auth[_0x422c('0x8')](),controller[_0x422c('0x16')]);router[_0x422c('0x13')](_0x422c('0x11'),auth[_0x422c('0x8')](),controller[_0x422c('0x17')]);router[_0x422c('0x18')](_0x422c('0x19'),auth['isAuthenticated'](),controller[_0x422c('0x1a')]);router[_0x422c('0x1b')](_0x422c('0x19'),auth[_0x422c('0x8')](),controller[_0x422c('0x1c')]);router['delete'](_0x422c('0xf'),auth['isAuthenticated'](),controller['removeLists']);router[_0x422c('0x1b')](_0x422c('0x11'),auth['isAuthenticated'](),controller[_0x422c('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xd431=['create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x3b5e65,_0x1b1bf4){var _0x4d423b=function(_0x1a5a57){while(--_0x1a5a57){_0x3b5e65['push'](_0x3b5e65['shift']());}};_0x4d423b(++_0x1b1bf4);}(_0xd431,0x135));var _0x1d43=function(_0x578a78,_0xfdd763){_0x578a78=_0x578a78-0x0;var _0x5b517b=_0xd431[_0x578a78];return _0x5b517b;};'use strict';var multer=require(_0x1d43('0x0'));var util=require(_0x1d43('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d43('0x2'));var router=express[_0x1d43('0x3')]();var auth=require(_0x1d43('0x4'));var interaction=require(_0x1d43('0x5'));var config=require(_0x1d43('0x6'));var controller=require(_0x1d43('0x7'));router['get']('/',auth[_0x1d43('0x8')](),controller[_0x1d43('0x9')]);router[_0x1d43('0xa')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller['show']);router[_0x1d43('0xa')]('/:id/hoppers',auth[_0x1d43('0x8')](),controller[_0x1d43('0xc')]);router[_0x1d43('0xa')](_0x1d43('0xd'),auth[_0x1d43('0x8')](),controller[_0x1d43('0xe')]);router[_0x1d43('0xa')](_0x1d43('0xf'),auth[_0x1d43('0x8')](),controller['getHopperFinals']);router[_0x1d43('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x1d43('0x10')]);router[_0x1d43('0xa')](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x12')]);router[_0x1d43('0xa')](_0x1d43('0x13'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x14')]);router['post']('/',auth[_0x1d43('0x8')](),controller[_0x1d43('0x15')]);router[_0x1d43('0x16')](_0x1d43('0x17'),auth['isAuthenticated'](),controller[_0x1d43('0x18')]);router[_0x1d43('0x16')](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x19')]);router[_0x1d43('0x16')](_0x1d43('0x13'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1a')]);router[_0x1d43('0x1b')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1c')]);router[_0x1d43('0x1d')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1e')]);router['delete'](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller['removeLists']);router[_0x1d43('0x1d')]('/:id/blacklists',auth[_0x1d43('0x8')](),controller[_0x1d43('0x1f')]);module[_0x1d43('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a87f2c2..04c88ea 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 _0x1a6a=['TEXT','VIRTUAL','key','sequelize','STRING'];(function(_0x4b4744,_0x42897a){var _0x52d833=function(_0x58724c){while(--_0x58724c){_0x4b4744['push'](_0x4b4744['shift']());}};_0x52d833(++_0x42897a);}(_0x1a6a,0x12f));var _0xa1a6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1a6a[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xa1a6('0x0'));module['exports']={'key':{'type':Sequelize[_0xa1a6('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xa1a6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa1a6('0x1')]},'name':{'type':Sequelize[_0xa1a6('0x3')],'get':function(){return this['getDataValue'](_0xa1a6('0x4'));}}}; \ No newline at end of file +var _0x397c=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0xcd9f1c,_0x4ecdce){var _0x1259fe=function(_0x383cff){while(--_0x383cff){_0xcd9f1c['push'](_0xcd9f1c['shift']());}};_0x1259fe(++_0x4ecdce);}(_0x397c,0x1c9));var _0xc397=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x397c[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0xc397('0x0'));module[_0xc397('0x1')]={'key':{'type':Sequelize[_0xc397('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xc397('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xc397('0x2')]},'name':{'type':Sequelize[_0xc397('0x4')],'get':function(){return this[_0xc397('0x5')](_0xc397('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 461b4f4..f26adf9 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x5700b8,_0x466567){var _0x4f3646=function(_0x2e60c1){while(--_0x2e60c1){_0x5700b8['push'](_0x5700b8['shift']());}};_0x4f3646(++_0x466567);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 aaacf37..4cdf429 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 _0x78d8=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','rimraf'];(function(_0x25a245,_0x158aa9){var _0x3990e7=function(_0x3fee5b){while(--_0x3fee5b){_0x25a245['push'](_0x25a245['shift']());}};_0x3990e7(++_0x158aa9);}(_0x78d8,0x15c));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x878d('0x0'));var logger=require(_0x878d('0x1'))(_0x878d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x878d('0x3'));var config=require(_0x878d('0x4'));var attributes=require(_0x878d('0x5'));module[_0x878d('0x6')]=function(_0x144302,_0x2c2d79){return _0x144302[_0x878d('0x7')](_0x878d('0x8'),attributes,{'tableName':_0x878d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x878d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2567=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0xdefacb,_0x511ca0){var _0x2ca364=function(_0x2aa0ed){while(--_0x2aa0ed){_0xdefacb['push'](_0xdefacb['shift']());}};_0x2ca364(++_0x511ca0);}(_0x2567,0x1c7));var _0x7256=function(_0x3825e6,_0xe169de){_0x3825e6=_0x3825e6-0x0;var _0xd75004=_0x2567[_0x3825e6];return _0xd75004;};'use strict';var _=require(_0x7256('0x0'));var util=require(_0x7256('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7256('0x2'));var BPromise=require(_0x7256('0x3'));var rp=require(_0x7256('0x4'));var fs=require('fs');var path=require(_0x7256('0x5'));var rimraf=require('rimraf');var config=require(_0x7256('0x6'));var attributes=require(_0x7256('0x7'));module[_0x7256('0x8')]=function(_0x321fc0,_0x2d195b){return _0x321fc0['define'](_0x7256('0x9'),attributes,{'tableName':_0x7256('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7256('0xb'),'collate':_0x7256('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2a4ef85..96ec445 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 _0x174e=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s'];(function(_0x3c787b,_0x15f957){var _0x3605fb=function(_0x3ae1c8){while(--_0x3ae1c8){_0x3c787b['push'](_0x3c787b['shift']());}};_0x3605fb(++_0x15f957);}(_0x174e,0xbf));var _0xe174=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x174e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe174('0x0'));var util=require(_0xe174('0x1'));var moment=require(_0xe174('0x2'));var BPromise=require(_0xe174('0x3'));var rs=require(_0xe174('0x4'));var fs=require('fs');var Redis=require(_0xe174('0x5'));var db=require(_0xe174('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe174('0x7'));var config=require(_0xe174('0x8'));var jayson=require(_0xe174('0x9'));var client=jayson[_0xe174('0xa')][_0xe174('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ba677,_0x577b25,_0x15b7eb){return new BPromise(function(_0x1b6981,_0x3214e1){return client[_0xe174('0xc')](_0x1ba677,_0x15b7eb)['then'](function(_0x37cb15){logger[_0xe174('0xd')](_0xe174('0xe'),_0x577b25,'request\x20sent');logger['debug'](_0xe174('0xf'),_0x577b25,_0xe174('0x10'),JSON[_0xe174('0x11')](_0x37cb15));if(_0x37cb15[_0xe174('0x12')]){if(_0x37cb15['error'][_0xe174('0x13')]===0x1f4){logger[_0xe174('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x577b25,_0x37cb15['error'][_0xe174('0x14')]);return _0x3214e1(_0x37cb15[_0xe174('0x12')]['message']);}logger['error'](_0xe174('0xe'),_0x577b25,_0x37cb15[_0xe174('0x12')][_0xe174('0x14')]);return _0x1b6981(_0x37cb15[_0xe174('0x12')][_0xe174('0x14')]);}else{logger[_0xe174('0xd')](_0xe174('0xe'),_0x577b25,_0xe174('0x10'));_0x1b6981(_0x37cb15[_0xe174('0x15')][_0xe174('0x14')]);}})[_0xe174('0x16')](function(_0x3097af){logger['error'](_0xe174('0xe'),_0x577b25,_0x3097af);_0x3214e1(_0x3097af);});});} \ No newline at end of file +var _0x1028=['http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d6478,_0x12f001){var _0x5db1ec=function(_0x1f2dd3){while(--_0x1f2dd3){_0x3d6478['push'](_0x3d6478['shift']());}};_0x5db1ec(++_0x12f001);}(_0x1028,0x155));var _0x8102=function(_0x19fa95,_0x1cca0a){_0x19fa95=_0x19fa95-0x0;var _0x58a835=_0x1028[_0x19fa95];return _0x58a835;};'use strict';var _=require(_0x8102('0x0'));var util=require(_0x8102('0x1'));var moment=require(_0x8102('0x2'));var BPromise=require('bluebird');var rs=require(_0x8102('0x3'));var fs=require('fs');var Redis=require(_0x8102('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8102('0x5'));var logger=require(_0x8102('0x6'))(_0x8102('0x7'));var config=require(_0x8102('0x8'));var jayson=require(_0x8102('0x9'));var client=jayson[_0x8102('0xa')][_0x8102('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4105a1,_0x41c2af,_0x4a4a99){return new BPromise(function(_0x272b30,_0xc2b37){return client[_0x8102('0xc')](_0x4105a1,_0x4a4a99)['then'](function(_0xc7c933){logger[_0x8102('0xd')](_0x8102('0xe'),_0x41c2af,_0x8102('0xf'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x41c2af,_0x8102('0xf'),JSON[_0x8102('0x10')](_0xc7c933));if(_0xc7c933[_0x8102('0x11')]){if(_0xc7c933['error'][_0x8102('0x12')]===0x1f4){logger[_0x8102('0x11')](_0x8102('0xe'),_0x41c2af,_0xc7c933[_0x8102('0x11')]['message']);return _0xc2b37(_0xc7c933['error'][_0x8102('0x13')]);}logger[_0x8102('0x11')](_0x8102('0xe'),_0x41c2af,_0xc7c933[_0x8102('0x11')][_0x8102('0x13')]);return _0x272b30(_0xc7c933[_0x8102('0x11')][_0x8102('0x13')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x41c2af,_0x8102('0xf'));_0x272b30(_0xc7c933[_0x8102('0x14')][_0x8102('0x13')]);}})[_0x8102('0x15')](function(_0x8e809d){logger['error'](_0x8102('0xe'),_0x41c2af,_0x8e809d);_0xc2b37(_0x8e809d);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b94231b..b13db1d 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 _0xbf8d=['show','post','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x3f9547,_0x2c7d73){var _0x30ad70=function(_0x52aab5){while(--_0x52aab5){_0x3f9547['push'](_0x3f9547['shift']());}};_0x30ad70(++_0x2c7d73);}(_0xbf8d,0x117));var _0xdbf8=function(_0x579e75,_0x40fe61){_0x579e75=_0x579e75-0x0;var _0x53a03f=_0xbf8d[_0x579e75];return _0x53a03f;};'use strict';var multer=require('multer');var util=require(_0xdbf8('0x0'));var path=require(_0xdbf8('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbf8('0x2'));var router=express[_0xdbf8('0x3')]();var auth=require(_0xdbf8('0x4'));var interaction=require(_0xdbf8('0x5'));var config=require(_0xdbf8('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xdbf8('0x7')](),controller['index']);router[_0xdbf8('0x8')](_0xdbf8('0x9'),auth['isAuthenticated'](),controller[_0xdbf8('0xa')]);router[_0xdbf8('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbf8('0xc')]);router[_0xdbf8('0xd')](_0xdbf8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xdbf8('0xe')](_0xdbf8('0x9'),auth[_0xdbf8('0x7')](),controller[_0xdbf8('0xf')]);module[_0xdbf8('0x10')]=router; \ No newline at end of file +var _0x3757=['get','isAuthenticated','index','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xee674,_0x48c45c){var _0x870bd4=function(_0x7acbb5){while(--_0x7acbb5){_0xee674['push'](_0xee674['shift']());}};_0x870bd4(++_0x48c45c);}(_0x3757,0xf8));var _0x7375=function(_0x4bb416,_0x5af42f){_0x4bb416=_0x4bb416-0x0;var _0x1663d5=_0x3757[_0x4bb416];return _0x1663d5;};'use strict';var multer=require('multer');var util=require(_0x7375('0x0'));var path=require(_0x7375('0x1'));var timeout=require(_0x7375('0x2'));var express=require(_0x7375('0x3'));var router=express[_0x7375('0x4')]();var auth=require(_0x7375('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7375('0x6'));var controller=require('./cannedAnswer.controller');router[_0x7375('0x7')]('/',auth[_0x7375('0x8')](),controller[_0x7375('0x9')]);router[_0x7375('0x7')]('/:id',auth[_0x7375('0x8')](),controller['show']);router['post']('/',auth[_0x7375('0x8')](),controller[_0x7375('0xa')]);router[_0x7375('0xb')]('/:id',auth[_0x7375('0x8')](),controller[_0x7375('0xc')]);router['delete']('/:id',auth[_0x7375('0x8')](),controller[_0x7375('0xd')]);module[_0x7375('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4f46974..db1d951 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 _0xb735=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5708f5,_0x273841){var _0x655c4b=function(_0x1d58d1){while(--_0x1d58d1){_0x5708f5['push'](_0x5708f5['shift']());}};_0x655c4b(++_0x273841);}(_0xb735,0x96));var _0x5b73=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0xb735[_0x246f92];return _0x2b8e7d;};'use strict';var Sequelize=require(_0x5b73('0x0'));module[_0x5b73('0x1')]={'calldate':{'type':Sequelize[_0x5b73('0x2')],'allowNull':![],'defaultValue':_0x5b73('0x3')},'clid':{'type':Sequelize[_0x5b73('0x4')]},'src':{'type':Sequelize[_0x5b73('0x4')]},'dst':{'type':Sequelize[_0x5b73('0x4')]},'dcontext':{'type':Sequelize[_0x5b73('0x4')]},'channel':{'type':Sequelize[_0x5b73('0x4')]},'dstchannel':{'type':Sequelize[_0x5b73('0x4')]},'lastapp':{'type':Sequelize[_0x5b73('0x4')]},'lastdata':{'type':Sequelize[_0x5b73('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5b73('0x4')]},'amaflags':{'type':Sequelize[_0x5b73('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5b73('0x4')]},'userfield':{'type':Sequelize[_0x5b73('0x4')]},'uniqueid':{'type':Sequelize[_0x5b73('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x5b73('0x4')]},'peeraccount':{'type':Sequelize[_0x5b73('0x4')]},'type':{'type':Sequelize[_0x5b73('0x4')]},'tag':{'type':Sequelize[_0x5b73('0x4')]}}; \ No newline at end of file +var _0x5f35=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5f35,0x199));var _0x55f3=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x5f35[_0x45346d];return _0x5ce7ca;};'use strict';var Sequelize=require(_0x55f3('0x0'));module[_0x55f3('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x55f3('0x2')},'clid':{'type':Sequelize[_0x55f3('0x3')]},'src':{'type':Sequelize[_0x55f3('0x3')]},'dst':{'type':Sequelize[_0x55f3('0x3')]},'dcontext':{'type':Sequelize[_0x55f3('0x3')]},'channel':{'type':Sequelize[_0x55f3('0x3')]},'dstchannel':{'type':Sequelize[_0x55f3('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x55f3('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x55f3('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x55f3('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x55f3('0x3')]},'uniqueid':{'type':Sequelize[_0x55f3('0x3')]},'linkedid':{'type':Sequelize[_0x55f3('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x55f3('0x3')]},'type':{'type':Sequelize[_0x55f3('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3d72286..8049df1 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 _0xa48d=['update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xa48d,0x1a0));var _0xda48=function(_0x22369e,_0x1a67ee){_0x22369e=_0x22369e-0x0;var _0x240791=_0xa48d[_0x22369e];return _0x240791;};'use strict';var pdf=require(_0xda48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xda48('0x1'));var zipdir=require(_0xda48('0x2'));var jsonpatch=require(_0xda48('0x3'));var rp=require(_0xda48('0x4'));var moment=require(_0xda48('0x5'));var BPromise=require(_0xda48('0x6'));var Mustache=require('mustache');var util=require(_0xda48('0x7'));var path=require(_0xda48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda48('0x9'));var fs=require('fs');var _=require(_0xda48('0xa'));var squel=require(_0xda48('0xb'));var crypto=require(_0xda48('0xc'));var jsforce=require(_0xda48('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda48('0xe'));var querystring=require(_0xda48('0xf'));var Papa=require(_0xda48('0x10'));var Redis=require('ioredis');var authService=require(_0xda48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda48('0x12'));var hardwareService=require(_0xda48('0x13'));var logger=require(_0xda48('0x14'))('api');var utils=require(_0xda48('0x15'));var config=require(_0xda48('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4464ae,_0x53e510){_0x53e510=_0x53e510||0xcc;return function(_0x48919d){if(_0x48919d){return _0x4464ae[_0xda48('0x17')](_0x53e510);}return _0x4464ae['status'](_0x53e510)[_0xda48('0x18')]();};}function respondWithResult(_0x2bf6ac,_0x4f72bd){_0x4f72bd=_0x4f72bd||0xc8;return function(_0x5a36b3){if(_0x5a36b3){return _0x2bf6ac['status'](_0x4f72bd)[_0xda48('0x19')](_0x5a36b3);}};}function respondWithFilteredResult(_0x549fd9,_0x4b5c98){return function(_0x3a0058){if(_0x3a0058){var _0x192251=_0x3a0058['count'],_0x265499=_0x4b5c98[_0xda48('0x1a')],_0x497750=_0x4b5c98[_0xda48('0x1a')]+_0x4b5c98[_0xda48('0x1b')],_0x425b14;if(_0x497750>=_0x192251){_0x497750=_0x192251;_0x425b14=0xc8;}else{_0x425b14=0xce;}_0x549fd9[_0xda48('0x1c')](_0x425b14);return _0x549fd9[_0xda48('0x1d')](_0xda48('0x1e'),_0x265499+'-'+_0x497750+'/'+_0x192251)[_0xda48('0x19')](_0x3a0058);}return null;};}function patchUpdates(_0x4b7933){return function(_0x12503e){try{jsonpatch[_0xda48('0x1f')](_0x12503e,_0x4b7933,!![]);}catch(_0x41da95){return BPromise[_0xda48('0x20')](_0x41da95);}return _0x12503e[_0xda48('0x21')]();};}function saveUpdates(_0x4d0078,_0x51715d){return function(_0x394b73){if(_0x394b73){return _0x394b73[_0xda48('0x22')](_0x4d0078)[_0xda48('0x23')](function(_0xcc3462){return _0xcc3462;});}return null;};}function removeEntity(_0x4170be,_0x1e00ac){return function(_0x4a012a){if(_0x4a012a){return _0x4a012a['destroy']()[_0xda48('0x23')](function(){_0x4170be[_0xda48('0x1c')](0xcc)[_0xda48('0x18')]();});}};}function handleEntityNotFound(_0x33056d,_0x34e656){return function(_0x1d41ae){if(!_0x1d41ae){_0x33056d['sendStatus'](0x194);}return _0x1d41ae;};}function handleError(_0x281019,_0xa6ef4b){_0xa6ef4b=_0xa6ef4b||0x1f4;return function(_0x5540bd){logger[_0xda48('0x24')](_0x5540bd[_0xda48('0x25')]);if(_0x5540bd[_0xda48('0x26')]){delete _0x5540bd[_0xda48('0x26')];}_0x281019['status'](_0xa6ef4b)[_0xda48('0x27')](_0x5540bd);};}exports[_0xda48('0x28')]=function(_0x186be1,_0x164660){var _0x1d6f4c={},_0x311af2={},_0x3cdbda={'count':0x0,'rows':[]};var _0x981ffc=_[_0xda48('0x29')](db[_0xda48('0x2a')][_0xda48('0x2b')],function(_0x3bf87b){return{'name':_0x3bf87b[_0xda48('0x2c')],'type':_0x3bf87b['type'][_0xda48('0x2d')]};});_0x311af2[_0xda48('0x2e')]=_[_0xda48('0x29')](_0x981ffc,_0xda48('0x26'));_0x311af2[_0xda48('0x2f')]=_[_0xda48('0x30')](_0x186be1[_0xda48('0x2f')]);_0x311af2[_0xda48('0x31')]=_[_0xda48('0x32')](_0x311af2[_0xda48('0x2e')],_0x311af2[_0xda48('0x2f')]);_0x1d6f4c[_0xda48('0x33')]=_[_0xda48('0x32')](_0x311af2['model'],qs[_0xda48('0x34')](_0x186be1[_0xda48('0x2f')][_0xda48('0x34')]));_0x1d6f4c['attributes']=_0x1d6f4c[_0xda48('0x33')][_0xda48('0x35')]?_0x1d6f4c['attributes']:_0x311af2['model'];if(!_0x186be1[_0xda48('0x2f')][_0xda48('0x36')](_0xda48('0x37'))){_0x1d6f4c[_0xda48('0x1b')]=qs[_0xda48('0x1b')](_0x186be1[_0xda48('0x2f')][_0xda48('0x1b')]);_0x1d6f4c['offset']=qs['offset'](_0x186be1['query'][_0xda48('0x1a')]);}_0x1d6f4c['order']=qs[_0xda48('0x38')](_0x186be1[_0xda48('0x2f')]['sort']);_0x1d6f4c['where']=qs[_0xda48('0x31')](_[_0xda48('0x39')](_0x186be1['query'],_0x311af2[_0xda48('0x31')]),_0x981ffc);if(_0x186be1['query'][_0xda48('0x3a')]){_0x1d6f4c[_0xda48('0x3b')]=_[_0xda48('0x3c')](_0x1d6f4c[_0xda48('0x3b')],{'$or':_[_0xda48('0x29')](_0x981ffc,function(_0x5e7ba1){if(_0x5e7ba1[_0xda48('0x3d')]!==_0xda48('0x3e')){var _0x106d66={};_0x106d66[_0x5e7ba1[_0xda48('0x26')]]={'$like':'%'+_0x186be1[_0xda48('0x2f')][_0xda48('0x3a')]+'%'};return _0x106d66;}})});}_0x1d6f4c=_[_0xda48('0x3c')]({},_0x1d6f4c,_0x186be1['options']);var _0x69a670={'where':_0x1d6f4c[_0xda48('0x3b')]};return db['Cdr']['count'](_0x69a670)[_0xda48('0x23')](function(_0x177c11){_0x3cdbda[_0xda48('0x3f')]=_0x177c11;if(_0x186be1[_0xda48('0x2f')]['includeAll']){_0x1d6f4c[_0xda48('0x40')]=[{'all':!![]}];}return db[_0xda48('0x2a')][_0xda48('0x41')](_0x1d6f4c);})['then'](function(_0x4a338d){_0x3cdbda[_0xda48('0x42')]=_0x4a338d;return _0x3cdbda;})[_0xda48('0x23')](respondWithFilteredResult(_0x164660,_0x1d6f4c))[_0xda48('0x43')](handleError(_0x164660,null));};exports['show']=function(_0x505d6b,_0x5ce198){var _0x30d7f9={'raw':!![],'where':{'id':_0x505d6b[_0xda48('0x44')]['id']}},_0x35989e={};_0x35989e[_0xda48('0x2e')]=_[_0xda48('0x30')](db[_0xda48('0x2a')][_0xda48('0x2b')]);_0x35989e['query']=_[_0xda48('0x30')](_0x505d6b[_0xda48('0x2f')]);_0x35989e['filters']=_[_0xda48('0x32')](_0x35989e[_0xda48('0x2e')],_0x35989e[_0xda48('0x2f')]);_0x30d7f9[_0xda48('0x33')]=_[_0xda48('0x32')](_0x35989e[_0xda48('0x2e')],qs[_0xda48('0x34')](_0x505d6b[_0xda48('0x2f')]['fields']));_0x30d7f9[_0xda48('0x33')]=_0x30d7f9[_0xda48('0x33')][_0xda48('0x35')]?_0x30d7f9[_0xda48('0x33')]:_0x35989e[_0xda48('0x2e')];if(_0x505d6b['query'][_0xda48('0x45')]){_0x30d7f9['include']=[{'all':!![]}];}_0x30d7f9=_[_0xda48('0x3c')]({},_0x30d7f9,_0x505d6b[_0xda48('0x46')]);return db['Cdr'][_0xda48('0x47')](_0x30d7f9)[_0xda48('0x23')](handleEntityNotFound(_0x5ce198,null))[_0xda48('0x23')](respondWithResult(_0x5ce198,null))[_0xda48('0x43')](handleError(_0x5ce198,null));};exports['create']=function(_0x4af24e,_0x22e738){return db['Cdr']['create'](_0x4af24e[_0xda48('0x48')],{})[_0xda48('0x23')](respondWithResult(_0x22e738,0xc9))[_0xda48('0x43')](handleError(_0x22e738,null));};exports[_0xda48('0x22')]=function(_0x5cab3a,_0xb47a85){if(_0x5cab3a[_0xda48('0x48')]['id']){delete _0x5cab3a[_0xda48('0x48')]['id'];}return db[_0xda48('0x2a')][_0xda48('0x47')]({'where':{'id':_0x5cab3a[_0xda48('0x44')]['id']}})[_0xda48('0x23')](handleEntityNotFound(_0xb47a85,null))[_0xda48('0x23')](saveUpdates(_0x5cab3a[_0xda48('0x48')],null))[_0xda48('0x23')](respondWithResult(_0xb47a85,null))[_0xda48('0x43')](handleError(_0xb47a85,null));};exports[_0xda48('0x49')]=function(_0x4e5e20,_0x1aeb06){return db[_0xda48('0x2a')][_0xda48('0x47')]({'where':{'id':_0x4e5e20[_0xda48('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aeb06,null))[_0xda48('0x23')](removeEntity(_0x1aeb06,null))[_0xda48('0x43')](handleError(_0x1aeb06,null));};exports[_0xda48('0x4a')]=function(_0x43826b,_0x12af66){return db[_0xda48('0x2a')]['describe']()[_0xda48('0x23')](respondWithResult(_0x12af66,null))[_0xda48('0x43')](handleError(_0x12af66,null));}; \ No newline at end of file +var _0x262d=['sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x2bba73,_0x82bb5d){var _0x19870b=function(_0x404d5f){while(--_0x404d5f){_0x2bba73['push'](_0x2bba73['shift']());}};_0x19870b(++_0x82bb5d);}(_0x262d,0x64));var _0xd262=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x262d[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0xd262('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd262('0x1'));var zipdir=require(_0xd262('0x2'));var jsonpatch=require(_0xd262('0x3'));var rp=require(_0xd262('0x4'));var moment=require(_0xd262('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd262('0x6'));var sox=require(_0xd262('0x7'));var csv=require(_0xd262('0x8'));var ejs=require(_0xd262('0x9'));var fs=require('fs');var _=require(_0xd262('0xa'));var squel=require(_0xd262('0xb'));var crypto=require(_0xd262('0xc'));var jsforce=require(_0xd262('0xd'));var deskjs=require(_0xd262('0xe'));var toCsv=require(_0xd262('0x8'));var querystring=require(_0xd262('0xf'));var Papa=require(_0xd262('0x10'));var Redis=require(_0xd262('0x11'));var authService=require(_0xd262('0x12'));var qs=require(_0xd262('0x13'));var as=require(_0xd262('0x14'));var hardwareService=require(_0xd262('0x15'));var logger=require(_0xd262('0x16'))(_0xd262('0x17'));var utils=require(_0xd262('0x18'));var config=require(_0xd262('0x19'));var licenseUtil=require(_0xd262('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2c38,_0x508217){_0x508217=_0x508217||0xcc;return function(_0x59c4f8){if(_0x59c4f8){return _0x2e2c38[_0xd262('0x1b')](_0x508217);}return _0x2e2c38['status'](_0x508217)['end']();};}function respondWithResult(_0x1d8bbb,_0x263de6){_0x263de6=_0x263de6||0xc8;return function(_0x39834e){if(_0x39834e){return _0x1d8bbb[_0xd262('0x1c')](_0x263de6)[_0xd262('0x1d')](_0x39834e);}};}function respondWithFilteredResult(_0x5c7c8a,_0x5bb1bb){return function(_0xa38e62){if(_0xa38e62){var _0x3fadd7=_0xa38e62[_0xd262('0x1e')],_0x3c0eac=_0x5bb1bb[_0xd262('0x1f')],_0x355906=_0x5bb1bb[_0xd262('0x1f')]+_0x5bb1bb[_0xd262('0x20')],_0x586ad8;if(_0x355906>=_0x3fadd7){_0x355906=_0x3fadd7;_0x586ad8=0xc8;}else{_0x586ad8=0xce;}_0x5c7c8a[_0xd262('0x1c')](_0x586ad8);return _0x5c7c8a[_0xd262('0x21')](_0xd262('0x22'),_0x3c0eac+'-'+_0x355906+'/'+_0x3fadd7)['json'](_0xa38e62);}return null;};}function patchUpdates(_0x45c08f){return function(_0x5de32b){try{jsonpatch[_0xd262('0x23')](_0x5de32b,_0x45c08f,!![]);}catch(_0x572b0f){return BPromise[_0xd262('0x24')](_0x572b0f);}return _0x5de32b[_0xd262('0x25')]();};}function saveUpdates(_0x308465,_0x1f28a8){return function(_0x3edc1b){if(_0x3edc1b){return _0x3edc1b['update'](_0x308465)[_0xd262('0x26')](function(_0x3e5946){return _0x3e5946;});}return null;};}function removeEntity(_0x3d32e0,_0xd2eebb){return function(_0x10f239){if(_0x10f239){return _0x10f239[_0xd262('0x27')]()['then'](function(){_0x3d32e0[_0xd262('0x1c')](0xcc)[_0xd262('0x28')]();});}};}function handleEntityNotFound(_0x4bcd27,_0x306695){return function(_0x16593d){if(!_0x16593d){_0x4bcd27[_0xd262('0x1b')](0x194);}return _0x16593d;};}function handleError(_0x38d69b,_0x4915c6){_0x4915c6=_0x4915c6||0x1f4;return function(_0x2365e1){logger[_0xd262('0x29')](_0x2365e1[_0xd262('0x2a')]);if(_0x2365e1[_0xd262('0x2b')]){delete _0x2365e1[_0xd262('0x2b')];}_0x38d69b[_0xd262('0x1c')](_0x4915c6)[_0xd262('0x2c')](_0x2365e1);};}exports[_0xd262('0x2d')]=function(_0x21e00c,_0x3b0b38){var _0x48106d={},_0x229b49={},_0xecb504={'count':0x0,'rows':[]};var _0x18a857=_[_0xd262('0x2e')](db[_0xd262('0x2f')][_0xd262('0x30')],function(_0x2f0206){return{'name':_0x2f0206[_0xd262('0x31')],'type':_0x2f0206['type'][_0xd262('0x32')]};});_0x229b49[_0xd262('0x33')]=_[_0xd262('0x2e')](_0x18a857,_0xd262('0x2b'));_0x229b49['query']=_[_0xd262('0x34')](_0x21e00c[_0xd262('0x35')]);_0x229b49['filters']=_[_0xd262('0x36')](_0x229b49[_0xd262('0x33')],_0x229b49['query']);_0x48106d[_0xd262('0x37')]=_[_0xd262('0x36')](_0x229b49[_0xd262('0x33')],qs[_0xd262('0x38')](_0x21e00c['query'][_0xd262('0x38')]));_0x48106d[_0xd262('0x37')]=_0x48106d['attributes'][_0xd262('0x39')]?_0x48106d[_0xd262('0x37')]:_0x229b49[_0xd262('0x33')];if(!_0x21e00c[_0xd262('0x35')][_0xd262('0x3a')]('nolimit')){_0x48106d[_0xd262('0x20')]=qs[_0xd262('0x20')](_0x21e00c[_0xd262('0x35')][_0xd262('0x20')]);_0x48106d[_0xd262('0x1f')]=qs['offset'](_0x21e00c[_0xd262('0x35')]['offset']);}_0x48106d[_0xd262('0x3b')]=qs[_0xd262('0x3c')](_0x21e00c[_0xd262('0x35')][_0xd262('0x3c')]);_0x48106d['where']=qs['filters'](_[_0xd262('0x3d')](_0x21e00c[_0xd262('0x35')],_0x229b49[_0xd262('0x3e')]),_0x18a857);if(_0x21e00c[_0xd262('0x35')][_0xd262('0x3f')]){_0x48106d[_0xd262('0x40')]=_['merge'](_0x48106d[_0xd262('0x40')],{'$or':_[_0xd262('0x2e')](_0x18a857,function(_0x6c9f9f){if(_0x6c9f9f[_0xd262('0x41')]!==_0xd262('0x42')){var _0x3613d0={};_0x3613d0[_0x6c9f9f[_0xd262('0x2b')]]={'$like':'%'+_0x21e00c['query'][_0xd262('0x3f')]+'%'};return _0x3613d0;}})});}_0x48106d=_[_0xd262('0x43')]({},_0x48106d,_0x21e00c[_0xd262('0x44')]);var _0x21c517={'where':_0x48106d[_0xd262('0x40')]};return db[_0xd262('0x2f')][_0xd262('0x1e')](_0x21c517)[_0xd262('0x26')](function(_0x2e3599){_0xecb504[_0xd262('0x1e')]=_0x2e3599;if(_0x21e00c[_0xd262('0x35')][_0xd262('0x45')]){_0x48106d[_0xd262('0x46')]=[{'all':!![]}];}return db[_0xd262('0x2f')][_0xd262('0x47')](_0x48106d);})[_0xd262('0x26')](function(_0x5dd927){_0xecb504['rows']=_0x5dd927;return _0xecb504;})[_0xd262('0x26')](respondWithFilteredResult(_0x3b0b38,_0x48106d))[_0xd262('0x48')](handleError(_0x3b0b38,null));};exports[_0xd262('0x49')]=function(_0x4f7fe5,_0x82c5a1){var _0x57789f={'raw':!![],'where':{'id':_0x4f7fe5[_0xd262('0x4a')]['id']}},_0x12f799={};_0x12f799['model']=_[_0xd262('0x34')](db[_0xd262('0x2f')]['rawAttributes']);_0x12f799[_0xd262('0x35')]=_[_0xd262('0x34')](_0x4f7fe5['query']);_0x12f799[_0xd262('0x3e')]=_[_0xd262('0x36')](_0x12f799[_0xd262('0x33')],_0x12f799[_0xd262('0x35')]);_0x57789f[_0xd262('0x37')]=_['intersection'](_0x12f799['model'],qs['fields'](_0x4f7fe5[_0xd262('0x35')][_0xd262('0x38')]));_0x57789f[_0xd262('0x37')]=_0x57789f['attributes']['length']?_0x57789f[_0xd262('0x37')]:_0x12f799[_0xd262('0x33')];if(_0x4f7fe5[_0xd262('0x35')]['includeAll']){_0x57789f[_0xd262('0x46')]=[{'all':!![]}];}_0x57789f=_[_0xd262('0x43')]({},_0x57789f,_0x4f7fe5['options']);return db[_0xd262('0x2f')][_0xd262('0x4b')](_0x57789f)[_0xd262('0x26')](handleEntityNotFound(_0x82c5a1,null))[_0xd262('0x26')](respondWithResult(_0x82c5a1,null))[_0xd262('0x48')](handleError(_0x82c5a1,null));};exports[_0xd262('0x4c')]=function(_0x4ad908,_0x362e86){return db[_0xd262('0x2f')]['create'](_0x4ad908[_0xd262('0x4d')],{})[_0xd262('0x26')](respondWithResult(_0x362e86,0xc9))[_0xd262('0x48')](handleError(_0x362e86,null));};exports[_0xd262('0x4e')]=function(_0x24c458,_0x445be1){if(_0x24c458[_0xd262('0x4d')]['id']){delete _0x24c458['body']['id'];}return db[_0xd262('0x2f')][_0xd262('0x4b')]({'where':{'id':_0x24c458['params']['id']}})[_0xd262('0x26')](handleEntityNotFound(_0x445be1,null))[_0xd262('0x26')](saveUpdates(_0x24c458[_0xd262('0x4d')],null))[_0xd262('0x26')](respondWithResult(_0x445be1,null))[_0xd262('0x48')](handleError(_0x445be1,null));};exports[_0xd262('0x27')]=function(_0x581391,_0x1e9c4e){return db[_0xd262('0x2f')][_0xd262('0x4b')]({'where':{'id':_0x581391[_0xd262('0x4a')]['id']}})[_0xd262('0x26')](handleEntityNotFound(_0x1e9c4e,null))[_0xd262('0x26')](removeEntity(_0x1e9c4e,null))[_0xd262('0x48')](handleError(_0x1e9c4e,null));};exports[_0xd262('0x4f')]=function(_0x14ada8,_0x554ad6){return db[_0xd262('0x2f')][_0xd262('0x4f')]()['then'](respondWithResult(_0x554ad6,null))[_0xd262('0x48')](handleError(_0x554ad6,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4d10ff6..5043731 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','uniqueid','util','api','moment'];(function(_0x1753bc,_0x440440){var _0x8c4313=function(_0x2247cf){while(--_0x2247cf){_0x1753bc['push'](_0x1753bc['shift']());}};_0x8c4313(++_0x440440);}(_0xadb5,0xad));var _0x5adb=function(_0x3b637c,_0x1e148b){_0x3b637c=_0x3b637c-0x0;var _0x433089=_0xadb5[_0x3b637c];return _0x433089;};'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('./cdr.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')]},{'name':_0x5adb('0xc'),'fields':[_0x5adb('0xc')]},{'name':_0x5adb('0xd'),'fields':[_0x5adb('0xd')]},{'name':_0x5adb('0xe'),'fields':[_0x5adb('0xe')]},{'name':'src','fields':['src']},{'name':_0x5adb('0xf'),'fields':[_0x5adb('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc1c6=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Cdr'];(function(_0xca6cb2,_0x29d8bc){var _0x33d214=function(_0x26d57a){while(--_0x26d57a){_0xca6cb2['push'](_0xca6cb2['shift']());}};_0x33d214(++_0x29d8bc);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x38e886,_0x4cd19c){_0x38e886=_0x38e886-0x0;var _0x4422b0=_0xc1c6[_0x38e886];return _0x4422b0;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'calldate','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['disposition']},{'name':_0x6c1c('0xd'),'fields':[_0x6c1c('0xd')]},{'name':_0x6c1c('0xe'),'fields':[_0x6c1c('0xe')]},{'name':'uniqueid','fields':[_0x6c1c('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2df64a2..6818b02 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 _0x4385=['jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23e5b7,_0x201e66){var _0x4ec4aa=function(_0x512618){while(--_0x512618){_0x23e5b7['push'](_0x23e5b7['shift']());}};_0x4ec4aa(++_0x201e66);}(_0x4385,0x133));var _0x5438=function(_0x39bfca,_0x1a1881){_0x39bfca=_0x39bfca-0x0;var _0x24519a=_0x4385[_0x39bfca];return _0x24519a;};'use strict';var _=require(_0x5438('0x0'));var util=require('util');var moment=require(_0x5438('0x1'));var BPromise=require(_0x5438('0x2'));var rs=require(_0x5438('0x3'));var fs=require('fs');var Redis=require(_0x5438('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5438('0x5'));var logger=require(_0x5438('0x6'))(_0x5438('0x7'));var config=require('../../config/environment');var jayson=require(_0x5438('0x8'));var client=jayson[_0x5438('0x9')][_0x5438('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x499d54,_0x16b63,_0x5ae176){return new BPromise(function(_0x15af6c,_0xa5b2b8){return client['request'](_0x499d54,_0x5ae176)[_0x5438('0xb')](function(_0x2c3e40){logger['info'](_0x5438('0xc'),_0x16b63,_0x5438('0xd'));logger['debug'](_0x5438('0xe'),_0x16b63,_0x5438('0xd'),JSON['stringify'](_0x2c3e40));if(_0x2c3e40[_0x5438('0xf')]){if(_0x2c3e40[_0x5438('0xf')][_0x5438('0x10')]===0x1f4){logger[_0x5438('0xf')](_0x5438('0xc'),_0x16b63,_0x2c3e40['error'][_0x5438('0x11')]);return _0xa5b2b8(_0x2c3e40[_0x5438('0xf')][_0x5438('0x11')]);}logger[_0x5438('0xf')](_0x5438('0xc'),_0x16b63,_0x2c3e40[_0x5438('0xf')][_0x5438('0x11')]);return _0x15af6c(_0x2c3e40['error'][_0x5438('0x11')]);}else{logger[_0x5438('0x12')](_0x5438('0xc'),_0x16b63,_0x5438('0xd'));_0x15af6c(_0x2c3e40[_0x5438('0x13')][_0x5438('0x11')]);}})[_0x5438('0x14')](function(_0x33b61b){logger['error'](_0x5438('0xc'),_0x16b63,_0x33b61b);_0xa5b2b8(_0x33b61b);});});} \ No newline at end of file +var _0x7a7b=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x3f4265,_0xfd8046){var _0x5d4525=function(_0x1883e1){while(--_0x1883e1){_0x3f4265['push'](_0x3f4265['shift']());}};_0x5d4525(++_0xfd8046);}(_0x7a7b,0xd0));var _0xb7a7=function(_0x12f7d6,_0x4be9ad){_0x12f7d6=_0x12f7d6-0x0;var _0xcac6e5=_0x7a7b[_0x12f7d6];return _0xcac6e5;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var moment=require(_0xb7a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7a7('0x4'))['db'];var utils=require(_0xb7a7('0x5'));var logger=require(_0xb7a7('0x6'))(_0xb7a7('0x7'));var config=require(_0xb7a7('0x8'));var jayson=require(_0xb7a7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12d364,_0x20993e,_0xcae982){return new BPromise(function(_0x5a1ae1,_0xc64973){return client[_0xb7a7('0xa')](_0x12d364,_0xcae982)[_0xb7a7('0xb')](function(_0x3ba3d7){logger['info']('Cdr,\x20%s,\x20%s',_0x20993e,'request\x20sent');logger[_0xb7a7('0xc')](_0xb7a7('0xd'),_0x20993e,_0xb7a7('0xe'),JSON['stringify'](_0x3ba3d7));if(_0x3ba3d7[_0xb7a7('0xf')]){if(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x10')]===0x1f4){logger[_0xb7a7('0xf')]('Cdr,\x20%s,\x20%s',_0x20993e,_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);return _0xc64973(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);}logger[_0xb7a7('0xf')](_0xb7a7('0x12'),_0x20993e,_0x3ba3d7[_0xb7a7('0xf')]['message']);return _0x5a1ae1(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);}else{logger['info'](_0xb7a7('0x12'),_0x20993e,_0xb7a7('0xe'));_0x5a1ae1(_0x3ba3d7[_0xb7a7('0x13')][_0xb7a7('0x11')]);}})[_0xb7a7('0x14')](function(_0x25a9fb){logger['error']('Cdr,\x20%s,\x20%s',_0x20993e,_0x25a9fb);_0xc64973(_0x25a9fb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index bc8dd02..82e432c 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 _0xf5e2=['create','put','update','exports','multer','express','Router','../../config/environment','./cdr.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x161951,_0x542e06){var _0x5c9c1a=function(_0x221fc2){while(--_0x221fc2){_0x161951['push'](_0x161951['shift']());}};_0x5c9c1a(++_0x542e06);}(_0xf5e2,0x144));var _0x2f5e=function(_0x52e0a9,_0x110044){_0x52e0a9=_0x52e0a9-0x0;var _0x37015a=_0xf5e2[_0x52e0a9];return _0x37015a;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2f5e('0x1'));var router=express[_0x2f5e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f5e('0x3'));var controller=require(_0x2f5e('0x4'));router[_0x2f5e('0x5')]('/',auth['isAuthenticated'](),controller[_0x2f5e('0x6')]);router['get'](_0x2f5e('0x7'),auth['isAuthenticated'](),controller[_0x2f5e('0x8')]);router['get'](_0x2f5e('0x9'),auth[_0x2f5e('0xa')](),controller[_0x2f5e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2f5e('0xc')]);router[_0x2f5e('0xd')](_0x2f5e('0x9'),auth['isAuthenticated'](),controller[_0x2f5e('0xe')]);router['delete'](_0x2f5e('0x9'),auth[_0x2f5e('0xa')](),controller['destroy']);module[_0x2f5e('0xf')]=router; \ No newline at end of file +var _0xd8f7=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer'];(function(_0x40c656,_0x27b0fa){var _0x553a28=function(_0x49ce84){while(--_0x49ce84){_0x40c656['push'](_0x40c656['shift']());}};_0x553a28(++_0x27b0fa);}(_0xd8f7,0xef));var _0x7d8f=function(_0x3de9fe,_0x3a7be9){_0x3de9fe=_0x3de9fe-0x0;var _0x547d09=_0xd8f7[_0x3de9fe];return _0x547d09;};'use strict';var multer=require(_0x7d8f('0x0'));var util=require(_0x7d8f('0x1'));var path=require('path');var timeout=require(_0x7d8f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x7d8f('0x3'));var interaction=require(_0x7d8f('0x4'));var config=require(_0x7d8f('0x5'));var controller=require('./cdr.controller');router[_0x7d8f('0x6')]('/',auth['isAuthenticated'](),controller[_0x7d8f('0x7')]);router[_0x7d8f('0x6')]('/describe',auth[_0x7d8f('0x8')](),controller['describe']);router['get'](_0x7d8f('0x9'),auth['isAuthenticated'](),controller[_0x7d8f('0xa')]);router[_0x7d8f('0xb')]('/',auth[_0x7d8f('0x8')](),controller[_0x7d8f('0xc')]);router[_0x7d8f('0xd')](_0x7d8f('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7d8f('0x9'),auth['isAuthenticated'](),controller[_0x7d8f('0xe')]);module[_0x7d8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 173b0b5..b658f3e 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 _0x065b=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x3c5249,_0x52a4a6){var _0x5ea511=function(_0x4f97c6){while(--_0x4f97c6){_0x3c5249['push'](_0x3c5249['shift']());}};_0x5ea511(++_0x52a4a6);}(_0x065b,0x84));var _0xb065=function(_0x5a7244,_0x605a4){_0x5a7244=_0x5a7244-0x0;var _0x77ff1b=_0x065b[_0x5a7244];return _0x77ff1b;};'use strict';var Sequelize=require(_0xb065('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb065('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb065('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb065('0x3')]()},'description':{'type':Sequelize[_0xb065('0x2')]},'interval':{'type':Sequelize[_0xb065('0x2')],'defaultValue':_0xb065('0x4')}}; \ No newline at end of file +var _0x9907=['noop','TEXT','*,*,*,*','STRING'];(function(_0x4d73fc,_0x56f819){var _0x48a4cd=function(_0x188906){while(--_0x188906){_0x4d73fc['push'](_0x4d73fc['shift']());}};_0x48a4cd(++_0x56f819);}(_0x9907,0x1c7));var _0x7990=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9907[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7990('0x0')],'allowNull':![],'defaultValue':_0x7990('0x1')},'appdata':{'type':Sequelize[_0x7990('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7990('0x0')],'defaultValue':_0x7990('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1742b9a..26647f5 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 _0xfc87=['moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','update','then','destroy','sendStatus','stack','name','show','keys','ChatApplication','query','filters','model','attributes','intersection','fields','length','includeAll','merge','find','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x105df9,_0x3dc4f1){var _0x2e0281=function(_0x484f31){while(--_0x484f31){_0x105df9['push'](_0x105df9['shift']());}};_0x2e0281(++_0x3dc4f1);}(_0xfc87,0x1ce));var _0x7fc8=function(_0x4b2a30,_0x1156cf){_0x4b2a30=_0x4b2a30-0x0;var _0xa17628=_0xfc87[_0x4b2a30];return _0xa17628;};'use strict';var pdf=require(_0x7fc8('0x0'));var emlformat=require(_0x7fc8('0x1'));var rimraf=require(_0x7fc8('0x2'));var zipdir=require(_0x7fc8('0x3'));var jsonpatch=require(_0x7fc8('0x4'));var rp=require(_0x7fc8('0x5'));var moment=require(_0x7fc8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7fc8('0x7'));var util=require(_0x7fc8('0x8'));var path=require(_0x7fc8('0x9'));var sox=require(_0x7fc8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fc8('0xb'));var fs=require('fs');var _=require(_0x7fc8('0xc'));var squel=require('squel');var crypto=require(_0x7fc8('0xd'));var jsforce=require(_0x7fc8('0xe'));var deskjs=require(_0x7fc8('0xf'));var toCsv=require(_0x7fc8('0x10'));var querystring=require(_0x7fc8('0x11'));var Papa=require(_0x7fc8('0x12'));var Redis=require(_0x7fc8('0x13'));var authService=require(_0x7fc8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc8('0x15'))(_0x7fc8('0x16'));var utils=require('../../config/utils');var config=require(_0x7fc8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa4bb,_0x543718){_0x543718=_0x543718||0xcc;return function(_0x53589d){if(_0x53589d){return _0xaa4bb['sendStatus'](_0x543718);}return _0xaa4bb[_0x7fc8('0x18')](_0x543718)[_0x7fc8('0x19')]();};}function respondWithResult(_0x1a9522,_0x54dcd7){_0x54dcd7=_0x54dcd7||0xc8;return function(_0x5a8756){if(_0x5a8756){return _0x1a9522['status'](_0x54dcd7)[_0x7fc8('0x1a')](_0x5a8756);}};}function respondWithFilteredResult(_0x16c008,_0x24aca7){return function(_0xe2734e){if(_0xe2734e){var _0x597e62=_0xe2734e['count'],_0x2b76c6=_0x24aca7[_0x7fc8('0x1b')],_0x17b285=_0x24aca7[_0x7fc8('0x1b')]+_0x24aca7[_0x7fc8('0x1c')],_0x4db820;if(_0x17b285>=_0x597e62){_0x17b285=_0x597e62;_0x4db820=0xc8;}else{_0x4db820=0xce;}_0x16c008['status'](_0x4db820);return _0x16c008[_0x7fc8('0x1d')]('Content-Range',_0x2b76c6+'-'+_0x17b285+'/'+_0x597e62)['json'](_0xe2734e);}return null;};}function patchUpdates(_0x16482c){return function(_0x1b5067){try{jsonpatch['apply'](_0x1b5067,_0x16482c,!![]);}catch(_0x2366c9){return BPromise['reject'](_0x2366c9);}return _0x1b5067['save']();};}function saveUpdates(_0x2bea09,_0x205b2b){return function(_0x16541c){if(_0x16541c){return _0x16541c[_0x7fc8('0x1e')](_0x2bea09)[_0x7fc8('0x1f')](function(_0x24d2a9){return _0x24d2a9;});}return null;};}function removeEntity(_0xbe5e7e,_0x3cabf2){return function(_0x2bd0af){if(_0x2bd0af){return _0x2bd0af[_0x7fc8('0x20')]()[_0x7fc8('0x1f')](function(){_0xbe5e7e[_0x7fc8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bfbd3,_0x4e2b80){return function(_0x1366d7){if(!_0x1366d7){_0x1bfbd3[_0x7fc8('0x21')](0x194);}return _0x1366d7;};}function handleError(_0x5ef18c,_0x1d6432){_0x1d6432=_0x1d6432||0x1f4;return function(_0x55ad8f){logger['error'](_0x55ad8f[_0x7fc8('0x22')]);if(_0x55ad8f[_0x7fc8('0x23')]){delete _0x55ad8f[_0x7fc8('0x23')];}_0x5ef18c['status'](_0x1d6432)['send'](_0x55ad8f);};}exports[_0x7fc8('0x24')]=function(_0x4861cd,_0x474d98){var _0x1a751b={'raw':!![],'where':{'id':_0x4861cd['params']['id']}},_0x1cdbdf={};_0x1cdbdf['model']=_[_0x7fc8('0x25')](db[_0x7fc8('0x26')]['rawAttributes']);_0x1cdbdf['query']=_['keys'](_0x4861cd[_0x7fc8('0x27')]);_0x1cdbdf[_0x7fc8('0x28')]=_['intersection'](_0x1cdbdf[_0x7fc8('0x29')],_0x1cdbdf['query']);_0x1a751b[_0x7fc8('0x2a')]=_[_0x7fc8('0x2b')](_0x1cdbdf[_0x7fc8('0x29')],qs[_0x7fc8('0x2c')](_0x4861cd['query'][_0x7fc8('0x2c')]));_0x1a751b['attributes']=_0x1a751b['attributes'][_0x7fc8('0x2d')]?_0x1a751b['attributes']:_0x1cdbdf[_0x7fc8('0x29')];if(_0x4861cd[_0x7fc8('0x27')][_0x7fc8('0x2e')]){_0x1a751b['include']=[{'all':!![]}];}_0x1a751b=_[_0x7fc8('0x2f')]({},_0x1a751b,_0x4861cd['options']);return db[_0x7fc8('0x26')][_0x7fc8('0x30')](_0x1a751b)[_0x7fc8('0x1f')](handleEntityNotFound(_0x474d98,null))[_0x7fc8('0x1f')](respondWithResult(_0x474d98,null))[_0x7fc8('0x31')](handleError(_0x474d98,null));};exports['update']=function(_0x357f14,_0x4c7bc9){if(_0x357f14['body']['id']){delete _0x357f14[_0x7fc8('0x32')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x357f14[_0x7fc8('0x33')]['id']}})[_0x7fc8('0x1f')](handleEntityNotFound(_0x4c7bc9,null))['then'](saveUpdates(_0x357f14[_0x7fc8('0x32')],null))['then'](respondWithResult(_0x4c7bc9,null))[_0x7fc8('0x31')](handleError(_0x4c7bc9,null));};exports['destroy']=function(_0x58df23,_0x8a7e3e){return db[_0x7fc8('0x26')][_0x7fc8('0x30')]({'where':{'id':_0x58df23[_0x7fc8('0x33')]['id']}})[_0x7fc8('0x1f')](handleEntityNotFound(_0x8a7e3e,null))['then'](removeEntity(_0x8a7e3e,null))[_0x7fc8('0x31')](handleError(_0x8a7e3e,null));}; \ No newline at end of file +var _0x72af=['save','update','then','destroy','error','stack','name','send','show','model','ChatApplication','query','filters','intersection','fields','attributes','length','includeAll','merge','find','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x57e07b,_0x3a3c77){var _0x2a7b65=function(_0x4a42c4){while(--_0x4a42c4){_0x57e07b['push'](_0x57e07b['shift']());}};_0x2a7b65(++_0x3a3c77);}(_0x72af,0x1bf));var _0xf72a=function(_0x3a59e2,_0x502e43){_0x3a59e2=_0x3a59e2-0x0;var _0x226b63=_0x72af[_0x3a59e2];return _0x226b63;};'use strict';var pdf=require(_0xf72a('0x0'));var emlformat=require(_0xf72a('0x1'));var rimraf=require(_0xf72a('0x2'));var zipdir=require(_0xf72a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf72a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf72a('0x5'));var util=require(_0xf72a('0x6'));var path=require(_0xf72a('0x7'));var sox=require(_0xf72a('0x8'));var csv=require('to-csv');var ejs=require(_0xf72a('0x9'));var fs=require('fs');var _=require(_0xf72a('0xa'));var squel=require(_0xf72a('0xb'));var crypto=require(_0xf72a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf72a('0xd'));var toCsv=require(_0xf72a('0xe'));var querystring=require(_0xf72a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf72a('0x10'));var authService=require(_0xf72a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf72a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf72a('0x13'))(_0xf72a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf72a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c1c1a,_0x2dc455){_0x2dc455=_0x2dc455||0xcc;return function(_0x3499a5){if(_0x3499a5){return _0x2c1c1a[_0xf72a('0x16')](_0x2dc455);}return _0x2c1c1a[_0xf72a('0x17')](_0x2dc455)[_0xf72a('0x18')]();};}function respondWithResult(_0x449484,_0xbed691){_0xbed691=_0xbed691||0xc8;return function(_0x5a279e){if(_0x5a279e){return _0x449484['status'](_0xbed691)[_0xf72a('0x19')](_0x5a279e);}};}function respondWithFilteredResult(_0x515bc5,_0xfaae47){return function(_0x49e932){if(_0x49e932){var _0x1b025d=_0x49e932[_0xf72a('0x1a')],_0x3ca7c6=_0xfaae47[_0xf72a('0x1b')],_0x201d59=_0xfaae47[_0xf72a('0x1b')]+_0xfaae47[_0xf72a('0x1c')],_0x5768e9;if(_0x201d59>=_0x1b025d){_0x201d59=_0x1b025d;_0x5768e9=0xc8;}else{_0x5768e9=0xce;}_0x515bc5['status'](_0x5768e9);return _0x515bc5['set'](_0xf72a('0x1d'),_0x3ca7c6+'-'+_0x201d59+'/'+_0x1b025d)[_0xf72a('0x19')](_0x49e932);}return null;};}function patchUpdates(_0x2c104c){return function(_0x4ef62e){try{jsonpatch['apply'](_0x4ef62e,_0x2c104c,!![]);}catch(_0x54e460){return BPromise['reject'](_0x54e460);}return _0x4ef62e[_0xf72a('0x1e')]();};}function saveUpdates(_0x5a044d,_0x34075a){return function(_0x572268){if(_0x572268){return _0x572268[_0xf72a('0x1f')](_0x5a044d)[_0xf72a('0x20')](function(_0x2f6aaf){return _0x2f6aaf;});}return null;};}function removeEntity(_0x4cc4c6,_0x43857a){return function(_0x3e09a0){if(_0x3e09a0){return _0x3e09a0[_0xf72a('0x21')]()['then'](function(){_0x4cc4c6[_0xf72a('0x17')](0xcc)[_0xf72a('0x18')]();});}};}function handleEntityNotFound(_0x1c7bb7,_0x171ac9){return function(_0x57720d){if(!_0x57720d){_0x1c7bb7[_0xf72a('0x16')](0x194);}return _0x57720d;};}function handleError(_0x550660,_0x57c24a){_0x57c24a=_0x57c24a||0x1f4;return function(_0x7201fd){logger[_0xf72a('0x22')](_0x7201fd[_0xf72a('0x23')]);if(_0x7201fd[_0xf72a('0x24')]){delete _0x7201fd[_0xf72a('0x24')];}_0x550660[_0xf72a('0x17')](_0x57c24a)[_0xf72a('0x25')](_0x7201fd);};}exports[_0xf72a('0x26')]=function(_0x14f60d,_0x1808d4){var _0x218d77={'raw':!![],'where':{'id':_0x14f60d['params']['id']}},_0x4f8a63={};_0x4f8a63[_0xf72a('0x27')]=_['keys'](db[_0xf72a('0x28')]['rawAttributes']);_0x4f8a63['query']=_['keys'](_0x14f60d[_0xf72a('0x29')]);_0x4f8a63[_0xf72a('0x2a')]=_[_0xf72a('0x2b')](_0x4f8a63['model'],_0x4f8a63[_0xf72a('0x29')]);_0x218d77['attributes']=_[_0xf72a('0x2b')](_0x4f8a63[_0xf72a('0x27')],qs[_0xf72a('0x2c')](_0x14f60d['query'][_0xf72a('0x2c')]));_0x218d77['attributes']=_0x218d77[_0xf72a('0x2d')][_0xf72a('0x2e')]?_0x218d77[_0xf72a('0x2d')]:_0x4f8a63[_0xf72a('0x27')];if(_0x14f60d[_0xf72a('0x29')][_0xf72a('0x2f')]){_0x218d77['include']=[{'all':!![]}];}_0x218d77=_[_0xf72a('0x30')]({},_0x218d77,_0x14f60d['options']);return db[_0xf72a('0x28')][_0xf72a('0x31')](_0x218d77)[_0xf72a('0x20')](handleEntityNotFound(_0x1808d4,null))[_0xf72a('0x20')](respondWithResult(_0x1808d4,null))[_0xf72a('0x32')](handleError(_0x1808d4,null));};exports[_0xf72a('0x1f')]=function(_0xfc0c11,_0x12741a){if(_0xfc0c11[_0xf72a('0x33')]['id']){delete _0xfc0c11[_0xf72a('0x33')]['id'];}return db[_0xf72a('0x28')][_0xf72a('0x31')]({'where':{'id':_0xfc0c11[_0xf72a('0x34')]['id']}})[_0xf72a('0x20')](handleEntityNotFound(_0x12741a,null))[_0xf72a('0x20')](saveUpdates(_0xfc0c11['body'],null))[_0xf72a('0x20')](respondWithResult(_0x12741a,null))[_0xf72a('0x32')](handleError(_0x12741a,null));};exports[_0xf72a('0x21')]=function(_0x362111,_0x2c8c4e){return db['ChatApplication'][_0xf72a('0x31')]({'where':{'id':_0x362111[_0xf72a('0x34')]['id']}})['then'](handleEntityNotFound(_0x2c8c4e,null))[_0xf72a('0x20')](removeEntity(_0x2c8c4e,null))[_0xf72a('0x32')](handleError(_0x2c8c4e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2fd04fc..2c6c1db 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(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 8c570b2..b087373 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 _0x8684=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8684,0x1ed));var _0x4868=function(_0xe61a8e,_0x5506ea){_0xe61a8e=_0xe61a8e-0x0;var _0xbe8518=_0x8684[_0xe61a8e];return _0xbe8518;};'use strict';var _=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var moment=require('moment');var BPromise=require(_0x4868('0x2'));var rs=require(_0x4868('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4868('0x4'))(_0x4868('0x5'));var config=require(_0x4868('0x6'));var jayson=require(_0x4868('0x7'));var client=jayson[_0x4868('0x8')][_0x4868('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7ab3,_0x339d22,_0x18051a){return new BPromise(function(_0x5b8a07,_0x3746e8){return client[_0x4868('0xa')](_0x2a7ab3,_0x18051a)[_0x4868('0xb')](function(_0x384b71){logger[_0x4868('0xc')](_0x4868('0xd'),_0x339d22,_0x4868('0xe'));logger[_0x4868('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x339d22,_0x4868('0xe'),JSON[_0x4868('0x10')](_0x384b71));if(_0x384b71[_0x4868('0x11')]){if(_0x384b71[_0x4868('0x11')][_0x4868('0x12')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x339d22,_0x384b71[_0x4868('0x11')]['message']);return _0x3746e8(_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);}logger[_0x4868('0x11')](_0x4868('0xd'),_0x339d22,_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);return _0x5b8a07(_0x384b71[_0x4868('0x11')][_0x4868('0x13')]);}else{logger[_0x4868('0xc')](_0x4868('0xd'),_0x339d22,_0x4868('0xe'));_0x5b8a07(_0x384b71[_0x4868('0x14')][_0x4868('0x13')]);}})[_0x4868('0x15')](function(_0x2ef2af){logger[_0x4868('0x11')](_0x4868('0xd'),_0x339d22,_0x2ef2af);_0x3746e8(_0x2ef2af);});});} \ No newline at end of file +var _0xd966=['http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2fe975,_0x13249a){var _0x41a20d=function(_0x1578a1){while(--_0x1578a1){_0x2fe975['push'](_0x2fe975['shift']());}};_0x41a20d(++_0x13249a);}(_0xd966,0x1e7));var _0x6d96=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0xd966[_0x43747e];return _0x7fb853;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d96('0x0'));var BPromise=require('bluebird');var rs=require(_0x6d96('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d96('0x2'))['db'];var utils=require(_0x6d96('0x3'));var logger=require(_0x6d96('0x4'))('rpc');var config=require(_0x6d96('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d96('0x6')][_0x6d96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x515a22,_0x5e781f,_0x4fc530){return new BPromise(function(_0x2a696d,_0x5e54c3){return client['request'](_0x515a22,_0x4fc530)[_0x6d96('0x8')](function(_0x146e28){logger[_0x6d96('0x9')](_0x6d96('0xa'),_0x5e781f,_0x6d96('0xb'));logger[_0x6d96('0xc')](_0x6d96('0xd'),_0x5e781f,_0x6d96('0xb'),JSON['stringify'](_0x146e28));if(_0x146e28[_0x6d96('0xe')]){if(_0x146e28[_0x6d96('0xe')][_0x6d96('0xf')]===0x1f4){logger[_0x6d96('0xe')](_0x6d96('0xa'),_0x5e781f,_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);return _0x5e54c3(_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);}logger[_0x6d96('0xe')](_0x6d96('0xa'),_0x5e781f,_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);return _0x2a696d(_0x146e28[_0x6d96('0xe')]['message']);}else{logger[_0x6d96('0x9')](_0x6d96('0xa'),_0x5e781f,_0x6d96('0xb'));_0x2a696d(_0x146e28[_0x6d96('0x11')]['message']);}})[_0x6d96('0x12')](function(_0x1abe07){logger['error'](_0x6d96('0xa'),_0x5e781f,_0x1abe07);_0x5e54c3(_0x1abe07);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7ea4a97..3ad6a6f 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 _0xab53=['isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','show','put'];(function(_0x1322fa,_0x1a1690){var _0x3c9af7=function(_0x5e0e16){while(--_0x5e0e16){_0x1322fa['push'](_0x1322fa['shift']());}};_0x3c9af7(++_0x1a1690);}(_0xab53,0x9a));var _0x3ab5=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xab53[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x3ab5('0x0'));var util=require(_0x3ab5('0x1'));var path=require(_0x3ab5('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ab5('0x3'));var router=express[_0x3ab5('0x4')]();var auth=require(_0x3ab5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ab5('0x6'));var controller=require(_0x3ab5('0x7'));router['get'](_0x3ab5('0x8'),auth['isAuthenticated'](),controller[_0x3ab5('0x9')]);router[_0x3ab5('0xa')](_0x3ab5('0x8'),auth[_0x3ab5('0xb')](),controller[_0x3ab5('0xc')]);router[_0x3ab5('0xd')](_0x3ab5('0x8'),auth[_0x3ab5('0xb')](),controller['destroy']);module[_0x3ab5('0xe')]=router; \ No newline at end of file +var _0xee88=['util','path','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','multer'];(function(_0x980a04,_0x3f1a86){var _0x4be21f=function(_0x53fa2d){while(--_0x53fa2d){_0x980a04['push'](_0x980a04['shift']());}};_0x4be21f(++_0x3f1a86);}(_0xee88,0x1df));var _0x8ee8=function(_0x4c7959,_0x46d94f){_0x4c7959=_0x4c7959-0x0;var _0xab8fe8=_0xee88[_0x4c7959];return _0xab8fe8;};'use strict';var multer=require(_0x8ee8('0x0'));var util=require(_0x8ee8('0x1'));var path=require(_0x8ee8('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ee8('0x3'));var router=express[_0x8ee8('0x4')]();var auth=require(_0x8ee8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8ee8('0x6'));var controller=require(_0x8ee8('0x7'));router[_0x8ee8('0x8')](_0x8ee8('0x9'),auth[_0x8ee8('0xa')](),controller[_0x8ee8('0xb')]);router[_0x8ee8('0xc')]('/:id',auth[_0x8ee8('0xa')](),controller[_0x8ee8('0xd')]);router['delete'](_0x8ee8('0x9'),auth['isAuthenticated'](),controller[_0x8ee8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e05a29d..806d872 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 _0x447f=['exports','STRING','sequelize'];(function(_0x43039d,_0x4f36bb){var _0x24927d=function(_0x54f7ea){while(--_0x54f7ea){_0x43039d['push'](_0x43039d['shift']());}};_0x24927d(++_0x4f36bb);}(_0x447f,0x89));var _0xf447=function(_0x19b002,_0x4c9ae2){_0x19b002=_0x19b002-0x0;var _0x3e2f36=_0x447f[_0x19b002];return _0x3e2f36;};'use strict';var Sequelize=require(_0xf447('0x0'));module[_0xf447('0x1')]={'name':{'type':Sequelize[_0xf447('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x218c=['BOOLEAN','exports','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x218c,0x118));var _0xc218=function(_0x17968b,_0xd64399){_0x17968b=_0x17968b-0x0;var _0x4eabd9=_0x218c[_0x17968b];return _0x4eabd9;};'use strict';var Sequelize=require('sequelize');module[_0xc218('0x0')]={'name':{'type':Sequelize[_0xc218('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc218('0x1')]},'write':{'type':Sequelize[_0xc218('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 7923760..82d9fec 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 _0x1bb4=['fields','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params'];(function(_0x599dcb,_0x1e4e79){var _0x5898c7=function(_0x381b02){while(--_0x381b02){_0x599dcb['push'](_0x599dcb['shift']());}};_0x5898c7(++_0x1e4e79);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x56a3fc,_0x2f5c06){_0x56a3fc=_0x56a3fc-0x0;var _0x4069f9=_0x1bb4[_0x56a3fc];return _0x4069f9;};'use strict';var pdf=require(_0x41bb('0x0'));var emlformat=require(_0x41bb('0x1'));var rimraf=require(_0x41bb('0x2'));var zipdir=require(_0x41bb('0x3'));var jsonpatch=require(_0x41bb('0x4'));var rp=require('request-promise');var moment=require(_0x41bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41bb('0x6'));var util=require('util');var path=require(_0x41bb('0x7'));var sox=require('sox');var csv=require(_0x41bb('0x8'));var ejs=require(_0x41bb('0x9'));var fs=require('fs');var _=require(_0x41bb('0xa'));var squel=require('squel');var crypto=require(_0x41bb('0xb'));var jsforce=require(_0x41bb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x41bb('0x8'));var querystring=require(_0x41bb('0xd'));var Papa=require(_0x41bb('0xe'));var Redis=require('ioredis');var authService=require(_0x41bb('0xf'));var qs=require(_0x41bb('0x10'));var as=require(_0x41bb('0x11'));var hardwareService=require(_0x41bb('0x12'));var logger=require(_0x41bb('0x13'))('api');var utils=require(_0x41bb('0x14'));var config=require(_0x41bb('0x15'));var licenseUtil=require(_0x41bb('0x16'));var db=require(_0x41bb('0x17'))['db'];config[_0x41bb('0x18')]=_[_0x41bb('0x19')](config[_0x41bb('0x18')],{'host':_0x41bb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0x41bb('0x1b')](socket);var jayson=require(_0x41bb('0x1c'));var client=jayson[_0x41bb('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514d8f,_0x18bf70,_0xa66c46,_0xfa8f14){return new BPromise(function(_0x2b3dbd,_0x358246){var _0x4a1687=_0xfa8f14||client;return _0x4a1687[_0x41bb('0x1e')](_0x514d8f,_0xa66c46)['then'](function(_0x1d2ead){logger[_0x41bb('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x18bf70,_0x41bb('0x20'));logger[_0x41bb('0x21')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x18bf70,'request\x20sent',JSON[_0x41bb('0x22')](_0x1d2ead));if(_0x1d2ead['error']){if(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x24')]===0x1f4){logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);return _0x358246(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);}logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x1d2ead['error'][_0x41bb('0x26')]);return _0x2b3dbd(_0x1d2ead[_0x41bb('0x23')][_0x41bb('0x26')]);}else{logger[_0x41bb('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x18bf70,'request\x20sent');_0x2b3dbd(_0x1d2ead[_0x41bb('0x27')][_0x41bb('0x26')]);}})[_0x41bb('0x28')](function(_0x58c3f7){logger[_0x41bb('0x23')](_0x41bb('0x25'),_0x18bf70,_0x58c3f7);_0x358246(_0x58c3f7);});});}function respondWithStatusCode(_0x592239,_0x310f09){_0x310f09=_0x310f09||0xcc;return function(_0x5c09bf){if(_0x5c09bf){return _0x592239[_0x41bb('0x29')](_0x310f09);}return _0x592239[_0x41bb('0x2a')](_0x310f09)[_0x41bb('0x2b')]();};}function respondWithResult(_0x1ed303,_0x3d515e){_0x3d515e=_0x3d515e||0xc8;return function(_0x237817){if(_0x237817){return _0x1ed303[_0x41bb('0x2a')](_0x3d515e)[_0x41bb('0x2c')](_0x237817);}};}function respondWithFilteredResult(_0x3f28b0,_0x2ba1cd){return function(_0x430131){if(_0x430131){var _0x16b1f6=_0x430131[_0x41bb('0x2d')],_0x148ea5=_0x2ba1cd[_0x41bb('0x2e')],_0x4645c8=_0x2ba1cd[_0x41bb('0x2e')]+_0x2ba1cd[_0x41bb('0x2f')],_0x501f78;if(_0x4645c8>=_0x16b1f6){_0x4645c8=_0x16b1f6;_0x501f78=0xc8;}else{_0x501f78=0xce;}_0x3f28b0[_0x41bb('0x2a')](_0x501f78);return _0x3f28b0[_0x41bb('0x30')](_0x41bb('0x31'),_0x148ea5+'-'+_0x4645c8+'/'+_0x16b1f6)[_0x41bb('0x2c')](_0x430131);}return null;};}function patchUpdates(_0x3590d6){return function(_0x76c3c7){try{jsonpatch[_0x41bb('0x32')](_0x76c3c7,_0x3590d6,!![]);}catch(_0x7c3a3c){return BPromise[_0x41bb('0x33')](_0x7c3a3c);}return _0x76c3c7[_0x41bb('0x34')]();};}function saveUpdates(_0x142661,_0xfb737f){return function(_0x58eb96){if(_0x58eb96){return _0x58eb96[_0x41bb('0x35')](_0x142661)[_0x41bb('0x36')](function(_0x28faac){return _0x28faac;});}return null;};}function removeEntity(_0x7a9b34,_0x8df1f3){return function(_0xb2041a){if(_0xb2041a){return _0xb2041a[_0x41bb('0x37')]()['then'](function(){_0x7a9b34['status'](0xcc)[_0x41bb('0x2b')]();});}};}function handleEntityNotFound(_0xe7d034,_0x2ca65f){return function(_0x7c4fb2){if(!_0x7c4fb2){_0xe7d034[_0x41bb('0x29')](0x194);}return _0x7c4fb2;};}function handleError(_0x11f3c9,_0x346cbc){_0x346cbc=_0x346cbc||0x1f4;return function(_0x333738){logger['error'](_0x333738['stack']);if(_0x333738['name']){delete _0x333738[_0x41bb('0x38')];}_0x11f3c9[_0x41bb('0x2a')](_0x346cbc)[_0x41bb('0x39')](_0x333738);};}exports[_0x41bb('0x3a')]=function(_0x243ecd,_0x5b130a){var _0x233fa2={},_0x2293c7={},_0x463fd0={'count':0x0,'rows':[]};var _0x1a8a53=_[_0x41bb('0x3b')](db[_0x41bb('0x3c')][_0x41bb('0x3d')],function(_0x3ecb67){return{'name':_0x3ecb67[_0x41bb('0x3e')],'type':_0x3ecb67[_0x41bb('0x3f')]['key']};});_0x2293c7['model']=_['map'](_0x1a8a53,_0x41bb('0x38'));_0x2293c7[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x243ecd[_0x41bb('0x40')]);_0x2293c7['filters']=_[_0x41bb('0x42')](_0x2293c7[_0x41bb('0x43')],_0x2293c7['query']);_0x233fa2['attributes']=_[_0x41bb('0x42')](_0x2293c7[_0x41bb('0x43')],qs['fields'](_0x243ecd[_0x41bb('0x40')]['fields']));_0x233fa2[_0x41bb('0x44')]=_0x233fa2[_0x41bb('0x44')][_0x41bb('0x45')]?_0x233fa2[_0x41bb('0x44')]:_0x2293c7[_0x41bb('0x43')];if(!_0x243ecd[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x233fa2[_0x41bb('0x2f')]=qs[_0x41bb('0x2f')](_0x243ecd['query'][_0x41bb('0x2f')]);_0x233fa2[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x243ecd['query'][_0x41bb('0x2e')]);}_0x233fa2[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x243ecd['query'][_0x41bb('0x49')]);_0x233fa2[_0x41bb('0x4a')]=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x243ecd[_0x41bb('0x40')],_0x2293c7[_0x41bb('0x4b')]),_0x1a8a53);if(_0x243ecd[_0x41bb('0x40')][_0x41bb('0x4d')]){_0x233fa2['where']=_[_0x41bb('0x4e')](_0x233fa2[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x1a8a53,function(_0x520754){if(_0x520754[_0x41bb('0x3f')]!==_0x41bb('0x4f')){var _0x4034c1={};_0x4034c1[_0x520754[_0x41bb('0x38')]]={'$like':'%'+_0x243ecd[_0x41bb('0x40')][_0x41bb('0x4d')]+'%'};return _0x4034c1;}})});}_0x233fa2=_['merge']({},_0x233fa2,_0x243ecd['options']);var _0x4c5b15={'where':_0x233fa2[_0x41bb('0x4a')]};return db[_0x41bb('0x3c')][_0x41bb('0x2d')](_0x4c5b15)['then'](function(_0x595cb5){_0x463fd0['count']=_0x595cb5;if(_0x243ecd[_0x41bb('0x40')][_0x41bb('0x50')]){_0x233fa2[_0x41bb('0x51')]=[{'all':!![]}];}return db[_0x41bb('0x3c')][_0x41bb('0x52')](_0x233fa2);})[_0x41bb('0x36')](function(_0x4a72eb){_0x463fd0[_0x41bb('0x53')]=_0x4a72eb;return _0x463fd0;})[_0x41bb('0x36')](respondWithFilteredResult(_0x5b130a,_0x233fa2))[_0x41bb('0x28')](handleError(_0x5b130a,null));};exports['show']=function(_0x590f8f,_0x5d2e2e){var _0x1efcd1={'raw':!![],'where':{'id':_0x590f8f[_0x41bb('0x54')]['id']}},_0x2147b6={};_0x2147b6[_0x41bb('0x43')]=_[_0x41bb('0x41')](db['ChatGroup'][_0x41bb('0x3d')]);_0x2147b6[_0x41bb('0x40')]=_['keys'](_0x590f8f[_0x41bb('0x40')]);_0x2147b6[_0x41bb('0x4b')]=_[_0x41bb('0x42')](_0x2147b6['model'],_0x2147b6[_0x41bb('0x40')]);_0x1efcd1['attributes']=_[_0x41bb('0x42')](_0x2147b6['model'],qs[_0x41bb('0x55')](_0x590f8f[_0x41bb('0x40')]['fields']));_0x1efcd1[_0x41bb('0x44')]=_0x1efcd1['attributes']['length']?_0x1efcd1[_0x41bb('0x44')]:_0x2147b6[_0x41bb('0x43')];if(_0x590f8f[_0x41bb('0x40')]['includeAll']){_0x1efcd1[_0x41bb('0x51')]=[{'all':!![]}];}_0x1efcd1=_['merge']({},_0x1efcd1,_0x590f8f[_0x41bb('0x56')]);return db[_0x41bb('0x3c')][_0x41bb('0x57')](_0x1efcd1)['then'](handleEntityNotFound(_0x5d2e2e,null))['then'](respondWithResult(_0x5d2e2e,null))['catch'](handleError(_0x5d2e2e,null));};exports['create']=function(_0x27bd50,_0x19cd26){return db[_0x41bb('0x3c')][_0x41bb('0x58')](_0x27bd50['body'],{})[_0x41bb('0x36')](respondWithResult(_0x19cd26,0xc9))[_0x41bb('0x28')](handleError(_0x19cd26,null));};exports[_0x41bb('0x35')]=function(_0x3f407c,_0x336630){if(_0x3f407c[_0x41bb('0x59')]['id']){delete _0x3f407c['body']['id'];}return db[_0x41bb('0x3c')]['find']({'where':{'id':_0x3f407c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x336630,null))[_0x41bb('0x36')](saveUpdates(_0x3f407c[_0x41bb('0x59')],null))[_0x41bb('0x36')](respondWithResult(_0x336630,null))[_0x41bb('0x28')](handleError(_0x336630,null));};exports[_0x41bb('0x37')]=function(_0xc7c4c,_0x1bae35){return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0xc7c4c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x1bae35,null))['then'](removeEntity(_0x1bae35,null))[_0x41bb('0x28')](handleError(_0x1bae35,null));};exports[_0x41bb('0x5a')]=function(_0x5cfa0f,_0xceb0df){return db[_0x41bb('0x3c')][_0x41bb('0x5a')]()['then'](respondWithResult(_0xceb0df,null))['catch'](handleError(_0xceb0df,null));};exports[_0x41bb('0x5b')]=function(_0xaa011c,_0xfc7c88,_0x34aa8a){return db[_0x41bb('0x5c')][_0x41bb('0x2d')]({'where':{'ChatGroupId':_0xaa011c[_0x41bb('0x54')]['id'],'ToId':_0xaa011c[_0x41bb('0x5d')]['id'],'read':![]}})[_0x41bb('0x36')](function(_0x103d28){return{'id':_[_0x41bb('0x5e')](_0xaa011c[_0x41bb('0x54')]['id']),'count':_0x103d28};})[_0x41bb('0x36')](respondWithResult(_0xfc7c88,null))[_0x41bb('0x28')](handleError(_0xfc7c88,null));};exports[_0x41bb('0x5f')]=function(_0x219e6c,_0xb083f0,_0x1aab5a){return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0x219e6c[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0xb083f0,null))['then'](function(_0x5e6b79){if(_0x5e6b79){return _0x5e6b79[_0x41bb('0x5f')](_0x219e6c[_0x41bb('0x59')][_0x41bb('0x60')],_[_0x41bb('0x61')](_0x219e6c[_0x41bb('0x59')],['ids','id'])||{});}})[_0x41bb('0x36')](respondWithResult(_0xb083f0,null))[_0x41bb('0x28')](handleError(_0xb083f0,null));};exports['getMembers']=function(_0x215ef6,_0x58f1ce,_0x1ef3f2){var _0x103651={};var _0x16a281={};var _0x1422ea;var _0x250e59;return db[_0x41bb('0x3c')][_0x41bb('0x62')]({'where':{'id':_0x215ef6[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x58f1ce,null))[_0x41bb('0x36')](function(_0x12d23c){if(_0x12d23c){_0x1422ea=_0x12d23c;_0x16a281[_0x41bb('0x43')]=_[_0x41bb('0x41')](db[_0x41bb('0x63')]['rawAttributes']);_0x16a281[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x215ef6['query']);_0x16a281['filters']=_[_0x41bb('0x42')](_0x16a281[_0x41bb('0x43')],_0x16a281[_0x41bb('0x40')]);_0x103651[_0x41bb('0x44')]=_['intersection'](_0x16a281[_0x41bb('0x43')],qs[_0x41bb('0x55')](_0x215ef6[_0x41bb('0x40')]['fields']));_0x103651[_0x41bb('0x44')]=_0x103651['attributes'][_0x41bb('0x45')]?_0x103651[_0x41bb('0x44')]:_0x16a281['model'];_0x103651[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x215ef6[_0x41bb('0x40')][_0x41bb('0x49')]);_0x103651[_0x41bb('0x4a')]=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x215ef6['query'],_0x16a281[_0x41bb('0x4b')]));if(_0x215ef6[_0x41bb('0x40')]['filter']){_0x103651[_0x41bb('0x4a')]=_['merge'](_0x103651[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x103651['attributes'],function(_0x3a1eb2){var _0x3a830a={};_0x3a830a[_0x3a1eb2]={'$like':'%'+_0x215ef6[_0x41bb('0x40')]['filter']+'%'};return _0x3a830a;})});}_0x103651=_[_0x41bb('0x4e')]({},_0x103651,_0x215ef6[_0x41bb('0x56')]);return _0x1422ea[_0x41bb('0x64')](_0x103651);}})['then'](function(_0xcd9ae6){if(_0xcd9ae6){_0x250e59=_0xcd9ae6[_0x41bb('0x45')];if(!_0x215ef6[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x103651['limit']=qs[_0x41bb('0x2f')](_0x215ef6['query'][_0x41bb('0x2f')]);_0x103651[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x215ef6['query'][_0x41bb('0x2e')]);}return _0x1422ea['getMembers'](_0x103651);}})['then'](function(_0x4d0505){if(_0x4d0505){return _0x4d0505?{'count':_0x250e59,'rows':_0x4d0505}:null;}})['then'](respondWithResult(_0x58f1ce,null))[_0x41bb('0x28')](handleError(_0x58f1ce,null));};exports['removeMembers']=function(_0x41f287,_0x47194d,_0x5deb5d){return db['ChatGroup']['find']({'where':{'id':_0x41f287[_0x41bb('0x54')]['id']}})['then'](handleEntityNotFound(_0x47194d,null))['then'](function(_0x2068a2){if(_0x2068a2){return _0x2068a2['removeMembers'](_0x41f287[_0x41bb('0x40')][_0x41bb('0x60')]);}})['then'](respondWithStatusCode(_0x47194d,null))['catch'](handleError(_0x47194d,null));};exports[_0x41bb('0x65')]=function(_0xd7619,_0x42bd49,_0x289430){if(_0xd7619[_0x41bb('0x59')]['id']){delete _0xd7619[_0x41bb('0x59')]['id'];}return db[_0x41bb('0x3c')][_0x41bb('0x57')]({'where':{'id':_0xd7619[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x42bd49,null))[_0x41bb('0x36')](function(_0x3d8a3d){if(_0x3d8a3d){_0xd7619['body'][_0x41bb('0x66')]=_0x3d8a3d['id'];return db[_0x41bb('0x5c')][_0x41bb('0x58')](_0xd7619[_0x41bb('0x59')]);}})[_0x41bb('0x36')](respondWithResult(_0x42bd49,null))[_0x41bb('0x28')](handleError(_0x42bd49,null));};exports[_0x41bb('0x67')]=function(_0x23e66a,_0x13aec1,_0x6e988f){var _0x2a4df8={};var _0x1a1009={};var _0x4977eb;var _0x2de632;return db['ChatGroup'][_0x41bb('0x62')]({'where':{'id':_0x23e66a[_0x41bb('0x54')]['id']}})[_0x41bb('0x36')](handleEntityNotFound(_0x13aec1,null))[_0x41bb('0x36')](function(_0x4c70d9){if(_0x4c70d9){_0x4977eb=_0x4c70d9;_0x1a1009[_0x41bb('0x43')]=_[_0x41bb('0x41')](db['ChatInternalMessage'][_0x41bb('0x3d')]);_0x1a1009[_0x41bb('0x40')]=_[_0x41bb('0x41')](_0x23e66a[_0x41bb('0x40')]);_0x1a1009[_0x41bb('0x4b')]=_[_0x41bb('0x42')](_0x1a1009['model'],_0x1a1009[_0x41bb('0x40')]);_0x2a4df8[_0x41bb('0x44')]=_['intersection'](_0x1a1009[_0x41bb('0x43')],qs[_0x41bb('0x55')](_0x23e66a[_0x41bb('0x40')]['fields']));_0x2a4df8['attributes']=_0x2a4df8['attributes'][_0x41bb('0x45')]?_0x2a4df8[_0x41bb('0x44')]:_0x1a1009['model'];_0x2a4df8[_0x41bb('0x48')]=qs[_0x41bb('0x49')](_0x23e66a['query'][_0x41bb('0x49')]);_0x2a4df8['where']=qs[_0x41bb('0x4b')](_[_0x41bb('0x4c')](_0x23e66a[_0x41bb('0x40')],_0x1a1009['filters']));if(_0x23e66a[_0x41bb('0x40')][_0x41bb('0x4d')]){_0x2a4df8['where']=_[_0x41bb('0x4e')](_0x2a4df8[_0x41bb('0x4a')],{'$or':_[_0x41bb('0x3b')](_0x2a4df8[_0x41bb('0x44')],function(_0x857e70){var _0x2d6c12={};_0x2d6c12[_0x857e70]={'$like':'%'+_0x23e66a[_0x41bb('0x40')][_0x41bb('0x4d')]+'%'};return _0x2d6c12;})});}if(_0x23e66a[_0x41bb('0x40')][_0x41bb('0x68')]){var _0x26205d=_0x23e66a['query'][_0x41bb('0x68')][_0x41bb('0x69')](',');var _0x31e373={};_0x31e373[_0x26205d[0x0]]={'$gte':moment(_0x26205d[0x1])[_0x41bb('0x6a')](_0x41bb('0x6b'))};_0x2a4df8[_0x41bb('0x4a')]=_[_0x41bb('0x4e')](_0x2a4df8[_0x41bb('0x4a')],_0x31e373);}_0x2a4df8=_[_0x41bb('0x4e')]({},_0x2a4df8,_0x23e66a['options']);return _0x4977eb['getMessages'](_0x2a4df8);}})[_0x41bb('0x36')](function(_0x758bed){if(_0x758bed){_0x2de632=_0x758bed[_0x41bb('0x45')];if(!_0x23e66a[_0x41bb('0x40')][_0x41bb('0x46')](_0x41bb('0x47'))){_0x2a4df8[_0x41bb('0x2f')]=qs[_0x41bb('0x2f')](_0x23e66a[_0x41bb('0x40')][_0x41bb('0x2f')]);_0x2a4df8[_0x41bb('0x2e')]=qs[_0x41bb('0x2e')](_0x23e66a['query']['offset']);}return _0x4977eb[_0x41bb('0x67')](_0x2a4df8);}})[_0x41bb('0x36')](function(_0x4c1b4b){if(_0x4c1b4b){return _0x4c1b4b?{'count':_0x2de632,'rows':_0x4c1b4b}:null;}})[_0x41bb('0x36')](respondWithResult(_0x13aec1,null))[_0x41bb('0x28')](handleError(_0x13aec1,null));}; \ No newline at end of file +var _0x2ace=['request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','json','reject','update','then','destroy','stack','name','index','map','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','ChatGroup','includeAll','findAll','rows','params','rawAttributes','include','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','filter','getMembers','removeMembers','addMessage','ChatGroupId','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','ChatGroup,\x20%s,\x20%s'];(function(_0xdad5b8,_0x4164d3){var _0x55b0bd=function(_0x3ca225){while(--_0x3ca225){_0xdad5b8['push'](_0xdad5b8['shift']());}};_0x55b0bd(++_0x4164d3);}(_0x2ace,0x17e));var _0xe2ac=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0x2ace[_0x3f670b];return _0x1c0978;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2ac('0x0'));var rimraf=require(_0xe2ac('0x1'));var zipdir=require(_0xe2ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ac('0x3'));var moment=require(_0xe2ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe2ac('0x5'));var util=require(_0xe2ac('0x6'));var path=require(_0xe2ac('0x7'));var sox=require(_0xe2ac('0x8'));var csv=require(_0xe2ac('0x9'));var ejs=require(_0xe2ac('0xa'));var fs=require('fs');var _=require(_0xe2ac('0xb'));var squel=require(_0xe2ac('0xc'));var crypto=require(_0xe2ac('0xd'));var jsforce=require(_0xe2ac('0xe'));var deskjs=require(_0xe2ac('0xf'));var toCsv=require(_0xe2ac('0x9'));var querystring=require(_0xe2ac('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe2ac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe2ac('0x12'));var hardwareService=require(_0xe2ac('0x13'));var logger=require('../../config/logger')(_0xe2ac('0x14'));var utils=require(_0xe2ac('0x15'));var config=require(_0xe2ac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2ac('0x17'))['db'];config[_0xe2ac('0x18')]=_[_0xe2ac('0x19')](config[_0xe2ac('0x18')],{'host':_0xe2ac('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2ac('0x18')]));require('./chatGroup.socket')[_0xe2ac('0x1b')](socket);var jayson=require(_0xe2ac('0x1c'));var client=jayson[_0xe2ac('0x1d')][_0xe2ac('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3bec11,_0xbddfba,_0x445bca,_0x2f3caf){return new BPromise(function(_0x170693,_0x4e1851){var _0x557ef6=_0x2f3caf||client;return _0x557ef6[_0xe2ac('0x1f')](_0x3bec11,_0x445bca)['then'](function(_0x415665){logger[_0xe2ac('0x20')](_0xe2ac('0x21'),_0xbddfba,_0xe2ac('0x22'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xbddfba,'request\x20sent',JSON[_0xe2ac('0x23')](_0x415665));if(_0x415665[_0xe2ac('0x24')]){if(_0x415665[_0xe2ac('0x24')][_0xe2ac('0x25')]===0x1f4){logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x415665['error']['message']);return _0x4e1851(_0x415665[_0xe2ac('0x24')]['message']);}logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x415665[_0xe2ac('0x24')][_0xe2ac('0x26')]);return _0x170693(_0x415665[_0xe2ac('0x24')][_0xe2ac('0x26')]);}else{logger[_0xe2ac('0x20')](_0xe2ac('0x21'),_0xbddfba,_0xe2ac('0x22'));_0x170693(_0x415665['result']['message']);}})[_0xe2ac('0x27')](function(_0x4c9981){logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x4c9981);_0x4e1851(_0x4c9981);});});}function respondWithStatusCode(_0x55711b,_0x192649){_0x192649=_0x192649||0xcc;return function(_0x47b950){if(_0x47b950){return _0x55711b[_0xe2ac('0x28')](_0x192649);}return _0x55711b[_0xe2ac('0x29')](_0x192649)[_0xe2ac('0x2a')]();};}function respondWithResult(_0x557cb2,_0x2702cd){_0x2702cd=_0x2702cd||0xc8;return function(_0x2caff4){if(_0x2caff4){return _0x557cb2['status'](_0x2702cd)['json'](_0x2caff4);}};}function respondWithFilteredResult(_0x3201e8,_0x2d816f){return function(_0x2b50aa){if(_0x2b50aa){var _0x23bef4=_0x2b50aa[_0xe2ac('0x2b')],_0x486ee3=_0x2d816f[_0xe2ac('0x2c')],_0x2ccd98=_0x2d816f[_0xe2ac('0x2c')]+_0x2d816f[_0xe2ac('0x2d')],_0x5f32e8;if(_0x2ccd98>=_0x23bef4){_0x2ccd98=_0x23bef4;_0x5f32e8=0xc8;}else{_0x5f32e8=0xce;}_0x3201e8[_0xe2ac('0x29')](_0x5f32e8);return _0x3201e8[_0xe2ac('0x2e')]('Content-Range',_0x486ee3+'-'+_0x2ccd98+'/'+_0x23bef4)[_0xe2ac('0x2f')](_0x2b50aa);}return null;};}function patchUpdates(_0x4d0c1d){return function(_0x493d18){try{jsonpatch['apply'](_0x493d18,_0x4d0c1d,!![]);}catch(_0x2e4984){return BPromise[_0xe2ac('0x30')](_0x2e4984);}return _0x493d18['save']();};}function saveUpdates(_0xb07e8a,_0x3b9938){return function(_0x4e7286){if(_0x4e7286){return _0x4e7286[_0xe2ac('0x31')](_0xb07e8a)[_0xe2ac('0x32')](function(_0x58d8bb){return _0x58d8bb;});}return null;};}function removeEntity(_0x4b9e5e,_0xd4db2a){return function(_0x5d34a2){if(_0x5d34a2){return _0x5d34a2[_0xe2ac('0x33')]()[_0xe2ac('0x32')](function(){_0x4b9e5e[_0xe2ac('0x29')](0xcc)[_0xe2ac('0x2a')]();});}};}function handleEntityNotFound(_0x1f68a6,_0x42b5d7){return function(_0x34bff6){if(!_0x34bff6){_0x1f68a6[_0xe2ac('0x28')](0x194);}return _0x34bff6;};}function handleError(_0x16a023,_0x4ced94){_0x4ced94=_0x4ced94||0x1f4;return function(_0x14cb81){logger[_0xe2ac('0x24')](_0x14cb81[_0xe2ac('0x34')]);if(_0x14cb81[_0xe2ac('0x35')]){delete _0x14cb81[_0xe2ac('0x35')];}_0x16a023[_0xe2ac('0x29')](_0x4ced94)['send'](_0x14cb81);};}exports[_0xe2ac('0x36')]=function(_0x4b2529,_0x37bf0e){var _0x25b5a8={},_0x3cab70={},_0x15f6d8={'count':0x0,'rows':[]};var _0x5a2025=_[_0xe2ac('0x37')](db['ChatGroup']['rawAttributes'],function(_0x570ba9){return{'name':_0x570ba9['fieldName'],'type':_0x570ba9[_0xe2ac('0x38')][_0xe2ac('0x39')]};});_0x3cab70['model']=_[_0xe2ac('0x37')](_0x5a2025,_0xe2ac('0x35'));_0x3cab70[_0xe2ac('0x3a')]=_[_0xe2ac('0x3b')](_0x4b2529[_0xe2ac('0x3a')]);_0x3cab70[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x3cab70['model'],_0x3cab70[_0xe2ac('0x3a')]);_0x25b5a8['attributes']=_['intersection'](_0x3cab70[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x25b5a8[_0xe2ac('0x40')]=_0x25b5a8[_0xe2ac('0x40')][_0xe2ac('0x41')]?_0x25b5a8[_0xe2ac('0x40')]:_0x3cab70['model'];if(!_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x42')](_0xe2ac('0x43'))){_0x25b5a8[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x4b2529['query'][_0xe2ac('0x2d')]);_0x25b5a8[_0xe2ac('0x2c')]=qs['offset'](_0x4b2529['query'][_0xe2ac('0x2c')]);}_0x25b5a8[_0xe2ac('0x44')]=qs[_0xe2ac('0x45')](_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x25b5a8['where']=qs[_0xe2ac('0x3c')](_['pick'](_0x4b2529[_0xe2ac('0x3a')],_0x3cab70[_0xe2ac('0x3c')]),_0x5a2025);if(_0x4b2529[_0xe2ac('0x3a')]['filter']){_0x25b5a8[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x25b5a8[_0xe2ac('0x46')],{'$or':_[_0xe2ac('0x37')](_0x5a2025,function(_0xfef752){if(_0xfef752[_0xe2ac('0x38')]!==_0xe2ac('0x48')){var _0x30eda2={};_0x30eda2[_0xfef752['name']]={'$like':'%'+_0x4b2529[_0xe2ac('0x3a')]['filter']+'%'};return _0x30eda2;}})});}_0x25b5a8=_['merge']({},_0x25b5a8,_0x4b2529[_0xe2ac('0x49')]);var _0x21f488={'where':_0x25b5a8[_0xe2ac('0x46')]};return db[_0xe2ac('0x4a')][_0xe2ac('0x2b')](_0x21f488)[_0xe2ac('0x32')](function(_0x3715ad){_0x15f6d8[_0xe2ac('0x2b')]=_0x3715ad;if(_0x4b2529['query'][_0xe2ac('0x4b')]){_0x25b5a8['include']=[{'all':!![]}];}return db[_0xe2ac('0x4a')][_0xe2ac('0x4c')](_0x25b5a8);})[_0xe2ac('0x32')](function(_0x350e4b){_0x15f6d8[_0xe2ac('0x4d')]=_0x350e4b;return _0x15f6d8;})[_0xe2ac('0x32')](respondWithFilteredResult(_0x37bf0e,_0x25b5a8))['catch'](handleError(_0x37bf0e,null));};exports['show']=function(_0x55916d,_0xd054e0){var _0x1b4c77={'raw':!![],'where':{'id':_0x55916d[_0xe2ac('0x4e')]['id']}},_0x32a422={};_0x32a422[_0xe2ac('0x3e')]=_['keys'](db['ChatGroup'][_0xe2ac('0x4f')]);_0x32a422['query']=_['keys'](_0x55916d[_0xe2ac('0x3a')]);_0x32a422[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x32a422[_0xe2ac('0x3e')],_0x32a422[_0xe2ac('0x3a')]);_0x1b4c77[_0xe2ac('0x40')]=_[_0xe2ac('0x3d')](_0x32a422[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x55916d[_0xe2ac('0x3a')]['fields']));_0x1b4c77[_0xe2ac('0x40')]=_0x1b4c77[_0xe2ac('0x40')]['length']?_0x1b4c77[_0xe2ac('0x40')]:_0x32a422[_0xe2ac('0x3e')];if(_0x55916d['query'][_0xe2ac('0x4b')]){_0x1b4c77[_0xe2ac('0x50')]=[{'all':!![]}];}_0x1b4c77=_['merge']({},_0x1b4c77,_0x55916d[_0xe2ac('0x49')]);return db[_0xe2ac('0x4a')]['find'](_0x1b4c77)[_0xe2ac('0x32')](handleEntityNotFound(_0xd054e0,null))[_0xe2ac('0x32')](respondWithResult(_0xd054e0,null))[_0xe2ac('0x27')](handleError(_0xd054e0,null));};exports[_0xe2ac('0x51')]=function(_0x501df6,_0xfa3865){return db['ChatGroup'][_0xe2ac('0x51')](_0x501df6[_0xe2ac('0x52')],{})[_0xe2ac('0x32')](respondWithResult(_0xfa3865,0xc9))[_0xe2ac('0x27')](handleError(_0xfa3865,null));};exports[_0xe2ac('0x31')]=function(_0x5cca8a,_0x36bf87){if(_0x5cca8a[_0xe2ac('0x52')]['id']){delete _0x5cca8a[_0xe2ac('0x52')]['id'];}return db[_0xe2ac('0x4a')][_0xe2ac('0x53')]({'where':{'id':_0x5cca8a[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36bf87,null))[_0xe2ac('0x32')](saveUpdates(_0x5cca8a[_0xe2ac('0x52')],null))[_0xe2ac('0x32')](respondWithResult(_0x36bf87,null))[_0xe2ac('0x27')](handleError(_0x36bf87,null));};exports[_0xe2ac('0x33')]=function(_0xceaf52,_0x1a7782){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0xceaf52['params']['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x1a7782,null))[_0xe2ac('0x32')](removeEntity(_0x1a7782,null))['catch'](handleError(_0x1a7782,null));};exports[_0xe2ac('0x54')]=function(_0x20447d,_0x36412f){return db[_0xe2ac('0x4a')]['describe']()['then'](respondWithResult(_0x36412f,null))['catch'](handleError(_0x36412f,null));};exports[_0xe2ac('0x55')]=function(_0x142acf,_0x1076ab,_0x15916f){return db[_0xe2ac('0x56')]['count']({'where':{'ChatGroupId':_0x142acf[_0xe2ac('0x4e')]['id'],'ToId':_0x142acf[_0xe2ac('0x57')]['id'],'read':![]}})[_0xe2ac('0x32')](function(_0xdd18d){return{'id':_[_0xe2ac('0x58')](_0x142acf[_0xe2ac('0x4e')]['id']),'count':_0xdd18d};})[_0xe2ac('0x32')](respondWithResult(_0x1076ab,null))[_0xe2ac('0x27')](handleError(_0x1076ab,null));};exports[_0xe2ac('0x59')]=function(_0x5cddd6,_0x5092e7,_0x8dd497){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0x5cddd6['params']['id']}})['then'](handleEntityNotFound(_0x5092e7,null))[_0xe2ac('0x32')](function(_0x3e43b7){if(_0x3e43b7){return _0x3e43b7[_0xe2ac('0x59')](_0x5cddd6[_0xe2ac('0x52')][_0xe2ac('0x5a')],_[_0xe2ac('0x5b')](_0x5cddd6[_0xe2ac('0x52')],['ids','id'])||{});}})[_0xe2ac('0x32')](respondWithResult(_0x5092e7,null))[_0xe2ac('0x27')](handleError(_0x5092e7,null));};exports['getMembers']=function(_0x2e98e1,_0x2301b3,_0x58b3f4){var _0x3b584b={};var _0x3ef371={};var _0x2091a2;var _0x382c2b;return db[_0xe2ac('0x4a')]['findOne']({'where':{'id':_0x2e98e1[_0xe2ac('0x4e')]['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x2301b3,null))[_0xe2ac('0x32')](function(_0x45e3fd){if(_0x45e3fd){_0x2091a2=_0x45e3fd;_0x3ef371['model']=_[_0xe2ac('0x3b')](db[_0xe2ac('0x5c')][_0xe2ac('0x4f')]);_0x3ef371['query']=_[_0xe2ac('0x3b')](_0x2e98e1[_0xe2ac('0x3a')]);_0x3ef371[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x3ef371[_0xe2ac('0x3e')],_0x3ef371[_0xe2ac('0x3a')]);_0x3b584b[_0xe2ac('0x40')]=_['intersection'](_0x3ef371[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x3b584b[_0xe2ac('0x40')]=_0x3b584b[_0xe2ac('0x40')]['length']?_0x3b584b[_0xe2ac('0x40')]:_0x3ef371['model'];_0x3b584b['order']=qs['sort'](_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x3b584b['where']=qs[_0xe2ac('0x3c')](_['pick'](_0x2e98e1[_0xe2ac('0x3a')],_0x3ef371[_0xe2ac('0x3c')]));if(_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x5d')]){_0x3b584b['where']=_[_0xe2ac('0x47')](_0x3b584b[_0xe2ac('0x46')],{'$or':_['map'](_0x3b584b[_0xe2ac('0x40')],function(_0x198710){var _0x187ae7={};_0x187ae7[_0x198710]={'$like':'%'+_0x2e98e1['query'][_0xe2ac('0x5d')]+'%'};return _0x187ae7;})});}_0x3b584b=_['merge']({},_0x3b584b,_0x2e98e1['options']);return _0x2091a2[_0xe2ac('0x5e')](_0x3b584b);}})[_0xe2ac('0x32')](function(_0x107673){if(_0x107673){_0x382c2b=_0x107673['length'];if(!_0x2e98e1['query']['hasOwnProperty'](_0xe2ac('0x43'))){_0x3b584b[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x2e98e1[_0xe2ac('0x3a')]['limit']);_0x3b584b[_0xe2ac('0x2c')]=qs[_0xe2ac('0x2c')](_0x2e98e1[_0xe2ac('0x3a')]['offset']);}return _0x2091a2[_0xe2ac('0x5e')](_0x3b584b);}})[_0xe2ac('0x32')](function(_0x2373e3){if(_0x2373e3){return _0x2373e3?{'count':_0x382c2b,'rows':_0x2373e3}:null;}})[_0xe2ac('0x32')](respondWithResult(_0x2301b3,null))[_0xe2ac('0x27')](handleError(_0x2301b3,null));};exports[_0xe2ac('0x5f')]=function(_0xb4c51f,_0x235fc8,_0x763b5b){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0xb4c51f[_0xe2ac('0x4e')]['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x235fc8,null))[_0xe2ac('0x32')](function(_0x58479f){if(_0x58479f){return _0x58479f[_0xe2ac('0x5f')](_0xb4c51f[_0xe2ac('0x3a')][_0xe2ac('0x5a')]);}})['then'](respondWithStatusCode(_0x235fc8,null))[_0xe2ac('0x27')](handleError(_0x235fc8,null));};exports[_0xe2ac('0x60')]=function(_0x32e98b,_0x5a5fe2,_0x340b17){if(_0x32e98b[_0xe2ac('0x52')]['id']){delete _0x32e98b[_0xe2ac('0x52')]['id'];}return db['ChatGroup'][_0xe2ac('0x53')]({'where':{'id':_0x32e98b[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a5fe2,null))[_0xe2ac('0x32')](function(_0x1992a2){if(_0x1992a2){_0x32e98b[_0xe2ac('0x52')][_0xe2ac('0x61')]=_0x1992a2['id'];return db[_0xe2ac('0x56')][_0xe2ac('0x51')](_0x32e98b[_0xe2ac('0x52')]);}})[_0xe2ac('0x32')](respondWithResult(_0x5a5fe2,null))[_0xe2ac('0x27')](handleError(_0x5a5fe2,null));};exports['getMessages']=function(_0x54171b,_0x5dd520,_0x4bdaa9){var _0x309a72={};var _0x1244de={};var _0x672d7c;var _0x17fe36;return db[_0xe2ac('0x4a')]['findOne']({'where':{'id':_0x54171b[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dd520,null))[_0xe2ac('0x32')](function(_0x3c730e){if(_0x3c730e){_0x672d7c=_0x3c730e;_0x1244de[_0xe2ac('0x3e')]=_[_0xe2ac('0x3b')](db['ChatInternalMessage'][_0xe2ac('0x4f')]);_0x1244de['query']=_['keys'](_0x54171b[_0xe2ac('0x3a')]);_0x1244de[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x1244de[_0xe2ac('0x3e')],_0x1244de[_0xe2ac('0x3a')]);_0x309a72[_0xe2ac('0x40')]=_[_0xe2ac('0x3d')](_0x1244de['model'],qs[_0xe2ac('0x3f')](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x309a72['attributes']=_0x309a72[_0xe2ac('0x40')]['length']?_0x309a72[_0xe2ac('0x40')]:_0x1244de[_0xe2ac('0x3e')];_0x309a72['order']=qs['sort'](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x309a72[_0xe2ac('0x46')]=qs[_0xe2ac('0x3c')](_[_0xe2ac('0x62')](_0x54171b[_0xe2ac('0x3a')],_0x1244de[_0xe2ac('0x3c')]));if(_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x5d')]){_0x309a72[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x309a72[_0xe2ac('0x46')],{'$or':_[_0xe2ac('0x37')](_0x309a72['attributes'],function(_0x57c99e){var _0x3efe6f={};_0x3efe6f[_0x57c99e]={'$like':'%'+_0x54171b[_0xe2ac('0x3a')]['filter']+'%'};return _0x3efe6f;})});}if(_0x54171b['query'][_0xe2ac('0x63')]){var _0x5cba39=_0x54171b['query'][_0xe2ac('0x63')][_0xe2ac('0x64')](',');var _0x56bce6={};_0x56bce6[_0x5cba39[0x0]]={'$gte':moment(_0x5cba39[0x1])[_0xe2ac('0x65')](_0xe2ac('0x66'))};_0x309a72[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x309a72[_0xe2ac('0x46')],_0x56bce6);}_0x309a72=_[_0xe2ac('0x47')]({},_0x309a72,_0x54171b['options']);return _0x672d7c[_0xe2ac('0x67')](_0x309a72);}})[_0xe2ac('0x32')](function(_0x3e139c){if(_0x3e139c){_0x17fe36=_0x3e139c['length'];if(!_0x54171b['query'][_0xe2ac('0x42')]('nolimit')){_0x309a72[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x2d')]);_0x309a72['offset']=qs['offset'](_0x54171b[_0xe2ac('0x3a')]['offset']);}return _0x672d7c[_0xe2ac('0x67')](_0x309a72);}})[_0xe2ac('0x32')](function(_0x1e24f3){if(_0x1e24f3){return _0x1e24f3?{'count':_0x17fe36,'rows':_0x1e24f3}:null;}})[_0xe2ac('0x32')](respondWithResult(_0x5dd520,null))[_0xe2ac('0x27')](handleError(_0x5dd520,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f90a064..12bee57 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x350d11,_0x49e715){var _0x68bb83=function(_0x48c74f){while(--_0x48c74f){_0x350d11['push'](_0x350d11['shift']());}};_0x68bb83(++_0x49e715);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39f9f6,_0x3152c0){_0x39f9f6=_0x39f9f6-0x0;var _0x1f262e=_0x5f2f[_0x39f9f6];return _0x1f262e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x10b6ab,_0x47ed19){var _0x32410e=function(_0x5c7050){while(--_0x5c7050){_0x10b6ab['push'](_0x10b6ab['shift']());}};_0x32410e(++_0x47ed19);}(_0x0b0e,0x187));var _0xe0b0=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x0b0e[_0x184759];return _0xf26d5f;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 5f84cb0..8282b5e 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 _0x96aa=['request-promise','path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird'];(function(_0x2140a8,_0x22e3cd){var _0xbb816b=function(_0x3f8dfb){while(--_0x3f8dfb){_0x2140a8['push'](_0x2140a8['shift']());}};_0xbb816b(++_0x22e3cd);}(_0x96aa,0x67));var _0xa96a=function(_0x172029,_0x41a3cd){_0x172029=_0x172029-0x0;var _0x1bb677=_0x96aa[_0x172029];return _0x1bb677;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1c=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','util','api','bluebird','request-promise'];(function(_0x537ba7,_0x57383f){var _0x273c3c=function(_0x2525af){while(--_0x2525af){_0x537ba7['push'](_0x537ba7['shift']());}};_0x273c3c(++_0x57383f);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x483e77,_0x433e9b){_0x483e77=_0x483e77-0x0;var _0x359df0=_0xbc1c[_0x483e77];return _0x359df0;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'chat_groups','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 6937d00..f519466 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 _0x823b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x3d2580,_0x5bcf59){var _0x1bed34=function(_0x4838e5){while(--_0x4838e5){_0x3d2580['push'](_0x3d2580['shift']());}};_0x1bed34(++_0x5bcf59);}(_0x823b,0xb8));var _0xb823=function(_0x48e3fe,_0x5d2bf1){_0x48e3fe=_0x48e3fe-0x0;var _0x5c0e1e=_0x823b[_0x48e3fe];return _0x5c0e1e;};'use strict';var _=require('lodash');var util=require(_0xb823('0x0'));var moment=require(_0xb823('0x1'));var BPromise=require(_0xb823('0x2'));var rs=require(_0xb823('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb823('0x4'));var logger=require(_0xb823('0x5'))(_0xb823('0x6'));var config=require(_0xb823('0x7'));var jayson=require(_0xb823('0x8'));var client=jayson[_0xb823('0x9')][_0xb823('0xa')]({'port':0x232a});config[_0xb823('0xb')]=_[_0xb823('0xc')](config['redis'],{'host':_0xb823('0xd'),'port':0x18eb});var socket=require(_0xb823('0xe'))(new Redis(config[_0xb823('0xb')]));require(_0xb823('0xf'))['register'](socket);function respondWithRpcPromise(_0x3c6a42,_0x4258b5,_0x126221){return new BPromise(function(_0x5d61cc,_0x532fcb){return client[_0xb823('0x10')](_0x3c6a42,_0x126221)[_0xb823('0x11')](function(_0x3b391e){logger[_0xb823('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4258b5,_0xb823('0x13'));logger[_0xb823('0x14')](_0xb823('0x15'),_0x4258b5,'request\x20sent',JSON['stringify'](_0x3b391e));if(_0x3b391e['error']){if(_0x3b391e[_0xb823('0x16')][_0xb823('0x17')]===0x1f4){logger['error'](_0xb823('0x18'),_0x4258b5,_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);return _0x532fcb(_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);}logger[_0xb823('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4258b5,_0x3b391e[_0xb823('0x16')]['message']);return _0x5d61cc(_0x3b391e[_0xb823('0x16')][_0xb823('0x19')]);}else{logger[_0xb823('0x12')](_0xb823('0x18'),_0x4258b5,_0xb823('0x13'));_0x5d61cc(_0x3b391e['result'][_0xb823('0x19')]);}})[_0xb823('0x1a')](function(_0x3f7494){logger[_0xb823('0x16')](_0xb823('0x18'),_0x4258b5,_0x3f7494);_0x532fcb(_0x3f7494);});});} \ No newline at end of file +var _0xe0e0=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatGroup,\x20%s,\x20%s','util','moment','bluebird','randomstring'];(function(_0xd586c8,_0x40476b){var _0x1b1fc1=function(_0x1151df){while(--_0x1151df){_0xd586c8['push'](_0xd586c8['shift']());}};_0x1b1fc1(++_0x40476b);}(_0xe0e0,0x1af));var _0x0e0e=function(_0x4a8eb2,_0x504d05){_0x4a8eb2=_0x4a8eb2-0x0;var _0x238e36=_0xe0e0[_0x4a8eb2];return _0x238e36;};'use strict';var _=require('lodash');var util=require(_0x0e0e('0x0'));var moment=require(_0x0e0e('0x1'));var BPromise=require(_0x0e0e('0x2'));var rs=require(_0x0e0e('0x3'));var fs=require('fs');var Redis=require(_0x0e0e('0x4'));var db=require(_0x0e0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e0e('0x6'))('rpc');var config=require(_0x0e0e('0x7'));var jayson=require(_0x0e0e('0x8'));var client=jayson[_0x0e0e('0x9')][_0x0e0e('0xa')]({'port':0x232a});config[_0x0e0e('0xb')]=_[_0x0e0e('0xc')](config['redis'],{'host':_0x0e0e('0xd'),'port':0x18eb});var socket=require(_0x0e0e('0xe'))(new Redis(config[_0x0e0e('0xb')]));require(_0x0e0e('0xf'))[_0x0e0e('0x10')](socket);function respondWithRpcPromise(_0x84195e,_0x1a1c17,_0x25c674){return new BPromise(function(_0x36ea2b,_0x24661a){return client[_0x0e0e('0x11')](_0x84195e,_0x25c674)[_0x0e0e('0x12')](function(_0x46988c){logger[_0x0e0e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x0e0e('0x14'));logger[_0x0e0e('0x15')](_0x0e0e('0x16'),_0x1a1c17,_0x0e0e('0x14'),JSON['stringify'](_0x46988c));if(_0x46988c[_0x0e0e('0x17')]){if(_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x18')]===0x1f4){logger[_0x0e0e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x46988c[_0x0e0e('0x17')]['message']);return _0x24661a(_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x19')]);}logger[_0x0e0e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x19')]);return _0x36ea2b(_0x46988c['error'][_0x0e0e('0x19')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x1a1c17,'request\x20sent');_0x36ea2b(_0x46988c[_0x0e0e('0x1a')]['message']);}})[_0x0e0e('0x1b')](function(_0x1732ff){logger[_0x0e0e('0x17')](_0x0e0e('0x1c'),_0x1a1c17,_0x1732ff);_0x24661a(_0x1732ff);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bbb331b..5885667 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 _0x9770=['remove','emit','removeListener','register','./chatGroup.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9770,0x12a));var _0x0977=function(_0x3b3e16,_0x1ffbff){_0x3b3e16=_0x3b3e16-0x0;var _0x473145=_0x9770[_0x3b3e16];return _0x473145;};'use strict';var ChatGroupEvents=require(_0x0977('0x0'));var events=[_0x0977('0x1'),_0x0977('0x2'),'update'];function createListener(_0x334796,_0x18c3a8){return function(_0x25ee21){_0x18c3a8[_0x0977('0x3')](_0x334796,_0x25ee21);};}function removeListener(_0x201b49,_0x5ce251){return function(){ChatGroupEvents[_0x0977('0x4')](_0x201b49,_0x5ce251);};}exports[_0x0977('0x5')]=function(_0x4afa39){for(var _0x370f1a=0x0,_0x2fb9ce=events['length'];_0x370f1a<_0x2fb9ce;_0x370f1a++){var _0x539401=events[_0x370f1a];var _0x3d28ab=createListener('chatGroup:'+_0x539401,_0x4afa39);ChatGroupEvents['on'](_0x539401,_0x3d28ab);}}; \ No newline at end of file +var _0x9944=['chatGroup:','./chatGroup.events','save','remove','update','emit','register','length'];(function(_0x46f059,_0x2dbdc0){var _0x5698df=function(_0x55c210){while(--_0x55c210){_0x46f059['push'](_0x46f059['shift']());}};_0x5698df(++_0x2dbdc0);}(_0x9944,0xc9));var _0x4994=function(_0x5b8228,_0x2fd3f0){_0x5b8228=_0x5b8228-0x0;var _0x346061=_0x9944[_0x5b8228];return _0x346061;};'use strict';var ChatGroupEvents=require(_0x4994('0x0'));var events=[_0x4994('0x1'),_0x4994('0x2'),_0x4994('0x3')];function createListener(_0x1e511b,_0x1202cf){return function(_0x58e477){_0x1202cf[_0x4994('0x4')](_0x1e511b,_0x58e477);};}function removeListener(_0x418ba3,_0x1bbb75){return function(){ChatGroupEvents['removeListener'](_0x418ba3,_0x1bbb75);};}exports[_0x4994('0x5')]=function(_0x2ca947){for(var _0x111836=0x0,_0x4d9364=events[_0x4994('0x6')];_0x111836<_0x4d9364;_0x111836++){var _0x261796=events[_0x111836];var _0x41a69e=createListener(_0x4994('0x7')+_0x261796,_0x2ca947);ChatGroupEvents['on'](_0x261796,_0x41a69e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e410718..d4d6de2 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 _0x896e=['/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','put','update','delete','destroy','exports','multer','express','Router','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xc70b9d,_0x12b259){var _0x193ecf=function(_0x44bf4c){while(--_0x44bf4c){_0xc70b9d['push'](_0xc70b9d['shift']());}};_0x193ecf(++_0x12b259);}(_0x896e,0x120));var _0xe896=function(_0x4b6a7f,_0x5b8d25){_0x4b6a7f=_0x4b6a7f-0x0;var _0x5508af=_0x896e[_0x4b6a7f];return _0x5508af;};'use strict';var multer=require(_0xe896('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe896('0x1'));var router=express[_0xe896('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe896('0x3'));var controller=require(_0xe896('0x4'));router[_0xe896('0x5')]('/',auth[_0xe896('0x6')](),controller[_0xe896('0x7')]);router['get'](_0xe896('0x8'),auth[_0xe896('0x6')](),controller[_0xe896('0x9')]);router[_0xe896('0x5')](_0xe896('0xa'),auth[_0xe896('0x6')](),controller[_0xe896('0xb')]);router['get'](_0xe896('0xc'),auth[_0xe896('0x6')](),controller[_0xe896('0xd')]);router[_0xe896('0x5')](_0xe896('0xe'),auth[_0xe896('0x6')](),controller['getMembers']);router[_0xe896('0x5')]('/:id/messages',auth[_0xe896('0x6')](),controller[_0xe896('0xf')]);router[_0xe896('0x10')]('/',auth[_0xe896('0x6')](),controller[_0xe896('0x11')]);router[_0xe896('0x10')]('/:id/members',auth[_0xe896('0x6')](),controller[_0xe896('0x12')]);router[_0xe896('0x10')](_0xe896('0x13'),auth[_0xe896('0x6')](),controller['addMessage']);router[_0xe896('0x14')](_0xe896('0xa'),auth['isAuthenticated'](),controller[_0xe896('0x15')]);router[_0xe896('0x16')]('/:id',auth[_0xe896('0x6')](),controller[_0xe896('0x17')]);router[_0xe896('0x16')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xe896('0x18')]=router; \ No newline at end of file +var _0x4290=['describe','/:id','isAuthenticated','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','removeMembers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get'];(function(_0xf7dacf,_0x54e074){var _0x5ebe51=function(_0x4011a4){while(--_0x4011a4){_0xf7dacf['push'](_0xf7dacf['shift']());}};_0x5ebe51(++_0x54e074);}(_0x4290,0x1eb));var _0x0429=function(_0x2019df,_0x3c86af){_0x2019df=_0x2019df-0x0;var _0x32870c=_0x4290[_0x2019df];return _0x32870c;};'use strict';var multer=require(_0x0429('0x0'));var util=require(_0x0429('0x1'));var path=require('path');var timeout=require(_0x0429('0x2'));var express=require(_0x0429('0x3'));var router=express[_0x0429('0x4')]();var auth=require(_0x0429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0429('0x6'));var controller=require(_0x0429('0x7'));router[_0x0429('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0429('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0429('0x9')]);router[_0x0429('0x8')](_0x0429('0xa'),auth[_0x0429('0xb')](),controller['show']);router[_0x0429('0x8')](_0x0429('0xc'),auth[_0x0429('0xb')](),controller[_0x0429('0xd')]);router['get'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0xf')]);router[_0x0429('0x8')](_0x0429('0x10'),auth['isAuthenticated'](),controller[_0x0429('0x11')]);router[_0x0429('0x12')]('/',auth[_0x0429('0xb')](),controller['create']);router['post'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0x13')]);router[_0x0429('0x12')](_0x0429('0x10'),auth[_0x0429('0xb')](),controller[_0x0429('0x14')]);router[_0x0429('0x15')](_0x0429('0xa'),auth['isAuthenticated'](),controller[_0x0429('0x16')]);router[_0x0429('0x17')](_0x0429('0xa'),auth[_0x0429('0xb')](),controller['destroy']);router['delete'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7639b63..011d744 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 _0xc94e=['long','DATE','out','BOOLEAN','ENUM','star','TEXT','STRING'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xc94e,0x1f3));var _0xec94=function(_0x1a83ad,_0x59477e){_0x1a83ad=_0x1a83ad-0x0;var _0x3af492=_0xc94e[_0x1a83ad];return _0x3af492;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xec94('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xec94('0x1')]('star','thumb'),'defaultValue':_0xec94('0x2')},'ratingMessage':{'type':Sequelize[_0xec94('0x3')]},'pathTranscript':{'type':Sequelize[_0xec94('0x3')]},'mailTranscript':{'type':Sequelize[_0xec94('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xec94('0x4')]},'secondDisposition':{'type':Sequelize[_0xec94('0x4')]},'thirdDisposition':{'type':Sequelize[_0xec94('0x4')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xec94('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xec94('0x4')]},'deviceVendor':{'type':Sequelize[_0xec94('0x4')]},'deviceType':{'type':Sequelize[_0xec94('0x4')]},'referer':{'type':Sequelize[_0xec94('0x3')]},'customerIp':{'type':Sequelize[_0xec94('0x4')]},'formData':{'type':Sequelize[_0xec94('0x3')](_0xec94('0x5'))},'read1stAt':{'type':Sequelize[_0xec94('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xec94('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xec94('0x4')]},'vidaooSessionId':{'type':Sequelize[_0xec94('0x3')]}}; \ No newline at end of file +var _0xa96a=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa96a,0xa5));var _0xaa96=function(_0x30b8ad,_0x38cf22){_0x30b8ad=_0x30b8ad-0x0;var _0x260c2f=_0xa96a[_0x30b8ad];return _0x260c2f;};'use strict';var Sequelize=require(_0xaa96('0x0'));module['exports']={'closed':{'type':Sequelize[_0xaa96('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xaa96('0x2')]},'ratingType':{'type':Sequelize[_0xaa96('0x3')](_0xaa96('0x4'),_0xaa96('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xaa96('0x6')]},'pathTranscript':{'type':Sequelize[_0xaa96('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa96('0x7')]},'thirdDisposition':{'type':Sequelize[_0xaa96('0x7')]},'note':{'type':Sequelize[_0xaa96('0x7')]},'browserName':{'type':Sequelize[_0xaa96('0x7')]},'browserVersion':{'type':Sequelize[_0xaa96('0x7')]},'osName':{'type':Sequelize[_0xaa96('0x7')]},'osVersion':{'type':Sequelize[_0xaa96('0x7')]},'deviceModel':{'type':Sequelize[_0xaa96('0x7')]},'deviceVendor':{'type':Sequelize[_0xaa96('0x7')]},'deviceType':{'type':Sequelize[_0xaa96('0x7')]},'referer':{'type':Sequelize[_0xaa96('0x6')]},'customerIp':{'type':Sequelize[_0xaa96('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xaa96('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xaa96('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xaa96('0x3')]('in',_0xaa96('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xaa96('0x7')]},'customerPort':{'type':Sequelize[_0xaa96('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xaa96('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ee41808..e839ea0 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 _0xb4c3=['register','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','status','end','json','offset','limit','Content-Range','reject','update','then','sendStatus','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','compact','isEmpty','ChatWebsiteId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','count','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','catch','show','params','keys','includeAll','include','options','create','body','destroy','describe','createVidaooSession','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','agentAlias','System','Visitor','website_alias','%s%d','agent_alias','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','findAll','rows','getMyMessages','alias','addTags','setTags','spread','removeTags','download','unix','server','files','tmp','attachments','CmContact','firstName','lastName','direction','Owner','get','mkdirSync','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','YYYY-MM-DD','Account','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','basename','pipe','createWriteStream','Contact','downloadInteraction.html','toFile','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket'];(function(_0xb0505,_0x3bba57){var _0x11d790=function(_0x3d368a){while(--_0x3d368a){_0xb0505['push'](_0xb0505['shift']());}};_0x11d790(++_0x3bba57);}(_0xb4c3,0x115));var _0x3b4c=function(_0x210cd7,_0x1ad9d6){_0x210cd7=_0x210cd7-0x0;var _0x4d4d64=_0xb4c3[_0x210cd7];return _0x4d4d64;};'use strict';var pdf=require(_0x3b4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3b4c('0x1'));var zipdir=require(_0x3b4c('0x2'));var jsonpatch=require(_0x3b4c('0x3'));var rp=require(_0x3b4c('0x4'));var moment=require(_0x3b4c('0x5'));var BPromise=require(_0x3b4c('0x6'));var Mustache=require(_0x3b4c('0x7'));var util=require('util');var path=require(_0x3b4c('0x8'));var sox=require('sox');var csv=require(_0x3b4c('0x9'));var ejs=require(_0x3b4c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3b4c('0xb'));var crypto=require(_0x3b4c('0xc'));var jsforce=require(_0x3b4c('0xd'));var deskjs=require(_0x3b4c('0xe'));var toCsv=require(_0x3b4c('0x9'));var querystring=require(_0x3b4c('0xf'));var Papa=require(_0x3b4c('0x10'));var Redis=require(_0x3b4c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b4c('0x12'));var hardwareService=require(_0x3b4c('0x13'));var logger=require(_0x3b4c('0x14'))(_0x3b4c('0x15'));var utils=require(_0x3b4c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b4c('0x17'));var db=require(_0x3b4c('0x18'))['db'];config[_0x3b4c('0x19')]=_[_0x3b4c('0x1a')](config[_0x3b4c('0x19')],{'host':_0x3b4c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b4c('0x1c'))[_0x3b4c('0x1d')](socket);var jayson=require(_0x3b4c('0x1e'));var client=jayson[_0x3b4c('0x1f')][_0x3b4c('0x20')]({'port':0x232b});var client9004=jayson[_0x3b4c('0x1f')][_0x3b4c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x68fed1,_0x159ac8,_0x1c0810,_0x7bad30){return new BPromise(function(_0x5c5946,_0x1e3f8f){var _0x525630=_0x7bad30||client;return _0x525630[_0x3b4c('0x21')](_0x68fed1,_0x1c0810)['then'](function(_0x1cc3e9){logger[_0x3b4c('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x159ac8,_0x3b4c('0x23'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x159ac8,'request\x20sent',JSON[_0x3b4c('0x24')](_0x1cc3e9));if(_0x1cc3e9[_0x3b4c('0x25')]){if(_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x26')]===0x1f4){logger['error'](_0x3b4c('0x27'),_0x159ac8,_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);return _0x1e3f8f(_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);}logger['error'](_0x3b4c('0x27'),_0x159ac8,_0x1cc3e9[_0x3b4c('0x25')][_0x3b4c('0x28')]);return _0x5c5946(_0x1cc3e9[_0x3b4c('0x25')]['message']);}else{logger['info'](_0x3b4c('0x27'),_0x159ac8,_0x3b4c('0x23'));_0x5c5946(_0x1cc3e9['result'][_0x3b4c('0x28')]);}})['catch'](function(_0x182319){logger[_0x3b4c('0x25')](_0x3b4c('0x27'),_0x159ac8,_0x182319);_0x1e3f8f(_0x182319);});});}function respondWithStatusCode(_0x3f8194,_0x15185c){_0x15185c=_0x15185c||0xcc;return function(_0x268cb9){if(_0x268cb9){return _0x3f8194['sendStatus'](_0x15185c);}return _0x3f8194[_0x3b4c('0x29')](_0x15185c)[_0x3b4c('0x2a')]();};}function respondWithResult(_0x3d0c55,_0x1fd850){_0x1fd850=_0x1fd850||0xc8;return function(_0x2f3467){if(_0x2f3467){return _0x3d0c55['status'](_0x1fd850)[_0x3b4c('0x2b')](_0x2f3467);}};}function respondWithFilteredResult(_0x324611,_0x334fcc){return function(_0x23a48e){if(_0x23a48e){var _0x316df1=_0x23a48e['count'],_0x2f3d88=_0x334fcc[_0x3b4c('0x2c')],_0xa1ea95=_0x334fcc['offset']+_0x334fcc[_0x3b4c('0x2d')],_0x55bc9a;if(_0xa1ea95>=_0x316df1){_0xa1ea95=_0x316df1;_0x55bc9a=0xc8;}else{_0x55bc9a=0xce;}_0x324611[_0x3b4c('0x29')](_0x55bc9a);return _0x324611['set'](_0x3b4c('0x2e'),_0x2f3d88+'-'+_0xa1ea95+'/'+_0x316df1)[_0x3b4c('0x2b')](_0x23a48e);}return null;};}function patchUpdates(_0x3c18b0){return function(_0x5ea060){try{jsonpatch['apply'](_0x5ea060,_0x3c18b0,!![]);}catch(_0x55fd34){return BPromise[_0x3b4c('0x2f')](_0x55fd34);}return _0x5ea060['save']();};}function saveUpdates(_0x23d0fe,_0x396a60){return function(_0x2fabee){if(_0x2fabee){return _0x2fabee[_0x3b4c('0x30')](_0x23d0fe)[_0x3b4c('0x31')](function(_0x550152){return _0x550152;});}return null;};}function removeEntity(_0x5a54a2,_0x45d47a){return function(_0x57d7c9){if(_0x57d7c9){return _0x57d7c9['destroy']()[_0x3b4c('0x31')](function(){_0x5a54a2['status'](0xcc)[_0x3b4c('0x2a')]();});}};}function handleEntityNotFound(_0x4dc344,_0x5c904){return function(_0x118f6b){if(!_0x118f6b){_0x4dc344[_0x3b4c('0x32')](0x194);}return _0x118f6b;};}function handleError(_0x5c9fa0,_0x3533c2){_0x3533c2=_0x3533c2||0x1f4;return function(_0x138f73){logger[_0x3b4c('0x25')](_0x138f73[_0x3b4c('0x33')]);if(_0x138f73['name']){delete _0x138f73[_0x3b4c('0x34')];}_0x5c9fa0['status'](_0x3533c2)['send'](_0x138f73);};}function getInteractionUsers(_0x56cb42,_0x35ccd8){return new BPromise(function(_0x53b117,_0x1bf769){try{if(_0x35ccd8[_0x56cb42['id']]){_0x56cb42[_0x3b4c('0x35')]=_[_0x3b4c('0x36')](_0x35ccd8[_0x56cb42['id']],function(_0x1bd78f){return{'id':_0x1bd78f['id'],'fullname':_0x1bd78f[_0x3b4c('0x37')]};});}}catch(_0x431e2f){_0x1bf769(_0x431e2f);}_0x53b117(_0x56cb42);});}function getInteractionTags(_0x3d3a3e,_0x446af4){return new BPromise(function(_0x428bc6,_0x5f4b80){try{if(_0x3d3a3e[_0x3b4c('0x38')]){_0x3d3a3e[_0x3b4c('0x39')]=[];_0x3d3a3e['TagIds']['split'](',')[_0x3b4c('0x3a')](function(_0x6b65ad){_0x3d3a3e['Tags'][_0x3b4c('0x3b')](_0x446af4[_0x6b65ad]);});}delete _0x3d3a3e[_0x3b4c('0x38')];}catch(_0xe540f7){_0x5f4b80(_0xe540f7);}_0x428bc6(_0x3d3a3e);});}function updateChatInteraction(_0x15796e,_0x1da032,_0x353d88){return new BPromise(function(_0x149d85,_0xfe3c47){return getInteractionUsers(_0x15796e,_0x353d88)[_0x3b4c('0x31')](function(_0x22d8e5){return getInteractionTags(_0x22d8e5,_0x1da032);})[_0x3b4c('0x31')](function(_0x42699b){_0x149d85(_0x42699b);})['catch'](function(_0x21da82){_0xfe3c47(_0x21da82);});});}exports[_0x3b4c('0x3c')]=function(_0x2d287c,_0x31f736){var _0x5f419c={},_0x1612ea={},_0x347879={'count':0x0,'rows':[]};var _0xbee826=_['map'](db[_0x3b4c('0x3d')][_0x3b4c('0x3e')],function(_0x158f0d){return{'name':_0x158f0d[_0x3b4c('0x3f')],'type':_0x158f0d[_0x3b4c('0x40')]['key']};});_0x1612ea[_0x3b4c('0x41')]=_[_0x3b4c('0x36')](_0xbee826,'name');_0x1612ea['query']=_['keys'](_0x2d287c[_0x3b4c('0x42')]);_0x1612ea[_0x3b4c('0x43')]=_[_0x3b4c('0x44')](_0x1612ea['model'],_0x1612ea['query']);_0x5f419c[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x1612ea['model'],qs[_0x3b4c('0x46')](_0x2d287c['query'][_0x3b4c('0x46')]));_0x5f419c[_0x3b4c('0x45')]=_0x5f419c[_0x3b4c('0x45')][_0x3b4c('0x47')]?_0x5f419c[_0x3b4c('0x45')]:_0x1612ea[_0x3b4c('0x41')];if(!_0x2d287c['query'][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x5f419c['limit']=qs[_0x3b4c('0x2d')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x2d')]);_0x5f419c[_0x3b4c('0x2c')]=qs[_0x3b4c('0x2c')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x2c')]);}_0x5f419c[_0x3b4c('0x4a')]=qs[_0x3b4c('0x4b')](_0x2d287c[_0x3b4c('0x42')]['sort']);_0x5f419c[_0x3b4c('0x4c')]=qs[_0x3b4c('0x43')](_[_0x3b4c('0x4d')](_0x2d287c['query'],_0x1612ea[_0x3b4c('0x43')]),_0xbee826);var _0x54a80b=[];var _0x353102=squel[_0x3b4c('0x4e')]()[_0x3b4c('0x4f')]('id')[_0x3b4c('0x4f')]('name')['field'](_0x3b4c('0x50'))[_0x3b4c('0x51')](_0x3b4c('0x52'));var _0xbc40af=squel[_0x3b4c('0x4e')]()['field'](_0x3b4c('0x53'))[_0x3b4c('0x4f')]('u.fullname')[_0x3b4c('0x4f')](_0x3b4c('0x54'))[_0x3b4c('0x51')](_0x3b4c('0x55'),'ui')['left_join'](_0x3b4c('0x56'),'u',_0x3b4c('0x57'));var _0x3c2f74=squel[_0x3b4c('0x4e')]()[_0x3b4c('0x51')]('chat_interactions','i')[_0x3b4c('0x58')](_0x3b4c('0x59'),'c',_0x3b4c('0x5a'))['left_join'](_0x3b4c('0x56'),'o',_0x3b4c('0x5b'))[_0x3b4c('0x58')]('chat_websites','a',_0x3b4c('0x5c'))[_0x3b4c('0x58')](_0x3b4c('0x5d'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x3b4c('0x58')](_0x3b4c('0x5e'),'it',_0x3b4c('0x5f'))[_0x3b4c('0x58')](_0x3b4c('0x52'),'t',_0x3b4c('0x60'));var _0x5d88c5=squel[_0x3b4c('0x61')]();var _0x241d8a=[];var _0x3b879d=squel[_0x3b4c('0x61')]();var _0x2d56ae;if(_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x62')]){_0x2d56ae=as['parseSearch'](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x62')]);var _0xedf7c7=_0x2d56ae[_0x3b4c('0x63')];for(var _0x38a353=0x0;_0x38a353<_0x2d56ae[_0x3b4c('0x64')][_0x3b4c('0x47')];_0x38a353++){var _0x5075bd=_0x2d56ae[_0x3b4c('0x64')][_0x38a353];var _0x5de131='i';var _0x1539ed=_[_0x3b4c('0x65')](_0xbee826,[_0x3b4c('0x34'),_0x5075bd[_0x3b4c('0x4f')]]);if(!_0x1539ed){switch(_0x5075bd['field']){case _0x3b4c('0x66'):if(_0x5075bd['value']==0x1){_0x3c2f74[_0x3b4c('0x67')]('`'+_0x5075bd[_0x3b4c('0x4f')]+'`\x20=\x200');}else{_0x3c2f74[_0x3b4c('0x67')]('`'+_0x5075bd['field']+_0x3b4c('0x68'));}break;case'Contact':if(_0x5075bd[_0x3b4c('0x69')]===_0x3b4c('0x6a')){if(_0x5075bd[_0x3b4c('0x6b')][_0x3b4c('0x6c')]('\x20')[_0x3b4c('0x47')]>0x1){_0x5d88c5[_0xedf7c7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5075bd[_0x3b4c('0x6b')]),null);}else{var _0x382850='%'+_0x5075bd[_0x3b4c('0x6b')]+'%';_0x5d88c5[_0xedf7c7](_0x3b4c('0x6d'),_0x382850,_0x382850,_0x382850);}}else{_0x1539ed=_[_0x3b4c('0x65')](_0xbee826,[_0x3b4c('0x34'),_0x3b4c('0x6e')]);_0x5075bd[_0x3b4c('0x4f')]=_0x3b4c('0x6e');_0x5bd28a=as['buildExpression'](_0x5de131,_0x1539ed[_0x3b4c('0x40')],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')]['start'],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}break;case _0x3b4c('0x70'):var _0x24861a=_0x5075bd[_0x3b4c('0x6b')][_0x3b4c('0x6c')](',')[_0x3b4c('0x36')](function(_0x17824e){return Number(_0x17824e);});_0x24861a[_0x3b4c('0x3a')](function(_0x3c5ee7){_0x3b879d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c5ee7+',%');});_0x241d8a=_[_0x3b4c('0x71')](_0x241d8a,_0x24861a);break;case _0x3b4c('0x72'):if(_0x5075bd['operator']===_0x3b4c('0x6a')){_0x5d88c5[_0xedf7c7](_0x3b4c('0x73'),'%'+_0x5075bd[_0x3b4c('0x6b')]+'%',null);}else{_0x1539ed=_['find'](_0xbee826,[_0x3b4c('0x34'),_0x3b4c('0x74')]);_0x5075bd['field']=_0x3b4c('0x74');_0x5bd28a=as['buildExpression'](_0x5de131,_0x1539ed[_0x3b4c('0x40')],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a['value']['start'],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}break;case'body':_0x5bd28a=as['buildExpression']('me',null,_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x75')],_0x5bd28a[_0x3b4c('0x6b')]['end']);break;}}else{var _0x5bd28a=as[_0x3b4c('0x76')](_0x5de131,_0x1539ed['type'],_0x5075bd);_0x5d88c5[_0xedf7c7](_0x5bd28a[_0x3b4c('0x6f')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x75')],_0x5bd28a[_0x3b4c('0x6b')][_0x3b4c('0x2a')]);}}}else{var _0x52d6ad=_(_0x2d287c[_0x3b4c('0x42')])['keys']()[_0x3b4c('0x36')](function(_0x449828){return _['some'](_0xbee826,[_0x3b4c('0x34'),_0x449828])?_0x449828:undefined;})[_0x3b4c('0x77')]()['value']();if(!_[_0x3b4c('0x78')](_0x52d6ad)){_0x52d6ad[_0x3b4c('0x3a')](function(_0xdb925c){if(_0xdb925c===_0x3b4c('0x79')){_0x3c2f74[_0x3b4c('0x4c')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x2d287c[_0x3b4c('0x42')][_0xdb925c]));}else if(_0xdb925c===_0x3b4c('0x7a')){var _0x215620=JSON[_0x3b4c('0x7b')](_0x2d287c['query'][_0xdb925c])[_0x3b4c('0x7c')];var _0x187178=JSON['parse'](_0x2d287c[_0x3b4c('0x42')][_0xdb925c])[_0x3b4c('0x7d')];_0x3c2f74[_0x3b4c('0x4c')](_0x3b4c('0x7e'),_0x215620,_0x187178);}else{if(_0x2d287c[_0x3b4c('0x42')][_0xdb925c]===_0x3b4c('0x7f')){_0x3c2f74[_0x3b4c('0x4c')]('i.'+_0xdb925c+_0x3b4c('0x80'));}else{_0x3c2f74[_0x3b4c('0x4c')]('i.'+_0xdb925c+_0x3b4c('0x81'),_0x2d287c[_0x3b4c('0x42')][_0xdb925c]);}}});}if(_0x2d287c[_0x3b4c('0x42')]['read']){if(_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x82')]==0x1){_0x3c2f74[_0x3b4c('0x67')]('`unreadMessages`\x20=\x200');}else{_0x3c2f74['having'](_0x3b4c('0x83'));}}if(_0x2d287c[_0x3b4c('0x42')]['tag']){_0x241d8a=_[_0x3b4c('0x84')](_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x85')])?_0x2d287c['query'][_0x3b4c('0x85')]:new Array(_0x2d287c['query'][_0x3b4c('0x85')]);_0x241d8a['forEach'](function(_0x476351){_0x3b879d['or'](_0x3b4c('0x86'),'%,'+_0x476351+',%');});}if(_0x2d287c['query'][_0x3b4c('0x87')]){var _0x3a5194=_0x2d287c['query'][_0x3b4c('0x87')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3a5194)){_0x5d88c5['or'](_0x3b4c('0x88'),_0x3a5194+'%');}else{_0x5d88c5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b4c('0x89')](_0x3a5194))['or'](_0x3b4c('0x8a'),_0x3a5194+'%');}}}_0x3c2f74[_0x3b4c('0x4c')](_0x5d88c5);_0x3c2f74[_0x3b4c('0x8b')](_0x3b4c('0x8c'));var _0xe1d2ee={'type':db[_0x3b4c('0x8d')][_0x3b4c('0x8e')][_0x3b4c('0x8f')],'raw':!![]};var _0x54443c=_0x3c2f74[_0x3b4c('0x90')]();_0x54443c[_0x3b4c('0x4f')](_0x3b4c('0x8c'));_0x54443c['field'](_0x3b4c('0x91'),'unreadMessages');if(_0x5f419c[_0x3b4c('0x4a')]){_0x5f419c[_0x3b4c('0x4a')][_0x3b4c('0x3a')](function(_0x6604b){var _0x471bc2=_0x6604b[0x0]===_0x3b4c('0x92')?_0x6604b[0x0]:'i.'+_0x6604b[0x0];_0x3c2f74['order'](_0x471bc2,_0x6604b[0x1]===_0x3b4c('0x93')?![]:!![]);});}if(!_[_0x3b4c('0x78')](_0x241d8a)){_0x3c2f74['having'](_0x3b879d);_0x54443c[_0x3b4c('0x4c')]('t.id\x20IN\x20?',_0x241d8a);}BPromise[_0x3b4c('0x94')]()[_0x3b4c('0x31')](function(){if(!_0x2d56ae){if(_0x2d287c[_0x3b4c('0x42')]['ChatWebsiteId']||_0x2d287c[_0x3b4c('0x42')][_0x3b4c('0x95')])return;_0x54443c['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3c2f74['where'](_0x3b4c('0x96'));return;}if(_0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x98')]!==_0x3b4c('0x99'))return;return _0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x9a')]({'attributes':['id'],'raw':!![]})[_0x3b4c('0x31')](function(_0x57419b){if(_[_0x3b4c('0x78')](_0x57419b)){_0x54443c[_0x3b4c('0x4c')](_0x3b4c('0x9b'));_0x3c2f74[_0x3b4c('0x4c')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x54443c['where'](_0x3b4c('0x9c'),_[_0x3b4c('0x36')](_0x57419b,'id'));_0x3c2f74[_0x3b4c('0x4c')](_0x3b4c('0x9c'),_['map'](_0x57419b,'id'));}});})[_0x3b4c('0x31')](function(){if(_0x2d287c[_0x3b4c('0x97')][_0x3b4c('0x98')]===_0x3b4c('0x99')&&!_0x2d56ae&&!_0x2d287c[_0x3b4c('0x42')]['ChatWebsiteId'])return[];return db[_0x3b4c('0x9d')]['query'](_0x54443c[_0x3b4c('0x9e')](),_0xe1d2ee);})['then'](function(_0x17caa1){_0x347879[_0x3b4c('0x9f')]=_0x17caa1[_0x3b4c('0x47')];if(_0x347879[_0x3b4c('0x9f')]===0x0)return[];return db[_0x3b4c('0x9d')][_0x3b4c('0x42')](_0x353102[_0x3b4c('0x9e')](),_0xe1d2ee)[_0x3b4c('0x31')](function(_0x34ca37){_0x54a80b=_['keyBy'](_0x34ca37,'id');_0xe1d2ee=_[_0x3b4c('0xa0')](_0xe1d2ee,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d287c['query'][_0x3b4c('0x46')]){_0x5f419c[_0x3b4c('0x45')]['forEach'](function(_0x3ec2b6){_0x3c2f74[_0x3b4c('0x4f')]('i.'+_0x3ec2b6);});}else{_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0x91'),_0x3b4c('0x66'));_0x3c2f74['field'](_0x3b4c('0xa1'),_0x3b4c('0xa2'));_0x3c2f74[_0x3b4c('0x4f')]('a.mandatoryDisposition',_0x3b4c('0xa3'));_0x3c2f74['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',_0x3b4c('0x92'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa4'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa5'),_0x3b4c('0xa6'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa7'),'Contact.lastName');_0x3c2f74['field'](_0x3b4c('0xa8'),'Contact.email');_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xa9'),_0x3b4c('0xaa'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xab'),_0x3b4c('0xac'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xad'),_0x3b4c('0xae'));_0x3c2f74[_0x3b4c('0x4f')](_0x3b4c('0xaf'),_0x3b4c('0xb0'));_0x3c2f74['field'](_0x3b4c('0xb1'),'Owner.internal');_0x3c2f74['field'](_0x3b4c('0xb2'),_0x3b4c('0x38'));}if(_0x5f419c[_0x3b4c('0x2d')])_0x3c2f74[_0x3b4c('0x2d')](_0x5f419c[_0x3b4c('0x2d')]);if(_0x5f419c['offset'])_0x3c2f74['offset'](_0x5f419c[_0x3b4c('0x2c')]);return db['sequelize'][_0x3b4c('0x42')](_0x3c2f74['toString'](),_0xe1d2ee);})[_0x3b4c('0x31')](function(_0x22186f){_0xbc40af[_0x3b4c('0x4c')]('ui.ChatInteractionId\x20IN\x20?',_[_0x3b4c('0x36')](_0x22186f,'id'));return db[_0x3b4c('0x9d')]['query'](_0xbc40af[_0x3b4c('0x9e')](),_0xe1d2ee)[_0x3b4c('0x31')](function(_0x4f1890){var _0x101f52=_[_0x3b4c('0xb3')](_0x4f1890,'ChatInteractionId');var _0x6a0151=[];_0x22186f['forEach'](function(_0x2f3a63){_0x6a0151[_0x3b4c('0x3b')](updateChatInteraction(_0x2f3a63,_0x54a80b,_0x101f52));});return BPromise[_0x3b4c('0xb4')](_0x6a0151);});});})[_0x3b4c('0x31')](function(_0x116429){_0x347879['rows']=_0x116429;return _0x347879;})[_0x3b4c('0x31')](respondWithFilteredResult(_0x31f736,_0x5f419c))[_0x3b4c('0xb5')](handleError(_0x31f736,null));};exports[_0x3b4c('0xb6')]=function(_0x436db0,_0x5db897){var _0x1f2ed3={'raw':![],'where':{'id':_0x436db0[_0x3b4c('0xb7')]['id']}},_0x305a94={};_0x305a94['model']=_[_0x3b4c('0xb8')](db['ChatInteraction'][_0x3b4c('0x3e')]);_0x305a94[_0x3b4c('0x42')]=_['keys'](_0x436db0[_0x3b4c('0x42')]);_0x305a94[_0x3b4c('0x43')]=_[_0x3b4c('0x44')](_0x305a94[_0x3b4c('0x41')],_0x305a94[_0x3b4c('0x42')]);_0x1f2ed3[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x305a94[_0x3b4c('0x41')],qs[_0x3b4c('0x46')](_0x436db0[_0x3b4c('0x42')][_0x3b4c('0x46')]));_0x1f2ed3[_0x3b4c('0x45')]=_0x1f2ed3[_0x3b4c('0x45')]['length']?_0x1f2ed3[_0x3b4c('0x45')]:_0x305a94[_0x3b4c('0x41')];if(_0x436db0['query'][_0x3b4c('0xb9')]){_0x1f2ed3[_0x3b4c('0xba')]=[{'all':!![]}];}_0x1f2ed3=_['merge']({},_0x1f2ed3,_0x436db0[_0x3b4c('0xbb')]);return db[_0x3b4c('0x3d')][_0x3b4c('0x65')](_0x1f2ed3)['then'](handleEntityNotFound(_0x5db897,null))[_0x3b4c('0x31')](respondWithResult(_0x5db897,null))[_0x3b4c('0xb5')](handleError(_0x5db897,null));};exports[_0x3b4c('0xbc')]=function(_0x4f9f11,_0x481b3f){return db[_0x3b4c('0x3d')][_0x3b4c('0xbc')](_0x4f9f11[_0x3b4c('0xbd')],{})[_0x3b4c('0x31')](respondWithResult(_0x481b3f,0xc9))[_0x3b4c('0xb5')](handleError(_0x481b3f,null));};exports[_0x3b4c('0x30')]=function(_0x44f098,_0x178b92){if(_0x44f098[_0x3b4c('0xbd')]['id']){delete _0x44f098[_0x3b4c('0xbd')]['id'];}return db['ChatInteraction'][_0x3b4c('0x65')]({'where':{'id':_0x44f098[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x178b92,null))[_0x3b4c('0x31')](saveUpdates(_0x44f098[_0x3b4c('0xbd')],null))['then'](respondWithResult(_0x178b92,null))[_0x3b4c('0xb5')](handleError(_0x178b92,null));};exports[_0x3b4c('0xbe')]=function(_0x48d3ef,_0x429feb){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x48d3ef[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x429feb,null))['then'](removeEntity(_0x429feb,null))[_0x3b4c('0xb5')](handleError(_0x429feb,null));};exports[_0x3b4c('0xbf')]=function(_0x2d9c60,_0x2b2556){return db[_0x3b4c('0x3d')][_0x3b4c('0xbf')]()[_0x3b4c('0x31')](respondWithResult(_0x2b2556,null))['catch'](handleError(_0x2b2556,null));};exports[_0x3b4c('0xc0')]=function(_0xf7f352,_0x207357){var _0x4f4767=_0xf7f352[_0x3b4c('0xb7')]['id'];var _0x1a7d0d;var _0x448800;var _0x1ae814;return db['ChatInteraction']['findOne']({'where':{'id':_0x4f4767}})[_0x3b4c('0x31')](function(_0x1d46b4){_0x1a7d0d=_0x1d46b4;return db['ChatWebsite']['findOne']({'where':{'id':_0x1d46b4[_0x3b4c('0x79')]},'attributes':['id',_0x3b4c('0xc1'),_0x3b4c('0xc2')],'raw':!![]});})[_0x3b4c('0x31')](function(_0xae84cf){if(_0xae84cf&&_0xae84cf[_0x3b4c('0xc1')]&&_0xae84cf[_0x3b4c('0xc2')]){_0x448800=_0xae84cf;var _0x425e3f={'rejectUnauthorized':![],'method':_0x3b4c('0xc3'),'uri':_0x3b4c('0xc4'),'headers':{'X-APIKEY':_0xae84cf[_0x3b4c('0xc1')]},'body':{'name':_0x3b4c('0xc5')+_0x4f4767},'redirect':_0x3b4c('0xc6'),'json':!![]};return rp(_0x425e3f);}else{throw new db['Sequelize'][(_0x3b4c('0xc7'))](_0x3b4c('0xc8'));}})[_0x3b4c('0x31')](function(_0x301ce0){_0x1ae814=_0x301ce0;if(_0x1ae814['id']){var _0x27f69d={'body':_0x1ae814[_0x3b4c('0xc9')],'ChatWebsiteId':_0x448800['id'],'ChatInteractionId':_0x1a7d0d['id'],'direction':_0x3b4c('0xca'),'UserId':_0xf7f352[_0x3b4c('0x97')]['id']};return db[_0x3b4c('0xcb')][_0x3b4c('0xbc')](_0x27f69d,{});}else{throw new db[(_0x3b4c('0x8d'))][(_0x3b4c('0xc7'))](_0x3b4c('0xcc'));}})[_0x3b4c('0x31')](function(){return _0x1a7d0d[_0x3b4c('0xcd')]({'vidaooSessionId':_0x1ae814['id']});})['then'](respondWithResult(_0x207357,null))[_0x3b4c('0xb5')](handleError(_0x207357,null));};exports[_0x3b4c('0xce')]=function(_0x17857a,_0x4040f6){if(_0x17857a[_0x3b4c('0xbd')]['id']){delete _0x17857a[_0x3b4c('0xbd')]['id'];}return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x17857a[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x4040f6,null))[_0x3b4c('0x31')](saveUpdates(_0x17857a[_0x3b4c('0xbd')],null))['then'](respondWithResult(_0x4040f6,null))[_0x3b4c('0xb5')](handleError(_0x4040f6,null));};exports['abandon']=function(_0x3a42ae,_0x281749,_0x13b231){if(_0x3a42ae[_0x3b4c('0xbd')]['id']){delete _0x3a42ae['body']['id'];}return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x3a42ae[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](function(_0x209a12){if(!_0x209a12){logger[_0x3b4c('0x25')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x281749[_0x3b4c('0x32')](0x194);}else{if(_0x209a12[_0x3b4c('0x74')]){throw new db[(_0x3b4c('0x8d'))][(_0x3b4c('0xc7'))](_0x3b4c('0xcf'));}}return _0x209a12;})[_0x3b4c('0x31')](function(_0x2c8316){if(_0x2c8316){return _0x2c8316[_0x3b4c('0x30')]({'closed':_0x3a42ae[_0x3b4c('0xbd')][_0x3b4c('0xd0')],'disposition':_0x3a42ae['body'][_0x3b4c('0xd1')]})[_0x3b4c('0x31')](function(_0x2022bc){return _0x2022bc;});}})['then'](function(_0xa7fb6b){return respondWithRpcPromise(_0x3b4c('0xd2'),_0x3b4c('0xd3'),_0x3a42ae['body'],client9004);})[_0x3b4c('0x31')](respondWithResult(_0x281749,null))[_0x3b4c('0xb5')](handleError(_0x281749,null));};exports[_0x3b4c('0xd4')]=function(_0x52cfd0,_0x12845f,_0x12fd01){_0x52cfd0['body'][_0x3b4c('0x34')]=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd6')];_0x52cfd0['body']['basename']=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd7')];_0x52cfd0['body'][_0x3b4c('0x40')]=_0x52cfd0[_0x3b4c('0xd5')][_0x3b4c('0xd8')];return db[_0x3b4c('0xd9')]['create'](_0x52cfd0['body'])['then'](respondWithResult(_0x12845f,0xc9))[_0x3b4c('0xb5')](handleError(_0x12845f,null));};exports[_0x3b4c('0xda')]=function(_0x25af4f,_0x5af489,_0x53bf5c){return db[_0x3b4c('0x3d')][_0x3b4c('0xdb')]({'where':{'id':_0x25af4f[_0x3b4c('0xb7')]['id']},'raw':!![]})[_0x3b4c('0x31')](handleEntityNotFound(_0x5af489,null))[_0x3b4c('0x31')](function(_0x1bf2e2){if(_0x1bf2e2){if(_0x1bf2e2[_0x3b4c('0xd0')]){return _0x5af489[_0x3b4c('0x29')](0x193)['json']({'status':0x193,'message':_0x3b4c('0xdc')});}return db['Attachment'][_0x3b4c('0xdb')]({'where':{'id':_0x25af4f['query'][_0x3b4c('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0x5af489,null));}})[_0x3b4c('0x31')](function(_0x2de478){if(_0x2de478){return _0x5af489['download'](path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0xe0'),_0x2de478['basename']));}})[_0x3b4c('0xb5')](handleError(_0x5af489,null));};exports['close']=function(_0x56f7d0,_0x101b81){var _0xda4bc7=null;var _0x2fd9ac=null;var _0x73174e=null;var _0x5c7087=null;if(_0x56f7d0['body']['id']){delete _0x56f7d0[_0x3b4c('0xbd')]['id'];}if(_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')]){_0x5c7087=path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0xe2'),util[_0x3b4c('0xe3')](_0x3b4c('0xe4'),Date[_0x3b4c('0xe5')]()));_0x56f7d0['body'][_0x3b4c('0xe6')]=_0x5c7087;}return db['ChatInteraction'][_0x3b4c('0x65')]({'where':{'id':_0x56f7d0[_0x3b4c('0xb7')]['id']},'include':[{'model':db[_0x3b4c('0xcb')],'as':_0x3b4c('0xe7'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x3b4c('0x31')](handleEntityNotFound(_0x101b81,null))[_0x3b4c('0x31')](saveUpdates(_0x56f7d0[_0x3b4c('0xbd')],null))[_0x3b4c('0x31')](function(_0x52b83b){if(_0x52b83b){_0xda4bc7=_0x52b83b;return db[_0x3b4c('0xe8')]['find']({'where':{'id':_0xda4bc7[_0x3b4c('0x79')]}});}})['then'](function(_0x9c65bb){if(_0x9c65bb){_0x73174e=_0x9c65bb;return db['CmContact']['find']({'where':{'id':_0xda4bc7[_0x3b4c('0x6e')]}});}})['then'](function(_0x21360c){if(_0x21360c){_0x2fd9ac=_0x21360c;if(_0x5c7087){var _0x41f68f=null;for(var _0x305f63=0x1;_0x305f63<_0xda4bc7[_0x3b4c('0xe7')]['length'];++_0x305f63){_0x41f68f=_0xda4bc7['Messages'][_0x305f63];var _0x44f407=_0x41f68f[_0x3b4c('0x74')]?util[_0x3b4c('0xe3')]('%s%d',_0x73174e[_0x3b4c('0xe9')],_0x41f68f[_0x3b4c('0x74')]):_0x3b4c('0xea');var _0x520bb8=_0x56f7d0[_0x3b4c('0xbd')]['customer']||util[_0x3b4c('0xe3')]('%s%d',_0x3b4c('0xeb'),_0x41f68f[_0x3b4c('0x6e')]);switch(_0x73174e['agentIdentifier']){case _0x3b4c('0xec'):_0x44f407=_0x41f68f[_0x3b4c('0x74')]?util[_0x3b4c('0xe3')](_0x3b4c('0xed'),_0x73174e[_0x3b4c('0xe9')],_0x41f68f[_0x3b4c('0x74')]):_0x3b4c('0xea');break;case _0x3b4c('0xee'):_0x44f407=_0x41f68f[_0x3b4c('0x74')]?_0x41f68f[_0x3b4c('0x72')]['alias']||_0x41f68f[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea');break;case'agent_fullname':_0x44f407=_0x41f68f[_0x3b4c('0x74')]?_0x41f68f[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea');break;default:_0x44f407=_0x41f68f['UserId']?util[_0x3b4c('0xe3')](_0x3b4c('0xed'),_0x73174e[_0x3b4c('0xe9')],_0x41f68f['UserId']):_0x3b4c('0xea');}var _0x3dc2ff=util[_0x3b4c('0xe3')]('[%s]\x20%s:\x20%s\x0a',moment(_0x41f68f['createdAt'])[_0x3b4c('0xe3')](_0x3b4c('0xef')),_0x41f68f['direction']==='in'?_0x520bb8:_0x44f407,_0x41f68f[_0x3b4c('0xbd')]);if(!_0x41f68f[_0x3b4c('0xf0')]){fs[_0x3b4c('0xf1')](_0x5c7087,_0x3dc2ff);}}return db[_0x3b4c('0xf2')][_0x3b4c('0xdb')]({'where':{'service':!![]},'include':[{'model':db[_0x3b4c('0xf3')],'as':_0x3b4c('0xf4'),'raw':!![]}]});}}})['then'](function(_0x2819da){if(_0x2819da&&_0x2819da[_0x3b4c('0xf4')]&&_0x56f7d0[_0x3b4c('0xbd')]){var _0x12c0f3={'tls':{'rejectUnauthorized':![]}};if(_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf5')]){_0x12c0f3[_0x3b4c('0xf5')]=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf5')];}else{_0x12c0f3[_0x3b4c('0xf6')]=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf6')];_0x12c0f3[_0x3b4c('0xf7')]=_0x2819da['Smtp']['port'];_0x12c0f3['secure']=_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xf8')];}if(_0x2819da[_0x3b4c('0xf4')]['authentication']){_0x12c0f3[_0x3b4c('0xf9')]={'user':_0x2819da['Smtp'][_0x3b4c('0x97')],'pass':_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0xfa')]};}return respondWithRpcPromise('SendMail',_0x3b4c('0xfb'),{'account':_0x12c0f3,'message':{'from':util['format'](_0x3b4c('0xfc'),_0x2819da[_0x3b4c('0x34')],_0x2819da[_0x3b4c('0xfd')]||_0x2819da[_0x3b4c('0xf4')][_0x3b4c('0x97')]),'to':_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')],'subject':_0x3b4c('0xfe'),'text':util[_0x3b4c('0xe3')](_0x3b4c('0xff'),_0x56f7d0[_0x3b4c('0xbd')][_0x3b4c('0xe1')]),'attachments':[{'path':_0x5c7087}]}})['then'](function(){return _0xda4bc7;})['catch'](function(_0x403957){console[_0x3b4c('0x25')](_0x403957);});}else{return _0xda4bc7;}})['then'](respondWithStatusCode(_0x101b81,0xc8))[_0x3b4c('0xb5')](handleError(_0x101b81,null));};exports['addMessage']=function(_0x4ef0c2,_0x6b199d,_0x2a601c){return db['ChatMessage'][_0x3b4c('0x65')]({'where':{'id':_0x4ef0c2[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x6b199d,null))[_0x3b4c('0x31')](function(_0x589c63){if(_0x589c63){return _0x589c63[_0x3b4c('0x100')](_0x4ef0c2[_0x3b4c('0xbd')][_0x3b4c('0x101')],_[_0x3b4c('0x102')](_0x4ef0c2['body'],[_0x3b4c('0x101'),'id'])||{});}})[_0x3b4c('0x31')](respondWithResult(_0x6b199d,null))['catch'](handleError(_0x6b199d,null));};exports[_0x3b4c('0x103')]=function(_0x5f53e3,_0x150867,_0x5b1c42){var _0x30d86b={'raw':![],'where':{}};var _0x7c4960={};var _0x496959={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3b4c('0xdb')]({'where':{'id':_0x5f53e3[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x150867,null))['then'](function(_0xbe9dd9){if(_0xbe9dd9){_0x7c4960[_0x3b4c('0x41')]=_[_0x3b4c('0xb8')](db[_0x3b4c('0xcb')][_0x3b4c('0x3e')]);_0x7c4960[_0x3b4c('0x42')]=_[_0x3b4c('0xb8')](_0x5f53e3[_0x3b4c('0x42')]);_0x7c4960[_0x3b4c('0x43')]=_['intersection'](_0x7c4960[_0x3b4c('0x41')],_0x7c4960[_0x3b4c('0x42')]);_0x30d86b[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0x7c4960[_0x3b4c('0x41')],qs[_0x3b4c('0x46')](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x46')]));_0x30d86b[_0x3b4c('0x45')]=_0x30d86b[_0x3b4c('0x45')]['length']?_0x30d86b[_0x3b4c('0x45')]:_0x7c4960[_0x3b4c('0x41')];if(!_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x30d86b['limit']=qs[_0x3b4c('0x2d')](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x2d')]);_0x30d86b['offset']=qs['offset'](_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x2c')]);}_0x30d86b[_0x3b4c('0x4a')]=qs['sort'](_0x5f53e3[_0x3b4c('0x42')]['sort']);_0x30d86b['where']=qs[_0x3b4c('0x43')](_['pick'](_0x5f53e3['query'],_0x7c4960[_0x3b4c('0x43')]));_0x30d86b[_0x3b4c('0x4c')][_0x3b4c('0x104')]=_0xbe9dd9['id'];if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x87')]){_0x30d86b[_0x3b4c('0x4c')]=_['merge'](_0x30d86b[_0x3b4c('0x4c')],{'$or':_[_0x3b4c('0x36')](_0x30d86b[_0x3b4c('0x45')],function(_0xcceea7){var _0x3fcc60={};_0x3fcc60[_0xcceea7]={'$like':'%'+_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x87')]+'%'};return _0x3fcc60;})});}if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0x7c')]){var _0x10c80f=_0x5f53e3['query'][_0x3b4c('0x7c')][_0x3b4c('0x6c')](',');var _0x4d725b={};_0x4d725b[_0x10c80f[0x0]]={'$gte':moment(_0x10c80f[0x1])[_0x3b4c('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30d86b[_0x3b4c('0x4c')]=_['merge'](_0x30d86b['where'],_0x4d725b);}_0x30d86b=_[_0x3b4c('0xa0')]({},_0x30d86b,_0x5f53e3[_0x3b4c('0xbb')]);return db[_0x3b4c('0xcb')][_0x3b4c('0x9f')]({'where':_0x30d86b[_0x3b4c('0x4c')]})['then'](function(_0x57acff){_0x496959[_0x3b4c('0x9f')]=_0x57acff;if(_0x5f53e3[_0x3b4c('0x42')][_0x3b4c('0xb9')]){_0x30d86b[_0x3b4c('0xba')]=[{'all':!![]}];}return db[_0x3b4c('0xcb')][_0x3b4c('0x105')](_0x30d86b);})[_0x3b4c('0x31')](function(_0x5e0cbb){_0x496959[_0x3b4c('0x106')]=_0x5e0cbb;return _0x496959;});}})[_0x3b4c('0x31')](respondWithFilteredResult(_0x150867,_0x30d86b))[_0x3b4c('0xb5')](handleError(_0x150867,null));};exports[_0x3b4c('0x107')]=function(_0x215d93,_0x5e62c9,_0xb0b907){var _0x4807bf={'where':{}},_0xc8eee9={},_0x2b0909={'count':0x0,'rows':[]};return db[_0x3b4c('0x3d')][_0x3b4c('0xdb')]({'where':{'id':_0x215d93[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x5e62c9,null))[_0x3b4c('0x31')](function(_0x2cc80c){if(_0x2cc80c){_0xc8eee9[_0x3b4c('0x41')]=_[_0x3b4c('0xb8')](db[_0x3b4c('0xcb')]['rawAttributes']);_0xc8eee9[_0x3b4c('0x42')]=_[_0x3b4c('0xb8')](_0x215d93[_0x3b4c('0x42')]);_0xc8eee9[_0x3b4c('0x43')]=_['intersection'](_0xc8eee9[_0x3b4c('0x41')],_0xc8eee9[_0x3b4c('0x42')]);_0x4807bf[_0x3b4c('0x45')]=_[_0x3b4c('0x44')](_0xc8eee9[_0x3b4c('0x41')],qs['fields'](_0x215d93[_0x3b4c('0x42')]['fields']));_0x4807bf['attributes']=_0x4807bf[_0x3b4c('0x45')]['length']?_0x4807bf[_0x3b4c('0x45')]:_0xc8eee9['model'];if(!_0x215d93[_0x3b4c('0x42')][_0x3b4c('0x48')](_0x3b4c('0x49'))){_0x4807bf[_0x3b4c('0x2d')]=qs[_0x3b4c('0x2d')](_0x215d93[_0x3b4c('0x42')]['limit']);_0x4807bf[_0x3b4c('0x2c')]=qs[_0x3b4c('0x2c')](_0x215d93[_0x3b4c('0x42')]['offset']);}_0x4807bf[_0x3b4c('0x4a')]=qs[_0x3b4c('0x4b')](_0x215d93['query']['sort']);_0x4807bf['where']=qs[_0x3b4c('0x43')](_['pick'](_0x215d93['query'],_0xc8eee9[_0x3b4c('0x43')]));_0x4807bf[_0x3b4c('0x4c')]['ChatInteractionId']=_0x2cc80c['id'];if(_0x215d93[_0x3b4c('0x42')][_0x3b4c('0x87')]){_0x4807bf['where']=_['merge'](_0x4807bf[_0x3b4c('0x4c')],{'$or':_['map'](_0x4807bf['attributes'],function(_0x68d79f){var _0x38bf8f={};_0x38bf8f[_0x68d79f]={'$like':'%'+_0x215d93['query'][_0x3b4c('0x87')]+'%'};return _0x38bf8f;})});}_0x4807bf[_0x3b4c('0x4c')][_0x3b4c('0xf0')]=![];if(_0x215d93[_0x3b4c('0x42')]['id']){_0x4807bf[_0x3b4c('0x4c')]['id']={'$gt':_0x215d93[_0x3b4c('0x42')]['id']};}_0x4807bf=_['merge']({},_0x4807bf,_0x215d93[_0x3b4c('0xbb')]);return db['ChatMessage'][_0x3b4c('0x9f')]({'where':_0x4807bf['where']})[_0x3b4c('0x31')](function(_0x398810){_0x2b0909[_0x3b4c('0x9f')]=_0x398810;_0x4807bf[_0x3b4c('0xba')]=[];if(_0x215d93[_0x3b4c('0x42')]['includeAgent']){_0x4807bf[_0x3b4c('0xba')][_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':_0x3b4c('0x72'),'attributes':['id',_0x3b4c('0x37'),_0x3b4c('0x108')]});}if(_0x215d93[_0x3b4c('0x42')][_0x3b4c('0xb9')]){_0x4807bf[_0x3b4c('0xba')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4807bf);})[_0x3b4c('0x31')](function(_0x3713ab){_0x2b0909[_0x3b4c('0x106')]=_0x3713ab;return _0x2b0909;});}})[_0x3b4c('0x31')](respondWithFilteredResult(_0x5e62c9,_0x4807bf))[_0x3b4c('0xb5')](handleError(_0x5e62c9,null));};exports[_0x3b4c('0x109')]=function(_0x41c3a7,_0x264c8b,_0x4762f0){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x41c3a7[_0x3b4c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x264c8b,null))[_0x3b4c('0x31')](function(_0xa8ec8d){if(_0xa8ec8d){return _0xa8ec8d[_0x3b4c('0x10a')](_0x41c3a7['body'][_0x3b4c('0x101')],_[_0x3b4c('0x102')](_0x41c3a7[_0x3b4c('0xbd')],[_0x3b4c('0x101'),'id'])||{})[_0x3b4c('0x10b')](function(){return db[_0x3b4c('0x70')]['findAll']({'attributes':['id',_0x3b4c('0x34'),'color'],'where':{'id':_0x41c3a7[_0x3b4c('0xbd')][_0x3b4c('0x101')]}});})[_0x3b4c('0x31')](function(_0x1e871f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x41c3a7[_0x3b4c('0xb7')]['id']),'tags':_0x1e871f||[]});return{'id':Number(_0x41c3a7[_0x3b4c('0xb7')]['id']),'tags':_0x1e871f||[]};});}})['then'](respondWithResult(_0x264c8b,null))[_0x3b4c('0xb5')](handleError(_0x264c8b,null));};exports[_0x3b4c('0x10c')]=function(_0x2902fc,_0x3f91b9,_0x3f79f7){return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x2902fc[_0x3b4c('0xb7')]['id']}})[_0x3b4c('0x31')](handleEntityNotFound(_0x3f91b9,null))['then'](function(_0x1b1ba4){if(_0x1b1ba4){return _0x1b1ba4[_0x3b4c('0x10c')](_0x2902fc['query'][_0x3b4c('0x101')]);}})[_0x3b4c('0x31')](respondWithStatusCode(_0x3f91b9,null))[_0x3b4c('0xb5')](handleError(_0x3f91b9,null));};exports[_0x3b4c('0x10d')]=function(_0x1b7d1f,_0x210d93){var _0x482393=moment()[_0x3b4c('0x10e')]()[_0x3b4c('0x9e')]();var _0x215b92=path[_0x3b4c('0xde')](config['root'],_0x3b4c('0x10f'),_0x3b4c('0x110'),_0x3b4c('0x111'));var _0x289db2=path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0x10f'),_0x3b4c('0x110'),_0x3b4c('0x112'));var _0x2c4101=path[_0x3b4c('0xde')](_0x215b92,_0x482393);var _0x315fb3=util[_0x3b4c('0xe3')]('transcript-%d-%s.zip',_0x1b7d1f[_0x3b4c('0xb7')]['id'],_0x482393);var _0x5d4316=path[_0x3b4c('0xde')](_0x215b92,_0x315fb3);var _0x283c77=[];_0x283c77[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':'User','attributes':['id',_0x3b4c('0x37')],'raw':!![]});_0x283c77[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x113')],'as':'Contact','attributes':['id',_0x3b4c('0x114'),_0x3b4c('0x115')],'raw':!![]});if(_0x1b7d1f[_0x3b4c('0x42')]['attachments']){_0x283c77[_0x3b4c('0x3b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x31f95e=[{'model':db[_0x3b4c('0xcb')],'as':_0x3b4c('0xe7'),'attributes':['id',_0x3b4c('0xbd'),_0x3b4c('0x7a'),_0x3b4c('0x116'),_0x3b4c('0xf0'),_0x3b4c('0x82')],'include':_0x283c77}];_0x31f95e['push']({'model':db[_0x3b4c('0xe8')],'as':'Account','attributes':['id',_0x3b4c('0x34')]});_0x31f95e[_0x3b4c('0x3b')]({'model':db[_0x3b4c('0x72')],'as':_0x3b4c('0x117'),'attributes':['id','fullname']});return db[_0x3b4c('0x3d')][_0x3b4c('0x65')]({'where':{'id':_0x1b7d1f[_0x3b4c('0xb7')]['id']},'include':_0x31f95e})[_0x3b4c('0x31')](handleEntityNotFound(_0x210d93,null))[_0x3b4c('0x31')](function(_0x37662b){if(_0x37662b){var _0x22d0b4=_0x37662b[_0x3b4c('0x118')]({'plain':!![]});fs[_0x3b4c('0x119')](_0x2c4101);var _0x2e4a88={'format':'A4','border':'10px','header':{'height':_0x3b4c('0x11a'),'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':_0x3b4c('0x11b'),'contents':{'default':util[_0x3b4c('0xe3')](_0x3b4c('0x11c'),util[_0x3b4c('0xe3')](_0x3b4c('0x11d'),_0x3b4c('0x11e'),_0x22d0b4['id']),moment()[_0x3b4c('0xe3')](_0x3b4c('0x11f'))[_0x3b4c('0x9e')]())}}};var _0x3e02bc={'channel':_0x3b4c('0x11e'),'account':_0x22d0b4[_0x3b4c('0x120')]['name'],'agent':_0x22d0b4[_0x3b4c('0x117')]?_0x22d0b4[_0x3b4c('0x117')]['fullname']:'N.A.','createdAt':moment(_0x22d0b4['createdAt'])[_0x3b4c('0xe3')](_0x3b4c('0x121'))['toString'](),'closedAt':_0x22d0b4[_0x3b4c('0xd0')]?moment(_0x22d0b4[_0x3b4c('0x122')])[_0x3b4c('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b4c('0x9e')]():'','disposition':_0x22d0b4[_0x3b4c('0xd1')],'chatInfo':{'browser':_0x22d0b4[_0x3b4c('0x123')],'os':_0x22d0b4['osName'],'referer':_0x22d0b4[_0x3b4c('0x124')],'customerIp':_0x22d0b4[_0x3b4c('0x125')],'customerPort':_0x22d0b4[_0x3b4c('0x126')]?_0x22d0b4['customerPort']:_0x3b4c('0x127')},'messages':_(_0x22d0b4[_0x3b4c('0xe7')])[_0x3b4c('0x128')]()[_0x3b4c('0x87')]({'secret':![]})['map'](function(_0x21a6b6){if(_0x21a6b6['Attachment']){var _0x5f3f1f=path['join'](_0x289db2,_0x21a6b6[_0x3b4c('0xd9')][_0x3b4c('0x129')]);if(fs['existsSync'](_0x5f3f1f)){fs['createReadStream'](_0x5f3f1f)[_0x3b4c('0x12a')](fs[_0x3b4c('0x12b')](path[_0x3b4c('0xde')](_0x2c4101,_0x21a6b6[_0x3b4c('0xd9')][_0x3b4c('0x129')])));}}return{'date':moment(_0x21a6b6[_0x3b4c('0x7a')])[_0x3b4c('0xe3')](_0x3b4c('0x121'))['toString'](),'sender':_0x21a6b6[_0x3b4c('0x116')]==='out'?_0x21a6b6['User']?_0x21a6b6[_0x3b4c('0x72')][_0x3b4c('0x37')]:_0x3b4c('0xea'):_0x21a6b6[_0x3b4c('0x12c')][_0x3b4c('0x114')]+(_0x21a6b6[_0x3b4c('0x12c')][_0x3b4c('0x115')]?'\x20'+_0x21a6b6[_0x3b4c('0x12c')]['lastName']:''),'body':_0x21a6b6[_0x3b4c('0xd9')]?_0x21a6b6[_0x3b4c('0xd9')]['basename']:_0x21a6b6[_0x3b4c('0xbd')],'direction':_0x21a6b6[_0x3b4c('0x116')]===_0x3b4c('0xca')?'A':'C','secret':_0x21a6b6[_0x3b4c('0xf0')],'read':_0x21a6b6['read'],'attachment':_0x21a6b6['Attachment']};})['value']()};return ejs['renderFile'](path[_0x3b4c('0xde')](config[_0x3b4c('0xdf')],_0x3b4c('0x10f'),'views',_0x3b4c('0x12d')),{'interaction':_0x3e02bc})['then'](function(_0x2b7c29){return new BPromise(function(_0x297acb,_0xc95dfa){pdf['create'](_0x2b7c29,_0x2e4a88)[_0x3b4c('0x12e')](path[_0x3b4c('0xde')](_0x2c4101,'transcript-'+_0x22d0b4['id']+'-'+_0x482393+'.pdf'),function(_0x3f2e23,_0x1739b5){if(_0x3f2e23)return _0xc95dfa(_0x3f2e23);_0x297acb(_0x1739b5);});});})['then'](function(){return new BPromise(function(_0x356c83,_0x24cc96){zipdir(_0x2c4101,{'saveTo':_0x5d4316},function(_0x11c2b4,_0x1c825e){if(_0x11c2b4)return _0x24cc96(_0x11c2b4);return _0x356c83(_0x1c825e);});})[_0x3b4c('0x31')](function(){return new BPromise(function(_0x206695,_0x4d9887){rimraf(_0x2c4101,function(_0x382c52){if(_0x382c52)_0x4d9887(_0x382c52);return _0x206695();});});})[_0x3b4c('0x31')](function(){return _0x210d93[_0x3b4c('0x10d')](_0x5d4316,_0x315fb3,function(_0x5c6d05){if(_0x5c6d05){console[_0x3b4c('0x12f')](_0x3b4c('0x130'),_0x5c6d05);}else{fs[_0x3b4c('0x131')](_0x5d4316);}});});});}else{return _0x210d93[_0x3b4c('0x32')](0xc8);}})[_0x3b4c('0xb5')](handleError(_0x210d93,null));}; \ No newline at end of file +var _0xb846=['journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','length','keyBy','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','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.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','create','body','update','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Attachment','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','CmContact','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','secret','includeAgent','setTags','spread','emit','removeTags','download','unix','server','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','direction','ChatWebsite','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','Owner','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','result','status','end','json','count','offset','set','reject','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','buildExpression','some','compact','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','ChatWebsiteId'];(function(_0x35c348,_0x377b7){var _0x14b47a=function(_0x24d855){while(--_0x24d855){_0x35c348['push'](_0x35c348['shift']());}};_0x14b47a(++_0x377b7);}(_0xb846,0x1d0));var _0x6b84=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb846[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x6b84('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b84('0x1'));var jsonpatch=require(_0x6b84('0x2'));var rp=require(_0x6b84('0x3'));var moment=require(_0x6b84('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b84('0x5'));var path=require(_0x6b84('0x6'));var sox=require(_0x6b84('0x7'));var csv=require(_0x6b84('0x8'));var ejs=require(_0x6b84('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b84('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6b84('0xb'));var toCsv=require(_0x6b84('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b84('0xc'));var qs=require(_0x6b84('0xd'));var as=require(_0x6b84('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6b84('0xf'));var config=require(_0x6b84('0x10'));var licenseUtil=require(_0x6b84('0x11'));var db=require(_0x6b84('0x12'))['db'];config[_0x6b84('0x13')]=_[_0x6b84('0x14')](config[_0x6b84('0x13')],{'host':_0x6b84('0x15'),'port':0x18eb});var socket=require(_0x6b84('0x16'))(new Redis(config[_0x6b84('0x13')]));require(_0x6b84('0x17'))[_0x6b84('0x18')](socket);var jayson=require(_0x6b84('0x19'));var client=jayson['client'][_0x6b84('0x1a')]({'port':0x232b});var client9004=jayson['client'][_0x6b84('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x2673ad,_0x33b0ac,_0x15714b,_0x100b1e){return new BPromise(function(_0x1ff8d9,_0x13496a){var _0x24a2ca=_0x100b1e||client;return _0x24a2ca[_0x6b84('0x1b')](_0x2673ad,_0x15714b)[_0x6b84('0x1c')](function(_0xd798f){logger[_0x6b84('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x33b0ac,_0x6b84('0x1e'));logger[_0x6b84('0x1f')](_0x6b84('0x20'),_0x33b0ac,_0x6b84('0x1e'),JSON[_0x6b84('0x21')](_0xd798f));if(_0xd798f[_0x6b84('0x22')]){if(_0xd798f['error']['code']===0x1f4){logger[_0x6b84('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x33b0ac,_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);return _0x13496a(_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);}logger['error'](_0x6b84('0x24'),_0x33b0ac,_0xd798f['error']['message']);return _0x1ff8d9(_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);}else{logger[_0x6b84('0x1d')](_0x6b84('0x24'),_0x33b0ac,_0x6b84('0x1e'));_0x1ff8d9(_0xd798f[_0x6b84('0x25')][_0x6b84('0x23')]);}})['catch'](function(_0xb16a64){logger['error'](_0x6b84('0x24'),_0x33b0ac,_0xb16a64);_0x13496a(_0xb16a64);});});}function respondWithStatusCode(_0x2d99bc,_0x8674f0){_0x8674f0=_0x8674f0||0xcc;return function(_0x3617bc){if(_0x3617bc){return _0x2d99bc['sendStatus'](_0x8674f0);}return _0x2d99bc[_0x6b84('0x26')](_0x8674f0)[_0x6b84('0x27')]();};}function respondWithResult(_0x3355f1,_0x4d315a){_0x4d315a=_0x4d315a||0xc8;return function(_0x20bf16){if(_0x20bf16){return _0x3355f1['status'](_0x4d315a)[_0x6b84('0x28')](_0x20bf16);}};}function respondWithFilteredResult(_0x3a9873,_0x395880){return function(_0x599602){if(_0x599602){var _0x37b9e3=_0x599602[_0x6b84('0x29')],_0x2ae34f=_0x395880[_0x6b84('0x2a')],_0xba147=_0x395880['offset']+_0x395880['limit'],_0x1d3e0e;if(_0xba147>=_0x37b9e3){_0xba147=_0x37b9e3;_0x1d3e0e=0xc8;}else{_0x1d3e0e=0xce;}_0x3a9873[_0x6b84('0x26')](_0x1d3e0e);return _0x3a9873[_0x6b84('0x2b')]('Content-Range',_0x2ae34f+'-'+_0xba147+'/'+_0x37b9e3)['json'](_0x599602);}return null;};}function patchUpdates(_0x30fd96){return function(_0x5e0203){try{jsonpatch['apply'](_0x5e0203,_0x30fd96,!![]);}catch(_0x20f3a4){return BPromise[_0x6b84('0x2c')](_0x20f3a4);}return _0x5e0203['save']();};}function saveUpdates(_0x4713f9,_0x1a1899){return function(_0x39629e){if(_0x39629e){return _0x39629e['update'](_0x4713f9)['then'](function(_0x3304ea){return _0x3304ea;});}return null;};}function removeEntity(_0x4fe5a0,_0x30c63e){return function(_0x1ec6c9){if(_0x1ec6c9){return _0x1ec6c9[_0x6b84('0x2d')]()[_0x6b84('0x1c')](function(){_0x4fe5a0[_0x6b84('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x472266,_0x3bec64){return function(_0x5130d4){if(!_0x5130d4){_0x472266[_0x6b84('0x2e')](0x194);}return _0x5130d4;};}function handleError(_0xf8019,_0x3f7d28){_0x3f7d28=_0x3f7d28||0x1f4;return function(_0x6e2cc4){logger['error'](_0x6e2cc4[_0x6b84('0x2f')]);if(_0x6e2cc4['name']){delete _0x6e2cc4[_0x6b84('0x30')];}_0xf8019[_0x6b84('0x26')](_0x3f7d28)[_0x6b84('0x31')](_0x6e2cc4);};}function getInteractionUsers(_0x339164,_0x443cbc){return new BPromise(function(_0x3a9446,_0x982111){try{if(_0x443cbc[_0x339164['id']]){_0x339164[_0x6b84('0x32')]=_[_0x6b84('0x33')](_0x443cbc[_0x339164['id']],function(_0x462ddb){return{'id':_0x462ddb['id'],'fullname':_0x462ddb[_0x6b84('0x34')]};});}}catch(_0x51b535){_0x982111(_0x51b535);}_0x3a9446(_0x339164);});}function getInteractionTags(_0x183761,_0x440185){return new BPromise(function(_0x2a4dc2,_0x4061f0){try{if(_0x183761['TagIds']){_0x183761[_0x6b84('0x35')]=[];_0x183761[_0x6b84('0x36')][_0x6b84('0x37')](',')[_0x6b84('0x38')](function(_0x4e1be2){_0x183761[_0x6b84('0x35')][_0x6b84('0x39')](_0x440185[_0x4e1be2]);});}delete _0x183761['TagIds'];}catch(_0x2d99e6){_0x4061f0(_0x2d99e6);}_0x2a4dc2(_0x183761);});}function updateChatInteraction(_0x133592,_0x58964f,_0x1c468a){return new BPromise(function(_0x3c2b3f,_0x19c9af){return getInteractionUsers(_0x133592,_0x1c468a)[_0x6b84('0x1c')](function(_0x49637b){return getInteractionTags(_0x49637b,_0x58964f);})['then'](function(_0x13052d){_0x3c2b3f(_0x13052d);})[_0x6b84('0x3a')](function(_0x201c2f){_0x19c9af(_0x201c2f);});});}exports[_0x6b84('0x3b')]=function(_0x3bb31f,_0x5a8913){var _0x1624cc={},_0x5d4761={},_0x10f7f4={'count':0x0,'rows':[]};var _0x1e23ae=_[_0x6b84('0x33')](db[_0x6b84('0x3c')][_0x6b84('0x3d')],function(_0x462d80){return{'name':_0x462d80[_0x6b84('0x3e')],'type':_0x462d80[_0x6b84('0x3f')][_0x6b84('0x40')]};});_0x5d4761[_0x6b84('0x41')]=_[_0x6b84('0x33')](_0x1e23ae,_0x6b84('0x30'));_0x5d4761[_0x6b84('0x42')]=_[_0x6b84('0x43')](_0x3bb31f['query']);_0x5d4761[_0x6b84('0x44')]=_['intersection'](_0x5d4761[_0x6b84('0x41')],_0x5d4761[_0x6b84('0x42')]);_0x1624cc[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0x5d4761['model'],qs['fields'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x47')]));_0x1624cc[_0x6b84('0x45')]=_0x1624cc[_0x6b84('0x45')]['length']?_0x1624cc[_0x6b84('0x45')]:_0x5d4761['model'];if(!_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x48')](_0x6b84('0x49'))){_0x1624cc[_0x6b84('0x4a')]=qs['limit'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x4a')]);_0x1624cc['offset']=qs[_0x6b84('0x2a')](_0x3bb31f[_0x6b84('0x42')]['offset']);}_0x1624cc[_0x6b84('0x4b')]=qs['sort'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x1624cc[_0x6b84('0x4d')]=qs['filters'](_[_0x6b84('0x4e')](_0x3bb31f['query'],_0x5d4761['filters']),_0x1e23ae);var _0x2dbd22=[];var _0x12c25c=squel['select']()[_0x6b84('0x4f')]('id')[_0x6b84('0x4f')](_0x6b84('0x30'))[_0x6b84('0x4f')](_0x6b84('0x50'))[_0x6b84('0x51')]('tools_tags');var _0x84ea38=squel[_0x6b84('0x52')]()['field']('u.id')['field'](_0x6b84('0x53'))[_0x6b84('0x4f')](_0x6b84('0x54'))[_0x6b84('0x51')](_0x6b84('0x55'),'ui')[_0x6b84('0x56')](_0x6b84('0x57'),'u',_0x6b84('0x58'));var _0x35b6fd=squel[_0x6b84('0x52')]()['from'](_0x6b84('0x59'),'i')[_0x6b84('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6b84('0x56')](_0x6b84('0x57'),'o',_0x6b84('0x5a'))['left_join'](_0x6b84('0x5b'),'a',_0x6b84('0x5c'))[_0x6b84('0x56')](_0x6b84('0x5d'),'me',_0x6b84('0x5e'))[_0x6b84('0x56')]('chat_interaction_has_tags','it',_0x6b84('0x5f'))[_0x6b84('0x56')]('tools_tags','t',_0x6b84('0x60'));var _0x3b997e=squel[_0x6b84('0x61')]();var _0x2639ee=[];var _0x2a538c=squel['expr']();var _0x15c4a8;if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x62')]){_0x15c4a8=as['parseSearch'](_0x3bb31f['query']['search']);var _0x314e71=_0x15c4a8['sqlOperator'];for(var _0x37256c=0x0;_0x37256c<_0x15c4a8[_0x6b84('0x63')]['length'];_0x37256c++){var _0x2a79f9=_0x15c4a8[_0x6b84('0x63')][_0x37256c];var _0x291305='i';var _0x86b94d=_[_0x6b84('0x64')](_0x1e23ae,[_0x6b84('0x30'),_0x2a79f9[_0x6b84('0x4f')]]);if(!_0x86b94d){switch(_0x2a79f9[_0x6b84('0x4f')]){case _0x6b84('0x65'):if(_0x2a79f9[_0x6b84('0x66')]==0x1){_0x35b6fd['having']('`'+_0x2a79f9[_0x6b84('0x4f')]+_0x6b84('0x67'));}else{_0x35b6fd[_0x6b84('0x68')]('`'+_0x2a79f9[_0x6b84('0x4f')]+_0x6b84('0x69'));}break;case'Contact':if(_0x2a79f9['operator']===_0x6b84('0x6a')){if(_0x2a79f9['value']['split']('\x20')['length']>0x1){_0x3b997e[_0x314e71](_0x6b84('0x6b'),qs[_0x6b84('0x6c')](_0x2a79f9['value']),null);}else{var _0x50a894='%'+_0x2a79f9['value']+'%';_0x3b997e[_0x314e71]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x50a894,_0x50a894,_0x50a894);}}else{_0x86b94d=_['find'](_0x1e23ae,[_0x6b84('0x30'),'ContactId']);_0x2a79f9[_0x6b84('0x4f')]='ContactId';_0x50f2c9=as['buildExpression'](_0x291305,_0x86b94d['type'],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9['text'],_0x50f2c9['value'][_0x6b84('0x6d')],_0x50f2c9['value']['end']);}break;case _0x6b84('0x6e'):var _0x15456e=_0x2a79f9[_0x6b84('0x66')][_0x6b84('0x37')](',')[_0x6b84('0x33')](function(_0xa05e99){return Number(_0xa05e99);});_0x15456e[_0x6b84('0x38')](function(_0x3b625c){_0x2a538c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b625c+',%');});_0x2639ee=_[_0x6b84('0x6f')](_0x2639ee,_0x15456e);break;case _0x6b84('0x70'):if(_0x2a79f9['operator']===_0x6b84('0x6a')){_0x3b997e[_0x314e71](_0x6b84('0x71'),'%'+_0x2a79f9[_0x6b84('0x66')]+'%',null);}else{_0x86b94d=_[_0x6b84('0x64')](_0x1e23ae,['name',_0x6b84('0x72')]);_0x2a79f9['field']=_0x6b84('0x72');_0x50f2c9=as['buildExpression'](_0x291305,_0x86b94d['type'],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')]['start'],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x27')]);}break;case'body':_0x50f2c9=as[_0x6b84('0x74')]('me',null,_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x6d')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x27')]);break;}}else{var _0x50f2c9=as[_0x6b84('0x74')](_0x291305,_0x86b94d[_0x6b84('0x3f')],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x6d')],_0x50f2c9[_0x6b84('0x66')]['end']);}}}else{var _0x12b407=_(_0x3bb31f['query'])['keys']()[_0x6b84('0x33')](function(_0x186fc4){return _[_0x6b84('0x75')](_0x1e23ae,[_0x6b84('0x30'),_0x186fc4])?_0x186fc4:undefined;})[_0x6b84('0x76')]()[_0x6b84('0x66')]();if(!_[_0x6b84('0x77')](_0x12b407)){_0x12b407[_0x6b84('0x38')](function(_0x1aac98){if(_0x1aac98==='ChatWebsiteId'){_0x35b6fd['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x6b84('0x78')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98]));}else if(_0x1aac98===_0x6b84('0x79')){var _0x251800=JSON[_0x6b84('0x7a')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98])[_0x6b84('0x7b')];var _0x54722a=JSON[_0x6b84('0x7a')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98])['$lte'];_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x7c'),_0x251800,_0x54722a);}else{if(_0x3bb31f[_0x6b84('0x42')][_0x1aac98]===_0x6b84('0x7d')){_0x35b6fd[_0x6b84('0x4d')]('i.'+_0x1aac98+_0x6b84('0x7e'));}else{_0x35b6fd[_0x6b84('0x4d')]('i.'+_0x1aac98+_0x6b84('0x7f'),_0x3bb31f['query'][_0x1aac98]);}}});}if(_0x3bb31f['query'][_0x6b84('0x80')]){if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x80')]==0x1){_0x35b6fd[_0x6b84('0x68')]('`unreadMessages`\x20=\x200');}else{_0x35b6fd[_0x6b84('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]){_0x2639ee=_[_0x6b84('0x82')](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')])?_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]:new Array(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]);_0x2639ee[_0x6b84('0x38')](function(_0x2b149d){_0x2a538c['or'](_0x6b84('0x83'),'%,'+_0x2b149d+',%');});}if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x84')]){var _0x21f065=_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x84')][_0x6b84('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6b84('0x86')](_0x21f065)){_0x3b997e['or'](_0x6b84('0x87'),_0x21f065+'%');}else{_0x3b997e['or'](_0x6b84('0x88'),qs['getFullTextValue'](_0x21f065))['or'](_0x6b84('0x89'),_0x21f065+'%');}}}_0x35b6fd[_0x6b84('0x4d')](_0x3b997e);_0x35b6fd[_0x6b84('0x8a')]('i.id');var _0x4cb50f={'type':db[_0x6b84('0x8b')][_0x6b84('0x8c')][_0x6b84('0x8d')],'raw':!![]};var _0x1d0919=_0x35b6fd['clone']();_0x1d0919[_0x6b84('0x4f')](_0x6b84('0x8e'));_0x1d0919[_0x6b84('0x4f')](_0x6b84('0x8f'),'unreadMessages');if(_0x1624cc[_0x6b84('0x4b')]){_0x1624cc[_0x6b84('0x4b')]['forEach'](function(_0xb8e528){var _0x2c334c=_0xb8e528[0x0]===_0x6b84('0x90')?_0xb8e528[0x0]:'i.'+_0xb8e528[0x0];_0x35b6fd['order'](_0x2c334c,_0xb8e528[0x1]===_0x6b84('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x2639ee)){_0x35b6fd['having'](_0x2a538c);_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x92'),_0x2639ee);}BPromise['resolve']()[_0x6b84('0x1c')](function(){if(!_0x15c4a8){if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x93')]||_0x3bb31f['query'][_0x6b84('0x94')])return;_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x95'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x95'));return;}if(_0x3bb31f[_0x6b84('0x96')][_0x6b84('0x97')]!==_0x6b84('0x98'))return;return _0x3bb31f[_0x6b84('0x96')][_0x6b84('0x99')]({'attributes':['id'],'raw':!![]})[_0x6b84('0x1c')](function(_0x10f13a){if(_[_0x6b84('0x77')](_0x10f13a)){_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x9a'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x9a'));}else{_0x1d0919['where'](_0x6b84('0x9b'),_[_0x6b84('0x33')](_0x10f13a,'id'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x9b'),_[_0x6b84('0x33')](_0x10f13a,'id'));}});})[_0x6b84('0x1c')](function(){if(_0x3bb31f[_0x6b84('0x96')][_0x6b84('0x97')]===_0x6b84('0x98')&&!_0x15c4a8&&!_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x93')])return[];return db[_0x6b84('0x9c')][_0x6b84('0x42')](_0x1d0919[_0x6b84('0x9d')](),_0x4cb50f);})[_0x6b84('0x1c')](function(_0x2b18ec){_0x10f7f4[_0x6b84('0x29')]=_0x2b18ec[_0x6b84('0x9e')];if(_0x10f7f4[_0x6b84('0x29')]===0x0)return[];return db[_0x6b84('0x9c')]['query'](_0x12c25c['toString'](),_0x4cb50f)[_0x6b84('0x1c')](function(_0x41d6af){_0x2dbd22=_[_0x6b84('0x9f')](_0x41d6af,'id');_0x4cb50f=_[_0x6b84('0xa0')](_0x4cb50f,{'model':db[_0x6b84('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bb31f['query'][_0x6b84('0x47')]){_0x1624cc[_0x6b84('0x45')][_0x6b84('0x38')](function(_0x7fc0b8){_0x35b6fd[_0x6b84('0x4f')]('i.'+_0x7fc0b8);});}else{_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0x8f'),_0x6b84('0x65'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa1'),'Account.key');_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa2'),'Account.mandatoryDisposition');_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa3'),_0x6b84('0x90'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa4'));_0x35b6fd['field'](_0x6b84('0xa5'),_0x6b84('0xa6'));_0x35b6fd[_0x6b84('0x4f')]('c.lastName',_0x6b84('0xa7'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa8'),'Contact.email');_0x35b6fd['field']('c.phone',_0x6b84('0xa9'));_0x35b6fd['field'](_0x6b84('0xaa'),_0x6b84('0xab'));_0x35b6fd['field'](_0x6b84('0xac'),_0x6b84('0xad'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xae'),_0x6b84('0xaf'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xb0'),_0x6b84('0xb1'));_0x35b6fd['field'](_0x6b84('0xb2'),_0x6b84('0x36'));}if(_0x1624cc[_0x6b84('0x4a')])_0x35b6fd[_0x6b84('0x4a')](_0x1624cc[_0x6b84('0x4a')]);if(_0x1624cc[_0x6b84('0x2a')])_0x35b6fd[_0x6b84('0x2a')](_0x1624cc[_0x6b84('0x2a')]);return db[_0x6b84('0x9c')][_0x6b84('0x42')](_0x35b6fd[_0x6b84('0x9d')](),_0x4cb50f);})[_0x6b84('0x1c')](function(_0x503033){_0x84ea38[_0x6b84('0x4d')](_0x6b84('0xb3'),_[_0x6b84('0x33')](_0x503033,'id'));return db['sequelize'][_0x6b84('0x42')](_0x84ea38[_0x6b84('0x9d')](),_0x4cb50f)[_0x6b84('0x1c')](function(_0x33b7e8){var _0x58c0f6=_[_0x6b84('0xb4')](_0x33b7e8,_0x6b84('0xb5'));var _0x292908=[];_0x503033[_0x6b84('0x38')](function(_0x2c5bff){_0x292908[_0x6b84('0x39')](updateChatInteraction(_0x2c5bff,_0x2dbd22,_0x58c0f6));});return BPromise['all'](_0x292908);});});})[_0x6b84('0x1c')](function(_0x1e2ba4){_0x10f7f4[_0x6b84('0xb6')]=_0x1e2ba4;return _0x10f7f4;})[_0x6b84('0x1c')](respondWithFilteredResult(_0x5a8913,_0x1624cc))[_0x6b84('0x3a')](handleError(_0x5a8913,null));};exports[_0x6b84('0xb7')]=function(_0x3e6a36,_0xca9c19){var _0x509bf9={'raw':![],'where':{'id':_0x3e6a36[_0x6b84('0xb8')]['id']}},_0x179966={};_0x179966[_0x6b84('0x41')]=_[_0x6b84('0x43')](db[_0x6b84('0x3c')][_0x6b84('0x3d')]);_0x179966[_0x6b84('0x42')]=_['keys'](_0x3e6a36['query']);_0x179966[_0x6b84('0x44')]=_[_0x6b84('0x46')](_0x179966[_0x6b84('0x41')],_0x179966[_0x6b84('0x42')]);_0x509bf9[_0x6b84('0x45')]=_['intersection'](_0x179966[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x3e6a36[_0x6b84('0x42')][_0x6b84('0x47')]));_0x509bf9[_0x6b84('0x45')]=_0x509bf9[_0x6b84('0x45')]['length']?_0x509bf9[_0x6b84('0x45')]:_0x179966['model'];if(_0x3e6a36[_0x6b84('0x42')]['includeAll']){_0x509bf9['include']=[{'all':!![]}];}_0x509bf9=_['merge']({},_0x509bf9,_0x3e6a36['options']);return db['ChatInteraction'][_0x6b84('0x64')](_0x509bf9)[_0x6b84('0x1c')](handleEntityNotFound(_0xca9c19,null))['then'](respondWithResult(_0xca9c19,null))['catch'](handleError(_0xca9c19,null));};exports[_0x6b84('0xb9')]=function(_0x255fb5,_0x2bc84f){return db[_0x6b84('0x3c')][_0x6b84('0xb9')](_0x255fb5[_0x6b84('0xba')],{})['then'](respondWithResult(_0x2bc84f,0xc9))['catch'](handleError(_0x2bc84f,null));};exports[_0x6b84('0xbb')]=function(_0x23a521,_0x3a6287){if(_0x23a521[_0x6b84('0xba')]['id']){delete _0x23a521[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x23a521[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x3a6287,null))['then'](saveUpdates(_0x23a521['body'],null))[_0x6b84('0x1c')](respondWithResult(_0x3a6287,null))[_0x6b84('0x3a')](handleError(_0x3a6287,null));};exports[_0x6b84('0x2d')]=function(_0x536a25,_0x8a89c1){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x536a25[_0x6b84('0xb8')]['id']}})['then'](handleEntityNotFound(_0x8a89c1,null))[_0x6b84('0x1c')](removeEntity(_0x8a89c1,null))['catch'](handleError(_0x8a89c1,null));};exports['describe']=function(_0x1723b2,_0x1afd92){return db[_0x6b84('0x3c')][_0x6b84('0xbc')]()[_0x6b84('0x1c')](respondWithResult(_0x1afd92,null))[_0x6b84('0x3a')](handleError(_0x1afd92,null));};exports[_0x6b84('0xbd')]=function(_0x3201b2,_0x57f0b7){var _0x28d284=_0x3201b2[_0x6b84('0xb8')]['id'];var _0x3fa193;var _0x474695;var _0xc1a7b7;return db['ChatInteraction']['findOne']({'where':{'id':_0x28d284}})['then'](function(_0x568962){_0x3fa193=_0x568962;return db['ChatWebsite'][_0x6b84('0xbe')]({'where':{'id':_0x568962['ChatWebsiteId']},'attributes':['id',_0x6b84('0xbf'),_0x6b84('0xc0')],'raw':!![]});})[_0x6b84('0x1c')](function(_0x3a8976){if(_0x3a8976&&_0x3a8976[_0x6b84('0xbf')]&&_0x3a8976[_0x6b84('0xc0')]){_0x474695=_0x3a8976;var _0x38ea5f={'rejectUnauthorized':![],'method':'POST','uri':_0x6b84('0xc1'),'headers':{'X-APIKEY':_0x3a8976[_0x6b84('0xbf')]},'body':{'name':_0x6b84('0xc2')+_0x28d284},'redirect':_0x6b84('0xc3'),'json':!![]};return rp(_0x38ea5f);}else{throw new db[(_0x6b84('0x8b'))][(_0x6b84('0xc4'))](_0x6b84('0xc5'));}})[_0x6b84('0x1c')](function(_0x5a19a1){_0xc1a7b7=_0x5a19a1;if(_0xc1a7b7['id']){var _0x1be09d={'body':_0xc1a7b7[_0x6b84('0xc6')],'ChatWebsiteId':_0x474695['id'],'ChatInteractionId':_0x3fa193['id'],'direction':_0x6b84('0xc7'),'UserId':_0x3201b2[_0x6b84('0x96')]['id']};return db[_0x6b84('0xc8')][_0x6b84('0xb9')](_0x1be09d,{});}else{throw new db[(_0x6b84('0x8b'))]['ValidationError'](_0x6b84('0xc9'));}})['then'](function(){return _0x3fa193[_0x6b84('0xca')]({'vidaooSessionId':_0xc1a7b7['id']});})[_0x6b84('0x1c')](respondWithResult(_0x57f0b7,null))['catch'](handleError(_0x57f0b7,null));};exports['customUpdate']=function(_0x488ac0,_0x3d06a3){if(_0x488ac0['body']['id']){delete _0x488ac0[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x488ac0['params']['id']}})['then'](handleEntityNotFound(_0x3d06a3,null))[_0x6b84('0x1c')](saveUpdates(_0x488ac0[_0x6b84('0xba')],null))[_0x6b84('0x1c')](respondWithResult(_0x3d06a3,null))[_0x6b84('0x3a')](handleError(_0x3d06a3,null));};exports[_0x6b84('0xcb')]=function(_0x37a63f,_0x2eb1fc,_0x27509c){if(_0x37a63f[_0x6b84('0xba')]['id']){delete _0x37a63f[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')]['find']({'where':{'id':_0x37a63f[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](function(_0x76be9b){if(!_0x76be9b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x6b84('0xcc'));_0x2eb1fc[_0x6b84('0x2e')](0x194);}else{if(_0x76be9b[_0x6b84('0x72')]){throw new db[(_0x6b84('0x8b'))]['ValidationError'](_0x6b84('0xcd'));}}return _0x76be9b;})['then'](function(_0x5b4561){if(_0x5b4561){return _0x5b4561['update']({'closed':_0x37a63f[_0x6b84('0xba')]['closed'],'disposition':_0x37a63f[_0x6b84('0xba')][_0x6b84('0xce')]})['then'](function(_0x341856){return _0x341856;});}})[_0x6b84('0x1c')](function(_0x13149c){return respondWithRpcPromise(_0x6b84('0xcf'),'abandon',_0x37a63f[_0x6b84('0xba')],client9004);})[_0x6b84('0x1c')](respondWithResult(_0x2eb1fc,null))[_0x6b84('0x3a')](handleError(_0x2eb1fc,null));};exports['attachmentUpload']=function(_0x2d6e37,_0x4cd4cd,_0x32b8b6){_0x2d6e37[_0x6b84('0xba')][_0x6b84('0x30')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd1')];_0x2d6e37['body'][_0x6b84('0xd2')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd3')];_0x2d6e37[_0x6b84('0xba')][_0x6b84('0x3f')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd4')];return db['Attachment'][_0x6b84('0xb9')](_0x2d6e37[_0x6b84('0xba')])[_0x6b84('0x1c')](respondWithResult(_0x4cd4cd,0xc9))[_0x6b84('0x3a')](handleError(_0x4cd4cd,null));};exports[_0x6b84('0xd5')]=function(_0x3b918e,_0x517ddd,_0x2dcecc){return db['ChatInteraction']['findOne']({'where':{'id':_0x3b918e['params']['id']},'raw':!![]})[_0x6b84('0x1c')](handleEntityNotFound(_0x517ddd,null))[_0x6b84('0x1c')](function(_0x2bf73b){if(_0x2bf73b){if(_0x2bf73b[_0x6b84('0xd6')]){return _0x517ddd[_0x6b84('0x26')](0x193)[_0x6b84('0x28')]({'status':0x193,'message':'Unauthorized'});}return db[_0x6b84('0xd7')][_0x6b84('0xbe')]({'where':{'id':_0x3b918e[_0x6b84('0x42')][_0x6b84('0xd8')]},'raw':!![]})[_0x6b84('0x1c')](handleEntityNotFound(_0x517ddd,null));}})['then'](function(_0x214d93){if(_0x214d93){return _0x517ddd['download'](path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0xdb'),_0x214d93[_0x6b84('0xd2')]));}})[_0x6b84('0x3a')](handleError(_0x517ddd,null));};exports[_0x6b84('0xdc')]=function(_0x2ff772,_0x46298d){var _0x2f59d1=null;var _0x2407dd=null;var _0x5d3b4a=null;var _0x159b1e=null;if(_0x2ff772['body']['id']){delete _0x2ff772['body']['id'];}if(_0x2ff772[_0x6b84('0xba')][_0x6b84('0xdd')]){_0x159b1e=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0xde'),util['format'](_0x6b84('0xdf'),Date['now']()));_0x2ff772[_0x6b84('0xba')][_0x6b84('0xe0')]=_0x159b1e;}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x2ff772['params']['id']},'include':[{'model':db[_0x6b84('0xc8')],'as':_0x6b84('0xe1'),'include':[{'model':db[_0x6b84('0x70')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x46298d,null))[_0x6b84('0x1c')](saveUpdates(_0x2ff772[_0x6b84('0xba')],null))['then'](function(_0x440fb8){if(_0x440fb8){_0x2f59d1=_0x440fb8;return db['ChatWebsite'][_0x6b84('0x64')]({'where':{'id':_0x2f59d1[_0x6b84('0x93')]}});}})[_0x6b84('0x1c')](function(_0xcf7da9){if(_0xcf7da9){_0x5d3b4a=_0xcf7da9;return db[_0x6b84('0xe2')][_0x6b84('0x64')]({'where':{'id':_0x2f59d1[_0x6b84('0xe3')]}});}})['then'](function(_0x560b4a){if(_0x560b4a){_0x2407dd=_0x560b4a;if(_0x159b1e){var _0x4d99b6=null;for(var _0x57dd80=0x1;_0x57dd80<_0x2f59d1[_0x6b84('0xe1')]['length'];++_0x57dd80){_0x4d99b6=_0x2f59d1[_0x6b84('0xe1')][_0x57dd80];var _0x2e127b=_0x4d99b6['UserId']?util[_0x6b84('0xe4')](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');var _0x5b8981=_0x2ff772[_0x6b84('0xba')]['customer']||util['format'](_0x6b84('0xe5'),_0x6b84('0xe8'),_0x4d99b6[_0x6b84('0xe3')]);switch(_0x5d3b4a[_0x6b84('0xe9')]){case'website_alias':_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?util[_0x6b84('0xe4')](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');break;case _0x6b84('0xea'):_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?_0x4d99b6[_0x6b84('0x70')][_0x6b84('0xeb')]||_0x4d99b6['User']['fullname']:'System';break;case'agent_fullname':_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?_0x4d99b6[_0x6b84('0x70')][_0x6b84('0x34')]:_0x6b84('0xe7');break;default:_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?util['format'](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');}var _0x2e8d45=util[_0x6b84('0xe4')](_0x6b84('0xec'),moment(_0x4d99b6[_0x6b84('0x79')])[_0x6b84('0xe4')](_0x6b84('0xed')),_0x4d99b6['direction']==='in'?_0x5b8981:_0x2e127b,_0x4d99b6[_0x6b84('0xba')]);if(!_0x4d99b6['secret']){fs['appendFileSync'](_0x159b1e,_0x2e8d45);}}return db[_0x6b84('0xee')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6b84('0xef')],'as':_0x6b84('0xf0'),'raw':!![]}]});}}})['then'](function(_0x5b5bd7){if(_0x5b5bd7&&_0x5b5bd7[_0x6b84('0xf0')]&&_0x2ff772[_0x6b84('0xba')]){var _0x9067cd={'tls':{'rejectUnauthorized':![]}};if(_0x5b5bd7[_0x6b84('0xf0')]['service']){_0x9067cd[_0x6b84('0xf1')]=_0x5b5bd7['Smtp']['service'];}else{_0x9067cd[_0x6b84('0xf2')]=_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf2')];_0x9067cd[_0x6b84('0xf3')]=_0x5b5bd7[_0x6b84('0xf0')]['port'];_0x9067cd[_0x6b84('0xf4')]=_0x5b5bd7['Smtp']['secure'];}if(_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf5')]){_0x9067cd[_0x6b84('0xf6')]={'user':_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0x96')],'pass':_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf7')]};}return respondWithRpcPromise(_0x6b84('0xf8'),_0x6b84('0xf9'),{'account':_0x9067cd,'message':{'from':util['format'](_0x6b84('0xfa'),_0x5b5bd7[_0x6b84('0x30')],_0x5b5bd7['email']||_0x5b5bd7[_0x6b84('0xf0')]['user']),'to':_0x2ff772[_0x6b84('0xba')][_0x6b84('0xdd')],'subject':_0x6b84('0xfb'),'text':util[_0x6b84('0xe4')](_0x6b84('0xfc'),_0x2ff772['body'][_0x6b84('0xdd')]),'attachments':[{'path':_0x159b1e}]}})['then'](function(){return _0x2f59d1;})[_0x6b84('0x3a')](function(_0x3e2ef4){console[_0x6b84('0x22')](_0x3e2ef4);});}else{return _0x2f59d1;}})[_0x6b84('0x1c')](respondWithStatusCode(_0x46298d,0xc8))[_0x6b84('0x3a')](handleError(_0x46298d,null));};exports[_0x6b84('0xfd')]=function(_0x46b5ee,_0x11bfa1,_0x5cc307){return db[_0x6b84('0xc8')][_0x6b84('0x64')]({'where':{'id':_0x46b5ee[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x11bfa1,null))[_0x6b84('0x1c')](function(_0x521213){if(_0x521213){return _0x521213[_0x6b84('0xfd')](_0x46b5ee['body'][_0x6b84('0xfe')],_[_0x6b84('0xff')](_0x46b5ee[_0x6b84('0xba')],[_0x6b84('0xfe'),'id'])||{});}})[_0x6b84('0x1c')](respondWithResult(_0x11bfa1,null))['catch'](handleError(_0x11bfa1,null));};exports[_0x6b84('0x100')]=function(_0x279bf,_0x458734,_0x3d10e3){var _0x39b58d={'raw':![],'where':{}};var _0xf19321={};var _0x3185e4={'count':0x0,'rows':[]};return db[_0x6b84('0x3c')]['findOne']({'where':{'id':_0x279bf['params']['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x458734,null))[_0x6b84('0x1c')](function(_0x571eb0){if(_0x571eb0){_0xf19321[_0x6b84('0x41')]=_[_0x6b84('0x43')](db[_0x6b84('0xc8')][_0x6b84('0x3d')]);_0xf19321['query']=_[_0x6b84('0x43')](_0x279bf[_0x6b84('0x42')]);_0xf19321[_0x6b84('0x44')]=_['intersection'](_0xf19321[_0x6b84('0x41')],_0xf19321[_0x6b84('0x42')]);_0x39b58d[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0xf19321[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x279bf[_0x6b84('0x42')][_0x6b84('0x47')]));_0x39b58d[_0x6b84('0x45')]=_0x39b58d[_0x6b84('0x45')][_0x6b84('0x9e')]?_0x39b58d[_0x6b84('0x45')]:_0xf19321['model'];if(!_0x279bf[_0x6b84('0x42')][_0x6b84('0x48')]('nolimit')){_0x39b58d['limit']=qs['limit'](_0x279bf[_0x6b84('0x42')][_0x6b84('0x4a')]);_0x39b58d[_0x6b84('0x2a')]=qs['offset'](_0x279bf[_0x6b84('0x42')]['offset']);}_0x39b58d[_0x6b84('0x4b')]=qs[_0x6b84('0x4c')](_0x279bf[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x39b58d['where']=qs['filters'](_[_0x6b84('0x4e')](_0x279bf[_0x6b84('0x42')],_0xf19321[_0x6b84('0x44')]));_0x39b58d[_0x6b84('0x4d')][_0x6b84('0xb5')]=_0x571eb0['id'];if(_0x279bf[_0x6b84('0x42')][_0x6b84('0x84')]){_0x39b58d[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x39b58d[_0x6b84('0x4d')],{'$or':_[_0x6b84('0x33')](_0x39b58d[_0x6b84('0x45')],function(_0x5eb70f){var _0xd4e51a={};_0xd4e51a[_0x5eb70f]={'$like':'%'+_0x279bf[_0x6b84('0x42')]['filter']+'%'};return _0xd4e51a;})});}if(_0x279bf['query']['$gte']){var _0x2e4f2b=_0x279bf[_0x6b84('0x42')][_0x6b84('0x7b')][_0x6b84('0x37')](',');var _0x2307f7={};_0x2307f7[_0x2e4f2b[0x0]]={'$gte':moment(_0x2e4f2b[0x1])[_0x6b84('0xe4')](_0x6b84('0x101'))};_0x39b58d[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x39b58d[_0x6b84('0x4d')],_0x2307f7);}_0x39b58d=_['merge']({},_0x39b58d,_0x279bf[_0x6b84('0x102')]);return db[_0x6b84('0xc8')][_0x6b84('0x29')]({'where':_0x39b58d['where']})['then'](function(_0x5bca81){_0x3185e4['count']=_0x5bca81;if(_0x279bf[_0x6b84('0x42')]['includeAll']){_0x39b58d[_0x6b84('0x103')]=[{'all':!![]}];}return db[_0x6b84('0xc8')][_0x6b84('0x104')](_0x39b58d);})[_0x6b84('0x1c')](function(_0x139125){_0x3185e4['rows']=_0x139125;return _0x3185e4;});}})[_0x6b84('0x1c')](respondWithFilteredResult(_0x458734,_0x39b58d))[_0x6b84('0x3a')](handleError(_0x458734,null));};exports['getMyMessages']=function(_0x6bacf6,_0x578f7b,_0x5a6295){var _0x4e4d7f={'where':{}},_0x2d2cb9={},_0x4179d5={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x6bacf6['params']['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x578f7b,null))['then'](function(_0x47e197){if(_0x47e197){_0x2d2cb9['model']=_['keys'](db[_0x6b84('0xc8')]['rawAttributes']);_0x2d2cb9[_0x6b84('0x42')]=_[_0x6b84('0x43')](_0x6bacf6[_0x6b84('0x42')]);_0x2d2cb9[_0x6b84('0x44')]=_[_0x6b84('0x46')](_0x2d2cb9[_0x6b84('0x41')],_0x2d2cb9[_0x6b84('0x42')]);_0x4e4d7f[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0x2d2cb9[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x47')]));_0x4e4d7f[_0x6b84('0x45')]=_0x4e4d7f[_0x6b84('0x45')][_0x6b84('0x9e')]?_0x4e4d7f['attributes']:_0x2d2cb9[_0x6b84('0x41')];if(!_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x48')]('nolimit')){_0x4e4d7f['limit']=qs[_0x6b84('0x4a')](_0x6bacf6['query'][_0x6b84('0x4a')]);_0x4e4d7f['offset']=qs[_0x6b84('0x2a')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x2a')]);}_0x4e4d7f[_0x6b84('0x4b')]=qs[_0x6b84('0x4c')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x4e4d7f['where']=qs[_0x6b84('0x44')](_[_0x6b84('0x4e')](_0x6bacf6[_0x6b84('0x42')],_0x2d2cb9['filters']));_0x4e4d7f[_0x6b84('0x4d')][_0x6b84('0xb5')]=_0x47e197['id'];if(_0x6bacf6[_0x6b84('0x42')]['filter']){_0x4e4d7f[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x4e4d7f[_0x6b84('0x4d')],{'$or':_[_0x6b84('0x33')](_0x4e4d7f[_0x6b84('0x45')],function(_0xc8ebee){var _0x387f49={};_0x387f49[_0xc8ebee]={'$like':'%'+_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x84')]+'%'};return _0x387f49;})});}_0x4e4d7f['where'][_0x6b84('0x105')]=![];if(_0x6bacf6[_0x6b84('0x42')]['id']){_0x4e4d7f[_0x6b84('0x4d')]['id']={'$gt':_0x6bacf6[_0x6b84('0x42')]['id']};}_0x4e4d7f=_[_0x6b84('0xa0')]({},_0x4e4d7f,_0x6bacf6['options']);return db[_0x6b84('0xc8')][_0x6b84('0x29')]({'where':_0x4e4d7f[_0x6b84('0x4d')]})['then'](function(_0x3d5b2c){_0x4179d5[_0x6b84('0x29')]=_0x3d5b2c;_0x4e4d7f[_0x6b84('0x103')]=[];if(_0x6bacf6['query'][_0x6b84('0x106')]){_0x4e4d7f[_0x6b84('0x103')][_0x6b84('0x39')]({'model':db[_0x6b84('0x70')],'as':_0x6b84('0x70'),'attributes':['id',_0x6b84('0x34'),'alias']});}if(_0x6bacf6[_0x6b84('0x42')]['includeAll']){_0x4e4d7f[_0x6b84('0x103')]=[{'all':!![]}];}return db[_0x6b84('0xc8')][_0x6b84('0x104')](_0x4e4d7f);})[_0x6b84('0x1c')](function(_0x1178dc){_0x4179d5[_0x6b84('0xb6')]=_0x1178dc;return _0x4179d5;});}})[_0x6b84('0x1c')](respondWithFilteredResult(_0x578f7b,_0x4e4d7f))['catch'](handleError(_0x578f7b,null));};exports['addTags']=function(_0x236898,_0x5739ce,_0x398ad1){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x236898[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x5739ce,null))[_0x6b84('0x1c')](function(_0x1191c5){if(_0x1191c5){return _0x1191c5[_0x6b84('0x107')](_0x236898[_0x6b84('0xba')]['ids'],_[_0x6b84('0xff')](_0x236898['body'],[_0x6b84('0xfe'),'id'])||{})[_0x6b84('0x108')](function(){return db['Tag']['findAll']({'attributes':['id',_0x6b84('0x30'),_0x6b84('0x50')],'where':{'id':_0x236898[_0x6b84('0xba')][_0x6b84('0xfe')]}});})[_0x6b84('0x1c')](function(_0x23858d){socket[_0x6b84('0x109')]('chatInteractionTags:save',{'id':Number(_0x236898[_0x6b84('0xb8')]['id']),'tags':_0x23858d||[]});return{'id':Number(_0x236898['params']['id']),'tags':_0x23858d||[]};});}})[_0x6b84('0x1c')](respondWithResult(_0x5739ce,null))['catch'](handleError(_0x5739ce,null));};exports['removeTags']=function(_0x1fd1f6,_0x113b93,_0xb497f5){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x1fd1f6[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x113b93,null))['then'](function(_0x29c90){if(_0x29c90){return _0x29c90[_0x6b84('0x10a')](_0x1fd1f6[_0x6b84('0x42')][_0x6b84('0xfe')]);}})[_0x6b84('0x1c')](respondWithStatusCode(_0x113b93,null))[_0x6b84('0x3a')](handleError(_0x113b93,null));};exports[_0x6b84('0x10b')]=function(_0x1c681b,_0x545e8d){var _0x3206d3=moment()[_0x6b84('0x10c')]()[_0x6b84('0x9d')]();var _0x4c0073=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),'files',_0x6b84('0x10e'));var _0x140cbc=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),'files',_0x6b84('0x10f'));var _0x313403=path[_0x6b84('0xd9')](_0x4c0073,_0x3206d3);var _0x46d5c4=util[_0x6b84('0xe4')](_0x6b84('0x110'),_0x1c681b['params']['id'],_0x3206d3);var _0x37c3af=path['join'](_0x4c0073,_0x46d5c4);var _0x1a8800=[];_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0xe2')],'as':_0x6b84('0x111'),'attributes':['id',_0x6b84('0x112'),'lastName'],'raw':!![]});if(_0x1c681b[_0x6b84('0x42')][_0x6b84('0x10f')]){_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0xd7')],'as':_0x6b84('0xd7'),'raw':!![]});}var _0x2cfbb5=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x6b84('0xba'),_0x6b84('0x79'),_0x6b84('0x113'),_0x6b84('0x105'),_0x6b84('0x80')],'include':_0x1a8800}];_0x2cfbb5[_0x6b84('0x39')]({'model':db[_0x6b84('0x114')],'as':_0x6b84('0x115'),'attributes':['id',_0x6b84('0x30')]});_0x2cfbb5['push']({'model':db[_0x6b84('0x70')],'as':'Owner','attributes':['id',_0x6b84('0x34')]});return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x1c681b[_0x6b84('0xb8')]['id']},'include':_0x2cfbb5})[_0x6b84('0x1c')](handleEntityNotFound(_0x545e8d,null))[_0x6b84('0x1c')](function(_0x352f4a){if(_0x352f4a){var _0x4cdcbe=_0x352f4a[_0x6b84('0x116')]({'plain':!![]});fs[_0x6b84('0x117')](_0x313403);var _0x448088={'format':'A4','border':_0x6b84('0x118'),'header':{'height':_0x6b84('0x119'),'contents':{'first':_0x6b84('0x11a')}},'footer':{'height':_0x6b84('0x11b'),'contents':{'default':util[_0x6b84('0xe4')](_0x6b84('0x11c'),util['format']('%s\x20#%d',_0x6b84('0x11d'),_0x4cdcbe['id']),moment()[_0x6b84('0xe4')]('YYYY-MM-DD')['toString']())}}};var _0x6aa63c={'channel':_0x6b84('0x11d'),'account':_0x4cdcbe[_0x6b84('0x115')]['name'],'agent':_0x4cdcbe[_0x6b84('0x11e')]?_0x4cdcbe[_0x6b84('0x11e')][_0x6b84('0x34')]:_0x6b84('0x11f'),'createdAt':moment(_0x4cdcbe[_0x6b84('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6b84('0x9d')](),'closedAt':_0x4cdcbe[_0x6b84('0xd6')]?moment(_0x4cdcbe[_0x6b84('0x120')])[_0x6b84('0xe4')](_0x6b84('0x101'))[_0x6b84('0x9d')]():'','disposition':_0x4cdcbe[_0x6b84('0xce')],'chatInfo':{'browser':_0x4cdcbe[_0x6b84('0x121')],'os':_0x4cdcbe[_0x6b84('0x122')],'referer':_0x4cdcbe['referer'],'customerIp':_0x4cdcbe[_0x6b84('0x123')],'customerPort':_0x4cdcbe[_0x6b84('0x124')]?_0x4cdcbe[_0x6b84('0x124')]:_0x6b84('0x11f')},'messages':_(_0x4cdcbe[_0x6b84('0xe1')])[_0x6b84('0x125')]()[_0x6b84('0x84')]({'secret':![]})[_0x6b84('0x33')](function(_0x4d6f83){if(_0x4d6f83[_0x6b84('0xd7')]){var _0x4335a4=path[_0x6b84('0xd9')](_0x140cbc,_0x4d6f83[_0x6b84('0xd7')][_0x6b84('0xd2')]);if(fs[_0x6b84('0x126')](_0x4335a4)){fs[_0x6b84('0x127')](_0x4335a4)['pipe'](fs[_0x6b84('0x128')](path[_0x6b84('0xd9')](_0x313403,_0x4d6f83['Attachment'][_0x6b84('0xd2')])));}}return{'date':moment(_0x4d6f83['createdAt'])[_0x6b84('0xe4')](_0x6b84('0x101'))['toString'](),'sender':_0x4d6f83[_0x6b84('0x113')]==='out'?_0x4d6f83[_0x6b84('0x70')]?_0x4d6f83['User'][_0x6b84('0x34')]:'System':_0x4d6f83[_0x6b84('0x111')][_0x6b84('0x112')]+(_0x4d6f83[_0x6b84('0x111')]['lastName']?'\x20'+_0x4d6f83[_0x6b84('0x111')][_0x6b84('0x129')]:''),'body':_0x4d6f83[_0x6b84('0xd7')]?_0x4d6f83[_0x6b84('0xd7')]['basename']:_0x4d6f83[_0x6b84('0xba')],'direction':_0x4d6f83[_0x6b84('0x113')]===_0x6b84('0xc7')?'A':'C','secret':_0x4d6f83['secret'],'read':_0x4d6f83[_0x6b84('0x80')],'attachment':_0x4d6f83[_0x6b84('0xd7')]};})[_0x6b84('0x66')]()};return ejs[_0x6b84('0x12a')](path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),_0x6b84('0x12b'),_0x6b84('0x12c')),{'interaction':_0x6aa63c})[_0x6b84('0x1c')](function(_0x57aab3){return new BPromise(function(_0x435c8e,_0x1a9889){pdf['create'](_0x57aab3,_0x448088)[_0x6b84('0x12d')](path[_0x6b84('0xd9')](_0x313403,_0x6b84('0x12e')+_0x4cdcbe['id']+'-'+_0x3206d3+_0x6b84('0x12f')),function(_0x50036d,_0x159c6c){if(_0x50036d)return _0x1a9889(_0x50036d);_0x435c8e(_0x159c6c);});});})[_0x6b84('0x1c')](function(){return new BPromise(function(_0x10f78b,_0x148e36){zipdir(_0x313403,{'saveTo':_0x37c3af},function(_0x203275,_0x875dfd){if(_0x203275)return _0x148e36(_0x203275);return _0x10f78b(_0x875dfd);});})[_0x6b84('0x1c')](function(){return new BPromise(function(_0x26f8ba,_0x4efeea){rimraf(_0x313403,function(_0x1daa23){if(_0x1daa23)_0x4efeea(_0x1daa23);return _0x26f8ba();});});})['then'](function(){return _0x545e8d[_0x6b84('0x10b')](_0x37c3af,_0x46d5c4,function(_0x394e40){if(_0x394e40){console['log'](_0x6b84('0x130'),_0x394e40);}else{fs[_0x6b84('0x131')](_0x37c3af);}});});});}else{return _0x545e8d[_0x6b84('0x2e')](0xc8);}})[_0x6b84('0x3a')](handleError(_0x545e8d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0cc905d..1cc5adc 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 _0xdce9=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x1fcf30,_0x221e1b){var _0x3c7c3d=function(_0x2bcc14){while(--_0x2bcc14){_0x1fcf30['push'](_0x1fcf30['shift']());}};_0x3c7c3d(++_0x221e1b);}(_0xdce9,0x1e5));var _0x9dce=function(_0x308a14,_0xab44bf){_0x308a14=_0x308a14-0x0;var _0x46c3a4=_0xdce9[_0x308a14];return _0x46c3a4;};'use strict';var EventEmitter=require(_0x9dce('0x0'));var ChatInteraction=require(_0x9dce('0x1'))['db'][_0x9dce('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x9dce('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9dce('0x4')](0x0);var events={'afterCreate':_0x9dce('0x5'),'afterUpdate':_0x9dce('0x6'),'afterDestroy':_0x9dce('0x7')};function emitEvent(_0x1ed2dd){return function(_0x423d37,_0x58b009,_0x1dde23){_0x423d37['getUsers']({'attributes':['id'],'raw':!![]})[_0x9dce('0x8')](function(_0x2e79ee){_0x423d37[_0x9dce('0x9')](_0x9dce('0xa'),_0x2e79ee[_0x9dce('0xb')](function(_0x6747b0){return{'id':_0x6747b0['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x423d37['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dce('0x8')](function(_0x303d46){_0x423d37['setDataValue'](_0x9dce('0xc'),_0x303d46[_0x9dce('0xd')]);ChatInteractionEvents[_0x9dce('0xe')](_0x1ed2dd+':'+_0x423d37['id'],_0x423d37);ChatInteractionEvents[_0x9dce('0xe')](_0x1ed2dd,_0x423d37);_0x1dde23(null);})['catch'](_0x1dde23(null));};}for(var e in events){if(events[_0x9dce('0xf')](e)){var event=events[e];ChatInteraction[_0x9dce('0x10')](e,emitEvent(event));}}module[_0x9dce('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xdbb9=['Users','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','setDataValue'];(function(_0x22e4ee,_0x57e857){var _0x281efb=function(_0x4f7475){while(--_0x4f7475){_0x22e4ee['push'](_0x22e4ee['shift']());}};_0x281efb(++_0x57e857);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x551d08,_0x60e772){_0x551d08=_0x551d08-0x0;var _0x785c8=_0xdbb9[_0x551d08];return _0x785c8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x9dbb('0x0'))['db'][_0x9dbb('0x1')];var ChatMessage=require(_0x9dbb('0x0'))['db'][_0x9dbb('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9dbb('0x3'),'afterUpdate':_0x9dbb('0x4'),'afterDestroy':_0x9dbb('0x5')};function emitEvent(_0x3b4460){return function(_0xb960a5,_0x398f78,_0x4c7cb2){_0xb960a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x28c5c0){_0xb960a5[_0x9dbb('0x6')](_0x9dbb('0x7'),_0x28c5c0['map'](function(_0x59b2fc){return{'id':_0x59b2fc['id']};}));return ChatMessage[_0x9dbb('0x8')]({'where':{'ChatInteractionId':_0xb960a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dbb('0x9')](function(_0x37f00d){_0xb960a5['setDataValue'](_0x9dbb('0xa'),_0x37f00d[_0x9dbb('0xb')]);ChatInteractionEvents[_0x9dbb('0xc')](_0x3b4460+':'+_0xb960a5['id'],_0xb960a5);ChatInteractionEvents[_0x9dbb('0xc')](_0x3b4460,_0xb960a5);_0x4c7cb2(null);})['catch'](_0x4c7cb2(null));};}for(var e in events){if(events[_0x9dbb('0xd')](e)){var event=events[e];ChatInteraction[_0x9dbb('0xe')](e,emitEvent(event));}}module[_0x9dbb('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9a1606a..8560c6b 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 _0xb780=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xb780,0x1b5));var _0x0b78=function(_0x529fa3,_0x507a9c){_0x529fa3=_0x529fa3-0x0;var _0x42f497=_0xb780[_0x529fa3];return _0x42f497;};'use strict';var _=require(_0x0b78('0x0'));var util=require('util');var logger=require(_0x0b78('0x1'))(_0x0b78('0x2'));var moment=require(_0x0b78('0x3'));var BPromise=require(_0x0b78('0x4'));var rp=require(_0x0b78('0x5'));var fs=require('fs');var path=require(_0x0b78('0x6'));var rimraf=require(_0x0b78('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b78('0x8'));module['exports']=function(_0x8b75a3,_0x46e6c7){return _0x8b75a3[_0x0b78('0x9')](_0x0b78('0xa'),attributes,{'tableName':_0x0b78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a2264,_0x298485,_0x5e321b){if(_0x1a2264[_0x0b78('0xc')](_0x0b78('0xd'))){_0x1a2264[_0x0b78('0xe')]=moment()[_0x0b78('0xf')](_0x0b78('0x10'));}_0x5e321b(null,_0x1a2264);}},'charset':'utf8mb4','collate':_0x0b78('0x11')});}; \ No newline at end of file +var _0x9086=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4'];(function(_0x11d0f3,_0x345358){var _0xd2c64=function(_0x3551fe){while(--_0x3551fe){_0x11d0f3['push'](_0x11d0f3['shift']());}};_0xd2c64(++_0x345358);}(_0x9086,0x1cb));var _0x6908=function(_0xdb255f,_0x3e9f0d){_0xdb255f=_0xdb255f-0x0;var _0x922e3c=_0x9086[_0xdb255f];return _0x922e3c;};'use strict';var _=require(_0x6908('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6908('0x1'));var moment=require(_0x6908('0x2'));var BPromise=require(_0x6908('0x3'));var rp=require(_0x6908('0x4'));var fs=require('fs');var path=require(_0x6908('0x5'));var rimraf=require(_0x6908('0x6'));var config=require(_0x6908('0x7'));var attributes=require(_0x6908('0x8'));module[_0x6908('0x9')]=function(_0x39440a,_0x3c6609){return _0x39440a[_0x6908('0xa')]('ChatInteraction',attributes,{'tableName':_0x6908('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x572f94,_0x124915,_0x28e0b8){if(_0x572f94[_0x6908('0xc')](_0x6908('0xd'))){_0x572f94[_0x6908('0xe')]=moment()[_0x6908('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x28e0b8(null,_0x572f94);}},'charset':_0x6908('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5bf0ec5..32956ba 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 _0x425c=['ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','debug','AddTagsToChatInteraction','addTags','omit','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0x425c,0x1ed));var _0xc425=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x425c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xc425('0x0'));var util=require(_0xc425('0x1'));var moment=require(_0xc425('0x2'));var BPromise=require(_0xc425('0x3'));var rs=require(_0xc425('0x4'));var fs=require('fs');var Redis=require(_0xc425('0x5'));var db=require(_0xc425('0x6'))['db'];var utils=require(_0xc425('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc425('0x8'));var jayson=require(_0xc425('0x9'));var client=jayson[_0xc425('0xa')][_0xc425('0xb')]({'port':0x232a});config[_0xc425('0xc')]=_[_0xc425('0xd')](config['redis'],{'host':_0xc425('0xe'),'port':0x18eb});var socket=require(_0xc425('0xf'))(new Redis(config[_0xc425('0xc')]));require(_0xc425('0x10'))[_0xc425('0x11')](socket);function respondWithRpcPromise(_0x51540c,_0x235077,_0x3fd493){return new BPromise(function(_0x873831,_0x50e353){return client['request'](_0x51540c,_0x3fd493)[_0xc425('0x12')](function(_0x8c6da7){logger[_0xc425('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x235077,_0xc425('0x14'));logger['debug'](_0xc425('0x15'),_0x235077,_0xc425('0x14'),JSON['stringify'](_0x8c6da7));if(_0x8c6da7['error']){if(_0x8c6da7[_0xc425('0x16')]['code']===0x1f4){logger[_0xc425('0x16')](_0xc425('0x17'),_0x235077,_0x8c6da7['error']['message']);return _0x50e353(_0x8c6da7[_0xc425('0x16')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x235077,_0x8c6da7[_0xc425('0x16')][_0xc425('0x18')]);return _0x873831(_0x8c6da7[_0xc425('0x16')][_0xc425('0x18')]);}else{logger[_0xc425('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x235077,_0xc425('0x14'));_0x873831(_0x8c6da7[_0xc425('0x19')]['message']);}})[_0xc425('0x1a')](function(_0x53738c){logger[_0xc425('0x16')](_0xc425('0x17'),_0x235077,_0x53738c);_0x50e353(_0x53738c);});});}exports['UpdateChatInteraction']=function(_0x30724f){var _0x112120=this;return new Promise(function(_0x4c3c09,_0x360234){return db['ChatInteraction'][_0xc425('0x1b')](_0x30724f[_0xc425('0x1c')],{'raw':_0x30724f[_0xc425('0x1d')]?_0x30724f[_0xc425('0x1d')][_0xc425('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30724f[_0xc425('0x1d')]?_0x30724f['options'][_0xc425('0x1f')]||null:null,'attributes':_0x30724f['options']?_0x30724f[_0xc425('0x1d')][_0xc425('0x20')]||null:null,'limit':_0x30724f['options']?_0x30724f[_0xc425('0x1d')][_0xc425('0x21')]||null:null})['then'](function(_0xf11511){logger[_0xc425('0x13')](_0xc425('0x22'),_0x30724f);logger[_0xc425('0x23')](_0xc425('0x22'),_0x30724f,JSON['stringify'](_0xf11511));_0x4c3c09(_0xf11511);})[_0xc425('0x1a')](function(_0x339129){logger[_0xc425('0x16')](_0xc425('0x22'),_0x339129[_0xc425('0x18')],_0x30724f);_0x360234(_0x112120[_0xc425('0x16')](0x1f4,_0x339129[_0xc425('0x18')]));});});};exports[_0xc425('0x24')]=function(_0xd19ccc){return new Promise(function(_0x2153ee,_0x4c8e12){return db['ChatInteraction']['find']({'where':_0xd19ccc[_0xc425('0x1d')]?_0xd19ccc['options']['where']||null:null})[_0xc425('0x12')](function(_0x1d2423){if(_0x1d2423){return _0x1d2423[_0xc425('0x25')](_0xd19ccc[_0xc425('0x1c')]['ids'],_[_0xc425('0x26')](_0xd19ccc[_0xc425('0x1c')],[_0xc425('0x27'),'id'])||{});}})[_0xc425('0x28')](function(_0x5b3364){logger[_0xc425('0x13')]('AddTags',_0xd19ccc);logger[_0xc425('0x23')](_0xc425('0x29'),_0xd19ccc,JSON[_0xc425('0x2a')](_0x5b3364));_0x2153ee(_0x5b3364);})[_0xc425('0x1a')](function(_0x4ad857){logger[_0xc425('0x16')](_0xc425('0x29'),_0x4ad857[_0xc425('0x18')],_0xd19ccc);_0x4c8e12(_this[_0xc425('0x16')](0x1f4,_0x4ad857[_0xc425('0x18')]));});});}; \ No newline at end of file +var _0xa913=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','options','raw','where','attributes','limit','ChatInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird'];(function(_0x3087eb,_0x20f88f){var _0x557eea=function(_0x3528af){while(--_0x3528af){_0x3087eb['push'](_0x3087eb['shift']());}};_0x557eea(++_0x20f88f);}(_0xa913,0x72));var _0x3a91=function(_0x5269f8,_0x327626){_0x5269f8=_0x5269f8-0x0;var _0x15e61b=_0xa913[_0x5269f8];return _0x15e61b;};'use strict';var _=require(_0x3a91('0x0'));var util=require('util');var moment=require(_0x3a91('0x1'));var BPromise=require(_0x3a91('0x2'));var rs=require(_0x3a91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a91('0x4'));var logger=require('../../config/logger')(_0x3a91('0x5'));var config=require(_0x3a91('0x6'));var jayson=require(_0x3a91('0x7'));var client=jayson['client'][_0x3a91('0x8')]({'port':0x232a});config[_0x3a91('0x9')]=_[_0x3a91('0xa')](config[_0x3a91('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a91('0xb'))(new Redis(config[_0x3a91('0x9')]));require(_0x3a91('0xc'))[_0x3a91('0xd')](socket);function respondWithRpcPromise(_0x2b924c,_0x1db748,_0x162f6f){return new BPromise(function(_0x1a4a5c,_0xf251aa){return client[_0x3a91('0xe')](_0x2b924c,_0x162f6f)[_0x3a91('0xf')](function(_0x32e9f6){logger[_0x3a91('0x10')](_0x3a91('0x11'),_0x1db748,_0x3a91('0x12'));logger[_0x3a91('0x13')](_0x3a91('0x14'),_0x1db748,_0x3a91('0x12'),JSON[_0x3a91('0x15')](_0x32e9f6));if(_0x32e9f6[_0x3a91('0x16')]){if(_0x32e9f6[_0x3a91('0x16')]['code']===0x1f4){logger[_0x3a91('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x1db748,_0x32e9f6[_0x3a91('0x16')]['message']);return _0xf251aa(_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);}logger['error'](_0x3a91('0x11'),_0x1db748,_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);return _0x1a4a5c(_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);}else{logger['info'](_0x3a91('0x11'),_0x1db748,_0x3a91('0x12'));_0x1a4a5c(_0x32e9f6[_0x3a91('0x18')][_0x3a91('0x17')]);}})[_0x3a91('0x19')](function(_0x28bf85){logger[_0x3a91('0x16')](_0x3a91('0x11'),_0x1db748,_0x28bf85);_0xf251aa(_0x28bf85);});});}exports[_0x3a91('0x1a')]=function(_0x384fc2){var _0xb58f2f=this;return new Promise(function(_0x4004b1,_0x522cf2){return db['ChatInteraction']['update'](_0x384fc2['body'],{'raw':_0x384fc2[_0x3a91('0x1b')]?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384fc2[_0x3a91('0x1b')]?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1d')]||null:null,'attributes':_0x384fc2['options']?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1e')]||null:null,'limit':_0x384fc2['options']?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1f')]||null:null})[_0x3a91('0xf')](function(_0x25b088){logger['info'](_0x3a91('0x1a'),_0x384fc2);logger[_0x3a91('0x13')](_0x3a91('0x1a'),_0x384fc2,JSON[_0x3a91('0x15')](_0x25b088));_0x4004b1(_0x25b088);})[_0x3a91('0x19')](function(_0x5ba55f){logger[_0x3a91('0x16')](_0x3a91('0x1a'),_0x5ba55f[_0x3a91('0x17')],_0x384fc2);_0x522cf2(_0xb58f2f[_0x3a91('0x16')](0x1f4,_0x5ba55f['message']));});});};exports['AddTagsToChatInteraction']=function(_0x58dec0){return new Promise(function(_0xaca27b,_0x2f8a43){return db[_0x3a91('0x20')][_0x3a91('0x21')]({'where':_0x58dec0[_0x3a91('0x1b')]?_0x58dec0[_0x3a91('0x1b')][_0x3a91('0x1d')]||null:null})[_0x3a91('0xf')](function(_0x130a01){if(_0x130a01){return _0x130a01[_0x3a91('0x22')](_0x58dec0[_0x3a91('0x23')][_0x3a91('0x24')],_[_0x3a91('0x25')](_0x58dec0[_0x3a91('0x23')],[_0x3a91('0x24'),'id'])||{});}})['spread'](function(_0x28e515){logger[_0x3a91('0x10')](_0x3a91('0x26'),_0x58dec0);logger['debug'](_0x3a91('0x26'),_0x58dec0,JSON['stringify'](_0x28e515));_0xaca27b(_0x28e515);})[_0x3a91('0x19')](function(_0x504e7c){logger[_0x3a91('0x16')](_0x3a91('0x26'),_0x504e7c[_0x3a91('0x17')],_0x58dec0);_0x2f8a43(_this[_0x3a91('0x16')](0x1f4,_0x504e7c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 44c565d..4f171a2 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 _0x7243=['emit','register','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x41923f,_0x1fe455){var _0x5022dc=function(_0x2051c3){while(--_0x2051c3){_0x41923f['push'](_0x41923f['shift']());}};_0x5022dc(++_0x1fe455);}(_0x7243,0xba));var _0x3724=function(_0x3647d8,_0x1d1c2f){_0x3647d8=_0x3647d8-0x0;var _0x1b9d0b=_0x7243[_0x3647d8];return _0x1b9d0b;};'use strict';var ChatInteractionEvents=require(_0x3724('0x0'));var events=[_0x3724('0x1'),'remove',_0x3724('0x2')];function createListener(_0x269798,_0x507e6b){return function(_0x182613){_0x507e6b[_0x3724('0x3')](_0x269798,_0x182613);};}function removeListener(_0x3714ae,_0x3897be){return function(){ChatInteractionEvents['removeListener'](_0x3714ae,_0x3897be);};}exports[_0x3724('0x4')]=function(_0x14927f){for(var _0x1c2f49=0x0,_0x3ad51=events[_0x3724('0x5')];_0x1c2f49<_0x3ad51;_0x1c2f49++){var _0x1d86bc=events[_0x1c2f49];var _0x537a5e=createListener(_0x3724('0x6')+_0x1d86bc,_0x14927f);ChatInteractionEvents['on'](_0x1d86bc,_0x537a5e);}}; \ No newline at end of file +var _0x9d38=['chatInteraction:','./chatInteraction.events','save','emit'];(function(_0x362b05,_0x1d95fb){var _0x39ab83=function(_0x3f9d64){while(--_0x3f9d64){_0x362b05['push'](_0x362b05['shift']());}};_0x39ab83(++_0x1d95fb);}(_0x9d38,0xe5));var _0x89d3=function(_0x25ebfe,_0x1394eb){_0x25ebfe=_0x25ebfe-0x0;var _0x1ca13f=_0x9d38[_0x25ebfe];return _0x1ca13f;};'use strict';var ChatInteractionEvents=require(_0x89d3('0x0'));var events=[_0x89d3('0x1'),'remove','update'];function createListener(_0x13cb78,_0x5a892b){return function(_0x2df9cc){_0x5a892b[_0x89d3('0x2')](_0x13cb78,_0x2df9cc);};}function removeListener(_0x10f541,_0x2ee6d0){return function(){ChatInteractionEvents['removeListener'](_0x10f541,_0x2ee6d0);};}exports['register']=function(_0x5e422){for(var _0x3a244c=0x0,_0x5edcf7=events['length'];_0x3a244c<_0x5edcf7;_0x3a244c++){var _0x5ae980=events[_0x3a244c];var _0x142415=createListener(_0x89d3('0x3')+_0x5ae980,_0x5e422);ChatInteractionEvents['on'](_0x5ae980,_0x142415);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 31b4801..2e2e0c4 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 _0x3752=['chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','close','delete','chat'];(function(_0x4e12a2,_0x4afb09){var _0x3a1d3b=function(_0x2855d3){while(--_0x2855d3){_0x4e12a2['push'](_0x4e12a2['shift']());}};_0x3a1d3b(++_0x4afb09);}(_0x3752,0x112));var _0x2375=function(_0xb4bdb3,_0x48dca0){_0xb4bdb3=_0xb4bdb3-0x0;var _0x4c8c02=_0x3752[_0xb4bdb3];return _0x4c8c02;};'use strict';var multer=require('multer');var util=require(_0x2375('0x0'));var path=require(_0x2375('0x1'));var timeout=require(_0x2375('0x2'));var express=require(_0x2375('0x3'));var router=express[_0x2375('0x4')]();var auth=require(_0x2375('0x5'));var interaction=require(_0x2375('0x6'));var config=require(_0x2375('0x7'));var controller=require(_0x2375('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2375('0x9')]);router[_0x2375('0xa')](_0x2375('0xb'),auth[_0x2375('0xc')](),controller[_0x2375('0xd')]);router[_0x2375('0xa')](_0x2375('0xe'),auth[_0x2375('0xf')](),controller[_0x2375('0x10')]);router['get'](_0x2375('0x11'),auth[_0x2375('0xf')](),controller['attachmentDownload']);router['get'](_0x2375('0x12'),auth['isAuthenticated'](),controller[_0x2375('0x13')]);router[_0x2375('0xa')](_0x2375('0x14'),auth[_0x2375('0xf')](),controller['getMyMessages']);router['get'](_0x2375('0x15'),auth[_0x2375('0xc')](),controller[_0x2375('0x16')]);router[_0x2375('0x17')]('/',auth[_0x2375('0xc')](),controller[_0x2375('0x18')]);router[_0x2375('0x17')](_0x2375('0x19'),auth[_0x2375('0xc')](),controller[_0x2375('0x1a')]);var upload=multer({'storage':multer[_0x2375('0x1b')]({'destination':function(_0x4a7157,_0x3a91a6,_0x2650a7){_0x2650a7(null,path[_0x2375('0x1c')](config[_0x2375('0x1d')],_0x2375('0x1e')));},'filename':function(_0x17ba24,_0x8a2ede,_0x1c5762){_0x1c5762(null,util[_0x2375('0x1f')](_0x2375('0x20'),Date[_0x2375('0x21')](),_0x8a2ede[_0x2375('0x22')][_0x2375('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2375('0x17')](_0x2375('0x24'),upload[_0x2375('0x25')]('file'),controller[_0x2375('0x26')]);router[_0x2375('0x17')](_0x2375('0x12'),auth[_0x2375('0xf')](),controller['addMessage']);router[_0x2375('0x17')]('/:id/tags',auth[_0x2375('0xc')](),interaction[_0x2375('0x27')]('chat',_0x2375('0x28')),controller[_0x2375('0x29')]);router[_0x2375('0x2a')](_0x2375('0xe'),auth[_0x2375('0xc')](),interaction[_0x2375('0x27')]('chat','chatinteraction:update'),controller[_0x2375('0x2b')]);router['put'](_0x2375('0x2c'),controller[_0x2375('0x2d')]);router[_0x2375('0x2a')](_0x2375('0x2e'),auth[_0x2375('0xf')](),controller['abandon']);router[_0x2375('0x2a')]('/:id/close',controller[_0x2375('0x2f')]);router[_0x2375('0x30')](_0x2375('0xe'),auth[_0x2375('0xc')](),interaction[_0x2375('0x27')](_0x2375('0x31'),_0x2375('0x32')),controller[_0x2375('0x33')]);router['delete']('/:id/tags',auth[_0x2375('0xc')](),controller[_0x2375('0x34')]);module[_0x2375('0x35')]=router; \ No newline at end of file +var _0x8535=['destroy','removeTags','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chat','chatinteraction:destroy'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x8535,0x19b));var _0x5853=function(_0x4a5796,_0x19838a){_0x4a5796=_0x4a5796-0x0;var _0x2d7379=_0x8535[_0x4a5796];return _0x2d7379;};'use strict';var multer=require('multer');var util=require(_0x5853('0x0'));var path=require(_0x5853('0x1'));var timeout=require('connect-timeout');var express=require(_0x5853('0x2'));var router=express['Router']();var auth=require(_0x5853('0x3'));var interaction=require(_0x5853('0x4'));var config=require(_0x5853('0x5'));var controller=require(_0x5853('0x6'));router[_0x5853('0x7')]('/',auth['isAuthenticated'](),controller[_0x5853('0x8')]);router[_0x5853('0x7')](_0x5853('0x9'),auth[_0x5853('0xa')](),controller[_0x5853('0xb')]);router[_0x5853('0x7')](_0x5853('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x5853('0xd')]);router['get']('/:id/attachment_download',auth[_0x5853('0xe')](),controller[_0x5853('0xf')]);router[_0x5853('0x7')](_0x5853('0x10'),auth[_0x5853('0xa')](),controller['getMessages']);router[_0x5853('0x7')](_0x5853('0x11'),auth[_0x5853('0xe')](),controller[_0x5853('0x12')]);router[_0x5853('0x7')](_0x5853('0x13'),auth[_0x5853('0xa')](),controller[_0x5853('0x14')]);router[_0x5853('0x15')]('/',auth[_0x5853('0xa')](),controller['create']);router[_0x5853('0x15')](_0x5853('0x16'),auth[_0x5853('0xa')](),controller[_0x5853('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f89b9,_0x47c269,_0xb3472a){_0xb3472a(null,path[_0x5853('0x18')](config[_0x5853('0x19')],_0x5853('0x1a')));},'filename':function(_0x4c290a,_0x1a504b,_0x2ab340){_0x2ab340(null,util['format'](_0x5853('0x1b'),Date[_0x5853('0x1c')](),_0x1a504b['originalname'][_0x5853('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5853('0x1e'),upload[_0x5853('0x1f')](_0x5853('0x20')),controller['attachmentUpload']);router['post'](_0x5853('0x10'),auth[_0x5853('0xe')](),controller[_0x5853('0x21')]);router[_0x5853('0x15')](_0x5853('0x22'),auth[_0x5853('0xa')](),interaction[_0x5853('0x23')]('chat','chatinteraction:addtags'),controller[_0x5853('0x24')]);router[_0x5853('0x25')]('/:id',auth[_0x5853('0xa')](),interaction[_0x5853('0x23')]('chat',_0x5853('0x26')),controller[_0x5853('0x27')]);router[_0x5853('0x25')](_0x5853('0x28'),controller[_0x5853('0x29')]);router[_0x5853('0x25')](_0x5853('0x2a'),auth[_0x5853('0xe')](),controller[_0x5853('0x2b')]);router[_0x5853('0x25')](_0x5853('0x2c'),controller['close']);router[_0x5853('0x2d')]('/:id',auth[_0x5853('0xa')](),interaction['tracked'](_0x5853('0x2e'),_0x5853('0x2f')),controller[_0x5853('0x30')]);router['delete'](_0x5853('0x22'),auth[_0x5853('0xa')](),controller[_0x5853('0x31')]);module[_0x5853('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1c0ef25..a5855e4 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x2eee05,_0x2ba3f7){var _0x2aa6a8=function(_0x279144){while(--_0x279144){_0x2eee05['push'](_0x2eee05['shift']());}};_0x2aa6a8(++_0x2ba3f7);}(_0x57ca,0x108));var _0xa57c=function(_0x185934,_0x36c5e2){_0x185934=_0x185934-0x0;var _0x23daa9=_0x57ca[_0x185934];return _0x23daa9;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x0295=['sequelize','medium'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0295,0x1f0));var _0x5029=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0x0295[_0x1ef726];return _0x4c3c66;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 239166a..541a4a5 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 _0x19d0=['-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar'];(function(_0x581041,_0x2fdcec){var _0xc686b9=function(_0xafdda1){while(--_0xafdda1){_0x581041['push'](_0x581041['shift']());}};_0xc686b9(++_0x2fdcec);}(_0x19d0,0xe5));var _0x019d=function(_0x269667,_0x485d5f){_0x269667=_0x269667-0x0;var _0xf5d9fd=_0x19d0[_0x269667];return _0xf5d9fd;};'use strict';var pdf=require(_0x019d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x019d('0x1'));var BPromise=require(_0x019d('0x2'));var Mustache=require(_0x019d('0x3'));var util=require(_0x019d('0x4'));var path=require(_0x019d('0x5'));var sox=require(_0x019d('0x6'));var csv=require('to-csv');var ejs=require(_0x019d('0x7'));var fs=require('fs');var _=require(_0x019d('0x8'));var squel=require(_0x019d('0x9'));var crypto=require('crypto');var jsforce=require(_0x019d('0xa'));var deskjs=require(_0x019d('0xb'));var toCsv=require(_0x019d('0xc'));var querystring=require('querystring');var Papa=require(_0x019d('0xd'));var Redis=require(_0x019d('0xe'));var authService=require(_0x019d('0xf'));var qs=require(_0x019d('0x10'));var as=require(_0x019d('0x11'));var hardwareService=require(_0x019d('0x12'));var logger=require(_0x019d('0x13'))('api');var utils=require(_0x019d('0x14'));var config=require(_0x019d('0x15'));var licenseUtil=require(_0x019d('0x16'));var db=require(_0x019d('0x17'))['db'];config[_0x019d('0x18')]=_[_0x019d('0x19')](config['redis'],{'host':_0x019d('0x1a'),'port':0x18eb});var socket=require(_0x019d('0x1b'))(new Redis(config[_0x019d('0x18')]));require(_0x019d('0x1c'))[_0x019d('0x1d')](socket);function respondWithStatusCode(_0x16cc4a,_0x51f4a4){_0x51f4a4=_0x51f4a4||0xcc;return function(_0x51daf4){if(_0x51daf4){return _0x16cc4a[_0x019d('0x1e')](_0x51f4a4);}return _0x16cc4a[_0x019d('0x1f')](_0x51f4a4)['end']();};}function respondWithResult(_0x554ce7,_0x23e1ac){_0x23e1ac=_0x23e1ac||0xc8;return function(_0x38233c){if(_0x38233c){return _0x554ce7[_0x019d('0x1f')](_0x23e1ac)[_0x019d('0x20')](_0x38233c);}};}function respondWithFilteredResult(_0x5ba948,_0x4d4336){return function(_0x2bd6fd){if(_0x2bd6fd){var _0x469a46=_0x2bd6fd[_0x019d('0x21')],_0x41cc81=_0x4d4336['offset'],_0x51ca53=_0x4d4336[_0x019d('0x22')]+_0x4d4336[_0x019d('0x23')],_0x118e4d;if(_0x51ca53>=_0x469a46){_0x51ca53=_0x469a46;_0x118e4d=0xc8;}else{_0x118e4d=0xce;}_0x5ba948[_0x019d('0x1f')](_0x118e4d);return _0x5ba948['set'](_0x019d('0x24'),_0x41cc81+'-'+_0x51ca53+'/'+_0x469a46)[_0x019d('0x20')](_0x2bd6fd);}return null;};}function patchUpdates(_0x1c7e7f){return function(_0x1181a3){try{jsonpatch[_0x019d('0x25')](_0x1181a3,_0x1c7e7f,!![]);}catch(_0x32f026){return BPromise[_0x019d('0x26')](_0x32f026);}return _0x1181a3[_0x019d('0x27')]();};}function saveUpdates(_0x538afc,_0x137436){return function(_0x129c63){if(_0x129c63){return _0x129c63[_0x019d('0x28')](_0x538afc)[_0x019d('0x29')](function(_0x17aea8){return _0x17aea8;});}return null;};}function removeEntity(_0x282517,_0x5a508d){return function(_0x4eaec5){if(_0x4eaec5){return _0x4eaec5[_0x019d('0x2a')]()[_0x019d('0x29')](function(){_0x282517[_0x019d('0x1f')](0xcc)[_0x019d('0x2b')]();});}};}function handleEntityNotFound(_0xdc3dd3,_0x45be32){return function(_0x418039){if(!_0x418039){_0xdc3dd3['sendStatus'](0x194);}return _0x418039;};}function handleError(_0x3a36dc,_0x362293){_0x362293=_0x362293||0x1f4;return function(_0x551497){logger[_0x019d('0x2c')](_0x551497[_0x019d('0x2d')]);if(_0x551497[_0x019d('0x2e')]){delete _0x551497[_0x019d('0x2e')];}_0x3a36dc['status'](_0x362293)[_0x019d('0x2f')](_0x551497);};}exports[_0x019d('0x30')]=function(_0x317a69,_0x1c1e03){var _0x5b026e={},_0x571d73={},_0x1e9838={'count':0x0,'rows':[]};var _0x409fc5=_[_0x019d('0x31')](db[_0x019d('0x32')][_0x019d('0x33')],function(_0x403fe7){return{'name':_0x403fe7['fieldName'],'type':_0x403fe7[_0x019d('0x34')][_0x019d('0x35')]};});_0x571d73[_0x019d('0x36')]=_[_0x019d('0x31')](_0x409fc5,_0x019d('0x2e'));_0x571d73[_0x019d('0x37')]=_['keys'](_0x317a69[_0x019d('0x37')]);_0x571d73[_0x019d('0x38')]=_[_0x019d('0x39')](_0x571d73[_0x019d('0x36')],_0x571d73[_0x019d('0x37')]);_0x5b026e[_0x019d('0x3a')]=_[_0x019d('0x39')](_0x571d73[_0x019d('0x36')],qs[_0x019d('0x3b')](_0x317a69['query'][_0x019d('0x3b')]));_0x5b026e[_0x019d('0x3a')]=_0x5b026e[_0x019d('0x3a')][_0x019d('0x3c')]?_0x5b026e[_0x019d('0x3a')]:_0x571d73[_0x019d('0x36')];if(!_0x317a69[_0x019d('0x37')]['hasOwnProperty']('nolimit')){_0x5b026e[_0x019d('0x23')]=qs[_0x019d('0x23')](_0x317a69[_0x019d('0x37')][_0x019d('0x23')]);_0x5b026e['offset']=qs[_0x019d('0x22')](_0x317a69[_0x019d('0x37')][_0x019d('0x22')]);}_0x5b026e[_0x019d('0x3d')]=qs['sort'](_0x317a69['query'][_0x019d('0x3e')]);_0x5b026e[_0x019d('0x3f')]=qs[_0x019d('0x38')](_['pick'](_0x317a69[_0x019d('0x37')],_0x571d73[_0x019d('0x38')]),_0x409fc5);if(_0x317a69[_0x019d('0x37')][_0x019d('0x40')]){_0x5b026e[_0x019d('0x3f')]=_['merge'](_0x5b026e[_0x019d('0x3f')],{'$or':_['map'](_0x409fc5,function(_0x30aa1a){if(_0x30aa1a['type']!==_0x019d('0x41')){var _0x4bce42={};_0x4bce42[_0x30aa1a[_0x019d('0x2e')]]={'$like':'%'+_0x317a69['query'][_0x019d('0x40')]+'%'};return _0x4bce42;}})});}_0x5b026e=_['merge']({},_0x5b026e,_0x317a69['options']);var _0x4c829a={'where':_0x5b026e[_0x019d('0x3f')]};return db[_0x019d('0x32')]['count'](_0x4c829a)[_0x019d('0x29')](function(_0x5ed99e){_0x1e9838[_0x019d('0x21')]=_0x5ed99e;if(_0x317a69[_0x019d('0x37')]['includeAll']){_0x5b026e[_0x019d('0x42')]=[{'all':!![]}];}return db[_0x019d('0x32')][_0x019d('0x43')](_0x5b026e);})[_0x019d('0x29')](function(_0x198a08){_0x1e9838[_0x019d('0x44')]=_0x198a08;return _0x1e9838;})[_0x019d('0x29')](respondWithFilteredResult(_0x1c1e03,_0x5b026e))[_0x019d('0x45')](handleError(_0x1c1e03,null));};exports['show']=function(_0x295cc7,_0x1381ac){var _0x1e7e19={'raw':!![],'where':{'id':_0x295cc7[_0x019d('0x46')]['id']}},_0x37fb72={};_0x37fb72[_0x019d('0x36')]=_[_0x019d('0x47')](db[_0x019d('0x32')]['rawAttributes']);_0x37fb72[_0x019d('0x37')]=_[_0x019d('0x47')](_0x295cc7[_0x019d('0x37')]);_0x37fb72['filters']=_['intersection'](_0x37fb72[_0x019d('0x36')],_0x37fb72[_0x019d('0x37')]);_0x1e7e19[_0x019d('0x3a')]=_[_0x019d('0x39')](_0x37fb72[_0x019d('0x36')],qs[_0x019d('0x3b')](_0x295cc7[_0x019d('0x37')][_0x019d('0x3b')]));_0x1e7e19['attributes']=_0x1e7e19[_0x019d('0x3a')][_0x019d('0x3c')]?_0x1e7e19[_0x019d('0x3a')]:_0x37fb72[_0x019d('0x36')];if(_0x295cc7[_0x019d('0x37')][_0x019d('0x48')]){_0x1e7e19[_0x019d('0x42')]=[{'all':!![]}];}_0x1e7e19=_['merge']({},_0x1e7e19,_0x295cc7[_0x019d('0x49')]);return db[_0x019d('0x32')][_0x019d('0x4a')](_0x1e7e19)[_0x019d('0x29')](handleEntityNotFound(_0x1381ac,null))['then'](respondWithResult(_0x1381ac,null))['catch'](handleError(_0x1381ac,null));};exports[_0x019d('0x4b')]=function(_0xad1f7f,_0x4326ec){return db['ChatInternalMessage'][_0x019d('0x4b')](_0xad1f7f[_0x019d('0x4c')],{})[_0x019d('0x29')](respondWithResult(_0x4326ec,0xc9))[_0x019d('0x45')](handleError(_0x4326ec,null));};exports['update']=function(_0x2872bf,_0x63f11d){if(_0x2872bf[_0x019d('0x4c')]['id']){delete _0x2872bf[_0x019d('0x4c')]['id'];}return db[_0x019d('0x32')][_0x019d('0x4a')]({'where':{'id':_0x2872bf[_0x019d('0x46')]['id']}})[_0x019d('0x29')](handleEntityNotFound(_0x63f11d,null))['then'](saveUpdates(_0x2872bf[_0x019d('0x4c')],null))[_0x019d('0x29')](respondWithResult(_0x63f11d,null))[_0x019d('0x45')](handleError(_0x63f11d,null));};exports['destroy']=function(_0x2283e8,_0xf5c3f2){return db['ChatInternalMessage']['find']({'where':{'id':_0x2283e8[_0x019d('0x46')]['id']}})[_0x019d('0x29')](handleEntityNotFound(_0xf5c3f2,null))[_0x019d('0x29')](removeEntity(_0xf5c3f2,null))[_0x019d('0x45')](handleError(_0xf5c3f2,null));};exports[_0x019d('0x4d')]=function(_0x5e6395,_0x5ef9f9){return db[_0x019d('0x32')][_0x019d('0x4d')]()[_0x019d('0x29')](respondWithResult(_0x5ef9f9,null))[_0x019d('0x45')](handleError(_0x5ef9f9,null));};function wrapUser(_0x40a135){return function(_0x1919c6){var _0x36b34f=_0x40a135[_0x019d('0x4e')]({'plain':!![]});_0x36b34f[_0x019d('0x4f')]=[];if(_0x1919c6){_0x36b34f[_0x019d('0x50')]=_0x1919c6['createdAt'];_0x36b34f[_0x019d('0x51')]=_0x1919c6;}else{_0x36b34f[_0x019d('0x50')]=moment(0x0)['format'](_0x019d('0x52'));_0x36b34f[_0x019d('0x51')]={};}return _0x36b34f;};}exports['getUsers']=function(_0x25e316,_0x4aef9e,_0x1a1468){var _0x1ec193=[];return db[_0x019d('0x53')][_0x019d('0x43')]({'where':{'role':[_0x019d('0x54'),_0x019d('0x55'),_0x019d('0x56')]},'attributes':['id',_0x019d('0x57'),'name',_0x019d('0x58'),_0x019d('0x59'),_0x019d('0x5a'),_0x019d('0x5b'),_0x019d('0x5c'),_0x019d('0x5d'),_0x019d('0x5e')],'order':qs[_0x019d('0x3e')](_0x019d('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0x019d('0x60'),'attributes':['id',_0x019d('0x2e'),_0x019d('0x34')],'through':{'attributes':[]}}]})[_0x019d('0x29')](function(_0x26a561){if(_0x26a561){var _0x5e1650=_0x25e316[_0x019d('0x56')]['get']({'plain':!![]});if(!_0x5e1650)throw new Error(_0x019d('0x61'));if(_0x5e1650['role']===_0x019d('0x56')){return db[_0x019d('0x62')]['find']({'where':{'name':'Agents','userProfileId':_0x5e1650[_0x019d('0x63')]},'raw':!![]})['then'](function(_0x80d077){if(_0x80d077){if(_0x80d077['autoAssociation']===0x0){return db[_0x019d('0x64')][_0x019d('0x43')]({'where':{'sectionId':_0x80d077['id']},'raw':!![]})['then'](function(_0x3605ce){var _0x368602=[];if(_[_0x019d('0x65')](_0x3605ce)){_0x368602=_[_0x019d('0x40')](_0x26a561,function(_0x59ca94){if(_0x59ca94[_0x019d('0x58')]!==_0x019d('0x54')){return _0x59ca94;}});return _0x368602;}else{for(var _0x3372aa=0x0;_0x3372aa<_0x26a561[_0x019d('0x3c')];_0x3372aa++){var _0x47ac16=_0x26a561[_0x3372aa];if(_0x47ac16[_0x019d('0x58')]===_0x019d('0x54')){var _0x28c70a=_['find'](_0x3605ce,function(_0x17aaa9){return _0x17aaa9[_0x019d('0x66')]===_0x47ac16['id'];});if(_0x28c70a)_0x368602[_0x019d('0x67')](_0x47ac16);}else{_0x368602[_0x019d('0x67')](_0x47ac16);}}return _0x368602;}});}else{return _0x26a561;}}else{var _0x45b0aa=_[_0x019d('0x40')](_0x26a561,function(_0x1924b3){if(_0x1924b3[_0x019d('0x58')]!==_0x019d('0x54')){return _0x1924b3;}});return _0x45b0aa;}});}else{return _0x26a561;}}})[_0x019d('0x29')](function(_0xd60385){var _0x458496=[];if(_0xd60385){_0x1ec193=_0xd60385;for(var _0x48c6ba=0x0;_0x48c6ba<_0xd60385[_0x019d('0x3c')];_0x48c6ba+=0x1){_0x1ec193[_0x48c6ba][_0x019d('0x4f')]=[];_0x458496[_0x019d('0x67')](db[_0x019d('0x32')][_0x019d('0x4a')]({'where':{'FromId':[_0x25e316[_0x019d('0x56')]['id'],_0xd60385[_0x48c6ba]['id']],'ToId':[_0x25e316[_0x019d('0x56')]['id'],_0xd60385[_0x48c6ba]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x019d('0x68'),'ToId',_0x019d('0x69'),'body'],'order':qs[_0x019d('0x3e')](_0x019d('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xd60385[_0x48c6ba])));}return BPromise[_0x019d('0x6b')](_0x458496);}return[];})[_0x019d('0x29')](function(_0x1b8c1a){return{'rows':_0x1b8c1a,'count':_0x1b8c1a[_0x019d('0x3c')]};})[_0x019d('0x29')](respondWithResult(_0x4aef9e,null))[_0x019d('0x45')](handleError(_0x4aef9e,null));}; \ No newline at end of file +var _0x6f0b=['rows','catch','show','params','options','create','body','find','describe','get','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','read','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','then','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','count','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f0b,0x94));var _0xb6f0=function(_0x5bff5d,_0x120b46){_0x5bff5d=_0x5bff5d-0x0;var _0x3e7af3=_0x6f0b[_0x5bff5d];return _0x3e7af3;};'use strict';var pdf=require(_0xb6f0('0x0'));var emlformat=require(_0xb6f0('0x1'));var rimraf=require(_0xb6f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6f0('0x3'));var rp=require(_0xb6f0('0x4'));var moment=require(_0xb6f0('0x5'));var BPromise=require(_0xb6f0('0x6'));var Mustache=require(_0xb6f0('0x7'));var util=require(_0xb6f0('0x8'));var path=require('path');var sox=require(_0xb6f0('0x9'));var csv=require(_0xb6f0('0xa'));var ejs=require(_0xb6f0('0xb'));var fs=require('fs');var _=require(_0xb6f0('0xc'));var squel=require(_0xb6f0('0xd'));var crypto=require(_0xb6f0('0xe'));var jsforce=require(_0xb6f0('0xf'));var deskjs=require(_0xb6f0('0x10'));var toCsv=require(_0xb6f0('0xa'));var querystring=require(_0xb6f0('0x11'));var Papa=require(_0xb6f0('0x12'));var Redis=require(_0xb6f0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb6f0('0x14'));var as=require(_0xb6f0('0x15'));var hardwareService=require(_0xb6f0('0x16'));var logger=require(_0xb6f0('0x17'))(_0xb6f0('0x18'));var utils=require(_0xb6f0('0x19'));var config=require(_0xb6f0('0x1a'));var licenseUtil=require(_0xb6f0('0x1b'));var db=require(_0xb6f0('0x1c'))['db'];config[_0xb6f0('0x1d')]=_['defaults'](config[_0xb6f0('0x1d')],{'host':_0xb6f0('0x1e'),'port':0x18eb});var socket=require(_0xb6f0('0x1f'))(new Redis(config[_0xb6f0('0x1d')]));require(_0xb6f0('0x20'))['register'](socket);function respondWithStatusCode(_0x460c12,_0x12e555){_0x12e555=_0x12e555||0xcc;return function(_0x3c34d7){if(_0x3c34d7){return _0x460c12[_0xb6f0('0x21')](_0x12e555);}return _0x460c12[_0xb6f0('0x22')](_0x12e555)[_0xb6f0('0x23')]();};}function respondWithResult(_0x3f93fe,_0x21b671){_0x21b671=_0x21b671||0xc8;return function(_0x411efd){if(_0x411efd){return _0x3f93fe['status'](_0x21b671)[_0xb6f0('0x24')](_0x411efd);}};}function respondWithFilteredResult(_0x16b832,_0x3adac5){return function(_0xe4f25c){if(_0xe4f25c){var _0x258e2d=_0xe4f25c['count'],_0x428146=_0x3adac5['offset'],_0x14863c=_0x3adac5[_0xb6f0('0x25')]+_0x3adac5[_0xb6f0('0x26')],_0x40d896;if(_0x14863c>=_0x258e2d){_0x14863c=_0x258e2d;_0x40d896=0xc8;}else{_0x40d896=0xce;}_0x16b832[_0xb6f0('0x22')](_0x40d896);return _0x16b832[_0xb6f0('0x27')]('Content-Range',_0x428146+'-'+_0x14863c+'/'+_0x258e2d)[_0xb6f0('0x24')](_0xe4f25c);}return null;};}function patchUpdates(_0x2599b7){return function(_0x457146){try{jsonpatch[_0xb6f0('0x28')](_0x457146,_0x2599b7,!![]);}catch(_0x4854f3){return BPromise['reject'](_0x4854f3);}return _0x457146[_0xb6f0('0x29')]();};}function saveUpdates(_0x5672f0,_0x4183e3){return function(_0x3b0712){if(_0x3b0712){return _0x3b0712[_0xb6f0('0x2a')](_0x5672f0)['then'](function(_0x452741){return _0x452741;});}return null;};}function removeEntity(_0x1b5638,_0x3bf6bf){return function(_0x195907){if(_0x195907){return _0x195907[_0xb6f0('0x2b')]()[_0xb6f0('0x2c')](function(){_0x1b5638[_0xb6f0('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35806b,_0xc9bc77){return function(_0xc1050f){if(!_0xc1050f){_0x35806b['sendStatus'](0x194);}return _0xc1050f;};}function handleError(_0x50ec3a,_0x40946e){_0x40946e=_0x40946e||0x1f4;return function(_0xbd539c){logger[_0xb6f0('0x2d')](_0xbd539c['stack']);if(_0xbd539c[_0xb6f0('0x2e')]){delete _0xbd539c[_0xb6f0('0x2e')];}_0x50ec3a[_0xb6f0('0x22')](_0x40946e)[_0xb6f0('0x2f')](_0xbd539c);};}exports[_0xb6f0('0x30')]=function(_0x1a4165,_0x4790c6){var _0xb3b455={},_0x45f0fc={},_0x164e6a={'count':0x0,'rows':[]};var _0x22f2e9=_[_0xb6f0('0x31')](db[_0xb6f0('0x32')][_0xb6f0('0x33')],function(_0xad8295){return{'name':_0xad8295[_0xb6f0('0x34')],'type':_0xad8295['type'][_0xb6f0('0x35')]};});_0x45f0fc['model']=_[_0xb6f0('0x31')](_0x22f2e9,'name');_0x45f0fc[_0xb6f0('0x36')]=_[_0xb6f0('0x37')](_0x1a4165[_0xb6f0('0x36')]);_0x45f0fc['filters']=_[_0xb6f0('0x38')](_0x45f0fc['model'],_0x45f0fc[_0xb6f0('0x36')]);_0xb3b455[_0xb6f0('0x39')]=_[_0xb6f0('0x38')](_0x45f0fc[_0xb6f0('0x3a')],qs[_0xb6f0('0x3b')](_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x3b')]));_0xb3b455[_0xb6f0('0x39')]=_0xb3b455[_0xb6f0('0x39')][_0xb6f0('0x3c')]?_0xb3b455[_0xb6f0('0x39')]:_0x45f0fc['model'];if(!_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x3d')]('nolimit')){_0xb3b455[_0xb6f0('0x26')]=qs[_0xb6f0('0x26')](_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x26')]);_0xb3b455[_0xb6f0('0x25')]=qs[_0xb6f0('0x25')](_0x1a4165['query'][_0xb6f0('0x25')]);}_0xb3b455[_0xb6f0('0x3e')]=qs[_0xb6f0('0x3f')](_0x1a4165['query'][_0xb6f0('0x3f')]);_0xb3b455[_0xb6f0('0x40')]=qs[_0xb6f0('0x41')](_['pick'](_0x1a4165['query'],_0x45f0fc[_0xb6f0('0x41')]),_0x22f2e9);if(_0x1a4165['query'][_0xb6f0('0x42')]){_0xb3b455[_0xb6f0('0x40')]=_[_0xb6f0('0x43')](_0xb3b455[_0xb6f0('0x40')],{'$or':_[_0xb6f0('0x31')](_0x22f2e9,function(_0x2ae260){if(_0x2ae260[_0xb6f0('0x44')]!==_0xb6f0('0x45')){var _0x15d539={};_0x15d539[_0x2ae260[_0xb6f0('0x2e')]]={'$like':'%'+_0x1a4165['query']['filter']+'%'};return _0x15d539;}})});}_0xb3b455=_[_0xb6f0('0x43')]({},_0xb3b455,_0x1a4165['options']);var _0x315ea7={'where':_0xb3b455[_0xb6f0('0x40')]};return db[_0xb6f0('0x32')][_0xb6f0('0x46')](_0x315ea7)[_0xb6f0('0x2c')](function(_0x1fd247){_0x164e6a[_0xb6f0('0x46')]=_0x1fd247;if(_0x1a4165['query'][_0xb6f0('0x47')]){_0xb3b455[_0xb6f0('0x48')]=[{'all':!![]}];}return db[_0xb6f0('0x32')][_0xb6f0('0x49')](_0xb3b455);})[_0xb6f0('0x2c')](function(_0x128ca2){_0x164e6a[_0xb6f0('0x4a')]=_0x128ca2;return _0x164e6a;})[_0xb6f0('0x2c')](respondWithFilteredResult(_0x4790c6,_0xb3b455))[_0xb6f0('0x4b')](handleError(_0x4790c6,null));};exports[_0xb6f0('0x4c')]=function(_0x2c882e,_0x2f556f){var _0x18cdce={'raw':!![],'where':{'id':_0x2c882e[_0xb6f0('0x4d')]['id']}},_0x5e4a71={};_0x5e4a71[_0xb6f0('0x3a')]=_[_0xb6f0('0x37')](db[_0xb6f0('0x32')][_0xb6f0('0x33')]);_0x5e4a71['query']=_['keys'](_0x2c882e['query']);_0x5e4a71['filters']=_['intersection'](_0x5e4a71['model'],_0x5e4a71[_0xb6f0('0x36')]);_0x18cdce[_0xb6f0('0x39')]=_[_0xb6f0('0x38')](_0x5e4a71['model'],qs['fields'](_0x2c882e['query'][_0xb6f0('0x3b')]));_0x18cdce[_0xb6f0('0x39')]=_0x18cdce[_0xb6f0('0x39')][_0xb6f0('0x3c')]?_0x18cdce[_0xb6f0('0x39')]:_0x5e4a71['model'];if(_0x2c882e[_0xb6f0('0x36')][_0xb6f0('0x47')]){_0x18cdce['include']=[{'all':!![]}];}_0x18cdce=_['merge']({},_0x18cdce,_0x2c882e[_0xb6f0('0x4e')]);return db['ChatInternalMessage']['find'](_0x18cdce)[_0xb6f0('0x2c')](handleEntityNotFound(_0x2f556f,null))[_0xb6f0('0x2c')](respondWithResult(_0x2f556f,null))[_0xb6f0('0x4b')](handleError(_0x2f556f,null));};exports[_0xb6f0('0x4f')]=function(_0x274d44,_0x14979c){return db['ChatInternalMessage'][_0xb6f0('0x4f')](_0x274d44[_0xb6f0('0x50')],{})[_0xb6f0('0x2c')](respondWithResult(_0x14979c,0xc9))[_0xb6f0('0x4b')](handleError(_0x14979c,null));};exports[_0xb6f0('0x2a')]=function(_0x936ca1,_0x4f93fa){if(_0x936ca1[_0xb6f0('0x50')]['id']){delete _0x936ca1[_0xb6f0('0x50')]['id'];}return db[_0xb6f0('0x32')][_0xb6f0('0x51')]({'where':{'id':_0x936ca1[_0xb6f0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f93fa,null))[_0xb6f0('0x2c')](saveUpdates(_0x936ca1[_0xb6f0('0x50')],null))[_0xb6f0('0x2c')](respondWithResult(_0x4f93fa,null))['catch'](handleError(_0x4f93fa,null));};exports[_0xb6f0('0x2b')]=function(_0x251ae7,_0x46d6c9){return db[_0xb6f0('0x32')][_0xb6f0('0x51')]({'where':{'id':_0x251ae7['params']['id']}})[_0xb6f0('0x2c')](handleEntityNotFound(_0x46d6c9,null))['then'](removeEntity(_0x46d6c9,null))[_0xb6f0('0x4b')](handleError(_0x46d6c9,null));};exports[_0xb6f0('0x52')]=function(_0x22da57,_0x50ba15){return db[_0xb6f0('0x32')][_0xb6f0('0x52')]()[_0xb6f0('0x2c')](respondWithResult(_0x50ba15,null))[_0xb6f0('0x4b')](handleError(_0x50ba15,null));};function wrapUser(_0x26dc84){return function(_0x24ebc9){var _0x140501=_0x26dc84[_0xb6f0('0x53')]({'plain':!![]});_0x140501[_0xb6f0('0x54')]=[];if(_0x24ebc9){_0x140501['lastMessageAt']=_0x24ebc9[_0xb6f0('0x55')];_0x140501['lastMessage']=_0x24ebc9;}else{_0x140501[_0xb6f0('0x56')]=moment(0x0)['format'](_0xb6f0('0x57'));_0x140501['lastMessage']={};}return _0x140501;};}exports[_0xb6f0('0x58')]=function(_0x274dc2,_0xd8409b,_0x412d2e){var _0x184953=[];return db['User'][_0xb6f0('0x49')]({'where':{'role':[_0xb6f0('0x59'),_0xb6f0('0x5a'),_0xb6f0('0x5b')]},'attributes':['id',_0xb6f0('0x5c'),'name',_0xb6f0('0x5d'),_0xb6f0('0x5e'),'internal',_0xb6f0('0x5f'),_0xb6f0('0x60'),_0xb6f0('0x61'),_0xb6f0('0x62')],'order':qs['sort'](_0xb6f0('0x63')),'include':[{'model':db[_0xb6f0('0x64')],'as':_0xb6f0('0x65'),'attributes':['id','name',_0xb6f0('0x44')],'through':{'attributes':[]}}]})['then'](function(_0x3a254b){if(_0x3a254b){var _0x21a4ff=_0x274dc2[_0xb6f0('0x5b')]['get']({'plain':!![]});if(!_0x21a4ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21a4ff['role']===_0xb6f0('0x5b')){return db[_0xb6f0('0x66')][_0xb6f0('0x51')]({'where':{'name':_0xb6f0('0x67'),'userProfileId':_0x21a4ff['userProfileId']},'raw':!![]})['then'](function(_0x537ba4){if(_0x537ba4){if(_0x537ba4[_0xb6f0('0x68')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x537ba4['id']},'raw':!![]})['then'](function(_0x5bb1a5){var _0x53d06a=[];if(_[_0xb6f0('0x69')](_0x5bb1a5)){_0x53d06a=_['filter'](_0x3a254b,function(_0x13049b){if(_0x13049b[_0xb6f0('0x5d')]!==_0xb6f0('0x59')){return _0x13049b;}});return _0x53d06a;}else{for(var _0x4753f5=0x0;_0x4753f5<_0x3a254b[_0xb6f0('0x3c')];_0x4753f5++){var _0x1caa16=_0x3a254b[_0x4753f5];if(_0x1caa16[_0xb6f0('0x5d')]===_0xb6f0('0x59')){var _0xa4fc78=_[_0xb6f0('0x51')](_0x5bb1a5,function(_0x2c005e){return _0x2c005e[_0xb6f0('0x6a')]===_0x1caa16['id'];});if(_0xa4fc78)_0x53d06a['push'](_0x1caa16);}else{_0x53d06a[_0xb6f0('0x6b')](_0x1caa16);}}return _0x53d06a;}});}else{return _0x3a254b;}}else{var _0x629923=_[_0xb6f0('0x42')](_0x3a254b,function(_0x2e0766){if(_0x2e0766[_0xb6f0('0x5d')]!==_0xb6f0('0x59')){return _0x2e0766;}});return _0x629923;}});}else{return _0x3a254b;}}})[_0xb6f0('0x2c')](function(_0x533ff8){var _0x50e71c=[];if(_0x533ff8){_0x184953=_0x533ff8;for(var _0x27fc9a=0x0;_0x27fc9a<_0x533ff8[_0xb6f0('0x3c')];_0x27fc9a+=0x1){_0x184953[_0x27fc9a][_0xb6f0('0x54')]=[];_0x50e71c[_0xb6f0('0x6b')](db['ChatInternalMessage'][_0xb6f0('0x51')]({'where':{'FromId':[_0x274dc2[_0xb6f0('0x5b')]['id'],_0x533ff8[_0x27fc9a]['id']],'ToId':[_0x274dc2[_0xb6f0('0x5b')]['id'],_0x533ff8[_0x27fc9a]['id']],'ChatGroupId':null},'attributes':['id',_0xb6f0('0x55'),'FromId','ToId',_0xb6f0('0x6c'),_0xb6f0('0x50')],'order':qs[_0xb6f0('0x3f')](_0xb6f0('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb6f0('0x2c')](wrapUser(_0x533ff8[_0x27fc9a])));}return BPromise[_0xb6f0('0x6e')](_0x50e71c);}return[];})[_0xb6f0('0x2c')](function(_0x43243e){return{'rows':_0x43243e,'count':_0x43243e[_0xb6f0('0x3c')]};})[_0xb6f0('0x2c')](respondWithResult(_0xd8409b,null))['catch'](handleError(_0xd8409b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index bed0b3d..d0b4bbe 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 _0x3c7b=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x205b6e,_0x36a183){var _0x974b6b=function(_0x3ba59f){while(--_0x3ba59f){_0x205b6e['push'](_0x205b6e['shift']());}};_0x974b6b(++_0x36a183);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x48f948,_0x3ebee8){_0x48f948=_0x48f948-0x0;var _0x13cead=_0x3c7b[_0x48f948];return _0x13cead;};'use strict';var EventEmitter=require(_0xb3c7('0x0'));var ChatInternalMessage=require(_0xb3c7('0x1'))['db'][_0xb3c7('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb3c7('0x3')](0x0);var events={'afterCreate':_0xb3c7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x500bea){return function(_0x5b34ef,_0x234fe5,_0x44c399){ChatInternalMessageEvents['emit'](_0x500bea+':'+_0x5b34ef['id'],_0x5b34ef);ChatInternalMessageEvents[_0xb3c7('0x5')](_0x500bea,_0x5b34ef);_0x44c399(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb3c7('0x6')](e,emitEvent(event));}}module[_0xb3c7('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x61b8=['exports','events','../../mysqldb','ChatInternalMessage','save','emit','hasOwnProperty','hook'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x61b8,0x169));var _0x861b=function(_0x4eb780,_0x478e25){_0x4eb780=_0x4eb780-0x0;var _0x214fca=_0x61b8[_0x4eb780];return _0x214fca;};'use strict';var EventEmitter=require(_0x861b('0x0'));var ChatInternalMessage=require(_0x861b('0x1'))['db'][_0x861b('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x861b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37b79f){return function(_0x10e70b,_0x4b139c,_0x56a7a9){ChatInternalMessageEvents[_0x861b('0x4')](_0x37b79f+':'+_0x10e70b['id'],_0x10e70b);ChatInternalMessageEvents[_0x861b('0x4')](_0x37b79f,_0x10e70b);_0x56a7a9(null);};}for(var e in events){if(events[_0x861b('0x5')](e)){var event=events[e];ChatInternalMessage[_0x861b('0x6')](e,emitEvent(event));}}module[_0x861b('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 c32b734..03f4302 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 _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2ad1a0,_0x7850b2){var _0x1a9268=function(_0x5ce2d2){while(--_0x5ce2d2){_0x2ad1a0['push'](_0x2ad1a0['shift']());}};_0x1a9268(++_0x7850b2);}(_0x4fc2,0x111));var _0x24fc=function(_0x247a5e,_0x40b75d){_0x247a5e=_0x247a5e-0x0;var _0x16e004=_0x4fc2[_0x247a5e];return _0x16e004;};'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 _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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 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_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index dc8f572..352f5b1 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 _0x76c1=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x194e6f,_0x2f43db){var _0x46cb85=function(_0x5eef56){while(--_0x5eef56){_0x194e6f['push'](_0x194e6f['shift']());}};_0x46cb85(++_0x2f43db);}(_0x76c1,0x7d));var _0x176c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x76c1[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var moment=require(_0x176c('0x2'));var BPromise=require(_0x176c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x176c('0x4'));var db=require(_0x176c('0x5'))['db'];var utils=require(_0x176c('0x6'));var logger=require(_0x176c('0x7'))(_0x176c('0x8'));var config=require(_0x176c('0x9'));var jayson=require(_0x176c('0xa'));var client=jayson['client'][_0x176c('0xb')]({'port':0x232a});config[_0x176c('0xc')]=_[_0x176c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x176c('0xe'))(new Redis(config['redis']));require(_0x176c('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e4f96,_0x3a7f15,_0x40c770){return new BPromise(function(_0xf93c94,_0x18e506){return client['request'](_0x4e4f96,_0x40c770)[_0x176c('0x10')](function(_0x1cdd66){logger[_0x176c('0x11')](_0x176c('0x12'),_0x3a7f15,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3a7f15,_0x176c('0x13'),JSON['stringify'](_0x1cdd66));if(_0x1cdd66[_0x176c('0x14')]){if(_0x1cdd66['error'][_0x176c('0x15')]===0x1f4){logger[_0x176c('0x14')](_0x176c('0x12'),_0x3a7f15,_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);return _0x18e506(_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);}logger[_0x176c('0x14')](_0x176c('0x12'),_0x3a7f15,_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);return _0xf93c94(_0x1cdd66[_0x176c('0x14')][_0x176c('0x16')]);}else{logger[_0x176c('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3a7f15,_0x176c('0x13'));_0xf93c94(_0x1cdd66[_0x176c('0x17')][_0x176c('0x16')]);}})[_0x176c('0x18')](function(_0x393d35){logger[_0x176c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3a7f15,_0x393d35);_0x18e506(_0x393d35);});});} \ No newline at end of file +var _0xe0ca=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xe0ca,0xb1));var _0xae0c=function(_0x4eafcf,_0x458eb5){_0x4eafcf=_0x4eafcf-0x0;var _0x431945=_0xe0ca[_0x4eafcf];return _0x431945;};'use strict';var _=require(_0xae0c('0x0'));var util=require(_0xae0c('0x1'));var moment=require(_0xae0c('0x2'));var BPromise=require(_0xae0c('0x3'));var rs=require(_0xae0c('0x4'));var fs=require('fs');var Redis=require(_0xae0c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae0c('0x6'));var logger=require(_0xae0c('0x7'))(_0xae0c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae0c('0x9')][_0xae0c('0xa')]({'port':0x232a});config[_0xae0c('0xb')]=_[_0xae0c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae0c('0xb')]));require(_0xae0c('0xd'))[_0xae0c('0xe')](socket);function respondWithRpcPromise(_0x907201,_0x490a79,_0x2f3465){return new BPromise(function(_0x5e9b42,_0x449a54){return client[_0xae0c('0xf')](_0x907201,_0x2f3465)[_0xae0c('0x10')](function(_0x447ff){logger['info'](_0xae0c('0x11'),_0x490a79,_0xae0c('0x12'));logger['debug'](_0xae0c('0x13'),_0x490a79,'request\x20sent',JSON[_0xae0c('0x14')](_0x447ff));if(_0x447ff[_0xae0c('0x15')]){if(_0x447ff[_0xae0c('0x15')]['code']===0x1f4){logger['error'](_0xae0c('0x11'),_0x490a79,_0x447ff[_0xae0c('0x15')][_0xae0c('0x16')]);return _0x449a54(_0x447ff[_0xae0c('0x15')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x490a79,_0x447ff[_0xae0c('0x15')]['message']);return _0x5e9b42(_0x447ff[_0xae0c('0x15')]['message']);}else{logger[_0xae0c('0x17')](_0xae0c('0x11'),_0x490a79,'request\x20sent');_0x5e9b42(_0x447ff[_0xae0c('0x18')][_0xae0c('0x16')]);}})['catch'](function(_0x307329){logger[_0xae0c('0x15')](_0xae0c('0x11'),_0x490a79,_0x307329);_0x449a54(_0x307329);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 41aa2ea..6122792 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 _0xf1e1=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0xd7bcf0,_0x5da944){var _0xcb918a=function(_0x30556c){while(--_0x30556c){_0xd7bcf0['push'](_0xd7bcf0['shift']());}};_0xcb918a(++_0x5da944);}(_0xf1e1,0x102));var _0x1f1e=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xf1e1[_0x270adf];return _0x29eda9;};'use strict';var ChatInternalMessageEvents=require(_0x1f1e('0x0'));var events=['save',_0x1f1e('0x1'),'update'];function createListener(_0x436258,_0x490554){return function(_0xdd125){_0x490554[_0x1f1e('0x2')](_0x436258,_0xdd125);};}function removeListener(_0x2243c6,_0x2ab1f9){return function(){ChatInternalMessageEvents[_0x1f1e('0x3')](_0x2243c6,_0x2ab1f9);};}exports[_0x1f1e('0x4')]=function(_0x1bdcee){for(var _0x3242af=0x0,_0x1db643=events[_0x1f1e('0x5')];_0x3242af<_0x1db643;_0x3242af++){var _0x46e32b=events[_0x3242af];var _0x3699d2=createListener(_0x1f1e('0x6')+_0x46e32b,_0x1bdcee);ChatInternalMessageEvents['on'](_0x46e32b,_0x3699d2);}}; \ No newline at end of file +var _0x61a1=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5d3391,_0x26043f){var _0x24cd40=function(_0x5e9b68){while(--_0x5e9b68){_0x5d3391['push'](_0x5d3391['shift']());}};_0x24cd40(++_0x26043f);}(_0x61a1,0x127));var _0x161a=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x61a1[_0x4a82ac];return _0x58ee97;};'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 7ebdf82..8f84374 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x1949c6,_0x11fc26){var _0x992ce7=function(_0x5930c9){while(--_0x5930c9){_0x1949c6['push'](_0x1949c6['shift']());}};_0x992ce7(++_0x11fc26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xcb91[_0x336264];return _0x53cf91;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x25f7ae,_0x52ccd4){var _0x429699=function(_0x279235){while(--_0x279235){_0x25f7ae['push'](_0x25f7ae['shift']());}};_0x429699(++_0x52ccd4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 5d7e867..863333b 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 _0xf20c=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xf20c,0x144));var _0xcf20=function(_0x3485f8,_0x1b66cf){_0x3485f8=_0x3485f8-0x0;var _0x1fbba7=_0xf20c[_0x3485f8];return _0x1fbba7;};'use strict';var Sequelize=require('sequelize');module[_0xcf20('0x0')]={'body':{'type':Sequelize[_0xcf20('0x1')](_0xcf20('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcf20('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf20('0x4')]('in',_0xcf20('0x5')),'defaultValue':_0xcf20('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcf20('0x6')]},'providerName':{'type':Sequelize[_0xcf20('0x7')]},'providerResponse':{'type':Sequelize[_0xcf20('0x1')]}}; \ No newline at end of file +var _0x1ab2=['TEXT','sequelize','BOOLEAN','out','DATE','STRING'];(function(_0x3d69a5,_0x2fd801){var _0x13170a=function(_0x443980){while(--_0x443980){_0x3d69a5['push'](_0x3d69a5['shift']());}};_0x13170a(++_0x2fd801);}(_0x1ab2,0x12d));var _0x21ab=function(_0x5e7fe7,_0x722a27){_0x5e7fe7=_0x5e7fe7-0x0;var _0x4497d7=_0x1ab2[_0x5e7fe7];return _0x4497d7;};'use strict';var Sequelize=require(_0x21ab('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x21ab('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x21ab('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x21ab('0x2')),'defaultValue':_0x21ab('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x21ab('0x3')]},'providerName':{'type':Sequelize[_0x21ab('0x4')]},'providerResponse':{'type':Sequelize[_0x21ab('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 536425a..0f41502 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 _0x0720=['include','find','create','body','describe','../../config/logger','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','parse','formData','chat-interactions','chat','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','show','params','fields'];(function(_0x477fdb,_0x462b55){var _0x32beaf=function(_0x1f9528){while(--_0x1f9528){_0x477fdb['push'](_0x477fdb['shift']());}};_0x32beaf(++_0x462b55);}(_0x0720,0x183));var _0x0072=function(_0x5737ac,_0x147697){_0x5737ac=_0x5737ac-0x0;var _0x599c28=_0x0720[_0x5737ac];return _0x599c28;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0072('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0072('0x1'));var jsonpatch=require(_0x0072('0x2'));var rp=require(_0x0072('0x3'));var moment=require(_0x0072('0x4'));var BPromise=require(_0x0072('0x5'));var Mustache=require(_0x0072('0x6'));var util=require(_0x0072('0x7'));var path=require('path');var sox=require(_0x0072('0x8'));var csv=require(_0x0072('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0072('0xa'));var squel=require(_0x0072('0xb'));var crypto=require(_0x0072('0xc'));var jsforce=require(_0x0072('0xd'));var deskjs=require(_0x0072('0xe'));var toCsv=require(_0x0072('0x9'));var querystring=require(_0x0072('0xf'));var Papa=require(_0x0072('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0072('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0072('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0072('0x13'));var config=require(_0x0072('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0072('0x15'))['db'];config[_0x0072('0x16')]=_[_0x0072('0x17')](config[_0x0072('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0072('0x18'))(new Redis(config[_0x0072('0x16')]));require(_0x0072('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0072('0x1a')][_0x0072('0x1b')]({'port':0x232c});var client9002=jayson[_0x0072('0x1a')][_0x0072('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4aeda2,_0x478241,_0x345ded,_0x13afe1){return new BPromise(function(_0x1cd69d,_0x5bd16e){var _0xbbb6a0=_0x13afe1||client;return _0xbbb6a0['request'](_0x4aeda2,_0x345ded)[_0x0072('0x1c')](function(_0x3df269){logger[_0x0072('0x1d')](_0x0072('0x1e'),_0x478241,_0x0072('0x1f'));logger[_0x0072('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x478241,_0x0072('0x1f'),JSON[_0x0072('0x21')](_0x3df269));if(_0x3df269[_0x0072('0x22')]){if(_0x3df269['error'][_0x0072('0x23')]===0x1f4){logger[_0x0072('0x22')](_0x0072('0x1e'),_0x478241,_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);return _0x5bd16e(_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);}logger[_0x0072('0x22')]('ChatMessage,\x20%s,\x20%s',_0x478241,_0x3df269[_0x0072('0x22')]['message']);return _0x1cd69d(_0x3df269[_0x0072('0x22')][_0x0072('0x24')]);}else{logger[_0x0072('0x1d')](_0x0072('0x1e'),_0x478241,'request\x20sent');_0x1cd69d(_0x3df269[_0x0072('0x25')]['message']);}})[_0x0072('0x26')](function(_0x3b5b7f){logger['error'](_0x0072('0x1e'),_0x478241,_0x3b5b7f);_0x5bd16e(_0x3b5b7f);});});}function respondWithStatusCode(_0x1ece3a,_0x547d09){_0x547d09=_0x547d09||0xcc;return function(_0x1641d7){if(_0x1641d7){return _0x1ece3a['sendStatus'](_0x547d09);}return _0x1ece3a['status'](_0x547d09)['end']();};}function respondWithResult(_0x3bfdeb,_0x44c821){_0x44c821=_0x44c821||0xc8;return function(_0x45d93a){if(_0x45d93a){return _0x3bfdeb[_0x0072('0x27')](_0x44c821)['json'](_0x45d93a);}};}function respondWithFilteredResult(_0x545c0b,_0xfe695d){return function(_0x4ac5bc){if(_0x4ac5bc){var _0x59f726=_0x4ac5bc[_0x0072('0x28')],_0xd4858d=_0xfe695d[_0x0072('0x29')],_0x472cf1=_0xfe695d[_0x0072('0x29')]+_0xfe695d[_0x0072('0x2a')],_0xd0669a;if(_0x472cf1>=_0x59f726){_0x472cf1=_0x59f726;_0xd0669a=0xc8;}else{_0xd0669a=0xce;}_0x545c0b[_0x0072('0x27')](_0xd0669a);return _0x545c0b[_0x0072('0x2b')](_0x0072('0x2c'),_0xd4858d+'-'+_0x472cf1+'/'+_0x59f726)[_0x0072('0x2d')](_0x4ac5bc);}return null;};}function patchUpdates(_0x31a800){return function(_0x98e44d){try{jsonpatch[_0x0072('0x2e')](_0x98e44d,_0x31a800,!![]);}catch(_0x35f24e){return BPromise[_0x0072('0x2f')](_0x35f24e);}return _0x98e44d[_0x0072('0x30')]();};}function saveUpdates(_0x70bc94,_0x58f97f){return function(_0x31bfef){if(_0x31bfef){return _0x31bfef[_0x0072('0x31')](_0x70bc94)[_0x0072('0x1c')](function(_0xe90d9b){return _0xe90d9b;});}return null;};}function removeEntity(_0x5761dc,_0x57fdba){return function(_0x3ef6f5){if(_0x3ef6f5){return _0x3ef6f5[_0x0072('0x32')]()[_0x0072('0x1c')](function(){_0x5761dc[_0x0072('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d9cff,_0x579a1c){return function(_0x4ab8cd){if(!_0x4ab8cd){_0x3d9cff[_0x0072('0x33')](0x194);}return _0x4ab8cd;};}function handleError(_0x2eb260,_0x4c5b66){_0x4c5b66=_0x4c5b66||0x1f4;return function(_0xddad91){logger['error'](_0xddad91[_0x0072('0x34')]);if(_0xddad91[_0x0072('0x35')]){delete _0xddad91[_0x0072('0x35')];}_0x2eb260[_0x0072('0x27')](_0x4c5b66)[_0x0072('0x36')](_0xddad91);};}exports[_0x0072('0x37')]=function(_0x5a140a,_0x10e599){var _0x1fab2e={},_0x4c49ed={},_0x2176a0={'count':0x0,'rows':[]};var _0x40b780=_[_0x0072('0x38')](db[_0x0072('0x39')][_0x0072('0x3a')],function(_0xc19ffc){return{'name':_0xc19ffc['fieldName'],'type':_0xc19ffc[_0x0072('0x3b')][_0x0072('0x3c')]};});_0x4c49ed[_0x0072('0x3d')]=_[_0x0072('0x38')](_0x40b780,'name');_0x4c49ed[_0x0072('0x3e')]=_[_0x0072('0x3f')](_0x5a140a[_0x0072('0x3e')]);_0x4c49ed['filters']=_['intersection'](_0x4c49ed['model'],_0x4c49ed[_0x0072('0x3e')]);_0x1fab2e['attributes']=_[_0x0072('0x40')](_0x4c49ed[_0x0072('0x3d')],qs['fields'](_0x5a140a['query']['fields']));_0x1fab2e[_0x0072('0x41')]=_0x1fab2e[_0x0072('0x41')][_0x0072('0x42')]?_0x1fab2e['attributes']:_0x4c49ed[_0x0072('0x3d')];if(!_0x5a140a[_0x0072('0x3e')][_0x0072('0x43')](_0x0072('0x44'))){_0x1fab2e[_0x0072('0x2a')]=qs[_0x0072('0x2a')](_0x5a140a[_0x0072('0x3e')][_0x0072('0x2a')]);_0x1fab2e['offset']=qs['offset'](_0x5a140a[_0x0072('0x3e')]['offset']);}_0x1fab2e[_0x0072('0x45')]=qs[_0x0072('0x46')](_0x5a140a[_0x0072('0x3e')]['sort']);_0x1fab2e[_0x0072('0x47')]=qs[_0x0072('0x48')](_[_0x0072('0x49')](_0x5a140a['query'],_0x4c49ed[_0x0072('0x48')]),_0x40b780);if(_0x5a140a[_0x0072('0x3e')][_0x0072('0x4a')]){_0x1fab2e['where']=_[_0x0072('0x4b')](_0x1fab2e['where'],{'$or':_[_0x0072('0x38')](_0x40b780,function(_0x25b977){if(_0x25b977['type']!=='VIRTUAL'){var _0xb428fb={};_0xb428fb[_0x25b977['name']]={'$like':'%'+_0x5a140a['query']['filter']+'%'};return _0xb428fb;}})});}_0x1fab2e=_[_0x0072('0x4b')]({},_0x1fab2e,_0x5a140a[_0x0072('0x4c')]);var _0xb4c749={'where':_0x1fab2e[_0x0072('0x47')]};return db[_0x0072('0x39')]['count'](_0xb4c749)[_0x0072('0x1c')](function(_0xffd1e4){_0x2176a0[_0x0072('0x28')]=_0xffd1e4;if(_0x5a140a[_0x0072('0x3e')][_0x0072('0x4d')]){_0x1fab2e['include']=[{'all':!![]}];}return db[_0x0072('0x39')]['findAll'](_0x1fab2e);})[_0x0072('0x1c')](function(_0x4d011c){_0x2176a0['rows']=_0x4d011c;return _0x2176a0;})['then'](respondWithFilteredResult(_0x10e599,_0x1fab2e))[_0x0072('0x26')](handleError(_0x10e599,null));};exports[_0x0072('0x4e')]=function(_0x3225be,_0x542dc1){var _0xb16a35={'raw':!![],'where':{'id':_0x3225be[_0x0072('0x4f')]['id']}},_0x4b6bc6={};_0x4b6bc6[_0x0072('0x3d')]=_[_0x0072('0x3f')](db['ChatMessage'][_0x0072('0x3a')]);_0x4b6bc6[_0x0072('0x3e')]=_[_0x0072('0x3f')](_0x3225be[_0x0072('0x3e')]);_0x4b6bc6[_0x0072('0x48')]=_[_0x0072('0x40')](_0x4b6bc6[_0x0072('0x3d')],_0x4b6bc6['query']);_0xb16a35['attributes']=_[_0x0072('0x40')](_0x4b6bc6[_0x0072('0x3d')],qs[_0x0072('0x50')](_0x3225be[_0x0072('0x3e')][_0x0072('0x50')]));_0xb16a35[_0x0072('0x41')]=_0xb16a35['attributes'][_0x0072('0x42')]?_0xb16a35[_0x0072('0x41')]:_0x4b6bc6['model'];if(_0x3225be[_0x0072('0x3e')][_0x0072('0x4d')]){_0xb16a35[_0x0072('0x51')]=[{'all':!![]}];}_0xb16a35=_[_0x0072('0x4b')]({},_0xb16a35,_0x3225be['options']);return db[_0x0072('0x39')][_0x0072('0x52')](_0xb16a35)['then'](handleEntityNotFound(_0x542dc1,null))[_0x0072('0x1c')](respondWithResult(_0x542dc1,null))[_0x0072('0x26')](handleError(_0x542dc1,null));};exports[_0x0072('0x53')]=function(_0x279b42,_0x4e8e47){return db['ChatMessage'][_0x0072('0x53')](_0x279b42['body'],{})[_0x0072('0x1c')](respondWithResult(_0x4e8e47,0xc9))[_0x0072('0x26')](handleError(_0x4e8e47,null));};exports[_0x0072('0x31')]=function(_0x29220c,_0x4fa041){if(_0x29220c[_0x0072('0x54')]['id']){delete _0x29220c[_0x0072('0x54')]['id'];}return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x29220c[_0x0072('0x4f')]['id']}})[_0x0072('0x1c')](handleEntityNotFound(_0x4fa041,null))[_0x0072('0x1c')](saveUpdates(_0x29220c[_0x0072('0x54')],null))[_0x0072('0x1c')](respondWithResult(_0x4fa041,null))[_0x0072('0x26')](handleError(_0x4fa041,null));};exports['destroy']=function(_0x1c083c,_0x51c1bb){return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x1c083c['params']['id']}})[_0x0072('0x1c')](handleEntityNotFound(_0x51c1bb,null))[_0x0072('0x1c')](removeEntity(_0x51c1bb,null))[_0x0072('0x26')](handleError(_0x51c1bb,null));};exports[_0x0072('0x55')]=function(_0x148d83,_0x496b51){return db[_0x0072('0x39')]['describe']()['then'](respondWithResult(_0x496b51,null))[_0x0072('0x26')](handleError(_0x496b51,null));};var interaction_log=require(_0x0072('0x56'))('chat-interactions');exports['accept']=function(_0x143b97,_0x47c5cb,_0x3002d4){var _0x3104e2={'channel':'chat'};if(_0x143b97[_0x0072('0x54')]['id']){delete _0x143b97[_0x0072('0x54')]['id'];}_0x143b97[_0x0072('0x54')]['read']=!![];_0x143b97[_0x0072('0x54')][_0x0072('0x57')]=moment()[_0x0072('0x58')](_0x0072('0x59'));_0x143b97[_0x0072('0x54')][_0x0072('0x5a')]=_0x143b97[_0x0072('0x54')][_0x0072('0x5a')]||_0x143b97[_0x0072('0x5b')]['id'];return db[_0x0072('0x39')][_0x0072('0x52')]({'where':{'id':_0x143b97['params']['id'],'UserId':null},'include':[{'model':db[_0x0072('0x5c')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x47c5cb,null))[_0x0072('0x1c')](saveUpdates(_0x143b97[_0x0072('0x54')],null))['then'](function(_0x4f58fa){if(_0x4f58fa){_0x3104e2[_0x0072('0x24')]=_0x4f58fa[_0x0072('0x5d')]({'plain':!![]});return db[_0x0072('0x5e')][_0x0072('0x52')]({'where':{'id':_0x4f58fa[_0x0072('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x47c5cb,null))[_0x0072('0x1c')](function(_0x1e4adf){if(_0x1e4adf){return _0x1e4adf['update']({'UserId':_0x143b97[_0x0072('0x54')][_0x0072('0x5a')],'read1stAt':_['isNil'](_0x1e4adf[_0x0072('0x60')])?moment()[_0x0072('0x58')](_0x0072('0x59')):undefined});}return null;})['then'](function(_0x392ed2){if(_0x392ed2){_0x3104e2['interaction']=_0x392ed2['get']({'plain':!![]});interaction_log[_0x0072('0x1d')](_0x0072('0x61'),_0x143b97[_0x0072('0x5b')]['id'],_0x143b97[_0x0072('0x5b')][_0x0072('0x35')],_0x143b97[_0x0072('0x5b')][_0x0072('0x62')],_0x3104e2[_0x0072('0x63')]['id'],_0x143b97[_0x0072('0x54')]?JSON['stringify'](_0x143b97[_0x0072('0x54')]):_0x0072('0x64'));return respondWithRpcPromise('AcceptMessage',_0x0072('0x65'),_0x3104e2);}return null;})[_0x0072('0x1c')](function(_0x36d54b){if(_0x36d54b){if(_0x143b97[_0x0072('0x54')]['manual']){_0x3104e2['message'][_0x0072('0x66')]=util[_0x0072('0x58')](_0x0072('0x67'),_0x143b97['user'][_0x0072('0x35')]);_0x3104e2['message'][_0x0072('0x68')]=_0x3104e2[_0x0072('0x68')];_0x3104e2['message'][_0x0072('0x69')]=_0x0072('0x6a');return respondWithRpcPromise(_0x0072('0x6b'),_0x0072('0x6b'),{'event':'acceptmessage','message':_[_0x0072('0x4b')](_0x3104e2[_0x0072('0x24')],JSON[_0x0072('0x6c')](_0x3104e2[_0x0072('0x63')][_0x0072('0x6d')]))},client9002)[_0x0072('0x1c')](function(){return _0x3104e2;});}return _0x3104e2;}return null;})['then'](respondWithResult(_0x47c5cb,null))[_0x0072('0x26')](handleError(_0x47c5cb,null));};var interaction_log=require(_0x0072('0x56'))(_0x0072('0x6e'));exports[_0x0072('0x2f')]=function(_0x473e4d,_0x2b84a2,_0x27e2fe){var _0x44fed8={'agent':{},'channel':_0x0072('0x6f')};if(_0x473e4d[_0x0072('0x54')]['id']){delete _0x473e4d[_0x0072('0x54')]['id'];}_0x473e4d[_0x0072('0x54')][_0x0072('0x5a')]=_0x473e4d[_0x0072('0x54')][_0x0072('0x5a')]||_0x473e4d[_0x0072('0x5b')]['id'];_0x44fed8[_0x0072('0x70')]['id']=_0x473e4d['body'][_0x0072('0x5a')];return db[_0x0072('0x39')]['find']({'where':{'id':_0x473e4d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b84a2,null))[_0x0072('0x1c')](function(_0x210287){if(_0x210287){_0x44fed8[_0x0072('0x24')]=_0x210287[_0x0072('0x5d')]({'plain':!![]});return db[_0x0072('0x5e')][_0x0072('0x52')]({'where':{'id':_0x210287[_0x0072('0x5f')]}});}return null;})[_0x0072('0x1c')](handleEntityNotFound(_0x2b84a2,null))[_0x0072('0x1c')](function(_0x185c1f){if(_0x185c1f){_0x44fed8['interaction']=_0x185c1f[_0x0072('0x5d')]({'plain':!![]});interaction_log[_0x0072('0x1d')](_0x0072('0x71'),_0x473e4d['user']['id'],_0x473e4d[_0x0072('0x5b')]['name'],_0x473e4d[_0x0072('0x5b')]['role'],_0x44fed8[_0x0072('0x63')]['id'],_0x473e4d[_0x0072('0x54')]?JSON['stringify'](_0x473e4d['body']):_0x0072('0x64'));return respondWithRpcPromise(_0x0072('0x72'),_0x0072('0x73'),_0x44fed8);}return null;})[_0x0072('0x1c')](function(_0x4ebe65){if(_0x4ebe65){_0x4ebe65[_0x0072('0x24')][_0x0072('0x66')]=util[_0x0072('0x58')](_0x0072('0x67'),_0x473e4d['user']['name']);_0x4ebe65[_0x0072('0x24')][_0x0072('0x68')]=_0x44fed8[_0x0072('0x68')];_0x4ebe65['message'][_0x0072('0x69')]='reject';respondWithRpcPromise(_0x0072('0x6b'),'EventManager',{'event':_0x0072('0x74'),'message':_0x4ebe65[_0x0072('0x24')]},client9002);return _0x44fed8;}return null;})[_0x0072('0x1c')](respondWithResult(_0x2b84a2,null))[_0x0072('0x26')](handleError(_0x2b84a2,null));}; \ No newline at end of file +var _0x8cac=['accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','format','channel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','stack','name','index','map','ChatMessage','rawAttributes','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','find','describe','chat-interactions'];(function(_0x1d210d,_0x1fd62f){var _0xf7cb18=function(_0x5ce8ef){while(--_0x5ce8ef){_0x1d210d['push'](_0x1d210d['shift']());}};_0xf7cb18(++_0x1fd62f);}(_0x8cac,0x94));var _0xc8ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8cac[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xc8ca('0x0'));var emlformat=require(_0xc8ca('0x1'));var rimraf=require(_0xc8ca('0x2'));var zipdir=require(_0xc8ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ca('0x4'));var moment=require('moment');var BPromise=require(_0xc8ca('0x5'));var Mustache=require(_0xc8ca('0x6'));var util=require(_0xc8ca('0x7'));var path=require(_0xc8ca('0x8'));var sox=require(_0xc8ca('0x9'));var csv=require(_0xc8ca('0xa'));var ejs=require(_0xc8ca('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc8ca('0xc'));var crypto=require(_0xc8ca('0xd'));var jsforce=require(_0xc8ca('0xe'));var deskjs=require(_0xc8ca('0xf'));var toCsv=require(_0xc8ca('0xa'));var querystring=require(_0xc8ca('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc8ca('0x11'));var qs=require(_0xc8ca('0x12'));var as=require(_0xc8ca('0x13'));var hardwareService=require(_0xc8ca('0x14'));var logger=require(_0xc8ca('0x15'))(_0xc8ca('0x16'));var utils=require(_0xc8ca('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8ca('0x18'));var db=require(_0xc8ca('0x19'))['db'];config['redis']=_[_0xc8ca('0x1a')](config[_0xc8ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc8ca('0x1c'))(new Redis(config[_0xc8ca('0x1b')]));require(_0xc8ca('0x1d'))[_0xc8ca('0x1e')](socket);var jayson=require(_0xc8ca('0x1f'));var client=jayson[_0xc8ca('0x20')][_0xc8ca('0x21')]({'port':0x232c});var client9002=jayson[_0xc8ca('0x20')][_0xc8ca('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x38cae7,_0x2e5dca,_0x212a88,_0x2043bb){return new BPromise(function(_0x2f5632,_0x24e81f){var _0x3b83fa=_0x2043bb||client;return _0x3b83fa[_0xc8ca('0x22')](_0x38cae7,_0x212a88)['then'](function(_0x5725c8){logger['info'](_0xc8ca('0x23'),_0x2e5dca,_0xc8ca('0x24'));logger[_0xc8ca('0x25')](_0xc8ca('0x26'),_0x2e5dca,'request\x20sent',JSON['stringify'](_0x5725c8));if(_0x5725c8[_0xc8ca('0x27')]){if(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x28')]===0x1f4){logger[_0xc8ca('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2e5dca,_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);return _0x24e81f(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);}logger[_0xc8ca('0x27')](_0xc8ca('0x23'),_0x2e5dca,_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);return _0x2f5632(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);}else{logger[_0xc8ca('0x2a')](_0xc8ca('0x23'),_0x2e5dca,_0xc8ca('0x24'));_0x2f5632(_0x5725c8[_0xc8ca('0x2b')][_0xc8ca('0x29')]);}})[_0xc8ca('0x2c')](function(_0x4cfcf2){logger[_0xc8ca('0x27')](_0xc8ca('0x23'),_0x2e5dca,_0x4cfcf2);_0x24e81f(_0x4cfcf2);});});}function respondWithStatusCode(_0x598861,_0x4da3f7){_0x4da3f7=_0x4da3f7||0xcc;return function(_0x5b057d){if(_0x5b057d){return _0x598861[_0xc8ca('0x2d')](_0x4da3f7);}return _0x598861[_0xc8ca('0x2e')](_0x4da3f7)[_0xc8ca('0x2f')]();};}function respondWithResult(_0x84fb8f,_0x50a1cb){_0x50a1cb=_0x50a1cb||0xc8;return function(_0x369d8d){if(_0x369d8d){return _0x84fb8f['status'](_0x50a1cb)['json'](_0x369d8d);}};}function respondWithFilteredResult(_0x9c90dc,_0x4fe980){return function(_0x4c431c){if(_0x4c431c){var _0x330767=_0x4c431c[_0xc8ca('0x30')],_0x14b44c=_0x4fe980[_0xc8ca('0x31')],_0x2833e5=_0x4fe980[_0xc8ca('0x31')]+_0x4fe980[_0xc8ca('0x32')],_0x44f372;if(_0x2833e5>=_0x330767){_0x2833e5=_0x330767;_0x44f372=0xc8;}else{_0x44f372=0xce;}_0x9c90dc['status'](_0x44f372);return _0x9c90dc[_0xc8ca('0x33')]('Content-Range',_0x14b44c+'-'+_0x2833e5+'/'+_0x330767)[_0xc8ca('0x34')](_0x4c431c);}return null;};}function patchUpdates(_0x2fe9a6){return function(_0xd56f3c){try{jsonpatch['apply'](_0xd56f3c,_0x2fe9a6,!![]);}catch(_0x2c8553){return BPromise[_0xc8ca('0x35')](_0x2c8553);}return _0xd56f3c[_0xc8ca('0x36')]();};}function saveUpdates(_0x3d8dbc,_0x5b1b48){return function(_0x26011f){if(_0x26011f){return _0x26011f[_0xc8ca('0x37')](_0x3d8dbc)[_0xc8ca('0x38')](function(_0x5223eb){return _0x5223eb;});}return null;};}function removeEntity(_0x41c0f5,_0x22adac){return function(_0x1e2624){if(_0x1e2624){return _0x1e2624['destroy']()['then'](function(){_0x41c0f5[_0xc8ca('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x869af,_0x22befb){return function(_0x183fc9){if(!_0x183fc9){_0x869af[_0xc8ca('0x2d')](0x194);}return _0x183fc9;};}function handleError(_0x2d1b00,_0x54d2bc){_0x54d2bc=_0x54d2bc||0x1f4;return function(_0x14edf8){logger['error'](_0x14edf8[_0xc8ca('0x39')]);if(_0x14edf8[_0xc8ca('0x3a')]){delete _0x14edf8[_0xc8ca('0x3a')];}_0x2d1b00[_0xc8ca('0x2e')](_0x54d2bc)['send'](_0x14edf8);};}exports[_0xc8ca('0x3b')]=function(_0x5cac52,_0x185260){var _0x489f9b={},_0x57aef6={},_0x470b6b={'count':0x0,'rows':[]};var _0x221ea0=_[_0xc8ca('0x3c')](db[_0xc8ca('0x3d')][_0xc8ca('0x3e')],function(_0x3970aa){return{'name':_0x3970aa['fieldName'],'type':_0x3970aa['type'][_0xc8ca('0x3f')]};});_0x57aef6[_0xc8ca('0x40')]=_[_0xc8ca('0x3c')](_0x221ea0,_0xc8ca('0x3a'));_0x57aef6['query']=_['keys'](_0x5cac52['query']);_0x57aef6[_0xc8ca('0x41')]=_[_0xc8ca('0x42')](_0x57aef6[_0xc8ca('0x40')],_0x57aef6['query']);_0x489f9b['attributes']=_[_0xc8ca('0x42')](_0x57aef6[_0xc8ca('0x40')],qs[_0xc8ca('0x43')](_0x5cac52[_0xc8ca('0x44')]['fields']));_0x489f9b[_0xc8ca('0x45')]=_0x489f9b[_0xc8ca('0x45')][_0xc8ca('0x46')]?_0x489f9b['attributes']:_0x57aef6[_0xc8ca('0x40')];if(!_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x47')](_0xc8ca('0x48'))){_0x489f9b[_0xc8ca('0x32')]=qs['limit'](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x32')]);_0x489f9b[_0xc8ca('0x31')]=qs[_0xc8ca('0x31')](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x31')]);}_0x489f9b[_0xc8ca('0x49')]=qs[_0xc8ca('0x4a')](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x4a')]);_0x489f9b['where']=qs[_0xc8ca('0x41')](_[_0xc8ca('0x4b')](_0x5cac52[_0xc8ca('0x44')],_0x57aef6['filters']),_0x221ea0);if(_0x5cac52[_0xc8ca('0x44')]['filter']){_0x489f9b[_0xc8ca('0x4c')]=_[_0xc8ca('0x4d')](_0x489f9b[_0xc8ca('0x4c')],{'$or':_['map'](_0x221ea0,function(_0x31b945){if(_0x31b945[_0xc8ca('0x4e')]!==_0xc8ca('0x4f')){var _0x5403d5={};_0x5403d5[_0x31b945[_0xc8ca('0x3a')]]={'$like':'%'+_0x5cac52[_0xc8ca('0x44')]['filter']+'%'};return _0x5403d5;}})});}_0x489f9b=_[_0xc8ca('0x4d')]({},_0x489f9b,_0x5cac52[_0xc8ca('0x50')]);var _0x25aaa3={'where':_0x489f9b[_0xc8ca('0x4c')]};return db[_0xc8ca('0x3d')]['count'](_0x25aaa3)[_0xc8ca('0x38')](function(_0x245fef){_0x470b6b[_0xc8ca('0x30')]=_0x245fef;if(_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x51')]){_0x489f9b[_0xc8ca('0x52')]=[{'all':!![]}];}return db[_0xc8ca('0x3d')][_0xc8ca('0x53')](_0x489f9b);})[_0xc8ca('0x38')](function(_0x2fd2f8){_0x470b6b[_0xc8ca('0x54')]=_0x2fd2f8;return _0x470b6b;})[_0xc8ca('0x38')](respondWithFilteredResult(_0x185260,_0x489f9b))[_0xc8ca('0x2c')](handleError(_0x185260,null));};exports['show']=function(_0x1be200,_0x2aa7a7){var _0x3a14f7={'raw':!![],'where':{'id':_0x1be200[_0xc8ca('0x55')]['id']}},_0x2eb72d={};_0x2eb72d['model']=_[_0xc8ca('0x56')](db['ChatMessage'][_0xc8ca('0x3e')]);_0x2eb72d[_0xc8ca('0x44')]=_[_0xc8ca('0x56')](_0x1be200[_0xc8ca('0x44')]);_0x2eb72d[_0xc8ca('0x41')]=_[_0xc8ca('0x42')](_0x2eb72d[_0xc8ca('0x40')],_0x2eb72d[_0xc8ca('0x44')]);_0x3a14f7[_0xc8ca('0x45')]=_[_0xc8ca('0x42')](_0x2eb72d[_0xc8ca('0x40')],qs[_0xc8ca('0x43')](_0x1be200[_0xc8ca('0x44')][_0xc8ca('0x43')]));_0x3a14f7[_0xc8ca('0x45')]=_0x3a14f7[_0xc8ca('0x45')]['length']?_0x3a14f7[_0xc8ca('0x45')]:_0x2eb72d[_0xc8ca('0x40')];if(_0x1be200[_0xc8ca('0x44')][_0xc8ca('0x51')]){_0x3a14f7['include']=[{'all':!![]}];}_0x3a14f7=_['merge']({},_0x3a14f7,_0x1be200['options']);return db[_0xc8ca('0x3d')]['find'](_0x3a14f7)['then'](handleEntityNotFound(_0x2aa7a7,null))[_0xc8ca('0x38')](respondWithResult(_0x2aa7a7,null))['catch'](handleError(_0x2aa7a7,null));};exports[_0xc8ca('0x57')]=function(_0x34ed37,_0x28fdd9){return db[_0xc8ca('0x3d')][_0xc8ca('0x57')](_0x34ed37[_0xc8ca('0x58')],{})[_0xc8ca('0x38')](respondWithResult(_0x28fdd9,0xc9))[_0xc8ca('0x2c')](handleError(_0x28fdd9,null));};exports[_0xc8ca('0x37')]=function(_0x50ec3a,_0x26fe0d){if(_0x50ec3a[_0xc8ca('0x58')]['id']){delete _0x50ec3a['body']['id'];}return db[_0xc8ca('0x3d')]['find']({'where':{'id':_0x50ec3a[_0xc8ca('0x55')]['id']}})[_0xc8ca('0x38')](handleEntityNotFound(_0x26fe0d,null))[_0xc8ca('0x38')](saveUpdates(_0x50ec3a[_0xc8ca('0x58')],null))[_0xc8ca('0x38')](respondWithResult(_0x26fe0d,null))['catch'](handleError(_0x26fe0d,null));};exports['destroy']=function(_0x196c0b,_0xe74148){return db[_0xc8ca('0x3d')][_0xc8ca('0x59')]({'where':{'id':_0x196c0b['params']['id']}})[_0xc8ca('0x38')](handleEntityNotFound(_0xe74148,null))['then'](removeEntity(_0xe74148,null))[_0xc8ca('0x2c')](handleError(_0xe74148,null));};exports[_0xc8ca('0x5a')]=function(_0x1aec41,_0x4088be){return db[_0xc8ca('0x3d')][_0xc8ca('0x5a')]()[_0xc8ca('0x38')](respondWithResult(_0x4088be,null))[_0xc8ca('0x2c')](handleError(_0x4088be,null));};var interaction_log=require('../../config/logger')(_0xc8ca('0x5b'));exports[_0xc8ca('0x5c')]=function(_0x27d0e1,_0x3d608e,_0x57bbf2){var _0xba6bb3={'channel':'chat'};if(_0x27d0e1[_0xc8ca('0x58')]['id']){delete _0x27d0e1[_0xc8ca('0x58')]['id'];}_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x5d')]=!![];_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x5e')]=moment()['format'](_0xc8ca('0x5f'));_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x60')]=_0x27d0e1['body'][_0xc8ca('0x60')]||_0x27d0e1[_0xc8ca('0x61')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x27d0e1['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc8ca('0x62')}]})[_0xc8ca('0x38')](handleEntityNotFound(_0x3d608e,null))[_0xc8ca('0x38')](saveUpdates(_0x27d0e1['body'],null))[_0xc8ca('0x38')](function(_0x6d6f33){if(_0x6d6f33){_0xba6bb3[_0xc8ca('0x29')]=_0x6d6f33[_0xc8ca('0x63')]({'plain':!![]});return db[_0xc8ca('0x64')][_0xc8ca('0x59')]({'where':{'id':_0x6d6f33[_0xc8ca('0x65')]}});}return null;})[_0xc8ca('0x38')](handleEntityNotFound(_0x3d608e,null))['then'](function(_0xdf0bec){if(_0xdf0bec){return _0xdf0bec['update']({'UserId':_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x60')],'read1stAt':_['isNil'](_0xdf0bec[_0xc8ca('0x66')])?moment()['format'](_0xc8ca('0x5f')):undefined});}return null;})[_0xc8ca('0x38')](function(_0x30514c){if(_0x30514c){_0xba6bb3['interaction']=_0x30514c[_0xc8ca('0x63')]({'plain':!![]});interaction_log['info'](_0xc8ca('0x67'),_0x27d0e1[_0xc8ca('0x61')]['id'],_0x27d0e1[_0xc8ca('0x61')][_0xc8ca('0x3a')],_0x27d0e1[_0xc8ca('0x61')][_0xc8ca('0x68')],_0xba6bb3[_0xc8ca('0x69')]['id'],_0x27d0e1[_0xc8ca('0x58')]?JSON['stringify'](_0x27d0e1[_0xc8ca('0x58')]):_0xc8ca('0x6a'));return respondWithRpcPromise(_0xc8ca('0x6b'),_0xc8ca('0x6c'),_0xba6bb3);}return null;})[_0xc8ca('0x38')](function(_0x1fb9a0){if(_0x1fb9a0){if(_0x27d0e1['body'][_0xc8ca('0x6d')]){_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x6e')]=util[_0xc8ca('0x6f')]('SIP/%s',_0x27d0e1[_0xc8ca('0x61')]['name']);_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x70')]=_0xba6bb3[_0xc8ca('0x70')];_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x71')]=_0xc8ca('0x5c');return respondWithRpcPromise('EventManager',_0xc8ca('0x72'),{'event':'acceptmessage','message':_[_0xc8ca('0x4d')](_0xba6bb3[_0xc8ca('0x29')],JSON[_0xc8ca('0x73')](_0xba6bb3[_0xc8ca('0x69')][_0xc8ca('0x74')]))},client9002)['then'](function(){return _0xba6bb3;});}return _0xba6bb3;}return null;})[_0xc8ca('0x38')](respondWithResult(_0x3d608e,null))[_0xc8ca('0x2c')](handleError(_0x3d608e,null));};var interaction_log=require('../../config/logger')(_0xc8ca('0x5b'));exports['reject']=function(_0x40c869,_0x3e51b9,_0x2d4e85){var _0x1d73d2={'agent':{},'channel':'chat'};if(_0x40c869[_0xc8ca('0x58')]['id']){delete _0x40c869[_0xc8ca('0x58')]['id'];}_0x40c869[_0xc8ca('0x58')][_0xc8ca('0x60')]=_0x40c869[_0xc8ca('0x58')][_0xc8ca('0x60')]||_0x40c869[_0xc8ca('0x61')]['id'];_0x1d73d2['agent']['id']=_0x40c869[_0xc8ca('0x58')]['UserId'];return db[_0xc8ca('0x3d')][_0xc8ca('0x59')]({'where':{'id':_0x40c869['params']['id'],'UserId':null}})[_0xc8ca('0x38')](handleEntityNotFound(_0x3e51b9,null))[_0xc8ca('0x38')](function(_0x2325dc){if(_0x2325dc){_0x1d73d2[_0xc8ca('0x29')]=_0x2325dc[_0xc8ca('0x63')]({'plain':!![]});return db[_0xc8ca('0x64')][_0xc8ca('0x59')]({'where':{'id':_0x2325dc[_0xc8ca('0x65')]}});}return null;})[_0xc8ca('0x38')](handleEntityNotFound(_0x3e51b9,null))['then'](function(_0x54f601){if(_0x54f601){_0x1d73d2[_0xc8ca('0x69')]=_0x54f601[_0xc8ca('0x63')]({'plain':!![]});interaction_log[_0xc8ca('0x2a')](_0xc8ca('0x75'),_0x40c869[_0xc8ca('0x61')]['id'],_0x40c869['user'][_0xc8ca('0x3a')],_0x40c869[_0xc8ca('0x61')][_0xc8ca('0x68')],_0x1d73d2[_0xc8ca('0x69')]['id'],_0x40c869[_0xc8ca('0x58')]?JSON['stringify'](_0x40c869['body']):'null');return respondWithRpcPromise(_0xc8ca('0x76'),'rejectMessage',_0x1d73d2);}return null;})[_0xc8ca('0x38')](function(_0x353687){if(_0x353687){_0x353687['message'][_0xc8ca('0x6e')]=util[_0xc8ca('0x6f')](_0xc8ca('0x77'),_0x40c869[_0xc8ca('0x61')][_0xc8ca('0x3a')]);_0x353687[_0xc8ca('0x29')][_0xc8ca('0x70')]=_0x1d73d2[_0xc8ca('0x70')];_0x353687[_0xc8ca('0x29')]['event']='reject';respondWithRpcPromise(_0xc8ca('0x72'),_0xc8ca('0x72'),{'event':'rejectmessage','message':_0x353687[_0xc8ca('0x29')]},client9002);return _0x1d73d2;}return null;})[_0xc8ca('0x38')](respondWithResult(_0x3e51b9,null))[_0xc8ca('0x2c')](handleError(_0x3e51b9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6748748..9ed1e62 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 _0x4911=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x17eae9,_0x23d6ee){var _0x187c53=function(_0xc6a57c){while(--_0xc6a57c){_0x17eae9['push'](_0x17eae9['shift']());}};_0x187c53(++_0x23d6ee);}(_0x4911,0x17a));var _0x1491=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x4911[_0x834bb6];return _0xa35d00;};'use strict';var EventEmitter=require(_0x1491('0x0'));var ChatMessage=require(_0x1491('0x1'))['db'][_0x1491('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1491('0x3')](0x0);var events={'afterCreate':_0x1491('0x4'),'afterUpdate':_0x1491('0x5'),'afterDestroy':_0x1491('0x6')};function emitEvent(_0xdc7d02){return function(_0x30ea85,_0x29a260,_0x2d521){ChatMessageEvents['emit'](_0xdc7d02+':'+_0x30ea85['id'],_0x30ea85);ChatMessageEvents[_0x1491('0x7')](_0xdc7d02,_0x30ea85);_0x2d521(null);};}for(var e in events){if(events[_0x1491('0x8')](e)){var event=events[e];ChatMessage[_0x1491('0x9')](e,emitEvent(event));}}module[_0x1491('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x44ed=['ChatMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x44ed,0x15d));var _0xd44e=function(_0x47f0b6,_0x3daf1a){_0x47f0b6=_0x47f0b6-0x0;var _0x53c469=_0x44ed[_0x47f0b6];return _0x53c469;};'use strict';var EventEmitter=require(_0xd44e('0x0'));var ChatMessage=require(_0xd44e('0x1'))['db'][_0xd44e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd44e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd44e('0x4')};function emitEvent(_0x369e12){return function(_0x2c50b0,_0x450da6,_0x49f34b){ChatMessageEvents['emit'](_0x369e12+':'+_0x2c50b0['id'],_0x2c50b0);ChatMessageEvents[_0xd44e('0x5')](_0x369e12,_0x2c50b0);_0x49f34b(null);};}for(var e in events){if(events[_0xd44e('0x6')](e)){var event=events[e];ChatMessage[_0xd44e('0x7')](e,emitEvent(event));}}module[_0xd44e('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3a89cdb..0967954 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 _0x4a76=['ChatInteractionId','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0x4a76,0x16d));var _0x64a7=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a76[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x64a7('0x0'));var util=require('util');var logger=require(_0x64a7('0x1'))(_0x64a7('0x2'));var moment=require(_0x64a7('0x3'));var BPromise=require(_0x64a7('0x4'));var rp=require(_0x64a7('0x5'));var fs=require('fs');var path=require(_0x64a7('0x6'));var rimraf=require(_0x64a7('0x7'));var config=require(_0x64a7('0x8'));var attributes=require(_0x64a7('0x9'));module[_0x64a7('0xa')]=function(_0x40e5cb,_0x3757d1){return _0x40e5cb[_0x64a7('0xb')](_0x64a7('0xc'),attributes,{'tableName':_0x64a7('0xd'),'paranoid':![],'indexes':[{'name':_0x64a7('0xe'),'fields':[_0x64a7('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f5de7,_0x2db43c,_0x4d3105){var _0x5bcc28=_0x40e5cb[_0x64a7('0x10')];var _0x344348=_0x5f5de7[_0x64a7('0x11')]({'plain':!![]});if(_0x344348[_0x64a7('0x12')][_0x64a7('0x13')]()==='in'||_0x344348[_0x64a7('0x12')][_0x64a7('0x13')]()==='out'&&!_0x344348[_0x64a7('0x14')]&&!_[_0x64a7('0x15')](_0x344348[_0x64a7('0x16')])){_0x5bcc28[_0x64a7('0x17')][_0x64a7('0x18')]({'where':{'id':_0x344348[_0x64a7('0x19')]}})['then'](function(_0x8d3b16){if(_0x8d3b16){_0x8d3b16['update']({'lastMsgAt':_0x344348[_0x64a7('0x1a')],'lastMsgDirection':_0x344348[_0x64a7('0x12')]['toLowerCase']()});}})[_0x64a7('0x1b')](function(_0x1fecae){console[_0x64a7('0x1c')](_0x1fecae);});}_0x4d3105();}},'charset':_0x64a7('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb352=['then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','findOne'];(function(_0x505db3,_0xf39b41){var _0x2306ac=function(_0x494a2c){while(--_0x494a2c){_0x505db3['push'](_0x505db3['shift']());}};_0x2306ac(++_0xf39b41);}(_0xb352,0x99));var _0x2b35=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb352[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x2b35('0x0'));var util=require('util');var logger=require(_0x2b35('0x1'))(_0x2b35('0x2'));var moment=require(_0x2b35('0x3'));var BPromise=require(_0x2b35('0x4'));var rp=require(_0x2b35('0x5'));var fs=require('fs');var path=require(_0x2b35('0x6'));var rimraf=require(_0x2b35('0x7'));var config=require(_0x2b35('0x8'));var attributes=require('./chatMessage.attributes');module[_0x2b35('0x9')]=function(_0x572023,_0x2003b2){return _0x572023[_0x2b35('0xa')](_0x2b35('0xb'),attributes,{'tableName':_0x2b35('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x2b35('0xd')],'type':_0x2b35('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x461d73,_0x468c13,_0x4e4113){var _0x4ecc79=_0x572023['models'];var _0x41b37f=_0x461d73[_0x2b35('0xf')]({'plain':!![]});if(_0x41b37f[_0x2b35('0x10')]['toLowerCase']()==='in'||_0x41b37f[_0x2b35('0x10')][_0x2b35('0x11')]()===_0x2b35('0x12')&&!_0x41b37f[_0x2b35('0x13')]&&!_[_0x2b35('0x14')](_0x41b37f['UserId'])){_0x4ecc79['ChatInteraction'][_0x2b35('0x15')]({'where':{'id':_0x41b37f['ChatInteractionId']}})[_0x2b35('0x16')](function(_0x25dc9e){if(_0x25dc9e){_0x25dc9e['update']({'lastMsgAt':_0x41b37f['createdAt'],'lastMsgDirection':_0x41b37f['direction'][_0x2b35('0x11')]()});}})['catch'](function(_0x7e0cce){console['error'](_0x7e0cce);});}_0x4e4113();}},'charset':_0x2b35('0x17'),'collate':_0x2b35('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a060bd9..8a6ca4c 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 _0x800c=['defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x1cd042,_0x5c7451){var _0x29a214=function(_0x466a98){while(--_0x466a98){_0x1cd042['push'](_0x1cd042['shift']());}};_0x29a214(++_0x5c7451);}(_0x800c,0x79));var _0xc800=function(_0x1e7286,_0xc259ee){_0x1e7286=_0x1e7286-0x0;var _0x3ab62a=_0x800c[_0x1e7286];return _0x3ab62a;};'use strict';var _=require(_0xc800('0x0'));var util=require('util');var moment=require(_0xc800('0x1'));var BPromise=require(_0xc800('0x2'));var rs=require(_0xc800('0x3'));var fs=require('fs');var Redis=require(_0xc800('0x4'));var db=require(_0xc800('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc800('0x6'))(_0xc800('0x7'));var config=require(_0xc800('0x8'));var jayson=require(_0xc800('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc800('0xa')]=_[_0xc800('0xb')](config[_0xc800('0xa')],{'host':_0xc800('0xc'),'port':0x18eb});var socket=require(_0xc800('0xd'))(new Redis(config[_0xc800('0xa')]));require('./chatMessage.socket')[_0xc800('0xe')](socket);function respondWithRpcPromise(_0xf56cc4,_0x35ba01,_0x5aac7f){return new BPromise(function(_0x11d025,_0x523318){return client[_0xc800('0xf')](_0xf56cc4,_0x5aac7f)[_0xc800('0x10')](function(_0x452b0b){logger[_0xc800('0x11')](_0xc800('0x12'),_0x35ba01,_0xc800('0x13'));logger[_0xc800('0x14')](_0xc800('0x15'),_0x35ba01,_0xc800('0x13'),JSON[_0xc800('0x16')](_0x452b0b));if(_0x452b0b[_0xc800('0x17')]){if(_0x452b0b[_0xc800('0x17')][_0xc800('0x18')]===0x1f4){logger[_0xc800('0x17')](_0xc800('0x12'),_0x35ba01,_0x452b0b[_0xc800('0x17')][_0xc800('0x19')]);return _0x523318(_0x452b0b['error'][_0xc800('0x19')]);}logger[_0xc800('0x17')]('ChatMessage,\x20%s,\x20%s',_0x35ba01,_0x452b0b[_0xc800('0x17')][_0xc800('0x19')]);return _0x11d025(_0x452b0b[_0xc800('0x17')]['message']);}else{logger[_0xc800('0x11')](_0xc800('0x12'),_0x35ba01,_0xc800('0x13'));_0x11d025(_0x452b0b['result'][_0xc800('0x19')]);}})[_0xc800('0x1a')](function(_0x50221f){logger[_0xc800('0x17')](_0xc800('0x12'),_0x35ba01,_0x50221f);_0x523318(_0x50221f);});});}exports['CreateChatMessage']=function(_0x16e753){var _0x4bd155=this;return new Promise(function(_0x23f6c3,_0x4317da){return db[_0xc800('0x1b')][_0xc800('0x1c')](_0x16e753[_0xc800('0x1d')],{'raw':_0x16e753[_0xc800('0x1e')]?_0x16e753[_0xc800('0x1e')][_0xc800('0x1f')]===undefined?!![]:![]:!![]})[_0xc800('0x10')](function(_0x3bee42){logger[_0xc800('0x11')](_0xc800('0x20'),_0x16e753);logger['debug'](_0xc800('0x20'),_0x16e753,JSON[_0xc800('0x16')](_0x3bee42));_0x23f6c3(_0x3bee42);})[_0xc800('0x1a')](function(_0x1aca57){logger[_0xc800('0x17')](_0xc800('0x20'),_0x1aca57[_0xc800('0x19')],_0x16e753);_0x4317da(_0x4bd155[_0xc800('0x17')](0x1f4,_0x1aca57['message']));});});}; \ No newline at end of file +var _0x4009=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','options','lodash','util','bluebird','randomstring'];(function(_0x1780ec,_0x3af2fa){var _0x5c5663=function(_0x23eac9){while(--_0x23eac9){_0x1780ec['push'](_0x1780ec['shift']());}};_0x5c5663(++_0x3af2fa);}(_0x4009,0x1a0));var _0x9400=function(_0x3b5337,_0xe882e7){_0x3b5337=_0x3b5337-0x0;var _0x6b807c=_0x4009[_0x3b5337];return _0x6b807c;};'use strict';var _=require(_0x9400('0x0'));var util=require(_0x9400('0x1'));var moment=require('moment');var BPromise=require(_0x9400('0x2'));var rs=require(_0x9400('0x3'));var fs=require('fs');var Redis=require(_0x9400('0x4'));var db=require(_0x9400('0x5'))['db'];var utils=require(_0x9400('0x6'));var logger=require(_0x9400('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9400('0x8'));var client=jayson['client'][_0x9400('0x9')]({'port':0x232a});config['redis']=_[_0x9400('0xa')](config['redis'],{'host':_0x9400('0xb'),'port':0x18eb});var socket=require(_0x9400('0xc'))(new Redis(config[_0x9400('0xd')]));require(_0x9400('0xe'))['register'](socket);function respondWithRpcPromise(_0x31e00b,_0x4e528d,_0x249290){return new BPromise(function(_0x13b733,_0x1eae28){return client[_0x9400('0xf')](_0x31e00b,_0x249290)[_0x9400('0x10')](function(_0x91c18a){logger[_0x9400('0x11')]('ChatMessage,\x20%s,\x20%s',_0x4e528d,_0x9400('0x12'));logger[_0x9400('0x13')](_0x9400('0x14'),_0x4e528d,'request\x20sent',JSON[_0x9400('0x15')](_0x91c18a));if(_0x91c18a[_0x9400('0x16')]){if(_0x91c18a[_0x9400('0x16')]['code']===0x1f4){logger['error'](_0x9400('0x17'),_0x4e528d,_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);return _0x1eae28(_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);}logger[_0x9400('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4e528d,_0x91c18a['error'][_0x9400('0x18')]);return _0x13b733(_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);}else{logger[_0x9400('0x11')](_0x9400('0x17'),_0x4e528d,'request\x20sent');_0x13b733(_0x91c18a[_0x9400('0x19')][_0x9400('0x18')]);}})[_0x9400('0x1a')](function(_0x44174e){logger[_0x9400('0x16')](_0x9400('0x17'),_0x4e528d,_0x44174e);_0x1eae28(_0x44174e);});});}exports[_0x9400('0x1b')]=function(_0x253fa){var _0x33edeb=this;return new Promise(function(_0x3d8684,_0x54adb7){return db[_0x9400('0x1c')]['create'](_0x253fa['body'],{'raw':_0x253fa[_0x9400('0x1d')]?_0x253fa[_0x9400('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x9400('0x10')](function(_0x38bccc){logger[_0x9400('0x11')](_0x9400('0x1b'),_0x253fa);logger[_0x9400('0x13')](_0x9400('0x1b'),_0x253fa,JSON[_0x9400('0x15')](_0x38bccc));_0x3d8684(_0x38bccc);})[_0x9400('0x1a')](function(_0x30b48f){logger[_0x9400('0x16')](_0x9400('0x1b'),_0x30b48f['message'],_0x253fa);_0x54adb7(_0x33edeb['error'](0x1f4,_0x30b48f[_0x9400('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c17ecf6..1bfe2e2 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 _0x5d58=['register'];(function(_0x41f99d,_0x5db144){var _0x39855b=function(_0x30cb83){while(--_0x30cb83){_0x41f99d['push'](_0x41f99d['shift']());}};_0x39855b(++_0x5db144);}(_0x5d58,0x187));var _0x85d5=function(_0x575589,_0x25f057){_0x575589=_0x575589-0x0;var _0x26ba7d=_0x5d58[_0x575589];return _0x26ba7d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){ChatMessageEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('chatMessage:'+_0x98c963,_0x2d457a);ChatMessageEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file +var _0xe2fe=['update','emit','register','length','./chatMessage.events'];(function(_0x3b6646,_0x466c7c){var _0x464ac8=function(_0x1f857d){while(--_0x1f857d){_0x3b6646['push'](_0x3b6646['shift']());}};_0x464ac8(++_0x466c7c);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){ChatMessageEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('chatMessage:'+_0x5a7975,_0x2b7e7c);ChatMessageEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 73c0acc..acf4de4 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 _0x6128=['../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','chat','chatmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0xaa3384,_0x2d409c){var _0x2ef945=function(_0x24c67b){while(--_0x24c67b){_0xaa3384['push'](_0xaa3384['shift']());}};_0x2ef945(++_0x2d409c);}(_0x6128,0x17a));var _0x8612=function(_0x1205b2,_0x1addbd){_0x1205b2=_0x1205b2-0x0;var _0x5c55b7=_0x6128[_0x1205b2];return _0x5c55b7;};'use strict';var multer=require(_0x8612('0x0'));var util=require(_0x8612('0x1'));var path=require(_0x8612('0x2'));var timeout=require('connect-timeout');var express=require(_0x8612('0x3'));var router=express[_0x8612('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8612('0x5'));var config=require(_0x8612('0x6'));var controller=require(_0x8612('0x7'));router[_0x8612('0x8')]('/',auth['isAuthenticated'](),controller[_0x8612('0x9')]);router[_0x8612('0x8')](_0x8612('0xa'),auth[_0x8612('0xb')](),controller[_0x8612('0xc')]);router[_0x8612('0x8')](_0x8612('0xd'),auth[_0x8612('0xb')](),controller['show']);router[_0x8612('0xe')]('/',auth[_0x8612('0xb')](),interaction[_0x8612('0xf')](_0x8612('0x10'),_0x8612('0x11')),controller['create']);router['put']('/:id',controller['update']);router[_0x8612('0x12')](_0x8612('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x8612('0x12')](_0x8612('0x14'),auth['isAuthenticated'](),controller[_0x8612('0x15')]);router['delete'](_0x8612('0xd'),auth[_0x8612('0xb')](),controller[_0x8612('0x16')]);module[_0x8612('0x17')]=router; \ No newline at end of file +var _0x7523=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/reject','reject','delete'];(function(_0x5bc025,_0x553741){var _0x4cf244=function(_0x46a384){while(--_0x46a384){_0x5bc025['push'](_0x5bc025['shift']());}};_0x4cf244(++_0x553741);}(_0x7523,0x152));var _0x3752=function(_0x222913,_0x264f1b){_0x222913=_0x222913-0x0;var _0x5d4b00=_0x7523[_0x222913];return _0x5d4b00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3752('0x0'));var timeout=require(_0x3752('0x1'));var express=require(_0x3752('0x2'));var router=express['Router']();var auth=require(_0x3752('0x3'));var interaction=require(_0x3752('0x4'));var config=require('../../config/environment');var controller=require(_0x3752('0x5'));router[_0x3752('0x6')]('/',auth['isAuthenticated'](),controller[_0x3752('0x7')]);router[_0x3752('0x6')]('/describe',auth[_0x3752('0x8')](),controller[_0x3752('0x9')]);router[_0x3752('0x6')]('/:id',auth[_0x3752('0x8')](),controller[_0x3752('0xa')]);router[_0x3752('0xb')]('/',auth[_0x3752('0x8')](),interaction[_0x3752('0xc')](_0x3752('0xd'),_0x3752('0xe')),controller[_0x3752('0xf')]);router[_0x3752('0x10')](_0x3752('0x11'),controller[_0x3752('0x12')]);router['put']('/:id/accept',auth[_0x3752('0x8')](),controller['accept']);router[_0x3752('0x10')](_0x3752('0x13'),auth[_0x3752('0x8')](),controller[_0x3752('0x14')]);router[_0x3752('0x15')](_0x3752('0x11'),auth['isAuthenticated'](),controller[_0x3752('0x16')]);module[_0x3752('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d7aeb74..76524b9 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 _0xd2c9=['sequelize','exports','TEXT','medium'];(function(_0x1548c9,_0x4aa1ae){var _0x5cb8b5=function(_0x3a787d){while(--_0x3a787d){_0x1548c9['push'](_0x1548c9['shift']());}};_0x5cb8b5(++_0x4aa1ae);}(_0xd2c9,0x1a8));var _0x9d2c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d2c('0x0'));module[_0x9d2c('0x1')]={'body':{'type':Sequelize[_0x9d2c('0x2')](_0x9d2c('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xcbf8=['medium','sequelize','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcbf8,0x121));var _0x8cbf=function(_0x427b63,_0x11f446){_0x427b63=_0x427b63-0x0;var _0x32a211=_0xcbf8[_0x427b63];return _0x32a211;};'use strict';var Sequelize=require(_0x8cbf('0x0'));module['exports']={'body':{'type':Sequelize[_0x8cbf('0x1')](_0x8cbf('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 9ab7fd1..508fee2 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 _0x33a5=['sort','where','filter','VIRTUAL','merge','options','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','query','order'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x33a5,0x180));var _0x533a=function(_0x1d7119,_0x43dd94){_0x1d7119=_0x1d7119-0x0;var _0x2fd750=_0x33a5[_0x1d7119];return _0x2fd750;};'use strict';var pdf=require(_0x533a('0x0'));var emlformat=require(_0x533a('0x1'));var rimraf=require(_0x533a('0x2'));var zipdir=require(_0x533a('0x3'));var jsonpatch=require(_0x533a('0x4'));var rp=require('request-promise');var moment=require(_0x533a('0x5'));var BPromise=require(_0x533a('0x6'));var Mustache=require(_0x533a('0x7'));var util=require(_0x533a('0x8'));var path=require(_0x533a('0x9'));var sox=require(_0x533a('0xa'));var csv=require(_0x533a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x533a('0xc'));var squel=require(_0x533a('0xd'));var crypto=require('crypto');var jsforce=require(_0x533a('0xe'));var deskjs=require(_0x533a('0xf'));var toCsv=require(_0x533a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x533a('0x10'));var qs=require(_0x533a('0x11'));var as=require(_0x533a('0x12'));var hardwareService=require(_0x533a('0x13'));var logger=require(_0x533a('0x14'))(_0x533a('0x15'));var utils=require(_0x533a('0x16'));var config=require(_0x533a('0x17'));var licenseUtil=require(_0x533a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd50489,_0x25565d){_0x25565d=_0x25565d||0xcc;return function(_0x248efd){if(_0x248efd){return _0xd50489[_0x533a('0x19')](_0x25565d);}return _0xd50489['status'](_0x25565d)['end']();};}function respondWithResult(_0x3e829c,_0x38d662){_0x38d662=_0x38d662||0xc8;return function(_0x249785){if(_0x249785){return _0x3e829c[_0x533a('0x1a')](_0x38d662)[_0x533a('0x1b')](_0x249785);}};}function respondWithFilteredResult(_0xaa0bda,_0x2deab5){return function(_0x3d3c2f){if(_0x3d3c2f){var _0x4f3604=_0x3d3c2f[_0x533a('0x1c')],_0x18a6c0=_0x2deab5[_0x533a('0x1d')],_0x51b6bb=_0x2deab5['offset']+_0x2deab5['limit'],_0x592d0d;if(_0x51b6bb>=_0x4f3604){_0x51b6bb=_0x4f3604;_0x592d0d=0xc8;}else{_0x592d0d=0xce;}_0xaa0bda['status'](_0x592d0d);return _0xaa0bda[_0x533a('0x1e')](_0x533a('0x1f'),_0x18a6c0+'-'+_0x51b6bb+'/'+_0x4f3604)[_0x533a('0x1b')](_0x3d3c2f);}return null;};}function patchUpdates(_0x13dbaa){return function(_0x46d304){try{jsonpatch['apply'](_0x46d304,_0x13dbaa,!![]);}catch(_0x4c998e){return BPromise[_0x533a('0x20')](_0x4c998e);}return _0x46d304[_0x533a('0x21')]();};}function saveUpdates(_0x4d738b,_0x4b4793){return function(_0x3297c2){if(_0x3297c2){return _0x3297c2[_0x533a('0x22')](_0x4d738b)['then'](function(_0x114adc){return _0x114adc;});}return null;};}function removeEntity(_0x36ffcb,_0x1fac0d){return function(_0x1d5e61){if(_0x1d5e61){return _0x1d5e61[_0x533a('0x23')]()[_0x533a('0x24')](function(){_0x36ffcb[_0x533a('0x1a')](0xcc)[_0x533a('0x25')]();});}};}function handleEntityNotFound(_0x36d7ce,_0xedfdbb){return function(_0x49400a){if(!_0x49400a){_0x36d7ce[_0x533a('0x19')](0x194);}return _0x49400a;};}function handleError(_0x5035bd,_0x1ac3ab){_0x1ac3ab=_0x1ac3ab||0x1f4;return function(_0x21ab17){logger[_0x533a('0x26')](_0x21ab17[_0x533a('0x27')]);if(_0x21ab17[_0x533a('0x28')]){delete _0x21ab17[_0x533a('0x28')];}_0x5035bd[_0x533a('0x1a')](_0x1ac3ab)[_0x533a('0x29')](_0x21ab17);};}exports['index']=function(_0x1d7fcd,_0x289d80){var _0xf20f={},_0x1b3ee9={},_0x3a1843={'count':0x0,'rows':[]};var _0x168d2c=_[_0x533a('0x2a')](db[_0x533a('0x2b')][_0x533a('0x2c')],function(_0x4e69d9){return{'name':_0x4e69d9[_0x533a('0x2d')],'type':_0x4e69d9[_0x533a('0x2e')][_0x533a('0x2f')]};});_0x1b3ee9[_0x533a('0x30')]=_[_0x533a('0x2a')](_0x168d2c,'name');_0x1b3ee9['query']=_[_0x533a('0x31')](_0x1d7fcd['query']);_0x1b3ee9[_0x533a('0x32')]=_[_0x533a('0x33')](_0x1b3ee9['model'],_0x1b3ee9['query']);_0xf20f[_0x533a('0x34')]=_['intersection'](_0x1b3ee9[_0x533a('0x30')],qs[_0x533a('0x35')](_0x1d7fcd['query']['fields']));_0xf20f[_0x533a('0x34')]=_0xf20f[_0x533a('0x34')][_0x533a('0x36')]?_0xf20f[_0x533a('0x34')]:_0x1b3ee9[_0x533a('0x30')];if(!_0x1d7fcd['query'][_0x533a('0x37')](_0x533a('0x38'))){_0xf20f['limit']=qs[_0x533a('0x39')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x39')]);_0xf20f[_0x533a('0x1d')]=qs[_0x533a('0x1d')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x1d')]);}_0xf20f[_0x533a('0x3b')]=qs[_0x533a('0x3c')](_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x3c')]);_0xf20f[_0x533a('0x3d')]=qs[_0x533a('0x32')](_['pick'](_0x1d7fcd[_0x533a('0x3a')],_0x1b3ee9[_0x533a('0x32')]),_0x168d2c);if(_0x1d7fcd[_0x533a('0x3a')][_0x533a('0x3e')]){_0xf20f[_0x533a('0x3d')]=_['merge'](_0xf20f[_0x533a('0x3d')],{'$or':_[_0x533a('0x2a')](_0x168d2c,function(_0x47eada){if(_0x47eada['type']!==_0x533a('0x3f')){var _0x55a08b={};_0x55a08b[_0x47eada[_0x533a('0x28')]]={'$like':'%'+_0x1d7fcd['query'][_0x533a('0x3e')]+'%'};return _0x55a08b;}})});}_0xf20f=_[_0x533a('0x40')]({},_0xf20f,_0x1d7fcd[_0x533a('0x41')]);var _0x11071f={'where':_0xf20f['where']};return db['ChatOfflineMessage'][_0x533a('0x1c')](_0x11071f)[_0x533a('0x24')](function(_0x461364){_0x3a1843['count']=_0x461364;if(_0x1d7fcd[_0x533a('0x3a')]['includeAll']){_0xf20f['include']=[{'all':!![]}];}return db[_0x533a('0x2b')]['findAll'](_0xf20f);})['then'](function(_0x4f94cb){_0x3a1843['rows']=_0x4f94cb;return _0x3a1843;})[_0x533a('0x24')](respondWithFilteredResult(_0x289d80,_0xf20f))[_0x533a('0x42')](handleError(_0x289d80,null));};exports[_0x533a('0x43')]=function(_0x1e2b4b,_0x4e260f){var _0x26e657={'raw':!![],'where':{'id':_0x1e2b4b[_0x533a('0x44')]['id']}},_0xab0604={};_0xab0604[_0x533a('0x30')]=_[_0x533a('0x31')](db[_0x533a('0x2b')][_0x533a('0x2c')]);_0xab0604[_0x533a('0x3a')]=_['keys'](_0x1e2b4b[_0x533a('0x3a')]);_0xab0604[_0x533a('0x32')]=_[_0x533a('0x33')](_0xab0604[_0x533a('0x30')],_0xab0604['query']);_0x26e657[_0x533a('0x34')]=_[_0x533a('0x33')](_0xab0604[_0x533a('0x30')],qs[_0x533a('0x35')](_0x1e2b4b[_0x533a('0x3a')][_0x533a('0x35')]));_0x26e657[_0x533a('0x34')]=_0x26e657[_0x533a('0x34')][_0x533a('0x36')]?_0x26e657[_0x533a('0x34')]:_0xab0604[_0x533a('0x30')];if(_0x1e2b4b['query']['includeAll']){_0x26e657[_0x533a('0x45')]=[{'all':!![]}];}_0x26e657=_[_0x533a('0x40')]({},_0x26e657,_0x1e2b4b[_0x533a('0x41')]);return db[_0x533a('0x2b')][_0x533a('0x46')](_0x26e657)['then'](handleEntityNotFound(_0x4e260f,null))['then'](respondWithResult(_0x4e260f,null))[_0x533a('0x42')](handleError(_0x4e260f,null));};exports['create']=function(_0x335aae,_0x114dd1){return db[_0x533a('0x2b')][_0x533a('0x47')](_0x335aae[_0x533a('0x48')],{})[_0x533a('0x24')](respondWithResult(_0x114dd1,0xc9))[_0x533a('0x42')](handleError(_0x114dd1,null));};exports[_0x533a('0x22')]=function(_0x558f8,_0x3defd3){if(_0x558f8[_0x533a('0x48')]['id']){delete _0x558f8[_0x533a('0x48')]['id'];}return db[_0x533a('0x2b')][_0x533a('0x46')]({'where':{'id':_0x558f8[_0x533a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3defd3,null))[_0x533a('0x24')](saveUpdates(_0x558f8['body'],null))['then'](respondWithResult(_0x3defd3,null))[_0x533a('0x42')](handleError(_0x3defd3,null));};exports[_0x533a('0x23')]=function(_0x5be481,_0x55a80d){return db[_0x533a('0x2b')][_0x533a('0x46')]({'where':{'id':_0x5be481[_0x533a('0x44')]['id']}})[_0x533a('0x24')](handleEntityNotFound(_0x55a80d,null))[_0x533a('0x24')](removeEntity(_0x55a80d,null))[_0x533a('0x42')](handleError(_0x55a80d,null));};exports[_0x533a('0x49')]=function(_0x1957df,_0x16ee27){return db[_0x533a('0x2b')]['describe']()[_0x533a('0x24')](respondWithResult(_0x16ee27,null))[_0x533a('0x42')](handleError(_0x16ee27,null));}; \ No newline at end of file +var _0xf4f4=['eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','ChatOfflineMessage','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','describe','html-pdf'];(function(_0x5378a1,_0x258b11){var _0x462b69=function(_0x3d4d0e){while(--_0x3d4d0e){_0x5378a1['push'](_0x5378a1['shift']());}};_0x462b69(++_0x258b11);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x59de9b,_0x517095){_0x59de9b=_0x59de9b-0x0;var _0x4f1348=_0xf4f4[_0x59de9b];return _0x4f1348;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=_0x47ab66[_0x4f4f('0x1c')],_0x422894=_0x4c68f4[_0x4f4f('0x1d')],_0x8d65a2=_0x4c68f4[_0x4f4f('0x1d')]+_0x4c68f4[_0x4f4f('0x1e')],_0x2d21ed;if(_0x8d65a2>=_0x58de77){_0x8d65a2=_0x58de77;_0x2d21ed=0xc8;}else{_0x2d21ed=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x2d21ed);return _0x19f2fd[_0x4f4f('0x1f')](_0x4f4f('0x20'),_0x422894+'-'+_0x8d65a2+'/'+_0x58de77)[_0x4f4f('0x21')](_0x47ab66);}return null;};}function patchUpdates(_0x43f43b){return function(_0x499277){try{jsonpatch[_0x4f4f('0x22')](_0x499277,_0x43f43b,!![]);}catch(_0x4622c2){return BPromise[_0x4f4f('0x23')](_0x4622c2);}return _0x499277[_0x4f4f('0x24')]();};}function saveUpdates(_0x302a79,_0x460b4d){return function(_0x2eedcc){if(_0x2eedcc){return _0x2eedcc[_0x4f4f('0x25')](_0x302a79)[_0x4f4f('0x26')](function(_0x2509a8){return _0x2509a8;});}return null;};}function removeEntity(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x27')]()['then'](function(){_0x469a1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272125,_0x43e661){return function(_0x5186ac){if(!_0x5186ac){_0x272125[_0x4f4f('0x28')](0x194);}return _0x5186ac;};}function handleError(_0x15859c,_0xcf19ac){_0xcf19ac=_0xcf19ac||0x1f4;return function(_0x2ec92a){logger[_0x4f4f('0x29')](_0x2ec92a[_0x4f4f('0x2a')]);if(_0x2ec92a[_0x4f4f('0x2b')]){delete _0x2ec92a['name'];}_0x15859c[_0x4f4f('0x1b')](_0xcf19ac)[_0x4f4f('0x2c')](_0x2ec92a);};}exports[_0x4f4f('0x2d')]=function(_0x15c79c,_0x18e864){var _0x4ad33d={},_0x23df57={},_0xaf3de1={'count':0x0,'rows':[]};var _0x7180f8=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x73b8bb){return{'name':_0x73b8bb['fieldName'],'type':_0x73b8bb[_0x4f4f('0x2e')][_0x4f4f('0x2f')]};});_0x23df57[_0x4f4f('0x30')]=_['map'](_0x7180f8,_0x4f4f('0x2b'));_0x23df57[_0x4f4f('0x31')]=_['keys'](_0x15c79c[_0x4f4f('0x31')]);_0x23df57[_0x4f4f('0x32')]=_[_0x4f4f('0x33')](_0x23df57['model'],_0x23df57[_0x4f4f('0x31')]);_0x4ad33d[_0x4f4f('0x34')]=_['intersection'](_0x23df57['model'],qs[_0x4f4f('0x35')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0x4ad33d[_0x4f4f('0x34')]=_0x4ad33d[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0x4ad33d[_0x4f4f('0x34')]:_0x23df57[_0x4f4f('0x30')];if(!_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x37')]('nolimit')){_0x4ad33d['limit']=qs[_0x4f4f('0x1e')](_0x15c79c['query'][_0x4f4f('0x1e')]);_0x4ad33d[_0x4f4f('0x1d')]=qs[_0x4f4f('0x1d')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x1d')]);}_0x4ad33d[_0x4f4f('0x38')]=qs[_0x4f4f('0x39')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x39')]);_0x4ad33d[_0x4f4f('0x3a')]=qs[_0x4f4f('0x32')](_[_0x4f4f('0x3b')](_0x15c79c['query'],_0x23df57[_0x4f4f('0x32')]),_0x7180f8);if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x3c')]){_0x4ad33d[_0x4f4f('0x3a')]=_[_0x4f4f('0x3d')](_0x4ad33d[_0x4f4f('0x3a')],{'$or':_[_0x4f4f('0x3e')](_0x7180f8,function(_0x32b077){if(_0x32b077[_0x4f4f('0x2e')]!=='VIRTUAL'){var _0xbd62c5={};_0xbd62c5[_0x32b077[_0x4f4f('0x2b')]]={'$like':'%'+_0x15c79c[_0x4f4f('0x31')]['filter']+'%'};return _0xbd62c5;}})});}_0x4ad33d=_['merge']({},_0x4ad33d,_0x15c79c[_0x4f4f('0x3f')]);var _0x95a296={'where':_0x4ad33d[_0x4f4f('0x3a')]};return db[_0x4f4f('0x40')][_0x4f4f('0x1c')](_0x95a296)[_0x4f4f('0x26')](function(_0x1c012d){_0xaf3de1[_0x4f4f('0x1c')]=_0x1c012d;if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0x4ad33d[_0x4f4f('0x42')]=[{'all':!![]}];}return db[_0x4f4f('0x40')]['findAll'](_0x4ad33d);})[_0x4f4f('0x26')](function(_0x1b031e){_0xaf3de1[_0x4f4f('0x43')]=_0x1b031e;return _0xaf3de1;})[_0x4f4f('0x26')](respondWithFilteredResult(_0x18e864,_0x4ad33d))[_0x4f4f('0x44')](handleError(_0x18e864,null));};exports['show']=function(_0x5c06a1,_0x134710){var _0xa070ad={'raw':!![],'where':{'id':_0x5c06a1[_0x4f4f('0x45')]['id']}},_0x2064e9={};_0x2064e9['model']=_[_0x4f4f('0x46')](db['ChatOfflineMessage'][_0x4f4f('0x47')]);_0x2064e9['query']=_['keys'](_0x5c06a1[_0x4f4f('0x31')]);_0x2064e9['filters']=_[_0x4f4f('0x33')](_0x2064e9[_0x4f4f('0x30')],_0x2064e9['query']);_0xa070ad[_0x4f4f('0x34')]=_[_0x4f4f('0x33')](_0x2064e9['model'],qs[_0x4f4f('0x35')](_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0xa070ad[_0x4f4f('0x34')]=_0xa070ad[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0xa070ad[_0x4f4f('0x34')]:_0x2064e9[_0x4f4f('0x30')];if(_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0xa070ad[_0x4f4f('0x42')]=[{'all':!![]}];}_0xa070ad=_[_0x4f4f('0x3d')]({},_0xa070ad,_0x5c06a1[_0x4f4f('0x3f')]);return db[_0x4f4f('0x40')][_0x4f4f('0x48')](_0xa070ad)['then'](handleEntityNotFound(_0x134710,null))[_0x4f4f('0x26')](respondWithResult(_0x134710,null))['catch'](handleError(_0x134710,null));};exports['create']=function(_0x31349a,_0x4363c9){return db['ChatOfflineMessage'][_0x4f4f('0x49')](_0x31349a[_0x4f4f('0x4a')],{})[_0x4f4f('0x26')](respondWithResult(_0x4363c9,0xc9))[_0x4f4f('0x44')](handleError(_0x4363c9,null));};exports[_0x4f4f('0x25')]=function(_0x545dd6,_0xd4625a){if(_0x545dd6[_0x4f4f('0x4a')]['id']){delete _0x545dd6[_0x4f4f('0x4a')]['id'];}return db[_0x4f4f('0x40')][_0x4f4f('0x48')]({'where':{'id':_0x545dd6[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0xd4625a,null))[_0x4f4f('0x26')](saveUpdates(_0x545dd6[_0x4f4f('0x4a')],null))['then'](respondWithResult(_0xd4625a,null))[_0x4f4f('0x44')](handleError(_0xd4625a,null));};exports[_0x4f4f('0x27')]=function(_0x4b33a5,_0x5ac4df){return db['ChatOfflineMessage'][_0x4f4f('0x48')]({'where':{'id':_0x4b33a5[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x5ac4df,null))['then'](removeEntity(_0x5ac4df,null))[_0x4f4f('0x44')](handleError(_0x5ac4df,null));};exports['describe']=function(_0xf13a0,_0x1c181e){return db[_0x4f4f('0x40')][_0x4f4f('0x4b')]()[_0x4f4f('0x26')](respondWithResult(_0x1c181e,null))[_0x4f4f('0x44')](handleError(_0x1c181e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2492b60..4fc5c21 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x303a=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','lodash','../../config/logger','api','moment'];(function(_0x36fbe0,_0x447b3c){var _0x2e0727=function(_0x54ccff){while(--_0x54ccff){_0x36fbe0['push'](_0x36fbe0['shift']());}};_0x2e0727(++_0x447b3c);}(_0x303a,0x1a0));var _0xa303=function(_0x19f183,_0x540981){_0x19f183=_0x19f183-0x0;var _0x317275=_0x303a[_0x19f183];return _0x317275;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5636=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1da63d,_0x10a600){var _0xd41645=function(_0x371afa){while(--_0x371afa){_0x1da63d['push'](_0x1da63d['shift']());}};_0xd41645(++_0x10a600);}(_0x5636,0x102));var _0x6563=function(_0x20005c,_0xdb2d77){_0x20005c=_0x20005c-0x0;var _0x39d7ef=_0x5636[_0x20005c];return _0x39d7ef;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6563('0xb'),'collate':_0x6563('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0edaaf6..cbdd8a5 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 _0xf6a5=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x5e4611,_0x450168){var _0x76346e=function(_0x13369f){while(--_0x13369f){_0x5e4611['push'](_0x5e4611['shift']());}};_0x76346e(++_0x450168);}(_0xf6a5,0x116));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f6a('0x0'));var util=require(_0x5f6a('0x1'));var moment=require(_0x5f6a('0x2'));var BPromise=require(_0x5f6a('0x3'));var rs=require(_0x5f6a('0x4'));var fs=require('fs');var Redis=require(_0x5f6a('0x5'));var db=require(_0x5f6a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f6a('0x7'));var jayson=require(_0x5f6a('0x8'));var client=jayson[_0x5f6a('0x9')][_0x5f6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc369b6,_0x1b22ee,_0xf1e514){return new BPromise(function(_0x55fff7,_0x2e64e6){return client[_0x5f6a('0xb')](_0xc369b6,_0xf1e514)[_0x5f6a('0xc')](function(_0x43c8ed){logger[_0x5f6a('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,'request\x20sent');logger[_0x5f6a('0xe')](_0x5f6a('0xf'),_0x1b22ee,_0x5f6a('0x10'),JSON[_0x5f6a('0x11')](_0x43c8ed));if(_0x43c8ed[_0x5f6a('0x12')]){if(_0x43c8ed[_0x5f6a('0x12')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);return _0x2e64e6(_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);}logger[_0x5f6a('0x12')](_0x5f6a('0x14'),_0x1b22ee,_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);return _0x55fff7(_0x43c8ed[_0x5f6a('0x12')][_0x5f6a('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b22ee,_0x5f6a('0x10'));_0x55fff7(_0x43c8ed[_0x5f6a('0x15')][_0x5f6a('0x13')]);}})[_0x5f6a('0x16')](function(_0x5ec8c7){logger[_0x5f6a('0x12')](_0x5f6a('0x14'),_0x1b22ee,_0x5ec8c7);_0x2e64e6(_0x5ec8c7);});});} \ No newline at end of file +var _0x9ec2=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9ec2,0xda));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x29ec('0x0'));var util=require(_0x29ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29ec('0x2'));var fs=require('fs');var Redis=require(_0x29ec('0x3'));var db=require(_0x29ec('0x4'))['db'];var utils=require(_0x29ec('0x5'));var logger=require(_0x29ec('0x6'))(_0x29ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x29ec('0x8'));var client=jayson[_0x29ec('0x9')][_0x29ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x302ce0,_0x1ce55d,_0x1dc540){return new BPromise(function(_0x5b5885,_0x481db4){return client[_0x29ec('0xb')](_0x302ce0,_0x1dc540)[_0x29ec('0xc')](function(_0x556fe3){logger[_0x29ec('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x29ec('0xe'));logger[_0x29ec('0xf')](_0x29ec('0x10'),_0x1ce55d,_0x29ec('0xe'),JSON['stringify'](_0x556fe3));if(_0x556fe3[_0x29ec('0x11')]){if(_0x556fe3['error'][_0x29ec('0x12')]===0x1f4){logger['error'](_0x29ec('0x13'),_0x1ce55d,_0x556fe3[_0x29ec('0x11')]['message']);return _0x481db4(_0x556fe3['error']['message']);}logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x1ce55d,_0x556fe3[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x5b5885(_0x556fe3[_0x29ec('0x11')][_0x29ec('0x14')]);}else{logger[_0x29ec('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x29ec('0xe'));_0x5b5885(_0x556fe3[_0x29ec('0x15')][_0x29ec('0x14')]);}})[_0x29ec('0x16')](function(_0x15439f){logger[_0x29ec('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x15439f);_0x481db4(_0x15439f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 72b075a..59e506e 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 _0xac7f=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete'];(function(_0x2d4a23,_0x3301b9){var _0x73659d=function(_0x228267){while(--_0x228267){_0x2d4a23['push'](_0x2d4a23['shift']());}};_0x73659d(++_0x3301b9);}(_0xac7f,0x190));var _0xfac7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xac7f[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require(_0xfac7('0x0'));var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express[_0xfac7('0x4')]();var auth=require(_0xfac7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfac7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfac7('0x7')]);router[_0xfac7('0x8')](_0xfac7('0x9'),auth[_0xfac7('0xa')](),controller[_0xfac7('0xb')]);router[_0xfac7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfac7('0xc')]);router[_0xfac7('0xd')]('/',auth[_0xfac7('0xa')](),controller[_0xfac7('0xe')]);router['put'](_0xfac7('0xf'),auth[_0xfac7('0xa')](),controller[_0xfac7('0x10')]);router[_0xfac7('0x11')]('/:id',auth[_0xfac7('0xa')](),controller['destroy']);module[_0xfac7('0x12')]=router; \ No newline at end of file +var _0xc3e5=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x406b9c,_0x400dd0){var _0x24389b=function(_0x193383){while(--_0x193383){_0x406b9c['push'](_0x406b9c['shift']());}};_0x24389b(++_0x400dd0);}(_0xc3e5,0x107));var _0x5c3e=function(_0x38e3b9,_0x5109ac){_0x38e3b9=_0x38e3b9-0x0;var _0x194d19=_0xc3e5[_0x38e3b9];return _0x194d19;};'use strict';var multer=require('multer');var util=require(_0x5c3e('0x0'));var path=require(_0x5c3e('0x1'));var timeout=require(_0x5c3e('0x2'));var express=require(_0x5c3e('0x3'));var router=express['Router']();var auth=require(_0x5c3e('0x4'));var interaction=require(_0x5c3e('0x5'));var config=require(_0x5c3e('0x6'));var controller=require(_0x5c3e('0x7'));router[_0x5c3e('0x8')]('/',auth[_0x5c3e('0x9')](),controller['index']);router[_0x5c3e('0x8')](_0x5c3e('0xa'),auth[_0x5c3e('0x9')](),controller[_0x5c3e('0xb')]);router[_0x5c3e('0x8')](_0x5c3e('0xc'),auth['isAuthenticated'](),controller[_0x5c3e('0xd')]);router[_0x5c3e('0xe')]('/',auth[_0x5c3e('0x9')](),controller['create']);router['put']('/:id',auth[_0x5c3e('0x9')](),controller[_0x5c3e('0xf')]);router[_0x5c3e('0x10')](_0x5c3e('0xc'),auth[_0x5c3e('0x9')](),controller[_0x5c3e('0x11')]);module[_0x5c3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index eb4d826..c4fe76b 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 _0xa315=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x3c44ff,_0x5bf30a){var _0x3627b4=function(_0x582c00){while(--_0x582c00){_0x3c44ff['push'](_0x3c44ff['shift']());}};_0x3627b4(++_0x5bf30a);}(_0xa315,0xd2));var _0x5a31=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xa315[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0x5a31('0x0'));module[_0x5a31('0x1')]={'name':{'type':Sequelize[_0x5a31('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5a31('0x3')](_0x5a31('0x4'),_0x5a31('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5a31('0x6')]}}; \ No newline at end of file +var _0xbca5=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x1eb326,_0x53c40b){var _0x468d1c=function(_0x33fa68){while(--_0x33fa68){_0x1eb326['push'](_0x1eb326['shift']());}};_0x468d1c(++_0x53c40b);}(_0xbca5,0xba));var _0x5bca=function(_0x527228,_0x2bf9d1){_0x527228=_0x527228-0x0;var _0x18fc82=_0xbca5[_0x527228];return _0x18fc82;};'use strict';var Sequelize=require(_0x5bca('0x0'));module[_0x5bca('0x1')]={'name':{'type':Sequelize[_0x5bca('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bca('0x3')](_0x5bca('0x4'),_0x5bca('0x5')),'defaultValue':_0x5bca('0x4')},'selector':{'type':Sequelize[_0x5bca('0x2')]},'timeout':{'type':Sequelize[_0x5bca('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 6e51d4d..11b3b4b 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 _0x7eec=['options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','fields','attributes','include','merge'];(function(_0x58d3c7,_0x3fd69e){var _0x14b6ea=function(_0x3cbedc){while(--_0x3cbedc){_0x58d3c7['push'](_0x58d3c7['shift']());}};_0x14b6ea(++_0x3fd69e);}(_0x7eec,0x132));var _0xc7ee=function(_0x4d389b,_0x4e8b97){_0x4d389b=_0x4d389b-0x0;var _0x34a089=_0x7eec[_0x4d389b];return _0x34a089;};'use strict';var pdf=require(_0xc7ee('0x0'));var emlformat=require(_0xc7ee('0x1'));var rimraf=require(_0xc7ee('0x2'));var zipdir=require(_0xc7ee('0x3'));var jsonpatch=require(_0xc7ee('0x4'));var rp=require(_0xc7ee('0x5'));var moment=require(_0xc7ee('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc7ee('0x7'));var util=require('util');var path=require(_0xc7ee('0x8'));var sox=require(_0xc7ee('0x9'));var csv=require(_0xc7ee('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc7ee('0xb'));var squel=require('squel');var crypto=require(_0xc7ee('0xc'));var jsforce=require(_0xc7ee('0xd'));var deskjs=require(_0xc7ee('0xe'));var toCsv=require(_0xc7ee('0xa'));var querystring=require(_0xc7ee('0xf'));var Papa=require('papaparse');var Redis=require(_0xc7ee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc7ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7ee('0x12'));var logger=require(_0xc7ee('0x13'))(_0xc7ee('0x14'));var utils=require(_0xc7ee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7ee('0x16'));var db=require(_0xc7ee('0x17'))['db'];function respondWithStatusCode(_0x407b16,_0x2b24a6){_0x2b24a6=_0x2b24a6||0xcc;return function(_0x2ba850){if(_0x2ba850){return _0x407b16[_0xc7ee('0x18')](_0x2b24a6);}return _0x407b16[_0xc7ee('0x19')](_0x2b24a6)[_0xc7ee('0x1a')]();};}function respondWithResult(_0x36935e,_0x2e2ff8){_0x2e2ff8=_0x2e2ff8||0xc8;return function(_0x3ca1ce){if(_0x3ca1ce){return _0x36935e[_0xc7ee('0x19')](_0x2e2ff8)[_0xc7ee('0x1b')](_0x3ca1ce);}};}function respondWithFilteredResult(_0x14a982,_0x171aa8){return function(_0x4e4c25){if(_0x4e4c25){var _0x25dd15=_0x4e4c25[_0xc7ee('0x1c')],_0x48fc80=_0x171aa8[_0xc7ee('0x1d')],_0x81958=_0x171aa8[_0xc7ee('0x1d')]+_0x171aa8['limit'],_0x4c8a72;if(_0x81958>=_0x25dd15){_0x81958=_0x25dd15;_0x4c8a72=0xc8;}else{_0x4c8a72=0xce;}_0x14a982[_0xc7ee('0x19')](_0x4c8a72);return _0x14a982[_0xc7ee('0x1e')](_0xc7ee('0x1f'),_0x48fc80+'-'+_0x81958+'/'+_0x25dd15)[_0xc7ee('0x1b')](_0x4e4c25);}return null;};}function patchUpdates(_0x29eded){return function(_0x58314d){try{jsonpatch[_0xc7ee('0x20')](_0x58314d,_0x29eded,!![]);}catch(_0x19c1de){return BPromise[_0xc7ee('0x21')](_0x19c1de);}return _0x58314d[_0xc7ee('0x22')]();};}function saveUpdates(_0x431d87,_0x55a6ad){return function(_0x2c9eff){if(_0x2c9eff){return _0x2c9eff[_0xc7ee('0x23')](_0x431d87)['then'](function(_0x3db280){return _0x3db280;});}return null;};}function removeEntity(_0x30b2af,_0x56b3da){return function(_0x261923){if(_0x261923){return _0x261923[_0xc7ee('0x24')]()[_0xc7ee('0x25')](function(){_0x30b2af[_0xc7ee('0x19')](0xcc)[_0xc7ee('0x1a')]();});}};}function handleEntityNotFound(_0x568adb,_0x161ef8){return function(_0x5774cb){if(!_0x5774cb){_0x568adb[_0xc7ee('0x18')](0x194);}return _0x5774cb;};}function handleError(_0xe0f6bf,_0x248cb5){_0x248cb5=_0x248cb5||0x1f4;return function(_0x18debd){logger[_0xc7ee('0x26')](_0x18debd[_0xc7ee('0x27')]);if(_0x18debd['name']){delete _0x18debd[_0xc7ee('0x28')];}_0xe0f6bf[_0xc7ee('0x19')](_0x248cb5)[_0xc7ee('0x29')](_0x18debd);};}exports[_0xc7ee('0x2a')]=function(_0x3508d3,_0x4052c8){var _0x21a954={'raw':!![],'where':{'id':_0x3508d3[_0xc7ee('0x2b')]['id']}},_0x501756={};_0x501756[_0xc7ee('0x2c')]=_['keys'](db['ChatProactiveAction'][_0xc7ee('0x2d')]);_0x501756[_0xc7ee('0x2e')]=_[_0xc7ee('0x2f')](_0x3508d3[_0xc7ee('0x2e')]);_0x501756[_0xc7ee('0x30')]=_[_0xc7ee('0x31')](_0x501756[_0xc7ee('0x2c')],_0x501756[_0xc7ee('0x2e')]);_0x21a954['attributes']=_[_0xc7ee('0x31')](_0x501756[_0xc7ee('0x2c')],qs[_0xc7ee('0x32')](_0x3508d3[_0xc7ee('0x2e')]['fields']));_0x21a954[_0xc7ee('0x33')]=_0x21a954['attributes']['length']?_0x21a954['attributes']:_0x501756['model'];if(_0x3508d3['query']['includeAll']){_0x21a954[_0xc7ee('0x34')]=[{'all':!![]}];}_0x21a954=_[_0xc7ee('0x35')]({},_0x21a954,_0x3508d3[_0xc7ee('0x36')]);return db[_0xc7ee('0x37')][_0xc7ee('0x38')](_0x21a954)[_0xc7ee('0x25')](handleEntityNotFound(_0x4052c8,null))[_0xc7ee('0x25')](respondWithResult(_0x4052c8,null))[_0xc7ee('0x39')](handleError(_0x4052c8,null));};exports[_0xc7ee('0x3a')]=function(_0x36d287,_0x24fef0){return db[_0xc7ee('0x37')][_0xc7ee('0x3a')](_0x36d287['body'],{})[_0xc7ee('0x25')](respondWithResult(_0x24fef0,0xc9))['catch'](handleError(_0x24fef0,null));};exports['update']=function(_0x3623a5,_0x55d087){if(_0x3623a5[_0xc7ee('0x3b')]['id']){delete _0x3623a5[_0xc7ee('0x3b')]['id'];}return db[_0xc7ee('0x37')][_0xc7ee('0x38')]({'where':{'id':_0x3623a5[_0xc7ee('0x2b')]['id']}})[_0xc7ee('0x25')](handleEntityNotFound(_0x55d087,null))[_0xc7ee('0x25')](saveUpdates(_0x3623a5[_0xc7ee('0x3b')],null))[_0xc7ee('0x25')](respondWithResult(_0x55d087,null))[_0xc7ee('0x39')](handleError(_0x55d087,null));};exports[_0xc7ee('0x24')]=function(_0x2b9882,_0x4d9313){return db[_0xc7ee('0x37')]['find']({'where':{'id':_0x2b9882[_0xc7ee('0x2b')]['id']}})[_0xc7ee('0x25')](handleEntityNotFound(_0x4d9313,null))[_0xc7ee('0x25')](removeEntity(_0x4d9313,null))[_0xc7ee('0x39')](handleError(_0x4d9313,null));}; \ No newline at end of file +var _0xbcac=['count','offset','limit','Content-Range','apply','save','update','destroy','then','end','error','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x513743,_0x57dd3){var _0x3509f8=function(_0x2d9556){while(--_0x2d9556){_0x513743['push'](_0x513743['shift']());}};_0x3509f8(++_0x57dd3);}(_0xbcac,0x111));var _0xcbca=function(_0x436624,_0x1aaf79){_0x436624=_0x436624-0x0;var _0x4473ba=_0xbcac[_0x436624];return _0x4473ba;};'use strict';var pdf=require(_0xcbca('0x0'));var emlformat=require(_0xcbca('0x1'));var rimraf=require(_0xcbca('0x2'));var zipdir=require(_0xcbca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcbca('0x4'));var BPromise=require(_0xcbca('0x5'));var Mustache=require(_0xcbca('0x6'));var util=require(_0xcbca('0x7'));var path=require(_0xcbca('0x8'));var sox=require(_0xcbca('0x9'));var csv=require(_0xcbca('0xa'));var ejs=require(_0xcbca('0xb'));var fs=require('fs');var _=require(_0xcbca('0xc'));var squel=require('squel');var crypto=require(_0xcbca('0xd'));var jsforce=require(_0xcbca('0xe'));var deskjs=require(_0xcbca('0xf'));var toCsv=require(_0xcbca('0xa'));var querystring=require(_0xcbca('0x10'));var Papa=require(_0xcbca('0x11'));var Redis=require(_0xcbca('0x12'));var authService=require(_0xcbca('0x13'));var qs=require(_0xcbca('0x14'));var as=require(_0xcbca('0x15'));var hardwareService=require(_0xcbca('0x16'));var logger=require(_0xcbca('0x17'))(_0xcbca('0x18'));var utils=require(_0xcbca('0x19'));var config=require(_0xcbca('0x1a'));var licenseUtil=require(_0xcbca('0x1b'));var db=require(_0xcbca('0x1c'))['db'];function respondWithStatusCode(_0xae0070,_0x46397a){_0x46397a=_0x46397a||0xcc;return function(_0xb1a466){if(_0xb1a466){return _0xae0070[_0xcbca('0x1d')](_0x46397a);}return _0xae0070[_0xcbca('0x1e')](_0x46397a)['end']();};}function respondWithResult(_0x8df3eb,_0x2a58cc){_0x2a58cc=_0x2a58cc||0xc8;return function(_0x229b1b){if(_0x229b1b){return _0x8df3eb[_0xcbca('0x1e')](_0x2a58cc)[_0xcbca('0x1f')](_0x229b1b);}};}function respondWithFilteredResult(_0x406999,_0xacd950){return function(_0x31b4d0){if(_0x31b4d0){var _0x1444df=_0x31b4d0[_0xcbca('0x20')],_0xfc6004=_0xacd950[_0xcbca('0x21')],_0x1f09d4=_0xacd950[_0xcbca('0x21')]+_0xacd950[_0xcbca('0x22')],_0x416f0c;if(_0x1f09d4>=_0x1444df){_0x1f09d4=_0x1444df;_0x416f0c=0xc8;}else{_0x416f0c=0xce;}_0x406999[_0xcbca('0x1e')](_0x416f0c);return _0x406999['set'](_0xcbca('0x23'),_0xfc6004+'-'+_0x1f09d4+'/'+_0x1444df)[_0xcbca('0x1f')](_0x31b4d0);}return null;};}function patchUpdates(_0x132644){return function(_0x481a00){try{jsonpatch[_0xcbca('0x24')](_0x481a00,_0x132644,!![]);}catch(_0x268f48){return BPromise['reject'](_0x268f48);}return _0x481a00[_0xcbca('0x25')]();};}function saveUpdates(_0x31e55a,_0x10fdc1){return function(_0x169641){if(_0x169641){return _0x169641[_0xcbca('0x26')](_0x31e55a)['then'](function(_0x513552){return _0x513552;});}return null;};}function removeEntity(_0x49cd87,_0x190830){return function(_0x1e913c){if(_0x1e913c){return _0x1e913c[_0xcbca('0x27')]()[_0xcbca('0x28')](function(){_0x49cd87[_0xcbca('0x1e')](0xcc)[_0xcbca('0x29')]();});}};}function handleEntityNotFound(_0x48bde1,_0x4435cb){return function(_0x23436d){if(!_0x23436d){_0x48bde1['sendStatus'](0x194);}return _0x23436d;};}function handleError(_0x5071e5,_0x4c65e9){_0x4c65e9=_0x4c65e9||0x1f4;return function(_0x487130){logger[_0xcbca('0x2a')](_0x487130['stack']);if(_0x487130[_0xcbca('0x2b')]){delete _0x487130[_0xcbca('0x2b')];}_0x5071e5['status'](_0x4c65e9)[_0xcbca('0x2c')](_0x487130);};}exports[_0xcbca('0x2d')]=function(_0x5123ad,_0x204854){var _0x53a923={'raw':!![],'where':{'id':_0x5123ad[_0xcbca('0x2e')]['id']}},_0x46a87d={};_0x46a87d[_0xcbca('0x2f')]=_['keys'](db[_0xcbca('0x30')][_0xcbca('0x31')]);_0x46a87d[_0xcbca('0x32')]=_['keys'](_0x5123ad['query']);_0x46a87d[_0xcbca('0x33')]=_[_0xcbca('0x34')](_0x46a87d[_0xcbca('0x2f')],_0x46a87d[_0xcbca('0x32')]);_0x53a923[_0xcbca('0x35')]=_[_0xcbca('0x34')](_0x46a87d[_0xcbca('0x2f')],qs['fields'](_0x5123ad[_0xcbca('0x32')][_0xcbca('0x36')]));_0x53a923['attributes']=_0x53a923[_0xcbca('0x35')][_0xcbca('0x37')]?_0x53a923[_0xcbca('0x35')]:_0x46a87d[_0xcbca('0x2f')];if(_0x5123ad['query']['includeAll']){_0x53a923['include']=[{'all':!![]}];}_0x53a923=_[_0xcbca('0x38')]({},_0x53a923,_0x5123ad['options']);return db[_0xcbca('0x30')][_0xcbca('0x39')](_0x53a923)['then'](handleEntityNotFound(_0x204854,null))['then'](respondWithResult(_0x204854,null))[_0xcbca('0x3a')](handleError(_0x204854,null));};exports[_0xcbca('0x3b')]=function(_0x2db689,_0x180357){return db['ChatProactiveAction'][_0xcbca('0x3b')](_0x2db689[_0xcbca('0x3c')],{})[_0xcbca('0x28')](respondWithResult(_0x180357,0xc9))[_0xcbca('0x3a')](handleError(_0x180357,null));};exports['update']=function(_0x3becc8,_0x485768){if(_0x3becc8[_0xcbca('0x3c')]['id']){delete _0x3becc8[_0xcbca('0x3c')]['id'];}return db[_0xcbca('0x30')][_0xcbca('0x39')]({'where':{'id':_0x3becc8[_0xcbca('0x2e')]['id']}})[_0xcbca('0x28')](handleEntityNotFound(_0x485768,null))[_0xcbca('0x28')](saveUpdates(_0x3becc8[_0xcbca('0x3c')],null))[_0xcbca('0x28')](respondWithResult(_0x485768,null))[_0xcbca('0x3a')](handleError(_0x485768,null));};exports[_0xcbca('0x27')]=function(_0x2a14be,_0x427599){return db[_0xcbca('0x30')][_0xcbca('0x39')]({'where':{'id':_0x2a14be['params']['id']}})[_0xcbca('0x28')](handleEntityNotFound(_0x427599,null))[_0xcbca('0x28')](removeEntity(_0x427599,null))[_0xcbca('0x3a')](handleError(_0x427599,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1d7aaff..379bf9a 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 _0xa67c=['request-promise','path','rimraf','../../config/environment','ChatProactiveAction','lodash','../../config/logger','api','bluebird'];(function(_0x4b6c08,_0x51473c){var _0x53b1bb=function(_0x47822){while(--_0x47822){_0x4b6c08['push'](_0x4b6c08['shift']());}};_0x53b1bb(++_0x51473c);}(_0xa67c,0x1eb));var _0xca67=function(_0x12f911,_0x4b7cc2){_0x12f911=_0x12f911-0x0;var _0xda369f=_0xa67c[_0x12f911];return _0xda369f;};'use strict';var _=require(_0xca67('0x0'));var util=require('util');var logger=require(_0xca67('0x1'))(_0xca67('0x2'));var moment=require('moment');var BPromise=require(_0xca67('0x3'));var rp=require(_0xca67('0x4'));var fs=require('fs');var path=require(_0xca67('0x5'));var rimraf=require(_0xca67('0x6'));var config=require(_0xca67('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x153c02,_0x3d9582){return _0x153c02['define'](_0xca67('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdc7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x4d1828,_0x103c6b){var _0x32a374=function(_0x1a73f0){while(--_0x1a73f0){_0x4d1828['push'](_0x4d1828['shift']());}};_0x32a374(++_0x103c6b);}(_0xfdc7,0x1d9));var _0x7fdc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xfdc7[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7fdc('0x0'));var moment=require(_0x7fdc('0x1'));var BPromise=require(_0x7fdc('0x2'));var rp=require(_0x7fdc('0x3'));var fs=require('fs');var path=require(_0x7fdc('0x4'));var rimraf=require(_0x7fdc('0x5'));var config=require(_0x7fdc('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x7fdc('0x7')]=function(_0x523003,_0x49ba9c){return _0x523003[_0x7fdc('0x8')](_0x7fdc('0x9'),attributes,{'tableName':_0x7fdc('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 e8744b5..cebfcc9 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 _0x57b3=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x57b3,0x13e));var _0x357b=function(_0x21f595,_0x4b32b6){_0x21f595=_0x21f595-0x0;var _0x5bafbb=_0x57b3[_0x21f595];return _0x5bafbb;};'use strict';var _=require(_0x357b('0x0'));var util=require('util');var moment=require(_0x357b('0x1'));var BPromise=require(_0x357b('0x2'));var rs=require(_0x357b('0x3'));var fs=require('fs');var Redis=require(_0x357b('0x4'));var db=require(_0x357b('0x5'))['db'];var utils=require(_0x357b('0x6'));var logger=require(_0x357b('0x7'))('rpc');var config=require(_0x357b('0x8'));var jayson=require(_0x357b('0x9'));var client=jayson[_0x357b('0xa')][_0x357b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e213,_0x1be68a,_0x152e27){return new BPromise(function(_0x4e5df4,_0x24a58e){return client['request'](_0x42e213,_0x152e27)[_0x357b('0xc')](function(_0x308b57){logger[_0x357b('0xd')](_0x357b('0xe'),_0x1be68a,_0x357b('0xf'));logger['debug'](_0x357b('0x10'),_0x1be68a,_0x357b('0xf'),JSON[_0x357b('0x11')](_0x308b57));if(_0x308b57['error']){if(_0x308b57[_0x357b('0x12')]['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1be68a,_0x308b57['error'][_0x357b('0x13')]);return _0x24a58e(_0x308b57['error'][_0x357b('0x13')]);}logger[_0x357b('0x12')](_0x357b('0xe'),_0x1be68a,_0x308b57[_0x357b('0x12')][_0x357b('0x13')]);return _0x4e5df4(_0x308b57[_0x357b('0x12')][_0x357b('0x13')]);}else{logger[_0x357b('0xd')](_0x357b('0xe'),_0x1be68a,_0x357b('0xf'));_0x4e5df4(_0x308b57['result']['message']);}})[_0x357b('0x14')](function(_0x3ec11f){logger[_0x357b('0x12')](_0x357b('0xe'),_0x1be68a,_0x3ec11f);_0x24a58e(_0x3ec11f);});});} \ No newline at end of file +var _0x10e7=['message','ChatProactiveAction,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10e7,0x147));var _0x710e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x10e7[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x710e('0x0'));var BPromise=require('bluebird');var rs=require(_0x710e('0x1'));var fs=require('fs');var Redis=require(_0x710e('0x2'));var db=require(_0x710e('0x3'))['db'];var utils=require(_0x710e('0x4'));var logger=require(_0x710e('0x5'))(_0x710e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x710e('0x7')][_0x710e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d139,_0x47f2ff,_0x1c6535){return new BPromise(function(_0x38cdb3,_0x5110f9){return client['request'](_0x31d139,_0x1c6535)[_0x710e('0x9')](function(_0x3d8f5f){logger[_0x710e('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x710e('0xb'));logger['debug'](_0x710e('0xc'),_0x47f2ff,_0x710e('0xb'),JSON['stringify'](_0x3d8f5f));if(_0x3d8f5f[_0x710e('0xd')]){if(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xe')]===0x1f4){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);return _0x5110f9(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}logger[_0x710e('0xd')](_0x710e('0x10'),_0x47f2ff,_0x3d8f5f['error'][_0x710e('0xf')]);return _0x38cdb3(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}else{logger[_0x710e('0xa')](_0x710e('0x10'),_0x47f2ff,_0x710e('0xb'));_0x38cdb3(_0x3d8f5f[_0x710e('0x11')]['message']);}})[_0x710e('0x12')](function(_0x585d7a){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x585d7a);_0x5110f9(_0x585d7a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 13f3e6a..3ce233e 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 _0xf725=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xf725,0x7e));var _0x5f72=function(_0x186cf7,_0x1de895){_0x186cf7=_0x186cf7-0x0;var _0x14202f=_0xf725[_0x186cf7];return _0x14202f;};'use strict';var multer=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var path=require(_0x5f72('0x2'));var timeout=require(_0x5f72('0x3'));var express=require(_0x5f72('0x4'));var router=express[_0x5f72('0x5')]();var auth=require(_0x5f72('0x6'));var interaction=require(_0x5f72('0x7'));var config=require(_0x5f72('0x8'));var controller=require(_0x5f72('0x9'));router['get'](_0x5f72('0xa'),auth[_0x5f72('0xb')](),controller[_0x5f72('0xc')]);router[_0x5f72('0xd')]('/',auth[_0x5f72('0xb')](),controller[_0x5f72('0xe')]);router[_0x5f72('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5f72('0x10')]);router[_0x5f72('0x11')]('/:id',auth[_0x5f72('0xb')](),controller[_0x5f72('0x12')]);module['exports']=router; \ No newline at end of file +var _0x67f5=['/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1c2cd7,_0x4ec333){var _0x2a46f9=function(_0x46bd9c){while(--_0x46bd9c){_0x1c2cd7['push'](_0x1c2cd7['shift']());}};_0x2a46f9(++_0x4ec333);}(_0x67f5,0x99));var _0x567f=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x67f5[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x567f('0x0'));var util=require(_0x567f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x567f('0x2'));var router=express[_0x567f('0x3')]();var auth=require(_0x567f('0x4'));var interaction=require(_0x567f('0x5'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x567f('0x6')](_0x567f('0x7'),auth['isAuthenticated'](),controller[_0x567f('0x8')]);router[_0x567f('0x9')]('/',auth[_0x567f('0xa')](),controller['create']);router[_0x567f('0xb')](_0x567f('0x7'),auth[_0x567f('0xa')](),controller[_0x567f('0xc')]);router[_0x567f('0xd')](_0x567f('0x7'),auth[_0x567f('0xa')](),controller[_0x567f('0xe')]);module[_0x567f('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index bd1c078..ab587f1 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 _0x8c2b=['INTEGER','ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x16247f,_0x1909df){var _0x93822a=function(_0x3cf991){while(--_0x3cf991){_0x16247f['push'](_0x16247f['shift']());}};_0x93822a(++_0x1909df);}(_0x8c2b,0x8f));var _0xb8c2=function(_0xd1021,_0x59249a){_0xd1021=_0xd1021-0x0;var _0x3de50d=_0x8c2b[_0xd1021];return _0x3de50d;};'use strict';var Sequelize=require(_0xb8c2('0x0'));module[_0xb8c2('0x1')]={'name':{'type':Sequelize[_0xb8c2('0x2')],'unique':_0xb8c2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb8c2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb8c2('0x5')]('rrmemory',_0xb8c2('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x25cc=['STRING','INTEGER','ENUM','rrmemory','exports'];(function(_0x4815f4,_0x17ad21){var _0x33b6b2=function(_0x53a917){while(--_0x53a917){_0x4815f4['push'](_0x4815f4['shift']());}};_0x33b6b2(++_0x17ad21);}(_0x25cc,0xe5));var _0xc25c=function(_0x4e897e,_0x5970fe){_0x4e897e=_0x4e897e-0x0;var _0x5d39cc=_0x25cc[_0x4e897e];return _0x5d39cc;};'use strict';var Sequelize=require('sequelize');module[_0xc25c('0x0')]={'name':{'type':Sequelize[_0xc25c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc25c('0x1')]},'timeout':{'type':Sequelize[_0xc25c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc25c('0x3')](_0xc25c('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 60ca795..9ced591 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 _0xdf0e=['Agents','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','count','offset','limit','status','set','json','apply','reject','save','destroy','then','get','UserProfileResource','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatQueue','includeAll','rows','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','update','describe','findOne','UserChatQueue','nolimit','ChatQueueId','findAll','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','Team','hasOwnProperty','addTeams','ids','online','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x31b950,_0x48a4e9){var _0x415d87=function(_0x42cb07){while(--_0x42cb07){_0x31b950['push'](_0x31b950['shift']());}};_0x415d87(++_0x48a4e9);}(_0xdf0e,0xa9));var _0xedf0=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xdf0e[_0x492535];return _0x256620;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf0('0x0'));var rimraf=require(_0xedf0('0x1'));var zipdir=require(_0xedf0('0x2'));var jsonpatch=require(_0xedf0('0x3'));var rp=require(_0xedf0('0x4'));var moment=require(_0xedf0('0x5'));var BPromise=require(_0xedf0('0x6'));var Mustache=require(_0xedf0('0x7'));var util=require(_0xedf0('0x8'));var path=require(_0xedf0('0x9'));var sox=require(_0xedf0('0xa'));var csv=require(_0xedf0('0xb'));var ejs=require(_0xedf0('0xc'));var fs=require('fs');var _=require(_0xedf0('0xd'));var squel=require('squel');var crypto=require(_0xedf0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xedf0('0xf'));var toCsv=require(_0xedf0('0xb'));var querystring=require(_0xedf0('0x10'));var Papa=require(_0xedf0('0x11'));var Redis=require(_0xedf0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xedf0('0x13'));var as=require(_0xedf0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedf0('0x15'));var utils=require(_0xedf0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xedf0('0x17'));var db=require(_0xedf0('0x18'))['db'];config[_0xedf0('0x19')]=_[_0xedf0('0x1a')](config[_0xedf0('0x19')],{'host':_0xedf0('0x1b'),'port':0x18eb});var socket=require(_0xedf0('0x1c'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xedf0('0x1d')](socket);var jayson=require(_0xedf0('0x1e'));var client=jayson['client'][_0xedf0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4686c0,_0x5e7526,_0xe60ed8,_0x2b4d97){return new BPromise(function(_0x54ee20,_0x120d53){var _0x320415=_0x2b4d97||client;return _0x320415[_0xedf0('0x20')](_0x4686c0,_0xe60ed8)['then'](function(_0x3df6c4){logger[_0xedf0('0x21')](_0xedf0('0x22'),_0x5e7526,_0xedf0('0x23'));logger[_0xedf0('0x24')](_0xedf0('0x25'),_0x5e7526,_0xedf0('0x23'),JSON[_0xedf0('0x26')](_0x3df6c4));if(_0x3df6c4[_0xedf0('0x27')]){if(_0x3df6c4[_0xedf0('0x27')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5e7526,_0x3df6c4[_0xedf0('0x27')][_0xedf0('0x28')]);return _0x120d53(_0x3df6c4[_0xedf0('0x27')]['message']);}logger[_0xedf0('0x27')](_0xedf0('0x22'),_0x5e7526,_0x3df6c4['error'][_0xedf0('0x28')]);return _0x54ee20(_0x3df6c4[_0xedf0('0x27')][_0xedf0('0x28')]);}else{logger[_0xedf0('0x21')](_0xedf0('0x22'),_0x5e7526,_0xedf0('0x23'));_0x54ee20(_0x3df6c4['result']['message']);}})[_0xedf0('0x29')](function(_0x43ed3f){logger[_0xedf0('0x27')](_0xedf0('0x22'),_0x5e7526,_0x43ed3f);_0x120d53(_0x43ed3f);});});}function respondWithStatusCode(_0x457d31,_0x138423){_0x138423=_0x138423||0xcc;return function(_0x381455){if(_0x381455){return _0x457d31[_0xedf0('0x2a')](_0x138423);}return _0x457d31['status'](_0x138423)[_0xedf0('0x2b')]();};}function respondWithResult(_0x3a12a1,_0x25896c){_0x25896c=_0x25896c||0xc8;return function(_0x5ac843){if(_0x5ac843){return _0x3a12a1['status'](_0x25896c)['json'](_0x5ac843);}};}function respondWithFilteredResult(_0x48f0a1,_0x26fb18){return function(_0x4cfa62){if(_0x4cfa62){var _0x127a80=_0x4cfa62[_0xedf0('0x2c')],_0x2df2df=_0x26fb18[_0xedf0('0x2d')],_0x38c356=_0x26fb18[_0xedf0('0x2d')]+_0x26fb18[_0xedf0('0x2e')],_0x72849c;if(_0x38c356>=_0x127a80){_0x38c356=_0x127a80;_0x72849c=0xc8;}else{_0x72849c=0xce;}_0x48f0a1[_0xedf0('0x2f')](_0x72849c);return _0x48f0a1[_0xedf0('0x30')]('Content-Range',_0x2df2df+'-'+_0x38c356+'/'+_0x127a80)[_0xedf0('0x31')](_0x4cfa62);}return null;};}function patchUpdates(_0xd56486){return function(_0x376f59){try{jsonpatch[_0xedf0('0x32')](_0x376f59,_0xd56486,!![]);}catch(_0xdbcbc1){return BPromise[_0xedf0('0x33')](_0xdbcbc1);}return _0x376f59[_0xedf0('0x34')]();};}function saveUpdates(_0x3c04b4,_0x3c81ab){return function(_0x390bc1){if(_0x390bc1){return _0x390bc1['update'](_0x3c04b4)['then'](function(_0x3b9772){return _0x3b9772;});}return null;};}function removeEntity(_0x5a1773,_0x44e740){return function(_0x156aa9){if(_0x156aa9){return _0x156aa9[_0xedf0('0x35')]()[_0xedf0('0x36')](function(){var _0x5c6575=_0x156aa9[_0xedf0('0x37')]({'plain':!![]});var _0x265eb2='ChatQueues';return db[_0xedf0('0x38')][_0xedf0('0x35')]({'where':{'type':_0x265eb2,'resourceId':_0x5c6575['id']}})[_0xedf0('0x36')](function(){return _0x156aa9;});})[_0xedf0('0x36')](function(){_0x5a1773[_0xedf0('0x2f')](0xcc)[_0xedf0('0x2b')]();});}};}function handleEntityNotFound(_0x4e0a49,_0x2d9868){return function(_0xdd5eed){if(!_0xdd5eed){_0x4e0a49[_0xedf0('0x2a')](0x194);}return _0xdd5eed;};}function handleError(_0x2a78e0,_0x3f5052){_0x3f5052=_0x3f5052||0x1f4;return function(_0x34bdab){logger[_0xedf0('0x27')](_0x34bdab[_0xedf0('0x39')]);if(_0x34bdab['name']){delete _0x34bdab[_0xedf0('0x3a')];}_0x2a78e0[_0xedf0('0x2f')](_0x3f5052)[_0xedf0('0x3b')](_0x34bdab);};}exports[_0xedf0('0x3c')]=function(_0x16973b,_0x338599){var _0x4e264d={},_0x56e76d={},_0x43d43b={'count':0x0,'rows':[]};var _0x50fd9d=_[_0xedf0('0x3d')](db['ChatQueue']['rawAttributes'],function(_0x58a41d){return{'name':_0x58a41d['fieldName'],'type':_0x58a41d[_0xedf0('0x3e')][_0xedf0('0x3f')]};});_0x56e76d[_0xedf0('0x40')]=_[_0xedf0('0x3d')](_0x50fd9d,_0xedf0('0x3a'));_0x56e76d[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x16973b['query']);_0x56e76d[_0xedf0('0x43')]=_['intersection'](_0x56e76d[_0xedf0('0x40')],_0x56e76d[_0xedf0('0x41')]);_0x4e264d[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x56e76d[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x46')]));_0x4e264d['attributes']=_0x4e264d['attributes'][_0xedf0('0x47')]?_0x4e264d[_0xedf0('0x44')]:_0x56e76d['model'];if(!_0x16973b[_0xedf0('0x41')]['hasOwnProperty']('nolimit')){_0x4e264d[_0xedf0('0x2e')]=qs['limit'](_0x16973b[_0xedf0('0x41')]['limit']);_0x4e264d[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x2d')]);}_0x4e264d[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x16973b[_0xedf0('0x41')][_0xedf0('0x49')]);_0x4e264d['where']=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x16973b[_0xedf0('0x41')],_0x56e76d[_0xedf0('0x43')]),_0x50fd9d);if(_0x16973b['query'][_0xedf0('0x4b')]){_0x4e264d[_0xedf0('0x4c')]=_['merge'](_0x4e264d[_0xedf0('0x4c')],{'$or':_[_0xedf0('0x3d')](_0x50fd9d,function(_0x14b9c3){if(_0x14b9c3[_0xedf0('0x3e')]!==_0xedf0('0x4d')){var _0x25ba31={};_0x25ba31[_0x14b9c3[_0xedf0('0x3a')]]={'$like':'%'+_0x16973b[_0xedf0('0x41')]['filter']+'%'};return _0x25ba31;}})});}_0x4e264d=_[_0xedf0('0x4e')]({},_0x4e264d,_0x16973b[_0xedf0('0x4f')]);var _0x2fe5b8={'where':_0x4e264d['where']};return db[_0xedf0('0x50')][_0xedf0('0x2c')](_0x2fe5b8)[_0xedf0('0x36')](function(_0x1958c3){_0x43d43b[_0xedf0('0x2c')]=_0x1958c3;if(_0x16973b[_0xedf0('0x41')][_0xedf0('0x51')]){_0x4e264d['include']=[{'all':!![]}];}return db[_0xedf0('0x50')]['findAll'](_0x4e264d);})['then'](function(_0x41466c){_0x43d43b[_0xedf0('0x52')]=_0x41466c;return _0x43d43b;})[_0xedf0('0x36')](respondWithFilteredResult(_0x338599,_0x4e264d))[_0xedf0('0x29')](handleError(_0x338599,null));};exports['show']=function(_0x510029,_0x2bbf8b){var _0xbe424f={'raw':!![],'where':{'id':_0x510029[_0xedf0('0x53')]['id']}},_0x28f77c={};_0x28f77c[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x50')][_0xedf0('0x54')]);_0x28f77c['query']=_[_0xedf0('0x42')](_0x510029[_0xedf0('0x41')]);_0x28f77c[_0xedf0('0x43')]=_[_0xedf0('0x45')](_0x28f77c[_0xedf0('0x40')],_0x28f77c[_0xedf0('0x41')]);_0xbe424f[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x28f77c[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x510029[_0xedf0('0x41')][_0xedf0('0x46')]));_0xbe424f[_0xedf0('0x44')]=_0xbe424f['attributes']['length']?_0xbe424f[_0xedf0('0x44')]:_0x28f77c[_0xedf0('0x40')];if(_0x510029[_0xedf0('0x41')]['includeAll']){_0xbe424f['include']=[{'all':!![]}];}_0xbe424f=_[_0xedf0('0x4e')]({},_0xbe424f,_0x510029[_0xedf0('0x4f')]);return db[_0xedf0('0x50')][_0xedf0('0x55')](_0xbe424f)['then'](handleEntityNotFound(_0x2bbf8b,null))[_0xedf0('0x36')](respondWithResult(_0x2bbf8b,null))[_0xedf0('0x29')](handleError(_0x2bbf8b,null));};exports[_0xedf0('0x56')]=function(_0x2318ad,_0x4f94fd){return db[_0xedf0('0x50')][_0xedf0('0x56')](_0x2318ad[_0xedf0('0x57')],{})[_0xedf0('0x36')](function(_0x2f4030){var _0x364935=_0x2318ad[_0xedf0('0x58')][_0xedf0('0x37')]({'plain':!![]});if(!_0x364935)throw new Error(_0xedf0('0x59'));if(_0x364935[_0xedf0('0x5a')]===_0xedf0('0x58')){var _0x4eefda=_0x2f4030['get']({'plain':!![]});var _0x4a93b0=_0xedf0('0x5b');return db['UserProfileSection'][_0xedf0('0x55')]({'where':{'name':_0x4a93b0,'userProfileId':_0x364935[_0xedf0('0x5c')]},'raw':!![]})[_0xedf0('0x36')](function(_0x435efd){if(_0x435efd&&_0x435efd[_0xedf0('0x5d')]===0x0){return db[_0xedf0('0x38')][_0xedf0('0x56')]({'name':_0x4eefda[_0xedf0('0x3a')],'resourceId':_0x4eefda['id'],'type':_0x435efd['name'],'sectionId':_0x435efd['id']},{})[_0xedf0('0x36')](function(){return _0x2f4030;});}else{return _0x2f4030;}})[_0xedf0('0x29')](function(_0x495da0){logger[_0xedf0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x495da0);throw _0x495da0;});}return _0x2f4030;})[_0xedf0('0x36')](respondWithResult(_0x4f94fd,0xc9))[_0xedf0('0x29')](handleError(_0x4f94fd,null));};exports[_0xedf0('0x5e')]=function(_0xaab9b0,_0x72e21d){if(_0xaab9b0[_0xedf0('0x57')]['id']){delete _0xaab9b0[_0xedf0('0x57')]['id'];}return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0xaab9b0['params']['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x72e21d,null))[_0xedf0('0x36')](saveUpdates(_0xaab9b0[_0xedf0('0x57')],null))['then'](respondWithResult(_0x72e21d,null))[_0xedf0('0x29')](handleError(_0x72e21d,null));};exports[_0xedf0('0x35')]=function(_0x2384c2,_0x3f8644){return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x2384c2['params']['id']}})['then'](handleEntityNotFound(_0x3f8644,null))[_0xedf0('0x36')](removeEntity(_0x3f8644,null))[_0xedf0('0x29')](handleError(_0x3f8644,null));};exports[_0xedf0('0x5f')]=function(_0x486310,_0x56dd05){return db[_0xedf0('0x50')][_0xedf0('0x5f')]()[_0xedf0('0x36')](respondWithResult(_0x56dd05,null))['catch'](handleError(_0x56dd05,null));};exports['getMembers']=function(_0x548b6b,_0x2f81a2,_0x45a482){var _0x129c55={'raw':!![],'where':{}},_0x42862f={},_0x5b4ffc;return db[_0xedf0('0x50')][_0xedf0('0x60')]({'where':{'id':_0x548b6b[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x2f81a2,null))[_0xedf0('0x36')](function(_0x193acc){if(_0x193acc){_0x5b4ffc=_0x193acc[_0xedf0('0x37')]({'plain':!![]});_0x42862f[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x61')][_0xedf0('0x54')]);_0x42862f[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x548b6b[_0xedf0('0x41')]);_0x42862f['filters']=_['intersection'](_0x42862f[_0xedf0('0x40')],_0x42862f[_0xedf0('0x41')]);_0x129c55[_0xedf0('0x44')]=_['intersection'](_0x42862f[_0xedf0('0x40')],qs[_0xedf0('0x46')](_0x548b6b['query'][_0xedf0('0x46')]));_0x129c55[_0xedf0('0x44')]=_0x129c55[_0xedf0('0x44')]['length']?_0x129c55[_0xedf0('0x44')]:_0x42862f[_0xedf0('0x40')];if(!_0x548b6b[_0xedf0('0x41')]['hasOwnProperty'](_0xedf0('0x62'))){_0x129c55[_0xedf0('0x2e')]=qs[_0xedf0('0x2e')](_0x548b6b[_0xedf0('0x41')][_0xedf0('0x2e')]);_0x129c55[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x548b6b[_0xedf0('0x41')]['offset']);}_0x129c55[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x548b6b['query']['sort']);_0x129c55[_0xedf0('0x4c')]=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x548b6b[_0xedf0('0x41')],_0x42862f[_0xedf0('0x43')]));_0x129c55[_0xedf0('0x4c')][_0xedf0('0x63')]=_0x193acc['id'];if(_0x548b6b[_0xedf0('0x41')]['filter']){_0x129c55[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0x129c55['where'],{'$or':_[_0xedf0('0x3d')](_0x129c55[_0xedf0('0x44')],function(_0x4a2fdf){var _0x349662={};_0x349662[_0x4a2fdf]={'$like':'%'+_0x548b6b['query']['filter']+'%'};return _0x349662;})});}_0x129c55=_[_0xedf0('0x4e')]({},_0x129c55,_0x548b6b[_0xedf0('0x4f')]);return db[_0xedf0('0x61')][_0xedf0('0x64')](_0x129c55);}})[_0xedf0('0x36')](function(_0x14effd){if(_0x14effd){return db[_0xedf0('0x65')][_0xedf0('0x66')]({'where':{'id':_['map'](_0x14effd,'UserId'),'role':_0xedf0('0x67')},'attributes':['id',_0xedf0('0x3a'),'chatPause',_0xedf0('0x68'),_0xedf0('0x69')]});}})['then'](function(_0x568d57){if(_0x568d57){return{'count':_0x568d57[_0xedf0('0x2c')],'rows':_['map'](_0x568d57[_0xedf0('0x52')],function(_0xd0c211){return{'membername':_0xd0c211[_0xedf0('0x3a')],'UserId':_0xd0c211['id'],'queue_name':_0x5b4ffc[_0xedf0('0x3a')],'ChatQueueId':_0x5b4ffc['id'],'interface':util['format'](_0xedf0('0x6a'),_0xedf0('0x6b'),_0xd0c211['name']),'penalty':0x0,'paused':_0xd0c211[_0xedf0('0x6c')],'createdAt':_0xd0c211[_0xedf0('0x69')],'updatedAt':_0xd0c211[_0xedf0('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xedf0('0x36')](respondWithFilteredResult(_0x2f81a2,_0x129c55))[_0xedf0('0x29')](handleError(_0x2f81a2,null));};exports[_0xedf0('0x6d')]=function(_0x13360c,_0x559524,_0x37d900){var _0xabb84c={};var _0x58ba36={};var _0x23df4d;var _0x39bbac;return db['ChatQueue']['findOne']({'where':{'id':_0x13360c[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x559524,null))[_0xedf0('0x36')](function(_0x3308dd){if(_0x3308dd){_0x23df4d=_0x3308dd;_0x58ba36[_0xedf0('0x40')]=_[_0xedf0('0x42')](db[_0xedf0('0x6e')][_0xedf0('0x54')]);_0x58ba36[_0xedf0('0x41')]=_['keys'](_0x13360c[_0xedf0('0x41')]);_0x58ba36[_0xedf0('0x43')]=_['intersection'](_0x58ba36['model'],_0x58ba36[_0xedf0('0x41')]);_0xabb84c[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x58ba36['model'],qs['fields'](_0x13360c[_0xedf0('0x41')][_0xedf0('0x46')]));_0xabb84c[_0xedf0('0x44')]=_0xabb84c[_0xedf0('0x44')]['length']?_0xabb84c['attributes']:_0x58ba36[_0xedf0('0x40')];_0xabb84c[_0xedf0('0x48')]=qs[_0xedf0('0x49')](_0x13360c[_0xedf0('0x41')]['sort']);_0xabb84c['where']=qs['filters'](_[_0xedf0('0x4a')](_0x13360c[_0xedf0('0x41')],_0x58ba36['filters']));if(_0x13360c[_0xedf0('0x41')][_0xedf0('0x4b')]){_0xabb84c[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0xabb84c[_0xedf0('0x4c')],{'$or':_[_0xedf0('0x3d')](_0xabb84c[_0xedf0('0x44')],function(_0x25ffb3){var _0x3a568b={};_0x3a568b[_0x25ffb3]={'$like':'%'+_0x13360c[_0xedf0('0x41')]['filter']+'%'};return _0x3a568b;})});}_0xabb84c=_['merge']({},_0xabb84c,_0x13360c[_0xedf0('0x4f')]);return _0x23df4d['getTeams'](_0xabb84c);}})['then'](function(_0x368ee5){if(_0x368ee5){_0x39bbac=_0x368ee5[_0xedf0('0x47')];if(!_0x13360c[_0xedf0('0x41')][_0xedf0('0x6f')](_0xedf0('0x62'))){_0xabb84c[_0xedf0('0x2e')]=qs['limit'](_0x13360c[_0xedf0('0x41')][_0xedf0('0x2e')]);_0xabb84c[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x13360c['query'][_0xedf0('0x2d')]);}return _0x23df4d[_0xedf0('0x6d')](_0xabb84c);}})['then'](function(_0x3f5feb){if(_0x3f5feb){return _0x3f5feb?{'count':_0x39bbac,'rows':_0x3f5feb}:null;}})['then'](respondWithResult(_0x559524,null))[_0xedf0('0x29')](handleError(_0x559524,null));};exports[_0xedf0('0x70')]=function(_0x3ea80d,_0x240273,_0x57a473){var _0x214163=_0x3ea80d[_0xedf0('0x57')][_0xedf0('0x71')];return db[_0xedf0('0x6e')][_0xedf0('0x64')]({'where':{'id':_0x214163},'attributes':['id'],'include':[{'model':db[_0xedf0('0x65')],'as':'Agents','attributes':['id','name',_0xedf0('0x72'),'voicePause',_0xedf0('0x73')],'raw':!![]}]})['then'](function(_0x1066dd){if(_0x1066dd){var _0x22e384=_['flatMap'](_0x1066dd,function(_0x315a4f){var _0x269a9d=_0x315a4f[_0xedf0('0x37')]({'plain':!![]});return _0x269a9d['Agents'];});return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x3ea80d['params']['id']}})[_0xedf0('0x36')](function(_0xedfc0){return db['sequelize'][_0xedf0('0x74')](function(_0x4f2717){return _0xedfc0['addTeams'](_0x214163,{'transaction':_0x4f2717})['then'](function(){return BPromise[_0xedf0('0x75')](_0x22e384,function(_0x5a06ba){return db[_0xedf0('0x61')][_0xedf0('0x76')]({'where':{'UserId':_0x5a06ba['id'],'ChatQueueId':_0x3ea80d[_0xedf0('0x53')]['id']},'transaction':_0x4f2717});});})[_0xedf0('0x36')](function(){_0x22e384[_0xedf0('0x77')](function(_0x4ec58a){socket[_0xedf0('0x78')](_0xedf0('0x79'),{'UserId':_0x4ec58a['id'],'ChatQueueId':_0xedfc0['id']});});});});});}})[_0xedf0('0x36')](respondWithStatusCode(_0x240273,null))['catch'](handleError(_0x240273,null));};exports[_0xedf0('0x7a')]=function(_0x39e3e1,_0x5034c7,_0x206dfb){return db[_0xedf0('0x6e')][_0xedf0('0x64')]({'where':{'id':_0x39e3e1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xedf0('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5034c7,null))[_0xedf0('0x36')](function(_0x142435){var _0x5b7785=_[_0xedf0('0x3d')](_0x142435,'id');var _0x366cf0=[];var _0x1c0b59=[];var _0x13d522=squel['select']();_0x13d522[_0xedf0('0x7b')]('tq.TeamId')[_0xedf0('0x7c')](_0xedf0('0x7d'),'tq')['join'](_0xedf0('0x7e'),'ut',_0xedf0('0x7f'))[_0xedf0('0x4c')](_0xedf0('0x80'),_0x39e3e1[_0xedf0('0x53')]['id']);for(var _0x50764d=0x0;_0x50764d<_0x142435[_0xedf0('0x47')];_0x50764d+=0x1){let _0x1dd8aa=_0x142435[_0x50764d];for(var _0x2da4b2=0x0;_0x2da4b2<_0x1dd8aa['Agents'][_0xedf0('0x47')];_0x2da4b2+=0x1){let _0x22cc8e=_0x1dd8aa[_0xedf0('0x81')][_0x2da4b2];var _0x438af5=_0x13d522[_0xedf0('0x82')]();_0x438af5[_0xedf0('0x4c')](_0xedf0('0x83'),_0x22cc8e['id']);_0x1c0b59[_0xedf0('0x84')](db['sequelize'][_0xedf0('0x41')](_0x438af5[_0xedf0('0x85')](),{'type':db[_0xedf0('0x86')]['QueryTypes'][_0xedf0('0x87')]})[_0xedf0('0x36')](function(_0xc81009){if(_0xc81009['length']===0x1){return _0x22cc8e['id'];}else{var _0x4240b4=_[_0xedf0('0x88')](_[_0xedf0('0x3d')](_0xc81009,_0xedf0('0x89')),function(_0x3722c0){return _[_0xedf0('0x8a')](_0x5b7785,_0x3722c0);});if(_0x4240b4){return _0x22cc8e['id'];}}}));}}return BPromise['all'](_0x1c0b59)['then'](function(_0x577e44){_0x366cf0=_(_0x366cf0)[_0xedf0('0x8b')](_0x577e44)[_0xedf0('0x8c')]()[_0xedf0('0x8d')]();return db[_0xedf0('0x50')][_0xedf0('0x55')]({'where':{'id':_0x39e3e1[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](function(_0x1076fb){return db[_0xedf0('0x86')][_0xedf0('0x74')](function(_0xd30409){return _0x1076fb[_0xedf0('0x7a')](_0x39e3e1[_0xedf0('0x41')][_0xedf0('0x71')],{'transaction':_0xd30409})[_0xedf0('0x36')](function(){if(!_[_0xedf0('0x8e')](_0x366cf0)){return _0x1076fb[_0xedf0('0x8f')](_0x366cf0,{'transaction':_0xd30409});}})['then'](function(){_0x366cf0[_0xedf0('0x77')](function(_0x3045e8){socket[_0xedf0('0x78')](_0xedf0('0x90'),{'UserId':_0x3045e8,'ChatQueueId':_0x1076fb['id']});});});});});});})[_0xedf0('0x36')](respondWithStatusCode(_0x5034c7,null))[_0xedf0('0x29')](handleError(_0x5034c7,null));};exports['addAgents']=function(_0x37caf9,_0x6bd522,_0x300d50){return db['ChatQueue']['find']({'where':{'id':_0x37caf9[_0xedf0('0x53')]['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x6bd522,null))[_0xedf0('0x36')](function(_0x17de8f){if(_0x17de8f){return _0x17de8f[_0xedf0('0x91')](_0x37caf9[_0xedf0('0x57')]['ids'],_[_0xedf0('0x92')](_0x37caf9[_0xedf0('0x57')],[_0xedf0('0x71'),'id'])||{})[_0xedf0('0x93')](function(_0x102c57){for(var _0x2729bb=0x0;_0x2729bb<_0x37caf9[_0xedf0('0x57')][_0xedf0('0x71')]['length'];_0x2729bb+=0x1){socket[_0xedf0('0x78')]('userChatQueue:save',{'UserId':_0x37caf9['body']['ids'][_0x2729bb],'ChatQueueId':_0x37caf9['params']['id']});}return _0x102c57;});}})[_0xedf0('0x36')](respondWithResult(_0x6bd522,null))[_0xedf0('0x29')](handleError(_0x6bd522,null));};exports[_0xedf0('0x8f')]=function(_0x1b73c3,_0x1f8c42,_0x39966f){return db['ChatQueue'][_0xedf0('0x55')]({'where':{'id':_0x1b73c3['params']['id']}})[_0xedf0('0x36')](handleEntityNotFound(_0x1f8c42,null))[_0xedf0('0x36')](function(_0x570e2b){if(_0x570e2b){return _0x570e2b[_0xedf0('0x8f')](_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')])[_0xedf0('0x36')](function(){if(_['isArray'](_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')])){for(var _0x663e2a=0x0;_0x663e2a<_0x1b73c3['query']['ids'][_0xedf0('0x47')];_0x663e2a+=0x1){socket['emit'](_0xedf0('0x90'),{'UserId':Number(_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')][_0x663e2a]),'ChatQueueId':Number(_0x1b73c3['params']['id'])});}}else{socket[_0xedf0('0x78')](_0xedf0('0x90'),{'UserId':Number(_0x1b73c3[_0xedf0('0x41')][_0xedf0('0x71')]),'ChatQueueId':Number(_0x1b73c3[_0xedf0('0x53')]['id'])});}});}})[_0xedf0('0x36')](respondWithStatusCode(_0x1f8c42,null))[_0xedf0('0x29')](handleError(_0x1f8c42,null));};exports[_0xedf0('0x94')]=function(_0x225927,_0x1ff066,_0x4ad1c0){var _0x1b4123={};var _0x3301dc={};var _0x7e92b;var _0x45e540;return db['ChatQueue']['findOne']({'where':{'id':_0x225927[_0xedf0('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ff066,null))[_0xedf0('0x36')](function(_0xe45bdd){if(_0xe45bdd){_0x7e92b=_0xe45bdd;_0x3301dc['model']=_['keys'](db[_0xedf0('0x65')][_0xedf0('0x54')]);_0x3301dc[_0xedf0('0x41')]=_[_0xedf0('0x42')](_0x225927['query']);_0x3301dc[_0xedf0('0x43')]=_['intersection'](_0x3301dc[_0xedf0('0x40')],_0x3301dc[_0xedf0('0x41')]);_0x1b4123[_0xedf0('0x44')]=_[_0xedf0('0x45')](_0x3301dc[_0xedf0('0x40')],qs['fields'](_0x225927[_0xedf0('0x41')]['fields']));_0x1b4123['attributes']=_0x1b4123[_0xedf0('0x44')]['length']?_0x1b4123[_0xedf0('0x44')]:_0x3301dc[_0xedf0('0x40')];_0x1b4123['order']=qs[_0xedf0('0x49')](_0x225927[_0xedf0('0x41')][_0xedf0('0x49')]);_0x1b4123[_0xedf0('0x4c')]=qs[_0xedf0('0x43')](_[_0xedf0('0x4a')](_0x225927[_0xedf0('0x41')],_0x3301dc['filters']));if(_0x225927[_0xedf0('0x41')][_0xedf0('0x4b')]){_0x1b4123[_0xedf0('0x4c')]=_[_0xedf0('0x4e')](_0x1b4123[_0xedf0('0x4c')],{'$or':_['map'](_0x1b4123['attributes'],function(_0x2104ca){var _0x305379={};_0x305379[_0x2104ca]={'$like':'%'+_0x225927['query']['filter']+'%'};return _0x305379;})});}_0x1b4123=_[_0xedf0('0x4e')]({},_0x1b4123,_0x225927['options']);return _0x7e92b[_0xedf0('0x94')](_0x1b4123);}})[_0xedf0('0x36')](function(_0x64e782){if(_0x64e782){_0x45e540=_0x64e782[_0xedf0('0x47')];if(!_0x225927[_0xedf0('0x41')][_0xedf0('0x6f')]('nolimit')){_0x1b4123[_0xedf0('0x2e')]=qs[_0xedf0('0x2e')](_0x225927[_0xedf0('0x41')]['limit']);_0x1b4123[_0xedf0('0x2d')]=qs[_0xedf0('0x2d')](_0x225927[_0xedf0('0x41')][_0xedf0('0x2d')]);}return _0x7e92b['getAgents'](_0x1b4123);}})['then'](function(_0x56ebc1){if(_0x56ebc1){return _0x56ebc1?{'count':_0x45e540,'rows':_0x56ebc1}:null;}})[_0xedf0('0x36')](respondWithResult(_0x1ff066,null))[_0xedf0('0x29')](handleError(_0x1ff066,null));}; \ No newline at end of file +var _0xfb4e=['omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','map','VIRTUAL','ChatQueue','includeAll','include','findAll','rows','length','options','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','hasOwnProperty','pick','ChatQueueId','filter','User','agent','chatPause','updatedAt','createdAt','format','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','UserChatQueue','findOrCreate','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','union','compact','transaction','removeAgents','userChatQueue:remove','addAgents'];(function(_0x401e64,_0x213090){var _0x216dcc=function(_0x12d88a){while(--_0x12d88a){_0x401e64['push'](_0x401e64['shift']());}};_0x216dcc(++_0x213090);}(_0xfb4e,0x1bd));var _0xefb4=function(_0x144035,_0x571993){_0x144035=_0x144035-0x0;var _0x518a5b=_0xfb4e[_0x144035];return _0x518a5b;};'use strict';var pdf=require(_0xefb4('0x0'));var emlformat=require(_0xefb4('0x1'));var rimraf=require(_0xefb4('0x2'));var zipdir=require(_0xefb4('0x3'));var jsonpatch=require(_0xefb4('0x4'));var rp=require('request-promise');var moment=require(_0xefb4('0x5'));var BPromise=require(_0xefb4('0x6'));var Mustache=require(_0xefb4('0x7'));var util=require(_0xefb4('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xefb4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefb4('0xa'));var squel=require(_0xefb4('0xb'));var crypto=require(_0xefb4('0xc'));var jsforce=require(_0xefb4('0xd'));var deskjs=require(_0xefb4('0xe'));var toCsv=require(_0xefb4('0x9'));var querystring=require(_0xefb4('0xf'));var Papa=require(_0xefb4('0x10'));var Redis=require(_0xefb4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xefb4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefb4('0x13'));var logger=require(_0xefb4('0x14'))('api');var utils=require(_0xefb4('0x15'));var config=require(_0xefb4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xefb4('0x17'))['db'];config[_0xefb4('0x18')]=_[_0xefb4('0x19')](config[_0xefb4('0x18')],{'host':_0xefb4('0x1a'),'port':0x18eb});var socket=require(_0xefb4('0x1b'))(new Redis(config[_0xefb4('0x18')]));require(_0xefb4('0x1c'))[_0xefb4('0x1d')](socket);var jayson=require(_0xefb4('0x1e'));var client=jayson[_0xefb4('0x1f')][_0xefb4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x45f0fd,_0x407a8b,_0x474f14,_0x3782ec){return new BPromise(function(_0x5e1222,_0x11a773){var _0x4a3095=_0x3782ec||client;return _0x4a3095['request'](_0x45f0fd,_0x474f14)[_0xefb4('0x21')](function(_0x1b5fda){logger[_0xefb4('0x22')](_0xefb4('0x23'),_0x407a8b,_0xefb4('0x24'));logger[_0xefb4('0x25')](_0xefb4('0x26'),_0x407a8b,_0xefb4('0x24'),JSON[_0xefb4('0x27')](_0x1b5fda));if(_0x1b5fda[_0xefb4('0x28')]){if(_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x407a8b,_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x2a')]);return _0x11a773(_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x2a')]);}logger[_0xefb4('0x28')](_0xefb4('0x23'),_0x407a8b,_0x1b5fda['error'][_0xefb4('0x2a')]);return _0x5e1222(_0x1b5fda[_0xefb4('0x28')]['message']);}else{logger[_0xefb4('0x22')]('ChatQueue,\x20%s,\x20%s',_0x407a8b,_0xefb4('0x24'));_0x5e1222(_0x1b5fda[_0xefb4('0x2b')][_0xefb4('0x2a')]);}})[_0xefb4('0x2c')](function(_0x8e2705){logger[_0xefb4('0x28')](_0xefb4('0x23'),_0x407a8b,_0x8e2705);_0x11a773(_0x8e2705);});});}function respondWithStatusCode(_0x490ead,_0x35b6bc){_0x35b6bc=_0x35b6bc||0xcc;return function(_0x33d168){if(_0x33d168){return _0x490ead['sendStatus'](_0x35b6bc);}return _0x490ead[_0xefb4('0x2d')](_0x35b6bc)[_0xefb4('0x2e')]();};}function respondWithResult(_0x14b1ac,_0x45ef7a){_0x45ef7a=_0x45ef7a||0xc8;return function(_0x151514){if(_0x151514){return _0x14b1ac[_0xefb4('0x2d')](_0x45ef7a)[_0xefb4('0x2f')](_0x151514);}};}function respondWithFilteredResult(_0x174f65,_0x8d5511){return function(_0x2b70ca){if(_0x2b70ca){var _0xda7079=_0x2b70ca[_0xefb4('0x30')],_0x4ce943=_0x8d5511['offset'],_0x158e67=_0x8d5511[_0xefb4('0x31')]+_0x8d5511[_0xefb4('0x32')],_0x46c6ac;if(_0x158e67>=_0xda7079){_0x158e67=_0xda7079;_0x46c6ac=0xc8;}else{_0x46c6ac=0xce;}_0x174f65[_0xefb4('0x2d')](_0x46c6ac);return _0x174f65['set']('Content-Range',_0x4ce943+'-'+_0x158e67+'/'+_0xda7079)[_0xefb4('0x2f')](_0x2b70ca);}return null;};}function patchUpdates(_0x158353){return function(_0x4b6810){try{jsonpatch[_0xefb4('0x33')](_0x4b6810,_0x158353,!![]);}catch(_0x5b0348){return BPromise[_0xefb4('0x34')](_0x5b0348);}return _0x4b6810[_0xefb4('0x35')]();};}function saveUpdates(_0x1e3722,_0x55d136){return function(_0x28482f){if(_0x28482f){return _0x28482f[_0xefb4('0x36')](_0x1e3722)[_0xefb4('0x21')](function(_0x12f582){return _0x12f582;});}return null;};}function removeEntity(_0x5e7b51,_0x3ce981){return function(_0x561708){if(_0x561708){return _0x561708[_0xefb4('0x37')]()[_0xefb4('0x21')](function(){var _0x11a13c=_0x561708['get']({'plain':!![]});var _0x5e288f=_0xefb4('0x38');return db[_0xefb4('0x39')][_0xefb4('0x37')]({'where':{'type':_0x5e288f,'resourceId':_0x11a13c['id']}})[_0xefb4('0x21')](function(){return _0x561708;});})[_0xefb4('0x21')](function(){_0x5e7b51['status'](0xcc)[_0xefb4('0x2e')]();});}};}function handleEntityNotFound(_0x126a37,_0x2bdcf9){return function(_0x1f5978){if(!_0x1f5978){_0x126a37['sendStatus'](0x194);}return _0x1f5978;};}function handleError(_0x2de95b,_0x64f726){_0x64f726=_0x64f726||0x1f4;return function(_0x44db0c){logger[_0xefb4('0x28')](_0x44db0c[_0xefb4('0x3a')]);if(_0x44db0c[_0xefb4('0x3b')]){delete _0x44db0c[_0xefb4('0x3b')];}_0x2de95b[_0xefb4('0x2d')](_0x64f726)[_0xefb4('0x3c')](_0x44db0c);};}exports[_0xefb4('0x3d')]=function(_0x34908c,_0x3d8a92){var _0x484df8={},_0x5637a5={},_0x497e37={'count':0x0,'rows':[]};var _0x130113=_['map'](db['ChatQueue'][_0xefb4('0x3e')],function(_0x26d73e){return{'name':_0x26d73e[_0xefb4('0x3f')],'type':_0x26d73e[_0xefb4('0x40')][_0xefb4('0x41')]};});_0x5637a5[_0xefb4('0x42')]=_['map'](_0x130113,_0xefb4('0x3b'));_0x5637a5[_0xefb4('0x43')]=_[_0xefb4('0x44')](_0x34908c['query']);_0x5637a5['filters']=_[_0xefb4('0x45')](_0x5637a5[_0xefb4('0x42')],_0x5637a5[_0xefb4('0x43')]);_0x484df8[_0xefb4('0x46')]=_['intersection'](_0x5637a5['model'],qs[_0xefb4('0x47')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x47')]));_0x484df8['attributes']=_0x484df8[_0xefb4('0x46')]['length']?_0x484df8['attributes']:_0x5637a5[_0xefb4('0x42')];if(!_0x34908c[_0xefb4('0x43')]['hasOwnProperty'](_0xefb4('0x48'))){_0x484df8['limit']=qs[_0xefb4('0x32')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x32')]);_0x484df8[_0xefb4('0x31')]=qs['offset'](_0x34908c[_0xefb4('0x43')][_0xefb4('0x31')]);}_0x484df8[_0xefb4('0x49')]=qs[_0xefb4('0x4a')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x484df8[_0xefb4('0x4b')]=qs[_0xefb4('0x4c')](_['pick'](_0x34908c[_0xefb4('0x43')],_0x5637a5['filters']),_0x130113);if(_0x34908c['query']['filter']){_0x484df8[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x484df8[_0xefb4('0x4b')],{'$or':_[_0xefb4('0x4e')](_0x130113,function(_0x400f98){if(_0x400f98[_0xefb4('0x40')]!==_0xefb4('0x4f')){var _0x518b93={};_0x518b93[_0x400f98[_0xefb4('0x3b')]]={'$like':'%'+_0x34908c['query']['filter']+'%'};return _0x518b93;}})});}_0x484df8=_[_0xefb4('0x4d')]({},_0x484df8,_0x34908c['options']);var _0x49af57={'where':_0x484df8[_0xefb4('0x4b')]};return db[_0xefb4('0x50')][_0xefb4('0x30')](_0x49af57)['then'](function(_0x40cd0a){_0x497e37[_0xefb4('0x30')]=_0x40cd0a;if(_0x34908c[_0xefb4('0x43')][_0xefb4('0x51')]){_0x484df8[_0xefb4('0x52')]=[{'all':!![]}];}return db[_0xefb4('0x50')][_0xefb4('0x53')](_0x484df8);})[_0xefb4('0x21')](function(_0x516b54){_0x497e37[_0xefb4('0x54')]=_0x516b54;return _0x497e37;})[_0xefb4('0x21')](respondWithFilteredResult(_0x3d8a92,_0x484df8))['catch'](handleError(_0x3d8a92,null));};exports['show']=function(_0x2b9481,_0x107884){var _0x443405={'raw':!![],'where':{'id':_0x2b9481['params']['id']}},_0x34ae29={};_0x34ae29[_0xefb4('0x42')]=_['keys'](db[_0xefb4('0x50')]['rawAttributes']);_0x34ae29['query']=_[_0xefb4('0x44')](_0x2b9481['query']);_0x34ae29[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x34ae29[_0xefb4('0x42')],_0x34ae29[_0xefb4('0x43')]);_0x443405['attributes']=_[_0xefb4('0x45')](_0x34ae29[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x2b9481[_0xefb4('0x43')][_0xefb4('0x47')]));_0x443405['attributes']=_0x443405[_0xefb4('0x46')][_0xefb4('0x55')]?_0x443405[_0xefb4('0x46')]:_0x34ae29[_0xefb4('0x42')];if(_0x2b9481[_0xefb4('0x43')][_0xefb4('0x51')]){_0x443405['include']=[{'all':!![]}];}_0x443405=_[_0xefb4('0x4d')]({},_0x443405,_0x2b9481[_0xefb4('0x56')]);return db[_0xefb4('0x50')][_0xefb4('0x57')](_0x443405)[_0xefb4('0x21')](handleEntityNotFound(_0x107884,null))[_0xefb4('0x21')](respondWithResult(_0x107884,null))['catch'](handleError(_0x107884,null));};exports['create']=function(_0x24e46e,_0x4e612e){return db[_0xefb4('0x50')][_0xefb4('0x58')](_0x24e46e[_0xefb4('0x59')],{})[_0xefb4('0x21')](function(_0x246e44){var _0x4a4a9d=_0x24e46e['user'][_0xefb4('0x5a')]({'plain':!![]});if(!_0x4a4a9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a4a9d['role']===_0xefb4('0x5b')){var _0x200a8d=_0x246e44[_0xefb4('0x5a')]({'plain':!![]});var _0x4ce9a1=_0xefb4('0x38');return db[_0xefb4('0x5c')][_0xefb4('0x57')]({'where':{'name':_0x4ce9a1,'userProfileId':_0x4a4a9d[_0xefb4('0x5d')]},'raw':!![]})[_0xefb4('0x21')](function(_0x5abe67){if(_0x5abe67&&_0x5abe67[_0xefb4('0x5e')]===0x0){return db[_0xefb4('0x39')]['create']({'name':_0x200a8d[_0xefb4('0x3b')],'resourceId':_0x200a8d['id'],'type':_0x5abe67[_0xefb4('0x3b')],'sectionId':_0x5abe67['id']},{})[_0xefb4('0x21')](function(){return _0x246e44;});}else{return _0x246e44;}})[_0xefb4('0x2c')](function(_0x5aab90){logger[_0xefb4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aab90);throw _0x5aab90;});}return _0x246e44;})[_0xefb4('0x21')](respondWithResult(_0x4e612e,0xc9))[_0xefb4('0x2c')](handleError(_0x4e612e,null));};exports[_0xefb4('0x36')]=function(_0x32f816,_0x40d383){if(_0x32f816[_0xefb4('0x59')]['id']){delete _0x32f816[_0xefb4('0x59')]['id'];}return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x32f816['params']['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x40d383,null))[_0xefb4('0x21')](saveUpdates(_0x32f816[_0xefb4('0x59')],null))[_0xefb4('0x21')](respondWithResult(_0x40d383,null))[_0xefb4('0x2c')](handleError(_0x40d383,null));};exports[_0xefb4('0x37')]=function(_0x104460,_0x3125c4){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x104460[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3125c4,null))['then'](removeEntity(_0x3125c4,null))[_0xefb4('0x2c')](handleError(_0x3125c4,null));};exports[_0xefb4('0x60')]=function(_0x10f37b,_0x25bbb4){return db['ChatQueue'][_0xefb4('0x60')]()[_0xefb4('0x21')](respondWithResult(_0x25bbb4,null))[_0xefb4('0x2c')](handleError(_0x25bbb4,null));};exports[_0xefb4('0x61')]=function(_0x62c2e4,_0x302f90,_0x3bee64){var _0x2386a1={'raw':!![],'where':{}},_0x22fda6={},_0x483e96;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x62c2e4[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x302f90,null))[_0xefb4('0x21')](function(_0x21f15c){if(_0x21f15c){_0x483e96=_0x21f15c['get']({'plain':!![]});_0x22fda6[_0xefb4('0x42')]=_[_0xefb4('0x44')](db['UserChatQueue'][_0xefb4('0x3e')]);_0x22fda6[_0xefb4('0x43')]=_['keys'](_0x62c2e4[_0xefb4('0x43')]);_0x22fda6[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x22fda6[_0xefb4('0x42')],_0x22fda6['query']);_0x2386a1['attributes']=_[_0xefb4('0x45')](_0x22fda6[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x62c2e4[_0xefb4('0x43')]['fields']));_0x2386a1['attributes']=_0x2386a1[_0xefb4('0x46')][_0xefb4('0x55')]?_0x2386a1[_0xefb4('0x46')]:_0x22fda6[_0xefb4('0x42')];if(!_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x63')](_0xefb4('0x48'))){_0x2386a1['limit']=qs[_0xefb4('0x32')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x32')]);_0x2386a1['offset']=qs[_0xefb4('0x31')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x31')]);}_0x2386a1[_0xefb4('0x49')]=qs[_0xefb4('0x4a')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x2386a1[_0xefb4('0x4b')]=qs[_0xefb4('0x4c')](_[_0xefb4('0x64')](_0x62c2e4[_0xefb4('0x43')],_0x22fda6[_0xefb4('0x4c')]));_0x2386a1['where'][_0xefb4('0x65')]=_0x21f15c['id'];if(_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x66')]){_0x2386a1[_0xefb4('0x4b')]=_['merge'](_0x2386a1['where'],{'$or':_['map'](_0x2386a1[_0xefb4('0x46')],function(_0xcb826a){var _0x33cd7e={};_0x33cd7e[_0xcb826a]={'$like':'%'+_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0x33cd7e;})});}_0x2386a1=_[_0xefb4('0x4d')]({},_0x2386a1,_0x62c2e4[_0xefb4('0x56')]);return db['UserChatQueue'][_0xefb4('0x53')](_0x2386a1);}})[_0xefb4('0x21')](function(_0x50e934){if(_0x50e934){return db[_0xefb4('0x67')]['findAndCountAll']({'where':{'id':_[_0xefb4('0x4e')](_0x50e934,'UserId'),'role':_0xefb4('0x68')},'attributes':['id',_0xefb4('0x3b'),_0xefb4('0x69'),_0xefb4('0x6a'),_0xefb4('0x6b')]});}})[_0xefb4('0x21')](function(_0xf85c22){if(_0xf85c22){return{'count':_0xf85c22[_0xefb4('0x30')],'rows':_[_0xefb4('0x4e')](_0xf85c22['rows'],function(_0x2f2de7){return{'membername':_0x2f2de7[_0xefb4('0x3b')],'UserId':_0x2f2de7['id'],'queue_name':_0x483e96['name'],'ChatQueueId':_0x483e96['id'],'interface':util[_0xefb4('0x6c')]('%s/%s','SIP',_0x2f2de7[_0xefb4('0x3b')]),'penalty':0x0,'paused':_0x2f2de7[_0xefb4('0x69')],'createdAt':_0x2f2de7[_0xefb4('0x6b')],'updatedAt':_0x2f2de7[_0xefb4('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xefb4('0x21')](respondWithFilteredResult(_0x302f90,_0x2386a1))[_0xefb4('0x2c')](handleError(_0x302f90,null));};exports[_0xefb4('0x6d')]=function(_0x2bb5e0,_0xffef0a,_0x269e53){var _0x1b3955={};var _0x40d3ce={};var _0x4d46ce;var _0x201152;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x2bb5e0[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0xffef0a,null))['then'](function(_0x251943){if(_0x251943){_0x4d46ce=_0x251943;_0x40d3ce['model']=_['keys'](db['Team'][_0xefb4('0x3e')]);_0x40d3ce['query']=_['keys'](_0x2bb5e0[_0xefb4('0x43')]);_0x40d3ce[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x40d3ce[_0xefb4('0x42')],_0x40d3ce['query']);_0x1b3955['attributes']=_[_0xefb4('0x45')](_0x40d3ce[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x2bb5e0['query'][_0xefb4('0x47')]));_0x1b3955[_0xefb4('0x46')]=_0x1b3955['attributes'][_0xefb4('0x55')]?_0x1b3955['attributes']:_0x40d3ce[_0xefb4('0x42')];_0x1b3955['order']=qs[_0xefb4('0x4a')](_0x2bb5e0['query'][_0xefb4('0x4a')]);_0x1b3955['where']=qs[_0xefb4('0x4c')](_['pick'](_0x2bb5e0[_0xefb4('0x43')],_0x40d3ce['filters']));if(_0x2bb5e0['query']['filter']){_0x1b3955[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x1b3955[_0xefb4('0x4b')],{'$or':_['map'](_0x1b3955['attributes'],function(_0x15bf56){var _0x2793a9={};_0x2793a9[_0x15bf56]={'$like':'%'+_0x2bb5e0[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0x2793a9;})});}_0x1b3955=_['merge']({},_0x1b3955,_0x2bb5e0[_0xefb4('0x56')]);return _0x4d46ce['getTeams'](_0x1b3955);}})[_0xefb4('0x21')](function(_0x384f82){if(_0x384f82){_0x201152=_0x384f82[_0xefb4('0x55')];if(!_0x2bb5e0[_0xefb4('0x43')]['hasOwnProperty'](_0xefb4('0x48'))){_0x1b3955[_0xefb4('0x32')]=qs[_0xefb4('0x32')](_0x2bb5e0['query'][_0xefb4('0x32')]);_0x1b3955[_0xefb4('0x31')]=qs[_0xefb4('0x31')](_0x2bb5e0['query'][_0xefb4('0x31')]);}return _0x4d46ce[_0xefb4('0x6d')](_0x1b3955);}})[_0xefb4('0x21')](function(_0xc8062f){if(_0xc8062f){return _0xc8062f?{'count':_0x201152,'rows':_0xc8062f}:null;}})['then'](respondWithResult(_0xffef0a,null))[_0xefb4('0x2c')](handleError(_0xffef0a,null));};exports[_0xefb4('0x6e')]=function(_0x3e37a8,_0x578330,_0x115388){var _0x28770f=_0x3e37a8[_0xefb4('0x59')][_0xefb4('0x6f')];return db[_0xefb4('0x70')][_0xefb4('0x53')]({'where':{'id':_0x28770f},'attributes':['id'],'include':[{'model':db[_0xefb4('0x67')],'as':_0xefb4('0x71'),'attributes':['id',_0xefb4('0x3b'),'online',_0xefb4('0x72'),'interface'],'raw':!![]}]})[_0xefb4('0x21')](function(_0x14080d){if(_0x14080d){var _0xfd5a61=_[_0xefb4('0x73')](_0x14080d,function(_0xf8efac){var _0x3e9c1d=_0xf8efac[_0xefb4('0x5a')]({'plain':!![]});return _0x3e9c1d[_0xefb4('0x71')];});return db['ChatQueue'][_0xefb4('0x57')]({'where':{'id':_0x3e37a8['params']['id']}})['then'](function(_0x17048f){return db[_0xefb4('0x74')]['transaction'](function(_0x26544a){return _0x17048f[_0xefb4('0x6e')](_0x28770f,{'transaction':_0x26544a})[_0xefb4('0x21')](function(){return BPromise[_0xefb4('0x75')](_0xfd5a61,function(_0x4935b0){return db[_0xefb4('0x76')][_0xefb4('0x77')]({'where':{'UserId':_0x4935b0['id'],'ChatQueueId':_0x3e37a8['params']['id']},'transaction':_0x26544a});});})[_0xefb4('0x21')](function(){_0xfd5a61['forEach'](function(_0x195c71){socket[_0xefb4('0x78')](_0xefb4('0x79'),{'UserId':_0x195c71['id'],'ChatQueueId':_0x17048f['id']});});});});});}})['then'](respondWithStatusCode(_0x578330,null))[_0xefb4('0x2c')](handleError(_0x578330,null));};exports[_0xefb4('0x7a')]=function(_0x681d5e,_0x862911,_0x48e785){return db['Team']['findAll']({'where':{'id':_0x681d5e['query'][_0xefb4('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xefb4('0x21')](handleEntityNotFound(_0x862911,null))[_0xefb4('0x21')](function(_0x5bacb5){var _0x50bf65=_[_0xefb4('0x4e')](_0x5bacb5,'id');var _0x516d96=[];var _0x3ba1e0=[];var _0x24b222=squel[_0xefb4('0x7b')]();_0x24b222['field'](_0xefb4('0x7c'))[_0xefb4('0x7d')]('team_has_chat_queues','tq')[_0xefb4('0x7e')](_0xefb4('0x7f'),'ut',_0xefb4('0x80'))[_0xefb4('0x4b')](_0xefb4('0x81'),_0x681d5e['params']['id']);for(var _0x4d5a14=0x0;_0x4d5a14<_0x5bacb5[_0xefb4('0x55')];_0x4d5a14+=0x1){let _0x5e0a56=_0x5bacb5[_0x4d5a14];for(var _0x2bf79b=0x0;_0x2bf79b<_0x5e0a56[_0xefb4('0x71')][_0xefb4('0x55')];_0x2bf79b+=0x1){let _0x37cf21=_0x5e0a56['Agents'][_0x2bf79b];var _0x2cffd3=_0x24b222[_0xefb4('0x82')]();_0x2cffd3[_0xefb4('0x4b')]('ut.UserId\x20=\x20?',_0x37cf21['id']);_0x3ba1e0[_0xefb4('0x83')](db[_0xefb4('0x74')][_0xefb4('0x43')](_0x2cffd3[_0xefb4('0x84')](),{'type':db[_0xefb4('0x74')][_0xefb4('0x85')][_0xefb4('0x86')]})[_0xefb4('0x21')](function(_0x218424){if(_0x218424['length']===0x1){return _0x37cf21['id'];}else{var _0x5944f5=_[_0xefb4('0x87')](_[_0xefb4('0x4e')](_0x218424,'TeamId'),function(_0x4d4ae9){return _[_0xefb4('0x88')](_0x50bf65,_0x4d4ae9);});if(_0x5944f5){return _0x37cf21['id'];}}}));}}return BPromise['all'](_0x3ba1e0)[_0xefb4('0x21')](function(_0x835640){_0x516d96=_(_0x516d96)[_0xefb4('0x89')](_0x835640)[_0xefb4('0x8a')]()['value']();return db['ChatQueue'][_0xefb4('0x57')]({'where':{'id':_0x681d5e[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](function(_0x3276f8){return db[_0xefb4('0x74')][_0xefb4('0x8b')](function(_0x2e8e59){return _0x3276f8[_0xefb4('0x7a')](_0x681d5e[_0xefb4('0x43')][_0xefb4('0x6f')],{'transaction':_0x2e8e59})[_0xefb4('0x21')](function(){if(!_['isEmpty'](_0x516d96)){return _0x3276f8[_0xefb4('0x8c')](_0x516d96,{'transaction':_0x2e8e59});}})[_0xefb4('0x21')](function(){_0x516d96['forEach'](function(_0x39926f){socket[_0xefb4('0x78')](_0xefb4('0x8d'),{'UserId':_0x39926f,'ChatQueueId':_0x3276f8['id']});});});});});});})[_0xefb4('0x21')](respondWithStatusCode(_0x862911,null))[_0xefb4('0x2c')](handleError(_0x862911,null));};exports[_0xefb4('0x8e')]=function(_0x1a3201,_0x3f6c06,_0x1a2161){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x1a3201[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3f6c06,null))['then'](function(_0x184a38){if(_0x184a38){return _0x184a38[_0xefb4('0x8e')](_0x1a3201[_0xefb4('0x59')]['ids'],_[_0xefb4('0x8f')](_0x1a3201['body'],['ids','id'])||{})[_0xefb4('0x90')](function(_0x13315b){for(var _0x3c4d78=0x0;_0x3c4d78<_0x1a3201['body']['ids'][_0xefb4('0x55')];_0x3c4d78+=0x1){socket[_0xefb4('0x78')](_0xefb4('0x79'),{'UserId':_0x1a3201['body'][_0xefb4('0x6f')][_0x3c4d78],'ChatQueueId':_0x1a3201[_0xefb4('0x5f')]['id']});}return _0x13315b;});}})[_0xefb4('0x21')](respondWithResult(_0x3f6c06,null))[_0xefb4('0x2c')](handleError(_0x3f6c06,null));};exports['removeAgents']=function(_0xe8481f,_0x349d19,_0x5203e5){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0xe8481f[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x349d19,null))[_0xefb4('0x21')](function(_0x442ccf){if(_0x442ccf){return _0x442ccf['removeAgents'](_0xe8481f[_0xefb4('0x43')][_0xefb4('0x6f')])['then'](function(){if(_[_0xefb4('0x91')](_0xe8481f['query'][_0xefb4('0x6f')])){for(var _0x545f65=0x0;_0x545f65<_0xe8481f[_0xefb4('0x43')]['ids']['length'];_0x545f65+=0x1){socket['emit'](_0xefb4('0x8d'),{'UserId':Number(_0xe8481f['query'][_0xefb4('0x6f')][_0x545f65]),'ChatQueueId':Number(_0xe8481f[_0xefb4('0x5f')]['id'])});}}else{socket[_0xefb4('0x78')](_0xefb4('0x8d'),{'UserId':Number(_0xe8481f[_0xefb4('0x43')][_0xefb4('0x6f')]),'ChatQueueId':Number(_0xe8481f[_0xefb4('0x5f')]['id'])});}});}})[_0xefb4('0x21')](respondWithStatusCode(_0x349d19,null))[_0xefb4('0x2c')](handleError(_0x349d19,null));};exports['getAgents']=function(_0x2298d4,_0x3a2002,_0x5b235e){var _0x571ee4={};var _0x2ce672={};var _0x45af55;var _0x343d18;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x2298d4[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x3a2002,null))['then'](function(_0x2eb177){if(_0x2eb177){_0x45af55=_0x2eb177;_0x2ce672[_0xefb4('0x42')]=_[_0xefb4('0x44')](db['User'][_0xefb4('0x3e')]);_0x2ce672[_0xefb4('0x43')]=_[_0xefb4('0x44')](_0x2298d4[_0xefb4('0x43')]);_0x2ce672[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x2ce672[_0xefb4('0x42')],_0x2ce672[_0xefb4('0x43')]);_0x571ee4[_0xefb4('0x46')]=_[_0xefb4('0x45')](_0x2ce672['model'],qs['fields'](_0x2298d4['query'][_0xefb4('0x47')]));_0x571ee4[_0xefb4('0x46')]=_0x571ee4[_0xefb4('0x46')]['length']?_0x571ee4[_0xefb4('0x46')]:_0x2ce672[_0xefb4('0x42')];_0x571ee4['order']=qs['sort'](_0x2298d4[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x571ee4['where']=qs[_0xefb4('0x4c')](_[_0xefb4('0x64')](_0x2298d4[_0xefb4('0x43')],_0x2ce672[_0xefb4('0x4c')]));if(_0x2298d4['query'][_0xefb4('0x66')]){_0x571ee4[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x571ee4[_0xefb4('0x4b')],{'$or':_['map'](_0x571ee4[_0xefb4('0x46')],function(_0x55222c){var _0xf62ad1={};_0xf62ad1[_0x55222c]={'$like':'%'+_0x2298d4[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0xf62ad1;})});}_0x571ee4=_[_0xefb4('0x4d')]({},_0x571ee4,_0x2298d4[_0xefb4('0x56')]);return _0x45af55[_0xefb4('0x92')](_0x571ee4);}})[_0xefb4('0x21')](function(_0x502ccd){if(_0x502ccd){_0x343d18=_0x502ccd['length'];if(!_0x2298d4[_0xefb4('0x43')][_0xefb4('0x63')](_0xefb4('0x48'))){_0x571ee4['limit']=qs[_0xefb4('0x32')](_0x2298d4['query']['limit']);_0x571ee4[_0xefb4('0x31')]=qs[_0xefb4('0x31')](_0x2298d4[_0xefb4('0x43')]['offset']);}return _0x45af55[_0xefb4('0x92')](_0x571ee4);}})['then'](function(_0x56dd63){if(_0x56dd63){return _0x56dd63?{'count':_0x343d18,'rows':_0x56dd63}:null;}})[_0xefb4('0x21')](respondWithResult(_0x3a2002,null))['catch'](handleError(_0x3a2002,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 787dd0a..396cad6 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(_0x2b16c8,_0x33d9aa){var _0x4a7e1f=function(_0x5eb6ab){while(--_0x5eb6ab){_0x2b16c8['push'](_0x2b16c8['shift']());}};_0x4a7e1f(++_0x33d9aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0xb10b[_0x31bd8b];return _0x1506e4;};'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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x4f8fcf,_0x1caa89){var _0x2b7958=function(_0x3a96b8){while(--_0x3a96b8){_0x4f8fcf['push'](_0x4f8fcf['shift']());}};_0x2b7958(++_0x1caa89);}(_0x5f2f,0x73));var _0xf5f2=function(_0x187949,_0x14e3d9){_0x187949=_0x187949-0x0;var _0x4b348c=_0x5f2f[_0x187949];return _0x4b348c;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9974e50..ad24272 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 _0x07d4=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x37e2f5,_0x587cf9){var _0x41c16c=function(_0x18b8b6){while(--_0x18b8b6){_0x37e2f5['push'](_0x37e2f5['shift']());}};_0x41c16c(++_0x587cf9);}(_0x07d4,0xb6));var _0x407d=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x07d4[_0x13b3b5];return _0x337cd0;};'use strict';var _=require(_0x407d('0x0'));var util=require('util');var logger=require(_0x407d('0x1'))(_0x407d('0x2'));var moment=require(_0x407d('0x3'));var BPromise=require(_0x407d('0x4'));var rp=require(_0x407d('0x5'));var fs=require('fs');var path=require(_0x407d('0x6'));var rimraf=require('rimraf');var config=require(_0x407d('0x7'));var attributes=require(_0x407d('0x8'));module[_0x407d('0x9')]=function(_0x1cbd9c,_0x3d142d){return _0x1cbd9c[_0x407d('0xa')](_0x407d('0xb'),attributes,{'tableName':_0x407d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ca4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash'];(function(_0x1040f4,_0x121c51){var _0x43563b=function(_0x177ef8){while(--_0x177ef8){_0x1040f4['push'](_0x1040f4['shift']());}};_0x43563b(++_0x121c51);}(_0x5ca4,0x11d));var _0x45ca=function(_0x5a9c7a,_0x51fa85){_0x5a9c7a=_0x5a9c7a-0x0;var _0x4888a1=_0x5ca4[_0x5a9c7a];return _0x4888a1;};'use strict';var _=require(_0x45ca('0x0'));var util=require(_0x45ca('0x1'));var logger=require(_0x45ca('0x2'))('api');var moment=require(_0x45ca('0x3'));var BPromise=require(_0x45ca('0x4'));var rp=require(_0x45ca('0x5'));var fs=require('fs');var path=require(_0x45ca('0x6'));var rimraf=require(_0x45ca('0x7'));var config=require(_0x45ca('0x8'));var attributes=require(_0x45ca('0x9'));module[_0x45ca('0xa')]=function(_0x401d57,_0x2203dc){return _0x401d57['define'](_0x45ca('0xb'),attributes,{'tableName':_0x45ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 2a70099..85c5e8d 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 _0x1c45=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23017d,_0x38695c){var _0x315230=function(_0x3ceca1){while(--_0x3ceca1){_0x23017d['push'](_0x23017d['shift']());}};_0x315230(++_0x38695c);}(_0x1c45,0x1b0));var _0x51c4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c45[_0x432682];return _0x463d05;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));var BPromise=require(_0x51c4('0x3'));var rs=require(_0x51c4('0x4'));var fs=require('fs');var Redis=require(_0x51c4('0x5'));var db=require(_0x51c4('0x6'))['db'];var utils=require(_0x51c4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x51c4('0x8'));var jayson=require(_0x51c4('0x9'));var client=jayson[_0x51c4('0xa')][_0x51c4('0xb')]({'port':0x232a});config[_0x51c4('0xc')]=_[_0x51c4('0xd')](config[_0x51c4('0xc')],{'host':_0x51c4('0xe'),'port':0x18eb});var socket=require(_0x51c4('0xf'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x51c4('0x10')](socket);function respondWithRpcPromise(_0x3f0716,_0x42e523,_0xab88cb){return new BPromise(function(_0x109781,_0x1882e7){return client['request'](_0x3f0716,_0xab88cb)[_0x51c4('0x11')](function(_0xb3ac98){logger[_0x51c4('0x12')](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));logger[_0x51c4('0x15')](_0x51c4('0x16'),_0x42e523,_0x51c4('0x14'),JSON[_0x51c4('0x17')](_0xb3ac98));if(_0xb3ac98[_0x51c4('0x18')]){if(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x19')]===0x1f4){logger[_0x51c4('0x18')]('ChatQueue,\x20%s,\x20%s',_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x1882e7(_0xb3ac98['error'][_0x51c4('0x1a')]);}logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x109781(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);}else{logger['info'](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));_0x109781(_0xb3ac98['result'][_0x51c4('0x1a')]);}})['catch'](function(_0x2b3e0b){logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0x2b3e0b);_0x1882e7(_0x2b3e0b);});});}exports[_0x51c4('0x1b')]=function(_0x535690){var _0x3a67ed=this;return new Promise(function(_0x3842d8,_0x47878a){return db['ChatQueue'][_0x51c4('0x1c')]({'raw':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'limit':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')]||null:null,'include':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x535690[_0x51c4('0x1d')]['include'],function(_0x367065){return{'model':db[_0x367065[_0x51c4('0x23')]],'as':_0x367065['as'],'attributes':_0x367065[_0x51c4('0x1f')],'include':_0x367065[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x367065[_0x51c4('0x21')],function(_0xe2f167){return{'model':db[_0xe2f167[_0x51c4('0x23')]],'as':_0xe2f167['as'],'attributes':_0xe2f167[_0x51c4('0x1f')],'include':_0xe2f167[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0xe2f167[_0x51c4('0x21')],function(_0x32ef99){return{'model':db[_0x32ef99[_0x51c4('0x23')]],'as':_0x32ef99['as'],'attributes':_0x32ef99[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cfff4){logger[_0x51c4('0x12')]('GetChatQueue',_0x535690);logger[_0x51c4('0x15')](_0x51c4('0x1b'),_0x535690,JSON[_0x51c4('0x17')](_0x3cfff4));_0x3842d8(_0x3cfff4);})[_0x51c4('0x24')](function(_0x227940){logger['error'](_0x51c4('0x1b'),_0x227940[_0x51c4('0x1a')],_0x535690);_0x47878a(_0x3a67ed[_0x51c4('0x18')](0x1f4,_0x227940[_0x51c4('0x1a')]));});});};exports['ShowChatQueue']=function(_0x4af023){var _0xb46c43=this;return new Promise(function(_0x3e4cbd,_0x4fd966){return db[_0x51c4('0x25')][_0x51c4('0x26')]({'raw':_0x4af023['options']?_0x4af023['options'][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4af023[_0x51c4('0x1d')]?_0x4af023[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x4af023[_0x51c4('0x1d')]?_0x4af023[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'include':_0x4af023[_0x51c4('0x1d')]?_0x4af023['options'][_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4af023['options'][_0x51c4('0x21')],function(_0x4dcbda){return{'model':db[_0x4dcbda[_0x51c4('0x23')]],'as':_0x4dcbda['as'],'attributes':_0x4dcbda[_0x51c4('0x1f')],'include':_0x4dcbda[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4dcbda[_0x51c4('0x21')],function(_0x4f77a7){return{'model':db[_0x4f77a7[_0x51c4('0x23')]],'as':_0x4f77a7['as'],'attributes':_0x4f77a7['attributes'],'include':_0x4f77a7[_0x51c4('0x21')]?_[_0x51c4('0x22')](_0x4f77a7[_0x51c4('0x21')],function(_0x3169c8){return{'model':db[_0x3169c8[_0x51c4('0x23')]],'as':_0x3169c8['as'],'attributes':_0x3169c8[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x51c4('0x11')](function(_0xfcc949){logger[_0x51c4('0x12')](_0x51c4('0x27'),_0x4af023);logger[_0x51c4('0x15')](_0x51c4('0x27'),_0x4af023,JSON[_0x51c4('0x17')](_0xfcc949));_0x3e4cbd(_0xfcc949);})[_0x51c4('0x24')](function(_0x493d97){logger[_0x51c4('0x18')](_0x51c4('0x27'),_0x493d97[_0x51c4('0x1a')],_0x4af023);_0x4fd966(_0xb46c43[_0x51c4('0x18')](0x1f4,_0x493d97[_0x51c4('0x1a')]));});});}; \ No newline at end of file +var _0x6302=['http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowChatQueue','find','raw','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6302,0x109));var _0x2630=function(_0x541c36,_0xbc5950){_0x541c36=_0x541c36-0x0;var _0x252704=_0x6302[_0x541c36];return _0x252704;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});config[_0x2630('0x9')]=_[_0x2630('0xa')](config[_0x2630('0x9')],{'host':_0x2630('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2630('0xc'))[_0x2630('0xd')](socket);function respondWithRpcPromise(_0x582c0c,_0x115d6d,_0x517124){return new BPromise(function(_0x1d1b18,_0x569a0c){return client[_0x2630('0xe')](_0x582c0c,_0x517124)[_0x2630('0xf')](function(_0x28d302){logger[_0x2630('0x10')](_0x2630('0x11'),_0x115d6d,_0x2630('0x12'));logger['debug'](_0x2630('0x13'),_0x115d6d,_0x2630('0x12'),JSON[_0x2630('0x14')](_0x28d302));if(_0x28d302[_0x2630('0x15')]){if(_0x28d302['error'][_0x2630('0x16')]===0x1f4){logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x28d302['error'][_0x2630('0x17')]);return _0x569a0c(_0x28d302['error'][_0x2630('0x17')]);}logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x28d302[_0x2630('0x15')][_0x2630('0x17')]);return _0x1d1b18(_0x28d302[_0x2630('0x15')][_0x2630('0x17')]);}else{logger[_0x2630('0x10')]('ChatQueue,\x20%s,\x20%s',_0x115d6d,_0x2630('0x12'));_0x1d1b18(_0x28d302['result']['message']);}})['catch'](function(_0x17d98b){logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x17d98b);_0x569a0c(_0x17d98b);});});}exports[_0x2630('0x18')]=function(_0x1c292c){var _0x7ec957=this;return new Promise(function(_0x4364a0,_0x608d15){return db[_0x2630('0x19')][_0x2630('0x1a')]({'raw':_0x1c292c[_0x2630('0x1b')]?_0x1c292c[_0x2630('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c292c['options']?_0x1c292c[_0x2630('0x1b')][_0x2630('0x1c')]||null:null,'attributes':_0x1c292c['options']?_0x1c292c[_0x2630('0x1b')]['attributes']||null:null,'limit':_0x1c292c[_0x2630('0x1b')]?_0x1c292c[_0x2630('0x1b')][_0x2630('0x1d')]||null:null,'include':_0x1c292c[_0x2630('0x1b')]?_0x1c292c['options'][_0x2630('0x1e')]?_[_0x2630('0x1f')](_0x1c292c[_0x2630('0x1b')][_0x2630('0x1e')],function(_0x3468dc){return{'model':db[_0x3468dc[_0x2630('0x20')]],'as':_0x3468dc['as'],'attributes':_0x3468dc[_0x2630('0x21')],'include':_0x3468dc[_0x2630('0x1e')]?_['map'](_0x3468dc['include'],function(_0x1e57d6){return{'model':db[_0x1e57d6[_0x2630('0x20')]],'as':_0x1e57d6['as'],'attributes':_0x1e57d6[_0x2630('0x21')],'include':_0x1e57d6['include']?_[_0x2630('0x1f')](_0x1e57d6[_0x2630('0x1e')],function(_0x3e0f49){return{'model':db[_0x3e0f49['model']],'as':_0x3e0f49['as'],'attributes':_0x3e0f49[_0x2630('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x336226){logger['info'](_0x2630('0x18'),_0x1c292c);logger[_0x2630('0x22')]('GetChatQueue',_0x1c292c,JSON[_0x2630('0x14')](_0x336226));_0x4364a0(_0x336226);})['catch'](function(_0x547d25){logger[_0x2630('0x15')](_0x2630('0x18'),_0x547d25['message'],_0x1c292c);_0x608d15(_0x7ec957[_0x2630('0x15')](0x1f4,_0x547d25[_0x2630('0x17')]));});});};exports[_0x2630('0x23')]=function(_0x2ee2b6){var _0x2abe44=this;return new Promise(function(_0x355fe7,_0x357035){return db['ChatQueue'][_0x2630('0x24')]({'raw':_0x2ee2b6[_0x2630('0x1b')]?_0x2ee2b6['options'][_0x2630('0x25')]===undefined?!![]:![]:!![],'where':_0x2ee2b6['options']?_0x2ee2b6[_0x2630('0x1b')]['where']||null:null,'attributes':_0x2ee2b6['options']?_0x2ee2b6[_0x2630('0x1b')][_0x2630('0x21')]||null:null,'include':_0x2ee2b6[_0x2630('0x1b')]?_0x2ee2b6['options'][_0x2630('0x1e')]?_[_0x2630('0x1f')](_0x2ee2b6['options'][_0x2630('0x1e')],function(_0x3975d1){return{'model':db[_0x3975d1['model']],'as':_0x3975d1['as'],'attributes':_0x3975d1[_0x2630('0x21')],'include':_0x3975d1['include']?_[_0x2630('0x1f')](_0x3975d1[_0x2630('0x1e')],function(_0x55bb15){return{'model':db[_0x55bb15[_0x2630('0x20')]],'as':_0x55bb15['as'],'attributes':_0x55bb15[_0x2630('0x21')],'include':_0x55bb15['include']?_[_0x2630('0x1f')](_0x55bb15[_0x2630('0x1e')],function(_0x369908){return{'model':db[_0x369908[_0x2630('0x20')]],'as':_0x369908['as'],'attributes':_0x369908[_0x2630('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2630('0xf')](function(_0x22de2d){logger[_0x2630('0x10')](_0x2630('0x23'),_0x2ee2b6);logger['debug'](_0x2630('0x23'),_0x2ee2b6,JSON['stringify'](_0x22de2d));_0x355fe7(_0x22de2d);})[_0x2630('0x26')](function(_0x3d7106){logger[_0x2630('0x15')](_0x2630('0x23'),_0x3d7106[_0x2630('0x17')],_0x2ee2b6);_0x357035(_0x2abe44[_0x2630('0x15')](0x1f4,_0x3d7106['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 16ffadd..0b879bd 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x405e13,_0x1ed8d3){var _0x5eb8a5=function(_0x3fbeb0){while(--_0x3fbeb0){_0x405e13['push'](_0x405e13['shift']());}};_0x5eb8a5(++_0x1ed8d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c227d,_0x23bb40){_0x5c227d=_0x5c227d-0x0;var _0x33986a=_0x5f2f[_0x5c227d];return _0x33986a;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x36f6fb,_0x249aa3){var _0x39c006=function(_0x2ba353){while(--_0x2ba353){_0x36f6fb['push'](_0x36f6fb['shift']());}};_0x39c006(++_0x249aa3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a98b6,_0x5436bb){_0x1a98b6=_0x1a98b6-0x0;var _0x38bac6=_0x5f2f[_0x1a98b6];return _0x38bac6;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7b4e1f2..ac907bd 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 _0x162c=['/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x162c,0x189));var _0xc162=function(_0xa30bad,_0x40e784){_0xa30bad=_0xa30bad-0x0;var _0x118bd3=_0x162c[_0xa30bad];return _0x118bd3;};'use strict';var multer=require(_0xc162('0x0'));var util=require('util');var path=require(_0xc162('0x1'));var timeout=require('connect-timeout');var express=require(_0xc162('0x2'));var router=express[_0xc162('0x3')]();var auth=require(_0xc162('0x4'));var interaction=require(_0xc162('0x5'));var config=require(_0xc162('0x6'));var controller=require('./chatQueue.controller');router[_0xc162('0x7')]('/',auth['isAuthenticated'](),controller[_0xc162('0x8')]);router['get'](_0xc162('0x9'),auth[_0xc162('0xa')](),controller[_0xc162('0xb')]);router[_0xc162('0x7')](_0xc162('0xc'),auth[_0xc162('0xa')](),controller['show']);router[_0xc162('0x7')](_0xc162('0xd'),auth['isAuthenticated'](),controller[_0xc162('0xe')]);router[_0xc162('0x7')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x10')]);router[_0xc162('0x7')]('/:id/users',auth[_0xc162('0xa')](),controller[_0xc162('0x11')]);router[_0xc162('0x12')]('/',auth[_0xc162('0xa')](),controller[_0xc162('0x13')]);router[_0xc162('0x12')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x14')]);router[_0xc162('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xc162('0x15')]);router[_0xc162('0x16')](_0xc162('0xc'),auth[_0xc162('0xa')](),controller[_0xc162('0x17')]);router[_0xc162('0x18')](_0xc162('0xc'),auth['isAuthenticated'](),controller[_0xc162('0x19')]);router[_0xc162('0x18')](_0xc162('0xf'),auth[_0xc162('0xa')](),controller[_0xc162('0x1a')]);router[_0xc162('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xc162('0x1b')]);module[_0xc162('0x1c')]=router; \ No newline at end of file +var _0xa1dd=['/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x24d4da,_0x57c43d){var _0x3e9102=function(_0x3a12b2){while(--_0x3a12b2){_0x24d4da['push'](_0x24d4da['shift']());}};_0x3e9102(++_0x57c43d);}(_0xa1dd,0x15e));var _0xda1d=function(_0x36c465,_0x5c21bf){_0x36c465=_0x36c465-0x0;var _0x122e60=_0xa1dd[_0x36c465];return _0x122e60;};'use strict';var multer=require(_0xda1d('0x0'));var util=require(_0xda1d('0x1'));var path=require(_0xda1d('0x2'));var timeout=require(_0xda1d('0x3'));var express=require(_0xda1d('0x4'));var router=express[_0xda1d('0x5')]();var auth=require(_0xda1d('0x6'));var interaction=require(_0xda1d('0x7'));var config=require('../../config/environment');var controller=require(_0xda1d('0x8'));router[_0xda1d('0x9')]('/',auth[_0xda1d('0xa')](),controller[_0xda1d('0xb')]);router[_0xda1d('0x9')](_0xda1d('0xc'),auth['isAuthenticated'](),controller[_0xda1d('0xd')]);router[_0xda1d('0x9')](_0xda1d('0xe'),auth['isAuthenticated'](),controller[_0xda1d('0xf')]);router['get']('/:id/members',auth[_0xda1d('0xa')](),controller[_0xda1d('0x10')]);router['get']('/:id/teams',auth[_0xda1d('0xa')](),controller[_0xda1d('0x11')]);router[_0xda1d('0x9')](_0xda1d('0x12'),auth['isAuthenticated'](),controller[_0xda1d('0x13')]);router[_0xda1d('0x14')]('/',auth['isAuthenticated'](),controller[_0xda1d('0x15')]);router['post'](_0xda1d('0x16'),auth[_0xda1d('0xa')](),controller[_0xda1d('0x17')]);router[_0xda1d('0x14')](_0xda1d('0x12'),auth[_0xda1d('0xa')](),controller['addAgents']);router[_0xda1d('0x18')](_0xda1d('0xe'),auth[_0xda1d('0xa')](),controller[_0xda1d('0x19')]);router[_0xda1d('0x1a')](_0xda1d('0xe'),auth[_0xda1d('0xa')](),controller['destroy']);router[_0xda1d('0x1a')](_0xda1d('0x16'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xda1d('0x1a')]('/:id/users',auth[_0xda1d('0xa')](),controller[_0xda1d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3a6f4a1..1e2a5b2 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 _0x140a=['exports','STRING','DATE','moment'];(function(_0x579d00,_0x2f2a51){var _0x4d06e0=function(_0x2f3328){while(--_0x2f3328){_0x579d00['push'](_0x579d00['shift']());}};_0x4d06e0(++_0x2f2a51);}(_0x140a,0xfb));var _0xa140=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x140a[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require(_0xa140('0x0'));var Sequelize=require('sequelize');module[_0xa140('0x1')]={'uniqueid':{'type':Sequelize[_0xa140('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa140('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa140('0x3')]},'exitAt':{'type':Sequelize[_0xa140('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x443b=['STRING','DATE','moment','sequelize','exports'];(function(_0x5171ee,_0x49024d){var _0x306409=function(_0x48f94b){while(--_0x48f94b){_0x5171ee['push'](_0x5171ee['shift']());}};_0x306409(++_0x49024d);}(_0x443b,0xe3));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xb443('0x0'));var Sequelize=require(_0xb443('0x1'));module[_0xb443('0x2')]={'uniqueid':{'type':Sequelize[_0xb443('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb443('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb443('0x4')]},'exitAt':{'type':Sequelize[_0xb443('0x4')]},'reason':{'type':Sequelize[_0xb443('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f3f9a1e..e56d799 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 _0x823f=['../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','include','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x823f,0x161));var _0xf823=function(_0x5390a3,_0x4d60f7){_0x5390a3=_0x5390a3-0x0;var _0x45d220=_0x823f[_0x5390a3];return _0x45d220;};'use strict';var pdf=require(_0xf823('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf823('0x1'));var jsonpatch=require(_0xf823('0x2'));var rp=require(_0xf823('0x3'));var moment=require(_0xf823('0x4'));var BPromise=require(_0xf823('0x5'));var Mustache=require('mustache');var util=require(_0xf823('0x6'));var path=require(_0xf823('0x7'));var sox=require(_0xf823('0x8'));var csv=require(_0xf823('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf823('0xa'));var squel=require(_0xf823('0xb'));var crypto=require(_0xf823('0xc'));var jsforce=require(_0xf823('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf823('0x9'));var querystring=require(_0xf823('0xe'));var Papa=require(_0xf823('0xf'));var Redis=require('ioredis');var authService=require(_0xf823('0x10'));var qs=require(_0xf823('0x11'));var as=require(_0xf823('0x12'));var hardwareService=require(_0xf823('0x13'));var logger=require('../../config/logger')(_0xf823('0x14'));var utils=require(_0xf823('0x15'));var config=require(_0xf823('0x16'));var licenseUtil=require(_0xf823('0x17'));var db=require(_0xf823('0x18'))['db'];function respondWithStatusCode(_0x5b8ba9,_0x1a04a3){_0x1a04a3=_0x1a04a3||0xcc;return function(_0x3e676f){if(_0x3e676f){return _0x5b8ba9['sendStatus'](_0x1a04a3);}return _0x5b8ba9[_0xf823('0x19')](_0x1a04a3)[_0xf823('0x1a')]();};}function respondWithResult(_0x5ab1d0,_0x46d7db){_0x46d7db=_0x46d7db||0xc8;return function(_0x2e2795){if(_0x2e2795){return _0x5ab1d0['status'](_0x46d7db)['json'](_0x2e2795);}};}function respondWithFilteredResult(_0x56e99a,_0x3810d8){return function(_0x1f183b){if(_0x1f183b){var _0x1c00ca=_0x1f183b[_0xf823('0x1b')],_0x222b2f=_0x3810d8[_0xf823('0x1c')],_0x2bea02=_0x3810d8[_0xf823('0x1c')]+_0x3810d8[_0xf823('0x1d')],_0x2399c0;if(_0x2bea02>=_0x1c00ca){_0x2bea02=_0x1c00ca;_0x2399c0=0xc8;}else{_0x2399c0=0xce;}_0x56e99a[_0xf823('0x19')](_0x2399c0);return _0x56e99a[_0xf823('0x1e')](_0xf823('0x1f'),_0x222b2f+'-'+_0x2bea02+'/'+_0x1c00ca)[_0xf823('0x20')](_0x1f183b);}return null;};}function patchUpdates(_0x3cde30){return function(_0x20672c){try{jsonpatch['apply'](_0x20672c,_0x3cde30,!![]);}catch(_0x2373b4){return BPromise[_0xf823('0x21')](_0x2373b4);}return _0x20672c[_0xf823('0x22')]();};}function saveUpdates(_0x4a099e,_0x4ec5a7){return function(_0x122df6){if(_0x122df6){return _0x122df6[_0xf823('0x23')](_0x4a099e)['then'](function(_0x409da7){return _0x409da7;});}return null;};}function removeEntity(_0x2868b5,_0x3ca843){return function(_0x6bd316){if(_0x6bd316){return _0x6bd316[_0xf823('0x24')]()[_0xf823('0x25')](function(){_0x2868b5['status'](0xcc)[_0xf823('0x1a')]();});}};}function handleEntityNotFound(_0x394c92,_0x49f968){return function(_0x4e610a){if(!_0x4e610a){_0x394c92[_0xf823('0x26')](0x194);}return _0x4e610a;};}function handleError(_0x2a47d6,_0x5a236b){_0x5a236b=_0x5a236b||0x1f4;return function(_0xca43f3){logger[_0xf823('0x27')](_0xca43f3[_0xf823('0x28')]);if(_0xca43f3[_0xf823('0x29')]){delete _0xca43f3['name'];}_0x2a47d6[_0xf823('0x19')](_0x5a236b)['send'](_0xca43f3);};}exports[_0xf823('0x2a')]=function(_0x48d973,_0x561d90){var _0x2d90ad={},_0x5d0a53={},_0x545e2d={'count':0x0,'rows':[]};var _0x558e66=_[_0xf823('0x2b')](db[_0xf823('0x2c')][_0xf823('0x2d')],function(_0x322d40){return{'name':_0x322d40[_0xf823('0x2e')],'type':_0x322d40[_0xf823('0x2f')][_0xf823('0x30')]};});_0x5d0a53[_0xf823('0x31')]=_[_0xf823('0x2b')](_0x558e66,_0xf823('0x29'));_0x5d0a53[_0xf823('0x32')]=_[_0xf823('0x33')](_0x48d973[_0xf823('0x32')]);_0x5d0a53[_0xf823('0x34')]=_[_0xf823('0x35')](_0x5d0a53['model'],_0x5d0a53[_0xf823('0x32')]);_0x2d90ad[_0xf823('0x36')]=_[_0xf823('0x35')](_0x5d0a53[_0xf823('0x31')],qs[_0xf823('0x37')](_0x48d973[_0xf823('0x32')][_0xf823('0x37')]));_0x2d90ad[_0xf823('0x36')]=_0x2d90ad[_0xf823('0x36')][_0xf823('0x38')]?_0x2d90ad[_0xf823('0x36')]:_0x5d0a53[_0xf823('0x31')];if(!_0x48d973['query'][_0xf823('0x39')](_0xf823('0x3a'))){_0x2d90ad[_0xf823('0x1d')]=qs[_0xf823('0x1d')](_0x48d973[_0xf823('0x32')][_0xf823('0x1d')]);_0x2d90ad[_0xf823('0x1c')]=qs['offset'](_0x48d973[_0xf823('0x32')]['offset']);}_0x2d90ad[_0xf823('0x3b')]=qs[_0xf823('0x3c')](_0x48d973[_0xf823('0x32')][_0xf823('0x3c')]);_0x2d90ad[_0xf823('0x3d')]=qs[_0xf823('0x34')](_[_0xf823('0x3e')](_0x48d973['query'],_0x5d0a53[_0xf823('0x34')]),_0x558e66);if(_0x48d973['query']['filter']){_0x2d90ad['where']=_[_0xf823('0x3f')](_0x2d90ad[_0xf823('0x3d')],{'$or':_[_0xf823('0x2b')](_0x558e66,function(_0x93adb1){if(_0x93adb1[_0xf823('0x2f')]!==_0xf823('0x40')){var _0xe114={};_0xe114[_0x93adb1[_0xf823('0x29')]]={'$like':'%'+_0x48d973['query'][_0xf823('0x41')]+'%'};return _0xe114;}})});}_0x2d90ad=_[_0xf823('0x3f')]({},_0x2d90ad,_0x48d973['options']);var _0x19341f={'where':_0x2d90ad[_0xf823('0x3d')]};return db[_0xf823('0x2c')][_0xf823('0x1b')](_0x19341f)[_0xf823('0x25')](function(_0x3a1e29){_0x545e2d[_0xf823('0x1b')]=_0x3a1e29;if(_0x48d973[_0xf823('0x32')]['includeAll']){_0x2d90ad['include']=[{'all':!![]}];}return db[_0xf823('0x2c')][_0xf823('0x42')](_0x2d90ad);})[_0xf823('0x25')](function(_0x5a759e){_0x545e2d['rows']=_0x5a759e;return _0x545e2d;})[_0xf823('0x25')](respondWithFilteredResult(_0x561d90,_0x2d90ad))[_0xf823('0x43')](handleError(_0x561d90,null));};exports[_0xf823('0x44')]=function(_0xa93682,_0x2b11d4){var _0x2991f0={'raw':!![],'where':{'id':_0xa93682[_0xf823('0x45')]['id']}},_0x57cb5d={};_0x57cb5d['model']=_[_0xf823('0x33')](db[_0xf823('0x2c')]['rawAttributes']);_0x57cb5d['query']=_['keys'](_0xa93682[_0xf823('0x32')]);_0x57cb5d[_0xf823('0x34')]=_['intersection'](_0x57cb5d[_0xf823('0x31')],_0x57cb5d[_0xf823('0x32')]);_0x2991f0[_0xf823('0x36')]=_[_0xf823('0x35')](_0x57cb5d[_0xf823('0x31')],qs[_0xf823('0x37')](_0xa93682[_0xf823('0x32')][_0xf823('0x37')]));_0x2991f0[_0xf823('0x36')]=_0x2991f0['attributes'][_0xf823('0x38')]?_0x2991f0[_0xf823('0x36')]:_0x57cb5d[_0xf823('0x31')];if(_0xa93682[_0xf823('0x32')]['includeAll']){_0x2991f0[_0xf823('0x46')]=[{'all':!![]}];}_0x2991f0=_[_0xf823('0x3f')]({},_0x2991f0,_0xa93682['options']);return db[_0xf823('0x2c')][_0xf823('0x47')](_0x2991f0)['then'](handleEntityNotFound(_0x2b11d4,null))[_0xf823('0x25')](respondWithResult(_0x2b11d4,null))[_0xf823('0x43')](handleError(_0x2b11d4,null));};exports[_0xf823('0x48')]=function(_0x7d6da5,_0x2e57f7){return db['ChatQueueReport'][_0xf823('0x48')](_0x7d6da5[_0xf823('0x49')],{})[_0xf823('0x25')](respondWithResult(_0x2e57f7,0xc9))[_0xf823('0x43')](handleError(_0x2e57f7,null));};exports[_0xf823('0x23')]=function(_0x3e06b3,_0x2ae884){if(_0x3e06b3[_0xf823('0x49')]['id']){delete _0x3e06b3['body']['id'];}return db[_0xf823('0x2c')][_0xf823('0x47')]({'where':{'id':_0x3e06b3[_0xf823('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ae884,null))['then'](saveUpdates(_0x3e06b3[_0xf823('0x49')],null))['then'](respondWithResult(_0x2ae884,null))[_0xf823('0x43')](handleError(_0x2ae884,null));};exports[_0xf823('0x24')]=function(_0x41af96,_0x1b4796){return db[_0xf823('0x2c')][_0xf823('0x47')]({'where':{'id':_0x41af96[_0xf823('0x45')]['id']}})[_0xf823('0x25')](handleEntityNotFound(_0x1b4796,null))['then'](removeEntity(_0x1b4796,null))[_0xf823('0x43')](handleError(_0x1b4796,null));};exports[_0xf823('0x4a')]=function(_0x529c55,_0x47ef44){return db[_0xf823('0x2c')][_0xf823('0x4a')]()['then'](respondWithResult(_0x47ef44,null))[_0xf823('0x43')](handleError(_0x47ef44,null));}; \ No newline at end of file +var _0x90cf=['show','params','include','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','index','ChatQueueReport','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x906ca6,_0x592235){var _0x12dd8b=function(_0x20f636){while(--_0x20f636){_0x906ca6['push'](_0x906ca6['shift']());}};_0x12dd8b(++_0x592235);}(_0x90cf,0x9c));var _0xf90c=function(_0x334fc2,_0x443008){_0x334fc2=_0x334fc2-0x0;var _0x4cba29=_0x90cf[_0x334fc2];return _0x4cba29;};'use strict';var pdf=require(_0xf90c('0x0'));var emlformat=require(_0xf90c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf90c('0x2'));var jsonpatch=require(_0xf90c('0x3'));var rp=require(_0xf90c('0x4'));var moment=require(_0xf90c('0x5'));var BPromise=require(_0xf90c('0x6'));var Mustache=require('mustache');var util=require(_0xf90c('0x7'));var path=require('path');var sox=require(_0xf90c('0x8'));var csv=require('to-csv');var ejs=require(_0xf90c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf90c('0xa'));var crypto=require(_0xf90c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf90c('0xc'));var querystring=require(_0xf90c('0xd'));var Papa=require(_0xf90c('0xe'));var Redis=require(_0xf90c('0xf'));var authService=require(_0xf90c('0x10'));var qs=require(_0xf90c('0x11'));var as=require(_0xf90c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf90c('0x13'))(_0xf90c('0x14'));var utils=require(_0xf90c('0x15'));var config=require(_0xf90c('0x16'));var licenseUtil=require(_0xf90c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d521,_0x42acc4){_0x42acc4=_0x42acc4||0xcc;return function(_0x41d856){if(_0x41d856){return _0x42d521[_0xf90c('0x18')](_0x42acc4);}return _0x42d521['status'](_0x42acc4)[_0xf90c('0x19')]();};}function respondWithResult(_0x1ea706,_0x5419d4){_0x5419d4=_0x5419d4||0xc8;return function(_0x43ceeb){if(_0x43ceeb){return _0x1ea706[_0xf90c('0x1a')](_0x5419d4)[_0xf90c('0x1b')](_0x43ceeb);}};}function respondWithFilteredResult(_0x5a0fd8,_0x25d79b){return function(_0x2f8478){if(_0x2f8478){var _0x2551e8=_0x2f8478[_0xf90c('0x1c')],_0x3ccd1f=_0x25d79b[_0xf90c('0x1d')],_0x1e8211=_0x25d79b['offset']+_0x25d79b[_0xf90c('0x1e')],_0x1ea016;if(_0x1e8211>=_0x2551e8){_0x1e8211=_0x2551e8;_0x1ea016=0xc8;}else{_0x1ea016=0xce;}_0x5a0fd8[_0xf90c('0x1a')](_0x1ea016);return _0x5a0fd8['set'](_0xf90c('0x1f'),_0x3ccd1f+'-'+_0x1e8211+'/'+_0x2551e8)[_0xf90c('0x1b')](_0x2f8478);}return null;};}function patchUpdates(_0x502688){return function(_0x395960){try{jsonpatch[_0xf90c('0x20')](_0x395960,_0x502688,!![]);}catch(_0x410813){return BPromise[_0xf90c('0x21')](_0x410813);}return _0x395960[_0xf90c('0x22')]();};}function saveUpdates(_0x5e1e61,_0xb95d03){return function(_0xa724bb){if(_0xa724bb){return _0xa724bb['update'](_0x5e1e61)[_0xf90c('0x23')](function(_0x453b6e){return _0x453b6e;});}return null;};}function removeEntity(_0x564301,_0x5ae47a){return function(_0x129033){if(_0x129033){return _0x129033[_0xf90c('0x24')]()['then'](function(){_0x564301[_0xf90c('0x1a')](0xcc)[_0xf90c('0x19')]();});}};}function handleEntityNotFound(_0x2251d8,_0x1d9854){return function(_0x511739){if(!_0x511739){_0x2251d8[_0xf90c('0x18')](0x194);}return _0x511739;};}function handleError(_0x4ceb90,_0x2bc5ec){_0x2bc5ec=_0x2bc5ec||0x1f4;return function(_0x515a44){logger[_0xf90c('0x25')](_0x515a44[_0xf90c('0x26')]);if(_0x515a44['name']){delete _0x515a44['name'];}_0x4ceb90[_0xf90c('0x1a')](_0x2bc5ec)['send'](_0x515a44);};}exports[_0xf90c('0x27')]=function(_0x2dedaa,_0x394b96){var _0x5df1e3={},_0x52be3f={},_0x49e242={'count':0x0,'rows':[]};var _0x1a6f78=_['map'](db[_0xf90c('0x28')]['rawAttributes'],function(_0x4745a9){return{'name':_0x4745a9[_0xf90c('0x29')],'type':_0x4745a9[_0xf90c('0x2a')]['key']};});_0x52be3f[_0xf90c('0x2b')]=_[_0xf90c('0x2c')](_0x1a6f78,_0xf90c('0x2d'));_0x52be3f[_0xf90c('0x2e')]=_[_0xf90c('0x2f')](_0x2dedaa[_0xf90c('0x2e')]);_0x52be3f[_0xf90c('0x30')]=_[_0xf90c('0x31')](_0x52be3f['model'],_0x52be3f[_0xf90c('0x2e')]);_0x5df1e3[_0xf90c('0x32')]=_[_0xf90c('0x31')](_0x52be3f['model'],qs[_0xf90c('0x33')](_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x33')]));_0x5df1e3['attributes']=_0x5df1e3['attributes'][_0xf90c('0x34')]?_0x5df1e3[_0xf90c('0x32')]:_0x52be3f[_0xf90c('0x2b')];if(!_0x2dedaa[_0xf90c('0x2e')]['hasOwnProperty'](_0xf90c('0x35'))){_0x5df1e3[_0xf90c('0x1e')]=qs[_0xf90c('0x1e')](_0x2dedaa['query']['limit']);_0x5df1e3[_0xf90c('0x1d')]=qs['offset'](_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x1d')]);}_0x5df1e3[_0xf90c('0x36')]=qs[_0xf90c('0x37')](_0x2dedaa['query'][_0xf90c('0x37')]);_0x5df1e3[_0xf90c('0x38')]=qs['filters'](_[_0xf90c('0x39')](_0x2dedaa[_0xf90c('0x2e')],_0x52be3f[_0xf90c('0x30')]),_0x1a6f78);if(_0x2dedaa['query'][_0xf90c('0x3a')]){_0x5df1e3[_0xf90c('0x38')]=_[_0xf90c('0x3b')](_0x5df1e3[_0xf90c('0x38')],{'$or':_[_0xf90c('0x2c')](_0x1a6f78,function(_0x1fd88e){if(_0x1fd88e['type']!==_0xf90c('0x3c')){var _0x487d0b={};_0x487d0b[_0x1fd88e[_0xf90c('0x2d')]]={'$like':'%'+_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x3a')]+'%'};return _0x487d0b;}})});}_0x5df1e3=_[_0xf90c('0x3b')]({},_0x5df1e3,_0x2dedaa[_0xf90c('0x3d')]);var _0x845449={'where':_0x5df1e3[_0xf90c('0x38')]};return db[_0xf90c('0x28')][_0xf90c('0x1c')](_0x845449)['then'](function(_0x58d568){_0x49e242['count']=_0x58d568;if(_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x3e')]){_0x5df1e3['include']=[{'all':!![]}];}return db[_0xf90c('0x28')][_0xf90c('0x3f')](_0x5df1e3);})[_0xf90c('0x23')](function(_0x3f8134){_0x49e242[_0xf90c('0x40')]=_0x3f8134;return _0x49e242;})[_0xf90c('0x23')](respondWithFilteredResult(_0x394b96,_0x5df1e3))[_0xf90c('0x41')](handleError(_0x394b96,null));};exports[_0xf90c('0x42')]=function(_0x15c3f0,_0x1783d3){var _0x18adf3={'raw':!![],'where':{'id':_0x15c3f0[_0xf90c('0x43')]['id']}},_0x3435a2={};_0x3435a2['model']=_[_0xf90c('0x2f')](db[_0xf90c('0x28')]['rawAttributes']);_0x3435a2[_0xf90c('0x2e')]=_[_0xf90c('0x2f')](_0x15c3f0[_0xf90c('0x2e')]);_0x3435a2[_0xf90c('0x30')]=_[_0xf90c('0x31')](_0x3435a2[_0xf90c('0x2b')],_0x3435a2[_0xf90c('0x2e')]);_0x18adf3[_0xf90c('0x32')]=_[_0xf90c('0x31')](_0x3435a2[_0xf90c('0x2b')],qs[_0xf90c('0x33')](_0x15c3f0[_0xf90c('0x2e')][_0xf90c('0x33')]));_0x18adf3[_0xf90c('0x32')]=_0x18adf3[_0xf90c('0x32')][_0xf90c('0x34')]?_0x18adf3[_0xf90c('0x32')]:_0x3435a2[_0xf90c('0x2b')];if(_0x15c3f0['query']['includeAll']){_0x18adf3[_0xf90c('0x44')]=[{'all':!![]}];}_0x18adf3=_[_0xf90c('0x3b')]({},_0x18adf3,_0x15c3f0[_0xf90c('0x3d')]);return db[_0xf90c('0x28')][_0xf90c('0x45')](_0x18adf3)['then'](handleEntityNotFound(_0x1783d3,null))[_0xf90c('0x23')](respondWithResult(_0x1783d3,null))[_0xf90c('0x41')](handleError(_0x1783d3,null));};exports[_0xf90c('0x46')]=function(_0x452492,_0x383560){return db[_0xf90c('0x28')]['create'](_0x452492[_0xf90c('0x47')],{})[_0xf90c('0x23')](respondWithResult(_0x383560,0xc9))[_0xf90c('0x41')](handleError(_0x383560,null));};exports[_0xf90c('0x48')]=function(_0x86a452,_0x44c92c){if(_0x86a452[_0xf90c('0x47')]['id']){delete _0x86a452[_0xf90c('0x47')]['id'];}return db[_0xf90c('0x28')]['find']({'where':{'id':_0x86a452[_0xf90c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44c92c,null))[_0xf90c('0x23')](saveUpdates(_0x86a452[_0xf90c('0x47')],null))[_0xf90c('0x23')](respondWithResult(_0x44c92c,null))[_0xf90c('0x41')](handleError(_0x44c92c,null));};exports[_0xf90c('0x24')]=function(_0x538a51,_0x31be4b){return db[_0xf90c('0x28')][_0xf90c('0x45')]({'where':{'id':_0x538a51[_0xf90c('0x43')]['id']}})[_0xf90c('0x23')](handleEntityNotFound(_0x31be4b,null))[_0xf90c('0x23')](removeEntity(_0x31be4b,null))[_0xf90c('0x41')](handleError(_0x31be4b,null));};exports['describe']=function(_0x4c631a,_0x3cc4c6){return db[_0xf90c('0x28')][_0xf90c('0x49')]()[_0xf90c('0x23')](respondWithResult(_0x3cc4c6,null))['catch'](handleError(_0x3cc4c6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c68d2f5..08d9b83 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 _0xf349=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','lodash'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xf349,0x1ee));var _0x9f34=function(_0xfd3d87,_0x10aa44){_0xfd3d87=_0xfd3d87-0x0;var _0x21fc4a=_0xf349[_0xfd3d87];return _0x21fc4a;};'use strict';var _=require(_0x9f34('0x0'));var util=require(_0x9f34('0x1'));var logger=require(_0x9f34('0x2'))(_0x9f34('0x3'));var moment=require(_0x9f34('0x4'));var BPromise=require(_0x9f34('0x5'));var rp=require(_0x9f34('0x6'));var fs=require('fs');var path=require(_0x9f34('0x7'));var rimraf=require(_0x9f34('0x8'));var config=require(_0x9f34('0x9'));var attributes=require(_0x9f34('0xa'));module[_0x9f34('0xb')]=function(_0x53fa0f,_0x1d555b){return _0x53fa0f[_0x9f34('0xc')](_0x9f34('0xd'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9f34('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab48=['../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xab48,0xc6));var _0x8ab4=function(_0x46c1a8,_0x363524){_0x46c1a8=_0x46c1a8-0x0;var _0x1d2217=_0xab48[_0x46c1a8];return _0x1d2217;};'use strict';var _=require(_0x8ab4('0x0'));var util=require('util');var logger=require(_0x8ab4('0x1'))('api');var moment=require(_0x8ab4('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ab4('0x3'));var fs=require('fs');var path=require(_0x8ab4('0x4'));var rimraf=require(_0x8ab4('0x5'));var config=require(_0x8ab4('0x6'));var attributes=require(_0x8ab4('0x7'));module[_0x8ab4('0x8')]=function(_0x55e587,_0x10c524){return _0x55e587['define'](_0x8ab4('0x9'),attributes,{'tableName':_0x8ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x8ab4('0xb'),'fields':[_0x8ab4('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 1ca539e..0b299bc 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 _0x92e5=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','limit'];(function(_0x54ed23,_0x137310){var _0x51df35=function(_0x16cc4e){while(--_0x16cc4e){_0x54ed23['push'](_0x54ed23['shift']());}};_0x51df35(++_0x137310);}(_0x92e5,0x17a));var _0x592e=function(_0x2a152f,_0x1bc9ce){_0x2a152f=_0x2a152f-0x0;var _0x3f4113=_0x92e5[_0x2a152f];return _0x3f4113;};'use strict';var _=require(_0x592e('0x0'));var util=require(_0x592e('0x1'));var moment=require('moment');var BPromise=require(_0x592e('0x2'));var rs=require(_0x592e('0x3'));var fs=require('fs');var Redis=require(_0x592e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x592e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x592e('0x6'));var client=jayson[_0x592e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x259660,_0x31ade9,_0x35f645){return new BPromise(function(_0x5534f9,_0x52e91c){return client['request'](_0x259660,_0x35f645)[_0x592e('0x8')](function(_0x4cf979){logger[_0x592e('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x31ade9,_0x592e('0xa'));logger[_0x592e('0xb')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x31ade9,'request\x20sent',JSON[_0x592e('0xc')](_0x4cf979));if(_0x4cf979['error']){if(_0x4cf979[_0x592e('0xd')][_0x592e('0xe')]===0x1f4){logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x4cf979[_0x592e('0xd')][_0x592e('0x10')]);return _0x52e91c(_0x4cf979[_0x592e('0xd')]['message']);}logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x4cf979['error'][_0x592e('0x10')]);return _0x5534f9(_0x4cf979['error'][_0x592e('0x10')]);}else{logger[_0x592e('0x9')](_0x592e('0xf'),_0x31ade9,_0x592e('0xa'));_0x5534f9(_0x4cf979['result']['message']);}})['catch'](function(_0x29d852){logger[_0x592e('0xd')](_0x592e('0xf'),_0x31ade9,_0x29d852);_0x52e91c(_0x29d852);});});}exports[_0x592e('0x11')]=function(_0x4fcc68){var _0x66532f=this;return new Promise(function(_0x335812,_0xfde0f7){return db[_0x592e('0x12')][_0x592e('0x13')](_0x4fcc68[_0x592e('0x14')],{'raw':_0x4fcc68[_0x592e('0x15')]?_0x4fcc68[_0x592e('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x143781){logger[_0x592e('0x9')](_0x592e('0x11'),_0x4fcc68);logger[_0x592e('0xb')](_0x592e('0x11'),_0x4fcc68,JSON[_0x592e('0xc')](_0x143781));_0x335812(_0x143781);})['catch'](function(_0x36bf64){logger[_0x592e('0xd')](_0x592e('0x11'),_0x36bf64['message'],_0x4fcc68);_0xfde0f7(_0x66532f[_0x592e('0xd')](0x1f4,_0x36bf64[_0x592e('0x10')]));});});};exports[_0x592e('0x16')]=function(_0x3d35d7){var _0x4cffa3=this;return new Promise(function(_0x182578,_0x4e92b5){return db[_0x592e('0x12')][_0x592e('0x17')](_0x3d35d7['body'],{'raw':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x19')]||null:null,'attributes':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7['options'][_0x592e('0x1a')]||null:null,'limit':_0x3d35d7[_0x592e('0x15')]?_0x3d35d7[_0x592e('0x15')][_0x592e('0x1b')]||null:null})[_0x592e('0x8')](function(_0x17a43c){logger[_0x592e('0x9')](_0x592e('0x16'),_0x3d35d7);logger[_0x592e('0xb')]('UpdateChatQueueReport',_0x3d35d7,JSON['stringify'](_0x17a43c));_0x182578(_0x17a43c);})[_0x592e('0x1c')](function(_0xa72d8b){logger[_0x592e('0xd')](_0x592e('0x16'),_0xa72d8b[_0x592e('0x10')],_0x3d35d7);_0x4e92b5(_0x4cffa3[_0x592e('0xd')](0x1f4,_0xa72d8b[_0x592e('0x10')]));});});}; \ No newline at end of file +var _0x5ca8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','body','raw','where','attributes','lodash','util','moment'];(function(_0x14de31,_0x42bceb){var _0x36403f=function(_0x470d49){while(--_0x470d49){_0x14de31['push'](_0x14de31['shift']());}};_0x36403f(++_0x42bceb);}(_0x5ca8,0x195));var _0x85ca=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ca8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x85ca('0x0'));var util=require(_0x85ca('0x1'));var moment=require(_0x85ca('0x2'));var BPromise=require(_0x85ca('0x3'));var rs=require(_0x85ca('0x4'));var fs=require('fs');var Redis=require(_0x85ca('0x5'));var db=require(_0x85ca('0x6'))['db'];var utils=require(_0x85ca('0x7'));var logger=require(_0x85ca('0x8'))(_0x85ca('0x9'));var config=require(_0x85ca('0xa'));var jayson=require(_0x85ca('0xb'));var client=jayson[_0x85ca('0xc')][_0x85ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xae6367,_0x457b99,_0x56977f){return new BPromise(function(_0x3a4041,_0x248742){return client['request'](_0xae6367,_0x56977f)[_0x85ca('0xe')](function(_0x42a075){logger[_0x85ca('0xf')](_0x85ca('0x10'),_0x457b99,_0x85ca('0x11'));logger['debug'](_0x85ca('0x12'),_0x457b99,_0x85ca('0x11'),JSON[_0x85ca('0x13')](_0x42a075));if(_0x42a075[_0x85ca('0x14')]){if(_0x42a075['error'][_0x85ca('0x15')]===0x1f4){logger[_0x85ca('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x457b99,_0x42a075['error'][_0x85ca('0x16')]);return _0x248742(_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);}logger['error'](_0x85ca('0x10'),_0x457b99,_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);return _0x3a4041(_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);}else{logger['info'](_0x85ca('0x10'),_0x457b99,_0x85ca('0x11'));_0x3a4041(_0x42a075[_0x85ca('0x17')][_0x85ca('0x16')]);}})[_0x85ca('0x18')](function(_0x240266){logger[_0x85ca('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x457b99,_0x240266);_0x248742(_0x240266);});});}exports['CreateChatQueueReport']=function(_0x198cee){var _0x3c04a4=this;return new Promise(function(_0x1ee378,_0x1b4414){return db['ChatQueueReport'][_0x85ca('0x19')](_0x198cee['body'],{'raw':_0x198cee[_0x85ca('0x1a')]?_0x198cee[_0x85ca('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c9402){logger[_0x85ca('0xf')]('CreateChatQueueReport',_0x198cee);logger['debug'](_0x85ca('0x1b'),_0x198cee,JSON[_0x85ca('0x13')](_0x4c9402));_0x1ee378(_0x4c9402);})[_0x85ca('0x18')](function(_0x39f203){logger[_0x85ca('0x14')]('CreateChatQueueReport',_0x39f203[_0x85ca('0x16')],_0x198cee);_0x1b4414(_0x3c04a4['error'](0x1f4,_0x39f203['message']));});});};exports[_0x85ca('0x1c')]=function(_0x1c51d1){var _0x15b8ae=this;return new Promise(function(_0x49b81b,_0xf052cc){return db[_0x85ca('0x1d')]['update'](_0x1c51d1[_0x85ca('0x1e')],{'raw':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1['options'][_0x85ca('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1[_0x85ca('0x1a')][_0x85ca('0x20')]||null:null,'attributes':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1[_0x85ca('0x1a')][_0x85ca('0x21')]||null:null,'limit':_0x1c51d1['options']?_0x1c51d1[_0x85ca('0x1a')]['limit']||null:null})[_0x85ca('0xe')](function(_0x1e30bc){logger[_0x85ca('0xf')](_0x85ca('0x1c'),_0x1c51d1);logger['debug'](_0x85ca('0x1c'),_0x1c51d1,JSON[_0x85ca('0x13')](_0x1e30bc));_0x49b81b(_0x1e30bc);})['catch'](function(_0x1eb502){logger[_0x85ca('0x14')](_0x85ca('0x1c'),_0x1eb502[_0x85ca('0x16')],_0x1c51d1);_0xf052cc(_0x15b8ae[_0x85ca('0x14')](0x1f4,_0x1eb502['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4c14c82..56b85d4 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 _0xe089=['path','connect-timeout','express','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xe089,0xc6));var _0x9e08=function(_0x3871be,_0x5ca3e8){_0x3871be=_0x3871be-0x0;var _0x4f460d=_0xe089[_0x3871be];return _0x4f460d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e08('0x0'));var timeout=require(_0x9e08('0x1'));var express=require(_0x9e08('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e08('0x3'));var controller=require(_0x9e08('0x4'));router[_0x9e08('0x5')]('/',auth[_0x9e08('0x6')](),controller[_0x9e08('0x7')]);router[_0x9e08('0x5')](_0x9e08('0x8'),auth[_0x9e08('0x6')](),controller['describe']);router[_0x9e08('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x9e08('0x9')]);router[_0x9e08('0xa')]('/',auth[_0x9e08('0x6')](),controller[_0x9e08('0xb')]);router[_0x9e08('0xc')]('/:id',auth[_0x9e08('0x6')](),controller[_0x9e08('0xd')]);router[_0x9e08('0xe')](_0x9e08('0xf'),auth[_0x9e08('0x6')](),controller[_0x9e08('0x10')]);module[_0x9e08('0x11')]=router; \ No newline at end of file +var _0x5543=['isAuthenticated','get','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','/describe'];(function(_0x226121,_0x5217df){var _0x501a63=function(_0x4f6362){while(--_0x4f6362){_0x226121['push'](_0x226121['shift']());}};_0x501a63(++_0x5217df);}(_0x5543,0x1d0));var _0x3554=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x5543[_0x31bab3];return _0x4fd382;};'use strict';var multer=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var path=require(_0x3554('0x2'));var timeout=require(_0x3554('0x3'));var express=require('express');var router=express[_0x3554('0x4')]();var auth=require(_0x3554('0x5'));var interaction=require(_0x3554('0x6'));var config=require(_0x3554('0x7'));var controller=require(_0x3554('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3554('0x9')]);router['get'](_0x3554('0xa'),auth[_0x3554('0xb')](),controller['describe']);router[_0x3554('0xc')](_0x3554('0xd'),auth[_0x3554('0xb')](),controller[_0x3554('0xe')]);router[_0x3554('0xf')]('/',auth['isAuthenticated'](),controller[_0x3554('0x10')]);router[_0x3554('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3554('0xd'),auth[_0x3554('0xb')](),controller[_0x3554('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 13d793e..628c99f 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 _0xc24c=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x4f52c3,_0x58f7c8){var _0x15be4b=function(_0x5d6e35){while(--_0x5d6e35){_0x4f52c3['push'](_0x4f52c3['shift']());}};_0x15be4b(++_0x58f7c8);}(_0xc24c,0x18e));var _0xcc24=function(_0x425ea4,_0x10376d){_0x425ea4=_0x425ea4-0x0;var _0x2a7690=_0xc24c[_0x425ea4];return _0x2a7690;};'use strict';var moment=require(_0xcc24('0x0'));var Sequelize=require(_0xcc24('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcc24('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc24('0x3')]('account',_0xcc24('0x4'),'queue'),'allowNull':![],'defaultValue':_0xcc24('0x5')},'transferredAt':{'type':Sequelize[_0xcc24('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xcc24('0x7')]}}; \ No newline at end of file +var _0x23de=['DATE','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x23de,0x1a8));var _0xe23d=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x23de[_0x328534];return _0x2796c0;};'use strict';var moment=require(_0xe23d('0x0'));var Sequelize=require(_0xe23d('0x1'));module[_0xe23d('0x2')]={'uniqueid':{'type':Sequelize[_0xe23d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe23d('0x4')](_0xe23d('0x5'),_0xe23d('0x6'),'queue'),'allowNull':![],'defaultValue':_0xe23d('0x7')},'transferredAt':{'type':Sequelize[_0xe23d('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9f96060..d8c0595 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 _0xdf71=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdf71,0xd2));var _0x1df7=function(_0x523d5b,_0x1808f0){_0x523d5b=_0x523d5b-0x0;var _0x4d5b4c=_0xdf71[_0x523d5b];return _0x4d5b4c;};'use strict';var pdf=require(_0x1df7('0x0'));var emlformat=require(_0x1df7('0x1'));var rimraf=require(_0x1df7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1df7('0x3'));var rp=require(_0x1df7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1df7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1df7('0x6'));var csv=require(_0x1df7('0x7'));var ejs=require(_0x1df7('0x8'));var fs=require('fs');var _=require(_0x1df7('0x9'));var squel=require('squel');var crypto=require(_0x1df7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1df7('0xb'));var toCsv=require(_0x1df7('0x7'));var querystring=require(_0x1df7('0xc'));var Papa=require(_0x1df7('0xd'));var Redis=require(_0x1df7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1df7('0xf'));var hardwareService=require(_0x1df7('0x10'));var logger=require(_0x1df7('0x11'))(_0x1df7('0x12'));var utils=require(_0x1df7('0x13'));var config=require(_0x1df7('0x14'));var licenseUtil=require(_0x1df7('0x15'));var db=require(_0x1df7('0x16'))['db'];function respondWithStatusCode(_0x5187b7,_0x160f25){_0x160f25=_0x160f25||0xcc;return function(_0x4f8694){if(_0x4f8694){return _0x5187b7['sendStatus'](_0x160f25);}return _0x5187b7[_0x1df7('0x17')](_0x160f25)['end']();};}function respondWithResult(_0x41a8f8,_0x441d37){_0x441d37=_0x441d37||0xc8;return function(_0x408574){if(_0x408574){return _0x41a8f8[_0x1df7('0x17')](_0x441d37)[_0x1df7('0x18')](_0x408574);}};}function respondWithFilteredResult(_0x44e973,_0x5aa14a){return function(_0x3a6cc1){if(_0x3a6cc1){var _0x425442=_0x3a6cc1[_0x1df7('0x19')],_0x4c054a=_0x5aa14a['offset'],_0x2a55e4=_0x5aa14a['offset']+_0x5aa14a[_0x1df7('0x1a')],_0x2c4319;if(_0x2a55e4>=_0x425442){_0x2a55e4=_0x425442;_0x2c4319=0xc8;}else{_0x2c4319=0xce;}_0x44e973[_0x1df7('0x17')](_0x2c4319);return _0x44e973[_0x1df7('0x1b')](_0x1df7('0x1c'),_0x4c054a+'-'+_0x2a55e4+'/'+_0x425442)[_0x1df7('0x18')](_0x3a6cc1);}return null;};}function patchUpdates(_0x10f4cf){return function(_0x4b8a77){try{jsonpatch[_0x1df7('0x1d')](_0x4b8a77,_0x10f4cf,!![]);}catch(_0x53f19d){return BPromise[_0x1df7('0x1e')](_0x53f19d);}return _0x4b8a77['save']();};}function saveUpdates(_0x11c393,_0x46d868){return function(_0x385edb){if(_0x385edb){return _0x385edb[_0x1df7('0x1f')](_0x11c393)[_0x1df7('0x20')](function(_0x453903){return _0x453903;});}return null;};}function removeEntity(_0x595ccd,_0x18708d){return function(_0x4da20c){if(_0x4da20c){return _0x4da20c[_0x1df7('0x21')]()[_0x1df7('0x20')](function(){_0x595ccd[_0x1df7('0x17')](0xcc)[_0x1df7('0x22')]();});}};}function handleEntityNotFound(_0x379f44,_0x446810){return function(_0x3b0446){if(!_0x3b0446){_0x379f44['sendStatus'](0x194);}return _0x3b0446;};}function handleError(_0x50eda4,_0x1c102b){_0x1c102b=_0x1c102b||0x1f4;return function(_0x47ef19){logger[_0x1df7('0x23')](_0x47ef19['stack']);if(_0x47ef19['name']){delete _0x47ef19[_0x1df7('0x24')];}_0x50eda4['status'](_0x1c102b)[_0x1df7('0x25')](_0x47ef19);};}exports[_0x1df7('0x26')]=function(_0x35055b,_0x2b7aaa){var _0x12747b={},_0x50dfae={},_0x48e1e3={'count':0x0,'rows':[]};var _0x4e082d=_[_0x1df7('0x27')](db[_0x1df7('0x28')][_0x1df7('0x29')],function(_0x5a41ee){return{'name':_0x5a41ee['fieldName'],'type':_0x5a41ee[_0x1df7('0x2a')][_0x1df7('0x2b')]};});_0x50dfae[_0x1df7('0x2c')]=_[_0x1df7('0x27')](_0x4e082d,'name');_0x50dfae[_0x1df7('0x2d')]=_[_0x1df7('0x2e')](_0x35055b[_0x1df7('0x2d')]);_0x50dfae['filters']=_[_0x1df7('0x2f')](_0x50dfae[_0x1df7('0x2c')],_0x50dfae[_0x1df7('0x2d')]);_0x12747b[_0x1df7('0x30')]=_[_0x1df7('0x2f')](_0x50dfae[_0x1df7('0x2c')],qs[_0x1df7('0x31')](_0x35055b['query'][_0x1df7('0x31')]));_0x12747b['attributes']=_0x12747b[_0x1df7('0x30')][_0x1df7('0x32')]?_0x12747b[_0x1df7('0x30')]:_0x50dfae[_0x1df7('0x2c')];if(!_0x35055b[_0x1df7('0x2d')][_0x1df7('0x33')](_0x1df7('0x34'))){_0x12747b[_0x1df7('0x1a')]=qs['limit'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x1a')]);_0x12747b[_0x1df7('0x35')]=qs['offset'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x35')]);}_0x12747b[_0x1df7('0x36')]=qs['sort'](_0x35055b[_0x1df7('0x2d')][_0x1df7('0x37')]);_0x12747b[_0x1df7('0x38')]=qs[_0x1df7('0x39')](_['pick'](_0x35055b['query'],_0x50dfae[_0x1df7('0x39')]),_0x4e082d);if(_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3a')]){_0x12747b[_0x1df7('0x38')]=_[_0x1df7('0x3b')](_0x12747b[_0x1df7('0x38')],{'$or':_[_0x1df7('0x27')](_0x4e082d,function(_0x1132b3){if(_0x1132b3['type']!=='VIRTUAL'){var _0x1d4ebd={};_0x1d4ebd[_0x1132b3['name']]={'$like':'%'+_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3a')]+'%'};return _0x1d4ebd;}})});}_0x12747b=_['merge']({},_0x12747b,_0x35055b[_0x1df7('0x3c')]);var _0xcce1d8={'where':_0x12747b['where']};return db[_0x1df7('0x28')][_0x1df7('0x19')](_0xcce1d8)['then'](function(_0x1c0f07){_0x48e1e3[_0x1df7('0x19')]=_0x1c0f07;if(_0x35055b[_0x1df7('0x2d')][_0x1df7('0x3d')]){_0x12747b[_0x1df7('0x3e')]=[{'all':!![]}];}return db[_0x1df7('0x28')][_0x1df7('0x3f')](_0x12747b);})[_0x1df7('0x20')](function(_0x1ca74c){_0x48e1e3['rows']=_0x1ca74c;return _0x48e1e3;})[_0x1df7('0x20')](respondWithFilteredResult(_0x2b7aaa,_0x12747b))[_0x1df7('0x40')](handleError(_0x2b7aaa,null));};exports['show']=function(_0x53996d,_0x530a85){var _0x5d3085={'raw':!![],'where':{'id':_0x53996d[_0x1df7('0x41')]['id']}},_0x346f90={};_0x346f90[_0x1df7('0x2c')]=_[_0x1df7('0x2e')](db[_0x1df7('0x28')]['rawAttributes']);_0x346f90['query']=_[_0x1df7('0x2e')](_0x53996d[_0x1df7('0x2d')]);_0x346f90[_0x1df7('0x39')]=_['intersection'](_0x346f90[_0x1df7('0x2c')],_0x346f90['query']);_0x5d3085[_0x1df7('0x30')]=_[_0x1df7('0x2f')](_0x346f90[_0x1df7('0x2c')],qs[_0x1df7('0x31')](_0x53996d[_0x1df7('0x2d')][_0x1df7('0x31')]));_0x5d3085[_0x1df7('0x30')]=_0x5d3085[_0x1df7('0x30')][_0x1df7('0x32')]?_0x5d3085[_0x1df7('0x30')]:_0x346f90[_0x1df7('0x2c')];if(_0x53996d[_0x1df7('0x2d')][_0x1df7('0x3d')]){_0x5d3085['include']=[{'all':!![]}];}_0x5d3085=_['merge']({},_0x5d3085,_0x53996d[_0x1df7('0x3c')]);return db[_0x1df7('0x28')][_0x1df7('0x42')](_0x5d3085)[_0x1df7('0x20')](handleEntityNotFound(_0x530a85,null))[_0x1df7('0x20')](respondWithResult(_0x530a85,null))[_0x1df7('0x40')](handleError(_0x530a85,null));};exports[_0x1df7('0x43')]=function(_0x44246f,_0x370b25){return db[_0x1df7('0x28')][_0x1df7('0x43')](_0x44246f[_0x1df7('0x44')],{})[_0x1df7('0x20')](respondWithResult(_0x370b25,0xc9))[_0x1df7('0x40')](handleError(_0x370b25,null));};exports[_0x1df7('0x1f')]=function(_0x2e7718,_0x64bebc){if(_0x2e7718['body']['id']){delete _0x2e7718['body']['id'];}return db[_0x1df7('0x28')][_0x1df7('0x42')]({'where':{'id':_0x2e7718[_0x1df7('0x41')]['id']}})[_0x1df7('0x20')](handleEntityNotFound(_0x64bebc,null))[_0x1df7('0x20')](saveUpdates(_0x2e7718[_0x1df7('0x44')],null))[_0x1df7('0x20')](respondWithResult(_0x64bebc,null))[_0x1df7('0x40')](handleError(_0x64bebc,null));};exports[_0x1df7('0x21')]=function(_0x1cff29,_0x13b3ce){return db['ChatTransferReport'][_0x1df7('0x42')]({'where':{'id':_0x1cff29[_0x1df7('0x41')]['id']}})[_0x1df7('0x20')](handleEntityNotFound(_0x13b3ce,null))['then'](removeEntity(_0x13b3ce,null))[_0x1df7('0x40')](handleError(_0x13b3ce,null));};exports[_0x1df7('0x45')]=function(_0x41e05c,_0x59bcc1){return db[_0x1df7('0x28')]['describe']()[_0x1df7('0x20')](respondWithResult(_0x59bcc1,null))[_0x1df7('0x40')](handleError(_0x59bcc1,null));}; \ No newline at end of file +var _0xb91b=['create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','then','stack','send','index','map','ChatTransferReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','type','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','length','merge','find'];(function(_0x15f8d7,_0x5df371){var _0x4f17c2=function(_0xeac47d){while(--_0xeac47d){_0x15f8d7['push'](_0x15f8d7['shift']());}};_0x4f17c2(++_0x5df371);}(_0xb91b,0x99));var _0xbb91=function(_0xce0491,_0x400a1e){_0xce0491=_0xce0491-0x0;var _0x4fde94=_0xb91b[_0xce0491];return _0x4fde94;};'use strict';var pdf=require(_0xbb91('0x0'));var emlformat=require(_0xbb91('0x1'));var rimraf=require(_0xbb91('0x2'));var zipdir=require(_0xbb91('0x3'));var jsonpatch=require(_0xbb91('0x4'));var rp=require(_0xbb91('0x5'));var moment=require(_0xbb91('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbb91('0x7'));var util=require(_0xbb91('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb91('0x9'));var fs=require('fs');var _=require(_0xbb91('0xa'));var squel=require('squel');var crypto=require(_0xbb91('0xb'));var jsforce=require(_0xbb91('0xc'));var deskjs=require(_0xbb91('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbb91('0xe'));var Papa=require('papaparse');var Redis=require(_0xbb91('0xf'));var authService=require(_0xbb91('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbb91('0x11'));var hardwareService=require(_0xbb91('0x12'));var logger=require(_0xbb91('0x13'))('api');var utils=require(_0xbb91('0x14'));var config=require(_0xbb91('0x15'));var licenseUtil=require(_0xbb91('0x16'));var db=require(_0xbb91('0x17'))['db'];function respondWithStatusCode(_0x1bf521,_0x10a10c){_0x10a10c=_0x10a10c||0xcc;return function(_0x366eb7){if(_0x366eb7){return _0x1bf521[_0xbb91('0x18')](_0x10a10c);}return _0x1bf521['status'](_0x10a10c)[_0xbb91('0x19')]();};}function respondWithResult(_0x53c87b,_0xb1fe6a){_0xb1fe6a=_0xb1fe6a||0xc8;return function(_0x467dc2){if(_0x467dc2){return _0x53c87b[_0xbb91('0x1a')](_0xb1fe6a)['json'](_0x467dc2);}};}function respondWithFilteredResult(_0x3933d0,_0x5d9af9){return function(_0x11b70c){if(_0x11b70c){var _0x343e1e=_0x11b70c[_0xbb91('0x1b')],_0x11364e=_0x5d9af9['offset'],_0x13e737=_0x5d9af9[_0xbb91('0x1c')]+_0x5d9af9[_0xbb91('0x1d')],_0x55d858;if(_0x13e737>=_0x343e1e){_0x13e737=_0x343e1e;_0x55d858=0xc8;}else{_0x55d858=0xce;}_0x3933d0['status'](_0x55d858);return _0x3933d0[_0xbb91('0x1e')]('Content-Range',_0x11364e+'-'+_0x13e737+'/'+_0x343e1e)[_0xbb91('0x1f')](_0x11b70c);}return null;};}function patchUpdates(_0x5074bf){return function(_0x4479ef){try{jsonpatch[_0xbb91('0x20')](_0x4479ef,_0x5074bf,!![]);}catch(_0x4dd3fc){return BPromise[_0xbb91('0x21')](_0x4dd3fc);}return _0x4479ef['save']();};}function saveUpdates(_0x118e58,_0x139bda){return function(_0x45e255){if(_0x45e255){return _0x45e255[_0xbb91('0x22')](_0x118e58)[_0xbb91('0x23')](function(_0x1d4fed){return _0x1d4fed;});}return null;};}function removeEntity(_0x3808b3,_0x3ca9b8){return function(_0x351151){if(_0x351151){return _0x351151['destroy']()['then'](function(){_0x3808b3['status'](0xcc)[_0xbb91('0x19')]();});}};}function handleEntityNotFound(_0x579e7a,_0xed0f5){return function(_0x3bf365){if(!_0x3bf365){_0x579e7a[_0xbb91('0x18')](0x194);}return _0x3bf365;};}function handleError(_0x43a3c3,_0x46b658){_0x46b658=_0x46b658||0x1f4;return function(_0x4d8298){logger['error'](_0x4d8298[_0xbb91('0x24')]);if(_0x4d8298['name']){delete _0x4d8298['name'];}_0x43a3c3['status'](_0x46b658)[_0xbb91('0x25')](_0x4d8298);};}exports[_0xbb91('0x26')]=function(_0x225204,_0x16cabf){var _0x2d8399={},_0xba073e={},_0x1c5e83={'count':0x0,'rows':[]};var _0x42218d=_[_0xbb91('0x27')](db[_0xbb91('0x28')][_0xbb91('0x29')],function(_0x50bbdd){return{'name':_0x50bbdd['fieldName'],'type':_0x50bbdd['type'][_0xbb91('0x2a')]};});_0xba073e[_0xbb91('0x2b')]=_[_0xbb91('0x27')](_0x42218d,'name');_0xba073e[_0xbb91('0x2c')]=_[_0xbb91('0x2d')](_0x225204[_0xbb91('0x2c')]);_0xba073e['filters']=_['intersection'](_0xba073e[_0xbb91('0x2b')],_0xba073e[_0xbb91('0x2c')]);_0x2d8399['attributes']=_[_0xbb91('0x2e')](_0xba073e[_0xbb91('0x2b')],qs['fields'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x2f')]));_0x2d8399[_0xbb91('0x30')]=_0x2d8399['attributes']['length']?_0x2d8399['attributes']:_0xba073e['model'];if(!_0x225204[_0xbb91('0x2c')][_0xbb91('0x31')]('nolimit')){_0x2d8399['limit']=qs['limit'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x1d')]);_0x2d8399['offset']=qs[_0xbb91('0x1c')](_0x225204['query'][_0xbb91('0x1c')]);}_0x2d8399[_0xbb91('0x32')]=qs['sort'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x33')]);_0x2d8399[_0xbb91('0x34')]=qs['filters'](_[_0xbb91('0x35')](_0x225204[_0xbb91('0x2c')],_0xba073e[_0xbb91('0x36')]),_0x42218d);if(_0x225204[_0xbb91('0x2c')][_0xbb91('0x37')]){_0x2d8399[_0xbb91('0x34')]=_['merge'](_0x2d8399['where'],{'$or':_['map'](_0x42218d,function(_0x27df93){if(_0x27df93[_0xbb91('0x38')]!==_0xbb91('0x39')){var _0x230209={};_0x230209[_0x27df93[_0xbb91('0x3a')]]={'$like':'%'+_0x225204[_0xbb91('0x2c')][_0xbb91('0x37')]+'%'};return _0x230209;}})});}_0x2d8399=_['merge']({},_0x2d8399,_0x225204[_0xbb91('0x3b')]);var _0x5566e4={'where':_0x2d8399['where']};return db['ChatTransferReport'][_0xbb91('0x1b')](_0x5566e4)[_0xbb91('0x23')](function(_0x512e1a){_0x1c5e83[_0xbb91('0x1b')]=_0x512e1a;if(_0x225204[_0xbb91('0x2c')][_0xbb91('0x3c')]){_0x2d8399[_0xbb91('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xbb91('0x3e')](_0x2d8399);})[_0xbb91('0x23')](function(_0x28fd1c){_0x1c5e83[_0xbb91('0x3f')]=_0x28fd1c;return _0x1c5e83;})[_0xbb91('0x23')](respondWithFilteredResult(_0x16cabf,_0x2d8399))[_0xbb91('0x40')](handleError(_0x16cabf,null));};exports[_0xbb91('0x41')]=function(_0x5ca63c,_0x2b1d81){var _0x244a51={'raw':!![],'where':{'id':_0x5ca63c['params']['id']}},_0x18c40d={};_0x18c40d[_0xbb91('0x2b')]=_[_0xbb91('0x2d')](db['ChatTransferReport'][_0xbb91('0x29')]);_0x18c40d['query']=_[_0xbb91('0x2d')](_0x5ca63c[_0xbb91('0x2c')]);_0x18c40d[_0xbb91('0x36')]=_[_0xbb91('0x2e')](_0x18c40d[_0xbb91('0x2b')],_0x18c40d['query']);_0x244a51[_0xbb91('0x30')]=_[_0xbb91('0x2e')](_0x18c40d[_0xbb91('0x2b')],qs[_0xbb91('0x2f')](_0x5ca63c[_0xbb91('0x2c')][_0xbb91('0x2f')]));_0x244a51[_0xbb91('0x30')]=_0x244a51[_0xbb91('0x30')][_0xbb91('0x42')]?_0x244a51['attributes']:_0x18c40d[_0xbb91('0x2b')];if(_0x5ca63c[_0xbb91('0x2c')][_0xbb91('0x3c')]){_0x244a51[_0xbb91('0x3d')]=[{'all':!![]}];}_0x244a51=_[_0xbb91('0x43')]({},_0x244a51,_0x5ca63c[_0xbb91('0x3b')]);return db['ChatTransferReport'][_0xbb91('0x44')](_0x244a51)[_0xbb91('0x23')](handleEntityNotFound(_0x2b1d81,null))[_0xbb91('0x23')](respondWithResult(_0x2b1d81,null))[_0xbb91('0x40')](handleError(_0x2b1d81,null));};exports[_0xbb91('0x45')]=function(_0x463be0,_0x2cde9c){return db[_0xbb91('0x28')][_0xbb91('0x45')](_0x463be0[_0xbb91('0x46')],{})['then'](respondWithResult(_0x2cde9c,0xc9))[_0xbb91('0x40')](handleError(_0x2cde9c,null));};exports['update']=function(_0x52b5c9,_0x5c0d49){if(_0x52b5c9[_0xbb91('0x46')]['id']){delete _0x52b5c9[_0xbb91('0x46')]['id'];}return db[_0xbb91('0x28')][_0xbb91('0x44')]({'where':{'id':_0x52b5c9[_0xbb91('0x47')]['id']}})[_0xbb91('0x23')](handleEntityNotFound(_0x5c0d49,null))[_0xbb91('0x23')](saveUpdates(_0x52b5c9[_0xbb91('0x46')],null))[_0xbb91('0x23')](respondWithResult(_0x5c0d49,null))['catch'](handleError(_0x5c0d49,null));};exports[_0xbb91('0x48')]=function(_0x5a875a,_0x5665b0){return db[_0xbb91('0x28')]['find']({'where':{'id':_0x5a875a['params']['id']}})[_0xbb91('0x23')](handleEntityNotFound(_0x5665b0,null))['then'](removeEntity(_0x5665b0,null))[_0xbb91('0x40')](handleError(_0x5665b0,null));};exports[_0xbb91('0x49')]=function(_0x2af9f9,_0xf41c82){return db[_0xbb91('0x28')][_0xbb91('0x49')]()[_0xbb91('0x23')](respondWithResult(_0xf41c82,null))[_0xbb91('0x40')](handleError(_0xf41c82,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5a313e0..89cb104 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 _0xfb09=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x33a779,_0x4d6e39){var _0x22f24f=function(_0x582b84){while(--_0x582b84){_0x33a779['push'](_0x33a779['shift']());}};_0x22f24f(++_0x4d6e39);}(_0xfb09,0x19d));var _0x9fb0=function(_0x159ec6,_0x42ff9a){_0x159ec6=_0x159ec6-0x0;var _0x337b21=_0xfb09[_0x159ec6];return _0x337b21;};'use strict';var _=require(_0x9fb0('0x0'));var util=require('util');var logger=require(_0x9fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fb0('0x2'));var rp=require(_0x9fb0('0x3'));var fs=require('fs');var path=require(_0x9fb0('0x4'));var rimraf=require('rimraf');var config=require(_0x9fb0('0x5'));var attributes=require(_0x9fb0('0x6'));module['exports']=function(_0x3bad46,_0x19b030){return _0x3bad46['define'](_0x9fb0('0x7'),attributes,{'tableName':_0x9fb0('0x8'),'paranoid':![],'indexes':[{'name':_0x9fb0('0x9'),'fields':[_0x9fb0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa421=['../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xa421,0x1b8));var _0x1a42=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xa421[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x1a42('0x0'));var util=require(_0x1a42('0x1'));var logger=require(_0x1a42('0x2'))(_0x1a42('0x3'));var moment=require(_0x1a42('0x4'));var BPromise=require(_0x1a42('0x5'));var rp=require(_0x1a42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a42('0x7'));var config=require(_0x1a42('0x8'));var attributes=require(_0x1a42('0x9'));module[_0x1a42('0xa')]=function(_0x4d5ca2,_0x5eac2b){return _0x4d5ca2[_0x1a42('0xb')]('ChatTransferReport',attributes,{'tableName':_0x1a42('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a42('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9789e04..92f9c1b 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 _0xc4bc=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc4bc,0x1e2));var _0xcc4b=function(_0x3514db,_0x17706d){_0x3514db=_0x3514db-0x0;var _0x34f65d=_0xc4bc[_0x3514db];return _0x34f65d;};'use strict';var _=require(_0xcc4b('0x0'));var util=require('util');var moment=require(_0xcc4b('0x1'));var BPromise=require(_0xcc4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc4b('0x3'));var db=require(_0xcc4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc4b('0x5'))(_0xcc4b('0x6'));var config=require('../../config/environment');var jayson=require(_0xcc4b('0x7'));var client=jayson[_0xcc4b('0x8')][_0xcc4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28e541,_0x5504e0,_0x8e1b01){return new BPromise(function(_0x4694bd,_0x357438){return client['request'](_0x28e541,_0x8e1b01)[_0xcc4b('0xa')](function(_0x4be97b){logger[_0xcc4b('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x5504e0,'request\x20sent');logger[_0xcc4b('0xc')](_0xcc4b('0xd'),_0x5504e0,_0xcc4b('0xe'),JSON[_0xcc4b('0xf')](_0x4be97b));if(_0x4be97b[_0xcc4b('0x10')]){if(_0x4be97b['error'][_0xcc4b('0x11')]===0x1f4){logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);return _0x357438(_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);}logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x4be97b[_0xcc4b('0x10')]['message']);return _0x4694bd(_0x4be97b[_0xcc4b('0x10')][_0xcc4b('0x13')]);}else{logger[_0xcc4b('0xb')](_0xcc4b('0x12'),_0x5504e0,_0xcc4b('0xe'));_0x4694bd(_0x4be97b[_0xcc4b('0x14')][_0xcc4b('0x13')]);}})[_0xcc4b('0x15')](function(_0x48cddc){logger[_0xcc4b('0x10')](_0xcc4b('0x12'),_0x5504e0,_0x48cddc);_0x357438(_0x48cddc);});});} \ No newline at end of file +var _0xee1e=['http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c0317,_0x54e894){var _0x3fc8eb=function(_0xb8361a){while(--_0xb8361a){_0x2c0317['push'](_0x2c0317['shift']());}};_0x3fc8eb(++_0x54e894);}(_0xee1e,0x109));var _0xeee1=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0xee1e[_0x1b664d];return _0x43af6b;};'use strict';var _=require(_0xeee1('0x0'));var util=require('util');var moment=require(_0xeee1('0x1'));var BPromise=require(_0xeee1('0x2'));var rs=require(_0xeee1('0x3'));var fs=require('fs');var Redis=require(_0xeee1('0x4'));var db=require(_0xeee1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeee1('0x6'))(_0xeee1('0x7'));var config=require(_0xeee1('0x8'));var jayson=require(_0xeee1('0x9'));var client=jayson[_0xeee1('0xa')][_0xeee1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fc4b2,_0x2f8229,_0x28703e){return new BPromise(function(_0x5a4a9d,_0x138407){return client['request'](_0x3fc4b2,_0x28703e)[_0xeee1('0xc')](function(_0x376b2c){logger[_0xeee1('0xd')](_0xeee1('0xe'),_0x2f8229,_0xeee1('0xf'));logger[_0xeee1('0x10')](_0xeee1('0x11'),_0x2f8229,_0xeee1('0xf'),JSON[_0xeee1('0x12')](_0x376b2c));if(_0x376b2c[_0xeee1('0x13')]){if(_0x376b2c['error'][_0xeee1('0x14')]===0x1f4){logger[_0xeee1('0x13')](_0xeee1('0xe'),_0x2f8229,_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);return _0x138407(_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);}logger[_0xeee1('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2f8229,_0x376b2c['error'][_0xeee1('0x15')]);return _0x5a4a9d(_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);}else{logger[_0xeee1('0xd')](_0xeee1('0xe'),_0x2f8229,_0xeee1('0xf'));_0x5a4a9d(_0x376b2c['result'][_0xeee1('0x15')]);}})[_0xeee1('0x16')](function(_0x269e25){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2f8229,_0x269e25);_0x138407(_0x269e25);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6c5d045..4bdcffe 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x391325,_0x171dd9){var _0x439160=function(_0x5aa314){while(--_0x5aa314){_0x391325['push'](_0x391325['shift']());}};_0x439160(++_0x171dd9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb7e7[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);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 d9a7abb..9708a66 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 _0xd24d=['website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xbda624,_0xcc2832){var _0x5470cc=function(_0x680f24){while(--_0x680f24){_0xbda624['push'](_0xbda624['shift']());}};_0x5470cc(++_0xcc2832);}(_0xd24d,0x168));var _0xdd24=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd24d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdd24('0x0'));var rs=require(_0xdd24('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'unique':_0xdd24('0x3')},'description':{'type':Sequelize[_0xdd24('0x2')]},'mapKey':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x4')},'mapKeyOffline':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x5')},'customerAlias':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdd24('0x2')]},'animation':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdd24('0x9')]('rounded','squared'),'defaultValue':_0xdd24('0xa')},'header_online':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xb')},'start_chat_button':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0xd')},'download_transcript':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdd24('0xe')]},'closingQuestion':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xdd24('0x11'),_0xdd24('0x12')),'defaultValue':_0xdd24('0x11')},'ratingStarsNumber':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdd24('0x13')]({'items':[{'type':_0xdd24('0x14'),'variable':null,'config':{'placeholder':_0xdd24('0x15'),'type':_0xdd24('0x16'),'required':!![]},'props':{'title':_0xdd24('0x15'),'helpText':''}},{'type':_0xdd24('0x14'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xdd24('0x4'),'type':_0xdd24('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdd24('0x17')](_0xdd24('0x18'))?JSON[_0xdd24('0x19')](this[_0xdd24('0x17')](_0xdd24('0x18'))):{};},'set':function(_0x5391a0){return this[_0xdd24('0x1a')](_0xdd24('0x18'),JSON['stringify'](_0x5391a0));}},'offlineForm':{'type':Sequelize[_0xdd24('0xe')],'defaultValue':function(){return JSON[_0xdd24('0x13')]({'items':[{'type':_0xdd24('0x14'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdd24('0x4')},'variable':null},{'type':_0xdd24('0x1b'),'config':{'placeholder':_0xdd24('0x1c')},'props':{'title':_0xdd24('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xdd24('0x17')](_0xdd24('0x1d'))?JSON[_0xdd24('0x19')](this[_0xdd24('0x17')](_0xdd24('0x1d'))):{};},'set':function(_0x4c5afc){return this[_0xdd24('0x1a')](_0xdd24('0x1d'),JSON[_0xdd24('0x13')](_0x4c5afc));}},'token':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdd24('0x2')]},'forwardOffline':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdd24('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x1e')},'offlineMessageSubject':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x1f')},'offlineMessageBody':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x20')},'enableUnmanagedNote':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x21')},'skipUnmanaged':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x22')},'sendUnmanaged':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdd24('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdd24('0x2')]},'notificationTemplate':{'type':Sequelize[_0xdd24('0xe')],'defaultValue':function(){return _0xdd24('0x23');}},'notificationSound':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x24')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdd24('0x25')},'verticalAlignment':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdd24('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdd24('0x2')],'allowNull':![],'defaultValue':_0xdd24('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd24('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd24('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':_0xdd24('0x28')},'systemAvatar':{'type':Sequelize[_0xdd24('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd24('0x7')],'comment':_0xdd24('0x29')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdd24('0x2a'),'set':function(_0xbeb82c){if(!_0xbeb82c)this[_0xdd24('0x1a')]('mandatoryDispositionPauseId',null);this[_0xdd24('0x1a')](_0xdd24('0x2b'),_0xbeb82c);}},'vidaooEscalation':{'type':Sequelize[_0xdd24('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdd24('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a96=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','name','text','input','parse','getDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','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:'];(function(_0x1d750e,_0x4bde92){var _0x1daae5=function(_0x18d26a){while(--_0x18d26a){_0x1d750e['push'](_0x1d750e['shift']());}};_0x1daae5(++_0x4bde92);}(_0x9a96,0xd0));var _0x69a9=function(_0x5e33e1,_0xaf0b6f){_0x5e33e1=_0x5e33e1-0x0;var _0x1bfcc3=_0x9a96[_0x5e33e1];return _0x1bfcc3;};'use strict';var Sequelize=require(_0x69a9('0x0'));var rs=require(_0x69a9('0x1'));module[_0x69a9('0x2')]={'name':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'unique':_0x69a9('0x4')},'description':{'type':Sequelize[_0x69a9('0x3')]},'mapKey':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x5')},'mapKeyOffline':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x5')},'key':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x6')},'customerAlias':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x69a9('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x69a9('0x3')]},'animation':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x69a9('0xb')]('rounded',_0x69a9('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xd')},'start_chat_button':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xe')},'header_offline':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xf')},'download_transcript':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x69a9('0x11')]},'closingQuestion':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x14')},'placeholderMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x16')},'closingMessageButton':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xe')},'skipMessageButton':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x17')},'conditionAgreement':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x69a9('0x18'),_0x69a9('0x19')),'defaultValue':_0x69a9('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x69a9('0x1a'),'type':_0x69a9('0x1b'),'required':!![]},'props':{'title':_0x69a9('0x1a'),'helpText':''}},{'type':_0x69a9('0x1c'),'props':{'title':_0x69a9('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x69a9('0x1d')](this[_0x69a9('0x1e')]('onlineForm')):{};},'set':function(_0x56314f){return this['setDataValue'](_0x69a9('0x1f'),JSON[_0x69a9('0x20')](_0x56314f));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x69a9('0x20')]({'items':[{'type':_0x69a9('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x69a9('0x5'),'type':'email'},'variable':null},{'type':_0x69a9('0x21'),'config':{'placeholder':_0x69a9('0x22')},'props':{'title':_0x69a9('0x22'),'helpText':_0x69a9('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x69a9('0x1e')](_0x69a9('0x24'))?JSON[_0x69a9('0x1d')](this[_0x69a9('0x1e')](_0x69a9('0x24'))):{};},'set':function(_0x2672e9){return this[_0x69a9('0x25')]('offlineForm',JSON[_0x69a9('0x20')](_0x2672e9));}},'token':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':function(){return rs[_0x69a9('0x26')]();}},'autoclose':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x69a9('0x3')]},'forwardOffline':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x69a9('0x3')]},'waitingTitle':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x28')},'offlineMessageBody':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x69a9('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x69a9('0x3')]},'notificationTemplate':{'type':Sequelize[_0x69a9('0x11')],'defaultValue':function(){return _0x69a9('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2c')},'verticalAlignment':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x69a9('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x69a9('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2f')},'systemAvatar':{'type':Sequelize[_0x69a9('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![],'comment':_0x69a9('0x30'),'set':function(_0x587dee){if(!_0x587dee)this[_0x69a9('0x25')](_0x69a9('0x31'),null);this[_0x69a9('0x25')]('mandatoryDisposition',_0x587dee);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 42f8b61..9096753 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 _0x2a39=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','count','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','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','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','getResult','Sequelize','ValidationError','difference','createdAt','updatedAt','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','ListId','contact','customerIp','headers','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','close','unmanaged','*,*,*,*','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','utf8','render','toPairs','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-forwarded-for','x-real-ip','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','ChatApplication','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','Pause','length','catch'];(function(_0x5f115e,_0x97497f){var _0x12187c=function(_0xedc797){while(--_0xedc797){_0x5f115e['push'](_0x5f115e['shift']());}};_0x12187c(++_0x97497f);}(_0x2a39,0x1e3));var _0x92a3=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0x2a39[_0x235884];return _0x211158;};'use strict';var pdf=require(_0x92a3('0x0'));var emlformat=require(_0x92a3('0x1'));var rimraf=require(_0x92a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92a3('0x3'));var rp=require(_0x92a3('0x4'));var moment=require(_0x92a3('0x5'));var BPromise=require(_0x92a3('0x6'));var Mustache=require(_0x92a3('0x7'));var util=require(_0x92a3('0x8'));var path=require(_0x92a3('0x9'));var sox=require('sox');var csv=require(_0x92a3('0xa'));var ejs=require(_0x92a3('0xb'));var fs=require('fs');var _=require(_0x92a3('0xc'));var squel=require(_0x92a3('0xd'));var crypto=require(_0x92a3('0xe'));var jsforce=require(_0x92a3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x92a3('0xa'));var querystring=require(_0x92a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x92a3('0x11'));var authService=require(_0x92a3('0x12'));var qs=require(_0x92a3('0x13'));var as=require(_0x92a3('0x14'));var hardwareService=require(_0x92a3('0x15'));var logger=require(_0x92a3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x92a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x92a3('0x18'))['db'];config[_0x92a3('0x19')]=_[_0x92a3('0x1a')](config[_0x92a3('0x19')],{'host':_0x92a3('0x1b'),'port':0x18eb});var socket=require(_0x92a3('0x1c'))(new Redis(config[_0x92a3('0x19')]));require('./chatWebsite.socket')[_0x92a3('0x1d')](socket);var jayson=require(_0x92a3('0x1e'));var client=jayson['client'][_0x92a3('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x92a3('0x20')][_0x92a3('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x2a993d,_0x3c6ef8,_0x436085,_0x18b8c5){return new BPromise(function(_0x463670,_0x4caf2a){var _0x17648d=_0x18b8c5||client;return _0x17648d[_0x92a3('0x21')](_0x2a993d,_0x436085)[_0x92a3('0x22')](function(_0x1e9743){logger[_0x92a3('0x23')](_0x92a3('0x24'),_0x3c6ef8,'request\x20sent');logger['debug'](_0x92a3('0x25'),_0x3c6ef8,'request\x20sent',JSON[_0x92a3('0x26')](_0x1e9743));if(_0x1e9743[_0x92a3('0x27')]){if(_0x1e9743['error'][_0x92a3('0x28')]===0x1f4){logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x1e9743['error'][_0x92a3('0x29')]);return _0x4caf2a(_0x1e9743[_0x92a3('0x27')][_0x92a3('0x29')]);}logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x1e9743['error'][_0x92a3('0x29')]);return _0x463670(_0x1e9743['error'][_0x92a3('0x29')]);}else{logger[_0x92a3('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x3c6ef8,_0x92a3('0x2a'));_0x463670(_0x1e9743[_0x92a3('0x2b')]['message']);}})['catch'](function(_0x576516){logger[_0x92a3('0x27')](_0x92a3('0x24'),_0x3c6ef8,_0x576516);_0x4caf2a(_0x576516);});});}function respondWithStatusCode(_0x10d0c6,_0x53ed7d){_0x53ed7d=_0x53ed7d||0xcc;return function(_0x419f11){if(_0x419f11){return _0x10d0c6[_0x92a3('0x2c')](_0x53ed7d);}return _0x10d0c6[_0x92a3('0x2d')](_0x53ed7d)[_0x92a3('0x2e')]();};}function respondWithResult(_0x30e0a0,_0x230dc6){_0x230dc6=_0x230dc6||0xc8;return function(_0x49d5b3){if(_0x49d5b3){return _0x30e0a0['status'](_0x230dc6)[_0x92a3('0x2f')](_0x49d5b3);}};}function respondWithFilteredResult(_0x485977,_0x16db82){return function(_0x2cba72){if(_0x2cba72){var _0x37d3dc=_0x2cba72['count'],_0x510ceb=_0x16db82[_0x92a3('0x30')],_0x4ba255=_0x16db82[_0x92a3('0x30')]+_0x16db82[_0x92a3('0x31')],_0x4b791e;if(_0x4ba255>=_0x37d3dc){_0x4ba255=_0x37d3dc;_0x4b791e=0xc8;}else{_0x4b791e=0xce;}_0x485977[_0x92a3('0x2d')](_0x4b791e);return _0x485977['set'](_0x92a3('0x32'),_0x510ceb+'-'+_0x4ba255+'/'+_0x37d3dc)[_0x92a3('0x2f')](_0x2cba72);}return null;};}function patchUpdates(_0x4d99fa){return function(_0x1cea3e){try{jsonpatch[_0x92a3('0x33')](_0x1cea3e,_0x4d99fa,!![]);}catch(_0x2bb9b5){return BPromise[_0x92a3('0x34')](_0x2bb9b5);}return _0x1cea3e[_0x92a3('0x35')]();};}function saveUpdates(_0x2fb9a0,_0x5067c4){return function(_0x22675c){if(_0x22675c){return _0x22675c['update'](_0x2fb9a0)[_0x92a3('0x22')](function(_0x1ec9cb){return _0x1ec9cb;});}return null;};}function removeEntity(_0x4b9dbd,_0x15bbe1){return function(_0x215acd){if(_0x215acd){return _0x215acd[_0x92a3('0x36')]()[_0x92a3('0x22')](function(){var _0x4ca247=_0x215acd['get']({'plain':!![]});var _0xc44233=_0x92a3('0x37');return db[_0x92a3('0x38')][_0x92a3('0x36')]({'where':{'type':_0xc44233,'resourceId':_0x4ca247['id']}})[_0x92a3('0x22')](function(){return _0x215acd;});})['then'](function(){_0x4b9dbd[_0x92a3('0x2d')](0xcc)[_0x92a3('0x2e')]();});}};}function handleEntityNotFound(_0x480bf1,_0x5c16af){return function(_0x11989e){if(!_0x11989e){_0x480bf1['sendStatus'](0x194);}return _0x11989e;};}function handleError(_0x2ccc17,_0x4c83f4){_0x4c83f4=_0x4c83f4||0x1f4;return function(_0x47a170){logger[_0x92a3('0x27')](_0x47a170[_0x92a3('0x39')]);if(_0x47a170[_0x92a3('0x3a')]){delete _0x47a170[_0x92a3('0x3a')];}_0x2ccc17['status'](_0x4c83f4)[_0x92a3('0x3b')](_0x47a170);};}exports[_0x92a3('0x3c')]=function(_0x441e80,_0x2aecb3){var _0x5b7d80={'include':[{'model':db['Pause'],'as':_0x92a3('0x3d')}]},_0x214a68={},_0x224148={'count':0x0,'rows':[]};var _0xe5fd47=_[_0x92a3('0x3e')](db['ChatWebsite'][_0x92a3('0x3f')],function(_0x54ad2f){return{'name':_0x54ad2f[_0x92a3('0x40')],'type':_0x54ad2f[_0x92a3('0x41')]['key']};});_0x214a68[_0x92a3('0x42')]=_['map'](_0xe5fd47,'name');_0x214a68[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x441e80['query']);_0x214a68['filters']=_[_0x92a3('0x45')](_0x214a68[_0x92a3('0x42')],_0x214a68[_0x92a3('0x43')]);_0x5b7d80['attributes']=_[_0x92a3('0x45')](_0x214a68['model'],qs[_0x92a3('0x46')](_0x441e80[_0x92a3('0x43')][_0x92a3('0x46')]));_0x5b7d80['attributes']=_0x5b7d80[_0x92a3('0x47')]['length']?_0x5b7d80[_0x92a3('0x47')]:_0x214a68[_0x92a3('0x42')];if(!_0x441e80['query'][_0x92a3('0x48')](_0x92a3('0x49'))){_0x5b7d80['limit']=qs[_0x92a3('0x31')](_0x441e80['query'][_0x92a3('0x31')]);_0x5b7d80[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x441e80[_0x92a3('0x43')]['offset']);}_0x5b7d80[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x441e80[_0x92a3('0x43')][_0x92a3('0x4b')]);_0x5b7d80[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x441e80[_0x92a3('0x43')],_0x214a68['filters']),_0xe5fd47);if(_0x441e80[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x5b7d80['where']=_[_0x92a3('0x50')](_0x5b7d80[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0xe5fd47,function(_0x2688dd){if(_0x2688dd[_0x92a3('0x41')]!==_0x92a3('0x51')){var _0x3565ec={};_0x3565ec[_0x2688dd[_0x92a3('0x3a')]]={'$like':'%'+_0x441e80[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x3565ec;}})});}_0x5b7d80=_[_0x92a3('0x50')]({},_0x5b7d80,_0x441e80[_0x92a3('0x52')]);var _0x1fa9c4={'where':_0x5b7d80[_0x92a3('0x4c')]};return db[_0x92a3('0x53')]['count'](_0x1fa9c4)[_0x92a3('0x22')](function(_0x30b111){_0x224148['count']=_0x30b111;if(_0x441e80['query'][_0x92a3('0x54')]){_0x5b7d80[_0x92a3('0x55')]=[{'all':!![]}];}return db[_0x92a3('0x53')][_0x92a3('0x56')](_0x5b7d80);})[_0x92a3('0x22')](function(_0x2d3d5a){_0x224148[_0x92a3('0x57')]=_0x2d3d5a;return _0x224148;})[_0x92a3('0x22')](respondWithFilteredResult(_0x2aecb3,_0x5b7d80))['catch'](handleError(_0x2aecb3,null));};exports[_0x92a3('0x58')]=function(_0x100b76,_0x208827){var _0x3ff344={'raw':![],'where':{'id':_0x100b76[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0x5a')],'as':'mandatoryDispositionPause'}]},_0x36b619={};_0x36b619[_0x92a3('0x42')]=_[_0x92a3('0x44')](db[_0x92a3('0x53')][_0x92a3('0x3f')]);_0x36b619['query']=_['keys'](_0x100b76[_0x92a3('0x43')]);_0x36b619['filters']=_[_0x92a3('0x45')](_0x36b619[_0x92a3('0x42')],_0x36b619['query']);_0x3ff344['attributes']=_['intersection'](_0x36b619[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x100b76[_0x92a3('0x43')]['fields']));_0x3ff344[_0x92a3('0x47')]=_0x3ff344[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x3ff344[_0x92a3('0x47')]:_0x36b619[_0x92a3('0x42')];if(_0x100b76[_0x92a3('0x43')][_0x92a3('0x54')]){_0x3ff344[_0x92a3('0x55')]=[{'all':!![]}];}_0x3ff344=_['merge']({},_0x3ff344,_0x100b76['options']);return db[_0x92a3('0x53')]['find'](_0x3ff344)[_0x92a3('0x22')](handleEntityNotFound(_0x208827,null))[_0x92a3('0x22')](respondWithResult(_0x208827,null))[_0x92a3('0x5c')](handleError(_0x208827,null));};exports['create']=function(_0x71f05e,_0x40a5ed){return db[_0x92a3('0x53')][_0x92a3('0x5d')](_0x71f05e[_0x92a3('0x5e')],{})[_0x92a3('0x22')](function(_0x3fdc5e){var _0x66e80a=_0x71f05e[_0x92a3('0x5f')][_0x92a3('0x60')]({'plain':!![]});if(!_0x66e80a)throw new Error(_0x92a3('0x61'));if(_0x66e80a[_0x92a3('0x62')]===_0x92a3('0x5f')){var _0x441c4f=_0x3fdc5e[_0x92a3('0x60')]({'plain':!![]});var _0x1c6c75=_0x92a3('0x37');return db[_0x92a3('0x63')]['find']({'where':{'name':_0x1c6c75,'userProfileId':_0x66e80a[_0x92a3('0x64')]},'raw':!![]})['then'](function(_0x265c4f){if(_0x265c4f&&_0x265c4f['autoAssociation']===0x0){return db[_0x92a3('0x38')][_0x92a3('0x5d')]({'name':_0x441c4f['name'],'resourceId':_0x441c4f['id'],'type':_0x265c4f[_0x92a3('0x3a')],'sectionId':_0x265c4f['id']},{})['then'](function(){return _0x3fdc5e;});}else{return _0x3fdc5e;}})[_0x92a3('0x5c')](function(_0x4a3329){logger[_0x92a3('0x27')](_0x92a3('0x65'),_0x4a3329);throw _0x4a3329;});}return _0x3fdc5e;})[_0x92a3('0x22')](respondWithResult(_0x40a5ed,0xc9))[_0x92a3('0x5c')](handleError(_0x40a5ed,null));};exports[_0x92a3('0x66')]=function(_0x53b332,_0x2812a8){if(_0x53b332[_0x92a3('0x5e')]['id']){delete _0x53b332['body']['id'];}return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x53b332[_0x92a3('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x92a3('0x3d')}]})[_0x92a3('0x22')](handleEntityNotFound(_0x2812a8,null))['then'](saveUpdates(_0x53b332[_0x92a3('0x5e')],null))[_0x92a3('0x22')](respondWithResult(_0x2812a8,null))[_0x92a3('0x5c')](handleError(_0x2812a8,null));};exports[_0x92a3('0x36')]=function(_0x29d0c1,_0x18ee24){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x29d0c1['params']['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x18ee24,null))['then'](removeEntity(_0x18ee24,null))[_0x92a3('0x5c')](handleError(_0x18ee24,null));};exports[_0x92a3('0x68')]=function(_0x3c8363,_0x550534){return db[_0x92a3('0x53')][_0x92a3('0x68')]()[_0x92a3('0x22')](respondWithResult(_0x550534,null))[_0x92a3('0x5c')](handleError(_0x550534,null));};exports[_0x92a3('0x69')]=function(_0x4cbf71,_0x30c35f,_0x2b266f){if(_0x4cbf71[_0x92a3('0x5e')]['id']){delete _0x4cbf71[_0x92a3('0x5e')]['id'];}return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x4cbf71[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x30c35f,null))['then'](function(_0x12407b){if(_0x12407b){_0x4cbf71[_0x92a3('0x5e')][_0x92a3('0x6a')]=_0x12407b['id'];return db[_0x92a3('0x6b')][_0x92a3('0x5d')](_0x4cbf71[_0x92a3('0x5e')]);}})[_0x92a3('0x22')](respondWithResult(_0x30c35f,null))[_0x92a3('0x5c')](handleError(_0x30c35f,null));};exports[_0x92a3('0x6c')]=function(_0x3df64b,_0x55d02f,_0x511283){var _0x160505={'raw':![],'where':{}};var _0x2b2a83={};var _0x357743={'count':0x0,'rows':[]};return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x3df64b[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x55d02f,null))[_0x92a3('0x22')](function(_0x8afd7f){if(_0x8afd7f){_0x2b2a83[_0x92a3('0x42')]=_['keys'](db[_0x92a3('0x6b')][_0x92a3('0x3f')]);_0x2b2a83[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x3df64b['query']);_0x2b2a83[_0x92a3('0x4d')]=_['intersection'](_0x2b2a83[_0x92a3('0x42')],_0x2b2a83[_0x92a3('0x43')]);_0x160505[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x2b2a83[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x3df64b['query']['fields']));_0x160505[_0x92a3('0x47')]=_0x160505[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x160505[_0x92a3('0x47')]:_0x2b2a83[_0x92a3('0x42')];if(!_0x3df64b[_0x92a3('0x43')]['hasOwnProperty']('nolimit')){_0x160505[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x3df64b[_0x92a3('0x43')][_0x92a3('0x31')]);_0x160505[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x3df64b[_0x92a3('0x43')]['offset']);}_0x160505[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x3df64b['query'][_0x92a3('0x4b')]);_0x160505['where']=qs['filters'](_['pick'](_0x3df64b[_0x92a3('0x43')],_0x2b2a83[_0x92a3('0x4d')]));_0x160505['where'][_0x92a3('0x6a')]=_0x8afd7f['id'];if(_0x3df64b['query'][_0x92a3('0x4f')]){_0x160505[_0x92a3('0x4c')]=_['merge'](_0x160505[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x160505[_0x92a3('0x47')],function(_0x62b874){var _0x2a170f={};_0x2a170f[_0x62b874]={'$like':'%'+_0x3df64b[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x2a170f;})});}_0x160505=_[_0x92a3('0x50')]({},_0x160505,_0x3df64b[_0x92a3('0x52')]);return db[_0x92a3('0x6b')][_0x92a3('0x6d')]({'where':_0x160505[_0x92a3('0x4c')]})['then'](function(_0x5c71a1){_0x357743['count']=_0x5c71a1;if(_0x3df64b['query'][_0x92a3('0x54')]){_0x160505[_0x92a3('0x55')]=[{'all':!![]}];}return db[_0x92a3('0x6b')][_0x92a3('0x56')](_0x160505);})[_0x92a3('0x22')](function(_0x37f350){_0x357743[_0x92a3('0x57')]=_0x37f350;return _0x357743;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x55d02f,_0x160505))[_0x92a3('0x5c')](handleError(_0x55d02f,null));};exports[_0x92a3('0x6e')]=function(_0x38de40,_0x535611,_0x298c43){return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0x38de40[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x535611,null))['then'](function(_0x117f05){if(_0x117f05){return _0x117f05[_0x92a3('0x6e')](_0x38de40['query'][_0x92a3('0x6f')]);}})[_0x92a3('0x22')](respondWithStatusCode(_0x535611,null))[_0x92a3('0x5c')](handleError(_0x535611,null));};exports[_0x92a3('0x70')]=function(_0x8c6cd2,_0x4314f9,_0x11caa9){if(_0x8c6cd2[_0x92a3('0x5e')]['id']){delete _0x8c6cd2[_0x92a3('0x5e')]['id'];}return db[_0x92a3('0x53')]['find']({'where':{'id':_0x8c6cd2['params']['id']}})['then'](handleEntityNotFound(_0x4314f9,null))['then'](function(_0x4d8fad){if(_0x4d8fad){_0x8c6cd2[_0x92a3('0x5e')][_0x92a3('0x6a')]=_0x4d8fad['id'];return db[_0x92a3('0x71')][_0x92a3('0x5d')](_0x8c6cd2['body']);}})['then'](respondWithResult(_0x4314f9,null))[_0x92a3('0x5c')](handleError(_0x4314f9,null));};exports['getAnswers']=function(_0x2b8376,_0x5496cf,_0x246c62){var _0x464672={'raw':![],'where':{}};var _0x438c91={};var _0x44f909={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92a3('0x72')]({'where':{'id':_0x2b8376[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x5496cf,null))['then'](function(_0x109f39){if(_0x109f39){_0x438c91[_0x92a3('0x42')]=_[_0x92a3('0x44')](db['CannedAnswer'][_0x92a3('0x3f')]);_0x438c91[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x2b8376[_0x92a3('0x43')]);_0x438c91[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x438c91[_0x92a3('0x42')],_0x438c91['query']);_0x464672[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x438c91['model'],qs['fields'](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x46')]));_0x464672[_0x92a3('0x47')]=_0x464672[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x464672[_0x92a3('0x47')]:_0x438c91[_0x92a3('0x42')];if(!_0x2b8376[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x464672[_0x92a3('0x31')]=qs['limit'](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x31')]);_0x464672['offset']=qs[_0x92a3('0x30')](_0x2b8376['query']['offset']);}_0x464672['order']=qs[_0x92a3('0x4b')](_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4b')]);_0x464672[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x2b8376[_0x92a3('0x43')],_0x438c91[_0x92a3('0x4d')]));_0x464672[_0x92a3('0x4c')][_0x92a3('0x6a')]=_0x109f39['id'];if(_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x464672[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0x464672['where'],{'$or':_[_0x92a3('0x3e')](_0x464672[_0x92a3('0x47')],function(_0x354cdc){var _0x500259={};_0x500259[_0x354cdc]={'$like':'%'+_0x2b8376[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x500259;})});}_0x464672=_[_0x92a3('0x50')]({},_0x464672,_0x2b8376['options']);return db[_0x92a3('0x71')][_0x92a3('0x6d')]({'where':_0x464672[_0x92a3('0x4c')]})[_0x92a3('0x22')](function(_0x3dace1){_0x44f909['count']=_0x3dace1;if(_0x2b8376[_0x92a3('0x43')][_0x92a3('0x54')]){_0x464672['include']=[{'all':!![]}];}return db[_0x92a3('0x71')]['findAll'](_0x464672);})[_0x92a3('0x22')](function(_0x4e0c21){_0x44f909[_0x92a3('0x57')]=_0x4e0c21;return _0x44f909;});}})['then'](respondWithFilteredResult(_0x5496cf,_0x464672))[_0x92a3('0x5c')](handleError(_0x5496cf,null));};exports[_0x92a3('0x73')]=function(_0xf76327,_0x4e85eb,_0x5ba108){return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0xf76327[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x4e85eb,null))[_0x92a3('0x22')](function(_0x5858f3){if(_0x5858f3){return _0x5858f3[_0x92a3('0x73')](_0xf76327['query'][_0x92a3('0x6f')]);}})[_0x92a3('0x22')](respondWithStatusCode(_0x4e85eb,null))[_0x92a3('0x5c')](handleError(_0x4e85eb,null));};exports[_0x92a3('0x74')]=function(_0x17e1a1,_0x2ea600,_0x1945dc){_0x17e1a1[_0x92a3('0x5e')]['sitepic']=_0x17e1a1[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x17e1a1[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x2ea600,null))[_0x92a3('0x22')](saveUpdates(_0x17e1a1['body'],null))[_0x92a3('0x22')](respondWithResult(_0x2ea600,null))[_0x92a3('0x5c')](handleError(_0x2ea600,null));};exports['addAvatar']=function(_0x2525b5,_0x969363,_0x2ed84c){_0x2525b5[_0x92a3('0x5e')][_0x92a3('0x77')]=_0x2525b5[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')]['find']({'where':{'id':_0x2525b5[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x969363,null))[_0x92a3('0x22')](saveUpdates(_0x2525b5['body'],null))[_0x92a3('0x22')](respondWithResult(_0x969363,null))[_0x92a3('0x5c')](handleError(_0x969363,null));};exports[_0x92a3('0x78')]=function(_0x5d1e87,_0x3483ab,_0x1024c9){_0x5d1e87['body'][_0x92a3('0x79')]=_0x5d1e87[_0x92a3('0x75')][_0x92a3('0x76')];return db['ChatWebsite'][_0x92a3('0x67')]({'where':{'id':_0x5d1e87[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3483ab,null))[_0x92a3('0x22')](saveUpdates(_0x5d1e87[_0x92a3('0x5e')],null))['then'](respondWithResult(_0x3483ab,null))[_0x92a3('0x5c')](handleError(_0x3483ab,null));};exports[_0x92a3('0x7a')]=function(_0x54c64f,_0x70c26,_0x4882b9){_0x54c64f['body'][_0x92a3('0x7b')]=_0x54c64f[_0x92a3('0x75')][_0x92a3('0x76')];return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x54c64f[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x70c26,null))[_0x92a3('0x22')](saveUpdates(_0x54c64f[_0x92a3('0x5e')],null))[_0x92a3('0x22')](respondWithResult(_0x70c26,null))[_0x92a3('0x5c')](handleError(_0x70c26,null));};exports[_0x92a3('0x7c')]=function(_0x20471e,_0x725b43,_0x362f64){var _0x3243e1=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x7f'));var _0x1d6db7={'where':{'id':_0x20471e['params']['id']},'attributes':['id',_0x92a3('0x80')],'raw':!![]};var _0x3607d4=![];return require(_0x92a3('0x81'))[_0x92a3('0x82')]()[_0x92a3('0x22')](function(_0x1fff18){if(_0x1fff18){_0x3607d4=_0x1fff18['custom'];}})[_0x92a3('0x22')](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x1d6db7);})['then'](handleEntityNotFound(_0x725b43,null))['then'](function(_0x33b409){if(_0x33b409){if(!_[_0x92a3('0x83')](_0x33b409[_0x92a3('0x80')])){if(fs['existsSync'](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x84'),_0x33b409['sitepic']))&&_0x3607d4){_0x3243e1=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x84'),_0x33b409[_0x92a3('0x80')]);}}return _0x725b43[_0x92a3('0x85')](_0x3243e1);}})[_0x92a3('0x5c')](handleError(_0x725b43,null));};exports[_0x92a3('0x86')]=function(_0x239b43,_0x8b448f,_0x4024ba){var _0xbb90f5=path['join'](config[_0x92a3('0x7e')],_0x92a3('0x87'));var _0x36cd88={'where':{'id':_0x239b43[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x77')],'raw':!![]};return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x36cd88)[_0x92a3('0x22')](handleEntityNotFound(_0x8b448f,null))[_0x92a3('0x22')](function(_0x5edf31){if(_0x5edf31){if(!_[_0x92a3('0x83')](_0x5edf31[_0x92a3('0x77')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x5edf31[_0x92a3('0x77')]))){_0xbb90f5=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x5edf31[_0x92a3('0x77')]);}}return _0x8b448f['download'](_0xbb90f5);}})['catch'](handleError(_0x8b448f,null));};exports[_0x92a3('0x8a')]=function(_0x3fbea6,_0x367451,_0x26d8ac){var _0x42d106=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x8b'));var _0x369065={'where':{'id':_0x3fbea6[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x79'),_0x92a3('0x8c')],'raw':!![]};return db['ChatWebsite'][_0x92a3('0x67')](_0x369065)[_0x92a3('0x22')](handleEntityNotFound(_0x367451,null))[_0x92a3('0x22')](function(_0x59a195){if(_0x59a195){if(!_[_0x92a3('0x83')](_0x59a195[_0x92a3('0x79')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config['root'],_0x92a3('0x89'),_0x59a195[_0x92a3('0x79')]))&&_0x59a195[_0x92a3('0x8c')]){_0x42d106=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x89'),_0x59a195[_0x92a3('0x79')]);}}return _0x367451[_0x92a3('0x85')](_0x42d106);}})[_0x92a3('0x5c')](handleError(_0x367451,null));};exports[_0x92a3('0x8d')]=function(_0x4ee0cb,_0x144b72,_0x5b503b){var _0x5aa061=path['join'](config[_0x92a3('0x7e')],_0x92a3('0x8e'));var _0x2d8f3e={'where':{'id':_0x4ee0cb[_0x92a3('0x59')]['id']},'attributes':['id',_0x92a3('0x7b')],'raw':!![]};return db[_0x92a3('0x53')][_0x92a3('0x67')](_0x2d8f3e)[_0x92a3('0x22')](handleEntityNotFound(_0x144b72,null))[_0x92a3('0x22')](function(_0xbfe5aa){if(_0xbfe5aa){if(!_[_0x92a3('0x83')](_0xbfe5aa[_0x92a3('0x7b')])){if(fs[_0x92a3('0x88')](path[_0x92a3('0x7d')](config['root'],_0x92a3('0x89'),_0xbfe5aa[_0x92a3('0x7b')]))){_0x5aa061=path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],'server/files/images/avatars/',_0xbfe5aa['systemAvatar']);}}return _0x144b72[_0x92a3('0x85')](_0x5aa061);}})['catch'](handleError(_0x144b72,null));};exports['notify']=function(_0x5e05bd,_0x2e234d,_0x3c2316){var _0x52eff0=require(_0x92a3('0x8f'));var _0x5a760=new _0x52eff0();var _0xcf956f=_0x5a760[_0x92a3('0x90')](_0x5e05bd['headers']['user-agent'])[_0x92a3('0x91')]();var _0x2fae58={'body':_0x5e05bd[_0x92a3('0x5e')],'channel':'chat'};var _0x1da915=[];var _0x395295=[];var _0x49ad3b={};var _0x2b3457=![];return db['CmContact'][_0x92a3('0x68')]()[_0x92a3('0x22')](function(_0x1a17ce){if(!_0x1a17ce){throw new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('no\x20available\x20attributes');}_0x1da915=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x1a17ce),[_0x92a3('0x95'),'updatedAt']);_0x395295=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x1a17ce),[_0x92a3('0x95'),_0x92a3('0x96'),'CompanyId','ListId']);if(_0x5e05bd[_0x92a3('0x5e')]['id']){delete _0x5e05bd[_0x92a3('0x5e')]['id'];}if(_['isNil'](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')])){throw new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('from\x20is\x20mandatory');}if(_[_0x92a3('0x83')](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x5e')])||_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x5e')]===''){throw new db[(_0x92a3('0x92'))]['ValidationError'](_0x92a3('0x98'));}if(_[_0x92a3('0x83')](_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')])){throw new db[(_0x92a3('0x92'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x395295);}if(!_[_0x92a3('0x9a')](_0x395295,_0x5e05bd['body'][_0x92a3('0x99')])){throw new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0x9b')+_0x395295);}_0x49ad3b[_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')]]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')];})['then'](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x5e05bd[_0x92a3('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x92a3('0x9c'),'include':[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0x9e'),'where':_0x49ad3b,'limit':0x1,'order':[[_0x92a3('0x96'),_0x92a3('0x9f')]]}]},{'model':db['ChatApplication'],'as':_0x92a3('0xa0')}]});})[_0x92a3('0x22')](handleEntityNotFound(_0x2e234d,null))[_0x92a3('0x22')](function(_0x57eb56){if(_0x57eb56&&_0x57eb56[_0x92a3('0x9c')]){_0x2fae58[_0x92a3('0xa1')]=_0x57eb56;_0x2fae58[_0x92a3('0xa2')]=_0x57eb56[_0x92a3('0xa0')];_0x2fae58['list']=_0x57eb56[_0x92a3('0x9c')];_0x2fae58[_0x92a3('0xa2')]=_[_0x92a3('0xa3')](_0x2fae58['applications'],[_0x92a3('0xa4')],[_0x92a3('0xa5')]);if(_0x2fae58['account'][_0x92a3('0xa0')]){delete _0x2fae58[_0x92a3('0xa1')][_0x92a3('0xa0')];}if(_0x2fae58[_0x92a3('0xa1')][_0x92a3('0x9c')]&&_0x2fae58[_0x92a3('0xa1')]['List'][_0x92a3('0x9e')]['length']){return _0x2fae58[_0x92a3('0xa1')][_0x92a3('0x9c')]['Contacts'][0x0];}var _0x59829e=_['defaults'](_0x5e05bd[_0x92a3('0x5e')],{'firstName':_0x5e05bd[_0x92a3('0x5e')]['from'],'ListId':_0x57eb56[_0x92a3('0xa6')]});_0x59829e[_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x99')]]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0x97')];return db[_0x92a3('0x9d')][_0x92a3('0x5d')](_0x59829e,{'fields':_0x1da915,'raw':!![]});}})[_0x92a3('0x22')](handleEntityNotFound(_0x2e234d,null))['then'](function(_0xb685a9){_0x2fae58[_0x92a3('0xa7')]=_0xb685a9;var _0x4d61a9=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xa8')];if(_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaa')]){_0x4d61a9=_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaa')];}else if(_0x5e05bd[_0x92a3('0xa9')]['x-forwarded-for']){_0x4d61a9=_[_0x92a3('0xab')](_0x5e05bd[_0x92a3('0xa9')]['x-forwarded-for'][_0x92a3('0xac')](','));}if(_0xb685a9){var _0x340cda={'ContactId':_0xb685a9['id'],'ChatWebsiteId':_0x5e05bd[_0x92a3('0x59')]['id'],'from':(_0xb685a9[_0x92a3('0xad')]||'')+'\x20'+(_0xb685a9[_0x92a3('0xae')]||''),'customerIp':_0x4d61a9,'customerPort':_0x5e05bd['headers']['x-real-port']?_0x5e05bd[_0x92a3('0xa9')][_0x92a3('0xaf')]:null,'referer':_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb0')],'browserName':_0xcf956f[_0x92a3('0xb1')][_0x92a3('0x3a')]&&_0xcf956f[_0x92a3('0xb1')][_0x92a3('0xb2')]?util[_0x92a3('0xb3')](_0x92a3('0xb4'),_0xcf956f[_0x92a3('0xb1')][_0x92a3('0x3a')],_0xcf956f[_0x92a3('0xb1')][_0x92a3('0xb2')]):_0x92a3('0xb5'),'browserVersion':_0xcf956f[_0x92a3('0xb1')]['version']||_0x92a3('0xb5'),'osName':util[_0x92a3('0xb3')](_0x92a3('0xb4'),_0xcf956f['os'][_0x92a3('0x3a')],_0xcf956f['os'][_0x92a3('0xb2')]),'osVersion':_0xcf956f['os']['version'],'deviceModel':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x42')]&&_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')]?util[_0x92a3('0xb3')](_0x92a3('0xb8'),_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x42')],_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')],_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x41')]):null,'deviceVendor':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0xb7')],'deviceType':_0xcf956f[_0x92a3('0xb6')][_0x92a3('0x41')],'formData':JSON[_0x92a3('0x26')](_0x5e05bd[_0x92a3('0x5e')])};var _0xe4d90e={'ChatWebsiteId':_0x5e05bd[_0x92a3('0x59')]['id'],'closed':![]};if(_0x5e05bd[_0x92a3('0x5e')]['threadId']){_0xe4d90e[_0x92a3('0xb9')]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb9')];return db[_0x92a3('0xba')][_0x92a3('0x67')]({'where':_0xe4d90e})[_0x92a3('0x22')](function(_0x38467c){if(_0x38467c){return[_0x38467c,![]];}_0x340cda['threadId']=_0x5e05bd['body'][_0x92a3('0xb9')];_0x340cda[_0x92a3('0xbb')]=_0x5e05bd['body'][_0x92a3('0xbb')];return db[_0x92a3('0xba')][_0x92a3('0x5d')](_0x340cda)[_0x92a3('0x22')](function(_0x1bcc8c){return[_0x1bcc8c,!![]];});});}_0xe4d90e['ContactId']=_0xb685a9['id'];if(_0x5e05bd['body']['interaction']&&_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbc')]['id']){_0xe4d90e['id']=_0x5e05bd[_0x92a3('0x5e')]['interaction']['id'];return db[_0x92a3('0xba')][_0x92a3('0x67')]({'where':_0xe4d90e})['then'](function(_0x528080){if(_0x528080){return[_0x528080,![]];}return db[_0x92a3('0xba')]['create'](_0x340cda)[_0x92a3('0x22')](function(_0x1d841a){return[_0x1d841a,!![]];});});}return db[_0x92a3('0xba')][_0x92a3('0x5d')](_0x340cda)[_0x92a3('0x22')](function(_0x2a5d19){return[_0x2a5d19,!![]];});}})[_0x92a3('0xbd')](function(_0x3528ca,_0x210b63){if(_0x3528ca){_0x2b3457=_0x210b63;if(!_0x210b63){var _0x12e8d2={'from':(_0x2fae58[_0x92a3('0xa7')]['firstName']||'')+'\x20'+(_0x2fae58[_0x92a3('0xa7')][_0x92a3('0xae')]||'')};if(_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xb9')]&&_0x5e05bd['body'][_0x92a3('0xbe')]&&_0x5e05bd[_0x92a3('0x5e')]['threadId']!=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbe')]){_0x12e8d2[_0x92a3('0xb9')]=_0x5e05bd[_0x92a3('0x5e')][_0x92a3('0xbe')];}return _0x3528ca['update'](_0x12e8d2);}else{return _0x3528ca;}}})[_0x92a3('0x22')](function(_0x570adf){_0x2fae58['interaction']=_0x570adf[_0x92a3('0x60')]({'plain':!![]});_0x2fae58[_0x92a3('0xbc')]['created']=_0x2b3457;if(_0x2fae58[_0x92a3('0xbc')][_0x92a3('0xbf')]){if(_0x2fae58['account']['autoclose']){_0x2fae58[_0x92a3('0xa2')]['push']({'id':0x0,'priority':_0x2fae58[_0x92a3('0xa2')]['length']+0x1,'app':_0x92a3('0xc0'),'appdata':_0x92a3('0xc1'),'interval':_0x92a3('0xc2')});}}return db['ChatMessage'][_0x92a3('0x5d')]({'body':_0x5e05bd['body']['body'],'ChatWebsiteId':_0x5e05bd['params']['id'],'ChatInteractionId':_0x570adf['id'],'direction':'in','ContactId':_0x2fae58['contact']['id'],'AttachmentId':_0x5e05bd['body']['AttachmentId']});})[_0x92a3('0x22')](function(_0x3ea01c){_0x2fae58[_0x92a3('0x29')]=_0x3ea01c;if(_0x2fae58[_0x92a3('0xbc')]['UserId']){return db[_0x92a3('0xc3')][_0x92a3('0x67')]({'attributes':['id',_0x92a3('0x3a')],'where':{'id':_0x2fae58[_0x92a3('0xbc')][_0x92a3('0xc4')]}})['then'](function(_0x17cd7b){if(_0x17cd7b){_0x2fae58[_0x92a3('0xa2')][_0x92a3('0xc5')]({'id':0x0,'priority':0x0,'app':_0x92a3('0xc6'),'appdata':_0x17cd7b[_0x92a3('0x3a')]+','+(_0x2fae58['account'][_0x92a3('0xc7')]||0xa),'interval':'*,*,*,*'});_0x2fae58[_0x92a3('0xc8')]=!![];}return respondWithRpcPromise(_0x92a3('0xc9'),'startRouting',_0x2fae58);});}return respondWithRpcPromise(_0x92a3('0xc9'),_0x92a3('0xca'),_0x2fae58);})[_0x92a3('0x22')](function(_0x50de3f){respondWithRpcPromise(_0x92a3('0xcb'),_0x92a3('0xcb'),{'event':_0x92a3('0xcc'),'message':_0x50de3f},client9002);return _0x50de3f;})[_0x92a3('0x22')](respondWithResult(_0x2e234d,null))[_0x92a3('0x5c')](handleError(_0x2e234d,null));};exports['offline']=function(_0x25baf,_0x1d4405,_0x44b12f){var _0x10993d,_0x41e9dd,_0x9f3fd4;var _0x1698e9=[];var _0x554969=[];var _0x233b42={};return db[_0x92a3('0x9d')][_0x92a3('0x68')]()['then'](function(_0x3cbbcd){if(!_0x3cbbcd){throw new db[(_0x92a3('0x92'))]['ValidationError'](_0x92a3('0xcd'));}_0x554969=_[_0x92a3('0x94')](_[_0x92a3('0x44')](_0x3cbbcd),[_0x92a3('0x95'),_0x92a3('0x96')]);_0x1698e9=_['difference'](_[_0x92a3('0x44')](_0x3cbbcd),['createdAt',_0x92a3('0x96'),'CompanyId',_0x92a3('0xa6')]);if(_0x25baf['body']['id']){delete _0x25baf[_0x92a3('0x5e')]['id'];}if(_[_0x92a3('0x83')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')])){throw _0x1d4405['status'](0x1f4)[_0x92a3('0x3b')](new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0xce')));}if(_['isNil'](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')])||_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')]===''){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)[_0x92a3('0x3b')](new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))](_0x92a3('0x98')));}if(_[_0x92a3('0x83')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')])){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)['send'](new db[(_0x92a3('0x92'))][(_0x92a3('0x93'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1698e9));}if(!_[_0x92a3('0x9a')](_0x1698e9,_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')])){throw _0x1d4405[_0x92a3('0x2d')](0x1f4)[_0x92a3('0x3b')](new db['Sequelize'][(_0x92a3('0x93'))](_0x92a3('0xd0')+_0x1698e9));}_0x233b42[_0x25baf['body'][_0x92a3('0xcf')]]=_0x25baf[_0x92a3('0x5e')]['from'];})[_0x92a3('0x22')](function(){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x25baf[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0xd1')],'as':_0x92a3('0x9c')}]});})[_0x92a3('0x22')](handleEntityNotFound(_0x1d4405,null))['then'](function(_0x476982){if(_0x476982&&_0x476982[_0x92a3('0x9c')]){_0x41e9dd=_0x476982;var _0x259f97=_[_0x92a3('0x1a')](_0x25baf[_0x92a3('0x5e')],{'firstName':_0x25baf[_0x92a3('0x5e')]['from'],'phone':_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')],'ListId':_0x476982[_0x92a3('0xa6')]});_0x259f97[_0x25baf[_0x92a3('0x5e')][_0x92a3('0xcf')]]=_0x25baf[_0x92a3('0x5e')][_0x92a3('0x97')];return db[_0x92a3('0x9d')][_0x92a3('0xd2')]({'where':_0x233b42,'defaults':_0x259f97});}})[_0x92a3('0xbd')](function(_0x337778){if(_0x337778){_0x9f3fd4=_0x337778;var _0x30a76b=fs[_0x92a3('0xd3')](path['join'](config[_0x92a3('0x7e')],'server/files/templates/chatOfflineMessage.ejs'),_0x92a3('0xd4'));var _0x119cc4=ejs[_0x92a3('0xd5')](_0x30a76b,{'body':_[_0x92a3('0xd6')](_0x25baf[_0x92a3('0x5e')][_0x92a3('0x5e')]),'bodyTitle':_0x41e9dd['offlineMessageBody']});return db[_0x92a3('0xd7')][_0x92a3('0x5d')]({'body':_0x119cc4,'ContactId':_0x337778['id'],'ChatWebsiteId':_0x41e9dd['id']});}})[_0x92a3('0x22')](function(_0x580441){if(_0x580441){_0x10993d=_0x580441;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x92a3('0xd8')],'as':_0x92a3('0xd9'),'raw':!![]}]});}})[_0x92a3('0x22')](function(_0x194c21){if(_0x194c21&&_0x194c21['Smtp']&&_0x41e9dd[_0x92a3('0xda')]){var _0x3722e8={'tls':{'rejectUnauthorized':![]}};if(_0x194c21[_0x92a3('0xd9')][_0x92a3('0xdb')]){_0x3722e8[_0x92a3('0xdb')]=_0x194c21['Smtp']['service'];}else{_0x3722e8[_0x92a3('0xdc')]=_0x194c21[_0x92a3('0xd9')]['host'];_0x3722e8[_0x92a3('0xdd')]=_0x194c21['Smtp'][_0x92a3('0xdd')];_0x3722e8[_0x92a3('0xde')]=_0x194c21[_0x92a3('0xd9')][_0x92a3('0xde')];}if(_0x194c21[_0x92a3('0xd9')][_0x92a3('0xdf')]){_0x3722e8[_0x92a3('0xe0')]={'user':_0x194c21[_0x92a3('0xd9')][_0x92a3('0x5f')],'pass':_0x194c21[_0x92a3('0xd9')][_0x92a3('0xe1')]};}return respondWithRpcPromise(_0x92a3('0xe2'),_0x92a3('0xe3'),{'account':_0x3722e8,'message':{'from':util[_0x92a3('0xb3')](_0x92a3('0xe4'),_0x194c21[_0x92a3('0x3a')],_0x194c21[_0x92a3('0xe5')]||_0x194c21[_0x92a3('0xd9')][_0x92a3('0x5f')]),'to':_0x41e9dd['forwardOfflineAddress'],'subject':_0x41e9dd[_0x92a3('0xe6')],'text':_0x10993d[_0x92a3('0x5e')]}},client9003)[_0x92a3('0x22')](function(){return _0x10993d;})[_0x92a3('0x5c')](function(_0x28fc20){console[_0x92a3('0x27')](_0x28fc20);});}})['then'](function(){if(_0x10993d){return _0x10993d;}})[_0x92a3('0x22')](respondWithResult(_0x1d4405,null))[_0x92a3('0x5c')](handleError(_0x1d4405,null));};exports[_0x92a3('0xe7')]=function(_0x8dce3c,_0x3be2a4,_0x3a2ad3){return db['ChatInteraction'][_0x92a3('0x67')]({'where':{'id':_0x8dce3c[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3be2a4,null))[_0x92a3('0x22')](function(_0x4039ee){if(_0x4039ee){return _0x4039ee[_0x92a3('0xe7')](_0x8dce3c['body'][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0x8dce3c[_0x92a3('0x5e')],['ids','id'])||{});}})[_0x92a3('0x22')](respondWithResult(_0x3be2a4,null))[_0x92a3('0x5c')](handleError(_0x3be2a4,null));};exports['getInteractions']=function(_0x48a74e,_0x3b681c,_0x4421a5){var _0x271b44={'raw':![],'where':{}};var _0x1e09f6={};var _0x44bc72={'count':0x0,'rows':[]};return db[_0x92a3('0x53')][_0x92a3('0x72')]({'where':{'id':_0x48a74e[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b681c,null))[_0x92a3('0x22')](function(_0x16f86d){if(_0x16f86d){_0x1e09f6['model']=_[_0x92a3('0x44')](db['ChatInteraction'][_0x92a3('0x3f')]);_0x1e09f6[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x48a74e[_0x92a3('0x43')]);_0x1e09f6[_0x92a3('0x4d')]=_['intersection'](_0x1e09f6['model'],_0x1e09f6[_0x92a3('0x43')]);_0x271b44[_0x92a3('0x47')]=_['intersection'](_0x1e09f6[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x48a74e[_0x92a3('0x43')][_0x92a3('0x46')]));_0x271b44[_0x92a3('0x47')]=_0x271b44[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x271b44[_0x92a3('0x47')]:_0x1e09f6[_0x92a3('0x42')];if(!_0x48a74e[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x271b44[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x48a74e[_0x92a3('0x43')]['limit']);_0x271b44[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x48a74e[_0x92a3('0x43')][_0x92a3('0x30')]);}_0x271b44[_0x92a3('0x4a')]=qs['sort'](_0x48a74e[_0x92a3('0x43')]['sort']);_0x271b44['where']=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x48a74e[_0x92a3('0x43')],_0x1e09f6['filters']));_0x271b44['where'][_0x92a3('0x6a')]=_0x16f86d['id'];if(_0x48a74e[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x271b44[_0x92a3('0x4c')]=_['merge'](_0x271b44[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x271b44[_0x92a3('0x47')],function(_0x4a4c6b){var _0x3bea48={};_0x3bea48[_0x4a4c6b]={'$like':'%'+_0x48a74e[_0x92a3('0x43')]['filter']+'%'};return _0x3bea48;})});}_0x271b44=_[_0x92a3('0x50')]({},_0x271b44,_0x48a74e[_0x92a3('0x52')]);return db[_0x92a3('0xba')][_0x92a3('0x6d')]({'where':_0x271b44[_0x92a3('0x4c')]})['then'](function(_0x384112){_0x44bc72[_0x92a3('0x6d')]=_0x384112;if(_0x48a74e[_0x92a3('0x43')]['includeAll']){_0x271b44[_0x92a3('0x55')]=[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0xe9'),'required':![]},{'model':db['User'],'as':_0x92a3('0xea'),'attributes':[_0x92a3('0x3a'),_0x92a3('0xeb'),_0x92a3('0xec')],'required':![]},{'model':db[_0x92a3('0xed')],'as':_0x92a3('0xee'),'attributes':['id',_0x92a3('0x3a'),_0x92a3('0xef')],'where':_0x48a74e[_0x92a3('0x43')]['tag']?{'id':_0x48a74e[_0x92a3('0x43')][_0x92a3('0xf0')]}:undefined,'required':_0x48a74e[_0x92a3('0x43')][_0x92a3('0xf0')]?!![]:![]}];}return db[_0x92a3('0xba')][_0x92a3('0x56')](_0x271b44);})[_0x92a3('0x22')](function(_0x1e68f0){_0x44bc72[_0x92a3('0x57')]=_0x1e68f0;return _0x44bc72;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x3b681c,_0x271b44))[_0x92a3('0x5c')](handleError(_0x3b681c,null));};function iftimePromise(_0x1c8219,_0x2d6c49){return respondWithRpcPromise(_0x92a3('0xf1'),_0x92a3('0xf2'),{'command':_0x2d6c49[_0x92a3('0xf3')]?util[_0x92a3('0xb3')](_0x92a3('0xf4'),_0x1c8219[_0x92a3('0xf5')],_0x2d6c49[_0x92a3('0xf3')]):util[_0x92a3('0xb3')](_0x92a3('0xf6'),_0x1c8219[_0x92a3('0xf5')])},client9002)[_0x92a3('0x22')](function(_0x1e49fc){var _0x2378c8=_0x1e49fc&&_0x1e49fc['indexOf']('true')>=0x0?!![]:![];logger[_0x92a3('0x23')](_0x92a3('0xf7'),_0x2d6c49['id'],_0x1c8219['id'],_0x1c8219[_0x92a3('0xf5')],_0x2378c8?_0x92a3('0xf8'):_0x92a3('0xf9'),_0x2d6c49[_0x92a3('0xf3')]?_0x2d6c49[_0x92a3('0xf3')]:_0x92a3('0xfa'));return _0x2378c8;})[_0x92a3('0x5c')](function(_0x1b1cd3){logger[_0x92a3('0x27')](_0x92a3('0xf7'),_0x2d6c49['id'],_0x1c8219['id'],_0x1c8219[_0x92a3('0xf5')],util['inspect'](_0x1b1cd3,{'showHidden':![],'depth':null}),_0x2d6c49[_0x92a3('0xf3')]?_0x2d6c49[_0x92a3('0xf3')]:_0x92a3('0xfa'));return![];});}exports[_0x92a3('0xf2')]=function(_0x185a11,_0xf98a95,_0x24782a){var _0x4213a5=0x0;var _0x33d121=0x0;var _0x1f0035=![];var _0x4956ab;var _0x55f5a0;return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0x185a11[_0x92a3('0x59')]['id']},'include':[{'model':db[_0x92a3('0xfb')],'as':'Interval','include':[{'model':db[_0x92a3('0xfb')],'as':_0x92a3('0xfc'),'attributes':['id',_0x92a3('0xf5')],'raw':!![]}]}]})[_0x92a3('0x22')](handleEntityNotFound(_0xf98a95,null))[_0x92a3('0x22')](function(_0x232dc7){if(_0x232dc7){_0x4956ab=_0x232dc7;return _0x232dc7[_0x92a3('0xfd')]({'raw':!![]});}})[_0x92a3('0x22')](function(_0x40ecd8){if(_0x4956ab){if(_0x40ecd8){_0x55f5a0=_0x40ecd8;}}return require(_0x92a3('0x81'))[_0x92a3('0x82')]();})['then'](function(_0x1cb624){if(_0x1cb624){_0x33d121=_0x1cb624[_0x92a3('0xfe')];_0x1f0035=_0x1cb624['custom'];}})[_0x92a3('0x22')](function(){return db['ChatInteraction'][_0x92a3('0x6d')]({'where':{'closed':![]}});})['then'](function(_0x4db8e3){_0x4213a5=_0x4db8e3;if(_0x33d121&&_0x4db8e3>_0x33d121){return db[_0x92a3('0xff')]['findOne']({'where':{'id':0x1}})[_0x92a3('0x22')](function(_0x5dc51e){if(_0x5dc51e){_0x5dc51e[_0x92a3('0x100')](_0x92a3('0x101'));}});}})[_0x92a3('0x22')](function(){if(_0x4956ab[_0x92a3('0xfb')]&&_0x4956ab['Interval'][_0x92a3('0xfc')]){var _0x2da61d=[];for(var _0x4731c0=0x0;_0x4731c0<_0x4956ab[_0x92a3('0xfb')]['Intervals'][_0x92a3('0x5b')];_0x4731c0++){var _0x3be4d1=_0x4956ab['Interval'][_0x92a3('0xfc')][_0x4731c0]['get']({'plain':!![]});_0x2da61d['push'](iftimePromise(_0x3be4d1,_0x4956ab));}return BPromise[_0x92a3('0x102')](_0x2da61d)[_0x92a3('0x22')](function(_0x6120df){return _[_0x92a3('0x103')](_0x6120df);});}else{return!![];}})['then'](function(_0x59c31c){var _0x54a154=fs[_0x92a3('0xd3')](path[_0x92a3('0x7d')](config[_0x92a3('0x7e')],_0x92a3('0x104')),_0x92a3('0xd4'));var _0x5ce53d={'remote':_0x4956ab[_0x92a3('0x105')],'query':querystring[_0x92a3('0x26')](_['merge'](_0x4956ab[_0x92a3('0x60')]({'plain':!![]}),{'customerIp':_0x185a11[_0x92a3('0xa9')][_0x92a3('0x106')]||_0x185a11[_0x92a3('0xa9')][_0x92a3('0x107')]||_0x185a11['connection']['remoteAddress']||_0x185a11['ip'],'referer':_0x185a11['headers']['referer'],'openedInteractions':_0x4213a5,'maxInteractions':_0x33d121,'virtual':_0x1f0035[_0x92a3('0xfe')],'online':_0x59c31c,'custom':_0x1f0035}))[_0x92a3('0x108')](/'/g,'\x5c\x27')};_0xf98a95[_0x92a3('0x3b')](ejs['render'](Mustache[_0x92a3('0xd5')](_0x54a154,_0x5ce53d),{'proactiveActions':_0x55f5a0,'alignment':_0x4956ab[_0x92a3('0x109')],'verticalAlignment':_0x4956ab[_0x92a3('0x10a')],'div_color':_0x4956ab[_0x92a3('0xef')],'text_color':_0x4956ab['textColor']}));})[_0x92a3('0x5c')](handleError(_0xf98a95,null));};exports[_0x92a3('0x10b')]=function(_0x3eafbb,_0x440db8,_0x902af8){return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x3eafbb['params']['id']}})['then'](handleEntityNotFound(_0x440db8,null))['then'](function(_0x4d1f1e){if(_0x4d1f1e){return db[_0x92a3('0x10c')][_0x92a3('0x10d')](function(_0x1229ec){return db[_0x92a3('0x10e')][_0x92a3('0x36')]({'where':{'ChatWebsiteId':_0x3eafbb[_0x92a3('0x59')]['id']},'transaction':_0x1229ec})[_0x92a3('0x22')](function(_0x5c9cd4){var _0x223fd2=_['map'](_0x3eafbb[_0x92a3('0x5e')],function(_0x1be8c4){_0x1be8c4['ChatWebsiteId']=_0x3eafbb[_0x92a3('0x59')]['id'];return _0x1be8c4;});return db[_0x92a3('0x10e')]['bulkCreate'](_0x223fd2,{'transaction':_0x1229ec});});})[_0x92a3('0x22')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x3eafbb[_0x92a3('0x59')]['id']},'order':_0x92a3('0xa4')});});}})[_0x92a3('0x22')](respondWithResult(_0x440db8,null))['catch'](handleError(_0x440db8,null));};exports[_0x92a3('0x10f')]=function(_0x20127b,_0xc6bdc0,_0x111c5a){var _0xfc3252={};var _0x32f9af={};var _0x5cf51c;var _0x261bbd;return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x20127b[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0xc6bdc0,null))[_0x92a3('0x22')](function(_0x198d72){if(_0x198d72){_0x5cf51c=_0x198d72;_0x32f9af[_0x92a3('0x42')]=_['keys'](db[_0x92a3('0x10e')][_0x92a3('0x3f')]);_0x32f9af['query']=_[_0x92a3('0x44')](_0x20127b['query']);_0x32f9af[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x32f9af['model'],_0x32f9af['query']);_0xfc3252[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x32f9af[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x20127b['query'][_0x92a3('0x46')]));_0xfc3252[_0x92a3('0x47')]=_0xfc3252[_0x92a3('0x47')][_0x92a3('0x5b')]?_0xfc3252[_0x92a3('0x47')]:_0x32f9af['model'];_0xfc3252[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x20127b[_0x92a3('0x43')][_0x92a3('0x4b')]);_0xfc3252[_0x92a3('0x4c')]=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x20127b[_0x92a3('0x43')],_0x32f9af[_0x92a3('0x4d')]));if(_0x20127b['query']['filter']){_0xfc3252[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0xfc3252['where'],{'$or':_[_0x92a3('0x3e')](_0xfc3252[_0x92a3('0x47')],function(_0x5761d4){var _0x45918d={};_0x45918d[_0x5761d4]={'$like':'%'+_0x20127b[_0x92a3('0x43')]['filter']+'%'};return _0x45918d;})});}_0xfc3252=_[_0x92a3('0x50')]({},_0xfc3252,_0x20127b['options']);return _0x5cf51c['getApplications'](_0xfc3252);}})['then'](function(_0x1011b2){if(_0x1011b2){_0x261bbd=_0x1011b2[_0x92a3('0x5b')];if(!_0x20127b[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0xfc3252[_0x92a3('0x31')]=qs['limit'](_0x20127b['query'][_0x92a3('0x31')]);_0xfc3252[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x20127b[_0x92a3('0x43')]['offset']);}return _0x5cf51c[_0x92a3('0x10f')](_0xfc3252);}})['then'](function(_0xbaec2f){if(_0xbaec2f){return _0xbaec2f?{'count':_0x261bbd,'rows':_0xbaec2f}:null;}})[_0x92a3('0x22')](respondWithResult(_0xc6bdc0,null))[_0x92a3('0x5c')](handleError(_0xc6bdc0,null));};exports['addProactiveActions']=function(_0x327058,_0x3e1c18,_0x33b7c3){return db['chatProactiveAction']['find']({'where':{'id':_0x327058[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3e1c18,null))[_0x92a3('0x22')](function(_0x9a6b55){if(_0x9a6b55){return _0x9a6b55[_0x92a3('0x110')](_0x327058['body'][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0x327058[_0x92a3('0x5e')],[_0x92a3('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x3e1c18,null))[_0x92a3('0x5c')](handleError(_0x3e1c18,null));};exports[_0x92a3('0xfd')]=function(_0x2c3cde,_0x33e7ac,_0x20d4c9){var _0x3bd0d4={};var _0x322061={};var _0x54b44d;var _0x327b1b;return db[_0x92a3('0x53')]['findOne']({'where':{'id':_0x2c3cde[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x33e7ac,null))[_0x92a3('0x22')](function(_0xac3c0c){if(_0xac3c0c){_0x54b44d=_0xac3c0c;_0x322061['model']=_[_0x92a3('0x44')](db[_0x92a3('0x111')][_0x92a3('0x3f')]);_0x322061[_0x92a3('0x43')]=_['keys'](_0x2c3cde['query']);_0x322061[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x322061[_0x92a3('0x42')],_0x322061[_0x92a3('0x43')]);_0x3bd0d4[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x322061[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x46')]));_0x3bd0d4[_0x92a3('0x47')]=_0x3bd0d4[_0x92a3('0x47')]['length']?_0x3bd0d4[_0x92a3('0x47')]:_0x322061[_0x92a3('0x42')];_0x3bd0d4[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x2c3cde[_0x92a3('0x43')]['sort']);_0x3bd0d4[_0x92a3('0x4c')]=qs['filters'](_[_0x92a3('0x4e')](_0x2c3cde[_0x92a3('0x43')],_0x322061[_0x92a3('0x4d')]));if(_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x3bd0d4[_0x92a3('0x4c')]=_[_0x92a3('0x50')](_0x3bd0d4[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x3bd0d4[_0x92a3('0x47')],function(_0x4d2dab){var _0x4519f4={};_0x4519f4[_0x4d2dab]={'$like':'%'+_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x4519f4;})});}_0x3bd0d4=_[_0x92a3('0x50')]({},_0x3bd0d4,_0x2c3cde['options']);return _0x54b44d[_0x92a3('0xfd')](_0x3bd0d4);}})[_0x92a3('0x22')](function(_0x230d33){if(_0x230d33){_0x327b1b=_0x230d33[_0x92a3('0x5b')];if(!_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x48')](_0x92a3('0x49'))){_0x3bd0d4[_0x92a3('0x31')]=qs['limit'](_0x2c3cde['query']['limit']);_0x3bd0d4['offset']=qs[_0x92a3('0x30')](_0x2c3cde[_0x92a3('0x43')][_0x92a3('0x30')]);}return _0x54b44d['getProactiveActions'](_0x3bd0d4);}})[_0x92a3('0x22')](function(_0x5a2cc6){if(_0x5a2cc6){return _0x5a2cc6?{'count':_0x327b1b,'rows':_0x5a2cc6}:null;}})[_0x92a3('0x22')](respondWithResult(_0x33e7ac,null))[_0x92a3('0x5c')](handleError(_0x33e7ac,null));};exports[_0x92a3('0x112')]=function(_0x19c59c,_0x17932c,_0x3b8bc0){var _0x1e03fd=_0x19c59c[_0x92a3('0x43')][_0x92a3('0x113')]==='false'?_0x92a3('0x114'):_0x92a3('0x115');return db[_0x92a3('0x53')][_0x92a3('0x67')]({'attributes':['id',_0x1e03fd],'where':{'id':_0x19c59c[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x17932c,null))[_0x92a3('0x22')](function(_0x38c22d){if(_0x38c22d){var _0x3b80e4=_0x38c22d[_0x1e03fd];var _0x34aceb=_0x3b80e4&&_0x3b80e4[_0x92a3('0x116')]?_0x3b80e4[_0x92a3('0x116')]:[];_0x17932c['send']({'fromKey':_[_0x92a3('0x83')](_0x3b80e4[_0x92a3('0x117')])?undefined:_0x3b80e4[_0x92a3('0x117')],'count':_0x34aceb[_0x92a3('0x5b')],'rows':_0x34aceb});}})[_0x92a3('0x5c')](handleError(_0x17932c,null));};exports[_0x92a3('0x118')]=function(_0x59dc06,_0x35e2db,_0x18b3dd){var _0x2e3f31={'raw':![],'where':{}};var _0x11071e={};var _0x18b83f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92a3('0x72')]({'where':{'id':_0x59dc06[_0x92a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x35e2db,null))[_0x92a3('0x22')](function(_0x444812){if(_0x444812){_0x11071e['model']=_[_0x92a3('0x44')](db[_0x92a3('0xd7')][_0x92a3('0x3f')]);_0x11071e['query']=_[_0x92a3('0x44')](_0x59dc06[_0x92a3('0x43')]);_0x11071e[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x11071e[_0x92a3('0x42')],_0x11071e[_0x92a3('0x43')]);_0x2e3f31[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x11071e[_0x92a3('0x42')],qs['fields'](_0x59dc06['query'][_0x92a3('0x46')]));_0x2e3f31['attributes']=_0x2e3f31[_0x92a3('0x47')]['length']?_0x2e3f31[_0x92a3('0x47')]:_0x11071e['model'];if(!_0x59dc06['query']['hasOwnProperty'](_0x92a3('0x49'))){_0x2e3f31[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x59dc06[_0x92a3('0x43')][_0x92a3('0x31')]);_0x2e3f31[_0x92a3('0x30')]=qs['offset'](_0x59dc06['query'][_0x92a3('0x30')]);}_0x2e3f31[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x59dc06['query'][_0x92a3('0x4b')]);_0x2e3f31['where']=qs[_0x92a3('0x4d')](_[_0x92a3('0x4e')](_0x59dc06['query'],_0x11071e[_0x92a3('0x4d')]));_0x2e3f31[_0x92a3('0x4c')][_0x92a3('0x6a')]=_0x444812['id'];if(_0x59dc06['query'][_0x92a3('0x4f')]){_0x2e3f31['where']=_[_0x92a3('0x50')](_0x2e3f31[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x2e3f31[_0x92a3('0x47')],function(_0x3a4954){var _0x2469db={};_0x2469db[_0x3a4954]={'$like':'%'+_0x59dc06[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x2469db;})});}_0x2e3f31=_[_0x92a3('0x50')]({},_0x2e3f31,_0x59dc06['options']);return db['ChatOfflineMessage']['count']({'where':_0x2e3f31['where']})[_0x92a3('0x22')](function(_0x34cf4c){_0x18b83f['count']=_0x34cf4c;if(_0x59dc06[_0x92a3('0x43')][_0x92a3('0x54')]){_0x2e3f31[_0x92a3('0x55')]=[{'all':!![]}];}else{_0x2e3f31[_0x92a3('0x55')]=[{'model':db[_0x92a3('0x9d')],'as':_0x92a3('0xe9'),'required':![]}];}return db[_0x92a3('0xd7')]['findAll'](_0x2e3f31);})['then'](function(_0x1b0ea8){_0x18b83f[_0x92a3('0x57')]=_0x1b0ea8;return _0x18b83f;});}})[_0x92a3('0x22')](respondWithFilteredResult(_0x35e2db,_0x2e3f31))[_0x92a3('0x5c')](handleError(_0x35e2db,null));};exports[_0x92a3('0x119')]=function(_0xcaa309,_0x1ae0c5,_0xf5e1a4){return db[_0x92a3('0x53')][_0x92a3('0x67')]({'where':{'id':_0xcaa309[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x1ae0c5,null))[_0x92a3('0x22')](function(_0x456952){if(_0x456952){return _0x456952['addAgents'](_0xcaa309[_0x92a3('0x5e')][_0x92a3('0x6f')],_[_0x92a3('0xe8')](_0xcaa309[_0x92a3('0x5e')],['ids','id'])||{})[_0x92a3('0xbd')](function(_0x4118f9){for(var _0x2fb61e=0x0;_0x2fb61e<_0xcaa309[_0x92a3('0x5e')]['ids'][_0x92a3('0x5b')];_0x2fb61e+=0x1){socket[_0x92a3('0x11a')](_0x92a3('0x11b'),{'UserId':_0xcaa309[_0x92a3('0x5e')]['ids'][_0x2fb61e],'ChatWebsiteId':_0xcaa309[_0x92a3('0x59')]['id']});}return _0x4118f9;});}})[_0x92a3('0x22')](respondWithResult(_0x1ae0c5,null))[_0x92a3('0x5c')](handleError(_0x1ae0c5,null));};exports[_0x92a3('0x11c')]=function(_0x42191d,_0x3804e3,_0x3c68c0){return db[_0x92a3('0x53')]['find']({'where':{'id':_0x42191d['params']['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x3804e3,null))[_0x92a3('0x22')](function(_0x251da0){if(_0x251da0){return _0x251da0[_0x92a3('0x11c')](_0x42191d['query'][_0x92a3('0x6f')])[_0x92a3('0x22')](function(){if(_[_0x92a3('0x11d')](_0x42191d[_0x92a3('0x43')][_0x92a3('0x6f')])){for(var _0x53b00b=0x0;_0x53b00b<_0x42191d['query'][_0x92a3('0x6f')][_0x92a3('0x5b')];_0x53b00b+=0x1){socket[_0x92a3('0x11a')](_0x92a3('0x11e'),{'UserId':Number(_0x42191d[_0x92a3('0x43')][_0x92a3('0x6f')][_0x53b00b]),'ChatWebsiteId':Number(_0x42191d['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x42191d[_0x92a3('0x43')]['ids']),'ChatWebsiteId':Number(_0x42191d[_0x92a3('0x59')]['id'])});}});}})[_0x92a3('0x22')](respondWithStatusCode(_0x3804e3,null))[_0x92a3('0x5c')](handleError(_0x3804e3,null));};exports['getAgents']=function(_0x5cf0a7,_0x211359,_0x2a3f92){var _0x38f339={};var _0x1551bf={};var _0xfceac4;var _0x159e09;return db[_0x92a3('0x53')][_0x92a3('0x72')]({'where':{'id':_0x5cf0a7[_0x92a3('0x59')]['id']}})[_0x92a3('0x22')](handleEntityNotFound(_0x211359,null))['then'](function(_0x240b8e){if(_0x240b8e){_0xfceac4=_0x240b8e;_0x1551bf[_0x92a3('0x42')]=_[_0x92a3('0x44')](db['User'][_0x92a3('0x3f')]);_0x1551bf[_0x92a3('0x43')]=_[_0x92a3('0x44')](_0x5cf0a7[_0x92a3('0x43')]);_0x1551bf[_0x92a3('0x4d')]=_[_0x92a3('0x45')](_0x1551bf[_0x92a3('0x42')],_0x1551bf['query']);_0x38f339[_0x92a3('0x47')]=_[_0x92a3('0x45')](_0x1551bf[_0x92a3('0x42')],qs[_0x92a3('0x46')](_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x46')]));_0x38f339[_0x92a3('0x47')]=_0x38f339[_0x92a3('0x47')][_0x92a3('0x5b')]?_0x38f339[_0x92a3('0x47')]:_0x1551bf['model'];_0x38f339[_0x92a3('0x4a')]=qs[_0x92a3('0x4b')](_0x5cf0a7['query']['sort']);_0x38f339['where']=qs[_0x92a3('0x4d')](_['pick'](_0x5cf0a7[_0x92a3('0x43')],_0x1551bf[_0x92a3('0x4d')]));if(_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x4f')]){_0x38f339['where']=_['merge'](_0x38f339[_0x92a3('0x4c')],{'$or':_[_0x92a3('0x3e')](_0x38f339[_0x92a3('0x47')],function(_0x3db138){var _0x14c2cb={};_0x14c2cb[_0x3db138]={'$like':'%'+_0x5cf0a7[_0x92a3('0x43')][_0x92a3('0x4f')]+'%'};return _0x14c2cb;})});}_0x38f339=_['merge']({},_0x38f339,_0x5cf0a7[_0x92a3('0x52')]);return _0xfceac4[_0x92a3('0x11f')](_0x38f339);}})[_0x92a3('0x22')](function(_0x42e73b){if(_0x42e73b){_0x159e09=_0x42e73b[_0x92a3('0x5b')];if(!_0x5cf0a7['query'][_0x92a3('0x48')](_0x92a3('0x49'))){_0x38f339[_0x92a3('0x31')]=qs[_0x92a3('0x31')](_0x5cf0a7['query'][_0x92a3('0x31')]);_0x38f339[_0x92a3('0x30')]=qs[_0x92a3('0x30')](_0x5cf0a7['query'][_0x92a3('0x30')]);}return _0xfceac4[_0x92a3('0x11f')](_0x38f339);}})[_0x92a3('0x22')](function(_0x524238){if(_0x524238){return _0x524238?{'count':_0x159e09,'rows':_0x524238}:null;}})[_0x92a3('0x22')](respondWithResult(_0x211359,null))[_0x92a3('0x5c')](handleError(_0x211359,null));}; \ No newline at end of file +var _0x718e=['Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','filename','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','sitepic','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','headers','chat','CmContact','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','List','account','applications','list','asc','Applications','cf-connecting-ip','x-forwarded-for','x-real-port','referer','browser','%s\x20%s','version','unknown','device','vendor','format','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','firstName','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','some','server/files/chat/iframe.js','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../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','./chatWebsite.socket','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','get','ChatWebsites','UserProfileResource','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','rawAttributes','filters','includeAll','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','ChatWebsiteId'];(function(_0x1786ab,_0x2dbb7c){var _0x25f463=function(_0x176a73){while(--_0x176a73){_0x1786ab['push'](_0x1786ab['shift']());}};_0x25f463(++_0x2dbb7c);}(_0x718e,0x1d4));var _0xe718=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x718e[_0x117821];return _0x4ae9ff;};'use strict';var pdf=require(_0xe718('0x0'));var emlformat=require(_0xe718('0x1'));var rimraf=require(_0xe718('0x2'));var zipdir=require(_0xe718('0x3'));var jsonpatch=require(_0xe718('0x4'));var rp=require(_0xe718('0x5'));var moment=require(_0xe718('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe718('0x7'));var path=require(_0xe718('0x8'));var sox=require(_0xe718('0x9'));var csv=require(_0xe718('0xa'));var ejs=require(_0xe718('0xb'));var fs=require('fs');var _=require(_0xe718('0xc'));var squel=require(_0xe718('0xd'));var crypto=require(_0xe718('0xe'));var jsforce=require(_0xe718('0xf'));var deskjs=require(_0xe718('0x10'));var toCsv=require(_0xe718('0xa'));var querystring=require('querystring');var Papa=require(_0xe718('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe718('0x12'));var as=require(_0xe718('0x13'));var hardwareService=require(_0xe718('0x14'));var logger=require(_0xe718('0x15'))(_0xe718('0x16'));var utils=require(_0xe718('0x17'));var config=require(_0xe718('0x18'));var licenseUtil=require(_0xe718('0x19'));var db=require(_0xe718('0x1a'))['db'];config['redis']=_[_0xe718('0x1b')](config[_0xe718('0x1c')],{'host':_0xe718('0x1d'),'port':0x18eb});var socket=require(_0xe718('0x1e'))(new Redis(config['redis']));require(_0xe718('0x1f'))[_0xe718('0x20')](socket);var jayson=require(_0xe718('0x21'));var client=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232c});var client9002=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232a});var client9003=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x1a8352,_0x271c07,_0x55b376,_0x30e5c5){return new BPromise(function(_0x209a61,_0x1fe9f4){var _0x2a9a78=_0x30e5c5||client;return _0x2a9a78[_0xe718('0x24')](_0x1a8352,_0x55b376)['then'](function(_0x1fe942){logger[_0xe718('0x25')](_0xe718('0x26'),_0x271c07,'request\x20sent');logger[_0xe718('0x27')](_0xe718('0x28'),_0x271c07,_0xe718('0x29'),JSON[_0xe718('0x2a')](_0x1fe942));if(_0x1fe942[_0xe718('0x2b')]){if(_0x1fe942[_0xe718('0x2b')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x271c07,_0x1fe942[_0xe718('0x2b')][_0xe718('0x2c')]);return _0x1fe9f4(_0x1fe942[_0xe718('0x2b')]['message']);}logger[_0xe718('0x2b')](_0xe718('0x26'),_0x271c07,_0x1fe942[_0xe718('0x2b')]['message']);return _0x209a61(_0x1fe942[_0xe718('0x2b')][_0xe718('0x2c')]);}else{logger[_0xe718('0x25')](_0xe718('0x26'),_0x271c07,_0xe718('0x29'));_0x209a61(_0x1fe942[_0xe718('0x2d')][_0xe718('0x2c')]);}})[_0xe718('0x2e')](function(_0x5a00db){logger[_0xe718('0x2b')](_0xe718('0x26'),_0x271c07,_0x5a00db);_0x1fe9f4(_0x5a00db);});});}function respondWithStatusCode(_0x496ad1,_0x4933f5){_0x4933f5=_0x4933f5||0xcc;return function(_0x4828cd){if(_0x4828cd){return _0x496ad1[_0xe718('0x2f')](_0x4933f5);}return _0x496ad1[_0xe718('0x30')](_0x4933f5)['end']();};}function respondWithResult(_0x48c5cc,_0x4a6318){_0x4a6318=_0x4a6318||0xc8;return function(_0x466cd7){if(_0x466cd7){return _0x48c5cc[_0xe718('0x30')](_0x4a6318)[_0xe718('0x31')](_0x466cd7);}};}function respondWithFilteredResult(_0x5270ca,_0x119c3d){return function(_0x291fa9){if(_0x291fa9){var _0x21d534=_0x291fa9['count'],_0x123bb7=_0x119c3d[_0xe718('0x32')],_0x155f2c=_0x119c3d[_0xe718('0x32')]+_0x119c3d[_0xe718('0x33')],_0x3d5714;if(_0x155f2c>=_0x21d534){_0x155f2c=_0x21d534;_0x3d5714=0xc8;}else{_0x3d5714=0xce;}_0x5270ca['status'](_0x3d5714);return _0x5270ca['set'](_0xe718('0x34'),_0x123bb7+'-'+_0x155f2c+'/'+_0x21d534)[_0xe718('0x31')](_0x291fa9);}return null;};}function patchUpdates(_0x3d00b7){return function(_0x4852b3){try{jsonpatch['apply'](_0x4852b3,_0x3d00b7,!![]);}catch(_0x233acf){return BPromise[_0xe718('0x35')](_0x233acf);}return _0x4852b3[_0xe718('0x36')]();};}function saveUpdates(_0x51984a,_0x4ec900){return function(_0x42ce34){if(_0x42ce34){return _0x42ce34[_0xe718('0x37')](_0x51984a)[_0xe718('0x38')](function(_0x133d27){return _0x133d27;});}return null;};}function removeEntity(_0x4ca928,_0x2f67d7){return function(_0x3a6230){if(_0x3a6230){return _0x3a6230['destroy']()[_0xe718('0x38')](function(){var _0x25cdab=_0x3a6230[_0xe718('0x39')]({'plain':!![]});var _0x2ad577=_0xe718('0x3a');return db[_0xe718('0x3b')][_0xe718('0x3c')]({'where':{'type':_0x2ad577,'resourceId':_0x25cdab['id']}})[_0xe718('0x38')](function(){return _0x3a6230;});})[_0xe718('0x38')](function(){_0x4ca928[_0xe718('0x30')](0xcc)[_0xe718('0x3d')]();});}};}function handleEntityNotFound(_0x39dde8,_0xc7dbe1){return function(_0x58f2bd){if(!_0x58f2bd){_0x39dde8[_0xe718('0x2f')](0x194);}return _0x58f2bd;};}function handleError(_0x380e90,_0x565b90){_0x565b90=_0x565b90||0x1f4;return function(_0x40bf2e){logger[_0xe718('0x2b')](_0x40bf2e[_0xe718('0x3e')]);if(_0x40bf2e[_0xe718('0x3f')]){delete _0x40bf2e[_0xe718('0x3f')];}_0x380e90[_0xe718('0x30')](_0x565b90)[_0xe718('0x40')](_0x40bf2e);};}exports['index']=function(_0x54f9f3,_0xc6c2db){var _0x2c473f={'include':[{'model':db[_0xe718('0x41')],'as':_0xe718('0x42')}]},_0x11d2f3={},_0x4dbec5={'count':0x0,'rows':[]};var _0x48e4f0=_[_0xe718('0x43')](db[_0xe718('0x44')]['rawAttributes'],function(_0x33f189){return{'name':_0x33f189[_0xe718('0x45')],'type':_0x33f189['type'][_0xe718('0x46')]};});_0x11d2f3[_0xe718('0x47')]=_['map'](_0x48e4f0,_0xe718('0x3f'));_0x11d2f3[_0xe718('0x48')]=_[_0xe718('0x49')](_0x54f9f3[_0xe718('0x48')]);_0x11d2f3['filters']=_['intersection'](_0x11d2f3[_0xe718('0x47')],_0x11d2f3[_0xe718('0x48')]);_0x2c473f[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x11d2f3[_0xe718('0x47')],qs['fields'](_0x54f9f3[_0xe718('0x48')][_0xe718('0x4c')]));_0x2c473f['attributes']=_0x2c473f[_0xe718('0x4a')][_0xe718('0x4d')]?_0x2c473f[_0xe718('0x4a')]:_0x11d2f3[_0xe718('0x47')];if(!_0x54f9f3['query'][_0xe718('0x4e')]('nolimit')){_0x2c473f[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x54f9f3['query'][_0xe718('0x33')]);_0x2c473f[_0xe718('0x32')]=qs['offset'](_0x54f9f3['query']['offset']);}_0x2c473f[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x54f9f3['query'][_0xe718('0x50')]);_0x2c473f[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x54f9f3[_0xe718('0x48')],_0x11d2f3['filters']),_0x48e4f0);if(_0x54f9f3['query'][_0xe718('0x53')]){_0x2c473f['where']=_[_0xe718('0x54')](_0x2c473f['where'],{'$or':_['map'](_0x48e4f0,function(_0x4ff4a7){if(_0x4ff4a7['type']!==_0xe718('0x55')){var _0x5e3d9a={};_0x5e3d9a[_0x4ff4a7[_0xe718('0x3f')]]={'$like':'%'+_0x54f9f3['query'][_0xe718('0x53')]+'%'};return _0x5e3d9a;}})});}_0x2c473f=_['merge']({},_0x2c473f,_0x54f9f3[_0xe718('0x56')]);var _0x96de2f={'where':_0x2c473f[_0xe718('0x51')]};return db['ChatWebsite'][_0xe718('0x57')](_0x96de2f)[_0xe718('0x38')](function(_0xba2192){_0x4dbec5[_0xe718('0x57')]=_0xba2192;if(_0x54f9f3[_0xe718('0x48')]['includeAll']){_0x2c473f[_0xe718('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0xe718('0x59')](_0x2c473f);})[_0xe718('0x38')](function(_0x30d1c0){_0x4dbec5['rows']=_0x30d1c0;return _0x4dbec5;})[_0xe718('0x38')](respondWithFilteredResult(_0xc6c2db,_0x2c473f))[_0xe718('0x2e')](handleError(_0xc6c2db,null));};exports[_0xe718('0x5a')]=function(_0x4c5850,_0x55e111){var _0x529130={'raw':![],'where':{'id':_0x4c5850[_0xe718('0x5b')]['id']},'include':[{'model':db[_0xe718('0x41')],'as':_0xe718('0x42')}]},_0x40cf2e={};_0x40cf2e[_0xe718('0x47')]=_[_0xe718('0x49')](db['ChatWebsite'][_0xe718('0x5c')]);_0x40cf2e[_0xe718('0x48')]=_[_0xe718('0x49')](_0x4c5850[_0xe718('0x48')]);_0x40cf2e[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x40cf2e[_0xe718('0x47')],_0x40cf2e[_0xe718('0x48')]);_0x529130[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x40cf2e['model'],qs['fields'](_0x4c5850[_0xe718('0x48')][_0xe718('0x4c')]));_0x529130['attributes']=_0x529130[_0xe718('0x4a')]['length']?_0x529130[_0xe718('0x4a')]:_0x40cf2e[_0xe718('0x47')];if(_0x4c5850[_0xe718('0x48')][_0xe718('0x5e')]){_0x529130['include']=[{'all':!![]}];}_0x529130=_[_0xe718('0x54')]({},_0x529130,_0x4c5850[_0xe718('0x56')]);return db['ChatWebsite'][_0xe718('0x5f')](_0x529130)[_0xe718('0x38')](handleEntityNotFound(_0x55e111,null))[_0xe718('0x38')](respondWithResult(_0x55e111,null))[_0xe718('0x2e')](handleError(_0x55e111,null));};exports['create']=function(_0x300191,_0x45ee96){return db[_0xe718('0x44')][_0xe718('0x60')](_0x300191[_0xe718('0x61')],{})[_0xe718('0x38')](function(_0x32d491){var _0x210c85=_0x300191[_0xe718('0x62')][_0xe718('0x39')]({'plain':!![]});if(!_0x210c85)throw new Error(_0xe718('0x63'));if(_0x210c85[_0xe718('0x64')]===_0xe718('0x62')){var _0x436390=_0x32d491[_0xe718('0x39')]({'plain':!![]});var _0x4e91fa=_0xe718('0x3a');return db[_0xe718('0x65')][_0xe718('0x5f')]({'where':{'name':_0x4e91fa,'userProfileId':_0x210c85[_0xe718('0x66')]},'raw':!![]})[_0xe718('0x38')](function(_0x38dda8){if(_0x38dda8&&_0x38dda8['autoAssociation']===0x0){return db[_0xe718('0x3b')][_0xe718('0x60')]({'name':_0x436390['name'],'resourceId':_0x436390['id'],'type':_0x38dda8[_0xe718('0x3f')],'sectionId':_0x38dda8['id']},{})[_0xe718('0x38')](function(){return _0x32d491;});}else{return _0x32d491;}})[_0xe718('0x2e')](function(_0x49a630){logger[_0xe718('0x2b')](_0xe718('0x67'),_0x49a630);throw _0x49a630;});}return _0x32d491;})['then'](respondWithResult(_0x45ee96,0xc9))['catch'](handleError(_0x45ee96,null));};exports[_0xe718('0x37')]=function(_0x48139e,_0xfd5d2f){if(_0x48139e['body']['id']){delete _0x48139e[_0xe718('0x61')]['id'];}return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x48139e[_0xe718('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe718('0x38')](handleEntityNotFound(_0xfd5d2f,null))[_0xe718('0x38')](saveUpdates(_0x48139e['body'],null))[_0xe718('0x38')](respondWithResult(_0xfd5d2f,null))[_0xe718('0x2e')](handleError(_0xfd5d2f,null));};exports[_0xe718('0x3c')]=function(_0x2a0319,_0x37e96c){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x2a0319[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x37e96c,null))[_0xe718('0x38')](removeEntity(_0x37e96c,null))[_0xe718('0x2e')](handleError(_0x37e96c,null));};exports[_0xe718('0x68')]=function(_0x388330,_0x26c8bd){return db[_0xe718('0x44')][_0xe718('0x68')]()[_0xe718('0x38')](respondWithResult(_0x26c8bd,null))[_0xe718('0x2e')](handleError(_0x26c8bd,null));};exports['addDisposition']=function(_0x27eb97,_0x2c1e53,_0x2530ef){if(_0x27eb97[_0xe718('0x61')]['id']){delete _0x27eb97['body']['id'];}return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x27eb97[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2c1e53,null))[_0xe718('0x38')](function(_0x1ea279){if(_0x1ea279){_0x27eb97[_0xe718('0x61')][_0xe718('0x69')]=_0x1ea279['id'];return db[_0xe718('0x6a')][_0xe718('0x60')](_0x27eb97[_0xe718('0x61')]);}})[_0xe718('0x38')](respondWithResult(_0x2c1e53,null))[_0xe718('0x2e')](handleError(_0x2c1e53,null));};exports[_0xe718('0x6b')]=function(_0x574e24,_0x473a05,_0x3742a0){var _0x43445f={'raw':![],'where':{}};var _0x44f182={};var _0x47e179={'count':0x0,'rows':[]};return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x574e24[_0xe718('0x5b')]['id']}})['then'](handleEntityNotFound(_0x473a05,null))[_0xe718('0x38')](function(_0x45bd1c){if(_0x45bd1c){_0x44f182['model']=_['keys'](db['Disposition']['rawAttributes']);_0x44f182['query']=_[_0xe718('0x49')](_0x574e24[_0xe718('0x48')]);_0x44f182['filters']=_['intersection'](_0x44f182[_0xe718('0x47')],_0x44f182[_0xe718('0x48')]);_0x43445f['attributes']=_['intersection'](_0x44f182['model'],qs[_0xe718('0x4c')](_0x574e24['query'][_0xe718('0x4c')]));_0x43445f[_0xe718('0x4a')]=_0x43445f['attributes'][_0xe718('0x4d')]?_0x43445f['attributes']:_0x44f182[_0xe718('0x47')];if(!_0x574e24[_0xe718('0x48')][_0xe718('0x4e')](_0xe718('0x6d'))){_0x43445f[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x574e24[_0xe718('0x48')][_0xe718('0x33')]);_0x43445f[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x574e24[_0xe718('0x48')][_0xe718('0x32')]);}_0x43445f['order']=qs[_0xe718('0x50')](_0x574e24[_0xe718('0x48')]['sort']);_0x43445f[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x574e24['query'],_0x44f182[_0xe718('0x5d')]));_0x43445f[_0xe718('0x51')][_0xe718('0x69')]=_0x45bd1c['id'];if(_0x574e24['query'][_0xe718('0x53')]){_0x43445f['where']=_['merge'](_0x43445f[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x43445f[_0xe718('0x4a')],function(_0x3a405e){var _0xe682fc={};_0xe682fc[_0x3a405e]={'$like':'%'+_0x574e24[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0xe682fc;})});}_0x43445f=_[_0xe718('0x54')]({},_0x43445f,_0x574e24['options']);return db[_0xe718('0x6a')]['count']({'where':_0x43445f[_0xe718('0x51')]})[_0xe718('0x38')](function(_0x4160b9){_0x47e179[_0xe718('0x57')]=_0x4160b9;if(_0x574e24[_0xe718('0x48')][_0xe718('0x5e')]){_0x43445f[_0xe718('0x58')]=[{'all':!![]}];}return db[_0xe718('0x6a')][_0xe718('0x59')](_0x43445f);})[_0xe718('0x38')](function(_0x3e7a4b){_0x47e179[_0xe718('0x6e')]=_0x3e7a4b;return _0x47e179;});}})['then'](respondWithFilteredResult(_0x473a05,_0x43445f))['catch'](handleError(_0x473a05,null));};exports[_0xe718('0x6f')]=function(_0x3ca2b6,_0x9904cd,_0x11628a){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x3ca2b6[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x9904cd,null))[_0xe718('0x38')](function(_0x499057){if(_0x499057){return _0x499057[_0xe718('0x6f')](_0x3ca2b6[_0xe718('0x48')][_0xe718('0x70')]);}})[_0xe718('0x38')](respondWithStatusCode(_0x9904cd,null))['catch'](handleError(_0x9904cd,null));};exports['addAnswer']=function(_0x4a0390,_0x23f7df,_0x17ad06){if(_0x4a0390[_0xe718('0x61')]['id']){delete _0x4a0390[_0xe718('0x61')]['id'];}return db['ChatWebsite'][_0xe718('0x5f')]({'where':{'id':_0x4a0390[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x23f7df,null))[_0xe718('0x38')](function(_0x90709b){if(_0x90709b){_0x4a0390[_0xe718('0x61')][_0xe718('0x69')]=_0x90709b['id'];return db['CannedAnswer']['create'](_0x4a0390[_0xe718('0x61')]);}})['then'](respondWithResult(_0x23f7df,null))['catch'](handleError(_0x23f7df,null));};exports[_0xe718('0x71')]=function(_0x13cf69,_0x3d80bb,_0x53e720){var _0x4d3e48={'raw':![],'where':{}};var _0x376f0f={};var _0x27a89e={'count':0x0,'rows':[]};return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x13cf69[_0xe718('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d80bb,null))['then'](function(_0x3f5a83){if(_0x3f5a83){_0x376f0f['model']=_[_0xe718('0x49')](db[_0xe718('0x72')][_0xe718('0x5c')]);_0x376f0f[_0xe718('0x48')]=_[_0xe718('0x49')](_0x13cf69[_0xe718('0x48')]);_0x376f0f[_0xe718('0x5d')]=_['intersection'](_0x376f0f[_0xe718('0x47')],_0x376f0f[_0xe718('0x48')]);_0x4d3e48['attributes']=_[_0xe718('0x4b')](_0x376f0f[_0xe718('0x47')],qs[_0xe718('0x4c')](_0x13cf69[_0xe718('0x48')][_0xe718('0x4c')]));_0x4d3e48[_0xe718('0x4a')]=_0x4d3e48['attributes'][_0xe718('0x4d')]?_0x4d3e48[_0xe718('0x4a')]:_0x376f0f[_0xe718('0x47')];if(!_0x13cf69[_0xe718('0x48')][_0xe718('0x4e')](_0xe718('0x6d'))){_0x4d3e48[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x13cf69[_0xe718('0x48')]['limit']);_0x4d3e48[_0xe718('0x32')]=qs['offset'](_0x13cf69[_0xe718('0x48')]['offset']);}_0x4d3e48[_0xe718('0x4f')]=qs['sort'](_0x13cf69[_0xe718('0x48')][_0xe718('0x50')]);_0x4d3e48[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x13cf69[_0xe718('0x48')],_0x376f0f['filters']));_0x4d3e48[_0xe718('0x51')][_0xe718('0x69')]=_0x3f5a83['id'];if(_0x13cf69[_0xe718('0x48')][_0xe718('0x53')]){_0x4d3e48['where']=_[_0xe718('0x54')](_0x4d3e48[_0xe718('0x51')],{'$or':_['map'](_0x4d3e48[_0xe718('0x4a')],function(_0x68525a){var _0x19705c={};_0x19705c[_0x68525a]={'$like':'%'+_0x13cf69[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x19705c;})});}_0x4d3e48=_[_0xe718('0x54')]({},_0x4d3e48,_0x13cf69[_0xe718('0x56')]);return db[_0xe718('0x72')][_0xe718('0x57')]({'where':_0x4d3e48[_0xe718('0x51')]})[_0xe718('0x38')](function(_0x176141){_0x27a89e[_0xe718('0x57')]=_0x176141;if(_0x13cf69[_0xe718('0x48')][_0xe718('0x5e')]){_0x4d3e48['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe718('0x59')](_0x4d3e48);})[_0xe718('0x38')](function(_0x5aa335){_0x27a89e['rows']=_0x5aa335;return _0x27a89e;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x3d80bb,_0x4d3e48))['catch'](handleError(_0x3d80bb,null));};exports[_0xe718('0x73')]=function(_0x4b976c,_0x36ef20,_0x4a8d41){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x4b976c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x36ef20,null))[_0xe718('0x38')](function(_0x10986a){if(_0x10986a){return _0x10986a[_0xe718('0x73')](_0x4b976c[_0xe718('0x48')][_0xe718('0x70')]);}})['then'](respondWithStatusCode(_0x36ef20,null))['catch'](handleError(_0x36ef20,null));};exports[_0xe718('0x74')]=function(_0x423aca,_0x529ab1,_0x520191){_0x423aca[_0xe718('0x61')]['sitepic']=_0x423aca[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x423aca['params']['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x529ab1,null))[_0xe718('0x38')](saveUpdates(_0x423aca[_0xe718('0x61')],null))[_0xe718('0x38')](respondWithResult(_0x529ab1,null))[_0xe718('0x2e')](handleError(_0x529ab1,null));};exports[_0xe718('0x76')]=function(_0x411171,_0xf15a9f,_0x247747){_0x411171[_0xe718('0x61')][_0xe718('0x77')]=_0x411171[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x411171[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0xf15a9f,null))[_0xe718('0x38')](saveUpdates(_0x411171[_0xe718('0x61')],null))['then'](respondWithResult(_0xf15a9f,null))[_0xe718('0x2e')](handleError(_0xf15a9f,null));};exports[_0xe718('0x78')]=function(_0x5bb785,_0x2c5cac,_0x3f3c59){_0x5bb785['body'][_0xe718('0x79')]=_0x5bb785[_0xe718('0x75')][_0xe718('0x7a')];return db[_0xe718('0x44')]['find']({'where':{'id':_0x5bb785[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2c5cac,null))[_0xe718('0x38')](saveUpdates(_0x5bb785[_0xe718('0x61')],null))[_0xe718('0x38')](respondWithResult(_0x2c5cac,null))[_0xe718('0x2e')](handleError(_0x2c5cac,null));};exports['addSystemAvatar']=function(_0x3d637d,_0x1cd3bf,_0x91f145){_0x3d637d[_0xe718('0x61')][_0xe718('0x7b')]=_0x3d637d[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x3d637d['params']['id']}})['then'](handleEntityNotFound(_0x1cd3bf,null))['then'](saveUpdates(_0x3d637d[_0xe718('0x61')],null))['then'](respondWithResult(_0x1cd3bf,null))[_0xe718('0x2e')](handleError(_0x1cd3bf,null));};exports[_0xe718('0x7c')]=function(_0x2ae3d3,_0x13ed3b,_0xc05a4f){var _0x11143a=path[_0xe718('0x7d')](config['root'],_0xe718('0x7e'));var _0x33bc05={'where':{'id':_0x2ae3d3[_0xe718('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xe59147=![];return require(_0xe718('0x19'))[_0xe718('0x7f')]()[_0xe718('0x38')](function(_0xf531c9){if(_0xf531c9){_0xe59147=_0xf531c9[_0xe718('0x80')];}})[_0xe718('0x38')](function(){return db['ChatWebsite'][_0xe718('0x5f')](_0x33bc05);})[_0xe718('0x38')](handleEntityNotFound(_0x13ed3b,null))['then'](function(_0x52ea1f){if(_0x52ea1f){if(!_[_0xe718('0x81')](_0x52ea1f[_0xe718('0x82')])){if(fs[_0xe718('0x83')](path['join'](config[_0xe718('0x84')],_0xe718('0x85'),_0x52ea1f[_0xe718('0x82')]))&&_0xe59147){_0x11143a=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x85'),_0x52ea1f['sitepic']);}}return _0x13ed3b[_0xe718('0x86')](_0x11143a);}})[_0xe718('0x2e')](handleError(_0x13ed3b,null));};exports[_0xe718('0x87')]=function(_0x134e38,_0x50c80d,_0x23bbbe){var _0x385418=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x88'));var _0x42e0c9={'where':{'id':_0x134e38[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x77')],'raw':!![]};return db[_0xe718('0x44')]['find'](_0x42e0c9)['then'](handleEntityNotFound(_0x50c80d,null))[_0xe718('0x38')](function(_0x90a562){if(_0x90a562){if(!_[_0xe718('0x81')](_0x90a562['agentAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x89'),_0x90a562[_0xe718('0x77')]))){_0x385418=path[_0xe718('0x7d')](config[_0xe718('0x84')],'server/files/images/avatars/',_0x90a562[_0xe718('0x77')]);}}return _0x50c80d['download'](_0x385418);}})[_0xe718('0x2e')](handleError(_0x50c80d,null));};exports[_0xe718('0x8a')]=function(_0x4f7525,_0x3d5b83,_0x434ccb){var _0x49db00=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x8b'));var _0x230dea={'where':{'id':_0x4f7525[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x79'),'showCustomerAvatar'],'raw':!![]};return db[_0xe718('0x44')][_0xe718('0x5f')](_0x230dea)[_0xe718('0x38')](handleEntityNotFound(_0x3d5b83,null))['then'](function(_0x2bf596){if(_0x2bf596){if(!_[_0xe718('0x81')](_0x2bf596['customerAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config['root'],_0xe718('0x89'),_0x2bf596[_0xe718('0x79')]))&&_0x2bf596[_0xe718('0x8c')]){_0x49db00=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x89'),_0x2bf596[_0xe718('0x79')]);}}return _0x3d5b83['download'](_0x49db00);}})[_0xe718('0x2e')](handleError(_0x3d5b83,null));};exports[_0xe718('0x8d')]=function(_0x48d46b,_0x5af1c7,_0x2bd464){var _0x4fd805=path['join'](config[_0xe718('0x84')],'server/files/images/avatars/system_avatar.png');var _0x385bf4={'where':{'id':_0x48d46b[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x7b')],'raw':!![]};return db[_0xe718('0x44')][_0xe718('0x5f')](_0x385bf4)['then'](handleEntityNotFound(_0x5af1c7,null))['then'](function(_0x490a78){if(_0x490a78){if(!_[_0xe718('0x81')](_0x490a78['systemAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config[_0xe718('0x84')],'server/files/images/avatars/',_0x490a78[_0xe718('0x7b')]))){_0x4fd805=path[_0xe718('0x7d')](config['root'],_0xe718('0x89'),_0x490a78['systemAvatar']);}}return _0x5af1c7[_0xe718('0x86')](_0x4fd805);}})[_0xe718('0x2e')](handleError(_0x5af1c7,null));};exports[_0xe718('0x8e')]=function(_0x2f35ba,_0x4db480,_0x4bb2a8){var _0x536b13=require(_0xe718('0x8f'));var _0x3e276e=new _0x536b13();var _0x4b6c1b=_0x3e276e['setUA'](_0x2f35ba[_0xe718('0x90')]['user-agent'])['getResult']();var _0x49664b={'body':_0x2f35ba['body'],'channel':_0xe718('0x91')};var _0x2f68bf=[];var _0x49c9ae=[];var _0x3023d5={};var _0x32ccfb=![];return db[_0xe718('0x92')][_0xe718('0x68')]()[_0xe718('0x38')](function(_0xc177ba){if(!_0xc177ba){throw new db['Sequelize'][(_0xe718('0x93'))]('no\x20available\x20attributes');}_0x2f68bf=_[_0xe718('0x94')](_[_0xe718('0x49')](_0xc177ba),['createdAt',_0xe718('0x95')]);_0x49c9ae=_[_0xe718('0x94')](_[_0xe718('0x49')](_0xc177ba),[_0xe718('0x96'),'updatedAt',_0xe718('0x97'),_0xe718('0x98')]);if(_0x2f35ba[_0xe718('0x61')]['id']){delete _0x2f35ba['body']['id'];}if(_['isNil'](_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')])){throw new db['Sequelize']['ValidationError'](_0xe718('0x9a'));}if(_[_0xe718('0x81')](_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')])||_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')]===''){throw new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9c'));}if(_[_0xe718('0x81')](_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')])){throw new db['Sequelize'][(_0xe718('0x93'))](_0xe718('0x9e')+_0x49c9ae);}if(!_[_0xe718('0x9f')](_0x49c9ae,_0x2f35ba['body'][_0xe718('0x9d')])){throw new db['Sequelize'][(_0xe718('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49c9ae);}_0x3023d5[_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')]]=_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')];})[_0xe718('0x38')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2f35ba[_0xe718('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe718('0x92')],'as':_0xe718('0xa0'),'where':_0x3023d5,'limit':0x1,'order':[['updatedAt',_0xe718('0xa1')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x4db480,null))[_0xe718('0x38')](function(_0x181041){if(_0x181041&&_0x181041[_0xe718('0xa2')]){_0x49664b[_0xe718('0xa3')]=_0x181041;_0x49664b[_0xe718('0xa4')]=_0x181041['Applications'];_0x49664b[_0xe718('0xa5')]=_0x181041['List'];_0x49664b[_0xe718('0xa4')]=_['orderBy'](_0x49664b['applications'],['priority'],[_0xe718('0xa6')]);if(_0x49664b[_0xe718('0xa3')]['Applications']){delete _0x49664b['account'][_0xe718('0xa7')];}if(_0x49664b['account'][_0xe718('0xa2')]&&_0x49664b[_0xe718('0xa3')][_0xe718('0xa2')][_0xe718('0xa0')][_0xe718('0x4d')]){return _0x49664b[_0xe718('0xa3')]['List'][_0xe718('0xa0')][0x0];}var _0x479b3d=_[_0xe718('0x1b')](_0x2f35ba[_0xe718('0x61')],{'firstName':_0x2f35ba['body'][_0xe718('0x99')],'ListId':_0x181041['ListId']});_0x479b3d[_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')]]=_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')];return db['CmContact'][_0xe718('0x60')](_0x479b3d,{'fields':_0x2f68bf,'raw':!![]});}})[_0xe718('0x38')](handleEntityNotFound(_0x4db480,null))[_0xe718('0x38')](function(_0x40a68a){_0x49664b['contact']=_0x40a68a;var _0x6d1b82=_0x2f35ba[_0xe718('0x61')]['customerIp'];if(_0x2f35ba['headers'][_0xe718('0xa8')]){_0x6d1b82=_0x2f35ba['headers'][_0xe718('0xa8')];}else if(_0x2f35ba[_0xe718('0x90')][_0xe718('0xa9')]){_0x6d1b82=_['first'](_0x2f35ba['headers'][_0xe718('0xa9')]['split'](','));}if(_0x40a68a){var _0x4377fd={'ContactId':_0x40a68a['id'],'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'from':(_0x40a68a['firstName']||'')+'\x20'+(_0x40a68a['lastName']||''),'customerIp':_0x6d1b82,'customerPort':_0x2f35ba[_0xe718('0x90')][_0xe718('0xaa')]?_0x2f35ba[_0xe718('0x90')][_0xe718('0xaa')]:null,'referer':_0x2f35ba[_0xe718('0x61')][_0xe718('0xab')],'browserName':_0x4b6c1b[_0xe718('0xac')]['name']&&_0x4b6c1b[_0xe718('0xac')]['version']?util['format'](_0xe718('0xad'),_0x4b6c1b[_0xe718('0xac')][_0xe718('0x3f')],_0x4b6c1b[_0xe718('0xac')][_0xe718('0xae')]):_0xe718('0xaf'),'browserVersion':_0x4b6c1b[_0xe718('0xac')][_0xe718('0xae')]||_0xe718('0xaf'),'osName':util['format']('%s\x20%s',_0x4b6c1b['os'][_0xe718('0x3f')],_0x4b6c1b['os'][_0xe718('0xae')]),'osVersion':_0x4b6c1b['os'][_0xe718('0xae')],'deviceModel':_0x4b6c1b[_0xe718('0xb0')][_0xe718('0x47')]&&_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb1')]?util[_0xe718('0xb2')](_0xe718('0xb3'),_0x4b6c1b[_0xe718('0xb0')][_0xe718('0x47')],_0x4b6c1b['device']['vendor'],_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb4')]):null,'deviceVendor':_0x4b6c1b['device']['vendor'],'deviceType':_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb4')],'formData':JSON[_0xe718('0x2a')](_0x2f35ba[_0xe718('0x61')])};var _0x17dedb={'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'closed':![]};if(_0x2f35ba[_0xe718('0x61')]['threadId']){_0x17dedb[_0xe718('0xb5')]=_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')];return db['ChatInteraction'][_0xe718('0x5f')]({'where':_0x17dedb})['then'](function(_0x345752){if(_0x345752){return[_0x345752,![]];}_0x4377fd[_0xe718('0xb5')]=_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')];_0x4377fd[_0xe718('0xb6')]=_0x2f35ba['body'][_0xe718('0xb6')];return db[_0xe718('0xb7')][_0xe718('0x60')](_0x4377fd)[_0xe718('0x38')](function(_0x183e03){return[_0x183e03,!![]];});});}_0x17dedb[_0xe718('0xb8')]=_0x40a68a['id'];if(_0x2f35ba[_0xe718('0x61')][_0xe718('0xb9')]&&_0x2f35ba[_0xe718('0x61')]['interaction']['id']){_0x17dedb['id']=_0x2f35ba['body'][_0xe718('0xb9')]['id'];return db[_0xe718('0xb7')][_0xe718('0x5f')]({'where':_0x17dedb})[_0xe718('0x38')](function(_0x5a3e0d){if(_0x5a3e0d){return[_0x5a3e0d,![]];}return db[_0xe718('0xb7')][_0xe718('0x60')](_0x4377fd)[_0xe718('0x38')](function(_0x1299c6){return[_0x1299c6,!![]];});});}return db[_0xe718('0xb7')]['create'](_0x4377fd)[_0xe718('0x38')](function(_0x26d8b6){return[_0x26d8b6,!![]];});}})[_0xe718('0xba')](function(_0xb62386,_0x27e1a1){if(_0xb62386){_0x32ccfb=_0x27e1a1;if(!_0x27e1a1){var _0xeac610={'from':(_0x49664b['contact'][_0xe718('0xbb')]||'')+'\x20'+(_0x49664b[_0xe718('0xbc')][_0xe718('0xbd')]||'')};if(_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')]&&_0x2f35ba[_0xe718('0x61')]['messageId']&&_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')]!=_0x2f35ba[_0xe718('0x61')]['messageId']){_0xeac610['threadId']=_0x2f35ba[_0xe718('0x61')][_0xe718('0xbe')];}return _0xb62386[_0xe718('0x37')](_0xeac610);}else{return _0xb62386;}}})[_0xe718('0x38')](function(_0x426a36){_0x49664b[_0xe718('0xb9')]=_0x426a36['get']({'plain':!![]});_0x49664b[_0xe718('0xb9')][_0xe718('0xbf')]=_0x32ccfb;if(_0x49664b['interaction']['created']){if(_0x49664b[_0xe718('0xa3')][_0xe718('0xc0')]){_0x49664b[_0xe718('0xa4')][_0xe718('0xc1')]({'id':0x0,'priority':_0x49664b[_0xe718('0xa4')][_0xe718('0x4d')]+0x1,'app':_0xe718('0xc2'),'appdata':_0xe718('0xc3'),'interval':_0xe718('0xc4')});}}return db[_0xe718('0xc5')][_0xe718('0x60')]({'body':_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')],'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'ChatInteractionId':_0x426a36['id'],'direction':'in','ContactId':_0x49664b['contact']['id'],'AttachmentId':_0x2f35ba[_0xe718('0x61')][_0xe718('0xc6')]});})['then'](function(_0x4a3ae2){_0x49664b[_0xe718('0x2c')]=_0x4a3ae2;if(_0x49664b[_0xe718('0xb9')][_0xe718('0xc7')]){return db[_0xe718('0xc8')][_0xe718('0x5f')]({'attributes':['id',_0xe718('0x3f')],'where':{'id':_0x49664b[_0xe718('0xb9')][_0xe718('0xc7')]}})[_0xe718('0x38')](function(_0x1a12cb){if(_0x1a12cb){_0x49664b[_0xe718('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe718('0xc9'),'appdata':_0x1a12cb[_0xe718('0x3f')]+','+(_0x49664b[_0xe718('0xa3')][_0xe718('0xca')]||0xa),'interval':'*,*,*,*'});_0x49664b['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xe718('0xcb'),_0x49664b);});}return respondWithRpcPromise(_0xe718('0xcc'),_0xe718('0xcb'),_0x49664b);})[_0xe718('0x38')](function(_0x395551){respondWithRpcPromise(_0xe718('0xcd'),_0xe718('0xcd'),{'event':_0xe718('0x8e'),'message':_0x395551},client9002);return _0x395551;})[_0xe718('0x38')](respondWithResult(_0x4db480,null))[_0xe718('0x2e')](handleError(_0x4db480,null));};exports[_0xe718('0xce')]=function(_0x62f01b,_0x41353c,_0x470b56){var _0x433b85,_0x58d030,_0x26865d;var _0xb7eb7b=[];var _0x26d667=[];var _0x5af3fc={};return db[_0xe718('0x92')][_0xe718('0x68')]()[_0xe718('0x38')](function(_0x5eac43){if(!_0x5eac43){throw new db[(_0xe718('0x9b'))]['ValidationError'](_0xe718('0xcf'));}_0x26d667=_[_0xe718('0x94')](_[_0xe718('0x49')](_0x5eac43),['createdAt','updatedAt']);_0xb7eb7b=_[_0xe718('0x94')](_[_0xe718('0x49')](_0x5eac43),[_0xe718('0x96'),_0xe718('0x95'),_0xe718('0x97'),_0xe718('0x98')]);if(_0x62f01b[_0xe718('0x61')]['id']){delete _0x62f01b[_0xe718('0x61')]['id'];}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')][_0xe718('0x99')])){throw _0x41353c[_0xe718('0x30')](0x1f4)['send'](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9a')));}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')]['body'])||_0x62f01b[_0xe718('0x61')]['body']===''){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9c')));}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')][_0xe718('0xd0')])){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0xd1')+_0xb7eb7b));}if(!_[_0xe718('0x9f')](_0xb7eb7b,_0x62f01b[_0xe718('0x61')]['mapKeyOffline'])){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db['Sequelize'][(_0xe718('0x93'))](_0xe718('0xd2')+_0xb7eb7b));}_0x5af3fc[_0x62f01b[_0xe718('0x61')]['mapKeyOffline']]=_0x62f01b['body'][_0xe718('0x99')];})[_0xe718('0x38')](function(){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x62f01b[_0xe718('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xe718('0xa2')}]});})[_0xe718('0x38')](handleEntityNotFound(_0x41353c,null))[_0xe718('0x38')](function(_0x384a11){if(_0x384a11&&_0x384a11['List']){_0x58d030=_0x384a11;var _0x480385=_['defaults'](_0x62f01b[_0xe718('0x61')],{'firstName':_0x62f01b[_0xe718('0x61')][_0xe718('0x99')],'phone':_0x62f01b['body']['from'],'ListId':_0x384a11[_0xe718('0x98')]});_0x480385[_0x62f01b['body'][_0xe718('0xd0')]]=_0x62f01b[_0xe718('0x61')][_0xe718('0x99')];return db['CmContact']['findOrCreate']({'where':_0x5af3fc,'defaults':_0x480385});}})['spread'](function(_0x200198){if(_0x200198){_0x26865d=_0x200198;var _0xb765cb=fs[_0xe718('0xd3')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0xd4')),_0xe718('0xd5'));var _0x1358e1=ejs[_0xe718('0xd6')](_0xb765cb,{'body':_['toPairs'](_0x62f01b['body'][_0xe718('0x61')]),'bodyTitle':_0x58d030[_0xe718('0xd7')]});return db[_0xe718('0xd8')][_0xe718('0x60')]({'body':_0x1358e1,'ContactId':_0x200198['id'],'ChatWebsiteId':_0x58d030['id']});}})['then'](function(_0x2305c4){if(_0x2305c4){_0x433b85=_0x2305c4;return db[_0xe718('0xd9')][_0xe718('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xe718('0xda')],'as':_0xe718('0xdb'),'raw':!![]}]});}})['then'](function(_0x4743eb){if(_0x4743eb&&_0x4743eb[_0xe718('0xdb')]&&_0x58d030[_0xe718('0xdc')]){var _0x2ede0c={'tls':{'rejectUnauthorized':![]}};if(_0x4743eb[_0xe718('0xdb')]['service']){_0x2ede0c['service']=_0x4743eb['Smtp'][_0xe718('0xdd')];}else{_0x2ede0c[_0xe718('0xde')]=_0x4743eb[_0xe718('0xdb')][_0xe718('0xde')];_0x2ede0c[_0xe718('0xdf')]=_0x4743eb[_0xe718('0xdb')][_0xe718('0xdf')];_0x2ede0c['secure']=_0x4743eb[_0xe718('0xdb')][_0xe718('0xe0')];}if(_0x4743eb['Smtp'][_0xe718('0xe1')]){_0x2ede0c[_0xe718('0xe2')]={'user':_0x4743eb[_0xe718('0xdb')][_0xe718('0x62')],'pass':_0x4743eb[_0xe718('0xdb')][_0xe718('0xe3')]};}return respondWithRpcPromise(_0xe718('0xe4'),_0xe718('0xe5'),{'account':_0x2ede0c,'message':{'from':util[_0xe718('0xb2')](_0xe718('0xe6'),_0x4743eb[_0xe718('0x3f')],_0x4743eb[_0xe718('0xe7')]||_0x4743eb[_0xe718('0xdb')][_0xe718('0x62')]),'to':_0x58d030[_0xe718('0xdc')],'subject':_0x58d030[_0xe718('0xe8')],'text':_0x433b85['body']}},client9003)[_0xe718('0x38')](function(){return _0x433b85;})[_0xe718('0x2e')](function(_0x36fefb){console[_0xe718('0x2b')](_0x36fefb);});}})[_0xe718('0x38')](function(){if(_0x433b85){return _0x433b85;}})[_0xe718('0x38')](respondWithResult(_0x41353c,null))[_0xe718('0x2e')](handleError(_0x41353c,null));};exports[_0xe718('0xe9')]=function(_0x549ec1,_0xae9327,_0x504411){return db[_0xe718('0xb7')]['find']({'where':{'id':_0x549ec1[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0xae9327,null))['then'](function(_0xbe15dc){if(_0xbe15dc){return _0xbe15dc[_0xe718('0xe9')](_0x549ec1[_0xe718('0x61')]['ids'],_[_0xe718('0xea')](_0x549ec1[_0xe718('0x61')],[_0xe718('0x70'),'id'])||{});}})[_0xe718('0x38')](respondWithResult(_0xae9327,null))[_0xe718('0x2e')](handleError(_0xae9327,null));};exports[_0xe718('0xeb')]=function(_0x4fce24,_0x27cb75,_0x58d01e){var _0x26129a={'raw':![],'where':{}};var _0x36d1bc={};var _0x32ae15={'count':0x0,'rows':[]};return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x4fce24[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x27cb75,null))['then'](function(_0xb9b25){if(_0xb9b25){_0x36d1bc[_0xe718('0x47')]=_[_0xe718('0x49')](db['ChatInteraction']['rawAttributes']);_0x36d1bc[_0xe718('0x48')]=_['keys'](_0x4fce24['query']);_0x36d1bc[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x36d1bc['model'],_0x36d1bc[_0xe718('0x48')]);_0x26129a[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x36d1bc['model'],qs[_0xe718('0x4c')](_0x4fce24[_0xe718('0x48')][_0xe718('0x4c')]));_0x26129a[_0xe718('0x4a')]=_0x26129a['attributes']['length']?_0x26129a[_0xe718('0x4a')]:_0x36d1bc[_0xe718('0x47')];if(!_0x4fce24['query'][_0xe718('0x4e')](_0xe718('0x6d'))){_0x26129a['limit']=qs[_0xe718('0x33')](_0x4fce24[_0xe718('0x48')]['limit']);_0x26129a['offset']=qs[_0xe718('0x32')](_0x4fce24[_0xe718('0x48')][_0xe718('0x32')]);}_0x26129a[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x4fce24['query']['sort']);_0x26129a[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x4fce24[_0xe718('0x48')],_0x36d1bc[_0xe718('0x5d')]));_0x26129a[_0xe718('0x51')][_0xe718('0x69')]=_0xb9b25['id'];if(_0x4fce24[_0xe718('0x48')]['filter']){_0x26129a['where']=_['merge'](_0x26129a[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x26129a[_0xe718('0x4a')],function(_0x9ab65){var _0x5b0334={};_0x5b0334[_0x9ab65]={'$like':'%'+_0x4fce24[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x5b0334;})});}_0x26129a=_['merge']({},_0x26129a,_0x4fce24[_0xe718('0x56')]);return db[_0xe718('0xb7')][_0xe718('0x57')]({'where':_0x26129a['where']})['then'](function(_0x406156){_0x32ae15['count']=_0x406156;if(_0x4fce24[_0xe718('0x48')][_0xe718('0x5e')]){_0x26129a[_0xe718('0x58')]=[{'model':db[_0xe718('0x92')],'as':_0xe718('0xec'),'required':![]},{'model':db[_0xe718('0xc8')],'as':'Owner','attributes':['name','fullname',_0xe718('0xed')],'required':![]},{'model':db[_0xe718('0xee')],'as':_0xe718('0xef'),'attributes':['id',_0xe718('0x3f'),_0xe718('0xf0')],'where':_0x4fce24[_0xe718('0x48')][_0xe718('0xf1')]?{'id':_0x4fce24['query'][_0xe718('0xf1')]}:undefined,'required':_0x4fce24[_0xe718('0x48')][_0xe718('0xf1')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x26129a);})[_0xe718('0x38')](function(_0x409f56){_0x32ae15['rows']=_0x409f56;return _0x32ae15;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x27cb75,_0x26129a))['catch'](handleError(_0x27cb75,null));};function iftimePromise(_0x4cb9b7,_0x1cb2ff){return respondWithRpcPromise('Command',_0xe718('0xf2'),{'command':_0x1cb2ff[_0xe718('0xf3')]?util['format'](_0xe718('0xf4'),_0x4cb9b7[_0xe718('0xf5')],_0x1cb2ff[_0xe718('0xf3')]):util[_0xe718('0xb2')](_0xe718('0xf6'),_0x4cb9b7[_0xe718('0xf5')])},client9002)[_0xe718('0x38')](function(_0x1fa335){var _0xf71edb=_0x1fa335&&_0x1fa335[_0xe718('0xf7')](_0xe718('0xf8'))>=0x0?!![]:![];logger[_0xe718('0x25')](_0xe718('0xf9'),_0x1cb2ff['id'],_0x4cb9b7['id'],_0x4cb9b7[_0xe718('0xf5')],_0xf71edb?'ONLINE':_0xe718('0xfa'),_0x1cb2ff['timezone']?_0x1cb2ff[_0xe718('0xf3')]:'No\x20timezone');return _0xf71edb;})[_0xe718('0x2e')](function(_0x5eabed){logger[_0xe718('0x2b')](_0xe718('0xf9'),_0x1cb2ff['id'],_0x4cb9b7['id'],_0x4cb9b7['interval'],util[_0xe718('0xfb')](_0x5eabed,{'showHidden':![],'depth':null}),_0x1cb2ff[_0xe718('0xf3')]?_0x1cb2ff[_0xe718('0xf3')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x33ca21,_0x79774e,_0x91e744){var _0xda3712=0x0;var _0x4dd4a0=0x0;var _0xa03eec=![];var _0x387b17;var _0x481529;return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x33ca21['params']['id']},'include':[{'model':db[_0xe718('0xfc')],'as':_0xe718('0xfc'),'include':[{'model':db[_0xe718('0xfc')],'as':_0xe718('0xfd'),'attributes':['id',_0xe718('0xf5')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x79774e,null))[_0xe718('0x38')](function(_0xb9bdc1){if(_0xb9bdc1){_0x387b17=_0xb9bdc1;return _0xb9bdc1[_0xe718('0xfe')]({'raw':!![]});}})['then'](function(_0x6f1e14){if(_0x387b17){if(_0x6f1e14){_0x481529=_0x6f1e14;}}return require(_0xe718('0x19'))['getLicense']();})[_0xe718('0x38')](function(_0x4735e7){if(_0x4735e7){_0x4dd4a0=_0x4735e7[_0xe718('0xff')];_0xa03eec=_0x4735e7[_0xe718('0x80')];}})[_0xe718('0x38')](function(){return db[_0xe718('0xb7')][_0xe718('0x57')]({'where':{'closed':![]}});})[_0xe718('0x38')](function(_0x30c2b8){_0xda3712=_0x30c2b8;if(_0x4dd4a0&&_0x30c2b8>_0x4dd4a0){return db[_0xe718('0x100')][_0xe718('0x6c')]({'where':{'id':0x1}})[_0xe718('0x38')](function(_0x39eb5a){if(_0x39eb5a){_0x39eb5a[_0xe718('0x101')]('chatLicenseExceeded');}});}})[_0xe718('0x38')](function(){if(_0x387b17[_0xe718('0xfc')]&&_0x387b17['Interval'][_0xe718('0xfd')]){var _0x3b22ae=[];for(var _0x28f847=0x0;_0x28f847<_0x387b17[_0xe718('0xfc')]['Intervals'][_0xe718('0x4d')];_0x28f847++){var _0x48d2a9=_0x387b17[_0xe718('0xfc')][_0xe718('0xfd')][_0x28f847][_0xe718('0x39')]({'plain':!![]});_0x3b22ae[_0xe718('0xc1')](iftimePromise(_0x48d2a9,_0x387b17));}return BPromise['all'](_0x3b22ae)['then'](function(_0xc34ec9){return _[_0xe718('0x102')](_0xc34ec9);});}else{return!![];}})[_0xe718('0x38')](function(_0x27c6db){var _0x58834f=fs[_0xe718('0xd3')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x103')),_0xe718('0xd5'));var _0x1d40c2={'remote':_0x387b17[_0xe718('0x104')],'query':querystring[_0xe718('0x2a')](_[_0xe718('0x54')](_0x387b17['get']({'plain':!![]}),{'customerIp':_0x33ca21[_0xe718('0x90')][_0xe718('0xa9')]||_0x33ca21['headers']['x-real-ip']||_0x33ca21[_0xe718('0x105')][_0xe718('0x106')]||_0x33ca21['ip'],'referer':_0x33ca21[_0xe718('0x90')][_0xe718('0xab')],'openedInteractions':_0xda3712,'maxInteractions':_0x4dd4a0,'virtual':_0xa03eec[_0xe718('0xff')],'online':_0x27c6db,'custom':_0xa03eec}))[_0xe718('0x107')](/'/g,'\x5c\x27')};_0x79774e[_0xe718('0x40')](ejs[_0xe718('0xd6')](Mustache[_0xe718('0xd6')](_0x58834f,_0x1d40c2),{'proactiveActions':_0x481529,'alignment':_0x387b17[_0xe718('0x108')],'verticalAlignment':_0x387b17[_0xe718('0x109')],'div_color':_0x387b17[_0xe718('0xf0')],'text_color':_0x387b17[_0xe718('0x10a')]}));})[_0xe718('0x2e')](handleError(_0x79774e,null));};exports['addApplications']=function(_0x599402,_0x5bcf16,_0x39b073){return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x599402[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x5bcf16,null))['then'](function(_0x58189d){if(_0x58189d){return db[_0xe718('0x10b')][_0xe718('0x10c')](function(_0x42f111){return db[_0xe718('0x10d')][_0xe718('0x3c')]({'where':{'ChatWebsiteId':_0x599402[_0xe718('0x5b')]['id']},'transaction':_0x42f111})[_0xe718('0x38')](function(_0x25fce2){var _0x15035c=_[_0xe718('0x43')](_0x599402[_0xe718('0x61')],function(_0xad998f){_0xad998f[_0xe718('0x69')]=_0x599402[_0xe718('0x5b')]['id'];return _0xad998f;});return db[_0xe718('0x10d')][_0xe718('0x10e')](_0x15035c,{'transaction':_0x42f111});});})[_0xe718('0x38')](function(){return db[_0xe718('0x10d')][_0xe718('0x10f')]({'where':{'ChatWebsiteId':_0x599402['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5bcf16,null))[_0xe718('0x2e')](handleError(_0x5bcf16,null));};exports[_0xe718('0x110')]=function(_0x53f97c,_0x36eada,_0x5f5573){var _0x1b64ec={};var _0x5a9006={};var _0x508f8c;var _0x1dbd9d;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x53f97c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x36eada,null))[_0xe718('0x38')](function(_0x653384){if(_0x653384){_0x508f8c=_0x653384;_0x5a9006[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0x10d')][_0xe718('0x5c')]);_0x5a9006[_0xe718('0x48')]=_[_0xe718('0x49')](_0x53f97c['query']);_0x5a9006[_0xe718('0x5d')]=_['intersection'](_0x5a9006[_0xe718('0x47')],_0x5a9006[_0xe718('0x48')]);_0x1b64ec[_0xe718('0x4a')]=_['intersection'](_0x5a9006[_0xe718('0x47')],qs[_0xe718('0x4c')](_0x53f97c[_0xe718('0x48')][_0xe718('0x4c')]));_0x1b64ec[_0xe718('0x4a')]=_0x1b64ec[_0xe718('0x4a')][_0xe718('0x4d')]?_0x1b64ec['attributes']:_0x5a9006[_0xe718('0x47')];_0x1b64ec['order']=qs[_0xe718('0x50')](_0x53f97c[_0xe718('0x48')]['sort']);_0x1b64ec[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x53f97c[_0xe718('0x48')],_0x5a9006['filters']));if(_0x53f97c[_0xe718('0x48')]['filter']){_0x1b64ec[_0xe718('0x51')]=_['merge'](_0x1b64ec['where'],{'$or':_[_0xe718('0x43')](_0x1b64ec[_0xe718('0x4a')],function(_0x211867){var _0x3c8383={};_0x3c8383[_0x211867]={'$like':'%'+_0x53f97c[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x3c8383;})});}_0x1b64ec=_[_0xe718('0x54')]({},_0x1b64ec,_0x53f97c['options']);return _0x508f8c[_0xe718('0x110')](_0x1b64ec);}})[_0xe718('0x38')](function(_0x1b1fe6){if(_0x1b1fe6){_0x1dbd9d=_0x1b1fe6[_0xe718('0x4d')];if(!_0x53f97c[_0xe718('0x48')]['hasOwnProperty'](_0xe718('0x6d'))){_0x1b64ec[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x53f97c[_0xe718('0x48')][_0xe718('0x33')]);_0x1b64ec[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x53f97c['query'][_0xe718('0x32')]);}return _0x508f8c[_0xe718('0x110')](_0x1b64ec);}})[_0xe718('0x38')](function(_0x5d2ad3){if(_0x5d2ad3){return _0x5d2ad3?{'count':_0x1dbd9d,'rows':_0x5d2ad3}:null;}})[_0xe718('0x38')](respondWithResult(_0x36eada,null))[_0xe718('0x2e')](handleError(_0x36eada,null));};exports['addProactiveActions']=function(_0x558d15,_0x29c6b7,_0x1ebb88){return db['chatProactiveAction'][_0xe718('0x5f')]({'where':{'id':_0x558d15[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x29c6b7,null))[_0xe718('0x38')](function(_0x1ad690){if(_0x1ad690){return _0x1ad690['addProactiveActions'](_0x558d15[_0xe718('0x61')][_0xe718('0x70')],_[_0xe718('0xea')](_0x558d15[_0xe718('0x61')],[_0xe718('0x70'),'id'])||{});}})[_0xe718('0x38')](respondWithResult(_0x29c6b7,null))['catch'](handleError(_0x29c6b7,null));};exports['getProactiveActions']=function(_0x1f3eb2,_0x51ebf8,_0x231d5f){var _0x49aa40={};var _0x284061={};var _0x3306ab;var _0x1d1099;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x1f3eb2[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x51ebf8,null))[_0xe718('0x38')](function(_0x3569e5){if(_0x3569e5){_0x3306ab=_0x3569e5;_0x284061[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0x111')][_0xe718('0x5c')]);_0x284061[_0xe718('0x48')]=_['keys'](_0x1f3eb2[_0xe718('0x48')]);_0x284061[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x284061['model'],_0x284061[_0xe718('0x48')]);_0x49aa40[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x284061['model'],qs[_0xe718('0x4c')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x4c')]));_0x49aa40[_0xe718('0x4a')]=_0x49aa40[_0xe718('0x4a')][_0xe718('0x4d')]?_0x49aa40['attributes']:_0x284061['model'];_0x49aa40[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x50')]);_0x49aa40[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x1f3eb2[_0xe718('0x48')],_0x284061['filters']));if(_0x1f3eb2[_0xe718('0x48')][_0xe718('0x53')]){_0x49aa40[_0xe718('0x51')]=_[_0xe718('0x54')](_0x49aa40[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x49aa40[_0xe718('0x4a')],function(_0x4c0bf2){var _0x2cb5fc={};_0x2cb5fc[_0x4c0bf2]={'$like':'%'+_0x1f3eb2['query'][_0xe718('0x53')]+'%'};return _0x2cb5fc;})});}_0x49aa40=_[_0xe718('0x54')]({},_0x49aa40,_0x1f3eb2['options']);return _0x3306ab[_0xe718('0xfe')](_0x49aa40);}})[_0xe718('0x38')](function(_0x5cb121){if(_0x5cb121){_0x1d1099=_0x5cb121['length'];if(!_0x1f3eb2[_0xe718('0x48')][_0xe718('0x4e')]('nolimit')){_0x49aa40[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x33')]);_0x49aa40[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x32')]);}return _0x3306ab[_0xe718('0xfe')](_0x49aa40);}})[_0xe718('0x38')](function(_0x17c83f){if(_0x17c83f){return _0x17c83f?{'count':_0x1d1099,'rows':_0x17c83f}:null;}})[_0xe718('0x38')](respondWithResult(_0x51ebf8,null))[_0xe718('0x2e')](handleError(_0x51ebf8,null));};exports[_0xe718('0x112')]=function(_0x304994,_0x188d3d,_0x267825){var _0xdf2cfb=_0x304994[_0xe718('0x48')][_0xe718('0x113')]===_0xe718('0x114')?_0xe718('0x115'):_0xe718('0x116');return db['ChatWebsite']['find']({'attributes':['id',_0xdf2cfb],'where':{'id':_0x304994[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x188d3d,null))['then'](function(_0x6c320d){if(_0x6c320d){var _0x267293=_0x6c320d[_0xdf2cfb];var _0x2aa199=_0x267293&&_0x267293[_0xe718('0x117')]?_0x267293[_0xe718('0x117')]:[];_0x188d3d[_0xe718('0x40')]({'fromKey':_[_0xe718('0x81')](_0x267293[_0xe718('0x118')])?undefined:_0x267293[_0xe718('0x118')],'count':_0x2aa199[_0xe718('0x4d')],'rows':_0x2aa199});}})[_0xe718('0x2e')](handleError(_0x188d3d,null));};exports[_0xe718('0x119')]=function(_0x520d0d,_0x527060,_0x1faa16){var _0x48ee9c={'raw':![],'where':{}};var _0x1b11d8={};var _0x28c8fd={'count':0x0,'rows':[]};return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x520d0d[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x527060,null))[_0xe718('0x38')](function(_0x5dd7bc){if(_0x5dd7bc){_0x1b11d8[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0xd8')][_0xe718('0x5c')]);_0x1b11d8[_0xe718('0x48')]=_[_0xe718('0x49')](_0x520d0d[_0xe718('0x48')]);_0x1b11d8[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x1b11d8[_0xe718('0x47')],_0x1b11d8[_0xe718('0x48')]);_0x48ee9c[_0xe718('0x4a')]=_['intersection'](_0x1b11d8[_0xe718('0x47')],qs['fields'](_0x520d0d[_0xe718('0x48')][_0xe718('0x4c')]));_0x48ee9c[_0xe718('0x4a')]=_0x48ee9c['attributes'][_0xe718('0x4d')]?_0x48ee9c[_0xe718('0x4a')]:_0x1b11d8['model'];if(!_0x520d0d['query']['hasOwnProperty'](_0xe718('0x6d'))){_0x48ee9c['limit']=qs[_0xe718('0x33')](_0x520d0d[_0xe718('0x48')][_0xe718('0x33')]);_0x48ee9c[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x520d0d[_0xe718('0x48')]['offset']);}_0x48ee9c[_0xe718('0x4f')]=qs['sort'](_0x520d0d[_0xe718('0x48')][_0xe718('0x50')]);_0x48ee9c[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x520d0d[_0xe718('0x48')],_0x1b11d8[_0xe718('0x5d')]));_0x48ee9c[_0xe718('0x51')][_0xe718('0x69')]=_0x5dd7bc['id'];if(_0x520d0d['query']['filter']){_0x48ee9c[_0xe718('0x51')]=_[_0xe718('0x54')](_0x48ee9c[_0xe718('0x51')],{'$or':_['map'](_0x48ee9c['attributes'],function(_0x161933){var _0x289674={};_0x289674[_0x161933]={'$like':'%'+_0x520d0d[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x289674;})});}_0x48ee9c=_[_0xe718('0x54')]({},_0x48ee9c,_0x520d0d['options']);return db['ChatOfflineMessage'][_0xe718('0x57')]({'where':_0x48ee9c['where']})[_0xe718('0x38')](function(_0x5a9e45){_0x28c8fd[_0xe718('0x57')]=_0x5a9e45;if(_0x520d0d[_0xe718('0x48')][_0xe718('0x5e')]){_0x48ee9c[_0xe718('0x58')]=[{'all':!![]}];}else{_0x48ee9c['include']=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0xe718('0xd8')]['findAll'](_0x48ee9c);})[_0xe718('0x38')](function(_0x50213d){_0x28c8fd['rows']=_0x50213d;return _0x28c8fd;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x527060,_0x48ee9c))[_0xe718('0x2e')](handleError(_0x527060,null));};exports[_0xe718('0x11a')]=function(_0x64ad6,_0x402736,_0x819556){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x64ad6[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x402736,null))['then'](function(_0x7d6383){if(_0x7d6383){return _0x7d6383['addAgents'](_0x64ad6[_0xe718('0x61')][_0xe718('0x70')],_[_0xe718('0xea')](_0x64ad6['body'],[_0xe718('0x70'),'id'])||{})[_0xe718('0xba')](function(_0x332ca7){for(var _0x436e91=0x0;_0x436e91<_0x64ad6['body'][_0xe718('0x70')][_0xe718('0x4d')];_0x436e91+=0x1){socket[_0xe718('0x11b')]('userChatWebsite:save',{'UserId':_0x64ad6['body'][_0xe718('0x70')][_0x436e91],'ChatWebsiteId':_0x64ad6['params']['id']});}return _0x332ca7;});}})[_0xe718('0x38')](respondWithResult(_0x402736,null))['catch'](handleError(_0x402736,null));};exports[_0xe718('0x11c')]=function(_0xc8747c,_0x2bec4b,_0x49828c){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0xc8747c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2bec4b,null))[_0xe718('0x38')](function(_0x5af647){if(_0x5af647){return _0x5af647['removeAgents'](_0xc8747c['query'][_0xe718('0x70')])[_0xe718('0x38')](function(){if(_['isArray'](_0xc8747c['query'][_0xe718('0x70')])){for(var _0xb2327f=0x0;_0xb2327f<_0xc8747c[_0xe718('0x48')][_0xe718('0x70')][_0xe718('0x4d')];_0xb2327f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xc8747c[_0xe718('0x48')][_0xe718('0x70')][_0xb2327f]),'ChatWebsiteId':Number(_0xc8747c[_0xe718('0x5b')]['id'])});}}else{socket[_0xe718('0x11b')](_0xe718('0x11d'),{'UserId':Number(_0xc8747c[_0xe718('0x48')][_0xe718('0x70')]),'ChatWebsiteId':Number(_0xc8747c[_0xe718('0x5b')]['id'])});}});}})[_0xe718('0x38')](respondWithStatusCode(_0x2bec4b,null))[_0xe718('0x2e')](handleError(_0x2bec4b,null));};exports[_0xe718('0x11e')]=function(_0x86ba5d,_0x441e9d,_0x131620){var _0x3e24fe={};var _0x4b2aa4={};var _0x16bfff;var _0x1d9c15;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x86ba5d[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x441e9d,null))[_0xe718('0x38')](function(_0x41257a){if(_0x41257a){_0x16bfff=_0x41257a;_0x4b2aa4[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0xc8')]['rawAttributes']);_0x4b2aa4[_0xe718('0x48')]=_['keys'](_0x86ba5d['query']);_0x4b2aa4[_0xe718('0x5d')]=_['intersection'](_0x4b2aa4[_0xe718('0x47')],_0x4b2aa4['query']);_0x3e24fe[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x4b2aa4['model'],qs[_0xe718('0x4c')](_0x86ba5d['query'][_0xe718('0x4c')]));_0x3e24fe[_0xe718('0x4a')]=_0x3e24fe[_0xe718('0x4a')][_0xe718('0x4d')]?_0x3e24fe['attributes']:_0x4b2aa4['model'];_0x3e24fe[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x86ba5d[_0xe718('0x48')]['sort']);_0x3e24fe[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x86ba5d[_0xe718('0x48')],_0x4b2aa4['filters']));if(_0x86ba5d[_0xe718('0x48')]['filter']){_0x3e24fe[_0xe718('0x51')]=_[_0xe718('0x54')](_0x3e24fe['where'],{'$or':_[_0xe718('0x43')](_0x3e24fe['attributes'],function(_0x13b86){var _0x2a2800={};_0x2a2800[_0x13b86]={'$like':'%'+_0x86ba5d[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x2a2800;})});}_0x3e24fe=_[_0xe718('0x54')]({},_0x3e24fe,_0x86ba5d[_0xe718('0x56')]);return _0x16bfff[_0xe718('0x11e')](_0x3e24fe);}})[_0xe718('0x38')](function(_0x71f0b1){if(_0x71f0b1){_0x1d9c15=_0x71f0b1[_0xe718('0x4d')];if(!_0x86ba5d['query']['hasOwnProperty'](_0xe718('0x6d'))){_0x3e24fe[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x86ba5d[_0xe718('0x48')][_0xe718('0x33')]);_0x3e24fe[_0xe718('0x32')]=qs['offset'](_0x86ba5d[_0xe718('0x48')][_0xe718('0x32')]);}return _0x16bfff[_0xe718('0x11e')](_0x3e24fe);}})['then'](function(_0x506d68){if(_0x506d68){return _0x506d68?{'count':_0x1d9c15,'rows':_0x506d68}:null;}})['then'](respondWithResult(_0x441e9d,null))[_0xe718('0x2e')](handleError(_0x441e9d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index be28d2f..1723705 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 _0x3685=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5368('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x5368('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5368('0x2')](0x0);var events={'afterCreate':_0x5368('0x3'),'afterUpdate':_0x5368('0x4'),'afterDestroy':_0x5368('0x5')};function emitEvent(_0xf0428a){return function(_0x271e21,_0x2c9c35,_0x3bf968){ChatWebsiteEvents[_0x5368('0x6')](_0xf0428a+':'+_0x271e21['id'],_0x271e21);ChatWebsiteEvents['emit'](_0xf0428a,_0x271e21);_0x3bf968(null);};}for(var e in events){if(events[_0x5368('0x7')](e)){var event=events[e];ChatWebsite[_0x5368('0x8')](e,emitEvent(event));}}module[_0x5368('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc39c=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit'];(function(_0x1711b0,_0x429531){var _0x2668ae=function(_0x307ced){while(--_0x307ced){_0x1711b0['push'](_0x1711b0['shift']());}};_0x2668ae(++_0x429531);}(_0xc39c,0xd2));var _0xcc39=function(_0x2341bd,_0xca9782){_0x2341bd=_0x2341bd-0x0;var _0x8a1b3=_0xc39c[_0x2341bd];return _0x8a1b3;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xcc39('0x0'))['db'][_0xcc39('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcc39('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc39('0x3'),'afterDestroy':_0xcc39('0x4')};function emitEvent(_0x2da5dd){return function(_0x5bc333,_0x29c6c2,_0x535eae){ChatWebsiteEvents[_0xcc39('0x5')](_0x2da5dd+':'+_0x5bc333['id'],_0x5bc333);ChatWebsiteEvents[_0xcc39('0x5')](_0x2da5dd,_0x5bc333);_0x535eae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xcc39('0x6')](e,emitEvent(event));}}module[_0xcc39('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 2d72ec4..1eaf774 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 _0x777d=['./chatWebsite.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4655a8,_0x136ca0){var _0x15af3d=function(_0x41a016){while(--_0x41a016){_0x4655a8['push'](_0x4655a8['shift']());}};_0x15af3d(++_0x136ca0);}(_0x777d,0xe9));var _0xd777=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x777d[_0x23884b];return _0x28113b;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6215=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatWebsite','chat_websites'];(function(_0x77308f,_0x2179da){var _0x1dc727=function(_0x52b685){while(--_0x52b685){_0x77308f['push'](_0x77308f['shift']());}};_0x1dc727(++_0x2179da);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var logger=require(_0x5621('0x2'))('api');var moment=require(_0x5621('0x3'));var BPromise=require(_0x5621('0x4'));var rp=require(_0x5621('0x5'));var fs=require('fs');var path=require(_0x5621('0x6'));var rimraf=require(_0x5621('0x7'));var config=require(_0x5621('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x52f3c6,_0x5ae3af){return _0x52f3c6[_0x5621('0x9')](_0x5621('0xa'),attributes,{'tableName':_0x5621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index a9626e8..b71222d 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['debug','request\x20sent','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','ChatWebsite,\x20%s,\x20%s'];(function(_0x31b404,_0x28cc15){var _0x5c46cb=function(_0x393ed9){while(--_0x393ed9){_0x31b404['push'](_0x31b404['shift']());}};_0x5c46cb(++_0x28cc15);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});} \ No newline at end of file +var _0x1a85=['catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1a5288,_0x4b41a6){var _0x336e26=function(_0x441118){while(--_0x441118){_0x1a5288['push'](_0x1a5288['shift']());}};_0x336e26(++_0x4b41a6);}(_0x1a85,0x178));var _0x51a8=function(_0x6b23f3,_0x4189c9){_0x6b23f3=_0x6b23f3-0x0;var _0x473e8f=_0x1a85[_0x6b23f3];return _0x473e8f;};'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});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5180d8e..eb907d5 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xb10b,0x12a));var _0xbb10=function(_0x29b997,_0x3f7266){_0x29b997=_0x29b997-0x0;var _0x18fe58=_0xb10b[_0x29b997];return _0x18fe58;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1ed46f,_0x7691d7){var _0x43b931=function(_0x5f2454){while(--_0x5f2454){_0x1ed46f['push'](_0x1ed46f['shift']());}};_0x43b931(++_0x7691d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0xb10b[_0x3b4455];return _0x34dd09;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 890399c..daa7089 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 _0x1b62=['/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','addAvatar','server/files/images/avatars/','now','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','post'];(function(_0x2464e2,_0x373500){var _0x59b9d2=function(_0x4ff855){while(--_0x4ff855){_0x2464e2['push'](_0x2464e2['shift']());}};_0x59b9d2(++_0x373500);}(_0x1b62,0x9a));var _0x21b6=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x1b62[_0x4d7f3f];return _0x5d67cc;};'use strict';var multer=require(_0x21b6('0x0'));var util=require(_0x21b6('0x1'));var path=require(_0x21b6('0x2'));var timeout=require(_0x21b6('0x3'));var express=require('express');var router=express[_0x21b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x21b6('0x5'));var config=require('../../config/environment');var controller=require(_0x21b6('0x6'));router[_0x21b6('0x7')]('/',auth[_0x21b6('0x8')](),controller[_0x21b6('0x9')]);router[_0x21b6('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x21b6('0xa')]);router[_0x21b6('0x7')](_0x21b6('0xb'),auth[_0x21b6('0x8')](),controller[_0x21b6('0xc')]);router[_0x21b6('0x7')]('/:id/dispositions',auth[_0x21b6('0x8')](),controller[_0x21b6('0xd')]);router[_0x21b6('0x7')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller['getAnswers']);router[_0x21b6('0x7')](_0x21b6('0xf'),controller['getLogo']);router[_0x21b6('0x7')](_0x21b6('0x10'),controller['getAvatar']);router[_0x21b6('0x7')](_0x21b6('0x11'),controller[_0x21b6('0x12')]);router['get'](_0x21b6('0x13'),controller[_0x21b6('0x14')]);router[_0x21b6('0x7')](_0x21b6('0x15'),auth[_0x21b6('0x8')](),controller['getInteractions']);router[_0x21b6('0x7')](_0x21b6('0x16'),controller[_0x21b6('0x17')]);router['get']('/:id/applications',auth[_0x21b6('0x8')](),controller[_0x21b6('0x18')]);router['get'](_0x21b6('0x19'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x1a')]);router[_0x21b6('0x7')](_0x21b6('0x1b'),controller[_0x21b6('0x1c')]);router[_0x21b6('0x7')]('/:id/offline_messages',auth[_0x21b6('0x8')](),controller['getOfflineMessages']);router['get'](_0x21b6('0x1d'),auth['isAuthenticated'](),controller[_0x21b6('0x1e')]);router['post']('/',auth[_0x21b6('0x8')](),controller['create']);router[_0x21b6('0x1f')](_0x21b6('0x20'),auth[_0x21b6('0x8')](),controller['addDisposition']);router[_0x21b6('0x1f')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x21')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x8b6615,_0x50d092,_0x5cb7ff){_0x5cb7ff(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],_0x21b6('0x25')));},'filename':function(_0x12d9a4,_0x517660,_0x5ab394){_0x5ab394(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date['now'](),_0x517660[_0x21b6('0x28')]));}})});router[_0x21b6('0x1f')]('/:id/logo',upload[_0x21b6('0x29')]('file'),controller[_0x21b6('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c2a0d,_0x112dd4,_0x9dff2){_0x9dff2(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],'server/files/images/avatars/'));},'filename':function(_0x1767f0,_0x2c09c7,_0x317772){_0x317772(null,util['format']('%s-%s',Date['now'](),_0x2c09c7['originalname']));}})});router[_0x21b6('0x1f')](_0x21b6('0x10'),upload['single']('file'),controller[_0x21b6('0x2b')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x1ccf12,_0x3f9a54,_0x406992){_0x406992(null,path[_0x21b6('0x23')](config['root'],_0x21b6('0x2c')));},'filename':function(_0x171c55,_0x5cb725,_0x1b4886){_0x1b4886(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date[_0x21b6('0x2d')](),_0x5cb725[_0x21b6('0x28')]));}})});router['post'](_0x21b6('0x11'),upload['single']('file'),controller[_0x21b6('0x2e')]);var upload=multer({'storage':multer[_0x21b6('0x22')]({'destination':function(_0x23769e,_0x21a1cb,_0x3beb3f){_0x3beb3f(null,path[_0x21b6('0x23')](config[_0x21b6('0x24')],'server/files/images/avatars/'));},'filename':function(_0x3a109b,_0x3649d5,_0x3bb2cd){_0x3bb2cd(null,util[_0x21b6('0x26')](_0x21b6('0x27'),Date[_0x21b6('0x2d')](),_0x3649d5['originalname']));}})});router[_0x21b6('0x1f')](_0x21b6('0x13'),upload['single']('file'),controller[_0x21b6('0x2f')]);router[_0x21b6('0x1f')]('/:id/notify',controller[_0x21b6('0x30')]);router[_0x21b6('0x1f')](_0x21b6('0x31'),controller[_0x21b6('0x32')]);router[_0x21b6('0x1f')](_0x21b6('0x15'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x33')]);router[_0x21b6('0x1f')](_0x21b6('0x34'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x35')]);router[_0x21b6('0x1f')](_0x21b6('0x19'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x36')]);router[_0x21b6('0x1f')](_0x21b6('0x1d'),auth[_0x21b6('0x8')](),controller['addAgents']);router[_0x21b6('0x37')]('/:id',auth[_0x21b6('0x8')](),controller[_0x21b6('0x38')]);router[_0x21b6('0x39')](_0x21b6('0xb'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x3a')]);router[_0x21b6('0x39')](_0x21b6('0x20'),auth[_0x21b6('0x8')](),controller['removeDispositions']);router[_0x21b6('0x39')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x3b')]);router[_0x21b6('0x39')]('/:id/users',auth['isAuthenticated'](),controller[_0x21b6('0x3c')]);module[_0x21b6('0x3d')]=router; \ No newline at end of file +var _0x5cb1=['/:id/users','create','post','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages'];(function(_0x452b59,_0x162fd3){var _0x15273c=function(_0x10c71f){while(--_0x10c71f){_0x452b59['push'](_0x452b59['shift']());}};_0x15273c(++_0x162fd3);}(_0x5cb1,0x117));var _0x15cb=function(_0x340907,_0x4a9781){_0x340907=_0x340907-0x0;var _0x1cd555=_0x5cb1[_0x340907];return _0x1cd555;};'use strict';var multer=require('multer');var util=require(_0x15cb('0x0'));var path=require(_0x15cb('0x1'));var timeout=require(_0x15cb('0x2'));var express=require(_0x15cb('0x3'));var router=express[_0x15cb('0x4')]();var auth=require(_0x15cb('0x5'));var interaction=require(_0x15cb('0x6'));var config=require(_0x15cb('0x7'));var controller=require(_0x15cb('0x8'));router[_0x15cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x15cb('0xa')]);router[_0x15cb('0x9')](_0x15cb('0xb'),auth[_0x15cb('0xc')](),controller['describe']);router[_0x15cb('0x9')](_0x15cb('0xd'),auth[_0x15cb('0xc')](),controller[_0x15cb('0xe')]);router[_0x15cb('0x9')](_0x15cb('0xf'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x10')]);router[_0x15cb('0x9')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x12')]);router['get']('/:id/logo',controller[_0x15cb('0x13')]);router[_0x15cb('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x15cb('0x9')](_0x15cb('0x14'),controller['getCustomerAvatar']);router[_0x15cb('0x9')](_0x15cb('0x15'),controller[_0x15cb('0x16')]);router[_0x15cb('0x9')](_0x15cb('0x17'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x18')]);router['get']('/:id/snippet',controller['getSnippet']);router[_0x15cb('0x9')](_0x15cb('0x19'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x1a')]);router[_0x15cb('0x9')](_0x15cb('0x1b'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x1c')]);router[_0x15cb('0x9')]('/:id/fields',controller[_0x15cb('0x1d')]);router[_0x15cb('0x9')](_0x15cb('0x1e'),auth[_0x15cb('0xc')](),controller['getOfflineMessages']);router[_0x15cb('0x9')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x15cb('0xc')](),controller[_0x15cb('0x20')]);router[_0x15cb('0x21')](_0x15cb('0xf'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x22')]);router[_0x15cb('0x21')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x4e7b8a,_0x409639,_0x47e693){_0x47e693(null,path[_0x15cb('0x24')](config[_0x15cb('0x25')],'server/files/images/logos/'));},'filename':function(_0x3eee42,_0x3c4fee,_0x33b09e){_0x33b09e(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date[_0x15cb('0x28')](),_0x3c4fee[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')](_0x15cb('0x2a'),upload['single'](_0x15cb('0x2b')),controller[_0x15cb('0x2c')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0xa8f5f7,_0x2e5e7e,_0x593bfc){_0x593bfc(null,path[_0x15cb('0x24')](config[_0x15cb('0x25')],_0x15cb('0x2d')));},'filename':function(_0x4dc8ee,_0x265b83,_0x414916){_0x414916(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date[_0x15cb('0x28')](),_0x265b83[_0x15cb('0x29')]));}})});router['post'](_0x15cb('0x2e'),upload['single'](_0x15cb('0x2b')),controller[_0x15cb('0x2f')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x284ade,_0x3af3ee,_0x30c43e){_0x30c43e(null,path['join'](config['root'],_0x15cb('0x2d')));},'filename':function(_0x58f72b,_0x2f0748,_0x2f414e){_0x2f414e(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date['now'](),_0x2f0748[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')]('/:id/customer_avatar',upload[_0x15cb('0x30')](_0x15cb('0x2b')),controller[_0x15cb('0x31')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x2c8a25,_0x1c306e,_0x406390){_0x406390(null,path[_0x15cb('0x24')](config['root'],_0x15cb('0x2d')));},'filename':function(_0x7f47b9,_0x406cac,_0x284c38){_0x284c38(null,util[_0x15cb('0x26')]('%s-%s',Date[_0x15cb('0x28')](),_0x406cac[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')](_0x15cb('0x15'),upload[_0x15cb('0x30')](_0x15cb('0x2b')),controller[_0x15cb('0x32')]);router['post'](_0x15cb('0x33'),controller[_0x15cb('0x34')]);router[_0x15cb('0x21')](_0x15cb('0x35'),controller['offline']);router[_0x15cb('0x21')]('/:id/interactions',auth[_0x15cb('0xc')](),controller[_0x15cb('0x36')]);router['post'](_0x15cb('0x19'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x37')]);router[_0x15cb('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x15cb('0x38')]);router[_0x15cb('0x21')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller['addAgents']);router[_0x15cb('0x39')](_0x15cb('0xd'),auth['isAuthenticated'](),controller[_0x15cb('0x3a')]);router['delete'](_0x15cb('0xd'),auth[_0x15cb('0xc')](),controller['destroy']);router[_0x15cb('0x3b')](_0x15cb('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x15cb('0x3b')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller['removeAnswers']);router[_0x15cb('0x3b')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller[_0x15cb('0x3c')]);module[_0x15cb('0x3d')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 2ccf74b..3fcaaa0 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 _0x4d68=['Google','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0xc6db2b,_0x3bcc48){var _0x5462d=function(_0x4c636c){while(--_0x4c636c){_0xc6db2b['push'](_0xc6db2b['shift']());}};_0x5462d(++_0x3bcc48);}(_0x4d68,0x1c3));var _0x84d6=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x4d68[_0x290694];return _0x5a0f2e;};'use strict';var Sequelize=require(_0x84d6('0x0'));module[_0x84d6('0x1')]={'name':{'type':Sequelize[_0x84d6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x84d6('0x3')](_0x84d6('0x4'),_0x84d6('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x84d6('0x2')]}}; \ No newline at end of file +var _0x8cad=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x245fd0,_0xcc4572){var _0x166e3b=function(_0x4a6733){while(--_0x4a6733){_0x245fd0['push'](_0x245fd0['shift']());}};_0x166e3b(++_0xcc4572);}(_0x8cad,0xfe));var _0xd8ca=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8cad[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x4'),_0xd8ca('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd8ca('0x2')]},'data2':{'type':Sequelize[_0xd8ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 3be5e6a..b2f8455 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 _0x5d4d=['key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','CloudProvider','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x15f724,_0x2794ef){var _0x49b152=function(_0x561b35){while(--_0x561b35){_0x15f724['push'](_0x15f724['shift']());}};_0x49b152(++_0x2794ef);}(_0x5d4d,0xb4));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd5d4('0x0'));var emlformat=require(_0xd5d4('0x1'));var rimraf=require(_0xd5d4('0x2'));var zipdir=require(_0xd5d4('0x3'));var jsonpatch=require(_0xd5d4('0x4'));var rp=require(_0xd5d4('0x5'));var moment=require(_0xd5d4('0x6'));var BPromise=require(_0xd5d4('0x7'));var Mustache=require(_0xd5d4('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd5d4('0x9'));var csv=require(_0xd5d4('0xa'));var ejs=require(_0xd5d4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd5d4('0xc'));var crypto=require(_0xd5d4('0xd'));var jsforce=require(_0xd5d4('0xe'));var deskjs=require(_0xd5d4('0xf'));var toCsv=require(_0xd5d4('0xa'));var querystring=require(_0xd5d4('0x10'));var Papa=require(_0xd5d4('0x11'));var Redis=require(_0xd5d4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd5d4('0x13'));var as=require(_0xd5d4('0x14'));var hardwareService=require(_0xd5d4('0x15'));var logger=require('../../config/logger')(_0xd5d4('0x16'));var utils=require(_0xd5d4('0x17'));var config=require(_0xd5d4('0x18'));var licenseUtil=require(_0xd5d4('0x19'));var db=require(_0xd5d4('0x1a'))['db'];function respondWithStatusCode(_0x30bfa5,_0x414644){_0x414644=_0x414644||0xcc;return function(_0x2f190f){if(_0x2f190f){return _0x30bfa5[_0xd5d4('0x1b')](_0x414644);}return _0x30bfa5[_0xd5d4('0x1c')](_0x414644)[_0xd5d4('0x1d')]();};}function respondWithResult(_0x48da47,_0x44d74b){_0x44d74b=_0x44d74b||0xc8;return function(_0x13acea){if(_0x13acea){return _0x48da47[_0xd5d4('0x1c')](_0x44d74b)[_0xd5d4('0x1e')](_0x13acea);}};}function respondWithFilteredResult(_0x271edf,_0x4b9232){return function(_0x393b19){if(_0x393b19){var _0x4044c9=_0x393b19[_0xd5d4('0x1f')],_0x3cafac=_0x4b9232['offset'],_0xba251e=_0x4b9232[_0xd5d4('0x20')]+_0x4b9232[_0xd5d4('0x21')],_0x24aad3;if(_0xba251e>=_0x4044c9){_0xba251e=_0x4044c9;_0x24aad3=0xc8;}else{_0x24aad3=0xce;}_0x271edf[_0xd5d4('0x1c')](_0x24aad3);return _0x271edf[_0xd5d4('0x22')](_0xd5d4('0x23'),_0x3cafac+'-'+_0xba251e+'/'+_0x4044c9)[_0xd5d4('0x1e')](_0x393b19);}return null;};}function patchUpdates(_0x342f67){return function(_0x572e7a){try{jsonpatch[_0xd5d4('0x24')](_0x572e7a,_0x342f67,!![]);}catch(_0x5b9ee5){return BPromise[_0xd5d4('0x25')](_0x5b9ee5);}return _0x572e7a[_0xd5d4('0x26')]();};}function saveUpdates(_0x18fd9d,_0x499c52){return function(_0x69c26a){if(_0x69c26a){return _0x69c26a[_0xd5d4('0x27')](_0x18fd9d)['then'](function(_0x50e8d2){return _0x50e8d2;});}return null;};}function removeEntity(_0x3cad60,_0x2f93d0){return function(_0x5d0f03){if(_0x5d0f03){return _0x5d0f03['destroy']()[_0xd5d4('0x28')](function(){_0x3cad60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e3ce,_0x224bfe){return function(_0x2a9f88){if(!_0x2a9f88){_0x38e3ce[_0xd5d4('0x1b')](0x194);}return _0x2a9f88;};}function handleError(_0xf602a4,_0x418e5a){_0x418e5a=_0x418e5a||0x1f4;return function(_0x4d9219){logger['error'](_0x4d9219['stack']);if(_0x4d9219['name']){delete _0x4d9219[_0xd5d4('0x29')];}_0xf602a4[_0xd5d4('0x1c')](_0x418e5a)[_0xd5d4('0x2a')](_0x4d9219);};}exports[_0xd5d4('0x2b')]=function(_0x27aaf9,_0x38a84f){var _0x22d1a2={},_0xdc02b={},_0x3739e2={'count':0x0,'rows':[]};var _0xb1c03f=_[_0xd5d4('0x2c')](db['CloudProvider'][_0xd5d4('0x2d')],function(_0x363e62){return{'name':_0x363e62[_0xd5d4('0x2e')],'type':_0x363e62[_0xd5d4('0x2f')][_0xd5d4('0x30')]};});_0xdc02b[_0xd5d4('0x31')]=_['map'](_0xb1c03f,_0xd5d4('0x29'));_0xdc02b['query']=_[_0xd5d4('0x32')](_0x27aaf9[_0xd5d4('0x33')]);_0xdc02b['filters']=_[_0xd5d4('0x34')](_0xdc02b[_0xd5d4('0x31')],_0xdc02b[_0xd5d4('0x33')]);_0x22d1a2[_0xd5d4('0x35')]=_[_0xd5d4('0x34')](_0xdc02b[_0xd5d4('0x31')],qs[_0xd5d4('0x36')](_0x27aaf9[_0xd5d4('0x33')]['fields']));_0x22d1a2['attributes']=_0x22d1a2['attributes'][_0xd5d4('0x37')]?_0x22d1a2['attributes']:_0xdc02b[_0xd5d4('0x31')];if(!_0x27aaf9['query'][_0xd5d4('0x38')](_0xd5d4('0x39'))){_0x22d1a2[_0xd5d4('0x21')]=qs[_0xd5d4('0x21')](_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x21')]);_0x22d1a2[_0xd5d4('0x20')]=qs['offset'](_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x20')]);}_0x22d1a2[_0xd5d4('0x3a')]=qs[_0xd5d4('0x3b')](_0x27aaf9[_0xd5d4('0x33')]['sort']);_0x22d1a2[_0xd5d4('0x3c')]=qs['filters'](_[_0xd5d4('0x3d')](_0x27aaf9[_0xd5d4('0x33')],_0xdc02b[_0xd5d4('0x3e')]),_0xb1c03f);if(_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x3f')]){_0x22d1a2['where']=_[_0xd5d4('0x40')](_0x22d1a2['where'],{'$or':_[_0xd5d4('0x2c')](_0xb1c03f,function(_0x2ff8d9){if(_0x2ff8d9['type']!=='VIRTUAL'){var _0x25ec4a={};_0x25ec4a[_0x2ff8d9[_0xd5d4('0x29')]]={'$like':'%'+_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x3f')]+'%'};return _0x25ec4a;}})});}_0x22d1a2=_[_0xd5d4('0x40')]({},_0x22d1a2,_0x27aaf9[_0xd5d4('0x41')]);var _0x146582={'where':_0x22d1a2[_0xd5d4('0x3c')]};return db[_0xd5d4('0x42')][_0xd5d4('0x1f')](_0x146582)[_0xd5d4('0x28')](function(_0x4397cd){_0x3739e2[_0xd5d4('0x1f')]=_0x4397cd;if(_0x27aaf9[_0xd5d4('0x33')][_0xd5d4('0x43')]){_0x22d1a2[_0xd5d4('0x44')]=[{'all':!![]}];}return db['CloudProvider'][_0xd5d4('0x45')](_0x22d1a2);})[_0xd5d4('0x28')](function(_0x9e95f4){_0x3739e2[_0xd5d4('0x46')]=_0x9e95f4;return _0x3739e2;})[_0xd5d4('0x28')](respondWithFilteredResult(_0x38a84f,_0x22d1a2))[_0xd5d4('0x47')](handleError(_0x38a84f,null));};exports['show']=function(_0x5e2258,_0x355253){var _0x1315fd={'raw':!![],'where':{'id':_0x5e2258['params']['id']}},_0x23f9f9={};_0x23f9f9[_0xd5d4('0x31')]=_[_0xd5d4('0x32')](db[_0xd5d4('0x42')][_0xd5d4('0x2d')]);_0x23f9f9[_0xd5d4('0x33')]=_[_0xd5d4('0x32')](_0x5e2258['query']);_0x23f9f9[_0xd5d4('0x3e')]=_['intersection'](_0x23f9f9[_0xd5d4('0x31')],_0x23f9f9[_0xd5d4('0x33')]);_0x1315fd[_0xd5d4('0x35')]=_[_0xd5d4('0x34')](_0x23f9f9[_0xd5d4('0x31')],qs[_0xd5d4('0x36')](_0x5e2258['query'][_0xd5d4('0x36')]));_0x1315fd[_0xd5d4('0x35')]=_0x1315fd[_0xd5d4('0x35')][_0xd5d4('0x37')]?_0x1315fd[_0xd5d4('0x35')]:_0x23f9f9[_0xd5d4('0x31')];if(_0x5e2258['query'][_0xd5d4('0x43')]){_0x1315fd['include']=[{'all':!![]}];}_0x1315fd=_[_0xd5d4('0x40')]({},_0x1315fd,_0x5e2258[_0xd5d4('0x41')]);return db[_0xd5d4('0x42')][_0xd5d4('0x48')](_0x1315fd)[_0xd5d4('0x28')](handleEntityNotFound(_0x355253,null))[_0xd5d4('0x28')](respondWithResult(_0x355253,null))[_0xd5d4('0x47')](handleError(_0x355253,null));};exports[_0xd5d4('0x49')]=function(_0x465284,_0x16d354){return db[_0xd5d4('0x42')][_0xd5d4('0x49')](_0x465284[_0xd5d4('0x4a')],{})[_0xd5d4('0x28')](respondWithResult(_0x16d354,0xc9))[_0xd5d4('0x47')](handleError(_0x16d354,null));};exports[_0xd5d4('0x27')]=function(_0x540dec,_0x27edb0){if(_0x540dec['body']['id']){delete _0x540dec[_0xd5d4('0x4a')]['id'];}return db[_0xd5d4('0x42')]['find']({'where':{'id':_0x540dec['params']['id']}})[_0xd5d4('0x28')](handleEntityNotFound(_0x27edb0,null))[_0xd5d4('0x28')](saveUpdates(_0x540dec['body'],null))['then'](respondWithResult(_0x27edb0,null))['catch'](handleError(_0x27edb0,null));};exports['destroy']=function(_0x17a3fa,_0x4091bf){return db[_0xd5d4('0x42')]['find']({'where':{'id':_0x17a3fa[_0xd5d4('0x4b')]['id']}})[_0xd5d4('0x28')](handleEntityNotFound(_0x4091bf,null))[_0xd5d4('0x28')](removeEntity(_0x4091bf,null))[_0xd5d4('0x47')](handleError(_0x4091bf,null));}; \ No newline at end of file +var _0x936a=['error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x936a,0x103));var _0xa936=function(_0x87395d,_0x2a89c3){_0x87395d=_0x87395d-0x0;var _0x396385=_0x936a[_0x87395d];return _0x396385;};'use strict';var pdf=require(_0xa936('0x0'));var emlformat=require(_0xa936('0x1'));var rimraf=require(_0xa936('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa936('0x5'));var path=require('path');var sox=require(_0xa936('0x6'));var csv=require(_0xa936('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa936('0x8'));var crypto=require(_0xa936('0x9'));var jsforce=require(_0xa936('0xa'));var deskjs=require(_0xa936('0xb'));var toCsv=require(_0xa936('0x7'));var querystring=require(_0xa936('0xc'));var Papa=require(_0xa936('0xd'));var Redis=require(_0xa936('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa936('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa936('0x10'));var logger=require('../../config/logger')(_0xa936('0x11'));var utils=require(_0xa936('0x12'));var config=require(_0xa936('0x13'));var licenseUtil=require(_0xa936('0x14'));var db=require(_0xa936('0x15'))['db'];function respondWithStatusCode(_0x408a6b,_0x32f8fc){_0x32f8fc=_0x32f8fc||0xcc;return function(_0x31d62f){if(_0x31d62f){return _0x408a6b[_0xa936('0x16')](_0x32f8fc);}return _0x408a6b[_0xa936('0x17')](_0x32f8fc)[_0xa936('0x18')]();};}function respondWithResult(_0x1adfb3,_0x4e4c2e){_0x4e4c2e=_0x4e4c2e||0xc8;return function(_0x3d3586){if(_0x3d3586){return _0x1adfb3[_0xa936('0x17')](_0x4e4c2e)[_0xa936('0x19')](_0x3d3586);}};}function respondWithFilteredResult(_0x12ea91,_0x3dab2c){return function(_0x17ab3d){if(_0x17ab3d){var _0x47bfdd=_0x17ab3d[_0xa936('0x1a')],_0x930991=_0x3dab2c[_0xa936('0x1b')],_0x1c4655=_0x3dab2c[_0xa936('0x1b')]+_0x3dab2c[_0xa936('0x1c')],_0x45640c;if(_0x1c4655>=_0x47bfdd){_0x1c4655=_0x47bfdd;_0x45640c=0xc8;}else{_0x45640c=0xce;}_0x12ea91[_0xa936('0x17')](_0x45640c);return _0x12ea91[_0xa936('0x1d')](_0xa936('0x1e'),_0x930991+'-'+_0x1c4655+'/'+_0x47bfdd)['json'](_0x17ab3d);}return null;};}function patchUpdates(_0x541f84){return function(_0x292eca){try{jsonpatch[_0xa936('0x1f')](_0x292eca,_0x541f84,!![]);}catch(_0x1c627c){return BPromise[_0xa936('0x20')](_0x1c627c);}return _0x292eca[_0xa936('0x21')]();};}function saveUpdates(_0x2a354a,_0x4903b1){return function(_0x430347){if(_0x430347){return _0x430347[_0xa936('0x22')](_0x2a354a)[_0xa936('0x23')](function(_0x50e8a5){return _0x50e8a5;});}return null;};}function removeEntity(_0x23fece,_0x1b0985){return function(_0x337046){if(_0x337046){return _0x337046[_0xa936('0x24')]()[_0xa936('0x23')](function(){_0x23fece[_0xa936('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ae4a9,_0xdd6a13){return function(_0x58a780){if(!_0x58a780){_0x7ae4a9[_0xa936('0x16')](0x194);}return _0x58a780;};}function handleError(_0x41bdee,_0x3709a6){_0x3709a6=_0x3709a6||0x1f4;return function(_0x481f57){logger[_0xa936('0x25')](_0x481f57[_0xa936('0x26')]);if(_0x481f57[_0xa936('0x27')]){delete _0x481f57[_0xa936('0x27')];}_0x41bdee[_0xa936('0x17')](_0x3709a6)[_0xa936('0x28')](_0x481f57);};}exports[_0xa936('0x29')]=function(_0x2c6363,_0x2d1936){var _0x3ff2ee={},_0x374f1e={},_0x255a89={'count':0x0,'rows':[]};var _0x35af68=_[_0xa936('0x2a')](db[_0xa936('0x2b')][_0xa936('0x2c')],function(_0x581c09){return{'name':_0x581c09[_0xa936('0x2d')],'type':_0x581c09[_0xa936('0x2e')]['key']};});_0x374f1e[_0xa936('0x2f')]=_['map'](_0x35af68,'name');_0x374f1e[_0xa936('0x30')]=_[_0xa936('0x31')](_0x2c6363[_0xa936('0x30')]);_0x374f1e[_0xa936('0x32')]=_[_0xa936('0x33')](_0x374f1e['model'],_0x374f1e[_0xa936('0x30')]);_0x3ff2ee[_0xa936('0x34')]=_[_0xa936('0x33')](_0x374f1e[_0xa936('0x2f')],qs[_0xa936('0x35')](_0x2c6363[_0xa936('0x30')][_0xa936('0x35')]));_0x3ff2ee[_0xa936('0x34')]=_0x3ff2ee[_0xa936('0x34')]['length']?_0x3ff2ee['attributes']:_0x374f1e[_0xa936('0x2f')];if(!_0x2c6363[_0xa936('0x30')]['hasOwnProperty'](_0xa936('0x36'))){_0x3ff2ee[_0xa936('0x1c')]=qs[_0xa936('0x1c')](_0x2c6363['query']['limit']);_0x3ff2ee['offset']=qs[_0xa936('0x1b')](_0x2c6363[_0xa936('0x30')][_0xa936('0x1b')]);}_0x3ff2ee[_0xa936('0x37')]=qs[_0xa936('0x38')](_0x2c6363['query'][_0xa936('0x38')]);_0x3ff2ee[_0xa936('0x39')]=qs[_0xa936('0x32')](_[_0xa936('0x3a')](_0x2c6363[_0xa936('0x30')],_0x374f1e['filters']),_0x35af68);if(_0x2c6363[_0xa936('0x30')][_0xa936('0x3b')]){_0x3ff2ee['where']=_[_0xa936('0x3c')](_0x3ff2ee[_0xa936('0x39')],{'$or':_[_0xa936('0x2a')](_0x35af68,function(_0xdfa154){if(_0xdfa154[_0xa936('0x2e')]!==_0xa936('0x3d')){var _0x4a0cd2={};_0x4a0cd2[_0xdfa154['name']]={'$like':'%'+_0x2c6363[_0xa936('0x30')][_0xa936('0x3b')]+'%'};return _0x4a0cd2;}})});}_0x3ff2ee=_['merge']({},_0x3ff2ee,_0x2c6363[_0xa936('0x3e')]);var _0x41c677={'where':_0x3ff2ee[_0xa936('0x39')]};return db[_0xa936('0x2b')][_0xa936('0x1a')](_0x41c677)[_0xa936('0x23')](function(_0x731ff2){_0x255a89[_0xa936('0x1a')]=_0x731ff2;if(_0x2c6363[_0xa936('0x30')][_0xa936('0x3f')]){_0x3ff2ee[_0xa936('0x40')]=[{'all':!![]}];}return db[_0xa936('0x2b')][_0xa936('0x41')](_0x3ff2ee);})['then'](function(_0xe005a1){_0x255a89[_0xa936('0x42')]=_0xe005a1;return _0x255a89;})[_0xa936('0x23')](respondWithFilteredResult(_0x2d1936,_0x3ff2ee))[_0xa936('0x43')](handleError(_0x2d1936,null));};exports[_0xa936('0x44')]=function(_0x4ea49c,_0xce06da){var _0x5f192f={'raw':!![],'where':{'id':_0x4ea49c[_0xa936('0x45')]['id']}},_0x321418={};_0x321418[_0xa936('0x2f')]=_[_0xa936('0x31')](db[_0xa936('0x2b')]['rawAttributes']);_0x321418['query']=_[_0xa936('0x31')](_0x4ea49c[_0xa936('0x30')]);_0x321418['filters']=_[_0xa936('0x33')](_0x321418['model'],_0x321418[_0xa936('0x30')]);_0x5f192f['attributes']=_[_0xa936('0x33')](_0x321418[_0xa936('0x2f')],qs['fields'](_0x4ea49c['query'][_0xa936('0x35')]));_0x5f192f['attributes']=_0x5f192f[_0xa936('0x34')][_0xa936('0x46')]?_0x5f192f['attributes']:_0x321418[_0xa936('0x2f')];if(_0x4ea49c['query'][_0xa936('0x3f')]){_0x5f192f[_0xa936('0x40')]=[{'all':!![]}];}_0x5f192f=_['merge']({},_0x5f192f,_0x4ea49c[_0xa936('0x3e')]);return db[_0xa936('0x2b')][_0xa936('0x47')](_0x5f192f)['then'](handleEntityNotFound(_0xce06da,null))['then'](respondWithResult(_0xce06da,null))['catch'](handleError(_0xce06da,null));};exports[_0xa936('0x48')]=function(_0x13c0d3,_0x119c8c){return db[_0xa936('0x2b')][_0xa936('0x48')](_0x13c0d3[_0xa936('0x49')],{})['then'](respondWithResult(_0x119c8c,0xc9))['catch'](handleError(_0x119c8c,null));};exports[_0xa936('0x22')]=function(_0x11cb82,_0x440fed){if(_0x11cb82[_0xa936('0x49')]['id']){delete _0x11cb82[_0xa936('0x49')]['id'];}return db[_0xa936('0x2b')]['find']({'where':{'id':_0x11cb82['params']['id']}})[_0xa936('0x23')](handleEntityNotFound(_0x440fed,null))['then'](saveUpdates(_0x11cb82[_0xa936('0x49')],null))['then'](respondWithResult(_0x440fed,null))[_0xa936('0x43')](handleError(_0x440fed,null));};exports[_0xa936('0x24')]=function(_0x498d1d,_0x4730f3){return db[_0xa936('0x2b')][_0xa936('0x47')]({'where':{'id':_0x498d1d[_0xa936('0x45')]['id']}})[_0xa936('0x23')](handleEntityNotFound(_0x4730f3,null))[_0xa936('0x23')](removeEntity(_0x4730f3,null))['catch'](handleError(_0x4730f3,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 199f21e..16757c4 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 _0x580d=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x580d,0x113));var _0xd580=function(_0x57b286,_0x19fdeb){_0x57b286=_0x57b286-0x0;var _0x4efce9=_0x580d[_0x57b286];return _0x4efce9;};'use strict';var _=require(_0xd580('0x0'));var util=require(_0xd580('0x1'));var logger=require(_0xd580('0x2'))(_0xd580('0x3'));var moment=require(_0xd580('0x4'));var BPromise=require('bluebird');var rp=require(_0xd580('0x5'));var fs=require('fs');var path=require(_0xd580('0x6'));var rimraf=require('rimraf');var config=require(_0xd580('0x7'));var attributes=require(_0xd580('0x8'));module[_0xd580('0x9')]=function(_0x356a2e,_0x3e2b6f){return _0x356a2e['define'](_0xd580('0xa'),attributes,{'tableName':_0xd580('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf647=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','moment','request-promise','path','../../config/environment'];(function(_0x5c9655,_0x431222){var _0x552d60=function(_0x48c502){while(--_0x48c502){_0x5c9655['push'](_0x5c9655['shift']());}};_0x552d60(++_0x431222);}(_0xf647,0x18a));var _0x7f64=function(_0x4db622,_0x449ae1){_0x4db622=_0x4db622-0x0;var _0x477f5b=_0xf647[_0x4db622];return _0x477f5b;};'use strict';var _=require(_0x7f64('0x0'));var util=require(_0x7f64('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f64('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f64('0x3'));var fs=require('fs');var path=require(_0x7f64('0x4'));var rimraf=require('rimraf');var config=require(_0x7f64('0x5'));var attributes=require(_0x7f64('0x6'));module[_0x7f64('0x7')]=function(_0x441375,_0x1a3194){return _0x441375[_0x7f64('0x8')](_0x7f64('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index d7facad..51c6de8 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 _0xebad=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s'];(function(_0x174fc6,_0x28bf3c){var _0x55577a=function(_0x27a999){while(--_0x27a999){_0x174fc6['push'](_0x174fc6['shift']());}};_0x55577a(++_0x28bf3c);}(_0xebad,0x14d));var _0xdeba=function(_0xa4aa3b,_0x58401f){_0xa4aa3b=_0xa4aa3b-0x0;var _0x2dfee4=_0xebad[_0xa4aa3b];return _0x2dfee4;};'use strict';var _=require(_0xdeba('0x0'));var util=require('util');var moment=require(_0xdeba('0x1'));var BPromise=require(_0xdeba('0x2'));var rs=require(_0xdeba('0x3'));var fs=require('fs');var Redis=require(_0xdeba('0x4'));var db=require(_0xdeba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeba('0x6'))('rpc');var config=require(_0xdeba('0x7'));var jayson=require(_0xdeba('0x8'));var client=jayson['client'][_0xdeba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57f332,_0x7ed1e5,_0x39c4ed){return new BPromise(function(_0x59bd14,_0x589efe){return client[_0xdeba('0xa')](_0x57f332,_0x39c4ed)[_0xdeba('0xb')](function(_0x194317){logger['info']('CloudProvider,\x20%s,\x20%s',_0x7ed1e5,_0xdeba('0xc'));logger[_0xdeba('0xd')](_0xdeba('0xe'),_0x7ed1e5,_0xdeba('0xc'),JSON[_0xdeba('0xf')](_0x194317));if(_0x194317[_0xdeba('0x10')]){if(_0x194317[_0xdeba('0x10')][_0xdeba('0x11')]===0x1f4){logger[_0xdeba('0x10')](_0xdeba('0x12'),_0x7ed1e5,_0x194317[_0xdeba('0x10')][_0xdeba('0x13')]);return _0x589efe(_0x194317[_0xdeba('0x10')]['message']);}logger[_0xdeba('0x10')]('CloudProvider,\x20%s,\x20%s',_0x7ed1e5,_0x194317['error'][_0xdeba('0x13')]);return _0x59bd14(_0x194317[_0xdeba('0x10')]['message']);}else{logger[_0xdeba('0x14')](_0xdeba('0x12'),_0x7ed1e5,_0xdeba('0xc'));_0x59bd14(_0x194317[_0xdeba('0x15')][_0xdeba('0x13')]);}})['catch'](function(_0xe101c1){logger['error'](_0xdeba('0x12'),_0x7ed1e5,_0xe101c1);_0x589efe(_0xe101c1);});});} \ No newline at end of file +var _0x4c59=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x4c59,0xa3));var _0x94c5=function(_0x3386a6,_0x474678){_0x3386a6=_0x3386a6-0x0;var _0x362b74=_0x4c59[_0x3386a6];return _0x362b74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94c5('0x0'));var BPromise=require(_0x94c5('0x1'));var rs=require(_0x94c5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c5('0x3'))['db'];var utils=require(_0x94c5('0x4'));var logger=require(_0x94c5('0x5'))(_0x94c5('0x6'));var config=require(_0x94c5('0x7'));var jayson=require(_0x94c5('0x8'));var client=jayson[_0x94c5('0x9')][_0x94c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9ba0,_0x57140a,_0x50f96b){return new BPromise(function(_0x53a626,_0x1e5b53){return client[_0x94c5('0xb')](_0x3f9ba0,_0x50f96b)[_0x94c5('0xc')](function(_0x136345){logger[_0x94c5('0xd')](_0x94c5('0xe'),_0x57140a,_0x94c5('0xf'));logger['debug'](_0x94c5('0x10'),_0x57140a,_0x94c5('0xf'),JSON[_0x94c5('0x11')](_0x136345));if(_0x136345['error']){if(_0x136345[_0x94c5('0x12')][_0x94c5('0x13')]===0x1f4){logger['error'](_0x94c5('0xe'),_0x57140a,_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);return _0x1e5b53(_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);}logger[_0x94c5('0x12')]('CloudProvider,\x20%s,\x20%s',_0x57140a,_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);return _0x53a626(_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);}else{logger[_0x94c5('0xd')]('CloudProvider,\x20%s,\x20%s',_0x57140a,_0x94c5('0xf'));_0x53a626(_0x136345['result'][_0x94c5('0x14')]);}})['catch'](function(_0x16e616){logger[_0x94c5('0x12')](_0x94c5('0xe'),_0x57140a,_0x16e616);_0x1e5b53(_0x16e616);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 218565c..59edc19 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 _0xd84b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','post','create','/:id','update','exports','util','path','connect-timeout','express'];(function(_0x5be285,_0x590183){var _0x5f1fe1=function(_0x4cb30b){while(--_0x4cb30b){_0x5be285['push'](_0x5be285['shift']());}};_0x5f1fe1(++_0x590183);}(_0xd84b,0x1a0));var _0xbd84=function(_0x3b2503,_0x5b107b){_0x3b2503=_0x3b2503-0x0;var _0x3fdef0=_0xd84b[_0x3b2503];return _0x3fdef0;};'use strict';var multer=require('multer');var util=require(_0xbd84('0x0'));var path=require(_0xbd84('0x1'));var timeout=require(_0xbd84('0x2'));var express=require(_0xbd84('0x3'));var router=express[_0xbd84('0x4')]();var auth=require(_0xbd84('0x5'));var interaction=require(_0xbd84('0x6'));var config=require(_0xbd84('0x7'));var controller=require(_0xbd84('0x8'));router['get']('/',auth[_0xbd84('0x9')](),controller['index']);router['get']('/:id',auth[_0xbd84('0x9')](),controller['show']);router[_0xbd84('0xa')]('/',auth['isAuthenticated'](),controller[_0xbd84('0xb')]);router['put'](_0xbd84('0xc'),auth['isAuthenticated'](),controller[_0xbd84('0xd')]);router['delete'](_0xbd84('0xc'),auth[_0xbd84('0x9')](),controller['destroy']);module[_0xbd84('0xe')]=router; \ No newline at end of file +var _0xa9c0=['./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f1749,_0x998e73){var _0x9a9ab3=function(_0x37ee0b){while(--_0x37ee0b){_0x4f1749['push'](_0x4f1749['shift']());}};_0x9a9ab3(++_0x998e73);}(_0xa9c0,0x6a));var _0x0a9c=function(_0x8a268b,_0xcdad0c){_0x8a268b=_0x8a268b-0x0;var _0x1a909e=_0xa9c0[_0x8a268b];return _0x1a909e;};'use strict';var multer=require(_0x0a9c('0x0'));var util=require(_0x0a9c('0x1'));var path=require('path');var timeout=require(_0x0a9c('0x2'));var express=require(_0x0a9c('0x3'));var router=express[_0x0a9c('0x4')]();var auth=require(_0x0a9c('0x5'));var interaction=require(_0x0a9c('0x6'));var config=require(_0x0a9c('0x7'));var controller=require(_0x0a9c('0x8'));router[_0x0a9c('0x9')]('/',auth[_0x0a9c('0xa')](),controller[_0x0a9c('0xb')]);router['get'](_0x0a9c('0xc'),auth['isAuthenticated'](),controller[_0x0a9c('0xd')]);router[_0x0a9c('0xe')]('/',auth['isAuthenticated'](),controller[_0x0a9c('0xf')]);router[_0x0a9c('0x10')](_0x0a9c('0xc'),auth[_0x0a9c('0xa')](),controller[_0x0a9c('0x11')]);router['delete'](_0x0a9c('0xc'),auth[_0x0a9c('0xa')](),controller['destroy']);module[_0x0a9c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f1c1865..76f8b43 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 _0x458e=['exports','STRING'];(function(_0x2ca1eb,_0xff2bce){var _0x554ae2=function(_0x19b255){while(--_0x19b255){_0x2ca1eb['push'](_0x2ca1eb['shift']());}};_0x554ae2(++_0xff2bce);}(_0x458e,0x9a));var _0xe458=function(_0x587fbb,_0x52a0d9){_0x587fbb=_0x587fbb-0x0;var _0x488b05=_0x458e[_0x587fbb];return _0x488b05;};'use strict';var Sequelize=require('sequelize');module[_0xe458('0x0')]={'name':{'type':Sequelize[_0xe458('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe458('0x1')]},'companyId':{'type':Sequelize[_0xe458('0x1')]},'website':{'type':Sequelize[_0xe458('0x1')]},'phone':{'type':Sequelize[_0xe458('0x1')]},'fax':{'type':Sequelize[_0xe458('0x1')]},'type':{'type':Sequelize[_0xe458('0x1')]},'street':{'type':Sequelize[_0xe458('0x1')]},'postalCode':{'type':Sequelize[_0xe458('0x1')]},'city':{'type':Sequelize[_0xe458('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe458('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe458('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe458('0x1')]},'sCity':{'type':Sequelize[_0xe458('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe458('0x1')]}}; \ No newline at end of file +var _0xbba6=['name','exports','STRING'];(function(_0x1180c7,_0x11eaf0){var _0x150b77=function(_0x53fe27){while(--_0x53fe27){_0x1180c7['push'](_0x1180c7['shift']());}};_0x150b77(++_0x11eaf0);}(_0xbba6,0x133));var _0x6bba=function(_0x2caff6,_0x3aed98){_0x2caff6=_0x2caff6-0x0;var _0x544461=_0xbba6[_0x2caff6];return _0x544461;};'use strict';var Sequelize=require('sequelize');module[_0x6bba('0x0')]={'name':{'type':Sequelize[_0x6bba('0x1')],'unique':_0x6bba('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6bba('0x1')]},'companyId':{'type':Sequelize[_0x6bba('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6bba('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6bba('0x1')]},'city':{'type':Sequelize[_0x6bba('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6bba('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6bba('0x1')]},'sStreet':{'type':Sequelize[_0x6bba('0x1')]},'sPostalCode':{'type':Sequelize[_0x6bba('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6bba('0x1')]},'description':{'type':Sequelize[_0x6bba('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4725543..8cebe3f 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 _0x1974=['reject','save','update','destroy','then','get','sendStatus','name','index','describe','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','pick','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x37a6fb,_0x5a6cf9){var _0x4980f9=function(_0x3b3951){while(--_0x3b3951){_0x37a6fb['push'](_0x37a6fb['shift']());}};_0x4980f9(++_0x5a6cf9);}(_0x1974,0xe4));var _0x4197=function(_0x2cde44,_0x522a1e){_0x2cde44=_0x2cde44-0x0;var _0x4ece2e=_0x1974[_0x2cde44];return _0x4ece2e;};'use strict';var pdf=require(_0x4197('0x0'));var emlformat=require(_0x4197('0x1'));var rimraf=require(_0x4197('0x2'));var zipdir=require(_0x4197('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4197('0x4'));var BPromise=require(_0x4197('0x5'));var Mustache=require('mustache');var util=require(_0x4197('0x6'));var path=require(_0x4197('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4197('0x8'));var fs=require('fs');var _=require(_0x4197('0x9'));var squel=require('squel');var crypto=require(_0x4197('0xa'));var jsforce=require(_0x4197('0xb'));var deskjs=require(_0x4197('0xc'));var toCsv=require(_0x4197('0xd'));var querystring=require(_0x4197('0xe'));var Papa=require('papaparse');var Redis=require(_0x4197('0xf'));var authService=require(_0x4197('0x10'));var qs=require(_0x4197('0x11'));var as=require(_0x4197('0x12'));var hardwareService=require(_0x4197('0x13'));var logger=require(_0x4197('0x14'))(_0x4197('0x15'));var utils=require('../../config/utils');var config=require(_0x4197('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4197('0x17'))['db'];function respondWithStatusCode(_0x35796b,_0x1670ae){_0x1670ae=_0x1670ae||0xcc;return function(_0x20ba35){if(_0x20ba35){return _0x35796b['sendStatus'](_0x1670ae);}return _0x35796b[_0x4197('0x18')](_0x1670ae)[_0x4197('0x19')]();};}function respondWithResult(_0x3581c5,_0x2d871a){_0x2d871a=_0x2d871a||0xc8;return function(_0x1d14ba){if(_0x1d14ba){return _0x3581c5[_0x4197('0x18')](_0x2d871a)[_0x4197('0x1a')](_0x1d14ba);}};}function respondWithFilteredResult(_0x1728f5,_0x4d9a44){return function(_0x567135){if(_0x567135){var _0x278c1d=_0x567135[_0x4197('0x1b')],_0x177ec5=_0x4d9a44[_0x4197('0x1c')],_0x2cdc24=_0x4d9a44[_0x4197('0x1c')]+_0x4d9a44[_0x4197('0x1d')],_0x3cb377;if(_0x2cdc24>=_0x278c1d){_0x2cdc24=_0x278c1d;_0x3cb377=0xc8;}else{_0x3cb377=0xce;}_0x1728f5[_0x4197('0x18')](_0x3cb377);return _0x1728f5[_0x4197('0x1e')](_0x4197('0x1f'),_0x177ec5+'-'+_0x2cdc24+'/'+_0x278c1d)[_0x4197('0x1a')](_0x567135);}return null;};}function patchUpdates(_0x4c11c1){return function(_0x5f1c24){try{jsonpatch[_0x4197('0x20')](_0x5f1c24,_0x4c11c1,!![]);}catch(_0x44bf7b){return BPromise[_0x4197('0x21')](_0x44bf7b);}return _0x5f1c24[_0x4197('0x22')]();};}function saveUpdates(_0x5ee45d,_0x2ae73e){return function(_0x49c148){if(_0x49c148){return _0x49c148[_0x4197('0x23')](_0x5ee45d)['then'](function(_0x313072){return _0x313072;});}return null;};}function removeEntity(_0x8997fa,_0x1d1dd4){return function(_0x2ed0be){if(_0x2ed0be){return _0x2ed0be[_0x4197('0x24')]()[_0x4197('0x25')](function(){var _0x2459bd=_0x2ed0be[_0x4197('0x26')]({'plain':!![]});var _0x58e8da='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x58e8da,'resourceId':_0x2459bd['id']}})[_0x4197('0x25')](function(){return _0x2ed0be;});})[_0x4197('0x25')](function(){_0x8997fa[_0x4197('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f4e8,_0x528dac){return function(_0x4ea3fb){if(!_0x4ea3fb){_0x43f4e8[_0x4197('0x27')](0x194);}return _0x4ea3fb;};}function handleError(_0x14fea7,_0x98d033){_0x98d033=_0x98d033||0x1f4;return function(_0x46c7da){logger['error'](_0x46c7da['stack']);if(_0x46c7da[_0x4197('0x28')]){delete _0x46c7da[_0x4197('0x28')];}_0x14fea7['status'](_0x98d033)['send'](_0x46c7da);};}exports[_0x4197('0x29')]=function(_0x247af4,_0x3c75da){var _0x9e9a68={},_0x316322={},_0x26c3c6={'count':0x0,'rows':[]};return db['CmCompany'][_0x4197('0x2a')]()['then'](function(_0x288426){_0x316322[_0x4197('0x2b')]=_['keys'](_0x288426);_0x316322[_0x4197('0x2c')]=_[_0x4197('0x2d')](_0x247af4[_0x4197('0x2c')]);_0x316322[_0x4197('0x2e')]=_['intersection'](_0x316322[_0x4197('0x2b')],_0x316322[_0x4197('0x2c')]);_0x9e9a68[_0x4197('0x2f')]=_[_0x4197('0x30')](_0x316322[_0x4197('0x2b')],qs[_0x4197('0x31')](_0x247af4['query']['fields']));_0x9e9a68[_0x4197('0x2f')]=_0x9e9a68[_0x4197('0x2f')]['length']?_0x9e9a68[_0x4197('0x2f')]:_0x316322[_0x4197('0x2b')];if(!_0x247af4['query']['hasOwnProperty'](_0x4197('0x32'))){_0x9e9a68['limit']=qs['limit'](_0x247af4['query'][_0x4197('0x1d')]);_0x9e9a68[_0x4197('0x1c')]=qs['offset'](_0x247af4['query'][_0x4197('0x1c')]);}_0x9e9a68[_0x4197('0x33')]=qs[_0x4197('0x34')](_0x247af4[_0x4197('0x2c')][_0x4197('0x34')]);_0x9e9a68[_0x4197('0x35')]=qs[_0x4197('0x2e')](_['pick'](_0x247af4['query'],_0x316322['filters']),_0x288426);if(_0x247af4[_0x4197('0x2c')]['filter']){_0x9e9a68[_0x4197('0x35')]=_[_0x4197('0x36')](_0x9e9a68[_0x4197('0x35')],{'$or':_[_0x4197('0x37')](_0x9e9a68['attributes'],function(_0x4f9148){var _0x2196e8={};_0x2196e8[_0x4f9148]={'$like':'%'+_0x247af4[_0x4197('0x2c')][_0x4197('0x38')]+'%'};return _0x2196e8;})});}_0x9e9a68=_[_0x4197('0x36')]({},_0x9e9a68,_0x247af4[_0x4197('0x39')]);var _0x1f8210={'where':_0x9e9a68['where']};return db[_0x4197('0x3a')][_0x4197('0x1b')](_0x1f8210)['then'](function(_0x5d216b){_0x26c3c6[_0x4197('0x1b')]=_0x5d216b;if(_0x247af4['query'][_0x4197('0x3b')]){_0x9e9a68[_0x4197('0x3c')]=[{'all':!![]}];}return db[_0x4197('0x3a')][_0x4197('0x3d')](_0x9e9a68);})[_0x4197('0x25')](function(_0x26699c){_0x26c3c6[_0x4197('0x3e')]=_0x26699c;return _0x26c3c6;})['then'](respondWithFilteredResult(_0x3c75da,_0x9e9a68))[_0x4197('0x3f')](handleError(_0x3c75da,null));})[_0x4197('0x3f')](handleError(_0x3c75da,null));};exports[_0x4197('0x40')]=function(_0x60fbd6,_0x1beb66){var _0x3732d6={'raw':![],'where':{'id':_0x60fbd6[_0x4197('0x41')]['id']}},_0x3bfc37={};_0x3bfc37[_0x4197('0x2b')]=_['keys'](db['CmCompany'][_0x4197('0x42')]);_0x3bfc37['query']=_[_0x4197('0x2d')](_0x60fbd6['query']);_0x3bfc37[_0x4197('0x2e')]=_[_0x4197('0x30')](_0x3bfc37[_0x4197('0x2b')],_0x3bfc37[_0x4197('0x2c')]);_0x3732d6[_0x4197('0x2f')]=_[_0x4197('0x30')](_0x3bfc37[_0x4197('0x2b')],qs['fields'](_0x60fbd6[_0x4197('0x2c')][_0x4197('0x31')]));_0x3732d6['attributes']=_0x3732d6[_0x4197('0x2f')][_0x4197('0x43')]?_0x3732d6['attributes']:_0x3bfc37['model'];if(_0x60fbd6[_0x4197('0x2c')][_0x4197('0x3b')]){_0x3732d6[_0x4197('0x3c')]=[{'all':!![]}];}_0x3732d6=_[_0x4197('0x36')]({},_0x3732d6,_0x60fbd6[_0x4197('0x39')]);return db[_0x4197('0x3a')][_0x4197('0x44')](_0x3732d6)['then'](handleEntityNotFound(_0x1beb66,null))[_0x4197('0x25')](respondWithResult(_0x1beb66,null))[_0x4197('0x3f')](handleError(_0x1beb66,null));};exports[_0x4197('0x45')]=function(_0x28c09d,_0x59bc18){return db[_0x4197('0x3a')][_0x4197('0x45')](_0x28c09d[_0x4197('0x46')],{})[_0x4197('0x25')](function(_0x22c8fe){var _0x387d9e=_0x28c09d[_0x4197('0x47')][_0x4197('0x26')]({'plain':!![]});if(!_0x387d9e)throw new Error(_0x4197('0x48'));if(_0x387d9e[_0x4197('0x49')]===_0x4197('0x47')){var _0x40634e=_0x22c8fe['get']({'plain':!![]});var _0x1f4c93=_0x4197('0x4a');return db[_0x4197('0x4b')][_0x4197('0x44')]({'where':{'name':_0x1f4c93,'userProfileId':_0x387d9e['userProfileId']},'raw':!![]})[_0x4197('0x25')](function(_0x17b403){if(_0x17b403&&_0x17b403['autoAssociation']===0x0){return db[_0x4197('0x4c')]['create']({'name':_0x40634e[_0x4197('0x28')],'resourceId':_0x40634e['id'],'type':_0x17b403['name'],'sectionId':_0x17b403['id']},{})[_0x4197('0x25')](function(){return _0x22c8fe;});}else{return _0x22c8fe;}})[_0x4197('0x3f')](function(_0xfe2bcb){logger[_0x4197('0x4d')](_0x4197('0x4e'),_0xfe2bcb);throw _0xfe2bcb;});}return _0x22c8fe;})[_0x4197('0x25')](respondWithResult(_0x59bc18,0xc9))[_0x4197('0x3f')](handleError(_0x59bc18,null));};exports[_0x4197('0x23')]=function(_0x49e988,_0x34347e){if(_0x49e988['body']['id']){delete _0x49e988[_0x4197('0x46')]['id'];}return db[_0x4197('0x3a')][_0x4197('0x44')]({'where':{'id':_0x49e988[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x34347e,null))[_0x4197('0x25')](saveUpdates(_0x49e988['body'],null))[_0x4197('0x25')](respondWithResult(_0x34347e,null))[_0x4197('0x3f')](handleError(_0x34347e,null));};exports[_0x4197('0x24')]=function(_0x5a8892,_0x24d8d2){return db[_0x4197('0x3a')][_0x4197('0x44')]({'where':{'id':_0x5a8892[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x24d8d2,null))[_0x4197('0x25')](removeEntity(_0x24d8d2,null))[_0x4197('0x3f')](handleError(_0x24d8d2,null));};exports[_0x4197('0x2a')]=function(_0x891497,_0x6ca20a){return db[_0x4197('0x3a')][_0x4197('0x2a')]()[_0x4197('0x25')](respondWithResult(_0x6ca20a,null))[_0x4197('0x3f')](handleError(_0x6ca20a,null));};exports[_0x4197('0x4f')]=function(_0x5e642f,_0x5a8cad,_0xb76a2){return db[_0x4197('0x50')][_0x4197('0x44')]({'where':{'id':_0x5e642f[_0x4197('0x41')]['id']}})[_0x4197('0x25')](handleEntityNotFound(_0x5a8cad,null))[_0x4197('0x25')](function(_0x5c20c4){if(_0x5c20c4){return _0x5c20c4[_0x4197('0x4f')](_0x5e642f[_0x4197('0x46')][_0x4197('0x51')],_[_0x4197('0x52')](_0x5e642f['body'],[_0x4197('0x51'),'id'])||{});}})[_0x4197('0x25')](respondWithResult(_0x5a8cad,null))[_0x4197('0x3f')](handleError(_0x5a8cad,null));};exports[_0x4197('0x53')]=function(_0x29bbc7,_0x2e6800,_0x2ca889){var _0x4f9789={};var _0x4c617c={};var _0x30e96c;var _0x1d92d5;return db[_0x4197('0x3a')][_0x4197('0x54')]({'where':{'id':_0x29bbc7['params']['id']}})['then'](handleEntityNotFound(_0x2e6800,null))[_0x4197('0x25')](function(_0x10c958){if(_0x10c958){_0x30e96c=_0x10c958;_0x4c617c[_0x4197('0x2b')]=_[_0x4197('0x2d')](db[_0x4197('0x50')][_0x4197('0x42')]);_0x4c617c[_0x4197('0x2c')]=_[_0x4197('0x2d')](_0x29bbc7[_0x4197('0x2c')]);_0x4c617c[_0x4197('0x2e')]=_[_0x4197('0x30')](_0x4c617c[_0x4197('0x2b')],_0x4c617c[_0x4197('0x2c')]);_0x4f9789[_0x4197('0x2f')]=_['intersection'](_0x4c617c[_0x4197('0x2b')],qs[_0x4197('0x31')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x31')]));_0x4f9789[_0x4197('0x2f')]=_0x4f9789[_0x4197('0x2f')]['length']?_0x4f9789[_0x4197('0x2f')]:_0x4c617c[_0x4197('0x2b')];_0x4f9789[_0x4197('0x33')]=qs[_0x4197('0x34')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x34')]);_0x4f9789[_0x4197('0x35')]=qs[_0x4197('0x2e')](_[_0x4197('0x55')](_0x29bbc7[_0x4197('0x2c')],_0x4c617c[_0x4197('0x2e')]));if(_0x29bbc7[_0x4197('0x2c')][_0x4197('0x38')]){_0x4f9789['where']=_[_0x4197('0x36')](_0x4f9789[_0x4197('0x35')],{'$or':_['map'](_0x4f9789[_0x4197('0x2f')],function(_0x20faf2){var _0x326b11={};_0x326b11[_0x20faf2]={'$like':'%'+_0x29bbc7[_0x4197('0x2c')][_0x4197('0x38')]+'%'};return _0x326b11;})});}_0x4f9789=_[_0x4197('0x36')]({},_0x4f9789,_0x29bbc7[_0x4197('0x39')]);return _0x30e96c[_0x4197('0x53')](_0x4f9789);}})[_0x4197('0x25')](function(_0x13b294){if(_0x13b294){_0x1d92d5=_0x13b294['length'];if(!_0x29bbc7['query'][_0x4197('0x56')]('nolimit')){_0x4f9789[_0x4197('0x1d')]=qs[_0x4197('0x1d')](_0x29bbc7[_0x4197('0x2c')][_0x4197('0x1d')]);_0x4f9789['offset']=qs[_0x4197('0x1c')](_0x29bbc7['query']['offset']);}return _0x30e96c[_0x4197('0x53')](_0x4f9789);}})[_0x4197('0x25')](function(_0x22599f){if(_0x22599f){return _0x22599f?{'count':_0x1d92d5,'rows':_0x22599f}:null;}})[_0x4197('0x25')](respondWithResult(_0x2e6800,null))[_0x4197('0x3f')](handleError(_0x2e6800,null));}; \ No newline at end of file +var _0x380f=['../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','sort','pick','filter','where','map','options','includeAll','include','findAll','catch','show','rawAttributes','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addContacts','CmContact','ids','omit','getContacts','order','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x43cafe,_0x971954){var _0x28926d=function(_0x1a2656){while(--_0x1a2656){_0x43cafe['push'](_0x43cafe['shift']());}};_0x28926d(++_0x971954);}(_0x380f,0x97));var _0xf380=function(_0x5324d4,_0x2d901f){_0x5324d4=_0x5324d4-0x0;var _0x3ca0d6=_0x380f[_0x5324d4];return _0x3ca0d6;};'use strict';var pdf=require(_0xf380('0x0'));var emlformat=require(_0xf380('0x1'));var rimraf=require(_0xf380('0x2'));var zipdir=require(_0xf380('0x3'));var jsonpatch=require(_0xf380('0x4'));var rp=require(_0xf380('0x5'));var moment=require(_0xf380('0x6'));var BPromise=require(_0xf380('0x7'));var Mustache=require(_0xf380('0x8'));var util=require(_0xf380('0x9'));var path=require(_0xf380('0xa'));var sox=require(_0xf380('0xb'));var csv=require('to-csv');var ejs=require(_0xf380('0xc'));var fs=require('fs');var _=require(_0xf380('0xd'));var squel=require(_0xf380('0xe'));var crypto=require('crypto');var jsforce=require(_0xf380('0xf'));var deskjs=require(_0xf380('0x10'));var toCsv=require(_0xf380('0x11'));var querystring=require(_0xf380('0x12'));var Papa=require(_0xf380('0x13'));var Redis=require('ioredis');var authService=require(_0xf380('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf380('0x15'));var hardwareService=require(_0xf380('0x16'));var logger=require(_0xf380('0x17'))(_0xf380('0x18'));var utils=require('../../config/utils');var config=require(_0xf380('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x97a270,_0x60b887){_0x60b887=_0x60b887||0xcc;return function(_0x3cf894){if(_0x3cf894){return _0x97a270[_0xf380('0x1a')](_0x60b887);}return _0x97a270[_0xf380('0x1b')](_0x60b887)[_0xf380('0x1c')]();};}function respondWithResult(_0x2e886f,_0x49f529){_0x49f529=_0x49f529||0xc8;return function(_0x59830b){if(_0x59830b){return _0x2e886f[_0xf380('0x1b')](_0x49f529)[_0xf380('0x1d')](_0x59830b);}};}function respondWithFilteredResult(_0x348024,_0x2e7223){return function(_0x58826c){if(_0x58826c){var _0x469e7a=_0x58826c[_0xf380('0x1e')],_0x22f92f=_0x2e7223['offset'],_0x57bd46=_0x2e7223[_0xf380('0x1f')]+_0x2e7223[_0xf380('0x20')],_0x28a4fb;if(_0x57bd46>=_0x469e7a){_0x57bd46=_0x469e7a;_0x28a4fb=0xc8;}else{_0x28a4fb=0xce;}_0x348024['status'](_0x28a4fb);return _0x348024['set'](_0xf380('0x21'),_0x22f92f+'-'+_0x57bd46+'/'+_0x469e7a)[_0xf380('0x1d')](_0x58826c);}return null;};}function patchUpdates(_0x2f1b98){return function(_0x5e70fd){try{jsonpatch[_0xf380('0x22')](_0x5e70fd,_0x2f1b98,!![]);}catch(_0x12806a){return BPromise[_0xf380('0x23')](_0x12806a);}return _0x5e70fd[_0xf380('0x24')]();};}function saveUpdates(_0x19c3a2,_0x262513){return function(_0x422710){if(_0x422710){return _0x422710['update'](_0x19c3a2)[_0xf380('0x25')](function(_0x50f272){return _0x50f272;});}return null;};}function removeEntity(_0x21d1ae,_0x1f40e0){return function(_0x5b48a1){if(_0x5b48a1){return _0x5b48a1[_0xf380('0x26')]()['then'](function(){var _0x1453dd=_0x5b48a1[_0xf380('0x27')]({'plain':!![]});var _0x1332ce=_0xf380('0x28');return db[_0xf380('0x29')][_0xf380('0x26')]({'where':{'type':_0x1332ce,'resourceId':_0x1453dd['id']}})[_0xf380('0x25')](function(){return _0x5b48a1;});})['then'](function(){_0x21d1ae[_0xf380('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445bbb,_0x5af21d){return function(_0x4f4d07){if(!_0x4f4d07){_0x445bbb['sendStatus'](0x194);}return _0x4f4d07;};}function handleError(_0x13a983,_0x3242ef){_0x3242ef=_0x3242ef||0x1f4;return function(_0x3beb4e){logger[_0xf380('0x2a')](_0x3beb4e[_0xf380('0x2b')]);if(_0x3beb4e[_0xf380('0x2c')]){delete _0x3beb4e['name'];}_0x13a983[_0xf380('0x1b')](_0x3242ef)[_0xf380('0x2d')](_0x3beb4e);};}exports[_0xf380('0x2e')]=function(_0xa6b3c9,_0x82179f){var _0x55279c={},_0x23e52c={},_0x308027={'count':0x0,'rows':[]};return db[_0xf380('0x2f')][_0xf380('0x30')]()['then'](function(_0x3de8ac){_0x23e52c[_0xf380('0x31')]=_[_0xf380('0x32')](_0x3de8ac);_0x23e52c[_0xf380('0x33')]=_['keys'](_0xa6b3c9[_0xf380('0x33')]);_0x23e52c[_0xf380('0x34')]=_[_0xf380('0x35')](_0x23e52c[_0xf380('0x31')],_0x23e52c[_0xf380('0x33')]);_0x55279c['attributes']=_[_0xf380('0x35')](_0x23e52c[_0xf380('0x31')],qs[_0xf380('0x36')](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x36')]));_0x55279c[_0xf380('0x37')]=_0x55279c['attributes'][_0xf380('0x38')]?_0x55279c[_0xf380('0x37')]:_0x23e52c[_0xf380('0x31')];if(!_0xa6b3c9[_0xf380('0x33')]['hasOwnProperty']('nolimit')){_0x55279c[_0xf380('0x20')]=qs[_0xf380('0x20')](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x20')]);_0x55279c['offset']=qs['offset'](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x1f')]);}_0x55279c['order']=qs[_0xf380('0x39')](_0xa6b3c9['query'][_0xf380('0x39')]);_0x55279c['where']=qs[_0xf380('0x34')](_[_0xf380('0x3a')](_0xa6b3c9[_0xf380('0x33')],_0x23e52c[_0xf380('0x34')]),_0x3de8ac);if(_0xa6b3c9[_0xf380('0x33')][_0xf380('0x3b')]){_0x55279c['where']=_['merge'](_0x55279c[_0xf380('0x3c')],{'$or':_[_0xf380('0x3d')](_0x55279c[_0xf380('0x37')],function(_0x5f233d){var _0x1ae1ff={};_0x1ae1ff[_0x5f233d]={'$like':'%'+_0xa6b3c9['query']['filter']+'%'};return _0x1ae1ff;})});}_0x55279c=_['merge']({},_0x55279c,_0xa6b3c9[_0xf380('0x3e')]);var _0x1069ee={'where':_0x55279c[_0xf380('0x3c')]};return db[_0xf380('0x2f')][_0xf380('0x1e')](_0x1069ee)['then'](function(_0x108bfa){_0x308027[_0xf380('0x1e')]=_0x108bfa;if(_0xa6b3c9[_0xf380('0x33')][_0xf380('0x3f')]){_0x55279c[_0xf380('0x40')]=[{'all':!![]}];}return db[_0xf380('0x2f')][_0xf380('0x41')](_0x55279c);})[_0xf380('0x25')](function(_0xc0cb0b){_0x308027['rows']=_0xc0cb0b;return _0x308027;})[_0xf380('0x25')](respondWithFilteredResult(_0x82179f,_0x55279c))[_0xf380('0x42')](handleError(_0x82179f,null));})[_0xf380('0x42')](handleError(_0x82179f,null));};exports[_0xf380('0x43')]=function(_0x7746d4,_0x9a2584){var _0x4368e4={'raw':![],'where':{'id':_0x7746d4['params']['id']}},_0x5df0b6={};_0x5df0b6[_0xf380('0x31')]=_['keys'](db[_0xf380('0x2f')][_0xf380('0x44')]);_0x5df0b6[_0xf380('0x33')]=_[_0xf380('0x32')](_0x7746d4[_0xf380('0x33')]);_0x5df0b6[_0xf380('0x34')]=_[_0xf380('0x35')](_0x5df0b6[_0xf380('0x31')],_0x5df0b6[_0xf380('0x33')]);_0x4368e4[_0xf380('0x37')]=_[_0xf380('0x35')](_0x5df0b6[_0xf380('0x31')],qs[_0xf380('0x36')](_0x7746d4[_0xf380('0x33')]['fields']));_0x4368e4[_0xf380('0x37')]=_0x4368e4[_0xf380('0x37')][_0xf380('0x38')]?_0x4368e4['attributes']:_0x5df0b6[_0xf380('0x31')];if(_0x7746d4[_0xf380('0x33')][_0xf380('0x3f')]){_0x4368e4[_0xf380('0x40')]=[{'all':!![]}];}_0x4368e4=_[_0xf380('0x45')]({},_0x4368e4,_0x7746d4[_0xf380('0x3e')]);return db[_0xf380('0x2f')][_0xf380('0x46')](_0x4368e4)[_0xf380('0x25')](handleEntityNotFound(_0x9a2584,null))['then'](respondWithResult(_0x9a2584,null))['catch'](handleError(_0x9a2584,null));};exports[_0xf380('0x47')]=function(_0x3f3712,_0x6b3a44){return db[_0xf380('0x2f')][_0xf380('0x47')](_0x3f3712[_0xf380('0x48')],{})['then'](function(_0x15fe76){var _0x30952d=_0x3f3712[_0xf380('0x49')]['get']({'plain':!![]});if(!_0x30952d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30952d[_0xf380('0x4a')]===_0xf380('0x49')){var _0x3e2655=_0x15fe76[_0xf380('0x27')]({'plain':!![]});var _0x5efd27='Companies';return db[_0xf380('0x4b')][_0xf380('0x46')]({'where':{'name':_0x5efd27,'userProfileId':_0x30952d[_0xf380('0x4c')]},'raw':!![]})[_0xf380('0x25')](function(_0x8bc915){if(_0x8bc915&&_0x8bc915['autoAssociation']===0x0){return db[_0xf380('0x29')][_0xf380('0x47')]({'name':_0x3e2655[_0xf380('0x2c')],'resourceId':_0x3e2655['id'],'type':_0x8bc915[_0xf380('0x2c')],'sectionId':_0x8bc915['id']},{})[_0xf380('0x25')](function(){return _0x15fe76;});}else{return _0x15fe76;}})[_0xf380('0x42')](function(_0x58affe){logger[_0xf380('0x2a')](_0xf380('0x4d'),_0x58affe);throw _0x58affe;});}return _0x15fe76;})[_0xf380('0x25')](respondWithResult(_0x6b3a44,0xc9))['catch'](handleError(_0x6b3a44,null));};exports[_0xf380('0x4e')]=function(_0x1ffc2d,_0x19531e){if(_0x1ffc2d[_0xf380('0x48')]['id']){delete _0x1ffc2d[_0xf380('0x48')]['id'];}return db[_0xf380('0x2f')][_0xf380('0x46')]({'where':{'id':_0x1ffc2d[_0xf380('0x4f')]['id']}})['then'](handleEntityNotFound(_0x19531e,null))[_0xf380('0x25')](saveUpdates(_0x1ffc2d[_0xf380('0x48')],null))['then'](respondWithResult(_0x19531e,null))[_0xf380('0x42')](handleError(_0x19531e,null));};exports[_0xf380('0x26')]=function(_0x29beff,_0x4f8677){return db[_0xf380('0x2f')][_0xf380('0x46')]({'where':{'id':_0x29beff[_0xf380('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f8677,null))[_0xf380('0x25')](removeEntity(_0x4f8677,null))[_0xf380('0x42')](handleError(_0x4f8677,null));};exports[_0xf380('0x30')]=function(_0x1b29cb,_0x528235){return db[_0xf380('0x2f')][_0xf380('0x30')]()['then'](respondWithResult(_0x528235,null))['catch'](handleError(_0x528235,null));};exports[_0xf380('0x50')]=function(_0xb7a2b6,_0x6cb536,_0x31d6ff){return db[_0xf380('0x51')]['find']({'where':{'id':_0xb7a2b6[_0xf380('0x4f')]['id']}})[_0xf380('0x25')](handleEntityNotFound(_0x6cb536,null))[_0xf380('0x25')](function(_0x100ebd){if(_0x100ebd){return _0x100ebd[_0xf380('0x50')](_0xb7a2b6['body'][_0xf380('0x52')],_[_0xf380('0x53')](_0xb7a2b6[_0xf380('0x48')],[_0xf380('0x52'),'id'])||{});}})['then'](respondWithResult(_0x6cb536,null))['catch'](handleError(_0x6cb536,null));};exports[_0xf380('0x54')]=function(_0x37ff9f,_0x779fb,_0x10937a){var _0x46e033={};var _0x3bac48={};var _0x3d24c7;var _0x4fc248;return db[_0xf380('0x2f')]['findOne']({'where':{'id':_0x37ff9f[_0xf380('0x4f')]['id']}})[_0xf380('0x25')](handleEntityNotFound(_0x779fb,null))['then'](function(_0x194ee2){if(_0x194ee2){_0x3d24c7=_0x194ee2;_0x3bac48[_0xf380('0x31')]=_[_0xf380('0x32')](db['CmContact']['rawAttributes']);_0x3bac48[_0xf380('0x33')]=_[_0xf380('0x32')](_0x37ff9f[_0xf380('0x33')]);_0x3bac48[_0xf380('0x34')]=_[_0xf380('0x35')](_0x3bac48[_0xf380('0x31')],_0x3bac48[_0xf380('0x33')]);_0x46e033[_0xf380('0x37')]=_[_0xf380('0x35')](_0x3bac48[_0xf380('0x31')],qs['fields'](_0x37ff9f['query'][_0xf380('0x36')]));_0x46e033[_0xf380('0x37')]=_0x46e033[_0xf380('0x37')][_0xf380('0x38')]?_0x46e033[_0xf380('0x37')]:_0x3bac48['model'];_0x46e033[_0xf380('0x55')]=qs['sort'](_0x37ff9f[_0xf380('0x33')][_0xf380('0x39')]);_0x46e033[_0xf380('0x3c')]=qs[_0xf380('0x34')](_['pick'](_0x37ff9f[_0xf380('0x33')],_0x3bac48[_0xf380('0x34')]));if(_0x37ff9f[_0xf380('0x33')][_0xf380('0x3b')]){_0x46e033['where']=_[_0xf380('0x45')](_0x46e033[_0xf380('0x3c')],{'$or':_[_0xf380('0x3d')](_0x46e033[_0xf380('0x37')],function(_0x5f27ff){var _0xa26baf={};_0xa26baf[_0x5f27ff]={'$like':'%'+_0x37ff9f[_0xf380('0x33')][_0xf380('0x3b')]+'%'};return _0xa26baf;})});}_0x46e033=_[_0xf380('0x45')]({},_0x46e033,_0x37ff9f[_0xf380('0x3e')]);return _0x3d24c7[_0xf380('0x54')](_0x46e033);}})[_0xf380('0x25')](function(_0xb71707){if(_0xb71707){_0x4fc248=_0xb71707[_0xf380('0x38')];if(!_0x37ff9f[_0xf380('0x33')]['hasOwnProperty'](_0xf380('0x56'))){_0x46e033[_0xf380('0x20')]=qs[_0xf380('0x20')](_0x37ff9f[_0xf380('0x33')][_0xf380('0x20')]);_0x46e033[_0xf380('0x1f')]=qs[_0xf380('0x1f')](_0x37ff9f[_0xf380('0x33')][_0xf380('0x1f')]);}return _0x3d24c7[_0xf380('0x54')](_0x46e033);}})['then'](function(_0x3a4050){if(_0x3a4050){return _0x3a4050?{'count':_0x4fc248,'rows':_0x3a4050}:null;}})[_0xf380('0x25')](respondWithResult(_0x779fb,null))['catch'](handleError(_0x779fb,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ccc581b..85a6e86 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 _0x79d3=['CmCompany','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x51606d,_0x51af29){var _0x1c66be=function(_0x3f1611){while(--_0x3f1611){_0x51606d['push'](_0x51606d['shift']());}};_0x1c66be(++_0x51af29);}(_0x79d3,0x15f));var _0x379d=function(_0x3768f3,_0x4a40f1){_0x3768f3=_0x3768f3-0x0;var _0x526a13=_0x79d3[_0x3768f3];return _0x526a13;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc997=['bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','util','../../config/logger','api','moment'];(function(_0x499a43,_0x3cbee7){var _0x4e607e=function(_0xd7f146){while(--_0xd7f146){_0x499a43['push'](_0x499a43['shift']());}};_0x4e607e(++_0x3cbee7);}(_0xc997,0x1ac));var _0x7c99=function(_0x313e5f,_0x27c27f){_0x313e5f=_0x313e5f-0x0;var _0x3e76c6=_0xc997[_0x313e5f];return _0x3e76c6;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('CmCompany',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e78a836..30b8ec2 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 _0x4684=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16fca4,_0x259c71){var _0x2fdb39=function(_0x2bc10f){while(--_0x2bc10f){_0x16fca4['push'](_0x16fca4['shift']());}};_0x2fdb39(++_0x259c71);}(_0x4684,0x11d));var _0x4468=function(_0x261b97,_0x50c866){_0x261b97=_0x261b97-0x0;var _0x4f423f=_0x4684[_0x261b97];return _0x4f423f;};'use strict';var _=require(_0x4468('0x0'));var util=require(_0x4468('0x1'));var moment=require(_0x4468('0x2'));var BPromise=require(_0x4468('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4468('0x4'));var db=require(_0x4468('0x5'))['db'];var utils=require(_0x4468('0x6'));var logger=require(_0x4468('0x7'))(_0x4468('0x8'));var config=require(_0x4468('0x9'));var jayson=require(_0x4468('0xa'));var client=jayson[_0x4468('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbab6,_0x239f55,_0x4ebe78){return new BPromise(function(_0x20a078,_0x47e6d4){return client[_0x4468('0xc')](_0x1fbab6,_0x4ebe78)[_0x4468('0xd')](function(_0x90200d){logger[_0x4468('0xe')](_0x4468('0xf'),_0x239f55,_0x4468('0x10'));logger[_0x4468('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x239f55,_0x4468('0x10'),JSON[_0x4468('0x12')](_0x90200d));if(_0x90200d[_0x4468('0x13')]){if(_0x90200d['error'][_0x4468('0x14')]===0x1f4){logger[_0x4468('0x13')](_0x4468('0xf'),_0x239f55,_0x90200d[_0x4468('0x13')][_0x4468('0x15')]);return _0x47e6d4(_0x90200d[_0x4468('0x13')]['message']);}logger[_0x4468('0x13')](_0x4468('0xf'),_0x239f55,_0x90200d['error'][_0x4468('0x15')]);return _0x20a078(_0x90200d[_0x4468('0x13')][_0x4468('0x15')]);}else{logger[_0x4468('0xe')](_0x4468('0xf'),_0x239f55,_0x4468('0x10'));_0x20a078(_0x90200d['result'][_0x4468('0x15')]);}})[_0x4468('0x16')](function(_0x5177c7){logger[_0x4468('0x13')]('CmCompany,\x20%s,\x20%s',_0x239f55,_0x5177c7);_0x47e6d4(_0x5177c7);});});} \ No newline at end of file +var _0x4185=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4c272f,_0x18d107){var _0xd08a10=function(_0x148083){while(--_0x148083){_0x4c272f['push'](_0x4c272f['shift']());}};_0xd08a10(++_0x18d107);}(_0x4185,0x69));var _0x5418=function(_0x1b8ad2,_0x39acef){_0x1b8ad2=_0x1b8ad2-0x0;var _0x262c25=_0x4185[_0x1b8ad2];return _0x262c25;};'use strict';var _=require(_0x5418('0x0'));var util=require(_0x5418('0x1'));var moment=require(_0x5418('0x2'));var BPromise=require(_0x5418('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5418('0x4'));var db=require(_0x5418('0x5'))['db'];var utils=require(_0x5418('0x6'));var logger=require(_0x5418('0x7'))('rpc');var config=require(_0x5418('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5418('0x9')][_0x5418('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c41cd,_0x2ff57f,_0x57b71f){return new BPromise(function(_0x23568e,_0x4bb5b1){return client[_0x5418('0xb')](_0x4c41cd,_0x57b71f)[_0x5418('0xc')](function(_0x6cdd3d){logger[_0x5418('0xd')](_0x5418('0xe'),_0x2ff57f,_0x5418('0xf'));logger[_0x5418('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2ff57f,_0x5418('0xf'),JSON[_0x5418('0x11')](_0x6cdd3d));if(_0x6cdd3d[_0x5418('0x12')]){if(_0x6cdd3d['error'][_0x5418('0x13')]===0x1f4){logger[_0x5418('0x12')](_0x5418('0xe'),_0x2ff57f,_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);return _0x4bb5b1(_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);}logger[_0x5418('0x12')](_0x5418('0xe'),_0x2ff57f,_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);return _0x23568e(_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);}else{logger['info'](_0x5418('0xe'),_0x2ff57f,_0x5418('0xf'));_0x23568e(_0x6cdd3d[_0x5418('0x15')][_0x5418('0x14')]);}})[_0x5418('0x16')](function(_0x13fa4a){logger[_0x5418('0x12')]('CmCompany,\x20%s,\x20%s',_0x2ff57f,_0x13fa4a);_0x4bb5b1(_0x13fa4a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3ffde6f..6c61c4d 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 _0xc2c7=['../../config/environment','isAuthenticated','index','get','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x527a53,_0x3265d6){var _0x2332f5=function(_0x3b2d90){while(--_0x3b2d90){_0x527a53['push'](_0x527a53['shift']());}};_0x2332f5(++_0x3265d6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1440a1,_0x419177){_0x1440a1=_0x1440a1-0x0;var _0x5d4c5a=_0xc2c7[_0x1440a1];return _0x5d4c5a;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var auth=require(_0x7c2c('0x5'));var interaction=require(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x9')]);router[_0x7c2c('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7c2c('0xa')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xa')]('/:id/contacts',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xd')]);router[_0x7c2c('0xe')]('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0xe')](_0x7c2c('0x10'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x12')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')](_0x7c2c('0xb'),auth[_0x7c2c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5204=['addContacts','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id/contacts','getContacts','post','create'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5204,0xdf));var _0x4520=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x5204[_0x5a7d5f];return _0x5dcded;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var auth=require(_0x4520('0x5'));var interaction=require(_0x4520('0x6'));var config=require('../../config/environment');var controller=require(_0x4520('0x7'));router['get']('/',auth[_0x4520('0x8')](),controller[_0x4520('0x9')]);router[_0x4520('0xa')](_0x4520('0xb'),auth[_0x4520('0x8')](),controller[_0x4520('0xc')]);router[_0x4520('0xa')]('/:id',auth[_0x4520('0x8')](),controller['show']);router[_0x4520('0xa')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0xe')]);router[_0x4520('0xf')]('/',auth[_0x4520('0x8')](),controller[_0x4520('0x10')]);router[_0x4520('0xf')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0x11')]);router[_0x4520('0x12')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x14')]);router[_0x4520('0x15')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x16')]);module[_0x4520('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f96244e..f41e432 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 _0x4f5e=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x4f5e,0xc0));var _0xe4f5=function(_0x572d14,_0x18c54f){_0x572d14=_0x572d14-0x0;var _0x23bc6f=_0x4f5e[_0x572d14];return _0x23bc6f;};'use strict';var _=require(_0xe4f5('0x0'));var Sequelize=require(_0xe4f5('0x1'));module[_0xe4f5('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe4f5('0x3')]},'street':{'type':Sequelize[_0xe4f5('0x3')]},'postalCode':{'type':Sequelize[_0xe4f5('0x3')]},'city':{'type':Sequelize[_0xe4f5('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe4f5('0x3')]},'description':{'type':Sequelize[_0xe4f5('0x4')]},'phone':{'type':Sequelize[_0xe4f5('0x3')]},'mobile':{'type':Sequelize[_0xe4f5('0x3')]},'fax':{'type':Sequelize[_0xe4f5('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe4f5('0x3')]},'facebook':{'type':Sequelize[_0xe4f5('0x3')]},'fb_data':{'type':Sequelize[_0xe4f5('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe4f5('0x3')]},'teams':{'type':Sequelize[_0xe4f5('0x3')]},'viber':{'type':Sequelize[_0xe4f5('0x3')]},'line':{'type':Sequelize[_0xe4f5('0x3')]},'wechat':{'type':Sequelize[_0xe4f5('0x3')]},'telegram':{'type':Sequelize[_0xe4f5('0x3')]},'UserId':{'type':Sequelize[_0xe4f5('0x5')]},'priority':{'type':Sequelize[_0xe4f5('0x5')](0x2)[_0xe4f5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe4f5('0x7')],'defaultValue':Sequelize[_0xe4f5('0x8')]}}; \ No newline at end of file +var _0x62f0=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x455ccf,_0x1afbde){var _0x26fe4f=function(_0x355e84){while(--_0x355e84){_0x455ccf['push'](_0x455ccf['shift']());}};_0x26fe4f(++_0x1afbde);}(_0x62f0,0x156));var _0x062f=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x62f0[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x062f('0x0'));var Sequelize=require(_0x062f('0x1'));module[_0x062f('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x062f('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x062f('0x3')]},'dateOfBirth':{'type':Sequelize[_0x062f('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x062f('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x062f('0x3')]},'url':{'type':Sequelize[_0x062f('0x3')]},'facebook':{'type':Sequelize[_0x062f('0x3')]},'fb_data':{'type':Sequelize[_0x062f('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x062f('0x3')]},'teams':{'type':Sequelize[_0x062f('0x3')]},'viber':{'type':Sequelize[_0x062f('0x3')]},'line':{'type':Sequelize[_0x062f('0x3')]},'wechat':{'type':Sequelize[_0x062f('0x3')]},'telegram':{'type':Sequelize[_0x062f('0x3')]},'UserId':{'type':Sequelize[_0x062f('0x4')]},'priority':{'type':Sequelize[_0x062f('0x4')](0x2)[_0x062f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x062f('0x6')],'defaultValue':Sequelize[_0x062f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index de35bcd..30b0815 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 _0x661a=['send','describe','keys','length','push','CmCustomField','findOne','trimStart','cf_','all','type','model','query','filters','intersection','fields','attributes','sort','where','pick','select','field','color','from','tools_tags','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','castTo','DATE','buildExpression','text','start','hasOwnProperty','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','order','DESC','having','t.id\x20IN\x20?','resolve','user','some','getLists','c.ListId\x20IS\x20NULL','role','agent','sequelize','toString','merge','CmContact','c.lastName','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','columnName','displayName','alias','custom','body','findAll','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','each','duplicates','$or','spread','show','omit','format','$and','pickBy','cf_%d','table','cm_contacts','setFields','toParam','values','phone','getTags','rawAttributes','options','nolimit','setTags','ids','getHoppers','ContactId','count','include','getHopperHistories','getHopperFinals','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','meta','import','binding','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','then','destroy','error','name'];(function(_0x518392,_0x25ac70){var _0x344e59=function(_0xa99198){while(--_0xa99198){_0x518392['push'](_0x518392['shift']());}};_0x344e59(++_0x25ac70);}(_0x661a,0x1c9));var _0xa661=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x661a[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require(_0xa661('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa661('0x1'));var zipdir=require(_0xa661('0x2'));var jsonpatch=require(_0xa661('0x3'));var rp=require('request-promise');var moment=require(_0xa661('0x4'));var BPromise=require(_0xa661('0x5'));var Mustache=require(_0xa661('0x6'));var util=require('util');var path=require(_0xa661('0x7'));var sox=require('sox');var csv=require(_0xa661('0x8'));var ejs=require(_0xa661('0x9'));var fs=require('fs');var _=require(_0xa661('0xa'));var squel=require(_0xa661('0xb'));var crypto=require(_0xa661('0xc'));var jsforce=require(_0xa661('0xd'));var deskjs=require(_0xa661('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa661('0xf'));var Papa=require('papaparse');var Redis=require(_0xa661('0x10'));var authService=require(_0xa661('0x11'));var qs=require(_0xa661('0x12'));var as=require(_0xa661('0x13'));var hardwareService=require(_0xa661('0x14'));var logger=require(_0xa661('0x15'))(_0xa661('0x16'));var utils=require(_0xa661('0x17'));var config=require(_0xa661('0x18'));var licenseUtil=require(_0xa661('0x19'));var db=require(_0xa661('0x1a'))['db'];config['redis']=_['defaults'](config[_0xa661('0x1b')],{'host':_0xa661('0x1c'),'port':0x18eb});var socket=require(_0xa661('0x1d'))(new Redis(config['redis']));require('./cmContact.socket')[_0xa661('0x1e')](socket);function respondWithStatusCode(_0x3e7ed7,_0x1b11b2){_0x1b11b2=_0x1b11b2||0xcc;return function(_0x14bb49){if(_0x14bb49){return _0x3e7ed7[_0xa661('0x1f')](_0x1b11b2);}return _0x3e7ed7[_0xa661('0x20')](_0x1b11b2)[_0xa661('0x21')]();};}function respondWithResult(_0x1b6ec2,_0xb1fdb8){_0xb1fdb8=_0xb1fdb8||0xc8;return function(_0x326eba){if(_0x326eba){return _0x1b6ec2[_0xa661('0x20')](_0xb1fdb8)[_0xa661('0x22')](_0x326eba);}};}function respondWithFilteredResult(_0x369ec5,_0x81006d){return function(_0x5d419e){if(_0x5d419e){var _0x2de22b=_0x5d419e['count'],_0x4359b2=_0x81006d[_0xa661('0x23')],_0x2f74df=_0x81006d['offset']+_0x81006d[_0xa661('0x24')],_0xb17d74;if(_0x2f74df>=_0x2de22b){_0x2f74df=_0x2de22b;_0xb17d74=0xc8;}else{_0xb17d74=0xce;}_0x369ec5['status'](_0xb17d74);return _0x369ec5[_0xa661('0x25')]('Content-Range',_0x4359b2+'-'+_0x2f74df+'/'+_0x2de22b)[_0xa661('0x22')](_0x5d419e);}return null;};}function patchUpdates(_0x12bf4d){return function(_0x44f439){try{jsonpatch[_0xa661('0x26')](_0x44f439,_0x12bf4d,!![]);}catch(_0x5e444f){return BPromise[_0xa661('0x27')](_0x5e444f);}return _0x44f439[_0xa661('0x28')]();};}function saveUpdates(_0x4cae6a,_0x2890a5){return function(_0x385346){if(_0x385346){return _0x385346['update'](_0x4cae6a)[_0xa661('0x29')](function(_0x4b06bf){return _0x4b06bf;});}return null;};}function removeEntity(_0x51b69a,_0x39bc60){return function(_0x362454){if(_0x362454){return _0x362454[_0xa661('0x2a')]()['then'](function(){_0x51b69a[_0xa661('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389015,_0x11d7dc){return function(_0x3715a9){if(!_0x3715a9){_0x389015[_0xa661('0x1f')](0x194);}return _0x3715a9;};}function handleError(_0x954273,_0x31ee05){_0x31ee05=_0x31ee05||0x1f4;return function(_0x33d5af){logger[_0xa661('0x2b')](_0x33d5af['stack']);if(_0x33d5af[_0xa661('0x2c')]){delete _0x33d5af[_0xa661('0x2c')];}_0x954273[_0xa661('0x20')](_0x31ee05)[_0xa661('0x2d')](_0x33d5af);};}exports['index']=function(_0x2e61ba,_0x3f9d0b){var _0x436713={},_0x1733f5={},_0x86105a={'count':0x0,'rows':[]};return db['CmContact'][_0xa661('0x2e')]()[_0xa661('0x29')](function(_0x45a27f){var _0x33bf85=[];for(var _0xdb0cbc=0x0;_0xdb0cbc0x1){_0x4c9a1f['or'](_0xa661('0x6d'),qs[_0xa661('0x6e')](_0xa5ff5b),null);}else{if(qs[_0xa661('0x6f')](_0xa5ff5b)){_0x4c9a1f['or']('c.id\x20LIKE\x20?',_0xa5ff5b+'%');_0x4c9a1f['or']('c.phone\x20LIKE\x20?',_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x70'),_0xa5ff5b+'%');_0x4c9a1f['or']('c.fax\x20LIKE\x20?',_0xa5ff5b+'%');}else if(qs[_0xa661('0x71')](_0xa5ff5b)){_0x4c9a1f['or'](_0xa661('0x72'),_0xa5ff5b+'%');}else{_0x4c9a1f['or'](_0xa661('0x73'),'%'+_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x74'),'%'+_0xa5ff5b+'%');_0x4c9a1f['or'](_0xa661('0x72'),'%'+_0xa5ff5b+'%');}}}}_0x354fad[_0xa661('0x3f')](_0x4c9a1f);_0x354fad[_0xa661('0x75')]('c.id');var _0x504191={'type':db[_0xa661('0x76')][_0xa661('0x77')]['SELECT'],'raw':!![]};var _0x3f0140=_0x354fad[_0xa661('0x78')]()[_0xa661('0x42')](_0xa661('0x79'));if(_0x436713[_0xa661('0x7a')]){_0x436713[_0xa661('0x7a')][_0xa661('0x54')](function(_0x4f29c6){_0x354fad[_0xa661('0x7a')]('c.'+_0x4f29c6[0x0],_0x4f29c6[0x1]===_0xa661('0x7b')?![]:!![]);});}if(!_[_0xa661('0x63')](_0x5145c0)){_0x354fad[_0xa661('0x7c')](_0x2bedab);_0x3f0140[_0xa661('0x3f')](_0xa661('0x7d'),_0x5145c0);}BPromise[_0xa661('0x7e')]()[_0xa661('0x29')](function(){if(!_0x44843e)return;if(_0x2e61ba[_0xa661('0x7f')]['role']!=='agent')return;if(!_[_0xa661('0x80')](_0x44843e[_0xa661('0x4f')],[_0xa661('0x42'),_0xa661('0x57')])){return _0x2e61ba['user'][_0xa661('0x81')]({'attributes':['id'],'raw':!![]})[_0xa661('0x29')](function(_0x54bba5){if(_[_0xa661('0x63')](_0x54bba5)){_0x3f0140[_0xa661('0x3f')](_0xa661('0x82'));_0x354fad[_0xa661('0x3f')](_0xa661('0x82'));}else{_0x3f0140[_0xa661('0x3f')](_0xa661('0x65'),_[_0xa661('0x53')](_0x54bba5,'id'));_0x354fad['where'](_0xa661('0x65'),_['map'](_0x54bba5,'id'));}});}})[_0xa661('0x29')](function(){if(_0x2e61ba[_0xa661('0x7f')][_0xa661('0x83')]===_0xa661('0x84')&&!_0x44843e&&!_0x2e61ba[_0xa661('0x39')][_0xa661('0x64')])return[];return db[_0xa661('0x85')][_0xa661('0x39')](_0x3f0140[_0xa661('0x86')](),_0x504191);})[_0xa661('0x29')](function(_0x490e0c){_0x86105a['count']=_0x490e0c['length'];if(_0x86105a['count']===0x0)return[];return db[_0xa661('0x85')][_0xa661('0x39')](_0x5ce6de[_0xa661('0x86')](),_0x504191)[_0xa661('0x29')](function(_0x2ad8c9){_0xd41142=_['keyBy'](_0x2ad8c9,'id');_0x504191=_[_0xa661('0x87')](_0x504191,{'model':db[_0xa661('0x88')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e61ba[_0xa661('0x39')]['fields']){_0x436713[_0xa661('0x3d')]['forEach'](function(_0x33dd5a){_0x354fad[_0xa661('0x42')]('c.'+_0x33dd5a);});}else{_0x354fad[_0xa661('0x42')](_0xa661('0x79'));_0x354fad[_0xa661('0x42')]('c.firstName');_0x354fad['field'](_0xa661('0x89'));_0x354fad[_0xa661('0x42')]('c.phone');_0x354fad[_0xa661('0x42')]('c.mobile');_0x354fad[_0xa661('0x42')](_0xa661('0x8a'));_0x354fad[_0xa661('0x42')](_0xa661('0x8b'));_0x354fad[_0xa661('0x42')](_0xa661('0x8c'));_0x354fad[_0xa661('0x42')](_0xa661('0x8d'));_0x354fad['field'](_0xa661('0x8e'));_0x354fad[_0xa661('0x42')](_0xa661('0x8f'));_0x354fad[_0xa661('0x42')](_0xa661('0x90'),_0xa661('0x91'));}if(_0x436713['limit'])_0x354fad[_0xa661('0x24')](_0x436713[_0xa661('0x24')]);if(_0x436713[_0xa661('0x23')])_0x354fad[_0xa661('0x23')](_0x436713[_0xa661('0x23')]);return db[_0xa661('0x85')][_0xa661('0x39')](_0x354fad['toString'](),_0x504191);});})[_0xa661('0x29')](function(_0x50a1fb){_0x50a1fb['forEach'](function(_0x12bb38){if(_0x12bb38['TagIds']){_0x12bb38[_0xa661('0x92')]=[];_0x12bb38['TagIds']['split'](',')[_0xa661('0x54')](function(_0x1bac44){_0x12bb38[_0xa661('0x92')][_0xa661('0x31')](_0xd41142[_0x1bac44]);});}delete _0x12bb38[_0xa661('0x91')];});_0x86105a[_0xa661('0x93')]=_0x50a1fb;return _0x86105a;})[_0xa661('0x29')](respondWithFilteredResult(_0x3f9d0b,_0x436713));})[_0xa661('0x94')](handleError(_0x3f9d0b,null));};exports[_0xa661('0x2a')]=function(_0x5b35c1,_0x4d251a){return db[_0xa661('0x88')][_0xa661('0x50')]({'where':{'id':_0x5b35c1[_0xa661('0x95')]['id']}})[_0xa661('0x29')](handleEntityNotFound(_0x4d251a,null))['then'](removeEntity(_0x4d251a,null))['catch'](handleError(_0x4d251a,null));};exports['describe']=function(_0x17d260,_0x292536){return db[_0xa661('0x88')][_0xa661('0x2e')]()['then'](function(_0x28b0ee){delete _0x28b0ee[_0xa661('0x96')];for(var _0x1dc4c8=0x0;_0x1dc4c8=_0x38d6e4){_0x4ffe2b=_0x38d6e4;_0x3abbba=0xc8;}else{_0x3abbba=0xce;}_0x57466a[_0x4b76('0x1e')](_0x3abbba);return _0x57466a[_0x4b76('0x23')](_0x4b76('0x24'),_0x383d8f+'-'+_0x4ffe2b+'/'+_0x38d6e4)[_0x4b76('0x25')](_0x3a46f);}return null;};}function patchUpdates(_0x2535a8){return function(_0x3e8c21){try{jsonpatch['apply'](_0x3e8c21,_0x2535a8,!![]);}catch(_0x37f81c){return BPromise[_0x4b76('0x26')](_0x37f81c);}return _0x3e8c21[_0x4b76('0x27')]();};}function saveUpdates(_0x181845,_0x36fcbd){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa['update'](_0x181845)['then'](function(_0x3535f7){return _0x3535f7;});}return null;};}function removeEntity(_0x305302,_0x46d179){return function(_0xbbf16c){if(_0xbbf16c){return _0xbbf16c[_0x4b76('0x28')]()[_0x4b76('0x29')](function(){_0x305302['status'](0xcc)[_0x4b76('0x1f')]();});}};}function handleEntityNotFound(_0x351cf3,_0x5ef046){return function(_0xfd2e4f){if(!_0xfd2e4f){_0x351cf3[_0x4b76('0x1d')](0x194);}return _0xfd2e4f;};}function handleError(_0x343c2d,_0xc2a266){_0xc2a266=_0xc2a266||0x1f4;return function(_0x473f04){logger[_0x4b76('0x2a')](_0x473f04[_0x4b76('0x2b')]);if(_0x473f04['name']){delete _0x473f04[_0x4b76('0x2c')];}_0x343c2d[_0x4b76('0x1e')](_0xc2a266)[_0x4b76('0x2d')](_0x473f04);};}exports[_0x4b76('0x2e')]=function(_0x484c97,_0x4a63fc){var _0x1e1349={},_0x535550={},_0x19573c={'count':0x0,'rows':[]};return db[_0x4b76('0x2f')]['describe']()[_0x4b76('0x29')](function(_0x1467ac){var _0x478cf0=[];for(var _0x3dc2c8=0x0;_0x3dc2c80x1){_0x1085f9['or'](_0x4b76('0x66'),qs[_0x4b76('0x67')](_0x2f9bb5),null);}else{if(qs[_0x4b76('0x68')](_0x2f9bb5)){_0x1085f9['or'](_0x4b76('0x69'),_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6a'),_0x2f9bb5+'%');_0x1085f9['or']('c.mobile\x20LIKE\x20?',_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6b'),_0x2f9bb5+'%');}else if(qs[_0x4b76('0x6c')](_0x2f9bb5)){_0x1085f9['or'](_0x4b76('0x6d'),_0x2f9bb5+'%');}else{_0x1085f9['or'](_0x4b76('0x6e'),'%'+_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6f'),'%'+_0x2f9bb5+'%');_0x1085f9['or']('c.email\x20LIKE\x20?','%'+_0x2f9bb5+'%');}}}}_0x594d47[_0x4b76('0x42')](_0x1085f9);_0x594d47[_0x4b76('0x70')](_0x4b76('0x71'));var _0x4fa1b9={'type':db[_0x4b76('0x72')][_0x4b76('0x73')]['SELECT'],'raw':!![]};var _0x23d353=_0x594d47[_0x4b76('0x74')]()[_0x4b76('0x45')]('c.id');if(_0x1e1349[_0x4b76('0x40')]){_0x1e1349[_0x4b76('0x40')]['forEach'](function(_0x312ab6){_0x594d47[_0x4b76('0x40')]('c.'+_0x312ab6[0x0],_0x312ab6[0x1]===_0x4b76('0x75')?![]:!![]);});}if(!_[_0x4b76('0x76')](_0x5508cf)){_0x594d47[_0x4b76('0x77')](_0x35d8e0);_0x23d353[_0x4b76('0x42')](_0x4b76('0x78'),_0x5508cf);}BPromise[_0x4b76('0x79')]()['then'](function(){if(!_0x28e573)return;if(_0x484c97[_0x4b76('0x7a')]['role']!==_0x4b76('0x7b'))return;if(!_[_0x4b76('0x7c')](_0x28e573[_0x4b76('0x4f')],['field',_0x4b76('0x54')])){return _0x484c97[_0x4b76('0x7a')][_0x4b76('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x266167){if(_['isEmpty'](_0x266167)){_0x23d353[_0x4b76('0x42')](_0x4b76('0x7e'));_0x594d47[_0x4b76('0x42')](_0x4b76('0x7e'));}else{_0x23d353['where'](_0x4b76('0x60'),_[_0x4b76('0x52')](_0x266167,'id'));_0x594d47['where'](_0x4b76('0x60'),_[_0x4b76('0x52')](_0x266167,'id'));}});}})[_0x4b76('0x29')](function(){if(_0x484c97[_0x4b76('0x7a')][_0x4b76('0x7f')]===_0x4b76('0x7b')&&!_0x28e573&&!_0x484c97[_0x4b76('0x39')][_0x4b76('0x5f')])return[];return db[_0x4b76('0x80')]['query'](_0x23d353[_0x4b76('0x81')](),_0x4fa1b9);})[_0x4b76('0x29')](function(_0x26dfc8){_0x19573c['count']=_0x26dfc8[_0x4b76('0x31')];if(_0x19573c[_0x4b76('0x20')]===0x0)return[];return db[_0x4b76('0x80')][_0x4b76('0x39')](_0x130c13[_0x4b76('0x81')](),_0x4fa1b9)[_0x4b76('0x29')](function(_0x13b834){_0x2b1e8b=_[_0x4b76('0x82')](_0x13b834,'id');_0x4fa1b9=_[_0x4b76('0x83')](_0x4fa1b9,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x484c97[_0x4b76('0x39')][_0x4b76('0x3c')]){_0x1e1349[_0x4b76('0x3d')][_0x4b76('0x53')](function(_0xc6c881){_0x594d47[_0x4b76('0x45')]('c.'+_0xc6c881);});}else{_0x594d47['field'](_0x4b76('0x71'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x84'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x85'));_0x594d47[_0x4b76('0x45')]('c.phone');_0x594d47['field']('c.mobile');_0x594d47[_0x4b76('0x45')]('c.fax');_0x594d47[_0x4b76('0x45')](_0x4b76('0x86'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x87'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x88'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x89'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x8a'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x8b'),_0x4b76('0x8c'));}if(_0x1e1349[_0x4b76('0x22')])_0x594d47[_0x4b76('0x22')](_0x1e1349[_0x4b76('0x22')]);if(_0x1e1349['offset'])_0x594d47['offset'](_0x1e1349[_0x4b76('0x21')]);return db[_0x4b76('0x80')]['query'](_0x594d47[_0x4b76('0x81')](),_0x4fa1b9);});})[_0x4b76('0x29')](function(_0x1abc5){_0x1abc5[_0x4b76('0x53')](function(_0xd1ef92){if(_0xd1ef92[_0x4b76('0x8c')]){_0xd1ef92['Tags']=[];_0xd1ef92['TagIds'][_0x4b76('0x51')](',')[_0x4b76('0x53')](function(_0x3340c9){_0xd1ef92['Tags']['push'](_0x2b1e8b[_0x3340c9]);});}delete _0xd1ef92['TagIds'];});_0x19573c[_0x4b76('0x8d')]=_0x1abc5;return _0x19573c;})[_0x4b76('0x29')](respondWithFilteredResult(_0x4a63fc,_0x1e1349));})['catch'](handleError(_0x4a63fc,null));};exports['destroy']=function(_0x4edcee,_0x174624){return db['CmContact'][_0x4b76('0x8e')]({'where':{'id':_0x4edcee[_0x4b76('0x8f')]['id']}})['then'](handleEntityNotFound(_0x174624,null))[_0x4b76('0x29')](removeEntity(_0x174624,null))[_0x4b76('0x90')](handleError(_0x174624,null));};exports[_0x4b76('0x91')]=function(_0x5cc7f4,_0x37fce2){return db['CmContact'][_0x4b76('0x91')]()[_0x4b76('0x29')](function(_0x36088c){delete _0x36088c[_0x4b76('0x92')];for(var _0x36009f=0x0;_0x36009f{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file +var _0xae24=['path','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','format','extname','now','single','file','uploadCsv','server/files/tmp','replace','%s-%s%s','upload','/upload/:id','import','put','update','delete','destroy','exports','multer'];(function(_0x2870e8,_0x45e908){var _0x13b9d=function(_0x458e6e){while(--_0x458e6e){_0x2870e8['push'](_0x2870e8['shift']());}};_0x13b9d(++_0x45e908);}(_0xae24,0x182));var _0x4ae2=function(_0x215ca2,_0x233c5d){_0x215ca2=_0x215ca2-0x0;var _0x1f404b=_0xae24[_0x215ca2];return _0x1f404b;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./cmContact.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['describe']);router['get'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0x5')](_0x4ae2('0xa'),auth['isAuthenticated'](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0x5')](_0x4ae2('0xc'),auth[_0x4ae2('0x6')](),controller['getHoppers']);router[_0x4ae2('0x5')](_0x4ae2('0xd'),auth[_0x4ae2('0x6')](),controller['getHopperHistories']);router[_0x4ae2('0x5')](_0x4ae2('0xe'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xf')]);router[_0x4ae2('0x5')](_0x4ae2('0x10'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x11')]);router[_0x4ae2('0x12')]('/merge',auth['isAuthenticated'](),controller['merge']);router[_0x4ae2('0x12')]('/',auth[_0x4ae2('0x6')](),controller['create']);router[_0x4ae2('0x12')](_0x4ae2('0x13'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x14')]);router[_0x4ae2('0x12')](_0x4ae2('0xa'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x15')]);var upload=multer({'storage':multer[_0x4ae2('0x16')]({'destination':function(_0x18936a,_0x4d5071,_0x4a97af){_0x4a97af(null,path[_0x4ae2('0x17')](config[_0x4ae2('0x18')],'server/files/tmp'));},'filename':function(_0x45c1bf,_0x343db1,_0xccb3b){_0x343db1[_0x4ae2('0x19')]=_0x343db1[_0x4ae2('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xccb3b(null,util[_0x4ae2('0x1a')]('%s-%s%s',path['basename'](_0x343db1[_0x4ae2('0x19')],path[_0x4ae2('0x1b')](_0x343db1[_0x4ae2('0x19')])),Date[_0x4ae2('0x1c')](),path[_0x4ae2('0x1b')](_0x343db1['originalname'])));}})});router[_0x4ae2('0x12')]('/csv',upload[_0x4ae2('0x1d')](_0x4ae2('0x1e')),controller[_0x4ae2('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43f112,_0x6f0cc6,_0x2454b3){_0x2454b3(null,path[_0x4ae2('0x17')](config[_0x4ae2('0x18')],_0x4ae2('0x20')));},'filename':function(_0x5b2e65,_0x5962b0,_0x9508d7){_0x5962b0[_0x4ae2('0x19')]=_0x5962b0[_0x4ae2('0x19')][_0x4ae2('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9508d7(null,util[_0x4ae2('0x1a')](_0x4ae2('0x22'),path['basename'](_0x5962b0['originalname'],path[_0x4ae2('0x1b')](_0x5962b0['originalname'])),Date['now'](),path['extname'](_0x5962b0[_0x4ae2('0x19')])));}})});router[_0x4ae2('0x12')]('/upload',upload[_0x4ae2('0x1d')](_0x4ae2('0x1e')),controller[_0x4ae2('0x23')]);router[_0x4ae2('0x12')](_0x4ae2('0x24'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x25')]);router[_0x4ae2('0x26')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x27')]);router[_0x4ae2('0x28')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x29')]);module[_0x4ae2('0x2a')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 50c4eca..d2d720d 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 _0xd072=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x4bbce6,_0x554194){var _0x33ab0a=function(_0x8f9f9c){while(--_0x8f9f9c){_0x4bbce6['push'](_0x4bbce6['shift']());}};_0x33ab0a(++_0x554194);}(_0xd072,0x132));var _0x2d07=function(_0x1105d9,_0x142fa5){_0x1105d9=_0x1105d9-0x0;var _0x896c61=_0xd072[_0x1105d9];return _0x896c61;};'use strict';var Sequelize=require(_0x2d07('0x0'));module[_0x2d07('0x1')]={'CmContactId':{'type':Sequelize[_0x2d07('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2d07('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2d07('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2d07('0x3')],'defaultValue':_0x2d07('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x96fd=['PHONE','exports','STRING','INTEGER'];(function(_0x370987,_0x16ce5a){var _0x4382db=function(_0x2ba31b){while(--_0x2ba31b){_0x370987['push'](_0x370987['shift']());}};_0x4382db(++_0x16ce5a);}(_0x96fd,0x1e9));var _0xd96f=function(_0x1bccda,_0x1009e2){_0x1bccda=_0x1bccda-0x0;var _0x486285=_0x96fd[_0x1bccda];return _0x486285;};'use strict';var Sequelize=require('sequelize');module[_0xd96f('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xd96f('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd96f('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd96f('0x3')},'OrderBy':{'type':Sequelize[_0xd96f('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 130ce2f..c5d597c 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 _0xfead=['UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','reject','save','update','then','destroy','get','CmContactHasItems'];(function(_0xef5648,_0x12fe60){var _0x5b808a=function(_0x5a0f89){while(--_0x5a0f89){_0xef5648['push'](_0xef5648['shift']());}};_0x5b808a(++_0x12fe60);}(_0xfead,0x152));var _0xdfea=function(_0x1689f7,_0x16c276){_0x1689f7=_0x1689f7-0x0;var _0x2059af=_0xfead[_0x1689f7];return _0x2059af;};'use strict';var pdf=require(_0xdfea('0x0'));var emlformat=require(_0xdfea('0x1'));var rimraf=require(_0xdfea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfea('0x3'));var rp=require('request-promise');var moment=require(_0xdfea('0x4'));var BPromise=require(_0xdfea('0x5'));var Mustache=require(_0xdfea('0x6'));var util=require('util');var path=require(_0xdfea('0x7'));var sox=require('sox');var csv=require(_0xdfea('0x8'));var ejs=require(_0xdfea('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdfea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdfea('0xb'));var toCsv=require(_0xdfea('0x8'));var querystring=require(_0xdfea('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfea('0xd'));var qs=require(_0xdfea('0xe'));var as=require(_0xdfea('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfea('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfea('0x11'));var db=require(_0xdfea('0x12'))['db'];function respondWithStatusCode(_0x1fcecd,_0x335aa2){_0x335aa2=_0x335aa2||0xcc;return function(_0x395c0e){if(_0x395c0e){return _0x1fcecd['sendStatus'](_0x335aa2);}return _0x1fcecd[_0xdfea('0x13')](_0x335aa2)[_0xdfea('0x14')]();};}function respondWithResult(_0x480f44,_0x534f73){_0x534f73=_0x534f73||0xc8;return function(_0x3e4fd3){if(_0x3e4fd3){return _0x480f44[_0xdfea('0x13')](_0x534f73)[_0xdfea('0x15')](_0x3e4fd3);}};}function respondWithFilteredResult(_0x1279fc,_0x1b01a2){return function(_0x5ce6b1){if(_0x5ce6b1){var _0x1f4755=_0x5ce6b1[_0xdfea('0x16')],_0x167b5d=_0x1b01a2['offset'],_0x3d605e=_0x1b01a2['offset']+_0x1b01a2[_0xdfea('0x17')],_0x31a7ab;if(_0x3d605e>=_0x1f4755){_0x3d605e=_0x1f4755;_0x31a7ab=0xc8;}else{_0x31a7ab=0xce;}_0x1279fc['status'](_0x31a7ab);return _0x1279fc[_0xdfea('0x18')]('Content-Range',_0x167b5d+'-'+_0x3d605e+'/'+_0x1f4755)[_0xdfea('0x15')](_0x5ce6b1);}return null;};}function patchUpdates(_0x2a2a76){return function(_0x2a1f23){try{jsonpatch['apply'](_0x2a1f23,_0x2a2a76,!![]);}catch(_0xeb3b83){return BPromise[_0xdfea('0x19')](_0xeb3b83);}return _0x2a1f23[_0xdfea('0x1a')]();};}function saveUpdates(_0x47a34d,_0x40e1e8){return function(_0x37a60c){if(_0x37a60c){return _0x37a60c[_0xdfea('0x1b')](_0x47a34d)[_0xdfea('0x1c')](function(_0xff3862){return _0xff3862;});}return null;};}function removeEntity(_0xc1ab75,_0x54812f){return function(_0x281060){if(_0x281060){return _0x281060[_0xdfea('0x1d')]()[_0xdfea('0x1c')](function(){var _0x203a01=_0x281060[_0xdfea('0x1e')]({'plain':!![]});var _0x2edc0f=_0xdfea('0x1f');return db[_0xdfea('0x20')]['destroy']({'where':{'type':_0x2edc0f,'resourceId':_0x203a01['id']}})[_0xdfea('0x1c')](function(){return _0x281060;});})[_0xdfea('0x1c')](function(){_0xc1ab75[_0xdfea('0x13')](0xcc)[_0xdfea('0x14')]();});}};}function handleEntityNotFound(_0x25ac4e,_0x279eea){return function(_0x287bab){if(!_0x287bab){_0x25ac4e['sendStatus'](0x194);}return _0x287bab;};}function handleError(_0x2e0d98,_0xae6e98){_0xae6e98=_0xae6e98||0x1f4;return function(_0x25923e){logger[_0xdfea('0x21')](_0x25923e[_0xdfea('0x22')]);if(_0x25923e[_0xdfea('0x23')]){delete _0x25923e[_0xdfea('0x23')];}_0x2e0d98[_0xdfea('0x13')](_0xae6e98)[_0xdfea('0x24')](_0x25923e);};}exports[_0xdfea('0x25')]=function(_0x53922c,_0x58b501){var _0x2a6fee={},_0x127473={},_0x578f1b={'count':0x0,'rows':[]};var _0x4b105e=_[_0xdfea('0x26')](db[_0xdfea('0x27')][_0xdfea('0x28')],function(_0x3651a1){return{'name':_0x3651a1[_0xdfea('0x29')],'type':_0x3651a1[_0xdfea('0x2a')][_0xdfea('0x2b')]};});_0x127473[_0xdfea('0x2c')]=_[_0xdfea('0x26')](_0x4b105e,_0xdfea('0x23'));_0x127473[_0xdfea('0x2d')]=_[_0xdfea('0x2e')](_0x53922c[_0xdfea('0x2d')]);_0x127473[_0xdfea('0x2f')]=_[_0xdfea('0x30')](_0x127473['model'],_0x127473[_0xdfea('0x2d')]);_0x2a6fee['attributes']=_[_0xdfea('0x30')](_0x127473[_0xdfea('0x2c')],qs[_0xdfea('0x31')](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x31')]));_0x2a6fee[_0xdfea('0x32')]=_0x2a6fee[_0xdfea('0x32')][_0xdfea('0x33')]?_0x2a6fee[_0xdfea('0x32')]:_0x127473[_0xdfea('0x2c')];if(!_0x53922c['query'][_0xdfea('0x34')]('nolimit')){_0x2a6fee['limit']=qs[_0xdfea('0x17')](_0x53922c[_0xdfea('0x2d')]['limit']);_0x2a6fee[_0xdfea('0x35')]=qs['offset'](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x35')]);}_0x2a6fee['order']=qs[_0xdfea('0x36')](_0x53922c[_0xdfea('0x2d')][_0xdfea('0x36')]);_0x2a6fee[_0xdfea('0x37')]=qs[_0xdfea('0x2f')](_[_0xdfea('0x38')](_0x53922c[_0xdfea('0x2d')],_0x127473[_0xdfea('0x2f')]),_0x4b105e);if(_0x53922c['query'][_0xdfea('0x39')]){_0x2a6fee[_0xdfea('0x37')]=_[_0xdfea('0x3a')](_0x2a6fee[_0xdfea('0x37')],{'$or':_[_0xdfea('0x26')](_0x4b105e,function(_0x584cdc){if(_0x584cdc['type']!==_0xdfea('0x3b')){var _0xe5c53d={};_0xe5c53d[_0x584cdc[_0xdfea('0x23')]]={'$like':'%'+_0x53922c['query'][_0xdfea('0x39')]+'%'};return _0xe5c53d;}})});}_0x2a6fee=_[_0xdfea('0x3a')]({},_0x2a6fee,_0x53922c['options']);var _0x34fac3={'where':_0x2a6fee[_0xdfea('0x37')]};return db[_0xdfea('0x27')][_0xdfea('0x16')](_0x34fac3)[_0xdfea('0x1c')](function(_0x266b76){_0x578f1b[_0xdfea('0x16')]=_0x266b76;if(_0x53922c['query'][_0xdfea('0x3c')]){_0x2a6fee[_0xdfea('0x3d')]=[{'all':!![]}];}return db[_0xdfea('0x27')][_0xdfea('0x3e')](_0x2a6fee);})['then'](function(_0x13305c){_0x578f1b[_0xdfea('0x3f')]=_0x13305c;return _0x578f1b;})[_0xdfea('0x1c')](respondWithFilteredResult(_0x58b501,_0x2a6fee))[_0xdfea('0x40')](handleError(_0x58b501,null));};exports['show']=function(_0x1e3572,_0x3acfc4){var _0x4e8498={'raw':!![],'where':{'id':_0x1e3572['params']['id']}},_0x443ca9={};_0x443ca9[_0xdfea('0x2c')]=_[_0xdfea('0x2e')](db[_0xdfea('0x27')][_0xdfea('0x28')]);_0x443ca9[_0xdfea('0x2d')]=_[_0xdfea('0x2e')](_0x1e3572[_0xdfea('0x2d')]);_0x443ca9[_0xdfea('0x2f')]=_['intersection'](_0x443ca9[_0xdfea('0x2c')],_0x443ca9['query']);_0x4e8498['attributes']=_[_0xdfea('0x30')](_0x443ca9[_0xdfea('0x2c')],qs[_0xdfea('0x31')](_0x1e3572[_0xdfea('0x2d')][_0xdfea('0x31')]));_0x4e8498[_0xdfea('0x32')]=_0x4e8498[_0xdfea('0x32')][_0xdfea('0x33')]?_0x4e8498[_0xdfea('0x32')]:_0x443ca9[_0xdfea('0x2c')];if(_0x1e3572[_0xdfea('0x2d')][_0xdfea('0x3c')]){_0x4e8498[_0xdfea('0x3d')]=[{'all':!![]}];}_0x4e8498=_['merge']({},_0x4e8498,_0x1e3572[_0xdfea('0x41')]);return db[_0xdfea('0x27')][_0xdfea('0x42')](_0x4e8498)['then'](handleEntityNotFound(_0x3acfc4,null))[_0xdfea('0x1c')](respondWithResult(_0x3acfc4,null))['catch'](handleError(_0x3acfc4,null));};exports[_0xdfea('0x43')]=function(_0x372f6c,_0x80ba85){return db[_0xdfea('0x27')]['create'](_0x372f6c[_0xdfea('0x44')],{})[_0xdfea('0x1c')](function(_0x55b71c){var _0x18d502=_0x372f6c[_0xdfea('0x45')]['get']({'plain':!![]});if(!_0x18d502)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18d502['role']===_0xdfea('0x45')){var _0x3a7e10=_0x55b71c[_0xdfea('0x1e')]({'plain':!![]});var _0xfc838a=_0xdfea('0x1f');return db[_0xdfea('0x46')][_0xdfea('0x42')]({'where':{'name':_0xfc838a,'userProfileId':_0x18d502[_0xdfea('0x47')]},'raw':!![]})[_0xdfea('0x1c')](function(_0x1517bc){if(_0x1517bc&&_0x1517bc[_0xdfea('0x48')]===0x0){return db[_0xdfea('0x20')]['create']({'name':_0x3a7e10['name'],'resourceId':_0x3a7e10['id'],'type':_0x1517bc[_0xdfea('0x23')],'sectionId':_0x1517bc['id']},{})[_0xdfea('0x1c')](function(){return _0x55b71c;});}else{return _0x55b71c;}})['catch'](function(_0x3180e4){logger[_0xdfea('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3180e4);throw _0x3180e4;});}return _0x55b71c;})[_0xdfea('0x1c')](respondWithResult(_0x80ba85,0xc9))[_0xdfea('0x40')](handleError(_0x80ba85,null));};exports[_0xdfea('0x1b')]=function(_0xe9fd94,_0x32bfae){if(_0xe9fd94[_0xdfea('0x44')]['id']){delete _0xe9fd94[_0xdfea('0x44')]['id'];}return db[_0xdfea('0x27')][_0xdfea('0x42')]({'where':{'id':_0xe9fd94[_0xdfea('0x49')]['id']}})[_0xdfea('0x1c')](handleEntityNotFound(_0x32bfae,null))['then'](saveUpdates(_0xe9fd94[_0xdfea('0x44')],null))[_0xdfea('0x1c')](respondWithResult(_0x32bfae,null))['catch'](handleError(_0x32bfae,null));};exports[_0xdfea('0x1d')]=function(_0x44e763,_0x19c86c){return db['CmContactHasItem'][_0xdfea('0x42')]({'where':{'id':_0x44e763[_0xdfea('0x49')]['id']}})[_0xdfea('0x1c')](handleEntityNotFound(_0x19c86c,null))[_0xdfea('0x1c')](removeEntity(_0x19c86c,null))[_0xdfea('0x40')](handleError(_0x19c86c,null));}; \ No newline at end of file +var _0x053c=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','index','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll'];(function(_0x5ad96e,_0x2e0eb4){var _0x20d419=function(_0x15ddd2){while(--_0x15ddd2){_0x5ad96e['push'](_0x5ad96e['shift']());}};_0x20d419(++_0x2e0eb4);}(_0x053c,0xfc));var _0xc053=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x053c[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0xc053('0x0'));var emlformat=require(_0xc053('0x1'));var rimraf=require(_0xc053('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc053('0x3'));var moment=require(_0xc053('0x4'));var BPromise=require(_0xc053('0x5'));var Mustache=require(_0xc053('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc053('0x7'));var csv=require('to-csv');var ejs=require(_0xc053('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc053('0x9'));var jsforce=require(_0xc053('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc053('0xb'));var querystring=require('querystring');var Papa=require(_0xc053('0xc'));var Redis=require(_0xc053('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc053('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc053('0xf'));var logger=require(_0xc053('0x10'))(_0xc053('0x11'));var utils=require(_0xc053('0x12'));var config=require(_0xc053('0x13'));var licenseUtil=require(_0xc053('0x14'));var db=require(_0xc053('0x15'))['db'];function respondWithStatusCode(_0x2cc68a,_0x2bc207){_0x2bc207=_0x2bc207||0xcc;return function(_0x57f00e){if(_0x57f00e){return _0x2cc68a[_0xc053('0x16')](_0x2bc207);}return _0x2cc68a[_0xc053('0x17')](_0x2bc207)[_0xc053('0x18')]();};}function respondWithResult(_0x8e1cb3,_0x235e12){_0x235e12=_0x235e12||0xc8;return function(_0x7ea9f3){if(_0x7ea9f3){return _0x8e1cb3[_0xc053('0x17')](_0x235e12)[_0xc053('0x19')](_0x7ea9f3);}};}function respondWithFilteredResult(_0x54a7d0,_0x181107){return function(_0x264c0e){if(_0x264c0e){var _0x8a4b1b=_0x264c0e[_0xc053('0x1a')],_0xb50f73=_0x181107['offset'],_0x116d00=_0x181107[_0xc053('0x1b')]+_0x181107['limit'],_0x590540;if(_0x116d00>=_0x8a4b1b){_0x116d00=_0x8a4b1b;_0x590540=0xc8;}else{_0x590540=0xce;}_0x54a7d0['status'](_0x590540);return _0x54a7d0['set'](_0xc053('0x1c'),_0xb50f73+'-'+_0x116d00+'/'+_0x8a4b1b)['json'](_0x264c0e);}return null;};}function patchUpdates(_0xad63e2){return function(_0x3603ec){try{jsonpatch[_0xc053('0x1d')](_0x3603ec,_0xad63e2,!![]);}catch(_0x23287e){return BPromise[_0xc053('0x1e')](_0x23287e);}return _0x3603ec[_0xc053('0x1f')]();};}function saveUpdates(_0x3ce3c9,_0x302d88){return function(_0x4af9dd){if(_0x4af9dd){return _0x4af9dd['update'](_0x3ce3c9)[_0xc053('0x20')](function(_0x4d9a88){return _0x4d9a88;});}return null;};}function removeEntity(_0x3970fe,_0x2657f8){return function(_0x2d58f2){if(_0x2d58f2){return _0x2d58f2[_0xc053('0x21')]()['then'](function(){var _0xe57474=_0x2d58f2[_0xc053('0x22')]({'plain':!![]});var _0x27e75d='CmContactHasItems';return db[_0xc053('0x23')][_0xc053('0x21')]({'where':{'type':_0x27e75d,'resourceId':_0xe57474['id']}})[_0xc053('0x20')](function(){return _0x2d58f2;});})['then'](function(){_0x3970fe[_0xc053('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c535,_0x3514c5){return function(_0x253ece){if(!_0x253ece){_0x31c535[_0xc053('0x16')](0x194);}return _0x253ece;};}function handleError(_0x1c94e3,_0x5810da){_0x5810da=_0x5810da||0x1f4;return function(_0x4255da){logger['error'](_0x4255da[_0xc053('0x24')]);if(_0x4255da['name']){delete _0x4255da[_0xc053('0x25')];}_0x1c94e3[_0xc053('0x17')](_0x5810da)['send'](_0x4255da);};}exports[_0xc053('0x26')]=function(_0x259092,_0x5d1328){var _0x20e643={},_0x7f37dd={},_0x105eaa={'count':0x0,'rows':[]};var _0x5cf192=_['map'](db[_0xc053('0x27')]['rawAttributes'],function(_0x51cdb3){return{'name':_0x51cdb3[_0xc053('0x28')],'type':_0x51cdb3[_0xc053('0x29')][_0xc053('0x2a')]};});_0x7f37dd[_0xc053('0x2b')]=_['map'](_0x5cf192,_0xc053('0x25'));_0x7f37dd[_0xc053('0x2c')]=_[_0xc053('0x2d')](_0x259092[_0xc053('0x2c')]);_0x7f37dd[_0xc053('0x2e')]=_[_0xc053('0x2f')](_0x7f37dd['model'],_0x7f37dd['query']);_0x20e643[_0xc053('0x30')]=_['intersection'](_0x7f37dd[_0xc053('0x2b')],qs[_0xc053('0x31')](_0x259092[_0xc053('0x2c')][_0xc053('0x31')]));_0x20e643[_0xc053('0x30')]=_0x20e643[_0xc053('0x30')][_0xc053('0x32')]?_0x20e643[_0xc053('0x30')]:_0x7f37dd[_0xc053('0x2b')];if(!_0x259092[_0xc053('0x2c')][_0xc053('0x33')]('nolimit')){_0x20e643[_0xc053('0x34')]=qs[_0xc053('0x34')](_0x259092[_0xc053('0x2c')][_0xc053('0x34')]);_0x20e643[_0xc053('0x1b')]=qs['offset'](_0x259092[_0xc053('0x2c')][_0xc053('0x1b')]);}_0x20e643[_0xc053('0x35')]=qs[_0xc053('0x36')](_0x259092[_0xc053('0x2c')][_0xc053('0x36')]);_0x20e643[_0xc053('0x37')]=qs[_0xc053('0x2e')](_['pick'](_0x259092['query'],_0x7f37dd[_0xc053('0x2e')]),_0x5cf192);if(_0x259092[_0xc053('0x2c')][_0xc053('0x38')]){_0x20e643[_0xc053('0x37')]=_[_0xc053('0x39')](_0x20e643[_0xc053('0x37')],{'$or':_[_0xc053('0x3a')](_0x5cf192,function(_0x9156d0){if(_0x9156d0[_0xc053('0x29')]!==_0xc053('0x3b')){var _0x33e91d={};_0x33e91d[_0x9156d0['name']]={'$like':'%'+_0x259092[_0xc053('0x2c')][_0xc053('0x38')]+'%'};return _0x33e91d;}})});}_0x20e643=_[_0xc053('0x39')]({},_0x20e643,_0x259092[_0xc053('0x3c')]);var _0x1c4073={'where':_0x20e643[_0xc053('0x37')]};return db[_0xc053('0x27')]['count'](_0x1c4073)[_0xc053('0x20')](function(_0x193e99){_0x105eaa[_0xc053('0x1a')]=_0x193e99;if(_0x259092[_0xc053('0x2c')]['includeAll']){_0x20e643['include']=[{'all':!![]}];}return db[_0xc053('0x27')][_0xc053('0x3d')](_0x20e643);})[_0xc053('0x20')](function(_0x39638f){_0x105eaa[_0xc053('0x3e')]=_0x39638f;return _0x105eaa;})[_0xc053('0x20')](respondWithFilteredResult(_0x5d1328,_0x20e643))[_0xc053('0x3f')](handleError(_0x5d1328,null));};exports[_0xc053('0x40')]=function(_0x16fb9e,_0x568f3d){var _0x190873={'raw':!![],'where':{'id':_0x16fb9e[_0xc053('0x41')]['id']}},_0x24a9e7={};_0x24a9e7[_0xc053('0x2b')]=_[_0xc053('0x2d')](db[_0xc053('0x27')][_0xc053('0x42')]);_0x24a9e7[_0xc053('0x2c')]=_[_0xc053('0x2d')](_0x16fb9e['query']);_0x24a9e7[_0xc053('0x2e')]=_[_0xc053('0x2f')](_0x24a9e7['model'],_0x24a9e7['query']);_0x190873[_0xc053('0x30')]=_[_0xc053('0x2f')](_0x24a9e7[_0xc053('0x2b')],qs['fields'](_0x16fb9e['query']['fields']));_0x190873[_0xc053('0x30')]=_0x190873[_0xc053('0x30')][_0xc053('0x32')]?_0x190873[_0xc053('0x30')]:_0x24a9e7[_0xc053('0x2b')];if(_0x16fb9e[_0xc053('0x2c')][_0xc053('0x43')]){_0x190873[_0xc053('0x44')]=[{'all':!![]}];}_0x190873=_['merge']({},_0x190873,_0x16fb9e['options']);return db[_0xc053('0x27')][_0xc053('0x45')](_0x190873)['then'](handleEntityNotFound(_0x568f3d,null))[_0xc053('0x20')](respondWithResult(_0x568f3d,null))[_0xc053('0x3f')](handleError(_0x568f3d,null));};exports[_0xc053('0x46')]=function(_0x539aca,_0x428df2){return db[_0xc053('0x27')][_0xc053('0x46')](_0x539aca['body'],{})['then'](function(_0x5a1072){var _0x2afdbb=_0x539aca[_0xc053('0x47')][_0xc053('0x22')]({'plain':!![]});if(!_0x2afdbb)throw new Error(_0xc053('0x48'));if(_0x2afdbb[_0xc053('0x49')]==='user'){var _0x4b7be0=_0x5a1072[_0xc053('0x22')]({'plain':!![]});var _0x24dd02='CmContactHasItems';return db[_0xc053('0x4a')]['find']({'where':{'name':_0x24dd02,'userProfileId':_0x2afdbb[_0xc053('0x4b')]},'raw':!![]})[_0xc053('0x20')](function(_0x487722){if(_0x487722&&_0x487722[_0xc053('0x4c')]===0x0){return db[_0xc053('0x23')][_0xc053('0x46')]({'name':_0x4b7be0[_0xc053('0x25')],'resourceId':_0x4b7be0['id'],'type':_0x487722[_0xc053('0x25')],'sectionId':_0x487722['id']},{})['then'](function(){return _0x5a1072;});}else{return _0x5a1072;}})['catch'](function(_0x38d3bc){logger[_0xc053('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38d3bc);throw _0x38d3bc;});}return _0x5a1072;})[_0xc053('0x20')](respondWithResult(_0x428df2,0xc9))[_0xc053('0x3f')](handleError(_0x428df2,null));};exports[_0xc053('0x4e')]=function(_0x32397b,_0x49a41c){if(_0x32397b[_0xc053('0x4f')]['id']){delete _0x32397b[_0xc053('0x4f')]['id'];}return db[_0xc053('0x27')][_0xc053('0x45')]({'where':{'id':_0x32397b[_0xc053('0x41')]['id']}})[_0xc053('0x20')](handleEntityNotFound(_0x49a41c,null))[_0xc053('0x20')](saveUpdates(_0x32397b[_0xc053('0x4f')],null))[_0xc053('0x20')](respondWithResult(_0x49a41c,null))['catch'](handleError(_0x49a41c,null));};exports[_0xc053('0x21')]=function(_0x477869,_0x27b200){return db[_0xc053('0x27')][_0xc053('0x45')]({'where':{'id':_0x477869[_0xc053('0x41')]['id']}})[_0xc053('0x20')](handleEntityNotFound(_0x27b200,null))['then'](removeEntity(_0x27b200,null))[_0xc053('0x3f')](handleError(_0x27b200,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4816b0c..66540a3 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 _0xeff8=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util','api','moment','bluebird','path'];(function(_0x5b1e8d,_0x4eaca){var _0x3ce7a4=function(_0x20eb53){while(--_0x20eb53){_0x5b1e8d['push'](_0x5b1e8d['shift']());}};_0x3ce7a4(++_0x4eaca);}(_0xeff8,0x186));var _0x8eff=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xeff8[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['exports','define','CmContactHasItem','cm_contact_has_items','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x293200,_0x95f715){var _0x20864f=function(_0x165c9d){while(--_0x165c9d){_0x293200['push'](_0x293200['shift']());}};_0x20864f(++_0x95f715);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index b61b6fe..0c5ba55 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 _0x11c3=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3827b0,_0x16cacf){var _0x241e2a=function(_0x258f6e){while(--_0x258f6e){_0x3827b0['push'](_0x3827b0['shift']());}};_0x241e2a(++_0x16cacf);}(_0x11c3,0x179));var _0x311c=function(_0xc48818,_0x53aa65){_0xc48818=_0xc48818-0x0;var _0x44953f=_0x11c3[_0xc48818];return _0x44953f;};'use strict';var _=require(_0x311c('0x0'));var util=require('util');var moment=require(_0x311c('0x1'));var BPromise=require(_0x311c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311c('0x3'));var db=require(_0x311c('0x4'))['db'];var utils=require(_0x311c('0x5'));var logger=require(_0x311c('0x6'))(_0x311c('0x7'));var config=require('../../config/environment');var jayson=require(_0x311c('0x8'));var client=jayson[_0x311c('0x9')][_0x311c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1472d5,_0x12d1d9,_0x1e67a4){return new BPromise(function(_0xee6b8d,_0x3634aa){return client['request'](_0x1472d5,_0x1e67a4)[_0x311c('0xb')](function(_0x5c9f1c){logger[_0x311c('0xc')](_0x311c('0xd'),_0x12d1d9,_0x311c('0xe'));logger[_0x311c('0xf')](_0x311c('0x10'),_0x12d1d9,_0x311c('0xe'),JSON[_0x311c('0x11')](_0x5c9f1c));if(_0x5c9f1c['error']){if(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x13')]===0x1f4){logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);return _0x3634aa(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);}logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);return _0xee6b8d(_0x5c9f1c[_0x311c('0x12')][_0x311c('0x14')]);}else{logger[_0x311c('0xc')](_0x311c('0xd'),_0x12d1d9,_0x311c('0xe'));_0xee6b8d(_0x5c9f1c[_0x311c('0x15')]['message']);}})['catch'](function(_0x4eb95f){logger[_0x311c('0x12')](_0x311c('0xd'),_0x12d1d9,_0x4eb95f);_0x3634aa(_0x4eb95f);});});} \ No newline at end of file +var _0xbb7c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5029e4,_0x4ed85f){var _0x4187c6=function(_0x380fd7){while(--_0x380fd7){_0x5029e4['push'](_0x5029e4['shift']());}};_0x4187c6(++_0x4ed85f);}(_0xbb7c,0x17a));var _0xcbb7=function(_0x5d973f,_0x37ba33){_0x5d973f=_0x5d973f-0x0;var _0x4bff69=_0xbb7c[_0x5d973f];return _0x4bff69;};'use strict';var _=require(_0xcbb7('0x0'));var util=require(_0xcbb7('0x1'));var moment=require(_0xcbb7('0x2'));var BPromise=require(_0xcbb7('0x3'));var rs=require(_0xcbb7('0x4'));var fs=require('fs');var Redis=require(_0xcbb7('0x5'));var db=require(_0xcbb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbb7('0x7'))(_0xcbb7('0x8'));var config=require(_0xcbb7('0x9'));var jayson=require(_0xcbb7('0xa'));var client=jayson[_0xcbb7('0xb')][_0xcbb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f359e,_0x1a9c84,_0x56f5ea){return new BPromise(function(_0x316c06,_0x255b0f){return client['request'](_0x3f359e,_0x56f5ea)['then'](function(_0xadeb65){logger[_0xcbb7('0xd')](_0xcbb7('0xe'),_0x1a9c84,_0xcbb7('0xf'));logger[_0xcbb7('0x10')](_0xcbb7('0x11'),_0x1a9c84,_0xcbb7('0xf'),JSON[_0xcbb7('0x12')](_0xadeb65));if(_0xadeb65[_0xcbb7('0x13')]){if(_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x14')]===0x1f4){logger[_0xcbb7('0x13')](_0xcbb7('0xe'),_0x1a9c84,_0xadeb65['error']['message']);return _0x255b0f(_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x15')]);}logger[_0xcbb7('0x13')](_0xcbb7('0xe'),_0x1a9c84,_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x15')]);return _0x316c06(_0xadeb65['error'][_0xcbb7('0x15')]);}else{logger[_0xcbb7('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x1a9c84,_0xcbb7('0xf'));_0x316c06(_0xadeb65[_0xcbb7('0x16')][_0xcbb7('0x15')]);}})[_0xcbb7('0x17')](function(_0x18ef80){logger[_0xcbb7('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x1a9c84,_0x18ef80);_0x255b0f(_0x18ef80);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ed17452..042c91b 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 _0x5e06=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmContactHasItem.controller','get'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5e06,0xbd));var _0x65e0=function(_0x1ffc11,_0x2423d4){_0x1ffc11=_0x1ffc11-0x0;var _0x1f781a=_0x5e06[_0x1ffc11];return _0x1f781a;};'use strict';var multer=require(_0x65e0('0x0'));var util=require(_0x65e0('0x1'));var path=require(_0x65e0('0x2'));var timeout=require(_0x65e0('0x3'));var express=require(_0x65e0('0x4'));var router=express[_0x65e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65e0('0x6'));var controller=require(_0x65e0('0x7'));router[_0x65e0('0x8')]('/',auth[_0x65e0('0x9')](),controller['index']);router['get'](_0x65e0('0xa'),auth['isAuthenticated'](),controller[_0x65e0('0xb')]);router[_0x65e0('0xc')]('/',auth[_0x65e0('0x9')](),controller[_0x65e0('0xd')]);router[_0x65e0('0xe')](_0x65e0('0xa'),auth[_0x65e0('0x9')](),controller[_0x65e0('0xf')]);router['delete'](_0x65e0('0xa'),auth['isAuthenticated'](),controller[_0x65e0('0x10')]);module[_0x65e0('0x11')]=router; \ No newline at end of file +var _0x89bc=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','/:id','update','delete','multer','util'];(function(_0x2a3990,_0xd4355c){var _0x32d362=function(_0x58bdca){while(--_0x58bdca){_0x2a3990['push'](_0x2a3990['shift']());}};_0x32d362(++_0xd4355c);}(_0x89bc,0xdf));var _0xc89b=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x89bc[_0x44c325];return _0x55f09e;};'use strict';var multer=require(_0xc89b('0x0'));var util=require(_0xc89b('0x1'));var path=require(_0xc89b('0x2'));var timeout=require(_0xc89b('0x3'));var express=require(_0xc89b('0x4'));var router=express[_0xc89b('0x5')]();var auth=require(_0xc89b('0x6'));var interaction=require(_0xc89b('0x7'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xc89b('0x8')]('/',auth[_0xc89b('0x9')](),controller[_0xc89b('0xa')]);router[_0xc89b('0x8')]('/:id',auth[_0xc89b('0x9')](),controller['show']);router[_0xc89b('0xb')]('/',auth[_0xc89b('0x9')](),controller['create']);router['put'](_0xc89b('0xc'),auth['isAuthenticated'](),controller[_0xc89b('0xd')]);router[_0xc89b('0xe')](_0xc89b('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 0dbef74..1991b41 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 _0xba9e=['STRING','sequelize','exports','INTEGER'];(function(_0x1ca543,_0x7d11e6){var _0x304668=function(_0x202264){while(--_0x202264){_0x1ca543['push'](_0x1ca543['shift']());}};_0x304668(++_0x7d11e6);}(_0xba9e,0xf5));var _0xeba9=function(_0x30ceaa,_0x2fe315){_0x30ceaa=_0x30ceaa-0x0;var _0x47850f=_0xba9e[_0x30ceaa];return _0x47850f;};'use strict';var Sequelize=require(_0xeba9('0x0'));module[_0xeba9('0x1')]={'CmContactId':{'type':Sequelize[_0xeba9('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xeba9('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x6fb5=['exports','INTEGER','STRING','sequelize'];(function(_0xd6a479,_0x1817cc){var _0x2a86d9=function(_0x617468){while(--_0x617468){_0xd6a479['push'](_0xd6a479['shift']());}};_0x2a86d9(++_0x1817cc);}(_0x6fb5,0x1d3));var _0x56fb=function(_0x39f38f,_0x172389){_0x39f38f=_0x39f38f-0x0;var _0xae1df7=_0x6fb5[_0x39f38f];return _0xae1df7;};'use strict';var Sequelize=require(_0x56fb('0x0'));module[_0x56fb('0x1')]={'CmContactId':{'type':Sequelize[_0x56fb('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x56fb('0x3')],'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 b1a8a19..23668af 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 _0x6381=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','CmContactHasPhone','include','rows','show','params','rawAttributes','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasPhones','UserProfileResource','error','stack','name','send','index','map','fieldName'];(function(_0x2394bd,_0x46fef1){var _0x5c1a48=function(_0x4ae5a4){while(--_0x4ae5a4){_0x2394bd['push'](_0x2394bd['shift']());}};_0x5c1a48(++_0x46fef1);}(_0x6381,0xcc));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1638('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1638('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1638('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1638('0x3'));var path=require(_0x1638('0x4'));var sox=require(_0x1638('0x5'));var csv=require(_0x1638('0x6'));var ejs=require(_0x1638('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1638('0x8'));var crypto=require(_0x1638('0x9'));var jsforce=require(_0x1638('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1638('0x6'));var querystring=require(_0x1638('0xb'));var Papa=require(_0x1638('0xc'));var Redis=require('ioredis');var authService=require(_0x1638('0xd'));var qs=require(_0x1638('0xe'));var as=require(_0x1638('0xf'));var hardwareService=require(_0x1638('0x10'));var logger=require(_0x1638('0x11'))(_0x1638('0x12'));var utils=require(_0x1638('0x13'));var config=require(_0x1638('0x14'));var licenseUtil=require(_0x1638('0x15'));var db=require(_0x1638('0x16'))['db'];function respondWithStatusCode(_0x1246f1,_0x5e4549){_0x5e4549=_0x5e4549||0xcc;return function(_0x453c37){if(_0x453c37){return _0x1246f1[_0x1638('0x17')](_0x5e4549);}return _0x1246f1['status'](_0x5e4549)[_0x1638('0x18')]();};}function respondWithResult(_0x32dd13,_0x45dfaa){_0x45dfaa=_0x45dfaa||0xc8;return function(_0x3128a8){if(_0x3128a8){return _0x32dd13[_0x1638('0x19')](_0x45dfaa)[_0x1638('0x1a')](_0x3128a8);}};}function respondWithFilteredResult(_0x489ac3,_0x1eba1e){return function(_0x29ee7d){if(_0x29ee7d){var _0x26c68f=_0x29ee7d[_0x1638('0x1b')],_0x33b238=_0x1eba1e['offset'],_0x56e662=_0x1eba1e['offset']+_0x1eba1e['limit'],_0x47c79c;if(_0x56e662>=_0x26c68f){_0x56e662=_0x26c68f;_0x47c79c=0xc8;}else{_0x47c79c=0xce;}_0x489ac3[_0x1638('0x19')](_0x47c79c);return _0x489ac3[_0x1638('0x1c')](_0x1638('0x1d'),_0x33b238+'-'+_0x56e662+'/'+_0x26c68f)['json'](_0x29ee7d);}return null;};}function patchUpdates(_0x37e74c){return function(_0x288367){try{jsonpatch[_0x1638('0x1e')](_0x288367,_0x37e74c,!![]);}catch(_0x5d24dd){return BPromise[_0x1638('0x1f')](_0x5d24dd);}return _0x288367[_0x1638('0x20')]();};}function saveUpdates(_0xf85dc6,_0x369f08){return function(_0x2c13e0){if(_0x2c13e0){return _0x2c13e0[_0x1638('0x21')](_0xf85dc6)[_0x1638('0x22')](function(_0xf12a2f){return _0xf12a2f;});}return null;};}function removeEntity(_0xdd0df,_0x3cff9a){return function(_0x1f69c7){if(_0x1f69c7){return _0x1f69c7[_0x1638('0x23')]()[_0x1638('0x22')](function(){var _0x2c275c=_0x1f69c7['get']({'plain':!![]});var _0x5909e8=_0x1638('0x24');return db[_0x1638('0x25')][_0x1638('0x23')]({'where':{'type':_0x5909e8,'resourceId':_0x2c275c['id']}})[_0x1638('0x22')](function(){return _0x1f69c7;});})['then'](function(){_0xdd0df[_0x1638('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a0a9,_0x5695fc){return function(_0x567d92){if(!_0x567d92){_0x59a0a9[_0x1638('0x17')](0x194);}return _0x567d92;};}function handleError(_0x5ca3f3,_0x2e9b08){_0x2e9b08=_0x2e9b08||0x1f4;return function(_0x5c4dce){logger[_0x1638('0x26')](_0x5c4dce[_0x1638('0x27')]);if(_0x5c4dce[_0x1638('0x28')]){delete _0x5c4dce['name'];}_0x5ca3f3[_0x1638('0x19')](_0x2e9b08)[_0x1638('0x29')](_0x5c4dce);};}exports[_0x1638('0x2a')]=function(_0x5ade6b,_0x24a903){var _0x475ade={},_0x5d020d={},_0x11c38f={'count':0x0,'rows':[]};var _0x19d7ef=_[_0x1638('0x2b')](db['CmContactHasPhone']['rawAttributes'],function(_0x14f648){return{'name':_0x14f648[_0x1638('0x2c')],'type':_0x14f648[_0x1638('0x2d')][_0x1638('0x2e')]};});_0x5d020d[_0x1638('0x2f')]=_[_0x1638('0x2b')](_0x19d7ef,'name');_0x5d020d[_0x1638('0x30')]=_[_0x1638('0x31')](_0x5ade6b['query']);_0x5d020d[_0x1638('0x32')]=_[_0x1638('0x33')](_0x5d020d['model'],_0x5d020d[_0x1638('0x30')]);_0x475ade[_0x1638('0x34')]=_['intersection'](_0x5d020d[_0x1638('0x2f')],qs[_0x1638('0x35')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x35')]));_0x475ade[_0x1638('0x34')]=_0x475ade['attributes']['length']?_0x475ade['attributes']:_0x5d020d[_0x1638('0x2f')];if(!_0x5ade6b['query'][_0x1638('0x36')](_0x1638('0x37'))){_0x475ade[_0x1638('0x38')]=qs[_0x1638('0x38')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x38')]);_0x475ade['offset']=qs[_0x1638('0x39')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x39')]);}_0x475ade[_0x1638('0x3a')]=qs[_0x1638('0x3b')](_0x5ade6b[_0x1638('0x30')][_0x1638('0x3b')]);_0x475ade[_0x1638('0x3c')]=qs[_0x1638('0x32')](_[_0x1638('0x3d')](_0x5ade6b[_0x1638('0x30')],_0x5d020d['filters']),_0x19d7ef);if(_0x5ade6b[_0x1638('0x30')][_0x1638('0x3e')]){_0x475ade['where']=_[_0x1638('0x3f')](_0x475ade[_0x1638('0x3c')],{'$or':_['map'](_0x19d7ef,function(_0x1928e4){if(_0x1928e4[_0x1638('0x2d')]!=='VIRTUAL'){var _0x27f254={};_0x27f254[_0x1928e4[_0x1638('0x28')]]={'$like':'%'+_0x5ade6b[_0x1638('0x30')]['filter']+'%'};return _0x27f254;}})});}_0x475ade=_['merge']({},_0x475ade,_0x5ade6b['options']);var _0x6edc69={'where':_0x475ade[_0x1638('0x3c')]};return db[_0x1638('0x40')]['count'](_0x6edc69)[_0x1638('0x22')](function(_0x4379dc){_0x11c38f[_0x1638('0x1b')]=_0x4379dc;if(_0x5ade6b['query']['includeAll']){_0x475ade[_0x1638('0x41')]=[{'all':!![]}];}return db[_0x1638('0x40')]['findAll'](_0x475ade);})[_0x1638('0x22')](function(_0x4d0c5c){_0x11c38f[_0x1638('0x42')]=_0x4d0c5c;return _0x11c38f;})[_0x1638('0x22')](respondWithFilteredResult(_0x24a903,_0x475ade))['catch'](handleError(_0x24a903,null));};exports[_0x1638('0x43')]=function(_0x1dc0b2,_0x503f14){var _0x58d24d={'raw':!![],'where':{'id':_0x1dc0b2[_0x1638('0x44')]['id']}},_0x11a7dc={};_0x11a7dc[_0x1638('0x2f')]=_[_0x1638('0x31')](db[_0x1638('0x40')][_0x1638('0x45')]);_0x11a7dc[_0x1638('0x30')]=_[_0x1638('0x31')](_0x1dc0b2[_0x1638('0x30')]);_0x11a7dc[_0x1638('0x32')]=_['intersection'](_0x11a7dc[_0x1638('0x2f')],_0x11a7dc[_0x1638('0x30')]);_0x58d24d[_0x1638('0x34')]=_[_0x1638('0x33')](_0x11a7dc[_0x1638('0x2f')],qs['fields'](_0x1dc0b2[_0x1638('0x30')][_0x1638('0x35')]));_0x58d24d[_0x1638('0x34')]=_0x58d24d[_0x1638('0x34')][_0x1638('0x46')]?_0x58d24d['attributes']:_0x11a7dc[_0x1638('0x2f')];if(_0x1dc0b2[_0x1638('0x30')][_0x1638('0x47')]){_0x58d24d[_0x1638('0x41')]=[{'all':!![]}];}_0x58d24d=_[_0x1638('0x3f')]({},_0x58d24d,_0x1dc0b2['options']);return db[_0x1638('0x40')][_0x1638('0x48')](_0x58d24d)[_0x1638('0x22')](handleEntityNotFound(_0x503f14,null))['then'](respondWithResult(_0x503f14,null))['catch'](handleError(_0x503f14,null));};exports[_0x1638('0x49')]=function(_0x51daad,_0x2219e2){return db['CmContactHasPhone'][_0x1638('0x49')](_0x51daad[_0x1638('0x4a')],{})[_0x1638('0x22')](function(_0x207be4){var _0xc1d9a3=_0x51daad[_0x1638('0x4b')][_0x1638('0x4c')]({'plain':!![]});if(!_0xc1d9a3)throw new Error(_0x1638('0x4d'));if(_0xc1d9a3[_0x1638('0x4e')]===_0x1638('0x4b')){var _0x449d9b=_0x207be4[_0x1638('0x4c')]({'plain':!![]});var _0x294932='CmContactHasPhones';return db[_0x1638('0x4f')][_0x1638('0x48')]({'where':{'name':_0x294932,'userProfileId':_0xc1d9a3['userProfileId']},'raw':!![]})['then'](function(_0x344919){if(_0x344919&&_0x344919[_0x1638('0x50')]===0x0){return db[_0x1638('0x25')][_0x1638('0x49')]({'name':_0x449d9b[_0x1638('0x28')],'resourceId':_0x449d9b['id'],'type':_0x344919[_0x1638('0x28')],'sectionId':_0x344919['id']},{})[_0x1638('0x22')](function(){return _0x207be4;});}else{return _0x207be4;}})[_0x1638('0x51')](function(_0x62d98d){logger['error'](_0x1638('0x52'),_0x62d98d);throw _0x62d98d;});}return _0x207be4;})['then'](respondWithResult(_0x2219e2,0xc9))[_0x1638('0x51')](handleError(_0x2219e2,null));};exports[_0x1638('0x21')]=function(_0x269730,_0x15c921){if(_0x269730[_0x1638('0x4a')]['id']){delete _0x269730['body']['id'];}return db[_0x1638('0x40')][_0x1638('0x48')]({'where':{'id':_0x269730[_0x1638('0x44')]['id']}})[_0x1638('0x22')](handleEntityNotFound(_0x15c921,null))[_0x1638('0x22')](saveUpdates(_0x269730['body'],null))[_0x1638('0x22')](respondWithResult(_0x15c921,null))[_0x1638('0x51')](handleError(_0x15c921,null));};exports[_0x1638('0x23')]=function(_0x52b172,_0x35fa31){return db['CmContactHasPhone'][_0x1638('0x48')]({'where':{'id':_0x52b172[_0x1638('0x44')]['id']}})['then'](handleEntityNotFound(_0x35fa31,null))[_0x1638('0x22')](removeEntity(_0x35fa31,null))[_0x1638('0x51')](handleError(_0x35fa31,null));}; \ No newline at end of file +var _0x6bd5=['lodash','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','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasPhones','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','CmContactHasPhone','include','rows','catch','show','params','fields','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs'];(function(_0x4c9c9d,_0x4eaa40){var _0x58322b=function(_0xa47cbb){while(--_0xa47cbb){_0x4c9c9d['push'](_0x4c9c9d['shift']());}};_0x58322b(++_0x4eaa40);}(_0x6bd5,0x1e3));var _0x56bd=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6bd5[_0x39c734];return _0xb2a2f9;};'use strict';var pdf=require(_0x56bd('0x0'));var emlformat=require(_0x56bd('0x1'));var rimraf=require(_0x56bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56bd('0x3'));var rp=require('request-promise');var moment=require(_0x56bd('0x4'));var BPromise=require(_0x56bd('0x5'));var Mustache=require('mustache');var util=require(_0x56bd('0x6'));var path=require('path');var sox=require(_0x56bd('0x7'));var csv=require('to-csv');var ejs=require(_0x56bd('0x8'));var fs=require('fs');var _=require(_0x56bd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56bd('0xa'));var deskjs=require(_0x56bd('0xb'));var toCsv=require(_0x56bd('0xc'));var querystring=require(_0x56bd('0xd'));var Papa=require(_0x56bd('0xe'));var Redis=require(_0x56bd('0xf'));var authService=require(_0x56bd('0x10'));var qs=require(_0x56bd('0x11'));var as=require(_0x56bd('0x12'));var hardwareService=require(_0x56bd('0x13'));var logger=require(_0x56bd('0x14'))(_0x56bd('0x15'));var utils=require(_0x56bd('0x16'));var config=require(_0x56bd('0x17'));var licenseUtil=require(_0x56bd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12ab99,_0x3359f4){_0x3359f4=_0x3359f4||0xcc;return function(_0x192b58){if(_0x192b58){return _0x12ab99['sendStatus'](_0x3359f4);}return _0x12ab99[_0x56bd('0x19')](_0x3359f4)[_0x56bd('0x1a')]();};}function respondWithResult(_0x1aab9a,_0x4da0e4){_0x4da0e4=_0x4da0e4||0xc8;return function(_0x506093){if(_0x506093){return _0x1aab9a['status'](_0x4da0e4)['json'](_0x506093);}};}function respondWithFilteredResult(_0x539afe,_0x25377d){return function(_0x85e449){if(_0x85e449){var _0x188974=_0x85e449[_0x56bd('0x1b')],_0x5dc98b=_0x25377d[_0x56bd('0x1c')],_0x2f352a=_0x25377d['offset']+_0x25377d[_0x56bd('0x1d')],_0x245778;if(_0x2f352a>=_0x188974){_0x2f352a=_0x188974;_0x245778=0xc8;}else{_0x245778=0xce;}_0x539afe['status'](_0x245778);return _0x539afe[_0x56bd('0x1e')](_0x56bd('0x1f'),_0x5dc98b+'-'+_0x2f352a+'/'+_0x188974)['json'](_0x85e449);}return null;};}function patchUpdates(_0x1b304f){return function(_0x5b47a0){try{jsonpatch[_0x56bd('0x20')](_0x5b47a0,_0x1b304f,!![]);}catch(_0x178975){return BPromise[_0x56bd('0x21')](_0x178975);}return _0x5b47a0[_0x56bd('0x22')]();};}function saveUpdates(_0x413430,_0x3c5750){return function(_0x213549){if(_0x213549){return _0x213549[_0x56bd('0x23')](_0x413430)[_0x56bd('0x24')](function(_0x2ebbee){return _0x2ebbee;});}return null;};}function removeEntity(_0x31c5f9,_0xe75eb4){return function(_0x111d4a){if(_0x111d4a){return _0x111d4a[_0x56bd('0x25')]()['then'](function(){var _0x58f707=_0x111d4a[_0x56bd('0x26')]({'plain':!![]});var _0x4391d3=_0x56bd('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4391d3,'resourceId':_0x58f707['id']}})[_0x56bd('0x24')](function(){return _0x111d4a;});})['then'](function(){_0x31c5f9[_0x56bd('0x19')](0xcc)[_0x56bd('0x1a')]();});}};}function handleEntityNotFound(_0x5ca21b,_0x231a6c){return function(_0x5351e0){if(!_0x5351e0){_0x5ca21b[_0x56bd('0x28')](0x194);}return _0x5351e0;};}function handleError(_0x1c1f3b,_0x449d30){_0x449d30=_0x449d30||0x1f4;return function(_0x79c7ab){logger['error'](_0x79c7ab['stack']);if(_0x79c7ab[_0x56bd('0x29')]){delete _0x79c7ab[_0x56bd('0x29')];}_0x1c1f3b['status'](_0x449d30)[_0x56bd('0x2a')](_0x79c7ab);};}exports[_0x56bd('0x2b')]=function(_0x1b4c79,_0x536360){var _0x5e5e61={},_0x4064d0={},_0x4cb47f={'count':0x0,'rows':[]};var _0xceb58=_[_0x56bd('0x2c')](db['CmContactHasPhone'][_0x56bd('0x2d')],function(_0x19bd25){return{'name':_0x19bd25[_0x56bd('0x2e')],'type':_0x19bd25['type'][_0x56bd('0x2f')]};});_0x4064d0[_0x56bd('0x30')]=_[_0x56bd('0x2c')](_0xceb58,_0x56bd('0x29'));_0x4064d0[_0x56bd('0x31')]=_[_0x56bd('0x32')](_0x1b4c79['query']);_0x4064d0[_0x56bd('0x33')]=_[_0x56bd('0x34')](_0x4064d0['model'],_0x4064d0['query']);_0x5e5e61['attributes']=_[_0x56bd('0x34')](_0x4064d0[_0x56bd('0x30')],qs['fields'](_0x1b4c79[_0x56bd('0x31')]['fields']));_0x5e5e61[_0x56bd('0x35')]=_0x5e5e61[_0x56bd('0x35')][_0x56bd('0x36')]?_0x5e5e61[_0x56bd('0x35')]:_0x4064d0['model'];if(!_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x37')](_0x56bd('0x38'))){_0x5e5e61[_0x56bd('0x1d')]=qs['limit'](_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x1d')]);_0x5e5e61[_0x56bd('0x1c')]=qs[_0x56bd('0x1c')](_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x1c')]);}_0x5e5e61['order']=qs[_0x56bd('0x39')](_0x1b4c79['query'][_0x56bd('0x39')]);_0x5e5e61[_0x56bd('0x3a')]=qs[_0x56bd('0x33')](_['pick'](_0x1b4c79['query'],_0x4064d0['filters']),_0xceb58);if(_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x3b')]){_0x5e5e61[_0x56bd('0x3a')]=_['merge'](_0x5e5e61[_0x56bd('0x3a')],{'$or':_[_0x56bd('0x2c')](_0xceb58,function(_0x2799e4){if(_0x2799e4[_0x56bd('0x3c')]!==_0x56bd('0x3d')){var _0x8ac68d={};_0x8ac68d[_0x2799e4[_0x56bd('0x29')]]={'$like':'%'+_0x1b4c79[_0x56bd('0x31')]['filter']+'%'};return _0x8ac68d;}})});}_0x5e5e61=_[_0x56bd('0x3e')]({},_0x5e5e61,_0x1b4c79[_0x56bd('0x3f')]);var _0xaa5805={'where':_0x5e5e61[_0x56bd('0x3a')]};return db[_0x56bd('0x40')][_0x56bd('0x1b')](_0xaa5805)['then'](function(_0x13ea9a){_0x4cb47f[_0x56bd('0x1b')]=_0x13ea9a;if(_0x1b4c79['query']['includeAll']){_0x5e5e61[_0x56bd('0x41')]=[{'all':!![]}];}return db[_0x56bd('0x40')]['findAll'](_0x5e5e61);})[_0x56bd('0x24')](function(_0x408dd2){_0x4cb47f[_0x56bd('0x42')]=_0x408dd2;return _0x4cb47f;})['then'](respondWithFilteredResult(_0x536360,_0x5e5e61))[_0x56bd('0x43')](handleError(_0x536360,null));};exports[_0x56bd('0x44')]=function(_0x3ecd8a,_0x329c1b){var _0x335bb3={'raw':!![],'where':{'id':_0x3ecd8a[_0x56bd('0x45')]['id']}},_0x8e5edb={};_0x8e5edb[_0x56bd('0x30')]=_[_0x56bd('0x32')](db['CmContactHasPhone'][_0x56bd('0x2d')]);_0x8e5edb[_0x56bd('0x31')]=_[_0x56bd('0x32')](_0x3ecd8a[_0x56bd('0x31')]);_0x8e5edb[_0x56bd('0x33')]=_[_0x56bd('0x34')](_0x8e5edb[_0x56bd('0x30')],_0x8e5edb['query']);_0x335bb3[_0x56bd('0x35')]=_[_0x56bd('0x34')](_0x8e5edb['model'],qs[_0x56bd('0x46')](_0x3ecd8a['query'][_0x56bd('0x46')]));_0x335bb3[_0x56bd('0x35')]=_0x335bb3['attributes'][_0x56bd('0x36')]?_0x335bb3[_0x56bd('0x35')]:_0x8e5edb['model'];if(_0x3ecd8a['query'][_0x56bd('0x47')]){_0x335bb3[_0x56bd('0x41')]=[{'all':!![]}];}_0x335bb3=_['merge']({},_0x335bb3,_0x3ecd8a[_0x56bd('0x3f')]);return db[_0x56bd('0x40')]['find'](_0x335bb3)[_0x56bd('0x24')](handleEntityNotFound(_0x329c1b,null))[_0x56bd('0x24')](respondWithResult(_0x329c1b,null))[_0x56bd('0x43')](handleError(_0x329c1b,null));};exports[_0x56bd('0x48')]=function(_0x5c9d4c,_0x4d3ef6){return db[_0x56bd('0x40')]['create'](_0x5c9d4c[_0x56bd('0x49')],{})[_0x56bd('0x24')](function(_0x37bdf2){var _0x224d42=_0x5c9d4c[_0x56bd('0x4a')][_0x56bd('0x26')]({'plain':!![]});if(!_0x224d42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x224d42[_0x56bd('0x4b')]==='user'){var _0x199816=_0x37bdf2[_0x56bd('0x26')]({'plain':!![]});var _0x349c0b=_0x56bd('0x27');return db[_0x56bd('0x4c')][_0x56bd('0x4d')]({'where':{'name':_0x349c0b,'userProfileId':_0x224d42[_0x56bd('0x4e')]},'raw':!![]})[_0x56bd('0x24')](function(_0x35b468){if(_0x35b468&&_0x35b468['autoAssociation']===0x0){return db[_0x56bd('0x4f')][_0x56bd('0x48')]({'name':_0x199816[_0x56bd('0x29')],'resourceId':_0x199816['id'],'type':_0x35b468[_0x56bd('0x29')],'sectionId':_0x35b468['id']},{})[_0x56bd('0x24')](function(){return _0x37bdf2;});}else{return _0x37bdf2;}})[_0x56bd('0x43')](function(_0x302cfe){logger[_0x56bd('0x50')](_0x56bd('0x51'),_0x302cfe);throw _0x302cfe;});}return _0x37bdf2;})[_0x56bd('0x24')](respondWithResult(_0x4d3ef6,0xc9))['catch'](handleError(_0x4d3ef6,null));};exports[_0x56bd('0x23')]=function(_0x50cfb6,_0xacbf57){if(_0x50cfb6[_0x56bd('0x49')]['id']){delete _0x50cfb6[_0x56bd('0x49')]['id'];}return db[_0x56bd('0x40')][_0x56bd('0x4d')]({'where':{'id':_0x50cfb6[_0x56bd('0x45')]['id']}})[_0x56bd('0x24')](handleEntityNotFound(_0xacbf57,null))[_0x56bd('0x24')](saveUpdates(_0x50cfb6[_0x56bd('0x49')],null))['then'](respondWithResult(_0xacbf57,null))['catch'](handleError(_0xacbf57,null));};exports['destroy']=function(_0x4f76ba,_0x5e3475){return db[_0x56bd('0x40')][_0x56bd('0x4d')]({'where':{'id':_0x4f76ba[_0x56bd('0x45')]['id']}})[_0x56bd('0x24')](handleEntityNotFound(_0x5e3475,null))[_0x56bd('0x24')](removeEntity(_0x5e3475,null))[_0x56bd('0x43')](handleError(_0x5e3475,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 679a121..c423e50 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 _0xb205=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','cm_contact_has_phones'];(function(_0x10f846,_0x445c1b){var _0x118ce5=function(_0x505c7c){while(--_0x505c7c){_0x10f846['push'](_0x10f846['shift']());}};_0x118ce5(++_0x445c1b);}(_0xb205,0xcc));var _0x5b20=function(_0x555435,_0xce8d7d){_0x555435=_0x555435-0x0;var _0x48ebd0=_0xb205[_0x555435];return _0x48ebd0;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b20('0x5'));var fs=require('fs');var path=require(_0x5b20('0x6'));var rimraf=require(_0x5b20('0x7'));var config=require(_0x5b20('0x8'));var attributes=require(_0x5b20('0x9'));module[_0x5b20('0xa')]=function(_0x287ac7,_0x51dc6e){return _0x287ac7['define']('CmContactHasPhone',attributes,{'tableName':_0x5b20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b1e=['path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','api','moment','request-promise'];(function(_0x5e9f6a,_0x2b7d54){var _0xc7246a=function(_0x256d27){while(--_0x256d27){_0x5e9f6a['push'](_0x5e9f6a['shift']());}};_0xc7246a(++_0x2b7d54);}(_0x2b1e,0x19b));var _0xe2b1=function(_0x318dce,_0x166f0f){_0x318dce=_0x318dce-0x0;var _0x1d98f7=_0x2b1e[_0x318dce];return _0x1d98f7;};'use strict';var _=require(_0xe2b1('0x0'));var util=require(_0xe2b1('0x1'));var logger=require('../../config/logger')(_0xe2b1('0x2'));var moment=require(_0xe2b1('0x3'));var BPromise=require('bluebird');var rp=require(_0xe2b1('0x4'));var fs=require('fs');var path=require(_0xe2b1('0x5'));var rimraf=require(_0xe2b1('0x6'));var config=require(_0xe2b1('0x7'));var attributes=require(_0xe2b1('0x8'));module[_0xe2b1('0x9')]=function(_0x518e2a,_0x5b11bc){return _0x518e2a[_0xe2b1('0xa')](_0xe2b1('0xb'),attributes,{'tableName':_0xe2b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index f2a6258..03db564 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 _0xc84c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc84c,0x12f));var _0xcc84=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xc84c[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xcc84('0x0'));var util=require(_0xcc84('0x1'));var moment=require(_0xcc84('0x2'));var BPromise=require(_0xcc84('0x3'));var rs=require(_0xcc84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc84('0x6'))(_0xcc84('0x7'));var config=require(_0xcc84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30030b,_0x54fc2b,_0x8daa1f){return new BPromise(function(_0x2635c4,_0x45c5cc){return client[_0xcc84('0xa')](_0x30030b,_0x8daa1f)[_0xcc84('0xb')](function(_0x58e08f){logger['info'](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));logger[_0xcc84('0xe')](_0xcc84('0xf'),_0x54fc2b,_0xcc84('0xd'),JSON[_0xcc84('0x10')](_0x58e08f));if(_0x58e08f[_0xcc84('0x11')]){if(_0x58e08f[_0xcc84('0x11')]['code']===0x1f4){logger[_0xcc84('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x54fc2b,_0x58e08f[_0xcc84('0x11')][_0xcc84('0x12')]);return _0x45c5cc(_0x58e08f[_0xcc84('0x11')]['message']);}logger[_0xcc84('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x54fc2b,_0x58e08f['error']['message']);return _0x2635c4(_0x58e08f['error'][_0xcc84('0x12')]);}else{logger[_0xcc84('0x13')](_0xcc84('0xc'),_0x54fc2b,_0xcc84('0xd'));_0x2635c4(_0x58e08f[_0xcc84('0x14')][_0xcc84('0x12')]);}})[_0xcc84('0x15')](function(_0x334ec8){logger[_0xcc84('0x11')](_0xcc84('0xc'),_0x54fc2b,_0x334ec8);_0x45c5cc(_0x334ec8);});});} \ No newline at end of file +var _0xb201=['stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb201,0x117));var _0x1b20=function(_0x77e35c,_0x4ce416){_0x77e35c=_0x77e35c-0x0;var _0x58b3ca=_0xb201[_0x77e35c];return _0x58b3ca;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var moment=require(_0x1b20('0x1'));var BPromise=require(_0x1b20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b20('0x3'));var db=require(_0x1b20('0x4'))['db'];var utils=require(_0x1b20('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b20('0x6'));var jayson=require(_0x1b20('0x7'));var client=jayson['client'][_0x1b20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a1b64,_0x44ce5f,_0x158a41){return new BPromise(function(_0x3f0519,_0x35eaa5){return client[_0x1b20('0x9')](_0x4a1b64,_0x158a41)['then'](function(_0x389092){logger[_0x1b20('0xa')](_0x1b20('0xb'),_0x44ce5f,_0x1b20('0xc'));logger[_0x1b20('0xd')](_0x1b20('0xe'),_0x44ce5f,_0x1b20('0xc'),JSON[_0x1b20('0xf')](_0x389092));if(_0x389092['error']){if(_0x389092['error'][_0x1b20('0x10')]===0x1f4){logger[_0x1b20('0x11')](_0x1b20('0xb'),_0x44ce5f,_0x389092['error'][_0x1b20('0x12')]);return _0x35eaa5(_0x389092['error'][_0x1b20('0x12')]);}logger[_0x1b20('0x11')](_0x1b20('0xb'),_0x44ce5f,_0x389092['error'][_0x1b20('0x12')]);return _0x3f0519(_0x389092[_0x1b20('0x11')]['message']);}else{logger['info'](_0x1b20('0xb'),_0x44ce5f,_0x1b20('0xc'));_0x3f0519(_0x389092[_0x1b20('0x13')]['message']);}})[_0x1b20('0x14')](function(_0x2be1ed){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x44ce5f,_0x2be1ed);_0x35eaa5(_0x2be1ed);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index e00da70..5693b40 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 _0xcd91=['index','/:id','show','post','create','put','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd91,0x139));var _0x1cd9=function(_0x39dd57,_0x4ef720){_0x39dd57=_0x39dd57-0x0;var _0x25171a=_0xcd91[_0x39dd57];return _0x25171a;};'use strict';var multer=require('multer');var util=require(_0x1cd9('0x0'));var path=require(_0x1cd9('0x1'));var timeout=require(_0x1cd9('0x2'));var express=require(_0x1cd9('0x3'));var router=express[_0x1cd9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cd9('0x5'));var config=require(_0x1cd9('0x6'));var controller=require(_0x1cd9('0x7'));router[_0x1cd9('0x8')]('/',auth[_0x1cd9('0x9')](),controller[_0x1cd9('0xa')]);router[_0x1cd9('0x8')](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller[_0x1cd9('0xc')]);router[_0x1cd9('0xd')]('/',auth['isAuthenticated'](),controller[_0x1cd9('0xe')]);router[_0x1cd9('0xf')](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller['update']);router['delete'](_0x1cd9('0xb'),auth[_0x1cd9('0x9')](),controller[_0x1cd9('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbea0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','isAuthenticated','show','post','/:id','update','delete','destroy','exports','util','path'];(function(_0x4be8c8,_0x4be2f6){var _0x42c7e9=function(_0x488b71){while(--_0x488b71){_0x4be8c8['push'](_0x4be8c8['shift']());}};_0x42c7e9(++_0x4be2f6);}(_0xbea0,0xa9));var _0x0bea=function(_0x528be9,_0xea36cd){_0x528be9=_0x528be9-0x0;var _0x209b83=_0xbea0[_0x528be9];return _0x209b83;};'use strict';var multer=require('multer');var util=require(_0x0bea('0x0'));var path=require(_0x0bea('0x1'));var timeout=require(_0x0bea('0x2'));var express=require(_0x0bea('0x3'));var router=express[_0x0bea('0x4')]();var auth=require(_0x0bea('0x5'));var interaction=require(_0x0bea('0x6'));var config=require(_0x0bea('0x7'));var controller=require(_0x0bea('0x8'));router[_0x0bea('0x9')]('/',auth['isAuthenticated'](),controller[_0x0bea('0xa')]);router[_0x0bea('0x9')]('/:id',auth[_0x0bea('0xb')](),controller[_0x0bea('0xc')]);router[_0x0bea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0bea('0xe'),auth['isAuthenticated'](),controller[_0x0bea('0xf')]);router[_0x0bea('0x10')](_0x0bea('0xe'),auth['isAuthenticated'](),controller[_0x0bea('0x11')]);module[_0x0bea('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f8195fa..5874e49 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 _0xa41a=['values','isArray','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','type','parse'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa41a,0x6b));var _0xaa41=function(_0x33c2b8,_0x2645ea){_0x33c2b8=_0x33c2b8-0x0;var _0x4ccb39=_0xa41a[_0x33c2b8];return _0x4ccb39;};'use strict';var Sequelize=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));module['exports']={'name':{'type':Sequelize[_0xaa41('0x2')],'get':function(_0x2a96ba){return this[_0xaa41('0x3')](_0xaa41('0x4'));}},'alias':{'type':Sequelize[_0xaa41('0x5')],'allowNull':![],'set':function(_0x3168be){this[_0xaa41('0x6')](_0xaa41('0x4'),_0x3168be?_0x3168be:this['getDataValue'](_0xaa41('0x7')));}},'type':{'type':Sequelize[_0xaa41('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xaa41('0x3')](_0xaa41('0x8'))==='select'){return JSON[_0xaa41('0x9')](this[_0xaa41('0x3')](_0xaa41('0xa')));}else{return this[_0xaa41('0x3')](_0xaa41('0xa'));}},'set':function(_0x38d930){if(Array[_0xaa41('0xb')](_0x38d930)){this[_0xaa41('0x6')](_0xaa41('0xa'),JSON['stringify'](_0x38d930));}else{this[_0xaa41('0x6')](_0xaa41('0xa'),_0x38d930);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xaa41('0xc')]('voice')}}; \ No newline at end of file +var _0xde50=['TEXT','long','type','values','isArray','stringify','ENUM','voice','exports','VIRTUAL','getDataValue','STRING','setDataValue'];(function(_0x58f66d,_0x440726){var _0x1a2303=function(_0x4c9e32){while(--_0x4c9e32){_0x58f66d['push'](_0x58f66d['shift']());}};_0x1a2303(++_0x440726);}(_0xde50,0x140));var _0x0de5=function(_0x36acb6,_0x572bf7){_0x36acb6=_0x36acb6-0x0;var _0x3b5cef=_0xde50[_0x36acb6];return _0x3b5cef;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x0de5('0x0')]={'name':{'type':Sequelize[_0x0de5('0x1')],'get':function(_0x13190a){return this[_0x0de5('0x2')]('alias');}},'alias':{'type':Sequelize[_0x0de5('0x3')],'allowNull':![],'set':function(_0x5c22bc){this[_0x0de5('0x4')]('alias',_0x5c22bc?_0x5c22bc:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x0de5('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x0de5('0x5')](_0x0de5('0x6')),'get':function(){if(this['getDataValue'](_0x0de5('0x7'))==='select'){return JSON['parse'](this['getDataValue'](_0x0de5('0x8')));}else{return this[_0x0de5('0x2')](_0x0de5('0x8'));}},'set':function(_0x5a165a){if(Array[_0x0de5('0x9')](_0x5a165a)){this[_0x0de5('0x4')]('values',JSON[_0x0de5('0xa')](_0x5a165a));}else{this[_0x0de5('0x4')](_0x0de5('0x8'),_0x5a165a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0de5('0xb')](_0x0de5('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9443007..8664503 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 _0xbbaf=['request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','rows','catch','show','params','keys','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','defaultValue','queryInterface','cm_contacts','format','cf_%d','html-pdf','eml-format','fast-json-patch'];(function(_0x2515a3,_0x356de5){var _0xe8bbb=function(_0x18876b){while(--_0x18876b){_0x2515a3['push'](_0x2515a3['shift']());}};_0xe8bbb(++_0x356de5);}(_0xbbaf,0x19c));var _0xfbba=function(_0x423160,_0x5bcb1){_0x423160=_0x423160-0x0;var _0x4683ce=_0xbbaf[_0x423160];return _0x4683ce;};'use strict';var pdf=require(_0xfbba('0x0'));var emlformat=require(_0xfbba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbba('0x2'));var rp=require(_0xfbba('0x3'));var moment=require(_0xfbba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbba('0x5'));var util=require(_0xfbba('0x6'));var path=require('path');var sox=require(_0xfbba('0x7'));var csv=require(_0xfbba('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbba('0x9'));var squel=require('squel');var crypto=require(_0xfbba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfbba('0xb'));var toCsv=require(_0xfbba('0x8'));var querystring=require(_0xfbba('0xc'));var Papa=require(_0xfbba('0xd'));var Redis=require(_0xfbba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbba('0xf'));var as=require(_0xfbba('0x10'));var hardwareService=require(_0xfbba('0x11'));var logger=require(_0xfbba('0x12'))(_0xfbba('0x13'));var utils=require(_0xfbba('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfbba('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9901,_0x4129ee){_0x4129ee=_0x4129ee||0xcc;return function(_0x2759c1){if(_0x2759c1){return _0x3c9901[_0xfbba('0x16')](_0x4129ee);}return _0x3c9901['status'](_0x4129ee)[_0xfbba('0x17')]();};}function respondWithResult(_0x456075,_0x5a95d2){_0x5a95d2=_0x5a95d2||0xc8;return function(_0x549f07){if(_0x549f07){return _0x456075[_0xfbba('0x18')](_0x5a95d2)[_0xfbba('0x19')](_0x549f07);}};}function respondWithFilteredResult(_0x5626ab,_0x33967a){return function(_0x328c73){if(_0x328c73){var _0x2f0dc8=_0x328c73[_0xfbba('0x1a')],_0x5b8276=_0x33967a[_0xfbba('0x1b')],_0x3fea2a=_0x33967a['offset']+_0x33967a[_0xfbba('0x1c')],_0x53d5fa;if(_0x3fea2a>=_0x2f0dc8){_0x3fea2a=_0x2f0dc8;_0x53d5fa=0xc8;}else{_0x53d5fa=0xce;}_0x5626ab['status'](_0x53d5fa);return _0x5626ab[_0xfbba('0x1d')](_0xfbba('0x1e'),_0x5b8276+'-'+_0x3fea2a+'/'+_0x2f0dc8)[_0xfbba('0x19')](_0x328c73);}return null;};}function patchUpdates(_0x2c8c02){return function(_0x557470){try{jsonpatch[_0xfbba('0x1f')](_0x557470,_0x2c8c02,!![]);}catch(_0x13d41b){return BPromise[_0xfbba('0x20')](_0x13d41b);}return _0x557470[_0xfbba('0x21')]();};}function saveUpdates(_0x5d365a,_0x59aa94){return function(_0x1298b1){if(_0x1298b1){return _0x1298b1['update'](_0x5d365a)['then'](function(_0x1f05e3){return _0x1f05e3;});}return null;};}function removeEntity(_0x5a88a9,_0x259734){return function(_0x17d51e){if(_0x17d51e){return _0x17d51e['destroy']()[_0xfbba('0x22')](function(){_0x5a88a9[_0xfbba('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42dec6,_0x202a1c){return function(_0x1f14fe){if(!_0x1f14fe){_0x42dec6[_0xfbba('0x16')](0x194);}return _0x1f14fe;};}function handleError(_0x42201b,_0x1c5fe2){_0x1c5fe2=_0x1c5fe2||0x1f4;return function(_0x5b31b8){logger[_0xfbba('0x23')](_0x5b31b8['stack']);if(_0x5b31b8[_0xfbba('0x24')]){delete _0x5b31b8[_0xfbba('0x24')];}_0x42201b[_0xfbba('0x18')](_0x1c5fe2)[_0xfbba('0x25')](_0x5b31b8);};}exports[_0xfbba('0x26')]=function(_0x40ad6e,_0x1d6e3b){var _0x524e69={},_0x24e6fd={},_0x4c8ee7={'count':0x0,'rows':[]};var _0x31a46e=_[_0xfbba('0x27')](db['CmCustomField'][_0xfbba('0x28')],function(_0x408577){return{'name':_0x408577[_0xfbba('0x29')],'type':_0x408577[_0xfbba('0x2a')][_0xfbba('0x2b')]};});_0x24e6fd[_0xfbba('0x2c')]=_[_0xfbba('0x2d')](_[_0xfbba('0x27')](_0x31a46e,_0xfbba('0x24')),['name']);_0x24e6fd[_0xfbba('0x2e')]=_['keys'](_0x40ad6e['query']);_0x24e6fd[_0xfbba('0x2f')]=_['intersection'](_0x24e6fd[_0xfbba('0x2c')],_0x24e6fd['query']);_0x524e69['attributes']=_[_0xfbba('0x30')](_0x24e6fd[_0xfbba('0x2c')],qs[_0xfbba('0x31')](_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x31')]));_0x524e69[_0xfbba('0x32')]=_0x524e69[_0xfbba('0x32')][_0xfbba('0x33')]?_0x524e69[_0xfbba('0x32')]:_0x24e6fd[_0xfbba('0x2c')];if(!_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x34')](_0xfbba('0x35'))){_0x524e69[_0xfbba('0x1c')]=qs[_0xfbba('0x1c')](_0x40ad6e['query'][_0xfbba('0x1c')]);_0x524e69[_0xfbba('0x1b')]=qs['offset'](_0x40ad6e['query'][_0xfbba('0x1b')]);}_0x524e69['order']=qs['sort'](_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x36')]);_0x524e69[_0xfbba('0x37')]=qs[_0xfbba('0x2f')](_[_0xfbba('0x38')](_0x40ad6e['query'],_0x24e6fd['filters']),_0x31a46e);if(_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x39')]){_0x524e69['where']=_[_0xfbba('0x3a')](_0x524e69['where'],{'$or':_[_0xfbba('0x27')](_0x31a46e,function(_0x4f8b24){if(_0x4f8b24[_0xfbba('0x2a')]!==_0xfbba('0x3b')){var _0x178cf1={};_0x178cf1[_0x4f8b24['name']]={'$like':'%'+_0x40ad6e[_0xfbba('0x2e')]['filter']+'%'};return _0x178cf1;}})});}_0x524e69=_[_0xfbba('0x3a')]({},_0x524e69,_0x40ad6e[_0xfbba('0x3c')]);var _0x55ef08={'where':_0x524e69[_0xfbba('0x37')]};return db[_0xfbba('0x3d')][_0xfbba('0x1a')](_0x55ef08)[_0xfbba('0x22')](function(_0x326e88){_0x4c8ee7[_0xfbba('0x1a')]=_0x326e88;if(_0x40ad6e[_0xfbba('0x2e')][_0xfbba('0x3e')]){_0x524e69['include']=[{'all':!![]}];}return db[_0xfbba('0x3d')][_0xfbba('0x3f')](_0x524e69);})[_0xfbba('0x22')](function(_0x244706){_0x4c8ee7[_0xfbba('0x40')]=_0x244706;return _0x4c8ee7;})[_0xfbba('0x22')](respondWithFilteredResult(_0x1d6e3b,_0x524e69))[_0xfbba('0x41')](handleError(_0x1d6e3b,null));};exports[_0xfbba('0x42')]=function(_0x350b89,_0x1b747d){var _0x2d57ec={'raw':!![],'where':{'id':_0x350b89[_0xfbba('0x43')]['id']}},_0x159bec={};_0x159bec[_0xfbba('0x2c')]=_[_0xfbba('0x44')](db[_0xfbba('0x3d')]['rawAttributes']);_0x159bec[_0xfbba('0x2e')]=_[_0xfbba('0x44')](_0x350b89[_0xfbba('0x2e')]);_0x159bec[_0xfbba('0x2f')]=_[_0xfbba('0x30')](_0x159bec[_0xfbba('0x2c')],_0x159bec[_0xfbba('0x2e')]);_0x2d57ec[_0xfbba('0x32')]=_['intersection'](_0x159bec[_0xfbba('0x2c')],qs[_0xfbba('0x31')](_0x350b89[_0xfbba('0x2e')][_0xfbba('0x31')]));_0x2d57ec['attributes']=_0x2d57ec[_0xfbba('0x32')][_0xfbba('0x33')]?_0x2d57ec[_0xfbba('0x32')]:_0x159bec[_0xfbba('0x2c')];if(_0x350b89[_0xfbba('0x2e')]['includeAll']){_0x2d57ec['include']=[{'all':!![]}];}_0x2d57ec=_['merge']({},_0x2d57ec,_0x350b89[_0xfbba('0x3c')]);return db['CmCustomField'][_0xfbba('0x45')](_0x2d57ec)[_0xfbba('0x22')](handleEntityNotFound(_0x1b747d,null))[_0xfbba('0x22')](respondWithResult(_0x1b747d,null))[_0xfbba('0x41')](handleError(_0x1b747d,null));};exports[_0xfbba('0x46')]=function(_0x424ea1,_0x2100a7){if(_0x424ea1[_0xfbba('0x47')]['id']){delete _0x424ea1[_0xfbba('0x47')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x424ea1[_0xfbba('0x43')]['id']}})['then'](handleEntityNotFound(_0x2100a7,null))['then'](saveUpdates(_0x424ea1['body'],null))[_0xfbba('0x22')](respondWithResult(_0x2100a7,null))[_0xfbba('0x41')](handleError(_0x2100a7,null));};exports[_0xfbba('0x48')]=function(_0x4bc325,_0x43ad38){return db[_0xfbba('0x3d')]['find']({'where':{'id':_0x4bc325[_0xfbba('0x43')]['id']}})[_0xfbba('0x22')](handleEntityNotFound(_0x43ad38,null))[_0xfbba('0x22')](removeEntity(_0x43ad38,null))['catch'](handleError(_0x43ad38,null));};exports[_0xfbba('0x49')]=function(_0x4b9b54,_0x43e83a){var _0x190a08;return db[_0xfbba('0x4a')][_0xfbba('0x4b')](function(_0x4a8d1f){return db[_0xfbba('0x3d')][_0xfbba('0x49')](_0x4b9b54[_0xfbba('0x47')],{'transaction':_0x4a8d1f})['then'](function(_0x489a0d){_0x190a08=_0x489a0d;var _0x141863={'type':db[_0xfbba('0x4c')][_0xfbba('0x4d')],'transaction':_0x4a8d1f};switch(_0x4b9b54[_0xfbba('0x47')]['type']){case'text':_0x141863['type']=db[_0xfbba('0x4c')]['TEXT'];break;case'number':_0x141863[_0xfbba('0x2a')]=db[_0xfbba('0x4c')]['INTEGER'];break;case'switch':_0x141863[_0xfbba('0x2a')]=db[_0xfbba('0x4c')]['BOOLEAN'];_0x141863[_0xfbba('0x4e')]=![];break;default:}return db[_0xfbba('0x4a')][_0xfbba('0x4f')]['addColumn'](_0xfbba('0x50'),util[_0xfbba('0x51')](_0xfbba('0x52'),_0x190a08['id']),_0x141863);})[_0xfbba('0x22')](function(){return _0x190a08;});})['then'](respondWithResult(_0x43e83a,0xc9))['catch'](handleError(_0x43e83a,null));}; \ No newline at end of file +var _0x53ba=['reject','update','then','destroy','sendStatus','error','stack','name','index','map','CmCustomField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ba,0x18a));var _0xa53b=function(_0x33a430,_0x2dfe3b){_0x33a430=_0x33a430-0x0;var _0x269cee=_0x53ba[_0x33a430];return _0x269cee;};'use strict';var pdf=require(_0xa53b('0x0'));var emlformat=require(_0xa53b('0x1'));var rimraf=require(_0xa53b('0x2'));var zipdir=require(_0xa53b('0x3'));var jsonpatch=require(_0xa53b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa53b('0x5'));var Mustache=require(_0xa53b('0x6'));var util=require(_0xa53b('0x7'));var path=require(_0xa53b('0x8'));var sox=require(_0xa53b('0x9'));var csv=require(_0xa53b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa53b('0xb'));var squel=require(_0xa53b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa53b('0xd'));var deskjs=require(_0xa53b('0xe'));var toCsv=require(_0xa53b('0xa'));var querystring=require('querystring');var Papa=require(_0xa53b('0xf'));var Redis=require(_0xa53b('0x10'));var authService=require(_0xa53b('0x11'));var qs=require(_0xa53b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa53b('0x13'));var logger=require(_0xa53b('0x14'))(_0xa53b('0x15'));var utils=require(_0xa53b('0x16'));var config=require(_0xa53b('0x17'));var licenseUtil=require(_0xa53b('0x18'));var db=require(_0xa53b('0x19'))['db'];function respondWithStatusCode(_0x5c72d2,_0x3aac02){_0x3aac02=_0x3aac02||0xcc;return function(_0x1c3d33){if(_0x1c3d33){return _0x5c72d2['sendStatus'](_0x3aac02);}return _0x5c72d2[_0xa53b('0x1a')](_0x3aac02)['end']();};}function respondWithResult(_0x1445ed,_0x4851b2){_0x4851b2=_0x4851b2||0xc8;return function(_0x8e2b3b){if(_0x8e2b3b){return _0x1445ed['status'](_0x4851b2)[_0xa53b('0x1b')](_0x8e2b3b);}};}function respondWithFilteredResult(_0x17de05,_0x24fa3d){return function(_0x520f70){if(_0x520f70){var _0x2d6b6f=_0x520f70['count'],_0x2ba991=_0x24fa3d[_0xa53b('0x1c')],_0x4e008c=_0x24fa3d[_0xa53b('0x1c')]+_0x24fa3d[_0xa53b('0x1d')],_0x36a5a4;if(_0x4e008c>=_0x2d6b6f){_0x4e008c=_0x2d6b6f;_0x36a5a4=0xc8;}else{_0x36a5a4=0xce;}_0x17de05[_0xa53b('0x1a')](_0x36a5a4);return _0x17de05[_0xa53b('0x1e')]('Content-Range',_0x2ba991+'-'+_0x4e008c+'/'+_0x2d6b6f)['json'](_0x520f70);}return null;};}function patchUpdates(_0x1d2643){return function(_0xcbd883){try{jsonpatch['apply'](_0xcbd883,_0x1d2643,!![]);}catch(_0x3d18d8){return BPromise[_0xa53b('0x1f')](_0x3d18d8);}return _0xcbd883['save']();};}function saveUpdates(_0x3d8f6c,_0x3c2c9f){return function(_0x515a3e){if(_0x515a3e){return _0x515a3e[_0xa53b('0x20')](_0x3d8f6c)[_0xa53b('0x21')](function(_0x190665){return _0x190665;});}return null;};}function removeEntity(_0x5cd5d7,_0x268d50){return function(_0x252bef){if(_0x252bef){return _0x252bef[_0xa53b('0x22')]()[_0xa53b('0x21')](function(){_0x5cd5d7[_0xa53b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3007,_0x1dbe41){return function(_0x433c61){if(!_0x433c61){_0x4b3007[_0xa53b('0x23')](0x194);}return _0x433c61;};}function handleError(_0x1047ac,_0x555b1e){_0x555b1e=_0x555b1e||0x1f4;return function(_0x1c91bb){logger[_0xa53b('0x24')](_0x1c91bb[_0xa53b('0x25')]);if(_0x1c91bb[_0xa53b('0x26')]){delete _0x1c91bb[_0xa53b('0x26')];}_0x1047ac[_0xa53b('0x1a')](_0x555b1e)['send'](_0x1c91bb);};}exports[_0xa53b('0x27')]=function(_0x427b61,_0x1207bb){var _0x511698={},_0x1d0aa6={},_0x593e3d={'count':0x0,'rows':[]};var _0x2db367=_[_0xa53b('0x28')](db[_0xa53b('0x29')][_0xa53b('0x2a')],function(_0xb5b15e){return{'name':_0xb5b15e['fieldName'],'type':_0xb5b15e[_0xa53b('0x2b')][_0xa53b('0x2c')]};});_0x1d0aa6[_0xa53b('0x2d')]=_['differenceBy'](_[_0xa53b('0x28')](_0x2db367,'name'),['name']);_0x1d0aa6['query']=_[_0xa53b('0x2e')](_0x427b61[_0xa53b('0x2f')]);_0x1d0aa6[_0xa53b('0x30')]=_[_0xa53b('0x31')](_0x1d0aa6[_0xa53b('0x2d')],_0x1d0aa6[_0xa53b('0x2f')]);_0x511698[_0xa53b('0x32')]=_[_0xa53b('0x31')](_0x1d0aa6['model'],qs[_0xa53b('0x33')](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x33')]));_0x511698[_0xa53b('0x32')]=_0x511698['attributes']['length']?_0x511698[_0xa53b('0x32')]:_0x1d0aa6[_0xa53b('0x2d')];if(!_0x427b61[_0xa53b('0x2f')]['hasOwnProperty']('nolimit')){_0x511698[_0xa53b('0x1d')]=qs['limit'](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x1d')]);_0x511698[_0xa53b('0x1c')]=qs[_0xa53b('0x1c')](_0x427b61[_0xa53b('0x2f')]['offset']);}_0x511698[_0xa53b('0x34')]=qs[_0xa53b('0x35')](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x35')]);_0x511698['where']=qs[_0xa53b('0x30')](_[_0xa53b('0x36')](_0x427b61[_0xa53b('0x2f')],_0x1d0aa6['filters']),_0x2db367);if(_0x427b61['query'][_0xa53b('0x37')]){_0x511698[_0xa53b('0x38')]=_[_0xa53b('0x39')](_0x511698['where'],{'$or':_['map'](_0x2db367,function(_0xf179ce){if(_0xf179ce['type']!==_0xa53b('0x3a')){var _0x5a8ff5={};_0x5a8ff5[_0xf179ce[_0xa53b('0x26')]]={'$like':'%'+_0x427b61['query'][_0xa53b('0x37')]+'%'};return _0x5a8ff5;}})});}_0x511698=_[_0xa53b('0x39')]({},_0x511698,_0x427b61[_0xa53b('0x3b')]);var _0x1da9e8={'where':_0x511698['where']};return db[_0xa53b('0x29')][_0xa53b('0x3c')](_0x1da9e8)[_0xa53b('0x21')](function(_0x45b705){_0x593e3d['count']=_0x45b705;if(_0x427b61[_0xa53b('0x2f')][_0xa53b('0x3d')]){_0x511698[_0xa53b('0x3e')]=[{'all':!![]}];}return db[_0xa53b('0x29')][_0xa53b('0x3f')](_0x511698);})['then'](function(_0x31c365){_0x593e3d[_0xa53b('0x40')]=_0x31c365;return _0x593e3d;})[_0xa53b('0x21')](respondWithFilteredResult(_0x1207bb,_0x511698))[_0xa53b('0x41')](handleError(_0x1207bb,null));};exports[_0xa53b('0x42')]=function(_0x5af256,_0x4fca0e){var _0x22f834={'raw':!![],'where':{'id':_0x5af256[_0xa53b('0x43')]['id']}},_0x24e029={};_0x24e029[_0xa53b('0x2d')]=_[_0xa53b('0x2e')](db[_0xa53b('0x29')]['rawAttributes']);_0x24e029[_0xa53b('0x2f')]=_[_0xa53b('0x2e')](_0x5af256[_0xa53b('0x2f')]);_0x24e029['filters']=_[_0xa53b('0x31')](_0x24e029['model'],_0x24e029[_0xa53b('0x2f')]);_0x22f834['attributes']=_[_0xa53b('0x31')](_0x24e029[_0xa53b('0x2d')],qs[_0xa53b('0x33')](_0x5af256[_0xa53b('0x2f')]['fields']));_0x22f834[_0xa53b('0x32')]=_0x22f834[_0xa53b('0x32')]['length']?_0x22f834[_0xa53b('0x32')]:_0x24e029[_0xa53b('0x2d')];if(_0x5af256[_0xa53b('0x2f')][_0xa53b('0x3d')]){_0x22f834[_0xa53b('0x3e')]=[{'all':!![]}];}_0x22f834=_['merge']({},_0x22f834,_0x5af256['options']);return db[_0xa53b('0x29')]['find'](_0x22f834)[_0xa53b('0x21')](handleEntityNotFound(_0x4fca0e,null))[_0xa53b('0x21')](respondWithResult(_0x4fca0e,null))['catch'](handleError(_0x4fca0e,null));};exports[_0xa53b('0x20')]=function(_0x57c362,_0x1ee080){if(_0x57c362['body']['id']){delete _0x57c362[_0xa53b('0x44')]['id'];}return db[_0xa53b('0x29')][_0xa53b('0x45')]({'where':{'id':_0x57c362['params']['id']}})['then'](handleEntityNotFound(_0x1ee080,null))[_0xa53b('0x21')](saveUpdates(_0x57c362[_0xa53b('0x44')],null))['then'](respondWithResult(_0x1ee080,null))[_0xa53b('0x41')](handleError(_0x1ee080,null));};exports[_0xa53b('0x22')]=function(_0xcf792f,_0xbce704){return db[_0xa53b('0x29')]['find']({'where':{'id':_0xcf792f[_0xa53b('0x43')]['id']}})[_0xa53b('0x21')](handleEntityNotFound(_0xbce704,null))['then'](removeEntity(_0xbce704,null))['catch'](handleError(_0xbce704,null));};exports[_0xa53b('0x46')]=function(_0x3eac55,_0x1cf7ad){var _0x44f324;return db[_0xa53b('0x47')][_0xa53b('0x48')](function(_0x116bef){return db['CmCustomField'][_0xa53b('0x46')](_0x3eac55[_0xa53b('0x44')],{'transaction':_0x116bef})[_0xa53b('0x21')](function(_0x1c0a19){_0x44f324=_0x1c0a19;var _0x50bd35={'type':db[_0xa53b('0x49')]['TEXT'],'transaction':_0x116bef};switch(_0x3eac55[_0xa53b('0x44')][_0xa53b('0x2b')]){case _0xa53b('0x4a'):_0x50bd35[_0xa53b('0x2b')]=db[_0xa53b('0x49')][_0xa53b('0x4b')];break;case _0xa53b('0x4c'):_0x50bd35[_0xa53b('0x2b')]=db[_0xa53b('0x49')][_0xa53b('0x4d')];break;case _0xa53b('0x4e'):_0x50bd35[_0xa53b('0x2b')]=db['Sequelize'][_0xa53b('0x4f')];_0x50bd35[_0xa53b('0x50')]=![];break;default:}return db[_0xa53b('0x47')][_0xa53b('0x51')][_0xa53b('0x52')](_0xa53b('0x53'),util[_0xa53b('0x54')]('cf_%d',_0x44f324['id']),_0x50bd35);})[_0xa53b('0x21')](function(){return _0x44f324;});})[_0xa53b('0x21')](respondWithResult(_0x1cf7ad,0xc9))[_0xa53b('0x41')](handleError(_0x1cf7ad,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8081b04..40d9a09 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 _0xe75a=['api','moment','request-promise','path','rimraf','define','CmCustomField','util','../../config/logger'];(function(_0x46c11a,_0x4ad31f){var _0x314398=function(_0x51acde){while(--_0x51acde){_0x46c11a['push'](_0x46c11a['shift']());}};_0x314398(++_0x4ad31f);}(_0xe75a,0x115));var _0xae75=function(_0x12efa0,_0x579590){_0x12efa0=_0x12efa0-0x0;var _0x158c02=_0xe75a[_0x12efa0];return _0x158c02;};'use strict';var _=require('lodash');var util=require(_0xae75('0x0'));var logger=require(_0xae75('0x1'))(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require('bluebird');var rp=require(_0xae75('0x4'));var fs=require('fs');var path=require(_0xae75('0x5'));var rimraf=require(_0xae75('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x3e7f3d,_0x25bd3f){return _0x3e7f3d[_0xae75('0x7')](_0xae75('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ad3=['request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x6ad3,0xe5));var _0x36ad=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x6ad3[_0x4bbe00];return _0x3999d2;};'use strict';var _=require(_0x36ad('0x0'));var util=require('util');var logger=require(_0x36ad('0x1'))(_0x36ad('0x2'));var moment=require(_0x36ad('0x3'));var BPromise=require(_0x36ad('0x4'));var rp=require(_0x36ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36ad('0x6'));var config=require(_0x36ad('0x7'));var attributes=require(_0x36ad('0x8'));module[_0x36ad('0x9')]=function(_0x19e1c4,_0x2ae432){return _0x19e1c4[_0x36ad('0xa')](_0x36ad('0xb'),attributes,{'tableName':_0x36ad('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 88ddaca..edc00c3 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1cc3ce,_0x43791e){var _0x4ac6ac=function(_0x15d789){while(--_0x15d789){_0x1cc3ce['push'](_0x1cc3ce['shift']());}};_0x4ac6ac(++_0x43791e);}(_0xe14d,0x1ee));var _0xde14=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xe14d[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('CmCustomField,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x26d2b0,_0x16b1d0){var _0x13fa84=function(_0x1e00b1){while(--_0x1e00b1){_0x26d2b0['push'](_0x26d2b0['shift']());}};_0x13fa84(++_0x16b1d0);}(_0xd3d1,0x172));var _0x1d3d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd3d1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ea290c8..322843f 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 _0x1794=['Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x532693,_0x3a46c9){var _0x57299c=function(_0x504240){while(--_0x504240){_0x532693['push'](_0x532693['shift']());}};_0x57299c(++_0x3a46c9);}(_0x1794,0x165));var _0x4179=function(_0x251bb9,_0x13345c){_0x251bb9=_0x251bb9-0x0;var _0x31dd3f=_0x1794[_0x251bb9];return _0x31dd3f;};'use strict';var multer=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var path=require('path');var timeout=require(_0x4179('0x2'));var express=require(_0x4179('0x3'));var router=express[_0x4179('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4179('0x5'));var config=require(_0x4179('0x6'));var controller=require(_0x4179('0x7'));router[_0x4179('0x8')]('/',auth[_0x4179('0x9')](),controller[_0x4179('0xa')]);router['get'](_0x4179('0xb'),auth[_0x4179('0x9')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth['isAuthenticated'](),controller[_0x4179('0xe')]);router['put'](_0x4179('0xb'),auth[_0x4179('0x9')](),controller[_0x4179('0xf')]);router[_0x4179('0x10')](_0x4179('0xb'),auth['isAuthenticated'](),controller[_0x4179('0x11')]);module[_0x4179('0x12')]=router; \ No newline at end of file +var _0x946d=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0xc612fc,_0x1a4d6b){var _0x1ed090=function(_0x1ef973){while(--_0x1ef973){_0xc612fc['push'](_0xc612fc['shift']());}};_0x1ed090(++_0x1a4d6b);}(_0x946d,0xad));var _0xd946=function(_0x3bf167,_0x118b04){_0x3bf167=_0x3bf167-0x0;var _0x4f4ca4=_0x946d[_0x3bf167];return _0x4f4ca4;};'use strict';var multer=require(_0xd946('0x0'));var util=require(_0xd946('0x1'));var path=require(_0xd946('0x2'));var timeout=require(_0xd946('0x3'));var express=require('express');var router=express[_0xd946('0x4')]();var auth=require(_0xd946('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd946('0x6'));var controller=require('./cmCustomField.controller');router[_0xd946('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd946('0x7')](_0xd946('0x8'),auth[_0xd946('0x9')](),controller[_0xd946('0xa')]);router[_0xd946('0xb')]('/',auth[_0xd946('0x9')](),controller[_0xd946('0xc')]);router[_0xd946('0xd')]('/:id',auth[_0xd946('0x9')](),controller['update']);router[_0xd946('0xe')](_0xd946('0x8'),auth[_0xd946('0x9')](),controller[_0xd946('0xf')]);module[_0xd946('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index db80486..0590545 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 _0x9c5a=['format','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3471c5,_0x51fc11){_0x3471c5=_0x3471c5-0x0;var _0x417ed5=_0x9c5a[_0x3471c5];return _0x417ed5;};'use strict';var moment=require(_0xa9c5('0x0'));var Sequelize=require(_0xa9c5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa9c5('0x4')],'defaultValue':moment()[_0xa9c5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9c5('0x4')]},'priority':{'type':Sequelize[_0xa9c5('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa9c5('0x6')],'unique':_0xa9c5('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'UserId':{'type':Sequelize[_0xa9c5('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'CampaignId':{'type':Sequelize[_0xa9c5('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f4d=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ad968,_0x201fe7){var _0x124c94=function(_0x24ea98){while(--_0x24ea98){_0x2ad968['push'](_0x2ad968['shift']());}};_0x124c94(++_0x201fe7);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2e4fd3,_0x1530dc){_0x2e4fd3=_0x2e4fd3-0x0;var _0x6fe43d=_0x0f4d[_0x2e4fd3];return _0x6fe43d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xd0f4('0x0')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd0f4('0x1')],'defaultValue':moment()[_0xd0f4('0x2')](_0xd0f4('0x3'))},'countbusyretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd0f4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd0f4('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xd0f4('0x4')](0x2)[_0xd0f4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd0f4('0x4')],'unique':_0xd0f4('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd0f4('0x7')},'UserId':{'type':Sequelize[_0xd0f4('0x4')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd0f4('0x7')},'CampaignId':{'type':Sequelize[_0xd0f4('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0f4('0x4')],'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 96faba8..d6bdc9f 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 _0xaa1b=['entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','intersection','filters','concat','$or','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmList','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s'];(function(_0x121bfa,_0x1d1be0){var _0x28ae89=function(_0x1404f7){while(--_0x1404f7){_0x121bfa['push'](_0x121bfa['shift']());}};_0x28ae89(++_0x1d1be0);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xbaa1('0x0'));var emlformat=require(_0xbaa1('0x1'));var rimraf=require(_0xbaa1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbaa1('0x3'));var rp=require('request-promise');var moment=require(_0xbaa1('0x4'));var BPromise=require(_0xbaa1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbaa1('0x6'));var csv=require(_0xbaa1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbaa1('0x8'));var squel=require('squel');var crypto=require(_0xbaa1('0x9'));var jsforce=require(_0xbaa1('0xa'));var deskjs=require(_0xbaa1('0xb'));var toCsv=require(_0xbaa1('0x7'));var querystring=require(_0xbaa1('0xc'));var Papa=require(_0xbaa1('0xd'));var Redis=require('ioredis');var authService=require(_0xbaa1('0xe'));var qs=require(_0xbaa1('0xf'));var as=require(_0xbaa1('0x10'));var hardwareService=require(_0xbaa1('0x11'));var logger=require(_0xbaa1('0x12'))(_0xbaa1('0x13'));var utils=require(_0xbaa1('0x14'));var config=require(_0xbaa1('0x15'));var licenseUtil=require(_0xbaa1('0x16'));var db=require(_0xbaa1('0x17'))['db'];function respondWithStatusCode(_0x8ce72d,_0x1376c6){_0x1376c6=_0x1376c6||0xcc;return function(_0x5064a4){if(_0x5064a4){return _0x8ce72d['sendStatus'](_0x1376c6);}return _0x8ce72d['status'](_0x1376c6)['end']();};}function respondWithResult(_0x2184ab,_0x388cfd){_0x388cfd=_0x388cfd||0xc8;return function(_0x3bfbcc){if(_0x3bfbcc){return _0x2184ab[_0xbaa1('0x18')](_0x388cfd)[_0xbaa1('0x19')](_0x3bfbcc);}};}function respondWithFilteredResult(_0x2e7db5,_0x30f191){return function(_0xdbaa8b){if(_0xdbaa8b){var _0x35a3fd=_0xdbaa8b[_0xbaa1('0x1a')],_0x2a0c0b=_0x30f191[_0xbaa1('0x1b')],_0x37c862=_0x30f191[_0xbaa1('0x1b')]+_0x30f191[_0xbaa1('0x1c')],_0x42f360;if(_0x37c862>=_0x35a3fd){_0x37c862=_0x35a3fd;_0x42f360=0xc8;}else{_0x42f360=0xce;}_0x2e7db5[_0xbaa1('0x18')](_0x42f360);return _0x2e7db5[_0xbaa1('0x1d')](_0xbaa1('0x1e'),_0x2a0c0b+'-'+_0x37c862+'/'+_0x35a3fd)['json'](_0xdbaa8b);}return null;};}function patchUpdates(_0x10bfd3){return function(_0x3e3f4a){try{jsonpatch[_0xbaa1('0x1f')](_0x3e3f4a,_0x10bfd3,!![]);}catch(_0x2f18f7){return BPromise[_0xbaa1('0x20')](_0x2f18f7);}return _0x3e3f4a[_0xbaa1('0x21')]();};}function saveUpdates(_0x5c2115,_0x1c587c){return function(_0x451255){if(_0x451255){return _0x451255[_0xbaa1('0x22')](_0x5c2115)[_0xbaa1('0x23')](function(_0x3b2f53){return _0x3b2f53;});}return null;};}function removeEntity(_0x5a7d21,_0x4e4a0c){return function(_0x2b01ec){if(_0x2b01ec){return _0x2b01ec[_0xbaa1('0x24')]()[_0xbaa1('0x23')](function(){_0x5a7d21[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x25')]();});}};}function handleEntityNotFound(_0x113bbd,_0x4806e7){return function(_0x243eeb){if(!_0x243eeb){_0x113bbd[_0xbaa1('0x26')](0x194);}return _0x243eeb;};}function handleError(_0x28e508,_0x353730){_0x353730=_0x353730||0x1f4;return function(_0x1204f4){logger[_0xbaa1('0x27')](_0x1204f4[_0xbaa1('0x28')]);if(_0x1204f4[_0xbaa1('0x29')]){delete _0x1204f4[_0xbaa1('0x29')];}_0x28e508['status'](_0x353730)[_0xbaa1('0x2a')](_0x1204f4);};}exports[_0xbaa1('0x2b')]=function(_0xd2cae3,_0x2913ae){var _0x109187={},_0x422925={},_0x594578={'count':0x0,'rows':[]};var _0x49803c=_[_0xbaa1('0x2c')](db[_0xbaa1('0x2d')][_0xbaa1('0x2e')],function(_0x48cbc0){return{'name':_0x48cbc0[_0xbaa1('0x2f')],'type':_0x48cbc0[_0xbaa1('0x30')]['key']};});_0x422925[_0xbaa1('0x31')]=_['map'](_0x49803c,_0xbaa1('0x29'));_0x422925[_0xbaa1('0x32')]=_[_0xbaa1('0x33')](_0xd2cae3['query']);_0x422925['filters']=_[_0xbaa1('0x34')](_0x422925[_0xbaa1('0x31')],_0x422925[_0xbaa1('0x32')]);_0x422925[_0xbaa1('0x35')]=_[_0xbaa1('0x36')](_0x422925[_0xbaa1('0x35')],['$and',_0xbaa1('0x37'),_0xbaa1('0x38'),_0xbaa1('0x39'),_0xbaa1('0x3a'),'$lte',_0xbaa1('0x3b'),'$eq',_0xbaa1('0x3c'),_0xbaa1('0x3d'),_0xbaa1('0x3e'),_0xbaa1('0x3f'),'$notIn',_0xbaa1('0x40'),_0xbaa1('0x41'),_0xbaa1('0x42'),'$notILike',_0xbaa1('0x40'),_0xbaa1('0x43'),'$contains',_0xbaa1('0x44'),_0xbaa1('0x45')]);_0x109187[_0xbaa1('0x46')]=_['intersection'](_0x422925[_0xbaa1('0x31')],qs['fields'](_0xd2cae3['query'][_0xbaa1('0x47')]));_0x109187['attributes']=_0x109187[_0xbaa1('0x46')][_0xbaa1('0x48')]?_0x109187[_0xbaa1('0x46')]:_0x422925['model'];if(!_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x49')]('nolimit')){_0x109187[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x1c')]);_0x109187[_0xbaa1('0x1b')]=qs[_0xbaa1('0x1b')](_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x1b')]);}_0x109187['order']=qs[_0xbaa1('0x4a')](_0xd2cae3['query'][_0xbaa1('0x4a')]);_0x109187[_0xbaa1('0x4b')]=qs[_0xbaa1('0x35')](_['pick'](_0xd2cae3[_0xbaa1('0x32')],_0x422925['filters']),_0x49803c);if(_0xd2cae3['query'][_0xbaa1('0x4c')]){_0x109187[_0xbaa1('0x4b')]=_[_0xbaa1('0x4d')](_0x109187['where'],{'$or':_['map'](_0x49803c,function(_0x22f533){if(_0x22f533[_0xbaa1('0x30')]!==_0xbaa1('0x4e')){var _0x2443e3={};_0x2443e3[_0x22f533[_0xbaa1('0x29')]]={'$like':'%'+_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x4c')]+'%'};return _0x2443e3;}})});}_0x109187=_[_0xbaa1('0x4d')]({},_0x109187,_0xd2cae3[_0xbaa1('0x4f')]);var _0x36b72b={'where':_0x109187[_0xbaa1('0x4b')]};return db[_0xbaa1('0x2d')][_0xbaa1('0x1a')](_0x36b72b)[_0xbaa1('0x23')](function(_0x509e8f){_0x594578['count']=_0x509e8f;if(_0xd2cae3[_0xbaa1('0x32')][_0xbaa1('0x50')]){_0x109187[_0xbaa1('0x51')]=[{'all':!![]}];}return db[_0xbaa1('0x2d')][_0xbaa1('0x52')](_0x109187);})[_0xbaa1('0x23')](function(_0x3a6ec7){_0x594578[_0xbaa1('0x53')]=_0x3a6ec7;return _0x594578;})['then'](respondWithFilteredResult(_0x2913ae,_0x109187))[_0xbaa1('0x54')](handleError(_0x2913ae,null));};exports[_0xbaa1('0x55')]=function(_0x2aae88,_0x2b4d2c){var _0x32e527={'raw':!![],'where':{'id':_0x2aae88['params']['id']}},_0x164244={};_0x164244['model']=_[_0xbaa1('0x33')](db['CmHopper'][_0xbaa1('0x2e')]);_0x164244[_0xbaa1('0x32')]=_[_0xbaa1('0x33')](_0x2aae88['query']);_0x164244[_0xbaa1('0x35')]=_[_0xbaa1('0x34')](_0x164244[_0xbaa1('0x31')],_0x164244[_0xbaa1('0x32')]);_0x32e527[_0xbaa1('0x46')]=_['intersection'](_0x164244['model'],qs[_0xbaa1('0x47')](_0x2aae88[_0xbaa1('0x32')][_0xbaa1('0x47')]));_0x32e527[_0xbaa1('0x46')]=_0x32e527[_0xbaa1('0x46')][_0xbaa1('0x48')]?_0x32e527[_0xbaa1('0x46')]:_0x164244[_0xbaa1('0x31')];if(_0x2aae88[_0xbaa1('0x32')][_0xbaa1('0x50')]){_0x32e527[_0xbaa1('0x51')]=[{'all':!![]}];}_0x32e527=_['merge']({},_0x32e527,_0x2aae88[_0xbaa1('0x4f')]);return db[_0xbaa1('0x2d')][_0xbaa1('0x56')](_0x32e527)[_0xbaa1('0x23')](handleEntityNotFound(_0x2b4d2c,null))[_0xbaa1('0x23')](respondWithResult(_0x2b4d2c,null))[_0xbaa1('0x54')](handleError(_0x2b4d2c,null));};exports[_0xbaa1('0x57')]=function(_0x5bdc78,_0x25ccab){return db[_0xbaa1('0x2d')]['create'](_0x5bdc78[_0xbaa1('0x58')],{})[_0xbaa1('0x23')](respondWithResult(_0x25ccab,0xc9))[_0xbaa1('0x54')](handleError(_0x25ccab,null));};exports[_0xbaa1('0x22')]=function(_0x4fd674,_0x3808e3){if(_0x4fd674['body']['id']){delete _0x4fd674[_0xbaa1('0x58')]['id'];}return db[_0xbaa1('0x2d')][_0xbaa1('0x56')]({'where':{'id':_0x4fd674[_0xbaa1('0x59')]['id']}})['then'](handleEntityNotFound(_0x3808e3,null))[_0xbaa1('0x23')](saveUpdates(_0x4fd674[_0xbaa1('0x58')],null))[_0xbaa1('0x23')](respondWithResult(_0x3808e3,null))[_0xbaa1('0x54')](handleError(_0x3808e3,null));};exports[_0xbaa1('0x5a')]=function(_0x3f1018,_0x33a918){return db[_0xbaa1('0x2d')]['describe']()[_0xbaa1('0x23')](respondWithResult(_0x33a918,null))[_0xbaa1('0x54')](handleError(_0x33a918,null));};exports[_0xbaa1('0x24')]=function(_0x475e3d,_0x28f7a1){var _0x254368;return db[_0xbaa1('0x2d')]['find']({'where':{'id':_0x475e3d['params']['id']}})[_0xbaa1('0x23')](handleEntityNotFound(_0x28f7a1,null))[_0xbaa1('0x23')](function(_0x4c6b79){if(_0x4c6b79){return _0x4c6b79[_0xbaa1('0x24')]()[_0xbaa1('0x23')](function(_0x3eca07){return _0x3eca07;});}})['then'](function(_0x207b6f){_0x254368=_0x207b6f;if(_0x207b6f){if(_0x207b6f[_0xbaa1('0x5b')]||_0x207b6f[_0xbaa1('0x5c')]){return db[_0x207b6f[_0xbaa1('0x5b')]?_0xbaa1('0x5d'):_0xbaa1('0x5e')]['find']({'where':{'id':_0x207b6f[_0xbaa1('0x5b')]?_0x207b6f[_0xbaa1('0x5b')]:_0x207b6f['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xbaa1('0x23')](function(_0x4973d4){var _0x2bb374={};if(_0x4973d4){_[_0xbaa1('0x4d')](_0x2bb374,_[_0xbaa1('0x5f')](_0x254368['dataValues'],[_0xbaa1('0x60'),_0xbaa1('0x61'),'id']));_0x2bb374[_0xbaa1('0x62')]=0x15;_0x2bb374[_0xbaa1('0x63')]='deleted';_0x2bb374[_0xbaa1('0x64')]=_0x4973d4[_0xbaa1('0x29')];_0x2bb374[_0xbaa1('0x65')]=_0x475e3d[_0xbaa1('0x66')][_0xbaa1('0x29')];_0x2bb374[_0xbaa1('0x67')]=_0x475e3d[_0xbaa1('0x66')]['id'];_0x2bb374[_0xbaa1('0x68')]=!![];_0x2bb374[_0xbaa1('0x69')]=moment()[_0xbaa1('0x6a')](_0xbaa1('0x6b'));_0x2bb374[_0xbaa1('0x6c')]=_0x254368[_0xbaa1('0x6d')];_0x2bb374['campaigntype']=_0x254368[_0xbaa1('0x5b')]?_0xbaa1('0x6e'):_0xbaa1('0x6f');return db['CmContact'][_0xbaa1('0x56')]({'where':{'id':_0x2bb374[_0xbaa1('0x70')]},'attributes':[_0xbaa1('0x71'),_0xbaa1('0x72')]})[_0xbaa1('0x23')](function(_0x3fb861){if(!_[_0xbaa1('0x73')](_0x28f7a1)&&!_[_0xbaa1('0x73')](_0x3fb861[_0xbaa1('0x71')])){_0x2bb374[_0xbaa1('0x74')]=_0x3fb861[_0xbaa1('0x71')];if(!_[_0xbaa1('0x73')](_0x3fb861[_0xbaa1('0x72')])){_0x2bb374['calleridname']+='\x20'+_0x3fb861['lastName'];}}})[_0xbaa1('0x75')](function(){return db[_0xbaa1('0x76')][_0xbaa1('0x57')](_0x2bb374);});}})[_0xbaa1('0x23')](function(){return _0x28f7a1[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x25')]();})['catch'](handleError(_0x28f7a1,null));};exports[_0xbaa1('0x77')]=function(_0x402158,_0x5b2c22,_0x5b0d46){var _0x55475b=[];return db[_0xbaa1('0x78')]['describe']()[_0xbaa1('0x23')](function(_0x57d9ca){_0x55475b=_[_0xbaa1('0x33')](_0x57d9ca);return _0x402158[_0xbaa1('0x66')][_0xbaa1('0x79')]({'where':{'type':_0xbaa1('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbaa1('0x7b')],'raw':!![]});})['then'](function(_0x3be487){if(_0x3be487&&_0x3be487[_0xbaa1('0x48')]){return db[_0xbaa1('0x7c')][_0xbaa1('0x7d')](function(_0xd6b380){var _0x134906={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbaa1('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x3be487,'id')},'$or':[{'UserId':null},{'UserId':_0x402158[_0xbaa1('0x66')]['id']}]};var _0xa9a5f4=[];if(_0x402158['body']['direction']&&_0x402158[_0xbaa1('0x58')][_0xbaa1('0x7e')]==='prev'){if(!_[_0xbaa1('0x7f')](_0x402158['body']['hopperIds'])){_0x134906['id']={'$in':_0x402158[_0xbaa1('0x58')][_0xbaa1('0x80')]};}_0xa9a5f4=[[_0xbaa1('0x81'),_0xbaa1('0x82')],['scheduledAt',_0x3be487[0x0]['dialOrderByScheduledAt']===_0xbaa1('0x82')?'DESC':_0xbaa1('0x82')],db[_0xbaa1('0x7c')]['literal'](_0xbaa1('0x83')),['id',_0xbaa1('0x84')]];}else{if(!_[_0xbaa1('0x7f')](_0x402158[_0xbaa1('0x58')][_0xbaa1('0x80')])){_0x134906['id']={'$notIn':_0x402158['body'][_0xbaa1('0x80')]};}_0xa9a5f4=[['priority',_0xbaa1('0x84')],[_0xbaa1('0x85'),_0x3be487[0x0][_0xbaa1('0x7b')]],db[_0xbaa1('0x7c')]['literal'](_0xbaa1('0x86')),['id',_0xbaa1('0x82')]];}return db[_0xbaa1('0x2d')]['findOne']({'attributes':['id',_0xbaa1('0x87')],'where':_0x134906,'order':_0xa9a5f4,'transaction':_0xd6b380,'lock':_0xd6b380[_0xbaa1('0x88')][_0xbaa1('0x89')],'include':[{'model':db[_0xbaa1('0x78')],'as':_0xbaa1('0x8a'),'attributes':_0x55475b,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xbaa1('0x29')]}]},{'model':db[_0xbaa1('0x8b')],'as':'List','attributes':['id',_0xbaa1('0x29')]},{'model':db[_0xbaa1('0x5d')],'as':'Queue','attributes':['id','name',_0xbaa1('0x8c')]}]})[_0xbaa1('0x23')](function(_0x4a706e){if(_0x4a706e){return _0x4a706e[_0xbaa1('0x22')]({'UserId':_0x402158[_0xbaa1('0x66')]['id']},{'transaction':_0xd6b380});}});});}})['then'](handleEntityNotFound(_0x5b2c22,null))['then'](respondWithResult(_0x5b2c22,null))[_0xbaa1('0x54')](handleError(_0x5b2c22,null));};exports[_0xbaa1('0x8d')]=function(_0x2d02f8,_0x306e66,_0xea66ab){return _0x2d02f8[_0xbaa1('0x66')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbaa1('0x23')](function(_0x469184){if(_0x469184&&_0x469184[_0xbaa1('0x48')]){return db[_0xbaa1('0x2d')][_0xbaa1('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbaa1('0x6b'))},'VoiceQueueId':{'$in':_[_0xbaa1('0x2c')](_0x469184,'id')},'$or':[{'UserId':null},{'UserId':_0x2d02f8[_0xbaa1('0x66')]['id']}]}});}return 0x0;})[_0xbaa1('0x23')](function(_0x2212be){if(!_[_0xbaa1('0x73')](_0x2212be)&&_[_0xbaa1('0x8e')](_0x2212be)){return _0x306e66[_0xbaa1('0x18')](0xc8)['json']({'contacts':_0x2212be});}else{logger[_0xbaa1('0x27')](_0xbaa1('0x8f'),'getOpenContacts',0x194,_0xbaa1('0x90'));_0x306e66[_0xbaa1('0x26')](0x194);}})[_0xbaa1('0x54')](handleError(_0x306e66,null));}; \ No newline at end of file +var _0x1ba2=['campaigntype','ivr','CmContact','ContactId','firstName','isNil','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','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','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','then','includeAll','findAll','params','include','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x21470d,_0x284f75){var _0x22a83d=function(_0xab71cc){while(--_0xab71cc){_0x21470d['push'](_0x21470d['shift']());}};_0x22a83d(++_0x284f75);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'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'];function respondWithStatusCode(_0x10fae1,_0x2bc413){_0x2bc413=_0x2bc413||0xcc;return function(_0x48f552){if(_0x48f552){return _0x10fae1['sendStatus'](_0x2bc413);}return _0x10fae1[_0x21ba('0x19')](_0x2bc413)[_0x21ba('0x1a')]();};}function respondWithResult(_0x214f8e,_0x4f43e2){_0x4f43e2=_0x4f43e2||0xc8;return function(_0x4b9fd2){if(_0x4b9fd2){return _0x214f8e[_0x21ba('0x19')](_0x4f43e2)['json'](_0x4b9fd2);}};}function respondWithFilteredResult(_0x3591cd,_0x494588){return function(_0x179063){if(_0x179063){var _0x2e7b03=_0x179063['count'],_0x17df0e=_0x494588[_0x21ba('0x1b')],_0x1c2bac=_0x494588['offset']+_0x494588[_0x21ba('0x1c')],_0x10b9e6;if(_0x1c2bac>=_0x2e7b03){_0x1c2bac=_0x2e7b03;_0x10b9e6=0xc8;}else{_0x10b9e6=0xce;}_0x3591cd[_0x21ba('0x19')](_0x10b9e6);return _0x3591cd[_0x21ba('0x1d')](_0x21ba('0x1e'),_0x17df0e+'-'+_0x1c2bac+'/'+_0x2e7b03)[_0x21ba('0x1f')](_0x179063);}return null;};}function patchUpdates(_0x260c98){return function(_0x1eb6ed){try{jsonpatch[_0x21ba('0x20')](_0x1eb6ed,_0x260c98,!![]);}catch(_0x4b8d7a){return BPromise[_0x21ba('0x21')](_0x4b8d7a);}return _0x1eb6ed[_0x21ba('0x22')]();};}function saveUpdates(_0x58ba99,_0x213a83){return function(_0x5d1c55){if(_0x5d1c55){return _0x5d1c55[_0x21ba('0x23')](_0x58ba99)['then'](function(_0x430bbd){return _0x430bbd;});}return null;};}function removeEntity(_0x43383f,_0x30ac7a){return function(_0x7abe9d){if(_0x7abe9d){return _0x7abe9d['destroy']()['then'](function(){_0x43383f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e4b49,_0x1529ec){return function(_0x209ec8){if(!_0x209ec8){_0x2e4b49[_0x21ba('0x24')](0x194);}return _0x209ec8;};}function handleError(_0x328d9f,_0x472656){_0x472656=_0x472656||0x1f4;return function(_0x2f4d96){logger[_0x21ba('0x25')](_0x2f4d96[_0x21ba('0x26')]);if(_0x2f4d96[_0x21ba('0x27')]){delete _0x2f4d96[_0x21ba('0x27')];}_0x328d9f[_0x21ba('0x19')](_0x472656)[_0x21ba('0x28')](_0x2f4d96);};}exports[_0x21ba('0x29')]=function(_0x1aca0c,_0x38d430){var _0x19c367={},_0x2dccbf={},_0x2567f9={'count':0x0,'rows':[]};var _0x33800c=_[_0x21ba('0x2a')](db[_0x21ba('0x2b')][_0x21ba('0x2c')],function(_0x1b4ebe){return{'name':_0x1b4ebe[_0x21ba('0x2d')],'type':_0x1b4ebe[_0x21ba('0x2e')][_0x21ba('0x2f')]};});_0x2dccbf[_0x21ba('0x30')]=_[_0x21ba('0x2a')](_0x33800c,_0x21ba('0x27'));_0x2dccbf[_0x21ba('0x31')]=_[_0x21ba('0x32')](_0x1aca0c['query']);_0x2dccbf[_0x21ba('0x33')]=_[_0x21ba('0x34')](_0x2dccbf[_0x21ba('0x30')],_0x2dccbf[_0x21ba('0x31')]);_0x2dccbf['filters']=_['concat'](_0x2dccbf[_0x21ba('0x33')],[_0x21ba('0x35'),_0x21ba('0x36'),_0x21ba('0x37'),_0x21ba('0x38'),'$lt',_0x21ba('0x39'),'$ne',_0x21ba('0x3a'),_0x21ba('0x3b'),_0x21ba('0x3c'),_0x21ba('0x3d'),_0x21ba('0x3e'),_0x21ba('0x3f'),_0x21ba('0x40'),_0x21ba('0x41'),_0x21ba('0x42'),'$notILike','$like',_0x21ba('0x43'),_0x21ba('0x44'),_0x21ba('0x45'),_0x21ba('0x46')]);_0x19c367['attributes']=_[_0x21ba('0x34')](_0x2dccbf[_0x21ba('0x30')],qs['fields'](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x47')]));_0x19c367[_0x21ba('0x48')]=_0x19c367[_0x21ba('0x48')][_0x21ba('0x49')]?_0x19c367[_0x21ba('0x48')]:_0x2dccbf[_0x21ba('0x30')];if(!_0x1aca0c['query'][_0x21ba('0x4a')]('nolimit')){_0x19c367[_0x21ba('0x1c')]=qs['limit'](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x1c')]);_0x19c367[_0x21ba('0x1b')]=qs[_0x21ba('0x1b')](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x1b')]);}_0x19c367[_0x21ba('0x4b')]=qs[_0x21ba('0x4c')](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4c')]);_0x19c367[_0x21ba('0x4d')]=qs[_0x21ba('0x33')](_[_0x21ba('0x4e')](_0x1aca0c['query'],_0x2dccbf[_0x21ba('0x33')]),_0x33800c);if(_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4f')]){_0x19c367[_0x21ba('0x4d')]=_[_0x21ba('0x50')](_0x19c367['where'],{'$or':_[_0x21ba('0x2a')](_0x33800c,function(_0x4789bd){if(_0x4789bd[_0x21ba('0x2e')]!==_0x21ba('0x51')){var _0x24ccf6={};_0x24ccf6[_0x4789bd[_0x21ba('0x27')]]={'$like':'%'+_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4f')]+'%'};return _0x24ccf6;}})});}_0x19c367=_[_0x21ba('0x50')]({},_0x19c367,_0x1aca0c['options']);var _0x4a38b5={'where':_0x19c367[_0x21ba('0x4d')]};return db['CmHopper'][_0x21ba('0x52')](_0x4a38b5)[_0x21ba('0x53')](function(_0x1f6260){_0x2567f9[_0x21ba('0x52')]=_0x1f6260;if(_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x54')]){_0x19c367['include']=[{'all':!![]}];}return db[_0x21ba('0x2b')][_0x21ba('0x55')](_0x19c367);})['then'](function(_0x270e0c){_0x2567f9['rows']=_0x270e0c;return _0x2567f9;})[_0x21ba('0x53')](respondWithFilteredResult(_0x38d430,_0x19c367))['catch'](handleError(_0x38d430,null));};exports['show']=function(_0x1e12ca,_0x20fd57){var _0x49ee31={'raw':!![],'where':{'id':_0x1e12ca[_0x21ba('0x56')]['id']}},_0x59cbb9={};_0x59cbb9[_0x21ba('0x30')]=_[_0x21ba('0x32')](db[_0x21ba('0x2b')]['rawAttributes']);_0x59cbb9['query']=_[_0x21ba('0x32')](_0x1e12ca[_0x21ba('0x31')]);_0x59cbb9[_0x21ba('0x33')]=_[_0x21ba('0x34')](_0x59cbb9[_0x21ba('0x30')],_0x59cbb9['query']);_0x49ee31[_0x21ba('0x48')]=_[_0x21ba('0x34')](_0x59cbb9[_0x21ba('0x30')],qs['fields'](_0x1e12ca['query']['fields']));_0x49ee31[_0x21ba('0x48')]=_0x49ee31[_0x21ba('0x48')][_0x21ba('0x49')]?_0x49ee31[_0x21ba('0x48')]:_0x59cbb9[_0x21ba('0x30')];if(_0x1e12ca['query'][_0x21ba('0x54')]){_0x49ee31[_0x21ba('0x57')]=[{'all':!![]}];}_0x49ee31=_[_0x21ba('0x50')]({},_0x49ee31,_0x1e12ca['options']);return db[_0x21ba('0x2b')][_0x21ba('0x58')](_0x49ee31)['then'](handleEntityNotFound(_0x20fd57,null))[_0x21ba('0x53')](respondWithResult(_0x20fd57,null))[_0x21ba('0x59')](handleError(_0x20fd57,null));};exports[_0x21ba('0x5a')]=function(_0x384765,_0x518ae7){return db[_0x21ba('0x2b')][_0x21ba('0x5a')](_0x384765[_0x21ba('0x5b')],{})[_0x21ba('0x53')](respondWithResult(_0x518ae7,0xc9))[_0x21ba('0x59')](handleError(_0x518ae7,null));};exports[_0x21ba('0x23')]=function(_0x196fcf,_0x2f149d){if(_0x196fcf[_0x21ba('0x5b')]['id']){delete _0x196fcf[_0x21ba('0x5b')]['id'];}return db[_0x21ba('0x2b')][_0x21ba('0x58')]({'where':{'id':_0x196fcf['params']['id']}})[_0x21ba('0x53')](handleEntityNotFound(_0x2f149d,null))['then'](saveUpdates(_0x196fcf[_0x21ba('0x5b')],null))['then'](respondWithResult(_0x2f149d,null))[_0x21ba('0x59')](handleError(_0x2f149d,null));};exports[_0x21ba('0x5c')]=function(_0x36ddbb,_0x30c6fc){return db[_0x21ba('0x2b')][_0x21ba('0x5c')]()[_0x21ba('0x53')](respondWithResult(_0x30c6fc,null))['catch'](handleError(_0x30c6fc,null));};exports['destroy']=function(_0x9449e9,_0x7e1de2){var _0x4022ed;return db[_0x21ba('0x2b')]['find']({'where':{'id':_0x9449e9['params']['id']}})[_0x21ba('0x53')](handleEntityNotFound(_0x7e1de2,null))[_0x21ba('0x53')](function(_0x1b23f0){if(_0x1b23f0){return _0x1b23f0['destroy']()[_0x21ba('0x53')](function(_0x2fe608){return _0x2fe608;});}})[_0x21ba('0x53')](function(_0x462b1d){_0x4022ed=_0x462b1d;if(_0x462b1d){if(_0x462b1d[_0x21ba('0x5d')]||_0x462b1d[_0x21ba('0x5e')]){return db[_0x462b1d[_0x21ba('0x5d')]?_0x21ba('0x5f'):_0x21ba('0x60')][_0x21ba('0x58')]({'where':{'id':_0x462b1d['VoiceQueueId']?_0x462b1d['VoiceQueueId']:_0x462b1d['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x21ba('0x53')](function(_0x52741b){var _0x556619={};if(_0x52741b){_[_0x21ba('0x50')](_0x556619,_[_0x21ba('0x61')](_0x4022ed[_0x21ba('0x62')],[_0x21ba('0x63'),_0x21ba('0x64'),'id']));_0x556619[_0x21ba('0x65')]=0x15;_0x556619['statedesc']='deleted';_0x556619['campaign']=_0x52741b[_0x21ba('0x27')];_0x556619[_0x21ba('0x66')]=_0x9449e9[_0x21ba('0x67')]['name'];_0x556619[_0x21ba('0x68')]=_0x9449e9[_0x21ba('0x67')]['id'];_0x556619[_0x21ba('0x69')]=!![];_0x556619['deletedat']=moment()[_0x21ba('0x6a')](_0x21ba('0x6b'));_0x556619[_0x21ba('0x6c')]=_0x4022ed[_0x21ba('0x6d')];_0x556619[_0x21ba('0x6e')]=_0x4022ed[_0x21ba('0x5d')]?'queue':_0x21ba('0x6f');return db[_0x21ba('0x70')][_0x21ba('0x58')]({'where':{'id':_0x556619[_0x21ba('0x71')]},'attributes':[_0x21ba('0x72'),'lastName']})[_0x21ba('0x53')](function(_0x5cf37c){if(!_[_0x21ba('0x73')](_0x7e1de2)&&!_[_0x21ba('0x73')](_0x5cf37c['firstName'])){_0x556619['calleridname']=_0x5cf37c[_0x21ba('0x72')];if(!_[_0x21ba('0x73')](_0x5cf37c['lastName'])){_0x556619['calleridname']+='\x20'+_0x5cf37c['lastName'];}}})[_0x21ba('0x74')](function(){return db[_0x21ba('0x75')][_0x21ba('0x5a')](_0x556619);});}})[_0x21ba('0x53')](function(){return _0x7e1de2['status'](0xcc)[_0x21ba('0x1a')]();})[_0x21ba('0x59')](handleError(_0x7e1de2,null));};exports[_0x21ba('0x76')]=function(_0x52aa36,_0x11e5bd,_0x14b9b4){var _0x4647ea=[];return db[_0x21ba('0x70')][_0x21ba('0x5c')]()['then'](function(_0x588140){_0x4647ea=_[_0x21ba('0x32')](_0x588140);return _0x52aa36['user'][_0x21ba('0x77')]({'where':{'type':_0x21ba('0x78'),'dialActive':!![],'dialMethod':_0x21ba('0x79')},'attributes':['id',_0x21ba('0x7a')],'raw':!![]});})[_0x21ba('0x53')](function(_0x4ce4d5){if(_0x4ce4d5&&_0x4ce4d5[_0x21ba('0x49')]){return db[_0x21ba('0x7b')][_0x21ba('0x7c')](function(_0x394ea9){var _0x33814e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x21ba('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x21ba('0x2a')](_0x4ce4d5,'id')},'$or':[{'UserId':null},{'UserId':_0x52aa36[_0x21ba('0x67')]['id']}]};var _0x3b1b1d=[];if(_0x52aa36[_0x21ba('0x5b')]['direction']&&_0x52aa36[_0x21ba('0x5b')]['direction']==='prev'){if(!_[_0x21ba('0x7d')](_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')])){_0x33814e['id']={'$in':_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')]};}_0x3b1b1d=[[_0x21ba('0x7f'),_0x21ba('0x80')],[_0x21ba('0x81'),_0x4ce4d5[0x0]['dialOrderByScheduledAt']===_0x21ba('0x80')?_0x21ba('0x82'):_0x21ba('0x80')],db[_0x21ba('0x7b')]['literal'](_0x21ba('0x83')),['id','DESC']];}else{if(!_[_0x21ba('0x7d')](_0x52aa36['body'][_0x21ba('0x7e')])){_0x33814e['id']={'$notIn':_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')]};}_0x3b1b1d=[['priority',_0x21ba('0x82')],[_0x21ba('0x81'),_0x4ce4d5[0x0][_0x21ba('0x7a')]],db[_0x21ba('0x7b')]['literal'](_0x21ba('0x84')),['id',_0x21ba('0x80')]];}return db[_0x21ba('0x2b')]['findOne']({'attributes':['id',_0x21ba('0x85')],'where':_0x33814e,'order':_0x3b1b1d,'transaction':_0x394ea9,'lock':_0x394ea9[_0x21ba('0x86')][_0x21ba('0x87')],'include':[{'model':db[_0x21ba('0x70')],'as':_0x21ba('0x88'),'attributes':_0x4647ea,'include':[{'model':db[_0x21ba('0x89')],'as':_0x21ba('0x8a'),'attributes':['id',_0x21ba('0x27')]}]},{'model':db[_0x21ba('0x8b')],'as':'List','attributes':['id',_0x21ba('0x27')]},{'model':db[_0x21ba('0x5f')],'as':_0x21ba('0x8c'),'attributes':['id',_0x21ba('0x27'),_0x21ba('0x8d')]}]})[_0x21ba('0x53')](function(_0x43f947){if(_0x43f947){return _0x43f947[_0x21ba('0x23')]({'UserId':_0x52aa36[_0x21ba('0x67')]['id']},{'transaction':_0x394ea9});}});});}})[_0x21ba('0x53')](handleEntityNotFound(_0x11e5bd,null))[_0x21ba('0x53')](respondWithResult(_0x11e5bd,null))[_0x21ba('0x59')](handleError(_0x11e5bd,null));};exports[_0x21ba('0x8e')]=function(_0x3031a1,_0x798f66,_0x289db8){return _0x3031a1[_0x21ba('0x67')][_0x21ba('0x77')]({'where':{'type':_0x21ba('0x78'),'dialActive':!![],'dialMethod':_0x21ba('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x18f58f){if(_0x18f58f&&_0x18f58f[_0x21ba('0x49')]){return db[_0x21ba('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x21ba('0x2a')](_0x18f58f,'id')},'$or':[{'UserId':null},{'UserId':_0x3031a1[_0x21ba('0x67')]['id']}]}});}return 0x0;})[_0x21ba('0x53')](function(_0x3fe7e2){if(!_['isNil'](_0x3fe7e2)&&_[_0x21ba('0x8f')](_0x3fe7e2)){return _0x798f66[_0x21ba('0x19')](0xc8)[_0x21ba('0x1f')]({'contacts':_0x3fe7e2});}else{logger[_0x21ba('0x25')](_0x21ba('0x90'),_0x21ba('0x8e'),0x194,'entity\x20not\x20found');_0x798f66['sendStatus'](0x194);}})[_0x21ba('0x59')](handleError(_0x798f66,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 33ec27c..531c699 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 _0x3c38=['cm_hopper','scheduledat','phone','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3c38,0x81));var _0x83c3=function(_0x54c913,_0x3b9057){_0x54c913=_0x54c913-0x0;var _0x4fd1aa=_0x3c38[_0x54c913];return _0x4fd1aa;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var logger=require(_0x83c3('0x2'))(_0x83c3('0x3'));var moment=require(_0x83c3('0x4'));var BPromise=require(_0x83c3('0x5'));var rp=require(_0x83c3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83c3('0x7'));var config=require(_0x83c3('0x8'));var attributes=require('./cmHopper.attributes');module[_0x83c3('0x9')]=function(_0x139138,_0x143f75){return _0x139138[_0x83c3('0xa')]('CmHopper',attributes,{'tableName':_0x83c3('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x83c3('0xc')]},{'name':_0x83c3('0xd'),'fields':[_0x83c3('0xd')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb02=['../../config/environment','./cmHopper.attributes','CmHopper','scheduledat','phone','priority','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x16e105,_0x11269e){var _0x162275=function(_0x3917bf){while(--_0x3917bf){_0x16e105['push'](_0x16e105['shift']());}};_0x162275(++_0x11269e);}(_0xfb02,0x1e6));var _0x2fb0=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xfb02[_0x154cb5];return _0x3f574f;};'use strict';var _=require(_0x2fb0('0x0'));var util=require('util');var logger=require(_0x2fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2fb0('0x2'));var rp=require(_0x2fb0('0x3'));var fs=require('fs');var path=require(_0x2fb0('0x4'));var rimraf=require(_0x2fb0('0x5'));var config=require(_0x2fb0('0x6'));var attributes=require(_0x2fb0('0x7'));module['exports']=function(_0x2226e1,_0x531b79){return _0x2226e1['define'](_0x2fb0('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x2fb0('0x9'),'fields':[_0x2fb0('0x9')]},{'name':'phone','fields':[_0x2fb0('0xa')]},{'name':_0x2fb0('0xb'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 17ac05e..bd332d3 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 _0xabad=['CmContact','describe','transaction','LOCK','UPDATE','Contact','Agent','name','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','order','all','GetContactRecallMe','GetCmHopperPreview','limit','keys','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','findAll','options','raw','where','attributes','include','map','model','catch','ShowCmHopper','CmHopper','CreateCmHopper','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer'];(function(_0x477f8b,_0x4863d2){var _0x16e662=function(_0x595180){while(--_0x595180){_0x477f8b['push'](_0x477f8b['shift']());}};_0x16e662(++_0x4863d2);}(_0xabad,0xab));var _0xdaba=function(_0x53a0ce,_0x5eaa86){_0x53a0ce=_0x53a0ce-0x0;var _0x491112=_0xabad[_0x53a0ce];return _0x491112;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdaba('0x1'));var rs=require(_0xdaba('0x2'));var fs=require('fs');var Redis=require(_0xdaba('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdaba('0x4'))(_0xdaba('0x5'));var config=require(_0xdaba('0x6'));var jayson=require(_0xdaba('0x7'));var client=jayson[_0xdaba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a5dc3,_0x458fe2,_0x110aed){return new BPromise(function(_0x3bcdfd,_0x5cb3d8){return client[_0xdaba('0x9')](_0x8a5dc3,_0x110aed)[_0xdaba('0xa')](function(_0x5018f6){logger[_0xdaba('0xb')](_0xdaba('0xc'),_0x458fe2,'request\x20sent');logger[_0xdaba('0xd')](_0xdaba('0xe'),_0x458fe2,'request\x20sent',JSON[_0xdaba('0xf')](_0x5018f6));if(_0x5018f6[_0xdaba('0x10')]){if(_0x5018f6[_0xdaba('0x10')][_0xdaba('0x11')]===0x1f4){logger['error'](_0xdaba('0xc'),_0x458fe2,_0x5018f6[_0xdaba('0x10')][_0xdaba('0x12')]);return _0x5cb3d8(_0x5018f6['error'][_0xdaba('0x12')]);}logger[_0xdaba('0x10')]('CmHopper,\x20%s,\x20%s',_0x458fe2,_0x5018f6['error']['message']);return _0x3bcdfd(_0x5018f6[_0xdaba('0x10')][_0xdaba('0x12')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x458fe2,'request\x20sent');_0x3bcdfd(_0x5018f6[_0xdaba('0x13')][_0xdaba('0x12')]);}})['catch'](function(_0x21d46f){logger[_0xdaba('0x10')](_0xdaba('0xc'),_0x458fe2,_0x21d46f);_0x5cb3d8(_0x21d46f);});});}exports[_0xdaba('0x14')]=function(_0x5b16ba){var _0x36ef05=this;return new Promise(function(_0x985296,_0x2b8270){return db['CmHopper'][_0xdaba('0x15')]({'raw':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'where':_0x5b16ba['options']?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')]['limit']||null:null,'include':_0x5b16ba[_0xdaba('0x16')]?_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x1a')]?_['map'](_0x5b16ba[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x4966c3){return{'model':db[_0x4966c3['model']],'as':_0x4966c3['as'],'attributes':_0x4966c3[_0xdaba('0x19')],'include':_0x4966c3[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4966c3[_0xdaba('0x1a')],function(_0x471094){return{'model':db[_0x471094['model']],'as':_0x471094['as'],'attributes':_0x471094['attributes'],'include':_0x471094[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x471094['include'],function(_0x80b66a){return{'model':db[_0x80b66a[_0xdaba('0x1c')]],'as':_0x80b66a['as'],'attributes':_0x80b66a[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x3262fb){logger[_0xdaba('0xb')](_0xdaba('0x14'),_0x5b16ba);logger[_0xdaba('0xd')]('GetCmHopper',_0x5b16ba,JSON['stringify'](_0x3262fb));_0x985296(_0x3262fb);})[_0xdaba('0x1d')](function(_0x1e6d66){logger[_0xdaba('0x10')]('GetCmHopper',_0x1e6d66['message'],_0x5b16ba);_0x2b8270(_0x36ef05[_0xdaba('0x10')](0x1f4,_0x1e6d66[_0xdaba('0x12')]));});});};exports[_0xdaba('0x1e')]=function(_0x4f9044){var _0x23d869=this;return new Promise(function(_0x59923e,_0x443219){return db[_0xdaba('0x1f')]['find']({'raw':_0x4f9044['options']?_0x4f9044['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9044['options']?_0x4f9044[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x4f9044[_0xdaba('0x16')]?_0x4f9044[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'include':_0x4f9044[_0xdaba('0x16')]?_0x4f9044[_0xdaba('0x16')]['include']?_[_0xdaba('0x1b')](_0x4f9044[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x175a34){return{'model':db[_0x175a34['model']],'as':_0x175a34['as'],'attributes':_0x175a34[_0xdaba('0x19')],'include':_0x175a34[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x175a34[_0xdaba('0x1a')],function(_0x4798ce){return{'model':db[_0x4798ce[_0xdaba('0x1c')]],'as':_0x4798ce['as'],'attributes':_0x4798ce[_0xdaba('0x19')],'include':_0x4798ce[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4798ce[_0xdaba('0x1a')],function(_0x4bee37){return{'model':db[_0x4bee37['model']],'as':_0x4bee37['as'],'attributes':_0x4bee37[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x2f69bf){logger[_0xdaba('0xb')](_0xdaba('0x1e'),_0x4f9044);logger[_0xdaba('0xd')](_0xdaba('0x1e'),_0x4f9044,JSON[_0xdaba('0xf')](_0x2f69bf));_0x59923e(_0x2f69bf);})[_0xdaba('0x1d')](function(_0x1d87e9){logger['error']('ShowCmHopper',_0x1d87e9[_0xdaba('0x12')],_0x4f9044);_0x443219(_0x23d869[_0xdaba('0x10')](0x1f4,_0x1d87e9[_0xdaba('0x12')]));});});};exports['CreateCmHopper']=function(_0x5131b0){var _0x2ab67f=this;return new Promise(function(_0x109d4d,_0x4e18da){return db[_0xdaba('0x1f')]['create'](_0x5131b0['body'],{'raw':_0x5131b0[_0xdaba('0x16')]?_0x5131b0[_0xdaba('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x556d71){logger[_0xdaba('0xb')](_0xdaba('0x20'),_0x5131b0);logger[_0xdaba('0xd')]('CreateCmHopper',_0x5131b0,JSON[_0xdaba('0xf')](_0x556d71));_0x109d4d(_0x556d71);})[_0xdaba('0x1d')](function(_0x478c24){logger['error'](_0xdaba('0x20'),_0x478c24[_0xdaba('0x12')],_0x5131b0);_0x4e18da(_0x2ab67f[_0xdaba('0x10')](0x1f4,_0x478c24['message']));});});};exports[_0xdaba('0x21')]=function(_0x569607){var _0x2d2333=this;return new Promise(function(_0x17536b,_0x475845){return db[_0xdaba('0x1f')][_0xdaba('0x22')](_0x569607[_0xdaba('0x23')],{'raw':_0x569607[_0xdaba('0x16')]?_0x569607[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569607[_0xdaba('0x16')]?_0x569607[_0xdaba('0x16')]['where']||null:null,'attributes':_0x569607['options']?_0x569607[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x569607['options']?_0x569607[_0xdaba('0x16')]['limit']||null:null})[_0xdaba('0xa')](function(_0x45de3e){logger[_0xdaba('0xb')](_0xdaba('0x21'),_0x569607);logger['debug'](_0xdaba('0x21'),_0x569607,JSON['stringify'](_0x45de3e));_0x17536b(_0x45de3e);})['catch'](function(_0x656a95){logger[_0xdaba('0x10')](_0xdaba('0x21'),_0x656a95[_0xdaba('0x12')],_0x569607);_0x475845(_0x2d2333[_0xdaba('0x10')](0x1f4,_0x656a95['message']));});});};exports[_0xdaba('0x24')]=function(_0x2fdc54){var _0x7a24d=this;return new Promise(function(_0x4160ba,_0x3875f6){return db['CmHopper'][_0xdaba('0x25')]({'where':_0x2fdc54[_0xdaba('0x16')]?_0x2fdc54[_0xdaba('0x16')][_0xdaba('0x18')]||null:null})[_0xdaba('0xa')](function(_0x4058f1){logger[_0xdaba('0xb')](_0xdaba('0x24'),_0x2fdc54);logger['debug']('DestroyCmHopper',_0x2fdc54,JSON[_0xdaba('0xf')](_0x4058f1));_0x4160ba(_0x4058f1);})['catch'](function(_0x298d7b){logger['error'](_0xdaba('0x24'),_0x298d7b[_0xdaba('0x12')],_0x2fdc54);_0x3875f6(_0x7a24d[_0xdaba('0x10')](0x1f4,_0x298d7b[_0xdaba('0x12')]));});});};exports[_0xdaba('0x26')]=function(_0xc4e976){var _0x2e0c6c=this;return new Promise(function(_0x2cb462,_0x2e18d1){return db[_0xdaba('0x27')][_0xdaba('0x28')]()[_0xdaba('0xa')](function(_0x2ec0c){return db['sequelize'][_0xdaba('0x29')](function(_0x2d1894){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'where':_0xc4e976[_0xdaba('0x16')]?_0xc4e976['options'][_0xdaba('0x18')]||null:null,'attributes':_0xc4e976[_0xdaba('0x16')]?_0xc4e976['options'][_0xdaba('0x19')]||null:null,'limit':_0xc4e976['options']?_0xc4e976[_0xdaba('0x16')]['limit']||null:null,'order':_0xc4e976['options']?_0xc4e976['options']['order']||null:null,'transaction':_0x2d1894,'lock':_0x2d1894[_0xdaba('0x2a')][_0xdaba('0x2b')],'include':[{'model':db[_0xdaba('0x27')],'as':_0xdaba('0x2c'),'attributes':_['keys'](_0x2ec0c)},{'model':db['User'],'as':_0xdaba('0x2d'),'attributes':['id',_0xdaba('0x2e'),'voicePause']}]})[_0xdaba('0xa')](function(_0x5adf77){var _0x5f1ea5=[];var _0xa0b07a=[];for(var _0x296816=0x0;_0x296816<_0x5adf77[_0xdaba('0x2f')];_0x296816+=0x1){if(!_0xa0b07a[_0xdaba('0x30')](_0x5adf77[_0x296816][_0xdaba('0x31')])){_0xa0b07a[_0xdaba('0x32')](_0x5adf77[_0x296816][_0xdaba('0x31')]);_0x5f1ea5['push'](_0x5adf77[_0x296816][_0xdaba('0x22')](_0xc4e976[_0xdaba('0x23')],{'transaction':_0x2d1894}));}}return BPromise['all'](_0x5f1ea5);});})['then'](function(_0x58e1b2){logger[_0xdaba('0xb')]('GetContactDialer',_0xc4e976);logger[_0xdaba('0xd')](_0xdaba('0x26'),_0xc4e976,JSON[_0xdaba('0xf')](_0x58e1b2));_0x2cb462(_0x58e1b2);})[_0xdaba('0x1d')](function(_0x14a196){logger[_0xdaba('0x10')]('GetContactDialer',_0x14a196[_0xdaba('0x12')],_0xc4e976);_0x2e18d1(_0x2e0c6c[_0xdaba('0x10')](0x1f4,_0x14a196[_0xdaba('0x12')]));});});});};exports[_0xdaba('0x33')]=function(_0x1b21fa){var _0x5082ad=this;return new Promise(function(_0x1ef787,_0x71ffee){return db['sequelize']['transaction'](function(_0x5dfe69){return db[_0xdaba('0x34')][_0xdaba('0x35')](_0x1b21fa['body'],{'raw':_0x1b21fa['options']?_0x1b21fa[_0xdaba('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5dfe69})[_0xdaba('0xa')](function(){return db[_0xdaba('0x1f')][_0xdaba('0x25')]({'where':_0x1b21fa['options']?_0x1b21fa[_0xdaba('0x16')]['where']||null:null,'transaction':_0x5dfe69});});})['then'](function(_0x1cd52b){logger[_0xdaba('0xb')](_0xdaba('0x33'),_0x1b21fa);logger[_0xdaba('0xd')](_0xdaba('0x33'),_0x1b21fa,JSON[_0xdaba('0xf')](_0x1cd52b));_0x1ef787(_0x1cd52b);})[_0xdaba('0x1d')](function(_0x1053cb){logger[_0xdaba('0x10')]('MoveContactManagedDialer',_0x1053cb[_0xdaba('0x12')],_0x1b21fa);_0x71ffee(_0x5082ad[_0xdaba('0x10')](0x1f4,_0x1053cb[_0xdaba('0x12')]));});});};exports[_0xdaba('0x36')]=function(_0x311df5){var _0x3afe19=this;return new Promise(function(_0x2d88a3,_0x1ba224){return db['CmHopper']['findAll']({'raw':_0x311df5[_0xdaba('0x16')]?_0x311df5['options']['raw']===undefined?!![]:![]:!![],'where':_0x311df5[_0xdaba('0x16')]?_0x311df5[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':[[db[_0xdaba('0x37')]['fn'](_0xdaba('0x38'),db[_0xdaba('0x37')]['fn']('IF',db[_0xdaba('0x37')][_0xdaba('0x39')](_0xdaba('0x3a')+util[_0xdaba('0x3b')](_0xdaba('0x3c'),moment()[_0xdaba('0x3b')](_0xdaba('0x3d')))+_0xdaba('0x3e')))),_0xdaba('0x3f')]]})[_0xdaba('0xa')](function(_0x2692ff){logger[_0xdaba('0xb')](_0xdaba('0x36'),_0x311df5);logger[_0xdaba('0xd')](_0xdaba('0x36'),_0x311df5,JSON['stringify'](_0x2692ff));_0x2d88a3(_0x2692ff);})[_0xdaba('0x1d')](function(_0x433e3a){logger['error']('CountReScheduled',_0x433e3a[_0xdaba('0x12')],_0x311df5);_0x1ba224(_0x3afe19[_0xdaba('0x10')](0x1f4,_0x433e3a['message']));});});};exports['GetContactRecallMe']=function(_0x10a4d2){var _0x1a76e7=this;return new Promise(function(_0x4694d4,_0x4732f1){return db[_0xdaba('0x27')][_0xdaba('0x28')]()['then'](function(_0x5702ec){return db[_0xdaba('0x37')][_0xdaba('0x29')](function(_0x3029bd){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'where':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x18')]||null:null,'attributes':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':0x1,'order':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2['options'][_0xdaba('0x40')]||null:null,'group':db[_0xdaba('0x1f')][_0xdaba('0x31')],'transaction':_0x3029bd,'lock':_0x3029bd['LOCK'][_0xdaba('0x2b')],'include':_0x10a4d2[_0xdaba('0x16')]?_0x10a4d2['options'][_0xdaba('0x1a')]?_['map'](_0x10a4d2[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x4cae6b){return{'model':db[_0x4cae6b[_0xdaba('0x1c')]],'as':_0x4cae6b['as'],'attributes':_0x4cae6b['attributes'],'include':_0x4cae6b[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x4cae6b[_0xdaba('0x1a')],function(_0x261364){return{'model':db[_0x261364[_0xdaba('0x1c')]],'as':_0x261364['as'],'attributes':_0x261364[_0xdaba('0x19')],'include':_0x261364[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x261364[_0xdaba('0x1a')],function(_0x410d84){return{'model':db[_0x410d84['model']],'as':_0x410d84['as'],'attributes':_0x410d84[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x9117cb){var _0x1fa479=[];for(var _0x1c4f3e=0x0;_0x1c4f3e<_0x9117cb[_0xdaba('0x2f')];_0x1c4f3e+=0x1){_0x1fa479[_0xdaba('0x32')](_0x9117cb[_0x1c4f3e]['update'](_0x10a4d2[_0xdaba('0x23')],{'transaction':_0x3029bd}));}return BPromise[_0xdaba('0x41')](_0x1fa479);});})['then'](function(_0x2aab5f){logger['info'](_0xdaba('0x42'),_0x10a4d2);logger[_0xdaba('0xd')](_0xdaba('0x42'),_0x10a4d2,JSON[_0xdaba('0xf')](_0x2aab5f));_0x4694d4(_0x2aab5f);})[_0xdaba('0x1d')](function(_0x493017){logger['error'](_0xdaba('0x42'),_0x493017[_0xdaba('0x12')],_0x10a4d2);_0x4732f1(_0x1a76e7['error'](0x1f4,_0x493017[_0xdaba('0x12')]));});});});};exports[_0xdaba('0x43')]=function(_0x2f5eea){var _0x2973cc=this;return new Promise(function(_0x226b5e,_0x392e33){db[_0xdaba('0x27')]['describe']()['then'](function(_0x3bf6c5){return db[_0xdaba('0x1f')][_0xdaba('0x15')]({'raw':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x17')]===undefined?!![]:![]:!![],'where':_0x2f5eea['options']?_0x2f5eea[_0xdaba('0x16')]['where']||null:null,'attributes':_0x2f5eea['options']?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x19')]||null:null,'limit':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea['options'][_0xdaba('0x44')]||null:null,'include':_0x2f5eea[_0xdaba('0x16')]?_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x2f5eea[_0xdaba('0x16')][_0xdaba('0x1a')],function(_0x260769){return{'model':db[_0x260769['model']],'as':_0x260769['as'],'attributes':_0x260769['as']===_0xdaba('0x2c')?_[_0xdaba('0x45')](_0x3bf6c5):_0x260769[_0xdaba('0x19')],'include':_0x260769[_0xdaba('0x1a')]?_['map'](_0x260769[_0xdaba('0x1a')],function(_0x91ba66){return{'model':db[_0x91ba66[_0xdaba('0x1c')]],'as':_0x91ba66['as'],'attributes':_0x91ba66[_0xdaba('0x19')],'include':_0x91ba66[_0xdaba('0x1a')]?_[_0xdaba('0x1b')](_0x91ba66[_0xdaba('0x1a')],function(_0x7b588f){return{'model':db[_0x7b588f[_0xdaba('0x1c')]],'as':_0x7b588f['as'],'attributes':_0x7b588f[_0xdaba('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaba('0xa')](function(_0x1156b2){logger['info'](_0xdaba('0x14'),_0x2f5eea);logger[_0xdaba('0xd')](_0xdaba('0x14'),_0x2f5eea,JSON[_0xdaba('0xf')](_0x1156b2));_0x226b5e(_0x1156b2);})[_0xdaba('0x1d')](function(_0x5743ad){logger[_0xdaba('0x10')](_0xdaba('0x14'),_0x5743ad['message'],_0x2f5eea);_0x392e33(_0x2973cc[_0xdaba('0x10')](0x1f4,_0x5743ad[_0xdaba('0x12')]));});});});}; \ No newline at end of file +var _0xa419=['GetContactDialer','describe','sequelize','CmContact','Contact','keys','User','Agent','voicePause','length','includes','push','UserId','all','transaction','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','LOCK','GetCmHopperPreview','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','GetCmHopper','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','CmHopper','find','stringify','catch','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper'];(function(_0x1df9c4,_0x31ed6d){var _0x54a9fe=function(_0x540de8){while(--_0x540de8){_0x1df9c4['push'](_0x1df9c4['shift']());}};_0x54a9fe(++_0x31ed6d);}(_0xa419,0xf0));var _0x9a41=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xa419[_0x602ca8];return _0x26e8ab;};'use strict';var _=require('lodash');var util=require(_0x9a41('0x0'));var moment=require(_0x9a41('0x1'));var BPromise=require(_0x9a41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a41('0x3'));var db=require(_0x9a41('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a41('0x5'))(_0x9a41('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a41('0x7'));var client=jayson[_0x9a41('0x8')][_0x9a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485e14,_0x322cce,_0x188d3b){return new BPromise(function(_0x1a67dc,_0x22672d){return client[_0x9a41('0xa')](_0x485e14,_0x188d3b)[_0x9a41('0xb')](function(_0xb2e034){logger[_0x9a41('0xc')](_0x9a41('0xd'),_0x322cce,_0x9a41('0xe'));logger[_0x9a41('0xf')](_0x9a41('0x10'),_0x322cce,_0x9a41('0xe'),JSON['stringify'](_0xb2e034));if(_0xb2e034['error']){if(_0xb2e034[_0x9a41('0x11')][_0x9a41('0x12')]===0x1f4){logger[_0x9a41('0x11')]('CmHopper,\x20%s,\x20%s',_0x322cce,_0xb2e034[_0x9a41('0x11')][_0x9a41('0x13')]);return _0x22672d(_0xb2e034[_0x9a41('0x11')][_0x9a41('0x13')]);}logger[_0x9a41('0x11')](_0x9a41('0xd'),_0x322cce,_0xb2e034['error'][_0x9a41('0x13')]);return _0x1a67dc(_0xb2e034[_0x9a41('0x11')]['message']);}else{logger[_0x9a41('0xc')](_0x9a41('0xd'),_0x322cce,_0x9a41('0xe'));_0x1a67dc(_0xb2e034['result'][_0x9a41('0x13')]);}})['catch'](function(_0x4b7f29){logger[_0x9a41('0x11')](_0x9a41('0xd'),_0x322cce,_0x4b7f29);_0x22672d(_0x4b7f29);});});}exports[_0x9a41('0x14')]=function(_0x2994bb){var _0x2470ce=this;return new Promise(function(_0x216afe,_0x2ba003){return db['CmHopper']['findAll']({'raw':_0x2994bb[_0x9a41('0x15')]?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x2994bb[_0x9a41('0x15')]?_0x2994bb['options'][_0x9a41('0x17')]||null:null,'attributes':_0x2994bb[_0x9a41('0x15')]?_0x2994bb['options'][_0x9a41('0x18')]||null:null,'limit':_0x2994bb['options']?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x19')]||null:null,'include':_0x2994bb[_0x9a41('0x15')]?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x2994bb[_0x9a41('0x15')][_0x9a41('0x1a')],function(_0x1351f5){return{'model':db[_0x1351f5[_0x9a41('0x1c')]],'as':_0x1351f5['as'],'attributes':_0x1351f5[_0x9a41('0x18')],'include':_0x1351f5[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x1351f5[_0x9a41('0x1a')],function(_0x446b03){return{'model':db[_0x446b03[_0x9a41('0x1c')]],'as':_0x446b03['as'],'attributes':_0x446b03[_0x9a41('0x18')],'include':_0x446b03[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x446b03[_0x9a41('0x1a')],function(_0x3c9801){return{'model':db[_0x3c9801[_0x9a41('0x1c')]],'as':_0x3c9801['as'],'attributes':_0x3c9801[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x21d710){logger['info'](_0x9a41('0x14'),_0x2994bb);logger[_0x9a41('0xf')](_0x9a41('0x14'),_0x2994bb,JSON['stringify'](_0x21d710));_0x216afe(_0x21d710);})['catch'](function(_0x399658){logger[_0x9a41('0x11')](_0x9a41('0x14'),_0x399658[_0x9a41('0x13')],_0x2994bb);_0x2ba003(_0x2470ce[_0x9a41('0x11')](0x1f4,_0x399658[_0x9a41('0x13')]));});});};exports[_0x9a41('0x1d')]=function(_0x239c0b){var _0x56e0f3=this;return new Promise(function(_0x46f068,_0x1d16bb){return db[_0x9a41('0x1e')][_0x9a41('0x1f')]({'raw':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')]['where']||null:null,'attributes':_0x239c0b[_0x9a41('0x15')]?_0x239c0b['options'][_0x9a41('0x18')]||null:null,'include':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')][_0x9a41('0x1a')]?_['map'](_0x239c0b[_0x9a41('0x15')]['include'],function(_0x311008){return{'model':db[_0x311008[_0x9a41('0x1c')]],'as':_0x311008['as'],'attributes':_0x311008[_0x9a41('0x18')],'include':_0x311008[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x311008[_0x9a41('0x1a')],function(_0x256bc7){return{'model':db[_0x256bc7[_0x9a41('0x1c')]],'as':_0x256bc7['as'],'attributes':_0x256bc7[_0x9a41('0x18')],'include':_0x256bc7[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x256bc7[_0x9a41('0x1a')],function(_0x149f83){return{'model':db[_0x149f83[_0x9a41('0x1c')]],'as':_0x149f83['as'],'attributes':_0x149f83[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x35aded){logger[_0x9a41('0xc')]('ShowCmHopper',_0x239c0b);logger[_0x9a41('0xf')](_0x9a41('0x1d'),_0x239c0b,JSON[_0x9a41('0x20')](_0x35aded));_0x46f068(_0x35aded);})[_0x9a41('0x21')](function(_0x76f040){logger[_0x9a41('0x11')](_0x9a41('0x1d'),_0x76f040[_0x9a41('0x13')],_0x239c0b);_0x1d16bb(_0x56e0f3['error'](0x1f4,_0x76f040[_0x9a41('0x13')]));});});};exports['CreateCmHopper']=function(_0x2cb402){var _0x47381f=this;return new Promise(function(_0x4329e3,_0x16820e){return db[_0x9a41('0x1e')][_0x9a41('0x22')](_0x2cb402[_0x9a41('0x23')],{'raw':_0x2cb402[_0x9a41('0x15')]?_0x2cb402[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2c47cc){logger[_0x9a41('0xc')]('CreateCmHopper',_0x2cb402);logger['debug'](_0x9a41('0x24'),_0x2cb402,JSON['stringify'](_0x2c47cc));_0x4329e3(_0x2c47cc);})[_0x9a41('0x21')](function(_0x489c6b){logger[_0x9a41('0x11')](_0x9a41('0x24'),_0x489c6b['message'],_0x2cb402);_0x16820e(_0x47381f['error'](0x1f4,_0x489c6b[_0x9a41('0x13')]));});});};exports[_0x9a41('0x25')]=function(_0x566161){var _0x5147a0=this;return new Promise(function(_0x1b6674,_0x3b04c4){return db[_0x9a41('0x1e')][_0x9a41('0x26')](_0x566161['body'],{'raw':_0x566161['options']?_0x566161[_0x9a41('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x566161[_0x9a41('0x15')]?_0x566161[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x566161['options']?_0x566161[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':_0x566161[_0x9a41('0x15')]?_0x566161[_0x9a41('0x15')]['limit']||null:null})[_0x9a41('0xb')](function(_0x56d3c3){logger[_0x9a41('0xc')](_0x9a41('0x25'),_0x566161);logger['debug'](_0x9a41('0x25'),_0x566161,JSON['stringify'](_0x56d3c3));_0x1b6674(_0x56d3c3);})[_0x9a41('0x21')](function(_0x1622f1){logger[_0x9a41('0x11')](_0x9a41('0x25'),_0x1622f1[_0x9a41('0x13')],_0x566161);_0x3b04c4(_0x5147a0[_0x9a41('0x11')](0x1f4,_0x1622f1[_0x9a41('0x13')]));});});};exports['DestroyCmHopper']=function(_0x4a2669){var _0x20e78d=this;return new Promise(function(_0x590685,_0x16b85a){return db[_0x9a41('0x1e')]['destroy']({'where':_0x4a2669[_0x9a41('0x15')]?_0x4a2669['options'][_0x9a41('0x17')]||null:null})['then'](function(_0x31543a){logger[_0x9a41('0xc')](_0x9a41('0x27'),_0x4a2669);logger['debug'](_0x9a41('0x27'),_0x4a2669,JSON[_0x9a41('0x20')](_0x31543a));_0x590685(_0x31543a);})[_0x9a41('0x21')](function(_0x394cc4){logger[_0x9a41('0x11')](_0x9a41('0x27'),_0x394cc4[_0x9a41('0x13')],_0x4a2669);_0x16b85a(_0x20e78d[_0x9a41('0x11')](0x1f4,_0x394cc4['message']));});});};exports[_0x9a41('0x28')]=function(_0x3d7011){var _0x5ba5d5=this;return new Promise(function(_0x529279,_0x459d1e){return db['CmContact'][_0x9a41('0x29')]()[_0x9a41('0xb')](function(_0x5e44e6){return db[_0x9a41('0x2a')]['transaction'](function(_0x58697b){return db['CmHopper']['findAll']({'where':_0x3d7011['options']?_0x3d7011[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')]['attributes']||null:null,'limit':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')][_0x9a41('0x19')]||null:null,'order':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')]['order']||null:null,'transaction':_0x58697b,'lock':_0x58697b['LOCK']['UPDATE'],'include':[{'model':db[_0x9a41('0x2b')],'as':_0x9a41('0x2c'),'attributes':_[_0x9a41('0x2d')](_0x5e44e6)},{'model':db[_0x9a41('0x2e')],'as':_0x9a41('0x2f'),'attributes':['id','name',_0x9a41('0x30')]}]})[_0x9a41('0xb')](function(_0x5b0047){var _0xdcebd8=[];var _0x5f3263=[];for(var _0x95cafd=0x0;_0x95cafd<_0x5b0047[_0x9a41('0x31')];_0x95cafd+=0x1){if(!_0x5f3263[_0x9a41('0x32')](_0x5b0047[_0x95cafd]['UserId'])){_0x5f3263[_0x9a41('0x33')](_0x5b0047[_0x95cafd][_0x9a41('0x34')]);_0xdcebd8[_0x9a41('0x33')](_0x5b0047[_0x95cafd][_0x9a41('0x26')](_0x3d7011['body'],{'transaction':_0x58697b}));}}return BPromise[_0x9a41('0x35')](_0xdcebd8);});})['then'](function(_0xb9bb8b){logger[_0x9a41('0xc')]('GetContactDialer',_0x3d7011);logger['debug'](_0x9a41('0x28'),_0x3d7011,JSON[_0x9a41('0x20')](_0xb9bb8b));_0x529279(_0xb9bb8b);})[_0x9a41('0x21')](function(_0x208bba){logger[_0x9a41('0x11')](_0x9a41('0x28'),_0x208bba[_0x9a41('0x13')],_0x3d7011);_0x459d1e(_0x5ba5d5[_0x9a41('0x11')](0x1f4,_0x208bba['message']));});});});};exports['MoveContactManagedDialer']=function(_0xe6bc6b){var _0xa84278=this;return new Promise(function(_0x30e0e9,_0x29442f){return db[_0x9a41('0x2a')][_0x9a41('0x36')](function(_0x53aa67){return db[_0x9a41('0x37')][_0x9a41('0x22')](_0xe6bc6b[_0x9a41('0x23')],{'raw':_0xe6bc6b[_0x9a41('0x15')]?_0xe6bc6b[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'transaction':_0x53aa67})[_0x9a41('0xb')](function(){return db[_0x9a41('0x1e')][_0x9a41('0x38')]({'where':_0xe6bc6b['options']?_0xe6bc6b[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'transaction':_0x53aa67});});})[_0x9a41('0xb')](function(_0x4fc0ae){logger['info'](_0x9a41('0x39'),_0xe6bc6b);logger[_0x9a41('0xf')](_0x9a41('0x39'),_0xe6bc6b,JSON[_0x9a41('0x20')](_0x4fc0ae));_0x30e0e9(_0x4fc0ae);})[_0x9a41('0x21')](function(_0x1d4f1e){logger[_0x9a41('0x11')](_0x9a41('0x39'),_0x1d4f1e[_0x9a41('0x13')],_0xe6bc6b);_0x29442f(_0xa84278[_0x9a41('0x11')](0x1f4,_0x1d4f1e['message']));});});};exports[_0x9a41('0x3a')]=function(_0x1faada){var _0x3c011e=this;return new Promise(function(_0x3b0b57,_0x58d7da){return db[_0x9a41('0x1e')][_0x9a41('0x3b')]({'raw':_0x1faada[_0x9a41('0x15')]?_0x1faada[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x1faada[_0x9a41('0x15')]?_0x1faada[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9a41('0x3c'),db[_0x9a41('0x2a')]['fn']('IF',db['sequelize'][_0x9a41('0x3d')](_0x9a41('0x3e')+util[_0x9a41('0x3f')](_0x9a41('0x40'),moment()[_0x9a41('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x9a41('0x41')))),'contactsRescheduled']]})[_0x9a41('0xb')](function(_0x496474){logger[_0x9a41('0xc')]('CountReScheduled',_0x1faada);logger[_0x9a41('0xf')]('CountReScheduled',_0x1faada,JSON[_0x9a41('0x20')](_0x496474));_0x3b0b57(_0x496474);})[_0x9a41('0x21')](function(_0x1317dd){logger[_0x9a41('0x11')](_0x9a41('0x3a'),_0x1317dd[_0x9a41('0x13')],_0x1faada);_0x58d7da(_0x3c011e[_0x9a41('0x11')](0x1f4,_0x1317dd[_0x9a41('0x13')]));});});};exports[_0x9a41('0x42')]=function(_0x97ea29){var _0x48c4d3=this;return new Promise(function(_0xd5f45d,_0x1dabaf){return db[_0x9a41('0x2b')][_0x9a41('0x29')]()['then'](function(_0x390a42){return db[_0x9a41('0x2a')][_0x9a41('0x36')](function(_0x5d1b20){return db['CmHopper'][_0x9a41('0x3b')]({'where':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')]['where']||null:null,'attributes':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':0x1,'order':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x43')]||null:null,'group':db[_0x9a41('0x1e')]['UserId'],'transaction':_0x5d1b20,'lock':_0x5d1b20[_0x9a41('0x44')]['UPDATE'],'include':_0x97ea29['options']?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x97ea29[_0x9a41('0x15')][_0x9a41('0x1a')],function(_0x8f9bcc){return{'model':db[_0x8f9bcc[_0x9a41('0x1c')]],'as':_0x8f9bcc['as'],'attributes':_0x8f9bcc['attributes'],'include':_0x8f9bcc[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x8f9bcc[_0x9a41('0x1a')],function(_0xe4156){return{'model':db[_0xe4156[_0x9a41('0x1c')]],'as':_0xe4156['as'],'attributes':_0xe4156[_0x9a41('0x18')],'include':_0xe4156[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0xe4156['include'],function(_0x33bf77){return{'model':db[_0x33bf77[_0x9a41('0x1c')]],'as':_0x33bf77['as'],'attributes':_0x33bf77[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x2a5c8a){var _0x350411=[];for(var _0x34ebb1=0x0;_0x34ebb1<_0x2a5c8a[_0x9a41('0x31')];_0x34ebb1+=0x1){_0x350411[_0x9a41('0x33')](_0x2a5c8a[_0x34ebb1][_0x9a41('0x26')](_0x97ea29[_0x9a41('0x23')],{'transaction':_0x5d1b20}));}return BPromise[_0x9a41('0x35')](_0x350411);});})[_0x9a41('0xb')](function(_0x5668f4){logger[_0x9a41('0xc')](_0x9a41('0x42'),_0x97ea29);logger[_0x9a41('0xf')](_0x9a41('0x42'),_0x97ea29,JSON[_0x9a41('0x20')](_0x5668f4));_0xd5f45d(_0x5668f4);})[_0x9a41('0x21')](function(_0x4af027){logger[_0x9a41('0x11')]('GetContactRecallMe',_0x4af027[_0x9a41('0x13')],_0x97ea29);_0x1dabaf(_0x48c4d3[_0x9a41('0x11')](0x1f4,_0x4af027[_0x9a41('0x13')]));});});});};exports[_0x9a41('0x45')]=function(_0x4c058f){var _0x139998=this;return new Promise(function(_0x225ed2,_0x35931f){db[_0x9a41('0x2b')][_0x9a41('0x29')]()[_0x9a41('0xb')](function(_0x474a93){return db[_0x9a41('0x1e')][_0x9a41('0x3b')]({'raw':_0x4c058f['options']?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x4c058f[_0x9a41('0x15')]?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x4c058f['options']?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':_0x4c058f[_0x9a41('0x15')]?_0x4c058f[_0x9a41('0x15')]['limit']||null:null,'include':_0x4c058f[_0x9a41('0x15')]?_0x4c058f['options'][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x4c058f['options']['include'],function(_0x32dc82){return{'model':db[_0x32dc82[_0x9a41('0x1c')]],'as':_0x32dc82['as'],'attributes':_0x32dc82['as']===_0x9a41('0x2c')?_['keys'](_0x474a93):_0x32dc82[_0x9a41('0x18')],'include':_0x32dc82[_0x9a41('0x1a')]?_['map'](_0x32dc82[_0x9a41('0x1a')],function(_0x4a700c){return{'model':db[_0x4a700c[_0x9a41('0x1c')]],'as':_0x4a700c['as'],'attributes':_0x4a700c[_0x9a41('0x18')],'include':_0x4a700c['include']?_[_0x9a41('0x1b')](_0x4a700c[_0x9a41('0x1a')],function(_0x3e795c){return{'model':db[_0x3e795c[_0x9a41('0x1c')]],'as':_0x3e795c['as'],'attributes':_0x3e795c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x544142){logger[_0x9a41('0xc')]('GetCmHopper',_0x4c058f);logger[_0x9a41('0xf')](_0x9a41('0x14'),_0x4c058f,JSON[_0x9a41('0x20')](_0x544142));_0x225ed2(_0x544142);})['catch'](function(_0x135a72){logger[_0x9a41('0x11')](_0x9a41('0x14'),_0x135a72[_0x9a41('0x13')],_0x4c058f);_0x35931f(_0x139998[_0x9a41('0x11')](0x1f4,_0x135a72[_0x9a41('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 734184c..9ca83ec 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 _0xf7d9=['../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7d9,0x122));var _0x9f7d=function(_0x56cc0b,_0x335f0b){_0x56cc0b=_0x56cc0b-0x0;var _0x428427=_0xf7d9[_0x56cc0b];return _0x428427;};'use strict';var multer=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var path=require(_0x9f7d('0x2'));var timeout=require(_0x9f7d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9f7d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f7d('0x5'));var controller=require(_0x9f7d('0x6'));router[_0x9f7d('0x7')]('/',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x9')]);router['get']('/describe',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xa')]);router[_0x9f7d('0x7')](_0x9f7d('0xb'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xc')]);router['get'](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller['show']);router[_0x9f7d('0xe')]('/',auth[_0x9f7d('0x8')](),controller[_0x9f7d('0xf')]);router['post'](_0x9f7d('0x10'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x11')]);router[_0x9f7d('0x12')](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller['update']);router[_0x9f7d('0x13')](_0x9f7d('0xd'),auth[_0x9f7d('0x8')](),controller[_0x9f7d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd8d7=['create','/preview','getPreview','update','delete','exports','multer','util','path','connect-timeout','express','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts','/:id','show','post'];(function(_0x19bf9c,_0xa5ef2){var _0x2fd6a6=function(_0x1662fc){while(--_0x1662fc){_0x19bf9c['push'](_0x19bf9c['shift']());}};_0x2fd6a6(++_0xa5ef2);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xd8d7[_0x1a37e3];return _0x4db78a;};'use strict';var multer=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var path=require(_0x7d8d('0x2'));var timeout=require(_0x7d8d('0x3'));var express=require(_0x7d8d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d8d('0x5'));router['get']('/',auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x7')]);router[_0x7d8d('0x8')](_0x7d8d('0x9'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xa')]);router[_0x7d8d('0x8')]('/opencontacts',auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xb')]);router[_0x7d8d('0x8')](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xd')]);router[_0x7d8d('0xe')]('/',auth['isAuthenticated'](),controller[_0x7d8d('0xf')]);router[_0x7d8d('0xe')](_0x7d8d('0x10'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x11')]);router['put'](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x12')]);router[_0x7d8d('0x13')](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller['destroy']);module[_0x7d8d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7861b72..3d125f9 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 _0xf3b6=['INTEGER','format','exports'];(function(_0x22356e,_0x526698){var _0x59461e=function(_0x4ceb27){while(--_0x4ceb27){_0x22356e['push'](_0x22356e['shift']());}};_0x59461e(++_0x526698);}(_0xf3b6,0x143));var _0x6f3b=function(_0x144bcc,_0x55c75d){_0x144bcc=_0x144bcc-0x0;var _0x56774d=_0xf3b6[_0x144bcc];return _0x56774d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6f3b('0x0')]={'CmHopperId':{'type':Sequelize[_0x6f3b('0x1')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6f3b('0x2')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f3b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3892=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x1b886d,_0x35ace0){var _0x318c4d=function(_0x220360){while(--_0x220360){_0x1b886d['push'](_0x1b886d['shift']());}};_0x318c4d(++_0x35ace0);}(_0x3892,0xde));var _0x2389=function(_0x4300b3,_0x38ee7f){_0x4300b3=_0x4300b3-0x0;var _0x8620ab=_0x3892[_0x4300b3];return _0x8620ab;};'use strict';var moment=require(_0x2389('0x0'));var Sequelize=require(_0x2389('0x1'));module[_0x2389('0x2')]={'CmHopperId':{'type':Sequelize[_0x2389('0x3')]},'phone':{'type':Sequelize[_0x2389('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2389('0x5')],'defaultValue':moment()[_0x2389('0x6')](_0x2389('0x7'))},'countbusyretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2389('0x3')],'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 997078d..484aed5 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 _0xc051=['hasOwnProperty','nolimit','sort','pick','filter','where','options','includeAll','include','catch','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','error','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x17e00c,_0xae93a){var _0x175f73=function(_0x57e8e9){while(--_0x57e8e9){_0x17e00c['push'](_0x17e00c['shift']());}};_0x175f73(++_0xae93a);}(_0xc051,0xb5));var _0x1c05=function(_0x3871d6,_0x552214){_0x3871d6=_0x3871d6-0x0;var _0xcaab5=_0xc051[_0x3871d6];return _0xcaab5;};'use strict';var pdf=require(_0x1c05('0x0'));var emlformat=require(_0x1c05('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c05('0x2'));var rp=require(_0x1c05('0x3'));var moment=require(_0x1c05('0x4'));var BPromise=require(_0x1c05('0x5'));var Mustache=require('mustache');var util=require(_0x1c05('0x6'));var path=require(_0x1c05('0x7'));var sox=require(_0x1c05('0x8'));var csv=require(_0x1c05('0x9'));var ejs=require(_0x1c05('0xa'));var fs=require('fs');var _=require(_0x1c05('0xb'));var squel=require(_0x1c05('0xc'));var crypto=require(_0x1c05('0xd'));var jsforce=require(_0x1c05('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c05('0x9'));var querystring=require(_0x1c05('0xf'));var Papa=require(_0x1c05('0x10'));var Redis=require(_0x1c05('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c05('0x12'));var as=require(_0x1c05('0x13'));var hardwareService=require(_0x1c05('0x14'));var logger=require(_0x1c05('0x15'))('api');var utils=require(_0x1c05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1c05('0x17'));var db=require(_0x1c05('0x18'))['db'];function respondWithStatusCode(_0x188301,_0x32cbf0){_0x32cbf0=_0x32cbf0||0xcc;return function(_0x4474ef){if(_0x4474ef){return _0x188301[_0x1c05('0x19')](_0x32cbf0);}return _0x188301[_0x1c05('0x1a')](_0x32cbf0)[_0x1c05('0x1b')]();};}function respondWithResult(_0x4de1c8,_0x2ba5a2){_0x2ba5a2=_0x2ba5a2||0xc8;return function(_0x2bffb8){if(_0x2bffb8){return _0x4de1c8[_0x1c05('0x1a')](_0x2ba5a2)['json'](_0x2bffb8);}};}function respondWithFilteredResult(_0x8fe340,_0x175166){return function(_0x26a61e){if(_0x26a61e){var _0x568633=_0x26a61e[_0x1c05('0x1c')],_0x1e713f=_0x175166[_0x1c05('0x1d')],_0x49b538=_0x175166[_0x1c05('0x1d')]+_0x175166[_0x1c05('0x1e')],_0x2ad711;if(_0x49b538>=_0x568633){_0x49b538=_0x568633;_0x2ad711=0xc8;}else{_0x2ad711=0xce;}_0x8fe340['status'](_0x2ad711);return _0x8fe340[_0x1c05('0x1f')](_0x1c05('0x20'),_0x1e713f+'-'+_0x49b538+'/'+_0x568633)[_0x1c05('0x21')](_0x26a61e);}return null;};}function patchUpdates(_0x4d0680){return function(_0x2e177c){try{jsonpatch[_0x1c05('0x22')](_0x2e177c,_0x4d0680,!![]);}catch(_0x3176c0){return BPromise['reject'](_0x3176c0);}return _0x2e177c[_0x1c05('0x23')]();};}function saveUpdates(_0x32cce1,_0x4a4bff){return function(_0x5696ce){if(_0x5696ce){return _0x5696ce[_0x1c05('0x24')](_0x32cce1)['then'](function(_0x48400c){return _0x48400c;});}return null;};}function removeEntity(_0x549b51,_0x31beae){return function(_0xcce64e){if(_0xcce64e){return _0xcce64e['destroy']()[_0x1c05('0x25')](function(){var _0x357401=_0xcce64e[_0x1c05('0x26')]({'plain':!![]});var _0x2cf340='CmHopperAdditionalPhones';return db[_0x1c05('0x27')][_0x1c05('0x28')]({'where':{'type':_0x2cf340,'resourceId':_0x357401['id']}})[_0x1c05('0x25')](function(){return _0xcce64e;});})[_0x1c05('0x25')](function(){_0x549b51[_0x1c05('0x1a')](0xcc)[_0x1c05('0x1b')]();});}};}function handleEntityNotFound(_0x56c701,_0xa841fb){return function(_0x1dd767){if(!_0x1dd767){_0x56c701[_0x1c05('0x19')](0x194);}return _0x1dd767;};}function handleError(_0x334a42,_0xbcd61a){_0xbcd61a=_0xbcd61a||0x1f4;return function(_0x127190){logger[_0x1c05('0x29')](_0x127190['stack']);if(_0x127190[_0x1c05('0x2a')]){delete _0x127190[_0x1c05('0x2a')];}_0x334a42[_0x1c05('0x1a')](_0xbcd61a)['send'](_0x127190);};}exports['index']=function(_0x21594d,_0x1d548e){var _0x1ca0de={},_0x404b36={},_0x2a9c74={'count':0x0,'rows':[]};var _0x438f4d=_[_0x1c05('0x2b')](db[_0x1c05('0x2c')][_0x1c05('0x2d')],function(_0x3a9abb){return{'name':_0x3a9abb[_0x1c05('0x2e')],'type':_0x3a9abb[_0x1c05('0x2f')][_0x1c05('0x30')]};});_0x404b36[_0x1c05('0x31')]=_['map'](_0x438f4d,_0x1c05('0x2a'));_0x404b36['query']=_['keys'](_0x21594d[_0x1c05('0x32')]);_0x404b36[_0x1c05('0x33')]=_[_0x1c05('0x34')](_0x404b36[_0x1c05('0x31')],_0x404b36['query']);_0x1ca0de[_0x1c05('0x35')]=_['intersection'](_0x404b36[_0x1c05('0x31')],qs['fields'](_0x21594d[_0x1c05('0x32')][_0x1c05('0x36')]));_0x1ca0de[_0x1c05('0x35')]=_0x1ca0de[_0x1c05('0x35')][_0x1c05('0x37')]?_0x1ca0de[_0x1c05('0x35')]:_0x404b36[_0x1c05('0x31')];if(!_0x21594d[_0x1c05('0x32')][_0x1c05('0x38')](_0x1c05('0x39'))){_0x1ca0de[_0x1c05('0x1e')]=qs[_0x1c05('0x1e')](_0x21594d[_0x1c05('0x32')][_0x1c05('0x1e')]);_0x1ca0de[_0x1c05('0x1d')]=qs[_0x1c05('0x1d')](_0x21594d[_0x1c05('0x32')][_0x1c05('0x1d')]);}_0x1ca0de['order']=qs[_0x1c05('0x3a')](_0x21594d[_0x1c05('0x32')]['sort']);_0x1ca0de['where']=qs[_0x1c05('0x33')](_[_0x1c05('0x3b')](_0x21594d[_0x1c05('0x32')],_0x404b36['filters']),_0x438f4d);if(_0x21594d[_0x1c05('0x32')][_0x1c05('0x3c')]){_0x1ca0de[_0x1c05('0x3d')]=_['merge'](_0x1ca0de[_0x1c05('0x3d')],{'$or':_[_0x1c05('0x2b')](_0x438f4d,function(_0x2079cc){if(_0x2079cc['type']!=='VIRTUAL'){var _0x515b3d={};_0x515b3d[_0x2079cc['name']]={'$like':'%'+_0x21594d[_0x1c05('0x32')]['filter']+'%'};return _0x515b3d;}})});}_0x1ca0de=_['merge']({},_0x1ca0de,_0x21594d[_0x1c05('0x3e')]);var _0x35de2a={'where':_0x1ca0de[_0x1c05('0x3d')]};return db['CmHopperAdditionalPhone'][_0x1c05('0x1c')](_0x35de2a)[_0x1c05('0x25')](function(_0x2b0605){_0x2a9c74[_0x1c05('0x1c')]=_0x2b0605;if(_0x21594d[_0x1c05('0x32')][_0x1c05('0x3f')]){_0x1ca0de[_0x1c05('0x40')]=[{'all':!![]}];}return db[_0x1c05('0x2c')]['findAll'](_0x1ca0de);})[_0x1c05('0x25')](function(_0x223a30){_0x2a9c74['rows']=_0x223a30;return _0x2a9c74;})[_0x1c05('0x25')](respondWithFilteredResult(_0x1d548e,_0x1ca0de))[_0x1c05('0x41')](handleError(_0x1d548e,null));};exports['show']=function(_0x28ae69,_0x12bc9f){var _0x315604={'raw':!![],'where':{'id':_0x28ae69['params']['id']}},_0x32b117={};_0x32b117[_0x1c05('0x31')]=_['keys'](db['CmHopperAdditionalPhone'][_0x1c05('0x2d')]);_0x32b117[_0x1c05('0x32')]=_[_0x1c05('0x42')](_0x28ae69['query']);_0x32b117[_0x1c05('0x33')]=_['intersection'](_0x32b117[_0x1c05('0x31')],_0x32b117['query']);_0x315604[_0x1c05('0x35')]=_[_0x1c05('0x34')](_0x32b117['model'],qs[_0x1c05('0x36')](_0x28ae69[_0x1c05('0x32')][_0x1c05('0x36')]));_0x315604[_0x1c05('0x35')]=_0x315604[_0x1c05('0x35')][_0x1c05('0x37')]?_0x315604[_0x1c05('0x35')]:_0x32b117[_0x1c05('0x31')];if(_0x28ae69[_0x1c05('0x32')]['includeAll']){_0x315604[_0x1c05('0x40')]=[{'all':!![]}];}_0x315604=_[_0x1c05('0x43')]({},_0x315604,_0x28ae69[_0x1c05('0x3e')]);return db['CmHopperAdditionalPhone'][_0x1c05('0x44')](_0x315604)[_0x1c05('0x25')](handleEntityNotFound(_0x12bc9f,null))[_0x1c05('0x25')](respondWithResult(_0x12bc9f,null))[_0x1c05('0x41')](handleError(_0x12bc9f,null));};exports[_0x1c05('0x45')]=function(_0x2158d7,_0xfa3a5e){return db[_0x1c05('0x2c')][_0x1c05('0x45')](_0x2158d7[_0x1c05('0x46')],{})[_0x1c05('0x25')](function(_0x4dc4fb){var _0x3626c4=_0x2158d7['user'][_0x1c05('0x26')]({'plain':!![]});if(!_0x3626c4)throw new Error(_0x1c05('0x47'));if(_0x3626c4[_0x1c05('0x48')]==='user'){var _0x10f511=_0x4dc4fb['get']({'plain':!![]});var _0x1df18b=_0x1c05('0x49');return db[_0x1c05('0x4a')][_0x1c05('0x44')]({'where':{'name':_0x1df18b,'userProfileId':_0x3626c4[_0x1c05('0x4b')]},'raw':!![]})[_0x1c05('0x25')](function(_0x3be46e){if(_0x3be46e&&_0x3be46e[_0x1c05('0x4c')]===0x0){return db[_0x1c05('0x27')]['create']({'name':_0x10f511[_0x1c05('0x2a')],'resourceId':_0x10f511['id'],'type':_0x3be46e[_0x1c05('0x2a')],'sectionId':_0x3be46e['id']},{})[_0x1c05('0x25')](function(){return _0x4dc4fb;});}else{return _0x4dc4fb;}})[_0x1c05('0x41')](function(_0x164328){logger[_0x1c05('0x29')](_0x1c05('0x4d'),_0x164328);throw _0x164328;});}return _0x4dc4fb;})[_0x1c05('0x25')](respondWithResult(_0xfa3a5e,0xc9))[_0x1c05('0x41')](handleError(_0xfa3a5e,null));};exports[_0x1c05('0x24')]=function(_0x204d09,_0x23422c){if(_0x204d09[_0x1c05('0x46')]['id']){delete _0x204d09[_0x1c05('0x46')]['id'];}return db[_0x1c05('0x2c')][_0x1c05('0x44')]({'where':{'id':_0x204d09[_0x1c05('0x4e')]['id']}})['then'](handleEntityNotFound(_0x23422c,null))[_0x1c05('0x25')](saveUpdates(_0x204d09['body'],null))[_0x1c05('0x25')](respondWithResult(_0x23422c,null))[_0x1c05('0x41')](handleError(_0x23422c,null));};exports['destroy']=function(_0x4077d9,_0x45de8a){return db[_0x1c05('0x2c')][_0x1c05('0x44')]({'where':{'id':_0x4077d9[_0x1c05('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45de8a,null))[_0x1c05('0x25')](removeEntity(_0x45de8a,null))['catch'](handleError(_0x45de8a,null));}; \ No newline at end of file +var _0x4672=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','destroy','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x4672,0x18a));var _0x2467=function(_0x52835d,_0x47b9b3){_0x52835d=_0x52835d-0x0;var _0x5724c0=_0x4672[_0x52835d];return _0x5724c0;};'use strict';var pdf=require(_0x2467('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2467('0x1'));var zipdir=require(_0x2467('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2467('0x3'));var moment=require('moment');var BPromise=require(_0x2467('0x4'));var Mustache=require(_0x2467('0x5'));var util=require(_0x2467('0x6'));var path=require(_0x2467('0x7'));var sox=require('sox');var csv=require(_0x2467('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2467('0x9'));var squel=require(_0x2467('0xa'));var crypto=require(_0x2467('0xb'));var jsforce=require(_0x2467('0xc'));var deskjs=require(_0x2467('0xd'));var toCsv=require(_0x2467('0x8'));var querystring=require(_0x2467('0xe'));var Papa=require(_0x2467('0xf'));var Redis=require(_0x2467('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2467('0x11'));var as=require(_0x2467('0x12'));var hardwareService=require(_0x2467('0x13'));var logger=require(_0x2467('0x14'))('api');var utils=require(_0x2467('0x15'));var config=require(_0x2467('0x16'));var licenseUtil=require(_0x2467('0x17'));var db=require(_0x2467('0x18'))['db'];function respondWithStatusCode(_0x348f51,_0x381f99){_0x381f99=_0x381f99||0xcc;return function(_0x5ac925){if(_0x5ac925){return _0x348f51[_0x2467('0x19')](_0x381f99);}return _0x348f51[_0x2467('0x1a')](_0x381f99)[_0x2467('0x1b')]();};}function respondWithResult(_0xa9966d,_0x37df20){_0x37df20=_0x37df20||0xc8;return function(_0x265d7e){if(_0x265d7e){return _0xa9966d[_0x2467('0x1a')](_0x37df20)['json'](_0x265d7e);}};}function respondWithFilteredResult(_0x520ad9,_0x4eab72){return function(_0x2cab68){if(_0x2cab68){var _0xe72566=_0x2cab68[_0x2467('0x1c')],_0x239ef0=_0x4eab72['offset'],_0x593994=_0x4eab72[_0x2467('0x1d')]+_0x4eab72[_0x2467('0x1e')],_0x34a9f4;if(_0x593994>=_0xe72566){_0x593994=_0xe72566;_0x34a9f4=0xc8;}else{_0x34a9f4=0xce;}_0x520ad9[_0x2467('0x1a')](_0x34a9f4);return _0x520ad9[_0x2467('0x1f')](_0x2467('0x20'),_0x239ef0+'-'+_0x593994+'/'+_0xe72566)[_0x2467('0x21')](_0x2cab68);}return null;};}function patchUpdates(_0x1081e5){return function(_0x5ecb91){try{jsonpatch['apply'](_0x5ecb91,_0x1081e5,!![]);}catch(_0x3f32a8){return BPromise['reject'](_0x3f32a8);}return _0x5ecb91[_0x2467('0x22')]();};}function saveUpdates(_0xa16c1a,_0x50e555){return function(_0x51633c){if(_0x51633c){return _0x51633c[_0x2467('0x23')](_0xa16c1a)[_0x2467('0x24')](function(_0x5a2acc){return _0x5a2acc;});}return null;};}function removeEntity(_0x1217e0,_0x1ed72b){return function(_0xb35e27){if(_0xb35e27){return _0xb35e27[_0x2467('0x25')]()['then'](function(){var _0x2ebd45=_0xb35e27['get']({'plain':!![]});var _0x5e5621=_0x2467('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e5621,'resourceId':_0x2ebd45['id']}})['then'](function(){return _0xb35e27;});})[_0x2467('0x24')](function(){_0x1217e0[_0x2467('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb8f34f,_0x1f3126){return function(_0x2cd7a6){if(!_0x2cd7a6){_0xb8f34f[_0x2467('0x19')](0x194);}return _0x2cd7a6;};}function handleError(_0x18f045,_0x10e3cb){_0x10e3cb=_0x10e3cb||0x1f4;return function(_0x4aeb8b){logger[_0x2467('0x27')](_0x4aeb8b[_0x2467('0x28')]);if(_0x4aeb8b[_0x2467('0x29')]){delete _0x4aeb8b[_0x2467('0x29')];}_0x18f045[_0x2467('0x1a')](_0x10e3cb)[_0x2467('0x2a')](_0x4aeb8b);};}exports[_0x2467('0x2b')]=function(_0x42bc8e,_0x4da106){var _0xa793b2={},_0x1de49c={},_0x1dffa0={'count':0x0,'rows':[]};var _0x146562=_[_0x2467('0x2c')](db[_0x2467('0x2d')][_0x2467('0x2e')],function(_0x4d7632){return{'name':_0x4d7632[_0x2467('0x2f')],'type':_0x4d7632['type']['key']};});_0x1de49c[_0x2467('0x30')]=_['map'](_0x146562,'name');_0x1de49c['query']=_[_0x2467('0x31')](_0x42bc8e[_0x2467('0x32')]);_0x1de49c[_0x2467('0x33')]=_[_0x2467('0x34')](_0x1de49c['model'],_0x1de49c[_0x2467('0x32')]);_0xa793b2[_0x2467('0x35')]=_[_0x2467('0x34')](_0x1de49c['model'],qs[_0x2467('0x36')](_0x42bc8e['query']['fields']));_0xa793b2[_0x2467('0x35')]=_0xa793b2[_0x2467('0x35')][_0x2467('0x37')]?_0xa793b2[_0x2467('0x35')]:_0x1de49c[_0x2467('0x30')];if(!_0x42bc8e['query']['hasOwnProperty']('nolimit')){_0xa793b2[_0x2467('0x1e')]=qs[_0x2467('0x1e')](_0x42bc8e[_0x2467('0x32')][_0x2467('0x1e')]);_0xa793b2[_0x2467('0x1d')]=qs[_0x2467('0x1d')](_0x42bc8e[_0x2467('0x32')][_0x2467('0x1d')]);}_0xa793b2[_0x2467('0x38')]=qs['sort'](_0x42bc8e[_0x2467('0x32')][_0x2467('0x39')]);_0xa793b2[_0x2467('0x3a')]=qs[_0x2467('0x33')](_[_0x2467('0x3b')](_0x42bc8e[_0x2467('0x32')],_0x1de49c['filters']),_0x146562);if(_0x42bc8e['query'][_0x2467('0x3c')]){_0xa793b2[_0x2467('0x3a')]=_[_0x2467('0x3d')](_0xa793b2[_0x2467('0x3a')],{'$or':_[_0x2467('0x2c')](_0x146562,function(_0x5458e9){if(_0x5458e9[_0x2467('0x3e')]!=='VIRTUAL'){var _0x4ca1e6={};_0x4ca1e6[_0x5458e9[_0x2467('0x29')]]={'$like':'%'+_0x42bc8e[_0x2467('0x32')][_0x2467('0x3c')]+'%'};return _0x4ca1e6;}})});}_0xa793b2=_[_0x2467('0x3d')]({},_0xa793b2,_0x42bc8e[_0x2467('0x3f')]);var _0xb48c02={'where':_0xa793b2[_0x2467('0x3a')]};return db[_0x2467('0x2d')][_0x2467('0x1c')](_0xb48c02)['then'](function(_0x277ceb){_0x1dffa0['count']=_0x277ceb;if(_0x42bc8e['query'][_0x2467('0x40')]){_0xa793b2[_0x2467('0x41')]=[{'all':!![]}];}return db[_0x2467('0x2d')]['findAll'](_0xa793b2);})['then'](function(_0x5f5cb3){_0x1dffa0[_0x2467('0x42')]=_0x5f5cb3;return _0x1dffa0;})['then'](respondWithFilteredResult(_0x4da106,_0xa793b2))[_0x2467('0x43')](handleError(_0x4da106,null));};exports[_0x2467('0x44')]=function(_0x2f8b67,_0x2f39c8){var _0xcf9f24={'raw':!![],'where':{'id':_0x2f8b67[_0x2467('0x45')]['id']}},_0x175412={};_0x175412[_0x2467('0x30')]=_['keys'](db[_0x2467('0x2d')]['rawAttributes']);_0x175412[_0x2467('0x32')]=_[_0x2467('0x31')](_0x2f8b67['query']);_0x175412[_0x2467('0x33')]=_[_0x2467('0x34')](_0x175412['model'],_0x175412[_0x2467('0x32')]);_0xcf9f24['attributes']=_[_0x2467('0x34')](_0x175412['model'],qs['fields'](_0x2f8b67[_0x2467('0x32')][_0x2467('0x36')]));_0xcf9f24[_0x2467('0x35')]=_0xcf9f24[_0x2467('0x35')][_0x2467('0x37')]?_0xcf9f24[_0x2467('0x35')]:_0x175412[_0x2467('0x30')];if(_0x2f8b67[_0x2467('0x32')][_0x2467('0x40')]){_0xcf9f24[_0x2467('0x41')]=[{'all':!![]}];}_0xcf9f24=_[_0x2467('0x3d')]({},_0xcf9f24,_0x2f8b67[_0x2467('0x3f')]);return db['CmHopperAdditionalPhone']['find'](_0xcf9f24)[_0x2467('0x24')](handleEntityNotFound(_0x2f39c8,null))[_0x2467('0x24')](respondWithResult(_0x2f39c8,null))[_0x2467('0x43')](handleError(_0x2f39c8,null));};exports[_0x2467('0x46')]=function(_0x411a40,_0x41c64e){return db[_0x2467('0x2d')][_0x2467('0x46')](_0x411a40['body'],{})[_0x2467('0x24')](function(_0x42ca44){var _0x554011=_0x411a40[_0x2467('0x47')]['get']({'plain':!![]});if(!_0x554011)throw new Error(_0x2467('0x48'));if(_0x554011[_0x2467('0x49')]===_0x2467('0x47')){var _0x43a437=_0x42ca44[_0x2467('0x4a')]({'plain':!![]});var _0x2a9ca6=_0x2467('0x26');return db[_0x2467('0x4b')][_0x2467('0x4c')]({'where':{'name':_0x2a9ca6,'userProfileId':_0x554011[_0x2467('0x4d')]},'raw':!![]})[_0x2467('0x24')](function(_0x5d938f){if(_0x5d938f&&_0x5d938f[_0x2467('0x4e')]===0x0){return db[_0x2467('0x4f')][_0x2467('0x46')]({'name':_0x43a437['name'],'resourceId':_0x43a437['id'],'type':_0x5d938f[_0x2467('0x29')],'sectionId':_0x5d938f['id']},{})['then'](function(){return _0x42ca44;});}else{return _0x42ca44;}})['catch'](function(_0x5d43ed){logger[_0x2467('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d43ed);throw _0x5d43ed;});}return _0x42ca44;})[_0x2467('0x24')](respondWithResult(_0x41c64e,0xc9))['catch'](handleError(_0x41c64e,null));};exports['update']=function(_0x40c119,_0x36e32b){if(_0x40c119['body']['id']){delete _0x40c119[_0x2467('0x50')]['id'];}return db[_0x2467('0x2d')][_0x2467('0x4c')]({'where':{'id':_0x40c119['params']['id']}})[_0x2467('0x24')](handleEntityNotFound(_0x36e32b,null))[_0x2467('0x24')](saveUpdates(_0x40c119[_0x2467('0x50')],null))[_0x2467('0x24')](respondWithResult(_0x36e32b,null))['catch'](handleError(_0x36e32b,null));};exports[_0x2467('0x25')]=function(_0x3e849d,_0xd95419){return db['CmHopperAdditionalPhone'][_0x2467('0x4c')]({'where':{'id':_0x3e849d[_0x2467('0x45')]['id']}})[_0x2467('0x24')](handleEntityNotFound(_0xd95419,null))[_0x2467('0x24')](removeEntity(_0xd95419,null))[_0x2467('0x43')](handleError(_0xd95419,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 00c52dc..4cf8daa 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 _0x1f5f=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x83221c,_0x3975ef){var _0x2fa1fc=function(_0x26d691){while(--_0x26d691){_0x83221c['push'](_0x83221c['shift']());}};_0x2fa1fc(++_0x3975ef);}(_0x1f5f,0x194));var _0xf1f5=function(_0x3312ed,_0x3a7734){_0x3312ed=_0x3312ed-0x0;var _0x1844b5=_0x1f5f[_0x3312ed];return _0x1844b5;};'use strict';var _=require('lodash');var util=require(_0xf1f5('0x0'));var logger=require(_0xf1f5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf1f5('0x2'));var fs=require('fs');var path=require(_0xf1f5('0x3'));var rimraf=require(_0xf1f5('0x4'));var config=require(_0xf1f5('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf1f5('0x6')]=function(_0x3f8157,_0x699611){return _0x3f8157[_0xf1f5('0x7')](_0xf1f5('0x8'),attributes,{'tableName':_0xf1f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3dc=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x44678a,_0x46cb70){var _0x8a8bf8=function(_0x1dfdb6){while(--_0x1dfdb6){_0x44678a['push'](_0x44678a['shift']());}};_0x8a8bf8(++_0x46cb70);}(_0xe3dc,0x14c));var _0xce3d=function(_0x57a0a4,_0x5589c1){_0x57a0a4=_0x57a0a4-0x0;var _0x1b0ec5=_0xe3dc[_0x57a0a4];return _0x1b0ec5;};'use strict';var _=require(_0xce3d('0x0'));var util=require(_0xce3d('0x1'));var logger=require(_0xce3d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xce3d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce3d('0x4'));var config=require(_0xce3d('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xce3d('0x6')]=function(_0x8c7dd6,_0x15a8b7){return _0x8c7dd6[_0xce3d('0x7')](_0xce3d('0x8'),attributes,{'tableName':_0xce3d('0x9'),'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 95e0298..a71cf89 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 _0xe3d9=['phone','countbusyretry','countcongestionretry','createdAt','updatedAt','isNil','countnosuchnumberretry','additionalToHop','sequelize','update','IncrementPreviewCounters','field','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes'];(function(_0x135fe1,_0x36f285){var _0x29624d=function(_0x1ad7a4){while(--_0x1ad7a4){_0x135fe1['push'](_0x135fe1['shift']());}};_0x29624d(++_0x36f285);}(_0xe3d9,0x7e));var _0x9e3d=function(_0x208a7c,_0x266eda){_0x208a7c=_0x208a7c-0x0;var _0x2744e3=_0xe3d9[_0x208a7c];return _0x2744e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9e3d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e3d('0x1'));var db=require(_0x9e3d('0x2'))['db'];var utils=require(_0x9e3d('0x3'));var logger=require(_0x9e3d('0x4'))(_0x9e3d('0x5'));var config=require(_0x9e3d('0x6'));var jayson=require(_0x9e3d('0x7'));var client=jayson[_0x9e3d('0x8')][_0x9e3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b6ace,_0x4c9713,_0x42783c){return new BPromise(function(_0x38704c,_0x46cad1){return client[_0x9e3d('0xa')](_0x2b6ace,_0x42783c)[_0x9e3d('0xb')](function(_0x56ea3e){logger['info'](_0x9e3d('0xc'),_0x4c9713,_0x9e3d('0xd'));logger[_0x9e3d('0xe')](_0x9e3d('0xf'),_0x4c9713,_0x9e3d('0xd'),JSON['stringify'](_0x56ea3e));if(_0x56ea3e[_0x9e3d('0x10')]){if(_0x56ea3e[_0x9e3d('0x10')]['code']===0x1f4){logger['error'](_0x9e3d('0xc'),_0x4c9713,_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);return _0x46cad1(_0x56ea3e['error'][_0x9e3d('0x11')]);}logger[_0x9e3d('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4c9713,_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);return _0x38704c(_0x56ea3e[_0x9e3d('0x10')][_0x9e3d('0x11')]);}else{logger[_0x9e3d('0x12')](_0x9e3d('0xc'),_0x4c9713,_0x9e3d('0xd'));_0x38704c(_0x56ea3e[_0x9e3d('0x13')]['message']);}})[_0x9e3d('0x14')](function(_0x1a1870){logger[_0x9e3d('0x10')](_0x9e3d('0xc'),_0x4c9713,_0x1a1870);_0x46cad1(_0x1a1870);});});}exports[_0x9e3d('0x15')]=function(_0x1e4f6e){var _0x493f66=this;return new Promise(function(_0x287319,_0x5b5761){return db[_0x9e3d('0x16')][_0x9e3d('0x17')]({'raw':!![],'where':{'ContactId':_0x1e4f6e['body'][_0x9e3d('0x18')],'ListId':_0x1e4f6e[_0x9e3d('0x19')]['ListId'],'VoiceQueueId':_0x1e4f6e['body'][_0x9e3d('0x1a')]===undefined?null:_0x1e4f6e[_0x9e3d('0x19')][_0x9e3d('0x1a')],'CampaignId':_0x1e4f6e[_0x9e3d('0x19')]['CampaignId']===undefined?null:_0x1e4f6e[_0x9e3d('0x19')][_0x9e3d('0x1b')]}})[_0x9e3d('0xb')](function(_0x173751){if(_0x173751!=null){return db[_0x9e3d('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x173751['id'],'OrderBy':{'$gt':_0x173751['OrderBy']}},'order':[[_0x9e3d('0x1d'),_0x9e3d('0x1e')]]})[_0x9e3d('0xb')](function(_0x4fef6c){var _0x534827=0x0;if(_0x4fef6c){if(_0x4fef6c['countbusyretry']+_0x4fef6c['countcongestionretry']+_0x4fef6c[_0x9e3d('0x1f')]+_0x4fef6c['countnosuchnumberretry']+_0x4fef6c[_0x9e3d('0x20')]+_0x4fef6c[_0x9e3d('0x21')]+_0x4fef6c[_0x9e3d('0x22')]+_0x4fef6c[_0x9e3d('0x23')]<_0x1e4f6e[_0x9e3d('0x24')]['dialGlobalMaxRetry'])_0x534827=0x1;_0x287319({'additional':_0x534827});}else{return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x173751['id']},'order':[[_0x9e3d('0x1d'),'ASC']]})[_0x9e3d('0xb')](function(_0x5afbed){var _0x162046=0x0;if(_0x5afbed){if(_0x5afbed['countbusyretry']+_0x5afbed['countcongestionretry']+_0x5afbed['countnoanswerretry']+_0x5afbed['countnosuchnumberretry']+_0x5afbed['countdropretry']+_0x5afbed['countabandonedretry']+_0x5afbed[_0x9e3d('0x22')]+_0x5afbed[_0x9e3d('0x23')]<_0x1e4f6e[_0x9e3d('0x24')][_0x9e3d('0x25')])_0x162046=0x1;_0x287319({'additional':_0x162046});}else{_0x287319({'additional':0x0});}})[_0x9e3d('0x14')](function(_0x924625){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x924625[_0x9e3d('0x11')],_0x1e4f6e);_0x5b5761(_0x493f66[_0x9e3d('0x10')](0x1f4,_0x924625[_0x9e3d('0x11')]));});}})[_0x9e3d('0x14')](function(_0x3aacd5){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x3aacd5['message'],_0x1e4f6e);_0x5b5761(_0x493f66[_0x9e3d('0x10')](0x1f4,_0x3aacd5[_0x9e3d('0x11')]));});}else _0x287319({'additional':0x0});});});};exports[_0x9e3d('0x26')]=function(_0xfecdd0){var _0x1569c2=this;return new Promise(function(_0x357d5d,_0x3e9dd2){return db[_0x9e3d('0x16')][_0x9e3d('0x17')]({'raw':!![],'where':{'ContactId':_0xfecdd0['body'][_0x9e3d('0x18')],'ListId':_0xfecdd0['body'][_0x9e3d('0x27')],'VoiceQueueId':_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1a')]===undefined?null:_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1a')],'CampaignId':_0xfecdd0[_0x9e3d('0x19')][_0x9e3d('0x1b')]===undefined?null:_0xfecdd0[_0x9e3d('0x19')]['CampaignId']}})[_0x9e3d('0xb')](function(_0x5c02d6){if(_0x5c02d6!=null){return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5c02d6['id'],'OrderBy':{'$gt':_0x5c02d6[_0x9e3d('0x1d')]}},'order':[['OrderBy','ASC']]})[_0x9e3d('0xb')](function(_0x211129){if(_0x211129)return activateAdditionalPhone(_0x5c02d6,_0xfecdd0['body'],_0x211129,_0xfecdd0[_0x9e3d('0x28')],_0xfecdd0[_0x9e3d('0x29')])[_0x9e3d('0xb')](function(_0x2e4339){_0x357d5d(_0x2e4339);});else{return db[_0x9e3d('0x1c')][_0x9e3d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5c02d6['id']},'order':[[_0x9e3d('0x1d'),_0x9e3d('0x1e')]]})[_0x9e3d('0xb')](function(_0x47605a){if(_0x47605a)return activateAdditionalPhone(_0x5c02d6,_0xfecdd0[_0x9e3d('0x19')],_0x47605a,_0xfecdd0[_0x9e3d('0x28')],_0xfecdd0[_0x9e3d('0x29')])['then'](function(_0x137e7b){_0x357d5d(_0x137e7b);});else{_0x357d5d({'id':_0x5c02d6['id'],'phone':''});}})[_0x9e3d('0x14')](function(_0x587beb){logger[_0x9e3d('0x10')]('VerifyAdditionalPhones',_0x587beb[_0x9e3d('0x11')],_0xfecdd0);_0x3e9dd2(_0x1569c2[_0x9e3d('0x10')](0x1f4,_0x587beb[_0x9e3d('0x11')]));});}})[_0x9e3d('0x14')](function(_0x3bbca2){logger[_0x9e3d('0x10')](_0x9e3d('0x15'),_0x3bbca2['message'],_0xfecdd0);_0x3e9dd2(_0x1569c2[_0x9e3d('0x10')](0x1f4,_0x3bbca2[_0x9e3d('0x11')]));});}else _0x357d5d(0x1);});});};function activateAdditionalPhone(_0x496d7f,_0x45da29,_0x2ebef8,_0x1590a6,_0x1df9e6){return new Promise(function(_0x1daf91,_0xf6234c){logger[_0x9e3d('0x12')](_0x9e3d('0x15'),_0x2ebef8);var _0x40412e;if(moment()>moment(_0x2ebef8[_0x9e3d('0x2a')])){_0x40412e=moment()[_0x9e3d('0x2b')](_0x1df9e6||0x3,_0x9e3d('0x2c'));}else{if(_0x2ebef8[_0x9e3d('0x1d')]==0x0){_0x40412e=moment(_0x2ebef8[_0x9e3d('0x2a')]);}else{_0x40412e=moment()[_0x9e3d('0x2b')](_0x1df9e6||0x3,_0x9e3d('0x2c'));}}var _0x4fd0db={'phone':_0x496d7f[_0x9e3d('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x496d7f[_0x9e3d('0x1d')])?0x0:_0x496d7f['OrderBy'],'scheduledat':moment()[_0x9e3d('0x2b')](_0x1590a6||0x1,_0x9e3d('0x2c')),'countbusyretry':_0x45da29[_0x9e3d('0x2e')],'countcongestionretry':_0x45da29[_0x9e3d('0x2f')],'countnoanswerretry':_0x45da29[_0x9e3d('0x1f')],'countnosuchnumberretry':_0x45da29['countnosuchnumberretry'],'countdropretry':_0x45da29[_0x9e3d('0x20')],'countabandonedretry':_0x45da29['countabandonedretry'],'countmachineretry':_0x45da29['countmachineretry'],'countagentrejectretry':_0x45da29['countagentrejectretry'],'createdAt':_0x45da29[_0x9e3d('0x30')],'updatedAt':_0x45da29[_0x9e3d('0x31')]};var _0x2db644={'CmHopperId':_0x496d7f['id'],'phone':_0x2ebef8[_0x9e3d('0x2d')],'active':0x0,'OrderBy':_[_0x9e3d('0x32')](_0x2ebef8[_0x9e3d('0x1d')])?0x0:_0x2ebef8[_0x9e3d('0x1d')],'scheduledat':_0x40412e,'countbusyretry':_0x2ebef8[_0x9e3d('0x2e')],'countcongestionretry':_0x2ebef8[_0x9e3d('0x2f')],'countnoanswerretry':_0x2ebef8[_0x9e3d('0x1f')],'countnosuchnumberretry':_0x45da29[_0x9e3d('0x33')],'countdropretry':_0x45da29[_0x9e3d('0x20')],'countabandonedretry':_0x45da29[_0x9e3d('0x21')],'countmachineretry':_0x45da29['countmachineretry'],'countagentrejectretry':_0x45da29['countagentrejectretry'],'createdAt':_0x2ebef8[_0x9e3d('0x30')],'updatedAt':_0x2ebef8['updatedAt']};logger['info']('hopperToAdd',_0x4fd0db);logger['info'](_0x9e3d('0x34'),_0x2db644);return db[_0x9e3d('0x35')]['transaction'](function(_0x5dc89d){return db[_0x9e3d('0x1c')][_0x9e3d('0x36')](_0x4fd0db,{'where':{'id':_0x2ebef8['id']}},{'transaction':_0x5dc89d})['then'](function(){return db[_0x9e3d('0x16')]['update'](_0x2db644,{'where':{'id':_0x496d7f['id']}},{'transaction':_0x5dc89d});});})['then'](function(_0x3b0a6c){_0x1daf91({'id':_0x496d7f['id'],'phone':_0x2ebef8[_0x9e3d('0x2d')]});})[_0x9e3d('0x14')](function(_0x40931f){logger['error'](_0x9e3d('0x15'),_0x40931f[_0x9e3d('0x11')],req);_0xf6234c(_this[_0x9e3d('0x10')](0x1f4,_0x40931f[_0x9e3d('0x11')]));});});}exports[_0x9e3d('0x37')]=function(_0x51bf36){var _0x5a1ff9=this;return new Promise(function(_0x2fd381,_0x233181){return db[_0x9e3d('0x16')]['update'](_0x51bf36[_0x9e3d('0x19')][_0x9e3d('0x38')],{'where':{'id':_0x51bf36[_0x9e3d('0x19')]['id']}})['then'](function(_0x1a4e97){_0x2fd381(_0x1a4e97);})['catch'](function(_0x300591){logger[_0x9e3d('0x10')](_0x9e3d('0x37'),_0x300591[_0x9e3d('0x11')],_0x51bf36);_0x233181(_0x5a1ff9[_0x9e3d('0x10')](0x1f4,_0x300591[_0x9e3d('0x11')]));});});}; \ No newline at end of file +var _0xeafd=['IncrementPreviewCounters','field','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countabandonedretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','countcongestionretry','createdAt','updatedAt','hopperToAdd','additionalToHop','transaction','update'];(function(_0x2f13c3,_0x427892){var _0x218c3a=function(_0x490033){while(--_0x490033){_0x2f13c3['push'](_0x2f13c3['shift']());}};_0x218c3a(++_0x427892);}(_0xeafd,0x76));var _0xdeaf=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xeafd[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0xdeaf('0x0'));var util=require(_0xdeaf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeaf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeaf('0x3'));var logger=require(_0xdeaf('0x4'))(_0xdeaf('0x5'));var config=require(_0xdeaf('0x6'));var jayson=require(_0xdeaf('0x7'));var client=jayson[_0xdeaf('0x8')][_0xdeaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593a74,_0x46bab3,_0x426134){return new BPromise(function(_0x12e3c5,_0x438399){return client['request'](_0x593a74,_0x426134)[_0xdeaf('0xa')](function(_0x597e49){logger['info'](_0xdeaf('0xb'),_0x46bab3,'request\x20sent');logger[_0xdeaf('0xc')](_0xdeaf('0xd'),_0x46bab3,'request\x20sent',JSON[_0xdeaf('0xe')](_0x597e49));if(_0x597e49[_0xdeaf('0xf')]){if(_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x10')]===0x1f4){logger['error'](_0xdeaf('0xb'),_0x46bab3,_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);return _0x438399(_0x597e49[_0xdeaf('0xf')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x46bab3,_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);return _0x12e3c5(_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);}else{logger[_0xdeaf('0x12')](_0xdeaf('0xb'),_0x46bab3,_0xdeaf('0x13'));_0x12e3c5(_0x597e49['result'][_0xdeaf('0x11')]);}})[_0xdeaf('0x14')](function(_0xa25837){logger['error'](_0xdeaf('0xb'),_0x46bab3,_0xa25837);_0x438399(_0xa25837);});});}exports[_0xdeaf('0x15')]=function(_0xcdfc78){var _0x2273d9=this;return new Promise(function(_0x5a31d0,_0x8b07fb){return db[_0xdeaf('0x16')][_0xdeaf('0x17')]({'raw':!![],'where':{'ContactId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x19')],'ListId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x1a')],'VoiceQueueId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x1b')]===undefined?null:_0xcdfc78[_0xdeaf('0x18')]['VoiceQueueId'],'CampaignId':_0xcdfc78[_0xdeaf('0x18')]['CampaignId']===undefined?null:_0xcdfc78['body'][_0xdeaf('0x1c')]}})[_0xdeaf('0xa')](function(_0x4ec267){if(_0x4ec267!=null){return db[_0xdeaf('0x1d')][_0xdeaf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4ec267['id'],'OrderBy':{'$gt':_0x4ec267['OrderBy']}},'order':[[_0xdeaf('0x1e'),'ASC']]})[_0xdeaf('0xa')](function(_0x3f810f){var _0x5a862a=0x0;if(_0x3f810f){if(_0x3f810f[_0xdeaf('0x1f')]+_0x3f810f['countcongestionretry']+_0x3f810f[_0xdeaf('0x20')]+_0x3f810f[_0xdeaf('0x21')]+_0x3f810f[_0xdeaf('0x22')]+_0x3f810f['countabandonedretry']+_0x3f810f[_0xdeaf('0x23')]+_0x3f810f[_0xdeaf('0x24')]<_0xcdfc78[_0xdeaf('0x25')][_0xdeaf('0x26')])_0x5a862a=0x1;_0x5a31d0({'additional':_0x5a862a});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4ec267['id']},'order':[['OrderBy',_0xdeaf('0x27')]]})[_0xdeaf('0xa')](function(_0x46b3ce){var _0x5f42dc=0x0;if(_0x46b3ce){if(_0x46b3ce['countbusyretry']+_0x46b3ce['countcongestionretry']+_0x46b3ce[_0xdeaf('0x20')]+_0x46b3ce[_0xdeaf('0x21')]+_0x46b3ce['countdropretry']+_0x46b3ce[_0xdeaf('0x28')]+_0x46b3ce[_0xdeaf('0x23')]+_0x46b3ce[_0xdeaf('0x24')]<_0xcdfc78[_0xdeaf('0x25')][_0xdeaf('0x26')])_0x5f42dc=0x1;_0x5a31d0({'additional':_0x5f42dc});}else{_0x5a31d0({'additional':0x0});}})[_0xdeaf('0x14')](function(_0x461de0){logger[_0xdeaf('0xf')](_0xdeaf('0x15'),_0x461de0['message'],_0xcdfc78);_0x8b07fb(_0x2273d9['error'](0x1f4,_0x461de0['message']));});}})[_0xdeaf('0x14')](function(_0x181a8d){logger['error'](_0xdeaf('0x15'),_0x181a8d[_0xdeaf('0x11')],_0xcdfc78);_0x8b07fb(_0x2273d9[_0xdeaf('0xf')](0x1f4,_0x181a8d[_0xdeaf('0x11')]));});}else _0x5a31d0({'additional':0x0});});});};exports[_0xdeaf('0x29')]=function(_0x2f7d3e){var _0xee06e5=this;return new Promise(function(_0xc468e,_0x230d97){return db['CmHopper'][_0xdeaf('0x17')]({'raw':!![],'where':{'ContactId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x19')],'ListId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1a')],'VoiceQueueId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1b')]===undefined?null:_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1b')],'CampaignId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1c')]===undefined?null:_0x2f7d3e['body'][_0xdeaf('0x1c')]}})[_0xdeaf('0xa')](function(_0x3fbf09){if(_0x3fbf09!=null){return db['CmHopperAdditionalPhone'][_0xdeaf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fbf09['id'],'OrderBy':{'$gt':_0x3fbf09[_0xdeaf('0x1e')]}},'order':[[_0xdeaf('0x1e'),_0xdeaf('0x27')]]})[_0xdeaf('0xa')](function(_0xa19bf3){if(_0xa19bf3)return activateAdditionalPhone(_0x3fbf09,_0x2f7d3e[_0xdeaf('0x18')],_0xa19bf3,_0x2f7d3e[_0xdeaf('0x2a')],_0x2f7d3e[_0xdeaf('0x2b')])['then'](function(_0x13926c){_0xc468e(_0x13926c);});else{return db[_0xdeaf('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3fbf09['id']},'order':[[_0xdeaf('0x1e'),'ASC']]})['then'](function(_0x54c778){if(_0x54c778)return activateAdditionalPhone(_0x3fbf09,_0x2f7d3e[_0xdeaf('0x18')],_0x54c778,_0x2f7d3e[_0xdeaf('0x2a')],_0x2f7d3e[_0xdeaf('0x2b')])[_0xdeaf('0xa')](function(_0x46e66a){_0xc468e(_0x46e66a);});else{_0xc468e({'id':_0x3fbf09['id'],'phone':''});}})[_0xdeaf('0x14')](function(_0x4aeff9){logger['error'](_0xdeaf('0x15'),_0x4aeff9[_0xdeaf('0x11')],_0x2f7d3e);_0x230d97(_0xee06e5['error'](0x1f4,_0x4aeff9['message']));});}})[_0xdeaf('0x14')](function(_0x505198){logger['error'](_0xdeaf('0x15'),_0x505198[_0xdeaf('0x11')],_0x2f7d3e);_0x230d97(_0xee06e5['error'](0x1f4,_0x505198[_0xdeaf('0x11')]));});}else _0xc468e(0x1);});});};function activateAdditionalPhone(_0x423849,_0x39209f,_0x59f80e,_0x15c45e,_0x20288e){return new Promise(function(_0x3276c9,_0x30266a){logger[_0xdeaf('0x12')](_0xdeaf('0x15'),_0x59f80e);var _0x37f36a;if(moment()>moment(_0x59f80e[_0xdeaf('0x2c')])){_0x37f36a=moment()[_0xdeaf('0x2d')](_0x20288e||0x3,_0xdeaf('0x2e'));}else{if(_0x59f80e[_0xdeaf('0x1e')]==0x0){_0x37f36a=moment(_0x59f80e[_0xdeaf('0x2c')]);}else{_0x37f36a=moment()[_0xdeaf('0x2d')](_0x20288e||0x3,'minutes');}}var _0x17de1c={'phone':_0x423849[_0xdeaf('0x2f')],'active':0x0,'OrderBy':_[_0xdeaf('0x30')](_0x423849['OrderBy'])?0x0:_0x423849['OrderBy'],'scheduledat':moment()[_0xdeaf('0x2d')](_0x15c45e||0x1,_0xdeaf('0x2e')),'countbusyretry':_0x39209f['countbusyretry'],'countcongestionretry':_0x39209f[_0xdeaf('0x31')],'countnoanswerretry':_0x39209f[_0xdeaf('0x20')],'countnosuchnumberretry':_0x39209f[_0xdeaf('0x21')],'countdropretry':_0x39209f[_0xdeaf('0x22')],'countabandonedretry':_0x39209f['countabandonedretry'],'countmachineretry':_0x39209f[_0xdeaf('0x23')],'countagentrejectretry':_0x39209f[_0xdeaf('0x24')],'createdAt':_0x39209f[_0xdeaf('0x32')],'updatedAt':_0x39209f['updatedAt']};var _0x45a89a={'CmHopperId':_0x423849['id'],'phone':_0x59f80e[_0xdeaf('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x59f80e[_0xdeaf('0x1e')])?0x0:_0x59f80e[_0xdeaf('0x1e')],'scheduledat':_0x37f36a,'countbusyretry':_0x59f80e['countbusyretry'],'countcongestionretry':_0x59f80e[_0xdeaf('0x31')],'countnoanswerretry':_0x59f80e['countnoanswerretry'],'countnosuchnumberretry':_0x39209f[_0xdeaf('0x21')],'countdropretry':_0x39209f[_0xdeaf('0x22')],'countabandonedretry':_0x39209f['countabandonedretry'],'countmachineretry':_0x39209f[_0xdeaf('0x23')],'countagentrejectretry':_0x39209f[_0xdeaf('0x24')],'createdAt':_0x59f80e[_0xdeaf('0x32')],'updatedAt':_0x59f80e[_0xdeaf('0x33')]};logger[_0xdeaf('0x12')](_0xdeaf('0x34'),_0x17de1c);logger[_0xdeaf('0x12')](_0xdeaf('0x35'),_0x45a89a);return db['sequelize'][_0xdeaf('0x36')](function(_0x561e60){return db[_0xdeaf('0x1d')][_0xdeaf('0x37')](_0x17de1c,{'where':{'id':_0x59f80e['id']}},{'transaction':_0x561e60})[_0xdeaf('0xa')](function(){return db[_0xdeaf('0x16')][_0xdeaf('0x37')](_0x45a89a,{'where':{'id':_0x423849['id']}},{'transaction':_0x561e60});});})[_0xdeaf('0xa')](function(_0x254b84){_0x3276c9({'id':_0x423849['id'],'phone':_0x59f80e[_0xdeaf('0x2f')]});})[_0xdeaf('0x14')](function(_0x424324){logger[_0xdeaf('0xf')](_0xdeaf('0x15'),_0x424324['message'],req);_0x30266a(_this[_0xdeaf('0xf')](0x1f4,_0x424324[_0xdeaf('0x11')]));});});}exports[_0xdeaf('0x38')]=function(_0x1b3f3c){var _0x1d6077=this;return new Promise(function(_0x1cba7d,_0x1ec348){return db[_0xdeaf('0x16')]['update'](_0x1b3f3c[_0xdeaf('0x18')][_0xdeaf('0x39')],{'where':{'id':_0x1b3f3c[_0xdeaf('0x18')]['id']}})['then'](function(_0x3dbbe8){_0x1cba7d(_0x3dbbe8);})[_0xdeaf('0x14')](function(_0x14ecf3){logger[_0xdeaf('0xf')](_0xdeaf('0x38'),_0x14ecf3['message'],_0x1b3f3c);_0x1ec348(_0x1d6077[_0xdeaf('0xf')](0x1f4,_0x14ecf3[_0xdeaf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4d4def1..6c52d87 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 _0x523a=['connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','util'];(function(_0x28acd0,_0x387a42){var _0x848823=function(_0x29a00d){while(--_0x29a00d){_0x28acd0['push'](_0x28acd0['shift']());}};_0x848823(++_0x387a42);}(_0x523a,0x1bf));var _0xa523=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x523a[_0xbeb808];return _0x5d6909;};'use strict';var multer=require('multer');var util=require(_0xa523('0x0'));var path=require('path');var timeout=require(_0xa523('0x1'));var express=require(_0xa523('0x2'));var router=express['Router']();var auth=require(_0xa523('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa523('0x4'));var controller=require(_0xa523('0x5'));router[_0xa523('0x6')]('/',auth['isAuthenticated'](),controller[_0xa523('0x7')]);router[_0xa523('0x6')](_0xa523('0x8'),auth[_0xa523('0x9')](),controller[_0xa523('0xa')]);router[_0xa523('0xb')]('/',auth[_0xa523('0x9')](),controller[_0xa523('0xc')]);router[_0xa523('0xd')](_0xa523('0x8'),auth[_0xa523('0x9')](),controller[_0xa523('0xe')]);router['delete'](_0xa523('0x8'),auth[_0xa523('0x9')](),controller['destroy']);module[_0xa523('0xf')]=router; \ No newline at end of file +var _0x5b5f=['get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5b5f,0x1a7));var _0xf5b5=function(_0x36e8e4,_0x213a61){_0x36e8e4=_0x36e8e4-0x0;var _0x491ac7=_0x5b5f[_0x36e8e4];return _0x491ac7;};'use strict';var multer=require(_0xf5b5('0x0'));var util=require(_0xf5b5('0x1'));var path=require(_0xf5b5('0x2'));var timeout=require(_0xf5b5('0x3'));var express=require('express');var router=express[_0xf5b5('0x4')]();var auth=require(_0xf5b5('0x5'));var interaction=require(_0xf5b5('0x6'));var config=require(_0xf5b5('0x7'));var controller=require(_0xf5b5('0x8'));router[_0xf5b5('0x9')]('/',auth[_0xf5b5('0xa')](),controller['index']);router['get'](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xc')]);router[_0xf5b5('0xd')]('/',auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xe')]);router['put'](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xf')]);router[_0xf5b5('0x10')](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller['destroy']);module[_0xf5b5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index e99e7c2..f23bf9e 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 _0x3309=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3309,0x1e6));var _0x9330=function(_0x3a38f7,_0x2b700e){_0x3a38f7=_0x3a38f7-0x0;var _0x5a0eb3=_0x3309[_0x3a38f7];return _0x5a0eb3;};'use strict';var moment=require('moment');var Sequelize=require(_0x9330('0x0'));module[_0x9330('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9330('0x2')],'unique':_0x9330('0x3')},'ListId':{'type':Sequelize[_0x9330('0x2')],'unique':_0x9330('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9330('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xb633=['exports','STRING','INTEGER','contactListQueue'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xb633,0xb0));var _0x3b63=function(_0x16c4ef,_0x22724c){_0x16c4ef=_0x16c4ef-0x0;var _0x26a684=_0xb633[_0x16c4ef];return _0x26a684;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3b63('0x0')]={'phone':{'type':Sequelize[_0x3b63('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')},'ListId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8c607d0..5a6db49 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 _0xc814=['filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','CmHopperBlack','find','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','apply','reject','update','then','error','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc814,0xa4));var _0x4c81=function(_0x22cdea,_0x3defc0){_0x22cdea=_0x22cdea-0x0;var _0x4cde30=_0xc814[_0x22cdea];return _0x4cde30;};'use strict';var pdf=require(_0x4c81('0x0'));var emlformat=require(_0x4c81('0x1'));var rimraf=require(_0x4c81('0x2'));var zipdir=require(_0x4c81('0x3'));var jsonpatch=require(_0x4c81('0x4'));var rp=require('request-promise');var moment=require(_0x4c81('0x5'));var BPromise=require(_0x4c81('0x6'));var Mustache=require(_0x4c81('0x7'));var util=require(_0x4c81('0x8'));var path=require(_0x4c81('0x9'));var sox=require('sox');var csv=require(_0x4c81('0xa'));var ejs=require(_0x4c81('0xb'));var fs=require('fs');var _=require(_0x4c81('0xc'));var squel=require(_0x4c81('0xd'));var crypto=require(_0x4c81('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c81('0xf'));var toCsv=require(_0x4c81('0xa'));var querystring=require(_0x4c81('0x10'));var Papa=require(_0x4c81('0x11'));var Redis=require(_0x4c81('0x12'));var authService=require(_0x4c81('0x13'));var qs=require(_0x4c81('0x14'));var as=require(_0x4c81('0x15'));var hardwareService=require(_0x4c81('0x16'));var logger=require(_0x4c81('0x17'))('api');var utils=require(_0x4c81('0x18'));var config=require(_0x4c81('0x19'));var licenseUtil=require(_0x4c81('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429523,_0x6e6fde){_0x6e6fde=_0x6e6fde||0xcc;return function(_0x18b344){if(_0x18b344){return _0x429523[_0x4c81('0x1b')](_0x6e6fde);}return _0x429523[_0x4c81('0x1c')](_0x6e6fde)[_0x4c81('0x1d')]();};}function respondWithResult(_0xb83468,_0x36a5ca){_0x36a5ca=_0x36a5ca||0xc8;return function(_0x132b23){if(_0x132b23){return _0xb83468[_0x4c81('0x1c')](_0x36a5ca)[_0x4c81('0x1e')](_0x132b23);}};}function respondWithFilteredResult(_0x5ca51d,_0x527cb7){return function(_0x5dfb65){if(_0x5dfb65){var _0xd73b9e=_0x5dfb65['count'],_0xef89dc=_0x527cb7[_0x4c81('0x1f')],_0x323e92=_0x527cb7[_0x4c81('0x1f')]+_0x527cb7['limit'],_0x2f9259;if(_0x323e92>=_0xd73b9e){_0x323e92=_0xd73b9e;_0x2f9259=0xc8;}else{_0x2f9259=0xce;}_0x5ca51d['status'](_0x2f9259);return _0x5ca51d['set']('Content-Range',_0xef89dc+'-'+_0x323e92+'/'+_0xd73b9e)[_0x4c81('0x1e')](_0x5dfb65);}return null;};}function patchUpdates(_0x247684){return function(_0x733611){try{jsonpatch[_0x4c81('0x20')](_0x733611,_0x247684,!![]);}catch(_0x5aa138){return BPromise[_0x4c81('0x21')](_0x5aa138);}return _0x733611['save']();};}function saveUpdates(_0x4aa890,_0x3efdbb){return function(_0x41e7eb){if(_0x41e7eb){return _0x41e7eb[_0x4c81('0x22')](_0x4aa890)[_0x4c81('0x23')](function(_0x39c5ee){return _0x39c5ee;});}return null;};}function removeEntity(_0x23a8b9,_0x3b7c62){return function(_0x2a81f3){if(_0x2a81f3){return _0x2a81f3['destroy']()[_0x4c81('0x23')](function(){_0x23a8b9[_0x4c81('0x1c')](0xcc)[_0x4c81('0x1d')]();});}};}function handleEntityNotFound(_0x3dd8d2,_0x52bc3f){return function(_0x4077a8){if(!_0x4077a8){_0x3dd8d2[_0x4c81('0x1b')](0x194);}return _0x4077a8;};}function handleError(_0x4380c3,_0x18429e){_0x18429e=_0x18429e||0x1f4;return function(_0x14e6ab){logger[_0x4c81('0x24')](_0x14e6ab[_0x4c81('0x25')]);if(_0x14e6ab[_0x4c81('0x26')]){delete _0x14e6ab[_0x4c81('0x26')];}_0x4380c3[_0x4c81('0x1c')](_0x18429e)[_0x4c81('0x27')](_0x14e6ab);};}exports['index']=function(_0x3fab7c,_0x55a7bd){var _0x131462={},_0x5a54bc={},_0x3912af={'count':0x0,'rows':[]};var _0x4027d4=_['map'](db['CmHopperBlack'][_0x4c81('0x28')],function(_0x409d0e){return{'name':_0x409d0e[_0x4c81('0x29')],'type':_0x409d0e['type'][_0x4c81('0x2a')]};});_0x5a54bc['model']=_[_0x4c81('0x2b')](_0x4027d4,_0x4c81('0x26'));_0x5a54bc[_0x4c81('0x2c')]=_[_0x4c81('0x2d')](_0x3fab7c['query']);_0x5a54bc[_0x4c81('0x2e')]=_[_0x4c81('0x2f')](_0x5a54bc['model'],_0x5a54bc['query']);_0x131462[_0x4c81('0x30')]=_['intersection'](_0x5a54bc[_0x4c81('0x31')],qs[_0x4c81('0x32')](_0x3fab7c['query']['fields']));_0x131462[_0x4c81('0x30')]=_0x131462[_0x4c81('0x30')][_0x4c81('0x33')]?_0x131462[_0x4c81('0x30')]:_0x5a54bc[_0x4c81('0x31')];if(!_0x3fab7c['query'][_0x4c81('0x34')](_0x4c81('0x35'))){_0x131462[_0x4c81('0x36')]=qs[_0x4c81('0x36')](_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x36')]);_0x131462['offset']=qs[_0x4c81('0x1f')](_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x1f')]);}_0x131462['order']=qs[_0x4c81('0x37')](_0x3fab7c['query'][_0x4c81('0x37')]);_0x131462[_0x4c81('0x38')]=qs[_0x4c81('0x2e')](_[_0x4c81('0x39')](_0x3fab7c[_0x4c81('0x2c')],_0x5a54bc[_0x4c81('0x2e')]),_0x4027d4);if(_0x3fab7c['query'][_0x4c81('0x3a')]){_0x131462['where']=_[_0x4c81('0x3b')](_0x131462[_0x4c81('0x38')],{'$or':_[_0x4c81('0x2b')](_0x4027d4,function(_0x5eb3dd){if(_0x5eb3dd['type']!==_0x4c81('0x3c')){var _0x35a950={};_0x35a950[_0x5eb3dd[_0x4c81('0x26')]]={'$like':'%'+_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x3a')]+'%'};return _0x35a950;}})});}_0x131462=_[_0x4c81('0x3b')]({},_0x131462,_0x3fab7c[_0x4c81('0x3d')]);var _0xb560c1={'where':_0x131462[_0x4c81('0x38')]};return db['CmHopperBlack'][_0x4c81('0x3e')](_0xb560c1)[_0x4c81('0x23')](function(_0x4a3fe8){_0x3912af[_0x4c81('0x3e')]=_0x4a3fe8;if(_0x3fab7c[_0x4c81('0x2c')][_0x4c81('0x3f')]){_0x131462[_0x4c81('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4c81('0x41')](_0x131462);})[_0x4c81('0x23')](function(_0xa1e0cb){_0x3912af[_0x4c81('0x42')]=_0xa1e0cb;return _0x3912af;})[_0x4c81('0x23')](respondWithFilteredResult(_0x55a7bd,_0x131462))['catch'](handleError(_0x55a7bd,null));};exports[_0x4c81('0x43')]=function(_0x6805c8,_0x5e4098){var _0x2469c4={'raw':!![],'where':{'id':_0x6805c8[_0x4c81('0x44')]['id']}},_0x56963f={};_0x56963f[_0x4c81('0x31')]=_['keys'](db[_0x4c81('0x45')][_0x4c81('0x28')]);_0x56963f['query']=_[_0x4c81('0x2d')](_0x6805c8['query']);_0x56963f[_0x4c81('0x2e')]=_[_0x4c81('0x2f')](_0x56963f[_0x4c81('0x31')],_0x56963f[_0x4c81('0x2c')]);_0x2469c4['attributes']=_[_0x4c81('0x2f')](_0x56963f[_0x4c81('0x31')],qs[_0x4c81('0x32')](_0x6805c8['query'][_0x4c81('0x32')]));_0x2469c4[_0x4c81('0x30')]=_0x2469c4[_0x4c81('0x30')][_0x4c81('0x33')]?_0x2469c4['attributes']:_0x56963f[_0x4c81('0x31')];if(_0x6805c8[_0x4c81('0x2c')][_0x4c81('0x3f')]){_0x2469c4[_0x4c81('0x40')]=[{'all':!![]}];}_0x2469c4=_['merge']({},_0x2469c4,_0x6805c8['options']);return db[_0x4c81('0x45')][_0x4c81('0x46')](_0x2469c4)['then'](handleEntityNotFound(_0x5e4098,null))[_0x4c81('0x23')](respondWithResult(_0x5e4098,null))[_0x4c81('0x47')](handleError(_0x5e4098,null));};exports[_0x4c81('0x22')]=function(_0x37bc27,_0x585adb){if(_0x37bc27[_0x4c81('0x48')]['id']){delete _0x37bc27['body']['id'];}return db[_0x4c81('0x45')][_0x4c81('0x46')]({'where':{'id':_0x37bc27[_0x4c81('0x44')]['id']}})[_0x4c81('0x23')](handleEntityNotFound(_0x585adb,null))[_0x4c81('0x23')](saveUpdates(_0x37bc27['body'],null))['then'](respondWithResult(_0x585adb,null))['catch'](handleError(_0x585adb,null));};exports['destroy']=function(_0x57eed6,_0x4b5704){return db[_0x4c81('0x45')]['find']({'where':{'id':_0x57eed6[_0x4c81('0x44')]['id']}})[_0x4c81('0x23')](handleEntityNotFound(_0x4b5704,null))[_0x4c81('0x23')](removeEntity(_0x4b5704,null))[_0x4c81('0x47')](handleError(_0x4b5704,null));};exports[_0x4c81('0x49')]=function(_0x26b056,_0x2a173d){return db['CmHopperBlack'][_0x4c81('0x49')]()[_0x4c81('0x23')](respondWithResult(_0x2a173d,null))[_0x4c81('0x47')](handleError(_0x2a173d,null));}; \ No newline at end of file +var _0x4359=['VIRTUAL','findAll','rows','catch','show','params','includeAll','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x3fdd21,_0x26aec6){var _0x4973df=function(_0x27eda9){while(--_0x27eda9){_0x3fdd21['push'](_0x3fdd21['shift']());}};_0x4973df(++_0x26aec6);}(_0x4359,0x15a));var _0x9435=function(_0x49fe3e,_0x2cca6b){_0x49fe3e=_0x49fe3e-0x0;var _0x4afb0f=_0x4359[_0x49fe3e];return _0x4afb0f;};'use strict';var pdf=require(_0x9435('0x0'));var emlformat=require(_0x9435('0x1'));var rimraf=require(_0x9435('0x2'));var zipdir=require(_0x9435('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9435('0x4'));var Mustache=require(_0x9435('0x5'));var util=require(_0x9435('0x6'));var path=require(_0x9435('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9435('0x8'));var squel=require(_0x9435('0x9'));var crypto=require(_0x9435('0xa'));var jsforce=require(_0x9435('0xb'));var deskjs=require(_0x9435('0xc'));var toCsv=require(_0x9435('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9435('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9435('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9435('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x9435('0x11'));var licenseUtil=require(_0x9435('0x12'));var db=require(_0x9435('0x13'))['db'];function respondWithStatusCode(_0x3822b3,_0x3e87d6){_0x3e87d6=_0x3e87d6||0xcc;return function(_0x3f796f){if(_0x3f796f){return _0x3822b3[_0x9435('0x14')](_0x3e87d6);}return _0x3822b3[_0x9435('0x15')](_0x3e87d6)[_0x9435('0x16')]();};}function respondWithResult(_0x55eb8b,_0x442e7a){_0x442e7a=_0x442e7a||0xc8;return function(_0x5ce1d6){if(_0x5ce1d6){return _0x55eb8b['status'](_0x442e7a)[_0x9435('0x17')](_0x5ce1d6);}};}function respondWithFilteredResult(_0x5ad43d,_0x3bc598){return function(_0x45fcbe){if(_0x45fcbe){var _0x36a660=_0x45fcbe[_0x9435('0x18')],_0x462d1e=_0x3bc598[_0x9435('0x19')],_0x5aa33c=_0x3bc598[_0x9435('0x19')]+_0x3bc598[_0x9435('0x1a')],_0x2383ed;if(_0x5aa33c>=_0x36a660){_0x5aa33c=_0x36a660;_0x2383ed=0xc8;}else{_0x2383ed=0xce;}_0x5ad43d[_0x9435('0x15')](_0x2383ed);return _0x5ad43d['set'](_0x9435('0x1b'),_0x462d1e+'-'+_0x5aa33c+'/'+_0x36a660)[_0x9435('0x17')](_0x45fcbe);}return null;};}function patchUpdates(_0x16f815){return function(_0x39d991){try{jsonpatch[_0x9435('0x1c')](_0x39d991,_0x16f815,!![]);}catch(_0x3d5fc8){return BPromise['reject'](_0x3d5fc8);}return _0x39d991[_0x9435('0x1d')]();};}function saveUpdates(_0x52f8e2,_0x1880e9){return function(_0x1eb501){if(_0x1eb501){return _0x1eb501[_0x9435('0x1e')](_0x52f8e2)[_0x9435('0x1f')](function(_0x2890cb){return _0x2890cb;});}return null;};}function removeEntity(_0x4fe21c,_0x333c23){return function(_0x55e0f5){if(_0x55e0f5){return _0x55e0f5[_0x9435('0x20')]()[_0x9435('0x1f')](function(){_0x4fe21c['status'](0xcc)[_0x9435('0x16')]();});}};}function handleEntityNotFound(_0x5d9120,_0x477e01){return function(_0x3e8cd4){if(!_0x3e8cd4){_0x5d9120[_0x9435('0x14')](0x194);}return _0x3e8cd4;};}function handleError(_0x2fde1c,_0x429d0e){_0x429d0e=_0x429d0e||0x1f4;return function(_0x320bb2){logger['error'](_0x320bb2['stack']);if(_0x320bb2[_0x9435('0x21')]){delete _0x320bb2[_0x9435('0x21')];}_0x2fde1c[_0x9435('0x15')](_0x429d0e)[_0x9435('0x22')](_0x320bb2);};}exports[_0x9435('0x23')]=function(_0x85bc1,_0x37096c){var _0x1557a4={},_0x1a3800={},_0x5cf603={'count':0x0,'rows':[]};var _0x151815=_[_0x9435('0x24')](db[_0x9435('0x25')][_0x9435('0x26')],function(_0x32d707){return{'name':_0x32d707['fieldName'],'type':_0x32d707[_0x9435('0x27')]['key']};});_0x1a3800['model']=_[_0x9435('0x24')](_0x151815,_0x9435('0x21'));_0x1a3800[_0x9435('0x28')]=_[_0x9435('0x29')](_0x85bc1[_0x9435('0x28')]);_0x1a3800[_0x9435('0x2a')]=_['intersection'](_0x1a3800[_0x9435('0x2b')],_0x1a3800['query']);_0x1557a4[_0x9435('0x2c')]=_[_0x9435('0x2d')](_0x1a3800['model'],qs['fields'](_0x85bc1[_0x9435('0x28')][_0x9435('0x2e')]));_0x1557a4[_0x9435('0x2c')]=_0x1557a4[_0x9435('0x2c')][_0x9435('0x2f')]?_0x1557a4[_0x9435('0x2c')]:_0x1a3800['model'];if(!_0x85bc1['query'][_0x9435('0x30')](_0x9435('0x31'))){_0x1557a4[_0x9435('0x1a')]=qs['limit'](_0x85bc1[_0x9435('0x28')][_0x9435('0x1a')]);_0x1557a4[_0x9435('0x19')]=qs[_0x9435('0x19')](_0x85bc1[_0x9435('0x28')][_0x9435('0x19')]);}_0x1557a4[_0x9435('0x32')]=qs[_0x9435('0x33')](_0x85bc1[_0x9435('0x28')][_0x9435('0x33')]);_0x1557a4['where']=qs['filters'](_[_0x9435('0x34')](_0x85bc1[_0x9435('0x28')],_0x1a3800[_0x9435('0x2a')]),_0x151815);if(_0x85bc1[_0x9435('0x28')][_0x9435('0x35')]){_0x1557a4[_0x9435('0x36')]=_[_0x9435('0x37')](_0x1557a4['where'],{'$or':_[_0x9435('0x24')](_0x151815,function(_0x49814f){if(_0x49814f[_0x9435('0x27')]!==_0x9435('0x38')){var _0x17297e={};_0x17297e[_0x49814f[_0x9435('0x21')]]={'$like':'%'+_0x85bc1[_0x9435('0x28')][_0x9435('0x35')]+'%'};return _0x17297e;}})});}_0x1557a4=_[_0x9435('0x37')]({},_0x1557a4,_0x85bc1['options']);var _0x5431a4={'where':_0x1557a4[_0x9435('0x36')]};return db[_0x9435('0x25')][_0x9435('0x18')](_0x5431a4)['then'](function(_0x3ad151){_0x5cf603[_0x9435('0x18')]=_0x3ad151;if(_0x85bc1[_0x9435('0x28')]['includeAll']){_0x1557a4['include']=[{'all':!![]}];}return db[_0x9435('0x25')][_0x9435('0x39')](_0x1557a4);})['then'](function(_0x291ecb){_0x5cf603[_0x9435('0x3a')]=_0x291ecb;return _0x5cf603;})[_0x9435('0x1f')](respondWithFilteredResult(_0x37096c,_0x1557a4))[_0x9435('0x3b')](handleError(_0x37096c,null));};exports[_0x9435('0x3c')]=function(_0x5d092c,_0x481da9){var _0x3ed6ac={'raw':!![],'where':{'id':_0x5d092c[_0x9435('0x3d')]['id']}},_0x1835d4={};_0x1835d4[_0x9435('0x2b')]=_[_0x9435('0x29')](db[_0x9435('0x25')]['rawAttributes']);_0x1835d4[_0x9435('0x28')]=_[_0x9435('0x29')](_0x5d092c['query']);_0x1835d4[_0x9435('0x2a')]=_[_0x9435('0x2d')](_0x1835d4[_0x9435('0x2b')],_0x1835d4[_0x9435('0x28')]);_0x3ed6ac['attributes']=_['intersection'](_0x1835d4[_0x9435('0x2b')],qs[_0x9435('0x2e')](_0x5d092c[_0x9435('0x28')][_0x9435('0x2e')]));_0x3ed6ac[_0x9435('0x2c')]=_0x3ed6ac[_0x9435('0x2c')][_0x9435('0x2f')]?_0x3ed6ac['attributes']:_0x1835d4['model'];if(_0x5d092c[_0x9435('0x28')][_0x9435('0x3e')]){_0x3ed6ac['include']=[{'all':!![]}];}_0x3ed6ac=_['merge']({},_0x3ed6ac,_0x5d092c[_0x9435('0x3f')]);return db[_0x9435('0x25')][_0x9435('0x40')](_0x3ed6ac)[_0x9435('0x1f')](handleEntityNotFound(_0x481da9,null))[_0x9435('0x1f')](respondWithResult(_0x481da9,null))['catch'](handleError(_0x481da9,null));};exports[_0x9435('0x1e')]=function(_0x2defe2,_0x5a2f00){if(_0x2defe2['body']['id']){delete _0x2defe2['body']['id'];}return db[_0x9435('0x25')][_0x9435('0x40')]({'where':{'id':_0x2defe2['params']['id']}})['then'](handleEntityNotFound(_0x5a2f00,null))[_0x9435('0x1f')](saveUpdates(_0x2defe2[_0x9435('0x41')],null))[_0x9435('0x1f')](respondWithResult(_0x5a2f00,null))['catch'](handleError(_0x5a2f00,null));};exports[_0x9435('0x20')]=function(_0x4a5799,_0x5ef923){return db[_0x9435('0x25')][_0x9435('0x40')]({'where':{'id':_0x4a5799[_0x9435('0x3d')]['id']}})[_0x9435('0x1f')](handleEntityNotFound(_0x5ef923,null))[_0x9435('0x1f')](removeEntity(_0x5ef923,null))[_0x9435('0x3b')](handleError(_0x5ef923,null));};exports[_0x9435('0x42')]=function(_0x5bb040,_0x3eb35f){return db[_0x9435('0x25')][_0x9435('0x42')]()[_0x9435('0x1f')](respondWithResult(_0x3eb35f,null))[_0x9435('0x3b')](handleError(_0x3eb35f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e901822..e61ff99 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 _0x2c3f=['rimraf','../../config/environment','exports','define','CmHopperBlack','lodash','api','bluebird','request-promise'];(function(_0x18f5a7,_0x436f82){var _0x4d740c=function(_0x243c5c){while(--_0x243c5c){_0x18f5a7['push'](_0x18f5a7['shift']());}};_0x4d740c(++_0x436f82);}(_0x2c3f,0x113));var _0xf2c3=function(_0x20aaf3,_0x35d17b){_0x20aaf3=_0x20aaf3-0x0;var _0x3cc5c4=_0x2c3f[_0x20aaf3];return _0x3cc5c4;};'use strict';var _=require(_0xf2c3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf2c3('0x1'));var moment=require('moment');var BPromise=require(_0xf2c3('0x2'));var rp=require(_0xf2c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2c3('0x4'));var config=require(_0xf2c3('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0xf2c3('0x6')]=function(_0x334787,_0xc90000){return _0x334787[_0xf2c3('0x7')](_0xf2c3('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1867=['../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a39e1,_0x53a4f1){var _0xd29d7c=function(_0x2e6d34){while(--_0x2e6d34){_0x1a39e1['push'](_0x1a39e1['shift']());}};_0xd29d7c(++_0x53a4f1);}(_0x1867,0xe5));var _0x7186=function(_0x46e9f2,_0x554c12){_0x46e9f2=_0x46e9f2-0x0;var _0x505f9a=_0x1867[_0x46e9f2];return _0x505f9a;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var logger=require(_0x7186('0x2'))(_0x7186('0x3'));var moment=require(_0x7186('0x4'));var BPromise=require(_0x7186('0x5'));var rp=require(_0x7186('0x6'));var fs=require('fs');var path=require(_0x7186('0x7'));var rimraf=require(_0x7186('0x8'));var config=require(_0x7186('0x9'));var attributes=require(_0x7186('0xa'));module[_0x7186('0xb')]=function(_0x12433,_0x31c55b){return _0x12433[_0x7186('0xc')]('CmHopperBlack',attributes,{'tableName':_0x7186('0xd'),'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 82417c9..051b7b3 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 _0x99e2=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','include','map','model','attributes','stringify','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x99e2,0xaa));var _0x299e=function(_0x1d54ca,_0x17e0c){_0x1d54ca=_0x1d54ca-0x0;var _0xaab15e=_0x99e2[_0x1d54ca];return _0xaab15e;};'use strict';var _=require(_0x299e('0x0'));var util=require(_0x299e('0x1'));var moment=require(_0x299e('0x2'));var BPromise=require(_0x299e('0x3'));var rs=require(_0x299e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x299e('0x5'));var logger=require(_0x299e('0x6'))(_0x299e('0x7'));var config=require('../../config/environment');var jayson=require(_0x299e('0x8'));var client=jayson['client'][_0x299e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48de19,_0x5ac98a,_0x26002e){return new BPromise(function(_0x4e41b7,_0x4bd94b){return client[_0x299e('0xa')](_0x48de19,_0x26002e)[_0x299e('0xb')](function(_0x417849){logger[_0x299e('0xc')](_0x299e('0xd'),_0x5ac98a,_0x299e('0xe'));logger[_0x299e('0xf')](_0x299e('0x10'),_0x5ac98a,'request\x20sent',JSON['stringify'](_0x417849));if(_0x417849[_0x299e('0x11')]){if(_0x417849[_0x299e('0x11')][_0x299e('0x12')]===0x1f4){logger['error'](_0x299e('0xd'),_0x5ac98a,_0x417849['error'][_0x299e('0x13')]);return _0x4bd94b(_0x417849[_0x299e('0x11')][_0x299e('0x13')]);}logger[_0x299e('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x5ac98a,_0x417849[_0x299e('0x11')]['message']);return _0x4e41b7(_0x417849[_0x299e('0x11')]['message']);}else{logger['info'](_0x299e('0xd'),_0x5ac98a,_0x299e('0xe'));_0x4e41b7(_0x417849[_0x299e('0x14')][_0x299e('0x13')]);}})[_0x299e('0x15')](function(_0x36b0b8){logger[_0x299e('0x11')](_0x299e('0xd'),_0x5ac98a,_0x36b0b8);_0x4bd94b(_0x36b0b8);});});}exports[_0x299e('0x16')]=function(_0x554f24){var _0x196f38=this;return new Promise(function(_0x14d50c,_0x1be86d){return db[_0x299e('0x17')][_0x299e('0x18')]({'raw':_0x554f24[_0x299e('0x19')]?_0x554f24['options'][_0x299e('0x1a')]===undefined?!![]:![]:!![],'where':_0x554f24[_0x299e('0x19')]?_0x554f24[_0x299e('0x19')][_0x299e('0x1b')]||null:null,'attributes':_0x554f24['options']?_0x554f24[_0x299e('0x19')]['attributes']||null:null,'limit':_0x554f24['options']?_0x554f24['options']['limit']||null:null,'include':_0x554f24['options']?_0x554f24[_0x299e('0x19')][_0x299e('0x1c')]?_[_0x299e('0x1d')](_0x554f24[_0x299e('0x19')][_0x299e('0x1c')],function(_0x46e25f){return{'model':db[_0x46e25f[_0x299e('0x1e')]],'as':_0x46e25f['as'],'attributes':_0x46e25f['attributes'],'include':_0x46e25f['include']?_['map'](_0x46e25f['include'],function(_0x53c958){return{'model':db[_0x53c958[_0x299e('0x1e')]],'as':_0x53c958['as'],'attributes':_0x53c958[_0x299e('0x1f')],'include':_0x53c958['include']?_[_0x299e('0x1d')](_0x53c958[_0x299e('0x1c')],function(_0x32643f){return{'model':db[_0x32643f[_0x299e('0x1e')]],'as':_0x32643f['as'],'attributes':_0x32643f[_0x299e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x299e('0xb')](function(_0x2a1387){logger[_0x299e('0xc')](_0x299e('0x16'),_0x554f24);logger['debug']('GetCmHopperBlack',_0x554f24,JSON[_0x299e('0x20')](_0x2a1387));_0x14d50c(_0x2a1387);})[_0x299e('0x15')](function(_0x434224){logger[_0x299e('0x11')](_0x299e('0x16'),_0x434224['message'],_0x554f24);_0x1be86d(_0x196f38[_0x299e('0x11')](0x1f4,_0x434224[_0x299e('0x13')]));});});};exports[_0x299e('0x21')]=function(_0x206d7c){var _0x49f75e=this;return new Promise(function(_0x3d7c01,_0x226be9){return db[_0x299e('0x17')][_0x299e('0x22')](_0x206d7c[_0x299e('0x23')],{'raw':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')][_0x299e('0x1b')]||null:null,'attributes':_0x206d7c[_0x299e('0x19')]?_0x206d7c[_0x299e('0x19')][_0x299e('0x1f')]||null:null,'limit':_0x206d7c[_0x299e('0x19')]?_0x206d7c['options'][_0x299e('0x24')]||null:null})[_0x299e('0xb')](function(_0x4bcb23){logger[_0x299e('0xc')](_0x299e('0x21'),_0x206d7c);logger[_0x299e('0xf')]('UpdateCmHopperBlack',_0x206d7c,JSON[_0x299e('0x20')](_0x4bcb23));_0x3d7c01(_0x4bcb23);})[_0x299e('0x15')](function(_0x3a45c1){logger[_0x299e('0x11')](_0x299e('0x21'),_0x3a45c1[_0x299e('0x13')],_0x206d7c);_0x226be9(_0x49f75e[_0x299e('0x11')](0x1f4,_0x3a45c1['message']));});});};exports[_0x299e('0x25')]=function(_0x54be86){var _0x4b3102=this;return new Promise(function(_0x40747a,_0x1307fc){return db[_0x299e('0x17')]['destroy']({'where':_0x54be86['options']?_0x54be86[_0x299e('0x19')][_0x299e('0x1b')]||null:null})[_0x299e('0xb')](function(_0xe55745){logger[_0x299e('0xc')]('DestroyCmHopperBlack',_0x54be86);logger[_0x299e('0xf')](_0x299e('0x25'),_0x54be86,JSON[_0x299e('0x20')](_0xe55745));_0x40747a(_0xe55745);})[_0x299e('0x15')](function(_0x18f698){logger[_0x299e('0x11')]('DestroyCmHopperBlack',_0x18f698[_0x299e('0x13')],_0x54be86);_0x1307fc(_0x4b3102[_0x299e('0x11')](0x1f4,_0x18f698[_0x299e('0x13')]));});});}; \ No newline at end of file +var _0xe61f=['limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','include','model','map','then','stringify','UpdateCmHopperBlack','CmHopperBlack','body','raw'];(function(_0x194f6a,_0x2709ef){var _0x4b1ddd=function(_0x3f75e6){while(--_0x3f75e6){_0x194f6a['push'](_0x194f6a['shift']());}};_0x4b1ddd(++_0x2709ef);}(_0xe61f,0x114));var _0xfe61=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe61f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfe61('0x0'));var util=require(_0xfe61('0x1'));var moment=require(_0xfe61('0x2'));var BPromise=require(_0xfe61('0x3'));var rs=require(_0xfe61('0x4'));var fs=require('fs');var Redis=require(_0xfe61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe61('0x6'));var logger=require('../../config/logger')(_0xfe61('0x7'));var config=require(_0xfe61('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe61('0x9')][_0xfe61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0098,_0x47cace,_0x2222d6){return new BPromise(function(_0x16e0f3,_0x24553b){return client[_0xfe61('0xb')](_0x2a0098,_0x2222d6)['then'](function(_0x1f2c59){logger[_0xfe61('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x47cace,_0xfe61('0xd'));logger[_0xfe61('0xe')](_0xfe61('0xf'),_0x47cace,'request\x20sent',JSON['stringify'](_0x1f2c59));if(_0x1f2c59[_0xfe61('0x10')]){if(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x11')]===0x1f4){logger['error'](_0xfe61('0x12'),_0x47cace,_0x1f2c59['error'][_0xfe61('0x13')]);return _0x24553b(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x13')]);}logger['error'](_0xfe61('0x12'),_0x47cace,_0x1f2c59[_0xfe61('0x10')]['message']);return _0x16e0f3(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x13')]);}else{logger[_0xfe61('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x47cace,'request\x20sent');_0x16e0f3(_0x1f2c59[_0xfe61('0x14')]['message']);}})[_0xfe61('0x15')](function(_0x3b4608){logger[_0xfe61('0x10')](_0xfe61('0x12'),_0x47cace,_0x3b4608);_0x24553b(_0x3b4608);});});}exports[_0xfe61('0x16')]=function(_0x349a80){var _0x1c8add=this;return new Promise(function(_0x476928,_0x38c8a2){return db['CmHopperBlack'][_0xfe61('0x17')]({'raw':_0x349a80['options']?_0x349a80['options']['raw']===undefined?!![]:![]:!![],'where':_0x349a80['options']?_0x349a80[_0xfe61('0x18')][_0xfe61('0x19')]||null:null,'attributes':_0x349a80[_0xfe61('0x18')]?_0x349a80['options'][_0xfe61('0x1a')]||null:null,'limit':_0x349a80[_0xfe61('0x18')]?_0x349a80['options']['limit']||null:null,'include':_0x349a80[_0xfe61('0x18')]?_0x349a80[_0xfe61('0x18')][_0xfe61('0x1b')]?_['map'](_0x349a80[_0xfe61('0x18')][_0xfe61('0x1b')],function(_0x2062fe){return{'model':db[_0x2062fe['model']],'as':_0x2062fe['as'],'attributes':_0x2062fe[_0xfe61('0x1a')],'include':_0x2062fe[_0xfe61('0x1b')]?_['map'](_0x2062fe['include'],function(_0x3eaf81){return{'model':db[_0x3eaf81[_0xfe61('0x1c')]],'as':_0x3eaf81['as'],'attributes':_0x3eaf81[_0xfe61('0x1a')],'include':_0x3eaf81[_0xfe61('0x1b')]?_[_0xfe61('0x1d')](_0x3eaf81[_0xfe61('0x1b')],function(_0x5df015){return{'model':db[_0x5df015[_0xfe61('0x1c')]],'as':_0x5df015['as'],'attributes':_0x5df015[_0xfe61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfe61('0x1e')](function(_0x15f6e5){logger[_0xfe61('0xc')](_0xfe61('0x16'),_0x349a80);logger[_0xfe61('0xe')]('GetCmHopperBlack',_0x349a80,JSON[_0xfe61('0x1f')](_0x15f6e5));_0x476928(_0x15f6e5);})[_0xfe61('0x15')](function(_0x3ece1a){logger[_0xfe61('0x10')](_0xfe61('0x16'),_0x3ece1a['message'],_0x349a80);_0x38c8a2(_0x1c8add['error'](0x1f4,_0x3ece1a[_0xfe61('0x13')]));});});};exports[_0xfe61('0x20')]=function(_0x2e9374){var _0x2f59fa=this;return new Promise(function(_0x143988,_0x5b870f){return db[_0xfe61('0x21')]['update'](_0x2e9374[_0xfe61('0x22')],{'raw':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x19')]||null:null,'attributes':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x1a')]||null:null,'limit':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x24')]||null:null})[_0xfe61('0x1e')](function(_0x20f4b9){logger[_0xfe61('0xc')](_0xfe61('0x20'),_0x2e9374);logger[_0xfe61('0xe')](_0xfe61('0x20'),_0x2e9374,JSON[_0xfe61('0x1f')](_0x20f4b9));_0x143988(_0x20f4b9);})[_0xfe61('0x15')](function(_0x523d2e){logger[_0xfe61('0x10')](_0xfe61('0x20'),_0x523d2e[_0xfe61('0x13')],_0x2e9374);_0x5b870f(_0x2f59fa['error'](0x1f4,_0x523d2e['message']));});});};exports[_0xfe61('0x25')]=function(_0x52a893){var _0x461427=this;return new Promise(function(_0x235629,_0x28ed47){return db[_0xfe61('0x21')][_0xfe61('0x26')]({'where':_0x52a893['options']?_0x52a893['options'][_0xfe61('0x19')]||null:null})[_0xfe61('0x1e')](function(_0x21e19d){logger['info']('DestroyCmHopperBlack',_0x52a893);logger[_0xfe61('0xe')]('DestroyCmHopperBlack',_0x52a893,JSON[_0xfe61('0x1f')](_0x21e19d));_0x235629(_0x21e19d);})['catch'](function(_0x3c7e18){logger[_0xfe61('0x10')](_0xfe61('0x25'),_0x3c7e18[_0xfe61('0x13')],_0x52a893);_0x28ed47(_0x461427['error'](0x1f4,_0x3c7e18[_0xfe61('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c50f599..4c24fb7 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 _0xa8a8=['index','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0xa8a8,0xec));var _0x8a8a=function(_0x35efee,_0x4ff547){_0x35efee=_0x35efee-0x0;var _0x1e1ac9=_0xa8a8[_0x35efee];return _0x1e1ac9;};'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('0x9')](_0x8a8a('0xe'),auth[_0x8a8a('0xa')](),controller['show']);router['put'](_0x8a8a('0xe'),auth['isAuthenticated'](),controller[_0x8a8a('0xf')]);router[_0x8a8a('0x10')]('/:id',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0x11')]);module[_0x8a8a('0x12')]=router; \ No newline at end of file +var _0x7bae=['index','/describe','describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x5ef413,_0x3948a8){var _0x469ead=function(_0x95479e){while(--_0x95479e){_0x5ef413['push'](_0x5ef413['shift']());}};_0x469ead(++_0x3948a8);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7bae[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0x6')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xc')]);router['put'](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router[_0xe7ba('0xe')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xf')]);module[_0xe7ba('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8ebb4e0..8407835 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 _0xa5fc=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x3b12b9,_0x2d99db){var _0x4f757a=function(_0x1ac62f){while(--_0x1ac62f){_0x3b12b9['push'](_0x3b12b9['shift']());}};_0x4f757a(++_0x2d99db);}(_0xa5fc,0x146));var _0xca5f=function(_0x443aa2,_0x5ab2e9){_0x443aa2=_0x443aa2-0x0;var _0x47700d=_0xa5fc[_0x443aa2];return _0x47700d;};'use strict';var Sequelize=require(_0xca5f('0x0'));var moment=require(_0xca5f('0x1'));module[_0xca5f('0x2')]={'state':{'type':Sequelize[_0xca5f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xca5f('0x4')]},'scheduledat':{'type':Sequelize[_0xca5f('0x5')]},'countbusyretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca5f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xca5f('0x4')]},'originatecalleridname':{'type':Sequelize[_0xca5f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xca5f('0x5')]},'responsetime':{'type':Sequelize[_0xca5f('0x5')]},'answertime':{'type':Sequelize[_0xca5f('0x5')]},'droptime':{'type':Sequelize[_0xca5f('0x5')]},'endtime':{'type':Sequelize[_0xca5f('0x5')]},'ringtime':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca5f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xca5f('0x4')]},'membername':{'type':Sequelize[_0xca5f('0x4')]},'reason':{'type':Sequelize[_0xca5f('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca5f('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5278ef){var _0x5e744d=this[_0xca5f('0x6')](_0xca5f('0x7'));if(_0x5e744d&&_0x5278ef){this[_0xca5f('0x8')](_0xca5f('0x9'),moment(_0x5278ef)[_0xca5f('0xa')](moment(_0x5e744d),_0xca5f('0xb')));}return this[_0xca5f('0x8')](_0xca5f('0xc'),_0x5278ef);}},'amd':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca5f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca5f('0x5')]},'deleted':{'type':Sequelize[_0xca5f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xca5f('0x5')]},'recallme':{'type':Sequelize[_0xca5f('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xca5f('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca5f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe1ea=['followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','endtime','setDataValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe1ea,0x19c));var _0xae1e=function(_0x3ff2da,_0x109bc2){_0x3ff2da=_0x3ff2da-0x0;var _0x8c1dda=_0xe1ea[_0x3ff2da];return _0x8c1dda;};'use strict';var Sequelize=require(_0xae1e('0x0'));var moment=require(_0xae1e('0x1'));module[_0xae1e('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xae1e('0x3')]},'scheduledat':{'type':Sequelize[_0xae1e('0x4')]},'countbusyretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xae1e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xae1e('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xae1e('0x3')]},'calleridname':{'type':Sequelize[_0xae1e('0x3')]},'starttime':{'type':Sequelize[_0xae1e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xae1e('0x4')]},'droptime':{'type':Sequelize[_0xae1e('0x4')]},'endtime':{'type':Sequelize[_0xae1e('0x4')]},'ringtime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xae1e('0x3')]},'campaigntype':{'type':Sequelize[_0xae1e('0x3')]},'membername':{'type':Sequelize[_0xae1e('0x3')]},'reason':{'type':Sequelize[_0xae1e('0x3')]},'disposition':{'type':Sequelize[_0xae1e('0x3')]},'secondDisposition':{'type':Sequelize[_0xae1e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3f43ae){var _0x5ee332=this['getDataValue'](_0xae1e('0x6'));if(_0x5ee332&&_0x3f43ae){this[_0xae1e('0x7')](_0xae1e('0x8'),moment(_0x3f43ae)['diff'](moment(_0x5ee332),_0xae1e('0x9')));}return this[_0xae1e('0x7')](_0xae1e('0xa'),_0x3f43ae);}},'amd':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xae1e('0x4')]},'callback':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xae1e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xae1e('0x4')]},'deleted':{'type':Sequelize[_0xae1e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index feb633b..9d0d10f 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 _0x3667=['order','sort','where','filters','merge','VIRTUAL','filter','CmHopperFinal','includeAll','include','rows','catch','show','params','length','options','find','describe','update','body','uniqueid','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','ListId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','cm_hopper_final','group','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','checkContactHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x4e24d9,_0x45a2f0){var _0x339180=function(_0x2e9da4){while(--_0x2e9da4){_0x4e24d9['push'](_0x4e24d9['shift']());}};_0x339180(++_0x45a2f0);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7366('0x0'));var emlformat=require(_0x7366('0x1'));var rimraf=require(_0x7366('0x2'));var zipdir=require(_0x7366('0x3'));var jsonpatch=require(_0x7366('0x4'));var rp=require('request-promise');var moment=require(_0x7366('0x5'));var BPromise=require(_0x7366('0x6'));var Mustache=require('mustache');var util=require(_0x7366('0x7'));var path=require(_0x7366('0x8'));var sox=require(_0x7366('0x9'));var csv=require(_0x7366('0xa'));var ejs=require(_0x7366('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0xa'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var licenseUtil=require(_0x7366('0x1b'));var db=require(_0x7366('0x1c'))['db'];function respondWithStatusCode(_0xd5bac8,_0x3e3a73){_0x3e3a73=_0x3e3a73||0xcc;return function(_0x262659){if(_0x262659){return _0xd5bac8[_0x7366('0x1d')](_0x3e3a73);}return _0xd5bac8[_0x7366('0x1e')](_0x3e3a73)[_0x7366('0x1f')]();};}function respondWithResult(_0x308253,_0x27500c){_0x27500c=_0x27500c||0xc8;return function(_0x22562f){if(_0x22562f){return _0x308253[_0x7366('0x1e')](_0x27500c)['json'](_0x22562f);}};}function respondWithFilteredResult(_0x23e763,_0x308752){return function(_0x338719){if(_0x338719){var _0x2c0422=_0x338719[_0x7366('0x20')],_0xe2c87b=_0x308752[_0x7366('0x21')],_0x431c01=_0x308752[_0x7366('0x21')]+_0x308752[_0x7366('0x22')],_0x2bc2af;if(_0x431c01>=_0x2c0422){_0x431c01=_0x2c0422;_0x2bc2af=0xc8;}else{_0x2bc2af=0xce;}_0x23e763['status'](_0x2bc2af);return _0x23e763[_0x7366('0x23')]('Content-Range',_0xe2c87b+'-'+_0x431c01+'/'+_0x2c0422)[_0x7366('0x24')](_0x338719);}return null;};}function patchUpdates(_0x4acbd3){return function(_0x3f23cd){try{jsonpatch['apply'](_0x3f23cd,_0x4acbd3,!![]);}catch(_0x29f725){return BPromise[_0x7366('0x25')](_0x29f725);}return _0x3f23cd[_0x7366('0x26')]();};}function saveUpdates(_0x532ce2,_0x16e038){return function(_0x1946c6){if(_0x1946c6){return _0x1946c6['update'](_0x532ce2)[_0x7366('0x27')](function(_0x411dfe){return _0x411dfe;});}return null;};}function removeEntity(_0xaab659,_0x1a12d2){return function(_0x3c30a2){if(_0x3c30a2){return _0x3c30a2[_0x7366('0x28')]()[_0x7366('0x27')](function(){_0xaab659[_0x7366('0x1e')](0xcc)[_0x7366('0x1f')]();});}};}function handleEntityNotFound(_0x301220,_0x12aed6){return function(_0x1dc875){if(!_0x1dc875){_0x301220[_0x7366('0x1d')](0x194);}return _0x1dc875;};}function handleError(_0x563b22,_0xb63a21){_0xb63a21=_0xb63a21||0x1f4;return function(_0x4fe7cf){logger[_0x7366('0x29')](_0x4fe7cf['stack']);if(_0x4fe7cf['name']){delete _0x4fe7cf[_0x7366('0x2a')];}_0x563b22['status'](_0xb63a21)[_0x7366('0x2b')](_0x4fe7cf);};}exports['index']=function(_0x256633,_0x191177){var _0x5c37e2={},_0x6d196a={},_0x565aa7={'count':0x0,'rows':[]};var _0x31c642=_[_0x7366('0x2c')](db['CmHopperFinal'][_0x7366('0x2d')],function(_0x507baf){return{'name':_0x507baf[_0x7366('0x2e')],'type':_0x507baf[_0x7366('0x2f')][_0x7366('0x30')]};});_0x6d196a[_0x7366('0x31')]=_[_0x7366('0x2c')](_0x31c642,'name');_0x6d196a[_0x7366('0x32')]=_[_0x7366('0x33')](_0x256633['query']);_0x6d196a['filters']=_['intersection'](_0x6d196a['model'],_0x6d196a[_0x7366('0x32')]);_0x5c37e2[_0x7366('0x34')]=_[_0x7366('0x35')](_0x6d196a[_0x7366('0x31')],qs['fields'](_0x256633[_0x7366('0x32')][_0x7366('0x36')]));_0x5c37e2[_0x7366('0x34')]=_0x5c37e2[_0x7366('0x34')]['length']?_0x5c37e2[_0x7366('0x34')]:_0x6d196a[_0x7366('0x31')];if(!_0x256633['query'][_0x7366('0x37')](_0x7366('0x38'))){_0x5c37e2[_0x7366('0x22')]=qs[_0x7366('0x22')](_0x256633[_0x7366('0x32')][_0x7366('0x22')]);_0x5c37e2[_0x7366('0x21')]=qs[_0x7366('0x21')](_0x256633[_0x7366('0x32')]['offset']);}_0x5c37e2[_0x7366('0x39')]=qs[_0x7366('0x3a')](_0x256633['query'][_0x7366('0x3a')]);_0x5c37e2[_0x7366('0x3b')]=qs[_0x7366('0x3c')](_['pick'](_0x256633[_0x7366('0x32')],_0x6d196a['filters']),_0x31c642);if(_0x256633[_0x7366('0x32')]['filter']){_0x5c37e2['where']=_[_0x7366('0x3d')](_0x5c37e2['where'],{'$or':_[_0x7366('0x2c')](_0x31c642,function(_0x116081){if(_0x116081['type']!==_0x7366('0x3e')){var _0x533919={};_0x533919[_0x116081[_0x7366('0x2a')]]={'$like':'%'+_0x256633[_0x7366('0x32')][_0x7366('0x3f')]+'%'};return _0x533919;}})});}_0x5c37e2=_[_0x7366('0x3d')]({},_0x5c37e2,_0x256633['options']);var _0x8ed827={'where':_0x5c37e2[_0x7366('0x3b')]};return db[_0x7366('0x40')]['count'](_0x8ed827)[_0x7366('0x27')](function(_0x35ae13){_0x565aa7[_0x7366('0x20')]=_0x35ae13;if(_0x256633[_0x7366('0x32')][_0x7366('0x41')]){_0x5c37e2[_0x7366('0x42')]=[{'all':!![]}];}return db[_0x7366('0x40')]['findAll'](_0x5c37e2);})['then'](function(_0x35b274){_0x565aa7[_0x7366('0x43')]=_0x35b274;return _0x565aa7;})['then'](respondWithFilteredResult(_0x191177,_0x5c37e2))[_0x7366('0x44')](handleError(_0x191177,null));};exports[_0x7366('0x45')]=function(_0x550fe2,_0x432f79){var _0x54fca7={'raw':!![],'where':{'id':_0x550fe2[_0x7366('0x46')]['id']}},_0xafac5={};_0xafac5['model']=_['keys'](db[_0x7366('0x40')][_0x7366('0x2d')]);_0xafac5[_0x7366('0x32')]=_[_0x7366('0x33')](_0x550fe2['query']);_0xafac5[_0x7366('0x3c')]=_[_0x7366('0x35')](_0xafac5[_0x7366('0x31')],_0xafac5[_0x7366('0x32')]);_0x54fca7[_0x7366('0x34')]=_[_0x7366('0x35')](_0xafac5[_0x7366('0x31')],qs['fields'](_0x550fe2[_0x7366('0x32')][_0x7366('0x36')]));_0x54fca7[_0x7366('0x34')]=_0x54fca7['attributes'][_0x7366('0x47')]?_0x54fca7[_0x7366('0x34')]:_0xafac5['model'];if(_0x550fe2[_0x7366('0x32')][_0x7366('0x41')]){_0x54fca7[_0x7366('0x42')]=[{'all':!![]}];}_0x54fca7=_['merge']({},_0x54fca7,_0x550fe2[_0x7366('0x48')]);return db[_0x7366('0x40')][_0x7366('0x49')](_0x54fca7)['then'](handleEntityNotFound(_0x432f79,null))[_0x7366('0x27')](respondWithResult(_0x432f79,null))[_0x7366('0x44')](handleError(_0x432f79,null));};exports[_0x7366('0x4a')]=function(_0x4de2ce,_0xb32e28){return db[_0x7366('0x40')][_0x7366('0x4a')]()[_0x7366('0x27')](respondWithResult(_0xb32e28,null))['catch'](handleError(_0xb32e28,null));};exports[_0x7366('0x4b')]=function(_0x2d1c52,_0x6d46d2){if(_0x2d1c52[_0x7366('0x4c')][_0x7366('0x4d')]){delete _0x2d1c52[_0x7366('0x4c')][_0x7366('0x4d')];}return db[_0x7366('0x40')][_0x7366('0x49')]({'where':{'uniqueid':_0x2d1c52['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x6d46d2,null))[_0x7366('0x27')](saveUpdates(_0x2d1c52['body'],null))[_0x7366('0x27')](respondWithResult(_0x6d46d2,null))[_0x7366('0x44')](handleError(_0x6d46d2,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x2ea6ce,_0x579495,_0x3a16d6){return db[_0x7366('0x40')][_0x7366('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x2ea6ce[_0x7366('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x52')))),_0x7366('0x53')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x54')))),'noAnswerContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x7366('0x55')],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x56')))),_0x7366('0x57')],[db['sequelize']['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x58')))),_0x7366('0x59')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5a')))),_0x7366('0x5b')],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5c')))),'reCallContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x5d')))),_0x7366('0x5e')]]})[_0x7366('0x27')](handleEntityNotFound(_0x579495,null))[_0x7366('0x27')](respondWithResult(_0x579495,null))['catch'](handleError(_0x579495,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x112c82,_0x574e1e,_0x432755){return db[_0x7366('0x40')][_0x7366('0x4e')]({'raw':![],'where':{'CampaignId':_0x112c82[_0x7366('0x46')]['id']},'attributes':[[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x200,\x201,\x20null'))),_0x7366('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')]['literal'](_0x7366('0x54')))),'noAnswerContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x7366('0x55')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db['sequelize'][_0x7366('0x51')](_0x7366('0x56')))),_0x7366('0x57')],[db['sequelize']['fn']('COUNT',db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7366('0x59')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5a')))),_0x7366('0x5b')],[db[_0x7366('0x50')]['fn'](_0x7366('0x4f'),db[_0x7366('0x50')]['fn']('IF',db['sequelize'][_0x7366('0x51')](_0x7366('0x5c')))),'reCallContacts'],[db[_0x7366('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7366('0x50')][_0x7366('0x51')](_0x7366('0x5d')))),_0x7366('0x5e')]]})[_0x7366('0x27')](handleEntityNotFound(_0x574e1e,null))[_0x7366('0x27')](respondWithResult(_0x574e1e,null))['catch'](handleError(_0x574e1e,null));};exports[_0x7366('0x5f')]=function(_0x94b414,_0x305dff,_0x4f4fe1){return db[_0x7366('0x60')]['find']({'where':{'id':_0x94b414['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x305dff,null))['then'](function(_0x142cd7){var _0xa0ac25;if(_0x142cd7){_0xa0ac25=squel[_0x7366('0x61')]()[_0x7366('0x62')]('cm_hopper')['fromQuery']([_0x7366('0x63'),_0x7366('0x64'),_0x7366('0x65'),_0x7366('0x66'),'VoiceQueueId',_0x7366('0x67'),'updatedAt'],squel['select']()[_0x7366('0x68')](_0x7366('0x69'),'phone')[_0x7366('0x68')](_0x7366('0x6a'),'scheduledAt')[_0x7366('0x68')](_0x7366('0x6b'),_0x7366('0x65'))[_0x7366('0x68')](_0x7366('0x6c'),_0x7366('0x66'))[_0x7366('0x68')](_0x7366('0x6d'),_0x7366('0x6e'))[_0x7366('0x68')]('NOW()','createdAt')['field'](_0x7366('0x6a'),_0x7366('0x6f'))[_0x7366('0x70')]('cm_hopper_final')[_0x7366('0x3b')](_0x7366('0x71'),_0x94b414[_0x7366('0x46')]['id'][_0x7366('0x72')]())[_0x7366('0x3b')]('state\x20=\x20?',_0x94b414[_0x7366('0x4c')][_0x7366('0x73')]['toString']())[_0x7366('0x3b')](_0x7366('0x74'))[_0x7366('0x3b')](_0x7366('0x75'),squel[_0x7366('0x76')]()['field']('phone')[_0x7366('0x70')](_0x7366('0x77'))[_0x7366('0x3b')](_0x7366('0x71'),_0x94b414[_0x7366('0x46')]['id'][_0x7366('0x72')]()))[_0x7366('0x3b')](_0x7366('0x75'),squel[_0x7366('0x76')]()[_0x7366('0x68')](_0x7366('0x78'))[_0x7366('0x70')](_0x7366('0x79'))[_0x7366('0x3b')]('VoiceQueueId\x20=\x20?',_0x94b414[_0x7366('0x46')]['id']['toString']())[_0x7366('0x3b')]('state\x20=\x204'))[_0x7366('0x7a')]('ContactId'))[_0x7366('0x72')]();return db[_0x7366('0x50')]['query'](_0xa0ac25);}return[];})[_0x7366('0x27')](respondWithResult(_0x305dff,null))[_0x7366('0x44')](handleError(_0x305dff,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4ea1e6,_0x394367,_0x1821e1){return db['Campaign'][_0x7366('0x49')]({'where':{'id':_0x4ea1e6['params']['id']}})[_0x7366('0x27')](handleEntityNotFound(_0x394367,null))['then'](function(_0x4788dd){var _0x45a50f;if(_0x4788dd){_0x45a50f=squel[_0x7366('0x61')]()[_0x7366('0x62')]('cm_hopper')[_0x7366('0x7b')]([_0x7366('0x63'),_0x7366('0x64'),'ContactId',_0x7366('0x66'),_0x7366('0x7c'),_0x7366('0x67'),_0x7366('0x6f')],squel[_0x7366('0x76')]()[_0x7366('0x68')]('ANY_VALUE(calleridnum)',_0x7366('0x63'))[_0x7366('0x68')](_0x7366('0x6a'),'scheduledAt')[_0x7366('0x68')]('ANY_VALUE(ContactId)',_0x7366('0x65'))[_0x7366('0x68')](_0x7366('0x6c'),_0x7366('0x66'))[_0x7366('0x68')](_0x7366('0x7d'),_0x7366('0x7c'))[_0x7366('0x68')](_0x7366('0x6a'),_0x7366('0x67'))[_0x7366('0x68')](_0x7366('0x6a'),_0x7366('0x6f'))['from'](_0x7366('0x79'))[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]())['where'](_0x7366('0x7f'),_0x4ea1e6[_0x7366('0x4c')]['state'][_0x7366('0x72')]())[_0x7366('0x3b')](_0x7366('0x74'))['where'](_0x7366('0x75'),squel['select']()['field']('phone')[_0x7366('0x70')](_0x7366('0x77'))[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7366('0x76')]()[_0x7366('0x68')](_0x7366('0x78'))[_0x7366('0x70')]('cm_hopper_final')[_0x7366('0x3b')](_0x7366('0x7e'),_0x4ea1e6[_0x7366('0x46')]['id'][_0x7366('0x72')]())[_0x7366('0x3b')](_0x7366('0x80')))['group'](_0x7366('0x65')))[_0x7366('0x72')]();return db[_0x7366('0x50')][_0x7366('0x32')](_0x45a50f);}return[];})[_0x7366('0x27')](respondWithResult(_0x394367,null))[_0x7366('0x44')](handleError(_0x394367,null));};exports[_0x7366('0x81')]=function(_0x5ac943,_0x396c88,_0x9b7f5a){return db['CmHopper'][_0x7366('0x82')]({'where':{'VoiceQueueId':_0x5ac943[_0x7366('0x4c')][_0x7366('0x6e')],'CampaignId':_0x5ac943[_0x7366('0x4c')][_0x7366('0x7c')],'ContactId':_0x5ac943['body']['ContactId']}})['then'](handleEntityNotFound(_0x396c88,null))[_0x7366('0x27')](function(_0x17660e){if(_0x17660e){return _0x17660e;}return null;})[_0x7366('0x27')](respondWithResult(_0x396c88,null))[_0x7366('0x44')](handleError(_0x396c88,null));}; \ No newline at end of file +var _0xf109=['limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','then','rows','catch','params','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x5cfc87,_0x3efea7){var _0x3c19f2=function(_0x2f06ec){while(--_0x2f06ec){_0x5cfc87['push'](_0x5cfc87['shift']());}};_0x3c19f2(++_0x3efea7);}(_0xf109,0xce));var _0x9f10=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xf109[_0x2b9b7f];return _0x4ed19a;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289164,_0x260606){_0x260606=_0x260606||0xcc;return function(_0x35c529){if(_0x35c529){return _0x289164['sendStatus'](_0x260606);}return _0x289164[_0x9f10('0x18')](_0x260606)[_0x9f10('0x19')]();};}function respondWithResult(_0x5be443,_0x40a48a){_0x40a48a=_0x40a48a||0xc8;return function(_0x236e28){if(_0x236e28){return _0x5be443['status'](_0x40a48a)['json'](_0x236e28);}};}function respondWithFilteredResult(_0x2b6c4c,_0x177918){return function(_0x549217){if(_0x549217){var _0x11154b=_0x549217['count'],_0x5ae255=_0x177918[_0x9f10('0x1a')],_0x14d3fe=_0x177918[_0x9f10('0x1a')]+_0x177918['limit'],_0x1f68d8;if(_0x14d3fe>=_0x11154b){_0x14d3fe=_0x11154b;_0x1f68d8=0xc8;}else{_0x1f68d8=0xce;}_0x2b6c4c[_0x9f10('0x18')](_0x1f68d8);return _0x2b6c4c['set'](_0x9f10('0x1b'),_0x5ae255+'-'+_0x14d3fe+'/'+_0x11154b)['json'](_0x549217);}return null;};}function patchUpdates(_0x2c5064){return function(_0x56fb44){try{jsonpatch['apply'](_0x56fb44,_0x2c5064,!![]);}catch(_0x3d216b){return BPromise[_0x9f10('0x1c')](_0x3d216b);}return _0x56fb44[_0x9f10('0x1d')]();};}function saveUpdates(_0x3a78be,_0xa810c){return function(_0x332575){if(_0x332575){return _0x332575[_0x9f10('0x1e')](_0x3a78be)['then'](function(_0x366044){return _0x366044;});}return null;};}function removeEntity(_0x58e6ba,_0x293990){return function(_0x36ace4){if(_0x36ace4){return _0x36ace4[_0x9f10('0x1f')]()['then'](function(){_0x58e6ba[_0x9f10('0x18')](0xcc)[_0x9f10('0x19')]();});}};}function handleEntityNotFound(_0x213567,_0x4d21c5){return function(_0x36821e){if(!_0x36821e){_0x213567[_0x9f10('0x20')](0x194);}return _0x36821e;};}function handleError(_0x44b99d,_0x4c531e){_0x4c531e=_0x4c531e||0x1f4;return function(_0x2ec07d){logger[_0x9f10('0x21')](_0x2ec07d[_0x9f10('0x22')]);if(_0x2ec07d[_0x9f10('0x23')]){delete _0x2ec07d['name'];}_0x44b99d['status'](_0x4c531e)['send'](_0x2ec07d);};}exports[_0x9f10('0x24')]=function(_0x4a0407,_0x314794){var _0x1de75a={},_0x45fffc={},_0x2ed95b={'count':0x0,'rows':[]};var _0x2e11b1=_['map'](db[_0x9f10('0x25')][_0x9f10('0x26')],function(_0x40f96b){return{'name':_0x40f96b[_0x9f10('0x27')],'type':_0x40f96b[_0x9f10('0x28')][_0x9f10('0x29')]};});_0x45fffc['model']=_[_0x9f10('0x2a')](_0x2e11b1,_0x9f10('0x23'));_0x45fffc[_0x9f10('0x2b')]=_[_0x9f10('0x2c')](_0x4a0407['query']);_0x45fffc[_0x9f10('0x2d')]=_[_0x9f10('0x2e')](_0x45fffc[_0x9f10('0x2f')],_0x45fffc['query']);_0x1de75a[_0x9f10('0x30')]=_['intersection'](_0x45fffc[_0x9f10('0x2f')],qs[_0x9f10('0x31')](_0x4a0407[_0x9f10('0x2b')]['fields']));_0x1de75a[_0x9f10('0x30')]=_0x1de75a[_0x9f10('0x30')][_0x9f10('0x32')]?_0x1de75a[_0x9f10('0x30')]:_0x45fffc[_0x9f10('0x2f')];if(!_0x4a0407['query'][_0x9f10('0x33')]('nolimit')){_0x1de75a[_0x9f10('0x34')]=qs[_0x9f10('0x34')](_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x34')]);_0x1de75a[_0x9f10('0x1a')]=qs[_0x9f10('0x1a')](_0x4a0407['query'][_0x9f10('0x1a')]);}_0x1de75a[_0x9f10('0x35')]=qs[_0x9f10('0x36')](_0x4a0407['query'][_0x9f10('0x36')]);_0x1de75a[_0x9f10('0x37')]=qs['filters'](_[_0x9f10('0x38')](_0x4a0407['query'],_0x45fffc[_0x9f10('0x2d')]),_0x2e11b1);if(_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x39')]){_0x1de75a[_0x9f10('0x37')]=_[_0x9f10('0x3a')](_0x1de75a[_0x9f10('0x37')],{'$or':_[_0x9f10('0x2a')](_0x2e11b1,function(_0x1db955){if(_0x1db955['type']!==_0x9f10('0x3b')){var _0x622030={};_0x622030[_0x1db955[_0x9f10('0x23')]]={'$like':'%'+_0x4a0407['query'][_0x9f10('0x39')]+'%'};return _0x622030;}})});}_0x1de75a=_[_0x9f10('0x3a')]({},_0x1de75a,_0x4a0407['options']);var _0x30b04b={'where':_0x1de75a[_0x9f10('0x37')]};return db[_0x9f10('0x25')]['count'](_0x30b04b)['then'](function(_0x2e4e2d){_0x2ed95b[_0x9f10('0x3c')]=_0x2e4e2d;if(_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x3d')]){_0x1de75a[_0x9f10('0x3e')]=[{'all':!![]}];}return db[_0x9f10('0x25')][_0x9f10('0x3f')](_0x1de75a);})[_0x9f10('0x40')](function(_0x7fe320){_0x2ed95b[_0x9f10('0x41')]=_0x7fe320;return _0x2ed95b;})[_0x9f10('0x40')](respondWithFilteredResult(_0x314794,_0x1de75a))[_0x9f10('0x42')](handleError(_0x314794,null));};exports['show']=function(_0x5e3f06,_0x4bb805){var _0x24700a={'raw':!![],'where':{'id':_0x5e3f06[_0x9f10('0x43')]['id']}},_0x5c8c44={};_0x5c8c44[_0x9f10('0x2f')]=_[_0x9f10('0x2c')](db['CmHopperFinal'][_0x9f10('0x26')]);_0x5c8c44[_0x9f10('0x2b')]=_[_0x9f10('0x2c')](_0x5e3f06[_0x9f10('0x2b')]);_0x5c8c44[_0x9f10('0x2d')]=_['intersection'](_0x5c8c44['model'],_0x5c8c44['query']);_0x24700a[_0x9f10('0x30')]=_['intersection'](_0x5c8c44[_0x9f10('0x2f')],qs['fields'](_0x5e3f06[_0x9f10('0x2b')][_0x9f10('0x31')]));_0x24700a[_0x9f10('0x30')]=_0x24700a[_0x9f10('0x30')]['length']?_0x24700a[_0x9f10('0x30')]:_0x5c8c44[_0x9f10('0x2f')];if(_0x5e3f06['query'][_0x9f10('0x3d')]){_0x24700a[_0x9f10('0x3e')]=[{'all':!![]}];}_0x24700a=_[_0x9f10('0x3a')]({},_0x24700a,_0x5e3f06[_0x9f10('0x44')]);return db[_0x9f10('0x25')][_0x9f10('0x45')](_0x24700a)[_0x9f10('0x40')](handleEntityNotFound(_0x4bb805,null))[_0x9f10('0x40')](respondWithResult(_0x4bb805,null))[_0x9f10('0x42')](handleError(_0x4bb805,null));};exports[_0x9f10('0x46')]=function(_0x552588,_0x181eab){return db[_0x9f10('0x25')]['describe']()[_0x9f10('0x40')](respondWithResult(_0x181eab,null))[_0x9f10('0x42')](handleError(_0x181eab,null));};exports[_0x9f10('0x1e')]=function(_0x1807b3,_0x58b5b5){if(_0x1807b3[_0x9f10('0x47')][_0x9f10('0x48')]){delete _0x1807b3[_0x9f10('0x47')][_0x9f10('0x48')];}return db[_0x9f10('0x25')][_0x9f10('0x45')]({'where':{'uniqueid':_0x1807b3['params']['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x58b5b5,null))[_0x9f10('0x40')](saveUpdates(_0x1807b3[_0x9f10('0x47')],null))[_0x9f10('0x40')](respondWithResult(_0x58b5b5,null))[_0x9f10('0x42')](handleError(_0x58b5b5,null));};exports[_0x9f10('0x49')]=function(_0x52c069,_0x3ec147,_0x1bbf92){return db[_0x9f10('0x25')][_0x9f10('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x52c069[_0x9f10('0x43')]['id']},'attributes':[[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x9f10('0x4d')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x4e')))),'noAnswerContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x9f10('0x4f')],[db[_0x9f10('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x50')))),'congestionContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x51')))),_0x9f10('0x52')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x53')))),_0x9f10('0x54')],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9f10('0x55')],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x56')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x3ec147,null))[_0x9f10('0x40')](respondWithResult(_0x3ec147,null))[_0x9f10('0x42')](handleError(_0x3ec147,null));};exports[_0x9f10('0x57')]=function(_0x40f845,_0x2625ca,_0x2094c9){return db[_0x9f10('0x25')]['findAll']({'raw':![],'where':{'CampaignId':_0x40f845[_0x9f10('0x43')]['id']},'attributes':[[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')]['literal'](_0x9f10('0x58')))),_0x9f10('0x4d')],[db['sequelize']['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x4e')))),_0x9f10('0x59')],[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x50')))),_0x9f10('0x5a')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f10('0x52')],[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x53')))),_0x9f10('0x54')],[db['sequelize']['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x5b')))),'reCallContacts'],[db[_0x9f10('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x56')))),'answeringMachine']]})[_0x9f10('0x40')](handleEntityNotFound(_0x2625ca,null))['then'](respondWithResult(_0x2625ca,null))['catch'](handleError(_0x2625ca,null));};exports[_0x9f10('0x5c')]=function(_0x551a5d,_0x4e7b27,_0x13a2cb){return db['VoiceQueue'][_0x9f10('0x45')]({'where':{'id':_0x551a5d[_0x9f10('0x43')]['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x4e7b27,null))['then'](function(_0x30b571){var _0x1cbcf3;if(_0x30b571){_0x1cbcf3=squel['insert']()[_0x9f10('0x5d')]('cm_hopper')['fromQuery']([_0x9f10('0x5e'),_0x9f10('0x5f'),_0x9f10('0x60'),_0x9f10('0x61'),_0x9f10('0x62'),_0x9f10('0x63'),_0x9f10('0x64')],squel['select']()[_0x9f10('0x65')](_0x9f10('0x66'),_0x9f10('0x5e'))[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x5f'))[_0x9f10('0x65')](_0x9f10('0x68'),_0x9f10('0x60'))['field'](_0x9f10('0x69'),_0x9f10('0x61'))[_0x9f10('0x65')](_0x9f10('0x6a'),'VoiceQueueId')[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x63'))[_0x9f10('0x65')]('NOW()','updatedAt')[_0x9f10('0x6b')](_0x9f10('0x6c'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x6f'),_0x551a5d[_0x9f10('0x47')][_0x9f10('0x70')][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x71'))[_0x9f10('0x37')](_0x9f10('0x72'),squel['select']()[_0x9f10('0x65')](_0x9f10('0x5e'))['from'](_0x9f10('0x73'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d[_0x9f10('0x43')]['id']['toString']()))[_0x9f10('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9f10('0x74')]()[_0x9f10('0x65')](_0x9f10('0x75'))['from'](_0x9f10('0x6c'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d['params']['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x76')))['group']('ContactId'))['toString']();return db['sequelize']['query'](_0x1cbcf3);}return[];})['then'](respondWithResult(_0x4e7b27,null))['catch'](handleError(_0x4e7b27,null));};exports[_0x9f10('0x77')]=function(_0x2571a6,_0x4dc5d5,_0xa0988b){return db[_0x9f10('0x78')][_0x9f10('0x45')]({'where':{'id':_0x2571a6[_0x9f10('0x43')]['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x4dc5d5,null))[_0x9f10('0x40')](function(_0x45ebcc){var _0x27a67c;if(_0x45ebcc){_0x27a67c=squel[_0x9f10('0x79')]()[_0x9f10('0x5d')]('cm_hopper')[_0x9f10('0x7a')]([_0x9f10('0x5e'),'scheduledAt',_0x9f10('0x60'),'ListId','CampaignId',_0x9f10('0x63'),_0x9f10('0x64')],squel['select']()[_0x9f10('0x65')](_0x9f10('0x66'),'phone')[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x5f'))['field'](_0x9f10('0x68'),_0x9f10('0x60'))['field']('ANY_VALUE(ListId)',_0x9f10('0x61'))[_0x9f10('0x65')]('ANY_VALUE(CampaignId)',_0x9f10('0x7b'))[_0x9f10('0x65')]('NOW()','createdAt')[_0x9f10('0x65')](_0x9f10('0x67'),'updatedAt')['from'](_0x9f10('0x6c'))[_0x9f10('0x37')]('CampaignId\x20=\x20?',_0x2571a6[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x6f'),_0x2571a6[_0x9f10('0x47')]['state']['toString']())['where'](_0x9f10('0x71'))[_0x9f10('0x37')](_0x9f10('0x72'),squel['select']()[_0x9f10('0x65')]('phone')[_0x9f10('0x6b')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x2571a6[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]()))[_0x9f10('0x37')](_0x9f10('0x72'),squel[_0x9f10('0x74')]()[_0x9f10('0x65')](_0x9f10('0x75'))[_0x9f10('0x6b')]('cm_hopper_final')[_0x9f10('0x37')](_0x9f10('0x7c'),_0x2571a6[_0x9f10('0x43')]['id']['toString']())[_0x9f10('0x37')](_0x9f10('0x76')))[_0x9f10('0x7d')](_0x9f10('0x60')))[_0x9f10('0x6e')]();return db['sequelize'][_0x9f10('0x2b')](_0x27a67c);}return[];})['then'](respondWithResult(_0x4dc5d5,null))[_0x9f10('0x42')](handleError(_0x4dc5d5,null));};exports[_0x9f10('0x7e')]=function(_0x559701,_0x25698c,_0x331330){return db[_0x9f10('0x7f')][_0x9f10('0x80')]({'where':{'VoiceQueueId':_0x559701['body'][_0x9f10('0x62')],'CampaignId':_0x559701['body'][_0x9f10('0x7b')],'ContactId':_0x559701[_0x9f10('0x47')]['ContactId']}})['then'](handleEntityNotFound(_0x25698c,null))[_0x9f10('0x40')](function(_0x52f70c){if(_0x52f70c){return _0x52f70c;}return null;})['then'](respondWithResult(_0x25698c,null))['catch'](handleError(_0x25698c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bb68c60..2b5fa49 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 _0x16e9=['util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x23e267,_0x15a165){var _0x2ef1df=function(_0x354f0c){while(--_0x354f0c){_0x23e267['push'](_0x23e267['shift']());}};_0x2ef1df(++_0x15a165);}(_0x16e9,0x138));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x916e('0x0'));var logger=require('../../config/logger')(_0x916e('0x1'));var moment=require(_0x916e('0x2'));var BPromise=require(_0x916e('0x3'));var rp=require(_0x916e('0x4'));var fs=require('fs');var path=require(_0x916e('0x5'));var rimraf=require(_0x916e('0x6'));var config=require('../../config/environment');var attributes=require(_0x916e('0x7'));module['exports']=function(_0x113fb0,_0xbeaeb6){return _0x113fb0[_0x916e('0x8')](_0x916e('0x9'),attributes,{'tableName':_0x916e('0xa'),'paranoid':![],'indexes':[{'name':_0x916e('0xb'),'fields':[_0x916e('0xb')]},{'name':_0x916e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc27=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x8f689a,_0x3f0f65){var _0x2fce62=function(_0x12a766){while(--_0x12a766){_0x8f689a['push'](_0x8f689a['shift']());}};_0x2fce62(++_0x3f0f65);}(_0xdc27,0xcb));var _0x7dc2=function(_0x162c12,_0x5963a0){_0x162c12=_0x162c12-0x0;var _0x11b07c=_0xdc27[_0x162c12];return _0x11b07c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7dc2('0x0'))(_0x7dc2('0x1'));var moment=require('moment');var BPromise=require(_0x7dc2('0x2'));var rp=require(_0x7dc2('0x3'));var fs=require('fs');var path=require(_0x7dc2('0x4'));var rimraf=require('rimraf');var config=require(_0x7dc2('0x5'));var attributes=require(_0x7dc2('0x6'));module[_0x7dc2('0x7')]=function(_0x2ec329,_0x54aca8){return _0x2ec329[_0x7dc2('0x8')](_0x7dc2('0x9'),attributes,{'tableName':_0x7dc2('0xa'),'paranoid':![],'indexes':[{'name':_0x7dc2('0xb'),'fields':[_0x7dc2('0xb')]},{'name':_0x7dc2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4c8e903..fcdc313 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 _0x1df6=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','raw','then'];(function(_0x582c8,_0x200fa9){var _0x15dc72=function(_0xa48543){while(--_0xa48543){_0x582c8['push'](_0x582c8['shift']());}};_0x15dc72(++_0x200fa9);}(_0x1df6,0x75));var _0x61df=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x1df6[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x61df('0x0'));var moment=require(_0x61df('0x1'));var BPromise=require(_0x61df('0x2'));var rs=require(_0x61df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61df('0x4'))['db'];var utils=require(_0x61df('0x5'));var logger=require('../../config/logger')(_0x61df('0x6'));var config=require(_0x61df('0x7'));var jayson=require(_0x61df('0x8'));var client=jayson[_0x61df('0x9')][_0x61df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5484c8,_0x5a04ff,_0x37bfe3){return new BPromise(function(_0x103c32,_0x4d98ef){return client[_0x61df('0xb')](_0x5484c8,_0x37bfe3)['then'](function(_0x3109b5){logger[_0x61df('0xc')](_0x61df('0xd'),_0x5a04ff,_0x61df('0xe'));logger[_0x61df('0xf')](_0x61df('0x10'),_0x5a04ff,'request\x20sent',JSON[_0x61df('0x11')](_0x3109b5));if(_0x3109b5['error']){if(_0x3109b5[_0x61df('0x12')][_0x61df('0x13')]===0x1f4){logger[_0x61df('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x5a04ff,_0x3109b5[_0x61df('0x12')][_0x61df('0x14')]);return _0x4d98ef(_0x3109b5['error'][_0x61df('0x14')]);}logger[_0x61df('0x12')](_0x61df('0xd'),_0x5a04ff,_0x3109b5[_0x61df('0x12')][_0x61df('0x14')]);return _0x103c32(_0x3109b5[_0x61df('0x12')]['message']);}else{logger['info'](_0x61df('0xd'),_0x5a04ff,'request\x20sent');_0x103c32(_0x3109b5[_0x61df('0x15')][_0x61df('0x14')]);}})['catch'](function(_0x52406a){logger[_0x61df('0x12')](_0x61df('0xd'),_0x5a04ff,_0x52406a);_0x4d98ef(_0x52406a);});});}exports[_0x61df('0x16')]=function(_0x8d47f0){var _0x962f4=this;return new Promise(function(_0x5b073d,_0x39cb94){return db[_0x61df('0x17')][_0x61df('0x18')](_0x8d47f0[_0x61df('0x19')],{'raw':_0x8d47f0['options']?_0x8d47f0['options'][_0x61df('0x1a')]===undefined?!![]:![]:!![]})[_0x61df('0x1b')](function(_0x1c4d11){logger[_0x61df('0xc')](_0x61df('0x16'),_0x8d47f0);logger['debug']('CreateCmHopperFinal',_0x8d47f0,JSON['stringify'](_0x1c4d11));_0x5b073d(_0x1c4d11);})[_0x61df('0x1c')](function(_0x50e08c){logger['error'](_0x61df('0x16'),_0x50e08c[_0x61df('0x14')],_0x8d47f0);_0x39cb94(_0x962f4['error'](0x1f4,_0x50e08c['message']));});});}; \ No newline at end of file +var _0xd8f5=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd8f5,0x6b));var _0x5d8f=function(_0x596f51,_0x300f6d){_0x596f51=_0x596f51-0x0;var _0x325124=_0xd8f5[_0x596f51];return _0x325124;};'use strict';var _=require(_0x5d8f('0x0'));var util=require(_0x5d8f('0x1'));var moment=require('moment');var BPromise=require(_0x5d8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d8f('0x3'))['db'];var utils=require(_0x5d8f('0x4'));var logger=require(_0x5d8f('0x5'))(_0x5d8f('0x6'));var config=require(_0x5d8f('0x7'));var jayson=require(_0x5d8f('0x8'));var client=jayson[_0x5d8f('0x9')][_0x5d8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ca14d,_0x163ded,_0xf04ded){return new BPromise(function(_0x5c6bc4,_0x54543b){return client[_0x5d8f('0xb')](_0x2ca14d,_0xf04ded)[_0x5d8f('0xc')](function(_0x3ba885){logger['info'](_0x5d8f('0xd'),_0x163ded,_0x5d8f('0xe'));logger[_0x5d8f('0xf')](_0x5d8f('0x10'),_0x163ded,_0x5d8f('0xe'),JSON[_0x5d8f('0x11')](_0x3ba885));if(_0x3ba885[_0x5d8f('0x12')]){if(_0x3ba885['error'][_0x5d8f('0x13')]===0x1f4){logger['error'](_0x5d8f('0xd'),_0x163ded,_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);return _0x54543b(_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);}logger[_0x5d8f('0x12')](_0x5d8f('0xd'),_0x163ded,_0x3ba885[_0x5d8f('0x12')]['message']);return _0x5c6bc4(_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);}else{logger[_0x5d8f('0x15')](_0x5d8f('0xd'),_0x163ded,_0x5d8f('0xe'));_0x5c6bc4(_0x3ba885[_0x5d8f('0x16')]['message']);}})[_0x5d8f('0x17')](function(_0x24ccb8){logger[_0x5d8f('0x12')](_0x5d8f('0xd'),_0x163ded,_0x24ccb8);_0x54543b(_0x24ccb8);});});}exports[_0x5d8f('0x18')]=function(_0x5710ff){var _0x114139=this;return new Promise(function(_0x4b1fa8,_0x52fe50){return db[_0x5d8f('0x19')][_0x5d8f('0x1a')](_0x5710ff[_0x5d8f('0x1b')],{'raw':_0x5710ff[_0x5d8f('0x1c')]?_0x5710ff[_0x5d8f('0x1c')][_0x5d8f('0x1d')]===undefined?!![]:![]:!![]})[_0x5d8f('0xc')](function(_0x27e7c3){logger[_0x5d8f('0x15')](_0x5d8f('0x18'),_0x5710ff);logger[_0x5d8f('0xf')](_0x5d8f('0x18'),_0x5710ff,JSON[_0x5d8f('0x11')](_0x27e7c3));_0x4b1fa8(_0x27e7c3);})[_0x5d8f('0x17')](function(_0x6c8971){logger[_0x5d8f('0x12')](_0x5d8f('0x18'),_0x6c8971[_0x5d8f('0x14')],_0x5710ff);_0x52fe50(_0x114139[_0x5d8f('0x12')](0x1f4,_0x6c8971[_0x5d8f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index be97d0c..f0b92e2 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 _0x664f=['/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x5a2920,_0x5635a0){var _0x3d07ca=function(_0x531892){while(--_0x531892){_0x5a2920['push'](_0x5a2920['shift']());}};_0x3d07ca(++_0x5635a0);}(_0x664f,0x184));var _0xf664=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0x664f[_0x558472];return _0x37e917;};'use strict';var multer=require(_0xf664('0x0'));var util=require('util');var path=require(_0xf664('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf664('0x2')]();var auth=require(_0xf664('0x3'));var interaction=require(_0xf664('0x4'));var config=require(_0xf664('0x5'));var controller=require(_0xf664('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf664('0x7')]);router['get'](_0xf664('0x8'),auth[_0xf664('0x9')](),controller[_0xf664('0xa')]);router[_0xf664('0xb')](_0xf664('0xc'),auth['isAuthenticated'](),controller[_0xf664('0xd')]);router[_0xf664('0xb')](_0xf664('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf664('0xb')](_0xf664('0xf'),auth[_0xf664('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xf664('0x10')]('/voice/queue/moveContacts/:id',auth[_0xf664('0x9')](),controller[_0xf664('0x11')]);router[_0xf664('0x10')](_0xf664('0x12'),auth['isAuthenticated'](),controller[_0xf664('0x13')]);router[_0xf664('0x10')](_0xf664('0x14'),auth[_0xf664('0x9')](),controller[_0xf664('0x15')]);router[_0xf664('0x16')](_0xf664('0xc'),auth[_0xf664('0x9')](),controller[_0xf664('0x17')]);module[_0xf664('0x18')]=router; \ No newline at end of file +var _0xbc3a=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x521f32,_0x915745){var _0x32aaf1=function(_0x406305){while(--_0x406305){_0x521f32['push'](_0x521f32['shift']());}};_0x32aaf1(++_0x915745);}(_0xbc3a,0x82));var _0xabc3=function(_0x207477,_0x550083){_0x207477=_0x207477-0x0;var _0x221820=_0xbc3a[_0x207477];return _0x221820;};'use strict';var multer=require(_0xabc3('0x0'));var util=require(_0xabc3('0x1'));var path=require(_0xabc3('0x2'));var timeout=require(_0xabc3('0x3'));var express=require(_0xabc3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xabc3('0x5'));var config=require(_0xabc3('0x6'));var controller=require(_0xabc3('0x7'));router[_0xabc3('0x8')]('/',auth[_0xabc3('0x9')](),controller[_0xabc3('0xa')]);router[_0xabc3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xabc3('0xb')]);router['get'](_0xabc3('0xc'),auth[_0xabc3('0x9')](),controller[_0xabc3('0xd')]);router[_0xabc3('0x8')](_0xabc3('0xe'),auth[_0xabc3('0x9')](),controller[_0xabc3('0xf')]);router[_0xabc3('0x8')](_0xabc3('0x10'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x11')]);router[_0xabc3('0x12')](_0xabc3('0x13'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x14')]);router[_0xabc3('0x12')](_0xabc3('0x15'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x16')]);router[_0xabc3('0x12')](_0xabc3('0x17'),auth[_0xabc3('0x9')](),controller['checkContactHopper']);router['put'](_0xabc3('0xc'),auth[_0xabc3('0x9')](),controller[_0xabc3('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 9b02262..f8e91ae 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 _0x53d0=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4f0a65,_0x73359d){var _0x45d6dd=function(_0xab0cb6){while(--_0xab0cb6){_0x4f0a65['push'](_0x4f0a65['shift']());}};_0x45d6dd(++_0x73359d);}(_0x53d0,0x1b2));var _0x053d=function(_0x12530c,_0x55b2e0){_0x12530c=_0x12530c-0x0;var _0x3cfa3a=_0x53d0[_0x12530c];return _0x3cfa3a;};'use strict';var Sequelize=require(_0x053d('0x0'));module['exports']={'state':{'type':Sequelize[_0x053d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x053d('0x2')]},'scheduledat':{'type':Sequelize[_0x053d('0x3')]},'countbusyretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x053d('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x053d('0x2')]},'calleridnum':{'type':Sequelize[_0x053d('0x2')]},'calleridname':{'type':Sequelize[_0x053d('0x2')]},'starttime':{'type':Sequelize[_0x053d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x053d('0x3')]},'endtime':{'type':Sequelize[_0x053d('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x053d('0x2')]},'campaign':{'type':Sequelize[_0x053d('0x2')]},'campaigntype':{'type':Sequelize[_0x053d('0x2')]},'membername':{'type':Sequelize[_0x053d('0x2')]},'reason':{'type':Sequelize[_0x053d('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x053d('0x3')]},'recallme':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x053d('0x3')]},'edited':{'type':Sequelize[_0x053d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x053d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x42ce=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x44d343,_0x2f0a76){var _0x404732=function(_0xb67472){while(--_0xb67472){_0x44d343['push'](_0x44d343['shift']());}};_0x404732(++_0x2f0a76);}(_0x42ce,0x17c));var _0xe42c=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x42ce[_0x3ee5df];return _0x446d24;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xe42c('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xe42c('0x1')]},'scheduledat':{'type':Sequelize[_0xe42c('0x2')]},'countbusyretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe42c('0x1')]},'originatecalleridname':{'type':Sequelize[_0xe42c('0x1')]},'calleridnum':{'type':Sequelize[_0xe42c('0x1')]},'calleridname':{'type':Sequelize[_0xe42c('0x1')]},'starttime':{'type':Sequelize[_0xe42c('0x2')]},'responsetime':{'type':Sequelize[_0xe42c('0x2')]},'answertime':{'type':Sequelize[_0xe42c('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe42c('0x2')]},'ringtime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe42c('0x1')]},'campaign':{'type':Sequelize[_0xe42c('0x1')]},'campaigntype':{'type':Sequelize[_0xe42c('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe42c('0x1')]},'amd':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe42c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe42c('0x2')]},'recallme':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe42c('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe42c('0x0')],'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 74e3acb..97a9aed 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 _0x04e4=['Content-Range','apply','save','update','then','destroy','name','send','index','fieldName','type','model','keys','filters','query','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','map','VIRTUAL','CmHopperHistory','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','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','set'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x04e4,0x15e));var _0x404e=function(_0x557383,_0x227505){_0x557383=_0x557383-0x0;var _0x4afb9c=_0x04e4[_0x557383];return _0x4afb9c;};'use strict';var pdf=require(_0x404e('0x0'));var emlformat=require(_0x404e('0x1'));var rimraf=require(_0x404e('0x2'));var zipdir=require(_0x404e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x404e('0x4'));var moment=require(_0x404e('0x5'));var BPromise=require(_0x404e('0x6'));var Mustache=require(_0x404e('0x7'));var util=require(_0x404e('0x8'));var path=require(_0x404e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x404e('0xa'));var fs=require('fs');var _=require(_0x404e('0xb'));var squel=require(_0x404e('0xc'));var crypto=require(_0x404e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x404e('0xe'));var querystring=require(_0x404e('0xf'));var Papa=require(_0x404e('0x10'));var Redis=require(_0x404e('0x11'));var authService=require(_0x404e('0x12'));var qs=require(_0x404e('0x13'));var as=require(_0x404e('0x14'));var hardwareService=require(_0x404e('0x15'));var logger=require(_0x404e('0x16'))(_0x404e('0x17'));var utils=require(_0x404e('0x18'));var config=require(_0x404e('0x19'));var licenseUtil=require(_0x404e('0x1a'));var db=require(_0x404e('0x1b'))['db'];function respondWithStatusCode(_0x3db641,_0x390b19){_0x390b19=_0x390b19||0xcc;return function(_0x1ae6e){if(_0x1ae6e){return _0x3db641[_0x404e('0x1c')](_0x390b19);}return _0x3db641[_0x404e('0x1d')](_0x390b19)[_0x404e('0x1e')]();};}function respondWithResult(_0x46f738,_0x22f862){_0x22f862=_0x22f862||0xc8;return function(_0xaef464){if(_0xaef464){return _0x46f738[_0x404e('0x1d')](_0x22f862)[_0x404e('0x1f')](_0xaef464);}};}function respondWithFilteredResult(_0x5db951,_0x206e9d){return function(_0x2cc382){if(_0x2cc382){var _0x2ac7ba=_0x2cc382[_0x404e('0x20')],_0x3ef532=_0x206e9d[_0x404e('0x21')],_0x5c17ec=_0x206e9d[_0x404e('0x21')]+_0x206e9d['limit'],_0x56d59b;if(_0x5c17ec>=_0x2ac7ba){_0x5c17ec=_0x2ac7ba;_0x56d59b=0xc8;}else{_0x56d59b=0xce;}_0x5db951[_0x404e('0x1d')](_0x56d59b);return _0x5db951[_0x404e('0x22')](_0x404e('0x23'),_0x3ef532+'-'+_0x5c17ec+'/'+_0x2ac7ba)[_0x404e('0x1f')](_0x2cc382);}return null;};}function patchUpdates(_0x288834){return function(_0x491198){try{jsonpatch[_0x404e('0x24')](_0x491198,_0x288834,!![]);}catch(_0x3bafe6){return BPromise['reject'](_0x3bafe6);}return _0x491198[_0x404e('0x25')]();};}function saveUpdates(_0x39ea01,_0x2f305e){return function(_0x53d18d){if(_0x53d18d){return _0x53d18d[_0x404e('0x26')](_0x39ea01)[_0x404e('0x27')](function(_0x131d39){return _0x131d39;});}return null;};}function removeEntity(_0x1e08d0,_0x1b1251){return function(_0x5e2efc){if(_0x5e2efc){return _0x5e2efc[_0x404e('0x28')]()[_0x404e('0x27')](function(){_0x1e08d0[_0x404e('0x1d')](0xcc)[_0x404e('0x1e')]();});}};}function handleEntityNotFound(_0x1041fe,_0x3c27c1){return function(_0x16bc4e){if(!_0x16bc4e){_0x1041fe['sendStatus'](0x194);}return _0x16bc4e;};}function handleError(_0x511f22,_0x3bc288){_0x3bc288=_0x3bc288||0x1f4;return function(_0x4bef94){logger['error'](_0x4bef94['stack']);if(_0x4bef94[_0x404e('0x29')]){delete _0x4bef94[_0x404e('0x29')];}_0x511f22[_0x404e('0x1d')](_0x3bc288)[_0x404e('0x2a')](_0x4bef94);};}exports[_0x404e('0x2b')]=function(_0x5e8ffd,_0x40034c){var _0x1e844a={},_0x2d76ca={},_0x3c1299={'count':0x0,'rows':[]};var _0x4a190c=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x50c9cd){return{'name':_0x50c9cd[_0x404e('0x2c')],'type':_0x50c9cd[_0x404e('0x2d')]['key']};});_0x2d76ca[_0x404e('0x2e')]=_['map'](_0x4a190c,'name');_0x2d76ca['query']=_[_0x404e('0x2f')](_0x5e8ffd['query']);_0x2d76ca[_0x404e('0x30')]=_['intersection'](_0x2d76ca[_0x404e('0x2e')],_0x2d76ca[_0x404e('0x31')]);_0x1e844a['attributes']=_[_0x404e('0x32')](_0x2d76ca['model'],qs[_0x404e('0x33')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x33')]));_0x1e844a[_0x404e('0x34')]=_0x1e844a[_0x404e('0x34')][_0x404e('0x35')]?_0x1e844a[_0x404e('0x34')]:_0x2d76ca[_0x404e('0x2e')];if(!_0x5e8ffd[_0x404e('0x31')]['hasOwnProperty'](_0x404e('0x36'))){_0x1e844a[_0x404e('0x37')]=qs[_0x404e('0x37')](_0x5e8ffd[_0x404e('0x31')]['limit']);_0x1e844a[_0x404e('0x21')]=qs[_0x404e('0x21')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x21')]);}_0x1e844a[_0x404e('0x38')]=qs[_0x404e('0x39')](_0x5e8ffd[_0x404e('0x31')][_0x404e('0x39')]);_0x1e844a['where']=qs[_0x404e('0x30')](_['pick'](_0x5e8ffd[_0x404e('0x31')],_0x2d76ca[_0x404e('0x30')]),_0x4a190c);if(_0x5e8ffd[_0x404e('0x31')][_0x404e('0x3a')]){_0x1e844a[_0x404e('0x3b')]=_[_0x404e('0x3c')](_0x1e844a[_0x404e('0x3b')],{'$or':_[_0x404e('0x3d')](_0x4a190c,function(_0x487ac7){if(_0x487ac7['type']!==_0x404e('0x3e')){var _0x3e979b={};_0x3e979b[_0x487ac7[_0x404e('0x29')]]={'$like':'%'+_0x5e8ffd['query'][_0x404e('0x3a')]+'%'};return _0x3e979b;}})});}_0x1e844a=_['merge']({},_0x1e844a,_0x5e8ffd['options']);var _0x4017eb={'where':_0x1e844a['where']};return db[_0x404e('0x3f')][_0x404e('0x20')](_0x4017eb)['then'](function(_0xd67aff){_0x3c1299[_0x404e('0x20')]=_0xd67aff;if(_0x5e8ffd['query'][_0x404e('0x40')]){_0x1e844a[_0x404e('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x404e('0x42')](_0x1e844a);})[_0x404e('0x27')](function(_0x5da543){_0x3c1299[_0x404e('0x43')]=_0x5da543;return _0x3c1299;})[_0x404e('0x27')](respondWithFilteredResult(_0x40034c,_0x1e844a))[_0x404e('0x44')](handleError(_0x40034c,null));};exports['show']=function(_0x1404a6,_0x4cd21a){var _0x55f19c={'raw':!![],'where':{'id':_0x1404a6[_0x404e('0x45')]['id']}},_0x3bf893={};_0x3bf893[_0x404e('0x2e')]=_[_0x404e('0x2f')](db[_0x404e('0x3f')][_0x404e('0x46')]);_0x3bf893[_0x404e('0x31')]=_[_0x404e('0x2f')](_0x1404a6[_0x404e('0x31')]);_0x3bf893[_0x404e('0x30')]=_[_0x404e('0x32')](_0x3bf893['model'],_0x3bf893[_0x404e('0x31')]);_0x55f19c[_0x404e('0x34')]=_[_0x404e('0x32')](_0x3bf893['model'],qs[_0x404e('0x33')](_0x1404a6[_0x404e('0x31')][_0x404e('0x33')]));_0x55f19c[_0x404e('0x34')]=_0x55f19c[_0x404e('0x34')]['length']?_0x55f19c[_0x404e('0x34')]:_0x3bf893[_0x404e('0x2e')];if(_0x1404a6[_0x404e('0x31')]['includeAll']){_0x55f19c[_0x404e('0x41')]=[{'all':!![]}];}_0x55f19c=_[_0x404e('0x3c')]({},_0x55f19c,_0x1404a6[_0x404e('0x47')]);return db[_0x404e('0x3f')][_0x404e('0x48')](_0x55f19c)[_0x404e('0x27')](handleEntityNotFound(_0x4cd21a,null))[_0x404e('0x27')](respondWithResult(_0x4cd21a,null))[_0x404e('0x44')](handleError(_0x4cd21a,null));};exports[_0x404e('0x49')]=function(_0x11253b,_0x51ce85){return db[_0x404e('0x3f')][_0x404e('0x49')](_0x11253b[_0x404e('0x4a')],{})[_0x404e('0x27')](respondWithResult(_0x51ce85,0xc9))['catch'](handleError(_0x51ce85,null));};exports[_0x404e('0x4b')]=function(_0x28dc38,_0x3a5a03){return db['CmHopperHistory'][_0x404e('0x4b')]()[_0x404e('0x27')](respondWithResult(_0x3a5a03,null))['catch'](handleError(_0x3a5a03,null));};exports[_0x404e('0x26')]=function(_0x428d9a,_0x39c976){if(_0x428d9a[_0x404e('0x4a')][_0x404e('0x4c')]){delete _0x428d9a[_0x404e('0x4a')][_0x404e('0x4c')];}return db[_0x404e('0x3f')]['find']({'where':{'uniqueid':_0x428d9a[_0x404e('0x45')]['id']}})['then'](handleEntityNotFound(_0x39c976,null))[_0x404e('0x27')](saveUpdates(_0x428d9a['body'],null))[_0x404e('0x27')](respondWithResult(_0x39c976,null))[_0x404e('0x44')](handleError(_0x39c976,null));}; \ No newline at end of file +var _0x4771=['map','CmHopperHistory','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','where','merge','VIRTUAL','filter','options','include','findAll','catch','params','keys','length','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x4771,0xa1));var _0x1477=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4771[_0x344a3f];return _0x264712;};'use strict';var pdf=require(_0x1477('0x0'));var emlformat=require(_0x1477('0x1'));var rimraf=require(_0x1477('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1477('0x3'));var rp=require(_0x1477('0x4'));var moment=require(_0x1477('0x5'));var BPromise=require(_0x1477('0x6'));var Mustache=require(_0x1477('0x7'));var util=require(_0x1477('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1477('0x9'));var ejs=require(_0x1477('0xa'));var fs=require('fs');var _=require(_0x1477('0xb'));var squel=require('squel');var crypto=require(_0x1477('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1477('0xd'));var toCsv=require(_0x1477('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1477('0xe'));var authService=require(_0x1477('0xf'));var qs=require(_0x1477('0x10'));var as=require(_0x1477('0x11'));var hardwareService=require(_0x1477('0x12'));var logger=require('../../config/logger')(_0x1477('0x13'));var utils=require('../../config/utils');var config=require(_0x1477('0x14'));var licenseUtil=require(_0x1477('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542c48,_0x17b5fb){_0x17b5fb=_0x17b5fb||0xcc;return function(_0x44aeab){if(_0x44aeab){return _0x542c48['sendStatus'](_0x17b5fb);}return _0x542c48[_0x1477('0x16')](_0x17b5fb)[_0x1477('0x17')]();};}function respondWithResult(_0x1f2b49,_0x34069a){_0x34069a=_0x34069a||0xc8;return function(_0x4c536d){if(_0x4c536d){return _0x1f2b49[_0x1477('0x16')](_0x34069a)[_0x1477('0x18')](_0x4c536d);}};}function respondWithFilteredResult(_0x194b17,_0x1444d4){return function(_0x2c104c){if(_0x2c104c){var _0x34ccd2=_0x2c104c[_0x1477('0x19')],_0x4fb662=_0x1444d4[_0x1477('0x1a')],_0x2a2dd8=_0x1444d4[_0x1477('0x1a')]+_0x1444d4[_0x1477('0x1b')],_0x23daca;if(_0x2a2dd8>=_0x34ccd2){_0x2a2dd8=_0x34ccd2;_0x23daca=0xc8;}else{_0x23daca=0xce;}_0x194b17['status'](_0x23daca);return _0x194b17['set'](_0x1477('0x1c'),_0x4fb662+'-'+_0x2a2dd8+'/'+_0x34ccd2)['json'](_0x2c104c);}return null;};}function patchUpdates(_0x180998){return function(_0x37c7de){try{jsonpatch[_0x1477('0x1d')](_0x37c7de,_0x180998,!![]);}catch(_0x1b4e91){return BPromise[_0x1477('0x1e')](_0x1b4e91);}return _0x37c7de[_0x1477('0x1f')]();};}function saveUpdates(_0x364c6b,_0x39d87){return function(_0x5e8618){if(_0x5e8618){return _0x5e8618[_0x1477('0x20')](_0x364c6b)[_0x1477('0x21')](function(_0x544b44){return _0x544b44;});}return null;};}function removeEntity(_0x468a15,_0x5a7df1){return function(_0x387cfe){if(_0x387cfe){return _0x387cfe[_0x1477('0x22')]()[_0x1477('0x21')](function(){_0x468a15[_0x1477('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128151,_0x7332b9){return function(_0x11988c){if(!_0x11988c){_0x128151[_0x1477('0x23')](0x194);}return _0x11988c;};}function handleError(_0x181d9e,_0x1904eb){_0x1904eb=_0x1904eb||0x1f4;return function(_0x1a34ea){logger['error'](_0x1a34ea[_0x1477('0x24')]);if(_0x1a34ea['name']){delete _0x1a34ea[_0x1477('0x25')];}_0x181d9e[_0x1477('0x16')](_0x1904eb)[_0x1477('0x26')](_0x1a34ea);};}exports[_0x1477('0x27')]=function(_0x50d4b7,_0x1ad4f7){var _0xf6ba02={},_0x4a2772={},_0x250171={'count':0x0,'rows':[]};var _0x213a1e=_[_0x1477('0x28')](db[_0x1477('0x29')]['rawAttributes'],function(_0x5066cb){return{'name':_0x5066cb[_0x1477('0x2a')],'type':_0x5066cb[_0x1477('0x2b')]['key']};});_0x4a2772[_0x1477('0x2c')]=_[_0x1477('0x28')](_0x213a1e,_0x1477('0x25'));_0x4a2772['query']=_['keys'](_0x50d4b7[_0x1477('0x2d')]);_0x4a2772[_0x1477('0x2e')]=_[_0x1477('0x2f')](_0x4a2772['model'],_0x4a2772[_0x1477('0x2d')]);_0xf6ba02[_0x1477('0x30')]=_[_0x1477('0x2f')](_0x4a2772[_0x1477('0x2c')],qs[_0x1477('0x31')](_0x50d4b7['query'][_0x1477('0x31')]));_0xf6ba02['attributes']=_0xf6ba02[_0x1477('0x30')]['length']?_0xf6ba02[_0x1477('0x30')]:_0x4a2772[_0x1477('0x2c')];if(!_0x50d4b7[_0x1477('0x2d')][_0x1477('0x32')]('nolimit')){_0xf6ba02['limit']=qs[_0x1477('0x1b')](_0x50d4b7['query']['limit']);_0xf6ba02[_0x1477('0x1a')]=qs['offset'](_0x50d4b7[_0x1477('0x2d')][_0x1477('0x1a')]);}_0xf6ba02['order']=qs['sort'](_0x50d4b7[_0x1477('0x2d')]['sort']);_0xf6ba02[_0x1477('0x33')]=qs[_0x1477('0x2e')](_['pick'](_0x50d4b7[_0x1477('0x2d')],_0x4a2772[_0x1477('0x2e')]),_0x213a1e);if(_0x50d4b7[_0x1477('0x2d')]['filter']){_0xf6ba02['where']=_[_0x1477('0x34')](_0xf6ba02['where'],{'$or':_[_0x1477('0x28')](_0x213a1e,function(_0x129aa9){if(_0x129aa9[_0x1477('0x2b')]!==_0x1477('0x35')){var _0x3a7eac={};_0x3a7eac[_0x129aa9[_0x1477('0x25')]]={'$like':'%'+_0x50d4b7[_0x1477('0x2d')][_0x1477('0x36')]+'%'};return _0x3a7eac;}})});}_0xf6ba02=_[_0x1477('0x34')]({},_0xf6ba02,_0x50d4b7[_0x1477('0x37')]);var _0x253027={'where':_0xf6ba02[_0x1477('0x33')]};return db[_0x1477('0x29')][_0x1477('0x19')](_0x253027)[_0x1477('0x21')](function(_0x20593d){_0x250171['count']=_0x20593d;if(_0x50d4b7[_0x1477('0x2d')]['includeAll']){_0xf6ba02[_0x1477('0x38')]=[{'all':!![]}];}return db[_0x1477('0x29')][_0x1477('0x39')](_0xf6ba02);})[_0x1477('0x21')](function(_0x4bbf7d){_0x250171['rows']=_0x4bbf7d;return _0x250171;})[_0x1477('0x21')](respondWithFilteredResult(_0x1ad4f7,_0xf6ba02))[_0x1477('0x3a')](handleError(_0x1ad4f7,null));};exports['show']=function(_0x70022c,_0x4e4a6f){var _0x584096={'raw':!![],'where':{'id':_0x70022c[_0x1477('0x3b')]['id']}},_0x5c96f9={};_0x5c96f9[_0x1477('0x2c')]=_[_0x1477('0x3c')](db[_0x1477('0x29')]['rawAttributes']);_0x5c96f9['query']=_[_0x1477('0x3c')](_0x70022c['query']);_0x5c96f9['filters']=_[_0x1477('0x2f')](_0x5c96f9[_0x1477('0x2c')],_0x5c96f9[_0x1477('0x2d')]);_0x584096[_0x1477('0x30')]=_[_0x1477('0x2f')](_0x5c96f9[_0x1477('0x2c')],qs[_0x1477('0x31')](_0x70022c[_0x1477('0x2d')]['fields']));_0x584096[_0x1477('0x30')]=_0x584096['attributes'][_0x1477('0x3d')]?_0x584096[_0x1477('0x30')]:_0x5c96f9[_0x1477('0x2c')];if(_0x70022c['query']['includeAll']){_0x584096[_0x1477('0x38')]=[{'all':!![]}];}_0x584096=_[_0x1477('0x34')]({},_0x584096,_0x70022c['options']);return db[_0x1477('0x29')][_0x1477('0x3e')](_0x584096)[_0x1477('0x21')](handleEntityNotFound(_0x4e4a6f,null))[_0x1477('0x21')](respondWithResult(_0x4e4a6f,null))[_0x1477('0x3a')](handleError(_0x4e4a6f,null));};exports['create']=function(_0x22066e,_0x268e9b){return db['CmHopperHistory'][_0x1477('0x3f')](_0x22066e[_0x1477('0x40')],{})[_0x1477('0x21')](respondWithResult(_0x268e9b,0xc9))[_0x1477('0x3a')](handleError(_0x268e9b,null));};exports[_0x1477('0x41')]=function(_0x38fe37,_0x321174){return db[_0x1477('0x29')][_0x1477('0x41')]()['then'](respondWithResult(_0x321174,null))[_0x1477('0x3a')](handleError(_0x321174,null));};exports[_0x1477('0x20')]=function(_0x1ce972,_0x405cfe){if(_0x1ce972[_0x1477('0x40')]['uniqueid']){delete _0x1ce972['body'][_0x1477('0x42')];}return db[_0x1477('0x29')][_0x1477('0x3e')]({'where':{'uniqueid':_0x1ce972[_0x1477('0x3b')]['id']}})[_0x1477('0x21')](handleEntityNotFound(_0x405cfe,null))[_0x1477('0x21')](saveUpdates(_0x1ce972[_0x1477('0x40')],null))['then'](respondWithResult(_0x405cfe,null))[_0x1477('0x3a')](handleError(_0x405cfe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c106884..a6701a6 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 _0xa835=['CmHopperHistory','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3cc82b,_0x259747){var _0x4d2e83=function(_0x485795){while(--_0x485795){_0x3cc82b['push'](_0x3cc82b['shift']());}};_0x4d2e83(++_0x259747);}(_0xa835,0x157));var _0x5a83=function(_0x427b3b,_0x4c82fb){_0x427b3b=_0x427b3b-0x0;var _0x54807b=_0xa835[_0x427b3b];return _0x54807b;};'use strict';var _=require('lodash');var util=require(_0x5a83('0x0'));var logger=require(_0x5a83('0x1'))(_0x5a83('0x2'));var moment=require(_0x5a83('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a83('0x4'));var rimraf=require(_0x5a83('0x5'));var config=require(_0x5a83('0x6'));var attributes=require(_0x5a83('0x7'));module[_0x5a83('0x8')]=function(_0xfd3ad9,_0x267285){return _0xfd3ad9['define'](_0x5a83('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x5a83('0xa'),'fields':[_0x5a83('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01ee=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x01ee,0x7e));var _0xe01e=function(_0x148c35,_0x9dc00a){_0x148c35=_0x148c35-0x0;var _0x50d613=_0x01ee[_0x148c35];return _0x50d613;};'use strict';var _=require(_0xe01e('0x0'));var util=require(_0xe01e('0x1'));var logger=require(_0xe01e('0x2'))(_0xe01e('0x3'));var moment=require(_0xe01e('0x4'));var BPromise=require(_0xe01e('0x5'));var rp=require(_0xe01e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe01e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe01e('0x8'));module['exports']=function(_0xf7efe5,_0x10dae3){return _0xf7efe5[_0xe01e('0x9')](_0xe01e('0xa'),attributes,{'tableName':_0xe01e('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xe01e('0xc')]},{'name':_0xe01e('0xd'),'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 de29d8f..b7f9fd0 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 _0xb1d3=['then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3797aa,_0x47ebe1){var _0x261182=function(_0x1d5b05){while(--_0x1d5b05){_0x3797aa['push'](_0x3797aa['shift']());}};_0x261182(++_0x47ebe1);}(_0xb1d3,0xcc));var _0x3b1d=function(_0x3704a1,_0x309580){_0x3704a1=_0x3704a1-0x0;var _0x39ed5a=_0xb1d3[_0x3704a1];return _0x39ed5a;};'use strict';var _=require(_0x3b1d('0x0'));var util=require('util');var moment=require(_0x3b1d('0x1'));var BPromise=require(_0x3b1d('0x2'));var rs=require(_0x3b1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b1d('0x4'));var logger=require(_0x3b1d('0x5'))(_0x3b1d('0x6'));var config=require(_0x3b1d('0x7'));var jayson=require(_0x3b1d('0x8'));var client=jayson[_0x3b1d('0x9')][_0x3b1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea7f7,_0x2a4b19,_0xcdf9e9){return new BPromise(function(_0x34377a,_0x4d0c4a){return client[_0x3b1d('0xb')](_0x4ea7f7,_0xcdf9e9)[_0x3b1d('0xc')](function(_0x25130f){logger['info'](_0x3b1d('0xd'),_0x2a4b19,_0x3b1d('0xe'));logger[_0x3b1d('0xf')](_0x3b1d('0x10'),_0x2a4b19,_0x3b1d('0xe'),JSON[_0x3b1d('0x11')](_0x25130f));if(_0x25130f['error']){if(_0x25130f[_0x3b1d('0x12')]['code']===0x1f4){logger[_0x3b1d('0x12')](_0x3b1d('0xd'),_0x2a4b19,_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);return _0x4d0c4a(_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2a4b19,_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);return _0x34377a(_0x25130f[_0x3b1d('0x12')][_0x3b1d('0x13')]);}else{logger['info'](_0x3b1d('0xd'),_0x2a4b19,_0x3b1d('0xe'));_0x34377a(_0x25130f[_0x3b1d('0x14')][_0x3b1d('0x13')]);}})[_0x3b1d('0x15')](function(_0x11dd28){logger[_0x3b1d('0x12')](_0x3b1d('0xd'),_0x2a4b19,_0x11dd28);_0x4d0c4a(_0x11dd28);});});}exports[_0x3b1d('0x16')]=function(_0x4f6a3b){var _0x5a08b1=this;return new Promise(function(_0x16dee3,_0x38e594){return db[_0x3b1d('0x17')][_0x3b1d('0x18')](_0x4f6a3b[_0x3b1d('0x19')],{'raw':_0x4f6a3b['options']?_0x4f6a3b[_0x3b1d('0x1a')][_0x3b1d('0x1b')]===undefined?!![]:![]:!![]})[_0x3b1d('0xc')](function(_0x5d2855){logger['info']('CreateCmHopperHistory',_0x4f6a3b);logger[_0x3b1d('0xf')](_0x3b1d('0x16'),_0x4f6a3b,JSON['stringify'](_0x5d2855));_0x16dee3(_0x5d2855);})[_0x3b1d('0x15')](function(_0x269934){logger[_0x3b1d('0x12')](_0x3b1d('0x16'),_0x269934['message'],_0x4f6a3b);_0x38e594(_0x5a08b1[_0x3b1d('0x12')](0x1f4,_0x269934[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x1c')]=function(_0x3ff0b9){var _0x53d835=this;return new Promise(function(_0xd3dda4,_0x58fc15){return db[_0x3b1d('0x17')][_0x3b1d('0x1d')]({'raw':_0x3ff0b9['options']?_0x3ff0b9[_0x3b1d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3ff0b9[_0x3b1d('0x1a')]?_0x3ff0b9['options'][_0x3b1d('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['col']('id')),_0x3b1d('0x21')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x23')))),_0x3b1d('0x24')],[db['sequelize']['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x26')))),_0x3b1d('0x27')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x28'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x29')))),_0x3b1d('0x2a')],[db['sequelize']['fn'](_0x3b1d('0x28'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x2b')))),_0x3b1d('0x2c')]]})['then'](function(_0x5814b3){logger[_0x3b1d('0x2d')](_0x3b1d('0x1c'),_0x3ff0b9);logger[_0x3b1d('0xf')](_0x3b1d('0x1c'),_0x3ff0b9,JSON[_0x3b1d('0x11')](_0x5814b3));_0xd3dda4(_0x5814b3);})[_0x3b1d('0x15')](function(_0x5dda57){logger['error']('AvgHandleTime',_0x5dda57['message'],_0x3ff0b9);_0x58fc15(_0x53d835[_0x3b1d('0x12')](0x1f4,_0x5dda57[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x2e')]=function(_0x2aa197){var _0x253428=this;return new Promise(function(_0xe3c8f7,_0x3a2406){return db[_0x3b1d('0x17')]['findAll']({'raw':_0x2aa197['options']?_0x2aa197['options']['raw']===undefined?!![]:![]:!![],'where':_0x2aa197['options']?_0x2aa197[_0x3b1d('0x1a')][_0x3b1d('0x1e')]||null:null,'attributes':[[_0x3b1d('0x2f'),'name'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x30')))),_0x3b1d('0x31')],[db[_0x3b1d('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x32')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x23')))),'outboundAnswerCallsDay'],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x33')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x208,\x201,\x20null'))),_0x3b1d('0x34')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3b1d('0x35')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3b1d('0x36')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize'][_0x3b1d('0x22')](_0x3b1d('0x37')))),_0x3b1d('0x38')],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x39')))),_0x3b1d('0x3a')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')]['literal'](_0x3b1d('0x3c')))),_0x3b1d('0x3d')],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db['sequelize']['literal'](_0x3b1d('0x3e')))),_0x3b1d('0x3f')],[db['sequelize']['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x40')))),_0x3b1d('0x3d')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db['sequelize']['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')](_0x3b1d('0x41')))),_0x3b1d('0x42')]],'group':['campaign']})[_0x3b1d('0xc')](function(_0x522b39){logger['info']('GetVoiceQueueHopperHistory',_0x2aa197);logger['debug'](_0x3b1d('0x2e'),_0x2aa197,JSON[_0x3b1d('0x11')](_0x522b39));_0xe3c8f7(_0x522b39);})[_0x3b1d('0x15')](function(_0x2939fc){logger[_0x3b1d('0x12')](_0x3b1d('0x2e'),_0x2939fc['message'],_0x2aa197);_0x3a2406(_0x253428['error'](0x1f4,_0x2939fc[_0x3b1d('0x13')]));});});};exports[_0x3b1d('0x43')]=function(_0x25327b){var _0x268ee6=this;return new Promise(function(_0x288bf4,_0x218381){return db[_0x3b1d('0x17')][_0x3b1d('0x1d')]({'raw':_0x25327b[_0x3b1d('0x1a')]?_0x25327b[_0x3b1d('0x1a')][_0x3b1d('0x1b')]===undefined?!![]:![]:!![],'where':_0x25327b[_0x3b1d('0x1a')]?_0x25327b['options'][_0x3b1d('0x1e')]||null:null,'attributes':[[_0x3b1d('0x2f'),_0x3b1d('0x44')],[db[_0x3b1d('0x20')]['fn']('COUNT',db[_0x3b1d('0x20')][_0x3b1d('0x45')]('id')),_0x3b1d('0x46')],[db[_0x3b1d('0x20')]['fn'](_0x3b1d('0x1f'),db[_0x3b1d('0x20')]['fn']('IF',db[_0x3b1d('0x20')][_0x3b1d('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x3b1d('0x47')]],'group':[_0x3b1d('0x2f')]})[_0x3b1d('0xc')](function(_0x41be10){logger[_0x3b1d('0x2d')](_0x3b1d('0x43'),_0x25327b);logger['debug']('GetCampaignHopperHistory',_0x25327b,JSON[_0x3b1d('0x11')](_0x41be10));_0x288bf4(_0x41be10);})[_0x3b1d('0x15')](function(_0x3f1beb){logger[_0x3b1d('0x12')](_0x3b1d('0x43'),_0x3f1beb[_0x3b1d('0x13')],_0x25327b);_0x218381(_0x268ee6['error'](0x1f4,_0x3f1beb[_0x3b1d('0x13')]));});});}; \ No newline at end of file +var _0x9706=['predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','where','sequelize','col'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9706,0xbc));var _0x6970=function(_0x356e13,_0x3e2b18){_0x356e13=_0x356e13-0x0;var _0x2c1dd6=_0x9706[_0x356e13];return _0x2c1dd6;};'use strict';var _=require(_0x6970('0x0'));var util=require(_0x6970('0x1'));var moment=require(_0x6970('0x2'));var BPromise=require(_0x6970('0x3'));var rs=require(_0x6970('0x4'));var fs=require('fs');var Redis=require(_0x6970('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6970('0x6'));var logger=require(_0x6970('0x7'))(_0x6970('0x8'));var config=require(_0x6970('0x9'));var jayson=require(_0x6970('0xa'));var client=jayson[_0x6970('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dfcfa,_0x2e6f52,_0x898a1b){return new BPromise(function(_0x59483e,_0x58d10f){return client['request'](_0x5dfcfa,_0x898a1b)[_0x6970('0xc')](function(_0x244704){logger[_0x6970('0xd')](_0x6970('0xe'),_0x2e6f52,_0x6970('0xf'));logger[_0x6970('0x10')](_0x6970('0x11'),_0x2e6f52,'request\x20sent',JSON['stringify'](_0x244704));if(_0x244704[_0x6970('0x12')]){if(_0x244704['error'][_0x6970('0x13')]===0x1f4){logger['error'](_0x6970('0xe'),_0x2e6f52,_0x244704['error'][_0x6970('0x14')]);return _0x58d10f(_0x244704[_0x6970('0x12')][_0x6970('0x14')]);}logger[_0x6970('0x12')](_0x6970('0xe'),_0x2e6f52,_0x244704[_0x6970('0x12')][_0x6970('0x14')]);return _0x59483e(_0x244704['error']['message']);}else{logger[_0x6970('0xd')](_0x6970('0xe'),_0x2e6f52,_0x6970('0xf'));_0x59483e(_0x244704[_0x6970('0x15')][_0x6970('0x14')]);}})[_0x6970('0x16')](function(_0x1b0404){logger[_0x6970('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2e6f52,_0x1b0404);_0x58d10f(_0x1b0404);});});}exports['CreateCmHopperHistory']=function(_0x3af95e){var _0x103cfa=this;return new Promise(function(_0x511684,_0x3d33b1){return db[_0x6970('0x17')][_0x6970('0x18')](_0x3af95e['body'],{'raw':_0x3af95e['options']?_0x3af95e[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![]})[_0x6970('0xc')](function(_0x3b2b40){logger['info']('CreateCmHopperHistory',_0x3af95e);logger['debug'](_0x6970('0x1b'),_0x3af95e,JSON[_0x6970('0x1c')](_0x3b2b40));_0x511684(_0x3b2b40);})['catch'](function(_0x41c493){logger['error'](_0x6970('0x1b'),_0x41c493[_0x6970('0x14')],_0x3af95e);_0x3d33b1(_0x103cfa[_0x6970('0x12')](0x1f4,_0x41c493['message']));});});};exports[_0x6970('0x1d')]=function(_0x1c51ee){var _0x5082fe=this;return new Promise(function(_0x38d670,_0x3ac3a7){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x1c51ee[_0x6970('0x19')]?_0x1c51ee[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c51ee[_0x6970('0x19')]?_0x1c51ee[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')][_0x6970('0x21')]('id')),_0x6970('0x22')],[db['sequelize']['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x25')))),_0x6970('0x26')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x6970('0x27')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x28')))),_0x6970('0x29')],[db[_0x6970('0x20')]['fn'](_0x6970('0x2a'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x2b')))),_0x6970('0x2c')],[db[_0x6970('0x20')]['fn'](_0x6970('0x2a'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x2d')))),_0x6970('0x2e')]]})[_0x6970('0xc')](function(_0x15e1c4){logger[_0x6970('0xd')](_0x6970('0x1d'),_0x1c51ee);logger[_0x6970('0x10')](_0x6970('0x1d'),_0x1c51ee,JSON['stringify'](_0x15e1c4));_0x38d670(_0x15e1c4);})[_0x6970('0x16')](function(_0x338579){logger['error']('AvgHandleTime',_0x338579['message'],_0x1c51ee);_0x3ac3a7(_0x5082fe[_0x6970('0x12')](0x1f4,_0x338579[_0x6970('0x14')]));});});};exports[_0x6970('0x2f')]=function(_0x18b432){var _0x14932f=this;return new Promise(function(_0x32b8dc,_0x5a8902){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x18b432[_0x6970('0x19')]?_0x18b432['options'][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x18b432[_0x6970('0x19')]?_0x18b432[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[['campaign',_0x6970('0x30')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x6970('0x31')],[db['sequelize']['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x6970('0x32')],[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x6970('0x33')],[db[_0x6970('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x34')))),_0x6970('0x35')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x36')))),_0x6970('0x37')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x38')))),_0x6970('0x39')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x3a')))),_0x6970('0x3b')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db['sequelize'][_0x6970('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0x6970('0x3c')],[db[_0x6970('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x3d')))),_0x6970('0x3e')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x3f')))),_0x6970('0x40')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x41')))),'outboundRejectCallsDay'],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x42')))),_0x6970('0x43')],[db['sequelize']['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x6970('0x44')],[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x45')))),_0x6970('0x46')]],'group':[_0x6970('0x47')]})[_0x6970('0xc')](function(_0x55c489){logger[_0x6970('0xd')](_0x6970('0x2f'),_0x18b432);logger[_0x6970('0x10')](_0x6970('0x2f'),_0x18b432,JSON[_0x6970('0x1c')](_0x55c489));_0x32b8dc(_0x55c489);})[_0x6970('0x16')](function(_0x491d08){logger[_0x6970('0x12')]('GetVoiceQueueHopperHistory',_0x491d08['message'],_0x18b432);_0x5a8902(_0x14932f[_0x6970('0x12')](0x1f4,_0x491d08[_0x6970('0x14')]));});});};exports[_0x6970('0x48')]=function(_0x24bdff){var _0x28d31e=this;return new Promise(function(_0xe53ea0,_0x17a98c){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x24bdff[_0x6970('0x19')]?_0x24bdff[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x24bdff[_0x6970('0x19')]?_0x24bdff[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[[_0x6970('0x47'),_0x6970('0x30')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')][_0x6970('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x25')))),_0x6970('0x49')]],'group':[_0x6970('0x47')]})[_0x6970('0xc')](function(_0x3ab1fe){logger['info'](_0x6970('0x48'),_0x24bdff);logger['debug']('GetCampaignHopperHistory',_0x24bdff,JSON['stringify'](_0x3ab1fe));_0xe53ea0(_0x3ab1fe);})['catch'](function(_0x4bdc78){logger[_0x6970('0x12')](_0x6970('0x48'),_0x4bdc78[_0x6970('0x14')],_0x24bdff);_0x17a98c(_0x28d31e[_0x6970('0x12')](0x1f4,_0x4bdc78[_0x6970('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6316bab..45e2758 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 _0x442b=['/describe','isAuthenticated','describe','/:id','show','post','create','update','exports','multer','path','express','Router','../../components/auth/service','./cmHopperHistory.controller','get','index'];(function(_0x21b4f4,_0x4ab686){var _0x97b9f1=function(_0x27225a){while(--_0x27225a){_0x21b4f4['push'](_0x21b4f4['shift']());}};_0x97b9f1(++_0x4ab686);}(_0x442b,0x6f));var _0xb442=function(_0xac989b,_0x1da105){_0xac989b=_0xac989b-0x0;var _0xabdd63=_0x442b[_0xac989b];return _0xabdd63;};'use strict';var multer=require(_0xb442('0x0'));var util=require('util');var path=require(_0xb442('0x1'));var timeout=require('connect-timeout');var express=require(_0xb442('0x2'));var router=express[_0xb442('0x3')]();var auth=require(_0xb442('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb442('0x5'));router[_0xb442('0x6')]('/',auth['isAuthenticated'](),controller[_0xb442('0x7')]);router['get'](_0xb442('0x8'),auth[_0xb442('0x9')](),controller[_0xb442('0xa')]);router['get'](_0xb442('0xb'),auth[_0xb442('0x9')](),controller[_0xb442('0xc')]);router[_0xb442('0xd')]('/',auth['isAuthenticated'](),controller[_0xb442('0xe')]);router['put'](_0xb442('0xb'),auth['isAuthenticated'](),controller[_0xb442('0xf')]);module[_0xb442('0x10')]=router; \ No newline at end of file +var _0xc82c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create','put','multer'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc82c,0x125));var _0xcc82=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc82c[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xcc82('0x0'));var util=require(_0xcc82('0x1'));var path=require('path');var timeout=require(_0xcc82('0x2'));var express=require(_0xcc82('0x3'));var router=express[_0xcc82('0x4')]();var auth=require(_0xcc82('0x5'));var interaction=require(_0xcc82('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xcc82('0x7')](),controller[_0xcc82('0x8')]);router['get']('/describe',auth[_0xcc82('0x7')](),controller['describe']);router[_0xcc82('0x9')](_0xcc82('0xa'),auth[_0xcc82('0x7')](),controller['show']);router[_0xcc82('0xb')]('/',auth[_0xcc82('0x7')](),controller[_0xcc82('0xc')]);router[_0xcc82('0xd')](_0xcc82('0xa'),auth[_0xcc82('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c3be19c..6607ce8 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 _0xcf44=['sequelize','exports','STRING'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0xcf44,0xba));var _0x4cf4=function(_0x52daca,_0x9a8d43){_0x52daca=_0x52daca-0x0;var _0x3abe0b=_0xcf44[_0x52daca];return _0x3abe0b;};'use strict';var Sequelize=require(_0x4cf4('0x0'));module[_0x4cf4('0x1')]={'name':{'type':Sequelize[_0x4cf4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4cf4('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f9d=['name','sequelize','exports','STRING'];(function(_0x24bd96,_0x260e8f){var _0x5bfdd7=function(_0x3dda59){while(--_0x3dda59){_0x24bd96['push'](_0x24bd96['shift']());}};_0x5bfdd7(++_0x260e8f);}(_0x6f9d,0x191));var _0xd6f9=function(_0xb96f50,_0xa21d9b){_0xb96f50=_0xb96f50-0x0;var _0x1caf5d=_0x6f9d[_0xb96f50];return _0x1caf5d;};'use strict';var Sequelize=require(_0xd6f9('0x0'));module[_0xd6f9('0x1')]={'name':{'type':Sequelize[_0xd6f9('0x2')],'unique':_0xd6f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd6f9('0x2')]},'dialPrefix':{'type':Sequelize[_0xd6f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aa81dc9..23436ea 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 _0x3f20=['./cmList.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','Lists','UserProfileResource','name','send','index','map','CmList','fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','role','get','userProfileId','autoAssociation','error','find','describe','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x4e073b,_0x3bba61){var _0x33dfe1=function(_0x5c9628){while(--_0x5c9628){_0x4e073b['push'](_0x4e073b['shift']());}};_0x33dfe1(++_0x3bba61);}(_0x3f20,0x102));var _0x03f2=function(_0x1bea85,_0x491bc3){_0x1bea85=_0x1bea85-0x0;var _0xe0a6c4=_0x3f20[_0x1bea85];return _0xe0a6c4;};'use strict';var pdf=require(_0x03f2('0x0'));var emlformat=require(_0x03f2('0x1'));var rimraf=require(_0x03f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03f2('0x3'));var rp=require(_0x03f2('0x4'));var moment=require(_0x03f2('0x5'));var BPromise=require(_0x03f2('0x6'));var Mustache=require(_0x03f2('0x7'));var util=require(_0x03f2('0x8'));var path=require('path');var sox=require(_0x03f2('0x9'));var csv=require(_0x03f2('0xa'));var ejs=require(_0x03f2('0xb'));var fs=require('fs');var _=require(_0x03f2('0xc'));var squel=require(_0x03f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x03f2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x03f2('0xa'));var querystring=require(_0x03f2('0xf'));var Papa=require(_0x03f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03f2('0x11'));var as=require(_0x03f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03f2('0x13'))(_0x03f2('0x14'));var utils=require('../../config/utils');var config=require(_0x03f2('0x15'));var licenseUtil=require(_0x03f2('0x16'));var db=require(_0x03f2('0x17'))['db'];config[_0x03f2('0x18')]=_[_0x03f2('0x19')](config[_0x03f2('0x18')],{'host':_0x03f2('0x1a'),'port':0x18eb});var socket=require(_0x03f2('0x1b'))(new Redis(config[_0x03f2('0x18')]));require(_0x03f2('0x1c'))[_0x03f2('0x1d')](socket);function respondWithStatusCode(_0x3e35a0,_0x54588c){_0x54588c=_0x54588c||0xcc;return function(_0x33d7e3){if(_0x33d7e3){return _0x3e35a0[_0x03f2('0x1e')](_0x54588c);}return _0x3e35a0['status'](_0x54588c)[_0x03f2('0x1f')]();};}function respondWithResult(_0x42fbf5,_0xdd5789){_0xdd5789=_0xdd5789||0xc8;return function(_0x3a3206){if(_0x3a3206){return _0x42fbf5[_0x03f2('0x20')](_0xdd5789)[_0x03f2('0x21')](_0x3a3206);}};}function respondWithFilteredResult(_0x5ca41a,_0x4f5843){return function(_0x2a0e25){if(_0x2a0e25){var _0x521435=_0x2a0e25[_0x03f2('0x22')],_0x26bf5c=_0x4f5843[_0x03f2('0x23')],_0x21abec=_0x4f5843[_0x03f2('0x23')]+_0x4f5843['limit'],_0x246f98;if(_0x21abec>=_0x521435){_0x21abec=_0x521435;_0x246f98=0xc8;}else{_0x246f98=0xce;}_0x5ca41a[_0x03f2('0x20')](_0x246f98);return _0x5ca41a[_0x03f2('0x24')](_0x03f2('0x25'),_0x26bf5c+'-'+_0x21abec+'/'+_0x521435)[_0x03f2('0x21')](_0x2a0e25);}return null;};}function patchUpdates(_0x46a28d){return function(_0x22f4ae){try{jsonpatch['apply'](_0x22f4ae,_0x46a28d,!![]);}catch(_0x5ace09){return BPromise[_0x03f2('0x26')](_0x5ace09);}return _0x22f4ae[_0x03f2('0x27')]();};}function saveUpdates(_0x56b777,_0x5bf0dc){return function(_0x401a4d){if(_0x401a4d){return _0x401a4d[_0x03f2('0x28')](_0x56b777)[_0x03f2('0x29')](function(_0x3fe27b){return _0x3fe27b;});}return null;};}function removeEntity(_0x4cadc7,_0x249dc5){return function(_0x4f5d15){if(_0x4f5d15){return _0x4f5d15[_0x03f2('0x2a')]()[_0x03f2('0x29')](function(){var _0x44ec31=_0x4f5d15['get']({'plain':!![]});var _0x5f599a=_0x03f2('0x2b');return db[_0x03f2('0x2c')][_0x03f2('0x2a')]({'where':{'type':_0x5f599a,'resourceId':_0x44ec31['id']}})[_0x03f2('0x29')](function(){return _0x4f5d15;});})['then'](function(){_0x4cadc7[_0x03f2('0x20')](0xcc)[_0x03f2('0x1f')]();});}};}function handleEntityNotFound(_0x4006e2,_0x597318){return function(_0x34ed53){if(!_0x34ed53){_0x4006e2[_0x03f2('0x1e')](0x194);}return _0x34ed53;};}function handleError(_0x2683ac,_0xcbdca3){_0xcbdca3=_0xcbdca3||0x1f4;return function(_0x53e9ee){logger['error'](_0x53e9ee['stack']);if(_0x53e9ee['name']){delete _0x53e9ee[_0x03f2('0x2d')];}_0x2683ac[_0x03f2('0x20')](_0xcbdca3)[_0x03f2('0x2e')](_0x53e9ee);};}exports[_0x03f2('0x2f')]=function(_0xe4ce58,_0x13627e){var _0x56f452={},_0x33c951={},_0x4a0306={'count':0x0,'rows':[]};var _0x1a689b=_[_0x03f2('0x30')](db[_0x03f2('0x31')]['rawAttributes'],function(_0x427c13){return{'name':_0x427c13[_0x03f2('0x32')],'type':_0x427c13['type'][_0x03f2('0x33')]};});_0x33c951['model']=_[_0x03f2('0x30')](_0x1a689b,_0x03f2('0x2d'));_0x33c951['query']=_[_0x03f2('0x34')](_0xe4ce58[_0x03f2('0x35')]);_0x33c951['filters']=_[_0x03f2('0x36')](_0x33c951[_0x03f2('0x37')],_0x33c951[_0x03f2('0x35')]);_0x56f452['attributes']=_[_0x03f2('0x36')](_0x33c951[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x38')]));_0x56f452['attributes']=_0x56f452[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x56f452[_0x03f2('0x39')]:_0x33c951[_0x03f2('0x37')];if(!_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3b')](_0x03f2('0x3c'))){_0x56f452[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3d')]);_0x56f452['offset']=qs[_0x03f2('0x23')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x23')]);}_0x56f452[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x56f452[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0xe4ce58[_0x03f2('0x35')],_0x33c951['filters']),_0x1a689b);if(_0xe4ce58['query'][_0x03f2('0x43')]){_0x56f452[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x56f452[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x1a689b,function(_0x31cc8a){if(_0x31cc8a[_0x03f2('0x45')]!=='VIRTUAL'){var _0x4145e9={};_0x4145e9[_0x31cc8a[_0x03f2('0x2d')]]={'$like':'%'+_0xe4ce58[_0x03f2('0x35')][_0x03f2('0x43')]+'%'};return _0x4145e9;}})});}_0x56f452=_[_0x03f2('0x44')]({},_0x56f452,_0xe4ce58[_0x03f2('0x46')]);var _0x34e4ad={'where':_0x56f452[_0x03f2('0x40')]};return db[_0x03f2('0x31')][_0x03f2('0x22')](_0x34e4ad)[_0x03f2('0x29')](function(_0x24c8df){_0x4a0306[_0x03f2('0x22')]=_0x24c8df;if(_0xe4ce58[_0x03f2('0x35')]['includeAll']){_0x56f452[_0x03f2('0x47')]=[{'all':!![]}];}return db[_0x03f2('0x31')][_0x03f2('0x48')](_0x56f452);})['then'](function(_0x2573f1){_0x4a0306[_0x03f2('0x49')]=_0x2573f1;return _0x4a0306;})['then'](respondWithFilteredResult(_0x13627e,_0x56f452))[_0x03f2('0x4a')](handleError(_0x13627e,null));};exports[_0x03f2('0x4b')]=function(_0x519683,_0x4d91f5){var _0x33b698={'raw':![],'where':{'id':_0x519683[_0x03f2('0x4c')]['id']}},_0xc82696={};_0xc82696['model']=_[_0x03f2('0x34')](db[_0x03f2('0x31')][_0x03f2('0x4d')]);_0xc82696[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x519683[_0x03f2('0x35')]);_0xc82696[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0xc82696['model'],_0xc82696[_0x03f2('0x35')]);_0x33b698[_0x03f2('0x39')]=_['intersection'](_0xc82696[_0x03f2('0x37')],qs['fields'](_0x519683[_0x03f2('0x35')][_0x03f2('0x38')]));_0x33b698[_0x03f2('0x39')]=_0x33b698[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x33b698['attributes']:_0xc82696[_0x03f2('0x37')];if(_0x519683[_0x03f2('0x35')][_0x03f2('0x4e')]){_0x33b698[_0x03f2('0x47')]=[{'all':!![]}];}_0x33b698=_['merge']({},_0x33b698,_0x519683['options']);return db['CmList']['find'](_0x33b698)['then'](handleEntityNotFound(_0x4d91f5,null))[_0x03f2('0x29')](respondWithResult(_0x4d91f5,null))[_0x03f2('0x4a')](handleError(_0x4d91f5,null));};exports['create']=function(_0x396a5c,_0x24c54f){return db[_0x03f2('0x31')][_0x03f2('0x4f')](_0x396a5c[_0x03f2('0x50')],{})[_0x03f2('0x29')](function(_0x5ef86a){var _0xab64eb=_0x396a5c[_0x03f2('0x51')]['get']({'plain':!![]});if(!_0xab64eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xab64eb[_0x03f2('0x52')]==='user'){var _0x59f621=_0x5ef86a[_0x03f2('0x53')]({'plain':!![]});var _0x1bfb22='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x1bfb22,'userProfileId':_0xab64eb[_0x03f2('0x54')]},'raw':!![]})[_0x03f2('0x29')](function(_0x34cc6f){if(_0x34cc6f&&_0x34cc6f[_0x03f2('0x55')]===0x0){return db[_0x03f2('0x2c')][_0x03f2('0x4f')]({'name':_0x59f621['name'],'resourceId':_0x59f621['id'],'type':_0x34cc6f[_0x03f2('0x2d')],'sectionId':_0x34cc6f['id']},{})[_0x03f2('0x29')](function(){return _0x5ef86a;});}else{return _0x5ef86a;}})[_0x03f2('0x4a')](function(_0x2b96f4){logger[_0x03f2('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b96f4);throw _0x2b96f4;});}return _0x5ef86a;})['then'](respondWithResult(_0x24c54f,0xc9))[_0x03f2('0x4a')](handleError(_0x24c54f,null));};exports[_0x03f2('0x28')]=function(_0x282b89,_0x25b12e){if(_0x282b89[_0x03f2('0x50')]['id']){delete _0x282b89[_0x03f2('0x50')]['id'];}return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x282b89[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x25b12e,null))[_0x03f2('0x29')](saveUpdates(_0x282b89[_0x03f2('0x50')],null))[_0x03f2('0x29')](respondWithResult(_0x25b12e,null))['catch'](handleError(_0x25b12e,null));};exports[_0x03f2('0x2a')]=function(_0x41b3e4,_0x2f339d){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x41b3e4[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x2f339d,null))[_0x03f2('0x29')](removeEntity(_0x2f339d,null))[_0x03f2('0x4a')](handleError(_0x2f339d,null));};exports['describe']=function(_0x42f1eb,_0x1d77b5){return db[_0x03f2('0x31')][_0x03f2('0x58')]()['then'](respondWithResult(_0x1d77b5,null))[_0x03f2('0x4a')](handleError(_0x1d77b5,null));};exports['addDisposition']=function(_0x1cbaaa,_0x3d5a28,_0x387b1d){if(_0x1cbaaa[_0x03f2('0x50')]['id']){delete _0x1cbaaa[_0x03f2('0x50')]['id'];}return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x1cbaaa[_0x03f2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d5a28,null))[_0x03f2('0x29')](function(_0x123a04){if(_0x123a04){_0x1cbaaa['body'][_0x03f2('0x59')]=_0x123a04['id'];return db['Disposition'][_0x03f2('0x4f')](_0x1cbaaa['body']);}})[_0x03f2('0x29')](respondWithResult(_0x3d5a28,null))[_0x03f2('0x4a')](handleError(_0x3d5a28,null));};exports[_0x03f2('0x5a')]=function(_0x398a5a,_0x34c774,_0x2e19fe){var _0x166389={'raw':![],'where':{}};var _0x4f8d0b={};var _0x51bc7c={'count':0x0,'rows':[]};return db[_0x03f2('0x31')][_0x03f2('0x5b')]({'where':{'id':_0x398a5a[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x34c774,null))[_0x03f2('0x29')](function(_0x18b824){if(_0x18b824){_0x4f8d0b[_0x03f2('0x37')]=_[_0x03f2('0x34')](db['Disposition'][_0x03f2('0x4d')]);_0x4f8d0b[_0x03f2('0x35')]=_['keys'](_0x398a5a[_0x03f2('0x35')]);_0x4f8d0b[_0x03f2('0x41')]=_['intersection'](_0x4f8d0b[_0x03f2('0x37')],_0x4f8d0b['query']);_0x166389[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x4f8d0b[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x398a5a['query']['fields']));_0x166389[_0x03f2('0x39')]=_0x166389[_0x03f2('0x39')]['length']?_0x166389[_0x03f2('0x39')]:_0x4f8d0b[_0x03f2('0x37')];if(!_0x398a5a[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x166389['limit']=qs['limit'](_0x398a5a[_0x03f2('0x35')]['limit']);_0x166389['offset']=qs['offset'](_0x398a5a['query'][_0x03f2('0x23')]);}_0x166389['order']=qs[_0x03f2('0x3f')](_0x398a5a[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x166389[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0x398a5a[_0x03f2('0x35')],_0x4f8d0b[_0x03f2('0x41')]));_0x166389[_0x03f2('0x40')]['ListId']=_0x18b824['id'];if(_0x398a5a[_0x03f2('0x35')][_0x03f2('0x43')]){_0x166389['where']=_['merge'](_0x166389['where'],{'$or':_[_0x03f2('0x30')](_0x166389[_0x03f2('0x39')],function(_0x132071){var _0x2576d8={};_0x2576d8[_0x132071]={'$like':'%'+_0x398a5a[_0x03f2('0x35')][_0x03f2('0x43')]+'%'};return _0x2576d8;})});}_0x166389=_[_0x03f2('0x44')]({},_0x166389,_0x398a5a['options']);return db[_0x03f2('0x5c')][_0x03f2('0x22')]({'where':_0x166389[_0x03f2('0x40')]})[_0x03f2('0x29')](function(_0x341c0e){_0x51bc7c[_0x03f2('0x22')]=_0x341c0e;if(_0x398a5a[_0x03f2('0x35')]['includeAll']){_0x166389['include']=[{'all':!![]}];}return db[_0x03f2('0x5c')][_0x03f2('0x48')](_0x166389);})['then'](function(_0x439238){_0x51bc7c[_0x03f2('0x49')]=_0x439238;return _0x51bc7c;});}})[_0x03f2('0x29')](respondWithFilteredResult(_0x34c774,_0x166389))[_0x03f2('0x4a')](handleError(_0x34c774,null));};exports[_0x03f2('0x5d')]=function(_0x35613b,_0x18ea22,_0x525ab3){return db[_0x03f2('0x31')]['find']({'where':{'id':_0x35613b[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x18ea22,null))[_0x03f2('0x29')](function(_0x2b4464){if(_0x2b4464){return _0x2b4464['removeDispositions'](_0x35613b['query'][_0x03f2('0x5e')]);}})[_0x03f2('0x29')](respondWithStatusCode(_0x18ea22,null))[_0x03f2('0x4a')](handleError(_0x18ea22,null));};exports[_0x03f2('0x5f')]=function(_0x1ae4bc,_0x126ef9,_0x5d60c6){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x1ae4bc['params']['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x126ef9,null))[_0x03f2('0x29')](function(_0x499728){if(_0x499728){var _0x4ecded=[];var _0x27e56c={'success':[],'errors':[]};return db[_0x03f2('0x60')][_0x03f2('0x58')]()[_0x03f2('0x29')](function(_0x1b80e8){if(_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]&&_['isArray'](_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')])){if(_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')][_0x03f2('0x3a')]){_0x1ae4bc['body'][_0x03f2('0x61')]=_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]['join'](';')+';';}else{_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]=null;}}else{_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x61')]=null;}if(_0x1ae4bc[_0x03f2('0x50')]&&_[_0x03f2('0x62')](_0x1ae4bc[_0x03f2('0x50')])){for(var _0x205eda=0x0;_0x205eda<_0x1ae4bc[_0x03f2('0x50')][_0x03f2('0x3a')];_0x205eda+=0x1){_0x1ae4bc[_0x03f2('0x50')][_0x205eda][_0x03f2('0x59')]=_0x1ae4bc[_0x03f2('0x4c')]['id'];_0x4ecded[_0x03f2('0x63')](_0x1ae4bc[_0x03f2('0x50')][_0x205eda]);}return BPromise[_0x03f2('0x64')](_0x4ecded,function(_0x43a232){return db[_0x03f2('0x60')][_0x03f2('0x4f')](_['omit'](_0x43a232,[_0x03f2('0x5e'),'id'])||{},{'fields':_['keys'](_0x1b80e8),'raw':!![]})['then'](function(_0x478dc0){_0x27e56c['success'][_0x03f2('0x63')](_0x478dc0[_0x03f2('0x65')]);})[_0x03f2('0x4a')](function(_0x4a57db){_0x27e56c['errors'][_0x03f2('0x63')]({'data':_0x43a232,'error':_0x4a57db['message']});});})[_0x03f2('0x29')](function(_0x4d403f){return _0x27e56c;})[_0x03f2('0x4a')](function(_0x57f623){return _0x57f623;});}else{_0x126ef9[_0x03f2('0x20')](0x190)['json']({'message':_0x03f2('0x66')});}});}})['then'](respondWithResult(_0x126ef9,null))['catch'](handleError(_0x126ef9,null));};exports[_0x03f2('0x67')]=function(_0x523d45,_0x557316,_0x1f4a6b){var _0x1a23cf;return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x523d45['params']['id']},'include':[{'model':db[_0x03f2('0x68')],'as':_0x03f2('0x69')}]})[_0x03f2('0x29')](handleEntityNotFound(_0x557316,null))[_0x03f2('0x29')](function(_0x520c15){if(_0x520c15){_0x1a23cf=_0x520c15;return db[_0x03f2('0x60')]['rawAttributes'];}})[_0x03f2('0x29')](function(_0x3382be){if(_0x3382be){var _0x3134fb={};var _0x413047={};_0x413047[_0x03f2('0x37')]=_[_0x03f2('0x6a')](_[_0x03f2('0x34')](_0x3382be),_[_0x03f2('0x30')](_0x1a23cf[_0x03f2('0x69')],function(_0x2453dc){return util[_0x03f2('0x6b')](_0x03f2('0x6c'),_0x2453dc['id']);}));_0x413047[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x523d45[_0x03f2('0x35')]);_0x413047[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0x413047['model'],_0x413047[_0x03f2('0x35')]);_0x3134fb[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x413047[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x523d45[_0x03f2('0x35')][_0x03f2('0x38')]));_0x3134fb[_0x03f2('0x39')]=_0x3134fb['attributes'][_0x03f2('0x3a')]?_0x3134fb[_0x03f2('0x39')]:_0x413047[_0x03f2('0x37')];if(!_0x523d45[_0x03f2('0x35')][_0x03f2('0x3b')](_0x03f2('0x3c'))){_0x3134fb[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0x523d45[_0x03f2('0x35')]['limit']);_0x3134fb[_0x03f2('0x23')]=qs[_0x03f2('0x23')](_0x523d45[_0x03f2('0x35')]['offset']);}_0x3134fb[_0x03f2('0x3e')]=qs['sort'](_0x523d45['query'][_0x03f2('0x3f')]);_0x3134fb[_0x03f2('0x40')]=qs['filters'](_[_0x03f2('0x42')](_0x523d45[_0x03f2('0x35')],_0x413047['filters']));_0x3134fb[_0x03f2('0x6d')]=!![];if(_0x523d45[_0x03f2('0x35')]['filter']){_0x3134fb[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x3134fb[_0x03f2('0x40')],{'$or':_['map'](_0x3134fb[_0x03f2('0x39')],function(_0x4f846a){var _0x141877={};_0x141877[_0x4f846a]={'$like':'%'+_0x523d45[_0x03f2('0x35')]['filter']+'%'};return _0x141877;})});}_0x3134fb=_[_0x03f2('0x44')]({},_0x3134fb,_0x523d45[_0x03f2('0x46')]);return _0x1a23cf[_0x03f2('0x67')](_0x3134fb);}})[_0x03f2('0x29')](respondWithResult(_0x557316,null))[_0x03f2('0x4a')](handleError(_0x557316,null));};exports[_0x03f2('0x6e')]=function(_0x79b814,_0xdd0caa,_0x5602b0){var _0x47cec0;return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x79b814[_0x03f2('0x4c')]['id']},'include':[{'model':db[_0x03f2('0x68')],'as':'CustomFields'}]})[_0x03f2('0x29')](handleEntityNotFound(_0xdd0caa,null))[_0x03f2('0x29')](function(_0x31bde7){if(_0x31bde7){_0x47cec0=_0x31bde7;return db['CmContact'][_0x03f2('0x4d')];}})[_0x03f2('0x29')](function(_0xe0cbf){if(_0xe0cbf){var _0x4b0675={};var _0x3d514a={};_0x3d514a['model']=_['concat'](_[_0x03f2('0x34')](_0xe0cbf),_['map'](_0x47cec0[_0x03f2('0x69')],function(_0x58fe36){return util[_0x03f2('0x6b')](_0x03f2('0x6c'),_0x58fe36['id']);}));_0x3d514a['query']=_[_0x03f2('0x34')](_0x79b814[_0x03f2('0x35')]);_0x3d514a[_0x03f2('0x41')]=_['intersection'](_0x3d514a[_0x03f2('0x37')],_0x3d514a[_0x03f2('0x35')]);_0x4b0675[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x3d514a[_0x03f2('0x37')],qs['fields'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x38')]));_0x4b0675[_0x03f2('0x39')]=_0x4b0675[_0x03f2('0x39')]['length']?_0x4b0675[_0x03f2('0x39')]:_0x3d514a['model'];if(!_0x79b814[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x4b0675[_0x03f2('0x3d')]=qs[_0x03f2('0x3d')](_0x79b814[_0x03f2('0x35')][_0x03f2('0x3d')]);_0x4b0675[_0x03f2('0x23')]=qs['offset'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x23')]);}_0x4b0675[_0x03f2('0x3e')]=qs['sort'](_0x79b814[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x4b0675[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_[_0x03f2('0x42')](_0x79b814['query'],_0x3d514a[_0x03f2('0x41')]));_0x4b0675['raw']=!![];if(_0x79b814[_0x03f2('0x35')][_0x03f2('0x43')]){_0x4b0675[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x4b0675['where'],{'$or':_[_0x03f2('0x30')](_0x4b0675[_0x03f2('0x39')],function(_0xad0eae){var _0x4ea681={};_0x4ea681[_0xad0eae]={'$like':'%'+_0x79b814[_0x03f2('0x35')]['filter']+'%'};return _0x4ea681;})});}_0x4b0675=_[_0x03f2('0x44')]({},_0x4b0675,_0x79b814[_0x03f2('0x46')]);return _0x47cec0[_0x03f2('0x67')](_0x4b0675);}})[_0x03f2('0x29')](function(_0xfa23e9){if(!_[_0x03f2('0x6f')](_0xfa23e9)){var _0x432bba=toCsv(_0xfa23e9);var _0x1a744f=Date[_0x03f2('0x70')]();fs[_0x03f2('0x71')](util['format'](_0x03f2('0x72'),_0x47cec0['id'],_0x1a744f),_0x432bba);_0xdd0caa[_0x03f2('0x73')]('Content-disposition',_0x03f2('0x74')+util[_0x03f2('0x6b')](_0x03f2('0x75'),_0x47cec0['id'],_0x1a744f));_0xdd0caa[_0x03f2('0x73')](_0x03f2('0x76'),_0x03f2('0x77'));return _0xdd0caa[_0x03f2('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x47cec0['id'],_0x1a744f));}else{return _0xdd0caa[_0x03f2('0x1e')](0xcc);}})['catch'](handleError(_0xdd0caa,null));};exports[_0x03f2('0x79')]=function(_0x2ed243,_0x7b1dd5,_0x3f08ee){var _0x31e66a;delete _0x2ed243[_0x03f2('0x50')]['id'];return db[_0x03f2('0x31')]['findOne']({'where':{'id':_0x2ed243[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x7b1dd5,null))[_0x03f2('0x29')](function(_0x10b436){if(_0x10b436){return db[_0x03f2('0x7a')]['transaction'](function(_0x3e7ff5){return db[_0x03f2('0x68')]['create'](_0x2ed243[_0x03f2('0x50')],{'transaction':_0x3e7ff5})['then'](function(_0xaee921){_0x31e66a=_0xaee921;return _0x10b436['addCustomFields'](_0xaee921,{'transaction':_0x3e7ff5});})[_0x03f2('0x29')](function(){var _0x4ef507={'type':db[_0x03f2('0x7b')][_0x03f2('0x7c')],'transaction':_0x3e7ff5};switch(_0x2ed243[_0x03f2('0x50')][_0x03f2('0x45')]){case _0x03f2('0x7d'):_0x4ef507[_0x03f2('0x45')]=db['Sequelize'][_0x03f2('0x7c')];break;case _0x03f2('0x7e'):_0x4ef507[_0x03f2('0x45')]=db[_0x03f2('0x7b')][_0x03f2('0x7f')];break;case'switch':_0x4ef507[_0x03f2('0x45')]=db[_0x03f2('0x7b')][_0x03f2('0x80')];_0x4ef507[_0x03f2('0x81')]=![];break;default:}return db[_0x03f2('0x7a')][_0x03f2('0x82')]['addColumn'](_0x03f2('0x83'),util[_0x03f2('0x6b')](_0x03f2('0x84'),_0x31e66a['id']),_0x4ef507);})['then'](function(){return _0x31e66a;});});}})[_0x03f2('0x29')](respondWithResult(_0x7b1dd5,null))[_0x03f2('0x4a')](handleError(_0x7b1dd5,null));};exports[_0x03f2('0x85')]=function(_0x553bc0,_0x22782e,_0x2fa7ec){var _0x3b3abb={};var _0x4e5796={};var _0x3bed94;var _0x564028;return db[_0x03f2('0x31')]['findOne']({'where':{'id':_0x553bc0[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x22782e,null))[_0x03f2('0x29')](function(_0x493cb2){if(_0x493cb2){_0x3bed94=_0x493cb2;_0x4e5796[_0x03f2('0x37')]=_['keys'](db[_0x03f2('0x68')]['rawAttributes']);_0x4e5796[_0x03f2('0x35')]=_['keys'](_0x553bc0[_0x03f2('0x35')]);_0x4e5796[_0x03f2('0x41')]=_[_0x03f2('0x36')](_0x4e5796['model'],_0x4e5796['query']);_0x3b3abb['attributes']=_[_0x03f2('0x36')](_0x4e5796[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x553bc0['query'][_0x03f2('0x38')]));_0x3b3abb[_0x03f2('0x39')]=_0x3b3abb['attributes'][_0x03f2('0x3a')]?_0x3b3abb['attributes']:_0x4e5796[_0x03f2('0x37')];_0x3b3abb[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0x553bc0[_0x03f2('0x35')][_0x03f2('0x3f')]);_0x3b3abb[_0x03f2('0x40')]=qs[_0x03f2('0x41')](_['pick'](_0x553bc0['query'],_0x4e5796[_0x03f2('0x41')]));_0x3b3abb[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x3b3abb[_0x03f2('0x40')],{'$or':[{'ListId':_0x493cb2['id']},{'ListId':null}]});if(_0x553bc0[_0x03f2('0x35')][_0x03f2('0x43')]){_0x3b3abb[_0x03f2('0x40')]=_['merge'](_0x3b3abb[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x3b3abb['attributes'],function(_0x16853d){var _0xc05d7f={};_0xc05d7f[_0x16853d]={'$like':'%'+_0x553bc0[_0x03f2('0x35')]['filter']+'%'};return _0xc05d7f;})});}_0x3b3abb=_[_0x03f2('0x44')]({},_0x3b3abb,_0x553bc0[_0x03f2('0x46')]);return db[_0x03f2('0x68')][_0x03f2('0x86')](_0x3b3abb);}})[_0x03f2('0x29')](respondWithResult(_0x22782e,null))[_0x03f2('0x4a')](handleError(_0x22782e,null));};exports[_0x03f2('0x87')]=function(_0x214acd,_0x3b30d3,_0x5e0cc3){return db[_0x03f2('0x31')]['find']({'where':{'id':_0x214acd['params']['id']}})['then'](handleEntityNotFound(_0x3b30d3,null))['then'](function(_0x33cc2a){if(_0x33cc2a){return _0x33cc2a[_0x03f2('0x87')](_0x214acd[_0x03f2('0x50')][_0x03f2('0x5e')],_[_0x03f2('0x88')](_0x214acd['body'],[_0x03f2('0x5e'),'id'])||{})[_0x03f2('0x89')](function(_0x4dfacd){for(var _0x3d481e=0x0;_0x3d481e<_0x214acd['body'][_0x03f2('0x5e')][_0x03f2('0x3a')];_0x3d481e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x214acd[_0x03f2('0x50')]['ids'][_0x3d481e],'CmListId':_0x214acd[_0x03f2('0x4c')]['id']});}return _0x4dfacd;});}})['then'](respondWithResult(_0x3b30d3,null))[_0x03f2('0x4a')](handleError(_0x3b30d3,null));};exports['removeAgents']=function(_0x5517fa,_0x26e224,_0x5258fa){return db[_0x03f2('0x31')][_0x03f2('0x57')]({'where':{'id':_0x5517fa['params']['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x26e224,null))[_0x03f2('0x29')](function(_0x2efa2b){if(_0x2efa2b){return _0x2efa2b[_0x03f2('0x8a')](_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')])[_0x03f2('0x29')](function(){if(_['isArray'](_0x5517fa['query'][_0x03f2('0x5e')])){for(var _0x122a77=0x0;_0x122a77<_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')][_0x03f2('0x3a')];_0x122a77+=0x1){socket[_0x03f2('0x8b')](_0x03f2('0x8c'),{'UserId':Number(_0x5517fa[_0x03f2('0x35')]['ids'][_0x122a77]),'CmListId':Number(_0x5517fa[_0x03f2('0x4c')]['id'])});}}else{socket['emit'](_0x03f2('0x8c'),{'UserId':Number(_0x5517fa[_0x03f2('0x35')][_0x03f2('0x5e')]),'CmListId':Number(_0x5517fa['params']['id'])});}});}})[_0x03f2('0x29')](respondWithStatusCode(_0x26e224,null))[_0x03f2('0x4a')](handleError(_0x26e224,null));};exports[_0x03f2('0x8d')]=function(_0x1c0d1f,_0x5755ee,_0x5c0e65){var _0x1f2add={};var _0x1e45c5={};var _0x31cabb;var _0x336b2c;return db[_0x03f2('0x31')][_0x03f2('0x5b')]({'where':{'id':_0x1c0d1f[_0x03f2('0x4c')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x5755ee,null))[_0x03f2('0x29')](function(_0x517c60){if(_0x517c60){_0x31cabb=_0x517c60;_0x1e45c5['model']=_[_0x03f2('0x34')](db[_0x03f2('0x8e')]['rawAttributes']);_0x1e45c5[_0x03f2('0x35')]=_[_0x03f2('0x34')](_0x1c0d1f[_0x03f2('0x35')]);_0x1e45c5[_0x03f2('0x41')]=_['intersection'](_0x1e45c5[_0x03f2('0x37')],_0x1e45c5[_0x03f2('0x35')]);_0x1f2add[_0x03f2('0x39')]=_[_0x03f2('0x36')](_0x1e45c5[_0x03f2('0x37')],qs[_0x03f2('0x38')](_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x38')]));_0x1f2add[_0x03f2('0x39')]=_0x1f2add[_0x03f2('0x39')][_0x03f2('0x3a')]?_0x1f2add['attributes']:_0x1e45c5[_0x03f2('0x37')];_0x1f2add[_0x03f2('0x3e')]=qs[_0x03f2('0x3f')](_0x1c0d1f[_0x03f2('0x35')]['sort']);_0x1f2add[_0x03f2('0x40')]=qs['filters'](_[_0x03f2('0x42')](_0x1c0d1f[_0x03f2('0x35')],_0x1e45c5['filters']));if(_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x43')]){_0x1f2add[_0x03f2('0x40')]=_[_0x03f2('0x44')](_0x1f2add[_0x03f2('0x40')],{'$or':_[_0x03f2('0x30')](_0x1f2add[_0x03f2('0x39')],function(_0x1206fb){var _0x22d10f={};_0x22d10f[_0x1206fb]={'$like':'%'+_0x1c0d1f[_0x03f2('0x35')]['filter']+'%'};return _0x22d10f;})});}_0x1f2add=_['merge']({},_0x1f2add,_0x1c0d1f[_0x03f2('0x46')]);return _0x31cabb[_0x03f2('0x8d')](_0x1f2add);}})[_0x03f2('0x29')](function(_0x43dbc0){if(_0x43dbc0){_0x336b2c=_0x43dbc0['length'];if(!_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x3b')]('nolimit')){_0x1f2add['limit']=qs[_0x03f2('0x3d')](_0x1c0d1f['query'][_0x03f2('0x3d')]);_0x1f2add[_0x03f2('0x23')]=qs['offset'](_0x1c0d1f[_0x03f2('0x35')][_0x03f2('0x23')]);}return _0x31cabb[_0x03f2('0x8d')](_0x1f2add);}})[_0x03f2('0x29')](function(_0x1c42e8){if(_0x1c42e8){return _0x1c42e8?{'count':_0x336b2c,'rows':_0x1c42e8}:null;}})[_0x03f2('0x29')](respondWithResult(_0x5755ee,null))[_0x03f2('0x4a')](handleError(_0x5755ee,null));}; \ No newline at end of file +var _0x2cb4=['filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','order','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','pick','raw','getContactsCsv','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./cmList.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','then','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5f51b2,_0x5ac502){var _0x7a4006=function(_0x5e93b0){while(--_0x5e93b0){_0x5f51b2['push'](_0x5f51b2['shift']());}};_0x7a4006(++_0x5ac502);}(_0x2cb4,0x176));var _0x42cb=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x2cb4[_0x58381c];return _0x1a7440;};'use strict';var pdf=require(_0x42cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42cb('0x1'));var zipdir=require(_0x42cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42cb('0x3'));var moment=require(_0x42cb('0x4'));var BPromise=require(_0x42cb('0x5'));var Mustache=require(_0x42cb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x42cb('0x7'));var csv=require(_0x42cb('0x8'));var ejs=require(_0x42cb('0x9'));var fs=require('fs');var _=require(_0x42cb('0xa'));var squel=require('squel');var crypto=require(_0x42cb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42cb('0x8'));var querystring=require(_0x42cb('0xc'));var Papa=require(_0x42cb('0xd'));var Redis=require(_0x42cb('0xe'));var authService=require(_0x42cb('0xf'));var qs=require(_0x42cb('0x10'));var as=require(_0x42cb('0x11'));var hardwareService=require(_0x42cb('0x12'));var logger=require(_0x42cb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x42cb('0x14'));var licenseUtil=require(_0x42cb('0x15'));var db=require(_0x42cb('0x16'))['db'];config['redis']=_[_0x42cb('0x17')](config[_0x42cb('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42cb('0x18')]));require(_0x42cb('0x19'))[_0x42cb('0x1a')](socket);function respondWithStatusCode(_0x1cdb92,_0x27ee11){_0x27ee11=_0x27ee11||0xcc;return function(_0x3e8a7a){if(_0x3e8a7a){return _0x1cdb92[_0x42cb('0x1b')](_0x27ee11);}return _0x1cdb92[_0x42cb('0x1c')](_0x27ee11)[_0x42cb('0x1d')]();};}function respondWithResult(_0x1bca76,_0x389945){_0x389945=_0x389945||0xc8;return function(_0x47b8e0){if(_0x47b8e0){return _0x1bca76[_0x42cb('0x1c')](_0x389945)['json'](_0x47b8e0);}};}function respondWithFilteredResult(_0x12f4bf,_0x4b927f){return function(_0x3ca4d4){if(_0x3ca4d4){var _0x3b4fb9=_0x3ca4d4[_0x42cb('0x1e')],_0x31c76e=_0x4b927f[_0x42cb('0x1f')],_0x1b208b=_0x4b927f['offset']+_0x4b927f[_0x42cb('0x20')],_0x192674;if(_0x1b208b>=_0x3b4fb9){_0x1b208b=_0x3b4fb9;_0x192674=0xc8;}else{_0x192674=0xce;}_0x12f4bf[_0x42cb('0x1c')](_0x192674);return _0x12f4bf['set'](_0x42cb('0x21'),_0x31c76e+'-'+_0x1b208b+'/'+_0x3b4fb9)[_0x42cb('0x22')](_0x3ca4d4);}return null;};}function patchUpdates(_0x1f06bc){return function(_0x3ae5cb){try{jsonpatch[_0x42cb('0x23')](_0x3ae5cb,_0x1f06bc,!![]);}catch(_0x4404cf){return BPromise[_0x42cb('0x24')](_0x4404cf);}return _0x3ae5cb[_0x42cb('0x25')]();};}function saveUpdates(_0x174f77,_0x10e048){return function(_0x102bcd){if(_0x102bcd){return _0x102bcd['update'](_0x174f77)['then'](function(_0x82a23c){return _0x82a23c;});}return null;};}function removeEntity(_0x3861c0,_0x5480f2){return function(_0x20e6b6){if(_0x20e6b6){return _0x20e6b6[_0x42cb('0x26')]()[_0x42cb('0x27')](function(){var _0x1b74ae=_0x20e6b6[_0x42cb('0x28')]({'plain':!![]});var _0x3cd942=_0x42cb('0x29');return db[_0x42cb('0x2a')][_0x42cb('0x26')]({'where':{'type':_0x3cd942,'resourceId':_0x1b74ae['id']}})[_0x42cb('0x27')](function(){return _0x20e6b6;});})[_0x42cb('0x27')](function(){_0x3861c0[_0x42cb('0x1c')](0xcc)[_0x42cb('0x1d')]();});}};}function handleEntityNotFound(_0x42c70e,_0x4520ad){return function(_0x268872){if(!_0x268872){_0x42c70e[_0x42cb('0x1b')](0x194);}return _0x268872;};}function handleError(_0x668460,_0xa92028){_0xa92028=_0xa92028||0x1f4;return function(_0x32038b){logger['error'](_0x32038b[_0x42cb('0x2b')]);if(_0x32038b[_0x42cb('0x2c')]){delete _0x32038b[_0x42cb('0x2c')];}_0x668460['status'](_0xa92028)[_0x42cb('0x2d')](_0x32038b);};}exports[_0x42cb('0x2e')]=function(_0x4798b0,_0x4e279e){var _0x203840={},_0x15bf67={},_0x1d20e7={'count':0x0,'rows':[]};var _0x3d57c8=_[_0x42cb('0x2f')](db[_0x42cb('0x30')][_0x42cb('0x31')],function(_0x1d3fe2){return{'name':_0x1d3fe2[_0x42cb('0x32')],'type':_0x1d3fe2[_0x42cb('0x33')][_0x42cb('0x34')]};});_0x15bf67[_0x42cb('0x35')]=_['map'](_0x3d57c8,_0x42cb('0x2c'));_0x15bf67[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x4798b0[_0x42cb('0x36')]);_0x15bf67['filters']=_[_0x42cb('0x38')](_0x15bf67[_0x42cb('0x35')],_0x15bf67['query']);_0x203840['attributes']=_[_0x42cb('0x38')](_0x15bf67[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x4798b0[_0x42cb('0x36')]['fields']));_0x203840[_0x42cb('0x3a')]=_0x203840[_0x42cb('0x3a')]['length']?_0x203840[_0x42cb('0x3a')]:_0x15bf67[_0x42cb('0x35')];if(!_0x4798b0[_0x42cb('0x36')][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0x203840[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x4798b0['query']['limit']);_0x203840[_0x42cb('0x1f')]=qs[_0x42cb('0x1f')](_0x4798b0[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x203840['order']=qs['sort'](_0x4798b0[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x203840[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x4798b0['query'],_0x15bf67[_0x42cb('0x3f')]),_0x3d57c8);if(_0x4798b0[_0x42cb('0x36')][_0x42cb('0x40')]){_0x203840[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0x203840['where'],{'$or':_[_0x42cb('0x2f')](_0x3d57c8,function(_0x393869){if(_0x393869[_0x42cb('0x33')]!==_0x42cb('0x42')){var _0x2a14a2={};_0x2a14a2[_0x393869[_0x42cb('0x2c')]]={'$like':'%'+_0x4798b0['query'][_0x42cb('0x40')]+'%'};return _0x2a14a2;}})});}_0x203840=_[_0x42cb('0x41')]({},_0x203840,_0x4798b0[_0x42cb('0x43')]);var _0x2766dd={'where':_0x203840[_0x42cb('0x3e')]};return db[_0x42cb('0x30')][_0x42cb('0x1e')](_0x2766dd)['then'](function(_0x13cc66){_0x1d20e7['count']=_0x13cc66;if(_0x4798b0['query'][_0x42cb('0x44')]){_0x203840[_0x42cb('0x45')]=[{'all':!![]}];}return db['CmList'][_0x42cb('0x46')](_0x203840);})['then'](function(_0x6c8011){_0x1d20e7['rows']=_0x6c8011;return _0x1d20e7;})[_0x42cb('0x27')](respondWithFilteredResult(_0x4e279e,_0x203840))['catch'](handleError(_0x4e279e,null));};exports[_0x42cb('0x47')]=function(_0x564925,_0x27eeb4){var _0x3ddeb0={'raw':![],'where':{'id':_0x564925[_0x42cb('0x48')]['id']}},_0x2c7960={};_0x2c7960[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x30')][_0x42cb('0x31')]);_0x2c7960[_0x42cb('0x36')]=_['keys'](_0x564925['query']);_0x2c7960[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x2c7960['model'],_0x2c7960[_0x42cb('0x36')]);_0x3ddeb0[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x2c7960['model'],qs['fields'](_0x564925['query'][_0x42cb('0x39')]));_0x3ddeb0['attributes']=_0x3ddeb0[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x3ddeb0[_0x42cb('0x3a')]:_0x2c7960['model'];if(_0x564925[_0x42cb('0x36')][_0x42cb('0x44')]){_0x3ddeb0[_0x42cb('0x45')]=[{'all':!![]}];}_0x3ddeb0=_['merge']({},_0x3ddeb0,_0x564925[_0x42cb('0x43')]);return db[_0x42cb('0x30')][_0x42cb('0x4a')](_0x3ddeb0)[_0x42cb('0x27')](handleEntityNotFound(_0x27eeb4,null))[_0x42cb('0x27')](respondWithResult(_0x27eeb4,null))['catch'](handleError(_0x27eeb4,null));};exports['create']=function(_0x1388c1,_0xe747d6){return db[_0x42cb('0x30')][_0x42cb('0x4b')](_0x1388c1['body'],{})[_0x42cb('0x27')](function(_0x142f82){var _0x23d2ca=_0x1388c1[_0x42cb('0x4c')][_0x42cb('0x28')]({'plain':!![]});if(!_0x23d2ca)throw new Error(_0x42cb('0x4d'));if(_0x23d2ca[_0x42cb('0x4e')]===_0x42cb('0x4c')){var _0x2c3099=_0x142f82[_0x42cb('0x28')]({'plain':!![]});var _0x25a401=_0x42cb('0x29');return db['UserProfileSection'][_0x42cb('0x4a')]({'where':{'name':_0x25a401,'userProfileId':_0x23d2ca['userProfileId']},'raw':!![]})[_0x42cb('0x27')](function(_0xa3d8cb){if(_0xa3d8cb&&_0xa3d8cb[_0x42cb('0x4f')]===0x0){return db[_0x42cb('0x2a')][_0x42cb('0x4b')]({'name':_0x2c3099[_0x42cb('0x2c')],'resourceId':_0x2c3099['id'],'type':_0xa3d8cb[_0x42cb('0x2c')],'sectionId':_0xa3d8cb['id']},{})['then'](function(){return _0x142f82;});}else{return _0x142f82;}})[_0x42cb('0x50')](function(_0x441919){logger[_0x42cb('0x51')](_0x42cb('0x52'),_0x441919);throw _0x441919;});}return _0x142f82;})[_0x42cb('0x27')](respondWithResult(_0xe747d6,0xc9))['catch'](handleError(_0xe747d6,null));};exports[_0x42cb('0x53')]=function(_0x7ba440,_0x522cff){if(_0x7ba440[_0x42cb('0x54')]['id']){delete _0x7ba440[_0x42cb('0x54')]['id'];}return db[_0x42cb('0x30')]['find']({'where':{'id':_0x7ba440[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x522cff,null))[_0x42cb('0x27')](saveUpdates(_0x7ba440[_0x42cb('0x54')],null))['then'](respondWithResult(_0x522cff,null))[_0x42cb('0x50')](handleError(_0x522cff,null));};exports[_0x42cb('0x26')]=function(_0x29f893,_0x36a417){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x29f893['params']['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x36a417,null))[_0x42cb('0x27')](removeEntity(_0x36a417,null))[_0x42cb('0x50')](handleError(_0x36a417,null));};exports[_0x42cb('0x55')]=function(_0x3ad3d3,_0xe1be1a){return db[_0x42cb('0x30')][_0x42cb('0x55')]()[_0x42cb('0x27')](respondWithResult(_0xe1be1a,null))[_0x42cb('0x50')](handleError(_0xe1be1a,null));};exports[_0x42cb('0x56')]=function(_0x55bb62,_0x5d4511,_0x3eaea4){if(_0x55bb62['body']['id']){delete _0x55bb62[_0x42cb('0x54')]['id'];}return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x55bb62[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5d4511,null))[_0x42cb('0x27')](function(_0x2c43f9){if(_0x2c43f9){_0x55bb62['body'][_0x42cb('0x57')]=_0x2c43f9['id'];return db[_0x42cb('0x58')][_0x42cb('0x4b')](_0x55bb62['body']);}})[_0x42cb('0x27')](respondWithResult(_0x5d4511,null))[_0x42cb('0x50')](handleError(_0x5d4511,null));};exports['getDispositions']=function(_0x560ea4,_0x3f4ef2,_0x542be1){var _0x4be477={'raw':![],'where':{}};var _0x217774={};var _0x5e75c3={'count':0x0,'rows':[]};return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x560ea4['params']['id']}})['then'](handleEntityNotFound(_0x3f4ef2,null))[_0x42cb('0x27')](function(_0x74496d){if(_0x74496d){_0x217774[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x58')]['rawAttributes']);_0x217774[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x560ea4[_0x42cb('0x36')]);_0x217774[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x217774['model'],_0x217774[_0x42cb('0x36')]);_0x4be477[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x217774['model'],qs[_0x42cb('0x39')](_0x560ea4['query'][_0x42cb('0x39')]));_0x4be477['attributes']=_0x4be477[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x4be477['attributes']:_0x217774[_0x42cb('0x35')];if(!_0x560ea4['query'][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0x4be477[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x560ea4[_0x42cb('0x36')][_0x42cb('0x20')]);_0x4be477['offset']=qs['offset'](_0x560ea4[_0x42cb('0x36')]['offset']);}_0x4be477[_0x42cb('0x5a')]=qs['sort'](_0x560ea4['query']['sort']);_0x4be477[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x560ea4[_0x42cb('0x36')],_0x217774[_0x42cb('0x3f')]));_0x4be477[_0x42cb('0x3e')][_0x42cb('0x57')]=_0x74496d['id'];if(_0x560ea4[_0x42cb('0x36')][_0x42cb('0x40')]){_0x4be477[_0x42cb('0x3e')]=_['merge'](_0x4be477[_0x42cb('0x3e')],{'$or':_[_0x42cb('0x2f')](_0x4be477[_0x42cb('0x3a')],function(_0x140eea){var _0x3a8945={};_0x3a8945[_0x140eea]={'$like':'%'+_0x560ea4[_0x42cb('0x36')][_0x42cb('0x40')]+'%'};return _0x3a8945;})});}_0x4be477=_[_0x42cb('0x41')]({},_0x4be477,_0x560ea4[_0x42cb('0x43')]);return db['Disposition'][_0x42cb('0x1e')]({'where':_0x4be477[_0x42cb('0x3e')]})[_0x42cb('0x27')](function(_0x5815e3){_0x5e75c3[_0x42cb('0x1e')]=_0x5815e3;if(_0x560ea4[_0x42cb('0x36')][_0x42cb('0x44')]){_0x4be477[_0x42cb('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x42cb('0x46')](_0x4be477);})[_0x42cb('0x27')](function(_0xf2df8c){_0x5e75c3[_0x42cb('0x5b')]=_0xf2df8c;return _0x5e75c3;});}})[_0x42cb('0x27')](respondWithFilteredResult(_0x3f4ef2,_0x4be477))[_0x42cb('0x50')](handleError(_0x3f4ef2,null));};exports[_0x42cb('0x5c')]=function(_0x36949f,_0x5b93b0,_0x403c44){return db['CmList'][_0x42cb('0x4a')]({'where':{'id':_0x36949f['params']['id']}})['then'](handleEntityNotFound(_0x5b93b0,null))[_0x42cb('0x27')](function(_0x3900aa){if(_0x3900aa){return _0x3900aa[_0x42cb('0x5c')](_0x36949f['query'][_0x42cb('0x5d')]);}})['then'](respondWithStatusCode(_0x5b93b0,null))[_0x42cb('0x50')](handleError(_0x5b93b0,null));};exports[_0x42cb('0x5e')]=function(_0x1cbf58,_0x1be2a4,_0x39123e){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x1cbf58[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x1be2a4,null))[_0x42cb('0x27')](function(_0x1e7e62){if(_0x1e7e62){var _0x2d1522=[];var _0x43d35e={'success':[],'errors':[]};return db[_0x42cb('0x5f')][_0x42cb('0x55')]()[_0x42cb('0x27')](function(_0x171e46){if(_0x1cbf58[_0x42cb('0x54')]['tags']&&_[_0x42cb('0x60')](_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')])){if(_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]['length']){_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')][_0x42cb('0x62')](';')+';';}else{_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=null;}}else{_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=null;}if(_0x1cbf58[_0x42cb('0x54')]&&_[_0x42cb('0x60')](_0x1cbf58['body'])){for(var _0x29386c=0x0;_0x29386c<_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x49')];_0x29386c+=0x1){_0x1cbf58['body'][_0x29386c]['ListId']=_0x1cbf58[_0x42cb('0x48')]['id'];_0x2d1522[_0x42cb('0x63')](_0x1cbf58[_0x42cb('0x54')][_0x29386c]);}return BPromise[_0x42cb('0x64')](_0x2d1522,function(_0x4a50f8){return db[_0x42cb('0x5f')]['create'](_[_0x42cb('0x65')](_0x4a50f8,['ids','id'])||{},{'fields':_[_0x42cb('0x37')](_0x171e46),'raw':!![]})[_0x42cb('0x27')](function(_0x167a2a){_0x43d35e[_0x42cb('0x66')][_0x42cb('0x63')](_0x167a2a[_0x42cb('0x67')]);})[_0x42cb('0x50')](function(_0x4df71d){_0x43d35e[_0x42cb('0x68')][_0x42cb('0x63')]({'data':_0x4a50f8,'error':_0x4df71d[_0x42cb('0x69')]});});})[_0x42cb('0x27')](function(_0x284b09){return _0x43d35e;})[_0x42cb('0x50')](function(_0x722555){return _0x722555;});}else{_0x1be2a4[_0x42cb('0x1c')](0x190)[_0x42cb('0x22')]({'message':_0x42cb('0x6a')});}});}})[_0x42cb('0x27')](respondWithResult(_0x1be2a4,null))[_0x42cb('0x50')](handleError(_0x1be2a4,null));};exports[_0x42cb('0x6b')]=function(_0x309682,_0x5a01cb,_0x4c3a17){var _0x45a1e9;return db['CmList']['find']({'where':{'id':_0x309682[_0x42cb('0x48')]['id']},'include':[{'model':db[_0x42cb('0x6c')],'as':'CustomFields'}]})[_0x42cb('0x27')](handleEntityNotFound(_0x5a01cb,null))[_0x42cb('0x27')](function(_0x1de934){if(_0x1de934){_0x45a1e9=_0x1de934;return db[_0x42cb('0x5f')][_0x42cb('0x31')];}})[_0x42cb('0x27')](function(_0x1fd7ef){if(_0x1fd7ef){var _0x52212b={};var _0x1d713c={};_0x1d713c['model']=_[_0x42cb('0x6d')](_[_0x42cb('0x37')](_0x1fd7ef),_[_0x42cb('0x2f')](_0x45a1e9[_0x42cb('0x6e')],function(_0x2bebf1){return util['format'](_0x42cb('0x6f'),_0x2bebf1['id']);}));_0x1d713c[_0x42cb('0x36')]=_['keys'](_0x309682['query']);_0x1d713c['filters']=_[_0x42cb('0x38')](_0x1d713c['model'],_0x1d713c[_0x42cb('0x36')]);_0x52212b[_0x42cb('0x3a')]=_['intersection'](_0x1d713c[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x309682['query'][_0x42cb('0x39')]));_0x52212b[_0x42cb('0x3a')]=_0x52212b[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x52212b[_0x42cb('0x3a')]:_0x1d713c[_0x42cb('0x35')];if(!_0x309682['query'][_0x42cb('0x3b')]('nolimit')){_0x52212b[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x309682['query'][_0x42cb('0x20')]);_0x52212b[_0x42cb('0x1f')]=qs['offset'](_0x309682[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x52212b[_0x42cb('0x5a')]=qs[_0x42cb('0x3d')](_0x309682[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x52212b[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_[_0x42cb('0x70')](_0x309682[_0x42cb('0x36')],_0x1d713c['filters']));_0x52212b[_0x42cb('0x71')]=!![];if(_0x309682[_0x42cb('0x36')][_0x42cb('0x40')]){_0x52212b[_0x42cb('0x3e')]=_['merge'](_0x52212b[_0x42cb('0x3e')],{'$or':_['map'](_0x52212b[_0x42cb('0x3a')],function(_0x58ec7e){var _0x2a413e={};_0x2a413e[_0x58ec7e]={'$like':'%'+_0x309682[_0x42cb('0x36')]['filter']+'%'};return _0x2a413e;})});}_0x52212b=_[_0x42cb('0x41')]({},_0x52212b,_0x309682[_0x42cb('0x43')]);return _0x45a1e9['getContacts'](_0x52212b);}})[_0x42cb('0x27')](respondWithResult(_0x5a01cb,null))[_0x42cb('0x50')](handleError(_0x5a01cb,null));};exports[_0x42cb('0x72')]=function(_0x3d5960,_0xe4ad46,_0x577594){var _0x42ffde;return db[_0x42cb('0x30')]['find']({'where':{'id':_0x3d5960[_0x42cb('0x48')]['id']},'include':[{'model':db[_0x42cb('0x6c')],'as':_0x42cb('0x6e')}]})[_0x42cb('0x27')](handleEntityNotFound(_0xe4ad46,null))[_0x42cb('0x27')](function(_0x2e9891){if(_0x2e9891){_0x42ffde=_0x2e9891;return db['CmContact'][_0x42cb('0x31')];}})['then'](function(_0x53590e){if(_0x53590e){var _0x55ae7c={};var _0x1e3a3d={};_0x1e3a3d['model']=_[_0x42cb('0x6d')](_['keys'](_0x53590e),_[_0x42cb('0x2f')](_0x42ffde[_0x42cb('0x6e')],function(_0x5f319f){return util['format']('cf_%d',_0x5f319f['id']);}));_0x1e3a3d[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x3d5960[_0x42cb('0x36')]);_0x1e3a3d[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x1e3a3d['model'],_0x1e3a3d['query']);_0x55ae7c['attributes']=_[_0x42cb('0x38')](_0x1e3a3d[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x3d5960['query'][_0x42cb('0x39')]));_0x55ae7c[_0x42cb('0x3a')]=_0x55ae7c['attributes'][_0x42cb('0x49')]?_0x55ae7c[_0x42cb('0x3a')]:_0x1e3a3d[_0x42cb('0x35')];if(!_0x3d5960[_0x42cb('0x36')][_0x42cb('0x3b')]('nolimit')){_0x55ae7c['limit']=qs['limit'](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x20')]);_0x55ae7c['offset']=qs[_0x42cb('0x1f')](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x55ae7c['order']=qs[_0x42cb('0x3d')](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x55ae7c[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_[_0x42cb('0x70')](_0x3d5960['query'],_0x1e3a3d['filters']));_0x55ae7c[_0x42cb('0x71')]=!![];if(_0x3d5960[_0x42cb('0x36')][_0x42cb('0x40')]){_0x55ae7c[_0x42cb('0x3e')]=_['merge'](_0x55ae7c['where'],{'$or':_[_0x42cb('0x2f')](_0x55ae7c['attributes'],function(_0x38cd86){var _0x9eb43b={};_0x9eb43b[_0x38cd86]={'$like':'%'+_0x3d5960[_0x42cb('0x36')]['filter']+'%'};return _0x9eb43b;})});}_0x55ae7c=_[_0x42cb('0x41')]({},_0x55ae7c,_0x3d5960[_0x42cb('0x43')]);return _0x42ffde['getContacts'](_0x55ae7c);}})['then'](function(_0x955c47){if(!_[_0x42cb('0x73')](_0x955c47)){var _0x3351f2=toCsv(_0x955c47);var _0x47b680=Date[_0x42cb('0x74')]();fs['writeFileSync'](util[_0x42cb('0x75')](_0x42cb('0x76'),_0x42ffde['id'],_0x47b680),_0x3351f2);_0xe4ad46[_0x42cb('0x77')](_0x42cb('0x78'),_0x42cb('0x79')+util['format'](_0x42cb('0x7a'),_0x42ffde['id'],_0x47b680));_0xe4ad46[_0x42cb('0x77')](_0x42cb('0x7b'),'text/csv');return _0xe4ad46[_0x42cb('0x7c')](util[_0x42cb('0x75')](_0x42cb('0x76'),_0x42ffde['id'],_0x47b680));}else{return _0xe4ad46[_0x42cb('0x1b')](0xcc);}})[_0x42cb('0x50')](handleError(_0xe4ad46,null));};exports[_0x42cb('0x7d')]=function(_0x11c6ae,_0x19a45b,_0x44d451){var _0x36ddc1;delete _0x11c6ae[_0x42cb('0x54')]['id'];return db[_0x42cb('0x30')]['findOne']({'where':{'id':_0x11c6ae[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x19a45b,null))[_0x42cb('0x27')](function(_0x209340){if(_0x209340){return db[_0x42cb('0x7e')][_0x42cb('0x7f')](function(_0x5677db){return db['CmCustomField'][_0x42cb('0x4b')](_0x11c6ae[_0x42cb('0x54')],{'transaction':_0x5677db})[_0x42cb('0x27')](function(_0x50f997){_0x36ddc1=_0x50f997;return _0x209340[_0x42cb('0x80')](_0x50f997,{'transaction':_0x5677db});})[_0x42cb('0x27')](function(){var _0x58bac0={'type':db[_0x42cb('0x81')][_0x42cb('0x82')],'transaction':_0x5677db};switch(_0x11c6ae[_0x42cb('0x54')][_0x42cb('0x33')]){case'text':_0x58bac0[_0x42cb('0x33')]=db[_0x42cb('0x81')][_0x42cb('0x82')];break;case'number':_0x58bac0[_0x42cb('0x33')]=db[_0x42cb('0x81')][_0x42cb('0x83')];break;case _0x42cb('0x84'):_0x58bac0[_0x42cb('0x33')]=db['Sequelize'][_0x42cb('0x85')];_0x58bac0[_0x42cb('0x86')]=![];break;default:}return db['sequelize'][_0x42cb('0x87')]['addColumn'](_0x42cb('0x88'),util[_0x42cb('0x75')]('cf_%s',_0x36ddc1['id']),_0x58bac0);})['then'](function(){return _0x36ddc1;});});}})[_0x42cb('0x27')](respondWithResult(_0x19a45b,null))[_0x42cb('0x50')](handleError(_0x19a45b,null));};exports[_0x42cb('0x89')]=function(_0x2a36f9,_0x1aa944,_0x3854e5){var _0xe15a39={};var _0x58e7c6={};var _0x39ab19;var _0x46d3af;return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x2a36f9[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x1aa944,null))[_0x42cb('0x27')](function(_0x2527bb){if(_0x2527bb){_0x39ab19=_0x2527bb;_0x58e7c6[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x6c')][_0x42cb('0x31')]);_0x58e7c6['query']=_[_0x42cb('0x37')](_0x2a36f9[_0x42cb('0x36')]);_0x58e7c6[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x58e7c6['model'],_0x58e7c6[_0x42cb('0x36')]);_0xe15a39[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x58e7c6['model'],qs['fields'](_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x39')]));_0xe15a39[_0x42cb('0x3a')]=_0xe15a39[_0x42cb('0x3a')][_0x42cb('0x49')]?_0xe15a39[_0x42cb('0x3a')]:_0x58e7c6[_0x42cb('0x35')];_0xe15a39[_0x42cb('0x5a')]=qs[_0x42cb('0x3d')](_0x2a36f9['query']['sort']);_0xe15a39['where']=qs['filters'](_[_0x42cb('0x70')](_0x2a36f9[_0x42cb('0x36')],_0x58e7c6[_0x42cb('0x3f')]));_0xe15a39[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0xe15a39['where'],{'$or':[{'ListId':_0x2527bb['id']},{'ListId':null}]});if(_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x40')]){_0xe15a39['where']=_['merge'](_0xe15a39['where'],{'$or':_[_0x42cb('0x2f')](_0xe15a39[_0x42cb('0x3a')],function(_0x1502a6){var _0x2e6344={};_0x2e6344[_0x1502a6]={'$like':'%'+_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x40')]+'%'};return _0x2e6344;})});}_0xe15a39=_[_0x42cb('0x41')]({},_0xe15a39,_0x2a36f9[_0x42cb('0x43')]);return db[_0x42cb('0x6c')]['findAndCountAll'](_0xe15a39);}})['then'](respondWithResult(_0x1aa944,null))[_0x42cb('0x50')](handleError(_0x1aa944,null));};exports[_0x42cb('0x8a')]=function(_0x1485b6,_0x5e86b8,_0x6532b6){return db['CmList'][_0x42cb('0x4a')]({'where':{'id':_0x1485b6[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5e86b8,null))['then'](function(_0x3988a1){if(_0x3988a1){return _0x3988a1[_0x42cb('0x8a')](_0x1485b6[_0x42cb('0x54')][_0x42cb('0x5d')],_[_0x42cb('0x65')](_0x1485b6[_0x42cb('0x54')],['ids','id'])||{})[_0x42cb('0x8b')](function(_0x3f9c99){for(var _0x3c05c3=0x0;_0x3c05c3<_0x1485b6[_0x42cb('0x54')]['ids']['length'];_0x3c05c3+=0x1){socket[_0x42cb('0x8c')](_0x42cb('0x8d'),{'UserId':_0x1485b6['body'][_0x42cb('0x5d')][_0x3c05c3],'CmListId':_0x1485b6[_0x42cb('0x48')]['id']});}return _0x3f9c99;});}})[_0x42cb('0x27')](respondWithResult(_0x5e86b8,null))[_0x42cb('0x50')](handleError(_0x5e86b8,null));};exports[_0x42cb('0x8e')]=function(_0x466c5a,_0x5b6113,_0x29ec6b){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x466c5a[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5b6113,null))[_0x42cb('0x27')](function(_0x24bfe8){if(_0x24bfe8){return _0x24bfe8['removeAgents'](_0x466c5a[_0x42cb('0x36')]['ids'])['then'](function(){if(_[_0x42cb('0x60')](_0x466c5a[_0x42cb('0x36')][_0x42cb('0x5d')])){for(var _0x4e66a2=0x0;_0x4e66a2<_0x466c5a[_0x42cb('0x36')][_0x42cb('0x5d')][_0x42cb('0x49')];_0x4e66a2+=0x1){socket[_0x42cb('0x8c')](_0x42cb('0x8f'),{'UserId':Number(_0x466c5a['query']['ids'][_0x4e66a2]),'CmListId':Number(_0x466c5a[_0x42cb('0x48')]['id'])});}}else{socket[_0x42cb('0x8c')](_0x42cb('0x8f'),{'UserId':Number(_0x466c5a['query']['ids']),'CmListId':Number(_0x466c5a[_0x42cb('0x48')]['id'])});}});}})[_0x42cb('0x27')](respondWithStatusCode(_0x5b6113,null))[_0x42cb('0x50')](handleError(_0x5b6113,null));};exports[_0x42cb('0x90')]=function(_0x580daf,_0x10bd33,_0x5c79dc){var _0xb81b36={};var _0x9650a7={};var _0x1a687d;var _0x35f0de;return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x580daf[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x10bd33,null))[_0x42cb('0x27')](function(_0x4a05aa){if(_0x4a05aa){_0x1a687d=_0x4a05aa;_0x9650a7[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x91')][_0x42cb('0x31')]);_0x9650a7[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x580daf[_0x42cb('0x36')]);_0x9650a7['filters']=_[_0x42cb('0x38')](_0x9650a7[_0x42cb('0x35')],_0x9650a7['query']);_0xb81b36[_0x42cb('0x3a')]=_['intersection'](_0x9650a7[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x39')]));_0xb81b36['attributes']=_0xb81b36['attributes'][_0x42cb('0x49')]?_0xb81b36[_0x42cb('0x3a')]:_0x9650a7[_0x42cb('0x35')];_0xb81b36[_0x42cb('0x5a')]=qs['sort'](_0x580daf[_0x42cb('0x36')]['sort']);_0xb81b36[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x580daf['query'],_0x9650a7[_0x42cb('0x3f')]));if(_0x580daf[_0x42cb('0x36')][_0x42cb('0x40')]){_0xb81b36[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0xb81b36[_0x42cb('0x3e')],{'$or':_[_0x42cb('0x2f')](_0xb81b36[_0x42cb('0x3a')],function(_0x585a6e){var _0x115d5e={};_0x115d5e[_0x585a6e]={'$like':'%'+_0x580daf[_0x42cb('0x36')]['filter']+'%'};return _0x115d5e;})});}_0xb81b36=_[_0x42cb('0x41')]({},_0xb81b36,_0x580daf[_0x42cb('0x43')]);return _0x1a687d[_0x42cb('0x90')](_0xb81b36);}})[_0x42cb('0x27')](function(_0x5f4e4e){if(_0x5f4e4e){_0x35f0de=_0x5f4e4e[_0x42cb('0x49')];if(!_0x580daf[_0x42cb('0x36')][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0xb81b36['limit']=qs[_0x42cb('0x20')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x20')]);_0xb81b36['offset']=qs[_0x42cb('0x1f')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x1f')]);}return _0x1a687d[_0x42cb('0x90')](_0xb81b36);}})[_0x42cb('0x27')](function(_0x5430d0){if(_0x5430d0){return _0x5430d0?{'count':_0x35f0de,'rows':_0x5430d0}:null;}})['then'](respondWithResult(_0x10bd33,null))[_0x42cb('0x50')](handleError(_0x10bd33,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4413600..e69388a 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 _0x6ece=['../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x15c37c,_0x4f7106){var _0x1d7463=function(_0x5c4030){while(--_0x5c4030){_0x15c37c['push'](_0x15c37c['shift']());}};_0x1d7463(++_0x4f7106);}(_0x6ece,0xd7));var _0xe6ec=function(_0x14276d,_0x20cc7a){_0x14276d=_0x14276d-0x0;var _0x114714=_0x6ece[_0x14276d];return _0x114714;};'use strict';var EventEmitter=require(_0xe6ec('0x0'));var CmList=require(_0xe6ec('0x1'))['db'][_0xe6ec('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xe6ec('0x3')](0x0);var events={'afterCreate':_0xe6ec('0x4'),'afterUpdate':'update','afterDestroy':_0xe6ec('0x5')};function emitEvent(_0x931a69){return function(_0x271110,_0x593a74,_0x4c1e97){CmListEvents[_0xe6ec('0x6')](_0x931a69+':'+_0x271110['id'],_0x271110);CmListEvents['emit'](_0x931a69,_0x271110);_0x4c1e97(null);};}for(var e in events){if(events[_0xe6ec('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xe6ec('0x8')]=CmListEvents; \ No newline at end of file +var _0x1d98=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x2408c3,_0x117956){var _0x1898d7=function(_0x3ba375){while(--_0x3ba375){_0x2408c3['push'](_0x2408c3['shift']());}};_0x1898d7(++_0x117956);}(_0x1d98,0x1aa));var _0x81d9=function(_0x5c7290,_0x56b55f){_0x5c7290=_0x5c7290-0x0;var _0x132e60=_0x1d98[_0x5c7290];return _0x132e60;};'use strict';var EventEmitter=require(_0x81d9('0x0'));var CmList=require(_0x81d9('0x1'))['db'][_0x81d9('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x81d9('0x3')](0x0);var events={'afterCreate':_0x81d9('0x4'),'afterUpdate':_0x81d9('0x5'),'afterDestroy':_0x81d9('0x6')};function emitEvent(_0x375a1d){return function(_0x15b03f,_0x4c39a1,_0x19d2f0){CmListEvents[_0x81d9('0x7')](_0x375a1d+':'+_0x15b03f['id'],_0x15b03f);CmListEvents[_0x81d9('0x7')](_0x375a1d,_0x15b03f);_0x19d2f0(null);};}for(var e in events){if(events[_0x81d9('0x8')](e)){var event=events[e];CmList[_0x81d9('0x9')](e,emitEvent(event));}}module[_0x81d9('0xa')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 66e5353..5a2ff34 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 _0xe9d6=['exports','define','CmList','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d7c6e,_0x199af9){var _0x4186b3=function(_0x420862){while(--_0x420862){_0x2d7c6e['push'](_0x2d7c6e['shift']());}};_0x4186b3(++_0x199af9);}(_0xe9d6,0x1cb));var _0x6e9d=function(_0x547402,_0x83073c){_0x547402=_0x547402-0x0;var _0x3d35e9=_0xe9d6[_0x547402];return _0x3d35e9;};'use strict';var _=require(_0x6e9d('0x0'));var util=require(_0x6e9d('0x1'));var logger=require(_0x6e9d('0x2'))(_0x6e9d('0x3'));var moment=require(_0x6e9d('0x4'));var BPromise=require(_0x6e9d('0x5'));var rp=require(_0x6e9d('0x6'));var fs=require('fs');var path=require(_0x6e9d('0x7'));var rimraf=require(_0x6e9d('0x8'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0x6e9d('0x9')]=function(_0x28ce6d,_0x220b41){return _0x28ce6d[_0x6e9d('0xa')](_0x6e9d('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b3e=['path','rimraf','../../config/environment','./cmList.attributes','define','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5798fe,_0x4a0598){var _0x1b6e9d=function(_0x377eeb){while(--_0x377eeb){_0x5798fe['push'](_0x5798fe['shift']());}};_0x1b6e9d(++_0x4a0598);}(_0x9b3e,0x96));var _0xe9b3=function(_0x430f98,_0x93424f){_0x430f98=_0x430f98-0x0;var _0x13ccf7=_0x9b3e[_0x430f98];return _0x13ccf7;};'use strict';var _=require(_0xe9b3('0x0'));var util=require(_0xe9b3('0x1'));var logger=require(_0xe9b3('0x2'))(_0xe9b3('0x3'));var moment=require('moment');var BPromise=require(_0xe9b3('0x4'));var rp=require(_0xe9b3('0x5'));var fs=require('fs');var path=require(_0xe9b3('0x6'));var rimraf=require(_0xe9b3('0x7'));var config=require(_0xe9b3('0x8'));var attributes=require(_0xe9b3('0x9'));module['exports']=function(_0x1120d0,_0x4c7699){return _0x1120d0[_0xe9b3('0xa')]('CmList',attributes,{'tableName':_0xe9b3('0xb'),'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 b6ded7a..e17bab3 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 _0xe775=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x55784c,_0xe48041){var _0x55cb34=function(_0x4723ce){while(--_0x4723ce){_0x55784c['push'](_0x55784c['shift']());}};_0x55cb34(++_0xe48041);}(_0xe775,0x1c3));var _0x5e77=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xe775[_0x104e21];return _0x605b37;};'use strict';var _=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var moment=require('moment');var BPromise=require(_0x5e77('0x2'));var rs=require(_0x5e77('0x3'));var fs=require('fs');var Redis=require(_0x5e77('0x4'));var db=require(_0x5e77('0x5'))['db'];var utils=require(_0x5e77('0x6'));var logger=require(_0x5e77('0x7'))(_0x5e77('0x8'));var config=require(_0x5e77('0x9'));var jayson=require(_0x5e77('0xa'));var client=jayson[_0x5e77('0xb')][_0x5e77('0xc')]({'port':0x232a});config[_0x5e77('0xd')]=_[_0x5e77('0xe')](config[_0x5e77('0xd')],{'host':_0x5e77('0xf'),'port':0x18eb});var socket=require(_0x5e77('0x10'))(new Redis(config[_0x5e77('0xd')]));require(_0x5e77('0x11'))['register'](socket);function respondWithRpcPromise(_0xd947b3,_0x57b938,_0x27bec1){return new BPromise(function(_0xbadee9,_0x474c51){return client[_0x5e77('0x12')](_0xd947b3,_0x27bec1)[_0x5e77('0x13')](function(_0xd7b90){logger[_0x5e77('0x14')](_0x5e77('0x15'),_0x57b938,_0x5e77('0x16'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x57b938,'request\x20sent',JSON['stringify'](_0xd7b90));if(_0xd7b90['error']){if(_0xd7b90[_0x5e77('0x17')][_0x5e77('0x18')]===0x1f4){logger[_0x5e77('0x17')](_0x5e77('0x15'),_0x57b938,_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);return _0x474c51(_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);}logger['error'](_0x5e77('0x15'),_0x57b938,_0xd7b90[_0x5e77('0x17')][_0x5e77('0x19')]);return _0xbadee9(_0xd7b90[_0x5e77('0x17')]['message']);}else{logger[_0x5e77('0x14')](_0x5e77('0x15'),_0x57b938,_0x5e77('0x16'));_0xbadee9(_0xd7b90[_0x5e77('0x1a')][_0x5e77('0x19')]);}})[_0x5e77('0x1b')](function(_0x18d632){logger[_0x5e77('0x17')](_0x5e77('0x15'),_0x57b938,_0x18d632);_0x474c51(_0x18d632);});});} \ No newline at end of file +var _0xdcbc=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch'];(function(_0x22135e,_0x5eb9cd){var _0x4094a5=function(_0x95711d){while(--_0x95711d){_0x22135e['push'](_0x22135e['shift']());}};_0x4094a5(++_0x5eb9cd);}(_0xdcbc,0x16c));var _0xcdcb=function(_0x3ff45e,_0x52c556){_0x3ff45e=_0x3ff45e-0x0;var _0x4dd4dc=_0xdcbc[_0x3ff45e];return _0x4dd4dc;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var moment=require(_0xcdcb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcdcb('0x3'));var fs=require('fs');var Redis=require(_0xcdcb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdcb('0x5'));var logger=require(_0xcdcb('0x6'))('rpc');var config=require(_0xcdcb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcdcb('0x8')]['http']({'port':0x232a});config[_0xcdcb('0x9')]=_[_0xcdcb('0xa')](config[_0xcdcb('0x9')],{'host':_0xcdcb('0xb'),'port':0x18eb});var socket=require(_0xcdcb('0xc'))(new Redis(config[_0xcdcb('0x9')]));require(_0xcdcb('0xd'))[_0xcdcb('0xe')](socket);function respondWithRpcPromise(_0x58f232,_0x57d81d,_0x57e6d0){return new BPromise(function(_0x1accb6,_0x105844){return client[_0xcdcb('0xf')](_0x58f232,_0x57e6d0)[_0xcdcb('0x10')](function(_0x4f6bf0){logger[_0xcdcb('0x11')](_0xcdcb('0x12'),_0x57d81d,'request\x20sent');logger[_0xcdcb('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x57d81d,'request\x20sent',JSON[_0xcdcb('0x14')](_0x4f6bf0));if(_0x4f6bf0['error']){if(_0x4f6bf0[_0xcdcb('0x15')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x57d81d,_0x4f6bf0[_0xcdcb('0x15')]['message']);return _0x105844(_0x4f6bf0[_0xcdcb('0x15')][_0xcdcb('0x16')]);}logger[_0xcdcb('0x15')](_0xcdcb('0x12'),_0x57d81d,_0x4f6bf0['error'][_0xcdcb('0x16')]);return _0x1accb6(_0x4f6bf0['error'][_0xcdcb('0x16')]);}else{logger[_0xcdcb('0x11')](_0xcdcb('0x12'),_0x57d81d,_0xcdcb('0x17'));_0x1accb6(_0x4f6bf0[_0xcdcb('0x18')][_0xcdcb('0x16')]);}})[_0xcdcb('0x19')](function(_0x544ee3){logger['error'](_0xcdcb('0x12'),_0x57d81d,_0x544ee3);_0x105844(_0x544ee3);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 41c1773..bf6dc37 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 _0x9206=['save','remove','update','length','./cmList.events'];(function(_0x565053,_0x4bdd98){var _0x181c41=function(_0x176d8b){while(--_0x176d8b){_0x565053['push'](_0x565053['shift']());}};_0x181c41(++_0x4bdd98);}(_0x9206,0x176));var _0x6920=function(_0x4a0657,_0x14abfd){_0x4a0657=_0x4a0657-0x0;var _0x385e03=_0x9206[_0x4a0657];return _0x385e03;};'use strict';var CmListEvents=require(_0x6920('0x0'));var events=[_0x6920('0x1'),_0x6920('0x2'),_0x6920('0x3')];function createListener(_0x18c93a,_0x319cce){return function(_0x4bc24b){_0x319cce['emit'](_0x18c93a,_0x4bc24b);};}function removeListener(_0x1770ce,_0x3c84f7){return function(){CmListEvents['removeListener'](_0x1770ce,_0x3c84f7);};}exports['register']=function(_0x41c8c4){for(var _0x4d67d7=0x0,_0x21fb21=events[_0x6920('0x4')];_0x4d67d7<_0x21fb21;_0x4d67d7++){var _0x2aad51=events[_0x4d67d7];var _0xef5d38=createListener('cmList:'+_0x2aad51,_0x41c8c4);CmListEvents['on'](_0x2aad51,_0xef5d38);}}; \ No newline at end of file +var _0x86b8=['save','remove','emit','removeListener','length','cmList:','./cmList.events'];(function(_0x145ac9,_0x49779f){var _0x287117=function(_0x315a6f){while(--_0x315a6f){_0x145ac9['push'](_0x145ac9['shift']());}};_0x287117(++_0x49779f);}(_0x86b8,0x15d));var _0x886b=function(_0x5ccf37,_0x44b55d){_0x5ccf37=_0x5ccf37-0x0;var _0x44bdd5=_0x86b8[_0x5ccf37];return _0x44bdd5;};'use strict';var CmListEvents=require(_0x886b('0x0'));var events=[_0x886b('0x1'),_0x886b('0x2'),'update'];function createListener(_0x105f5d,_0x5db7b6){return function(_0x3dcb96){_0x5db7b6[_0x886b('0x3')](_0x105f5d,_0x3dcb96);};}function removeListener(_0x4191fb,_0x4d3769){return function(){CmListEvents[_0x886b('0x4')](_0x4191fb,_0x4d3769);};}exports['register']=function(_0x5b5ff5){for(var _0x2c32bc=0x0,_0xd9d9ac=events[_0x886b('0x5')];_0x2c32bc<_0xd9d9ac;_0x2c32bc++){var _0x2f8957=events[_0x2c32bc];var _0xbc2d70=createListener(_0x886b('0x6')+_0x2f8957,_0x5b5ff5);CmListEvents['on'](_0x2f8957,_0xbc2d70);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e96157e..2ef17fe 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_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('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 ccf9996..8b1c3a0 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(_0x19e975,_0x2ecafb){var _0x3c145f=function(_0x11241c){while(--_0x11241c){_0x19e975['push'](_0x19e975['shift']());}};_0x3c145f(++_0x2ecafb);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x17de04,_0x5ac311){var _0x32b3b1=function(_0x4934e0){while(--_0x4934e0){_0x17de04['push'](_0x17de04['shift']());}};_0x32b3b1(++_0x5ac311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 3d981e3..2b2975b 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 _0xfbc3=['util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','reject','save','error','stack','name','update','body','then','catch','destroy','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1cd6ed,_0x432b14){var _0xc7859e=function(_0x28ee65){while(--_0x28ee65){_0x1cd6ed['push'](_0x1cd6ed['shift']());}};_0xc7859e(++_0x432b14);}(_0xfbc3,0x1f1));var _0x3fbc=function(_0x77f62c,_0x2eebaa){_0x77f62c=_0x77f62c-0x0;var _0x590e50=_0xfbc3[_0x77f62c];return _0x590e50;};'use strict';var pdf=require(_0x3fbc('0x0'));var emlformat=require(_0x3fbc('0x1'));var rimraf=require(_0x3fbc('0x2'));var zipdir=require(_0x3fbc('0x3'));var jsonpatch=require(_0x3fbc('0x4'));var rp=require(_0x3fbc('0x5'));var moment=require(_0x3fbc('0x6'));var BPromise=require(_0x3fbc('0x7'));var Mustache=require(_0x3fbc('0x8'));var util=require(_0x3fbc('0x9'));var path=require(_0x3fbc('0xa'));var sox=require(_0x3fbc('0xb'));var csv=require(_0x3fbc('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fbc('0xd'));var squel=require(_0x3fbc('0xe'));var crypto=require('crypto');var jsforce=require(_0x3fbc('0xf'));var deskjs=require(_0x3fbc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3fbc('0x11'));var Papa=require(_0x3fbc('0x12'));var Redis=require(_0x3fbc('0x13'));var authService=require(_0x3fbc('0x14'));var qs=require(_0x3fbc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fbc('0x16'));var logger=require('../../config/logger')(_0x3fbc('0x17'));var utils=require(_0x3fbc('0x18'));var config=require(_0x3fbc('0x19'));var licenseUtil=require(_0x3fbc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dd24,_0x1273fe){_0x1273fe=_0x1273fe||0xcc;return function(_0x6dada4){if(_0x6dada4){return _0x21dd24[_0x3fbc('0x1b')](_0x1273fe);}return _0x21dd24[_0x3fbc('0x1c')](_0x1273fe)[_0x3fbc('0x1d')]();};}function respondWithResult(_0x455694,_0x298779){_0x298779=_0x298779||0xc8;return function(_0x42bfc4){if(_0x42bfc4){return _0x455694[_0x3fbc('0x1c')](_0x298779)[_0x3fbc('0x1e')](_0x42bfc4);}};}function respondWithFilteredResult(_0x56f8c9,_0x18b177){return function(_0x57d703){if(_0x57d703){var _0x31a0a1=_0x57d703[_0x3fbc('0x1f')],_0x4cdb3d=_0x18b177[_0x3fbc('0x20')],_0x45a86f=_0x18b177[_0x3fbc('0x20')]+_0x18b177[_0x3fbc('0x21')],_0x4f1e2d;if(_0x45a86f>=_0x31a0a1){_0x45a86f=_0x31a0a1;_0x4f1e2d=0xc8;}else{_0x4f1e2d=0xce;}_0x56f8c9[_0x3fbc('0x1c')](_0x4f1e2d);return _0x56f8c9['set']('Content-Range',_0x4cdb3d+'-'+_0x45a86f+'/'+_0x31a0a1)[_0x3fbc('0x1e')](_0x57d703);}return null;};}function patchUpdates(_0x17d382){return function(_0x4f6868){try{jsonpatch['apply'](_0x4f6868,_0x17d382,!![]);}catch(_0x1c2ea8){return BPromise[_0x3fbc('0x22')](_0x1c2ea8);}return _0x4f6868[_0x3fbc('0x23')]();};}function saveUpdates(_0x1ffa41,_0x93981f){return function(_0x267a31){if(_0x267a31){return _0x267a31['update'](_0x1ffa41)['then'](function(_0x2b49e4){return _0x2b49e4;});}return null;};}function removeEntity(_0x590009,_0x16c61c){return function(_0x331c95){if(_0x331c95){return _0x331c95['destroy']()['then'](function(){_0x590009[_0x3fbc('0x1c')](0xcc)[_0x3fbc('0x1d')]();});}};}function handleEntityNotFound(_0x83b98f,_0x39590d){return function(_0x32de22){if(!_0x32de22){_0x83b98f['sendStatus'](0x194);}return _0x32de22;};}function handleError(_0x25dd72,_0x333da2){_0x333da2=_0x333da2||0x1f4;return function(_0x56a35d){logger[_0x3fbc('0x24')](_0x56a35d[_0x3fbc('0x25')]);if(_0x56a35d[_0x3fbc('0x26')]){delete _0x56a35d[_0x3fbc('0x26')];}_0x25dd72[_0x3fbc('0x1c')](_0x333da2)['send'](_0x56a35d);};}exports[_0x3fbc('0x27')]=function(_0x561428,_0x2509ce){if(_0x561428[_0x3fbc('0x28')]['id']){delete _0x561428[_0x3fbc('0x28')]['id'];}return db['Condition']['find']({'where':{'id':_0x561428['params']['id']}})[_0x3fbc('0x29')](handleEntityNotFound(_0x2509ce,null))[_0x3fbc('0x29')](saveUpdates(_0x561428[_0x3fbc('0x28')],null))[_0x3fbc('0x29')](respondWithResult(_0x2509ce,null))[_0x3fbc('0x2a')](handleError(_0x2509ce,null));};exports[_0x3fbc('0x2b')]=function(_0x42db8e,_0x1aee3b){return db['Condition'][_0x3fbc('0x2c')]({'where':{'id':_0x42db8e[_0x3fbc('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1aee3b,null))['then'](removeEntity(_0x1aee3b,null))[_0x3fbc('0x2a')](handleError(_0x1aee3b,null));}; \ No newline at end of file +var _0x60ae=['to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','name','send','body','Condition','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x60ae,0x9a));var _0xe60a=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0x60ae[_0x545150];return _0xff7fd6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe60a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe60a('0x1'));var jsonpatch=require(_0xe60a('0x2'));var rp=require(_0xe60a('0x3'));var moment=require('moment');var BPromise=require(_0xe60a('0x4'));var Mustache=require('mustache');var util=require(_0xe60a('0x5'));var path=require(_0xe60a('0x6'));var sox=require(_0xe60a('0x7'));var csv=require('to-csv');var ejs=require(_0xe60a('0x8'));var fs=require('fs');var _=require(_0xe60a('0x9'));var squel=require(_0xe60a('0xa'));var crypto=require(_0xe60a('0xb'));var jsforce=require(_0xe60a('0xc'));var deskjs=require(_0xe60a('0xd'));var toCsv=require(_0xe60a('0xe'));var querystring=require(_0xe60a('0xf'));var Papa=require(_0xe60a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe60a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe60a('0x12'));var utils=require(_0xe60a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe60a('0x14'));var db=require(_0xe60a('0x15'))['db'];function respondWithStatusCode(_0x40914f,_0x5cf96c){_0x5cf96c=_0x5cf96c||0xcc;return function(_0x4a40f6){if(_0x4a40f6){return _0x40914f['sendStatus'](_0x5cf96c);}return _0x40914f[_0xe60a('0x16')](_0x5cf96c)[_0xe60a('0x17')]();};}function respondWithResult(_0xa1a8c0,_0xfd2523){_0xfd2523=_0xfd2523||0xc8;return function(_0x15c052){if(_0x15c052){return _0xa1a8c0['status'](_0xfd2523)[_0xe60a('0x18')](_0x15c052);}};}function respondWithFilteredResult(_0x583d85,_0x5c8e74){return function(_0x2fcde5){if(_0x2fcde5){var _0x21656=_0x2fcde5[_0xe60a('0x19')],_0x535b69=_0x5c8e74[_0xe60a('0x1a')],_0x597673=_0x5c8e74['offset']+_0x5c8e74['limit'],_0x528d88;if(_0x597673>=_0x21656){_0x597673=_0x21656;_0x528d88=0xc8;}else{_0x528d88=0xce;}_0x583d85[_0xe60a('0x16')](_0x528d88);return _0x583d85[_0xe60a('0x1b')]('Content-Range',_0x535b69+'-'+_0x597673+'/'+_0x21656)[_0xe60a('0x18')](_0x2fcde5);}return null;};}function patchUpdates(_0x3cc4f2){return function(_0x384605){try{jsonpatch[_0xe60a('0x1c')](_0x384605,_0x3cc4f2,!![]);}catch(_0x33a644){return BPromise[_0xe60a('0x1d')](_0x33a644);}return _0x384605[_0xe60a('0x1e')]();};}function saveUpdates(_0x1729bc,_0x33e45d){return function(_0x1f8faf){if(_0x1f8faf){return _0x1f8faf[_0xe60a('0x1f')](_0x1729bc)[_0xe60a('0x20')](function(_0x2fe58a){return _0x2fe58a;});}return null;};}function removeEntity(_0x28867d,_0x1fd6ad){return function(_0x21714e){if(_0x21714e){return _0x21714e[_0xe60a('0x21')]()['then'](function(){_0x28867d[_0xe60a('0x16')](0xcc)[_0xe60a('0x17')]();});}};}function handleEntityNotFound(_0xccdaaa,_0x37eddb){return function(_0x1295a9){if(!_0x1295a9){_0xccdaaa[_0xe60a('0x22')](0x194);}return _0x1295a9;};}function handleError(_0x2cbd34,_0x1f12a8){_0x1f12a8=_0x1f12a8||0x1f4;return function(_0x539db6){logger['error'](_0x539db6['stack']);if(_0x539db6[_0xe60a('0x23')]){delete _0x539db6[_0xe60a('0x23')];}_0x2cbd34[_0xe60a('0x16')](_0x1f12a8)[_0xe60a('0x24')](_0x539db6);};}exports[_0xe60a('0x1f')]=function(_0x4ff1da,_0x27a031){if(_0x4ff1da[_0xe60a('0x25')]['id']){delete _0x4ff1da[_0xe60a('0x25')]['id'];}return db[_0xe60a('0x26')][_0xe60a('0x27')]({'where':{'id':_0x4ff1da[_0xe60a('0x28')]['id']}})[_0xe60a('0x20')](handleEntityNotFound(_0x27a031,null))['then'](saveUpdates(_0x4ff1da['body'],null))[_0xe60a('0x20')](respondWithResult(_0x27a031,null))[_0xe60a('0x29')](handleError(_0x27a031,null));};exports[_0xe60a('0x21')]=function(_0x4ecf73,_0x352561){return db[_0xe60a('0x26')][_0xe60a('0x27')]({'where':{'id':_0x4ecf73[_0xe60a('0x28')]['id']}})[_0xe60a('0x20')](handleEntityNotFound(_0x352561,null))['then'](removeEntity(_0x352561,null))['catch'](handleError(_0x352561,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 746da5b..e04aa8d 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 _0x8369=['util','moment','../../config/environment','define','Condition','tools_conditions','lodash'];(function(_0x46c346,_0x5a0277){var _0x519b32=function(_0x4308ce){while(--_0x4308ce){_0x46c346['push'](_0x46c346['shift']());}};_0x519b32(++_0x5a0277);}(_0x8369,0x1b1));var _0x9836=function(_0x3c41b0,_0x1d7f00){_0x3c41b0=_0x3c41b0-0x0;var _0xd3fea2=_0x8369[_0x3c41b0];return _0xd3fea2;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9836('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(_0x9836('0x3'));var attributes=require('./condition.attributes');module['exports']=function(_0x2c3475,_0x5b73cd){return _0x2c3475[_0x9836('0x4')](_0x9836('0x5'),attributes,{'tableName':_0x9836('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2570=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions','util'];(function(_0x37c5bd,_0x48b34b){var _0x1f9ad1=function(_0x283d34){while(--_0x283d34){_0x37c5bd['push'](_0x37c5bd['shift']());}};_0x1f9ad1(++_0x48b34b);}(_0x2570,0xaf));var _0x0257=function(_0x2b11c8,_0x20be4f){_0x2b11c8=_0x2b11c8-0x0;var _0x4c0768=_0x2570[_0x2b11c8];return _0x4c0768;};'use strict';var _=require('lodash');var util=require(_0x0257('0x0'));var logger=require(_0x0257('0x1'))(_0x0257('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0257('0x3'));var fs=require('fs');var path=require(_0x0257('0x4'));var rimraf=require(_0x0257('0x5'));var config=require(_0x0257('0x6'));var attributes=require('./condition.attributes');module[_0x0257('0x7')]=function(_0xc6338d,_0x3b60cc){return _0xc6338d[_0x0257('0x8')](_0x0257('0x9'),attributes,{'tableName':_0x0257('0xa'),'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 fa92572..a8d55d3 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 _0xa502=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x362fb0,_0x2806de){var _0x220474=function(_0x32412f){while(--_0x32412f){_0x362fb0['push'](_0x362fb0['shift']());}};_0x220474(++_0x2806de);}(_0xa502,0x186));var _0x2a50=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa502[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x2a50('0x0'));var moment=require('moment');var BPromise=require(_0x2a50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a50('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a50('0x3'));var logger=require('../../config/logger')(_0x2a50('0x4'));var config=require('../../config/environment');var jayson=require(_0x2a50('0x5'));var client=jayson['client'][_0x2a50('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5b8da8,_0x4f41ee,_0x5e075a){return new BPromise(function(_0x579b74,_0xed8fd4){return client[_0x2a50('0x7')](_0x5b8da8,_0x5e075a)[_0x2a50('0x8')](function(_0x5e5caf){logger[_0x2a50('0x9')](_0x2a50('0xa'),_0x4f41ee,_0x2a50('0xb'));logger[_0x2a50('0xc')](_0x2a50('0xd'),_0x4f41ee,_0x2a50('0xb'),JSON[_0x2a50('0xe')](_0x5e5caf));if(_0x5e5caf[_0x2a50('0xf')]){if(_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x10')]===0x1f4){logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);return _0xed8fd4(_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);}logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0x5e5caf[_0x2a50('0xf')][_0x2a50('0x11')]);return _0x579b74(_0x5e5caf['error']['message']);}else{logger[_0x2a50('0x9')]('Condition,\x20%s,\x20%s',_0x4f41ee,'request\x20sent');_0x579b74(_0x5e5caf[_0x2a50('0x12')][_0x2a50('0x11')]);}})['catch'](function(_0xff7e96){logger[_0x2a50('0xf')](_0x2a50('0xa'),_0x4f41ee,_0xff7e96);_0xed8fd4(_0xff7e96);});});} \ No newline at end of file +var _0x9ead=['error','message','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x958146,_0x4aea4c){var _0x6c93f7=function(_0x4096eb){while(--_0x4096eb){_0x958146['push'](_0x958146['shift']());}};_0x6c93f7(++_0x4aea4c);}(_0x9ead,0xfe));var _0xd9ea=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0x9ead[_0x5d1d6c];return _0x3f4b02;};'use strict';var _=require(_0xd9ea('0x0'));var util=require(_0xd9ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9ea('0x2'));var db=require(_0xd9ea('0x3'))['db'];var utils=require(_0xd9ea('0x4'));var logger=require(_0xd9ea('0x5'))(_0xd9ea('0x6'));var config=require(_0xd9ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x332028,_0x2af84f,_0x118ea1){return new BPromise(function(_0x12d434,_0x10fe2a){return client[_0xd9ea('0x9')](_0x332028,_0x118ea1)[_0xd9ea('0xa')](function(_0x5af358){logger[_0xd9ea('0xb')](_0xd9ea('0xc'),_0x2af84f,_0xd9ea('0xd'));logger[_0xd9ea('0xe')](_0xd9ea('0xf'),_0x2af84f,_0xd9ea('0xd'),JSON['stringify'](_0x5af358));if(_0x5af358[_0xd9ea('0x10')]){if(_0x5af358['error']['code']===0x1f4){logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x5af358[_0xd9ea('0x10')]['message']);return _0x10fe2a(_0x5af358[_0xd9ea('0x10')]['message']);}logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x5af358[_0xd9ea('0x10')][_0xd9ea('0x11')]);return _0x12d434(_0x5af358[_0xd9ea('0x10')][_0xd9ea('0x11')]);}else{logger['info'](_0xd9ea('0xc'),_0x2af84f,_0xd9ea('0xd'));_0x12d434(_0x5af358['result'][_0xd9ea('0x11')]);}})['catch'](function(_0x24124d){logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x24124d);_0x10fe2a(_0x24124d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6b6eb5a..034bf61 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 _0xc1bd=['../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','multer','connect-timeout','express'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xc1bd,0x18d));var _0xdc1b=function(_0x4e752e,_0x479543){_0x4e752e=_0x4e752e-0x0;var _0x2392b0=_0xc1bd[_0x4e752e];return _0x2392b0;};'use strict';var multer=require(_0xdc1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdc1b('0x1'));var express=require(_0xdc1b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdc1b('0x3'));var config=require(_0xdc1b('0x4'));var controller=require(_0xdc1b('0x5'));router[_0xdc1b('0x6')]('/:id',auth[_0xdc1b('0x7')](),controller[_0xdc1b('0x8')]);router[_0xdc1b('0x9')]('/:id',auth[_0xdc1b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa73a=['./condition.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5116f5,_0x5b95d2){var _0x36da70=function(_0x1b6df8){while(--_0x1b6df8){_0x5116f5['push'](_0x5116f5['shift']());}};_0x36da70(++_0x5b95d2);}(_0xa73a,0x124));var _0xaa73=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0xa73a[_0x3fad5a];return _0x4ca713;};'use strict';var multer=require(_0xaa73('0x0'));var util=require(_0xaa73('0x1'));var path=require(_0xaa73('0x2'));var timeout=require(_0xaa73('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xaa73('0x4'));var interaction=require(_0xaa73('0x5'));var config=require(_0xaa73('0x6'));var controller=require(_0xaa73('0x7'));router['put'](_0xaa73('0x8'),auth[_0xaa73('0x9')](),controller[_0xaa73('0xa')]);router['delete']('/:id',auth[_0xaa73('0x9')](),controller[_0xaa73('0xb')]);module[_0xaa73('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5dfe167..e1bc7ad 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 _0x0b78=['INTEGER','sequelize','exports','name'];(function(_0x5aecc9,_0x357513){var _0x5013b3=function(_0x54bcf6){while(--_0x54bcf6){_0x5aecc9['push'](_0x5aecc9['shift']());}};_0x5013b3(++_0x357513);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x80b7('0x0'));module[_0x80b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x80b7('0x2')},'OrderBy':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x87df=['exports','STRING','name','INTEGER','sequelize'];(function(_0x564a0d,_0x224acb){var _0x2a2f0f=function(_0x5d0b4d){while(--_0x5d0b4d){_0x564a0d['push'](_0x564a0d['shift']());}};_0x2a2f0f(++_0x224acb);}(_0x87df,0x167));var _0xf87d=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x87df[_0x3a7257];return _0x467d25;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'allowNull':![],'unique':_0xf87d('0x3')},'OrderBy':{'type':Sequelize[_0xf87d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf87d('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 94b6323..3db9fe3 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 _0xb96d=['error','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../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','set','reject','save','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','keys','query','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ContactItemType','findAll','rows','show','params','filters','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xb96d,0x9e));var _0xdb96=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xb96d[_0x2ec2bf];return _0x2c279c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb96('0x0'));var rimraf=require(_0xdb96('0x1'));var zipdir=require(_0xdb96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb96('0x3'));var moment=require(_0xdb96('0x4'));var BPromise=require(_0xdb96('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb96('0x6'));var sox=require(_0xdb96('0x7'));var csv=require(_0xdb96('0x8'));var ejs=require(_0xdb96('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb96('0xa'));var crypto=require(_0xdb96('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdb96('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdb96('0xd'));var Papa=require(_0xdb96('0xe'));var Redis=require('ioredis');var authService=require(_0xdb96('0xf'));var qs=require(_0xdb96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb96('0x11'));var logger=require(_0xdb96('0x12'))(_0xdb96('0x13'));var utils=require(_0xdb96('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb96('0x15'));var db=require(_0xdb96('0x16'))['db'];function respondWithStatusCode(_0x33e478,_0x5a004c){_0x5a004c=_0x5a004c||0xcc;return function(_0x3afec0){if(_0x3afec0){return _0x33e478[_0xdb96('0x17')](_0x5a004c);}return _0x33e478[_0xdb96('0x18')](_0x5a004c)[_0xdb96('0x19')]();};}function respondWithResult(_0x359970,_0xf88086){_0xf88086=_0xf88086||0xc8;return function(_0x2b3c32){if(_0x2b3c32){return _0x359970[_0xdb96('0x18')](_0xf88086)[_0xdb96('0x1a')](_0x2b3c32);}};}function respondWithFilteredResult(_0x745780,_0xb95f96){return function(_0x94bbc3){if(_0x94bbc3){var _0x190b52=_0x94bbc3[_0xdb96('0x1b')],_0x596673=_0xb95f96[_0xdb96('0x1c')],_0x3a94da=_0xb95f96['offset']+_0xb95f96[_0xdb96('0x1d')],_0x2a766e;if(_0x3a94da>=_0x190b52){_0x3a94da=_0x190b52;_0x2a766e=0xc8;}else{_0x2a766e=0xce;}_0x745780[_0xdb96('0x18')](_0x2a766e);return _0x745780[_0xdb96('0x1e')]('Content-Range',_0x596673+'-'+_0x3a94da+'/'+_0x190b52)['json'](_0x94bbc3);}return null;};}function patchUpdates(_0x16f863){return function(_0x51ab35){try{jsonpatch['apply'](_0x51ab35,_0x16f863,!![]);}catch(_0x2013e4){return BPromise[_0xdb96('0x1f')](_0x2013e4);}return _0x51ab35[_0xdb96('0x20')]();};}function saveUpdates(_0x11b7bd,_0x518a91){return function(_0x6c3170){if(_0x6c3170){return _0x6c3170['update'](_0x11b7bd)[_0xdb96('0x21')](function(_0x467a5d){return _0x467a5d;});}return null;};}function removeEntity(_0x4ddf48,_0x111673){return function(_0x29f0d4){if(_0x29f0d4){return _0x29f0d4[_0xdb96('0x22')]()[_0xdb96('0x21')](function(){var _0x1a5b88=_0x29f0d4[_0xdb96('0x23')]({'plain':!![]});var _0x25834a='ContactItemTypes';return db[_0xdb96('0x24')][_0xdb96('0x22')]({'where':{'type':_0x25834a,'resourceId':_0x1a5b88['id']}})[_0xdb96('0x21')](function(){return _0x29f0d4;});})['then'](function(){_0x4ddf48[_0xdb96('0x18')](0xcc)[_0xdb96('0x19')]();});}};}function handleEntityNotFound(_0x169425,_0x41eb65){return function(_0x2663c4){if(!_0x2663c4){_0x169425[_0xdb96('0x17')](0x194);}return _0x2663c4;};}function handleError(_0x1ef903,_0x42365){_0x42365=_0x42365||0x1f4;return function(_0xfa9833){logger['error'](_0xfa9833[_0xdb96('0x25')]);if(_0xfa9833[_0xdb96('0x26')]){delete _0xfa9833['name'];}_0x1ef903[_0xdb96('0x18')](_0x42365)[_0xdb96('0x27')](_0xfa9833);};}exports['index']=function(_0x32eabc,_0x118a43){var _0x33e7bb={},_0x1317b8={},_0x346ce2={'count':0x0,'rows':[]};var _0xb54f12=_[_0xdb96('0x28')](db['ContactItemType'][_0xdb96('0x29')],function(_0xe1f111){return{'name':_0xe1f111[_0xdb96('0x2a')],'type':_0xe1f111[_0xdb96('0x2b')]['key']};});_0x1317b8['model']=_[_0xdb96('0x28')](_0xb54f12,_0xdb96('0x26'));_0x1317b8['query']=_[_0xdb96('0x2c')](_0x32eabc['query']);_0x1317b8['filters']=_['intersection'](_0x1317b8['model'],_0x1317b8[_0xdb96('0x2d')]);_0x33e7bb['attributes']=_['intersection'](_0x1317b8[_0xdb96('0x2e')],qs[_0xdb96('0x2f')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x2f')]));_0x33e7bb['attributes']=_0x33e7bb[_0xdb96('0x30')][_0xdb96('0x31')]?_0x33e7bb[_0xdb96('0x30')]:_0x1317b8[_0xdb96('0x2e')];if(!_0x32eabc[_0xdb96('0x2d')]['hasOwnProperty'](_0xdb96('0x32'))){_0x33e7bb[_0xdb96('0x1d')]=qs[_0xdb96('0x1d')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x1d')]);_0x33e7bb[_0xdb96('0x1c')]=qs[_0xdb96('0x1c')](_0x32eabc['query']['offset']);}_0x33e7bb['order']=qs[_0xdb96('0x33')](_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x33')]);_0x33e7bb[_0xdb96('0x34')]=qs['filters'](_[_0xdb96('0x35')](_0x32eabc['query'],_0x1317b8['filters']),_0xb54f12);if(_0x32eabc[_0xdb96('0x2d')][_0xdb96('0x36')]){_0x33e7bb[_0xdb96('0x34')]=_[_0xdb96('0x37')](_0x33e7bb['where'],{'$or':_[_0xdb96('0x28')](_0xb54f12,function(_0xa69018){if(_0xa69018[_0xdb96('0x2b')]!==_0xdb96('0x38')){var _0x1b18b5={};_0x1b18b5[_0xa69018['name']]={'$like':'%'+_0x32eabc[_0xdb96('0x2d')]['filter']+'%'};return _0x1b18b5;}})});}_0x33e7bb=_[_0xdb96('0x37')]({},_0x33e7bb,_0x32eabc[_0xdb96('0x39')]);var _0x34c9c3={'where':_0x33e7bb[_0xdb96('0x34')]};return db[_0xdb96('0x3a')]['count'](_0x34c9c3)[_0xdb96('0x21')](function(_0x4da5b2){_0x346ce2[_0xdb96('0x1b')]=_0x4da5b2;if(_0x32eabc[_0xdb96('0x2d')]['includeAll']){_0x33e7bb['include']=[{'all':!![]}];}return db[_0xdb96('0x3a')][_0xdb96('0x3b')](_0x33e7bb);})[_0xdb96('0x21')](function(_0x4501f1){_0x346ce2[_0xdb96('0x3c')]=_0x4501f1;return _0x346ce2;})[_0xdb96('0x21')](respondWithFilteredResult(_0x118a43,_0x33e7bb))['catch'](handleError(_0x118a43,null));};exports[_0xdb96('0x3d')]=function(_0x5266d5,_0x2a93ca){var _0x58635d={'raw':!![],'where':{'id':_0x5266d5[_0xdb96('0x3e')]['id']}},_0x5466e1={};_0x5466e1['model']=_['keys'](db['ContactItemType']['rawAttributes']);_0x5466e1[_0xdb96('0x2d')]=_[_0xdb96('0x2c')](_0x5266d5['query']);_0x5466e1[_0xdb96('0x3f')]=_[_0xdb96('0x40')](_0x5466e1[_0xdb96('0x2e')],_0x5466e1['query']);_0x58635d[_0xdb96('0x30')]=_[_0xdb96('0x40')](_0x5466e1['model'],qs[_0xdb96('0x2f')](_0x5266d5[_0xdb96('0x2d')][_0xdb96('0x2f')]));_0x58635d['attributes']=_0x58635d[_0xdb96('0x30')][_0xdb96('0x31')]?_0x58635d[_0xdb96('0x30')]:_0x5466e1['model'];if(_0x5266d5[_0xdb96('0x2d')]['includeAll']){_0x58635d[_0xdb96('0x41')]=[{'all':!![]}];}_0x58635d=_[_0xdb96('0x37')]({},_0x58635d,_0x5266d5[_0xdb96('0x39')]);return db['ContactItemType'][_0xdb96('0x42')](_0x58635d)['then'](handleEntityNotFound(_0x2a93ca,null))[_0xdb96('0x21')](respondWithResult(_0x2a93ca,null))['catch'](handleError(_0x2a93ca,null));};exports['create']=function(_0x593dfe,_0x327a92){return db[_0xdb96('0x3a')][_0xdb96('0x43')](_0x593dfe[_0xdb96('0x44')],{})[_0xdb96('0x21')](function(_0xf90551){var _0xb6725c=_0x593dfe[_0xdb96('0x45')][_0xdb96('0x23')]({'plain':!![]});if(!_0xb6725c)throw new Error(_0xdb96('0x46'));if(_0xb6725c[_0xdb96('0x47')]==='user'){var _0x3be97e=_0xf90551[_0xdb96('0x23')]({'plain':!![]});var _0x175688=_0xdb96('0x48');return db[_0xdb96('0x49')][_0xdb96('0x42')]({'where':{'name':_0x175688,'userProfileId':_0xb6725c[_0xdb96('0x4a')]},'raw':!![]})['then'](function(_0x550f43){if(_0x550f43&&_0x550f43[_0xdb96('0x4b')]===0x0){return db[_0xdb96('0x24')][_0xdb96('0x43')]({'name':_0x3be97e[_0xdb96('0x26')],'resourceId':_0x3be97e['id'],'type':_0x550f43[_0xdb96('0x26')],'sectionId':_0x550f43['id']},{})[_0xdb96('0x21')](function(){return _0xf90551;});}else{return _0xf90551;}})['catch'](function(_0x1e49dd){logger[_0xdb96('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e49dd);throw _0x1e49dd;});}return _0xf90551;})[_0xdb96('0x21')](respondWithResult(_0x327a92,0xc9))['catch'](handleError(_0x327a92,null));};exports['update']=function(_0x53a951,_0x348d89){if(_0x53a951['body']['id']){delete _0x53a951[_0xdb96('0x44')]['id'];}return db['ContactItemType'][_0xdb96('0x42')]({'where':{'id':_0x53a951[_0xdb96('0x3e')]['id']}})[_0xdb96('0x21')](handleEntityNotFound(_0x348d89,null))[_0xdb96('0x21')](saveUpdates(_0x53a951[_0xdb96('0x44')],null))[_0xdb96('0x21')](respondWithResult(_0x348d89,null))[_0xdb96('0x4d')](handleError(_0x348d89,null));};exports[_0xdb96('0x22')]=function(_0x14b38d,_0x5181c9){return db[_0xdb96('0x3a')][_0xdb96('0x42')]({'where':{'id':_0x14b38d[_0xdb96('0x3e')]['id']}})[_0xdb96('0x21')](handleEntityNotFound(_0x5181c9,null))[_0xdb96('0x21')](removeEntity(_0x5181c9,null))[_0xdb96('0x4d')](handleError(_0x5181c9,null));}; \ No newline at end of file +var _0x9e69=['filter','merge','options','ContactItemType','include','findAll','rows','catch','show','keys','includeAll','find','create','role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','status','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x9e69,0x150));var _0x99e6=function(_0x345be8,_0x17a84a){_0x345be8=_0x345be8-0x0;var _0x47cc18=_0x9e69[_0x345be8];return _0x47cc18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x99e6('0x0'));var rimraf=require(_0x99e6('0x1'));var zipdir=require(_0x99e6('0x2'));var jsonpatch=require(_0x99e6('0x3'));var rp=require('request-promise');var moment=require(_0x99e6('0x4'));var BPromise=require(_0x99e6('0x5'));var Mustache=require('mustache');var util=require(_0x99e6('0x6'));var path=require(_0x99e6('0x7'));var sox=require(_0x99e6('0x8'));var csv=require('to-csv');var ejs=require(_0x99e6('0x9'));var fs=require('fs');var _=require(_0x99e6('0xa'));var squel=require(_0x99e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x99e6('0xc'));var deskjs=require(_0x99e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x99e6('0xe'));var Papa=require(_0x99e6('0xf'));var Redis=require('ioredis');var authService=require(_0x99e6('0x10'));var qs=require(_0x99e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99e6('0x12'))(_0x99e6('0x13'));var utils=require(_0x99e6('0x14'));var config=require(_0x99e6('0x15'));var licenseUtil=require(_0x99e6('0x16'));var db=require(_0x99e6('0x17'))['db'];function respondWithStatusCode(_0x51de85,_0x13a62b){_0x13a62b=_0x13a62b||0xcc;return function(_0x4033c5){if(_0x4033c5){return _0x51de85[_0x99e6('0x18')](_0x13a62b);}return _0x51de85['status'](_0x13a62b)[_0x99e6('0x19')]();};}function respondWithResult(_0x4061b2,_0x2cf6a4){_0x2cf6a4=_0x2cf6a4||0xc8;return function(_0x57111c){if(_0x57111c){return _0x4061b2['status'](_0x2cf6a4)['json'](_0x57111c);}};}function respondWithFilteredResult(_0x40fdb8,_0x4741c9){return function(_0x1d910a){if(_0x1d910a){var _0x5d5cd5=_0x1d910a[_0x99e6('0x1a')],_0x18fa86=_0x4741c9[_0x99e6('0x1b')],_0x38fcdd=_0x4741c9['offset']+_0x4741c9[_0x99e6('0x1c')],_0xebfd62;if(_0x38fcdd>=_0x5d5cd5){_0x38fcdd=_0x5d5cd5;_0xebfd62=0xc8;}else{_0xebfd62=0xce;}_0x40fdb8['status'](_0xebfd62);return _0x40fdb8[_0x99e6('0x1d')](_0x99e6('0x1e'),_0x18fa86+'-'+_0x38fcdd+'/'+_0x5d5cd5)['json'](_0x1d910a);}return null;};}function patchUpdates(_0x29dbea){return function(_0x3c4cc8){try{jsonpatch[_0x99e6('0x1f')](_0x3c4cc8,_0x29dbea,!![]);}catch(_0x2578f6){return BPromise[_0x99e6('0x20')](_0x2578f6);}return _0x3c4cc8[_0x99e6('0x21')]();};}function saveUpdates(_0x41a32b,_0x95a8e5){return function(_0x46f1d8){if(_0x46f1d8){return _0x46f1d8[_0x99e6('0x22')](_0x41a32b)['then'](function(_0x40590f){return _0x40590f;});}return null;};}function removeEntity(_0xef9c63,_0x16f05d){return function(_0x249872){if(_0x249872){return _0x249872[_0x99e6('0x23')]()[_0x99e6('0x24')](function(){var _0x2a308f=_0x249872[_0x99e6('0x25')]({'plain':!![]});var _0x2033af=_0x99e6('0x26');return db[_0x99e6('0x27')][_0x99e6('0x23')]({'where':{'type':_0x2033af,'resourceId':_0x2a308f['id']}})[_0x99e6('0x24')](function(){return _0x249872;});})[_0x99e6('0x24')](function(){_0xef9c63[_0x99e6('0x28')](0xcc)[_0x99e6('0x19')]();});}};}function handleEntityNotFound(_0x17bc07,_0x57815a){return function(_0x43038d){if(!_0x43038d){_0x17bc07['sendStatus'](0x194);}return _0x43038d;};}function handleError(_0x30b956,_0x2bcd72){_0x2bcd72=_0x2bcd72||0x1f4;return function(_0x35d4f2){logger['error'](_0x35d4f2[_0x99e6('0x29')]);if(_0x35d4f2['name']){delete _0x35d4f2[_0x99e6('0x2a')];}_0x30b956['status'](_0x2bcd72)[_0x99e6('0x2b')](_0x35d4f2);};}exports[_0x99e6('0x2c')]=function(_0x4b58c7,_0x4d6b19){var _0x2c9b92={},_0x350fa0={},_0x29740d={'count':0x0,'rows':[]};var _0x1f4c63=_[_0x99e6('0x2d')](db['ContactItemType'][_0x99e6('0x2e')],function(_0x4b204a){return{'name':_0x4b204a[_0x99e6('0x2f')],'type':_0x4b204a['type']['key']};});_0x350fa0[_0x99e6('0x30')]=_['map'](_0x1f4c63,'name');_0x350fa0[_0x99e6('0x31')]=_['keys'](_0x4b58c7[_0x99e6('0x31')]);_0x350fa0[_0x99e6('0x32')]=_[_0x99e6('0x33')](_0x350fa0['model'],_0x350fa0[_0x99e6('0x31')]);_0x2c9b92[_0x99e6('0x34')]=_[_0x99e6('0x33')](_0x350fa0[_0x99e6('0x30')],qs['fields'](_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x35')]));_0x2c9b92[_0x99e6('0x34')]=_0x2c9b92[_0x99e6('0x34')][_0x99e6('0x36')]?_0x2c9b92[_0x99e6('0x34')]:_0x350fa0['model'];if(!_0x4b58c7[_0x99e6('0x31')]['hasOwnProperty']('nolimit')){_0x2c9b92['limit']=qs[_0x99e6('0x1c')](_0x4b58c7[_0x99e6('0x31')]['limit']);_0x2c9b92[_0x99e6('0x1b')]=qs[_0x99e6('0x1b')](_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x1b')]);}_0x2c9b92[_0x99e6('0x37')]=qs[_0x99e6('0x38')](_0x4b58c7['query'][_0x99e6('0x38')]);_0x2c9b92[_0x99e6('0x39')]=qs[_0x99e6('0x32')](_[_0x99e6('0x3a')](_0x4b58c7['query'],_0x350fa0[_0x99e6('0x32')]),_0x1f4c63);if(_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x3b')]){_0x2c9b92[_0x99e6('0x39')]=_[_0x99e6('0x3c')](_0x2c9b92[_0x99e6('0x39')],{'$or':_[_0x99e6('0x2d')](_0x1f4c63,function(_0x58332f){if(_0x58332f['type']!=='VIRTUAL'){var _0x20d7bd={};_0x20d7bd[_0x58332f[_0x99e6('0x2a')]]={'$like':'%'+_0x4b58c7['query'][_0x99e6('0x3b')]+'%'};return _0x20d7bd;}})});}_0x2c9b92=_[_0x99e6('0x3c')]({},_0x2c9b92,_0x4b58c7[_0x99e6('0x3d')]);var _0x6e0c1e={'where':_0x2c9b92[_0x99e6('0x39')]};return db[_0x99e6('0x3e')][_0x99e6('0x1a')](_0x6e0c1e)[_0x99e6('0x24')](function(_0x48a318){_0x29740d[_0x99e6('0x1a')]=_0x48a318;if(_0x4b58c7[_0x99e6('0x31')]['includeAll']){_0x2c9b92[_0x99e6('0x3f')]=[{'all':!![]}];}return db[_0x99e6('0x3e')][_0x99e6('0x40')](_0x2c9b92);})[_0x99e6('0x24')](function(_0x315e6b){_0x29740d[_0x99e6('0x41')]=_0x315e6b;return _0x29740d;})[_0x99e6('0x24')](respondWithFilteredResult(_0x4d6b19,_0x2c9b92))[_0x99e6('0x42')](handleError(_0x4d6b19,null));};exports[_0x99e6('0x43')]=function(_0x534f05,_0x562921){var _0x497e3d={'raw':!![],'where':{'id':_0x534f05['params']['id']}},_0x4abd00={};_0x4abd00[_0x99e6('0x30')]=_[_0x99e6('0x44')](db['ContactItemType'][_0x99e6('0x2e')]);_0x4abd00[_0x99e6('0x31')]=_[_0x99e6('0x44')](_0x534f05[_0x99e6('0x31')]);_0x4abd00[_0x99e6('0x32')]=_[_0x99e6('0x33')](_0x4abd00['model'],_0x4abd00[_0x99e6('0x31')]);_0x497e3d[_0x99e6('0x34')]=_[_0x99e6('0x33')](_0x4abd00[_0x99e6('0x30')],qs[_0x99e6('0x35')](_0x534f05[_0x99e6('0x31')][_0x99e6('0x35')]));_0x497e3d[_0x99e6('0x34')]=_0x497e3d[_0x99e6('0x34')][_0x99e6('0x36')]?_0x497e3d[_0x99e6('0x34')]:_0x4abd00[_0x99e6('0x30')];if(_0x534f05[_0x99e6('0x31')][_0x99e6('0x45')]){_0x497e3d['include']=[{'all':!![]}];}_0x497e3d=_['merge']({},_0x497e3d,_0x534f05['options']);return db['ContactItemType'][_0x99e6('0x46')](_0x497e3d)[_0x99e6('0x24')](handleEntityNotFound(_0x562921,null))[_0x99e6('0x24')](respondWithResult(_0x562921,null))[_0x99e6('0x42')](handleError(_0x562921,null));};exports[_0x99e6('0x47')]=function(_0x55e660,_0x558d09){return db[_0x99e6('0x3e')][_0x99e6('0x47')](_0x55e660['body'],{})['then'](function(_0x10a08e){var _0x437bf2=_0x55e660['user'][_0x99e6('0x25')]({'plain':!![]});if(!_0x437bf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x437bf2[_0x99e6('0x48')]===_0x99e6('0x49')){var _0x2160ea=_0x10a08e['get']({'plain':!![]});var _0x1835d9=_0x99e6('0x26');return db['UserProfileSection'][_0x99e6('0x46')]({'where':{'name':_0x1835d9,'userProfileId':_0x437bf2[_0x99e6('0x4a')]},'raw':!![]})[_0x99e6('0x24')](function(_0x49b7ab){if(_0x49b7ab&&_0x49b7ab['autoAssociation']===0x0){return db[_0x99e6('0x27')][_0x99e6('0x47')]({'name':_0x2160ea['name'],'resourceId':_0x2160ea['id'],'type':_0x49b7ab[_0x99e6('0x2a')],'sectionId':_0x49b7ab['id']},{})[_0x99e6('0x24')](function(){return _0x10a08e;});}else{return _0x10a08e;}})[_0x99e6('0x42')](function(_0x40de95){logger[_0x99e6('0x4b')](_0x99e6('0x4c'),_0x40de95);throw _0x40de95;});}return _0x10a08e;})[_0x99e6('0x24')](respondWithResult(_0x558d09,0xc9))['catch'](handleError(_0x558d09,null));};exports[_0x99e6('0x22')]=function(_0x896906,_0x561b1f){if(_0x896906[_0x99e6('0x4d')]['id']){delete _0x896906[_0x99e6('0x4d')]['id'];}return db['ContactItemType'][_0x99e6('0x46')]({'where':{'id':_0x896906[_0x99e6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x561b1f,null))[_0x99e6('0x24')](saveUpdates(_0x896906['body'],null))[_0x99e6('0x24')](respondWithResult(_0x561b1f,null))[_0x99e6('0x42')](handleError(_0x561b1f,null));};exports[_0x99e6('0x23')]=function(_0xf0cadd,_0x3dcdae){return db[_0x99e6('0x3e')][_0x99e6('0x46')]({'where':{'id':_0xf0cadd[_0x99e6('0x4e')]['id']}})[_0x99e6('0x24')](handleEntityNotFound(_0x3dcdae,null))[_0x99e6('0x24')](removeEntity(_0x3dcdae,null))[_0x99e6('0x42')](handleError(_0x3dcdae,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 63ce18c..86a58d5 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 _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x322e76,_0x1dc92b){var _0xd8144f=function(_0x55a8ff){while(--_0x55a8ff){_0x322e76['push'](_0x322e76['shift']());}};_0xd8144f(++_0x1dc92b);}(_0xb138,0x1dd));var _0x8b13=function(_0x353751,_0x24d599){_0x353751=_0x353751-0x0;var _0x316f24=_0xb138[_0x353751];return _0x316f24;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f27=['rimraf','../../config/environment','exports','define','tools_contact_item_types','lodash','util','moment','path'];(function(_0x18329a,_0x5c7619){var _0x10e340=function(_0x1e78a8){while(--_0x1e78a8){_0x18329a['push'](_0x18329a['shift']());}};_0x10e340(++_0x5c7619);}(_0x7f27,0x12e));var _0x77f2=function(_0x11f771,_0xe39186){_0x11f771=_0x11f771-0x0;var _0x52edf0=_0x7f27[_0x11f771];return _0x52edf0;};'use strict';var _=require(_0x77f2('0x0'));var util=require(_0x77f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x77f2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77f2('0x3'));var rimraf=require(_0x77f2('0x4'));var config=require(_0x77f2('0x5'));var attributes=require('./contactItemType.attributes');module[_0x77f2('0x6')]=function(_0x5da5eb,_0x292221){return _0x5da5eb[_0x77f2('0x7')]('ContactItemType',attributes,{'tableName':_0x77f2('0x8'),'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 7d49029..cbf35e4 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 _0xd737=['lodash','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','request','info','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd737,0x85));var _0x7d73=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xd737[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var moment=require(_0x7d73('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d73('0x2'));var fs=require('fs');var Redis=require(_0x7d73('0x3'));var db=require(_0x7d73('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d73('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d73('0x6')][_0x7d73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x70a9f1,_0x1bd2f4,_0x10dec9){return new BPromise(function(_0x4552e3,_0x3e100b){return client[_0x7d73('0x8')](_0x70a9f1,_0x10dec9)['then'](function(_0x57fbe4){logger[_0x7d73('0x9')](_0x7d73('0xa'),_0x1bd2f4,'request\x20sent');logger[_0x7d73('0xb')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1bd2f4,_0x7d73('0xc'),JSON[_0x7d73('0xd')](_0x57fbe4));if(_0x57fbe4[_0x7d73('0xe')]){if(_0x57fbe4['error'][_0x7d73('0xf')]===0x1f4){logger[_0x7d73('0xe')]('ContactItemType,\x20%s,\x20%s',_0x1bd2f4,_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);return _0x3e100b(_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);}logger['error'](_0x7d73('0xa'),_0x1bd2f4,_0x57fbe4['error']['message']);return _0x4552e3(_0x57fbe4[_0x7d73('0xe')][_0x7d73('0x10')]);}else{logger[_0x7d73('0x9')]('ContactItemType,\x20%s,\x20%s',_0x1bd2f4,_0x7d73('0xc'));_0x4552e3(_0x57fbe4[_0x7d73('0x11')][_0x7d73('0x10')]);}})[_0x7d73('0x12')](function(_0x113598){logger[_0x7d73('0xe')](_0x7d73('0xa'),_0x1bd2f4,_0x113598);_0x3e100b(_0x113598);});});} \ No newline at end of file +var _0x0eec=['jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3a5c21,_0x3635f3){var _0x403652=function(_0x1a782c){while(--_0x1a782c){_0x3a5c21['push'](_0x3a5c21['shift']());}};_0x403652(++_0x3635f3);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 64ecf81..caad55c 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 _0x277b=['express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x277b,0x1a6));var _0xb277=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x277b[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xb277('0x0'));var util=require(_0xb277('0x1'));var path=require('path');var timeout=require(_0xb277('0x2'));var express=require(_0xb277('0x3'));var router=express['Router']();var auth=require(_0xb277('0x4'));var interaction=require(_0xb277('0x5'));var config=require('../../config/environment');var controller=require(_0xb277('0x6'));router[_0xb277('0x7')]('/',auth[_0xb277('0x8')](),controller['index']);router[_0xb277('0x7')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xa')]);router[_0xb277('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb277('0xc')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xd')]);router[_0xb277('0xe')](_0xb277('0x9'),auth[_0xb277('0x8')](),controller[_0xb277('0xf')]);module[_0xb277('0x10')]=router; \ No newline at end of file +var _0x0d31=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','put','update','destroy','exports','multer','util'];(function(_0x51a9c6,_0x571ec0){var _0x43e5fb=function(_0x20600b){while(--_0x20600b){_0x51a9c6['push'](_0x51a9c6['shift']());}};_0x43e5fb(++_0x571ec0);}(_0x0d31,0xdb));var _0x10d3=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x0d31[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x10d3('0x0'));var util=require(_0x10d3('0x1'));var path=require(_0x10d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10d3('0x3')]();var auth=require(_0x10d3('0x4'));var interaction=require(_0x10d3('0x5'));var config=require(_0x10d3('0x6'));var controller=require(_0x10d3('0x7'));router['get']('/',auth[_0x10d3('0x8')](),controller['index']);router[_0x10d3('0x9')](_0x10d3('0xa'),auth[_0x10d3('0x8')](),controller[_0x10d3('0xb')]);router[_0x10d3('0xc')]('/',auth[_0x10d3('0x8')](),controller['create']);router[_0x10d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x10d3('0xe')]);router['delete'](_0x10d3('0xa'),auth[_0x10d3('0x8')](),controller[_0x10d3('0xf')]);module[_0x10d3('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 771d634..a7610bb 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 _0xd4f4=['sequelize','name','STRING'];(function(_0x2c0319,_0x615db7){var _0x568847=function(_0x5c6c72){while(--_0x5c6c72){_0x2c0319['push'](_0x2c0319['shift']());}};_0x568847(++_0x615db7);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x437860,_0x1989c7){_0x437860=_0x437860-0x0;var _0x59509f=_0xd4f4[_0x437860];return _0x59509f;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d4f('0x1')},'description':{'type':Sequelize[_0x4d4f('0x2')]}}; \ No newline at end of file +var _0x2873=['STRING','name','sequelize','exports'];(function(_0x57b167,_0x2a7559){var _0x43ed78=function(_0x3c7afe){while(--_0x3c7afe){_0x57b167['push'](_0x57b167['shift']());}};_0x43ed78(++_0x2a7559);}(_0x2873,0x1f2));var _0x3287=function(_0x3930c0,_0x1755c3){_0x3930c0=_0x3930c0-0x0;var _0x19d6dc=_0x2873[_0x3930c0];return _0x19d6dc;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'name':{'type':Sequelize[_0x3287('0x2')],'allowNull':![],'unique':_0x3287('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index aecec75..931ced3 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 _0x684f=['attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','hasOwnProperty','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','CustomDashboards','error','stack','name','send','map','fieldName','type','key','query','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','Dashboard','includeAll','findAll','catch','show','params','keys','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','counter','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport'];(function(_0x5e2862,_0x4760eb){var _0x8dcad4=function(_0x205ddf){while(--_0x205ddf){_0x5e2862['push'](_0x5e2862['shift']());}};_0x8dcad4(++_0x4760eb);}(_0x684f,0x7f));var _0xf684=function(_0x15da7c,_0x44b14f){_0x15da7c=_0x15da7c-0x0;var _0x4e0563=_0x684f[_0x15da7c];return _0x4e0563;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf684('0x0'));var rimraf=require(_0xf684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf684('0x2'));var moment=require('moment');var BPromise=require(_0xf684('0x3'));var Mustache=require(_0xf684('0x4'));var util=require(_0xf684('0x5'));var path=require(_0xf684('0x6'));var sox=require(_0xf684('0x7'));var csv=require(_0xf684('0x8'));var ejs=require(_0xf684('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf684('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf684('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf684('0xc'));var Papa=require('papaparse');var Redis=require(_0xf684('0xd'));var authService=require(_0xf684('0xe'));var qs=require(_0xf684('0xf'));var as=require(_0xf684('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf684('0x11'))(_0xf684('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf684('0x13'));var db=require(_0xf684('0x14'))['db'];config['redis']=_[_0xf684('0x15')](config[_0xf684('0x16')],{'host':_0xf684('0x17'),'port':0x18eb});var socket=require(_0xf684('0x18'))(new Redis(config[_0xf684('0x16')]));require(_0xf684('0x19'))['register'](socket);function respondWithStatusCode(_0xd94a1f,_0x35b6d1){_0x35b6d1=_0x35b6d1||0xcc;return function(_0x145d34){if(_0x145d34){return _0xd94a1f[_0xf684('0x1a')](_0x35b6d1);}return _0xd94a1f['status'](_0x35b6d1)[_0xf684('0x1b')]();};}function respondWithResult(_0x28b350,_0x46b4de){_0x46b4de=_0x46b4de||0xc8;return function(_0x4122d1){if(_0x4122d1){return _0x28b350[_0xf684('0x1c')](_0x46b4de)[_0xf684('0x1d')](_0x4122d1);}};}function respondWithFilteredResult(_0x2f1c6f,_0x62f815){return function(_0x2125b9){if(_0x2125b9){var _0x2d21a7=_0x2125b9[_0xf684('0x1e')],_0x2b403e=_0x62f815[_0xf684('0x1f')],_0x12edff=_0x62f815['offset']+_0x62f815[_0xf684('0x20')],_0x34bee5;if(_0x12edff>=_0x2d21a7){_0x12edff=_0x2d21a7;_0x34bee5=0xc8;}else{_0x34bee5=0xce;}_0x2f1c6f['status'](_0x34bee5);return _0x2f1c6f[_0xf684('0x21')](_0xf684('0x22'),_0x2b403e+'-'+_0x12edff+'/'+_0x2d21a7)['json'](_0x2125b9);}return null;};}function patchUpdates(_0x72f0cd){return function(_0x5872ab){try{jsonpatch['apply'](_0x5872ab,_0x72f0cd,!![]);}catch(_0xc664f0){return BPromise['reject'](_0xc664f0);}return _0x5872ab[_0xf684('0x23')]();};}function saveUpdates(_0x4b4d3e,_0x5f38dd){return function(_0x24aef5){if(_0x24aef5){return _0x24aef5[_0xf684('0x24')](_0x4b4d3e)['then'](function(_0x5dd4f8){return _0x5dd4f8;});}return null;};}function removeEntity(_0x41c2a5,_0x20205a){return function(_0x2e27cb){if(_0x2e27cb){return _0x2e27cb[_0xf684('0x25')]()[_0xf684('0x26')](function(){var _0x3c51fc=_0x2e27cb['get']({'plain':!![]});var _0x3f9102=_0xf684('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f9102,'resourceId':_0x3c51fc['id']}})[_0xf684('0x26')](function(){return _0x2e27cb;});})[_0xf684('0x26')](function(){_0x41c2a5[_0xf684('0x1c')](0xcc)[_0xf684('0x1b')]();});}};}function handleEntityNotFound(_0x38beac,_0x919007){return function(_0x489114){if(!_0x489114){_0x38beac[_0xf684('0x1a')](0x194);}return _0x489114;};}function handleError(_0x1e4a5f,_0xa6f8e2){_0xa6f8e2=_0xa6f8e2||0x1f4;return function(_0x25dbc9){logger[_0xf684('0x28')](_0x25dbc9[_0xf684('0x29')]);if(_0x25dbc9[_0xf684('0x2a')]){delete _0x25dbc9[_0xf684('0x2a')];}_0x1e4a5f[_0xf684('0x1c')](_0xa6f8e2)[_0xf684('0x2b')](_0x25dbc9);};}exports['index']=function(_0x3f1b62,_0x5ed612){var _0x3a8a28={},_0x2ebe79={},_0x43a785={'count':0x0,'rows':[]};var _0x2aa022=_[_0xf684('0x2c')](db['Dashboard']['rawAttributes'],function(_0x3bf487){return{'name':_0x3bf487[_0xf684('0x2d')],'type':_0x3bf487[_0xf684('0x2e')][_0xf684('0x2f')]};});_0x2ebe79['model']=_['map'](_0x2aa022,'name');_0x2ebe79[_0xf684('0x30')]=_['keys'](_0x3f1b62[_0xf684('0x30')]);_0x2ebe79['filters']=_[_0xf684('0x31')](_0x2ebe79[_0xf684('0x32')],_0x2ebe79['query']);_0x3a8a28['attributes']=_['intersection'](_0x2ebe79[_0xf684('0x32')],qs[_0xf684('0x33')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x33')]));_0x3a8a28['attributes']=_0x3a8a28[_0xf684('0x34')]['length']?_0x3a8a28[_0xf684('0x34')]:_0x2ebe79[_0xf684('0x32')];if(!_0x3f1b62['query']['hasOwnProperty'](_0xf684('0x35'))){_0x3a8a28[_0xf684('0x20')]=qs['limit'](_0x3f1b62[_0xf684('0x30')][_0xf684('0x20')]);_0x3a8a28[_0xf684('0x1f')]=qs[_0xf684('0x1f')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x1f')]);}_0x3a8a28[_0xf684('0x36')]=qs[_0xf684('0x37')](_0x3f1b62[_0xf684('0x30')][_0xf684('0x37')]);_0x3a8a28[_0xf684('0x38')]=qs['filters'](_[_0xf684('0x39')](_0x3f1b62[_0xf684('0x30')],_0x2ebe79[_0xf684('0x3a')]),_0x2aa022);if(_0x3f1b62[_0xf684('0x30')]['filter']){_0x3a8a28[_0xf684('0x38')]=_[_0xf684('0x3b')](_0x3a8a28[_0xf684('0x38')],{'$or':_[_0xf684('0x2c')](_0x2aa022,function(_0xc508bb){if(_0xc508bb['type']!==_0xf684('0x3c')){var _0x4f8b5b={};_0x4f8b5b[_0xc508bb[_0xf684('0x2a')]]={'$like':'%'+_0x3f1b62[_0xf684('0x30')][_0xf684('0x3d')]+'%'};return _0x4f8b5b;}})});}_0x3a8a28=_[_0xf684('0x3b')]({},_0x3a8a28,_0x3f1b62[_0xf684('0x3e')]);var _0x3a1912={'where':_0x3a8a28[_0xf684('0x38')]};return db[_0xf684('0x3f')]['count'](_0x3a1912)[_0xf684('0x26')](function(_0x57556b){_0x43a785[_0xf684('0x1e')]=_0x57556b;if(_0x3f1b62[_0xf684('0x30')][_0xf684('0x40')]){_0x3a8a28['include']=[{'all':!![]}];}return db[_0xf684('0x3f')][_0xf684('0x41')](_0x3a8a28);})['then'](function(_0x3c5611){_0x43a785['rows']=_0x3c5611;return _0x43a785;})[_0xf684('0x26')](respondWithFilteredResult(_0x5ed612,_0x3a8a28))[_0xf684('0x42')](handleError(_0x5ed612,null));};exports[_0xf684('0x43')]=function(_0x5cfafa,_0x49ff34){var _0x780163={'raw':![],'where':{'id':_0x5cfafa[_0xf684('0x44')]['id']}},_0x3c8a70={};_0x3c8a70[_0xf684('0x32')]=_[_0xf684('0x45')](db[_0xf684('0x3f')][_0xf684('0x46')]);_0x3c8a70[_0xf684('0x30')]=_[_0xf684('0x45')](_0x5cfafa['query']);_0x3c8a70['filters']=_[_0xf684('0x31')](_0x3c8a70['model'],_0x3c8a70[_0xf684('0x30')]);_0x780163['attributes']=_['intersection'](_0x3c8a70[_0xf684('0x32')],qs[_0xf684('0x33')](_0x5cfafa[_0xf684('0x30')]['fields']));_0x780163[_0xf684('0x34')]=_0x780163[_0xf684('0x34')]['length']?_0x780163[_0xf684('0x34')]:_0x3c8a70[_0xf684('0x32')];if(_0x5cfafa[_0xf684('0x30')][_0xf684('0x40')]){_0x780163[_0xf684('0x47')]=[{'all':!![]}];}_0x780163=_['merge']({},_0x780163,_0x5cfafa['options']);return db[_0xf684('0x3f')][_0xf684('0x48')](_0x780163)['then'](handleEntityNotFound(_0x49ff34,null))['then'](respondWithResult(_0x49ff34,null))[_0xf684('0x42')](handleError(_0x49ff34,null));};exports[_0xf684('0x49')]=function(_0x44ba89,_0x421c26){return db['Dashboard'][_0xf684('0x49')](_0x44ba89[_0xf684('0x4a')],{})['then'](function(_0x1d643a){var _0x1422bc=_0x44ba89['user'][_0xf684('0x4b')]({'plain':!![]});if(!_0x1422bc)throw new Error(_0xf684('0x4c'));if(_0x1422bc[_0xf684('0x4d')]===_0xf684('0x4e')){var _0x43ebdf=_0x1d643a['get']({'plain':!![]});var _0x2e854e=_0xf684('0x27');return db[_0xf684('0x4f')]['find']({'where':{'name':_0x2e854e,'userProfileId':_0x1422bc[_0xf684('0x50')]},'raw':!![]})[_0xf684('0x26')](function(_0x454089){if(_0x454089&&_0x454089[_0xf684('0x51')]===0x0){return db[_0xf684('0x52')]['create']({'name':_0x43ebdf[_0xf684('0x2a')],'resourceId':_0x43ebdf['id'],'type':_0x454089[_0xf684('0x2a')],'sectionId':_0x454089['id']},{})[_0xf684('0x26')](function(){return _0x1d643a;});}else{return _0x1d643a;}})[_0xf684('0x42')](function(_0x18ccf2){logger[_0xf684('0x28')](_0xf684('0x53'),_0x18ccf2);throw _0x18ccf2;});}return _0x1d643a;})[_0xf684('0x26')](respondWithResult(_0x421c26,0xc9))['catch'](handleError(_0x421c26,null));};exports[_0xf684('0x54')]=function(_0x327767,_0x533d18){var _0x13e66c={'where':{'id':_0x327767['params']['id']}},_0xc1dd6e={};_0xc1dd6e[_0xf684('0x32')]=_['keys'](db[_0xf684('0x3f')]['rawAttributes']);_0x13e66c[_0xf684('0x34')]=_[_0xf684('0x31')](_0xc1dd6e[_0xf684('0x32')],qs['fields'](_0x327767[_0xf684('0x30')]['fields']));_0x13e66c[_0xf684('0x34')]=_0x13e66c[_0xf684('0x34')][_0xf684('0x55')]?_0x13e66c['attributes']:_0xc1dd6e['model'];if(_0x327767[_0xf684('0x30')][_0xf684('0x40')]){_0x13e66c['include']=[{'all':!![]}];}_0x13e66c=_[_0xf684('0x3b')]({},_0x13e66c,_0x327767['options']);return db[_0xf684('0x3f')][_0xf684('0x48')](_0x13e66c)[_0xf684('0x26')](handleEntityNotFound(_0x533d18,null))['then'](function(_0x1a4ce4){if(_0x1a4ce4){var _0x303265=_0x1a4ce4[_0xf684('0x4b')]({'plain':!![]});_0x303265=qs[_0xf684('0x56')](_0x303265,['id',_0xf684('0x57'),_0xf684('0x58')]);_0x327767['body']=_[_0xf684('0x56')](_0x327767[_0xf684('0x4a')],['id',_0xf684('0x57'),_0xf684('0x58')]);return db[_0xf684('0x3f')]['create'](_[_0xf684('0x3b')](_0x303265,_0x327767['body']),{'include':_0x327767[_0xf684('0x30')][_0xf684('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0xd3305b){var _0x33ec13=_0x327767[_0xf684('0x4e')][_0xf684('0x4b')]({'plain':!![]});if(!_0x33ec13)throw new Error(_0xf684('0x4c'));if(_0x33ec13[_0xf684('0x4d')]==='user'){var _0x39d3a3=_0xd3305b[_0xf684('0x4b')]({'plain':!![]});var _0x39cdd1=_0xf684('0x27');return db['UserProfileSection'][_0xf684('0x48')]({'where':{'name':_0x39cdd1,'userProfileId':_0x33ec13[_0xf684('0x50')]},'raw':!![]})[_0xf684('0x26')](function(_0x20af61){if(_0x20af61&&_0x20af61[_0xf684('0x51')]===0x0){return db[_0xf684('0x52')][_0xf684('0x49')]({'name':_0x39d3a3[_0xf684('0x2a')],'resourceId':_0x39d3a3['id'],'type':_0x20af61[_0xf684('0x2a')],'sectionId':_0x20af61['id']},{})['then'](function(){return _0xd3305b;});}else{return _0xd3305b;}})[_0xf684('0x42')](function(_0x5a84ff){logger[_0xf684('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a84ff);throw _0x5a84ff;});}return _0xd3305b;});}})[_0xf684('0x26')](respondWithResult(_0x533d18,0xc9))[_0xf684('0x42')](handleError(_0x533d18,null));};exports['update']=function(_0x1d8265,_0x117588){if(_0x1d8265[_0xf684('0x4a')]['id']){delete _0x1d8265[_0xf684('0x4a')]['id'];}return db[_0xf684('0x3f')]['find']({'where':{'id':_0x1d8265[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x117588,null))[_0xf684('0x26')](saveUpdates(_0x1d8265[_0xf684('0x4a')],null))[_0xf684('0x26')](respondWithResult(_0x117588,null))[_0xf684('0x42')](handleError(_0x117588,null));};exports[_0xf684('0x25')]=function(_0xa4671f,_0xfa4fbb){return db[_0xf684('0x3f')]['find']({'where':{'id':_0xa4671f[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0xfa4fbb,null))['then'](removeEntity(_0xfa4fbb,null))['catch'](handleError(_0xfa4fbb,null));};function widgetAttributes(_0x300a45){try{switch(_0x300a45['type']){case _0xf684('0x59'):return[{'name':_0xf684('0x5a'),'value':_0x300a45[_0xf684('0x5a')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45['attrs'][0x0][_0xf684('0x5c')]:undefined)||_0xf684('0x5d')}];case _0xf684('0x5e'):return[{'name':'attrPath','value':_0x300a45[_0xf684('0x5f')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||''}];case _0xf684('0x60'):return[{'name':'attrHourFormat','value':_0x300a45[_0xf684('0x61')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0][_0xf684('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0xf684('0x62'),'value':_0x300a45[_0xf684('0x62')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45[_0xf684('0x5b')][0x1]['value']:undefined)||_0xf684('0x63')},{'name':'attrFontSize','value':_0x300a45['attrFontSize']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45['attrs'][0x2][_0xf684('0x5c')]:undefined)||0xc}];case _0xf684('0x64'):return[{'name':'attrMetric','value':_0x300a45['attrMetric']||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||_0xf684('0x65')},{'name':_0xf684('0x66'),'value':_0x300a45['attrVoiceQueues']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45[_0xf684('0x5b')][0x1][_0xf684('0x5c')]:undefined)||[]},{'name':_0xf684('0x67'),'value':_0x300a45[_0xf684('0x67')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45[_0xf684('0x5b')][0x2][_0xf684('0x5c')]:undefined)||0x14}];case'multibar-chart':case _0xf684('0x68'):return[{'name':_0xf684('0x69'),'value':_0x300a45[_0xf684('0x69')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['value']:undefined)||_0xf684('0x65')},{'name':'attrSerie2','value':_0x300a45[_0xf684('0x6a')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45['attrs'][0x1][_0xf684('0x5c')]:undefined)||null},{'name':_0xf684('0x6b'),'value':_0x300a45['attrSerie3']||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x2]?_0x300a45[_0xf684('0x5b')][0x2]['value']:undefined)||null},{'name':_0xf684('0x66'),'value':_0x300a45[_0xf684('0x66')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x3]?_0x300a45['attrs'][0x3][_0xf684('0x5c')]:undefined)||[]}];case _0xf684('0x6c'):return[{'name':'attrReport','type':_0x300a45[_0xf684('0x6d')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45[_0xf684('0x5b')][0x0]?_0x300a45[_0xf684('0x5b')][0x0]['type']:undefined)||null,'value':_0x300a45[_0xf684('0x6e')]||(_0x300a45[_0xf684('0x5b')]&&_0x300a45['attrs'][0x0]?_0x300a45[_0xf684('0x5b')][0x0][_0xf684('0x5c')]:undefined)||null},{'name':_0xf684('0x6f'),'value':_0x300a45[_0xf684('0x6f')]||(_0x300a45['attrs']&&_0x300a45[_0xf684('0x5b')][0x1]?_0x300a45['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1f10ea){logger[_0xf684('0x28')](_0xf684('0x70'),JSON[_0xf684('0x71')](_0x1f10ea));return[];}}exports[_0xf684('0x72')]=function(_0x28f54c,_0x42e495,_0x425278){if(_0x28f54c['body']['id']){delete _0x28f54c[_0xf684('0x4a')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x28f54c['params']['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x42e495,null))['then'](function(_0x1d5cf8){if(_0x1d5cf8){_0x28f54c[_0xf684('0x4a')][_0xf684('0x73')]=_0x1d5cf8['id'];_0x28f54c[_0xf684('0x4a')][_0xf684('0x5b')]=widgetAttributes(_0x28f54c['body']);return db[_0xf684('0x74')][_0xf684('0x49')](_0x28f54c['body']);}})[_0xf684('0x26')](respondWithResult(_0x42e495,null))[_0xf684('0x42')](handleError(_0x42e495,null));};exports['getItems']=function(_0x40818b,_0x4f7a37,_0x538bfa){var _0x2196c5={};var _0x3e24f4={};var _0x2114f4;var _0x1f31ce;return db['Dashboard']['findOne']({'where':{'id':_0x40818b[_0xf684('0x44')]['id']}})[_0xf684('0x26')](handleEntityNotFound(_0x4f7a37,null))[_0xf684('0x26')](function(_0x29f7ee){if(_0x29f7ee){_0x2114f4=_0x29f7ee;_0x3e24f4[_0xf684('0x32')]=_[_0xf684('0x45')](db[_0xf684('0x74')][_0xf684('0x46')]);_0x3e24f4[_0xf684('0x30')]=_[_0xf684('0x45')](_0x40818b['query']);_0x3e24f4[_0xf684('0x3a')]=_[_0xf684('0x31')](_0x3e24f4[_0xf684('0x32')],_0x3e24f4['query']);_0x2196c5['attributes']=_[_0xf684('0x31')](_0x3e24f4[_0xf684('0x32')],qs[_0xf684('0x33')](_0x40818b['query']['fields']));_0x2196c5[_0xf684('0x34')]=_0x2196c5[_0xf684('0x34')][_0xf684('0x55')]?_0x2196c5[_0xf684('0x34')]:_0x3e24f4[_0xf684('0x32')];_0x2196c5[_0xf684('0x36')]=qs[_0xf684('0x37')](_0x40818b[_0xf684('0x30')]['sort']);_0x2196c5['where']=qs[_0xf684('0x3a')](_[_0xf684('0x39')](_0x40818b['query'],_0x3e24f4[_0xf684('0x3a')]));if(_0x40818b[_0xf684('0x30')][_0xf684('0x3d')]){_0x2196c5[_0xf684('0x38')]=_[_0xf684('0x3b')](_0x2196c5[_0xf684('0x38')],{'$or':_[_0xf684('0x2c')](_0x2196c5[_0xf684('0x34')],function(_0x1088ef){var _0x4aad5c={};_0x4aad5c[_0x1088ef]={'$like':'%'+_0x40818b['query'][_0xf684('0x3d')]+'%'};return _0x4aad5c;})});}_0x2196c5=_['merge']({},_0x2196c5,_0x40818b[_0xf684('0x3e')]);return _0x2114f4[_0xf684('0x75')](_0x2196c5);}})[_0xf684('0x26')](function(_0x47db72){if(_0x47db72){_0x1f31ce=_0x47db72[_0xf684('0x55')];if(!_0x40818b['query'][_0xf684('0x76')](_0xf684('0x35'))){_0x2196c5[_0xf684('0x20')]=qs[_0xf684('0x20')](_0x40818b[_0xf684('0x30')]['limit']);_0x2196c5['offset']=qs['offset'](_0x40818b['query'][_0xf684('0x1f')]);}return _0x2114f4[_0xf684('0x75')](_0x2196c5);}})[_0xf684('0x26')](function(_0xfb398c){if(_0xfb398c){return _0xfb398c?{'count':_0x1f31ce,'rows':_0xfb398c}:null;}})[_0xf684('0x26')](respondWithResult(_0x4f7a37,null))['catch'](handleError(_0x4f7a37,null));}; \ No newline at end of file +var _0xff99=['to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','rawAttributes','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dashboard','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','findOne','getItems','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox'];(function(_0x54b41e,_0x52bae1){var _0x3ac113=function(_0x45177a){while(--_0x45177a){_0x54b41e['push'](_0x54b41e['shift']());}};_0x3ac113(++_0x52bae1);}(_0xff99,0x1e2));var _0x9ff9=function(_0x1616fc,_0x2faf46){_0x1616fc=_0x1616fc-0x0;var _0x2b1fc4=_0xff99[_0x1616fc];return _0x2b1fc4;};'use strict';var pdf=require(_0x9ff9('0x0'));var emlformat=require(_0x9ff9('0x1'));var rimraf=require(_0x9ff9('0x2'));var zipdir=require(_0x9ff9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ff9('0x4'));var moment=require(_0x9ff9('0x5'));var BPromise=require(_0x9ff9('0x6'));var Mustache=require('mustache');var util=require(_0x9ff9('0x7'));var path=require(_0x9ff9('0x8'));var sox=require(_0x9ff9('0x9'));var csv=require(_0x9ff9('0xa'));var ejs=require(_0x9ff9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ff9('0xc'));var crypto=require('crypto');var jsforce=require(_0x9ff9('0xd'));var deskjs=require(_0x9ff9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9ff9('0xf'));var authService=require(_0x9ff9('0x10'));var qs=require(_0x9ff9('0x11'));var as=require(_0x9ff9('0x12'));var hardwareService=require(_0x9ff9('0x13'));var logger=require(_0x9ff9('0x14'))(_0x9ff9('0x15'));var utils=require(_0x9ff9('0x16'));var config=require(_0x9ff9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff9('0x18'))['db'];config[_0x9ff9('0x19')]=_[_0x9ff9('0x1a')](config['redis'],{'host':_0x9ff9('0x1b'),'port':0x18eb});var socket=require(_0x9ff9('0x1c'))(new Redis(config[_0x9ff9('0x19')]));require(_0x9ff9('0x1d'))[_0x9ff9('0x1e')](socket);function respondWithStatusCode(_0x239699,_0x80b0bd){_0x80b0bd=_0x80b0bd||0xcc;return function(_0xbcd34a){if(_0xbcd34a){return _0x239699[_0x9ff9('0x1f')](_0x80b0bd);}return _0x239699[_0x9ff9('0x20')](_0x80b0bd)[_0x9ff9('0x21')]();};}function respondWithResult(_0x39aaa2,_0x3eaefd){_0x3eaefd=_0x3eaefd||0xc8;return function(_0x1ad66e){if(_0x1ad66e){return _0x39aaa2[_0x9ff9('0x20')](_0x3eaefd)['json'](_0x1ad66e);}};}function respondWithFilteredResult(_0x444c7e,_0xbcf779){return function(_0x2c7cde){if(_0x2c7cde){var _0x4ce66f=_0x2c7cde[_0x9ff9('0x22')],_0x36bde1=_0xbcf779[_0x9ff9('0x23')],_0x4f4672=_0xbcf779[_0x9ff9('0x23')]+_0xbcf779[_0x9ff9('0x24')],_0x50d171;if(_0x4f4672>=_0x4ce66f){_0x4f4672=_0x4ce66f;_0x50d171=0xc8;}else{_0x50d171=0xce;}_0x444c7e[_0x9ff9('0x20')](_0x50d171);return _0x444c7e[_0x9ff9('0x25')](_0x9ff9('0x26'),_0x36bde1+'-'+_0x4f4672+'/'+_0x4ce66f)['json'](_0x2c7cde);}return null;};}function patchUpdates(_0x386dc3){return function(_0x431145){try{jsonpatch['apply'](_0x431145,_0x386dc3,!![]);}catch(_0x97945){return BPromise[_0x9ff9('0x27')](_0x97945);}return _0x431145[_0x9ff9('0x28')]();};}function saveUpdates(_0x52e856,_0x2a6872){return function(_0x5f369b){if(_0x5f369b){return _0x5f369b[_0x9ff9('0x29')](_0x52e856)[_0x9ff9('0x2a')](function(_0x428fac){return _0x428fac;});}return null;};}function removeEntity(_0x24377e,_0x536d2a){return function(_0xf41d7a){if(_0xf41d7a){return _0xf41d7a[_0x9ff9('0x2b')]()[_0x9ff9('0x2a')](function(){var _0x1f353c=_0xf41d7a[_0x9ff9('0x2c')]({'plain':!![]});var _0x1d9f72=_0x9ff9('0x2d');return db[_0x9ff9('0x2e')]['destroy']({'where':{'type':_0x1d9f72,'resourceId':_0x1f353c['id']}})['then'](function(){return _0xf41d7a;});})[_0x9ff9('0x2a')](function(){_0x24377e[_0x9ff9('0x20')](0xcc)[_0x9ff9('0x21')]();});}};}function handleEntityNotFound(_0x3157d6,_0x37466e){return function(_0x426a5c){if(!_0x426a5c){_0x3157d6['sendStatus'](0x194);}return _0x426a5c;};}function handleError(_0x56a347,_0x191190){_0x191190=_0x191190||0x1f4;return function(_0x449525){logger[_0x9ff9('0x2f')](_0x449525[_0x9ff9('0x30')]);if(_0x449525[_0x9ff9('0x31')]){delete _0x449525[_0x9ff9('0x31')];}_0x56a347['status'](_0x191190)[_0x9ff9('0x32')](_0x449525);};}exports[_0x9ff9('0x33')]=function(_0x3d8744,_0x18a201){var _0x2e10fd={},_0x320f3d={},_0x59feb5={'count':0x0,'rows':[]};var _0x2d849d=_[_0x9ff9('0x34')](db['Dashboard'][_0x9ff9('0x35')],function(_0x296b28){return{'name':_0x296b28['fieldName'],'type':_0x296b28['type']['key']};});_0x320f3d['model']=_['map'](_0x2d849d,_0x9ff9('0x31'));_0x320f3d[_0x9ff9('0x36')]=_['keys'](_0x3d8744['query']);_0x320f3d['filters']=_[_0x9ff9('0x37')](_0x320f3d[_0x9ff9('0x38')],_0x320f3d['query']);_0x2e10fd[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x320f3d[_0x9ff9('0x38')],qs[_0x9ff9('0x3a')](_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x3a')]));_0x2e10fd[_0x9ff9('0x39')]=_0x2e10fd[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x2e10fd[_0x9ff9('0x39')]:_0x320f3d[_0x9ff9('0x38')];if(!_0x3d8744['query'][_0x9ff9('0x3c')](_0x9ff9('0x3d'))){_0x2e10fd['limit']=qs[_0x9ff9('0x24')](_0x3d8744['query'][_0x9ff9('0x24')]);_0x2e10fd[_0x9ff9('0x23')]=qs[_0x9ff9('0x23')](_0x3d8744['query'][_0x9ff9('0x23')]);}_0x2e10fd[_0x9ff9('0x3e')]=qs[_0x9ff9('0x3f')](_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x3f')]);_0x2e10fd[_0x9ff9('0x40')]=qs[_0x9ff9('0x41')](_[_0x9ff9('0x42')](_0x3d8744['query'],_0x320f3d['filters']),_0x2d849d);if(_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x43')]){_0x2e10fd['where']=_[_0x9ff9('0x44')](_0x2e10fd[_0x9ff9('0x40')],{'$or':_['map'](_0x2d849d,function(_0x2841de){if(_0x2841de['type']!==_0x9ff9('0x45')){var _0xb8fc00={};_0xb8fc00[_0x2841de[_0x9ff9('0x31')]]={'$like':'%'+_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x43')]+'%'};return _0xb8fc00;}})});}_0x2e10fd=_[_0x9ff9('0x44')]({},_0x2e10fd,_0x3d8744['options']);var _0x37c521={'where':_0x2e10fd[_0x9ff9('0x40')]};return db[_0x9ff9('0x46')][_0x9ff9('0x22')](_0x37c521)[_0x9ff9('0x2a')](function(_0x384d9f){_0x59feb5[_0x9ff9('0x22')]=_0x384d9f;if(_0x3d8744['query'][_0x9ff9('0x47')]){_0x2e10fd[_0x9ff9('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x9ff9('0x49')](_0x2e10fd);})['then'](function(_0x463e14){_0x59feb5[_0x9ff9('0x4a')]=_0x463e14;return _0x59feb5;})['then'](respondWithFilteredResult(_0x18a201,_0x2e10fd))[_0x9ff9('0x4b')](handleError(_0x18a201,null));};exports['show']=function(_0x5c9601,_0x3b80e5){var _0x192fd2={'raw':![],'where':{'id':_0x5c9601[_0x9ff9('0x4c')]['id']}},_0x22b46a={};_0x22b46a[_0x9ff9('0x38')]=_[_0x9ff9('0x4d')](db[_0x9ff9('0x46')][_0x9ff9('0x35')]);_0x22b46a[_0x9ff9('0x36')]=_[_0x9ff9('0x4d')](_0x5c9601[_0x9ff9('0x36')]);_0x22b46a[_0x9ff9('0x41')]=_[_0x9ff9('0x37')](_0x22b46a[_0x9ff9('0x38')],_0x22b46a[_0x9ff9('0x36')]);_0x192fd2[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x22b46a['model'],qs[_0x9ff9('0x3a')](_0x5c9601['query']['fields']));_0x192fd2[_0x9ff9('0x39')]=_0x192fd2[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x192fd2['attributes']:_0x22b46a[_0x9ff9('0x38')];if(_0x5c9601[_0x9ff9('0x36')][_0x9ff9('0x47')]){_0x192fd2[_0x9ff9('0x48')]=[{'all':!![]}];}_0x192fd2=_['merge']({},_0x192fd2,_0x5c9601[_0x9ff9('0x4e')]);return db[_0x9ff9('0x46')][_0x9ff9('0x4f')](_0x192fd2)[_0x9ff9('0x2a')](handleEntityNotFound(_0x3b80e5,null))[_0x9ff9('0x2a')](respondWithResult(_0x3b80e5,null))['catch'](handleError(_0x3b80e5,null));};exports['create']=function(_0x3eeade,_0x5d0ad4){return db[_0x9ff9('0x46')][_0x9ff9('0x50')](_0x3eeade[_0x9ff9('0x51')],{})[_0x9ff9('0x2a')](function(_0x4e362b){var _0x5624b6=_0x3eeade['user'][_0x9ff9('0x2c')]({'plain':!![]});if(!_0x5624b6)throw new Error(_0x9ff9('0x52'));if(_0x5624b6[_0x9ff9('0x53')]===_0x9ff9('0x54')){var _0x2fa328=_0x4e362b[_0x9ff9('0x2c')]({'plain':!![]});var _0x1502ee=_0x9ff9('0x2d');return db[_0x9ff9('0x55')][_0x9ff9('0x4f')]({'where':{'name':_0x1502ee,'userProfileId':_0x5624b6[_0x9ff9('0x56')]},'raw':!![]})[_0x9ff9('0x2a')](function(_0x2bbaaf){if(_0x2bbaaf&&_0x2bbaaf['autoAssociation']===0x0){return db['UserProfileResource'][_0x9ff9('0x50')]({'name':_0x2fa328[_0x9ff9('0x31')],'resourceId':_0x2fa328['id'],'type':_0x2bbaaf[_0x9ff9('0x31')],'sectionId':_0x2bbaaf['id']},{})[_0x9ff9('0x2a')](function(){return _0x4e362b;});}else{return _0x4e362b;}})[_0x9ff9('0x4b')](function(_0x1b8cb0){logger['error'](_0x9ff9('0x57'),_0x1b8cb0);throw _0x1b8cb0;});}return _0x4e362b;})[_0x9ff9('0x2a')](respondWithResult(_0x5d0ad4,0xc9))[_0x9ff9('0x4b')](handleError(_0x5d0ad4,null));};exports[_0x9ff9('0x58')]=function(_0x527d0c,_0x2da287){var _0x828e14={'where':{'id':_0x527d0c[_0x9ff9('0x4c')]['id']}},_0x519445={};_0x519445['model']=_['keys'](db['Dashboard'][_0x9ff9('0x35')]);_0x828e14[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x519445['model'],qs[_0x9ff9('0x3a')](_0x527d0c['query'][_0x9ff9('0x3a')]));_0x828e14[_0x9ff9('0x39')]=_0x828e14['attributes'][_0x9ff9('0x3b')]?_0x828e14[_0x9ff9('0x39')]:_0x519445['model'];if(_0x527d0c[_0x9ff9('0x36')]['includeAll']){_0x828e14[_0x9ff9('0x48')]=[{'all':!![]}];}_0x828e14=_[_0x9ff9('0x44')]({},_0x828e14,_0x527d0c['options']);return db['Dashboard']['find'](_0x828e14)[_0x9ff9('0x2a')](handleEntityNotFound(_0x2da287,null))['then'](function(_0x477316){if(_0x477316){var _0x8fb40=_0x477316[_0x9ff9('0x2c')]({'plain':!![]});_0x8fb40=qs[_0x9ff9('0x59')](_0x8fb40,['id',_0x9ff9('0x5a'),_0x9ff9('0x5b')]);_0x527d0c['body']=_[_0x9ff9('0x59')](_0x527d0c[_0x9ff9('0x51')],['id',_0x9ff9('0x5a'),'updatedAt']);return db[_0x9ff9('0x46')][_0x9ff9('0x50')](_['merge'](_0x8fb40,_0x527d0c['body']),{'include':_0x527d0c[_0x9ff9('0x36')][_0x9ff9('0x47')]?[{'all':!![]}]:undefined})[_0x9ff9('0x2a')](function(_0xb42b1d){var _0x35572e=_0x527d0c[_0x9ff9('0x54')][_0x9ff9('0x2c')]({'plain':!![]});if(!_0x35572e)throw new Error(_0x9ff9('0x52'));if(_0x35572e[_0x9ff9('0x53')]===_0x9ff9('0x54')){var _0x5e9c70=_0xb42b1d['get']({'plain':!![]});var _0x4a88b9='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x4a88b9,'userProfileId':_0x35572e[_0x9ff9('0x56')]},'raw':!![]})['then'](function(_0x44b8fa){if(_0x44b8fa&&_0x44b8fa[_0x9ff9('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e9c70[_0x9ff9('0x31')],'resourceId':_0x5e9c70['id'],'type':_0x44b8fa[_0x9ff9('0x31')],'sectionId':_0x44b8fa['id']},{})[_0x9ff9('0x2a')](function(){return _0xb42b1d;});}else{return _0xb42b1d;}})[_0x9ff9('0x4b')](function(_0x47a842){logger['error'](_0x9ff9('0x57'),_0x47a842);throw _0x47a842;});}return _0xb42b1d;});}})[_0x9ff9('0x2a')](respondWithResult(_0x2da287,0xc9))[_0x9ff9('0x4b')](handleError(_0x2da287,null));};exports[_0x9ff9('0x29')]=function(_0x4d5a9c,_0x56bb6d){if(_0x4d5a9c[_0x9ff9('0x51')]['id']){delete _0x4d5a9c[_0x9ff9('0x51')]['id'];}return db[_0x9ff9('0x46')]['find']({'where':{'id':_0x4d5a9c['params']['id']}})[_0x9ff9('0x2a')](handleEntityNotFound(_0x56bb6d,null))['then'](saveUpdates(_0x4d5a9c[_0x9ff9('0x51')],null))['then'](respondWithResult(_0x56bb6d,null))['catch'](handleError(_0x56bb6d,null));};exports['destroy']=function(_0x153dae,_0x1117ef){return db[_0x9ff9('0x46')][_0x9ff9('0x4f')]({'where':{'id':_0x153dae['params']['id']}})['then'](handleEntityNotFound(_0x1117ef,null))[_0x9ff9('0x2a')](removeEntity(_0x1117ef,null))[_0x9ff9('0x4b')](handleError(_0x1117ef,null));};function widgetAttributes(_0x269d38){try{switch(_0x269d38[_0x9ff9('0x5d')]){case _0x9ff9('0x5e'):return[{'name':_0x9ff9('0x5f'),'value':_0x269d38[_0x9ff9('0x5f')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x62')}];case _0x9ff9('0x63'):return[{'name':_0x9ff9('0x64'),'value':_0x269d38[_0x9ff9('0x64')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38['attrs'][0x0][_0x9ff9('0x61')]:undefined)||''}];case _0x9ff9('0x65'):return[{'name':'attrHourFormat','value':_0x269d38['attrHourFormat']||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x66')},{'name':'attrTimezone','value':_0x269d38[_0x9ff9('0x67')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x1]?_0x269d38[_0x9ff9('0x60')][0x1]['value']:undefined)||'0.00'},{'name':_0x9ff9('0x68'),'value':_0x269d38[_0x9ff9('0x68')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x2]?_0x269d38[_0x9ff9('0x60')][0x2][_0x9ff9('0x61')]:undefined)||0xc}];case _0x9ff9('0x69'):return[{'name':_0x9ff9('0x6a'),'value':_0x269d38[_0x9ff9('0x6a')]||(_0x269d38['attrs']&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x269d38[_0x9ff9('0x6b')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||[]},{'name':_0x9ff9('0x68'),'value':_0x269d38[_0x9ff9('0x68')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x2]?_0x269d38['attrs'][0x2][_0x9ff9('0x61')]:undefined)||0x14}];case _0x9ff9('0x6c'):case _0x9ff9('0x6d'):return[{'name':_0x9ff9('0x6e'),'value':_0x269d38[_0x9ff9('0x6e')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x6f')},{'name':_0x9ff9('0x70'),'value':_0x269d38['attrSerie2']||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||null},{'name':_0x9ff9('0x71'),'value':_0x269d38[_0x9ff9('0x71')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x2]?_0x269d38[_0x9ff9('0x60')][0x2]['value']:undefined)||null},{'name':_0x9ff9('0x6b'),'value':_0x269d38[_0x9ff9('0x6b')]||(_0x269d38['attrs']&&_0x269d38[_0x9ff9('0x60')][0x3]?_0x269d38[_0x9ff9('0x60')][0x3][_0x9ff9('0x61')]:undefined)||[]}];case _0x9ff9('0x72'):return[{'name':'attrReport','type':_0x269d38[_0x9ff9('0x73')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x0]?_0x269d38['attrs'][0x0]['type']:undefined)||null,'value':_0x269d38[_0x9ff9('0x74')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||null},{'name':_0x9ff9('0x75'),'value':_0x269d38[_0x9ff9('0x75')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4a4b1c){logger['error'](_0x9ff9('0x76'),JSON['stringify'](_0x4a4b1c));return[];}}exports[_0x9ff9('0x77')]=function(_0x36a191,_0x338bb6,_0x57b669){if(_0x36a191[_0x9ff9('0x51')]['id']){delete _0x36a191[_0x9ff9('0x51')]['id'];}return db['Dashboard'][_0x9ff9('0x4f')]({'where':{'id':_0x36a191[_0x9ff9('0x4c')]['id']}})[_0x9ff9('0x2a')](handleEntityNotFound(_0x338bb6,null))[_0x9ff9('0x2a')](function(_0x1815c0){if(_0x1815c0){_0x36a191[_0x9ff9('0x51')]['DashboardId']=_0x1815c0['id'];_0x36a191['body'][_0x9ff9('0x60')]=widgetAttributes(_0x36a191[_0x9ff9('0x51')]);return db[_0x9ff9('0x78')][_0x9ff9('0x50')](_0x36a191['body']);}})[_0x9ff9('0x2a')](respondWithResult(_0x338bb6,null))[_0x9ff9('0x4b')](handleError(_0x338bb6,null));};exports['getItems']=function(_0x4ef934,_0xce2431,_0x20f4d2){var _0x55bc1f={};var _0x85a6d2={};var _0xd69893;var _0x24fba3;return db['Dashboard'][_0x9ff9('0x79')]({'where':{'id':_0x4ef934[_0x9ff9('0x4c')]['id']}})['then'](handleEntityNotFound(_0xce2431,null))[_0x9ff9('0x2a')](function(_0x1464c9){if(_0x1464c9){_0xd69893=_0x1464c9;_0x85a6d2['model']=_[_0x9ff9('0x4d')](db[_0x9ff9('0x78')]['rawAttributes']);_0x85a6d2['query']=_[_0x9ff9('0x4d')](_0x4ef934[_0x9ff9('0x36')]);_0x85a6d2[_0x9ff9('0x41')]=_[_0x9ff9('0x37')](_0x85a6d2[_0x9ff9('0x38')],_0x85a6d2[_0x9ff9('0x36')]);_0x55bc1f['attributes']=_[_0x9ff9('0x37')](_0x85a6d2[_0x9ff9('0x38')],qs[_0x9ff9('0x3a')](_0x4ef934['query'][_0x9ff9('0x3a')]));_0x55bc1f['attributes']=_0x55bc1f[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x55bc1f[_0x9ff9('0x39')]:_0x85a6d2[_0x9ff9('0x38')];_0x55bc1f[_0x9ff9('0x3e')]=qs[_0x9ff9('0x3f')](_0x4ef934[_0x9ff9('0x36')][_0x9ff9('0x3f')]);_0x55bc1f[_0x9ff9('0x40')]=qs[_0x9ff9('0x41')](_[_0x9ff9('0x42')](_0x4ef934[_0x9ff9('0x36')],_0x85a6d2[_0x9ff9('0x41')]));if(_0x4ef934['query']['filter']){_0x55bc1f['where']=_[_0x9ff9('0x44')](_0x55bc1f[_0x9ff9('0x40')],{'$or':_[_0x9ff9('0x34')](_0x55bc1f[_0x9ff9('0x39')],function(_0x5d3c83){var _0x412d2f={};_0x412d2f[_0x5d3c83]={'$like':'%'+_0x4ef934['query']['filter']+'%'};return _0x412d2f;})});}_0x55bc1f=_[_0x9ff9('0x44')]({},_0x55bc1f,_0x4ef934['options']);return _0xd69893['getItems'](_0x55bc1f);}})['then'](function(_0x122b5b){if(_0x122b5b){_0x24fba3=_0x122b5b[_0x9ff9('0x3b')];if(!_0x4ef934[_0x9ff9('0x36')]['hasOwnProperty'](_0x9ff9('0x3d'))){_0x55bc1f[_0x9ff9('0x24')]=qs[_0x9ff9('0x24')](_0x4ef934[_0x9ff9('0x36')]['limit']);_0x55bc1f[_0x9ff9('0x23')]=qs[_0x9ff9('0x23')](_0x4ef934[_0x9ff9('0x36')][_0x9ff9('0x23')]);}return _0xd69893[_0x9ff9('0x7a')](_0x55bc1f);}})[_0x9ff9('0x2a')](function(_0xb93dfa){if(_0xb93dfa){return _0xb93dfa?{'count':_0x24fba3,'rows':_0xb93dfa}:null;}})[_0x9ff9('0x2a')](respondWithResult(_0xce2431,null))['catch'](handleError(_0xce2431,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 2ae1496..6e111ff 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 _0x6ccb=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x1a5d7c,_0x4dadb8){var _0x565525=function(_0x186608){while(--_0x186608){_0x1a5d7c['push'](_0x1a5d7c['shift']());}};_0x565525(++_0x4dadb8);}(_0x6ccb,0xad));var _0xb6cc=function(_0x24af60,_0x438265){_0x24af60=_0x24af60-0x0;var _0x24ccff=_0x6ccb[_0x24af60];return _0x24ccff;};'use strict';var EventEmitter=require(_0xb6cc('0x0'));var Dashboard=require(_0xb6cc('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6cc('0x2'),'afterUpdate':_0xb6cc('0x3'),'afterDestroy':_0xb6cc('0x4')};function emitEvent(_0x15fc61){return function(_0x48665f,_0x468091,_0x28e5e4){DashboardEvents[_0xb6cc('0x5')](_0x15fc61+':'+_0x48665f['id'],_0x48665f);DashboardEvents['emit'](_0x15fc61,_0x48665f);_0x28e5e4(null);};}for(var e in events){if(events[_0xb6cc('0x6')](e)){var event=events[e];Dashboard[_0xb6cc('0x7')](e,emitEvent(event));}}module[_0xb6cc('0x8')]=DashboardEvents; \ No newline at end of file +var _0x5a87=['Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x5a87,0x148));var _0x75a8=function(_0x51f2bf,_0x560324){_0x51f2bf=_0x51f2bf-0x0;var _0x1af141=_0x5a87[_0x51f2bf];return _0x1af141;};'use strict';var EventEmitter=require(_0x75a8('0x0'));var Dashboard=require(_0x75a8('0x1'))['db'][_0x75a8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x75a8('0x3')](0x0);var events={'afterCreate':_0x75a8('0x4'),'afterUpdate':_0x75a8('0x5'),'afterDestroy':_0x75a8('0x6')};function emitEvent(_0x384979){return function(_0x2b37ac,_0x2112e9,_0x2d5e2b){DashboardEvents[_0x75a8('0x7')](_0x384979+':'+_0x2b37ac['id'],_0x2b37ac);DashboardEvents[_0x75a8('0x7')](_0x384979,_0x2b37ac);_0x2d5e2b(null);};}for(var e in events){if(events[_0x75a8('0x8')](e)){var event=events[e];Dashboard[_0x75a8('0x9')](e,emitEvent(event));}}module[_0x75a8('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index afebbc1..8a5ada1 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 _0xf136=['bluebird','request-promise','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x515e9f,_0xff9586){var _0x19cbf0=function(_0xa2ae5c){while(--_0xa2ae5c){_0x515e9f['push'](_0x515e9f['shift']());}};_0x19cbf0(++_0xff9586);}(_0xf136,0x1d0));var _0x6f13=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf136[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0x6f13('0x0'));var util=require(_0x6f13('0x1'));var logger=require(_0x6f13('0x2'))(_0x6f13('0x3'));var moment=require('moment');var BPromise=require(_0x6f13('0x4'));var rp=require(_0x6f13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f13('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f13('0x7'));module[_0x6f13('0x8')]=function(_0x3c19b3,_0x49ff51){return _0x3c19b3[_0x6f13('0x9')](_0x6f13('0xa'),attributes,{'tableName':_0x6f13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6fe=['bluebird','request-promise','path','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x4cbe85,_0xc8880d){var _0x129048=function(_0xb5994c){while(--_0xb5994c){_0x4cbe85['push'](_0x4cbe85['shift']());}};_0x129048(++_0xc8880d);}(_0xe6fe,0xdf));var _0xee6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee6f('0x0'));var util=require(_0xee6f('0x1'));var logger=require(_0xee6f('0x2'))(_0xee6f('0x3'));var moment=require(_0xee6f('0x4'));var BPromise=require(_0xee6f('0x5'));var rp=require(_0xee6f('0x6'));var fs=require('fs');var path=require(_0xee6f('0x7'));var rimraf=require('rimraf');var config=require(_0xee6f('0x8'));var attributes=require(_0xee6f('0x9'));module['exports']=function(_0x2601ed,_0x3d8739){return _0x2601ed['define'](_0xee6f('0xa'),attributes,{'tableName':_0xee6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 0fcf0a2..c8eeee7 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 _0xdc6c=['Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x3e4cbc,_0xa57b87){var _0x5e7ad6=function(_0x44e4a2){while(--_0x44e4a2){_0x3e4cbc['push'](_0x3e4cbc['shift']());}};_0x5e7ad6(++_0xa57b87);}(_0xdc6c,0x157));var _0xcdc6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdc6c[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xcdc6('0x0'));var moment=require(_0xcdc6('0x1'));var BPromise=require(_0xcdc6('0x2'));var rs=require(_0xcdc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdc6('0x5'))(_0xcdc6('0x6'));var config=require(_0xcdc6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcdc6('0x8')]({'port':0x232a});config[_0xcdc6('0x9')]=_[_0xcdc6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdc6('0xb'))(new Redis(config['redis']));require('./dashboard.socket')[_0xcdc6('0xc')](socket);function respondWithRpcPromise(_0x3cf515,_0x9a4140,_0x5b59f6){return new BPromise(function(_0x8e4f7e,_0x29ffd4){return client[_0xcdc6('0xd')](_0x3cf515,_0x5b59f6)[_0xcdc6('0xe')](function(_0x58da10){logger[_0xcdc6('0xf')](_0xcdc6('0x10'),_0x9a4140,'request\x20sent');logger['debug'](_0xcdc6('0x11'),_0x9a4140,_0xcdc6('0x12'),JSON['stringify'](_0x58da10));if(_0x58da10['error']){if(_0x58da10[_0xcdc6('0x13')][_0xcdc6('0x14')]===0x1f4){logger[_0xcdc6('0x13')](_0xcdc6('0x10'),_0x9a4140,_0x58da10[_0xcdc6('0x13')]['message']);return _0x29ffd4(_0x58da10[_0xcdc6('0x13')]['message']);}logger[_0xcdc6('0x13')](_0xcdc6('0x10'),_0x9a4140,_0x58da10[_0xcdc6('0x13')]['message']);return _0x8e4f7e(_0x58da10[_0xcdc6('0x13')][_0xcdc6('0x15')]);}else{logger['info'](_0xcdc6('0x10'),_0x9a4140,_0xcdc6('0x12'));_0x8e4f7e(_0x58da10[_0xcdc6('0x16')][_0xcdc6('0x15')]);}})[_0xcdc6('0x17')](function(_0x32e607){logger['error']('Dashboard,\x20%s,\x20%s',_0x9a4140,_0x32e607);_0x29ffd4(_0x32e607);});});} \ No newline at end of file +var _0x6334=['client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4c8fd8,_0x21956a){var _0x9103f=function(_0x34473e){while(--_0x34473e){_0x4c8fd8['push'](_0x4c8fd8['shift']());}};_0x9103f(++_0x21956a);}(_0x6334,0x7f));var _0x4633=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0x6334[_0x23c3f4];return _0x82f0f1;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4633('0x3'));var db=require(_0x4633('0x4'))['db'];var utils=require(_0x4633('0x5'));var logger=require(_0x4633('0x6'))('rpc');var config=require(_0x4633('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4633('0x8')][_0x4633('0x9')]({'port':0x232a});config[_0x4633('0xa')]=_[_0x4633('0xb')](config[_0x4633('0xa')],{'host':_0x4633('0xc'),'port':0x18eb});var socket=require(_0x4633('0xd'))(new Redis(config[_0x4633('0xa')]));require(_0x4633('0xe'))[_0x4633('0xf')](socket);function respondWithRpcPromise(_0x1a21f1,_0x248173,_0xa153d9){return new BPromise(function(_0x142125,_0x189b54){return client[_0x4633('0x10')](_0x1a21f1,_0xa153d9)[_0x4633('0x11')](function(_0x4b65b9){logger[_0x4633('0x12')](_0x4633('0x13'),_0x248173,_0x4633('0x14'));logger[_0x4633('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x248173,'request\x20sent',JSON[_0x4633('0x16')](_0x4b65b9));if(_0x4b65b9[_0x4633('0x17')]){if(_0x4b65b9[_0x4633('0x17')][_0x4633('0x18')]===0x1f4){logger[_0x4633('0x17')](_0x4633('0x13'),_0x248173,_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);return _0x189b54(_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);}logger[_0x4633('0x17')]('Dashboard,\x20%s,\x20%s',_0x248173,_0x4b65b9[_0x4633('0x17')]['message']);return _0x142125(_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);}else{logger[_0x4633('0x12')](_0x4633('0x13'),_0x248173,_0x4633('0x14'));_0x142125(_0x4b65b9[_0x4633('0x1a')][_0x4633('0x19')]);}})['catch'](function(_0x2d74f0){logger[_0x4633('0x17')](_0x4633('0x13'),_0x248173,_0x2d74f0);_0x189b54(_0x2d74f0);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 97a6776..353190c 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 _0x64c4=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x290a92,_0x389e67){var _0xe81d11=function(_0x2739c6){while(--_0x2739c6){_0x290a92['push'](_0x290a92['shift']());}};_0xe81d11(++_0x389e67);}(_0x64c4,0x1ef));var _0x464c=function(_0x519ba,_0x50baa4){_0x519ba=_0x519ba-0x0;var _0x2687ff=_0x64c4[_0x519ba];return _0x2687ff;};'use strict';var DashboardEvents=require(_0x464c('0x0'));var events=[_0x464c('0x1'),_0x464c('0x2'),_0x464c('0x3')];function createListener(_0x448bd0,_0x1d4ac5){return function(_0x3c8e4d){_0x1d4ac5[_0x464c('0x4')](_0x448bd0,_0x3c8e4d);};}function removeListener(_0x2689dc,_0x2c5c3f){return function(){DashboardEvents[_0x464c('0x5')](_0x2689dc,_0x2c5c3f);};}exports[_0x464c('0x6')]=function(_0x464d19){for(var _0x318ddc=0x0,_0x8eaec6=events[_0x464c('0x7')];_0x318ddc<_0x8eaec6;_0x318ddc++){var _0x527eb4=events[_0x318ddc];var _0x1112dc=createListener(_0x464c('0x8')+_0x527eb4,_0x464d19);DashboardEvents['on'](_0x527eb4,_0x1112dc);}}; \ No newline at end of file +var _0xa521=['./dashboard.events','remove','update','removeListener','register','dashboard:'];(function(_0x99f5e7,_0x3e6f9d){var _0x183688=function(_0x55e9ef){while(--_0x55e9ef){_0x99f5e7['push'](_0x99f5e7['shift']());}};_0x183688(++_0x3e6f9d);}(_0xa521,0x12c));var _0x1a52=function(_0x5aa22d,_0x16b722){_0x5aa22d=_0x5aa22d-0x0;var _0x3ad1ac=_0xa521[_0x5aa22d];return _0x3ad1ac;};'use strict';var DashboardEvents=require(_0x1a52('0x0'));var events=['save',_0x1a52('0x1'),_0x1a52('0x2')];function createListener(_0x27404d,_0x4a5e90){return function(_0x154f0c){_0x4a5e90['emit'](_0x27404d,_0x154f0c);};}function removeListener(_0x528468,_0x49153f){return function(){DashboardEvents[_0x1a52('0x3')](_0x528468,_0x49153f);};}exports[_0x1a52('0x4')]=function(_0x4bdbd3){for(var _0x1075eb=0x0,_0x3ced6e=events['length'];_0x1075eb<_0x3ced6e;_0x1075eb++){var _0x180688=events[_0x1075eb];var _0x461a60=createListener(_0x1a52('0x5')+_0x180688,_0x4bdbd3);DashboardEvents['on'](_0x180688,_0x461a60);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index eb1a59d..b06fb8a 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x525bcf,_0x428c0c){var _0x4c3486=function(_0xf87f2){while(--_0xf87f2){_0x525bcf['push'](_0x525bcf['shift']());}};_0x4c3486(++_0x428c0c);}(_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/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','destroy','exports','path','connect-timeout'];(function(_0x4522f3,_0x522a52){var _0x25a7ad=function(_0x4925ad){while(--_0x4925ad){_0x4522f3['push'](_0x4522f3['shift']());}};_0x25a7ad(++_0x522a52);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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('./dashboard.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('0xe'),auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xd')]('/:id/items',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0e709c3..56320c2 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 _0xdf2a=['setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','getDataValue','attrs'];(function(_0x69eeaa,_0x495ec4){var _0xbf9605=function(_0x5464c8){while(--_0x5464c8){_0x69eeaa['push'](_0x69eeaa['shift']());}};_0xbf9605(++_0x495ec4);}(_0xdf2a,0x83));var _0xadf2=function(_0x1b2812,_0x4e1c67){_0x1b2812=_0x1b2812-0x0;var _0x5df4f0=_0xdf2a[_0x1b2812];return _0x5df4f0;};'use strict';var Sequelize=require(_0xadf2('0x0'));var squel=require(_0xadf2('0x1'));var _=require(_0xadf2('0x2'));module[_0xadf2('0x3')]={'title':{'type':Sequelize[_0xadf2('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xadf2('0x5')](_0xadf2('0x6')),'get':function(){try{return JSON['parse'](this[_0xadf2('0x7')](_0xadf2('0x8')));}catch(_0xd4fa1e){return[];}},'set':function(_0x58150b){try{this[_0xadf2('0x9')](_0xadf2('0x8'),JSON[_0xadf2('0xa')](_0x58150b));}catch(_0x4bbca3){this[_0xadf2('0x9')](_0xadf2('0x8'),JSON[_0xadf2('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0xadf2('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xadf2('0xb')]},'col':{'type':Sequelize[_0xadf2('0xb')]},'background':{'type':Sequelize[_0xadf2('0x4')],'allowNull':![],'defaultValue':_0xadf2('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xadf2('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d69=['#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT','long','setDataValue','attrs','stringify','INTEGER'];(function(_0x151205,_0xb040ff){var _0x5075aa=function(_0x12c97a){while(--_0x12c97a){_0x151205['push'](_0x151205['shift']());}};_0x5075aa(++_0xb040ff);}(_0x9d69,0x19a));var _0x99d6=function(_0x478163,_0x117ec5){_0x478163=_0x478163-0x0;var _0x56c43c=_0x9d69[_0x478163];return _0x56c43c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x99d6('0x0'));var _=require(_0x99d6('0x1'));module[_0x99d6('0x2')]={'title':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x99d6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x99d6('0x4')](_0x99d6('0x5')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x4eb8f9){return[];}},'set':function(_0x31e866){try{this[_0x99d6('0x6')](_0x99d6('0x7'),JSON[_0x99d6('0x8')](_0x31e866));}catch(_0xe36e6){this[_0x99d6('0x6')]('attrs',JSON[_0x99d6('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x99d6('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x99d6('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x99d6('0x9')]},'col':{'type':Sequelize[_0x99d6('0x9')]},'background':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![],'defaultValue':_0x99d6('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![],'defaultValue':_0x99d6('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 4d0f94f..2a9e665 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 _0x0e87=['then','destroy','end','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','length','merge','options','catch','find','type','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x31ecaf,_0x5a75fb){var _0x7a1567=function(_0x429ffe){while(--_0x429ffe){_0x31ecaf['push'](_0x31ecaf['shift']());}};_0x7a1567(++_0x5a75fb);}(_0x0e87,0x8d));var _0x70e8=function(_0x3c6708,_0x115bc4){_0x3c6708=_0x3c6708-0x0;var _0xd7c998=_0x0e87[_0x3c6708];return _0xd7c998;};'use strict';var pdf=require(_0x70e8('0x0'));var emlformat=require(_0x70e8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70e8('0x2'));var jsonpatch=require(_0x70e8('0x3'));var rp=require('request-promise');var moment=require(_0x70e8('0x4'));var BPromise=require(_0x70e8('0x5'));var Mustache=require(_0x70e8('0x6'));var util=require(_0x70e8('0x7'));var path=require(_0x70e8('0x8'));var sox=require(_0x70e8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x70e8('0xa'));var squel=require(_0x70e8('0xb'));var crypto=require('crypto');var jsforce=require(_0x70e8('0xc'));var deskjs=require(_0x70e8('0xd'));var toCsv=require(_0x70e8('0xe'));var querystring=require(_0x70e8('0xf'));var Papa=require(_0x70e8('0x10'));var Redis=require(_0x70e8('0x11'));var authService=require(_0x70e8('0x12'));var qs=require(_0x70e8('0x13'));var as=require(_0x70e8('0x14'));var hardwareService=require(_0x70e8('0x15'));var logger=require(_0x70e8('0x16'))(_0x70e8('0x17'));var utils=require(_0x70e8('0x18'));var config=require(_0x70e8('0x19'));var licenseUtil=require(_0x70e8('0x1a'));var db=require(_0x70e8('0x1b'))['db'];config[_0x70e8('0x1c')]=_[_0x70e8('0x1d')](config['redis'],{'host':_0x70e8('0x1e'),'port':0x18eb});var socket=require(_0x70e8('0x1f'))(new Redis(config[_0x70e8('0x1c')]));require(_0x70e8('0x20'))['register'](socket);function respondWithStatusCode(_0x545a59,_0x1f52e1){_0x1f52e1=_0x1f52e1||0xcc;return function(_0x29d342){if(_0x29d342){return _0x545a59[_0x70e8('0x21')](_0x1f52e1);}return _0x545a59[_0x70e8('0x22')](_0x1f52e1)['end']();};}function respondWithResult(_0x2bd472,_0x1f55ad){_0x1f55ad=_0x1f55ad||0xc8;return function(_0x8c48){if(_0x8c48){return _0x2bd472[_0x70e8('0x22')](_0x1f55ad)[_0x70e8('0x23')](_0x8c48);}};}function respondWithFilteredResult(_0x407bab,_0x358eb8){return function(_0xf47cb9){if(_0xf47cb9){var _0x529c82=_0xf47cb9[_0x70e8('0x24')],_0x5ba6fe=_0x358eb8[_0x70e8('0x25')],_0x318fb4=_0x358eb8['offset']+_0x358eb8[_0x70e8('0x26')],_0x4be1c9;if(_0x318fb4>=_0x529c82){_0x318fb4=_0x529c82;_0x4be1c9=0xc8;}else{_0x4be1c9=0xce;}_0x407bab[_0x70e8('0x22')](_0x4be1c9);return _0x407bab[_0x70e8('0x27')](_0x70e8('0x28'),_0x5ba6fe+'-'+_0x318fb4+'/'+_0x529c82)[_0x70e8('0x23')](_0xf47cb9);}return null;};}function patchUpdates(_0x21b9b8){return function(_0x26d0f8){try{jsonpatch[_0x70e8('0x29')](_0x26d0f8,_0x21b9b8,!![]);}catch(_0x43b30){return BPromise[_0x70e8('0x2a')](_0x43b30);}return _0x26d0f8[_0x70e8('0x2b')]();};}function saveUpdates(_0x301011,_0x18428d){return function(_0x5d2d0b){if(_0x5d2d0b){return _0x5d2d0b[_0x70e8('0x2c')](_0x301011)[_0x70e8('0x2d')](function(_0x182896){return _0x182896;});}return null;};}function removeEntity(_0x298b97,_0x18e357){return function(_0x29c6a2){if(_0x29c6a2){return _0x29c6a2[_0x70e8('0x2e')]()[_0x70e8('0x2d')](function(){_0x298b97[_0x70e8('0x22')](0xcc)[_0x70e8('0x2f')]();});}};}function handleEntityNotFound(_0x5a515b,_0x19f56a){return function(_0x4b850a){if(!_0x4b850a){_0x5a515b['sendStatus'](0x194);}return _0x4b850a;};}function handleError(_0x18e2af,_0x96d76b){_0x96d76b=_0x96d76b||0x1f4;return function(_0x2ede28){logger[_0x70e8('0x30')](_0x2ede28[_0x70e8('0x31')]);if(_0x2ede28[_0x70e8('0x32')]){delete _0x2ede28[_0x70e8('0x32')];}_0x18e2af['status'](_0x96d76b)[_0x70e8('0x33')](_0x2ede28);};}exports[_0x70e8('0x34')]=function(_0x4e4d26,_0x2eb053){var _0x30ed2a={'raw':![],'where':{'id':_0x4e4d26['params']['id']}},_0x365465={};_0x365465['model']=_[_0x70e8('0x35')](db[_0x70e8('0x36')][_0x70e8('0x37')]);_0x365465[_0x70e8('0x38')]=_[_0x70e8('0x35')](_0x4e4d26[_0x70e8('0x38')]);_0x365465[_0x70e8('0x39')]=_[_0x70e8('0x3a')](_0x365465['model'],_0x365465[_0x70e8('0x38')]);_0x30ed2a[_0x70e8('0x3b')]=_['intersection'](_0x365465[_0x70e8('0x3c')],qs['fields'](_0x4e4d26[_0x70e8('0x38')]['fields']));_0x30ed2a[_0x70e8('0x3b')]=_0x30ed2a[_0x70e8('0x3b')][_0x70e8('0x3d')]?_0x30ed2a[_0x70e8('0x3b')]:_0x365465[_0x70e8('0x3c')];if(_0x4e4d26['query']['includeAll']){_0x30ed2a['include']=[{'all':!![]}];}_0x30ed2a=_[_0x70e8('0x3e')]({},_0x30ed2a,_0x4e4d26[_0x70e8('0x3f')]);return db[_0x70e8('0x36')]['find'](_0x30ed2a)['then'](handleEntityNotFound(_0x2eb053,null))['then'](respondWithResult(_0x2eb053,null))[_0x70e8('0x40')](handleError(_0x2eb053,null));};exports[_0x70e8('0x2e')]=function(_0x6ab7e9,_0x14f9c8){return db[_0x70e8('0x36')][_0x70e8('0x41')]({'where':{'id':_0x6ab7e9['params']['id']}})[_0x70e8('0x2d')](handleEntityNotFound(_0x14f9c8,null))[_0x70e8('0x2d')](removeEntity(_0x14f9c8,null))[_0x70e8('0x40')](handleError(_0x14f9c8,null));};function widgetAttributes(_0x54b589){try{switch(_0x54b589[_0x70e8('0x42')]){case'iframe':return[{'name':_0x70e8('0x43'),'value':_0x54b589[_0x70e8('0x43')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589['attrs'][0x0]['value']:undefined)||'https://'}];case _0x70e8('0x45'):return[{'name':'attrPath','value':_0x54b589[_0x70e8('0x46')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||''}];case _0x70e8('0x47'):return[{'name':_0x70e8('0x48'),'value':_0x54b589[_0x70e8('0x48')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x49')]:undefined)||'HH:mm:ss'},{'name':_0x70e8('0x4a'),'value':_0x54b589[_0x70e8('0x4a')]||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||_0x70e8('0x4b')},{'name':_0x70e8('0x4c'),'value':_0x54b589[_0x70e8('0x4c')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2][_0x70e8('0x49')]:undefined)||0xc}];case _0x70e8('0x4d'):return[{'name':_0x70e8('0x4e'),'value':_0x54b589[_0x70e8('0x4e')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589['attrs'][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||_0x70e8('0x4f')},{'name':_0x70e8('0x50'),'value':_0x54b589[_0x70e8('0x50')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||[]},{'name':_0x70e8('0x4c'),'value':_0x54b589['attrFontSize']||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2][_0x70e8('0x49')]:undefined)||0x14}];case'multibar-chart':case _0x70e8('0x51'):return[{'name':_0x70e8('0x52'),'value':_0x54b589[_0x70e8('0x52')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x49')]:undefined)||_0x70e8('0x4f')},{'name':_0x70e8('0x53'),'value':_0x54b589[_0x70e8('0x53')]||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589['attrs'][0x1][_0x70e8('0x49')]:undefined)||null},{'name':'attrSerie3','value':_0x54b589[_0x70e8('0x54')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x2]?_0x54b589[_0x70e8('0x44')][0x2]['value']:undefined)||null},{'name':_0x70e8('0x50'),'value':_0x54b589['attrVoiceQueues']||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x3]?_0x54b589[_0x70e8('0x44')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x54b589[_0x70e8('0x55')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0][_0x70e8('0x42')]:undefined)||null,'value':_0x54b589[_0x70e8('0x56')]||(_0x54b589[_0x70e8('0x44')]&&_0x54b589[_0x70e8('0x44')][0x0]?_0x54b589[_0x70e8('0x44')][0x0]['value']:undefined)||null},{'name':_0x70e8('0x57'),'value':_0x54b589['attrRefresh']||(_0x54b589['attrs']&&_0x54b589[_0x70e8('0x44')][0x1]?_0x54b589[_0x70e8('0x44')][0x1][_0x70e8('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x55d482){logger[_0x70e8('0x30')](_0x70e8('0x58'),JSON[_0x70e8('0x59')](_0x55d482));return[];}}exports[_0x70e8('0x5a')]=function(_0x440d8b,_0xa151bd){if(_0x440d8b['body']){_0x440d8b['body'][_0x70e8('0x44')]=widgetAttributes(_0x440d8b['body']);}return db[_0x70e8('0x36')][_0x70e8('0x5a')](_0x440d8b[_0x70e8('0x5b')],{})[_0x70e8('0x2d')](respondWithResult(_0xa151bd,0xc9))[_0x70e8('0x40')](handleError(_0xa151bd,null));};exports[_0x70e8('0x2c')]=function(_0xeade6a,_0x4c50bd){if(_0xeade6a[_0x70e8('0x5b')]['id']){delete _0xeade6a[_0x70e8('0x5b')]['id'];}_0xeade6a['body']['attrs']=widgetAttributes(_0xeade6a['body']);return db[_0x70e8('0x36')][_0x70e8('0x41')]({'where':{'id':_0xeade6a[_0x70e8('0x5c')]['id']}})[_0x70e8('0x2d')](handleEntityNotFound(_0x4c50bd,null))['then'](saveUpdates(_0xeade6a['body'],null))[_0x70e8('0x2d')](respondWithResult(_0x4c50bd,null))[_0x70e8('0x40')](handleError(_0x4c50bd,null));}; \ No newline at end of file +var _0x4482=['util','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','json','offset','limit','set','apply','then','error','name','send','show','params','model','DashboardItem','keys','query','filters','intersection','attributes','fields','length','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x263418,_0x2555a9){var _0x2a66c4=function(_0x304fd2){while(--_0x304fd2){_0x263418['push'](_0x263418['shift']());}};_0x2a66c4(++_0x2555a9);}(_0x4482,0x198));var _0x2448=function(_0x386426,_0xa4983b){_0x386426=_0x386426-0x0;var _0x584ff0=_0x4482[_0x386426];return _0x584ff0;};'use strict';var pdf=require(_0x2448('0x0'));var emlformat=require(_0x2448('0x1'));var rimraf=require(_0x2448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2448('0x3'));var rp=require(_0x2448('0x4'));var moment=require('moment');var BPromise=require(_0x2448('0x5'));var Mustache=require(_0x2448('0x6'));var util=require(_0x2448('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2448('0x8'));var ejs=require(_0x2448('0x9'));var fs=require('fs');var _=require(_0x2448('0xa'));var squel=require(_0x2448('0xb'));var crypto=require(_0x2448('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2448('0x8'));var querystring=require(_0x2448('0xd'));var Papa=require('papaparse');var Redis=require(_0x2448('0xe'));var authService=require(_0x2448('0xf'));var qs=require(_0x2448('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2448('0x11'));var logger=require(_0x2448('0x12'))(_0x2448('0x13'));var utils=require(_0x2448('0x14'));var config=require(_0x2448('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2448('0x16'))['db'];config['redis']=_['defaults'](config[_0x2448('0x17')],{'host':_0x2448('0x18'),'port':0x18eb});var socket=require(_0x2448('0x19'))(new Redis(config['redis']));require(_0x2448('0x1a'))['register'](socket);function respondWithStatusCode(_0x3cd47d,_0x402298){_0x402298=_0x402298||0xcc;return function(_0x4fdd6b){if(_0x4fdd6b){return _0x3cd47d[_0x2448('0x1b')](_0x402298);}return _0x3cd47d['status'](_0x402298)[_0x2448('0x1c')]();};}function respondWithResult(_0xdc1da4,_0x216a1c){_0x216a1c=_0x216a1c||0xc8;return function(_0x1c064a){if(_0x1c064a){return _0xdc1da4[_0x2448('0x1d')](_0x216a1c)[_0x2448('0x1e')](_0x1c064a);}};}function respondWithFilteredResult(_0x48c182,_0xbb2a77){return function(_0x1d9a5b){if(_0x1d9a5b){var _0x20b061=_0x1d9a5b['count'],_0x115caa=_0xbb2a77[_0x2448('0x1f')],_0x44c6b0=_0xbb2a77[_0x2448('0x1f')]+_0xbb2a77[_0x2448('0x20')],_0x25fd63;if(_0x44c6b0>=_0x20b061){_0x44c6b0=_0x20b061;_0x25fd63=0xc8;}else{_0x25fd63=0xce;}_0x48c182[_0x2448('0x1d')](_0x25fd63);return _0x48c182[_0x2448('0x21')]('Content-Range',_0x115caa+'-'+_0x44c6b0+'/'+_0x20b061)['json'](_0x1d9a5b);}return null;};}function patchUpdates(_0x407c58){return function(_0x25ce87){try{jsonpatch[_0x2448('0x22')](_0x25ce87,_0x407c58,!![]);}catch(_0x471920){return BPromise['reject'](_0x471920);}return _0x25ce87['save']();};}function saveUpdates(_0x16f7b2,_0x471c6a){return function(_0x5ea032){if(_0x5ea032){return _0x5ea032['update'](_0x16f7b2)[_0x2448('0x23')](function(_0x451771){return _0x451771;});}return null;};}function removeEntity(_0x427ebe,_0x44a384){return function(_0x27a05a){if(_0x27a05a){return _0x27a05a['destroy']()[_0x2448('0x23')](function(){_0x427ebe[_0x2448('0x1d')](0xcc)[_0x2448('0x1c')]();});}};}function handleEntityNotFound(_0x1ede7a,_0x4c282d){return function(_0x54de0e){if(!_0x54de0e){_0x1ede7a[_0x2448('0x1b')](0x194);}return _0x54de0e;};}function handleError(_0x53df4b,_0x1c76a9){_0x1c76a9=_0x1c76a9||0x1f4;return function(_0x1a3e95){logger[_0x2448('0x24')](_0x1a3e95['stack']);if(_0x1a3e95[_0x2448('0x25')]){delete _0x1a3e95['name'];}_0x53df4b[_0x2448('0x1d')](_0x1c76a9)[_0x2448('0x26')](_0x1a3e95);};}exports[_0x2448('0x27')]=function(_0x39a9ad,_0x3530c4){var _0x3192da={'raw':![],'where':{'id':_0x39a9ad[_0x2448('0x28')]['id']}},_0x586667={};_0x586667[_0x2448('0x29')]=_['keys'](db[_0x2448('0x2a')]['rawAttributes']);_0x586667['query']=_[_0x2448('0x2b')](_0x39a9ad[_0x2448('0x2c')]);_0x586667[_0x2448('0x2d')]=_[_0x2448('0x2e')](_0x586667['model'],_0x586667[_0x2448('0x2c')]);_0x3192da[_0x2448('0x2f')]=_[_0x2448('0x2e')](_0x586667[_0x2448('0x29')],qs[_0x2448('0x30')](_0x39a9ad[_0x2448('0x2c')][_0x2448('0x30')]));_0x3192da['attributes']=_0x3192da[_0x2448('0x2f')][_0x2448('0x31')]?_0x3192da[_0x2448('0x2f')]:_0x586667['model'];if(_0x39a9ad[_0x2448('0x2c')]['includeAll']){_0x3192da['include']=[{'all':!![]}];}_0x3192da=_[_0x2448('0x32')]({},_0x3192da,_0x39a9ad[_0x2448('0x33')]);return db['DashboardItem'][_0x2448('0x34')](_0x3192da)[_0x2448('0x23')](handleEntityNotFound(_0x3530c4,null))[_0x2448('0x23')](respondWithResult(_0x3530c4,null))[_0x2448('0x35')](handleError(_0x3530c4,null));};exports[_0x2448('0x36')]=function(_0x21e791,_0x256eea){return db['DashboardItem'][_0x2448('0x34')]({'where':{'id':_0x21e791[_0x2448('0x28')]['id']}})['then'](handleEntityNotFound(_0x256eea,null))['then'](removeEntity(_0x256eea,null))[_0x2448('0x35')](handleError(_0x256eea,null));};function widgetAttributes(_0x5dd935){try{switch(_0x5dd935[_0x2448('0x37')]){case _0x2448('0x38'):return[{'name':_0x2448('0x39'),'value':_0x5dd935[_0x2448('0x39')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||_0x2448('0x3c')}];case _0x2448('0x3d'):return[{'name':_0x2448('0x3e'),'value':_0x5dd935[_0x2448('0x3e')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||''}];case _0x2448('0x3f'):return[{'name':_0x2448('0x40'),'value':_0x5dd935[_0x2448('0x40')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935[_0x2448('0x3a')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5dd935[_0x2448('0x41')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935[_0x2448('0x3a')][0x1][_0x2448('0x3b')]:undefined)||_0x2448('0x42')},{'name':_0x2448('0x43'),'value':_0x5dd935['attrFontSize']||(_0x5dd935['attrs']&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935['attrs'][0x2][_0x2448('0x3b')]:undefined)||0xc}];case _0x2448('0x44'):return[{'name':'attrMetric','value':_0x5dd935[_0x2448('0x45')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935['attrs'][0x0][_0x2448('0x3b')]:undefined)||_0x2448('0x46')},{'name':_0x2448('0x47'),'value':_0x5dd935['attrVoiceQueues']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935['attrs'][0x1][_0x2448('0x3b')]:undefined)||[]},{'name':_0x2448('0x43'),'value':_0x5dd935[_0x2448('0x43')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935['attrs'][0x2][_0x2448('0x3b')]:undefined)||0x14}];case _0x2448('0x48'):case'pie-chart':return[{'name':'attrSerie1','value':_0x5dd935[_0x2448('0x49')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935['attrs'][0x0][_0x2448('0x3b')]:undefined)||'total'},{'name':_0x2448('0x4a'),'value':_0x5dd935['attrSerie2']||(_0x5dd935['attrs']&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935['attrs'][0x1]['value']:undefined)||null},{'name':_0x2448('0x4b'),'value':_0x5dd935[_0x2448('0x4b')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935[_0x2448('0x3a')][0x2][_0x2448('0x3b')]:undefined)||null},{'name':_0x2448('0x47'),'value':_0x5dd935['attrVoiceQueues']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x3]?_0x5dd935[_0x2448('0x3a')][0x3][_0x2448('0x3b')]:undefined)||[]}];case _0x2448('0x4c'):return[{'name':_0x2448('0x4d'),'type':_0x5dd935['reportType']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0]['type']:undefined)||null,'value':_0x5dd935[_0x2448('0x4d')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||null},{'name':_0x2448('0x4e'),'value':_0x5dd935[_0x2448('0x4e')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935[_0x2448('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x114a81){logger[_0x2448('0x24')]('widgetAttributes:\x20%s',JSON[_0x2448('0x4f')](_0x114a81));return[];}}exports[_0x2448('0x50')]=function(_0x235bcd,_0x266149){if(_0x235bcd['body']){_0x235bcd[_0x2448('0x51')][_0x2448('0x3a')]=widgetAttributes(_0x235bcd[_0x2448('0x51')]);}return db[_0x2448('0x2a')][_0x2448('0x50')](_0x235bcd['body'],{})[_0x2448('0x23')](respondWithResult(_0x266149,0xc9))[_0x2448('0x35')](handleError(_0x266149,null));};exports[_0x2448('0x52')]=function(_0x288580,_0xef349e){if(_0x288580[_0x2448('0x51')]['id']){delete _0x288580[_0x2448('0x51')]['id'];}_0x288580[_0x2448('0x51')]['attrs']=widgetAttributes(_0x288580[_0x2448('0x51')]);return db[_0x2448('0x2a')][_0x2448('0x34')]({'where':{'id':_0x288580[_0x2448('0x28')]['id']}})[_0x2448('0x23')](handleEntityNotFound(_0xef349e,null))[_0x2448('0x23')](saveUpdates(_0x288580['body'],null))[_0x2448('0x23')](respondWithResult(_0xef349e,null))[_0x2448('0x35')](handleError(_0xef349e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6b6dd2a..f18ad83 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 _0x2c7b=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x3ca273,_0x2e2a69){var _0x182fa0=function(_0x55fd1b){while(--_0x55fd1b){_0x3ca273['push'](_0x3ca273['shift']());}};_0x182fa0(++_0x2e2a69);}(_0x2c7b,0x1af));var _0xb2c7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2c7b[_0x55f8b4];return _0x2475f9;};'use strict';var EventEmitter=require(_0xb2c7('0x0'));var DashboardItem=require(_0xb2c7('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb2c7('0x2')](0x0);var events={'afterCreate':_0xb2c7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25acf7){return function(_0x3dfc62,_0x1febb1,_0x167e83){DashboardItemEvents[_0xb2c7('0x4')](_0x25acf7+':'+_0x3dfc62['id'],_0x3dfc62);DashboardItemEvents['emit'](_0x25acf7,_0x3dfc62);_0x167e83(null);};}for(var e in events){if(events[_0xb2c7('0x5')](e)){var event=events[e];DashboardItem[_0xb2c7('0x6')](e,emitEvent(event));}}module[_0xb2c7('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xfdd7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfdd7,0x156));var _0x7fdd=function(_0x9ab334,_0x2035b4){_0x9ab334=_0x9ab334-0x0;var _0x274d57=_0xfdd7[_0x9ab334];return _0x274d57;};'use strict';var EventEmitter=require(_0x7fdd('0x0'));var DashboardItem=require(_0x7fdd('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7fdd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fdd('0x3'),'afterDestroy':_0x7fdd('0x4')};function emitEvent(_0xb4288d){return function(_0x493c94,_0xd8388a,_0x46df9c){DashboardItemEvents['emit'](_0xb4288d+':'+_0x493c94['id'],_0x493c94);DashboardItemEvents[_0x7fdd('0x5')](_0xb4288d,_0x493c94);_0x46df9c(null);};}for(var e in events){if(events[_0x7fdd('0x6')](e)){var event=events[e];DashboardItem[_0x7fdd('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index fa40967..e657dd9 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 _0xb0b6=['./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46f4aa,_0x3086e6){var _0x197c3a=function(_0x5cf206){while(--_0x5cf206){_0x46f4aa['push'](_0x46f4aa['shift']());}};_0x197c3a(++_0x3086e6);}(_0xb0b6,0x122));var _0x6b0b=function(_0x483005,_0x175491){_0x483005=_0x483005-0x0;var _0x4a082f=_0xb0b6[_0x483005];return _0x4a082f;};'use strict';var _=require(_0x6b0b('0x0'));var util=require(_0x6b0b('0x1'));var logger=require(_0x6b0b('0x2'))(_0x6b0b('0x3'));var moment=require('moment');var BPromise=require(_0x6b0b('0x4'));var rp=require(_0x6b0b('0x5'));var fs=require('fs');var path=require(_0x6b0b('0x6'));var rimraf=require(_0x6b0b('0x7'));var config=require(_0x6b0b('0x8'));var attributes=require(_0x6b0b('0x9'));module['exports']=function(_0x205fe8,_0x5cd8cc){return _0x205fe8[_0x6b0b('0xa')](_0x6b0b('0xb'),attributes,{'tableName':_0x6b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe304=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','lodash'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xe304,0x8f));var _0x4e30=function(_0x48104b,_0xb93475){_0x48104b=_0x48104b-0x0;var _0x9de74d=_0xe304[_0x48104b];return _0x9de74d;};'use strict';var _=require(_0x4e30('0x0'));var util=require(_0x4e30('0x1'));var logger=require(_0x4e30('0x2'))(_0x4e30('0x3'));var moment=require('moment');var BPromise=require(_0x4e30('0x4'));var rp=require(_0x4e30('0x5'));var fs=require('fs');var path=require(_0x4e30('0x6'));var rimraf=require('rimraf');var config=require(_0x4e30('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x39f0c6,_0x5dc1aa){return _0x39f0c6[_0x4e30('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 98fadde..17ffae6 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 _0x5488=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x4503ef,_0x2189f0){var _0x11c4d6=function(_0x1387c9){while(--_0x1387c9){_0x4503ef['push'](_0x4503ef['shift']());}};_0x11c4d6(++_0x2189f0);}(_0x5488,0x163));var _0x8548=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x5488[_0xe719ec];return _0x4842a1;};'use strict';var _=require(_0x8548('0x0'));var util=require('util');var moment=require(_0x8548('0x1'));var BPromise=require(_0x8548('0x2'));var rs=require(_0x8548('0x3'));var fs=require('fs');var Redis=require(_0x8548('0x4'));var db=require(_0x8548('0x5'))['db'];var utils=require(_0x8548('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8548('0x7'));var jayson=require(_0x8548('0x8'));var client=jayson['client'][_0x8548('0x9')]({'port':0x232a});config[_0x8548('0xa')]=_[_0x8548('0xb')](config['redis'],{'host':_0x8548('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8548('0xa')]));require(_0x8548('0xd'))['register'](socket);function respondWithRpcPromise(_0x272d9b,_0x5a8b31,_0x23144d){return new BPromise(function(_0x1ff695,_0x5928fa){return client['request'](_0x272d9b,_0x23144d)[_0x8548('0xe')](function(_0x4c2f44){logger[_0x8548('0xf')](_0x8548('0x10'),_0x5a8b31,_0x8548('0x11'));logger[_0x8548('0x12')](_0x8548('0x13'),_0x5a8b31,_0x8548('0x11'),JSON[_0x8548('0x14')](_0x4c2f44));if(_0x4c2f44['error']){if(_0x4c2f44[_0x8548('0x15')]['code']===0x1f4){logger['error'](_0x8548('0x10'),_0x5a8b31,_0x4c2f44[_0x8548('0x15')]['message']);return _0x5928fa(_0x4c2f44[_0x8548('0x15')][_0x8548('0x16')]);}logger[_0x8548('0x15')](_0x8548('0x10'),_0x5a8b31,_0x4c2f44['error']['message']);return _0x1ff695(_0x4c2f44['error'][_0x8548('0x16')]);}else{logger['info'](_0x8548('0x10'),_0x5a8b31,'request\x20sent');_0x1ff695(_0x4c2f44[_0x8548('0x17')]['message']);}})[_0x8548('0x18')](function(_0x3b117d){logger[_0x8548('0x15')](_0x8548('0x10'),_0x5a8b31,_0x3b117d);_0x5928fa(_0x3b117d);});});} \ No newline at end of file +var _0xaf37=['register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket'];(function(_0x2c414e,_0x3367f9){var _0x24af0=function(_0x282162){while(--_0x282162){_0x2c414e['push'](_0x2c414e['shift']());}};_0x24af0(++_0x3367f9);}(_0xaf37,0xe5));var _0x7af3=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xaf37[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x7af3('0x0'));var util=require(_0x7af3('0x1'));var moment=require(_0x7af3('0x2'));var BPromise=require(_0x7af3('0x3'));var rs=require(_0x7af3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7af3('0x5'))(_0x7af3('0x6'));var config=require(_0x7af3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7af3('0x8')][_0x7af3('0x9')]({'port':0x232a});config[_0x7af3('0xa')]=_[_0x7af3('0xb')](config[_0x7af3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7af3('0xc'))(new Redis(config[_0x7af3('0xa')]));require(_0x7af3('0xd'))[_0x7af3('0xe')](socket);function respondWithRpcPromise(_0x4b1f25,_0x3d24ac,_0x383f08){return new BPromise(function(_0x330f2b,_0x11a36){return client[_0x7af3('0xf')](_0x4b1f25,_0x383f08)[_0x7af3('0x10')](function(_0x55625a){logger[_0x7af3('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x7af3('0x12'));logger['debug'](_0x7af3('0x13'),_0x3d24ac,_0x7af3('0x12'),JSON[_0x7af3('0x14')](_0x55625a));if(_0x55625a[_0x7af3('0x15')]){if(_0x55625a['error'][_0x7af3('0x16')]===0x1f4){logger[_0x7af3('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x55625a[_0x7af3('0x15')]['message']);return _0x11a36(_0x55625a[_0x7af3('0x15')][_0x7af3('0x17')]);}logger[_0x7af3('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x55625a[_0x7af3('0x15')][_0x7af3('0x17')]);return _0x330f2b(_0x55625a[_0x7af3('0x15')]['message']);}else{logger[_0x7af3('0x11')](_0x7af3('0x18'),_0x3d24ac,'request\x20sent');_0x330f2b(_0x55625a[_0x7af3('0x19')][_0x7af3('0x17')]);}})[_0x7af3('0x1a')](function(_0x7dacdd){logger[_0x7af3('0x15')](_0x7af3('0x18'),_0x3d24ac,_0x7dacdd);_0x11a36(_0x7dacdd);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c390146..3425793 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 _0x390f=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x2530a3,_0x5717ff){var _0x92c944=function(_0x13414f){while(--_0x13414f){_0x2530a3['push'](_0x2530a3['shift']());}};_0x92c944(++_0x5717ff);}(_0x390f,0x104));var _0xf390=function(_0x1c5b1a,_0x3db3fe){_0x1c5b1a=_0x1c5b1a-0x0;var _0x351b48=_0x390f[_0x1c5b1a];return _0x351b48;};'use strict';var DashboardItemEvents=require(_0xf390('0x0'));var events=[_0xf390('0x1'),_0xf390('0x2'),_0xf390('0x3')];function createListener(_0x36b48a,_0x1445a0){return function(_0x3b761f){_0x1445a0[_0xf390('0x4')](_0x36b48a,_0x3b761f);};}function removeListener(_0x30582b,_0x1ed69b){return function(){DashboardItemEvents[_0xf390('0x5')](_0x30582b,_0x1ed69b);};}exports[_0xf390('0x6')]=function(_0x12d519){for(var _0x4e9d18=0x0,_0x1b4feb=events['length'];_0x4e9d18<_0x1b4feb;_0x4e9d18++){var _0x4929ad=events[_0x4e9d18];var _0x37b005=createListener(_0xf390('0x7')+_0x4929ad,_0x12d519);DashboardItemEvents['on'](_0x4929ad,_0x37b005);}}; \ No newline at end of file +var _0xa50f=['update','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x13dff4,_0x3a25c8){var _0x5546d6=function(_0x3626f8){while(--_0x3626f8){_0x13dff4['push'](_0x13dff4['shift']());}};_0x5546d6(++_0x3a25c8);}(_0xa50f,0x1e0));var _0xfa50=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa50f[_0x27af45];return _0x18df21;};'use strict';var DashboardItemEvents=require(_0xfa50('0x0'));var events=[_0xfa50('0x1'),_0xfa50('0x2'),_0xfa50('0x3')];function createListener(_0x4c46ff,_0x54a76b){return function(_0x2e20e5){_0x54a76b['emit'](_0x4c46ff,_0x2e20e5);};}function removeListener(_0x2aebe3,_0x2e9ed5){return function(){DashboardItemEvents[_0xfa50('0x4')](_0x2aebe3,_0x2e9ed5);};}exports['register']=function(_0x20da93){for(var _0x3c7d35=0x0,_0x39604d=events[_0xfa50('0x5')];_0x3c7d35<_0x39604d;_0x3c7d35++){var _0x3179dc=events[_0x3c7d35];var _0x54eb34=createListener(_0xfa50('0x6')+_0x3179dc,_0x20da93);DashboardItemEvents['on'](_0x3179dc,_0x54eb34);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b1aceb4..9b4b9d0 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x1becd7,_0x14d862){var _0x2205b5=function(_0x307898){while(--_0x307898){_0x1becd7['push'](_0x1becd7['shift']());}};_0x2205b5(++_0x14d862);}(_0x687b,0x14a));var _0xb687=function(_0x153c6c,_0x5aa22f){_0x153c6c=_0x153c6c-0x0;var _0x3c85d3=_0x687b[_0x153c6c];return _0x3c85d3;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x45805b,_0x1bbf1a){var _0x4c339a=function(_0x220b7d){while(--_0x220b7d){_0x45805b['push'](_0x45805b['shift']());}};_0x4c339a(++_0x1bbf1a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x283e44,_0x3eca6d){_0x283e44=_0x283e44-0x0;var _0x4e3f99=_0xdbf5[_0x283e44];return _0x4e3f99;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3b40184..32ca622 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 _0xae4a=['exports','STRING','ENUM','first','third','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xae4a,0x1c1));var _0xaae4=function(_0x1207e8,_0x32702f){_0x1207e8=_0x1207e8-0x0;var _0x38f90c=_0xae4a[_0x1207e8];return _0x38f90c;};'use strict';var Sequelize=require(_0xaae4('0x0'));module[_0xaae4('0x1')]={'name':{'type':Sequelize[_0xaae4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xaae4('0x3')](_0xaae4('0x4'),'second',_0xaae4('0x5')),'allowNull':![],'defaultValue':_0xaae4('0x4')},'description':{'type':Sequelize[_0xaae4('0x2')]}}; \ No newline at end of file +var _0x4c42=['first','second','sequelize','exports','STRING','ENUM'];(function(_0x351ee2,_0x414437){var _0x519eef=function(_0x987f85){while(--_0x987f85){_0x351ee2['push'](_0x351ee2['shift']());}};_0x519eef(++_0x414437);}(_0x4c42,0x98));var _0x24c4=function(_0x39f8cc,_0x41329e){_0x39f8cc=_0x39f8cc-0x0;var _0x49fb94=_0x4c42[_0x39f8cc];return _0x49fb94;};'use strict';var Sequelize=require(_0x24c4('0x0'));module[_0x24c4('0x1')]={'name':{'type':Sequelize[_0x24c4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x24c4('0x3')](_0x24c4('0x4'),_0x24c4('0x5'),'third'),'allowNull':![],'defaultValue':_0x24c4('0x4')},'description':{'type':Sequelize[_0x24c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 03e7707..9dc9a7f 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 _0xac22=['UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','Disposition','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Dispositions'];(function(_0x2ceb59,_0x3171d7){var _0x329409=function(_0x17b58d){while(--_0x17b58d){_0x2ceb59['push'](_0x2ceb59['shift']());}};_0x329409(++_0x3171d7);}(_0xac22,0x1ea));var _0x2ac2=function(_0xbafe5e,_0x508a64){_0xbafe5e=_0xbafe5e-0x0;var _0x454fdb=_0xac22[_0xbafe5e];return _0x454fdb;};'use strict';var pdf=require(_0x2ac2('0x0'));var emlformat=require(_0x2ac2('0x1'));var rimraf=require(_0x2ac2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ac2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ac2('0x4'));var Mustache=require(_0x2ac2('0x5'));var util=require('util');var path=require(_0x2ac2('0x6'));var sox=require('sox');var csv=require(_0x2ac2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ac2('0x8'));var squel=require('squel');var crypto=require(_0x2ac2('0x9'));var jsforce=require(_0x2ac2('0xa'));var deskjs=require(_0x2ac2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ac2('0xc'));var authService=require(_0x2ac2('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ac2('0xe'));var logger=require(_0x2ac2('0xf'))('api');var utils=require(_0x2ac2('0x10'));var config=require(_0x2ac2('0x11'));var licenseUtil=require(_0x2ac2('0x12'));var db=require(_0x2ac2('0x13'))['db'];function respondWithStatusCode(_0x3a8134,_0x537148){_0x537148=_0x537148||0xcc;return function(_0x357b35){if(_0x357b35){return _0x3a8134[_0x2ac2('0x14')](_0x537148);}return _0x3a8134[_0x2ac2('0x15')](_0x537148)[_0x2ac2('0x16')]();};}function respondWithResult(_0x5ca179,_0x261ef2){_0x261ef2=_0x261ef2||0xc8;return function(_0x6ae476){if(_0x6ae476){return _0x5ca179['status'](_0x261ef2)[_0x2ac2('0x17')](_0x6ae476);}};}function respondWithFilteredResult(_0x3a5781,_0xb1ffe2){return function(_0xade8bd){if(_0xade8bd){var _0x131eb3=_0xade8bd['count'],_0x4f9b87=_0xb1ffe2[_0x2ac2('0x18')],_0xd161a7=_0xb1ffe2[_0x2ac2('0x18')]+_0xb1ffe2[_0x2ac2('0x19')],_0x37a071;if(_0xd161a7>=_0x131eb3){_0xd161a7=_0x131eb3;_0x37a071=0xc8;}else{_0x37a071=0xce;}_0x3a5781[_0x2ac2('0x15')](_0x37a071);return _0x3a5781[_0x2ac2('0x1a')](_0x2ac2('0x1b'),_0x4f9b87+'-'+_0xd161a7+'/'+_0x131eb3)['json'](_0xade8bd);}return null;};}function patchUpdates(_0x13f950){return function(_0x2f0ed4){try{jsonpatch[_0x2ac2('0x1c')](_0x2f0ed4,_0x13f950,!![]);}catch(_0x238226){return BPromise[_0x2ac2('0x1d')](_0x238226);}return _0x2f0ed4[_0x2ac2('0x1e')]();};}function saveUpdates(_0x13436f,_0x5dc4eb){return function(_0x3b12bf){if(_0x3b12bf){return _0x3b12bf[_0x2ac2('0x1f')](_0x13436f)[_0x2ac2('0x20')](function(_0x5e707a){return _0x5e707a;});}return null;};}function removeEntity(_0x7f57f0,_0x2eff85){return function(_0x572431){if(_0x572431){return _0x572431['destroy']()['then'](function(){var _0x28c0f3=_0x572431[_0x2ac2('0x21')]({'plain':!![]});var _0x43e825=_0x2ac2('0x22');return db[_0x2ac2('0x23')][_0x2ac2('0x24')]({'where':{'type':_0x43e825,'resourceId':_0x28c0f3['id']}})[_0x2ac2('0x20')](function(){return _0x572431;});})[_0x2ac2('0x20')](function(){_0x7f57f0[_0x2ac2('0x15')](0xcc)[_0x2ac2('0x16')]();});}};}function handleEntityNotFound(_0x1c1b57,_0x2fc42f){return function(_0x2bd792){if(!_0x2bd792){_0x1c1b57['sendStatus'](0x194);}return _0x2bd792;};}function handleError(_0x1d0f8b,_0x243640){_0x243640=_0x243640||0x1f4;return function(_0x131ed1){logger[_0x2ac2('0x25')](_0x131ed1[_0x2ac2('0x26')]);if(_0x131ed1[_0x2ac2('0x27')]){delete _0x131ed1[_0x2ac2('0x27')];}_0x1d0f8b[_0x2ac2('0x15')](_0x243640)[_0x2ac2('0x28')](_0x131ed1);};}exports['index']=function(_0x4ad59b,_0x2925bf){var _0x49943f={},_0x56f55c={},_0x54f2d0={'count':0x0,'rows':[]};var _0x3afd2c=_[_0x2ac2('0x29')](db['Disposition'][_0x2ac2('0x2a')],function(_0x3709e4){return{'name':_0x3709e4['fieldName'],'type':_0x3709e4['type']['key']};});_0x56f55c['model']=_[_0x2ac2('0x29')](_0x3afd2c,_0x2ac2('0x27'));_0x56f55c[_0x2ac2('0x2b')]=_[_0x2ac2('0x2c')](_0x4ad59b[_0x2ac2('0x2b')]);_0x56f55c[_0x2ac2('0x2d')]=_['intersection'](_0x56f55c[_0x2ac2('0x2e')],_0x56f55c[_0x2ac2('0x2b')]);_0x49943f['attributes']=_['intersection'](_0x56f55c[_0x2ac2('0x2e')],qs[_0x2ac2('0x2f')](_0x4ad59b[_0x2ac2('0x2b')]['fields']));_0x49943f['attributes']=_0x49943f[_0x2ac2('0x30')][_0x2ac2('0x31')]?_0x49943f[_0x2ac2('0x30')]:_0x56f55c[_0x2ac2('0x2e')];if(!_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x32')](_0x2ac2('0x33'))){_0x49943f[_0x2ac2('0x19')]=qs[_0x2ac2('0x19')](_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x19')]);_0x49943f[_0x2ac2('0x18')]=qs[_0x2ac2('0x18')](_0x4ad59b[_0x2ac2('0x2b')][_0x2ac2('0x18')]);}_0x49943f[_0x2ac2('0x34')]=qs[_0x2ac2('0x35')](_0x4ad59b[_0x2ac2('0x2b')]['sort']);_0x49943f[_0x2ac2('0x36')]=qs[_0x2ac2('0x2d')](_[_0x2ac2('0x37')](_0x4ad59b[_0x2ac2('0x2b')],_0x56f55c['filters']),_0x3afd2c);if(_0x4ad59b[_0x2ac2('0x2b')]['filter']){_0x49943f[_0x2ac2('0x36')]=_[_0x2ac2('0x38')](_0x49943f['where'],{'$or':_[_0x2ac2('0x29')](_0x3afd2c,function(_0x57e137){if(_0x57e137['type']!==_0x2ac2('0x39')){var _0x45b3d0={};_0x45b3d0[_0x57e137[_0x2ac2('0x27')]]={'$like':'%'+_0x4ad59b['query']['filter']+'%'};return _0x45b3d0;}})});}_0x49943f=_[_0x2ac2('0x38')]({},_0x49943f,_0x4ad59b[_0x2ac2('0x3a')]);var _0x113202={'where':_0x49943f[_0x2ac2('0x36')]};return db[_0x2ac2('0x3b')][_0x2ac2('0x3c')](_0x113202)[_0x2ac2('0x20')](function(_0x59fc3b){_0x54f2d0[_0x2ac2('0x3c')]=_0x59fc3b;if(_0x4ad59b[_0x2ac2('0x2b')]['includeAll']){_0x49943f[_0x2ac2('0x3d')]=[{'all':!![]}];}return db[_0x2ac2('0x3b')][_0x2ac2('0x3e')](_0x49943f);})['then'](function(_0xf6ba0f){_0x54f2d0[_0x2ac2('0x3f')]=_0xf6ba0f;return _0x54f2d0;})[_0x2ac2('0x20')](respondWithFilteredResult(_0x2925bf,_0x49943f))[_0x2ac2('0x40')](handleError(_0x2925bf,null));};exports[_0x2ac2('0x41')]=function(_0x23f9ac,_0x159f6b){var _0x14f3a0={'raw':!![],'where':{'id':_0x23f9ac[_0x2ac2('0x42')]['id']}},_0x2ced74={};_0x2ced74[_0x2ac2('0x2e')]=_[_0x2ac2('0x2c')](db[_0x2ac2('0x3b')][_0x2ac2('0x2a')]);_0x2ced74['query']=_[_0x2ac2('0x2c')](_0x23f9ac[_0x2ac2('0x2b')]);_0x2ced74['filters']=_['intersection'](_0x2ced74['model'],_0x2ced74[_0x2ac2('0x2b')]);_0x14f3a0['attributes']=_['intersection'](_0x2ced74[_0x2ac2('0x2e')],qs[_0x2ac2('0x2f')](_0x23f9ac[_0x2ac2('0x2b')][_0x2ac2('0x2f')]));_0x14f3a0[_0x2ac2('0x30')]=_0x14f3a0[_0x2ac2('0x30')][_0x2ac2('0x31')]?_0x14f3a0['attributes']:_0x2ced74['model'];if(_0x23f9ac[_0x2ac2('0x2b')][_0x2ac2('0x43')]){_0x14f3a0[_0x2ac2('0x3d')]=[{'all':!![]}];}_0x14f3a0=_['merge']({},_0x14f3a0,_0x23f9ac[_0x2ac2('0x3a')]);return db[_0x2ac2('0x3b')][_0x2ac2('0x44')](_0x14f3a0)['then'](handleEntityNotFound(_0x159f6b,null))[_0x2ac2('0x20')](respondWithResult(_0x159f6b,null))[_0x2ac2('0x40')](handleError(_0x159f6b,null));};exports[_0x2ac2('0x45')]=function(_0x2ac1c8,_0x39f21a){return db['Disposition'][_0x2ac2('0x45')](_0x2ac1c8[_0x2ac2('0x46')],{})[_0x2ac2('0x20')](function(_0x5bcee1){var _0x204c1d=_0x2ac1c8[_0x2ac2('0x47')][_0x2ac2('0x21')]({'plain':!![]});if(!_0x204c1d)throw new Error(_0x2ac2('0x48'));if(_0x204c1d[_0x2ac2('0x49')]===_0x2ac2('0x47')){var _0x26a520=_0x5bcee1[_0x2ac2('0x21')]({'plain':!![]});var _0x507433=_0x2ac2('0x22');return db[_0x2ac2('0x4a')]['find']({'where':{'name':_0x507433,'userProfileId':_0x204c1d['userProfileId']},'raw':!![]})[_0x2ac2('0x20')](function(_0x36704c){if(_0x36704c&&_0x36704c['autoAssociation']===0x0){return db[_0x2ac2('0x23')][_0x2ac2('0x45')]({'name':_0x26a520['name'],'resourceId':_0x26a520['id'],'type':_0x36704c[_0x2ac2('0x27')],'sectionId':_0x36704c['id']},{})[_0x2ac2('0x20')](function(){return _0x5bcee1;});}else{return _0x5bcee1;}})[_0x2ac2('0x40')](function(_0x5713e8){logger[_0x2ac2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5713e8);throw _0x5713e8;});}return _0x5bcee1;})[_0x2ac2('0x20')](respondWithResult(_0x39f21a,0xc9))['catch'](handleError(_0x39f21a,null));};exports['update']=function(_0x5c5332,_0x311399){if(_0x5c5332[_0x2ac2('0x46')]['id']){delete _0x5c5332[_0x2ac2('0x46')]['id'];}return db[_0x2ac2('0x3b')][_0x2ac2('0x44')]({'where':{'id':_0x5c5332['params']['id']}})[_0x2ac2('0x20')](handleEntityNotFound(_0x311399,null))[_0x2ac2('0x20')](saveUpdates(_0x5c5332['body'],null))[_0x2ac2('0x20')](respondWithResult(_0x311399,null))[_0x2ac2('0x40')](handleError(_0x311399,null));};exports['destroy']=function(_0x17fd22,_0x173427){return db[_0x2ac2('0x3b')][_0x2ac2('0x44')]({'where':{'id':_0x17fd22[_0x2ac2('0x42')]['id']}})['then'](handleEntityNotFound(_0x173427,null))['then'](removeEntity(_0x173427,null))[_0x2ac2('0x40')](handleError(_0x173427,null));}; \ No newline at end of file +var _0x428a=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','merge','VIRTUAL','where','includeAll','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model'];(function(_0x211fdc,_0x45348b){var _0x52f0ab=function(_0xbfd99f){while(--_0xbfd99f){_0x211fdc['push'](_0x211fdc['shift']());}};_0x52f0ab(++_0x45348b);}(_0x428a,0x6a));var _0xa428=function(_0x351c58,_0x79fef6){_0x351c58=_0x351c58-0x0;var _0x386eac=_0x428a[_0x351c58];return _0x386eac;};'use strict';var pdf=require(_0xa428('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa428('0x1'));var zipdir=require(_0xa428('0x2'));var jsonpatch=require(_0xa428('0x3'));var rp=require('request-promise');var moment=require(_0xa428('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa428('0x5'));var util=require('util');var path=require(_0xa428('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa428('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa428('0x8'));var crypto=require(_0xa428('0x9'));var jsforce=require(_0xa428('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa428('0xb'));var querystring=require(_0xa428('0xc'));var Papa=require(_0xa428('0xd'));var Redis=require('ioredis');var authService=require(_0xa428('0xe'));var qs=require(_0xa428('0xf'));var as=require(_0xa428('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa428('0x11'));var utils=require('../../config/utils');var config=require(_0xa428('0x12'));var licenseUtil=require(_0xa428('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e5dab,_0x57eee7){_0x57eee7=_0x57eee7||0xcc;return function(_0x473275){if(_0x473275){return _0x3e5dab[_0xa428('0x14')](_0x57eee7);}return _0x3e5dab[_0xa428('0x15')](_0x57eee7)[_0xa428('0x16')]();};}function respondWithResult(_0xfa3b6a,_0x23f579){_0x23f579=_0x23f579||0xc8;return function(_0x1faecb){if(_0x1faecb){return _0xfa3b6a['status'](_0x23f579)[_0xa428('0x17')](_0x1faecb);}};}function respondWithFilteredResult(_0x24115a,_0x496b92){return function(_0x201a15){if(_0x201a15){var _0x4daf91=_0x201a15[_0xa428('0x18')],_0x5cf5cf=_0x496b92[_0xa428('0x19')],_0x26dd11=_0x496b92[_0xa428('0x19')]+_0x496b92['limit'],_0x335376;if(_0x26dd11>=_0x4daf91){_0x26dd11=_0x4daf91;_0x335376=0xc8;}else{_0x335376=0xce;}_0x24115a['status'](_0x335376);return _0x24115a[_0xa428('0x1a')](_0xa428('0x1b'),_0x5cf5cf+'-'+_0x26dd11+'/'+_0x4daf91)['json'](_0x201a15);}return null;};}function patchUpdates(_0x1dd44a){return function(_0x2aa74b){try{jsonpatch[_0xa428('0x1c')](_0x2aa74b,_0x1dd44a,!![]);}catch(_0x3396b7){return BPromise[_0xa428('0x1d')](_0x3396b7);}return _0x2aa74b[_0xa428('0x1e')]();};}function saveUpdates(_0x25e745,_0x25278e){return function(_0x26afaf){if(_0x26afaf){return _0x26afaf[_0xa428('0x1f')](_0x25e745)[_0xa428('0x20')](function(_0x54c168){return _0x54c168;});}return null;};}function removeEntity(_0x343b78,_0x3b26fe){return function(_0x1f641f){if(_0x1f641f){return _0x1f641f[_0xa428('0x21')]()[_0xa428('0x20')](function(){var _0xcb5fae=_0x1f641f['get']({'plain':!![]});var _0xfe8e4b=_0xa428('0x22');return db[_0xa428('0x23')][_0xa428('0x21')]({'where':{'type':_0xfe8e4b,'resourceId':_0xcb5fae['id']}})['then'](function(){return _0x1f641f;});})[_0xa428('0x20')](function(){_0x343b78['status'](0xcc)[_0xa428('0x16')]();});}};}function handleEntityNotFound(_0x1e14f4,_0x1e50d8){return function(_0x67ed3c){if(!_0x67ed3c){_0x1e14f4[_0xa428('0x14')](0x194);}return _0x67ed3c;};}function handleError(_0x5d5e31,_0x331ad1){_0x331ad1=_0x331ad1||0x1f4;return function(_0xcdfb20){logger[_0xa428('0x24')](_0xcdfb20[_0xa428('0x25')]);if(_0xcdfb20[_0xa428('0x26')]){delete _0xcdfb20['name'];}_0x5d5e31[_0xa428('0x15')](_0x331ad1)['send'](_0xcdfb20);};}exports['index']=function(_0x33752e,_0x2bffb6){var _0x242ebf={},_0x4bb8e2={},_0x20e3fd={'count':0x0,'rows':[]};var _0x5023e0=_[_0xa428('0x27')](db[_0xa428('0x28')][_0xa428('0x29')],function(_0x3fa5c0){return{'name':_0x3fa5c0[_0xa428('0x2a')],'type':_0x3fa5c0[_0xa428('0x2b')][_0xa428('0x2c')]};});_0x4bb8e2[_0xa428('0x2d')]=_[_0xa428('0x27')](_0x5023e0,_0xa428('0x26'));_0x4bb8e2[_0xa428('0x2e')]=_[_0xa428('0x2f')](_0x33752e['query']);_0x4bb8e2[_0xa428('0x30')]=_[_0xa428('0x31')](_0x4bb8e2[_0xa428('0x2d')],_0x4bb8e2[_0xa428('0x2e')]);_0x242ebf[_0xa428('0x32')]=_['intersection'](_0x4bb8e2[_0xa428('0x2d')],qs[_0xa428('0x33')](_0x33752e['query'][_0xa428('0x33')]));_0x242ebf[_0xa428('0x32')]=_0x242ebf[_0xa428('0x32')][_0xa428('0x34')]?_0x242ebf['attributes']:_0x4bb8e2[_0xa428('0x2d')];if(!_0x33752e['query']['hasOwnProperty'](_0xa428('0x35'))){_0x242ebf[_0xa428('0x36')]=qs[_0xa428('0x36')](_0x33752e[_0xa428('0x2e')][_0xa428('0x36')]);_0x242ebf['offset']=qs[_0xa428('0x19')](_0x33752e[_0xa428('0x2e')][_0xa428('0x19')]);}_0x242ebf['order']=qs['sort'](_0x33752e[_0xa428('0x2e')][_0xa428('0x37')]);_0x242ebf['where']=qs[_0xa428('0x30')](_[_0xa428('0x38')](_0x33752e[_0xa428('0x2e')],_0x4bb8e2['filters']),_0x5023e0);if(_0x33752e['query'][_0xa428('0x39')]){_0x242ebf['where']=_[_0xa428('0x3a')](_0x242ebf['where'],{'$or':_[_0xa428('0x27')](_0x5023e0,function(_0x49ab28){if(_0x49ab28[_0xa428('0x2b')]!==_0xa428('0x3b')){var _0xdd71f2={};_0xdd71f2[_0x49ab28[_0xa428('0x26')]]={'$like':'%'+_0x33752e[_0xa428('0x2e')][_0xa428('0x39')]+'%'};return _0xdd71f2;}})});}_0x242ebf=_[_0xa428('0x3a')]({},_0x242ebf,_0x33752e['options']);var _0x5f1339={'where':_0x242ebf[_0xa428('0x3c')]};return db[_0xa428('0x28')][_0xa428('0x18')](_0x5f1339)[_0xa428('0x20')](function(_0x11457b){_0x20e3fd[_0xa428('0x18')]=_0x11457b;if(_0x33752e[_0xa428('0x2e')][_0xa428('0x3d')]){_0x242ebf['include']=[{'all':!![]}];}return db[_0xa428('0x28')][_0xa428('0x3e')](_0x242ebf);})[_0xa428('0x20')](function(_0x5c50ee){_0x20e3fd[_0xa428('0x3f')]=_0x5c50ee;return _0x20e3fd;})[_0xa428('0x20')](respondWithFilteredResult(_0x2bffb6,_0x242ebf))[_0xa428('0x40')](handleError(_0x2bffb6,null));};exports[_0xa428('0x41')]=function(_0xb35add,_0x1f9953){var _0x2c5db0={'raw':!![],'where':{'id':_0xb35add['params']['id']}},_0x2e5fc0={};_0x2e5fc0[_0xa428('0x2d')]=_[_0xa428('0x2f')](db[_0xa428('0x28')][_0xa428('0x29')]);_0x2e5fc0['query']=_[_0xa428('0x2f')](_0xb35add[_0xa428('0x2e')]);_0x2e5fc0[_0xa428('0x30')]=_[_0xa428('0x31')](_0x2e5fc0[_0xa428('0x2d')],_0x2e5fc0[_0xa428('0x2e')]);_0x2c5db0[_0xa428('0x32')]=_[_0xa428('0x31')](_0x2e5fc0[_0xa428('0x2d')],qs[_0xa428('0x33')](_0xb35add[_0xa428('0x2e')][_0xa428('0x33')]));_0x2c5db0['attributes']=_0x2c5db0[_0xa428('0x32')]['length']?_0x2c5db0['attributes']:_0x2e5fc0[_0xa428('0x2d')];if(_0xb35add[_0xa428('0x2e')][_0xa428('0x3d')]){_0x2c5db0['include']=[{'all':!![]}];}_0x2c5db0=_[_0xa428('0x3a')]({},_0x2c5db0,_0xb35add['options']);return db[_0xa428('0x28')][_0xa428('0x42')](_0x2c5db0)[_0xa428('0x20')](handleEntityNotFound(_0x1f9953,null))['then'](respondWithResult(_0x1f9953,null))[_0xa428('0x40')](handleError(_0x1f9953,null));};exports[_0xa428('0x43')]=function(_0xbcaaf0,_0x3eb886){return db['Disposition']['create'](_0xbcaaf0[_0xa428('0x44')],{})['then'](function(_0x343ab1){var _0x42ae9a=_0xbcaaf0['user'][_0xa428('0x45')]({'plain':!![]});if(!_0x42ae9a)throw new Error(_0xa428('0x46'));if(_0x42ae9a[_0xa428('0x47')]===_0xa428('0x48')){var _0x279fb6=_0x343ab1[_0xa428('0x45')]({'plain':!![]});var _0x1280db=_0xa428('0x22');return db[_0xa428('0x49')][_0xa428('0x42')]({'where':{'name':_0x1280db,'userProfileId':_0x42ae9a[_0xa428('0x4a')]},'raw':!![]})[_0xa428('0x20')](function(_0x1679f3){if(_0x1679f3&&_0x1679f3['autoAssociation']===0x0){return db[_0xa428('0x23')][_0xa428('0x43')]({'name':_0x279fb6[_0xa428('0x26')],'resourceId':_0x279fb6['id'],'type':_0x1679f3[_0xa428('0x26')],'sectionId':_0x1679f3['id']},{})[_0xa428('0x20')](function(){return _0x343ab1;});}else{return _0x343ab1;}})[_0xa428('0x40')](function(_0x352e8a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x352e8a);throw _0x352e8a;});}return _0x343ab1;})[_0xa428('0x20')](respondWithResult(_0x3eb886,0xc9))[_0xa428('0x40')](handleError(_0x3eb886,null));};exports[_0xa428('0x1f')]=function(_0x432fcc,_0x164254){if(_0x432fcc[_0xa428('0x44')]['id']){delete _0x432fcc[_0xa428('0x44')]['id'];}return db[_0xa428('0x28')][_0xa428('0x42')]({'where':{'id':_0x432fcc[_0xa428('0x4b')]['id']}})['then'](handleEntityNotFound(_0x164254,null))[_0xa428('0x20')](saveUpdates(_0x432fcc[_0xa428('0x44')],null))[_0xa428('0x20')](respondWithResult(_0x164254,null))[_0xa428('0x40')](handleError(_0x164254,null));};exports['destroy']=function(_0x2123bf,_0x234204){return db[_0xa428('0x28')][_0xa428('0x42')]({'where':{'id':_0x2123bf['params']['id']}})[_0xa428('0x20')](handleEntityNotFound(_0x234204,null))[_0xa428('0x20')](removeEntity(_0x234204,null))['catch'](handleError(_0x234204,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1e25842..95b962f 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 _0xcd05=['name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcd05,0x163));var _0x5cd0=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xcd05[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5cd0('0xa'),'fields':[_0x5cd0('0xb'),_0x5cd0('0xc')]},{'unique':!![],'name':_0x5cd0('0xd'),'fields':['name',_0x5cd0('0xe')]},{'unique':!![],'name':_0x5cd0('0xf'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x5cd0('0xb'),_0x5cd0('0x11')]},{'unique':!![],'name':_0x5cd0('0x12'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x13')]},{'unique':!![],'name':_0x5cd0('0x14'),'fields':[_0x5cd0('0xb'),_0x5cd0('0x15')]},{'unique':!![],'name':_0x5cd0('0x16'),'fields':[_0x5cd0('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8403=['moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8403,0x1a5));var _0x3840=function(_0x19344e,_0x47f315){_0x19344e=_0x19344e-0x0;var _0x431f96=_0x8403[_0x19344e];return _0x431f96;};'use strict';var _=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var logger=require(_0x3840('0x2'))(_0x3840('0x3'));var moment=require(_0x3840('0x4'));var BPromise=require(_0x3840('0x5'));var rp=require(_0x3840('0x6'));var fs=require('fs');var path=require(_0x3840('0x7'));var rimraf=require(_0x3840('0x8'));var config=require('../../config/environment');var attributes=require(_0x3840('0x9'));module[_0x3840('0xa')]=function(_0x1cd658,_0x233be3){return _0x1cd658[_0x3840('0xb')](_0x3840('0xc'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3840('0xd'),_0x3840('0xe')]},{'unique':!![],'name':_0x3840('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x3840('0x10'),'fields':[_0x3840('0xd'),_0x3840('0x11')]},{'unique':!![],'name':_0x3840('0x12'),'fields':[_0x3840('0xd'),_0x3840('0x13')]},{'unique':!![],'name':_0x3840('0x14'),'fields':[_0x3840('0xd'),_0x3840('0x15')]},{'unique':!![],'name':_0x3840('0x16'),'fields':['name',_0x3840('0x17')]},{'unique':!![],'name':_0x3840('0x18'),'fields':[_0x3840('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4ce4b3a..f6972fe 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 _0xb3ad=['Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1a2297,_0x55c048){var _0x161b80=function(_0x34a412){while(--_0x34a412){_0x1a2297['push'](_0x1a2297['shift']());}};_0x161b80(++_0x55c048);}(_0xb3ad,0x1c0));var _0xdb3a=function(_0x42c0ca,_0xc28f44){_0x42c0ca=_0x42c0ca-0x0;var _0x1d9872=_0xb3ad[_0x42c0ca];return _0x1d9872;};'use strict';var _=require(_0xdb3a('0x0'));var util=require(_0xdb3a('0x1'));var moment=require('moment');var BPromise=require(_0xdb3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb3a('0x3'));var db=require(_0xdb3a('0x4'))['db'];var utils=require(_0xdb3a('0x5'));var logger=require(_0xdb3a('0x6'))('rpc');var config=require(_0xdb3a('0x7'));var jayson=require(_0xdb3a('0x8'));var client=jayson[_0xdb3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290e9b,_0x52f2c7,_0xa20046){return new BPromise(function(_0xfd6114,_0x9ced5f){return client[_0xdb3a('0xa')](_0x290e9b,_0xa20046)[_0xdb3a('0xb')](function(_0x3e58c1){logger['info'](_0xdb3a('0xc'),_0x52f2c7,_0xdb3a('0xd'));logger[_0xdb3a('0xe')]('Disposition,\x20%s,\x20%s,\x20%s',_0x52f2c7,'request\x20sent',JSON[_0xdb3a('0xf')](_0x3e58c1));if(_0x3e58c1[_0xdb3a('0x10')]){if(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x11')]===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x52f2c7,_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);return _0x9ced5f(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);}logger['error'](_0xdb3a('0xc'),_0x52f2c7,_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);return _0xfd6114(_0x3e58c1[_0xdb3a('0x10')][_0xdb3a('0x12')]);}else{logger['info'](_0xdb3a('0xc'),_0x52f2c7,_0xdb3a('0xd'));_0xfd6114(_0x3e58c1[_0xdb3a('0x13')][_0xdb3a('0x12')]);}})['catch'](function(_0x2b3514){logger[_0xdb3a('0x10')](_0xdb3a('0xc'),_0x52f2c7,_0x2b3514);_0x9ced5f(_0x2b3514);});});} \ No newline at end of file +var _0xff8d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','info','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','Disposition,\x20%s,\x20%s','message','result','catch'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xff8d,0x120));var _0xdff8=function(_0x2d58e4,_0x4622dd){_0x2d58e4=_0x2d58e4-0x0;var _0x3c7c10=_0xff8d[_0x2d58e4];return _0x3c7c10;};'use strict';var _=require(_0xdff8('0x0'));var util=require(_0xdff8('0x1'));var moment=require(_0xdff8('0x2'));var BPromise=require(_0xdff8('0x3'));var rs=require(_0xdff8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdff8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdff8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdff8('0x7'));var client=jayson['client'][_0xdff8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a74c6,_0x52f4ce,_0x52c4a8){return new BPromise(function(_0x3a543f,_0x943cc6){return client['request'](_0x5a74c6,_0x52c4a8)['then'](function(_0x2e0100){logger[_0xdff8('0x9')]('Disposition,\x20%s,\x20%s',_0x52f4ce,_0xdff8('0xa'));logger['debug'](_0xdff8('0xb'),_0x52f4ce,_0xdff8('0xa'),JSON[_0xdff8('0xc')](_0x2e0100));if(_0x2e0100['error']){if(_0x2e0100[_0xdff8('0xd')]['code']===0x1f4){logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);return _0x943cc6(_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);}logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);return _0x3a543f(_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);}else{logger[_0xdff8('0x9')](_0xdff8('0xe'),_0x52f4ce,'request\x20sent');_0x3a543f(_0x2e0100[_0xdff8('0x10')][_0xdff8('0xf')]);}})[_0xdff8('0x11')](function(_0x311b92){logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x311b92);_0x943cc6(_0x311b92);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b6f8efb..fa9cf76 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 _0x6cf6=['../../config/environment','./disposition.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26d237,_0x4d3945){var _0x184541=function(_0x1edd11){while(--_0x1edd11){_0x26d237['push'](_0x26d237['shift']());}};_0x184541(++_0x4d3945);}(_0x6cf6,0x14d));var _0x66cf=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6cf6[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x66cf('0x0'));var util=require(_0x66cf('0x1'));var path=require(_0x66cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x66cf('0x3'));var router=express[_0x66cf('0x4')]();var auth=require(_0x66cf('0x5'));var interaction=require(_0x66cf('0x6'));var config=require(_0x66cf('0x7'));var controller=require(_0x66cf('0x8'));router[_0x66cf('0x9')]('/',auth['isAuthenticated'](),controller[_0x66cf('0xa')]);router['get']('/:id',auth[_0x66cf('0xb')](),controller['show']);router[_0x66cf('0xc')]('/',auth[_0x66cf('0xb')](),controller[_0x66cf('0xd')]);router[_0x66cf('0xe')](_0x66cf('0xf'),auth[_0x66cf('0xb')](),controller[_0x66cf('0x10')]);router[_0x66cf('0x11')]('/:id',auth[_0x66cf('0xb')](),controller[_0x66cf('0x12')]);module[_0x66cf('0x13')]=router; \ No newline at end of file +var _0x64de=['express','Router','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','create','put','update','exports','multer','path','connect-timeout'];(function(_0x23d3e7,_0x139ae7){var _0x4c1019=function(_0x2c9d42){while(--_0x2c9d42){_0x23d3e7['push'](_0x23d3e7['shift']());}};_0x4c1019(++_0x139ae7);}(_0x64de,0x13f));var _0xe64d=function(_0x770dbe,_0x319534){_0x770dbe=_0x770dbe-0x0;var _0x402d8e=_0x64de[_0x770dbe];return _0x402d8e;};'use strict';var multer=require(_0xe64d('0x0'));var util=require('util');var path=require(_0xe64d('0x1'));var timeout=require(_0xe64d('0x2'));var express=require(_0xe64d('0x3'));var router=express[_0xe64d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe64d('0x5'));var config=require('../../config/environment');var controller=require(_0xe64d('0x6'));router[_0xe64d('0x7')]('/',auth[_0xe64d('0x8')](),controller['index']);router['get'](_0xe64d('0x9'),auth[_0xe64d('0x8')](),controller['show']);router['post']('/',auth[_0xe64d('0x8')](),controller[_0xe64d('0xa')]);router[_0xe64d('0xb')](_0xe64d('0x9'),auth[_0xe64d('0x8')](),controller[_0xe64d('0xc')]);router['delete']('/:id',auth[_0xe64d('0x8')](),controller['destroy']);module[_0xe64d('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f6831de..ae55899 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 _0xec38=['IAX','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','9600','12000','14400','7200','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec38,0x1a9));var _0x8ec3=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xec38[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require('sequelize');module[_0x8ec3('0x0')]={'name':{'type':Sequelize[_0x8ec3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8ec3('0x1')]},'ecm':{'type':Sequelize[_0x8ec3('0x2')]('yes','no'),'defaultValue':_0x8ec3('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8ec3('0x1')],'unique':_0x8ec3('0x4')},'minrate':{'type':Sequelize[_0x8ec3('0x2')](_0x8ec3('0x5'),_0x8ec3('0x6'),'7200',_0x8ec3('0x7'),_0x8ec3('0x8'),_0x8ec3('0x9')),'defaultValue':_0x8ec3('0x6')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x8ec3('0x6'),_0x8ec3('0xa'),_0x8ec3('0x7'),'12000','14400'),'defaultValue':_0x8ec3('0x9')},'modem':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8ec3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8ec3('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8ec3('0x2')]('SIP',_0x8ec3('0xc'),_0x8ec3('0xd'),'KHOMP'),'defaultValue':_0x8ec3('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8ec3('0xf')],'defaultValue':function(){return _0x8ec3('0x10');}},'notificationSound':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8ec3('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x8ec3('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8ec3('0x11')],'defaultValue':![],'comment':_0x8ec3('0x13'),'set':function(_0x124574){if(!_0x124574)this[_0x8ec3('0x14')](_0x8ec3('0x15'),null);this['setDataValue'](_0x8ec3('0x16'),_0x124574);}}}; \ No newline at end of file +var _0x8a7b=['INTEGER','SIP','IAX','DADHI','KHOMP','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','exports','STRING','ENUM','yes','2400','4800','7200','9600','12000','14400','v17,v27,v29'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x8a7b,0x1d5));var _0xb8a7=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0x8a7b[_0x1d3e3f];return _0x3879fa;};'use strict';var Sequelize=require('sequelize');module[_0xb8a7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb8a7('0x1')]},'ecm':{'type':Sequelize[_0xb8a7('0x2')]('yes','no'),'defaultValue':_0xb8a7('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb8a7('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb8a7('0x2')](_0xb8a7('0x4'),_0xb8a7('0x5'),_0xb8a7('0x6'),_0xb8a7('0x7'),_0xb8a7('0x8'),_0xb8a7('0x9')),'defaultValue':_0xb8a7('0x5')},'maxrate':{'type':Sequelize[_0xb8a7('0x2')](_0xb8a7('0x4'),_0xb8a7('0x5'),'7200',_0xb8a7('0x7'),'12000',_0xb8a7('0x9')),'defaultValue':_0xb8a7('0x9')},'modem':{'type':Sequelize[_0xb8a7('0x1')],'defaultValue':_0xb8a7('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb8a7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb8a7('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb8a7('0xc'),_0xb8a7('0xd'),_0xb8a7('0xe'),_0xb8a7('0xf')),'defaultValue':_0xb8a7('0xc')},'key':{'type':Sequelize[_0xb8a7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb8a7('0x10')],'defaultValue':function(){return _0xb8a7('0x11');}},'notificationSound':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8a7('0xb')],'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[_0xb8a7('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xb8a7('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb8a7('0x14'),'set':function(_0x13d918){if(!_0x13d918)this[_0xb8a7('0x15')](_0xb8a7('0x16'),null);this[_0xb8a7('0x15')](_0xb8a7('0x17'),_0x13d918);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 35c71a0..033748a 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 _0xe50a=['tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','end','json','count','offset','limit','set','Content-Range','apply','reject','get','UserProfileResource','destroy','status','sendStatus','name','send','index','mandatoryDispositionPause','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','FaxAccount','includeAll','include','findAll','catch','params','Pause','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','order','pick','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','minrate','modem','t38timeout','FAXOPT(','/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'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe50a,0xf0));var _0xae50=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xe50a[_0x427352];return _0x23e0e6;};'use strict';var pdf=require(_0xae50('0x0'));var emlformat=require(_0xae50('0x1'));var rimraf=require(_0xae50('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae50('0x3'));var rp=require('request-promise');var moment=require(_0xae50('0x4'));var BPromise=require(_0xae50('0x5'));var Mustache=require('mustache');var util=require(_0xae50('0x6'));var path=require(_0xae50('0x7'));var sox=require(_0xae50('0x8'));var csv=require('to-csv');var ejs=require(_0xae50('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae50('0xa'));var crypto=require('crypto');var jsforce=require(_0xae50('0xb'));var deskjs=require(_0xae50('0xc'));var toCsv=require(_0xae50('0xd'));var querystring=require(_0xae50('0xe'));var Papa=require(_0xae50('0xf'));var Redis=require(_0xae50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xae50('0x11'));var as=require(_0xae50('0x12'));var hardwareService=require(_0xae50('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xae50('0x14'));var config=require(_0xae50('0x15'));var licenseUtil=require(_0xae50('0x16'));var db=require(_0xae50('0x17'))['db'];config['redis']=_[_0xae50('0x18')](config[_0xae50('0x19')],{'host':_0xae50('0x1a'),'port':0x18eb});var socket=require(_0xae50('0x1b'))(new Redis(config['redis']));require(_0xae50('0x1c'))[_0xae50('0x1d')](socket);var jayson=require(_0xae50('0x1e'));var client=jayson[_0xae50('0x1f')][_0xae50('0x20')]({'port':0x232c});var client9002=jayson[_0xae50('0x1f')][_0xae50('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x33ce9a,_0x5f5a35,_0x407353,_0xf2c5ac){return new BPromise(function(_0x852470,_0x25f42e){var _0x32eaa0=_0xf2c5ac||client;return _0x32eaa0['request'](_0x33ce9a,_0x407353)[_0xae50('0x21')](function(_0x28ed36){logger[_0xae50('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5f5a35,_0xae50('0x23'));logger[_0xae50('0x24')](_0xae50('0x25'),_0x5f5a35,_0xae50('0x23'),JSON[_0xae50('0x26')](_0x28ed36));if(_0x28ed36[_0xae50('0x27')]){if(_0x28ed36[_0xae50('0x27')][_0xae50('0x28')]===0x1f4){logger[_0xae50('0x27')](_0xae50('0x29'),_0x5f5a35,_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);return _0x25f42e(_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);}logger[_0xae50('0x27')](_0xae50('0x29'),_0x5f5a35,_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);return _0x852470(_0x28ed36[_0xae50('0x27')][_0xae50('0x2a')]);}else{logger[_0xae50('0x22')](_0xae50('0x29'),_0x5f5a35,_0xae50('0x23'));_0x852470(_0x28ed36[_0xae50('0x2b')]['message']);}})['catch'](function(_0x2930ac){logger[_0xae50('0x27')]('FaxAccount,\x20%s,\x20%s',_0x5f5a35,_0x2930ac);_0x25f42e(_0x2930ac);});});}function respondWithStatusCode(_0x24198c,_0x592d7f){_0x592d7f=_0x592d7f||0xcc;return function(_0x49a435){if(_0x49a435){return _0x24198c['sendStatus'](_0x592d7f);}return _0x24198c['status'](_0x592d7f)[_0xae50('0x2c')]();};}function respondWithResult(_0x246c6e,_0x2864e6){_0x2864e6=_0x2864e6||0xc8;return function(_0x140344){if(_0x140344){return _0x246c6e['status'](_0x2864e6)[_0xae50('0x2d')](_0x140344);}};}function respondWithFilteredResult(_0x34b600,_0x5b0ffd){return function(_0x1a9a82){if(_0x1a9a82){var _0xea9fa4=_0x1a9a82[_0xae50('0x2e')],_0x19f4f1=_0x5b0ffd[_0xae50('0x2f')],_0x53ff21=_0x5b0ffd[_0xae50('0x2f')]+_0x5b0ffd[_0xae50('0x30')],_0x2d519b;if(_0x53ff21>=_0xea9fa4){_0x53ff21=_0xea9fa4;_0x2d519b=0xc8;}else{_0x2d519b=0xce;}_0x34b600['status'](_0x2d519b);return _0x34b600[_0xae50('0x31')](_0xae50('0x32'),_0x19f4f1+'-'+_0x53ff21+'/'+_0xea9fa4)['json'](_0x1a9a82);}return null;};}function patchUpdates(_0x51521e){return function(_0x247d03){try{jsonpatch[_0xae50('0x33')](_0x247d03,_0x51521e,!![]);}catch(_0x5609b5){return BPromise[_0xae50('0x34')](_0x5609b5);}return _0x247d03['save']();};}function saveUpdates(_0xa6c4e6,_0x48b709){return function(_0x3cf52d){if(_0x3cf52d){return _0x3cf52d['update'](_0xa6c4e6)[_0xae50('0x21')](function(_0x4a7592){return _0x4a7592;});}return null;};}function removeEntity(_0x5cd4e1,_0x554056){return function(_0x2f5194){if(_0x2f5194){return _0x2f5194['destroy']()['then'](function(){var _0x1cc441=_0x2f5194[_0xae50('0x35')]({'plain':!![]});var _0x21c530='FaxAccounts';return db[_0xae50('0x36')][_0xae50('0x37')]({'where':{'type':_0x21c530,'resourceId':_0x1cc441['id']}})[_0xae50('0x21')](function(){return _0x2f5194;});})[_0xae50('0x21')](function(){_0x5cd4e1[_0xae50('0x38')](0xcc)[_0xae50('0x2c')]();});}};}function handleEntityNotFound(_0xb6662a,_0x4306cf){return function(_0x4a3f9f){if(!_0x4a3f9f){_0xb6662a[_0xae50('0x39')](0x194);}return _0x4a3f9f;};}function handleError(_0x52eb51,_0x744026){_0x744026=_0x744026||0x1f4;return function(_0x2d6f46){logger['error'](_0x2d6f46['stack']);if(_0x2d6f46['name']){delete _0x2d6f46[_0xae50('0x3a')];}_0x52eb51[_0xae50('0x38')](_0x744026)[_0xae50('0x3b')](_0x2d6f46);};}exports[_0xae50('0x3c')]=function(_0x5ad282,_0x1c473e){var _0x1c02a3={'include':[{'model':db['Pause'],'as':_0xae50('0x3d')}]},_0x471880={},_0x3bb7e5={'count':0x0,'rows':[]};var _0x307b5c=_['map'](db['FaxAccount']['rawAttributes'],function(_0x1d7e7f){return{'name':_0x1d7e7f[_0xae50('0x3e')],'type':_0x1d7e7f[_0xae50('0x3f')]['key']};});_0x471880[_0xae50('0x40')]=_[_0xae50('0x41')](_0x307b5c,_0xae50('0x3a'));_0x471880[_0xae50('0x42')]=_[_0xae50('0x43')](_0x5ad282[_0xae50('0x42')]);_0x471880[_0xae50('0x44')]=_[_0xae50('0x45')](_0x471880[_0xae50('0x40')],_0x471880['query']);_0x1c02a3['attributes']=_[_0xae50('0x45')](_0x471880['model'],qs['fields'](_0x5ad282['query']['fields']));_0x1c02a3[_0xae50('0x46')]=_0x1c02a3[_0xae50('0x46')]['length']?_0x1c02a3['attributes']:_0x471880['model'];if(!_0x5ad282[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x1c02a3[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x5ad282['query'][_0xae50('0x30')]);_0x1c02a3[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x5ad282['query'][_0xae50('0x2f')]);}_0x1c02a3['order']=qs[_0xae50('0x49')](_0x5ad282[_0xae50('0x42')][_0xae50('0x49')]);_0x1c02a3[_0xae50('0x4a')]=qs[_0xae50('0x44')](_['pick'](_0x5ad282[_0xae50('0x42')],_0x471880[_0xae50('0x44')]),_0x307b5c);if(_0x5ad282[_0xae50('0x42')][_0xae50('0x4b')]){_0x1c02a3[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x1c02a3['where'],{'$or':_['map'](_0x307b5c,function(_0xef9590){if(_0xef9590[_0xae50('0x3f')]!=='VIRTUAL'){var _0x51e428={};_0x51e428[_0xef9590[_0xae50('0x3a')]]={'$like':'%'+_0x5ad282['query'][_0xae50('0x4b')]+'%'};return _0x51e428;}})});}_0x1c02a3=_[_0xae50('0x4c')]({},_0x1c02a3,_0x5ad282[_0xae50('0x4d')]);var _0x2b96bd={'where':_0x1c02a3['where']};return db[_0xae50('0x4e')][_0xae50('0x2e')](_0x2b96bd)[_0xae50('0x21')](function(_0xd23c47){_0x3bb7e5['count']=_0xd23c47;if(_0x5ad282[_0xae50('0x42')][_0xae50('0x4f')]){_0x1c02a3[_0xae50('0x50')]=[{'all':!![]}];}return db[_0xae50('0x4e')][_0xae50('0x51')](_0x1c02a3);})[_0xae50('0x21')](function(_0x1445c7){_0x3bb7e5['rows']=_0x1445c7;return _0x3bb7e5;})[_0xae50('0x21')](respondWithFilteredResult(_0x1c473e,_0x1c02a3))[_0xae50('0x52')](handleError(_0x1c473e,null));};exports['show']=function(_0xe94fe4,_0x129c35){var _0x3dea71={'raw':![],'where':{'id':_0xe94fe4[_0xae50('0x53')]['id']},'include':[{'model':db[_0xae50('0x54')],'as':_0xae50('0x3d')}]},_0x3d7b25={};_0x3d7b25['model']=_[_0xae50('0x43')](db[_0xae50('0x4e')]['rawAttributes']);_0x3d7b25[_0xae50('0x42')]=_[_0xae50('0x43')](_0xe94fe4[_0xae50('0x42')]);_0x3d7b25[_0xae50('0x44')]=_[_0xae50('0x45')](_0x3d7b25[_0xae50('0x40')],_0x3d7b25['query']);_0x3dea71[_0xae50('0x46')]=_[_0xae50('0x45')](_0x3d7b25[_0xae50('0x40')],qs[_0xae50('0x55')](_0xe94fe4[_0xae50('0x42')][_0xae50('0x55')]));_0x3dea71[_0xae50('0x46')]=_0x3dea71['attributes'][_0xae50('0x56')]?_0x3dea71[_0xae50('0x46')]:_0x3d7b25[_0xae50('0x40')];if(_0xe94fe4['query'][_0xae50('0x4f')]){_0x3dea71[_0xae50('0x50')]=[{'all':!![]}];}_0x3dea71=_[_0xae50('0x4c')]({},_0x3dea71,_0xe94fe4[_0xae50('0x4d')]);return db[_0xae50('0x4e')][_0xae50('0x57')](_0x3dea71)[_0xae50('0x21')](handleEntityNotFound(_0x129c35,null))[_0xae50('0x21')](respondWithResult(_0x129c35,null))[_0xae50('0x52')](handleError(_0x129c35,null));};exports[_0xae50('0x58')]=function(_0x418088,_0x107c79){return db[_0xae50('0x4e')][_0xae50('0x58')](_0x418088[_0xae50('0x59')],{})['then'](function(_0x401a59){var _0x1e2a7e=_0x418088[_0xae50('0x5a')]['get']({'plain':!![]});if(!_0x1e2a7e)throw new Error(_0xae50('0x5b'));if(_0x1e2a7e[_0xae50('0x5c')]==='user'){var _0x445749=_0x401a59[_0xae50('0x35')]({'plain':!![]});var _0x3ef67e=_0xae50('0x5d');return db['UserProfileSection'][_0xae50('0x57')]({'where':{'name':_0x3ef67e,'userProfileId':_0x1e2a7e[_0xae50('0x5e')]},'raw':!![]})[_0xae50('0x21')](function(_0x1e5d43){if(_0x1e5d43&&_0x1e5d43[_0xae50('0x5f')]===0x0){return db[_0xae50('0x36')]['create']({'name':_0x445749[_0xae50('0x3a')],'resourceId':_0x445749['id'],'type':_0x1e5d43[_0xae50('0x3a')],'sectionId':_0x1e5d43['id']},{})[_0xae50('0x21')](function(){return _0x401a59;});}else{return _0x401a59;}})[_0xae50('0x52')](function(_0x4372fd){logger[_0xae50('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4372fd);throw _0x4372fd;});}return _0x401a59;})[_0xae50('0x21')](respondWithResult(_0x107c79,0xc9))[_0xae50('0x52')](handleError(_0x107c79,null));};exports[_0xae50('0x60')]=function(_0x4a65a7,_0x186abc){if(_0x4a65a7[_0xae50('0x59')]['id']){delete _0x4a65a7[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x4a65a7[_0xae50('0x53')]['id']},'include':[{'model':db[_0xae50('0x54')],'as':_0xae50('0x3d')}]})['then'](handleEntityNotFound(_0x186abc,null))[_0xae50('0x21')](saveUpdates(_0x4a65a7['body'],null))[_0xae50('0x21')](respondWithResult(_0x186abc,null))['catch'](handleError(_0x186abc,null));};exports[_0xae50('0x37')]=function(_0x3cdff5,_0x404632){return db['FaxAccount'][_0xae50('0x57')]({'where':{'id':_0x3cdff5[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x404632,null))[_0xae50('0x21')](removeEntity(_0x404632,null))['catch'](handleError(_0x404632,null));};exports['describe']=function(_0x3d0126,_0x21a863){return db[_0xae50('0x4e')][_0xae50('0x61')]()['then'](respondWithResult(_0x21a863,null))['catch'](handleError(_0x21a863,null));};exports[_0xae50('0x62')]=function(_0xe30929,_0x1e5b87,_0x2cccbb){if(_0xe30929[_0xae50('0x59')]['id']){delete _0xe30929[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0xe30929[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x1e5b87,null))[_0xae50('0x21')](function(_0x191e27){if(_0x191e27){_0xe30929['body']['FaxAccountId']=_0x191e27['id'];return db[_0xae50('0x63')][_0xae50('0x58')](_0xe30929[_0xae50('0x59')]);}})[_0xae50('0x21')](respondWithResult(_0x1e5b87,null))[_0xae50('0x52')](handleError(_0x1e5b87,null));};exports[_0xae50('0x64')]=function(_0x1365bb,_0x35f226,_0x2fb9ca){var _0x154def={'raw':![],'where':{}};var _0xc143e8={};var _0x2e8152={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x1365bb[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x35f226,null))[_0xae50('0x21')](function(_0x26a4e9){if(_0x26a4e9){_0xc143e8[_0xae50('0x40')]=_[_0xae50('0x43')](db[_0xae50('0x63')][_0xae50('0x66')]);_0xc143e8['query']=_[_0xae50('0x43')](_0x1365bb[_0xae50('0x42')]);_0xc143e8['filters']=_['intersection'](_0xc143e8['model'],_0xc143e8[_0xae50('0x42')]);_0x154def['attributes']=_[_0xae50('0x45')](_0xc143e8[_0xae50('0x40')],qs['fields'](_0x1365bb[_0xae50('0x42')][_0xae50('0x55')]));_0x154def[_0xae50('0x46')]=_0x154def[_0xae50('0x46')][_0xae50('0x56')]?_0x154def[_0xae50('0x46')]:_0xc143e8[_0xae50('0x40')];if(!_0x1365bb[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x154def[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x1365bb[_0xae50('0x42')][_0xae50('0x30')]);_0x154def[_0xae50('0x2f')]=qs['offset'](_0x1365bb[_0xae50('0x42')][_0xae50('0x2f')]);}_0x154def[_0xae50('0x67')]=qs['sort'](_0x1365bb[_0xae50('0x42')][_0xae50('0x49')]);_0x154def['where']=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x1365bb['query'],_0xc143e8[_0xae50('0x44')]));_0x154def['where'][_0xae50('0x69')]=_0x26a4e9['id'];if(_0x1365bb[_0xae50('0x42')][_0xae50('0x4b')]){_0x154def[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x154def[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x154def[_0xae50('0x46')],function(_0x1b1fb9){var _0x2ccef7={};_0x2ccef7[_0x1b1fb9]={'$like':'%'+_0x1365bb['query'][_0xae50('0x4b')]+'%'};return _0x2ccef7;})});}_0x154def=_[_0xae50('0x4c')]({},_0x154def,_0x1365bb[_0xae50('0x4d')]);return db[_0xae50('0x63')][_0xae50('0x2e')]({'where':_0x154def[_0xae50('0x4a')]})['then'](function(_0x5565a6){_0x2e8152[_0xae50('0x2e')]=_0x5565a6;if(_0x1365bb[_0xae50('0x42')]['includeAll']){_0x154def['include']=[{'all':!![]}];}return db[_0xae50('0x63')]['findAll'](_0x154def);})[_0xae50('0x21')](function(_0x367b06){_0x2e8152[_0xae50('0x6a')]=_0x367b06;return _0x2e8152;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x35f226,_0x154def))['catch'](handleError(_0x35f226,null));};exports[_0xae50('0x6b')]=function(_0x47831d,_0x6918ac,_0x52ff42){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x47831d[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x6918ac,null))[_0xae50('0x21')](function(_0x53f18f){if(_0x53f18f){return _0x53f18f[_0xae50('0x6b')](_0x47831d[_0xae50('0x42')][_0xae50('0x6c')]);}})[_0xae50('0x21')](respondWithStatusCode(_0x6918ac,null))[_0xae50('0x52')](handleError(_0x6918ac,null));};exports[_0xae50('0x6d')]=function(_0x220c5b,_0x4c64f4,_0x4450fd){if(_0x220c5b[_0xae50('0x59')]['id']){delete _0x220c5b[_0xae50('0x59')]['id'];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x220c5b[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x4c64f4,null))[_0xae50('0x21')](function(_0x27ca41){if(_0x27ca41){_0x220c5b[_0xae50('0x59')][_0xae50('0x69')]=_0x27ca41['id'];return db[_0xae50('0x6e')][_0xae50('0x58')](_0x220c5b[_0xae50('0x59')]);}})['then'](respondWithResult(_0x4c64f4,null))[_0xae50('0x52')](handleError(_0x4c64f4,null));};exports[_0xae50('0x6f')]=function(_0x3f9a53,_0x26e176,_0x4d652c){var _0x199ec4={'raw':![],'where':{}};var _0xef0f30={};var _0x3b58f7={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x3f9a53[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x26e176,null))['then'](function(_0x20af3f){if(_0x20af3f){_0xef0f30['model']=_[_0xae50('0x43')](db[_0xae50('0x6e')]['rawAttributes']);_0xef0f30['query']=_[_0xae50('0x43')](_0x3f9a53[_0xae50('0x42')]);_0xef0f30[_0xae50('0x44')]=_[_0xae50('0x45')](_0xef0f30[_0xae50('0x40')],_0xef0f30[_0xae50('0x42')]);_0x199ec4['attributes']=_[_0xae50('0x45')](_0xef0f30[_0xae50('0x40')],qs['fields'](_0x3f9a53['query']['fields']));_0x199ec4['attributes']=_0x199ec4['attributes'][_0xae50('0x56')]?_0x199ec4[_0xae50('0x46')]:_0xef0f30[_0xae50('0x40')];if(!_0x3f9a53[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x199ec4[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x30')]);_0x199ec4['offset']=qs[_0xae50('0x2f')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x2f')]);}_0x199ec4[_0xae50('0x67')]=qs[_0xae50('0x49')](_0x3f9a53[_0xae50('0x42')][_0xae50('0x49')]);_0x199ec4[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x3f9a53['query'],_0xef0f30[_0xae50('0x44')]));_0x199ec4[_0xae50('0x4a')][_0xae50('0x69')]=_0x20af3f['id'];if(_0x3f9a53[_0xae50('0x42')][_0xae50('0x4b')]){_0x199ec4[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x199ec4[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x199ec4[_0xae50('0x46')],function(_0x5d6850){var _0x1fdd4f={};_0x1fdd4f[_0x5d6850]={'$like':'%'+_0x3f9a53['query']['filter']+'%'};return _0x1fdd4f;})});}_0x199ec4=_[_0xae50('0x4c')]({},_0x199ec4,_0x3f9a53['options']);return db[_0xae50('0x6e')][_0xae50('0x2e')]({'where':_0x199ec4[_0xae50('0x4a')]})[_0xae50('0x21')](function(_0x5d8501){_0x3b58f7[_0xae50('0x2e')]=_0x5d8501;if(_0x3f9a53[_0xae50('0x42')][_0xae50('0x4f')]){_0x199ec4['include']=[{'all':!![]}];}return db[_0xae50('0x6e')][_0xae50('0x51')](_0x199ec4);})[_0xae50('0x21')](function(_0x24b4d2){_0x3b58f7[_0xae50('0x6a')]=_0x24b4d2;return _0x3b58f7;});}})['then'](respondWithFilteredResult(_0x26e176,_0x199ec4))[_0xae50('0x52')](handleError(_0x26e176,null));};exports[_0xae50('0x70')]=function(_0x396475,_0x101c4b,_0x1c2bd5){return db[_0xae50('0x4e')]['find']({'where':{'id':_0x396475[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x101c4b,null))[_0xae50('0x21')](function(_0x5ae875){if(_0x5ae875){return _0x5ae875[_0xae50('0x70')](_0x396475[_0xae50('0x42')][_0xae50('0x6c')]);}})['then'](respondWithStatusCode(_0x101c4b,null))[_0xae50('0x52')](handleError(_0x101c4b,null));};exports[_0xae50('0x71')]=function(_0x54d50f,_0x1b6988,_0x4fde00){return db[_0xae50('0x72')][_0xae50('0x57')]({'where':{'id':_0x54d50f[_0xae50('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b6988,null))[_0xae50('0x21')](function(_0x56dfce){if(_0x56dfce){return _0x56dfce[_0xae50('0x71')](_0x54d50f[_0xae50('0x59')][_0xae50('0x6c')],_[_0xae50('0x73')](_0x54d50f[_0xae50('0x59')],[_0xae50('0x6c'),'id'])||{});}})[_0xae50('0x21')](respondWithResult(_0x1b6988,null))[_0xae50('0x52')](handleError(_0x1b6988,null));};exports[_0xae50('0x74')]=function(_0x37e0f4,_0x5c8ad6,_0x44dd17){var _0x32320b={'raw':![],'where':{}};var _0x394ef4={};var _0x2cadf1={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x37e0f4[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x5c8ad6,null))[_0xae50('0x21')](function(_0x3d877c){if(_0x3d877c){_0x394ef4[_0xae50('0x40')]=_[_0xae50('0x43')](db[_0xae50('0x72')][_0xae50('0x66')]);_0x394ef4[_0xae50('0x42')]=_['keys'](_0x37e0f4[_0xae50('0x42')]);_0x394ef4['filters']=_[_0xae50('0x45')](_0x394ef4['model'],_0x394ef4[_0xae50('0x42')]);_0x32320b[_0xae50('0x46')]=_[_0xae50('0x45')](_0x394ef4[_0xae50('0x40')],qs[_0xae50('0x55')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x55')]));_0x32320b[_0xae50('0x46')]=_0x32320b[_0xae50('0x46')][_0xae50('0x56')]?_0x32320b[_0xae50('0x46')]:_0x394ef4[_0xae50('0x40')];if(!_0x37e0f4[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x32320b[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x30')]);_0x32320b[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x37e0f4[_0xae50('0x42')]['offset']);}_0x32320b['order']=qs[_0xae50('0x49')](_0x37e0f4[_0xae50('0x42')][_0xae50('0x49')]);_0x32320b[_0xae50('0x4a')]=qs[_0xae50('0x44')](_['pick'](_0x37e0f4['query'],_0x394ef4[_0xae50('0x44')]));_0x32320b[_0xae50('0x4a')][_0xae50('0x69')]=_0x3d877c['id'];if(_0x37e0f4[_0xae50('0x42')][_0xae50('0x4b')]){_0x32320b['where']=_[_0xae50('0x4c')](_0x32320b[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x32320b[_0xae50('0x46')],function(_0x41c21d){var _0x333490={};_0x333490[_0x41c21d]={'$like':'%'+_0x37e0f4['query'][_0xae50('0x4b')]+'%'};return _0x333490;})});}_0x32320b=_[_0xae50('0x4c')]({},_0x32320b,_0x37e0f4[_0xae50('0x4d')]);return db['FaxInteraction'][_0xae50('0x2e')]({'where':_0x32320b[_0xae50('0x4a')]})['then'](function(_0x5d02e6){_0x2cadf1[_0xae50('0x2e')]=_0x5d02e6;if(_0x37e0f4[_0xae50('0x42')][_0xae50('0x4f')]){_0x32320b[_0xae50('0x50')]=[{'model':db[_0xae50('0x75')],'as':'Contact','required':![]},{'model':db[_0xae50('0x76')],'as':_0xae50('0x77'),'attributes':['name',_0xae50('0x78'),_0xae50('0x79')],'required':![]},{'model':db[_0xae50('0x7a')],'as':_0xae50('0x7b'),'attributes':['id',_0xae50('0x3a'),_0xae50('0x7c')],'where':_0x37e0f4[_0xae50('0x42')][_0xae50('0x7d')]?{'id':_0x37e0f4['query'][_0xae50('0x7d')]}:undefined,'required':_0x37e0f4['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0xae50('0x51')](_0x32320b);})[_0xae50('0x21')](function(_0x5cf1aa){_0x2cadf1[_0xae50('0x6a')]=_0x5cf1aa;return _0x2cadf1;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x5c8ad6,_0x32320b))['catch'](handleError(_0x5c8ad6,null));};exports['addApplications']=function(_0x465b08,_0x4969d9,_0x377cf0){return db[_0xae50('0x4e')]['findOne']({'where':{'id':_0x465b08['params']['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x4969d9,null))[_0xae50('0x21')](function(_0x851da2){if(_0x851da2){return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x41d760){return db[_0xae50('0x80')][_0xae50('0x37')]({'where':{'FaxAccountId':_0x465b08['params']['id']},'transaction':_0x41d760})['then'](function(_0x2b660c){var _0x5b4f74=_[_0xae50('0x41')](_0x465b08['body'],function(_0x506303){_0x506303[_0xae50('0x69')]=_0x465b08[_0xae50('0x53')]['id'];return _0x506303;});return db[_0xae50('0x80')][_0xae50('0x81')](_0x5b4f74,{'transaction':_0x41d760});});})[_0xae50('0x21')](function(){return db[_0xae50('0x80')]['findAndCountAll']({'where':{'FaxAccountId':_0x465b08[_0xae50('0x53')]['id']},'order':_0xae50('0x82')});});}})['then'](respondWithResult(_0x4969d9,null))[_0xae50('0x52')](handleError(_0x4969d9,null));};exports[_0xae50('0x83')]=function(_0x201768,_0x1eacfd,_0x4250b8){var _0x4afcc9={};var _0x37546a={};var _0x405905;var _0x34367c;return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x201768[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x1eacfd,null))[_0xae50('0x21')](function(_0x2f9d56){if(_0x2f9d56){_0x405905=_0x2f9d56;_0x37546a[_0xae50('0x40')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x37546a[_0xae50('0x42')]=_[_0xae50('0x43')](_0x201768[_0xae50('0x42')]);_0x37546a['filters']=_[_0xae50('0x45')](_0x37546a[_0xae50('0x40')],_0x37546a['query']);_0x4afcc9[_0xae50('0x46')]=_['intersection'](_0x37546a[_0xae50('0x40')],qs[_0xae50('0x55')](_0x201768['query'][_0xae50('0x55')]));_0x4afcc9[_0xae50('0x46')]=_0x4afcc9['attributes'][_0xae50('0x56')]?_0x4afcc9['attributes']:_0x37546a[_0xae50('0x40')];_0x4afcc9[_0xae50('0x67')]=qs[_0xae50('0x49')](_0x201768[_0xae50('0x42')][_0xae50('0x49')]);_0x4afcc9[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x201768[_0xae50('0x42')],_0x37546a[_0xae50('0x44')]));if(_0x201768[_0xae50('0x42')][_0xae50('0x4b')]){_0x4afcc9[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0x4afcc9[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x4afcc9[_0xae50('0x46')],function(_0x3b83eb){var _0x3c4cba={};_0x3c4cba[_0x3b83eb]={'$like':'%'+_0x201768[_0xae50('0x42')][_0xae50('0x4b')]+'%'};return _0x3c4cba;})});}_0x4afcc9=_[_0xae50('0x4c')]({},_0x4afcc9,_0x201768[_0xae50('0x4d')]);return _0x405905['getApplications'](_0x4afcc9);}})['then'](function(_0x338080){if(_0x338080){_0x34367c=_0x338080[_0xae50('0x56')];if(!_0x201768[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0x4afcc9[_0xae50('0x30')]=qs[_0xae50('0x30')](_0x201768[_0xae50('0x42')][_0xae50('0x30')]);_0x4afcc9[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x201768[_0xae50('0x42')][_0xae50('0x2f')]);}return _0x405905[_0xae50('0x83')](_0x4afcc9);}})['then'](function(_0x2f1e14){if(_0x2f1e14){return _0x2f1e14?{'count':_0x34367c,'rows':_0x2f1e14}:null;}})['then'](respondWithResult(_0x1eacfd,null))['catch'](handleError(_0x1eacfd,null));};function Extension(_0x5eda26,_0x40eae7,_0x20fb3c,_0xaa2ca0){this['context']=_0xae50('0x84');this[_0xae50('0x85')]=_0x5eda26['localstationid'];this[_0xae50('0x86')]=_0xaa2ca0;this[_0xae50('0x3f')]=_0xae50('0x87');this[_0xae50('0x88')]=_0xae50('0x89');this[_0xae50('0x69')]=_0x5eda26['id'];this[_0xae50('0x82')]=_0x40eae7;this[_0xae50('0x8a')]=_0x20fb3c;}function createExtensionsReciveFax(_0x4276c8){var _0x8801=0x1;var _0x2a6638=[];_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,'',_0xae50('0x8c')));_0x8801+=0x1;_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,_0xae50('0x8d'),_0xae50('0x8e')));_0x8801+=0x1;for(var _0x1271c1 in _0x4276c8){if(_0x4276c8[_0xae50('0x47')](_0x1271c1)&&(_0x1271c1===_0xae50('0x8f')||_0x1271c1===_0xae50('0x90')||_0x1271c1===_0xae50('0x91')||_0x1271c1===_0xae50('0x92')||_0x1271c1==='headerinfo'||_0x1271c1==='maxrate'||_0x1271c1===_0xae50('0x93')||_0x1271c1===_0xae50('0x94')||_0x1271c1===_0xae50('0x95'))){_0x2a6638['push'](new Extension(_0x4276c8,_0x8801,_0xae50('0x96')+_0x1271c1+')='+_0x4276c8[_0x1271c1],_0xae50('0x8e')));_0x8801+=0x1;}}_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,'6','Wait'));_0x8801+=0x1;_0x2a6638[_0xae50('0x8b')](new Extension(_0x4276c8,_0x8801,_0xae50('0x97'),_0xae50('0x98')));_0x8801=0x0;return _0x2a6638;}exports[_0xae50('0x99')]=function(_0x14f702,_0x425cd7,_0x3f0b9c){var _0x5c413d;return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x51341a){return db[_0xae50('0x4e')][_0xae50('0x58')](_0x14f702['body'],{'transaction':_0x51341a})['then'](function(_0x129362){_0x5c413d=_0x129362[_0xae50('0x35')]({'plain':!![]});return db[_0xae50('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x5c413d),{'transaction':_0x51341a});});})[_0xae50('0x21')](function(){return _0x5c413d;})[_0xae50('0x21')](respondWithResult(_0x425cd7,null))[_0xae50('0x52')](handleError(_0x425cd7,null));};exports[_0xae50('0x9b')]=function(_0x38a3d0,_0x1a7994,_0x3accf5){var _0x49eaad;return db[_0xae50('0x7e')][_0xae50('0x7f')](function(_0x6991d9){return db[_0xae50('0x4e')]['update'](_0x38a3d0['body'],{'where':{'id':_0x38a3d0[_0xae50('0x59')]['id']},'transaction':_0x6991d9})[_0xae50('0x21')](function(_0x454df0){return db[_0xae50('0x9a')][_0xae50('0x37')]({'where':{'FaxAccountId':_0x38a3d0[_0xae50('0x59')]['id']},'transaction':_0x6991d9})[_0xae50('0x21')](function(_0xb54f97){return db['VoiceExtension'][_0xae50('0x81')](createExtensionsReciveFax(_[_0xae50('0x73')](_0x38a3d0[_0xae50('0x59')],[_0xae50('0x9c'),_0xae50('0x9d'),_0xae50('0x9e'),_0xae50('0x9f'),_0xae50('0xa0'),_0xae50('0xa1')])),{'transaction':_0x6991d9});});});})[_0xae50('0x21')](function(){return db['FaxAccount'][_0xae50('0xa2')](_0x38a3d0[_0xae50('0x59')]['id']);})[_0xae50('0x21')](respondWithResult(_0x1a7994,null))[_0xae50('0x52')](handleError(_0x1a7994,null));};exports[_0xae50('0xa3')]=function(_0x2aaad3,_0x34e66b,_0x21b653){var _0x215c59={'raw':!![],'where':{}};var _0x28fba5={};var _0x35cea3={'count':0x0,'rows':[]};return db[_0xae50('0x4e')][_0xae50('0x65')]({'where':{'id':_0x2aaad3[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x34e66b,null))[_0xae50('0x21')](function(_0x4b1d48){if(_0x4b1d48){_0x28fba5[_0xae50('0x40')]=_[_0xae50('0x43')](db['FaxMessage'][_0xae50('0x66')]);_0x28fba5[_0xae50('0x42')]=_[_0xae50('0x43')](_0x2aaad3[_0xae50('0x42')]);_0x28fba5[_0xae50('0x44')]=_[_0xae50('0x45')](_0x28fba5[_0xae50('0x40')],_0x28fba5[_0xae50('0x42')]);_0x215c59[_0xae50('0x46')]=_[_0xae50('0x45')](_0x28fba5[_0xae50('0x40')],qs[_0xae50('0x55')](_0x2aaad3[_0xae50('0x42')]['fields']));_0x215c59[_0xae50('0x46')]=_0x215c59[_0xae50('0x46')][_0xae50('0x56')]?_0x215c59['attributes']:_0x28fba5[_0xae50('0x40')];if(!_0x2aaad3[_0xae50('0x42')][_0xae50('0x47')]('nolimit')){_0x215c59['limit']=qs['limit'](_0x2aaad3['query'][_0xae50('0x30')]);_0x215c59[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x2aaad3[_0xae50('0x42')]['offset']);}_0x215c59[_0xae50('0x67')]=qs['sort'](_0x2aaad3['query'][_0xae50('0x49')]);_0x215c59['where']=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x2aaad3[_0xae50('0x42')],_0x28fba5[_0xae50('0x44')]));_0x215c59[_0xae50('0x4a')][_0xae50('0x69')]=_0x4b1d48['id'];if(_0x2aaad3[_0xae50('0x42')]['filter']){_0x215c59['where']=_[_0xae50('0x4c')](_0x215c59[_0xae50('0x4a')],{'$or':_[_0xae50('0x41')](_0x215c59[_0xae50('0x46')],function(_0x151516){var _0x44d70a={};_0x44d70a[_0x151516]={'$like':'%'+_0x2aaad3[_0xae50('0x42')]['filter']+'%'};return _0x44d70a;})});}if(_0x2aaad3[_0xae50('0x42')][_0xae50('0xa4')]){var _0x2b9322=_0x2aaad3[_0xae50('0x42')][_0xae50('0xa4')][_0xae50('0xa5')](',');var _0x352676={};_0x352676[_0x2b9322[0x0]]={'$gte':moment(_0x2b9322[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x215c59['where']=_[_0xae50('0x4c')](_0x215c59[_0xae50('0x4a')],_0x352676);}_0x215c59=_['merge']({},_0x215c59,_0x2aaad3[_0xae50('0x4d')]);return db[_0xae50('0xa6')][_0xae50('0x2e')]({'where':_0x215c59['where']})[_0xae50('0x21')](function(_0x2479a8){_0x35cea3[_0xae50('0x2e')]=_0x2479a8;if(_0x2aaad3[_0xae50('0x42')][_0xae50('0x4f')]){_0x215c59['include']=[{'all':!![]}];}return db[_0xae50('0xa6')]['findAll'](_0x215c59);})[_0xae50('0x21')](function(_0xfc8ac6){_0x35cea3[_0xae50('0x6a')]=_0xfc8ac6;return _0x35cea3;});}})[_0xae50('0x21')](respondWithFilteredResult(_0x34e66b,_0x215c59))[_0xae50('0x52')](handleError(_0x34e66b,null));};exports[_0xae50('0x3b')]=function(_0x511a3a,_0x5a8c1d,_0x263fc3){var _0x100f0f,_0xa4a24e={},_0x51323a;if(_0x511a3a[_0xae50('0x59')]['to']){_0x51323a=_0x511a3a['body']['to'][0x0];}return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x511a3a['params']['id']},'include':[{'model':db[_0xae50('0xa7')],'as':_0xae50('0xa8'),'include':[{'model':db[_0xae50('0x75')],'as':_0xae50('0xa9'),'where':{'fax':_0x51323a},'limit':0x1,'order':[[_0xae50('0x9f'),'DESC']]}]}]})[_0xae50('0x21')](handleEntityNotFound(_0x5a8c1d,null))[_0xae50('0x21')](function(_0x4736a6){_0x100f0f=_0x4736a6;if(_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')]&&_0x511a3a[_0xae50('0x59')]['attachments'][_0xae50('0x56')]){for(var _0x593d20=0x0;_0x593d20<_0x511a3a['body'][_0xae50('0xaa')][_0xae50('0x56')];_0x593d20+=0x1){_0x511a3a[_0xae50('0x59')]['attachments'][_0x593d20]={'filename':_0x511a3a['body'][_0xae50('0xaa')][_0x593d20][_0xae50('0x3a')],'id':_0x511a3a['body'][_0xae50('0xaa')][_0x593d20]['id'],'path':path[_0xae50('0xab')](config[_0xae50('0xac')],_0xae50('0xad'),_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][_0x593d20][_0xae50('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0xae50('0xaf'),{'FaxAccountId':_[_0xae50('0xb0')](_0x511a3a[_0xae50('0x53')]['id'])?undefined:_0x511a3a[_0xae50('0x53')]['id'],'path':_['isNil'](_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['path'])?undefined:_0x511a3a['body']['attachments'][0x0][_0xae50('0x7')],'fax':_[_0xae50('0xb0')](_0x511a3a[_0xae50('0x59')]['to'][0x0])?undefined:_0x511a3a[_0xae50('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x100f0f){if(_['isNil'](_0x511a3a[_0xae50('0x59')][_0xae50('0xb1')])){_0x511a3a[_0xae50('0x59')][_0xae50('0xb1')]=util[_0xae50('0xb2')](_0xae50('0xb3'),_0x100f0f[_0xae50('0x3a')],_0x100f0f[_0xae50('0xb4')]);}if(_0x100f0f[_0xae50('0xa8')]){if(_0x100f0f[_0xae50('0xa8')][_0xae50('0xa9')][_0xae50('0x56')]){return _0x100f0f[_0xae50('0xa8')][_0xae50('0xa9')][0x0];}else{return db['CmContact'][_0xae50('0x58')](_[_0xae50('0x18')](_0x511a3a[_0xae50('0x59')],{'firstName':_0x511a3a[_0xae50('0x59')]['to'][0x0],'phone':_0x511a3a[_0xae50('0x59')]['to'][0x0],'fax':_0x511a3a[_0xae50('0x59')]['to'][0x0],'ListId':_0x100f0f[_0xae50('0xa1')]}));}}else{throw new Error(_0xae50('0xb5'));}}else{throw new Error(_0xae50('0xb6'));}})[_0xae50('0x21')](function(_0x18889c){if(_0x18889c){return db[_0xae50('0x72')][_0xae50('0x57')]({'where':{'ContactId':_0x18889c['id'],'closed':![],'FaxAccountId':_0x100f0f['id']}})[_0xae50('0x21')](function(_0x16f9a9){if(_0x16f9a9){return[_0x16f9a9,![]];}return db[_0xae50('0x72')][_0xae50('0x58')]({'UserId':_0x511a3a['user']['id'],'ContactId':_0x18889c['id'],'FaxAccountId':_0x100f0f['id'],'fax':_0x511a3a[_0xae50('0x59')]['to'][0x0],'firstMsgDirection':_0xae50('0xb7'),'Messages':[_[_0xae50('0x4c')](_0x511a3a[_0xae50('0x59')],{'read':![],'body':_0x511a3a['body'][_0xae50('0xaa')][0x0]['filename'],'FaxAccountId':_0x100f0f['id'],'UserId':_0x511a3a[_0xae50('0x5a')]['id'],'ContactId':_0x18889c['id'],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xae50('0xa6')],'as':_0xae50('0xb8')}]})[_0xae50('0x21')](function(_0x29f394){return[_0x29f394,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xae50('0xb9')](function(_0x1f2ddc,_0x42c7a0){if(_0x42c7a0){return _0x1f2ddc;}return db['FaxMessage'][_0xae50('0x58')]({'direction':_0xae50('0xb7'),'read':![],'body':_0x511a3a[_0xae50('0x59')]['attachments'][0x0][_0xae50('0xba')],'FaxAccountId':_0x100f0f['id'],'FaxInteractionId':_0x1f2ddc['id'],'UserId':_0x511a3a[_0xae50('0x5a')]['id'],'ContactId':_0x1f2ddc[_0xae50('0xbb')],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']})[_0xae50('0x21')](function(_0x490b6e){_0x1f2ddc[_0xae50('0xbc')][_0xae50('0xb8')]=[];_0x1f2ddc[_0xae50('0xbc')]['Messages'][_0xae50('0x8b')](_0x490b6e[_0xae50('0xbc')]);return _0x1f2ddc;});})[_0xae50('0x21')](function(_0x2ee420){respondWithRpcPromise('SendFax',_0xae50('0xbd'),{'FaxAccountId':_[_0xae50('0xb0')](_0x511a3a['params']['id'])?undefined:_0x511a3a['params']['id'],'path':_[_0xae50('0xb0')](_0x511a3a['body']['attachments'][0x0]['path'])?undefined:_0x511a3a[_0xae50('0x59')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x511a3a[_0xae50('0x59')]['to'][0x0])?undefined:_0x511a3a[_0xae50('0x59')]['to'][0x0],'AttachmentId':_0x511a3a[_0xae50('0x59')][_0xae50('0xaa')][0x0]['id']},client9002)['then'](function(_0x4808c1){logger[_0xae50('0x22')](_0xae50('0xbe'),_0x4808c1);})[_0xae50('0x52')](function(_0x409f23){logger['info']('SendFaxRpc,\x20%s',_0x409f23);});return _0x2ee420;})['then'](respondWithResult(_0x5a8c1d,null))[_0xae50('0x52')](handleError(_0x5a8c1d,null));};exports[_0xae50('0xbf')]=function(_0x31bce1,_0x187a86,_0x8a610e){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x31bce1[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x187a86,null))[_0xae50('0x21')](function(_0xca17e4){if(_0xca17e4){return _0xca17e4[_0xae50('0xbf')](_0x31bce1[_0xae50('0x59')][_0xae50('0x6c')],_[_0xae50('0x73')](_0x31bce1[_0xae50('0x59')],[_0xae50('0x6c'),'id'])||{})[_0xae50('0xb9')](function(_0x3be331){for(var _0x4ac8b0=0x0;_0x4ac8b0<_0x31bce1['body'][_0xae50('0x6c')][_0xae50('0x56')];_0x4ac8b0+=0x1){socket[_0xae50('0xc0')](_0xae50('0xc1'),{'UserId':_0x31bce1[_0xae50('0x59')]['ids'][_0x4ac8b0],'FaxAccountId':_0x31bce1[_0xae50('0x53')]['id']});}return _0x3be331;});}})[_0xae50('0x21')](respondWithResult(_0x187a86,null))[_0xae50('0x52')](handleError(_0x187a86,null));};exports['removeAgents']=function(_0x4488ff,_0x2bb70c,_0xb4c946){return db[_0xae50('0x4e')][_0xae50('0x57')]({'where':{'id':_0x4488ff[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x2bb70c,null))[_0xae50('0x21')](function(_0x2f607f){if(_0x2f607f){return _0x2f607f[_0xae50('0xc2')](_0x4488ff[_0xae50('0x42')]['ids'])[_0xae50('0x21')](function(){if(_[_0xae50('0xc3')](_0x4488ff['query'][_0xae50('0x6c')])){for(var _0xbf7c4f=0x0;_0xbf7c4f<_0x4488ff[_0xae50('0x42')][_0xae50('0x6c')]['length'];_0xbf7c4f+=0x1){socket[_0xae50('0xc0')](_0xae50('0xc4'),{'UserId':Number(_0x4488ff['query'][_0xae50('0x6c')][_0xbf7c4f]),'FaxAccountId':Number(_0x4488ff['params']['id'])});}}else{socket[_0xae50('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x4488ff[_0xae50('0x42')]['ids']),'FaxAccountId':Number(_0x4488ff[_0xae50('0x53')]['id'])});}});}})[_0xae50('0x21')](respondWithStatusCode(_0x2bb70c,null))[_0xae50('0x52')](handleError(_0x2bb70c,null));};exports['getAgents']=function(_0x5acd8c,_0x563552,_0x28e4fc){var _0xb750b5={};var _0x2c3d5b={};var _0x4e2c57;var _0x44ce48;return db['FaxAccount']['findOne']({'where':{'id':_0x5acd8c[_0xae50('0x53')]['id']}})[_0xae50('0x21')](handleEntityNotFound(_0x563552,null))['then'](function(_0x35ff4e){if(_0x35ff4e){_0x4e2c57=_0x35ff4e;_0x2c3d5b[_0xae50('0x40')]=_[_0xae50('0x43')](db['User'][_0xae50('0x66')]);_0x2c3d5b[_0xae50('0x42')]=_[_0xae50('0x43')](_0x5acd8c[_0xae50('0x42')]);_0x2c3d5b[_0xae50('0x44')]=_['intersection'](_0x2c3d5b[_0xae50('0x40')],_0x2c3d5b[_0xae50('0x42')]);_0xb750b5[_0xae50('0x46')]=_[_0xae50('0x45')](_0x2c3d5b[_0xae50('0x40')],qs['fields'](_0x5acd8c[_0xae50('0x42')][_0xae50('0x55')]));_0xb750b5[_0xae50('0x46')]=_0xb750b5[_0xae50('0x46')][_0xae50('0x56')]?_0xb750b5[_0xae50('0x46')]:_0x2c3d5b[_0xae50('0x40')];_0xb750b5['order']=qs[_0xae50('0x49')](_0x5acd8c[_0xae50('0x42')][_0xae50('0x49')]);_0xb750b5[_0xae50('0x4a')]=qs[_0xae50('0x44')](_[_0xae50('0x68')](_0x5acd8c[_0xae50('0x42')],_0x2c3d5b[_0xae50('0x44')]));if(_0x5acd8c[_0xae50('0x42')][_0xae50('0x4b')]){_0xb750b5[_0xae50('0x4a')]=_[_0xae50('0x4c')](_0xb750b5[_0xae50('0x4a')],{'$or':_['map'](_0xb750b5['attributes'],function(_0x401ee3){var _0x3b7d73={};_0x3b7d73[_0x401ee3]={'$like':'%'+_0x5acd8c[_0xae50('0x42')][_0xae50('0x4b')]+'%'};return _0x3b7d73;})});}_0xb750b5=_[_0xae50('0x4c')]({},_0xb750b5,_0x5acd8c[_0xae50('0x4d')]);return _0x4e2c57[_0xae50('0xc5')](_0xb750b5);}})[_0xae50('0x21')](function(_0x32d716){if(_0x32d716){_0x44ce48=_0x32d716[_0xae50('0x56')];if(!_0x5acd8c[_0xae50('0x42')][_0xae50('0x47')](_0xae50('0x48'))){_0xb750b5['limit']=qs[_0xae50('0x30')](_0x5acd8c[_0xae50('0x42')][_0xae50('0x30')]);_0xb750b5[_0xae50('0x2f')]=qs[_0xae50('0x2f')](_0x5acd8c['query'][_0xae50('0x2f')]);}return _0x4e2c57['getAgents'](_0xb750b5);}})[_0xae50('0x21')](function(_0x93a469){if(_0x93a469){return _0x93a469?{'count':_0x44ce48,'rows':_0x93a469}:null;}})[_0xae50('0x21')](respondWithResult(_0x563552,null))[_0xae50('0x52')](handleError(_0x563552,null));}; \ No newline at end of file +var _0x9dc3=['client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','getDispositions','findOne','nolimit','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','fullname','internal','Tag','Tags','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','type','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','ListId','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x9dc3,0xa5));var _0x39dc=function(_0x4861a4,_0x15b586){_0x4861a4=_0x4861a4-0x0;var _0x3e4cb4=_0x9dc3[_0x4861a4];return _0x3e4cb4;};'use strict';var pdf=require(_0x39dc('0x0'));var emlformat=require(_0x39dc('0x1'));var rimraf=require(_0x39dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39dc('0x3'));var moment=require(_0x39dc('0x4'));var BPromise=require(_0x39dc('0x5'));var Mustache=require(_0x39dc('0x6'));var util=require(_0x39dc('0x7'));var path=require(_0x39dc('0x8'));var sox=require('sox');var csv=require(_0x39dc('0x9'));var ejs=require(_0x39dc('0xa'));var fs=require('fs');var _=require(_0x39dc('0xb'));var squel=require(_0x39dc('0xc'));var crypto=require(_0x39dc('0xd'));var jsforce=require(_0x39dc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39dc('0xf'));var Redis=require(_0x39dc('0x10'));var authService=require(_0x39dc('0x11'));var qs=require(_0x39dc('0x12'));var as=require(_0x39dc('0x13'));var hardwareService=require(_0x39dc('0x14'));var logger=require(_0x39dc('0x15'))(_0x39dc('0x16'));var utils=require('../../config/utils');var config=require(_0x39dc('0x17'));var licenseUtil=require(_0x39dc('0x18'));var db=require(_0x39dc('0x19'))['db'];config[_0x39dc('0x1a')]=_['defaults'](config[_0x39dc('0x1a')],{'host':_0x39dc('0x1b'),'port':0x18eb});var socket=require(_0x39dc('0x1c'))(new Redis(config['redis']));require(_0x39dc('0x1d'))[_0x39dc('0x1e')](socket);var jayson=require(_0x39dc('0x1f'));var client=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x39dc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x286350,_0x258601,_0xc60a99,_0xb6f64e){return new BPromise(function(_0x1ecb04,_0x14ede6){var _0x489b4d=_0xb6f64e||client;return _0x489b4d[_0x39dc('0x22')](_0x286350,_0xc60a99)[_0x39dc('0x23')](function(_0x5690a8){logger['info'](_0x39dc('0x24'),_0x258601,_0x39dc('0x25'));logger[_0x39dc('0x26')](_0x39dc('0x27'),_0x258601,'request\x20sent',JSON[_0x39dc('0x28')](_0x5690a8));if(_0x5690a8['error']){if(_0x5690a8['error'][_0x39dc('0x29')]===0x1f4){logger[_0x39dc('0x2a')](_0x39dc('0x24'),_0x258601,_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);return _0x14ede6(_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);}logger[_0x39dc('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x258601,_0x5690a8[_0x39dc('0x2a')]['message']);return _0x1ecb04(_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);}else{logger['info'](_0x39dc('0x24'),_0x258601,_0x39dc('0x25'));_0x1ecb04(_0x5690a8[_0x39dc('0x2c')][_0x39dc('0x2b')]);}})[_0x39dc('0x2d')](function(_0x421696){logger[_0x39dc('0x2a')](_0x39dc('0x24'),_0x258601,_0x421696);_0x14ede6(_0x421696);});});}function respondWithStatusCode(_0x59e351,_0x485e9f){_0x485e9f=_0x485e9f||0xcc;return function(_0x56fff2){if(_0x56fff2){return _0x59e351['sendStatus'](_0x485e9f);}return _0x59e351[_0x39dc('0x2e')](_0x485e9f)['end']();};}function respondWithResult(_0x4246c4,_0x1fb03b){_0x1fb03b=_0x1fb03b||0xc8;return function(_0x975413){if(_0x975413){return _0x4246c4[_0x39dc('0x2e')](_0x1fb03b)[_0x39dc('0x2f')](_0x975413);}};}function respondWithFilteredResult(_0x9ecec,_0x3d7c9c){return function(_0x880d29){if(_0x880d29){var _0x239eca=_0x880d29[_0x39dc('0x30')],_0x36405a=_0x3d7c9c['offset'],_0x4196d6=_0x3d7c9c[_0x39dc('0x31')]+_0x3d7c9c[_0x39dc('0x32')],_0x4eebe2;if(_0x4196d6>=_0x239eca){_0x4196d6=_0x239eca;_0x4eebe2=0xc8;}else{_0x4eebe2=0xce;}_0x9ecec[_0x39dc('0x2e')](_0x4eebe2);return _0x9ecec[_0x39dc('0x33')](_0x39dc('0x34'),_0x36405a+'-'+_0x4196d6+'/'+_0x239eca)[_0x39dc('0x2f')](_0x880d29);}return null;};}function patchUpdates(_0x5c8c04){return function(_0x24f1c6){try{jsonpatch[_0x39dc('0x35')](_0x24f1c6,_0x5c8c04,!![]);}catch(_0x346ebf){return BPromise[_0x39dc('0x36')](_0x346ebf);}return _0x24f1c6[_0x39dc('0x37')]();};}function saveUpdates(_0x1725e0,_0x2e8902){return function(_0x354483){if(_0x354483){return _0x354483[_0x39dc('0x38')](_0x1725e0)['then'](function(_0x3a190c){return _0x3a190c;});}return null;};}function removeEntity(_0x2eed35,_0x15493f){return function(_0x4f0aff){if(_0x4f0aff){return _0x4f0aff[_0x39dc('0x39')]()[_0x39dc('0x23')](function(){var _0x48d0e0=_0x4f0aff[_0x39dc('0x3a')]({'plain':!![]});var _0x3e193c=_0x39dc('0x3b');return db[_0x39dc('0x3c')][_0x39dc('0x39')]({'where':{'type':_0x3e193c,'resourceId':_0x48d0e0['id']}})['then'](function(){return _0x4f0aff;});})[_0x39dc('0x23')](function(){_0x2eed35['status'](0xcc)[_0x39dc('0x3d')]();});}};}function handleEntityNotFound(_0x19ff9f,_0x25ab4b){return function(_0x4ea552){if(!_0x4ea552){_0x19ff9f[_0x39dc('0x3e')](0x194);}return _0x4ea552;};}function handleError(_0x13adf3,_0x5a4614){_0x5a4614=_0x5a4614||0x1f4;return function(_0x3d5782){logger['error'](_0x3d5782[_0x39dc('0x3f')]);if(_0x3d5782[_0x39dc('0x40')]){delete _0x3d5782['name'];}_0x13adf3[_0x39dc('0x2e')](_0x5a4614)[_0x39dc('0x41')](_0x3d5782);};}exports[_0x39dc('0x42')]=function(_0x36e02c,_0x4cfe53){var _0x4b46f4={'include':[{'model':db['Pause'],'as':_0x39dc('0x43')}]},_0x2fa173={},_0xd2c966={'count':0x0,'rows':[]};var _0x570749=_['map'](db['FaxAccount'][_0x39dc('0x44')],function(_0x32d003){return{'name':_0x32d003[_0x39dc('0x45')],'type':_0x32d003['type'][_0x39dc('0x46')]};});_0x2fa173[_0x39dc('0x47')]=_[_0x39dc('0x48')](_0x570749,_0x39dc('0x40'));_0x2fa173[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x36e02c['query']);_0x2fa173['filters']=_[_0x39dc('0x4b')](_0x2fa173['model'],_0x2fa173['query']);_0x4b46f4['attributes']=_[_0x39dc('0x4b')](_0x2fa173[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x36e02c[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x4b46f4[_0x39dc('0x4d')]=_0x4b46f4[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x4b46f4[_0x39dc('0x4d')]:_0x2fa173[_0x39dc('0x47')];if(!_0x36e02c[_0x39dc('0x49')][_0x39dc('0x4f')]('nolimit')){_0x4b46f4[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x36e02c['query']['limit']);_0x4b46f4['offset']=qs[_0x39dc('0x31')](_0x36e02c['query']['offset']);}_0x4b46f4[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x36e02c[_0x39dc('0x49')]['sort']);_0x4b46f4[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x36e02c['query'],_0x2fa173[_0x39dc('0x53')]),_0x570749);if(_0x36e02c[_0x39dc('0x49')][_0x39dc('0x55')]){_0x4b46f4[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x4b46f4['where'],{'$or':_[_0x39dc('0x48')](_0x570749,function(_0x1d0e6f){if(_0x1d0e6f['type']!==_0x39dc('0x57')){var _0x31e53b={};_0x31e53b[_0x1d0e6f[_0x39dc('0x40')]]={'$like':'%'+_0x36e02c[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x31e53b;}})});}_0x4b46f4=_['merge']({},_0x4b46f4,_0x36e02c['options']);var _0x34ce33={'where':_0x4b46f4[_0x39dc('0x52')]};return db[_0x39dc('0x58')][_0x39dc('0x30')](_0x34ce33)[_0x39dc('0x23')](function(_0x5a711f){_0xd2c966['count']=_0x5a711f;if(_0x36e02c[_0x39dc('0x49')][_0x39dc('0x59')]){_0x4b46f4[_0x39dc('0x5a')]=[{'all':!![]}];}return db[_0x39dc('0x58')][_0x39dc('0x5b')](_0x4b46f4);})[_0x39dc('0x23')](function(_0x3801a8){_0xd2c966[_0x39dc('0x5c')]=_0x3801a8;return _0xd2c966;})['then'](respondWithFilteredResult(_0x4cfe53,_0x4b46f4))[_0x39dc('0x2d')](handleError(_0x4cfe53,null));};exports[_0x39dc('0x5d')]=function(_0x527820,_0x7ca27f){var _0x25bb0f={'raw':![],'where':{'id':_0x527820[_0x39dc('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x39dc('0x43')}]},_0x2738fd={};_0x2738fd['model']=_['keys'](db[_0x39dc('0x58')]['rawAttributes']);_0x2738fd['query']=_['keys'](_0x527820[_0x39dc('0x49')]);_0x2738fd[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x2738fd[_0x39dc('0x47')],_0x2738fd[_0x39dc('0x49')]);_0x25bb0f[_0x39dc('0x4d')]=_['intersection'](_0x2738fd[_0x39dc('0x47')],qs['fields'](_0x527820[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x25bb0f[_0x39dc('0x4d')]=_0x25bb0f[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x25bb0f[_0x39dc('0x4d')]:_0x2738fd['model'];if(_0x527820[_0x39dc('0x49')][_0x39dc('0x59')]){_0x25bb0f[_0x39dc('0x5a')]=[{'all':!![]}];}_0x25bb0f=_[_0x39dc('0x56')]({},_0x25bb0f,_0x527820[_0x39dc('0x5f')]);return db[_0x39dc('0x58')]['find'](_0x25bb0f)[_0x39dc('0x23')](handleEntityNotFound(_0x7ca27f,null))['then'](respondWithResult(_0x7ca27f,null))['catch'](handleError(_0x7ca27f,null));};exports[_0x39dc('0x60')]=function(_0x2d8bb8,_0x18134d){return db['FaxAccount'][_0x39dc('0x60')](_0x2d8bb8[_0x39dc('0x61')],{})[_0x39dc('0x23')](function(_0x40bfcb){var _0x567c7b=_0x2d8bb8[_0x39dc('0x62')][_0x39dc('0x3a')]({'plain':!![]});if(!_0x567c7b)throw new Error(_0x39dc('0x63'));if(_0x567c7b[_0x39dc('0x64')]===_0x39dc('0x62')){var _0x545795=_0x40bfcb[_0x39dc('0x3a')]({'plain':!![]});var _0x5c1f68=_0x39dc('0x3b');return db[_0x39dc('0x65')][_0x39dc('0x66')]({'where':{'name':_0x5c1f68,'userProfileId':_0x567c7b[_0x39dc('0x67')]},'raw':!![]})['then'](function(_0x50385f){if(_0x50385f&&_0x50385f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x545795['name'],'resourceId':_0x545795['id'],'type':_0x50385f['name'],'sectionId':_0x50385f['id']},{})['then'](function(){return _0x40bfcb;});}else{return _0x40bfcb;}})['catch'](function(_0x254299){logger['error'](_0x39dc('0x68'),_0x254299);throw _0x254299;});}return _0x40bfcb;})[_0x39dc('0x23')](respondWithResult(_0x18134d,0xc9))[_0x39dc('0x2d')](handleError(_0x18134d,null));};exports['update']=function(_0x7c3c9d,_0x4f3167){if(_0x7c3c9d[_0x39dc('0x61')]['id']){delete _0x7c3c9d['body']['id'];}return db[_0x39dc('0x58')]['find']({'where':{'id':_0x7c3c9d['params']['id']},'include':[{'model':db[_0x39dc('0x69')],'as':_0x39dc('0x43')}]})[_0x39dc('0x23')](handleEntityNotFound(_0x4f3167,null))['then'](saveUpdates(_0x7c3c9d[_0x39dc('0x61')],null))['then'](respondWithResult(_0x4f3167,null))[_0x39dc('0x2d')](handleError(_0x4f3167,null));};exports[_0x39dc('0x39')]=function(_0x447f10,_0x223f59){return db['FaxAccount'][_0x39dc('0x66')]({'where':{'id':_0x447f10[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x223f59,null))[_0x39dc('0x23')](removeEntity(_0x223f59,null))[_0x39dc('0x2d')](handleError(_0x223f59,null));};exports['describe']=function(_0x1e6799,_0x47251f){return db[_0x39dc('0x58')][_0x39dc('0x6a')]()['then'](respondWithResult(_0x47251f,null))[_0x39dc('0x2d')](handleError(_0x47251f,null));};exports[_0x39dc('0x6b')]=function(_0x1bc85e,_0x3f79a4,_0x3da62d){if(_0x1bc85e[_0x39dc('0x61')]['id']){delete _0x1bc85e[_0x39dc('0x61')]['id'];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x1bc85e[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x3f79a4,null))[_0x39dc('0x23')](function(_0x5194d2){if(_0x5194d2){_0x1bc85e[_0x39dc('0x61')][_0x39dc('0x6c')]=_0x5194d2['id'];return db['Disposition'][_0x39dc('0x60')](_0x1bc85e[_0x39dc('0x61')]);}})[_0x39dc('0x23')](respondWithResult(_0x3f79a4,null))[_0x39dc('0x2d')](handleError(_0x3f79a4,null));};exports[_0x39dc('0x6d')]=function(_0x3656db,_0x5c6d7d,_0x1f22b0){var _0x4a430f={'raw':![],'where':{}};var _0x23c2ee={};var _0x1d75e3={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x3656db['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x5c6d7d,null))['then'](function(_0x46c08d){if(_0x46c08d){_0x23c2ee[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db['Disposition']['rawAttributes']);_0x23c2ee[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x3656db[_0x39dc('0x49')]);_0x23c2ee[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x23c2ee[_0x39dc('0x47')],_0x23c2ee[_0x39dc('0x49')]);_0x4a430f[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x23c2ee['model'],qs['fields'](_0x3656db[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x4a430f[_0x39dc('0x4d')]=_0x4a430f['attributes']['length']?_0x4a430f['attributes']:_0x23c2ee[_0x39dc('0x47')];if(!_0x3656db[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x4a430f[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x3656db['query'][_0x39dc('0x32')]);_0x4a430f[_0x39dc('0x31')]=qs['offset'](_0x3656db[_0x39dc('0x49')][_0x39dc('0x31')]);}_0x4a430f[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x3656db[_0x39dc('0x49')][_0x39dc('0x51')]);_0x4a430f[_0x39dc('0x52')]=qs['filters'](_[_0x39dc('0x54')](_0x3656db[_0x39dc('0x49')],_0x23c2ee[_0x39dc('0x53')]));_0x4a430f['where'][_0x39dc('0x6c')]=_0x46c08d['id'];if(_0x3656db[_0x39dc('0x49')][_0x39dc('0x55')]){_0x4a430f[_0x39dc('0x52')]=_['merge'](_0x4a430f[_0x39dc('0x52')],{'$or':_['map'](_0x4a430f[_0x39dc('0x4d')],function(_0x18d0cf){var _0x81e46b={};_0x81e46b[_0x18d0cf]={'$like':'%'+_0x3656db[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x81e46b;})});}_0x4a430f=_['merge']({},_0x4a430f,_0x3656db[_0x39dc('0x5f')]);return db[_0x39dc('0x70')][_0x39dc('0x30')]({'where':_0x4a430f[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x4ac2a5){_0x1d75e3['count']=_0x4ac2a5;if(_0x3656db[_0x39dc('0x49')][_0x39dc('0x59')]){_0x4a430f[_0x39dc('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x39dc('0x5b')](_0x4a430f);})[_0x39dc('0x23')](function(_0x26842e){_0x1d75e3[_0x39dc('0x5c')]=_0x26842e;return _0x1d75e3;});}})['then'](respondWithFilteredResult(_0x5c6d7d,_0x4a430f))['catch'](handleError(_0x5c6d7d,null));};exports[_0x39dc('0x71')]=function(_0x54b384,_0x4ae05e,_0xe6ad5a){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x54b384[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x4ae05e,null))[_0x39dc('0x23')](function(_0x1823e2){if(_0x1823e2){return _0x1823e2[_0x39dc('0x71')](_0x54b384[_0x39dc('0x49')][_0x39dc('0x72')]);}})[_0x39dc('0x23')](respondWithStatusCode(_0x4ae05e,null))['catch'](handleError(_0x4ae05e,null));};exports[_0x39dc('0x73')]=function(_0x3c2d93,_0x497973,_0x36d09e){if(_0x3c2d93['body']['id']){delete _0x3c2d93[_0x39dc('0x61')]['id'];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x3c2d93[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x497973,null))[_0x39dc('0x23')](function(_0x5c1f41){if(_0x5c1f41){_0x3c2d93['body'][_0x39dc('0x6c')]=_0x5c1f41['id'];return db['CannedAnswer'][_0x39dc('0x60')](_0x3c2d93[_0x39dc('0x61')]);}})[_0x39dc('0x23')](respondWithResult(_0x497973,null))[_0x39dc('0x2d')](handleError(_0x497973,null));};exports['getAnswers']=function(_0x3c92d6,_0x3f5b4d,_0x351d6f){var _0x8f2be3={'raw':![],'where':{}};var _0x4d0bad={};var _0x56ca4d={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x3c92d6[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x3f5b4d,null))[_0x39dc('0x23')](function(_0xda6e2c){if(_0xda6e2c){_0x4d0bad[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db[_0x39dc('0x74')][_0x39dc('0x44')]);_0x4d0bad[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x3c92d6[_0x39dc('0x49')]);_0x4d0bad[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x4d0bad[_0x39dc('0x47')],_0x4d0bad[_0x39dc('0x49')]);_0x8f2be3['attributes']=_[_0x39dc('0x4b')](_0x4d0bad[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x3c92d6['query']['fields']));_0x8f2be3['attributes']=_0x8f2be3[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x8f2be3[_0x39dc('0x4d')]:_0x4d0bad[_0x39dc('0x47')];if(!_0x3c92d6[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x8f2be3[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x3c92d6['query'][_0x39dc('0x32')]);_0x8f2be3[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x3c92d6[_0x39dc('0x49')]['offset']);}_0x8f2be3[_0x39dc('0x50')]=qs['sort'](_0x3c92d6[_0x39dc('0x49')]['sort']);_0x8f2be3[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_['pick'](_0x3c92d6['query'],_0x4d0bad[_0x39dc('0x53')]));_0x8f2be3['where'][_0x39dc('0x6c')]=_0xda6e2c['id'];if(_0x3c92d6[_0x39dc('0x49')][_0x39dc('0x55')]){_0x8f2be3['where']=_['merge'](_0x8f2be3['where'],{'$or':_['map'](_0x8f2be3['attributes'],function(_0x5324c7){var _0x3f00a8={};_0x3f00a8[_0x5324c7]={'$like':'%'+_0x3c92d6['query']['filter']+'%'};return _0x3f00a8;})});}_0x8f2be3=_[_0x39dc('0x56')]({},_0x8f2be3,_0x3c92d6[_0x39dc('0x5f')]);return db[_0x39dc('0x74')]['count']({'where':_0x8f2be3[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x2cbe5a){_0x56ca4d[_0x39dc('0x30')]=_0x2cbe5a;if(_0x3c92d6['query'][_0x39dc('0x59')]){_0x8f2be3['include']=[{'all':!![]}];}return db[_0x39dc('0x74')]['findAll'](_0x8f2be3);})[_0x39dc('0x23')](function(_0x1d652b){_0x56ca4d[_0x39dc('0x5c')]=_0x1d652b;return _0x56ca4d;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x3f5b4d,_0x8f2be3))[_0x39dc('0x2d')](handleError(_0x3f5b4d,null));};exports[_0x39dc('0x75')]=function(_0x495749,_0x7d036a,_0x48eda8){return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x495749[_0x39dc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x7d036a,null))['then'](function(_0x3c3ad3){if(_0x3c3ad3){return _0x3c3ad3[_0x39dc('0x75')](_0x495749[_0x39dc('0x49')][_0x39dc('0x72')]);}})[_0x39dc('0x23')](respondWithStatusCode(_0x7d036a,null))[_0x39dc('0x2d')](handleError(_0x7d036a,null));};exports[_0x39dc('0x76')]=function(_0x498ad8,_0x484b16,_0x3a6d8f){return db['FaxInteraction'][_0x39dc('0x66')]({'where':{'id':_0x498ad8['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x484b16,null))[_0x39dc('0x23')](function(_0x5d0fb1){if(_0x5d0fb1){return _0x5d0fb1['addInteraction'](_0x498ad8[_0x39dc('0x61')][_0x39dc('0x72')],_[_0x39dc('0x77')](_0x498ad8[_0x39dc('0x61')],[_0x39dc('0x72'),'id'])||{});}})[_0x39dc('0x23')](respondWithResult(_0x484b16,null))['catch'](handleError(_0x484b16,null));};exports[_0x39dc('0x78')]=function(_0xda06c3,_0x38171f,_0x299067){var _0x5b14df={'raw':![],'where':{}};var _0x1b56f6={};var _0x2d1776={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0xda06c3['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x38171f,null))[_0x39dc('0x23')](function(_0x5a059b){if(_0x5a059b){_0x1b56f6['model']=_[_0x39dc('0x4a')](db[_0x39dc('0x79')][_0x39dc('0x44')]);_0x1b56f6['query']=_[_0x39dc('0x4a')](_0xda06c3[_0x39dc('0x49')]);_0x1b56f6['filters']=_[_0x39dc('0x4b')](_0x1b56f6['model'],_0x1b56f6['query']);_0x5b14df[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x1b56f6[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0xda06c3[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x5b14df[_0x39dc('0x4d')]=_0x5b14df[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x5b14df[_0x39dc('0x4d')]:_0x1b56f6[_0x39dc('0x47')];if(!_0xda06c3[_0x39dc('0x49')][_0x39dc('0x4f')]('nolimit')){_0x5b14df[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0xda06c3['query'][_0x39dc('0x32')]);_0x5b14df[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0xda06c3['query']['offset']);}_0x5b14df[_0x39dc('0x50')]=qs['sort'](_0xda06c3[_0x39dc('0x49')]['sort']);_0x5b14df[_0x39dc('0x52')]=qs['filters'](_[_0x39dc('0x54')](_0xda06c3[_0x39dc('0x49')],_0x1b56f6[_0x39dc('0x53')]));_0x5b14df[_0x39dc('0x52')][_0x39dc('0x6c')]=_0x5a059b['id'];if(_0xda06c3[_0x39dc('0x49')][_0x39dc('0x55')]){_0x5b14df[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x5b14df['where'],{'$or':_[_0x39dc('0x48')](_0x5b14df[_0x39dc('0x4d')],function(_0x335321){var _0x45c67b={};_0x45c67b[_0x335321]={'$like':'%'+_0xda06c3[_0x39dc('0x49')]['filter']+'%'};return _0x45c67b;})});}_0x5b14df=_[_0x39dc('0x56')]({},_0x5b14df,_0xda06c3[_0x39dc('0x5f')]);return db[_0x39dc('0x79')]['count']({'where':_0x5b14df[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x88e949){_0x2d1776['count']=_0x88e949;if(_0xda06c3[_0x39dc('0x49')]['includeAll']){_0x5b14df[_0x39dc('0x5a')]=[{'model':db[_0x39dc('0x7a')],'as':'Contact','required':![]},{'model':db[_0x39dc('0x7b')],'as':'Owner','attributes':[_0x39dc('0x40'),_0x39dc('0x7c'),_0x39dc('0x7d')],'required':![]},{'model':db[_0x39dc('0x7e')],'as':_0x39dc('0x7f'),'attributes':['id',_0x39dc('0x40'),'color'],'where':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]?{'id':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]}:undefined,'required':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]?!![]:![]}];}return db[_0x39dc('0x79')]['findAll'](_0x5b14df);})['then'](function(_0x437284){_0x2d1776[_0x39dc('0x5c')]=_0x437284;return _0x2d1776;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x38171f,_0x5b14df))[_0x39dc('0x2d')](handleError(_0x38171f,null));};exports['addApplications']=function(_0x50d8e2,_0x160893,_0x23ace8){return db[_0x39dc('0x58')]['findOne']({'where':{'id':_0x50d8e2[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x160893,null))[_0x39dc('0x23')](function(_0x1926b8){if(_0x1926b8){return db[_0x39dc('0x81')][_0x39dc('0x82')](function(_0x11182f){return db[_0x39dc('0x83')][_0x39dc('0x39')]({'where':{'FaxAccountId':_0x50d8e2[_0x39dc('0x5e')]['id']},'transaction':_0x11182f})[_0x39dc('0x23')](function(_0x32e851){var _0x9880bf=_['map'](_0x50d8e2[_0x39dc('0x61')],function(_0x550dc8){_0x550dc8['FaxAccountId']=_0x50d8e2['params']['id'];return _0x550dc8;});return db['FaxApplication'][_0x39dc('0x84')](_0x9880bf,{'transaction':_0x11182f});});})['then'](function(){return db[_0x39dc('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x50d8e2[_0x39dc('0x5e')]['id']},'order':_0x39dc('0x85')});});}})[_0x39dc('0x23')](respondWithResult(_0x160893,null))[_0x39dc('0x2d')](handleError(_0x160893,null));};exports['getApplications']=function(_0x1a9d79,_0x9912b3,_0x1c95ad){var _0x265a8e={};var _0x107873={};var _0x56cb93;var _0x29eadd;return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x1a9d79[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x9912b3,null))[_0x39dc('0x23')](function(_0x1689ff){if(_0x1689ff){_0x56cb93=_0x1689ff;_0x107873[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db['FaxApplication'][_0x39dc('0x44')]);_0x107873[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x1a9d79[_0x39dc('0x49')]);_0x107873[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x107873[_0x39dc('0x47')],_0x107873['query']);_0x265a8e[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x107873[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x1a9d79['query'][_0x39dc('0x4c')]));_0x265a8e[_0x39dc('0x4d')]=_0x265a8e[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x265a8e[_0x39dc('0x4d')]:_0x107873['model'];_0x265a8e[_0x39dc('0x50')]=qs['sort'](_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x51')]);_0x265a8e[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x1a9d79[_0x39dc('0x49')],_0x107873['filters']));if(_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x55')]){_0x265a8e['where']=_[_0x39dc('0x56')](_0x265a8e['where'],{'$or':_[_0x39dc('0x48')](_0x265a8e[_0x39dc('0x4d')],function(_0x27faa9){var _0x2a8eae={};_0x2a8eae[_0x27faa9]={'$like':'%'+_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x2a8eae;})});}_0x265a8e=_[_0x39dc('0x56')]({},_0x265a8e,_0x1a9d79[_0x39dc('0x5f')]);return _0x56cb93[_0x39dc('0x86')](_0x265a8e);}})['then'](function(_0x5534cf){if(_0x5534cf){_0x29eadd=_0x5534cf['length'];if(!_0x1a9d79[_0x39dc('0x49')]['hasOwnProperty'](_0x39dc('0x6f'))){_0x265a8e[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x32')]);_0x265a8e[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x1a9d79[_0x39dc('0x49')]['offset']);}return _0x56cb93['getApplications'](_0x265a8e);}})['then'](function(_0x527bd0){if(_0x527bd0){return _0x527bd0?{'count':_0x29eadd,'rows':_0x527bd0}:null;}})[_0x39dc('0x23')](respondWithResult(_0x9912b3,null))[_0x39dc('0x2d')](handleError(_0x9912b3,null));};function Extension(_0x3fa454,_0x280be2,_0x553123,_0x1a4075){this[_0x39dc('0x87')]=_0x39dc('0x88');this['exten']=_0x3fa454[_0x39dc('0x89')];this['app']=_0x1a4075;this[_0x39dc('0x8a')]='system';this[_0x39dc('0x8b')]=_0x39dc('0x8c');this[_0x39dc('0x6c')]=_0x3fa454['id'];this['priority']=_0x280be2;this[_0x39dc('0x8d')]=_0x553123;}function createExtensionsReciveFax(_0x13ecd1){var _0x1e5d0e=0x1;var _0x3c6b74=[];_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,'',_0x39dc('0x8f')));_0x1e5d0e+=0x1;_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x90'),_0x39dc('0x91')));_0x1e5d0e+=0x1;for(var _0x1c069e in _0x13ecd1){if(_0x13ecd1[_0x39dc('0x4f')](_0x1c069e)&&(_0x1c069e===_0x39dc('0x92')||_0x1c069e===_0x39dc('0x89')||_0x1c069e===_0x39dc('0x93')||_0x1c069e===_0x39dc('0x94')||_0x1c069e===_0x39dc('0x95')||_0x1c069e==='maxrate'||_0x1c069e===_0x39dc('0x96')||_0x1c069e===_0x39dc('0x97')||_0x1c069e===_0x39dc('0x98'))){_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x99')+_0x1c069e+')='+_0x13ecd1[_0x1c069e],_0x39dc('0x91')));_0x1e5d0e+=0x1;}}_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,'6',_0x39dc('0x9a')));_0x1e5d0e+=0x1;_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x9b'),_0x39dc('0x9c')));_0x1e5d0e=0x0;return _0x3c6b74;}exports['addAccountApplications']=function(_0x16f23d,_0x4d4255,_0xb70030){var _0x3bd83c;return db[_0x39dc('0x81')][_0x39dc('0x82')](function(_0x59affa){return db['FaxAccount'][_0x39dc('0x60')](_0x16f23d['body'],{'transaction':_0x59affa})[_0x39dc('0x23')](function(_0x5e00b6){_0x3bd83c=_0x5e00b6['get']({'plain':!![]});return db['VoiceExtension'][_0x39dc('0x84')](createExtensionsReciveFax(_0x3bd83c),{'transaction':_0x59affa});});})[_0x39dc('0x23')](function(){return _0x3bd83c;})[_0x39dc('0x23')](respondWithResult(_0x4d4255,null))[_0x39dc('0x2d')](handleError(_0x4d4255,null));};exports[_0x39dc('0x9d')]=function(_0x4fda46,_0x3e11ab,_0x47fd3a){var _0x431b88;return db[_0x39dc('0x81')]['transaction'](function(_0x3f7987){return db[_0x39dc('0x58')][_0x39dc('0x38')](_0x4fda46['body'],{'where':{'id':_0x4fda46[_0x39dc('0x61')]['id']},'transaction':_0x3f7987})[_0x39dc('0x23')](function(_0x1a699b){return db[_0x39dc('0x9e')][_0x39dc('0x39')]({'where':{'FaxAccountId':_0x4fda46[_0x39dc('0x61')]['id']},'transaction':_0x3f7987})[_0x39dc('0x23')](function(_0x124b12){return db[_0x39dc('0x9e')][_0x39dc('0x84')](createExtensionsReciveFax(_[_0x39dc('0x77')](_0x4fda46[_0x39dc('0x61')],[_0x39dc('0x9f'),_0x39dc('0x46'),_0x39dc('0xa0'),_0x39dc('0xa1'),_0x39dc('0xa2'),'ListId'])),{'transaction':_0x3f7987});});});})[_0x39dc('0x23')](function(){return db[_0x39dc('0x58')]['findById'](_0x4fda46[_0x39dc('0x61')]['id']);})[_0x39dc('0x23')](respondWithResult(_0x3e11ab,null))[_0x39dc('0x2d')](handleError(_0x3e11ab,null));};exports[_0x39dc('0xa3')]=function(_0x10e061,_0x3c2984,_0x2f4b5b){var _0x875611={'raw':!![],'where':{}};var _0x145784={};var _0xbb0c3={'count':0x0,'rows':[]};return db[_0x39dc('0x58')]['findOne']({'where':{'id':_0x10e061[_0x39dc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3c2984,null))[_0x39dc('0x23')](function(_0x34c032){if(_0x34c032){_0x145784['model']=_['keys'](db[_0x39dc('0xa4')]['rawAttributes']);_0x145784[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x10e061['query']);_0x145784[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x145784[_0x39dc('0x47')],_0x145784[_0x39dc('0x49')]);_0x875611[_0x39dc('0x4d')]=_['intersection'](_0x145784[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x10e061['query'][_0x39dc('0x4c')]));_0x875611[_0x39dc('0x4d')]=_0x875611['attributes']['length']?_0x875611[_0x39dc('0x4d')]:_0x145784[_0x39dc('0x47')];if(!_0x10e061[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x875611[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x10e061[_0x39dc('0x49')][_0x39dc('0x32')]);_0x875611['offset']=qs['offset'](_0x10e061[_0x39dc('0x49')][_0x39dc('0x31')]);}_0x875611['order']=qs[_0x39dc('0x51')](_0x10e061['query'][_0x39dc('0x51')]);_0x875611[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x10e061[_0x39dc('0x49')],_0x145784[_0x39dc('0x53')]));_0x875611[_0x39dc('0x52')]['FaxAccountId']=_0x34c032['id'];if(_0x10e061[_0x39dc('0x49')][_0x39dc('0x55')]){_0x875611[_0x39dc('0x52')]=_['merge'](_0x875611[_0x39dc('0x52')],{'$or':_[_0x39dc('0x48')](_0x875611[_0x39dc('0x4d')],function(_0x3b2be9){var _0x23f5e2={};_0x23f5e2[_0x3b2be9]={'$like':'%'+_0x10e061[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x23f5e2;})});}if(_0x10e061[_0x39dc('0x49')]['$gte']){var _0x3b2453=_0x10e061[_0x39dc('0x49')][_0x39dc('0xa5')][_0x39dc('0xa6')](',');var _0x4671a1={};_0x4671a1[_0x3b2453[0x0]]={'$gte':moment(_0x3b2453[0x1])[_0x39dc('0xa7')](_0x39dc('0xa8'))};_0x875611[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x875611['where'],_0x4671a1);}_0x875611=_[_0x39dc('0x56')]({},_0x875611,_0x10e061[_0x39dc('0x5f')]);return db['FaxMessage'][_0x39dc('0x30')]({'where':_0x875611[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x7ef9e8){_0xbb0c3[_0x39dc('0x30')]=_0x7ef9e8;if(_0x10e061['query'][_0x39dc('0x59')]){_0x875611[_0x39dc('0x5a')]=[{'all':!![]}];}return db[_0x39dc('0xa4')][_0x39dc('0x5b')](_0x875611);})[_0x39dc('0x23')](function(_0x2294cd){_0xbb0c3['rows']=_0x2294cd;return _0xbb0c3;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x3c2984,_0x875611))[_0x39dc('0x2d')](handleError(_0x3c2984,null));};exports['send']=function(_0x264bf7,_0x3af4f2,_0x262abc){var _0x5beb08,_0x5900e3={},_0x3dc7f8;if(_0x264bf7[_0x39dc('0x61')]['to']){_0x3dc7f8=_0x264bf7[_0x39dc('0x61')]['to'][0x0];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x264bf7[_0x39dc('0x5e')]['id']},'include':[{'model':db[_0x39dc('0xa9')],'as':_0x39dc('0xaa'),'include':[{'model':db[_0x39dc('0x7a')],'as':_0x39dc('0xab'),'where':{'fax':_0x3dc7f8},'limit':0x1,'order':[[_0x39dc('0xa1'),_0x39dc('0xac')]]}]}]})[_0x39dc('0x23')](handleEntityNotFound(_0x3af4f2,null))['then'](function(_0x42fab9){_0x5beb08=_0x42fab9;if(_0x264bf7['body'][_0x39dc('0xad')]&&_0x264bf7['body'][_0x39dc('0xad')][_0x39dc('0x4e')]){for(var _0x4ebd07=0x0;_0x4ebd07<_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x39dc('0x4e')];_0x4ebd07+=0x1){_0x264bf7['body']['attachments'][_0x4ebd07]={'filename':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x4ebd07][_0x39dc('0x40')],'id':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x4ebd07]['id'],'path':path['join'](config['root'],_0x39dc('0xae'),_0x264bf7[_0x39dc('0x61')]['attachments'][_0x4ebd07]['basename'])};}}return respondWithRpcPromise(_0x39dc('0xaf'),_0x39dc('0xaf'),{'FaxAccountId':_[_0x39dc('0xb0')](_0x264bf7['params']['id'])?undefined:_0x264bf7['params']['id'],'path':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['path'])?undefined:_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')],'fax':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')]['to'][0x0])?undefined:_0x264bf7[_0x39dc('0x61')]['to'][0x0]},client9002);})[_0x39dc('0x23')](function(){if(_0x5beb08){if(_['isNil'](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xb1')])){_0x264bf7[_0x39dc('0x61')][_0x39dc('0xb1')]=util[_0x39dc('0xa7')](_0x39dc('0xb2'),_0x5beb08[_0x39dc('0x40')],_0x5beb08['fax']);}if(_0x5beb08[_0x39dc('0xaa')]){if(_0x5beb08[_0x39dc('0xaa')][_0x39dc('0xab')]['length']){return _0x5beb08[_0x39dc('0xaa')][_0x39dc('0xab')][0x0];}else{return db[_0x39dc('0x7a')][_0x39dc('0x60')](_[_0x39dc('0xb3')](_0x264bf7[_0x39dc('0x61')],{'firstName':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'phone':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'fax':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'ListId':_0x5beb08[_0x39dc('0xb4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x189030){if(_0x189030){return db[_0x39dc('0x79')][_0x39dc('0x66')]({'where':{'ContactId':_0x189030['id'],'closed':![],'FaxAccountId':_0x5beb08['id']}})[_0x39dc('0x23')](function(_0x43fa0d){if(_0x43fa0d){return[_0x43fa0d,![]];}return db[_0x39dc('0x79')]['create']({'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x189030['id'],'FaxAccountId':_0x5beb08['id'],'fax':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'firstMsgDirection':_0x39dc('0xb5'),'Messages':[_[_0x39dc('0x56')](_0x264bf7['body'],{'read':![],'body':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0xb6')],'FaxAccountId':_0x5beb08['id'],'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x189030['id'],'AttachmentId':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x39dc('0xb7')}]})[_0x39dc('0x23')](function(_0x1b45d3){return[_0x1b45d3,!![]];});});}else{throw new Error(_0x39dc('0xb8'));}})[_0x39dc('0xb9')](function(_0x3639b7,_0x755350){if(_0x755350){return _0x3639b7;}return db[_0x39dc('0xa4')]['create']({'direction':_0x39dc('0xb5'),'read':![],'body':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0xb6')],'FaxAccountId':_0x5beb08['id'],'FaxInteractionId':_0x3639b7['id'],'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x3639b7[_0x39dc('0xba')],'AttachmentId':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['id']})[_0x39dc('0x23')](function(_0x4825e5){_0x3639b7[_0x39dc('0xbb')][_0x39dc('0xb7')]=[];_0x3639b7['dataValues'][_0x39dc('0xb7')][_0x39dc('0x8e')](_0x4825e5[_0x39dc('0xbb')]);return _0x3639b7;});})[_0x39dc('0x23')](function(_0x46f42b){respondWithRpcPromise('SendFax',_0x39dc('0xbc'),{'FaxAccountId':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x5e')]['id'])?undefined:_0x264bf7[_0x39dc('0x5e')]['id'],'path':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')])?undefined:_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')],'fax':_['isNil'](_0x264bf7[_0x39dc('0x61')]['to'][0x0])?undefined:_0x264bf7[_0x39dc('0x61')]['to'][0x0],'AttachmentId':_0x264bf7[_0x39dc('0x61')]['attachments'][0x0]['id']},client9002)[_0x39dc('0x23')](function(_0x1e8dcd){logger[_0x39dc('0xbd')](_0x39dc('0xbe'),_0x1e8dcd);})['catch'](function(_0x485d90){logger[_0x39dc('0xbd')](_0x39dc('0xbe'),_0x485d90);});return _0x46f42b;})[_0x39dc('0x23')](respondWithResult(_0x3af4f2,null))['catch'](handleError(_0x3af4f2,null));};exports['addAgents']=function(_0x571a94,_0x55a78b,_0x55625a){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x571a94[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x55a78b,null))['then'](function(_0x1d4d32){if(_0x1d4d32){return _0x1d4d32['addAgents'](_0x571a94[_0x39dc('0x61')][_0x39dc('0x72')],_['omit'](_0x571a94[_0x39dc('0x61')],['ids','id'])||{})[_0x39dc('0xb9')](function(_0x137010){for(var _0x5c7ceb=0x0;_0x5c7ceb<_0x571a94[_0x39dc('0x61')][_0x39dc('0x72')]['length'];_0x5c7ceb+=0x1){socket[_0x39dc('0xbf')](_0x39dc('0xc0'),{'UserId':_0x571a94[_0x39dc('0x61')]['ids'][_0x5c7ceb],'FaxAccountId':_0x571a94['params']['id']});}return _0x137010;});}})[_0x39dc('0x23')](respondWithResult(_0x55a78b,null))[_0x39dc('0x2d')](handleError(_0x55a78b,null));};exports[_0x39dc('0xc1')]=function(_0x157152,_0xb5febf,_0x5b6556){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x157152['params']['id']}})['then'](handleEntityNotFound(_0xb5febf,null))[_0x39dc('0x23')](function(_0x13660a){if(_0x13660a){return _0x13660a[_0x39dc('0xc1')](_0x157152[_0x39dc('0x49')][_0x39dc('0x72')])['then'](function(){if(_[_0x39dc('0xc2')](_0x157152['query'][_0x39dc('0x72')])){for(var _0x43bdb4=0x0;_0x43bdb4<_0x157152[_0x39dc('0x49')][_0x39dc('0x72')][_0x39dc('0x4e')];_0x43bdb4+=0x1){socket[_0x39dc('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x157152[_0x39dc('0x49')][_0x39dc('0x72')][_0x43bdb4]),'FaxAccountId':Number(_0x157152[_0x39dc('0x5e')]['id'])});}}else{socket[_0x39dc('0xbf')](_0x39dc('0xc3'),{'UserId':Number(_0x157152[_0x39dc('0x49')][_0x39dc('0x72')]),'FaxAccountId':Number(_0x157152['params']['id'])});}});}})[_0x39dc('0x23')](respondWithStatusCode(_0xb5febf,null))[_0x39dc('0x2d')](handleError(_0xb5febf,null));};exports[_0x39dc('0xc4')]=function(_0x5e77f2,_0x1ce56a,_0x497252){var _0x5d8ed7={};var _0x169205={};var _0xd9bac2;var _0x3517e9;return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x5e77f2[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x1ce56a,null))[_0x39dc('0x23')](function(_0x524a0c){if(_0x524a0c){_0xd9bac2=_0x524a0c;_0x169205[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db[_0x39dc('0x7b')][_0x39dc('0x44')]);_0x169205['query']=_[_0x39dc('0x4a')](_0x5e77f2[_0x39dc('0x49')]);_0x169205[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x169205[_0x39dc('0x47')],_0x169205[_0x39dc('0x49')]);_0x5d8ed7['attributes']=_['intersection'](_0x169205[_0x39dc('0x47')],qs['fields'](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x5d8ed7[_0x39dc('0x4d')]=_0x5d8ed7[_0x39dc('0x4d')]['length']?_0x5d8ed7[_0x39dc('0x4d')]:_0x169205[_0x39dc('0x47')];_0x5d8ed7[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x51')]);_0x5d8ed7['where']=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x5e77f2[_0x39dc('0x49')],_0x169205[_0x39dc('0x53')]));if(_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x55')]){_0x5d8ed7[_0x39dc('0x52')]=_['merge'](_0x5d8ed7[_0x39dc('0x52')],{'$or':_[_0x39dc('0x48')](_0x5d8ed7[_0x39dc('0x4d')],function(_0x3e8a24){var _0x3322b3={};_0x3322b3[_0x3e8a24]={'$like':'%'+_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x3322b3;})});}_0x5d8ed7=_['merge']({},_0x5d8ed7,_0x5e77f2['options']);return _0xd9bac2[_0x39dc('0xc4')](_0x5d8ed7);}})[_0x39dc('0x23')](function(_0x1e2162){if(_0x1e2162){_0x3517e9=_0x1e2162[_0x39dc('0x4e')];if(!_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x5d8ed7[_0x39dc('0x32')]=qs['limit'](_0x5e77f2['query'][_0x39dc('0x32')]);_0x5d8ed7[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x31')]);}return _0xd9bac2[_0x39dc('0xc4')](_0x5d8ed7);}})[_0x39dc('0x23')](function(_0x47f784){if(_0x47f784){return _0x47f784?{'count':_0x3517e9,'rows':_0x47f784}:null;}})[_0x39dc('0x23')](respondWithResult(_0x1ce56a,null))[_0x39dc('0x2d')](handleError(_0x1ce56a,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4fb82e3..96c1cc9 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 _0x9da5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','FaxAccount'];(function(_0x391efe,_0x580daa){var _0x49f226=function(_0x5bec8f){while(--_0x5bec8f){_0x391efe['push'](_0x391efe['shift']());}};_0x49f226(++_0x580daa);}(_0x9da5,0x1de));var _0x59da=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x9da5[_0x1defb2];return _0xad8973;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x59da('0x0'))['db'][_0x59da('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x59da('0x2')](0x0);var events={'afterCreate':_0x59da('0x3'),'afterUpdate':_0x59da('0x4'),'afterDestroy':_0x59da('0x5')};function emitEvent(_0x1236f2){return function(_0x13dced,_0x199306,_0x3c774a){FaxAccountEvents['emit'](_0x1236f2+':'+_0x13dced['id'],_0x13dced);FaxAccountEvents[_0x59da('0x6')](_0x1236f2,_0x13dced);_0x3c774a(null);};}for(var e in events){if(events[_0x59da('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x339a=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x256347,_0x2acc02){var _0x39d71e=function(_0xb9f42c){while(--_0xb9f42c){_0x256347['push'](_0x256347['shift']());}};_0x39d71e(++_0x2acc02);}(_0x339a,0x151));var _0xa339=function(_0x42d5b6,_0xd75104){_0x42d5b6=_0x42d5b6-0x0;var _0x226b34=_0x339a[_0x42d5b6];return _0x226b34;};'use strict';var EventEmitter=require(_0xa339('0x0'));var FaxAccount=require(_0xa339('0x1'))['db'][_0xa339('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa339('0x3')](0x0);var events={'afterCreate':_0xa339('0x4'),'afterUpdate':_0xa339('0x5'),'afterDestroy':_0xa339('0x6')};function emitEvent(_0x44604a){return function(_0x2ed1c3,_0xe91e50,_0x4071ea){FaxAccountEvents[_0xa339('0x7')](_0x44604a+':'+_0x2ed1c3['id'],_0x2ed1c3);FaxAccountEvents['emit'](_0x44604a,_0x2ed1c3);_0x4071ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa339('0x8')](e,emitEvent(event));}}module[_0xa339('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 857f6bc..f21ed4a 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 _0x3cb2=['request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3cb2,0xf6));var _0x23cb=function(_0x577fa5,_0x1989b4){_0x577fa5=_0x577fa5-0x0;var _0x3c36be=_0x3cb2[_0x577fa5];return _0x3c36be;};'use strict';var _=require(_0x23cb('0x0'));var util=require('util');var logger=require(_0x23cb('0x1'))(_0x23cb('0x2'));var moment=require(_0x23cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x23cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23cb('0x5'));var config=require(_0x23cb('0x6'));var attributes=require(_0x23cb('0x7'));module['exports']=function(_0x2800ef,_0x24289e){return _0x2800ef[_0x23cb('0x8')](_0x23cb('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x48a427,_0x686beb){var _0x41ff42=function(_0xe00a3a){while(--_0xe00a3a){_0x48a427['push'](_0x48a427['shift']());}};_0x41ff42(++_0x686beb);}(_0xb4c8,0x70));var _0x8b4c=function(_0x5f1d95,_0x5b0931){_0x5f1d95=_0x5f1d95-0x0;var _0xb75816=_0xb4c8[_0x5f1d95];return _0xb75816;};'use strict';var _=require(_0x8b4c('0x0'));var util=require(_0x8b4c('0x1'));var logger=require(_0x8b4c('0x2'))(_0x8b4c('0x3'));var moment=require(_0x8b4c('0x4'));var BPromise=require(_0x8b4c('0x5'));var rp=require(_0x8b4c('0x6'));var fs=require('fs');var path=require(_0x8b4c('0x7'));var rimraf=require(_0x8b4c('0x8'));var config=require(_0x8b4c('0x9'));var attributes=require(_0x8b4c('0xa'));module['exports']=function(_0x4b2423,_0x1db737){return _0x4b2423[_0x8b4c('0xb')]('FaxAccount',attributes,{'tableName':_0x8b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 1444b25..12d6e14 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 _0x163f=['localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','options','raw','where','limit','include','model','attributes','map','then','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','Contacts','defaults','fax','FaxInteraction','create','Contact\x20not\x20found','autoclose','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x295476,_0x2e3efc){var _0x28b71e=function(_0x51121c){while(--_0x51121c){_0x295476['push'](_0x295476['shift']());}};_0x28b71e(++_0x2e3efc);}(_0x163f,0xf3));var _0xf163=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x163f[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0xf163('0x0'));var moment=require(_0xf163('0x1'));var BPromise=require(_0xf163('0x2'));var rs=require(_0xf163('0x3'));var fs=require('fs');var Redis=require(_0xf163('0x4'));var db=require(_0xf163('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf163('0x6'))(_0xf163('0x7'));var config=require('../../config/environment');var jayson=require(_0xf163('0x8'));var client=jayson[_0xf163('0x9')][_0xf163('0xa')]({'port':0x232c});config[_0xf163('0xb')]=_['defaults'](config[_0xf163('0xb')],{'host':_0xf163('0xc'),'port':0x18eb});var socket=require(_0xf163('0xd'))(new Redis(config['redis']));require(_0xf163('0xe'))[_0xf163('0xf')](socket);function respondWithRpcPromise(_0x103857,_0x367db8,_0x1b2372){return new BPromise(function(_0x58da5c,_0x37e566){return client[_0xf163('0x10')](_0x103857,_0x1b2372)['then'](function(_0x2adda8){logger[_0xf163('0x11')](_0xf163('0x12'),_0x367db8,_0xf163('0x13'));logger[_0xf163('0x14')](_0xf163('0x15'),_0x367db8,_0xf163('0x13'),JSON[_0xf163('0x16')](_0x2adda8));if(_0x2adda8['error']){if(_0x2adda8[_0xf163('0x17')][_0xf163('0x18')]===0x1f4){logger[_0xf163('0x17')]('FaxAccount,\x20%s,\x20%s',_0x367db8,_0x2adda8['error'][_0xf163('0x19')]);return _0x37e566(_0x2adda8[_0xf163('0x17')][_0xf163('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x367db8,_0x2adda8['error'][_0xf163('0x19')]);return _0x58da5c(_0x2adda8[_0xf163('0x17')][_0xf163('0x19')]);}else{logger[_0xf163('0x11')](_0xf163('0x12'),_0x367db8,_0xf163('0x13'));_0x58da5c(_0x2adda8['result'][_0xf163('0x19')]);}})[_0xf163('0x1a')](function(_0x24a121){logger[_0xf163('0x17')](_0xf163('0x12'),_0x367db8,_0x24a121);_0x37e566(_0x24a121);});});}exports[_0xf163('0x1b')]=function(_0x3675d5){var _0x3befa9=this;return new Promise(function(_0x52edfe,_0x401ca8){return db['FaxAccount']['findAll']({'raw':_0x3675d5['options']?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1d')]===undefined?!![]:![]:!![],'where':_0x3675d5['options']?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1e')]||null:null,'attributes':_0x3675d5[_0xf163('0x1c')]?_0x3675d5['options']['attributes']||null:null,'limit':_0x3675d5[_0xf163('0x1c')]?_0x3675d5[_0xf163('0x1c')][_0xf163('0x1f')]||null:null,'include':_0x3675d5[_0xf163('0x1c')]?_0x3675d5[_0xf163('0x1c')][_0xf163('0x20')]?_['map'](_0x3675d5[_0xf163('0x1c')][_0xf163('0x20')],function(_0x17503c){return{'model':db[_0x17503c[_0xf163('0x21')]],'as':_0x17503c['as'],'attributes':_0x17503c[_0xf163('0x22')],'include':_0x17503c[_0xf163('0x20')]?_[_0xf163('0x23')](_0x17503c[_0xf163('0x20')],function(_0x5a80ec){return{'model':db[_0x5a80ec[_0xf163('0x21')]],'as':_0x5a80ec['as'],'attributes':_0x5a80ec[_0xf163('0x22')],'include':_0x5a80ec[_0xf163('0x20')]?_[_0xf163('0x23')](_0x5a80ec['include'],function(_0x49fe60){return{'model':db[_0x49fe60[_0xf163('0x21')]],'as':_0x49fe60['as'],'attributes':_0x49fe60['attributes']};}):[]};}):[]};}):[]:[]})[_0xf163('0x24')](function(_0x520b7a){logger[_0xf163('0x11')]('GetFaxAccount',_0x3675d5);logger['debug']('GetFaxAccount',_0x3675d5,JSON[_0xf163('0x16')](_0x520b7a));_0x52edfe(_0x520b7a);})[_0xf163('0x1a')](function(_0x1cc7a3){logger[_0xf163('0x17')](_0xf163('0x1b'),_0x1cc7a3[_0xf163('0x19')],_0x3675d5);_0x401ca8(_0x3befa9[_0xf163('0x17')](0x1f4,_0x1cc7a3[_0xf163('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x196914,_0x1fd085,_0x2f36e0){var _0x14a97f=this;return new Promise(function(_0x28b0d6,_0x4e2283){var _0xecf459={'body':_0x196914['body'],'channel':'fax'};var _0x1c395f=[];var _0x5b3d22=[];var _0x28491a={};return db[_0xf163('0x25')][_0xf163('0x26')]()[_0xf163('0x24')](function(_0x4671e8){if(!_0x4671e8){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))]('no\x20available\x20attributes');}_0x1c395f=_[_0xf163('0x29')](_['keys'](_0x4671e8),[_0xf163('0x2a'),_0xf163('0x2b')]);_0x5b3d22=_[_0xf163('0x29')](_[_0xf163('0x2c')](_0x4671e8),['createdAt','updatedAt',_0xf163('0x2d'),_0xf163('0x2e')]);if(_0x196914[_0xf163('0x2f')]['id']){delete _0x196914[_0xf163('0x2f')]['id'];}if(_['isNil'](_0x196914['body'][_0xf163('0x30')])){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))](_0xf163('0x31'));}if(_[_0xf163('0x32')](_0x196914['body'][_0xf163('0x2f')])||_0x196914[_0xf163('0x2f')][_0xf163('0x2f')]===''){throw new db[(_0xf163('0x27'))]['ValidationError'](_0xf163('0x33'));}if(_['isNil'](_0x196914[_0xf163('0x2f')]['mapKey'])){throw new db[(_0xf163('0x27'))][(_0xf163('0x28'))](_0xf163('0x34')+_0x5b3d22);}if(!_['includes'](_0x5b3d22,_0x196914[_0xf163('0x2f')][_0xf163('0x35')])){throw new db['Sequelize'][(_0xf163('0x28'))](_0xf163('0x36')+_0x5b3d22);}_0x28491a[_0x196914[_0xf163('0x2f')][_0xf163('0x35')]]=_0x196914[_0xf163('0x2f')][_0xf163('0x30')];})[_0xf163('0x24')](function(){return db['FaxAccount'][_0xf163('0x37')]({'where':{'id':_0x196914['account']['id']},'include':[{'model':db[_0xf163('0x38')],'as':_0xf163('0x39'),'include':[{'model':db[_0xf163('0x25')],'as':'Contacts','where':_0x28491a,'limit':0x1,'order':[[_0xf163('0x2b'),_0xf163('0x3a')]]}]},{'model':db[_0xf163('0x3b')],'as':_0xf163('0x3c')}]});})[_0xf163('0x24')](function(_0x652d4d){if(_0x652d4d&&_0x652d4d[_0xf163('0x39')]){var _0x26fa8f=_0x652d4d[_0xf163('0x3d')]({'plain':!![]});_0xecf459[_0xf163('0x3e')]=_0x26fa8f;_0xecf459[_0xf163('0x3f')]=_0x26fa8f[_0xf163('0x3c')];_0xecf459[_0xf163('0x40')]=_0x26fa8f[_0xf163('0x39')];_0xecf459[_0xf163('0x3f')]=_[_0xf163('0x41')](_0xecf459[_0xf163('0x3f')],['priority'],['asc']);if(_0xecf459[_0xf163('0x3e')][_0xf163('0x3c')]){delete _0xecf459[_0xf163('0x3e')][_0xf163('0x3c')];}if(_0xecf459[_0xf163('0x3e')]['List']&&_0xecf459[_0xf163('0x3e')][_0xf163('0x39')][_0xf163('0x42')]['length']){return _0xecf459['account'][_0xf163('0x39')][_0xf163('0x42')][0x0];}var _0x2dd4d9=_[_0xf163('0x43')](_0x196914[_0xf163('0x2f')],{'firstName':_0x196914[_0xf163('0x2f')]['from'],'ListId':_0x26fa8f[_0xf163('0x2e')]});_0x2dd4d9[_0x196914[_0xf163('0x2f')][_0xf163('0x35')]]=_0x196914[_0xf163('0x2f')]['from'];return db[_0xf163('0x25')]['create'](_0x2dd4d9,{'fields':_0x1c395f,'raw':!![]});}})['then'](function(_0x4240cb){_0xecf459['contact']=_0x4240cb;if(_0x4240cb){var _0x3482e3={'ContactId':_0x4240cb['id'],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id'],'fax':_0x4240cb[_0xf163('0x44')]};return db[_0xf163('0x45')]['find']({'where':{'ContactId':_0x4240cb['id'],'closed':![],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id']}})[_0xf163('0x24')](function(_0x490a49){if(_0x490a49){return[_0x490a49,![]];}return db[_0xf163('0x45')][_0xf163('0x46')](_0x3482e3)[_0xf163('0x24')](function(_0x383af5){return[_0x383af5,!![]];});});}else{throw new Error(_0xf163('0x47'));}})['spread'](function(_0x5cc2fc,_0x5a790a){var _0x4c36e5=_0x5cc2fc['get']({'plain':!![]});if(_0x5a790a){if(_0xecf459[_0xf163('0x3e')][_0xf163('0x48')]){_0xecf459['applications']['push']({'id':0x0,'priority':_0xecf459[_0xf163('0x3f')]['length']+0x1,'app':'close','appdata':_0xf163('0x49'),'interval':'*,*,*,*'});}_0x4c36e5[_0xf163('0x4a')]=!![];}else{_0x4c36e5['created']=![];}_0xecf459[_0xf163('0x4b')]=_0x4c36e5;return db[_0xf163('0x4c')][_0xf163('0x46')]({'body':_0x196914[_0xf163('0x2f')]['body'],'FaxAccountId':_0x196914[_0xf163('0x3e')]['id'],'FaxInteractionId':_0x5cc2fc['id'],'direction':'in','ContactId':_0x5cc2fc[_0xf163('0x4d')],'AttachmentId':_0x196914['body']['AttachmentId']});})[_0xf163('0x24')](function(_0x368336){_0xecf459[_0xf163('0x19')]=_0x368336;if(_0xecf459['interaction'][_0xf163('0x4e')]){return db[_0xf163('0x4f')][_0xf163('0x37')]({'attributes':['id',_0xf163('0x50')],'where':{'id':_0xecf459[_0xf163('0x4b')][_0xf163('0x4e')]}})['then'](function(_0x144247){if(_0x144247){_0xecf459['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x144247[_0xf163('0x50')]+','+(_0xecf459['account'][_0xf163('0x51')]||0xa),'interval':_0xf163('0x52')});}return respondWithRpcPromise(_0xf163('0x53'),'startRouting',_0xecf459);});}return respondWithRpcPromise(_0xf163('0x53'),_0xf163('0x54'),_0xecf459);})['then'](function(_0x406b13){_0x28b0d6(_0x406b13);})['catch'](function(_0x293c72){_0x4e2283(_0x14a97f[_0xf163('0x17')](0x1f4,_0x293c72[_0xf163('0x19')]));});});}; \ No newline at end of file +var _0xcd28=['find','CmList','List','Contacts','FaxApplication','Applications','get','account','applications','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','startRouting','Start','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','include','model','map','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','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'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xcd28,0x170));var _0x8cd2=function(_0x123189,_0x27c117){_0x123189=_0x123189-0x0;var _0x1f46d=_0xcd28[_0x123189];return _0x1f46d;};'use strict';var _=require(_0x8cd2('0x0'));var util=require('util');var moment=require(_0x8cd2('0x1'));var BPromise=require(_0x8cd2('0x2'));var rs=require(_0x8cd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8cd2('0x5'));var config=require('../../config/environment');var jayson=require(_0x8cd2('0x6'));var client=jayson['client']['http']({'port':0x232c});config[_0x8cd2('0x7')]=_[_0x8cd2('0x8')](config[_0x8cd2('0x7')],{'host':_0x8cd2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8cd2('0xa'))[_0x8cd2('0xb')](socket);function respondWithRpcPromise(_0x2240ed,_0xab6b1e,_0x23eaab){return new BPromise(function(_0x5bd456,_0x2cb674){return client[_0x8cd2('0xc')](_0x2240ed,_0x23eaab)[_0x8cd2('0xd')](function(_0x158923){logger[_0x8cd2('0xe')]('FaxAccount,\x20%s,\x20%s',_0xab6b1e,_0x8cd2('0xf'));logger[_0x8cd2('0x10')](_0x8cd2('0x11'),_0xab6b1e,_0x8cd2('0xf'),JSON[_0x8cd2('0x12')](_0x158923));if(_0x158923['error']){if(_0x158923['error'][_0x8cd2('0x13')]===0x1f4){logger[_0x8cd2('0x14')]('FaxAccount,\x20%s,\x20%s',_0xab6b1e,_0x158923[_0x8cd2('0x14')]['message']);return _0x2cb674(_0x158923[_0x8cd2('0x14')][_0x8cd2('0x15')]);}logger['error'](_0x8cd2('0x16'),_0xab6b1e,_0x158923[_0x8cd2('0x14')]['message']);return _0x5bd456(_0x158923['error']['message']);}else{logger[_0x8cd2('0xe')](_0x8cd2('0x16'),_0xab6b1e,_0x8cd2('0xf'));_0x5bd456(_0x158923[_0x8cd2('0x17')]['message']);}})[_0x8cd2('0x18')](function(_0x273686){logger[_0x8cd2('0x14')](_0x8cd2('0x16'),_0xab6b1e,_0x273686);_0x2cb674(_0x273686);});});}exports[_0x8cd2('0x19')]=function(_0x5d6e58){var _0x5b54bd=this;return new Promise(function(_0x4a2397,_0x510316){return db[_0x8cd2('0x1a')][_0x8cd2('0x1b')]({'raw':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['where']||null:null,'attributes':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['attributes']||null:null,'limit':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58['options']['limit']||null:null,'include':_0x5d6e58['options']?_0x5d6e58[_0x8cd2('0x1c')]['include']?_['map'](_0x5d6e58[_0x8cd2('0x1c')][_0x8cd2('0x1d')],function(_0x5aff3d){return{'model':db[_0x5aff3d[_0x8cd2('0x1e')]],'as':_0x5aff3d['as'],'attributes':_0x5aff3d['attributes'],'include':_0x5aff3d[_0x8cd2('0x1d')]?_[_0x8cd2('0x1f')](_0x5aff3d['include'],function(_0x49ef38){return{'model':db[_0x49ef38[_0x8cd2('0x1e')]],'as':_0x49ef38['as'],'attributes':_0x49ef38[_0x8cd2('0x20')],'include':_0x49ef38['include']?_[_0x8cd2('0x1f')](_0x49ef38[_0x8cd2('0x1d')],function(_0x3441ac){return{'model':db[_0x3441ac['model']],'as':_0x3441ac['as'],'attributes':_0x3441ac[_0x8cd2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8cd2('0xd')](function(_0x1d498a){logger['info']('GetFaxAccount',_0x5d6e58);logger['debug'](_0x8cd2('0x19'),_0x5d6e58,JSON['stringify'](_0x1d498a));_0x4a2397(_0x1d498a);})[_0x8cd2('0x18')](function(_0x349d84){logger['error'](_0x8cd2('0x19'),_0x349d84[_0x8cd2('0x15')],_0x5d6e58);_0x510316(_0x5b54bd[_0x8cd2('0x14')](0x1f4,_0x349d84[_0x8cd2('0x15')]));});});};exports[_0x8cd2('0x21')]=function(_0x56fe1f,_0x402912,_0x2bb7a9){var _0x2b5406=this;return new Promise(function(_0x506f1e,_0x35a1b3){var _0x2a51c5={'body':_0x56fe1f['body'],'channel':_0x8cd2('0x22')};var _0x2f2c4d=[];var _0x416380=[];var _0x4594cf={};return db[_0x8cd2('0x23')][_0x8cd2('0x24')]()[_0x8cd2('0xd')](function(_0x345eed){if(!_0x345eed){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))]('no\x20available\x20attributes');}_0x2f2c4d=_['difference'](_[_0x8cd2('0x27')](_0x345eed),[_0x8cd2('0x28'),_0x8cd2('0x29')]);_0x416380=_[_0x8cd2('0x2a')](_['keys'](_0x345eed),['createdAt',_0x8cd2('0x29'),_0x8cd2('0x2b'),'ListId']);if(_0x56fe1f[_0x8cd2('0x2c')]['id']){delete _0x56fe1f[_0x8cd2('0x2c')]['id'];}if(_[_0x8cd2('0x2d')](_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')])){throw new db[(_0x8cd2('0x25'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x56fe1f['body']['body'])||_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2c')]===''){throw new db[(_0x8cd2('0x25'))]['ValidationError'](_0x8cd2('0x2f'));}if(_[_0x8cd2('0x2d')](_0x56fe1f['body'][_0x8cd2('0x30')])){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))](_0x8cd2('0x31')+_0x416380);}if(!_[_0x8cd2('0x32')](_0x416380,_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')])){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))](_0x8cd2('0x33')+_0x416380);}_0x4594cf[_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')]]=_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')];})[_0x8cd2('0xd')](function(){return db[_0x8cd2('0x1a')][_0x8cd2('0x34')]({'where':{'id':_0x56fe1f['account']['id']},'include':[{'model':db[_0x8cd2('0x35')],'as':_0x8cd2('0x36'),'include':[{'model':db[_0x8cd2('0x23')],'as':_0x8cd2('0x37'),'where':_0x4594cf,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8cd2('0x38')],'as':_0x8cd2('0x39')}]});})['then'](function(_0x58c1bb){if(_0x58c1bb&&_0x58c1bb[_0x8cd2('0x36')]){var _0x4d2bea=_0x58c1bb[_0x8cd2('0x3a')]({'plain':!![]});_0x2a51c5[_0x8cd2('0x3b')]=_0x4d2bea;_0x2a51c5[_0x8cd2('0x3c')]=_0x4d2bea[_0x8cd2('0x39')];_0x2a51c5['list']=_0x4d2bea[_0x8cd2('0x36')];_0x2a51c5[_0x8cd2('0x3c')]=_['orderBy'](_0x2a51c5[_0x8cd2('0x3c')],[_0x8cd2('0x3d')],[_0x8cd2('0x3e')]);if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x39')]){delete _0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x39')];}if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')]&&_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')]['Contacts'][_0x8cd2('0x3f')]){return _0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')][_0x8cd2('0x37')][0x0];}var _0x4c1808=_[_0x8cd2('0x8')](_0x56fe1f[_0x8cd2('0x2c')],{'firstName':_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')],'ListId':_0x4d2bea[_0x8cd2('0x40')]});_0x4c1808[_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')]]=_0x56fe1f['body'][_0x8cd2('0x2e')];return db[_0x8cd2('0x23')][_0x8cd2('0x41')](_0x4c1808,{'fields':_0x2f2c4d,'raw':!![]});}})[_0x8cd2('0xd')](function(_0x30e0f1){_0x2a51c5[_0x8cd2('0x42')]=_0x30e0f1;if(_0x30e0f1){var _0x3b2834={'ContactId':_0x30e0f1['id'],'FaxAccountId':_0x56fe1f['account']['id'],'fax':_0x30e0f1[_0x8cd2('0x22')]};return db[_0x8cd2('0x43')][_0x8cd2('0x34')]({'where':{'ContactId':_0x30e0f1['id'],'closed':![],'FaxAccountId':_0x56fe1f[_0x8cd2('0x3b')]['id']}})[_0x8cd2('0xd')](function(_0x3264eb){if(_0x3264eb){return[_0x3264eb,![]];}return db[_0x8cd2('0x43')][_0x8cd2('0x41')](_0x3b2834)['then'](function(_0x2bba01){return[_0x2bba01,!![]];});});}else{throw new Error(_0x8cd2('0x44'));}})['spread'](function(_0x1454fa,_0x4e7543){var _0x2e3e6f=_0x1454fa[_0x8cd2('0x3a')]({'plain':!![]});if(_0x4e7543){if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x45')]){_0x2a51c5[_0x8cd2('0x3c')][_0x8cd2('0x46')]({'id':0x0,'priority':_0x2a51c5[_0x8cd2('0x3c')]['length']+0x1,'app':_0x8cd2('0x47'),'appdata':_0x8cd2('0x48'),'interval':_0x8cd2('0x49')});}_0x2e3e6f[_0x8cd2('0x4a')]=!![];}else{_0x2e3e6f['created']=![];}_0x2a51c5[_0x8cd2('0x4b')]=_0x2e3e6f;return db[_0x8cd2('0x4c')][_0x8cd2('0x41')]({'body':_0x56fe1f[_0x8cd2('0x2c')]['body'],'FaxAccountId':_0x56fe1f['account']['id'],'FaxInteractionId':_0x1454fa['id'],'direction':'in','ContactId':_0x1454fa[_0x8cd2('0x4d')],'AttachmentId':_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x4e')]});})['then'](function(_0x127fff){_0x2a51c5[_0x8cd2('0x15')]=_0x127fff;if(_0x2a51c5[_0x8cd2('0x4b')]['UserId']){return db[_0x8cd2('0x4f')][_0x8cd2('0x34')]({'attributes':['id',_0x8cd2('0x50')],'where':{'id':_0x2a51c5['interaction']['UserId']}})[_0x8cd2('0xd')](function(_0x228120){if(_0x228120){_0x2a51c5[_0x8cd2('0x3c')][_0x8cd2('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x228120[_0x8cd2('0x50')]+','+(_0x2a51c5[_0x8cd2('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x8cd2('0x49')});}return respondWithRpcPromise('Start',_0x8cd2('0x52'),_0x2a51c5);});}return respondWithRpcPromise(_0x8cd2('0x53'),_0x8cd2('0x52'),_0x2a51c5);})['then'](function(_0x2ecd31){_0x506f1e(_0x2ecd31);})[_0x8cd2('0x18')](function(_0x3bf267){_0x35a1b3(_0x2b5406[_0x8cd2('0x14')](0x1f4,_0x3bf267[_0x8cd2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b392c5e..a4c0632 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 _0x68b3=['./faxAccount.events','save','remove','update','emit','register','length','faxAccount:'];(function(_0x2f4d82,_0x373756){var _0x42c438=function(_0xf08be4){while(--_0xf08be4){_0x2f4d82['push'](_0x2f4d82['shift']());}};_0x42c438(++_0x373756);}(_0x68b3,0x1d8));var _0x368b=function(_0x57ae5e,_0x38a856){_0x57ae5e=_0x57ae5e-0x0;var _0xbe1fb2=_0x68b3[_0x57ae5e];return _0xbe1fb2;};'use strict';var FaxAccountEvents=require(_0x368b('0x0'));var events=[_0x368b('0x1'),_0x368b('0x2'),_0x368b('0x3')];function createListener(_0x2d2762,_0x4a9da6){return function(_0x208c48){_0x4a9da6[_0x368b('0x4')](_0x2d2762,_0x208c48);};}function removeListener(_0xc40116,_0x404282){return function(){FaxAccountEvents['removeListener'](_0xc40116,_0x404282);};}exports[_0x368b('0x5')]=function(_0x41b15b){for(var _0x104dad=0x0,_0x23584a=events[_0x368b('0x6')];_0x104dad<_0x23584a;_0x104dad++){var _0x127c1e=events[_0x104dad];var _0x2dec1c=createListener(_0x368b('0x7')+_0x127c1e,_0x41b15b);FaxAccountEvents['on'](_0x127c1e,_0x2dec1c);}}; \ No newline at end of file +var _0x82c4=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x4bf2c1,_0x4a0c03){var _0x160d45=function(_0x25832c){while(--_0x25832c){_0x4bf2c1['push'](_0x4bf2c1['shift']());}};_0x160d45(++_0x4a0c03);}(_0x82c4,0x1ca));var _0x482c=function(_0x525cc6,_0x5a7e0e){_0x525cc6=_0x525cc6-0x0;var _0x2427d3=_0x82c4[_0x525cc6];return _0x2427d3;};'use strict';var FaxAccountEvents=require(_0x482c('0x0'));var events=[_0x482c('0x1'),_0x482c('0x2'),_0x482c('0x3')];function createListener(_0x18d056,_0x69706f){return function(_0x863ea9){_0x69706f['emit'](_0x18d056,_0x863ea9);};}function removeListener(_0x16b0f8,_0x5f4dee){return function(){FaxAccountEvents[_0x482c('0x4')](_0x16b0f8,_0x5f4dee);};}exports['register']=function(_0x477cf4){for(var _0x5d7c76=0x0,_0xfdb92=events[_0x482c('0x5')];_0x5d7c76<_0xfdb92;_0x5d7c76++){var _0x35cdab=events[_0x5d7c76];var _0x1c10f2=createListener(_0x482c('0x6')+_0x35cdab,_0x477cf4);FaxAccountEvents['on'](_0x35cdab,_0x1c10f2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7f0e7e2..60b0430 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 _0x7f34=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','post','create','addDisposition','/:id/canned_answers','addAnswer','addAccountApplications','updateAccountApplications','/:id/send','/:id/users','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x51c543,_0x2465cc){var _0x5e21e2=function(_0x580772){while(--_0x580772){_0x51c543['push'](_0x51c543['shift']());}};_0x5e21e2(++_0x2465cc);}(_0x7f34,0x1d4));var _0x47f3=function(_0x309e08,_0x1ab9a4){_0x309e08=_0x309e08-0x0;var _0x464775=_0x7f34[_0x309e08];return _0x464775;};'use strict';var multer=require('multer');var util=require(_0x47f3('0x0'));var path=require('path');var timeout=require(_0x47f3('0x1'));var express=require(_0x47f3('0x2'));var router=express[_0x47f3('0x3')]();var auth=require(_0x47f3('0x4'));var interaction=require(_0x47f3('0x5'));var config=require(_0x47f3('0x6'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x47f3('0x7')](),controller[_0x47f3('0x8')]);router[_0x47f3('0x9')](_0x47f3('0xa'),auth[_0x47f3('0x7')](),controller[_0x47f3('0xb')]);router[_0x47f3('0x9')](_0x47f3('0xc'),auth[_0x47f3('0x7')](),controller['show']);router[_0x47f3('0x9')](_0x47f3('0xd'),auth[_0x47f3('0x7')](),controller[_0x47f3('0xe')]);router[_0x47f3('0x9')]('/:id/canned_answers',auth[_0x47f3('0x7')](),controller[_0x47f3('0xf')]);router['get'](_0x47f3('0x10'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x11')]);router[_0x47f3('0x9')](_0x47f3('0x12'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x13')]);router[_0x47f3('0x9')](_0x47f3('0x14'),auth['isAuthenticated'](),controller[_0x47f3('0x15')]);router[_0x47f3('0x9')]('/:id/users',auth[_0x47f3('0x7')](),controller['getAgents']);router[_0x47f3('0x16')]('/',auth[_0x47f3('0x7')](),controller[_0x47f3('0x17')]);router['post']('/:id/dispositions',auth[_0x47f3('0x7')](),controller[_0x47f3('0x18')]);router[_0x47f3('0x16')](_0x47f3('0x19'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x1a')]);router[_0x47f3('0x16')](_0x47f3('0x10'),auth[_0x47f3('0x7')](),controller['addInteraction']);router[_0x47f3('0x16')](_0x47f3('0x12'),auth[_0x47f3('0x7')](),controller['addApplications']);router['post']('/addaccountapplications',auth[_0x47f3('0x7')](),controller[_0x47f3('0x1b')]);router[_0x47f3('0x16')]('/updateaccountapplications',auth[_0x47f3('0x7')](),controller[_0x47f3('0x1c')]);router[_0x47f3('0x16')](_0x47f3('0x1d'),auth[_0x47f3('0x7')](),controller['send']);router['post'](_0x47f3('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0x47f3('0x1f')]('/:id',auth[_0x47f3('0x7')](),controller[_0x47f3('0x20')]);router['delete'](_0x47f3('0xc'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x21')]);router[_0x47f3('0x22')]('/:id/dispositions',auth[_0x47f3('0x7')](),controller[_0x47f3('0x23')]);router[_0x47f3('0x22')](_0x47f3('0x19'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x24')]);router[_0x47f3('0x22')](_0x47f3('0x1e'),auth[_0x47f3('0x7')](),controller[_0x47f3('0x25')]);module[_0x47f3('0x26')]=router; \ No newline at end of file +var _0x5896=['getInteractions','getApplications','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/applications','/addaccountapplications','/updateaccountapplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions'];(function(_0x369d7c,_0xeb28ba){var _0x12f56d=function(_0x33ad8a){while(--_0x33ad8a){_0x369d7c['push'](_0x369d7c['shift']());}};_0x12f56d(++_0xeb28ba);}(_0x5896,0x13d));var _0x6589=function(_0x50c493,_0x583092){_0x50c493=_0x50c493-0x0;var _0x159e02=_0x5896[_0x50c493];return _0x159e02;};'use strict';var multer=require(_0x6589('0x0'));var util=require(_0x6589('0x1'));var path=require(_0x6589('0x2'));var timeout=require('connect-timeout');var express=require(_0x6589('0x3'));var router=express['Router']();var auth=require(_0x6589('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6589('0x5'));router[_0x6589('0x6')]('/',auth['isAuthenticated'](),controller[_0x6589('0x7')]);router['get'](_0x6589('0x8'),auth[_0x6589('0x9')](),controller[_0x6589('0xa')]);router[_0x6589('0x6')](_0x6589('0xb'),auth[_0x6589('0x9')](),controller['show']);router[_0x6589('0x6')](_0x6589('0xc'),auth['isAuthenticated'](),controller[_0x6589('0xd')]);router[_0x6589('0x6')](_0x6589('0xe'),auth[_0x6589('0x9')](),controller['getAnswers']);router['get'](_0x6589('0xf'),auth[_0x6589('0x9')](),controller[_0x6589('0x10')]);router[_0x6589('0x6')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6589('0x11')]);router[_0x6589('0x6')]('/:id/messages',auth[_0x6589('0x9')](),controller[_0x6589('0x12')]);router[_0x6589('0x6')](_0x6589('0x13'),auth['isAuthenticated'](),controller[_0x6589('0x14')]);router[_0x6589('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6589('0x15')](_0x6589('0xc'),auth['isAuthenticated'](),controller[_0x6589('0x16')]);router[_0x6589('0x15')](_0x6589('0xe'),auth[_0x6589('0x9')](),controller[_0x6589('0x17')]);router[_0x6589('0x15')](_0x6589('0xf'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x6589('0x15')](_0x6589('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6589('0x15')](_0x6589('0x19'),auth[_0x6589('0x9')](),controller['addAccountApplications']);router[_0x6589('0x15')](_0x6589('0x1a'),auth[_0x6589('0x9')](),controller['updateAccountApplications']);router[_0x6589('0x15')](_0x6589('0x1b'),auth[_0x6589('0x9')](),controller[_0x6589('0x1c')]);router[_0x6589('0x15')](_0x6589('0x13'),auth[_0x6589('0x9')](),controller[_0x6589('0x1d')]);router['put']('/:id',auth[_0x6589('0x9')](),controller[_0x6589('0x1e')]);router[_0x6589('0x1f')](_0x6589('0xb'),auth['isAuthenticated'](),controller[_0x6589('0x20')]);router[_0x6589('0x1f')](_0x6589('0xc'),auth[_0x6589('0x9')](),controller[_0x6589('0x21')]);router['delete']('/:id/canned_answers',auth[_0x6589('0x9')](),controller[_0x6589('0x22')]);router[_0x6589('0x1f')](_0x6589('0x13'),auth[_0x6589('0x9')](),controller[_0x6589('0x23')]);module[_0x6589('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7ef9138..5e021b9 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 _0x723c=['INTEGER','noop','STRING','*,*,*,*','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x723c,0x1ad));var _0xc723=function(_0xff9b4b,_0x5943a0){_0xff9b4b=_0xff9b4b-0x0;var _0x253961=_0x723c[_0xff9b4b];return _0x253961;};'use strict';var Sequelize=require('sequelize');module[_0xc723('0x0')]={'priority':{'type':Sequelize[_0xc723('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc723('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc723('0x3')]},'interval':{'type':Sequelize[_0xc723('0x3')],'defaultValue':_0xc723('0x4')}}; \ No newline at end of file +var _0x82d8=['INTEGER','TEXT','STRING','sequelize'];(function(_0x11739a,_0x10fb03){var _0x4f5c0e=function(_0x41c0be){while(--_0x41c0be){_0x11739a['push'](_0x11739a['shift']());}};_0x4f5c0e(++_0x10fb03);}(_0x82d8,0xff));var _0x882d=function(_0x18c8ee,_0xf8bd4c){_0x18c8ee=_0x18c8ee-0x0;var _0x4f8ad5=_0x82d8[_0x18c8ee];return _0x4f8ad5;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x882d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x882d('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x882d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7cb892a..ed44ca7 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 _0x6e72=['json','count','offset','set','reject','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x535cb7,_0x489364){var _0x56f3ee=function(_0xa320f8){while(--_0xa320f8){_0x535cb7['push'](_0x535cb7['shift']());}};_0x56f3ee(++_0x489364);}(_0x6e72,0x142));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x26e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x26e7('0x1'));var zipdir=require(_0x26e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26e7('0x3'));var moment=require(_0x26e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x26e7('0x5'));var util=require(_0x26e7('0x6'));var path=require(_0x26e7('0x7'));var sox=require(_0x26e7('0x8'));var csv=require(_0x26e7('0x9'));var ejs=require(_0x26e7('0xa'));var fs=require('fs');var _=require(_0x26e7('0xb'));var squel=require('squel');var crypto=require(_0x26e7('0xc'));var jsforce=require(_0x26e7('0xd'));var deskjs=require(_0x26e7('0xe'));var toCsv=require(_0x26e7('0x9'));var querystring=require(_0x26e7('0xf'));var Papa=require(_0x26e7('0x10'));var Redis=require(_0x26e7('0x11'));var authService=require(_0x26e7('0x12'));var qs=require(_0x26e7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26e7('0x14'));var utils=require(_0x26e7('0x15'));var config=require(_0x26e7('0x16'));var licenseUtil=require(_0x26e7('0x17'));var db=require(_0x26e7('0x18'))['db'];function respondWithStatusCode(_0x2b8055,_0x3fb212){_0x3fb212=_0x3fb212||0xcc;return function(_0x53f815){if(_0x53f815){return _0x2b8055[_0x26e7('0x19')](_0x3fb212);}return _0x2b8055[_0x26e7('0x1a')](_0x3fb212)[_0x26e7('0x1b')]();};}function respondWithResult(_0x3d4296,_0x18cf03){_0x18cf03=_0x18cf03||0xc8;return function(_0x586e4a){if(_0x586e4a){return _0x3d4296[_0x26e7('0x1a')](_0x18cf03)[_0x26e7('0x1c')](_0x586e4a);}};}function respondWithFilteredResult(_0x369edc,_0x20c3de){return function(_0x37067d){if(_0x37067d){var _0x202ad4=_0x37067d[_0x26e7('0x1d')],_0x2baf7b=_0x20c3de['offset'],_0x2d018e=_0x20c3de[_0x26e7('0x1e')]+_0x20c3de['limit'],_0x514eaf;if(_0x2d018e>=_0x202ad4){_0x2d018e=_0x202ad4;_0x514eaf=0xc8;}else{_0x514eaf=0xce;}_0x369edc[_0x26e7('0x1a')](_0x514eaf);return _0x369edc[_0x26e7('0x1f')]('Content-Range',_0x2baf7b+'-'+_0x2d018e+'/'+_0x202ad4)['json'](_0x37067d);}return null;};}function patchUpdates(_0x83b0b1){return function(_0x8a582e){try{jsonpatch['apply'](_0x8a582e,_0x83b0b1,!![]);}catch(_0x40e11f){return BPromise[_0x26e7('0x20')](_0x40e11f);}return _0x8a582e[_0x26e7('0x21')]();};}function saveUpdates(_0x1377d9,_0x4822cf){return function(_0x28be8c){if(_0x28be8c){return _0x28be8c[_0x26e7('0x22')](_0x1377d9)[_0x26e7('0x23')](function(_0x476157){return _0x476157;});}return null;};}function removeEntity(_0x2291d4,_0x10d502){return function(_0x14f57f){if(_0x14f57f){return _0x14f57f[_0x26e7('0x24')]()['then'](function(){_0x2291d4[_0x26e7('0x1a')](0xcc)[_0x26e7('0x1b')]();});}};}function handleEntityNotFound(_0x421504,_0x4a9470){return function(_0x57dafa){if(!_0x57dafa){_0x421504[_0x26e7('0x19')](0x194);}return _0x57dafa;};}function handleError(_0x38aa0,_0x3a8d9b){_0x3a8d9b=_0x3a8d9b||0x1f4;return function(_0x57bf67){logger['error'](_0x57bf67[_0x26e7('0x25')]);if(_0x57bf67['name']){delete _0x57bf67[_0x26e7('0x26')];}_0x38aa0[_0x26e7('0x1a')](_0x3a8d9b)[_0x26e7('0x27')](_0x57bf67);};}exports[_0x26e7('0x28')]=function(_0x2d3db3,_0x439376){var _0x3d7de5={},_0x2ec840={},_0x503f84={'count':0x0,'rows':[]};var _0xc1cef2=_[_0x26e7('0x29')](db[_0x26e7('0x2a')][_0x26e7('0x2b')],function(_0x40962d){return{'name':_0x40962d[_0x26e7('0x2c')],'type':_0x40962d[_0x26e7('0x2d')]['key']};});_0x2ec840[_0x26e7('0x2e')]=_[_0x26e7('0x29')](_0xc1cef2,_0x26e7('0x26'));_0x2ec840[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0x2d3db3[_0x26e7('0x2f')]);_0x2ec840[_0x26e7('0x31')]=_[_0x26e7('0x32')](_0x2ec840['model'],_0x2ec840[_0x26e7('0x2f')]);_0x3d7de5[_0x26e7('0x33')]=_[_0x26e7('0x32')](_0x2ec840[_0x26e7('0x2e')],qs[_0x26e7('0x34')](_0x2d3db3['query'][_0x26e7('0x34')]));_0x3d7de5[_0x26e7('0x33')]=_0x3d7de5[_0x26e7('0x33')][_0x26e7('0x35')]?_0x3d7de5[_0x26e7('0x33')]:_0x2ec840[_0x26e7('0x2e')];if(!_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x36')]('nolimit')){_0x3d7de5[_0x26e7('0x37')]=qs[_0x26e7('0x37')](_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x37')]);_0x3d7de5[_0x26e7('0x1e')]=qs[_0x26e7('0x1e')](_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x1e')]);}_0x3d7de5[_0x26e7('0x38')]=qs[_0x26e7('0x39')](_0x2d3db3['query'][_0x26e7('0x39')]);_0x3d7de5[_0x26e7('0x3a')]=qs[_0x26e7('0x31')](_['pick'](_0x2d3db3['query'],_0x2ec840[_0x26e7('0x31')]),_0xc1cef2);if(_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3b')]){_0x3d7de5['where']=_[_0x26e7('0x3c')](_0x3d7de5[_0x26e7('0x3a')],{'$or':_[_0x26e7('0x29')](_0xc1cef2,function(_0x246699){if(_0x246699[_0x26e7('0x2d')]!==_0x26e7('0x3d')){var _0x1784fa={};_0x1784fa[_0x246699[_0x26e7('0x26')]]={'$like':'%'+_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3b')]+'%'};return _0x1784fa;}})});}_0x3d7de5=_[_0x26e7('0x3c')]({},_0x3d7de5,_0x2d3db3[_0x26e7('0x3e')]);var _0x520672={'where':_0x3d7de5[_0x26e7('0x3a')]};return db[_0x26e7('0x2a')][_0x26e7('0x1d')](_0x520672)['then'](function(_0x5ccdde){_0x503f84[_0x26e7('0x1d')]=_0x5ccdde;if(_0x2d3db3[_0x26e7('0x2f')][_0x26e7('0x3f')]){_0x3d7de5[_0x26e7('0x40')]=[{'all':!![]}];}return db[_0x26e7('0x2a')]['findAll'](_0x3d7de5);})['then'](function(_0x498469){_0x503f84['rows']=_0x498469;return _0x503f84;})[_0x26e7('0x23')](respondWithFilteredResult(_0x439376,_0x3d7de5))[_0x26e7('0x41')](handleError(_0x439376,null));};exports['show']=function(_0x1c49b9,_0x42bad8){var _0x108eb5={'raw':!![],'where':{'id':_0x1c49b9[_0x26e7('0x42')]['id']}},_0x333913={};_0x333913[_0x26e7('0x2e')]=_[_0x26e7('0x30')](db[_0x26e7('0x2a')][_0x26e7('0x2b')]);_0x333913[_0x26e7('0x2f')]=_[_0x26e7('0x30')](_0x1c49b9[_0x26e7('0x2f')]);_0x333913[_0x26e7('0x31')]=_['intersection'](_0x333913[_0x26e7('0x2e')],_0x333913[_0x26e7('0x2f')]);_0x108eb5['attributes']=_[_0x26e7('0x32')](_0x333913[_0x26e7('0x2e')],qs[_0x26e7('0x34')](_0x1c49b9[_0x26e7('0x2f')]['fields']));_0x108eb5[_0x26e7('0x33')]=_0x108eb5['attributes'][_0x26e7('0x35')]?_0x108eb5[_0x26e7('0x33')]:_0x333913[_0x26e7('0x2e')];if(_0x1c49b9[_0x26e7('0x2f')][_0x26e7('0x3f')]){_0x108eb5[_0x26e7('0x40')]=[{'all':!![]}];}_0x108eb5=_['merge']({},_0x108eb5,_0x1c49b9[_0x26e7('0x3e')]);return db[_0x26e7('0x2a')][_0x26e7('0x43')](_0x108eb5)[_0x26e7('0x23')](handleEntityNotFound(_0x42bad8,null))['then'](respondWithResult(_0x42bad8,null))[_0x26e7('0x41')](handleError(_0x42bad8,null));};exports[_0x26e7('0x44')]=function(_0x4c3be9,_0x2f3598){return db[_0x26e7('0x2a')]['create'](_0x4c3be9[_0x26e7('0x45')],{})[_0x26e7('0x23')](respondWithResult(_0x2f3598,0xc9))['catch'](handleError(_0x2f3598,null));};exports['update']=function(_0x541c6b,_0x168808){if(_0x541c6b[_0x26e7('0x45')]['id']){delete _0x541c6b[_0x26e7('0x45')]['id'];}return db['FaxApplication'][_0x26e7('0x43')]({'where':{'id':_0x541c6b['params']['id']}})['then'](handleEntityNotFound(_0x168808,null))['then'](saveUpdates(_0x541c6b[_0x26e7('0x45')],null))[_0x26e7('0x23')](respondWithResult(_0x168808,null))['catch'](handleError(_0x168808,null));};exports['destroy']=function(_0x4fe0a0,_0x585731){return db[_0x26e7('0x2a')][_0x26e7('0x43')]({'where':{'id':_0x4fe0a0['params']['id']}})['then'](handleEntityNotFound(_0x585731,null))['then'](removeEntity(_0x585731,null))['catch'](handleError(_0x585731,null));}; \ No newline at end of file +var _0x2b58=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','FaxApplication'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2b58,0x1e0));var _0x82b5=function(_0x385223,_0x1fe515){_0x385223=_0x385223-0x0;var _0x4eec94=_0x2b58[_0x385223];return _0x4eec94;};'use strict';var pdf=require(_0x82b5('0x0'));var emlformat=require(_0x82b5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x82b5('0x2'));var rp=require(_0x82b5('0x3'));var moment=require('moment');var BPromise=require(_0x82b5('0x4'));var Mustache=require(_0x82b5('0x5'));var util=require(_0x82b5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x82b5('0x7'));var ejs=require(_0x82b5('0x8'));var fs=require('fs');var _=require(_0x82b5('0x9'));var squel=require(_0x82b5('0xa'));var crypto=require(_0x82b5('0xb'));var jsforce=require(_0x82b5('0xc'));var deskjs=require(_0x82b5('0xd'));var toCsv=require(_0x82b5('0x7'));var querystring=require('querystring');var Papa=require(_0x82b5('0xe'));var Redis=require('ioredis');var authService=require(_0x82b5('0xf'));var qs=require(_0x82b5('0x10'));var as=require(_0x82b5('0x11'));var hardwareService=require(_0x82b5('0x12'));var logger=require(_0x82b5('0x13'))(_0x82b5('0x14'));var utils=require(_0x82b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x82b5('0x16'));var db=require(_0x82b5('0x17'))['db'];function respondWithStatusCode(_0x1a82df,_0x4d745f){_0x4d745f=_0x4d745f||0xcc;return function(_0x113e51){if(_0x113e51){return _0x1a82df['sendStatus'](_0x4d745f);}return _0x1a82df[_0x82b5('0x18')](_0x4d745f)[_0x82b5('0x19')]();};}function respondWithResult(_0x24f37e,_0x27d30a){_0x27d30a=_0x27d30a||0xc8;return function(_0x20c975){if(_0x20c975){return _0x24f37e['status'](_0x27d30a)[_0x82b5('0x1a')](_0x20c975);}};}function respondWithFilteredResult(_0x3518f9,_0x4f0505){return function(_0x11039f){if(_0x11039f){var _0x5a06eb=_0x11039f[_0x82b5('0x1b')],_0x1885f7=_0x4f0505[_0x82b5('0x1c')],_0x1aa928=_0x4f0505['offset']+_0x4f0505[_0x82b5('0x1d')],_0x3115cc;if(_0x1aa928>=_0x5a06eb){_0x1aa928=_0x5a06eb;_0x3115cc=0xc8;}else{_0x3115cc=0xce;}_0x3518f9[_0x82b5('0x18')](_0x3115cc);return _0x3518f9[_0x82b5('0x1e')](_0x82b5('0x1f'),_0x1885f7+'-'+_0x1aa928+'/'+_0x5a06eb)[_0x82b5('0x1a')](_0x11039f);}return null;};}function patchUpdates(_0x340528){return function(_0x370de2){try{jsonpatch[_0x82b5('0x20')](_0x370de2,_0x340528,!![]);}catch(_0x1f5a16){return BPromise[_0x82b5('0x21')](_0x1f5a16);}return _0x370de2['save']();};}function saveUpdates(_0x1e7db4,_0x238aa8){return function(_0x39ee23){if(_0x39ee23){return _0x39ee23[_0x82b5('0x22')](_0x1e7db4)['then'](function(_0xf1d566){return _0xf1d566;});}return null;};}function removeEntity(_0x4b44c9,_0x474a94){return function(_0xa4481c){if(_0xa4481c){return _0xa4481c[_0x82b5('0x23')]()[_0x82b5('0x24')](function(){_0x4b44c9[_0x82b5('0x18')](0xcc)[_0x82b5('0x19')]();});}};}function handleEntityNotFound(_0x532f32,_0x4254b8){return function(_0x39683f){if(!_0x39683f){_0x532f32[_0x82b5('0x25')](0x194);}return _0x39683f;};}function handleError(_0x4ab381,_0x1373ad){_0x1373ad=_0x1373ad||0x1f4;return function(_0x42f052){logger[_0x82b5('0x26')](_0x42f052[_0x82b5('0x27')]);if(_0x42f052[_0x82b5('0x28')]){delete _0x42f052[_0x82b5('0x28')];}_0x4ab381[_0x82b5('0x18')](_0x1373ad)[_0x82b5('0x29')](_0x42f052);};}exports[_0x82b5('0x2a')]=function(_0x331c5e,_0x1c7ad8){var _0x483fce={},_0x53ae9f={},_0xf3f6be={'count':0x0,'rows':[]};var _0x31dfe6=_[_0x82b5('0x2b')](db[_0x82b5('0x2c')][_0x82b5('0x2d')],function(_0x2744e6){return{'name':_0x2744e6[_0x82b5('0x2e')],'type':_0x2744e6[_0x82b5('0x2f')][_0x82b5('0x30')]};});_0x53ae9f[_0x82b5('0x31')]=_[_0x82b5('0x2b')](_0x31dfe6,_0x82b5('0x28'));_0x53ae9f['query']=_[_0x82b5('0x32')](_0x331c5e[_0x82b5('0x33')]);_0x53ae9f[_0x82b5('0x34')]=_[_0x82b5('0x35')](_0x53ae9f[_0x82b5('0x31')],_0x53ae9f[_0x82b5('0x33')]);_0x483fce[_0x82b5('0x36')]=_[_0x82b5('0x35')](_0x53ae9f[_0x82b5('0x31')],qs['fields'](_0x331c5e[_0x82b5('0x33')][_0x82b5('0x37')]));_0x483fce[_0x82b5('0x36')]=_0x483fce[_0x82b5('0x36')][_0x82b5('0x38')]?_0x483fce[_0x82b5('0x36')]:_0x53ae9f['model'];if(!_0x331c5e[_0x82b5('0x33')][_0x82b5('0x39')](_0x82b5('0x3a'))){_0x483fce[_0x82b5('0x1d')]=qs[_0x82b5('0x1d')](_0x331c5e[_0x82b5('0x33')][_0x82b5('0x1d')]);_0x483fce[_0x82b5('0x1c')]=qs[_0x82b5('0x1c')](_0x331c5e['query'][_0x82b5('0x1c')]);}_0x483fce[_0x82b5('0x3b')]=qs[_0x82b5('0x3c')](_0x331c5e[_0x82b5('0x33')]['sort']);_0x483fce[_0x82b5('0x3d')]=qs['filters'](_[_0x82b5('0x3e')](_0x331c5e[_0x82b5('0x33')],_0x53ae9f[_0x82b5('0x34')]),_0x31dfe6);if(_0x331c5e[_0x82b5('0x33')][_0x82b5('0x3f')]){_0x483fce[_0x82b5('0x3d')]=_[_0x82b5('0x40')](_0x483fce[_0x82b5('0x3d')],{'$or':_[_0x82b5('0x2b')](_0x31dfe6,function(_0x5ce6d3){if(_0x5ce6d3[_0x82b5('0x2f')]!==_0x82b5('0x41')){var _0x136d10={};_0x136d10[_0x5ce6d3[_0x82b5('0x28')]]={'$like':'%'+_0x331c5e[_0x82b5('0x33')]['filter']+'%'};return _0x136d10;}})});}_0x483fce=_['merge']({},_0x483fce,_0x331c5e[_0x82b5('0x42')]);var _0x50f9eb={'where':_0x483fce[_0x82b5('0x3d')]};return db[_0x82b5('0x2c')][_0x82b5('0x1b')](_0x50f9eb)[_0x82b5('0x24')](function(_0x21ccf8){_0xf3f6be[_0x82b5('0x1b')]=_0x21ccf8;if(_0x331c5e[_0x82b5('0x33')][_0x82b5('0x43')]){_0x483fce[_0x82b5('0x44')]=[{'all':!![]}];}return db[_0x82b5('0x2c')]['findAll'](_0x483fce);})[_0x82b5('0x24')](function(_0x2a1b41){_0xf3f6be[_0x82b5('0x45')]=_0x2a1b41;return _0xf3f6be;})[_0x82b5('0x24')](respondWithFilteredResult(_0x1c7ad8,_0x483fce))[_0x82b5('0x46')](handleError(_0x1c7ad8,null));};exports[_0x82b5('0x47')]=function(_0xc68376,_0xa5d39a){var _0x2c3f5f={'raw':!![],'where':{'id':_0xc68376['params']['id']}},_0xa3563b={};_0xa3563b[_0x82b5('0x31')]=_[_0x82b5('0x32')](db['FaxApplication'][_0x82b5('0x2d')]);_0xa3563b[_0x82b5('0x33')]=_[_0x82b5('0x32')](_0xc68376['query']);_0xa3563b[_0x82b5('0x34')]=_[_0x82b5('0x35')](_0xa3563b[_0x82b5('0x31')],_0xa3563b['query']);_0x2c3f5f[_0x82b5('0x36')]=_[_0x82b5('0x35')](_0xa3563b[_0x82b5('0x31')],qs[_0x82b5('0x37')](_0xc68376[_0x82b5('0x33')]['fields']));_0x2c3f5f['attributes']=_0x2c3f5f[_0x82b5('0x36')][_0x82b5('0x38')]?_0x2c3f5f['attributes']:_0xa3563b['model'];if(_0xc68376['query'][_0x82b5('0x43')]){_0x2c3f5f[_0x82b5('0x44')]=[{'all':!![]}];}_0x2c3f5f=_['merge']({},_0x2c3f5f,_0xc68376[_0x82b5('0x42')]);return db[_0x82b5('0x2c')]['find'](_0x2c3f5f)['then'](handleEntityNotFound(_0xa5d39a,null))[_0x82b5('0x24')](respondWithResult(_0xa5d39a,null))[_0x82b5('0x46')](handleError(_0xa5d39a,null));};exports['create']=function(_0x478972,_0x2cb936){return db['FaxApplication'][_0x82b5('0x48')](_0x478972['body'],{})['then'](respondWithResult(_0x2cb936,0xc9))[_0x82b5('0x46')](handleError(_0x2cb936,null));};exports[_0x82b5('0x22')]=function(_0x193826,_0x4fe787){if(_0x193826[_0x82b5('0x49')]['id']){delete _0x193826[_0x82b5('0x49')]['id'];}return db[_0x82b5('0x2c')]['find']({'where':{'id':_0x193826[_0x82b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fe787,null))['then'](saveUpdates(_0x193826[_0x82b5('0x49')],null))[_0x82b5('0x24')](respondWithResult(_0x4fe787,null))[_0x82b5('0x46')](handleError(_0x4fe787,null));};exports[_0x82b5('0x23')]=function(_0x5a9280,_0x5c9c11){return db['FaxApplication']['find']({'where':{'id':_0x5a9280[_0x82b5('0x4a')]['id']}})[_0x82b5('0x24')](handleEntityNotFound(_0x5c9c11,null))[_0x82b5('0x24')](removeEntity(_0x5c9c11,null))[_0x82b5('0x46')](handleError(_0x5c9c11,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f0767c5..09d8d44 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 _0x08d1=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x08d1,0x67));var _0x108d=function(_0x296466,_0x40144c){_0x296466=_0x296466-0x0;var _0x2aff3f=_0x08d1[_0x296466];return _0x2aff3f;};'use strict';var _=require(_0x108d('0x0'));var util=require(_0x108d('0x1'));var logger=require(_0x108d('0x2'))('api');var moment=require(_0x108d('0x3'));var BPromise=require(_0x108d('0x4'));var rp=require(_0x108d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x108d('0x6'));var config=require(_0x108d('0x7'));var attributes=require(_0x108d('0x8'));module[_0x108d('0x9')]=function(_0x57ec74,_0x10a296){return _0x57ec74[_0x108d('0xa')](_0x108d('0xb'),attributes,{'tableName':_0x108d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x108d('0xd'),'collate':_0x108d('0xe')});}; \ No newline at end of file +var _0xd78d=['bluebird','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x28ce1a,_0x548bbf){var _0x4b1154=function(_0x381e96){while(--_0x381e96){_0x28ce1a['push'](_0x28ce1a['shift']());}};_0x4b1154(++_0x548bbf);}(_0xd78d,0x182));var _0xdd78=function(_0x175a4d,_0x155355){_0x175a4d=_0x175a4d-0x0;var _0x501590=_0xd78d[_0x175a4d];return _0x501590;};'use strict';var _=require(_0xdd78('0x0'));var util=require('util');var logger=require(_0xdd78('0x1'))(_0xdd78('0x2'));var moment=require(_0xdd78('0x3'));var BPromise=require(_0xdd78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdd78('0x5'));var attributes=require(_0xdd78('0x6'));module[_0xdd78('0x7')]=function(_0x53797e,_0x3e34de){return _0x53797e[_0xdd78('0x8')](_0xdd78('0x9'),attributes,{'tableName':_0xdd78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd78('0xb'),'collate':_0xdd78('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4639706..1ddc9fc 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 _0xd03c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','lodash'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xd03c,0x15b));var _0xcd03=function(_0x2242a4,_0x4a45cb){_0x2242a4=_0x2242a4-0x0;var _0x18f626=_0xd03c[_0x2242a4];return _0x18f626;};'use strict';var _=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));var moment=require(_0xcd03('0x2'));var BPromise=require(_0xcd03('0x3'));var rs=require(_0xcd03('0x4'));var fs=require('fs');var Redis=require(_0xcd03('0x5'));var db=require(_0xcd03('0x6'))['db'];var utils=require(_0xcd03('0x7'));var logger=require('../../config/logger')(_0xcd03('0x8'));var config=require(_0xcd03('0x9'));var jayson=require(_0xcd03('0xa'));var client=jayson[_0xcd03('0xb')][_0xcd03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x546deb,_0x4a99d6,_0xfc260f){return new BPromise(function(_0x2413fa,_0x2067d0){return client[_0xcd03('0xd')](_0x546deb,_0xfc260f)[_0xcd03('0xe')](function(_0x28bf0c){logger[_0xcd03('0xf')]('FaxApplication,\x20%s,\x20%s',_0x4a99d6,_0xcd03('0x10'));logger[_0xcd03('0x11')](_0xcd03('0x12'),_0x4a99d6,_0xcd03('0x10'),JSON['stringify'](_0x28bf0c));if(_0x28bf0c[_0xcd03('0x13')]){if(_0x28bf0c[_0xcd03('0x13')]['code']===0x1f4){logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x28bf0c['error'][_0xcd03('0x15')]);return _0x2067d0(_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);}logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);return _0x2413fa(_0x28bf0c[_0xcd03('0x13')][_0xcd03('0x15')]);}else{logger[_0xcd03('0xf')](_0xcd03('0x14'),_0x4a99d6,_0xcd03('0x10'));_0x2413fa(_0x28bf0c[_0xcd03('0x16')][_0xcd03('0x15')]);}})[_0xcd03('0x17')](function(_0x817953){logger[_0xcd03('0x13')](_0xcd03('0x14'),_0x4a99d6,_0x817953);_0x2067d0(_0x817953);});});}exports[_0xcd03('0x18')]=function(_0x1d21c9){var _0x581f12=this;return new Promise(function(_0x309b78,_0x1a9c18){return db[_0xcd03('0x19')]['update'](_0x1d21c9['body'],{'raw':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')][_0xcd03('0x1b')]||null:null,'attributes':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')][_0xcd03('0x1c')]||null:null,'limit':_0x1d21c9[_0xcd03('0x1a')]?_0x1d21c9[_0xcd03('0x1a')]['limit']||null:null})[_0xcd03('0xe')](function(_0x461509){logger[_0xcd03('0xf')](_0xcd03('0x18'),_0x1d21c9);logger[_0xcd03('0x11')](_0xcd03('0x18'),_0x1d21c9,JSON['stringify'](_0x461509));_0x309b78(_0x461509);})[_0xcd03('0x17')](function(_0x5176b3){logger[_0xcd03('0x13')](_0xcd03('0x18'),_0x5176b3[_0xcd03('0x15')],_0x1d21c9);_0x1a9c18(_0x581f12['error'](0x1f4,_0x5176b3[_0xcd03('0x15')]));});});}; \ No newline at end of file +var _0x9420=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','debug','moment'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x9420,0x1a3));var _0x0942=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x9420[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0942('0x0'));var BPromise=require(_0x0942('0x1'));var rs=require(_0x0942('0x2'));var fs=require('fs');var Redis=require(_0x0942('0x3'));var db=require(_0x0942('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0942('0x5'))(_0x0942('0x6'));var config=require(_0x0942('0x7'));var jayson=require(_0x0942('0x8'));var client=jayson['client'][_0x0942('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x165ecb,_0x5a86d1,_0x25f245){return new BPromise(function(_0x5351c6,_0x1b36af){return client[_0x0942('0xa')](_0x165ecb,_0x25f245)[_0x0942('0xb')](function(_0xfe6954){logger[_0x0942('0xc')](_0x0942('0xd'),_0x5a86d1,_0x0942('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5a86d1,'request\x20sent',JSON[_0x0942('0xf')](_0xfe6954));if(_0xfe6954[_0x0942('0x10')]){if(_0xfe6954[_0x0942('0x10')][_0x0942('0x11')]===0x1f4){logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);return _0x1b36af(_0xfe6954['error']['message']);}logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);return _0x5351c6(_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);}else{logger[_0x0942('0xc')]('FaxApplication,\x20%s,\x20%s',_0x5a86d1,'request\x20sent');_0x5351c6(_0xfe6954[_0x0942('0x13')]['message']);}})[_0x0942('0x14')](function(_0x4bbe97){logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0x4bbe97);_0x1b36af(_0x4bbe97);});});}exports[_0x0942('0x15')]=function(_0x9ab287){var _0x25ff32=this;return new Promise(function(_0x5e7122,_0x40b93c){return db[_0x0942('0x16')][_0x0942('0x17')](_0x9ab287[_0x0942('0x18')],{'raw':_0x9ab287[_0x0942('0x19')]?_0x9ab287['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1a')]||null:null,'attributes':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1b')]||null:null,'limit':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1c')]||null:null})[_0x0942('0xb')](function(_0x52c14e){logger['info'](_0x0942('0x15'),_0x9ab287);logger[_0x0942('0x1d')]('UpdateFaxApplication',_0x9ab287,JSON[_0x0942('0xf')](_0x52c14e));_0x5e7122(_0x52c14e);})[_0x0942('0x14')](function(_0x47792d){logger['error'](_0x0942('0x15'),_0x47792d[_0x0942('0x12')],_0x9ab287);_0x40b93c(_0x25ff32[_0x0942('0x10')](0x1f4,_0x47792d[_0x0942('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d3d9d94..8859886 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 _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x227102,_0xf07c04){var _0x1d89ed=function(_0x2a709a){while(--_0x2a709a){_0x227102['push'](_0x227102['shift']());}};_0x1d89ed(++_0xf07c04);}(_0x2eb2,0x19f));var _0x22eb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2eb2[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa630=['delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xa630,0xbe));var _0x0a63=function(_0x55ded6,_0x7eb99b){_0x55ded6=_0x55ded6-0x0;var _0x3c3348=_0xa630[_0x55ded6];return _0x3c3348;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var auth=require(_0x0a63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a63('0x4'));var controller=require(_0x0a63('0x5'));router[_0x0a63('0x6')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0x8')]);router['get'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xa')]);router[_0x0a63('0xb')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0xc')]);router['put'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);module[_0x0a63('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5543cdb..7f8f333 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 _0x383d=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x470ed4,_0x1bd1ce){var _0x4b681e=function(_0x8a5b6f){while(--_0x8a5b6f){_0x470ed4['push'](_0x470ed4['shift']());}};_0x4b681e(++_0x1bd1ce);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xd383('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd383('0x1')]},'disposition':{'type':Sequelize[_0xd383('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd383('0x2')]},'note':{'type':Sequelize[_0xd383('0x2')]},'read1stAt':{'type':Sequelize[_0xd383('0x1')]},'fax':{'type':Sequelize[_0xd383('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd383('0x3')]('in',_0xd383('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd383('0x3')]('in',_0xd383('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x55a5=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1d4be2,_0x12c7ec){var _0x3df399=function(_0x1e4e7d){while(--_0x1e4e7d){_0x1d4be2['push'](_0x1d4be2['shift']());}};_0x3df399(++_0x12c7ec);}(_0x55a5,0xf7));var _0x555a=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x55a5[_0x3d27a];return _0x314fd7;};'use strict';var Sequelize=require(_0x555a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x555a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x555a('0x2')]},'disposition':{'type':Sequelize[_0x555a('0x3')]},'secondDisposition':{'type':Sequelize[_0x555a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x555a('0x3')]},'note':{'type':Sequelize[_0x555a('0x3')]},'read1stAt':{'type':Sequelize[_0x555a('0x2')]},'fax':{'type':Sequelize[_0x555a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x555a('0x4')]('in',_0x555a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x555a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x555a('0x4')]('in',_0x555a('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 b0a3032..a0107ed 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 _0x668b=['parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','rawAttributes','options','create','body','params','addMessage','ids','getMessages','findOne','FaxMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','addTags','setTags','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','push','index','FaxInteraction','key','model','keys','intersection','fields','query','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x668b,0x140));var _0xb668=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x668b[_0x21c6b8];return _0x39d474;};'use strict';var pdf=require(_0xb668('0x0'));var emlformat=require(_0xb668('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb668('0x2'));var jsonpatch=require(_0xb668('0x3'));var rp=require('request-promise');var moment=require(_0xb668('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb668('0x5'));var util=require(_0xb668('0x6'));var path=require(_0xb668('0x7'));var sox=require('sox');var csv=require(_0xb668('0x8'));var ejs=require(_0xb668('0x9'));var fs=require('fs');var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0x8'));var querystring=require(_0xb668('0xe'));var Papa=require(_0xb668('0xf'));var Redis=require(_0xb668('0x10'));var authService=require(_0xb668('0x11'));var qs=require(_0xb668('0x12'));var as=require(_0xb668('0x13'));var hardwareService=require(_0xb668('0x14'));var logger=require('../../config/logger')(_0xb668('0x15'));var utils=require(_0xb668('0x16'));var config=require(_0xb668('0x17'));var licenseUtil=require(_0xb668('0x18'));var db=require(_0xb668('0x19'))['db'];config[_0xb668('0x1a')]=_[_0xb668('0x1b')](config[_0xb668('0x1a')],{'host':_0xb668('0x1c'),'port':0x18eb});var socket=require(_0xb668('0x1d'))(new Redis(config[_0xb668('0x1a')]));require(_0xb668('0x1e'))[_0xb668('0x1f')](socket);function respondWithStatusCode(_0xd0450f,_0x2ec706){_0x2ec706=_0x2ec706||0xcc;return function(_0x3b0c84){if(_0x3b0c84){return _0xd0450f[_0xb668('0x20')](_0x2ec706);}return _0xd0450f[_0xb668('0x21')](_0x2ec706)[_0xb668('0x22')]();};}function respondWithResult(_0x4a755b,_0xd3e39f){_0xd3e39f=_0xd3e39f||0xc8;return function(_0x27bbfa){if(_0x27bbfa){return _0x4a755b['status'](_0xd3e39f)[_0xb668('0x23')](_0x27bbfa);}};}function respondWithFilteredResult(_0x567ad7,_0x30742a){return function(_0x89fe72){if(_0x89fe72){var _0x5438ff=_0x89fe72[_0xb668('0x24')],_0x38595d=_0x30742a['offset'],_0x18e9c1=_0x30742a[_0xb668('0x25')]+_0x30742a[_0xb668('0x26')],_0x53ff78;if(_0x18e9c1>=_0x5438ff){_0x18e9c1=_0x5438ff;_0x53ff78=0xc8;}else{_0x53ff78=0xce;}_0x567ad7[_0xb668('0x21')](_0x53ff78);return _0x567ad7[_0xb668('0x27')]('Content-Range',_0x38595d+'-'+_0x18e9c1+'/'+_0x5438ff)[_0xb668('0x23')](_0x89fe72);}return null;};}function patchUpdates(_0xfe4595){return function(_0x25e5be){try{jsonpatch['apply'](_0x25e5be,_0xfe4595,!![]);}catch(_0x5a2f74){return BPromise[_0xb668('0x28')](_0x5a2f74);}return _0x25e5be[_0xb668('0x29')]();};}function saveUpdates(_0x517eee,_0x61de4a){return function(_0x4bf863){if(_0x4bf863){return _0x4bf863[_0xb668('0x2a')](_0x517eee)['then'](function(_0x3f4745){return _0x3f4745;});}return null;};}function removeEntity(_0x1e1c94,_0x3f84c7){return function(_0x3231b2){if(_0x3231b2){return _0x3231b2[_0xb668('0x2b')]()[_0xb668('0x2c')](function(){_0x1e1c94['status'](0xcc)[_0xb668('0x22')]();});}};}function handleEntityNotFound(_0x10d767,_0x2ab8c2){return function(_0x49abfd){if(!_0x49abfd){_0x10d767['sendStatus'](0x194);}return _0x49abfd;};}function handleError(_0xe62fce,_0x2a826d){_0x2a826d=_0x2a826d||0x1f4;return function(_0x30b965){logger['error'](_0x30b965[_0xb668('0x2d')]);if(_0x30b965[_0xb668('0x2e')]){delete _0x30b965[_0xb668('0x2e')];}_0xe62fce['status'](_0x2a826d)['send'](_0x30b965);};}function getInteractionUsers(_0x12919c,_0x2619a4){return new BPromise(function(_0x589c58,_0x2e5857){try{if(_0x2619a4[_0x12919c['id']]){_0x12919c[_0xb668('0x2f')]=_[_0xb668('0x30')](_0x2619a4[_0x12919c['id']],function(_0x19a1dc){return{'id':_0x19a1dc['id'],'fullname':_0x19a1dc[_0xb668('0x31')]};});}}catch(_0x5f36b5){_0x2e5857(_0x5f36b5);}_0x589c58(_0x12919c);});}function getInteractionTags(_0x138ee5,_0x3bd27c){return new BPromise(function(_0x5dfa2c,_0x28bcdd){try{if(_0x138ee5['TagIds']){_0x138ee5[_0xb668('0x32')]=[];_0x138ee5[_0xb668('0x33')][_0xb668('0x34')](',')[_0xb668('0x35')](function(_0x2e40dd){_0x138ee5[_0xb668('0x32')][_0xb668('0x36')](_0x3bd27c[_0x2e40dd]);});}delete _0x138ee5[_0xb668('0x33')];}catch(_0xadeb63){_0x28bcdd(_0xadeb63);}_0x5dfa2c(_0x138ee5);});}function updateFaxInteraction(_0x4ae272,_0x277f95,_0x13bc2b){return new BPromise(function(_0x1483ba,_0x4dd83e){return getInteractionUsers(_0x4ae272,_0x13bc2b)[_0xb668('0x2c')](function(_0x203ea0){return getInteractionTags(_0x203ea0,_0x277f95);})[_0xb668('0x2c')](function(_0x68d980){_0x1483ba(_0x68d980);})['catch'](function(_0xb989a3){_0x4dd83e(_0xb989a3);});});}exports[_0xb668('0x37')]=function(_0x3cb3a1,_0x2f6edb){var _0x34e0d6={},_0xe10c43={},_0x304311={'count':0x0,'rows':[]};var _0x5a9134=_[_0xb668('0x30')](db[_0xb668('0x38')]['rawAttributes'],function(_0xede795){return{'name':_0xede795['fieldName'],'type':_0xede795['type'][_0xb668('0x39')]};});_0xe10c43[_0xb668('0x3a')]=_['map'](_0x5a9134,_0xb668('0x2e'));_0xe10c43['query']=_[_0xb668('0x3b')](_0x3cb3a1['query']);_0xe10c43['filters']=_[_0xb668('0x3c')](_0xe10c43[_0xb668('0x3a')],_0xe10c43['query']);_0x34e0d6['attributes']=_[_0xb668('0x3c')](_0xe10c43[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x3d')]));_0x34e0d6['attributes']=_0x34e0d6['attributes'][_0xb668('0x3f')]?_0x34e0d6[_0xb668('0x40')]:_0xe10c43[_0xb668('0x3a')];if(!_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x41')](_0xb668('0x42'))){_0x34e0d6['limit']=qs['limit'](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x26')]);_0x34e0d6[_0xb668('0x25')]=qs[_0xb668('0x25')](_0x3cb3a1[_0xb668('0x3e')]['offset']);}_0x34e0d6[_0xb668('0x43')]=qs[_0xb668('0x44')](_0x3cb3a1['query'][_0xb668('0x44')]);_0x34e0d6[_0xb668('0x45')]=qs[_0xb668('0x46')](_[_0xb668('0x47')](_0x3cb3a1['query'],_0xe10c43['filters']),_0x5a9134);var _0x4b7192=[];var _0x311c59=squel['select']()['field']('id')['field']('name')[_0xb668('0x48')]('color')[_0xb668('0x49')](_0xb668('0x4a'));var _0x30f4bb=squel[_0xb668('0x4b')]()[_0xb668('0x48')]('u.id')[_0xb668('0x48')](_0xb668('0x4c'))[_0xb668('0x48')](_0xb668('0x4d'))[_0xb668('0x49')](_0xb668('0x4e'),'ui')[_0xb668('0x4f')](_0xb668('0x50'),'u',_0xb668('0x51'));var _0x3c8a3e=squel[_0xb668('0x4b')]()['from'](_0xb668('0x52'),'i')[_0xb668('0x4f')](_0xb668('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb668('0x50'),'o','o.id\x20=\x20i.UserId')[_0xb668('0x4f')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xb668('0x54'),'me',_0xb668('0x55'))['left_join'](_0xb668('0x56'),'it',_0xb668('0x57'))[_0xb668('0x4f')](_0xb668('0x4a'),'t',_0xb668('0x58'));var _0x36926a=squel[_0xb668('0x59')]();var _0x6fb5f1=[];var _0x207eed=squel[_0xb668('0x59')]();var _0x4e0628;if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x5a')]){_0x4e0628=as[_0xb668('0x5b')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x5a')]);var _0x3da9ba=_0x4e0628[_0xb668('0x5c')];for(var _0x1bff79=0x0;_0x1bff79<_0x4e0628[_0xb668('0x5d')]['length'];_0x1bff79++){var _0x1c36df=_0x4e0628[_0xb668('0x5d')][_0x1bff79];var _0x2e906d='i';var _0x4c9eab=_['find'](_0x5a9134,[_0xb668('0x2e'),_0x1c36df[_0xb668('0x48')]]);if(!_0x4c9eab){switch(_0x1c36df[_0xb668('0x48')]){case'unreadMessages':if(_0x1c36df[_0xb668('0x5e')]==0x1){_0x3c8a3e['having']('`'+_0x1c36df['field']+_0xb668('0x5f'));}else{_0x3c8a3e[_0xb668('0x60')]('`'+_0x1c36df[_0xb668('0x48')]+_0xb668('0x61'));}break;case _0xb668('0x62'):if(_0x1c36df[_0xb668('0x63')]===_0xb668('0x64')){if(_0x1c36df[_0xb668('0x5e')][_0xb668('0x34')]('\x20')[_0xb668('0x3f')]>0x1){_0x36926a[_0x3da9ba](_0xb668('0x65'),qs[_0xb668('0x66')](_0x1c36df[_0xb668('0x5e')]),null);}else{var _0x41750e='%'+_0x1c36df[_0xb668('0x5e')]+'%';_0x36926a[_0x3da9ba](_0xb668('0x67'),_0x41750e,_0x41750e,_0x41750e);}}else{_0x4c9eab=_[_0xb668('0x68')](_0x5a9134,[_0xb668('0x2e'),_0xb668('0x69')]);_0x1c36df[_0xb668('0x48')]=_0xb668('0x69');_0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x22')]);}break;case _0xb668('0x6e'):var _0x262976=_0x1c36df['value'][_0xb668('0x34')](',')[_0xb668('0x30')](function(_0x5ec04e){return Number(_0x5ec04e);});_0x262976[_0xb668('0x35')](function(_0x416d73){_0x207eed['or'](_0xb668('0x6f'),'%,'+_0x416d73+',%');});_0x6fb5f1=_[_0xb668('0x70')](_0x6fb5f1,_0x262976);break;case _0xb668('0x71'):if(_0x1c36df[_0xb668('0x63')]===_0xb668('0x64')){_0x36926a[_0x3da9ba](_0xb668('0x72'),'%'+_0x1c36df[_0xb668('0x5e')]+'%',null);}else{_0x4c9eab=_[_0xb668('0x68')](_0x5a9134,['name',_0xb668('0x73')]);_0x1c36df[_0xb668('0x48')]='UserId';_0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf['text'],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf['value'][_0xb668('0x22')]);}break;case'body':_0x10e2bf=as[_0xb668('0x6a')]('me',null,_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf['value'][_0xb668('0x6d')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x22')]);break;}}else{var _0x10e2bf=as[_0xb668('0x6a')](_0x2e906d,_0x4c9eab[_0xb668('0x6b')],_0x1c36df);_0x36926a[_0x3da9ba](_0x10e2bf[_0xb668('0x6c')],_0x10e2bf[_0xb668('0x5e')][_0xb668('0x6d')],_0x10e2bf['value'][_0xb668('0x22')]);}}}else{var _0x440d30=_(_0x3cb3a1[_0xb668('0x3e')])[_0xb668('0x3b')]()[_0xb668('0x30')](function(_0x51fcc6){return _[_0xb668('0x74')](_0x5a9134,[_0xb668('0x2e'),_0x51fcc6])?_0x51fcc6:undefined;})[_0xb668('0x75')]()['value']();if(!_[_0xb668('0x76')](_0x440d30)){_0x440d30[_0xb668('0x35')](function(_0x409c8b){if(_0x409c8b===_0xb668('0x77')){_0x3c8a3e['where'](_0xb668('0x78'),[][_0xb668('0x79')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]));}else if(_0x409c8b==='createdAt'){var _0xfaafb5=JSON[_0xb668('0x7a')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b])[_0xb668('0x7b')];var _0x2bf503=JSON[_0xb668('0x7a')](_0x3cb3a1[_0xb668('0x3e')][_0x409c8b])[_0xb668('0x7c')];_0x3c8a3e[_0xb668('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xfaafb5,_0x2bf503);}else{if(_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]==='null'){_0x3c8a3e[_0xb668('0x45')]('i.'+_0x409c8b+'\x20IS\x20NULL');}else{_0x3c8a3e[_0xb668('0x45')]('i.'+_0x409c8b+_0xb668('0x7d'),_0x3cb3a1[_0xb668('0x3e')][_0x409c8b]);}}});}if(_0x3cb3a1['query'][_0xb668('0x7e')]){if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x7e')]==0x1){_0x3c8a3e[_0xb668('0x60')](_0xb668('0x7f'));}else{_0x3c8a3e[_0xb668('0x60')](_0xb668('0x80'));}}if(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]){_0x6fb5f1=_[_0xb668('0x82')](_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')])?_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]:new Array(_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x81')]);_0x6fb5f1[_0xb668('0x35')](function(_0x4260a9){_0x207eed['or'](_0xb668('0x6f'),'%,'+_0x4260a9+',%');});}if(_0x3cb3a1[_0xb668('0x3e')]['filter']){var _0x37a567=_0x3cb3a1[_0xb668('0x3e')]['filter'][_0xb668('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb668('0x84')](_0x37a567)){_0x36926a['or'](_0xb668('0x85'),_0x37a567+'%')['or']('i.fax\x20LIKE\x20?',_0x37a567+'%');}_0x36926a['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x37a567+'%');}}_0x3c8a3e[_0xb668('0x45')](_0x36926a);_0x3c8a3e[_0xb668('0x86')](_0xb668('0x87'));var _0x486fbd={'type':db[_0xb668('0x88')][_0xb668('0x89')][_0xb668('0x8a')],'raw':!![]};var _0x4f1712=_0x3c8a3e[_0xb668('0x8b')]();_0x4f1712[_0xb668('0x48')](_0xb668('0x87'));_0x4f1712[_0xb668('0x48')](_0xb668('0x8c'),_0xb668('0x8d'));if(_0x34e0d6[_0xb668('0x43')]){_0x34e0d6[_0xb668('0x43')][_0xb668('0x35')](function(_0x209184){var _0x2596d6=_0x209184[0x0]==='contactName'?_0x209184[0x0]:'i.'+_0x209184[0x0];_0x3c8a3e[_0xb668('0x43')](_0x2596d6,_0x209184[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x6fb5f1)){_0x3c8a3e[_0xb668('0x60')](_0x207eed);_0x4f1712[_0xb668('0x45')](_0xb668('0x8e'),_0x6fb5f1);}BPromise[_0xb668('0x8f')]()['then'](function(){if(!_0x4e0628){if(_0x3cb3a1[_0xb668('0x3e')]['FaxAccountId']||_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x90')])return;_0x4f1712[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3c8a3e[_0xb668('0x45')](_0xb668('0x91'));return;}if(_0x3cb3a1[_0xb668('0x92')]['role']!==_0xb668('0x93'))return;return _0x3cb3a1[_0xb668('0x92')][_0xb668('0x94')]({'attributes':['id'],'raw':!![]})[_0xb668('0x2c')](function(_0x57e479){if(_[_0xb668('0x76')](_0x57e479)){_0x4f1712[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x3c8a3e[_0xb668('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4f1712[_0xb668('0x45')](_0xb668('0x78'),_[_0xb668('0x30')](_0x57e479,'id'));_0x3c8a3e[_0xb668('0x45')](_0xb668('0x78'),_['map'](_0x57e479,'id'));}});})['then'](function(){if(_0x3cb3a1[_0xb668('0x92')][_0xb668('0x95')]===_0xb668('0x93')&&!_0x4e0628&&!_0x3cb3a1[_0xb668('0x3e')][_0xb668('0x77')])return[];return db[_0xb668('0x96')][_0xb668('0x3e')](_0x4f1712[_0xb668('0x97')](),_0x486fbd);})[_0xb668('0x2c')](function(_0x2bcea0){_0x304311[_0xb668('0x24')]=_0x2bcea0['length'];if(_0x304311[_0xb668('0x24')]===0x0)return[];return db[_0xb668('0x96')]['query'](_0x311c59[_0xb668('0x97')](),_0x486fbd)[_0xb668('0x2c')](function(_0x1ddfd1){_0x4b7192=_[_0xb668('0x98')](_0x1ddfd1,'id');_0x486fbd=_[_0xb668('0x99')](_0x486fbd,{'model':db[_0xb668('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cb3a1[_0xb668('0x3e')]['fields']){_0x34e0d6[_0xb668('0x40')]['forEach'](function(_0x2f599d){_0x3c8a3e[_0xb668('0x48')]('i.'+_0x2f599d);});}else{_0x3c8a3e[_0xb668('0x48')](_0xb668('0x8c'),_0xb668('0x8d'));_0x3c8a3e['field'](_0xb668('0x9a'),_0xb668('0x9b'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0x9c'),_0xb668('0x9d'));_0x3c8a3e[_0xb668('0x48')]('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',_0xb668('0x9e'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0x9f'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa0'),_0xb668('0xa1'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa2'),'Contact.lastName');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa3'),_0xb668('0xa4'));_0x3c8a3e['field'](_0xb668('0xa5'),'Contact.phone');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa6'),_0xb668('0xa7'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xa8'),_0xb668('0xa9'));_0x3c8a3e[_0xb668('0x48')]('o.fullname','Owner.fullname');_0x3c8a3e[_0xb668('0x48')](_0xb668('0xaa'),_0xb668('0xab'));_0x3c8a3e[_0xb668('0x48')](_0xb668('0xac'),_0xb668('0x33'));}if(_0x34e0d6[_0xb668('0x26')])_0x3c8a3e[_0xb668('0x26')](_0x34e0d6[_0xb668('0x26')]);if(_0x34e0d6[_0xb668('0x25')])_0x3c8a3e[_0xb668('0x25')](_0x34e0d6[_0xb668('0x25')]);return db[_0xb668('0x96')]['query'](_0x3c8a3e[_0xb668('0x97')](),_0x486fbd);})[_0xb668('0x2c')](function(_0x318c4e){_0x30f4bb[_0xb668('0x45')](_0xb668('0xad'),_[_0xb668('0x30')](_0x318c4e,'id'));return db[_0xb668('0x96')][_0xb668('0x3e')](_0x30f4bb['toString'](),_0x486fbd)[_0xb668('0x2c')](function(_0x4c36e5){var _0x52fc01=_[_0xb668('0xae')](_0x4c36e5,_0xb668('0xaf'));var _0x48f897=[];_0x318c4e[_0xb668('0x35')](function(_0x5e05de){_0x48f897[_0xb668('0x36')](updateFaxInteraction(_0x5e05de,_0x4b7192,_0x52fc01));});return BPromise[_0xb668('0xb0')](_0x48f897);});});})[_0xb668('0x2c')](function(_0x4e061e){_0x304311[_0xb668('0xb1')]=_0x4e061e;return _0x304311;})[_0xb668('0x2c')](respondWithFilteredResult(_0x2f6edb,_0x34e0d6))[_0xb668('0xb2')](handleError(_0x2f6edb,null));};exports[_0xb668('0xb3')]=function(_0x57eb41,_0x4c49ee){var _0x1b8d19={'raw':![],'where':{'id':_0x57eb41['params']['id']}},_0xd14e7f={};_0xd14e7f[_0xb668('0x3a')]=_['keys'](db[_0xb668('0x38')][_0xb668('0xb4')]);_0xd14e7f[_0xb668('0x3e')]=_[_0xb668('0x3b')](_0x57eb41['query']);_0xd14e7f['filters']=_[_0xb668('0x3c')](_0xd14e7f[_0xb668('0x3a')],_0xd14e7f[_0xb668('0x3e')]);_0x1b8d19['attributes']=_[_0xb668('0x3c')](_0xd14e7f[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x57eb41['query'][_0xb668('0x3d')]));_0x1b8d19['attributes']=_0x1b8d19[_0xb668('0x40')][_0xb668('0x3f')]?_0x1b8d19[_0xb668('0x40')]:_0xd14e7f[_0xb668('0x3a')];if(_0x57eb41[_0xb668('0x3e')]['includeAll']){_0x1b8d19['include']=[{'all':!![]}];}_0x1b8d19=_[_0xb668('0x99')]({},_0x1b8d19,_0x57eb41[_0xb668('0xb5')]);return db[_0xb668('0x38')][_0xb668('0x68')](_0x1b8d19)['then'](handleEntityNotFound(_0x4c49ee,null))['then'](respondWithResult(_0x4c49ee,null))[_0xb668('0xb2')](handleError(_0x4c49ee,null));};exports[_0xb668('0xb6')]=function(_0x4e6d34,_0x229583){return db[_0xb668('0x38')][_0xb668('0xb6')](_0x4e6d34[_0xb668('0xb7')],{})[_0xb668('0x2c')](respondWithResult(_0x229583,0xc9))[_0xb668('0xb2')](handleError(_0x229583,null));};exports[_0xb668('0x2a')]=function(_0x11c949,_0x206546){if(_0x11c949[_0xb668('0xb7')]['id']){delete _0x11c949['body']['id'];}return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x11c949[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x206546,null))[_0xb668('0x2c')](saveUpdates(_0x11c949[_0xb668('0xb7')],null))[_0xb668('0x2c')](respondWithResult(_0x206546,null))[_0xb668('0xb2')](handleError(_0x206546,null));};exports[_0xb668('0x2b')]=function(_0x1bbbad,_0x54eef6){return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x1bbbad['params']['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x54eef6,null))[_0xb668('0x2c')](removeEntity(_0x54eef6,null))[_0xb668('0xb2')](handleError(_0x54eef6,null));};exports['describe']=function(_0x1fa9f1,_0x30dbdb){return db['FaxInteraction']['describe']()[_0xb668('0x2c')](respondWithResult(_0x30dbdb,null))[_0xb668('0xb2')](handleError(_0x30dbdb,null));};exports['addMessage']=function(_0x254f3b,_0x5507f9,_0x1a05b8){return db['FaxMessage'][_0xb668('0x68')]({'where':{'id':_0x254f3b[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x5507f9,null))[_0xb668('0x2c')](function(_0x47bf24){if(_0x47bf24){return _0x47bf24[_0xb668('0xb9')](_0x254f3b[_0xb668('0xb7')][_0xb668('0xba')],_['omit'](_0x254f3b['body'],[_0xb668('0xba'),'id'])||{});}})[_0xb668('0x2c')](respondWithResult(_0x5507f9,null))[_0xb668('0xb2')](handleError(_0x5507f9,null));};exports[_0xb668('0xbb')]=function(_0x4cb72d,_0xbfd89d,_0x2b9b93){var _0xaa6842={'raw':![],'where':{}};var _0x578d8c={};var _0x28692b={'count':0x0,'rows':[]};return db[_0xb668('0x38')][_0xb668('0xbc')]({'where':{'id':_0x4cb72d['params']['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0xbfd89d,null))[_0xb668('0x2c')](function(_0x3c39dc){if(_0x3c39dc){_0x578d8c[_0xb668('0x3a')]=_[_0xb668('0x3b')](db[_0xb668('0xbd')][_0xb668('0xb4')]);_0x578d8c[_0xb668('0x3e')]=_[_0xb668('0x3b')](_0x4cb72d['query']);_0x578d8c[_0xb668('0x46')]=_['intersection'](_0x578d8c[_0xb668('0x3a')],_0x578d8c['query']);_0xaa6842[_0xb668('0x40')]=_[_0xb668('0x3c')](_0x578d8c[_0xb668('0x3a')],qs[_0xb668('0x3d')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x3d')]));_0xaa6842[_0xb668('0x40')]=_0xaa6842[_0xb668('0x40')][_0xb668('0x3f')]?_0xaa6842['attributes']:_0x578d8c[_0xb668('0x3a')];if(!_0x4cb72d[_0xb668('0x3e')]['hasOwnProperty'](_0xb668('0x42'))){_0xaa6842['limit']=qs[_0xb668('0x26')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x26')]);_0xaa6842['offset']=qs[_0xb668('0x25')](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x25')]);}_0xaa6842['order']=qs['sort'](_0x4cb72d[_0xb668('0x3e')][_0xb668('0x44')]);_0xaa6842[_0xb668('0x45')]=qs[_0xb668('0x46')](_[_0xb668('0x47')](_0x4cb72d[_0xb668('0x3e')],_0x578d8c[_0xb668('0x46')]));_0xaa6842[_0xb668('0x45')]['FaxInteractionId']=_0x3c39dc['id'];if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0xbe')]){_0xaa6842[_0xb668('0x45')]=_[_0xb668('0x99')](_0xaa6842['where'],{'$or':_['map'](_0xaa6842[_0xb668('0x40')],function(_0xfa552c){var _0x2b100f={};_0x2b100f[_0xfa552c]={'$like':'%'+_0x4cb72d['query'][_0xb668('0xbe')]+'%'};return _0x2b100f;})});}if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0x7b')]){var _0x5dc0fc=_0x4cb72d[_0xb668('0x3e')][_0xb668('0x7b')][_0xb668('0x34')](',');var _0x1fc825={};_0x1fc825[_0x5dc0fc[0x0]]={'$gte':moment(_0x5dc0fc[0x1])[_0xb668('0xbf')](_0xb668('0xc0'))};_0xaa6842[_0xb668('0x45')]=_[_0xb668('0x99')](_0xaa6842[_0xb668('0x45')],_0x1fc825);}_0xaa6842=_[_0xb668('0x99')]({},_0xaa6842,_0x4cb72d[_0xb668('0xb5')]);return db[_0xb668('0xbd')][_0xb668('0x24')]({'where':_0xaa6842[_0xb668('0x45')]})[_0xb668('0x2c')](function(_0x3ad326){_0x28692b[_0xb668('0x24')]=_0x3ad326;if(_0x4cb72d[_0xb668('0x3e')][_0xb668('0xc1')]){_0xaa6842[_0xb668('0xc2')]=[{'all':!![]}];}return db[_0xb668('0xbd')]['findAll'](_0xaa6842);})['then'](function(_0x5bc068){_0x28692b[_0xb668('0xb1')]=_0x5bc068;return _0x28692b;});}})[_0xb668('0x2c')](respondWithFilteredResult(_0xbfd89d,_0xaa6842))[_0xb668('0xb2')](handleError(_0xbfd89d,null));};exports[_0xb668('0xc3')]=function(_0x19b6bf,_0x56f9dc,_0x300c2d){return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x19b6bf[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x56f9dc,null))[_0xb668('0x2c')](function(_0x36bd15){if(_0x36bd15){return _0x36bd15[_0xb668('0xc4')](_0x19b6bf[_0xb668('0xb7')][_0xb668('0xba')],_[_0xb668('0xc5')](_0x19b6bf[_0xb668('0xb7')],[_0xb668('0xba'),'id'])||{})[_0xb668('0xc6')](function(){return db['Tag'][_0xb668('0xc7')]({'attributes':['id',_0xb668('0x2e'),'color'],'where':{'id':_0x19b6bf[_0xb668('0xb7')]['ids']}});})[_0xb668('0x2c')](function(_0x575f0b){socket[_0xb668('0xc8')](_0xb668('0xc9'),{'id':Number(_0x19b6bf[_0xb668('0xb8')]['id']),'tags':_0x575f0b||[]});return{'id':Number(_0x19b6bf[_0xb668('0xb8')]['id']),'tags':_0x575f0b||[]};});}})[_0xb668('0x2c')](respondWithResult(_0x56f9dc,null))[_0xb668('0xb2')](handleError(_0x56f9dc,null));};exports[_0xb668('0xca')]=function(_0x304e6c,_0x5a4fb7,_0x26ccbb){return db['FaxInteraction'][_0xb668('0x68')]({'where':{'id':_0x304e6c[_0xb668('0xb8')]['id']}})[_0xb668('0x2c')](handleEntityNotFound(_0x5a4fb7,null))[_0xb668('0x2c')](function(_0x42a8c7){if(_0x42a8c7){return _0x42a8c7[_0xb668('0xca')](_0x304e6c['query'][_0xb668('0xba')]);}})['then'](respondWithStatusCode(_0x5a4fb7,null))[_0xb668('0xb2')](handleError(_0x5a4fb7,null));};exports[_0xb668('0xcb')]=function(_0x3a0ffe,_0x103031){var _0x11bcde=moment()[_0xb668('0xcc')]()['toString']();var _0x3dc283=path[_0xb668('0xcd')](config[_0xb668('0xce')],_0xb668('0xcf'),_0xb668('0xd0'),'tmp');var _0x32b1f8=path[_0xb668('0xcd')](config['root'],_0xb668('0xcf'),_0xb668('0xd0'),_0xb668('0xd1'));var _0x80faf3=path[_0xb668('0xcd')](_0x3dc283,_0x11bcde);var _0xf0c5d8=util[_0xb668('0xbf')](_0xb668('0xd2'),_0x3a0ffe[_0xb668('0xb8')]['id'],_0x11bcde);var _0x1ee2c4=path[_0xb668('0xcd')](_0x3dc283,_0xf0c5d8);var _0x36727=[];_0x36727[_0xb668('0x36')]({'model':db[_0xb668('0xd3')],'as':_0xb668('0xd3'),'raw':!![]});var _0x1a63f6=[{'model':db[_0xb668('0xbd')],'as':_0xb668('0xd4'),'attributes':['id',_0xb668('0xb7'),'createdAt'],'include':_0x36727}];return db[_0xb668('0x38')][_0xb668('0x68')]({'where':{'id':_0x3a0ffe[_0xb668('0xb8')]['id']},'include':_0x1a63f6})['then'](handleEntityNotFound(_0x103031,null))[_0xb668('0x2c')](function(_0x1e45e1){if(_0x1e45e1&&_0x1e45e1['Messages']){var _0x5f4484=_0x1e45e1[_0xb668('0xd5')]({'plain':!![]});fs['mkdirSync'](_0x80faf3);for(var _0x569d78=0x0;_0x569d78<_0x5f4484[_0xb668('0xd4')][_0xb668('0x3f')];_0x569d78++){var _0x33c1a5=_0x5f4484[_0xb668('0xd4')][_0x569d78][_0xb668('0xd3')];if(_0x33c1a5){var _0xab7055=path[_0xb668('0xcd')](_0x32b1f8,_0x33c1a5[_0xb668('0xd6')]);if(fs[_0xb668('0xd7')](_0xab7055)){fs[_0xb668('0xd8')](_0xab7055)[_0xb668('0xd9')](fs[_0xb668('0xda')](path[_0xb668('0xcd')](_0x80faf3,_0x33c1a5[_0xb668('0xd6')])));}}}return BPromise[_0xb668('0x8f')]()[_0xb668('0x2c')](function(){return new BPromise(function(_0xea4b26,_0x2f9cfa){zipdir(_0x80faf3,{'saveTo':_0x1ee2c4},function(_0x6993f9,_0x5f31be){if(_0x6993f9)return _0x2f9cfa(_0x6993f9);return _0xea4b26(_0x5f31be);});})[_0xb668('0x2c')](function(){return new BPromise(function(_0x4ff2e4,_0x3d6b97){rimraf(_0x80faf3,function(_0x70e3f2){if(_0x70e3f2)_0x3d6b97(_0x70e3f2);return _0x4ff2e4();});});})[_0xb668('0x2c')](function(){return _0x103031[_0xb668('0xcb')](_0x1ee2c4,_0xf0c5d8,function(_0x39bbe6){if(_0x39bbe6){console[_0xb668('0xdb')](_0xb668('0xdc'),_0x39bbe6);}else{fs['unlinkSync'](_0x1ee2c4);}});});});}else{return _0x103031['sendStatus'](0xc8);}})[_0xb668('0xb2')](handleError(_0x103031,null));}; \ No newline at end of file +var _0xee5b=['i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','rawAttributes','includeAll','options','FaxInteraction','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','join','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','then','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','catch','index','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','start','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1a1052,_0x46d9af){_0x1a1052=_0x1a1052-0x0;var _0x31708a=_0xee5b[_0x1a1052];return _0x31708a;};'use strict';var pdf=require(_0xbee5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbee5('0x1'));var zipdir=require(_0xbee5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbee5('0x3'));var moment=require(_0xbee5('0x4'));var BPromise=require(_0xbee5('0x5'));var Mustache=require(_0xbee5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbee5('0x7'));var csv=require(_0xbee5('0x8'));var ejs=require(_0xbee5('0x9'));var fs=require('fs');var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];config[_0xbee5('0x17')]=_['defaults'](config[_0xbee5('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbee5('0x18'))(new Redis(config[_0xbee5('0x17')]));require(_0xbee5('0x19'))['register'](socket);function respondWithStatusCode(_0x5092f2,_0x3c6e56){_0x3c6e56=_0x3c6e56||0xcc;return function(_0x4cf5a8){if(_0x4cf5a8){return _0x5092f2[_0xbee5('0x1a')](_0x3c6e56);}return _0x5092f2['status'](_0x3c6e56)[_0xbee5('0x1b')]();};}function respondWithResult(_0x141878,_0xf676b1){_0xf676b1=_0xf676b1||0xc8;return function(_0x53b269){if(_0x53b269){return _0x141878[_0xbee5('0x1c')](_0xf676b1)[_0xbee5('0x1d')](_0x53b269);}};}function respondWithFilteredResult(_0x5a0ae5,_0x254dd3){return function(_0x538460){if(_0x538460){var _0x11b4a3=_0x538460[_0xbee5('0x1e')],_0x3c3f4e=_0x254dd3[_0xbee5('0x1f')],_0x35eb5c=_0x254dd3[_0xbee5('0x1f')]+_0x254dd3[_0xbee5('0x20')],_0xac51f5;if(_0x35eb5c>=_0x11b4a3){_0x35eb5c=_0x11b4a3;_0xac51f5=0xc8;}else{_0xac51f5=0xce;}_0x5a0ae5[_0xbee5('0x1c')](_0xac51f5);return _0x5a0ae5[_0xbee5('0x21')](_0xbee5('0x22'),_0x3c3f4e+'-'+_0x35eb5c+'/'+_0x11b4a3)[_0xbee5('0x1d')](_0x538460);}return null;};}function patchUpdates(_0x450824){return function(_0x47af8e){try{jsonpatch['apply'](_0x47af8e,_0x450824,!![]);}catch(_0x469a7a){return BPromise['reject'](_0x469a7a);}return _0x47af8e[_0xbee5('0x23')]();};}function saveUpdates(_0x117cb3,_0x3cee7f){return function(_0x2bfb0f){if(_0x2bfb0f){return _0x2bfb0f[_0xbee5('0x24')](_0x117cb3)[_0xbee5('0x25')](function(_0x359ccf){return _0x359ccf;});}return null;};}function removeEntity(_0x3cfa8d,_0xc79035){return function(_0x520c02){if(_0x520c02){return _0x520c02['destroy']()['then'](function(){_0x3cfa8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af3de,_0x18d7f4){return function(_0x3b84c8){if(!_0x3b84c8){_0x1af3de[_0xbee5('0x1a')](0x194);}return _0x3b84c8;};}function handleError(_0x169042,_0x20e7e8){_0x20e7e8=_0x20e7e8||0x1f4;return function(_0x3c8643){logger['error'](_0x3c8643[_0xbee5('0x26')]);if(_0x3c8643[_0xbee5('0x27')]){delete _0x3c8643[_0xbee5('0x27')];}_0x169042[_0xbee5('0x1c')](_0x20e7e8)[_0xbee5('0x28')](_0x3c8643);};}function getInteractionUsers(_0x5f0419,_0x21b993){return new BPromise(function(_0x15ffb1,_0xb7a077){try{if(_0x21b993[_0x5f0419['id']]){_0x5f0419[_0xbee5('0x29')]=_[_0xbee5('0x2a')](_0x21b993[_0x5f0419['id']],function(_0x26abe3){return{'id':_0x26abe3['id'],'fullname':_0x26abe3[_0xbee5('0x2b')]};});}}catch(_0x36e8bb){_0xb7a077(_0x36e8bb);}_0x15ffb1(_0x5f0419);});}function getInteractionTags(_0x2ccb91,_0x59c2e4){return new BPromise(function(_0x22df5f,_0x5b10a6){try{if(_0x2ccb91[_0xbee5('0x2c')]){_0x2ccb91['Tags']=[];_0x2ccb91[_0xbee5('0x2c')]['split'](',')[_0xbee5('0x2d')](function(_0x5c1109){_0x2ccb91[_0xbee5('0x2e')][_0xbee5('0x2f')](_0x59c2e4[_0x5c1109]);});}delete _0x2ccb91[_0xbee5('0x2c')];}catch(_0x751489){_0x5b10a6(_0x751489);}_0x22df5f(_0x2ccb91);});}function updateFaxInteraction(_0x502e55,_0xefbf7c,_0x17aa8d){return new BPromise(function(_0x477a03,_0x1c78cc){return getInteractionUsers(_0x502e55,_0x17aa8d)['then'](function(_0x24aed0){return getInteractionTags(_0x24aed0,_0xefbf7c);})[_0xbee5('0x25')](function(_0x23ce3f){_0x477a03(_0x23ce3f);})[_0xbee5('0x30')](function(_0x4c3428){_0x1c78cc(_0x4c3428);});});}exports[_0xbee5('0x31')]=function(_0xe61341,_0x3e854){var _0x33aaba={},_0x52ecf1={},_0x3c8a87={'count':0x0,'rows':[]};var _0x59cacb=_[_0xbee5('0x2a')](db['FaxInteraction']['rawAttributes'],function(_0x59bf49){return{'name':_0x59bf49[_0xbee5('0x32')],'type':_0x59bf49[_0xbee5('0x33')][_0xbee5('0x34')]};});_0x52ecf1[_0xbee5('0x35')]=_[_0xbee5('0x2a')](_0x59cacb,_0xbee5('0x27'));_0x52ecf1[_0xbee5('0x36')]=_[_0xbee5('0x37')](_0xe61341['query']);_0x52ecf1[_0xbee5('0x38')]=_['intersection'](_0x52ecf1[_0xbee5('0x35')],_0x52ecf1[_0xbee5('0x36')]);_0x33aaba[_0xbee5('0x39')]=_[_0xbee5('0x3a')](_0x52ecf1['model'],qs[_0xbee5('0x3b')](_0xe61341['query']['fields']));_0x33aaba[_0xbee5('0x39')]=_0x33aaba[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x33aaba[_0xbee5('0x39')]:_0x52ecf1['model'];if(!_0xe61341[_0xbee5('0x36')][_0xbee5('0x3d')](_0xbee5('0x3e'))){_0x33aaba[_0xbee5('0x20')]=qs[_0xbee5('0x20')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x20')]);_0x33aaba[_0xbee5('0x1f')]=qs[_0xbee5('0x1f')](_0xe61341[_0xbee5('0x36')]['offset']);}_0x33aaba[_0xbee5('0x3f')]=qs[_0xbee5('0x40')](_0xe61341['query'][_0xbee5('0x40')]);_0x33aaba[_0xbee5('0x41')]=qs[_0xbee5('0x38')](_[_0xbee5('0x42')](_0xe61341['query'],_0x52ecf1['filters']),_0x59cacb);var _0x4b4641=[];var _0x138a40=squel[_0xbee5('0x43')]()[_0xbee5('0x44')]('id')[_0xbee5('0x44')](_0xbee5('0x27'))[_0xbee5('0x44')](_0xbee5('0x45'))[_0xbee5('0x46')](_0xbee5('0x47'));var _0x5ee32c=squel['select']()[_0xbee5('0x44')]('u.id')[_0xbee5('0x44')](_0xbee5('0x48'))['field'](_0xbee5('0x49'))[_0xbee5('0x46')]('user_has_fax_interactions','ui')['left_join'](_0xbee5('0x4a'),'u',_0xbee5('0x4b'));var _0x496872=squel[_0xbee5('0x43')]()[_0xbee5('0x46')]('fax_interactions','i')[_0xbee5('0x4c')](_0xbee5('0x4d'),'c',_0xbee5('0x4e'))[_0xbee5('0x4c')](_0xbee5('0x4a'),'o',_0xbee5('0x4f'))[_0xbee5('0x4c')]('fax_accounts','a',_0xbee5('0x50'))[_0xbee5('0x4c')](_0xbee5('0x51'),'me',_0xbee5('0x52'))['left_join'](_0xbee5('0x53'),'it',_0xbee5('0x54'))[_0xbee5('0x4c')]('tools_tags','t',_0xbee5('0x55'));var _0xf637bf=squel['expr']();var _0x5a6cc2=[];var _0x54a570=squel[_0xbee5('0x56')]();var _0x501167;if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x57')]){_0x501167=as[_0xbee5('0x58')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x57')]);var _0x296fc8=_0x501167['sqlOperator'];for(var _0x24274d=0x0;_0x24274d<_0x501167[_0xbee5('0x59')][_0xbee5('0x3c')];_0x24274d++){var _0x2479f6=_0x501167['conditions'][_0x24274d];var _0x98b160='i';var _0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,[_0xbee5('0x27'),_0x2479f6[_0xbee5('0x44')]]);if(!_0x594dcf){switch(_0x2479f6[_0xbee5('0x44')]){case _0xbee5('0x5b'):if(_0x2479f6[_0xbee5('0x5c')]==0x1){_0x496872[_0xbee5('0x5d')]('`'+_0x2479f6[_0xbee5('0x44')]+_0xbee5('0x5e'));}else{_0x496872[_0xbee5('0x5d')]('`'+_0x2479f6[_0xbee5('0x44')]+_0xbee5('0x5f'));}break;case _0xbee5('0x60'):if(_0x2479f6[_0xbee5('0x61')]===_0xbee5('0x62')){if(_0x2479f6['value'][_0xbee5('0x63')]('\x20')[_0xbee5('0x3c')]>0x1){_0xf637bf[_0x296fc8](_0xbee5('0x64'),qs['getFullTextValue'](_0x2479f6[_0xbee5('0x5c')]),null);}else{var _0x1b753a='%'+_0x2479f6[_0xbee5('0x5c')]+'%';_0xf637bf[_0x296fc8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b753a,_0x1b753a,_0x1b753a);}}else{_0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,['name',_0xbee5('0x65')]);_0x2479f6['field']=_0xbee5('0x65');_0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a['text'],_0x53cb9a['value']['start'],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x1b')]);}break;case _0xbee5('0x67'):var _0x5b1a05=_0x2479f6[_0xbee5('0x5c')]['split'](',')[_0xbee5('0x2a')](function(_0x33fbb8){return Number(_0x33fbb8);});_0x5b1a05[_0xbee5('0x2d')](function(_0x5cc68d){_0x54a570['or'](_0xbee5('0x68'),'%,'+_0x5cc68d+',%');});_0x5a6cc2=_[_0xbee5('0x69')](_0x5a6cc2,_0x5b1a05);break;case _0xbee5('0x6a'):if(_0x2479f6[_0xbee5('0x61')]===_0xbee5('0x62')){_0xf637bf[_0x296fc8](_0xbee5('0x6b'),'%'+_0x2479f6[_0xbee5('0x5c')]+'%',null);}else{_0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,[_0xbee5('0x27'),_0xbee5('0x6c')]);_0x2479f6[_0xbee5('0x44')]=_0xbee5('0x6c');_0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a[_0xbee5('0x6d')],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x6e')],_0x53cb9a['value'][_0xbee5('0x1b')]);}break;case'body':_0x53cb9a=as['buildExpression']('me',null,_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a[_0xbee5('0x6d')],_0x53cb9a[_0xbee5('0x5c')]['start'],_0x53cb9a['value'][_0xbee5('0x1b')]);break;}}else{var _0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a['text'],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x6e')],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x1b')]);}}}else{var _0x5107d3=_(_0xe61341[_0xbee5('0x36')])['keys']()[_0xbee5('0x2a')](function(_0x465ec8){return _['some'](_0x59cacb,[_0xbee5('0x27'),_0x465ec8])?_0x465ec8:undefined;})[_0xbee5('0x6f')]()['value']();if(!_[_0xbee5('0x70')](_0x5107d3)){_0x5107d3[_0xbee5('0x2d')](function(_0x4f431e){if(_0x4f431e===_0xbee5('0x71')){_0x496872['where'](_0xbee5('0x72'),[]['concat'](_0xe61341[_0xbee5('0x36')][_0x4f431e]));}else if(_0x4f431e==='createdAt'){var _0x541414=JSON[_0xbee5('0x73')](_0xe61341[_0xbee5('0x36')][_0x4f431e])[_0xbee5('0x74')];var _0x2f025c=JSON[_0xbee5('0x73')](_0xe61341[_0xbee5('0x36')][_0x4f431e])['$lte'];_0x496872[_0xbee5('0x41')](_0xbee5('0x75'),_0x541414,_0x2f025c);}else{if(_0xe61341[_0xbee5('0x36')][_0x4f431e]===_0xbee5('0x76')){_0x496872[_0xbee5('0x41')]('i.'+_0x4f431e+_0xbee5('0x77'));}else{_0x496872[_0xbee5('0x41')]('i.'+_0x4f431e+_0xbee5('0x78'),_0xe61341[_0xbee5('0x36')][_0x4f431e]);}}});}if(_0xe61341['query'][_0xbee5('0x79')]){if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x79')]==0x1){_0x496872[_0xbee5('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x496872[_0xbee5('0x5d')](_0xbee5('0x7a'));}}if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]){_0x5a6cc2=_[_0xbee5('0x7c')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')])?_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]:new Array(_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]);_0x5a6cc2[_0xbee5('0x2d')](function(_0x4f9431){_0x54a570['or'](_0xbee5('0x68'),'%,'+_0x4f9431+',%');});}if(_0xe61341[_0xbee5('0x36')]['filter']){var _0x3612ee=_0xe61341['query'][_0xbee5('0x7d')][_0xbee5('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xbee5('0x7f')](_0x3612ee)){_0xf637bf['or']('i.id\x20LIKE\x20?',_0x3612ee+'%')['or']('i.fax\x20LIKE\x20?',_0x3612ee+'%');}_0xf637bf['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3612ee+'%');}}_0x496872['where'](_0xf637bf);_0x496872['group']('i.id');var _0x14d5e4={'type':db[_0xbee5('0x80')][_0xbee5('0x81')][_0xbee5('0x82')],'raw':!![]};var _0x2284ac=_0x496872[_0xbee5('0x83')]();_0x2284ac[_0xbee5('0x44')](_0xbee5('0x84'));_0x2284ac[_0xbee5('0x44')](_0xbee5('0x85'),_0xbee5('0x5b'));if(_0x33aaba[_0xbee5('0x3f')]){_0x33aaba['order'][_0xbee5('0x2d')](function(_0x3196f9){var _0x56cff5=_0x3196f9[0x0]==='contactName'?_0x3196f9[0x0]:'i.'+_0x3196f9[0x0];_0x496872[_0xbee5('0x3f')](_0x56cff5,_0x3196f9[0x1]===_0xbee5('0x86')?![]:!![]);});}if(!_[_0xbee5('0x70')](_0x5a6cc2)){_0x496872['having'](_0x54a570);_0x2284ac[_0xbee5('0x41')](_0xbee5('0x87'),_0x5a6cc2);}BPromise[_0xbee5('0x88')]()['then'](function(){if(!_0x501167){if(_0xe61341['query']['FaxAccountId']||_0xe61341[_0xbee5('0x36')][_0xbee5('0x89')])return;_0x2284ac[_0xbee5('0x41')](_0xbee5('0x8a'));_0x496872[_0xbee5('0x41')](_0xbee5('0x8a'));return;}if(_0xe61341[_0xbee5('0x8b')][_0xbee5('0x8c')]!=='agent')return;return _0xe61341['user'][_0xbee5('0x8d')]({'attributes':['id'],'raw':!![]})[_0xbee5('0x25')](function(_0x554fae){if(_['isEmpty'](_0x554fae)){_0x2284ac[_0xbee5('0x41')]('i.FaxAccountId\x20IS\x20NULL');_0x496872['where'](_0xbee5('0x8e'));}else{_0x2284ac['where'](_0xbee5('0x72'),_[_0xbee5('0x2a')](_0x554fae,'id'));_0x496872['where'](_0xbee5('0x72'),_[_0xbee5('0x2a')](_0x554fae,'id'));}});})[_0xbee5('0x25')](function(){if(_0xe61341[_0xbee5('0x8b')][_0xbee5('0x8c')]==='agent'&&!_0x501167&&!_0xe61341['query'][_0xbee5('0x71')])return[];return db['sequelize'][_0xbee5('0x36')](_0x2284ac['toString'](),_0x14d5e4);})[_0xbee5('0x25')](function(_0x387032){_0x3c8a87[_0xbee5('0x1e')]=_0x387032[_0xbee5('0x3c')];if(_0x3c8a87[_0xbee5('0x1e')]===0x0)return[];return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x138a40[_0xbee5('0x90')](),_0x14d5e4)[_0xbee5('0x25')](function(_0xcd0388){_0x4b4641=_[_0xbee5('0x91')](_0xcd0388,'id');_0x14d5e4=_[_0xbee5('0x92')](_0x14d5e4,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x3b')]){_0x33aaba[_0xbee5('0x39')][_0xbee5('0x2d')](function(_0x4ecf47){_0x496872[_0xbee5('0x44')]('i.'+_0x4ecf47);});}else{_0x496872[_0xbee5('0x44')](_0xbee5('0x85'),_0xbee5('0x5b'));_0x496872[_0xbee5('0x44')](_0xbee5('0x93'),_0xbee5('0x94'));_0x496872[_0xbee5('0x44')]('a.mandatoryDisposition',_0xbee5('0x95'));_0x496872[_0xbee5('0x44')](_0xbee5('0x96'),_0xbee5('0x97'));_0x496872[_0xbee5('0x44')](_0xbee5('0x98'));_0x496872[_0xbee5('0x44')](_0xbee5('0x99'),_0xbee5('0x9a'));_0x496872[_0xbee5('0x44')](_0xbee5('0x9b'),'Contact.lastName');_0x496872[_0xbee5('0x44')](_0xbee5('0x9c'),'Contact.email');_0x496872[_0xbee5('0x44')](_0xbee5('0x9d'),_0xbee5('0x9e'));_0x496872['field'](_0xbee5('0x9f'),_0xbee5('0xa0'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa1'),_0xbee5('0xa2'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa3'),_0xbee5('0xa4'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa5'),_0xbee5('0xa6'));_0x496872[_0xbee5('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbee5('0x2c'));}if(_0x33aaba['limit'])_0x496872['limit'](_0x33aaba[_0xbee5('0x20')]);if(_0x33aaba[_0xbee5('0x1f')])_0x496872['offset'](_0x33aaba['offset']);return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x496872[_0xbee5('0x90')](),_0x14d5e4);})[_0xbee5('0x25')](function(_0x317712){_0x5ee32c[_0xbee5('0x41')](_0xbee5('0xa7'),_['map'](_0x317712,'id'));return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x5ee32c[_0xbee5('0x90')](),_0x14d5e4)[_0xbee5('0x25')](function(_0x595e0d){var _0x2b4752=_[_0xbee5('0xa8')](_0x595e0d,_0xbee5('0xa9'));var _0x4cade8=[];_0x317712['forEach'](function(_0x4b4c2f){_0x4cade8[_0xbee5('0x2f')](updateFaxInteraction(_0x4b4c2f,_0x4b4641,_0x2b4752));});return BPromise[_0xbee5('0xaa')](_0x4cade8);});});})[_0xbee5('0x25')](function(_0xbc2343){_0x3c8a87['rows']=_0xbc2343;return _0x3c8a87;})[_0xbee5('0x25')](respondWithFilteredResult(_0x3e854,_0x33aaba))[_0xbee5('0x30')](handleError(_0x3e854,null));};exports[_0xbee5('0xab')]=function(_0x4ec2fd,_0x7f76f6){var _0x51b28b={'raw':![],'where':{'id':_0x4ec2fd[_0xbee5('0xac')]['id']}},_0x41cae9={};_0x41cae9['model']=_['keys'](db['FaxInteraction'][_0xbee5('0xad')]);_0x41cae9['query']=_[_0xbee5('0x37')](_0x4ec2fd[_0xbee5('0x36')]);_0x41cae9['filters']=_['intersection'](_0x41cae9[_0xbee5('0x35')],_0x41cae9['query']);_0x51b28b[_0xbee5('0x39')]=_[_0xbee5('0x3a')](_0x41cae9[_0xbee5('0x35')],qs['fields'](_0x4ec2fd[_0xbee5('0x36')][_0xbee5('0x3b')]));_0x51b28b[_0xbee5('0x39')]=_0x51b28b[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x51b28b[_0xbee5('0x39')]:_0x41cae9['model'];if(_0x4ec2fd['query'][_0xbee5('0xae')]){_0x51b28b['include']=[{'all':!![]}];}_0x51b28b=_['merge']({},_0x51b28b,_0x4ec2fd[_0xbee5('0xaf')]);return db[_0xbee5('0xb0')][_0xbee5('0x5a')](_0x51b28b)[_0xbee5('0x25')](handleEntityNotFound(_0x7f76f6,null))[_0xbee5('0x25')](respondWithResult(_0x7f76f6,null))[_0xbee5('0x30')](handleError(_0x7f76f6,null));};exports[_0xbee5('0xb1')]=function(_0x5cfd5e,_0x4ec289){return db['FaxInteraction']['create'](_0x5cfd5e[_0xbee5('0xb2')],{})[_0xbee5('0x25')](respondWithResult(_0x4ec289,0xc9))[_0xbee5('0x30')](handleError(_0x4ec289,null));};exports['update']=function(_0x18b240,_0x477fb4){if(_0x18b240[_0xbee5('0xb2')]['id']){delete _0x18b240['body']['id'];}return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0x18b240[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x477fb4,null))[_0xbee5('0x25')](saveUpdates(_0x18b240['body'],null))['then'](respondWithResult(_0x477fb4,null))['catch'](handleError(_0x477fb4,null));};exports['destroy']=function(_0xecfee1,_0xbc3978){return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0xecfee1[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0xbc3978,null))[_0xbee5('0x25')](removeEntity(_0xbc3978,null))[_0xbee5('0x30')](handleError(_0xbc3978,null));};exports[_0xbee5('0xb3')]=function(_0x2bc246,_0x233228){return db['FaxInteraction'][_0xbee5('0xb3')]()[_0xbee5('0x25')](respondWithResult(_0x233228,null))[_0xbee5('0x30')](handleError(_0x233228,null));};exports[_0xbee5('0xb4')]=function(_0xbae6f5,_0x40a6ce,_0x29ae4f){return db[_0xbee5('0xb5')][_0xbee5('0x5a')]({'where':{'id':_0xbae6f5[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x40a6ce,null))[_0xbee5('0x25')](function(_0x2b076b){if(_0x2b076b){return _0x2b076b[_0xbee5('0xb4')](_0xbae6f5[_0xbee5('0xb2')][_0xbee5('0xb6')],_[_0xbee5('0xb7')](_0xbae6f5['body'],[_0xbee5('0xb6'),'id'])||{});}})[_0xbee5('0x25')](respondWithResult(_0x40a6ce,null))[_0xbee5('0x30')](handleError(_0x40a6ce,null));};exports[_0xbee5('0xb8')]=function(_0x5f25c9,_0x1acb5b,_0xab45a2){var _0x4c1b42={'raw':![],'where':{}};var _0xd6f063={};var _0x13ad75={'count':0x0,'rows':[]};return db[_0xbee5('0xb0')][_0xbee5('0xb9')]({'where':{'id':_0x5f25c9['params']['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x1acb5b,null))['then'](function(_0x13661e){if(_0x13661e){_0xd6f063[_0xbee5('0x35')]=_['keys'](db[_0xbee5('0xb5')][_0xbee5('0xad')]);_0xd6f063[_0xbee5('0x36')]=_['keys'](_0x5f25c9[_0xbee5('0x36')]);_0xd6f063['filters']=_[_0xbee5('0x3a')](_0xd6f063[_0xbee5('0x35')],_0xd6f063[_0xbee5('0x36')]);_0x4c1b42['attributes']=_['intersection'](_0xd6f063[_0xbee5('0x35')],qs['fields'](_0x5f25c9[_0xbee5('0x36')]['fields']));_0x4c1b42[_0xbee5('0x39')]=_0x4c1b42[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x4c1b42[_0xbee5('0x39')]:_0xd6f063[_0xbee5('0x35')];if(!_0x5f25c9['query'][_0xbee5('0x3d')](_0xbee5('0x3e'))){_0x4c1b42['limit']=qs['limit'](_0x5f25c9[_0xbee5('0x36')][_0xbee5('0x20')]);_0x4c1b42[_0xbee5('0x1f')]=qs['offset'](_0x5f25c9['query'][_0xbee5('0x1f')]);}_0x4c1b42['order']=qs[_0xbee5('0x40')](_0x5f25c9[_0xbee5('0x36')][_0xbee5('0x40')]);_0x4c1b42['where']=qs[_0xbee5('0x38')](_[_0xbee5('0x42')](_0x5f25c9[_0xbee5('0x36')],_0xd6f063['filters']));_0x4c1b42[_0xbee5('0x41')][_0xbee5('0xa9')]=_0x13661e['id'];if(_0x5f25c9['query']['filter']){_0x4c1b42['where']=_['merge'](_0x4c1b42[_0xbee5('0x41')],{'$or':_[_0xbee5('0x2a')](_0x4c1b42[_0xbee5('0x39')],function(_0x37deb0){var _0x3cb059={};_0x3cb059[_0x37deb0]={'$like':'%'+_0x5f25c9['query'][_0xbee5('0x7d')]+'%'};return _0x3cb059;})});}if(_0x5f25c9[_0xbee5('0x36')]['$gte']){var _0x368ede=_0x5f25c9[_0xbee5('0x36')]['$gte'][_0xbee5('0x63')](',');var _0x291a94={};_0x291a94[_0x368ede[0x0]]={'$gte':moment(_0x368ede[0x1])['format'](_0xbee5('0xba'))};_0x4c1b42[_0xbee5('0x41')]=_['merge'](_0x4c1b42[_0xbee5('0x41')],_0x291a94);}_0x4c1b42=_[_0xbee5('0x92')]({},_0x4c1b42,_0x5f25c9['options']);return db['FaxMessage'][_0xbee5('0x1e')]({'where':_0x4c1b42[_0xbee5('0x41')]})[_0xbee5('0x25')](function(_0xd61f78){_0x13ad75[_0xbee5('0x1e')]=_0xd61f78;if(_0x5f25c9['query'][_0xbee5('0xae')]){_0x4c1b42[_0xbee5('0xbb')]=[{'all':!![]}];}return db[_0xbee5('0xb5')][_0xbee5('0xbc')](_0x4c1b42);})[_0xbee5('0x25')](function(_0x2c64ed){_0x13ad75['rows']=_0x2c64ed;return _0x13ad75;});}})[_0xbee5('0x25')](respondWithFilteredResult(_0x1acb5b,_0x4c1b42))[_0xbee5('0x30')](handleError(_0x1acb5b,null));};exports[_0xbee5('0xbd')]=function(_0x33761d,_0x51d980,_0x214b20){return db[_0xbee5('0xb0')]['find']({'where':{'id':_0x33761d['params']['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x51d980,null))['then'](function(_0x5be1ca){if(_0x5be1ca){return _0x5be1ca[_0xbee5('0xbe')](_0x33761d['body'][_0xbee5('0xb6')],_[_0xbee5('0xb7')](_0x33761d[_0xbee5('0xb2')],[_0xbee5('0xb6'),'id'])||{})[_0xbee5('0xbf')](function(){return db[_0xbee5('0x67')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x33761d[_0xbee5('0xb2')][_0xbee5('0xb6')]}});})[_0xbee5('0x25')](function(_0x304444){socket['emit'](_0xbee5('0xc0'),{'id':Number(_0x33761d[_0xbee5('0xac')]['id']),'tags':_0x304444||[]});return{'id':Number(_0x33761d[_0xbee5('0xac')]['id']),'tags':_0x304444||[]};});}})[_0xbee5('0x25')](respondWithResult(_0x51d980,null))['catch'](handleError(_0x51d980,null));};exports[_0xbee5('0xc1')]=function(_0xfb815b,_0x39e261,_0x5e0e8a){return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0xfb815b[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x39e261,null))[_0xbee5('0x25')](function(_0x187f08){if(_0x187f08){return _0x187f08[_0xbee5('0xc1')](_0xfb815b[_0xbee5('0x36')][_0xbee5('0xb6')]);}})['then'](respondWithStatusCode(_0x39e261,null))['catch'](handleError(_0x39e261,null));};exports[_0xbee5('0xc2')]=function(_0x4f7522,_0x5b3427){var _0x4e8450=moment()[_0xbee5('0xc3')]()[_0xbee5('0x90')]();var _0x15f65b=path['join'](config[_0xbee5('0xc4')],'server',_0xbee5('0xc5'),_0xbee5('0xc6'));var _0x492b1a=path[_0xbee5('0xc7')](config[_0xbee5('0xc4')],'server','files',_0xbee5('0xc8'));var _0x329131=path['join'](_0x15f65b,_0x4e8450);var _0x58ed4d=util[_0xbee5('0xc9')](_0xbee5('0xca'),_0x4f7522[_0xbee5('0xac')]['id'],_0x4e8450);var _0x4cb4be=path['join'](_0x15f65b,_0x58ed4d);var _0x2f306a=[];_0x2f306a[_0xbee5('0x2f')]({'model':db['Attachment'],'as':_0xbee5('0xcb'),'raw':!![]});var _0x4f2b78=[{'model':db['FaxMessage'],'as':_0xbee5('0xcc'),'attributes':['id','body',_0xbee5('0xcd')],'include':_0x2f306a}];return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0x4f7522['params']['id']},'include':_0x4f2b78})['then'](handleEntityNotFound(_0x5b3427,null))[_0xbee5('0x25')](function(_0x36a752){if(_0x36a752&&_0x36a752[_0xbee5('0xcc')]){var _0x112b11=_0x36a752[_0xbee5('0xce')]({'plain':!![]});fs[_0xbee5('0xcf')](_0x329131);for(var _0xded122=0x0;_0xded122<_0x112b11[_0xbee5('0xcc')][_0xbee5('0x3c')];_0xded122++){var _0x41a7c0=_0x112b11[_0xbee5('0xcc')][_0xded122][_0xbee5('0xcb')];if(_0x41a7c0){var _0x4c9c43=path[_0xbee5('0xc7')](_0x492b1a,_0x41a7c0[_0xbee5('0xd0')]);if(fs[_0xbee5('0xd1')](_0x4c9c43)){fs['createReadStream'](_0x4c9c43)['pipe'](fs[_0xbee5('0xd2')](path[_0xbee5('0xc7')](_0x329131,_0x41a7c0[_0xbee5('0xd0')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4d0e6b,_0x186688){zipdir(_0x329131,{'saveTo':_0x4cb4be},function(_0x2616c3,_0x20dbd7){if(_0x2616c3)return _0x186688(_0x2616c3);return _0x4d0e6b(_0x20dbd7);});})[_0xbee5('0x25')](function(){return new BPromise(function(_0x242ff7,_0x487059){rimraf(_0x329131,function(_0x1fb664){if(_0x1fb664)_0x487059(_0x1fb664);return _0x242ff7();});});})['then'](function(){return _0x5b3427[_0xbee5('0xc2')](_0x4cb4be,_0x58ed4d,function(_0x4be85b){if(_0x4be85b){console[_0xbee5('0xd3')](_0xbee5('0xd4'),_0x4be85b);}else{fs[_0xbee5('0xd5')](_0x4cb4be);}});});});}else{return _0x5b3427['sendStatus'](0xc8);}})[_0xbee5('0x30')](handleError(_0x5b3427,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9bfc91d..36f3494 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(_0x582f9a,_0x4c8826){var _0x29e66b=function(_0x494b24){while(--_0x494b24){_0x582f9a['push'](_0x582f9a['shift']());}};_0x29e66b(++_0x4c8826);}(_0x7a54,0x106));var _0x47a5=function(_0x2855ab,_0x40ca01){_0x2855ab=_0x2855ab-0x0;var _0x349d96=_0x7a54[_0x2855ab];return _0x349d96;};'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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x2568ec,_0x46f182){var _0x4c67a4=function(_0x9bca75){while(--_0x9bca75){_0x2568ec['push'](_0x2568ec['shift']());}};_0x4c67a4(++_0x46f182);}(_0x1261,0x144));var _0x1126=function(_0x579121,_0x27e9e2){_0x579121=_0x579121-0x0;var _0x38a4ae=_0x1261[_0x579121];return _0x38a4ae;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f46904e..aaf991a 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 _0x6e3f=['exports','define','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxInteraction.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6e3f,0x124));var _0xf6e3=function(_0x986968,_0xa04b6d){_0x986968=_0x986968-0x0;var _0x9cd33c=_0x6e3f[_0x986968];return _0x9cd33c;};'use strict';var _=require('lodash');var util=require(_0xf6e3('0x0'));var logger=require(_0xf6e3('0x1'))(_0xf6e3('0x2'));var moment=require(_0xf6e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6e3('0x4'));var fs=require('fs');var path=require(_0xf6e3('0x5'));var rimraf=require('rimraf');var config=require(_0xf6e3('0x6'));var attributes=require(_0xf6e3('0x7'));module[_0xf6e3('0x8')]=function(_0x1f866a,_0x5d8582){return _0x1f866a[_0xf6e3('0x9')]('FaxInteraction',attributes,{'tableName':_0xf6e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31cb8a,_0x182386,_0x17665a){if(_0x31cb8a[_0xf6e3('0xb')](_0xf6e3('0xc'))){_0x31cb8a['closedAt']=moment()[_0xf6e3('0xd')](_0xf6e3('0xe'));}_0x17665a(null,_0x31cb8a);}}});}; \ No newline at end of file +var _0xa420=['lodash','util','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt','format'];(function(_0x57e415,_0x119437){var _0x56bde6=function(_0x3c3332){while(--_0x3c3332){_0x57e415['push'](_0x57e415['shift']());}};_0x56bde6(++_0x119437);}(_0xa420,0x179));var _0x0a42=function(_0xb18ca6,_0x19758f){_0xb18ca6=_0xb18ca6-0x0;var _0x199631=_0xa420[_0xb18ca6];return _0x199631;};'use strict';var _=require(_0x0a42('0x0'));var util=require(_0x0a42('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a42('0x2'));var fs=require('fs');var path=require(_0x0a42('0x3'));var rimraf=require(_0x0a42('0x4'));var config=require(_0x0a42('0x5'));var attributes=require(_0x0a42('0x6'));module[_0x0a42('0x7')]=function(_0x52ed53,_0x471d48){return _0x52ed53[_0x0a42('0x8')](_0x0a42('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507ef8,_0x3a53fa,_0x24513c){if(_0x507ef8[_0x0a42('0xa')]('closed')){_0x507ef8[_0x0a42('0xb')]=moment()[_0x0a42('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x24513c(null,_0x507ef8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6806040..7f4caa0 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 _0xd503=['client','redis','defaults','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0xd503,0x1c3));var _0x3d50=function(_0x5534ab,_0x3a0b77){_0x5534ab=_0x5534ab-0x0;var _0x3887cc=_0xd503[_0x5534ab];return _0x3887cc;};'use strict';var _=require(_0x3d50('0x0'));var util=require(_0x3d50('0x1'));var moment=require(_0x3d50('0x2'));var BPromise=require(_0x3d50('0x3'));var rs=require(_0x3d50('0x4'));var fs=require('fs');var Redis=require(_0x3d50('0x5'));var db=require(_0x3d50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d50('0x7'))(_0x3d50('0x8'));var config=require(_0x3d50('0x9'));var jayson=require(_0x3d50('0xa'));var client=jayson[_0x3d50('0xb')]['http']({'port':0x232a});config[_0x3d50('0xc')]=_[_0x3d50('0xd')](config[_0x3d50('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d50('0xe'))(new Redis(config[_0x3d50('0xc')]));require('./faxInteraction.socket')[_0x3d50('0xf')](socket);function respondWithRpcPromise(_0x1e7135,_0x32b9af,_0x45901e){return new BPromise(function(_0x3fbd21,_0x5e9be5){return client['request'](_0x1e7135,_0x45901e)[_0x3d50('0x10')](function(_0x5364bb){logger[_0x3d50('0x11')](_0x3d50('0x12'),_0x32b9af,'request\x20sent');logger[_0x3d50('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x32b9af,_0x3d50('0x14'),JSON['stringify'](_0x5364bb));if(_0x5364bb[_0x3d50('0x15')]){if(_0x5364bb[_0x3d50('0x15')]['code']===0x1f4){logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x5364bb[_0x3d50('0x15')]['message']);return _0x5e9be5(_0x5364bb[_0x3d50('0x15')][_0x3d50('0x16')]);}logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x5364bb[_0x3d50('0x15')]['message']);return _0x3fbd21(_0x5364bb[_0x3d50('0x15')]['message']);}else{logger[_0x3d50('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x32b9af,_0x3d50('0x14'));_0x3fbd21(_0x5364bb[_0x3d50('0x17')][_0x3d50('0x16')]);}})[_0x3d50('0x18')](function(_0x4d4945){logger[_0x3d50('0x15')](_0x3d50('0x12'),_0x32b9af,_0x4d4945);_0x5e9be5(_0x4d4945);});});}exports['UpdateFaxInteraction']=function(_0x2aa474){var _0x14fff3=this;return new Promise(function(_0x135f27,_0x580af7){return db[_0x3d50('0x19')][_0x3d50('0x1a')](_0x2aa474[_0x3d50('0x1b')],{'raw':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null,'attributes':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474['options'][_0x3d50('0x1f')]||null:null,'limit':_0x2aa474[_0x3d50('0x1c')]?_0x2aa474[_0x3d50('0x1c')][_0x3d50('0x20')]||null:null})[_0x3d50('0x10')](function(_0x14b839){logger[_0x3d50('0x11')](_0x3d50('0x21'),_0x2aa474);logger[_0x3d50('0x13')](_0x3d50('0x21'),_0x2aa474,JSON[_0x3d50('0x22')](_0x14b839));_0x135f27(_0x14b839);})['catch'](function(_0x30185e){logger[_0x3d50('0x15')](_0x3d50('0x21'),_0x30185e[_0x3d50('0x16')],_0x2aa474);_0x580af7(_0x14fff3[_0x3d50('0x15')](0x1f4,_0x30185e['message']));});});};exports[_0x3d50('0x23')]=function(_0x36a79e){return new Promise(function(_0xa85443,_0x3fbd53){return db[_0x3d50('0x19')][_0x3d50('0x24')]({'where':_0x36a79e[_0x3d50('0x1c')]?_0x36a79e[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null})[_0x3d50('0x10')](function(_0x5a59a0){if(_0x5a59a0){return _0x5a59a0[_0x3d50('0x25')](_0x36a79e[_0x3d50('0x1b')]['ids'],_[_0x3d50('0x26')](_0x36a79e[_0x3d50('0x1b')],[_0x3d50('0x27'),'id'])||{});}})[_0x3d50('0x28')](function(_0x466740){logger[_0x3d50('0x11')](_0x3d50('0x29'),_0x36a79e);logger[_0x3d50('0x13')]('AddTags',_0x36a79e,JSON['stringify'](_0x466740));_0xa85443(_0x466740);})[_0x3d50('0x18')](function(_0x39051e){logger[_0x3d50('0x15')](_0x3d50('0x29'),_0x39051e[_0x3d50('0x16')],_0x36a79e);_0x3fbd53(_this[_0x3d50('0x15')](0x1f4,_0x39051e[_0x3d50('0x16')]));});});}; \ No newline at end of file +var _0x5fbc=['limit','UpdateFaxInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','FaxInteraction','body','options','raw','where','attributes'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x5fbc,0xc9));var _0xc5fb=function(_0x319ef2,_0x199166){_0x319ef2=_0x319ef2-0x0;var _0x39dbb3=_0x5fbc[_0x319ef2];return _0x39dbb3;};'use strict';var _=require(_0xc5fb('0x0'));var util=require(_0xc5fb('0x1'));var moment=require(_0xc5fb('0x2'));var BPromise=require(_0xc5fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5fb('0x4'))['db'];var utils=require(_0xc5fb('0x5'));var logger=require(_0xc5fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc5fb('0x7'));var client=jayson[_0xc5fb('0x8')][_0xc5fb('0x9')]({'port':0x232a});config[_0xc5fb('0xa')]=_[_0xc5fb('0xb')](config[_0xc5fb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5fb('0xc'))(new Redis(config['redis']));require(_0xc5fb('0xd'))[_0xc5fb('0xe')](socket);function respondWithRpcPromise(_0x4b1bc6,_0x2b221f,_0x36aed8){return new BPromise(function(_0x42cc4d,_0x26b6f1){return client['request'](_0x4b1bc6,_0x36aed8)[_0xc5fb('0xf')](function(_0x4721fa){logger[_0xc5fb('0x10')](_0xc5fb('0x11'),_0x2b221f,'request\x20sent');logger[_0xc5fb('0x12')](_0xc5fb('0x13'),_0x2b221f,'request\x20sent',JSON[_0xc5fb('0x14')](_0x4721fa));if(_0x4721fa['error']){if(_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x16')]===0x1f4){logger['error'](_0xc5fb('0x11'),_0x2b221f,_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x17')]);return _0x26b6f1(_0x4721fa[_0xc5fb('0x15')]['message']);}logger[_0xc5fb('0x15')](_0xc5fb('0x11'),_0x2b221f,_0x4721fa['error'][_0xc5fb('0x17')]);return _0x42cc4d(_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x17')]);}else{logger['info'](_0xc5fb('0x11'),_0x2b221f,_0xc5fb('0x18'));_0x42cc4d(_0x4721fa[_0xc5fb('0x19')]['message']);}})[_0xc5fb('0x1a')](function(_0x253e67){logger[_0xc5fb('0x15')](_0xc5fb('0x11'),_0x2b221f,_0x253e67);_0x26b6f1(_0x253e67);});});}exports['UpdateFaxInteraction']=function(_0x463e9b){var _0x1e0b59=this;return new Promise(function(_0x221fe8,_0x423e3c){return db[_0xc5fb('0x1b')]['update'](_0x463e9b[_0xc5fb('0x1c')],{'raw':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463e9b['options']?_0x463e9b['options'][_0xc5fb('0x1f')]||null:null,'attributes':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x20')]||null:null,'limit':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x21')]||null:null})[_0xc5fb('0xf')](function(_0x1a9d58){logger[_0xc5fb('0x10')](_0xc5fb('0x22'),_0x463e9b);logger[_0xc5fb('0x12')](_0xc5fb('0x22'),_0x463e9b,JSON['stringify'](_0x1a9d58));_0x221fe8(_0x1a9d58);})[_0xc5fb('0x1a')](function(_0x4c654e){logger['error']('UpdateFaxInteraction',_0x4c654e[_0xc5fb('0x17')],_0x463e9b);_0x423e3c(_0x1e0b59[_0xc5fb('0x15')](0x1f4,_0x4c654e['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x206b9f){return new Promise(function(_0x1ec033,_0x5e2715){return db[_0xc5fb('0x1b')]['find']({'where':_0x206b9f[_0xc5fb('0x1d')]?_0x206b9f['options'][_0xc5fb('0x1f')]||null:null})[_0xc5fb('0xf')](function(_0x576b86){if(_0x576b86){return _0x576b86['addTags'](_0x206b9f[_0xc5fb('0x1c')][_0xc5fb('0x23')],_[_0xc5fb('0x24')](_0x206b9f[_0xc5fb('0x1c')],[_0xc5fb('0x23'),'id'])||{});}})[_0xc5fb('0x25')](function(_0x3f95a3){logger[_0xc5fb('0x10')](_0xc5fb('0x26'),_0x206b9f);logger[_0xc5fb('0x12')](_0xc5fb('0x26'),_0x206b9f,JSON[_0xc5fb('0x14')](_0x3f95a3));_0x1ec033(_0x3f95a3);})[_0xc5fb('0x1a')](function(_0x5035dc){logger['error'](_0xc5fb('0x26'),_0x5035dc[_0xc5fb('0x17')],_0x206b9f);_0x5e2715(_this[_0xc5fb('0x15')](0x1f4,_0x5035dc['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4a99291..a05c29a 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 _0x11ed=['emit','register','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x52fe1a,_0x52928b){var _0x4aff8b=function(_0x572ca8){while(--_0x572ca8){_0x52fe1a['push'](_0x52fe1a['shift']());}};_0x4aff8b(++_0x52928b);}(_0x11ed,0x99));var _0xd11e=function(_0x31ef2c,_0x554acc){_0x31ef2c=_0x31ef2c-0x0;var _0x49253a=_0x11ed[_0x31ef2c];return _0x49253a;};'use strict';var FaxInteractionEvents=require(_0xd11e('0x0'));var events=['save',_0xd11e('0x1'),_0xd11e('0x2')];function createListener(_0x5d8f1a,_0x3dcd8b){return function(_0x3da071){_0x3dcd8b[_0xd11e('0x3')](_0x5d8f1a,_0x3da071);};}function removeListener(_0x1a9f26,_0x13be90){return function(){FaxInteractionEvents['removeListener'](_0x1a9f26,_0x13be90);};}exports[_0xd11e('0x4')]=function(_0x148099){for(var _0x488bfc=0x0,_0x1d897f=events['length'];_0x488bfc<_0x1d897f;_0x488bfc++){var _0x25c8b5=events[_0x488bfc];var _0x3c92c6=createListener(_0xd11e('0x5')+_0x25c8b5,_0x148099);FaxInteractionEvents['on'](_0x25c8b5,_0x3c92c6);}}; \ No newline at end of file +var _0x375b=['update','emit','removeListener','register','length','save','remove'];(function(_0x5bbae4,_0x2a4a4e){var _0x338a50=function(_0x478845){while(--_0x478845){_0x5bbae4['push'](_0x5bbae4['shift']());}};_0x338a50(++_0x2a4a4e);}(_0x375b,0x124));var _0xb375=function(_0x135169,_0xd31f06){_0x135169=_0x135169-0x0;var _0x3f9034=_0x375b[_0x135169];return _0x3f9034;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xb375('0x0'),_0xb375('0x1'),_0xb375('0x2')];function createListener(_0x450619,_0x2c4307){return function(_0x4b97dd){_0x2c4307[_0xb375('0x3')](_0x450619,_0x4b97dd);};}function removeListener(_0x100f6a,_0x572514){return function(){FaxInteractionEvents[_0xb375('0x4')](_0x100f6a,_0x572514);};}exports[_0xb375('0x5')]=function(_0x3042e4){for(var _0x296a54=0x0,_0x28d898=events[_0xb375('0x6')];_0x296a54<_0x28d898;_0x296a54++){var _0x31cbf0=events[_0x296a54];var _0x18a945=createListener('faxInteraction:'+_0x31cbf0,_0x3042e4);FaxInteractionEvents['on'](_0x31cbf0,_0x18a945);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 159a95e..b75fbdb 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 _0xb688=['delete','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','addTags','put','fax','update'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0xb688,0xcf));var _0x8b68=function(_0x3707fb,_0x377dfb){_0x3707fb=_0x3707fb-0x0;var _0x4ad1f0=_0xb688[_0x3707fb];return _0x4ad1f0;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',auth[_0x8b68('0x9')](),controller['index']);router[_0x8b68('0x8')]('/describe',auth[_0x8b68('0x9')](),controller[_0x8b68('0xa')]);router[_0x8b68('0x8')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xc')]);router[_0x8b68('0x8')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xe')]);router[_0x8b68('0x8')](_0x8b68('0xf'),auth[_0x8b68('0x9')](),controller['download']);router[_0x8b68('0x10')]('/',auth[_0x8b68('0x9')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x10')](_0x8b68('0xd'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x12')]);router[_0x8b68('0x10')](_0x8b68('0x13'),auth['isAuthenticated'](),interaction[_0x8b68('0x14')]('fax','faxinteraction:addtags'),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')](_0x8b68('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x8b68('0x17'),'faxinteraction:update'),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')](_0x8b68('0xb'),auth[_0x8b68('0x9')](),interaction['tracked'](_0x8b68('0x17'),_0x8b68('0x1a')),controller['destroy']);router[_0x8b68('0x19')](_0x8b68('0x13'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x1b')]);module[_0x8b68('0x1c')]=router; \ No newline at end of file +var _0x9ffd=['download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','update','fax','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1c65c3,_0x3e2166){_0x1c65c3=_0x1c65c3-0x0;var _0xe4e4ae=_0x9ffd[_0x1c65c3];return _0xe4e4ae;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xd9ff('0x8')](_0xd9ff('0xf'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x10')]);router[_0xd9ff('0x11')]('/',auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x12')]);router[_0xd9ff('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x11')](_0xd9ff('0x14'),auth[_0xd9ff('0xb')](),interaction[_0xd9ff('0x15')]('fax',_0xd9ff('0x16')),controller[_0xd9ff('0x17')]);router['put'](_0xd9ff('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:update'),controller[_0xd9ff('0x18')]);router['delete'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),interaction[_0xd9ff('0x15')](_0xd9ff('0x19'),_0xd9ff('0x1a')),controller[_0xd9ff('0x1b')]);router[_0xd9ff('0x1c')](_0xd9ff('0x14'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x1d')]);module[_0xd9ff('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6e3c10e..00cb6fb 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 _0x3760=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x3760,0x1a9));var _0x0376=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x3760[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0376('0x0'));module[_0x0376('0x1')]={'body':{'type':Sequelize[_0x0376('0x2')](_0x0376('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0376('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0376('0x5')]('in',_0x0376('0x6')),'defaultValue':_0x0376('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0376('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0376('0x7')]}}; \ No newline at end of file +var _0x90f9=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x4b512e,_0xf538bd){var _0x4085d6=function(_0x29ad08){while(--_0x29ad08){_0x4b512e['push'](_0x4b512e['shift']());}};_0x4085d6(++_0xf538bd);}(_0x90f9,0xad));var _0x990f=function(_0x303d78,_0x8eeaea){_0x303d78=_0x303d78-0x0;var _0x5696b1=_0x90f9[_0x303d78];return _0x5696b1;};'use strict';var Sequelize=require('sequelize');module[_0x990f('0x0')]={'body':{'type':Sequelize[_0x990f('0x1')](_0x990f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x990f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x990f('0x4')]('in',_0x990f('0x5')),'defaultValue':_0x990f('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x990f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x990f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6f038ed..6de62c5 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 _0x8b9d=['jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','sendStatus','stack','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','update','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','Attachment','join','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket'];(function(_0x2adae8,_0x317544){var _0x352c88=function(_0x379022){while(--_0x379022){_0x2adae8['push'](_0x2adae8['shift']());}};_0x352c88(++_0x317544);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x1d8a06,_0x3c3804){_0x1d8a06=_0x1d8a06-0x0;var _0x28fa68=_0x8b9d[_0x1d8a06];return _0x28fa68;};'use strict';var pdf=require(_0xd8b9('0x0'));var emlformat=require(_0xd8b9('0x1'));var rimraf=require(_0xd8b9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8b9('0x4'));var util=require(_0xd8b9('0x5'));var path=require(_0xd8b9('0x6'));var sox=require(_0xd8b9('0x7'));var csv=require(_0xd8b9('0x8'));var ejs=require(_0xd8b9('0x9'));var fs=require('fs');var _=require(_0xd8b9('0xa'));var squel=require('squel');var crypto=require(_0xd8b9('0xb'));var jsforce=require(_0xd8b9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd8b9('0x8'));var querystring=require(_0xd8b9('0xd'));var Papa=require('papaparse');var Redis=require(_0xd8b9('0xe'));var authService=require(_0xd8b9('0xf'));var qs=require(_0xd8b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8b9('0x11'));var logger=require('../../config/logger')(_0xd8b9('0x12'));var utils=require(_0xd8b9('0x13'));var config=require(_0xd8b9('0x14'));var licenseUtil=require(_0xd8b9('0x15'));var db=require('../../mysqldb')['db'];config[_0xd8b9('0x16')]=_[_0xd8b9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd8b9('0x18'))(new Redis(config[_0xd8b9('0x16')]));require(_0xd8b9('0x19'))['register'](socket);var jayson=require(_0xd8b9('0x1a'));var client=jayson[_0xd8b9('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd8b9('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e610a,_0x1ea3d6,_0x5d1c56,_0x70d87c){return new BPromise(function(_0x15cf6f,_0x337212){var _0x11e549=_0x70d87c||client;return _0x11e549[_0xd8b9('0x1c')](_0x1e610a,_0x5d1c56)[_0xd8b9('0x1d')](function(_0x47e51e){logger[_0xd8b9('0x1e')](_0xd8b9('0x1f'),_0x1ea3d6,_0xd8b9('0x20'));logger['debug'](_0xd8b9('0x21'),_0x1ea3d6,_0xd8b9('0x20'),JSON[_0xd8b9('0x22')](_0x47e51e));if(_0x47e51e[_0xd8b9('0x23')]){if(_0x47e51e['error'][_0xd8b9('0x24')]===0x1f4){logger[_0xd8b9('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1ea3d6,_0x47e51e[_0xd8b9('0x23')]['message']);return _0x337212(_0x47e51e[_0xd8b9('0x23')]['message']);}logger[_0xd8b9('0x23')](_0xd8b9('0x1f'),_0x1ea3d6,_0x47e51e[_0xd8b9('0x23')][_0xd8b9('0x25')]);return _0x15cf6f(_0x47e51e['error'][_0xd8b9('0x25')]);}else{logger[_0xd8b9('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x1ea3d6,'request\x20sent');_0x15cf6f(_0x47e51e[_0xd8b9('0x26')]['message']);}})[_0xd8b9('0x27')](function(_0x2e537a){logger[_0xd8b9('0x23')](_0xd8b9('0x1f'),_0x1ea3d6,_0x2e537a);_0x337212(_0x2e537a);});});}function respondWithStatusCode(_0x31bcdb,_0x1aaa93){_0x1aaa93=_0x1aaa93||0xcc;return function(_0x2222b8){if(_0x2222b8){return _0x31bcdb['sendStatus'](_0x1aaa93);}return _0x31bcdb[_0xd8b9('0x28')](_0x1aaa93)[_0xd8b9('0x29')]();};}function respondWithResult(_0x5c9c12,_0x555f65){_0x555f65=_0x555f65||0xc8;return function(_0x257266){if(_0x257266){return _0x5c9c12[_0xd8b9('0x28')](_0x555f65)[_0xd8b9('0x2a')](_0x257266);}};}function respondWithFilteredResult(_0x5a20da,_0x10d6fd){return function(_0x134d1f){if(_0x134d1f){var _0x25ef8e=_0x134d1f[_0xd8b9('0x2b')],_0x4715b5=_0x10d6fd['offset'],_0x99563f=_0x10d6fd[_0xd8b9('0x2c')]+_0x10d6fd[_0xd8b9('0x2d')],_0x4afc30;if(_0x99563f>=_0x25ef8e){_0x99563f=_0x25ef8e;_0x4afc30=0xc8;}else{_0x4afc30=0xce;}_0x5a20da[_0xd8b9('0x28')](_0x4afc30);return _0x5a20da[_0xd8b9('0x2e')](_0xd8b9('0x2f'),_0x4715b5+'-'+_0x99563f+'/'+_0x25ef8e)['json'](_0x134d1f);}return null;};}function patchUpdates(_0x3e6304){return function(_0x56b858){try{jsonpatch[_0xd8b9('0x30')](_0x56b858,_0x3e6304,!![]);}catch(_0x38781a){return BPromise[_0xd8b9('0x31')](_0x38781a);}return _0x56b858['save']();};}function saveUpdates(_0x234bf0,_0x893951){return function(_0x1bd77b){if(_0x1bd77b){return _0x1bd77b['update'](_0x234bf0)[_0xd8b9('0x1d')](function(_0x231f38){return _0x231f38;});}return null;};}function removeEntity(_0x32f07f,_0x1603bf){return function(_0x31194d){if(_0x31194d){return _0x31194d['destroy']()[_0xd8b9('0x1d')](function(){_0x32f07f[_0xd8b9('0x28')](0xcc)[_0xd8b9('0x29')]();});}};}function handleEntityNotFound(_0x13bca2,_0x4e6b7a){return function(_0x496089){if(!_0x496089){_0x13bca2[_0xd8b9('0x32')](0x194);}return _0x496089;};}function handleError(_0x208f4c,_0x18606f){_0x18606f=_0x18606f||0x1f4;return function(_0x1872df){logger[_0xd8b9('0x23')](_0x1872df[_0xd8b9('0x33')]);if(_0x1872df['name']){delete _0x1872df['name'];}_0x208f4c[_0xd8b9('0x28')](_0x18606f)[_0xd8b9('0x34')](_0x1872df);};}exports[_0xd8b9('0x35')]=function(_0xbfe419,_0x728af0){var _0x357f36={},_0x68576e={},_0x2a0110={'count':0x0,'rows':[]};var _0x3b9388=_[_0xd8b9('0x36')](db[_0xd8b9('0x37')][_0xd8b9('0x38')],function(_0x439e53){return{'name':_0x439e53[_0xd8b9('0x39')],'type':_0x439e53[_0xd8b9('0x3a')][_0xd8b9('0x3b')]};});_0x68576e[_0xd8b9('0x3c')]=_[_0xd8b9('0x36')](_0x3b9388,_0xd8b9('0x3d'));_0x68576e['query']=_[_0xd8b9('0x3e')](_0xbfe419[_0xd8b9('0x3f')]);_0x68576e[_0xd8b9('0x40')]=_['intersection'](_0x68576e[_0xd8b9('0x3c')],_0x68576e[_0xd8b9('0x3f')]);_0x357f36[_0xd8b9('0x41')]=_[_0xd8b9('0x42')](_0x68576e[_0xd8b9('0x3c')],qs['fields'](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x43')]));_0x357f36['attributes']=_0x357f36[_0xd8b9('0x41')][_0xd8b9('0x44')]?_0x357f36['attributes']:_0x68576e[_0xd8b9('0x3c')];if(!_0xbfe419['query'][_0xd8b9('0x45')](_0xd8b9('0x46'))){_0x357f36[_0xd8b9('0x2d')]=qs[_0xd8b9('0x2d')](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x2d')]);_0x357f36[_0xd8b9('0x2c')]=qs[_0xd8b9('0x2c')](_0xbfe419['query'][_0xd8b9('0x2c')]);}_0x357f36['order']=qs[_0xd8b9('0x47')](_0xbfe419[_0xd8b9('0x3f')][_0xd8b9('0x47')]);_0x357f36[_0xd8b9('0x48')]=qs[_0xd8b9('0x40')](_[_0xd8b9('0x49')](_0xbfe419[_0xd8b9('0x3f')],_0x68576e[_0xd8b9('0x40')]),_0x3b9388);if(_0xbfe419['query'][_0xd8b9('0x4a')]){_0x357f36[_0xd8b9('0x48')]=_[_0xd8b9('0x4b')](_0x357f36[_0xd8b9('0x48')],{'$or':_[_0xd8b9('0x36')](_0x3b9388,function(_0x40fdd9){if(_0x40fdd9['type']!==_0xd8b9('0x4c')){var _0x1ba4b4={};_0x1ba4b4[_0x40fdd9['name']]={'$like':'%'+_0xbfe419['query']['filter']+'%'};return _0x1ba4b4;}})});}_0x357f36=_[_0xd8b9('0x4b')]({},_0x357f36,_0xbfe419[_0xd8b9('0x4d')]);var _0x2c6a4c={'where':_0x357f36[_0xd8b9('0x48')]};return db['FaxMessage'][_0xd8b9('0x2b')](_0x2c6a4c)[_0xd8b9('0x1d')](function(_0x25bc23){_0x2a0110[_0xd8b9('0x2b')]=_0x25bc23;if(_0xbfe419['query'][_0xd8b9('0x4e')]){_0x357f36[_0xd8b9('0x4f')]=[{'all':!![]}];}return db[_0xd8b9('0x37')][_0xd8b9('0x50')](_0x357f36);})[_0xd8b9('0x1d')](function(_0x42a1ab){_0x2a0110[_0xd8b9('0x51')]=_0x42a1ab;return _0x2a0110;})[_0xd8b9('0x1d')](respondWithFilteredResult(_0x728af0,_0x357f36))[_0xd8b9('0x27')](handleError(_0x728af0,null));};exports['show']=function(_0x42cff0,_0x2fcefd){var _0x4d1290={'raw':!![],'where':{'id':_0x42cff0[_0xd8b9('0x52')]['id']}},_0x5f508f={};_0x5f508f[_0xd8b9('0x3c')]=_[_0xd8b9('0x3e')](db[_0xd8b9('0x37')][_0xd8b9('0x38')]);_0x5f508f[_0xd8b9('0x3f')]=_['keys'](_0x42cff0[_0xd8b9('0x3f')]);_0x5f508f[_0xd8b9('0x40')]=_[_0xd8b9('0x42')](_0x5f508f[_0xd8b9('0x3c')],_0x5f508f['query']);_0x4d1290[_0xd8b9('0x41')]=_[_0xd8b9('0x42')](_0x5f508f[_0xd8b9('0x3c')],qs[_0xd8b9('0x43')](_0x42cff0[_0xd8b9('0x3f')][_0xd8b9('0x43')]));_0x4d1290[_0xd8b9('0x41')]=_0x4d1290[_0xd8b9('0x41')]['length']?_0x4d1290[_0xd8b9('0x41')]:_0x5f508f['model'];if(_0x42cff0['query'][_0xd8b9('0x4e')]){_0x4d1290[_0xd8b9('0x4f')]=[{'all':!![]}];}_0x4d1290=_[_0xd8b9('0x4b')]({},_0x4d1290,_0x42cff0['options']);return db[_0xd8b9('0x37')][_0xd8b9('0x53')](_0x4d1290)[_0xd8b9('0x1d')](handleEntityNotFound(_0x2fcefd,null))[_0xd8b9('0x1d')](respondWithResult(_0x2fcefd,null))[_0xd8b9('0x27')](handleError(_0x2fcefd,null));};exports[_0xd8b9('0x54')]=function(_0x59f769,_0x38125f){if(_0x59f769[_0xd8b9('0x55')]['id']){delete _0x59f769[_0xd8b9('0x55')]['id'];}return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x59f769[_0xd8b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x38125f,null))[_0xd8b9('0x1d')](saveUpdates(_0x59f769['body'],null))[_0xd8b9('0x1d')](respondWithResult(_0x38125f,null))['catch'](handleError(_0x38125f,null));};exports[_0xd8b9('0x56')]=function(_0x19f956,_0x287a26){return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x19f956['params']['id']}})[_0xd8b9('0x1d')](handleEntityNotFound(_0x287a26,null))[_0xd8b9('0x1d')](removeEntity(_0x287a26,null))['catch'](handleError(_0x287a26,null));};exports[_0xd8b9('0x57')]=function(_0x431076,_0x39d0ea){return db[_0xd8b9('0x37')][_0xd8b9('0x57')]()['then'](respondWithResult(_0x39d0ea,null))['catch'](handleError(_0x39d0ea,null));};var interaction_log=require('../../config/logger')(_0xd8b9('0x58'));exports[_0xd8b9('0x59')]=function(_0x59b020,_0xbc48e4,_0x2e6d7a){var _0x387a7e={'channel':_0xd8b9('0x5a')};if(_0x59b020['body']['id']){delete _0x59b020['body']['id'];}_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5b')]=!![];_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5c')]=moment()[_0xd8b9('0x5d')](_0xd8b9('0x5e'));_0x59b020[_0xd8b9('0x55')]['UserId']=_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x5f')]||_0x59b020[_0xd8b9('0x60')]['id'];return db[_0xd8b9('0x37')]['find']({'where':{'id':_0x59b020[_0xd8b9('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xd8b9('0x61')],'as':_0xd8b9('0x62')}]})[_0xd8b9('0x1d')](handleEntityNotFound(_0xbc48e4,null))[_0xd8b9('0x1d')](saveUpdates(_0x59b020[_0xd8b9('0x55')],null))[_0xd8b9('0x1d')](function(_0x4c8f37){if(_0x4c8f37){_0x387a7e[_0xd8b9('0x25')]=_0x4c8f37['get']({'plain':!![]});return db[_0xd8b9('0x63')][_0xd8b9('0x53')]({'where':{'id':_0x4c8f37[_0xd8b9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0xbc48e4,null))[_0xd8b9('0x1d')](function(_0x170ec1){if(_0x170ec1){return _0x170ec1['update']({'UserId':_0x59b020['body']['UserId'],'read1stAt':_[_0xd8b9('0x65')](_0x170ec1[_0xd8b9('0x66')])?moment()[_0xd8b9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd8b9('0x1d')](function(_0x58005d){if(_0x58005d){_0x387a7e[_0xd8b9('0x67')]=_0x58005d[_0xd8b9('0x68')]({'plain':!![]});interaction_log[_0xd8b9('0x1e')](_0xd8b9('0x69'),_0x59b020[_0xd8b9('0x60')]['id'],_0x59b020[_0xd8b9('0x60')]['name'],_0x59b020[_0xd8b9('0x60')]['role'],_0x387a7e[_0xd8b9('0x67')]['id'],_0x59b020[_0xd8b9('0x55')]?JSON[_0xd8b9('0x22')](_0x59b020[_0xd8b9('0x55')]):_0xd8b9('0x6a'));return respondWithRpcPromise(_0xd8b9('0x6b'),'acceptMessage',_0x387a7e);}return null;})['then'](function(_0x4345e6){if(_0x4345e6){if(_0x59b020[_0xd8b9('0x55')][_0xd8b9('0x6c')]){_0x387a7e['message'][_0xd8b9('0x6d')]=util[_0xd8b9('0x5d')](_0xd8b9('0x6e'),_0x59b020[_0xd8b9('0x60')][_0xd8b9('0x3d')]);_0x387a7e['message'][_0xd8b9('0x6f')]=_0x387a7e[_0xd8b9('0x6f')];_0x387a7e[_0xd8b9('0x25')][_0xd8b9('0x70')]=_0xd8b9('0x59');return respondWithRpcPromise(_0xd8b9('0x71'),_0xd8b9('0x71'),{'event':_0xd8b9('0x72'),'message':_0x387a7e[_0xd8b9('0x25')]},client9002)[_0xd8b9('0x1d')](function(){return _0x387a7e;});}return _0x387a7e;}return null;})[_0xd8b9('0x1d')](respondWithResult(_0xbc48e4,null))[_0xd8b9('0x27')](handleError(_0xbc48e4,null));};var interaction_log=require(_0xd8b9('0x73'))(_0xd8b9('0x58'));exports[_0xd8b9('0x31')]=function(_0x15ac81,_0x60dd2e,_0x230d9f){var _0x1fed05={'agent':{},'channel':_0xd8b9('0x5a')};if(_0x15ac81['body']['id']){delete _0x15ac81[_0xd8b9('0x55')]['id'];}_0x15ac81[_0xd8b9('0x55')]['UserId']=_0x15ac81[_0xd8b9('0x55')][_0xd8b9('0x5f')]||_0x15ac81[_0xd8b9('0x60')]['id'];_0x1fed05[_0xd8b9('0x74')]['id']=_0x15ac81[_0xd8b9('0x55')][_0xd8b9('0x5f')];return db['FaxMessage']['find']({'where':{'id':_0x15ac81[_0xd8b9('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x60dd2e,null))[_0xd8b9('0x1d')](function(_0x109c74){if(_0x109c74){_0x1fed05[_0xd8b9('0x25')]=_0x109c74[_0xd8b9('0x68')]({'plain':!![]});return db[_0xd8b9('0x63')]['find']({'where':{'id':_0x109c74[_0xd8b9('0x64')]}});}return null;})[_0xd8b9('0x1d')](handleEntityNotFound(_0x60dd2e,null))[_0xd8b9('0x1d')](function(_0x57c2cc){if(_0x57c2cc){_0x1fed05[_0xd8b9('0x67')]=_0x57c2cc[_0xd8b9('0x68')]({'plain':!![]});interaction_log[_0xd8b9('0x1e')](_0xd8b9('0x75'),_0x15ac81[_0xd8b9('0x60')]['id'],_0x15ac81['user']['name'],_0x15ac81[_0xd8b9('0x60')][_0xd8b9('0x76')],_0x1fed05[_0xd8b9('0x67')]['id'],_0x15ac81[_0xd8b9('0x55')]?JSON['stringify'](_0x15ac81[_0xd8b9('0x55')]):_0xd8b9('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1fed05);}return null;})['then'](function(_0x2b2921){if(_0x2b2921){_0x2b2921['message'][_0xd8b9('0x6d')]=util[_0xd8b9('0x5d')](_0xd8b9('0x6e'),_0x15ac81[_0xd8b9('0x60')][_0xd8b9('0x3d')]);_0x2b2921[_0xd8b9('0x25')][_0xd8b9('0x6f')]=_0x1fed05['channel'];_0x2b2921['message'][_0xd8b9('0x70')]=_0xd8b9('0x31');respondWithRpcPromise(_0xd8b9('0x71'),_0xd8b9('0x71'),{'event':_0xd8b9('0x77'),'message':_0x2b2921[_0xd8b9('0x25')]},client9002);return _0x1fed05;}return null;})[_0xd8b9('0x1d')](respondWithResult(_0x60dd2e,null))[_0xd8b9('0x27')](handleError(_0x60dd2e,null));};exports['create']=function(_0x43e84a,_0x564caf){var _0x38e977;return db[_0xd8b9('0x37')][_0xd8b9('0x78')](_0x43e84a[_0xd8b9('0x55')],{})[_0xd8b9('0x1d')](function(_0x4b9644){_0x38e977=_0x4b9644;return db[_0xd8b9('0x61')]['findOne']({'where':{'id':_0x38e977[_0xd8b9('0x79')]}});})[_0xd8b9('0x1d')](function(_0x30d45b){if(_['isNil'](_0x30d45b)){return;}else{_0x38e977['fax']=_0x30d45b[_0xd8b9('0x5a')];return db['Attachment'][_0xd8b9('0x7a')]({'where':{'id':_0x38e977[_0xd8b9('0x7b')]}});}})[_0xd8b9('0x1d')](function(_0x2598ae){return respondWithRpcPromise('SendFax',_0xd8b9('0x7c'),{'FaxAccountId':_[_0xd8b9('0x65')](_0x43e84a[_0xd8b9('0x55')])?undefined:_0x43e84a[_0xd8b9('0x55')]['FaxAccountId'],'path':_[_0xd8b9('0x65')](_0x2598ae)?undefined:util[_0xd8b9('0x5d')](_0xd8b9('0x7d'),_0x2598ae[_0xd8b9('0x7e')]),'fax':_[_0xd8b9('0x65')](_0x38e977[_0xd8b9('0x5a')])?undefined:_0x38e977['fax'],'AttachmentId':_0x38e977[_0xd8b9('0x7b')]},client9002);})[_0xd8b9('0x1d')](respondWithResult(_0x564caf,0xc9))[_0xd8b9('0x27')](handleError(_0x564caf,null));};exports[_0xd8b9('0x7f')]=function(_0x239f12,_0x1e79c4){var _0xfdcdda=path['join'](config[_0xd8b9('0x80')],'server',_0xd8b9('0x81'),'attachments');return db[_0xd8b9('0x37')][_0xd8b9('0x53')]({'where':{'id':_0x239f12[_0xd8b9('0x52')]['id']},'include':[{'model':db[_0xd8b9('0x82')],'as':_0xd8b9('0x82')}]})[_0xd8b9('0x1d')](handleEntityNotFound(_0x1e79c4,null))[_0xd8b9('0x1d')](function(_0x5f10a1){if(_0x5f10a1){return _0x1e79c4[_0xd8b9('0x7f')](path[_0xd8b9('0x83')](_0xfdcdda,_0x5f10a1[_0xd8b9('0x82')][_0xd8b9('0x7e')]));}})[_0xd8b9('0x27')](handleError(_0x1e79c4,null));}; \ No newline at end of file +var _0xc356=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','create','ContactId','AttachmentId','SendFax','FaxAccountId','format','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','end','status','offset','limit','set','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','length','includeAll','find','body','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt'];(function(_0x780921,_0x7c3eef){var _0x1536c6=function(_0x5b2c11){while(--_0x5b2c11){_0x780921['push'](_0x780921['shift']());}};_0x1536c6(++_0x7c3eef);}(_0xc356,0x11f));var _0x6c35=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xc356[_0x4063a4];return _0x17908d;};'use strict';var pdf=require(_0x6c35('0x0'));var emlformat=require(_0x6c35('0x1'));var rimraf=require(_0x6c35('0x2'));var zipdir=require(_0x6c35('0x3'));var jsonpatch=require(_0x6c35('0x4'));var rp=require(_0x6c35('0x5'));var moment=require(_0x6c35('0x6'));var BPromise=require(_0x6c35('0x7'));var Mustache=require('mustache');var util=require(_0x6c35('0x8'));var path=require('path');var sox=require(_0x6c35('0x9'));var csv=require(_0x6c35('0xa'));var ejs=require(_0x6c35('0xb'));var fs=require('fs');var _=require(_0x6c35('0xc'));var squel=require(_0x6c35('0xd'));var crypto=require(_0x6c35('0xe'));var jsforce=require(_0x6c35('0xf'));var deskjs=require(_0x6c35('0x10'));var toCsv=require(_0x6c35('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c35('0x11'));var qs=require(_0x6c35('0x12'));var as=require(_0x6c35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c35('0x14'))(_0x6c35('0x15'));var utils=require('../../config/utils');var config=require(_0x6c35('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6c35('0x17')](config['redis'],{'host':_0x6c35('0x18'),'port':0x18eb});var socket=require(_0x6c35('0x19'))(new Redis(config[_0x6c35('0x1a')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6c35('0x1b')][_0x6c35('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x6c35('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x29c7c5,_0x570efb,_0x10c390,_0x3ac5e6){return new BPromise(function(_0x7c402d,_0x122e76){var _0x4ec4f5=_0x3ac5e6||client;return _0x4ec4f5[_0x6c35('0x1d')](_0x29c7c5,_0x10c390)[_0x6c35('0x1e')](function(_0x45fc44){logger['info']('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x6c35('0x1f'));logger[_0x6c35('0x20')](_0x6c35('0x21'),_0x570efb,_0x6c35('0x1f'),JSON['stringify'](_0x45fc44));if(_0x45fc44[_0x6c35('0x22')]){if(_0x45fc44[_0x6c35('0x22')][_0x6c35('0x23')]===0x1f4){logger[_0x6c35('0x22')](_0x6c35('0x24'),_0x570efb,_0x45fc44[_0x6c35('0x22')][_0x6c35('0x25')]);return _0x122e76(_0x45fc44[_0x6c35('0x22')][_0x6c35('0x25')]);}logger[_0x6c35('0x22')]('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x45fc44['error'][_0x6c35('0x25')]);return _0x7c402d(_0x45fc44[_0x6c35('0x22')]['message']);}else{logger[_0x6c35('0x26')]('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x6c35('0x1f'));_0x7c402d(_0x45fc44[_0x6c35('0x27')]['message']);}})['catch'](function(_0x3bf970){logger[_0x6c35('0x22')](_0x6c35('0x24'),_0x570efb,_0x3bf970);_0x122e76(_0x3bf970);});});}function respondWithStatusCode(_0x3a700c,_0x2ba9d0){_0x2ba9d0=_0x2ba9d0||0xcc;return function(_0x340e92){if(_0x340e92){return _0x3a700c['sendStatus'](_0x2ba9d0);}return _0x3a700c['status'](_0x2ba9d0)[_0x6c35('0x28')]();};}function respondWithResult(_0x3c8c5d,_0xaa2ef6){_0xaa2ef6=_0xaa2ef6||0xc8;return function(_0x4d8457){if(_0x4d8457){return _0x3c8c5d[_0x6c35('0x29')](_0xaa2ef6)['json'](_0x4d8457);}};}function respondWithFilteredResult(_0x49847b,_0xbe6ea2){return function(_0x489c8e){if(_0x489c8e){var _0x51e80c=_0x489c8e['count'],_0x3b1449=_0xbe6ea2['offset'],_0x43fdd5=_0xbe6ea2[_0x6c35('0x2a')]+_0xbe6ea2[_0x6c35('0x2b')],_0x16338c;if(_0x43fdd5>=_0x51e80c){_0x43fdd5=_0x51e80c;_0x16338c=0xc8;}else{_0x16338c=0xce;}_0x49847b[_0x6c35('0x29')](_0x16338c);return _0x49847b[_0x6c35('0x2c')]('Content-Range',_0x3b1449+'-'+_0x43fdd5+'/'+_0x51e80c)['json'](_0x489c8e);}return null;};}function patchUpdates(_0x2e5170){return function(_0xd8a6de){try{jsonpatch[_0x6c35('0x2d')](_0xd8a6de,_0x2e5170,!![]);}catch(_0xb960fd){return BPromise[_0x6c35('0x2e')](_0xb960fd);}return _0xd8a6de['save']();};}function saveUpdates(_0x5bc6e4,_0x21ee73){return function(_0x5ab6b9){if(_0x5ab6b9){return _0x5ab6b9[_0x6c35('0x2f')](_0x5bc6e4)[_0x6c35('0x1e')](function(_0x1321c7){return _0x1321c7;});}return null;};}function removeEntity(_0x21e779,_0x523622){return function(_0xfbb1ff){if(_0xfbb1ff){return _0xfbb1ff[_0x6c35('0x30')]()['then'](function(){_0x21e779[_0x6c35('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec6bb,_0x4f3615){return function(_0xfcd8ff){if(!_0xfcd8ff){_0x3ec6bb[_0x6c35('0x31')](0x194);}return _0xfcd8ff;};}function handleError(_0x235afb,_0x4a2e82){_0x4a2e82=_0x4a2e82||0x1f4;return function(_0x386df2){logger[_0x6c35('0x22')](_0x386df2[_0x6c35('0x32')]);if(_0x386df2[_0x6c35('0x33')]){delete _0x386df2[_0x6c35('0x33')];}_0x235afb[_0x6c35('0x29')](_0x4a2e82)[_0x6c35('0x34')](_0x386df2);};}exports[_0x6c35('0x35')]=function(_0x256ffc,_0x12a3a3){var _0x50f124={},_0x472512={},_0x43fa6b={'count':0x0,'rows':[]};var _0x568035=_[_0x6c35('0x36')](db[_0x6c35('0x37')]['rawAttributes'],function(_0x10034d){return{'name':_0x10034d[_0x6c35('0x38')],'type':_0x10034d[_0x6c35('0x39')]['key']};});_0x472512[_0x6c35('0x3a')]=_[_0x6c35('0x36')](_0x568035,_0x6c35('0x33'));_0x472512[_0x6c35('0x3b')]=_[_0x6c35('0x3c')](_0x256ffc['query']);_0x472512['filters']=_[_0x6c35('0x3d')](_0x472512[_0x6c35('0x3a')],_0x472512[_0x6c35('0x3b')]);_0x50f124[_0x6c35('0x3e')]=_['intersection'](_0x472512[_0x6c35('0x3a')],qs[_0x6c35('0x3f')](_0x256ffc['query'][_0x6c35('0x3f')]));_0x50f124[_0x6c35('0x3e')]=_0x50f124[_0x6c35('0x3e')]['length']?_0x50f124[_0x6c35('0x3e')]:_0x472512[_0x6c35('0x3a')];if(!_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x40')]('nolimit')){_0x50f124[_0x6c35('0x2b')]=qs['limit'](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x2b')]);_0x50f124[_0x6c35('0x2a')]=qs[_0x6c35('0x2a')](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x2a')]);}_0x50f124[_0x6c35('0x41')]=qs[_0x6c35('0x42')](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x42')]);_0x50f124[_0x6c35('0x43')]=qs['filters'](_[_0x6c35('0x44')](_0x256ffc['query'],_0x472512[_0x6c35('0x45')]),_0x568035);if(_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x46')]){_0x50f124[_0x6c35('0x43')]=_[_0x6c35('0x47')](_0x50f124[_0x6c35('0x43')],{'$or':_[_0x6c35('0x36')](_0x568035,function(_0x171180){if(_0x171180[_0x6c35('0x39')]!==_0x6c35('0x48')){var _0x4f670c={};_0x4f670c[_0x171180['name']]={'$like':'%'+_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x46')]+'%'};return _0x4f670c;}})});}_0x50f124=_['merge']({},_0x50f124,_0x256ffc[_0x6c35('0x49')]);var _0xb8021={'where':_0x50f124[_0x6c35('0x43')]};return db[_0x6c35('0x37')][_0x6c35('0x4a')](_0xb8021)[_0x6c35('0x1e')](function(_0x554975){_0x43fa6b[_0x6c35('0x4a')]=_0x554975;if(_0x256ffc[_0x6c35('0x3b')]['includeAll']){_0x50f124[_0x6c35('0x4b')]=[{'all':!![]}];}return db[_0x6c35('0x37')][_0x6c35('0x4c')](_0x50f124);})[_0x6c35('0x1e')](function(_0x366632){_0x43fa6b['rows']=_0x366632;return _0x43fa6b;})[_0x6c35('0x1e')](respondWithFilteredResult(_0x12a3a3,_0x50f124))[_0x6c35('0x4d')](handleError(_0x12a3a3,null));};exports[_0x6c35('0x4e')]=function(_0x432172,_0x3dbb4b){var _0xd2e0e0={'raw':!![],'where':{'id':_0x432172['params']['id']}},_0xdef08e={};_0xdef08e['model']=_[_0x6c35('0x3c')](db[_0x6c35('0x37')]['rawAttributes']);_0xdef08e[_0x6c35('0x3b')]=_[_0x6c35('0x3c')](_0x432172['query']);_0xdef08e[_0x6c35('0x45')]=_[_0x6c35('0x3d')](_0xdef08e[_0x6c35('0x3a')],_0xdef08e[_0x6c35('0x3b')]);_0xd2e0e0[_0x6c35('0x3e')]=_[_0x6c35('0x3d')](_0xdef08e['model'],qs['fields'](_0x432172[_0x6c35('0x3b')][_0x6c35('0x3f')]));_0xd2e0e0[_0x6c35('0x3e')]=_0xd2e0e0['attributes'][_0x6c35('0x4f')]?_0xd2e0e0['attributes']:_0xdef08e[_0x6c35('0x3a')];if(_0x432172[_0x6c35('0x3b')][_0x6c35('0x50')]){_0xd2e0e0[_0x6c35('0x4b')]=[{'all':!![]}];}_0xd2e0e0=_['merge']({},_0xd2e0e0,_0x432172[_0x6c35('0x49')]);return db[_0x6c35('0x37')][_0x6c35('0x51')](_0xd2e0e0)[_0x6c35('0x1e')](handleEntityNotFound(_0x3dbb4b,null))['then'](respondWithResult(_0x3dbb4b,null))[_0x6c35('0x4d')](handleError(_0x3dbb4b,null));};exports[_0x6c35('0x2f')]=function(_0x177b24,_0x1305bb){if(_0x177b24[_0x6c35('0x52')]['id']){delete _0x177b24[_0x6c35('0x52')]['id'];}return db['FaxMessage'][_0x6c35('0x51')]({'where':{'id':_0x177b24[_0x6c35('0x53')]['id']}})['then'](handleEntityNotFound(_0x1305bb,null))[_0x6c35('0x1e')](saveUpdates(_0x177b24['body'],null))[_0x6c35('0x1e')](respondWithResult(_0x1305bb,null))[_0x6c35('0x4d')](handleError(_0x1305bb,null));};exports[_0x6c35('0x30')]=function(_0x38d57c,_0x279693){return db[_0x6c35('0x37')]['find']({'where':{'id':_0x38d57c['params']['id']}})[_0x6c35('0x1e')](handleEntityNotFound(_0x279693,null))['then'](removeEntity(_0x279693,null))['catch'](handleError(_0x279693,null));};exports[_0x6c35('0x54')]=function(_0x4cf40c,_0x1e365c){return db[_0x6c35('0x37')][_0x6c35('0x54')]()[_0x6c35('0x1e')](respondWithResult(_0x1e365c,null))[_0x6c35('0x4d')](handleError(_0x1e365c,null));};var interaction_log=require(_0x6c35('0x14'))(_0x6c35('0x55'));exports[_0x6c35('0x56')]=function(_0x5a57fe,_0x303c18,_0xa7110a){var _0x4d47a1={'channel':_0x6c35('0x57')};if(_0x5a57fe[_0x6c35('0x52')]['id']){delete _0x5a57fe[_0x6c35('0x52')]['id'];}_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x58')]=!![];_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x59')]=moment()['format'](_0x6c35('0x5a'));_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x5b')]=_0x5a57fe['body'][_0x6c35('0x5b')]||_0x5a57fe[_0x6c35('0x5c')]['id'];return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x5a57fe[_0x6c35('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6c35('0x5d')],'as':_0x6c35('0x5e')}]})[_0x6c35('0x1e')](handleEntityNotFound(_0x303c18,null))[_0x6c35('0x1e')](saveUpdates(_0x5a57fe['body'],null))['then'](function(_0x2f219d){if(_0x2f219d){_0x4d47a1[_0x6c35('0x25')]=_0x2f219d[_0x6c35('0x5f')]({'plain':!![]});return db[_0x6c35('0x60')][_0x6c35('0x51')]({'where':{'id':_0x2f219d[_0x6c35('0x61')]}});}return null;})[_0x6c35('0x1e')](handleEntityNotFound(_0x303c18,null))['then'](function(_0x445bc2){if(_0x445bc2){return _0x445bc2[_0x6c35('0x2f')]({'UserId':_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x5b')],'read1stAt':_[_0x6c35('0x62')](_0x445bc2[_0x6c35('0x63')])?moment()['format'](_0x6c35('0x5a')):undefined});}return null;})[_0x6c35('0x1e')](function(_0x38d5a2){if(_0x38d5a2){_0x4d47a1['interaction']=_0x38d5a2[_0x6c35('0x5f')]({'plain':!![]});interaction_log[_0x6c35('0x26')](_0x6c35('0x64'),_0x5a57fe[_0x6c35('0x5c')]['id'],_0x5a57fe[_0x6c35('0x5c')][_0x6c35('0x33')],_0x5a57fe[_0x6c35('0x5c')]['role'],_0x4d47a1['interaction']['id'],_0x5a57fe['body']?JSON['stringify'](_0x5a57fe[_0x6c35('0x52')]):_0x6c35('0x65'));return respondWithRpcPromise(_0x6c35('0x66'),'acceptMessage',_0x4d47a1);}return null;})[_0x6c35('0x1e')](function(_0x26de90){if(_0x26de90){if(_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x67')]){_0x4d47a1['message'][_0x6c35('0x68')]=util['format'](_0x6c35('0x69'),_0x5a57fe[_0x6c35('0x5c')]['name']);_0x4d47a1['message'][_0x6c35('0x6a')]=_0x4d47a1[_0x6c35('0x6a')];_0x4d47a1[_0x6c35('0x25')][_0x6c35('0x6b')]='accept';return respondWithRpcPromise(_0x6c35('0x6c'),_0x6c35('0x6c'),{'event':_0x6c35('0x6d'),'message':_0x4d47a1[_0x6c35('0x25')]},client9002)[_0x6c35('0x1e')](function(){return _0x4d47a1;});}return _0x4d47a1;}return null;})[_0x6c35('0x1e')](respondWithResult(_0x303c18,null))[_0x6c35('0x4d')](handleError(_0x303c18,null));};var interaction_log=require(_0x6c35('0x14'))(_0x6c35('0x55'));exports[_0x6c35('0x2e')]=function(_0x4c8847,_0x2658f6,_0x25bea8){var _0x3de82b={'agent':{},'channel':'fax'};if(_0x4c8847[_0x6c35('0x52')]['id']){delete _0x4c8847[_0x6c35('0x52')]['id'];}_0x4c8847[_0x6c35('0x52')][_0x6c35('0x5b')]=_0x4c8847['body'][_0x6c35('0x5b')]||_0x4c8847[_0x6c35('0x5c')]['id'];_0x3de82b[_0x6c35('0x6e')]['id']=_0x4c8847[_0x6c35('0x52')][_0x6c35('0x5b')];return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x4c8847[_0x6c35('0x53')]['id'],'UserId':null}})[_0x6c35('0x1e')](handleEntityNotFound(_0x2658f6,null))[_0x6c35('0x1e')](function(_0x4c7706){if(_0x4c7706){_0x3de82b[_0x6c35('0x25')]=_0x4c7706['get']({'plain':!![]});return db[_0x6c35('0x60')][_0x6c35('0x51')]({'where':{'id':_0x4c7706[_0x6c35('0x61')]}});}return null;})[_0x6c35('0x1e')](handleEntityNotFound(_0x2658f6,null))[_0x6c35('0x1e')](function(_0x5691e8){if(_0x5691e8){_0x3de82b[_0x6c35('0x6f')]=_0x5691e8[_0x6c35('0x5f')]({'plain':!![]});interaction_log[_0x6c35('0x26')](_0x6c35('0x70'),_0x4c8847[_0x6c35('0x5c')]['id'],_0x4c8847[_0x6c35('0x5c')][_0x6c35('0x33')],_0x4c8847['user'][_0x6c35('0x71')],_0x3de82b['interaction']['id'],_0x4c8847[_0x6c35('0x52')]?JSON['stringify'](_0x4c8847[_0x6c35('0x52')]):_0x6c35('0x65'));return respondWithRpcPromise(_0x6c35('0x72'),'rejectMessage',_0x3de82b);}return null;})['then'](function(_0x30ba4e){if(_0x30ba4e){_0x30ba4e[_0x6c35('0x25')]['interface']=util['format'](_0x6c35('0x69'),_0x4c8847[_0x6c35('0x5c')]['name']);_0x30ba4e['message']['channel']=_0x3de82b[_0x6c35('0x6a')];_0x30ba4e[_0x6c35('0x25')][_0x6c35('0x6b')]=_0x6c35('0x2e');respondWithRpcPromise(_0x6c35('0x6c'),'EventManager',{'event':_0x6c35('0x73'),'message':_0x30ba4e[_0x6c35('0x25')]},client9002);return _0x3de82b;}return null;})[_0x6c35('0x1e')](respondWithResult(_0x2658f6,null))[_0x6c35('0x4d')](handleError(_0x2658f6,null));};exports[_0x6c35('0x74')]=function(_0x441828,_0x391a75){var _0x158364;return db[_0x6c35('0x37')][_0x6c35('0x74')](_0x441828[_0x6c35('0x52')],{})[_0x6c35('0x1e')](function(_0x57754c){_0x158364=_0x57754c;return db[_0x6c35('0x5d')]['findOne']({'where':{'id':_0x158364[_0x6c35('0x75')]}});})[_0x6c35('0x1e')](function(_0x4e9052){if(_[_0x6c35('0x62')](_0x4e9052)){return;}else{_0x158364[_0x6c35('0x57')]=_0x4e9052[_0x6c35('0x57')];return db['Attachment']['findOne']({'where':{'id':_0x158364[_0x6c35('0x76')]}});}})[_0x6c35('0x1e')](function(_0x45dad5){return respondWithRpcPromise(_0x6c35('0x77'),_0x6c35('0x77'),{'FaxAccountId':_[_0x6c35('0x62')](_0x441828[_0x6c35('0x52')])?undefined:_0x441828[_0x6c35('0x52')][_0x6c35('0x78')],'path':_[_0x6c35('0x62')](_0x45dad5)?undefined:util[_0x6c35('0x79')](_0x6c35('0x7a'),_0x45dad5[_0x6c35('0x7b')]),'fax':_[_0x6c35('0x62')](_0x158364[_0x6c35('0x57')])?undefined:_0x158364[_0x6c35('0x57')],'AttachmentId':_0x158364['AttachmentId']},client9002);})[_0x6c35('0x1e')](respondWithResult(_0x391a75,0xc9))['catch'](handleError(_0x391a75,null));};exports['download']=function(_0x1ebceb,_0x3b5975){var _0x1c2f56=path[_0x6c35('0x7c')](config[_0x6c35('0x7d')],_0x6c35('0x7e'),'files',_0x6c35('0x7f'));return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x1ebceb[_0x6c35('0x53')]['id']},'include':[{'model':db[_0x6c35('0x80')],'as':_0x6c35('0x80')}]})['then'](handleEntityNotFound(_0x3b5975,null))['then'](function(_0x12d06b){if(_0x12d06b){return _0x3b5975['download'](path[_0x6c35('0x7c')](_0x1c2f56,_0x12d06b[_0x6c35('0x80')][_0x6c35('0x7b')]));}})[_0x6c35('0x4d')](handleError(_0x3b5975,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6804528..946f66c 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x55ca,0x126));var _0xa55c=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0x55ca[_0x5cb367];return _0x279365;};'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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x2735d8,_0x7c3cf){var _0x2f3654=function(_0x3862b9){while(--_0x3862b9){_0x2735d8['push'](_0x2735d8['shift']());}};_0x2f3654(++_0x7c3cf);}(_0x008c,0x188));var _0xc008=function(_0x40b241,_0x2ce6cc){_0x40b241=_0x40b241-0x0;var _0x22b4b1=_0x008c[_0x40b241];return _0x22b4b1;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3b45973..b433ad0 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 _0x17ca=['fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x6c58d2,_0x128b1f){var _0x541c56=function(_0x2cf1d3){while(--_0x2cf1d3){_0x6c58d2['push'](_0x6c58d2['shift']());}};_0x541c56(++_0x128b1f);}(_0x17ca,0x14a));var _0xa17c=function(_0x534555,_0x212763){_0x534555=_0x534555-0x0;var _0xbb8a35=_0x17ca[_0x534555];return _0xbb8a35;};'use strict';var _=require(_0xa17c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa17c('0x1'));var moment=require(_0xa17c('0x2'));var BPromise=require(_0xa17c('0x3'));var rp=require(_0xa17c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa17c('0x5'));var config=require('../../config/environment');var attributes=require(_0xa17c('0x6'));module[_0xa17c('0x7')]=function(_0x5840dd,_0x51f82d){return _0x5840dd[_0xa17c('0x8')](_0xa17c('0x9'),attributes,{'tableName':_0xa17c('0xa'),'paranoid':![],'indexes':[{'name':_0xa17c('0xb'),'fields':[_0xa17c('0xc')],'type':_0xa17c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f85c8,_0x439cfb,_0x5019f3){var _0x441f43=_0x5840dd[_0xa17c('0xe')];var _0x4de602=_0x3f85c8[_0xa17c('0xf')]({'plain':!![]});if(_0x4de602[_0xa17c('0x10')][_0xa17c('0x11')]()==='in'||_0x4de602[_0xa17c('0x10')]['toLowerCase']()===_0xa17c('0x12')&&!_0x4de602[_0xa17c('0x13')]&&!_[_0xa17c('0x14')](_0x4de602[_0xa17c('0x15')])){_0x441f43[_0xa17c('0x16')]['findOne']({'where':{'id':_0x4de602[_0xa17c('0x17')]}})[_0xa17c('0x18')](function(_0x488a84){if(_0x488a84){_0x488a84[_0xa17c('0x19')]({'lastMsgAt':_0x4de602[_0xa17c('0x1a')],'lastMsgDirection':_0x4de602[_0xa17c('0x10')][_0xa17c('0x11')]()});}})[_0xa17c('0x1b')](function(_0x528233){console[_0xa17c('0x1c')](_0x528233);});}_0x5019f3();}},'charset':_0xa17c('0x1d'),'collate':_0xa17c('0x1e')});}; \ No newline at end of file +var _0xa79f=['FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne'];(function(_0x599585,_0x1bc6bb){var _0x25d5ff=function(_0x3abc35){while(--_0x3abc35){_0x599585['push'](_0x599585['shift']());}};_0x25d5ff(++_0x1bc6bb);}(_0xa79f,0x77));var _0xfa79=function(_0x2205cc,_0x9f0d7d){_0x2205cc=_0x2205cc-0x0;var _0x29f7b4=_0xa79f[_0x2205cc];return _0x29f7b4;};'use strict';var _=require('lodash');var util=require(_0xfa79('0x0'));var logger=require(_0xfa79('0x1'))(_0xfa79('0x2'));var moment=require('moment');var BPromise=require(_0xfa79('0x3'));var rp=require(_0xfa79('0x4'));var fs=require('fs');var path=require(_0xfa79('0x5'));var rimraf=require('rimraf');var config=require(_0xfa79('0x6'));var attributes=require(_0xfa79('0x7'));module[_0xfa79('0x8')]=function(_0x3c8de9,_0x33b3e0){return _0x3c8de9['define'](_0xfa79('0x9'),attributes,{'tableName':_0xfa79('0xa'),'paranoid':![],'indexes':[{'name':_0xfa79('0xb'),'fields':['body'],'type':_0xfa79('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c1f78,_0x559b07,_0x2b64b7){var _0x1a5345=_0x3c8de9['models'];var _0x21e271=_0x4c1f78[_0xfa79('0xd')]({'plain':!![]});if(_0x21e271[_0xfa79('0xe')][_0xfa79('0xf')]()==='in'||_0x21e271[_0xfa79('0xe')][_0xfa79('0xf')]()===_0xfa79('0x10')&&!_0x21e271[_0xfa79('0x11')]&&!_[_0xfa79('0x12')](_0x21e271['UserId'])){_0x1a5345[_0xfa79('0x13')][_0xfa79('0x14')]({'where':{'id':_0x21e271[_0xfa79('0x15')]}})['then'](function(_0x25ffdd){if(_0x25ffdd){_0x25ffdd[_0xfa79('0x16')]({'lastMsgAt':_0x21e271[_0xfa79('0x17')],'lastMsgDirection':_0x21e271['direction'][_0xfa79('0xf')]()});}})[_0xfa79('0x18')](function(_0x7aedb){console[_0xfa79('0x19')](_0x7aedb);});}_0x2b64b7();}},'charset':_0xfa79('0x1a'),'collate':_0xfa79('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 309882f..2f136ef 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 _0x07a7=['http','redis','defaults','localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','stringify','UpdateFaxMessage','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x457993,_0x162e4f){var _0x207dc7=function(_0x37fd7d){while(--_0x37fd7d){_0x457993['push'](_0x457993['shift']());}};_0x207dc7(++_0x162e4f);}(_0x07a7,0x1b2));var _0x707a=function(_0x5575ec,_0x16fc90){_0x5575ec=_0x5575ec-0x0;var _0x248352=_0x07a7[_0x5575ec];return _0x248352;};'use strict';var _=require(_0x707a('0x0'));var util=require(_0x707a('0x1'));var moment=require(_0x707a('0x2'));var BPromise=require('bluebird');var rs=require(_0x707a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x707a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x707a('0x5'))(_0x707a('0x6'));var config=require(_0x707a('0x7'));var jayson=require(_0x707a('0x8'));var client=jayson[_0x707a('0x9')][_0x707a('0xa')]({'port':0x232a});config[_0x707a('0xb')]=_[_0x707a('0xc')](config[_0x707a('0xb')],{'host':_0x707a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x707a('0xb')]));require(_0x707a('0xe'))[_0x707a('0xf')](socket);function respondWithRpcPromise(_0x2679da,_0x4f9650,_0x29feb4){return new BPromise(function(_0x5e5249,_0x2664d7){return client[_0x707a('0x10')](_0x2679da,_0x29feb4)['then'](function(_0x1dd9f7){logger[_0x707a('0x11')](_0x707a('0x12'),_0x4f9650,_0x707a('0x13'));logger[_0x707a('0x14')](_0x707a('0x15'),_0x4f9650,_0x707a('0x13'),JSON['stringify'](_0x1dd9f7));if(_0x1dd9f7[_0x707a('0x16')]){if(_0x1dd9f7[_0x707a('0x16')][_0x707a('0x17')]===0x1f4){logger[_0x707a('0x16')]('FaxMessage,\x20%s,\x20%s',_0x4f9650,_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);return _0x2664d7(_0x1dd9f7['error']['message']);}logger[_0x707a('0x16')](_0x707a('0x12'),_0x4f9650,_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);return _0x5e5249(_0x1dd9f7[_0x707a('0x16')][_0x707a('0x18')]);}else{logger[_0x707a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4f9650,_0x707a('0x13'));_0x5e5249(_0x1dd9f7[_0x707a('0x19')][_0x707a('0x18')]);}})[_0x707a('0x1a')](function(_0x5cb1ad){logger[_0x707a('0x16')](_0x707a('0x12'),_0x4f9650,_0x5cb1ad);_0x2664d7(_0x5cb1ad);});});}exports['CreateFaxMessage']=function(_0x190bbd){var _0x2756c8=this;return new Promise(function(_0x44be2c,_0x3de2f6){return db[_0x707a('0x1b')][_0x707a('0x1c')](_0x190bbd[_0x707a('0x1d')],{'raw':_0x190bbd[_0x707a('0x1e')]?_0x190bbd['options'][_0x707a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x549f4d){logger[_0x707a('0x11')](_0x707a('0x20'),_0x190bbd);logger['debug'](_0x707a('0x20'),_0x190bbd,JSON[_0x707a('0x21')](_0x549f4d));_0x44be2c(_0x549f4d);})[_0x707a('0x1a')](function(_0x3b9020){logger[_0x707a('0x16')](_0x707a('0x20'),_0x3b9020[_0x707a('0x18')],_0x190bbd);_0x3de2f6(_0x2756c8[_0x707a('0x16')](0x1f4,_0x3b9020[_0x707a('0x18')]));});});};exports[_0x707a('0x22')]=function(_0x18ac3e){var _0x32d032=this;return new Promise(function(_0x48245b,_0x4c1f75){return db[_0x707a('0x1b')]['update'](_0x18ac3e[_0x707a('0x1d')],{'raw':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')]['where']||null:null,'attributes':_0x18ac3e['options']?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x23')]||null:null,'limit':_0x18ac3e[_0x707a('0x1e')]?_0x18ac3e[_0x707a('0x1e')][_0x707a('0x24')]||null:null})['then'](function(_0x293851){logger[_0x707a('0x11')](_0x707a('0x22'),_0x18ac3e);logger[_0x707a('0x14')]('UpdateFaxMessage',_0x18ac3e,JSON[_0x707a('0x21')](_0x293851));_0x48245b(_0x293851);})[_0x707a('0x1a')](function(_0x50bb17){logger[_0x707a('0x16')](_0x707a('0x22'),_0x50bb17[_0x707a('0x18')],_0x18ac3e);_0x4c1f75(_0x32d032[_0x707a('0x16')](0x1f4,_0x50bb17[_0x707a('0x18')]));});});}; \ No newline at end of file +var _0xbf18=['update','where','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage'];(function(_0x57d6b2,_0x5c41aa){var _0x30fc38=function(_0x54ee89){while(--_0x54ee89){_0x57d6b2['push'](_0x57d6b2['shift']());}};_0x30fc38(++_0x5c41aa);}(_0xbf18,0x19b));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8bf1('0x0'));var util=require(_0x8bf1('0x1'));var moment=require('moment');var BPromise=require(_0x8bf1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bf1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bf1('0x4'));var logger=require(_0x8bf1('0x5'))(_0x8bf1('0x6'));var config=require('../../config/environment');var jayson=require(_0x8bf1('0x7'));var client=jayson[_0x8bf1('0x8')][_0x8bf1('0x9')]({'port':0x232a});config['redis']=_[_0x8bf1('0xa')](config['redis'],{'host':_0x8bf1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf1('0xc')]));require(_0x8bf1('0xd'))[_0x8bf1('0xe')](socket);function respondWithRpcPromise(_0x1b8c86,_0x166dd6,_0x285648){return new BPromise(function(_0x992e9b,_0x427dd2){return client['request'](_0x1b8c86,_0x285648)[_0x8bf1('0xf')](function(_0x4c8c62){logger['info'](_0x8bf1('0x10'),_0x166dd6,_0x8bf1('0x11'));logger[_0x8bf1('0x12')](_0x8bf1('0x13'),_0x166dd6,'request\x20sent',JSON[_0x8bf1('0x14')](_0x4c8c62));if(_0x4c8c62['error']){if(_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x16')]===0x1f4){logger['error'](_0x8bf1('0x10'),_0x166dd6,_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x17')]);return _0x427dd2(_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x17')]);}logger[_0x8bf1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x166dd6,_0x4c8c62['error']['message']);return _0x992e9b(_0x4c8c62['error']['message']);}else{logger[_0x8bf1('0x18')]('FaxMessage,\x20%s,\x20%s',_0x166dd6,'request\x20sent');_0x992e9b(_0x4c8c62[_0x8bf1('0x19')][_0x8bf1('0x17')]);}})[_0x8bf1('0x1a')](function(_0x4ebe50){logger['error']('FaxMessage,\x20%s,\x20%s',_0x166dd6,_0x4ebe50);_0x427dd2(_0x4ebe50);});});}exports[_0x8bf1('0x1b')]=function(_0x135906){var _0x9a5160=this;return new Promise(function(_0x450e20,_0x2424c1){return db[_0x8bf1('0x1c')]['create'](_0x135906[_0x8bf1('0x1d')],{'raw':_0x135906[_0x8bf1('0x1e')]?_0x135906['options'][_0x8bf1('0x1f')]===undefined?!![]:![]:!![]})[_0x8bf1('0xf')](function(_0x56a86e){logger['info']('CreateFaxMessage',_0x135906);logger[_0x8bf1('0x12')](_0x8bf1('0x1b'),_0x135906,JSON['stringify'](_0x56a86e));_0x450e20(_0x56a86e);})[_0x8bf1('0x1a')](function(_0x32bc0d){logger[_0x8bf1('0x15')](_0x8bf1('0x1b'),_0x32bc0d[_0x8bf1('0x17')],_0x135906);_0x2424c1(_0x9a5160[_0x8bf1('0x15')](0x1f4,_0x32bc0d['message']));});});};exports[_0x8bf1('0x20')]=function(_0x4ed367){var _0x22a382=this;return new Promise(function(_0x2eba39,_0x37e31b){return db[_0x8bf1('0x1c')][_0x8bf1('0x21')](_0x4ed367[_0x8bf1('0x1d')],{'raw':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x22')]||null:null,'attributes':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367['options'][_0x8bf1('0x23')]||null:null,'limit':_0x4ed367['options']?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x24')]||null:null})[_0x8bf1('0xf')](function(_0x49a65b){logger[_0x8bf1('0x18')]('UpdateFaxMessage',_0x4ed367);logger[_0x8bf1('0x12')](_0x8bf1('0x20'),_0x4ed367,JSON[_0x8bf1('0x14')](_0x49a65b));_0x2eba39(_0x49a65b);})['catch'](function(_0x4afa26){logger[_0x8bf1('0x15')]('UpdateFaxMessage',_0x4afa26[_0x8bf1('0x17')],_0x4ed367);_0x37e31b(_0x22a382[_0x8bf1('0x15')](0x1f4,_0x4afa26[_0x8bf1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ef1de51..b9b8517 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 dcb14b9..c6a3e46 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 _0xd5e4=['update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','put'];(function(_0x2c2a81,_0x1d63e5){var _0x4e337c=function(_0x58495d){while(--_0x58495d){_0x2c2a81['push'](_0x2c2a81['shift']());}};_0x4e337c(++_0x1d63e5);}(_0xd5e4,0x8e));var _0x4d5e=function(_0x5480d5,_0x446a24){_0x5480d5=_0x5480d5-0x0;var _0x297386=_0xd5e4[_0x5480d5];return _0x297386;};'use strict';var multer=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var path=require('path');var timeout=require(_0x4d5e('0x2'));var express=require(_0x4d5e('0x3'));var router=express[_0x4d5e('0x4')]();var auth=require(_0x4d5e('0x5'));var interaction=require(_0x4d5e('0x6'));var config=require('../../config/environment');var controller=require(_0x4d5e('0x7'));router[_0x4d5e('0x8')]('/',auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xa')]);router['get'](_0x4d5e('0xb'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xc')]);router['get'](_0x4d5e('0xd'),auth['isAuthenticated'](),controller[_0x4d5e('0xe')]);router['get'](_0x4d5e('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4d5e('0x10')]('/',auth['isAuthenticated'](),interaction[_0x4d5e('0x11')](_0x4d5e('0x12'),'faxmessage:create'),controller['create']);router[_0x4d5e('0x13')](_0x4d5e('0xd'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x14')]);router['put'](_0x4d5e('0x15'),auth[_0x4d5e('0x9')](),controller['accept']);router['put'](_0x4d5e('0x16'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x17')]);router[_0x4d5e('0x18')](_0x4d5e('0xd'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x19')]);module[_0x4d5e('0x1a')]=router; \ No newline at end of file +var _0x35fc=['tracked','create','put','update','accept','/:id/reject','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','download','post'];(function(_0x5cf245,_0x33976e){var _0x1178c7=function(_0x2183ff){while(--_0x2183ff){_0x5cf245['push'](_0x5cf245['shift']());}};_0x1178c7(++_0x33976e);}(_0x35fc,0x7f));var _0xc35f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35fc[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xc35f('0x0'));var util=require(_0xc35f('0x1'));var path=require('path');var timeout=require(_0xc35f('0x2'));var express=require(_0xc35f('0x3'));var router=express[_0xc35f('0x4')]();var auth=require(_0xc35f('0x5'));var interaction=require(_0xc35f('0x6'));var config=require(_0xc35f('0x7'));var controller=require(_0xc35f('0x8'));router[_0xc35f('0x9')]('/',auth[_0xc35f('0xa')](),controller[_0xc35f('0xb')]);router[_0xc35f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc35f('0xc')]);router[_0xc35f('0x9')](_0xc35f('0xd'),auth[_0xc35f('0xa')](),controller[_0xc35f('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xc35f('0xf')]);router[_0xc35f('0x10')]('/',auth['isAuthenticated'](),interaction[_0xc35f('0x11')]('fax','faxmessage:create'),controller[_0xc35f('0x12')]);router[_0xc35f('0x13')](_0xc35f('0xd'),auth[_0xc35f('0xa')](),controller[_0xc35f('0x14')]);router[_0xc35f('0x13')]('/:id/accept',auth[_0xc35f('0xa')](),controller[_0xc35f('0x15')]);router[_0xc35f('0x13')](_0xc35f('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xc35f('0xd'),auth['isAuthenticated'](),controller[_0xc35f('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9c1519b..94e58f6 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 _0x43b7=['ENUM','roundrobin','sequelize','name','INTEGER'];(function(_0x54e26b,_0x18219e){var _0x2a82f5=function(_0x3023ac){while(--_0x3023ac){_0x54e26b['push'](_0x54e26b['shift']());}};_0x2a82f5(++_0x18219e);}(_0x43b7,0x183));var _0x743b=function(_0x4f6ffd,_0x366959){_0x4f6ffd=_0x4f6ffd-0x0;var _0xbaca20=_0x43b7[_0x4f6ffd];return _0xbaca20;};'use strict';var Sequelize=require(_0x743b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x743b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x743b('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x743b('0x3')]('rrmemory','beepall',_0x743b('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x743b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3fc4=['sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x5a7ed9,_0x49b0e2){var _0x41b05=function(_0x3a8141){while(--_0x3a8141){_0x5a7ed9['push'](_0x5a7ed9['shift']());}};_0x41b05(++_0x49b0e2);}(_0x3fc4,0x1c2));var _0x43fc=function(_0x3f9dcd,_0x5323e4){_0x3f9dcd=_0x3f9dcd-0x0;var _0x4cfa61=_0x3fc4[_0x3f9dcd];return _0x4cfa61;};'use strict';var Sequelize=require(_0x43fc('0x0'));module[_0x43fc('0x1')]={'name':{'type':Sequelize[_0x43fc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x43fc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x43fc('0x4'),_0x43fc('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 e067e93..401e741 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 _0xa244=['index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','rawAttributes','FaxQueueId','User','findAndCountAll','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','emit','userFaxQueue:save','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send'];(function(_0x3d0e9f,_0x3a30cd){var _0x500132=function(_0xb38c4a){while(--_0xb38c4a){_0x3d0e9f['push'](_0x3d0e9f['shift']());}};_0x500132(++_0x3a30cd);}(_0xa244,0xf1));var _0x4a24=function(_0x1fe14f,_0x36745d){_0x1fe14f=_0x1fe14f-0x0;var _0x4c4904=_0xa244[_0x1fe14f];return _0x4c4904;};'use strict';var pdf=require(_0x4a24('0x0'));var emlformat=require(_0x4a24('0x1'));var rimraf=require(_0x4a24('0x2'));var zipdir=require(_0x4a24('0x3'));var jsonpatch=require(_0x4a24('0x4'));var rp=require(_0x4a24('0x5'));var moment=require(_0x4a24('0x6'));var BPromise=require(_0x4a24('0x7'));var Mustache=require(_0x4a24('0x8'));var util=require('util');var path=require('path');var sox=require(_0x4a24('0x9'));var csv=require('to-csv');var ejs=require(_0x4a24('0xa'));var fs=require('fs');var _=require(_0x4a24('0xb'));var squel=require('squel');var crypto=require(_0x4a24('0xc'));var jsforce=require(_0x4a24('0xd'));var deskjs=require(_0x4a24('0xe'));var toCsv=require(_0x4a24('0xf'));var querystring=require(_0x4a24('0x10'));var Papa=require(_0x4a24('0x11'));var Redis=require(_0x4a24('0x12'));var authService=require(_0x4a24('0x13'));var qs=require(_0x4a24('0x14'));var as=require(_0x4a24('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a24('0x16'))(_0x4a24('0x17'));var utils=require(_0x4a24('0x18'));var config=require(_0x4a24('0x19'));var licenseUtil=require(_0x4a24('0x1a'));var db=require(_0x4a24('0x1b'))['db'];config[_0x4a24('0x1c')]=_[_0x4a24('0x1d')](config[_0x4a24('0x1c')],{'host':_0x4a24('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0x4a24('0x1f')](socket);function respondWithStatusCode(_0x562145,_0x5a9250){_0x5a9250=_0x5a9250||0xcc;return function(_0x4bcf17){if(_0x4bcf17){return _0x562145[_0x4a24('0x20')](_0x5a9250);}return _0x562145[_0x4a24('0x21')](_0x5a9250)[_0x4a24('0x22')]();};}function respondWithResult(_0x123b66,_0x130622){_0x130622=_0x130622||0xc8;return function(_0x452ba9){if(_0x452ba9){return _0x123b66['status'](_0x130622)['json'](_0x452ba9);}};}function respondWithFilteredResult(_0x139a21,_0x1a4825){return function(_0x4a1fa8){if(_0x4a1fa8){var _0x310557=_0x4a1fa8[_0x4a24('0x23')],_0x51271b=_0x1a4825[_0x4a24('0x24')],_0x4dafdb=_0x1a4825[_0x4a24('0x24')]+_0x1a4825[_0x4a24('0x25')],_0x15768c;if(_0x4dafdb>=_0x310557){_0x4dafdb=_0x310557;_0x15768c=0xc8;}else{_0x15768c=0xce;}_0x139a21[_0x4a24('0x21')](_0x15768c);return _0x139a21[_0x4a24('0x26')](_0x4a24('0x27'),_0x51271b+'-'+_0x4dafdb+'/'+_0x310557)[_0x4a24('0x28')](_0x4a1fa8);}return null;};}function patchUpdates(_0x377801){return function(_0x1d4661){try{jsonpatch['apply'](_0x1d4661,_0x377801,!![]);}catch(_0x163b97){return BPromise[_0x4a24('0x29')](_0x163b97);}return _0x1d4661[_0x4a24('0x2a')]();};}function saveUpdates(_0x116458,_0x2ce0b8){return function(_0x221e22){if(_0x221e22){return _0x221e22[_0x4a24('0x2b')](_0x116458)[_0x4a24('0x2c')](function(_0x5efde5){return _0x5efde5;});}return null;};}function removeEntity(_0x5f5477,_0x3fbd5d){return function(_0x38edaf){if(_0x38edaf){return _0x38edaf[_0x4a24('0x2d')]()[_0x4a24('0x2c')](function(){var _0xcbe500=_0x38edaf[_0x4a24('0x2e')]({'plain':!![]});var _0x29bc71='FaxQueues';return db[_0x4a24('0x2f')][_0x4a24('0x2d')]({'where':{'type':_0x29bc71,'resourceId':_0xcbe500['id']}})[_0x4a24('0x2c')](function(){return _0x38edaf;});})[_0x4a24('0x2c')](function(){_0x5f5477[_0x4a24('0x21')](0xcc)[_0x4a24('0x22')]();});}};}function handleEntityNotFound(_0x204a90,_0x521969){return function(_0x2f7847){if(!_0x2f7847){_0x204a90[_0x4a24('0x20')](0x194);}return _0x2f7847;};}function handleError(_0xed3c45,_0x595438){_0x595438=_0x595438||0x1f4;return function(_0x678475){logger[_0x4a24('0x30')](_0x678475['stack']);if(_0x678475[_0x4a24('0x31')]){delete _0x678475[_0x4a24('0x31')];}_0xed3c45[_0x4a24('0x21')](_0x595438)[_0x4a24('0x32')](_0x678475);};}exports[_0x4a24('0x33')]=function(_0x21e37a,_0x5ab1ed){var _0xb80f4f={},_0x32b537={},_0x9125e4={'count':0x0,'rows':[]};var _0x56e625=_[_0x4a24('0x34')](db['FaxQueue']['rawAttributes'],function(_0x2a52ba){return{'name':_0x2a52ba[_0x4a24('0x35')],'type':_0x2a52ba[_0x4a24('0x36')][_0x4a24('0x37')]};});_0x32b537[_0x4a24('0x38')]=_[_0x4a24('0x34')](_0x56e625,_0x4a24('0x31'));_0x32b537[_0x4a24('0x39')]=_['keys'](_0x21e37a[_0x4a24('0x39')]);_0x32b537['filters']=_[_0x4a24('0x3a')](_0x32b537['model'],_0x32b537[_0x4a24('0x39')]);_0xb80f4f[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x32b537[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x21e37a[_0x4a24('0x39')][_0x4a24('0x3c')]));_0xb80f4f['attributes']=_0xb80f4f[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0xb80f4f[_0x4a24('0x3b')]:_0x32b537[_0x4a24('0x38')];if(!_0x21e37a[_0x4a24('0x39')][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0xb80f4f['limit']=qs['limit'](_0x21e37a[_0x4a24('0x39')]['limit']);_0xb80f4f[_0x4a24('0x24')]=qs[_0x4a24('0x24')](_0x21e37a[_0x4a24('0x39')]['offset']);}_0xb80f4f[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x21e37a[_0x4a24('0x39')][_0x4a24('0x41')]);_0xb80f4f[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x21e37a[_0x4a24('0x39')],_0x32b537['filters']),_0x56e625);if(_0x21e37a['query'][_0x4a24('0x45')]){_0xb80f4f[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0xb80f4f['where'],{'$or':_[_0x4a24('0x34')](_0x56e625,function(_0x4019df){if(_0x4019df[_0x4a24('0x36')]!==_0x4a24('0x47')){var _0x1bbb6b={};_0x1bbb6b[_0x4019df['name']]={'$like':'%'+_0x21e37a[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x1bbb6b;}})});}_0xb80f4f=_[_0x4a24('0x46')]({},_0xb80f4f,_0x21e37a[_0x4a24('0x48')]);var _0x49344b={'where':_0xb80f4f[_0x4a24('0x42')]};return db[_0x4a24('0x49')][_0x4a24('0x23')](_0x49344b)['then'](function(_0x5226e4){_0x9125e4[_0x4a24('0x23')]=_0x5226e4;if(_0x21e37a['query']['includeAll']){_0xb80f4f[_0x4a24('0x4a')]=[{'all':!![]}];}return db[_0x4a24('0x49')][_0x4a24('0x4b')](_0xb80f4f);})[_0x4a24('0x2c')](function(_0xe04232){_0x9125e4[_0x4a24('0x4c')]=_0xe04232;return _0x9125e4;})[_0x4a24('0x2c')](respondWithFilteredResult(_0x5ab1ed,_0xb80f4f))[_0x4a24('0x4d')](handleError(_0x5ab1ed,null));};exports[_0x4a24('0x4e')]=function(_0x19894c,_0xa255b9){var _0x1f42b1={'raw':!![],'where':{'id':_0x19894c[_0x4a24('0x4f')]['id']}},_0x320273={};_0x320273[_0x4a24('0x38')]=_[_0x4a24('0x50')](db['FaxQueue']['rawAttributes']);_0x320273[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x19894c['query']);_0x320273[_0x4a24('0x43')]=_[_0x4a24('0x3a')](_0x320273[_0x4a24('0x38')],_0x320273[_0x4a24('0x39')]);_0x1f42b1[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x320273['model'],qs[_0x4a24('0x3c')](_0x19894c[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x1f42b1[_0x4a24('0x3b')]=_0x1f42b1[_0x4a24('0x3b')]['length']?_0x1f42b1['attributes']:_0x320273[_0x4a24('0x38')];if(_0x19894c[_0x4a24('0x39')][_0x4a24('0x51')]){_0x1f42b1[_0x4a24('0x4a')]=[{'all':!![]}];}_0x1f42b1=_[_0x4a24('0x46')]({},_0x1f42b1,_0x19894c['options']);return db[_0x4a24('0x49')][_0x4a24('0x52')](_0x1f42b1)[_0x4a24('0x2c')](handleEntityNotFound(_0xa255b9,null))[_0x4a24('0x2c')](respondWithResult(_0xa255b9,null))['catch'](handleError(_0xa255b9,null));};exports['create']=function(_0x393d08,_0x202400){return db[_0x4a24('0x49')][_0x4a24('0x53')](_0x393d08['body'],{})[_0x4a24('0x2c')](function(_0x59328f){var _0x492dbf=_0x393d08[_0x4a24('0x54')][_0x4a24('0x2e')]({'plain':!![]});if(!_0x492dbf)throw new Error(_0x4a24('0x55'));if(_0x492dbf[_0x4a24('0x56')]==='user'){var _0x1c8bba=_0x59328f[_0x4a24('0x2e')]({'plain':!![]});var _0x33289e=_0x4a24('0x57');return db[_0x4a24('0x58')]['find']({'where':{'name':_0x33289e,'userProfileId':_0x492dbf['userProfileId']},'raw':!![]})['then'](function(_0x2a9e56){if(_0x2a9e56&&_0x2a9e56[_0x4a24('0x59')]===0x0){return db[_0x4a24('0x2f')][_0x4a24('0x53')]({'name':_0x1c8bba['name'],'resourceId':_0x1c8bba['id'],'type':_0x2a9e56[_0x4a24('0x31')],'sectionId':_0x2a9e56['id']},{})[_0x4a24('0x2c')](function(){return _0x59328f;});}else{return _0x59328f;}})[_0x4a24('0x4d')](function(_0x18f795){logger[_0x4a24('0x30')](_0x4a24('0x5a'),_0x18f795);throw _0x18f795;});}return _0x59328f;})[_0x4a24('0x2c')](respondWithResult(_0x202400,0xc9))['catch'](handleError(_0x202400,null));};exports[_0x4a24('0x2b')]=function(_0x5465ce,_0x27f1a9){if(_0x5465ce[_0x4a24('0x5b')]['id']){delete _0x5465ce[_0x4a24('0x5b')]['id'];}return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x5465ce['params']['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x27f1a9,null))[_0x4a24('0x2c')](saveUpdates(_0x5465ce[_0x4a24('0x5b')],null))['then'](respondWithResult(_0x27f1a9,null))[_0x4a24('0x4d')](handleError(_0x27f1a9,null));};exports[_0x4a24('0x2d')]=function(_0x11a26c,_0x3cda12){return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x11a26c[_0x4a24('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3cda12,null))[_0x4a24('0x2c')](removeEntity(_0x3cda12,null))[_0x4a24('0x4d')](handleError(_0x3cda12,null));};exports['describe']=function(_0x18ad42,_0x46ca4f){return db[_0x4a24('0x49')][_0x4a24('0x5c')]()[_0x4a24('0x2c')](respondWithResult(_0x46ca4f,null))[_0x4a24('0x4d')](handleError(_0x46ca4f,null));};exports['getMembers']=function(_0x25c3df,_0xbcbab9,_0x16aaf0){var _0x110484={'raw':!![],'where':{}},_0x2abe28={},_0x1d5b70;return db['FaxQueue'][_0x4a24('0x5d')]({'where':{'id':_0x25c3df['params']['id']}})['then'](handleEntityNotFound(_0xbcbab9,null))[_0x4a24('0x2c')](function(_0x25329a){if(_0x25329a){_0x1d5b70=_0x25329a[_0x4a24('0x2e')]({'plain':!![]});_0x2abe28[_0x4a24('0x38')]=_[_0x4a24('0x50')](db[_0x4a24('0x5e')][_0x4a24('0x5f')]);_0x2abe28[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x25c3df[_0x4a24('0x39')]);_0x2abe28[_0x4a24('0x43')]=_['intersection'](_0x2abe28[_0x4a24('0x38')],_0x2abe28[_0x4a24('0x39')]);_0x110484['attributes']=_['intersection'](_0x2abe28[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x25c3df[_0x4a24('0x39')]['fields']));_0x110484[_0x4a24('0x3b')]=_0x110484[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0x110484[_0x4a24('0x3b')]:_0x2abe28['model'];if(!_0x25c3df[_0x4a24('0x39')][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0x110484[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x25c3df[_0x4a24('0x39')]['limit']);_0x110484[_0x4a24('0x24')]=qs[_0x4a24('0x24')](_0x25c3df[_0x4a24('0x39')]['offset']);}_0x110484[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x25c3df[_0x4a24('0x39')][_0x4a24('0x41')]);_0x110484['where']=qs[_0x4a24('0x43')](_['pick'](_0x25c3df[_0x4a24('0x39')],_0x2abe28[_0x4a24('0x43')]));_0x110484[_0x4a24('0x42')][_0x4a24('0x60')]=_0x25329a['id'];if(_0x25c3df[_0x4a24('0x39')]['filter']){_0x110484[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0x110484[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x110484[_0x4a24('0x3b')],function(_0x400630){var _0x2ea5c3={};_0x2ea5c3[_0x400630]={'$like':'%'+_0x25c3df[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x2ea5c3;})});}_0x110484=_[_0x4a24('0x46')]({},_0x110484,_0x25c3df[_0x4a24('0x48')]);return db['UserFaxQueue'][_0x4a24('0x4b')](_0x110484);}})[_0x4a24('0x2c')](function(_0x7030b3){if(_0x7030b3){return db[_0x4a24('0x61')][_0x4a24('0x62')]({'where':{'id':_[_0x4a24('0x34')](_0x7030b3,_0x4a24('0x63')),'role':'agent'},'attributes':['id',_0x4a24('0x31'),_0x4a24('0x64'),'updatedAt','createdAt']});}})[_0x4a24('0x2c')](function(_0x27c703){if(_0x27c703){return{'count':_0x27c703['count'],'rows':_[_0x4a24('0x34')](_0x27c703[_0x4a24('0x4c')],function(_0x29d2ed){return{'membername':_0x29d2ed[_0x4a24('0x31')],'UserId':_0x29d2ed['id'],'queue_name':_0x1d5b70[_0x4a24('0x31')],'FaxQueueId':_0x1d5b70['id'],'interface':util[_0x4a24('0x65')](_0x4a24('0x66'),_0x4a24('0x67'),_0x29d2ed[_0x4a24('0x31')]),'penalty':0x0,'paused':_0x29d2ed['faxPause'],'createdAt':_0x29d2ed[_0x4a24('0x68')],'updatedAt':_0x29d2ed[_0x4a24('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xbcbab9,_0x110484))[_0x4a24('0x4d')](handleError(_0xbcbab9,null));};exports['getTeams']=function(_0x58bb03,_0x4a8275,_0x3324e4){var _0x425957={};var _0x1012fa={};var _0x2dd83d;var _0x1e0b6c;return db[_0x4a24('0x49')]['findOne']({'where':{'id':_0x58bb03[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x4a8275,null))[_0x4a24('0x2c')](function(_0x5557cf){if(_0x5557cf){_0x2dd83d=_0x5557cf;_0x1012fa[_0x4a24('0x38')]=_[_0x4a24('0x50')](db[_0x4a24('0x6a')][_0x4a24('0x5f')]);_0x1012fa[_0x4a24('0x39')]=_[_0x4a24('0x50')](_0x58bb03['query']);_0x1012fa[_0x4a24('0x43')]=_['intersection'](_0x1012fa[_0x4a24('0x38')],_0x1012fa['query']);_0x425957['attributes']=_[_0x4a24('0x3a')](_0x1012fa[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x425957['attributes']=_0x425957[_0x4a24('0x3b')][_0x4a24('0x3d')]?_0x425957[_0x4a24('0x3b')]:_0x1012fa[_0x4a24('0x38')];_0x425957[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x41')]);_0x425957[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x58bb03[_0x4a24('0x39')],_0x1012fa['filters']));if(_0x58bb03[_0x4a24('0x39')][_0x4a24('0x45')]){_0x425957['where']=_['merge'](_0x425957[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x425957[_0x4a24('0x3b')],function(_0x5a9228){var _0x277829={};_0x277829[_0x5a9228]={'$like':'%'+_0x58bb03[_0x4a24('0x39')][_0x4a24('0x45')]+'%'};return _0x277829;})});}_0x425957=_[_0x4a24('0x46')]({},_0x425957,_0x58bb03[_0x4a24('0x48')]);return _0x2dd83d[_0x4a24('0x6b')](_0x425957);}})[_0x4a24('0x2c')](function(_0x1d9725){if(_0x1d9725){_0x1e0b6c=_0x1d9725[_0x4a24('0x3d')];if(!_0x58bb03[_0x4a24('0x39')]['hasOwnProperty'](_0x4a24('0x3f'))){_0x425957[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x25')]);_0x425957['offset']=qs[_0x4a24('0x24')](_0x58bb03[_0x4a24('0x39')][_0x4a24('0x24')]);}return _0x2dd83d['getTeams'](_0x425957);}})[_0x4a24('0x2c')](function(_0x1a52fb){if(_0x1a52fb){return _0x1a52fb?{'count':_0x1e0b6c,'rows':_0x1a52fb}:null;}})['then'](respondWithResult(_0x4a8275,null))[_0x4a24('0x4d')](handleError(_0x4a8275,null));};exports[_0x4a24('0x6c')]=function(_0x1a4e99,_0x12e03b,_0x410173){var _0xef19ec=_0x1a4e99[_0x4a24('0x5b')][_0x4a24('0x6d')];return db['Team'][_0x4a24('0x4b')]({'where':{'id':_0xef19ec},'attributes':['id'],'include':[{'model':db[_0x4a24('0x61')],'as':'Agents','attributes':['id',_0x4a24('0x31'),'online',_0x4a24('0x6e'),_0x4a24('0x6f')],'raw':!![]}]})[_0x4a24('0x2c')](function(_0x11e21c){if(_0x11e21c){var _0x2ec058=_[_0x4a24('0x70')](_0x11e21c,function(_0xf7f7f4){var _0x453e7a=_0xf7f7f4[_0x4a24('0x2e')]({'plain':!![]});return _0x453e7a[_0x4a24('0x71')];});return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x1a4e99['params']['id']}})['then'](function(_0x144656){return db['sequelize'][_0x4a24('0x72')](function(_0x12fc8e){return _0x144656[_0x4a24('0x6c')](_0xef19ec,{'transaction':_0x12fc8e})[_0x4a24('0x2c')](function(){return BPromise[_0x4a24('0x73')](_0x2ec058,function(_0x2b521d){return db[_0x4a24('0x5e')]['findOrCreate']({'where':{'UserId':_0x2b521d['id'],'FaxQueueId':_0x1a4e99[_0x4a24('0x4f')]['id']},'transaction':_0x12fc8e});});})[_0x4a24('0x2c')](function(){_0x2ec058['forEach'](function(_0x29a008){socket[_0x4a24('0x74')](_0x4a24('0x75'),{'UserId':_0x29a008['id'],'FaxQueueId':_0x144656['id']});});});});});}})[_0x4a24('0x2c')](respondWithStatusCode(_0x12e03b,null))[_0x4a24('0x4d')](handleError(_0x12e03b,null));};exports['removeTeams']=function(_0x162b46,_0x5d687c,_0x3df962){return db[_0x4a24('0x6a')][_0x4a24('0x4b')]({'where':{'id':_0x162b46[_0x4a24('0x39')][_0x4a24('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x4a24('0x61')],'as':_0x4a24('0x71'),'attributes':['id'],'raw':!![]}]})[_0x4a24('0x2c')](handleEntityNotFound(_0x5d687c,null))[_0x4a24('0x2c')](function(_0x78f8d9){var _0x6b13c2=_[_0x4a24('0x34')](_0x78f8d9,'id');var _0x1609ae=[];var _0x4a2931=[];var _0xe6387a=squel[_0x4a24('0x76')]();_0xe6387a[_0x4a24('0x77')]('tq.TeamId')[_0x4a24('0x78')](_0x4a24('0x79'),'tq')[_0x4a24('0x7a')](_0x4a24('0x7b'),'ut',_0x4a24('0x7c'))[_0x4a24('0x42')](_0x4a24('0x7d'),_0x162b46[_0x4a24('0x4f')]['id']);for(var _0x333631=0x0;_0x333631<_0x78f8d9['length'];_0x333631+=0x1){let _0x472086=_0x78f8d9[_0x333631];for(var _0x196c03=0x0;_0x196c03<_0x472086[_0x4a24('0x71')]['length'];_0x196c03+=0x1){let _0x3caac7=_0x472086['Agents'][_0x196c03];var _0x59b470=_0xe6387a[_0x4a24('0x7e')]();_0x59b470[_0x4a24('0x42')](_0x4a24('0x7f'),_0x3caac7['id']);_0x4a2931[_0x4a24('0x80')](db[_0x4a24('0x81')][_0x4a24('0x39')](_0x59b470[_0x4a24('0x82')](),{'type':db['sequelize']['QueryTypes'][_0x4a24('0x83')]})[_0x4a24('0x2c')](function(_0x489910){if(_0x489910[_0x4a24('0x3d')]===0x1){return _0x3caac7['id'];}else{var _0x51c436=_['every'](_[_0x4a24('0x34')](_0x489910,_0x4a24('0x84')),function(_0x2efab1){return _[_0x4a24('0x85')](_0x6b13c2,_0x2efab1);});if(_0x51c436){return _0x3caac7['id'];}}}));}}return BPromise[_0x4a24('0x86')](_0x4a2931)['then'](function(_0x385961){_0x1609ae=_(_0x1609ae)[_0x4a24('0x87')](_0x385961)[_0x4a24('0x88')]()[_0x4a24('0x89')]();return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x162b46[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](function(_0x4456c8){return db['sequelize']['transaction'](function(_0x52ef0b){return _0x4456c8[_0x4a24('0x8a')](_0x162b46[_0x4a24('0x39')][_0x4a24('0x6d')],{'transaction':_0x52ef0b})[_0x4a24('0x2c')](function(){if(!_[_0x4a24('0x8b')](_0x1609ae)){return _0x4456c8[_0x4a24('0x8c')](_0x1609ae,{'transaction':_0x52ef0b});}})[_0x4a24('0x2c')](function(){_0x1609ae[_0x4a24('0x8d')](function(_0x585602){socket[_0x4a24('0x74')]('userFaxQueue:remove',{'UserId':_0x585602,'FaxQueueId':_0x4456c8['id']});});});});});});})[_0x4a24('0x2c')](respondWithStatusCode(_0x5d687c,null))[_0x4a24('0x4d')](handleError(_0x5d687c,null));};exports[_0x4a24('0x8e')]=function(_0x960f73,_0x148625,_0xc9b317){return db[_0x4a24('0x49')][_0x4a24('0x52')]({'where':{'id':_0x960f73[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x148625,null))[_0x4a24('0x2c')](function(_0x42b6d4){if(_0x42b6d4){return _0x42b6d4[_0x4a24('0x8e')](_0x960f73[_0x4a24('0x5b')][_0x4a24('0x6d')],_['omit'](_0x960f73[_0x4a24('0x5b')],[_0x4a24('0x6d'),'id'])||{})['spread'](function(_0x5b9834){for(var _0xc2c140=0x0;_0xc2c140<_0x960f73[_0x4a24('0x5b')][_0x4a24('0x6d')][_0x4a24('0x3d')];_0xc2c140+=0x1){socket['emit'](_0x4a24('0x75'),{'UserId':_0x960f73['body']['ids'][_0xc2c140],'FaxQueueId':_0x960f73[_0x4a24('0x4f')]['id']});}return _0x5b9834;});}})[_0x4a24('0x2c')](respondWithResult(_0x148625,null))[_0x4a24('0x4d')](handleError(_0x148625,null));};exports[_0x4a24('0x8c')]=function(_0x2f5a31,_0x7a60b0,_0x26ba7d){return db[_0x4a24('0x49')]['find']({'where':{'id':_0x2f5a31[_0x4a24('0x4f')]['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x7a60b0,null))[_0x4a24('0x2c')](function(_0x34c0a8){if(_0x34c0a8){return _0x34c0a8[_0x4a24('0x8c')](_0x2f5a31['query'][_0x4a24('0x6d')])[_0x4a24('0x2c')](function(){if(_[_0x4a24('0x8f')](_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')])){for(var _0x4907a7=0x0;_0x4907a7<_0x2f5a31[_0x4a24('0x39')]['ids'][_0x4a24('0x3d')];_0x4907a7+=0x1){socket[_0x4a24('0x74')]('userFaxQueue:remove',{'UserId':Number(_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')][_0x4907a7]),'FaxQueueId':Number(_0x2f5a31[_0x4a24('0x4f')]['id'])});}}else{socket[_0x4a24('0x74')](_0x4a24('0x90'),{'UserId':Number(_0x2f5a31[_0x4a24('0x39')][_0x4a24('0x6d')]),'FaxQueueId':Number(_0x2f5a31[_0x4a24('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x7a60b0,null))[_0x4a24('0x4d')](handleError(_0x7a60b0,null));};exports[_0x4a24('0x91')]=function(_0x372aec,_0x4d7bd2,_0x58ae85){var _0x5813f8={};var _0x4afabf={};var _0x47abc8;var _0x250b1a;return db[_0x4a24('0x49')][_0x4a24('0x5d')]({'where':{'id':_0x372aec['params']['id']}})[_0x4a24('0x2c')](handleEntityNotFound(_0x4d7bd2,null))[_0x4a24('0x2c')](function(_0x32ad5f){if(_0x32ad5f){_0x47abc8=_0x32ad5f;_0x4afabf[_0x4a24('0x38')]=_['keys'](db['User'][_0x4a24('0x5f')]);_0x4afabf['query']=_[_0x4a24('0x50')](_0x372aec[_0x4a24('0x39')]);_0x4afabf[_0x4a24('0x43')]=_['intersection'](_0x4afabf[_0x4a24('0x38')],_0x4afabf[_0x4a24('0x39')]);_0x5813f8[_0x4a24('0x3b')]=_[_0x4a24('0x3a')](_0x4afabf[_0x4a24('0x38')],qs[_0x4a24('0x3c')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x3c')]));_0x5813f8[_0x4a24('0x3b')]=_0x5813f8[_0x4a24('0x3b')]['length']?_0x5813f8[_0x4a24('0x3b')]:_0x4afabf['model'];_0x5813f8[_0x4a24('0x40')]=qs[_0x4a24('0x41')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x41')]);_0x5813f8[_0x4a24('0x42')]=qs[_0x4a24('0x43')](_[_0x4a24('0x44')](_0x372aec['query'],_0x4afabf[_0x4a24('0x43')]));if(_0x372aec[_0x4a24('0x39')][_0x4a24('0x45')]){_0x5813f8[_0x4a24('0x42')]=_[_0x4a24('0x46')](_0x5813f8[_0x4a24('0x42')],{'$or':_[_0x4a24('0x34')](_0x5813f8[_0x4a24('0x3b')],function(_0x305afb){var _0x48d0a4={};_0x48d0a4[_0x305afb]={'$like':'%'+_0x372aec['query'][_0x4a24('0x45')]+'%'};return _0x48d0a4;})});}_0x5813f8=_[_0x4a24('0x46')]({},_0x5813f8,_0x372aec[_0x4a24('0x48')]);return _0x47abc8['getAgents'](_0x5813f8);}})[_0x4a24('0x2c')](function(_0x490a28){if(_0x490a28){_0x250b1a=_0x490a28['length'];if(!_0x372aec['query'][_0x4a24('0x3e')](_0x4a24('0x3f'))){_0x5813f8[_0x4a24('0x25')]=qs[_0x4a24('0x25')](_0x372aec[_0x4a24('0x39')][_0x4a24('0x25')]);_0x5813f8['offset']=qs['offset'](_0x372aec[_0x4a24('0x39')][_0x4a24('0x24')]);}return _0x47abc8['getAgents'](_0x5813f8);}})[_0x4a24('0x2c')](function(_0x437646){if(_0x437646){return _0x437646?{'count':_0x250b1a,'rows':_0x437646}:null;}})['then'](respondWithResult(_0x4d7bd2,null))[_0x4a24('0x4d')](handleError(_0x4d7bd2,null));}; \ No newline at end of file +var _0xcd18=['agent','faxPause','updatedAt','format','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','compact','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','FaxQueues','end','error','stack','name','send','FaxQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','sort','filter','merge','VIRTUAL','options','where','findAll','rows','catch','params','length','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','pick','FaxQueueId','User','findAndCountAll','UserId'];(function(_0x466044,_0x50b7de){var _0xca6267=function(_0x5a4e5d){while(--_0x5a4e5d){_0x466044['push'](_0x466044['shift']());}};_0xca6267(++_0x50b7de);}(_0xcd18,0xb4));var _0x8cd1=function(_0x3396e8,_0x3048a3){_0x3396e8=_0x3396e8-0x0;var _0x296815=_0xcd18[_0x3396e8];return _0x296815;};'use strict';var pdf=require(_0x8cd1('0x0'));var emlformat=require(_0x8cd1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8cd1('0x2'));var jsonpatch=require(_0x8cd1('0x3'));var rp=require('request-promise');var moment=require(_0x8cd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cd1('0x5'));var util=require(_0x8cd1('0x6'));var path=require('path');var sox=require(_0x8cd1('0x7'));var csv=require(_0x8cd1('0x8'));var ejs=require(_0x8cd1('0x9'));var fs=require('fs');var _=require(_0x8cd1('0xa'));var squel=require(_0x8cd1('0xb'));var crypto=require(_0x8cd1('0xc'));var jsforce=require(_0x8cd1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8cd1('0x8'));var querystring=require(_0x8cd1('0xe'));var Papa=require(_0x8cd1('0xf'));var Redis=require(_0x8cd1('0x10'));var authService=require(_0x8cd1('0x11'));var qs=require(_0x8cd1('0x12'));var as=require(_0x8cd1('0x13'));var hardwareService=require(_0x8cd1('0x14'));var logger=require('../../config/logger')(_0x8cd1('0x15'));var utils=require(_0x8cd1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8cd1('0x17'));var db=require(_0x8cd1('0x18'))['db'];config['redis']=_[_0x8cd1('0x19')](config[_0x8cd1('0x1a')],{'host':_0x8cd1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd1('0x1a')]));require(_0x8cd1('0x1c'))[_0x8cd1('0x1d')](socket);function respondWithStatusCode(_0x12736a,_0xa1a5a6){_0xa1a5a6=_0xa1a5a6||0xcc;return function(_0x75b1fd){if(_0x75b1fd){return _0x12736a[_0x8cd1('0x1e')](_0xa1a5a6);}return _0x12736a[_0x8cd1('0x1f')](_0xa1a5a6)['end']();};}function respondWithResult(_0x280f0a,_0x29292d){_0x29292d=_0x29292d||0xc8;return function(_0x23ff8d){if(_0x23ff8d){return _0x280f0a['status'](_0x29292d)[_0x8cd1('0x20')](_0x23ff8d);}};}function respondWithFilteredResult(_0x37f2be,_0x534426){return function(_0x2ceba1){if(_0x2ceba1){var _0x159b45=_0x2ceba1[_0x8cd1('0x21')],_0x21dcc4=_0x534426[_0x8cd1('0x22')],_0x5069ae=_0x534426['offset']+_0x534426[_0x8cd1('0x23')],_0x4147a2;if(_0x5069ae>=_0x159b45){_0x5069ae=_0x159b45;_0x4147a2=0xc8;}else{_0x4147a2=0xce;}_0x37f2be['status'](_0x4147a2);return _0x37f2be[_0x8cd1('0x24')](_0x8cd1('0x25'),_0x21dcc4+'-'+_0x5069ae+'/'+_0x159b45)['json'](_0x2ceba1);}return null;};}function patchUpdates(_0x11353b){return function(_0x2b8d70){try{jsonpatch[_0x8cd1('0x26')](_0x2b8d70,_0x11353b,!![]);}catch(_0x5aae20){return BPromise['reject'](_0x5aae20);}return _0x2b8d70[_0x8cd1('0x27')]();};}function saveUpdates(_0x1c68b4,_0x1506cb){return function(_0x5e861f){if(_0x5e861f){return _0x5e861f[_0x8cd1('0x28')](_0x1c68b4)[_0x8cd1('0x29')](function(_0xc9494e){return _0xc9494e;});}return null;};}function removeEntity(_0x5dddcd,_0x57c814){return function(_0x55fe48){if(_0x55fe48){return _0x55fe48[_0x8cd1('0x2a')]()[_0x8cd1('0x29')](function(){var _0x50a95e=_0x55fe48['get']({'plain':!![]});var _0x532457=_0x8cd1('0x2b');return db['UserProfileResource'][_0x8cd1('0x2a')]({'where':{'type':_0x532457,'resourceId':_0x50a95e['id']}})[_0x8cd1('0x29')](function(){return _0x55fe48;});})[_0x8cd1('0x29')](function(){_0x5dddcd['status'](0xcc)[_0x8cd1('0x2c')]();});}};}function handleEntityNotFound(_0x2fae55,_0x48babd){return function(_0x3b441c){if(!_0x3b441c){_0x2fae55[_0x8cd1('0x1e')](0x194);}return _0x3b441c;};}function handleError(_0x411ca2,_0x49b008){_0x49b008=_0x49b008||0x1f4;return function(_0x2f86d4){logger[_0x8cd1('0x2d')](_0x2f86d4[_0x8cd1('0x2e')]);if(_0x2f86d4[_0x8cd1('0x2f')]){delete _0x2f86d4[_0x8cd1('0x2f')];}_0x411ca2[_0x8cd1('0x1f')](_0x49b008)[_0x8cd1('0x30')](_0x2f86d4);};}exports['index']=function(_0x3dece5,_0x5ce70f){var _0x3734c6={},_0x121cec={},_0x1e6e24={'count':0x0,'rows':[]};var _0x17bacf=_['map'](db[_0x8cd1('0x31')][_0x8cd1('0x32')],function(_0x275d08){return{'name':_0x275d08[_0x8cd1('0x33')],'type':_0x275d08[_0x8cd1('0x34')]['key']};});_0x121cec[_0x8cd1('0x35')]=_[_0x8cd1('0x36')](_0x17bacf,_0x8cd1('0x2f'));_0x121cec[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x3dece5[_0x8cd1('0x37')]);_0x121cec[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x121cec[_0x8cd1('0x35')],_0x121cec[_0x8cd1('0x37')]);_0x3734c6[_0x8cd1('0x3b')]=_['intersection'](_0x121cec[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x3dece5['query'][_0x8cd1('0x3c')]));_0x3734c6[_0x8cd1('0x3b')]=_0x3734c6[_0x8cd1('0x3b')]['length']?_0x3734c6[_0x8cd1('0x3b')]:_0x121cec['model'];if(!_0x3dece5[_0x8cd1('0x37')]['hasOwnProperty']('nolimit')){_0x3734c6[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x3dece5['query'][_0x8cd1('0x23')]);_0x3734c6['offset']=qs[_0x8cd1('0x22')](_0x3dece5[_0x8cd1('0x37')][_0x8cd1('0x22')]);}_0x3734c6['order']=qs[_0x8cd1('0x3d')](_0x3dece5['query'][_0x8cd1('0x3d')]);_0x3734c6['where']=qs[_0x8cd1('0x39')](_['pick'](_0x3dece5['query'],_0x121cec[_0x8cd1('0x39')]),_0x17bacf);if(_0x3dece5['query'][_0x8cd1('0x3e')]){_0x3734c6['where']=_[_0x8cd1('0x3f')](_0x3734c6['where'],{'$or':_[_0x8cd1('0x36')](_0x17bacf,function(_0xb50181){if(_0xb50181[_0x8cd1('0x34')]!==_0x8cd1('0x40')){var _0x3ce544={};_0x3ce544[_0xb50181[_0x8cd1('0x2f')]]={'$like':'%'+_0x3dece5[_0x8cd1('0x37')][_0x8cd1('0x3e')]+'%'};return _0x3ce544;}})});}_0x3734c6=_[_0x8cd1('0x3f')]({},_0x3734c6,_0x3dece5[_0x8cd1('0x41')]);var _0x27e24c={'where':_0x3734c6[_0x8cd1('0x42')]};return db['FaxQueue'][_0x8cd1('0x21')](_0x27e24c)['then'](function(_0x2a77a6){_0x1e6e24['count']=_0x2a77a6;if(_0x3dece5[_0x8cd1('0x37')]['includeAll']){_0x3734c6['include']=[{'all':!![]}];}return db[_0x8cd1('0x31')][_0x8cd1('0x43')](_0x3734c6);})[_0x8cd1('0x29')](function(_0x51113){_0x1e6e24[_0x8cd1('0x44')]=_0x51113;return _0x1e6e24;})[_0x8cd1('0x29')](respondWithFilteredResult(_0x5ce70f,_0x3734c6))[_0x8cd1('0x45')](handleError(_0x5ce70f,null));};exports['show']=function(_0x2a8429,_0x7617a3){var _0x579c4c={'raw':!![],'where':{'id':_0x2a8429[_0x8cd1('0x46')]['id']}},_0x4f5af4={};_0x4f5af4[_0x8cd1('0x35')]=_['keys'](db['FaxQueue'][_0x8cd1('0x32')]);_0x4f5af4[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x2a8429['query']);_0x4f5af4[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x4f5af4[_0x8cd1('0x35')],_0x4f5af4[_0x8cd1('0x37')]);_0x579c4c[_0x8cd1('0x3b')]=_[_0x8cd1('0x3a')](_0x4f5af4['model'],qs[_0x8cd1('0x3c')](_0x2a8429['query'][_0x8cd1('0x3c')]));_0x579c4c[_0x8cd1('0x3b')]=_0x579c4c[_0x8cd1('0x3b')][_0x8cd1('0x47')]?_0x579c4c[_0x8cd1('0x3b')]:_0x4f5af4['model'];if(_0x2a8429[_0x8cd1('0x37')][_0x8cd1('0x48')]){_0x579c4c[_0x8cd1('0x49')]=[{'all':!![]}];}_0x579c4c=_[_0x8cd1('0x3f')]({},_0x579c4c,_0x2a8429[_0x8cd1('0x41')]);return db[_0x8cd1('0x31')][_0x8cd1('0x4a')](_0x579c4c)[_0x8cd1('0x29')](handleEntityNotFound(_0x7617a3,null))['then'](respondWithResult(_0x7617a3,null))[_0x8cd1('0x45')](handleError(_0x7617a3,null));};exports[_0x8cd1('0x4b')]=function(_0x47d2ca,_0x2e5363){return db['FaxQueue'][_0x8cd1('0x4b')](_0x47d2ca['body'],{})[_0x8cd1('0x29')](function(_0x43a449){var _0x2344fd=_0x47d2ca[_0x8cd1('0x4c')][_0x8cd1('0x4d')]({'plain':!![]});if(!_0x2344fd)throw new Error(_0x8cd1('0x4e'));if(_0x2344fd['role']==='user'){var _0x434345=_0x43a449[_0x8cd1('0x4d')]({'plain':!![]});var _0x3a7046=_0x8cd1('0x2b');return db[_0x8cd1('0x4f')]['find']({'where':{'name':_0x3a7046,'userProfileId':_0x2344fd[_0x8cd1('0x50')]},'raw':!![]})[_0x8cd1('0x29')](function(_0x313cf5){if(_0x313cf5&&_0x313cf5[_0x8cd1('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x434345[_0x8cd1('0x2f')],'resourceId':_0x434345['id'],'type':_0x313cf5[_0x8cd1('0x2f')],'sectionId':_0x313cf5['id']},{})['then'](function(){return _0x43a449;});}else{return _0x43a449;}})[_0x8cd1('0x45')](function(_0x56d09d){logger[_0x8cd1('0x2d')](_0x8cd1('0x52'),_0x56d09d);throw _0x56d09d;});}return _0x43a449;})['then'](respondWithResult(_0x2e5363,0xc9))[_0x8cd1('0x45')](handleError(_0x2e5363,null));};exports[_0x8cd1('0x28')]=function(_0x112ea1,_0x452dc6){if(_0x112ea1['body']['id']){delete _0x112ea1[_0x8cd1('0x53')]['id'];}return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x112ea1[_0x8cd1('0x46')]['id']}})['then'](handleEntityNotFound(_0x452dc6,null))['then'](saveUpdates(_0x112ea1[_0x8cd1('0x53')],null))['then'](respondWithResult(_0x452dc6,null))[_0x8cd1('0x45')](handleError(_0x452dc6,null));};exports[_0x8cd1('0x2a')]=function(_0x4aedd0,_0x1bb460){return db[_0x8cd1('0x31')][_0x8cd1('0x4a')]({'where':{'id':_0x4aedd0[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x1bb460,null))['then'](removeEntity(_0x1bb460,null))[_0x8cd1('0x45')](handleError(_0x1bb460,null));};exports[_0x8cd1('0x54')]=function(_0x2d6f34,_0x8fd9f5){return db[_0x8cd1('0x31')]['describe']()['then'](respondWithResult(_0x8fd9f5,null))[_0x8cd1('0x45')](handleError(_0x8fd9f5,null));};exports[_0x8cd1('0x55')]=function(_0x364f98,_0x218bac,_0x32cc8e){var _0x20b6a3={'raw':!![],'where':{}},_0x3da29c={},_0x5835ef;return db['FaxQueue'][_0x8cd1('0x56')]({'where':{'id':_0x364f98[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x218bac,null))[_0x8cd1('0x29')](function(_0x356269){if(_0x356269){_0x5835ef=_0x356269[_0x8cd1('0x4d')]({'plain':!![]});_0x3da29c['model']=_[_0x8cd1('0x38')](db[_0x8cd1('0x57')][_0x8cd1('0x32')]);_0x3da29c[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x364f98['query']);_0x3da29c[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x3da29c['model'],_0x3da29c[_0x8cd1('0x37')]);_0x20b6a3['attributes']=_['intersection'](_0x3da29c['model'],qs['fields'](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x3c')]));_0x20b6a3['attributes']=_0x20b6a3[_0x8cd1('0x3b')][_0x8cd1('0x47')]?_0x20b6a3['attributes']:_0x3da29c[_0x8cd1('0x35')];if(!_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x58')](_0x8cd1('0x59'))){_0x20b6a3[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x23')]);_0x20b6a3['offset']=qs[_0x8cd1('0x22')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x22')]);}_0x20b6a3[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x3d')]);_0x20b6a3[_0x8cd1('0x42')]=qs[_0x8cd1('0x39')](_[_0x8cd1('0x5b')](_0x364f98[_0x8cd1('0x37')],_0x3da29c[_0x8cd1('0x39')]));_0x20b6a3[_0x8cd1('0x42')][_0x8cd1('0x5c')]=_0x356269['id'];if(_0x364f98[_0x8cd1('0x37')]['filter']){_0x20b6a3['where']=_[_0x8cd1('0x3f')](_0x20b6a3[_0x8cd1('0x42')],{'$or':_[_0x8cd1('0x36')](_0x20b6a3[_0x8cd1('0x3b')],function(_0x525fb8){var _0x44db80={};_0x44db80[_0x525fb8]={'$like':'%'+_0x364f98['query'][_0x8cd1('0x3e')]+'%'};return _0x44db80;})});}_0x20b6a3=_[_0x8cd1('0x3f')]({},_0x20b6a3,_0x364f98['options']);return db[_0x8cd1('0x57')][_0x8cd1('0x43')](_0x20b6a3);}})[_0x8cd1('0x29')](function(_0x4f1624){if(_0x4f1624){return db[_0x8cd1('0x5d')][_0x8cd1('0x5e')]({'where':{'id':_[_0x8cd1('0x36')](_0x4f1624,_0x8cd1('0x5f')),'role':_0x8cd1('0x60')},'attributes':['id',_0x8cd1('0x2f'),_0x8cd1('0x61'),_0x8cd1('0x62'),'createdAt']});}})[_0x8cd1('0x29')](function(_0x58428b){if(_0x58428b){return{'count':_0x58428b[_0x8cd1('0x21')],'rows':_['map'](_0x58428b[_0x8cd1('0x44')],function(_0x56ff16){return{'membername':_0x56ff16[_0x8cd1('0x2f')],'UserId':_0x56ff16['id'],'queue_name':_0x5835ef['name'],'FaxQueueId':_0x5835ef['id'],'interface':util[_0x8cd1('0x63')]('%s/%s','SIP',_0x56ff16[_0x8cd1('0x2f')]),'penalty':0x0,'paused':_0x56ff16[_0x8cd1('0x61')],'createdAt':_0x56ff16[_0x8cd1('0x64')],'updatedAt':_0x56ff16[_0x8cd1('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8cd1('0x29')](respondWithFilteredResult(_0x218bac,_0x20b6a3))[_0x8cd1('0x45')](handleError(_0x218bac,null));};exports[_0x8cd1('0x65')]=function(_0x5c35dd,_0x12d6f4,_0x363b54){var _0x21bab7={};var _0x176074={};var _0x4cede2;var _0x386403;return db[_0x8cd1('0x31')]['findOne']({'where':{'id':_0x5c35dd['params']['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x12d6f4,null))[_0x8cd1('0x29')](function(_0x31888d){if(_0x31888d){_0x4cede2=_0x31888d;_0x176074['model']=_[_0x8cd1('0x38')](db[_0x8cd1('0x66')][_0x8cd1('0x32')]);_0x176074[_0x8cd1('0x37')]=_['keys'](_0x5c35dd[_0x8cd1('0x37')]);_0x176074[_0x8cd1('0x39')]=_['intersection'](_0x176074[_0x8cd1('0x35')],_0x176074[_0x8cd1('0x37')]);_0x21bab7['attributes']=_['intersection'](_0x176074[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x5c35dd['query'][_0x8cd1('0x3c')]));_0x21bab7[_0x8cd1('0x3b')]=_0x21bab7[_0x8cd1('0x3b')]['length']?_0x21bab7['attributes']:_0x176074[_0x8cd1('0x35')];_0x21bab7[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x5c35dd['query']['sort']);_0x21bab7[_0x8cd1('0x42')]=qs['filters'](_[_0x8cd1('0x5b')](_0x5c35dd[_0x8cd1('0x37')],_0x176074[_0x8cd1('0x39')]));if(_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x3e')]){_0x21bab7['where']=_[_0x8cd1('0x3f')](_0x21bab7[_0x8cd1('0x42')],{'$or':_[_0x8cd1('0x36')](_0x21bab7[_0x8cd1('0x3b')],function(_0x4a0b6e){var _0x3cd7a1={};_0x3cd7a1[_0x4a0b6e]={'$like':'%'+_0x5c35dd[_0x8cd1('0x37')]['filter']+'%'};return _0x3cd7a1;})});}_0x21bab7=_[_0x8cd1('0x3f')]({},_0x21bab7,_0x5c35dd['options']);return _0x4cede2[_0x8cd1('0x65')](_0x21bab7);}})[_0x8cd1('0x29')](function(_0x13d3b1){if(_0x13d3b1){_0x386403=_0x13d3b1[_0x8cd1('0x47')];if(!_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x58')]('nolimit')){_0x21bab7[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x5c35dd['query'][_0x8cd1('0x23')]);_0x21bab7[_0x8cd1('0x22')]=qs[_0x8cd1('0x22')](_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x22')]);}return _0x4cede2[_0x8cd1('0x65')](_0x21bab7);}})[_0x8cd1('0x29')](function(_0x55c354){if(_0x55c354){return _0x55c354?{'count':_0x386403,'rows':_0x55c354}:null;}})['then'](respondWithResult(_0x12d6f4,null))[_0x8cd1('0x45')](handleError(_0x12d6f4,null));};exports[_0x8cd1('0x67')]=function(_0x1e256e,_0x49be53,_0x52fb51){var _0x3b5310=_0x1e256e['body'][_0x8cd1('0x68')];return db[_0x8cd1('0x66')][_0x8cd1('0x43')]({'where':{'id':_0x3b5310},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x8cd1('0x69'),'voicePause',_0x8cd1('0x6a')],'raw':!![]}]})[_0x8cd1('0x29')](function(_0x39b0af){if(_0x39b0af){var _0x270a3f=_[_0x8cd1('0x6b')](_0x39b0af,function(_0x3d3018){var _0x2e4a48=_0x3d3018['get']({'plain':!![]});return _0x2e4a48[_0x8cd1('0x6c')];});return db[_0x8cd1('0x31')]['find']({'where':{'id':_0x1e256e[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](function(_0x1fef45){return db[_0x8cd1('0x6d')][_0x8cd1('0x6e')](function(_0x4ad61b){return _0x1fef45[_0x8cd1('0x67')](_0x3b5310,{'transaction':_0x4ad61b})[_0x8cd1('0x29')](function(){return BPromise['each'](_0x270a3f,function(_0x5b4fdd){return db[_0x8cd1('0x57')][_0x8cd1('0x6f')]({'where':{'UserId':_0x5b4fdd['id'],'FaxQueueId':_0x1e256e[_0x8cd1('0x46')]['id']},'transaction':_0x4ad61b});});})[_0x8cd1('0x29')](function(){_0x270a3f[_0x8cd1('0x70')](function(_0x4177dd){socket[_0x8cd1('0x71')](_0x8cd1('0x72'),{'UserId':_0x4177dd['id'],'FaxQueueId':_0x1fef45['id']});});});});});}})[_0x8cd1('0x29')](respondWithStatusCode(_0x49be53,null))['catch'](handleError(_0x49be53,null));};exports[_0x8cd1('0x73')]=function(_0x1d629e,_0x353c61,_0x497558){return db['Team'][_0x8cd1('0x43')]({'where':{'id':_0x1d629e[_0x8cd1('0x37')][_0x8cd1('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8cd1('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x353c61,null))[_0x8cd1('0x29')](function(_0x12f284){var _0x36b51c=_[_0x8cd1('0x36')](_0x12f284,'id');var _0x2a7905=[];var _0x1c772f=[];var _0xedc148=squel[_0x8cd1('0x74')]();_0xedc148[_0x8cd1('0x75')](_0x8cd1('0x76'))['from'](_0x8cd1('0x77'),'tq')['join']('user_has_teams','ut',_0x8cd1('0x78'))[_0x8cd1('0x42')](_0x8cd1('0x79'),_0x1d629e[_0x8cd1('0x46')]['id']);for(var _0x5e0a46=0x0;_0x5e0a46<_0x12f284[_0x8cd1('0x47')];_0x5e0a46+=0x1){let _0x1545a3=_0x12f284[_0x5e0a46];for(var _0x1f0ddb=0x0;_0x1f0ddb<_0x1545a3['Agents'][_0x8cd1('0x47')];_0x1f0ddb+=0x1){let _0x242235=_0x1545a3['Agents'][_0x1f0ddb];var _0x2cacb1=_0xedc148[_0x8cd1('0x7a')]();_0x2cacb1[_0x8cd1('0x42')](_0x8cd1('0x7b'),_0x242235['id']);_0x1c772f[_0x8cd1('0x7c')](db[_0x8cd1('0x6d')][_0x8cd1('0x37')](_0x2cacb1[_0x8cd1('0x7d')](),{'type':db[_0x8cd1('0x6d')]['QueryTypes'][_0x8cd1('0x7e')]})['then'](function(_0x4e8f75){if(_0x4e8f75[_0x8cd1('0x47')]===0x1){return _0x242235['id'];}else{var _0x4710c9=_['every'](_[_0x8cd1('0x36')](_0x4e8f75,_0x8cd1('0x7f')),function(_0x562e22){return _[_0x8cd1('0x80')](_0x36b51c,_0x562e22);});if(_0x4710c9){return _0x242235['id'];}}}));}}return BPromise[_0x8cd1('0x81')](_0x1c772f)[_0x8cd1('0x29')](function(_0x52f2cf){_0x2a7905=_(_0x2a7905)['union'](_0x52f2cf)[_0x8cd1('0x82')]()['value']();return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x1d629e[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](function(_0x350bbb){return db[_0x8cd1('0x6d')]['transaction'](function(_0x1afe33){return _0x350bbb[_0x8cd1('0x73')](_0x1d629e[_0x8cd1('0x37')][_0x8cd1('0x68')],{'transaction':_0x1afe33})[_0x8cd1('0x29')](function(){if(!_['isEmpty'](_0x2a7905)){return _0x350bbb[_0x8cd1('0x83')](_0x2a7905,{'transaction':_0x1afe33});}})[_0x8cd1('0x29')](function(){_0x2a7905[_0x8cd1('0x70')](function(_0x3b51a5){socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':_0x3b51a5,'FaxQueueId':_0x350bbb['id']});});});});});});})['then'](respondWithStatusCode(_0x353c61,null))[_0x8cd1('0x45')](handleError(_0x353c61,null));};exports[_0x8cd1('0x85')]=function(_0x54fbfa,_0x5eb5d4,_0x5d02ce){return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x54fbfa['params']['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x5eb5d4,null))['then'](function(_0x2e7308){if(_0x2e7308){return _0x2e7308[_0x8cd1('0x85')](_0x54fbfa[_0x8cd1('0x53')][_0x8cd1('0x68')],_[_0x8cd1('0x86')](_0x54fbfa[_0x8cd1('0x53')],[_0x8cd1('0x68'),'id'])||{})[_0x8cd1('0x87')](function(_0x4b76a){for(var _0x4755bb=0x0;_0x4755bb<_0x54fbfa[_0x8cd1('0x53')]['ids'][_0x8cd1('0x47')];_0x4755bb+=0x1){socket[_0x8cd1('0x71')](_0x8cd1('0x72'),{'UserId':_0x54fbfa['body'][_0x8cd1('0x68')][_0x4755bb],'FaxQueueId':_0x54fbfa[_0x8cd1('0x46')]['id']});}return _0x4b76a;});}})['then'](respondWithResult(_0x5eb5d4,null))['catch'](handleError(_0x5eb5d4,null));};exports[_0x8cd1('0x83')]=function(_0x47e464,_0x51c350,_0x40366b){return db[_0x8cd1('0x31')][_0x8cd1('0x4a')]({'where':{'id':_0x47e464[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x51c350,null))[_0x8cd1('0x29')](function(_0x331170){if(_0x331170){return _0x331170[_0x8cd1('0x83')](_0x47e464[_0x8cd1('0x37')][_0x8cd1('0x68')])[_0x8cd1('0x29')](function(){if(_[_0x8cd1('0x88')](_0x47e464['query'][_0x8cd1('0x68')])){for(var _0x3057f7=0x0;_0x3057f7<_0x47e464[_0x8cd1('0x37')][_0x8cd1('0x68')]['length'];_0x3057f7+=0x1){socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':Number(_0x47e464['query'][_0x8cd1('0x68')][_0x3057f7]),'FaxQueueId':Number(_0x47e464[_0x8cd1('0x46')]['id'])});}}else{socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':Number(_0x47e464['query'][_0x8cd1('0x68')]),'FaxQueueId':Number(_0x47e464[_0x8cd1('0x46')]['id'])});}});}})[_0x8cd1('0x29')](respondWithStatusCode(_0x51c350,null))[_0x8cd1('0x45')](handleError(_0x51c350,null));};exports[_0x8cd1('0x89')]=function(_0x26e04b,_0x236e0b,_0x58c160){var _0x3e747e={};var _0x2aad5f={};var _0x229610;var _0x417b10;return db['FaxQueue']['findOne']({'where':{'id':_0x26e04b[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x236e0b,null))['then'](function(_0x567cde){if(_0x567cde){_0x229610=_0x567cde;_0x2aad5f[_0x8cd1('0x35')]=_[_0x8cd1('0x38')](db[_0x8cd1('0x5d')]['rawAttributes']);_0x2aad5f[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x26e04b[_0x8cd1('0x37')]);_0x2aad5f[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x2aad5f[_0x8cd1('0x35')],_0x2aad5f[_0x8cd1('0x37')]);_0x3e747e[_0x8cd1('0x3b')]=_[_0x8cd1('0x3a')](_0x2aad5f[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x26e04b['query'][_0x8cd1('0x3c')]));_0x3e747e[_0x8cd1('0x3b')]=_0x3e747e['attributes']['length']?_0x3e747e[_0x8cd1('0x3b')]:_0x2aad5f[_0x8cd1('0x35')];_0x3e747e[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x3d')]);_0x3e747e[_0x8cd1('0x42')]=qs[_0x8cd1('0x39')](_[_0x8cd1('0x5b')](_0x26e04b['query'],_0x2aad5f['filters']));if(_0x26e04b['query'][_0x8cd1('0x3e')]){_0x3e747e[_0x8cd1('0x42')]=_[_0x8cd1('0x3f')](_0x3e747e['where'],{'$or':_[_0x8cd1('0x36')](_0x3e747e[_0x8cd1('0x3b')],function(_0x1f5f3a){var _0x475a70={};_0x475a70[_0x1f5f3a]={'$like':'%'+_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x3e')]+'%'};return _0x475a70;})});}_0x3e747e=_[_0x8cd1('0x3f')]({},_0x3e747e,_0x26e04b[_0x8cd1('0x41')]);return _0x229610[_0x8cd1('0x89')](_0x3e747e);}})[_0x8cd1('0x29')](function(_0x36b889){if(_0x36b889){_0x417b10=_0x36b889[_0x8cd1('0x47')];if(!_0x26e04b['query'][_0x8cd1('0x58')]('nolimit')){_0x3e747e['limit']=qs[_0x8cd1('0x23')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x23')]);_0x3e747e[_0x8cd1('0x22')]=qs[_0x8cd1('0x22')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x22')]);}return _0x229610['getAgents'](_0x3e747e);}})[_0x8cd1('0x29')](function(_0x1ced03){if(_0x1ced03){return _0x1ced03?{'count':_0x417b10,'rows':_0x1ced03}:null;}})[_0x8cd1('0x29')](respondWithResult(_0x236e0b,null))[_0x8cd1('0x45')](handleError(_0x236e0b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 59948cd..aae2af0 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 _0xd399=['save','update','remove','emit','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xd399,0x1a4));var _0x9d39=function(_0x3e16bb,_0x11045c){_0x3e16bb=_0x3e16bb-0x0;var _0x19d8db=_0xd399[_0x3e16bb];return _0x19d8db;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x9d39('0x0'))['db'][_0x9d39('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9d39('0x2')](0x0);var events={'afterCreate':_0x9d39('0x3'),'afterUpdate':_0x9d39('0x4'),'afterDestroy':_0x9d39('0x5')};function emitEvent(_0x1cda69){return function(_0x27e5bc,_0x5ab51a,_0x5454cf){FaxQueueEvents[_0x9d39('0x6')](_0x1cda69+':'+_0x27e5bc['id'],_0x27e5bc);FaxQueueEvents[_0x9d39('0x6')](_0x1cda69,_0x27e5bc);_0x5454cf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9d39('0x7')](e,emitEvent(event));}}module[_0x9d39('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xda53=['exports','../../mysqldb','FaxQueue','update','hook'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xda53,0x114));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x3da5('0x0'))['db'][_0x3da5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3da5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x43cc83){return function(_0x560f9d,_0x4a57f9,_0x3cb14f){FaxQueueEvents['emit'](_0x43cc83+':'+_0x560f9d['id'],_0x560f9d);FaxQueueEvents['emit'](_0x43cc83,_0x560f9d);_0x3cb14f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x3da5('0x3')](e,emitEvent(event));}}module[_0x3da5('0x4')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5629648..78a720c 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 _0xdeee=['fax_queues','util','../../config/logger','api','bluebird','request-promise','exports','define','FaxQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdeee,0xeb));var _0xedee=function(_0x2c54d3,_0x1bf001){_0x2c54d3=_0x2c54d3-0x0;var _0x5d62c8=_0xdeee[_0x2c54d3];return _0x5d62c8;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require('moment');var BPromise=require(_0xedee('0x3'));var rp=require(_0xedee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xedee('0x5')]=function(_0xec8ee0,_0x569234){return _0xec8ee0[_0xedee('0x6')](_0xedee('0x7'),attributes,{'tableName':_0xedee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c6f=['request-promise','path','rimraf','exports','define','fax_queues','lodash','util','../../config/logger'];(function(_0x362689,_0x32f169){var _0x11f999=function(_0x2df9c8){while(--_0x2df9c8){_0x362689['push'](_0x362689['shift']());}};_0x11f999(++_0x32f169);}(_0x7c6f,0x141));var _0xf7c6=function(_0x76d1ca,_0x2577ad){_0x76d1ca=_0x76d1ca-0x0;var _0x5a056=_0x7c6f[_0x76d1ca];return _0x5a056;};'use strict';var _=require(_0xf7c6('0x0'));var util=require(_0xf7c6('0x1'));var logger=require(_0xf7c6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7c6('0x3'));var fs=require('fs');var path=require(_0xf7c6('0x4'));var rimraf=require(_0xf7c6('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xf7c6('0x6')]=function(_0x2c85ac,_0x1e015b){return _0x2c85ac[_0xf7c6('0x7')]('FaxQueue',attributes,{'tableName':_0xf7c6('0x8'),'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 4a4a7e9..1c85581 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 _0x343b=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','info','find','raw','ShowFaxQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','then'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x343b,0x1ae));var _0xb343=function(_0x45f0b3,_0x20e607){_0x45f0b3=_0x45f0b3-0x0;var _0x1ab605=_0x343b[_0x45f0b3];return _0x1ab605;};'use strict';var _=require('lodash');var util=require(_0xb343('0x0'));var moment=require(_0xb343('0x1'));var BPromise=require(_0xb343('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb343('0x3'));var db=require(_0xb343('0x4'))['db'];var utils=require(_0xb343('0x5'));var logger=require(_0xb343('0x6'))(_0xb343('0x7'));var config=require(_0xb343('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb343('0x9')]['http']({'port':0x232a});config[_0xb343('0xa')]=_[_0xb343('0xb')](config[_0xb343('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xb343('0xc')](socket);function respondWithRpcPromise(_0x5a5b0f,_0x2b9ac7,_0xdbbf6b){return new BPromise(function(_0x158e15,_0x3a8b66){return client['request'](_0x5a5b0f,_0xdbbf6b)[_0xb343('0xd')](function(_0x3fd3d1){logger['info'](_0xb343('0xe'),_0x2b9ac7,_0xb343('0xf'));logger[_0xb343('0x10')](_0xb343('0x11'),_0x2b9ac7,_0xb343('0xf'),JSON[_0xb343('0x12')](_0x3fd3d1));if(_0x3fd3d1['error']){if(_0x3fd3d1[_0xb343('0x13')]['code']===0x1f4){logger['error'](_0xb343('0xe'),_0x2b9ac7,_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);return _0x3a8b66(_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);}logger[_0xb343('0x13')](_0xb343('0xe'),_0x2b9ac7,_0x3fd3d1[_0xb343('0x13')]['message']);return _0x158e15(_0x3fd3d1[_0xb343('0x13')][_0xb343('0x14')]);}else{logger['info'](_0xb343('0xe'),_0x2b9ac7,_0xb343('0xf'));_0x158e15(_0x3fd3d1[_0xb343('0x15')][_0xb343('0x14')]);}})[_0xb343('0x16')](function(_0x4b5839){logger['error'](_0xb343('0xe'),_0x2b9ac7,_0x4b5839);_0x3a8b66(_0x4b5839);});});}exports[_0xb343('0x17')]=function(_0x2b0c47){var _0x561e86=this;return new Promise(function(_0x4fba58,_0x3d2cfe){return db[_0xb343('0x18')][_0xb343('0x19')]({'raw':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47['options'][_0xb343('0x1b')]||null:null,'attributes':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')]['attributes']||null:null,'limit':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1c')]||null:null,'include':_0x2b0c47[_0xb343('0x1a')]?_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x2b0c47[_0xb343('0x1a')][_0xb343('0x1d')],function(_0x4f9853){return{'model':db[_0x4f9853[_0xb343('0x1f')]],'as':_0x4f9853['as'],'attributes':_0x4f9853[_0xb343('0x20')],'include':_0x4f9853['include']?_[_0xb343('0x1e')](_0x4f9853['include'],function(_0x76fefa){return{'model':db[_0x76fefa[_0xb343('0x1f')]],'as':_0x76fefa['as'],'attributes':_0x76fefa['attributes'],'include':_0x76fefa[_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x76fefa['include'],function(_0x555753){return{'model':db[_0x555753[_0xb343('0x1f')]],'as':_0x555753['as'],'attributes':_0x555753[_0xb343('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5780a5){logger[_0xb343('0x21')](_0xb343('0x17'),_0x2b0c47);logger['debug']('GetFaxQueue',_0x2b0c47,JSON[_0xb343('0x12')](_0x5780a5));_0x4fba58(_0x5780a5);})[_0xb343('0x16')](function(_0x4affb7){logger['error']('GetFaxQueue',_0x4affb7[_0xb343('0x14')],_0x2b0c47);_0x3d2cfe(_0x561e86['error'](0x1f4,_0x4affb7[_0xb343('0x14')]));});});};exports['ShowFaxQueue']=function(_0x16dd2e){var _0x5d0ca6=this;return new Promise(function(_0x47638d,_0x42ae47){return db[_0xb343('0x18')][_0xb343('0x22')]({'raw':_0x16dd2e[_0xb343('0x1a')]?_0x16dd2e[_0xb343('0x1a')][_0xb343('0x23')]===undefined?!![]:![]:!![],'where':_0x16dd2e['options']?_0x16dd2e[_0xb343('0x1a')][_0xb343('0x1b')]||null:null,'attributes':_0x16dd2e['options']?_0x16dd2e['options']['attributes']||null:null,'include':_0x16dd2e['options']?_0x16dd2e['options'][_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x16dd2e[_0xb343('0x1a')][_0xb343('0x1d')],function(_0x48e94f){return{'model':db[_0x48e94f[_0xb343('0x1f')]],'as':_0x48e94f['as'],'attributes':_0x48e94f[_0xb343('0x20')],'include':_0x48e94f[_0xb343('0x1d')]?_['map'](_0x48e94f[_0xb343('0x1d')],function(_0x210894){return{'model':db[_0x210894[_0xb343('0x1f')]],'as':_0x210894['as'],'attributes':_0x210894['attributes'],'include':_0x210894[_0xb343('0x1d')]?_[_0xb343('0x1e')](_0x210894['include'],function(_0x3494ee){return{'model':db[_0x3494ee[_0xb343('0x1f')]],'as':_0x3494ee['as'],'attributes':_0x3494ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xb343('0xd')](function(_0x439910){logger[_0xb343('0x21')](_0xb343('0x24'),_0x16dd2e);logger['debug'](_0xb343('0x24'),_0x16dd2e,JSON[_0xb343('0x12')](_0x439910));_0x47638d(_0x439910);})[_0xb343('0x16')](function(_0x22606d){logger[_0xb343('0x13')](_0xb343('0x24'),_0x22606d['message'],_0x16dd2e);_0x42ae47(_0x5d0ca6[_0xb343('0x13')](0x1f4,_0x22606d[_0xb343('0x14')]));});});}; \ No newline at end of file +var _0xc24f=['message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2d3627,_0x12bf50){var _0x42d073=function(_0x26d96a){while(--_0x26d96a){_0x2d3627['push'](_0x2d3627['shift']());}};_0x42d073(++_0x12bf50);}(_0xc24f,0x148));var _0xfc24=function(_0x2b581a,_0x1e8ed7){_0x2b581a=_0x2b581a-0x0;var _0xd46de1=_0xc24f[_0x2b581a];return _0xd46de1;};'use strict';var _=require(_0xfc24('0x0'));var util=require(_0xfc24('0x1'));var moment=require(_0xfc24('0x2'));var BPromise=require(_0xfc24('0x3'));var rs=require(_0xfc24('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc24('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfc24('0x6'));var jayson=require(_0xfc24('0x7'));var client=jayson[_0xfc24('0x8')][_0xfc24('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc24('0xa')]));require(_0xfc24('0xb'))[_0xfc24('0xc')](socket);function respondWithRpcPromise(_0xd50919,_0x32be92,_0x428949){return new BPromise(function(_0x49b20c,_0x3b6398){return client[_0xfc24('0xd')](_0xd50919,_0x428949)[_0xfc24('0xe')](function(_0x1186f1){logger[_0xfc24('0xf')](_0xfc24('0x10'),_0x32be92,_0xfc24('0x11'));logger[_0xfc24('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x32be92,_0xfc24('0x11'),JSON[_0xfc24('0x13')](_0x1186f1));if(_0x1186f1[_0xfc24('0x14')]){if(_0x1186f1['error'][_0xfc24('0x15')]===0x1f4){logger[_0xfc24('0x14')](_0xfc24('0x10'),_0x32be92,_0x1186f1[_0xfc24('0x14')]['message']);return _0x3b6398(_0x1186f1[_0xfc24('0x14')][_0xfc24('0x16')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x32be92,_0x1186f1['error'][_0xfc24('0x16')]);return _0x49b20c(_0x1186f1[_0xfc24('0x14')][_0xfc24('0x16')]);}else{logger[_0xfc24('0xf')]('FaxQueue,\x20%s,\x20%s',_0x32be92,_0xfc24('0x11'));_0x49b20c(_0x1186f1['result']['message']);}})[_0xfc24('0x17')](function(_0x43ba15){logger['error']('FaxQueue,\x20%s,\x20%s',_0x32be92,_0x43ba15);_0x3b6398(_0x43ba15);});});}exports[_0xfc24('0x18')]=function(_0x371963){var _0x4649f2=this;return new Promise(function(_0x133421,_0x59b599){return db[_0xfc24('0x19')]['findAll']({'raw':_0x371963[_0xfc24('0x1a')]?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1b')]===undefined?!![]:![]:!![],'where':_0x371963['options']?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1c')]||null:null,'attributes':_0x371963['options']?_0x371963['options'][_0xfc24('0x1d')]||null:null,'limit':_0x371963[_0xfc24('0x1a')]?_0x371963['options']['limit']||null:null,'include':_0x371963[_0xfc24('0x1a')]?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x371963[_0xfc24('0x1a')][_0xfc24('0x1e')],function(_0x4122e0){return{'model':db[_0x4122e0[_0xfc24('0x20')]],'as':_0x4122e0['as'],'attributes':_0x4122e0['attributes'],'include':_0x4122e0[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x4122e0[_0xfc24('0x1e')],function(_0x129f91){return{'model':db[_0x129f91[_0xfc24('0x20')]],'as':_0x129f91['as'],'attributes':_0x129f91[_0xfc24('0x1d')],'include':_0x129f91[_0xfc24('0x1e')]?_['map'](_0x129f91[_0xfc24('0x1e')],function(_0x25a36e){return{'model':db[_0x25a36e[_0xfc24('0x20')]],'as':_0x25a36e['as'],'attributes':_0x25a36e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc24('0xe')](function(_0x34f513){logger[_0xfc24('0xf')](_0xfc24('0x18'),_0x371963);logger[_0xfc24('0x12')](_0xfc24('0x18'),_0x371963,JSON[_0xfc24('0x13')](_0x34f513));_0x133421(_0x34f513);})[_0xfc24('0x17')](function(_0x5856c7){logger[_0xfc24('0x14')](_0xfc24('0x18'),_0x5856c7[_0xfc24('0x16')],_0x371963);_0x59b599(_0x4649f2[_0xfc24('0x14')](0x1f4,_0x5856c7[_0xfc24('0x16')]));});});};exports[_0xfc24('0x21')]=function(_0x155fd7){var _0x134e1e=this;return new Promise(function(_0xec2f4b,_0x338764){return db[_0xfc24('0x19')][_0xfc24('0x22')]({'raw':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1c')]||null:null,'attributes':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1d')]||null:null,'include':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7['options'][_0xfc24('0x1e')]?_['map'](_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1e')],function(_0x352c2f){return{'model':db[_0x352c2f[_0xfc24('0x20')]],'as':_0x352c2f['as'],'attributes':_0x352c2f[_0xfc24('0x1d')],'include':_0x352c2f[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x352c2f[_0xfc24('0x1e')],function(_0x1d5dd1){return{'model':db[_0x1d5dd1[_0xfc24('0x20')]],'as':_0x1d5dd1['as'],'attributes':_0x1d5dd1[_0xfc24('0x1d')],'include':_0x1d5dd1[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x1d5dd1[_0xfc24('0x1e')],function(_0x26ea43){return{'model':db[_0x26ea43[_0xfc24('0x20')]],'as':_0x26ea43['as'],'attributes':_0x26ea43[_0xfc24('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d47f9){logger[_0xfc24('0xf')](_0xfc24('0x21'),_0x155fd7);logger[_0xfc24('0x12')](_0xfc24('0x21'),_0x155fd7,JSON[_0xfc24('0x13')](_0x4d47f9));_0xec2f4b(_0x4d47f9);})[_0xfc24('0x17')](function(_0x4cd721){logger[_0xfc24('0x14')](_0xfc24('0x21'),_0x4cd721['message'],_0x155fd7);_0x338764(_0x134e1e['error'](0x1f4,_0x4cd721[_0xfc24('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 61c2b22..297af1e 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 _0xc6b4=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1b616e,_0x213f14){var _0x3dc67f=function(_0x437a98){while(--_0x437a98){_0x1b616e['push'](_0x1b616e['shift']());}};_0x3dc67f(++_0x213f14);}(_0xc6b4,0x6b));var _0x4c6b=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0xc6b4[_0x229128];return _0x1875b9;};'use strict';var FaxQueueEvents=require(_0x4c6b('0x0'));var events=[_0x4c6b('0x1'),_0x4c6b('0x2'),_0x4c6b('0x3')];function createListener(_0x2f5165,_0x1fdf96){return function(_0x5a671e){_0x1fdf96[_0x4c6b('0x4')](_0x2f5165,_0x5a671e);};}function removeListener(_0x14f257,_0x5d7060){return function(){FaxQueueEvents[_0x4c6b('0x5')](_0x14f257,_0x5d7060);};}exports[_0x4c6b('0x6')]=function(_0x15ad08){for(var _0x5bd660=0x0,_0x37a1c4=events[_0x4c6b('0x7')];_0x5bd660<_0x37a1c4;_0x5bd660++){var _0x220834=events[_0x5bd660];var _0x5b7309=createListener(_0x4c6b('0x8')+_0x220834,_0x15ad08);FaxQueueEvents['on'](_0x220834,_0x5b7309);}}; \ No newline at end of file +var _0xec53=['save','emit','removeListener','register','faxQueue:'];(function(_0x1f7662,_0x5cde47){var _0x1a8fd8=function(_0xf857ca){while(--_0xf857ca){_0x1f7662['push'](_0x1f7662['shift']());}};_0x1a8fd8(++_0x5cde47);}(_0xec53,0xaa));var _0x3ec5=function(_0x412ca4,_0x110b15){_0x412ca4=_0x412ca4-0x0;var _0x192e25=_0xec53[_0x412ca4];return _0x192e25;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x3ec5('0x0'),'remove','update'];function createListener(_0xdacda3,_0x2a7b89){return function(_0x35e4a1){_0x2a7b89[_0x3ec5('0x1')](_0xdacda3,_0x35e4a1);};}function removeListener(_0x3f4719,_0x476f96){return function(){FaxQueueEvents[_0x3ec5('0x2')](_0x3f4719,_0x476f96);};}exports[_0x3ec5('0x3')]=function(_0x1c9efa){for(var _0x35274a=0x0,_0x3a024c=events['length'];_0x35274a<_0x3a024c;_0x35274a++){var _0x4346ba=events[_0x35274a];var _0x110ed4=createListener(_0x3ec5('0x4')+_0x4346ba,_0x1c9efa);FaxQueueEvents['on'](_0x4346ba,_0x110ed4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index cb9065f..105f5b9 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(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4fa4fd,_0x4c656b){_0x4fa4fd=_0x4fa4fd-0x0;var _0x3c50d0=_0x0b0e[_0x4fa4fd];return _0x3c50d0;};'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(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xb10b,0x12a));var _0xbb10=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xb10b[_0x16bb4b];return _0x8aeb84;};'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 a101915..c9a857c 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 _0x6182=['moment','sequelize','exports','STRING','DATE'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6182,0x1bd));var _0x2618=function(_0x4cd697,_0x4fc09f){_0x4cd697=_0x4cd697-0x0;var _0x414475=_0x6182[_0x4cd697];return _0x414475;};'use strict';var moment=require(_0x2618('0x0'));var Sequelize=require(_0x2618('0x1'));module[_0x2618('0x2')]={'uniqueid':{'type':Sequelize[_0x2618('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2618('0x3')]},'joinAt':{'type':Sequelize[_0x2618('0x4')]},'leaveAt':{'type':Sequelize[_0x2618('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2618('0x4')]},'reason':{'type':Sequelize[_0x2618('0x3')]}}; \ No newline at end of file +var _0x93ed=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e1082,_0x264907){var _0x10a267=function(_0x4055ff){while(--_0x4055ff){_0x1e1082['push'](_0x1e1082['shift']());}};_0x10a267(++_0x264907);}(_0x93ed,0x192));var _0xd93e=function(_0x4bdda0,_0x2dd23d){_0x4bdda0=_0x4bdda0-0x0;var _0x2d3f4e=_0x93ed[_0x4bdda0];return _0x2d3f4e;};'use strict';var moment=require(_0xd93e('0x0'));var Sequelize=require(_0xd93e('0x1'));module[_0xd93e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd93e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd93e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd93e('0x4')]},'reason':{'type':Sequelize[_0xd93e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index bd5dbbc..b27e8e7 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 _0x727a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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'];(function(_0x529156,_0x175c52){var _0x515f46=function(_0x39c0ab){while(--_0x39c0ab){_0x529156['push'](_0x529156['shift']());}};_0x515f46(++_0x175c52);}(_0x727a,0x173));var _0xa727=function(_0x557081,_0x5e7589){_0x557081=_0x557081-0x0;var _0x373575=_0x727a[_0x557081];return _0x373575;};'use strict';var pdf=require(_0xa727('0x0'));var emlformat=require(_0xa727('0x1'));var rimraf=require(_0xa727('0x2'));var zipdir=require(_0xa727('0x3'));var jsonpatch=require(_0xa727('0x4'));var rp=require(_0xa727('0x5'));var moment=require(_0xa727('0x6'));var BPromise=require(_0xa727('0x7'));var Mustache=require(_0xa727('0x8'));var util=require('util');var path=require(_0xa727('0x9'));var sox=require(_0xa727('0xa'));var csv=require(_0xa727('0xb'));var ejs=require(_0xa727('0xc'));var fs=require('fs');var _=require(_0xa727('0xd'));var squel=require(_0xa727('0xe'));var crypto=require(_0xa727('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa727('0x10'));var toCsv=require(_0xa727('0xb'));var querystring=require(_0xa727('0x11'));var Papa=require(_0xa727('0x12'));var Redis=require(_0xa727('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa727('0x14'));var as=require(_0xa727('0x15'));var hardwareService=require(_0xa727('0x16'));var logger=require(_0xa727('0x17'))('api');var utils=require(_0xa727('0x18'));var config=require(_0xa727('0x19'));var licenseUtil=require(_0xa727('0x1a'));var db=require(_0xa727('0x1b'))['db'];function respondWithStatusCode(_0x168a71,_0x3b9319){_0x3b9319=_0x3b9319||0xcc;return function(_0x248148){if(_0x248148){return _0x168a71[_0xa727('0x1c')](_0x3b9319);}return _0x168a71[_0xa727('0x1d')](_0x3b9319)['end']();};}function respondWithResult(_0x502935,_0x59e7f6){_0x59e7f6=_0x59e7f6||0xc8;return function(_0x3c5362){if(_0x3c5362){return _0x502935[_0xa727('0x1d')](_0x59e7f6)['json'](_0x3c5362);}};}function respondWithFilteredResult(_0x46e13e,_0x113f12){return function(_0x5f2ede){if(_0x5f2ede){var _0x51ac86=_0x5f2ede[_0xa727('0x1e')],_0x1d1500=_0x113f12[_0xa727('0x1f')],_0x3d271c=_0x113f12[_0xa727('0x1f')]+_0x113f12[_0xa727('0x20')],_0x5bec7;if(_0x3d271c>=_0x51ac86){_0x3d271c=_0x51ac86;_0x5bec7=0xc8;}else{_0x5bec7=0xce;}_0x46e13e[_0xa727('0x1d')](_0x5bec7);return _0x46e13e[_0xa727('0x21')](_0xa727('0x22'),_0x1d1500+'-'+_0x3d271c+'/'+_0x51ac86)[_0xa727('0x23')](_0x5f2ede);}return null;};}function patchUpdates(_0x98cac7){return function(_0x4f3c84){try{jsonpatch[_0xa727('0x24')](_0x4f3c84,_0x98cac7,!![]);}catch(_0x2e6d68){return BPromise[_0xa727('0x25')](_0x2e6d68);}return _0x4f3c84[_0xa727('0x26')]();};}function saveUpdates(_0x348d0c,_0x196d52){return function(_0x11c27b){if(_0x11c27b){return _0x11c27b['update'](_0x348d0c)[_0xa727('0x27')](function(_0x5ca56a){return _0x5ca56a;});}return null;};}function removeEntity(_0x20f214,_0x18153f){return function(_0x285995){if(_0x285995){return _0x285995[_0xa727('0x28')]()[_0xa727('0x27')](function(){_0x20f214[_0xa727('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4632a3,_0x5e693a){return function(_0x2d46f5){if(!_0x2d46f5){_0x4632a3['sendStatus'](0x194);}return _0x2d46f5;};}function handleError(_0x5d244b,_0x16cfaf){_0x16cfaf=_0x16cfaf||0x1f4;return function(_0x43a26c){logger[_0xa727('0x29')](_0x43a26c['stack']);if(_0x43a26c[_0xa727('0x2a')]){delete _0x43a26c[_0xa727('0x2a')];}_0x5d244b[_0xa727('0x1d')](_0x16cfaf)[_0xa727('0x2b')](_0x43a26c);};}exports['index']=function(_0x334433,_0x4b2ccb){var _0xa37456={},_0x5cb7b1={},_0x342fa0={'count':0x0,'rows':[]};var _0x4ceda4=_[_0xa727('0x2c')](db[_0xa727('0x2d')][_0xa727('0x2e')],function(_0x3fd7fb){return{'name':_0x3fd7fb[_0xa727('0x2f')],'type':_0x3fd7fb['type'][_0xa727('0x30')]};});_0x5cb7b1[_0xa727('0x31')]=_['map'](_0x4ceda4,_0xa727('0x2a'));_0x5cb7b1[_0xa727('0x32')]=_['keys'](_0x334433[_0xa727('0x32')]);_0x5cb7b1['filters']=_[_0xa727('0x33')](_0x5cb7b1[_0xa727('0x31')],_0x5cb7b1[_0xa727('0x32')]);_0xa37456['attributes']=_[_0xa727('0x33')](_0x5cb7b1['model'],qs[_0xa727('0x34')](_0x334433['query'][_0xa727('0x34')]));_0xa37456[_0xa727('0x35')]=_0xa37456[_0xa727('0x35')][_0xa727('0x36')]?_0xa37456[_0xa727('0x35')]:_0x5cb7b1[_0xa727('0x31')];if(!_0x334433['query'][_0xa727('0x37')](_0xa727('0x38'))){_0xa37456[_0xa727('0x20')]=qs[_0xa727('0x20')](_0x334433[_0xa727('0x32')][_0xa727('0x20')]);_0xa37456[_0xa727('0x1f')]=qs['offset'](_0x334433['query']['offset']);}_0xa37456[_0xa727('0x39')]=qs[_0xa727('0x3a')](_0x334433[_0xa727('0x32')][_0xa727('0x3a')]);_0xa37456[_0xa727('0x3b')]=qs[_0xa727('0x3c')](_['pick'](_0x334433['query'],_0x5cb7b1['filters']),_0x4ceda4);if(_0x334433[_0xa727('0x32')][_0xa727('0x3d')]){_0xa37456['where']=_[_0xa727('0x3e')](_0xa37456[_0xa727('0x3b')],{'$or':_[_0xa727('0x2c')](_0x4ceda4,function(_0x2dc37a){if(_0x2dc37a[_0xa727('0x3f')]!==_0xa727('0x40')){var _0x4487a5={};_0x4487a5[_0x2dc37a['name']]={'$like':'%'+_0x334433[_0xa727('0x32')][_0xa727('0x3d')]+'%'};return _0x4487a5;}})});}_0xa37456=_[_0xa727('0x3e')]({},_0xa37456,_0x334433[_0xa727('0x41')]);var _0x101f2a={'where':_0xa37456[_0xa727('0x3b')]};return db['FaxQueueReport'][_0xa727('0x1e')](_0x101f2a)[_0xa727('0x27')](function(_0x9de4a0){_0x342fa0[_0xa727('0x1e')]=_0x9de4a0;if(_0x334433['query'][_0xa727('0x42')]){_0xa37456[_0xa727('0x43')]=[{'all':!![]}];}return db[_0xa727('0x2d')][_0xa727('0x44')](_0xa37456);})[_0xa727('0x27')](function(_0x54ca2f){_0x342fa0[_0xa727('0x45')]=_0x54ca2f;return _0x342fa0;})['then'](respondWithFilteredResult(_0x4b2ccb,_0xa37456))[_0xa727('0x46')](handleError(_0x4b2ccb,null));};exports[_0xa727('0x47')]=function(_0x1fccb,_0x43b62b){var _0x2ba9a4={'raw':!![],'where':{'id':_0x1fccb[_0xa727('0x48')]['id']}},_0x2c7883={};_0x2c7883['model']=_[_0xa727('0x49')](db[_0xa727('0x2d')][_0xa727('0x2e')]);_0x2c7883[_0xa727('0x32')]=_[_0xa727('0x49')](_0x1fccb['query']);_0x2c7883[_0xa727('0x3c')]=_[_0xa727('0x33')](_0x2c7883['model'],_0x2c7883[_0xa727('0x32')]);_0x2ba9a4[_0xa727('0x35')]=_[_0xa727('0x33')](_0x2c7883[_0xa727('0x31')],qs['fields'](_0x1fccb['query'][_0xa727('0x34')]));_0x2ba9a4['attributes']=_0x2ba9a4[_0xa727('0x35')][_0xa727('0x36')]?_0x2ba9a4[_0xa727('0x35')]:_0x2c7883[_0xa727('0x31')];if(_0x1fccb[_0xa727('0x32')][_0xa727('0x42')]){_0x2ba9a4[_0xa727('0x43')]=[{'all':!![]}];}_0x2ba9a4=_[_0xa727('0x3e')]({},_0x2ba9a4,_0x1fccb[_0xa727('0x41')]);return db[_0xa727('0x2d')][_0xa727('0x4a')](_0x2ba9a4)[_0xa727('0x27')](handleEntityNotFound(_0x43b62b,null))[_0xa727('0x27')](respondWithResult(_0x43b62b,null))[_0xa727('0x46')](handleError(_0x43b62b,null));};exports[_0xa727('0x4b')]=function(_0x37a316,_0x5ba71b){return db[_0xa727('0x2d')]['create'](_0x37a316[_0xa727('0x4c')],{})[_0xa727('0x27')](respondWithResult(_0x5ba71b,0xc9))[_0xa727('0x46')](handleError(_0x5ba71b,null));};exports[_0xa727('0x4d')]=function(_0x414163,_0x49e0eb){if(_0x414163[_0xa727('0x4c')]['id']){delete _0x414163[_0xa727('0x4c')]['id'];}return db[_0xa727('0x2d')][_0xa727('0x4a')]({'where':{'id':_0x414163[_0xa727('0x48')]['id']}})[_0xa727('0x27')](handleEntityNotFound(_0x49e0eb,null))[_0xa727('0x27')](saveUpdates(_0x414163[_0xa727('0x4c')],null))[_0xa727('0x27')](respondWithResult(_0x49e0eb,null))[_0xa727('0x46')](handleError(_0x49e0eb,null));};exports[_0xa727('0x28')]=function(_0x5d331d,_0x475fa8){return db[_0xa727('0x2d')][_0xa727('0x4a')]({'where':{'id':_0x5d331d[_0xa727('0x48')]['id']}})[_0xa727('0x27')](handleEntityNotFound(_0x475fa8,null))[_0xa727('0x27')](removeEntity(_0x475fa8,null))[_0xa727('0x46')](handleError(_0x475fa8,null));};exports[_0xa727('0x4e')]=function(_0x44b673,_0x3f5414){return db[_0xa727('0x2d')][_0xa727('0x4e')]()['then'](respondWithResult(_0x3f5414,null))[_0xa727('0x46')](handleError(_0x3f5414,null));}; \ No newline at end of file +var _0xcf91=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FaxQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel'];(function(_0x350d24,_0x5d329f){var _0x3b9281=function(_0x3abc8e){while(--_0x3abc8e){_0x350d24['push'](_0x350d24['shift']());}};_0x3b9281(++_0x5d329f);}(_0xcf91,0x19f));var _0x1cf9=function(_0x443427,_0x518e89){_0x443427=_0x443427-0x0;var _0x57e334=_0xcf91[_0x443427];return _0x57e334;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1cf9('0x0'));var rimraf=require(_0x1cf9('0x1'));var zipdir=require(_0x1cf9('0x2'));var jsonpatch=require(_0x1cf9('0x3'));var rp=require('request-promise');var moment=require(_0x1cf9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1cf9('0x5'));var util=require(_0x1cf9('0x6'));var path=require(_0x1cf9('0x7'));var sox=require(_0x1cf9('0x8'));var csv=require(_0x1cf9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1cf9('0xa'));var crypto=require('crypto');var jsforce=require(_0x1cf9('0xb'));var deskjs=require(_0x1cf9('0xc'));var toCsv=require(_0x1cf9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cf9('0xd'));var authService=require(_0x1cf9('0xe'));var qs=require(_0x1cf9('0xf'));var as=require(_0x1cf9('0x10'));var hardwareService=require(_0x1cf9('0x11'));var logger=require('../../config/logger')(_0x1cf9('0x12'));var utils=require('../../config/utils');var config=require(_0x1cf9('0x13'));var licenseUtil=require(_0x1cf9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3610f6,_0x29de00){_0x29de00=_0x29de00||0xcc;return function(_0xde234b){if(_0xde234b){return _0x3610f6[_0x1cf9('0x15')](_0x29de00);}return _0x3610f6[_0x1cf9('0x16')](_0x29de00)[_0x1cf9('0x17')]();};}function respondWithResult(_0x19aeea,_0x195e12){_0x195e12=_0x195e12||0xc8;return function(_0x55a81f){if(_0x55a81f){return _0x19aeea[_0x1cf9('0x16')](_0x195e12)[_0x1cf9('0x18')](_0x55a81f);}};}function respondWithFilteredResult(_0x3fe355,_0x545e75){return function(_0x3b5408){if(_0x3b5408){var _0x1fbe58=_0x3b5408[_0x1cf9('0x19')],_0x2c9164=_0x545e75[_0x1cf9('0x1a')],_0x496393=_0x545e75[_0x1cf9('0x1a')]+_0x545e75[_0x1cf9('0x1b')],_0x43c6ee;if(_0x496393>=_0x1fbe58){_0x496393=_0x1fbe58;_0x43c6ee=0xc8;}else{_0x43c6ee=0xce;}_0x3fe355[_0x1cf9('0x16')](_0x43c6ee);return _0x3fe355[_0x1cf9('0x1c')](_0x1cf9('0x1d'),_0x2c9164+'-'+_0x496393+'/'+_0x1fbe58)[_0x1cf9('0x18')](_0x3b5408);}return null;};}function patchUpdates(_0x3fc0e6){return function(_0x1780e6){try{jsonpatch[_0x1cf9('0x1e')](_0x1780e6,_0x3fc0e6,!![]);}catch(_0x56b505){return BPromise[_0x1cf9('0x1f')](_0x56b505);}return _0x1780e6[_0x1cf9('0x20')]();};}function saveUpdates(_0x56f1c6,_0x939544){return function(_0x1b0da5){if(_0x1b0da5){return _0x1b0da5[_0x1cf9('0x21')](_0x56f1c6)['then'](function(_0x3da4e){return _0x3da4e;});}return null;};}function removeEntity(_0x2901af,_0x5314ca){return function(_0xf25c5f){if(_0xf25c5f){return _0xf25c5f[_0x1cf9('0x22')]()[_0x1cf9('0x23')](function(){_0x2901af[_0x1cf9('0x16')](0xcc)[_0x1cf9('0x17')]();});}};}function handleEntityNotFound(_0x5cd42c,_0x376765){return function(_0x158da9){if(!_0x158da9){_0x5cd42c['sendStatus'](0x194);}return _0x158da9;};}function handleError(_0x5d0b41,_0x1152fe){_0x1152fe=_0x1152fe||0x1f4;return function(_0x426cc1){logger[_0x1cf9('0x24')](_0x426cc1[_0x1cf9('0x25')]);if(_0x426cc1[_0x1cf9('0x26')]){delete _0x426cc1[_0x1cf9('0x26')];}_0x5d0b41[_0x1cf9('0x16')](_0x1152fe)[_0x1cf9('0x27')](_0x426cc1);};}exports['index']=function(_0x3d2a93,_0x3ff197){var _0x4b9cb2={},_0x807387={},_0x254656={'count':0x0,'rows':[]};var _0x36ab=_['map'](db['FaxQueueReport'][_0x1cf9('0x28')],function(_0x7da773){return{'name':_0x7da773['fieldName'],'type':_0x7da773[_0x1cf9('0x29')]['key']};});_0x807387[_0x1cf9('0x2a')]=_['map'](_0x36ab,'name');_0x807387[_0x1cf9('0x2b')]=_[_0x1cf9('0x2c')](_0x3d2a93[_0x1cf9('0x2b')]);_0x807387['filters']=_['intersection'](_0x807387[_0x1cf9('0x2a')],_0x807387[_0x1cf9('0x2b')]);_0x4b9cb2['attributes']=_[_0x1cf9('0x2d')](_0x807387[_0x1cf9('0x2a')],qs[_0x1cf9('0x2e')](_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x2e')]));_0x4b9cb2[_0x1cf9('0x2f')]=_0x4b9cb2[_0x1cf9('0x2f')][_0x1cf9('0x30')]?_0x4b9cb2[_0x1cf9('0x2f')]:_0x807387[_0x1cf9('0x2a')];if(!_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x31')](_0x1cf9('0x32'))){_0x4b9cb2[_0x1cf9('0x1b')]=qs['limit'](_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x1b')]);_0x4b9cb2[_0x1cf9('0x1a')]=qs[_0x1cf9('0x1a')](_0x3d2a93[_0x1cf9('0x2b')]['offset']);}_0x4b9cb2[_0x1cf9('0x33')]=qs[_0x1cf9('0x34')](_0x3d2a93['query'][_0x1cf9('0x34')]);_0x4b9cb2[_0x1cf9('0x35')]=qs[_0x1cf9('0x36')](_[_0x1cf9('0x37')](_0x3d2a93[_0x1cf9('0x2b')],_0x807387['filters']),_0x36ab);if(_0x3d2a93[_0x1cf9('0x2b')]['filter']){_0x4b9cb2['where']=_[_0x1cf9('0x38')](_0x4b9cb2['where'],{'$or':_['map'](_0x36ab,function(_0x28a6b9){if(_0x28a6b9['type']!==_0x1cf9('0x39')){var _0x2c89b3={};_0x2c89b3[_0x28a6b9[_0x1cf9('0x26')]]={'$like':'%'+_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x3a')]+'%'};return _0x2c89b3;}})});}_0x4b9cb2=_[_0x1cf9('0x38')]({},_0x4b9cb2,_0x3d2a93[_0x1cf9('0x3b')]);var _0x412f33={'where':_0x4b9cb2[_0x1cf9('0x35')]};return db[_0x1cf9('0x3c')][_0x1cf9('0x19')](_0x412f33)['then'](function(_0x4c60c6){_0x254656[_0x1cf9('0x19')]=_0x4c60c6;if(_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x3d')]){_0x4b9cb2[_0x1cf9('0x3e')]=[{'all':!![]}];}return db[_0x1cf9('0x3c')][_0x1cf9('0x3f')](_0x4b9cb2);})[_0x1cf9('0x23')](function(_0x1d6873){_0x254656[_0x1cf9('0x40')]=_0x1d6873;return _0x254656;})[_0x1cf9('0x23')](respondWithFilteredResult(_0x3ff197,_0x4b9cb2))[_0x1cf9('0x41')](handleError(_0x3ff197,null));};exports['show']=function(_0x510beb,_0x112794){var _0xd5c40f={'raw':!![],'where':{'id':_0x510beb[_0x1cf9('0x42')]['id']}},_0x5c69c2={};_0x5c69c2['model']=_[_0x1cf9('0x2c')](db[_0x1cf9('0x3c')][_0x1cf9('0x28')]);_0x5c69c2[_0x1cf9('0x2b')]=_[_0x1cf9('0x2c')](_0x510beb[_0x1cf9('0x2b')]);_0x5c69c2[_0x1cf9('0x36')]=_[_0x1cf9('0x2d')](_0x5c69c2[_0x1cf9('0x2a')],_0x5c69c2['query']);_0xd5c40f[_0x1cf9('0x2f')]=_[_0x1cf9('0x2d')](_0x5c69c2[_0x1cf9('0x2a')],qs[_0x1cf9('0x2e')](_0x510beb['query']['fields']));_0xd5c40f[_0x1cf9('0x2f')]=_0xd5c40f['attributes'][_0x1cf9('0x30')]?_0xd5c40f[_0x1cf9('0x2f')]:_0x5c69c2[_0x1cf9('0x2a')];if(_0x510beb[_0x1cf9('0x2b')]['includeAll']){_0xd5c40f[_0x1cf9('0x3e')]=[{'all':!![]}];}_0xd5c40f=_[_0x1cf9('0x38')]({},_0xd5c40f,_0x510beb[_0x1cf9('0x3b')]);return db[_0x1cf9('0x3c')][_0x1cf9('0x43')](_0xd5c40f)[_0x1cf9('0x23')](handleEntityNotFound(_0x112794,null))[_0x1cf9('0x23')](respondWithResult(_0x112794,null))[_0x1cf9('0x41')](handleError(_0x112794,null));};exports[_0x1cf9('0x44')]=function(_0x4c72ed,_0x2acd70){return db[_0x1cf9('0x3c')][_0x1cf9('0x44')](_0x4c72ed['body'],{})['then'](respondWithResult(_0x2acd70,0xc9))[_0x1cf9('0x41')](handleError(_0x2acd70,null));};exports[_0x1cf9('0x21')]=function(_0x48790b,_0x2bd733){if(_0x48790b['body']['id']){delete _0x48790b[_0x1cf9('0x45')]['id'];}return db[_0x1cf9('0x3c')][_0x1cf9('0x43')]({'where':{'id':_0x48790b[_0x1cf9('0x42')]['id']}})[_0x1cf9('0x23')](handleEntityNotFound(_0x2bd733,null))[_0x1cf9('0x23')](saveUpdates(_0x48790b[_0x1cf9('0x45')],null))[_0x1cf9('0x23')](respondWithResult(_0x2bd733,null))[_0x1cf9('0x41')](handleError(_0x2bd733,null));};exports[_0x1cf9('0x22')]=function(_0x368d8f,_0x395395){return db['FaxQueueReport']['find']({'where':{'id':_0x368d8f[_0x1cf9('0x42')]['id']}})['then'](handleEntityNotFound(_0x395395,null))['then'](removeEntity(_0x395395,null))[_0x1cf9('0x41')](handleError(_0x395395,null));};exports[_0x1cf9('0x46')]=function(_0xaa8776,_0x382434){return db['FaxQueueReport'][_0x1cf9('0x46')]()[_0x1cf9('0x23')](respondWithResult(_0x382434,null))['catch'](handleError(_0x382434,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d9fbdd5..0ab431c 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 _0x74a1=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x74a1,0xc6));var _0x174a=function(_0x1e5c8d,_0x1bd355){_0x1e5c8d=_0x1e5c8d-0x0;var _0x17f720=_0x74a1[_0x1e5c8d];return _0x17f720;};'use strict';var _=require('lodash');var util=require(_0x174a('0x0'));var logger=require(_0x174a('0x1'))(_0x174a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x174a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x174a('0x4'));var config=require(_0x174a('0x5'));var attributes=require('./faxQueueReport.attributes');module[_0x174a('0x6')]=function(_0x5887b2,_0x2ad3d1){return _0x5887b2[_0x174a('0x7')](_0x174a('0x8'),attributes,{'tableName':_0x174a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x174a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3052=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','define'];(function(_0x5aaba8,_0x248b94){var _0x13f7e3=function(_0x2db2c5){while(--_0x2db2c5){_0x5aaba8['push'](_0x5aaba8['shift']());}};_0x13f7e3(++_0x248b94);}(_0x3052,0x1d1));var _0x2305=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3052[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2305('0x0'));var util=require(_0x2305('0x1'));var logger=require(_0x2305('0x2'))(_0x2305('0x3'));var moment=require(_0x2305('0x4'));var BPromise=require(_0x2305('0x5'));var rp=require(_0x2305('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2305('0x7'));var config=require(_0x2305('0x8'));var attributes=require(_0x2305('0x9'));module['exports']=function(_0x56ff80,_0x129385){return _0x56ff80[_0x2305('0xa')](_0x2305('0xb'),attributes,{'tableName':_0x2305('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2305('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 38b0449..a5c63c1 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 _0x1047=['result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','raw','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message'];(function(_0x9a4503,_0x31ea1d){var _0x354f11=function(_0x502393){while(--_0x502393){_0x9a4503['push'](_0x9a4503['shift']());}};_0x354f11(++_0x31ea1d);}(_0x1047,0xf4));var _0x7104=function(_0x24cab6,_0xd43e28){_0x24cab6=_0x24cab6-0x0;var _0x25d6b6=_0x1047[_0x24cab6];return _0x25d6b6;};'use strict';var _=require(_0x7104('0x0'));var util=require(_0x7104('0x1'));var moment=require('moment');var BPromise=require(_0x7104('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7104('0x3'));var db=require(_0x7104('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7104('0x5'))('rpc');var config=require(_0x7104('0x6'));var jayson=require(_0x7104('0x7'));var client=jayson['client'][_0x7104('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d639f,_0x440077,_0x1ba0c){return new BPromise(function(_0x3b38cd,_0x33c437){return client[_0x7104('0x9')](_0x2d639f,_0x1ba0c)[_0x7104('0xa')](function(_0x288ac3){logger[_0x7104('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x440077,_0x7104('0xc'));logger[_0x7104('0xd')](_0x7104('0xe'),_0x440077,'request\x20sent',JSON[_0x7104('0xf')](_0x288ac3));if(_0x288ac3[_0x7104('0x10')]){if(_0x288ac3[_0x7104('0x10')][_0x7104('0x11')]===0x1f4){logger[_0x7104('0x10')](_0x7104('0x12'),_0x440077,_0x288ac3[_0x7104('0x10')]['message']);return _0x33c437(_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);}logger['error'](_0x7104('0x12'),_0x440077,_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);return _0x3b38cd(_0x288ac3[_0x7104('0x10')][_0x7104('0x13')]);}else{logger[_0x7104('0xb')](_0x7104('0x12'),_0x440077,_0x7104('0xc'));_0x3b38cd(_0x288ac3[_0x7104('0x14')][_0x7104('0x13')]);}})[_0x7104('0x15')](function(_0x456311){logger['error'](_0x7104('0x12'),_0x440077,_0x456311);_0x33c437(_0x456311);});});}exports['CreateFaxQueueReport']=function(_0x70ca9e){var _0x1420c3=this;return new Promise(function(_0x3c2c78,_0x453873){return db[_0x7104('0x16')][_0x7104('0x17')](_0x70ca9e['body'],{'raw':_0x70ca9e['options']?_0x70ca9e[_0x7104('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3069ae){logger['info'](_0x7104('0x19'),_0x70ca9e);logger[_0x7104('0xd')]('CreateFaxQueueReport',_0x70ca9e,JSON[_0x7104('0xf')](_0x3069ae));_0x3c2c78(_0x3069ae);})[_0x7104('0x15')](function(_0x2f75e4){logger['error'](_0x7104('0x19'),_0x2f75e4[_0x7104('0x13')],_0x70ca9e);_0x453873(_0x1420c3[_0x7104('0x10')](0x1f4,_0x2f75e4[_0x7104('0x13')]));});});};exports[_0x7104('0x1a')]=function(_0x8d6e8a){var _0x1cdc8a=this;return new Promise(function(_0x4f05d5,_0xe54376){return db[_0x7104('0x16')][_0x7104('0x1b')](_0x8d6e8a[_0x7104('0x1c')],{'raw':_0x8d6e8a['options']?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d6e8a['options']?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1e')]||null:null,'attributes':_0x8d6e8a[_0x7104('0x18')]?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x1f')]||null:null,'limit':_0x8d6e8a[_0x7104('0x18')]?_0x8d6e8a[_0x7104('0x18')][_0x7104('0x20')]||null:null})[_0x7104('0xa')](function(_0x9c8069){logger[_0x7104('0xb')](_0x7104('0x1a'),_0x8d6e8a);logger['debug'](_0x7104('0x1a'),_0x8d6e8a,JSON['stringify'](_0x9c8069));_0x4f05d5(_0x9c8069);})[_0x7104('0x15')](function(_0x47bdc1){logger['error'](_0x7104('0x1a'),_0x47bdc1[_0x7104('0x13')],_0x8d6e8a);_0xe54376(_0x1cdc8a['error'](0x1f4,_0x47bdc1[_0x7104('0x13')]));});});}; \ No newline at end of file +var _0x9729=['limit','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','raw'];(function(_0x5869f7,_0x557186){var _0x3937ec=function(_0x2bf8d9){while(--_0x2bf8d9){_0x5869f7['push'](_0x5869f7['shift']());}};_0x3937ec(++_0x557186);}(_0x9729,0x15d));var _0x9972=function(_0x31b3c7,_0x2c983c){_0x31b3c7=_0x31b3c7-0x0;var _0x3283f0=_0x9729[_0x31b3c7];return _0x3283f0;};'use strict';var _=require(_0x9972('0x0'));var util=require(_0x9972('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9972('0x2'));var db=require(_0x9972('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9972('0x4'))(_0x9972('0x5'));var config=require('../../config/environment');var jayson=require(_0x9972('0x6'));var client=jayson[_0x9972('0x7')][_0x9972('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x548e1b,_0x101268,_0x4ab487){return new BPromise(function(_0x580d62,_0x5765b5){return client[_0x9972('0x9')](_0x548e1b,_0x4ab487)[_0x9972('0xa')](function(_0x10311e){logger[_0x9972('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x101268,_0x9972('0xc'));logger[_0x9972('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x101268,_0x9972('0xc'),JSON[_0x9972('0xe')](_0x10311e));if(_0x10311e[_0x9972('0xf')]){if(_0x10311e[_0x9972('0xf')][_0x9972('0x10')]===0x1f4){logger[_0x9972('0xf')](_0x9972('0x11'),_0x101268,_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);return _0x5765b5(_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);}logger['error'](_0x9972('0x11'),_0x101268,_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);return _0x580d62(_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);}else{logger[_0x9972('0xb')](_0x9972('0x11'),_0x101268,_0x9972('0xc'));_0x580d62(_0x10311e[_0x9972('0x13')][_0x9972('0x12')]);}})[_0x9972('0x14')](function(_0x56c425){logger[_0x9972('0xf')](_0x9972('0x11'),_0x101268,_0x56c425);_0x5765b5(_0x56c425);});});}exports[_0x9972('0x15')]=function(_0x1d024e){var _0x578254=this;return new Promise(function(_0x25f204,_0x51c231){return db[_0x9972('0x16')][_0x9972('0x17')](_0x1d024e[_0x9972('0x18')],{'raw':_0x1d024e[_0x9972('0x19')]?_0x1d024e[_0x9972('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9972('0xa')](function(_0x5d54a6){logger[_0x9972('0xb')]('CreateFaxQueueReport',_0x1d024e);logger['debug'](_0x9972('0x15'),_0x1d024e,JSON['stringify'](_0x5d54a6));_0x25f204(_0x5d54a6);})[_0x9972('0x14')](function(_0x304798){logger[_0x9972('0xf')]('CreateFaxQueueReport',_0x304798[_0x9972('0x12')],_0x1d024e);_0x51c231(_0x578254[_0x9972('0xf')](0x1f4,_0x304798[_0x9972('0x12')]));});});};exports[_0x9972('0x1a')]=function(_0x2e2d6c){var _0x4b9d9b=this;return new Promise(function(_0x447799,_0x4dcec2){return db['FaxQueueReport']['update'](_0x2e2d6c['body'],{'raw':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c[_0x9972('0x19')][_0x9972('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2d6c['options']?_0x2e2d6c[_0x9972('0x19')]['where']||null:null,'attributes':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c[_0x9972('0x19')]['attributes']||null:null,'limit':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c['options'][_0x9972('0x1c')]||null:null})[_0x9972('0xa')](function(_0x2d9bad){logger[_0x9972('0xb')]('UpdateFaxQueueReport',_0x2e2d6c);logger[_0x9972('0xd')](_0x9972('0x1a'),_0x2e2d6c,JSON['stringify'](_0x2d9bad));_0x447799(_0x2d9bad);})[_0x9972('0x14')](function(_0x505240){logger['error']('UpdateFaxQueueReport',_0x505240[_0x9972('0x12')],_0x2e2d6c);_0x4dcec2(_0x4b9d9b[_0x9972('0xf')](0x1f4,_0x505240[_0x9972('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0427887..a4108ef 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 _0xefc2=['/:id','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1361e2,_0x2cbfc0){var _0x17161e=function(_0x1681ca){while(--_0x1681ca){_0x1361e2['push'](_0x1361e2['shift']());}};_0x17161e(++_0x2cbfc0);}(_0xefc2,0x1b6));var _0x2efc=function(_0x6fd45a,_0x1d9c70){_0x6fd45a=_0x6fd45a-0x0;var _0x368a9e=_0xefc2[_0x6fd45a];return _0x368a9e;};'use strict';var multer=require(_0x2efc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2efc('0x1'));var express=require(_0x2efc('0x2'));var router=express[_0x2efc('0x3')]();var auth=require(_0x2efc('0x4'));var interaction=require(_0x2efc('0x5'));var config=require('../../config/environment');var controller=require(_0x2efc('0x6'));router[_0x2efc('0x7')]('/',auth[_0x2efc('0x8')](),controller[_0x2efc('0x9')]);router[_0x2efc('0x7')](_0x2efc('0xa'),auth[_0x2efc('0x8')](),controller[_0x2efc('0xb')]);router[_0x2efc('0x7')](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller['show']);router[_0x2efc('0xd')]('/',auth[_0x2efc('0x8')](),controller[_0x2efc('0xe')]);router[_0x2efc('0xf')](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller[_0x2efc('0x10')]);router['delete'](_0x2efc('0xc'),auth[_0x2efc('0x8')](),controller['destroy']);module[_0x2efc('0x11')]=router; \ No newline at end of file +var _0xa7b9=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1fadad,_0x12b95e){var _0xc75692=function(_0x25031c){while(--_0x25031c){_0x1fadad['push'](_0x1fadad['shift']());}};_0xc75692(++_0x12b95e);}(_0xa7b9,0x139));var _0x9a7b=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xa7b9[_0x562ec5];return _0x279c8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a7b('0x0'));var timeout=require(_0x9a7b('0x1'));var express=require(_0x9a7b('0x2'));var router=express[_0x9a7b('0x3')]();var auth=require(_0x9a7b('0x4'));var interaction=require(_0x9a7b('0x5'));var config=require(_0x9a7b('0x6'));var controller=require(_0x9a7b('0x7'));router[_0x9a7b('0x8')]('/',auth[_0x9a7b('0x9')](),controller[_0x9a7b('0xa')]);router[_0x9a7b('0x8')](_0x9a7b('0xb'),auth[_0x9a7b('0x9')](),controller['describe']);router[_0x9a7b('0x8')](_0x9a7b('0xc'),auth[_0x9a7b('0x9')](),controller[_0x9a7b('0xd')]);router[_0x9a7b('0xe')]('/',auth['isAuthenticated'](),controller[_0x9a7b('0xf')]);router[_0x9a7b('0x10')]('/:id',auth[_0x9a7b('0x9')](),controller[_0x9a7b('0x11')]);router[_0x9a7b('0x12')](_0x9a7b('0xc'),auth[_0x9a7b('0x9')](),controller[_0x9a7b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7482e19..f514e35 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 _0x228c=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x1c7d3a,_0x526b24){var _0x42a22d=function(_0x137fd4){while(--_0x137fd4){_0x1c7d3a['push'](_0x1c7d3a['shift']());}};_0x42a22d(++_0x526b24);}(_0x228c,0x1ca));var _0xc228=function(_0x1a9ef2,_0x3dbfc6){_0x1a9ef2=_0x1a9ef2-0x0;var _0x13cd36=_0x228c[_0x1a9ef2];return _0x13cd36;};'use strict';var moment=require(_0xc228('0x0'));var Sequelize=require(_0xc228('0x1'));module[_0xc228('0x2')]={'uniqueid':{'type':Sequelize[_0xc228('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc228('0x4')](_0xc228('0x5'),_0xc228('0x6'),_0xc228('0x7')),'allowNull':![],'defaultValue':_0xc228('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc228('0x8')]}}; \ No newline at end of file +var _0xa0f2=['exports','ENUM','account','agent','queue','NOW','moment','sequelize'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa0f2,0x13e));var _0x2a0f=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xa0f2[_0x3f2a90];return _0xb46279;};'use strict';var moment=require(_0x2a0f('0x0'));var Sequelize=require(_0x2a0f('0x1'));module[_0x2a0f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2a0f('0x3')](_0x2a0f('0x4'),_0x2a0f('0x5'),'queue'),'allowNull':![],'defaultValue':_0x2a0f('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2a0f('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d7fdb08..37d3f2d 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 _0xfd8f=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','FaxTransferReport','rawAttributes'];(function(_0x3da9ad,_0x19e536){var _0x1ffef0=function(_0xbc785b){while(--_0xbc785b){_0x3da9ad['push'](_0x3da9ad['shift']());}};_0x1ffef0(++_0x19e536);}(_0xfd8f,0xae));var _0xffd8=function(_0x5bae60,_0x46f6f3){_0x5bae60=_0x5bae60-0x0;var _0x2cd1a1=_0xfd8f[_0x5bae60];return _0x2cd1a1;};'use strict';var pdf=require(_0xffd8('0x0'));var emlformat=require(_0xffd8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xffd8('0x2'));var jsonpatch=require(_0xffd8('0x3'));var rp=require(_0xffd8('0x4'));var moment=require(_0xffd8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xffd8('0x6'));var util=require(_0xffd8('0x7'));var path=require('path');var sox=require(_0xffd8('0x8'));var csv=require(_0xffd8('0x9'));var ejs=require(_0xffd8('0xa'));var fs=require('fs');var _=require(_0xffd8('0xb'));var squel=require(_0xffd8('0xc'));var crypto=require(_0xffd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xffd8('0xe'));var toCsv=require(_0xffd8('0x9'));var querystring=require(_0xffd8('0xf'));var Papa=require(_0xffd8('0x10'));var Redis=require('ioredis');var authService=require(_0xffd8('0x11'));var qs=require(_0xffd8('0x12'));var as=require(_0xffd8('0x13'));var hardwareService=require(_0xffd8('0x14'));var logger=require(_0xffd8('0x15'))(_0xffd8('0x16'));var utils=require(_0xffd8('0x17'));var config=require(_0xffd8('0x18'));var licenseUtil=require(_0xffd8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4999b6,_0x478cd3){_0x478cd3=_0x478cd3||0xcc;return function(_0x250b2f){if(_0x250b2f){return _0x4999b6[_0xffd8('0x1a')](_0x478cd3);}return _0x4999b6[_0xffd8('0x1b')](_0x478cd3)[_0xffd8('0x1c')]();};}function respondWithResult(_0x7910b7,_0x52844a){_0x52844a=_0x52844a||0xc8;return function(_0x36f48a){if(_0x36f48a){return _0x7910b7[_0xffd8('0x1b')](_0x52844a)[_0xffd8('0x1d')](_0x36f48a);}};}function respondWithFilteredResult(_0x31739f,_0x18bdd5){return function(_0x4eb27f){if(_0x4eb27f){var _0x6ef93e=_0x4eb27f[_0xffd8('0x1e')],_0x31bc46=_0x18bdd5[_0xffd8('0x1f')],_0x4fc61a=_0x18bdd5[_0xffd8('0x1f')]+_0x18bdd5[_0xffd8('0x20')],_0x86251f;if(_0x4fc61a>=_0x6ef93e){_0x4fc61a=_0x6ef93e;_0x86251f=0xc8;}else{_0x86251f=0xce;}_0x31739f[_0xffd8('0x1b')](_0x86251f);return _0x31739f['set'](_0xffd8('0x21'),_0x31bc46+'-'+_0x4fc61a+'/'+_0x6ef93e)[_0xffd8('0x1d')](_0x4eb27f);}return null;};}function patchUpdates(_0x2ec434){return function(_0x547ce7){try{jsonpatch['apply'](_0x547ce7,_0x2ec434,!![]);}catch(_0x3bcef5){return BPromise[_0xffd8('0x22')](_0x3bcef5);}return _0x547ce7[_0xffd8('0x23')]();};}function saveUpdates(_0x5a9211,_0x4ca566){return function(_0x5bb0bc){if(_0x5bb0bc){return _0x5bb0bc[_0xffd8('0x24')](_0x5a9211)[_0xffd8('0x25')](function(_0x180baf){return _0x180baf;});}return null;};}function removeEntity(_0x22c368,_0x5536a1){return function(_0xac3157){if(_0xac3157){return _0xac3157[_0xffd8('0x26')]()[_0xffd8('0x25')](function(){_0x22c368[_0xffd8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46bf81,_0x11ad69){return function(_0x2bea03){if(!_0x2bea03){_0x46bf81['sendStatus'](0x194);}return _0x2bea03;};}function handleError(_0x3fe4b3,_0x46de7d){_0x46de7d=_0x46de7d||0x1f4;return function(_0x4c3e3c){logger[_0xffd8('0x27')](_0x4c3e3c[_0xffd8('0x28')]);if(_0x4c3e3c['name']){delete _0x4c3e3c[_0xffd8('0x29')];}_0x3fe4b3[_0xffd8('0x1b')](_0x46de7d)['send'](_0x4c3e3c);};}exports[_0xffd8('0x2a')]=function(_0x57ba67,_0x45c5fe){var _0x288269={},_0x345bc7={},_0x41520a={'count':0x0,'rows':[]};var _0x3d5d35=_['map'](db[_0xffd8('0x2b')][_0xffd8('0x2c')],function(_0x2c1571){return{'name':_0x2c1571['fieldName'],'type':_0x2c1571['type']['key']};});_0x345bc7[_0xffd8('0x2d')]=_[_0xffd8('0x2e')](_0x3d5d35,_0xffd8('0x29'));_0x345bc7[_0xffd8('0x2f')]=_[_0xffd8('0x30')](_0x57ba67[_0xffd8('0x2f')]);_0x345bc7[_0xffd8('0x31')]=_[_0xffd8('0x32')](_0x345bc7['model'],_0x345bc7[_0xffd8('0x2f')]);_0x288269[_0xffd8('0x33')]=_[_0xffd8('0x32')](_0x345bc7['model'],qs[_0xffd8('0x34')](_0x57ba67[_0xffd8('0x2f')]['fields']));_0x288269[_0xffd8('0x33')]=_0x288269['attributes'][_0xffd8('0x35')]?_0x288269[_0xffd8('0x33')]:_0x345bc7[_0xffd8('0x2d')];if(!_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x36')]('nolimit')){_0x288269[_0xffd8('0x20')]=qs[_0xffd8('0x20')](_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x20')]);_0x288269[_0xffd8('0x1f')]=qs[_0xffd8('0x1f')](_0x57ba67['query']['offset']);}_0x288269[_0xffd8('0x37')]=qs[_0xffd8('0x38')](_0x57ba67[_0xffd8('0x2f')]['sort']);_0x288269[_0xffd8('0x39')]=qs[_0xffd8('0x31')](_['pick'](_0x57ba67[_0xffd8('0x2f')],_0x345bc7[_0xffd8('0x31')]),_0x3d5d35);if(_0x57ba67[_0xffd8('0x2f')][_0xffd8('0x3a')]){_0x288269[_0xffd8('0x39')]=_[_0xffd8('0x3b')](_0x288269[_0xffd8('0x39')],{'$or':_[_0xffd8('0x2e')](_0x3d5d35,function(_0x3c6b7f){if(_0x3c6b7f[_0xffd8('0x3c')]!==_0xffd8('0x3d')){var _0x281dad={};_0x281dad[_0x3c6b7f['name']]={'$like':'%'+_0x57ba67['query'][_0xffd8('0x3a')]+'%'};return _0x281dad;}})});}_0x288269=_['merge']({},_0x288269,_0x57ba67[_0xffd8('0x3e')]);var _0x26f59c={'where':_0x288269[_0xffd8('0x39')]};return db[_0xffd8('0x2b')]['count'](_0x26f59c)[_0xffd8('0x25')](function(_0x5c8801){_0x41520a['count']=_0x5c8801;if(_0x57ba67['query'][_0xffd8('0x3f')]){_0x288269['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xffd8('0x40')](_0x288269);})[_0xffd8('0x25')](function(_0x2363b4){_0x41520a['rows']=_0x2363b4;return _0x41520a;})[_0xffd8('0x25')](respondWithFilteredResult(_0x45c5fe,_0x288269))[_0xffd8('0x41')](handleError(_0x45c5fe,null));};exports[_0xffd8('0x42')]=function(_0x2e1866,_0x4386f8){var _0x357542={'raw':!![],'where':{'id':_0x2e1866[_0xffd8('0x43')]['id']}},_0x427bb8={};_0x427bb8['model']=_[_0xffd8('0x30')](db[_0xffd8('0x2b')][_0xffd8('0x2c')]);_0x427bb8[_0xffd8('0x2f')]=_['keys'](_0x2e1866[_0xffd8('0x2f')]);_0x427bb8[_0xffd8('0x31')]=_['intersection'](_0x427bb8[_0xffd8('0x2d')],_0x427bb8[_0xffd8('0x2f')]);_0x357542[_0xffd8('0x33')]=_[_0xffd8('0x32')](_0x427bb8[_0xffd8('0x2d')],qs[_0xffd8('0x34')](_0x2e1866['query']['fields']));_0x357542[_0xffd8('0x33')]=_0x357542[_0xffd8('0x33')][_0xffd8('0x35')]?_0x357542[_0xffd8('0x33')]:_0x427bb8[_0xffd8('0x2d')];if(_0x2e1866['query'][_0xffd8('0x3f')]){_0x357542[_0xffd8('0x44')]=[{'all':!![]}];}_0x357542=_[_0xffd8('0x3b')]({},_0x357542,_0x2e1866[_0xffd8('0x3e')]);return db[_0xffd8('0x2b')][_0xffd8('0x45')](_0x357542)[_0xffd8('0x25')](handleEntityNotFound(_0x4386f8,null))[_0xffd8('0x25')](respondWithResult(_0x4386f8,null))[_0xffd8('0x41')](handleError(_0x4386f8,null));};exports[_0xffd8('0x46')]=function(_0xceb389,_0x14d666){return db[_0xffd8('0x2b')][_0xffd8('0x46')](_0xceb389[_0xffd8('0x47')],{})[_0xffd8('0x25')](respondWithResult(_0x14d666,0xc9))[_0xffd8('0x41')](handleError(_0x14d666,null));};exports[_0xffd8('0x24')]=function(_0x50933c,_0x1d1537){if(_0x50933c['body']['id']){delete _0x50933c[_0xffd8('0x47')]['id'];}return db[_0xffd8('0x2b')][_0xffd8('0x45')]({'where':{'id':_0x50933c[_0xffd8('0x43')]['id']}})[_0xffd8('0x25')](handleEntityNotFound(_0x1d1537,null))[_0xffd8('0x25')](saveUpdates(_0x50933c['body'],null))[_0xffd8('0x25')](respondWithResult(_0x1d1537,null))['catch'](handleError(_0x1d1537,null));};exports['destroy']=function(_0xca05c3,_0x2feed7){return db[_0xffd8('0x2b')][_0xffd8('0x45')]({'where':{'id':_0xca05c3[_0xffd8('0x43')]['id']}})[_0xffd8('0x25')](handleEntityNotFound(_0x2feed7,null))['then'](removeEntity(_0x2feed7,null))[_0xffd8('0x41')](handleError(_0x2feed7,null));};exports[_0xffd8('0x48')]=function(_0x5a867d,_0xbcf6c){return db[_0xffd8('0x2b')][_0xffd8('0x48')]()['then'](respondWithResult(_0xbcf6c,null))[_0xffd8('0x41')](handleError(_0xbcf6c,null));}; \ No newline at end of file +var _0xc474=['FaxTransferReport','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','type','filter','options','include','rows','catch','intersection','length','includeAll','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','set','Content-Range','json','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map'];(function(_0x5afe0a,_0x59f4c0){var _0x3d3d3c=function(_0x3ff1ef){while(--_0x3ff1ef){_0x5afe0a['push'](_0x5afe0a['shift']());}};_0x3d3d3c(++_0x59f4c0);}(_0xc474,0xfc));var _0x4c47=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xc474[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x4c47('0x0'));var emlformat=require(_0x4c47('0x1'));var rimraf=require(_0x4c47('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c47('0x3'));var rp=require(_0x4c47('0x4'));var moment=require(_0x4c47('0x5'));var BPromise=require(_0x4c47('0x6'));var Mustache=require(_0x4c47('0x7'));var util=require(_0x4c47('0x8'));var path=require(_0x4c47('0x9'));var sox=require(_0x4c47('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=_0x16c7a9[_0x4c47('0x1b')],_0x533344=_0x78f26b[_0x4c47('0x1c')],_0x4833f1=_0x78f26b[_0x4c47('0x1c')]+_0x78f26b['limit'],_0x5afffc;if(_0x4833f1>=_0xd162cc){_0x4833f1=_0xd162cc;_0x5afffc=0xc8;}else{_0x5afffc=0xce;}_0xb53c24[_0x4c47('0x1a')](_0x5afffc);return _0xb53c24[_0x4c47('0x1d')](_0x4c47('0x1e'),_0x533344+'-'+_0x4833f1+'/'+_0xd162cc)[_0x4c47('0x1f')](_0x16c7a9);}return null;};}function patchUpdates(_0x4e8f78){return function(_0x4cc984){try{jsonpatch['apply'](_0x4cc984,_0x4e8f78,!![]);}catch(_0x1adfb1){return BPromise[_0x4c47('0x20')](_0x1adfb1);}return _0x4cc984[_0x4c47('0x21')]();};}function saveUpdates(_0x3b156f,_0x52de60){return function(_0x38530c){if(_0x38530c){return _0x38530c[_0x4c47('0x22')](_0x3b156f)[_0x4c47('0x23')](function(_0x213623){return _0x213623;});}return null;};}function removeEntity(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['destroy']()['then'](function(){_0x20950c[_0x4c47('0x1a')](0xcc)[_0x4c47('0x24')]();});}};}function handleEntityNotFound(_0x4d110d,_0x3037a2){return function(_0x5aae26){if(!_0x5aae26){_0x4d110d[_0x4c47('0x25')](0x194);}return _0x5aae26;};}function handleError(_0x4c761f,_0x533533){_0x533533=_0x533533||0x1f4;return function(_0x592469){logger[_0x4c47('0x26')](_0x592469[_0x4c47('0x27')]);if(_0x592469[_0x4c47('0x28')]){delete _0x592469['name'];}_0x4c761f[_0x4c47('0x1a')](_0x533533)[_0x4c47('0x29')](_0x592469);};}exports[_0x4c47('0x2a')]=function(_0x4dd77d,_0x2121b2){var _0x3fda58={},_0x17d8e6={},_0x41b8d5={'count':0x0,'rows':[]};var _0x5d3a94=_[_0x4c47('0x2b')](db[_0x4c47('0x2c')]['rawAttributes'],function(_0x491638){return{'name':_0x491638[_0x4c47('0x2d')],'type':_0x491638['type']['key']};});_0x17d8e6[_0x4c47('0x2e')]=_[_0x4c47('0x2b')](_0x5d3a94,_0x4c47('0x28'));_0x17d8e6[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x4dd77d['query']);_0x17d8e6[_0x4c47('0x31')]=_['intersection'](_0x17d8e6[_0x4c47('0x2e')],_0x17d8e6[_0x4c47('0x2f')]);_0x3fda58[_0x4c47('0x32')]=_['intersection'](_0x17d8e6['model'],qs['fields'](_0x4dd77d['query'][_0x4c47('0x33')]));_0x3fda58[_0x4c47('0x32')]=_0x3fda58[_0x4c47('0x32')]['length']?_0x3fda58[_0x4c47('0x32')]:_0x17d8e6['model'];if(!_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x34')](_0x4c47('0x35'))){_0x3fda58[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x3fda58[_0x4c47('0x1c')]=qs['offset'](_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x1c')]);}_0x3fda58[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x4dd77d['query']['sort']);_0x3fda58['where']=qs[_0x4c47('0x31')](_[_0x4c47('0x39')](_0x4dd77d[_0x4c47('0x2f')],_0x17d8e6['filters']),_0x5d3a94);if(_0x4dd77d['query']['filter']){_0x3fda58['where']=_[_0x4c47('0x3a')](_0x3fda58[_0x4c47('0x3b')],{'$or':_[_0x4c47('0x2b')](_0x5d3a94,function(_0x217268){if(_0x217268[_0x4c47('0x3c')]!=='VIRTUAL'){var _0x2e195c={};_0x2e195c[_0x217268[_0x4c47('0x28')]]={'$like':'%'+_0x4dd77d['query'][_0x4c47('0x3d')]+'%'};return _0x2e195c;}})});}_0x3fda58=_[_0x4c47('0x3a')]({},_0x3fda58,_0x4dd77d[_0x4c47('0x3e')]);var _0x418098={'where':_0x3fda58[_0x4c47('0x3b')]};return db['FaxTransferReport'][_0x4c47('0x1b')](_0x418098)[_0x4c47('0x23')](function(_0x12f6d5){_0x41b8d5[_0x4c47('0x1b')]=_0x12f6d5;if(_0x4dd77d[_0x4c47('0x2f')]['includeAll']){_0x3fda58[_0x4c47('0x3f')]=[{'all':!![]}];}return db[_0x4c47('0x2c')]['findAll'](_0x3fda58);})[_0x4c47('0x23')](function(_0x5de12b){_0x41b8d5[_0x4c47('0x40')]=_0x5de12b;return _0x41b8d5;})[_0x4c47('0x23')](respondWithFilteredResult(_0x2121b2,_0x3fda58))[_0x4c47('0x41')](handleError(_0x2121b2,null));};exports['show']=function(_0x5c01fd,_0x164105){var _0x4b52f5={'raw':!![],'where':{'id':_0x5c01fd['params']['id']}},_0x1c1246={};_0x1c1246[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2c')]['rawAttributes']);_0x1c1246[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x5c01fd[_0x4c47('0x2f')]);_0x1c1246[_0x4c47('0x31')]=_[_0x4c47('0x42')](_0x1c1246[_0x4c47('0x2e')],_0x1c1246[_0x4c47('0x2f')]);_0x4b52f5[_0x4c47('0x32')]=_[_0x4c47('0x42')](_0x1c1246[_0x4c47('0x2e')],qs['fields'](_0x5c01fd[_0x4c47('0x2f')][_0x4c47('0x33')]));_0x4b52f5['attributes']=_0x4b52f5['attributes'][_0x4c47('0x43')]?_0x4b52f5[_0x4c47('0x32')]:_0x1c1246['model'];if(_0x5c01fd[_0x4c47('0x2f')][_0x4c47('0x44')]){_0x4b52f5[_0x4c47('0x3f')]=[{'all':!![]}];}_0x4b52f5=_[_0x4c47('0x3a')]({},_0x4b52f5,_0x5c01fd[_0x4c47('0x3e')]);return db['FaxTransferReport']['find'](_0x4b52f5)[_0x4c47('0x23')](handleEntityNotFound(_0x164105,null))[_0x4c47('0x23')](respondWithResult(_0x164105,null))[_0x4c47('0x41')](handleError(_0x164105,null));};exports[_0x4c47('0x45')]=function(_0x3d4a60,_0x231eb6){return db[_0x4c47('0x2c')]['create'](_0x3d4a60[_0x4c47('0x46')],{})['then'](respondWithResult(_0x231eb6,0xc9))[_0x4c47('0x41')](handleError(_0x231eb6,null));};exports[_0x4c47('0x22')]=function(_0x40e35e,_0x4c7e19){if(_0x40e35e[_0x4c47('0x46')]['id']){delete _0x40e35e[_0x4c47('0x46')]['id'];}return db[_0x4c47('0x2c')]['find']({'where':{'id':_0x40e35e[_0x4c47('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c7e19,null))[_0x4c47('0x23')](saveUpdates(_0x40e35e['body'],null))[_0x4c47('0x23')](respondWithResult(_0x4c7e19,null))['catch'](handleError(_0x4c7e19,null));};exports[_0x4c47('0x48')]=function(_0x3c347d,_0x2d28dd){return db[_0x4c47('0x2c')]['find']({'where':{'id':_0x3c347d['params']['id']}})[_0x4c47('0x23')](handleEntityNotFound(_0x2d28dd,null))['then'](removeEntity(_0x2d28dd,null))[_0x4c47('0x41')](handleError(_0x2d28dd,null));};exports[_0x4c47('0x49')]=function(_0x163752,_0x54a394){return db[_0x4c47('0x2c')][_0x4c47('0x49')]()['then'](respondWithResult(_0x54a394,null))['catch'](handleError(_0x54a394,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 934f4b0..134ccef 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 _0x7a2d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x4d12c0,_0x19f3af){var _0x216508=function(_0xbb45a){while(--_0xbb45a){_0x4d12c0['push'](_0x4d12c0['shift']());}};_0x216508(++_0x19f3af);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3e5501,_0x456563){_0x3e5501=_0x3e5501-0x0;var _0x51c573=_0x7a2d[_0x3e5501];return _0x51c573;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'paranoid':![],'indexes':[{'name':_0xd7a2('0xd'),'fields':[_0xd7a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a69=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4d99d3,_0x27176b){var _0x29bed2=function(_0x25fd02){while(--_0x25fd02){_0x4d99d3['push'](_0x4d99d3['shift']());}};_0x29bed2(++_0x27176b);}(_0x8a69,0x144));var _0x98a6=function(_0x7dd75c,_0x355e07){_0x7dd75c=_0x7dd75c-0x0;var _0x629af1=_0x8a69[_0x7dd75c];return _0x629af1;};'use strict';var _=require(_0x98a6('0x0'));var util=require(_0x98a6('0x1'));var logger=require(_0x98a6('0x2'))(_0x98a6('0x3'));var moment=require('moment');var BPromise=require(_0x98a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98a6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98a6('0x6'));module[_0x98a6('0x7')]=function(_0x31db24,_0x44a39e){return _0x31db24[_0x98a6('0x8')](_0x98a6('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x98a6('0xa'),'fields':[_0x98a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 64eb714..29790da 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 _0xb53c=['client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xb53c,0x141));var _0xcb53=function(_0x1213cf,_0x1ad683){_0x1213cf=_0x1213cf-0x0;var _0x2f77c3=_0xb53c[_0x1213cf];return _0x2f77c3;};'use strict';var _=require(_0xcb53('0x0'));var util=require(_0xcb53('0x1'));var moment=require('moment');var BPromise=require(_0xcb53('0x2'));var rs=require(_0xcb53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb53('0x4'))['db'];var utils=require(_0xcb53('0x5'));var logger=require(_0xcb53('0x6'))(_0xcb53('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb53('0x8'));var client=jayson[_0xcb53('0x9')][_0xcb53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c88ea,_0x220cfa,_0x2afb96){return new BPromise(function(_0x589856,_0x4d83c3){return client['request'](_0x1c88ea,_0x2afb96)[_0xcb53('0xb')](function(_0x286128){logger[_0xcb53('0xc')](_0xcb53('0xd'),_0x220cfa,_0xcb53('0xe'));logger['debug'](_0xcb53('0xf'),_0x220cfa,_0xcb53('0xe'),JSON[_0xcb53('0x10')](_0x286128));if(_0x286128[_0xcb53('0x11')]){if(_0x286128[_0xcb53('0x11')][_0xcb53('0x12')]===0x1f4){logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x286128[_0xcb53('0x11')][_0xcb53('0x13')]);return _0x4d83c3(_0x286128[_0xcb53('0x11')][_0xcb53('0x13')]);}logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x286128['error'][_0xcb53('0x13')]);return _0x589856(_0x286128['error'][_0xcb53('0x13')]);}else{logger[_0xcb53('0xc')](_0xcb53('0xd'),_0x220cfa,_0xcb53('0xe'));_0x589856(_0x286128[_0xcb53('0x14')]['message']);}})[_0xcb53('0x15')](function(_0x5c4ba7){logger[_0xcb53('0x11')](_0xcb53('0xd'),_0x220cfa,_0x5c4ba7);_0x4d83c3(_0x5c4ba7);});});} \ No newline at end of file +var _0x9641=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x176017,_0x46629a){var _0x58d8c4=function(_0x2501cb){while(--_0x2501cb){_0x176017['push'](_0x176017['shift']());}};_0x58d8c4(++_0x46629a);}(_0x9641,0xfb));var _0x1964=function(_0x29e3e4,_0x370df9){_0x29e3e4=_0x29e3e4-0x0;var _0x4f98e7=_0x9641[_0x29e3e4];return _0x4f98e7;};'use strict';var _=require(_0x1964('0x0'));var util=require(_0x1964('0x1'));var moment=require(_0x1964('0x2'));var BPromise=require('bluebird');var rs=require(_0x1964('0x3'));var fs=require('fs');var Redis=require(_0x1964('0x4'));var db=require(_0x1964('0x5'))['db'];var utils=require(_0x1964('0x6'));var logger=require(_0x1964('0x7'))(_0x1964('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x215e36,_0x25a660,_0x1fd627){return new BPromise(function(_0x443f3b,_0xf5b2ab){return client[_0x1964('0xa')](_0x215e36,_0x1fd627)['then'](function(_0x32a345){logger[_0x1964('0xb')](_0x1964('0xc'),_0x25a660,_0x1964('0xd'));logger['debug'](_0x1964('0xe'),_0x25a660,'request\x20sent',JSON[_0x1964('0xf')](_0x32a345));if(_0x32a345[_0x1964('0x10')]){if(_0x32a345['error'][_0x1964('0x11')]===0x1f4){logger[_0x1964('0x10')](_0x1964('0xc'),_0x25a660,_0x32a345[_0x1964('0x10')]['message']);return _0xf5b2ab(_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);}logger[_0x1964('0x10')](_0x1964('0xc'),_0x25a660,_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);return _0x443f3b(_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);}else{logger[_0x1964('0xb')](_0x1964('0xc'),_0x25a660,_0x1964('0xd'));_0x443f3b(_0x32a345[_0x1964('0x13')]['message']);}})[_0x1964('0x14')](function(_0x591d25){logger['error'](_0x1964('0xc'),_0x25a660,_0x591d25);_0xf5b2ab(_0x591d25);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2fb5163..b211673 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 _0xb729=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','util'];(function(_0x225815,_0x5db310){var _0x47a32e=function(_0xafe283){while(--_0xafe283){_0x225815['push'](_0x225815['shift']());}};_0x47a32e(++_0x5db310);}(_0xb729,0x12b));var _0x9b72=function(_0x4b8b74,_0x1e5dc3){_0x4b8b74=_0x4b8b74-0x0;var _0x12e5b0=_0xb729[_0x4b8b74];return _0x12e5b0;};'use strict';var multer=require('multer');var util=require(_0x9b72('0x0'));var path=require(_0x9b72('0x1'));var timeout=require(_0x9b72('0x2'));var express=require(_0x9b72('0x3'));var router=express[_0x9b72('0x4')]();var auth=require(_0x9b72('0x5'));var interaction=require(_0x9b72('0x6'));var config=require('../../config/environment');var controller=require(_0x9b72('0x7'));router[_0x9b72('0x8')]('/',auth[_0x9b72('0x9')](),controller[_0x9b72('0xa')]);router[_0x9b72('0x8')](_0x9b72('0xb'),auth[_0x9b72('0x9')](),controller[_0x9b72('0xc')]);router[_0x9b72('0x8')](_0x9b72('0xd'),auth[_0x9b72('0x9')](),controller[_0x9b72('0xe')]);router[_0x9b72('0xf')]('/',auth[_0x9b72('0x9')](),controller[_0x9b72('0x10')]);router[_0x9b72('0x11')](_0x9b72('0xd'),auth['isAuthenticated'](),controller[_0x9b72('0x12')]);router['delete'](_0x9b72('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9b72('0x13')]=router; \ No newline at end of file +var _0x7554=['get','/:id','show','put','update','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','/describe','isAuthenticated','describe'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x7554,0x17d));var _0x4755=function(_0x3bd288,_0x5c0ca0){_0x3bd288=_0x3bd288-0x0;var _0x49066a=_0x7554[_0x3bd288];return _0x49066a;};'use strict';var multer=require('multer');var util=require(_0x4755('0x0'));var path=require('path');var timeout=require(_0x4755('0x1'));var express=require(_0x4755('0x2'));var router=express['Router']();var auth=require(_0x4755('0x3'));var interaction=require(_0x4755('0x4'));var config=require(_0x4755('0x5'));var controller=require(_0x4755('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4755('0x7'),auth[_0x4755('0x8')](),controller[_0x4755('0x9')]);router[_0x4755('0xa')](_0x4755('0xb'),auth['isAuthenticated'](),controller[_0x4755('0xc')]);router['post']('/',auth[_0x4755('0x8')](),controller['create']);router[_0x4755('0xd')](_0x4755('0xb'),auth[_0x4755('0x8')](),controller[_0x4755('0xe')]);router['delete'](_0x4755('0xb'),auth[_0x4755('0x8')](),controller[_0x4755('0xf')]);module[_0x4755('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d3e1d96..f508a76 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 _0xd6f5=['/:id','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x54be1a,_0x3bb687){var _0x4a7b5f=function(_0xf8903d){while(--_0xf8903d){_0x54be1a['push'](_0x54be1a['shift']());}};_0x4a7b5f(++_0x3bb687);}(_0xd6f5,0x1cb));var _0x5d6f=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xd6f5[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require('multer');var util=require(_0x5d6f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5d6f('0x1'));var router=express[_0x5d6f('0x2')]();var auth=require(_0x5d6f('0x3'));var interaction=require(_0x5d6f('0x4'));var config=require('../../config/environment');var controller=require(_0x5d6f('0x5'));router['get']('/',auth[_0x5d6f('0x6')](),controller[_0x5d6f('0x7')]);router[_0x5d6f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5d6f('0x9')]);router[_0x5d6f('0x8')]('/:id/configurations',auth[_0x5d6f('0x6')](),controller['getConfigurations']);router['get'](_0x5d6f('0xa'),auth[_0x5d6f('0x6')](),controller['getFields']);router[_0x5d6f('0xb')]('/',auth[_0x5d6f('0x6')](),controller[_0x5d6f('0xc')]);router[_0x5d6f('0xb')](_0x5d6f('0xd'),auth[_0x5d6f('0x6')](),controller[_0x5d6f('0xe')]);router[_0x5d6f('0xf')](_0x5d6f('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5d6f('0x11')](_0x5d6f('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x5d6f('0x12')]=router; \ No newline at end of file +var _0xfb33=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x537cc0,_0x5ec69d){var _0x4c2091=function(_0x5e8469){while(--_0x5e8469){_0x537cc0['push'](_0x537cc0['shift']());}};_0x4c2091(++_0x5ec69d);}(_0xfb33,0x17f));var _0x3fb3=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xfb33[_0x4a8bad];return _0x30cf32;};'use strict';var multer=require(_0x3fb3('0x0'));var util=require(_0x3fb3('0x1'));var path=require('path');var timeout=require(_0x3fb3('0x2'));var express=require(_0x3fb3('0x3'));var router=express[_0x3fb3('0x4')]();var auth=require(_0x3fb3('0x5'));var interaction=require(_0x3fb3('0x6'));var config=require('../../config/environment');var controller=require(_0x3fb3('0x7'));router[_0x3fb3('0x8')]('/',auth[_0x3fb3('0x9')](),controller['index']);router[_0x3fb3('0x8')]('/:id',auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xa')]);router['get']('/:id/configurations',auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xb')]);router[_0x3fb3('0x8')](_0x3fb3('0xc'),auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xd')]);router[_0x3fb3('0xe')]('/',auth['isAuthenticated'](),controller[_0x3fb3('0xf')]);router['post']('/:id/configurations',auth[_0x3fb3('0x9')](),controller['addConfiguration']);router[_0x3fb3('0x10')](_0x3fb3('0x11'),auth['isAuthenticated'](),controller[_0x3fb3('0x12')]);router['delete'](_0x3fb3('0x11'),auth['isAuthenticated'](),controller[_0x3fb3('0x13')]);module[_0x3fb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c00e8ff..5f09065 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 _0xb4e2=['sequelize','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x38d975,_0x1ade49){var _0x10d6c5=function(_0x5637c0){while(--_0x5637c0){_0x38d975['push'](_0x38d975['shift']());}};_0x10d6c5(++_0x1ade49);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0xc6863c,_0x5b704f){_0xc6863c=_0xc6863c-0x0;var _0x3ac6f5=_0xb4e2[_0xc6863c];return _0x3ac6f5;};'use strict';var Sequelize=require(_0x2b4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2b4e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x2b4e('0x2')),'defaultValue':_0x2b4e('0x2')},'password':{'type':Sequelize[_0x2b4e('0x1')]},'consumerKey':{'type':Sequelize[_0x2b4e('0x1')]},'consumerSecret':{'type':Sequelize[_0x2b4e('0x1')]},'token':{'type':Sequelize[_0x2b4e('0x1')]},'tokenSecret':{'type':Sequelize[_0x2b4e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2b4e('0x3')](_0x2b4e('0x4'),_0x2b4e('0x5')),'defaultValue':_0x2b4e('0x4')}}; \ No newline at end of file +var _0x6c9c=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x3d58aa,_0x5f62b1){var _0x1bc158=function(_0x5398f3){while(--_0x5398f3){_0x3d58aa['push'](_0x3d58aa['shift']());}};_0x1bc158(++_0x5f62b1);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5a0e28,_0xc4c8d5){_0x5a0e28=_0x5a0e28-0x0;var _0x3a67d9=_0x6c9c[_0x5a0e28];return _0x3a67d9;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc6c9('0x2')]},'username':{'type':Sequelize[_0xc6c9('0x2')]},'remoteUri':{'type':Sequelize[_0xc6c9('0x2')]},'authType':{'type':Sequelize[_0xc6c9('0x3')]('basic'),'defaultValue':_0xc6c9('0x4')},'password':{'type':Sequelize[_0xc6c9('0x2')]},'consumerKey':{'type':Sequelize[_0xc6c9('0x2')]},'consumerSecret':{'type':Sequelize[_0xc6c9('0x2')]},'token':{'type':Sequelize[_0xc6c9('0x2')]},'tokenSecret':{'type':Sequelize[_0xc6c9('0x2')]},'serverUrl':{'type':Sequelize[_0xc6c9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc6c9('0x3')](_0xc6c9('0x5'),_0xc6c9('0x6')),'defaultValue':_0xc6c9('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4424f9c..e8413bc 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 _0x78a7=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','DeskAccount','include','findAll','rows','show','length','includeAll','find','catch','create','body','params','findOne','DeskConfiguration','sort','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','label','test','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird'];(function(_0x1151ec,_0x4576b9){var _0xce4b78=function(_0x9d4742){while(--_0x9d4742){_0x1151ec['push'](_0x1151ec['shift']());}};_0xce4b78(++_0x4576b9);}(_0x78a7,0xeb));var _0x778a=function(_0x401f2e,_0x119d0d){_0x401f2e=_0x401f2e-0x0;var _0x4ef876=_0x78a7[_0x401f2e];return _0x4ef876;};'use strict';var pdf=require(_0x778a('0x0'));var emlformat=require(_0x778a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x778a('0x2'));var rp=require('request-promise');var moment=require(_0x778a('0x3'));var BPromise=require(_0x778a('0x4'));var Mustache=require('mustache');var util=require(_0x778a('0x5'));var path=require(_0x778a('0x6'));var sox=require(_0x778a('0x7'));var csv=require(_0x778a('0x8'));var ejs=require(_0x778a('0x9'));var fs=require('fs');var _=require(_0x778a('0xa'));var squel=require(_0x778a('0xb'));var crypto=require('crypto');var jsforce=require(_0x778a('0xc'));var deskjs=require(_0x778a('0xd'));var toCsv=require(_0x778a('0x8'));var querystring=require(_0x778a('0xe'));var Papa=require(_0x778a('0xf'));var Redis=require('ioredis');var authService=require(_0x778a('0x10'));var qs=require(_0x778a('0x11'));var as=require(_0x778a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x778a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x778a('0x14'));var licenseUtil=require(_0x778a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x778a('0x16'));var client=jayson['client'][_0x778a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3d8e3f,_0x5e9dba,_0x5c91bf,_0x43f776){return new BPromise(function(_0x174ad5,_0x487ceb){var _0x58f521=_0x43f776||client;return _0x58f521[_0x778a('0x18')](_0x3d8e3f,_0x5c91bf)['then'](function(_0xee831){logger['info'](_0x778a('0x19'),_0x5e9dba,_0x778a('0x1a'));logger[_0x778a('0x1b')](_0x778a('0x1c'),_0x5e9dba,_0x778a('0x1a'),JSON[_0x778a('0x1d')](_0xee831));if(_0xee831[_0x778a('0x1e')]){if(_0xee831['error']['code']===0x1f4){logger[_0x778a('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5e9dba,_0xee831[_0x778a('0x1e')]['message']);return _0x487ceb(_0xee831[_0x778a('0x1e')][_0x778a('0x1f')]);}logger['error'](_0x778a('0x19'),_0x5e9dba,_0xee831['error'][_0x778a('0x1f')]);return _0x174ad5(_0xee831['error']['message']);}else{logger[_0x778a('0x20')]('DeskAccount,\x20%s,\x20%s',_0x5e9dba,'request\x20sent');_0x174ad5(_0xee831[_0x778a('0x21')][_0x778a('0x1f')]);}})['catch'](function(_0x5d1d4d){logger[_0x778a('0x1e')](_0x778a('0x19'),_0x5e9dba,_0x5d1d4d);_0x487ceb(_0x5d1d4d);});});}function respondWithStatusCode(_0x3d40c4,_0x3a19f3){_0x3a19f3=_0x3a19f3||0xcc;return function(_0x5b4c4a){if(_0x5b4c4a){return _0x3d40c4[_0x778a('0x22')](_0x3a19f3);}return _0x3d40c4[_0x778a('0x23')](_0x3a19f3)[_0x778a('0x24')]();};}function respondWithResult(_0xb142cf,_0x22aa47){_0x22aa47=_0x22aa47||0xc8;return function(_0xa8729a){if(_0xa8729a){return _0xb142cf[_0x778a('0x23')](_0x22aa47)[_0x778a('0x25')](_0xa8729a);}};}function respondWithFilteredResult(_0x4f58b1,_0xcaf66){return function(_0x1787ab){if(_0x1787ab){var _0x52b959=_0x1787ab[_0x778a('0x26')],_0x10e870=_0xcaf66[_0x778a('0x27')],_0x14fc91=_0xcaf66[_0x778a('0x27')]+_0xcaf66[_0x778a('0x28')],_0x5e2ff9;if(_0x14fc91>=_0x52b959){_0x14fc91=_0x52b959;_0x5e2ff9=0xc8;}else{_0x5e2ff9=0xce;}_0x4f58b1['status'](_0x5e2ff9);return _0x4f58b1['set'](_0x778a('0x29'),_0x10e870+'-'+_0x14fc91+'/'+_0x52b959)[_0x778a('0x25')](_0x1787ab);}return null;};}function patchUpdates(_0x3298b5){return function(_0x1440dd){try{jsonpatch[_0x778a('0x2a')](_0x1440dd,_0x3298b5,!![]);}catch(_0x91fee){return BPromise[_0x778a('0x2b')](_0x91fee);}return _0x1440dd['save']();};}function saveUpdates(_0x2c4a10,_0x4d18d9){return function(_0x2b85b0){if(_0x2b85b0){return _0x2b85b0[_0x778a('0x2c')](_0x2c4a10)[_0x778a('0x2d')](function(_0x4a933d){return _0x4a933d;});}return null;};}function removeEntity(_0x3f9b5c,_0x2f5cb0){return function(_0x244cbe){if(_0x244cbe){return _0x244cbe[_0x778a('0x2e')]()[_0x778a('0x2d')](function(){_0x3f9b5c[_0x778a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fedc,_0xd06661){return function(_0x2c86f8){if(!_0x2c86f8){_0x28fedc[_0x778a('0x22')](0x194);}return _0x2c86f8;};}function handleError(_0x309573,_0x380618){_0x380618=_0x380618||0x1f4;return function(_0x1d2043){logger[_0x778a('0x1e')](_0x1d2043[_0x778a('0x2f')]);if(_0x1d2043[_0x778a('0x30')]){delete _0x1d2043['name'];}_0x309573[_0x778a('0x23')](_0x380618)['send'](_0x1d2043);};}exports[_0x778a('0x31')]=function(_0x5b003b,_0x190468){var _0x2b8060={},_0x21b24d={},_0x4c4734={'count':0x0,'rows':[]};var _0x383f89=_[_0x778a('0x32')](db['DeskAccount'][_0x778a('0x33')],function(_0x24f908){return{'name':_0x24f908[_0x778a('0x34')],'type':_0x24f908[_0x778a('0x35')][_0x778a('0x36')]};});_0x21b24d[_0x778a('0x37')]=_['map'](_0x383f89,'name');_0x21b24d[_0x778a('0x38')]=_[_0x778a('0x39')](_0x5b003b[_0x778a('0x38')]);_0x21b24d['filters']=_[_0x778a('0x3a')](_0x21b24d[_0x778a('0x37')],_0x21b24d[_0x778a('0x38')]);_0x2b8060[_0x778a('0x3b')]=_[_0x778a('0x3a')](_0x21b24d[_0x778a('0x37')],qs[_0x778a('0x3c')](_0x5b003b[_0x778a('0x38')][_0x778a('0x3c')]));_0x2b8060[_0x778a('0x3b')]=_0x2b8060[_0x778a('0x3b')]['length']?_0x2b8060[_0x778a('0x3b')]:_0x21b24d[_0x778a('0x37')];if(!_0x5b003b['query'][_0x778a('0x3d')](_0x778a('0x3e'))){_0x2b8060[_0x778a('0x28')]=qs[_0x778a('0x28')](_0x5b003b['query'][_0x778a('0x28')]);_0x2b8060[_0x778a('0x27')]=qs[_0x778a('0x27')](_0x5b003b['query'][_0x778a('0x27')]);}_0x2b8060[_0x778a('0x3f')]=qs['sort'](_0x5b003b[_0x778a('0x38')]['sort']);_0x2b8060[_0x778a('0x40')]=qs[_0x778a('0x41')](_['pick'](_0x5b003b['query'],_0x21b24d[_0x778a('0x41')]),_0x383f89);if(_0x5b003b[_0x778a('0x38')][_0x778a('0x42')]){_0x2b8060[_0x778a('0x40')]=_[_0x778a('0x43')](_0x2b8060[_0x778a('0x40')],{'$or':_[_0x778a('0x32')](_0x383f89,function(_0xd38b49){if(_0xd38b49[_0x778a('0x35')]!==_0x778a('0x44')){var _0x582add={};_0x582add[_0xd38b49[_0x778a('0x30')]]={'$like':'%'+_0x5b003b[_0x778a('0x38')]['filter']+'%'};return _0x582add;}})});}_0x2b8060=_[_0x778a('0x43')]({},_0x2b8060,_0x5b003b[_0x778a('0x45')]);var _0x3ff305={'where':_0x2b8060[_0x778a('0x40')]};return db[_0x778a('0x46')][_0x778a('0x26')](_0x3ff305)['then'](function(_0x5de680){_0x4c4734[_0x778a('0x26')]=_0x5de680;if(_0x5b003b[_0x778a('0x38')]['includeAll']){_0x2b8060[_0x778a('0x47')]=[{'all':!![]}];}return db[_0x778a('0x46')][_0x778a('0x48')](_0x2b8060);})[_0x778a('0x2d')](function(_0x1fc241){_0x4c4734[_0x778a('0x49')]=_0x1fc241;return _0x4c4734;})[_0x778a('0x2d')](respondWithFilteredResult(_0x190468,_0x2b8060))['catch'](handleError(_0x190468,null));};exports[_0x778a('0x4a')]=function(_0xcb560b,_0x32cef3){var _0x2aa54b={'raw':![],'where':{'id':_0xcb560b['params']['id']}},_0x46172b={};_0x46172b[_0x778a('0x37')]=_['keys'](db[_0x778a('0x46')][_0x778a('0x33')]);_0x46172b[_0x778a('0x38')]=_[_0x778a('0x39')](_0xcb560b[_0x778a('0x38')]);_0x46172b['filters']=_[_0x778a('0x3a')](_0x46172b[_0x778a('0x37')],_0x46172b[_0x778a('0x38')]);_0x2aa54b['attributes']=_[_0x778a('0x3a')](_0x46172b[_0x778a('0x37')],qs[_0x778a('0x3c')](_0xcb560b[_0x778a('0x38')][_0x778a('0x3c')]));_0x2aa54b['attributes']=_0x2aa54b[_0x778a('0x3b')][_0x778a('0x4b')]?_0x2aa54b['attributes']:_0x46172b[_0x778a('0x37')];if(_0xcb560b['query'][_0x778a('0x4c')]){_0x2aa54b[_0x778a('0x47')]=[{'all':!![]}];}_0x2aa54b=_[_0x778a('0x43')]({},_0x2aa54b,_0xcb560b[_0x778a('0x45')]);return db[_0x778a('0x46')][_0x778a('0x4d')](_0x2aa54b)[_0x778a('0x2d')](handleEntityNotFound(_0x32cef3,null))['then'](respondWithResult(_0x32cef3,null))[_0x778a('0x4e')](handleError(_0x32cef3,null));};exports[_0x778a('0x4f')]=function(_0x51e47b,_0x37c433){return db[_0x778a('0x46')]['create'](_0x51e47b['body'],{})[_0x778a('0x2d')](respondWithResult(_0x37c433,0xc9))['catch'](handleError(_0x37c433,null));};exports[_0x778a('0x2c')]=function(_0x2bc41c,_0x4c2048){if(_0x2bc41c[_0x778a('0x50')]['id']){delete _0x2bc41c[_0x778a('0x50')]['id'];}return db[_0x778a('0x46')][_0x778a('0x4d')]({'where':{'id':_0x2bc41c[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x4c2048,null))[_0x778a('0x2d')](saveUpdates(_0x2bc41c[_0x778a('0x50')],null))[_0x778a('0x2d')](respondWithResult(_0x4c2048,null))[_0x778a('0x4e')](handleError(_0x4c2048,null));};exports[_0x778a('0x2e')]=function(_0x3b615a,_0x566a26){return db[_0x778a('0x46')][_0x778a('0x4d')]({'where':{'id':_0x3b615a[_0x778a('0x51')]['id']}})['then'](handleEntityNotFound(_0x566a26,null))[_0x778a('0x2d')](removeEntity(_0x566a26,null))[_0x778a('0x4e')](handleError(_0x566a26,null));};exports['getConfigurations']=function(_0x13a90b,_0x313d94,_0x30fb73){var _0x18935d={};var _0x40c077={};var _0x47d66e;var _0x3a7811;return db[_0x778a('0x46')][_0x778a('0x52')]({'where':{'id':_0x13a90b[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x313d94,null))['then'](function(_0x3c2612){if(_0x3c2612){_0x47d66e=_0x3c2612;_0x40c077['model']=_[_0x778a('0x39')](db[_0x778a('0x53')][_0x778a('0x33')]);_0x40c077[_0x778a('0x38')]=_[_0x778a('0x39')](_0x13a90b[_0x778a('0x38')]);_0x40c077['filters']=_['intersection'](_0x40c077[_0x778a('0x37')],_0x40c077[_0x778a('0x38')]);_0x18935d[_0x778a('0x3b')]=_['intersection'](_0x40c077[_0x778a('0x37')],qs[_0x778a('0x3c')](_0x13a90b[_0x778a('0x38')][_0x778a('0x3c')]));_0x18935d[_0x778a('0x3b')]=_0x18935d[_0x778a('0x3b')][_0x778a('0x4b')]?_0x18935d['attributes']:_0x40c077[_0x778a('0x37')];_0x18935d[_0x778a('0x3f')]=qs[_0x778a('0x54')](_0x13a90b[_0x778a('0x38')][_0x778a('0x54')]);_0x18935d[_0x778a('0x40')]=qs[_0x778a('0x41')](_[_0x778a('0x55')](_0x13a90b[_0x778a('0x38')],_0x40c077['filters']));if(_0x13a90b[_0x778a('0x38')]['filter']){_0x18935d['where']=_[_0x778a('0x43')](_0x18935d['where'],{'$or':_[_0x778a('0x32')](_0x18935d[_0x778a('0x3b')],function(_0x5a4501){var _0x35b9ca={};_0x35b9ca[_0x5a4501]={'$like':'%'+_0x13a90b[_0x778a('0x38')][_0x778a('0x42')]+'%'};return _0x35b9ca;})});}_0x18935d=_[_0x778a('0x43')]({},_0x18935d,_0x13a90b[_0x778a('0x45')]);return _0x47d66e[_0x778a('0x56')](_0x18935d);}})[_0x778a('0x2d')](function(_0x1888ca){if(_0x1888ca){_0x3a7811=_0x1888ca[_0x778a('0x4b')];if(!_0x13a90b[_0x778a('0x38')][_0x778a('0x3d')](_0x778a('0x3e'))){_0x18935d[_0x778a('0x28')]=qs[_0x778a('0x28')](_0x13a90b['query']['limit']);_0x18935d[_0x778a('0x27')]=qs[_0x778a('0x27')](_0x13a90b['query'][_0x778a('0x27')]);}return _0x47d66e['getConfigurations'](_0x18935d);}})[_0x778a('0x2d')](function(_0x5de60f){if(_0x5de60f){return _0x5de60f?{'count':_0x3a7811,'rows':_0x5de60f}:null;}})[_0x778a('0x2d')](respondWithResult(_0x313d94,null))[_0x778a('0x4e')](handleError(_0x313d94,null));};exports[_0x778a('0x57')]=function(_0x139c39,_0x30dbee,_0x1edde6){if(_0x139c39[_0x778a('0x50')]['id']){delete _0x139c39['body']['id'];}return db[_0x778a('0x46')]['findOne']({'where':{'id':_0x139c39[_0x778a('0x51')]['id']}})[_0x778a('0x2d')](handleEntityNotFound(_0x30dbee,null))[_0x778a('0x2d')](function(_0x7305ca){if(_0x7305ca){_0x139c39[_0x778a('0x50')][_0x778a('0x58')]=_0x7305ca['id'];_0x139c39[_0x778a('0x50')][_0x778a('0x59')]=integrations['getSubjects'](_0x139c39['body'][_0x778a('0x5a')],_0x139c39[_0x778a('0x50')][_0x778a('0x35')]);_0x139c39[_0x778a('0x50')][_0x778a('0x5b')]=integrations[_0x778a('0x5c')](_0x139c39['body'][_0x778a('0x5a')],_0x139c39[_0x778a('0x50')][_0x778a('0x35')]);return db[_0x778a('0x53')][_0x778a('0x4f')](_0x139c39['body'],{'include':[{'model':db[_0x778a('0x5d')],'as':'Subjects'},{'model':db[_0x778a('0x5d')],'as':_0x778a('0x5b')}]});}return null;})[_0x778a('0x2d')](respondWithResult(_0x30dbee,null))[_0x778a('0x4e')](handleError(_0x30dbee,null));};exports['getFields']=function(_0x5ac95a,_0x5ca8e0,_0x5c5e8c){var _0x3a55ec=[{'name':_0x778a('0x5e'),'label':_0x778a('0x5e'),'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 _0x44d18c='';return db[_0x778a('0x46')][_0x778a('0x52')]({'where':{'id':_0x5ac95a[_0x778a('0x51')]['id']},'attributes':['id',_0x778a('0x5f'),_0x778a('0x60'),'username',_0x778a('0x61'),_0x778a('0x62'),_0x778a('0x63'),_0x778a('0x64'),_0x778a('0x65')]})[_0x778a('0x2d')](handleEntityNotFound(_0x5ca8e0,null))[_0x778a('0x2d')](function(_0x2c84ce){if(_0x2c84ce){_0x44d18c=_0x2c84ce[_0x778a('0x5f')];var _0x166349=_0x44d18c['slice'](-0x1);if(_0x166349==='/'){_0x44d18c=_0x44d18c[_0x778a('0x66')](0x0,_0x44d18c['lastIndexOf'](_0x166349));}var _0x5335e8={'method':_0x778a('0x67'),'uri':util[_0x778a('0x68')](_0x778a('0x69'),_0x44d18c),'headers':{'Content-Type':'application/json','Accept':_0x778a('0x6a')},'json':!![]};if(_0x2c84ce[_0x778a('0x60')]===_0x778a('0x6b')){_0x5335e8[_0x778a('0x6c')][_0x778a('0x6d')]=util[_0x778a('0x68')](_0x778a('0x6e'),new Buffer(util[_0x778a('0x68')]('%s:%s',_0x2c84ce['username'],_0x2c84ce[_0x778a('0x61')]))[_0x778a('0x6f')](_0x778a('0x70')));}return rp(_0x5335e8)[_0x778a('0x2d')](function(_0x1de108){return _0x3a55ec[_0x778a('0x71')](_['map'](_0x1de108[_0x778a('0x72')]['entries'],function(_0x3e5f55){return{'id':_0x3e5f55[_0x778a('0x30')],'name':_0x3e5f55['name'],'type':_0x3e5f55[_0x778a('0x35')],'active':_0x3e5f55['active'],'label':_0x3e5f55[_0x778a('0x73')],'custom':!![]};}));});}})['then'](function(_0x14ee3c){return{'count':_0x14ee3c[_0x778a('0x4b')],'rows':_0x14ee3c};})['then'](respondWithResult(_0x5ca8e0,null))[_0x778a('0x4e')](function(_0x1f91d1){var _0x3df57d=_0x5ac95a[_0x778a('0x38')][_0x778a('0x74')]?0x1f4:_0x1f91d1[_0x778a('0x75')]||0x1f4;logger[_0x778a('0x1e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3df57d,JSON[_0x778a('0x1d')](_0x1f91d1));delete _0x1f91d1['name'];if(_0x3df57d===0x191){_0x3df57d=0x190;}_0x5ca8e0[_0x778a('0x23')](_0x3df57d)[_0x778a('0x76')](_0x5ac95a[_0x778a('0x38')][_0x778a('0x74')]?{'message':_0x778a('0x77'),'statusCode':_0x1f91d1[_0x778a('0x75')]}:_0x1f91d1);});}; \ No newline at end of file +var _0x7863=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','show','params','includeAll','find','create','body','update','findOne','DeskConfiguration','pick','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','remoteUri','authType','password','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7863,0x1da));var _0x3786=function(_0xda127b,_0x3792b4){_0xda127b=_0xda127b-0x0;var _0x4f9ddb=_0x7863[_0xda127b];return _0x4f9ddb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3786('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3786('0x1'));var jsonpatch=require(_0x3786('0x2'));var rp=require('request-promise');var moment=require(_0x3786('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3786('0x4'));var util=require(_0x3786('0x5'));var path=require(_0x3786('0x6'));var sox=require(_0x3786('0x7'));var csv=require(_0x3786('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3786('0x9'));var crypto=require(_0x3786('0xa'));var jsforce=require(_0x3786('0xb'));var deskjs=require(_0x3786('0xc'));var toCsv=require(_0x3786('0x8'));var querystring=require(_0x3786('0xd'));var Papa=require(_0x3786('0xe'));var Redis=require(_0x3786('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3786('0x10'));var as=require(_0x3786('0x11'));var hardwareService=require(_0x3786('0x12'));var logger=require(_0x3786('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3786('0x14'));var licenseUtil=require(_0x3786('0x15'));var db=require(_0x3786('0x16'))['db'];var integrations=require(_0x3786('0x17'));var jayson=require(_0x3786('0x18'));var client=jayson['client'][_0x3786('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x597555,_0x136569,_0x4c9cf9,_0x9ab8f5){return new BPromise(function(_0x251d52,_0x2dc463){var _0x16bf36=_0x9ab8f5||client;return _0x16bf36['request'](_0x597555,_0x4c9cf9)[_0x3786('0x1a')](function(_0x2e104e){logger[_0x3786('0x1b')]('DeskAccount,\x20%s,\x20%s',_0x136569,_0x3786('0x1c'));logger[_0x3786('0x1d')](_0x3786('0x1e'),_0x136569,_0x3786('0x1c'),JSON['stringify'](_0x2e104e));if(_0x2e104e[_0x3786('0x1f')]){if(_0x2e104e['error'][_0x3786('0x20')]===0x1f4){logger['error'](_0x3786('0x21'),_0x136569,_0x2e104e[_0x3786('0x1f')][_0x3786('0x22')]);return _0x2dc463(_0x2e104e[_0x3786('0x1f')]['message']);}logger[_0x3786('0x1f')](_0x3786('0x21'),_0x136569,_0x2e104e['error'][_0x3786('0x22')]);return _0x251d52(_0x2e104e[_0x3786('0x1f')]['message']);}else{logger['info'](_0x3786('0x21'),_0x136569,'request\x20sent');_0x251d52(_0x2e104e[_0x3786('0x23')][_0x3786('0x22')]);}})[_0x3786('0x24')](function(_0x3d0a3c){logger[_0x3786('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x136569,_0x3d0a3c);_0x2dc463(_0x3d0a3c);});});}function respondWithStatusCode(_0x37d7c7,_0x5418b9){_0x5418b9=_0x5418b9||0xcc;return function(_0x4a0b04){if(_0x4a0b04){return _0x37d7c7[_0x3786('0x25')](_0x5418b9);}return _0x37d7c7['status'](_0x5418b9)[_0x3786('0x26')]();};}function respondWithResult(_0x5f2c90,_0x44b052){_0x44b052=_0x44b052||0xc8;return function(_0x551b37){if(_0x551b37){return _0x5f2c90[_0x3786('0x27')](_0x44b052)['json'](_0x551b37);}};}function respondWithFilteredResult(_0x7ce834,_0x33dc63){return function(_0xf6f498){if(_0xf6f498){var _0x434294=_0xf6f498[_0x3786('0x28')],_0x1f6185=_0x33dc63[_0x3786('0x29')],_0x226857=_0x33dc63[_0x3786('0x29')]+_0x33dc63[_0x3786('0x2a')],_0x2b13c2;if(_0x226857>=_0x434294){_0x226857=_0x434294;_0x2b13c2=0xc8;}else{_0x2b13c2=0xce;}_0x7ce834[_0x3786('0x27')](_0x2b13c2);return _0x7ce834[_0x3786('0x2b')](_0x3786('0x2c'),_0x1f6185+'-'+_0x226857+'/'+_0x434294)['json'](_0xf6f498);}return null;};}function patchUpdates(_0x4974cb){return function(_0x24264c){try{jsonpatch[_0x3786('0x2d')](_0x24264c,_0x4974cb,!![]);}catch(_0x304356){return BPromise[_0x3786('0x2e')](_0x304356);}return _0x24264c[_0x3786('0x2f')]();};}function saveUpdates(_0x26c9f0,_0x405fc1){return function(_0x418a97){if(_0x418a97){return _0x418a97['update'](_0x26c9f0)[_0x3786('0x1a')](function(_0x500a51){return _0x500a51;});}return null;};}function removeEntity(_0x45e842,_0x35e6ab){return function(_0x4aac87){if(_0x4aac87){return _0x4aac87[_0x3786('0x30')]()[_0x3786('0x1a')](function(){_0x45e842[_0x3786('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1673c1,_0x1513ef){return function(_0x23751f){if(!_0x23751f){_0x1673c1[_0x3786('0x25')](0x194);}return _0x23751f;};}function handleError(_0x316c79,_0x26a57d){_0x26a57d=_0x26a57d||0x1f4;return function(_0x3846f6){logger[_0x3786('0x1f')](_0x3846f6['stack']);if(_0x3846f6['name']){delete _0x3846f6[_0x3786('0x31')];}_0x316c79[_0x3786('0x27')](_0x26a57d)[_0x3786('0x32')](_0x3846f6);};}exports['index']=function(_0x3028f9,_0x39275f){var _0x2163f6={},_0xb81969={},_0x251093={'count':0x0,'rows':[]};var _0x421915=_[_0x3786('0x33')](db[_0x3786('0x34')][_0x3786('0x35')],function(_0x43f55e){return{'name':_0x43f55e[_0x3786('0x36')],'type':_0x43f55e[_0x3786('0x37')][_0x3786('0x38')]};});_0xb81969[_0x3786('0x39')]=_['map'](_0x421915,_0x3786('0x31'));_0xb81969[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x3028f9[_0x3786('0x3a')]);_0xb81969[_0x3786('0x3c')]=_[_0x3786('0x3d')](_0xb81969['model'],_0xb81969[_0x3786('0x3a')]);_0x2163f6[_0x3786('0x3e')]=_[_0x3786('0x3d')](_0xb81969['model'],qs[_0x3786('0x3f')](_0x3028f9[_0x3786('0x3a')]['fields']));_0x2163f6['attributes']=_0x2163f6['attributes'][_0x3786('0x40')]?_0x2163f6[_0x3786('0x3e')]:_0xb81969['model'];if(!_0x3028f9['query'][_0x3786('0x41')](_0x3786('0x42'))){_0x2163f6['limit']=qs['limit'](_0x3028f9[_0x3786('0x3a')][_0x3786('0x2a')]);_0x2163f6['offset']=qs[_0x3786('0x29')](_0x3028f9[_0x3786('0x3a')][_0x3786('0x29')]);}_0x2163f6[_0x3786('0x43')]=qs[_0x3786('0x44')](_0x3028f9[_0x3786('0x3a')][_0x3786('0x44')]);_0x2163f6[_0x3786('0x45')]=qs[_0x3786('0x3c')](_['pick'](_0x3028f9[_0x3786('0x3a')],_0xb81969[_0x3786('0x3c')]),_0x421915);if(_0x3028f9[_0x3786('0x3a')][_0x3786('0x46')]){_0x2163f6[_0x3786('0x45')]=_[_0x3786('0x47')](_0x2163f6[_0x3786('0x45')],{'$or':_[_0x3786('0x33')](_0x421915,function(_0x14dc00){if(_0x14dc00[_0x3786('0x37')]!==_0x3786('0x48')){var _0x3fe386={};_0x3fe386[_0x14dc00[_0x3786('0x31')]]={'$like':'%'+_0x3028f9['query']['filter']+'%'};return _0x3fe386;}})});}_0x2163f6=_[_0x3786('0x47')]({},_0x2163f6,_0x3028f9[_0x3786('0x49')]);var _0x61ade6={'where':_0x2163f6[_0x3786('0x45')]};return db[_0x3786('0x34')][_0x3786('0x28')](_0x61ade6)[_0x3786('0x1a')](function(_0x59f987){_0x251093[_0x3786('0x28')]=_0x59f987;if(_0x3028f9[_0x3786('0x3a')]['includeAll']){_0x2163f6[_0x3786('0x4a')]=[{'all':!![]}];}return db[_0x3786('0x34')]['findAll'](_0x2163f6);})[_0x3786('0x1a')](function(_0x20b9a8){_0x251093['rows']=_0x20b9a8;return _0x251093;})['then'](respondWithFilteredResult(_0x39275f,_0x2163f6))[_0x3786('0x24')](handleError(_0x39275f,null));};exports[_0x3786('0x4b')]=function(_0x167c25,_0xdde5ec){var _0x2fb6ea={'raw':![],'where':{'id':_0x167c25[_0x3786('0x4c')]['id']}},_0x5839de={};_0x5839de['model']=_[_0x3786('0x3b')](db[_0x3786('0x34')][_0x3786('0x35')]);_0x5839de[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x167c25[_0x3786('0x3a')]);_0x5839de['filters']=_[_0x3786('0x3d')](_0x5839de['model'],_0x5839de[_0x3786('0x3a')]);_0x2fb6ea['attributes']=_['intersection'](_0x5839de[_0x3786('0x39')],qs['fields'](_0x167c25[_0x3786('0x3a')]['fields']));_0x2fb6ea['attributes']=_0x2fb6ea[_0x3786('0x3e')][_0x3786('0x40')]?_0x2fb6ea[_0x3786('0x3e')]:_0x5839de[_0x3786('0x39')];if(_0x167c25[_0x3786('0x3a')][_0x3786('0x4d')]){_0x2fb6ea['include']=[{'all':!![]}];}_0x2fb6ea=_['merge']({},_0x2fb6ea,_0x167c25['options']);return db[_0x3786('0x34')][_0x3786('0x4e')](_0x2fb6ea)[_0x3786('0x1a')](handleEntityNotFound(_0xdde5ec,null))[_0x3786('0x1a')](respondWithResult(_0xdde5ec,null))[_0x3786('0x24')](handleError(_0xdde5ec,null));};exports[_0x3786('0x4f')]=function(_0x45c50a,_0x519a29){return db[_0x3786('0x34')][_0x3786('0x4f')](_0x45c50a[_0x3786('0x50')],{})[_0x3786('0x1a')](respondWithResult(_0x519a29,0xc9))[_0x3786('0x24')](handleError(_0x519a29,null));};exports[_0x3786('0x51')]=function(_0x2299aa,_0x5254eb){if(_0x2299aa[_0x3786('0x50')]['id']){delete _0x2299aa[_0x3786('0x50')]['id'];}return db[_0x3786('0x34')][_0x3786('0x4e')]({'where':{'id':_0x2299aa[_0x3786('0x4c')]['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x5254eb,null))[_0x3786('0x1a')](saveUpdates(_0x2299aa[_0x3786('0x50')],null))['then'](respondWithResult(_0x5254eb,null))[_0x3786('0x24')](handleError(_0x5254eb,null));};exports[_0x3786('0x30')]=function(_0x53e276,_0xfd77c2){return db[_0x3786('0x34')][_0x3786('0x4e')]({'where':{'id':_0x53e276[_0x3786('0x4c')]['id']}})['then'](handleEntityNotFound(_0xfd77c2,null))[_0x3786('0x1a')](removeEntity(_0xfd77c2,null))[_0x3786('0x24')](handleError(_0xfd77c2,null));};exports['getConfigurations']=function(_0x19d48d,_0x12bf23,_0x72e9d5){var _0x4a72a4={};var _0xd2abc8={};var _0x57b7ef;var _0x24624a;return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x19d48d['params']['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x12bf23,null))['then'](function(_0xf27cfe){if(_0xf27cfe){_0x57b7ef=_0xf27cfe;_0xd2abc8[_0x3786('0x39')]=_[_0x3786('0x3b')](db[_0x3786('0x53')]['rawAttributes']);_0xd2abc8[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x19d48d[_0x3786('0x3a')]);_0xd2abc8[_0x3786('0x3c')]=_[_0x3786('0x3d')](_0xd2abc8[_0x3786('0x39')],_0xd2abc8[_0x3786('0x3a')]);_0x4a72a4[_0x3786('0x3e')]=_[_0x3786('0x3d')](_0xd2abc8[_0x3786('0x39')],qs['fields'](_0x19d48d[_0x3786('0x3a')][_0x3786('0x3f')]));_0x4a72a4['attributes']=_0x4a72a4[_0x3786('0x3e')][_0x3786('0x40')]?_0x4a72a4[_0x3786('0x3e')]:_0xd2abc8[_0x3786('0x39')];_0x4a72a4['order']=qs['sort'](_0x19d48d['query'][_0x3786('0x44')]);_0x4a72a4['where']=qs[_0x3786('0x3c')](_[_0x3786('0x54')](_0x19d48d[_0x3786('0x3a')],_0xd2abc8[_0x3786('0x3c')]));if(_0x19d48d['query']['filter']){_0x4a72a4[_0x3786('0x45')]=_['merge'](_0x4a72a4['where'],{'$or':_['map'](_0x4a72a4[_0x3786('0x3e')],function(_0x2eadb4){var _0x255cd6={};_0x255cd6[_0x2eadb4]={'$like':'%'+_0x19d48d[_0x3786('0x3a')][_0x3786('0x46')]+'%'};return _0x255cd6;})});}_0x4a72a4=_[_0x3786('0x47')]({},_0x4a72a4,_0x19d48d['options']);return _0x57b7ef[_0x3786('0x55')](_0x4a72a4);}})['then'](function(_0x362d89){if(_0x362d89){_0x24624a=_0x362d89[_0x3786('0x40')];if(!_0x19d48d['query'][_0x3786('0x41')]('nolimit')){_0x4a72a4[_0x3786('0x2a')]=qs[_0x3786('0x2a')](_0x19d48d[_0x3786('0x3a')][_0x3786('0x2a')]);_0x4a72a4['offset']=qs['offset'](_0x19d48d['query'][_0x3786('0x29')]);}return _0x57b7ef['getConfigurations'](_0x4a72a4);}})['then'](function(_0x4f4599){if(_0x4f4599){return _0x4f4599?{'count':_0x24624a,'rows':_0x4f4599}:null;}})['then'](respondWithResult(_0x12bf23,null))[_0x3786('0x24')](handleError(_0x12bf23,null));};exports[_0x3786('0x56')]=function(_0x5e2fd5,_0x3d45c9,_0xba9715){if(_0x5e2fd5['body']['id']){delete _0x5e2fd5[_0x3786('0x50')]['id'];}return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x5e2fd5[_0x3786('0x4c')]['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x3d45c9,null))['then'](function(_0x1217e2){if(_0x1217e2){_0x5e2fd5[_0x3786('0x50')]['AccountId']=_0x1217e2['id'];_0x5e2fd5[_0x3786('0x50')]['Subjects']=integrations[_0x3786('0x57')](_0x5e2fd5[_0x3786('0x50')][_0x3786('0x58')],_0x5e2fd5['body'][_0x3786('0x37')]);_0x5e2fd5[_0x3786('0x50')]['Descriptions']=integrations[_0x3786('0x59')](_0x5e2fd5[_0x3786('0x50')][_0x3786('0x58')],_0x5e2fd5[_0x3786('0x50')]['type']);return db[_0x3786('0x53')]['create'](_0x5e2fd5[_0x3786('0x50')],{'include':[{'model':db[_0x3786('0x5a')],'as':_0x3786('0x5b')},{'model':db[_0x3786('0x5a')],'as':_0x3786('0x5c')}]});}return null;})[_0x3786('0x1a')](respondWithResult(_0x3d45c9,null))[_0x3786('0x24')](handleError(_0x3d45c9,null));};exports[_0x3786('0x5d')]=function(_0x10fcc4,_0x1f97bf,_0x2a6789){var _0x46ee91=[{'name':'priority','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 _0x1435b8='';return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x10fcc4[_0x3786('0x4c')]['id']},'attributes':['id',_0x3786('0x5e'),_0x3786('0x5f'),'username',_0x3786('0x60'),'consumerKey','consumerSecret','token',_0x3786('0x61')]})['then'](handleEntityNotFound(_0x1f97bf,null))[_0x3786('0x1a')](function(_0x290a8e){if(_0x290a8e){_0x1435b8=_0x290a8e[_0x3786('0x5e')];var _0x25c60b=_0x1435b8[_0x3786('0x62')](-0x1);if(_0x25c60b==='/'){_0x1435b8=_0x1435b8[_0x3786('0x63')](0x0,_0x1435b8[_0x3786('0x64')](_0x25c60b));}var _0x1d7862={'method':_0x3786('0x65'),'uri':util[_0x3786('0x66')](_0x3786('0x67'),_0x1435b8),'headers':{'Content-Type':_0x3786('0x68'),'Accept':_0x3786('0x68')},'json':!![]};if(_0x290a8e['authType']===_0x3786('0x69')){_0x1d7862[_0x3786('0x6a')]['Authorization']=util[_0x3786('0x66')](_0x3786('0x6b'),new Buffer(util[_0x3786('0x66')](_0x3786('0x6c'),_0x290a8e[_0x3786('0x6d')],_0x290a8e[_0x3786('0x60')]))[_0x3786('0x6e')](_0x3786('0x6f')));}return rp(_0x1d7862)[_0x3786('0x1a')](function(_0x15fb61){return _0x46ee91[_0x3786('0x70')](_[_0x3786('0x33')](_0x15fb61[_0x3786('0x71')][_0x3786('0x72')],function(_0x407180){return{'id':_0x407180['name'],'name':_0x407180['name'],'type':_0x407180[_0x3786('0x37')],'active':_0x407180['active'],'label':_0x407180[_0x3786('0x73')],'custom':!![]};}));});}})['then'](function(_0x1421e2){return{'count':_0x1421e2[_0x3786('0x40')],'rows':_0x1421e2};})[_0x3786('0x1a')](respondWithResult(_0x1f97bf,null))['catch'](function(_0x131f5d){var _0x3d6608=_0x10fcc4[_0x3786('0x3a')][_0x3786('0x74')]?0x1f4:_0x131f5d[_0x3786('0x75')]||0x1f4;logger[_0x3786('0x1f')](_0x3786('0x76'),_0x3786('0x5d'),_0x3d6608,JSON[_0x3786('0x77')](_0x131f5d));delete _0x131f5d[_0x3786('0x31')];if(_0x3d6608===0x191){_0x3d6608=0x190;}_0x1f97bf[_0x3786('0x27')](_0x3d6608)[_0x3786('0x32')](_0x10fcc4[_0x3786('0x3a')][_0x3786('0x74')]?{'message':_0x3786('0x78'),'statusCode':_0x131f5d[_0x3786('0x75')]}:_0x131f5d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9cb5da3..e7e4870 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 _0x9c56=['../../config/logger','moment','bluebird','path','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x1505cb,_0x48a459){var _0x26d02a=function(_0x11f2d0){while(--_0x11f2d0){_0x1505cb['push'](_0x1505cb['shift']());}};_0x26d02a(++_0x48a459);}(_0x9c56,0x193));var _0x69c5=function(_0x1fb625,_0xb025a8){_0x1fb625=_0x1fb625-0x0;var _0xe462cf=_0x9c56[_0x1fb625];return _0xe462cf;};'use strict';var _=require(_0x69c5('0x0'));var util=require(_0x69c5('0x1'));var logger=require(_0x69c5('0x2'))('api');var moment=require(_0x69c5('0x3'));var BPromise=require(_0x69c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x9565d7,_0xdee36e){return _0x9565d7[_0x69c5('0x6')](_0x69c5('0x7'),attributes,{'tableName':_0x69c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8126=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x8126,0x14a));var _0x6812=function(_0x2b6d46,_0x11867e){_0x2b6d46=_0x2b6d46-0x0;var _0x555bdb=_0x8126[_0x2b6d46];return _0x555bdb;};'use strict';var _=require(_0x6812('0x0'));var util=require(_0x6812('0x1'));var logger=require(_0x6812('0x2'))(_0x6812('0x3'));var moment=require(_0x6812('0x4'));var BPromise=require(_0x6812('0x5'));var rp=require(_0x6812('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6812('0x7'));var config=require(_0x6812('0x8'));var attributes=require(_0x6812('0x9'));var integrations=require(_0x6812('0xa'));module[_0x6812('0xb')]=function(_0x2c96d2,_0x2722fc){return _0x2c96d2[_0x6812('0xc')](_0x6812('0xd'),attributes,{'tableName':_0x6812('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 239c01a..99bf170 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 _0x3571=['message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','DeskAccount','find','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x80582a,_0x31d6f0){var _0x1a6e2d=function(_0x264f10){while(--_0x264f10){_0x80582a['push'](_0x80582a['shift']());}};_0x1a6e2d(++_0x31d6f0);}(_0x3571,0x166));var _0x1357=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x3571[_0x2125f0];return _0x12d6eb;};'use strict';var _=require('lodash');var util=require(_0x1357('0x0'));var moment=require(_0x1357('0x1'));var BPromise=require(_0x1357('0x2'));var rs=require(_0x1357('0x3'));var fs=require('fs');var Redis=require(_0x1357('0x4'));var db=require(_0x1357('0x5'))['db'];var utils=require(_0x1357('0x6'));var logger=require(_0x1357('0x7'))(_0x1357('0x8'));var config=require(_0x1357('0x9'));var jayson=require(_0x1357('0xa'));var client=jayson[_0x1357('0xb')][_0x1357('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32af90,_0x56642e,_0x3c936d){return new BPromise(function(_0x5ce27e,_0x2acf1a){return client['request'](_0x32af90,_0x3c936d)[_0x1357('0xd')](function(_0x4ac306){logger[_0x1357('0xe')](_0x1357('0xf'),_0x56642e,_0x1357('0x10'));logger[_0x1357('0x11')](_0x1357('0x12'),_0x56642e,_0x1357('0x10'),JSON[_0x1357('0x13')](_0x4ac306));if(_0x4ac306[_0x1357('0x14')]){if(_0x4ac306[_0x1357('0x14')][_0x1357('0x15')]===0x1f4){logger[_0x1357('0x14')]('DeskAccount,\x20%s,\x20%s',_0x56642e,_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);return _0x2acf1a(_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);}logger[_0x1357('0x14')](_0x1357('0xf'),_0x56642e,_0x4ac306['error']['message']);return _0x5ce27e(_0x4ac306[_0x1357('0x14')][_0x1357('0x16')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x56642e,'request\x20sent');_0x5ce27e(_0x4ac306[_0x1357('0x17')][_0x1357('0x16')]);}})[_0x1357('0x18')](function(_0x4ce237){logger['error'](_0x1357('0xf'),_0x56642e,_0x4ce237);_0x2acf1a(_0x4ce237);});});}exports['GetDeskAccount']=function(_0x32b683){var _0x5426be=this;return new Promise(function(_0xcfccc8,_0x2df9cf){return db['DeskAccount'][_0x1357('0x19')]({'raw':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1b')]===undefined?!![]:![]:!![],'where':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1c')]||null:null,'attributes':_0x32b683['options']?_0x32b683[_0x1357('0x1a')][_0x1357('0x1d')]||null:null,'limit':_0x32b683[_0x1357('0x1a')]?_0x32b683['options'][_0x1357('0x1e')]||null:null,'include':_0x32b683[_0x1357('0x1a')]?_0x32b683[_0x1357('0x1a')][_0x1357('0x1f')]?_[_0x1357('0x20')](_0x32b683[_0x1357('0x1a')][_0x1357('0x1f')],function(_0x5b4105){return{'model':db[_0x5b4105[_0x1357('0x21')]],'as':_0x5b4105['as'],'attributes':_0x5b4105[_0x1357('0x1d')],'include':_0x5b4105[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x5b4105[_0x1357('0x1f')],function(_0x463bb7){return{'model':db[_0x463bb7['model']],'as':_0x463bb7['as'],'attributes':_0x463bb7[_0x1357('0x1d')],'include':_0x463bb7[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x463bb7[_0x1357('0x1f')],function(_0x33a2c7){return{'model':db[_0x33a2c7[_0x1357('0x21')]],'as':_0x33a2c7['as'],'attributes':_0x33a2c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1357('0xd')](function(_0x58fa28){logger[_0x1357('0xe')](_0x1357('0x22'),_0x32b683);logger[_0x1357('0x11')]('GetDeskAccount',_0x32b683,JSON[_0x1357('0x13')](_0x58fa28));_0xcfccc8(_0x58fa28);})[_0x1357('0x18')](function(_0x2ebb49){logger[_0x1357('0x14')]('GetDeskAccount',_0x2ebb49[_0x1357('0x16')],_0x32b683);_0x2df9cf(_0x5426be[_0x1357('0x14')](0x1f4,_0x2ebb49['message']));});});};exports['ShowDeskAccount']=function(_0x2d14a9){var _0x2adacd=this;return new Promise(function(_0x5cbc63,_0x5ace50){return db[_0x1357('0x23')][_0x1357('0x24')]({'raw':_0x2d14a9[_0x1357('0x1a')]?_0x2d14a9[_0x1357('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d14a9['options']?_0x2d14a9[_0x1357('0x1a')][_0x1357('0x1c')]||null:null,'attributes':_0x2d14a9[_0x1357('0x1a')]?_0x2d14a9['options'][_0x1357('0x1d')]||null:null,'include':_0x2d14a9['options']?_0x2d14a9['options'][_0x1357('0x1f')]?_[_0x1357('0x20')](_0x2d14a9[_0x1357('0x1a')][_0x1357('0x1f')],function(_0x53c2a6){return{'model':db[_0x53c2a6[_0x1357('0x21')]],'as':_0x53c2a6['as'],'attributes':_0x53c2a6[_0x1357('0x1d')],'include':_0x53c2a6[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x53c2a6[_0x1357('0x1f')],function(_0x39568d){return{'model':db[_0x39568d['model']],'as':_0x39568d['as'],'attributes':_0x39568d[_0x1357('0x1d')],'include':_0x39568d[_0x1357('0x1f')]?_[_0x1357('0x20')](_0x39568d[_0x1357('0x1f')],function(_0x4bfdbf){return{'model':db[_0x4bfdbf['model']],'as':_0x4bfdbf['as'],'attributes':_0x4bfdbf[_0x1357('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b3663){logger[_0x1357('0xe')](_0x1357('0x25'),_0x2d14a9);logger[_0x1357('0x11')]('ShowDeskAccount',_0x2d14a9,JSON[_0x1357('0x13')](_0x3b3663));_0x5cbc63(_0x3b3663);})[_0x1357('0x18')](function(_0x6ed4e7){logger[_0x1357('0x14')]('ShowDeskAccount',_0x6ed4e7['message'],_0x2d14a9);_0x5ace50(_0x2adacd['error'](0x1f4,_0x6ed4e7[_0x1357('0x16')]));});});}; \ No newline at end of file +var _0xd06d=['error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','map','include','model','stringify','ShowDeskAccount','find','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xd06d,0x13b));var _0xdd06=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0xd06d[_0x528342];return _0x27dd91;};'use strict';var _=require(_0xdd06('0x0'));var util=require('util');var moment=require(_0xdd06('0x1'));var BPromise=require(_0xdd06('0x2'));var rs=require(_0xdd06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd06('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd06('0x5'));var jayson=require(_0xdd06('0x6'));var client=jayson[_0xdd06('0x7')][_0xdd06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ee680,_0x1b56cf,_0x594eb7){return new BPromise(function(_0x78ffc4,_0x384a3b){return client[_0xdd06('0x9')](_0x3ee680,_0x594eb7)[_0xdd06('0xa')](function(_0xc15cd6){logger[_0xdd06('0xb')]('DeskAccount,\x20%s,\x20%s',_0x1b56cf,_0xdd06('0xc'));logger[_0xdd06('0xd')](_0xdd06('0xe'),_0x1b56cf,_0xdd06('0xc'),JSON['stringify'](_0xc15cd6));if(_0xc15cd6['error']){if(_0xc15cd6['error']['code']===0x1f4){logger[_0xdd06('0xf')](_0xdd06('0x10'),_0x1b56cf,_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);return _0x384a3b(_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);}logger[_0xdd06('0xf')](_0xdd06('0x10'),_0x1b56cf,_0xc15cd6[_0xdd06('0xf')]['message']);return _0x78ffc4(_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);}else{logger[_0xdd06('0xb')](_0xdd06('0x10'),_0x1b56cf,'request\x20sent');_0x78ffc4(_0xc15cd6[_0xdd06('0x12')][_0xdd06('0x11')]);}})['catch'](function(_0x5ad2a3){logger[_0xdd06('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1b56cf,_0x5ad2a3);_0x384a3b(_0x5ad2a3);});});}exports[_0xdd06('0x13')]=function(_0x50771b){var _0x1fdc41=this;return new Promise(function(_0x2cf0c6,_0x27d4b4){return db[_0xdd06('0x14')]['findAll']({'raw':_0x50771b['options']?_0x50771b[_0xdd06('0x15')][_0xdd06('0x16')]===undefined?!![]:![]:!![],'where':_0x50771b['options']?_0x50771b[_0xdd06('0x15')][_0xdd06('0x17')]||null:null,'attributes':_0x50771b[_0xdd06('0x15')]?_0x50771b['options'][_0xdd06('0x18')]||null:null,'limit':_0x50771b[_0xdd06('0x15')]?_0x50771b[_0xdd06('0x15')][_0xdd06('0x19')]||null:null,'include':_0x50771b[_0xdd06('0x15')]?_0x50771b['options']['include']?_[_0xdd06('0x1a')](_0x50771b[_0xdd06('0x15')][_0xdd06('0x1b')],function(_0x2f27a2){return{'model':db[_0x2f27a2[_0xdd06('0x1c')]],'as':_0x2f27a2['as'],'attributes':_0x2f27a2[_0xdd06('0x18')],'include':_0x2f27a2[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x2f27a2['include'],function(_0x1e91bf){return{'model':db[_0x1e91bf['model']],'as':_0x1e91bf['as'],'attributes':_0x1e91bf[_0xdd06('0x18')],'include':_0x1e91bf[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x1e91bf[_0xdd06('0x1b')],function(_0x14b7be){return{'model':db[_0x14b7be[_0xdd06('0x1c')]],'as':_0x14b7be['as'],'attributes':_0x14b7be[_0xdd06('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd06('0xa')](function(_0x4aa702){logger[_0xdd06('0xb')](_0xdd06('0x13'),_0x50771b);logger[_0xdd06('0xd')](_0xdd06('0x13'),_0x50771b,JSON[_0xdd06('0x1d')](_0x4aa702));_0x2cf0c6(_0x4aa702);})['catch'](function(_0x52798c){logger['error'](_0xdd06('0x13'),_0x52798c['message'],_0x50771b);_0x27d4b4(_0x1fdc41[_0xdd06('0xf')](0x1f4,_0x52798c['message']));});});};exports[_0xdd06('0x1e')]=function(_0xae08e9){var _0x9f7a58=this;return new Promise(function(_0x340af4,_0x2f5baf){return db[_0xdd06('0x14')][_0xdd06('0x1f')]({'raw':_0xae08e9['options']?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x16')]===undefined?!![]:![]:!![],'where':_0xae08e9['options']?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x17')]||null:null,'attributes':_0xae08e9[_0xdd06('0x15')]?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x18')]||null:null,'include':_0xae08e9[_0xdd06('0x15')]?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0xae08e9[_0xdd06('0x15')][_0xdd06('0x1b')],function(_0x2a559b){return{'model':db[_0x2a559b[_0xdd06('0x1c')]],'as':_0x2a559b['as'],'attributes':_0x2a559b[_0xdd06('0x18')],'include':_0x2a559b[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x2a559b[_0xdd06('0x1b')],function(_0x55aa6f){return{'model':db[_0x55aa6f[_0xdd06('0x1c')]],'as':_0x55aa6f['as'],'attributes':_0x55aa6f['attributes'],'include':_0x55aa6f[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x55aa6f[_0xdd06('0x1b')],function(_0x5b59cc){return{'model':db[_0x5b59cc[_0xdd06('0x1c')]],'as':_0x5b59cc['as'],'attributes':_0x5b59cc[_0xdd06('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd06('0xa')](function(_0x215788){logger[_0xdd06('0xb')](_0xdd06('0x1e'),_0xae08e9);logger['debug']('ShowDeskAccount',_0xae08e9,JSON['stringify'](_0x215788));_0x340af4(_0x215788);})[_0xdd06('0x20')](function(_0x2ff511){logger[_0xdd06('0xf')]('ShowDeskAccount',_0x2ff511[_0xdd06('0x11')],_0xae08e9);_0x2f5baf(_0x9f7a58[_0xdd06('0xf')](0x1f4,_0x2ff511[_0xdd06('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 49f00ba..c56d290 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 _0x2178=['post','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x16572e,_0x28c78f){var _0x4df768=function(_0x5affcf){while(--_0x5affcf){_0x16572e['push'](_0x16572e['shift']());}};_0x4df768(++_0x28c78f);}(_0x2178,0x1b0));var _0x8217=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x2178[_0x4322c6];return _0x4e7537;};'use strict';var multer=require(_0x8217('0x0'));var util=require('util');var path=require(_0x8217('0x1'));var timeout=require(_0x8217('0x2'));var express=require(_0x8217('0x3'));var router=express['Router']();var auth=require(_0x8217('0x4'));var interaction=require(_0x8217('0x5'));var config=require('../../config/environment');var controller=require(_0x8217('0x6'));router[_0x8217('0x7')]('/',auth[_0x8217('0x8')](),controller[_0x8217('0x9')]);router[_0x8217('0x7')](_0x8217('0xa'),auth[_0x8217('0x8')](),controller[_0x8217('0xb')]);router[_0x8217('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8217('0xc')]);router[_0x8217('0x7')](_0x8217('0xd'),auth['isAuthenticated'](),controller[_0x8217('0xe')]);router['get']('/:id/descriptions',auth[_0x8217('0x8')](),controller[_0x8217('0xf')]);router[_0x8217('0x7')](_0x8217('0x10'),auth[_0x8217('0x8')](),controller[_0x8217('0x11')]);router[_0x8217('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8217('0x10'),auth[_0x8217('0x8')](),controller[_0x8217('0x13')]);router[_0x8217('0x14')]('/:id',auth[_0x8217('0x8')](),controller[_0x8217('0x15')]);router[_0x8217('0x16')]('/:id',auth[_0x8217('0x8')](),controller[_0x8217('0x17')]);module[_0x8217('0x18')]=router; \ No newline at end of file +var _0x9512=['setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x109db8,_0xf0e481){var _0x3448f7=function(_0x50938d){while(--_0x50938d){_0x109db8['push'](_0x109db8['shift']());}};_0x3448f7(++_0xf0e481);}(_0x9512,0x75));var _0x2951=function(_0x4de958,_0x5b760e){_0x4de958=_0x4de958-0x0;var _0x6c13ff=_0x9512[_0x4de958];return _0x6c13ff;};'use strict';var multer=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var path=require(_0x2951('0x2'));var timeout=require(_0x2951('0x3'));var express=require(_0x2951('0x4'));var router=express[_0x2951('0x5')]();var auth=require(_0x2951('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2951('0x7'));var controller=require(_0x2951('0x8'));router[_0x2951('0x9')]('/',auth[_0x2951('0xa')](),controller[_0x2951('0xb')]);router[_0x2951('0x9')](_0x2951('0xc'),auth['isAuthenticated'](),controller[_0x2951('0xd')]);router[_0x2951('0x9')](_0x2951('0xe'),auth[_0x2951('0xa')](),controller[_0x2951('0xf')]);router[_0x2951('0x9')]('/:id/subjects',auth[_0x2951('0xa')](),controller[_0x2951('0x10')]);router[_0x2951('0x9')](_0x2951('0x11'),auth['isAuthenticated'](),controller[_0x2951('0x12')]);router[_0x2951('0x9')](_0x2951('0x13'),auth[_0x2951('0xa')](),controller[_0x2951('0x14')]);router['post']('/',auth[_0x2951('0xa')](),controller[_0x2951('0x15')]);router[_0x2951('0x16')](_0x2951('0x13'),auth[_0x2951('0xa')](),controller[_0x2951('0x17')]);router[_0x2951('0x18')](_0x2951('0xc'),auth[_0x2951('0xa')](),controller[_0x2951('0x19')]);router[_0x2951('0x1a')](_0x2951('0xc'),auth[_0x2951('0xa')](),controller['destroy']);module[_0x2951('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7f01dc3..494e233 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 _0x3841=['STRING','exports'];(function(_0x3b2955,_0x4d761b){var _0xab1186=function(_0x1dbb6d){while(--_0x1dbb6d){_0x3b2955['push'](_0x3b2955['shift']());}};_0xab1186(++_0x4d761b);}(_0x3841,0x1c3));var _0x1384=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x3841[_0x390733];return _0x33beb9;};'use strict';var Sequelize=require('sequelize');module[_0x1384('0x0')]={'name':{'type':Sequelize[_0x1384('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa85d=['sequelize'];(function(_0x220efe,_0x25ac58){var _0x52c213=function(_0xead87e){while(--_0xead87e){_0x220efe['push'](_0x220efe['shift']());}};_0x52c213(++_0x25ac58);}(_0xa85d,0x1e1));var _0xda85=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xa85d[_0x519756];return _0x37047e;};'use strict';var Sequelize=require(_0xda85('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a38f409..860eda7 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 _0x2795=['stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','DeskConfiguration','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','findOne','DeskField','order','pick','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x229f8d,_0x48402c){var _0x3e193c=function(_0x58009d){while(--_0x58009d){_0x229f8d['push'](_0x229f8d['shift']());}};_0x3e193c(++_0x48402c);}(_0x2795,0x9e));var _0x5279=function(_0x1ade95,_0x544ab7){_0x1ade95=_0x1ade95-0x0;var _0x11beb1=_0x2795[_0x1ade95];return _0x11beb1;};'use strict';var pdf=require(_0x5279('0x0'));var emlformat=require(_0x5279('0x1'));var rimraf=require(_0x5279('0x2'));var zipdir=require(_0x5279('0x3'));var jsonpatch=require(_0x5279('0x4'));var rp=require(_0x5279('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5279('0x6'));var util=require('util');var path=require(_0x5279('0x7'));var sox=require(_0x5279('0x8'));var csv=require(_0x5279('0x9'));var ejs=require(_0x5279('0xa'));var fs=require('fs');var _=require(_0x5279('0xb'));var squel=require('squel');var crypto=require(_0x5279('0xc'));var jsforce=require(_0x5279('0xd'));var deskjs=require(_0x5279('0xe'));var toCsv=require(_0x5279('0x9'));var querystring=require('querystring');var Papa=require(_0x5279('0xf'));var Redis=require(_0x5279('0x10'));var authService=require(_0x5279('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5279('0x12'));var hardwareService=require(_0x5279('0x13'));var logger=require(_0x5279('0x14'))(_0x5279('0x15'));var utils=require('../../config/utils');var config=require(_0x5279('0x16'));var licenseUtil=require(_0x5279('0x17'));var db=require(_0x5279('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7feb3b,_0x3eb9b5,_0x1d09d5,_0x4431c5){return new BPromise(function(_0x1a7d63,_0x522651){var _0x4ab9fd=_0x4431c5||client;return _0x4ab9fd[_0x5279('0x19')](_0x7feb3b,_0x1d09d5)['then'](function(_0x1a45b5){logger[_0x5279('0x1a')](_0x5279('0x1b'),_0x3eb9b5,_0x5279('0x1c'));logger[_0x5279('0x1d')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3eb9b5,'request\x20sent',JSON[_0x5279('0x1e')](_0x1a45b5));if(_0x1a45b5[_0x5279('0x1f')]){if(_0x1a45b5['error'][_0x5279('0x20')]===0x1f4){logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);return _0x522651(_0x1a45b5['error'][_0x5279('0x21')]);}logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);return _0x1a7d63(_0x1a45b5[_0x5279('0x1f')][_0x5279('0x21')]);}else{logger[_0x5279('0x1a')](_0x5279('0x1b'),_0x3eb9b5,_0x5279('0x1c'));_0x1a7d63(_0x1a45b5[_0x5279('0x22')][_0x5279('0x21')]);}})[_0x5279('0x23')](function(_0x3f60a5){logger[_0x5279('0x1f')](_0x5279('0x1b'),_0x3eb9b5,_0x3f60a5);_0x522651(_0x3f60a5);});});}function respondWithStatusCode(_0x11cdc4,_0x21708c){_0x21708c=_0x21708c||0xcc;return function(_0x368b4c){if(_0x368b4c){return _0x11cdc4[_0x5279('0x24')](_0x21708c);}return _0x11cdc4[_0x5279('0x25')](_0x21708c)[_0x5279('0x26')]();};}function respondWithResult(_0x41f732,_0x4b2f15){_0x4b2f15=_0x4b2f15||0xc8;return function(_0x3e775c){if(_0x3e775c){return _0x41f732[_0x5279('0x25')](_0x4b2f15)[_0x5279('0x27')](_0x3e775c);}};}function respondWithFilteredResult(_0x5e346b,_0x1944d8){return function(_0x3954b1){if(_0x3954b1){var _0xb8f929=_0x3954b1['count'],_0x4e677a=_0x1944d8[_0x5279('0x28')],_0x4bf6d2=_0x1944d8[_0x5279('0x28')]+_0x1944d8[_0x5279('0x29')],_0x451ef6;if(_0x4bf6d2>=_0xb8f929){_0x4bf6d2=_0xb8f929;_0x451ef6=0xc8;}else{_0x451ef6=0xce;}_0x5e346b[_0x5279('0x25')](_0x451ef6);return _0x5e346b[_0x5279('0x2a')](_0x5279('0x2b'),_0x4e677a+'-'+_0x4bf6d2+'/'+_0xb8f929)['json'](_0x3954b1);}return null;};}function patchUpdates(_0x5476a9){return function(_0x5585cb){try{jsonpatch['apply'](_0x5585cb,_0x5476a9,!![]);}catch(_0x3815c2){return BPromise[_0x5279('0x2c')](_0x3815c2);}return _0x5585cb[_0x5279('0x2d')]();};}function saveUpdates(_0x2a69ac,_0x4ec76b){return function(_0x1d78f1){if(_0x1d78f1){return _0x1d78f1[_0x5279('0x2e')](_0x2a69ac)['then'](function(_0x5ce97a){return _0x5ce97a;});}return null;};}function removeEntity(_0x5be7e6,_0x251147){return function(_0xd4c570){if(_0xd4c570){return _0xd4c570[_0x5279('0x2f')]()[_0x5279('0x30')](function(){_0x5be7e6[_0x5279('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3175a8,_0x5c659a){return function(_0x1b94fa){if(!_0x1b94fa){_0x3175a8[_0x5279('0x24')](0x194);}return _0x1b94fa;};}function handleError(_0x17ef4b,_0x221f2c){_0x221f2c=_0x221f2c||0x1f4;return function(_0x1b57bd){logger[_0x5279('0x1f')](_0x1b57bd[_0x5279('0x31')]);if(_0x1b57bd[_0x5279('0x32')]){delete _0x1b57bd[_0x5279('0x32')];}_0x17ef4b['status'](_0x221f2c)[_0x5279('0x33')](_0x1b57bd);};}exports['index']=function(_0x24d515,_0x31ad0a){var _0x1b0c36={},_0x4a1042={},_0x1905ab={'count':0x0,'rows':[]};var _0x1f68c3=_['map'](db[_0x5279('0x34')]['rawAttributes'],function(_0x58d977){return{'name':_0x58d977['fieldName'],'type':_0x58d977[_0x5279('0x35')][_0x5279('0x36')]};});_0x4a1042['model']=_[_0x5279('0x37')](_0x1f68c3,_0x5279('0x32'));_0x4a1042[_0x5279('0x38')]=_[_0x5279('0x39')](_0x24d515['query']);_0x4a1042[_0x5279('0x3a')]=_['intersection'](_0x4a1042[_0x5279('0x3b')],_0x4a1042[_0x5279('0x38')]);_0x1b0c36[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x4a1042['model'],qs['fields'](_0x24d515[_0x5279('0x38')]['fields']));_0x1b0c36[_0x5279('0x3c')]=_0x1b0c36[_0x5279('0x3c')][_0x5279('0x3e')]?_0x1b0c36['attributes']:_0x4a1042[_0x5279('0x3b')];if(!_0x24d515[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x1b0c36[_0x5279('0x29')]=qs[_0x5279('0x29')](_0x24d515[_0x5279('0x38')][_0x5279('0x29')]);_0x1b0c36[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x24d515[_0x5279('0x38')]['offset']);}_0x1b0c36['order']=qs[_0x5279('0x41')](_0x24d515[_0x5279('0x38')][_0x5279('0x41')]);_0x1b0c36['where']=qs[_0x5279('0x3a')](_['pick'](_0x24d515[_0x5279('0x38')],_0x4a1042[_0x5279('0x3a')]),_0x1f68c3);if(_0x24d515[_0x5279('0x38')][_0x5279('0x42')]){_0x1b0c36[_0x5279('0x43')]=_[_0x5279('0x44')](_0x1b0c36[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x1f68c3,function(_0x3ccd72){if(_0x3ccd72[_0x5279('0x35')]!==_0x5279('0x45')){var _0x26c983={};_0x26c983[_0x3ccd72['name']]={'$like':'%'+_0x24d515[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x26c983;}})});}_0x1b0c36=_[_0x5279('0x44')]({},_0x1b0c36,_0x24d515[_0x5279('0x46')]);var _0xa2273={'where':_0x1b0c36[_0x5279('0x43')]};return db[_0x5279('0x34')][_0x5279('0x47')](_0xa2273)['then'](function(_0x2cfccc){_0x1905ab[_0x5279('0x47')]=_0x2cfccc;if(_0x24d515[_0x5279('0x38')][_0x5279('0x48')]){_0x1b0c36['include']=[{'all':!![]}];}return db[_0x5279('0x34')][_0x5279('0x49')](_0x1b0c36);})[_0x5279('0x30')](function(_0x46d492){_0x1905ab[_0x5279('0x4a')]=_0x46d492;return _0x1905ab;})['then'](respondWithFilteredResult(_0x31ad0a,_0x1b0c36))['catch'](handleError(_0x31ad0a,null));};exports[_0x5279('0x4b')]=function(_0x4a3ab7,_0x47c320){var _0x48b935={'raw':![],'where':{'id':_0x4a3ab7[_0x5279('0x4c')]['id']}},_0x8ba31c={};_0x8ba31c[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x34')][_0x5279('0x4d')]);_0x8ba31c[_0x5279('0x38')]=_['keys'](_0x4a3ab7[_0x5279('0x38')]);_0x8ba31c[_0x5279('0x3a')]=_['intersection'](_0x8ba31c[_0x5279('0x3b')],_0x8ba31c[_0x5279('0x38')]);_0x48b935[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x8ba31c[_0x5279('0x3b')],qs['fields'](_0x4a3ab7['query'][_0x5279('0x4e')]));_0x48b935[_0x5279('0x3c')]=_0x48b935[_0x5279('0x3c')]['length']?_0x48b935[_0x5279('0x3c')]:_0x8ba31c[_0x5279('0x3b')];if(_0x4a3ab7[_0x5279('0x38')]['includeAll']){_0x48b935[_0x5279('0x4f')]=[{'all':!![]}];}_0x48b935=_[_0x5279('0x44')]({},_0x48b935,_0x4a3ab7['options']);return db['DeskConfiguration'][_0x5279('0x50')](_0x48b935)[_0x5279('0x30')](handleEntityNotFound(_0x47c320,null))[_0x5279('0x30')](respondWithResult(_0x47c320,null))['catch'](handleError(_0x47c320,null));};exports[_0x5279('0x51')]=function(_0x58f988,_0xe53bcb){return db[_0x5279('0x34')]['create'](_0x58f988[_0x5279('0x52')],{})[_0x5279('0x30')](respondWithResult(_0xe53bcb,0xc9))['catch'](handleError(_0xe53bcb,null));};exports['update']=function(_0x38c2c4,_0x548983){if(_0x38c2c4[_0x5279('0x52')]['id']){delete _0x38c2c4['body']['id'];}return db[_0x5279('0x34')][_0x5279('0x50')]({'where':{'id':_0x38c2c4[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x548983,null))[_0x5279('0x30')](saveUpdates(_0x38c2c4['body'],null))[_0x5279('0x30')](respondWithResult(_0x548983,null))[_0x5279('0x23')](handleError(_0x548983,null));};exports[_0x5279('0x2f')]=function(_0x285bfa,_0x1056e){return db[_0x5279('0x34')]['find']({'where':{'id':_0x285bfa[_0x5279('0x4c')]['id']}})[_0x5279('0x30')](handleEntityNotFound(_0x1056e,null))[_0x5279('0x30')](removeEntity(_0x1056e,null))[_0x5279('0x23')](handleError(_0x1056e,null));};exports['getFields']=function(_0x533fa6,_0x59c1b7,_0x5db099){var _0x14fcb7={};var _0x38c5d1={};var _0x9cf5a;var _0x299ab0;return db['DeskConfiguration'][_0x5279('0x53')]({'where':{'id':_0x533fa6[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59c1b7,null))[_0x5279('0x30')](function(_0xf26e73){if(_0xf26e73){_0x9cf5a=_0xf26e73;_0x38c5d1[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0x38c5d1[_0x5279('0x38')]=_[_0x5279('0x39')](_0x533fa6[_0x5279('0x38')]);_0x38c5d1[_0x5279('0x3a')]=_['intersection'](_0x38c5d1['model'],_0x38c5d1[_0x5279('0x38')]);_0x14fcb7[_0x5279('0x3c')]=_['intersection'](_0x38c5d1[_0x5279('0x3b')],qs['fields'](_0x533fa6[_0x5279('0x38')]['fields']));_0x14fcb7[_0x5279('0x3c')]=_0x14fcb7[_0x5279('0x3c')]['length']?_0x14fcb7[_0x5279('0x3c')]:_0x38c5d1[_0x5279('0x3b')];_0x14fcb7[_0x5279('0x55')]=qs['sort'](_0x533fa6[_0x5279('0x38')][_0x5279('0x41')]);_0x14fcb7[_0x5279('0x43')]=qs['filters'](_[_0x5279('0x56')](_0x533fa6[_0x5279('0x38')],_0x38c5d1[_0x5279('0x3a')]));if(_0x533fa6['query'][_0x5279('0x42')]){_0x14fcb7[_0x5279('0x43')]=_['merge'](_0x14fcb7[_0x5279('0x43')],{'$or':_['map'](_0x14fcb7[_0x5279('0x3c')],function(_0xffa628){var _0x3955b8={};_0x3955b8[_0xffa628]={'$like':'%'+_0x533fa6[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x3955b8;})});}_0x14fcb7=_[_0x5279('0x44')]({},_0x14fcb7,_0x533fa6['options']);return _0x9cf5a['getFields'](_0x14fcb7);}})['then'](function(_0x13af9f){if(_0x13af9f){_0x299ab0=_0x13af9f[_0x5279('0x3e')];if(!_0x533fa6[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x14fcb7[_0x5279('0x29')]=qs['limit'](_0x533fa6['query'][_0x5279('0x29')]);_0x14fcb7['offset']=qs[_0x5279('0x28')](_0x533fa6[_0x5279('0x38')]['offset']);}return _0x9cf5a[_0x5279('0x57')](_0x14fcb7);}})[_0x5279('0x30')](function(_0x1fb0b3){if(_0x1fb0b3){return _0x1fb0b3?{'count':_0x299ab0,'rows':_0x1fb0b3}:null;}})[_0x5279('0x30')](respondWithResult(_0x59c1b7,null))['catch'](handleError(_0x59c1b7,null));};exports['getSubjects']=function(_0x38a917,_0x12d5bd,_0x3f379b){var _0x523648={};var _0xb586d0={};var _0x40c35f;var _0x1bfe03;return db['DeskConfiguration'][_0x5279('0x53')]({'where':{'id':_0x38a917[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12d5bd,null))[_0x5279('0x30')](function(_0x3e40e7){if(_0x3e40e7){_0x40c35f=_0x3e40e7;_0xb586d0['model']=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0xb586d0['query']=_[_0x5279('0x39')](_0x38a917[_0x5279('0x38')]);_0xb586d0[_0x5279('0x3a')]=_['intersection'](_0xb586d0[_0x5279('0x3b')],_0xb586d0['query']);_0x523648[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0xb586d0['model'],qs[_0x5279('0x4e')](_0x38a917[_0x5279('0x38')][_0x5279('0x4e')]));_0x523648[_0x5279('0x3c')]=_0x523648[_0x5279('0x3c')][_0x5279('0x3e')]?_0x523648['attributes']:_0xb586d0[_0x5279('0x3b')];_0x523648[_0x5279('0x55')]=qs[_0x5279('0x41')](_0x38a917[_0x5279('0x38')][_0x5279('0x41')]);_0x523648[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x38a917['query'],_0xb586d0[_0x5279('0x3a')]));if(_0x38a917['query'][_0x5279('0x42')]){_0x523648['where']=_[_0x5279('0x44')](_0x523648[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x523648[_0x5279('0x3c')],function(_0x1d7f95){var _0x3af716={};_0x3af716[_0x1d7f95]={'$like':'%'+_0x38a917[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x3af716;})});}_0x523648=_[_0x5279('0x44')]({},_0x523648,_0x38a917[_0x5279('0x46')]);return _0x40c35f[_0x5279('0x58')](_0x523648);}})[_0x5279('0x30')](function(_0x146dae){if(_0x146dae){_0x1bfe03=_0x146dae['length'];if(!_0x38a917[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x523648[_0x5279('0x29')]=qs['limit'](_0x38a917[_0x5279('0x38')][_0x5279('0x29')]);_0x523648[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x38a917[_0x5279('0x38')]['offset']);}return _0x40c35f[_0x5279('0x58')](_0x523648);}})[_0x5279('0x30')](function(_0x3d7621){if(_0x3d7621){return _0x3d7621?{'count':_0x1bfe03,'rows':_0x3d7621}:null;}})['then'](respondWithResult(_0x12d5bd,null))[_0x5279('0x23')](handleError(_0x12d5bd,null));};exports[_0x5279('0x59')]=function(_0x10310c,_0x54e286,_0x2a81b9){var _0x438790={};var _0x496dd9={};var _0x134e2d;var _0x5a5025;return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x10310c[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x54e286,null))[_0x5279('0x30')](function(_0x2c7e9e){if(_0x2c7e9e){_0x134e2d=_0x2c7e9e;_0x496dd9[_0x5279('0x3b')]=_[_0x5279('0x39')](db[_0x5279('0x54')][_0x5279('0x4d')]);_0x496dd9[_0x5279('0x38')]=_[_0x5279('0x39')](_0x10310c[_0x5279('0x38')]);_0x496dd9[_0x5279('0x3a')]=_['intersection'](_0x496dd9['model'],_0x496dd9[_0x5279('0x38')]);_0x438790[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0x496dd9[_0x5279('0x3b')],qs[_0x5279('0x4e')](_0x10310c[_0x5279('0x38')][_0x5279('0x4e')]));_0x438790['attributes']=_0x438790[_0x5279('0x3c')][_0x5279('0x3e')]?_0x438790[_0x5279('0x3c')]:_0x496dd9[_0x5279('0x3b')];_0x438790['order']=qs[_0x5279('0x41')](_0x10310c[_0x5279('0x38')][_0x5279('0x41')]);_0x438790[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x10310c['query'],_0x496dd9[_0x5279('0x3a')]));if(_0x10310c[_0x5279('0x38')][_0x5279('0x42')]){_0x438790[_0x5279('0x43')]=_['merge'](_0x438790[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x438790[_0x5279('0x3c')],function(_0x3b3df4){var _0x5eb23a={};_0x5eb23a[_0x3b3df4]={'$like':'%'+_0x10310c['query'][_0x5279('0x42')]+'%'};return _0x5eb23a;})});}_0x438790=_[_0x5279('0x44')]({},_0x438790,_0x10310c[_0x5279('0x46')]);return _0x134e2d[_0x5279('0x59')](_0x438790);}})[_0x5279('0x30')](function(_0x3f059b){if(_0x3f059b){_0x5a5025=_0x3f059b['length'];if(!_0x10310c[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x438790['limit']=qs[_0x5279('0x29')](_0x10310c[_0x5279('0x38')][_0x5279('0x29')]);_0x438790['offset']=qs[_0x5279('0x28')](_0x10310c['query'][_0x5279('0x28')]);}return _0x134e2d['getDescriptions'](_0x438790);}})[_0x5279('0x30')](function(_0x1ba197){if(_0x1ba197){return _0x1ba197?{'count':_0x5a5025,'rows':_0x1ba197}:null;}})[_0x5279('0x30')](respondWithResult(_0x54e286,null))[_0x5279('0x23')](handleError(_0x54e286,null));};exports[_0x5279('0x5a')]=function(_0x5d2738,_0x287afd,_0x4f50b2){var _0x413c3d={};var _0xf16bbc={};var _0x26ac27;var _0x1868b3;return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x5d2738['params']['id']}})['then'](handleEntityNotFound(_0x287afd,null))[_0x5279('0x30')](function(_0x3147ee){if(_0x3147ee){_0x26ac27=_0x3147ee;_0xf16bbc[_0x5279('0x3b')]=_['keys'](db[_0x5279('0x5b')][_0x5279('0x4d')]);_0xf16bbc[_0x5279('0x38')]=_[_0x5279('0x39')](_0x5d2738[_0x5279('0x38')]);_0xf16bbc[_0x5279('0x3a')]=_[_0x5279('0x3d')](_0xf16bbc['model'],_0xf16bbc[_0x5279('0x38')]);_0x413c3d[_0x5279('0x3c')]=_[_0x5279('0x3d')](_0xf16bbc[_0x5279('0x3b')],qs[_0x5279('0x4e')](_0x5d2738['query'][_0x5279('0x4e')]));_0x413c3d[_0x5279('0x3c')]=_0x413c3d[_0x5279('0x3c')]['length']?_0x413c3d[_0x5279('0x3c')]:_0xf16bbc[_0x5279('0x3b')];_0x413c3d[_0x5279('0x55')]=qs['sort'](_0x5d2738[_0x5279('0x38')][_0x5279('0x41')]);_0x413c3d[_0x5279('0x43')]=qs[_0x5279('0x3a')](_[_0x5279('0x56')](_0x5d2738[_0x5279('0x38')],_0xf16bbc[_0x5279('0x3a')]));if(_0x5d2738[_0x5279('0x38')][_0x5279('0x42')]){_0x413c3d['where']=_['merge'](_0x413c3d[_0x5279('0x43')],{'$or':_[_0x5279('0x37')](_0x413c3d[_0x5279('0x3c')],function(_0x195f5a){var _0x501c1e={};_0x501c1e[_0x195f5a]={'$like':'%'+_0x5d2738[_0x5279('0x38')][_0x5279('0x42')]+'%'};return _0x501c1e;})});}_0x413c3d=_['merge']({},_0x413c3d,_0x5d2738[_0x5279('0x46')]);return _0x26ac27[_0x5279('0x5a')](_0x413c3d);}})[_0x5279('0x30')](function(_0x1f52b7){if(_0x1f52b7){_0x1868b3=_0x1f52b7[_0x5279('0x3e')];if(!_0x5d2738[_0x5279('0x38')][_0x5279('0x3f')](_0x5279('0x40'))){_0x413c3d[_0x5279('0x29')]=qs[_0x5279('0x29')](_0x5d2738[_0x5279('0x38')][_0x5279('0x29')]);_0x413c3d[_0x5279('0x28')]=qs[_0x5279('0x28')](_0x5d2738[_0x5279('0x38')][_0x5279('0x28')]);}return _0x26ac27['getTags'](_0x413c3d);}})[_0x5279('0x30')](function(_0x36cd03){if(_0x36cd03){return _0x36cd03?{'count':_0x1868b3,'rows':_0x36cd03}:null;}})[_0x5279('0x30')](respondWithResult(_0x287afd,null))[_0x5279('0x23')](handleError(_0x287afd,null));};exports[_0x5279('0x5c')]=function(_0x98d960,_0x4c3183,_0xa48ec9){if(_0x98d960[_0x5279('0x52')]['id']){delete _0x98d960[_0x5279('0x52')]['id'];}return db[_0x5279('0x34')][_0x5279('0x53')]({'where':{'id':_0x98d960[_0x5279('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c3183,null))[_0x5279('0x30')](function(_0x3f577d){if(_0x3f577d){return _0x3f577d[_0x5279('0x5c')](_0x98d960[_0x5279('0x52')][_0x5279('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x4c3183,null))['catch'](handleError(_0x4c3183,null));}; \ No newline at end of file +var _0x2928=['getSubjects','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','end','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getFields','DeskField','order','pick'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2928,0xc0));var _0x8292=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x2928[_0x381379];return _0x3e1063;};'use strict';var pdf=require(_0x8292('0x0'));var emlformat=require(_0x8292('0x1'));var rimraf=require(_0x8292('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8292('0x3'));var rp=require('request-promise');var moment=require(_0x8292('0x4'));var BPromise=require(_0x8292('0x5'));var Mustache=require(_0x8292('0x6'));var util=require(_0x8292('0x7'));var path=require(_0x8292('0x8'));var sox=require(_0x8292('0x9'));var csv=require(_0x8292('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8292('0xb'));var squel=require('squel');var crypto=require(_0x8292('0xc'));var jsforce=require(_0x8292('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8292('0xa'));var querystring=require(_0x8292('0xe'));var Papa=require('papaparse');var Redis=require(_0x8292('0xf'));var authService=require(_0x8292('0x10'));var qs=require(_0x8292('0x11'));var as=require(_0x8292('0x12'));var hardwareService=require(_0x8292('0x13'));var logger=require('../../config/logger')(_0x8292('0x14'));var utils=require(_0x8292('0x15'));var config=require(_0x8292('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8292('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1c6d88,_0x3fa99a,_0x1b8f2c,_0x301901){return new BPromise(function(_0x3a09af,_0x507212){var _0x448847=_0x301901||client;return _0x448847[_0x8292('0x18')](_0x1c6d88,_0x1b8f2c)[_0x8292('0x19')](function(_0x16cc82){logger[_0x8292('0x1a')](_0x8292('0x1b'),_0x3fa99a,_0x8292('0x1c'));logger[_0x8292('0x1d')](_0x8292('0x1e'),_0x3fa99a,'request\x20sent',JSON[_0x8292('0x1f')](_0x16cc82));if(_0x16cc82['error']){if(_0x16cc82[_0x8292('0x20')][_0x8292('0x21')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);return _0x507212(_0x16cc82['error'][_0x8292('0x22')]);}logger[_0x8292('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);return _0x3a09af(_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,'request\x20sent');_0x3a09af(_0x16cc82[_0x8292('0x23')][_0x8292('0x22')]);}})['catch'](function(_0x2d15e9){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x2d15e9);_0x507212(_0x2d15e9);});});}function respondWithStatusCode(_0x245a75,_0x3bd596){_0x3bd596=_0x3bd596||0xcc;return function(_0x2e7a85){if(_0x2e7a85){return _0x245a75[_0x8292('0x24')](_0x3bd596);}return _0x245a75['status'](_0x3bd596)['end']();};}function respondWithResult(_0x1a2b5b,_0x55e639){_0x55e639=_0x55e639||0xc8;return function(_0x13df76){if(_0x13df76){return _0x1a2b5b[_0x8292('0x25')](_0x55e639)[_0x8292('0x26')](_0x13df76);}};}function respondWithFilteredResult(_0x4d0e85,_0x5b0fbf){return function(_0x178d1a){if(_0x178d1a){var _0xc16c99=_0x178d1a[_0x8292('0x27')],_0x233c62=_0x5b0fbf[_0x8292('0x28')],_0x54e9fe=_0x5b0fbf[_0x8292('0x28')]+_0x5b0fbf['limit'],_0x59a892;if(_0x54e9fe>=_0xc16c99){_0x54e9fe=_0xc16c99;_0x59a892=0xc8;}else{_0x59a892=0xce;}_0x4d0e85[_0x8292('0x25')](_0x59a892);return _0x4d0e85[_0x8292('0x29')](_0x8292('0x2a'),_0x233c62+'-'+_0x54e9fe+'/'+_0xc16c99)[_0x8292('0x26')](_0x178d1a);}return null;};}function patchUpdates(_0x1cabf3){return function(_0x2812bc){try{jsonpatch[_0x8292('0x2b')](_0x2812bc,_0x1cabf3,!![]);}catch(_0x1d5306){return BPromise[_0x8292('0x2c')](_0x1d5306);}return _0x2812bc[_0x8292('0x2d')]();};}function saveUpdates(_0x49d4b2,_0x46ffb1){return function(_0x17ab60){if(_0x17ab60){return _0x17ab60['update'](_0x49d4b2)[_0x8292('0x19')](function(_0x1cb8d3){return _0x1cb8d3;});}return null;};}function removeEntity(_0x355ab1,_0x581585){return function(_0x3d5ca9){if(_0x3d5ca9){return _0x3d5ca9[_0x8292('0x2e')]()[_0x8292('0x19')](function(){_0x355ab1[_0x8292('0x25')](0xcc)[_0x8292('0x2f')]();});}};}function handleEntityNotFound(_0x1b3803,_0x360450){return function(_0x304cb1){if(!_0x304cb1){_0x1b3803[_0x8292('0x24')](0x194);}return _0x304cb1;};}function handleError(_0x3546c3,_0x2e53ec){_0x2e53ec=_0x2e53ec||0x1f4;return function(_0x5d5e40){logger[_0x8292('0x20')](_0x5d5e40['stack']);if(_0x5d5e40[_0x8292('0x30')]){delete _0x5d5e40[_0x8292('0x30')];}_0x3546c3[_0x8292('0x25')](_0x2e53ec)[_0x8292('0x31')](_0x5d5e40);};}exports['index']=function(_0x2e9cd6,_0x518bf0){var _0x3befda={},_0x338024={},_0xe0b67e={'count':0x0,'rows':[]};var _0x277547=_['map'](db[_0x8292('0x32')][_0x8292('0x33')],function(_0x21c1da){return{'name':_0x21c1da[_0x8292('0x34')],'type':_0x21c1da[_0x8292('0x35')][_0x8292('0x36')]};});_0x338024[_0x8292('0x37')]=_[_0x8292('0x38')](_0x277547,_0x8292('0x30'));_0x338024[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x2e9cd6[_0x8292('0x39')]);_0x338024[_0x8292('0x3b')]=_['intersection'](_0x338024[_0x8292('0x37')],_0x338024[_0x8292('0x39')]);_0x3befda[_0x8292('0x3c')]=_[_0x8292('0x3d')](_0x338024[_0x8292('0x37')],qs[_0x8292('0x3e')](_0x2e9cd6[_0x8292('0x39')][_0x8292('0x3e')]));_0x3befda['attributes']=_0x3befda[_0x8292('0x3c')][_0x8292('0x3f')]?_0x3befda[_0x8292('0x3c')]:_0x338024[_0x8292('0x37')];if(!_0x2e9cd6[_0x8292('0x39')][_0x8292('0x40')](_0x8292('0x41'))){_0x3befda['limit']=qs[_0x8292('0x42')](_0x2e9cd6['query'][_0x8292('0x42')]);_0x3befda[_0x8292('0x28')]=qs[_0x8292('0x28')](_0x2e9cd6[_0x8292('0x39')][_0x8292('0x28')]);}_0x3befda['order']=qs['sort'](_0x2e9cd6['query'][_0x8292('0x43')]);_0x3befda[_0x8292('0x44')]=qs[_0x8292('0x3b')](_['pick'](_0x2e9cd6['query'],_0x338024['filters']),_0x277547);if(_0x2e9cd6[_0x8292('0x39')][_0x8292('0x45')]){_0x3befda[_0x8292('0x44')]=_[_0x8292('0x46')](_0x3befda[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x277547,function(_0x57f8da){if(_0x57f8da['type']!==_0x8292('0x47')){var _0x264c28={};_0x264c28[_0x57f8da['name']]={'$like':'%'+_0x2e9cd6['query']['filter']+'%'};return _0x264c28;}})});}_0x3befda=_[_0x8292('0x46')]({},_0x3befda,_0x2e9cd6['options']);var _0x38e8f3={'where':_0x3befda['where']};return db['DeskConfiguration'][_0x8292('0x27')](_0x38e8f3)[_0x8292('0x19')](function(_0x50fd06){_0xe0b67e[_0x8292('0x27')]=_0x50fd06;if(_0x2e9cd6[_0x8292('0x39')][_0x8292('0x48')]){_0x3befda[_0x8292('0x49')]=[{'all':!![]}];}return db[_0x8292('0x32')][_0x8292('0x4a')](_0x3befda);})['then'](function(_0x36a6d1){_0xe0b67e['rows']=_0x36a6d1;return _0xe0b67e;})[_0x8292('0x19')](respondWithFilteredResult(_0x518bf0,_0x3befda))[_0x8292('0x4b')](handleError(_0x518bf0,null));};exports[_0x8292('0x4c')]=function(_0x55041c,_0xc5f635){var _0x37167e={'raw':![],'where':{'id':_0x55041c[_0x8292('0x4d')]['id']}},_0xbd8b7d={};_0xbd8b7d[_0x8292('0x37')]=_['keys'](db[_0x8292('0x32')]['rawAttributes']);_0xbd8b7d[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x55041c[_0x8292('0x39')]);_0xbd8b7d[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0xbd8b7d[_0x8292('0x37')],_0xbd8b7d['query']);_0x37167e[_0x8292('0x3c')]=_[_0x8292('0x3d')](_0xbd8b7d[_0x8292('0x37')],qs['fields'](_0x55041c[_0x8292('0x39')]['fields']));_0x37167e[_0x8292('0x3c')]=_0x37167e['attributes'][_0x8292('0x3f')]?_0x37167e[_0x8292('0x3c')]:_0xbd8b7d[_0x8292('0x37')];if(_0x55041c[_0x8292('0x39')][_0x8292('0x48')]){_0x37167e[_0x8292('0x49')]=[{'all':!![]}];}_0x37167e=_[_0x8292('0x46')]({},_0x37167e,_0x55041c[_0x8292('0x4e')]);return db['DeskConfiguration'][_0x8292('0x4f')](_0x37167e)[_0x8292('0x19')](handleEntityNotFound(_0xc5f635,null))[_0x8292('0x19')](respondWithResult(_0xc5f635,null))['catch'](handleError(_0xc5f635,null));};exports['create']=function(_0x4858b5,_0x13653f){return db['DeskConfiguration'][_0x8292('0x50')](_0x4858b5[_0x8292('0x51')],{})[_0x8292('0x19')](respondWithResult(_0x13653f,0xc9))[_0x8292('0x4b')](handleError(_0x13653f,null));};exports[_0x8292('0x52')]=function(_0x2dc111,_0x513877){if(_0x2dc111[_0x8292('0x51')]['id']){delete _0x2dc111[_0x8292('0x51')]['id'];}return db['DeskConfiguration'][_0x8292('0x4f')]({'where':{'id':_0x2dc111[_0x8292('0x4d')]['id']}})['then'](handleEntityNotFound(_0x513877,null))['then'](saveUpdates(_0x2dc111['body'],null))[_0x8292('0x19')](respondWithResult(_0x513877,null))[_0x8292('0x4b')](handleError(_0x513877,null));};exports['destroy']=function(_0x2ae781,_0x25b6d1){return db[_0x8292('0x32')][_0x8292('0x4f')]({'where':{'id':_0x2ae781[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x25b6d1,null))[_0x8292('0x19')](removeEntity(_0x25b6d1,null))[_0x8292('0x4b')](handleError(_0x25b6d1,null));};exports[_0x8292('0x53')]=function(_0x1db158,_0x7701e7,_0x2df0a6){var _0x529157={};var _0x4b32d5={};var _0x590185;var _0x3030ec;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1db158[_0x8292('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7701e7,null))['then'](function(_0x3158bc){if(_0x3158bc){_0x590185=_0x3158bc;_0x4b32d5['model']=_[_0x8292('0x3a')](db[_0x8292('0x54')][_0x8292('0x33')]);_0x4b32d5[_0x8292('0x39')]=_['keys'](_0x1db158['query']);_0x4b32d5[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x4b32d5[_0x8292('0x37')],_0x4b32d5[_0x8292('0x39')]);_0x529157['attributes']=_[_0x8292('0x3d')](_0x4b32d5[_0x8292('0x37')],qs['fields'](_0x1db158[_0x8292('0x39')][_0x8292('0x3e')]));_0x529157[_0x8292('0x3c')]=_0x529157['attributes'][_0x8292('0x3f')]?_0x529157[_0x8292('0x3c')]:_0x4b32d5[_0x8292('0x37')];_0x529157[_0x8292('0x55')]=qs[_0x8292('0x43')](_0x1db158[_0x8292('0x39')][_0x8292('0x43')]);_0x529157[_0x8292('0x44')]=qs['filters'](_[_0x8292('0x56')](_0x1db158[_0x8292('0x39')],_0x4b32d5['filters']));if(_0x1db158[_0x8292('0x39')]['filter']){_0x529157[_0x8292('0x44')]=_[_0x8292('0x46')](_0x529157[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x529157[_0x8292('0x3c')],function(_0x2694b7){var _0x432d1e={};_0x432d1e[_0x2694b7]={'$like':'%'+_0x1db158['query'][_0x8292('0x45')]+'%'};return _0x432d1e;})});}_0x529157=_[_0x8292('0x46')]({},_0x529157,_0x1db158[_0x8292('0x4e')]);return _0x590185[_0x8292('0x53')](_0x529157);}})[_0x8292('0x19')](function(_0x2e1c42){if(_0x2e1c42){_0x3030ec=_0x2e1c42[_0x8292('0x3f')];if(!_0x1db158['query'][_0x8292('0x40')]('nolimit')){_0x529157['limit']=qs['limit'](_0x1db158[_0x8292('0x39')]['limit']);_0x529157['offset']=qs[_0x8292('0x28')](_0x1db158[_0x8292('0x39')][_0x8292('0x28')]);}return _0x590185[_0x8292('0x53')](_0x529157);}})['then'](function(_0x4ca64e){if(_0x4ca64e){return _0x4ca64e?{'count':_0x3030ec,'rows':_0x4ca64e}:null;}})[_0x8292('0x19')](respondWithResult(_0x7701e7,null))[_0x8292('0x4b')](handleError(_0x7701e7,null));};exports[_0x8292('0x57')]=function(_0x1664c3,_0x5a999c,_0x3a59e1){var _0x1eee9b={};var _0x310cd7={};var _0x311e78;var _0x288a4f;return db[_0x8292('0x32')]['findOne']({'where':{'id':_0x1664c3['params']['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x5a999c,null))[_0x8292('0x19')](function(_0x2b3176){if(_0x2b3176){_0x311e78=_0x2b3176;_0x310cd7['model']=_[_0x8292('0x3a')](db['DeskField']['rawAttributes']);_0x310cd7['query']=_['keys'](_0x1664c3['query']);_0x310cd7['filters']=_[_0x8292('0x3d')](_0x310cd7[_0x8292('0x37')],_0x310cd7[_0x8292('0x39')]);_0x1eee9b['attributes']=_[_0x8292('0x3d')](_0x310cd7[_0x8292('0x37')],qs['fields'](_0x1664c3[_0x8292('0x39')]['fields']));_0x1eee9b[_0x8292('0x3c')]=_0x1eee9b[_0x8292('0x3c')]['length']?_0x1eee9b[_0x8292('0x3c')]:_0x310cd7['model'];_0x1eee9b['order']=qs[_0x8292('0x43')](_0x1664c3[_0x8292('0x39')][_0x8292('0x43')]);_0x1eee9b[_0x8292('0x44')]=qs[_0x8292('0x3b')](_[_0x8292('0x56')](_0x1664c3[_0x8292('0x39')],_0x310cd7[_0x8292('0x3b')]));if(_0x1664c3[_0x8292('0x39')]['filter']){_0x1eee9b[_0x8292('0x44')]=_[_0x8292('0x46')](_0x1eee9b[_0x8292('0x44')],{'$or':_['map'](_0x1eee9b[_0x8292('0x3c')],function(_0x74e129){var _0x1f12c3={};_0x1f12c3[_0x74e129]={'$like':'%'+_0x1664c3[_0x8292('0x39')]['filter']+'%'};return _0x1f12c3;})});}_0x1eee9b=_[_0x8292('0x46')]({},_0x1eee9b,_0x1664c3[_0x8292('0x4e')]);return _0x311e78[_0x8292('0x57')](_0x1eee9b);}})[_0x8292('0x19')](function(_0x32347a){if(_0x32347a){_0x288a4f=_0x32347a[_0x8292('0x3f')];if(!_0x1664c3[_0x8292('0x39')][_0x8292('0x40')]('nolimit')){_0x1eee9b[_0x8292('0x42')]=qs[_0x8292('0x42')](_0x1664c3['query']['limit']);_0x1eee9b['offset']=qs['offset'](_0x1664c3[_0x8292('0x39')][_0x8292('0x28')]);}return _0x311e78[_0x8292('0x57')](_0x1eee9b);}})[_0x8292('0x19')](function(_0x403e55){if(_0x403e55){return _0x403e55?{'count':_0x288a4f,'rows':_0x403e55}:null;}})[_0x8292('0x19')](respondWithResult(_0x5a999c,null))[_0x8292('0x4b')](handleError(_0x5a999c,null));};exports[_0x8292('0x58')]=function(_0x93b5ed,_0x25c8c5,_0x42733f){var _0x30e457={};var _0x435f5c={};var _0x3dcf7a;var _0x58d393;return db[_0x8292('0x32')][_0x8292('0x59')]({'where':{'id':_0x93b5ed[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x25c8c5,null))[_0x8292('0x19')](function(_0x2aa5ce){if(_0x2aa5ce){_0x3dcf7a=_0x2aa5ce;_0x435f5c[_0x8292('0x37')]=_[_0x8292('0x3a')](db[_0x8292('0x54')]['rawAttributes']);_0x435f5c[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x93b5ed[_0x8292('0x39')]);_0x435f5c[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x435f5c[_0x8292('0x37')],_0x435f5c[_0x8292('0x39')]);_0x30e457['attributes']=_['intersection'](_0x435f5c['model'],qs['fields'](_0x93b5ed['query'][_0x8292('0x3e')]));_0x30e457[_0x8292('0x3c')]=_0x30e457['attributes']['length']?_0x30e457['attributes']:_0x435f5c['model'];_0x30e457['order']=qs[_0x8292('0x43')](_0x93b5ed['query'][_0x8292('0x43')]);_0x30e457['where']=qs[_0x8292('0x3b')](_[_0x8292('0x56')](_0x93b5ed[_0x8292('0x39')],_0x435f5c[_0x8292('0x3b')]));if(_0x93b5ed[_0x8292('0x39')][_0x8292('0x45')]){_0x30e457['where']=_['merge'](_0x30e457[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x30e457[_0x8292('0x3c')],function(_0x4cac2f){var _0x35871f={};_0x35871f[_0x4cac2f]={'$like':'%'+_0x93b5ed[_0x8292('0x39')][_0x8292('0x45')]+'%'};return _0x35871f;})});}_0x30e457=_[_0x8292('0x46')]({},_0x30e457,_0x93b5ed[_0x8292('0x4e')]);return _0x3dcf7a['getDescriptions'](_0x30e457);}})[_0x8292('0x19')](function(_0x211672){if(_0x211672){_0x58d393=_0x211672[_0x8292('0x3f')];if(!_0x93b5ed['query'][_0x8292('0x40')](_0x8292('0x41'))){_0x30e457[_0x8292('0x42')]=qs[_0x8292('0x42')](_0x93b5ed[_0x8292('0x39')]['limit']);_0x30e457[_0x8292('0x28')]=qs[_0x8292('0x28')](_0x93b5ed[_0x8292('0x39')][_0x8292('0x28')]);}return _0x3dcf7a[_0x8292('0x58')](_0x30e457);}})['then'](function(_0x1ff309){if(_0x1ff309){return _0x1ff309?{'count':_0x58d393,'rows':_0x1ff309}:null;}})[_0x8292('0x19')](respondWithResult(_0x25c8c5,null))[_0x8292('0x4b')](handleError(_0x25c8c5,null));};exports['getTags']=function(_0x343b89,_0x34f9d6,_0x7646ff){var _0x32ed13={};var _0x376151={};var _0x4d1f6d;var _0x4c7220;return db[_0x8292('0x32')][_0x8292('0x59')]({'where':{'id':_0x343b89[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x34f9d6,null))[_0x8292('0x19')](function(_0x2762b7){if(_0x2762b7){_0x4d1f6d=_0x2762b7;_0x376151[_0x8292('0x37')]=_[_0x8292('0x3a')](db['Tag'][_0x8292('0x33')]);_0x376151['query']=_['keys'](_0x343b89['query']);_0x376151[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x376151[_0x8292('0x37')],_0x376151[_0x8292('0x39')]);_0x32ed13[_0x8292('0x3c')]=_['intersection'](_0x376151[_0x8292('0x37')],qs['fields'](_0x343b89['query'][_0x8292('0x3e')]));_0x32ed13[_0x8292('0x3c')]=_0x32ed13[_0x8292('0x3c')][_0x8292('0x3f')]?_0x32ed13[_0x8292('0x3c')]:_0x376151['model'];_0x32ed13[_0x8292('0x55')]=qs['sort'](_0x343b89[_0x8292('0x39')][_0x8292('0x43')]);_0x32ed13['where']=qs[_0x8292('0x3b')](_['pick'](_0x343b89[_0x8292('0x39')],_0x376151[_0x8292('0x3b')]));if(_0x343b89['query'][_0x8292('0x45')]){_0x32ed13[_0x8292('0x44')]=_[_0x8292('0x46')](_0x32ed13[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x32ed13['attributes'],function(_0x351a7){var _0xfc4d95={};_0xfc4d95[_0x351a7]={'$like':'%'+_0x343b89[_0x8292('0x39')][_0x8292('0x45')]+'%'};return _0xfc4d95;})});}_0x32ed13=_[_0x8292('0x46')]({},_0x32ed13,_0x343b89[_0x8292('0x4e')]);return _0x4d1f6d['getTags'](_0x32ed13);}})[_0x8292('0x19')](function(_0x11b0ad){if(_0x11b0ad){_0x4c7220=_0x11b0ad[_0x8292('0x3f')];if(!_0x343b89[_0x8292('0x39')]['hasOwnProperty']('nolimit')){_0x32ed13['limit']=qs[_0x8292('0x42')](_0x343b89[_0x8292('0x39')]['limit']);_0x32ed13['offset']=qs[_0x8292('0x28')](_0x343b89[_0x8292('0x39')][_0x8292('0x28')]);}return _0x4d1f6d[_0x8292('0x5a')](_0x32ed13);}})['then'](function(_0x5308f5){if(_0x5308f5){return _0x5308f5?{'count':_0x4c7220,'rows':_0x5308f5}:null;}})['then'](respondWithResult(_0x34f9d6,null))[_0x8292('0x4b')](handleError(_0x34f9d6,null));};exports[_0x8292('0x5b')]=function(_0x5076a7,_0x45deb8,_0x3f7f9c){if(_0x5076a7[_0x8292('0x51')]['id']){delete _0x5076a7[_0x8292('0x51')]['id'];}return db['DeskConfiguration'][_0x8292('0x59')]({'where':{'id':_0x5076a7[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x45deb8,null))[_0x8292('0x19')](function(_0x29563c){if(_0x29563c){return _0x29563c[_0x8292('0x5b')](_0x5076a7['body'][_0x8292('0x5c')]||[]);}return null;})[_0x8292('0x19')](respondWithResult(_0x45deb8,null))[_0x8292('0x4b')](handleError(_0x45deb8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 507aefb..bd6bb64 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 _0xb59d=['../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','api','bluebird','request-promise','path'];(function(_0x178f49,_0xd00f3a){var _0x5b3774=function(_0x7a08df){while(--_0x7a08df){_0x178f49['push'](_0x178f49['shift']());}};_0x5b3774(++_0xd00f3a);}(_0xb59d,0xf7));var _0xdb59=function(_0x3bf5e0,_0xaabb7e){_0x3bf5e0=_0x3bf5e0-0x0;var _0x172a49=_0xb59d[_0x3bf5e0];return _0x172a49;};'use strict';var _=require(_0xdb59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb59('0x1'));var moment=require('moment');var BPromise=require(_0xdb59('0x2'));var rp=require(_0xdb59('0x3'));var fs=require('fs');var path=require(_0xdb59('0x4'));var rimraf=require('rimraf');var config=require(_0xdb59('0x5'));var attributes=require(_0xdb59('0x6'));module['exports']=function(_0x12ca70,_0x4692f0){return _0x12ca70[_0xdb59('0x7')]('DeskConfiguration',attributes,{'tableName':_0xdb59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf54b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x566881,_0x4a2806){var _0x3b9b23=function(_0x53f7d3){while(--_0x53f7d3){_0x566881['push'](_0x566881['shift']());}};_0x3b9b23(++_0x4a2806);}(_0xf54b,0x69));var _0xbf54=function(_0x4072d0,_0x2c84bd){_0x4072d0=_0x4072d0-0x0;var _0x2fc971=_0xf54b[_0x4072d0];return _0x2fc971;};'use strict';var _=require(_0xbf54('0x0'));var util=require(_0xbf54('0x1'));var logger=require(_0xbf54('0x2'))(_0xbf54('0x3'));var moment=require(_0xbf54('0x4'));var BPromise=require(_0xbf54('0x5'));var rp=require(_0xbf54('0x6'));var fs=require('fs');var path=require(_0xbf54('0x7'));var rimraf=require(_0xbf54('0x8'));var config=require(_0xbf54('0x9'));var attributes=require(_0xbf54('0xa'));module[_0xbf54('0xb')]=function(_0x2ec5d2,_0x120176){return _0x2ec5d2[_0xbf54('0xc')](_0xbf54('0xd'),attributes,{'tableName':_0xbf54('0xe'),'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 11eb0bc..50ffff4 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 _0x23a8=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x32577b,_0x549bd7){var _0x358c74=function(_0xdb7346){while(--_0xdb7346){_0x32577b['push'](_0x32577b['shift']());}};_0x358c74(++_0x549bd7);}(_0x23a8,0x172));var _0x823a=function(_0xaeefa0,_0x4c9543){_0xaeefa0=_0xaeefa0-0x0;var _0x1f5c8f=_0x23a8[_0xaeefa0];return _0x1f5c8f;};'use strict';var _=require('lodash');var util=require(_0x823a('0x0'));var moment=require('moment');var BPromise=require(_0x823a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x823a('0x2'));var db=require(_0x823a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x823a('0x4'))('rpc');var config=require(_0x823a('0x5'));var jayson=require(_0x823a('0x6'));var client=jayson[_0x823a('0x7')][_0x823a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dca10,_0x472eb5,_0x3f35db){return new BPromise(function(_0x59866f,_0x42c0f2){return client[_0x823a('0x9')](_0x5dca10,_0x3f35db)['then'](function(_0x43ab90){logger[_0x823a('0xa')](_0x823a('0xb'),_0x472eb5,_0x823a('0xc'));logger['debug'](_0x823a('0xd'),_0x472eb5,_0x823a('0xc'),JSON[_0x823a('0xe')](_0x43ab90));if(_0x43ab90[_0x823a('0xf')]){if(_0x43ab90[_0x823a('0xf')][_0x823a('0x10')]===0x1f4){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error'][_0x823a('0x11')]);return _0x42c0f2(_0x43ab90['error'][_0x823a('0x11')]);}logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x43ab90['error']['message']);return _0x59866f(_0x43ab90[_0x823a('0xf')][_0x823a('0x11')]);}else{logger[_0x823a('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x472eb5,'request\x20sent');_0x59866f(_0x43ab90['result'][_0x823a('0x11')]);}})[_0x823a('0x12')](function(_0x41f41d){logger[_0x823a('0xf')](_0x823a('0xb'),_0x472eb5,_0x41f41d);_0x42c0f2(_0x41f41d);});});} \ 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(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x30fe,0x149));var _0xe30f=function(_0x34c36e,_0x115f1e){_0x34c36e=_0x34c36e-0x0;var _0x4dc416=_0x30fe[_0x34c36e];return _0x4dc416;};'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 4c010b7..139f83e 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 _0x4b31=['/:id','post','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0x44511a,_0xda471b){var _0x49b274=function(_0x1e344b){while(--_0x1e344b){_0x44511a['push'](_0x44511a['shift']());}};_0x49b274(++_0xda471b);}(_0x4b31,0x1b9));var _0x14b3=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0x4b31[_0x4beb42];return _0x198c48;};'use strict';var multer=require(_0x14b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x14b3('0x1'));var express=require(_0x14b3('0x2'));var router=express[_0x14b3('0x3')]();var auth=require(_0x14b3('0x4'));var interaction=require(_0x14b3('0x5'));var config=require(_0x14b3('0x6'));var controller=require(_0x14b3('0x7'));router['get']('/',auth[_0x14b3('0x8')](),controller['index']);router['get'](_0x14b3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x14b3('0xa')]('/',auth[_0x14b3('0x8')](),controller['create']);router[_0x14b3('0xb')](_0x14b3('0x9'),auth['isAuthenticated'](),controller[_0x14b3('0xc')]);router[_0x14b3('0xd')](_0x14b3('0x9'),auth['isAuthenticated'](),controller[_0x14b3('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd020=['delete','destroy','exports','multer','util','Router','../../components/auth/service','./intDeskField.controller','isAuthenticated','get','/:id','post','put','update'];(function(_0x149ad4,_0x5d1f11){var _0x303371=function(_0x3bd7bd){while(--_0x3bd7bd){_0x149ad4['push'](_0x149ad4['shift']());}};_0x303371(++_0x5d1f11);}(_0xd020,0x1b5));var _0x0d02=function(_0x3e83f1,_0x1b09ae){_0x3e83f1=_0x3e83f1-0x0;var _0x28cd96=_0xd020[_0x3e83f1];return _0x28cd96;};'use strict';var multer=require(_0x0d02('0x0'));var util=require(_0x0d02('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d02('0x2')]();var auth=require(_0x0d02('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0d02('0x4'));router['get']('/',auth[_0x0d02('0x5')](),controller['index']);router[_0x0d02('0x6')](_0x0d02('0x7'),auth[_0x0d02('0x5')](),controller['show']);router[_0x0d02('0x8')]('/',auth[_0x0d02('0x5')](),controller['create']);router[_0x0d02('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0d02('0xa')]);router[_0x0d02('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0d02('0xc')]);module[_0x0d02('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0c79349..bee1967 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 _0x6448=['ENUM','string','variable','customVariable','STRING','exports'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x6448,0x113));var _0x8644=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6448[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8644('0x0')]={'type':{'type':Sequelize[_0x8644('0x1')](_0x8644('0x2'),_0x8644('0x3'),_0x8644('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8644('0x1')](_0x8644('0x2'),_0x8644('0x3'),_0x8644('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8644('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8644('0x5')]}}; \ No newline at end of file +var _0xe681=['customVariable','string','STRING','exports','ENUM','variable'];(function(_0x41fbe2,_0xfba88){var _0x3c79da=function(_0x4346e6){while(--_0x4346e6){_0x41fbe2['push'](_0x41fbe2['shift']());}};_0x3c79da(++_0xfba88);}(_0xe681,0x177));var _0x1e68=function(_0x1b33d1,_0x2965e2){_0x1b33d1=_0x1b33d1-0x0;var _0x368c8f=_0xe681[_0x1b33d1];return _0x368c8f;};'use strict';var Sequelize=require('sequelize');module[_0x1e68('0x0')]={'type':{'type':Sequelize[_0x1e68('0x1')]('string',_0x1e68('0x2'),_0x1e68('0x3'),'keyValue'),'defaultValue':_0x1e68('0x4')},'content':{'type':Sequelize[_0x1e68('0x5')]},'key':{'type':Sequelize[_0x1e68('0x5')]},'keyType':{'type':Sequelize[_0x1e68('0x1')]('string',_0x1e68('0x2'),_0x1e68('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1e68('0x5')]},'nameField':{'type':Sequelize[_0x1e68('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 08e6c21..8c960d8 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 _0x8ac8=['eml-format','rimraf','fast-json-patch','moment','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','DeskField','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','html-pdf'];(function(_0x5c8cc1,_0x76afd2){var _0x56ef17=function(_0x538d31){while(--_0x538d31){_0x5c8cc1['push'](_0x5c8cc1['shift']());}};_0x56ef17(++_0x76afd2);}(_0x8ac8,0x1c1));var _0x88ac=function(_0x3093dc,_0x285119){_0x3093dc=_0x3093dc-0x0;var _0x3bedcc=_0x8ac8[_0x3093dc];return _0x3bedcc;};'use strict';var pdf=require(_0x88ac('0x0'));var emlformat=require(_0x88ac('0x1'));var rimraf=require(_0x88ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88ac('0x3'));var rp=require('request-promise');var moment=require(_0x88ac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88ac('0x5'));var path=require(_0x88ac('0x6'));var sox=require(_0x88ac('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ac('0x8'));var squel=require(_0x88ac('0x9'));var crypto=require(_0x88ac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x88ac('0xb'));var toCsv=require('to-csv');var querystring=require(_0x88ac('0xc'));var Papa=require(_0x88ac('0xd'));var Redis=require(_0x88ac('0xe'));var authService=require(_0x88ac('0xf'));var qs=require(_0x88ac('0x10'));var as=require(_0x88ac('0x11'));var hardwareService=require(_0x88ac('0x12'));var logger=require(_0x88ac('0x13'))(_0x88ac('0x14'));var utils=require(_0x88ac('0x15'));var config=require(_0x88ac('0x16'));var licenseUtil=require(_0x88ac('0x17'));var db=require(_0x88ac('0x18'))['db'];function respondWithStatusCode(_0x37f291,_0x219576){_0x219576=_0x219576||0xcc;return function(_0x52aedd){if(_0x52aedd){return _0x37f291[_0x88ac('0x19')](_0x219576);}return _0x37f291[_0x88ac('0x1a')](_0x219576)['end']();};}function respondWithResult(_0x4b3fc5,_0x5d38d1){_0x5d38d1=_0x5d38d1||0xc8;return function(_0x3ec8e2){if(_0x3ec8e2){return _0x4b3fc5[_0x88ac('0x1a')](_0x5d38d1)['json'](_0x3ec8e2);}};}function respondWithFilteredResult(_0x55bdf8,_0x2594ac){return function(_0x511a75){if(_0x511a75){var _0x498db9=_0x511a75['count'],_0x45eb14=_0x2594ac[_0x88ac('0x1b')],_0xdfaf17=_0x2594ac[_0x88ac('0x1b')]+_0x2594ac[_0x88ac('0x1c')],_0x108d09;if(_0xdfaf17>=_0x498db9){_0xdfaf17=_0x498db9;_0x108d09=0xc8;}else{_0x108d09=0xce;}_0x55bdf8[_0x88ac('0x1a')](_0x108d09);return _0x55bdf8[_0x88ac('0x1d')]('Content-Range',_0x45eb14+'-'+_0xdfaf17+'/'+_0x498db9)[_0x88ac('0x1e')](_0x511a75);}return null;};}function patchUpdates(_0x12dcd4){return function(_0x246cce){try{jsonpatch[_0x88ac('0x1f')](_0x246cce,_0x12dcd4,!![]);}catch(_0x535e18){return BPromise[_0x88ac('0x20')](_0x535e18);}return _0x246cce['save']();};}function saveUpdates(_0x234c15,_0xa95eb2){return function(_0x5ccd08){if(_0x5ccd08){return _0x5ccd08[_0x88ac('0x21')](_0x234c15)['then'](function(_0x3e28e6){return _0x3e28e6;});}return null;};}function removeEntity(_0x392732,_0x86db9){return function(_0x122ca2){if(_0x122ca2){return _0x122ca2[_0x88ac('0x22')]()[_0x88ac('0x23')](function(){_0x392732[_0x88ac('0x1a')](0xcc)[_0x88ac('0x24')]();});}};}function handleEntityNotFound(_0x2c06f5,_0x5ed0){return function(_0x296e85){if(!_0x296e85){_0x2c06f5['sendStatus'](0x194);}return _0x296e85;};}function handleError(_0x4d4975,_0x5d0d65){_0x5d0d65=_0x5d0d65||0x1f4;return function(_0x3d4782){logger[_0x88ac('0x25')](_0x3d4782[_0x88ac('0x26')]);if(_0x3d4782[_0x88ac('0x27')]){delete _0x3d4782[_0x88ac('0x27')];}_0x4d4975['status'](_0x5d0d65)[_0x88ac('0x28')](_0x3d4782);};}exports[_0x88ac('0x29')]=function(_0x2cff9f,_0x4a780a){var _0x1ef8c7={},_0x1e29b6={},_0x223edf={'count':0x0,'rows':[]};var _0x523206=_[_0x88ac('0x2a')](db['DeskField']['rawAttributes'],function(_0x10d06f){return{'name':_0x10d06f[_0x88ac('0x2b')],'type':_0x10d06f[_0x88ac('0x2c')][_0x88ac('0x2d')]};});_0x1e29b6[_0x88ac('0x2e')]=_['map'](_0x523206,_0x88ac('0x27'));_0x1e29b6['query']=_[_0x88ac('0x2f')](_0x2cff9f[_0x88ac('0x30')]);_0x1e29b6['filters']=_['intersection'](_0x1e29b6[_0x88ac('0x2e')],_0x1e29b6['query']);_0x1ef8c7[_0x88ac('0x31')]=_[_0x88ac('0x32')](_0x1e29b6[_0x88ac('0x2e')],qs[_0x88ac('0x33')](_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x33')]));_0x1ef8c7[_0x88ac('0x31')]=_0x1ef8c7[_0x88ac('0x31')][_0x88ac('0x34')]?_0x1ef8c7[_0x88ac('0x31')]:_0x1e29b6[_0x88ac('0x2e')];if(!_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x35')](_0x88ac('0x36'))){_0x1ef8c7[_0x88ac('0x1c')]=qs[_0x88ac('0x1c')](_0x2cff9f[_0x88ac('0x30')]['limit']);_0x1ef8c7[_0x88ac('0x1b')]=qs[_0x88ac('0x1b')](_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x1b')]);}_0x1ef8c7[_0x88ac('0x37')]=qs[_0x88ac('0x38')](_0x2cff9f['query']['sort']);_0x1ef8c7[_0x88ac('0x39')]=qs[_0x88ac('0x3a')](_[_0x88ac('0x3b')](_0x2cff9f[_0x88ac('0x30')],_0x1e29b6[_0x88ac('0x3a')]),_0x523206);if(_0x2cff9f['query'][_0x88ac('0x3c')]){_0x1ef8c7['where']=_[_0x88ac('0x3d')](_0x1ef8c7[_0x88ac('0x39')],{'$or':_[_0x88ac('0x2a')](_0x523206,function(_0x57b1dc){if(_0x57b1dc[_0x88ac('0x2c')]!=='VIRTUAL'){var _0x1e2618={};_0x1e2618[_0x57b1dc[_0x88ac('0x27')]]={'$like':'%'+_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x3c')]+'%'};return _0x1e2618;}})});}_0x1ef8c7=_[_0x88ac('0x3d')]({},_0x1ef8c7,_0x2cff9f[_0x88ac('0x3e')]);var _0x4252c2={'where':_0x1ef8c7[_0x88ac('0x39')]};return db[_0x88ac('0x3f')]['count'](_0x4252c2)['then'](function(_0x3b7145){_0x223edf['count']=_0x3b7145;if(_0x2cff9f[_0x88ac('0x30')][_0x88ac('0x40')]){_0x1ef8c7[_0x88ac('0x41')]=[{'all':!![]}];}return db[_0x88ac('0x3f')][_0x88ac('0x42')](_0x1ef8c7);})[_0x88ac('0x23')](function(_0x7ef731){_0x223edf[_0x88ac('0x43')]=_0x7ef731;return _0x223edf;})[_0x88ac('0x23')](respondWithFilteredResult(_0x4a780a,_0x1ef8c7))['catch'](handleError(_0x4a780a,null));};exports[_0x88ac('0x44')]=function(_0x13a3cc,_0x5ef988){var _0xeb268a={'raw':!![],'where':{'id':_0x13a3cc[_0x88ac('0x45')]['id']}},_0x22768b={};_0x22768b['model']=_[_0x88ac('0x2f')](db['DeskField'][_0x88ac('0x46')]);_0x22768b[_0x88ac('0x30')]=_[_0x88ac('0x2f')](_0x13a3cc[_0x88ac('0x30')]);_0x22768b['filters']=_['intersection'](_0x22768b['model'],_0x22768b[_0x88ac('0x30')]);_0xeb268a['attributes']=_['intersection'](_0x22768b['model'],qs['fields'](_0x13a3cc[_0x88ac('0x30')][_0x88ac('0x33')]));_0xeb268a[_0x88ac('0x31')]=_0xeb268a[_0x88ac('0x31')][_0x88ac('0x34')]?_0xeb268a[_0x88ac('0x31')]:_0x22768b[_0x88ac('0x2e')];if(_0x13a3cc[_0x88ac('0x30')]['includeAll']){_0xeb268a['include']=[{'all':!![]}];}_0xeb268a=_[_0x88ac('0x3d')]({},_0xeb268a,_0x13a3cc['options']);return db['DeskField'][_0x88ac('0x47')](_0xeb268a)[_0x88ac('0x23')](handleEntityNotFound(_0x5ef988,null))[_0x88ac('0x23')](respondWithResult(_0x5ef988,null))['catch'](handleError(_0x5ef988,null));};exports[_0x88ac('0x48')]=function(_0x2c66ac,_0xc57a4d){return db['DeskField'][_0x88ac('0x48')](_0x2c66ac[_0x88ac('0x49')],{})[_0x88ac('0x23')](respondWithResult(_0xc57a4d,0xc9))[_0x88ac('0x4a')](handleError(_0xc57a4d,null));};exports['update']=function(_0x5acedd,_0xdf5704){if(_0x5acedd[_0x88ac('0x49')]['id']){delete _0x5acedd[_0x88ac('0x49')]['id'];}return db[_0x88ac('0x3f')]['find']({'where':{'id':_0x5acedd[_0x88ac('0x45')]['id']}})[_0x88ac('0x23')](handleEntityNotFound(_0xdf5704,null))['then'](saveUpdates(_0x5acedd[_0x88ac('0x49')],null))[_0x88ac('0x23')](respondWithResult(_0xdf5704,null))[_0x88ac('0x4a')](handleError(_0xdf5704,null));};exports[_0x88ac('0x22')]=function(_0x1d9f5,_0x23fdd2){return db[_0x88ac('0x3f')][_0x88ac('0x47')]({'where':{'id':_0x1d9f5[_0x88ac('0x45')]['id']}})[_0x88ac('0x23')](handleEntityNotFound(_0x23fdd2,null))[_0x88ac('0x23')](removeEntity(_0x23fdd2,null))[_0x88ac('0x4a')](handleError(_0x23fdd2,null));}; \ No newline at end of file +var _0x4d68=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','DeskField','findAll','show','includeAll','options','catch','create','body','find','params'];(function(_0x686d1a,_0x2b0b9e){var _0xe79a5c=function(_0x58785d){while(--_0x58785d){_0x686d1a['push'](_0x686d1a['shift']());}};_0xe79a5c(++_0x2b0b9e);}(_0x4d68,0xd5));var _0x84d6=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x4d68[_0x4cc03b];return _0xf0358c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x84d6('0x0'));var rimraf=require(_0x84d6('0x1'));var zipdir=require(_0x84d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84d6('0x6'));var sox=require(_0x84d6('0x7'));var csv=require('to-csv');var ejs=require(_0x84d6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x84d6('0x9'));var crypto=require(_0x84d6('0xa'));var jsforce=require(_0x84d6('0xb'));var deskjs=require(_0x84d6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x84d6('0xd'));var Redis=require(_0x84d6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x84d6('0xf'));var as=require(_0x84d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84d6('0x11'))(_0x84d6('0x12'));var utils=require(_0x84d6('0x13'));var config=require(_0x84d6('0x14'));var licenseUtil=require(_0x84d6('0x15'));var db=require(_0x84d6('0x16'))['db'];function respondWithStatusCode(_0x4c1929,_0x8d867e){_0x8d867e=_0x8d867e||0xcc;return function(_0x2c4700){if(_0x2c4700){return _0x4c1929['sendStatus'](_0x8d867e);}return _0x4c1929[_0x84d6('0x17')](_0x8d867e)[_0x84d6('0x18')]();};}function respondWithResult(_0x16b115,_0x3e6d42){_0x3e6d42=_0x3e6d42||0xc8;return function(_0x332b44){if(_0x332b44){return _0x16b115[_0x84d6('0x17')](_0x3e6d42)[_0x84d6('0x19')](_0x332b44);}};}function respondWithFilteredResult(_0x388cb8,_0xc7b750){return function(_0x3f4101){if(_0x3f4101){var _0xff0f10=_0x3f4101[_0x84d6('0x1a')],_0x4abc0a=_0xc7b750[_0x84d6('0x1b')],_0xf9163c=_0xc7b750[_0x84d6('0x1b')]+_0xc7b750[_0x84d6('0x1c')],_0x3e6fe7;if(_0xf9163c>=_0xff0f10){_0xf9163c=_0xff0f10;_0x3e6fe7=0xc8;}else{_0x3e6fe7=0xce;}_0x388cb8[_0x84d6('0x17')](_0x3e6fe7);return _0x388cb8[_0x84d6('0x1d')](_0x84d6('0x1e'),_0x4abc0a+'-'+_0xf9163c+'/'+_0xff0f10)[_0x84d6('0x19')](_0x3f4101);}return null;};}function patchUpdates(_0x38c05b){return function(_0x4ad4b4){try{jsonpatch[_0x84d6('0x1f')](_0x4ad4b4,_0x38c05b,!![]);}catch(_0x47cc3f){return BPromise[_0x84d6('0x20')](_0x47cc3f);}return _0x4ad4b4[_0x84d6('0x21')]();};}function saveUpdates(_0x2d7061,_0x3e19c6){return function(_0x3fa1ae){if(_0x3fa1ae){return _0x3fa1ae[_0x84d6('0x22')](_0x2d7061)['then'](function(_0x4be303){return _0x4be303;});}return null;};}function removeEntity(_0xb8068c,_0x1d6f62){return function(_0x2c32a8){if(_0x2c32a8){return _0x2c32a8['destroy']()[_0x84d6('0x23')](function(){_0xb8068c['status'](0xcc)[_0x84d6('0x18')]();});}};}function handleEntityNotFound(_0x238cf6,_0x58cff6){return function(_0x21a102){if(!_0x21a102){_0x238cf6[_0x84d6('0x24')](0x194);}return _0x21a102;};}function handleError(_0x1a8307,_0x4fb647){_0x4fb647=_0x4fb647||0x1f4;return function(_0x8436c6){logger['error'](_0x8436c6[_0x84d6('0x25')]);if(_0x8436c6[_0x84d6('0x26')]){delete _0x8436c6[_0x84d6('0x26')];}_0x1a8307[_0x84d6('0x17')](_0x4fb647)[_0x84d6('0x27')](_0x8436c6);};}exports[_0x84d6('0x28')]=function(_0x142848,_0x37b5da){var _0x466cba={},_0x437ce5={},_0xd65b97={'count':0x0,'rows':[]};var _0x393fc9=_[_0x84d6('0x29')](db['DeskField'][_0x84d6('0x2a')],function(_0x16a17f){return{'name':_0x16a17f['fieldName'],'type':_0x16a17f[_0x84d6('0x2b')]['key']};});_0x437ce5[_0x84d6('0x2c')]=_[_0x84d6('0x29')](_0x393fc9,_0x84d6('0x26'));_0x437ce5[_0x84d6('0x2d')]=_[_0x84d6('0x2e')](_0x142848[_0x84d6('0x2d')]);_0x437ce5[_0x84d6('0x2f')]=_[_0x84d6('0x30')](_0x437ce5[_0x84d6('0x2c')],_0x437ce5['query']);_0x466cba['attributes']=_[_0x84d6('0x30')](_0x437ce5[_0x84d6('0x2c')],qs[_0x84d6('0x31')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x31')]));_0x466cba[_0x84d6('0x32')]=_0x466cba[_0x84d6('0x32')][_0x84d6('0x33')]?_0x466cba[_0x84d6('0x32')]:_0x437ce5['model'];if(!_0x142848[_0x84d6('0x2d')][_0x84d6('0x34')](_0x84d6('0x35'))){_0x466cba['limit']=qs['limit'](_0x142848[_0x84d6('0x2d')][_0x84d6('0x1c')]);_0x466cba['offset']=qs[_0x84d6('0x1b')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x1b')]);}_0x466cba[_0x84d6('0x36')]=qs[_0x84d6('0x37')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x37')]);_0x466cba[_0x84d6('0x38')]=qs['filters'](_[_0x84d6('0x39')](_0x142848[_0x84d6('0x2d')],_0x437ce5['filters']),_0x393fc9);if(_0x142848[_0x84d6('0x2d')][_0x84d6('0x3a')]){_0x466cba[_0x84d6('0x38')]=_[_0x84d6('0x3b')](_0x466cba[_0x84d6('0x38')],{'$or':_[_0x84d6('0x29')](_0x393fc9,function(_0x1322da){if(_0x1322da[_0x84d6('0x2b')]!=='VIRTUAL'){var _0x20e0b0={};_0x20e0b0[_0x1322da[_0x84d6('0x26')]]={'$like':'%'+_0x142848[_0x84d6('0x2d')][_0x84d6('0x3a')]+'%'};return _0x20e0b0;}})});}_0x466cba=_[_0x84d6('0x3b')]({},_0x466cba,_0x142848['options']);var _0x1f874e={'where':_0x466cba[_0x84d6('0x38')]};return db['DeskField'][_0x84d6('0x1a')](_0x1f874e)['then'](function(_0x22de56){_0xd65b97['count']=_0x22de56;if(_0x142848[_0x84d6('0x2d')]['includeAll']){_0x466cba[_0x84d6('0x3c')]=[{'all':!![]}];}return db[_0x84d6('0x3d')][_0x84d6('0x3e')](_0x466cba);})[_0x84d6('0x23')](function(_0x12d3d9){_0xd65b97['rows']=_0x12d3d9;return _0xd65b97;})['then'](respondWithFilteredResult(_0x37b5da,_0x466cba))['catch'](handleError(_0x37b5da,null));};exports[_0x84d6('0x3f')]=function(_0xf4b628,_0x1c2562){var _0x5010ff={'raw':!![],'where':{'id':_0xf4b628['params']['id']}},_0x5ccacb={};_0x5ccacb['model']=_[_0x84d6('0x2e')](db['DeskField'][_0x84d6('0x2a')]);_0x5ccacb['query']=_[_0x84d6('0x2e')](_0xf4b628[_0x84d6('0x2d')]);_0x5ccacb['filters']=_['intersection'](_0x5ccacb['model'],_0x5ccacb['query']);_0x5010ff[_0x84d6('0x32')]=_[_0x84d6('0x30')](_0x5ccacb[_0x84d6('0x2c')],qs['fields'](_0xf4b628[_0x84d6('0x2d')][_0x84d6('0x31')]));_0x5010ff[_0x84d6('0x32')]=_0x5010ff[_0x84d6('0x32')][_0x84d6('0x33')]?_0x5010ff['attributes']:_0x5ccacb[_0x84d6('0x2c')];if(_0xf4b628[_0x84d6('0x2d')][_0x84d6('0x40')]){_0x5010ff[_0x84d6('0x3c')]=[{'all':!![]}];}_0x5010ff=_[_0x84d6('0x3b')]({},_0x5010ff,_0xf4b628[_0x84d6('0x41')]);return db[_0x84d6('0x3d')]['find'](_0x5010ff)['then'](handleEntityNotFound(_0x1c2562,null))[_0x84d6('0x23')](respondWithResult(_0x1c2562,null))[_0x84d6('0x42')](handleError(_0x1c2562,null));};exports[_0x84d6('0x43')]=function(_0x3b551e,_0xe2b062){return db['DeskField']['create'](_0x3b551e['body'],{})['then'](respondWithResult(_0xe2b062,0xc9))[_0x84d6('0x42')](handleError(_0xe2b062,null));};exports[_0x84d6('0x22')]=function(_0xdc83a5,_0x49ab20){if(_0xdc83a5['body']['id']){delete _0xdc83a5[_0x84d6('0x44')]['id'];}return db[_0x84d6('0x3d')][_0x84d6('0x45')]({'where':{'id':_0xdc83a5[_0x84d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x49ab20,null))[_0x84d6('0x23')](saveUpdates(_0xdc83a5['body'],null))[_0x84d6('0x23')](respondWithResult(_0x49ab20,null))[_0x84d6('0x42')](handleError(_0x49ab20,null));};exports['destroy']=function(_0x5c573b,_0x57c7d8){return db[_0x84d6('0x3d')][_0x84d6('0x45')]({'where':{'id':_0x5c573b[_0x84d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x57c7d8,null))[_0x84d6('0x23')](removeEntity(_0x57c7d8,null))[_0x84d6('0x42')](handleError(_0x57c7d8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ff2dfb6..79c7c9a 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 _0x0517=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','DeskField'];(function(_0x1e05bc,_0x27eae6){var _0x153f32=function(_0x11627f){while(--_0x11627f){_0x1e05bc['push'](_0x1e05bc['shift']());}};_0x153f32(++_0x27eae6);}(_0x0517,0x17b));var _0x7051=function(_0x49f383,_0x9d5e9e){_0x49f383=_0x49f383-0x0;var _0x319941=_0x0517[_0x49f383];return _0x319941;};'use strict';var _=require(_0x7051('0x0'));var util=require('util');var logger=require(_0x7051('0x1'))(_0x7051('0x2'));var moment=require(_0x7051('0x3'));var BPromise=require(_0x7051('0x4'));var rp=require(_0x7051('0x5'));var fs=require('fs');var path=require(_0x7051('0x6'));var rimraf=require(_0x7051('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x7051('0x8')]=function(_0x14f334,_0x5d5b60){return _0x14f334[_0x7051('0x9')](_0x7051('0xa'),attributes,{'tableName':_0x7051('0xb'),'paranoid':![],'indexes':[{'name':_0x7051('0xc'),'fields':[_0x7051('0xd'),_0x7051('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf905=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','util','api','moment','bluebird','path'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xf905,0x14b));var _0x5f90=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xf905[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require(_0x5f90('0x0'));var logger=require('../../config/logger')(_0x5f90('0x1'));var moment=require(_0x5f90('0x2'));var BPromise=require(_0x5f90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f90('0x4'));var rimraf=require(_0x5f90('0x5'));var config=require(_0x5f90('0x6'));var attributes=require(_0x5f90('0x7'));module[_0x5f90('0x8')]=function(_0x1345be,_0x909e63){return _0x1345be[_0x5f90('0x9')]('DeskField',attributes,{'tableName':_0x5f90('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x5f90('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f897e49..f7f18b3 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 _0x2b27=['request','then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x3b2196,_0x3476bf){var _0x54ab19=function(_0x34be56){while(--_0x34be56){_0x3b2196['push'](_0x3b2196['shift']());}};_0x54ab19(++_0x3476bf);}(_0x2b27,0x160));var _0x72b2=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x2b27[_0x57fa7e];return _0x320671;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72b2('0x0'));var BPromise=require(_0x72b2('0x1'));var rs=require(_0x72b2('0x2'));var fs=require('fs');var Redis=require(_0x72b2('0x3'));var db=require(_0x72b2('0x4'))['db'];var utils=require(_0x72b2('0x5'));var logger=require('../../config/logger')(_0x72b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x72b2('0x7')][_0x72b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x564238,_0x476d9d,_0x4fd264){return new BPromise(function(_0x482885,_0x5c85a8){return client[_0x72b2('0x9')](_0x564238,_0x4fd264)[_0x72b2('0xa')](function(_0x23dc06){logger['info'](_0x72b2('0xb'),_0x476d9d,_0x72b2('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x476d9d,_0x72b2('0xc'),JSON[_0x72b2('0xd')](_0x23dc06));if(_0x23dc06[_0x72b2('0xe')]){if(_0x23dc06[_0x72b2('0xe')]['code']===0x1f4){logger[_0x72b2('0xe')](_0x72b2('0xb'),_0x476d9d,_0x23dc06[_0x72b2('0xe')]['message']);return _0x5c85a8(_0x23dc06[_0x72b2('0xe')]['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x476d9d,_0x23dc06[_0x72b2('0xe')][_0x72b2('0xf')]);return _0x482885(_0x23dc06[_0x72b2('0xe')][_0x72b2('0xf')]);}else{logger[_0x72b2('0x10')]('DeskField,\x20%s,\x20%s',_0x476d9d,_0x72b2('0xc'));_0x482885(_0x23dc06[_0x72b2('0x11')][_0x72b2('0xf')]);}})[_0x72b2('0x12')](function(_0x174d08){logger[_0x72b2('0xe')]('DeskField,\x20%s,\x20%s',_0x476d9d,_0x174d08);_0x5c85a8(_0x174d08);});});} \ No newline at end of file +var _0x3642=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3262b1,_0x4da836){var _0x11c184=function(_0x543116){while(--_0x543116){_0x3262b1['push'](_0x3262b1['shift']());}};_0x11c184(++_0x4da836);}(_0x3642,0x1a4));var _0x2364=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x3642[_0x5c4585];return _0x21dede;};'use strict';var _=require(_0x2364('0x0'));var util=require(_0x2364('0x1'));var moment=require(_0x2364('0x2'));var BPromise=require('bluebird');var rs=require(_0x2364('0x3'));var fs=require('fs');var Redis=require(_0x2364('0x4'));var db=require(_0x2364('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2364('0x6'))(_0x2364('0x7'));var config=require('../../config/environment');var jayson=require(_0x2364('0x8'));var client=jayson[_0x2364('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3632de,_0x5068bd,_0x3d258a){return new BPromise(function(_0x55e4d4,_0xad5a38){return client['request'](_0x3632de,_0x3d258a)[_0x2364('0xa')](function(_0x915194){logger['info']('DeskField,\x20%s,\x20%s',_0x5068bd,_0x2364('0xb'));logger[_0x2364('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x5068bd,'request\x20sent',JSON[_0x2364('0xd')](_0x915194));if(_0x915194[_0x2364('0xe')]){if(_0x915194[_0x2364('0xe')][_0x2364('0xf')]===0x1f4){logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x915194[_0x2364('0xe')][_0x2364('0x11')]);return _0xad5a38(_0x915194[_0x2364('0xe')]['message']);}logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x915194['error'][_0x2364('0x11')]);return _0x55e4d4(_0x915194[_0x2364('0xe')]['message']);}else{logger[_0x2364('0x12')]('DeskField,\x20%s,\x20%s',_0x5068bd,_0x2364('0xb'));_0x55e4d4(_0x915194[_0x2364('0x13')][_0x2364('0x11')]);}})[_0x2364('0x14')](function(_0x22e918){logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x22e918);_0xad5a38(_0x22e918);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8330019..64ae556 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 _0x5eb8=['getFields','post','create','/:id/configurations','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x5eb8,0xb0));var _0x85eb=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x5eb8[_0x597c16];return _0x30cc2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0x8')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xb')]);router[_0x85eb('0x8')]('/:id/configurations',auth[_0x85eb('0x9')](),controller['getConfigurations']);router[_0x85eb('0x8')](_0x85eb('0xc'),auth[_0x85eb('0x9')](),controller[_0x85eb('0xd')]);router[_0x85eb('0xe')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xf')]);router['post'](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller['addConfiguration']);router[_0x85eb('0x11')](_0x85eb('0x12'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x13')]);router['delete']('/:id',auth[_0x85eb('0x9')](),controller['destroy']);module[_0x85eb('0x14')]=router; \ No newline at end of file +var _0x66fa=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','update','multer'];(function(_0xb9d495,_0x3b0fb9){var _0x2cb8c7=function(_0x5493ca){while(--_0x5493ca){_0xb9d495['push'](_0xb9d495['shift']());}};_0x2cb8c7(++_0x3b0fb9);}(_0x66fa,0x117));var _0xa66f=function(_0x2f1f20,_0x1f0b1e){_0x2f1f20=_0x2f1f20-0x0;var _0x18e131=_0x66fa[_0x2f1f20];return _0x18e131;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['get'](_0xa66f('0xe'),auth['isAuthenticated'](),controller[_0xa66f('0xf')]);router['get'](_0xa66f('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xa66f('0xc')](),controller[_0xa66f('0x11')]);router['post'](_0xa66f('0xe'),auth['isAuthenticated'](),controller[_0xa66f('0x12')]);router['put'](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0x13')]);router['delete']('/:id',auth[_0xa66f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b04e9a3..1607e32 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 _0x2beb=['sequelize','STRING'];(function(_0x2dced0,_0x34fd18){var _0x2a9f2f=function(_0x430f72){while(--_0x430f72){_0x2dced0['push'](_0x2dced0['shift']());}};_0x2a9f2f(++_0x34fd18);}(_0x2beb,0x1be));var _0xb2be=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2beb[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xb2be('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2be('0x1')]},'username':{'type':Sequelize[_0xb2be('0x1')]},'password':{'type':Sequelize[_0xb2be('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb2be('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb2be('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb2be('0x1')]}}; \ No newline at end of file +var _0x412e=['STRING','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x412e,0xe1));var _0xe412=function(_0x5c2ad0,_0x46752e){_0x5c2ad0=_0x5c2ad0-0x0;var _0x3d0155=_0x412e[_0x5c2ad0];return _0x3d0155;};'use strict';var Sequelize=require('sequelize');module[_0xe412('0x0')]={'name':{'type':Sequelize[_0xe412('0x1')]},'username':{'type':Sequelize[_0xe412('0x1')]},'password':{'type':Sequelize[_0xe412('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xe412('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe412('0x1')]},'serverUrl':{'type':Sequelize[_0xe412('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe412('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 98c2964..78dbf3c 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 _0xeda8=['username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','Bearer\x20','4.0','value','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','concat','test','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','DisplayName','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','set','apply','end','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','options','create','body','update','find','params','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','slainvokedidname','slaname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','versionnumber','findOne'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xeda8,0x104));var _0x8eda=function(_0x33f598,_0x5335b2){_0x33f598=_0x33f598-0x0;var _0x312618=_0xeda8[_0x33f598];return _0x312618;};'use strict';var pdf=require(_0x8eda('0x0'));var emlformat=require(_0x8eda('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eda('0x2'));var jsonpatch=require(_0x8eda('0x3'));var rp=require(_0x8eda('0x4'));var moment=require(_0x8eda('0x5'));var BPromise=require(_0x8eda('0x6'));var Mustache=require(_0x8eda('0x7'));var util=require(_0x8eda('0x8'));var path=require(_0x8eda('0x9'));var sox=require(_0x8eda('0xa'));var csv=require(_0x8eda('0xb'));var ejs=require(_0x8eda('0xc'));var fs=require('fs');var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];var integrations=require(_0x8eda('0x18'));var jayson=require(_0x8eda('0x19'));var client=jayson[_0x8eda('0x1a')][_0x8eda('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x24ea76,_0x57957c,_0x500bd4,_0xe04d90){return new BPromise(function(_0x223dcf,_0x4fa040){var _0x106a04=_0xe04d90||client;return _0x106a04[_0x8eda('0x1c')](_0x24ea76,_0x500bd4)[_0x8eda('0x1d')](function(_0x56ff8a){logger[_0x8eda('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x8eda('0x1f'));logger['debug'](_0x8eda('0x20'),_0x57957c,'request\x20sent',JSON[_0x8eda('0x21')](_0x56ff8a));if(_0x56ff8a[_0x8eda('0x22')]){if(_0x56ff8a['error']['code']===0x1f4){logger[_0x8eda('0x22')](_0x8eda('0x23'),_0x57957c,_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);return _0x4fa040(_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);}logger[_0x8eda('0x22')](_0x8eda('0x23'),_0x57957c,_0x56ff8a[_0x8eda('0x22')][_0x8eda('0x24')]);return _0x223dcf(_0x56ff8a[_0x8eda('0x22')]['message']);}else{logger[_0x8eda('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x8eda('0x1f'));_0x223dcf(_0x56ff8a['result'][_0x8eda('0x24')]);}})[_0x8eda('0x25')](function(_0x4f3e0a){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x57957c,_0x4f3e0a);_0x4fa040(_0x4f3e0a);});});}function respondWithStatusCode(_0x2a4c99,_0x17cae8){_0x17cae8=_0x17cae8||0xcc;return function(_0x5be84f){if(_0x5be84f){return _0x2a4c99[_0x8eda('0x26')](_0x17cae8);}return _0x2a4c99[_0x8eda('0x27')](_0x17cae8)['end']();};}function respondWithResult(_0x25e955,_0xfa57ca){_0xfa57ca=_0xfa57ca||0xc8;return function(_0x24b1e1){if(_0x24b1e1){return _0x25e955[_0x8eda('0x27')](_0xfa57ca)[_0x8eda('0x28')](_0x24b1e1);}};}function respondWithFilteredResult(_0x5c8488,_0x41b5a9){return function(_0x5a8bed){if(_0x5a8bed){var _0x35310c=_0x5a8bed[_0x8eda('0x29')],_0x2e8b2b=_0x41b5a9[_0x8eda('0x2a')],_0x8337b4=_0x41b5a9[_0x8eda('0x2a')]+_0x41b5a9['limit'],_0x567f69;if(_0x8337b4>=_0x35310c){_0x8337b4=_0x35310c;_0x567f69=0xc8;}else{_0x567f69=0xce;}_0x5c8488[_0x8eda('0x27')](_0x567f69);return _0x5c8488[_0x8eda('0x2b')]('Content-Range',_0x2e8b2b+'-'+_0x8337b4+'/'+_0x35310c)[_0x8eda('0x28')](_0x5a8bed);}return null;};}function patchUpdates(_0x29e6f4){return function(_0x373ff6){try{jsonpatch[_0x8eda('0x2c')](_0x373ff6,_0x29e6f4,!![]);}catch(_0x53274e){return BPromise['reject'](_0x53274e);}return _0x373ff6['save']();};}function saveUpdates(_0x2611c6,_0x1c1cda){return function(_0x1ed3d3){if(_0x1ed3d3){return _0x1ed3d3['update'](_0x2611c6)['then'](function(_0x5b45c1){return _0x5b45c1;});}return null;};}function removeEntity(_0x244da0,_0x48d52d){return function(_0x31aaaf){if(_0x31aaaf){return _0x31aaaf['destroy']()['then'](function(){_0x244da0['status'](0xcc)[_0x8eda('0x2d')]();});}};}function handleEntityNotFound(_0x3e1431,_0x142f67){return function(_0x2a3cdc){if(!_0x2a3cdc){_0x3e1431[_0x8eda('0x26')](0x194);}return _0x2a3cdc;};}function handleError(_0x32fb2d,_0x38d663){_0x38d663=_0x38d663||0x1f4;return function(_0x2d4f9f){logger[_0x8eda('0x22')](_0x2d4f9f[_0x8eda('0x2e')]);if(_0x2d4f9f[_0x8eda('0x2f')]){delete _0x2d4f9f[_0x8eda('0x2f')];}_0x32fb2d[_0x8eda('0x27')](_0x38d663)[_0x8eda('0x30')](_0x2d4f9f);};}exports['index']=function(_0x986dbe,_0x2ed279){var _0x1af2af={},_0x4e3b81={},_0x5061a3={'count':0x0,'rows':[]};var _0x41c873=_[_0x8eda('0x31')](db[_0x8eda('0x32')][_0x8eda('0x33')],function(_0x5709a2){return{'name':_0x5709a2[_0x8eda('0x34')],'type':_0x5709a2[_0x8eda('0x35')][_0x8eda('0x36')]};});_0x4e3b81[_0x8eda('0x37')]=_[_0x8eda('0x31')](_0x41c873,_0x8eda('0x2f'));_0x4e3b81['query']=_[_0x8eda('0x38')](_0x986dbe[_0x8eda('0x39')]);_0x4e3b81[_0x8eda('0x3a')]=_[_0x8eda('0x3b')](_0x4e3b81[_0x8eda('0x37')],_0x4e3b81[_0x8eda('0x39')]);_0x1af2af['attributes']=_[_0x8eda('0x3b')](_0x4e3b81[_0x8eda('0x37')],qs[_0x8eda('0x3c')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x3c')]));_0x1af2af['attributes']=_0x1af2af[_0x8eda('0x3d')][_0x8eda('0x3e')]?_0x1af2af[_0x8eda('0x3d')]:_0x4e3b81['model'];if(!_0x986dbe[_0x8eda('0x39')]['hasOwnProperty'](_0x8eda('0x3f'))){_0x1af2af[_0x8eda('0x40')]=qs[_0x8eda('0x40')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x40')]);_0x1af2af['offset']=qs['offset'](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x2a')]);}_0x1af2af[_0x8eda('0x41')]=qs[_0x8eda('0x42')](_0x986dbe[_0x8eda('0x39')][_0x8eda('0x42')]);_0x1af2af[_0x8eda('0x43')]=qs[_0x8eda('0x3a')](_[_0x8eda('0x44')](_0x986dbe[_0x8eda('0x39')],_0x4e3b81[_0x8eda('0x3a')]),_0x41c873);if(_0x986dbe[_0x8eda('0x39')][_0x8eda('0x45')]){_0x1af2af[_0x8eda('0x43')]=_[_0x8eda('0x46')](_0x1af2af[_0x8eda('0x43')],{'$or':_[_0x8eda('0x31')](_0x41c873,function(_0x106232){if(_0x106232[_0x8eda('0x35')]!=='VIRTUAL'){var _0x3711f8={};_0x3711f8[_0x106232[_0x8eda('0x2f')]]={'$like':'%'+_0x986dbe['query'][_0x8eda('0x45')]+'%'};return _0x3711f8;}})});}_0x1af2af=_[_0x8eda('0x46')]({},_0x1af2af,_0x986dbe['options']);var _0x289688={'where':_0x1af2af[_0x8eda('0x43')]};return db['Dynamics365Account'][_0x8eda('0x29')](_0x289688)[_0x8eda('0x1d')](function(_0x2a3546){_0x5061a3['count']=_0x2a3546;if(_0x986dbe[_0x8eda('0x39')][_0x8eda('0x47')]){_0x1af2af[_0x8eda('0x48')]=[{'all':!![]}];}return db[_0x8eda('0x32')][_0x8eda('0x49')](_0x1af2af);})[_0x8eda('0x1d')](function(_0x2ce641){_0x5061a3['rows']=_0x2ce641;return _0x5061a3;})[_0x8eda('0x1d')](respondWithFilteredResult(_0x2ed279,_0x1af2af))['catch'](handleError(_0x2ed279,null));};exports[_0x8eda('0x4a')]=function(_0x52b026,_0x1a64e8){var _0x4d9d76={'raw':![],'where':{'id':_0x52b026['params']['id']}},_0x4607c4={};_0x4607c4[_0x8eda('0x37')]=_[_0x8eda('0x38')](db[_0x8eda('0x32')][_0x8eda('0x33')]);_0x4607c4[_0x8eda('0x39')]=_[_0x8eda('0x38')](_0x52b026[_0x8eda('0x39')]);_0x4607c4[_0x8eda('0x3a')]=_[_0x8eda('0x3b')](_0x4607c4[_0x8eda('0x37')],_0x4607c4[_0x8eda('0x39')]);_0x4d9d76[_0x8eda('0x3d')]=_['intersection'](_0x4607c4[_0x8eda('0x37')],qs[_0x8eda('0x3c')](_0x52b026[_0x8eda('0x39')][_0x8eda('0x3c')]));_0x4d9d76[_0x8eda('0x3d')]=_0x4d9d76[_0x8eda('0x3d')][_0x8eda('0x3e')]?_0x4d9d76[_0x8eda('0x3d')]:_0x4607c4[_0x8eda('0x37')];if(_0x52b026[_0x8eda('0x39')][_0x8eda('0x47')]){_0x4d9d76[_0x8eda('0x48')]=[{'all':!![]}];}_0x4d9d76=_[_0x8eda('0x46')]({},_0x4d9d76,_0x52b026[_0x8eda('0x4b')]);return db[_0x8eda('0x32')]['find'](_0x4d9d76)[_0x8eda('0x1d')](handleEntityNotFound(_0x1a64e8,null))[_0x8eda('0x1d')](respondWithResult(_0x1a64e8,null))[_0x8eda('0x25')](handleError(_0x1a64e8,null));};exports[_0x8eda('0x4c')]=function(_0x1a6bde,_0x8a172a){return db['Dynamics365Account'][_0x8eda('0x4c')](_0x1a6bde[_0x8eda('0x4d')],{})[_0x8eda('0x1d')](respondWithResult(_0x8a172a,0xc9))['catch'](handleError(_0x8a172a,null));};exports[_0x8eda('0x4e')]=function(_0x4d4e78,_0x3d16b4){if(_0x4d4e78[_0x8eda('0x4d')]['id']){delete _0x4d4e78[_0x8eda('0x4d')]['id'];}return db['Dynamics365Account'][_0x8eda('0x4f')]({'where':{'id':_0x4d4e78[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x3d16b4,null))['then'](saveUpdates(_0x4d4e78[_0x8eda('0x4d')],null))[_0x8eda('0x1d')](respondWithResult(_0x3d16b4,null))[_0x8eda('0x25')](handleError(_0x3d16b4,null));};exports[_0x8eda('0x51')]=function(_0xc7bc6a,_0x26aa9b){return db[_0x8eda('0x32')][_0x8eda('0x4f')]({'where':{'id':_0xc7bc6a[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x26aa9b,null))['then'](removeEntity(_0x26aa9b,null))[_0x8eda('0x25')](handleError(_0x26aa9b,null));};exports[_0x8eda('0x52')]=function(_0x4c137a,_0x709b8,_0x54df94){var _0x5f51fc={};var _0x4a3e61={};var _0x4a26af;var _0x4b24e1;return db[_0x8eda('0x32')]['findOne']({'where':{'id':_0x4c137a[_0x8eda('0x50')]['id']}})[_0x8eda('0x1d')](handleEntityNotFound(_0x709b8,null))[_0x8eda('0x1d')](function(_0x3298fa){if(_0x3298fa){_0x4a26af=_0x3298fa;_0x4a3e61[_0x8eda('0x37')]=_[_0x8eda('0x38')](db[_0x8eda('0x53')]['rawAttributes']);_0x4a3e61[_0x8eda('0x39')]=_['keys'](_0x4c137a[_0x8eda('0x39')]);_0x4a3e61['filters']=_[_0x8eda('0x3b')](_0x4a3e61['model'],_0x4a3e61[_0x8eda('0x39')]);_0x5f51fc[_0x8eda('0x3d')]=_[_0x8eda('0x3b')](_0x4a3e61['model'],qs['fields'](_0x4c137a['query'][_0x8eda('0x3c')]));_0x5f51fc[_0x8eda('0x3d')]=_0x5f51fc['attributes'][_0x8eda('0x3e')]?_0x5f51fc['attributes']:_0x4a3e61['model'];_0x5f51fc[_0x8eda('0x41')]=qs[_0x8eda('0x42')](_0x4c137a[_0x8eda('0x39')][_0x8eda('0x42')]);_0x5f51fc['where']=qs['filters'](_[_0x8eda('0x44')](_0x4c137a[_0x8eda('0x39')],_0x4a3e61[_0x8eda('0x3a')]));if(_0x4c137a[_0x8eda('0x39')]['filter']){_0x5f51fc[_0x8eda('0x43')]=_['merge'](_0x5f51fc[_0x8eda('0x43')],{'$or':_['map'](_0x5f51fc[_0x8eda('0x3d')],function(_0x585cf2){var _0x437d35={};_0x437d35[_0x585cf2]={'$like':'%'+_0x4c137a[_0x8eda('0x39')][_0x8eda('0x45')]+'%'};return _0x437d35;})});}_0x5f51fc=_[_0x8eda('0x46')]({},_0x5f51fc,_0x4c137a[_0x8eda('0x4b')]);return _0x4a26af[_0x8eda('0x52')](_0x5f51fc);}})[_0x8eda('0x1d')](function(_0x1dfb4f){if(_0x1dfb4f){_0x4b24e1=_0x1dfb4f[_0x8eda('0x3e')];if(!_0x4c137a['query']['hasOwnProperty'](_0x8eda('0x3f'))){_0x5f51fc['limit']=qs[_0x8eda('0x40')](_0x4c137a[_0x8eda('0x39')][_0x8eda('0x40')]);_0x5f51fc[_0x8eda('0x2a')]=qs[_0x8eda('0x2a')](_0x4c137a['query']['offset']);}return _0x4a26af[_0x8eda('0x52')](_0x5f51fc);}})[_0x8eda('0x1d')](function(_0x423df5){if(_0x423df5){return _0x423df5?{'count':_0x4b24e1,'rows':_0x423df5}:null;}})[_0x8eda('0x1d')](respondWithResult(_0x709b8,null))[_0x8eda('0x25')](handleError(_0x709b8,null));};exports[_0x8eda('0x54')]=function(_0x10cda2,_0x55ead4,_0x283dca){if(_0x10cda2[_0x8eda('0x4d')]['id']){delete _0x10cda2['body']['id'];}return db[_0x8eda('0x32')]['findOne']({'where':{'id':_0x10cda2['params']['id']}})['then'](handleEntityNotFound(_0x55ead4,null))['then'](function(_0x1e6e86){if(_0x1e6e86){_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x55')]=_0x1e6e86['id'];_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x56')]=integrations[_0x8eda('0x57')](_0x10cda2['body'][_0x8eda('0x58')],_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x35')]);_0x10cda2[_0x8eda('0x4d')]['Descriptions']=integrations[_0x8eda('0x59')](_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x58')],_0x10cda2[_0x8eda('0x4d')][_0x8eda('0x35')]);return db[_0x8eda('0x53')]['create'](_0x10cda2[_0x8eda('0x4d')],{'include':[{'model':db[_0x8eda('0x5a')],'as':_0x8eda('0x56')},{'model':db[_0x8eda('0x5a')],'as':_0x8eda('0x5b')}]});}return null;})[_0x8eda('0x1d')](respondWithResult(_0x55ead4,null))[_0x8eda('0x25')](handleError(_0x55ead4,null));};exports[_0x8eda('0x5c')]=function(_0x3119bc,_0x168e6c,_0x2bdceb){var _0xd84c42=_0x3119bc[_0x8eda('0x39')][_0x8eda('0x5d')];var _0x53d7da=_0xd84c42==='incident'?_0x8eda('0x5e'):_0x8eda('0x5f');var _0x1b43c0='';var _0x32db8b='';var _0x57e032='';var _0x23d64f='';var _0x306a0a='';var _0x5de432='';var _0x162c2f='';var _0x5f0d26='';var _0x415813=[_0x8eda('0x60'),_0x8eda('0x61'),'customerid',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),'phonenumber',_0x8eda('0x65'),_0x8eda('0x66'),_0x8eda('0x67')];var _0x2f30af=['accountidname','accountidyominame',_0x8eda('0x68'),_0x8eda('0x69'),_0x8eda('0x6a'),_0x8eda('0x6b'),'contractdetailidname',_0x8eda('0x6c'),_0x8eda('0x6d'),_0x8eda('0x6e'),_0x8eda('0x6f'),_0x8eda('0x70'),'createdon',_0x8eda('0x71'),_0x8eda('0x72'),_0x8eda('0x73'),'customeridtype','customeridyominame','emailaddress',_0x8eda('0x74'),_0x8eda('0x75'),_0x8eda('0x76'),_0x8eda('0x77'),_0x8eda('0x78'),_0x8eda('0x79'),_0x8eda('0x7a'),_0x8eda('0x7b'),'influencescore',_0x8eda('0x7c'),_0x8eda('0x7d'),_0x8eda('0x7e'),'modifiedbyexternalpartyname',_0x8eda('0x7f'),_0x8eda('0x80'),_0x8eda('0x81'),_0x8eda('0x82'),_0x8eda('0x83'),_0x8eda('0x84'),_0x8eda('0x85'),_0x8eda('0x86'),_0x8eda('0x87'),_0x8eda('0x88'),_0x8eda('0x89'),'owneridname',_0x8eda('0x8a'),_0x8eda('0x8b'),_0x8eda('0x8c'),_0x8eda('0x8d'),_0x8eda('0x8e'),_0x8eda('0x8f'),_0x8eda('0x90'),_0x8eda('0x91'),_0x8eda('0x92'),_0x8eda('0x93'),_0x8eda('0x94'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0x8eda('0x95'),_0x8eda('0x96'),'socialprofileidname',_0x8eda('0x97'),_0x8eda('0x98'),_0x8eda('0x99'),'ticketnumber',_0x8eda('0x9a'),'transactioncurrencyidname',_0x8eda('0x9b'),'utcconversiontimezonecode',_0x8eda('0x9c')];var _0x2f8b54=_0x415813['concat'](_0x2f30af);return db[_0x8eda('0x32')][_0x8eda('0x9d')]({'where':{'id':_0x3119bc[_0x8eda('0x50')]['id']},'attributes':['id',_0x8eda('0x9e'),_0x8eda('0x9f'),_0x8eda('0xa0'),_0x8eda('0xa1'),_0x8eda('0xa2'),_0x8eda('0xa3')]})[_0x8eda('0x1d')](handleEntityNotFound(_0x168e6c,null))['then'](function(_0x5e7f48){if(_0x5e7f48){_0x5f0d26=_0x5e7f48['remoteUri'];var _0x5b64c8=_0x5f0d26[_0x8eda('0xa4')](-0x1);if(_0x5b64c8==='/'){_0x5f0d26=_0x5f0d26[_0x8eda('0xa5')](0x0,_0x5f0d26[_0x8eda('0xa6')](_0x5b64c8));}_0x162c2f=util['format'](_0x8eda('0xa7'),_0x5f0d26);var _0x344150={'method':_0x8eda('0xa8'),'uri':_0x8eda('0xa9')+_0x5e7f48[_0x8eda('0xa1')]+_0x8eda('0xaa'),'form':{'client_id':_0x5e7f48[_0x8eda('0xa2')],'resource':_0x5f0d26,'username':_0x5e7f48[_0x8eda('0x9e')],'password':_0x5e7f48['password'],'grant_type':'password','client_secret':_0x5e7f48[_0x8eda('0xa3')]},'json':!![]};return rp(_0x344150);}})[_0x8eda('0x1d')](function(_0x570cd6){_0x5de432=_0x570cd6[_0x8eda('0xab')];var _0x27b68d={'method':_0x8eda('0xac'),'uri':encodeURI(_0x162c2f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x53d7da+'\x27'),'headers':{'Authorization':_0x8eda('0xad')+_0x5de432,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x27b68d);})[_0x8eda('0x1d')](function(_0x1838b1){var _0x1edd9f=_0x1838b1[_0x8eda('0xaf')][0x0];var _0x2480b2=_0x1edd9f['MetadataId'];var _0x11f9e4={'method':_0x8eda('0xac'),'uri':_0x162c2f+'EntityDefinitions('+_0x2480b2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x5de432,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x11f9e4);})[_0x8eda('0x1d')](function(_0x3a6a49){_0x1b43c0=_0x3a6a49;_0x32db8b=_0x1b43c0[_0x8eda('0xb0')];_0x32db8b=_[_0x8eda('0xb1')](_0x32db8b,function(_0x1ebc2b){return!_0x2f8b54[_0x8eda('0xb2')](_0x1ebc2b[_0x8eda('0xb3')]);});var _0x143d8d=[];var _0x1a3993=[];_0x32db8b[_0x8eda('0xb4')](function(_0x3ebd70){if(_0x3ebd70[_0x8eda('0xb5')]){var _0x3a386e=_0x3ebd70['@odata.type'][_0x8eda('0xa5')](_0x3ebd70[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x3a386e===_0x8eda('0xb6')){_0x143d8d['push'](getSelectList(_0x162c2f,_0xd84c42,_0x1a3993,_0x1b43c0[_0x8eda('0xb7')],_0x3ebd70[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x143d8d);})[_0x8eda('0x1d')](function(_0x4732be){_0x57e032=_0x4732be[0x0];var _0x59690b=[];var _0x447936=[];_0x32db8b[_0x8eda('0xb4')](function(_0x45c8d1){if(!_[_0x8eda('0xb9')](_0x45c8d1['@odata.type'])){var _0x5069ff=_0x45c8d1[_0x8eda('0xb5')][_0x8eda('0xa5')](_0x45c8d1[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x5069ff==='BooleanAttributeMetadata'){_0x59690b[_0x8eda('0xba')](getBooleanList(_0x162c2f,_0xd84c42,_0x447936,_0x1b43c0[_0x8eda('0xb7')],_0x45c8d1[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x59690b);})[_0x8eda('0x1d')](function(_0x3c26ba){_0x23d64f=_0x3c26ba[0x0];var _0x9edfd9=[];var _0x302329=[];_0x32db8b['forEach'](function(_0x25920d){if(_0x25920d[_0x8eda('0xb5')]){var _0x1e8ac4=_0x25920d[_0x8eda('0xb5')][_0x8eda('0xa5')](_0x25920d[_0x8eda('0xb5')][_0x8eda('0xa6')]('.')+0x1);if(_0x1e8ac4===_0x8eda('0xbb')||_0x1e8ac4===_0x8eda('0xbc')||_0x1e8ac4===_0x8eda('0xbd')||_0x1e8ac4==='IntegerAttributeMetadata'||_0x1e8ac4===_0x8eda('0xbe')||_0x1e8ac4===_0x8eda('0xbf')||_0x1e8ac4===_0x8eda('0xc0')||_0x1e8ac4==='EntityNameAttributeMetadata'||_0x1e8ac4===_0x8eda('0xc1')||_0x1e8ac4==='DecimalAttributeMetadata'){_0x9edfd9['push'](getInputList(_0x162c2f,_0xd84c42,_0x1e8ac4,_0x302329,_0x1b43c0['MetadataId'],_0x25920d[_0x8eda('0xb7')],_0x5de432));}}});return Promise[_0x8eda('0xb8')](_0x9edfd9);})['then'](function(_0x3923a5){_0x306a0a=_0x3923a5[0x0];var _0x2f19f9=_0x57e032['concat'](_0x23d64f)[_0x8eda('0xc2')](_0x306a0a);var _0x16860f={'count':_0x2f19f9['length'],'rows':_0x2f19f9};return _0x16860f;})['then'](respondWithResult(_0x168e6c,null))[_0x8eda('0x25')](function(_0x56279b){var _0x4e9522=_0x3119bc[_0x8eda('0x39')][_0x8eda('0xc3')]?0x1f4:_0x56279b['statusCode']||0x1f4;logger[_0x8eda('0x22')](_0x56279b[_0x8eda('0x2e')]);delete _0x56279b[_0x8eda('0x2f')];if(_0x4e9522===0x191){_0x4e9522=0x190;}_0x168e6c['status'](_0x4e9522)['send'](_0x3119bc[_0x8eda('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x56279b['statusCode']}:_0x56279b);});};function getSelectList(_0x35ece0,_0x5872c0,_0x7c3b4d,_0x465543,_0x44072b,_0x14ad01){var _0x2cfbd3={'method':_0x8eda('0xac'),'uri':_0x35ece0+_0x8eda('0xc4')+_0x465543+_0x8eda('0xc5')+_0x44072b+_0x8eda('0xc6')+_0x8eda('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x14ad01,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2cfbd3)[_0x8eda('0x1d')](function(_0x5dbfe4){var _0x2c3a82=[];var _0xa32ffb=_0x5dbfe4[_0x8eda('0xc8')][_0x8eda('0xc9')];_0xa32ffb[_0x8eda('0xb4')](function(_0x183bf7){_0x2c3a82[_0x8eda('0xba')]({'name':_0x183bf7['Label'][_0x8eda('0xca')][_0x8eda('0xcb')],'value':String(_0x183bf7['Value'])});});var _0xae066e={'id':_0x5872c0+'_'+_0x5dbfe4[_0x8eda('0xb3')],'name':_0x5dbfe4[_0x8eda('0xcc')][_0x8eda('0xca')][_0x8eda('0xcb')],'custom':![],'options':_0x2c3a82};_0x7c3b4d['push'](_0xae066e);return _0x7c3b4d;});}function getBooleanList(_0x1aa058,_0x4997aa,_0x38c2ab,_0x236587,_0x58f1be,_0x4f26fc){var _0x1078c1={'method':_0x8eda('0xac'),'uri':_0x1aa058+_0x8eda('0xc4')+_0x236587+_0x8eda('0xc5')+_0x58f1be+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x4f26fc,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x1078c1)[_0x8eda('0x1d')](function(_0x260c57){var _0x12b779=[];_0x12b779[_0x8eda('0xba')]({'name':_0x260c57[_0x8eda('0xc8')][_0x8eda('0xcd')]['Label']['UserLocalizedLabel'][_0x8eda('0xcb')],'value':'true'},{'name':_0x260c57['OptionSet'][_0x8eda('0xce')][_0x8eda('0xcb')][_0x8eda('0xca')][_0x8eda('0xcb')],'value':'false'});var _0xeb7a8d={'id':_0x4997aa+'_'+_0x260c57[_0x8eda('0xb3')],'name':_0x260c57[_0x8eda('0xcc')][_0x8eda('0xca')][_0x8eda('0xcb')],'custom':![],'options':_0x12b779};_0x38c2ab[_0x8eda('0xba')](_0xeb7a8d);return _0x38c2ab;});}function getInputList(_0x1514ee,_0xa74ba2,_0x1db309,_0x165d3b,_0x34986c,_0x235000,_0x2b4b2c){var _0x629d00={'method':_0x8eda('0xac'),'uri':_0x1514ee+_0x8eda('0xc4')+_0x34986c+_0x8eda('0xc5')+_0x235000+_0x8eda('0xcf')+_0x1db309+_0x8eda('0xd0'),'headers':{'Authorization':'Bearer\x20'+_0x2b4b2c,'If-None-Match':null,'OData-Version':_0x8eda('0xae')},'json':!![]};return rp(_0x629d00)['then'](function(_0x28b300){var _0x3222fd={'id':_0xa74ba2+'_'+_0x28b300[_0x8eda('0xb3')],'name':_0x28b300[_0x8eda('0xcc')][_0x8eda('0xca')]?_0x28b300[_0x8eda('0xcc')][_0x8eda('0xca')]['Label']:_0x28b300[_0x8eda('0xb3')],'custom':![],'options':[]};_0x165d3b[_0x8eda('0xba')](_0x3222fd);return _0x165d3b;});} \ No newline at end of file +var _0xe14b=['where','filter','merge','VIRTUAL','options','include','findAll','rows','show','filters','includeAll','find','create','body','params','getConfigurations','Dynamics365Configuration','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','includes','@odata.type','substring','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode','stack','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0xe14b,0x93));var _0xbe14=function(_0x59490f,_0x2af741){_0x59490f=_0x59490f-0x0;var _0x25e623=_0xe14b[_0x59490f];return _0x25e623;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];var integrations=require(_0xbe14('0x16'));var jayson=require(_0xbe14('0x17'));var client=jayson[_0xbe14('0x18')][_0xbe14('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x16893f,_0xa2cf72,_0x1e4826,_0x33fd54){return new BPromise(function(_0x813399,_0x530538){var _0x55b3a7=_0x33fd54||client;return _0x55b3a7[_0xbe14('0x1a')](_0x16893f,_0x1e4826)[_0xbe14('0x1b')](function(_0xf4ac9){logger[_0xbe14('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0xa2cf72,_0xbe14('0x1d'));logger[_0xbe14('0x1e')](_0xbe14('0x1f'),_0xa2cf72,_0xbe14('0x1d'),JSON[_0xbe14('0x20')](_0xf4ac9));if(_0xf4ac9[_0xbe14('0x21')]){if(_0xf4ac9[_0xbe14('0x21')]['code']===0x1f4){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x530538(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}logger['error'](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x813399(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}else{logger['info'](_0xbe14('0x22'),_0xa2cf72,'request\x20sent');_0x813399(_0xf4ac9[_0xbe14('0x24')]['message']);}})[_0xbe14('0x25')](function(_0x4a25fa){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0x4a25fa);_0x530538(_0x4a25fa);});});}function respondWithStatusCode(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0xcc;return function(_0x4d4190){if(_0x4d4190){return _0x505dbd[_0xbe14('0x26')](_0x2da350);}return _0x505dbd['status'](_0x2da350)[_0xbe14('0x27')]();};}function respondWithResult(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xc8;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x28')](_0x1ee9c1)[_0xbe14('0x29')](_0x39cc81);}};}function respondWithFilteredResult(_0x55d001,_0x1822e0){return function(_0x1ba46a){if(_0x1ba46a){var _0x391556=_0x1ba46a[_0xbe14('0x2a')],_0x169369=_0x1822e0['offset'],_0x5dd475=_0x1822e0[_0xbe14('0x2b')]+_0x1822e0[_0xbe14('0x2c')],_0x16f884;if(_0x5dd475>=_0x391556){_0x5dd475=_0x391556;_0x16f884=0xc8;}else{_0x16f884=0xce;}_0x55d001[_0xbe14('0x28')](_0x16f884);return _0x55d001[_0xbe14('0x2d')](_0xbe14('0x2e'),_0x169369+'-'+_0x5dd475+'/'+_0x391556)[_0xbe14('0x29')](_0x1ba46a);}return null;};}function patchUpdates(_0x31a664){return function(_0x2b05cb){try{jsonpatch[_0xbe14('0x2f')](_0x2b05cb,_0x31a664,!![]);}catch(_0x16a159){return BPromise[_0xbe14('0x30')](_0x16a159);}return _0x2b05cb[_0xbe14('0x31')]();};}function saveUpdates(_0x39dc0a,_0x10ae36){return function(_0x223f7a){if(_0x223f7a){return _0x223f7a[_0xbe14('0x32')](_0x39dc0a)[_0xbe14('0x1b')](function(_0x2ff48e){return _0x2ff48e;});}return null;};}function removeEntity(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x33')]()['then'](function(){_0x29e76a['status'](0xcc)[_0xbe14('0x27')]();});}};}function handleEntityNotFound(_0x4c1e7e,_0x243524){return function(_0x345b0){if(!_0x345b0){_0x4c1e7e['sendStatus'](0x194);}return _0x345b0;};}function handleError(_0x50cb09,_0x5798c7){_0x5798c7=_0x5798c7||0x1f4;return function(_0x412ad5){logger[_0xbe14('0x21')](_0x412ad5['stack']);if(_0x412ad5[_0xbe14('0x34')]){delete _0x412ad5[_0xbe14('0x34')];}_0x50cb09[_0xbe14('0x28')](_0x5798c7)[_0xbe14('0x35')](_0x412ad5);};}exports[_0xbe14('0x36')]=function(_0x5ef1e5,_0x591a36){var _0x15a997={},_0x52b24c={},_0x5dd7aa={'count':0x0,'rows':[]};var _0x5c5e9f=_[_0xbe14('0x37')](db[_0xbe14('0x38')][_0xbe14('0x39')],function(_0x3dbacb){return{'name':_0x3dbacb[_0xbe14('0x3a')],'type':_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x3c')]};});_0x52b24c[_0xbe14('0x3d')]=_[_0xbe14('0x37')](_0x5c5e9f,_0xbe14('0x34'));_0x52b24c[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x5ef1e5['query']);_0x52b24c['filters']=_[_0xbe14('0x40')](_0x52b24c[_0xbe14('0x3d')],_0x52b24c[_0xbe14('0x3e')]);_0x15a997['attributes']=_[_0xbe14('0x40')](_0x52b24c[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x41')]));_0x15a997[_0xbe14('0x42')]=_0x15a997[_0xbe14('0x42')][_0xbe14('0x43')]?_0x15a997[_0xbe14('0x42')]:_0x52b24c['model'];if(!_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x44')](_0xbe14('0x45'))){_0x15a997[_0xbe14('0x2c')]=qs[_0xbe14('0x2c')](_0x5ef1e5[_0xbe14('0x3e')]['limit']);_0x15a997[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x2b')]);}_0x15a997['order']=qs['sort'](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x46')]);_0x15a997[_0xbe14('0x47')]=qs['filters'](_['pick'](_0x5ef1e5[_0xbe14('0x3e')],_0x52b24c['filters']),_0x5c5e9f);if(_0x5ef1e5['query'][_0xbe14('0x48')]){_0x15a997[_0xbe14('0x47')]=_[_0xbe14('0x49')](_0x15a997['where'],{'$or':_['map'](_0x5c5e9f,function(_0x5aaa4f){if(_0x5aaa4f[_0xbe14('0x3b')]!==_0xbe14('0x4a')){var _0x1085d2={};_0x1085d2[_0x5aaa4f['name']]={'$like':'%'+_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x48')]+'%'};return _0x1085d2;}})});}_0x15a997=_[_0xbe14('0x49')]({},_0x15a997,_0x5ef1e5[_0xbe14('0x4b')]);var _0x58351f={'where':_0x15a997['where']};return db[_0xbe14('0x38')][_0xbe14('0x2a')](_0x58351f)[_0xbe14('0x1b')](function(_0xb2b285){_0x5dd7aa[_0xbe14('0x2a')]=_0xb2b285;if(_0x5ef1e5['query']['includeAll']){_0x15a997[_0xbe14('0x4c')]=[{'all':!![]}];}return db[_0xbe14('0x38')][_0xbe14('0x4d')](_0x15a997);})[_0xbe14('0x1b')](function(_0x4e65d2){_0x5dd7aa[_0xbe14('0x4e')]=_0x4e65d2;return _0x5dd7aa;})[_0xbe14('0x1b')](respondWithFilteredResult(_0x591a36,_0x15a997))['catch'](handleError(_0x591a36,null));};exports[_0xbe14('0x4f')]=function(_0x2a35e5,_0x2d6ee8){var _0x36c20c={'raw':![],'where':{'id':_0x2a35e5['params']['id']}},_0x589dac={};_0x589dac[_0xbe14('0x3d')]=_[_0xbe14('0x3f')](db['Dynamics365Account']['rawAttributes']);_0x589dac[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x2a35e5[_0xbe14('0x3e')]);_0x589dac[_0xbe14('0x50')]=_[_0xbe14('0x40')](_0x589dac[_0xbe14('0x3d')],_0x589dac[_0xbe14('0x3e')]);_0x36c20c['attributes']=_[_0xbe14('0x40')](_0x589dac[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x2a35e5[_0xbe14('0x3e')][_0xbe14('0x41')]));_0x36c20c['attributes']=_0x36c20c[_0xbe14('0x42')][_0xbe14('0x43')]?_0x36c20c[_0xbe14('0x42')]:_0x589dac[_0xbe14('0x3d')];if(_0x2a35e5[_0xbe14('0x3e')][_0xbe14('0x51')]){_0x36c20c['include']=[{'all':!![]}];}_0x36c20c=_['merge']({},_0x36c20c,_0x2a35e5[_0xbe14('0x4b')]);return db[_0xbe14('0x38')][_0xbe14('0x52')](_0x36c20c)['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x25')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x53')]=function(_0x50d78f,_0x339a86){return db[_0xbe14('0x38')]['create'](_0x50d78f[_0xbe14('0x54')],{})['then'](respondWithResult(_0x339a86,0xc9))[_0xbe14('0x25')](handleError(_0x339a86,null));};exports[_0xbe14('0x32')]=function(_0x12a9de,_0x550291){if(_0x12a9de[_0xbe14('0x54')]['id']){delete _0x12a9de[_0xbe14('0x54')]['id'];}return db['Dynamics365Account'][_0xbe14('0x52')]({'where':{'id':_0x12a9de[_0xbe14('0x55')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x550291,null))[_0xbe14('0x1b')](saveUpdates(_0x12a9de[_0xbe14('0x54')],null))['then'](respondWithResult(_0x550291,null))[_0xbe14('0x25')](handleError(_0x550291,null));};exports[_0xbe14('0x33')]=function(_0x3b7846,_0x243b9e){return db[_0xbe14('0x38')][_0xbe14('0x52')]({'where':{'id':_0x3b7846[_0xbe14('0x55')]['id']}})['then'](handleEntityNotFound(_0x243b9e,null))[_0xbe14('0x1b')](removeEntity(_0x243b9e,null))[_0xbe14('0x25')](handleError(_0x243b9e,null));};exports[_0xbe14('0x56')]=function(_0x1201e2,_0x246ed5,_0x2ed3fb){var _0xd8f78f={};var _0x32df3c={};var _0x285b6e;var _0xc61103;return db[_0xbe14('0x38')]['findOne']({'where':{'id':_0x1201e2['params']['id']}})['then'](handleEntityNotFound(_0x246ed5,null))[_0xbe14('0x1b')](function(_0x1bfcbf){if(_0x1bfcbf){_0x285b6e=_0x1bfcbf;_0x32df3c[_0xbe14('0x3d')]=_[_0xbe14('0x3f')](db[_0xbe14('0x57')][_0xbe14('0x39')]);_0x32df3c[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x1201e2[_0xbe14('0x3e')]);_0x32df3c[_0xbe14('0x50')]=_[_0xbe14('0x40')](_0x32df3c[_0xbe14('0x3d')],_0x32df3c[_0xbe14('0x3e')]);_0xd8f78f[_0xbe14('0x42')]=_[_0xbe14('0x40')](_0x32df3c[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x41')]));_0xd8f78f[_0xbe14('0x42')]=_0xd8f78f['attributes'][_0xbe14('0x43')]?_0xd8f78f[_0xbe14('0x42')]:_0x32df3c[_0xbe14('0x3d')];_0xd8f78f[_0xbe14('0x58')]=qs[_0xbe14('0x46')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x46')]);_0xd8f78f[_0xbe14('0x47')]=qs[_0xbe14('0x50')](_[_0xbe14('0x59')](_0x1201e2['query'],_0x32df3c[_0xbe14('0x50')]));if(_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x48')]){_0xd8f78f[_0xbe14('0x47')]=_[_0xbe14('0x49')](_0xd8f78f['where'],{'$or':_[_0xbe14('0x37')](_0xd8f78f[_0xbe14('0x42')],function(_0x3d186b){var _0xd4e1c7={};_0xd4e1c7[_0x3d186b]={'$like':'%'+_0x1201e2[_0xbe14('0x3e')]['filter']+'%'};return _0xd4e1c7;})});}_0xd8f78f=_[_0xbe14('0x49')]({},_0xd8f78f,_0x1201e2[_0xbe14('0x4b')]);return _0x285b6e[_0xbe14('0x56')](_0xd8f78f);}})[_0xbe14('0x1b')](function(_0xaebce8){if(_0xaebce8){_0xc61103=_0xaebce8[_0xbe14('0x43')];if(!_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x44')]('nolimit')){_0xd8f78f[_0xbe14('0x2c')]=qs[_0xbe14('0x2c')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x2c')]);_0xd8f78f[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x1201e2[_0xbe14('0x3e')]['offset']);}return _0x285b6e['getConfigurations'](_0xd8f78f);}})[_0xbe14('0x1b')](function(_0x3c2b58){if(_0x3c2b58){return _0x3c2b58?{'count':_0xc61103,'rows':_0x3c2b58}:null;}})[_0xbe14('0x1b')](respondWithResult(_0x246ed5,null))[_0xbe14('0x25')](handleError(_0x246ed5,null));};exports[_0xbe14('0x5a')]=function(_0x28cade,_0x23a32f,_0x43511e){if(_0x28cade['body']['id']){delete _0x28cade['body']['id'];}return db[_0xbe14('0x38')][_0xbe14('0x5b')]({'where':{'id':_0x28cade[_0xbe14('0x55')]['id']}})['then'](handleEntityNotFound(_0x23a32f,null))[_0xbe14('0x1b')](function(_0x16bca1){if(_0x16bca1){_0x28cade[_0xbe14('0x54')][_0xbe14('0x5c')]=_0x16bca1['id'];_0x28cade[_0xbe14('0x54')][_0xbe14('0x5d')]=integrations[_0xbe14('0x5e')](_0x28cade['body'][_0xbe14('0x5f')],_0x28cade[_0xbe14('0x54')][_0xbe14('0x3b')]);_0x28cade[_0xbe14('0x54')][_0xbe14('0x60')]=integrations[_0xbe14('0x61')](_0x28cade[_0xbe14('0x54')]['channel'],_0x28cade[_0xbe14('0x54')][_0xbe14('0x3b')]);return db[_0xbe14('0x57')][_0xbe14('0x53')](_0x28cade[_0xbe14('0x54')],{'include':[{'model':db[_0xbe14('0x62')],'as':_0xbe14('0x5d')},{'model':db[_0xbe14('0x62')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1b')](respondWithResult(_0x23a32f,null))[_0xbe14('0x25')](handleError(_0x23a32f,null));};exports[_0xbe14('0x63')]=function(_0xb40587,_0x2e0155,_0x17576b){var _0x4d59ce=_0xb40587[_0xbe14('0x3e')][_0xbe14('0x64')];var _0x1edc66=_0x4d59ce===_0xbe14('0x65')?'Incident':_0xbe14('0x66');var _0x1578b6='';var _0x316542='';var _0x1e7770='';var _0x80b6ec='';var _0x3d54e4='';var _0x3b0828='';var _0x55e70f='';var _0x70ed08='';var _0x589197=[_0xbe14('0x67'),'description',_0xbe14('0x68'),_0xbe14('0x69'),_0xbe14('0x6a'),'subject',_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'phonecall_activity_parties'];var _0x41a896=[_0xbe14('0x6e'),_0xbe14('0x6f'),_0xbe14('0x70'),'billedserviceunits',_0xbe14('0x71'),_0xbe14('0x72'),_0xbe14('0x73'),_0xbe14('0x74'),_0xbe14('0x75'),_0xbe14('0x76'),_0xbe14('0x77'),'createdbyyominame',_0xbe14('0x78'),_0xbe14('0x79'),_0xbe14('0x7a'),'customeridname',_0xbe14('0x7b'),_0xbe14('0x7c'),_0xbe14('0x7d'),'entitlementidname',_0xbe14('0x7e'),_0xbe14('0x7f'),'escalatedon',_0xbe14('0x80'),'firstresponsebykpiidname',_0xbe14('0x81'),_0xbe14('0x82'),'influencescore','kbarticleidname',_0xbe14('0x83'),_0xbe14('0x84'),_0xbe14('0x85'),'modifiedbyexternalpartyyominame',_0xbe14('0x86'),_0xbe14('0x87'),_0xbe14('0x88'),_0xbe14('0x89'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xbe14('0x8a'),_0xbe14('0x8b'),_0xbe14('0x8c'),_0xbe14('0x8d'),_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'parentcaseidname',_0xbe14('0x91'),'primarycontactidyominame',_0xbe14('0x92'),_0xbe14('0x93'),_0xbe14('0x94'),_0xbe14('0x95'),'resolvebykpiidname',_0xbe14('0x96'),_0xbe14('0x97'),_0xbe14('0x98'),'sentimentvalue',_0xbe14('0x99'),_0xbe14('0x9a'),_0xbe14('0x9b'),_0xbe14('0x9c'),_0xbe14('0x9d'),_0xbe14('0x9e'),_0xbe14('0x9f'),_0xbe14('0xa0'),_0xbe14('0xa1'),_0xbe14('0xa2'),_0xbe14('0xa3'),_0xbe14('0xa4')];var _0x5af56=_0x589197[_0xbe14('0xa5')](_0x41a896);return db[_0xbe14('0x38')][_0xbe14('0x5b')]({'where':{'id':_0xb40587[_0xbe14('0x55')]['id']},'attributes':['id',_0xbe14('0xa6'),_0xbe14('0xa7'),_0xbe14('0xa8'),'tenantId',_0xbe14('0xa9'),'clientSecret']})[_0xbe14('0x1b')](handleEntityNotFound(_0x2e0155,null))[_0xbe14('0x1b')](function(_0x262bc0){if(_0x262bc0){_0x70ed08=_0x262bc0[_0xbe14('0xa8')];var _0x1d7b08=_0x70ed08['slice'](-0x1);if(_0x1d7b08==='/'){_0x70ed08=_0x70ed08['substring'](0x0,_0x70ed08[_0xbe14('0xaa')](_0x1d7b08));}_0x55e70f=util[_0xbe14('0xab')](_0xbe14('0xac'),_0x70ed08);var _0x42b849={'method':'POST','uri':_0xbe14('0xad')+_0x262bc0[_0xbe14('0xae')]+'/oauth2/token','form':{'client_id':_0x262bc0[_0xbe14('0xa9')],'resource':_0x70ed08,'username':_0x262bc0[_0xbe14('0xa6')],'password':_0x262bc0[_0xbe14('0xa7')],'grant_type':_0xbe14('0xa7'),'client_secret':_0x262bc0['clientSecret']},'json':!![]};return rp(_0x42b849);}})[_0xbe14('0x1b')](function(_0x562559){_0x3b0828=_0x562559['access_token'];var _0x2ea561={'method':_0xbe14('0xaf'),'uri':encodeURI(_0x55e70f+_0xbe14('0xb0')+_0x1edc66+'\x27'),'headers':{'Authorization':_0xbe14('0xb1')+_0x3b0828,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x2ea561);})['then'](function(_0x1547f5){var _0x1584f6=_0x1547f5['value'][0x0];var _0x4e35ed=_0x1584f6[_0xbe14('0xb3')];var _0x141806={'method':'GET','uri':_0x55e70f+_0xbe14('0xb4')+_0x4e35ed+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xbe14('0xb1')+_0x3b0828,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x141806);})[_0xbe14('0x1b')](function(_0x5d4431){_0x1578b6=_0x5d4431;_0x316542=_0x1578b6[_0xbe14('0xb5')];_0x316542=_['remove'](_0x316542,function(_0x20a085){return!_0x5af56[_0xbe14('0xb6')](_0x20a085['LogicalName']);});var _0x519ffc=[];var _0x143f18=[];_0x316542['forEach'](function(_0x5a8750){if(_0x5a8750[_0xbe14('0xb7')]){var _0x2ca7c9=_0x5a8750[_0xbe14('0xb7')][_0xbe14('0xb8')](_0x5a8750[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x2ca7c9===_0xbe14('0xb9')){_0x519ffc['push'](getSelectList(_0x55e70f,_0x4d59ce,_0x143f18,_0x1578b6[_0xbe14('0xb3')],_0x5a8750[_0xbe14('0xb3')],_0x3b0828));}}});return Promise[_0xbe14('0xba')](_0x519ffc);})[_0xbe14('0x1b')](function(_0x59779a){_0x1e7770=_0x59779a[0x0];var _0x26372a=[];var _0x3c5097=[];_0x316542[_0xbe14('0xbb')](function(_0x501a53){if(!_[_0xbe14('0xbc')](_0x501a53[_0xbe14('0xb7')])){var _0x521a9f=_0x501a53[_0xbe14('0xb7')]['substring'](_0x501a53[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x521a9f===_0xbe14('0xbd')){_0x26372a['push'](getBooleanList(_0x55e70f,_0x4d59ce,_0x3c5097,_0x1578b6[_0xbe14('0xb3')],_0x501a53['MetadataId'],_0x3b0828));}}});return Promise[_0xbe14('0xba')](_0x26372a);})['then'](function(_0x590953){_0x80b6ec=_0x590953[0x0];var _0x21f3ff=[];var _0x553f51=[];_0x316542[_0xbe14('0xbb')](function(_0x5c6784){if(_0x5c6784[_0xbe14('0xb7')]){var _0x20763b=_0x5c6784[_0xbe14('0xb7')][_0xbe14('0xb8')](_0x5c6784[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x20763b===_0xbe14('0xbe')||_0x20763b===_0xbe14('0xbf')||_0x20763b===_0xbe14('0xc0')||_0x20763b===_0xbe14('0xc1')||_0x20763b===_0xbe14('0xc2')||_0x20763b===_0xbe14('0xc3')||_0x20763b===_0xbe14('0xc4')||_0x20763b==='EntityNameAttributeMetadata'||_0x20763b===_0xbe14('0xc5')||_0x20763b===_0xbe14('0xc6')){_0x21f3ff[_0xbe14('0xc7')](getInputList(_0x55e70f,_0x4d59ce,_0x20763b,_0x553f51,_0x1578b6[_0xbe14('0xb3')],_0x5c6784[_0xbe14('0xb3')],_0x3b0828));}}});return Promise['all'](_0x21f3ff);})['then'](function(_0x116282){_0x3d54e4=_0x116282[0x0];var _0x1a9cdc=_0x1e7770[_0xbe14('0xa5')](_0x80b6ec)[_0xbe14('0xa5')](_0x3d54e4);var _0x4942e3={'count':_0x1a9cdc[_0xbe14('0x43')],'rows':_0x1a9cdc};return _0x4942e3;})[_0xbe14('0x1b')](respondWithResult(_0x2e0155,null))[_0xbe14('0x25')](function(_0x1a3e87){var _0x26e7a7=_0xb40587[_0xbe14('0x3e')][_0xbe14('0xc8')]?0x1f4:_0x1a3e87[_0xbe14('0xc9')]||0x1f4;logger[_0xbe14('0x21')](_0x1a3e87[_0xbe14('0xca')]);delete _0x1a3e87[_0xbe14('0x34')];if(_0x26e7a7===0x191){_0x26e7a7=0x190;}_0x2e0155[_0xbe14('0x28')](_0x26e7a7)[_0xbe14('0x35')](_0xb40587[_0xbe14('0x3e')][_0xbe14('0xc8')]?{'message':_0xbe14('0xcb'),'statusCode':_0x1a3e87[_0xbe14('0xc9')]}:_0x1a3e87);});};function getSelectList(_0x1bdb8b,_0x317175,_0x151680,_0x499b5d,_0x245cdc,_0x3303a4){var _0x1ea574={'method':_0xbe14('0xaf'),'uri':_0x1bdb8b+_0xbe14('0xb4')+_0x499b5d+_0xbe14('0xcc')+_0x245cdc+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xbe14('0xb1')+_0x3303a4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ea574)[_0xbe14('0x1b')](function(_0x4babba){var _0x2408c6=[];var _0x59000b=_0x4babba[_0xbe14('0xcd')][_0xbe14('0xce')];_0x59000b[_0xbe14('0xbb')](function(_0x12498f){_0x2408c6[_0xbe14('0xc7')]({'name':_0x12498f[_0xbe14('0xcf')][_0xbe14('0xd0')][_0xbe14('0xcf')],'value':String(_0x12498f[_0xbe14('0xd1')])});});var _0x4f44ec={'id':_0x317175+'_'+_0x4babba[_0xbe14('0xd2')],'name':_0x4babba[_0xbe14('0xd3')][_0xbe14('0xd0')][_0xbe14('0xcf')],'custom':![],'options':_0x2408c6};_0x151680['push'](_0x4f44ec);return _0x151680;});}function getBooleanList(_0xe5a476,_0x4c3090,_0x2481fe,_0x4eb6c2,_0x25be60,_0x3e7588){var _0x24fa89={'method':'GET','uri':_0xe5a476+_0xbe14('0xb4')+_0x4eb6c2+')/Attributes('+_0x25be60+_0xbe14('0xd4'),'headers':{'Authorization':_0xbe14('0xb1')+_0x3e7588,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x24fa89)[_0xbe14('0x1b')](function(_0x1f7987){var _0x24d13d=[];_0x24d13d[_0xbe14('0xc7')]({'name':_0x1f7987[_0xbe14('0xcd')][_0xbe14('0xd5')]['Label'][_0xbe14('0xd0')]['Label'],'value':_0xbe14('0xd6')},{'name':_0x1f7987[_0xbe14('0xcd')][_0xbe14('0xd7')]['Label'][_0xbe14('0xd0')][_0xbe14('0xcf')],'value':_0xbe14('0xd8')});var _0xb6251a={'id':_0x4c3090+'_'+_0x1f7987[_0xbe14('0xd2')],'name':_0x1f7987['DisplayName']['UserLocalizedLabel'][_0xbe14('0xcf')],'custom':![],'options':_0x24d13d};_0x2481fe['push'](_0xb6251a);return _0x2481fe;});}function getInputList(_0x16b1c8,_0x36d6a6,_0x2dea3d,_0x374d51,_0x4e06b1,_0x33c7d5,_0x34af71){var _0x508c93={'method':_0xbe14('0xaf'),'uri':_0x16b1c8+_0xbe14('0xb4')+_0x4e06b1+_0xbe14('0xcc')+_0x33c7d5+_0xbe14('0xd9')+_0x2dea3d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbe14('0xb1')+_0x34af71,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x508c93)[_0xbe14('0x1b')](function(_0x3374d8){var _0x3b7920={'id':_0x36d6a6+'_'+_0x3374d8[_0xbe14('0xd2')],'name':_0x3374d8[_0xbe14('0xd3')][_0xbe14('0xd0')]?_0x3374d8[_0xbe14('0xd3')][_0xbe14('0xd0')]['Label']:_0x3374d8[_0xbe14('0xd2')],'custom':![],'options':[]};_0x374d51[_0xbe14('0xc7')](_0x3b7920);return _0x374d51;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index eacf641..73afac7 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 _0x697a=['util','api','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x34d14b,_0x27ab8a){var _0x1a010c=function(_0x436233){while(--_0x436233){_0x34d14b['push'](_0x34d14b['shift']());}};_0x1a010c(++_0x27ab8a);}(_0x697a,0x13e));var _0xa697=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x697a[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xa697('0x0'));var util=require(_0xa697('0x1'));var logger=require('../../config/logger')(_0xa697('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa697('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa697('0x4'));var config=require(_0xa697('0x5'));var attributes=require(_0xa697('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xa697('0x7')]=function(_0x429c84,_0x457da9){return _0x429c84[_0xa697('0x8')](_0xa697('0x9'),attributes,{'tableName':_0xa697('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5856=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x5856,0x13a));var _0x6585=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x5856[_0x1c208e];return _0x5104ff;};'use strict';var _=require('lodash');var util=require(_0x6585('0x0'));var logger=require(_0x6585('0x1'))(_0x6585('0x2'));var moment=require(_0x6585('0x3'));var BPromise=require(_0x6585('0x4'));var rp=require(_0x6585('0x5'));var fs=require('fs');var path=require(_0x6585('0x6'));var rimraf=require(_0x6585('0x7'));var config=require(_0x6585('0x8'));var attributes=require(_0x6585('0x9'));var integrations=require(_0x6585('0xa'));module[_0x6585('0xb')]=function(_0x3d850e,_0x59ed0f){return _0x3d850e[_0x6585('0xc')](_0x6585('0xd'),attributes,{'tableName':_0x6585('0xe'),'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 3a30639..2fc0474 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 _0x9c48=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','limit','include','model','attributes','map','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3b7820,_0x3aade4){var _0x4dc4a2=function(_0x5e08e4){while(--_0x5e08e4){_0x3b7820['push'](_0x3b7820['shift']());}};_0x4dc4a2(++_0x3aade4);}(_0x9c48,0xa1));var _0x89c4=function(_0xc9619c,_0x448ed3){_0xc9619c=_0xc9619c-0x0;var _0x3058aa=_0x9c48[_0xc9619c];return _0x3058aa;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var moment=require(_0x89c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c4('0x3'));var fs=require('fs');var Redis=require(_0x89c4('0x4'));var db=require(_0x89c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89c4('0x8')][_0x89c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0303,_0x213a86,_0x30cdf1){return new BPromise(function(_0x7faf5,_0x26ab92){return client[_0x89c4('0xa')](_0x1d0303,_0x30cdf1)[_0x89c4('0xb')](function(_0xad4f2c){logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));logger[_0x89c4('0xf')](_0x89c4('0x10'),_0x213a86,_0x89c4('0xe'),JSON[_0x89c4('0x11')](_0xad4f2c));if(_0xad4f2c[_0x89c4('0x12')]){if(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x213a86,_0xad4f2c['error'][_0x89c4('0x14')]);return _0x26ab92(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);}logger[_0x89c4('0x12')](_0x89c4('0xd'),_0x213a86,_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);return _0x7faf5(_0xad4f2c['error'][_0x89c4('0x14')]);}else{logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));_0x7faf5(_0xad4f2c['result'][_0x89c4('0x14')]);}})[_0x89c4('0x15')](function(_0xae1ed7){logger['error'](_0x89c4('0xd'),_0x213a86,_0xae1ed7);_0x26ab92(_0xae1ed7);});});}exports['GetDynamics365Account']=function(_0x29342c){var _0x477a19=this;return new Promise(function(_0x574f49,_0x456cf2){return db['Dynamics365Account']['findAll']({'raw':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x17')]===undefined?!![]:![]:!![],'where':_0x29342c['options']?_0x29342c[_0x89c4('0x16')]['where']||null:null,'attributes':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')]['attributes']||null:null,'limit':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x18')]||null:null,'include':_0x29342c[_0x89c4('0x16')]?_0x29342c[_0x89c4('0x16')][_0x89c4('0x19')]?_['map'](_0x29342c[_0x89c4('0x16')][_0x89c4('0x19')],function(_0x59e8ee){return{'model':db[_0x59e8ee[_0x89c4('0x1a')]],'as':_0x59e8ee['as'],'attributes':_0x59e8ee[_0x89c4('0x1b')],'include':_0x59e8ee[_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0x59e8ee[_0x89c4('0x19')],function(_0xa739bd){return{'model':db[_0xa739bd['model']],'as':_0xa739bd['as'],'attributes':_0xa739bd[_0x89c4('0x1b')],'include':_0xa739bd[_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0xa739bd[_0x89c4('0x19')],function(_0x17c9f9){return{'model':db[_0x17c9f9[_0x89c4('0x1a')]],'as':_0x17c9f9['as'],'attributes':_0x17c9f9[_0x89c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x89c4('0xb')](function(_0x256b9f){logger[_0x89c4('0xc')](_0x89c4('0x1d'),_0x29342c);logger[_0x89c4('0xf')](_0x89c4('0x1d'),_0x29342c,JSON[_0x89c4('0x11')](_0x256b9f));_0x574f49(_0x256b9f);})['catch'](function(_0x5e9b35){logger[_0x89c4('0x12')]('GetDynamics365Account',_0x5e9b35[_0x89c4('0x14')],_0x29342c);_0x456cf2(_0x477a19[_0x89c4('0x12')](0x1f4,_0x5e9b35[_0x89c4('0x14')]));});});};exports[_0x89c4('0x1e')]=function(_0x2c732a){var _0x24f61e=this;return new Promise(function(_0x35c1fb,_0x107222){return db[_0x89c4('0x1f')][_0x89c4('0x20')]({'raw':_0x2c732a[_0x89c4('0x16')]?_0x2c732a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c732a['options']?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x21')]||null:null,'attributes':_0x2c732a[_0x89c4('0x16')]?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x1b')]||null:null,'include':_0x2c732a[_0x89c4('0x16')]?_0x2c732a[_0x89c4('0x16')][_0x89c4('0x19')]?_[_0x89c4('0x1c')](_0x2c732a[_0x89c4('0x16')][_0x89c4('0x19')],function(_0x7ed242){return{'model':db[_0x7ed242['model']],'as':_0x7ed242['as'],'attributes':_0x7ed242[_0x89c4('0x1b')],'include':_0x7ed242['include']?_['map'](_0x7ed242[_0x89c4('0x19')],function(_0x2f92b0){return{'model':db[_0x2f92b0[_0x89c4('0x1a')]],'as':_0x2f92b0['as'],'attributes':_0x2f92b0[_0x89c4('0x1b')],'include':_0x2f92b0[_0x89c4('0x19')]?_['map'](_0x2f92b0[_0x89c4('0x19')],function(_0x140680){return{'model':db[_0x140680[_0x89c4('0x1a')]],'as':_0x140680['as'],'attributes':_0x140680['attributes']};}):[]};}):[]};}):[]:[]})[_0x89c4('0xb')](function(_0x483239){logger[_0x89c4('0xc')](_0x89c4('0x1e'),_0x2c732a);logger[_0x89c4('0xf')](_0x89c4('0x1e'),_0x2c732a,JSON[_0x89c4('0x11')](_0x483239));_0x35c1fb(_0x483239);})[_0x89c4('0x15')](function(_0x941071){logger[_0x89c4('0x12')](_0x89c4('0x1e'),_0x941071[_0x89c4('0x14')],_0x2c732a);_0x107222(_0x24f61e[_0x89c4('0x12')](0x1f4,_0x941071[_0x89c4('0x14')]));});});}; \ No newline at end of file +var _0x3641=['where','attributes','include','map','model','find','raw','ShowDynamics365Account','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x5beaac,_0x2403e4){var _0x97371e=function(_0x4858f4){while(--_0x4858f4){_0x5beaac['push'](_0x5beaac['shift']());}};_0x97371e(++_0x2403e4);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1364('0x1'));var fs=require('fs');var Redis=require(_0x1364('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1364('0x3'));var logger=require(_0x1364('0x4'))(_0x1364('0x5'));var config=require('../../config/environment');var jayson=require(_0x1364('0x6'));var client=jayson['client'][_0x1364('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x278f40,_0x344ee7,_0x5ef8ba){return new BPromise(function(_0xb5d644,_0x153620){return client[_0x1364('0x8')](_0x278f40,_0x5ef8ba)[_0x1364('0x9')](function(_0x72d53a){logger[_0x1364('0xa')](_0x1364('0xb'),_0x344ee7,_0x1364('0xc'));logger[_0x1364('0xd')](_0x1364('0xe'),_0x344ee7,_0x1364('0xc'),JSON[_0x1364('0xf')](_0x72d53a));if(_0x72d53a['error']){if(_0x72d53a['error'][_0x1364('0x10')]===0x1f4){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0x153620(_0x72d53a['error'][_0x1364('0x12')]);}logger[_0x1364('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0xb5d644(_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x344ee7,_0x1364('0xc'));_0xb5d644(_0x72d53a[_0x1364('0x13')][_0x1364('0x12')]);}})[_0x1364('0x14')](function(_0x265be7){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x265be7);_0x153620(_0x265be7);});});}exports[_0x1364('0x15')]=function(_0x4e7b68){var _0x5f0f59=this;return new Promise(function(_0x9423d5,_0x5cf4cd){return db[_0x1364('0x16')][_0x1364('0x17')]({'raw':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')][_0x1364('0x19')]||null:null,'attributes':_0x4e7b68['options']?_0x4e7b68[_0x1364('0x18')][_0x1364('0x1a')]||null:null,'limit':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')]['limit']||null:null,'include':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')][_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x4e7b68[_0x1364('0x18')][_0x1364('0x1b')],function(_0x8bc79d){return{'model':db[_0x8bc79d[_0x1364('0x1d')]],'as':_0x8bc79d['as'],'attributes':_0x8bc79d[_0x1364('0x1a')],'include':_0x8bc79d[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x8bc79d[_0x1364('0x1b')],function(_0x35f0e3){return{'model':db[_0x35f0e3[_0x1364('0x1d')]],'as':_0x35f0e3['as'],'attributes':_0x35f0e3[_0x1364('0x1a')],'include':_0x35f0e3[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x35f0e3['include'],function(_0x117777){return{'model':db[_0x117777[_0x1364('0x1d')]],'as':_0x117777['as'],'attributes':_0x117777[_0x1364('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ae44c){logger[_0x1364('0xa')]('GetDynamics365Account',_0x4e7b68);logger[_0x1364('0xd')](_0x1364('0x15'),_0x4e7b68,JSON[_0x1364('0xf')](_0x5ae44c));_0x9423d5(_0x5ae44c);})[_0x1364('0x14')](function(_0x4f4438){logger[_0x1364('0x11')](_0x1364('0x15'),_0x4f4438[_0x1364('0x12')],_0x4e7b68);_0x5cf4cd(_0x5f0f59['error'](0x1f4,_0x4f4438[_0x1364('0x12')]));});});};exports['ShowDynamics365Account']=function(_0xf6fabe){var _0x32a611=this;return new Promise(function(_0x5a49a5,_0x4de9ea){return db[_0x1364('0x16')][_0x1364('0x1e')]({'raw':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1f')]===undefined?!![]:![]:!![],'where':_0xf6fabe[_0x1364('0x18')]?_0xf6fabe[_0x1364('0x18')][_0x1364('0x19')]||null:null,'attributes':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1a')]||null:null,'include':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1b')]?_[_0x1364('0x1c')](_0xf6fabe[_0x1364('0x18')]['include'],function(_0x566954){return{'model':db[_0x566954[_0x1364('0x1d')]],'as':_0x566954['as'],'attributes':_0x566954[_0x1364('0x1a')],'include':_0x566954[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x566954[_0x1364('0x1b')],function(_0x53b347){return{'model':db[_0x53b347['model']],'as':_0x53b347['as'],'attributes':_0x53b347[_0x1364('0x1a')],'include':_0x53b347['include']?_[_0x1364('0x1c')](_0x53b347[_0x1364('0x1b')],function(_0x52cd96){return{'model':db[_0x52cd96[_0x1364('0x1d')]],'as':_0x52cd96['as'],'attributes':_0x52cd96[_0x1364('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1364('0x9')](function(_0x4e655b){logger[_0x1364('0xa')]('ShowDynamics365Account',_0xf6fabe);logger[_0x1364('0xd')](_0x1364('0x20'),_0xf6fabe,JSON[_0x1364('0xf')](_0x4e655b));_0x5a49a5(_0x4e655b);})['catch'](function(_0x5a96d7){logger[_0x1364('0x11')](_0x1364('0x20'),_0x5a96d7[_0x1364('0x12')],_0xf6fabe);_0x4de9ea(_0x32a611[_0x1364('0x11')](0x1f4,_0x5a96d7['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2b2cefc..96dd299 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 _0x0dcb=['get','/:id','show','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x42fddb,_0x43d777){var _0x357157=function(_0x468368){while(--_0x468368){_0x42fddb['push'](_0x42fddb['shift']());}};_0x357157(++_0x43d777);}(_0x0dcb,0x142));var _0xb0dc=function(_0x535d70,_0x3f1899){_0x535d70=_0x535d70-0x0;var _0x115779=_0x0dcb[_0x535d70];return _0x115779;};'use strict';var multer=require(_0xb0dc('0x0'));var util=require(_0xb0dc('0x1'));var path=require(_0xb0dc('0x2'));var timeout=require(_0xb0dc('0x3'));var express=require(_0xb0dc('0x4'));var router=express['Router']();var auth=require(_0xb0dc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb0dc('0x6'));var controller=require(_0xb0dc('0x7'));router[_0xb0dc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb0dc('0x8')](_0xb0dc('0x9'),auth['isAuthenticated'](),controller[_0xb0dc('0xa')]);router[_0xb0dc('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb0dc('0xb')]);router[_0xb0dc('0x8')]('/:id/subjects',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0xd')]);router[_0xb0dc('0x8')](_0xb0dc('0xe'),auth['isAuthenticated'](),controller[_0xb0dc('0xf')]);router[_0xb0dc('0x10')]('/',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x11')]);router['put'](_0xb0dc('0x9'),auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x12')]);router[_0xb0dc('0x13')]('/:id',auth[_0xb0dc('0xc')](),controller[_0xb0dc('0x14')]);module[_0xb0dc('0x15')]=router; \ No newline at end of file +var _0x1727=['update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','getFields','get','/:id/subjects','getSubjects','getDescriptions','create','put','/:id'];(function(_0x561c69,_0x277e52){var _0x10351a=function(_0x2e5458){while(--_0x2e5458){_0x561c69['push'](_0x561c69['shift']());}};_0x10351a(++_0x277e52);}(_0x1727,0x17d));var _0x7172=function(_0x574b8a,_0x4ee093){_0x574b8a=_0x574b8a-0x0;var _0x47396b=_0x1727[_0x574b8a];return _0x47396b;};'use strict';var multer=require(_0x7172('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7172('0x1'));var express=require(_0x7172('0x2'));var router=express[_0x7172('0x3')]();var auth=require(_0x7172('0x4'));var interaction=require(_0x7172('0x5'));var config=require(_0x7172('0x6'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x7172('0x7')](),controller[_0x7172('0x8')]);router['get']('/:id',auth[_0x7172('0x7')](),controller[_0x7172('0x9')]);router['get']('/:id/fields',auth[_0x7172('0x7')](),controller[_0x7172('0xa')]);router[_0x7172('0xb')](_0x7172('0xc'),auth[_0x7172('0x7')](),controller[_0x7172('0xd')]);router[_0x7172('0xb')]('/:id/descriptions',auth[_0x7172('0x7')](),controller[_0x7172('0xe')]);router['post']('/',auth[_0x7172('0x7')](),controller[_0x7172('0xf')]);router[_0x7172('0x10')](_0x7172('0x11'),auth['isAuthenticated'](),controller[_0x7172('0x12')]);router['delete'](_0x7172('0x11'),auth['isAuthenticated'](),controller[_0x7172('0x13')]);module[_0x7172('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ec3f430..2f0b39d 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 _0xbcce=['phonecall','incident','sequelize','exports','STRING','ENUM'];(function(_0x50c70f,_0x1f70b1){var _0x1ffd85=function(_0x2f564a){while(--_0x2f564a){_0x50c70f['push'](_0x50c70f['shift']());}};_0x1ffd85(++_0x1f70b1);}(_0xbcce,0x1ee));var _0xebcc=function(_0x39ae02,_0x5ad02f){_0x39ae02=_0x39ae02-0x0;var _0x218278=_0xbcce[_0x39ae02];return _0x218278;};'use strict';var Sequelize=require(_0xebcc('0x0'));module[_0xebcc('0x1')]={'name':{'type':Sequelize[_0xebcc('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xebcc('0x3')]('incident',_0xebcc('0x4')),'defaultValue':_0xebcc('0x5')}}; \ No newline at end of file +var _0xebf6=['phonecall','sequelize','incident'];(function(_0x3b48e1,_0x3f6577){var _0x3080bc=function(_0x5ac696){while(--_0x5ac696){_0x3b48e1['push'](_0x3b48e1['shift']());}};_0x3080bc(++_0x3f6577);}(_0xebf6,0x184));var _0x6ebf=function(_0x2c11ec,_0x774faf){_0x2c11ec=_0x2c11ec-0x0;var _0x40a567=_0xebf6[_0x2c11ec];return _0x40a567;};'use strict';var Sequelize=require(_0x6ebf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x6ebf('0x1'),_0x6ebf('0x2')),'defaultValue':_0x6ebf('0x1')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4f42498..1ccf84f 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 _0x2faf=['find','create','body','getFields','findOne','pick','options','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','count','offset','set','Content-Range','save','update','destroy','then','sendStatus','stack','name','send','index','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','Dynamics365Configuration','rows','params','rawAttributes','length'];(function(_0x301dbb,_0x45dcec){var _0x1d7567=function(_0x158510){while(--_0x158510){_0x301dbb['push'](_0x301dbb['shift']());}};_0x1d7567(++_0x45dcec);}(_0x2faf,0x16a));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xf2fa('0x0'));var emlformat=require(_0xf2fa('0x1'));var rimraf=require(_0xf2fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2fa('0x3'));var rp=require(_0xf2fa('0x4'));var moment=require(_0xf2fa('0x5'));var BPromise=require(_0xf2fa('0x6'));var Mustache=require(_0xf2fa('0x7'));var util=require(_0xf2fa('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf2fa('0x9'));var ejs=require(_0xf2fa('0xa'));var fs=require('fs');var _=require(_0xf2fa('0xb'));var squel=require(_0xf2fa('0xc'));var crypto=require(_0xf2fa('0xd'));var jsforce=require(_0xf2fa('0xe'));var deskjs=require(_0xf2fa('0xf'));var toCsv=require(_0xf2fa('0x9'));var querystring=require(_0xf2fa('0x10'));var Papa=require(_0xf2fa('0x11'));var Redis=require('ioredis');var authService=require(_0xf2fa('0x12'));var qs=require(_0xf2fa('0x13'));var as=require(_0xf2fa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2fa('0x15'));var utils=require(_0xf2fa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf2fa('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf2fa('0x18'));var client=jayson[_0xf2fa('0x19')][_0xf2fa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x59fd5f,_0x5d0f04,_0x2e017f,_0xd1e5e2){return new BPromise(function(_0x2edc95,_0x305cd7){var _0x57f790=_0xd1e5e2||client;return _0x57f790[_0xf2fa('0x1b')](_0x59fd5f,_0x2e017f)['then'](function(_0x5da111){logger['info'](_0xf2fa('0x1c'),_0x5d0f04,_0xf2fa('0x1d'));logger[_0xf2fa('0x1e')](_0xf2fa('0x1f'),_0x5d0f04,_0xf2fa('0x1d'),JSON[_0xf2fa('0x20')](_0x5da111));if(_0x5da111['error']){if(_0x5da111[_0xf2fa('0x21')]['code']===0x1f4){logger[_0xf2fa('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d0f04,_0x5da111[_0xf2fa('0x21')]['message']);return _0x305cd7(_0x5da111[_0xf2fa('0x21')][_0xf2fa('0x22')]);}logger[_0xf2fa('0x21')](_0xf2fa('0x1c'),_0x5d0f04,_0x5da111['error'][_0xf2fa('0x22')]);return _0x2edc95(_0x5da111[_0xf2fa('0x21')][_0xf2fa('0x22')]);}else{logger[_0xf2fa('0x23')](_0xf2fa('0x1c'),_0x5d0f04,_0xf2fa('0x1d'));_0x2edc95(_0x5da111[_0xf2fa('0x24')][_0xf2fa('0x22')]);}})[_0xf2fa('0x25')](function(_0x46fa70){logger[_0xf2fa('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d0f04,_0x46fa70);_0x305cd7(_0x46fa70);});});}function respondWithStatusCode(_0x2cbb33,_0x337065){_0x337065=_0x337065||0xcc;return function(_0x36f8b9){if(_0x36f8b9){return _0x2cbb33['sendStatus'](_0x337065);}return _0x2cbb33[_0xf2fa('0x26')](_0x337065)[_0xf2fa('0x27')]();};}function respondWithResult(_0x4a88a7,_0x149ed2){_0x149ed2=_0x149ed2||0xc8;return function(_0x45999a){if(_0x45999a){return _0x4a88a7[_0xf2fa('0x26')](_0x149ed2)[_0xf2fa('0x28')](_0x45999a);}};}function respondWithFilteredResult(_0x1efcbb,_0x591df1){return function(_0xdc8f86){if(_0xdc8f86){var _0x741392=_0xdc8f86[_0xf2fa('0x29')],_0x33b0ad=_0x591df1['offset'],_0x555e0f=_0x591df1[_0xf2fa('0x2a')]+_0x591df1['limit'],_0x994f05;if(_0x555e0f>=_0x741392){_0x555e0f=_0x741392;_0x994f05=0xc8;}else{_0x994f05=0xce;}_0x1efcbb[_0xf2fa('0x26')](_0x994f05);return _0x1efcbb[_0xf2fa('0x2b')](_0xf2fa('0x2c'),_0x33b0ad+'-'+_0x555e0f+'/'+_0x741392)['json'](_0xdc8f86);}return null;};}function patchUpdates(_0x178716){return function(_0x332c5b){try{jsonpatch['apply'](_0x332c5b,_0x178716,!![]);}catch(_0x45115f){return BPromise['reject'](_0x45115f);}return _0x332c5b[_0xf2fa('0x2d')]();};}function saveUpdates(_0x157399,_0x30c7f0){return function(_0x30732a){if(_0x30732a){return _0x30732a[_0xf2fa('0x2e')](_0x157399)['then'](function(_0x15d67e){return _0x15d67e;});}return null;};}function removeEntity(_0x2df034,_0x178726){return function(_0x97ba52){if(_0x97ba52){return _0x97ba52[_0xf2fa('0x2f')]()[_0xf2fa('0x30')](function(){_0x2df034[_0xf2fa('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x457e15,_0x44bef5){return function(_0x11727d){if(!_0x11727d){_0x457e15[_0xf2fa('0x31')](0x194);}return _0x11727d;};}function handleError(_0x4caac1,_0x2b8ddc){_0x2b8ddc=_0x2b8ddc||0x1f4;return function(_0x769361){logger[_0xf2fa('0x21')](_0x769361[_0xf2fa('0x32')]);if(_0x769361[_0xf2fa('0x33')]){delete _0x769361[_0xf2fa('0x33')];}_0x4caac1[_0xf2fa('0x26')](_0x2b8ddc)[_0xf2fa('0x34')](_0x769361);};}exports[_0xf2fa('0x35')]=function(_0x5337bb,_0x428b0a){var _0x35bbdc={},_0x51c98c={},_0x32e5b2={'count':0x0,'rows':[]};var _0x49cce7=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0xd1129a){return{'name':_0xd1129a[_0xf2fa('0x36')],'type':_0xd1129a['type']['key']};});_0x51c98c['model']=_[_0xf2fa('0x37')](_0x49cce7,_0xf2fa('0x33'));_0x51c98c[_0xf2fa('0x38')]=_[_0xf2fa('0x39')](_0x5337bb[_0xf2fa('0x38')]);_0x51c98c[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x51c98c[_0xf2fa('0x3c')],_0x51c98c['query']);_0x35bbdc[_0xf2fa('0x3d')]=_['intersection'](_0x51c98c[_0xf2fa('0x3c')],qs[_0xf2fa('0x3e')](_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0x35bbdc['attributes']=_0x35bbdc[_0xf2fa('0x3d')]['length']?_0x35bbdc[_0xf2fa('0x3d')]:_0x51c98c[_0xf2fa('0x3c')];if(!_0x5337bb['query'][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0x35bbdc['limit']=qs[_0xf2fa('0x41')](_0x5337bb[_0xf2fa('0x38')]['limit']);_0x35bbdc[_0xf2fa('0x2a')]=qs[_0xf2fa('0x2a')](_0x5337bb['query'][_0xf2fa('0x2a')]);}_0x35bbdc[_0xf2fa('0x42')]=qs['sort'](_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x43')]);_0x35bbdc[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_['pick'](_0x5337bb[_0xf2fa('0x38')],_0x51c98c['filters']),_0x49cce7);if(_0x5337bb[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0x35bbdc[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x35bbdc[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0x49cce7,function(_0x358b85){if(_0x358b85[_0xf2fa('0x47')]!==_0xf2fa('0x48')){var _0x5157f5={};_0x5157f5[_0x358b85[_0xf2fa('0x33')]]={'$like':'%'+_0x5337bb['query']['filter']+'%'};return _0x5157f5;}})});}_0x35bbdc=_['merge']({},_0x35bbdc,_0x5337bb['options']);var _0x391ca2={'where':_0x35bbdc[_0xf2fa('0x44')]};return db[_0xf2fa('0x49')]['count'](_0x391ca2)[_0xf2fa('0x30')](function(_0x2abd01){_0x32e5b2[_0xf2fa('0x29')]=_0x2abd01;if(_0x5337bb[_0xf2fa('0x38')]['includeAll']){_0x35bbdc['include']=[{'all':!![]}];}return db[_0xf2fa('0x49')]['findAll'](_0x35bbdc);})['then'](function(_0x3d0eac){_0x32e5b2[_0xf2fa('0x4a')]=_0x3d0eac;return _0x32e5b2;})[_0xf2fa('0x30')](respondWithFilteredResult(_0x428b0a,_0x35bbdc))[_0xf2fa('0x25')](handleError(_0x428b0a,null));};exports['show']=function(_0x47eea9,_0x5e544c){var _0xa77ac5={'raw':![],'where':{'id':_0x47eea9[_0xf2fa('0x4b')]['id']}},_0xae0487={};_0xae0487[_0xf2fa('0x3c')]=_[_0xf2fa('0x39')](db['Dynamics365Configuration'][_0xf2fa('0x4c')]);_0xae0487[_0xf2fa('0x38')]=_['keys'](_0x47eea9['query']);_0xae0487[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0xae0487[_0xf2fa('0x3c')],_0xae0487['query']);_0xa77ac5['attributes']=_[_0xf2fa('0x3b')](_0xae0487['model'],qs[_0xf2fa('0x3e')](_0x47eea9[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0xa77ac5['attributes']=_0xa77ac5[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0xa77ac5[_0xf2fa('0x3d')]:_0xae0487[_0xf2fa('0x3c')];if(_0x47eea9['query']['includeAll']){_0xa77ac5['include']=[{'all':!![]}];}_0xa77ac5=_[_0xf2fa('0x46')]({},_0xa77ac5,_0x47eea9['options']);return db[_0xf2fa('0x49')][_0xf2fa('0x4e')](_0xa77ac5)['then'](handleEntityNotFound(_0x5e544c,null))[_0xf2fa('0x30')](respondWithResult(_0x5e544c,null))[_0xf2fa('0x25')](handleError(_0x5e544c,null));};exports[_0xf2fa('0x4f')]=function(_0x56c8ac,_0x5c65e0){return db['Dynamics365Configuration'][_0xf2fa('0x4f')](_0x56c8ac[_0xf2fa('0x50')],{})[_0xf2fa('0x30')](respondWithResult(_0x5c65e0,0xc9))['catch'](handleError(_0x5c65e0,null));};exports[_0xf2fa('0x2e')]=function(_0x5b176b,_0x21c775){if(_0x5b176b[_0xf2fa('0x50')]['id']){delete _0x5b176b[_0xf2fa('0x50')]['id'];}return db['Dynamics365Configuration'][_0xf2fa('0x4e')]({'where':{'id':_0x5b176b['params']['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x21c775,null))['then'](saveUpdates(_0x5b176b['body'],null))['then'](respondWithResult(_0x21c775,null))[_0xf2fa('0x25')](handleError(_0x21c775,null));};exports[_0xf2fa('0x2f')]=function(_0x2d6d6,_0x436f82){return db[_0xf2fa('0x49')][_0xf2fa('0x4e')]({'where':{'id':_0x2d6d6[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x436f82,null))['then'](removeEntity(_0x436f82,null))[_0xf2fa('0x25')](handleError(_0x436f82,null));};exports[_0xf2fa('0x51')]=function(_0x2fe5eb,_0x4e8d99,_0x4f6d9b){var _0x3bc634={};var _0x468a75={};var _0x11de54;var _0x1e7992;return db[_0xf2fa('0x49')][_0xf2fa('0x52')]({'where':{'id':_0x2fe5eb[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x4e8d99,null))[_0xf2fa('0x30')](function(_0x2cb0c3){if(_0x2cb0c3){_0x11de54=_0x2cb0c3;_0x468a75['model']=_['keys'](db['Dynamics365Field'][_0xf2fa('0x4c')]);_0x468a75[_0xf2fa('0x38')]=_[_0xf2fa('0x39')](_0x2fe5eb[_0xf2fa('0x38')]);_0x468a75[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x468a75[_0xf2fa('0x3c')],_0x468a75[_0xf2fa('0x38')]);_0x3bc634[_0xf2fa('0x3d')]=_['intersection'](_0x468a75['model'],qs[_0xf2fa('0x3e')](_0x2fe5eb[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0x3bc634[_0xf2fa('0x3d')]=_0x3bc634[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0x3bc634[_0xf2fa('0x3d')]:_0x468a75[_0xf2fa('0x3c')];_0x3bc634[_0xf2fa('0x42')]=qs['sort'](_0x2fe5eb[_0xf2fa('0x38')]['sort']);_0x3bc634[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_[_0xf2fa('0x53')](_0x2fe5eb[_0xf2fa('0x38')],_0x468a75[_0xf2fa('0x3a')]));if(_0x2fe5eb[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0x3bc634[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x3bc634[_0xf2fa('0x44')],{'$or':_['map'](_0x3bc634['attributes'],function(_0x10c54c){var _0x44add6={};_0x44add6[_0x10c54c]={'$like':'%'+_0x2fe5eb['query']['filter']+'%'};return _0x44add6;})});}_0x3bc634=_['merge']({},_0x3bc634,_0x2fe5eb[_0xf2fa('0x54')]);return _0x11de54[_0xf2fa('0x51')](_0x3bc634);}})[_0xf2fa('0x30')](function(_0x40e923){if(_0x40e923){_0x1e7992=_0x40e923[_0xf2fa('0x4d')];if(!_0x2fe5eb[_0xf2fa('0x38')]['hasOwnProperty'](_0xf2fa('0x40'))){_0x3bc634[_0xf2fa('0x41')]=qs['limit'](_0x2fe5eb[_0xf2fa('0x38')]['limit']);_0x3bc634[_0xf2fa('0x2a')]=qs[_0xf2fa('0x2a')](_0x2fe5eb['query'][_0xf2fa('0x2a')]);}return _0x11de54[_0xf2fa('0x51')](_0x3bc634);}})['then'](function(_0x1d921a){if(_0x1d921a){return _0x1d921a?{'count':_0x1e7992,'rows':_0x1d921a}:null;}})[_0xf2fa('0x30')](respondWithResult(_0x4e8d99,null))[_0xf2fa('0x25')](handleError(_0x4e8d99,null));};exports[_0xf2fa('0x55')]=function(_0x2f0f59,_0x4349d8,_0x51377a){var _0xfb8e1d={};var _0x5390ee={};var _0xc6642b;var _0x2ca85c;return db[_0xf2fa('0x49')][_0xf2fa('0x52')]({'where':{'id':_0x2f0f59[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x4349d8,null))[_0xf2fa('0x30')](function(_0x4933c8){if(_0x4933c8){_0xc6642b=_0x4933c8;_0x5390ee['model']=_['keys'](db[_0xf2fa('0x56')]['rawAttributes']);_0x5390ee[_0xf2fa('0x38')]=_['keys'](_0x2f0f59['query']);_0x5390ee['filters']=_[_0xf2fa('0x3b')](_0x5390ee[_0xf2fa('0x3c')],_0x5390ee[_0xf2fa('0x38')]);_0xfb8e1d['attributes']=_[_0xf2fa('0x3b')](_0x5390ee[_0xf2fa('0x3c')],qs['fields'](_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x3e')]));_0xfb8e1d[_0xf2fa('0x3d')]=_0xfb8e1d[_0xf2fa('0x3d')][_0xf2fa('0x4d')]?_0xfb8e1d[_0xf2fa('0x3d')]:_0x5390ee[_0xf2fa('0x3c')];_0xfb8e1d['order']=qs[_0xf2fa('0x43')](_0x2f0f59['query'][_0xf2fa('0x43')]);_0xfb8e1d['where']=qs['filters'](_[_0xf2fa('0x53')](_0x2f0f59[_0xf2fa('0x38')],_0x5390ee[_0xf2fa('0x3a')]));if(_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x45')]){_0xfb8e1d[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0xfb8e1d[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0xfb8e1d[_0xf2fa('0x3d')],function(_0x14dfad){var _0x3c62b7={};_0x3c62b7[_0x14dfad]={'$like':'%'+_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x45')]+'%'};return _0x3c62b7;})});}_0xfb8e1d=_[_0xf2fa('0x46')]({},_0xfb8e1d,_0x2f0f59[_0xf2fa('0x54')]);return _0xc6642b['getSubjects'](_0xfb8e1d);}})[_0xf2fa('0x30')](function(_0x533c46){if(_0x533c46){_0x2ca85c=_0x533c46['length'];if(!_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0xfb8e1d[_0xf2fa('0x41')]=qs['limit'](_0x2f0f59[_0xf2fa('0x38')][_0xf2fa('0x41')]);_0xfb8e1d['offset']=qs[_0xf2fa('0x2a')](_0x2f0f59['query'][_0xf2fa('0x2a')]);}return _0xc6642b[_0xf2fa('0x55')](_0xfb8e1d);}})[_0xf2fa('0x30')](function(_0x20f79f){if(_0x20f79f){return _0x20f79f?{'count':_0x2ca85c,'rows':_0x20f79f}:null;}})['then'](respondWithResult(_0x4349d8,null))[_0xf2fa('0x25')](handleError(_0x4349d8,null));};exports[_0xf2fa('0x57')]=function(_0x3db2a9,_0x5adebd,_0x3be0a3){var _0x1f4281={};var _0x171ce9={};var _0x17d6a5;var _0x24fc23;return db[_0xf2fa('0x49')]['findOne']({'where':{'id':_0x3db2a9[_0xf2fa('0x4b')]['id']}})[_0xf2fa('0x30')](handleEntityNotFound(_0x5adebd,null))[_0xf2fa('0x30')](function(_0x51c426){if(_0x51c426){_0x17d6a5=_0x51c426;_0x171ce9[_0xf2fa('0x3c')]=_[_0xf2fa('0x39')](db[_0xf2fa('0x56')][_0xf2fa('0x4c')]);_0x171ce9[_0xf2fa('0x38')]=_['keys'](_0x3db2a9['query']);_0x171ce9[_0xf2fa('0x3a')]=_[_0xf2fa('0x3b')](_0x171ce9['model'],_0x171ce9[_0xf2fa('0x38')]);_0x1f4281[_0xf2fa('0x3d')]=_[_0xf2fa('0x3b')](_0x171ce9[_0xf2fa('0x3c')],qs['fields'](_0x3db2a9['query'][_0xf2fa('0x3e')]));_0x1f4281[_0xf2fa('0x3d')]=_0x1f4281[_0xf2fa('0x3d')]['length']?_0x1f4281[_0xf2fa('0x3d')]:_0x171ce9[_0xf2fa('0x3c')];_0x1f4281[_0xf2fa('0x42')]=qs[_0xf2fa('0x43')](_0x3db2a9[_0xf2fa('0x38')]['sort']);_0x1f4281[_0xf2fa('0x44')]=qs[_0xf2fa('0x3a')](_[_0xf2fa('0x53')](_0x3db2a9[_0xf2fa('0x38')],_0x171ce9[_0xf2fa('0x3a')]));if(_0x3db2a9[_0xf2fa('0x38')]['filter']){_0x1f4281[_0xf2fa('0x44')]=_[_0xf2fa('0x46')](_0x1f4281[_0xf2fa('0x44')],{'$or':_[_0xf2fa('0x37')](_0x1f4281['attributes'],function(_0x32db25){var _0x1afa30={};_0x1afa30[_0x32db25]={'$like':'%'+_0x3db2a9['query'][_0xf2fa('0x45')]+'%'};return _0x1afa30;})});}_0x1f4281=_['merge']({},_0x1f4281,_0x3db2a9['options']);return _0x17d6a5['getDescriptions'](_0x1f4281);}})[_0xf2fa('0x30')](function(_0x595b68){if(_0x595b68){_0x24fc23=_0x595b68[_0xf2fa('0x4d')];if(!_0x3db2a9[_0xf2fa('0x38')][_0xf2fa('0x3f')](_0xf2fa('0x40'))){_0x1f4281['limit']=qs[_0xf2fa('0x41')](_0x3db2a9[_0xf2fa('0x38')][_0xf2fa('0x41')]);_0x1f4281[_0xf2fa('0x2a')]=qs['offset'](_0x3db2a9[_0xf2fa('0x38')]['offset']);}return _0x17d6a5[_0xf2fa('0x57')](_0x1f4281);}})[_0xf2fa('0x30')](function(_0x113c32){if(_0x113c32){return _0x113c32?{'count':_0x24fc23,'rows':_0x113c32}:null;}})[_0xf2fa('0x30')](respondWithResult(_0x5adebd,null))[_0xf2fa('0x25')](handleError(_0x5adebd,null));}; \ No newline at end of file +var _0x475d=['findOne','nolimit','getSubjects','getDescriptions','Dynamics365Field','html-pdf','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','find','getFields'];(function(_0x1ba08a,_0x1af78b){var _0x5c6ead=function(_0x5a2c8c){while(--_0x5a2c8c){_0x1ba08a['push'](_0x1ba08a['shift']());}};_0x5c6ead(++_0x1af78b);}(_0x475d,0x110));var _0xd475=function(_0x4973ff,_0x30abe4){_0x4973ff=_0x4973ff-0x0;var _0x4dd6b6=_0x475d[_0x4973ff];return _0x4dd6b6;};'use strict';var pdf=require(_0xd475('0x0'));var emlformat=require(_0xd475('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd475('0x2'));var moment=require('moment');var BPromise=require(_0xd475('0x3'));var Mustache=require(_0xd475('0x4'));var util=require('util');var path=require(_0xd475('0x5'));var sox=require(_0xd475('0x6'));var csv=require(_0xd475('0x7'));var ejs=require(_0xd475('0x8'));var fs=require('fs');var _=require(_0xd475('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd475('0xa'));var deskjs=require(_0xd475('0xb'));var toCsv=require(_0xd475('0x7'));var querystring=require(_0xd475('0xc'));var Papa=require(_0xd475('0xd'));var Redis=require(_0xd475('0xe'));var authService=require(_0xd475('0xf'));var qs=require(_0xd475('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd475('0x11'))(_0xd475('0x12'));var utils=require(_0xd475('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd475('0x14'));var db=require(_0xd475('0x15'))['db'];var jayson=require(_0xd475('0x16'));var client=jayson[_0xd475('0x17')][_0xd475('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3721c3,_0x271ad2,_0x248f95,_0xff2b34){return new BPromise(function(_0x2ccd76,_0x55a137){var _0x43a1f8=_0xff2b34||client;return _0x43a1f8[_0xd475('0x19')](_0x3721c3,_0x248f95)['then'](function(_0x20d980){logger[_0xd475('0x1a')](_0xd475('0x1b'),_0x271ad2,_0xd475('0x1c'));logger['debug'](_0xd475('0x1d'),_0x271ad2,_0xd475('0x1c'),JSON['stringify'](_0x20d980));if(_0x20d980[_0xd475('0x1e')]){if(_0x20d980[_0xd475('0x1e')][_0xd475('0x1f')]===0x1f4){logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0x20d980['error']['message']);return _0x55a137(_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);}logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);return _0x2ccd76(_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);}else{logger[_0xd475('0x1a')](_0xd475('0x1b'),_0x271ad2,_0xd475('0x1c'));_0x2ccd76(_0x20d980[_0xd475('0x21')]['message']);}})[_0xd475('0x22')](function(_0xf61e99){logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0xf61e99);_0x55a137(_0xf61e99);});});}function respondWithStatusCode(_0x3d30c6,_0x5dac8e){_0x5dac8e=_0x5dac8e||0xcc;return function(_0x65f253){if(_0x65f253){return _0x3d30c6[_0xd475('0x23')](_0x5dac8e);}return _0x3d30c6[_0xd475('0x24')](_0x5dac8e)[_0xd475('0x25')]();};}function respondWithResult(_0x46ef18,_0xf8704c){_0xf8704c=_0xf8704c||0xc8;return function(_0xabe678){if(_0xabe678){return _0x46ef18[_0xd475('0x24')](_0xf8704c)['json'](_0xabe678);}};}function respondWithFilteredResult(_0x2c1e02,_0x2a586e){return function(_0x559a2a){if(_0x559a2a){var _0x492320=_0x559a2a['count'],_0x1dc9af=_0x2a586e[_0xd475('0x26')],_0x3df461=_0x2a586e[_0xd475('0x26')]+_0x2a586e[_0xd475('0x27')],_0x33840c;if(_0x3df461>=_0x492320){_0x3df461=_0x492320;_0x33840c=0xc8;}else{_0x33840c=0xce;}_0x2c1e02[_0xd475('0x24')](_0x33840c);return _0x2c1e02[_0xd475('0x28')]('Content-Range',_0x1dc9af+'-'+_0x3df461+'/'+_0x492320)['json'](_0x559a2a);}return null;};}function patchUpdates(_0x452eab){return function(_0x1bd858){try{jsonpatch[_0xd475('0x29')](_0x1bd858,_0x452eab,!![]);}catch(_0x148b16){return BPromise[_0xd475('0x2a')](_0x148b16);}return _0x1bd858[_0xd475('0x2b')]();};}function saveUpdates(_0x1d1eda,_0x3f8867){return function(_0x45943f){if(_0x45943f){return _0x45943f[_0xd475('0x2c')](_0x1d1eda)['then'](function(_0x4e3e61){return _0x4e3e61;});}return null;};}function removeEntity(_0x21d941,_0x46682b){return function(_0x2d3610){if(_0x2d3610){return _0x2d3610[_0xd475('0x2d')]()[_0xd475('0x2e')](function(){_0x21d941[_0xd475('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a27c,_0x38bcde){return function(_0x40b533){if(!_0x40b533){_0x52a27c[_0xd475('0x23')](0x194);}return _0x40b533;};}function handleError(_0xbaed8,_0x1eb739){_0x1eb739=_0x1eb739||0x1f4;return function(_0x1047df){logger['error'](_0x1047df[_0xd475('0x2f')]);if(_0x1047df['name']){delete _0x1047df[_0xd475('0x30')];}_0xbaed8[_0xd475('0x24')](_0x1eb739)[_0xd475('0x31')](_0x1047df);};}exports[_0xd475('0x32')]=function(_0x1cc186,_0x3bdd5f){var _0x5febe5={},_0x34f8c4={},_0xb7036b={'count':0x0,'rows':[]};var _0x234be9=_[_0xd475('0x33')](db[_0xd475('0x34')][_0xd475('0x35')],function(_0x612fa5){return{'name':_0x612fa5['fieldName'],'type':_0x612fa5[_0xd475('0x36')][_0xd475('0x37')]};});_0x34f8c4[_0xd475('0x38')]=_['map'](_0x234be9,'name');_0x34f8c4['query']=_[_0xd475('0x39')](_0x1cc186[_0xd475('0x3a')]);_0x34f8c4[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x34f8c4[_0xd475('0x38')],_0x34f8c4[_0xd475('0x3a')]);_0x5febe5[_0xd475('0x3d')]=_[_0xd475('0x3c')](_0x34f8c4[_0xd475('0x38')],qs['fields'](_0x1cc186[_0xd475('0x3a')][_0xd475('0x3e')]));_0x5febe5[_0xd475('0x3d')]=_0x5febe5[_0xd475('0x3d')][_0xd475('0x3f')]?_0x5febe5[_0xd475('0x3d')]:_0x34f8c4['model'];if(!_0x1cc186[_0xd475('0x3a')][_0xd475('0x40')]('nolimit')){_0x5febe5[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x1cc186[_0xd475('0x3a')][_0xd475('0x27')]);_0x5febe5['offset']=qs['offset'](_0x1cc186[_0xd475('0x3a')][_0xd475('0x26')]);}_0x5febe5[_0xd475('0x41')]=qs[_0xd475('0x42')](_0x1cc186[_0xd475('0x3a')][_0xd475('0x42')]);_0x5febe5[_0xd475('0x43')]=qs['filters'](_[_0xd475('0x44')](_0x1cc186[_0xd475('0x3a')],_0x34f8c4[_0xd475('0x3b')]),_0x234be9);if(_0x1cc186['query'][_0xd475('0x45')]){_0x5febe5['where']=_[_0xd475('0x46')](_0x5febe5[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x234be9,function(_0x32d72a){if(_0x32d72a[_0xd475('0x36')]!==_0xd475('0x47')){var _0x212496={};_0x212496[_0x32d72a['name']]={'$like':'%'+_0x1cc186[_0xd475('0x3a')]['filter']+'%'};return _0x212496;}})});}_0x5febe5=_[_0xd475('0x46')]({},_0x5febe5,_0x1cc186[_0xd475('0x48')]);var _0x53b89f={'where':_0x5febe5[_0xd475('0x43')]};return db['Dynamics365Configuration'][_0xd475('0x49')](_0x53b89f)[_0xd475('0x2e')](function(_0x4e1aa5){_0xb7036b[_0xd475('0x49')]=_0x4e1aa5;if(_0x1cc186['query'][_0xd475('0x4a')]){_0x5febe5[_0xd475('0x4b')]=[{'all':!![]}];}return db[_0xd475('0x34')][_0xd475('0x4c')](_0x5febe5);})['then'](function(_0x24858f){_0xb7036b[_0xd475('0x4d')]=_0x24858f;return _0xb7036b;})[_0xd475('0x2e')](respondWithFilteredResult(_0x3bdd5f,_0x5febe5))[_0xd475('0x22')](handleError(_0x3bdd5f,null));};exports[_0xd475('0x4e')]=function(_0x4614f5,_0x26c7e8){var _0x37f3f4={'raw':![],'where':{'id':_0x4614f5[_0xd475('0x4f')]['id']}},_0x3f1d86={};_0x3f1d86[_0xd475('0x38')]=_[_0xd475('0x39')](db[_0xd475('0x34')]['rawAttributes']);_0x3f1d86[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x4614f5[_0xd475('0x3a')]);_0x3f1d86['filters']=_['intersection'](_0x3f1d86[_0xd475('0x38')],_0x3f1d86[_0xd475('0x3a')]);_0x37f3f4[_0xd475('0x3d')]=_['intersection'](_0x3f1d86['model'],qs[_0xd475('0x3e')](_0x4614f5[_0xd475('0x3a')][_0xd475('0x3e')]));_0x37f3f4['attributes']=_0x37f3f4[_0xd475('0x3d')][_0xd475('0x3f')]?_0x37f3f4[_0xd475('0x3d')]:_0x3f1d86[_0xd475('0x38')];if(_0x4614f5[_0xd475('0x3a')][_0xd475('0x4a')]){_0x37f3f4[_0xd475('0x4b')]=[{'all':!![]}];}_0x37f3f4=_[_0xd475('0x46')]({},_0x37f3f4,_0x4614f5['options']);return db[_0xd475('0x34')]['find'](_0x37f3f4)[_0xd475('0x2e')](handleEntityNotFound(_0x26c7e8,null))['then'](respondWithResult(_0x26c7e8,null))['catch'](handleError(_0x26c7e8,null));};exports['create']=function(_0x3d5bd5,_0x6989f9){return db[_0xd475('0x34')][_0xd475('0x50')](_0x3d5bd5[_0xd475('0x51')],{})[_0xd475('0x2e')](respondWithResult(_0x6989f9,0xc9))['catch'](handleError(_0x6989f9,null));};exports[_0xd475('0x2c')]=function(_0x1c8071,_0x4a95db){if(_0x1c8071['body']['id']){delete _0x1c8071[_0xd475('0x51')]['id'];}return db[_0xd475('0x34')][_0xd475('0x52')]({'where':{'id':_0x1c8071[_0xd475('0x4f')]['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x4a95db,null))[_0xd475('0x2e')](saveUpdates(_0x1c8071['body'],null))['then'](respondWithResult(_0x4a95db,null))[_0xd475('0x22')](handleError(_0x4a95db,null));};exports[_0xd475('0x2d')]=function(_0x511014,_0x5d403f){return db[_0xd475('0x34')]['find']({'where':{'id':_0x511014[_0xd475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d403f,null))[_0xd475('0x2e')](removeEntity(_0x5d403f,null))[_0xd475('0x22')](handleError(_0x5d403f,null));};exports[_0xd475('0x53')]=function(_0x40d72c,_0x39df07,_0xcca883){var _0x594b0b={};var _0x5def05={};var _0xf6fd79;var _0x139454;return db['Dynamics365Configuration'][_0xd475('0x54')]({'where':{'id':_0x40d72c[_0xd475('0x4f')]['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x39df07,null))[_0xd475('0x2e')](function(_0x532222){if(_0x532222){_0xf6fd79=_0x532222;_0x5def05[_0xd475('0x38')]=_[_0xd475('0x39')](db['Dynamics365Field'][_0xd475('0x35')]);_0x5def05[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x40d72c[_0xd475('0x3a')]);_0x5def05[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x5def05[_0xd475('0x38')],_0x5def05[_0xd475('0x3a')]);_0x594b0b['attributes']=_[_0xd475('0x3c')](_0x5def05[_0xd475('0x38')],qs[_0xd475('0x3e')](_0x40d72c[_0xd475('0x3a')]['fields']));_0x594b0b[_0xd475('0x3d')]=_0x594b0b[_0xd475('0x3d')][_0xd475('0x3f')]?_0x594b0b[_0xd475('0x3d')]:_0x5def05[_0xd475('0x38')];_0x594b0b[_0xd475('0x41')]=qs['sort'](_0x40d72c[_0xd475('0x3a')][_0xd475('0x42')]);_0x594b0b[_0xd475('0x43')]=qs[_0xd475('0x3b')](_['pick'](_0x40d72c['query'],_0x5def05[_0xd475('0x3b')]));if(_0x40d72c[_0xd475('0x3a')][_0xd475('0x45')]){_0x594b0b['where']=_[_0xd475('0x46')](_0x594b0b[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x594b0b['attributes'],function(_0x359a05){var _0x4df1b6={};_0x4df1b6[_0x359a05]={'$like':'%'+_0x40d72c[_0xd475('0x3a')][_0xd475('0x45')]+'%'};return _0x4df1b6;})});}_0x594b0b=_[_0xd475('0x46')]({},_0x594b0b,_0x40d72c[_0xd475('0x48')]);return _0xf6fd79[_0xd475('0x53')](_0x594b0b);}})[_0xd475('0x2e')](function(_0x1b7b8e){if(_0x1b7b8e){_0x139454=_0x1b7b8e[_0xd475('0x3f')];if(!_0x40d72c[_0xd475('0x3a')][_0xd475('0x40')](_0xd475('0x55'))){_0x594b0b[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x40d72c['query']['limit']);_0x594b0b[_0xd475('0x26')]=qs['offset'](_0x40d72c[_0xd475('0x3a')][_0xd475('0x26')]);}return _0xf6fd79['getFields'](_0x594b0b);}})[_0xd475('0x2e')](function(_0x10b769){if(_0x10b769){return _0x10b769?{'count':_0x139454,'rows':_0x10b769}:null;}})['then'](respondWithResult(_0x39df07,null))['catch'](handleError(_0x39df07,null));};exports[_0xd475('0x56')]=function(_0xe67aae,_0x5d9039,_0xee86ef){var _0x27981d={};var _0x1b4ef1={};var _0x36b84c;var _0x554e48;return db[_0xd475('0x34')][_0xd475('0x54')]({'where':{'id':_0xe67aae[_0xd475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d9039,null))[_0xd475('0x2e')](function(_0x4ad8a9){if(_0x4ad8a9){_0x36b84c=_0x4ad8a9;_0x1b4ef1['model']=_[_0xd475('0x39')](db['Dynamics365Field'][_0xd475('0x35')]);_0x1b4ef1[_0xd475('0x3a')]=_['keys'](_0xe67aae[_0xd475('0x3a')]);_0x1b4ef1[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x1b4ef1[_0xd475('0x38')],_0x1b4ef1[_0xd475('0x3a')]);_0x27981d[_0xd475('0x3d')]=_[_0xd475('0x3c')](_0x1b4ef1[_0xd475('0x38')],qs['fields'](_0xe67aae[_0xd475('0x3a')][_0xd475('0x3e')]));_0x27981d[_0xd475('0x3d')]=_0x27981d['attributes'][_0xd475('0x3f')]?_0x27981d[_0xd475('0x3d')]:_0x1b4ef1[_0xd475('0x38')];_0x27981d['order']=qs[_0xd475('0x42')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x42')]);_0x27981d[_0xd475('0x43')]=qs[_0xd475('0x3b')](_['pick'](_0xe67aae[_0xd475('0x3a')],_0x1b4ef1[_0xd475('0x3b')]));if(_0xe67aae[_0xd475('0x3a')][_0xd475('0x45')]){_0x27981d[_0xd475('0x43')]=_[_0xd475('0x46')](_0x27981d[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x27981d[_0xd475('0x3d')],function(_0x1d59dc){var _0x536f65={};_0x536f65[_0x1d59dc]={'$like':'%'+_0xe67aae['query'][_0xd475('0x45')]+'%'};return _0x536f65;})});}_0x27981d=_[_0xd475('0x46')]({},_0x27981d,_0xe67aae[_0xd475('0x48')]);return _0x36b84c[_0xd475('0x56')](_0x27981d);}})[_0xd475('0x2e')](function(_0x3f1dfc){if(_0x3f1dfc){_0x554e48=_0x3f1dfc['length'];if(!_0xe67aae[_0xd475('0x3a')]['hasOwnProperty'](_0xd475('0x55'))){_0x27981d[_0xd475('0x27')]=qs[_0xd475('0x27')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x27')]);_0x27981d['offset']=qs[_0xd475('0x26')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x26')]);}return _0x36b84c[_0xd475('0x56')](_0x27981d);}})[_0xd475('0x2e')](function(_0x58f0fe){if(_0x58f0fe){return _0x58f0fe?{'count':_0x554e48,'rows':_0x58f0fe}:null;}})[_0xd475('0x2e')](respondWithResult(_0x5d9039,null))[_0xd475('0x22')](handleError(_0x5d9039,null));};exports[_0xd475('0x57')]=function(_0x59f7c0,_0x55c344,_0x1a71de){var _0x1da49c={};var _0x486a1c={};var _0x3d318c;var _0x41ecab;return db['Dynamics365Configuration'][_0xd475('0x54')]({'where':{'id':_0x59f7c0['params']['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x55c344,null))[_0xd475('0x2e')](function(_0x3bb95c){if(_0x3bb95c){_0x3d318c=_0x3bb95c;_0x486a1c[_0xd475('0x38')]=_['keys'](db[_0xd475('0x58')][_0xd475('0x35')]);_0x486a1c[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x59f7c0[_0xd475('0x3a')]);_0x486a1c[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x486a1c[_0xd475('0x38')],_0x486a1c[_0xd475('0x3a')]);_0x1da49c['attributes']=_['intersection'](_0x486a1c[_0xd475('0x38')],qs[_0xd475('0x3e')](_0x59f7c0[_0xd475('0x3a')]['fields']));_0x1da49c['attributes']=_0x1da49c[_0xd475('0x3d')][_0xd475('0x3f')]?_0x1da49c[_0xd475('0x3d')]:_0x486a1c['model'];_0x1da49c[_0xd475('0x41')]=qs['sort'](_0x59f7c0[_0xd475('0x3a')][_0xd475('0x42')]);_0x1da49c[_0xd475('0x43')]=qs[_0xd475('0x3b')](_[_0xd475('0x44')](_0x59f7c0[_0xd475('0x3a')],_0x486a1c['filters']));if(_0x59f7c0[_0xd475('0x3a')][_0xd475('0x45')]){_0x1da49c[_0xd475('0x43')]=_[_0xd475('0x46')](_0x1da49c[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x1da49c[_0xd475('0x3d')],function(_0x442fc3){var _0x5d12c5={};_0x5d12c5[_0x442fc3]={'$like':'%'+_0x59f7c0[_0xd475('0x3a')][_0xd475('0x45')]+'%'};return _0x5d12c5;})});}_0x1da49c=_['merge']({},_0x1da49c,_0x59f7c0[_0xd475('0x48')]);return _0x3d318c[_0xd475('0x57')](_0x1da49c);}})['then'](function(_0x2d2831){if(_0x2d2831){_0x41ecab=_0x2d2831[_0xd475('0x3f')];if(!_0x59f7c0['query']['hasOwnProperty']('nolimit')){_0x1da49c[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x59f7c0['query'][_0xd475('0x27')]);_0x1da49c['offset']=qs['offset'](_0x59f7c0[_0xd475('0x3a')]['offset']);}return _0x3d318c[_0xd475('0x57')](_0x1da49c);}})['then'](function(_0x45549b){if(_0x45549b){return _0x45549b?{'count':_0x41ecab,'rows':_0x45549b}:null;}})['then'](respondWithResult(_0x55c344,null))[_0xd475('0x22')](handleError(_0x55c344,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f7db8f9..7114695 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 _0xfa03=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xfa03,0x1aa));var _0x3fa0=function(_0x877a3d,_0x1202cb){_0x877a3d=_0x877a3d-0x0;var _0xe57699=_0xfa03[_0x877a3d];return _0xe57699;};'use strict';var _=require(_0x3fa0('0x0'));var util=require(_0x3fa0('0x1'));var logger=require(_0x3fa0('0x2'))(_0x3fa0('0x3'));var moment=require(_0x3fa0('0x4'));var BPromise=require(_0x3fa0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa0('0x6'));var config=require(_0x3fa0('0x7'));var attributes=require(_0x3fa0('0x8'));module[_0x3fa0('0x9')]=function(_0x40d71e,_0x5077c5){return _0x40d71e[_0x3fa0('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0x3fa0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfecf=['./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1bbcf6,_0x12aa4e){var _0x227667=function(_0x2131bb){while(--_0x2131bb){_0x1bbcf6['push'](_0x1bbcf6['shift']());}};_0x227667(++_0x12aa4e);}(_0xfecf,0x87));var _0xffec=function(_0x3bb5ea,_0x2cba90){_0x3bb5ea=_0x3bb5ea-0x0;var _0x8a562f=_0xfecf[_0x3bb5ea];return _0x8a562f;};'use strict';var _=require(_0xffec('0x0'));var util=require(_0xffec('0x1'));var logger=require('../../config/logger')(_0xffec('0x2'));var moment=require('moment');var BPromise=require(_0xffec('0x3'));var rp=require(_0xffec('0x4'));var fs=require('fs');var path=require(_0xffec('0x5'));var rimraf=require(_0xffec('0x6'));var config=require(_0xffec('0x7'));var attributes=require(_0xffec('0x8'));module[_0xffec('0x9')]=function(_0xfe0311,_0x49eb04){return _0xfe0311['define']('Dynamics365Configuration',attributes,{'tableName':_0xffec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 68be7ef..c7b6964 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 _0x0880=['message','info','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf37f2,_0x4cef7c){var _0x1dbff0=function(_0x129f93){while(--_0x129f93){_0xf37f2['push'](_0xf37f2['shift']());}};_0x1dbff0(++_0x4cef7c);}(_0x0880,0xf4));var _0x0088=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x0880[_0x330414];return _0x99dbff;};'use strict';var _=require(_0x0088('0x0'));var util=require(_0x0088('0x1'));var moment=require(_0x0088('0x2'));var BPromise=require(_0x0088('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0088('0x4'))(_0x0088('0x5'));var config=require(_0x0088('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0088('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a5457,_0x106d18,_0x32ad43){return new BPromise(function(_0x11ca9d,_0x58603b){return client[_0x0088('0x8')](_0x5a5457,_0x32ad43)[_0x0088('0x9')](function(_0x1100ec){logger['info'](_0x0088('0xa'),_0x106d18,_0x0088('0xb'));logger[_0x0088('0xc')](_0x0088('0xd'),_0x106d18,_0x0088('0xb'),JSON[_0x0088('0xe')](_0x1100ec));if(_0x1100ec[_0x0088('0xf')]){if(_0x1100ec[_0x0088('0xf')]['code']===0x1f4){logger[_0x0088('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x106d18,_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);return _0x58603b(_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);}logger[_0x0088('0xf')](_0x0088('0xa'),_0x106d18,_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);return _0x11ca9d(_0x1100ec[_0x0088('0xf')][_0x0088('0x10')]);}else{logger[_0x0088('0x11')](_0x0088('0xa'),_0x106d18,_0x0088('0xb'));_0x11ca9d(_0x1100ec[_0x0088('0x12')][_0x0088('0x10')]);}})[_0x0088('0x13')](function(_0x5076db){logger[_0x0088('0xf')](_0x0088('0xa'),_0x106d18,_0x5076db);_0x58603b(_0x5076db);});});} \ No newline at end of file +var _0xe89f=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5e8104,_0x413aad){var _0x19ed7d=function(_0x126479){while(--_0x126479){_0x5e8104['push'](_0x5e8104['shift']());}};_0x19ed7d(++_0x413aad);}(_0xe89f,0x15a));var _0xfe89=function(_0x5ef0d2,_0x10ea16){_0x5ef0d2=_0x5ef0d2-0x0;var _0x33ca21=_0xe89f[_0x5ef0d2];return _0x33ca21;};'use strict';var _=require(_0xfe89('0x0'));var util=require(_0xfe89('0x1'));var moment=require(_0xfe89('0x2'));var BPromise=require(_0xfe89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe89('0x4'));var db=require(_0xfe89('0x5'))['db'];var utils=require(_0xfe89('0x6'));var logger=require(_0xfe89('0x7'))(_0xfe89('0x8'));var config=require(_0xfe89('0x9'));var jayson=require(_0xfe89('0xa'));var client=jayson[_0xfe89('0xb')][_0xfe89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54ab69,_0x505194,_0x1c4f33){return new BPromise(function(_0x34a8f6,_0x4e5944){return client[_0xfe89('0xd')](_0x54ab69,_0x1c4f33)['then'](function(_0x148a4b){logger[_0xfe89('0xe')](_0xfe89('0xf'),_0x505194,'request\x20sent');logger['debug'](_0xfe89('0x10'),_0x505194,_0xfe89('0x11'),JSON[_0xfe89('0x12')](_0x148a4b));if(_0x148a4b[_0xfe89('0x13')]){if(_0x148a4b[_0xfe89('0x13')]['code']===0x1f4){logger[_0xfe89('0x13')](_0xfe89('0xf'),_0x505194,_0x148a4b[_0xfe89('0x13')][_0xfe89('0x14')]);return _0x4e5944(_0x148a4b[_0xfe89('0x13')][_0xfe89('0x14')]);}logger[_0xfe89('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x505194,_0x148a4b[_0xfe89('0x13')]['message']);return _0x34a8f6(_0x148a4b['error'][_0xfe89('0x14')]);}else{logger[_0xfe89('0xe')](_0xfe89('0xf'),_0x505194,_0xfe89('0x11'));_0x34a8f6(_0x148a4b[_0xfe89('0x15')][_0xfe89('0x14')]);}})[_0xfe89('0x16')](function(_0x4ecf9a){logger[_0xfe89('0x13')](_0xfe89('0xf'),_0x505194,_0x4ecf9a);_0x4e5944(_0x4ecf9a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e247df5..4858f09 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 _0xb43b=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x31049e,_0x4b2b6c){var _0x48941a=function(_0x5700d6){while(--_0x5700d6){_0x31049e['push'](_0x31049e['shift']());}};_0x48941a(++_0x4b2b6c);}(_0xb43b,0xbf));var _0xbb43=function(_0x1010ef,_0x99d47c){_0x1010ef=_0x1010ef-0x0;var _0x2cbbc8=_0xb43b[_0x1010ef];return _0x2cbbc8;};'use strict';var multer=require(_0xbb43('0x0'));var util=require('util');var path=require(_0xbb43('0x1'));var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router[_0xbb43('0x9')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xb')]);router['get'](_0xbb43('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xa')](),controller[_0xbb43('0xe')]);router[_0xbb43('0xf')](_0xbb43('0xc'),auth['isAuthenticated'](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),controller['destroy']);module[_0xbb43('0x12')]=router; \ No newline at end of file +var _0x0506=['exports','multer','util','path','../../components/interaction/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x14d227,_0x5c0814){var _0x548f78=function(_0x3a3827){while(--_0x3a3827){_0x14d227['push'](_0x14d227['shift']());}};_0x548f78(++_0x5c0814);}(_0x0506,0x1d1));var _0x6050=function(_0x4fb277,_0x2cb27a){_0x4fb277=_0x4fb277-0x0;var _0xdfc99a=_0x0506[_0x4fb277];return _0xdfc99a;};'use strict';var multer=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var path=require(_0x6050('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6050('0x3'));var config=require('../../config/environment');var controller=require(_0x6050('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x6050('0x5')]);router[_0x6050('0x6')](_0x6050('0x7'),auth[_0x6050('0x8')](),controller[_0x6050('0x9')]);router[_0x6050('0xa')]('/',auth[_0x6050('0x8')](),controller[_0x6050('0xb')]);router['put'](_0x6050('0x7'),auth['isAuthenticated'](),controller[_0x6050('0xc')]);router[_0x6050('0xd')](_0x6050('0x7'),auth[_0x6050('0x8')](),controller[_0x6050('0xe')]);module[_0x6050('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 890728b..2ccbaed 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 _0x88f5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x23212c,_0x471b91){var _0xbe8955=function(_0x51724c){while(--_0x51724c){_0x23212c['push'](_0x23212c['shift']());}};_0xbe8955(++_0x471b91);}(_0x88f5,0x79));var _0x588f=function(_0x174cd5,_0xf19a51){_0x174cd5=_0x174cd5-0x0;var _0x3e3cf8=_0x88f5[_0x174cd5];return _0x3e3cf8;};'use strict';var Sequelize=require(_0x588f('0x0'));module[_0x588f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x588f('0x2'),_0x588f('0x3'),_0x588f('0x4')),'defaultValue':_0x588f('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x588f('0x6')]},'keyType':{'type':Sequelize[_0x588f('0x7')](_0x588f('0x5'),_0x588f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x588f('0x6')]},'idField':{'type':Sequelize[_0x588f('0x6')]},'nameField':{'type':Sequelize[_0x588f('0x6')]},'customField':{'type':Sequelize[_0x588f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x588f('0x6')]}}; \ No newline at end of file +var _0xcbb3=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xc42a73,_0x232b84){var _0x108cf9=function(_0x5ea709){while(--_0x5ea709){_0xc42a73['push'](_0xc42a73['shift']());}};_0x108cf9(++_0x232b84);}(_0xcbb3,0x66));var _0x3cbb=function(_0x55869f,_0xfd83b){_0x55869f=_0x55869f-0x0;var _0x165b2c=_0xcbb3[_0x55869f];return _0x165b2c;};'use strict';var Sequelize=require(_0x3cbb('0x0'));module[_0x3cbb('0x1')]={'type':{'type':Sequelize[_0x3cbb('0x2')](_0x3cbb('0x3'),_0x3cbb('0x4'),_0x3cbb('0x5'),_0x3cbb('0x6')),'defaultValue':_0x3cbb('0x3')},'content':{'type':Sequelize[_0x3cbb('0x7')]},'key':{'type':Sequelize[_0x3cbb('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3cbb('0x3'),_0x3cbb('0x4'),_0x3cbb('0x5'))},'keyContent':{'type':Sequelize[_0x3cbb('0x7')]},'idField':{'type':Sequelize[_0x3cbb('0x7')]},'nameField':{'type':Sequelize[_0x3cbb('0x7')]},'customField':{'type':Sequelize[_0x3cbb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3ed8abc..7087ae7 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 _0x34e7=['Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','count','offset','limit','set'];(function(_0x1c76af,_0x196cda){var _0x4d2b7a=function(_0x1de888){while(--_0x1de888){_0x1c76af['push'](_0x1c76af['shift']());}};_0x4d2b7a(++_0x196cda);}(_0x34e7,0x161));var _0x734e=function(_0x5a3ec5,_0x71ae0f){_0x5a3ec5=_0x5a3ec5-0x0;var _0x5749de=_0x34e7[_0x5a3ec5];return _0x5749de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x734e('0x0'));var rimraf=require(_0x734e('0x1'));var zipdir=require(_0x734e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x734e('0x3'));var moment=require('moment');var BPromise=require(_0x734e('0x4'));var Mustache=require(_0x734e('0x5'));var util=require(_0x734e('0x6'));var path=require(_0x734e('0x7'));var sox=require(_0x734e('0x8'));var csv=require(_0x734e('0x9'));var ejs=require(_0x734e('0xa'));var fs=require('fs');var _=require(_0x734e('0xb'));var squel=require(_0x734e('0xc'));var crypto=require(_0x734e('0xd'));var jsforce=require(_0x734e('0xe'));var deskjs=require(_0x734e('0xf'));var toCsv=require(_0x734e('0x9'));var querystring=require(_0x734e('0x10'));var Papa=require(_0x734e('0x11'));var Redis=require(_0x734e('0x12'));var authService=require(_0x734e('0x13'));var qs=require(_0x734e('0x14'));var as=require(_0x734e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x734e('0x16'))(_0x734e('0x17'));var utils=require(_0x734e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x734e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0ff7,_0x4700b9){_0x4700b9=_0x4700b9||0xcc;return function(_0x334867){if(_0x334867){return _0x3c0ff7['sendStatus'](_0x4700b9);}return _0x3c0ff7[_0x734e('0x1a')](_0x4700b9)['end']();};}function respondWithResult(_0x642aa0,_0x3d039a){_0x3d039a=_0x3d039a||0xc8;return function(_0x54466e){if(_0x54466e){return _0x642aa0['status'](_0x3d039a)[_0x734e('0x1b')](_0x54466e);}};}function respondWithFilteredResult(_0x39145b,_0x267985){return function(_0x6cd0d7){if(_0x6cd0d7){var _0x292783=_0x6cd0d7[_0x734e('0x1c')],_0x2399af=_0x267985[_0x734e('0x1d')],_0x54c0a7=_0x267985[_0x734e('0x1d')]+_0x267985[_0x734e('0x1e')],_0xbf4c2b;if(_0x54c0a7>=_0x292783){_0x54c0a7=_0x292783;_0xbf4c2b=0xc8;}else{_0xbf4c2b=0xce;}_0x39145b['status'](_0xbf4c2b);return _0x39145b[_0x734e('0x1f')](_0x734e('0x20'),_0x2399af+'-'+_0x54c0a7+'/'+_0x292783)[_0x734e('0x1b')](_0x6cd0d7);}return null;};}function patchUpdates(_0x15fc99){return function(_0x40dcc7){try{jsonpatch[_0x734e('0x21')](_0x40dcc7,_0x15fc99,!![]);}catch(_0x47b41f){return BPromise[_0x734e('0x22')](_0x47b41f);}return _0x40dcc7['save']();};}function saveUpdates(_0x53da84,_0x30dad4){return function(_0x1d2794){if(_0x1d2794){return _0x1d2794[_0x734e('0x23')](_0x53da84)[_0x734e('0x24')](function(_0x496460){return _0x496460;});}return null;};}function removeEntity(_0x54db2c,_0x45fe35){return function(_0x2291a5){if(_0x2291a5){return _0x2291a5[_0x734e('0x25')]()[_0x734e('0x24')](function(){_0x54db2c[_0x734e('0x1a')](0xcc)[_0x734e('0x26')]();});}};}function handleEntityNotFound(_0x3a903c,_0x5b045){return function(_0x4ec0e7){if(!_0x4ec0e7){_0x3a903c[_0x734e('0x27')](0x194);}return _0x4ec0e7;};}function handleError(_0x35433d,_0x1e9fb1){_0x1e9fb1=_0x1e9fb1||0x1f4;return function(_0x5a39a7){logger[_0x734e('0x28')](_0x5a39a7[_0x734e('0x29')]);if(_0x5a39a7[_0x734e('0x2a')]){delete _0x5a39a7[_0x734e('0x2a')];}_0x35433d[_0x734e('0x1a')](_0x1e9fb1)[_0x734e('0x2b')](_0x5a39a7);};}exports[_0x734e('0x2c')]=function(_0x3562f7,_0x31831b){var _0x1340e0={},_0x41483e={},_0x546d30={'count':0x0,'rows':[]};var _0x526443=_['map'](db[_0x734e('0x2d')][_0x734e('0x2e')],function(_0x13305d){return{'name':_0x13305d[_0x734e('0x2f')],'type':_0x13305d[_0x734e('0x30')][_0x734e('0x31')]};});_0x41483e[_0x734e('0x32')]=_['map'](_0x526443,'name');_0x41483e['query']=_[_0x734e('0x33')](_0x3562f7[_0x734e('0x34')]);_0x41483e[_0x734e('0x35')]=_[_0x734e('0x36')](_0x41483e['model'],_0x41483e[_0x734e('0x34')]);_0x1340e0[_0x734e('0x37')]=_[_0x734e('0x36')](_0x41483e['model'],qs[_0x734e('0x38')](_0x3562f7[_0x734e('0x34')]['fields']));_0x1340e0['attributes']=_0x1340e0[_0x734e('0x37')]['length']?_0x1340e0[_0x734e('0x37')]:_0x41483e['model'];if(!_0x3562f7[_0x734e('0x34')][_0x734e('0x39')](_0x734e('0x3a'))){_0x1340e0[_0x734e('0x1e')]=qs[_0x734e('0x1e')](_0x3562f7[_0x734e('0x34')][_0x734e('0x1e')]);_0x1340e0[_0x734e('0x1d')]=qs[_0x734e('0x1d')](_0x3562f7[_0x734e('0x34')][_0x734e('0x1d')]);}_0x1340e0[_0x734e('0x3b')]=qs[_0x734e('0x3c')](_0x3562f7[_0x734e('0x34')][_0x734e('0x3c')]);_0x1340e0[_0x734e('0x3d')]=qs['filters'](_[_0x734e('0x3e')](_0x3562f7[_0x734e('0x34')],_0x41483e[_0x734e('0x35')]),_0x526443);if(_0x3562f7[_0x734e('0x34')][_0x734e('0x3f')]){_0x1340e0[_0x734e('0x3d')]=_[_0x734e('0x40')](_0x1340e0[_0x734e('0x3d')],{'$or':_[_0x734e('0x41')](_0x526443,function(_0x3d2bfb){if(_0x3d2bfb[_0x734e('0x30')]!==_0x734e('0x42')){var _0x3b9f1f={};_0x3b9f1f[_0x3d2bfb[_0x734e('0x2a')]]={'$like':'%'+_0x3562f7[_0x734e('0x34')][_0x734e('0x3f')]+'%'};return _0x3b9f1f;}})});}_0x1340e0=_[_0x734e('0x40')]({},_0x1340e0,_0x3562f7['options']);var _0x577e3d={'where':_0x1340e0['where']};return db[_0x734e('0x2d')][_0x734e('0x1c')](_0x577e3d)[_0x734e('0x24')](function(_0x7ef959){_0x546d30[_0x734e('0x1c')]=_0x7ef959;if(_0x3562f7[_0x734e('0x34')][_0x734e('0x43')]){_0x1340e0[_0x734e('0x44')]=[{'all':!![]}];}return db[_0x734e('0x2d')][_0x734e('0x45')](_0x1340e0);})[_0x734e('0x24')](function(_0xd4367c){_0x546d30[_0x734e('0x46')]=_0xd4367c;return _0x546d30;})[_0x734e('0x24')](respondWithFilteredResult(_0x31831b,_0x1340e0))[_0x734e('0x47')](handleError(_0x31831b,null));};exports['show']=function(_0x213590,_0x793d58){var _0x37e43b={'raw':!![],'where':{'id':_0x213590['params']['id']}},_0x1e21ee={};_0x1e21ee[_0x734e('0x32')]=_[_0x734e('0x33')](db[_0x734e('0x2d')][_0x734e('0x2e')]);_0x1e21ee[_0x734e('0x34')]=_[_0x734e('0x33')](_0x213590[_0x734e('0x34')]);_0x1e21ee[_0x734e('0x35')]=_[_0x734e('0x36')](_0x1e21ee['model'],_0x1e21ee[_0x734e('0x34')]);_0x37e43b[_0x734e('0x37')]=_[_0x734e('0x36')](_0x1e21ee[_0x734e('0x32')],qs[_0x734e('0x38')](_0x213590[_0x734e('0x34')]['fields']));_0x37e43b['attributes']=_0x37e43b[_0x734e('0x37')][_0x734e('0x48')]?_0x37e43b[_0x734e('0x37')]:_0x1e21ee[_0x734e('0x32')];if(_0x213590[_0x734e('0x34')][_0x734e('0x43')]){_0x37e43b[_0x734e('0x44')]=[{'all':!![]}];}_0x37e43b=_['merge']({},_0x37e43b,_0x213590[_0x734e('0x49')]);return db[_0x734e('0x2d')]['find'](_0x37e43b)['then'](handleEntityNotFound(_0x793d58,null))['then'](respondWithResult(_0x793d58,null))[_0x734e('0x47')](handleError(_0x793d58,null));};exports['create']=function(_0x591d7b,_0x63725c){return db['Dynamics365Field'][_0x734e('0x4a')](_0x591d7b[_0x734e('0x4b')],{})[_0x734e('0x24')](respondWithResult(_0x63725c,0xc9))[_0x734e('0x47')](handleError(_0x63725c,null));};exports[_0x734e('0x23')]=function(_0x48b298,_0x2615c9){if(_0x48b298[_0x734e('0x4b')]['id']){delete _0x48b298[_0x734e('0x4b')]['id'];}return db[_0x734e('0x2d')]['find']({'where':{'id':_0x48b298[_0x734e('0x4c')]['id']}})[_0x734e('0x24')](handleEntityNotFound(_0x2615c9,null))[_0x734e('0x24')](saveUpdates(_0x48b298[_0x734e('0x4b')],null))['then'](respondWithResult(_0x2615c9,null))['catch'](handleError(_0x2615c9,null));};exports[_0x734e('0x25')]=function(_0x55b250,_0x163921){return db[_0x734e('0x2d')]['find']({'where':{'id':_0x55b250[_0x734e('0x4c')]['id']}})[_0x734e('0x24')](handleEntityNotFound(_0x163921,null))[_0x734e('0x24')](removeEntity(_0x163921,null))[_0x734e('0x47')](handleError(_0x163921,null));}; \ No newline at end of file +var _0xeee4=['pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x524899,_0x4a1b81){var _0x5e2554=function(_0x5cd91c){while(--_0x5cd91c){_0x524899['push'](_0x524899['shift']());}};_0x5e2554(++_0x4a1b81);}(_0xeee4,0xeb));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(_0x4eee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4eee('0x3'));var rp=require(_0x4eee('0x4'));var moment=require(_0x4eee('0x5'));var BPromise=require(_0x4eee('0x6'));var Mustache=require(_0x4eee('0x7'));var util=require(_0x4eee('0x8'));var path=require(_0x4eee('0x9'));var sox=require('sox');var csv=require(_0x4eee('0xa'));var ejs=require(_0x4eee('0xb'));var fs=require('fs');var _=require(_0x4eee('0xc'));var squel=require(_0x4eee('0xd'));var crypto=require(_0x4eee('0xe'));var jsforce=require(_0x4eee('0xf'));var deskjs=require(_0x4eee('0x10'));var toCsv=require(_0x4eee('0xa'));var querystring=require(_0x4eee('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4eee('0x12'));var qs=require(_0x4eee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4eee('0x14'));var logger=require(_0x4eee('0x15'))(_0x4eee('0x16'));var utils=require(_0x4eee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4eee('0x18'))['db'];function respondWithStatusCode(_0x5ad215,_0x11d6ef){_0x11d6ef=_0x11d6ef||0xcc;return function(_0x3dd1c2){if(_0x3dd1c2){return _0x5ad215[_0x4eee('0x19')](_0x11d6ef);}return _0x5ad215[_0x4eee('0x1a')](_0x11d6ef)[_0x4eee('0x1b')]();};}function respondWithResult(_0x305467,_0x100762){_0x100762=_0x100762||0xc8;return function(_0x559b0d){if(_0x559b0d){return _0x305467[_0x4eee('0x1a')](_0x100762)[_0x4eee('0x1c')](_0x559b0d);}};}function respondWithFilteredResult(_0x34840d,_0x2d3a85){return function(_0x29aa3b){if(_0x29aa3b){var _0x41f48d=_0x29aa3b['count'],_0x2a580c=_0x2d3a85[_0x4eee('0x1d')],_0x5c9721=_0x2d3a85[_0x4eee('0x1d')]+_0x2d3a85[_0x4eee('0x1e')],_0x5948cc;if(_0x5c9721>=_0x41f48d){_0x5c9721=_0x41f48d;_0x5948cc=0xc8;}else{_0x5948cc=0xce;}_0x34840d[_0x4eee('0x1a')](_0x5948cc);return _0x34840d[_0x4eee('0x1f')](_0x4eee('0x20'),_0x2a580c+'-'+_0x5c9721+'/'+_0x41f48d)[_0x4eee('0x1c')](_0x29aa3b);}return null;};}function patchUpdates(_0x1bcb74){return function(_0x17c236){try{jsonpatch[_0x4eee('0x21')](_0x17c236,_0x1bcb74,!![]);}catch(_0xb0231){return BPromise['reject'](_0xb0231);}return _0x17c236['save']();};}function saveUpdates(_0x595c3a,_0x41d77c){return function(_0x118cf4){if(_0x118cf4){return _0x118cf4['update'](_0x595c3a)[_0x4eee('0x22')](function(_0x2a9603){return _0x2a9603;});}return null;};}function removeEntity(_0x14c057,_0x18573e){return function(_0x19f748){if(_0x19f748){return _0x19f748[_0x4eee('0x23')]()[_0x4eee('0x22')](function(){_0x14c057[_0x4eee('0x1a')](0xcc)[_0x4eee('0x1b')]();});}};}function handleEntityNotFound(_0x9cb624,_0x2da934){return function(_0x3de321){if(!_0x3de321){_0x9cb624[_0x4eee('0x19')](0x194);}return _0x3de321;};}function handleError(_0x228861,_0x4fb197){_0x4fb197=_0x4fb197||0x1f4;return function(_0x239204){logger[_0x4eee('0x24')](_0x239204[_0x4eee('0x25')]);if(_0x239204[_0x4eee('0x26')]){delete _0x239204[_0x4eee('0x26')];}_0x228861[_0x4eee('0x1a')](_0x4fb197)[_0x4eee('0x27')](_0x239204);};}exports[_0x4eee('0x28')]=function(_0x68c5d5,_0x5ba5cc){var _0x136b54={},_0xa59cee={},_0x38c63b={'count':0x0,'rows':[]};var _0x1bfbbd=_['map'](db[_0x4eee('0x29')][_0x4eee('0x2a')],function(_0x15387d){return{'name':_0x15387d[_0x4eee('0x2b')],'type':_0x15387d[_0x4eee('0x2c')]['key']};});_0xa59cee[_0x4eee('0x2d')]=_[_0x4eee('0x2e')](_0x1bfbbd,_0x4eee('0x26'));_0xa59cee[_0x4eee('0x2f')]=_['keys'](_0x68c5d5[_0x4eee('0x2f')]);_0xa59cee[_0x4eee('0x30')]=_[_0x4eee('0x31')](_0xa59cee[_0x4eee('0x2d')],_0xa59cee[_0x4eee('0x2f')]);_0x136b54[_0x4eee('0x32')]=_[_0x4eee('0x31')](_0xa59cee[_0x4eee('0x2d')],qs[_0x4eee('0x33')](_0x68c5d5['query'][_0x4eee('0x33')]));_0x136b54[_0x4eee('0x32')]=_0x136b54[_0x4eee('0x32')][_0x4eee('0x34')]?_0x136b54['attributes']:_0xa59cee['model'];if(!_0x68c5d5[_0x4eee('0x2f')]['hasOwnProperty'](_0x4eee('0x35'))){_0x136b54[_0x4eee('0x1e')]=qs['limit'](_0x68c5d5['query'][_0x4eee('0x1e')]);_0x136b54[_0x4eee('0x1d')]=qs['offset'](_0x68c5d5['query'][_0x4eee('0x1d')]);}_0x136b54[_0x4eee('0x36')]=qs[_0x4eee('0x37')](_0x68c5d5['query']['sort']);_0x136b54[_0x4eee('0x38')]=qs['filters'](_[_0x4eee('0x39')](_0x68c5d5[_0x4eee('0x2f')],_0xa59cee[_0x4eee('0x30')]),_0x1bfbbd);if(_0x68c5d5[_0x4eee('0x2f')][_0x4eee('0x3a')]){_0x136b54[_0x4eee('0x38')]=_[_0x4eee('0x3b')](_0x136b54[_0x4eee('0x38')],{'$or':_['map'](_0x1bfbbd,function(_0x560a5d){if(_0x560a5d['type']!=='VIRTUAL'){var _0x2cc752={};_0x2cc752[_0x560a5d[_0x4eee('0x26')]]={'$like':'%'+_0x68c5d5[_0x4eee('0x2f')]['filter']+'%'};return _0x2cc752;}})});}_0x136b54=_['merge']({},_0x136b54,_0x68c5d5[_0x4eee('0x3c')]);var _0x2d163a={'where':_0x136b54[_0x4eee('0x38')]};return db[_0x4eee('0x29')][_0x4eee('0x3d')](_0x2d163a)['then'](function(_0x2c2be9){_0x38c63b[_0x4eee('0x3d')]=_0x2c2be9;if(_0x68c5d5[_0x4eee('0x2f')][_0x4eee('0x3e')]){_0x136b54[_0x4eee('0x3f')]=[{'all':!![]}];}return db[_0x4eee('0x29')][_0x4eee('0x40')](_0x136b54);})[_0x4eee('0x22')](function(_0x437d2b){_0x38c63b[_0x4eee('0x41')]=_0x437d2b;return _0x38c63b;})['then'](respondWithFilteredResult(_0x5ba5cc,_0x136b54))[_0x4eee('0x42')](handleError(_0x5ba5cc,null));};exports[_0x4eee('0x43')]=function(_0x1a1cfc,_0x594c74){var _0x3a6328={'raw':!![],'where':{'id':_0x1a1cfc[_0x4eee('0x44')]['id']}},_0x26f9e6={};_0x26f9e6[_0x4eee('0x2d')]=_['keys'](db[_0x4eee('0x29')][_0x4eee('0x2a')]);_0x26f9e6[_0x4eee('0x2f')]=_[_0x4eee('0x45')](_0x1a1cfc['query']);_0x26f9e6[_0x4eee('0x30')]=_[_0x4eee('0x31')](_0x26f9e6['model'],_0x26f9e6[_0x4eee('0x2f')]);_0x3a6328['attributes']=_[_0x4eee('0x31')](_0x26f9e6[_0x4eee('0x2d')],qs[_0x4eee('0x33')](_0x1a1cfc[_0x4eee('0x2f')][_0x4eee('0x33')]));_0x3a6328[_0x4eee('0x32')]=_0x3a6328[_0x4eee('0x32')][_0x4eee('0x34')]?_0x3a6328[_0x4eee('0x32')]:_0x26f9e6[_0x4eee('0x2d')];if(_0x1a1cfc['query'][_0x4eee('0x3e')]){_0x3a6328[_0x4eee('0x3f')]=[{'all':!![]}];}_0x3a6328=_['merge']({},_0x3a6328,_0x1a1cfc[_0x4eee('0x3c')]);return db[_0x4eee('0x29')][_0x4eee('0x46')](_0x3a6328)[_0x4eee('0x22')](handleEntityNotFound(_0x594c74,null))[_0x4eee('0x22')](respondWithResult(_0x594c74,null))[_0x4eee('0x42')](handleError(_0x594c74,null));};exports['create']=function(_0xcdb09b,_0x386820){return db[_0x4eee('0x29')][_0x4eee('0x47')](_0xcdb09b['body'],{})[_0x4eee('0x22')](respondWithResult(_0x386820,0xc9))[_0x4eee('0x42')](handleError(_0x386820,null));};exports['update']=function(_0x4fc06b,_0x40f302){if(_0x4fc06b[_0x4eee('0x48')]['id']){delete _0x4fc06b['body']['id'];}return db[_0x4eee('0x29')][_0x4eee('0x46')]({'where':{'id':_0x4fc06b[_0x4eee('0x44')]['id']}})[_0x4eee('0x22')](handleEntityNotFound(_0x40f302,null))[_0x4eee('0x22')](saveUpdates(_0x4fc06b['body'],null))[_0x4eee('0x22')](respondWithResult(_0x40f302,null))[_0x4eee('0x42')](handleError(_0x40f302,null));};exports[_0x4eee('0x23')]=function(_0x5136d3,_0x12d292){return db['Dynamics365Field'][_0x4eee('0x46')]({'where':{'id':_0x5136d3[_0x4eee('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d292,null))[_0x4eee('0x22')](removeEntity(_0x12d292,null))[_0x4eee('0x42')](handleError(_0x12d292,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fa4df26..1fe6423 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 _0x2af0=['exports','define','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x46c95d,_0x56ad25){var _0x4211f4=function(_0x180210){while(--_0x180210){_0x46c95d['push'](_0x46c95d['shift']());}};_0x4211f4(++_0x56ad25);}(_0x2af0,0xe1));var _0x02af=function(_0x65bf20,_0xa669ce){_0x65bf20=_0x65bf20-0x0;var _0x43cfb1=_0x2af0[_0x65bf20];return _0x43cfb1;};'use strict';var _=require(_0x02af('0x0'));var util=require(_0x02af('0x1'));var logger=require(_0x02af('0x2'))('api');var moment=require(_0x02af('0x3'));var BPromise=require(_0x02af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x02af('0x5')]=function(_0x49b68a,_0x585e05){return _0x49b68a[_0x02af('0x6')]('Dynamics365Field',attributes,{'tableName':_0x02af('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x02af('0x8'),_0x02af('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6213=['define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports'];(function(_0x49496b,_0x5da8c0){var _0x96c516=function(_0x1ce6f4){while(--_0x1ce6f4){_0x49496b['push'](_0x49496b['shift']());}};_0x96c516(++_0x5da8c0);}(_0x6213,0xba));var _0x3621=function(_0x45cb11,_0x2c8ad2){_0x45cb11=_0x45cb11-0x0;var _0x11710a=_0x6213[_0x45cb11];return _0x11710a;};'use strict';var _=require(_0x3621('0x0'));var util=require(_0x3621('0x1'));var logger=require(_0x3621('0x2'))(_0x3621('0x3'));var moment=require(_0x3621('0x4'));var BPromise=require(_0x3621('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3621('0x6'));var rimraf=require(_0x3621('0x7'));var config=require('../../config/environment');var attributes=require(_0x3621('0x8'));module[_0x3621('0x9')]=function(_0x26645b,_0x2b2781){return _0x26645b[_0x3621('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x3621('0xb'),'fields':[_0x3621('0xc'),_0x3621('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 f393a94..d8d4478 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 _0xd9eb=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x58d72c,_0x4bf853){var _0x501b9e=function(_0x499c12){while(--_0x499c12){_0x58d72c['push'](_0x58d72c['shift']());}};_0x501b9e(++_0x4bf853);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5bb0ba,_0x3a1803){_0x5bb0ba=_0x5bb0ba-0x0;var _0x551a4e=_0xd9eb[_0x5bb0ba];return _0x551a4e;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var moment=require(_0xbd9e('0x2'));var BPromise=require(_0xbd9e('0x3'));var rs=require(_0xbd9e('0x4'));var fs=require('fs');var Redis=require(_0xbd9e('0x5'));var db=require(_0xbd9e('0x6'))['db'];var utils=require(_0xbd9e('0x7'));var logger=require(_0xbd9e('0x8'))(_0xbd9e('0x9'));var config=require(_0xbd9e('0xa'));var jayson=require(_0xbd9e('0xb'));var client=jayson[_0xbd9e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26408d,_0x37d9a1,_0x293a79){return new BPromise(function(_0x2dbf84,_0x20cddf){return client[_0xbd9e('0xd')](_0x26408d,_0x293a79)[_0xbd9e('0xe')](function(_0x82e476){logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));logger[_0xbd9e('0x12')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x37d9a1,_0xbd9e('0x11'),JSON[_0xbd9e('0x13')](_0x82e476));if(_0x82e476['error']){if(_0x82e476[_0xbd9e('0x14')]['code']===0x1f4){logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);return _0x20cddf(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476['error'][_0xbd9e('0x15')]);return _0x2dbf84(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}else{logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));_0x2dbf84(_0x82e476[_0xbd9e('0x16')][_0xbd9e('0x15')]);}})[_0xbd9e('0x17')](function(_0x42e634){logger[_0xbd9e('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x37d9a1,_0x42e634);_0x20cddf(_0x42e634);});});} \ No newline at end of file +var _0x9e69=['rpc','../../config/environment','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9e69,0x150));var _0x99e6=function(_0x2625c8,_0x21e402){_0x2625c8=_0x2625c8-0x0;var _0x41139e=_0x9e69[_0x2625c8];return _0x41139e;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var moment=require(_0x99e6('0x1'));var BPromise=require(_0x99e6('0x2'));var rs=require(_0x99e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99e6('0x4'))['db'];var utils=require(_0x99e6('0x5'));var logger=require('../../config/logger')(_0x99e6('0x6'));var config=require(_0x99e6('0x7'));var jayson=require(_0x99e6('0x8'));var client=jayson['client'][_0x99e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf241,_0x41635b,_0x58eb2d){return new BPromise(function(_0x3424c5,_0x305140){return client['request'](_0x3cf241,_0x58eb2d)[_0x99e6('0xa')](function(_0x133169){logger['info'](_0x99e6('0xb'),_0x41635b,_0x99e6('0xc'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x41635b,_0x99e6('0xc'),JSON[_0x99e6('0xd')](_0x133169));if(_0x133169[_0x99e6('0xe')]){if(_0x133169[_0x99e6('0xe')][_0x99e6('0xf')]===0x1f4){logger[_0x99e6('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x41635b,_0x133169[_0x99e6('0xe')][_0x99e6('0x10')]);return _0x305140(_0x133169[_0x99e6('0xe')]['message']);}logger[_0x99e6('0xe')](_0x99e6('0xb'),_0x41635b,_0x133169[_0x99e6('0xe')]['message']);return _0x3424c5(_0x133169['error']['message']);}else{logger[_0x99e6('0x11')](_0x99e6('0xb'),_0x41635b,_0x99e6('0xc'));_0x3424c5(_0x133169['result'][_0x99e6('0x10')]);}})[_0x99e6('0x12')](function(_0xebfd62){logger[_0x99e6('0xe')](_0x99e6('0xb'),_0x41635b,_0xebfd62);_0x305140(_0xebfd62);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5b36319..11212a3 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 _0x1c13=['getFields','post','/:id','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','show','/:id/configurations','getConfigurations','get'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x1c13,0x9e));var _0x31c1=function(_0x1b1999,_0x393b2b){_0x1b1999=_0x1b1999-0x0;var _0x1c1ae5=_0x1c13[_0x1b1999];return _0x1c1ae5;};'use strict';var multer=require(_0x31c1('0x0'));var util=require(_0x31c1('0x1'));var path=require(_0x31c1('0x2'));var timeout=require(_0x31c1('0x3'));var express=require('express');var router=express[_0x31c1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x31c1('0x5'));var config=require('../../config/environment');var controller=require(_0x31c1('0x6'));router['get']('/',auth[_0x31c1('0x7')](),controller['index']);router['get']('/:id',auth[_0x31c1('0x7')](),controller[_0x31c1('0x8')]);router['get'](_0x31c1('0x9'),auth['isAuthenticated'](),controller[_0x31c1('0xa')]);router[_0x31c1('0xb')]('/:id/fields',auth[_0x31c1('0x7')](),controller[_0x31c1('0xc')]);router[_0x31c1('0xd')]('/',auth[_0x31c1('0x7')](),controller['create']);router[_0x31c1('0xd')](_0x31c1('0x9'),auth[_0x31c1('0x7')](),controller['addConfiguration']);router['put'](_0x31c1('0xe'),auth['isAuthenticated'](),controller[_0x31c1('0xf')]);router['delete']('/:id',auth[_0x31c1('0x7')](),controller['destroy']);module[_0x31c1('0x10')]=router; \ No newline at end of file +var _0x442d=['index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x811ad,_0x1faa85){var _0x2a610d=function(_0x26e1cb){while(--_0x26e1cb){_0x811ad['push'](_0x811ad['shift']());}};_0x2a610d(++_0x1faa85);}(_0x442d,0xd6));var _0xd442=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x442d[_0x3fb030];return _0xd6899b;};'use strict';var multer=require(_0xd442('0x0'));var util=require(_0xd442('0x1'));var path=require('path');var timeout=require(_0xd442('0x2'));var express=require(_0xd442('0x3'));var router=express['Router']();var auth=require(_0xd442('0x4'));var interaction=require(_0xd442('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd442('0x6')]);router['get'](_0xd442('0x7'),auth[_0xd442('0x8')](),controller[_0xd442('0x9')]);router[_0xd442('0xa')](_0xd442('0xb'),auth[_0xd442('0x8')](),controller[_0xd442('0xc')]);router[_0xd442('0xa')](_0xd442('0xd'),auth[_0xd442('0x8')](),controller[_0xd442('0xe')]);router[_0xd442('0xf')]('/',auth[_0xd442('0x8')](),controller[_0xd442('0x10')]);router['post']('/:id/configurations',auth[_0xd442('0x8')](),controller[_0xd442('0x11')]);router['put'](_0xd442('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xd442('0x12')](_0xd442('0x7'),auth[_0xd442('0x8')](),controller[_0xd442('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 822c8a3..4a26a89 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 _0x786e=['STRING','username','sequelize','exports'];(function(_0x36e915,_0x41e5da){var _0x19fc7b=function(_0x4c0e34){while(--_0x4c0e34){_0x36e915['push'](_0x36e915['shift']());}};_0x19fc7b(++_0x41e5da);}(_0x786e,0x1b2));var _0xe786=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x786e[_0x93942f];return _0x23fcd8;};'use strict';var Sequelize=require(_0xe786('0x0'));module[_0xe786('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe786('0x2')]},'username':{'type':Sequelize[_0xe786('0x2')],'unique':_0xe786('0x3')},'apiKey':{'type':Sequelize[_0xe786('0x2')]},'remoteUri':{'type':Sequelize[_0xe786('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe786('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xea9c=['STRING','sequelize'];(function(_0x3bdefa,_0x2c38be){var _0x4ddf04=function(_0x341c17){while(--_0x341c17){_0x3bdefa['push'](_0x3bdefa['shift']());}};_0x4ddf04(++_0x2c38be);}(_0xea9c,0x117));var _0xcea9=function(_0x5cbe3d,_0x5bce46){_0x5cbe3d=_0x5cbe3d-0x0;var _0x554db8=_0xea9c[_0x5cbe3d];return _0x554db8;};'use strict';var Sequelize=require(_0xcea9('0x0'));module['exports']={'name':{'type':Sequelize[_0xcea9('0x1')]},'description':{'type':Sequelize[_0xcea9('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcea9('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcea9('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 7e5a328..336bea3 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 _0x8a79=['stack','name','send','map','FreshdeskAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','params','rawAttributes','intersection','options','find','create','body','update','getConfigurations','pick','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','%s:X','requester','subject','agent','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save'];(function(_0x1292fb,_0x4cd09a){var _0x2544ae=function(_0xb8443a){while(--_0xb8443a){_0x1292fb['push'](_0x1292fb['shift']());}};_0x2544ae(++_0x4cd09a);}(_0x8a79,0x1b3));var _0x98a7=function(_0x1616f8,_0x5798ae){_0x1616f8=_0x1616f8-0x0;var _0x5c7b3d=_0x8a79[_0x1616f8];return _0x5c7b3d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x98a7('0x0'));var rimraf=require(_0x98a7('0x1'));var zipdir=require(_0x98a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98a7('0x3'));var moment=require(_0x98a7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x98a7('0x5'));var util=require(_0x98a7('0x6'));var path=require('path');var sox=require(_0x98a7('0x7'));var csv=require(_0x98a7('0x8'));var ejs=require(_0x98a7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98a7('0xa'));var deskjs=require(_0x98a7('0xb'));var toCsv=require(_0x98a7('0x8'));var querystring=require(_0x98a7('0xc'));var Papa=require(_0x98a7('0xd'));var Redis=require('ioredis');var authService=require(_0x98a7('0xe'));var qs=require(_0x98a7('0xf'));var as=require(_0x98a7('0x10'));var hardwareService=require(_0x98a7('0x11'));var logger=require(_0x98a7('0x12'))('api');var utils=require(_0x98a7('0x13'));var config=require(_0x98a7('0x14'));var licenseUtil=require(_0x98a7('0x15'));var db=require(_0x98a7('0x16'))['db'];var integrations=require(_0x98a7('0x17'));var jayson=require(_0x98a7('0x18'));var client=jayson['client'][_0x98a7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x7b8da8,_0x54c19a,_0x4fff98,_0x7cc49a){return new BPromise(function(_0x3d4a4d,_0x38ca68){var _0x574e73=_0x7cc49a||client;return _0x574e73[_0x98a7('0x1a')](_0x7b8da8,_0x4fff98)[_0x98a7('0x1b')](function(_0x48cad6){logger[_0x98a7('0x1c')](_0x98a7('0x1d'),_0x54c19a,'request\x20sent');logger[_0x98a7('0x1e')](_0x98a7('0x1f'),_0x54c19a,_0x98a7('0x20'),JSON[_0x98a7('0x21')](_0x48cad6));if(_0x48cad6[_0x98a7('0x22')]){if(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x23')]===0x1f4){logger['error'](_0x98a7('0x1d'),_0x54c19a,_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);return _0x38ca68(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);}logger[_0x98a7('0x22')](_0x98a7('0x1d'),_0x54c19a,_0x48cad6['error'][_0x98a7('0x24')]);return _0x3d4a4d(_0x48cad6[_0x98a7('0x22')][_0x98a7('0x24')]);}else{logger[_0x98a7('0x1c')](_0x98a7('0x1d'),_0x54c19a,'request\x20sent');_0x3d4a4d(_0x48cad6['result'][_0x98a7('0x24')]);}})[_0x98a7('0x25')](function(_0x29edc8){logger['error'](_0x98a7('0x1d'),_0x54c19a,_0x29edc8);_0x38ca68(_0x29edc8);});});}function respondWithStatusCode(_0x16a33a,_0x45d40a){_0x45d40a=_0x45d40a||0xcc;return function(_0x47c5ca){if(_0x47c5ca){return _0x16a33a[_0x98a7('0x26')](_0x45d40a);}return _0x16a33a['status'](_0x45d40a)[_0x98a7('0x27')]();};}function respondWithResult(_0x27bf18,_0x5e91f3){_0x5e91f3=_0x5e91f3||0xc8;return function(_0xc345f9){if(_0xc345f9){return _0x27bf18['status'](_0x5e91f3)[_0x98a7('0x28')](_0xc345f9);}};}function respondWithFilteredResult(_0xe80755,_0x3ff3e6){return function(_0x534fba){if(_0x534fba){var _0x119e9a=_0x534fba['count'],_0x21fd81=_0x3ff3e6[_0x98a7('0x29')],_0x4e8d0d=_0x3ff3e6[_0x98a7('0x29')]+_0x3ff3e6[_0x98a7('0x2a')],_0x40c155;if(_0x4e8d0d>=_0x119e9a){_0x4e8d0d=_0x119e9a;_0x40c155=0xc8;}else{_0x40c155=0xce;}_0xe80755[_0x98a7('0x2b')](_0x40c155);return _0xe80755[_0x98a7('0x2c')](_0x98a7('0x2d'),_0x21fd81+'-'+_0x4e8d0d+'/'+_0x119e9a)[_0x98a7('0x28')](_0x534fba);}return null;};}function patchUpdates(_0x4fb61d){return function(_0x4ff627){try{jsonpatch[_0x98a7('0x2e')](_0x4ff627,_0x4fb61d,!![]);}catch(_0x3c9503){return BPromise[_0x98a7('0x2f')](_0x3c9503);}return _0x4ff627[_0x98a7('0x30')]();};}function saveUpdates(_0x1b7d02,_0x1ee99a){return function(_0x236c54){if(_0x236c54){return _0x236c54['update'](_0x1b7d02)[_0x98a7('0x1b')](function(_0x151d1c){return _0x151d1c;});}return null;};}function removeEntity(_0x572882,_0x43fa92){return function(_0x47ee13){if(_0x47ee13){return _0x47ee13['destroy']()[_0x98a7('0x1b')](function(){_0x572882['status'](0xcc)[_0x98a7('0x27')]();});}};}function handleEntityNotFound(_0x17967d,_0x1ea114){return function(_0x18697){if(!_0x18697){_0x17967d[_0x98a7('0x26')](0x194);}return _0x18697;};}function handleError(_0x691733,_0xae0afa){_0xae0afa=_0xae0afa||0x1f4;return function(_0x26e6c6){logger[_0x98a7('0x22')](_0x26e6c6[_0x98a7('0x31')]);if(_0x26e6c6[_0x98a7('0x32')]){delete _0x26e6c6[_0x98a7('0x32')];}_0x691733[_0x98a7('0x2b')](_0xae0afa)[_0x98a7('0x33')](_0x26e6c6);};}exports['index']=function(_0x1f1b7d,_0x1c977f){var _0x30cb72={},_0x45d67a={},_0x38d26a={'count':0x0,'rows':[]};var _0x42e0ba=_[_0x98a7('0x34')](db[_0x98a7('0x35')]['rawAttributes'],function(_0x53025d){return{'name':_0x53025d[_0x98a7('0x36')],'type':_0x53025d[_0x98a7('0x37')][_0x98a7('0x38')]};});_0x45d67a[_0x98a7('0x39')]=_[_0x98a7('0x34')](_0x42e0ba,_0x98a7('0x32'));_0x45d67a[_0x98a7('0x3a')]=_[_0x98a7('0x3b')](_0x1f1b7d[_0x98a7('0x3a')]);_0x45d67a['filters']=_['intersection'](_0x45d67a['model'],_0x45d67a[_0x98a7('0x3a')]);_0x30cb72[_0x98a7('0x3c')]=_['intersection'](_0x45d67a[_0x98a7('0x39')],qs[_0x98a7('0x3d')](_0x1f1b7d[_0x98a7('0x3a')]['fields']));_0x30cb72['attributes']=_0x30cb72[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x30cb72[_0x98a7('0x3c')]:_0x45d67a[_0x98a7('0x39')];if(!_0x1f1b7d['query'][_0x98a7('0x3f')](_0x98a7('0x40'))){_0x30cb72[_0x98a7('0x2a')]=qs[_0x98a7('0x2a')](_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x2a')]);_0x30cb72[_0x98a7('0x29')]=qs[_0x98a7('0x29')](_0x1f1b7d['query'][_0x98a7('0x29')]);}_0x30cb72[_0x98a7('0x41')]=qs[_0x98a7('0x42')](_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x42')]);_0x30cb72[_0x98a7('0x43')]=qs[_0x98a7('0x44')](_['pick'](_0x1f1b7d['query'],_0x45d67a[_0x98a7('0x44')]),_0x42e0ba);if(_0x1f1b7d[_0x98a7('0x3a')]['filter']){_0x30cb72['where']=_[_0x98a7('0x45')](_0x30cb72[_0x98a7('0x43')],{'$or':_[_0x98a7('0x34')](_0x42e0ba,function(_0x32c8a7){if(_0x32c8a7[_0x98a7('0x37')]!==_0x98a7('0x46')){var _0x10f272={};_0x10f272[_0x32c8a7[_0x98a7('0x32')]]={'$like':'%'+_0x1f1b7d['query'][_0x98a7('0x47')]+'%'};return _0x10f272;}})});}_0x30cb72=_[_0x98a7('0x45')]({},_0x30cb72,_0x1f1b7d['options']);var _0x51f9a6={'where':_0x30cb72[_0x98a7('0x43')]};return db[_0x98a7('0x35')][_0x98a7('0x48')](_0x51f9a6)[_0x98a7('0x1b')](function(_0x3f29d5){_0x38d26a[_0x98a7('0x48')]=_0x3f29d5;if(_0x1f1b7d[_0x98a7('0x3a')][_0x98a7('0x49')]){_0x30cb72[_0x98a7('0x4a')]=[{'all':!![]}];}return db[_0x98a7('0x35')][_0x98a7('0x4b')](_0x30cb72);})[_0x98a7('0x1b')](function(_0x21c0f6){_0x38d26a[_0x98a7('0x4c')]=_0x21c0f6;return _0x38d26a;})[_0x98a7('0x1b')](respondWithFilteredResult(_0x1c977f,_0x30cb72))[_0x98a7('0x25')](handleError(_0x1c977f,null));};exports['show']=function(_0x48b3ee,_0xde3b53){var _0x530fc9={'raw':![],'where':{'id':_0x48b3ee[_0x98a7('0x4d')]['id']}},_0x26d017={};_0x26d017[_0x98a7('0x39')]=_[_0x98a7('0x3b')](db[_0x98a7('0x35')][_0x98a7('0x4e')]);_0x26d017['query']=_['keys'](_0x48b3ee[_0x98a7('0x3a')]);_0x26d017[_0x98a7('0x44')]=_[_0x98a7('0x4f')](_0x26d017[_0x98a7('0x39')],_0x26d017[_0x98a7('0x3a')]);_0x530fc9['attributes']=_['intersection'](_0x26d017[_0x98a7('0x39')],qs[_0x98a7('0x3d')](_0x48b3ee[_0x98a7('0x3a')][_0x98a7('0x3d')]));_0x530fc9[_0x98a7('0x3c')]=_0x530fc9[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x530fc9['attributes']:_0x26d017[_0x98a7('0x39')];if(_0x48b3ee[_0x98a7('0x3a')][_0x98a7('0x49')]){_0x530fc9[_0x98a7('0x4a')]=[{'all':!![]}];}_0x530fc9=_['merge']({},_0x530fc9,_0x48b3ee[_0x98a7('0x50')]);return db[_0x98a7('0x35')][_0x98a7('0x51')](_0x530fc9)[_0x98a7('0x1b')](handleEntityNotFound(_0xde3b53,null))[_0x98a7('0x1b')](respondWithResult(_0xde3b53,null))[_0x98a7('0x25')](handleError(_0xde3b53,null));};exports[_0x98a7('0x52')]=function(_0x11cccb,_0x21985c){return db[_0x98a7('0x35')][_0x98a7('0x52')](_0x11cccb[_0x98a7('0x53')],{})['then'](respondWithResult(_0x21985c,0xc9))[_0x98a7('0x25')](handleError(_0x21985c,null));};exports[_0x98a7('0x54')]=function(_0x8103bd,_0x5581e6){if(_0x8103bd[_0x98a7('0x53')]['id']){delete _0x8103bd[_0x98a7('0x53')]['id'];}return db[_0x98a7('0x35')][_0x98a7('0x51')]({'where':{'id':_0x8103bd['params']['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x5581e6,null))[_0x98a7('0x1b')](saveUpdates(_0x8103bd[_0x98a7('0x53')],null))[_0x98a7('0x1b')](respondWithResult(_0x5581e6,null))[_0x98a7('0x25')](handleError(_0x5581e6,null));};exports['destroy']=function(_0x5aec16,_0x39ad13){return db['FreshdeskAccount'][_0x98a7('0x51')]({'where':{'id':_0x5aec16[_0x98a7('0x4d')]['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x39ad13,null))[_0x98a7('0x1b')](removeEntity(_0x39ad13,null))[_0x98a7('0x25')](handleError(_0x39ad13,null));};exports[_0x98a7('0x55')]=function(_0x221731,_0x3ff3e3,_0x13a9c6){var _0x4f39d3={};var _0x17e867={};var _0x5064d9;var _0xbc3410;return db[_0x98a7('0x35')]['findOne']({'where':{'id':_0x221731['params']['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x3ff3e3,null))[_0x98a7('0x1b')](function(_0x260445){if(_0x260445){_0x5064d9=_0x260445;_0x17e867['model']=_['keys'](db['FreshdeskConfiguration'][_0x98a7('0x4e')]);_0x17e867[_0x98a7('0x3a')]=_['keys'](_0x221731[_0x98a7('0x3a')]);_0x17e867[_0x98a7('0x44')]=_[_0x98a7('0x4f')](_0x17e867[_0x98a7('0x39')],_0x17e867[_0x98a7('0x3a')]);_0x4f39d3[_0x98a7('0x3c')]=_['intersection'](_0x17e867[_0x98a7('0x39')],qs['fields'](_0x221731[_0x98a7('0x3a')][_0x98a7('0x3d')]));_0x4f39d3[_0x98a7('0x3c')]=_0x4f39d3[_0x98a7('0x3c')][_0x98a7('0x3e')]?_0x4f39d3[_0x98a7('0x3c')]:_0x17e867['model'];_0x4f39d3[_0x98a7('0x41')]=qs['sort'](_0x221731[_0x98a7('0x3a')][_0x98a7('0x42')]);_0x4f39d3[_0x98a7('0x43')]=qs['filters'](_[_0x98a7('0x56')](_0x221731[_0x98a7('0x3a')],_0x17e867[_0x98a7('0x44')]));if(_0x221731['query'][_0x98a7('0x47')]){_0x4f39d3[_0x98a7('0x43')]=_[_0x98a7('0x45')](_0x4f39d3[_0x98a7('0x43')],{'$or':_[_0x98a7('0x34')](_0x4f39d3[_0x98a7('0x3c')],function(_0x29c87b){var _0x39658b={};_0x39658b[_0x29c87b]={'$like':'%'+_0x221731[_0x98a7('0x3a')][_0x98a7('0x47')]+'%'};return _0x39658b;})});}_0x4f39d3=_[_0x98a7('0x45')]({},_0x4f39d3,_0x221731[_0x98a7('0x50')]);return _0x5064d9[_0x98a7('0x55')](_0x4f39d3);}})[_0x98a7('0x1b')](function(_0x524659){if(_0x524659){_0xbc3410=_0x524659[_0x98a7('0x3e')];if(!_0x221731['query'][_0x98a7('0x3f')](_0x98a7('0x40'))){_0x4f39d3['limit']=qs[_0x98a7('0x2a')](_0x221731[_0x98a7('0x3a')][_0x98a7('0x2a')]);_0x4f39d3['offset']=qs[_0x98a7('0x29')](_0x221731[_0x98a7('0x3a')][_0x98a7('0x29')]);}return _0x5064d9['getConfigurations'](_0x4f39d3);}})[_0x98a7('0x1b')](function(_0x44c199){if(_0x44c199){return _0x44c199?{'count':_0xbc3410,'rows':_0x44c199}:null;}})[_0x98a7('0x1b')](respondWithResult(_0x3ff3e3,null))[_0x98a7('0x25')](handleError(_0x3ff3e3,null));};exports[_0x98a7('0x57')]=function(_0x5854d4,_0x49b1a5,_0x3c9e69){if(_0x5854d4[_0x98a7('0x53')]['id']){delete _0x5854d4[_0x98a7('0x53')]['id'];}return db[_0x98a7('0x35')][_0x98a7('0x58')]({'where':{'id':_0x5854d4[_0x98a7('0x4d')]['id']}})[_0x98a7('0x1b')](handleEntityNotFound(_0x49b1a5,null))['then'](function(_0x5e0f3d){if(_0x5e0f3d){_0x5854d4[_0x98a7('0x53')]['AccountId']=_0x5e0f3d['id'];_0x5854d4[_0x98a7('0x53')][_0x98a7('0x59')]=integrations[_0x98a7('0x5a')](_0x5854d4[_0x98a7('0x53')]['channel'],_0x5854d4[_0x98a7('0x53')][_0x98a7('0x37')]);_0x5854d4[_0x98a7('0x53')][_0x98a7('0x5b')]=integrations[_0x98a7('0x5c')](_0x5854d4[_0x98a7('0x53')]['channel'],_0x5854d4[_0x98a7('0x53')][_0x98a7('0x37')]);return db[_0x98a7('0x5d')]['create'](_0x5854d4[_0x98a7('0x53')],{'include':[{'model':db[_0x98a7('0x5e')],'as':_0x98a7('0x59')},{'model':db[_0x98a7('0x5e')],'as':_0x98a7('0x5b')}]});}return null;})[_0x98a7('0x1b')](respondWithResult(_0x49b1a5,null))[_0x98a7('0x25')](handleError(_0x49b1a5,null));};exports['getFields']=function(_0x9efac5,_0x35ba6c,_0x4f4c11){var _0x46faae='';return db[_0x98a7('0x35')]['findOne']({'where':{'id':_0x9efac5[_0x98a7('0x4d')]['id']},'attributes':['id',_0x98a7('0x5f'),_0x98a7('0x60')]})[_0x98a7('0x1b')](handleEntityNotFound(_0x35ba6c,null))[_0x98a7('0x1b')](function(_0x11aa51){if(_0x11aa51){_0x46faae=_0x11aa51[_0x98a7('0x5f')];var _0x52dccd=_0x46faae[_0x98a7('0x61')](-0x1);if(_0x52dccd==='/'){_0x46faae=_0x46faae['substring'](0x0,_0x46faae[_0x98a7('0x62')](_0x52dccd));}return rp({'method':_0x98a7('0x63'),'uri':util[_0x98a7('0x64')](_0x98a7('0x65'),_0x46faae,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x98a7('0x64')]('Basic\x20%s',new Buffer(util['format'](_0x98a7('0x66'),_0x11aa51[_0x98a7('0x60')]))['toString']('base64'))},'json':!![]});}})[_0x98a7('0x1b')](function(_0x4cbfaa){if(_0x4cbfaa){var _0x2bc5e9=[_0x98a7('0x67'),_0x98a7('0x68'),_0x98a7('0x69'),'description','status',_0x98a7('0x6a'),_0x98a7('0x6b'),_0x98a7('0x6c'),_0x98a7('0x6d'),_0x98a7('0x6b'),'company'];_[_0x98a7('0x6e')](_0x4cbfaa,function(_0x2599b9){return _0x2bc5e9[_0x98a7('0x6f')](_0x2599b9[_0x98a7('0x32')])||!_0x2599b9[_0x98a7('0x70')]&&_0x2599b9['type']!==_0x98a7('0x71')&&_0x2599b9['type']!==_0x98a7('0x72');});return{'count':_0x4cbfaa[_0x98a7('0x3e')],'rows':_[_0x98a7('0x34')](_0x4cbfaa,function(_0x4deef4){return{'id':_0x4deef4[_0x98a7('0x32')],'name':_0x4deef4['label'],'custom':!_0x4deef4[_0x98a7('0x70')],'options':_0x4deef4['choices']?_[_0x98a7('0x34')](_0x4deef4['choices'],function(_0x46b9eb){return{'name':_[_0x98a7('0x73')](_0x46b9eb),'value':_0x46b9eb};}):[]};})};}})[_0x98a7('0x1b')](respondWithResult(_0x35ba6c,null))[_0x98a7('0x25')](function(_0x46b2cb){var _0x2d223b=_0x9efac5[_0x98a7('0x3a')][_0x98a7('0x74')]?0x1f4:_0x46b2cb[_0x98a7('0x75')]||0x1f4;logger[_0x98a7('0x22')](_0x98a7('0x76'),_0x98a7('0x77'),_0x2d223b,JSON[_0x98a7('0x21')](_0x46b2cb));delete _0x46b2cb['name'];if(_0x2d223b===0x191){_0x2d223b=0x190;}_0x35ba6c[_0x98a7('0x2b')](_0x2d223b)['send'](_0x9efac5[_0x98a7('0x3a')]['test']?{'message':_0x98a7('0x78'),'statusCode':_0x46b2cb[_0x98a7('0x75')]}:_0x46b2cb);});}; \ No newline at end of file +var _0x7761=['sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','show','length','includeAll','include','find','create','body','getConfigurations','findOne','params','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','info','result','catch'];(function(_0x2fdafb,_0x2e19b7){var _0x3f0060=function(_0x4707f6){while(--_0x4707f6){_0x2fdafb['push'](_0x2fdafb['shift']());}};_0x3f0060(++_0x2e19b7);}(_0x7761,0x151));var _0x1776=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7761[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1776('0x0'));var emlformat=require(_0x1776('0x1'));var rimraf=require(_0x1776('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1776('0x3'));var BPromise=require(_0x1776('0x4'));var Mustache=require(_0x1776('0x5'));var util=require('util');var path=require(_0x1776('0x6'));var sox=require(_0x1776('0x7'));var csv=require(_0x1776('0x8'));var ejs=require(_0x1776('0x9'));var fs=require('fs');var _=require(_0x1776('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1776('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1776('0xc'));var Papa=require(_0x1776('0xd'));var Redis=require(_0x1776('0xe'));var authService=require(_0x1776('0xf'));var qs=require(_0x1776('0x10'));var as=require(_0x1776('0x11'));var hardwareService=require(_0x1776('0x12'));var logger=require('../../config/logger')(_0x1776('0x13'));var utils=require(_0x1776('0x14'));var config=require(_0x1776('0x15'));var licenseUtil=require(_0x1776('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1776('0x17'));var jayson=require(_0x1776('0x18'));var client=jayson[_0x1776('0x19')][_0x1776('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5e2730,_0x2357c0,_0xf1dbd1,_0x9a0486){return new BPromise(function(_0x426b6d,_0x5a2573){var _0x5366f6=_0x9a0486||client;return _0x5366f6[_0x1776('0x1b')](_0x5e2730,_0xf1dbd1)[_0x1776('0x1c')](function(_0xa4dfa8){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2357c0,_0x1776('0x1d'));logger[_0x1776('0x1e')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2357c0,_0x1776('0x1d'),JSON[_0x1776('0x1f')](_0xa4dfa8));if(_0xa4dfa8[_0x1776('0x20')]){if(_0xa4dfa8[_0x1776('0x20')]['code']===0x1f4){logger[_0x1776('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x2357c0,_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);return _0x5a2573(_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);}logger[_0x1776('0x20')](_0x1776('0x22'),_0x2357c0,_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);return _0x426b6d(_0xa4dfa8[_0x1776('0x20')]['message']);}else{logger[_0x1776('0x23')](_0x1776('0x22'),_0x2357c0,_0x1776('0x1d'));_0x426b6d(_0xa4dfa8[_0x1776('0x24')][_0x1776('0x21')]);}})[_0x1776('0x25')](function(_0x96198){logger['error'](_0x1776('0x22'),_0x2357c0,_0x96198);_0x5a2573(_0x96198);});});}function respondWithStatusCode(_0x3a22ec,_0xf947da){_0xf947da=_0xf947da||0xcc;return function(_0x29b488){if(_0x29b488){return _0x3a22ec[_0x1776('0x26')](_0xf947da);}return _0x3a22ec[_0x1776('0x27')](_0xf947da)[_0x1776('0x28')]();};}function respondWithResult(_0x5a5b5a,_0x1fb3a6){_0x1fb3a6=_0x1fb3a6||0xc8;return function(_0x98d4a8){if(_0x98d4a8){return _0x5a5b5a[_0x1776('0x27')](_0x1fb3a6)[_0x1776('0x29')](_0x98d4a8);}};}function respondWithFilteredResult(_0x1b7b8f,_0x477658){return function(_0x46e741){if(_0x46e741){var _0x2e1d8b=_0x46e741['count'],_0x5b53b8=_0x477658[_0x1776('0x2a')],_0xd668d8=_0x477658['offset']+_0x477658[_0x1776('0x2b')],_0x5d6fb1;if(_0xd668d8>=_0x2e1d8b){_0xd668d8=_0x2e1d8b;_0x5d6fb1=0xc8;}else{_0x5d6fb1=0xce;}_0x1b7b8f[_0x1776('0x27')](_0x5d6fb1);return _0x1b7b8f[_0x1776('0x2c')](_0x1776('0x2d'),_0x5b53b8+'-'+_0xd668d8+'/'+_0x2e1d8b)['json'](_0x46e741);}return null;};}function patchUpdates(_0x440905){return function(_0x549b34){try{jsonpatch['apply'](_0x549b34,_0x440905,!![]);}catch(_0x50ffe8){return BPromise[_0x1776('0x2e')](_0x50ffe8);}return _0x549b34[_0x1776('0x2f')]();};}function saveUpdates(_0x193093,_0x551283){return function(_0x355845){if(_0x355845){return _0x355845[_0x1776('0x30')](_0x193093)[_0x1776('0x1c')](function(_0x2489bd){return _0x2489bd;});}return null;};}function removeEntity(_0x1fa40e,_0x4a4f14){return function(_0x36bf31){if(_0x36bf31){return _0x36bf31[_0x1776('0x31')]()[_0x1776('0x1c')](function(){_0x1fa40e[_0x1776('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c39e,_0x578cd0){return function(_0x35a970){if(!_0x35a970){_0x17c39e[_0x1776('0x26')](0x194);}return _0x35a970;};}function handleError(_0x5c0f61,_0xa0fc42){_0xa0fc42=_0xa0fc42||0x1f4;return function(_0x322545){logger['error'](_0x322545['stack']);if(_0x322545[_0x1776('0x32')]){delete _0x322545[_0x1776('0x32')];}_0x5c0f61[_0x1776('0x27')](_0xa0fc42)[_0x1776('0x33')](_0x322545);};}exports['index']=function(_0x3522b,_0x851400){var _0xc05e37={},_0x9328b1={},_0x3e9c67={'count':0x0,'rows':[]};var _0x56a0ab=_['map'](db[_0x1776('0x34')][_0x1776('0x35')],function(_0x1dd49d){return{'name':_0x1dd49d[_0x1776('0x36')],'type':_0x1dd49d[_0x1776('0x37')]['key']};});_0x9328b1[_0x1776('0x38')]=_[_0x1776('0x39')](_0x56a0ab,_0x1776('0x32'));_0x9328b1[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x3522b[_0x1776('0x3a')]);_0x9328b1[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x9328b1[_0x1776('0x38')],_0x9328b1[_0x1776('0x3a')]);_0xc05e37['attributes']=_[_0x1776('0x3d')](_0x9328b1[_0x1776('0x38')],qs[_0x1776('0x3e')](_0x3522b[_0x1776('0x3a')][_0x1776('0x3e')]));_0xc05e37[_0x1776('0x3f')]=_0xc05e37[_0x1776('0x3f')]['length']?_0xc05e37['attributes']:_0x9328b1[_0x1776('0x38')];if(!_0x3522b['query']['hasOwnProperty'](_0x1776('0x40'))){_0xc05e37[_0x1776('0x2b')]=qs[_0x1776('0x2b')](_0x3522b[_0x1776('0x3a')][_0x1776('0x2b')]);_0xc05e37['offset']=qs[_0x1776('0x2a')](_0x3522b[_0x1776('0x3a')][_0x1776('0x2a')]);}_0xc05e37[_0x1776('0x41')]=qs[_0x1776('0x42')](_0x3522b[_0x1776('0x3a')][_0x1776('0x42')]);_0xc05e37[_0x1776('0x43')]=qs[_0x1776('0x3c')](_[_0x1776('0x44')](_0x3522b['query'],_0x9328b1[_0x1776('0x3c')]),_0x56a0ab);if(_0x3522b[_0x1776('0x3a')]['filter']){_0xc05e37['where']=_[_0x1776('0x45')](_0xc05e37['where'],{'$or':_[_0x1776('0x39')](_0x56a0ab,function(_0x353e97){if(_0x353e97[_0x1776('0x37')]!==_0x1776('0x46')){var _0x21a441={};_0x21a441[_0x353e97[_0x1776('0x32')]]={'$like':'%'+_0x3522b[_0x1776('0x3a')][_0x1776('0x47')]+'%'};return _0x21a441;}})});}_0xc05e37=_[_0x1776('0x45')]({},_0xc05e37,_0x3522b[_0x1776('0x48')]);var _0x245958={'where':_0xc05e37['where']};return db[_0x1776('0x34')]['count'](_0x245958)[_0x1776('0x1c')](function(_0x289c3a){_0x3e9c67[_0x1776('0x49')]=_0x289c3a;if(_0x3522b[_0x1776('0x3a')]['includeAll']){_0xc05e37['include']=[{'all':!![]}];}return db[_0x1776('0x34')][_0x1776('0x4a')](_0xc05e37);})[_0x1776('0x1c')](function(_0x5b11d0){_0x3e9c67[_0x1776('0x4b')]=_0x5b11d0;return _0x3e9c67;})[_0x1776('0x1c')](respondWithFilteredResult(_0x851400,_0xc05e37))[_0x1776('0x25')](handleError(_0x851400,null));};exports[_0x1776('0x4c')]=function(_0x2bb41c,_0x545bdc){var _0x550f46={'raw':![],'where':{'id':_0x2bb41c['params']['id']}},_0x1d6f7c={};_0x1d6f7c[_0x1776('0x38')]=_[_0x1776('0x3b')](db[_0x1776('0x34')][_0x1776('0x35')]);_0x1d6f7c[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x2bb41c[_0x1776('0x3a')]);_0x1d6f7c[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x1d6f7c[_0x1776('0x38')],_0x1d6f7c[_0x1776('0x3a')]);_0x550f46[_0x1776('0x3f')]=_[_0x1776('0x3d')](_0x1d6f7c[_0x1776('0x38')],qs[_0x1776('0x3e')](_0x2bb41c['query'][_0x1776('0x3e')]));_0x550f46[_0x1776('0x3f')]=_0x550f46[_0x1776('0x3f')][_0x1776('0x4d')]?_0x550f46[_0x1776('0x3f')]:_0x1d6f7c['model'];if(_0x2bb41c[_0x1776('0x3a')][_0x1776('0x4e')]){_0x550f46[_0x1776('0x4f')]=[{'all':!![]}];}_0x550f46=_[_0x1776('0x45')]({},_0x550f46,_0x2bb41c['options']);return db[_0x1776('0x34')][_0x1776('0x50')](_0x550f46)['then'](handleEntityNotFound(_0x545bdc,null))['then'](respondWithResult(_0x545bdc,null))[_0x1776('0x25')](handleError(_0x545bdc,null));};exports[_0x1776('0x51')]=function(_0x1a4dcd,_0x1e03e1){return db['FreshdeskAccount'][_0x1776('0x51')](_0x1a4dcd[_0x1776('0x52')],{})[_0x1776('0x1c')](respondWithResult(_0x1e03e1,0xc9))['catch'](handleError(_0x1e03e1,null));};exports[_0x1776('0x30')]=function(_0x1fde04,_0x5f46c1){if(_0x1fde04['body']['id']){delete _0x1fde04['body']['id'];}return db[_0x1776('0x34')]['find']({'where':{'id':_0x1fde04['params']['id']}})['then'](handleEntityNotFound(_0x5f46c1,null))['then'](saveUpdates(_0x1fde04[_0x1776('0x52')],null))[_0x1776('0x1c')](respondWithResult(_0x5f46c1,null))['catch'](handleError(_0x5f46c1,null));};exports[_0x1776('0x31')]=function(_0xad3bac,_0x430ca3){return db[_0x1776('0x34')]['find']({'where':{'id':_0xad3bac['params']['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x430ca3,null))[_0x1776('0x1c')](removeEntity(_0x430ca3,null))['catch'](handleError(_0x430ca3,null));};exports[_0x1776('0x53')]=function(_0x266e99,_0x3559d1,_0x4a0867){var _0x34ee82={};var _0x341868={};var _0x5bdeee;var _0xe6914;return db['FreshdeskAccount'][_0x1776('0x54')]({'where':{'id':_0x266e99[_0x1776('0x55')]['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x3559d1,null))[_0x1776('0x1c')](function(_0x2bcd1c){if(_0x2bcd1c){_0x5bdeee=_0x2bcd1c;_0x341868[_0x1776('0x38')]=_[_0x1776('0x3b')](db['FreshdeskConfiguration'][_0x1776('0x35')]);_0x341868[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x266e99[_0x1776('0x3a')]);_0x341868[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x341868[_0x1776('0x38')],_0x341868[_0x1776('0x3a')]);_0x34ee82[_0x1776('0x3f')]=_[_0x1776('0x3d')](_0x341868['model'],qs[_0x1776('0x3e')](_0x266e99[_0x1776('0x3a')][_0x1776('0x3e')]));_0x34ee82[_0x1776('0x3f')]=_0x34ee82['attributes']['length']?_0x34ee82[_0x1776('0x3f')]:_0x341868[_0x1776('0x38')];_0x34ee82[_0x1776('0x41')]=qs[_0x1776('0x42')](_0x266e99[_0x1776('0x3a')][_0x1776('0x42')]);_0x34ee82[_0x1776('0x43')]=qs[_0x1776('0x3c')](_[_0x1776('0x44')](_0x266e99[_0x1776('0x3a')],_0x341868[_0x1776('0x3c')]));if(_0x266e99[_0x1776('0x3a')][_0x1776('0x47')]){_0x34ee82[_0x1776('0x43')]=_[_0x1776('0x45')](_0x34ee82[_0x1776('0x43')],{'$or':_[_0x1776('0x39')](_0x34ee82['attributes'],function(_0x48c615){var _0x3d3a0f={};_0x3d3a0f[_0x48c615]={'$like':'%'+_0x266e99[_0x1776('0x3a')]['filter']+'%'};return _0x3d3a0f;})});}_0x34ee82=_[_0x1776('0x45')]({},_0x34ee82,_0x266e99[_0x1776('0x48')]);return _0x5bdeee[_0x1776('0x53')](_0x34ee82);}})[_0x1776('0x1c')](function(_0x2caf72){if(_0x2caf72){_0xe6914=_0x2caf72[_0x1776('0x4d')];if(!_0x266e99[_0x1776('0x3a')][_0x1776('0x56')](_0x1776('0x40'))){_0x34ee82['limit']=qs[_0x1776('0x2b')](_0x266e99[_0x1776('0x3a')][_0x1776('0x2b')]);_0x34ee82[_0x1776('0x2a')]=qs[_0x1776('0x2a')](_0x266e99[_0x1776('0x3a')][_0x1776('0x2a')]);}return _0x5bdeee['getConfigurations'](_0x34ee82);}})['then'](function(_0x5e7a9b){if(_0x5e7a9b){return _0x5e7a9b?{'count':_0xe6914,'rows':_0x5e7a9b}:null;}})['then'](respondWithResult(_0x3559d1,null))['catch'](handleError(_0x3559d1,null));};exports[_0x1776('0x57')]=function(_0x188e58,_0x2842b2,_0x14f5c1){if(_0x188e58[_0x1776('0x52')]['id']){delete _0x188e58[_0x1776('0x52')]['id'];}return db[_0x1776('0x34')]['findOne']({'where':{'id':_0x188e58[_0x1776('0x55')]['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x2842b2,null))[_0x1776('0x1c')](function(_0xd559a1){if(_0xd559a1){_0x188e58[_0x1776('0x52')][_0x1776('0x58')]=_0xd559a1['id'];_0x188e58[_0x1776('0x52')][_0x1776('0x59')]=integrations[_0x1776('0x5a')](_0x188e58['body']['channel'],_0x188e58[_0x1776('0x52')]['type']);_0x188e58[_0x1776('0x52')]['Descriptions']=integrations[_0x1776('0x5b')](_0x188e58[_0x1776('0x52')][_0x1776('0x5c')],_0x188e58[_0x1776('0x52')]['type']);return db[_0x1776('0x5d')]['create'](_0x188e58['body'],{'include':[{'model':db[_0x1776('0x5e')],'as':_0x1776('0x59')},{'model':db[_0x1776('0x5e')],'as':'Descriptions'}]});}return null;})[_0x1776('0x1c')](respondWithResult(_0x2842b2,null))[_0x1776('0x25')](handleError(_0x2842b2,null));};exports[_0x1776('0x5f')]=function(_0x1cf64b,_0x15db49,_0xe616ff){var _0x1ffb41='';return db[_0x1776('0x34')]['findOne']({'where':{'id':_0x1cf64b[_0x1776('0x55')]['id']},'attributes':['id',_0x1776('0x60'),_0x1776('0x61')]})[_0x1776('0x1c')](handleEntityNotFound(_0x15db49,null))[_0x1776('0x1c')](function(_0x37bc51){if(_0x37bc51){_0x1ffb41=_0x37bc51[_0x1776('0x60')];var _0x194953=_0x1ffb41[_0x1776('0x62')](-0x1);if(_0x194953==='/'){_0x1ffb41=_0x1ffb41['substring'](0x0,_0x1ffb41[_0x1776('0x63')](_0x194953));}return rp({'method':_0x1776('0x64'),'uri':util[_0x1776('0x65')]('%s/%s',_0x1ffb41,_0x1776('0x66')),'headers':{'Authorization':util[_0x1776('0x65')](_0x1776('0x67'),new Buffer(util[_0x1776('0x65')]('%s:X',_0x37bc51[_0x1776('0x61')]))[_0x1776('0x68')](_0x1776('0x69')))},'json':!![]});}})[_0x1776('0x1c')](function(_0xe0955c){if(_0xe0955c){var _0x43f89b=[_0x1776('0x6a'),_0x1776('0x6b'),_0x1776('0x6c'),_0x1776('0x6d'),'status',_0x1776('0x6e'),_0x1776('0x6f'),_0x1776('0x70'),_0x1776('0x71'),_0x1776('0x6f'),_0x1776('0x72')];_['remove'](_0xe0955c,function(_0x3a16c8){return _0x43f89b[_0x1776('0x73')](_0x3a16c8[_0x1776('0x32')])||!_0x3a16c8[_0x1776('0x74')]&&_0x3a16c8['type']!==_0x1776('0x75')&&_0x3a16c8['type']!==_0x1776('0x76');});return{'count':_0xe0955c['length'],'rows':_[_0x1776('0x39')](_0xe0955c,function(_0x2d76fe){return{'id':_0x2d76fe[_0x1776('0x32')],'name':_0x2d76fe[_0x1776('0x77')],'custom':!_0x2d76fe[_0x1776('0x74')],'options':_0x2d76fe[_0x1776('0x78')]?_[_0x1776('0x39')](_0x2d76fe[_0x1776('0x78')],function(_0x222319){return{'name':_[_0x1776('0x79')](_0x222319),'value':_0x222319};}):[]};})};}})['then'](respondWithResult(_0x15db49,null))[_0x1776('0x25')](function(_0x2168ed){var _0xf8254f=_0x1cf64b[_0x1776('0x3a')]['test']?0x1f4:_0x2168ed[_0x1776('0x7a')]||0x1f4;logger[_0x1776('0x20')](_0x1776('0x7b'),_0x1776('0x5f'),_0xf8254f,JSON[_0x1776('0x1f')](_0x2168ed));delete _0x2168ed[_0x1776('0x32')];if(_0xf8254f===0x191){_0xf8254f=0x190;}_0x15db49['status'](_0xf8254f)[_0x1776('0x33')](_0x1cf64b['query'][_0x1776('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x2168ed[_0x1776('0x7a')]}:_0x2168ed);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 339f834..3f63ad7 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 _0x99d4=['path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x40a77d,_0x53f474){var _0x3173c0=function(_0x39de4d){while(--_0x39de4d){_0x40a77d['push'](_0x40a77d['shift']());}};_0x3173c0(++_0x53f474);}(_0x99d4,0xa3));var _0x499d=function(_0x3803cb,_0x2c7aea){_0x3803cb=_0x3803cb-0x0;var _0x53a15d=_0x99d4[_0x3803cb];return _0x53a15d;};'use strict';var _=require(_0x499d('0x0'));var util=require(_0x499d('0x1'));var logger=require(_0x499d('0x2'))(_0x499d('0x3'));var moment=require('moment');var BPromise=require(_0x499d('0x4'));var rp=require(_0x499d('0x5'));var fs=require('fs');var path=require(_0x499d('0x6'));var rimraf=require('rimraf');var config=require(_0x499d('0x7'));var attributes=require(_0x499d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x499d('0x9')]=function(_0x51a3ac,_0x34092b){return _0x51a3ac[_0x499d('0xa')](_0x499d('0xb'),attributes,{'tableName':_0x499d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd605=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x1eef48,_0x130aed){var _0xe29de8=function(_0x3a0bde){while(--_0x3a0bde){_0x1eef48['push'](_0x1eef48['shift']());}};_0xe29de8(++_0x130aed);}(_0xd605,0x1d7));var _0x5d60=function(_0x47bc5e,_0x47d59d){_0x47bc5e=_0x47bc5e-0x0;var _0x16f825=_0xd605[_0x47bc5e];return _0x16f825;};'use strict';var _=require(_0x5d60('0x0'));var util=require(_0x5d60('0x1'));var logger=require('../../config/logger')(_0x5d60('0x2'));var moment=require(_0x5d60('0x3'));var BPromise=require(_0x5d60('0x4'));var rp=require(_0x5d60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d60('0x6'));var config=require(_0x5d60('0x7'));var attributes=require(_0x5d60('0x8'));var integrations=require(_0x5d60('0x9'));module[_0x5d60('0xa')]=function(_0x2ba660,_0x542f09){return _0x2ba660[_0x5d60('0xb')](_0x5d60('0xc'),attributes,{'tableName':_0x5d60('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 8ddaf5c..5f89598 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 _0x5a92=['stringify','error','code','message','GetFreshdeskAccount','findAll','options','raw','attributes','limit','map','include','model','catch','ShowFreshdeskAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58c8fd,_0x2d395e){var _0x548eef=function(_0x2b1129){while(--_0x2b1129){_0x58c8fd['push'](_0x58c8fd['shift']());}};_0x548eef(++_0x2d395e);}(_0x5a92,0x74));var _0x25a9=function(_0x5e546c,_0x141d38){_0x5e546c=_0x5e546c-0x0;var _0x5b116f=_0x5a92[_0x5e546c];return _0x5b116f;};'use strict';var _=require(_0x25a9('0x0'));var util=require(_0x25a9('0x1'));var moment=require(_0x25a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x25a9('0x3'));var fs=require('fs');var Redis=require(_0x25a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25a9('0x5'));var logger=require('../../config/logger')(_0x25a9('0x6'));var config=require(_0x25a9('0x7'));var jayson=require(_0x25a9('0x8'));var client=jayson[_0x25a9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47c810,_0x278624,_0x5cdef9){return new BPromise(function(_0x494bd0,_0x538811){return client[_0x25a9('0xa')](_0x47c810,_0x5cdef9)[_0x25a9('0xb')](function(_0x2ce6b4){logger[_0x25a9('0xc')](_0x25a9('0xd'),_0x278624,_0x25a9('0xe'));logger[_0x25a9('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x278624,'request\x20sent',JSON[_0x25a9('0x10')](_0x2ce6b4));if(_0x2ce6b4['error']){if(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x12')]===0x1f4){logger[_0x25a9('0x11')](_0x25a9('0xd'),_0x278624,_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);return _0x538811(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);}logger[_0x25a9('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x278624,_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);return _0x494bd0(_0x2ce6b4[_0x25a9('0x11')][_0x25a9('0x13')]);}else{logger['info'](_0x25a9('0xd'),_0x278624,_0x25a9('0xe'));_0x494bd0(_0x2ce6b4['result']['message']);}})['catch'](function(_0x1ba2e6){logger[_0x25a9('0x11')](_0x25a9('0xd'),_0x278624,_0x1ba2e6);_0x538811(_0x1ba2e6);});});}exports[_0x25a9('0x14')]=function(_0x8f17c7){var _0x175c89=this;return new Promise(function(_0x2ac16c,_0x5090c6){return db['FreshdeskAccount'][_0x25a9('0x15')]({'raw':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options'][_0x25a9('0x17')]===undefined?!![]:![]:!![],'where':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options']['where']||null:null,'attributes':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options'][_0x25a9('0x18')]||null:null,'limit':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7[_0x25a9('0x16')][_0x25a9('0x19')]||null:null,'include':_0x8f17c7[_0x25a9('0x16')]?_0x8f17c7['options']['include']?_[_0x25a9('0x1a')](_0x8f17c7['options'][_0x25a9('0x1b')],function(_0x4b49d8){return{'model':db[_0x4b49d8[_0x25a9('0x1c')]],'as':_0x4b49d8['as'],'attributes':_0x4b49d8['attributes'],'include':_0x4b49d8[_0x25a9('0x1b')]?_['map'](_0x4b49d8[_0x25a9('0x1b')],function(_0x5a7b92){return{'model':db[_0x5a7b92[_0x25a9('0x1c')]],'as':_0x5a7b92['as'],'attributes':_0x5a7b92['attributes'],'include':_0x5a7b92[_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x5a7b92[_0x25a9('0x1b')],function(_0x4208d4){return{'model':db[_0x4208d4[_0x25a9('0x1c')]],'as':_0x4208d4['as'],'attributes':_0x4208d4[_0x25a9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fdfd1){logger[_0x25a9('0xc')](_0x25a9('0x14'),_0x8f17c7);logger['debug'](_0x25a9('0x14'),_0x8f17c7,JSON[_0x25a9('0x10')](_0x4fdfd1));_0x2ac16c(_0x4fdfd1);})[_0x25a9('0x1d')](function(_0x581cc6){logger[_0x25a9('0x11')]('GetFreshdeskAccount',_0x581cc6[_0x25a9('0x13')],_0x8f17c7);_0x5090c6(_0x175c89[_0x25a9('0x11')](0x1f4,_0x581cc6[_0x25a9('0x13')]));});});};exports[_0x25a9('0x1e')]=function(_0x417a83){var _0x5bbda0=this;return new Promise(function(_0x5ba896,_0x37f03e){return db['FreshdeskAccount'][_0x25a9('0x1f')]({'raw':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x417a83[_0x25a9('0x16')]?_0x417a83['options'][_0x25a9('0x20')]||null:null,'attributes':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')][_0x25a9('0x18')]||null:null,'include':_0x417a83[_0x25a9('0x16')]?_0x417a83[_0x25a9('0x16')][_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x417a83['options'][_0x25a9('0x1b')],function(_0x26bf87){return{'model':db[_0x26bf87[_0x25a9('0x1c')]],'as':_0x26bf87['as'],'attributes':_0x26bf87['attributes'],'include':_0x26bf87[_0x25a9('0x1b')]?_[_0x25a9('0x1a')](_0x26bf87[_0x25a9('0x1b')],function(_0x3aac19){return{'model':db[_0x3aac19[_0x25a9('0x1c')]],'as':_0x3aac19['as'],'attributes':_0x3aac19[_0x25a9('0x18')],'include':_0x3aac19[_0x25a9('0x1b')]?_['map'](_0x3aac19[_0x25a9('0x1b')],function(_0x44dd05){return{'model':db[_0x44dd05[_0x25a9('0x1c')]],'as':_0x44dd05['as'],'attributes':_0x44dd05[_0x25a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x25a9('0xb')](function(_0x26b41c){logger['info']('ShowFreshdeskAccount',_0x417a83);logger[_0x25a9('0xf')](_0x25a9('0x1e'),_0x417a83,JSON['stringify'](_0x26b41c));_0x5ba896(_0x26b41c);})[_0x25a9('0x1d')](function(_0x406337){logger['error'](_0x25a9('0x1e'),_0x406337['message'],_0x417a83);_0x37f03e(_0x5bbda0[_0x25a9('0x11')](0x1f4,_0x406337['message']));});});}; \ No newline at end of file +var _0xba00=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowFreshdeskAccount','find','lodash','bluebird'];(function(_0x497eea,_0x175ed0){var _0x344af4=function(_0x51b1ae){while(--_0x51b1ae){_0x497eea['push'](_0x497eea['shift']());}};_0x344af4(++_0x175ed0);}(_0xba00,0x15c));var _0x0ba0=function(_0x4399da,_0x50f86b){_0x4399da=_0x4399da-0x0;var _0x32dfa1=_0xba00[_0x4399da];return _0x32dfa1;};'use strict';var _=require(_0x0ba0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ba0('0x1'));var rs=require(_0x0ba0('0x2'));var fs=require('fs');var Redis=require(_0x0ba0('0x3'));var db=require(_0x0ba0('0x4'))['db'];var utils=require(_0x0ba0('0x5'));var logger=require(_0x0ba0('0x6'))('rpc');var config=require(_0x0ba0('0x7'));var jayson=require(_0x0ba0('0x8'));var client=jayson['client'][_0x0ba0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f8af3,_0x18de1d,_0x11f3e4){return new BPromise(function(_0xa9f857,_0x54b7d4){return client[_0x0ba0('0xa')](_0x1f8af3,_0x11f3e4)[_0x0ba0('0xb')](function(_0x551d9d){logger[_0x0ba0('0xc')](_0x0ba0('0xd'),_0x18de1d,'request\x20sent');logger[_0x0ba0('0xe')](_0x0ba0('0xf'),_0x18de1d,_0x0ba0('0x10'),JSON[_0x0ba0('0x11')](_0x551d9d));if(_0x551d9d['error']){if(_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x13')]===0x1f4){logger[_0x0ba0('0x12')](_0x0ba0('0xd'),_0x18de1d,_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);return _0x54b7d4(_0x551d9d[_0x0ba0('0x12')]['message']);}logger[_0x0ba0('0x12')](_0x0ba0('0xd'),_0x18de1d,_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);return _0xa9f857(_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);}else{logger[_0x0ba0('0xc')](_0x0ba0('0xd'),_0x18de1d,'request\x20sent');_0xa9f857(_0x551d9d[_0x0ba0('0x15')][_0x0ba0('0x14')]);}})[_0x0ba0('0x16')](function(_0x3f593a){logger['error'](_0x0ba0('0xd'),_0x18de1d,_0x3f593a);_0x54b7d4(_0x3f593a);});});}exports[_0x0ba0('0x17')]=function(_0x251f90){var _0x3b4ee0=this;return new Promise(function(_0x50d81c,_0x28ede5){return db['FreshdeskAccount'][_0x0ba0('0x18')]({'raw':_0x251f90['options']?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1a')]===undefined?!![]:![]:!![],'where':_0x251f90[_0x0ba0('0x19')]?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1b')]||null:null,'attributes':_0x251f90[_0x0ba0('0x19')]?_0x251f90[_0x0ba0('0x19')]['attributes']||null:null,'limit':_0x251f90[_0x0ba0('0x19')]?_0x251f90['options'][_0x0ba0('0x1c')]||null:null,'include':_0x251f90['options']?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1d')]?_['map'](_0x251f90['options']['include'],function(_0x7463e3){return{'model':db[_0x7463e3[_0x0ba0('0x1e')]],'as':_0x7463e3['as'],'attributes':_0x7463e3['attributes'],'include':_0x7463e3[_0x0ba0('0x1d')]?_['map'](_0x7463e3[_0x0ba0('0x1d')],function(_0x3df913){return{'model':db[_0x3df913[_0x0ba0('0x1e')]],'as':_0x3df913['as'],'attributes':_0x3df913[_0x0ba0('0x1f')],'include':_0x3df913[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x3df913[_0x0ba0('0x1d')],function(_0x52840d){return{'model':db[_0x52840d['model']],'as':_0x52840d['as'],'attributes':_0x52840d[_0x0ba0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0ba0('0xb')](function(_0x85bd05){logger[_0x0ba0('0xc')](_0x0ba0('0x17'),_0x251f90);logger[_0x0ba0('0xe')](_0x0ba0('0x17'),_0x251f90,JSON[_0x0ba0('0x11')](_0x85bd05));_0x50d81c(_0x85bd05);})[_0x0ba0('0x16')](function(_0x1e6af7){logger[_0x0ba0('0x12')](_0x0ba0('0x17'),_0x1e6af7[_0x0ba0('0x14')],_0x251f90);_0x28ede5(_0x3b4ee0['error'](0x1f4,_0x1e6af7[_0x0ba0('0x14')]));});});};exports[_0x0ba0('0x21')]=function(_0x40d1bd){var _0x29d385=this;return new Promise(function(_0x136954,_0x528dd5){return db['FreshdeskAccount'][_0x0ba0('0x22')]({'raw':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd['options'][_0x0ba0('0x1a')]===undefined?!![]:![]:!![],'where':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd[_0x0ba0('0x19')][_0x0ba0('0x1b')]||null:null,'attributes':_0x40d1bd['options']?_0x40d1bd['options'][_0x0ba0('0x1f')]||null:null,'include':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd[_0x0ba0('0x19')][_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x40d1bd['options']['include'],function(_0x3a5cd0){return{'model':db[_0x3a5cd0['model']],'as':_0x3a5cd0['as'],'attributes':_0x3a5cd0[_0x0ba0('0x1f')],'include':_0x3a5cd0[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x3a5cd0[_0x0ba0('0x1d')],function(_0x2d0e71){return{'model':db[_0x2d0e71[_0x0ba0('0x1e')]],'as':_0x2d0e71['as'],'attributes':_0x2d0e71['attributes'],'include':_0x2d0e71[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x2d0e71[_0x0ba0('0x1d')],function(_0x11be89){return{'model':db[_0x11be89[_0x0ba0('0x1e')]],'as':_0x11be89['as'],'attributes':_0x11be89[_0x0ba0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0ba0('0xb')](function(_0x883ac5){logger[_0x0ba0('0xc')]('ShowFreshdeskAccount',_0x40d1bd);logger[_0x0ba0('0xe')](_0x0ba0('0x21'),_0x40d1bd,JSON[_0x0ba0('0x11')](_0x883ac5));_0x136954(_0x883ac5);})['catch'](function(_0x1518b4){logger[_0x0ba0('0x12')](_0x0ba0('0x21'),_0x1518b4[_0x0ba0('0x14')],_0x40d1bd);_0x528dd5(_0x29d385['error'](0x1f4,_0x1518b4[_0x0ba0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 46d1981..7760dc0 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 _0x7cdc=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','util','path','express','../../components/auth/service'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0x7cdc,0x1b1));var _0xc7cd=function(_0x3d26bc,_0x484d05){_0x3d26bc=_0x3d26bc-0x0;var _0x1cf90d=_0x7cdc[_0x3d26bc];return _0x1cf90d;};'use strict';var multer=require('multer');var util=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7cd('0x2'));var router=express['Router']();var auth=require(_0xc7cd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc7cd('0x4'));var controller=require(_0xc7cd('0x5'));router[_0xc7cd('0x6')]('/',auth[_0xc7cd('0x7')](),controller['index']);router[_0xc7cd('0x6')](_0xc7cd('0x8'),auth['isAuthenticated'](),controller[_0xc7cd('0x9')]);router[_0xc7cd('0x6')](_0xc7cd('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xc7cd('0xb'),auth['isAuthenticated'](),controller[_0xc7cd('0xc')]);router[_0xc7cd('0x6')]('/:id/descriptions',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0xd')]);router['get'](_0xc7cd('0xe'),auth['isAuthenticated'](),controller[_0xc7cd('0xf')]);router[_0xc7cd('0x10')]('/',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x11')]);router[_0xc7cd('0x10')](_0xc7cd('0xe'),auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x12')]);router[_0xc7cd('0x13')]('/:id',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x14')]);router[_0xc7cd('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc7cd('0x16')]=router; \ No newline at end of file +var _0xb471=['getDescriptions','/:id/tags','post','setTags','put','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../config/environment','index','/:id','show','/:id/fields','isAuthenticated','getFields','get'];(function(_0x1cb9f8,_0xd964df){var _0x25cd75=function(_0x28a078){while(--_0x28a078){_0x1cb9f8['push'](_0x1cb9f8['shift']());}};_0x25cd75(++_0xd964df);}(_0xb471,0x1aa));var _0x1b47=function(_0x2d44bb,_0x4cfd30){_0x2d44bb=_0x2d44bb-0x0;var _0xc9861e=_0xb471[_0x2d44bb];return _0xc9861e;};'use strict';var multer=require('multer');var util=require(_0x1b47('0x0'));var path=require('path');var timeout=require(_0x1b47('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1b47('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1b47('0x3'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1b47('0x4')]);router['get'](_0x1b47('0x5'),auth['isAuthenticated'](),controller[_0x1b47('0x6')]);router['get'](_0x1b47('0x7'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x9')]);router[_0x1b47('0xa')]('/:id/subjects',auth[_0x1b47('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x1b47('0x8')](),controller[_0x1b47('0xb')]);router['get'](_0x1b47('0xc'),auth[_0x1b47('0x8')](),controller['getTags']);router[_0x1b47('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1b47('0xd')](_0x1b47('0xc'),auth[_0x1b47('0x8')](),controller[_0x1b47('0xe')]);router[_0x1b47('0xf')](_0x1b47('0x5'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x10')]);router[_0x1b47('0x11')](_0x1b47('0x5'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3e28a40..62a205d 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 _0xb14e=['STRING','exports'];(function(_0x51b549,_0x5b5c6c){var _0x4941ce=function(_0x1506a1){while(--_0x1506a1){_0x51b549['push'](_0x51b549['shift']());}};_0x4941ce(++_0x5b5c6c);}(_0xb14e,0x79));var _0xeb14=function(_0x253df0,_0x170d58){_0x253df0=_0x253df0-0x0;var _0xdb46dc=_0xb14e[_0x253df0];return _0xdb46dc;};'use strict';var Sequelize=require('sequelize');module[_0xeb14('0x0')]={'name':{'type':Sequelize[_0xeb14('0x1')]},'description':{'type':Sequelize[_0xeb14('0x1')]}}; \ No newline at end of file +var _0xc86e=['exports'];(function(_0x5f1439,_0x29c20e){var _0x394cfe=function(_0x4a5129){while(--_0x4a5129){_0x5f1439['push'](_0x5f1439['shift']());}};_0x394cfe(++_0x29c20e);}(_0xc86e,0x17a));var _0xec86=function(_0x4d9db0,_0x5b9b99){_0x4d9db0=_0x4d9db0-0x0;var _0x12296b=_0xc86e[_0x4d9db0];return _0x12296b;};'use strict';var Sequelize=require('sequelize');module[_0xec86('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3d126c2..95dca43 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 _0x88ef=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getFields','FreshdeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x369289,_0xb779d8){var _0x1c8ba4=function(_0x28cc27){while(--_0x28cc27){_0x369289['push'](_0x369289['shift']());}};_0x1c8ba4(++_0xb779d8);}(_0x88ef,0x139));var _0xf88e=function(_0x3648ed,_0x3158db){_0x3648ed=_0x3648ed-0x0;var _0xfffa30=_0x88ef[_0x3648ed];return _0xfffa30;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf88e('0x0'));var rimraf=require(_0xf88e('0x1'));var zipdir=require(_0xf88e('0x2'));var jsonpatch=require(_0xf88e('0x3'));var rp=require(_0xf88e('0x4'));var moment=require(_0xf88e('0x5'));var BPromise=require(_0xf88e('0x6'));var Mustache=require(_0xf88e('0x7'));var util=require(_0xf88e('0x8'));var path=require(_0xf88e('0x9'));var sox=require(_0xf88e('0xa'));var csv=require('to-csv');var ejs=require(_0xf88e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf88e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf88e('0xd'));var deskjs=require(_0xf88e('0xe'));var toCsv=require(_0xf88e('0xf'));var querystring=require(_0xf88e('0x10'));var Papa=require(_0xf88e('0x11'));var Redis=require(_0xf88e('0x12'));var authService=require(_0xf88e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf88e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf88e('0x15'));var utils=require(_0xf88e('0x16'));var config=require(_0xf88e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf88e('0x18'))['db'];var jayson=require(_0xf88e('0x19'));var client=jayson[_0xf88e('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53881e,_0x24176c,_0x198460,_0x4f4c62){return new BPromise(function(_0x5c75c7,_0x338ed7){var _0x151770=_0x4f4c62||client;return _0x151770[_0xf88e('0x1b')](_0x53881e,_0x198460)['then'](function(_0x2f5835){logger[_0xf88e('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0xf88e('0x1d'));logger[_0xf88e('0x1e')](_0xf88e('0x1f'),_0x24176c,_0xf88e('0x1d'),JSON[_0xf88e('0x20')](_0x2f5835));if(_0x2f5835[_0xf88e('0x21')]){if(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x22')]===0x1f4){logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);return _0x338ed7(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);}logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f5835['error'][_0xf88e('0x23')]);return _0x5c75c7(_0x2f5835[_0xf88e('0x21')][_0xf88e('0x23')]);}else{logger[_0xf88e('0x1c')](_0xf88e('0x24'),_0x24176c,_0xf88e('0x1d'));_0x5c75c7(_0x2f5835[_0xf88e('0x25')][_0xf88e('0x23')]);}})[_0xf88e('0x26')](function(_0x2f35eb){logger[_0xf88e('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24176c,_0x2f35eb);_0x338ed7(_0x2f35eb);});});}function respondWithStatusCode(_0x373ce9,_0xad8f20){_0xad8f20=_0xad8f20||0xcc;return function(_0x292cf1){if(_0x292cf1){return _0x373ce9['sendStatus'](_0xad8f20);}return _0x373ce9[_0xf88e('0x27')](_0xad8f20)[_0xf88e('0x28')]();};}function respondWithResult(_0x590a7d,_0x6029b6){_0x6029b6=_0x6029b6||0xc8;return function(_0x3753fc){if(_0x3753fc){return _0x590a7d[_0xf88e('0x27')](_0x6029b6)['json'](_0x3753fc);}};}function respondWithFilteredResult(_0x320361,_0x54891b){return function(_0x15dae5){if(_0x15dae5){var _0x25830f=_0x15dae5[_0xf88e('0x29')],_0x15e4f6=_0x54891b[_0xf88e('0x2a')],_0x2d6863=_0x54891b['offset']+_0x54891b[_0xf88e('0x2b')],_0x43c50d;if(_0x2d6863>=_0x25830f){_0x2d6863=_0x25830f;_0x43c50d=0xc8;}else{_0x43c50d=0xce;}_0x320361[_0xf88e('0x27')](_0x43c50d);return _0x320361[_0xf88e('0x2c')](_0xf88e('0x2d'),_0x15e4f6+'-'+_0x2d6863+'/'+_0x25830f)[_0xf88e('0x2e')](_0x15dae5);}return null;};}function patchUpdates(_0x15d97e){return function(_0x1da9d3){try{jsonpatch[_0xf88e('0x2f')](_0x1da9d3,_0x15d97e,!![]);}catch(_0x50e64c){return BPromise[_0xf88e('0x30')](_0x50e64c);}return _0x1da9d3[_0xf88e('0x31')]();};}function saveUpdates(_0x4da930,_0xe13451){return function(_0x22c42b){if(_0x22c42b){return _0x22c42b[_0xf88e('0x32')](_0x4da930)[_0xf88e('0x33')](function(_0x1193b0){return _0x1193b0;});}return null;};}function removeEntity(_0x4710b7,_0x357d50){return function(_0x4a9754){if(_0x4a9754){return _0x4a9754[_0xf88e('0x34')]()['then'](function(){_0x4710b7[_0xf88e('0x27')](0xcc)[_0xf88e('0x28')]();});}};}function handleEntityNotFound(_0x220292,_0x354855){return function(_0x213b1c){if(!_0x213b1c){_0x220292[_0xf88e('0x35')](0x194);}return _0x213b1c;};}function handleError(_0x208268,_0xdc6362){_0xdc6362=_0xdc6362||0x1f4;return function(_0x55e7ab){logger[_0xf88e('0x21')](_0x55e7ab[_0xf88e('0x36')]);if(_0x55e7ab[_0xf88e('0x37')]){delete _0x55e7ab[_0xf88e('0x37')];}_0x208268['status'](_0xdc6362)['send'](_0x55e7ab);};}exports[_0xf88e('0x38')]=function(_0x5e2a3a,_0x2a3ef9){var _0x240172={},_0x3ee50e={},_0x5daaf2={'count':0x0,'rows':[]};var _0x172d8e=_['map'](db[_0xf88e('0x39')][_0xf88e('0x3a')],function(_0x216ab5){return{'name':_0x216ab5['fieldName'],'type':_0x216ab5[_0xf88e('0x3b')][_0xf88e('0x3c')]};});_0x3ee50e[_0xf88e('0x3d')]=_[_0xf88e('0x3e')](_0x172d8e,_0xf88e('0x37'));_0x3ee50e[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x5e2a3a[_0xf88e('0x3f')]);_0x3ee50e[_0xf88e('0x41')]=_['intersection'](_0x3ee50e['model'],_0x3ee50e[_0xf88e('0x3f')]);_0x240172[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x3ee50e[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x5e2a3a['query']['fields']));_0x240172[_0xf88e('0x42')]=_0x240172['attributes'][_0xf88e('0x45')]?_0x240172[_0xf88e('0x42')]:_0x3ee50e[_0xf88e('0x3d')];if(!_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x46')](_0xf88e('0x47'))){_0x240172[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0x240172[_0xf88e('0x2a')]=qs['offset'](_0x5e2a3a[_0xf88e('0x3f')]['offset']);}_0x240172['order']=qs['sort'](_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x240172[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x5e2a3a[_0xf88e('0x3f')],_0x3ee50e[_0xf88e('0x41')]),_0x172d8e);if(_0x5e2a3a['query'][_0xf88e('0x4b')]){_0x240172[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x240172['where'],{'$or':_[_0xf88e('0x3e')](_0x172d8e,function(_0x2b6225){if(_0x2b6225[_0xf88e('0x3b')]!==_0xf88e('0x4d')){var _0x132eb3={};_0x132eb3[_0x2b6225[_0xf88e('0x37')]]={'$like':'%'+_0x5e2a3a['query'][_0xf88e('0x4b')]+'%'};return _0x132eb3;}})});}_0x240172=_[_0xf88e('0x4c')]({},_0x240172,_0x5e2a3a[_0xf88e('0x4e')]);var _0xad7a9e={'where':_0x240172[_0xf88e('0x49')]};return db[_0xf88e('0x39')]['count'](_0xad7a9e)['then'](function(_0x35683b){_0x5daaf2[_0xf88e('0x29')]=_0x35683b;if(_0x5e2a3a[_0xf88e('0x3f')][_0xf88e('0x4f')]){_0x240172[_0xf88e('0x50')]=[{'all':!![]}];}return db[_0xf88e('0x39')][_0xf88e('0x51')](_0x240172);})['then'](function(_0x407f59){_0x5daaf2[_0xf88e('0x52')]=_0x407f59;return _0x5daaf2;})[_0xf88e('0x33')](respondWithFilteredResult(_0x2a3ef9,_0x240172))['catch'](handleError(_0x2a3ef9,null));};exports['show']=function(_0x5b8642,_0x43e5cf){var _0x10b1eb={'raw':![],'where':{'id':_0x5b8642[_0xf88e('0x53')]['id']}},_0x4e0e3c={};_0x4e0e3c[_0xf88e('0x3d')]=_['keys'](db[_0xf88e('0x39')]['rawAttributes']);_0x4e0e3c[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x5b8642['query']);_0x4e0e3c[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x4e0e3c[_0xf88e('0x3d')],_0x4e0e3c['query']);_0x10b1eb[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x4e0e3c[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x5b8642[_0xf88e('0x3f')][_0xf88e('0x44')]));_0x10b1eb[_0xf88e('0x42')]=_0x10b1eb[_0xf88e('0x42')]['length']?_0x10b1eb[_0xf88e('0x42')]:_0x4e0e3c['model'];if(_0x5b8642[_0xf88e('0x3f')][_0xf88e('0x4f')]){_0x10b1eb[_0xf88e('0x50')]=[{'all':!![]}];}_0x10b1eb=_[_0xf88e('0x4c')]({},_0x10b1eb,_0x5b8642[_0xf88e('0x4e')]);return db[_0xf88e('0x39')][_0xf88e('0x54')](_0x10b1eb)[_0xf88e('0x33')](handleEntityNotFound(_0x43e5cf,null))[_0xf88e('0x33')](respondWithResult(_0x43e5cf,null))[_0xf88e('0x26')](handleError(_0x43e5cf,null));};exports[_0xf88e('0x55')]=function(_0x2e61a7,_0x2e155a){return db['FreshdeskConfiguration'][_0xf88e('0x55')](_0x2e61a7[_0xf88e('0x56')],{})['then'](respondWithResult(_0x2e155a,0xc9))[_0xf88e('0x26')](handleError(_0x2e155a,null));};exports[_0xf88e('0x32')]=function(_0x5b53ef,_0x4261a7){if(_0x5b53ef[_0xf88e('0x56')]['id']){delete _0x5b53ef[_0xf88e('0x56')]['id'];}return db[_0xf88e('0x39')][_0xf88e('0x54')]({'where':{'id':_0x5b53ef['params']['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x4261a7,null))[_0xf88e('0x33')](saveUpdates(_0x5b53ef[_0xf88e('0x56')],null))[_0xf88e('0x33')](respondWithResult(_0x4261a7,null))['catch'](handleError(_0x4261a7,null));};exports[_0xf88e('0x34')]=function(_0x44a349,_0x4d18fa){return db[_0xf88e('0x39')][_0xf88e('0x54')]({'where':{'id':_0x44a349['params']['id']}})['then'](handleEntityNotFound(_0x4d18fa,null))[_0xf88e('0x33')](removeEntity(_0x4d18fa,null))[_0xf88e('0x26')](handleError(_0x4d18fa,null));};exports[_0xf88e('0x57')]=function(_0x2955b7,_0x215015,_0xcfe5e3){var _0x1db0ce={};var _0x2c2cc7={};var _0x153052;var _0x452089;return db[_0xf88e('0x39')]['findOne']({'where':{'id':_0x2955b7[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x215015,null))[_0xf88e('0x33')](function(_0x3fc33b){if(_0x3fc33b){_0x153052=_0x3fc33b;_0x2c2cc7['model']=_[_0xf88e('0x40')](db[_0xf88e('0x58')][_0xf88e('0x3a')]);_0x2c2cc7['query']=_[_0xf88e('0x40')](_0x2955b7['query']);_0x2c2cc7[_0xf88e('0x41')]=_['intersection'](_0x2c2cc7[_0xf88e('0x3d')],_0x2c2cc7[_0xf88e('0x3f')]);_0x1db0ce['attributes']=_[_0xf88e('0x43')](_0x2c2cc7['model'],qs[_0xf88e('0x44')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x44')]));_0x1db0ce[_0xf88e('0x42')]=_0x1db0ce[_0xf88e('0x42')][_0xf88e('0x45')]?_0x1db0ce['attributes']:_0x2c2cc7[_0xf88e('0x3d')];_0x1db0ce[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x1db0ce['where']=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x2955b7[_0xf88e('0x3f')],_0x2c2cc7[_0xf88e('0x41')]));if(_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x1db0ce[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x1db0ce['where'],{'$or':_[_0xf88e('0x3e')](_0x1db0ce['attributes'],function(_0x12db13){var _0x45d03d={};_0x45d03d[_0x12db13]={'$like':'%'+_0x2955b7[_0xf88e('0x3f')]['filter']+'%'};return _0x45d03d;})});}_0x1db0ce=_[_0xf88e('0x4c')]({},_0x1db0ce,_0x2955b7['options']);return _0x153052['getFields'](_0x1db0ce);}})['then'](function(_0x11b695){if(_0x11b695){_0x452089=_0x11b695['length'];if(!_0x2955b7[_0xf88e('0x3f')]['hasOwnProperty'](_0xf88e('0x47'))){_0x1db0ce[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x2955b7[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0x1db0ce[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x2955b7['query']['offset']);}return _0x153052[_0xf88e('0x57')](_0x1db0ce);}})[_0xf88e('0x33')](function(_0x1a3f23){if(_0x1a3f23){return _0x1a3f23?{'count':_0x452089,'rows':_0x1a3f23}:null;}})['then'](respondWithResult(_0x215015,null))[_0xf88e('0x26')](handleError(_0x215015,null));};exports['getSubjects']=function(_0x1cecc7,_0x1f5879,_0x46d39c){var _0x5ad521={};var _0x3c708d={};var _0x455ad7;var _0x10b6eb;return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x1cecc7[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x1f5879,null))['then'](function(_0x11f6a8){if(_0x11f6a8){_0x455ad7=_0x11f6a8;_0x3c708d[_0xf88e('0x3d')]=_[_0xf88e('0x40')](db[_0xf88e('0x58')][_0xf88e('0x3a')]);_0x3c708d[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x1cecc7[_0xf88e('0x3f')]);_0x3c708d[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x3c708d['model'],_0x3c708d[_0xf88e('0x3f')]);_0x5ad521['attributes']=_[_0xf88e('0x43')](_0x3c708d[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x1cecc7['query'][_0xf88e('0x44')]));_0x5ad521[_0xf88e('0x42')]=_0x5ad521[_0xf88e('0x42')][_0xf88e('0x45')]?_0x5ad521[_0xf88e('0x42')]:_0x3c708d[_0xf88e('0x3d')];_0x5ad521[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x48')]);_0x5ad521[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_['pick'](_0x1cecc7[_0xf88e('0x3f')],_0x3c708d[_0xf88e('0x41')]));if(_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x5ad521[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x5ad521[_0xf88e('0x49')],{'$or':_['map'](_0x5ad521[_0xf88e('0x42')],function(_0x3f81fb){var _0x1661a0={};_0x1661a0[_0x3f81fb]={'$like':'%'+_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x1661a0;})});}_0x5ad521=_[_0xf88e('0x4c')]({},_0x5ad521,_0x1cecc7[_0xf88e('0x4e')]);return _0x455ad7[_0xf88e('0x5b')](_0x5ad521);}})[_0xf88e('0x33')](function(_0x4aa728){if(_0x4aa728){_0x10b6eb=_0x4aa728[_0xf88e('0x45')];if(!_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x46')](_0xf88e('0x47'))){_0x5ad521[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x1cecc7['query']['limit']);_0x5ad521[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x1cecc7[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x455ad7[_0xf88e('0x5b')](_0x5ad521);}})[_0xf88e('0x33')](function(_0x4b6d24){if(_0x4b6d24){return _0x4b6d24?{'count':_0x10b6eb,'rows':_0x4b6d24}:null;}})[_0xf88e('0x33')](respondWithResult(_0x1f5879,null))[_0xf88e('0x26')](handleError(_0x1f5879,null));};exports[_0xf88e('0x5c')]=function(_0x162026,_0xc8aa3d,_0x5d3b17){var _0x546a59={};var _0x1c475b={};var _0x6938a4;var _0xfd8941;return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x162026[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0xc8aa3d,null))[_0xf88e('0x33')](function(_0x55d16c){if(_0x55d16c){_0x6938a4=_0x55d16c;_0x1c475b[_0xf88e('0x3d')]=_[_0xf88e('0x40')](db[_0xf88e('0x58')]['rawAttributes']);_0x1c475b['query']=_[_0xf88e('0x40')](_0x162026['query']);_0x1c475b['filters']=_[_0xf88e('0x43')](_0x1c475b[_0xf88e('0x3d')],_0x1c475b[_0xf88e('0x3f')]);_0x546a59[_0xf88e('0x42')]=_[_0xf88e('0x43')](_0x1c475b[_0xf88e('0x3d')],qs['fields'](_0x162026['query'][_0xf88e('0x44')]));_0x546a59[_0xf88e('0x42')]=_0x546a59['attributes'][_0xf88e('0x45')]?_0x546a59[_0xf88e('0x42')]:_0x1c475b['model'];_0x546a59[_0xf88e('0x59')]=qs['sort'](_0x162026['query']['sort']);_0x546a59[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_[_0xf88e('0x4a')](_0x162026['query'],_0x1c475b['filters']));if(_0x162026[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0x546a59[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0x546a59[_0xf88e('0x49')],{'$or':_[_0xf88e('0x3e')](_0x546a59[_0xf88e('0x42')],function(_0x41d6f9){var _0x16d85a={};_0x16d85a[_0x41d6f9]={'$like':'%'+_0x162026[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x16d85a;})});}_0x546a59=_[_0xf88e('0x4c')]({},_0x546a59,_0x162026[_0xf88e('0x4e')]);return _0x6938a4['getDescriptions'](_0x546a59);}})[_0xf88e('0x33')](function(_0x2a4c83){if(_0x2a4c83){_0xfd8941=_0x2a4c83[_0xf88e('0x45')];if(!_0x162026['query'][_0xf88e('0x46')](_0xf88e('0x47'))){_0x546a59[_0xf88e('0x2b')]=qs[_0xf88e('0x2b')](_0x162026[_0xf88e('0x3f')]['limit']);_0x546a59[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x162026[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x6938a4[_0xf88e('0x5c')](_0x546a59);}})[_0xf88e('0x33')](function(_0x5eaf0f){if(_0x5eaf0f){return _0x5eaf0f?{'count':_0xfd8941,'rows':_0x5eaf0f}:null;}})[_0xf88e('0x33')](respondWithResult(_0xc8aa3d,null))[_0xf88e('0x26')](handleError(_0xc8aa3d,null));};exports[_0xf88e('0x5d')]=function(_0x3f38a3,_0x3c7879,_0x1bee3f){var _0xb2f674={};var _0x119ca2={};var _0x462c02;var _0x324901;return db['FreshdeskConfiguration'][_0xf88e('0x5a')]({'where':{'id':_0x3f38a3[_0xf88e('0x53')]['id']}})[_0xf88e('0x33')](handleEntityNotFound(_0x3c7879,null))[_0xf88e('0x33')](function(_0x416128){if(_0x416128){_0x462c02=_0x416128;_0x119ca2[_0xf88e('0x3d')]=_['keys'](db[_0xf88e('0x5e')][_0xf88e('0x3a')]);_0x119ca2[_0xf88e('0x3f')]=_[_0xf88e('0x40')](_0x3f38a3['query']);_0x119ca2[_0xf88e('0x41')]=_[_0xf88e('0x43')](_0x119ca2[_0xf88e('0x3d')],_0x119ca2[_0xf88e('0x3f')]);_0xb2f674[_0xf88e('0x42')]=_['intersection'](_0x119ca2[_0xf88e('0x3d')],qs[_0xf88e('0x44')](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x44')]));_0xb2f674['attributes']=_0xb2f674[_0xf88e('0x42')][_0xf88e('0x45')]?_0xb2f674[_0xf88e('0x42')]:_0x119ca2[_0xf88e('0x3d')];_0xb2f674[_0xf88e('0x59')]=qs[_0xf88e('0x48')](_0x3f38a3[_0xf88e('0x3f')]['sort']);_0xb2f674[_0xf88e('0x49')]=qs[_0xf88e('0x41')](_['pick'](_0x3f38a3[_0xf88e('0x3f')],_0x119ca2[_0xf88e('0x41')]));if(_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x4b')]){_0xb2f674[_0xf88e('0x49')]=_[_0xf88e('0x4c')](_0xb2f674[_0xf88e('0x49')],{'$or':_[_0xf88e('0x3e')](_0xb2f674[_0xf88e('0x42')],function(_0x2f7426){var _0x499714={};_0x499714[_0x2f7426]={'$like':'%'+_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x4b')]+'%'};return _0x499714;})});}_0xb2f674=_['merge']({},_0xb2f674,_0x3f38a3[_0xf88e('0x4e')]);return _0x462c02['getTags'](_0xb2f674);}})['then'](function(_0x5f5d93){if(_0x5f5d93){_0x324901=_0x5f5d93[_0xf88e('0x45')];if(!_0x3f38a3['query']['hasOwnProperty']('nolimit')){_0xb2f674[_0xf88e('0x2b')]=qs['limit'](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x2b')]);_0xb2f674[_0xf88e('0x2a')]=qs[_0xf88e('0x2a')](_0x3f38a3[_0xf88e('0x3f')][_0xf88e('0x2a')]);}return _0x462c02['getTags'](_0xb2f674);}})[_0xf88e('0x33')](function(_0x440e78){if(_0x440e78){return _0x440e78?{'count':_0x324901,'rows':_0x440e78}:null;}})[_0xf88e('0x33')](respondWithResult(_0x3c7879,null))[_0xf88e('0x26')](handleError(_0x3c7879,null));};exports[_0xf88e('0x5f')]=function(_0x476978,_0x3d2671,_0x1de208){if(_0x476978['body']['id']){delete _0x476978[_0xf88e('0x56')]['id'];}return db[_0xf88e('0x39')][_0xf88e('0x5a')]({'where':{'id':_0x476978[_0xf88e('0x53')]['id']}})['then'](handleEntityNotFound(_0x3d2671,null))[_0xf88e('0x33')](function(_0x506721){if(_0x506721){return _0x506721[_0xf88e('0x5f')](_0x476978[_0xf88e('0x56')][_0xf88e('0x60')]||[]);}return null;})[_0xf88e('0x33')](respondWithResult(_0x3d2671,null))[_0xf88e('0x26')](handleError(_0x3d2671,null));}; \ No newline at end of file +var _0x5027=['limit','order','sort','where','pick','filter','merge','type','VIRTUAL','rows','show','length','include','options','create','body','update','params','getFields','FreshdeskField','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','nolimit'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x5027,0x1d3));var _0x7502=function(_0x2175b3,_0x4d7d8c){_0x2175b3=_0x2175b3-0x0;var _0x4cc295=_0x5027[_0x2175b3];return _0x4cc295;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7502('0x0'));var zipdir=require(_0x7502('0x1'));var jsonpatch=require(_0x7502('0x2'));var rp=require(_0x7502('0x3'));var moment=require(_0x7502('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7502('0x5'));var util=require(_0x7502('0x6'));var path=require('path');var sox=require(_0x7502('0x7'));var csv=require(_0x7502('0x8'));var ejs=require(_0x7502('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7502('0xa'));var crypto=require(_0x7502('0xb'));var jsforce=require(_0x7502('0xc'));var deskjs=require(_0x7502('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7502('0xe'));var Papa=require(_0x7502('0xf'));var Redis=require('ioredis');var authService=require(_0x7502('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7502('0x11'));var hardwareService=require(_0x7502('0x12'));var logger=require(_0x7502('0x13'))(_0x7502('0x14'));var utils=require('../../config/utils');var config=require(_0x7502('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x7502('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3b43,_0x13912c,_0x2093cb,_0x27c52d){return new BPromise(function(_0xa7431,_0x5dbe01){var _0x22867e=_0x27c52d||client;return _0x22867e['request'](_0x4c3b43,_0x2093cb)[_0x7502('0x17')](function(_0x125a30){logger[_0x7502('0x18')](_0x7502('0x19'),_0x13912c,'request\x20sent');logger['debug'](_0x7502('0x1a'),_0x13912c,'request\x20sent',JSON[_0x7502('0x1b')](_0x125a30));if(_0x125a30['error']){if(_0x125a30['error']['code']===0x1f4){logger['error'](_0x7502('0x19'),_0x13912c,_0x125a30[_0x7502('0x1c')][_0x7502('0x1d')]);return _0x5dbe01(_0x125a30['error'][_0x7502('0x1d')]);}logger['error'](_0x7502('0x19'),_0x13912c,_0x125a30[_0x7502('0x1c')][_0x7502('0x1d')]);return _0xa7431(_0x125a30[_0x7502('0x1c')]['message']);}else{logger[_0x7502('0x18')](_0x7502('0x19'),_0x13912c,_0x7502('0x1e'));_0xa7431(_0x125a30[_0x7502('0x1f')][_0x7502('0x1d')]);}})[_0x7502('0x20')](function(_0x27a3e3){logger[_0x7502('0x1c')](_0x7502('0x19'),_0x13912c,_0x27a3e3);_0x5dbe01(_0x27a3e3);});});}function respondWithStatusCode(_0x36c6f8,_0xe71794){_0xe71794=_0xe71794||0xcc;return function(_0xba2cb7){if(_0xba2cb7){return _0x36c6f8['sendStatus'](_0xe71794);}return _0x36c6f8[_0x7502('0x21')](_0xe71794)[_0x7502('0x22')]();};}function respondWithResult(_0x5ef45b,_0x496d45){_0x496d45=_0x496d45||0xc8;return function(_0x49688d){if(_0x49688d){return _0x5ef45b[_0x7502('0x21')](_0x496d45)[_0x7502('0x23')](_0x49688d);}};}function respondWithFilteredResult(_0x12d9a2,_0x4e8747){return function(_0x4e6ef7){if(_0x4e6ef7){var _0x40e1fc=_0x4e6ef7[_0x7502('0x24')],_0x42e667=_0x4e8747[_0x7502('0x25')],_0x369f7b=_0x4e8747[_0x7502('0x25')]+_0x4e8747['limit'],_0x405467;if(_0x369f7b>=_0x40e1fc){_0x369f7b=_0x40e1fc;_0x405467=0xc8;}else{_0x405467=0xce;}_0x12d9a2['status'](_0x405467);return _0x12d9a2[_0x7502('0x26')](_0x7502('0x27'),_0x42e667+'-'+_0x369f7b+'/'+_0x40e1fc)[_0x7502('0x23')](_0x4e6ef7);}return null;};}function patchUpdates(_0x2c9bd6){return function(_0x288617){try{jsonpatch[_0x7502('0x28')](_0x288617,_0x2c9bd6,!![]);}catch(_0x37102a){return BPromise[_0x7502('0x29')](_0x37102a);}return _0x288617[_0x7502('0x2a')]();};}function saveUpdates(_0x56cd0b,_0x4809c6){return function(_0x5e3fc8){if(_0x5e3fc8){return _0x5e3fc8['update'](_0x56cd0b)[_0x7502('0x17')](function(_0x30053b){return _0x30053b;});}return null;};}function removeEntity(_0x1726c0,_0x55c259){return function(_0x4ae6cc){if(_0x4ae6cc){return _0x4ae6cc[_0x7502('0x2b')]()[_0x7502('0x17')](function(){_0x1726c0['status'](0xcc)[_0x7502('0x22')]();});}};}function handleEntityNotFound(_0x152576,_0x5a476b){return function(_0x412afb){if(!_0x412afb){_0x152576[_0x7502('0x2c')](0x194);}return _0x412afb;};}function handleError(_0x51166b,_0x3d24c6){_0x3d24c6=_0x3d24c6||0x1f4;return function(_0x4c2995){logger[_0x7502('0x1c')](_0x4c2995[_0x7502('0x2d')]);if(_0x4c2995[_0x7502('0x2e')]){delete _0x4c2995[_0x7502('0x2e')];}_0x51166b['status'](_0x3d24c6)[_0x7502('0x2f')](_0x4c2995);};}exports[_0x7502('0x30')]=function(_0x1af296,_0x3d3b9e){var _0x593250={},_0x48aa46={},_0xe348a0={'count':0x0,'rows':[]};var _0x40eedf=_[_0x7502('0x31')](db[_0x7502('0x32')][_0x7502('0x33')],function(_0x5a7914){return{'name':_0x5a7914[_0x7502('0x34')],'type':_0x5a7914['type']['key']};});_0x48aa46['model']=_[_0x7502('0x31')](_0x40eedf,_0x7502('0x2e'));_0x48aa46[_0x7502('0x35')]=_[_0x7502('0x36')](_0x1af296['query']);_0x48aa46[_0x7502('0x37')]=_[_0x7502('0x38')](_0x48aa46[_0x7502('0x39')],_0x48aa46[_0x7502('0x35')]);_0x593250[_0x7502('0x3a')]=_['intersection'](_0x48aa46[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x1af296['query']['fields']));_0x593250['attributes']=_0x593250[_0x7502('0x3a')]['length']?_0x593250[_0x7502('0x3a')]:_0x48aa46['model'];if(!_0x1af296['query']['hasOwnProperty'](_0x7502('0x3c'))){_0x593250[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x1af296[_0x7502('0x35')][_0x7502('0x3d')]);_0x593250['offset']=qs[_0x7502('0x25')](_0x1af296[_0x7502('0x35')][_0x7502('0x25')]);}_0x593250[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x1af296[_0x7502('0x35')][_0x7502('0x3f')]);_0x593250[_0x7502('0x40')]=qs[_0x7502('0x37')](_[_0x7502('0x41')](_0x1af296[_0x7502('0x35')],_0x48aa46[_0x7502('0x37')]),_0x40eedf);if(_0x1af296['query'][_0x7502('0x42')]){_0x593250[_0x7502('0x40')]=_[_0x7502('0x43')](_0x593250[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0x40eedf,function(_0xbd8bed){if(_0xbd8bed[_0x7502('0x44')]!==_0x7502('0x45')){var _0x511412={};_0x511412[_0xbd8bed['name']]={'$like':'%'+_0x1af296[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x511412;}})});}_0x593250=_[_0x7502('0x43')]({},_0x593250,_0x1af296['options']);var _0x2c7d3f={'where':_0x593250[_0x7502('0x40')]};return db['FreshdeskConfiguration'][_0x7502('0x24')](_0x2c7d3f)['then'](function(_0x59679e){_0xe348a0[_0x7502('0x24')]=_0x59679e;if(_0x1af296[_0x7502('0x35')]['includeAll']){_0x593250['include']=[{'all':!![]}];}return db[_0x7502('0x32')]['findAll'](_0x593250);})[_0x7502('0x17')](function(_0x40520c){_0xe348a0[_0x7502('0x46')]=_0x40520c;return _0xe348a0;})[_0x7502('0x17')](respondWithFilteredResult(_0x3d3b9e,_0x593250))[_0x7502('0x20')](handleError(_0x3d3b9e,null));};exports[_0x7502('0x47')]=function(_0x2d2976,_0x239eae){var _0x2b244a={'raw':![],'where':{'id':_0x2d2976['params']['id']}},_0x1d0c5a={};_0x1d0c5a[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x32')][_0x7502('0x33')]);_0x1d0c5a[_0x7502('0x35')]=_['keys'](_0x2d2976[_0x7502('0x35')]);_0x1d0c5a[_0x7502('0x37')]=_['intersection'](_0x1d0c5a[_0x7502('0x39')],_0x1d0c5a['query']);_0x2b244a['attributes']=_[_0x7502('0x38')](_0x1d0c5a[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x2d2976['query']['fields']));_0x2b244a[_0x7502('0x3a')]=_0x2b244a[_0x7502('0x3a')][_0x7502('0x48')]?_0x2b244a[_0x7502('0x3a')]:_0x1d0c5a[_0x7502('0x39')];if(_0x2d2976[_0x7502('0x35')]['includeAll']){_0x2b244a[_0x7502('0x49')]=[{'all':!![]}];}_0x2b244a=_[_0x7502('0x43')]({},_0x2b244a,_0x2d2976[_0x7502('0x4a')]);return db[_0x7502('0x32')]['find'](_0x2b244a)[_0x7502('0x17')](handleEntityNotFound(_0x239eae,null))[_0x7502('0x17')](respondWithResult(_0x239eae,null))['catch'](handleError(_0x239eae,null));};exports[_0x7502('0x4b')]=function(_0x151c5b,_0x5ce7da){return db[_0x7502('0x32')][_0x7502('0x4b')](_0x151c5b[_0x7502('0x4c')],{})[_0x7502('0x17')](respondWithResult(_0x5ce7da,0xc9))['catch'](handleError(_0x5ce7da,null));};exports[_0x7502('0x4d')]=function(_0x1cfedc,_0xf13aa9){if(_0x1cfedc[_0x7502('0x4c')]['id']){delete _0x1cfedc['body']['id'];}return db[_0x7502('0x32')]['find']({'where':{'id':_0x1cfedc[_0x7502('0x4e')]['id']}})[_0x7502('0x17')](handleEntityNotFound(_0xf13aa9,null))['then'](saveUpdates(_0x1cfedc[_0x7502('0x4c')],null))[_0x7502('0x17')](respondWithResult(_0xf13aa9,null))[_0x7502('0x20')](handleError(_0xf13aa9,null));};exports[_0x7502('0x2b')]=function(_0x29b4e5,_0x3d32ed){return db[_0x7502('0x32')]['find']({'where':{'id':_0x29b4e5['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x3d32ed,null))[_0x7502('0x17')](removeEntity(_0x3d32ed,null))[_0x7502('0x20')](handleError(_0x3d32ed,null));};exports[_0x7502('0x4f')]=function(_0x39f0f4,_0x44eb2d,_0x23d28d){var _0xab9910={};var _0x2acff9={};var _0x2d7df0;var _0x36f159;return db[_0x7502('0x32')]['findOne']({'where':{'id':_0x39f0f4['params']['id']}})['then'](handleEntityNotFound(_0x44eb2d,null))['then'](function(_0x45ffac){if(_0x45ffac){_0x2d7df0=_0x45ffac;_0x2acff9['model']=_[_0x7502('0x36')](db[_0x7502('0x50')][_0x7502('0x33')]);_0x2acff9[_0x7502('0x35')]=_[_0x7502('0x36')](_0x39f0f4['query']);_0x2acff9[_0x7502('0x37')]=_['intersection'](_0x2acff9['model'],_0x2acff9[_0x7502('0x35')]);_0xab9910['attributes']=_[_0x7502('0x38')](_0x2acff9['model'],qs[_0x7502('0x3b')](_0x39f0f4[_0x7502('0x35')]['fields']));_0xab9910[_0x7502('0x3a')]=_0xab9910[_0x7502('0x3a')]['length']?_0xab9910[_0x7502('0x3a')]:_0x2acff9[_0x7502('0x39')];_0xab9910[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x3f')]);_0xab9910['where']=qs[_0x7502('0x37')](_['pick'](_0x39f0f4['query'],_0x2acff9[_0x7502('0x37')]));if(_0x39f0f4['query'][_0x7502('0x42')]){_0xab9910['where']=_['merge'](_0xab9910[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0xab9910[_0x7502('0x3a')],function(_0x80c5dc){var _0x57535d={};_0x57535d[_0x80c5dc]={'$like':'%'+_0x39f0f4[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x57535d;})});}_0xab9910=_[_0x7502('0x43')]({},_0xab9910,_0x39f0f4[_0x7502('0x4a')]);return _0x2d7df0['getFields'](_0xab9910);}})['then'](function(_0x30c227){if(_0x30c227){_0x36f159=_0x30c227['length'];if(!_0x39f0f4['query'][_0x7502('0x51')](_0x7502('0x3c'))){_0xab9910[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x3d')]);_0xab9910[_0x7502('0x25')]=qs[_0x7502('0x25')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x25')]);}return _0x2d7df0[_0x7502('0x4f')](_0xab9910);}})['then'](function(_0x13afa5){if(_0x13afa5){return _0x13afa5?{'count':_0x36f159,'rows':_0x13afa5}:null;}})['then'](respondWithResult(_0x44eb2d,null))[_0x7502('0x20')](handleError(_0x44eb2d,null));};exports['getSubjects']=function(_0x278f38,_0x4963cf,_0x2c0fe3){var _0x477ad8={};var _0x2b626e={};var _0x259139;var _0x189814;return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x278f38[_0x7502('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4963cf,null))[_0x7502('0x17')](function(_0x261e14){if(_0x261e14){_0x259139=_0x261e14;_0x2b626e[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x50')][_0x7502('0x33')]);_0x2b626e[_0x7502('0x35')]=_[_0x7502('0x36')](_0x278f38[_0x7502('0x35')]);_0x2b626e['filters']=_[_0x7502('0x38')](_0x2b626e[_0x7502('0x39')],_0x2b626e[_0x7502('0x35')]);_0x477ad8[_0x7502('0x3a')]=_[_0x7502('0x38')](_0x2b626e[_0x7502('0x39')],qs['fields'](_0x278f38[_0x7502('0x35')][_0x7502('0x3b')]));_0x477ad8[_0x7502('0x3a')]=_0x477ad8[_0x7502('0x3a')][_0x7502('0x48')]?_0x477ad8[_0x7502('0x3a')]:_0x2b626e[_0x7502('0x39')];_0x477ad8[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x278f38[_0x7502('0x35')][_0x7502('0x3f')]);_0x477ad8[_0x7502('0x40')]=qs[_0x7502('0x37')](_[_0x7502('0x41')](_0x278f38[_0x7502('0x35')],_0x2b626e['filters']));if(_0x278f38[_0x7502('0x35')][_0x7502('0x42')]){_0x477ad8[_0x7502('0x40')]=_[_0x7502('0x43')](_0x477ad8[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0x477ad8[_0x7502('0x3a')],function(_0x4b63d2){var _0x3bceb8={};_0x3bceb8[_0x4b63d2]={'$like':'%'+_0x278f38[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x3bceb8;})});}_0x477ad8=_[_0x7502('0x43')]({},_0x477ad8,_0x278f38['options']);return _0x259139[_0x7502('0x53')](_0x477ad8);}})[_0x7502('0x17')](function(_0x495bae){if(_0x495bae){_0x189814=_0x495bae[_0x7502('0x48')];if(!_0x278f38[_0x7502('0x35')][_0x7502('0x51')]('nolimit')){_0x477ad8[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x278f38[_0x7502('0x35')][_0x7502('0x3d')]);_0x477ad8['offset']=qs['offset'](_0x278f38['query'][_0x7502('0x25')]);}return _0x259139['getSubjects'](_0x477ad8);}})[_0x7502('0x17')](function(_0x551a4f){if(_0x551a4f){return _0x551a4f?{'count':_0x189814,'rows':_0x551a4f}:null;}})[_0x7502('0x17')](respondWithResult(_0x4963cf,null))['catch'](handleError(_0x4963cf,null));};exports[_0x7502('0x54')]=function(_0x12ff91,_0x5f5bd5,_0x42accd){var _0x7ef3d5={};var _0x34e6e5={};var _0x286e7d;var _0x3d21be;return db['FreshdeskConfiguration'][_0x7502('0x52')]({'where':{'id':_0x12ff91['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x5f5bd5,null))[_0x7502('0x17')](function(_0x3da27b){if(_0x3da27b){_0x286e7d=_0x3da27b;_0x34e6e5[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x50')]['rawAttributes']);_0x34e6e5[_0x7502('0x35')]=_['keys'](_0x12ff91[_0x7502('0x35')]);_0x34e6e5[_0x7502('0x37')]=_[_0x7502('0x38')](_0x34e6e5['model'],_0x34e6e5[_0x7502('0x35')]);_0x7ef3d5[_0x7502('0x3a')]=_[_0x7502('0x38')](_0x34e6e5['model'],qs[_0x7502('0x3b')](_0x12ff91[_0x7502('0x35')]['fields']));_0x7ef3d5[_0x7502('0x3a')]=_0x7ef3d5[_0x7502('0x3a')][_0x7502('0x48')]?_0x7ef3d5['attributes']:_0x34e6e5[_0x7502('0x39')];_0x7ef3d5[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x12ff91['query'][_0x7502('0x3f')]);_0x7ef3d5[_0x7502('0x40')]=qs[_0x7502('0x37')](_['pick'](_0x12ff91[_0x7502('0x35')],_0x34e6e5[_0x7502('0x37')]));if(_0x12ff91[_0x7502('0x35')][_0x7502('0x42')]){_0x7ef3d5[_0x7502('0x40')]=_[_0x7502('0x43')](_0x7ef3d5['where'],{'$or':_[_0x7502('0x31')](_0x7ef3d5['attributes'],function(_0x324ea3){var _0x3f5951={};_0x3f5951[_0x324ea3]={'$like':'%'+_0x12ff91['query'][_0x7502('0x42')]+'%'};return _0x3f5951;})});}_0x7ef3d5=_['merge']({},_0x7ef3d5,_0x12ff91[_0x7502('0x4a')]);return _0x286e7d[_0x7502('0x54')](_0x7ef3d5);}})[_0x7502('0x17')](function(_0x396563){if(_0x396563){_0x3d21be=_0x396563[_0x7502('0x48')];if(!_0x12ff91[_0x7502('0x35')][_0x7502('0x51')]('nolimit')){_0x7ef3d5[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x12ff91['query'][_0x7502('0x3d')]);_0x7ef3d5[_0x7502('0x25')]=qs[_0x7502('0x25')](_0x12ff91[_0x7502('0x35')]['offset']);}return _0x286e7d[_0x7502('0x54')](_0x7ef3d5);}})['then'](function(_0x3db582){if(_0x3db582){return _0x3db582?{'count':_0x3d21be,'rows':_0x3db582}:null;}})[_0x7502('0x17')](respondWithResult(_0x5f5bd5,null))[_0x7502('0x20')](handleError(_0x5f5bd5,null));};exports['getTags']=function(_0x4a1fe9,_0x10589b,_0x313bac){var _0x5dcfc9={};var _0x5b47a3={};var _0x7dd29a;var _0x63a35;return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x4a1fe9[_0x7502('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10589b,null))[_0x7502('0x17')](function(_0x16b2cb){if(_0x16b2cb){_0x7dd29a=_0x16b2cb;_0x5b47a3[_0x7502('0x39')]=_[_0x7502('0x36')](db['Tag']['rawAttributes']);_0x5b47a3['query']=_[_0x7502('0x36')](_0x4a1fe9[_0x7502('0x35')]);_0x5b47a3[_0x7502('0x37')]=_[_0x7502('0x38')](_0x5b47a3['model'],_0x5b47a3[_0x7502('0x35')]);_0x5dcfc9[_0x7502('0x3a')]=_['intersection'](_0x5b47a3[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x4a1fe9[_0x7502('0x35')]['fields']));_0x5dcfc9['attributes']=_0x5dcfc9[_0x7502('0x3a')][_0x7502('0x48')]?_0x5dcfc9[_0x7502('0x3a')]:_0x5b47a3[_0x7502('0x39')];_0x5dcfc9[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x4a1fe9[_0x7502('0x35')][_0x7502('0x3f')]);_0x5dcfc9[_0x7502('0x40')]=qs['filters'](_[_0x7502('0x41')](_0x4a1fe9[_0x7502('0x35')],_0x5b47a3[_0x7502('0x37')]));if(_0x4a1fe9[_0x7502('0x35')]['filter']){_0x5dcfc9[_0x7502('0x40')]=_[_0x7502('0x43')](_0x5dcfc9['where'],{'$or':_[_0x7502('0x31')](_0x5dcfc9[_0x7502('0x3a')],function(_0x51ef23){var _0x1bc625={};_0x1bc625[_0x51ef23]={'$like':'%'+_0x4a1fe9[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x1bc625;})});}_0x5dcfc9=_[_0x7502('0x43')]({},_0x5dcfc9,_0x4a1fe9['options']);return _0x7dd29a[_0x7502('0x55')](_0x5dcfc9);}})[_0x7502('0x17')](function(_0x5b113d){if(_0x5b113d){_0x63a35=_0x5b113d[_0x7502('0x48')];if(!_0x4a1fe9[_0x7502('0x35')]['hasOwnProperty'](_0x7502('0x3c'))){_0x5dcfc9[_0x7502('0x3d')]=qs['limit'](_0x4a1fe9[_0x7502('0x35')][_0x7502('0x3d')]);_0x5dcfc9[_0x7502('0x25')]=qs['offset'](_0x4a1fe9[_0x7502('0x35')]['offset']);}return _0x7dd29a[_0x7502('0x55')](_0x5dcfc9);}})[_0x7502('0x17')](function(_0x1f391f){if(_0x1f391f){return _0x1f391f?{'count':_0x63a35,'rows':_0x1f391f}:null;}})[_0x7502('0x17')](respondWithResult(_0x10589b,null))[_0x7502('0x20')](handleError(_0x10589b,null));};exports['setTags']=function(_0x260d43,_0x84dc50,_0x49d471){if(_0x260d43['body']['id']){delete _0x260d43[_0x7502('0x4c')]['id'];}return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x260d43['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x84dc50,null))[_0x7502('0x17')](function(_0x1c9697){if(_0x1c9697){return _0x1c9697[_0x7502('0x56')](_0x260d43[_0x7502('0x4c')][_0x7502('0x57')]||[]);}return null;})['then'](respondWithResult(_0x84dc50,null))[_0x7502('0x20')](handleError(_0x84dc50,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index df15d17..2745d75 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 _0xcc68=['exports','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x58ae9f,_0xcaa7d7){var _0x4c966d=function(_0x401fbe){while(--_0x401fbe){_0x58ae9f['push'](_0x58ae9f['shift']());}};_0x4c966d(++_0xcaa7d7);}(_0xcc68,0xda));var _0x8cc6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcc68[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8cc6('0x0'));var util=require(_0x8cc6('0x1'));var logger=require(_0x8cc6('0x2'))(_0x8cc6('0x3'));var moment=require(_0x8cc6('0x4'));var BPromise=require(_0x8cc6('0x5'));var rp=require(_0x8cc6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cc6('0x7'));var config=require(_0x8cc6('0x8'));var attributes=require(_0x8cc6('0x9'));module[_0x8cc6('0xa')]=function(_0x155d79,_0x20e227){return _0x155d79['define'](_0x8cc6('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd438=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_freshdesk_configurations','lodash','util'];(function(_0x4f3492,_0x476c27){var _0x355bf4=function(_0x588d77){while(--_0x588d77){_0x4f3492['push'](_0x4f3492['shift']());}};_0x355bf4(++_0x476c27);}(_0xd438,0x174));var _0x8d43=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0xd438[_0x1e1965];return _0x1a2e96;};'use strict';var _=require(_0x8d43('0x0'));var util=require(_0x8d43('0x1'));var logger=require(_0x8d43('0x2'))('api');var moment=require(_0x8d43('0x3'));var BPromise=require(_0x8d43('0x4'));var rp=require(_0x8d43('0x5'));var fs=require('fs');var path=require(_0x8d43('0x6'));var rimraf=require(_0x8d43('0x7'));var config=require(_0x8d43('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x20c946,_0x5ad329){return _0x20c946[_0x8d43('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x8d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 355e826..db7f139 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 _0xd851=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x514b13,_0x453510){var _0x51b897=function(_0x168f29){while(--_0x168f29){_0x514b13['push'](_0x514b13['shift']());}};_0x51b897(++_0x453510);}(_0xd851,0x1c6));var _0x1d85=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xd851[_0x9fb081];return _0x43f8b0;};'use strict';var _=require('lodash');var util=require(_0x1d85('0x0'));var moment=require(_0x1d85('0x1'));var BPromise=require(_0x1d85('0x2'));var rs=require(_0x1d85('0x3'));var fs=require('fs');var Redis=require(_0x1d85('0x4'));var db=require(_0x1d85('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1d85('0x6'));var jayson=require(_0x1d85('0x7'));var client=jayson[_0x1d85('0x8')][_0x1d85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32404d,_0x24b045,_0x31ab0f){return new BPromise(function(_0xa038bc,_0x2c069f){return client['request'](_0x32404d,_0x31ab0f)[_0x1d85('0xa')](function(_0x50f906){logger[_0x1d85('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x24b045,_0x1d85('0xc'));logger[_0x1d85('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x24b045,'request\x20sent',JSON['stringify'](_0x50f906));if(_0x50f906[_0x1d85('0xe')]){if(_0x50f906[_0x1d85('0xe')][_0x1d85('0xf')]===0x1f4){logger['error'](_0x1d85('0x10'),_0x24b045,_0x50f906['error'][_0x1d85('0x11')]);return _0x2c069f(_0x50f906['error'][_0x1d85('0x11')]);}logger[_0x1d85('0xe')](_0x1d85('0x10'),_0x24b045,_0x50f906[_0x1d85('0xe')][_0x1d85('0x11')]);return _0xa038bc(_0x50f906[_0x1d85('0xe')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x24b045,_0x1d85('0xc'));_0xa038bc(_0x50f906['result'][_0x1d85('0x11')]);}})[_0x1d85('0x12')](function(_0x39badb){logger[_0x1d85('0xe')](_0x1d85('0x10'),_0x24b045,_0x39badb);_0x2c069f(_0x39badb);});});} \ No newline at end of file +var _0xd337=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch'];(function(_0x133380,_0x5137b7){var _0x486823=function(_0xbc7be8){while(--_0xbc7be8){_0x133380['push'](_0x133380['shift']());}};_0x486823(++_0x5137b7);}(_0xd337,0x168));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d33('0x0'));var util=require('util');var moment=require(_0x7d33('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d33('0x2'));var db=require(_0x7d33('0x3'))['db'];var utils=require(_0x7d33('0x4'));var logger=require(_0x7d33('0x5'))(_0x7d33('0x6'));var config=require('../../config/environment');var jayson=require(_0x7d33('0x7'));var client=jayson[_0x7d33('0x8')][_0x7d33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b93c0,_0x31e4c1,_0x2bd5b9){return new BPromise(function(_0x5a3e7c,_0x107997){return client[_0x7d33('0xa')](_0x3b93c0,_0x2bd5b9)[_0x7d33('0xb')](function(_0x34c3c0){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x7d33('0xc'));logger[_0x7d33('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x31e4c1,_0x7d33('0xc'),JSON[_0x7d33('0xe')](_0x34c3c0));if(_0x34c3c0['error']){if(_0x34c3c0[_0x7d33('0xf')]['code']===0x1f4){logger['error'](_0x7d33('0x10'),_0x31e4c1,_0x34c3c0['error'][_0x7d33('0x11')]);return _0x107997(_0x34c3c0[_0x7d33('0xf')][_0x7d33('0x11')]);}logger[_0x7d33('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x34c3c0[_0x7d33('0xf')][_0x7d33('0x11')]);return _0x5a3e7c(_0x34c3c0[_0x7d33('0xf')]['message']);}else{logger[_0x7d33('0x12')](_0x7d33('0x10'),_0x31e4c1,_0x7d33('0xc'));_0x5a3e7c(_0x34c3c0['result'][_0x7d33('0x11')]);}})[_0x7d33('0x13')](function(_0x28bdba){logger[_0x7d33('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x28bdba);_0x107997(_0x28bdba);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2d11069..a209b09 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5285de,_0x554a15){_0x5285de=_0x5285de-0x0;var _0x55691e=_0xedd9[_0x5285de];return _0x55691e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x103605,_0x1f1415){var _0xeb2b20=function(_0x3ce8b0){while(--_0x3ce8b0){_0x103605['push'](_0x103605['shift']());}};_0xeb2b20(++_0x1f1415);}(_0x3e74,0x175));var _0x43e7=function(_0x5d7bf9,_0x9738dc){_0x5d7bf9=_0x5d7bf9-0x0;var _0x2f2994=_0x3e74[_0x5d7bf9];return _0x2f2994;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 87883c1..d3a7fb6 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 _0x5bb7=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x2fe785,_0x4cf563){var _0x2ef0f6=function(_0x5b1549){while(--_0x5b1549){_0x2fe785['push'](_0x2fe785['shift']());}};_0x2ef0f6(++_0x4cf563);}(_0x5bb7,0x1ee));var _0x75bb=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x5bb7[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x75bb('0x0'));module[_0x75bb('0x1')]={'type':{'type':Sequelize[_0x75bb('0x2')](_0x75bb('0x3'),_0x75bb('0x4'),_0x75bb('0x5'),_0x75bb('0x6')),'defaultValue':_0x75bb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x75bb('0x7')]},'keyType':{'type':Sequelize[_0x75bb('0x2')](_0x75bb('0x3'),_0x75bb('0x4'),_0x75bb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x75bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a19=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x9a19,0x114));var _0x99a1=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x9a19[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'type':{'type':Sequelize[_0x99a1('0x2')]('string',_0x99a1('0x3'),_0x99a1('0x4'),_0x99a1('0x5')),'defaultValue':_0x99a1('0x6')},'content':{'type':Sequelize[_0x99a1('0x7')]},'key':{'type':Sequelize[_0x99a1('0x7')]},'keyType':{'type':Sequelize[_0x99a1('0x2')](_0x99a1('0x6'),_0x99a1('0x3'),_0x99a1('0x4'))},'keyContent':{'type':Sequelize[_0x99a1('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99a1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 606375d..a22aaef 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 _0x2e35=['end','error','stack','name','send','index','FreshdeskField','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2e35,0x101));var _0x52e3=function(_0x4d9f2b,_0x240213){_0x4d9f2b=_0x4d9f2b-0x0;var _0x24261f=_0x2e35[_0x4d9f2b];return _0x24261f;};'use strict';var pdf=require(_0x52e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x52e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52e3('0x2'));var rp=require(_0x52e3('0x3'));var moment=require(_0x52e3('0x4'));var BPromise=require(_0x52e3('0x5'));var Mustache=require('mustache');var util=require(_0x52e3('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x52e3('0x7'));var fs=require('fs');var _=require(_0x52e3('0x8'));var squel=require(_0x52e3('0x9'));var crypto=require(_0x52e3('0xa'));var jsforce=require(_0x52e3('0xb'));var deskjs=require(_0x52e3('0xc'));var toCsv=require(_0x52e3('0xd'));var querystring=require(_0x52e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x52e3('0xf'));var authService=require(_0x52e3('0x10'));var qs=require(_0x52e3('0x11'));var as=require(_0x52e3('0x12'));var hardwareService=require(_0x52e3('0x13'));var logger=require(_0x52e3('0x14'))(_0x52e3('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52e3('0x16'))['db'];function respondWithStatusCode(_0x16f46e,_0x353753){_0x353753=_0x353753||0xcc;return function(_0x5d1d5b){if(_0x5d1d5b){return _0x16f46e[_0x52e3('0x17')](_0x353753);}return _0x16f46e[_0x52e3('0x18')](_0x353753)['end']();};}function respondWithResult(_0x411cbd,_0x18f267){_0x18f267=_0x18f267||0xc8;return function(_0x50f418){if(_0x50f418){return _0x411cbd[_0x52e3('0x18')](_0x18f267)[_0x52e3('0x19')](_0x50f418);}};}function respondWithFilteredResult(_0x1629d7,_0x2db102){return function(_0x17f4a1){if(_0x17f4a1){var _0x3cf4f0=_0x17f4a1[_0x52e3('0x1a')],_0x13b320=_0x2db102['offset'],_0x3f753e=_0x2db102[_0x52e3('0x1b')]+_0x2db102[_0x52e3('0x1c')],_0x453b02;if(_0x3f753e>=_0x3cf4f0){_0x3f753e=_0x3cf4f0;_0x453b02=0xc8;}else{_0x453b02=0xce;}_0x1629d7[_0x52e3('0x18')](_0x453b02);return _0x1629d7[_0x52e3('0x1d')](_0x52e3('0x1e'),_0x13b320+'-'+_0x3f753e+'/'+_0x3cf4f0)[_0x52e3('0x19')](_0x17f4a1);}return null;};}function patchUpdates(_0x33eba3){return function(_0x3001dd){try{jsonpatch[_0x52e3('0x1f')](_0x3001dd,_0x33eba3,!![]);}catch(_0x1d15b3){return BPromise[_0x52e3('0x20')](_0x1d15b3);}return _0x3001dd['save']();};}function saveUpdates(_0x36ba74,_0x3b4aec){return function(_0x592941){if(_0x592941){return _0x592941['update'](_0x36ba74)[_0x52e3('0x21')](function(_0x3c0757){return _0x3c0757;});}return null;};}function removeEntity(_0x2fbaf7,_0x323d46){return function(_0x246343){if(_0x246343){return _0x246343[_0x52e3('0x22')]()[_0x52e3('0x21')](function(){_0x2fbaf7[_0x52e3('0x18')](0xcc)[_0x52e3('0x23')]();});}};}function handleEntityNotFound(_0x2ecbfe,_0x37ac72){return function(_0x3f5021){if(!_0x3f5021){_0x2ecbfe[_0x52e3('0x17')](0x194);}return _0x3f5021;};}function handleError(_0x3cd251,_0x101b54){_0x101b54=_0x101b54||0x1f4;return function(_0x51c5c3){logger[_0x52e3('0x24')](_0x51c5c3[_0x52e3('0x25')]);if(_0x51c5c3['name']){delete _0x51c5c3[_0x52e3('0x26')];}_0x3cd251[_0x52e3('0x18')](_0x101b54)[_0x52e3('0x27')](_0x51c5c3);};}exports[_0x52e3('0x28')]=function(_0x1fdc89,_0x2e07ef){var _0x2618ed={},_0x4b2b8a={},_0x3ca54f={'count':0x0,'rows':[]};var _0x31275a=_['map'](db[_0x52e3('0x29')]['rawAttributes'],function(_0x299c52){return{'name':_0x299c52[_0x52e3('0x2a')],'type':_0x299c52[_0x52e3('0x2b')]['key']};});_0x4b2b8a[_0x52e3('0x2c')]=_[_0x52e3('0x2d')](_0x31275a,_0x52e3('0x26'));_0x4b2b8a[_0x52e3('0x2e')]=_[_0x52e3('0x2f')](_0x1fdc89[_0x52e3('0x2e')]);_0x4b2b8a['filters']=_[_0x52e3('0x30')](_0x4b2b8a['model'],_0x4b2b8a[_0x52e3('0x2e')]);_0x2618ed[_0x52e3('0x31')]=_[_0x52e3('0x30')](_0x4b2b8a['model'],qs[_0x52e3('0x32')](_0x1fdc89['query'][_0x52e3('0x32')]));_0x2618ed[_0x52e3('0x31')]=_0x2618ed[_0x52e3('0x31')][_0x52e3('0x33')]?_0x2618ed[_0x52e3('0x31')]:_0x4b2b8a[_0x52e3('0x2c')];if(!_0x1fdc89['query'][_0x52e3('0x34')](_0x52e3('0x35'))){_0x2618ed[_0x52e3('0x1c')]=qs['limit'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1c')]);_0x2618ed[_0x52e3('0x1b')]=qs['offset'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x1b')]);}_0x2618ed[_0x52e3('0x36')]=qs['sort'](_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x37')]);_0x2618ed[_0x52e3('0x38')]=qs[_0x52e3('0x39')](_['pick'](_0x1fdc89[_0x52e3('0x2e')],_0x4b2b8a['filters']),_0x31275a);if(_0x1fdc89[_0x52e3('0x2e')]['filter']){_0x2618ed['where']=_['merge'](_0x2618ed[_0x52e3('0x38')],{'$or':_['map'](_0x31275a,function(_0x249471){if(_0x249471[_0x52e3('0x2b')]!==_0x52e3('0x3a')){var _0x1f7a8a={};_0x1f7a8a[_0x249471[_0x52e3('0x26')]]={'$like':'%'+_0x1fdc89[_0x52e3('0x2e')][_0x52e3('0x3b')]+'%'};return _0x1f7a8a;}})});}_0x2618ed=_[_0x52e3('0x3c')]({},_0x2618ed,_0x1fdc89['options']);var _0x22de67={'where':_0x2618ed[_0x52e3('0x38')]};return db[_0x52e3('0x29')][_0x52e3('0x1a')](_0x22de67)['then'](function(_0x26b588){_0x3ca54f[_0x52e3('0x1a')]=_0x26b588;if(_0x1fdc89['query'][_0x52e3('0x3d')]){_0x2618ed['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x52e3('0x3e')](_0x2618ed);})['then'](function(_0x4de06f){_0x3ca54f[_0x52e3('0x3f')]=_0x4de06f;return _0x3ca54f;})[_0x52e3('0x21')](respondWithFilteredResult(_0x2e07ef,_0x2618ed))[_0x52e3('0x40')](handleError(_0x2e07ef,null));};exports[_0x52e3('0x41')]=function(_0x5a097c,_0x5792c7){var _0x1977a1={'raw':!![],'where':{'id':_0x5a097c['params']['id']}},_0x19b077={};_0x19b077[_0x52e3('0x2c')]=_[_0x52e3('0x2f')](db[_0x52e3('0x29')][_0x52e3('0x42')]);_0x19b077['query']=_[_0x52e3('0x2f')](_0x5a097c[_0x52e3('0x2e')]);_0x19b077[_0x52e3('0x39')]=_[_0x52e3('0x30')](_0x19b077[_0x52e3('0x2c')],_0x19b077[_0x52e3('0x2e')]);_0x1977a1[_0x52e3('0x31')]=_['intersection'](_0x19b077[_0x52e3('0x2c')],qs['fields'](_0x5a097c['query'][_0x52e3('0x32')]));_0x1977a1['attributes']=_0x1977a1['attributes'][_0x52e3('0x33')]?_0x1977a1[_0x52e3('0x31')]:_0x19b077['model'];if(_0x5a097c[_0x52e3('0x2e')][_0x52e3('0x3d')]){_0x1977a1[_0x52e3('0x43')]=[{'all':!![]}];}_0x1977a1=_['merge']({},_0x1977a1,_0x5a097c['options']);return db[_0x52e3('0x29')][_0x52e3('0x44')](_0x1977a1)[_0x52e3('0x21')](handleEntityNotFound(_0x5792c7,null))[_0x52e3('0x21')](respondWithResult(_0x5792c7,null))[_0x52e3('0x40')](handleError(_0x5792c7,null));};exports[_0x52e3('0x45')]=function(_0x3e591f,_0x2c6618){return db[_0x52e3('0x29')][_0x52e3('0x45')](_0x3e591f[_0x52e3('0x46')],{})[_0x52e3('0x21')](respondWithResult(_0x2c6618,0xc9))['catch'](handleError(_0x2c6618,null));};exports[_0x52e3('0x47')]=function(_0x4af63e,_0x3cf60b){if(_0x4af63e[_0x52e3('0x46')]['id']){delete _0x4af63e[_0x52e3('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4af63e[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x3cf60b,null))[_0x52e3('0x21')](saveUpdates(_0x4af63e[_0x52e3('0x46')],null))[_0x52e3('0x21')](respondWithResult(_0x3cf60b,null))['catch'](handleError(_0x3cf60b,null));};exports[_0x52e3('0x22')]=function(_0x4f8349,_0x4f0953){return db[_0x52e3('0x29')][_0x52e3('0x44')]({'where':{'id':_0x4f8349[_0x52e3('0x48')]['id']}})[_0x52e3('0x21')](handleEntityNotFound(_0x4f0953,null))[_0x52e3('0x21')](removeEntity(_0x4f0953,null))[_0x52e3('0x40')](handleError(_0x4f0953,null));}; \ No newline at end of file +var _0x00a8=['rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','keys','includeAll','options','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','send','index','map','FreshdeskField'];(function(_0x76577e,_0x4f42e5){var _0x1b13c7=function(_0x269df4){while(--_0x269df4){_0x76577e['push'](_0x76577e['shift']());}};_0x1b13c7(++_0x4f42e5);}(_0x00a8,0xb3));var _0x800a=function(_0x1b637f,_0x29190b){_0x1b637f=_0x1b637f-0x0;var _0x3f4869=_0x00a8[_0x1b637f];return _0x3f4869;};'use strict';var pdf=require(_0x800a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x800a('0x1'));var zipdir=require(_0x800a('0x2'));var jsonpatch=require(_0x800a('0x3'));var rp=require('request-promise');var moment=require(_0x800a('0x4'));var BPromise=require(_0x800a('0x5'));var Mustache=require(_0x800a('0x6'));var util=require(_0x800a('0x7'));var path=require(_0x800a('0x8'));var sox=require(_0x800a('0x9'));var csv=require(_0x800a('0xa'));var ejs=require(_0x800a('0xb'));var fs=require('fs');var _=require(_0x800a('0xc'));var squel=require(_0x800a('0xd'));var crypto=require(_0x800a('0xe'));var jsforce=require(_0x800a('0xf'));var deskjs=require(_0x800a('0x10'));var toCsv=require(_0x800a('0xa'));var querystring=require(_0x800a('0x11'));var Papa=require(_0x800a('0x12'));var Redis=require(_0x800a('0x13'));var authService=require(_0x800a('0x14'));var qs=require(_0x800a('0x15'));var as=require(_0x800a('0x16'));var hardwareService=require(_0x800a('0x17'));var logger=require('../../config/logger')(_0x800a('0x18'));var utils=require(_0x800a('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x800a('0x1a'))['db'];function respondWithStatusCode(_0x23d9e1,_0x1a12f1){_0x1a12f1=_0x1a12f1||0xcc;return function(_0x25c791){if(_0x25c791){return _0x23d9e1[_0x800a('0x1b')](_0x1a12f1);}return _0x23d9e1[_0x800a('0x1c')](_0x1a12f1)['end']();};}function respondWithResult(_0x5eb3ae,_0x4b849c){_0x4b849c=_0x4b849c||0xc8;return function(_0x2566c5){if(_0x2566c5){return _0x5eb3ae[_0x800a('0x1c')](_0x4b849c)[_0x800a('0x1d')](_0x2566c5);}};}function respondWithFilteredResult(_0x3075b4,_0x1dfe5f){return function(_0x3a6041){if(_0x3a6041){var _0x2f1d23=_0x3a6041[_0x800a('0x1e')],_0x482b99=_0x1dfe5f[_0x800a('0x1f')],_0x24e97e=_0x1dfe5f['offset']+_0x1dfe5f[_0x800a('0x20')],_0xba1692;if(_0x24e97e>=_0x2f1d23){_0x24e97e=_0x2f1d23;_0xba1692=0xc8;}else{_0xba1692=0xce;}_0x3075b4[_0x800a('0x1c')](_0xba1692);return _0x3075b4[_0x800a('0x21')](_0x800a('0x22'),_0x482b99+'-'+_0x24e97e+'/'+_0x2f1d23)[_0x800a('0x1d')](_0x3a6041);}return null;};}function patchUpdates(_0x285be1){return function(_0x182a95){try{jsonpatch['apply'](_0x182a95,_0x285be1,!![]);}catch(_0x5e2a89){return BPromise[_0x800a('0x23')](_0x5e2a89);}return _0x182a95[_0x800a('0x24')]();};}function saveUpdates(_0x9f31b9,_0x2e52ba){return function(_0x3dd9d7){if(_0x3dd9d7){return _0x3dd9d7[_0x800a('0x25')](_0x9f31b9)['then'](function(_0x2afbb2){return _0x2afbb2;});}return null;};}function removeEntity(_0x3029ce,_0x5ea727){return function(_0x19f48c){if(_0x19f48c){return _0x19f48c[_0x800a('0x26')]()[_0x800a('0x27')](function(){_0x3029ce['status'](0xcc)[_0x800a('0x28')]();});}};}function handleEntityNotFound(_0x25b14e,_0x2c48fd){return function(_0x5b3434){if(!_0x5b3434){_0x25b14e[_0x800a('0x1b')](0x194);}return _0x5b3434;};}function handleError(_0x4a6342,_0x16944c){_0x16944c=_0x16944c||0x1f4;return function(_0x5e15b3){logger[_0x800a('0x29')](_0x5e15b3['stack']);if(_0x5e15b3['name']){delete _0x5e15b3['name'];}_0x4a6342[_0x800a('0x1c')](_0x16944c)[_0x800a('0x2a')](_0x5e15b3);};}exports[_0x800a('0x2b')]=function(_0x4a9c99,_0x4e7bb8){var _0x1e75de={},_0x55b569={},_0x1541cf={'count':0x0,'rows':[]};var _0x36a70e=_[_0x800a('0x2c')](db[_0x800a('0x2d')][_0x800a('0x2e')],function(_0x384cf9){return{'name':_0x384cf9[_0x800a('0x2f')],'type':_0x384cf9['type'][_0x800a('0x30')]};});_0x55b569[_0x800a('0x31')]=_['map'](_0x36a70e,_0x800a('0x32'));_0x55b569[_0x800a('0x33')]=_['keys'](_0x4a9c99[_0x800a('0x33')]);_0x55b569[_0x800a('0x34')]=_[_0x800a('0x35')](_0x55b569[_0x800a('0x31')],_0x55b569[_0x800a('0x33')]);_0x1e75de[_0x800a('0x36')]=_[_0x800a('0x35')](_0x55b569['model'],qs[_0x800a('0x37')](_0x4a9c99[_0x800a('0x33')][_0x800a('0x37')]));_0x1e75de['attributes']=_0x1e75de[_0x800a('0x36')][_0x800a('0x38')]?_0x1e75de[_0x800a('0x36')]:_0x55b569[_0x800a('0x31')];if(!_0x4a9c99[_0x800a('0x33')][_0x800a('0x39')](_0x800a('0x3a'))){_0x1e75de[_0x800a('0x20')]=qs[_0x800a('0x20')](_0x4a9c99[_0x800a('0x33')][_0x800a('0x20')]);_0x1e75de[_0x800a('0x1f')]=qs[_0x800a('0x1f')](_0x4a9c99['query'][_0x800a('0x1f')]);}_0x1e75de[_0x800a('0x3b')]=qs[_0x800a('0x3c')](_0x4a9c99['query']['sort']);_0x1e75de[_0x800a('0x3d')]=qs[_0x800a('0x34')](_[_0x800a('0x3e')](_0x4a9c99[_0x800a('0x33')],_0x55b569[_0x800a('0x34')]),_0x36a70e);if(_0x4a9c99[_0x800a('0x33')][_0x800a('0x3f')]){_0x1e75de[_0x800a('0x3d')]=_['merge'](_0x1e75de[_0x800a('0x3d')],{'$or':_['map'](_0x36a70e,function(_0x4eb119){if(_0x4eb119['type']!=='VIRTUAL'){var _0x5928d4={};_0x5928d4[_0x4eb119['name']]={'$like':'%'+_0x4a9c99[_0x800a('0x33')][_0x800a('0x3f')]+'%'};return _0x5928d4;}})});}_0x1e75de=_[_0x800a('0x40')]({},_0x1e75de,_0x4a9c99['options']);var _0x339fda={'where':_0x1e75de[_0x800a('0x3d')]};return db[_0x800a('0x2d')][_0x800a('0x1e')](_0x339fda)['then'](function(_0x2945c7){_0x1541cf[_0x800a('0x1e')]=_0x2945c7;if(_0x4a9c99[_0x800a('0x33')]['includeAll']){_0x1e75de[_0x800a('0x41')]=[{'all':!![]}];}return db[_0x800a('0x2d')]['findAll'](_0x1e75de);})[_0x800a('0x27')](function(_0x4fde12){_0x1541cf[_0x800a('0x42')]=_0x4fde12;return _0x1541cf;})[_0x800a('0x27')](respondWithFilteredResult(_0x4e7bb8,_0x1e75de))[_0x800a('0x43')](handleError(_0x4e7bb8,null));};exports[_0x800a('0x44')]=function(_0x42fa1f,_0x5795e9){var _0x2dc47c={'raw':!![],'where':{'id':_0x42fa1f['params']['id']}},_0x78b993={};_0x78b993['model']=_['keys'](db[_0x800a('0x2d')]['rawAttributes']);_0x78b993['query']=_[_0x800a('0x45')](_0x42fa1f[_0x800a('0x33')]);_0x78b993['filters']=_[_0x800a('0x35')](_0x78b993[_0x800a('0x31')],_0x78b993[_0x800a('0x33')]);_0x2dc47c['attributes']=_['intersection'](_0x78b993['model'],qs[_0x800a('0x37')](_0x42fa1f[_0x800a('0x33')]['fields']));_0x2dc47c['attributes']=_0x2dc47c[_0x800a('0x36')][_0x800a('0x38')]?_0x2dc47c[_0x800a('0x36')]:_0x78b993['model'];if(_0x42fa1f[_0x800a('0x33')][_0x800a('0x46')]){_0x2dc47c['include']=[{'all':!![]}];}_0x2dc47c=_[_0x800a('0x40')]({},_0x2dc47c,_0x42fa1f[_0x800a('0x47')]);return db[_0x800a('0x2d')]['find'](_0x2dc47c)[_0x800a('0x27')](handleEntityNotFound(_0x5795e9,null))['then'](respondWithResult(_0x5795e9,null))[_0x800a('0x43')](handleError(_0x5795e9,null));};exports['create']=function(_0x18fcee,_0x3aa9cc){return db[_0x800a('0x2d')]['create'](_0x18fcee['body'],{})[_0x800a('0x27')](respondWithResult(_0x3aa9cc,0xc9))[_0x800a('0x43')](handleError(_0x3aa9cc,null));};exports[_0x800a('0x25')]=function(_0x4edc11,_0x35a86f){if(_0x4edc11[_0x800a('0x48')]['id']){delete _0x4edc11['body']['id'];}return db['FreshdeskField'][_0x800a('0x49')]({'where':{'id':_0x4edc11[_0x800a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35a86f,null))[_0x800a('0x27')](saveUpdates(_0x4edc11[_0x800a('0x48')],null))[_0x800a('0x27')](respondWithResult(_0x35a86f,null))[_0x800a('0x43')](handleError(_0x35a86f,null));};exports[_0x800a('0x26')]=function(_0x1e3e03,_0x234ca6){return db[_0x800a('0x2d')][_0x800a('0x49')]({'where':{'id':_0x1e3e03[_0x800a('0x4a')]['id']}})[_0x800a('0x27')](handleEntityNotFound(_0x234ca6,null))[_0x800a('0x27')](removeEntity(_0x234ca6,null))['catch'](handleError(_0x234ca6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b575e9f..5e4d143 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 _0x9006=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash'];(function(_0x516a5f,_0x1366b1){var _0x2cf601=function(_0x593866){while(--_0x593866){_0x516a5f['push'](_0x516a5f['shift']());}};_0x2cf601(++_0x1366b1);}(_0x9006,0xa7));var _0x6900=function(_0x1c664c,_0x1e303a){_0x1c664c=_0x1c664c-0x0;var _0x3dc08c=_0x9006[_0x1c664c];return _0x3dc08c;};'use strict';var _=require(_0x6900('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6900('0x1'));var moment=require(_0x6900('0x2'));var BPromise=require(_0x6900('0x3'));var rp=require(_0x6900('0x4'));var fs=require('fs');var path=require(_0x6900('0x5'));var rimraf=require(_0x6900('0x6'));var config=require(_0x6900('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x6900('0x8')]=function(_0xfb9f76,_0x6b9b20){return _0xfb9f76[_0x6900('0x9')](_0x6900('0xa'),attributes,{'tableName':_0x6900('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x6900('0xc'),_0x6900('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd31b=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x42cef3,_0x47db8a){var _0x2a2a85=function(_0x4d98d4){while(--_0x4d98d4){_0x42cef3['push'](_0x42cef3['shift']());}};_0x2a2a85(++_0x47db8a);}(_0xd31b,0x1dd));var _0xbd31=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0xd31b[_0x54f859];return _0x17a08b;};'use strict';var _=require(_0xbd31('0x0'));var util=require(_0xbd31('0x1'));var logger=require(_0xbd31('0x2'))(_0xbd31('0x3'));var moment=require(_0xbd31('0x4'));var BPromise=require(_0xbd31('0x5'));var rp=require(_0xbd31('0x6'));var fs=require('fs');var path=require(_0xbd31('0x7'));var rimraf=require(_0xbd31('0x8'));var config=require('../../config/environment');var attributes=require(_0xbd31('0x9'));module['exports']=function(_0x1dc1f0,_0x3f99be){return _0x1dc1f0[_0xbd31('0xa')]('FreshdeskField',attributes,{'tableName':_0xbd31('0xb'),'paranoid':![],'indexes':[{'name':_0xbd31('0xc'),'fields':['idField',_0xbd31('0xd')],'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 0e2d277..7076986 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x1db9fd,_0x31b4e7){_0x1db9fd=_0x1db9fd-0x0;var _0x4f4023=_0x7a54[_0x1db9fd];return _0x4f4023;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5f1992,_0x128523){var _0x1a2bc8=function(_0x42e8b5){while(--_0x42e8b5){_0x5f1992['push'](_0x5f1992['shift']());}};_0x1a2bc8(++_0x128523);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aba4f,_0x1afb63){_0x5aba4f=_0x5aba4f-0x0;var _0x10cf5c=_0xb10b[_0x5aba4f];return _0x10cf5c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 44d9d48..ce389d6 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 _0xd92d=['post','create','addConfiguration','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x19194a,_0x52e468){var _0x156499=function(_0x2f4c27){while(--_0x2f4c27){_0x19194a['push'](_0x19194a['shift']());}};_0x156499(++_0x52e468);}(_0xd92d,0x1e6));var _0xdd92=function(_0x5eca9f,_0x1d15d3){_0x5eca9f=_0x5eca9f-0x0;var _0x53a05c=_0xd92d[_0x5eca9f];return _0x53a05c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd92('0x0'));var timeout=require('connect-timeout');var express=require(_0xdd92('0x1'));var router=express[_0xdd92('0x2')]();var auth=require(_0xdd92('0x3'));var interaction=require(_0xdd92('0x4'));var config=require(_0xdd92('0x5'));var controller=require(_0xdd92('0x6'));router[_0xdd92('0x7')]('/',auth[_0xdd92('0x8')](),controller[_0xdd92('0x9')]);router['get'](_0xdd92('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdd92('0x7')](_0xdd92('0xb'),auth[_0xdd92('0x8')](),controller[_0xdd92('0xc')]);router[_0xdd92('0x7')]('/:id/fields',auth[_0xdd92('0x8')](),controller[_0xdd92('0xd')]);router[_0xdd92('0xe')]('/',auth[_0xdd92('0x8')](),controller[_0xdd92('0xf')]);router[_0xdd92('0xe')]('/:id/configurations',auth[_0xdd92('0x8')](),controller[_0xdd92('0x10')]);router['put']('/:id',auth[_0xdd92('0x8')](),controller['update']);router[_0xdd92('0x11')](_0xdd92('0xa'),auth[_0xdd92('0x8')](),controller[_0xdd92('0x12')]);module[_0xdd92('0x13')]=router; \ No newline at end of file +var _0xd90b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd90b,0x1ce));var _0xbd90=function(_0x580fe1,_0x49843f){_0x580fe1=_0x580fe1-0x0;var _0x285b16=_0xd90b[_0x580fe1];return _0x285b16;};'use strict';var multer=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var path=require(_0xbd90('0x2'));var timeout=require(_0xbd90('0x3'));var express=require(_0xbd90('0x4'));var router=express[_0xbd90('0x5')]();var auth=require(_0xbd90('0x6'));var interaction=require(_0xbd90('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xbd90('0x8')](),controller['index']);router[_0xbd90('0x9')]('/:id',auth[_0xbd90('0x8')](),controller['show']);router[_0xbd90('0x9')](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller[_0xbd90('0xb')]);router[_0xbd90('0x9')](_0xbd90('0xc'),auth['isAuthenticated'](),controller[_0xbd90('0xd')]);router[_0xbd90('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd90('0xf')]);router['post'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller['addConfiguration']);router[_0xbd90('0x10')](_0xbd90('0x11'),auth['isAuthenticated'](),controller[_0xbd90('0x12')]);router[_0xbd90('0x13')](_0xbd90('0x11'),auth[_0xbd90('0x8')](),controller[_0xbd90('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index dce631f..54f8abd 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 _0x77d1=['STRING','username','remoteUri','exports'];(function(_0x21be5f,_0x29b732){var _0x3d0828=function(_0x1541e5){while(--_0x1541e5){_0x21be5f['push'](_0x21be5f['shift']());}};_0x3d0828(++_0x29b732);}(_0x77d1,0x11b));var _0x177d=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x77d1[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require('sequelize');module[_0x177d('0x0')]={'name':{'type':Sequelize[_0x177d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x177d('0x1')],'unique':_0x177d('0x2')},'apiKey':{'type':Sequelize[_0x177d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x177d('0x3')},'serverUrl':{'type':Sequelize[_0x177d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x42cc=['exports','STRING','username','remoteUri','sequelize'];(function(_0x28240d,_0x419a72){var _0x52725f=function(_0x233aa0){while(--_0x233aa0){_0x28240d['push'](_0x28240d['shift']());}};_0x52725f(++_0x419a72);}(_0x42cc,0x194));var _0xc42c=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x42cc[_0x2431d6];return _0x4d0f9b;};'use strict';var Sequelize=require(_0xc42c('0x0'));module[_0xc42c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc42c('0x2')]},'username':{'type':Sequelize[_0xc42c('0x2')],'unique':_0xc42c('0x3')},'apiKey':{'type':Sequelize[_0xc42c('0x2')]},'remoteUri':{'type':Sequelize[_0xc42c('0x2')],'unique':_0xc42c('0x4')},'serverUrl':{'type':Sequelize[_0xc42c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 62d8d89..2b96d81 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(_0x566f95,_0x554d39){var _0x3e1bb4=function(_0x400eab){while(--_0x400eab){_0x566f95['push'](_0x566f95['shift']());}};_0x3e1bb4(++_0x554d39);}(_0x91a7,0xe7));var _0x791a=function(_0x20a746,_0x5c788c){_0x20a746=_0x20a746-0x0;var _0x5c260f=_0x91a7[_0x20a746];return _0x5c260f;};'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 _0x13f6=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','json','count','offset','limit','reject','save','update','destroy','name','send','index','map','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','findAll','rows','show','params','length','find','body','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshsalesField','username','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','getFields','test','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js'];(function(_0x1bad41,_0x76080f){var _0x101daa=function(_0x2e53b2){while(--_0x2e53b2){_0x1bad41['push'](_0x1bad41['shift']());}};_0x101daa(++_0x76080f);}(_0x13f6,0x124));var _0x613f=function(_0x1af91a,_0x308ab2){_0x1af91a=_0x1af91a-0x0;var _0x5c1fa6=_0x13f6[_0x1af91a];return _0x5c1fa6;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x13'));var db=require(_0x613f('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x613f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1ebab5,_0x3832d8,_0x375db1,_0x329fcf){return new BPromise(function(_0x4a6fc,_0x305894){var _0x291268=_0x329fcf||client;return _0x291268[_0x613f('0x16')](_0x1ebab5,_0x375db1)[_0x613f('0x17')](function(_0x548218){logger[_0x613f('0x18')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,'request\x20sent');logger[_0x613f('0x19')](_0x613f('0x1a'),_0x3832d8,'request\x20sent',JSON[_0x613f('0x1b')](_0x548218));if(_0x548218['error']){if(_0x548218[_0x613f('0x1c')][_0x613f('0x1d')]===0x1f4){logger[_0x613f('0x1c')](_0x613f('0x1e'),_0x3832d8,_0x548218[_0x613f('0x1c')][_0x613f('0x1f')]);return _0x305894(_0x548218['error']['message']);}logger[_0x613f('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,_0x548218['error'][_0x613f('0x1f')]);return _0x4a6fc(_0x548218[_0x613f('0x1c')]['message']);}else{logger[_0x613f('0x18')](_0x613f('0x1e'),_0x3832d8,_0x613f('0x20'));_0x4a6fc(_0x548218['result']['message']);}})[_0x613f('0x21')](function(_0x309437){logger[_0x613f('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,_0x309437);_0x305894(_0x309437);});});}function respondWithStatusCode(_0x41104e,_0x33e0c6){_0x33e0c6=_0x33e0c6||0xcc;return function(_0x30de90){if(_0x30de90){return _0x41104e[_0x613f('0x22')](_0x33e0c6);}return _0x41104e[_0x613f('0x23')](_0x33e0c6)['end']();};}function respondWithResult(_0x30fb15,_0x204185){_0x204185=_0x204185||0xc8;return function(_0x51bba1){if(_0x51bba1){return _0x30fb15[_0x613f('0x23')](_0x204185)[_0x613f('0x24')](_0x51bba1);}};}function respondWithFilteredResult(_0x32e747,_0x4a878d){return function(_0x53e32b){if(_0x53e32b){var _0x5a4a8b=_0x53e32b[_0x613f('0x25')],_0x379920=_0x4a878d['offset'],_0x594c28=_0x4a878d[_0x613f('0x26')]+_0x4a878d[_0x613f('0x27')],_0x412269;if(_0x594c28>=_0x5a4a8b){_0x594c28=_0x5a4a8b;_0x412269=0xc8;}else{_0x412269=0xce;}_0x32e747['status'](_0x412269);return _0x32e747['set']('Content-Range',_0x379920+'-'+_0x594c28+'/'+_0x5a4a8b)[_0x613f('0x24')](_0x53e32b);}return null;};}function patchUpdates(_0x7c1a94){return function(_0xcad8d6){try{jsonpatch['apply'](_0xcad8d6,_0x7c1a94,!![]);}catch(_0x23eda8){return BPromise[_0x613f('0x28')](_0x23eda8);}return _0xcad8d6[_0x613f('0x29')]();};}function saveUpdates(_0x19bb8f,_0x4f8500){return function(_0x31ccbd){if(_0x31ccbd){return _0x31ccbd[_0x613f('0x2a')](_0x19bb8f)[_0x613f('0x17')](function(_0x728f45){return _0x728f45;});}return null;};}function removeEntity(_0x10fa2b,_0x1664f1){return function(_0x5d7e9a){if(_0x5d7e9a){return _0x5d7e9a[_0x613f('0x2b')]()[_0x613f('0x17')](function(){_0x10fa2b[_0x613f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a1d1,_0x4af0de){return function(_0x3df7bf){if(!_0x3df7bf){_0x21a1d1[_0x613f('0x22')](0x194);}return _0x3df7bf;};}function handleError(_0xc8976c,_0x28c06c){_0x28c06c=_0x28c06c||0x1f4;return function(_0x2bceaa){logger[_0x613f('0x1c')](_0x2bceaa['stack']);if(_0x2bceaa[_0x613f('0x2c')]){delete _0x2bceaa[_0x613f('0x2c')];}_0xc8976c[_0x613f('0x23')](_0x28c06c)[_0x613f('0x2d')](_0x2bceaa);};}exports[_0x613f('0x2e')]=function(_0x47a9f6,_0x59236e){var _0x4eea2c={},_0x3d79f0={},_0x72c804={'count':0x0,'rows':[]};var _0x22074f=_[_0x613f('0x2f')](db['FreshsalesAccount'][_0x613f('0x30')],function(_0xaedbbd){return{'name':_0xaedbbd['fieldName'],'type':_0xaedbbd[_0x613f('0x31')]['key']};});_0x3d79f0[_0x613f('0x32')]=_['map'](_0x22074f,_0x613f('0x2c'));_0x3d79f0['query']=_[_0x613f('0x33')](_0x47a9f6[_0x613f('0x34')]);_0x3d79f0[_0x613f('0x35')]=_['intersection'](_0x3d79f0[_0x613f('0x32')],_0x3d79f0[_0x613f('0x34')]);_0x4eea2c[_0x613f('0x36')]=_[_0x613f('0x37')](_0x3d79f0[_0x613f('0x32')],qs[_0x613f('0x38')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x38')]));_0x4eea2c[_0x613f('0x36')]=_0x4eea2c[_0x613f('0x36')]['length']?_0x4eea2c[_0x613f('0x36')]:_0x3d79f0[_0x613f('0x32')];if(!_0x47a9f6[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x4eea2c[_0x613f('0x27')]=qs[_0x613f('0x27')](_0x47a9f6['query'][_0x613f('0x27')]);_0x4eea2c[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x26')]);}_0x4eea2c[_0x613f('0x3b')]=qs[_0x613f('0x3c')](_0x47a9f6['query'][_0x613f('0x3c')]);_0x4eea2c[_0x613f('0x3d')]=qs[_0x613f('0x35')](_[_0x613f('0x3e')](_0x47a9f6[_0x613f('0x34')],_0x3d79f0[_0x613f('0x35')]),_0x22074f);if(_0x47a9f6[_0x613f('0x34')][_0x613f('0x3f')]){_0x4eea2c[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x4eea2c[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x22074f,function(_0xdd4918){if(_0xdd4918['type']!==_0x613f('0x41')){var _0x121c91={};_0x121c91[_0xdd4918[_0x613f('0x2c')]]={'$like':'%'+_0x47a9f6[_0x613f('0x34')]['filter']+'%'};return _0x121c91;}})});}_0x4eea2c=_[_0x613f('0x40')]({},_0x4eea2c,_0x47a9f6[_0x613f('0x42')]);var _0x38aa12={'where':_0x4eea2c[_0x613f('0x3d')]};return db[_0x613f('0x43')][_0x613f('0x25')](_0x38aa12)[_0x613f('0x17')](function(_0x132745){_0x72c804[_0x613f('0x25')]=_0x132745;if(_0x47a9f6[_0x613f('0x34')]['includeAll']){_0x4eea2c['include']=[{'all':!![]}];}return db[_0x613f('0x43')][_0x613f('0x44')](_0x4eea2c);})['then'](function(_0x2ffa3c){_0x72c804[_0x613f('0x45')]=_0x2ffa3c;return _0x72c804;})[_0x613f('0x17')](respondWithFilteredResult(_0x59236e,_0x4eea2c))[_0x613f('0x21')](handleError(_0x59236e,null));};exports[_0x613f('0x46')]=function(_0x1c0b07,_0x412dd4){var _0x3a7f95={'raw':![],'where':{'id':_0x1c0b07[_0x613f('0x47')]['id']}},_0x3d938e={};_0x3d938e[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x43')][_0x613f('0x30')]);_0x3d938e[_0x613f('0x34')]=_[_0x613f('0x33')](_0x1c0b07[_0x613f('0x34')]);_0x3d938e[_0x613f('0x35')]=_['intersection'](_0x3d938e['model'],_0x3d938e[_0x613f('0x34')]);_0x3a7f95[_0x613f('0x36')]=_['intersection'](_0x3d938e['model'],qs[_0x613f('0x38')](_0x1c0b07['query']['fields']));_0x3a7f95[_0x613f('0x36')]=_0x3a7f95[_0x613f('0x36')][_0x613f('0x48')]?_0x3a7f95['attributes']:_0x3d938e[_0x613f('0x32')];if(_0x1c0b07[_0x613f('0x34')]['includeAll']){_0x3a7f95['include']=[{'all':!![]}];}_0x3a7f95=_[_0x613f('0x40')]({},_0x3a7f95,_0x1c0b07[_0x613f('0x42')]);return db[_0x613f('0x43')][_0x613f('0x49')](_0x3a7f95)[_0x613f('0x17')](handleEntityNotFound(_0x412dd4,null))[_0x613f('0x17')](respondWithResult(_0x412dd4,null))[_0x613f('0x21')](handleError(_0x412dd4,null));};exports['create']=function(_0x4c6096,_0x38d781){return db['FreshsalesAccount']['create'](_0x4c6096[_0x613f('0x4a')],{})[_0x613f('0x17')](respondWithResult(_0x38d781,0xc9))[_0x613f('0x21')](handleError(_0x38d781,null));};exports['update']=function(_0x27adac,_0x3ab684){if(_0x27adac[_0x613f('0x4a')]['id']){delete _0x27adac[_0x613f('0x4a')]['id'];}return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x27adac[_0x613f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ab684,null))[_0x613f('0x17')](saveUpdates(_0x27adac['body'],null))[_0x613f('0x17')](respondWithResult(_0x3ab684,null))[_0x613f('0x21')](handleError(_0x3ab684,null));};exports[_0x613f('0x2b')]=function(_0x3d1f1a,_0x5f1b88){return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x3d1f1a[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x5f1b88,null))[_0x613f('0x17')](removeEntity(_0x5f1b88,null))[_0x613f('0x21')](handleError(_0x5f1b88,null));};exports[_0x613f('0x4b')]=function(_0x43c238,_0x54ad8f,_0x4f316c){var _0x687e56={};var _0x4b6eb3={};var _0xcb1c9d;var _0x3c3cd7;return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x43c238[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x54ad8f,null))[_0x613f('0x17')](function(_0x3cc31b){if(_0x3cc31b){_0xcb1c9d=_0x3cc31b;_0x4b6eb3[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x4d')]['rawAttributes']);_0x4b6eb3[_0x613f('0x34')]=_[_0x613f('0x33')](_0x43c238[_0x613f('0x34')]);_0x4b6eb3[_0x613f('0x35')]=_['intersection'](_0x4b6eb3[_0x613f('0x32')],_0x4b6eb3[_0x613f('0x34')]);_0x687e56['attributes']=_['intersection'](_0x4b6eb3[_0x613f('0x32')],qs['fields'](_0x43c238['query']['fields']));_0x687e56[_0x613f('0x36')]=_0x687e56['attributes']['length']?_0x687e56['attributes']:_0x4b6eb3[_0x613f('0x32')];_0x687e56[_0x613f('0x3b')]=qs['sort'](_0x43c238[_0x613f('0x34')][_0x613f('0x3c')]);_0x687e56[_0x613f('0x3d')]=qs[_0x613f('0x35')](_['pick'](_0x43c238[_0x613f('0x34')],_0x4b6eb3[_0x613f('0x35')]));if(_0x43c238['query'][_0x613f('0x3f')]){_0x687e56[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x687e56[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x687e56[_0x613f('0x36')],function(_0xbead7c){var _0x130f54={};_0x130f54[_0xbead7c]={'$like':'%'+_0x43c238[_0x613f('0x34')][_0x613f('0x3f')]+'%'};return _0x130f54;})});}_0x687e56=_[_0x613f('0x40')]({},_0x687e56,_0x43c238[_0x613f('0x42')]);return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x428aab){if(_0x428aab){_0x3c3cd7=_0x428aab[_0x613f('0x48')];if(!_0x43c238[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x687e56['limit']=qs[_0x613f('0x27')](_0x43c238[_0x613f('0x34')][_0x613f('0x27')]);_0x687e56[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x43c238[_0x613f('0x34')]['offset']);}return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x25a550){if(_0x25a550){return _0x25a550?{'count':_0x3c3cd7,'rows':_0x25a550}:null;}})[_0x613f('0x17')](respondWithResult(_0x54ad8f,null))[_0x613f('0x21')](handleError(_0x54ad8f,null));};exports['addConfiguration']=function(_0x11d2f4,_0x29e5c8,_0x3d8777){if(_0x11d2f4[_0x613f('0x4a')]['id']){delete _0x11d2f4['body']['id'];}return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x11d2f4[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x29e5c8,null))[_0x613f('0x17')](function(_0x45e933){if(_0x45e933){_0x11d2f4[_0x613f('0x4a')][_0x613f('0x4e')]=_0x45e933['id'];_0x11d2f4['body'][_0x613f('0x4f')]=integrations[_0x613f('0x50')](_0x11d2f4[_0x613f('0x4a')][_0x613f('0x51')],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);_0x11d2f4[_0x613f('0x4a')][_0x613f('0x52')]=integrations[_0x613f('0x53')](_0x11d2f4[_0x613f('0x4a')]['channel'],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);return db[_0x613f('0x4d')][_0x613f('0x54')](_0x11d2f4[_0x613f('0x4a')],{'include':[{'model':db[_0x613f('0x55')],'as':_0x613f('0x4f')},{'model':db[_0x613f('0x55')],'as':_0x613f('0x52')}]});}return null;})[_0x613f('0x17')](respondWithResult(_0x29e5c8,null))[_0x613f('0x21')](handleError(_0x29e5c8,null));};exports['getFields']=function(_0xb36b52,_0x1739ac,_0x2bfb0a){var _0x907273='';var _0x205957='';return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0xb36b52[_0x613f('0x47')]['id']},'attributes':['id',_0x613f('0x56'),_0x613f('0x57'),_0x613f('0x58')]})[_0x613f('0x17')](handleEntityNotFound(_0x1739ac,null))['then'](function(_0x30c62f){if(_0x30c62f){_0x205957=_0x30c62f[_0x613f('0x56')];_0x907273=_0x30c62f['remoteUri'];var _0xb4ad75=_0x30c62f['remoteUri'][_0x613f('0x59')](-0x1);if(_0xb4ad75==='/'){_0x907273=_0x907273['substring'](0x0,_0x907273['lastIndexOf'](_0xb4ad75));}return rp({'method':_0x613f('0x5a'),'uri':util[_0x613f('0x5b')](_0x613f('0x5c'),_0x907273,_0x613f('0x5d')),'headers':{'Authorization':_0x613f('0x5e')+_0x30c62f[_0x613f('0x58')]},'json':!![]});}})[_0x613f('0x17')](function(_0x5be071){if(_0x5be071){var _0x1f2179=_0x5be071[_0x613f('0x5f')];var _0x438bfd=![];var _0x2bc172=null;for(_0x2bc172=0x0;_0x2bc172<_0x1f2179[_0x613f('0x48')];_0x2bc172++){if(_0x1f2179[_0x2bc172]['email']===_0x205957){_0x438bfd=!![];}}if(_0x438bfd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x613f('0x60')});}}})[_0x613f('0x17')](respondWithResult(_0x1739ac,null))['catch'](function(_0x188be6){var _0x8073b2=_0xb36b52[_0x613f('0x34')]['test']?0x1f4:_0x188be6['statusCode']||0x1f4;logger['error'](_0x613f('0x61'),_0x613f('0x62'),_0x8073b2,JSON['stringify'](_0x188be6));delete _0x188be6[_0x613f('0x2c')];if(_0x8073b2===0x191){_0x8073b2=0x190;}_0x1739ac[_0x613f('0x23')](_0x8073b2)[_0x613f('0x2d')](_0xb36b52['query'][_0x613f('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x188be6[_0x613f('0x64')]}:_0x188be6);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ee46bbb..c58826a 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 _0x7008=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7008,0x185));var _0x8700=function(_0x25c94e,_0x43c132){_0x25c94e=_0x25c94e-0x0;var _0x343ca1=_0x7008[_0x25c94e];return _0x343ca1;};'use strict';var _=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var logger=require(_0x8700('0x2'))(_0x8700('0x3'));var moment=require('moment');var BPromise=require(_0x8700('0x4'));var rp=require(_0x8700('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8700('0x6'));var config=require(_0x8700('0x7'));var attributes=require(_0x8700('0x8'));var integrations=require(_0x8700('0x9'));module[_0x8700('0xa')]=function(_0xf9a514,_0x9ed4c0){return _0xf9a514['define'](_0x8700('0xb'),attributes,{'tableName':_0x8700('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b95=['int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x5d06a6,_0x416bd5){var _0x283be1=function(_0xecc858){while(--_0xecc858){_0x5d06a6['push'](_0x5d06a6['shift']());}};_0x283be1(++_0x416bd5);}(_0x0b95,0x198));var _0x50b9=function(_0xf400dc,_0x55a516){_0xf400dc=_0xf400dc-0x0;var _0x21ab6a=_0x0b95[_0xf400dc];return _0x21ab6a;};'use strict';var _=require('lodash');var util=require(_0x50b9('0x0'));var logger=require(_0x50b9('0x1'))(_0x50b9('0x2'));var moment=require(_0x50b9('0x3'));var BPromise=require(_0x50b9('0x4'));var rp=require(_0x50b9('0x5'));var fs=require('fs');var path=require(_0x50b9('0x6'));var rimraf=require(_0x50b9('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x50b9('0x8')]=function(_0x19f3af,_0x892061){return _0x19f3af[_0x50b9('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x50b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 083d2c4..436314c 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 _0x2faf=['jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','model','map','attributes','catch','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var moment=require(_0xf2fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2fa('0x3'));var fs=require('fs');var Redis=require(_0xf2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2fa('0x5'));var logger=require(_0xf2fa('0x6'))(_0xf2fa('0x7'));var config=require(_0xf2fa('0x8'));var jayson=require(_0xf2fa('0x9'));var client=jayson[_0xf2fa('0xa')][_0xf2fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c7035,_0x2fcd02,_0x3287ac){return new BPromise(function(_0x28ca24,_0x19ce5a){return client['request'](_0x4c7035,_0x3287ac)[_0xf2fa('0xc')](function(_0x530819){logger[_0xf2fa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));logger[_0xf2fa('0xf')](_0xf2fa('0x10'),_0x2fcd02,_0xf2fa('0xe'),JSON[_0xf2fa('0x11')](_0x530819));if(_0x530819[_0xf2fa('0x12')]){if(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x13')]===0x1f4){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819['error'][_0xf2fa('0x15')]);return _0x19ce5a(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);}logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);return _0x28ca24(_0x530819[_0xf2fa('0x12')]['message']);}else{logger[_0xf2fa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));_0x28ca24(_0x530819[_0xf2fa('0x16')]['message']);}})['catch'](function(_0x1db062){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x1db062);_0x19ce5a(_0x1db062);});});}exports[_0xf2fa('0x17')]=function(_0x2b8f69){var _0x2d0d36=this;return new Promise(function(_0x551b3d,_0x41e4f3){return db[_0xf2fa('0x18')][_0xf2fa('0x19')]({'raw':_0x2b8f69['options']?_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1c')]||null:null,'attributes':_0x2b8f69['options']?_0x2b8f69['options']['attributes']||null:null,'limit':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69['options'][_0xf2fa('0x1d')]||null:null,'include':_0x2b8f69[_0xf2fa('0x1a')]?_0x2b8f69['options']['include']?_['map'](_0x2b8f69[_0xf2fa('0x1a')][_0xf2fa('0x1e')],function(_0x2b753e){return{'model':db[_0x2b753e[_0xf2fa('0x1f')]],'as':_0x2b753e['as'],'attributes':_0x2b753e['attributes'],'include':_0x2b753e['include']?_[_0xf2fa('0x20')](_0x2b753e['include'],function(_0x557631){return{'model':db[_0x557631['model']],'as':_0x557631['as'],'attributes':_0x557631[_0xf2fa('0x21')],'include':_0x557631['include']?_['map'](_0x557631[_0xf2fa('0x1e')],function(_0x5553fa){return{'model':db[_0x5553fa[_0xf2fa('0x1f')]],'as':_0x5553fa['as'],'attributes':_0x5553fa[_0xf2fa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf2fa('0xc')](function(_0x47d295){logger['info'](_0xf2fa('0x17'),_0x2b8f69);logger['debug'](_0xf2fa('0x17'),_0x2b8f69,JSON[_0xf2fa('0x11')](_0x47d295));_0x551b3d(_0x47d295);})[_0xf2fa('0x22')](function(_0x3e631d){logger['error'](_0xf2fa('0x17'),_0x3e631d[_0xf2fa('0x15')],_0x2b8f69);_0x41e4f3(_0x2d0d36[_0xf2fa('0x12')](0x1f4,_0x3e631d['message']));});});};exports[_0xf2fa('0x23')]=function(_0x44075f){var _0x3b29ee=this;return new Promise(function(_0x41b057,_0x3a8c3a){return db[_0xf2fa('0x18')][_0xf2fa('0x24')]({'raw':_0x44075f[_0xf2fa('0x1a')]?_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x1b')]===undefined?!![]:![]:!![],'where':_0x44075f['options']?_0x44075f['options'][_0xf2fa('0x1c')]||null:null,'attributes':_0x44075f[_0xf2fa('0x1a')]?_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x21')]||null:null,'include':_0x44075f[_0xf2fa('0x1a')]?_0x44075f['options']['include']?_[_0xf2fa('0x20')](_0x44075f[_0xf2fa('0x1a')][_0xf2fa('0x1e')],function(_0x167b91){return{'model':db[_0x167b91[_0xf2fa('0x1f')]],'as':_0x167b91['as'],'attributes':_0x167b91[_0xf2fa('0x21')],'include':_0x167b91['include']?_[_0xf2fa('0x20')](_0x167b91['include'],function(_0x8bb016){return{'model':db[_0x8bb016[_0xf2fa('0x1f')]],'as':_0x8bb016['as'],'attributes':_0x8bb016[_0xf2fa('0x21')],'include':_0x8bb016[_0xf2fa('0x1e')]?_[_0xf2fa('0x20')](_0x8bb016[_0xf2fa('0x1e')],function(_0x26033e){return{'model':db[_0x26033e[_0xf2fa('0x1f')]],'as':_0x26033e['as'],'attributes':_0x26033e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf2fa('0xc')](function(_0x4b9c33){logger[_0xf2fa('0xd')](_0xf2fa('0x23'),_0x44075f);logger[_0xf2fa('0xf')]('ShowFreshsalesAccount',_0x44075f,JSON['stringify'](_0x4b9c33));_0x41b057(_0x4b9c33);})[_0xf2fa('0x22')](function(_0x58277e){logger[_0xf2fa('0x12')](_0xf2fa('0x23'),_0x58277e[_0xf2fa('0x15')],_0x44075f);_0x3a8c3a(_0x3b29ee[_0xf2fa('0x12')](0x1f4,_0x58277e[_0xf2fa('0x15')]));});});}; \ No newline at end of file +var _0xac35=['raw','where','attributes','limit','include','model','debug','ShowFreshsalesAccount','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x512a56,_0x4aa4af){var _0x342a8e=function(_0x835dc9){while(--_0x835dc9){_0x512a56['push'](_0x512a56['shift']());}};_0x342a8e(++_0x4aa4af);}(_0xac35,0x141));var _0x5ac3=function(_0x5b4f60,_0x2158ac){_0x5b4f60=_0x5b4f60-0x0;var _0x4c967a=_0xac35[_0x5b4f60];return _0x4c967a;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});}exports[_0x5ac3('0x1a')]=function(_0x1c2566){var _0x200eca=this;return new Promise(function(_0x141128,_0x5aab00){return db[_0x5ac3('0x1b')][_0x5ac3('0x1c')]({'raw':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1f')]||null:null,'attributes':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x20')]||null:null,'limit':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566['options'][_0x5ac3('0x21')]||null:null,'include':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_['map'](_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')],function(_0x2aa7c9){return{'model':db[_0x2aa7c9[_0x5ac3('0x23')]],'as':_0x2aa7c9['as'],'attributes':_0x2aa7c9['attributes'],'include':_0x2aa7c9[_0x5ac3('0x22')]?_['map'](_0x2aa7c9[_0x5ac3('0x22')],function(_0x481a72){return{'model':db[_0x481a72['model']],'as':_0x481a72['as'],'attributes':_0x481a72[_0x5ac3('0x20')],'include':_0x481a72[_0x5ac3('0x22')]?_['map'](_0x481a72[_0x5ac3('0x22')],function(_0x3912f6){return{'model':db[_0x3912f6[_0x5ac3('0x23')]],'as':_0x3912f6['as'],'attributes':_0x3912f6[_0x5ac3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452519){logger[_0x5ac3('0x10')](_0x5ac3('0x1a'),_0x1c2566);logger[_0x5ac3('0x24')](_0x5ac3('0x1a'),_0x1c2566,JSON[_0x5ac3('0x13')](_0x452519));_0x141128(_0x452519);})[_0x5ac3('0x19')](function(_0x5a1486){logger[_0x5ac3('0x14')](_0x5ac3('0x1a'),_0x5a1486[_0x5ac3('0x16')],_0x1c2566);_0x5aab00(_0x200eca['error'](0x1f4,_0x5a1486[_0x5ac3('0x16')]));});});};exports[_0x5ac3('0x25')]=function(_0x28c96e){var _0x5df562=this;return new Promise(function(_0x194c52,_0x484012){return db[_0x5ac3('0x1b')]['find']({'raw':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28c96e['options']?_0x28c96e['options'][_0x5ac3('0x1f')]||null:null,'attributes':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e['options'][_0x5ac3('0x20')]||null:null,'include':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_[_0x5ac3('0x26')](_0x28c96e[_0x5ac3('0x1d')]['include'],function(_0x4552ab){return{'model':db[_0x4552ab[_0x5ac3('0x23')]],'as':_0x4552ab['as'],'attributes':_0x4552ab[_0x5ac3('0x20')],'include':_0x4552ab[_0x5ac3('0x22')]?_['map'](_0x4552ab['include'],function(_0x3466ef){return{'model':db[_0x3466ef['model']],'as':_0x3466ef['as'],'attributes':_0x3466ef[_0x5ac3('0x20')],'include':_0x3466ef[_0x5ac3('0x22')]?_['map'](_0x3466ef[_0x5ac3('0x22')],function(_0x4e68ea){return{'model':db[_0x4e68ea[_0x5ac3('0x23')]],'as':_0x4e68ea['as'],'attributes':_0x4e68ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21271a){logger[_0x5ac3('0x10')](_0x5ac3('0x25'),_0x28c96e);logger[_0x5ac3('0x24')]('ShowFreshsalesAccount',_0x28c96e,JSON[_0x5ac3('0x13')](_0x21271a));_0x194c52(_0x21271a);})['catch'](function(_0xbefb42){logger[_0x5ac3('0x14')](_0x5ac3('0x25'),_0xbefb42[_0x5ac3('0x16')],_0x28c96e);_0x484012(_0x5df562[_0x5ac3('0x14')](0x1f4,_0xbefb42['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d8d3e9d..8c53a29 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 _0xf554=['get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x24f8ea,_0x582561){var _0x387c81=function(_0x4fbe56){while(--_0x4fbe56){_0x24f8ea['push'](_0x24f8ea['shift']());}};_0x387c81(++_0x582561);}(_0xf554,0xa1));var _0x4f55=function(_0x5c4673,_0x3362df){_0x5c4673=_0x5c4673-0x0;var _0x2ecba4=_0xf554[_0x5c4673];return _0x2ecba4;};'use strict';var multer=require(_0x4f55('0x0'));var util=require(_0x4f55('0x1'));var path=require(_0x4f55('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f55('0x3'));var router=express[_0x4f55('0x4')]();var auth=require(_0x4f55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4f55('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x4f55('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f55('0x8')]);router[_0x4f55('0x7')](_0x4f55('0x9'),auth[_0x4f55('0xa')](),controller[_0x4f55('0xb')]);router['get'](_0x4f55('0xc'),auth[_0x4f55('0xa')](),controller[_0x4f55('0xd')]);router[_0x4f55('0x7')](_0x4f55('0xe'),auth[_0x4f55('0xa')](),controller['getDescriptions']);router[_0x4f55('0x7')](_0x4f55('0xf'),auth[_0x4f55('0xa')](),controller['getFields']);router[_0x4f55('0x10')]('/',auth[_0x4f55('0xa')](),controller['create']);router['put'](_0x4f55('0x9'),auth[_0x4f55('0xa')](),controller[_0x4f55('0x11')]);router[_0x4f55('0x12')]('/:id',auth[_0x4f55('0xa')](),controller[_0x4f55('0x13')]);module[_0x4f55('0x14')]=router; \ No newline at end of file +var _0x4f5f=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','/:id','destroy','exports','util','path','express','../../components/auth/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4f5f,0xec));var _0xf4f5=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4f5f[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require(_0xf4f5('0x0'));var path=require(_0xf4f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4f5('0x2'));var router=express['Router']();var auth=require(_0xf4f5('0x3'));var interaction=require(_0xf4f5('0x4'));var config=require(_0xf4f5('0x5'));var controller=require(_0xf4f5('0x6'));router[_0xf4f5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf4f5('0x7')]('/:id',auth[_0xf4f5('0x8')](),controller[_0xf4f5('0x9')]);router[_0xf4f5('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf4f5('0xa')]);router[_0xf4f5('0x7')](_0xf4f5('0xb'),auth['isAuthenticated'](),controller[_0xf4f5('0xc')]);router[_0xf4f5('0x7')](_0xf4f5('0xd'),auth[_0xf4f5('0x8')](),controller[_0xf4f5('0xe')]);router['post']('/',auth[_0xf4f5('0x8')](),controller[_0xf4f5('0xf')]);router[_0xf4f5('0x10')](_0xf4f5('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf4f5('0x11'),auth[_0xf4f5('0x8')](),controller[_0xf4f5('0x12')]);module[_0xf4f5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fbae5aa..b1099f3 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 _0x3667=['STRING'];(function(_0x28d8c6,_0x1e55d2){var _0x3353ad=function(_0x3b05e0){while(--_0x3b05e0){_0x28d8c6['push'](_0x28d8c6['shift']());}};_0x3353ad(++_0x1e55d2);}(_0x3667,0xf4));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7366('0x0')]},'description':{'type':Sequelize[_0x7366('0x0')]}}; \ No newline at end of file +var _0x68c3=['STRING','sequelize','exports'];(function(_0xc5ebeb,_0x1cff69){var _0x1e90a9=function(_0x1050ed){while(--_0x1050ed){_0xc5ebeb['push'](_0xc5ebeb['shift']());}};_0x1e90a9(++_0x1cff69);}(_0x68c3,0x193));var _0x368c=function(_0x27dc75,_0x10560b){_0x27dc75=_0x27dc75-0x0;var _0x316106=_0x68c3[_0x27dc75];return _0x316106;};'use strict';var Sequelize=require(_0x368c('0x0'));module[_0x368c('0x1')]={'name':{'type':Sequelize[_0x368c('0x2')]},'description':{'type':Sequelize[_0x368c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a42b665..e967b2d 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['FreshsalesField','length','hasOwnProperty','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','attributes','intersection','fields','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fab,0x177));var _0xb5fa=function(_0x852450,_0xd2456e){_0x852450=_0x852450-0x0;var _0x329404=_0x5fab[_0x852450];return _0x329404;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=_0x568870[_0xb5fa('0x2a')],_0x5bdf11=_0x20d649[_0xb5fa('0x2b')],_0x5a1c39=_0x20d649[_0xb5fa('0x2b')]+_0x20d649[_0xb5fa('0x2c')],_0x28a350;if(_0x5a1c39>=_0x4ec294){_0x5a1c39=_0x4ec294;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x28a350);return _0x6a455c[_0xb5fa('0x2d')](_0xb5fa('0x2e'),_0x5bdf11+'-'+_0x5a1c39+'/'+_0x4ec294)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x2a5690){return function(_0x142bfa){try{jsonpatch[_0xb5fa('0x2f')](_0x142bfa,_0x2a5690,!![]);}catch(_0xab5427){return BPromise[_0xb5fa('0x30')](_0xab5427);}return _0x142bfa[_0xb5fa('0x31')]();};}function saveUpdates(_0x116773,_0x5a0152){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0xb5fa('0x32')](_0x116773)[_0xb5fa('0x33')](function(_0x291938){return _0x291938;});}return null;};}function removeEntity(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['destroy']()[_0xb5fa('0x33')](function(){_0x370d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558708,_0x1e6ba0){return function(_0x502d57){if(!_0x502d57){_0x558708[_0xb5fa('0x26')](0x194);}return _0x502d57;};}function handleError(_0x5876f1,_0x5518b1){_0x5518b1=_0x5518b1||0x1f4;return function(_0x1847bc){logger[_0xb5fa('0x22')](_0x1847bc['stack']);if(_0x1847bc['name']){delete _0x1847bc[_0xb5fa('0x34')];}_0x5876f1[_0xb5fa('0x28')](_0x5518b1)[_0xb5fa('0x35')](_0x1847bc);};}exports['index']=function(_0xc9adee,_0xc28a80){var _0x4a7137={},_0x18398f={},_0x2056de={'count':0x0,'rows':[]};var _0x204d6b=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x24ef11){return{'name':_0x24ef11['fieldName'],'type':_0x24ef11[_0xb5fa('0x38')][_0xb5fa('0x39')]};});_0x18398f[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x204d6b,'name');_0x18398f['query']=_['keys'](_0xc9adee['query']);_0x18398f['filters']=_['intersection'](_0x18398f[_0xb5fa('0x3a')],_0x18398f['query']);_0x4a7137[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x18398f[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x4a7137['attributes']=_0x4a7137['attributes']['length']?_0x4a7137[_0xb5fa('0x3c')]:_0x18398f['model'];if(!_0xc9adee[_0xb5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a7137[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x4a7137[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}_0x4a7137[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0xc9adee['query'][_0xb5fa('0x41')]);_0x4a7137['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0xc9adee[_0xb5fa('0x3f')],_0x18398f[_0xb5fa('0x42')]),_0x204d6b);if(_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x4a7137[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x4a7137['where'],{'$or':_[_0xb5fa('0x3b')](_0x204d6b,function(_0xc03e44){if(_0xc03e44['type']!==_0xb5fa('0x47')){var _0x5a6ae3={};_0x5a6ae3[_0xc03e44[_0xb5fa('0x34')]]={'$like':'%'+_0xc9adee[_0xb5fa('0x3f')]['filter']+'%'};return _0x5a6ae3;}})});}_0x4a7137=_['merge']({},_0x4a7137,_0xc9adee[_0xb5fa('0x48')]);var _0xe86e11={'where':_0x4a7137[_0xb5fa('0x45')]};return db[_0xb5fa('0x36')][_0xb5fa('0x2a')](_0xe86e11)[_0xb5fa('0x33')](function(_0x10f354){_0x2056de[_0xb5fa('0x2a')]=_0x10f354;if(_0xc9adee['query'][_0xb5fa('0x49')]){_0x4a7137[_0xb5fa('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb5fa('0x4b')](_0x4a7137);})[_0xb5fa('0x33')](function(_0x247999){_0x2056de[_0xb5fa('0x4c')]=_0x247999;return _0x2056de;})[_0xb5fa('0x33')](respondWithFilteredResult(_0xc28a80,_0x4a7137))[_0xb5fa('0x25')](handleError(_0xc28a80,null));};exports[_0xb5fa('0x4d')]=function(_0x33eb2c,_0x20f5f5){var _0x464e36={'raw':![],'where':{'id':_0x33eb2c[_0xb5fa('0x4e')]['id']}},_0xfe091={};_0xfe091[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0xfe091['query']=_['keys'](_0x33eb2c[_0xb5fa('0x3f')]);_0xfe091['filters']=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],_0xfe091['query']);_0x464e36[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x33eb2c[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x464e36['attributes']=_0x464e36[_0xb5fa('0x3c')]['length']?_0x464e36[_0xb5fa('0x3c')]:_0xfe091[_0xb5fa('0x3a')];if(_0x33eb2c[_0xb5fa('0x3f')]['includeAll']){_0x464e36[_0xb5fa('0x4a')]=[{'all':!![]}];}_0x464e36=_[_0xb5fa('0x46')]({},_0x464e36,_0x33eb2c['options']);return db['FreshsalesConfiguration'][_0xb5fa('0x50')](_0x464e36)[_0xb5fa('0x33')](handleEntityNotFound(_0x20f5f5,null))[_0xb5fa('0x33')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x25')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x51')]=function(_0x7775b4,_0x31c91f){return db[_0xb5fa('0x36')][_0xb5fa('0x51')](_0x7775b4[_0xb5fa('0x52')],{})[_0xb5fa('0x33')](respondWithResult(_0x31c91f,0xc9))[_0xb5fa('0x25')](handleError(_0x31c91f,null));};exports[_0xb5fa('0x32')]=function(_0x2799e7,_0x23f235){if(_0x2799e7[_0xb5fa('0x52')]['id']){delete _0x2799e7[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x2799e7[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x23f235,null))[_0xb5fa('0x33')](saveUpdates(_0x2799e7[_0xb5fa('0x52')],null))[_0xb5fa('0x33')](respondWithResult(_0x23f235,null))[_0xb5fa('0x25')](handleError(_0x23f235,null));};exports[_0xb5fa('0x53')]=function(_0x24117e,_0x1cb39e){return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x24117e['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1cb39e,null))[_0xb5fa('0x33')](removeEntity(_0x1cb39e,null))[_0xb5fa('0x25')](handleError(_0x1cb39e,null));};exports['getSubjects']=function(_0x441c41,_0x367f7a,_0x1572fb){var _0x2e855c={};var _0x31ab22={};var _0x9d12f1;var _0x2e7286;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x441c41[_0xb5fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x367f7a,null))[_0xb5fa('0x33')](function(_0x26bc03){if(_0x26bc03){_0x9d12f1=_0x26bc03;_0x31ab22['model']=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x31ab22[_0xb5fa('0x3f')]=_[_0xb5fa('0x4f')](_0x441c41[_0xb5fa('0x3f')]);_0x31ab22[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],_0x31ab22[_0xb5fa('0x3f')]);_0x2e855c[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x2e855c[_0xb5fa('0x3c')]=_0x2e855c[_0xb5fa('0x3c')][_0xb5fa('0x56')]?_0x2e855c[_0xb5fa('0x3c')]:_0x31ab22[_0xb5fa('0x3a')];_0x2e855c[_0xb5fa('0x40')]=qs['sort'](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x41')]);_0x2e855c[_0xb5fa('0x45')]=qs['filters'](_[_0xb5fa('0x43')](_0x441c41[_0xb5fa('0x3f')],_0x31ab22['filters']));if(_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x2e855c[_0xb5fa('0x45')]=_['merge'](_0x2e855c['where'],{'$or':_[_0xb5fa('0x3b')](_0x2e855c[_0xb5fa('0x3c')],function(_0x432f04){var _0x57d8b7={};_0x57d8b7[_0x432f04]={'$like':'%'+_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x57d8b7;})});}_0x2e855c=_[_0xb5fa('0x46')]({},_0x2e855c,_0x441c41[_0xb5fa('0x48')]);return _0x9d12f1['getSubjects'](_0x2e855c);}})['then'](function(_0x5cec07){if(_0x5cec07){_0x2e7286=_0x5cec07[_0xb5fa('0x56')];if(!_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x57')]('nolimit')){_0x2e855c[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x2e855c[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x9d12f1[_0xb5fa('0x58')](_0x2e855c);}})[_0xb5fa('0x33')](function(_0x3a1db9){if(_0x3a1db9){return _0x3a1db9?{'count':_0x2e7286,'rows':_0x3a1db9}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x367f7a,null))[_0xb5fa('0x25')](handleError(_0x367f7a,null));};exports[_0xb5fa('0x59')]=function(_0x41127a,_0x5eeaa1,_0xf173e4){var _0x5a6f74={};var _0x47193c={};var _0x209213;var _0x37975d;return db[_0xb5fa('0x36')][_0xb5fa('0x54')]({'where':{'id':_0x41127a['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5eeaa1,null))['then'](function(_0x77a831){if(_0x77a831){_0x209213=_0x77a831;_0x47193c[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')]['rawAttributes']);_0x47193c['query']=_['keys'](_0x41127a[_0xb5fa('0x3f')]);_0x47193c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x47193c[_0xb5fa('0x3a')],_0x47193c[_0xb5fa('0x3f')]);_0x5a6f74[_0xb5fa('0x3c')]=_['intersection'](_0x47193c[_0xb5fa('0x3a')],qs['fields'](_0x41127a['query'][_0xb5fa('0x3e')]));_0x5a6f74['attributes']=_0x5a6f74['attributes']['length']?_0x5a6f74[_0xb5fa('0x3c')]:_0x47193c['model'];_0x5a6f74[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x41127a[_0xb5fa('0x3f')]['sort']);_0x5a6f74['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0x41127a['query'],_0x47193c[_0xb5fa('0x42')]));if(_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x5a6f74[_0xb5fa('0x45')]=_['merge'](_0x5a6f74[_0xb5fa('0x45')],{'$or':_[_0xb5fa('0x3b')](_0x5a6f74[_0xb5fa('0x3c')],function(_0x180e63){var _0x1c0f49={};_0x1c0f49[_0x180e63]={'$like':'%'+_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x1c0f49;})});}_0x5a6f74=_['merge']({},_0x5a6f74,_0x41127a[_0xb5fa('0x48')]);return _0x209213['getDescriptions'](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x45790c){if(_0x45790c){_0x37975d=_0x45790c['length'];if(!_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x5a6f74[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x5a6f74[_0xb5fa('0x2b')]=qs['offset'](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x209213[_0xb5fa('0x59')](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x53095e){if(_0x53095e){return _0x53095e?{'count':_0x37975d,'rows':_0x53095e}:null;}})['then'](respondWithResult(_0x5eeaa1,null))['catch'](handleError(_0x5eeaa1,null));};exports['getFields']=function(_0x1c60bd,_0x1e607b,_0xff504d){var _0x188e66={};var _0x599a7c={};var _0x551822;var _0x148cb4;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x1c60bd[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1e607b,null))[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){_0x551822=_0x577aef;_0x599a7c[_0xb5fa('0x3a')]=_['keys'](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x599a7c['query']=_['keys'](_0x1c60bd[_0xb5fa('0x3f')]);_0x599a7c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],_0x599a7c[_0xb5fa('0x3f')]);_0x188e66[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x188e66[_0xb5fa('0x3c')]=_0x188e66[_0xb5fa('0x3c')]['length']?_0x188e66['attributes']:_0x599a7c[_0xb5fa('0x3a')];_0x188e66['order']=qs[_0xb5fa('0x41')](_0x1c60bd[_0xb5fa('0x3f')]['sort']);_0x188e66[_0xb5fa('0x45')]=qs[_0xb5fa('0x42')](_['pick'](_0x1c60bd[_0xb5fa('0x3f')],_0x599a7c[_0xb5fa('0x42')]));if(_0x1c60bd['query'][_0xb5fa('0x44')]){_0x188e66[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x188e66['where'],{'$or':_['map'](_0x188e66[_0xb5fa('0x3c')],function(_0x1a24a2){var _0x3b5e1d={};_0x3b5e1d[_0x1a24a2]={'$like':'%'+_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x3b5e1d;})});}_0x188e66=_[_0xb5fa('0x46')]({},_0x188e66,_0x1c60bd[_0xb5fa('0x48')]);return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x1a4465){if(_0x1a4465){_0x148cb4=_0x1a4465['length'];if(!_0x1c60bd['query'][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x188e66[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x1c60bd['query'][_0xb5fa('0x2c')]);_0x188e66[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x1c60bd['query'][_0xb5fa('0x2b')]);}return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x301d14){if(_0x301d14){return _0x301d14?{'count':_0x148cb4,'rows':_0x301d14}:null;}})['then'](respondWithResult(_0x1e607b,null))[_0xb5fa('0x25')](handleError(_0x1e607b,null));}; \ No newline at end of file +var _0x4975=['limit','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','includeAll','find','create','update','body','destroy','FreshsalesConfiguration','getSubjects','findOne','FreshsalesField','order','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json'];(function(_0x130a16,_0x454766){var _0x189496=function(_0x15792b){while(--_0x15792b){_0x130a16['push'](_0x130a16['shift']());}};_0x189496(++_0x454766);}(_0x4975,0x86));var _0x5497=function(_0x577f4c,_0x23788c){_0x577f4c=_0x577f4c-0x0;var _0x2cc3f1=_0x4975[_0x577f4c];return _0x2cc3f1;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];var jayson=require(_0x5497('0x19'));var client=jayson[_0x5497('0x1a')][_0x5497('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x747dc7,_0x365144,_0x1f7169,_0xaca97d){return new BPromise(function(_0x363a5b,_0x1a4c74){var _0x55f590=_0xaca97d||client;return _0x55f590[_0x5497('0x1c')](_0x747dc7,_0x1f7169)['then'](function(_0x4237a9){logger[_0x5497('0x1d')](_0x5497('0x1e'),_0x365144,_0x5497('0x1f'));logger[_0x5497('0x20')](_0x5497('0x21'),_0x365144,_0x5497('0x1f'),JSON['stringify'](_0x4237a9));if(_0x4237a9['error']){if(_0x4237a9[_0x5497('0x22')][_0x5497('0x23')]===0x1f4){logger[_0x5497('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x1a4c74(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x363a5b(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}else{logger[_0x5497('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x5497('0x1f'));_0x363a5b(_0x4237a9['result'][_0x5497('0x24')]);}})[_0x5497('0x25')](function(_0x44265c){logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x44265c);_0x1a4c74(_0x44265c);});});}function respondWithStatusCode(_0x3b2fbc,_0x5018fa){_0x5018fa=_0x5018fa||0xcc;return function(_0x54043a){if(_0x54043a){return _0x3b2fbc[_0x5497('0x26')](_0x5018fa);}return _0x3b2fbc[_0x5497('0x27')](_0x5018fa)[_0x5497('0x28')]();};}function respondWithResult(_0x281155,_0x5223b5){_0x5223b5=_0x5223b5||0xc8;return function(_0x13b7a4){if(_0x13b7a4){return _0x281155['status'](_0x5223b5)[_0x5497('0x29')](_0x13b7a4);}};}function respondWithFilteredResult(_0x16a2b4,_0x429d36){return function(_0x34a1a5){if(_0x34a1a5){var _0x163a30=_0x34a1a5['count'],_0x31cd01=_0x429d36['offset'],_0x48b835=_0x429d36['offset']+_0x429d36[_0x5497('0x2a')],_0x4af5f4;if(_0x48b835>=_0x163a30){_0x48b835=_0x163a30;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x16a2b4['status'](_0x4af5f4);return _0x16a2b4['set'](_0x5497('0x2b'),_0x31cd01+'-'+_0x48b835+'/'+_0x163a30)[_0x5497('0x29')](_0x34a1a5);}return null;};}function patchUpdates(_0x1cf908){return function(_0x4c442a){try{jsonpatch['apply'](_0x4c442a,_0x1cf908,!![]);}catch(_0x58230b){return BPromise[_0x5497('0x2c')](_0x58230b);}return _0x4c442a[_0x5497('0x2d')]();};}function saveUpdates(_0xf4c117,_0x5b8f79){return function(_0x489f71){if(_0x489f71){return _0x489f71['update'](_0xf4c117)[_0x5497('0x2e')](function(_0x572460){return _0x572460;});}return null;};}function removeEntity(_0x438ee4,_0x258c2d){return function(_0x77c575){if(_0x77c575){return _0x77c575['destroy']()[_0x5497('0x2e')](function(){_0x438ee4[_0x5497('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce7cb2,_0xce2e81){return function(_0x331dfc){if(!_0x331dfc){_0xce7cb2['sendStatus'](0x194);}return _0x331dfc;};}function handleError(_0x3395f6,_0x2fe1f2){_0x2fe1f2=_0x2fe1f2||0x1f4;return function(_0x125d51){logger[_0x5497('0x22')](_0x125d51[_0x5497('0x2f')]);if(_0x125d51['name']){delete _0x125d51[_0x5497('0x30')];}_0x3395f6[_0x5497('0x27')](_0x2fe1f2)['send'](_0x125d51);};}exports[_0x5497('0x31')]=function(_0x44299b,_0xc7730){var _0x1b9cd8={},_0x1656c7={},_0x37011c={'count':0x0,'rows':[]};var _0x580e86=_[_0x5497('0x32')](db['FreshsalesConfiguration'][_0x5497('0x33')],function(_0x212199){return{'name':_0x212199[_0x5497('0x34')],'type':_0x212199['type']['key']};});_0x1656c7[_0x5497('0x35')]=_[_0x5497('0x32')](_0x580e86,_0x5497('0x30'));_0x1656c7[_0x5497('0x36')]=_[_0x5497('0x37')](_0x44299b[_0x5497('0x36')]);_0x1656c7['filters']=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],_0x1656c7[_0x5497('0x36')]);_0x1b9cd8[_0x5497('0x39')]=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x44299b[_0x5497('0x36')][_0x5497('0x3a')]));_0x1b9cd8['attributes']=_0x1b9cd8[_0x5497('0x39')][_0x5497('0x3b')]?_0x1b9cd8[_0x5497('0x39')]:_0x1656c7[_0x5497('0x35')];if(!_0x44299b[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1b9cd8['limit']=qs[_0x5497('0x2a')](_0x44299b[_0x5497('0x36')][_0x5497('0x2a')]);_0x1b9cd8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x44299b[_0x5497('0x36')][_0x5497('0x3e')]);}_0x1b9cd8['order']=qs[_0x5497('0x3f')](_0x44299b[_0x5497('0x36')][_0x5497('0x3f')]);_0x1b9cd8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x44299b[_0x5497('0x36')],_0x1656c7[_0x5497('0x41')]),_0x580e86);if(_0x44299b[_0x5497('0x36')][_0x5497('0x43')]){_0x1b9cd8['where']=_[_0x5497('0x44')](_0x1b9cd8['where'],{'$or':_[_0x5497('0x32')](_0x580e86,function(_0x9fc24){if(_0x9fc24[_0x5497('0x45')]!==_0x5497('0x46')){var _0x133746={};_0x133746[_0x9fc24['name']]={'$like':'%'+_0x44299b[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x133746;}})});}_0x1b9cd8=_['merge']({},_0x1b9cd8,_0x44299b[_0x5497('0x47')]);var _0x553279={'where':_0x1b9cd8[_0x5497('0x40')]};return db['FreshsalesConfiguration'][_0x5497('0x48')](_0x553279)[_0x5497('0x2e')](function(_0x2e8c6a){_0x37011c[_0x5497('0x48')]=_0x2e8c6a;if(_0x44299b[_0x5497('0x36')]['includeAll']){_0x1b9cd8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b9cd8);})[_0x5497('0x2e')](function(_0x43c430){_0x37011c[_0x5497('0x49')]=_0x43c430;return _0x37011c;})[_0x5497('0x2e')](respondWithFilteredResult(_0xc7730,_0x1b9cd8))[_0x5497('0x25')](handleError(_0xc7730,null));};exports[_0x5497('0x4a')]=function(_0xc78abe,_0x466287){var _0x2626bf={'raw':![],'where':{'id':_0xc78abe[_0x5497('0x4b')]['id']}},_0x57350a={};_0x57350a[_0x5497('0x35')]=_[_0x5497('0x37')](db['FreshsalesConfiguration'][_0x5497('0x33')]);_0x57350a['query']=_[_0x5497('0x37')](_0xc78abe[_0x5497('0x36')]);_0x57350a[_0x5497('0x41')]=_['intersection'](_0x57350a[_0x5497('0x35')],_0x57350a[_0x5497('0x36')]);_0x2626bf['attributes']=_[_0x5497('0x38')](_0x57350a['model'],qs[_0x5497('0x3a')](_0xc78abe['query'][_0x5497('0x3a')]));_0x2626bf[_0x5497('0x39')]=_0x2626bf[_0x5497('0x39')][_0x5497('0x3b')]?_0x2626bf[_0x5497('0x39')]:_0x57350a[_0x5497('0x35')];if(_0xc78abe[_0x5497('0x36')][_0x5497('0x4c')]){_0x2626bf['include']=[{'all':!![]}];}_0x2626bf=_[_0x5497('0x44')]({},_0x2626bf,_0xc78abe['options']);return db['FreshsalesConfiguration'][_0x5497('0x4d')](_0x2626bf)[_0x5497('0x2e')](handleEntityNotFound(_0x466287,null))['then'](respondWithResult(_0x466287,null))[_0x5497('0x25')](handleError(_0x466287,null));};exports[_0x5497('0x4e')]=function(_0x436a83,_0x3094c7){return db['FreshsalesConfiguration'][_0x5497('0x4e')](_0x436a83['body'],{})['then'](respondWithResult(_0x3094c7,0xc9))[_0x5497('0x25')](handleError(_0x3094c7,null));};exports[_0x5497('0x4f')]=function(_0x2f7ec8,_0x49c85a){if(_0x2f7ec8['body']['id']){delete _0x2f7ec8[_0x5497('0x50')]['id'];}return db['FreshsalesConfiguration'][_0x5497('0x4d')]({'where':{'id':_0x2f7ec8['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x49c85a,null))['then'](saveUpdates(_0x2f7ec8[_0x5497('0x50')],null))[_0x5497('0x2e')](respondWithResult(_0x49c85a,null))['catch'](handleError(_0x49c85a,null));};exports[_0x5497('0x51')]=function(_0x5dccfb,_0x506d69){return db[_0x5497('0x52')][_0x5497('0x4d')]({'where':{'id':_0x5dccfb['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x506d69,null))[_0x5497('0x2e')](removeEntity(_0x506d69,null))[_0x5497('0x25')](handleError(_0x506d69,null));};exports[_0x5497('0x53')]=function(_0x3fca40,_0x25c75e,_0x590be7){var _0x215ea8={};var _0x4916cd={};var _0x4e0d4c;var _0x480582;return db[_0x5497('0x52')][_0x5497('0x54')]({'where':{'id':_0x3fca40[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c75e,null))[_0x5497('0x2e')](function(_0x528fb4){if(_0x528fb4){_0x4e0d4c=_0x528fb4;_0x4916cd['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x4916cd[_0x5497('0x36')]=_[_0x5497('0x37')](_0x3fca40[_0x5497('0x36')]);_0x4916cd['filters']=_[_0x5497('0x38')](_0x4916cd[_0x5497('0x35')],_0x4916cd[_0x5497('0x36')]);_0x215ea8[_0x5497('0x39')]=_['intersection'](_0x4916cd[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x3fca40[_0x5497('0x36')][_0x5497('0x3a')]));_0x215ea8['attributes']=_0x215ea8[_0x5497('0x39')][_0x5497('0x3b')]?_0x215ea8[_0x5497('0x39')]:_0x4916cd['model'];_0x215ea8[_0x5497('0x56')]=qs['sort'](_0x3fca40['query']['sort']);_0x215ea8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x3fca40['query'],_0x4916cd[_0x5497('0x41')]));if(_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]){_0x215ea8[_0x5497('0x40')]=_['merge'](_0x215ea8[_0x5497('0x40')],{'$or':_[_0x5497('0x32')](_0x215ea8[_0x5497('0x39')],function(_0x49617c){var _0x164de1={};_0x164de1[_0x49617c]={'$like':'%'+_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x164de1;})});}_0x215ea8=_[_0x5497('0x44')]({},_0x215ea8,_0x3fca40[_0x5497('0x47')]);return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x4b4cfe){if(_0x4b4cfe){_0x480582=_0x4b4cfe[_0x5497('0x3b')];if(!_0x3fca40[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x215ea8['limit']=qs['limit'](_0x3fca40['query'][_0x5497('0x2a')]);_0x215ea8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x3fca40['query'][_0x5497('0x3e')]);}return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x464df3){if(_0x464df3){return _0x464df3?{'count':_0x480582,'rows':_0x464df3}:null;}})[_0x5497('0x2e')](respondWithResult(_0x25c75e,null))[_0x5497('0x25')](handleError(_0x25c75e,null));};exports[_0x5497('0x57')]=function(_0x23bd32,_0x21da3d,_0x940188){var _0x1fc6ad={};var _0x5a8b3a={};var _0x15d5a4;var _0x2940ec;return db[_0x5497('0x52')]['findOne']({'where':{'id':_0x23bd32[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21da3d,null))[_0x5497('0x2e')](function(_0x469e97){if(_0x469e97){_0x15d5a4=_0x469e97;_0x5a8b3a['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x5a8b3a[_0x5497('0x36')]=_['keys'](_0x23bd32[_0x5497('0x36')]);_0x5a8b3a[_0x5497('0x41')]=_[_0x5497('0x38')](_0x5a8b3a['model'],_0x5a8b3a[_0x5497('0x36')]);_0x1fc6ad[_0x5497('0x39')]=_['intersection'](_0x5a8b3a[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x23bd32[_0x5497('0x36')]['fields']));_0x1fc6ad['attributes']=_0x1fc6ad[_0x5497('0x39')][_0x5497('0x3b')]?_0x1fc6ad[_0x5497('0x39')]:_0x5a8b3a[_0x5497('0x35')];_0x1fc6ad[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x23bd32[_0x5497('0x36')]['sort']);_0x1fc6ad['where']=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x23bd32['query'],_0x5a8b3a[_0x5497('0x41')]));if(_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]){_0x1fc6ad['where']=_[_0x5497('0x44')](_0x1fc6ad[_0x5497('0x40')],{'$or':_['map'](_0x1fc6ad[_0x5497('0x39')],function(_0x16e2cf){var _0x9458d7={};_0x9458d7[_0x16e2cf]={'$like':'%'+_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x9458d7;})});}_0x1fc6ad=_['merge']({},_0x1fc6ad,_0x23bd32[_0x5497('0x47')]);return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x23e259){if(_0x23e259){_0x2940ec=_0x23e259[_0x5497('0x3b')];if(!_0x23bd32['query'][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1fc6ad[_0x5497('0x2a')]=qs[_0x5497('0x2a')](_0x23bd32['query'][_0x5497('0x2a')]);_0x1fc6ad[_0x5497('0x3e')]=qs['offset'](_0x23bd32[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x53b1b7){if(_0x53b1b7){return _0x53b1b7?{'count':_0x2940ec,'rows':_0x53b1b7}:null;}})['then'](respondWithResult(_0x21da3d,null))['catch'](handleError(_0x21da3d,null));};exports['getFields']=function(_0x594761,_0x2d5543,_0x2375cc){var _0x15d0da={};var _0x1f02d3={};var _0x41f347;var _0x4b7c43;return db['FreshsalesConfiguration'][_0x5497('0x54')]({'where':{'id':_0x594761[_0x5497('0x4b')]['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x2d5543,null))[_0x5497('0x2e')](function(_0x307dc5){if(_0x307dc5){_0x41f347=_0x307dc5;_0x1f02d3[_0x5497('0x35')]=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x1f02d3[_0x5497('0x36')]=_['keys'](_0x594761[_0x5497('0x36')]);_0x1f02d3[_0x5497('0x41')]=_[_0x5497('0x38')](_0x1f02d3[_0x5497('0x35')],_0x1f02d3[_0x5497('0x36')]);_0x15d0da[_0x5497('0x39')]=_['intersection'](_0x1f02d3[_0x5497('0x35')],qs['fields'](_0x594761[_0x5497('0x36')][_0x5497('0x3a')]));_0x15d0da[_0x5497('0x39')]=_0x15d0da['attributes']['length']?_0x15d0da[_0x5497('0x39')]:_0x1f02d3[_0x5497('0x35')];_0x15d0da[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x594761[_0x5497('0x36')][_0x5497('0x3f')]);_0x15d0da[_0x5497('0x40')]=qs[_0x5497('0x41')](_['pick'](_0x594761['query'],_0x1f02d3['filters']));if(_0x594761[_0x5497('0x36')][_0x5497('0x43')]){_0x15d0da[_0x5497('0x40')]=_[_0x5497('0x44')](_0x15d0da['where'],{'$or':_['map'](_0x15d0da[_0x5497('0x39')],function(_0xf38193){var _0x5dd9bc={};_0x5dd9bc[_0xf38193]={'$like':'%'+_0x594761[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x5dd9bc;})});}_0x15d0da=_[_0x5497('0x44')]({},_0x15d0da,_0x594761[_0x5497('0x47')]);return _0x41f347['getFields'](_0x15d0da);}})['then'](function(_0x55e597){if(_0x55e597){_0x4b7c43=_0x55e597['length'];if(!_0x594761['query'][_0x5497('0x3c')]('nolimit')){_0x15d0da[_0x5497('0x2a')]=qs['limit'](_0x594761[_0x5497('0x36')][_0x5497('0x2a')]);_0x15d0da[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x594761[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x41f347['getFields'](_0x15d0da);}})[_0x5497('0x2e')](function(_0x513479){if(_0x513479){return _0x513479?{'count':_0x4b7c43,'rows':_0x513479}:null;}})[_0x5497('0x2e')](respondWithResult(_0x2d5543,null))[_0x5497('0x25')](handleError(_0x2d5543,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 596d088..51b9a3b 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 _0x403a=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','api','bluebird','path'];(function(_0x454714,_0x43b9fd){var _0x750b9c=function(_0x29601f){while(--_0x29601f){_0x454714['push'](_0x454714['shift']());}};_0x750b9c(++_0x43b9fd);}(_0x403a,0x19e));var _0xa403=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x403a[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xa403('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa403('0x1'));var moment=require('moment');var BPromise=require(_0xa403('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa403('0x3'));var rimraf=require(_0xa403('0x4'));var config=require(_0xa403('0x5'));var attributes=require(_0xa403('0x6'));module[_0xa403('0x7')]=function(_0x4666b3,_0x1b1c9f){return _0x4666b3[_0xa403('0x8')](_0xa403('0x9'),attributes,{'tableName':_0xa403('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dcd=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5aa81e,_0x5710f3){var _0x2fba99=function(_0x4c4996){while(--_0x4c4996){_0x5aa81e['push'](_0x5aa81e['shift']());}};_0x2fba99(++_0x5710f3);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x2b4886,_0x59020){_0x2b4886=_0x2b4886-0x0;var _0x2ddbcb=_0x6dcd[_0x2b4886];return _0x2ddbcb;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rp=require(_0xd6dc('0x4'));var fs=require('fs');var path=require(_0xd6dc('0x5'));var rimraf=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var attributes=require(_0xd6dc('0x8'));module[_0xd6dc('0x9')]=function(_0x18277f,_0x311f22){return _0x18277f[_0xd6dc('0xa')](_0xd6dc('0xb'),attributes,{'tableName':_0xd6dc('0xc'),'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 ec651de..46feb43 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 _0xac4a=['FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x20d771,_0x39a667){_0x20d771=_0x20d771-0x0;var _0x16f6c1=_0xac4a[_0x20d771];return _0x16f6c1;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xf6e8=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3a8473,_0x4bd870){var _0x36314a=function(_0x2fb6e0){while(--_0x2fb6e0){_0x3a8473['push'](_0x3a8473['shift']());}};_0x36314a(++_0x4bd870);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x189971,_0x1c6bd3){_0x189971=_0x189971-0x0;var _0xc5cd10=_0xf6e8[_0x189971];return _0xc5cd10;};'use strict';var _=require('lodash');var util=require(_0x8f6e('0x0'));var moment=require(_0x8f6e('0x1'));var BPromise=require(_0x8f6e('0x2'));var rs=require(_0x8f6e('0x3'));var fs=require('fs');var Redis=require(_0x8f6e('0x4'));var db=require(_0x8f6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f6e('0x6'))('rpc');var config=require(_0x8f6e('0x7'));var jayson=require(_0x8f6e('0x8'));var client=jayson['client'][_0x8f6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233158,_0xd26126,_0x71b52c){return new BPromise(function(_0x423ed4,_0x105076){return client[_0x8f6e('0xa')](_0x233158,_0x71b52c)[_0x8f6e('0xb')](function(_0x364ade){logger[_0x8f6e('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'));logger[_0x8f6e('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'),JSON[_0x8f6e('0xf')](_0x364ade));if(_0x364ade[_0x8f6e('0x10')]){if(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x11')]===0x1f4){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);return _0x105076(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);}logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade['error'][_0x8f6e('0x13')]);return _0x423ed4(_0x364ade[_0x8f6e('0x10')]['message']);}else{logger[_0x8f6e('0xc')](_0x8f6e('0x12'),_0xd26126,_0x8f6e('0xd'));_0x423ed4(_0x364ade['result']['message']);}})['catch'](function(_0x201991){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x201991);_0x105076(_0x201991);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9fa8aa5..c503b13 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 _0x1009=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id'];(function(_0x4dedc3,_0x4f4966){var _0x1d08f4=function(_0x299d40){while(--_0x299d40){_0x4dedc3['push'](_0x4dedc3['shift']());}};_0x1d08f4(++_0x4f4966);}(_0x1009,0x1eb));var _0x9100=function(_0x8af03b,_0x32c5ce){_0x8af03b=_0x8af03b-0x0;var _0x2e5d4c=_0x1009[_0x8af03b];return _0x2e5d4c;};'use strict';var multer=require(_0x9100('0x0'));var util=require(_0x9100('0x1'));var path=require(_0x9100('0x2'));var timeout=require(_0x9100('0x3'));var express=require(_0x9100('0x4'));var router=express[_0x9100('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9100('0x6'));var config=require(_0x9100('0x7'));var controller=require(_0x9100('0x8'));router['get']('/',auth[_0x9100('0x9')](),controller[_0x9100('0xa')]);router[_0x9100('0xb')](_0x9100('0xc'),auth[_0x9100('0x9')](),controller[_0x9100('0xd')]);router[_0x9100('0xe')]('/',auth[_0x9100('0x9')](),controller[_0x9100('0xf')]);router[_0x9100('0x10')](_0x9100('0xc'),auth['isAuthenticated'](),controller[_0x9100('0x11')]);router[_0x9100('0x12')](_0x9100('0xc'),auth[_0x9100('0x9')](),controller[_0x9100('0x13')]);module[_0x9100('0x14')]=router; \ No newline at end of file +var _0x9a60=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x2a8ff1,_0x4615e5){var _0x3e588a=function(_0x3808f0){while(--_0x3808f0){_0x2a8ff1['push'](_0x2a8ff1['shift']());}};_0x3e588a(++_0x4615e5);}(_0x9a60,0x78));var _0x09a6=function(_0x3a9c1f,_0x3d5010){_0x3a9c1f=_0x3a9c1f-0x0;var _0x184d5d=_0x9a60[_0x3a9c1f];return _0x184d5d;};'use strict';var multer=require(_0x09a6('0x0'));var util=require(_0x09a6('0x1'));var path=require('path');var timeout=require(_0x09a6('0x2'));var express=require('express');var router=express[_0x09a6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09a6('0x4'));var config=require(_0x09a6('0x5'));var controller=require(_0x09a6('0x6'));router[_0x09a6('0x7')]('/',auth[_0x09a6('0x8')](),controller[_0x09a6('0x9')]);router[_0x09a6('0x7')](_0x09a6('0xa'),auth[_0x09a6('0x8')](),controller[_0x09a6('0xb')]);router[_0x09a6('0xc')]('/',auth[_0x09a6('0x8')](),controller[_0x09a6('0xd')]);router[_0x09a6('0xe')](_0x09a6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x09a6('0xf')](_0x09a6('0xa'),auth[_0x09a6('0x8')](),controller[_0x09a6('0x10')]);module[_0x09a6('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 ad8cc81..dabf04f 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 _0x36f1=['sequelize','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x2c682c,_0x2c7805){var _0x3726bf=function(_0x48058c){while(--_0x48058c){_0x2c682c['push'](_0x2c682c['shift']());}};_0x3726bf(++_0x2c7805);}(_0x36f1,0xb0));var _0x136f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x36f1[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x136f('0x0'));module['exports']={'type':{'type':Sequelize[_0x136f('0x1')]('string',_0x136f('0x2'),_0x136f('0x3'),_0x136f('0x4')),'defaultValue':_0x136f('0x5')},'content':{'type':Sequelize[_0x136f('0x6')]},'key':{'type':Sequelize[_0x136f('0x6')]},'keyType':{'type':Sequelize[_0x136f('0x1')](_0x136f('0x5'),_0x136f('0x2'),_0x136f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x136f('0x6')]},'nameField':{'type':Sequelize[_0x136f('0x6')]},'customField':{'type':Sequelize[_0x136f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe27=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x294676,_0x393370){var _0x1ad993=function(_0x5500ab){while(--_0x5500ab){_0x294676['push'](_0x294676['shift']());}};_0x1ad993(++_0x393370);}(_0xbe27,0x12d));var _0x7be2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbe27[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x7be2('0x0')]={'type':{'type':Sequelize[_0x7be2('0x1')]('string',_0x7be2('0x2'),_0x7be2('0x3'),_0x7be2('0x4')),'defaultValue':_0x7be2('0x5')},'content':{'type':Sequelize[_0x7be2('0x6')]},'key':{'type':Sequelize[_0x7be2('0x6')]},'keyType':{'type':Sequelize[_0x7be2('0x1')]('string',_0x7be2('0x2'),_0x7be2('0x3'))},'keyContent':{'type':Sequelize[_0x7be2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7be2('0x6')]},'customField':{'type':Sequelize[_0x7be2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7baef21..c64a3f5 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 _0x986a=['count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','update','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x316ad7,_0xf1004d){var _0x16f363=function(_0x350400){while(--_0x350400){_0x316ad7['push'](_0x316ad7['shift']());}};_0x16f363(++_0xf1004d);}(_0x986a,0x1f3));var _0xa986=function(_0x11dc5c,_0x50a40c){_0x11dc5c=_0x11dc5c-0x0;var _0x80bf74=_0x986a[_0x11dc5c];return _0x80bf74;};'use strict';var pdf=require(_0xa986('0x0'));var emlformat=require(_0xa986('0x1'));var rimraf=require(_0xa986('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa986('0x3'));var rp=require(_0xa986('0x4'));var moment=require('moment');var BPromise=require(_0xa986('0x5'));var Mustache=require('mustache');var util=require(_0xa986('0x6'));var path=require(_0xa986('0x7'));var sox=require(_0xa986('0x8'));var csv=require(_0xa986('0x9'));var ejs=require(_0xa986('0xa'));var fs=require('fs');var _=require(_0xa986('0xb'));var squel=require('squel');var crypto=require(_0xa986('0xc'));var jsforce=require(_0xa986('0xd'));var deskjs=require(_0xa986('0xe'));var toCsv=require(_0xa986('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa986('0xf'));var authService=require(_0xa986('0x10'));var qs=require(_0xa986('0x11'));var as=require(_0xa986('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa986('0x13'))('api');var utils=require(_0xa986('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa986('0x15'))['db'];function respondWithStatusCode(_0x24a7a6,_0x1d4ede){_0x1d4ede=_0x1d4ede||0xcc;return function(_0x41f93a){if(_0x41f93a){return _0x24a7a6[_0xa986('0x16')](_0x1d4ede);}return _0x24a7a6[_0xa986('0x17')](_0x1d4ede)[_0xa986('0x18')]();};}function respondWithResult(_0x1e1dfc,_0x5802db){_0x5802db=_0x5802db||0xc8;return function(_0x10e9b5){if(_0x10e9b5){return _0x1e1dfc[_0xa986('0x17')](_0x5802db)[_0xa986('0x19')](_0x10e9b5);}};}function respondWithFilteredResult(_0x578739,_0x472cad){return function(_0x4408dd){if(_0x4408dd){var _0xbbeb03=_0x4408dd[_0xa986('0x1a')],_0x6257e5=_0x472cad['offset'],_0x287009=_0x472cad[_0xa986('0x1b')]+_0x472cad[_0xa986('0x1c')],_0x2c17fd;if(_0x287009>=_0xbbeb03){_0x287009=_0xbbeb03;_0x2c17fd=0xc8;}else{_0x2c17fd=0xce;}_0x578739[_0xa986('0x17')](_0x2c17fd);return _0x578739['set'](_0xa986('0x1d'),_0x6257e5+'-'+_0x287009+'/'+_0xbbeb03)[_0xa986('0x19')](_0x4408dd);}return null;};}function patchUpdates(_0x43977d){return function(_0x670181){try{jsonpatch[_0xa986('0x1e')](_0x670181,_0x43977d,!![]);}catch(_0x12fb81){return BPromise[_0xa986('0x1f')](_0x12fb81);}return _0x670181[_0xa986('0x20')]();};}function saveUpdates(_0x5a5e6b,_0x199ef7){return function(_0x4d0ca7){if(_0x4d0ca7){return _0x4d0ca7['update'](_0x5a5e6b)[_0xa986('0x21')](function(_0x4c94f2){return _0x4c94f2;});}return null;};}function removeEntity(_0x22007c,_0x5a5afd){return function(_0x47487f){if(_0x47487f){return _0x47487f[_0xa986('0x22')]()[_0xa986('0x21')](function(){_0x22007c[_0xa986('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5645fb,_0x1ff2cc){return function(_0x52684e){if(!_0x52684e){_0x5645fb['sendStatus'](0x194);}return _0x52684e;};}function handleError(_0x43d576,_0x3f1ff7){_0x3f1ff7=_0x3f1ff7||0x1f4;return function(_0x2c52eb){logger[_0xa986('0x23')](_0x2c52eb[_0xa986('0x24')]);if(_0x2c52eb[_0xa986('0x25')]){delete _0x2c52eb[_0xa986('0x25')];}_0x43d576['status'](_0x3f1ff7)[_0xa986('0x26')](_0x2c52eb);};}exports[_0xa986('0x27')]=function(_0x4f146c,_0x4eea77){var _0x7af204={},_0x1218c8={},_0x399f61={'count':0x0,'rows':[]};var _0x398020=_[_0xa986('0x28')](db[_0xa986('0x29')][_0xa986('0x2a')],function(_0x3ff18e){return{'name':_0x3ff18e[_0xa986('0x2b')],'type':_0x3ff18e['type'][_0xa986('0x2c')]};});_0x1218c8['model']=_['map'](_0x398020,_0xa986('0x25'));_0x1218c8[_0xa986('0x2d')]=_['keys'](_0x4f146c[_0xa986('0x2d')]);_0x1218c8['filters']=_[_0xa986('0x2e')](_0x1218c8[_0xa986('0x2f')],_0x1218c8[_0xa986('0x2d')]);_0x7af204['attributes']=_[_0xa986('0x2e')](_0x1218c8[_0xa986('0x2f')],qs['fields'](_0x4f146c[_0xa986('0x2d')][_0xa986('0x30')]));_0x7af204[_0xa986('0x31')]=_0x7af204['attributes']['length']?_0x7af204[_0xa986('0x31')]:_0x1218c8[_0xa986('0x2f')];if(!_0x4f146c[_0xa986('0x2d')][_0xa986('0x32')](_0xa986('0x33'))){_0x7af204[_0xa986('0x1c')]=qs[_0xa986('0x1c')](_0x4f146c[_0xa986('0x2d')][_0xa986('0x1c')]);_0x7af204[_0xa986('0x1b')]=qs[_0xa986('0x1b')](_0x4f146c[_0xa986('0x2d')][_0xa986('0x1b')]);}_0x7af204[_0xa986('0x34')]=qs[_0xa986('0x35')](_0x4f146c[_0xa986('0x2d')]['sort']);_0x7af204[_0xa986('0x36')]=qs[_0xa986('0x37')](_[_0xa986('0x38')](_0x4f146c[_0xa986('0x2d')],_0x1218c8[_0xa986('0x37')]),_0x398020);if(_0x4f146c[_0xa986('0x2d')][_0xa986('0x39')]){_0x7af204[_0xa986('0x36')]=_['merge'](_0x7af204['where'],{'$or':_[_0xa986('0x28')](_0x398020,function(_0x470c9f){if(_0x470c9f[_0xa986('0x3a')]!==_0xa986('0x3b')){var _0x475727={};_0x475727[_0x470c9f[_0xa986('0x25')]]={'$like':'%'+_0x4f146c[_0xa986('0x2d')][_0xa986('0x39')]+'%'};return _0x475727;}})});}_0x7af204=_[_0xa986('0x3c')]({},_0x7af204,_0x4f146c[_0xa986('0x3d')]);var _0x573a0a={'where':_0x7af204[_0xa986('0x36')]};return db['FreshsalesField'][_0xa986('0x1a')](_0x573a0a)['then'](function(_0x2883fa){_0x399f61[_0xa986('0x1a')]=_0x2883fa;if(_0x4f146c[_0xa986('0x2d')][_0xa986('0x3e')]){_0x7af204[_0xa986('0x3f')]=[{'all':!![]}];}return db[_0xa986('0x29')][_0xa986('0x40')](_0x7af204);})[_0xa986('0x21')](function(_0x15a84e){_0x399f61[_0xa986('0x41')]=_0x15a84e;return _0x399f61;})[_0xa986('0x21')](respondWithFilteredResult(_0x4eea77,_0x7af204))[_0xa986('0x42')](handleError(_0x4eea77,null));};exports[_0xa986('0x43')]=function(_0x2540c9,_0xe27fdd){var _0x128391={'raw':!![],'where':{'id':_0x2540c9[_0xa986('0x44')]['id']}},_0x27b185={};_0x27b185[_0xa986('0x2f')]=_[_0xa986('0x45')](db['FreshsalesField'][_0xa986('0x2a')]);_0x27b185[_0xa986('0x2d')]=_['keys'](_0x2540c9[_0xa986('0x2d')]);_0x27b185[_0xa986('0x37')]=_[_0xa986('0x2e')](_0x27b185[_0xa986('0x2f')],_0x27b185[_0xa986('0x2d')]);_0x128391[_0xa986('0x31')]=_['intersection'](_0x27b185[_0xa986('0x2f')],qs[_0xa986('0x30')](_0x2540c9[_0xa986('0x2d')][_0xa986('0x30')]));_0x128391['attributes']=_0x128391[_0xa986('0x31')][_0xa986('0x46')]?_0x128391[_0xa986('0x31')]:_0x27b185['model'];if(_0x2540c9[_0xa986('0x2d')][_0xa986('0x3e')]){_0x128391[_0xa986('0x3f')]=[{'all':!![]}];}_0x128391=_[_0xa986('0x3c')]({},_0x128391,_0x2540c9['options']);return db['FreshsalesField'][_0xa986('0x47')](_0x128391)['then'](handleEntityNotFound(_0xe27fdd,null))[_0xa986('0x21')](respondWithResult(_0xe27fdd,null))['catch'](handleError(_0xe27fdd,null));};exports[_0xa986('0x48')]=function(_0x7dcb49,_0x3bc252){return db['FreshsalesField'][_0xa986('0x48')](_0x7dcb49['body'],{})[_0xa986('0x21')](respondWithResult(_0x3bc252,0xc9))[_0xa986('0x42')](handleError(_0x3bc252,null));};exports[_0xa986('0x49')]=function(_0x4d4879,_0x3d0c70){if(_0x4d4879[_0xa986('0x4a')]['id']){delete _0x4d4879['body']['id'];}return db[_0xa986('0x29')][_0xa986('0x47')]({'where':{'id':_0x4d4879[_0xa986('0x44')]['id']}})[_0xa986('0x21')](handleEntityNotFound(_0x3d0c70,null))[_0xa986('0x21')](saveUpdates(_0x4d4879['body'],null))[_0xa986('0x21')](respondWithResult(_0x3d0c70,null))['catch'](handleError(_0x3d0c70,null));};exports[_0xa986('0x22')]=function(_0xe381d6,_0x465f2f){return db[_0xa986('0x29')]['find']({'where':{'id':_0xe381d6[_0xa986('0x44')]['id']}})[_0xa986('0x21')](handleEntityNotFound(_0x465f2f,null))[_0xa986('0x21')](removeEntity(_0x465f2f,null))[_0xa986('0x42')](handleError(_0x465f2f,null));}; \ No newline at end of file +var _0x6a49=['fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','name','index','FreshsalesField','rawAttributes','type','key','model','map','query','keys','intersection'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0x6a49,0x148));var _0x96a4=function(_0x2d5a5e,_0x35e9ab){_0x2d5a5e=_0x2d5a5e-0x0;var _0x3b0448=_0x6a49[_0x2d5a5e];return _0x3b0448;};'use strict';var pdf=require(_0x96a4('0x0'));var emlformat=require(_0x96a4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x96a4('0x2'));var jsonpatch=require(_0x96a4('0x3'));var rp=require(_0x96a4('0x4'));var moment=require(_0x96a4('0x5'));var BPromise=require(_0x96a4('0x6'));var Mustache=require(_0x96a4('0x7'));var util=require(_0x96a4('0x8'));var path=require(_0x96a4('0x9'));var sox=require('sox');var csv=require(_0x96a4('0xa'));var ejs=require(_0x96a4('0xb'));var fs=require('fs');var _=require(_0x96a4('0xc'));var squel=require(_0x96a4('0xd'));var crypto=require(_0x96a4('0xe'));var jsforce=require(_0x96a4('0xf'));var deskjs=require(_0x96a4('0x10'));var toCsv=require(_0x96a4('0xa'));var querystring=require(_0x96a4('0x11'));var Papa=require(_0x96a4('0x12'));var Redis=require(_0x96a4('0x13'));var authService=require(_0x96a4('0x14'));var qs=require(_0x96a4('0x15'));var as=require(_0x96a4('0x16'));var hardwareService=require(_0x96a4('0x17'));var logger=require(_0x96a4('0x18'))('api');var utils=require(_0x96a4('0x19'));var config=require(_0x96a4('0x1a'));var licenseUtil=require(_0x96a4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3888,_0x3364a1){_0x3364a1=_0x3364a1||0xcc;return function(_0x37ec43){if(_0x37ec43){return _0x4f3888['sendStatus'](_0x3364a1);}return _0x4f3888[_0x96a4('0x1c')](_0x3364a1)[_0x96a4('0x1d')]();};}function respondWithResult(_0x4377fb,_0x155966){_0x155966=_0x155966||0xc8;return function(_0x27e94e){if(_0x27e94e){return _0x4377fb['status'](_0x155966)['json'](_0x27e94e);}};}function respondWithFilteredResult(_0x13d6d1,_0x2ea173){return function(_0xa9210e){if(_0xa9210e){var _0x3f9c10=_0xa9210e[_0x96a4('0x1e')],_0xcbbc60=_0x2ea173[_0x96a4('0x1f')],_0x277696=_0x2ea173['offset']+_0x2ea173[_0x96a4('0x20')],_0x11e601;if(_0x277696>=_0x3f9c10){_0x277696=_0x3f9c10;_0x11e601=0xc8;}else{_0x11e601=0xce;}_0x13d6d1[_0x96a4('0x1c')](_0x11e601);return _0x13d6d1[_0x96a4('0x21')](_0x96a4('0x22'),_0xcbbc60+'-'+_0x277696+'/'+_0x3f9c10)[_0x96a4('0x23')](_0xa9210e);}return null;};}function patchUpdates(_0x393650){return function(_0x31a453){try{jsonpatch[_0x96a4('0x24')](_0x31a453,_0x393650,!![]);}catch(_0x1d2a0e){return BPromise[_0x96a4('0x25')](_0x1d2a0e);}return _0x31a453['save']();};}function saveUpdates(_0x2ac5a8,_0x1566fc){return function(_0x45e629){if(_0x45e629){return _0x45e629[_0x96a4('0x26')](_0x2ac5a8)[_0x96a4('0x27')](function(_0xfb8ffc){return _0xfb8ffc;});}return null;};}function removeEntity(_0x2651bd,_0x16cdf3){return function(_0x23d5c8){if(_0x23d5c8){return _0x23d5c8['destroy']()[_0x96a4('0x27')](function(){_0x2651bd[_0x96a4('0x1c')](0xcc)[_0x96a4('0x1d')]();});}};}function handleEntityNotFound(_0x295eaf,_0x3cf8b2){return function(_0x32dd6c){if(!_0x32dd6c){_0x295eaf['sendStatus'](0x194);}return _0x32dd6c;};}function handleError(_0x4063f9,_0xbda9d7){_0xbda9d7=_0xbda9d7||0x1f4;return function(_0x4f6d9a){logger[_0x96a4('0x28')](_0x4f6d9a['stack']);if(_0x4f6d9a[_0x96a4('0x29')]){delete _0x4f6d9a[_0x96a4('0x29')];}_0x4063f9[_0x96a4('0x1c')](_0xbda9d7)['send'](_0x4f6d9a);};}exports[_0x96a4('0x2a')]=function(_0x54fb25,_0x53ccfe){var _0x41fa1f={},_0x582843={},_0x2d15c1={'count':0x0,'rows':[]};var _0xab875b=_['map'](db[_0x96a4('0x2b')][_0x96a4('0x2c')],function(_0x402326){return{'name':_0x402326['fieldName'],'type':_0x402326[_0x96a4('0x2d')][_0x96a4('0x2e')]};});_0x582843[_0x96a4('0x2f')]=_[_0x96a4('0x30')](_0xab875b,'name');_0x582843[_0x96a4('0x31')]=_[_0x96a4('0x32')](_0x54fb25[_0x96a4('0x31')]);_0x582843['filters']=_['intersection'](_0x582843['model'],_0x582843[_0x96a4('0x31')]);_0x41fa1f['attributes']=_[_0x96a4('0x33')](_0x582843[_0x96a4('0x2f')],qs[_0x96a4('0x34')](_0x54fb25['query'][_0x96a4('0x34')]));_0x41fa1f[_0x96a4('0x35')]=_0x41fa1f[_0x96a4('0x35')]['length']?_0x41fa1f['attributes']:_0x582843['model'];if(!_0x54fb25[_0x96a4('0x31')][_0x96a4('0x36')](_0x96a4('0x37'))){_0x41fa1f['limit']=qs['limit'](_0x54fb25[_0x96a4('0x31')][_0x96a4('0x20')]);_0x41fa1f[_0x96a4('0x1f')]=qs[_0x96a4('0x1f')](_0x54fb25[_0x96a4('0x31')][_0x96a4('0x1f')]);}_0x41fa1f[_0x96a4('0x38')]=qs[_0x96a4('0x39')](_0x54fb25['query'][_0x96a4('0x39')]);_0x41fa1f['where']=qs[_0x96a4('0x3a')](_[_0x96a4('0x3b')](_0x54fb25[_0x96a4('0x31')],_0x582843[_0x96a4('0x3a')]),_0xab875b);if(_0x54fb25[_0x96a4('0x31')][_0x96a4('0x3c')]){_0x41fa1f[_0x96a4('0x3d')]=_[_0x96a4('0x3e')](_0x41fa1f['where'],{'$or':_[_0x96a4('0x30')](_0xab875b,function(_0x473258){if(_0x473258['type']!==_0x96a4('0x3f')){var _0x119974={};_0x119974[_0x473258[_0x96a4('0x29')]]={'$like':'%'+_0x54fb25[_0x96a4('0x31')][_0x96a4('0x3c')]+'%'};return _0x119974;}})});}_0x41fa1f=_[_0x96a4('0x3e')]({},_0x41fa1f,_0x54fb25[_0x96a4('0x40')]);var _0x450957={'where':_0x41fa1f[_0x96a4('0x3d')]};return db[_0x96a4('0x2b')][_0x96a4('0x1e')](_0x450957)[_0x96a4('0x27')](function(_0x33fb5d){_0x2d15c1['count']=_0x33fb5d;if(_0x54fb25['query']['includeAll']){_0x41fa1f[_0x96a4('0x41')]=[{'all':!![]}];}return db[_0x96a4('0x2b')][_0x96a4('0x42')](_0x41fa1f);})[_0x96a4('0x27')](function(_0x22c0d0){_0x2d15c1[_0x96a4('0x43')]=_0x22c0d0;return _0x2d15c1;})[_0x96a4('0x27')](respondWithFilteredResult(_0x53ccfe,_0x41fa1f))['catch'](handleError(_0x53ccfe,null));};exports[_0x96a4('0x44')]=function(_0x1f88d7,_0x271ef8){var _0x3b0aee={'raw':!![],'where':{'id':_0x1f88d7[_0x96a4('0x45')]['id']}},_0x59fe15={};_0x59fe15[_0x96a4('0x2f')]=_[_0x96a4('0x32')](db[_0x96a4('0x2b')][_0x96a4('0x2c')]);_0x59fe15[_0x96a4('0x31')]=_['keys'](_0x1f88d7['query']);_0x59fe15[_0x96a4('0x3a')]=_['intersection'](_0x59fe15[_0x96a4('0x2f')],_0x59fe15[_0x96a4('0x31')]);_0x3b0aee[_0x96a4('0x35')]=_[_0x96a4('0x33')](_0x59fe15['model'],qs[_0x96a4('0x34')](_0x1f88d7[_0x96a4('0x31')][_0x96a4('0x34')]));_0x3b0aee[_0x96a4('0x35')]=_0x3b0aee['attributes'][_0x96a4('0x46')]?_0x3b0aee['attributes']:_0x59fe15['model'];if(_0x1f88d7['query'][_0x96a4('0x47')]){_0x3b0aee['include']=[{'all':!![]}];}_0x3b0aee=_['merge']({},_0x3b0aee,_0x1f88d7['options']);return db[_0x96a4('0x2b')][_0x96a4('0x48')](_0x3b0aee)[_0x96a4('0x27')](handleEntityNotFound(_0x271ef8,null))['then'](respondWithResult(_0x271ef8,null))['catch'](handleError(_0x271ef8,null));};exports[_0x96a4('0x49')]=function(_0x11020b,_0x3ab30f){return db[_0x96a4('0x2b')][_0x96a4('0x49')](_0x11020b[_0x96a4('0x4a')],{})[_0x96a4('0x27')](respondWithResult(_0x3ab30f,0xc9))[_0x96a4('0x4b')](handleError(_0x3ab30f,null));};exports[_0x96a4('0x26')]=function(_0x37c846,_0x5c7ebf){if(_0x37c846['body']['id']){delete _0x37c846[_0x96a4('0x4a')]['id'];}return db[_0x96a4('0x2b')]['find']({'where':{'id':_0x37c846[_0x96a4('0x45')]['id']}})[_0x96a4('0x27')](handleEntityNotFound(_0x5c7ebf,null))['then'](saveUpdates(_0x37c846[_0x96a4('0x4a')],null))[_0x96a4('0x27')](respondWithResult(_0x5c7ebf,null))[_0x96a4('0x4b')](handleError(_0x5c7ebf,null));};exports['destroy']=function(_0x5b8628,_0x33c185){return db[_0x96a4('0x2b')]['find']({'where':{'id':_0x5b8628[_0x96a4('0x45')]['id']}})['then'](handleEntityNotFound(_0x33c185,null))[_0x96a4('0x27')](removeEntity(_0x33c185,null))[_0x96a4('0x4b')](handleError(_0x33c185,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a23c66a..d264b64 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 _0xac85=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac85,0x67));var _0x5ac8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xac85[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require(_0x5ac8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5ac8('0x5'));var fs=require('fs');var path=require(_0x5ac8('0x6'));var rimraf=require(_0x5ac8('0x7'));var config=require(_0x5ac8('0x8'));var attributes=require(_0x5ac8('0x9'));module[_0x5ac8('0xa')]=function(_0x6cb21f,_0x2ea9fa){return _0x6cb21f[_0x5ac8('0xb')](_0x5ac8('0xc'),attributes,{'tableName':_0x5ac8('0xd'),'paranoid':![],'indexes':[{'name':_0x5ac8('0xe'),'fields':[_0x5ac8('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59ef=['api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','util'];(function(_0x577b1f,_0xe90720){var _0x5d6e61=function(_0x2753bf){while(--_0x2753bf){_0x577b1f['push'](_0x577b1f['shift']());}};_0x5d6e61(++_0xe90720);}(_0x59ef,0x12b));var _0xf59e=function(_0x3ac035,_0x40f232){_0x3ac035=_0x3ac035-0x0;var _0x4f9c43=_0x59ef[_0x3ac035];return _0x4f9c43;};'use strict';var _=require('lodash');var util=require(_0xf59e('0x0'));var logger=require('../../config/logger')(_0xf59e('0x1'));var moment=require(_0xf59e('0x2'));var BPromise=require(_0xf59e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf59e('0x4'));var rimraf=require('rimraf');var config=require(_0xf59e('0x5'));var attributes=require(_0xf59e('0x6'));module[_0xf59e('0x7')]=function(_0xe1fc12,_0x2dda75){return _0xe1fc12[_0xf59e('0x8')](_0xf59e('0x9'),attributes,{'tableName':_0xf59e('0xa'),'paranoid':![],'indexes':[{'name':_0xf59e('0xb'),'fields':['idField','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 3d1cffe..f5a43a5 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 _0x2630=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2630,0x79));var _0x0263=function(_0x5cd9f2,_0x461831){_0x5cd9f2=_0x5cd9f2-0x0;var _0x5d9719=_0x2630[_0x5cd9f2];return _0x5d9719;};'use strict';var _=require(_0x0263('0x0'));var util=require(_0x0263('0x1'));var moment=require(_0x0263('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0263('0x3'));var db=require(_0x0263('0x4'))['db'];var utils=require(_0x0263('0x5'));var logger=require(_0x0263('0x6'))(_0x0263('0x7'));var config=require(_0x0263('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0263('0x9')][_0x0263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49f6bd,_0x8053d9,_0xa22866){return new BPromise(function(_0x3f1327,_0x18e639){return client[_0x0263('0xb')](_0x49f6bd,_0xa22866)['then'](function(_0x20350e){logger[_0x0263('0xc')](_0x0263('0xd'),_0x8053d9,_0x0263('0xe'));logger[_0x0263('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x8053d9,_0x0263('0xe'),JSON['stringify'](_0x20350e));if(_0x20350e[_0x0263('0x10')]){if(_0x20350e[_0x0263('0x10')][_0x0263('0x11')]===0x1f4){logger['error'](_0x0263('0xd'),_0x8053d9,_0x20350e['error'][_0x0263('0x12')]);return _0x18e639(_0x20350e['error'][_0x0263('0x12')]);}logger[_0x0263('0x10')](_0x0263('0xd'),_0x8053d9,_0x20350e[_0x0263('0x10')][_0x0263('0x12')]);return _0x3f1327(_0x20350e[_0x0263('0x10')][_0x0263('0x12')]);}else{logger[_0x0263('0xc')](_0x0263('0xd'),_0x8053d9,_0x0263('0xe'));_0x3f1327(_0x20350e['result']['message']);}})['catch'](function(_0x496770){logger[_0x0263('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x8053d9,_0x496770);_0x18e639(_0x496770);});});} \ No newline at end of file +var _0x555e=['jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x555e,0x159));var _0xe555=function(_0x5b5cd3,_0x250f43){_0x5b5cd3=_0x5b5cd3-0x0;var _0x43e5c6=_0x555e[_0x5b5cd3];return _0x43e5c6;};'use strict';var _=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var moment=require(_0xe555('0x2'));var BPromise=require('bluebird');var rs=require(_0xe555('0x3'));var fs=require('fs');var Redis=require(_0xe555('0x4'));var db=require(_0xe555('0x5'))['db'];var utils=require(_0xe555('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe555('0x7'));var client=jayson[_0xe555('0x8')][_0xe555('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53a2cd,_0x516385,_0x29065f){return new BPromise(function(_0x5dd26d,_0x31a94b){return client[_0xe555('0xa')](_0x53a2cd,_0x29065f)[_0xe555('0xb')](function(_0x36bf99){logger[_0xe555('0xc')](_0xe555('0xd'),_0x516385,_0xe555('0xe'));logger['debug'](_0xe555('0xf'),_0x516385,_0xe555('0xe'),JSON[_0xe555('0x10')](_0x36bf99));if(_0x36bf99[_0xe555('0x11')]){if(_0x36bf99[_0xe555('0x11')][_0xe555('0x12')]===0x1f4){logger[_0xe555('0x11')](_0xe555('0xd'),_0x516385,_0x36bf99['error'][_0xe555('0x13')]);return _0x31a94b(_0x36bf99[_0xe555('0x11')][_0xe555('0x13')]);}logger[_0xe555('0x11')](_0xe555('0xd'),_0x516385,_0x36bf99['error'][_0xe555('0x13')]);return _0x5dd26d(_0x36bf99[_0xe555('0x11')][_0xe555('0x13')]);}else{logger[_0xe555('0xc')](_0xe555('0xd'),_0x516385,'request\x20sent');_0x5dd26d(_0x36bf99[_0xe555('0x14')][_0xe555('0x13')]);}})[_0xe555('0x15')](function(_0x142993){logger[_0xe555('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x516385,_0x142993);_0x31a94b(_0x142993);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2d464e0..44bdd20 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 _0xfec3=['express','Router','../../components/auth/service','./intSalesforceAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','addConfiguration','update','delete','/:id','multer','util','path','connect-timeout'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xfec3,0x6e));var _0x3fec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfec3[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var path=require(_0x3fec('0x2'));var timeout=require(_0x3fec('0x3'));var express=require(_0x3fec('0x4'));var router=express[_0x3fec('0x5')]();var auth=require(_0x3fec('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3fec('0x7'));router[_0x3fec('0x8')]('/',auth[_0x3fec('0x9')](),controller[_0x3fec('0xa')]);router['get']('/:id',auth[_0x3fec('0x9')](),controller[_0x3fec('0xb')]);router[_0x3fec('0x8')](_0x3fec('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3fec('0x8')]('/:id/fields',auth[_0x3fec('0x9')](),controller[_0x3fec('0xd')]);router[_0x3fec('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3fec('0xc'),auth[_0x3fec('0x9')](),controller[_0x3fec('0xf')]);router['put']('/:id',auth[_0x3fec('0x9')](),controller[_0x3fec('0x10')]);router[_0x3fec('0x11')](_0x3fec('0x12'),auth[_0x3fec('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb027=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration'];(function(_0x7b9c9,_0x6018c2){var _0x2f4b80=function(_0xcaa816){while(--_0xcaa816){_0x7b9c9['push'](_0x7b9c9['shift']());}};_0x2f4b80(++_0x6018c2);}(_0xb027,0xbd));var _0x7b02=function(_0x2e1946,_0x491df7){_0x2e1946=_0x2e1946-0x0;var _0x51a593=_0xb027[_0x2e1946];return _0x51a593;};'use strict';var multer=require(_0x7b02('0x0'));var util=require(_0x7b02('0x1'));var path=require('path');var timeout=require(_0x7b02('0x2'));var express=require(_0x7b02('0x3'));var router=express[_0x7b02('0x4')]();var auth=require(_0x7b02('0x5'));var interaction=require(_0x7b02('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0x7b02('0x7')]('/',auth[_0x7b02('0x8')](),controller[_0x7b02('0x9')]);router[_0x7b02('0x7')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0xb')]);router[_0x7b02('0x7')]('/:id/configurations',auth[_0x7b02('0x8')](),controller[_0x7b02('0xc')]);router[_0x7b02('0x7')](_0x7b02('0xd'),auth[_0x7b02('0x8')](),controller[_0x7b02('0xe')]);router[_0x7b02('0xf')]('/',auth[_0x7b02('0x8')](),controller['create']);router[_0x7b02('0xf')](_0x7b02('0x10'),auth['isAuthenticated'](),controller[_0x7b02('0x11')]);router[_0x7b02('0x12')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0x13')]);router[_0x7b02('0x14')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0x15')]);module[_0x7b02('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e1ffbe8..6b3f148 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 _0x926e=['ENUM','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x3da16d,_0x22eb63){var _0x29ab7e=function(_0x206003){while(--_0x206003){_0x3da16d['push'](_0x3da16d['shift']());}};_0x29ab7e(++_0x22eb63);}(_0x926e,0x1ad));var _0xe926=function(_0x1a3443,_0x2bbf32){_0x1a3443=_0x1a3443-0x0;var _0x1524ca=_0x926e[_0x1a3443];return _0x1524ca;};'use strict';var Sequelize=require(_0xe926('0x0'));module[_0xe926('0x1')]={'name':{'type':Sequelize[_0xe926('0x2')]},'description':{'type':Sequelize[_0xe926('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe926('0x2')]},'password':{'type':Sequelize[_0xe926('0x2')]},'clientId':{'type':Sequelize[_0xe926('0x2')]},'clientSecret':{'type':Sequelize[_0xe926('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe926('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe926('0x3')]('integrationTab',_0xe926('0x4')),'defaultValue':_0xe926('0x5')}}; \ No newline at end of file +var _0xbb42=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x5ebd38,_0x149546){var _0x38a769=function(_0x374bae){while(--_0x374bae){_0x5ebd38['push'](_0x5ebd38['shift']());}};_0x38a769(++_0x149546);}(_0xbb42,0x15c));var _0x2bb4=function(_0x13dbe9,_0x366fe0){_0x13dbe9=_0x13dbe9-0x0;var _0x5c528a=_0xbb42[_0x13dbe9];return _0x5c528a;};'use strict';var Sequelize=require(_0x2bb4('0x0'));module[_0x2bb4('0x1')]={'name':{'type':Sequelize[_0x2bb4('0x2')]},'description':{'type':Sequelize[_0x2bb4('0x2')]},'username':{'type':Sequelize[_0x2bb4('0x2')],'unique':_0x2bb4('0x3')},'remoteUri':{'type':Sequelize[_0x2bb4('0x2')]},'password':{'type':Sequelize[_0x2bb4('0x2')]},'clientId':{'type':Sequelize[_0x2bb4('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2bb4('0x2')]},'serverUrl':{'type':Sequelize[_0x2bb4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2bb4('0x4')](_0x2bb4('0x5'),_0x2bb4('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a2346fb..3a70f47 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 _0x1eba=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Status','Type','Case','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x36795f,_0x5c7f59){var _0xb73584=function(_0x3ecc97){while(--_0x3ecc97){_0x36795f['push'](_0x36795f['shift']());}};_0xb73584(++_0x5c7f59);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x1eba[_0x11e05d];return _0x335588;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];var integrations=require(_0xa1eb('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xa1eb('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e65dc,_0x35a353,_0x4c7983,_0x25d058){return new BPromise(function(_0x2178e2,_0x14e048){var _0x2877cb=_0x25d058||client;return _0x2877cb[_0xa1eb('0x1b')](_0x4e65dc,_0x4c7983)[_0xa1eb('0x1c')](function(_0x1c858c){logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,'request\x20sent');logger[_0xa1eb('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x35a353,_0xa1eb('0x20'),JSON[_0xa1eb('0x21')](_0x1c858c));if(_0x1c858c[_0xa1eb('0x22')]){if(_0x1c858c[_0xa1eb('0x22')]['code']===0x1f4){logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);return _0x14e048(_0x1c858c[_0xa1eb('0x22')][_0xa1eb('0x23')]);}logger[_0xa1eb('0x22')](_0xa1eb('0x1e'),_0x35a353,_0x1c858c['error'][_0xa1eb('0x23')]);return _0x2178e2(_0x1c858c['error'][_0xa1eb('0x23')]);}else{logger[_0xa1eb('0x1d')](_0xa1eb('0x1e'),_0x35a353,_0xa1eb('0x20'));_0x2178e2(_0x1c858c['result']['message']);}})[_0xa1eb('0x24')](function(_0xc64cb9){logger['error'](_0xa1eb('0x1e'),_0x35a353,_0xc64cb9);_0x14e048(_0xc64cb9);});});}function respondWithStatusCode(_0x250728,_0x258d3a){_0x258d3a=_0x258d3a||0xcc;return function(_0xa6b20c){if(_0xa6b20c){return _0x250728[_0xa1eb('0x25')](_0x258d3a);}return _0x250728[_0xa1eb('0x26')](_0x258d3a)[_0xa1eb('0x27')]();};}function respondWithResult(_0x364b1c,_0xd7bb88){_0xd7bb88=_0xd7bb88||0xc8;return function(_0x352796){if(_0x352796){return _0x364b1c[_0xa1eb('0x26')](_0xd7bb88)[_0xa1eb('0x28')](_0x352796);}};}function respondWithFilteredResult(_0x57d089,_0x7c617e){return function(_0xbd5517){if(_0xbd5517){var _0x491f37=_0xbd5517[_0xa1eb('0x29')],_0x2680c0=_0x7c617e['offset'],_0x4e2aa7=_0x7c617e[_0xa1eb('0x2a')]+_0x7c617e[_0xa1eb('0x2b')],_0x3aae71;if(_0x4e2aa7>=_0x491f37){_0x4e2aa7=_0x491f37;_0x3aae71=0xc8;}else{_0x3aae71=0xce;}_0x57d089[_0xa1eb('0x26')](_0x3aae71);return _0x57d089['set'](_0xa1eb('0x2c'),_0x2680c0+'-'+_0x4e2aa7+'/'+_0x491f37)[_0xa1eb('0x28')](_0xbd5517);}return null;};}function patchUpdates(_0x55f5cc){return function(_0x273a42){try{jsonpatch[_0xa1eb('0x2d')](_0x273a42,_0x55f5cc,!![]);}catch(_0x401510){return BPromise[_0xa1eb('0x2e')](_0x401510);}return _0x273a42[_0xa1eb('0x2f')]();};}function saveUpdates(_0x52f9c7,_0x9d49d8){return function(_0x316b02){if(_0x316b02){return _0x316b02[_0xa1eb('0x30')](_0x52f9c7)[_0xa1eb('0x1c')](function(_0x383e26){return _0x383e26;});}return null;};}function removeEntity(_0xcd9efd,_0x1d5b64){return function(_0xcfda64){if(_0xcfda64){return _0xcfda64[_0xa1eb('0x31')]()[_0xa1eb('0x1c')](function(){_0xcd9efd[_0xa1eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563b11,_0x126d50){return function(_0xb267e0){if(!_0xb267e0){_0x563b11[_0xa1eb('0x25')](0x194);}return _0xb267e0;};}function handleError(_0x36cc2a,_0x2b345a){_0x2b345a=_0x2b345a||0x1f4;return function(_0x58d336){logger['error'](_0x58d336[_0xa1eb('0x32')]);if(_0x58d336[_0xa1eb('0x33')]){delete _0x58d336['name'];}_0x36cc2a['status'](_0x2b345a)[_0xa1eb('0x34')](_0x58d336);};}exports['index']=function(_0x1f33dc,_0x534fe4){var _0x47737d={},_0x3ad54b={},_0x229931={'count':0x0,'rows':[]};var _0x57355f=_[_0xa1eb('0x35')](db[_0xa1eb('0x36')][_0xa1eb('0x37')],function(_0x481405){return{'name':_0x481405[_0xa1eb('0x38')],'type':_0x481405[_0xa1eb('0x39')][_0xa1eb('0x3a')]};});_0x3ad54b[_0xa1eb('0x3b')]=_[_0xa1eb('0x35')](_0x57355f,'name');_0x3ad54b[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1f33dc[_0xa1eb('0x3c')]);_0x3ad54b[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x3ad54b[_0xa1eb('0x3b')],_0x3ad54b[_0xa1eb('0x3c')]);_0x47737d[_0xa1eb('0x40')]=_['intersection'](_0x3ad54b[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x41')]));_0x47737d[_0xa1eb('0x40')]=_0x47737d['attributes'][_0xa1eb('0x42')]?_0x47737d[_0xa1eb('0x40')]:_0x3ad54b[_0xa1eb('0x3b')];if(!_0x1f33dc['query'][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x47737d[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x47737d[_0xa1eb('0x2a')]=qs['offset'](_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x2a')]);}_0x47737d['order']=qs[_0xa1eb('0x45')](_0x1f33dc['query'][_0xa1eb('0x45')]);_0x47737d[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1f33dc[_0xa1eb('0x3c')],_0x3ad54b[_0xa1eb('0x3e')]),_0x57355f);if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x48')]){_0x47737d[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x47737d[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x57355f,function(_0x459a02){if(_0x459a02[_0xa1eb('0x39')]!==_0xa1eb('0x4a')){var _0x2ee961={};_0x2ee961[_0x459a02['name']]={'$like':'%'+_0x1f33dc[_0xa1eb('0x3c')]['filter']+'%'};return _0x2ee961;}})});}_0x47737d=_[_0xa1eb('0x49')]({},_0x47737d,_0x1f33dc[_0xa1eb('0x4b')]);var _0x54a29f={'where':_0x47737d['where']};return db[_0xa1eb('0x36')][_0xa1eb('0x29')](_0x54a29f)[_0xa1eb('0x1c')](function(_0x55c770){_0x229931[_0xa1eb('0x29')]=_0x55c770;if(_0x1f33dc[_0xa1eb('0x3c')][_0xa1eb('0x4c')]){_0x47737d[_0xa1eb('0x4d')]=[{'all':!![]}];}return db[_0xa1eb('0x36')][_0xa1eb('0x4e')](_0x47737d);})[_0xa1eb('0x1c')](function(_0x3f66a9){_0x229931[_0xa1eb('0x4f')]=_0x3f66a9;return _0x229931;})[_0xa1eb('0x1c')](respondWithFilteredResult(_0x534fe4,_0x47737d))[_0xa1eb('0x24')](handleError(_0x534fe4,null));};exports[_0xa1eb('0x50')]=function(_0x39d3c6,_0x10e15a){var _0x50df09={'raw':![],'where':{'id':_0x39d3c6[_0xa1eb('0x51')]['id']}},_0x41b65a={};_0x41b65a[_0xa1eb('0x3b')]=_[_0xa1eb('0x3d')](db[_0xa1eb('0x36')][_0xa1eb('0x37')]);_0x41b65a[_0xa1eb('0x3c')]=_['keys'](_0x39d3c6[_0xa1eb('0x3c')]);_0x41b65a[_0xa1eb('0x3e')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],_0x41b65a[_0xa1eb('0x3c')]);_0x50df09[_0xa1eb('0x40')]=_[_0xa1eb('0x3f')](_0x41b65a[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x39d3c6['query'][_0xa1eb('0x41')]));_0x50df09['attributes']=_0x50df09[_0xa1eb('0x40')]['length']?_0x50df09[_0xa1eb('0x40')]:_0x41b65a[_0xa1eb('0x3b')];if(_0x39d3c6[_0xa1eb('0x3c')]['includeAll']){_0x50df09[_0xa1eb('0x4d')]=[{'all':!![]}];}_0x50df09=_[_0xa1eb('0x49')]({},_0x50df09,_0x39d3c6['options']);return db[_0xa1eb('0x36')][_0xa1eb('0x52')](_0x50df09)[_0xa1eb('0x1c')](handleEntityNotFound(_0x10e15a,null))[_0xa1eb('0x1c')](respondWithResult(_0x10e15a,null))[_0xa1eb('0x24')](handleError(_0x10e15a,null));};exports[_0xa1eb('0x53')]=function(_0x305202,_0x247b08){return db[_0xa1eb('0x36')][_0xa1eb('0x53')](_0x305202[_0xa1eb('0x54')],{})[_0xa1eb('0x1c')](respondWithResult(_0x247b08,0xc9))[_0xa1eb('0x24')](handleError(_0x247b08,null));};exports[_0xa1eb('0x30')]=function(_0x40f119,_0x2ba6c0){if(_0x40f119[_0xa1eb('0x54')]['id']){delete _0x40f119['body']['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x40f119[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2ba6c0,null))[_0xa1eb('0x1c')](saveUpdates(_0x40f119[_0xa1eb('0x54')],null))['then'](respondWithResult(_0x2ba6c0,null))[_0xa1eb('0x24')](handleError(_0x2ba6c0,null));};exports[_0xa1eb('0x31')]=function(_0x217ecb,_0xf9d185){return db[_0xa1eb('0x36')][_0xa1eb('0x52')]({'where':{'id':_0x217ecb[_0xa1eb('0x51')]['id']}})['then'](handleEntityNotFound(_0xf9d185,null))[_0xa1eb('0x1c')](removeEntity(_0xf9d185,null))[_0xa1eb('0x24')](handleError(_0xf9d185,null));};exports[_0xa1eb('0x55')]=function(_0x1c8fd0,_0x4c30ad,_0x5af1e6){var _0x58ca4e={};var _0x5673fa={};var _0x1b3c33;var _0x1e1e5d;return db['SalesforceAccount'][_0xa1eb('0x56')]({'where':{'id':_0x1c8fd0[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x4c30ad,null))[_0xa1eb('0x1c')](function(_0x4edf8e){if(_0x4edf8e){_0x1b3c33=_0x4edf8e;_0x5673fa['model']=_[_0xa1eb('0x3d')](db[_0xa1eb('0x57')][_0xa1eb('0x37')]);_0x5673fa[_0xa1eb('0x3c')]=_[_0xa1eb('0x3d')](_0x1c8fd0[_0xa1eb('0x3c')]);_0x5673fa['filters']=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],_0x5673fa['query']);_0x58ca4e[_0xa1eb('0x40')]=_['intersection'](_0x5673fa[_0xa1eb('0x3b')],qs[_0xa1eb('0x41')](_0x1c8fd0['query'][_0xa1eb('0x41')]));_0x58ca4e[_0xa1eb('0x40')]=_0x58ca4e['attributes'][_0xa1eb('0x42')]?_0x58ca4e[_0xa1eb('0x40')]:_0x5673fa[_0xa1eb('0x3b')];_0x58ca4e['order']=qs[_0xa1eb('0x45')](_0x1c8fd0[_0xa1eb('0x3c')]['sort']);_0x58ca4e[_0xa1eb('0x46')]=qs[_0xa1eb('0x3e')](_[_0xa1eb('0x47')](_0x1c8fd0['query'],_0x5673fa[_0xa1eb('0x3e')]));if(_0x1c8fd0['query'][_0xa1eb('0x48')]){_0x58ca4e[_0xa1eb('0x46')]=_[_0xa1eb('0x49')](_0x58ca4e[_0xa1eb('0x46')],{'$or':_[_0xa1eb('0x35')](_0x58ca4e['attributes'],function(_0x2aba03){var _0x401800={};_0x401800[_0x2aba03]={'$like':'%'+_0x1c8fd0[_0xa1eb('0x3c')]['filter']+'%'};return _0x401800;})});}_0x58ca4e=_[_0xa1eb('0x49')]({},_0x58ca4e,_0x1c8fd0['options']);return _0x1b3c33['getConfigurations'](_0x58ca4e);}})['then'](function(_0x555ded){if(_0x555ded){_0x1e1e5d=_0x555ded[_0xa1eb('0x42')];if(!_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x43')](_0xa1eb('0x44'))){_0x58ca4e[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1c8fd0[_0xa1eb('0x3c')][_0xa1eb('0x2b')]);_0x58ca4e[_0xa1eb('0x2a')]=qs[_0xa1eb('0x2a')](_0x1c8fd0['query'][_0xa1eb('0x2a')]);}return _0x1b3c33[_0xa1eb('0x55')](_0x58ca4e);}})[_0xa1eb('0x1c')](function(_0x1f9418){if(_0x1f9418){return _0x1f9418?{'count':_0x1e1e5d,'rows':_0x1f9418}:null;}})[_0xa1eb('0x1c')](respondWithResult(_0x4c30ad,null))[_0xa1eb('0x24')](handleError(_0x4c30ad,null));};exports['addConfiguration']=function(_0x113a3a,_0x2b6996,_0x16c5a3){if(_0x113a3a['body']['id']){delete _0x113a3a[_0xa1eb('0x54')]['id'];}return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x113a3a[_0xa1eb('0x51')]['id']}})[_0xa1eb('0x1c')](handleEntityNotFound(_0x2b6996,null))['then'](function(_0x2eca4e){if(_0x2eca4e){_0x113a3a['body'][_0xa1eb('0x58')]=_0x2eca4e['id'];_0x113a3a['body'][_0xa1eb('0x59')]=integrations[_0xa1eb('0x5a')](_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5b')],_0x113a3a['body'][_0xa1eb('0x39')]);_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x5c')]=integrations[_0xa1eb('0x5d')](_0x113a3a['body'][_0xa1eb('0x5b')],_0x113a3a[_0xa1eb('0x54')][_0xa1eb('0x39')]);return db[_0xa1eb('0x57')][_0xa1eb('0x53')](_0x113a3a[_0xa1eb('0x54')],{'include':[{'model':db[_0xa1eb('0x5e')],'as':_0xa1eb('0x59')},{'model':db[_0xa1eb('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2b6996,null))['catch'](handleError(_0x2b6996,null));};exports[_0xa1eb('0x5f')]=function(_0x5b7785,_0xa5810,_0x3ec094){var _0x492325;var _0x52522a='';var _0xdcaac3=_0xa1eb('0x60');return db[_0xa1eb('0x36')][_0xa1eb('0x56')]({'where':{'id':_0x5b7785[_0xa1eb('0x51')]['id']},'attributes':['id','remoteUri','clientId',_0xa1eb('0x61'),_0xa1eb('0x62'),_0xa1eb('0x63'),_0xa1eb('0x64')]})['then'](handleEntityNotFound(_0xa5810,null))[_0xa1eb('0x1c')](function(_0x28b3de){if(_0x28b3de){_0x52522a=_0x28b3de[_0xa1eb('0x65')];var _0x4050d6=_0x52522a[_0xa1eb('0x66')](-0x1);if(_0x4050d6==='/'){_0x52522a=_0x52522a[_0xa1eb('0x67')](0x0,_0x52522a[_0xa1eb('0x68')](_0x4050d6));}_0x492325=new jsforce[(_0xa1eb('0x69'))]({'oauth2':{'loginUrl':_0x52522a,'clientId':_0x28b3de[_0xa1eb('0x6a')],'clientSecret':_0x28b3de[_0xa1eb('0x61')]}});return _0x492325[_0xa1eb('0x6b')](_0x28b3de['username'],_0x28b3de[_0xa1eb('0x63')][_0xa1eb('0x6c')](_0x28b3de[_0xa1eb('0x64')]));}})[_0xa1eb('0x1c')](function(_0x3fe7ef){if(_0x3fe7ef){if(!_[_0xa1eb('0x6d')](_0x5b7785['query'][_0xa1eb('0x6e')])){_0xdcaac3=_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')];}return _0x492325[_0xa1eb('0x6f')](_0xdcaac3)['describe']();}})['then'](function(_0xff1843){var _0x5e0cd5=[_0xa1eb('0x70'),_0xa1eb('0x71'),'CallObject',_0xa1eb('0x72'),_0xa1eb('0x73'),'Priority',_0xa1eb('0x74'),_0xa1eb('0x75')];if(!_[_0xa1eb('0x6d')](_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')])&&_0x5b7785[_0xa1eb('0x3c')][_0xa1eb('0x6e')]===_0xa1eb('0x76')){_0x5e0cd5=[_0xa1eb('0x75'),_0xa1eb('0x77'),_0xa1eb('0x78'),'Status',_0xa1eb('0x79'),_0xa1eb('0x7a'),_0xa1eb('0x7b'),_0xa1eb('0x7c')];}if(_0xff1843){_['remove'](_0xff1843[_0xa1eb('0x41')],function(_0x2ff08e){return _0x2ff08e[_0xa1eb('0x7d')]===![]&&!_0x5e0cd5['includes'](_0x2ff08e[_0xa1eb('0x33')]);});return{'count':_0xff1843[_0xa1eb('0x41')][_0xa1eb('0x42')],'rows':_['map'](_0xff1843[_0xa1eb('0x41')],function(_0x4fb7a7){return{'id':_0x4fb7a7[_0xa1eb('0x33')],'name':_0x4fb7a7[_0xa1eb('0x7e')],'custom':_0x4fb7a7[_0xa1eb('0x7d')],'options':_0x4fb7a7[_0xa1eb('0x7f')][_0xa1eb('0x42')]>0x0?_[_0xa1eb('0x35')](_0x4fb7a7[_0xa1eb('0x7f')],function(_0xc16d28){return{'name':_0xc16d28['label'],'value':_0xc16d28[_0xa1eb('0x80')]};}):_0x4fb7a7[_0xa1eb('0x39')]==_0xa1eb('0x81')?[{'name':_0xa1eb('0x82'),'value':_0xa1eb('0x83')},{'name':'False','value':_0xa1eb('0x84')}]:[]};})};}})[_0xa1eb('0x1c')](respondWithResult(_0xa5810,null))['catch'](function(_0x1e7ce7){var _0x4be2e5=_0x5b7785['query'][_0xa1eb('0x85')]?0x1f4:_0x1e7ce7[_0xa1eb('0x86')]||0x1f4;logger['error'](_0xa1eb('0x87'),_0xa1eb('0x5f'),_0x4be2e5,JSON['stringify'](_0x1e7ce7));delete _0x1e7ce7[_0xa1eb('0x33')];if(_0x4be2e5===0x191){_0x4be2e5=0x190;}_0xa5810[_0xa1eb('0x26')](_0x4be2e5)['send'](_0x5b7785['query'][_0xa1eb('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x1e7ce7[_0xa1eb('0x86')]}:_0x1e7ce7);});}; \ No newline at end of file +var _0x8aad=['pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','rawAttributes','options','find','create','body','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','Reason','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','boolean','true','False','statusCode','send','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SalesforceAccount','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1bc362,_0x5c561d){var _0x5c96ec=function(_0x370c46){while(--_0x370c46){_0x1bc362['push'](_0x1bc362['shift']());}};_0x5c96ec(++_0x5c561d);}(_0x8aad,0x146));var _0xd8aa=function(_0x17cfb3,_0x45a33a){_0x17cfb3=_0x17cfb3-0x0;var _0x5532a3=_0x8aad[_0x17cfb3];return _0x5532a3;};'use strict';var pdf=require(_0xd8aa('0x0'));var emlformat=require(_0xd8aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8aa('0x3'));var moment=require(_0xd8aa('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8aa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd8aa('0x6'));var ejs=require(_0xd8aa('0x7'));var fs=require('fs');var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xc'));var authService=require(_0xd8aa('0xd'));var qs=require(_0xd8aa('0xe'));var as=require(_0xd8aa('0xf'));var hardwareService=require(_0xd8aa('0x10'));var logger=require('../../config/logger')(_0xd8aa('0x11'));var utils=require(_0xd8aa('0x12'));var config=require(_0xd8aa('0x13'));var licenseUtil=require(_0xd8aa('0x14'));var db=require(_0xd8aa('0x15'))['db'];var integrations=require(_0xd8aa('0x16'));var jayson=require(_0xd8aa('0x17'));var client=jayson[_0xd8aa('0x18')][_0xd8aa('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x364280,_0x5ea934,_0x5a8c79,_0x275eff){return new BPromise(function(_0x319ffe,_0x2bbd1e){var _0x47c131=_0x275eff||client;return _0x47c131[_0xd8aa('0x1a')](_0x364280,_0x5a8c79)[_0xd8aa('0x1b')](function(_0x39b5bc){logger[_0xd8aa('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x5ea934,_0xd8aa('0x1d'));logger[_0xd8aa('0x1e')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5ea934,_0xd8aa('0x1d'),JSON[_0xd8aa('0x1f')](_0x39b5bc));if(_0x39b5bc[_0xd8aa('0x20')]){if(_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x21')]===0x1f4){logger['error'](_0xd8aa('0x22'),_0x5ea934,_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x23')]);return _0x2bbd1e(_0x39b5bc[_0xd8aa('0x20')]['message']);}logger[_0xd8aa('0x20')](_0xd8aa('0x22'),_0x5ea934,_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x23')]);return _0x319ffe(_0x39b5bc[_0xd8aa('0x20')]['message']);}else{logger[_0xd8aa('0x1c')](_0xd8aa('0x22'),_0x5ea934,_0xd8aa('0x1d'));_0x319ffe(_0x39b5bc['result'][_0xd8aa('0x23')]);}})[_0xd8aa('0x24')](function(_0x1d1f87){logger[_0xd8aa('0x20')](_0xd8aa('0x22'),_0x5ea934,_0x1d1f87);_0x2bbd1e(_0x1d1f87);});});}function respondWithStatusCode(_0x16758a,_0x1f64f8){_0x1f64f8=_0x1f64f8||0xcc;return function(_0x34d957){if(_0x34d957){return _0x16758a[_0xd8aa('0x25')](_0x1f64f8);}return _0x16758a[_0xd8aa('0x26')](_0x1f64f8)[_0xd8aa('0x27')]();};}function respondWithResult(_0x370d6f,_0x26cc66){_0x26cc66=_0x26cc66||0xc8;return function(_0x5f1027){if(_0x5f1027){return _0x370d6f[_0xd8aa('0x26')](_0x26cc66)[_0xd8aa('0x28')](_0x5f1027);}};}function respondWithFilteredResult(_0xd4d204,_0x1f6ab2){return function(_0x26cff3){if(_0x26cff3){var _0x3696fd=_0x26cff3[_0xd8aa('0x29')],_0x26ab06=_0x1f6ab2['offset'],_0x19edee=_0x1f6ab2[_0xd8aa('0x2a')]+_0x1f6ab2[_0xd8aa('0x2b')],_0x3bba1d;if(_0x19edee>=_0x3696fd){_0x19edee=_0x3696fd;_0x3bba1d=0xc8;}else{_0x3bba1d=0xce;}_0xd4d204[_0xd8aa('0x26')](_0x3bba1d);return _0xd4d204['set'](_0xd8aa('0x2c'),_0x26ab06+'-'+_0x19edee+'/'+_0x3696fd)['json'](_0x26cff3);}return null;};}function patchUpdates(_0x3052c6){return function(_0x441466){try{jsonpatch[_0xd8aa('0x2d')](_0x441466,_0x3052c6,!![]);}catch(_0x168a2e){return BPromise[_0xd8aa('0x2e')](_0x168a2e);}return _0x441466[_0xd8aa('0x2f')]();};}function saveUpdates(_0xd8d3b3,_0x3cbe8d){return function(_0x5e41e6){if(_0x5e41e6){return _0x5e41e6[_0xd8aa('0x30')](_0xd8d3b3)[_0xd8aa('0x1b')](function(_0x11071f){return _0x11071f;});}return null;};}function removeEntity(_0x2d615a,_0x1b475a){return function(_0x3b8476){if(_0x3b8476){return _0x3b8476[_0xd8aa('0x31')]()[_0xd8aa('0x1b')](function(){_0x2d615a['status'](0xcc)[_0xd8aa('0x27')]();});}};}function handleEntityNotFound(_0x172673,_0x47401e){return function(_0x511b4a){if(!_0x511b4a){_0x172673[_0xd8aa('0x25')](0x194);}return _0x511b4a;};}function handleError(_0x3c8941,_0x21f550){_0x21f550=_0x21f550||0x1f4;return function(_0x45c216){logger[_0xd8aa('0x20')](_0x45c216[_0xd8aa('0x32')]);if(_0x45c216[_0xd8aa('0x33')]){delete _0x45c216[_0xd8aa('0x33')];}_0x3c8941[_0xd8aa('0x26')](_0x21f550)['send'](_0x45c216);};}exports[_0xd8aa('0x34')]=function(_0xef25cb,_0x41cd24){var _0x221f41={},_0x3e23fd={},_0x1b1469={'count':0x0,'rows':[]};var _0xd0bc2b=_[_0xd8aa('0x35')](db[_0xd8aa('0x36')]['rawAttributes'],function(_0x1df47c){return{'name':_0x1df47c['fieldName'],'type':_0x1df47c[_0xd8aa('0x37')][_0xd8aa('0x38')]};});_0x3e23fd['model']=_[_0xd8aa('0x35')](_0xd0bc2b,_0xd8aa('0x33'));_0x3e23fd[_0xd8aa('0x39')]=_[_0xd8aa('0x3a')](_0xef25cb[_0xd8aa('0x39')]);_0x3e23fd['filters']=_['intersection'](_0x3e23fd[_0xd8aa('0x3b')],_0x3e23fd['query']);_0x221f41[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x3e23fd[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x3e')]));_0x221f41[_0xd8aa('0x3c')]=_0x221f41[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x221f41[_0xd8aa('0x3c')]:_0x3e23fd[_0xd8aa('0x3b')];if(!_0xef25cb['query'][_0xd8aa('0x40')](_0xd8aa('0x41'))){_0x221f41[_0xd8aa('0x2b')]=qs['limit'](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x2b')]);_0x221f41[_0xd8aa('0x2a')]=qs[_0xd8aa('0x2a')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x2a')]);}_0x221f41[_0xd8aa('0x42')]=qs[_0xd8aa('0x43')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x43')]);_0x221f41[_0xd8aa('0x44')]=qs[_0xd8aa('0x45')](_[_0xd8aa('0x46')](_0xef25cb[_0xd8aa('0x39')],_0x3e23fd[_0xd8aa('0x45')]),_0xd0bc2b);if(_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x47')]){_0x221f41[_0xd8aa('0x44')]=_['merge'](_0x221f41[_0xd8aa('0x44')],{'$or':_[_0xd8aa('0x35')](_0xd0bc2b,function(_0x146ebd){if(_0x146ebd[_0xd8aa('0x37')]!==_0xd8aa('0x48')){var _0xc30ce={};_0xc30ce[_0x146ebd['name']]={'$like':'%'+_0xef25cb[_0xd8aa('0x39')]['filter']+'%'};return _0xc30ce;}})});}_0x221f41=_[_0xd8aa('0x49')]({},_0x221f41,_0xef25cb['options']);var _0x59565f={'where':_0x221f41['where']};return db['SalesforceAccount'][_0xd8aa('0x29')](_0x59565f)[_0xd8aa('0x1b')](function(_0xa608f9){_0x1b1469[_0xd8aa('0x29')]=_0xa608f9;if(_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x4a')]){_0x221f41['include']=[{'all':!![]}];}return db[_0xd8aa('0x36')][_0xd8aa('0x4b')](_0x221f41);})[_0xd8aa('0x1b')](function(_0xf6728d){_0x1b1469[_0xd8aa('0x4c')]=_0xf6728d;return _0x1b1469;})['then'](respondWithFilteredResult(_0x41cd24,_0x221f41))['catch'](handleError(_0x41cd24,null));};exports['show']=function(_0x1fd1dc,_0x2a24ae){var _0x131012={'raw':![],'where':{'id':_0x1fd1dc[_0xd8aa('0x4d')]['id']}},_0x2ae10b={};_0x2ae10b[_0xd8aa('0x3b')]=_['keys'](db[_0xd8aa('0x36')][_0xd8aa('0x4e')]);_0x2ae10b['query']=_[_0xd8aa('0x3a')](_0x1fd1dc[_0xd8aa('0x39')]);_0x2ae10b[_0xd8aa('0x45')]=_['intersection'](_0x2ae10b[_0xd8aa('0x3b')],_0x2ae10b[_0xd8aa('0x39')]);_0x131012[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x2ae10b[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0x1fd1dc['query']['fields']));_0x131012[_0xd8aa('0x3c')]=_0x131012[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x131012[_0xd8aa('0x3c')]:_0x2ae10b[_0xd8aa('0x3b')];if(_0x1fd1dc[_0xd8aa('0x39')][_0xd8aa('0x4a')]){_0x131012['include']=[{'all':!![]}];}_0x131012=_[_0xd8aa('0x49')]({},_0x131012,_0x1fd1dc[_0xd8aa('0x4f')]);return db['SalesforceAccount'][_0xd8aa('0x50')](_0x131012)['then'](handleEntityNotFound(_0x2a24ae,null))[_0xd8aa('0x1b')](respondWithResult(_0x2a24ae,null))[_0xd8aa('0x24')](handleError(_0x2a24ae,null));};exports[_0xd8aa('0x51')]=function(_0x5e2770,_0x5de908){return db['SalesforceAccount']['create'](_0x5e2770[_0xd8aa('0x52')],{})[_0xd8aa('0x1b')](respondWithResult(_0x5de908,0xc9))[_0xd8aa('0x24')](handleError(_0x5de908,null));};exports['update']=function(_0x4c44c2,_0x495a33){if(_0x4c44c2[_0xd8aa('0x52')]['id']){delete _0x4c44c2[_0xd8aa('0x52')]['id'];}return db[_0xd8aa('0x36')][_0xd8aa('0x50')]({'where':{'id':_0x4c44c2[_0xd8aa('0x4d')]['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x495a33,null))[_0xd8aa('0x1b')](saveUpdates(_0x4c44c2[_0xd8aa('0x52')],null))[_0xd8aa('0x1b')](respondWithResult(_0x495a33,null))[_0xd8aa('0x24')](handleError(_0x495a33,null));};exports[_0xd8aa('0x31')]=function(_0x24b935,_0x407b7d){return db['SalesforceAccount']['find']({'where':{'id':_0x24b935[_0xd8aa('0x4d')]['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x407b7d,null))[_0xd8aa('0x1b')](removeEntity(_0x407b7d,null))[_0xd8aa('0x24')](handleError(_0x407b7d,null));};exports['getConfigurations']=function(_0x120ccc,_0x34efde,_0x5875df){var _0x53564e={};var _0x2c5650={};var _0x38e1ec;var _0x157b97;return db[_0xd8aa('0x36')]['findOne']({'where':{'id':_0x120ccc['params']['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x34efde,null))['then'](function(_0x1a0fda){if(_0x1a0fda){_0x38e1ec=_0x1a0fda;_0x2c5650[_0xd8aa('0x3b')]=_[_0xd8aa('0x3a')](db[_0xd8aa('0x53')][_0xd8aa('0x4e')]);_0x2c5650[_0xd8aa('0x39')]=_['keys'](_0x120ccc[_0xd8aa('0x39')]);_0x2c5650[_0xd8aa('0x45')]=_[_0xd8aa('0x3d')](_0x2c5650[_0xd8aa('0x3b')],_0x2c5650[_0xd8aa('0x39')]);_0x53564e[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x2c5650[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x3e')]));_0x53564e[_0xd8aa('0x3c')]=_0x53564e[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x53564e[_0xd8aa('0x3c')]:_0x2c5650[_0xd8aa('0x3b')];_0x53564e[_0xd8aa('0x42')]=qs[_0xd8aa('0x43')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x43')]);_0x53564e[_0xd8aa('0x44')]=qs['filters'](_['pick'](_0x120ccc['query'],_0x2c5650[_0xd8aa('0x45')]));if(_0x120ccc['query'][_0xd8aa('0x47')]){_0x53564e[_0xd8aa('0x44')]=_[_0xd8aa('0x49')](_0x53564e[_0xd8aa('0x44')],{'$or':_[_0xd8aa('0x35')](_0x53564e[_0xd8aa('0x3c')],function(_0xdb3a5f){var _0x26bf3f={};_0x26bf3f[_0xdb3a5f]={'$like':'%'+_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x47')]+'%'};return _0x26bf3f;})});}_0x53564e=_[_0xd8aa('0x49')]({},_0x53564e,_0x120ccc['options']);return _0x38e1ec['getConfigurations'](_0x53564e);}})[_0xd8aa('0x1b')](function(_0x4fdba4){if(_0x4fdba4){_0x157b97=_0x4fdba4[_0xd8aa('0x3f')];if(!_0x120ccc['query']['hasOwnProperty'](_0xd8aa('0x41'))){_0x53564e[_0xd8aa('0x2b')]=qs[_0xd8aa('0x2b')](_0x120ccc[_0xd8aa('0x39')]['limit']);_0x53564e[_0xd8aa('0x2a')]=qs[_0xd8aa('0x2a')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x2a')]);}return _0x38e1ec[_0xd8aa('0x54')](_0x53564e);}})[_0xd8aa('0x1b')](function(_0x20865a){if(_0x20865a){return _0x20865a?{'count':_0x157b97,'rows':_0x20865a}:null;}})[_0xd8aa('0x1b')](respondWithResult(_0x34efde,null))[_0xd8aa('0x24')](handleError(_0x34efde,null));};exports[_0xd8aa('0x55')]=function(_0x552e85,_0x190fdf,_0x4102a3){if(_0x552e85[_0xd8aa('0x52')]['id']){delete _0x552e85['body']['id'];}return db['SalesforceAccount'][_0xd8aa('0x56')]({'where':{'id':_0x552e85[_0xd8aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x190fdf,null))[_0xd8aa('0x1b')](function(_0x36c155){if(_0x36c155){_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x57')]=_0x36c155['id'];_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x58')]=integrations[_0xd8aa('0x59')](_0x552e85['body'][_0xd8aa('0x5a')],_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x37')]);_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x5b')]=integrations[_0xd8aa('0x5c')](_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x5a')],_0x552e85['body'][_0xd8aa('0x37')]);return db[_0xd8aa('0x53')][_0xd8aa('0x51')](_0x552e85['body'],{'include':[{'model':db[_0xd8aa('0x5d')],'as':_0xd8aa('0x58')},{'model':db[_0xd8aa('0x5d')],'as':_0xd8aa('0x5b')}]});}return null;})[_0xd8aa('0x1b')](respondWithResult(_0x190fdf,null))[_0xd8aa('0x24')](handleError(_0x190fdf,null));};exports[_0xd8aa('0x5e')]=function(_0x2c6083,_0x12f182,_0x2ea370){var _0x377a95;var _0x373194='';var _0x2bb705=_0xd8aa('0x5f');return db[_0xd8aa('0x36')][_0xd8aa('0x56')]({'where':{'id':_0x2c6083[_0xd8aa('0x4d')]['id']},'attributes':['id',_0xd8aa('0x60'),'clientId',_0xd8aa('0x61'),_0xd8aa('0x62'),_0xd8aa('0x63'),_0xd8aa('0x64')]})['then'](handleEntityNotFound(_0x12f182,null))[_0xd8aa('0x1b')](function(_0x160a59){if(_0x160a59){_0x373194=_0x160a59[_0xd8aa('0x60')];var _0x8ffb88=_0x373194['slice'](-0x1);if(_0x8ffb88==='/'){_0x373194=_0x373194[_0xd8aa('0x65')](0x0,_0x373194['lastIndexOf'](_0x8ffb88));}_0x377a95=new jsforce[(_0xd8aa('0x66'))]({'oauth2':{'loginUrl':_0x373194,'clientId':_0x160a59[_0xd8aa('0x67')],'clientSecret':_0x160a59[_0xd8aa('0x61')]}});return _0x377a95[_0xd8aa('0x68')](_0x160a59[_0xd8aa('0x62')],_0x160a59[_0xd8aa('0x63')][_0xd8aa('0x69')](_0x160a59['securityToken']));}})['then'](function(_0x2b2222){if(_0x2b2222){if(!_[_0xd8aa('0x6a')](_0x2c6083[_0xd8aa('0x39')]['ticketType'])){_0x2bb705=_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x6b')];}return _0x377a95[_0xd8aa('0x6c')](_0x2bb705)[_0xd8aa('0x6d')]();}})[_0xd8aa('0x1b')](function(_0x518588){var _0x5286ec=[_0xd8aa('0x6e'),'CallDurationInSeconds',_0xd8aa('0x6f'),_0xd8aa('0x70'),_0xd8aa('0x71'),_0xd8aa('0x72'),_0xd8aa('0x73'),_0xd8aa('0x74')];if(!_['isNil'](_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x6b')])&&_0x2c6083[_0xd8aa('0x39')]['ticketType']==='Case'){_0x5286ec=['Type','Origin',_0xd8aa('0x75'),_0xd8aa('0x73'),'Priority','IsEscalated',_0xd8aa('0x76'),_0xd8aa('0x77')];}if(_0x518588){_['remove'](_0x518588['fields'],function(_0x29d8de){return _0x29d8de[_0xd8aa('0x78')]===![]&&!_0x5286ec[_0xd8aa('0x79')](_0x29d8de['name']);});return{'count':_0x518588['fields'][_0xd8aa('0x3f')],'rows':_[_0xd8aa('0x35')](_0x518588[_0xd8aa('0x3e')],function(_0x205bf6){return{'id':_0x205bf6[_0xd8aa('0x33')],'name':_0x205bf6[_0xd8aa('0x7a')],'custom':_0x205bf6[_0xd8aa('0x78')],'options':_0x205bf6[_0xd8aa('0x7b')][_0xd8aa('0x3f')]>0x0?_[_0xd8aa('0x35')](_0x205bf6[_0xd8aa('0x7b')],function(_0x3497a3){return{'name':_0x3497a3[_0xd8aa('0x7a')],'value':_0x3497a3[_0xd8aa('0x7c')]};}):_0x205bf6[_0xd8aa('0x37')]==_0xd8aa('0x7d')?[{'name':'True','value':_0xd8aa('0x7e')},{'name':_0xd8aa('0x7f'),'value':'false'}]:[]};})};}})[_0xd8aa('0x1b')](respondWithResult(_0x12f182,null))[_0xd8aa('0x24')](function(_0x2c3239){var _0x141043=_0x2c6083[_0xd8aa('0x39')]['test']?0x1f4:_0x2c3239[_0xd8aa('0x80')]||0x1f4;logger[_0xd8aa('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0xd8aa('0x5e'),_0x141043,JSON[_0xd8aa('0x1f')](_0x2c3239));delete _0x2c3239['name'];if(_0x141043===0x191){_0x141043=0x190;}_0x12f182[_0xd8aa('0x26')](_0x141043)[_0xd8aa('0x81')](_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x82')]?{'message':_0xd8aa('0x83'),'statusCode':_0x2c3239[_0xd8aa('0x80')]}:_0x2c3239);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f835fe2..818c235 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 _0x81f5=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x75f769,_0x17887a){var _0x26eb07=function(_0x1d6173){while(--_0x1d6173){_0x75f769['push'](_0x75f769['shift']());}};_0x26eb07(++_0x17887a);}(_0x81f5,0x11d));var _0x581f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x81f5[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x581f('0x0'));var util=require(_0x581f('0x1'));var logger=require(_0x581f('0x2'))('api');var moment=require(_0x581f('0x3'));var BPromise=require(_0x581f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x581f('0x5'));var config=require(_0x581f('0x6'));var attributes=require(_0x581f('0x7'));var integrations=require(_0x581f('0x8'));module[_0x581f('0x9')]=function(_0x42649c,_0x453cb4){return _0x42649c[_0x581f('0xa')](_0x581f('0xb'),attributes,{'tableName':_0x581f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe6b=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2af53e,_0x2222e5){var _0x4ed385=function(_0x4a393c){while(--_0x4a393c){_0x2af53e['push'](_0x2af53e['shift']());}};_0x4ed385(++_0x2222e5);}(_0xfe6b,0x10b));var _0xbfe6=function(_0x239a98,_0x288178){_0x239a98=_0x239a98-0x0;var _0x16d789=_0xfe6b[_0x239a98];return _0x16d789;};'use strict';var _=require(_0xbfe6('0x0'));var util=require(_0xbfe6('0x1'));var logger=require(_0xbfe6('0x2'))(_0xbfe6('0x3'));var moment=require('moment');var BPromise=require(_0xbfe6('0x4'));var rp=require(_0xbfe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfe6('0x6'));var config=require(_0xbfe6('0x7'));var attributes=require(_0xbfe6('0x8'));var integrations=require(_0xbfe6('0x9'));module[_0xbfe6('0xa')]=function(_0x49382f,_0x5996c5){return _0x49382f[_0xbfe6('0xb')](_0xbfe6('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 582d7bf..f7237ad 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 _0x5ff3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','ShowSalesforceAccount','raw','util','bluebird','ioredis'];(function(_0x3ad9e3,_0xe2eb88){var _0x1ece84=function(_0x3853a9){while(--_0x3853a9){_0x3ad9e3['push'](_0x3ad9e3['shift']());}};_0x1ece84(++_0xe2eb88);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3cb170,_0x3089d3){_0x3cb170=_0x3cb170-0x0;var _0x183504=_0x5ff3[_0x3cb170];return _0x183504;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});}exports[_0x35ff('0x15')]=function(_0x16c803){var _0x186f6a=this;return new Promise(function(_0x5f470e,_0x2404e5){return db[_0x35ff('0x16')][_0x35ff('0x17')]({'raw':_0x16c803[_0x35ff('0x18')]?_0x16c803['options']['raw']===undefined?!![]:![]:!![],'where':_0x16c803[_0x35ff('0x18')]?_0x16c803[_0x35ff('0x18')]['where']||null:null,'attributes':_0x16c803[_0x35ff('0x18')]?_0x16c803[_0x35ff('0x18')][_0x35ff('0x19')]||null:null,'limit':_0x16c803[_0x35ff('0x18')]?_0x16c803['options'][_0x35ff('0x1a')]||null:null,'include':_0x16c803['options']?_0x16c803[_0x35ff('0x18')][_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x16c803[_0x35ff('0x18')][_0x35ff('0x1b')],function(_0x2b3782){return{'model':db[_0x2b3782[_0x35ff('0x1d')]],'as':_0x2b3782['as'],'attributes':_0x2b3782['attributes'],'include':_0x2b3782[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x2b3782['include'],function(_0x426e4e){return{'model':db[_0x426e4e['model']],'as':_0x426e4e['as'],'attributes':_0x426e4e['attributes'],'include':_0x426e4e[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x426e4e[_0x35ff('0x1b')],function(_0x11a5eb){return{'model':db[_0x11a5eb[_0x35ff('0x1d')]],'as':_0x11a5eb['as'],'attributes':_0x11a5eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x35ff('0xb')](function(_0x412873){logger[_0x35ff('0xc')]('GetSalesforceAccount',_0x16c803);logger[_0x35ff('0xe')](_0x35ff('0x15'),_0x16c803,JSON[_0x35ff('0xf')](_0x412873));_0x5f470e(_0x412873);})[_0x35ff('0x14')](function(_0x47fcb5){logger[_0x35ff('0x10')](_0x35ff('0x15'),_0x47fcb5[_0x35ff('0x12')],_0x16c803);_0x2404e5(_0x186f6a[_0x35ff('0x10')](0x1f4,_0x47fcb5['message']));});});};exports[_0x35ff('0x1e')]=function(_0x57339d){var _0x1cb370=this;return new Promise(function(_0x257501,_0x2bc118){return db[_0x35ff('0x16')]['find']({'raw':_0x57339d[_0x35ff('0x18')]?_0x57339d['options'][_0x35ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x57339d[_0x35ff('0x18')]?_0x57339d['options']['where']||null:null,'attributes':_0x57339d[_0x35ff('0x18')]?_0x57339d[_0x35ff('0x18')]['attributes']||null:null,'include':_0x57339d[_0x35ff('0x18')]?_0x57339d[_0x35ff('0x18')]['include']?_[_0x35ff('0x1c')](_0x57339d[_0x35ff('0x18')][_0x35ff('0x1b')],function(_0x2727c3){return{'model':db[_0x2727c3[_0x35ff('0x1d')]],'as':_0x2727c3['as'],'attributes':_0x2727c3[_0x35ff('0x19')],'include':_0x2727c3[_0x35ff('0x1b')]?_[_0x35ff('0x1c')](_0x2727c3[_0x35ff('0x1b')],function(_0x1a5c81){return{'model':db[_0x1a5c81[_0x35ff('0x1d')]],'as':_0x1a5c81['as'],'attributes':_0x1a5c81[_0x35ff('0x19')],'include':_0x1a5c81[_0x35ff('0x1b')]?_['map'](_0x1a5c81[_0x35ff('0x1b')],function(_0x5c5dcb){return{'model':db[_0x5c5dcb[_0x35ff('0x1d')]],'as':_0x5c5dcb['as'],'attributes':_0x5c5dcb[_0x35ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35ff('0xb')](function(_0x11115d){logger[_0x35ff('0xc')]('ShowSalesforceAccount',_0x57339d);logger[_0x35ff('0xe')](_0x35ff('0x1e'),_0x57339d,JSON[_0x35ff('0xf')](_0x11115d));_0x257501(_0x11115d);})[_0x35ff('0x14')](function(_0x324f6c){logger['error'](_0x35ff('0x1e'),_0x324f6c[_0x35ff('0x12')],_0x57339d);_0x2bc118(_0x1cb370[_0x35ff('0x10')](0x1f4,_0x324f6c['message']));});});}; \ No newline at end of file +var _0x984b=['catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x45b451,_0x37246a){var _0xaddb69=function(_0x161ce2){while(--_0x161ce2){_0x45b451['push'](_0x45b451['shift']());}};_0xaddb69(++_0x37246a);}(_0x984b,0xee));var _0xb984=function(_0x222197,_0x5f2e94){_0x222197=_0x222197-0x0;var _0x4baa2f=_0x984b[_0x222197];return _0x4baa2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetSalesforceAccount']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetSalesforceAccount',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});};exports['ShowSalesforceAccount']=function(_0x10b9ac){var _0x23ecf6=this;return new Promise(function(_0x58a98c,_0x320bef){return db[_0xb984('0x13')][_0xb984('0x1e')]({'raw':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options'][_0xb984('0x18')]||null:null,'include':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x10b9ac[_0xb984('0x15')]['include'],function(_0x54a293){return{'model':db[_0x54a293[_0xb984('0x1c')]],'as':_0x54a293['as'],'attributes':_0x54a293[_0xb984('0x18')],'include':_0x54a293[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x54a293[_0xb984('0x1a')],function(_0x55dc81){return{'model':db[_0x55dc81[_0xb984('0x1c')]],'as':_0x55dc81['as'],'attributes':_0x55dc81[_0xb984('0x18')],'include':_0x55dc81['include']?_['map'](_0x55dc81[_0xb984('0x1a')],function(_0x4a440d){return{'model':db[_0x4a440d[_0xb984('0x1c')]],'as':_0x4a440d['as'],'attributes':_0x4a440d[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349db9){logger['info'](_0xb984('0x1f'),_0x10b9ac);logger['debug'](_0xb984('0x1f'),_0x10b9ac,JSON['stringify'](_0x349db9));_0x58a98c(_0x349db9);})['catch'](function(_0xf6d925){logger[_0xb984('0xe')]('ShowSalesforceAccount',_0xf6d925[_0xb984('0x10')],_0x10b9ac);_0x320bef(_0x23ecf6[_0xb984('0xe')](0x1f4,_0xf6d925['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c3f6b0e..bde122f 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 _0xde38=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde38,0x7b));var _0x8de3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8de3('0x0'));var util=require('util');var path=require(_0x8de3('0x1'));var timeout=require(_0x8de3('0x2'));var express=require(_0x8de3('0x3'));var router=express[_0x8de3('0x4')]();var auth=require(_0x8de3('0x5'));var interaction=require(_0x8de3('0x6'));var config=require(_0x8de3('0x7'));var controller=require(_0x8de3('0x8'));router[_0x8de3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8de3('0x9')](_0x8de3('0xa'),auth[_0x8de3('0xb')](),controller[_0x8de3('0xc')]);router['get']('/:id/fields',auth[_0x8de3('0xb')](),controller['getFields']);router[_0x8de3('0x9')](_0x8de3('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8de3('0x9')](_0x8de3('0xe'),auth[_0x8de3('0xb')](),controller[_0x8de3('0xf')]);router['post']('/',auth[_0x8de3('0xb')](),controller['create']);router['put'](_0x8de3('0xa'),auth[_0x8de3('0xb')](),controller[_0x8de3('0x10')]);router[_0x8de3('0x11')](_0x8de3('0xa'),auth['isAuthenticated'](),controller[_0x8de3('0x12')]);module[_0x8de3('0x13')]=router; \ No newline at end of file +var _0xc517=['getDescriptions','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intSalesforceConfiguration.controller','/:id','show','get','/:id/fields','isAuthenticated','getFields','getSubjects'];(function(_0xfb50f1,_0x4fc983){var _0x205702=function(_0x15da82){while(--_0x15da82){_0xfb50f1['push'](_0xfb50f1['shift']());}};_0x205702(++_0x4fc983);}(_0xc517,0x6a));var _0x7c51=function(_0x14ed50,_0x5eef5c){_0x14ed50=_0x14ed50-0x0;var _0x359b66=_0xc517[_0x14ed50];return _0x359b66;};'use strict';var multer=require('multer');var util=require(_0x7c51('0x0'));var path=require(_0x7c51('0x1'));var timeout=require(_0x7c51('0x2'));var express=require(_0x7c51('0x3'));var router=express[_0x7c51('0x4')]();var auth=require(_0x7c51('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c51('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7c51('0x7'),auth['isAuthenticated'](),controller[_0x7c51('0x8')]);router[_0x7c51('0x9')](_0x7c51('0xa'),auth[_0x7c51('0xb')](),controller[_0x7c51('0xc')]);router['get']('/:id/subjects',auth[_0x7c51('0xb')](),controller[_0x7c51('0xd')]);router[_0x7c51('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7c51('0xe')]);router[_0x7c51('0xf')]('/',auth[_0x7c51('0xb')](),controller['create']);router['put'](_0x7c51('0x7'),auth[_0x7c51('0xb')](),controller[_0x7c51('0x10')]);router[_0x7c51('0x11')](_0x7c51('0x7'),auth[_0x7c51('0xb')](),controller[_0x7c51('0x12')]);module[_0x7c51('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0eb841b..1a2b678 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 _0xdd06=['contact_lead','contact','nothing','lead','exports','STRING','ENUM','Task','Case'];(function(_0x3ffb01,_0x3aff18){var _0x30db9f=function(_0x308a6b){while(--_0x308a6b){_0x3ffb01['push'](_0x3ffb01['shift']());}};_0x30db9f(++_0x3aff18);}(_0xdd06,0x163));var _0x6dd0=function(_0x29d9d5,_0x5a1bd8){_0x29d9d5=_0x29d9d5-0x0;var _0x1be395=_0xdd06[_0x29d9d5];return _0x1be395;};'use strict';var Sequelize=require('sequelize');module[_0x6dd0('0x0')]={'name':{'type':Sequelize[_0x6dd0('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x3'),_0x6dd0('0x4')),'defaultValue':_0x6dd0('0x3')},'moduleSearch':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x5'),_0x6dd0('0x6'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x6dd0('0x2')](_0x6dd0('0x7'),_0x6dd0('0x6'),'lead'),'defaultValue':_0x6dd0('0x8')}}; \ No newline at end of file +var _0x38a9=['ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize','exports','STRING'];(function(_0xc83ec8,_0x543ee2){var _0x263b12=function(_0x4c9670){while(--_0x4c9670){_0xc83ec8['push'](_0xc83ec8['shift']());}};_0x263b12(++_0x543ee2);}(_0x38a9,0x9d));var _0x938a=function(_0x565760,_0x3b3b22){_0x565760=_0x565760-0x0;var _0x1b0ec5=_0x38a9[_0x565760];return _0x1b0ec5;};'use strict';var Sequelize=require(_0x938a('0x0'));module[_0x938a('0x1')]={'name':{'type':Sequelize[_0x938a('0x2')]},'description':{'type':Sequelize[_0x938a('0x2')]},'ticketType':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x4'),_0x938a('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x6'),_0x938a('0x7'),_0x938a('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x9'),_0x938a('0x7'),_0x938a('0x8')),'defaultValue':_0x938a('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 235874f..58be418 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 _0x5ee4=['reject','save','update','destroy','stack','name','send','index','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','SalesforceConfiguration','find','body','findOne','SalesforceField','rawAttributes','order','sort','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','../../mysqldb','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3cb9bc,_0x1c95f5){var _0x5d13ec=function(_0x12feae){while(--_0x12feae){_0x3cb9bc['push'](_0x3cb9bc['shift']());}};_0x5d13ec(++_0x1c95f5);}(_0x5ee4,0x1db));var _0x45ee=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5ee4[_0x178e48];return _0x440d7e;};'use strict';var pdf=require(_0x45ee('0x0'));var emlformat=require(_0x45ee('0x1'));var rimraf=require(_0x45ee('0x2'));var zipdir=require(_0x45ee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45ee('0x4'));var moment=require(_0x45ee('0x5'));var BPromise=require(_0x45ee('0x6'));var Mustache=require(_0x45ee('0x7'));var util=require(_0x45ee('0x8'));var path=require(_0x45ee('0x9'));var sox=require('sox');var csv=require(_0x45ee('0xa'));var ejs=require(_0x45ee('0xb'));var fs=require('fs');var _=require(_0x45ee('0xc'));var squel=require(_0x45ee('0xd'));var crypto=require('crypto');var jsforce=require(_0x45ee('0xe'));var deskjs=require(_0x45ee('0xf'));var toCsv=require(_0x45ee('0xa'));var querystring=require(_0x45ee('0x10'));var Papa=require(_0x45ee('0x11'));var Redis=require(_0x45ee('0x12'));var authService=require(_0x45ee('0x13'));var qs=require(_0x45ee('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45ee('0x15'));var logger=require(_0x45ee('0x16'))(_0x45ee('0x17'));var utils=require(_0x45ee('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x45ee('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x45ee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ba17b,_0x1eac47,_0x16ef6c,_0x49978f){return new BPromise(function(_0xa81f40,_0xb4d9a2){var _0x4c76bd=_0x49978f||client;return _0x4c76bd[_0x45ee('0x1b')](_0x3ba17b,_0x16ef6c)[_0x45ee('0x1c')](function(_0x4d46ae){logger['info'](_0x45ee('0x1d'),_0x1eac47,_0x45ee('0x1e'));logger['debug'](_0x45ee('0x1f'),_0x1eac47,_0x45ee('0x1e'),JSON['stringify'](_0x4d46ae));if(_0x4d46ae[_0x45ee('0x20')]){if(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x21')]===0x1f4){logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);return _0xb4d9a2(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);}logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);return _0xa81f40(_0x4d46ae[_0x45ee('0x20')][_0x45ee('0x22')]);}else{logger[_0x45ee('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eac47,_0x45ee('0x1e'));_0xa81f40(_0x4d46ae['result'][_0x45ee('0x22')]);}})[_0x45ee('0x24')](function(_0xd40506){logger[_0x45ee('0x20')](_0x45ee('0x1d'),_0x1eac47,_0xd40506);_0xb4d9a2(_0xd40506);});});}function respondWithStatusCode(_0x5b9265,_0x1d4343){_0x1d4343=_0x1d4343||0xcc;return function(_0x1a2488){if(_0x1a2488){return _0x5b9265[_0x45ee('0x25')](_0x1d4343);}return _0x5b9265[_0x45ee('0x26')](_0x1d4343)[_0x45ee('0x27')]();};}function respondWithResult(_0x3e4cf3,_0x56dc66){_0x56dc66=_0x56dc66||0xc8;return function(_0xbc6e4e){if(_0xbc6e4e){return _0x3e4cf3[_0x45ee('0x26')](_0x56dc66)[_0x45ee('0x28')](_0xbc6e4e);}};}function respondWithFilteredResult(_0x330330,_0x55fbf4){return function(_0x3786a8){if(_0x3786a8){var _0x3126ba=_0x3786a8[_0x45ee('0x29')],_0x6a9efb=_0x55fbf4[_0x45ee('0x2a')],_0x548b61=_0x55fbf4[_0x45ee('0x2a')]+_0x55fbf4[_0x45ee('0x2b')],_0x120d7c;if(_0x548b61>=_0x3126ba){_0x548b61=_0x3126ba;_0x120d7c=0xc8;}else{_0x120d7c=0xce;}_0x330330[_0x45ee('0x26')](_0x120d7c);return _0x330330[_0x45ee('0x2c')](_0x45ee('0x2d'),_0x6a9efb+'-'+_0x548b61+'/'+_0x3126ba)[_0x45ee('0x28')](_0x3786a8);}return null;};}function patchUpdates(_0x307762){return function(_0x298c97){try{jsonpatch[_0x45ee('0x2e')](_0x298c97,_0x307762,!![]);}catch(_0x8e5b01){return BPromise[_0x45ee('0x2f')](_0x8e5b01);}return _0x298c97[_0x45ee('0x30')]();};}function saveUpdates(_0x348051,_0x36bdb7){return function(_0x37dceb){if(_0x37dceb){return _0x37dceb[_0x45ee('0x31')](_0x348051)[_0x45ee('0x1c')](function(_0x44c404){return _0x44c404;});}return null;};}function removeEntity(_0x2993d2,_0x2a5c00){return function(_0x4b347e){if(_0x4b347e){return _0x4b347e[_0x45ee('0x32')]()[_0x45ee('0x1c')](function(){_0x2993d2['status'](0xcc)[_0x45ee('0x27')]();});}};}function handleEntityNotFound(_0x5c6a7b,_0x5e27b8){return function(_0x25e3d7){if(!_0x25e3d7){_0x5c6a7b['sendStatus'](0x194);}return _0x25e3d7;};}function handleError(_0x1032f1,_0xb4230d){_0xb4230d=_0xb4230d||0x1f4;return function(_0x4ecba8){logger[_0x45ee('0x20')](_0x4ecba8[_0x45ee('0x33')]);if(_0x4ecba8['name']){delete _0x4ecba8[_0x45ee('0x34')];}_0x1032f1['status'](_0xb4230d)[_0x45ee('0x35')](_0x4ecba8);};}exports[_0x45ee('0x36')]=function(_0x45e618,_0x113fff){var _0x886ebe={},_0x146de4={},_0x11444b={'count':0x0,'rows':[]};var _0x2c8682=_[_0x45ee('0x37')](db['SalesforceConfiguration']['rawAttributes'],function(_0x2d95ea){return{'name':_0x2d95ea['fieldName'],'type':_0x2d95ea['type']['key']};});_0x146de4['model']=_[_0x45ee('0x37')](_0x2c8682,'name');_0x146de4[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x45e618[_0x45ee('0x38')]);_0x146de4[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x146de4[_0x45ee('0x3c')],_0x146de4[_0x45ee('0x38')]);_0x886ebe[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x146de4[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x45e618[_0x45ee('0x38')][_0x45ee('0x3e')]));_0x886ebe['attributes']=_0x886ebe[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x886ebe[_0x45ee('0x3d')]:_0x146de4['model'];if(!_0x45e618[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x886ebe[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x45e618[_0x45ee('0x38')]['limit']);_0x886ebe[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x45e618[_0x45ee('0x38')][_0x45ee('0x2a')]);}_0x886ebe['order']=qs['sort'](_0x45e618[_0x45ee('0x38')]['sort']);_0x886ebe[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_[_0x45ee('0x43')](_0x45e618[_0x45ee('0x38')],_0x146de4[_0x45ee('0x3a')]),_0x2c8682);if(_0x45e618['query'][_0x45ee('0x44')]){_0x886ebe[_0x45ee('0x42')]=_['merge'](_0x886ebe[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x2c8682,function(_0x4b4679){if(_0x4b4679['type']!=='VIRTUAL'){var _0x534031={};_0x534031[_0x4b4679[_0x45ee('0x34')]]={'$like':'%'+_0x45e618[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x534031;}})});}_0x886ebe=_[_0x45ee('0x45')]({},_0x886ebe,_0x45e618[_0x45ee('0x46')]);var _0x2e238f={'where':_0x886ebe['where']};return db['SalesforceConfiguration'][_0x45ee('0x29')](_0x2e238f)['then'](function(_0xa57ee4){_0x11444b[_0x45ee('0x29')]=_0xa57ee4;if(_0x45e618[_0x45ee('0x38')][_0x45ee('0x47')]){_0x886ebe['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x45ee('0x48')](_0x886ebe);})[_0x45ee('0x1c')](function(_0x1b2daf){_0x11444b[_0x45ee('0x49')]=_0x1b2daf;return _0x11444b;})['then'](respondWithFilteredResult(_0x113fff,_0x886ebe))[_0x45ee('0x24')](handleError(_0x113fff,null));};exports[_0x45ee('0x4a')]=function(_0xd18d79,_0x391e43){var _0x249dfb={'raw':![],'where':{'id':_0xd18d79[_0x45ee('0x4b')]['id']}},_0x17afca={};_0x17afca[_0x45ee('0x3c')]=_[_0x45ee('0x39')](db[_0x45ee('0x4c')]['rawAttributes']);_0x17afca[_0x45ee('0x38')]=_['keys'](_0xd18d79[_0x45ee('0x38')]);_0x17afca[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x17afca[_0x45ee('0x3c')],_0x17afca[_0x45ee('0x38')]);_0x249dfb[_0x45ee('0x3d')]=_['intersection'](_0x17afca['model'],qs[_0x45ee('0x3e')](_0xd18d79['query'][_0x45ee('0x3e')]));_0x249dfb[_0x45ee('0x3d')]=_0x249dfb[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x249dfb[_0x45ee('0x3d')]:_0x17afca[_0x45ee('0x3c')];if(_0xd18d79['query'][_0x45ee('0x47')]){_0x249dfb['include']=[{'all':!![]}];}_0x249dfb=_['merge']({},_0x249dfb,_0xd18d79[_0x45ee('0x46')]);return db['SalesforceConfiguration'][_0x45ee('0x4d')](_0x249dfb)[_0x45ee('0x1c')](handleEntityNotFound(_0x391e43,null))[_0x45ee('0x1c')](respondWithResult(_0x391e43,null))[_0x45ee('0x24')](handleError(_0x391e43,null));};exports['create']=function(_0xb7e263,_0x135123){return db[_0x45ee('0x4c')]['create'](_0xb7e263['body'],{})[_0x45ee('0x1c')](respondWithResult(_0x135123,0xc9))['catch'](handleError(_0x135123,null));};exports[_0x45ee('0x31')]=function(_0x41fee8,_0x1b373c){if(_0x41fee8[_0x45ee('0x4e')]['id']){delete _0x41fee8[_0x45ee('0x4e')]['id'];}return db[_0x45ee('0x4c')][_0x45ee('0x4d')]({'where':{'id':_0x41fee8[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x1b373c,null))[_0x45ee('0x1c')](saveUpdates(_0x41fee8[_0x45ee('0x4e')],null))[_0x45ee('0x1c')](respondWithResult(_0x1b373c,null))[_0x45ee('0x24')](handleError(_0x1b373c,null));};exports[_0x45ee('0x32')]=function(_0x1f5854,_0x2eeed8){return db['SalesforceConfiguration'][_0x45ee('0x4d')]({'where':{'id':_0x1f5854[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x2eeed8,null))['then'](removeEntity(_0x2eeed8,null))['catch'](handleError(_0x2eeed8,null));};exports['getFields']=function(_0x2da4fb,_0x25d04d,_0x5ef2d9){var _0x20c19e={};var _0xbd4775={};var _0x2199fb;var _0x460906;return db[_0x45ee('0x4c')][_0x45ee('0x4f')]({'where':{'id':_0x2da4fb[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x25d04d,null))['then'](function(_0x197e4e){if(_0x197e4e){_0x2199fb=_0x197e4e;_0xbd4775[_0x45ee('0x3c')]=_['keys'](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0xbd4775[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x2da4fb['query']);_0xbd4775[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0xbd4775[_0x45ee('0x3c')],_0xbd4775[_0x45ee('0x38')]);_0x20c19e['attributes']=_[_0x45ee('0x3b')](_0xbd4775[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x2da4fb[_0x45ee('0x38')]['fields']));_0x20c19e[_0x45ee('0x3d')]=_0x20c19e[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x20c19e[_0x45ee('0x3d')]:_0xbd4775[_0x45ee('0x3c')];_0x20c19e[_0x45ee('0x52')]=qs['sort'](_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x53')]);_0x20c19e[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x2da4fb[_0x45ee('0x38')],_0xbd4775[_0x45ee('0x3a')]));if(_0x2da4fb['query'][_0x45ee('0x44')]){_0x20c19e[_0x45ee('0x42')]=_[_0x45ee('0x45')](_0x20c19e[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x20c19e['attributes'],function(_0x20f286){var _0x13246a={};_0x13246a[_0x20f286]={'$like':'%'+_0x2da4fb['query'][_0x45ee('0x44')]+'%'};return _0x13246a;})});}_0x20c19e=_[_0x45ee('0x45')]({},_0x20c19e,_0x2da4fb[_0x45ee('0x46')]);return _0x2199fb['getFields'](_0x20c19e);}})[_0x45ee('0x1c')](function(_0x23a879){if(_0x23a879){_0x460906=_0x23a879['length'];if(!_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x20c19e['limit']=qs[_0x45ee('0x2b')](_0x2da4fb[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x20c19e[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x2da4fb[_0x45ee('0x38')]['offset']);}return _0x2199fb[_0x45ee('0x54')](_0x20c19e);}})[_0x45ee('0x1c')](function(_0x4fcbe9){if(_0x4fcbe9){return _0x4fcbe9?{'count':_0x460906,'rows':_0x4fcbe9}:null;}})['then'](respondWithResult(_0x25d04d,null))[_0x45ee('0x24')](handleError(_0x25d04d,null));};exports['getSubjects']=function(_0x4bb725,_0x232434,_0x3f7b5d){var _0x27e49e={};var _0x58eaf3={};var _0x437110;var _0x33f4d4;return db[_0x45ee('0x4c')]['findOne']({'where':{'id':_0x4bb725['params']['id']}})['then'](handleEntityNotFound(_0x232434,null))[_0x45ee('0x1c')](function(_0x231f81){if(_0x231f81){_0x437110=_0x231f81;_0x58eaf3['model']=_[_0x45ee('0x39')](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0x58eaf3[_0x45ee('0x38')]=_[_0x45ee('0x39')](_0x4bb725[_0x45ee('0x38')]);_0x58eaf3[_0x45ee('0x3a')]=_[_0x45ee('0x3b')](_0x58eaf3[_0x45ee('0x3c')],_0x58eaf3['query']);_0x27e49e[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x58eaf3[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x3e')]));_0x27e49e[_0x45ee('0x3d')]=_0x27e49e['attributes']['length']?_0x27e49e[_0x45ee('0x3d')]:_0x58eaf3[_0x45ee('0x3c')];_0x27e49e[_0x45ee('0x52')]=qs[_0x45ee('0x53')](_0x4bb725[_0x45ee('0x38')]['sort']);_0x27e49e[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x4bb725[_0x45ee('0x38')],_0x58eaf3[_0x45ee('0x3a')]));if(_0x4bb725[_0x45ee('0x38')][_0x45ee('0x44')]){_0x27e49e[_0x45ee('0x42')]=_[_0x45ee('0x45')](_0x27e49e[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x27e49e['attributes'],function(_0x5793a3){var _0x18aa31={};_0x18aa31[_0x5793a3]={'$like':'%'+_0x4bb725[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x18aa31;})});}_0x27e49e=_[_0x45ee('0x45')]({},_0x27e49e,_0x4bb725['options']);return _0x437110['getSubjects'](_0x27e49e);}})['then'](function(_0x9c6a97){if(_0x9c6a97){_0x33f4d4=_0x9c6a97[_0x45ee('0x3f')];if(!_0x4bb725[_0x45ee('0x38')][_0x45ee('0x40')](_0x45ee('0x41'))){_0x27e49e[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x27e49e[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x4bb725[_0x45ee('0x38')][_0x45ee('0x2a')]);}return _0x437110[_0x45ee('0x55')](_0x27e49e);}})[_0x45ee('0x1c')](function(_0x2b3f3a){if(_0x2b3f3a){return _0x2b3f3a?{'count':_0x33f4d4,'rows':_0x2b3f3a}:null;}})[_0x45ee('0x1c')](respondWithResult(_0x232434,null))[_0x45ee('0x24')](handleError(_0x232434,null));};exports[_0x45ee('0x56')]=function(_0x3d181a,_0x528d29,_0x58eec6){var _0x5d3322={};var _0x486ef={};var _0x305d25;var _0x3f98df;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d181a[_0x45ee('0x4b')]['id']}})[_0x45ee('0x1c')](handleEntityNotFound(_0x528d29,null))[_0x45ee('0x1c')](function(_0xb8a256){if(_0xb8a256){_0x305d25=_0xb8a256;_0x486ef[_0x45ee('0x3c')]=_[_0x45ee('0x39')](db[_0x45ee('0x50')][_0x45ee('0x51')]);_0x486ef['query']=_[_0x45ee('0x39')](_0x3d181a['query']);_0x486ef[_0x45ee('0x3a')]=_['intersection'](_0x486ef[_0x45ee('0x3c')],_0x486ef['query']);_0x5d3322[_0x45ee('0x3d')]=_[_0x45ee('0x3b')](_0x486ef[_0x45ee('0x3c')],qs[_0x45ee('0x3e')](_0x3d181a[_0x45ee('0x38')]['fields']));_0x5d3322[_0x45ee('0x3d')]=_0x5d3322[_0x45ee('0x3d')][_0x45ee('0x3f')]?_0x5d3322['attributes']:_0x486ef[_0x45ee('0x3c')];_0x5d3322[_0x45ee('0x52')]=qs[_0x45ee('0x53')](_0x3d181a[_0x45ee('0x38')][_0x45ee('0x53')]);_0x5d3322[_0x45ee('0x42')]=qs[_0x45ee('0x3a')](_['pick'](_0x3d181a['query'],_0x486ef[_0x45ee('0x3a')]));if(_0x3d181a[_0x45ee('0x38')][_0x45ee('0x44')]){_0x5d3322['where']=_['merge'](_0x5d3322[_0x45ee('0x42')],{'$or':_[_0x45ee('0x37')](_0x5d3322['attributes'],function(_0x3951de){var _0x431259={};_0x431259[_0x3951de]={'$like':'%'+_0x3d181a[_0x45ee('0x38')][_0x45ee('0x44')]+'%'};return _0x431259;})});}_0x5d3322=_[_0x45ee('0x45')]({},_0x5d3322,_0x3d181a['options']);return _0x305d25[_0x45ee('0x56')](_0x5d3322);}})[_0x45ee('0x1c')](function(_0xaec76c){if(_0xaec76c){_0x3f98df=_0xaec76c[_0x45ee('0x3f')];if(!_0x3d181a['query'][_0x45ee('0x40')]('nolimit')){_0x5d3322[_0x45ee('0x2b')]=qs[_0x45ee('0x2b')](_0x3d181a[_0x45ee('0x38')][_0x45ee('0x2b')]);_0x5d3322[_0x45ee('0x2a')]=qs[_0x45ee('0x2a')](_0x3d181a['query'][_0x45ee('0x2a')]);}return _0x305d25[_0x45ee('0x56')](_0x5d3322);}})[_0x45ee('0x1c')](function(_0x5772de){if(_0x5772de){return _0x5772de?{'count':_0x3f98df,'rows':_0x5772de}:null;}})[_0x45ee('0x1c')](respondWithResult(_0x528d29,null))['catch'](handleError(_0x528d29,null));}; \ No newline at end of file +var _0xf2d0=['fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','keys','intersection','includeAll','options','create','body','update','find','findOne','SalesforceField','order','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x13fe79,_0x29366c){var _0x3c58e9=function(_0x581323){while(--_0x581323){_0x13fe79['push'](_0x13fe79['shift']());}};_0x3c58e9(++_0x29366c);}(_0xf2d0,0x1d2));var _0x0f2d=function(_0x4e05f7,_0x4bc33b){_0x4e05f7=_0x4e05f7-0x0;var _0xc93f86=_0xf2d0[_0x4e05f7];return _0xc93f86;};'use strict';var pdf=require(_0x0f2d('0x0'));var emlformat=require(_0x0f2d('0x1'));var rimraf=require(_0x0f2d('0x2'));var zipdir=require(_0x0f2d('0x3'));var jsonpatch=require(_0x0f2d('0x4'));var rp=require('request-promise');var moment=require(_0x0f2d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f2d('0x6'));var util=require(_0x0f2d('0x7'));var path=require(_0x0f2d('0x8'));var sox=require(_0x0f2d('0x9'));var csv=require('to-csv');var ejs=require(_0x0f2d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f2d('0xb'));var crypto=require(_0x0f2d('0xc'));var jsforce=require(_0x0f2d('0xd'));var deskjs=require(_0x0f2d('0xe'));var toCsv=require(_0x0f2d('0xf'));var querystring=require(_0x0f2d('0x10'));var Papa=require(_0x0f2d('0x11'));var Redis=require(_0x0f2d('0x12'));var authService=require(_0x0f2d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0f2d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f2d('0x15'))(_0x0f2d('0x16'));var utils=require(_0x0f2d('0x17'));var config=require(_0x0f2d('0x18'));var licenseUtil=require(_0x0f2d('0x19'));var db=require(_0x0f2d('0x1a'))['db'];var jayson=require(_0x0f2d('0x1b'));var client=jayson[_0x0f2d('0x1c')][_0x0f2d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x26b594,_0x5190f9,_0x34ddab,_0x2e3894){return new BPromise(function(_0x197697,_0x47a74a){var _0x230902=_0x2e3894||client;return _0x230902[_0x0f2d('0x1e')](_0x26b594,_0x34ddab)[_0x0f2d('0x1f')](function(_0x1cd6d6){logger[_0x0f2d('0x20')](_0x0f2d('0x21'),_0x5190f9,_0x0f2d('0x22'));logger[_0x0f2d('0x23')](_0x0f2d('0x24'),_0x5190f9,_0x0f2d('0x22'),JSON['stringify'](_0x1cd6d6));if(_0x1cd6d6[_0x0f2d('0x25')]){if(_0x1cd6d6['error'][_0x0f2d('0x26')]===0x1f4){logger[_0x0f2d('0x25')](_0x0f2d('0x21'),_0x5190f9,_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);return _0x47a74a(_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);}logger['error'](_0x0f2d('0x21'),_0x5190f9,_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);return _0x197697(_0x1cd6d6['error']['message']);}else{logger[_0x0f2d('0x20')](_0x0f2d('0x21'),_0x5190f9,_0x0f2d('0x22'));_0x197697(_0x1cd6d6[_0x0f2d('0x28')][_0x0f2d('0x27')]);}})[_0x0f2d('0x29')](function(_0x3c830e){logger[_0x0f2d('0x25')](_0x0f2d('0x21'),_0x5190f9,_0x3c830e);_0x47a74a(_0x3c830e);});});}function respondWithStatusCode(_0x3f4560,_0x38b3e7){_0x38b3e7=_0x38b3e7||0xcc;return function(_0x291d71){if(_0x291d71){return _0x3f4560[_0x0f2d('0x2a')](_0x38b3e7);}return _0x3f4560[_0x0f2d('0x2b')](_0x38b3e7)[_0x0f2d('0x2c')]();};}function respondWithResult(_0x3d56d1,_0x12f1ab){_0x12f1ab=_0x12f1ab||0xc8;return function(_0x55be64){if(_0x55be64){return _0x3d56d1[_0x0f2d('0x2b')](_0x12f1ab)[_0x0f2d('0x2d')](_0x55be64);}};}function respondWithFilteredResult(_0x21db8c,_0x48112c){return function(_0xc3a655){if(_0xc3a655){var _0x33decc=_0xc3a655['count'],_0x335d59=_0x48112c[_0x0f2d('0x2e')],_0x594e85=_0x48112c[_0x0f2d('0x2e')]+_0x48112c[_0x0f2d('0x2f')],_0x4579af;if(_0x594e85>=_0x33decc){_0x594e85=_0x33decc;_0x4579af=0xc8;}else{_0x4579af=0xce;}_0x21db8c[_0x0f2d('0x2b')](_0x4579af);return _0x21db8c[_0x0f2d('0x30')]('Content-Range',_0x335d59+'-'+_0x594e85+'/'+_0x33decc)[_0x0f2d('0x2d')](_0xc3a655);}return null;};}function patchUpdates(_0x2af199){return function(_0x2a0863){try{jsonpatch[_0x0f2d('0x31')](_0x2a0863,_0x2af199,!![]);}catch(_0x193828){return BPromise[_0x0f2d('0x32')](_0x193828);}return _0x2a0863['save']();};}function saveUpdates(_0xe6bba2,_0x238ccd){return function(_0x3b7ab7){if(_0x3b7ab7){return _0x3b7ab7['update'](_0xe6bba2)['then'](function(_0x306db6){return _0x306db6;});}return null;};}function removeEntity(_0x58c5ee,_0xc8c921){return function(_0x3db254){if(_0x3db254){return _0x3db254['destroy']()[_0x0f2d('0x1f')](function(){_0x58c5ee[_0x0f2d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216f57,_0x4391f4){return function(_0x3c1871){if(!_0x3c1871){_0x216f57['sendStatus'](0x194);}return _0x3c1871;};}function handleError(_0x1f1c47,_0x5a8fd1){_0x5a8fd1=_0x5a8fd1||0x1f4;return function(_0xffb214){logger[_0x0f2d('0x25')](_0xffb214['stack']);if(_0xffb214[_0x0f2d('0x33')]){delete _0xffb214[_0x0f2d('0x33')];}_0x1f1c47['status'](_0x5a8fd1)[_0x0f2d('0x34')](_0xffb214);};}exports[_0x0f2d('0x35')]=function(_0x46905b,_0x490d34){var _0x3160f1={},_0x3f9a8={},_0x3b29d9={'count':0x0,'rows':[]};var _0x12e980=_[_0x0f2d('0x36')](db[_0x0f2d('0x37')][_0x0f2d('0x38')],function(_0x4c6c9c){return{'name':_0x4c6c9c[_0x0f2d('0x39')],'type':_0x4c6c9c[_0x0f2d('0x3a')][_0x0f2d('0x3b')]};});_0x3f9a8[_0x0f2d('0x3c')]=_[_0x0f2d('0x36')](_0x12e980,_0x0f2d('0x33'));_0x3f9a8['query']=_['keys'](_0x46905b[_0x0f2d('0x3d')]);_0x3f9a8[_0x0f2d('0x3e')]=_['intersection'](_0x3f9a8[_0x0f2d('0x3c')],_0x3f9a8[_0x0f2d('0x3d')]);_0x3160f1[_0x0f2d('0x3f')]=_['intersection'](_0x3f9a8[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x3160f1[_0x0f2d('0x3f')]=_0x3160f1[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x3160f1['attributes']:_0x3f9a8[_0x0f2d('0x3c')];if(!_0x46905b[_0x0f2d('0x3d')]['hasOwnProperty']('nolimit')){_0x3160f1[_0x0f2d('0x2f')]=qs[_0x0f2d('0x2f')](_0x46905b[_0x0f2d('0x3d')]['limit']);_0x3160f1[_0x0f2d('0x2e')]=qs[_0x0f2d('0x2e')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}_0x3160f1['order']=qs[_0x0f2d('0x42')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x42')]);_0x3160f1[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x46905b[_0x0f2d('0x3d')],_0x3f9a8['filters']),_0x12e980);if(_0x46905b['query'][_0x0f2d('0x45')]){_0x3160f1['where']=_[_0x0f2d('0x46')](_0x3160f1[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x12e980,function(_0x2db07e){if(_0x2db07e['type']!==_0x0f2d('0x47')){var _0x4a7e92={};_0x4a7e92[_0x2db07e[_0x0f2d('0x33')]]={'$like':'%'+_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x4a7e92;}})});}_0x3160f1=_[_0x0f2d('0x46')]({},_0x3160f1,_0x46905b['options']);var _0x3dbe24={'where':_0x3160f1[_0x0f2d('0x43')]};return db[_0x0f2d('0x37')][_0x0f2d('0x48')](_0x3dbe24)[_0x0f2d('0x1f')](function(_0x4fc138){_0x3b29d9[_0x0f2d('0x48')]=_0x4fc138;if(_0x46905b[_0x0f2d('0x3d')]['includeAll']){_0x3160f1[_0x0f2d('0x49')]=[{'all':!![]}];}return db[_0x0f2d('0x37')][_0x0f2d('0x4a')](_0x3160f1);})[_0x0f2d('0x1f')](function(_0x14575a){_0x3b29d9[_0x0f2d('0x4b')]=_0x14575a;return _0x3b29d9;})[_0x0f2d('0x1f')](respondWithFilteredResult(_0x490d34,_0x3160f1))[_0x0f2d('0x29')](handleError(_0x490d34,null));};exports[_0x0f2d('0x4c')]=function(_0x136792,_0x3f281c){var _0x57ced4={'raw':![],'where':{'id':_0x136792[_0x0f2d('0x4d')]['id']}},_0x8964d9={};_0x8964d9[_0x0f2d('0x3c')]=_[_0x0f2d('0x4e')](db[_0x0f2d('0x37')][_0x0f2d('0x38')]);_0x8964d9[_0x0f2d('0x3d')]=_['keys'](_0x136792[_0x0f2d('0x3d')]);_0x8964d9[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x8964d9[_0x0f2d('0x3c')],_0x8964d9[_0x0f2d('0x3d')]);_0x57ced4[_0x0f2d('0x3f')]=_['intersection'](_0x8964d9[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x136792[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x57ced4[_0x0f2d('0x3f')]=_0x57ced4[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x57ced4[_0x0f2d('0x3f')]:_0x8964d9['model'];if(_0x136792[_0x0f2d('0x3d')][_0x0f2d('0x50')]){_0x57ced4['include']=[{'all':!![]}];}_0x57ced4=_[_0x0f2d('0x46')]({},_0x57ced4,_0x136792[_0x0f2d('0x51')]);return db[_0x0f2d('0x37')]['find'](_0x57ced4)['then'](handleEntityNotFound(_0x3f281c,null))['then'](respondWithResult(_0x3f281c,null))[_0x0f2d('0x29')](handleError(_0x3f281c,null));};exports['create']=function(_0x3d5b7c,_0x490651){return db[_0x0f2d('0x37')][_0x0f2d('0x52')](_0x3d5b7c[_0x0f2d('0x53')],{})[_0x0f2d('0x1f')](respondWithResult(_0x490651,0xc9))[_0x0f2d('0x29')](handleError(_0x490651,null));};exports[_0x0f2d('0x54')]=function(_0x4cc1fa,_0x4ff777){if(_0x4cc1fa[_0x0f2d('0x53')]['id']){delete _0x4cc1fa[_0x0f2d('0x53')]['id'];}return db[_0x0f2d('0x37')]['find']({'where':{'id':_0x4cc1fa[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x4ff777,null))[_0x0f2d('0x1f')](saveUpdates(_0x4cc1fa[_0x0f2d('0x53')],null))[_0x0f2d('0x1f')](respondWithResult(_0x4ff777,null))[_0x0f2d('0x29')](handleError(_0x4ff777,null));};exports['destroy']=function(_0x168403,_0x1e8b02){return db[_0x0f2d('0x37')][_0x0f2d('0x55')]({'where':{'id':_0x168403[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x1e8b02,null))[_0x0f2d('0x1f')](removeEntity(_0x1e8b02,null))['catch'](handleError(_0x1e8b02,null));};exports['getFields']=function(_0x10ebf3,_0x1d7b43,_0x36a3de){var _0x5798c4={};var _0x215c14={};var _0xc90dad;var _0x5a2a26;return db[_0x0f2d('0x37')][_0x0f2d('0x56')]({'where':{'id':_0x10ebf3[_0x0f2d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d7b43,null))[_0x0f2d('0x1f')](function(_0x2b62b2){if(_0x2b62b2){_0xc90dad=_0x2b62b2;_0x215c14[_0x0f2d('0x3c')]=_['keys'](db[_0x0f2d('0x57')]['rawAttributes']);_0x215c14[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x10ebf3[_0x0f2d('0x3d')]);_0x215c14[_0x0f2d('0x3e')]=_['intersection'](_0x215c14[_0x0f2d('0x3c')],_0x215c14[_0x0f2d('0x3d')]);_0x5798c4[_0x0f2d('0x3f')]=_['intersection'](_0x215c14['model'],qs['fields'](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x5798c4['attributes']=_0x5798c4['attributes'][_0x0f2d('0x41')]?_0x5798c4[_0x0f2d('0x3f')]:_0x215c14[_0x0f2d('0x3c')];_0x5798c4[_0x0f2d('0x58')]=qs[_0x0f2d('0x42')](_0x10ebf3[_0x0f2d('0x3d')]['sort']);_0x5798c4[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x10ebf3[_0x0f2d('0x3d')],_0x215c14['filters']));if(_0x10ebf3[_0x0f2d('0x3d')]['filter']){_0x5798c4['where']=_[_0x0f2d('0x46')](_0x5798c4[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x5798c4[_0x0f2d('0x3f')],function(_0x35634d){var _0x5a3a4b={};_0x5a3a4b[_0x35634d]={'$like':'%'+_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x5a3a4b;})});}_0x5798c4=_[_0x0f2d('0x46')]({},_0x5798c4,_0x10ebf3[_0x0f2d('0x51')]);return _0xc90dad[_0x0f2d('0x59')](_0x5798c4);}})['then'](function(_0x159a8e){if(_0x159a8e){_0x5a2a26=_0x159a8e['length'];if(!_0x10ebf3['query'][_0x0f2d('0x5a')](_0x0f2d('0x5b'))){_0x5798c4[_0x0f2d('0x2f')]=qs[_0x0f2d('0x2f')](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x2f')]);_0x5798c4['offset']=qs[_0x0f2d('0x2e')](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}return _0xc90dad[_0x0f2d('0x59')](_0x5798c4);}})[_0x0f2d('0x1f')](function(_0x4d12a3){if(_0x4d12a3){return _0x4d12a3?{'count':_0x5a2a26,'rows':_0x4d12a3}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x1d7b43,null))[_0x0f2d('0x29')](handleError(_0x1d7b43,null));};exports[_0x0f2d('0x5c')]=function(_0x2e83d6,_0x1f857a,_0x8cda7e){var _0x4fbffb={};var _0x23b97e={};var _0x47b0e9;var _0x163ed3;return db[_0x0f2d('0x37')][_0x0f2d('0x56')]({'where':{'id':_0x2e83d6['params']['id']}})['then'](handleEntityNotFound(_0x1f857a,null))['then'](function(_0x1b749c){if(_0x1b749c){_0x47b0e9=_0x1b749c;_0x23b97e[_0x0f2d('0x3c')]=_[_0x0f2d('0x4e')](db[_0x0f2d('0x57')][_0x0f2d('0x38')]);_0x23b97e[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x2e83d6['query']);_0x23b97e[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x23b97e[_0x0f2d('0x3c')],_0x23b97e[_0x0f2d('0x3d')]);_0x4fbffb[_0x0f2d('0x3f')]=_['intersection'](_0x23b97e[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x4fbffb['attributes']=_0x4fbffb[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x4fbffb['attributes']:_0x23b97e['model'];_0x4fbffb[_0x0f2d('0x58')]=qs['sort'](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x42')]);_0x4fbffb[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x2e83d6['query'],_0x23b97e[_0x0f2d('0x3e')]));if(_0x2e83d6['query'][_0x0f2d('0x45')]){_0x4fbffb[_0x0f2d('0x43')]=_[_0x0f2d('0x46')](_0x4fbffb['where'],{'$or':_[_0x0f2d('0x36')](_0x4fbffb[_0x0f2d('0x3f')],function(_0x43bd3e){var _0x462283={};_0x462283[_0x43bd3e]={'$like':'%'+_0x2e83d6['query'][_0x0f2d('0x45')]+'%'};return _0x462283;})});}_0x4fbffb=_['merge']({},_0x4fbffb,_0x2e83d6['options']);return _0x47b0e9[_0x0f2d('0x5c')](_0x4fbffb);}})['then'](function(_0x27161a){if(_0x27161a){_0x163ed3=_0x27161a[_0x0f2d('0x41')];if(!_0x2e83d6['query'][_0x0f2d('0x5a')]('nolimit')){_0x4fbffb[_0x0f2d('0x2f')]=qs['limit'](_0x2e83d6['query'][_0x0f2d('0x2f')]);_0x4fbffb['offset']=qs[_0x0f2d('0x2e')](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}return _0x47b0e9[_0x0f2d('0x5c')](_0x4fbffb);}})[_0x0f2d('0x1f')](function(_0xec80b){if(_0xec80b){return _0xec80b?{'count':_0x163ed3,'rows':_0xec80b}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x1f857a,null))[_0x0f2d('0x29')](handleError(_0x1f857a,null));};exports[_0x0f2d('0x5d')]=function(_0x471ef0,_0x187716,_0x659f17){var _0x307334={};var _0x59198c={};var _0x201210;var _0x3f91d8;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x471ef0[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x187716,null))[_0x0f2d('0x1f')](function(_0x346074){if(_0x346074){_0x201210=_0x346074;_0x59198c[_0x0f2d('0x3c')]=_['keys'](db[_0x0f2d('0x57')]['rawAttributes']);_0x59198c[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x471ef0[_0x0f2d('0x3d')]);_0x59198c[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x59198c['model'],_0x59198c[_0x0f2d('0x3d')]);_0x307334['attributes']=_['intersection'](_0x59198c[_0x0f2d('0x3c')],qs['fields'](_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x307334[_0x0f2d('0x3f')]=_0x307334[_0x0f2d('0x3f')]['length']?_0x307334['attributes']:_0x59198c[_0x0f2d('0x3c')];_0x307334[_0x0f2d('0x58')]=qs[_0x0f2d('0x42')](_0x471ef0['query']['sort']);_0x307334[_0x0f2d('0x43')]=qs['filters'](_[_0x0f2d('0x44')](_0x471ef0[_0x0f2d('0x3d')],_0x59198c[_0x0f2d('0x3e')]));if(_0x471ef0['query'][_0x0f2d('0x45')]){_0x307334[_0x0f2d('0x43')]=_[_0x0f2d('0x46')](_0x307334[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x307334['attributes'],function(_0x1d9e2e){var _0x50b8d5={};_0x50b8d5[_0x1d9e2e]={'$like':'%'+_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x50b8d5;})});}_0x307334=_[_0x0f2d('0x46')]({},_0x307334,_0x471ef0['options']);return _0x201210['getDescriptions'](_0x307334);}})[_0x0f2d('0x1f')](function(_0x4fdff3){if(_0x4fdff3){_0x3f91d8=_0x4fdff3[_0x0f2d('0x41')];if(!_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x5a')]('nolimit')){_0x307334['limit']=qs['limit'](_0x471ef0[_0x0f2d('0x3d')]['limit']);_0x307334['offset']=qs['offset'](_0x471ef0['query'][_0x0f2d('0x2e')]);}return _0x201210['getDescriptions'](_0x307334);}})[_0x0f2d('0x1f')](function(_0x3c2ce5){if(_0x3c2ce5){return _0x3c2ce5?{'count':_0x3f91d8,'rows':_0x3c2ce5}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x187716,null))[_0x0f2d('0x29')](handleError(_0x187716,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 36706ca..e3c57c1 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 _0xc2ac=['./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc2ac,0xe8));var _0xcc2a=function(_0x4b438a,_0x1a45dd){_0x4b438a=_0x4b438a-0x0;var _0x2704e1=_0xc2ac[_0x4b438a];return _0x2704e1;};'use strict';var _=require('lodash');var util=require(_0xcc2a('0x0'));var logger=require(_0xcc2a('0x1'))(_0xcc2a('0x2'));var moment=require(_0xcc2a('0x3'));var BPromise=require(_0xcc2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc2a('0x5'));var rimraf=require(_0xcc2a('0x6'));var config=require(_0xcc2a('0x7'));var attributes=require(_0xcc2a('0x8'));module['exports']=function(_0x27d301,_0x188a23){return _0x27d301[_0xcc2a('0x9')](_0xcc2a('0xa'),attributes,{'tableName':_0xcc2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7baf=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x4c9783,_0x3e0a34){var _0x3b5f0e=function(_0x403b09){while(--_0x403b09){_0x4c9783['push'](_0x4c9783['shift']());}};_0x3b5f0e(++_0x3e0a34);}(_0x7baf,0xc5));var _0xf7ba=function(_0x3e7868,_0x31e277){_0x3e7868=_0x3e7868-0x0;var _0x12e82a=_0x7baf[_0x3e7868];return _0x12e82a;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var logger=require(_0xf7ba('0x2'))(_0xf7ba('0x3'));var moment=require(_0xf7ba('0x4'));var BPromise=require(_0xf7ba('0x5'));var rp=require(_0xf7ba('0x6'));var fs=require('fs');var path=require(_0xf7ba('0x7'));var rimraf=require(_0xf7ba('0x8'));var config=require(_0xf7ba('0x9'));var attributes=require(_0xf7ba('0xa'));module['exports']=function(_0x69e793,_0x4f213b){return _0x69e793[_0xf7ba('0xb')](_0xf7ba('0xc'),attributes,{'tableName':_0xf7ba('0xd'),'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 75eb5c5..09d4410 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 _0xb476=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x25c251,_0x1dfab3){var _0x39ab55=function(_0x5752e4){while(--_0x5752e4){_0x25c251['push'](_0x25c251['shift']());}};_0x39ab55(++_0x1dfab3);}(_0xb476,0x14f));var _0x6b47=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xb476[_0x303c30];return _0x43161b;};'use strict';var _=require(_0x6b47('0x0'));var util=require(_0x6b47('0x1'));var moment=require(_0x6b47('0x2'));var BPromise=require(_0x6b47('0x3'));var rs=require(_0x6b47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b47('0x5'))['db'];var utils=require(_0x6b47('0x6'));var logger=require('../../config/logger')(_0x6b47('0x7'));var config=require(_0x6b47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b47('0x9')][_0x6b47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1abad1,_0x47921b,_0x367e11){return new BPromise(function(_0x5566f0,_0x59a192){return client[_0x6b47('0xb')](_0x1abad1,_0x367e11)[_0x6b47('0xc')](function(_0x369b9e){logger[_0x6b47('0xd')](_0x6b47('0xe'),_0x47921b,_0x6b47('0xf'));logger[_0x6b47('0x10')](_0x6b47('0x11'),_0x47921b,'request\x20sent',JSON[_0x6b47('0x12')](_0x369b9e));if(_0x369b9e[_0x6b47('0x13')]){if(_0x369b9e['error'][_0x6b47('0x14')]===0x1f4){logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x369b9e['error'][_0x6b47('0x15')]);return _0x59a192(_0x369b9e['error']['message']);}logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x369b9e[_0x6b47('0x13')][_0x6b47('0x15')]);return _0x5566f0(_0x369b9e[_0x6b47('0x13')][_0x6b47('0x15')]);}else{logger[_0x6b47('0xd')](_0x6b47('0xe'),_0x47921b,'request\x20sent');_0x5566f0(_0x369b9e[_0x6b47('0x16')][_0x6b47('0x15')]);}})[_0x6b47('0x17')](function(_0x31c2df){logger[_0x6b47('0x13')](_0x6b47('0xe'),_0x47921b,_0x31c2df);_0x59a192(_0x31c2df);});});} \ No newline at end of file +var _0x3126=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xc2fdf4,_0x25222f){var _0x3443b7=function(_0x2f5fa5){while(--_0x2f5fa5){_0xc2fdf4['push'](_0xc2fdf4['shift']());}};_0x3443b7(++_0x25222f);}(_0x3126,0x151));var _0x6312=function(_0x1a551e,_0x5e178f){_0x1a551e=_0x1a551e-0x0;var _0x37380e=_0x3126[_0x1a551e];return _0x37380e;};'use strict';var _=require('lodash');var util=require(_0x6312('0x0'));var moment=require(_0x6312('0x1'));var BPromise=require(_0x6312('0x2'));var rs=require(_0x6312('0x3'));var fs=require('fs');var Redis=require(_0x6312('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6312('0x5'));var logger=require(_0x6312('0x6'))(_0x6312('0x7'));var config=require(_0x6312('0x8'));var jayson=require(_0x6312('0x9'));var client=jayson[_0x6312('0xa')][_0x6312('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100539,_0x3504c1,_0x2d2c60){return new BPromise(function(_0x3ad95d,_0x21326e){return client[_0x6312('0xc')](_0x100539,_0x2d2c60)[_0x6312('0xd')](function(_0x211e41){logger[_0x6312('0xe')](_0x6312('0xf'),_0x3504c1,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3504c1,_0x6312('0x10'),JSON[_0x6312('0x11')](_0x211e41));if(_0x211e41[_0x6312('0x12')]){if(_0x211e41[_0x6312('0x12')][_0x6312('0x13')]===0x1f4){logger[_0x6312('0x12')](_0x6312('0xf'),_0x3504c1,_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);return _0x21326e(_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);}logger[_0x6312('0x12')](_0x6312('0xf'),_0x3504c1,_0x211e41[_0x6312('0x12')]['message']);return _0x3ad95d(_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);}else{logger[_0x6312('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3504c1,_0x6312('0x10'));_0x3ad95d(_0x211e41['result'][_0x6312('0x14')]);}})[_0x6312('0x15')](function(_0x3a8569){logger[_0x6312('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3504c1,_0x3a8569);_0x21326e(_0x3a8569);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2f4ce42..10e4463 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 _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x326f,0xd1));var _0xf326=function(_0x3bde9f,_0x504ef9){_0x3bde9f=_0x3bde9f-0x0;var _0xe539cd=_0x326f[_0x3bde9f];return _0xe539cd;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x13f0f9,_0x30f9c9){var _0x5b832c=function(_0x2d3f5e){while(--_0x2d3f5e){_0x13f0f9['push'](_0x13f0f9['shift']());}};_0x5b832c(++_0x30f9c9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2a5a21,_0x43820b){_0x2a5a21=_0x2a5a21-0x0;var _0x2d99ca=_0xd8fb[_0x2a5a21];return _0x2d99ca;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./intSalesforceField.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/:id',auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0x8')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xa')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e574ee6..e9c2262 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 _0xb2a1=['STRING','sequelize','ENUM','variable','keyValue','string','customVariable'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xb2a1,0x1cf));var _0x1b2a=function(_0x35e57e,_0x383e9b){_0x35e57e=_0x35e57e-0x0;var _0x2a6e43=_0xb2a1[_0x35e57e];return _0x2a6e43;};'use strict';var Sequelize=require(_0x1b2a('0x0'));module['exports']={'type':{'type':Sequelize[_0x1b2a('0x1')]('string',_0x1b2a('0x2'),'customVariable',_0x1b2a('0x3')),'defaultValue':_0x1b2a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1b2a('0x1')](_0x1b2a('0x4'),_0x1b2a('0x2'),_0x1b2a('0x5'))},'keyContent':{'type':Sequelize[_0x1b2a('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bc2=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x1c1f3e,_0x665593){var _0x325903=function(_0x198216){while(--_0x198216){_0x1c1f3e['push'](_0x1c1f3e['shift']());}};_0x325903(++_0x665593);}(_0x9bc2,0x192));var _0x29bc=function(_0x46f00f,_0x3c9ac5){_0x46f00f=_0x46f00f-0x0;var _0x2fd887=_0x9bc2[_0x46f00f];return _0x2fd887;};'use strict';var Sequelize=require(_0x29bc('0x0'));module['exports']={'type':{'type':Sequelize[_0x29bc('0x1')](_0x29bc('0x2'),_0x29bc('0x3'),_0x29bc('0x4'),_0x29bc('0x5')),'defaultValue':_0x29bc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x29bc('0x6')]},'keyType':{'type':Sequelize[_0x29bc('0x1')](_0x29bc('0x2'),_0x29bc('0x3'),_0x29bc('0x4'))},'keyContent':{'type':Sequelize[_0x29bc('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x29bc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e09919d..3630921 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 _0xdb00=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','index','SalesforceField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','map','type','merge','options','where','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb00,0x15f));var _0x0db0=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xdb00[_0x32f6b9];return _0x267d52;};'use strict';var pdf=require(_0x0db0('0x0'));var emlformat=require(_0x0db0('0x1'));var rimraf=require(_0x0db0('0x2'));var zipdir=require(_0x0db0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db0('0x4'));var moment=require(_0x0db0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0db0('0x6'));var util=require(_0x0db0('0x7'));var path=require(_0x0db0('0x8'));var sox=require('sox');var csv=require(_0x0db0('0x9'));var ejs=require(_0x0db0('0xa'));var fs=require('fs');var _=require(_0x0db0('0xb'));var squel=require(_0x0db0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0db0('0xd'));var deskjs=require(_0x0db0('0xe'));var toCsv=require(_0x0db0('0x9'));var querystring=require(_0x0db0('0xf'));var Papa=require(_0x0db0('0x10'));var Redis=require(_0x0db0('0x11'));var authService=require(_0x0db0('0x12'));var qs=require(_0x0db0('0x13'));var as=require(_0x0db0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0db0('0x15'))(_0x0db0('0x16'));var utils=require(_0x0db0('0x17'));var config=require(_0x0db0('0x18'));var licenseUtil=require(_0x0db0('0x19'));var db=require(_0x0db0('0x1a'))['db'];function respondWithStatusCode(_0x4fceb4,_0x576898){_0x576898=_0x576898||0xcc;return function(_0x49a0ec){if(_0x49a0ec){return _0x4fceb4[_0x0db0('0x1b')](_0x576898);}return _0x4fceb4[_0x0db0('0x1c')](_0x576898)[_0x0db0('0x1d')]();};}function respondWithResult(_0x534087,_0x5dbaae){_0x5dbaae=_0x5dbaae||0xc8;return function(_0x51a870){if(_0x51a870){return _0x534087['status'](_0x5dbaae)[_0x0db0('0x1e')](_0x51a870);}};}function respondWithFilteredResult(_0x57bfba,_0x4b0a60){return function(_0x1411f6){if(_0x1411f6){var _0x23dd7d=_0x1411f6[_0x0db0('0x1f')],_0x1733d9=_0x4b0a60['offset'],_0x5326d5=_0x4b0a60[_0x0db0('0x20')]+_0x4b0a60[_0x0db0('0x21')],_0x74cb58;if(_0x5326d5>=_0x23dd7d){_0x5326d5=_0x23dd7d;_0x74cb58=0xc8;}else{_0x74cb58=0xce;}_0x57bfba[_0x0db0('0x1c')](_0x74cb58);return _0x57bfba['set']('Content-Range',_0x1733d9+'-'+_0x5326d5+'/'+_0x23dd7d)[_0x0db0('0x1e')](_0x1411f6);}return null;};}function patchUpdates(_0x564ba4){return function(_0x20ea5b){try{jsonpatch[_0x0db0('0x22')](_0x20ea5b,_0x564ba4,!![]);}catch(_0x205f4c){return BPromise[_0x0db0('0x23')](_0x205f4c);}return _0x20ea5b[_0x0db0('0x24')]();};}function saveUpdates(_0x19d056,_0x5f2f49){return function(_0x117d6b){if(_0x117d6b){return _0x117d6b[_0x0db0('0x25')](_0x19d056)[_0x0db0('0x26')](function(_0x427fd9){return _0x427fd9;});}return null;};}function removeEntity(_0xc508ab,_0xba5e79){return function(_0x4f668b){if(_0x4f668b){return _0x4f668b[_0x0db0('0x27')]()[_0x0db0('0x26')](function(){_0xc508ab[_0x0db0('0x1c')](0xcc)[_0x0db0('0x1d')]();});}};}function handleEntityNotFound(_0x3d5f13,_0x14adfe){return function(_0x4c342c){if(!_0x4c342c){_0x3d5f13['sendStatus'](0x194);}return _0x4c342c;};}function handleError(_0x485c26,_0x3927f3){_0x3927f3=_0x3927f3||0x1f4;return function(_0x2d8cb3){logger['error'](_0x2d8cb3['stack']);if(_0x2d8cb3['name']){delete _0x2d8cb3['name'];}_0x485c26[_0x0db0('0x1c')](_0x3927f3)['send'](_0x2d8cb3);};}exports[_0x0db0('0x28')]=function(_0x33164d,_0x17f963){var _0xdea50d={},_0x1bf0c6={},_0x275b60={'count':0x0,'rows':[]};var _0x5dcf38=_['map'](db[_0x0db0('0x29')][_0x0db0('0x2a')],function(_0x5a7481){return{'name':_0x5a7481[_0x0db0('0x2b')],'type':_0x5a7481['type'][_0x0db0('0x2c')]};});_0x1bf0c6[_0x0db0('0x2d')]=_['map'](_0x5dcf38,_0x0db0('0x2e'));_0x1bf0c6[_0x0db0('0x2f')]=_[_0x0db0('0x30')](_0x33164d[_0x0db0('0x2f')]);_0x1bf0c6[_0x0db0('0x31')]=_[_0x0db0('0x32')](_0x1bf0c6[_0x0db0('0x2d')],_0x1bf0c6[_0x0db0('0x2f')]);_0xdea50d[_0x0db0('0x33')]=_[_0x0db0('0x32')](_0x1bf0c6[_0x0db0('0x2d')],qs[_0x0db0('0x34')](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x34')]));_0xdea50d[_0x0db0('0x33')]=_0xdea50d[_0x0db0('0x33')]['length']?_0xdea50d[_0x0db0('0x33')]:_0x1bf0c6[_0x0db0('0x2d')];if(!_0x33164d[_0x0db0('0x2f')][_0x0db0('0x35')](_0x0db0('0x36'))){_0xdea50d['limit']=qs['limit'](_0x33164d[_0x0db0('0x2f')]['limit']);_0xdea50d['offset']=qs[_0x0db0('0x20')](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x20')]);}_0xdea50d[_0x0db0('0x37')]=qs['sort'](_0x33164d[_0x0db0('0x2f')][_0x0db0('0x38')]);_0xdea50d['where']=qs[_0x0db0('0x31')](_[_0x0db0('0x39')](_0x33164d[_0x0db0('0x2f')],_0x1bf0c6[_0x0db0('0x31')]),_0x5dcf38);if(_0x33164d[_0x0db0('0x2f')][_0x0db0('0x3a')]){_0xdea50d['where']=_['merge'](_0xdea50d['where'],{'$or':_[_0x0db0('0x3b')](_0x5dcf38,function(_0xc03a1b){if(_0xc03a1b[_0x0db0('0x3c')]!=='VIRTUAL'){var _0x2c1f86={};_0x2c1f86[_0xc03a1b[_0x0db0('0x2e')]]={'$like':'%'+_0x33164d[_0x0db0('0x2f')]['filter']+'%'};return _0x2c1f86;}})});}_0xdea50d=_[_0x0db0('0x3d')]({},_0xdea50d,_0x33164d[_0x0db0('0x3e')]);var _0x503b83={'where':_0xdea50d[_0x0db0('0x3f')]};return db[_0x0db0('0x29')][_0x0db0('0x1f')](_0x503b83)[_0x0db0('0x26')](function(_0x5788d1){_0x275b60[_0x0db0('0x1f')]=_0x5788d1;if(_0x33164d['query'][_0x0db0('0x40')]){_0xdea50d[_0x0db0('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x0db0('0x42')](_0xdea50d);})[_0x0db0('0x26')](function(_0x3be188){_0x275b60[_0x0db0('0x43')]=_0x3be188;return _0x275b60;})[_0x0db0('0x26')](respondWithFilteredResult(_0x17f963,_0xdea50d))[_0x0db0('0x44')](handleError(_0x17f963,null));};exports[_0x0db0('0x45')]=function(_0x37feba,_0x4fa145){var _0xefb059={'raw':!![],'where':{'id':_0x37feba[_0x0db0('0x46')]['id']}},_0x5a8fd8={};_0x5a8fd8[_0x0db0('0x2d')]=_[_0x0db0('0x30')](db[_0x0db0('0x29')]['rawAttributes']);_0x5a8fd8[_0x0db0('0x2f')]=_[_0x0db0('0x30')](_0x37feba[_0x0db0('0x2f')]);_0x5a8fd8[_0x0db0('0x31')]=_['intersection'](_0x5a8fd8[_0x0db0('0x2d')],_0x5a8fd8[_0x0db0('0x2f')]);_0xefb059['attributes']=_[_0x0db0('0x32')](_0x5a8fd8[_0x0db0('0x2d')],qs['fields'](_0x37feba[_0x0db0('0x2f')][_0x0db0('0x34')]));_0xefb059[_0x0db0('0x33')]=_0xefb059[_0x0db0('0x33')][_0x0db0('0x47')]?_0xefb059[_0x0db0('0x33')]:_0x5a8fd8['model'];if(_0x37feba['query'][_0x0db0('0x40')]){_0xefb059[_0x0db0('0x41')]=[{'all':!![]}];}_0xefb059=_[_0x0db0('0x3d')]({},_0xefb059,_0x37feba['options']);return db[_0x0db0('0x29')][_0x0db0('0x48')](_0xefb059)[_0x0db0('0x26')](handleEntityNotFound(_0x4fa145,null))[_0x0db0('0x26')](respondWithResult(_0x4fa145,null))[_0x0db0('0x44')](handleError(_0x4fa145,null));};exports['create']=function(_0x35fc51,_0x4de530){return db[_0x0db0('0x29')][_0x0db0('0x49')](_0x35fc51[_0x0db0('0x4a')],{})[_0x0db0('0x26')](respondWithResult(_0x4de530,0xc9))[_0x0db0('0x44')](handleError(_0x4de530,null));};exports[_0x0db0('0x25')]=function(_0x8acf3f,_0x4e9152){if(_0x8acf3f[_0x0db0('0x4a')]['id']){delete _0x8acf3f['body']['id'];}return db[_0x0db0('0x29')]['find']({'where':{'id':_0x8acf3f[_0x0db0('0x46')]['id']}})[_0x0db0('0x26')](handleEntityNotFound(_0x4e9152,null))[_0x0db0('0x26')](saveUpdates(_0x8acf3f[_0x0db0('0x4a')],null))[_0x0db0('0x26')](respondWithResult(_0x4e9152,null))[_0x0db0('0x44')](handleError(_0x4e9152,null));};exports[_0x0db0('0x27')]=function(_0xf5e44e,_0x2adf32){return db[_0x0db0('0x29')][_0x0db0('0x48')]({'where':{'id':_0xf5e44e['params']['id']}})[_0x0db0('0x26')](handleEntityNotFound(_0x2adf32,null))[_0x0db0('0x26')](removeEntity(_0x2adf32,null))[_0x0db0('0x44')](handleError(_0x2adf32,null));}; \ No newline at end of file +var _0xcbd4=['error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','then','catch','show','params','keys','include','options','create','body','update','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save'];(function(_0x3e2e0c,_0x7d1be4){var _0xb29e66=function(_0x132ac7){while(--_0x132ac7){_0x3e2e0c['push'](_0x3e2e0c['shift']());}};_0xb29e66(++_0x7d1be4);}(_0xcbd4,0xcc));var _0x4cbd=function(_0x3fea6a,_0x5bc1f4){_0x3fea6a=_0x3fea6a-0x0;var _0x54f75d=_0xcbd4[_0x3fea6a];return _0x54f75d;};'use strict';var pdf=require(_0x4cbd('0x0'));var emlformat=require(_0x4cbd('0x1'));var rimraf=require(_0x4cbd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4cbd('0x3'));var rp=require(_0x4cbd('0x4'));var moment=require(_0x4cbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4cbd('0x6'));var util=require(_0x4cbd('0x7'));var path=require(_0x4cbd('0x8'));var sox=require(_0x4cbd('0x9'));var csv=require(_0x4cbd('0xa'));var ejs=require(_0x4cbd('0xb'));var fs=require('fs');var _=require(_0x4cbd('0xc'));var squel=require(_0x4cbd('0xd'));var crypto=require(_0x4cbd('0xe'));var jsforce=require(_0x4cbd('0xf'));var deskjs=require(_0x4cbd('0x10'));var toCsv=require(_0x4cbd('0xa'));var querystring=require(_0x4cbd('0x11'));var Papa=require(_0x4cbd('0x12'));var Redis=require('ioredis');var authService=require(_0x4cbd('0x13'));var qs=require(_0x4cbd('0x14'));var as=require(_0x4cbd('0x15'));var hardwareService=require(_0x4cbd('0x16'));var logger=require('../../config/logger')(_0x4cbd('0x17'));var utils=require(_0x4cbd('0x18'));var config=require(_0x4cbd('0x19'));var licenseUtil=require(_0x4cbd('0x1a'));var db=require(_0x4cbd('0x1b'))['db'];function respondWithStatusCode(_0x2e129f,_0x31776d){_0x31776d=_0x31776d||0xcc;return function(_0x3467af){if(_0x3467af){return _0x2e129f[_0x4cbd('0x1c')](_0x31776d);}return _0x2e129f[_0x4cbd('0x1d')](_0x31776d)[_0x4cbd('0x1e')]();};}function respondWithResult(_0x86290b,_0x5b3146){_0x5b3146=_0x5b3146||0xc8;return function(_0x4fbc2d){if(_0x4fbc2d){return _0x86290b['status'](_0x5b3146)[_0x4cbd('0x1f')](_0x4fbc2d);}};}function respondWithFilteredResult(_0x2f0873,_0x1e6188){return function(_0x1cb03c){if(_0x1cb03c){var _0x5e0477=_0x1cb03c[_0x4cbd('0x20')],_0x1823f7=_0x1e6188[_0x4cbd('0x21')],_0x1dea70=_0x1e6188[_0x4cbd('0x21')]+_0x1e6188['limit'],_0x2ce67c;if(_0x1dea70>=_0x5e0477){_0x1dea70=_0x5e0477;_0x2ce67c=0xc8;}else{_0x2ce67c=0xce;}_0x2f0873[_0x4cbd('0x1d')](_0x2ce67c);return _0x2f0873[_0x4cbd('0x22')](_0x4cbd('0x23'),_0x1823f7+'-'+_0x1dea70+'/'+_0x5e0477)['json'](_0x1cb03c);}return null;};}function patchUpdates(_0x176c77){return function(_0x29f66d){try{jsonpatch[_0x4cbd('0x24')](_0x29f66d,_0x176c77,!![]);}catch(_0x1cb529){return BPromise[_0x4cbd('0x25')](_0x1cb529);}return _0x29f66d[_0x4cbd('0x26')]();};}function saveUpdates(_0x256800,_0x728e3f){return function(_0xc81e73){if(_0xc81e73){return _0xc81e73['update'](_0x256800)['then'](function(_0x26c011){return _0x26c011;});}return null;};}function removeEntity(_0x2ecee9,_0x59069f){return function(_0x2a54a3){if(_0x2a54a3){return _0x2a54a3['destroy']()['then'](function(){_0x2ecee9['status'](0xcc)[_0x4cbd('0x1e')]();});}};}function handleEntityNotFound(_0x45e9c2,_0x10db80){return function(_0x3252b6){if(!_0x3252b6){_0x45e9c2[_0x4cbd('0x1c')](0x194);}return _0x3252b6;};}function handleError(_0x548225,_0x111941){_0x111941=_0x111941||0x1f4;return function(_0x22487c){logger[_0x4cbd('0x27')](_0x22487c[_0x4cbd('0x28')]);if(_0x22487c[_0x4cbd('0x29')]){delete _0x22487c[_0x4cbd('0x29')];}_0x548225[_0x4cbd('0x1d')](_0x111941)[_0x4cbd('0x2a')](_0x22487c);};}exports[_0x4cbd('0x2b')]=function(_0x1ab8cf,_0x2fcaa1){var _0x2a9419={},_0x41ffcb={},_0x50375c={'count':0x0,'rows':[]};var _0xf19c44=_[_0x4cbd('0x2c')](db[_0x4cbd('0x2d')][_0x4cbd('0x2e')],function(_0x44a4be){return{'name':_0x44a4be[_0x4cbd('0x2f')],'type':_0x44a4be[_0x4cbd('0x30')][_0x4cbd('0x31')]};});_0x41ffcb[_0x4cbd('0x32')]=_['map'](_0xf19c44,'name');_0x41ffcb['query']=_['keys'](_0x1ab8cf[_0x4cbd('0x33')]);_0x41ffcb[_0x4cbd('0x34')]=_[_0x4cbd('0x35')](_0x41ffcb[_0x4cbd('0x32')],_0x41ffcb['query']);_0x2a9419[_0x4cbd('0x36')]=_[_0x4cbd('0x35')](_0x41ffcb[_0x4cbd('0x32')],qs[_0x4cbd('0x37')](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x37')]));_0x2a9419['attributes']=_0x2a9419[_0x4cbd('0x36')][_0x4cbd('0x38')]?_0x2a9419[_0x4cbd('0x36')]:_0x41ffcb[_0x4cbd('0x32')];if(!_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x39')](_0x4cbd('0x3a'))){_0x2a9419[_0x4cbd('0x3b')]=qs['limit'](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x3b')]);_0x2a9419[_0x4cbd('0x21')]=qs[_0x4cbd('0x21')](_0x1ab8cf['query'][_0x4cbd('0x21')]);}_0x2a9419[_0x4cbd('0x3c')]=qs[_0x4cbd('0x3d')](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x3d')]);_0x2a9419[_0x4cbd('0x3e')]=qs[_0x4cbd('0x34')](_[_0x4cbd('0x3f')](_0x1ab8cf[_0x4cbd('0x33')],_0x41ffcb[_0x4cbd('0x34')]),_0xf19c44);if(_0x1ab8cf[_0x4cbd('0x33')]['filter']){_0x2a9419[_0x4cbd('0x3e')]=_[_0x4cbd('0x40')](_0x2a9419['where'],{'$or':_[_0x4cbd('0x2c')](_0xf19c44,function(_0x3c2dc3){if(_0x3c2dc3[_0x4cbd('0x30')]!==_0x4cbd('0x41')){var _0x48a6d4={};_0x48a6d4[_0x3c2dc3[_0x4cbd('0x29')]]={'$like':'%'+_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x42')]+'%'};return _0x48a6d4;}})});}_0x2a9419=_[_0x4cbd('0x40')]({},_0x2a9419,_0x1ab8cf['options']);var _0xe64f34={'where':_0x2a9419[_0x4cbd('0x3e')]};return db[_0x4cbd('0x2d')][_0x4cbd('0x20')](_0xe64f34)['then'](function(_0x313ccf){_0x50375c[_0x4cbd('0x20')]=_0x313ccf;if(_0x1ab8cf['query'][_0x4cbd('0x43')]){_0x2a9419['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4cbd('0x44')](_0x2a9419);})[_0x4cbd('0x45')](function(_0x3da8c4){_0x50375c['rows']=_0x3da8c4;return _0x50375c;})[_0x4cbd('0x45')](respondWithFilteredResult(_0x2fcaa1,_0x2a9419))[_0x4cbd('0x46')](handleError(_0x2fcaa1,null));};exports[_0x4cbd('0x47')]=function(_0x264fac,_0x43dfc9){var _0x4bf599={'raw':!![],'where':{'id':_0x264fac[_0x4cbd('0x48')]['id']}},_0x507a4a={};_0x507a4a[_0x4cbd('0x32')]=_[_0x4cbd('0x49')](db[_0x4cbd('0x2d')]['rawAttributes']);_0x507a4a[_0x4cbd('0x33')]=_['keys'](_0x264fac[_0x4cbd('0x33')]);_0x507a4a[_0x4cbd('0x34')]=_[_0x4cbd('0x35')](_0x507a4a['model'],_0x507a4a['query']);_0x4bf599['attributes']=_[_0x4cbd('0x35')](_0x507a4a['model'],qs[_0x4cbd('0x37')](_0x264fac['query'][_0x4cbd('0x37')]));_0x4bf599['attributes']=_0x4bf599['attributes'][_0x4cbd('0x38')]?_0x4bf599[_0x4cbd('0x36')]:_0x507a4a[_0x4cbd('0x32')];if(_0x264fac[_0x4cbd('0x33')][_0x4cbd('0x43')]){_0x4bf599[_0x4cbd('0x4a')]=[{'all':!![]}];}_0x4bf599=_['merge']({},_0x4bf599,_0x264fac[_0x4cbd('0x4b')]);return db[_0x4cbd('0x2d')]['find'](_0x4bf599)[_0x4cbd('0x45')](handleEntityNotFound(_0x43dfc9,null))[_0x4cbd('0x45')](respondWithResult(_0x43dfc9,null))[_0x4cbd('0x46')](handleError(_0x43dfc9,null));};exports[_0x4cbd('0x4c')]=function(_0x4da652,_0xc20cb4){return db[_0x4cbd('0x2d')]['create'](_0x4da652[_0x4cbd('0x4d')],{})[_0x4cbd('0x45')](respondWithResult(_0xc20cb4,0xc9))[_0x4cbd('0x46')](handleError(_0xc20cb4,null));};exports[_0x4cbd('0x4e')]=function(_0x44e346,_0x47c7ec){if(_0x44e346[_0x4cbd('0x4d')]['id']){delete _0x44e346['body']['id'];}return db[_0x4cbd('0x2d')][_0x4cbd('0x4f')]({'where':{'id':_0x44e346[_0x4cbd('0x48')]['id']}})[_0x4cbd('0x45')](handleEntityNotFound(_0x47c7ec,null))[_0x4cbd('0x45')](saveUpdates(_0x44e346[_0x4cbd('0x4d')],null))[_0x4cbd('0x45')](respondWithResult(_0x47c7ec,null))[_0x4cbd('0x46')](handleError(_0x47c7ec,null));};exports[_0x4cbd('0x50')]=function(_0x55ab38,_0x1e5994){return db[_0x4cbd('0x2d')]['find']({'where':{'id':_0x55ab38[_0x4cbd('0x48')]['id']}})[_0x4cbd('0x45')](handleEntityNotFound(_0x1e5994,null))['then'](removeEntity(_0x1e5994,null))[_0x4cbd('0x46')](handleError(_0x1e5994,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f42e871..f8a27fb 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 _0x3b41=['rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5bf034,_0xa7891b){var _0x232f13=function(_0x317bff){while(--_0x317bff){_0x5bf034['push'](_0x5bf034['shift']());}};_0x232f13(++_0xa7891b);}(_0x3b41,0x78));var _0x13b4=function(_0x2888ab,_0x4f8bd1){_0x2888ab=_0x2888ab-0x0;var _0x311ee5=_0x3b41[_0x2888ab];return _0x311ee5;};'use strict';var _=require(_0x13b4('0x0'));var util=require(_0x13b4('0x1'));var logger=require(_0x13b4('0x2'))(_0x13b4('0x3'));var moment=require('moment');var BPromise=require(_0x13b4('0x4'));var rp=require(_0x13b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x13b4('0x7'));module[_0x13b4('0x8')]=function(_0x3b9892,_0xf6d1f4){return _0x3b9892[_0x13b4('0x9')](_0x13b4('0xa'),attributes,{'tableName':_0x13b4('0xb'),'paranoid':![],'indexes':[{'name':_0x13b4('0xc'),'fields':[_0x13b4('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab5e=['moment','bluebird','request-promise','rimraf','../../config/environment','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0xab5e,0x183));var _0xeab5=function(_0x17ce8a,_0x392cbc){_0x17ce8a=_0x17ce8a-0x0;var _0x475c48=_0xab5e[_0x17ce8a];return _0x475c48;};'use strict';var _=require('lodash');var util=require(_0xeab5('0x0'));var logger=require(_0xeab5('0x1'))(_0xeab5('0x2'));var moment=require(_0xeab5('0x3'));var BPromise=require(_0xeab5('0x4'));var rp=require(_0xeab5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeab5('0x6'));var config=require(_0xeab5('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x3013fe,_0x5b1c2a){return _0x3013fe[_0xeab5('0x8')]('SalesforceField',attributes,{'tableName':_0xeab5('0x9'),'paranoid':![],'indexes':[{'name':_0xeab5('0xa'),'fields':[_0xeab5('0xb'),_0xeab5('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 fbe3070..76e749e 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 _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x544091,_0x34053b){var _0x2cce91=function(_0x189144){while(--_0x189144){_0x544091['push'](_0x544091['shift']());}};_0x2cce91(++_0x34053b);}(_0x153f,0x15b));var _0xf153=function(_0x2e9631,_0x2ec0d1){_0x2e9631=_0x2e9631-0x0;var _0xbca589=_0x153f[_0x2e9631];return _0xbca589;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0xac4a=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac4a,0x13f));var _0xaac4=function(_0x45b93a,_0x485e4e){_0x45b93a=_0x45b93a-0x0;var _0x11b2d4=_0xac4a[_0x45b93a];return _0x11b2d4;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0b49d1b..80cc9af 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 _0xbe27=['getFields','post','addConfiguration','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations'];(function(_0x552ebb,_0x2c71ef){var _0x5a2928=function(_0x5bf49b){while(--_0x5bf49b){_0x552ebb['push'](_0x552ebb['shift']());}};_0x5a2928(++_0x2c71ef);}(_0xbe27,0x92));var _0x7be2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbe27[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x7be2('0x0'));var path=require(_0x7be2('0x1'));var timeout=require(_0x7be2('0x2'));var express=require(_0x7be2('0x3'));var router=express[_0x7be2('0x4')]();var auth=require(_0x7be2('0x5'));var interaction=require(_0x7be2('0x6'));var config=require(_0x7be2('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x7be2('0x8')]('/',auth['isAuthenticated'](),controller[_0x7be2('0x9')]);router[_0x7be2('0x8')](_0x7be2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7be2('0x8')](_0x7be2('0xb'),auth[_0x7be2('0xc')](),controller[_0x7be2('0xd')]);router[_0x7be2('0x8')]('/:id/fields',auth[_0x7be2('0xc')](),controller[_0x7be2('0xe')]);router[_0x7be2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7be2('0xf')](_0x7be2('0xb'),auth['isAuthenticated'](),controller[_0x7be2('0x10')]);router['put'](_0x7be2('0xa'),auth[_0x7be2('0xc')](),controller[_0x7be2('0x11')]);router[_0x7be2('0x12')](_0x7be2('0xa'),auth['isAuthenticated'](),controller[_0x7be2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x719a=['post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields'];(function(_0x51278e,_0x5aeacc){var _0x58d3fa=function(_0xafc4f7){while(--_0xafc4f7){_0x51278e['push'](_0x51278e['shift']());}};_0x58d3fa(++_0x5aeacc);}(_0x719a,0x16d));var _0xa719=function(_0xf074f6,_0x3b2d98){_0xf074f6=_0xf074f6-0x0;var _0x1fc7bc=_0x719a[_0xf074f6];return _0x1fc7bc;};'use strict';var multer=require(_0xa719('0x0'));var util=require(_0xa719('0x1'));var path=require(_0xa719('0x2'));var timeout=require(_0xa719('0x3'));var express=require(_0xa719('0x4'));var router=express[_0xa719('0x5')]();var auth=require(_0xa719('0x6'));var interaction=require(_0xa719('0x7'));var config=require('../../config/environment');var controller=require(_0xa719('0x8'));router[_0xa719('0x9')]('/',auth[_0xa719('0xa')](),controller[_0xa719('0xb')]);router[_0xa719('0x9')]('/:id',auth[_0xa719('0xa')](),controller[_0xa719('0xc')]);router[_0xa719('0x9')](_0xa719('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa719('0x9')](_0xa719('0xe'),auth[_0xa719('0xa')](),controller['getFields']);router[_0xa719('0xf')]('/',auth[_0xa719('0xa')](),controller[_0xa719('0x10')]);router[_0xa719('0xf')](_0xa719('0xd'),auth[_0xa719('0xa')](),controller['addConfiguration']);router[_0xa719('0x11')](_0xa719('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa719('0x12'),auth[_0xa719('0xa')](),controller['destroy']);module[_0xa719('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 b351ca4..2e58d45 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 _0x0ae6=['username','sequelize','STRING'];(function(_0x345099,_0x5ee98e){var _0x3f516b=function(_0x1515fb){while(--_0x1515fb){_0x345099['push'](_0x345099['shift']());}};_0x3f516b(++_0x5ee98e);}(_0x0ae6,0x172));var _0x60ae=function(_0x1c6953,_0x410f21){_0x1c6953=_0x1c6953-0x0;var _0x1b754f=_0x0ae6[_0x1c6953];return _0x1b754f;};'use strict';var Sequelize=require(_0x60ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x60ae('0x1')]},'description':{'type':Sequelize[_0x60ae('0x1')]},'username':{'type':Sequelize[_0x60ae('0x1')],'unique':_0x60ae('0x2')},'password':{'type':Sequelize[_0x60ae('0x1')]},'email':{'type':Sequelize[_0x60ae('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x60ae('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x425f=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4df3c3,_0x2e96ca){var _0x3c3fbc=function(_0x1dcd1c){while(--_0x1dcd1c){_0x4df3c3['push'](_0x4df3c3['shift']());}};_0x3c3fbc(++_0x2e96ca);}(_0x425f,0xb3));var _0xf425=function(_0xe20738,_0x169fce){_0xe20738=_0xe20738-0x0;var _0x1e16da=_0x425f[_0xe20738];return _0x1e16da;};'use strict';var Sequelize=require(_0xf425('0x0'));module[_0xf425('0x1')]={'name':{'type':Sequelize[_0xf425('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf425('0x2')],'unique':_0xf425('0x3')},'password':{'type':Sequelize[_0xf425('0x2')]},'email':{'type':Sequelize[_0xf425('0x2')]},'remoteUri':{'type':Sequelize[_0xf425('0x2')],'unique':_0xf425('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 e7d95cf..32a26f3 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 _0x5470=['remove','forEach','internalType','label','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','False','false','inactive','value','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','work_start','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects'];(function(_0x358a07,_0x1770c6){var _0x307748=function(_0x13587c){while(--_0x13587c){_0x358a07['push'](_0x358a07['shift']());}};_0x307748(++_0x1770c6);}(_0x5470,0xda));var _0x0547=function(_0x290631,_0xe0a9ea){_0x290631=_0x290631-0x0;var _0x4c628f=_0x5470[_0x290631];return _0x4c628f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0547('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0547('0x1'));var jsonpatch=require(_0x0547('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0547('0x3'));var util=require(_0x0547('0x4'));var path=require(_0x0547('0x5'));var sox=require(_0x0547('0x6'));var csv=require(_0x0547('0x7'));var ejs=require(_0x0547('0x8'));var fs=require('fs');var _=require(_0x0547('0x9'));var squel=require('squel');var crypto=require(_0x0547('0xa'));var jsforce=require(_0x0547('0xb'));var deskjs=require(_0x0547('0xc'));var toCsv=require(_0x0547('0x7'));var querystring=require(_0x0547('0xd'));var Papa=require(_0x0547('0xe'));var Redis=require(_0x0547('0xf'));var authService=require(_0x0547('0x10'));var qs=require(_0x0547('0x11'));var as=require(_0x0547('0x12'));var hardwareService=require(_0x0547('0x13'));var logger=require(_0x0547('0x14'))('api');var utils=require(_0x0547('0x15'));var config=require(_0x0547('0x16'));var licenseUtil=require(_0x0547('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0547('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x0547('0x19')][_0x0547('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x51eeb3,_0x322532,_0x18a81a,_0x196f8f){return new BPromise(function(_0x27bd1d,_0x1a24f5){var _0x300a88=_0x196f8f||client;return _0x300a88[_0x0547('0x1b')](_0x51eeb3,_0x18a81a)[_0x0547('0x1c')](function(_0x4e74fc){logger[_0x0547('0x1d')](_0x0547('0x1e'),_0x322532,_0x0547('0x1f'));logger[_0x0547('0x20')](_0x0547('0x21'),_0x322532,_0x0547('0x1f'),JSON[_0x0547('0x22')](_0x4e74fc));if(_0x4e74fc[_0x0547('0x23')]){if(_0x4e74fc['error'][_0x0547('0x24')]===0x1f4){logger[_0x0547('0x23')](_0x0547('0x1e'),_0x322532,_0x4e74fc['error'][_0x0547('0x25')]);return _0x1a24f5(_0x4e74fc[_0x0547('0x23')][_0x0547('0x25')]);}logger['error'](_0x0547('0x1e'),_0x322532,_0x4e74fc[_0x0547('0x23')][_0x0547('0x25')]);return _0x27bd1d(_0x4e74fc['error'][_0x0547('0x25')]);}else{logger[_0x0547('0x1d')](_0x0547('0x1e'),_0x322532,'request\x20sent');_0x27bd1d(_0x4e74fc[_0x0547('0x26')][_0x0547('0x25')]);}})['catch'](function(_0x2c5652){logger[_0x0547('0x23')](_0x0547('0x1e'),_0x322532,_0x2c5652);_0x1a24f5(_0x2c5652);});});}function respondWithStatusCode(_0x3b963b,_0x20c89f){_0x20c89f=_0x20c89f||0xcc;return function(_0x3a39f8){if(_0x3a39f8){return _0x3b963b[_0x0547('0x27')](_0x20c89f);}return _0x3b963b[_0x0547('0x28')](_0x20c89f)[_0x0547('0x29')]();};}function respondWithResult(_0x1d1746,_0x3cae8b){_0x3cae8b=_0x3cae8b||0xc8;return function(_0x2621bc){if(_0x2621bc){return _0x1d1746[_0x0547('0x28')](_0x3cae8b)['json'](_0x2621bc);}};}function respondWithFilteredResult(_0x293a4a,_0x1d4c36){return function(_0x1b09b2){if(_0x1b09b2){var _0x7faddf=_0x1b09b2[_0x0547('0x2a')],_0x42b98d=_0x1d4c36[_0x0547('0x2b')],_0x14e9aa=_0x1d4c36[_0x0547('0x2b')]+_0x1d4c36[_0x0547('0x2c')],_0x1a105a;if(_0x14e9aa>=_0x7faddf){_0x14e9aa=_0x7faddf;_0x1a105a=0xc8;}else{_0x1a105a=0xce;}_0x293a4a['status'](_0x1a105a);return _0x293a4a[_0x0547('0x2d')](_0x0547('0x2e'),_0x42b98d+'-'+_0x14e9aa+'/'+_0x7faddf)['json'](_0x1b09b2);}return null;};}function patchUpdates(_0x1caca4){return function(_0x1987ac){try{jsonpatch[_0x0547('0x2f')](_0x1987ac,_0x1caca4,!![]);}catch(_0x320e69){return BPromise[_0x0547('0x30')](_0x320e69);}return _0x1987ac[_0x0547('0x31')]();};}function saveUpdates(_0x95d500,_0x5658fc){return function(_0x2d2ed9){if(_0x2d2ed9){return _0x2d2ed9[_0x0547('0x32')](_0x95d500)[_0x0547('0x1c')](function(_0x4982b8){return _0x4982b8;});}return null;};}function removeEntity(_0x4f283a,_0x59df1c){return function(_0x5b81c5){if(_0x5b81c5){return _0x5b81c5[_0x0547('0x33')]()[_0x0547('0x1c')](function(){_0x4f283a[_0x0547('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5202e9,_0x41580b){return function(_0x82288b){if(!_0x82288b){_0x5202e9[_0x0547('0x27')](0x194);}return _0x82288b;};}function handleError(_0xeba16c,_0x32e6b9){_0x32e6b9=_0x32e6b9||0x1f4;return function(_0x31c8f0){logger['error'](_0x31c8f0[_0x0547('0x34')]);if(_0x31c8f0[_0x0547('0x35')]){delete _0x31c8f0[_0x0547('0x35')];}_0xeba16c[_0x0547('0x28')](_0x32e6b9)['send'](_0x31c8f0);};}exports[_0x0547('0x36')]=function(_0x1c7780,_0x2f7343){var _0x246eda={},_0x573282={},_0x3265f8={'count':0x0,'rows':[]};var _0x2fadcf=_[_0x0547('0x37')](db[_0x0547('0x38')][_0x0547('0x39')],function(_0x6a5cf0){return{'name':_0x6a5cf0[_0x0547('0x3a')],'type':_0x6a5cf0['type'][_0x0547('0x3b')]};});_0x573282[_0x0547('0x3c')]=_['map'](_0x2fadcf,'name');_0x573282[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x1c7780[_0x0547('0x3d')]);_0x573282[_0x0547('0x3f')]=_[_0x0547('0x40')](_0x573282[_0x0547('0x3c')],_0x573282[_0x0547('0x3d')]);_0x246eda[_0x0547('0x41')]=_['intersection'](_0x573282[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x1c7780['query'][_0x0547('0x42')]));_0x246eda['attributes']=_0x246eda[_0x0547('0x41')][_0x0547('0x43')]?_0x246eda['attributes']:_0x573282[_0x0547('0x3c')];if(!_0x1c7780[_0x0547('0x3d')][_0x0547('0x44')](_0x0547('0x45'))){_0x246eda[_0x0547('0x2c')]=qs[_0x0547('0x2c')](_0x1c7780[_0x0547('0x3d')]['limit']);_0x246eda[_0x0547('0x2b')]=qs[_0x0547('0x2b')](_0x1c7780['query'][_0x0547('0x2b')]);}_0x246eda[_0x0547('0x46')]=qs['sort'](_0x1c7780['query']['sort']);_0x246eda[_0x0547('0x47')]=qs['filters'](_['pick'](_0x1c7780[_0x0547('0x3d')],_0x573282[_0x0547('0x3f')]),_0x2fadcf);if(_0x1c7780[_0x0547('0x3d')]['filter']){_0x246eda[_0x0547('0x47')]=_['merge'](_0x246eda[_0x0547('0x47')],{'$or':_[_0x0547('0x37')](_0x2fadcf,function(_0x3f89d9){if(_0x3f89d9[_0x0547('0x48')]!==_0x0547('0x49')){var _0x4b4659={};_0x4b4659[_0x3f89d9[_0x0547('0x35')]]={'$like':'%'+_0x1c7780[_0x0547('0x3d')][_0x0547('0x4a')]+'%'};return _0x4b4659;}})});}_0x246eda=_['merge']({},_0x246eda,_0x1c7780[_0x0547('0x4b')]);var _0x1fa2bb={'where':_0x246eda[_0x0547('0x47')]};return db[_0x0547('0x38')][_0x0547('0x2a')](_0x1fa2bb)[_0x0547('0x1c')](function(_0x31a899){_0x3265f8['count']=_0x31a899;if(_0x1c7780[_0x0547('0x3d')]['includeAll']){_0x246eda[_0x0547('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0547('0x4d')](_0x246eda);})[_0x0547('0x1c')](function(_0x386aea){_0x3265f8[_0x0547('0x4e')]=_0x386aea;return _0x3265f8;})[_0x0547('0x1c')](respondWithFilteredResult(_0x2f7343,_0x246eda))[_0x0547('0x4f')](handleError(_0x2f7343,null));};exports[_0x0547('0x50')]=function(_0x238651,_0x54cfcb){var _0x576c92={'raw':![],'where':{'id':_0x238651[_0x0547('0x51')]['id']}},_0x390fca={};_0x390fca[_0x0547('0x3c')]=_[_0x0547('0x3e')](db[_0x0547('0x38')][_0x0547('0x39')]);_0x390fca[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x238651[_0x0547('0x3d')]);_0x390fca[_0x0547('0x3f')]=_[_0x0547('0x40')](_0x390fca[_0x0547('0x3c')],_0x390fca[_0x0547('0x3d')]);_0x576c92[_0x0547('0x41')]=_[_0x0547('0x40')](_0x390fca[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x238651['query'][_0x0547('0x42')]));_0x576c92[_0x0547('0x41')]=_0x576c92[_0x0547('0x41')]['length']?_0x576c92[_0x0547('0x41')]:_0x390fca[_0x0547('0x3c')];if(_0x238651['query'][_0x0547('0x52')]){_0x576c92[_0x0547('0x4c')]=[{'all':!![]}];}_0x576c92=_[_0x0547('0x53')]({},_0x576c92,_0x238651[_0x0547('0x4b')]);return db['ServicenowAccount'][_0x0547('0x54')](_0x576c92)[_0x0547('0x1c')](handleEntityNotFound(_0x54cfcb,null))[_0x0547('0x1c')](respondWithResult(_0x54cfcb,null))[_0x0547('0x4f')](handleError(_0x54cfcb,null));};exports[_0x0547('0x55')]=function(_0x56ba74,_0x1c4146){return db[_0x0547('0x38')][_0x0547('0x55')](_0x56ba74[_0x0547('0x56')],{})[_0x0547('0x1c')](respondWithResult(_0x1c4146,0xc9))[_0x0547('0x4f')](handleError(_0x1c4146,null));};exports[_0x0547('0x32')]=function(_0xc90837,_0x1db118){if(_0xc90837[_0x0547('0x56')]['id']){delete _0xc90837['body']['id'];}return db['ServicenowAccount'][_0x0547('0x54')]({'where':{'id':_0xc90837[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x1db118,null))[_0x0547('0x1c')](saveUpdates(_0xc90837[_0x0547('0x56')],null))['then'](respondWithResult(_0x1db118,null))[_0x0547('0x4f')](handleError(_0x1db118,null));};exports[_0x0547('0x33')]=function(_0x1281c9,_0x141560){return db[_0x0547('0x38')][_0x0547('0x54')]({'where':{'id':_0x1281c9[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x141560,null))['then'](removeEntity(_0x141560,null))[_0x0547('0x4f')](handleError(_0x141560,null));};exports[_0x0547('0x57')]=function(_0x25db6e,_0x2b76a6,_0x4d5d13){var _0x3cb917={};var _0xb2abbf={};var _0x22bab4;var _0x3fbb43;return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x25db6e[_0x0547('0x51')]['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x2b76a6,null))[_0x0547('0x1c')](function(_0x460369){if(_0x460369){_0x22bab4=_0x460369;_0xb2abbf['model']=_[_0x0547('0x3e')](db[_0x0547('0x59')][_0x0547('0x39')]);_0xb2abbf[_0x0547('0x3d')]=_[_0x0547('0x3e')](_0x25db6e[_0x0547('0x3d')]);_0xb2abbf[_0x0547('0x3f')]=_[_0x0547('0x40')](_0xb2abbf['model'],_0xb2abbf[_0x0547('0x3d')]);_0x3cb917[_0x0547('0x41')]=_[_0x0547('0x40')](_0xb2abbf[_0x0547('0x3c')],qs[_0x0547('0x42')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x42')]));_0x3cb917[_0x0547('0x41')]=_0x3cb917[_0x0547('0x41')]['length']?_0x3cb917[_0x0547('0x41')]:_0xb2abbf['model'];_0x3cb917['order']=qs[_0x0547('0x5a')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x5a')]);_0x3cb917[_0x0547('0x47')]=qs[_0x0547('0x3f')](_['pick'](_0x25db6e[_0x0547('0x3d')],_0xb2abbf[_0x0547('0x3f')]));if(_0x25db6e['query'][_0x0547('0x4a')]){_0x3cb917[_0x0547('0x47')]=_[_0x0547('0x53')](_0x3cb917[_0x0547('0x47')],{'$or':_['map'](_0x3cb917[_0x0547('0x41')],function(_0x4d3482){var _0x56bc81={};_0x56bc81[_0x4d3482]={'$like':'%'+_0x25db6e[_0x0547('0x3d')]['filter']+'%'};return _0x56bc81;})});}_0x3cb917=_['merge']({},_0x3cb917,_0x25db6e[_0x0547('0x4b')]);return _0x22bab4[_0x0547('0x57')](_0x3cb917);}})[_0x0547('0x1c')](function(_0x377167){if(_0x377167){_0x3fbb43=_0x377167['length'];if(!_0x25db6e[_0x0547('0x3d')][_0x0547('0x44')](_0x0547('0x45'))){_0x3cb917[_0x0547('0x2c')]=qs[_0x0547('0x2c')](_0x25db6e[_0x0547('0x3d')]['limit']);_0x3cb917[_0x0547('0x2b')]=qs[_0x0547('0x2b')](_0x25db6e[_0x0547('0x3d')][_0x0547('0x2b')]);}return _0x22bab4[_0x0547('0x57')](_0x3cb917);}})[_0x0547('0x1c')](function(_0x586e85){if(_0x586e85){return _0x586e85?{'count':_0x3fbb43,'rows':_0x586e85}:null;}})[_0x0547('0x1c')](respondWithResult(_0x2b76a6,null))['catch'](handleError(_0x2b76a6,null));};exports['addConfiguration']=function(_0x19d371,_0x198503,_0x34da7f){if(_0x19d371['body']['id']){delete _0x19d371['body']['id'];}return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x19d371['params']['id']}})[_0x0547('0x1c')](handleEntityNotFound(_0x198503,null))[_0x0547('0x1c')](function(_0x355e3d){if(_0x355e3d){_0x19d371[_0x0547('0x56')][_0x0547('0x5b')]=_0x355e3d['id'];_0x19d371['body'][_0x0547('0x5c')]=integrations[_0x0547('0x5d')](_0x19d371[_0x0547('0x56')]['channel'],_0x19d371[_0x0547('0x56')][_0x0547('0x48')]);_0x19d371['body'][_0x0547('0x5e')]=integrations[_0x0547('0x5f')](_0x19d371['body'][_0x0547('0x60')],_0x19d371[_0x0547('0x56')][_0x0547('0x48')]);return db[_0x0547('0x59')][_0x0547('0x55')](_0x19d371[_0x0547('0x56')],{'include':[{'model':db[_0x0547('0x61')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x0547('0x5e')}]});}return null;})['then'](respondWithResult(_0x198503,null))[_0x0547('0x4f')](handleError(_0x198503,null));};exports[_0x0547('0x62')]=function(_0x19d90f,_0x3dd9c1,_0x3ec857){var _0x4ad209=[_0x0547('0x63'),_0x0547('0x64'),_0x0547('0x65'),'subcategory',_0x0547('0x66'),_0x0547('0x67'),_0x0547('0x68'),_0x0547('0x69'),_0x0547('0x6a')];var _0x1895ca=[_0x0547('0x6b'),_0x0547('0x63'),_0x0547('0x6c'),_0x0547('0x6d'),_0x0547('0x6e'),_0x0547('0x6f'),_0x0547('0x70'),_0x0547('0x64'),_0x0547('0x71'),_0x0547('0x72'),_0x0547('0x73'),_0x0547('0x74'),_0x0547('0x75'),'user_input',_0x0547('0x76'),_0x0547('0x77'),_0x0547('0x78'),'sys_created_by',_0x0547('0x65'),'order',_0x0547('0x79'),_0x0547('0x7a'),_0x0547('0x7b'),_0x0547('0x7c'),_0x0547('0x7d'),_0x0547('0x7e'),_0x0547('0x7f'),_0x0547('0x80'),_0x0547('0x81'),'sys_domain_path',_0x0547('0x82'),_0x0547('0x83'),_0x0547('0x84'),_0x0547('0x85'),_0x0547('0x86'),_0x0547('0x87'),_0x0547('0x88'),_0x0547('0x89'),_0x0547('0x8a'),_0x0547('0x8b'),_0x0547('0x8c'),_0x0547('0x8d'),'work_notes',_0x0547('0x8e'),_0x0547('0x66'),_0x0547('0x8f'),'delivery_task',_0x0547('0x90'),'assignment_group','business_stc',_0x0547('0x91'),_0x0547('0x92'),'calendar_duration',_0x0547('0x67'),_0x0547('0x93'),'close_notes',_0x0547('0x94'),_0x0547('0x95'),_0x0547('0x96'),_0x0547('0x97'),_0x0547('0x98'),_0x0547('0x99'),_0x0547('0x68'),'urgency',_0x0547('0x9a'),_0x0547('0x9b'),_0x0547('0x9c'),'activity_due','assigned_to','severity','comments','sla_due',_0x0547('0x9d'),_0x0547('0x9e'),_0x0547('0x9f'),_0x0547('0xa0'),_0x0547('0xa1'),_0x0547('0xa2'),_0x0547('0xa3'),'upon_approval',_0x0547('0xa4'),_0x0547('0xa5'),_0x0547('0x6a')];var _0x4d996b='';var _0x144f47='';var _0x2cfa52=[];var _0x359564='';var _0x25cb86='';var _0x498704=[];var _0x21263e='';var _0x2e6960='';var _0x107705={};var _0x20019c='';return db[_0x0547('0x38')][_0x0547('0x58')]({'where':{'id':_0x19d90f[_0x0547('0x51')]['id']},'attributes':['id',_0x0547('0xa6'),_0x0547('0xa7'),_0x0547('0xa8'),_0x0547('0xa9'),'serverUrl']})[_0x0547('0x1c')](handleEntityNotFound(_0x3dd9c1,null))[_0x0547('0x1c')](function(_0x4f7ebc){if(_0x4f7ebc){_0x20019c=_0x4f7ebc['remoteUri'];var _0x57a072=_0x20019c[_0x0547('0xaa')](-0x1);if(_0x57a072==='/'){_0x20019c=_0x20019c['substring'](0x0,_0x20019c[_0x0547('0xab')](_0x57a072));}_0x2e6960=util['format'](_0x0547('0xac'),_0x20019c);_0x21263e=util['format'](_0x0547('0xad'),_0x20019c);_0x107705={'user':_0x4f7ebc[_0x0547('0xa6')],'pass':_0x4f7ebc['password']};var _0x24dd7d={'method':_0x0547('0xae'),'uri':_0x2e6960+_0x0547('0xaf'),'auth':_0x107705,'json':!![]};return rp(_0x24dd7d);}})[_0x0547('0x1c')](function(_0x15c9ae){if(_0x15c9ae['result'][_0x0547('0x43')]>0x0){_0x4d996b=_0x15c9ae[_0x0547('0x26')];}console[_0x0547('0xb0')](_0x0547('0xb1'),_0x4d996b);_0x498704=[];_0x144f47=Object['assign']([],_0x4d996b);_[_0x0547('0xb2')](_0x144f47,function(_0x412160){return!_0x4ad209['includes'](_0x412160['name']);});_0x144f47[_0x0547('0xb3')](function(_0x3b5978){var _0x5a2a13=createFieldObject(_0x21263e,_0x107705,_0x3b5978[_0x0547('0xb4')],_0x3b5978[_0x0547('0x35')],_0x3b5978[_0x0547('0xb5')],![]);_0x498704[_0x0547('0xb6')](_0x5a2a13);});return Promise[_0x0547('0xb7')](_0x498704);})[_0x0547('0x1c')](function(_0x12bf37){_0x2cfa52=_0x12bf37;_0x359564=Object['assign']([],_0x4d996b);console[_0x0547('0xb0')]('TCL:\x20_object',_0x4d996b);_[_0x0547('0xb2')](_0x359564,function(_0x4fd3fa){return _0x1895ca[_0x0547('0xb8')](_0x4fd3fa['name']);});console['log'](_0x0547('0xb9'),_0x359564);_0x498704=[];_0x359564[_0x0547('0xb3')](function(_0x24aaaa){var _0x2ec6ff=createFieldObject(_0x21263e,_0x107705,_0x24aaaa[_0x0547('0xb4')],_0x24aaaa[_0x0547('0x35')],_0x24aaaa[_0x0547('0xb5')],!![]);_0x498704[_0x0547('0xb6')](_0x2ec6ff);});return Promise['all'](_0x498704);})[_0x0547('0x1c')](function(_0x2eaf38){_0x25cb86=_0x2eaf38;var _0x2ae9d1=_0x2cfa52[_0x0547('0xba')](_0x25cb86);return{'count':_0x2ae9d1['length'],'rows':_0x2ae9d1};})[_0x0547('0x1c')](respondWithResult(_0x3dd9c1,null))[_0x0547('0x4f')](function(_0x463255){console['log'](_0x0547('0xbb')+_0x463255);var _0x4c7b55=_0x19d90f['query'][_0x0547('0xbc')]?0x1f4:_0x463255[_0x0547('0xbd')]||0x1f4;logger[_0x0547('0x23')](_0x463255[_0x0547('0x34')]);delete _0x463255[_0x0547('0x35')];if(_0x4c7b55===0x191){_0x4c7b55=0x190;}_0x3dd9c1[_0x0547('0x28')](_0x4c7b55)[_0x0547('0xbe')](_0x19d90f[_0x0547('0x3d')][_0x0547('0xbc')]?{'message':_0x0547('0xbf'),'statusCode':_0x463255[_0x0547('0xbd')]}:_0x463255);});};function createFieldObject(_0x3f0d1a,_0x4fed2c,_0x49439e,_0x2aa157,_0xe9c5c2,_0x302606){return new Promise(function(_0x2803c5,_0x7bd234){var _0x2956d7={'id':_0x2aa157,'name':_0xe9c5c2,'custom':_0x302606};if(_0x49439e===_0x0547('0xc0')){_0x2956d7[_0x0547('0x4b')]=[{'name':_0x0547('0xc1'),'value':'true'},{'name':_0x0547('0xc2'),'value':_0x0547('0xc3')}];_0x2803c5(_0x2956d7);}else{var _0xfa1cc9={'method':_0x0547('0xae'),'uri':_0x3f0d1a+'sys_choice?sysparm_query=name=incident^element='+_0x2aa157,'auth':_0x4fed2c,'json':!![]};return rp(_0xfa1cc9)[_0x0547('0x1c')](function(_0x7ca5c9){var _0x58d594=[];if(_0x7ca5c9['result'][_0x0547('0x43')]>0x0){_0x7ca5c9[_0x0547('0x26')][_0x0547('0xb3')](function(_0x4108f5){if(_0x4108f5[_0x0547('0xc4')]===_0x0547('0xc3')){var _0x4f1583={'name':_0x4108f5['label'],'value':_0x4108f5[_0x0547('0xc5')]};_0x58d594[_0x0547('0xb6')](_0x4f1583);}});}_0x2956d7[_0x0547('0x4b')]=_0x58d594;if(_0x2956d7[_0x0547('0x4b')]['length']>0x0){_0x2803c5(_0x2956d7);}else{if(_0x302606==![]){_0x2803c5();}else{_0x2803c5(_0x2956d7);}}});}});} \ No newline at end of file +var _0x45d3=['email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','forEach','concat','stack','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','reject','destroy','end','name','send','index','map','ServicenowAccount','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','filter','merge','include','findAll','rows','show','params','length','includeAll','options','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','subcategory','close_code','incident_state','severity','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','knowledge','order','calendar_stc','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','comments','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','location','username'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x45d3,0xda));var _0x345d=function(_0x3c3aba,_0x5a8871){_0x3c3aba=_0x3c3aba-0x0;var _0x4ea747=_0x45d3[_0x3c3aba];return _0x4ea747;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x345d('0x0'));var zipdir=require(_0x345d('0x1'));var jsonpatch=require(_0x345d('0x2'));var rp=require('request-promise');var moment=require(_0x345d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x345d('0x4'));var sox=require(_0x345d('0x5'));var csv=require(_0x345d('0x6'));var ejs=require(_0x345d('0x7'));var fs=require('fs');var _=require(_0x345d('0x8'));var squel=require(_0x345d('0x9'));var crypto=require(_0x345d('0xa'));var jsforce=require(_0x345d('0xb'));var deskjs=require(_0x345d('0xc'));var toCsv=require(_0x345d('0x6'));var querystring=require(_0x345d('0xd'));var Papa=require(_0x345d('0xe'));var Redis=require(_0x345d('0xf'));var authService=require(_0x345d('0x10'));var qs=require(_0x345d('0x11'));var as=require(_0x345d('0x12'));var hardwareService=require(_0x345d('0x13'));var logger=require(_0x345d('0x14'))('api');var utils=require(_0x345d('0x15'));var config=require(_0x345d('0x16'));var licenseUtil=require(_0x345d('0x17'));var db=require(_0x345d('0x18'))['db'];var integrations=require(_0x345d('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x345d('0x1a')][_0x345d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x13c0f6,_0x5ba589,_0x3785a5,_0x230e1b){return new BPromise(function(_0x59380f,_0xd38f2e){var _0x1327c2=_0x230e1b||client;return _0x1327c2[_0x345d('0x1c')](_0x13c0f6,_0x3785a5)[_0x345d('0x1d')](function(_0xf72a9f){logger[_0x345d('0x1e')](_0x345d('0x1f'),_0x5ba589,'request\x20sent');logger[_0x345d('0x20')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5ba589,_0x345d('0x21'),JSON['stringify'](_0xf72a9f));if(_0xf72a9f[_0x345d('0x22')]){if(_0xf72a9f[_0x345d('0x22')]['code']===0x1f4){logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0xf72a9f[_0x345d('0x22')][_0x345d('0x23')]);return _0xd38f2e(_0xf72a9f['error']['message']);}logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0xf72a9f[_0x345d('0x22')][_0x345d('0x23')]);return _0x59380f(_0xf72a9f[_0x345d('0x22')]['message']);}else{logger['info'](_0x345d('0x1f'),_0x5ba589,'request\x20sent');_0x59380f(_0xf72a9f[_0x345d('0x24')]['message']);}})[_0x345d('0x25')](function(_0x5d2423){logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0x5d2423);_0xd38f2e(_0x5d2423);});});}function respondWithStatusCode(_0x3e89f5,_0x4e1b1b){_0x4e1b1b=_0x4e1b1b||0xcc;return function(_0x210a12){if(_0x210a12){return _0x3e89f5[_0x345d('0x26')](_0x4e1b1b);}return _0x3e89f5['status'](_0x4e1b1b)['end']();};}function respondWithResult(_0x504dbe,_0x550ab2){_0x550ab2=_0x550ab2||0xc8;return function(_0x5ecb23){if(_0x5ecb23){return _0x504dbe[_0x345d('0x27')](_0x550ab2)[_0x345d('0x28')](_0x5ecb23);}};}function respondWithFilteredResult(_0x1ab420,_0x3c1d83){return function(_0x451f58){if(_0x451f58){var _0x42f368=_0x451f58[_0x345d('0x29')],_0x6205ac=_0x3c1d83[_0x345d('0x2a')],_0x26744a=_0x3c1d83[_0x345d('0x2a')]+_0x3c1d83[_0x345d('0x2b')],_0x1be338;if(_0x26744a>=_0x42f368){_0x26744a=_0x42f368;_0x1be338=0xc8;}else{_0x1be338=0xce;}_0x1ab420[_0x345d('0x27')](_0x1be338);return _0x1ab420[_0x345d('0x2c')]('Content-Range',_0x6205ac+'-'+_0x26744a+'/'+_0x42f368)['json'](_0x451f58);}return null;};}function patchUpdates(_0xdc6f39){return function(_0x33a446){try{jsonpatch['apply'](_0x33a446,_0xdc6f39,!![]);}catch(_0x4c5165){return BPromise[_0x345d('0x2d')](_0x4c5165);}return _0x33a446['save']();};}function saveUpdates(_0x5399ef,_0x32462f){return function(_0x34dc58){if(_0x34dc58){return _0x34dc58['update'](_0x5399ef)[_0x345d('0x1d')](function(_0x13785c){return _0x13785c;});}return null;};}function removeEntity(_0x25511c,_0x54ddff){return function(_0x4ed715){if(_0x4ed715){return _0x4ed715[_0x345d('0x2e')]()[_0x345d('0x1d')](function(){_0x25511c[_0x345d('0x27')](0xcc)[_0x345d('0x2f')]();});}};}function handleEntityNotFound(_0x461e8e,_0x154d5a){return function(_0x22745d){if(!_0x22745d){_0x461e8e[_0x345d('0x26')](0x194);}return _0x22745d;};}function handleError(_0x318aca,_0x4000ac){_0x4000ac=_0x4000ac||0x1f4;return function(_0x41b45f){logger[_0x345d('0x22')](_0x41b45f['stack']);if(_0x41b45f[_0x345d('0x30')]){delete _0x41b45f[_0x345d('0x30')];}_0x318aca[_0x345d('0x27')](_0x4000ac)[_0x345d('0x31')](_0x41b45f);};}exports[_0x345d('0x32')]=function(_0x7ac697,_0x59eff2){var _0x21d9d4={},_0x4f8174={},_0xd7fc99={'count':0x0,'rows':[]};var _0x40f90a=_[_0x345d('0x33')](db[_0x345d('0x34')][_0x345d('0x35')],function(_0x206dad){return{'name':_0x206dad['fieldName'],'type':_0x206dad[_0x345d('0x36')]['key']};});_0x4f8174[_0x345d('0x37')]=_[_0x345d('0x33')](_0x40f90a,_0x345d('0x30'));_0x4f8174['query']=_[_0x345d('0x38')](_0x7ac697['query']);_0x4f8174[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x4f8174['model'],_0x4f8174[_0x345d('0x3b')]);_0x21d9d4[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x4f8174[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x3d')]));_0x21d9d4['attributes']=_0x21d9d4[_0x345d('0x3c')]['length']?_0x21d9d4['attributes']:_0x4f8174[_0x345d('0x37')];if(!_0x7ac697[_0x345d('0x3b')]['hasOwnProperty'](_0x345d('0x3e'))){_0x21d9d4['limit']=qs[_0x345d('0x2b')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x2b')]);_0x21d9d4[_0x345d('0x2a')]=qs[_0x345d('0x2a')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x2a')]);}_0x21d9d4['order']=qs[_0x345d('0x3f')](_0x7ac697[_0x345d('0x3b')]['sort']);_0x21d9d4[_0x345d('0x40')]=qs[_0x345d('0x39')](_['pick'](_0x7ac697[_0x345d('0x3b')],_0x4f8174[_0x345d('0x39')]),_0x40f90a);if(_0x7ac697[_0x345d('0x3b')][_0x345d('0x41')]){_0x21d9d4[_0x345d('0x40')]=_[_0x345d('0x42')](_0x21d9d4[_0x345d('0x40')],{'$or':_[_0x345d('0x33')](_0x40f90a,function(_0x446188){if(_0x446188[_0x345d('0x36')]!=='VIRTUAL'){var _0x1a18de={};_0x1a18de[_0x446188[_0x345d('0x30')]]={'$like':'%'+_0x7ac697['query'][_0x345d('0x41')]+'%'};return _0x1a18de;}})});}_0x21d9d4=_[_0x345d('0x42')]({},_0x21d9d4,_0x7ac697['options']);var _0x6bedd0={'where':_0x21d9d4['where']};return db[_0x345d('0x34')]['count'](_0x6bedd0)[_0x345d('0x1d')](function(_0x11f44e){_0xd7fc99['count']=_0x11f44e;if(_0x7ac697[_0x345d('0x3b')]['includeAll']){_0x21d9d4[_0x345d('0x43')]=[{'all':!![]}];}return db[_0x345d('0x34')][_0x345d('0x44')](_0x21d9d4);})[_0x345d('0x1d')](function(_0xf4b3ee){_0xd7fc99[_0x345d('0x45')]=_0xf4b3ee;return _0xd7fc99;})[_0x345d('0x1d')](respondWithFilteredResult(_0x59eff2,_0x21d9d4))[_0x345d('0x25')](handleError(_0x59eff2,null));};exports[_0x345d('0x46')]=function(_0x2f54c5,_0x48da30){var _0x3aa47e={'raw':![],'where':{'id':_0x2f54c5[_0x345d('0x47')]['id']}},_0x7918bf={};_0x7918bf['model']=_[_0x345d('0x38')](db[_0x345d('0x34')][_0x345d('0x35')]);_0x7918bf[_0x345d('0x3b')]=_[_0x345d('0x38')](_0x2f54c5[_0x345d('0x3b')]);_0x7918bf['filters']=_['intersection'](_0x7918bf[_0x345d('0x37')],_0x7918bf[_0x345d('0x3b')]);_0x3aa47e[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x7918bf[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x2f54c5['query'][_0x345d('0x3d')]));_0x3aa47e['attributes']=_0x3aa47e[_0x345d('0x3c')][_0x345d('0x48')]?_0x3aa47e[_0x345d('0x3c')]:_0x7918bf[_0x345d('0x37')];if(_0x2f54c5[_0x345d('0x3b')][_0x345d('0x49')]){_0x3aa47e[_0x345d('0x43')]=[{'all':!![]}];}_0x3aa47e=_[_0x345d('0x42')]({},_0x3aa47e,_0x2f54c5[_0x345d('0x4a')]);return db[_0x345d('0x34')][_0x345d('0x4b')](_0x3aa47e)['then'](handleEntityNotFound(_0x48da30,null))[_0x345d('0x1d')](respondWithResult(_0x48da30,null))[_0x345d('0x25')](handleError(_0x48da30,null));};exports[_0x345d('0x4c')]=function(_0x1d9357,_0x437611){return db[_0x345d('0x34')][_0x345d('0x4c')](_0x1d9357[_0x345d('0x4d')],{})[_0x345d('0x1d')](respondWithResult(_0x437611,0xc9))[_0x345d('0x25')](handleError(_0x437611,null));};exports[_0x345d('0x4e')]=function(_0x129969,_0x39eed0){if(_0x129969[_0x345d('0x4d')]['id']){delete _0x129969[_0x345d('0x4d')]['id'];}return db[_0x345d('0x34')][_0x345d('0x4b')]({'where':{'id':_0x129969[_0x345d('0x47')]['id']}})['then'](handleEntityNotFound(_0x39eed0,null))[_0x345d('0x1d')](saveUpdates(_0x129969[_0x345d('0x4d')],null))['then'](respondWithResult(_0x39eed0,null))[_0x345d('0x25')](handleError(_0x39eed0,null));};exports[_0x345d('0x2e')]=function(_0x13aa60,_0x3807cf){return db[_0x345d('0x34')][_0x345d('0x4b')]({'where':{'id':_0x13aa60[_0x345d('0x47')]['id']}})[_0x345d('0x1d')](handleEntityNotFound(_0x3807cf,null))[_0x345d('0x1d')](removeEntity(_0x3807cf,null))[_0x345d('0x25')](handleError(_0x3807cf,null));};exports[_0x345d('0x4f')]=function(_0x4157ba,_0x32af0f,_0x2b4bcb){var _0x21956a={};var _0x5b72d4={};var _0x4d2694;var _0x3a9342;return db[_0x345d('0x34')][_0x345d('0x50')]({'where':{'id':_0x4157ba[_0x345d('0x47')]['id']}})['then'](handleEntityNotFound(_0x32af0f,null))[_0x345d('0x1d')](function(_0x4c18e0){if(_0x4c18e0){_0x4d2694=_0x4c18e0;_0x5b72d4[_0x345d('0x37')]=_['keys'](db[_0x345d('0x51')][_0x345d('0x35')]);_0x5b72d4[_0x345d('0x3b')]=_['keys'](_0x4157ba[_0x345d('0x3b')]);_0x5b72d4[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x5b72d4[_0x345d('0x37')],_0x5b72d4['query']);_0x21956a[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x5b72d4[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x4157ba['query'][_0x345d('0x3d')]));_0x21956a[_0x345d('0x3c')]=_0x21956a['attributes'][_0x345d('0x48')]?_0x21956a[_0x345d('0x3c')]:_0x5b72d4[_0x345d('0x37')];_0x21956a['order']=qs[_0x345d('0x3f')](_0x4157ba['query'][_0x345d('0x3f')]);_0x21956a[_0x345d('0x40')]=qs[_0x345d('0x39')](_[_0x345d('0x52')](_0x4157ba['query'],_0x5b72d4[_0x345d('0x39')]));if(_0x4157ba['query'][_0x345d('0x41')]){_0x21956a[_0x345d('0x40')]=_[_0x345d('0x42')](_0x21956a[_0x345d('0x40')],{'$or':_['map'](_0x21956a[_0x345d('0x3c')],function(_0x58e4eb){var _0x333c65={};_0x333c65[_0x58e4eb]={'$like':'%'+_0x4157ba['query'][_0x345d('0x41')]+'%'};return _0x333c65;})});}_0x21956a=_[_0x345d('0x42')]({},_0x21956a,_0x4157ba[_0x345d('0x4a')]);return _0x4d2694[_0x345d('0x4f')](_0x21956a);}})[_0x345d('0x1d')](function(_0x3a3a8b){if(_0x3a3a8b){_0x3a9342=_0x3a3a8b['length'];if(!_0x4157ba[_0x345d('0x3b')][_0x345d('0x53')](_0x345d('0x3e'))){_0x21956a[_0x345d('0x2b')]=qs['limit'](_0x4157ba[_0x345d('0x3b')]['limit']);_0x21956a[_0x345d('0x2a')]=qs[_0x345d('0x2a')](_0x4157ba[_0x345d('0x3b')][_0x345d('0x2a')]);}return _0x4d2694['getConfigurations'](_0x21956a);}})[_0x345d('0x1d')](function(_0x6fc392){if(_0x6fc392){return _0x6fc392?{'count':_0x3a9342,'rows':_0x6fc392}:null;}})[_0x345d('0x1d')](respondWithResult(_0x32af0f,null))[_0x345d('0x25')](handleError(_0x32af0f,null));};exports['addConfiguration']=function(_0x38cbe8,_0x453c19,_0x3a4f97){if(_0x38cbe8['body']['id']){delete _0x38cbe8[_0x345d('0x4d')]['id'];}return db[_0x345d('0x34')]['findOne']({'where':{'id':_0x38cbe8[_0x345d('0x47')]['id']}})[_0x345d('0x1d')](handleEntityNotFound(_0x453c19,null))['then'](function(_0x46bc57){if(_0x46bc57){_0x38cbe8[_0x345d('0x4d')][_0x345d('0x54')]=_0x46bc57['id'];_0x38cbe8[_0x345d('0x4d')][_0x345d('0x55')]=integrations['getSubjects'](_0x38cbe8[_0x345d('0x4d')][_0x345d('0x56')],_0x38cbe8['body'][_0x345d('0x36')]);_0x38cbe8[_0x345d('0x4d')]['Descriptions']=integrations[_0x345d('0x57')](_0x38cbe8[_0x345d('0x4d')]['channel'],_0x38cbe8[_0x345d('0x4d')][_0x345d('0x36')]);return db['ServicenowConfiguration'][_0x345d('0x4c')](_0x38cbe8['body'],{'include':[{'model':db[_0x345d('0x58')],'as':_0x345d('0x55')},{'model':db[_0x345d('0x58')],'as':_0x345d('0x59')}]});}return null;})['then'](respondWithResult(_0x453c19,null))[_0x345d('0x25')](handleError(_0x453c19,null));};exports[_0x345d('0x5a')]=function(_0x284b11,_0xe67921,_0x161ac4){var _0x3cce70=['made_sla',_0x345d('0x5b'),'knowledge',_0x345d('0x5c'),_0x345d('0x5d'),'notify',_0x345d('0x5e'),_0x345d('0x5f'),'category'];var _0x370a4b=[_0x345d('0x60'),'made_sla',_0x345d('0x61'),_0x345d('0x62'),'upon_reject',_0x345d('0x63'),_0x345d('0x64'),'hold_reason',_0x345d('0x65'),_0x345d('0x66'),_0x345d('0x67'),_0x345d('0x68'),_0x345d('0x69'),'user_input','sys_created_on',_0x345d('0x6a'),_0x345d('0x6b'),_0x345d('0x6c'),_0x345d('0x6d'),_0x345d('0x6e'),_0x345d('0x6f'),'closed_at',_0x345d('0x70'),_0x345d('0x71'),_0x345d('0x72'),_0x345d('0x73'),'work_notes_list',_0x345d('0x74'),'priority',_0x345d('0x75'),'rfc','time_worked',_0x345d('0x76'),_0x345d('0x77'),_0x345d('0x78'),_0x345d('0x79'),_0x345d('0x7a'),_0x345d('0x7b'),_0x345d('0x7c'),'caller_id',_0x345d('0x7d'),_0x345d('0x5c'),_0x345d('0x7e'),_0x345d('0x7f'),'close_code',_0x345d('0x80'),_0x345d('0x81'),'work_start','assignment_group',_0x345d('0x82'),_0x345d('0x83'),_0x345d('0x84'),_0x345d('0x85'),'notify','sys_class_name',_0x345d('0x86'),_0x345d('0x87'),_0x345d('0x88'),_0x345d('0x89'),_0x345d('0x8a'),'contact_type',_0x345d('0x8b'),_0x345d('0x5e'),_0x345d('0x8c'),_0x345d('0x8d'),_0x345d('0x8e'),'reassignment_count',_0x345d('0x8f'),'assigned_to',_0x345d('0x5f'),_0x345d('0x90'),'sla_due',_0x345d('0x91'),_0x345d('0x92'),_0x345d('0x93'),'sys_mod_count','reopen_count',_0x345d('0x94'),_0x345d('0x95'),_0x345d('0x96'),_0x345d('0x97'),_0x345d('0x98'),'category'];var _0x2855a0='';var _0x20f30b='';var _0x3c72d2=[];var _0x171f68='';var _0x464023='';var _0x32d491=[];var _0x1c9454='';var _0x30e722='';var _0x1ba98a={};var _0x2d5158='';return db[_0x345d('0x34')][_0x345d('0x50')]({'where':{'id':_0x284b11[_0x345d('0x47')]['id']},'attributes':['id',_0x345d('0x99'),'password',_0x345d('0x9a'),_0x345d('0x9b'),_0x345d('0x9c')]})[_0x345d('0x1d')](handleEntityNotFound(_0xe67921,null))[_0x345d('0x1d')](function(_0x1accca){if(_0x1accca){_0x2d5158=_0x1accca[_0x345d('0x9b')];var _0x37e06d=_0x2d5158[_0x345d('0x9d')](-0x1);if(_0x37e06d==='/'){_0x2d5158=_0x2d5158[_0x345d('0x9e')](0x0,_0x2d5158[_0x345d('0x9f')](_0x37e06d));}_0x30e722=util['format'](_0x345d('0xa0'),_0x2d5158);_0x1c9454=util[_0x345d('0xa1')]('%s/api/now/table/',_0x2d5158);_0x1ba98a={'user':_0x1accca['username'],'pass':_0x1accca['password']};var _0x1299e8={'method':_0x345d('0xa2'),'uri':_0x30e722+_0x345d('0xa3'),'auth':_0x1ba98a,'json':!![]};return rp(_0x1299e8);}})[_0x345d('0x1d')](function(_0x30ad1e){if(_0x30ad1e[_0x345d('0x24')]['length']>0x0){_0x2855a0=_0x30ad1e[_0x345d('0x24')];}console[_0x345d('0xa4')](_0x345d('0xa5'),_0x2855a0);_0x32d491=[];_0x20f30b=Object[_0x345d('0xa6')]([],_0x2855a0);_[_0x345d('0xa7')](_0x20f30b,function(_0x28a952){return!_0x3cce70[_0x345d('0xa8')](_0x28a952[_0x345d('0x30')]);});_0x20f30b['forEach'](function(_0x266fcd){var _0x2e635d=createFieldObject(_0x1c9454,_0x1ba98a,_0x266fcd[_0x345d('0xa9')],_0x266fcd[_0x345d('0x30')],_0x266fcd[_0x345d('0xaa')],![]);_0x32d491[_0x345d('0xab')](_0x2e635d);});return Promise[_0x345d('0xac')](_0x32d491);})['then'](function(_0x20e269){_0x3c72d2=_0x20e269;_0x171f68=Object[_0x345d('0xa6')]([],_0x2855a0);console[_0x345d('0xa4')](_0x345d('0xad'),_0x2855a0);_[_0x345d('0xa7')](_0x171f68,function(_0x2c7444){return _0x370a4b['includes'](_0x2c7444[_0x345d('0x30')]);});console[_0x345d('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x171f68);_0x32d491=[];_0x171f68[_0x345d('0xae')](function(_0x3aefbd){var _0x466835=createFieldObject(_0x1c9454,_0x1ba98a,_0x3aefbd[_0x345d('0xa9')],_0x3aefbd['name'],_0x3aefbd[_0x345d('0xaa')],!![]);_0x32d491[_0x345d('0xab')](_0x466835);});return Promise[_0x345d('0xac')](_0x32d491);})[_0x345d('0x1d')](function(_0x46e4e0){_0x464023=_0x46e4e0;var _0x260759=_0x3c72d2[_0x345d('0xaf')](_0x464023);return{'count':_0x260759[_0x345d('0x48')],'rows':_0x260759};})[_0x345d('0x1d')](respondWithResult(_0xe67921,null))[_0x345d('0x25')](function(_0x42478b){console['log']('ServiceNow\x20error:\x20'+_0x42478b);var _0x194bf8=_0x284b11[_0x345d('0x3b')]['test']?0x1f4:_0x42478b['statusCode']||0x1f4;logger[_0x345d('0x22')](_0x42478b[_0x345d('0xb0')]);delete _0x42478b[_0x345d('0x30')];if(_0x194bf8===0x191){_0x194bf8=0x190;}_0xe67921['status'](_0x194bf8)['send'](_0x284b11[_0x345d('0x3b')][_0x345d('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x42478b[_0x345d('0xb2')]}:_0x42478b);});};function createFieldObject(_0x10c88a,_0x122af3,_0x829099,_0x3ada3a,_0x55173f,_0x186fc4){return new Promise(function(_0x2410bf,_0x536a17){var _0x14761e={'id':_0x3ada3a,'name':_0x55173f,'custom':_0x186fc4};if(_0x829099===_0x345d('0xb3')){_0x14761e['options']=[{'name':_0x345d('0xb4'),'value':'true'},{'name':_0x345d('0xb5'),'value':_0x345d('0xb6')}];_0x2410bf(_0x14761e);}else{var _0x3134cc={'method':_0x345d('0xa2'),'uri':_0x10c88a+_0x345d('0xb7')+_0x3ada3a,'auth':_0x122af3,'json':!![]};return rp(_0x3134cc)[_0x345d('0x1d')](function(_0x459210){var _0x488b1d=[];if(_0x459210[_0x345d('0x24')][_0x345d('0x48')]>0x0){_0x459210['result'][_0x345d('0xae')](function(_0x13f453){if(_0x13f453[_0x345d('0xb8')]==='false'){var _0x4272d1={'name':_0x13f453['label'],'value':_0x13f453[_0x345d('0xb9')]};_0x488b1d[_0x345d('0xab')](_0x4272d1);}});}_0x14761e[_0x345d('0x4a')]=_0x488b1d;if(_0x14761e[_0x345d('0x4a')][_0x345d('0x48')]>0x0){_0x2410bf(_0x14761e);}else{if(_0x186fc4==![]){_0x2410bf();}else{_0x2410bf(_0x14761e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9efe09e..c733b42 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 _0x24ca=['define','ServicenowAccount','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x264194,_0x48ee77){var _0x584be0=function(_0x4f9b57){while(--_0x4f9b57){_0x264194['push'](_0x264194['shift']());}};_0x584be0(++_0x48ee77);}(_0x24ca,0x1bc));var _0xa24c=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x24ca[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));var integrations=require(_0xa24c('0x9'));module[_0xa24c('0xa')]=function(_0x3c0aaa,_0x2dd348){return _0x3c0aaa[_0xa24c('0xb')](_0xa24c('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x52e719,_0x296682){var _0x84cff8=function(_0x1191f0){while(--_0x1191f0){_0x52e719['push'](_0x52e719['shift']());}};_0x84cff8(++_0x296682);}(_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'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e5d614c..d8d8571 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 _0x82e4=['GetServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x12a721,_0x5239ae){var _0x8c0ae0=function(_0x1f102c){while(--_0x1f102c){_0x12a721['push'](_0x12a721['shift']());}};_0x8c0ae0(++_0x5239ae);}(_0x82e4,0x71));var _0x482e=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x82e4[_0x553150];return _0x18193d;};'use strict';var _=require(_0x482e('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(_0x482e('0x1'))['db'];var utils=require(_0x482e('0x2'));var logger=require(_0x482e('0x3'))(_0x482e('0x4'));var config=require('../../config/environment');var jayson=require(_0x482e('0x5'));var client=jayson[_0x482e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43a17b,_0x15d834,_0x4a47d0){return new BPromise(function(_0x24746e,_0x5bd39d){return client[_0x482e('0x7')](_0x43a17b,_0x4a47d0)[_0x482e('0x8')](function(_0x21194f){logger[_0x482e('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x482e('0xa'));logger[_0x482e('0xb')](_0x482e('0xc'),_0x15d834,_0x482e('0xa'),JSON['stringify'](_0x21194f));if(_0x21194f['error']){if(_0x21194f[_0x482e('0xd')][_0x482e('0xe')]===0x1f4){logger[_0x482e('0xd')](_0x482e('0xf'),_0x15d834,_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);return _0x5bd39d(_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);}logger[_0x482e('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x21194f[_0x482e('0xd')][_0x482e('0x10')]);return _0x24746e(_0x21194f['error']['message']);}else{logger[_0x482e('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x15d834,_0x482e('0xa'));_0x24746e(_0x21194f[_0x482e('0x11')][_0x482e('0x10')]);}})[_0x482e('0x12')](function(_0x1ac075){logger['error'](_0x482e('0xf'),_0x15d834,_0x1ac075);_0x5bd39d(_0x1ac075);});});}exports[_0x482e('0x13')]=function(_0x5b4771){var _0x30a282=this;return new Promise(function(_0x22c197,_0x34302a){return db['ServicenowAccount'][_0x482e('0x14')]({'raw':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x16')]===undefined?!![]:![]:!![],'where':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x17')]||null:null,'attributes':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')]['attributes']||null:null,'limit':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x18')]||null:null,'include':_0x5b4771[_0x482e('0x15')]?_0x5b4771[_0x482e('0x15')][_0x482e('0x19')]?_[_0x482e('0x1a')](_0x5b4771['options'][_0x482e('0x19')],function(_0x593ab5){return{'model':db[_0x593ab5['model']],'as':_0x593ab5['as'],'attributes':_0x593ab5['attributes'],'include':_0x593ab5['include']?_[_0x482e('0x1a')](_0x593ab5['include'],function(_0x2b9a31){return{'model':db[_0x2b9a31[_0x482e('0x1b')]],'as':_0x2b9a31['as'],'attributes':_0x2b9a31[_0x482e('0x1c')],'include':_0x2b9a31[_0x482e('0x19')]?_['map'](_0x2b9a31['include'],function(_0x5ddf07){return{'model':db[_0x5ddf07[_0x482e('0x1b')]],'as':_0x5ddf07['as'],'attributes':_0x5ddf07['attributes']};}):[]};}):[]};}):[]:[]})[_0x482e('0x8')](function(_0x5577d8){logger[_0x482e('0x9')](_0x482e('0x13'),_0x5b4771);logger['debug'](_0x482e('0x13'),_0x5b4771,JSON[_0x482e('0x1d')](_0x5577d8));_0x22c197(_0x5577d8);})[_0x482e('0x12')](function(_0x40deca){logger[_0x482e('0xd')](_0x482e('0x13'),_0x40deca[_0x482e('0x10')],_0x5b4771);_0x34302a(_0x30a282[_0x482e('0xd')](0x1f4,_0x40deca[_0x482e('0x10')]));});});};exports[_0x482e('0x1e')]=function(_0xc0f1d5){var _0x58437e=this;return new Promise(function(_0x4427a4,_0x13adcc){return db[_0x482e('0x1f')][_0x482e('0x20')]({'raw':_0xc0f1d5['options']?_0xc0f1d5['options'][_0x482e('0x16')]===undefined?!![]:![]:!![],'where':_0xc0f1d5['options']?_0xc0f1d5['options'][_0x482e('0x17')]||null:null,'attributes':_0xc0f1d5[_0x482e('0x15')]?_0xc0f1d5[_0x482e('0x15')][_0x482e('0x1c')]||null:null,'include':_0xc0f1d5[_0x482e('0x15')]?_0xc0f1d5['options'][_0x482e('0x19')]?_[_0x482e('0x1a')](_0xc0f1d5[_0x482e('0x15')][_0x482e('0x19')],function(_0x31b8b0){return{'model':db[_0x31b8b0[_0x482e('0x1b')]],'as':_0x31b8b0['as'],'attributes':_0x31b8b0[_0x482e('0x1c')],'include':_0x31b8b0[_0x482e('0x19')]?_['map'](_0x31b8b0[_0x482e('0x19')],function(_0x1cf96f){return{'model':db[_0x1cf96f[_0x482e('0x1b')]],'as':_0x1cf96f['as'],'attributes':_0x1cf96f[_0x482e('0x1c')],'include':_0x1cf96f[_0x482e('0x19')]?_[_0x482e('0x1a')](_0x1cf96f[_0x482e('0x19')],function(_0x9a1f50){return{'model':db[_0x9a1f50[_0x482e('0x1b')]],'as':_0x9a1f50['as'],'attributes':_0x9a1f50[_0x482e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40eff2){logger['info'](_0x482e('0x1e'),_0xc0f1d5);logger[_0x482e('0xb')](_0x482e('0x1e'),_0xc0f1d5,JSON[_0x482e('0x1d')](_0x40eff2));_0x4427a4(_0x40eff2);})[_0x482e('0x12')](function(_0x11e21c){logger['error'](_0x482e('0x1e'),_0x11e21c[_0x482e('0x10')],_0xc0f1d5);_0x13adcc(_0x58437e[_0x482e('0xd')](0x1f4,_0x11e21c[_0x482e('0x10')]));});});}; \ No newline at end of file +var _0x445c=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','info','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x25e95a,_0x2efe4a){var _0x2b35e8=function(_0x1cd36a){while(--_0x1cd36a){_0x25e95a['push'](_0x25e95a['shift']());}};_0x2b35e8(++_0x2efe4a);}(_0x445c,0x151));var _0xc445=function(_0x25575b,_0x43c2c1){_0x25575b=_0x25575b-0x0;var _0x5ec627=_0x445c[_0x25575b];return _0x5ec627;};'use strict';var _=require(_0xc445('0x0'));var util=require(_0xc445('0x1'));var moment=require(_0xc445('0x2'));var BPromise=require('bluebird');var rs=require(_0xc445('0x3'));var fs=require('fs');var Redis=require(_0xc445('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc445('0x5'));var logger=require(_0xc445('0x6'))(_0xc445('0x7'));var config=require(_0xc445('0x8'));var jayson=require(_0xc445('0x9'));var client=jayson[_0xc445('0xa')][_0xc445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x384998,_0x1cb1eb,_0x24e1c9){return new BPromise(function(_0x5a1bf7,_0x3ef6f4){return client[_0xc445('0xc')](_0x384998,_0x24e1c9)['then'](function(_0x83ea34){logger['info'](_0xc445('0xd'),_0x1cb1eb,_0xc445('0xe'));logger[_0xc445('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1cb1eb,_0xc445('0xe'),JSON[_0xc445('0x10')](_0x83ea34));if(_0x83ea34[_0xc445('0x11')]){if(_0x83ea34[_0xc445('0x11')][_0xc445('0x12')]===0x1f4){logger[_0xc445('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1cb1eb,_0x83ea34['error'][_0xc445('0x13')]);return _0x3ef6f4(_0x83ea34['error'][_0xc445('0x13')]);}logger[_0xc445('0x11')](_0xc445('0xd'),_0x1cb1eb,_0x83ea34[_0xc445('0x11')]['message']);return _0x5a1bf7(_0x83ea34[_0xc445('0x11')][_0xc445('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1cb1eb,_0xc445('0xe'));_0x5a1bf7(_0x83ea34['result'][_0xc445('0x13')]);}})[_0xc445('0x14')](function(_0x1c4267){logger[_0xc445('0x11')](_0xc445('0xd'),_0x1cb1eb,_0x1c4267);_0x3ef6f4(_0x1c4267);});});}exports[_0xc445('0x15')]=function(_0x5d08bf){var _0x24cd57=this;return new Promise(function(_0x1e5d86,_0x207b13){return db[_0xc445('0x16')][_0xc445('0x17')]({'raw':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf[_0xc445('0x18')][_0xc445('0x19')]===undefined?!![]:![]:!![],'where':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf[_0xc445('0x18')][_0xc445('0x1a')]||null:null,'attributes':_0x5d08bf['options']?_0x5d08bf[_0xc445('0x18')][_0xc445('0x1b')]||null:null,'limit':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf['options'][_0xc445('0x1c')]||null:null,'include':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf['options'][_0xc445('0x1d')]?_[_0xc445('0x1e')](_0x5d08bf['options'][_0xc445('0x1d')],function(_0x2f073f){return{'model':db[_0x2f073f[_0xc445('0x1f')]],'as':_0x2f073f['as'],'attributes':_0x2f073f[_0xc445('0x1b')],'include':_0x2f073f['include']?_[_0xc445('0x1e')](_0x2f073f[_0xc445('0x1d')],function(_0x20e031){return{'model':db[_0x20e031[_0xc445('0x1f')]],'as':_0x20e031['as'],'attributes':_0x20e031[_0xc445('0x1b')],'include':_0x20e031[_0xc445('0x1d')]?_[_0xc445('0x1e')](_0x20e031[_0xc445('0x1d')],function(_0x2546a8){return{'model':db[_0x2546a8[_0xc445('0x1f')]],'as':_0x2546a8['as'],'attributes':_0x2546a8[_0xc445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc445('0x20')](function(_0xfecc05){logger[_0xc445('0x21')](_0xc445('0x15'),_0x5d08bf);logger['debug'](_0xc445('0x15'),_0x5d08bf,JSON[_0xc445('0x10')](_0xfecc05));_0x1e5d86(_0xfecc05);})[_0xc445('0x14')](function(_0x4f3a23){logger[_0xc445('0x11')]('GetServicenowAccount',_0x4f3a23[_0xc445('0x13')],_0x5d08bf);_0x207b13(_0x24cd57['error'](0x1f4,_0x4f3a23[_0xc445('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x1e0515){var _0x386f09=this;return new Promise(function(_0x251344,_0x5a7a34){return db['ServicenowAccount']['find']({'raw':_0x1e0515[_0xc445('0x18')]?_0x1e0515[_0xc445('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1e0515[_0xc445('0x18')]?_0x1e0515['options']['where']||null:null,'attributes':_0x1e0515['options']?_0x1e0515[_0xc445('0x18')][_0xc445('0x1b')]||null:null,'include':_0x1e0515[_0xc445('0x18')]?_0x1e0515[_0xc445('0x18')]['include']?_[_0xc445('0x1e')](_0x1e0515[_0xc445('0x18')][_0xc445('0x1d')],function(_0x543666){return{'model':db[_0x543666[_0xc445('0x1f')]],'as':_0x543666['as'],'attributes':_0x543666[_0xc445('0x1b')],'include':_0x543666['include']?_['map'](_0x543666['include'],function(_0x5e2edb){return{'model':db[_0x5e2edb[_0xc445('0x1f')]],'as':_0x5e2edb['as'],'attributes':_0x5e2edb['attributes'],'include':_0x5e2edb['include']?_[_0xc445('0x1e')](_0x5e2edb[_0xc445('0x1d')],function(_0x4b8d00){return{'model':db[_0x4b8d00['model']],'as':_0x4b8d00['as'],'attributes':_0x4b8d00[_0xc445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc445('0x20')](function(_0x1680e9){logger[_0xc445('0x21')](_0xc445('0x22'),_0x1e0515);logger[_0xc445('0xf')](_0xc445('0x22'),_0x1e0515,JSON[_0xc445('0x10')](_0x1680e9));_0x251344(_0x1680e9);})['catch'](function(_0x41f9b2){logger['error'](_0xc445('0x22'),_0x41f9b2[_0xc445('0x13')],_0x1e0515);_0x5a7a34(_0x386f09['error'](0x1f4,_0x41f9b2['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e6cd878..dfbfc60 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 _0x5844=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x5844,0x1ef));var _0x4584=function(_0xfcd0ca,_0xe39162){_0xfcd0ca=_0xfcd0ca-0x0;var _0x4f83a3=_0x5844[_0xfcd0ca];return _0x4f83a3;};'use strict';var multer=require(_0x4584('0x0'));var util=require(_0x4584('0x1'));var path=require(_0x4584('0x2'));var timeout=require(_0x4584('0x3'));var express=require('express');var router=express[_0x4584('0x4')]();var auth=require(_0x4584('0x5'));var interaction=require(_0x4584('0x6'));var config=require('../../config/environment');var controller=require(_0x4584('0x7'));router[_0x4584('0x8')]('/',auth[_0x4584('0x9')](),controller[_0x4584('0xa')]);router[_0x4584('0x8')](_0x4584('0xb'),auth['isAuthenticated'](),controller[_0x4584('0xc')]);router[_0x4584('0x8')]('/:id/fields',auth[_0x4584('0x9')](),controller['getFields']);router['get'](_0x4584('0xd'),auth[_0x4584('0x9')](),controller[_0x4584('0xe')]);router['get'](_0x4584('0xf'),auth[_0x4584('0x9')](),controller[_0x4584('0x10')]);router['post']('/',auth[_0x4584('0x9')](),controller['create']);router[_0x4584('0x11')](_0x4584('0xb'),auth[_0x4584('0x9')](),controller[_0x4584('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4584('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe6fd=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6fd,0xdc));var _0xde6f=function(_0x5cb4d2,_0x3bb9f1){_0x5cb4d2=_0x5cb4d2-0x0;var _0x42dcd4=_0xe6fd[_0x5cb4d2];return _0x42dcd4;};'use strict';var multer=require(_0xde6f('0x0'));var util=require(_0xde6f('0x1'));var path=require(_0xde6f('0x2'));var timeout=require(_0xde6f('0x3'));var express=require(_0xde6f('0x4'));var router=express[_0xde6f('0x5')]();var auth=require(_0xde6f('0x6'));var interaction=require(_0xde6f('0x7'));var config=require(_0xde6f('0x8'));var controller=require(_0xde6f('0x9'));router[_0xde6f('0xa')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0xc')]);router[_0xde6f('0xa')](_0xde6f('0xd'),auth[_0xde6f('0xb')](),controller[_0xde6f('0xe')]);router[_0xde6f('0xa')](_0xde6f('0xf'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x10')]);router['get']('/:id/subjects',auth[_0xde6f('0xb')](),controller[_0xde6f('0x11')]);router[_0xde6f('0xa')](_0xde6f('0x12'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x13')]);router[_0xde6f('0x14')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0x15')]);router['put'](_0xde6f('0xd'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x16')]);router[_0xde6f('0x17')](_0xde6f('0xd'),auth['isAuthenticated'](),controller[_0xde6f('0x18')]);module[_0xde6f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 14519b0..9a5af65 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 _0x6021=['sequelize','STRING'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0x6021,0x96));var _0x1602=function(_0x5e6377,_0x589bc4){_0x5e6377=_0x5e6377-0x0;var _0x5996c7=_0x6021[_0x5e6377];return _0x5996c7;};'use strict';var Sequelize=require(_0x1602('0x0'));module['exports']={'name':{'type':Sequelize[_0x1602('0x1')]},'description':{'type':Sequelize[_0x1602('0x1')]}}; \ No newline at end of file +var _0xcb4f=['STRING','sequelize','exports'];(function(_0x4af197,_0x338d52){var _0x2f34ae=function(_0x34e11f){while(--_0x34e11f){_0x4af197['push'](_0x4af197['shift']());}};_0x2f34ae(++_0x338d52);}(_0xcb4f,0x19c));var _0xfcb4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xcb4f[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xfcb4('0x0'));module[_0xfcb4('0x1')]={'name':{'type':Sequelize[_0xfcb4('0x2')]},'description':{'type':Sequelize[_0xfcb4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f0db136..19294bf 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 _0x3677=['ServicenowField','pick','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','ServicenowConfiguration','count','includeAll','include','findAll','rows','show','params','keys','create','body','find','findOne'];(function(_0x4eff92,_0x142ec2){var _0x3952f5=function(_0x262231){while(--_0x262231){_0x4eff92['push'](_0x4eff92['shift']());}};_0x3952f5(++_0x142ec2);}(_0x3677,0x1d1));var _0x7367=function(_0x138d2c,_0x2abba6){_0x138d2c=_0x138d2c-0x0;var _0xacae0d=_0x3677[_0x138d2c];return _0xacae0d;};'use strict';var pdf=require(_0x7367('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7367('0x1'));var zipdir=require(_0x7367('0x2'));var jsonpatch=require(_0x7367('0x3'));var rp=require('request-promise');var moment=require(_0x7367('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7367('0x5'));var util=require(_0x7367('0x6'));var path=require(_0x7367('0x7'));var sox=require(_0x7367('0x8'));var csv=require(_0x7367('0x9'));var ejs=require(_0x7367('0xa'));var fs=require('fs');var _=require(_0x7367('0xb'));var squel=require('squel');var crypto=require(_0x7367('0xc'));var jsforce=require(_0x7367('0xd'));var deskjs=require(_0x7367('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7367('0xf'));var authService=require(_0x7367('0x10'));var qs=require(_0x7367('0x11'));var as=require(_0x7367('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7367('0x13'));var config=require(_0x7367('0x14'));var licenseUtil=require(_0x7367('0x15'));var db=require(_0x7367('0x16'))['db'];var jayson=require(_0x7367('0x17'));var client=jayson[_0x7367('0x18')][_0x7367('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1547f5,_0xa70329,_0x5183fc,_0x21a1e6){return new BPromise(function(_0x54e79e,_0x36092e){var _0x170704=_0x21a1e6||client;return _0x170704['request'](_0x1547f5,_0x5183fc)['then'](function(_0xf3e2e){logger[_0x7367('0x1a')](_0x7367('0x1b'),_0xa70329,_0x7367('0x1c'));logger[_0x7367('0x1d')](_0x7367('0x1e'),_0xa70329,_0x7367('0x1c'),JSON[_0x7367('0x1f')](_0xf3e2e));if(_0xf3e2e['error']){if(_0xf3e2e[_0x7367('0x20')][_0x7367('0x21')]===0x1f4){logger[_0x7367('0x20')](_0x7367('0x1b'),_0xa70329,_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);return _0x36092e(_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);}logger[_0x7367('0x20')](_0x7367('0x1b'),_0xa70329,_0xf3e2e['error'][_0x7367('0x22')]);return _0x54e79e(_0xf3e2e[_0x7367('0x20')][_0x7367('0x22')]);}else{logger[_0x7367('0x1a')](_0x7367('0x1b'),_0xa70329,_0x7367('0x1c'));_0x54e79e(_0xf3e2e[_0x7367('0x23')][_0x7367('0x22')]);}})[_0x7367('0x24')](function(_0x1245e3){logger['error'](_0x7367('0x1b'),_0xa70329,_0x1245e3);_0x36092e(_0x1245e3);});});}function respondWithStatusCode(_0x5a114b,_0x5d8b76){_0x5d8b76=_0x5d8b76||0xcc;return function(_0x3071df){if(_0x3071df){return _0x5a114b[_0x7367('0x25')](_0x5d8b76);}return _0x5a114b[_0x7367('0x26')](_0x5d8b76)[_0x7367('0x27')]();};}function respondWithResult(_0x211e24,_0x2c3341){_0x2c3341=_0x2c3341||0xc8;return function(_0x323df1){if(_0x323df1){return _0x211e24[_0x7367('0x26')](_0x2c3341)[_0x7367('0x28')](_0x323df1);}};}function respondWithFilteredResult(_0x2a9da5,_0x35e71a){return function(_0x100ba0){if(_0x100ba0){var _0x1d1c50=_0x100ba0['count'],_0x2e22f7=_0x35e71a[_0x7367('0x29')],_0x41c08d=_0x35e71a[_0x7367('0x29')]+_0x35e71a[_0x7367('0x2a')],_0x8a725f;if(_0x41c08d>=_0x1d1c50){_0x41c08d=_0x1d1c50;_0x8a725f=0xc8;}else{_0x8a725f=0xce;}_0x2a9da5[_0x7367('0x26')](_0x8a725f);return _0x2a9da5['set'](_0x7367('0x2b'),_0x2e22f7+'-'+_0x41c08d+'/'+_0x1d1c50)['json'](_0x100ba0);}return null;};}function patchUpdates(_0x484c68){return function(_0x3e367f){try{jsonpatch['apply'](_0x3e367f,_0x484c68,!![]);}catch(_0x22280e){return BPromise[_0x7367('0x2c')](_0x22280e);}return _0x3e367f[_0x7367('0x2d')]();};}function saveUpdates(_0x4eceda,_0x4ef9ee){return function(_0x35a72d){if(_0x35a72d){return _0x35a72d[_0x7367('0x2e')](_0x4eceda)['then'](function(_0xfc895){return _0xfc895;});}return null;};}function removeEntity(_0xfc22,_0x5acfc7){return function(_0x3e7f83){if(_0x3e7f83){return _0x3e7f83[_0x7367('0x2f')]()[_0x7367('0x30')](function(){_0xfc22[_0x7367('0x26')](0xcc)[_0x7367('0x27')]();});}};}function handleEntityNotFound(_0x4e197e,_0x2640b2){return function(_0x29350a){if(!_0x29350a){_0x4e197e[_0x7367('0x25')](0x194);}return _0x29350a;};}function handleError(_0x545d57,_0x5e8581){_0x5e8581=_0x5e8581||0x1f4;return function(_0x10c219){logger[_0x7367('0x20')](_0x10c219[_0x7367('0x31')]);if(_0x10c219['name']){delete _0x10c219[_0x7367('0x32')];}_0x545d57['status'](_0x5e8581)[_0x7367('0x33')](_0x10c219);};}exports[_0x7367('0x34')]=function(_0x4e4cb9,_0xd22ddc){var _0xcce7ca={},_0xb967bd={},_0x4b5120={'count':0x0,'rows':[]};var _0x4feb54=_['map'](db['ServicenowConfiguration'][_0x7367('0x35')],function(_0x2bfa6f){return{'name':_0x2bfa6f[_0x7367('0x36')],'type':_0x2bfa6f[_0x7367('0x37')][_0x7367('0x38')]};});_0xb967bd['model']=_[_0x7367('0x39')](_0x4feb54,_0x7367('0x32'));_0xb967bd[_0x7367('0x3a')]=_['keys'](_0x4e4cb9[_0x7367('0x3a')]);_0xb967bd[_0x7367('0x3b')]=_['intersection'](_0xb967bd['model'],_0xb967bd[_0x7367('0x3a')]);_0xcce7ca[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0xb967bd[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x3f')]));_0xcce7ca['attributes']=_0xcce7ca['attributes'][_0x7367('0x40')]?_0xcce7ca[_0x7367('0x3c')]:_0xb967bd[_0x7367('0x3e')];if(!_0x4e4cb9['query'][_0x7367('0x41')](_0x7367('0x42'))){_0xcce7ca['limit']=qs['limit'](_0x4e4cb9['query']['limit']);_0xcce7ca[_0x7367('0x29')]=qs['offset'](_0x4e4cb9['query']['offset']);}_0xcce7ca[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x44')]);_0xcce7ca['where']=qs[_0x7367('0x3b')](_['pick'](_0x4e4cb9[_0x7367('0x3a')],_0xb967bd[_0x7367('0x3b')]),_0x4feb54);if(_0x4e4cb9['query'][_0x7367('0x45')]){_0xcce7ca['where']=_[_0x7367('0x46')](_0xcce7ca[_0x7367('0x47')],{'$or':_['map'](_0x4feb54,function(_0x352514){if(_0x352514[_0x7367('0x37')]!==_0x7367('0x48')){var _0x4eb3e4={};_0x4eb3e4[_0x352514[_0x7367('0x32')]]={'$like':'%'+_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x4eb3e4;}})});}_0xcce7ca=_[_0x7367('0x46')]({},_0xcce7ca,_0x4e4cb9[_0x7367('0x49')]);var _0x1ae5bd={'where':_0xcce7ca['where']};return db[_0x7367('0x4a')][_0x7367('0x4b')](_0x1ae5bd)[_0x7367('0x30')](function(_0x3aa651){_0x4b5120[_0x7367('0x4b')]=_0x3aa651;if(_0x4e4cb9[_0x7367('0x3a')][_0x7367('0x4c')]){_0xcce7ca[_0x7367('0x4d')]=[{'all':!![]}];}return db[_0x7367('0x4a')][_0x7367('0x4e')](_0xcce7ca);})[_0x7367('0x30')](function(_0x2cc095){_0x4b5120[_0x7367('0x4f')]=_0x2cc095;return _0x4b5120;})['then'](respondWithFilteredResult(_0xd22ddc,_0xcce7ca))['catch'](handleError(_0xd22ddc,null));};exports[_0x7367('0x50')]=function(_0x478bad,_0x115a2f){var _0x248f69={'raw':![],'where':{'id':_0x478bad[_0x7367('0x51')]['id']}},_0x2c315b={};_0x2c315b['model']=_[_0x7367('0x52')](db['ServicenowConfiguration'][_0x7367('0x35')]);_0x2c315b['query']=_[_0x7367('0x52')](_0x478bad[_0x7367('0x3a')]);_0x2c315b[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x2c315b[_0x7367('0x3e')],_0x2c315b[_0x7367('0x3a')]);_0x248f69[_0x7367('0x3c')]=_['intersection'](_0x2c315b[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x478bad['query'][_0x7367('0x3f')]));_0x248f69[_0x7367('0x3c')]=_0x248f69[_0x7367('0x3c')][_0x7367('0x40')]?_0x248f69['attributes']:_0x2c315b[_0x7367('0x3e')];if(_0x478bad['query'][_0x7367('0x4c')]){_0x248f69[_0x7367('0x4d')]=[{'all':!![]}];}_0x248f69=_[_0x7367('0x46')]({},_0x248f69,_0x478bad[_0x7367('0x49')]);return db[_0x7367('0x4a')]['find'](_0x248f69)[_0x7367('0x30')](handleEntityNotFound(_0x115a2f,null))['then'](respondWithResult(_0x115a2f,null))['catch'](handleError(_0x115a2f,null));};exports['create']=function(_0x54fc8c,_0x328c9f){return db['ServicenowConfiguration'][_0x7367('0x53')](_0x54fc8c['body'],{})[_0x7367('0x30')](respondWithResult(_0x328c9f,0xc9))[_0x7367('0x24')](handleError(_0x328c9f,null));};exports[_0x7367('0x2e')]=function(_0x24f4b4,_0x283efd){if(_0x24f4b4['body']['id']){delete _0x24f4b4[_0x7367('0x54')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x24f4b4['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x283efd,null))[_0x7367('0x30')](saveUpdates(_0x24f4b4[_0x7367('0x54')],null))[_0x7367('0x30')](respondWithResult(_0x283efd,null))['catch'](handleError(_0x283efd,null));};exports[_0x7367('0x2f')]=function(_0x2d80aa,_0x382b45){return db[_0x7367('0x4a')][_0x7367('0x55')]({'where':{'id':_0x2d80aa[_0x7367('0x51')]['id']}})['then'](handleEntityNotFound(_0x382b45,null))[_0x7367('0x30')](removeEntity(_0x382b45,null))['catch'](handleError(_0x382b45,null));};exports['getFields']=function(_0x4d3ee6,_0x1e890b,_0xd9208f){var _0x3e1910={};var _0xf8b435={};var _0x144fca;var _0x5e00e2;return db['ServicenowConfiguration'][_0x7367('0x56')]({'where':{'id':_0x4d3ee6[_0x7367('0x51')]['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x1e890b,null))[_0x7367('0x30')](function(_0x40aa95){if(_0x40aa95){_0x144fca=_0x40aa95;_0xf8b435['model']=_[_0x7367('0x52')](db[_0x7367('0x57')]['rawAttributes']);_0xf8b435['query']=_[_0x7367('0x52')](_0x4d3ee6[_0x7367('0x3a')]);_0xf8b435[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0xf8b435[_0x7367('0x3e')],_0xf8b435[_0x7367('0x3a')]);_0x3e1910[_0x7367('0x3c')]=_['intersection'](_0xf8b435[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x3f')]));_0x3e1910[_0x7367('0x3c')]=_0x3e1910['attributes'][_0x7367('0x40')]?_0x3e1910[_0x7367('0x3c')]:_0xf8b435[_0x7367('0x3e')];_0x3e1910[_0x7367('0x43')]=qs['sort'](_0x4d3ee6[_0x7367('0x3a')]['sort']);_0x3e1910[_0x7367('0x47')]=qs[_0x7367('0x3b')](_[_0x7367('0x58')](_0x4d3ee6[_0x7367('0x3a')],_0xf8b435['filters']));if(_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x45')]){_0x3e1910[_0x7367('0x47')]=_[_0x7367('0x46')](_0x3e1910['where'],{'$or':_[_0x7367('0x39')](_0x3e1910[_0x7367('0x3c')],function(_0x1313ad){var _0x232d99={};_0x232d99[_0x1313ad]={'$like':'%'+_0x4d3ee6[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x232d99;})});}_0x3e1910=_[_0x7367('0x46')]({},_0x3e1910,_0x4d3ee6[_0x7367('0x49')]);return _0x144fca[_0x7367('0x59')](_0x3e1910);}})['then'](function(_0x207282){if(_0x207282){_0x5e00e2=_0x207282[_0x7367('0x40')];if(!_0x4d3ee6[_0x7367('0x3a')]['hasOwnProperty'](_0x7367('0x42'))){_0x3e1910['limit']=qs[_0x7367('0x2a')](_0x4d3ee6[_0x7367('0x3a')]['limit']);_0x3e1910[_0x7367('0x29')]=qs[_0x7367('0x29')](_0x4d3ee6[_0x7367('0x3a')]['offset']);}return _0x144fca[_0x7367('0x59')](_0x3e1910);}})['then'](function(_0x5757b5){if(_0x5757b5){return _0x5757b5?{'count':_0x5e00e2,'rows':_0x5757b5}:null;}})[_0x7367('0x30')](respondWithResult(_0x1e890b,null))[_0x7367('0x24')](handleError(_0x1e890b,null));};exports[_0x7367('0x5a')]=function(_0x3eccfd,_0x54600,_0x52f355){var _0xbcef0c={};var _0x24df7b={};var _0x31499e;var _0x1f77d6;return db[_0x7367('0x4a')]['findOne']({'where':{'id':_0x3eccfd['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x54600,null))[_0x7367('0x30')](function(_0x53151b){if(_0x53151b){_0x31499e=_0x53151b;_0x24df7b['model']=_['keys'](db[_0x7367('0x57')][_0x7367('0x35')]);_0x24df7b[_0x7367('0x3a')]=_[_0x7367('0x52')](_0x3eccfd['query']);_0x24df7b[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x24df7b[_0x7367('0x3e')],_0x24df7b['query']);_0xbcef0c[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0x24df7b[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x3eccfd[_0x7367('0x3a')][_0x7367('0x3f')]));_0xbcef0c[_0x7367('0x3c')]=_0xbcef0c[_0x7367('0x3c')]['length']?_0xbcef0c[_0x7367('0x3c')]:_0x24df7b[_0x7367('0x3e')];_0xbcef0c[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x3eccfd[_0x7367('0x3a')][_0x7367('0x44')]);_0xbcef0c[_0x7367('0x47')]=qs['filters'](_[_0x7367('0x58')](_0x3eccfd['query'],_0x24df7b[_0x7367('0x3b')]));if(_0x3eccfd[_0x7367('0x3a')][_0x7367('0x45')]){_0xbcef0c[_0x7367('0x47')]=_[_0x7367('0x46')](_0xbcef0c[_0x7367('0x47')],{'$or':_[_0x7367('0x39')](_0xbcef0c['attributes'],function(_0x175628){var _0x3ff109={};_0x3ff109[_0x175628]={'$like':'%'+_0x3eccfd[_0x7367('0x3a')][_0x7367('0x45')]+'%'};return _0x3ff109;})});}_0xbcef0c=_[_0x7367('0x46')]({},_0xbcef0c,_0x3eccfd[_0x7367('0x49')]);return _0x31499e[_0x7367('0x5a')](_0xbcef0c);}})[_0x7367('0x30')](function(_0x518a09){if(_0x518a09){_0x1f77d6=_0x518a09[_0x7367('0x40')];if(!_0x3eccfd[_0x7367('0x3a')]['hasOwnProperty'](_0x7367('0x42'))){_0xbcef0c[_0x7367('0x2a')]=qs[_0x7367('0x2a')](_0x3eccfd['query'][_0x7367('0x2a')]);_0xbcef0c['offset']=qs[_0x7367('0x29')](_0x3eccfd['query'][_0x7367('0x29')]);}return _0x31499e[_0x7367('0x5a')](_0xbcef0c);}})[_0x7367('0x30')](function(_0xa27153){if(_0xa27153){return _0xa27153?{'count':_0x1f77d6,'rows':_0xa27153}:null;}})[_0x7367('0x30')](respondWithResult(_0x54600,null))[_0x7367('0x24')](handleError(_0x54600,null));};exports[_0x7367('0x5b')]=function(_0x2a3917,_0x4cc31,_0x547d85){var _0x5e31b2={};var _0x5dd5a8={};var _0x3ae4f5;var _0x403c10;return db[_0x7367('0x4a')]['findOne']({'where':{'id':_0x2a3917['params']['id']}})[_0x7367('0x30')](handleEntityNotFound(_0x4cc31,null))[_0x7367('0x30')](function(_0x59e4c9){if(_0x59e4c9){_0x3ae4f5=_0x59e4c9;_0x5dd5a8[_0x7367('0x3e')]=_['keys'](db[_0x7367('0x57')][_0x7367('0x35')]);_0x5dd5a8[_0x7367('0x3a')]=_[_0x7367('0x52')](_0x2a3917[_0x7367('0x3a')]);_0x5dd5a8[_0x7367('0x3b')]=_[_0x7367('0x3d')](_0x5dd5a8[_0x7367('0x3e')],_0x5dd5a8[_0x7367('0x3a')]);_0x5e31b2[_0x7367('0x3c')]=_[_0x7367('0x3d')](_0x5dd5a8[_0x7367('0x3e')],qs[_0x7367('0x3f')](_0x2a3917[_0x7367('0x3a')]['fields']));_0x5e31b2[_0x7367('0x3c')]=_0x5e31b2[_0x7367('0x3c')]['length']?_0x5e31b2['attributes']:_0x5dd5a8['model'];_0x5e31b2[_0x7367('0x43')]=qs[_0x7367('0x44')](_0x2a3917[_0x7367('0x3a')][_0x7367('0x44')]);_0x5e31b2[_0x7367('0x47')]=qs['filters'](_['pick'](_0x2a3917['query'],_0x5dd5a8[_0x7367('0x3b')]));if(_0x2a3917[_0x7367('0x3a')][_0x7367('0x45')]){_0x5e31b2['where']=_['merge'](_0x5e31b2[_0x7367('0x47')],{'$or':_[_0x7367('0x39')](_0x5e31b2[_0x7367('0x3c')],function(_0x34b885){var _0x3c18df={};_0x3c18df[_0x34b885]={'$like':'%'+_0x2a3917['query'][_0x7367('0x45')]+'%'};return _0x3c18df;})});}_0x5e31b2=_['merge']({},_0x5e31b2,_0x2a3917[_0x7367('0x49')]);return _0x3ae4f5[_0x7367('0x5b')](_0x5e31b2);}})[_0x7367('0x30')](function(_0x41dcf7){if(_0x41dcf7){_0x403c10=_0x41dcf7[_0x7367('0x40')];if(!_0x2a3917[_0x7367('0x3a')][_0x7367('0x41')](_0x7367('0x42'))){_0x5e31b2['limit']=qs['limit'](_0x2a3917[_0x7367('0x3a')][_0x7367('0x2a')]);_0x5e31b2[_0x7367('0x29')]=qs['offset'](_0x2a3917[_0x7367('0x3a')][_0x7367('0x29')]);}return _0x3ae4f5['getDescriptions'](_0x5e31b2);}})[_0x7367('0x30')](function(_0x38ec11){if(_0x38ec11){return _0x38ec11?{'count':_0x403c10,'rows':_0x38ec11}:null;}})[_0x7367('0x30')](respondWithResult(_0x4cc31,null))['catch'](handleError(_0x4cc31,null));}; \ No newline at end of file +var _0x149c=['rows','params','include','find','create','body','destroy','getFields','findOne','rawAttributes','order','getSubjects','ServicenowField','nolimit','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','end','stack','name','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x5de315,_0xea75a3){var _0x1040ea=function(_0x2aa0c3){while(--_0x2aa0c3){_0x5de315['push'](_0x5de315['shift']());}};_0x1040ea(++_0xea75a3);}(_0x149c,0xc7));var _0xc149=function(_0x5c919e,_0x5bbd2e){_0x5c919e=_0x5c919e-0x0;var _0x16128c=_0x149c[_0x5c919e];return _0x16128c;};'use strict';var pdf=require(_0xc149('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc149('0x1'));var zipdir=require(_0xc149('0x2'));var jsonpatch=require(_0xc149('0x3'));var rp=require(_0xc149('0x4'));var moment=require(_0xc149('0x5'));var BPromise=require(_0xc149('0x6'));var Mustache=require(_0xc149('0x7'));var util=require('util');var path=require(_0xc149('0x8'));var sox=require(_0xc149('0x9'));var csv=require(_0xc149('0xa'));var ejs=require(_0xc149('0xb'));var fs=require('fs');var _=require(_0xc149('0xc'));var squel=require(_0xc149('0xd'));var crypto=require(_0xc149('0xe'));var jsforce=require(_0xc149('0xf'));var deskjs=require(_0xc149('0x10'));var toCsv=require(_0xc149('0xa'));var querystring=require('querystring');var Papa=require(_0xc149('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc149('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc149('0x13'))(_0xc149('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc149('0x15'));var db=require(_0xc149('0x16'))['db'];var jayson=require(_0xc149('0x17'));var client=jayson[_0xc149('0x18')][_0xc149('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ba9c1,_0xadb42a,_0x2b4ae1,_0xe95098){return new BPromise(function(_0x3d7dc6,_0x29f347){var _0x55b476=_0xe95098||client;return _0x55b476[_0xc149('0x1a')](_0x4ba9c1,_0x2b4ae1)[_0xc149('0x1b')](function(_0x437d80){logger[_0xc149('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0xadb42a,_0xc149('0x1d'));logger[_0xc149('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xadb42a,_0xc149('0x1d'),JSON[_0xc149('0x1f')](_0x437d80));if(_0x437d80[_0xc149('0x20')]){if(_0x437d80['error'][_0xc149('0x21')]===0x1f4){logger[_0xc149('0x20')](_0xc149('0x22'),_0xadb42a,_0x437d80[_0xc149('0x20')]['message']);return _0x29f347(_0x437d80[_0xc149('0x20')][_0xc149('0x23')]);}logger[_0xc149('0x20')](_0xc149('0x22'),_0xadb42a,_0x437d80['error'][_0xc149('0x23')]);return _0x3d7dc6(_0x437d80[_0xc149('0x20')]['message']);}else{logger['info'](_0xc149('0x22'),_0xadb42a,_0xc149('0x1d'));_0x3d7dc6(_0x437d80[_0xc149('0x24')][_0xc149('0x23')]);}})[_0xc149('0x25')](function(_0x1815f5){logger['error'](_0xc149('0x22'),_0xadb42a,_0x1815f5);_0x29f347(_0x1815f5);});});}function respondWithStatusCode(_0x464d29,_0x1e19c1){_0x1e19c1=_0x1e19c1||0xcc;return function(_0x3a0370){if(_0x3a0370){return _0x464d29[_0xc149('0x26')](_0x1e19c1);}return _0x464d29[_0xc149('0x27')](_0x1e19c1)['end']();};}function respondWithResult(_0x22cc78,_0xa27969){_0xa27969=_0xa27969||0xc8;return function(_0xdc443d){if(_0xdc443d){return _0x22cc78[_0xc149('0x27')](_0xa27969)[_0xc149('0x28')](_0xdc443d);}};}function respondWithFilteredResult(_0xa3519b,_0x45a1d2){return function(_0x2359ba){if(_0x2359ba){var _0x170140=_0x2359ba[_0xc149('0x29')],_0x413ca3=_0x45a1d2['offset'],_0x457b23=_0x45a1d2['offset']+_0x45a1d2[_0xc149('0x2a')],_0x5855f0;if(_0x457b23>=_0x170140){_0x457b23=_0x170140;_0x5855f0=0xc8;}else{_0x5855f0=0xce;}_0xa3519b[_0xc149('0x27')](_0x5855f0);return _0xa3519b[_0xc149('0x2b')](_0xc149('0x2c'),_0x413ca3+'-'+_0x457b23+'/'+_0x170140)[_0xc149('0x28')](_0x2359ba);}return null;};}function patchUpdates(_0x4f2713){return function(_0x3ec254){try{jsonpatch[_0xc149('0x2d')](_0x3ec254,_0x4f2713,!![]);}catch(_0x1380de){return BPromise[_0xc149('0x2e')](_0x1380de);}return _0x3ec254[_0xc149('0x2f')]();};}function saveUpdates(_0x5b022e,_0x2175f1){return function(_0x453d94){if(_0x453d94){return _0x453d94[_0xc149('0x30')](_0x5b022e)[_0xc149('0x1b')](function(_0x4c4225){return _0x4c4225;});}return null;};}function removeEntity(_0x5e8449,_0x2a7b80){return function(_0x5b2425){if(_0x5b2425){return _0x5b2425['destroy']()[_0xc149('0x1b')](function(){_0x5e8449[_0xc149('0x27')](0xcc)[_0xc149('0x31')]();});}};}function handleEntityNotFound(_0x2e6e90,_0x2d0103){return function(_0x9d6188){if(!_0x9d6188){_0x2e6e90[_0xc149('0x26')](0x194);}return _0x9d6188;};}function handleError(_0x4be4cf,_0x2b7717){_0x2b7717=_0x2b7717||0x1f4;return function(_0x364ba6){logger[_0xc149('0x20')](_0x364ba6[_0xc149('0x32')]);if(_0x364ba6[_0xc149('0x33')]){delete _0x364ba6[_0xc149('0x33')];}_0x4be4cf[_0xc149('0x27')](_0x2b7717)['send'](_0x364ba6);};}exports[_0xc149('0x34')]=function(_0x13cb06,_0x3204f1){var _0x1eeac7={},_0x17fe77={},_0x5c1cb4={'count':0x0,'rows':[]};var _0x476579=_[_0xc149('0x35')](db[_0xc149('0x36')]['rawAttributes'],function(_0x24c612){return{'name':_0x24c612[_0xc149('0x37')],'type':_0x24c612[_0xc149('0x38')][_0xc149('0x39')]};});_0x17fe77[_0xc149('0x3a')]=_[_0xc149('0x35')](_0x476579,_0xc149('0x33'));_0x17fe77[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x13cb06[_0xc149('0x3b')]);_0x17fe77[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x17fe77[_0xc149('0x3a')],_0x17fe77[_0xc149('0x3b')]);_0x1eeac7[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x17fe77[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x13cb06[_0xc149('0x3b')][_0xc149('0x40')]));_0x1eeac7['attributes']=_0x1eeac7['attributes'][_0xc149('0x41')]?_0x1eeac7[_0xc149('0x3f')]:_0x17fe77[_0xc149('0x3a')];if(!_0x13cb06[_0xc149('0x3b')][_0xc149('0x42')]('nolimit')){_0x1eeac7['limit']=qs['limit'](_0x13cb06[_0xc149('0x3b')][_0xc149('0x2a')]);_0x1eeac7[_0xc149('0x43')]=qs[_0xc149('0x43')](_0x13cb06['query'][_0xc149('0x43')]);}_0x1eeac7['order']=qs['sort'](_0x13cb06[_0xc149('0x3b')][_0xc149('0x44')]);_0x1eeac7[_0xc149('0x45')]=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x13cb06[_0xc149('0x3b')],_0x17fe77['filters']),_0x476579);if(_0x13cb06[_0xc149('0x3b')][_0xc149('0x47')]){_0x1eeac7[_0xc149('0x45')]=_[_0xc149('0x48')](_0x1eeac7[_0xc149('0x45')],{'$or':_['map'](_0x476579,function(_0x1d2b29){if(_0x1d2b29['type']!==_0xc149('0x49')){var _0x3af542={};_0x3af542[_0x1d2b29['name']]={'$like':'%'+_0x13cb06[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x3af542;}})});}_0x1eeac7=_[_0xc149('0x48')]({},_0x1eeac7,_0x13cb06[_0xc149('0x4a')]);var _0x286f55={'where':_0x1eeac7[_0xc149('0x45')]};return db[_0xc149('0x36')][_0xc149('0x29')](_0x286f55)[_0xc149('0x1b')](function(_0x26fbcb){_0x5c1cb4[_0xc149('0x29')]=_0x26fbcb;if(_0x13cb06['query'][_0xc149('0x4b')]){_0x1eeac7['include']=[{'all':!![]}];}return db[_0xc149('0x36')][_0xc149('0x4c')](_0x1eeac7);})[_0xc149('0x1b')](function(_0x27a290){_0x5c1cb4[_0xc149('0x4d')]=_0x27a290;return _0x5c1cb4;})[_0xc149('0x1b')](respondWithFilteredResult(_0x3204f1,_0x1eeac7))[_0xc149('0x25')](handleError(_0x3204f1,null));};exports['show']=function(_0x197c1a,_0x694407){var _0x58b15f={'raw':![],'where':{'id':_0x197c1a[_0xc149('0x4e')]['id']}},_0x54cae1={};_0x54cae1[_0xc149('0x3a')]=_[_0xc149('0x3c')](db[_0xc149('0x36')]['rawAttributes']);_0x54cae1[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x197c1a[_0xc149('0x3b')]);_0x54cae1[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x54cae1[_0xc149('0x3a')],_0x54cae1['query']);_0x58b15f[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x54cae1[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x197c1a['query'][_0xc149('0x40')]));_0x58b15f[_0xc149('0x3f')]=_0x58b15f[_0xc149('0x3f')][_0xc149('0x41')]?_0x58b15f[_0xc149('0x3f')]:_0x54cae1[_0xc149('0x3a')];if(_0x197c1a[_0xc149('0x3b')][_0xc149('0x4b')]){_0x58b15f[_0xc149('0x4f')]=[{'all':!![]}];}_0x58b15f=_['merge']({},_0x58b15f,_0x197c1a[_0xc149('0x4a')]);return db[_0xc149('0x36')][_0xc149('0x50')](_0x58b15f)['then'](handleEntityNotFound(_0x694407,null))[_0xc149('0x1b')](respondWithResult(_0x694407,null))[_0xc149('0x25')](handleError(_0x694407,null));};exports[_0xc149('0x51')]=function(_0x369396,_0x4d3334){return db[_0xc149('0x36')]['create'](_0x369396['body'],{})[_0xc149('0x1b')](respondWithResult(_0x4d3334,0xc9))['catch'](handleError(_0x4d3334,null));};exports[_0xc149('0x30')]=function(_0xcf804,_0x408e70){if(_0xcf804[_0xc149('0x52')]['id']){delete _0xcf804[_0xc149('0x52')]['id'];}return db['ServicenowConfiguration'][_0xc149('0x50')]({'where':{'id':_0xcf804[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x408e70,null))[_0xc149('0x1b')](saveUpdates(_0xcf804['body'],null))[_0xc149('0x1b')](respondWithResult(_0x408e70,null))[_0xc149('0x25')](handleError(_0x408e70,null));};exports[_0xc149('0x53')]=function(_0x51a893,_0x35cbc7){return db['ServicenowConfiguration']['find']({'where':{'id':_0x51a893['params']['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x35cbc7,null))[_0xc149('0x1b')](removeEntity(_0x35cbc7,null))[_0xc149('0x25')](handleError(_0x35cbc7,null));};exports[_0xc149('0x54')]=function(_0x3d270e,_0x154836,_0x1f6b8f){var _0x3488a6={};var _0xb7ecf8={};var _0x54ff5f;var _0xdfd265;return db[_0xc149('0x36')][_0xc149('0x55')]({'where':{'id':_0x3d270e[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x154836,null))[_0xc149('0x1b')](function(_0x2c0000){if(_0x2c0000){_0x54ff5f=_0x2c0000;_0xb7ecf8[_0xc149('0x3a')]=_[_0xc149('0x3c')](db['ServicenowField'][_0xc149('0x56')]);_0xb7ecf8[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x3d270e['query']);_0xb7ecf8['filters']=_['intersection'](_0xb7ecf8['model'],_0xb7ecf8[_0xc149('0x3b')]);_0x3488a6[_0xc149('0x3f')]=_['intersection'](_0xb7ecf8[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x3d270e[_0xc149('0x3b')]['fields']));_0x3488a6[_0xc149('0x3f')]=_0x3488a6[_0xc149('0x3f')]['length']?_0x3488a6[_0xc149('0x3f')]:_0xb7ecf8[_0xc149('0x3a')];_0x3488a6[_0xc149('0x57')]=qs[_0xc149('0x44')](_0x3d270e[_0xc149('0x3b')][_0xc149('0x44')]);_0x3488a6['where']=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x3d270e['query'],_0xb7ecf8[_0xc149('0x3d')]));if(_0x3d270e['query']['filter']){_0x3488a6[_0xc149('0x45')]=_[_0xc149('0x48')](_0x3488a6[_0xc149('0x45')],{'$or':_['map'](_0x3488a6['attributes'],function(_0x58ba3d){var _0x268324={};_0x268324[_0x58ba3d]={'$like':'%'+_0x3d270e[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x268324;})});}_0x3488a6=_[_0xc149('0x48')]({},_0x3488a6,_0x3d270e[_0xc149('0x4a')]);return _0x54ff5f['getFields'](_0x3488a6);}})[_0xc149('0x1b')](function(_0xf2b0fe){if(_0xf2b0fe){_0xdfd265=_0xf2b0fe[_0xc149('0x41')];if(!_0x3d270e[_0xc149('0x3b')][_0xc149('0x42')]('nolimit')){_0x3488a6[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x3d270e['query']['limit']);_0x3488a6[_0xc149('0x43')]=qs['offset'](_0x3d270e[_0xc149('0x3b')]['offset']);}return _0x54ff5f[_0xc149('0x54')](_0x3488a6);}})[_0xc149('0x1b')](function(_0x844959){if(_0x844959){return _0x844959?{'count':_0xdfd265,'rows':_0x844959}:null;}})[_0xc149('0x1b')](respondWithResult(_0x154836,null))['catch'](handleError(_0x154836,null));};exports[_0xc149('0x58')]=function(_0x2c0753,_0x97c1f5,_0x3dd359){var _0x4f0777={};var _0x42eede={};var _0x108b1a;var _0x23136d;return db[_0xc149('0x36')][_0xc149('0x55')]({'where':{'id':_0x2c0753[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x97c1f5,null))[_0xc149('0x1b')](function(_0x3bd019){if(_0x3bd019){_0x108b1a=_0x3bd019;_0x42eede['model']=_[_0xc149('0x3c')](db[_0xc149('0x59')]['rawAttributes']);_0x42eede['query']=_[_0xc149('0x3c')](_0x2c0753[_0xc149('0x3b')]);_0x42eede[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x42eede[_0xc149('0x3a')],_0x42eede['query']);_0x4f0777[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x42eede['model'],qs['fields'](_0x2c0753[_0xc149('0x3b')][_0xc149('0x40')]));_0x4f0777['attributes']=_0x4f0777[_0xc149('0x3f')][_0xc149('0x41')]?_0x4f0777[_0xc149('0x3f')]:_0x42eede[_0xc149('0x3a')];_0x4f0777[_0xc149('0x57')]=qs[_0xc149('0x44')](_0x2c0753[_0xc149('0x3b')][_0xc149('0x44')]);_0x4f0777['where']=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x2c0753['query'],_0x42eede[_0xc149('0x3d')]));if(_0x2c0753[_0xc149('0x3b')][_0xc149('0x47')]){_0x4f0777[_0xc149('0x45')]=_['merge'](_0x4f0777['where'],{'$or':_[_0xc149('0x35')](_0x4f0777['attributes'],function(_0x5650a0){var _0x550e8f={};_0x550e8f[_0x5650a0]={'$like':'%'+_0x2c0753[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x550e8f;})});}_0x4f0777=_[_0xc149('0x48')]({},_0x4f0777,_0x2c0753[_0xc149('0x4a')]);return _0x108b1a[_0xc149('0x58')](_0x4f0777);}})[_0xc149('0x1b')](function(_0x3eae70){if(_0x3eae70){_0x23136d=_0x3eae70[_0xc149('0x41')];if(!_0x2c0753[_0xc149('0x3b')]['hasOwnProperty'](_0xc149('0x5a'))){_0x4f0777[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x2c0753[_0xc149('0x3b')][_0xc149('0x2a')]);_0x4f0777['offset']=qs[_0xc149('0x43')](_0x2c0753['query']['offset']);}return _0x108b1a[_0xc149('0x58')](_0x4f0777);}})[_0xc149('0x1b')](function(_0x5f85a0){if(_0x5f85a0){return _0x5f85a0?{'count':_0x23136d,'rows':_0x5f85a0}:null;}})[_0xc149('0x1b')](respondWithResult(_0x97c1f5,null))[_0xc149('0x25')](handleError(_0x97c1f5,null));};exports['getDescriptions']=function(_0x5a881b,_0xfcf318,_0x1a6199){var _0x289a32={};var _0x4c3d63={};var _0x27f6a4;var _0x66388f;return db['ServicenowConfiguration'][_0xc149('0x55')]({'where':{'id':_0x5a881b[_0xc149('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfcf318,null))['then'](function(_0x22268a){if(_0x22268a){_0x27f6a4=_0x22268a;_0x4c3d63[_0xc149('0x3a')]=_[_0xc149('0x3c')](db[_0xc149('0x59')]['rawAttributes']);_0x4c3d63['query']=_[_0xc149('0x3c')](_0x5a881b[_0xc149('0x3b')]);_0x4c3d63[_0xc149('0x3d')]=_['intersection'](_0x4c3d63['model'],_0x4c3d63['query']);_0x289a32[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x4c3d63['model'],qs[_0xc149('0x40')](_0x5a881b[_0xc149('0x3b')][_0xc149('0x40')]));_0x289a32[_0xc149('0x3f')]=_0x289a32[_0xc149('0x3f')][_0xc149('0x41')]?_0x289a32[_0xc149('0x3f')]:_0x4c3d63[_0xc149('0x3a')];_0x289a32['order']=qs[_0xc149('0x44')](_0x5a881b[_0xc149('0x3b')]['sort']);_0x289a32[_0xc149('0x45')]=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x5a881b[_0xc149('0x3b')],_0x4c3d63[_0xc149('0x3d')]));if(_0x5a881b[_0xc149('0x3b')][_0xc149('0x47')]){_0x289a32[_0xc149('0x45')]=_[_0xc149('0x48')](_0x289a32[_0xc149('0x45')],{'$or':_[_0xc149('0x35')](_0x289a32['attributes'],function(_0x225472){var _0x5969b0={};_0x5969b0[_0x225472]={'$like':'%'+_0x5a881b['query'][_0xc149('0x47')]+'%'};return _0x5969b0;})});}_0x289a32=_[_0xc149('0x48')]({},_0x289a32,_0x5a881b[_0xc149('0x4a')]);return _0x27f6a4[_0xc149('0x5b')](_0x289a32);}})[_0xc149('0x1b')](function(_0x338f33){if(_0x338f33){_0x66388f=_0x338f33[_0xc149('0x41')];if(!_0x5a881b[_0xc149('0x3b')][_0xc149('0x42')](_0xc149('0x5a'))){_0x289a32[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x5a881b[_0xc149('0x3b')][_0xc149('0x2a')]);_0x289a32[_0xc149('0x43')]=qs[_0xc149('0x43')](_0x5a881b[_0xc149('0x3b')]['offset']);}return _0x27f6a4[_0xc149('0x5b')](_0x289a32);}})[_0xc149('0x1b')](function(_0xf1bb59){if(_0xf1bb59){return _0xf1bb59?{'count':_0x66388f,'rows':_0xf1bb59}:null;}})[_0xc149('0x1b')](respondWithResult(_0xfcf318,null))[_0xc149('0x25')](handleError(_0xfcf318,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c2c2544..37933d3 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 _0x76fb=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x76fb,0xcb));var _0xb76f=function(_0x3da1c1,_0x809b72){_0x3da1c1=_0x3da1c1-0x0;var _0x46083d=_0x76fb[_0x3da1c1];return _0x46083d;};'use strict';var _=require('lodash');var util=require(_0xb76f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb76f('0x1'));var BPromise=require(_0xb76f('0x2'));var rp=require(_0xb76f('0x3'));var fs=require('fs');var path=require(_0xb76f('0x4'));var rimraf=require(_0xb76f('0x5'));var config=require(_0xb76f('0x6'));var attributes=require(_0xb76f('0x7'));module[_0xb76f('0x8')]=function(_0x110dd9,_0x822d6b){return _0x110dd9['define'](_0xb76f('0x9'),attributes,{'tableName':_0xb76f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa43e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x2e0a0c,_0x3fd647){var _0x3a20d7=function(_0x563222){while(--_0x563222){_0x2e0a0c['push'](_0x2e0a0c['shift']());}};_0x3a20d7(++_0x3fd647);}(_0xa43e,0x13f));var _0xea43=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa43e[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xea43('0x0'));var util=require(_0xea43('0x1'));var logger=require(_0xea43('0x2'))('api');var moment=require(_0xea43('0x3'));var BPromise=require(_0xea43('0x4'));var rp=require(_0xea43('0x5'));var fs=require('fs');var path=require(_0xea43('0x6'));var rimraf=require(_0xea43('0x7'));var config=require(_0xea43('0x8'));var attributes=require(_0xea43('0x9'));module[_0xea43('0xa')]=function(_0x222e43,_0x3cfea1){return _0x222e43[_0xea43('0xb')](_0xea43('0xc'),attributes,{'tableName':_0xea43('0xd'),'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 15a5abf..75e466c 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 _0x2127=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4d8de1,_0x1d1cd1){var _0x52d754=function(_0x2fb3a9){while(--_0x2fb3a9){_0x4d8de1['push'](_0x4d8de1['shift']());}};_0x52d754(++_0x1d1cd1);}(_0x2127,0xf1));var _0x7212=function(_0x3fdb26,_0x16e0ce){_0x3fdb26=_0x3fdb26-0x0;var _0x413bbb=_0x2127[_0x3fdb26];return _0x413bbb;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require(_0x7212('0x2'));var BPromise=require(_0x7212('0x3'));var rs=require(_0x7212('0x4'));var fs=require('fs');var Redis=require(_0x7212('0x5'));var db=require(_0x7212('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7212('0x7'))('rpc');var config=require(_0x7212('0x8'));var jayson=require(_0x7212('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1760d4,_0x40f2ff,_0x423717){return new BPromise(function(_0x131a94,_0x221551){return client['request'](_0x1760d4,_0x423717)[_0x7212('0xa')](function(_0x14c367){logger['info'](_0x7212('0xb'),_0x40f2ff,_0x7212('0xc'));logger[_0x7212('0xd')](_0x7212('0xe'),_0x40f2ff,_0x7212('0xc'),JSON[_0x7212('0xf')](_0x14c367));if(_0x14c367[_0x7212('0x10')]){if(_0x14c367[_0x7212('0x10')][_0x7212('0x11')]===0x1f4){logger[_0x7212('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x40f2ff,_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);return _0x221551(_0x14c367['error'][_0x7212('0x12')]);}logger[_0x7212('0x10')](_0x7212('0xb'),_0x40f2ff,_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);return _0x131a94(_0x14c367[_0x7212('0x10')][_0x7212('0x12')]);}else{logger[_0x7212('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x40f2ff,_0x7212('0xc'));_0x131a94(_0x14c367[_0x7212('0x14')][_0x7212('0x12')]);}})[_0x7212('0x15')](function(_0x5b8c70){logger['error'](_0x7212('0xb'),_0x40f2ff,_0x5b8c70);_0x221551(_0x5b8c70);});});} \ No newline at end of file +var _0x6f3c=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x123450,_0x491c01){var _0x23b29d=function(_0x2c23cb){while(--_0x2c23cb){_0x123450['push'](_0x123450['shift']());}};_0x23b29d(++_0x491c01);}(_0x6f3c,0x1d0));var _0xc6f3=function(_0xbbc8b3,_0x56c328){_0xbbc8b3=_0xbbc8b3-0x0;var _0x434d6c=_0x6f3c[_0xbbc8b3];return _0x434d6c;};'use strict';var _=require(_0xc6f3('0x0'));var util=require(_0xc6f3('0x1'));var moment=require(_0xc6f3('0x2'));var BPromise=require(_0xc6f3('0x3'));var rs=require(_0xc6f3('0x4'));var fs=require('fs');var Redis=require(_0xc6f3('0x5'));var db=require(_0xc6f3('0x6'))['db'];var utils=require(_0xc6f3('0x7'));var logger=require(_0xc6f3('0x8'))(_0xc6f3('0x9'));var config=require(_0xc6f3('0xa'));var jayson=require(_0xc6f3('0xb'));var client=jayson[_0xc6f3('0xc')][_0xc6f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x48f51a,_0x45690d,_0x2d8f8f){return new BPromise(function(_0x3bd8d7,_0x12e449){return client[_0xc6f3('0xe')](_0x48f51a,_0x2d8f8f)[_0xc6f3('0xf')](function(_0x252dd8){logger[_0xc6f3('0x10')](_0xc6f3('0x11'),_0x45690d,_0xc6f3('0x12'));logger[_0xc6f3('0x13')](_0xc6f3('0x14'),_0x45690d,_0xc6f3('0x12'),JSON[_0xc6f3('0x15')](_0x252dd8));if(_0x252dd8[_0xc6f3('0x16')]){if(_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x17')]===0x1f4){logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x252dd8['error'][_0xc6f3('0x18')]);return _0x12e449(_0x252dd8['error'][_0xc6f3('0x18')]);}logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x18')]);return _0x3bd8d7(_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x18')]);}else{logger[_0xc6f3('0x10')](_0xc6f3('0x11'),_0x45690d,_0xc6f3('0x12'));_0x3bd8d7(_0x252dd8[_0xc6f3('0x19')][_0xc6f3('0x18')]);}})[_0xc6f3('0x1a')](function(_0x21e0de){logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x21e0de);_0x12e449(_0x21e0de);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0f54792..38034b3 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 _0x6e0f=['isAuthenticated','show','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2350f0,_0x3f8391){var _0x3c24e0=function(_0x1ab696){while(--_0x1ab696){_0x2350f0['push'](_0x2350f0['shift']());}};_0x3c24e0(++_0x3f8391);}(_0x6e0f,0x14b));var _0xf6e0=function(_0x30ec0a,_0x390560){_0x30ec0a=_0x30ec0a-0x0;var _0x1c5562=_0x6e0f[_0x30ec0a];return _0x1c5562;};'use strict';var multer=require(_0xf6e0('0x0'));var util=require(_0xf6e0('0x1'));var path=require(_0xf6e0('0x2'));var timeout=require(_0xf6e0('0x3'));var express=require(_0xf6e0('0x4'));var router=express[_0xf6e0('0x5')]();var auth=require(_0xf6e0('0x6'));var interaction=require(_0xf6e0('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xf6e0('0x8')]('/',auth[_0xf6e0('0x9')](),controller['index']);router[_0xf6e0('0x8')]('/:id',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xa')]);router['post']('/',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xb')]);router[_0xf6e0('0xc')]('/:id',auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xd')]);router['delete'](_0xf6e0('0xe'),auth[_0xf6e0('0x9')](),controller[_0xf6e0('0xf')]);module[_0xf6e0('0x10')]=router; \ No newline at end of file +var _0xddf8=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e39aa,_0x587537){var _0xbfa068=function(_0x48dbd4){while(--_0x48dbd4){_0x5e39aa['push'](_0x5e39aa['shift']());}};_0xbfa068(++_0x587537);}(_0xddf8,0xcb));var _0x8ddf=function(_0x3fc3bb,_0xb00c65){_0x3fc3bb=_0x3fc3bb-0x0;var _0xf21227=_0xddf8[_0x3fc3bb];return _0xf21227;};'use strict';var multer=require(_0x8ddf('0x0'));var util=require(_0x8ddf('0x1'));var path=require(_0x8ddf('0x2'));var timeout=require(_0x8ddf('0x3'));var express=require(_0x8ddf('0x4'));var router=express[_0x8ddf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ddf('0x6'));var config=require('../../config/environment');var controller=require(_0x8ddf('0x7'));router[_0x8ddf('0x8')]('/',auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xa')]);router[_0x8ddf('0x8')](_0x8ddf('0xb'),auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xc')]);router[_0x8ddf('0xd')]('/',auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xe')]);router[_0x8ddf('0xf')](_0x8ddf('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8ddf('0x10')](_0x8ddf('0xb'),auth[_0x8ddf('0x9')](),controller[_0x8ddf('0x11')]);module[_0x8ddf('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ed08503..9d8d5be 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 _0xb1db=['STRING','ENUM','string','variable','customVariable','keyValue'];(function(_0x346c21,_0xd1d703){var _0x5b591c=function(_0x609651){while(--_0x609651){_0x346c21['push'](_0x346c21['shift']());}};_0x5b591c(++_0xd1d703);}(_0xb1db,0x1be));var _0xbb1d=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xb1db[_0x211bc3];return _0x34c9a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xbb1d('0x0'),_0xbb1d('0x1'),_0xbb1d('0x2'),_0xbb1d('0x3')),'defaultValue':_0xbb1d('0x0')},'content':{'type':Sequelize[_0xbb1d('0x4')]},'key':{'type':Sequelize[_0xbb1d('0x4')]},'keyType':{'type':Sequelize[_0xbb1d('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xbb1d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbb1d('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb1d('0x4')]}}; \ No newline at end of file +var _0xab2a=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string','STRING'];(function(_0x3ed495,_0x5b06fd){var _0xdfd441=function(_0x2c31a6){while(--_0x2c31a6){_0x3ed495['push'](_0x3ed495['shift']());}};_0xdfd441(++_0x5b06fd);}(_0xab2a,0x1a1));var _0xaab2=function(_0x4f2e68,_0x205ecb){_0x4f2e68=_0x4f2e68-0x0;var _0x54e9e5=_0xab2a[_0x4f2e68];return _0x54e9e5;};'use strict';var Sequelize=require(_0xaab2('0x0'));module[_0xaab2('0x1')]={'type':{'type':Sequelize[_0xaab2('0x2')]('string',_0xaab2('0x3'),'customVariable',_0xaab2('0x4')),'defaultValue':_0xaab2('0x5')},'content':{'type':Sequelize[_0xaab2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaab2('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaab2('0x6')]},'nameField':{'type':Sequelize[_0xaab2('0x6')]},'customField':{'type':Sequelize[_0xaab2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaab2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4417634..76e68c2 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 _0x7044=['length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0x7044,0x147));var _0x4704=function(_0x3cb52a,_0x5a586d){_0x3cb52a=_0x3cb52a-0x0;var _0x4e6bab=_0x7044[_0x3cb52a];return _0x4e6bab;};'use strict';var pdf=require(_0x4704('0x0'));var emlformat=require(_0x4704('0x1'));var rimraf=require(_0x4704('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4704('0x3'));var rp=require(_0x4704('0x4'));var moment=require(_0x4704('0x5'));var BPromise=require(_0x4704('0x6'));var Mustache=require('mustache');var util=require(_0x4704('0x7'));var path=require('path');var sox=require(_0x4704('0x8'));var csv=require(_0x4704('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4704('0xa'));var crypto=require(_0x4704('0xb'));var jsforce=require(_0x4704('0xc'));var deskjs=require(_0x4704('0xd'));var toCsv=require(_0x4704('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4704('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4704('0xf'));var as=require(_0x4704('0x10'));var hardwareService=require(_0x4704('0x11'));var logger=require(_0x4704('0x12'))(_0x4704('0x13'));var utils=require('../../config/utils');var config=require(_0x4704('0x14'));var licenseUtil=require(_0x4704('0x15'));var db=require(_0x4704('0x16'))['db'];function respondWithStatusCode(_0x30f8e8,_0x39ee42){_0x39ee42=_0x39ee42||0xcc;return function(_0x268453){if(_0x268453){return _0x30f8e8['sendStatus'](_0x39ee42);}return _0x30f8e8[_0x4704('0x17')](_0x39ee42)[_0x4704('0x18')]();};}function respondWithResult(_0x290e8e,_0x2ae487){_0x2ae487=_0x2ae487||0xc8;return function(_0x246765){if(_0x246765){return _0x290e8e[_0x4704('0x17')](_0x2ae487)[_0x4704('0x19')](_0x246765);}};}function respondWithFilteredResult(_0x3acce4,_0x27c4b8){return function(_0x5d5f3b){if(_0x5d5f3b){var _0x51ea30=_0x5d5f3b[_0x4704('0x1a')],_0xda3cbb=_0x27c4b8[_0x4704('0x1b')],_0x3930c2=_0x27c4b8['offset']+_0x27c4b8[_0x4704('0x1c')],_0x324169;if(_0x3930c2>=_0x51ea30){_0x3930c2=_0x51ea30;_0x324169=0xc8;}else{_0x324169=0xce;}_0x3acce4[_0x4704('0x17')](_0x324169);return _0x3acce4[_0x4704('0x1d')](_0x4704('0x1e'),_0xda3cbb+'-'+_0x3930c2+'/'+_0x51ea30)[_0x4704('0x19')](_0x5d5f3b);}return null;};}function patchUpdates(_0x4aa6b5){return function(_0x14b553){try{jsonpatch['apply'](_0x14b553,_0x4aa6b5,!![]);}catch(_0x360fa2){return BPromise[_0x4704('0x1f')](_0x360fa2);}return _0x14b553[_0x4704('0x20')]();};}function saveUpdates(_0x91fc0f,_0x568704){return function(_0x67825b){if(_0x67825b){return _0x67825b['update'](_0x91fc0f)[_0x4704('0x21')](function(_0x5d102c){return _0x5d102c;});}return null;};}function removeEntity(_0x3e7d5b,_0x85ac91){return function(_0x18d3d6){if(_0x18d3d6){return _0x18d3d6[_0x4704('0x22')]()[_0x4704('0x21')](function(){_0x3e7d5b['status'](0xcc)[_0x4704('0x18')]();});}};}function handleEntityNotFound(_0x26d9b1,_0x48bbb1){return function(_0xe3cec7){if(!_0xe3cec7){_0x26d9b1[_0x4704('0x23')](0x194);}return _0xe3cec7;};}function handleError(_0x5caeba,_0x51be5f){_0x51be5f=_0x51be5f||0x1f4;return function(_0x1c3e2d){logger[_0x4704('0x24')](_0x1c3e2d[_0x4704('0x25')]);if(_0x1c3e2d[_0x4704('0x26')]){delete _0x1c3e2d[_0x4704('0x26')];}_0x5caeba['status'](_0x51be5f)[_0x4704('0x27')](_0x1c3e2d);};}exports[_0x4704('0x28')]=function(_0x4aae62,_0x349366){var _0x14435={},_0xb9f47e={},_0x34d080={'count':0x0,'rows':[]};var _0x125d9c=_[_0x4704('0x29')](db[_0x4704('0x2a')][_0x4704('0x2b')],function(_0x2d1177){return{'name':_0x2d1177[_0x4704('0x2c')],'type':_0x2d1177['type'][_0x4704('0x2d')]};});_0xb9f47e[_0x4704('0x2e')]=_[_0x4704('0x29')](_0x125d9c,'name');_0xb9f47e['query']=_[_0x4704('0x2f')](_0x4aae62[_0x4704('0x30')]);_0xb9f47e[_0x4704('0x31')]=_[_0x4704('0x32')](_0xb9f47e[_0x4704('0x2e')],_0xb9f47e[_0x4704('0x30')]);_0x14435[_0x4704('0x33')]=_[_0x4704('0x32')](_0xb9f47e['model'],qs[_0x4704('0x34')](_0x4aae62['query'][_0x4704('0x34')]));_0x14435[_0x4704('0x33')]=_0x14435[_0x4704('0x33')][_0x4704('0x35')]?_0x14435['attributes']:_0xb9f47e['model'];if(!_0x4aae62['query'][_0x4704('0x36')](_0x4704('0x37'))){_0x14435[_0x4704('0x1c')]=qs[_0x4704('0x1c')](_0x4aae62[_0x4704('0x30')][_0x4704('0x1c')]);_0x14435[_0x4704('0x1b')]=qs[_0x4704('0x1b')](_0x4aae62[_0x4704('0x30')][_0x4704('0x1b')]);}_0x14435[_0x4704('0x38')]=qs[_0x4704('0x39')](_0x4aae62[_0x4704('0x30')][_0x4704('0x39')]);_0x14435['where']=qs[_0x4704('0x31')](_[_0x4704('0x3a')](_0x4aae62[_0x4704('0x30')],_0xb9f47e[_0x4704('0x31')]),_0x125d9c);if(_0x4aae62[_0x4704('0x30')][_0x4704('0x3b')]){_0x14435['where']=_[_0x4704('0x3c')](_0x14435[_0x4704('0x3d')],{'$or':_[_0x4704('0x29')](_0x125d9c,function(_0x42fab9){if(_0x42fab9[_0x4704('0x3e')]!==_0x4704('0x3f')){var _0x2ff891={};_0x2ff891[_0x42fab9[_0x4704('0x26')]]={'$like':'%'+_0x4aae62[_0x4704('0x30')][_0x4704('0x3b')]+'%'};return _0x2ff891;}})});}_0x14435=_[_0x4704('0x3c')]({},_0x14435,_0x4aae62[_0x4704('0x40')]);var _0x321daf={'where':_0x14435[_0x4704('0x3d')]};return db['ServicenowField']['count'](_0x321daf)[_0x4704('0x21')](function(_0x580d10){_0x34d080[_0x4704('0x1a')]=_0x580d10;if(_0x4aae62[_0x4704('0x30')][_0x4704('0x41')]){_0x14435['include']=[{'all':!![]}];}return db[_0x4704('0x2a')][_0x4704('0x42')](_0x14435);})[_0x4704('0x21')](function(_0x1cd6a2){_0x34d080[_0x4704('0x43')]=_0x1cd6a2;return _0x34d080;})[_0x4704('0x21')](respondWithFilteredResult(_0x349366,_0x14435))['catch'](handleError(_0x349366,null));};exports[_0x4704('0x44')]=function(_0x521221,_0x253fce){var _0x59ce0d={'raw':!![],'where':{'id':_0x521221[_0x4704('0x45')]['id']}},_0x9022b8={};_0x9022b8['model']=_[_0x4704('0x2f')](db[_0x4704('0x2a')]['rawAttributes']);_0x9022b8['query']=_[_0x4704('0x2f')](_0x521221[_0x4704('0x30')]);_0x9022b8[_0x4704('0x31')]=_['intersection'](_0x9022b8[_0x4704('0x2e')],_0x9022b8[_0x4704('0x30')]);_0x59ce0d[_0x4704('0x33')]=_[_0x4704('0x32')](_0x9022b8[_0x4704('0x2e')],qs[_0x4704('0x34')](_0x521221[_0x4704('0x30')][_0x4704('0x34')]));_0x59ce0d[_0x4704('0x33')]=_0x59ce0d[_0x4704('0x33')]['length']?_0x59ce0d[_0x4704('0x33')]:_0x9022b8['model'];if(_0x521221[_0x4704('0x30')][_0x4704('0x41')]){_0x59ce0d[_0x4704('0x46')]=[{'all':!![]}];}_0x59ce0d=_[_0x4704('0x3c')]({},_0x59ce0d,_0x521221['options']);return db[_0x4704('0x2a')][_0x4704('0x47')](_0x59ce0d)['then'](handleEntityNotFound(_0x253fce,null))['then'](respondWithResult(_0x253fce,null))[_0x4704('0x48')](handleError(_0x253fce,null));};exports[_0x4704('0x49')]=function(_0x3d3f0f,_0x3fda88){return db[_0x4704('0x2a')][_0x4704('0x49')](_0x3d3f0f[_0x4704('0x4a')],{})[_0x4704('0x21')](respondWithResult(_0x3fda88,0xc9))['catch'](handleError(_0x3fda88,null));};exports[_0x4704('0x4b')]=function(_0x51db07,_0x13f372){if(_0x51db07[_0x4704('0x4a')]['id']){delete _0x51db07[_0x4704('0x4a')]['id'];}return db[_0x4704('0x2a')][_0x4704('0x47')]({'where':{'id':_0x51db07[_0x4704('0x45')]['id']}})[_0x4704('0x21')](handleEntityNotFound(_0x13f372,null))[_0x4704('0x21')](saveUpdates(_0x51db07[_0x4704('0x4a')],null))[_0x4704('0x21')](respondWithResult(_0x13f372,null))[_0x4704('0x48')](handleError(_0x13f372,null));};exports[_0x4704('0x22')]=function(_0x51cb60,_0x1c496c){return db[_0x4704('0x2a')][_0x4704('0x47')]({'where':{'id':_0x51cb60['params']['id']}})[_0x4704('0x21')](handleEntityNotFound(_0x1c496c,null))[_0x4704('0x21')](removeEntity(_0x1c496c,null))[_0x4704('0x48')](handleError(_0x1c496c,null));}; \ No newline at end of file +var _0x7510=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys'];(function(_0x5a6bfd,_0x3b89ff){var _0x264a3a=function(_0x5ec77a){while(--_0x5ec77a){_0x5a6bfd['push'](_0x5a6bfd['shift']());}};_0x264a3a(++_0x3b89ff);}(_0x7510,0xa9));var _0x0751=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7510[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0751('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0751('0x1'));var jsonpatch=require(_0x0751('0x2'));var rp=require(_0x0751('0x3'));var moment=require('moment');var BPromise=require(_0x0751('0x4'));var Mustache=require(_0x0751('0x5'));var util=require(_0x0751('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0751('0x7'));var squel=require('squel');var crypto=require(_0x0751('0x8'));var jsforce=require(_0x0751('0x9'));var deskjs=require(_0x0751('0xa'));var toCsv=require(_0x0751('0xb'));var querystring=require(_0x0751('0xc'));var Papa=require(_0x0751('0xd'));var Redis=require(_0x0751('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0751('0xf'));var as=require(_0x0751('0x10'));var hardwareService=require(_0x0751('0x11'));var logger=require(_0x0751('0x12'))(_0x0751('0x13'));var utils=require('../../config/utils');var config=require(_0x0751('0x14'));var licenseUtil=require(_0x0751('0x15'));var db=require(_0x0751('0x16'))['db'];function respondWithStatusCode(_0x16b239,_0x340a1d){_0x340a1d=_0x340a1d||0xcc;return function(_0x2bda65){if(_0x2bda65){return _0x16b239['sendStatus'](_0x340a1d);}return _0x16b239['status'](_0x340a1d)[_0x0751('0x17')]();};}function respondWithResult(_0x12110b,_0x1dc807){_0x1dc807=_0x1dc807||0xc8;return function(_0x2c32af){if(_0x2c32af){return _0x12110b[_0x0751('0x18')](_0x1dc807)[_0x0751('0x19')](_0x2c32af);}};}function respondWithFilteredResult(_0x4a3c0e,_0x459c8f){return function(_0x56c928){if(_0x56c928){var _0x1a3e87=_0x56c928[_0x0751('0x1a')],_0x6545db=_0x459c8f[_0x0751('0x1b')],_0xea2eec=_0x459c8f[_0x0751('0x1b')]+_0x459c8f[_0x0751('0x1c')],_0x1d4be0;if(_0xea2eec>=_0x1a3e87){_0xea2eec=_0x1a3e87;_0x1d4be0=0xc8;}else{_0x1d4be0=0xce;}_0x4a3c0e[_0x0751('0x18')](_0x1d4be0);return _0x4a3c0e['set'](_0x0751('0x1d'),_0x6545db+'-'+_0xea2eec+'/'+_0x1a3e87)[_0x0751('0x19')](_0x56c928);}return null;};}function patchUpdates(_0x305efd){return function(_0x311fcd){try{jsonpatch[_0x0751('0x1e')](_0x311fcd,_0x305efd,!![]);}catch(_0x2c2a6e){return BPromise['reject'](_0x2c2a6e);}return _0x311fcd['save']();};}function saveUpdates(_0x13500f,_0x153564){return function(_0x26ff5d){if(_0x26ff5d){return _0x26ff5d[_0x0751('0x1f')](_0x13500f)['then'](function(_0x2630cb){return _0x2630cb;});}return null;};}function removeEntity(_0x2e72a8,_0x2eacee){return function(_0x156417){if(_0x156417){return _0x156417[_0x0751('0x20')]()[_0x0751('0x21')](function(){_0x2e72a8[_0x0751('0x18')](0xcc)[_0x0751('0x17')]();});}};}function handleEntityNotFound(_0x34734a,_0x578172){return function(_0x20b1e3){if(!_0x20b1e3){_0x34734a[_0x0751('0x22')](0x194);}return _0x20b1e3;};}function handleError(_0x20b055,_0x5a237d){_0x5a237d=_0x5a237d||0x1f4;return function(_0xcba6a9){logger[_0x0751('0x23')](_0xcba6a9[_0x0751('0x24')]);if(_0xcba6a9[_0x0751('0x25')]){delete _0xcba6a9[_0x0751('0x25')];}_0x20b055[_0x0751('0x18')](_0x5a237d)[_0x0751('0x26')](_0xcba6a9);};}exports['index']=function(_0x165c59,_0x4bc374){var _0x507b41={},_0x2c5130={},_0x448d93={'count':0x0,'rows':[]};var _0x16171c=_[_0x0751('0x27')](db[_0x0751('0x28')][_0x0751('0x29')],function(_0x327415){return{'name':_0x327415[_0x0751('0x2a')],'type':_0x327415[_0x0751('0x2b')][_0x0751('0x2c')]};});_0x2c5130['model']=_[_0x0751('0x27')](_0x16171c,_0x0751('0x25'));_0x2c5130[_0x0751('0x2d')]=_[_0x0751('0x2e')](_0x165c59[_0x0751('0x2d')]);_0x2c5130[_0x0751('0x2f')]=_[_0x0751('0x30')](_0x2c5130[_0x0751('0x31')],_0x2c5130[_0x0751('0x2d')]);_0x507b41['attributes']=_[_0x0751('0x30')](_0x2c5130[_0x0751('0x31')],qs[_0x0751('0x32')](_0x165c59['query'][_0x0751('0x32')]));_0x507b41[_0x0751('0x33')]=_0x507b41['attributes'][_0x0751('0x34')]?_0x507b41[_0x0751('0x33')]:_0x2c5130[_0x0751('0x31')];if(!_0x165c59[_0x0751('0x2d')][_0x0751('0x35')](_0x0751('0x36'))){_0x507b41['limit']=qs[_0x0751('0x1c')](_0x165c59[_0x0751('0x2d')][_0x0751('0x1c')]);_0x507b41[_0x0751('0x1b')]=qs['offset'](_0x165c59[_0x0751('0x2d')][_0x0751('0x1b')]);}_0x507b41[_0x0751('0x37')]=qs['sort'](_0x165c59[_0x0751('0x2d')][_0x0751('0x38')]);_0x507b41['where']=qs[_0x0751('0x2f')](_[_0x0751('0x39')](_0x165c59[_0x0751('0x2d')],_0x2c5130[_0x0751('0x2f')]),_0x16171c);if(_0x165c59[_0x0751('0x2d')][_0x0751('0x3a')]){_0x507b41[_0x0751('0x3b')]=_['merge'](_0x507b41[_0x0751('0x3b')],{'$or':_[_0x0751('0x27')](_0x16171c,function(_0x41e4af){if(_0x41e4af['type']!=='VIRTUAL'){var _0x338a58={};_0x338a58[_0x41e4af[_0x0751('0x25')]]={'$like':'%'+_0x165c59[_0x0751('0x2d')][_0x0751('0x3a')]+'%'};return _0x338a58;}})});}_0x507b41=_[_0x0751('0x3c')]({},_0x507b41,_0x165c59[_0x0751('0x3d')]);var _0x3307df={'where':_0x507b41[_0x0751('0x3b')]};return db[_0x0751('0x28')][_0x0751('0x1a')](_0x3307df)['then'](function(_0x5dd702){_0x448d93[_0x0751('0x1a')]=_0x5dd702;if(_0x165c59[_0x0751('0x2d')][_0x0751('0x3e')]){_0x507b41[_0x0751('0x3f')]=[{'all':!![]}];}return db[_0x0751('0x28')][_0x0751('0x40')](_0x507b41);})[_0x0751('0x21')](function(_0x28731a){_0x448d93[_0x0751('0x41')]=_0x28731a;return _0x448d93;})['then'](respondWithFilteredResult(_0x4bc374,_0x507b41))[_0x0751('0x42')](handleError(_0x4bc374,null));};exports[_0x0751('0x43')]=function(_0x2717d2,_0x53524b){var _0xf123c3={'raw':!![],'where':{'id':_0x2717d2['params']['id']}},_0xcc89b1={};_0xcc89b1[_0x0751('0x31')]=_['keys'](db[_0x0751('0x28')][_0x0751('0x29')]);_0xcc89b1['query']=_['keys'](_0x2717d2[_0x0751('0x2d')]);_0xcc89b1[_0x0751('0x2f')]=_['intersection'](_0xcc89b1[_0x0751('0x31')],_0xcc89b1[_0x0751('0x2d')]);_0xf123c3['attributes']=_[_0x0751('0x30')](_0xcc89b1[_0x0751('0x31')],qs['fields'](_0x2717d2[_0x0751('0x2d')]['fields']));_0xf123c3[_0x0751('0x33')]=_0xf123c3[_0x0751('0x33')][_0x0751('0x34')]?_0xf123c3[_0x0751('0x33')]:_0xcc89b1[_0x0751('0x31')];if(_0x2717d2[_0x0751('0x2d')][_0x0751('0x3e')]){_0xf123c3[_0x0751('0x3f')]=[{'all':!![]}];}_0xf123c3=_[_0x0751('0x3c')]({},_0xf123c3,_0x2717d2[_0x0751('0x3d')]);return db[_0x0751('0x28')][_0x0751('0x44')](_0xf123c3)[_0x0751('0x21')](handleEntityNotFound(_0x53524b,null))[_0x0751('0x21')](respondWithResult(_0x53524b,null))[_0x0751('0x42')](handleError(_0x53524b,null));};exports[_0x0751('0x45')]=function(_0x1bf1fa,_0x4a0a53){return db[_0x0751('0x28')][_0x0751('0x45')](_0x1bf1fa[_0x0751('0x46')],{})['then'](respondWithResult(_0x4a0a53,0xc9))[_0x0751('0x42')](handleError(_0x4a0a53,null));};exports[_0x0751('0x1f')]=function(_0x414ac6,_0x1bebc2){if(_0x414ac6[_0x0751('0x46')]['id']){delete _0x414ac6[_0x0751('0x46')]['id'];}return db['ServicenowField'][_0x0751('0x44')]({'where':{'id':_0x414ac6[_0x0751('0x47')]['id']}})[_0x0751('0x21')](handleEntityNotFound(_0x1bebc2,null))[_0x0751('0x21')](saveUpdates(_0x414ac6[_0x0751('0x46')],null))[_0x0751('0x21')](respondWithResult(_0x1bebc2,null))[_0x0751('0x42')](handleError(_0x1bebc2,null));};exports[_0x0751('0x20')]=function(_0x1ab7d6,_0x3fbc19){return db[_0x0751('0x28')][_0x0751('0x44')]({'where':{'id':_0x1ab7d6[_0x0751('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fbc19,null))[_0x0751('0x21')](removeEntity(_0x3fbc19,null))[_0x0751('0x42')](handleError(_0x3fbc19,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2531c23..753a50f 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 _0x31e7=['lodash','../../config/logger','api','moment','bluebird','rimraf','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','FieldId'];(function(_0x57e789,_0x53d74e){var _0x8783ca=function(_0x4e1945){while(--_0x4e1945){_0x57e789['push'](_0x57e789['shift']());}};_0x8783ca(++_0x53d74e);}(_0x31e7,0x108));var _0x731e=function(_0x5076e4,_0x5b4571){_0x5076e4=_0x5076e4-0x0;var _0x795e43=_0x31e7[_0x5076e4];return _0x795e43;};'use strict';var _=require(_0x731e('0x0'));var util=require('util');var logger=require(_0x731e('0x1'))(_0x731e('0x2'));var moment=require(_0x731e('0x3'));var BPromise=require(_0x731e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x731e('0x5'));var config=require('../../config/environment');var attributes=require(_0x731e('0x6'));module[_0x731e('0x7')]=function(_0x21922d,_0x586e9f){return _0x21922d['define'](_0x731e('0x8'),attributes,{'tableName':_0x731e('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x731e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb02=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','idField','lodash','util'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xeb02,0xe8));var _0x2eb0=function(_0x2ad9b3,_0x4b77a1){_0x2ad9b3=_0x2ad9b3-0x0;var _0x43fce5=_0xeb02[_0x2ad9b3];return _0x43fce5;};'use strict';var _=require(_0x2eb0('0x0'));var util=require(_0x2eb0('0x1'));var logger=require('../../config/logger')(_0x2eb0('0x2'));var moment=require(_0x2eb0('0x3'));var BPromise=require(_0x2eb0('0x4'));var rp=require(_0x2eb0('0x5'));var fs=require('fs');var path=require(_0x2eb0('0x6'));var rimraf=require(_0x2eb0('0x7'));var config=require(_0x2eb0('0x8'));var attributes=require(_0x2eb0('0x9'));module[_0x2eb0('0xa')]=function(_0x1638eb,_0x1dee70){return _0x1638eb['define'](_0x2eb0('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x2eb0('0xc'),'FieldId'],'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 e0f718b..1d70cc6 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 _0x8ae5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2e6c8d,_0x17c7ef){var _0x259c0f=function(_0x97387a){while(--_0x97387a){_0x2e6c8d['push'](_0x2e6c8d['shift']());}};_0x259c0f(++_0x17c7ef);}(_0x8ae5,0x6a));var _0x58ae=function(_0x59e0a6,_0x48b55c){_0x59e0a6=_0x59e0a6-0x0;var _0xd6efff=_0x8ae5[_0x59e0a6];return _0xd6efff;};'use strict';var _=require(_0x58ae('0x0'));var util=require(_0x58ae('0x1'));var moment=require(_0x58ae('0x2'));var BPromise=require(_0x58ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58ae('0x4'));var db=require(_0x58ae('0x5'))['db'];var utils=require(_0x58ae('0x6'));var logger=require(_0x58ae('0x7'))(_0x58ae('0x8'));var config=require(_0x58ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58ae('0xa')][_0x58ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3434a6,_0x3bfde1,_0x27bb1c){return new BPromise(function(_0x259d6c,_0x2f26e3){return client[_0x58ae('0xc')](_0x3434a6,_0x27bb1c)[_0x58ae('0xd')](function(_0x1af2a1){logger['info']('ServicenowField,\x20%s,\x20%s',_0x3bfde1,_0x58ae('0xe'));logger[_0x58ae('0xf')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x3bfde1,_0x58ae('0xe'),JSON[_0x58ae('0x10')](_0x1af2a1));if(_0x1af2a1[_0x58ae('0x11')]){if(_0x1af2a1[_0x58ae('0x11')][_0x58ae('0x12')]===0x1f4){logger[_0x58ae('0x11')](_0x58ae('0x13'),_0x3bfde1,_0x1af2a1['error'][_0x58ae('0x14')]);return _0x2f26e3(_0x1af2a1[_0x58ae('0x11')]['message']);}logger[_0x58ae('0x11')](_0x58ae('0x13'),_0x3bfde1,_0x1af2a1[_0x58ae('0x11')][_0x58ae('0x14')]);return _0x259d6c(_0x1af2a1['error'][_0x58ae('0x14')]);}else{logger['info'](_0x58ae('0x13'),_0x3bfde1,_0x58ae('0xe'));_0x259d6c(_0x1af2a1['result'][_0x58ae('0x14')]);}})[_0x58ae('0x15')](function(_0x44b596){logger['error'](_0x58ae('0x13'),_0x3bfde1,_0x44b596);_0x2f26e3(_0x44b596);});});} \ No newline at end of file +var _0xce49=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xce49,0x192));var _0x9ce4=function(_0x1075ab,_0x29f957){_0x1075ab=_0x1075ab-0x0;var _0x5998aa=_0xce49[_0x1075ab];return _0x5998aa;};'use strict';var _=require(_0x9ce4('0x0'));var util=require(_0x9ce4('0x1'));var moment=require(_0x9ce4('0x2'));var BPromise=require(_0x9ce4('0x3'));var rs=require(_0x9ce4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ce4('0x5'))['db'];var utils=require(_0x9ce4('0x6'));var logger=require(_0x9ce4('0x7'))('rpc');var config=require(_0x9ce4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ce4('0x9')][_0x9ce4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc88221,_0x44ce85,_0x1fa11f){return new BPromise(function(_0x2386a5,_0x449c5b){return client[_0x9ce4('0xb')](_0xc88221,_0x1fa11f)['then'](function(_0x84f74){logger[_0x9ce4('0xc')](_0x9ce4('0xd'),_0x44ce85,_0x9ce4('0xe'));logger[_0x9ce4('0xf')](_0x9ce4('0x10'),_0x44ce85,'request\x20sent',JSON[_0x9ce4('0x11')](_0x84f74));if(_0x84f74[_0x9ce4('0x12')]){if(_0x84f74[_0x9ce4('0x12')]['code']===0x1f4){logger[_0x9ce4('0x12')](_0x9ce4('0xd'),_0x44ce85,_0x84f74[_0x9ce4('0x12')][_0x9ce4('0x13')]);return _0x449c5b(_0x84f74[_0x9ce4('0x12')]['message']);}logger[_0x9ce4('0x12')]('ServicenowField,\x20%s,\x20%s',_0x44ce85,_0x84f74[_0x9ce4('0x12')][_0x9ce4('0x13')]);return _0x2386a5(_0x84f74['error'][_0x9ce4('0x13')]);}else{logger['info'](_0x9ce4('0xd'),_0x44ce85,_0x9ce4('0xe'));_0x2386a5(_0x84f74[_0x9ce4('0x14')][_0x9ce4('0x13')]);}})[_0x9ce4('0x15')](function(_0x29ac41){logger[_0x9ce4('0x12')](_0x9ce4('0xd'),_0x44ce85,_0x29ac41);_0x449c5b(_0x29ac41);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1a48915..040f6c7 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 _0xc0e6=['delete','destroy','exports','util','connect-timeout','express','Router','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x2e6776,_0x1ea7c7){var _0x3423bf=function(_0x4fe872){while(--_0x4fe872){_0x2e6776['push'](_0x2e6776['shift']());}};_0x3423bf(++_0x1ea7c7);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xc0e6[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require('multer');var util=require(_0x6c0e('0x0'));var path=require('path');var timeout=require(_0x6c0e('0x1'));var express=require(_0x6c0e('0x2'));var router=express[_0x6c0e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c0e('0x4'));var controller=require(_0x6c0e('0x5'));router[_0x6c0e('0x6')]('/',auth[_0x6c0e('0x7')](),controller[_0x6c0e('0x8')]);router[_0x6c0e('0x6')](_0x6c0e('0x9'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0xa')]);router[_0x6c0e('0x6')](_0x6c0e('0xb'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0xc')]);router[_0x6c0e('0x6')](_0x6c0e('0xd'),auth['isAuthenticated'](),controller[_0x6c0e('0xe')]);router[_0x6c0e('0xf')]('/',auth[_0x6c0e('0x7')](),controller['create']);router['post'](_0x6c0e('0xb'),auth[_0x6c0e('0x7')](),controller['addConfiguration']);router['put'](_0x6c0e('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6c0e('0x10')](_0x6c0e('0x9'),auth[_0x6c0e('0x7')](),controller[_0x6c0e('0x11')]);module[_0x6c0e('0x12')]=router; \ No newline at end of file +var _0x60eb=['put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration'];(function(_0x40e4b8,_0x5995b0){var _0x8cadf7=function(_0x521a12){while(--_0x521a12){_0x40e4b8['push'](_0x40e4b8['shift']());}};_0x8cadf7(++_0x5995b0);}(_0x60eb,0x192));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb60e('0x0'));var util=require('util');var path=require(_0xb60e('0x1'));var timeout=require(_0xb60e('0x2'));var express=require(_0xb60e('0x3'));var router=express[_0xb60e('0x4')]();var auth=require(_0xb60e('0x5'));var interaction=require(_0xb60e('0x6'));var config=require(_0xb60e('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0xb60e('0x8')]('/',auth[_0xb60e('0x9')](),controller[_0xb60e('0xa')]);router['get'](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller[_0xb60e('0xc')]);router['get'](_0xb60e('0xd'),auth[_0xb60e('0x9')](),controller[_0xb60e('0xe')]);router[_0xb60e('0x8')](_0xb60e('0xf'),auth[_0xb60e('0x9')](),controller[_0xb60e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb60e('0x11')]);router[_0xb60e('0x12')](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller['update']);router['delete'](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller['destroy']);module[_0xb60e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b7eabe6..fea214d 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 _0xb94f=['STRING','username','exports'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0xb94f,0xce));var _0xfb94=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0xb94f[_0x1d3892];return _0x574ff2;};'use strict';var Sequelize=require('sequelize');module[_0xfb94('0x0')]={'name':{'type':Sequelize[_0xfb94('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb94('0x1')],'unique':_0xfb94('0x2')},'password':{'type':Sequelize[_0xfb94('0x1')]},'remoteUri':{'type':Sequelize[_0xfb94('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xfb94('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd9b5=['sequelize','exports','STRING','remoteUri'];(function(_0x2a1d29,_0x524c2e){var _0x1ad8d3=function(_0x342dbf){while(--_0x342dbf){_0x2a1d29['push'](_0x2a1d29['shift']());}};_0x1ad8d3(++_0x524c2e);}(_0xd9b5,0x1b0));var _0x5d9b=function(_0x34af77,_0x5193f4){_0x34af77=_0x34af77-0x0;var _0x4f30e5=_0xd9b5[_0x34af77];return _0x4f30e5;};'use strict';var Sequelize=require(_0x5d9b('0x0'));module[_0x5d9b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d9b('0x2')]},'username':{'type':Sequelize[_0x5d9b('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5d9b('0x2')],'unique':_0x5d9b('0x3')},'serverUrl':{'type':Sequelize[_0x5d9b('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 449d8a8..d711d6a 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 _0x76b1=['request','then','info','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','rawAttributes','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','where','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http'];(function(_0x448706,_0x13f057){var _0x1307ab=function(_0x4d2286){while(--_0x4d2286){_0x448706['push'](_0x448706['shift']());}};_0x1307ab(++_0x13f057);}(_0x76b1,0x15d));var _0x176b=function(_0x270295,_0x51db7c){_0x270295=_0x270295-0x0;var _0x44eae6=_0x76b1[_0x270295];return _0x44eae6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x176b('0x0'));var zipdir=require(_0x176b('0x1'));var jsonpatch=require(_0x176b('0x2'));var rp=require(_0x176b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x176b('0x4'));var util=require(_0x176b('0x5'));var path=require(_0x176b('0x6'));var sox=require('sox');var csv=require(_0x176b('0x7'));var ejs=require(_0x176b('0x8'));var fs=require('fs');var _=require(_0x176b('0x9'));var squel=require(_0x176b('0xa'));var crypto=require(_0x176b('0xb'));var jsforce=require(_0x176b('0xc'));var deskjs=require(_0x176b('0xd'));var toCsv=require(_0x176b('0x7'));var querystring=require(_0x176b('0xe'));var Papa=require(_0x176b('0xf'));var Redis=require(_0x176b('0x10'));var authService=require(_0x176b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x176b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x176b('0x13'))(_0x176b('0x14'));var utils=require(_0x176b('0x15'));var config=require(_0x176b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x176b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x176b('0x18')][_0x176b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x46e218,_0x5221ff,_0x2fbe5d,_0xee6b58){return new BPromise(function(_0x12efdc,_0x974a7b){var _0xe93a77=_0xee6b58||client;return _0xe93a77[_0x176b('0x1a')](_0x46e218,_0x2fbe5d)[_0x176b('0x1b')](function(_0x2dac44){logger[_0x176b('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x5221ff,'request\x20sent');logger['debug'](_0x176b('0x1d'),_0x5221ff,'request\x20sent',JSON[_0x176b('0x1e')](_0x2dac44));if(_0x2dac44[_0x176b('0x1f')]){if(_0x2dac44[_0x176b('0x1f')]['code']===0x1f4){logger[_0x176b('0x1f')](_0x176b('0x20'),_0x5221ff,_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);return _0x974a7b(_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);}logger[_0x176b('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x5221ff,_0x2dac44[_0x176b('0x1f')][_0x176b('0x21')]);return _0x12efdc(_0x2dac44[_0x176b('0x1f')]['message']);}else{logger[_0x176b('0x1c')](_0x176b('0x20'),_0x5221ff,_0x176b('0x22'));_0x12efdc(_0x2dac44[_0x176b('0x23')][_0x176b('0x21')]);}})[_0x176b('0x24')](function(_0x2368b7){logger['error'](_0x176b('0x20'),_0x5221ff,_0x2368b7);_0x974a7b(_0x2368b7);});});}function respondWithStatusCode(_0x3d8e7a,_0x19e6da){_0x19e6da=_0x19e6da||0xcc;return function(_0x51b942){if(_0x51b942){return _0x3d8e7a['sendStatus'](_0x19e6da);}return _0x3d8e7a[_0x176b('0x25')](_0x19e6da)[_0x176b('0x26')]();};}function respondWithResult(_0x4b13fc,_0x28c671){_0x28c671=_0x28c671||0xc8;return function(_0x428158){if(_0x428158){return _0x4b13fc[_0x176b('0x25')](_0x28c671)['json'](_0x428158);}};}function respondWithFilteredResult(_0x521d7a,_0x2e8dfa){return function(_0x1cadd9){if(_0x1cadd9){var _0x12030b=_0x1cadd9['count'],_0x11e64f=_0x2e8dfa['offset'],_0x230d43=_0x2e8dfa[_0x176b('0x27')]+_0x2e8dfa[_0x176b('0x28')],_0x298491;if(_0x230d43>=_0x12030b){_0x230d43=_0x12030b;_0x298491=0xc8;}else{_0x298491=0xce;}_0x521d7a[_0x176b('0x25')](_0x298491);return _0x521d7a[_0x176b('0x29')](_0x176b('0x2a'),_0x11e64f+'-'+_0x230d43+'/'+_0x12030b)['json'](_0x1cadd9);}return null;};}function patchUpdates(_0x2d74da){return function(_0x3a9e3f){try{jsonpatch[_0x176b('0x2b')](_0x3a9e3f,_0x2d74da,!![]);}catch(_0xbef1cf){return BPromise['reject'](_0xbef1cf);}return _0x3a9e3f[_0x176b('0x2c')]();};}function saveUpdates(_0x42ada2,_0x442e9f){return function(_0x3b5ed9){if(_0x3b5ed9){return _0x3b5ed9[_0x176b('0x2d')](_0x42ada2)[_0x176b('0x1b')](function(_0x9f8456){return _0x9f8456;});}return null;};}function removeEntity(_0xd2baa3,_0x4ed74c){return function(_0x5232e0){if(_0x5232e0){return _0x5232e0[_0x176b('0x2e')]()[_0x176b('0x1b')](function(){_0xd2baa3[_0x176b('0x25')](0xcc)[_0x176b('0x26')]();});}};}function handleEntityNotFound(_0x10f384,_0x42b29c){return function(_0x3cbdb7){if(!_0x3cbdb7){_0x10f384['sendStatus'](0x194);}return _0x3cbdb7;};}function handleError(_0xc637ff,_0x16901d){_0x16901d=_0x16901d||0x1f4;return function(_0x2c2eed){logger[_0x176b('0x1f')](_0x2c2eed[_0x176b('0x2f')]);if(_0x2c2eed[_0x176b('0x30')]){delete _0x2c2eed[_0x176b('0x30')];}_0xc637ff[_0x176b('0x25')](_0x16901d)[_0x176b('0x31')](_0x2c2eed);};}exports[_0x176b('0x32')]=function(_0x1d13d4,_0x1647ef){var _0x1e54e2={},_0x25f02b={},_0x47782c={'count':0x0,'rows':[]};var _0x300c43=_[_0x176b('0x33')](db[_0x176b('0x34')]['rawAttributes'],function(_0xd4209a){return{'name':_0xd4209a[_0x176b('0x35')],'type':_0xd4209a[_0x176b('0x36')]['key']};});_0x25f02b[_0x176b('0x37')]=_['map'](_0x300c43,'name');_0x25f02b[_0x176b('0x38')]=_[_0x176b('0x39')](_0x1d13d4[_0x176b('0x38')]);_0x25f02b[_0x176b('0x3a')]=_[_0x176b('0x3b')](_0x25f02b['model'],_0x25f02b['query']);_0x1e54e2['attributes']=_[_0x176b('0x3b')](_0x25f02b[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x1d13d4[_0x176b('0x38')]['fields']));_0x1e54e2[_0x176b('0x3d')]=_0x1e54e2[_0x176b('0x3d')][_0x176b('0x3e')]?_0x1e54e2[_0x176b('0x3d')]:_0x25f02b[_0x176b('0x37')];if(!_0x1d13d4[_0x176b('0x38')]['hasOwnProperty'](_0x176b('0x3f'))){_0x1e54e2[_0x176b('0x28')]=qs['limit'](_0x1d13d4[_0x176b('0x38')]['limit']);_0x1e54e2['offset']=qs[_0x176b('0x27')](_0x1d13d4[_0x176b('0x38')][_0x176b('0x27')]);}_0x1e54e2[_0x176b('0x40')]=qs[_0x176b('0x41')](_0x1d13d4[_0x176b('0x38')]['sort']);_0x1e54e2['where']=qs[_0x176b('0x3a')](_[_0x176b('0x42')](_0x1d13d4[_0x176b('0x38')],_0x25f02b[_0x176b('0x3a')]),_0x300c43);if(_0x1d13d4[_0x176b('0x38')][_0x176b('0x43')]){_0x1e54e2['where']=_[_0x176b('0x44')](_0x1e54e2['where'],{'$or':_[_0x176b('0x33')](_0x300c43,function(_0x621340){if(_0x621340[_0x176b('0x36')]!=='VIRTUAL'){var _0x3d68df={};_0x3d68df[_0x621340['name']]={'$like':'%'+_0x1d13d4[_0x176b('0x38')][_0x176b('0x43')]+'%'};return _0x3d68df;}})});}_0x1e54e2=_[_0x176b('0x44')]({},_0x1e54e2,_0x1d13d4[_0x176b('0x45')]);var _0x242f4a={'where':_0x1e54e2['where']};return db[_0x176b('0x34')][_0x176b('0x46')](_0x242f4a)[_0x176b('0x1b')](function(_0x2ad4b2){_0x47782c[_0x176b('0x46')]=_0x2ad4b2;if(_0x1d13d4[_0x176b('0x38')][_0x176b('0x47')]){_0x1e54e2['include']=[{'all':!![]}];}return db[_0x176b('0x34')][_0x176b('0x48')](_0x1e54e2);})[_0x176b('0x1b')](function(_0x44c83b){_0x47782c[_0x176b('0x49')]=_0x44c83b;return _0x47782c;})[_0x176b('0x1b')](respondWithFilteredResult(_0x1647ef,_0x1e54e2))[_0x176b('0x24')](handleError(_0x1647ef,null));};exports[_0x176b('0x4a')]=function(_0x48463f,_0x5ce0ce){var _0x25e086={'raw':![],'where':{'id':_0x48463f[_0x176b('0x4b')]['id']}},_0x7f21b6={};_0x7f21b6['model']=_[_0x176b('0x39')](db[_0x176b('0x34')][_0x176b('0x4c')]);_0x7f21b6[_0x176b('0x38')]=_[_0x176b('0x39')](_0x48463f[_0x176b('0x38')]);_0x7f21b6[_0x176b('0x3a')]=_['intersection'](_0x7f21b6[_0x176b('0x37')],_0x7f21b6[_0x176b('0x38')]);_0x25e086[_0x176b('0x3d')]=_['intersection'](_0x7f21b6[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x48463f['query'][_0x176b('0x3c')]));_0x25e086['attributes']=_0x25e086[_0x176b('0x3d')][_0x176b('0x3e')]?_0x25e086[_0x176b('0x3d')]:_0x7f21b6[_0x176b('0x37')];if(_0x48463f[_0x176b('0x38')]['includeAll']){_0x25e086['include']=[{'all':!![]}];}_0x25e086=_['merge']({},_0x25e086,_0x48463f[_0x176b('0x45')]);return db[_0x176b('0x34')]['find'](_0x25e086)[_0x176b('0x1b')](handleEntityNotFound(_0x5ce0ce,null))[_0x176b('0x1b')](respondWithResult(_0x5ce0ce,null))[_0x176b('0x24')](handleError(_0x5ce0ce,null));};exports[_0x176b('0x4d')]=function(_0x30b863,_0x269567){return db[_0x176b('0x34')][_0x176b('0x4d')](_0x30b863[_0x176b('0x4e')],{})[_0x176b('0x1b')](respondWithResult(_0x269567,0xc9))['catch'](handleError(_0x269567,null));};exports[_0x176b('0x2d')]=function(_0x32ba5d,_0x394fc2){if(_0x32ba5d[_0x176b('0x4e')]['id']){delete _0x32ba5d['body']['id'];}return db[_0x176b('0x34')][_0x176b('0x4f')]({'where':{'id':_0x32ba5d[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x394fc2,null))['then'](saveUpdates(_0x32ba5d[_0x176b('0x4e')],null))[_0x176b('0x1b')](respondWithResult(_0x394fc2,null))[_0x176b('0x24')](handleError(_0x394fc2,null));};exports[_0x176b('0x2e')]=function(_0x1d5716,_0x350f6b){return db[_0x176b('0x34')][_0x176b('0x4f')]({'where':{'id':_0x1d5716[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x350f6b,null))[_0x176b('0x1b')](removeEntity(_0x350f6b,null))[_0x176b('0x24')](handleError(_0x350f6b,null));};exports[_0x176b('0x50')]=function(_0x480173,_0x1c3013,_0x3e4d6f){var _0x3f81d2={};var _0x4d2750={};var _0x4fed70;var _0x2b7cec;return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0x480173[_0x176b('0x4b')]['id']}})[_0x176b('0x1b')](handleEntityNotFound(_0x1c3013,null))[_0x176b('0x1b')](function(_0xdf7dab){if(_0xdf7dab){_0x4fed70=_0xdf7dab;_0x4d2750[_0x176b('0x37')]=_[_0x176b('0x39')](db[_0x176b('0x52')][_0x176b('0x4c')]);_0x4d2750[_0x176b('0x38')]=_[_0x176b('0x39')](_0x480173['query']);_0x4d2750[_0x176b('0x3a')]=_[_0x176b('0x3b')](_0x4d2750[_0x176b('0x37')],_0x4d2750[_0x176b('0x38')]);_0x3f81d2[_0x176b('0x3d')]=_[_0x176b('0x3b')](_0x4d2750[_0x176b('0x37')],qs[_0x176b('0x3c')](_0x480173[_0x176b('0x38')][_0x176b('0x3c')]));_0x3f81d2[_0x176b('0x3d')]=_0x3f81d2['attributes'][_0x176b('0x3e')]?_0x3f81d2[_0x176b('0x3d')]:_0x4d2750['model'];_0x3f81d2['order']=qs[_0x176b('0x41')](_0x480173[_0x176b('0x38')][_0x176b('0x41')]);_0x3f81d2[_0x176b('0x53')]=qs[_0x176b('0x3a')](_[_0x176b('0x42')](_0x480173[_0x176b('0x38')],_0x4d2750['filters']));if(_0x480173['query'][_0x176b('0x43')]){_0x3f81d2[_0x176b('0x53')]=_[_0x176b('0x44')](_0x3f81d2[_0x176b('0x53')],{'$or':_[_0x176b('0x33')](_0x3f81d2['attributes'],function(_0x4d4cc7){var _0xd2c73e={};_0xd2c73e[_0x4d4cc7]={'$like':'%'+_0x480173[_0x176b('0x38')][_0x176b('0x43')]+'%'};return _0xd2c73e;})});}_0x3f81d2=_[_0x176b('0x44')]({},_0x3f81d2,_0x480173[_0x176b('0x45')]);return _0x4fed70[_0x176b('0x50')](_0x3f81d2);}})['then'](function(_0x3e064c){if(_0x3e064c){_0x2b7cec=_0x3e064c[_0x176b('0x3e')];if(!_0x480173['query']['hasOwnProperty'](_0x176b('0x3f'))){_0x3f81d2[_0x176b('0x28')]=qs[_0x176b('0x28')](_0x480173['query'][_0x176b('0x28')]);_0x3f81d2[_0x176b('0x27')]=qs['offset'](_0x480173[_0x176b('0x38')][_0x176b('0x27')]);}return _0x4fed70['getConfigurations'](_0x3f81d2);}})[_0x176b('0x1b')](function(_0x3a5818){if(_0x3a5818){return _0x3a5818?{'count':_0x2b7cec,'rows':_0x3a5818}:null;}})[_0x176b('0x1b')](respondWithResult(_0x1c3013,null))[_0x176b('0x24')](handleError(_0x1c3013,null));};exports[_0x176b('0x54')]=function(_0x4b140f,_0x340c9d,_0x45f239){if(_0x4b140f['body']['id']){delete _0x4b140f[_0x176b('0x4e')]['id'];}return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0x4b140f['params']['id']}})['then'](handleEntityNotFound(_0x340c9d,null))[_0x176b('0x1b')](function(_0x380454){if(_0x380454){_0x4b140f[_0x176b('0x4e')]['AccountId']=_0x380454['id'];_0x4b140f['body'][_0x176b('0x55')]=integrations[_0x176b('0x56')](_0x4b140f[_0x176b('0x4e')][_0x176b('0x57')],_0x4b140f['body'][_0x176b('0x36')]);_0x4b140f[_0x176b('0x4e')][_0x176b('0x58')]=integrations[_0x176b('0x59')](_0x4b140f[_0x176b('0x4e')][_0x176b('0x57')],_0x4b140f[_0x176b('0x4e')][_0x176b('0x36')]);return db[_0x176b('0x52')][_0x176b('0x4d')](_0x4b140f[_0x176b('0x4e')],{'include':[{'model':db['SugarcrmField'],'as':_0x176b('0x55')},{'model':db[_0x176b('0x5a')],'as':'Descriptions'}]});}return null;})[_0x176b('0x1b')](respondWithResult(_0x340c9d,null))[_0x176b('0x24')](handleError(_0x340c9d,null));};exports['getFields']=function(_0xf8ce2a,_0xaee87f,_0x8350e8){var _0x19721b='';var _0x5133cc=['id',_0x176b('0x30'),'assigned_user_id',_0x176b('0x5b'),_0x176b('0x5c'),_0x176b('0x5d'),_0x176b('0x5e'),_0x176b('0x5f'),'parent_id',_0x176b('0x60'),_0x176b('0x61'),_0x176b('0x62')];return db[_0x176b('0x34')][_0x176b('0x51')]({'where':{'id':_0xf8ce2a[_0x176b('0x4b')]['id']},'attributes':['id',_0x176b('0x63'),_0x176b('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0xaee87f,null))[_0x176b('0x1b')](function(_0x12f0cb){if(_0x12f0cb){_0x19721b=_0x12f0cb[_0x176b('0x65')];var _0x21687c=_0x19721b[_0x176b('0x66')](-0x1);if(_0x21687c==='/'){_0x19721b=_0x19721b['substring'](0x0,_0x19721b[_0x176b('0x67')](_0x21687c));}return rp({'method':_0x176b('0x68'),'uri':util[_0x176b('0x69')](_0x176b('0x6a'),_0x19721b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x176b('0x6b'),'input_type':_0x176b('0x6c'),'response_type':'JSON','rest_data':JSON[_0x176b('0x1e')]({'user_auth':{'user_name':_0x12f0cb[_0x176b('0x63')],'password':_0x12f0cb[_0x176b('0x64')],'encryption':_0x176b('0x6d')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x176b('0x1b')](function(_0x2aa77e){if(_0x2aa77e&&_0x2aa77e[_0x176b('0x30')]!==_0x176b('0x6e')&&_0x2aa77e['name']!==_0x176b('0x6f')){return rp({'method':_0x176b('0x68'),'uri':util[_0x176b('0x69')](_0x176b('0x6a'),_0x19721b,_0x176b('0x70')),'json':!![],'form':{'method':_0x176b('0x71'),'input_type':_0x176b('0x6c'),'response_type':_0x176b('0x6c'),'rest_data':JSON[_0x176b('0x1e')]({'session':_0x2aa77e['id'],'module_name':_0x176b('0x72')})}})[_0x176b('0x1b')](function(_0x572eb7){if(_0x572eb7){var _0x100e86=_['values'](_0x572eb7[_0x176b('0x73')]);_[_0x176b('0x74')](_0x100e86,function(_0x4c5827){return _0x5133cc[_0x176b('0x75')](_0x4c5827[_0x176b('0x30')]);});return{'count':_0x100e86[_0x176b('0x3e')],'rows':_['map'](_0x100e86,function(_0x1f8335){return{'id':_0x1f8335[_0x176b('0x30')],'name':_0x1f8335[_0x176b('0x76')],'custom':_[_0x176b('0x77')](_0x1f8335['name'],'_c')?!![]:![],'options':_0x1f8335[_0x176b('0x45')]?_[_0x176b('0x33')](_[_0x176b('0x78')](_0x1f8335['options']),function(_0x459471){return{'name':_0x459471['value'],'value':_0x459471[_0x176b('0x30')]};}):[]};})};}})[_0x176b('0x1b')](respondWithResult(_0xaee87f,null))[_0x176b('0x24')](function(_0x344016){var _0x6d0eba=_0xf8ce2a['query']['test']?0x1f4:_0x344016[_0x176b('0x79')]||0x1f4;logger[_0x176b('0x1f')](_0x176b('0x7a'),'getFields',_0x6d0eba,JSON[_0x176b('0x1e')](_0x344016));delete _0x344016['name'];if(_0x6d0eba===0x191){_0x6d0eba=0x190;}_0xaee87f[_0x176b('0x25')](_0x6d0eba)[_0x176b('0x31')](_0xf8ce2a[_0x176b('0x38')][_0x176b('0x7b')]?{'message':_0x176b('0x7c'),'statusCode':_0x344016[_0x176b('0x79')]}:_0x344016);});}else{var _0x587f67=0x1f4;_0xaee87f[_0x176b('0x25')](_0x587f67)[_0x176b('0x31')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xe204=['merge','VIRTUAL','options','count','includeAll','include','SugarcrmAccount','findAll','rows','show','length','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','username','password','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','module_fields','includes','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x219b17,_0xe07746){var _0x2c479a=function(_0x5dda28){while(--_0x5dda28){_0x219b17['push'](_0x219b17['shift']());}};_0x2c479a(++_0xe07746);}(_0xe204,0xbb));var _0x4e20=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe204[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e20('0x0'));var rimraf=require(_0x4e20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e20('0x2'));var rp=require('request-promise');var moment=require(_0x4e20('0x3'));var BPromise=require(_0x4e20('0x4'));var Mustache=require(_0x4e20('0x5'));var util=require(_0x4e20('0x6'));var path=require(_0x4e20('0x7'));var sox=require('sox');var csv=require(_0x4e20('0x8'));var ejs=require(_0x4e20('0x9'));var fs=require('fs');var _=require(_0x4e20('0xa'));var squel=require(_0x4e20('0xb'));var crypto=require(_0x4e20('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4e20('0xd'));var toCsv=require(_0x4e20('0x8'));var querystring=require('querystring');var Papa=require(_0x4e20('0xe'));var Redis=require(_0x4e20('0xf'));var authService=require(_0x4e20('0x10'));var qs=require(_0x4e20('0x11'));var as=require(_0x4e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e20('0x13'))(_0x4e20('0x14'));var utils=require(_0x4e20('0x15'));var config=require(_0x4e20('0x16'));var licenseUtil=require(_0x4e20('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4e20('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e20('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x104d99,_0x33e0df,_0x34ca4a,_0x32590c){return new BPromise(function(_0x4a72cd,_0x1dc029){var _0x1fbe77=_0x32590c||client;return _0x1fbe77['request'](_0x104d99,_0x34ca4a)[_0x4e20('0x1a')](function(_0x20c025){logger[_0x4e20('0x1b')](_0x4e20('0x1c'),_0x33e0df,_0x4e20('0x1d'));logger['debug'](_0x4e20('0x1e'),_0x33e0df,_0x4e20('0x1d'),JSON[_0x4e20('0x1f')](_0x20c025));if(_0x20c025[_0x4e20('0x20')]){if(_0x20c025['error'][_0x4e20('0x21')]===0x1f4){logger['error'](_0x4e20('0x1c'),_0x33e0df,_0x20c025['error'][_0x4e20('0x22')]);return _0x1dc029(_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);}logger['error'](_0x4e20('0x1c'),_0x33e0df,_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);return _0x4a72cd(_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);}else{logger[_0x4e20('0x1b')](_0x4e20('0x1c'),_0x33e0df,_0x4e20('0x1d'));_0x4a72cd(_0x20c025[_0x4e20('0x23')]['message']);}})[_0x4e20('0x24')](function(_0x1226b5){logger[_0x4e20('0x20')](_0x4e20('0x1c'),_0x33e0df,_0x1226b5);_0x1dc029(_0x1226b5);});});}function respondWithStatusCode(_0x42766b,_0x2898cb){_0x2898cb=_0x2898cb||0xcc;return function(_0x4a860a){if(_0x4a860a){return _0x42766b[_0x4e20('0x25')](_0x2898cb);}return _0x42766b[_0x4e20('0x26')](_0x2898cb)[_0x4e20('0x27')]();};}function respondWithResult(_0x15c725,_0xe25a8){_0xe25a8=_0xe25a8||0xc8;return function(_0x1b9c27){if(_0x1b9c27){return _0x15c725['status'](_0xe25a8)[_0x4e20('0x28')](_0x1b9c27);}};}function respondWithFilteredResult(_0xb274f6,_0x5cbc36){return function(_0x5336db){if(_0x5336db){var _0x539dc3=_0x5336db['count'],_0xe4a069=_0x5cbc36[_0x4e20('0x29')],_0x29ebb8=_0x5cbc36[_0x4e20('0x29')]+_0x5cbc36['limit'],_0x4dfb28;if(_0x29ebb8>=_0x539dc3){_0x29ebb8=_0x539dc3;_0x4dfb28=0xc8;}else{_0x4dfb28=0xce;}_0xb274f6[_0x4e20('0x26')](_0x4dfb28);return _0xb274f6[_0x4e20('0x2a')](_0x4e20('0x2b'),_0xe4a069+'-'+_0x29ebb8+'/'+_0x539dc3)[_0x4e20('0x28')](_0x5336db);}return null;};}function patchUpdates(_0x436758){return function(_0x497e17){try{jsonpatch['apply'](_0x497e17,_0x436758,!![]);}catch(_0x3c6560){return BPromise[_0x4e20('0x2c')](_0x3c6560);}return _0x497e17[_0x4e20('0x2d')]();};}function saveUpdates(_0x234a8e,_0x1a8fa2){return function(_0x307ff2){if(_0x307ff2){return _0x307ff2[_0x4e20('0x2e')](_0x234a8e)[_0x4e20('0x1a')](function(_0x2f8c37){return _0x2f8c37;});}return null;};}function removeEntity(_0x263079,_0x425f6d){return function(_0x39270f){if(_0x39270f){return _0x39270f[_0x4e20('0x2f')]()[_0x4e20('0x1a')](function(){_0x263079[_0x4e20('0x26')](0xcc)[_0x4e20('0x27')]();});}};}function handleEntityNotFound(_0x5e3f8d,_0x4dbf57){return function(_0x13ea77){if(!_0x13ea77){_0x5e3f8d[_0x4e20('0x25')](0x194);}return _0x13ea77;};}function handleError(_0x1eb7d2,_0x256ae9){_0x256ae9=_0x256ae9||0x1f4;return function(_0x9c2027){logger[_0x4e20('0x20')](_0x9c2027['stack']);if(_0x9c2027[_0x4e20('0x30')]){delete _0x9c2027[_0x4e20('0x30')];}_0x1eb7d2[_0x4e20('0x26')](_0x256ae9)[_0x4e20('0x31')](_0x9c2027);};}exports[_0x4e20('0x32')]=function(_0xdd86be,_0x2b67c0){var _0x48501b={},_0x17cc3b={},_0x4ed1be={'count':0x0,'rows':[]};var _0x254782=_[_0x4e20('0x33')](db['SugarcrmAccount'][_0x4e20('0x34')],function(_0xce533b){return{'name':_0xce533b[_0x4e20('0x35')],'type':_0xce533b[_0x4e20('0x36')][_0x4e20('0x37')]};});_0x17cc3b[_0x4e20('0x38')]=_[_0x4e20('0x33')](_0x254782,_0x4e20('0x30'));_0x17cc3b[_0x4e20('0x39')]=_[_0x4e20('0x3a')](_0xdd86be[_0x4e20('0x39')]);_0x17cc3b[_0x4e20('0x3b')]=_[_0x4e20('0x3c')](_0x17cc3b['model'],_0x17cc3b[_0x4e20('0x39')]);_0x48501b[_0x4e20('0x3d')]=_[_0x4e20('0x3c')](_0x17cc3b[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x3e')]));_0x48501b[_0x4e20('0x3d')]=_0x48501b[_0x4e20('0x3d')]['length']?_0x48501b[_0x4e20('0x3d')]:_0x17cc3b['model'];if(!_0xdd86be[_0x4e20('0x39')][_0x4e20('0x3f')](_0x4e20('0x40'))){_0x48501b[_0x4e20('0x41')]=qs['limit'](_0xdd86be[_0x4e20('0x39')]['limit']);_0x48501b[_0x4e20('0x29')]=qs[_0x4e20('0x29')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x29')]);}_0x48501b[_0x4e20('0x42')]=qs[_0x4e20('0x43')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x43')]);_0x48501b[_0x4e20('0x44')]=qs['filters'](_[_0x4e20('0x45')](_0xdd86be['query'],_0x17cc3b['filters']),_0x254782);if(_0xdd86be[_0x4e20('0x39')][_0x4e20('0x46')]){_0x48501b[_0x4e20('0x44')]=_[_0x4e20('0x47')](_0x48501b['where'],{'$or':_[_0x4e20('0x33')](_0x254782,function(_0x3e8e17){if(_0x3e8e17['type']!==_0x4e20('0x48')){var _0x3c52eb={};_0x3c52eb[_0x3e8e17[_0x4e20('0x30')]]={'$like':'%'+_0xdd86be['query'][_0x4e20('0x46')]+'%'};return _0x3c52eb;}})});}_0x48501b=_['merge']({},_0x48501b,_0xdd86be[_0x4e20('0x49')]);var _0x106d1d={'where':_0x48501b[_0x4e20('0x44')]};return db['SugarcrmAccount'][_0x4e20('0x4a')](_0x106d1d)[_0x4e20('0x1a')](function(_0x11728f){_0x4ed1be[_0x4e20('0x4a')]=_0x11728f;if(_0xdd86be[_0x4e20('0x39')][_0x4e20('0x4b')]){_0x48501b[_0x4e20('0x4c')]=[{'all':!![]}];}return db[_0x4e20('0x4d')][_0x4e20('0x4e')](_0x48501b);})[_0x4e20('0x1a')](function(_0x24a781){_0x4ed1be[_0x4e20('0x4f')]=_0x24a781;return _0x4ed1be;})[_0x4e20('0x1a')](respondWithFilteredResult(_0x2b67c0,_0x48501b))[_0x4e20('0x24')](handleError(_0x2b67c0,null));};exports[_0x4e20('0x50')]=function(_0x449772,_0x16f9f5){var _0x3d16f0={'raw':![],'where':{'id':_0x449772['params']['id']}},_0x40353c={};_0x40353c[_0x4e20('0x38')]=_['keys'](db[_0x4e20('0x4d')][_0x4e20('0x34')]);_0x40353c[_0x4e20('0x39')]=_[_0x4e20('0x3a')](_0x449772[_0x4e20('0x39')]);_0x40353c['filters']=_[_0x4e20('0x3c')](_0x40353c['model'],_0x40353c[_0x4e20('0x39')]);_0x3d16f0[_0x4e20('0x3d')]=_[_0x4e20('0x3c')](_0x40353c[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0x449772['query'][_0x4e20('0x3e')]));_0x3d16f0[_0x4e20('0x3d')]=_0x3d16f0[_0x4e20('0x3d')][_0x4e20('0x51')]?_0x3d16f0[_0x4e20('0x3d')]:_0x40353c[_0x4e20('0x38')];if(_0x449772['query'][_0x4e20('0x4b')]){_0x3d16f0[_0x4e20('0x4c')]=[{'all':!![]}];}_0x3d16f0=_['merge']({},_0x3d16f0,_0x449772[_0x4e20('0x49')]);return db[_0x4e20('0x4d')]['find'](_0x3d16f0)[_0x4e20('0x1a')](handleEntityNotFound(_0x16f9f5,null))[_0x4e20('0x1a')](respondWithResult(_0x16f9f5,null))[_0x4e20('0x24')](handleError(_0x16f9f5,null));};exports[_0x4e20('0x52')]=function(_0x1ad727,_0xba8629){return db[_0x4e20('0x4d')][_0x4e20('0x52')](_0x1ad727[_0x4e20('0x53')],{})[_0x4e20('0x1a')](respondWithResult(_0xba8629,0xc9))[_0x4e20('0x24')](handleError(_0xba8629,null));};exports[_0x4e20('0x2e')]=function(_0x42e958,_0x1d9d64){if(_0x42e958[_0x4e20('0x53')]['id']){delete _0x42e958[_0x4e20('0x53')]['id'];}return db[_0x4e20('0x4d')][_0x4e20('0x54')]({'where':{'id':_0x42e958[_0x4e20('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d9d64,null))[_0x4e20('0x1a')](saveUpdates(_0x42e958[_0x4e20('0x53')],null))[_0x4e20('0x1a')](respondWithResult(_0x1d9d64,null))[_0x4e20('0x24')](handleError(_0x1d9d64,null));};exports[_0x4e20('0x2f')]=function(_0x256720,_0x4a2aa8){return db[_0x4e20('0x4d')][_0x4e20('0x54')]({'where':{'id':_0x256720[_0x4e20('0x55')]['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x4a2aa8,null))[_0x4e20('0x1a')](removeEntity(_0x4a2aa8,null))['catch'](handleError(_0x4a2aa8,null));};exports[_0x4e20('0x56')]=function(_0x348deb,_0x10545b,_0x32f158){var _0x4d84b2={};var _0x59cb4b={};var _0x223b17;var _0x14dc26;return db[_0x4e20('0x4d')][_0x4e20('0x57')]({'where':{'id':_0x348deb[_0x4e20('0x55')]['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x10545b,null))[_0x4e20('0x1a')](function(_0x167828){if(_0x167828){_0x223b17=_0x167828;_0x59cb4b[_0x4e20('0x38')]=_[_0x4e20('0x3a')](db[_0x4e20('0x58')][_0x4e20('0x34')]);_0x59cb4b[_0x4e20('0x39')]=_['keys'](_0x348deb[_0x4e20('0x39')]);_0x59cb4b['filters']=_[_0x4e20('0x3c')](_0x59cb4b[_0x4e20('0x38')],_0x59cb4b[_0x4e20('0x39')]);_0x4d84b2['attributes']=_[_0x4e20('0x3c')](_0x59cb4b[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0x348deb[_0x4e20('0x39')]['fields']));_0x4d84b2['attributes']=_0x4d84b2[_0x4e20('0x3d')][_0x4e20('0x51')]?_0x4d84b2[_0x4e20('0x3d')]:_0x59cb4b['model'];_0x4d84b2[_0x4e20('0x42')]=qs['sort'](_0x348deb[_0x4e20('0x39')][_0x4e20('0x43')]);_0x4d84b2[_0x4e20('0x44')]=qs[_0x4e20('0x3b')](_[_0x4e20('0x45')](_0x348deb[_0x4e20('0x39')],_0x59cb4b['filters']));if(_0x348deb[_0x4e20('0x39')][_0x4e20('0x46')]){_0x4d84b2[_0x4e20('0x44')]=_[_0x4e20('0x47')](_0x4d84b2[_0x4e20('0x44')],{'$or':_[_0x4e20('0x33')](_0x4d84b2[_0x4e20('0x3d')],function(_0x196ad7){var _0x130904={};_0x130904[_0x196ad7]={'$like':'%'+_0x348deb[_0x4e20('0x39')][_0x4e20('0x46')]+'%'};return _0x130904;})});}_0x4d84b2=_[_0x4e20('0x47')]({},_0x4d84b2,_0x348deb[_0x4e20('0x49')]);return _0x223b17[_0x4e20('0x56')](_0x4d84b2);}})['then'](function(_0x11d757){if(_0x11d757){_0x14dc26=_0x11d757[_0x4e20('0x51')];if(!_0x348deb[_0x4e20('0x39')][_0x4e20('0x3f')](_0x4e20('0x40'))){_0x4d84b2[_0x4e20('0x41')]=qs['limit'](_0x348deb['query'][_0x4e20('0x41')]);_0x4d84b2[_0x4e20('0x29')]=qs['offset'](_0x348deb[_0x4e20('0x39')]['offset']);}return _0x223b17[_0x4e20('0x56')](_0x4d84b2);}})[_0x4e20('0x1a')](function(_0x2bf3d3){if(_0x2bf3d3){return _0x2bf3d3?{'count':_0x14dc26,'rows':_0x2bf3d3}:null;}})['then'](respondWithResult(_0x10545b,null))[_0x4e20('0x24')](handleError(_0x10545b,null));};exports[_0x4e20('0x59')]=function(_0x7ce829,_0x4a67b7,_0x242c72){if(_0x7ce829[_0x4e20('0x53')]['id']){delete _0x7ce829['body']['id'];}return db[_0x4e20('0x4d')]['findOne']({'where':{'id':_0x7ce829['params']['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x4a67b7,null))['then'](function(_0x36817e){if(_0x36817e){_0x7ce829[_0x4e20('0x53')]['AccountId']=_0x36817e['id'];_0x7ce829[_0x4e20('0x53')][_0x4e20('0x5a')]=integrations[_0x4e20('0x5b')](_0x7ce829[_0x4e20('0x53')]['channel'],_0x7ce829[_0x4e20('0x53')]['type']);_0x7ce829['body'][_0x4e20('0x5c')]=integrations['getDescriptions'](_0x7ce829[_0x4e20('0x53')][_0x4e20('0x5d')],_0x7ce829['body'][_0x4e20('0x36')]);return db['SugarcrmConfiguration'][_0x4e20('0x52')](_0x7ce829[_0x4e20('0x53')],{'include':[{'model':db['SugarcrmField'],'as':_0x4e20('0x5a')},{'model':db[_0x4e20('0x5e')],'as':_0x4e20('0x5c')}]});}return null;})[_0x4e20('0x1a')](respondWithResult(_0x4a67b7,null))[_0x4e20('0x24')](handleError(_0x4a67b7,null));};exports['getFields']=function(_0x1473de,_0xf74a5f,_0x5a88a0){var _0x2bcd7a='';var _0x55b8fb=['id','name','assigned_user_id',_0x4e20('0x5f'),_0x4e20('0x60'),_0x4e20('0x61'),_0x4e20('0x62'),_0x4e20('0x63'),'parent_id',_0x4e20('0x64'),_0x4e20('0x65'),_0x4e20('0x66')];return db[_0x4e20('0x4d')][_0x4e20('0x57')]({'where':{'id':_0x1473de[_0x4e20('0x55')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0xf74a5f,null))['then'](function(_0x40c278){if(_0x40c278){_0x2bcd7a=_0x40c278[_0x4e20('0x67')];var _0x46b4ee=_0x2bcd7a[_0x4e20('0x68')](-0x1);if(_0x46b4ee==='/'){_0x2bcd7a=_0x2bcd7a[_0x4e20('0x69')](0x0,_0x2bcd7a[_0x4e20('0x6a')](_0x46b4ee));}return rp({'method':_0x4e20('0x6b'),'uri':util[_0x4e20('0x6c')]('%s%s',_0x2bcd7a,_0x4e20('0x6d')),'json':!![],'form':{'method':_0x4e20('0x6e'),'input_type':_0x4e20('0x6f'),'response_type':_0x4e20('0x6f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x40c278[_0x4e20('0x70')],'password':_0x40c278[_0x4e20('0x71')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x4e20('0x1a')](function(_0x26940a){if(_0x26940a&&_0x26940a[_0x4e20('0x30')]!==_0x4e20('0x72')&&_0x26940a['name']!==_0x4e20('0x73')){return rp({'method':_0x4e20('0x6b'),'uri':util[_0x4e20('0x6c')](_0x4e20('0x74'),_0x2bcd7a,_0x4e20('0x6d')),'json':!![],'form':{'method':_0x4e20('0x75'),'input_type':_0x4e20('0x6f'),'response_type':_0x4e20('0x6f'),'rest_data':JSON['stringify']({'session':_0x26940a['id'],'module_name':_0x4e20('0x76')})}})[_0x4e20('0x1a')](function(_0x1f3aed){if(_0x1f3aed){var _0x35cb37=_['values'](_0x1f3aed[_0x4e20('0x77')]);_['remove'](_0x35cb37,function(_0x208b2a){return _0x55b8fb[_0x4e20('0x78')](_0x208b2a[_0x4e20('0x30')]);});return{'count':_0x35cb37[_0x4e20('0x51')],'rows':_[_0x4e20('0x33')](_0x35cb37,function(_0x496d33){return{'id':_0x496d33[_0x4e20('0x30')],'name':_0x496d33['label'],'custom':_[_0x4e20('0x79')](_0x496d33['name'],'_c')?!![]:![],'options':_0x496d33[_0x4e20('0x49')]?_['map'](_[_0x4e20('0x7a')](_0x496d33[_0x4e20('0x49')]),function(_0x124ef0){return{'name':_0x124ef0[_0x4e20('0x7b')],'value':_0x124ef0[_0x4e20('0x30')]};}):[]};})};}})[_0x4e20('0x1a')](respondWithResult(_0xf74a5f,null))['catch'](function(_0x1eba62){var _0x25c6b9=_0x1473de['query'][_0x4e20('0x7c')]?0x1f4:_0x1eba62[_0x4e20('0x7d')]||0x1f4;logger['error'](_0x4e20('0x7e'),_0x4e20('0x7f'),_0x25c6b9,JSON[_0x4e20('0x1f')](_0x1eba62));delete _0x1eba62[_0x4e20('0x30')];if(_0x25c6b9===0x191){_0x25c6b9=0x190;}_0xf74a5f[_0x4e20('0x26')](_0x25c6b9)[_0x4e20('0x31')](_0x1473de[_0x4e20('0x39')][_0x4e20('0x7c')]?{'message':_0x4e20('0x80'),'statusCode':_0x1eba62[_0x4e20('0x7d')]}:_0x1eba62);});}else{var _0x770d4d=0x1f4;_0xf74a5f[_0x4e20('0x26')](_0x770d4d)[_0x4e20('0x31')]({'message':_0x4e20('0x80'),'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 d83359d..e35e7eb 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 _0xb477=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xb477,0x8f));var _0x7b47=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb477[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x7b47('0x0'));var logger=require(_0x7b47('0x1'))(_0x7b47('0x2'));var moment=require('moment');var BPromise=require(_0x7b47('0x3'));var rp=require(_0x7b47('0x4'));var fs=require('fs');var path=require(_0x7b47('0x5'));var rimraf=require('rimraf');var config=require(_0x7b47('0x6'));var attributes=require(_0x7b47('0x7'));var integrations=require(_0x7b47('0x8'));module[_0x7b47('0x9')]=function(_0x45fb67,_0x48e1fc){return _0x45fb67[_0x7b47('0xa')](_0x7b47('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf37f=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment'];(function(_0x1a8a35,_0x317f59){var _0x152aff=function(_0x583c3a){while(--_0x583c3a){_0x1a8a35['push'](_0x1a8a35['shift']());}};_0x152aff(++_0x317f59);}(_0xf37f,0x15a));var _0xff37=function(_0x348e46,_0x5187dc){_0x348e46=_0x348e46-0x0;var _0x58b74f=_0xf37f[_0x348e46];return _0x58b74f;};'use strict';var _=require(_0xff37('0x0'));var util=require(_0xff37('0x1'));var logger=require(_0xff37('0x2'))('api');var moment=require(_0xff37('0x3'));var BPromise=require(_0xff37('0x4'));var rp=require(_0xff37('0x5'));var fs=require('fs');var path=require(_0xff37('0x6'));var rimraf=require(_0xff37('0x7'));var config=require(_0xff37('0x8'));var attributes=require(_0xff37('0x9'));var integrations=require(_0xff37('0xa'));module[_0xff37('0xb')]=function(_0x1eff8b,_0x2a4372){return _0x1eff8b['define'](_0xff37('0xc'),attributes,{'tableName':_0xff37('0xd'),'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 17d94a7..3b419aa 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 _0x4a45=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','limit','map','include','model','attributes','stringify','ShowSugarcrmAccount'];(function(_0x407557,_0x21df64){var _0x309528=function(_0xb414d3){while(--_0xb414d3){_0x407557['push'](_0x407557['shift']());}};_0x309528(++_0x21df64);}(_0x4a45,0x1f0));var _0x54a4=function(_0x4a0163,_0x285cae){_0x4a0163=_0x4a0163-0x0;var _0x4e8b03=_0x4a45[_0x4a0163];return _0x4e8b03;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var moment=require(_0x54a4('0x2'));var BPromise=require(_0x54a4('0x3'));var rs=require(_0x54a4('0x4'));var fs=require('fs');var Redis=require(_0x54a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x54a4('0x6'));var logger=require('../../config/logger')(_0x54a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x54a4('0x8'));var client=jayson['client'][_0x54a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d05a5,_0x5bb10a,_0x1f0e2a){return new BPromise(function(_0x162614,_0x2418d8){return client['request'](_0x3d05a5,_0x1f0e2a)[_0x54a4('0xa')](function(_0x3c2f17){logger[_0x54a4('0xb')](_0x54a4('0xc'),_0x5bb10a,_0x54a4('0xd'));logger[_0x54a4('0xe')](_0x54a4('0xf'),_0x5bb10a,'request\x20sent',JSON['stringify'](_0x3c2f17));if(_0x3c2f17[_0x54a4('0x10')]){if(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x11')]===0x1f4){logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x3c2f17[_0x54a4('0x10')]['message']);return _0x2418d8(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x12')]);}logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x3c2f17[_0x54a4('0x10')]['message']);return _0x162614(_0x3c2f17[_0x54a4('0x10')][_0x54a4('0x12')]);}else{logger[_0x54a4('0xb')](_0x54a4('0xc'),_0x5bb10a,_0x54a4('0xd'));_0x162614(_0x3c2f17[_0x54a4('0x13')][_0x54a4('0x12')]);}})[_0x54a4('0x14')](function(_0x56dad1){logger[_0x54a4('0x10')](_0x54a4('0xc'),_0x5bb10a,_0x56dad1);_0x2418d8(_0x56dad1);});});}exports[_0x54a4('0x15')]=function(_0x5534df){var _0x15e2e3=this;return new Promise(function(_0xc3d8b,_0x4fa88d){return db[_0x54a4('0x16')]['findAll']({'raw':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')][_0x54a4('0x18')]===undefined?!![]:![]:!![],'where':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['where']||null:null,'attributes':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['attributes']||null:null,'limit':_0x5534df[_0x54a4('0x17')]?_0x5534df['options'][_0x54a4('0x19')]||null:null,'include':_0x5534df[_0x54a4('0x17')]?_0x5534df[_0x54a4('0x17')]['include']?_[_0x54a4('0x1a')](_0x5534df[_0x54a4('0x17')][_0x54a4('0x1b')],function(_0x1d8f30){return{'model':db[_0x1d8f30[_0x54a4('0x1c')]],'as':_0x1d8f30['as'],'attributes':_0x1d8f30[_0x54a4('0x1d')],'include':_0x1d8f30[_0x54a4('0x1b')]?_[_0x54a4('0x1a')](_0x1d8f30[_0x54a4('0x1b')],function(_0xcab016){return{'model':db[_0xcab016[_0x54a4('0x1c')]],'as':_0xcab016['as'],'attributes':_0xcab016[_0x54a4('0x1d')],'include':_0xcab016['include']?_[_0x54a4('0x1a')](_0xcab016[_0x54a4('0x1b')],function(_0x34b8a5){return{'model':db[_0x34b8a5['model']],'as':_0x34b8a5['as'],'attributes':_0x34b8a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x54a4('0xa')](function(_0x4ac148){logger['info'](_0x54a4('0x15'),_0x5534df);logger[_0x54a4('0xe')](_0x54a4('0x15'),_0x5534df,JSON[_0x54a4('0x1e')](_0x4ac148));_0xc3d8b(_0x4ac148);})[_0x54a4('0x14')](function(_0x468974){logger[_0x54a4('0x10')](_0x54a4('0x15'),_0x468974[_0x54a4('0x12')],_0x5534df);_0x4fa88d(_0x15e2e3[_0x54a4('0x10')](0x1f4,_0x468974['message']));});});};exports[_0x54a4('0x1f')]=function(_0x5e2c01){var _0x324eba=this;return new Promise(function(_0x38558c,_0x4e0e78){return db[_0x54a4('0x16')][_0x54a4('0x20')]({'raw':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01['options'][_0x54a4('0x18')]===undefined?!![]:![]:!![],'where':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')]['where']||null:null,'attributes':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1d')]||null:null,'include':_0x5e2c01[_0x54a4('0x17')]?_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1b')]?_['map'](_0x5e2c01[_0x54a4('0x17')][_0x54a4('0x1b')],function(_0x4705ed){return{'model':db[_0x4705ed[_0x54a4('0x1c')]],'as':_0x4705ed['as'],'attributes':_0x4705ed['attributes'],'include':_0x4705ed[_0x54a4('0x1b')]?_[_0x54a4('0x1a')](_0x4705ed[_0x54a4('0x1b')],function(_0x4eefed){return{'model':db[_0x4eefed['model']],'as':_0x4eefed['as'],'attributes':_0x4eefed[_0x54a4('0x1d')],'include':_0x4eefed[_0x54a4('0x1b')]?_['map'](_0x4eefed[_0x54a4('0x1b')],function(_0x4669f3){return{'model':db[_0x4669f3[_0x54a4('0x1c')]],'as':_0x4669f3['as'],'attributes':_0x4669f3[_0x54a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x54a4('0xa')](function(_0x13fb3a){logger['info'](_0x54a4('0x1f'),_0x5e2c01);logger['debug'](_0x54a4('0x1f'),_0x5e2c01,JSON['stringify'](_0x13fb3a));_0x38558c(_0x13fb3a);})[_0x54a4('0x14')](function(_0x5acaa5){logger[_0x54a4('0x10')](_0x54a4('0x1f'),_0x5acaa5[_0x54a4('0x12')],_0x5e2c01);_0x4e0e78(_0x324eba[_0x54a4('0x10')](0x1f4,_0x5acaa5[_0x54a4('0x12')]));});});}; \ No newline at end of file +var _0xe6e2=['model','ShowSugarcrmAccount','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xe6e2,0x1a7));var _0x2e6e=function(_0x32c7d4,_0x380bf0){_0x32c7d4=_0x32c7d4-0x0;var _0x489732=_0xe6e2[_0x32c7d4];return _0x489732;};'use strict';var _=require(_0x2e6e('0x0'));var util=require(_0x2e6e('0x1'));var moment=require(_0x2e6e('0x2'));var BPromise=require(_0x2e6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e6e('0x4'));var db=require(_0x2e6e('0x5'))['db'];var utils=require(_0x2e6e('0x6'));var logger=require(_0x2e6e('0x7'))(_0x2e6e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e6e('0x9')][_0x2e6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbfe7,_0x18fe24,_0x59470a){return new BPromise(function(_0x4c1ead,_0x55bf99){return client[_0x2e6e('0xb')](_0x2cbfe7,_0x59470a)[_0x2e6e('0xc')](function(_0x3c21ae){logger[_0x2e6e('0xd')](_0x2e6e('0xe'),_0x18fe24,_0x2e6e('0xf'));logger[_0x2e6e('0x10')](_0x2e6e('0x11'),_0x18fe24,_0x2e6e('0xf'),JSON[_0x2e6e('0x12')](_0x3c21ae));if(_0x3c21ae[_0x2e6e('0x13')]){if(_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x14')]===0x1f4){logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x55bf99(_0x3c21ae['error']['message']);}logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x4c1ead(_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);}else{logger['info'](_0x2e6e('0xe'),_0x18fe24,_0x2e6e('0xf'));_0x4c1ead(_0x3c21ae[_0x2e6e('0x16')]['message']);}})[_0x2e6e('0x17')](function(_0x227afe){logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x227afe);_0x55bf99(_0x227afe);});});}exports[_0x2e6e('0x18')]=function(_0x5d3441){var _0x5bad0e=this;return new Promise(function(_0xb24bb5,_0x5b3c41){return db[_0x2e6e('0x19')][_0x2e6e('0x1a')]({'raw':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1c')]||null:null,'attributes':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1d')]||null:null,'limit':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441['options']['limit']||null:null,'include':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x5d3441[_0x2e6e('0x1b')]['include'],function(_0x473b4a){return{'model':db[_0x473b4a[_0x2e6e('0x20')]],'as':_0x473b4a['as'],'attributes':_0x473b4a[_0x2e6e('0x1d')],'include':_0x473b4a[_0x2e6e('0x1e')]?_['map'](_0x473b4a[_0x2e6e('0x1e')],function(_0x5d6690){return{'model':db[_0x5d6690[_0x2e6e('0x20')]],'as':_0x5d6690['as'],'attributes':_0x5d6690[_0x2e6e('0x1d')],'include':_0x5d6690[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x5d6690[_0x2e6e('0x1e')],function(_0x4f1fe8){return{'model':db[_0x4f1fe8[_0x2e6e('0x20')]],'as':_0x4f1fe8['as'],'attributes':_0x4f1fe8[_0x2e6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e6e('0xc')](function(_0x2e2b34){logger[_0x2e6e('0xd')](_0x2e6e('0x18'),_0x5d3441);logger[_0x2e6e('0x10')]('GetSugarcrmAccount',_0x5d3441,JSON[_0x2e6e('0x12')](_0x2e2b34));_0xb24bb5(_0x2e2b34);})[_0x2e6e('0x17')](function(_0x2b7ab6){logger['error'](_0x2e6e('0x18'),_0x2b7ab6[_0x2e6e('0x15')],_0x5d3441);_0x5b3c41(_0x5bad0e[_0x2e6e('0x13')](0x1f4,_0x2b7ab6[_0x2e6e('0x15')]));});});};exports[_0x2e6e('0x21')]=function(_0x4a4093){var _0x45510f=this;return new Promise(function(_0xa7868c,_0x3d5a1f){return db[_0x2e6e('0x19')]['find']({'raw':_0x4a4093[_0x2e6e('0x1b')]?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x22')]===undefined?!![]:![]:!![],'where':_0x4a4093['options']?_0x4a4093['options'][_0x2e6e('0x1c')]||null:null,'attributes':_0x4a4093['options']?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1d')]||null:null,'include':_0x4a4093['options']?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1e')],function(_0x156da6){return{'model':db[_0x156da6[_0x2e6e('0x20')]],'as':_0x156da6['as'],'attributes':_0x156da6[_0x2e6e('0x1d')],'include':_0x156da6[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x156da6[_0x2e6e('0x1e')],function(_0x267615){return{'model':db[_0x267615[_0x2e6e('0x20')]],'as':_0x267615['as'],'attributes':_0x267615[_0x2e6e('0x1d')],'include':_0x267615[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x267615[_0x2e6e('0x1e')],function(_0x96fcb7){return{'model':db[_0x96fcb7[_0x2e6e('0x20')]],'as':_0x96fcb7['as'],'attributes':_0x96fcb7[_0x2e6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e6e('0xc')](function(_0x5f38eb){logger[_0x2e6e('0xd')](_0x2e6e('0x21'),_0x4a4093);logger[_0x2e6e('0x10')](_0x2e6e('0x21'),_0x4a4093,JSON[_0x2e6e('0x12')](_0x5f38eb));_0xa7868c(_0x5f38eb);})[_0x2e6e('0x17')](function(_0x41557e){logger[_0x2e6e('0x13')](_0x2e6e('0x21'),_0x41557e[_0x2e6e('0x15')],_0x4a4093);_0x3d5a1f(_0x45510f[_0x2e6e('0x13')](0x1f4,_0x41557e[_0x2e6e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4a14d79..3ae1447 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 _0x6f5a=['index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x6f5a,0x76));var _0xa6f5=function(_0x4fbbf6,_0x286b69){_0x4fbbf6=_0x4fbbf6-0x0;var _0x113411=_0x6f5a[_0x4fbbf6];return _0x113411;};'use strict';var multer=require('multer');var util=require(_0xa6f5('0x0'));var path=require(_0xa6f5('0x1'));var timeout=require(_0xa6f5('0x2'));var express=require('express');var router=express[_0xa6f5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6f5('0x4'));var config=require(_0xa6f5('0x5'));var controller=require(_0xa6f5('0x6'));router[_0xa6f5('0x7')]('/',auth['isAuthenticated'](),controller[_0xa6f5('0x8')]);router[_0xa6f5('0x7')](_0xa6f5('0x9'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xb')]);router['get'](_0xa6f5('0xc'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xd')]);router[_0xa6f5('0x7')]('/:id/subjects',auth[_0xa6f5('0xa')](),controller[_0xa6f5('0xe')]);router['get'](_0xa6f5('0xf'),auth['isAuthenticated'](),controller[_0xa6f5('0x10')]);router[_0xa6f5('0x11')]('/',auth[_0xa6f5('0xa')](),controller['create']);router['put']('/:id',auth[_0xa6f5('0xa')](),controller['update']);router[_0xa6f5('0x12')](_0xa6f5('0x9'),auth[_0xa6f5('0xa')](),controller[_0xa6f5('0x13')]);module[_0xa6f5('0x14')]=router; \ No newline at end of file +var _0x1e16=['put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','getSubjects','getDescriptions','post','create'];(function(_0x154b19,_0x21e4cf){var _0x10f433=function(_0x44e746){while(--_0x44e746){_0x154b19['push'](_0x154b19['shift']());}};_0x10f433(++_0x21e4cf);}(_0x1e16,0x138));var _0x61e1=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x1e16[_0x199c03];return _0x11a7d4;};'use strict';var multer=require(_0x61e1('0x0'));var util=require(_0x61e1('0x1'));var path=require(_0x61e1('0x2'));var timeout=require(_0x61e1('0x3'));var express=require('express');var router=express[_0x61e1('0x4')]();var auth=require(_0x61e1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x61e1('0x6'));var controller=require(_0x61e1('0x7'));router[_0x61e1('0x8')]('/',auth['isAuthenticated'](),controller[_0x61e1('0x9')]);router[_0x61e1('0x8')](_0x61e1('0xa'),auth[_0x61e1('0xb')](),controller[_0x61e1('0xc')]);router[_0x61e1('0x8')]('/:id/fields',auth[_0x61e1('0xb')](),controller[_0x61e1('0xd')]);router[_0x61e1('0x8')]('/:id/subjects',auth[_0x61e1('0xb')](),controller[_0x61e1('0xe')]);router[_0x61e1('0x8')]('/:id/descriptions',auth[_0x61e1('0xb')](),controller[_0x61e1('0xf')]);router[_0x61e1('0x10')]('/',auth['isAuthenticated'](),controller[_0x61e1('0x11')]);router[_0x61e1('0x12')](_0x61e1('0xa'),auth[_0x61e1('0xb')](),controller[_0x61e1('0x13')]);router[_0x61e1('0x14')]('/:id',auth[_0x61e1('0xb')](),controller['destroy']);module[_0x61e1('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 d10e6ac..4502bac 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 _0x4ea5=['exports','STRING','sequelize'];(function(_0x450807,_0x366f79){var _0x248e14=function(_0x174f64){while(--_0x174f64){_0x450807['push'](_0x450807['shift']());}};_0x248e14(++_0x366f79);}(_0x4ea5,0x131));var _0x54ea=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x4ea5[_0x5275b8];return _0x568a9b;};'use strict';var Sequelize=require(_0x54ea('0x0'));module[_0x54ea('0x1')]={'name':{'type':Sequelize[_0x54ea('0x2')]},'description':{'type':Sequelize[_0x54ea('0x2')]}}; \ No newline at end of file +var _0xf156=['sequelize','STRING'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf156,0x1a0));var _0x6f15=function(_0x4fee65,_0x13e8ed){_0x4fee65=_0x4fee65-0x0;var _0x3ad648=_0xf156[_0x4fee65];return _0x3ad648;};'use strict';var Sequelize=require(_0x6f15('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f15('0x1')]},'description':{'type':Sequelize[_0x6f15('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8a12f89..ba672df 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 _0x3a2f=['crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','intersection','include','find','create','body','params','destroy','getFields','findOne','order','getSubjects','SugarcrmField','length','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x2bc385,_0x1fbc61){var _0x20e2d0=function(_0x4ef4dd){while(--_0x4ef4dd){_0x2bc385['push'](_0x2bc385['shift']());}};_0x20e2d0(++_0x1fbc61);}(_0x3a2f,0x107));var _0xf3a2=function(_0x18b6c3,_0x39b3ea){_0x18b6c3=_0x18b6c3-0x0;var _0x223b0b=_0x3a2f[_0x18b6c3];return _0x223b0b;};'use strict';var pdf=require(_0xf3a2('0x0'));var emlformat=require(_0xf3a2('0x1'));var rimraf=require(_0xf3a2('0x2'));var zipdir=require(_0xf3a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3a2('0x4'));var moment=require('moment');var BPromise=require(_0xf3a2('0x5'));var Mustache=require(_0xf3a2('0x6'));var util=require(_0xf3a2('0x7'));var path=require('path');var sox=require(_0xf3a2('0x8'));var csv=require(_0xf3a2('0x9'));var ejs=require(_0xf3a2('0xa'));var fs=require('fs');var _=require(_0xf3a2('0xb'));var squel=require(_0xf3a2('0xc'));var crypto=require(_0xf3a2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf3a2('0xe'));var toCsv=require(_0xf3a2('0x9'));var querystring=require(_0xf3a2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3a2('0x10'));var qs=require(_0xf3a2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3a2('0x12'));var logger=require(_0xf3a2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3a2('0x14'))['db'];var jayson=require(_0xf3a2('0x15'));var client=jayson[_0xf3a2('0x16')][_0xf3a2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xb22ddf,_0x4df179,_0x1a4588,_0x3ec4b7){return new BPromise(function(_0x2f7eb9,_0x5456ee){var _0x34c039=_0x3ec4b7||client;return _0x34c039[_0xf3a2('0x18')](_0xb22ddf,_0x1a4588)[_0xf3a2('0x19')](function(_0x11f80f){logger['info'](_0xf3a2('0x1a'),_0x4df179,_0xf3a2('0x1b'));logger[_0xf3a2('0x1c')](_0xf3a2('0x1d'),_0x4df179,'request\x20sent',JSON['stringify'](_0x11f80f));if(_0x11f80f['error']){if(_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x1f')]===0x1f4){logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x20')]);return _0x5456ee(_0x11f80f['error'][_0xf3a2('0x20')]);}logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x11f80f['error'][_0xf3a2('0x20')]);return _0x2f7eb9(_0x11f80f[_0xf3a2('0x1e')][_0xf3a2('0x20')]);}else{logger[_0xf3a2('0x21')](_0xf3a2('0x1a'),_0x4df179,_0xf3a2('0x1b'));_0x2f7eb9(_0x11f80f[_0xf3a2('0x22')][_0xf3a2('0x20')]);}})[_0xf3a2('0x23')](function(_0x172a4f){logger[_0xf3a2('0x1e')](_0xf3a2('0x1a'),_0x4df179,_0x172a4f);_0x5456ee(_0x172a4f);});});}function respondWithStatusCode(_0x2fc435,_0x8a4142){_0x8a4142=_0x8a4142||0xcc;return function(_0x4a3a65){if(_0x4a3a65){return _0x2fc435['sendStatus'](_0x8a4142);}return _0x2fc435[_0xf3a2('0x24')](_0x8a4142)['end']();};}function respondWithResult(_0x30c05b,_0x241d76){_0x241d76=_0x241d76||0xc8;return function(_0x396a68){if(_0x396a68){return _0x30c05b['status'](_0x241d76)[_0xf3a2('0x25')](_0x396a68);}};}function respondWithFilteredResult(_0x2f17a8,_0x1a4e10){return function(_0x5ec9e3){if(_0x5ec9e3){var _0x28c505=_0x5ec9e3[_0xf3a2('0x26')],_0x35a079=_0x1a4e10['offset'],_0x1f830b=_0x1a4e10[_0xf3a2('0x27')]+_0x1a4e10['limit'],_0x47d6cf;if(_0x1f830b>=_0x28c505){_0x1f830b=_0x28c505;_0x47d6cf=0xc8;}else{_0x47d6cf=0xce;}_0x2f17a8['status'](_0x47d6cf);return _0x2f17a8[_0xf3a2('0x28')](_0xf3a2('0x29'),_0x35a079+'-'+_0x1f830b+'/'+_0x28c505)[_0xf3a2('0x25')](_0x5ec9e3);}return null;};}function patchUpdates(_0x4c756c){return function(_0x5bbd36){try{jsonpatch[_0xf3a2('0x2a')](_0x5bbd36,_0x4c756c,!![]);}catch(_0x300ab9){return BPromise[_0xf3a2('0x2b')](_0x300ab9);}return _0x5bbd36[_0xf3a2('0x2c')]();};}function saveUpdates(_0x2dba33,_0x3cc7e4){return function(_0x2bd196){if(_0x2bd196){return _0x2bd196[_0xf3a2('0x2d')](_0x2dba33)[_0xf3a2('0x19')](function(_0x589d2b){return _0x589d2b;});}return null;};}function removeEntity(_0x5740d1,_0x4a8000){return function(_0x93575e){if(_0x93575e){return _0x93575e['destroy']()[_0xf3a2('0x19')](function(){_0x5740d1[_0xf3a2('0x24')](0xcc)[_0xf3a2('0x2e')]();});}};}function handleEntityNotFound(_0x394fa8,_0x29d330){return function(_0x768433){if(!_0x768433){_0x394fa8[_0xf3a2('0x2f')](0x194);}return _0x768433;};}function handleError(_0x58ee6e,_0x38489d){_0x38489d=_0x38489d||0x1f4;return function(_0x2494ff){logger[_0xf3a2('0x1e')](_0x2494ff[_0xf3a2('0x30')]);if(_0x2494ff[_0xf3a2('0x31')]){delete _0x2494ff[_0xf3a2('0x31')];}_0x58ee6e[_0xf3a2('0x24')](_0x38489d)[_0xf3a2('0x32')](_0x2494ff);};}exports[_0xf3a2('0x33')]=function(_0x509767,_0x5843d7){var _0x124fac={},_0x54c273={},_0x2fb494={'count':0x0,'rows':[]};var _0xebcba1=_[_0xf3a2('0x34')](db[_0xf3a2('0x35')][_0xf3a2('0x36')],function(_0x3508fe){return{'name':_0x3508fe[_0xf3a2('0x37')],'type':_0x3508fe[_0xf3a2('0x38')][_0xf3a2('0x39')]};});_0x54c273[_0xf3a2('0x3a')]=_['map'](_0xebcba1,'name');_0x54c273[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x509767[_0xf3a2('0x3b')]);_0x54c273[_0xf3a2('0x3d')]=_['intersection'](_0x54c273[_0xf3a2('0x3a')],_0x54c273[_0xf3a2('0x3b')]);_0x124fac[_0xf3a2('0x3e')]=_['intersection'](_0x54c273[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x509767['query']['fields']));_0x124fac[_0xf3a2('0x3e')]=_0x124fac[_0xf3a2('0x3e')]['length']?_0x124fac[_0xf3a2('0x3e')]:_0x54c273[_0xf3a2('0x3a')];if(!_0x509767['query'][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x124fac[_0xf3a2('0x42')]=qs[_0xf3a2('0x42')](_0x509767[_0xf3a2('0x3b')]['limit']);_0x124fac[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x509767['query']['offset']);}_0x124fac['order']=qs[_0xf3a2('0x43')](_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x124fac['where']=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x509767[_0xf3a2('0x3b')],_0x54c273[_0xf3a2('0x3d')]),_0xebcba1);if(_0x509767['query']['filter']){_0x124fac[_0xf3a2('0x45')]=_[_0xf3a2('0x46')](_0x124fac[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0xebcba1,function(_0x3d769a){if(_0x3d769a[_0xf3a2('0x38')]!==_0xf3a2('0x47')){var _0x230b4a={};_0x230b4a[_0x3d769a['name']]={'$like':'%'+_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x230b4a;}})});}_0x124fac=_['merge']({},_0x124fac,_0x509767[_0xf3a2('0x49')]);var _0x4424d3={'where':_0x124fac['where']};return db[_0xf3a2('0x35')]['count'](_0x4424d3)[_0xf3a2('0x19')](function(_0xe3814a){_0x2fb494['count']=_0xe3814a;if(_0x509767[_0xf3a2('0x3b')][_0xf3a2('0x4a')]){_0x124fac['include']=[{'all':!![]}];}return db[_0xf3a2('0x35')][_0xf3a2('0x4b')](_0x124fac);})['then'](function(_0x286347){_0x2fb494[_0xf3a2('0x4c')]=_0x286347;return _0x2fb494;})['then'](respondWithFilteredResult(_0x5843d7,_0x124fac))['catch'](handleError(_0x5843d7,null));};exports[_0xf3a2('0x4d')]=function(_0x394c99,_0x136c62){var _0xe8324e={'raw':![],'where':{'id':_0x394c99['params']['id']}},_0x1b835e={};_0x1b835e['model']=_[_0xf3a2('0x3c')](db[_0xf3a2('0x35')][_0xf3a2('0x36')]);_0x1b835e[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x394c99[_0xf3a2('0x3b')]);_0x1b835e[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x1b835e[_0xf3a2('0x3a')],_0x1b835e[_0xf3a2('0x3b')]);_0xe8324e[_0xf3a2('0x3e')]=_['intersection'](_0x1b835e[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x394c99['query'][_0xf3a2('0x3f')]));_0xe8324e[_0xf3a2('0x3e')]=_0xe8324e[_0xf3a2('0x3e')]['length']?_0xe8324e[_0xf3a2('0x3e')]:_0x1b835e['model'];if(_0x394c99[_0xf3a2('0x3b')]['includeAll']){_0xe8324e[_0xf3a2('0x4f')]=[{'all':!![]}];}_0xe8324e=_['merge']({},_0xe8324e,_0x394c99['options']);return db[_0xf3a2('0x35')][_0xf3a2('0x50')](_0xe8324e)[_0xf3a2('0x19')](handleEntityNotFound(_0x136c62,null))[_0xf3a2('0x19')](respondWithResult(_0x136c62,null))[_0xf3a2('0x23')](handleError(_0x136c62,null));};exports[_0xf3a2('0x51')]=function(_0x30cb3b,_0xa8da16){return db['SugarcrmConfiguration'][_0xf3a2('0x51')](_0x30cb3b[_0xf3a2('0x52')],{})[_0xf3a2('0x19')](respondWithResult(_0xa8da16,0xc9))[_0xf3a2('0x23')](handleError(_0xa8da16,null));};exports[_0xf3a2('0x2d')]=function(_0x57cfcc,_0x5c5ca1){if(_0x57cfcc[_0xf3a2('0x52')]['id']){delete _0x57cfcc[_0xf3a2('0x52')]['id'];}return db[_0xf3a2('0x35')]['find']({'where':{'id':_0x57cfcc[_0xf3a2('0x53')]['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x5c5ca1,null))[_0xf3a2('0x19')](saveUpdates(_0x57cfcc[_0xf3a2('0x52')],null))[_0xf3a2('0x19')](respondWithResult(_0x5c5ca1,null))['catch'](handleError(_0x5c5ca1,null));};exports[_0xf3a2('0x54')]=function(_0x32e176,_0x12d854){return db[_0xf3a2('0x35')][_0xf3a2('0x50')]({'where':{'id':_0x32e176['params']['id']}})['then'](handleEntityNotFound(_0x12d854,null))[_0xf3a2('0x19')](removeEntity(_0x12d854,null))[_0xf3a2('0x23')](handleError(_0x12d854,null));};exports[_0xf3a2('0x55')]=function(_0x106892,_0x57b5f4,_0x321e75){var _0x31219f={};var _0x5ba44c={};var _0x3f6482;var _0x4da6dd;return db[_0xf3a2('0x35')][_0xf3a2('0x56')]({'where':{'id':_0x106892['params']['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x57b5f4,null))[_0xf3a2('0x19')](function(_0x4051a4){if(_0x4051a4){_0x3f6482=_0x4051a4;_0x5ba44c['model']=_[_0xf3a2('0x3c')](db['SugarcrmField'][_0xf3a2('0x36')]);_0x5ba44c[_0xf3a2('0x3b')]=_['keys'](_0x106892[_0xf3a2('0x3b')]);_0x5ba44c[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x5ba44c[_0xf3a2('0x3a')],_0x5ba44c[_0xf3a2('0x3b')]);_0x31219f[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x5ba44c[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x106892['query'][_0xf3a2('0x3f')]));_0x31219f[_0xf3a2('0x3e')]=_0x31219f[_0xf3a2('0x3e')]['length']?_0x31219f[_0xf3a2('0x3e')]:_0x5ba44c[_0xf3a2('0x3a')];_0x31219f[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x31219f[_0xf3a2('0x45')]=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x106892[_0xf3a2('0x3b')],_0x5ba44c[_0xf3a2('0x3d')]));if(_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x48')]){_0x31219f['where']=_['merge'](_0x31219f[_0xf3a2('0x45')],{'$or':_['map'](_0x31219f['attributes'],function(_0x178963){var _0x1a8191={};_0x1a8191[_0x178963]={'$like':'%'+_0x106892['query'][_0xf3a2('0x48')]+'%'};return _0x1a8191;})});}_0x31219f=_[_0xf3a2('0x46')]({},_0x31219f,_0x106892[_0xf3a2('0x49')]);return _0x3f6482[_0xf3a2('0x55')](_0x31219f);}})[_0xf3a2('0x19')](function(_0x196e5f){if(_0x196e5f){_0x4da6dd=_0x196e5f['length'];if(!_0x106892['query'][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x31219f[_0xf3a2('0x42')]=qs[_0xf3a2('0x42')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x42')]);_0x31219f[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x106892[_0xf3a2('0x3b')][_0xf3a2('0x27')]);}return _0x3f6482[_0xf3a2('0x55')](_0x31219f);}})[_0xf3a2('0x19')](function(_0x23a0b9){if(_0x23a0b9){return _0x23a0b9?{'count':_0x4da6dd,'rows':_0x23a0b9}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x57b5f4,null))[_0xf3a2('0x23')](handleError(_0x57b5f4,null));};exports[_0xf3a2('0x58')]=function(_0x14ff03,_0x2e86a4,_0x114d87){var _0x442ddd={};var _0x4e34c3={};var _0x539bb9;var _0x2ac453;return db[_0xf3a2('0x35')]['findOne']({'where':{'id':_0x14ff03[_0xf3a2('0x53')]['id']}})[_0xf3a2('0x19')](handleEntityNotFound(_0x2e86a4,null))[_0xf3a2('0x19')](function(_0x4f4aab){if(_0x4f4aab){_0x539bb9=_0x4f4aab;_0x4e34c3[_0xf3a2('0x3a')]=_[_0xf3a2('0x3c')](db[_0xf3a2('0x59')][_0xf3a2('0x36')]);_0x4e34c3['query']=_[_0xf3a2('0x3c')](_0x14ff03[_0xf3a2('0x3b')]);_0x4e34c3[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x4e34c3[_0xf3a2('0x3a')],_0x4e34c3[_0xf3a2('0x3b')]);_0x442ddd[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x4e34c3[_0xf3a2('0x3a')],qs['fields'](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x3f')]));_0x442ddd[_0xf3a2('0x3e')]=_0x442ddd[_0xf3a2('0x3e')][_0xf3a2('0x5a')]?_0x442ddd[_0xf3a2('0x3e')]:_0x4e34c3['model'];_0x442ddd[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x442ddd['where']=qs[_0xf3a2('0x3d')](_['pick'](_0x14ff03[_0xf3a2('0x3b')],_0x4e34c3[_0xf3a2('0x3d')]));if(_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x48')]){_0x442ddd[_0xf3a2('0x45')]=_['merge'](_0x442ddd[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0x442ddd[_0xf3a2('0x3e')],function(_0x4457a5){var _0x4ba022={};_0x4ba022[_0x4457a5]={'$like':'%'+_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x4ba022;})});}_0x442ddd=_[_0xf3a2('0x46')]({},_0x442ddd,_0x14ff03[_0xf3a2('0x49')]);return _0x539bb9[_0xf3a2('0x58')](_0x442ddd);}})['then'](function(_0x16eb12){if(_0x16eb12){_0x2ac453=_0x16eb12[_0xf3a2('0x5a')];if(!_0x14ff03[_0xf3a2('0x3b')]['hasOwnProperty'](_0xf3a2('0x41'))){_0x442ddd['limit']=qs[_0xf3a2('0x42')](_0x14ff03[_0xf3a2('0x3b')][_0xf3a2('0x42')]);_0x442ddd[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x14ff03['query'][_0xf3a2('0x27')]);}return _0x539bb9['getSubjects'](_0x442ddd);}})[_0xf3a2('0x19')](function(_0x299944){if(_0x299944){return _0x299944?{'count':_0x2ac453,'rows':_0x299944}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x2e86a4,null))[_0xf3a2('0x23')](handleError(_0x2e86a4,null));};exports[_0xf3a2('0x5b')]=function(_0x14c9c7,_0x20ace3,_0x43376c){var _0x199acb={};var _0x112bb6={};var _0x47a7ae;var _0x3e74ba;return db[_0xf3a2('0x35')][_0xf3a2('0x56')]({'where':{'id':_0x14c9c7['params']['id']}})['then'](handleEntityNotFound(_0x20ace3,null))[_0xf3a2('0x19')](function(_0x266a8b){if(_0x266a8b){_0x47a7ae=_0x266a8b;_0x112bb6[_0xf3a2('0x3a')]=_['keys'](db[_0xf3a2('0x59')][_0xf3a2('0x36')]);_0x112bb6[_0xf3a2('0x3b')]=_[_0xf3a2('0x3c')](_0x14c9c7[_0xf3a2('0x3b')]);_0x112bb6[_0xf3a2('0x3d')]=_[_0xf3a2('0x4e')](_0x112bb6[_0xf3a2('0x3a')],_0x112bb6[_0xf3a2('0x3b')]);_0x199acb[_0xf3a2('0x3e')]=_[_0xf3a2('0x4e')](_0x112bb6[_0xf3a2('0x3a')],qs[_0xf3a2('0x3f')](_0x14c9c7[_0xf3a2('0x3b')]['fields']));_0x199acb['attributes']=_0x199acb[_0xf3a2('0x3e')][_0xf3a2('0x5a')]?_0x199acb[_0xf3a2('0x3e')]:_0x112bb6['model'];_0x199acb[_0xf3a2('0x57')]=qs[_0xf3a2('0x43')](_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x43')]);_0x199acb[_0xf3a2('0x45')]=qs[_0xf3a2('0x3d')](_[_0xf3a2('0x44')](_0x14c9c7[_0xf3a2('0x3b')],_0x112bb6[_0xf3a2('0x3d')]));if(_0x14c9c7[_0xf3a2('0x3b')]['filter']){_0x199acb[_0xf3a2('0x45')]=_['merge'](_0x199acb[_0xf3a2('0x45')],{'$or':_[_0xf3a2('0x34')](_0x199acb[_0xf3a2('0x3e')],function(_0x2015bc){var _0x409a8d={};_0x409a8d[_0x2015bc]={'$like':'%'+_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x48')]+'%'};return _0x409a8d;})});}_0x199acb=_[_0xf3a2('0x46')]({},_0x199acb,_0x14c9c7[_0xf3a2('0x49')]);return _0x47a7ae[_0xf3a2('0x5b')](_0x199acb);}})[_0xf3a2('0x19')](function(_0x47b651){if(_0x47b651){_0x3e74ba=_0x47b651['length'];if(!_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x40')](_0xf3a2('0x41'))){_0x199acb['limit']=qs[_0xf3a2('0x42')](_0x14c9c7['query']['limit']);_0x199acb[_0xf3a2('0x27')]=qs[_0xf3a2('0x27')](_0x14c9c7[_0xf3a2('0x3b')][_0xf3a2('0x27')]);}return _0x47a7ae[_0xf3a2('0x5b')](_0x199acb);}})[_0xf3a2('0x19')](function(_0x3ce64f){if(_0x3ce64f){return _0x3ce64f?{'count':_0x3e74ba,'rows':_0x3ce64f}:null;}})[_0xf3a2('0x19')](respondWithResult(_0x20ace3,null))['catch'](handleError(_0x20ace3,null));}; \ No newline at end of file +var _0x1c7f=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','merge','find','body','params','getFields','SugarcrmField','findOne','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset'];(function(_0x6f24f9,_0x14049c){var _0x3d36d7=function(_0x4c54bd){while(--_0x4c54bd){_0x6f24f9['push'](_0x6f24f9['shift']());}};_0x3d36d7(++_0x14049c);}(_0x1c7f,0x8b));var _0xf1c7=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x1c7f[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0xf1c7('0x0'));var emlformat=require(_0xf1c7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1c7('0x2'));var rp=require(_0xf1c7('0x3'));var moment=require(_0xf1c7('0x4'));var BPromise=require(_0xf1c7('0x5'));var Mustache=require(_0xf1c7('0x6'));var util=require('util');var path=require(_0xf1c7('0x7'));var sox=require(_0xf1c7('0x8'));var csv=require('to-csv');var ejs=require(_0xf1c7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1c7('0xa'));var crypto=require(_0xf1c7('0xb'));var jsforce=require(_0xf1c7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf1c7('0xd'));var querystring=require(_0xf1c7('0xe'));var Papa=require(_0xf1c7('0xf'));var Redis=require('ioredis');var authService=require(_0xf1c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf1c7('0x11'));var hardwareService=require(_0xf1c7('0x12'));var logger=require(_0xf1c7('0x13'))(_0xf1c7('0x14'));var utils=require(_0xf1c7('0x15'));var config=require(_0xf1c7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1c7('0x17'))['db'];var jayson=require(_0xf1c7('0x18'));var client=jayson[_0xf1c7('0x19')][_0xf1c7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xdc217d,_0x31749d,_0x19eae0,_0x1f3af6){return new BPromise(function(_0x48c487,_0x2a41ee){var _0x2122d2=_0x1f3af6||client;return _0x2122d2[_0xf1c7('0x1b')](_0xdc217d,_0x19eae0)['then'](function(_0x4a5ef4){logger[_0xf1c7('0x1c')](_0xf1c7('0x1d'),_0x31749d,_0xf1c7('0x1e'));logger[_0xf1c7('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x31749d,_0xf1c7('0x1e'),JSON[_0xf1c7('0x20')](_0x4a5ef4));if(_0x4a5ef4[_0xf1c7('0x21')]){if(_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x22')]===0x1f4){logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x23')]);return _0x2a41ee(_0x4a5ef4[_0xf1c7('0x21')]['message']);}logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x4a5ef4[_0xf1c7('0x21')]['message']);return _0x48c487(_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x23')]);}else{logger[_0xf1c7('0x1c')](_0xf1c7('0x1d'),_0x31749d,_0xf1c7('0x1e'));_0x48c487(_0x4a5ef4['result'][_0xf1c7('0x23')]);}})[_0xf1c7('0x24')](function(_0x577cad){logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x577cad);_0x2a41ee(_0x577cad);});});}function respondWithStatusCode(_0xa0818c,_0x3481bb){_0x3481bb=_0x3481bb||0xcc;return function(_0x4413d0){if(_0x4413d0){return _0xa0818c[_0xf1c7('0x25')](_0x3481bb);}return _0xa0818c[_0xf1c7('0x26')](_0x3481bb)[_0xf1c7('0x27')]();};}function respondWithResult(_0x1bfda2,_0x52ff00){_0x52ff00=_0x52ff00||0xc8;return function(_0xe75314){if(_0xe75314){return _0x1bfda2[_0xf1c7('0x26')](_0x52ff00)[_0xf1c7('0x28')](_0xe75314);}};}function respondWithFilteredResult(_0x442fe0,_0x2134db){return function(_0x5a5c2f){if(_0x5a5c2f){var _0x46eebe=_0x5a5c2f[_0xf1c7('0x29')],_0x1ff048=_0x2134db[_0xf1c7('0x2a')],_0x32c9e0=_0x2134db['offset']+_0x2134db[_0xf1c7('0x2b')],_0xd3deb4;if(_0x32c9e0>=_0x46eebe){_0x32c9e0=_0x46eebe;_0xd3deb4=0xc8;}else{_0xd3deb4=0xce;}_0x442fe0['status'](_0xd3deb4);return _0x442fe0[_0xf1c7('0x2c')]('Content-Range',_0x1ff048+'-'+_0x32c9e0+'/'+_0x46eebe)[_0xf1c7('0x28')](_0x5a5c2f);}return null;};}function patchUpdates(_0x21ae09){return function(_0x47291e){try{jsonpatch[_0xf1c7('0x2d')](_0x47291e,_0x21ae09,!![]);}catch(_0x3c8aeb){return BPromise[_0xf1c7('0x2e')](_0x3c8aeb);}return _0x47291e[_0xf1c7('0x2f')]();};}function saveUpdates(_0x4e24e4,_0x441ce5){return function(_0x510bc8){if(_0x510bc8){return _0x510bc8[_0xf1c7('0x30')](_0x4e24e4)[_0xf1c7('0x31')](function(_0x3be37c){return _0x3be37c;});}return null;};}function removeEntity(_0x49dbe7,_0x3e6d85){return function(_0x441538){if(_0x441538){return _0x441538[_0xf1c7('0x32')]()[_0xf1c7('0x31')](function(){_0x49dbe7[_0xf1c7('0x26')](0xcc)[_0xf1c7('0x27')]();});}};}function handleEntityNotFound(_0x3884ff,_0x2a4b29){return function(_0x17d97b){if(!_0x17d97b){_0x3884ff[_0xf1c7('0x25')](0x194);}return _0x17d97b;};}function handleError(_0x32774e,_0x138706){_0x138706=_0x138706||0x1f4;return function(_0xe6b541){logger[_0xf1c7('0x21')](_0xe6b541[_0xf1c7('0x33')]);if(_0xe6b541[_0xf1c7('0x34')]){delete _0xe6b541[_0xf1c7('0x34')];}_0x32774e['status'](_0x138706)[_0xf1c7('0x35')](_0xe6b541);};}exports[_0xf1c7('0x36')]=function(_0x4762f8,_0x254ab4){var _0xab5782={},_0x38ad96={},_0x317589={'count':0x0,'rows':[]};var _0x29df9a=_[_0xf1c7('0x37')](db[_0xf1c7('0x38')][_0xf1c7('0x39')],function(_0x4d540e){return{'name':_0x4d540e[_0xf1c7('0x3a')],'type':_0x4d540e[_0xf1c7('0x3b')]['key']};});_0x38ad96[_0xf1c7('0x3c')]=_[_0xf1c7('0x37')](_0x29df9a,_0xf1c7('0x34'));_0x38ad96[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x4762f8[_0xf1c7('0x3d')]);_0x38ad96[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x38ad96[_0xf1c7('0x3c')],_0x38ad96[_0xf1c7('0x3d')]);_0xab5782[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x38ad96['model'],qs[_0xf1c7('0x42')](_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0xab5782[_0xf1c7('0x41')]=_0xab5782[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0xab5782[_0xf1c7('0x41')]:_0x38ad96[_0xf1c7('0x3c')];if(!_0x4762f8['query'][_0xf1c7('0x44')](_0xf1c7('0x45'))){_0xab5782[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x4762f8['query'][_0xf1c7('0x2b')]);_0xab5782[_0xf1c7('0x2a')]=qs['offset'](_0x4762f8['query'][_0xf1c7('0x2a')]);}_0xab5782[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x47')]);_0xab5782[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_[_0xf1c7('0x49')](_0x4762f8[_0xf1c7('0x3d')],_0x38ad96[_0xf1c7('0x3f')]),_0x29df9a);if(_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0xab5782[_0xf1c7('0x48')]=_['merge'](_0xab5782[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x29df9a,function(_0x1ed95f){if(_0x1ed95f['type']!==_0xf1c7('0x4b')){var _0x3b42cf={};_0x3b42cf[_0x1ed95f['name']]={'$like':'%'+_0x4762f8['query']['filter']+'%'};return _0x3b42cf;}})});}_0xab5782=_['merge']({},_0xab5782,_0x4762f8[_0xf1c7('0x4c')]);var _0x4bf150={'where':_0xab5782[_0xf1c7('0x48')]};return db['SugarcrmConfiguration'][_0xf1c7('0x29')](_0x4bf150)[_0xf1c7('0x31')](function(_0x2c1613){_0x317589[_0xf1c7('0x29')]=_0x2c1613;if(_0x4762f8['query'][_0xf1c7('0x4d')]){_0xab5782[_0xf1c7('0x4e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf1c7('0x4f')](_0xab5782);})[_0xf1c7('0x31')](function(_0x498e26){_0x317589[_0xf1c7('0x50')]=_0x498e26;return _0x317589;})[_0xf1c7('0x31')](respondWithFilteredResult(_0x254ab4,_0xab5782))[_0xf1c7('0x24')](handleError(_0x254ab4,null));};exports[_0xf1c7('0x51')]=function(_0x5815cb,_0xa71c28){var _0x32d763={'raw':![],'where':{'id':_0x5815cb['params']['id']}},_0x5dcfee={};_0x5dcfee[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db['SugarcrmConfiguration'][_0xf1c7('0x39')]);_0x5dcfee[_0xf1c7('0x3d')]=_['keys'](_0x5815cb[_0xf1c7('0x3d')]);_0x5dcfee[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x5dcfee[_0xf1c7('0x3c')],_0x5dcfee[_0xf1c7('0x3d')]);_0x32d763[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x5dcfee[_0xf1c7('0x3c')],qs[_0xf1c7('0x42')](_0x5815cb[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0x32d763['attributes']=_0x32d763[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x32d763['attributes']:_0x5dcfee['model'];if(_0x5815cb[_0xf1c7('0x3d')]['includeAll']){_0x32d763[_0xf1c7('0x4e')]=[{'all':!![]}];}_0x32d763=_[_0xf1c7('0x52')]({},_0x32d763,_0x5815cb[_0xf1c7('0x4c')]);return db['SugarcrmConfiguration'][_0xf1c7('0x53')](_0x32d763)[_0xf1c7('0x31')](handleEntityNotFound(_0xa71c28,null))[_0xf1c7('0x31')](respondWithResult(_0xa71c28,null))['catch'](handleError(_0xa71c28,null));};exports['create']=function(_0x10f046,_0x32191f){return db[_0xf1c7('0x38')]['create'](_0x10f046[_0xf1c7('0x54')],{})[_0xf1c7('0x31')](respondWithResult(_0x32191f,0xc9))[_0xf1c7('0x24')](handleError(_0x32191f,null));};exports[_0xf1c7('0x30')]=function(_0x2e7a2d,_0x3dbdd1){if(_0x2e7a2d[_0xf1c7('0x54')]['id']){delete _0x2e7a2d[_0xf1c7('0x54')]['id'];}return db['SugarcrmConfiguration'][_0xf1c7('0x53')]({'where':{'id':_0x2e7a2d[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x3dbdd1,null))['then'](saveUpdates(_0x2e7a2d[_0xf1c7('0x54')],null))[_0xf1c7('0x31')](respondWithResult(_0x3dbdd1,null))[_0xf1c7('0x24')](handleError(_0x3dbdd1,null));};exports[_0xf1c7('0x32')]=function(_0x737919,_0x391363){return db[_0xf1c7('0x38')][_0xf1c7('0x53')]({'where':{'id':_0x737919['params']['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x391363,null))[_0xf1c7('0x31')](removeEntity(_0x391363,null))['catch'](handleError(_0x391363,null));};exports[_0xf1c7('0x56')]=function(_0x2a2904,_0x576eda,_0x561ec0){var _0x4d4be6={};var _0x3cfc79={};var _0x1b5735;var _0x382943;return db[_0xf1c7('0x38')]['findOne']({'where':{'id':_0x2a2904[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x576eda,null))[_0xf1c7('0x31')](function(_0x37890c){if(_0x37890c){_0x1b5735=_0x37890c;_0x3cfc79[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x3cfc79[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x2a2904[_0xf1c7('0x3d')]);_0x3cfc79[_0xf1c7('0x3f')]=_['intersection'](_0x3cfc79['model'],_0x3cfc79[_0xf1c7('0x3d')]);_0x4d4be6['attributes']=_['intersection'](_0x3cfc79[_0xf1c7('0x3c')],qs['fields'](_0x2a2904['query'][_0xf1c7('0x42')]));_0x4d4be6[_0xf1c7('0x41')]=_0x4d4be6[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x4d4be6['attributes']:_0x3cfc79[_0xf1c7('0x3c')];_0x4d4be6[_0xf1c7('0x46')]=qs['sort'](_0x2a2904['query']['sort']);_0x4d4be6[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_['pick'](_0x2a2904[_0xf1c7('0x3d')],_0x3cfc79[_0xf1c7('0x3f')]));if(_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0x4d4be6['where']=_[_0xf1c7('0x52')](_0x4d4be6[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x4d4be6[_0xf1c7('0x41')],function(_0xa4c7d8){var _0x3818cc={};_0x3818cc[_0xa4c7d8]={'$like':'%'+_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x3818cc;})});}_0x4d4be6=_[_0xf1c7('0x52')]({},_0x4d4be6,_0x2a2904[_0xf1c7('0x4c')]);return _0x1b5735[_0xf1c7('0x56')](_0x4d4be6);}})[_0xf1c7('0x31')](function(_0x52a9eb){if(_0x52a9eb){_0x382943=_0x52a9eb[_0xf1c7('0x43')];if(!_0x2a2904[_0xf1c7('0x3d')]['hasOwnProperty']('nolimit')){_0x4d4be6[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x2a2904['query']['limit']);_0x4d4be6[_0xf1c7('0x2a')]=qs['offset'](_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x2a')]);}return _0x1b5735[_0xf1c7('0x56')](_0x4d4be6);}})['then'](function(_0x1b3e97){if(_0x1b3e97){return _0x1b3e97?{'count':_0x382943,'rows':_0x1b3e97}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x576eda,null))[_0xf1c7('0x24')](handleError(_0x576eda,null));};exports['getSubjects']=function(_0x1efe59,_0x1e18d9,_0x3c2c44){var _0x386a9b={};var _0x33d7e9={};var _0x25f2f3;var _0x350e03;return db[_0xf1c7('0x38')][_0xf1c7('0x58')]({'where':{'id':_0x1efe59['params']['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x1e18d9,null))[_0xf1c7('0x31')](function(_0x112288){if(_0x112288){_0x25f2f3=_0x112288;_0x33d7e9[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x33d7e9[_0xf1c7('0x3d')]=_['keys'](_0x1efe59[_0xf1c7('0x3d')]);_0x33d7e9[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x33d7e9[_0xf1c7('0x3c')],_0x33d7e9[_0xf1c7('0x3d')]);_0x386a9b['attributes']=_[_0xf1c7('0x40')](_0x33d7e9[_0xf1c7('0x3c')],qs['fields'](_0x1efe59[_0xf1c7('0x3d')]['fields']));_0x386a9b[_0xf1c7('0x41')]=_0x386a9b[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x386a9b[_0xf1c7('0x41')]:_0x33d7e9[_0xf1c7('0x3c')];_0x386a9b[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x47')]);_0x386a9b[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_[_0xf1c7('0x49')](_0x1efe59['query'],_0x33d7e9[_0xf1c7('0x3f')]));if(_0x1efe59[_0xf1c7('0x3d')]['filter']){_0x386a9b['where']=_[_0xf1c7('0x52')](_0x386a9b[_0xf1c7('0x48')],{'$or':_['map'](_0x386a9b[_0xf1c7('0x41')],function(_0x57d5ae){var _0x49ef36={};_0x49ef36[_0x57d5ae]={'$like':'%'+_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x49ef36;})});}_0x386a9b=_[_0xf1c7('0x52')]({},_0x386a9b,_0x1efe59[_0xf1c7('0x4c')]);return _0x25f2f3[_0xf1c7('0x59')](_0x386a9b);}})[_0xf1c7('0x31')](function(_0x55147c){if(_0x55147c){_0x350e03=_0x55147c[_0xf1c7('0x43')];if(!_0x1efe59['query'][_0xf1c7('0x44')](_0xf1c7('0x45'))){_0x386a9b[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x2b')]);_0x386a9b['offset']=qs['offset'](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x2a')]);}return _0x25f2f3[_0xf1c7('0x59')](_0x386a9b);}})[_0xf1c7('0x31')](function(_0x57fa79){if(_0x57fa79){return _0x57fa79?{'count':_0x350e03,'rows':_0x57fa79}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x1e18d9,null))[_0xf1c7('0x24')](handleError(_0x1e18d9,null));};exports[_0xf1c7('0x5a')]=function(_0x41bf5,_0x4f87ea,_0x1ff950){var _0x436c0a={};var _0x36562c={};var _0x1a614a;var _0x2a8140;return db['SugarcrmConfiguration'][_0xf1c7('0x58')]({'where':{'id':_0x41bf5[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x4f87ea,null))[_0xf1c7('0x31')](function(_0x1f8d16){if(_0x1f8d16){_0x1a614a=_0x1f8d16;_0x36562c[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x36562c[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x41bf5[_0xf1c7('0x3d')]);_0x36562c[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x36562c[_0xf1c7('0x3c')],_0x36562c[_0xf1c7('0x3d')]);_0x436c0a[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x36562c['model'],qs[_0xf1c7('0x42')](_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0x436c0a[_0xf1c7('0x41')]=_0x436c0a[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x436c0a[_0xf1c7('0x41')]:_0x36562c[_0xf1c7('0x3c')];_0x436c0a[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x41bf5[_0xf1c7('0x3d')]['sort']);_0x436c0a[_0xf1c7('0x48')]=qs['filters'](_[_0xf1c7('0x49')](_0x41bf5[_0xf1c7('0x3d')],_0x36562c['filters']));if(_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0x436c0a['where']=_['merge'](_0x436c0a[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x436c0a[_0xf1c7('0x41')],function(_0x560c5d){var _0x5bce46={};_0x5bce46[_0x560c5d]={'$like':'%'+_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x5bce46;})});}_0x436c0a=_[_0xf1c7('0x52')]({},_0x436c0a,_0x41bf5['options']);return _0x1a614a[_0xf1c7('0x5a')](_0x436c0a);}})[_0xf1c7('0x31')](function(_0x174908){if(_0x174908){_0x2a8140=_0x174908[_0xf1c7('0x43')];if(!_0x41bf5[_0xf1c7('0x3d')]['hasOwnProperty'](_0xf1c7('0x45'))){_0x436c0a[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x2b')]);_0x436c0a[_0xf1c7('0x2a')]=qs[_0xf1c7('0x2a')](_0x41bf5['query'][_0xf1c7('0x2a')]);}return _0x1a614a['getDescriptions'](_0x436c0a);}})[_0xf1c7('0x31')](function(_0x39682a){if(_0x39682a){return _0x39682a?{'count':_0x2a8140,'rows':_0x39682a}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x4f87ea,null))[_0xf1c7('0x24')](handleError(_0x4f87ea,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 55460e9..5a8221f 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 _0xa92b=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa92b,0x66));var _0xba92=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0xa92b[_0x2f037f];return _0x2d1573;};'use strict';var _=require(_0xba92('0x0'));var util=require(_0xba92('0x1'));var logger=require(_0xba92('0x2'))(_0xba92('0x3'));var moment=require(_0xba92('0x4'));var BPromise=require(_0xba92('0x5'));var rp=require(_0xba92('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba92('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xba92('0x8')]=function(_0x247fc6,_0x2197db){return _0x247fc6['define'](_0xba92('0x9'),attributes,{'tableName':_0xba92('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4873=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x261999,_0x15f7e8){var _0x109e04=function(_0x4c8e93){while(--_0x4c8e93){_0x261999['push'](_0x261999['shift']());}};_0x109e04(++_0x15f7e8);}(_0x4873,0xe9));var _0x3487=function(_0x2148a8,_0x48fec1){_0x2148a8=_0x2148a8-0x0;var _0x2cea12=_0x4873[_0x2148a8];return _0x2cea12;};'use strict';var _=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3487('0x2'));var BPromise=require('bluebird');var rp=require(_0x3487('0x3'));var fs=require('fs');var path=require(_0x3487('0x4'));var rimraf=require('rimraf');var config=require(_0x3487('0x5'));var attributes=require(_0x3487('0x6'));module[_0x3487('0x7')]=function(_0x3deaa2,_0x2c6d0c){return _0x3deaa2[_0x3487('0x8')](_0x3487('0x9'),attributes,{'tableName':_0x3487('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index e416a71..bb1818b 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 _0xeb00=['client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeb00,0x194));var _0x0eb0=function(_0x5ea3a3,_0x47e5f7){_0x5ea3a3=_0x5ea3a3-0x0;var _0x18837b=_0xeb00[_0x5ea3a3];return _0x18837b;};'use strict';var _=require('lodash');var util=require(_0x0eb0('0x0'));var moment=require(_0x0eb0('0x1'));var BPromise=require(_0x0eb0('0x2'));var rs=require(_0x0eb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eb0('0x4'))['db'];var utils=require(_0x0eb0('0x5'));var logger=require(_0x0eb0('0x6'))(_0x0eb0('0x7'));var config=require(_0x0eb0('0x8'));var jayson=require(_0x0eb0('0x9'));var client=jayson[_0x0eb0('0xa')][_0x0eb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55b551,_0x5c13e6,_0x4405f0){return new BPromise(function(_0x5f14d1,_0x5f57d8){return client['request'](_0x55b551,_0x4405f0)[_0x0eb0('0xc')](function(_0x30f900){logger[_0x0eb0('0xd')](_0x0eb0('0xe'),_0x5c13e6,_0x0eb0('0xf'));logger['debug'](_0x0eb0('0x10'),_0x5c13e6,_0x0eb0('0xf'),JSON[_0x0eb0('0x11')](_0x30f900));if(_0x30f900['error']){if(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x13')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5c13e6,_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);return _0x5f57d8(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);}logger[_0x0eb0('0x12')](_0x0eb0('0xe'),_0x5c13e6,_0x30f900[_0x0eb0('0x12')]['message']);return _0x5f14d1(_0x30f900[_0x0eb0('0x12')][_0x0eb0('0x14')]);}else{logger[_0x0eb0('0xd')](_0x0eb0('0xe'),_0x5c13e6,_0x0eb0('0xf'));_0x5f14d1(_0x30f900[_0x0eb0('0x15')][_0x0eb0('0x14')]);}})[_0x0eb0('0x16')](function(_0x4c23c1){logger['error'](_0x0eb0('0xe'),_0x5c13e6,_0x4c23c1);_0x5f57d8(_0x4c23c1);});});} \ No newline at end of file +var _0x7a9b=['message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b057d,_0x2ccd9e){var _0x1d3c44=function(_0x2cba63){while(--_0x2cba63){_0x4b057d['push'](_0x4b057d['shift']());}};_0x1d3c44(++_0x2ccd9e);}(_0x7a9b,0x15d));var _0xb7a9=function(_0x5cc51d,_0x1e2e33){_0x5cc51d=_0x5cc51d-0x0;var _0x3975d9=_0x7a9b[_0x5cc51d];return _0x3975d9;};'use strict';var _=require('lodash');var util=require(_0xb7a9('0x0'));var moment=require(_0xb7a9('0x1'));var BPromise=require(_0xb7a9('0x2'));var rs=require(_0xb7a9('0x3'));var fs=require('fs');var Redis=require(_0xb7a9('0x4'));var db=require(_0xb7a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a9('0x6'))(_0xb7a9('0x7'));var config=require(_0xb7a9('0x8'));var jayson=require(_0xb7a9('0x9'));var client=jayson['client'][_0xb7a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x413206,_0x17506e,_0x1096cf){return new BPromise(function(_0xda2711,_0x5bf3e9){return client['request'](_0x413206,_0x1096cf)[_0xb7a9('0xb')](function(_0xdf722b){logger[_0xb7a9('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17506e,_0xb7a9('0xd'));logger[_0xb7a9('0xe')](_0xb7a9('0xf'),_0x17506e,_0xb7a9('0xd'),JSON[_0xb7a9('0x10')](_0xdf722b));if(_0xdf722b[_0xb7a9('0x11')]){if(_0xdf722b[_0xb7a9('0x11')][_0xb7a9('0x12')]===0x1f4){logger[_0xb7a9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17506e,_0xdf722b[_0xb7a9('0x11')]['message']);return _0x5bf3e9(_0xdf722b['error'][_0xb7a9('0x13')]);}logger[_0xb7a9('0x11')](_0xb7a9('0x14'),_0x17506e,_0xdf722b['error'][_0xb7a9('0x13')]);return _0xda2711(_0xdf722b[_0xb7a9('0x11')][_0xb7a9('0x13')]);}else{logger[_0xb7a9('0xc')](_0xb7a9('0x14'),_0x17506e,_0xb7a9('0xd'));_0xda2711(_0xdf722b[_0xb7a9('0x15')][_0xb7a9('0x13')]);}})[_0xb7a9('0x16')](function(_0x55d92a){logger[_0xb7a9('0x11')](_0xb7a9('0x14'),_0x17506e,_0x55d92a);_0x5bf3e9(_0x55d92a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 34dbe88..3b0565f 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 _0x3fae=['/:id','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x3fae,0xf5));var _0xe3fa=function(_0x2163fb,_0x43a40f){_0x2163fb=_0x2163fb-0x0;var _0x3b1401=_0x3fae[_0x2163fb];return _0x3b1401;};'use strict';var multer=require(_0xe3fa('0x0'));var util=require(_0xe3fa('0x1'));var path=require(_0xe3fa('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3fa('0x3'));var router=express[_0xe3fa('0x4')]();var auth=require(_0xe3fa('0x5'));var interaction=require(_0xe3fa('0x6'));var config=require(_0xe3fa('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xe3fa('0x8')]('/',auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xa')]);router['get'](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller['show']);router['post']('/',auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xc')]);router[_0xe3fa('0xd')](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller[_0xe3fa('0xe')]);router[_0xe3fa('0xf')](_0xe3fa('0xb'),auth[_0xe3fa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc056=['../../config/environment','./intSugarcrmField.controller','index','isAuthenticated','post','create','/:id','update','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc056,0x9f));var _0x6c05=function(_0x15262b,_0x966690){_0x15262b=_0x15262b-0x0;var _0x371a9a=_0xc056[_0x15262b];return _0x371a9a;};'use strict';var multer=require(_0x6c05('0x0'));var util=require(_0x6c05('0x1'));var path=require(_0x6c05('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c05('0x3'));var router=express[_0x6c05('0x4')]();var auth=require(_0x6c05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c05('0x6'));var controller=require(_0x6c05('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c05('0x8')]);router['get']('/:id',auth[_0x6c05('0x9')](),controller['show']);router[_0x6c05('0xa')]('/',auth[_0x6c05('0x9')](),controller[_0x6c05('0xb')]);router['put'](_0x6c05('0xc'),auth[_0x6c05('0x9')](),controller[_0x6c05('0xd')]);router['delete']('/:id',auth[_0x6c05('0x9')](),controller[_0x6c05('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c96b962..a9db0de 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 _0xa8eb=['ENUM','variable','customVariable','keyValue','STRING','string','sequelize'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xa8eb,0x179));var _0xba8e=function(_0x1eefb7,_0x42488c){_0x1eefb7=_0x1eefb7-0x0;var _0x29268f=_0xa8eb[_0x1eefb7];return _0x29268f;};'use strict';var Sequelize=require(_0xba8e('0x0'));module['exports']={'type':{'type':Sequelize[_0xba8e('0x1')]('string',_0xba8e('0x2'),_0xba8e('0x3'),_0xba8e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xba8e('0x5')]},'key':{'type':Sequelize[_0xba8e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xba8e('0x6'),'variable',_0xba8e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xba8e('0x5')]},'nameField':{'type':Sequelize[_0xba8e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c96=['ENUM','string','customVariable','keyValue','STRING','sequelize'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6c96,0x1c1));var _0x66c9=function(_0x8c1974,_0x3f445c){_0x8c1974=_0x8c1974-0x0;var _0x3068cf=_0x6c96[_0x8c1974];return _0x3068cf;};'use strict';var Sequelize=require(_0x66c9('0x0'));module['exports']={'type':{'type':Sequelize[_0x66c9('0x1')](_0x66c9('0x2'),'variable',_0x66c9('0x3'),_0x66c9('0x4')),'defaultValue':_0x66c9('0x2')},'content':{'type':Sequelize[_0x66c9('0x5')]},'key':{'type':Sequelize[_0x66c9('0x5')]},'keyType':{'type':Sequelize[_0x66c9('0x1')](_0x66c9('0x2'),'variable',_0x66c9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x66c9('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ca61943..9428634 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 _0x98a8=['options','SugarcrmField','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge'];(function(_0x3c0ed7,_0x52c6ff){var _0x2973e6=function(_0xde1abf){while(--_0xde1abf){_0x3c0ed7['push'](_0x3c0ed7['shift']());}};_0x2973e6(++_0x52c6ff);}(_0x98a8,0x12c));var _0x898a=function(_0x2036c1,_0x88c68){_0x2036c1=_0x2036c1-0x0;var _0x5539ed=_0x98a8[_0x2036c1];return _0x5539ed;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=_0x53a4b8[_0x898a('0x1c')],_0x5c96a6=_0x47033c['offset'],_0x303321=_0x47033c[_0x898a('0x1d')]+_0x47033c[_0x898a('0x1e')],_0x4fb05b;if(_0x303321>=_0x3fec7a){_0x303321=_0x3fec7a;_0x4fb05b=0xc8;}else{_0x4fb05b=0xce;}_0x506023[_0x898a('0x1a')](_0x4fb05b);return _0x506023['set'](_0x898a('0x1f'),_0x5c96a6+'-'+_0x303321+'/'+_0x3fec7a)['json'](_0x53a4b8);}return null;};}function patchUpdates(_0x54c8f3){return function(_0x3f8af4){try{jsonpatch[_0x898a('0x20')](_0x3f8af4,_0x54c8f3,!![]);}catch(_0x58c3ab){return BPromise['reject'](_0x58c3ab);}return _0x3f8af4[_0x898a('0x21')]();};}function saveUpdates(_0x26449a,_0x38a8f0){return function(_0x2917ff){if(_0x2917ff){return _0x2917ff[_0x898a('0x22')](_0x26449a)[_0x898a('0x23')](function(_0x259541){return _0x259541;});}return null;};}function removeEntity(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x483212[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x4e254d,_0x274cdf){return function(_0x16c318){if(!_0x16c318){_0x4e254d[_0x898a('0x25')](0x194);}return _0x16c318;};}function handleError(_0x32eca5,_0x3901ab){_0x3901ab=_0x3901ab||0x1f4;return function(_0x1426e3){logger['error'](_0x1426e3[_0x898a('0x26')]);if(_0x1426e3['name']){delete _0x1426e3['name'];}_0x32eca5['status'](_0x3901ab)[_0x898a('0x27')](_0x1426e3);};}exports[_0x898a('0x28')]=function(_0x420b25,_0x40b3db){var _0x28ae6a={},_0x2efde2={},_0x398e98={'count':0x0,'rows':[]};var _0xac1fc4=_[_0x898a('0x29')](db['SugarcrmField']['rawAttributes'],function(_0x47f1ed){return{'name':_0x47f1ed[_0x898a('0x2a')],'type':_0x47f1ed[_0x898a('0x2b')][_0x898a('0x2c')]};});_0x2efde2[_0x898a('0x2d')]=_[_0x898a('0x29')](_0xac1fc4,_0x898a('0x2e'));_0x2efde2[_0x898a('0x2f')]=_[_0x898a('0x30')](_0x420b25[_0x898a('0x2f')]);_0x2efde2[_0x898a('0x31')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],_0x2efde2['query']);_0x28ae6a[_0x898a('0x33')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x420b25[_0x898a('0x2f')]['fields']));_0x28ae6a['attributes']=_0x28ae6a[_0x898a('0x33')][_0x898a('0x35')]?_0x28ae6a[_0x898a('0x33')]:_0x2efde2['model'];if(!_0x420b25[_0x898a('0x2f')][_0x898a('0x36')](_0x898a('0x37'))){_0x28ae6a[_0x898a('0x1e')]=qs[_0x898a('0x1e')](_0x420b25[_0x898a('0x2f')][_0x898a('0x1e')]);_0x28ae6a[_0x898a('0x1d')]=qs['offset'](_0x420b25[_0x898a('0x2f')]['offset']);}_0x28ae6a['order']=qs[_0x898a('0x38')](_0x420b25['query'][_0x898a('0x38')]);_0x28ae6a['where']=qs[_0x898a('0x31')](_['pick'](_0x420b25[_0x898a('0x2f')],_0x2efde2[_0x898a('0x31')]),_0xac1fc4);if(_0x420b25[_0x898a('0x2f')]['filter']){_0x28ae6a['where']=_['merge'](_0x28ae6a[_0x898a('0x39')],{'$or':_[_0x898a('0x29')](_0xac1fc4,function(_0x5a228f){if(_0x5a228f[_0x898a('0x2b')]!==_0x898a('0x3a')){var _0xe84f7e={};_0xe84f7e[_0x5a228f[_0x898a('0x2e')]]={'$like':'%'+_0x420b25['query']['filter']+'%'};return _0xe84f7e;}})});}_0x28ae6a=_[_0x898a('0x3b')]({},_0x28ae6a,_0x420b25[_0x898a('0x3c')]);var _0x4d486b={'where':_0x28ae6a['where']};return db[_0x898a('0x3d')][_0x898a('0x1c')](_0x4d486b)[_0x898a('0x23')](function(_0xa45405){_0x398e98['count']=_0xa45405;if(_0x420b25[_0x898a('0x2f')][_0x898a('0x3e')]){_0x28ae6a['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x28ae6a);})[_0x898a('0x23')](function(_0x477a9d){_0x398e98[_0x898a('0x3f')]=_0x477a9d;return _0x398e98;})[_0x898a('0x23')](respondWithFilteredResult(_0x40b3db,_0x28ae6a))[_0x898a('0x40')](handleError(_0x40b3db,null));};exports[_0x898a('0x41')]=function(_0x10daf6,_0x1432ec){var _0x3292c2={'raw':!![],'where':{'id':_0x10daf6[_0x898a('0x42')]['id']}},_0x235fcf={};_0x235fcf[_0x898a('0x2d')]=_[_0x898a('0x30')](db[_0x898a('0x3d')][_0x898a('0x43')]);_0x235fcf['query']=_[_0x898a('0x30')](_0x10daf6[_0x898a('0x2f')]);_0x235fcf[_0x898a('0x31')]=_['intersection'](_0x235fcf[_0x898a('0x2d')],_0x235fcf[_0x898a('0x2f')]);_0x3292c2[_0x898a('0x33')]=_[_0x898a('0x32')](_0x235fcf[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x10daf6[_0x898a('0x2f')][_0x898a('0x34')]));_0x3292c2['attributes']=_0x3292c2[_0x898a('0x33')][_0x898a('0x35')]?_0x3292c2[_0x898a('0x33')]:_0x235fcf[_0x898a('0x2d')];if(_0x10daf6['query'][_0x898a('0x3e')]){_0x3292c2[_0x898a('0x44')]=[{'all':!![]}];}_0x3292c2=_['merge']({},_0x3292c2,_0x10daf6[_0x898a('0x3c')]);return db['SugarcrmField'][_0x898a('0x45')](_0x3292c2)['then'](handleEntityNotFound(_0x1432ec,null))['then'](respondWithResult(_0x1432ec,null))[_0x898a('0x40')](handleError(_0x1432ec,null));};exports['create']=function(_0x313fb4,_0x1edb26){return db['SugarcrmField'][_0x898a('0x46')](_0x313fb4[_0x898a('0x47')],{})['then'](respondWithResult(_0x1edb26,0xc9))[_0x898a('0x40')](handleError(_0x1edb26,null));};exports[_0x898a('0x22')]=function(_0x11a0a3,_0x118240){if(_0x11a0a3['body']['id']){delete _0x11a0a3[_0x898a('0x47')]['id'];}return db[_0x898a('0x3d')]['find']({'where':{'id':_0x11a0a3[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x118240,null))['then'](saveUpdates(_0x11a0a3[_0x898a('0x47')],null))['then'](respondWithResult(_0x118240,null))[_0x898a('0x40')](handleError(_0x118240,null));};exports[_0x898a('0x24')]=function(_0x32ccb9,_0x50f9e3){return db[_0x898a('0x3d')][_0x898a('0x45')]({'where':{'id':_0x32ccb9[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x50f9e3,null))['then'](removeEntity(_0x50f9e3,null))[_0x898a('0x40')](handleError(_0x50f9e3,null));}; \ No newline at end of file +var _0x3831=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','includeAll','include','catch','params','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0xf99358,_0x1955b6){var _0x3d568f=function(_0x4312c4){while(--_0x4312c4){_0xf99358['push'](_0xf99358['shift']());}};_0x3d568f(++_0x1955b6);}(_0x3831,0x14c));var _0x1383=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0x3831[_0x55e5b9];return _0x58d1e7;};'use strict';var pdf=require(_0x1383('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1383('0x1'));var zipdir=require(_0x1383('0x2'));var jsonpatch=require(_0x1383('0x3'));var rp=require(_0x1383('0x4'));var moment=require(_0x1383('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1383('0x6'));var util=require('util');var path=require(_0x1383('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1383('0x8'));var squel=require('squel');var crypto=require(_0x1383('0x9'));var jsforce=require(_0x1383('0xa'));var deskjs=require(_0x1383('0xb'));var toCsv=require(_0x1383('0xc'));var querystring=require(_0x1383('0xd'));var Papa=require(_0x1383('0xe'));var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1383('0x11'));var hardwareService=require(_0x1383('0x12'));var logger=require(_0x1383('0x13'))(_0x1383('0x14'));var utils=require(_0x1383('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1383('0x16'));var db=require(_0x1383('0x17'))['db'];function respondWithStatusCode(_0x1d35fc,_0x48c107){_0x48c107=_0x48c107||0xcc;return function(_0x5e7f63){if(_0x5e7f63){return _0x1d35fc[_0x1383('0x18')](_0x48c107);}return _0x1d35fc[_0x1383('0x19')](_0x48c107)[_0x1383('0x1a')]();};}function respondWithResult(_0x1ba3d1,_0x1e02d7){_0x1e02d7=_0x1e02d7||0xc8;return function(_0x2c8931){if(_0x2c8931){return _0x1ba3d1[_0x1383('0x19')](_0x1e02d7)[_0x1383('0x1b')](_0x2c8931);}};}function respondWithFilteredResult(_0x5e9ed9,_0x7a50d0){return function(_0x1f46de){if(_0x1f46de){var _0x41d895=_0x1f46de[_0x1383('0x1c')],_0x1c6d7b=_0x7a50d0['offset'],_0x29fbd7=_0x7a50d0['offset']+_0x7a50d0[_0x1383('0x1d')],_0x388b94;if(_0x29fbd7>=_0x41d895){_0x29fbd7=_0x41d895;_0x388b94=0xc8;}else{_0x388b94=0xce;}_0x5e9ed9['status'](_0x388b94);return _0x5e9ed9[_0x1383('0x1e')]('Content-Range',_0x1c6d7b+'-'+_0x29fbd7+'/'+_0x41d895)['json'](_0x1f46de);}return null;};}function patchUpdates(_0x4d854f){return function(_0x1c8fe7){try{jsonpatch['apply'](_0x1c8fe7,_0x4d854f,!![]);}catch(_0x2aa3b6){return BPromise['reject'](_0x2aa3b6);}return _0x1c8fe7[_0x1383('0x1f')]();};}function saveUpdates(_0x1e6d5e,_0xca314){return function(_0x39884b){if(_0x39884b){return _0x39884b[_0x1383('0x20')](_0x1e6d5e)[_0x1383('0x21')](function(_0x315e42){return _0x315e42;});}return null;};}function removeEntity(_0x10ed33,_0x2afbd2){return function(_0x505093){if(_0x505093){return _0x505093[_0x1383('0x22')]()[_0x1383('0x21')](function(){_0x10ed33[_0x1383('0x19')](0xcc)[_0x1383('0x1a')]();});}};}function handleEntityNotFound(_0x186524,_0x2a9502){return function(_0x38f1d6){if(!_0x38f1d6){_0x186524['sendStatus'](0x194);}return _0x38f1d6;};}function handleError(_0x5c4658,_0x1d24b7){_0x1d24b7=_0x1d24b7||0x1f4;return function(_0x160497){logger[_0x1383('0x23')](_0x160497[_0x1383('0x24')]);if(_0x160497[_0x1383('0x25')]){delete _0x160497['name'];}_0x5c4658['status'](_0x1d24b7)['send'](_0x160497);};}exports[_0x1383('0x26')]=function(_0x128628,_0x30877f){var _0x263aea={},_0x5866a1={},_0x1f7688={'count':0x0,'rows':[]};var _0x4ac2d4=_[_0x1383('0x27')](db[_0x1383('0x28')][_0x1383('0x29')],function(_0x23e541){return{'name':_0x23e541[_0x1383('0x2a')],'type':_0x23e541[_0x1383('0x2b')][_0x1383('0x2c')]};});_0x5866a1[_0x1383('0x2d')]=_[_0x1383('0x27')](_0x4ac2d4,_0x1383('0x25'));_0x5866a1[_0x1383('0x2e')]=_[_0x1383('0x2f')](_0x128628[_0x1383('0x2e')]);_0x5866a1[_0x1383('0x30')]=_['intersection'](_0x5866a1[_0x1383('0x2d')],_0x5866a1[_0x1383('0x2e')]);_0x263aea[_0x1383('0x31')]=_[_0x1383('0x32')](_0x5866a1[_0x1383('0x2d')],qs[_0x1383('0x33')](_0x128628['query'][_0x1383('0x33')]));_0x263aea[_0x1383('0x31')]=_0x263aea[_0x1383('0x31')][_0x1383('0x34')]?_0x263aea[_0x1383('0x31')]:_0x5866a1[_0x1383('0x2d')];if(!_0x128628['query'][_0x1383('0x35')]('nolimit')){_0x263aea['limit']=qs[_0x1383('0x1d')](_0x128628[_0x1383('0x2e')][_0x1383('0x1d')]);_0x263aea['offset']=qs['offset'](_0x128628['query'][_0x1383('0x36')]);}_0x263aea[_0x1383('0x37')]=qs[_0x1383('0x38')](_0x128628['query']['sort']);_0x263aea[_0x1383('0x39')]=qs[_0x1383('0x30')](_[_0x1383('0x3a')](_0x128628[_0x1383('0x2e')],_0x5866a1['filters']),_0x4ac2d4);if(_0x128628['query'][_0x1383('0x3b')]){_0x263aea[_0x1383('0x39')]=_[_0x1383('0x3c')](_0x263aea[_0x1383('0x39')],{'$or':_[_0x1383('0x27')](_0x4ac2d4,function(_0x872e9b){if(_0x872e9b[_0x1383('0x2b')]!=='VIRTUAL'){var _0x3d5d03={};_0x3d5d03[_0x872e9b['name']]={'$like':'%'+_0x128628[_0x1383('0x2e')][_0x1383('0x3b')]+'%'};return _0x3d5d03;}})});}_0x263aea=_[_0x1383('0x3c')]({},_0x263aea,_0x128628['options']);var _0x277689={'where':_0x263aea['where']};return db['SugarcrmField'][_0x1383('0x1c')](_0x277689)[_0x1383('0x21')](function(_0x20bab4){_0x1f7688['count']=_0x20bab4;if(_0x128628[_0x1383('0x2e')][_0x1383('0x3d')]){_0x263aea[_0x1383('0x3e')]=[{'all':!![]}];}return db[_0x1383('0x28')]['findAll'](_0x263aea);})[_0x1383('0x21')](function(_0x4c465e){_0x1f7688['rows']=_0x4c465e;return _0x1f7688;})[_0x1383('0x21')](respondWithFilteredResult(_0x30877f,_0x263aea))[_0x1383('0x3f')](handleError(_0x30877f,null));};exports['show']=function(_0x4b4c0d,_0x5ca90f){var _0x42f579={'raw':!![],'where':{'id':_0x4b4c0d[_0x1383('0x40')]['id']}},_0x477d87={};_0x477d87[_0x1383('0x2d')]=_[_0x1383('0x2f')](db[_0x1383('0x28')][_0x1383('0x29')]);_0x477d87[_0x1383('0x2e')]=_[_0x1383('0x2f')](_0x4b4c0d['query']);_0x477d87[_0x1383('0x30')]=_[_0x1383('0x32')](_0x477d87[_0x1383('0x2d')],_0x477d87['query']);_0x42f579[_0x1383('0x31')]=_['intersection'](_0x477d87[_0x1383('0x2d')],qs[_0x1383('0x33')](_0x4b4c0d[_0x1383('0x2e')][_0x1383('0x33')]));_0x42f579[_0x1383('0x31')]=_0x42f579[_0x1383('0x31')][_0x1383('0x34')]?_0x42f579[_0x1383('0x31')]:_0x477d87[_0x1383('0x2d')];if(_0x4b4c0d['query']['includeAll']){_0x42f579['include']=[{'all':!![]}];}_0x42f579=_[_0x1383('0x3c')]({},_0x42f579,_0x4b4c0d[_0x1383('0x41')]);return db[_0x1383('0x28')][_0x1383('0x42')](_0x42f579)[_0x1383('0x21')](handleEntityNotFound(_0x5ca90f,null))[_0x1383('0x21')](respondWithResult(_0x5ca90f,null))['catch'](handleError(_0x5ca90f,null));};exports[_0x1383('0x43')]=function(_0x1d460c,_0x406f39){return db['SugarcrmField'][_0x1383('0x43')](_0x1d460c[_0x1383('0x44')],{})[_0x1383('0x21')](respondWithResult(_0x406f39,0xc9))[_0x1383('0x3f')](handleError(_0x406f39,null));};exports[_0x1383('0x20')]=function(_0x5918a1,_0x330853){if(_0x5918a1['body']['id']){delete _0x5918a1[_0x1383('0x44')]['id'];}return db[_0x1383('0x28')]['find']({'where':{'id':_0x5918a1[_0x1383('0x40')]['id']}})[_0x1383('0x21')](handleEntityNotFound(_0x330853,null))[_0x1383('0x21')](saveUpdates(_0x5918a1[_0x1383('0x44')],null))[_0x1383('0x21')](respondWithResult(_0x330853,null))[_0x1383('0x3f')](handleError(_0x330853,null));};exports[_0x1383('0x22')]=function(_0x472e99,_0x2cc900){return db[_0x1383('0x28')]['find']({'where':{'id':_0x472e99[_0x1383('0x40')]['id']}})[_0x1383('0x21')](handleEntityNotFound(_0x2cc900,null))[_0x1383('0x21')](removeEntity(_0x2cc900,null))[_0x1383('0x3f')](handleError(_0x2cc900,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 611fefd..d9b5d09 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 _0xc39a=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x407465,_0x4d661f){var _0x4611d9=function(_0x30f80e){while(--_0x30f80e){_0x407465['push'](_0x407465['shift']());}};_0x4611d9(++_0x4d661f);}(_0xc39a,0x85));var _0xac39=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xc39a[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0xac39('0x0'));var util=require(_0xac39('0x1'));var logger=require(_0xac39('0x2'))(_0xac39('0x3'));var moment=require(_0xac39('0x4'));var BPromise=require(_0xac39('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac39('0x6'));var rimraf=require(_0xac39('0x7'));var config=require(_0xac39('0x8'));var attributes=require(_0xac39('0x9'));module[_0xac39('0xa')]=function(_0x10360c,_0x2e3b9f){return _0x10360c[_0xac39('0xb')](_0xac39('0xc'),attributes,{'tableName':_0xac39('0xd'),'paranoid':![],'indexes':[{'name':_0xac39('0xe'),'fields':['idField',_0xac39('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd625=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x44814d,_0xf4663a){var _0x5d7695=function(_0x355c6e){while(--_0x355c6e){_0x44814d['push'](_0x44814d['shift']());}};_0x5d7695(++_0xf4663a);}(_0xd625,0xff));var _0x5d62=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xd625[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x5d62('0x0'));var util=require(_0x5d62('0x1'));var logger=require(_0x5d62('0x2'))(_0x5d62('0x3'));var moment=require('moment');var BPromise=require(_0x5d62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d62('0x5'));var rimraf=require(_0x5d62('0x6'));var config=require(_0x5d62('0x7'));var attributes=require(_0x5d62('0x8'));module['exports']=function(_0x1a925e,_0x113e30){return _0x1a925e[_0x5d62('0x9')](_0x5d62('0xa'),attributes,{'tableName':_0x5d62('0xb'),'paranoid':![],'indexes':[{'name':_0x5d62('0xc'),'fields':[_0x5d62('0xd'),_0x5d62('0xe')],'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 883b51b..b731ca2 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 _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x4fc2,0x111));var _0x24fc=function(_0x306e30,_0x107fe3){_0x306e30=_0x306e30-0x0;var _0x247281=_0x4fc2[_0x306e30];return _0x247281;};'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')]('SugarcrmField,\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')]('SugarcrmField,\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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x52bc53,_0x29d09d){var _0x36d12b=function(_0x1cd325){while(--_0x1cd325){_0x52bc53['push'](_0x52bc53['shift']());}};_0x36d12b(++_0x29d09d);}(_0x14a0,0x8e));var _0x014a=function(_0x4dbe44,_0x3b786e){_0x4dbe44=_0x4dbe44-0x0;var _0x4eaa3b=_0x14a0[_0x4dbe44];return _0x4eaa3b;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f56a95a..f4b8549 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 _0xb075=['getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations'];(function(_0x2bcaed,_0x49c3cd){var _0x26fab9=function(_0x53f134){while(--_0x53f134){_0x2bcaed['push'](_0x2bcaed['shift']());}};_0x26fab9(++_0x49c3cd);}(_0xb075,0x92));var _0x5b07=function(_0x13562f,_0x1e5376){_0x13562f=_0x13562f-0x0;var _0x2fb051=_0xb075[_0x13562f];return _0x2fb051;};'use strict';var multer=require(_0x5b07('0x0'));var util=require(_0x5b07('0x1'));var path=require(_0x5b07('0x2'));var timeout=require(_0x5b07('0x3'));var express=require(_0x5b07('0x4'));var router=express[_0x5b07('0x5')]();var auth=require(_0x5b07('0x6'));var interaction=require(_0x5b07('0x7'));var config=require(_0x5b07('0x8'));var controller=require(_0x5b07('0x9'));router['get']('/',auth[_0x5b07('0xa')](),controller[_0x5b07('0xb')]);router[_0x5b07('0xc')](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller['show']);router[_0x5b07('0xc')](_0x5b07('0xe'),auth[_0x5b07('0xa')](),controller[_0x5b07('0xf')]);router['get'](_0x5b07('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x5b07('0x11')]('/',auth['isAuthenticated'](),controller[_0x5b07('0x12')]);router['post'](_0x5b07('0xe'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x13')]);router[_0x5b07('0x14')](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x15')]);router['delete'](_0x5b07('0xd'),auth[_0x5b07('0xa')](),controller[_0x5b07('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb444=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x26a7f3,_0x4763c5){var _0x24d8dd=function(_0x5a4c54){while(--_0x5a4c54){_0x26a7f3['push'](_0x26a7f3['shift']());}};_0x24d8dd(++_0x4763c5);}(_0xb444,0x16c));var _0x4b44=function(_0x6ab212,_0xba159c){_0x6ab212=_0x6ab212-0x0;var _0x3002ed=_0xb444[_0x6ab212];return _0x3002ed;};'use strict';var multer=require(_0x4b44('0x0'));var util=require(_0x4b44('0x1'));var path=require('path');var timeout=require(_0x4b44('0x2'));var express=require(_0x4b44('0x3'));var router=express[_0x4b44('0x4')]();var auth=require(_0x4b44('0x5'));var interaction=require(_0x4b44('0x6'));var config=require(_0x4b44('0x7'));var controller=require(_0x4b44('0x8'));router[_0x4b44('0x9')]('/',auth[_0x4b44('0xa')](),controller[_0x4b44('0xb')]);router[_0x4b44('0x9')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0xd')]);router[_0x4b44('0x9')](_0x4b44('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4b44('0x9')](_0x4b44('0xf'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x10')]);router[_0x4b44('0x11')]('/',auth[_0x4b44('0xa')](),controller[_0x4b44('0x12')]);router[_0x4b44('0x11')](_0x4b44('0xe'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x13')]);router[_0x4b44('0x14')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x15')]);router[_0x4b44('0x16')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x17')]);module[_0x4b44('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3468844..5b9a396 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 _0xdcb8=['exports','STRING','HelpDesk'];(function(_0x4e8330,_0x430ee0){var _0x2f3774=function(_0x26d809){while(--_0x26d809){_0x4e8330['push'](_0x4e8330['shift']());}};_0x2f3774(++_0x430ee0);}(_0xdcb8,0x13b));var _0x8dcb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcb8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x8dcb('0x0')]={'name':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![],'defaultValue':_0x8dcb('0x2')},'remoteUri':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8dcb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2087=['exports','STRING','HelpDesk','sequelize'];(function(_0xc375f5,_0x1e1a0f){var _0x481727=function(_0x5aa7c5){while(--_0x5aa7c5){_0xc375f5['push'](_0xc375f5['shift']());}};_0x481727(++_0x1e1a0f);}(_0x2087,0xf3));var _0x7208=function(_0x2838e7,_0x58d4fb){_0x2838e7=_0x2838e7-0x0;var _0x53b163=_0x2087[_0x2838e7];return _0x53b163;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7208('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7208('0x2')],'allowNull':![],'defaultValue':_0x7208('0x3')},'remoteUri':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 8d94db0..6a93730 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 _0x4b1e=['remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','reference','owner','remove','includes','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','count','offset','status','apply','reject','save','update','then','stack','name','send','index','map','VtigerAccount','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description'];(function(_0x43c62f,_0x539ddf){var _0x50a638=function(_0x3117b2){while(--_0x3117b2){_0x43c62f['push'](_0x43c62f['shift']());}};_0x50a638(++_0x539ddf);}(_0x4b1e,0x11f));var _0xe4b1=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x4b1e[_0x1ac6ec];return _0x48a489;};'use strict';var pdf=require(_0xe4b1('0x0'));var emlformat=require(_0xe4b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe4b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4b1('0x3'));var moment=require(_0xe4b1('0x4'));var BPromise=require(_0xe4b1('0x5'));var Mustache=require(_0xe4b1('0x6'));var util=require(_0xe4b1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4b1('0x8'));var deskjs=require(_0xe4b1('0x9'));var toCsv=require(_0xe4b1('0xa'));var querystring=require(_0xe4b1('0xb'));var Papa=require('papaparse');var Redis=require(_0xe4b1('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe4b1('0xd'));var as=require(_0xe4b1('0xe'));var hardwareService=require(_0xe4b1('0xf'));var logger=require(_0xe4b1('0x10'))(_0xe4b1('0x11'));var utils=require(_0xe4b1('0x12'));var config=require(_0xe4b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4b1('0x14'))['db'];var integrations=require(_0xe4b1('0x15'));var jayson=require(_0xe4b1('0x16'));var client=jayson[_0xe4b1('0x17')][_0xe4b1('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5cae14,_0x4ab998,_0xe2df3d,_0x4c199a){return new BPromise(function(_0x3f512a,_0x5cabe6){var _0x47398e=_0x4c199a||client;return _0x47398e[_0xe4b1('0x19')](_0x5cae14,_0xe2df3d)['then'](function(_0x440186){logger[_0xe4b1('0x1a')](_0xe4b1('0x1b'),_0x4ab998,_0xe4b1('0x1c'));logger[_0xe4b1('0x1d')](_0xe4b1('0x1e'),_0x4ab998,_0xe4b1('0x1c'),JSON[_0xe4b1('0x1f')](_0x440186));if(_0x440186['error']){if(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x21')]===0x1f4){logger[_0xe4b1('0x20')](_0xe4b1('0x1b'),_0x4ab998,_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);return _0x5cabe6(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);}logger['error'](_0xe4b1('0x1b'),_0x4ab998,_0x440186['error']['message']);return _0x3f512a(_0x440186[_0xe4b1('0x20')][_0xe4b1('0x22')]);}else{logger[_0xe4b1('0x1a')](_0xe4b1('0x1b'),_0x4ab998,_0xe4b1('0x1c'));_0x3f512a(_0x440186[_0xe4b1('0x23')][_0xe4b1('0x22')]);}})['catch'](function(_0x3c5e55){logger[_0xe4b1('0x20')](_0xe4b1('0x1b'),_0x4ab998,_0x3c5e55);_0x5cabe6(_0x3c5e55);});});}function respondWithStatusCode(_0x3da249,_0x5d1f07){_0x5d1f07=_0x5d1f07||0xcc;return function(_0x447a42){if(_0x447a42){return _0x3da249[_0xe4b1('0x24')](_0x5d1f07);}return _0x3da249['status'](_0x5d1f07)[_0xe4b1('0x25')]();};}function respondWithResult(_0x2bbee8,_0x1a83b8){_0x1a83b8=_0x1a83b8||0xc8;return function(_0x13e369){if(_0x13e369){return _0x2bbee8['status'](_0x1a83b8)['json'](_0x13e369);}};}function respondWithFilteredResult(_0x46f366,_0x279ca1){return function(_0x40a429){if(_0x40a429){var _0x40e1f7=_0x40a429[_0xe4b1('0x26')],_0x2f0e00=_0x279ca1[_0xe4b1('0x27')],_0x594d04=_0x279ca1[_0xe4b1('0x27')]+_0x279ca1['limit'],_0x957603;if(_0x594d04>=_0x40e1f7){_0x594d04=_0x40e1f7;_0x957603=0xc8;}else{_0x957603=0xce;}_0x46f366[_0xe4b1('0x28')](_0x957603);return _0x46f366['set']('Content-Range',_0x2f0e00+'-'+_0x594d04+'/'+_0x40e1f7)['json'](_0x40a429);}return null;};}function patchUpdates(_0x2f7d54){return function(_0xa357d7){try{jsonpatch[_0xe4b1('0x29')](_0xa357d7,_0x2f7d54,!![]);}catch(_0x4fb64b){return BPromise[_0xe4b1('0x2a')](_0x4fb64b);}return _0xa357d7[_0xe4b1('0x2b')]();};}function saveUpdates(_0x46a32d,_0xb0ba86){return function(_0x34e297){if(_0x34e297){return _0x34e297[_0xe4b1('0x2c')](_0x46a32d)[_0xe4b1('0x2d')](function(_0x2cc247){return _0x2cc247;});}return null;};}function removeEntity(_0x5e786a,_0x5c26ca){return function(_0x59f130){if(_0x59f130){return _0x59f130['destroy']()[_0xe4b1('0x2d')](function(){_0x5e786a[_0xe4b1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74de16,_0x3eda85){return function(_0xc5b9ea){if(!_0xc5b9ea){_0x74de16[_0xe4b1('0x24')](0x194);}return _0xc5b9ea;};}function handleError(_0x653bd5,_0x5c0112){_0x5c0112=_0x5c0112||0x1f4;return function(_0x441d45){logger[_0xe4b1('0x20')](_0x441d45[_0xe4b1('0x2e')]);if(_0x441d45[_0xe4b1('0x2f')]){delete _0x441d45[_0xe4b1('0x2f')];}_0x653bd5[_0xe4b1('0x28')](_0x5c0112)[_0xe4b1('0x30')](_0x441d45);};}exports[_0xe4b1('0x31')]=function(_0xee58c3,_0x2711d5){var _0x2fdadc={},_0x34874a={},_0x29daa6={'count':0x0,'rows':[]};var _0x47111d=_[_0xe4b1('0x32')](db[_0xe4b1('0x33')]['rawAttributes'],function(_0xbdabc8){return{'name':_0xbdabc8['fieldName'],'type':_0xbdabc8[_0xe4b1('0x34')][_0xe4b1('0x35')]};});_0x34874a[_0xe4b1('0x36')]=_['map'](_0x47111d,'name');_0x34874a[_0xe4b1('0x37')]=_['keys'](_0xee58c3[_0xe4b1('0x37')]);_0x34874a[_0xe4b1('0x38')]=_[_0xe4b1('0x39')](_0x34874a[_0xe4b1('0x36')],_0x34874a[_0xe4b1('0x37')]);_0x2fdadc[_0xe4b1('0x3a')]=_['intersection'](_0x34874a[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x3b')]));_0x2fdadc[_0xe4b1('0x3a')]=_0x2fdadc[_0xe4b1('0x3a')][_0xe4b1('0x3c')]?_0x2fdadc[_0xe4b1('0x3a')]:_0x34874a[_0xe4b1('0x36')];if(!_0xee58c3[_0xe4b1('0x37')]['hasOwnProperty'](_0xe4b1('0x3d'))){_0x2fdadc[_0xe4b1('0x3e')]=qs[_0xe4b1('0x3e')](_0xee58c3[_0xe4b1('0x37')]['limit']);_0x2fdadc['offset']=qs['offset'](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x27')]);}_0x2fdadc['order']=qs['sort'](_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x3f')]);_0x2fdadc[_0xe4b1('0x40')]=qs[_0xe4b1('0x38')](_[_0xe4b1('0x41')](_0xee58c3[_0xe4b1('0x37')],_0x34874a[_0xe4b1('0x38')]),_0x47111d);if(_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x42')]){_0x2fdadc[_0xe4b1('0x40')]=_[_0xe4b1('0x43')](_0x2fdadc[_0xe4b1('0x40')],{'$or':_[_0xe4b1('0x32')](_0x47111d,function(_0x27e116){if(_0x27e116[_0xe4b1('0x34')]!==_0xe4b1('0x44')){var _0x4231eb={};_0x4231eb[_0x27e116[_0xe4b1('0x2f')]]={'$like':'%'+_0xee58c3['query'][_0xe4b1('0x42')]+'%'};return _0x4231eb;}})});}_0x2fdadc=_[_0xe4b1('0x43')]({},_0x2fdadc,_0xee58c3[_0xe4b1('0x45')]);var _0x3591b8={'where':_0x2fdadc[_0xe4b1('0x40')]};return db[_0xe4b1('0x33')][_0xe4b1('0x26')](_0x3591b8)['then'](function(_0x5d7975){_0x29daa6[_0xe4b1('0x26')]=_0x5d7975;if(_0xee58c3[_0xe4b1('0x37')][_0xe4b1('0x46')]){_0x2fdadc[_0xe4b1('0x47')]=[{'all':!![]}];}return db[_0xe4b1('0x33')]['findAll'](_0x2fdadc);})[_0xe4b1('0x2d')](function(_0x2de38f){_0x29daa6[_0xe4b1('0x48')]=_0x2de38f;return _0x29daa6;})['then'](respondWithFilteredResult(_0x2711d5,_0x2fdadc))[_0xe4b1('0x49')](handleError(_0x2711d5,null));};exports[_0xe4b1('0x4a')]=function(_0x1affec,_0x333453){var _0xefbb0f={'raw':![],'where':{'id':_0x1affec[_0xe4b1('0x4b')]['id']}},_0x40a08b={};_0x40a08b['model']=_[_0xe4b1('0x4c')](db[_0xe4b1('0x33')][_0xe4b1('0x4d')]);_0x40a08b[_0xe4b1('0x37')]=_['keys'](_0x1affec[_0xe4b1('0x37')]);_0x40a08b[_0xe4b1('0x38')]=_['intersection'](_0x40a08b[_0xe4b1('0x36')],_0x40a08b[_0xe4b1('0x37')]);_0xefbb0f[_0xe4b1('0x3a')]=_['intersection'](_0x40a08b[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0x1affec['query'][_0xe4b1('0x3b')]));_0xefbb0f['attributes']=_0xefbb0f[_0xe4b1('0x3a')]['length']?_0xefbb0f[_0xe4b1('0x3a')]:_0x40a08b[_0xe4b1('0x36')];if(_0x1affec[_0xe4b1('0x37')][_0xe4b1('0x46')]){_0xefbb0f[_0xe4b1('0x47')]=[{'all':!![]}];}_0xefbb0f=_[_0xe4b1('0x43')]({},_0xefbb0f,_0x1affec[_0xe4b1('0x45')]);return db[_0xe4b1('0x33')][_0xe4b1('0x4e')](_0xefbb0f)[_0xe4b1('0x2d')](handleEntityNotFound(_0x333453,null))[_0xe4b1('0x2d')](respondWithResult(_0x333453,null))[_0xe4b1('0x49')](handleError(_0x333453,null));};exports[_0xe4b1('0x4f')]=function(_0x4096ce,_0x5db998){return db[_0xe4b1('0x33')][_0xe4b1('0x4f')](_0x4096ce[_0xe4b1('0x50')],{})[_0xe4b1('0x2d')](respondWithResult(_0x5db998,0xc9))[_0xe4b1('0x49')](handleError(_0x5db998,null));};exports[_0xe4b1('0x2c')]=function(_0x11aa92,_0x211efd){if(_0x11aa92['body']['id']){delete _0x11aa92['body']['id'];}return db['VtigerAccount'][_0xe4b1('0x4e')]({'where':{'id':_0x11aa92['params']['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x211efd,null))[_0xe4b1('0x2d')](saveUpdates(_0x11aa92[_0xe4b1('0x50')],null))['then'](respondWithResult(_0x211efd,null))[_0xe4b1('0x49')](handleError(_0x211efd,null));};exports['destroy']=function(_0x2e1e21,_0x256a3d){return db[_0xe4b1('0x33')]['find']({'where':{'id':_0x2e1e21[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x256a3d,null))['then'](removeEntity(_0x256a3d,null))[_0xe4b1('0x49')](handleError(_0x256a3d,null));};exports[_0xe4b1('0x51')]=function(_0xf1bb7b,_0x2e2b1e,_0x1ef3cc){var _0xccb282={};var _0x55a728={};var _0x168bc5;var _0x1a3e42;return db[_0xe4b1('0x33')][_0xe4b1('0x52')]({'where':{'id':_0xf1bb7b[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x2e2b1e,null))[_0xe4b1('0x2d')](function(_0x405682){if(_0x405682){_0x168bc5=_0x405682;_0x55a728[_0xe4b1('0x36')]=_[_0xe4b1('0x4c')](db[_0xe4b1('0x53')][_0xe4b1('0x4d')]);_0x55a728[_0xe4b1('0x37')]=_[_0xe4b1('0x4c')](_0xf1bb7b[_0xe4b1('0x37')]);_0x55a728[_0xe4b1('0x38')]=_[_0xe4b1('0x39')](_0x55a728['model'],_0x55a728['query']);_0xccb282[_0xe4b1('0x3a')]=_[_0xe4b1('0x39')](_0x55a728[_0xe4b1('0x36')],qs[_0xe4b1('0x3b')](_0xf1bb7b[_0xe4b1('0x37')]['fields']));_0xccb282['attributes']=_0xccb282[_0xe4b1('0x3a')][_0xe4b1('0x3c')]?_0xccb282[_0xe4b1('0x3a')]:_0x55a728[_0xe4b1('0x36')];_0xccb282[_0xe4b1('0x54')]=qs['sort'](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x3f')]);_0xccb282[_0xe4b1('0x40')]=qs[_0xe4b1('0x38')](_[_0xe4b1('0x41')](_0xf1bb7b[_0xe4b1('0x37')],_0x55a728['filters']));if(_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x42')]){_0xccb282['where']=_[_0xe4b1('0x43')](_0xccb282[_0xe4b1('0x40')],{'$or':_[_0xe4b1('0x32')](_0xccb282[_0xe4b1('0x3a')],function(_0x5cc0e6){var _0x4b3de7={};_0x4b3de7[_0x5cc0e6]={'$like':'%'+_0xf1bb7b['query'][_0xe4b1('0x42')]+'%'};return _0x4b3de7;})});}_0xccb282=_[_0xe4b1('0x43')]({},_0xccb282,_0xf1bb7b[_0xe4b1('0x45')]);return _0x168bc5[_0xe4b1('0x51')](_0xccb282);}})['then'](function(_0x4398d7){if(_0x4398d7){_0x1a3e42=_0x4398d7['length'];if(!_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x55')]('nolimit')){_0xccb282['limit']=qs[_0xe4b1('0x3e')](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x3e')]);_0xccb282[_0xe4b1('0x27')]=qs[_0xe4b1('0x27')](_0xf1bb7b[_0xe4b1('0x37')][_0xe4b1('0x27')]);}return _0x168bc5[_0xe4b1('0x51')](_0xccb282);}})[_0xe4b1('0x2d')](function(_0x14b7a0){if(_0x14b7a0){return _0x14b7a0?{'count':_0x1a3e42,'rows':_0x14b7a0}:null;}})[_0xe4b1('0x2d')](respondWithResult(_0x2e2b1e,null))[_0xe4b1('0x49')](handleError(_0x2e2b1e,null));};exports[_0xe4b1('0x56')]=function(_0x5f17e9,_0x9dc12c,_0xc83d32){if(_0x5f17e9[_0xe4b1('0x50')]['id']){delete _0x5f17e9[_0xe4b1('0x50')]['id'];}return db[_0xe4b1('0x33')]['findOne']({'where':{'id':_0x5f17e9[_0xe4b1('0x4b')]['id']}})[_0xe4b1('0x2d')](handleEntityNotFound(_0x9dc12c,null))['then'](function(_0x14ec28){if(_0x14ec28){_0x5f17e9[_0xe4b1('0x50')]['AccountId']=_0x14ec28['id'];_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x57')]=integrations[_0xe4b1('0x58')](_0x5f17e9['body'][_0xe4b1('0x59')],_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x34')]);_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x5a')]=integrations[_0xe4b1('0x5b')](_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x59')],_0x5f17e9[_0xe4b1('0x50')][_0xe4b1('0x34')]);return db[_0xe4b1('0x53')]['create'](_0x5f17e9['body'],{'include':[{'model':db[_0xe4b1('0x5c')],'as':_0xe4b1('0x57')},{'model':db[_0xe4b1('0x5c')],'as':_0xe4b1('0x5a')}]});}return null;})[_0xe4b1('0x2d')](respondWithResult(_0x9dc12c,null))[_0xe4b1('0x49')](handleError(_0x9dc12c,null));};var md5=require(_0xe4b1('0x5d'));exports[_0xe4b1('0x5e')]=function(_0x2cf974,_0x2c6496,_0x285d7a){var _0x381ac6=null;var _0x328db3=null;var _0x438dda=null;var _0x4fd06a=null;var _0x1ca35e='';return db[_0xe4b1('0x33')]['findOne']({'where':{'id':_0x2cf974[_0xe4b1('0x4b')]['id']},'attributes':['id',_0xe4b1('0x2f'),_0xe4b1('0x5f'),_0xe4b1('0x60'),'moduleName',_0xe4b1('0x61'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x2c6496,null))[_0xe4b1('0x2d')](function(_0x365698){if(_0x365698){_0x381ac6=_0x365698[_0xe4b1('0x5f')];_0x328db3=_0x365698[_0xe4b1('0x62')];_0x438dda=_0x365698[_0xe4b1('0x63')];_0x1ca35e=_0x365698[_0xe4b1('0x61')];var _0x2251a3=_0x1ca35e[_0xe4b1('0x64')](-0x1);if(_0x2251a3==='/'){_0x1ca35e=_0x1ca35e[_0xe4b1('0x65')](0x0,_0x1ca35e[_0xe4b1('0x66')](_0x2251a3));}_0x4fd06a=util[_0xe4b1('0x67')](_0xe4b1('0x68'),_0x1ca35e);var _0x54ddf5={'method':_0xe4b1('0x69'),'uri':_0x4fd06a,'qs':{'operation':_0xe4b1('0x6a'),'username':_0x365698[_0xe4b1('0x5f')]},'json':!![]};return rp(_0x54ddf5);}})['then'](function(_0x5538a8){if(_0x5538a8[_0xe4b1('0x6b')]){var _0x1ced6b={'method':_0xe4b1('0x6c'),'uri':_0x4fd06a,'form':{'operation':_0xe4b1('0x6d'),'username':_0x381ac6,'accessKey':md5(_0x5538a8[_0xe4b1('0x23')][_0xe4b1('0x6e')]+_0x328db3)},'json':!![]};return rp(_0x1ced6b);}})[_0xe4b1('0x2d')](function(_0x2c670a){if(_0x2c670a['success']){var _0x2d0f3f={'method':_0xe4b1('0x69'),'uri':_0x4fd06a,'qs':{'operation':_0xe4b1('0x6f'),'username':_0x381ac6,'sessionName':_0x2c670a['result'][_0xe4b1('0x70')],'elementType':_0x438dda},'json':!![]};return rp(_0x2d0f3f);}})[_0xe4b1('0x2d')](function(_0x2b911a){if(_0x2b911a[_0xe4b1('0x6b')]){var _0xa82aa6=['autogenerated',_0xe4b1('0x71'),_0xe4b1('0x72')];_[_0xe4b1('0x73')](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0xbeb077){return _0xa82aa6[_0xe4b1('0x74')](_0xbeb077[_0xe4b1('0x34')][_0xe4b1('0x2f')]);});_['remove'](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0x5d6f8c){return _0x5d6f8c['editable']===_0xe4b1('0x75');});return{'count':_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')][_0xe4b1('0x3c')],'rows':_['map'](_0x2b911a[_0xe4b1('0x23')][_0xe4b1('0x3b')],function(_0x117801){return{'id':_0x117801[_0xe4b1('0x2f')],'name':_0x117801['label'],'custom':_[_0xe4b1('0x76')](_0x117801[_0xe4b1('0x2f')],_0xe4b1('0x77'))?!![]:![],'options':_0x117801[_0xe4b1('0x34')][_0xe4b1('0x2f')]==='picklist'&&_0x117801['type'][_0xe4b1('0x78')][_0xe4b1('0x3c')]>0x0?_[_0xe4b1('0x32')](_0x117801['type'][_0xe4b1('0x78')],function(_0x4ce52a){return{'name':_0x4ce52a[_0xe4b1('0x79')],'value':_0x4ce52a[_0xe4b1('0x7a')]};}):[]};})};}})[_0xe4b1('0x2d')](respondWithResult(_0x2c6496,null))[_0xe4b1('0x49')](function(_0x7d51e2){console[_0xe4b1('0x7b')](_0xe4b1('0x7c')+_0x7d51e2);var _0x40b407=_0x2cf974[_0xe4b1('0x37')][_0xe4b1('0x7d')]?0x1f4:_0x7d51e2['statusCode']||0x1f4;logger[_0xe4b1('0x20')](_0xe4b1('0x7e'),'getFields',_0x40b407,JSON['stringify'](_0x7d51e2));delete _0x7d51e2[_0xe4b1('0x2f')];if(_0x40b407===0x191){_0x40b407=0x190;}_0x2c6496['status'](_0x40b407)[_0xe4b1('0x30')](_0x2cf974[_0xe4b1('0x37')]['test']?{'message':_0xe4b1('0x7f'),'statusCode':_0x7d51e2['statusCode']}:_0x7d51e2);});}; \ No newline at end of file +var _0x9116=['describe','sessionName','reference','owner','includes','editable','false','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','json','apply','reject','destroy','end','sendStatus','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success'];(function(_0x1afa29,_0x7118bc){var _0x5e68bf=function(_0x400927){while(--_0x400927){_0x1afa29['push'](_0x1afa29['shift']());}};_0x5e68bf(++_0x7118bc);}(_0x9116,0x111));var _0x6911=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x9116[_0x51fe5f];return _0x4abce9;};'use strict';var pdf=require(_0x6911('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6911('0x1'));var zipdir=require(_0x6911('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6911('0x3'));var moment=require('moment');var BPromise=require(_0x6911('0x4'));var Mustache=require('mustache');var util=require(_0x6911('0x5'));var path=require(_0x6911('0x6'));var sox=require(_0x6911('0x7'));var csv=require(_0x6911('0x8'));var ejs=require(_0x6911('0x9'));var fs=require('fs');var _=require(_0x6911('0xa'));var squel=require(_0x6911('0xb'));var crypto=require(_0x6911('0xc'));var jsforce=require(_0x6911('0xd'));var deskjs=require(_0x6911('0xe'));var toCsv=require(_0x6911('0x8'));var querystring=require(_0x6911('0xf'));var Papa=require(_0x6911('0x10'));var Redis=require(_0x6911('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6911('0x12'));var as=require(_0x6911('0x13'));var hardwareService=require(_0x6911('0x14'));var logger=require(_0x6911('0x15'))(_0x6911('0x16'));var utils=require(_0x6911('0x17'));var config=require(_0x6911('0x18'));var licenseUtil=require(_0x6911('0x19'));var db=require(_0x6911('0x1a'))['db'];var integrations=require(_0x6911('0x1b'));var jayson=require(_0x6911('0x1c'));var client=jayson[_0x6911('0x1d')][_0x6911('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x59d4f8,_0x14ac12,_0x2e7ca3,_0xb69e26){return new BPromise(function(_0x44a440,_0x112e2f){var _0x2782e9=_0xb69e26||client;return _0x2782e9[_0x6911('0x1f')](_0x59d4f8,_0x2e7ca3)[_0x6911('0x20')](function(_0x54a0e7){logger[_0x6911('0x21')](_0x6911('0x22'),_0x14ac12,_0x6911('0x23'));logger['debug'](_0x6911('0x24'),_0x14ac12,_0x6911('0x23'),JSON[_0x6911('0x25')](_0x54a0e7));if(_0x54a0e7[_0x6911('0x26')]){if(_0x54a0e7[_0x6911('0x26')][_0x6911('0x27')]===0x1f4){logger['error'](_0x6911('0x22'),_0x14ac12,_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);return _0x112e2f(_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);}logger[_0x6911('0x26')](_0x6911('0x22'),_0x14ac12,_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);return _0x44a440(_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);}else{logger[_0x6911('0x21')](_0x6911('0x22'),_0x14ac12,_0x6911('0x23'));_0x44a440(_0x54a0e7[_0x6911('0x29')][_0x6911('0x28')]);}})[_0x6911('0x2a')](function(_0x579f43){logger[_0x6911('0x26')](_0x6911('0x22'),_0x14ac12,_0x579f43);_0x112e2f(_0x579f43);});});}function respondWithStatusCode(_0x5a76de,_0x46c4fc){_0x46c4fc=_0x46c4fc||0xcc;return function(_0x4db68a){if(_0x4db68a){return _0x5a76de['sendStatus'](_0x46c4fc);}return _0x5a76de['status'](_0x46c4fc)['end']();};}function respondWithResult(_0x50f721,_0x45852f){_0x45852f=_0x45852f||0xc8;return function(_0xd037b7){if(_0xd037b7){return _0x50f721[_0x6911('0x2b')](_0x45852f)['json'](_0xd037b7);}};}function respondWithFilteredResult(_0x661c53,_0x437640){return function(_0x57e2d6){if(_0x57e2d6){var _0x155ad4=_0x57e2d6['count'],_0x5a0112=_0x437640['offset'],_0x3f06bd=_0x437640[_0x6911('0x2c')]+_0x437640[_0x6911('0x2d')],_0x20c81a;if(_0x3f06bd>=_0x155ad4){_0x3f06bd=_0x155ad4;_0x20c81a=0xc8;}else{_0x20c81a=0xce;}_0x661c53['status'](_0x20c81a);return _0x661c53[_0x6911('0x2e')](_0x6911('0x2f'),_0x5a0112+'-'+_0x3f06bd+'/'+_0x155ad4)[_0x6911('0x30')](_0x57e2d6);}return null;};}function patchUpdates(_0x478d3f){return function(_0x29d85d){try{jsonpatch[_0x6911('0x31')](_0x29d85d,_0x478d3f,!![]);}catch(_0x597adb){return BPromise[_0x6911('0x32')](_0x597adb);}return _0x29d85d['save']();};}function saveUpdates(_0x47a13c,_0x3c18ff){return function(_0x33505b){if(_0x33505b){return _0x33505b['update'](_0x47a13c)[_0x6911('0x20')](function(_0x1f96cc){return _0x1f96cc;});}return null;};}function removeEntity(_0x1c2a15,_0x117465){return function(_0xc6216d){if(_0xc6216d){return _0xc6216d[_0x6911('0x33')]()[_0x6911('0x20')](function(){_0x1c2a15['status'](0xcc)[_0x6911('0x34')]();});}};}function handleEntityNotFound(_0x38be07,_0x4224e7){return function(_0x11981d){if(!_0x11981d){_0x38be07[_0x6911('0x35')](0x194);}return _0x11981d;};}function handleError(_0x100616,_0x196b3e){_0x196b3e=_0x196b3e||0x1f4;return function(_0x34bc3e){logger[_0x6911('0x26')](_0x34bc3e[_0x6911('0x36')]);if(_0x34bc3e[_0x6911('0x37')]){delete _0x34bc3e[_0x6911('0x37')];}_0x100616[_0x6911('0x2b')](_0x196b3e)[_0x6911('0x38')](_0x34bc3e);};}exports['index']=function(_0x2d27e2,_0x27c3d2){var _0x56a5a6={},_0x215ad2={},_0x2f6953={'count':0x0,'rows':[]};var _0x1355be=_[_0x6911('0x39')](db[_0x6911('0x3a')][_0x6911('0x3b')],function(_0x1f2c2e){return{'name':_0x1f2c2e[_0x6911('0x3c')],'type':_0x1f2c2e[_0x6911('0x3d')]['key']};});_0x215ad2[_0x6911('0x3e')]=_[_0x6911('0x39')](_0x1355be,_0x6911('0x37'));_0x215ad2[_0x6911('0x3f')]=_[_0x6911('0x40')](_0x2d27e2[_0x6911('0x3f')]);_0x215ad2[_0x6911('0x41')]=_[_0x6911('0x42')](_0x215ad2[_0x6911('0x3e')],_0x215ad2['query']);_0x56a5a6['attributes']=_[_0x6911('0x42')](_0x215ad2[_0x6911('0x3e')],qs[_0x6911('0x43')](_0x2d27e2[_0x6911('0x3f')]['fields']));_0x56a5a6[_0x6911('0x44')]=_0x56a5a6[_0x6911('0x44')][_0x6911('0x45')]?_0x56a5a6[_0x6911('0x44')]:_0x215ad2[_0x6911('0x3e')];if(!_0x2d27e2[_0x6911('0x3f')][_0x6911('0x46')]('nolimit')){_0x56a5a6[_0x6911('0x2d')]=qs[_0x6911('0x2d')](_0x2d27e2['query'][_0x6911('0x2d')]);_0x56a5a6[_0x6911('0x2c')]=qs['offset'](_0x2d27e2[_0x6911('0x3f')]['offset']);}_0x56a5a6['order']=qs['sort'](_0x2d27e2[_0x6911('0x3f')][_0x6911('0x47')]);_0x56a5a6['where']=qs[_0x6911('0x41')](_[_0x6911('0x48')](_0x2d27e2['query'],_0x215ad2[_0x6911('0x41')]),_0x1355be);if(_0x2d27e2[_0x6911('0x3f')][_0x6911('0x49')]){_0x56a5a6[_0x6911('0x4a')]=_['merge'](_0x56a5a6[_0x6911('0x4a')],{'$or':_[_0x6911('0x39')](_0x1355be,function(_0x20be29){if(_0x20be29['type']!==_0x6911('0x4b')){var _0x3285fa={};_0x3285fa[_0x20be29[_0x6911('0x37')]]={'$like':'%'+_0x2d27e2[_0x6911('0x3f')][_0x6911('0x49')]+'%'};return _0x3285fa;}})});}_0x56a5a6=_['merge']({},_0x56a5a6,_0x2d27e2[_0x6911('0x4c')]);var _0x3bbc4b={'where':_0x56a5a6['where']};return db[_0x6911('0x3a')]['count'](_0x3bbc4b)[_0x6911('0x20')](function(_0x4617b6){_0x2f6953['count']=_0x4617b6;if(_0x2d27e2[_0x6911('0x3f')][_0x6911('0x4d')]){_0x56a5a6[_0x6911('0x4e')]=[{'all':!![]}];}return db[_0x6911('0x3a')]['findAll'](_0x56a5a6);})[_0x6911('0x20')](function(_0x5bcfe6){_0x2f6953[_0x6911('0x4f')]=_0x5bcfe6;return _0x2f6953;})['then'](respondWithFilteredResult(_0x27c3d2,_0x56a5a6))[_0x6911('0x2a')](handleError(_0x27c3d2,null));};exports[_0x6911('0x50')]=function(_0x139f60,_0x54a3c7){var _0x4b3b4b={'raw':![],'where':{'id':_0x139f60[_0x6911('0x51')]['id']}},_0x2e72f8={};_0x2e72f8['model']=_[_0x6911('0x40')](db[_0x6911('0x3a')][_0x6911('0x3b')]);_0x2e72f8[_0x6911('0x3f')]=_[_0x6911('0x40')](_0x139f60['query']);_0x2e72f8[_0x6911('0x41')]=_[_0x6911('0x42')](_0x2e72f8['model'],_0x2e72f8['query']);_0x4b3b4b[_0x6911('0x44')]=_['intersection'](_0x2e72f8[_0x6911('0x3e')],qs[_0x6911('0x43')](_0x139f60[_0x6911('0x3f')][_0x6911('0x43')]));_0x4b3b4b[_0x6911('0x44')]=_0x4b3b4b[_0x6911('0x44')][_0x6911('0x45')]?_0x4b3b4b['attributes']:_0x2e72f8[_0x6911('0x3e')];if(_0x139f60[_0x6911('0x3f')][_0x6911('0x4d')]){_0x4b3b4b[_0x6911('0x4e')]=[{'all':!![]}];}_0x4b3b4b=_[_0x6911('0x52')]({},_0x4b3b4b,_0x139f60[_0x6911('0x4c')]);return db[_0x6911('0x3a')][_0x6911('0x53')](_0x4b3b4b)[_0x6911('0x20')](handleEntityNotFound(_0x54a3c7,null))[_0x6911('0x20')](respondWithResult(_0x54a3c7,null))[_0x6911('0x2a')](handleError(_0x54a3c7,null));};exports[_0x6911('0x54')]=function(_0x25dab9,_0x4e55fb){return db[_0x6911('0x3a')][_0x6911('0x54')](_0x25dab9['body'],{})[_0x6911('0x20')](respondWithResult(_0x4e55fb,0xc9))[_0x6911('0x2a')](handleError(_0x4e55fb,null));};exports[_0x6911('0x55')]=function(_0x274e88,_0x54e98c){if(_0x274e88['body']['id']){delete _0x274e88[_0x6911('0x56')]['id'];}return db[_0x6911('0x3a')]['find']({'where':{'id':_0x274e88[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x54e98c,null))['then'](saveUpdates(_0x274e88[_0x6911('0x56')],null))['then'](respondWithResult(_0x54e98c,null))[_0x6911('0x2a')](handleError(_0x54e98c,null));};exports[_0x6911('0x33')]=function(_0x3111e0,_0x12d710){return db['VtigerAccount'][_0x6911('0x53')]({'where':{'id':_0x3111e0[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x12d710,null))[_0x6911('0x20')](removeEntity(_0x12d710,null))['catch'](handleError(_0x12d710,null));};exports[_0x6911('0x57')]=function(_0x20e2b4,_0x4b63e0,_0x44a2fe){var _0x467c44={};var _0x4fd25d={};var _0x2ae7ab;var _0x2af460;return db['VtigerAccount'][_0x6911('0x58')]({'where':{'id':_0x20e2b4[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x4b63e0,null))['then'](function(_0x5b39c1){if(_0x5b39c1){_0x2ae7ab=_0x5b39c1;_0x4fd25d['model']=_[_0x6911('0x40')](db[_0x6911('0x59')][_0x6911('0x3b')]);_0x4fd25d[_0x6911('0x3f')]=_['keys'](_0x20e2b4[_0x6911('0x3f')]);_0x4fd25d['filters']=_[_0x6911('0x42')](_0x4fd25d[_0x6911('0x3e')],_0x4fd25d['query']);_0x467c44[_0x6911('0x44')]=_[_0x6911('0x42')](_0x4fd25d['model'],qs[_0x6911('0x43')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x43')]));_0x467c44[_0x6911('0x44')]=_0x467c44[_0x6911('0x44')][_0x6911('0x45')]?_0x467c44[_0x6911('0x44')]:_0x4fd25d[_0x6911('0x3e')];_0x467c44[_0x6911('0x5a')]=qs[_0x6911('0x47')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x47')]);_0x467c44[_0x6911('0x4a')]=qs[_0x6911('0x41')](_['pick'](_0x20e2b4[_0x6911('0x3f')],_0x4fd25d[_0x6911('0x41')]));if(_0x20e2b4[_0x6911('0x3f')][_0x6911('0x49')]){_0x467c44['where']=_[_0x6911('0x52')](_0x467c44['where'],{'$or':_[_0x6911('0x39')](_0x467c44[_0x6911('0x44')],function(_0x3bb708){var _0x18e519={};_0x18e519[_0x3bb708]={'$like':'%'+_0x20e2b4[_0x6911('0x3f')][_0x6911('0x49')]+'%'};return _0x18e519;})});}_0x467c44=_[_0x6911('0x52')]({},_0x467c44,_0x20e2b4['options']);return _0x2ae7ab[_0x6911('0x57')](_0x467c44);}})[_0x6911('0x20')](function(_0x235ae8){if(_0x235ae8){_0x2af460=_0x235ae8['length'];if(!_0x20e2b4[_0x6911('0x3f')][_0x6911('0x46')]('nolimit')){_0x467c44[_0x6911('0x2d')]=qs[_0x6911('0x2d')](_0x20e2b4['query'][_0x6911('0x2d')]);_0x467c44['offset']=qs[_0x6911('0x2c')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x2c')]);}return _0x2ae7ab['getConfigurations'](_0x467c44);}})['then'](function(_0x3ea917){if(_0x3ea917){return _0x3ea917?{'count':_0x2af460,'rows':_0x3ea917}:null;}})['then'](respondWithResult(_0x4b63e0,null))['catch'](handleError(_0x4b63e0,null));};exports['addConfiguration']=function(_0x443e05,_0x1981a,_0x20be06){if(_0x443e05[_0x6911('0x56')]['id']){delete _0x443e05[_0x6911('0x56')]['id'];}return db[_0x6911('0x3a')][_0x6911('0x58')]({'where':{'id':_0x443e05['params']['id']}})['then'](handleEntityNotFound(_0x1981a,null))[_0x6911('0x20')](function(_0x30d8d4){if(_0x30d8d4){_0x443e05[_0x6911('0x56')][_0x6911('0x5b')]=_0x30d8d4['id'];_0x443e05[_0x6911('0x56')][_0x6911('0x5c')]=integrations[_0x6911('0x5d')](_0x443e05[_0x6911('0x56')]['channel'],_0x443e05[_0x6911('0x56')][_0x6911('0x3d')]);_0x443e05[_0x6911('0x56')][_0x6911('0x5e')]=integrations[_0x6911('0x5f')](_0x443e05['body']['channel'],_0x443e05['body']['type']);return db['VtigerConfiguration'][_0x6911('0x54')](_0x443e05[_0x6911('0x56')],{'include':[{'model':db[_0x6911('0x60')],'as':_0x6911('0x5c')},{'model':db[_0x6911('0x60')],'as':'Descriptions'}]});}return null;})[_0x6911('0x20')](respondWithResult(_0x1981a,null))['catch'](handleError(_0x1981a,null));};var md5=require('md5');exports[_0x6911('0x61')]=function(_0x4e44c5,_0x473709,_0x38db24){var _0x3b214d=null;var _0x53cd59=null;var _0x219fed=null;var _0x19e5e0=null;var _0x18fa98='';return db[_0x6911('0x3a')]['findOne']({'where':{'id':_0x4e44c5[_0x6911('0x51')]['id']},'attributes':['id',_0x6911('0x37'),_0x6911('0x62'),_0x6911('0x63'),'moduleName',_0x6911('0x64'),_0x6911('0x65'),_0x6911('0x66')]})[_0x6911('0x20')](handleEntityNotFound(_0x473709,null))['then'](function(_0x33827c){if(_0x33827c){_0x3b214d=_0x33827c['username'];_0x53cd59=_0x33827c['accessKey'];_0x219fed=_0x33827c[_0x6911('0x67')];_0x18fa98=_0x33827c[_0x6911('0x64')];var _0x46e4cb=_0x18fa98[_0x6911('0x68')](-0x1);if(_0x46e4cb==='/'){_0x18fa98=_0x18fa98['substring'](0x0,_0x18fa98[_0x6911('0x69')](_0x46e4cb));}_0x19e5e0=util[_0x6911('0x6a')](_0x6911('0x6b'),_0x18fa98);var _0x4f89ce={'method':_0x6911('0x6c'),'uri':_0x19e5e0,'qs':{'operation':_0x6911('0x6d'),'username':_0x33827c['username']},'json':!![]};return rp(_0x4f89ce);}})[_0x6911('0x20')](function(_0x9984bf){if(_0x9984bf['success']){var _0x33b20b={'method':_0x6911('0x6e'),'uri':_0x19e5e0,'form':{'operation':_0x6911('0x6f'),'username':_0x3b214d,'accessKey':md5(_0x9984bf[_0x6911('0x29')][_0x6911('0x70')]+_0x53cd59)},'json':!![]};return rp(_0x33b20b);}})[_0x6911('0x20')](function(_0xa19023){if(_0xa19023[_0x6911('0x71')]){var _0x1499ac={'method':_0x6911('0x6c'),'uri':_0x19e5e0,'qs':{'operation':_0x6911('0x72'),'username':_0x3b214d,'sessionName':_0xa19023['result'][_0x6911('0x73')],'elementType':_0x219fed},'json':!![]};return rp(_0x1499ac);}})[_0x6911('0x20')](function(_0x5db353){if(_0x5db353['success']){var _0x3e035a=['autogenerated',_0x6911('0x74'),_0x6911('0x75')];_['remove'](_0x5db353[_0x6911('0x29')][_0x6911('0x43')],function(_0x3bc174){return _0x3e035a[_0x6911('0x76')](_0x3bc174[_0x6911('0x3d')][_0x6911('0x37')]);});_['remove'](_0x5db353['result']['fields'],function(_0x26ca8a){return _0x26ca8a[_0x6911('0x77')]===_0x6911('0x78');});return{'count':_0x5db353[_0x6911('0x29')][_0x6911('0x43')]['length'],'rows':_[_0x6911('0x39')](_0x5db353[_0x6911('0x29')][_0x6911('0x43')],function(_0xb60d61){return{'id':_0xb60d61['name'],'name':_0xb60d61['label'],'custom':_['startsWith'](_0xb60d61[_0x6911('0x37')],_0x6911('0x79'))?!![]:![],'options':_0xb60d61[_0x6911('0x3d')][_0x6911('0x37')]===_0x6911('0x7a')&&_0xb60d61['type'][_0x6911('0x7b')]['length']>0x0?_['map'](_0xb60d61[_0x6911('0x3d')][_0x6911('0x7b')],function(_0x357712){return{'name':_0x357712[_0x6911('0x7c')],'value':_0x357712['value']};}):[]};})};}})[_0x6911('0x20')](respondWithResult(_0x473709,null))[_0x6911('0x2a')](function(_0x3aeae2){console['log'](_0x6911('0x7d')+_0x3aeae2);var _0x580e50=_0x4e44c5[_0x6911('0x3f')][_0x6911('0x7e')]?0x1f4:_0x3aeae2['statusCode']||0x1f4;logger[_0x6911('0x26')](_0x6911('0x7f'),_0x6911('0x61'),_0x580e50,JSON[_0x6911('0x25')](_0x3aeae2));delete _0x3aeae2['name'];if(_0x580e50===0x191){_0x580e50=0x190;}_0x473709['status'](_0x580e50)[_0x6911('0x38')](_0x4e44c5[_0x6911('0x3f')][_0x6911('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x3aeae2[_0x6911('0x80')]}:_0x3aeae2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 82a2bfa..3d93031 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 _0x7697=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration'];(function(_0xec7fa,_0x3d0aa2){var _0x2586c4=function(_0x476f2c){while(--_0x476f2c){_0xec7fa['push'](_0xec7fa['shift']());}};_0x2586c4(++_0x3d0aa2);}(_0x7697,0x1a4));var _0x7769=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x7697[_0x4206f5];return _0xa29cf3;};'use strict';var _=require(_0x7769('0x0'));var util=require('util');var logger=require(_0x7769('0x1'))(_0x7769('0x2'));var moment=require(_0x7769('0x3'));var BPromise=require(_0x7769('0x4'));var rp=require(_0x7769('0x5'));var fs=require('fs');var path=require(_0x7769('0x6'));var rimraf=require('rimraf');var config=require(_0x7769('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7769('0x8'));module[_0x7769('0x9')]=function(_0x5081d4,_0x5da26d){return _0x5081d4[_0x7769('0xa')](_0x7769('0xb'),attributes,{'tableName':_0x7769('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5408=['../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intVtigerAccount.attributes'];(function(_0x5d5d04,_0x47315c){var _0x2d959f=function(_0x4e95e7){while(--_0x4e95e7){_0x5d5d04['push'](_0x5d5d04['shift']());}};_0x2d959f(++_0x47315c);}(_0x5408,0x121));var _0x8540=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x5408[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x8540('0x0'));var util=require(_0x8540('0x1'));var logger=require(_0x8540('0x2'))(_0x8540('0x3'));var moment=require('moment');var BPromise=require(_0x8540('0x4'));var rp=require(_0x8540('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8540('0x6'));var config=require('../../config/environment');var attributes=require(_0x8540('0x7'));var integrations=require(_0x8540('0x8'));module['exports']=function(_0x3a86a8,_0x2a959e){return _0x3a86a8['define'](_0x8540('0x9'),attributes,{'tableName':_0x8540('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6c86fe6..8056ab7 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 _0x1076=['GetVtigerAccount','VtigerAccount','options','where','attributes','limit','include','map','model','debug','ShowVtigerAccount','raw','info','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x1076,0x126));var _0x6107=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x1076[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x6107('0x0'));var moment=require(_0x6107('0x1'));var BPromise=require(_0x6107('0x2'));var rs=require(_0x6107('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6107('0x4'))['db'];var utils=require(_0x6107('0x5'));var logger=require(_0x6107('0x6'))('rpc');var config=require(_0x6107('0x7'));var jayson=require(_0x6107('0x8'));var client=jayson[_0x6107('0x9')][_0x6107('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569b67,_0x24b6ff,_0x4676e1){return new BPromise(function(_0x5704eb,_0x5e493f){return client[_0x6107('0xb')](_0x569b67,_0x4676e1)[_0x6107('0xc')](function(_0x1ee71a){logger['info'](_0x6107('0xd'),_0x24b6ff,_0x6107('0xe'));logger['debug'](_0x6107('0xf'),_0x24b6ff,_0x6107('0xe'),JSON['stringify'](_0x1ee71a));if(_0x1ee71a[_0x6107('0x10')]){if(_0x1ee71a['error'][_0x6107('0x11')]===0x1f4){logger[_0x6107('0x10')](_0x6107('0xd'),_0x24b6ff,_0x1ee71a[_0x6107('0x10')][_0x6107('0x12')]);return _0x5e493f(_0x1ee71a[_0x6107('0x10')][_0x6107('0x12')]);}logger[_0x6107('0x10')](_0x6107('0xd'),_0x24b6ff,_0x1ee71a['error']['message']);return _0x5704eb(_0x1ee71a['error'][_0x6107('0x12')]);}else{logger['info'](_0x6107('0xd'),_0x24b6ff,_0x6107('0xe'));_0x5704eb(_0x1ee71a[_0x6107('0x13')][_0x6107('0x12')]);}})[_0x6107('0x14')](function(_0x23193c){logger['error'](_0x6107('0xd'),_0x24b6ff,_0x23193c);_0x5e493f(_0x23193c);});});}exports[_0x6107('0x15')]=function(_0x16998a){var _0x26ff06=this;return new Promise(function(_0x3bdff2,_0x389cd4){return db[_0x6107('0x16')]['findAll']({'raw':_0x16998a[_0x6107('0x17')]?_0x16998a[_0x6107('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x16998a['options']?_0x16998a['options'][_0x6107('0x18')]||null:null,'attributes':_0x16998a[_0x6107('0x17')]?_0x16998a[_0x6107('0x17')][_0x6107('0x19')]||null:null,'limit':_0x16998a['options']?_0x16998a[_0x6107('0x17')][_0x6107('0x1a')]||null:null,'include':_0x16998a['options']?_0x16998a[_0x6107('0x17')][_0x6107('0x1b')]?_[_0x6107('0x1c')](_0x16998a['options'][_0x6107('0x1b')],function(_0x52c39d){return{'model':db[_0x52c39d[_0x6107('0x1d')]],'as':_0x52c39d['as'],'attributes':_0x52c39d['attributes'],'include':_0x52c39d['include']?_[_0x6107('0x1c')](_0x52c39d[_0x6107('0x1b')],function(_0x185e0c){return{'model':db[_0x185e0c['model']],'as':_0x185e0c['as'],'attributes':_0x185e0c[_0x6107('0x19')],'include':_0x185e0c[_0x6107('0x1b')]?_['map'](_0x185e0c['include'],function(_0x126114){return{'model':db[_0x126114['model']],'as':_0x126114['as'],'attributes':_0x126114['attributes']};}):[]};}):[]};}):[]:[]})[_0x6107('0xc')](function(_0x5233a7){logger['info'](_0x6107('0x15'),_0x16998a);logger[_0x6107('0x1e')](_0x6107('0x15'),_0x16998a,JSON['stringify'](_0x5233a7));_0x3bdff2(_0x5233a7);})[_0x6107('0x14')](function(_0x263d1f){logger['error'](_0x6107('0x15'),_0x263d1f['message'],_0x16998a);_0x389cd4(_0x26ff06[_0x6107('0x10')](0x1f4,_0x263d1f[_0x6107('0x12')]));});});};exports[_0x6107('0x1f')]=function(_0x5f4e40){var _0x2e4e8e=this;return new Promise(function(_0x42d583,_0x93ad0b){return db[_0x6107('0x16')]['find']({'raw':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40['options'][_0x6107('0x20')]===undefined?!![]:![]:!![],'where':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40[_0x6107('0x17')][_0x6107('0x18')]||null:null,'attributes':_0x5f4e40['options']?_0x5f4e40[_0x6107('0x17')][_0x6107('0x19')]||null:null,'include':_0x5f4e40[_0x6107('0x17')]?_0x5f4e40[_0x6107('0x17')]['include']?_[_0x6107('0x1c')](_0x5f4e40['options'][_0x6107('0x1b')],function(_0x28e7a1){return{'model':db[_0x28e7a1[_0x6107('0x1d')]],'as':_0x28e7a1['as'],'attributes':_0x28e7a1['attributes'],'include':_0x28e7a1[_0x6107('0x1b')]?_[_0x6107('0x1c')](_0x28e7a1[_0x6107('0x1b')],function(_0x513bcf){return{'model':db[_0x513bcf['model']],'as':_0x513bcf['as'],'attributes':_0x513bcf[_0x6107('0x19')],'include':_0x513bcf['include']?_['map'](_0x513bcf[_0x6107('0x1b')],function(_0x37cf10){return{'model':db[_0x37cf10[_0x6107('0x1d')]],'as':_0x37cf10['as'],'attributes':_0x37cf10[_0x6107('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6107('0xc')](function(_0x21f906){logger[_0x6107('0x21')](_0x6107('0x1f'),_0x5f4e40);logger[_0x6107('0x1e')](_0x6107('0x1f'),_0x5f4e40,JSON[_0x6107('0x22')](_0x21f906));_0x42d583(_0x21f906);})['catch'](function(_0x203a90){logger['error']('ShowVtigerAccount',_0x203a90['message'],_0x5f4e40);_0x93ad0b(_0x2e4e8e[_0x6107('0x10')](0x1f4,_0x203a90[_0x6107('0x12')]));});});}; \ No newline at end of file +var _0x48b7=['options','raw','where','attributes','map','include','model','GetVtigerAccount','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VtigerAccount','findAll'];(function(_0x385a39,_0x21a109){var _0x3823b8=function(_0x3d4c1c){while(--_0x3d4c1c){_0x385a39['push'](_0x385a39['shift']());}};_0x3823b8(++_0x21a109);}(_0x48b7,0x12b));var _0x748b=function(_0x3b5623,_0x23d48a){_0x3b5623=_0x3b5623-0x0;var _0x460e69=_0x48b7[_0x3b5623];return _0x460e69;};'use strict';var _=require(_0x748b('0x0'));var util=require(_0x748b('0x1'));var moment=require(_0x748b('0x2'));var BPromise=require(_0x748b('0x3'));var rs=require(_0x748b('0x4'));var fs=require('fs');var Redis=require(_0x748b('0x5'));var db=require(_0x748b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x748b('0x7'))(_0x748b('0x8'));var config=require(_0x748b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x748b('0xa')][_0x748b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x453f35,_0x232044,_0xd14c40){return new BPromise(function(_0x194b99,_0xdca2e8){return client[_0x748b('0xc')](_0x453f35,_0xd14c40)[_0x748b('0xd')](function(_0x2caaa8){logger['info'](_0x748b('0xe'),_0x232044,'request\x20sent');logger[_0x748b('0xf')](_0x748b('0x10'),_0x232044,_0x748b('0x11'),JSON['stringify'](_0x2caaa8));if(_0x2caaa8[_0x748b('0x12')]){if(_0x2caaa8[_0x748b('0x12')][_0x748b('0x13')]===0x1f4){logger[_0x748b('0x12')](_0x748b('0xe'),_0x232044,_0x2caaa8[_0x748b('0x12')]['message']);return _0xdca2e8(_0x2caaa8['error'][_0x748b('0x14')]);}logger['error'](_0x748b('0xe'),_0x232044,_0x2caaa8[_0x748b('0x12')][_0x748b('0x14')]);return _0x194b99(_0x2caaa8[_0x748b('0x12')][_0x748b('0x14')]);}else{logger['info'](_0x748b('0xe'),_0x232044,'request\x20sent');_0x194b99(_0x2caaa8[_0x748b('0x15')][_0x748b('0x14')]);}})[_0x748b('0x16')](function(_0x9ec2dd){logger[_0x748b('0x12')](_0x748b('0xe'),_0x232044,_0x9ec2dd);_0xdca2e8(_0x9ec2dd);});});}exports['GetVtigerAccount']=function(_0x260b98){var _0x18010f=this;return new Promise(function(_0x3b5a21,_0x3f48cc){return db[_0x748b('0x17')][_0x748b('0x18')]({'raw':_0x260b98[_0x748b('0x19')]?_0x260b98['options'][_0x748b('0x1a')]===undefined?!![]:![]:!![],'where':_0x260b98[_0x748b('0x19')]?_0x260b98['options'][_0x748b('0x1b')]||null:null,'attributes':_0x260b98[_0x748b('0x19')]?_0x260b98[_0x748b('0x19')][_0x748b('0x1c')]||null:null,'limit':_0x260b98['options']?_0x260b98[_0x748b('0x19')]['limit']||null:null,'include':_0x260b98[_0x748b('0x19')]?_0x260b98[_0x748b('0x19')]['include']?_[_0x748b('0x1d')](_0x260b98['options'][_0x748b('0x1e')],function(_0x227399){return{'model':db[_0x227399[_0x748b('0x1f')]],'as':_0x227399['as'],'attributes':_0x227399[_0x748b('0x1c')],'include':_0x227399[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x227399[_0x748b('0x1e')],function(_0x35d5cb){return{'model':db[_0x35d5cb['model']],'as':_0x35d5cb['as'],'attributes':_0x35d5cb['attributes'],'include':_0x35d5cb[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x35d5cb[_0x748b('0x1e')],function(_0x2b731c){return{'model':db[_0x2b731c[_0x748b('0x1f')]],'as':_0x2b731c['as'],'attributes':_0x2b731c['attributes']};}):[]};}):[]};}):[]:[]})[_0x748b('0xd')](function(_0x48bdcc){logger['info'](_0x748b('0x20'),_0x260b98);logger[_0x748b('0xf')]('GetVtigerAccount',_0x260b98,JSON[_0x748b('0x21')](_0x48bdcc));_0x3b5a21(_0x48bdcc);})[_0x748b('0x16')](function(_0x3ebd67){logger['error'](_0x748b('0x20'),_0x3ebd67[_0x748b('0x14')],_0x260b98);_0x3f48cc(_0x18010f['error'](0x1f4,_0x3ebd67[_0x748b('0x14')]));});});};exports[_0x748b('0x22')]=function(_0x427b40){var _0x197be4=this;return new Promise(function(_0x34d06d,_0x13b8ff){return db[_0x748b('0x17')][_0x748b('0x23')]({'raw':_0x427b40[_0x748b('0x19')]?_0x427b40['options'][_0x748b('0x1a')]===undefined?!![]:![]:!![],'where':_0x427b40['options']?_0x427b40[_0x748b('0x19')][_0x748b('0x1b')]||null:null,'attributes':_0x427b40[_0x748b('0x19')]?_0x427b40[_0x748b('0x19')][_0x748b('0x1c')]||null:null,'include':_0x427b40[_0x748b('0x19')]?_0x427b40[_0x748b('0x19')][_0x748b('0x1e')]?_['map'](_0x427b40[_0x748b('0x19')][_0x748b('0x1e')],function(_0x2eb96e){return{'model':db[_0x2eb96e['model']],'as':_0x2eb96e['as'],'attributes':_0x2eb96e[_0x748b('0x1c')],'include':_0x2eb96e[_0x748b('0x1e')]?_['map'](_0x2eb96e[_0x748b('0x1e')],function(_0x573b09){return{'model':db[_0x573b09[_0x748b('0x1f')]],'as':_0x573b09['as'],'attributes':_0x573b09[_0x748b('0x1c')],'include':_0x573b09[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x573b09['include'],function(_0x373900){return{'model':db[_0x373900['model']],'as':_0x373900['as'],'attributes':_0x373900[_0x748b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x748b('0xd')](function(_0x2d459b){logger['info']('ShowVtigerAccount',_0x427b40);logger['debug']('ShowVtigerAccount',_0x427b40,JSON[_0x748b('0x21')](_0x2d459b));_0x34d06d(_0x2d459b);})[_0x748b('0x16')](function(_0x25d371){logger[_0x748b('0x12')](_0x748b('0x22'),_0x25d371[_0x748b('0x14')],_0x427b40);_0x13b8ff(_0x197be4[_0x748b('0x12')](0x1f4,_0x25d371[_0x748b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 161f053..d30027c 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(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +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(_0x22b3e5,_0x47d66b){var _0x5e9502=function(_0x2a4226){while(--_0x2a4226){_0x22b3e5['push'](_0x22b3e5['shift']());}};_0x5e9502(++_0x47d66b);}(_0xb10b,0x12a));var _0xbb10=function(_0x310832,_0xe72c7e){_0x310832=_0x310832-0x0;var _0x103f74=_0xb10b[_0x310832];return _0x103f74;};'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 58ab34c..742de00 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 _0x5b65=['exports','STRING','sequelize'];(function(_0x12f522,_0x1e9fb6){var _0x1e35d4=function(_0x3d854f){while(--_0x3d854f){_0x12f522['push'](_0x12f522['shift']());}};_0x1e35d4(++_0x1e9fb6);}(_0x5b65,0x161));var _0x55b6=function(_0x723d58,_0x34bdce){_0x723d58=_0x723d58-0x0;var _0x12b23d=_0x5b65[_0x723d58];return _0x12b23d;};'use strict';var Sequelize=require(_0x55b6('0x0'));module[_0x55b6('0x1')]={'name':{'type':Sequelize[_0x55b6('0x2')]},'description':{'type':Sequelize[_0x55b6('0x2')]}}; \ No newline at end of file +var _0x328d=['STRING'];(function(_0x309385,_0x3ab38f){var _0x45b0f5=function(_0x4fa7e0){while(--_0x4fa7e0){_0x309385['push'](_0x309385['shift']());}};_0x45b0f5(++_0x3ab38f);}(_0x328d,0x16c));var _0xd328=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x328d[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd328('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index eeda853..6f7f5c1 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 _0x597b=['keys','options','create','body','update','find','params','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','client','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','name','index','VtigerConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','type','filter','merge','includeAll','findAll','rows','show'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x597b,0x1bc));var _0xb597=function(_0xad7f50,_0x5ad905){_0xad7f50=_0xad7f50-0x0;var _0x2a7362=_0x597b[_0xad7f50];return _0x2a7362;};'use strict';var pdf=require(_0xb597('0x0'));var emlformat=require(_0xb597('0x1'));var rimraf=require(_0xb597('0x2'));var zipdir=require(_0xb597('0x3'));var jsonpatch=require(_0xb597('0x4'));var rp=require(_0xb597('0x5'));var moment=require(_0xb597('0x6'));var BPromise=require(_0xb597('0x7'));var Mustache=require(_0xb597('0x8'));var util=require(_0xb597('0x9'));var path=require(_0xb597('0xa'));var sox=require(_0xb597('0xb'));var csv=require('to-csv');var ejs=require(_0xb597('0xc'));var fs=require('fs');var _=require(_0xb597('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb597('0xe'));var deskjs=require(_0xb597('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb597('0x10'));var Papa=require(_0xb597('0x11'));var Redis=require(_0xb597('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb597('0x13'));var as=require(_0xb597('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb597('0x15'));var config=require(_0xb597('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb597('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb597('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x234008,_0x124dbb,_0x1f19b6,_0x1fa06f){return new BPromise(function(_0x561870,_0xa4315e){var _0x12f041=_0x1fa06f||client;return _0x12f041['request'](_0x234008,_0x1f19b6)['then'](function(_0x42f40a){logger['info'](_0xb597('0x19'),_0x124dbb,_0xb597('0x1a'));logger[_0xb597('0x1b')](_0xb597('0x1c'),_0x124dbb,_0xb597('0x1a'),JSON[_0xb597('0x1d')](_0x42f40a));if(_0x42f40a[_0xb597('0x1e')]){if(_0x42f40a[_0xb597('0x1e')][_0xb597('0x1f')]===0x1f4){logger['error'](_0xb597('0x19'),_0x124dbb,_0x42f40a['error'][_0xb597('0x20')]);return _0xa4315e(_0x42f40a[_0xb597('0x1e')]['message']);}logger['error'](_0xb597('0x19'),_0x124dbb,_0x42f40a[_0xb597('0x1e')][_0xb597('0x20')]);return _0x561870(_0x42f40a['error'][_0xb597('0x20')]);}else{logger[_0xb597('0x21')](_0xb597('0x19'),_0x124dbb,_0xb597('0x1a'));_0x561870(_0x42f40a[_0xb597('0x22')][_0xb597('0x20')]);}})[_0xb597('0x23')](function(_0x298db8){logger[_0xb597('0x1e')](_0xb597('0x19'),_0x124dbb,_0x298db8);_0xa4315e(_0x298db8);});});}function respondWithStatusCode(_0x1621db,_0x2d9ca6){_0x2d9ca6=_0x2d9ca6||0xcc;return function(_0x4efb4c){if(_0x4efb4c){return _0x1621db[_0xb597('0x24')](_0x2d9ca6);}return _0x1621db[_0xb597('0x25')](_0x2d9ca6)[_0xb597('0x26')]();};}function respondWithResult(_0x5c82ba,_0x4ccee8){_0x4ccee8=_0x4ccee8||0xc8;return function(_0xbb012a){if(_0xbb012a){return _0x5c82ba[_0xb597('0x25')](_0x4ccee8)[_0xb597('0x27')](_0xbb012a);}};}function respondWithFilteredResult(_0x1a9fdf,_0x4aaa91){return function(_0x4fccaf){if(_0x4fccaf){var _0x2b13db=_0x4fccaf[_0xb597('0x28')],_0x5b4504=_0x4aaa91['offset'],_0x6eaa63=_0x4aaa91[_0xb597('0x29')]+_0x4aaa91[_0xb597('0x2a')],_0x1dac95;if(_0x6eaa63>=_0x2b13db){_0x6eaa63=_0x2b13db;_0x1dac95=0xc8;}else{_0x1dac95=0xce;}_0x1a9fdf[_0xb597('0x25')](_0x1dac95);return _0x1a9fdf[_0xb597('0x2b')]('Content-Range',_0x5b4504+'-'+_0x6eaa63+'/'+_0x2b13db)['json'](_0x4fccaf);}return null;};}function patchUpdates(_0x4b3184){return function(_0x562c14){try{jsonpatch['apply'](_0x562c14,_0x4b3184,!![]);}catch(_0x1303d4){return BPromise[_0xb597('0x2c')](_0x1303d4);}return _0x562c14['save']();};}function saveUpdates(_0x20e591,_0x5b60e0){return function(_0x135f57){if(_0x135f57){return _0x135f57['update'](_0x20e591)[_0xb597('0x2d')](function(_0x45bd74){return _0x45bd74;});}return null;};}function removeEntity(_0x314699,_0x43ae72){return function(_0x1bb841){if(_0x1bb841){return _0x1bb841[_0xb597('0x2e')]()[_0xb597('0x2d')](function(){_0x314699[_0xb597('0x25')](0xcc)[_0xb597('0x26')]();});}};}function handleEntityNotFound(_0x4098ad,_0x559554){return function(_0x7daeac){if(!_0x7daeac){_0x4098ad[_0xb597('0x24')](0x194);}return _0x7daeac;};}function handleError(_0x44806a,_0x3d0eff){_0x3d0eff=_0x3d0eff||0x1f4;return function(_0x33735c){logger['error'](_0x33735c['stack']);if(_0x33735c[_0xb597('0x2f')]){delete _0x33735c[_0xb597('0x2f')];}_0x44806a[_0xb597('0x25')](_0x3d0eff)['send'](_0x33735c);};}exports[_0xb597('0x30')]=function(_0x18e7d2,_0xe20b0d){var _0x522126={},_0x44c28e={},_0x551d75={'count':0x0,'rows':[]};var _0x53b8a8=_['map'](db[_0xb597('0x31')][_0xb597('0x32')],function(_0x393059){return{'name':_0x393059[_0xb597('0x33')],'type':_0x393059['type'][_0xb597('0x34')]};});_0x44c28e['model']=_[_0xb597('0x35')](_0x53b8a8,'name');_0x44c28e[_0xb597('0x36')]=_['keys'](_0x18e7d2[_0xb597('0x36')]);_0x44c28e['filters']=_[_0xb597('0x37')](_0x44c28e[_0xb597('0x38')],_0x44c28e[_0xb597('0x36')]);_0x522126[_0xb597('0x39')]=_[_0xb597('0x37')](_0x44c28e['model'],qs[_0xb597('0x3a')](_0x18e7d2[_0xb597('0x36')][_0xb597('0x3a')]));_0x522126[_0xb597('0x39')]=_0x522126[_0xb597('0x39')][_0xb597('0x3b')]?_0x522126[_0xb597('0x39')]:_0x44c28e[_0xb597('0x38')];if(!_0x18e7d2[_0xb597('0x36')][_0xb597('0x3c')](_0xb597('0x3d'))){_0x522126[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x18e7d2[_0xb597('0x36')][_0xb597('0x2a')]);_0x522126[_0xb597('0x29')]=qs['offset'](_0x18e7d2[_0xb597('0x36')][_0xb597('0x29')]);}_0x522126['order']=qs[_0xb597('0x3e')](_0x18e7d2[_0xb597('0x36')]['sort']);_0x522126[_0xb597('0x3f')]=qs[_0xb597('0x40')](_['pick'](_0x18e7d2[_0xb597('0x36')],_0x44c28e[_0xb597('0x40')]),_0x53b8a8);if(_0x18e7d2[_0xb597('0x36')]['filter']){_0x522126[_0xb597('0x3f')]=_['merge'](_0x522126[_0xb597('0x3f')],{'$or':_['map'](_0x53b8a8,function(_0x5dbe93){if(_0x5dbe93[_0xb597('0x41')]!=='VIRTUAL'){var _0x1e3683={};_0x1e3683[_0x5dbe93['name']]={'$like':'%'+_0x18e7d2[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x1e3683;}})});}_0x522126=_[_0xb597('0x43')]({},_0x522126,_0x18e7d2['options']);var _0x3979f0={'where':_0x522126['where']};return db[_0xb597('0x31')][_0xb597('0x28')](_0x3979f0)[_0xb597('0x2d')](function(_0x182b59){_0x551d75['count']=_0x182b59;if(_0x18e7d2[_0xb597('0x36')][_0xb597('0x44')]){_0x522126['include']=[{'all':!![]}];}return db[_0xb597('0x31')][_0xb597('0x45')](_0x522126);})[_0xb597('0x2d')](function(_0x29958b){_0x551d75[_0xb597('0x46')]=_0x29958b;return _0x551d75;})[_0xb597('0x2d')](respondWithFilteredResult(_0xe20b0d,_0x522126))['catch'](handleError(_0xe20b0d,null));};exports[_0xb597('0x47')]=function(_0xff3a96,_0x20bfdb){var _0x367b38={'raw':![],'where':{'id':_0xff3a96['params']['id']}},_0x280c9f={};_0x280c9f[_0xb597('0x38')]=_[_0xb597('0x48')](db[_0xb597('0x31')][_0xb597('0x32')]);_0x280c9f[_0xb597('0x36')]=_[_0xb597('0x48')](_0xff3a96[_0xb597('0x36')]);_0x280c9f[_0xb597('0x40')]=_[_0xb597('0x37')](_0x280c9f[_0xb597('0x38')],_0x280c9f['query']);_0x367b38[_0xb597('0x39')]=_[_0xb597('0x37')](_0x280c9f[_0xb597('0x38')],qs[_0xb597('0x3a')](_0xff3a96[_0xb597('0x36')]['fields']));_0x367b38[_0xb597('0x39')]=_0x367b38['attributes']['length']?_0x367b38['attributes']:_0x280c9f[_0xb597('0x38')];if(_0xff3a96[_0xb597('0x36')][_0xb597('0x44')]){_0x367b38['include']=[{'all':!![]}];}_0x367b38=_['merge']({},_0x367b38,_0xff3a96[_0xb597('0x49')]);return db[_0xb597('0x31')]['find'](_0x367b38)[_0xb597('0x2d')](handleEntityNotFound(_0x20bfdb,null))['then'](respondWithResult(_0x20bfdb,null))[_0xb597('0x23')](handleError(_0x20bfdb,null));};exports[_0xb597('0x4a')]=function(_0x5526d8,_0x338eb6){return db[_0xb597('0x31')][_0xb597('0x4a')](_0x5526d8[_0xb597('0x4b')],{})[_0xb597('0x2d')](respondWithResult(_0x338eb6,0xc9))[_0xb597('0x23')](handleError(_0x338eb6,null));};exports[_0xb597('0x4c')]=function(_0x9dfd36,_0x42650b){if(_0x9dfd36[_0xb597('0x4b')]['id']){delete _0x9dfd36['body']['id'];}return db[_0xb597('0x31')][_0xb597('0x4d')]({'where':{'id':_0x9dfd36[_0xb597('0x4e')]['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x42650b,null))[_0xb597('0x2d')](saveUpdates(_0x9dfd36[_0xb597('0x4b')],null))[_0xb597('0x2d')](respondWithResult(_0x42650b,null))[_0xb597('0x23')](handleError(_0x42650b,null));};exports['destroy']=function(_0x5bb420,_0x36d953){return db['VtigerConfiguration'][_0xb597('0x4d')]({'where':{'id':_0x5bb420[_0xb597('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36d953,null))[_0xb597('0x2d')](removeEntity(_0x36d953,null))[_0xb597('0x23')](handleError(_0x36d953,null));};exports[_0xb597('0x4f')]=function(_0x13c82a,_0x18928d,_0x4eb17c){var _0x3ebbd9={};var _0x52d90b={};var _0x14c7cf;var _0x5ce138;return db['VtigerConfiguration'][_0xb597('0x50')]({'where':{'id':_0x13c82a['params']['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x18928d,null))['then'](function(_0x1bd29c){if(_0x1bd29c){_0x14c7cf=_0x1bd29c;_0x52d90b[_0xb597('0x38')]=_[_0xb597('0x48')](db['VtigerField'][_0xb597('0x32')]);_0x52d90b[_0xb597('0x36')]=_[_0xb597('0x48')](_0x13c82a['query']);_0x52d90b[_0xb597('0x40')]=_[_0xb597('0x37')](_0x52d90b[_0xb597('0x38')],_0x52d90b['query']);_0x3ebbd9[_0xb597('0x39')]=_['intersection'](_0x52d90b[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x13c82a[_0xb597('0x36')][_0xb597('0x3a')]));_0x3ebbd9[_0xb597('0x39')]=_0x3ebbd9[_0xb597('0x39')][_0xb597('0x3b')]?_0x3ebbd9[_0xb597('0x39')]:_0x52d90b['model'];_0x3ebbd9['order']=qs[_0xb597('0x3e')](_0x13c82a[_0xb597('0x36')][_0xb597('0x3e')]);_0x3ebbd9['where']=qs['filters'](_[_0xb597('0x51')](_0x13c82a['query'],_0x52d90b[_0xb597('0x40')]));if(_0x13c82a[_0xb597('0x36')]['filter']){_0x3ebbd9['where']=_[_0xb597('0x43')](_0x3ebbd9[_0xb597('0x3f')],{'$or':_[_0xb597('0x35')](_0x3ebbd9[_0xb597('0x39')],function(_0x1ca6b2){var _0x44f2e9={};_0x44f2e9[_0x1ca6b2]={'$like':'%'+_0x13c82a[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x44f2e9;})});}_0x3ebbd9=_[_0xb597('0x43')]({},_0x3ebbd9,_0x13c82a[_0xb597('0x49')]);return _0x14c7cf['getFields'](_0x3ebbd9);}})[_0xb597('0x2d')](function(_0x29ac25){if(_0x29ac25){_0x5ce138=_0x29ac25[_0xb597('0x3b')];if(!_0x13c82a[_0xb597('0x36')][_0xb597('0x3c')](_0xb597('0x3d'))){_0x3ebbd9[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x13c82a['query']['limit']);_0x3ebbd9[_0xb597('0x29')]=qs[_0xb597('0x29')](_0x13c82a[_0xb597('0x36')]['offset']);}return _0x14c7cf[_0xb597('0x4f')](_0x3ebbd9);}})[_0xb597('0x2d')](function(_0x19e4ea){if(_0x19e4ea){return _0x19e4ea?{'count':_0x5ce138,'rows':_0x19e4ea}:null;}})[_0xb597('0x2d')](respondWithResult(_0x18928d,null))[_0xb597('0x23')](handleError(_0x18928d,null));};exports[_0xb597('0x52')]=function(_0x4d8277,_0x5da432,_0x52c516){var _0x1f2440={};var _0x43e5af={};var _0x5d531c;var _0x3f4318;return db[_0xb597('0x31')]['findOne']({'where':{'id':_0x4d8277['params']['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x5da432,null))['then'](function(_0x53cff9){if(_0x53cff9){_0x5d531c=_0x53cff9;_0x43e5af['model']=_[_0xb597('0x48')](db[_0xb597('0x53')][_0xb597('0x32')]);_0x43e5af['query']=_[_0xb597('0x48')](_0x4d8277[_0xb597('0x36')]);_0x43e5af['filters']=_[_0xb597('0x37')](_0x43e5af[_0xb597('0x38')],_0x43e5af['query']);_0x1f2440[_0xb597('0x39')]=_[_0xb597('0x37')](_0x43e5af[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x4d8277[_0xb597('0x36')]['fields']));_0x1f2440['attributes']=_0x1f2440[_0xb597('0x39')]['length']?_0x1f2440[_0xb597('0x39')]:_0x43e5af[_0xb597('0x38')];_0x1f2440['order']=qs[_0xb597('0x3e')](_0x4d8277[_0xb597('0x36')][_0xb597('0x3e')]);_0x1f2440[_0xb597('0x3f')]=qs[_0xb597('0x40')](_[_0xb597('0x51')](_0x4d8277[_0xb597('0x36')],_0x43e5af[_0xb597('0x40')]));if(_0x4d8277[_0xb597('0x36')][_0xb597('0x42')]){_0x1f2440[_0xb597('0x3f')]=_[_0xb597('0x43')](_0x1f2440[_0xb597('0x3f')],{'$or':_['map'](_0x1f2440[_0xb597('0x39')],function(_0x24b07f){var _0x56b0c7={};_0x56b0c7[_0x24b07f]={'$like':'%'+_0x4d8277[_0xb597('0x36')][_0xb597('0x42')]+'%'};return _0x56b0c7;})});}_0x1f2440=_['merge']({},_0x1f2440,_0x4d8277[_0xb597('0x49')]);return _0x5d531c[_0xb597('0x52')](_0x1f2440);}})['then'](function(_0x471c9f){if(_0x471c9f){_0x3f4318=_0x471c9f[_0xb597('0x3b')];if(!_0x4d8277[_0xb597('0x36')][_0xb597('0x3c')]('nolimit')){_0x1f2440[_0xb597('0x2a')]=qs[_0xb597('0x2a')](_0x4d8277[_0xb597('0x36')][_0xb597('0x2a')]);_0x1f2440['offset']=qs[_0xb597('0x29')](_0x4d8277[_0xb597('0x36')][_0xb597('0x29')]);}return _0x5d531c[_0xb597('0x52')](_0x1f2440);}})[_0xb597('0x2d')](function(_0x1cb256){if(_0x1cb256){return _0x1cb256?{'count':_0x3f4318,'rows':_0x1cb256}:null;}})[_0xb597('0x2d')](respondWithResult(_0x5da432,null))[_0xb597('0x23')](handleError(_0x5da432,null));};exports[_0xb597('0x54')]=function(_0x651345,_0x505012,_0x588ae5){var _0x39c4e1={};var _0x2bdc77={};var _0x1510eb;var _0x227735;return db[_0xb597('0x31')][_0xb597('0x50')]({'where':{'id':_0x651345[_0xb597('0x4e')]['id']}})[_0xb597('0x2d')](handleEntityNotFound(_0x505012,null))[_0xb597('0x2d')](function(_0x3e7824){if(_0x3e7824){_0x1510eb=_0x3e7824;_0x2bdc77[_0xb597('0x38')]=_[_0xb597('0x48')](db[_0xb597('0x53')]['rawAttributes']);_0x2bdc77[_0xb597('0x36')]=_[_0xb597('0x48')](_0x651345[_0xb597('0x36')]);_0x2bdc77['filters']=_[_0xb597('0x37')](_0x2bdc77['model'],_0x2bdc77['query']);_0x39c4e1[_0xb597('0x39')]=_['intersection'](_0x2bdc77[_0xb597('0x38')],qs[_0xb597('0x3a')](_0x651345[_0xb597('0x36')]['fields']));_0x39c4e1['attributes']=_0x39c4e1[_0xb597('0x39')]['length']?_0x39c4e1[_0xb597('0x39')]:_0x2bdc77[_0xb597('0x38')];_0x39c4e1[_0xb597('0x55')]=qs[_0xb597('0x3e')](_0x651345[_0xb597('0x36')][_0xb597('0x3e')]);_0x39c4e1[_0xb597('0x3f')]=qs[_0xb597('0x40')](_['pick'](_0x651345[_0xb597('0x36')],_0x2bdc77['filters']));if(_0x651345[_0xb597('0x36')][_0xb597('0x42')]){_0x39c4e1[_0xb597('0x3f')]=_[_0xb597('0x43')](_0x39c4e1['where'],{'$or':_['map'](_0x39c4e1['attributes'],function(_0x417e24){var _0x4315f8={};_0x4315f8[_0x417e24]={'$like':'%'+_0x651345['query'][_0xb597('0x42')]+'%'};return _0x4315f8;})});}_0x39c4e1=_[_0xb597('0x43')]({},_0x39c4e1,_0x651345['options']);return _0x1510eb[_0xb597('0x54')](_0x39c4e1);}})[_0xb597('0x2d')](function(_0x2c15ad){if(_0x2c15ad){_0x227735=_0x2c15ad[_0xb597('0x3b')];if(!_0x651345[_0xb597('0x36')][_0xb597('0x3c')]('nolimit')){_0x39c4e1[_0xb597('0x2a')]=qs['limit'](_0x651345[_0xb597('0x36')][_0xb597('0x2a')]);_0x39c4e1[_0xb597('0x29')]=qs['offset'](_0x651345[_0xb597('0x36')][_0xb597('0x29')]);}return _0x1510eb[_0xb597('0x54')](_0x39c4e1);}})[_0xb597('0x2d')](function(_0x5ec45f){if(_0x5ec45f){return _0x5ec45f?{'count':_0x227735,'rows':_0x5ec45f}:null;}})[_0xb597('0x2d')](respondWithResult(_0x505012,null))[_0xb597('0x23')](handleError(_0x505012,null));}; \ No newline at end of file +var _0x7cfe=['key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','VtigerConfiguration','rawAttributes','fieldName','type'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x36747f,_0xa43a1){_0x36747f=_0x36747f-0x0;var _0x430aea=_0x7cfe[_0x36747f];return _0x430aea;};'use strict';var pdf=require(_0xe7cf('0x0'));var emlformat=require(_0xe7cf('0x1'));var rimraf=require(_0xe7cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cf('0x3'));var rp=require(_0xe7cf('0x4'));var moment=require('moment');var BPromise=require(_0xe7cf('0x5'));var Mustache=require('mustache');var util=require(_0xe7cf('0x6'));var path=require('path');var sox=require(_0xe7cf('0x7'));var csv=require(_0xe7cf('0x8'));var ejs=require(_0xe7cf('0x9'));var fs=require('fs');var _=require(_0xe7cf('0xa'));var squel=require(_0xe7cf('0xb'));var crypto=require(_0xe7cf('0xc'));var jsforce=require(_0xe7cf('0xd'));var deskjs=require(_0xe7cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7cf('0x10'));var authService=require(_0xe7cf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe7cf('0x12'));var hardwareService=require(_0xe7cf('0x13'));var logger=require('../../config/logger')(_0xe7cf('0x14'));var utils=require(_0xe7cf('0x15'));var config=require(_0xe7cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7cf('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe7cf('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2769e6,_0x431a5e,_0x122439,_0x58735f){return new BPromise(function(_0x386dcb,_0x58b1f5){var _0x3fb3f1=_0x58735f||client;return _0x3fb3f1[_0xe7cf('0x19')](_0x2769e6,_0x122439)['then'](function(_0x280824){logger[_0xe7cf('0x1a')](_0xe7cf('0x1b'),_0x431a5e,_0xe7cf('0x1c'));logger['debug'](_0xe7cf('0x1d'),_0x431a5e,_0xe7cf('0x1c'),JSON[_0xe7cf('0x1e')](_0x280824));if(_0x280824['error']){if(_0x280824['error']['code']===0x1f4){logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0x280824[_0xe7cf('0x1f')][_0xe7cf('0x20')]);return _0x58b1f5(_0x280824[_0xe7cf('0x1f')]['message']);}logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0x280824[_0xe7cf('0x1f')]['message']);return _0x386dcb(_0x280824[_0xe7cf('0x1f')][_0xe7cf('0x20')]);}else{logger['info'](_0xe7cf('0x1b'),_0x431a5e,_0xe7cf('0x1c'));_0x386dcb(_0x280824[_0xe7cf('0x21')][_0xe7cf('0x20')]);}})['catch'](function(_0xde3105){logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0xde3105);_0x58b1f5(_0xde3105);});});}function respondWithStatusCode(_0x18ff6a,_0x3d4dd1){_0x3d4dd1=_0x3d4dd1||0xcc;return function(_0x5e0a98){if(_0x5e0a98){return _0x18ff6a[_0xe7cf('0x22')](_0x3d4dd1);}return _0x18ff6a['status'](_0x3d4dd1)[_0xe7cf('0x23')]();};}function respondWithResult(_0x380cfd,_0x2d3825){_0x2d3825=_0x2d3825||0xc8;return function(_0x3d670e){if(_0x3d670e){return _0x380cfd['status'](_0x2d3825)[_0xe7cf('0x24')](_0x3d670e);}};}function respondWithFilteredResult(_0x36c577,_0x241d99){return function(_0x4b7ecd){if(_0x4b7ecd){var _0x38cd7c=_0x4b7ecd['count'],_0x538f17=_0x241d99[_0xe7cf('0x25')],_0x115a12=_0x241d99['offset']+_0x241d99[_0xe7cf('0x26')],_0x17a1ca;if(_0x115a12>=_0x38cd7c){_0x115a12=_0x38cd7c;_0x17a1ca=0xc8;}else{_0x17a1ca=0xce;}_0x36c577[_0xe7cf('0x27')](_0x17a1ca);return _0x36c577[_0xe7cf('0x28')](_0xe7cf('0x29'),_0x538f17+'-'+_0x115a12+'/'+_0x38cd7c)[_0xe7cf('0x24')](_0x4b7ecd);}return null;};}function patchUpdates(_0x3ede17){return function(_0x3f58f2){try{jsonpatch[_0xe7cf('0x2a')](_0x3f58f2,_0x3ede17,!![]);}catch(_0x4b0f5f){return BPromise[_0xe7cf('0x2b')](_0x4b0f5f);}return _0x3f58f2[_0xe7cf('0x2c')]();};}function saveUpdates(_0x1d2e1a,_0x2dae52){return function(_0x409081){if(_0x409081){return _0x409081['update'](_0x1d2e1a)[_0xe7cf('0x2d')](function(_0x571e75){return _0x571e75;});}return null;};}function removeEntity(_0x2a8926,_0x21a6ec){return function(_0x53555a){if(_0x53555a){return _0x53555a[_0xe7cf('0x2e')]()[_0xe7cf('0x2d')](function(){_0x2a8926[_0xe7cf('0x27')](0xcc)[_0xe7cf('0x23')]();});}};}function handleEntityNotFound(_0x141e83,_0x26b5e4){return function(_0x4aedfe){if(!_0x4aedfe){_0x141e83[_0xe7cf('0x22')](0x194);}return _0x4aedfe;};}function handleError(_0x49231c,_0x1c4e7b){_0x1c4e7b=_0x1c4e7b||0x1f4;return function(_0x2a62df){logger[_0xe7cf('0x1f')](_0x2a62df[_0xe7cf('0x2f')]);if(_0x2a62df[_0xe7cf('0x30')]){delete _0x2a62df[_0xe7cf('0x30')];}_0x49231c['status'](_0x1c4e7b)['send'](_0x2a62df);};}exports['index']=function(_0x5388bc,_0x46ad5e){var _0x153dcd={},_0x152038={},_0x22cdf1={'count':0x0,'rows':[]};var _0x41ca73=_['map'](db[_0xe7cf('0x31')][_0xe7cf('0x32')],function(_0x2c6a3d){return{'name':_0x2c6a3d[_0xe7cf('0x33')],'type':_0x2c6a3d[_0xe7cf('0x34')][_0xe7cf('0x35')]};});_0x152038[_0xe7cf('0x36')]=_[_0xe7cf('0x37')](_0x41ca73,_0xe7cf('0x30'));_0x152038[_0xe7cf('0x38')]=_[_0xe7cf('0x39')](_0x5388bc[_0xe7cf('0x38')]);_0x152038[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x152038[_0xe7cf('0x36')],_0x152038[_0xe7cf('0x38')]);_0x153dcd[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x152038[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x5388bc['query'][_0xe7cf('0x3d')]));_0x153dcd[_0xe7cf('0x3c')]=_0x153dcd[_0xe7cf('0x3c')]['length']?_0x153dcd[_0xe7cf('0x3c')]:_0x152038[_0xe7cf('0x36')];if(!_0x5388bc['query']['hasOwnProperty'](_0xe7cf('0x3e'))){_0x153dcd[_0xe7cf('0x26')]=qs[_0xe7cf('0x26')](_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x153dcd['offset']=qs[_0xe7cf('0x25')](_0x5388bc[_0xe7cf('0x38')]['offset']);}_0x153dcd[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x5388bc[_0xe7cf('0x38')]['sort']);_0x153dcd[_0xe7cf('0x41')]=qs[_0xe7cf('0x3a')](_['pick'](_0x5388bc['query'],_0x152038['filters']),_0x41ca73);if(_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x153dcd['where']=_[_0xe7cf('0x43')](_0x153dcd['where'],{'$or':_[_0xe7cf('0x37')](_0x41ca73,function(_0x2a9094){if(_0x2a9094[_0xe7cf('0x34')]!==_0xe7cf('0x44')){var _0x298a16={};_0x298a16[_0x2a9094[_0xe7cf('0x30')]]={'$like':'%'+_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x42')]+'%'};return _0x298a16;}})});}_0x153dcd=_['merge']({},_0x153dcd,_0x5388bc[_0xe7cf('0x45')]);var _0x3960e={'where':_0x153dcd[_0xe7cf('0x41')]};return db[_0xe7cf('0x31')][_0xe7cf('0x46')](_0x3960e)[_0xe7cf('0x2d')](function(_0x447350){_0x22cdf1['count']=_0x447350;if(_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x47')]){_0x153dcd[_0xe7cf('0x48')]=[{'all':!![]}];}return db[_0xe7cf('0x31')][_0xe7cf('0x49')](_0x153dcd);})['then'](function(_0x1b647b){_0x22cdf1[_0xe7cf('0x4a')]=_0x1b647b;return _0x22cdf1;})[_0xe7cf('0x2d')](respondWithFilteredResult(_0x46ad5e,_0x153dcd))[_0xe7cf('0x4b')](handleError(_0x46ad5e,null));};exports[_0xe7cf('0x4c')]=function(_0xee34a6,_0x33ab1d){var _0x1aae03={'raw':![],'where':{'id':_0xee34a6[_0xe7cf('0x4d')]['id']}},_0x43b45c={};_0x43b45c[_0xe7cf('0x36')]=_[_0xe7cf('0x39')](db[_0xe7cf('0x31')][_0xe7cf('0x32')]);_0x43b45c[_0xe7cf('0x38')]=_['keys'](_0xee34a6['query']);_0x43b45c['filters']=_[_0xe7cf('0x3b')](_0x43b45c['model'],_0x43b45c[_0xe7cf('0x38')]);_0x1aae03[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x43b45c[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0xee34a6[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x1aae03[_0xe7cf('0x3c')]=_0x1aae03[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x1aae03[_0xe7cf('0x3c')]:_0x43b45c['model'];if(_0xee34a6[_0xe7cf('0x38')]['includeAll']){_0x1aae03[_0xe7cf('0x48')]=[{'all':!![]}];}_0x1aae03=_[_0xe7cf('0x43')]({},_0x1aae03,_0xee34a6[_0xe7cf('0x45')]);return db[_0xe7cf('0x31')]['find'](_0x1aae03)[_0xe7cf('0x2d')](handleEntityNotFound(_0x33ab1d,null))[_0xe7cf('0x2d')](respondWithResult(_0x33ab1d,null))['catch'](handleError(_0x33ab1d,null));};exports[_0xe7cf('0x4f')]=function(_0x3689aa,_0x557e2a){return db[_0xe7cf('0x31')][_0xe7cf('0x4f')](_0x3689aa['body'],{})[_0xe7cf('0x2d')](respondWithResult(_0x557e2a,0xc9))['catch'](handleError(_0x557e2a,null));};exports[_0xe7cf('0x50')]=function(_0x57c37d,_0x2136fe){if(_0x57c37d[_0xe7cf('0x51')]['id']){delete _0x57c37d[_0xe7cf('0x51')]['id'];}return db['VtigerConfiguration'][_0xe7cf('0x52')]({'where':{'id':_0x57c37d[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x2136fe,null))[_0xe7cf('0x2d')](saveUpdates(_0x57c37d[_0xe7cf('0x51')],null))[_0xe7cf('0x2d')](respondWithResult(_0x2136fe,null))['catch'](handleError(_0x2136fe,null));};exports[_0xe7cf('0x2e')]=function(_0x277574,_0x3962a9){return db[_0xe7cf('0x31')][_0xe7cf('0x52')]({'where':{'id':_0x277574[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x3962a9,null))[_0xe7cf('0x2d')](removeEntity(_0x3962a9,null))[_0xe7cf('0x4b')](handleError(_0x3962a9,null));};exports[_0xe7cf('0x53')]=function(_0x2e9668,_0x5276e4,_0x447bbd){var _0x303e3b={};var _0x81672d={};var _0x489dbb;var _0x1dc748;return db[_0xe7cf('0x31')][_0xe7cf('0x54')]({'where':{'id':_0x2e9668[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x5276e4,null))[_0xe7cf('0x2d')](function(_0x387090){if(_0x387090){_0x489dbb=_0x387090;_0x81672d[_0xe7cf('0x36')]=_['keys'](db[_0xe7cf('0x55')][_0xe7cf('0x32')]);_0x81672d['query']=_[_0xe7cf('0x39')](_0x2e9668['query']);_0x81672d[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x81672d[_0xe7cf('0x36')],_0x81672d[_0xe7cf('0x38')]);_0x303e3b[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x81672d[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x2e9668['query'][_0xe7cf('0x3d')]));_0x303e3b[_0xe7cf('0x3c')]=_0x303e3b[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x303e3b[_0xe7cf('0x3c')]:_0x81672d[_0xe7cf('0x36')];_0x303e3b[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x40')]);_0x303e3b['where']=qs[_0xe7cf('0x3a')](_['pick'](_0x2e9668[_0xe7cf('0x38')],_0x81672d[_0xe7cf('0x3a')]));if(_0x2e9668['query'][_0xe7cf('0x42')]){_0x303e3b[_0xe7cf('0x41')]=_[_0xe7cf('0x43')](_0x303e3b['where'],{'$or':_['map'](_0x303e3b[_0xe7cf('0x3c')],function(_0x38a152){var _0x492d3b={};_0x492d3b[_0x38a152]={'$like':'%'+_0x2e9668['query'][_0xe7cf('0x42')]+'%'};return _0x492d3b;})});}_0x303e3b=_['merge']({},_0x303e3b,_0x2e9668['options']);return _0x489dbb['getFields'](_0x303e3b);}})[_0xe7cf('0x2d')](function(_0x218180){if(_0x218180){_0x1dc748=_0x218180[_0xe7cf('0x4e')];if(!_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x56')]('nolimit')){_0x303e3b[_0xe7cf('0x26')]=qs['limit'](_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x303e3b['offset']=qs[_0xe7cf('0x25')](_0x2e9668[_0xe7cf('0x38')]['offset']);}return _0x489dbb[_0xe7cf('0x53')](_0x303e3b);}})['then'](function(_0x129408){if(_0x129408){return _0x129408?{'count':_0x1dc748,'rows':_0x129408}:null;}})[_0xe7cf('0x2d')](respondWithResult(_0x5276e4,null))[_0xe7cf('0x4b')](handleError(_0x5276e4,null));};exports[_0xe7cf('0x57')]=function(_0x176315,_0x9f0f8f,_0x4fd3b5){var _0x4978df={};var _0x586fe7={};var _0x2ae7c2;var _0xc8754a;return db[_0xe7cf('0x31')][_0xe7cf('0x54')]({'where':{'id':_0x176315[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x9f0f8f,null))[_0xe7cf('0x2d')](function(_0x4178d6){if(_0x4178d6){_0x2ae7c2=_0x4178d6;_0x586fe7['model']=_[_0xe7cf('0x39')](db[_0xe7cf('0x55')]['rawAttributes']);_0x586fe7[_0xe7cf('0x38')]=_['keys'](_0x176315[_0xe7cf('0x38')]);_0x586fe7[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x586fe7[_0xe7cf('0x36')],_0x586fe7[_0xe7cf('0x38')]);_0x4978df[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x586fe7[_0xe7cf('0x36')],qs['fields'](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x4978df['attributes']=_0x4978df[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x4978df['attributes']:_0x586fe7[_0xe7cf('0x36')];_0x4978df[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x40')]);_0x4978df[_0xe7cf('0x41')]=qs['filters'](_[_0xe7cf('0x58')](_0x176315[_0xe7cf('0x38')],_0x586fe7[_0xe7cf('0x3a')]));if(_0x176315[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x4978df['where']=_[_0xe7cf('0x43')](_0x4978df[_0xe7cf('0x41')],{'$or':_['map'](_0x4978df['attributes'],function(_0x3717e8){var _0x345025={};_0x345025[_0x3717e8]={'$like':'%'+_0x176315['query']['filter']+'%'};return _0x345025;})});}_0x4978df=_[_0xe7cf('0x43')]({},_0x4978df,_0x176315[_0xe7cf('0x45')]);return _0x2ae7c2[_0xe7cf('0x57')](_0x4978df);}})[_0xe7cf('0x2d')](function(_0x285246){if(_0x285246){_0xc8754a=_0x285246[_0xe7cf('0x4e')];if(!_0x176315[_0xe7cf('0x38')]['hasOwnProperty'](_0xe7cf('0x3e'))){_0x4978df[_0xe7cf('0x26')]=qs['limit'](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x4978df[_0xe7cf('0x25')]=qs[_0xe7cf('0x25')](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x25')]);}return _0x2ae7c2[_0xe7cf('0x57')](_0x4978df);}})[_0xe7cf('0x2d')](function(_0x3d12b0){if(_0x3d12b0){return _0x3d12b0?{'count':_0xc8754a,'rows':_0x3d12b0}:null;}})['then'](respondWithResult(_0x9f0f8f,null))[_0xe7cf('0x4b')](handleError(_0x9f0f8f,null));};exports['getDescriptions']=function(_0x31cdf6,_0x1440fe,_0x163022){var _0x380948={};var _0x39d572={};var _0x64bda3;var _0x3a19d2;return db['VtigerConfiguration'][_0xe7cf('0x54')]({'where':{'id':_0x31cdf6['params']['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x1440fe,null))[_0xe7cf('0x2d')](function(_0x4020cb){if(_0x4020cb){_0x64bda3=_0x4020cb;_0x39d572['model']=_[_0xe7cf('0x39')](db[_0xe7cf('0x55')][_0xe7cf('0x32')]);_0x39d572[_0xe7cf('0x38')]=_[_0xe7cf('0x39')](_0x31cdf6[_0xe7cf('0x38')]);_0x39d572['filters']=_[_0xe7cf('0x3b')](_0x39d572[_0xe7cf('0x36')],_0x39d572['query']);_0x380948[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x39d572[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x380948[_0xe7cf('0x3c')]=_0x380948['attributes'][_0xe7cf('0x4e')]?_0x380948[_0xe7cf('0x3c')]:_0x39d572['model'];_0x380948['order']=qs[_0xe7cf('0x40')](_0x31cdf6['query'][_0xe7cf('0x40')]);_0x380948[_0xe7cf('0x41')]=qs[_0xe7cf('0x3a')](_[_0xe7cf('0x58')](_0x31cdf6[_0xe7cf('0x38')],_0x39d572[_0xe7cf('0x3a')]));if(_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x380948[_0xe7cf('0x41')]=_[_0xe7cf('0x43')](_0x380948[_0xe7cf('0x41')],{'$or':_[_0xe7cf('0x37')](_0x380948[_0xe7cf('0x3c')],function(_0x1b3bf4){var _0x469b44={};_0x469b44[_0x1b3bf4]={'$like':'%'+_0x31cdf6[_0xe7cf('0x38')]['filter']+'%'};return _0x469b44;})});}_0x380948=_['merge']({},_0x380948,_0x31cdf6[_0xe7cf('0x45')]);return _0x64bda3[_0xe7cf('0x59')](_0x380948);}})[_0xe7cf('0x2d')](function(_0x371edf){if(_0x371edf){_0x3a19d2=_0x371edf[_0xe7cf('0x4e')];if(!_0x31cdf6['query'][_0xe7cf('0x56')]('nolimit')){_0x380948[_0xe7cf('0x26')]=qs[_0xe7cf('0x26')](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x380948[_0xe7cf('0x25')]=qs['offset'](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x25')]);}return _0x64bda3[_0xe7cf('0x59')](_0x380948);}})[_0xe7cf('0x2d')](function(_0xcdacb8){if(_0xcdacb8){return _0xcdacb8?{'count':_0x3a19d2,'rows':_0xcdacb8}:null;}})[_0xe7cf('0x2d')](respondWithResult(_0x1440fe,null))[_0xe7cf('0x4b')](handleError(_0x1440fe,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 04350e3..6d48ef7 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 _0x9055=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x196ac3,_0x41875d){var _0x18ccf9=function(_0x40725f){while(--_0x40725f){_0x196ac3['push'](_0x196ac3['shift']());}};_0x18ccf9(++_0x41875d);}(_0x9055,0x7b));var _0x5905=function(_0x475fe2,_0x505f67){_0x475fe2=_0x475fe2-0x0;var _0x2d813f=_0x9055[_0x475fe2];return _0x2d813f;};'use strict';var _=require(_0x5905('0x0'));var util=require(_0x5905('0x1'));var logger=require(_0x5905('0x2'))(_0x5905('0x3'));var moment=require(_0x5905('0x4'));var BPromise=require(_0x5905('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5905('0x6'));var rimraf=require('rimraf');var config=require(_0x5905('0x7'));var attributes=require(_0x5905('0x8'));module[_0x5905('0x9')]=function(_0x22ae6b,_0x17ba75){return _0x22ae6b[_0x5905('0xa')](_0x5905('0xb'),attributes,{'tableName':_0x5905('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65af=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4bc9ac,_0x3157eb){var _0x3d3bb2=function(_0x29dedf){while(--_0x29dedf){_0x4bc9ac['push'](_0x4bc9ac['shift']());}};_0x3d3bb2(++_0x3157eb);}(_0x65af,0x1e2));var _0xf65a=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x65af[_0x29db36];return _0x234e87;};'use strict';var _=require(_0xf65a('0x0'));var util=require(_0xf65a('0x1'));var logger=require(_0xf65a('0x2'))(_0xf65a('0x3'));var moment=require(_0xf65a('0x4'));var BPromise=require(_0xf65a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf65a('0x6'));var attributes=require(_0xf65a('0x7'));module[_0xf65a('0x8')]=function(_0x84359d,_0x1163f5){return _0x84359d[_0xf65a('0x9')](_0xf65a('0xa'),attributes,{'tableName':_0xf65a('0xb'),'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 96a82a4..d7e2b07 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 _0xff01=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0xff01,0x12f));var _0x1ff0=function(_0x532b22,_0x176208){_0x532b22=_0x532b22-0x0;var _0x324fcd=_0xff01[_0x532b22];return _0x324fcd;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var moment=require(_0x1ff0('0x2'));var BPromise=require(_0x1ff0('0x3'));var rs=require(_0x1ff0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ff0('0x5'));var logger=require(_0x1ff0('0x6'))(_0x1ff0('0x7'));var config=require(_0x1ff0('0x8'));var jayson=require(_0x1ff0('0x9'));var client=jayson[_0x1ff0('0xa')][_0x1ff0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x235163,_0x372dc1,_0x2436e6){return new BPromise(function(_0x2a8c32,_0x530d85){return client[_0x1ff0('0xc')](_0x235163,_0x2436e6)[_0x1ff0('0xd')](function(_0x56d655){logger[_0x1ff0('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x372dc1,'request\x20sent');logger[_0x1ff0('0xf')](_0x1ff0('0x10'),_0x372dc1,_0x1ff0('0x11'),JSON[_0x1ff0('0x12')](_0x56d655));if(_0x56d655[_0x1ff0('0x13')]){if(_0x56d655['error'][_0x1ff0('0x14')]===0x1f4){logger[_0x1ff0('0x13')](_0x1ff0('0x15'),_0x372dc1,_0x56d655[_0x1ff0('0x13')][_0x1ff0('0x16')]);return _0x530d85(_0x56d655[_0x1ff0('0x13')]['message']);}logger[_0x1ff0('0x13')](_0x1ff0('0x15'),_0x372dc1,_0x56d655['error'][_0x1ff0('0x16')]);return _0x2a8c32(_0x56d655[_0x1ff0('0x13')]['message']);}else{logger[_0x1ff0('0xe')](_0x1ff0('0x15'),_0x372dc1,'request\x20sent');_0x2a8c32(_0x56d655[_0x1ff0('0x17')][_0x1ff0('0x16')]);}})[_0x1ff0('0x18')](function(_0x3c29f9){logger[_0x1ff0('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x372dc1,_0x3c29f9);_0x530d85(_0x3c29f9);});});} \ No newline at end of file +var _0xd179=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd179,0x18d));var _0x9d17=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xd179[_0x3a0c4f];return _0x247049;};'use strict';var _=require(_0x9d17('0x0'));var util=require(_0x9d17('0x1'));var moment=require(_0x9d17('0x2'));var BPromise=require(_0x9d17('0x3'));var rs=require(_0x9d17('0x4'));var fs=require('fs');var Redis=require(_0x9d17('0x5'));var db=require(_0x9d17('0x6'))['db'];var utils=require(_0x9d17('0x7'));var logger=require(_0x9d17('0x8'))(_0x9d17('0x9'));var config=require(_0x9d17('0xa'));var jayson=require(_0x9d17('0xb'));var client=jayson[_0x9d17('0xc')][_0x9d17('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40f149,_0x3d1ada,_0x4a3ac7){return new BPromise(function(_0x2bc3e3,_0x212530){return client[_0x9d17('0xe')](_0x40f149,_0x4a3ac7)[_0x9d17('0xf')](function(_0x2aa85a){logger[_0x9d17('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x3d1ada,_0x9d17('0x11'));logger[_0x9d17('0x12')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3d1ada,'request\x20sent',JSON[_0x9d17('0x13')](_0x2aa85a));if(_0x2aa85a[_0x9d17('0x14')]){if(_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x15')]===0x1f4){logger[_0x9d17('0x14')](_0x9d17('0x16'),_0x3d1ada,_0x2aa85a['error'][_0x9d17('0x17')]);return _0x212530(_0x2aa85a['error'][_0x9d17('0x17')]);}logger[_0x9d17('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3d1ada,_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x17')]);return _0x2bc3e3(_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x17')]);}else{logger[_0x9d17('0x10')](_0x9d17('0x16'),_0x3d1ada,_0x9d17('0x11'));_0x2bc3e3(_0x2aa85a['result'][_0x9d17('0x17')]);}})[_0x9d17('0x18')](function(_0x1b2e11){logger[_0x9d17('0x14')](_0x9d17('0x16'),_0x3d1ada,_0x1b2e11);_0x212530(_0x1b2e11);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5ebbb12..fad53c5 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 _0x9f3b=['Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','exports','util','path','connect-timeout'];(function(_0x176462,_0x4f87c4){var _0x2dcd8a=function(_0x251c56){while(--_0x251c56){_0x176462['push'](_0x176462['shift']());}};_0x2dcd8a(++_0x4f87c4);}(_0x9f3b,0x184));var _0xb9f3=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x9f3b[_0x29a29f];return _0x443ea3;};'use strict';var multer=require('multer');var util=require(_0xb9f3('0x0'));var path=require(_0xb9f3('0x1'));var timeout=require(_0xb9f3('0x2'));var express=require('express');var router=express[_0xb9f3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9f3('0x4'));var config=require(_0xb9f3('0x5'));var controller=require(_0xb9f3('0x6'));router[_0xb9f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9f3('0x8')]);router[_0xb9f3('0x7')](_0xb9f3('0x9'),auth['isAuthenticated'](),controller[_0xb9f3('0xa')]);router[_0xb9f3('0xb')]('/',auth[_0xb9f3('0xc')](),controller[_0xb9f3('0xd')]);router[_0xb9f3('0xe')](_0xb9f3('0x9'),auth[_0xb9f3('0xc')](),controller[_0xb9f3('0xf')]);router['delete'](_0xb9f3('0x9'),auth[_0xb9f3('0xc')](),controller['destroy']);module[_0xb9f3('0x10')]=router; \ No newline at end of file +var _0x0835=['post','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','show'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x0835,0x135));var _0x5083=function(_0x24d849,_0x463371){_0x24d849=_0x24d849-0x0;var _0x18dc81=_0x0835[_0x24d849];return _0x18dc81;};'use strict';var multer=require(_0x5083('0x0'));var util=require(_0x5083('0x1'));var path=require(_0x5083('0x2'));var timeout=require(_0x5083('0x3'));var express=require(_0x5083('0x4'));var router=express[_0x5083('0x5')]();var auth=require(_0x5083('0x6'));var interaction=require(_0x5083('0x7'));var config=require(_0x5083('0x8'));var controller=require(_0x5083('0x9'));router['get']('/',auth[_0x5083('0xa')](),controller[_0x5083('0xb')]);router[_0x5083('0xc')]('/:id',auth[_0x5083('0xa')](),controller[_0x5083('0xd')]);router[_0x5083('0xe')]('/',auth[_0x5083('0xa')](),controller[_0x5083('0xf')]);router['put'](_0x5083('0x10'),auth['isAuthenticated'](),controller[_0x5083('0x11')]);router[_0x5083('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5578bed..f10ada4 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 _0xf3cd=['customVariable','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0xf3cd[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'type':{'type':Sequelize[_0xdf3c('0x2')](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'),'keyValue'),'defaultValue':_0xdf3c('0x3')},'content':{'type':Sequelize[_0xdf3c('0x6')]},'key':{'type':Sequelize[_0xdf3c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'))},'keyContent':{'type':Sequelize[_0xdf3c('0x6')]},'idField':{'type':Sequelize[_0xdf3c('0x6')]},'nameField':{'type':Sequelize[_0xdf3c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf3c('0x6')]}}; \ No newline at end of file +var _0x0d4d=['ENUM','string','variable','customVariable','STRING','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d4d,0x132));var _0xd0d4=function(_0x5c4a85,_0x15525e){_0x5c4a85=_0x5c4a85-0x0;var _0x3b7dc5=_0x0d4d[_0x5c4a85];return _0x3b7dc5;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'type':{'type':Sequelize[_0xd0d4('0x2')](_0xd0d4('0x3'),_0xd0d4('0x4'),_0xd0d4('0x5'),'keyValue'),'defaultValue':_0xd0d4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd0d4('0x6')]},'keyType':{'type':Sequelize[_0xd0d4('0x2')]('string',_0xd0d4('0x4'),_0xd0d4('0x5'))},'keyContent':{'type':Sequelize[_0xd0d4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd0d4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0d4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 775f857..0becd9f 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 _0xd8fb=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3154a2,_0x313363){_0x3154a2=_0x3154a2-0x0;var _0x256db5=_0xd8fb[_0x3154a2];return _0x256db5;};'use strict';var pdf=require(_0xbd8f('0x0'));var emlformat=require(_0xbd8f('0x1'));var rimraf=require(_0xbd8f('0x2'));var zipdir=require(_0xbd8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require('to-csv');var ejs=require(_0xbd8f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=_0x10d72e[_0xbd8f('0x18')],_0x174929=_0xa57e91[_0xbd8f('0x19')],_0x63db18=_0xa57e91['offset']+_0xa57e91[_0xbd8f('0x1a')],_0x5ebf8b;if(_0x63db18>=_0x4da96f){_0x63db18=_0x4da96f;_0x5ebf8b=0xc8;}else{_0x5ebf8b=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5ebf8b);return _0x829fb2['set']('Content-Range',_0x174929+'-'+_0x63db18+'/'+_0x4da96f)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0x5d2fdb){return function(_0x5705c5){try{jsonpatch[_0xbd8f('0x1b')](_0x5705c5,_0x5d2fdb,!![]);}catch(_0x4b5fac){return BPromise[_0xbd8f('0x1c')](_0x4b5fac);}return _0x5705c5[_0xbd8f('0x1d')]();};}function saveUpdates(_0xb47c8e,_0x897f25){return function(_0xdc11cc){if(_0xdc11cc){return _0xdc11cc[_0xbd8f('0x1e')](_0xb47c8e)[_0xbd8f('0x1f')](function(_0x90eff8){return _0x90eff8;});}return null;};}function removeEntity(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x20')]()[_0xbd8f('0x1f')](function(){_0x2fbe3b[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0xd11ae,_0x395b1b){return function(_0x4ba8db){if(!_0x4ba8db){_0xd11ae[_0xbd8f('0x14')](0x194);}return _0x4ba8db;};}function handleError(_0x9fa3b1,_0x1f9fcc){_0x1f9fcc=_0x1f9fcc||0x1f4;return function(_0x2f3df7){logger[_0xbd8f('0x21')](_0x2f3df7[_0xbd8f('0x22')]);if(_0x2f3df7[_0xbd8f('0x23')]){delete _0x2f3df7[_0xbd8f('0x23')];}_0x9fa3b1['status'](_0x1f9fcc)[_0xbd8f('0x24')](_0x2f3df7);};}exports[_0xbd8f('0x25')]=function(_0x5a3a8c,_0x339df7){var _0x557daa={},_0x41b2a6={},_0x30d62e={'count':0x0,'rows':[]};var _0x991401=_[_0xbd8f('0x26')](db[_0xbd8f('0x27')][_0xbd8f('0x28')],function(_0x4c4431){return{'name':_0x4c4431[_0xbd8f('0x29')],'type':_0x4c4431[_0xbd8f('0x2a')][_0xbd8f('0x2b')]};});_0x41b2a6[_0xbd8f('0x2c')]=_[_0xbd8f('0x26')](_0x991401,_0xbd8f('0x23'));_0x41b2a6[_0xbd8f('0x2d')]=_['keys'](_0x5a3a8c[_0xbd8f('0x2d')]);_0x41b2a6[_0xbd8f('0x2e')]=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],_0x41b2a6['query']);_0x557daa['attributes']=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],qs[_0xbd8f('0x30')](_0x5a3a8c[_0xbd8f('0x2d')]['fields']));_0x557daa[_0xbd8f('0x31')]=_0x557daa[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x557daa[_0xbd8f('0x31')]:_0x41b2a6[_0xbd8f('0x2c')];if(!_0x5a3a8c['query'][_0xbd8f('0x33')](_0xbd8f('0x34'))){_0x557daa[_0xbd8f('0x1a')]=qs[_0xbd8f('0x1a')](_0x5a3a8c[_0xbd8f('0x2d')]['limit']);_0x557daa[_0xbd8f('0x19')]=qs['offset'](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x19')]);}_0x557daa[_0xbd8f('0x35')]=qs[_0xbd8f('0x36')](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x36')]);_0x557daa['where']=qs['filters'](_['pick'](_0x5a3a8c[_0xbd8f('0x2d')],_0x41b2a6[_0xbd8f('0x2e')]),_0x991401);if(_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]){_0x557daa[_0xbd8f('0x38')]=_[_0xbd8f('0x39')](_0x557daa[_0xbd8f('0x38')],{'$or':_[_0xbd8f('0x26')](_0x991401,function(_0x2d4882){if(_0x2d4882[_0xbd8f('0x2a')]!==_0xbd8f('0x3a')){var _0x339c70={};_0x339c70[_0x2d4882[_0xbd8f('0x23')]]={'$like':'%'+_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]+'%'};return _0x339c70;}})});}_0x557daa=_['merge']({},_0x557daa,_0x5a3a8c[_0xbd8f('0x3b')]);var _0x4181e0={'where':_0x557daa['where']};return db[_0xbd8f('0x27')][_0xbd8f('0x18')](_0x4181e0)[_0xbd8f('0x1f')](function(_0x582bcf){_0x30d62e[_0xbd8f('0x18')]=_0x582bcf;if(_0x5a3a8c['query'][_0xbd8f('0x3c')]){_0x557daa[_0xbd8f('0x3d')]=[{'all':!![]}];}return db[_0xbd8f('0x27')]['findAll'](_0x557daa);})[_0xbd8f('0x1f')](function(_0x72fe99){_0x30d62e[_0xbd8f('0x3e')]=_0x72fe99;return _0x30d62e;})['then'](respondWithFilteredResult(_0x339df7,_0x557daa))[_0xbd8f('0x3f')](handleError(_0x339df7,null));};exports[_0xbd8f('0x40')]=function(_0x2c1397,_0x351027){var _0x280d95={'raw':!![],'where':{'id':_0x2c1397[_0xbd8f('0x41')]['id']}},_0x1db8c7={};_0x1db8c7[_0xbd8f('0x2c')]=_[_0xbd8f('0x42')](db['VtigerField']['rawAttributes']);_0x1db8c7[_0xbd8f('0x2d')]=_[_0xbd8f('0x42')](_0x2c1397[_0xbd8f('0x2d')]);_0x1db8c7[_0xbd8f('0x2e')]=_['intersection'](_0x1db8c7[_0xbd8f('0x2c')],_0x1db8c7[_0xbd8f('0x2d')]);_0x280d95[_0xbd8f('0x31')]=_[_0xbd8f('0x2f')](_0x1db8c7[_0xbd8f('0x2c')],qs['fields'](_0x2c1397['query'][_0xbd8f('0x30')]));_0x280d95['attributes']=_0x280d95[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x280d95[_0xbd8f('0x31')]:_0x1db8c7[_0xbd8f('0x2c')];if(_0x2c1397[_0xbd8f('0x2d')][_0xbd8f('0x3c')]){_0x280d95[_0xbd8f('0x3d')]=[{'all':!![]}];}_0x280d95=_[_0xbd8f('0x39')]({},_0x280d95,_0x2c1397['options']);return db[_0xbd8f('0x27')][_0xbd8f('0x43')](_0x280d95)[_0xbd8f('0x1f')](handleEntityNotFound(_0x351027,null))[_0xbd8f('0x1f')](respondWithResult(_0x351027,null))[_0xbd8f('0x3f')](handleError(_0x351027,null));};exports[_0xbd8f('0x44')]=function(_0x272f70,_0x3918a5){return db['VtigerField'][_0xbd8f('0x44')](_0x272f70[_0xbd8f('0x45')],{})[_0xbd8f('0x1f')](respondWithResult(_0x3918a5,0xc9))[_0xbd8f('0x3f')](handleError(_0x3918a5,null));};exports[_0xbd8f('0x1e')]=function(_0x1e40f2,_0x42bada){if(_0x1e40f2[_0xbd8f('0x45')]['id']){delete _0x1e40f2[_0xbd8f('0x45')]['id'];}return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x1e40f2[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x42bada,null))[_0xbd8f('0x1f')](saveUpdates(_0x1e40f2[_0xbd8f('0x45')],null))[_0xbd8f('0x1f')](respondWithResult(_0x42bada,null))[_0xbd8f('0x3f')](handleError(_0x42bada,null));};exports[_0xbd8f('0x20')]=function(_0x2668a4,_0x4d32c4){return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x2668a4[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x4d32c4,null))['then'](removeEntity(_0x4d32c4,null))[_0xbd8f('0x3f')](handleError(_0x4d32c4,null));}; \ No newline at end of file +var _0x687b=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','rawAttributes','length','create','body','params','html-pdf','eml-format','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerField','type','key'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x687b,0x14a));var _0xb687=function(_0x5b19ae,_0x2fef9e){_0x5b19ae=_0x5b19ae-0x0;var _0x367f6a=_0x687b[_0x5b19ae];return _0x367f6a;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=_0x141375['count'],_0x2c7a18=_0x30622f[_0xb687('0x1f')],_0x25124a=_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x20')],_0x19bb29;if(_0x25124a>=_0x263085){_0x25124a=_0x263085;_0x19bb29=0xc8;}else{_0x19bb29=0xce;}_0x3ab914['status'](_0x19bb29);return _0x3ab914['set'](_0xb687('0x21'),_0x2c7a18+'-'+_0x25124a+'/'+_0x263085)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x19ee14){return function(_0x4b593b){try{jsonpatch[_0xb687('0x22')](_0x4b593b,_0x19ee14,!![]);}catch(_0x481f1d){return BPromise[_0xb687('0x23')](_0x481f1d);}return _0x4b593b[_0xb687('0x24')]();};}function saveUpdates(_0x170dc0,_0x44bd0b){return function(_0x49d5a1){if(_0x49d5a1){return _0x49d5a1[_0xb687('0x25')](_0x170dc0)['then'](function(_0x335541){return _0x335541;});}return null;};}function removeEntity(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x26')]()[_0xb687('0x27')](function(){_0x90e892[_0xb687('0x1d')](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0xbf6c58,_0x38866c){return function(_0xf48ba4){if(!_0xf48ba4){_0xbf6c58[_0xb687('0x1c')](0x194);}return _0xf48ba4;};}function handleError(_0x57cd51,_0xf45db0){_0xf45db0=_0xf45db0||0x1f4;return function(_0x129347){logger[_0xb687('0x29')](_0x129347[_0xb687('0x2a')]);if(_0x129347[_0xb687('0x2b')]){delete _0x129347[_0xb687('0x2b')];}_0x57cd51[_0xb687('0x1d')](_0xf45db0)[_0xb687('0x2c')](_0x129347);};}exports[_0xb687('0x2d')]=function(_0x2e6185,_0x4a61ec){var _0x3712cf={},_0x192966={},_0x392721={'count':0x0,'rows':[]};var _0x265a4b=_[_0xb687('0x2e')](db[_0xb687('0x2f')]['rawAttributes'],function(_0x28b69a){return{'name':_0x28b69a['fieldName'],'type':_0x28b69a[_0xb687('0x30')][_0xb687('0x31')]};});_0x192966[_0xb687('0x32')]=_[_0xb687('0x2e')](_0x265a4b,_0xb687('0x2b'));_0x192966[_0xb687('0x33')]=_[_0xb687('0x34')](_0x2e6185['query']);_0x192966[_0xb687('0x35')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],_0x192966[_0xb687('0x33')]);_0x3712cf[_0xb687('0x37')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],qs[_0xb687('0x38')](_0x2e6185[_0xb687('0x33')][_0xb687('0x38')]));_0x3712cf[_0xb687('0x37')]=_0x3712cf['attributes']['length']?_0x3712cf[_0xb687('0x37')]:_0x192966[_0xb687('0x32')];if(!_0x2e6185[_0xb687('0x33')][_0xb687('0x39')]('nolimit')){_0x3712cf['limit']=qs[_0xb687('0x20')](_0x2e6185[_0xb687('0x33')]['limit']);_0x3712cf[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e6185['query'][_0xb687('0x1f')]);}_0x3712cf['order']=qs[_0xb687('0x3a')](_0x2e6185[_0xb687('0x33')][_0xb687('0x3a')]);_0x3712cf[_0xb687('0x3b')]=qs[_0xb687('0x35')](_[_0xb687('0x3c')](_0x2e6185['query'],_0x192966[_0xb687('0x35')]),_0x265a4b);if(_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]){_0x3712cf[_0xb687('0x3b')]=_['merge'](_0x3712cf[_0xb687('0x3b')],{'$or':_[_0xb687('0x2e')](_0x265a4b,function(_0x1f1c88){if(_0x1f1c88[_0xb687('0x30')]!==_0xb687('0x3e')){var _0x58c214={};_0x58c214[_0x1f1c88[_0xb687('0x2b')]]={'$like':'%'+_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]+'%'};return _0x58c214;}})});}_0x3712cf=_[_0xb687('0x3f')]({},_0x3712cf,_0x2e6185[_0xb687('0x40')]);var _0x29cf09={'where':_0x3712cf['where']};return db['VtigerField'][_0xb687('0x41')](_0x29cf09)['then'](function(_0x1f919f){_0x392721[_0xb687('0x41')]=_0x1f919f;if(_0x2e6185['query'][_0xb687('0x42')]){_0x3712cf[_0xb687('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xb687('0x44')](_0x3712cf);})[_0xb687('0x27')](function(_0x127b25){_0x392721['rows']=_0x127b25;return _0x392721;})[_0xb687('0x27')](respondWithFilteredResult(_0x4a61ec,_0x3712cf))[_0xb687('0x45')](handleError(_0x4a61ec,null));};exports[_0xb687('0x46')]=function(_0x75102a,_0x140388){var _0x1375f7={'raw':!![],'where':{'id':_0x75102a['params']['id']}},_0x21b9ef={};_0x21b9ef[_0xb687('0x32')]=_['keys'](db['VtigerField'][_0xb687('0x47')]);_0x21b9ef[_0xb687('0x33')]=_['keys'](_0x75102a[_0xb687('0x33')]);_0x21b9ef['filters']=_[_0xb687('0x36')](_0x21b9ef[_0xb687('0x32')],_0x21b9ef['query']);_0x1375f7[_0xb687('0x37')]=_[_0xb687('0x36')](_0x21b9ef['model'],qs[_0xb687('0x38')](_0x75102a[_0xb687('0x33')][_0xb687('0x38')]));_0x1375f7[_0xb687('0x37')]=_0x1375f7[_0xb687('0x37')][_0xb687('0x48')]?_0x1375f7[_0xb687('0x37')]:_0x21b9ef[_0xb687('0x32')];if(_0x75102a[_0xb687('0x33')][_0xb687('0x42')]){_0x1375f7[_0xb687('0x43')]=[{'all':!![]}];}_0x1375f7=_[_0xb687('0x3f')]({},_0x1375f7,_0x75102a['options']);return db[_0xb687('0x2f')]['find'](_0x1375f7)[_0xb687('0x27')](handleEntityNotFound(_0x140388,null))[_0xb687('0x27')](respondWithResult(_0x140388,null))[_0xb687('0x45')](handleError(_0x140388,null));};exports[_0xb687('0x49')]=function(_0x113b76,_0x3ff178){return db['VtigerField']['create'](_0x113b76[_0xb687('0x4a')],{})[_0xb687('0x27')](respondWithResult(_0x3ff178,0xc9))[_0xb687('0x45')](handleError(_0x3ff178,null));};exports[_0xb687('0x25')]=function(_0x4f5736,_0x3b5f2d){if(_0x4f5736[_0xb687('0x4a')]['id']){delete _0x4f5736[_0xb687('0x4a')]['id'];}return db[_0xb687('0x2f')]['find']({'where':{'id':_0x4f5736[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x3b5f2d,null))[_0xb687('0x27')](saveUpdates(_0x4f5736[_0xb687('0x4a')],null))['then'](respondWithResult(_0x3b5f2d,null))['catch'](handleError(_0x3b5f2d,null));};exports[_0xb687('0x26')]=function(_0x170b26,_0x42b61a){return db['VtigerField']['find']({'where':{'id':_0x170b26[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x42b61a,null))[_0xb687('0x27')](removeEntity(_0x42b61a,null))[_0xb687('0x45')](handleError(_0x42b61a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ea23ebf..c3a7f18 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x42692b,_0xa0080d){var _0x3ea2d7=function(_0x4feb33){while(--_0x4feb33){_0x42692b['push'](_0x42692b['shift']());}};_0x3ea2d7(++_0xa0080d);}(_0x7a54,0x106));var _0x47a5=function(_0xa2b936,_0x5e73c0){_0xa2b936=_0xa2b936-0x0;var _0x32abd3=_0x7a54[_0xa2b936];return _0x32abd3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x563bd8,_0x202f13){var _0x1e7a7d=function(_0x5f04d3){while(--_0x5f04d3){_0x563bd8['push'](_0x563bd8['shift']());}};_0x1e7a7d(++_0x202f13);}(_0x7a54,0x106));var _0x47a5=function(_0x4983ae,_0x1cdc50){_0x4983ae=_0x4983ae-0x0;var _0x1d3fc8=_0x7a54[_0x4983ae];return _0x1d3fc8;};'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 b8cddc4..fa7202d 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 _0x8322=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1132d1,_0x1a2f80){var _0x13b103=function(_0x743de8){while(--_0x743de8){_0x1132d1['push'](_0x1132d1['shift']());}};_0x13b103(++_0x1a2f80);}(_0x8322,0x186));var _0x2832=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x8322[_0x1aab74];return _0x396af2;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var moment=require(_0x2832('0x2'));var BPromise=require(_0x2832('0x3'));var rs=require(_0x2832('0x4'));var fs=require('fs');var Redis=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];var utils=require(_0x2832('0x7'));var logger=require(_0x2832('0x8'))(_0x2832('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2832('0xa')][_0x2832('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2c39,_0x29a788,_0x1488df){return new BPromise(function(_0x4b0ca8,_0xb57a3c){return client[_0x2832('0xc')](_0xab2c39,_0x1488df)[_0x2832('0xd')](function(_0xb1f005){logger['info'](_0x2832('0xe'),_0x29a788,_0x2832('0xf'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'),JSON['stringify'](_0xb1f005));if(_0xb1f005['error']){if(_0xb1f005[_0x2832('0x10')][_0x2832('0x11')]===0x1f4){logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005['error'][_0x2832('0x12')]);return _0xb57a3c(_0xb1f005[_0x2832('0x10')]['message']);}logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);return _0x4b0ca8(_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);}else{logger[_0x2832('0x13')]('VtigerField,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'));_0x4b0ca8(_0xb1f005[_0x2832('0x14')]['message']);}})[_0x2832('0x15')](function(_0x56d1e6){logger[_0x2832('0x10')]('VtigerField,\x20%s,\x20%s',_0x29a788,_0x56d1e6);_0xb57a3c(_0x56d1e6);});});} \ No newline at end of file +var _0x151b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x45d1a6,_0xeb5de6){var _0x11827c=function(_0x14be55){while(--_0x14be55){_0x45d1a6['push'](_0x45d1a6['shift']());}};_0x11827c(++_0xeb5de6);}(_0x151b,0x153));var _0xb151=function(_0x3c2bf2,_0x3db107){_0x3c2bf2=_0x3c2bf2-0x0;var _0x394f58=_0x151b[_0x3c2bf2];return _0x394f58;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb151('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb151('0x2'));var db=require(_0xb151('0x3'))['db'];var utils=require(_0xb151('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb151('0x5'));var jayson=require(_0xb151('0x6'));var client=jayson['client'][_0xb151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ba994,_0xd89657,_0x352713){return new BPromise(function(_0x46fdb0,_0x484caf){return client['request'](_0x4ba994,_0x352713)[_0xb151('0x8')](function(_0x20f1b2){logger['info']('VtigerField,\x20%s,\x20%s',_0xd89657,_0xb151('0x9'));logger[_0xb151('0xa')](_0xb151('0xb'),_0xd89657,_0xb151('0x9'),JSON[_0xb151('0xc')](_0x20f1b2));if(_0x20f1b2[_0xb151('0xd')]){if(_0x20f1b2[_0xb151('0xd')][_0xb151('0xe')]===0x1f4){logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2['error'][_0xb151('0x10')]);return _0x484caf(_0x20f1b2['error'][_0xb151('0x10')]);}logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2[_0xb151('0xd')]['message']);return _0x46fdb0(_0x20f1b2[_0xb151('0xd')][_0xb151('0x10')]);}else{logger[_0xb151('0x11')]('VtigerField,\x20%s,\x20%s',_0xd89657,'request\x20sent');_0x46fdb0(_0x20f1b2[_0xb151('0x12')]['message']);}})[_0xb151('0x13')](function(_0x4ca435){logger[_0xb151('0xd')]('VtigerField,\x20%s,\x20%s',_0xd89657,_0x4ca435);_0x484caf(_0x4ca435);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 56e0beb..1e26cce 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 _0xe650=['multer','util','path','express','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x3b72e4,_0x405b78){var _0x204771=function(_0x434eb5){while(--_0x434eb5){_0x3b72e4['push'](_0x3b72e4['shift']());}};_0x204771(++_0x405b78);}(_0xe650,0xfd));var _0x0e65=function(_0x49fb1c,_0x113891){_0x49fb1c=_0x49fb1c-0x0;var _0x36cc02=_0xe650[_0x49fb1c];return _0x36cc02;};'use strict';var multer=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var path=require(_0x0e65('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e65('0x3'));var router=express[_0x0e65('0x4')]();var auth=require(_0x0e65('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e65('0x6'));router[_0x0e65('0x7')]('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0x9')]);router[_0x0e65('0x7')]('/:id',auth[_0x0e65('0x8')](),controller[_0x0e65('0xa')]);router[_0x0e65('0x7')](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller['getConfigurations']);router['get'](_0x0e65('0xc'),auth[_0x0e65('0x8')](),controller[_0x0e65('0xd')]);router[_0x0e65('0xe')]('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0xf')]);router['post'](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller[_0x0e65('0x10')]);router[_0x0e65('0x11')](_0x0e65('0x12'),auth[_0x0e65('0x8')](),controller[_0x0e65('0x13')]);router[_0x0e65('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0e65('0x15')]);module[_0x0e65('0x16')]=router; \ No newline at end of file +var _0x1978=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id'];(function(_0x515534,_0x5a08e6){var _0x3e4e10=function(_0x31b74){while(--_0x31b74){_0x515534['push'](_0x515534['shift']());}};_0x3e4e10(++_0x5a08e6);}(_0x1978,0x174));var _0x8197=function(_0x4cee27,_0x232dea){_0x4cee27=_0x4cee27-0x0;var _0x125a1b=_0x1978[_0x4cee27];return _0x125a1b;};'use strict';var multer=require('multer');var util=require(_0x8197('0x0'));var path=require(_0x8197('0x1'));var timeout=require(_0x8197('0x2'));var express=require(_0x8197('0x3'));var router=express[_0x8197('0x4')]();var auth=require(_0x8197('0x5'));var interaction=require(_0x8197('0x6'));var config=require(_0x8197('0x7'));var controller=require(_0x8197('0x8'));router[_0x8197('0x9')]('/',auth['isAuthenticated'](),controller[_0x8197('0xa')]);router[_0x8197('0x9')](_0x8197('0xb'),auth[_0x8197('0xc')](),controller[_0x8197('0xd')]);router[_0x8197('0x9')](_0x8197('0xe'),auth[_0x8197('0xc')](),controller[_0x8197('0xf')]);router[_0x8197('0x9')](_0x8197('0x10'),auth[_0x8197('0xc')](),controller[_0x8197('0x11')]);router[_0x8197('0x12')]('/',auth[_0x8197('0xc')](),controller['create']);router[_0x8197('0x12')](_0x8197('0xe'),auth[_0x8197('0xc')](),controller[_0x8197('0x13')]);router[_0x8197('0x14')](_0x8197('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8197('0x15')](_0x8197('0xb'),auth[_0x8197('0xc')](),controller[_0x8197('0x16')]);module[_0x8197('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 481049a..1ad3f74 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 _0x3855=['STRING','username','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3855,0x17a));var _0x5385=function(_0x4cace9,_0xba6744){_0x4cace9=_0x4cace9-0x0;var _0x2c2879=_0x3855[_0x4cace9];return _0x2c2879;};'use strict';var Sequelize=require(_0x5385('0x0'));module[_0x5385('0x1')]={'name':{'type':Sequelize[_0x5385('0x2')]},'description':{'type':Sequelize[_0x5385('0x2')]},'username':{'type':Sequelize[_0x5385('0x2')],'unique':_0x5385('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5385('0x2')],'unique':_0x5385('0x4')},'authType':{'type':Sequelize[_0x5385('0x5')](_0x5385('0x6'),_0x5385('0x7')),'defaultValue':_0x5385('0x6')},'serverUrl':{'type':Sequelize[_0x5385('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5385('0x5')]('integrationTab',_0x5385('0x8')),'defaultValue':_0x5385('0x9')}}; \ No newline at end of file +var _0x3c1a=['ENUM','password','token','integrationTab','sequelize','exports','STRING','remoteUri'];(function(_0xbbc57,_0x3eed41){var _0x1fd5c4=function(_0x3a6d30){while(--_0x3a6d30){_0xbbc57['push'](_0xbbc57['shift']());}};_0x1fd5c4(++_0x3eed41);}(_0x3c1a,0x13c));var _0xa3c1=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x3c1a[_0x2ff739];return _0x12dc13;};'use strict';var Sequelize=require(_0xa3c1('0x0'));module[_0xa3c1('0x1')]={'name':{'type':Sequelize[_0xa3c1('0x2')]},'description':{'type':Sequelize[_0xa3c1('0x2')]},'username':{'type':Sequelize[_0xa3c1('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa3c1('0x2')]},'token':{'type':Sequelize[_0xa3c1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa3c1('0x3')},'authType':{'type':Sequelize[_0xa3c1('0x4')](_0xa3c1('0x5'),_0xa3c1('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa3c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa3c1('0x4')](_0xa3c1('0x7'),'newTab'),'defaultValue':_0xa3c1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bb627b9..d27054b 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 _0x98b8=['base64','Sequelize','Unknown\x20authentication\x20type','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','body','find','params','getConfigurations','findOne','pick','options','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','Basic\x20%s','toString'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x98b8,0x93));var _0x898b=function(_0x1d8d06,_0x1d8898){_0x1d8d06=_0x1d8d06-0x0;var _0x1a7237=_0x98b8[_0x1d8d06];return _0x1a7237;};'use strict';var pdf=require(_0x898b('0x0'));var emlformat=require(_0x898b('0x1'));var rimraf=require(_0x898b('0x2'));var zipdir=require(_0x898b('0x3'));var jsonpatch=require(_0x898b('0x4'));var rp=require(_0x898b('0x5'));var moment=require(_0x898b('0x6'));var BPromise=require(_0x898b('0x7'));var Mustache=require(_0x898b('0x8'));var util=require(_0x898b('0x9'));var path=require(_0x898b('0xa'));var sox=require(_0x898b('0xb'));var csv=require(_0x898b('0xc'));var ejs=require(_0x898b('0xd'));var fs=require('fs');var _=require(_0x898b('0xe'));var squel=require('squel');var crypto=require(_0x898b('0xf'));var jsforce=require(_0x898b('0x10'));var deskjs=require(_0x898b('0x11'));var toCsv=require(_0x898b('0xc'));var querystring=require(_0x898b('0x12'));var Papa=require(_0x898b('0x13'));var Redis=require(_0x898b('0x14'));var authService=require(_0x898b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x898b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x898b('0x17'));var utils=require(_0x898b('0x18'));var config=require(_0x898b('0x19'));var licenseUtil=require(_0x898b('0x1a'));var db=require(_0x898b('0x1b'))['db'];var integrations=require(_0x898b('0x1c'));var jayson=require(_0x898b('0x1d'));var client=jayson[_0x898b('0x1e')][_0x898b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x405aa0,_0x20669c,_0x1fb398,_0x51b5a0){return new BPromise(function(_0x435cba,_0x561cac){var _0x2c2346=_0x51b5a0||client;return _0x2c2346['request'](_0x405aa0,_0x1fb398)['then'](function(_0x427cc4){logger[_0x898b('0x20')](_0x898b('0x21'),_0x20669c,_0x898b('0x22'));logger['debug'](_0x898b('0x23'),_0x20669c,'request\x20sent',JSON['stringify'](_0x427cc4));if(_0x427cc4[_0x898b('0x24')]){if(_0x427cc4[_0x898b('0x24')][_0x898b('0x25')]===0x1f4){logger['error'](_0x898b('0x21'),_0x20669c,_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);return _0x561cac(_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);}logger[_0x898b('0x24')](_0x898b('0x21'),_0x20669c,_0x427cc4[_0x898b('0x24')][_0x898b('0x26')]);return _0x435cba(_0x427cc4[_0x898b('0x24')]['message']);}else{logger['info'](_0x898b('0x21'),_0x20669c,_0x898b('0x22'));_0x435cba(_0x427cc4['result'][_0x898b('0x26')]);}})[_0x898b('0x27')](function(_0x43b3a3){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x20669c,_0x43b3a3);_0x561cac(_0x43b3a3);});});}function respondWithStatusCode(_0x66101f,_0x2bd250){_0x2bd250=_0x2bd250||0xcc;return function(_0x1a70a1){if(_0x1a70a1){return _0x66101f[_0x898b('0x28')](_0x2bd250);}return _0x66101f[_0x898b('0x29')](_0x2bd250)[_0x898b('0x2a')]();};}function respondWithResult(_0x11c558,_0x21785b){_0x21785b=_0x21785b||0xc8;return function(_0x284dfd){if(_0x284dfd){return _0x11c558[_0x898b('0x29')](_0x21785b)[_0x898b('0x2b')](_0x284dfd);}};}function respondWithFilteredResult(_0x3479e1,_0x163a6c){return function(_0x485460){if(_0x485460){var _0x5177c9=_0x485460[_0x898b('0x2c')],_0x12c7e6=_0x163a6c[_0x898b('0x2d')],_0xb5c11=_0x163a6c[_0x898b('0x2d')]+_0x163a6c[_0x898b('0x2e')],_0x177ee0;if(_0xb5c11>=_0x5177c9){_0xb5c11=_0x5177c9;_0x177ee0=0xc8;}else{_0x177ee0=0xce;}_0x3479e1[_0x898b('0x29')](_0x177ee0);return _0x3479e1[_0x898b('0x2f')](_0x898b('0x30'),_0x12c7e6+'-'+_0xb5c11+'/'+_0x5177c9)['json'](_0x485460);}return null;};}function patchUpdates(_0x4f1bb5){return function(_0x2bdf79){try{jsonpatch[_0x898b('0x31')](_0x2bdf79,_0x4f1bb5,!![]);}catch(_0x561125){return BPromise[_0x898b('0x32')](_0x561125);}return _0x2bdf79[_0x898b('0x33')]();};}function saveUpdates(_0x3b2114,_0x2ede2d){return function(_0x18563c){if(_0x18563c){return _0x18563c[_0x898b('0x34')](_0x3b2114)['then'](function(_0x19dedc){return _0x19dedc;});}return null;};}function removeEntity(_0x63f3ce,_0x52b32c){return function(_0x816333){if(_0x816333){return _0x816333['destroy']()[_0x898b('0x35')](function(){_0x63f3ce[_0x898b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x312718,_0x4e472a){return function(_0x5f3dd5){if(!_0x5f3dd5){_0x312718[_0x898b('0x28')](0x194);}return _0x5f3dd5;};}function handleError(_0x3854dd,_0x43358d){_0x43358d=_0x43358d||0x1f4;return function(_0x3bde9a){logger[_0x898b('0x24')](_0x3bde9a[_0x898b('0x36')]);if(_0x3bde9a[_0x898b('0x37')]){delete _0x3bde9a[_0x898b('0x37')];}_0x3854dd[_0x898b('0x29')](_0x43358d)[_0x898b('0x38')](_0x3bde9a);};}exports[_0x898b('0x39')]=function(_0x177df7,_0x4ec638){var _0x5e6653={},_0x48e618={},_0x5e735d={'count':0x0,'rows':[]};var _0x393735=_[_0x898b('0x3a')](db[_0x898b('0x3b')]['rawAttributes'],function(_0x2c79f6){return{'name':_0x2c79f6[_0x898b('0x3c')],'type':_0x2c79f6[_0x898b('0x3d')][_0x898b('0x3e')]};});_0x48e618[_0x898b('0x3f')]=_['map'](_0x393735,_0x898b('0x37'));_0x48e618[_0x898b('0x40')]=_[_0x898b('0x41')](_0x177df7['query']);_0x48e618[_0x898b('0x42')]=_[_0x898b('0x43')](_0x48e618['model'],_0x48e618[_0x898b('0x40')]);_0x5e6653[_0x898b('0x44')]=_[_0x898b('0x43')](_0x48e618[_0x898b('0x3f')],qs['fields'](_0x177df7[_0x898b('0x40')][_0x898b('0x45')]));_0x5e6653[_0x898b('0x44')]=_0x5e6653[_0x898b('0x44')][_0x898b('0x46')]?_0x5e6653[_0x898b('0x44')]:_0x48e618[_0x898b('0x3f')];if(!_0x177df7[_0x898b('0x40')][_0x898b('0x47')](_0x898b('0x48'))){_0x5e6653['limit']=qs['limit'](_0x177df7[_0x898b('0x40')][_0x898b('0x2e')]);_0x5e6653[_0x898b('0x2d')]=qs[_0x898b('0x2d')](_0x177df7['query'][_0x898b('0x2d')]);}_0x5e6653[_0x898b('0x49')]=qs[_0x898b('0x4a')](_0x177df7[_0x898b('0x40')]['sort']);_0x5e6653[_0x898b('0x4b')]=qs[_0x898b('0x42')](_['pick'](_0x177df7[_0x898b('0x40')],_0x48e618[_0x898b('0x42')]),_0x393735);if(_0x177df7['query'][_0x898b('0x4c')]){_0x5e6653['where']=_[_0x898b('0x4d')](_0x5e6653['where'],{'$or':_[_0x898b('0x3a')](_0x393735,function(_0xd7f8fe){if(_0xd7f8fe[_0x898b('0x3d')]!==_0x898b('0x4e')){var _0x38da53={};_0x38da53[_0xd7f8fe['name']]={'$like':'%'+_0x177df7[_0x898b('0x40')][_0x898b('0x4c')]+'%'};return _0x38da53;}})});}_0x5e6653=_[_0x898b('0x4d')]({},_0x5e6653,_0x177df7['options']);var _0x2ad7ca={'where':_0x5e6653[_0x898b('0x4b')]};return db['ZendeskAccount'][_0x898b('0x2c')](_0x2ad7ca)[_0x898b('0x35')](function(_0x3aaf1a){_0x5e735d[_0x898b('0x2c')]=_0x3aaf1a;if(_0x177df7[_0x898b('0x40')][_0x898b('0x4f')]){_0x5e6653['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x898b('0x50')](_0x5e6653);})[_0x898b('0x35')](function(_0x4b077b){_0x5e735d[_0x898b('0x51')]=_0x4b077b;return _0x5e735d;})[_0x898b('0x35')](respondWithFilteredResult(_0x4ec638,_0x5e6653))[_0x898b('0x27')](handleError(_0x4ec638,null));};exports[_0x898b('0x52')]=function(_0x208be3,_0x463ec9){var _0x498240={'raw':![],'where':{'id':_0x208be3['params']['id']}},_0x4eab6a={};_0x4eab6a[_0x898b('0x3f')]=_[_0x898b('0x41')](db['ZendeskAccount'][_0x898b('0x53')]);_0x4eab6a[_0x898b('0x40')]=_[_0x898b('0x41')](_0x208be3[_0x898b('0x40')]);_0x4eab6a['filters']=_[_0x898b('0x43')](_0x4eab6a['model'],_0x4eab6a[_0x898b('0x40')]);_0x498240['attributes']=_[_0x898b('0x43')](_0x4eab6a[_0x898b('0x3f')],qs[_0x898b('0x45')](_0x208be3['query'][_0x898b('0x45')]));_0x498240[_0x898b('0x44')]=_0x498240[_0x898b('0x44')][_0x898b('0x46')]?_0x498240[_0x898b('0x44')]:_0x4eab6a['model'];if(_0x208be3['query'][_0x898b('0x4f')]){_0x498240[_0x898b('0x54')]=[{'all':!![]}];}_0x498240=_[_0x898b('0x4d')]({},_0x498240,_0x208be3['options']);return db[_0x898b('0x3b')]['find'](_0x498240)[_0x898b('0x35')](handleEntityNotFound(_0x463ec9,null))[_0x898b('0x35')](respondWithResult(_0x463ec9,null))['catch'](handleError(_0x463ec9,null));};exports['create']=function(_0xa15783,_0x18873f){return db[_0x898b('0x3b')]['create'](_0xa15783['body'],{})['then'](respondWithResult(_0x18873f,0xc9))[_0x898b('0x27')](handleError(_0x18873f,null));};exports[_0x898b('0x34')]=function(_0x2fe11f,_0x1fb84a){if(_0x2fe11f[_0x898b('0x55')]['id']){delete _0x2fe11f[_0x898b('0x55')]['id'];}return db['ZendeskAccount'][_0x898b('0x56')]({'where':{'id':_0x2fe11f[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x1fb84a,null))[_0x898b('0x35')](saveUpdates(_0x2fe11f[_0x898b('0x55')],null))[_0x898b('0x35')](respondWithResult(_0x1fb84a,null))['catch'](handleError(_0x1fb84a,null));};exports['destroy']=function(_0x8592e6,_0x163f51){return db[_0x898b('0x3b')][_0x898b('0x56')]({'where':{'id':_0x8592e6[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x163f51,null))['then'](removeEntity(_0x163f51,null))[_0x898b('0x27')](handleError(_0x163f51,null));};exports[_0x898b('0x58')]=function(_0x58ba5c,_0x175a76,_0x4aee80){var _0x1ca493={};var _0x29076c={};var _0xa8b62d;var _0x206fcf;return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x58ba5c[_0x898b('0x57')]['id']}})[_0x898b('0x35')](handleEntityNotFound(_0x175a76,null))['then'](function(_0x31aa89){if(_0x31aa89){_0xa8b62d=_0x31aa89;_0x29076c[_0x898b('0x3f')]=_[_0x898b('0x41')](db['ZendeskConfiguration'][_0x898b('0x53')]);_0x29076c[_0x898b('0x40')]=_[_0x898b('0x41')](_0x58ba5c[_0x898b('0x40')]);_0x29076c[_0x898b('0x42')]=_['intersection'](_0x29076c[_0x898b('0x3f')],_0x29076c[_0x898b('0x40')]);_0x1ca493[_0x898b('0x44')]=_[_0x898b('0x43')](_0x29076c['model'],qs['fields'](_0x58ba5c['query']['fields']));_0x1ca493[_0x898b('0x44')]=_0x1ca493[_0x898b('0x44')][_0x898b('0x46')]?_0x1ca493[_0x898b('0x44')]:_0x29076c[_0x898b('0x3f')];_0x1ca493[_0x898b('0x49')]=qs[_0x898b('0x4a')](_0x58ba5c[_0x898b('0x40')][_0x898b('0x4a')]);_0x1ca493[_0x898b('0x4b')]=qs[_0x898b('0x42')](_[_0x898b('0x5a')](_0x58ba5c[_0x898b('0x40')],_0x29076c[_0x898b('0x42')]));if(_0x58ba5c[_0x898b('0x40')]['filter']){_0x1ca493[_0x898b('0x4b')]=_['merge'](_0x1ca493['where'],{'$or':_[_0x898b('0x3a')](_0x1ca493[_0x898b('0x44')],function(_0xefac7a){var _0x9a1214={};_0x9a1214[_0xefac7a]={'$like':'%'+_0x58ba5c[_0x898b('0x40')][_0x898b('0x4c')]+'%'};return _0x9a1214;})});}_0x1ca493=_['merge']({},_0x1ca493,_0x58ba5c[_0x898b('0x5b')]);return _0xa8b62d['getConfigurations'](_0x1ca493);}})[_0x898b('0x35')](function(_0x30ba59){if(_0x30ba59){_0x206fcf=_0x30ba59['length'];if(!_0x58ba5c[_0x898b('0x40')][_0x898b('0x47')](_0x898b('0x48'))){_0x1ca493['limit']=qs[_0x898b('0x2e')](_0x58ba5c['query'][_0x898b('0x2e')]);_0x1ca493[_0x898b('0x2d')]=qs[_0x898b('0x2d')](_0x58ba5c[_0x898b('0x40')]['offset']);}return _0xa8b62d[_0x898b('0x58')](_0x1ca493);}})[_0x898b('0x35')](function(_0x13ffc2){if(_0x13ffc2){return _0x13ffc2?{'count':_0x206fcf,'rows':_0x13ffc2}:null;}})[_0x898b('0x35')](respondWithResult(_0x175a76,null))[_0x898b('0x27')](handleError(_0x175a76,null));};exports['addConfiguration']=function(_0x30e35c,_0xb4cb2a,_0x1232e1){if(_0x30e35c[_0x898b('0x55')]['id']){delete _0x30e35c['body']['id'];}return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x30e35c['params']['id']}})[_0x898b('0x35')](handleEntityNotFound(_0xb4cb2a,null))[_0x898b('0x35')](function(_0x1be43a){if(_0x1be43a){_0x30e35c[_0x898b('0x55')][_0x898b('0x5c')]=_0x1be43a['id'];_0x30e35c[_0x898b('0x55')][_0x898b('0x5d')]=integrations[_0x898b('0x5e')](_0x30e35c[_0x898b('0x55')][_0x898b('0x5f')],_0x30e35c[_0x898b('0x55')][_0x898b('0x3d')]);_0x30e35c[_0x898b('0x55')][_0x898b('0x60')]=integrations['getDescriptions'](_0x30e35c[_0x898b('0x55')][_0x898b('0x5f')],_0x30e35c['body'][_0x898b('0x3d')]);return db[_0x898b('0x61')]['create'](_0x30e35c[_0x898b('0x55')],{'include':[{'model':db[_0x898b('0x62')],'as':_0x898b('0x5d')},{'model':db[_0x898b('0x62')],'as':_0x898b('0x60')}]});}return null;})[_0x898b('0x35')](respondWithResult(_0xb4cb2a,null))[_0x898b('0x27')](handleError(_0xb4cb2a,null));};exports['getFields']=function(_0x4dc692,_0x58f94f,_0x3b1fd5){var _0x113648='';return db[_0x898b('0x3b')][_0x898b('0x59')]({'where':{'id':_0x4dc692[_0x898b('0x57')]['id']},'attributes':['id',_0x898b('0x63'),_0x898b('0x64'),_0x898b('0x65'),_0x898b('0x66'),_0x898b('0x67')]})[_0x898b('0x35')](handleEntityNotFound(_0x58f94f,null))[_0x898b('0x35')](function(_0x5c28f2){if(_0x5c28f2){_0x113648=_0x5c28f2['remoteUri'];var _0x5bb6c7=_0x113648[_0x898b('0x68')](-0x1);if(_0x5bb6c7==='/'){_0x113648=_0x113648[_0x898b('0x69')](0x0,_0x113648[_0x898b('0x6a')](_0x5bb6c7));}var _0x4b7633={'method':_0x898b('0x6b'),'uri':util[_0x898b('0x6c')](_0x898b('0x6d'),_0x113648,_0x898b('0x6e')),'json':!![]};switch(_0x5c28f2[_0x898b('0x66')]){case _0x898b('0x64'):_0x4b7633[_0x898b('0x6f')]={'Authorization':util[_0x898b('0x6c')]('Basic\x20%s',new Buffer(util['format'](_0x898b('0x70'),_0x5c28f2[_0x898b('0x63')],_0x5c28f2['password']))['toString']('base64'))};break;case'token':_0x4b7633[_0x898b('0x6f')]={'Authorization':util[_0x898b('0x6c')](_0x898b('0x71'),new Buffer(util['format']('%s/token:%s',_0x5c28f2[_0x898b('0x63')],_0x5c28f2[_0x898b('0x65')]))[_0x898b('0x72')](_0x898b('0x73')))};break;default:throw new db[(_0x898b('0x74'))]['ValidationError'](_0x898b('0x75'));}return rp(_0x4b7633);}})[_0x898b('0x35')](function(_0x2d9cc7){if(_0x2d9cc7){var _0x4805a9=['subject',_0x898b('0x76'),'group',_0x898b('0x77')];_[_0x898b('0x78')](_0x2d9cc7[_0x898b('0x6e')],function(_0x26d1bf){return _0x4805a9[_0x898b('0x79')](_0x26d1bf['type']);});return{'count':_0x2d9cc7[_0x898b('0x6e')][_0x898b('0x46')],'rows':_[_0x898b('0x3a')](_0x2d9cc7[_0x898b('0x6e')],function(_0x45f8bf){return{'id':_0x45f8bf['id'],'name':_0x45f8bf[_0x898b('0x7a')]>0x7?_0x45f8bf[_0x898b('0x7b')]:_0x45f8bf[_0x898b('0x3d')],'custom':_0x45f8bf[_0x898b('0x7a')]>0x7?!![]:![],'options':_0x45f8bf[_0x898b('0x7c')]?_0x45f8bf[_0x898b('0x7c')]:_0x45f8bf[_0x898b('0x7d')]?_0x45f8bf['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x58f94f,null))[_0x898b('0x27')](function(_0x40914b){var _0x4a4186=_0x4dc692['query']['test']?0x1f4:_0x40914b[_0x898b('0x7e')]||0x1f4;logger['error'](_0x898b('0x7f'),_0x898b('0x80'),_0x4a4186,JSON[_0x898b('0x81')](_0x40914b));delete _0x40914b[_0x898b('0x37')];if(_0x4a4186===0x191){_0x4a4186=0x190;}_0x58f94f[_0x898b('0x29')](_0x4a4186)[_0x898b('0x38')](_0x4dc692['query']['test']?{'message':_0x898b('0x82'),'statusCode':_0x40914b[_0x898b('0x7e')]}:_0x40914b);});}; \ No newline at end of file +var _0x566f=['getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','slice','substring','lastIndexOf','GET','format','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','json','reject','save','destroy','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','create','body','update','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions'];(function(_0x47edd1,_0x48a6c1){var _0x440a11=function(_0x46ce0){while(--_0x46ce0){_0x47edd1['push'](_0x47edd1['shift']());}};_0x440a11(++_0x48a6c1);}(_0x566f,0x124));var _0xf566=function(_0x372d9b,_0x475a22){_0x372d9b=_0x372d9b-0x0;var _0x553f17=_0x566f[_0x372d9b];return _0x553f17;};'use strict';var pdf=require(_0xf566('0x0'));var emlformat=require(_0xf566('0x1'));var rimraf=require(_0xf566('0x2'));var zipdir=require(_0xf566('0x3'));var jsonpatch=require(_0xf566('0x4'));var rp=require(_0xf566('0x5'));var moment=require(_0xf566('0x6'));var BPromise=require(_0xf566('0x7'));var Mustache=require('mustache');var util=require(_0xf566('0x8'));var path=require(_0xf566('0x9'));var sox=require(_0xf566('0xa'));var csv=require(_0xf566('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf566('0xc'));var squel=require(_0xf566('0xd'));var crypto=require(_0xf566('0xe'));var jsforce=require(_0xf566('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf566('0xb'));var querystring=require('querystring');var Papa=require(_0xf566('0x10'));var Redis=require(_0xf566('0x11'));var authService=require(_0xf566('0x12'));var qs=require(_0xf566('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf566('0x14'));var logger=require(_0xf566('0x15'))(_0xf566('0x16'));var utils=require(_0xf566('0x17'));var config=require(_0xf566('0x18'));var licenseUtil=require(_0xf566('0x19'));var db=require(_0xf566('0x1a'))['db'];var integrations=require(_0xf566('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xf566('0x1c')][_0xf566('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1ed8ab,_0x2a1b61,_0x5acc16,_0x3ed87f){return new BPromise(function(_0x591484,_0x58a073){var _0x1bce97=_0x3ed87f||client;return _0x1bce97[_0xf566('0x1e')](_0x1ed8ab,_0x5acc16)['then'](function(_0xc3f761){logger[_0xf566('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x2a1b61,_0xf566('0x20'));logger['debug'](_0xf566('0x21'),_0x2a1b61,'request\x20sent',JSON[_0xf566('0x22')](_0xc3f761));if(_0xc3f761[_0xf566('0x23')]){if(_0xc3f761['error'][_0xf566('0x24')]===0x1f4){logger[_0xf566('0x23')](_0xf566('0x25'),_0x2a1b61,_0xc3f761[_0xf566('0x23')]['message']);return _0x58a073(_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);}logger[_0xf566('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2a1b61,_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);return _0x591484(_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);}else{logger[_0xf566('0x1f')](_0xf566('0x25'),_0x2a1b61,_0xf566('0x20'));_0x591484(_0xc3f761[_0xf566('0x27')][_0xf566('0x26')]);}})[_0xf566('0x28')](function(_0x139484){logger['error'](_0xf566('0x25'),_0x2a1b61,_0x139484);_0x58a073(_0x139484);});});}function respondWithStatusCode(_0x3ae555,_0x54a2c8){_0x54a2c8=_0x54a2c8||0xcc;return function(_0x11a476){if(_0x11a476){return _0x3ae555[_0xf566('0x29')](_0x54a2c8);}return _0x3ae555[_0xf566('0x2a')](_0x54a2c8)[_0xf566('0x2b')]();};}function respondWithResult(_0x100ad3,_0x11e997){_0x11e997=_0x11e997||0xc8;return function(_0x2da964){if(_0x2da964){return _0x100ad3['status'](_0x11e997)['json'](_0x2da964);}};}function respondWithFilteredResult(_0xde2d8c,_0x368fa0){return function(_0x43d842){if(_0x43d842){var _0x232c9d=_0x43d842[_0xf566('0x2c')],_0x27bbb2=_0x368fa0[_0xf566('0x2d')],_0x1ae085=_0x368fa0[_0xf566('0x2d')]+_0x368fa0['limit'],_0x4f61ea;if(_0x1ae085>=_0x232c9d){_0x1ae085=_0x232c9d;_0x4f61ea=0xc8;}else{_0x4f61ea=0xce;}_0xde2d8c[_0xf566('0x2a')](_0x4f61ea);return _0xde2d8c[_0xf566('0x2e')]('Content-Range',_0x27bbb2+'-'+_0x1ae085+'/'+_0x232c9d)[_0xf566('0x2f')](_0x43d842);}return null;};}function patchUpdates(_0x3d7a02){return function(_0x75e8ab){try{jsonpatch['apply'](_0x75e8ab,_0x3d7a02,!![]);}catch(_0x44fbcc){return BPromise[_0xf566('0x30')](_0x44fbcc);}return _0x75e8ab[_0xf566('0x31')]();};}function saveUpdates(_0x5a5001,_0x3f885d){return function(_0x41a7ab){if(_0x41a7ab){return _0x41a7ab['update'](_0x5a5001)['then'](function(_0xb9d293){return _0xb9d293;});}return null;};}function removeEntity(_0x23d328,_0x2043f2){return function(_0x2a1026){if(_0x2a1026){return _0x2a1026[_0xf566('0x32')]()[_0xf566('0x33')](function(){_0x23d328[_0xf566('0x2a')](0xcc)[_0xf566('0x2b')]();});}};}function handleEntityNotFound(_0x2d7de5,_0x3e1af1){return function(_0x4cf6ea){if(!_0x4cf6ea){_0x2d7de5[_0xf566('0x29')](0x194);}return _0x4cf6ea;};}function handleError(_0x4b53dc,_0xb2e6c3){_0xb2e6c3=_0xb2e6c3||0x1f4;return function(_0x2751ff){logger[_0xf566('0x23')](_0x2751ff[_0xf566('0x34')]);if(_0x2751ff[_0xf566('0x35')]){delete _0x2751ff[_0xf566('0x35')];}_0x4b53dc[_0xf566('0x2a')](_0xb2e6c3)[_0xf566('0x36')](_0x2751ff);};}exports[_0xf566('0x37')]=function(_0x3f93c2,_0x385fd1){var _0x7984e2={},_0xa27799={},_0x44424b={'count':0x0,'rows':[]};var _0x3d77e5=_[_0xf566('0x38')](db[_0xf566('0x39')][_0xf566('0x3a')],function(_0x134bf4){return{'name':_0x134bf4[_0xf566('0x3b')],'type':_0x134bf4[_0xf566('0x3c')][_0xf566('0x3d')]};});_0xa27799[_0xf566('0x3e')]=_['map'](_0x3d77e5,_0xf566('0x35'));_0xa27799['query']=_['keys'](_0x3f93c2['query']);_0xa27799[_0xf566('0x3f')]=_['intersection'](_0xa27799['model'],_0xa27799[_0xf566('0x40')]);_0x7984e2['attributes']=_[_0xf566('0x41')](_0xa27799['model'],qs[_0xf566('0x42')](_0x3f93c2['query']['fields']));_0x7984e2[_0xf566('0x43')]=_0x7984e2[_0xf566('0x43')][_0xf566('0x44')]?_0x7984e2['attributes']:_0xa27799[_0xf566('0x3e')];if(!_0x3f93c2['query']['hasOwnProperty'](_0xf566('0x45'))){_0x7984e2[_0xf566('0x46')]=qs['limit'](_0x3f93c2[_0xf566('0x40')][_0xf566('0x46')]);_0x7984e2[_0xf566('0x2d')]=qs[_0xf566('0x2d')](_0x3f93c2[_0xf566('0x40')]['offset']);}_0x7984e2['order']=qs[_0xf566('0x47')](_0x3f93c2[_0xf566('0x40')][_0xf566('0x47')]);_0x7984e2[_0xf566('0x48')]=qs['filters'](_[_0xf566('0x49')](_0x3f93c2[_0xf566('0x40')],_0xa27799[_0xf566('0x3f')]),_0x3d77e5);if(_0x3f93c2[_0xf566('0x40')][_0xf566('0x4a')]){_0x7984e2[_0xf566('0x48')]=_['merge'](_0x7984e2[_0xf566('0x48')],{'$or':_[_0xf566('0x38')](_0x3d77e5,function(_0x56bf78){if(_0x56bf78['type']!=='VIRTUAL'){var _0x302e44={};_0x302e44[_0x56bf78[_0xf566('0x35')]]={'$like':'%'+_0x3f93c2[_0xf566('0x40')][_0xf566('0x4a')]+'%'};return _0x302e44;}})});}_0x7984e2=_[_0xf566('0x4b')]({},_0x7984e2,_0x3f93c2[_0xf566('0x4c')]);var _0x560ad4={'where':_0x7984e2[_0xf566('0x48')]};return db['ZendeskAccount'][_0xf566('0x2c')](_0x560ad4)['then'](function(_0x2f31e9){_0x44424b[_0xf566('0x2c')]=_0x2f31e9;if(_0x3f93c2[_0xf566('0x40')]['includeAll']){_0x7984e2[_0xf566('0x4d')]=[{'all':!![]}];}return db[_0xf566('0x39')]['findAll'](_0x7984e2);})[_0xf566('0x33')](function(_0x767343){_0x44424b[_0xf566('0x4e')]=_0x767343;return _0x44424b;})['then'](respondWithFilteredResult(_0x385fd1,_0x7984e2))['catch'](handleError(_0x385fd1,null));};exports[_0xf566('0x4f')]=function(_0x5ca9ab,_0x1af0cb){var _0x4dc6b4={'raw':![],'where':{'id':_0x5ca9ab[_0xf566('0x50')]['id']}},_0xe8c055={};_0xe8c055['model']=_[_0xf566('0x51')](db['ZendeskAccount'][_0xf566('0x3a')]);_0xe8c055[_0xf566('0x40')]=_[_0xf566('0x51')](_0x5ca9ab[_0xf566('0x40')]);_0xe8c055['filters']=_[_0xf566('0x41')](_0xe8c055[_0xf566('0x3e')],_0xe8c055[_0xf566('0x40')]);_0x4dc6b4[_0xf566('0x43')]=_['intersection'](_0xe8c055[_0xf566('0x3e')],qs[_0xf566('0x42')](_0x5ca9ab[_0xf566('0x40')]['fields']));_0x4dc6b4[_0xf566('0x43')]=_0x4dc6b4[_0xf566('0x43')][_0xf566('0x44')]?_0x4dc6b4[_0xf566('0x43')]:_0xe8c055['model'];if(_0x5ca9ab[_0xf566('0x40')][_0xf566('0x52')]){_0x4dc6b4['include']=[{'all':!![]}];}_0x4dc6b4=_[_0xf566('0x4b')]({},_0x4dc6b4,_0x5ca9ab[_0xf566('0x4c')]);return db['ZendeskAccount'][_0xf566('0x53')](_0x4dc6b4)['then'](handleEntityNotFound(_0x1af0cb,null))[_0xf566('0x33')](respondWithResult(_0x1af0cb,null))[_0xf566('0x28')](handleError(_0x1af0cb,null));};exports[_0xf566('0x54')]=function(_0x1a9708,_0x45aaf8){return db[_0xf566('0x39')][_0xf566('0x54')](_0x1a9708[_0xf566('0x55')],{})[_0xf566('0x33')](respondWithResult(_0x45aaf8,0xc9))['catch'](handleError(_0x45aaf8,null));};exports[_0xf566('0x56')]=function(_0x4d077f,_0x345530){if(_0x4d077f[_0xf566('0x55')]['id']){delete _0x4d077f[_0xf566('0x55')]['id'];}return db[_0xf566('0x39')][_0xf566('0x53')]({'where':{'id':_0x4d077f['params']['id']}})['then'](handleEntityNotFound(_0x345530,null))[_0xf566('0x33')](saveUpdates(_0x4d077f['body'],null))['then'](respondWithResult(_0x345530,null))[_0xf566('0x28')](handleError(_0x345530,null));};exports[_0xf566('0x32')]=function(_0x1a5895,_0x52bb1d){return db[_0xf566('0x39')][_0xf566('0x53')]({'where':{'id':_0x1a5895[_0xf566('0x50')]['id']}})['then'](handleEntityNotFound(_0x52bb1d,null))[_0xf566('0x33')](removeEntity(_0x52bb1d,null))['catch'](handleError(_0x52bb1d,null));};exports[_0xf566('0x57')]=function(_0x243354,_0x206a1c,_0x323838){var _0x4a57a9={};var _0x288473={};var _0x240847;var _0x3b8445;return db['ZendeskAccount'][_0xf566('0x58')]({'where':{'id':_0x243354[_0xf566('0x50')]['id']}})[_0xf566('0x33')](handleEntityNotFound(_0x206a1c,null))[_0xf566('0x33')](function(_0x577619){if(_0x577619){_0x240847=_0x577619;_0x288473[_0xf566('0x3e')]=_[_0xf566('0x51')](db['ZendeskConfiguration']['rawAttributes']);_0x288473[_0xf566('0x40')]=_[_0xf566('0x51')](_0x243354['query']);_0x288473['filters']=_[_0xf566('0x41')](_0x288473[_0xf566('0x3e')],_0x288473[_0xf566('0x40')]);_0x4a57a9[_0xf566('0x43')]=_[_0xf566('0x41')](_0x288473['model'],qs[_0xf566('0x42')](_0x243354[_0xf566('0x40')][_0xf566('0x42')]));_0x4a57a9[_0xf566('0x43')]=_0x4a57a9[_0xf566('0x43')][_0xf566('0x44')]?_0x4a57a9['attributes']:_0x288473[_0xf566('0x3e')];_0x4a57a9[_0xf566('0x59')]=qs[_0xf566('0x47')](_0x243354[_0xf566('0x40')][_0xf566('0x47')]);_0x4a57a9[_0xf566('0x48')]=qs['filters'](_[_0xf566('0x49')](_0x243354['query'],_0x288473[_0xf566('0x3f')]));if(_0x243354[_0xf566('0x40')][_0xf566('0x4a')]){_0x4a57a9[_0xf566('0x48')]=_[_0xf566('0x4b')](_0x4a57a9[_0xf566('0x48')],{'$or':_[_0xf566('0x38')](_0x4a57a9[_0xf566('0x43')],function(_0x3d1901){var _0x38bee6={};_0x38bee6[_0x3d1901]={'$like':'%'+_0x243354[_0xf566('0x40')][_0xf566('0x4a')]+'%'};return _0x38bee6;})});}_0x4a57a9=_[_0xf566('0x4b')]({},_0x4a57a9,_0x243354[_0xf566('0x4c')]);return _0x240847['getConfigurations'](_0x4a57a9);}})[_0xf566('0x33')](function(_0x47b4be){if(_0x47b4be){_0x3b8445=_0x47b4be[_0xf566('0x44')];if(!_0x243354[_0xf566('0x40')]['hasOwnProperty'](_0xf566('0x45'))){_0x4a57a9[_0xf566('0x46')]=qs[_0xf566('0x46')](_0x243354[_0xf566('0x40')][_0xf566('0x46')]);_0x4a57a9[_0xf566('0x2d')]=qs[_0xf566('0x2d')](_0x243354[_0xf566('0x40')][_0xf566('0x2d')]);}return _0x240847['getConfigurations'](_0x4a57a9);}})[_0xf566('0x33')](function(_0x3f1e6a){if(_0x3f1e6a){return _0x3f1e6a?{'count':_0x3b8445,'rows':_0x3f1e6a}:null;}})[_0xf566('0x33')](respondWithResult(_0x206a1c,null))[_0xf566('0x28')](handleError(_0x206a1c,null));};exports[_0xf566('0x5a')]=function(_0x11e25c,_0x334f00,_0xe4cd72){if(_0x11e25c['body']['id']){delete _0x11e25c[_0xf566('0x55')]['id'];}return db[_0xf566('0x39')][_0xf566('0x58')]({'where':{'id':_0x11e25c[_0xf566('0x50')]['id']}})[_0xf566('0x33')](handleEntityNotFound(_0x334f00,null))[_0xf566('0x33')](function(_0x329151){if(_0x329151){_0x11e25c[_0xf566('0x55')][_0xf566('0x5b')]=_0x329151['id'];_0x11e25c[_0xf566('0x55')][_0xf566('0x5c')]=integrations[_0xf566('0x5d')](_0x11e25c[_0xf566('0x55')]['channel'],_0x11e25c[_0xf566('0x55')]['type']);_0x11e25c[_0xf566('0x55')][_0xf566('0x5e')]=integrations[_0xf566('0x5f')](_0x11e25c[_0xf566('0x55')]['channel'],_0x11e25c[_0xf566('0x55')][_0xf566('0x3c')]);return db[_0xf566('0x60')][_0xf566('0x54')](_0x11e25c[_0xf566('0x55')],{'include':[{'model':db[_0xf566('0x61')],'as':'Subjects'},{'model':db[_0xf566('0x61')],'as':_0xf566('0x5e')}]});}return null;})['then'](respondWithResult(_0x334f00,null))['catch'](handleError(_0x334f00,null));};exports[_0xf566('0x62')]=function(_0x2d4dea,_0x560328,_0x130c95){var _0x2019ff='';return db[_0xf566('0x39')][_0xf566('0x58')]({'where':{'id':_0x2d4dea[_0xf566('0x50')]['id']},'attributes':['id',_0xf566('0x63'),'password',_0xf566('0x64'),'authType','remoteUri']})[_0xf566('0x33')](handleEntityNotFound(_0x560328,null))['then'](function(_0x377bab){if(_0x377bab){_0x2019ff=_0x377bab['remoteUri'];var _0x73797a=_0x2019ff[_0xf566('0x65')](-0x1);if(_0x73797a==='/'){_0x2019ff=_0x2019ff[_0xf566('0x66')](0x0,_0x2019ff[_0xf566('0x67')](_0x73797a));}var _0x5c5854={'method':_0xf566('0x68'),'uri':util[_0xf566('0x69')]('%s/%s',_0x2019ff,_0xf566('0x6a')),'json':!![]};switch(_0x377bab[_0xf566('0x6b')]){case _0xf566('0x6c'):_0x5c5854[_0xf566('0x6d')]={'Authorization':util[_0xf566('0x69')](_0xf566('0x6e'),new Buffer(util[_0xf566('0x69')](_0xf566('0x6f'),_0x377bab[_0xf566('0x63')],_0x377bab['password']))[_0xf566('0x70')](_0xf566('0x71')))};break;case _0xf566('0x64'):_0x5c5854['headers']={'Authorization':util['format'](_0xf566('0x6e'),new Buffer(util[_0xf566('0x69')]('%s/token:%s',_0x377bab['username'],_0x377bab[_0xf566('0x64')]))[_0xf566('0x70')]('base64'))};break;default:throw new db[(_0xf566('0x72'))]['ValidationError'](_0xf566('0x73'));}return rp(_0x5c5854);}})[_0xf566('0x33')](function(_0x322d00){if(_0x322d00){var _0x4314c9=[_0xf566('0x74'),_0xf566('0x75'),_0xf566('0x76'),_0xf566('0x77')];_[_0xf566('0x78')](_0x322d00['ticket_fields'],function(_0x57a4d1){return _0x4314c9[_0xf566('0x79')](_0x57a4d1[_0xf566('0x3c')]);});return{'count':_0x322d00[_0xf566('0x6a')][_0xf566('0x44')],'rows':_[_0xf566('0x38')](_0x322d00['ticket_fields'],function(_0x52e943){return{'id':_0x52e943['id'],'name':_0x52e943[_0xf566('0x7a')]>0x7?_0x52e943[_0xf566('0x7b')]:_0x52e943[_0xf566('0x3c')],'custom':_0x52e943[_0xf566('0x7a')]>0x7?!![]:![],'options':_0x52e943[_0xf566('0x7c')]?_0x52e943[_0xf566('0x7c')]:_0x52e943[_0xf566('0x7d')]?_0x52e943['custom_field_options']:[]};})};}})[_0xf566('0x33')](respondWithResult(_0x560328,null))[_0xf566('0x28')](function(_0x237d3c){var _0x38aa5b=_0x2d4dea['query'][_0xf566('0x7e')]?0x1f4:_0x237d3c[_0xf566('0x7f')]||0x1f4;logger[_0xf566('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xf566('0x62'),_0x38aa5b,JSON['stringify'](_0x237d3c));delete _0x237d3c[_0xf566('0x35')];if(_0x38aa5b===0x191){_0x38aa5b=0x190;}_0x560328[_0xf566('0x2a')](_0x38aa5b)['send'](_0x2d4dea['query'][_0xf566('0x7e')]?{'message':_0xf566('0x80'),'statusCode':_0x237d3c[_0xf566('0x7f')]}:_0x237d3c);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a6a9f7c..8943535 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 _0x38ab=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','../../config/logger','api','moment','bluebird'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x38ab,0x6a));var _0xb38a=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x38ab[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb38a('0x0'))(_0xb38a('0x1'));var moment=require(_0xb38a('0x2'));var BPromise=require(_0xb38a('0x3'));var rp=require(_0xb38a('0x4'));var fs=require('fs');var path=require(_0xb38a('0x5'));var rimraf=require(_0xb38a('0x6'));var config=require(_0xb38a('0x7'));var attributes=require(_0xb38a('0x8'));var integrations=require(_0xb38a('0x9'));module[_0xb38a('0xa')]=function(_0x544f81,_0x2369dd){return _0x544f81['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d4=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x21e253,_0x5f0f1c){var _0x2eea90=function(_0x3d705c){while(--_0x3d705c){_0x21e253['push'](_0x21e253['shift']());}};_0x2eea90(++_0x5f0f1c);}(_0xb3d4,0x1a4));var _0x4b3d=function(_0x4ddd02,_0x3c4b2f){_0x4ddd02=_0x4ddd02-0x0;var _0x1fcada=_0xb3d4[_0x4ddd02];return _0x1fcada;};'use strict';var _=require(_0x4b3d('0x0'));var util=require(_0x4b3d('0x1'));var logger=require(_0x4b3d('0x2'))(_0x4b3d('0x3'));var moment=require(_0x4b3d('0x4'));var BPromise=require(_0x4b3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b3d('0x6'));var rimraf=require(_0x4b3d('0x7'));var config=require(_0x4b3d('0x8'));var attributes=require(_0x4b3d('0x9'));var integrations=require(_0x4b3d('0xa'));module[_0x4b3d('0xb')]=function(_0x43baab,_0x25b979){return _0x43baab[_0x4b3d('0xc')](_0x4b3d('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index ef2a89f..4edf02d 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2a652c,_0x1facdb){var _0x52ea47=function(_0x56e5da){while(--_0x56e5da){_0x2a652c['push'](_0x2a652c['shift']());}};_0x52ea47(++_0x1facdb);}(_0x757a,0xde));var _0xa757=function(_0x43bc77,_0x3cb83f){_0x43bc77=_0x43bc77-0x0;var _0x2f4f9e=_0x757a[_0x43bc77];return _0x2f4f9e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xcb91[_0x1b64dd];return _0xeb464c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0437038..c94f005 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 _0x3cab=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3c3a86,_0x3deb37){var _0x4ff3e6=function(_0x59072c){while(--_0x59072c){_0x3c3a86['push'](_0x3c3a86['shift']());}};_0x4ff3e6(++_0x3deb37);}(_0x3cab,0x17a));var _0xb3ca=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x3cab[_0xc8db6b];return _0x12cb81;};'use strict';var multer=require(_0xb3ca('0x0'));var util=require('util');var path=require(_0xb3ca('0x1'));var timeout=require(_0xb3ca('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb3ca('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ca('0x4'));var controller=require(_0xb3ca('0x5'));router[_0xb3ca('0x6')]('/',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x8')]);router['get'](_0xb3ca('0x9'),auth['isAuthenticated'](),controller[_0xb3ca('0xa')]);router[_0xb3ca('0x6')](_0xb3ca('0xb'),auth[_0xb3ca('0x7')](),controller[_0xb3ca('0xc')]);router[_0xb3ca('0x6')](_0xb3ca('0xd'),auth['isAuthenticated'](),controller[_0xb3ca('0xe')]);router['get'](_0xb3ca('0xf'),auth['isAuthenticated'](),controller[_0xb3ca('0x10')]);router[_0xb3ca('0x6')](_0xb3ca('0x11'),auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x12')]);router['post']('/',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x13')]);router[_0xb3ca('0x14')]('/:id/tags',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x15')]);router[_0xb3ca('0x16')](_0xb3ca('0x9'),auth[_0xb3ca('0x7')](),controller['update']);router[_0xb3ca('0x17')]('/:id',auth[_0xb3ca('0x7')](),controller[_0xb3ca('0x18')]);module[_0xb3ca('0x19')]=router; \ No newline at end of file +var _0x8b6c=['index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b6c,0xd0));var _0xc8b6=function(_0xe55e34,_0x216414){_0xe55e34=_0xe55e34-0x0;var _0x3323a4=_0x8b6c[_0xe55e34];return _0x3323a4;};'use strict';var multer=require(_0xc8b6('0x0'));var util=require(_0xc8b6('0x1'));var path=require('path');var timeout=require(_0xc8b6('0x2'));var express=require(_0xc8b6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc8b6('0x4'));var config=require(_0xc8b6('0x5'));var controller=require(_0xc8b6('0x6'));router[_0xc8b6('0x7')]('/',auth['isAuthenticated'](),controller[_0xc8b6('0x8')]);router[_0xc8b6('0x7')](_0xc8b6('0x9'),auth['isAuthenticated'](),controller[_0xc8b6('0xa')]);router[_0xc8b6('0x7')](_0xc8b6('0xb'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0xd')]);router[_0xc8b6('0x7')](_0xc8b6('0xe'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0xf')]);router[_0xc8b6('0x7')]('/:id/descriptions',auth[_0xc8b6('0xc')](),controller['getDescriptions']);router[_0xc8b6('0x7')](_0xc8b6('0x10'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x11')]);router['post']('/',auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x12')]);router[_0xc8b6('0x13')](_0xc8b6('0x10'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x14')]);router['put']('/:id',auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x15')]);router['delete'](_0xc8b6('0x9'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x16')]);module[_0xc8b6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a688135..806941d 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x81d4=['sequelize','exports','STRING'];(function(_0x35535b,_0x484936){var _0x2bc934=function(_0x1b659c){while(--_0x1b659c){_0x35535b['push'](_0x35535b['shift']());}};_0x2bc934(++_0x484936);}(_0x81d4,0x180));var _0x481d=function(_0x1a2f86,_0x119ddf){_0x1a2f86=_0x1a2f86-0x0;var _0x35dcae=_0x81d4[_0x1a2f86];return _0x35dcae;};'use strict';var Sequelize=require(_0x481d('0x0'));module[_0x481d('0x1')]={'name':{'type':Sequelize[_0x481d('0x2')]},'description':{'type':Sequelize[_0x481d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f670ac9..cad0ba2 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 _0x3931=['name','send','index','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','findAll','show','params','length','includeAll','include','options','find','create','body','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','apply','update','sendStatus','stack'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x3931,0x88));var _0x1393=function(_0x1b4b82,_0x9b65e4){_0x1b4b82=_0x1b4b82-0x0;var _0x219c1b=_0x3931[_0x1b4b82];return _0x219c1b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1393('0x0'));var rimraf=require(_0x1393('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1393('0x2'));var rp=require(_0x1393('0x3'));var moment=require('moment');var BPromise=require(_0x1393('0x4'));var Mustache=require(_0x1393('0x5'));var util=require(_0x1393('0x6'));var path=require(_0x1393('0x7'));var sox=require(_0x1393('0x8'));var csv=require(_0x1393('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1393('0xa'));var squel=require('squel');var crypto=require(_0x1393('0xb'));var jsforce=require(_0x1393('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1393('0xd'));var Papa=require(_0x1393('0xe'));var Redis=require(_0x1393('0xf'));var authService=require(_0x1393('0x10'));var qs=require(_0x1393('0x11'));var as=require(_0x1393('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1393('0x13'))('api');var utils=require(_0x1393('0x14'));var config=require(_0x1393('0x15'));var licenseUtil=require(_0x1393('0x16'));var db=require(_0x1393('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1393('0x18')][_0x1393('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x257b3b,_0x113c31,_0x553cd4,_0x1f718d){return new BPromise(function(_0xe0551e,_0x5387dd){var _0x28c7d5=_0x1f718d||client;return _0x28c7d5[_0x1393('0x1a')](_0x257b3b,_0x553cd4)[_0x1393('0x1b')](function(_0x3e34e8){logger['info'](_0x1393('0x1c'),_0x113c31,_0x1393('0x1d'));logger[_0x1393('0x1e')](_0x1393('0x1f'),_0x113c31,_0x1393('0x1d'),JSON[_0x1393('0x20')](_0x3e34e8));if(_0x3e34e8[_0x1393('0x21')]){if(_0x3e34e8[_0x1393('0x21')][_0x1393('0x22')]===0x1f4){logger['error'](_0x1393('0x1c'),_0x113c31,_0x3e34e8['error'][_0x1393('0x23')]);return _0x5387dd(_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);}logger['error'](_0x1393('0x1c'),_0x113c31,_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);return _0xe0551e(_0x3e34e8[_0x1393('0x21')][_0x1393('0x23')]);}else{logger['info'](_0x1393('0x1c'),_0x113c31,_0x1393('0x1d'));_0xe0551e(_0x3e34e8[_0x1393('0x24')][_0x1393('0x23')]);}})[_0x1393('0x25')](function(_0x5be826){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x113c31,_0x5be826);_0x5387dd(_0x5be826);});});}function respondWithStatusCode(_0x438a64,_0x3d3c37){_0x3d3c37=_0x3d3c37||0xcc;return function(_0x20b293){if(_0x20b293){return _0x438a64['sendStatus'](_0x3d3c37);}return _0x438a64['status'](_0x3d3c37)['end']();};}function respondWithResult(_0x5e629e,_0x182adc){_0x182adc=_0x182adc||0xc8;return function(_0x4e1953){if(_0x4e1953){return _0x5e629e[_0x1393('0x26')](_0x182adc)[_0x1393('0x27')](_0x4e1953);}};}function respondWithFilteredResult(_0x566a6b,_0x5abc95){return function(_0x388416){if(_0x388416){var _0x4d5630=_0x388416[_0x1393('0x28')],_0x1c80f5=_0x5abc95[_0x1393('0x29')],_0x4fc91c=_0x5abc95[_0x1393('0x29')]+_0x5abc95[_0x1393('0x2a')],_0x2b75fc;if(_0x4fc91c>=_0x4d5630){_0x4fc91c=_0x4d5630;_0x2b75fc=0xc8;}else{_0x2b75fc=0xce;}_0x566a6b[_0x1393('0x26')](_0x2b75fc);return _0x566a6b['set'](_0x1393('0x2b'),_0x1c80f5+'-'+_0x4fc91c+'/'+_0x4d5630)[_0x1393('0x27')](_0x388416);}return null;};}function patchUpdates(_0x4caa0b){return function(_0x279805){try{jsonpatch[_0x1393('0x2c')](_0x279805,_0x4caa0b,!![]);}catch(_0x3b45fb){return BPromise['reject'](_0x3b45fb);}return _0x279805['save']();};}function saveUpdates(_0x2c96d5,_0x107b4a){return function(_0x5f36a9){if(_0x5f36a9){return _0x5f36a9[_0x1393('0x2d')](_0x2c96d5)[_0x1393('0x1b')](function(_0x39da4f){return _0x39da4f;});}return null;};}function removeEntity(_0x18339e,_0x17c524){return function(_0x118668){if(_0x118668){return _0x118668['destroy']()[_0x1393('0x1b')](function(){_0x18339e[_0x1393('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acb94,_0x1ac88b){return function(_0x2a0c2c){if(!_0x2a0c2c){_0x4acb94[_0x1393('0x2e')](0x194);}return _0x2a0c2c;};}function handleError(_0x448cf2,_0x27544e){_0x27544e=_0x27544e||0x1f4;return function(_0x3318a6){logger[_0x1393('0x21')](_0x3318a6[_0x1393('0x2f')]);if(_0x3318a6[_0x1393('0x30')]){delete _0x3318a6[_0x1393('0x30')];}_0x448cf2[_0x1393('0x26')](_0x27544e)[_0x1393('0x31')](_0x3318a6);};}exports[_0x1393('0x32')]=function(_0x4d36e9,_0xa9ec1f){var _0x2c5391={},_0x276637={},_0x320f74={'count':0x0,'rows':[]};var _0x6356fd=_['map'](db[_0x1393('0x33')][_0x1393('0x34')],function(_0x18ff76){return{'name':_0x18ff76['fieldName'],'type':_0x18ff76[_0x1393('0x35')][_0x1393('0x36')]};});_0x276637[_0x1393('0x37')]=_[_0x1393('0x38')](_0x6356fd,_0x1393('0x30'));_0x276637[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x4d36e9[_0x1393('0x39')]);_0x276637['filters']=_[_0x1393('0x3b')](_0x276637[_0x1393('0x37')],_0x276637['query']);_0x2c5391[_0x1393('0x3c')]=_[_0x1393('0x3b')](_0x276637[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x4d36e9[_0x1393('0x39')][_0x1393('0x3d')]));_0x2c5391[_0x1393('0x3c')]=_0x2c5391[_0x1393('0x3c')]['length']?_0x2c5391[_0x1393('0x3c')]:_0x276637[_0x1393('0x37')];if(!_0x4d36e9[_0x1393('0x39')]['hasOwnProperty'](_0x1393('0x3e'))){_0x2c5391[_0x1393('0x2a')]=qs[_0x1393('0x2a')](_0x4d36e9[_0x1393('0x39')][_0x1393('0x2a')]);_0x2c5391[_0x1393('0x29')]=qs['offset'](_0x4d36e9['query'][_0x1393('0x29')]);}_0x2c5391[_0x1393('0x3f')]=qs['sort'](_0x4d36e9['query'][_0x1393('0x40')]);_0x2c5391[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x4d36e9[_0x1393('0x39')],_0x276637[_0x1393('0x42')]),_0x6356fd);if(_0x4d36e9[_0x1393('0x39')]['filter']){_0x2c5391[_0x1393('0x41')]=_[_0x1393('0x44')](_0x2c5391[_0x1393('0x41')],{'$or':_[_0x1393('0x38')](_0x6356fd,function(_0x1104ef){if(_0x1104ef[_0x1393('0x35')]!==_0x1393('0x45')){var _0x59c75f={};_0x59c75f[_0x1104ef[_0x1393('0x30')]]={'$like':'%'+_0x4d36e9[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x59c75f;}})});}_0x2c5391=_[_0x1393('0x44')]({},_0x2c5391,_0x4d36e9['options']);var _0x10d1fa={'where':_0x2c5391[_0x1393('0x41')]};return db[_0x1393('0x33')][_0x1393('0x28')](_0x10d1fa)[_0x1393('0x1b')](function(_0x4952f5){_0x320f74[_0x1393('0x28')]=_0x4952f5;if(_0x4d36e9[_0x1393('0x39')]['includeAll']){_0x2c5391['include']=[{'all':!![]}];}return db[_0x1393('0x33')][_0x1393('0x47')](_0x2c5391);})[_0x1393('0x1b')](function(_0x3427ea){_0x320f74['rows']=_0x3427ea;return _0x320f74;})[_0x1393('0x1b')](respondWithFilteredResult(_0xa9ec1f,_0x2c5391))[_0x1393('0x25')](handleError(_0xa9ec1f,null));};exports[_0x1393('0x48')]=function(_0x235467,_0x51689c){var _0x37d7f3={'raw':![],'where':{'id':_0x235467[_0x1393('0x49')]['id']}},_0x58b6e4={};_0x58b6e4[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x33')][_0x1393('0x34')]);_0x58b6e4[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x235467[_0x1393('0x39')]);_0x58b6e4[_0x1393('0x42')]=_['intersection'](_0x58b6e4['model'],_0x58b6e4[_0x1393('0x39')]);_0x37d7f3[_0x1393('0x3c')]=_[_0x1393('0x3b')](_0x58b6e4[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x235467[_0x1393('0x39')]['fields']));_0x37d7f3['attributes']=_0x37d7f3[_0x1393('0x3c')][_0x1393('0x4a')]?_0x37d7f3[_0x1393('0x3c')]:_0x58b6e4[_0x1393('0x37')];if(_0x235467[_0x1393('0x39')][_0x1393('0x4b')]){_0x37d7f3[_0x1393('0x4c')]=[{'all':!![]}];}_0x37d7f3=_[_0x1393('0x44')]({},_0x37d7f3,_0x235467[_0x1393('0x4d')]);return db['ZendeskConfiguration'][_0x1393('0x4e')](_0x37d7f3)[_0x1393('0x1b')](handleEntityNotFound(_0x51689c,null))['then'](respondWithResult(_0x51689c,null))[_0x1393('0x25')](handleError(_0x51689c,null));};exports[_0x1393('0x4f')]=function(_0x8420f2,_0x113e97){return db['ZendeskConfiguration'][_0x1393('0x4f')](_0x8420f2[_0x1393('0x50')],{})[_0x1393('0x1b')](respondWithResult(_0x113e97,0xc9))[_0x1393('0x25')](handleError(_0x113e97,null));};exports[_0x1393('0x2d')]=function(_0x42d9bf,_0x5a24ff){if(_0x42d9bf[_0x1393('0x50')]['id']){delete _0x42d9bf[_0x1393('0x50')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x42d9bf[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a24ff,null))['then'](saveUpdates(_0x42d9bf[_0x1393('0x50')],null))[_0x1393('0x1b')](respondWithResult(_0x5a24ff,null))[_0x1393('0x25')](handleError(_0x5a24ff,null));};exports[_0x1393('0x51')]=function(_0x3d56a1,_0x120729){return db[_0x1393('0x33')][_0x1393('0x4e')]({'where':{'id':_0x3d56a1['params']['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x120729,null))[_0x1393('0x1b')](removeEntity(_0x120729,null))[_0x1393('0x25')](handleError(_0x120729,null));};exports[_0x1393('0x52')]=function(_0x3068b1,_0x45cde4,_0x4543da){var _0x103273={};var _0x33252b={};var _0x4a7fcf;var _0x18734c;return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x3068b1[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x45cde4,null))[_0x1393('0x1b')](function(_0x2f6707){if(_0x2f6707){_0x4a7fcf=_0x2f6707;_0x33252b[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x54')]['rawAttributes']);_0x33252b[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x3068b1['query']);_0x33252b[_0x1393('0x42')]=_['intersection'](_0x33252b[_0x1393('0x37')],_0x33252b[_0x1393('0x39')]);_0x103273['attributes']=_['intersection'](_0x33252b[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x3068b1[_0x1393('0x39')][_0x1393('0x3d')]));_0x103273['attributes']=_0x103273[_0x1393('0x3c')][_0x1393('0x4a')]?_0x103273[_0x1393('0x3c')]:_0x33252b[_0x1393('0x37')];_0x103273[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x3068b1['query']['sort']);_0x103273['where']=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x3068b1[_0x1393('0x39')],_0x33252b[_0x1393('0x42')]));if(_0x3068b1[_0x1393('0x39')][_0x1393('0x46')]){_0x103273[_0x1393('0x41')]=_[_0x1393('0x44')](_0x103273['where'],{'$or':_[_0x1393('0x38')](_0x103273[_0x1393('0x3c')],function(_0x464c22){var _0x209c2d={};_0x209c2d[_0x464c22]={'$like':'%'+_0x3068b1[_0x1393('0x39')]['filter']+'%'};return _0x209c2d;})});}_0x103273=_[_0x1393('0x44')]({},_0x103273,_0x3068b1[_0x1393('0x4d')]);return _0x4a7fcf['getFields'](_0x103273);}})[_0x1393('0x1b')](function(_0x28f07d){if(_0x28f07d){_0x18734c=_0x28f07d['length'];if(!_0x3068b1[_0x1393('0x39')][_0x1393('0x55')]('nolimit')){_0x103273['limit']=qs[_0x1393('0x2a')](_0x3068b1[_0x1393('0x39')][_0x1393('0x2a')]);_0x103273['offset']=qs[_0x1393('0x29')](_0x3068b1['query'][_0x1393('0x29')]);}return _0x4a7fcf['getFields'](_0x103273);}})[_0x1393('0x1b')](function(_0x506c43){if(_0x506c43){return _0x506c43?{'count':_0x18734c,'rows':_0x506c43}:null;}})[_0x1393('0x1b')](respondWithResult(_0x45cde4,null))['catch'](handleError(_0x45cde4,null));};exports[_0x1393('0x56')]=function(_0x5510ac,_0x4d6438,_0x2ebed4){var _0x10c436={};var _0x480e71={};var _0x3ff5ac;var _0x366ef4;return db['ZendeskConfiguration'][_0x1393('0x53')]({'where':{'id':_0x5510ac[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d6438,null))[_0x1393('0x1b')](function(_0x4d809f){if(_0x4d809f){_0x3ff5ac=_0x4d809f;_0x480e71['model']=_[_0x1393('0x3a')](db[_0x1393('0x54')]['rawAttributes']);_0x480e71[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x5510ac[_0x1393('0x39')]);_0x480e71[_0x1393('0x42')]=_['intersection'](_0x480e71['model'],_0x480e71[_0x1393('0x39')]);_0x10c436['attributes']=_[_0x1393('0x3b')](_0x480e71['model'],qs['fields'](_0x5510ac['query']['fields']));_0x10c436[_0x1393('0x3c')]=_0x10c436[_0x1393('0x3c')][_0x1393('0x4a')]?_0x10c436[_0x1393('0x3c')]:_0x480e71[_0x1393('0x37')];_0x10c436[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x5510ac[_0x1393('0x39')][_0x1393('0x40')]);_0x10c436[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x5510ac[_0x1393('0x39')],_0x480e71[_0x1393('0x42')]));if(_0x5510ac[_0x1393('0x39')]['filter']){_0x10c436[_0x1393('0x41')]=_[_0x1393('0x44')](_0x10c436[_0x1393('0x41')],{'$or':_['map'](_0x10c436[_0x1393('0x3c')],function(_0x29ef8d){var _0x409b97={};_0x409b97[_0x29ef8d]={'$like':'%'+_0x5510ac[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x409b97;})});}_0x10c436=_[_0x1393('0x44')]({},_0x10c436,_0x5510ac[_0x1393('0x4d')]);return _0x3ff5ac['getSubjects'](_0x10c436);}})[_0x1393('0x1b')](function(_0x372369){if(_0x372369){_0x366ef4=_0x372369['length'];if(!_0x5510ac['query']['hasOwnProperty'](_0x1393('0x3e'))){_0x10c436[_0x1393('0x2a')]=qs['limit'](_0x5510ac[_0x1393('0x39')]['limit']);_0x10c436[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x5510ac[_0x1393('0x39')][_0x1393('0x29')]);}return _0x3ff5ac[_0x1393('0x56')](_0x10c436);}})[_0x1393('0x1b')](function(_0x449c51){if(_0x449c51){return _0x449c51?{'count':_0x366ef4,'rows':_0x449c51}:null;}})[_0x1393('0x1b')](respondWithResult(_0x4d6438,null))[_0x1393('0x25')](handleError(_0x4d6438,null));};exports['getDescriptions']=function(_0x415b32,_0x4d7cca,_0x302c8b){var _0xe01a60={};var _0x27adea={};var _0x1212b5;var _0x2a06e1;return db['ZendeskConfiguration'][_0x1393('0x53')]({'where':{'id':_0x415b32[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x4d7cca,null))[_0x1393('0x1b')](function(_0x51d5f4){if(_0x51d5f4){_0x1212b5=_0x51d5f4;_0x27adea[_0x1393('0x37')]=_[_0x1393('0x3a')](db[_0x1393('0x54')][_0x1393('0x34')]);_0x27adea[_0x1393('0x39')]=_[_0x1393('0x3a')](_0x415b32[_0x1393('0x39')]);_0x27adea[_0x1393('0x42')]=_[_0x1393('0x3b')](_0x27adea[_0x1393('0x37')],_0x27adea[_0x1393('0x39')]);_0xe01a60[_0x1393('0x3c')]=_['intersection'](_0x27adea[_0x1393('0x37')],qs[_0x1393('0x3d')](_0x415b32['query']['fields']));_0xe01a60[_0x1393('0x3c')]=_0xe01a60['attributes'][_0x1393('0x4a')]?_0xe01a60[_0x1393('0x3c')]:_0x27adea['model'];_0xe01a60[_0x1393('0x3f')]=qs[_0x1393('0x40')](_0x415b32['query'][_0x1393('0x40')]);_0xe01a60[_0x1393('0x41')]=qs[_0x1393('0x42')](_[_0x1393('0x43')](_0x415b32[_0x1393('0x39')],_0x27adea['filters']));if(_0x415b32[_0x1393('0x39')][_0x1393('0x46')]){_0xe01a60[_0x1393('0x41')]=_['merge'](_0xe01a60[_0x1393('0x41')],{'$or':_[_0x1393('0x38')](_0xe01a60['attributes'],function(_0x4d3280){var _0x436542={};_0x436542[_0x4d3280]={'$like':'%'+_0x415b32[_0x1393('0x39')][_0x1393('0x46')]+'%'};return _0x436542;})});}_0xe01a60=_[_0x1393('0x44')]({},_0xe01a60,_0x415b32[_0x1393('0x4d')]);return _0x1212b5[_0x1393('0x57')](_0xe01a60);}})['then'](function(_0x1adbb9){if(_0x1adbb9){_0x2a06e1=_0x1adbb9[_0x1393('0x4a')];if(!_0x415b32[_0x1393('0x39')]['hasOwnProperty']('nolimit')){_0xe01a60['limit']=qs[_0x1393('0x2a')](_0x415b32['query'][_0x1393('0x2a')]);_0xe01a60[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x415b32[_0x1393('0x39')][_0x1393('0x29')]);}return _0x1212b5[_0x1393('0x57')](_0xe01a60);}})[_0x1393('0x1b')](function(_0x56e6bd){if(_0x56e6bd){return _0x56e6bd?{'count':_0x2a06e1,'rows':_0x56e6bd}:null;}})['then'](respondWithResult(_0x4d7cca,null))[_0x1393('0x25')](handleError(_0x4d7cca,null));};exports[_0x1393('0x58')]=function(_0x295be1,_0x22e0a0,_0x39a2a2){var _0x56023d={};var _0x24d370={};var _0x1f7fa3;var _0x598a02;return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x295be1[_0x1393('0x49')]['id']}})['then'](handleEntityNotFound(_0x22e0a0,null))[_0x1393('0x1b')](function(_0x2482b0){if(_0x2482b0){_0x1f7fa3=_0x2482b0;_0x24d370[_0x1393('0x37')]=_['keys'](db[_0x1393('0x59')][_0x1393('0x34')]);_0x24d370['query']=_[_0x1393('0x3a')](_0x295be1[_0x1393('0x39')]);_0x24d370[_0x1393('0x42')]=_[_0x1393('0x3b')](_0x24d370[_0x1393('0x37')],_0x24d370[_0x1393('0x39')]);_0x56023d['attributes']=_['intersection'](_0x24d370['model'],qs[_0x1393('0x3d')](_0x295be1[_0x1393('0x39')][_0x1393('0x3d')]));_0x56023d['attributes']=_0x56023d['attributes'][_0x1393('0x4a')]?_0x56023d[_0x1393('0x3c')]:_0x24d370[_0x1393('0x37')];_0x56023d[_0x1393('0x3f')]=qs['sort'](_0x295be1[_0x1393('0x39')][_0x1393('0x40')]);_0x56023d[_0x1393('0x41')]=qs['filters'](_[_0x1393('0x43')](_0x295be1[_0x1393('0x39')],_0x24d370['filters']));if(_0x295be1[_0x1393('0x39')][_0x1393('0x46')]){_0x56023d['where']=_['merge'](_0x56023d[_0x1393('0x41')],{'$or':_['map'](_0x56023d[_0x1393('0x3c')],function(_0xed6f09){var _0x4825fd={};_0x4825fd[_0xed6f09]={'$like':'%'+_0x295be1[_0x1393('0x39')]['filter']+'%'};return _0x4825fd;})});}_0x56023d=_['merge']({},_0x56023d,_0x295be1[_0x1393('0x4d')]);return _0x1f7fa3[_0x1393('0x58')](_0x56023d);}})['then'](function(_0x4b35ed){if(_0x4b35ed){_0x598a02=_0x4b35ed[_0x1393('0x4a')];if(!_0x295be1[_0x1393('0x39')][_0x1393('0x55')](_0x1393('0x3e'))){_0x56023d['limit']=qs[_0x1393('0x2a')](_0x295be1[_0x1393('0x39')]['limit']);_0x56023d[_0x1393('0x29')]=qs[_0x1393('0x29')](_0x295be1[_0x1393('0x39')]['offset']);}return _0x1f7fa3['getTags'](_0x56023d);}})[_0x1393('0x1b')](function(_0x5e2638){if(_0x5e2638){return _0x5e2638?{'count':_0x598a02,'rows':_0x5e2638}:null;}})[_0x1393('0x1b')](respondWithResult(_0x22e0a0,null))['catch'](handleError(_0x22e0a0,null));};exports[_0x1393('0x5a')]=function(_0x545220,_0x519c19,_0x33e58a){if(_0x545220['body']['id']){delete _0x545220['body']['id'];}return db[_0x1393('0x33')][_0x1393('0x53')]({'where':{'id':_0x545220[_0x1393('0x49')]['id']}})[_0x1393('0x1b')](handleEntityNotFound(_0x519c19,null))[_0x1393('0x1b')](function(_0x495e62){if(_0x495e62){return _0x495e62[_0x1393('0x5a')](_0x545220[_0x1393('0x50')][_0x1393('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x519c19,null))['catch'](handleError(_0x519c19,null));}; \ No newline at end of file +var _0x30a7=['merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','order','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0x30a7,0x1dd));var _0x730a=function(_0x61cadb,_0x365632){_0x61cadb=_0x61cadb-0x0;var _0x55ef4e=_0x30a7[_0x61cadb];return _0x55ef4e;};'use strict';var pdf=require(_0x730a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x730a('0x1'));var jsonpatch=require(_0x730a('0x2'));var rp=require('request-promise');var moment=require(_0x730a('0x3'));var BPromise=require(_0x730a('0x4'));var Mustache=require(_0x730a('0x5'));var util=require('util');var path=require(_0x730a('0x6'));var sox=require('sox');var csv=require(_0x730a('0x7'));var ejs=require(_0x730a('0x8'));var fs=require('fs');var _=require(_0x730a('0x9'));var squel=require(_0x730a('0xa'));var crypto=require(_0x730a('0xb'));var jsforce=require(_0x730a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x730a('0xd'));var authService=require(_0x730a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x730a('0xf'));var hardwareService=require(_0x730a('0x10'));var logger=require(_0x730a('0x11'))('api');var utils=require(_0x730a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x730a('0x13'));var client=jayson[_0x730a('0x14')][_0x730a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x26edeb,_0x376340,_0x3f5761,_0x1f3aed){return new BPromise(function(_0x254900,_0x3124bd){var _0x39e7b8=_0x1f3aed||client;return _0x39e7b8[_0x730a('0x16')](_0x26edeb,_0x3f5761)[_0x730a('0x17')](function(_0x4d4378){logger['info'](_0x730a('0x18'),_0x376340,_0x730a('0x19'));logger[_0x730a('0x1a')](_0x730a('0x1b'),_0x376340,'request\x20sent',JSON['stringify'](_0x4d4378));if(_0x4d4378[_0x730a('0x1c')]){if(_0x4d4378[_0x730a('0x1c')][_0x730a('0x1d')]===0x1f4){logger['error'](_0x730a('0x18'),_0x376340,_0x4d4378['error']['message']);return _0x3124bd(_0x4d4378[_0x730a('0x1c')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x376340,_0x4d4378['error']['message']);return _0x254900(_0x4d4378[_0x730a('0x1c')][_0x730a('0x1e')]);}else{logger[_0x730a('0x1f')](_0x730a('0x18'),_0x376340,_0x730a('0x19'));_0x254900(_0x4d4378[_0x730a('0x20')][_0x730a('0x1e')]);}})['catch'](function(_0x279df9){logger[_0x730a('0x1c')](_0x730a('0x18'),_0x376340,_0x279df9);_0x3124bd(_0x279df9);});});}function respondWithStatusCode(_0x20775a,_0x31c491){_0x31c491=_0x31c491||0xcc;return function(_0x1ed965){if(_0x1ed965){return _0x20775a[_0x730a('0x21')](_0x31c491);}return _0x20775a[_0x730a('0x22')](_0x31c491)['end']();};}function respondWithResult(_0x5518e4,_0x169e12){_0x169e12=_0x169e12||0xc8;return function(_0x14ef41){if(_0x14ef41){return _0x5518e4[_0x730a('0x22')](_0x169e12)[_0x730a('0x23')](_0x14ef41);}};}function respondWithFilteredResult(_0x40bb7f,_0x34a56c){return function(_0x31be29){if(_0x31be29){var _0x98a28c=_0x31be29[_0x730a('0x24')],_0x1864cb=_0x34a56c[_0x730a('0x25')],_0x136958=_0x34a56c['offset']+_0x34a56c[_0x730a('0x26')],_0xc925f4;if(_0x136958>=_0x98a28c){_0x136958=_0x98a28c;_0xc925f4=0xc8;}else{_0xc925f4=0xce;}_0x40bb7f[_0x730a('0x22')](_0xc925f4);return _0x40bb7f[_0x730a('0x27')](_0x730a('0x28'),_0x1864cb+'-'+_0x136958+'/'+_0x98a28c)['json'](_0x31be29);}return null;};}function patchUpdates(_0x592625){return function(_0x5c6b6e){try{jsonpatch['apply'](_0x5c6b6e,_0x592625,!![]);}catch(_0x416f9f){return BPromise['reject'](_0x416f9f);}return _0x5c6b6e[_0x730a('0x29')]();};}function saveUpdates(_0x447364,_0x2d7a62){return function(_0x4d7f97){if(_0x4d7f97){return _0x4d7f97[_0x730a('0x2a')](_0x447364)[_0x730a('0x17')](function(_0x2c5d18){return _0x2c5d18;});}return null;};}function removeEntity(_0x5d3ec2,_0x1a82ce){return function(_0x51b980){if(_0x51b980){return _0x51b980[_0x730a('0x2b')]()[_0x730a('0x17')](function(){_0x5d3ec2[_0x730a('0x22')](0xcc)[_0x730a('0x2c')]();});}};}function handleEntityNotFound(_0x139a5a,_0x551458){return function(_0x22f3f3){if(!_0x22f3f3){_0x139a5a[_0x730a('0x21')](0x194);}return _0x22f3f3;};}function handleError(_0x1b0d2b,_0x36c425){_0x36c425=_0x36c425||0x1f4;return function(_0x16bd07){logger['error'](_0x16bd07[_0x730a('0x2d')]);if(_0x16bd07[_0x730a('0x2e')]){delete _0x16bd07[_0x730a('0x2e')];}_0x1b0d2b[_0x730a('0x22')](_0x36c425)[_0x730a('0x2f')](_0x16bd07);};}exports[_0x730a('0x30')]=function(_0xd24a78,_0x2ac578){var _0x1b25d8={},_0x166eca={},_0x3b33cb={'count':0x0,'rows':[]};var _0x2bb230=_[_0x730a('0x31')](db[_0x730a('0x32')][_0x730a('0x33')],function(_0x57faf2){return{'name':_0x57faf2[_0x730a('0x34')],'type':_0x57faf2[_0x730a('0x35')][_0x730a('0x36')]};});_0x166eca[_0x730a('0x37')]=_['map'](_0x2bb230,_0x730a('0x2e'));_0x166eca[_0x730a('0x38')]=_[_0x730a('0x39')](_0xd24a78[_0x730a('0x38')]);_0x166eca['filters']=_[_0x730a('0x3a')](_0x166eca[_0x730a('0x37')],_0x166eca[_0x730a('0x38')]);_0x1b25d8[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x166eca['model'],qs['fields'](_0xd24a78[_0x730a('0x38')][_0x730a('0x3c')]));_0x1b25d8[_0x730a('0x3b')]=_0x1b25d8[_0x730a('0x3b')][_0x730a('0x3d')]?_0x1b25d8['attributes']:_0x166eca[_0x730a('0x37')];if(!_0xd24a78[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x1b25d8[_0x730a('0x26')]=qs[_0x730a('0x26')](_0xd24a78['query'][_0x730a('0x26')]);_0x1b25d8[_0x730a('0x25')]=qs[_0x730a('0x25')](_0xd24a78['query'][_0x730a('0x25')]);}_0x1b25d8['order']=qs['sort'](_0xd24a78[_0x730a('0x38')][_0x730a('0x40')]);_0x1b25d8[_0x730a('0x41')]=qs[_0x730a('0x42')](_['pick'](_0xd24a78[_0x730a('0x38')],_0x166eca[_0x730a('0x42')]),_0x2bb230);if(_0xd24a78[_0x730a('0x38')][_0x730a('0x43')]){_0x1b25d8[_0x730a('0x41')]=_['merge'](_0x1b25d8[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x2bb230,function(_0x2de619){if(_0x2de619[_0x730a('0x35')]!==_0x730a('0x44')){var _0x313e47={};_0x313e47[_0x2de619[_0x730a('0x2e')]]={'$like':'%'+_0xd24a78[_0x730a('0x38')][_0x730a('0x43')]+'%'};return _0x313e47;}})});}_0x1b25d8=_[_0x730a('0x45')]({},_0x1b25d8,_0xd24a78[_0x730a('0x46')]);var _0x2fd84f={'where':_0x1b25d8[_0x730a('0x41')]};return db['ZendeskConfiguration'][_0x730a('0x24')](_0x2fd84f)[_0x730a('0x17')](function(_0x4bb3ff){_0x3b33cb['count']=_0x4bb3ff;if(_0xd24a78[_0x730a('0x38')][_0x730a('0x47')]){_0x1b25d8[_0x730a('0x48')]=[{'all':!![]}];}return db[_0x730a('0x32')][_0x730a('0x49')](_0x1b25d8);})[_0x730a('0x17')](function(_0x2d7105){_0x3b33cb[_0x730a('0x4a')]=_0x2d7105;return _0x3b33cb;})['then'](respondWithFilteredResult(_0x2ac578,_0x1b25d8))[_0x730a('0x4b')](handleError(_0x2ac578,null));};exports['show']=function(_0x44316b,_0xa59fcc){var _0x24cf5c={'raw':![],'where':{'id':_0x44316b[_0x730a('0x4c')]['id']}},_0x20f6e0={};_0x20f6e0[_0x730a('0x37')]=_[_0x730a('0x39')](db['ZendeskConfiguration'][_0x730a('0x33')]);_0x20f6e0[_0x730a('0x38')]=_['keys'](_0x44316b[_0x730a('0x38')]);_0x20f6e0[_0x730a('0x42')]=_[_0x730a('0x3a')](_0x20f6e0[_0x730a('0x37')],_0x20f6e0[_0x730a('0x38')]);_0x24cf5c[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x20f6e0[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x44316b['query'][_0x730a('0x3c')]));_0x24cf5c[_0x730a('0x3b')]=_0x24cf5c[_0x730a('0x3b')][_0x730a('0x3d')]?_0x24cf5c[_0x730a('0x3b')]:_0x20f6e0['model'];if(_0x44316b['query'][_0x730a('0x47')]){_0x24cf5c[_0x730a('0x48')]=[{'all':!![]}];}_0x24cf5c=_[_0x730a('0x45')]({},_0x24cf5c,_0x44316b[_0x730a('0x46')]);return db['ZendeskConfiguration'][_0x730a('0x4d')](_0x24cf5c)[_0x730a('0x17')](handleEntityNotFound(_0xa59fcc,null))[_0x730a('0x17')](respondWithResult(_0xa59fcc,null))['catch'](handleError(_0xa59fcc,null));};exports[_0x730a('0x4e')]=function(_0x24c336,_0x35008b){return db[_0x730a('0x32')]['create'](_0x24c336[_0x730a('0x4f')],{})[_0x730a('0x17')](respondWithResult(_0x35008b,0xc9))[_0x730a('0x4b')](handleError(_0x35008b,null));};exports['update']=function(_0x3e41c8,_0x3670e9){if(_0x3e41c8[_0x730a('0x4f')]['id']){delete _0x3e41c8[_0x730a('0x4f')]['id'];}return db['ZendeskConfiguration'][_0x730a('0x4d')]({'where':{'id':_0x3e41c8[_0x730a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3670e9,null))[_0x730a('0x17')](saveUpdates(_0x3e41c8[_0x730a('0x4f')],null))[_0x730a('0x17')](respondWithResult(_0x3670e9,null))[_0x730a('0x4b')](handleError(_0x3670e9,null));};exports[_0x730a('0x2b')]=function(_0x2b8a82,_0x2a55c5){return db[_0x730a('0x32')][_0x730a('0x4d')]({'where':{'id':_0x2b8a82['params']['id']}})['then'](handleEntityNotFound(_0x2a55c5,null))[_0x730a('0x17')](removeEntity(_0x2a55c5,null))['catch'](handleError(_0x2a55c5,null));};exports[_0x730a('0x50')]=function(_0x3fca8e,_0x4b4dbf,_0x3aa1d4){var _0x424b96={};var _0x1d9351={};var _0x173853;var _0x2ae236;return db['ZendeskConfiguration'][_0x730a('0x51')]({'where':{'id':_0x3fca8e['params']['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x4b4dbf,null))[_0x730a('0x17')](function(_0x54de2a){if(_0x54de2a){_0x173853=_0x54de2a;_0x1d9351['model']=_[_0x730a('0x39')](db[_0x730a('0x52')][_0x730a('0x33')]);_0x1d9351['query']=_[_0x730a('0x39')](_0x3fca8e[_0x730a('0x38')]);_0x1d9351[_0x730a('0x42')]=_['intersection'](_0x1d9351[_0x730a('0x37')],_0x1d9351[_0x730a('0x38')]);_0x424b96[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x1d9351[_0x730a('0x37')],qs['fields'](_0x3fca8e[_0x730a('0x38')]['fields']));_0x424b96['attributes']=_0x424b96[_0x730a('0x3b')][_0x730a('0x3d')]?_0x424b96[_0x730a('0x3b')]:_0x1d9351[_0x730a('0x37')];_0x424b96[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x3fca8e[_0x730a('0x38')][_0x730a('0x40')]);_0x424b96[_0x730a('0x41')]=qs[_0x730a('0x42')](_[_0x730a('0x54')](_0x3fca8e[_0x730a('0x38')],_0x1d9351[_0x730a('0x42')]));if(_0x3fca8e[_0x730a('0x38')][_0x730a('0x43')]){_0x424b96[_0x730a('0x41')]=_['merge'](_0x424b96['where'],{'$or':_[_0x730a('0x31')](_0x424b96['attributes'],function(_0x1d1b79){var _0xfd8309={};_0xfd8309[_0x1d1b79]={'$like':'%'+_0x3fca8e['query'][_0x730a('0x43')]+'%'};return _0xfd8309;})});}_0x424b96=_[_0x730a('0x45')]({},_0x424b96,_0x3fca8e[_0x730a('0x46')]);return _0x173853[_0x730a('0x50')](_0x424b96);}})[_0x730a('0x17')](function(_0xcbff48){if(_0xcbff48){_0x2ae236=_0xcbff48[_0x730a('0x3d')];if(!_0x3fca8e[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x424b96[_0x730a('0x26')]=qs['limit'](_0x3fca8e[_0x730a('0x38')]['limit']);_0x424b96['offset']=qs[_0x730a('0x25')](_0x3fca8e[_0x730a('0x38')][_0x730a('0x25')]);}return _0x173853[_0x730a('0x50')](_0x424b96);}})[_0x730a('0x17')](function(_0xc9b077){if(_0xc9b077){return _0xc9b077?{'count':_0x2ae236,'rows':_0xc9b077}:null;}})[_0x730a('0x17')](respondWithResult(_0x4b4dbf,null))[_0x730a('0x4b')](handleError(_0x4b4dbf,null));};exports['getSubjects']=function(_0x376d18,_0x5dcf3a,_0x43a9d6){var _0x1ef247={};var _0xc8131f={};var _0x3ef78a;var _0x570e0e;return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x376d18[_0x730a('0x4c')]['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x5dcf3a,null))[_0x730a('0x17')](function(_0xab77){if(_0xab77){_0x3ef78a=_0xab77;_0xc8131f[_0x730a('0x37')]=_[_0x730a('0x39')](db[_0x730a('0x52')][_0x730a('0x33')]);_0xc8131f[_0x730a('0x38')]=_['keys'](_0x376d18[_0x730a('0x38')]);_0xc8131f[_0x730a('0x42')]=_[_0x730a('0x3a')](_0xc8131f[_0x730a('0x37')],_0xc8131f[_0x730a('0x38')]);_0x1ef247['attributes']=_[_0x730a('0x3a')](_0xc8131f[_0x730a('0x37')],qs['fields'](_0x376d18['query'][_0x730a('0x3c')]));_0x1ef247[_0x730a('0x3b')]=_0x1ef247[_0x730a('0x3b')][_0x730a('0x3d')]?_0x1ef247[_0x730a('0x3b')]:_0xc8131f[_0x730a('0x37')];_0x1ef247[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x376d18['query'][_0x730a('0x40')]);_0x1ef247['where']=qs[_0x730a('0x42')](_['pick'](_0x376d18[_0x730a('0x38')],_0xc8131f[_0x730a('0x42')]));if(_0x376d18[_0x730a('0x38')][_0x730a('0x43')]){_0x1ef247[_0x730a('0x41')]=_['merge'](_0x1ef247[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x1ef247['attributes'],function(_0x5c1c75){var _0x593ab5={};_0x593ab5[_0x5c1c75]={'$like':'%'+_0x376d18[_0x730a('0x38')][_0x730a('0x43')]+'%'};return _0x593ab5;})});}_0x1ef247=_[_0x730a('0x45')]({},_0x1ef247,_0x376d18['options']);return _0x3ef78a[_0x730a('0x55')](_0x1ef247);}})[_0x730a('0x17')](function(_0x200dfe){if(_0x200dfe){_0x570e0e=_0x200dfe['length'];if(!_0x376d18[_0x730a('0x38')][_0x730a('0x3e')]('nolimit')){_0x1ef247[_0x730a('0x26')]=qs[_0x730a('0x26')](_0x376d18[_0x730a('0x38')][_0x730a('0x26')]);_0x1ef247[_0x730a('0x25')]=qs[_0x730a('0x25')](_0x376d18[_0x730a('0x38')][_0x730a('0x25')]);}return _0x3ef78a['getSubjects'](_0x1ef247);}})[_0x730a('0x17')](function(_0x2b9a56){if(_0x2b9a56){return _0x2b9a56?{'count':_0x570e0e,'rows':_0x2b9a56}:null;}})['then'](respondWithResult(_0x5dcf3a,null))['catch'](handleError(_0x5dcf3a,null));};exports[_0x730a('0x56')]=function(_0x19f976,_0x286ad4,_0x112531){var _0x197b2f={};var _0x249dcc={};var _0x34d76a;var _0x339eaf;return db[_0x730a('0x32')]['findOne']({'where':{'id':_0x19f976[_0x730a('0x4c')]['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x286ad4,null))[_0x730a('0x17')](function(_0x1cade7){if(_0x1cade7){_0x34d76a=_0x1cade7;_0x249dcc['model']=_[_0x730a('0x39')](db['ZendeskField'][_0x730a('0x33')]);_0x249dcc[_0x730a('0x38')]=_['keys'](_0x19f976[_0x730a('0x38')]);_0x249dcc[_0x730a('0x42')]=_['intersection'](_0x249dcc[_0x730a('0x37')],_0x249dcc['query']);_0x197b2f[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x249dcc[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x19f976[_0x730a('0x38')]['fields']));_0x197b2f[_0x730a('0x3b')]=_0x197b2f[_0x730a('0x3b')][_0x730a('0x3d')]?_0x197b2f['attributes']:_0x249dcc[_0x730a('0x37')];_0x197b2f[_0x730a('0x53')]=qs['sort'](_0x19f976[_0x730a('0x38')][_0x730a('0x40')]);_0x197b2f[_0x730a('0x41')]=qs['filters'](_[_0x730a('0x54')](_0x19f976[_0x730a('0x38')],_0x249dcc[_0x730a('0x42')]));if(_0x19f976[_0x730a('0x38')][_0x730a('0x43')]){_0x197b2f[_0x730a('0x41')]=_[_0x730a('0x45')](_0x197b2f['where'],{'$or':_[_0x730a('0x31')](_0x197b2f[_0x730a('0x3b')],function(_0x1e8dbe){var _0x24a3df={};_0x24a3df[_0x1e8dbe]={'$like':'%'+_0x19f976['query'][_0x730a('0x43')]+'%'};return _0x24a3df;})});}_0x197b2f=_[_0x730a('0x45')]({},_0x197b2f,_0x19f976[_0x730a('0x46')]);return _0x34d76a[_0x730a('0x56')](_0x197b2f);}})[_0x730a('0x17')](function(_0x4e6fd1){if(_0x4e6fd1){_0x339eaf=_0x4e6fd1[_0x730a('0x3d')];if(!_0x19f976[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x197b2f[_0x730a('0x26')]=qs['limit'](_0x19f976[_0x730a('0x38')][_0x730a('0x26')]);_0x197b2f[_0x730a('0x25')]=qs['offset'](_0x19f976[_0x730a('0x38')][_0x730a('0x25')]);}return _0x34d76a[_0x730a('0x56')](_0x197b2f);}})[_0x730a('0x17')](function(_0x57a439){if(_0x57a439){return _0x57a439?{'count':_0x339eaf,'rows':_0x57a439}:null;}})['then'](respondWithResult(_0x286ad4,null))[_0x730a('0x4b')](handleError(_0x286ad4,null));};exports['getTags']=function(_0x3f27a4,_0x3d74e9,_0x206ff4){var _0x34e90a={};var _0x57edba={};var _0x48981e;var _0x45a642;return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x3f27a4['params']['id']}})['then'](handleEntityNotFound(_0x3d74e9,null))[_0x730a('0x17')](function(_0x257337){if(_0x257337){_0x48981e=_0x257337;_0x57edba['model']=_['keys'](db[_0x730a('0x57')][_0x730a('0x33')]);_0x57edba[_0x730a('0x38')]=_['keys'](_0x3f27a4[_0x730a('0x38')]);_0x57edba[_0x730a('0x42')]=_[_0x730a('0x3a')](_0x57edba[_0x730a('0x37')],_0x57edba[_0x730a('0x38')]);_0x34e90a[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x57edba[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x3c')]));_0x34e90a[_0x730a('0x3b')]=_0x34e90a['attributes']['length']?_0x34e90a[_0x730a('0x3b')]:_0x57edba[_0x730a('0x37')];_0x34e90a[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x40')]);_0x34e90a[_0x730a('0x41')]=qs[_0x730a('0x42')](_['pick'](_0x3f27a4[_0x730a('0x38')],_0x57edba['filters']));if(_0x3f27a4[_0x730a('0x38')][_0x730a('0x43')]){_0x34e90a[_0x730a('0x41')]=_[_0x730a('0x45')](_0x34e90a[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x34e90a[_0x730a('0x3b')],function(_0x4620d0){var _0x5f09d8={};_0x5f09d8[_0x4620d0]={'$like':'%'+_0x3f27a4['query'][_0x730a('0x43')]+'%'};return _0x5f09d8;})});}_0x34e90a=_['merge']({},_0x34e90a,_0x3f27a4[_0x730a('0x46')]);return _0x48981e[_0x730a('0x58')](_0x34e90a);}})[_0x730a('0x17')](function(_0x499ac8){if(_0x499ac8){_0x45a642=_0x499ac8[_0x730a('0x3d')];if(!_0x3f27a4[_0x730a('0x38')][_0x730a('0x3e')]('nolimit')){_0x34e90a['limit']=qs['limit'](_0x3f27a4[_0x730a('0x38')][_0x730a('0x26')]);_0x34e90a['offset']=qs[_0x730a('0x25')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x25')]);}return _0x48981e[_0x730a('0x58')](_0x34e90a);}})[_0x730a('0x17')](function(_0x178dbb){if(_0x178dbb){return _0x178dbb?{'count':_0x45a642,'rows':_0x178dbb}:null;}})[_0x730a('0x17')](respondWithResult(_0x3d74e9,null))[_0x730a('0x4b')](handleError(_0x3d74e9,null));};exports[_0x730a('0x59')]=function(_0x5b0ebc,_0x9a2cb4,_0xc56625){if(_0x5b0ebc[_0x730a('0x4f')]['id']){delete _0x5b0ebc[_0x730a('0x4f')]['id'];}return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x5b0ebc['params']['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x9a2cb4,null))[_0x730a('0x17')](function(_0xb44381){if(_0xb44381){return _0xb44381[_0x730a('0x59')](_0x5b0ebc[_0x730a('0x4f')][_0x730a('0x5a')]||[]);}return null;})[_0x730a('0x17')](respondWithResult(_0x9a2cb4,null))['catch'](handleError(_0x9a2cb4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7f7756d..8503cf5 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 _0x6344=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x44ae78,_0x30a80e){var _0x52906b=function(_0x26d2ab){while(--_0x26d2ab){_0x44ae78['push'](_0x44ae78['shift']());}};_0x52906b(++_0x30a80e);}(_0x6344,0x1b0));var _0x4634=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6344[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4634('0x0'));var util=require('util');var logger=require(_0x4634('0x1'))(_0x4634('0x2'));var moment=require(_0x4634('0x3'));var BPromise=require(_0x4634('0x4'));var rp=require(_0x4634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4634('0x6'));var config=require(_0x4634('0x7'));var attributes=require(_0x4634('0x8'));module[_0x4634('0x9')]=function(_0x27757e,_0x1a1a78){return _0x27757e['define'](_0x4634('0xa'),attributes,{'tableName':_0x4634('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf8f=['rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path'];(function(_0x4bcbc2,_0x46cbff){var _0xe5b888=function(_0xd3a99d){while(--_0xd3a99d){_0x4bcbc2['push'](_0x4bcbc2['shift']());}};_0xe5b888(++_0x46cbff);}(_0xcf8f,0xa5));var _0xfcf8=function(_0x4738dd,_0x2538fb){_0x4738dd=_0x4738dd-0x0;var _0x442194=_0xcf8f[_0x4738dd];return _0x442194;};'use strict';var _=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var logger=require(_0xfcf8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfcf8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf8('0x4'));var rimraf=require(_0xfcf8('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcf8('0x6'));module[_0xfcf8('0x7')]=function(_0x188cfb,_0x301f7a){return _0x188cfb[_0xfcf8('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xfcf8('0x9'),'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 ed51306..79c9e4a 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 _0x03af=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x89c8e9,_0x442d36){var _0x88cbf9=function(_0x4ef57d){while(--_0x4ef57d){_0x89c8e9['push'](_0x89c8e9['shift']());}};_0x88cbf9(++_0x442d36);}(_0x03af,0xc5));var _0xf03a=function(_0x4ddc25,_0x313973){_0x4ddc25=_0x4ddc25-0x0;var _0x3eeca0=_0x03af[_0x4ddc25];return _0x3eeca0;};'use strict';var _=require(_0xf03a('0x0'));var util=require(_0xf03a('0x1'));var moment=require('moment');var BPromise=require(_0xf03a('0x2'));var rs=require(_0xf03a('0x3'));var fs=require('fs');var Redis=require(_0xf03a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf03a('0x5'));var logger=require(_0xf03a('0x6'))(_0xf03a('0x7'));var config=require(_0xf03a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf03a('0x9')][_0xf03a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208b8e,_0x48b6b6,_0x4e053a){return new BPromise(function(_0x57f95f,_0x8dcc3e){return client[_0xf03a('0xb')](_0x208b8e,_0x4e053a)[_0xf03a('0xc')](function(_0x269697){logger[_0xf03a('0xd')](_0xf03a('0xe'),_0x48b6b6,_0xf03a('0xf'));logger[_0xf03a('0x10')](_0xf03a('0x11'),_0x48b6b6,_0xf03a('0xf'),JSON['stringify'](_0x269697));if(_0x269697[_0xf03a('0x12')]){if(_0x269697[_0xf03a('0x12')]['code']===0x1f4){logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x269697[_0xf03a('0x12')][_0xf03a('0x13')]);return _0x8dcc3e(_0x269697['error'][_0xf03a('0x13')]);}logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x269697['error'][_0xf03a('0x13')]);return _0x57f95f(_0x269697[_0xf03a('0x12')][_0xf03a('0x13')]);}else{logger[_0xf03a('0xd')](_0xf03a('0xe'),_0x48b6b6,_0xf03a('0xf'));_0x57f95f(_0x269697[_0xf03a('0x14')][_0xf03a('0x13')]);}})[_0xf03a('0x15')](function(_0x27f26d){logger[_0xf03a('0x12')](_0xf03a('0xe'),_0x48b6b6,_0x27f26d);_0x8dcc3e(_0x27f26d);});});} \ No newline at end of file +var _0x8e44=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e44,0x111));var _0x48e4=function(_0x2bda7e,_0x2b6d2f){_0x2bda7e=_0x2bda7e-0x0;var _0x10a523=_0x8e44[_0x2bda7e];return _0x10a523;};'use strict';var _=require(_0x48e4('0x0'));var util=require('util');var moment=require(_0x48e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x48e4('0x2'));var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48e4('0x4'))(_0x48e4('0x5'));var config=require(_0x48e4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x48e4('0x7')][_0x48e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40cbb7,_0x44a4f2,_0x22abe1){return new BPromise(function(_0x58638e,_0xefdc62){return client[_0x48e4('0x9')](_0x40cbb7,_0x22abe1)[_0x48e4('0xa')](function(_0x567a6c){logger[_0x48e4('0xb')](_0x48e4('0xc'),_0x44a4f2,_0x48e4('0xd'));logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x44a4f2,_0x48e4('0xd'),JSON[_0x48e4('0x10')](_0x567a6c));if(_0x567a6c['error']){if(_0x567a6c[_0x48e4('0x11')]['code']===0x1f4){logger['error'](_0x48e4('0xc'),_0x44a4f2,_0x567a6c['error'][_0x48e4('0x12')]);return _0xefdc62(_0x567a6c[_0x48e4('0x11')][_0x48e4('0x12')]);}logger[_0x48e4('0x11')](_0x48e4('0xc'),_0x44a4f2,_0x567a6c[_0x48e4('0x11')]['message']);return _0x58638e(_0x567a6c[_0x48e4('0x11')][_0x48e4('0x12')]);}else{logger[_0x48e4('0xb')](_0x48e4('0xc'),_0x44a4f2,_0x48e4('0xd'));_0x58638e(_0x567a6c[_0x48e4('0x13')][_0x48e4('0x12')]);}})['catch'](function(_0x24934c){logger[_0x48e4('0x11')](_0x48e4('0xc'),_0x44a4f2,_0x24934c);_0xefdc62(_0x24934c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 226dfba..b28dd97 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 _0x6649=['put','/:id','exports','multer','util','path','express','Router','../../components/interaction/service','isAuthenticated','index','show','post','create'];(function(_0x592e5d,_0x2a0038){var _0xe13b74=function(_0x292d7b){while(--_0x292d7b){_0x592e5d['push'](_0x592e5d['shift']());}};_0xe13b74(++_0x2a0038);}(_0x6649,0x73));var _0x9664=function(_0x383d3d,_0x3955f9){_0x383d3d=_0x383d3d-0x0;var _0x247aa0=_0x6649[_0x383d3d];return _0x247aa0;};'use strict';var multer=require(_0x9664('0x0'));var util=require(_0x9664('0x1'));var path=require(_0x9664('0x2'));var timeout=require('connect-timeout');var express=require(_0x9664('0x3'));var router=express[_0x9664('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9664('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x9664('0x6')](),controller[_0x9664('0x7')]);router['get']('/:id',auth[_0x9664('0x6')](),controller[_0x9664('0x8')]);router[_0x9664('0x9')]('/',auth['isAuthenticated'](),controller[_0x9664('0xa')]);router[_0x9664('0xb')](_0x9664('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9664('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9664('0xd')]=router; \ No newline at end of file +var _0xe539=['post','create','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ee5c,_0x210778){var _0x312a5b=function(_0x1e1399){while(--_0x1e1399){_0x2ee5c['push'](_0x2ee5c['shift']());}};_0x312a5b(++_0x210778);}(_0xe539,0x164));var _0x9e53=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xe539[_0x593564];return _0x211a89;};'use strict';var multer=require(_0x9e53('0x0'));var util=require('util');var path=require(_0x9e53('0x1'));var timeout=require(_0x9e53('0x2'));var express=require(_0x9e53('0x3'));var router=express[_0x9e53('0x4')]();var auth=require(_0x9e53('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e53('0x6'));router[_0x9e53('0x7')]('/',auth[_0x9e53('0x8')](),controller[_0x9e53('0x9')]);router[_0x9e53('0x7')](_0x9e53('0xa'),auth[_0x9e53('0x8')](),controller[_0x9e53('0xb')]);router[_0x9e53('0xc')]('/',auth[_0x9e53('0x8')](),controller[_0x9e53('0xd')]);router['put']('/:id',auth[_0x9e53('0x8')](),controller['update']);router[_0x9e53('0xe')](_0x9e53('0xa'),auth[_0x9e53('0x8')](),controller[_0x9e53('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bbdc538..4aaac48 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 _0x6b6d=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x6b6d[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0xd6b6('0x0'));module[_0xd6b6('0x1')]={'type':{'type':Sequelize[_0xd6b6('0x2')](_0xd6b6('0x3'),'variable',_0xd6b6('0x4'),_0xd6b6('0x5')),'defaultValue':_0xd6b6('0x3')},'content':{'type':Sequelize[_0xd6b6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd6b6('0x2')](_0xd6b6('0x3'),_0xd6b6('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd6b6('0x6')]},'idField':{'type':Sequelize[_0xd6b6('0x6')]},'nameField':{'type':Sequelize[_0xd6b6('0x6')]},'customField':{'type':Sequelize[_0xd6b6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6b6('0x6')]}}; \ No newline at end of file +var _0xdf70=['ENUM','variable','customVariable','string','STRING','BOOLEAN','sequelize','exports'];(function(_0xed6ed0,_0x28e1ad){var _0x20a428=function(_0x5b2603){while(--_0x5b2603){_0xed6ed0['push'](_0xed6ed0['shift']());}};_0x20a428(++_0x28e1ad);}(_0xdf70,0x86));var _0x0df7=function(_0x4d6ffd,_0x3f5780){_0x4d6ffd=_0x4d6ffd-0x0;var _0x406b81=_0xdf70[_0x4d6ffd];return _0x406b81;};'use strict';var Sequelize=require(_0x0df7('0x0'));module[_0x0df7('0x1')]={'type':{'type':Sequelize[_0x0df7('0x2')]('string',_0x0df7('0x3'),_0x0df7('0x4'),'keyValue'),'defaultValue':_0x0df7('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0df7('0x6')]},'keyType':{'type':Sequelize[_0x0df7('0x2')]('string',_0x0df7('0x3'),_0x0df7('0x4'))},'keyContent':{'type':Sequelize[_0x0df7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0df7('0x6')]},'customField':{'type':Sequelize[_0x0df7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0df7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 10f218c..53013f2 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x396734,_0x455c5b){var _0x661bd9=function(_0x3db41c){while(--_0x3db41c){_0x396734['push'](_0x396734['shift']());}};_0x661bd9(++_0x455c5b);}(_0x524e,0x15e));var _0xe524=function(_0x551808,_0x212062){_0x551808=_0x551808-0x0;var _0x2d59b4=_0x524e[_0x551808];return _0x2d59b4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['ZendeskField'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['ZendeskField'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));}; \ No newline at end of file +var _0x2542=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','error','stack','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x535c71,_0x267beb){var _0x2729dd=function(_0x38f4ae){while(--_0x38f4ae){_0x535c71['push'](_0x535c71['shift']());}};_0x2729dd(++_0x267beb);}(_0x2542,0x169));var _0x2254=function(_0x139c39,_0xc46751){_0x139c39=_0x139c39-0x0;var _0xdb9b55=_0x2542[_0x139c39];return _0xdb9b55;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x19'));var db=require(_0x2254('0x1a'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1b')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1c')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1d')](_0x504749)[_0x2254('0x1e')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=_0xbc5548[_0x2254('0x1f')],_0x18baf4=_0x26285a[_0x2254('0x20')],_0x57247a=_0x26285a[_0x2254('0x20')]+_0x26285a[_0x2254('0x21')],_0x327d6d;if(_0x57247a>=_0x50f137){_0x57247a=_0x50f137;_0x327d6d=0xc8;}else{_0x327d6d=0xce;}_0x145272[_0x2254('0x1d')](_0x327d6d);return _0x145272['set']('Content-Range',_0x18baf4+'-'+_0x57247a+'/'+_0x50f137)['json'](_0xbc5548);}return null;};}function patchUpdates(_0xb05559){return function(_0x3a79f8){try{jsonpatch[_0x2254('0x22')](_0x3a79f8,_0xb05559,!![]);}catch(_0x1f1163){return BPromise[_0x2254('0x23')](_0x1f1163);}return _0x3a79f8[_0x2254('0x24')]();};}function saveUpdates(_0x487f72,_0x28381e){return function(_0x16148d){if(_0x16148d){return _0x16148d[_0x2254('0x25')](_0x487f72)['then'](function(_0x52fedc){return _0x52fedc;});}return null;};}function removeEntity(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x26')]()['then'](function(){_0x5bd982['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540020,_0x5e5edb){return function(_0x4f797d){if(!_0x4f797d){_0x540020[_0x2254('0x1b')](0x194);}return _0x4f797d;};}function handleError(_0x9d6ccf,_0x2f3037){_0x2f3037=_0x2f3037||0x1f4;return function(_0x265467){logger[_0x2254('0x27')](_0x265467[_0x2254('0x28')]);if(_0x265467['name']){delete _0x265467['name'];}_0x9d6ccf[_0x2254('0x1d')](_0x2f3037)['send'](_0x265467);};}exports[_0x2254('0x29')]=function(_0x141dc5,_0x31a543){var _0x3aa0bd={},_0x19043b={},_0x482688={'count':0x0,'rows':[]};var _0x1a8a0d=_[_0x2254('0x2a')](db[_0x2254('0x2b')][_0x2254('0x2c')],function(_0x13366a){return{'name':_0x13366a[_0x2254('0x2d')],'type':_0x13366a[_0x2254('0x2e')][_0x2254('0x2f')]};});_0x19043b[_0x2254('0x30')]=_[_0x2254('0x2a')](_0x1a8a0d,_0x2254('0x31'));_0x19043b[_0x2254('0x32')]=_[_0x2254('0x33')](_0x141dc5[_0x2254('0x32')]);_0x19043b[_0x2254('0x34')]=_[_0x2254('0x35')](_0x19043b[_0x2254('0x30')],_0x19043b[_0x2254('0x32')]);_0x3aa0bd[_0x2254('0x36')]=_['intersection'](_0x19043b[_0x2254('0x30')],qs[_0x2254('0x37')](_0x141dc5[_0x2254('0x32')][_0x2254('0x37')]));_0x3aa0bd[_0x2254('0x36')]=_0x3aa0bd[_0x2254('0x36')][_0x2254('0x38')]?_0x3aa0bd[_0x2254('0x36')]:_0x19043b[_0x2254('0x30')];if(!_0x141dc5['query'][_0x2254('0x39')](_0x2254('0x3a'))){_0x3aa0bd['limit']=qs[_0x2254('0x21')](_0x141dc5[_0x2254('0x32')][_0x2254('0x21')]);_0x3aa0bd[_0x2254('0x20')]=qs['offset'](_0x141dc5['query'][_0x2254('0x20')]);}_0x3aa0bd['order']=qs[_0x2254('0x3b')](_0x141dc5[_0x2254('0x32')][_0x2254('0x3b')]);_0x3aa0bd[_0x2254('0x3c')]=qs[_0x2254('0x34')](_[_0x2254('0x3d')](_0x141dc5[_0x2254('0x32')],_0x19043b['filters']),_0x1a8a0d);if(_0x141dc5[_0x2254('0x32')][_0x2254('0x3e')]){_0x3aa0bd[_0x2254('0x3c')]=_[_0x2254('0x3f')](_0x3aa0bd[_0x2254('0x3c')],{'$or':_[_0x2254('0x2a')](_0x1a8a0d,function(_0x3e7ccb){if(_0x3e7ccb[_0x2254('0x2e')]!==_0x2254('0x40')){var _0x34543d={};_0x34543d[_0x3e7ccb['name']]={'$like':'%'+_0x141dc5[_0x2254('0x32')][_0x2254('0x3e')]+'%'};return _0x34543d;}})});}_0x3aa0bd=_[_0x2254('0x3f')]({},_0x3aa0bd,_0x141dc5[_0x2254('0x41')]);var _0x4c7cc3={'where':_0x3aa0bd[_0x2254('0x3c')]};return db[_0x2254('0x2b')][_0x2254('0x1f')](_0x4c7cc3)[_0x2254('0x42')](function(_0x216199){_0x482688[_0x2254('0x1f')]=_0x216199;if(_0x141dc5[_0x2254('0x32')][_0x2254('0x43')]){_0x3aa0bd['include']=[{'all':!![]}];}return db[_0x2254('0x2b')]['findAll'](_0x3aa0bd);})[_0x2254('0x42')](function(_0x19b580){_0x482688[_0x2254('0x44')]=_0x19b580;return _0x482688;})[_0x2254('0x42')](respondWithFilteredResult(_0x31a543,_0x3aa0bd))[_0x2254('0x45')](handleError(_0x31a543,null));};exports[_0x2254('0x46')]=function(_0x1c9a27,_0x568ec9){var _0x3025ee={'raw':!![],'where':{'id':_0x1c9a27[_0x2254('0x47')]['id']}},_0x2f1ff9={};_0x2f1ff9[_0x2254('0x30')]=_[_0x2254('0x33')](db['ZendeskField'][_0x2254('0x2c')]);_0x2f1ff9[_0x2254('0x32')]=_[_0x2254('0x33')](_0x1c9a27[_0x2254('0x32')]);_0x2f1ff9[_0x2254('0x34')]=_['intersection'](_0x2f1ff9[_0x2254('0x30')],_0x2f1ff9['query']);_0x3025ee[_0x2254('0x36')]=_[_0x2254('0x35')](_0x2f1ff9[_0x2254('0x30')],qs[_0x2254('0x37')](_0x1c9a27[_0x2254('0x32')][_0x2254('0x37')]));_0x3025ee[_0x2254('0x36')]=_0x3025ee[_0x2254('0x36')][_0x2254('0x38')]?_0x3025ee[_0x2254('0x36')]:_0x2f1ff9[_0x2254('0x30')];if(_0x1c9a27[_0x2254('0x32')][_0x2254('0x43')]){_0x3025ee['include']=[{'all':!![]}];}_0x3025ee=_[_0x2254('0x3f')]({},_0x3025ee,_0x1c9a27[_0x2254('0x41')]);return db[_0x2254('0x2b')]['find'](_0x3025ee)[_0x2254('0x42')](handleEntityNotFound(_0x568ec9,null))[_0x2254('0x42')](respondWithResult(_0x568ec9,null))[_0x2254('0x45')](handleError(_0x568ec9,null));};exports[_0x2254('0x48')]=function(_0x2e6603,_0x470241){return db[_0x2254('0x2b')][_0x2254('0x48')](_0x2e6603[_0x2254('0x49')],{})['then'](respondWithResult(_0x470241,0xc9))[_0x2254('0x45')](handleError(_0x470241,null));};exports[_0x2254('0x25')]=function(_0x2c3055,_0x32515f){if(_0x2c3055[_0x2254('0x49')]['id']){delete _0x2c3055[_0x2254('0x49')]['id'];}return db[_0x2254('0x2b')][_0x2254('0x4a')]({'where':{'id':_0x2c3055[_0x2254('0x47')]['id']}})[_0x2254('0x42')](handleEntityNotFound(_0x32515f,null))['then'](saveUpdates(_0x2c3055[_0x2254('0x49')],null))[_0x2254('0x42')](respondWithResult(_0x32515f,null))['catch'](handleError(_0x32515f,null));};exports[_0x2254('0x26')]=function(_0x143bd2,_0x12e2ff){return db[_0x2254('0x2b')]['find']({'where':{'id':_0x143bd2[_0x2254('0x47')]['id']}})[_0x2254('0x42')](handleEntityNotFound(_0x12e2ff,null))['then'](removeEntity(_0x12e2ff,null))[_0x2254('0x45')](handleError(_0x12e2ff,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index cc50d0a..a6bd8cb 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 _0x1ebd=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x1ebd,0x64));var _0xd1eb=function(_0x17fd77,_0x23b9d5){_0x17fd77=_0x17fd77-0x0;var _0x134b8d=_0x1ebd[_0x17fd77];return _0x134b8d;};'use strict';var _=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var logger=require(_0xd1eb('0x2'))('api');var moment=require(_0xd1eb('0x3'));var BPromise=require(_0xd1eb('0x4'));var rp=require(_0xd1eb('0x5'));var fs=require('fs');var path=require(_0xd1eb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd1eb('0x7'));module[_0xd1eb('0x8')]=function(_0x536a93,_0x2f050e){return _0x536a93[_0xd1eb('0x9')](_0xd1eb('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xd1eb('0xb'),'fields':[_0xd1eb('0xc'),_0xd1eb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12c9=['ZendeskField','int_zendesk_fields','idField','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x197aee,_0x55f0eb){var _0x453a1b=function(_0x533c39){while(--_0x533c39){_0x197aee['push'](_0x197aee['shift']());}};_0x453a1b(++_0x55f0eb);}(_0x12c9,0x9f));var _0x912c=function(_0x1eb8c1,_0x39ac08){_0x1eb8c1=_0x1eb8c1-0x0;var _0xabbaa2=_0x12c9[_0x1eb8c1];return _0xabbaa2;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))('api');var moment=require(_0x912c('0x2'));var BPromise=require('bluebird');var rp=require(_0x912c('0x3'));var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require(_0x912c('0x6'));var attributes=require(_0x912c('0x7'));module[_0x912c('0x8')]=function(_0x572179,_0x5daa7d){return _0x572179[_0x912c('0x9')](_0x912c('0xa'),attributes,{'tableName':_0x912c('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x912c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index b11a1de..55870d3 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 _0xdde7=['info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1c3454,_0x397e6a){var _0x10159f=function(_0x557aa3){while(--_0x557aa3){_0x1c3454['push'](_0x1c3454['shift']());}};_0x10159f(++_0x397e6a);}(_0xdde7,0xcf));var _0x7dde=function(_0x4a0c33,_0x5686bb){_0x4a0c33=_0x4a0c33-0x0;var _0x6488f9=_0xdde7[_0x4a0c33];return _0x6488f9;};'use strict';var _=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var moment=require(_0x7dde('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dde('0x3'));var fs=require('fs');var Redis=require(_0x7dde('0x4'));var db=require(_0x7dde('0x5'))['db'];var utils=require(_0x7dde('0x6'));var logger=require(_0x7dde('0x7'))(_0x7dde('0x8'));var config=require(_0x7dde('0x9'));var jayson=require(_0x7dde('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3676,_0x2d8cc0,_0x2d798e){return new BPromise(function(_0xc14009,_0x2293d1){return client[_0x7dde('0xb')](_0x3a3676,_0x2d798e)[_0x7dde('0xc')](function(_0xdbce70){logger[_0x7dde('0xd')]('ZendeskField,\x20%s,\x20%s',_0x2d8cc0,'request\x20sent');logger[_0x7dde('0xe')](_0x7dde('0xf'),_0x2d8cc0,'request\x20sent',JSON[_0x7dde('0x10')](_0xdbce70));if(_0xdbce70[_0x7dde('0x11')]){if(_0xdbce70[_0x7dde('0x11')][_0x7dde('0x12')]===0x1f4){logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);return _0x2293d1(_0xdbce70['error'][_0x7dde('0x14')]);}logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);return _0xc14009(_0xdbce70[_0x7dde('0x11')][_0x7dde('0x14')]);}else{logger['info'](_0x7dde('0x13'),_0x2d8cc0,_0x7dde('0x15'));_0xc14009(_0xdbce70['result'][_0x7dde('0x14')]);}})['catch'](function(_0x31ac52){logger[_0x7dde('0x11')](_0x7dde('0x13'),_0x2d8cc0,_0x31ac52);_0x2293d1(_0x31ac52);});});} \ No newline at end of file +var _0x8e71=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','message','ZendeskField,\x20%s,\x20%s','catch','lodash'];(function(_0x223e07,_0x49ee45){var _0x4633a5=function(_0x404c07){while(--_0x404c07){_0x223e07['push'](_0x223e07['shift']());}};_0x4633a5(++_0x49ee45);}(_0x8e71,0x1a3));var _0x18e7=function(_0x28d31d,_0x57a4e6){_0x28d31d=_0x28d31d-0x0;var _0x2df7c1=_0x8e71[_0x28d31d];return _0x2df7c1;};'use strict';var _=require(_0x18e7('0x0'));var util=require(_0x18e7('0x1'));var moment=require('moment');var BPromise=require(_0x18e7('0x2'));var rs=require(_0x18e7('0x3'));var fs=require('fs');var Redis=require(_0x18e7('0x4'));var db=require(_0x18e7('0x5'))['db'];var utils=require(_0x18e7('0x6'));var logger=require(_0x18e7('0x7'))(_0x18e7('0x8'));var config=require(_0x18e7('0x9'));var jayson=require(_0x18e7('0xa'));var client=jayson[_0x18e7('0xb')][_0x18e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e8516,_0x9275d1,_0x178be4){return new BPromise(function(_0x7b2fc9,_0x545697){return client['request'](_0x3e8516,_0x178be4)[_0x18e7('0xd')](function(_0x53a5f5){logger['info']('ZendeskField,\x20%s,\x20%s',_0x9275d1,_0x18e7('0xe'));logger[_0x18e7('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x9275d1,'request\x20sent',JSON['stringify'](_0x53a5f5));if(_0x53a5f5[_0x18e7('0x10')]){if(_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x9275d1,_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);return _0x545697(_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);}logger[_0x18e7('0x10')](_0x18e7('0x13'),_0x9275d1,_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);return _0x7b2fc9(_0x53a5f5['error']['message']);}else{logger['info'](_0x18e7('0x13'),_0x9275d1,_0x18e7('0xe'));_0x7b2fc9(_0x53a5f5['result'][_0x18e7('0x12')]);}})[_0x18e7('0x14')](function(_0x53200b){logger[_0x18e7('0x10')](_0x18e7('0x13'),_0x9275d1,_0x53200b);_0x545697(_0x53200b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d073563..f047bdb 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(_0x299a51,_0x5e1e3c){var _0x28afe4=function(_0x5e7194){while(--_0x5e7194){_0x299a51['push'](_0x299a51['shift']());}};_0x28afe4(++_0x5e1e3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +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(_0x794b29,_0xc016b1){var _0x18005b=function(_0x20887e){while(--_0x20887e){_0x794b29['push'](_0x794b29['shift']());}};_0x18005b(++_0xc016b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 ab6f4d5..ff6e9f7 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 _0x41e0=['sequelize','exports','STRING'];(function(_0x2eeec3,_0x53ce27){var _0x4a57bd=function(_0x14b222){while(--_0x14b222){_0x2eeec3['push'](_0x2eeec3['shift']());}};_0x4a57bd(++_0x53ce27);}(_0x41e0,0xe7));var _0x041e=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0x41e0[_0x36bbbb];return _0x3ca0eb;};'use strict';var Sequelize=require(_0x041e('0x0'));module[_0x041e('0x1')]={'name':{'type':Sequelize[_0x041e('0x2')]},'description':{'type':Sequelize[_0x041e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x041e('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x041e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x041e('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x653a=['STRING','sequelize','exports'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x653a,0x133));var _0xa653=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x653a[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0xa653('0x0'));module[_0xa653('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa653('0x2')]},'host':{'type':Sequelize[_0xa653('0x2')]},'zone':{'type':Sequelize[_0xa653('0x2')]},'clientId':{'type':Sequelize[_0xa653('0x2')]},'clientSecret':{'type':Sequelize[_0xa653('0x2')]},'serverUrl':{'type':Sequelize[_0xa653('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa653('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c754bb8..4e05955 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 _0xabad=['options','find','create','body','update','destroy','getConfigurations','findOne','pick','AccountId','getSubjects','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','json','apply','reject','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','VIRTUAL','where','ZohoAccount','include','findAll','rows','show','params','includeAll'];(function(_0x1c966f,_0x58fc8f){var _0x4661c6=function(_0x320167){while(--_0x320167){_0x1c966f['push'](_0x1c966f['shift']());}};_0x4661c6(++_0x58fc8f);}(_0xabad,0x150));var _0xdaba=function(_0x510cd9,_0x551300){_0x510cd9=_0x510cd9-0x0;var _0x2b1f61=_0xabad[_0x510cd9];return _0x2b1f61;};'use strict';var pdf=require(_0xdaba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdaba('0x1'));var zipdir=require(_0xdaba('0x2'));var jsonpatch=require(_0xdaba('0x3'));var rp=require('request-promise');var moment=require(_0xdaba('0x4'));var BPromise=require(_0xdaba('0x5'));var Mustache=require('mustache');var util=require(_0xdaba('0x6'));var path=require(_0xdaba('0x7'));var sox=require(_0xdaba('0x8'));var csv=require(_0xdaba('0x9'));var ejs=require(_0xdaba('0xa'));var fs=require('fs');var _=require(_0xdaba('0xb'));var squel=require(_0xdaba('0xc'));var crypto=require(_0xdaba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdaba('0xe'));var toCsv=require(_0xdaba('0x9'));var querystring=require(_0xdaba('0xf'));var Papa=require(_0xdaba('0x10'));var Redis=require('ioredis');var authService=require(_0xdaba('0x11'));var qs=require(_0xdaba('0x12'));var as=require(_0xdaba('0x13'));var hardwareService=require(_0xdaba('0x14'));var logger=require(_0xdaba('0x15'))(_0xdaba('0x16'));var utils=require(_0xdaba('0x17'));var config=require(_0xdaba('0x18'));var licenseUtil=require(_0xdaba('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdaba('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xdaba('0x1b')][_0xdaba('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x33f9a4,_0x3ba409,_0x24daca,_0x3b2d11){return new BPromise(function(_0x3b599b,_0x4e6e33){var _0x1b96e6=_0x3b2d11||client;return _0x1b96e6[_0xdaba('0x1d')](_0x33f9a4,_0x24daca)[_0xdaba('0x1e')](function(_0x57679f){logger[_0xdaba('0x1f')](_0xdaba('0x20'),_0x3ba409,_0xdaba('0x21'));logger['debug'](_0xdaba('0x22'),_0x3ba409,_0xdaba('0x21'),JSON[_0xdaba('0x23')](_0x57679f));if(_0x57679f[_0xdaba('0x24')]){if(_0x57679f[_0xdaba('0x24')]['code']===0x1f4){logger[_0xdaba('0x24')](_0xdaba('0x20'),_0x3ba409,_0x57679f[_0xdaba('0x24')]['message']);return _0x4e6e33(_0x57679f['error'][_0xdaba('0x25')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3ba409,_0x57679f[_0xdaba('0x24')][_0xdaba('0x25')]);return _0x3b599b(_0x57679f[_0xdaba('0x24')][_0xdaba('0x25')]);}else{logger['info'](_0xdaba('0x20'),_0x3ba409,_0xdaba('0x21'));_0x3b599b(_0x57679f[_0xdaba('0x26')]['message']);}})[_0xdaba('0x27')](function(_0x522258){logger[_0xdaba('0x24')](_0xdaba('0x20'),_0x3ba409,_0x522258);_0x4e6e33(_0x522258);});});}function respondWithStatusCode(_0x3f3dfb,_0x5735bf){_0x5735bf=_0x5735bf||0xcc;return function(_0x56b830){if(_0x56b830){return _0x3f3dfb[_0xdaba('0x28')](_0x5735bf);}return _0x3f3dfb[_0xdaba('0x29')](_0x5735bf)[_0xdaba('0x2a')]();};}function respondWithResult(_0x45db3b,_0x2c0eed){_0x2c0eed=_0x2c0eed||0xc8;return function(_0x1d599d){if(_0x1d599d){return _0x45db3b[_0xdaba('0x29')](_0x2c0eed)['json'](_0x1d599d);}};}function respondWithFilteredResult(_0xeadce6,_0x26bb7c){return function(_0x166a83){if(_0x166a83){var _0x3a2c48=_0x166a83[_0xdaba('0x2b')],_0x5c0f91=_0x26bb7c['offset'],_0x3ee19d=_0x26bb7c[_0xdaba('0x2c')]+_0x26bb7c['limit'],_0x752c66;if(_0x3ee19d>=_0x3a2c48){_0x3ee19d=_0x3a2c48;_0x752c66=0xc8;}else{_0x752c66=0xce;}_0xeadce6[_0xdaba('0x29')](_0x752c66);return _0xeadce6[_0xdaba('0x2d')]('Content-Range',_0x5c0f91+'-'+_0x3ee19d+'/'+_0x3a2c48)[_0xdaba('0x2e')](_0x166a83);}return null;};}function patchUpdates(_0x592521){return function(_0x3aa547){try{jsonpatch[_0xdaba('0x2f')](_0x3aa547,_0x592521,!![]);}catch(_0x1bf85e){return BPromise[_0xdaba('0x30')](_0x1bf85e);}return _0x3aa547['save']();};}function saveUpdates(_0x158dd8,_0x2602d4){return function(_0x453c09){if(_0x453c09){return _0x453c09['update'](_0x158dd8)[_0xdaba('0x1e')](function(_0x2619a8){return _0x2619a8;});}return null;};}function removeEntity(_0x466d7a,_0x12c5a3){return function(_0x331801){if(_0x331801){return _0x331801['destroy']()['then'](function(){_0x466d7a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4fe6,_0x3a9f95){return function(_0x3f1f09){if(!_0x3f1f09){_0x3c4fe6[_0xdaba('0x28')](0x194);}return _0x3f1f09;};}function handleError(_0x55256b,_0x282f5c){_0x282f5c=_0x282f5c||0x1f4;return function(_0x16e3ea){logger[_0xdaba('0x24')](_0x16e3ea[_0xdaba('0x31')]);if(_0x16e3ea['name']){delete _0x16e3ea[_0xdaba('0x32')];}_0x55256b[_0xdaba('0x29')](_0x282f5c)[_0xdaba('0x33')](_0x16e3ea);};}exports[_0xdaba('0x34')]=function(_0x196cb7,_0x5dceab){var _0x29a79c={},_0x2ed5f5={},_0x2fa4b5={'count':0x0,'rows':[]};var _0x559be8=_[_0xdaba('0x35')](db['ZohoAccount'][_0xdaba('0x36')],function(_0x470b14){return{'name':_0x470b14['fieldName'],'type':_0x470b14[_0xdaba('0x37')][_0xdaba('0x38')]};});_0x2ed5f5[_0xdaba('0x39')]=_[_0xdaba('0x35')](_0x559be8,_0xdaba('0x32'));_0x2ed5f5[_0xdaba('0x3a')]=_[_0xdaba('0x3b')](_0x196cb7[_0xdaba('0x3a')]);_0x2ed5f5[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x2ed5f5[_0xdaba('0x39')],_0x2ed5f5[_0xdaba('0x3a')]);_0x29a79c[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x2ed5f5['model'],qs[_0xdaba('0x3f')](_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x29a79c['attributes']=_0x29a79c[_0xdaba('0x3e')][_0xdaba('0x40')]?_0x29a79c['attributes']:_0x2ed5f5[_0xdaba('0x39')];if(!_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x41')](_0xdaba('0x42'))){_0x29a79c[_0xdaba('0x43')]=qs['limit'](_0x196cb7[_0xdaba('0x3a')]['limit']);_0x29a79c[_0xdaba('0x2c')]=qs['offset'](_0x196cb7[_0xdaba('0x3a')]['offset']);}_0x29a79c[_0xdaba('0x44')]=qs[_0xdaba('0x45')](_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x45')]);_0x29a79c['where']=qs['filters'](_['pick'](_0x196cb7[_0xdaba('0x3a')],_0x2ed5f5['filters']),_0x559be8);if(_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x46')]){_0x29a79c['where']=_[_0xdaba('0x47')](_0x29a79c['where'],{'$or':_[_0xdaba('0x35')](_0x559be8,function(_0x4065f5){if(_0x4065f5[_0xdaba('0x37')]!==_0xdaba('0x48')){var _0x5019a8={};_0x5019a8[_0x4065f5['name']]={'$like':'%'+_0x196cb7[_0xdaba('0x3a')][_0xdaba('0x46')]+'%'};return _0x5019a8;}})});}_0x29a79c=_[_0xdaba('0x47')]({},_0x29a79c,_0x196cb7['options']);var _0x9c0de6={'where':_0x29a79c[_0xdaba('0x49')]};return db[_0xdaba('0x4a')][_0xdaba('0x2b')](_0x9c0de6)[_0xdaba('0x1e')](function(_0x357a96){_0x2fa4b5[_0xdaba('0x2b')]=_0x357a96;if(_0x196cb7[_0xdaba('0x3a')]['includeAll']){_0x29a79c[_0xdaba('0x4b')]=[{'all':!![]}];}return db['ZohoAccount'][_0xdaba('0x4c')](_0x29a79c);})[_0xdaba('0x1e')](function(_0x1c07f8){_0x2fa4b5[_0xdaba('0x4d')]=_0x1c07f8;return _0x2fa4b5;})[_0xdaba('0x1e')](respondWithFilteredResult(_0x5dceab,_0x29a79c))['catch'](handleError(_0x5dceab,null));};exports[_0xdaba('0x4e')]=function(_0x3e1167,_0x4e9633){var _0x1a04d8={'raw':![],'where':{'id':_0x3e1167[_0xdaba('0x4f')]['id']}},_0x2b2c3e={};_0x2b2c3e[_0xdaba('0x39')]=_['keys'](db[_0xdaba('0x4a')][_0xdaba('0x36')]);_0x2b2c3e[_0xdaba('0x3a')]=_[_0xdaba('0x3b')](_0x3e1167[_0xdaba('0x3a')]);_0x2b2c3e[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x2b2c3e[_0xdaba('0x39')],_0x2b2c3e[_0xdaba('0x3a')]);_0x1a04d8[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x2b2c3e['model'],qs[_0xdaba('0x3f')](_0x3e1167[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x1a04d8[_0xdaba('0x3e')]=_0x1a04d8[_0xdaba('0x3e')][_0xdaba('0x40')]?_0x1a04d8[_0xdaba('0x3e')]:_0x2b2c3e['model'];if(_0x3e1167[_0xdaba('0x3a')][_0xdaba('0x50')]){_0x1a04d8['include']=[{'all':!![]}];}_0x1a04d8=_[_0xdaba('0x47')]({},_0x1a04d8,_0x3e1167[_0xdaba('0x51')]);return db[_0xdaba('0x4a')][_0xdaba('0x52')](_0x1a04d8)['then'](handleEntityNotFound(_0x4e9633,null))[_0xdaba('0x1e')](respondWithResult(_0x4e9633,null))[_0xdaba('0x27')](handleError(_0x4e9633,null));};exports[_0xdaba('0x53')]=function(_0x3b0f56,_0x2ec0c0){return db[_0xdaba('0x4a')][_0xdaba('0x53')](_0x3b0f56[_0xdaba('0x54')],{})[_0xdaba('0x1e')](respondWithResult(_0x2ec0c0,0xc9))['catch'](handleError(_0x2ec0c0,null));};exports[_0xdaba('0x55')]=function(_0x4ac675,_0x48d9e7){if(_0x4ac675['body']['id']){delete _0x4ac675[_0xdaba('0x54')]['id'];}return db[_0xdaba('0x4a')][_0xdaba('0x52')]({'where':{'id':_0x4ac675[_0xdaba('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48d9e7,null))[_0xdaba('0x1e')](saveUpdates(_0x4ac675[_0xdaba('0x54')],null))[_0xdaba('0x1e')](respondWithResult(_0x48d9e7,null))[_0xdaba('0x27')](handleError(_0x48d9e7,null));};exports[_0xdaba('0x56')]=function(_0x55e7e9,_0x4a07ef){return db[_0xdaba('0x4a')][_0xdaba('0x52')]({'where':{'id':_0x55e7e9['params']['id']}})[_0xdaba('0x1e')](handleEntityNotFound(_0x4a07ef,null))[_0xdaba('0x1e')](removeEntity(_0x4a07ef,null))[_0xdaba('0x27')](handleError(_0x4a07ef,null));};exports[_0xdaba('0x57')]=function(_0x32c6d0,_0x155553,_0x9d189){var _0x295aef={};var _0x21cf03={};var _0x19c06a;var _0x13ce1f;return db[_0xdaba('0x4a')][_0xdaba('0x58')]({'where':{'id':_0x32c6d0['params']['id']}})['then'](handleEntityNotFound(_0x155553,null))[_0xdaba('0x1e')](function(_0x49b41c){if(_0x49b41c){_0x19c06a=_0x49b41c;_0x21cf03['model']=_[_0xdaba('0x3b')](db['ZohoConfiguration']['rawAttributes']);_0x21cf03['query']=_[_0xdaba('0x3b')](_0x32c6d0[_0xdaba('0x3a')]);_0x21cf03[_0xdaba('0x3c')]=_[_0xdaba('0x3d')](_0x21cf03[_0xdaba('0x39')],_0x21cf03['query']);_0x295aef[_0xdaba('0x3e')]=_[_0xdaba('0x3d')](_0x21cf03[_0xdaba('0x39')],qs[_0xdaba('0x3f')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x3f')]));_0x295aef[_0xdaba('0x3e')]=_0x295aef['attributes']['length']?_0x295aef[_0xdaba('0x3e')]:_0x21cf03[_0xdaba('0x39')];_0x295aef[_0xdaba('0x44')]=qs[_0xdaba('0x45')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x45')]);_0x295aef[_0xdaba('0x49')]=qs[_0xdaba('0x3c')](_[_0xdaba('0x59')](_0x32c6d0['query'],_0x21cf03[_0xdaba('0x3c')]));if(_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x46')]){_0x295aef[_0xdaba('0x49')]=_[_0xdaba('0x47')](_0x295aef[_0xdaba('0x49')],{'$or':_['map'](_0x295aef[_0xdaba('0x3e')],function(_0x4f5421){var _0xc46744={};_0xc46744[_0x4f5421]={'$like':'%'+_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x46')]+'%'};return _0xc46744;})});}_0x295aef=_[_0xdaba('0x47')]({},_0x295aef,_0x32c6d0[_0xdaba('0x51')]);return _0x19c06a[_0xdaba('0x57')](_0x295aef);}})[_0xdaba('0x1e')](function(_0xad9773){if(_0xad9773){_0x13ce1f=_0xad9773[_0xdaba('0x40')];if(!_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x41')](_0xdaba('0x42'))){_0x295aef[_0xdaba('0x43')]=qs['limit'](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x43')]);_0x295aef[_0xdaba('0x2c')]=qs[_0xdaba('0x2c')](_0x32c6d0[_0xdaba('0x3a')][_0xdaba('0x2c')]);}return _0x19c06a[_0xdaba('0x57')](_0x295aef);}})[_0xdaba('0x1e')](function(_0x5be517){if(_0x5be517){return _0x5be517?{'count':_0x13ce1f,'rows':_0x5be517}:null;}})[_0xdaba('0x1e')](respondWithResult(_0x155553,null))[_0xdaba('0x27')](handleError(_0x155553,null));};exports['addConfiguration']=function(_0x1aaf07,_0xaa1b95,_0x6b947f){if(_0x1aaf07['body']['id']){delete _0x1aaf07[_0xdaba('0x54')]['id'];}return db[_0xdaba('0x4a')][_0xdaba('0x58')]({'where':{'id':_0x1aaf07[_0xdaba('0x4f')]['id']}})[_0xdaba('0x1e')](handleEntityNotFound(_0xaa1b95,null))['then'](function(_0x156cbc){if(_0x156cbc){_0x1aaf07[_0xdaba('0x54')][_0xdaba('0x5a')]=_0x156cbc['id'];_0x1aaf07[_0xdaba('0x54')]['Subjects']=integrations[_0xdaba('0x5b')](_0x1aaf07['body']['channel'],_0x1aaf07[_0xdaba('0x54')]['type']);_0x1aaf07['body'][_0xdaba('0x5c')]=integrations[_0xdaba('0x5d')](_0x1aaf07[_0xdaba('0x54')]['channel'],_0x1aaf07[_0xdaba('0x54')][_0xdaba('0x37')]);return db[_0xdaba('0x5e')]['create'](_0x1aaf07[_0xdaba('0x54')],{'include':[{'model':db[_0xdaba('0x5f')],'as':_0xdaba('0x60')},{'model':db[_0xdaba('0x5f')],'as':_0xdaba('0x5c')}]});}return null;})[_0xdaba('0x1e')](respondWithResult(_0xaa1b95,null))[_0xdaba('0x27')](handleError(_0xaa1b95,null));};function getAccessToken(_0x420c36){return new Promise(function(_0x40a945,_0x12dc9e){var _0x3264da;switch(_0x420c36[_0xdaba('0x61')]){case'US':_0x3264da=_0xdaba('0x62');break;case'AU':_0x3264da='https://accounts.zoho.com.au';break;case'EU':_0x3264da=_0xdaba('0x63');break;case'IN':_0x3264da=_0xdaba('0x64');break;case'CN':_0x3264da=_0xdaba('0x65');break;default:_0x3264da=_0xdaba('0x63');break;}var _0x4a44b2={'method':_0xdaba('0x66'),'uri':_0x3264da+_0xdaba('0x67'),'qs':{'refresh_token':_0x420c36[_0xdaba('0x68')],'client_id':_0x420c36['clientId'],'client_secret':_0x420c36['clientSecret'],'grant_type':_0xdaba('0x69')},'json':!![]};return rp(_0x4a44b2)[_0xdaba('0x1e')](function(_0x547352){if(_0x547352[_0xdaba('0x6a')]){_0x40a945(_0x547352[_0xdaba('0x6a')]);}else{_0x12dc9e(_0xdaba('0x6b'));}})[_0xdaba('0x27')](function(_0x25f90a){_0x12dc9e(_0x25f90a);});});}exports[_0xdaba('0x6c')]=function(_0x1f6739,_0x21fb98,_0x565d1c){var _0x3305c3,_0x1a159e,_0x1df034,_0x11f799,_0x546312;return db[_0xdaba('0x4a')]['findOne']({'where':{'id':_0x1f6739[_0xdaba('0x4f')]['id']},'attributes':['id',_0xdaba('0x6d'),'zone','clientId',_0xdaba('0x6e'),_0xdaba('0x6f'),_0xdaba('0x70'),_0xdaba('0x68')]})[_0xdaba('0x1e')](handleEntityNotFound(_0x21fb98,null))[_0xdaba('0x1e')](function(_0x3e700c){_0x546312=_0x3e700c;_0x3305c3=_0x546312['host'];_0x1a159e=_0x3305c3==='zoho.eu'?'eu':_0xdaba('0x71');_0x1df034=_0x546312[_0xdaba('0x6f')];var _0x11ab6d=_0x1df034['slice'](-0x1);if(_0x11ab6d==='/'||_0x11ab6d==='\x5c'||_0x11ab6d===':'){_0x1df034=_0x1df034[_0xdaba('0x72')](0x0,_0x1df034[_0xdaba('0x73')](_0x11ab6d));}if(!_0x546312[_0xdaba('0x68')]){throw new Error(_0xdaba('0x74'));}return getAccessToken(_0x546312);})[_0xdaba('0x1e')](function(_0x420e7c){if(_0x420e7c){return rp({'method':_0xdaba('0x75'),'uri':util['format'](_0xdaba('0x76'),_0x1a159e),'qs':{'module':_0xdaba('0x77')},'headers':{'Authorization':_0xdaba('0x78')+_0x420e7c},'json':!![]});}})[_0xdaba('0x1e')](function(_0x454d04){if(_0x454d04){if(_0x454d04[_0xdaba('0x79')]&&_0x454d04[_0xdaba('0x79')][_0xdaba('0x24')]){throw new Error(_0x454d04['response']['error'][_0xdaba('0x25')]);}var _0x11d5ca=[];var _0x5d08fa=[];var _0x35decc=['Owner',_0xdaba('0x7a'),_0xdaba('0x7b'),_0xdaba('0x7c'),_0xdaba('0x7d'),'Call_Result',_0xdaba('0x7e'),_0xdaba('0x7f')];_0x5d08fa=_[_0xdaba('0x80')](_0x454d04[_0xdaba('0x3f')],function(_0x2ac64a){return _0x35decc[_0xdaba('0x81')](_0x2ac64a[_0xdaba('0x82')]);});for(var _0x4fecf8=0x0;_0x4fecf8<_0x5d08fa[_0xdaba('0x40')];_0x4fecf8++){if(_0x5d08fa[_0x4fecf8][_0xdaba('0x83')]===![]){_0x11d5ca[_0xdaba('0x84')]({'id':_0x5d08fa[_0x4fecf8]['id'],'name':_0x5d08fa[_0x4fecf8]['display_label'],'custom':_0x5d08fa[_0x4fecf8]['custom_field'],'options':_0x5d08fa[_0x4fecf8]['data_type']===_0xdaba('0x85')&&_0x5d08fa[_0x4fecf8]['pick_list_values'][_0xdaba('0x40')]>-0x1?_[_0xdaba('0x35')](_0x5d08fa[_0x4fecf8][_0xdaba('0x86')],function(_0x28a79b){return{'name':_0x28a79b,'value':_0x28a79b};}):[]});}}return{'count':_0x11d5ca['length'],'rows':_0x11d5ca};}else{return{'count':0x0,'rows':[]};}})[_0xdaba('0x1e')](respondWithResult(_0x21fb98,null))['catch'](function(_0x5f154d){var _0x252ab1=_0x1f6739['query'][_0xdaba('0x87')]?0x1f4:_0x5f154d[_0xdaba('0x88')]||0x1f4;logger[_0xdaba('0x24')](_0xdaba('0x89'),'getFields',_0x252ab1,JSON[_0xdaba('0x23')](_0x5f154d));delete _0x5f154d['name'];if(_0x252ab1===0x191){_0x252ab1=0x190;}_0x21fb98[_0xdaba('0x29')](_0x252ab1)[_0xdaba('0x33')](_0x1f6739[_0xdaba('0x3a')][_0xdaba('0x87')]?{'message':_0xdaba('0x8a'),'statusCode':_0x5f154d['statusCode']}:_0x5f154d);});}; \ No newline at end of file +var _0x75dd=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','map','type','key','model','query','keys','intersection','attributes','fields','length','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','ZohoAccount','rows','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x75dd,0x1c9));var _0xd75d=function(_0x1e6e07,_0x372e98){_0x1e6e07=_0x1e6e07-0x0;var _0x4b3b9d=_0x75dd[_0x1e6e07];return _0x4b3b9d;};'use strict';var pdf=require(_0xd75d('0x0'));var emlformat=require(_0xd75d('0x1'));var rimraf=require(_0xd75d('0x2'));var zipdir=require(_0xd75d('0x3'));var jsonpatch=require(_0xd75d('0x4'));var rp=require(_0xd75d('0x5'));var moment=require('moment');var BPromise=require(_0xd75d('0x6'));var Mustache=require(_0xd75d('0x7'));var util=require(_0xd75d('0x8'));var path=require(_0xd75d('0x9'));var sox=require(_0xd75d('0xa'));var csv=require(_0xd75d('0xb'));var ejs=require(_0xd75d('0xc'));var fs=require('fs');var _=require(_0xd75d('0xd'));var squel=require('squel');var crypto=require(_0xd75d('0xe'));var jsforce=require(_0xd75d('0xf'));var deskjs=require(_0xd75d('0x10'));var toCsv=require(_0xd75d('0xb'));var querystring=require('querystring');var Papa=require(_0xd75d('0x11'));var Redis=require(_0xd75d('0x12'));var authService=require(_0xd75d('0x13'));var qs=require(_0xd75d('0x14'));var as=require(_0xd75d('0x15'));var hardwareService=require(_0xd75d('0x16'));var logger=require(_0xd75d('0x17'))(_0xd75d('0x18'));var utils=require('../../config/utils');var config=require(_0xd75d('0x19'));var licenseUtil=require(_0xd75d('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd75d('0x1b'));var jayson=require(_0xd75d('0x1c'));var client=jayson['client'][_0xd75d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x44164,_0x4aa031,_0x5d9e8c,_0x1af9dd){return new BPromise(function(_0x3082bc,_0x3f5d9a){var _0x49bcf8=_0x1af9dd||client;return _0x49bcf8[_0xd75d('0x1e')](_0x44164,_0x5d9e8c)['then'](function(_0x54bf05){logger['info'](_0xd75d('0x1f'),_0x4aa031,_0xd75d('0x20'));logger[_0xd75d('0x21')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4aa031,_0xd75d('0x20'),JSON[_0xd75d('0x22')](_0x54bf05));if(_0x54bf05[_0xd75d('0x23')]){if(_0x54bf05['error'][_0xd75d('0x24')]===0x1f4){logger['error'](_0xd75d('0x1f'),_0x4aa031,_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);return _0x3f5d9a(_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);}logger[_0xd75d('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x4aa031,_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);return _0x3082bc(_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);}else{logger[_0xd75d('0x26')](_0xd75d('0x1f'),_0x4aa031,_0xd75d('0x20'));_0x3082bc(_0x54bf05[_0xd75d('0x27')][_0xd75d('0x25')]);}})[_0xd75d('0x28')](function(_0x5d740d){logger[_0xd75d('0x23')](_0xd75d('0x1f'),_0x4aa031,_0x5d740d);_0x3f5d9a(_0x5d740d);});});}function respondWithStatusCode(_0x96e5b4,_0x138be8){_0x138be8=_0x138be8||0xcc;return function(_0x4ea4cd){if(_0x4ea4cd){return _0x96e5b4['sendStatus'](_0x138be8);}return _0x96e5b4[_0xd75d('0x29')](_0x138be8)[_0xd75d('0x2a')]();};}function respondWithResult(_0x3db450,_0x5c0f97){_0x5c0f97=_0x5c0f97||0xc8;return function(_0x165acb){if(_0x165acb){return _0x3db450[_0xd75d('0x29')](_0x5c0f97)[_0xd75d('0x2b')](_0x165acb);}};}function respondWithFilteredResult(_0x148992,_0x1945b5){return function(_0x3e425b){if(_0x3e425b){var _0x43ab02=_0x3e425b[_0xd75d('0x2c')],_0x59387f=_0x1945b5['offset'],_0xd1c0ae=_0x1945b5['offset']+_0x1945b5[_0xd75d('0x2d')],_0x544caf;if(_0xd1c0ae>=_0x43ab02){_0xd1c0ae=_0x43ab02;_0x544caf=0xc8;}else{_0x544caf=0xce;}_0x148992['status'](_0x544caf);return _0x148992['set'](_0xd75d('0x2e'),_0x59387f+'-'+_0xd1c0ae+'/'+_0x43ab02)[_0xd75d('0x2b')](_0x3e425b);}return null;};}function patchUpdates(_0x72920a){return function(_0x500e8f){try{jsonpatch[_0xd75d('0x2f')](_0x500e8f,_0x72920a,!![]);}catch(_0x11eac3){return BPromise[_0xd75d('0x30')](_0x11eac3);}return _0x500e8f[_0xd75d('0x31')]();};}function saveUpdates(_0x57654b,_0x30efc4){return function(_0x36608e){if(_0x36608e){return _0x36608e[_0xd75d('0x32')](_0x57654b)['then'](function(_0x42bbec){return _0x42bbec;});}return null;};}function removeEntity(_0x5bf955,_0x2456dc){return function(_0x1c7a5f){if(_0x1c7a5f){return _0x1c7a5f[_0xd75d('0x33')]()[_0xd75d('0x34')](function(){_0x5bf955[_0xd75d('0x29')](0xcc)[_0xd75d('0x2a')]();});}};}function handleEntityNotFound(_0x259fea,_0x11baa2){return function(_0x57e0a1){if(!_0x57e0a1){_0x259fea[_0xd75d('0x35')](0x194);}return _0x57e0a1;};}function handleError(_0x2a980,_0x3c9d9c){_0x3c9d9c=_0x3c9d9c||0x1f4;return function(_0x249d83){logger[_0xd75d('0x23')](_0x249d83['stack']);if(_0x249d83[_0xd75d('0x36')]){delete _0x249d83[_0xd75d('0x36')];}_0x2a980[_0xd75d('0x29')](_0x3c9d9c)[_0xd75d('0x37')](_0x249d83);};}exports['index']=function(_0x98985a,_0x45e66b){var _0x20ab46={},_0x21bc4b={},_0x5192e7={'count':0x0,'rows':[]};var _0x3e5312=_[_0xd75d('0x38')](db['ZohoAccount']['rawAttributes'],function(_0x12b9c7){return{'name':_0x12b9c7['fieldName'],'type':_0x12b9c7[_0xd75d('0x39')][_0xd75d('0x3a')]};});_0x21bc4b[_0xd75d('0x3b')]=_[_0xd75d('0x38')](_0x3e5312,_0xd75d('0x36'));_0x21bc4b[_0xd75d('0x3c')]=_[_0xd75d('0x3d')](_0x98985a[_0xd75d('0x3c')]);_0x21bc4b['filters']=_[_0xd75d('0x3e')](_0x21bc4b[_0xd75d('0x3b')],_0x21bc4b['query']);_0x20ab46[_0xd75d('0x3f')]=_[_0xd75d('0x3e')](_0x21bc4b[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x98985a['query'][_0xd75d('0x40')]));_0x20ab46[_0xd75d('0x3f')]=_0x20ab46[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x20ab46[_0xd75d('0x3f')]:_0x21bc4b[_0xd75d('0x3b')];if(!_0x98985a['query']['hasOwnProperty']('nolimit')){_0x20ab46[_0xd75d('0x2d')]=qs[_0xd75d('0x2d')](_0x98985a['query'][_0xd75d('0x2d')]);_0x20ab46[_0xd75d('0x42')]=qs[_0xd75d('0x42')](_0x98985a['query'][_0xd75d('0x42')]);}_0x20ab46[_0xd75d('0x43')]=qs[_0xd75d('0x44')](_0x98985a[_0xd75d('0x3c')][_0xd75d('0x44')]);_0x20ab46[_0xd75d('0x45')]=qs['filters'](_[_0xd75d('0x46')](_0x98985a[_0xd75d('0x3c')],_0x21bc4b[_0xd75d('0x47')]),_0x3e5312);if(_0x98985a['query'][_0xd75d('0x48')]){_0x20ab46['where']=_[_0xd75d('0x49')](_0x20ab46[_0xd75d('0x45')],{'$or':_['map'](_0x3e5312,function(_0x10e89c){if(_0x10e89c[_0xd75d('0x39')]!==_0xd75d('0x4a')){var _0x5f0b54={};_0x5f0b54[_0x10e89c[_0xd75d('0x36')]]={'$like':'%'+_0x98985a[_0xd75d('0x3c')][_0xd75d('0x48')]+'%'};return _0x5f0b54;}})});}_0x20ab46=_[_0xd75d('0x49')]({},_0x20ab46,_0x98985a['options']);var _0x2e9b36={'where':_0x20ab46['where']};return db['ZohoAccount'][_0xd75d('0x2c')](_0x2e9b36)[_0xd75d('0x34')](function(_0x191ff8){_0x5192e7['count']=_0x191ff8;if(_0x98985a['query'][_0xd75d('0x4b')]){_0x20ab46[_0xd75d('0x4c')]=[{'all':!![]}];}return db[_0xd75d('0x4d')]['findAll'](_0x20ab46);})['then'](function(_0x1364bd){_0x5192e7[_0xd75d('0x4e')]=_0x1364bd;return _0x5192e7;})[_0xd75d('0x34')](respondWithFilteredResult(_0x45e66b,_0x20ab46))[_0xd75d('0x28')](handleError(_0x45e66b,null));};exports[_0xd75d('0x4f')]=function(_0x67fad0,_0x26e565){var _0x43bb10={'raw':![],'where':{'id':_0x67fad0[_0xd75d('0x50')]['id']}},_0x42d1b1={};_0x42d1b1['model']=_[_0xd75d('0x3d')](db[_0xd75d('0x4d')][_0xd75d('0x51')]);_0x42d1b1['query']=_[_0xd75d('0x3d')](_0x67fad0[_0xd75d('0x3c')]);_0x42d1b1['filters']=_[_0xd75d('0x3e')](_0x42d1b1[_0xd75d('0x3b')],_0x42d1b1[_0xd75d('0x3c')]);_0x43bb10['attributes']=_[_0xd75d('0x3e')](_0x42d1b1[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x67fad0[_0xd75d('0x3c')][_0xd75d('0x40')]));_0x43bb10[_0xd75d('0x3f')]=_0x43bb10[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x43bb10[_0xd75d('0x3f')]:_0x42d1b1[_0xd75d('0x3b')];if(_0x67fad0['query'][_0xd75d('0x4b')]){_0x43bb10[_0xd75d('0x4c')]=[{'all':!![]}];}_0x43bb10=_[_0xd75d('0x49')]({},_0x43bb10,_0x67fad0[_0xd75d('0x52')]);return db[_0xd75d('0x4d')][_0xd75d('0x53')](_0x43bb10)[_0xd75d('0x34')](handleEntityNotFound(_0x26e565,null))[_0xd75d('0x34')](respondWithResult(_0x26e565,null))[_0xd75d('0x28')](handleError(_0x26e565,null));};exports['create']=function(_0x1295d2,_0x255460){return db[_0xd75d('0x4d')][_0xd75d('0x54')](_0x1295d2['body'],{})['then'](respondWithResult(_0x255460,0xc9))['catch'](handleError(_0x255460,null));};exports[_0xd75d('0x32')]=function(_0x41bbfc,_0x44ad90){if(_0x41bbfc[_0xd75d('0x55')]['id']){delete _0x41bbfc[_0xd75d('0x55')]['id'];}return db[_0xd75d('0x4d')]['find']({'where':{'id':_0x41bbfc[_0xd75d('0x50')]['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0x44ad90,null))[_0xd75d('0x34')](saveUpdates(_0x41bbfc[_0xd75d('0x55')],null))[_0xd75d('0x34')](respondWithResult(_0x44ad90,null))['catch'](handleError(_0x44ad90,null));};exports['destroy']=function(_0x1625e1,_0xec2fe5){return db[_0xd75d('0x4d')]['find']({'where':{'id':_0x1625e1['params']['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0xec2fe5,null))[_0xd75d('0x34')](removeEntity(_0xec2fe5,null))[_0xd75d('0x28')](handleError(_0xec2fe5,null));};exports[_0xd75d('0x56')]=function(_0x320db9,_0xea064f,_0x4681ec){var _0x35a034={};var _0x4c6c5d={};var _0x31e65f;var _0x36f7df;return db[_0xd75d('0x4d')][_0xd75d('0x57')]({'where':{'id':_0x320db9['params']['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0xea064f,null))[_0xd75d('0x34')](function(_0x308bfd){if(_0x308bfd){_0x31e65f=_0x308bfd;_0x4c6c5d[_0xd75d('0x3b')]=_[_0xd75d('0x3d')](db[_0xd75d('0x58')]['rawAttributes']);_0x4c6c5d[_0xd75d('0x3c')]=_[_0xd75d('0x3d')](_0x320db9[_0xd75d('0x3c')]);_0x4c6c5d['filters']=_[_0xd75d('0x3e')](_0x4c6c5d[_0xd75d('0x3b')],_0x4c6c5d[_0xd75d('0x3c')]);_0x35a034[_0xd75d('0x3f')]=_[_0xd75d('0x3e')](_0x4c6c5d[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x40')]));_0x35a034[_0xd75d('0x3f')]=_0x35a034[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x35a034[_0xd75d('0x3f')]:_0x4c6c5d[_0xd75d('0x3b')];_0x35a034[_0xd75d('0x43')]=qs[_0xd75d('0x44')](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x44')]);_0x35a034['where']=qs[_0xd75d('0x47')](_[_0xd75d('0x46')](_0x320db9['query'],_0x4c6c5d[_0xd75d('0x47')]));if(_0x320db9[_0xd75d('0x3c')]['filter']){_0x35a034[_0xd75d('0x45')]=_['merge'](_0x35a034['where'],{'$or':_[_0xd75d('0x38')](_0x35a034['attributes'],function(_0x364f96){var _0x5c1062={};_0x5c1062[_0x364f96]={'$like':'%'+_0x320db9[_0xd75d('0x3c')][_0xd75d('0x48')]+'%'};return _0x5c1062;})});}_0x35a034=_[_0xd75d('0x49')]({},_0x35a034,_0x320db9[_0xd75d('0x52')]);return _0x31e65f[_0xd75d('0x56')](_0x35a034);}})[_0xd75d('0x34')](function(_0x50e68c){if(_0x50e68c){_0x36f7df=_0x50e68c[_0xd75d('0x41')];if(!_0x320db9[_0xd75d('0x3c')][_0xd75d('0x59')]('nolimit')){_0x35a034[_0xd75d('0x2d')]=qs['limit'](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x2d')]);_0x35a034[_0xd75d('0x42')]=qs['offset'](_0x320db9['query'][_0xd75d('0x42')]);}return _0x31e65f[_0xd75d('0x56')](_0x35a034);}})[_0xd75d('0x34')](function(_0x5db064){if(_0x5db064){return _0x5db064?{'count':_0x36f7df,'rows':_0x5db064}:null;}})[_0xd75d('0x34')](respondWithResult(_0xea064f,null))['catch'](handleError(_0xea064f,null));};exports['addConfiguration']=function(_0x5cda35,_0x2261cf,_0x12c540){if(_0x5cda35[_0xd75d('0x55')]['id']){delete _0x5cda35[_0xd75d('0x55')]['id'];}return db[_0xd75d('0x4d')][_0xd75d('0x57')]({'where':{'id':_0x5cda35[_0xd75d('0x50')]['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0x2261cf,null))[_0xd75d('0x34')](function(_0x5eecbe){if(_0x5eecbe){_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5a')]=_0x5eecbe['id'];_0x5cda35['body'][_0xd75d('0x5b')]=integrations[_0xd75d('0x5c')](_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5d')],_0x5cda35[_0xd75d('0x55')]['type']);_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5e')]=integrations['getDescriptions'](_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5d')],_0x5cda35[_0xd75d('0x55')]['type']);return db[_0xd75d('0x58')][_0xd75d('0x54')](_0x5cda35['body'],{'include':[{'model':db['ZohoField'],'as':_0xd75d('0x5b')},{'model':db['ZohoField'],'as':_0xd75d('0x5e')}]});}return null;})[_0xd75d('0x34')](respondWithResult(_0x2261cf,null))['catch'](handleError(_0x2261cf,null));};function getAccessToken(_0x5b8db8){return new Promise(function(_0x4cae32,_0x21dd42){var _0x2ff75d;switch(_0x5b8db8[_0xd75d('0x5f')]){case'US':_0x2ff75d=_0xd75d('0x60');break;case'AU':_0x2ff75d=_0xd75d('0x61');break;case'EU':_0x2ff75d=_0xd75d('0x62');break;case'IN':_0x2ff75d=_0xd75d('0x63');break;case'CN':_0x2ff75d=_0xd75d('0x64');break;default:_0x2ff75d=_0xd75d('0x62');break;}var _0x1cc2c1={'method':_0xd75d('0x65'),'uri':_0x2ff75d+'/oauth/v2/token','qs':{'refresh_token':_0x5b8db8[_0xd75d('0x66')],'client_id':_0x5b8db8['clientId'],'client_secret':_0x5b8db8[_0xd75d('0x67')],'grant_type':_0xd75d('0x68')},'json':!![]};return rp(_0x1cc2c1)[_0xd75d('0x34')](function(_0x42878f){if(_0x42878f[_0xd75d('0x69')]){_0x4cae32(_0x42878f[_0xd75d('0x69')]);}else{_0x21dd42(_0xd75d('0x6a'));}})[_0xd75d('0x28')](function(_0x5b6d74){_0x21dd42(_0x5b6d74);});});}exports[_0xd75d('0x6b')]=function(_0x2fbd66,_0xbfcce8,_0x240557){var _0x5a82ac,_0x59cda6,_0x1d43ab,_0x1fb212,_0x1dd0e5;return db[_0xd75d('0x4d')]['findOne']({'where':{'id':_0x2fbd66['params']['id']},'attributes':['id',_0xd75d('0x6c'),_0xd75d('0x5f'),_0xd75d('0x6d'),_0xd75d('0x67'),_0xd75d('0x6e'),_0xd75d('0x24'),_0xd75d('0x66')]})[_0xd75d('0x34')](handleEntityNotFound(_0xbfcce8,null))[_0xd75d('0x34')](function(_0x522b2c){_0x1dd0e5=_0x522b2c;_0x5a82ac=_0x1dd0e5[_0xd75d('0x6c')];_0x59cda6=_0x5a82ac===_0xd75d('0x6f')?'eu':_0xd75d('0x70');_0x1d43ab=_0x1dd0e5[_0xd75d('0x6e')];var _0x14ba60=_0x1d43ab[_0xd75d('0x71')](-0x1);if(_0x14ba60==='/'||_0x14ba60==='\x5c'||_0x14ba60===':'){_0x1d43ab=_0x1d43ab[_0xd75d('0x72')](0x0,_0x1d43ab['lastIndexOf'](_0x14ba60));}if(!_0x1dd0e5[_0xd75d('0x66')]){throw new Error(_0xd75d('0x73'));}return getAccessToken(_0x1dd0e5);})[_0xd75d('0x34')](function(_0x18c91d){if(_0x18c91d){return rp({'method':_0xd75d('0x74'),'uri':util[_0xd75d('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x59cda6),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd75d('0x76')+_0x18c91d},'json':!![]});}})[_0xd75d('0x34')](function(_0x535a54){if(_0x535a54){if(_0x535a54[_0xd75d('0x77')]&&_0x535a54[_0xd75d('0x77')][_0xd75d('0x23')]){throw new Error(_0x535a54['response'][_0xd75d('0x23')][_0xd75d('0x25')]);}var _0x16db1d=[];var _0x3d860e=[];var _0x28fb45=[_0xd75d('0x78'),_0xd75d('0x79'),_0xd75d('0x7a'),'WhoId',_0xd75d('0x7b'),_0xd75d('0x7c'),_0xd75d('0x7d'),_0xd75d('0x7e')];_0x3d860e=_[_0xd75d('0x7f')](_0x535a54[_0xd75d('0x40')],function(_0x5cc7e8){return _0x28fb45[_0xd75d('0x80')](_0x5cc7e8[_0xd75d('0x81')]);});for(var _0x5d1726=0x0;_0x5d1726<_0x3d860e[_0xd75d('0x41')];_0x5d1726++){if(_0x3d860e[_0x5d1726]['system_mandatory']===![]){_0x16db1d[_0xd75d('0x82')]({'id':_0x3d860e[_0x5d1726]['id'],'name':_0x3d860e[_0x5d1726]['display_label'],'custom':_0x3d860e[_0x5d1726][_0xd75d('0x83')],'options':_0x3d860e[_0x5d1726][_0xd75d('0x84')]===_0xd75d('0x85')&&_0x3d860e[_0x5d1726][_0xd75d('0x86')][_0xd75d('0x41')]>-0x1?_[_0xd75d('0x38')](_0x3d860e[_0x5d1726][_0xd75d('0x86')],function(_0x41795a){return{'name':_0x41795a,'value':_0x41795a};}):[]});}}return{'count':_0x16db1d[_0xd75d('0x41')],'rows':_0x16db1d};}else{return{'count':0x0,'rows':[]};}})[_0xd75d('0x34')](respondWithResult(_0xbfcce8,null))[_0xd75d('0x28')](function(_0x2c4323){var _0x742e92=_0x2fbd66[_0xd75d('0x3c')]['test']?0x1f4:_0x2c4323[_0xd75d('0x87')]||0x1f4;logger[_0xd75d('0x23')](_0xd75d('0x88'),'getFields',_0x742e92,JSON[_0xd75d('0x22')](_0x2c4323));delete _0x2c4323[_0xd75d('0x36')];if(_0x742e92===0x191){_0x742e92=0x190;}_0xbfcce8[_0xd75d('0x29')](_0x742e92)['send'](_0x2fbd66[_0xd75d('0x3c')][_0xd75d('0x89')]?{'message':_0xd75d('0x8a'),'statusCode':_0x2c4323[_0xd75d('0x87')]}:_0x2c4323);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 43024ff..ffe5ee1 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 _0x358e=['/oauth/v2/token','then','parse','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','refreshToken','refresh_token','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','catch','inspect','slice'];(function(_0x2b2f8e,_0x494521){var _0xd95772=function(_0xef5869){while(--_0xef5869){_0x2b2f8e['push'](_0x2b2f8e['shift']());}};_0xd95772(++_0x494521);}(_0x358e,0x1b1));var _0xe358=function(_0x59684c,_0x4f23bd){_0x59684c=_0x59684c-0x0;var _0x6e9beb=_0x358e[_0x59684c];return _0x6e9beb;};'use strict';var _=require('lodash');var util=require(_0xe358('0x0'));var logger=require(_0xe358('0x1'))('api');var moment=require(_0xe358('0x2'));var BPromise=require(_0xe358('0x3'));var rp=require(_0xe358('0x4'));var fs=require('fs');var path=require(_0xe358('0x5'));var rimraf=require(_0xe358('0x6'));var config=require(_0xe358('0x7'));var attributes=require(_0xe358('0x8'));var integrations=require(_0xe358('0x9'));module['exports']=function(_0x44efe2,_0x13ac97){return _0x44efe2[_0xe358('0xa')](_0xe358('0xb'),attributes,{'tableName':_0xe358('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1aa6bc,_0x2d9a0d,_0x3f51ba){if(_0x1aa6bc[_0xe358('0xd')](_0xe358('0xe'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0xf'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0x10'))||_0x1aa6bc['changed'](_0xe358('0x11'))||_0x1aa6bc[_0xe358('0xd')](_0xe358('0x12'))||_0x1aa6bc[_0xe358('0xd')]('host')){var _0x1787f8,_0x2386f5;_0x1787f8=_0x1aa6bc[_0xe358('0xf')];var _0x424765=_0x1787f8['slice'](-0x1);if(_0x424765==='/'||_0x424765==='\x5c'||_0x424765===':'){_0x1787f8=_0x1787f8[_0xe358('0x13')](0x0,_0x1787f8[_0xe358('0x14')](_0x424765));}switch(_0x1aa6bc[_0xe358('0xe')]){case'US':_0x2386f5=_0xe358('0x15');break;case'AU':_0x2386f5=_0xe358('0x16');break;case'IN':_0x2386f5=_0xe358('0x17');break;case'CN':_0x2386f5=_0xe358('0x18');break;default:_0x2386f5=_0xe358('0x19');break;}var _0x2014b4={'method':_0xe358('0x1a'),'uri':_0x2386f5+'/oauth/v2/token','form':{'grant_type':_0xe358('0x1b'),'client_id':_0x1aa6bc[_0xe358('0x10')],'client_secret':_0x1aa6bc[_0xe358('0x11')],'redirect_uri':_0x1aa6bc['serverUrl'],'code':_0x1aa6bc[_0xe358('0x12')]},'headers':{'Content-Type':_0xe358('0x1c')}};return rp(_0x2014b4)['then'](function(_0x1fa88e){var _0x2b51de=JSON['parse'](_0x1fa88e);if(_0x2b51de['refresh_token']){_0x1aa6bc[_0xe358('0x1d')]=_0x2b51de[_0xe358('0x1e')];logger[_0xe358('0x1f')](util[_0xe358('0x20')](_0xe358('0x21'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']));}else{logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']),util['inspect'](_0x2b51de,{'showHidden':![],'depth':null}));}return _0x3f51ba(null,_0x2d9a0d);})[_0xe358('0x25')](function(_0x2083d6){logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x1aa6bc[_0xe358('0x22')],_0x1aa6bc['id']),util[_0xe358('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f51ba(_0x2083d6);});}else{return _0x3f51ba(null,_0x2d9a0d);}},'beforeUpdate':function(_0x47f6d3,_0x5a4634,_0x4c3d7f){if(_0x47f6d3[_0xe358('0xd')](_0xe358('0xe'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0xf'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0x10'))||_0x47f6d3[_0xe358('0xd')](_0xe358('0x11'))||_0x47f6d3['changed'](_0xe358('0x12'))||_0x47f6d3[_0xe358('0xd')]('host')){var _0x227071,_0x30f054;_0x227071=_0x47f6d3[_0xe358('0xf')];var _0x17fc24=_0x227071[_0xe358('0x27')](-0x1);if(_0x17fc24==='/'||_0x17fc24==='\x5c'||_0x17fc24===':'){_0x227071=_0x227071['substring'](0x0,_0x227071[_0xe358('0x14')](_0x17fc24));}switch(_0x47f6d3[_0xe358('0xe')]){case'US':_0x30f054='https://accounts.zoho.com';break;case'AU':_0x30f054=_0xe358('0x16');break;case'IN':_0x30f054='https://accounts.zoho.in';break;case'CN':_0x30f054=_0xe358('0x18');break;default:_0x30f054=_0xe358('0x19');break;}var _0x397867={'method':_0xe358('0x1a'),'uri':_0x30f054+_0xe358('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x47f6d3[_0xe358('0x10')],'client_secret':_0x47f6d3[_0xe358('0x11')],'redirect_uri':_0x47f6d3['serverUrl'],'code':_0x47f6d3['code']},'headers':{'Content-Type':_0xe358('0x1c')}};return rp(_0x397867)[_0xe358('0x29')](function(_0x4f38b2){var _0x5b73b3=JSON[_0xe358('0x2a')](_0x4f38b2);if(_0x5b73b3['refresh_token']){_0x47f6d3[_0xe358('0x1d')]=_0x5b73b3[_0xe358('0x1e')];logger[_0xe358('0x1f')](util[_0xe358('0x20')](_0xe358('0x21'),_0x47f6d3[_0xe358('0x22')],_0x47f6d3['id']));}else{logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x47f6d3[_0xe358('0x22')],_0x47f6d3['id']),util[_0xe358('0x26')](_0x5b73b3,{'showHidden':![],'depth':null}));}return _0x4c3d7f(null,_0x5a4634);})[_0xe358('0x25')](function(_0x24b091){logger[_0xe358('0x23')](util[_0xe358('0x20')](_0xe358('0x24'),_0x47f6d3['name'],_0x47f6d3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4c3d7f(_0x24b091);});}else{return _0x4c3d7f(null,_0x5a4634);}}}});}; \ No newline at end of file +var _0x5482=['../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','code','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','lastIndexOf','https://accounts.zoho.in','POST','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes'];(function(_0x2f0a0e,_0x53c4cf){var _0x579a2=function(_0x47c786){while(--_0x47c786){_0x2f0a0e['push'](_0x2f0a0e['shift']());}};_0x579a2(++_0x53c4cf);}(_0x5482,0x14e));var _0x2548=function(_0x53a382,_0x21cfcf){_0x53a382=_0x53a382-0x0;var _0x150aca=_0x5482[_0x53a382];return _0x150aca;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))(_0x2548('0x3'));var moment=require(_0x2548('0x4'));var BPromise=require(_0x2548('0x5'));var rp=require(_0x2548('0x6'));var fs=require('fs');var path=require(_0x2548('0x7'));var rimraf=require(_0x2548('0x8'));var config=require('../../config/environment');var attributes=require(_0x2548('0x9'));var integrations=require(_0x2548('0xa'));module[_0x2548('0xb')]=function(_0x56cf1a,_0x5e6aef){return _0x56cf1a['define'](_0x2548('0xc'),attributes,{'tableName':_0x2548('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a4f69,_0x4c517d,_0xb86ff7){if(_0x4a4f69[_0x2548('0xe')](_0x2548('0xf'))||_0x4a4f69[_0x2548('0xe')](_0x2548('0x10'))||_0x4a4f69[_0x2548('0xe')](_0x2548('0x11'))||_0x4a4f69[_0x2548('0xe')]('clientSecret')||_0x4a4f69[_0x2548('0xe')](_0x2548('0x12'))||_0x4a4f69[_0x2548('0xe')]('host')){var _0x2a4802,_0x55481a;_0x2a4802=_0x4a4f69[_0x2548('0x10')];var _0x394556=_0x2a4802[_0x2548('0x13')](-0x1);if(_0x394556==='/'||_0x394556==='\x5c'||_0x394556===':'){_0x2a4802=_0x2a4802['substring'](0x0,_0x2a4802['lastIndexOf'](_0x394556));}switch(_0x4a4f69[_0x2548('0xf')]){case'US':_0x55481a=_0x2548('0x14');break;case'AU':_0x55481a=_0x2548('0x15');break;case'IN':_0x55481a='https://accounts.zoho.in';break;case'CN':_0x55481a=_0x2548('0x16');break;default:_0x55481a=_0x2548('0x17');break;}var _0x4e22ba={'method':'POST','uri':_0x55481a+_0x2548('0x18'),'form':{'grant_type':_0x2548('0x19'),'client_id':_0x4a4f69['clientId'],'client_secret':_0x4a4f69[_0x2548('0x1a')],'redirect_uri':_0x4a4f69[_0x2548('0x10')],'code':_0x4a4f69[_0x2548('0x12')]},'headers':{'Content-Type':_0x2548('0x1b')}};return rp(_0x4e22ba)[_0x2548('0x1c')](function(_0xf33ee0){var _0x494407=JSON['parse'](_0xf33ee0);if(_0x494407[_0x2548('0x1d')]){_0x4a4f69[_0x2548('0x1e')]=_0x494407[_0x2548('0x1d')];logger[_0x2548('0x1f')](util[_0x2548('0x20')](_0x2548('0x21'),_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']));}else{logger[_0x2548('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']),util[_0x2548('0x24')](_0x494407,{'showHidden':![],'depth':null}));}return _0xb86ff7(null,_0x4c517d);})[_0x2548('0x25')](function(_0x28c873){logger[_0x2548('0x23')](util[_0x2548('0x20')](_0x2548('0x26'),_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xb86ff7(_0x28c873);});}else{return _0xb86ff7(null,_0x4c517d);}},'beforeUpdate':function(_0xf078b,_0x564a15,_0x506541){if(_0xf078b[_0x2548('0xe')](_0x2548('0xf'))||_0xf078b[_0x2548('0xe')]('serverUrl')||_0xf078b[_0x2548('0xe')](_0x2548('0x11'))||_0xf078b[_0x2548('0xe')](_0x2548('0x1a'))||_0xf078b[_0x2548('0xe')]('code')||_0xf078b['changed']('host')){var _0x31f710,_0x277fa3;_0x31f710=_0xf078b[_0x2548('0x10')];var _0x9e9385=_0x31f710['slice'](-0x1);if(_0x9e9385==='/'||_0x9e9385==='\x5c'||_0x9e9385===':'){_0x31f710=_0x31f710[_0x2548('0x27')](0x0,_0x31f710[_0x2548('0x28')](_0x9e9385));}switch(_0xf078b['zone']){case'US':_0x277fa3=_0x2548('0x14');break;case'AU':_0x277fa3='https://accounts.zoho.com.au';break;case'IN':_0x277fa3=_0x2548('0x29');break;case'CN':_0x277fa3=_0x2548('0x16');break;default:_0x277fa3=_0x2548('0x17');break;}var _0x29d35f={'method':_0x2548('0x2a'),'uri':_0x277fa3+'/oauth/v2/token','form':{'grant_type':_0x2548('0x19'),'client_id':_0xf078b['clientId'],'client_secret':_0xf078b['clientSecret'],'redirect_uri':_0xf078b[_0x2548('0x10')],'code':_0xf078b[_0x2548('0x12')]},'headers':{'Content-Type':_0x2548('0x1b')}};return rp(_0x29d35f)[_0x2548('0x1c')](function(_0x459180){var _0x3c14ce=JSON['parse'](_0x459180);if(_0x3c14ce[_0x2548('0x1d')]){_0xf078b['refreshToken']=_0x3c14ce[_0x2548('0x1d')];logger[_0x2548('0x1f')](util[_0x2548('0x20')](_0x2548('0x21'),_0xf078b[_0x2548('0x22')],_0xf078b['id']));}else{logger[_0x2548('0x23')](util['format'](_0x2548('0x26'),_0xf078b[_0x2548('0x22')],_0xf078b['id']),util[_0x2548('0x24')](_0x3c14ce,{'showHidden':![],'depth':null}));}return _0x506541(null,_0x564a15);})['catch'](function(_0x5b5f44){logger[_0x2548('0x23')](util['format'](_0x2548('0x26'),_0xf078b[_0x2548('0x22')],_0xf078b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x506541(_0x5b5f44);});}else{return _0x506541(null,_0x564a15);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0d5e63c..09e85bd 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 _0x551b=['then','GetZohoAccount','stringify','ShowZohoAccount','where','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ZohoAccount','options','raw','attributes','limit','include','model'];(function(_0xc27039,_0x2232e9){var _0x4f7c8c=function(_0x402f6b){while(--_0x402f6b){_0xc27039['push'](_0xc27039['shift']());}};_0x4f7c8c(++_0x2232e9);}(_0x551b,0x66));var _0xb551=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x551b[_0xfc0976];return _0x23579f;};'use strict';var _=require('lodash');var util=require(_0xb551('0x0'));var moment=require(_0xb551('0x1'));var BPromise=require(_0xb551('0x2'));var rs=require(_0xb551('0x3'));var fs=require('fs');var Redis=require(_0xb551('0x4'));var db=require(_0xb551('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb551('0x6'))(_0xb551('0x7'));var config=require(_0xb551('0x8'));var jayson=require(_0xb551('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91740a,_0x4cbe9d,_0x58dca9){return new BPromise(function(_0x530a84,_0x5b3eee){return client['request'](_0x91740a,_0x58dca9)['then'](function(_0x339351){logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,'request\x20sent');logger[_0xb551('0xc')](_0xb551('0xd'),_0x4cbe9d,_0xb551('0xe'),JSON['stringify'](_0x339351));if(_0x339351['error']){if(_0x339351['error']['code']===0x1f4){logger[_0xb551('0xf')](_0xb551('0xb'),_0x4cbe9d,_0x339351[_0xb551('0xf')][_0xb551('0x10')]);return _0x5b3eee(_0x339351[_0xb551('0xf')][_0xb551('0x10')]);}logger[_0xb551('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4cbe9d,_0x339351['error']['message']);return _0x530a84(_0x339351['error']['message']);}else{logger[_0xb551('0xa')](_0xb551('0xb'),_0x4cbe9d,_0xb551('0xe'));_0x530a84(_0x339351[_0xb551('0x11')][_0xb551('0x10')]);}})[_0xb551('0x12')](function(_0x1fb143){logger[_0xb551('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4cbe9d,_0x1fb143);_0x5b3eee(_0x1fb143);});});}exports['GetZohoAccount']=function(_0x4fa188){var _0x5eda1f=this;return new Promise(function(_0x12ace6,_0x1dc01a){return db[_0xb551('0x13')]['findAll']({'raw':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')]['where']||null:null,'attributes':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')][_0xb551('0x16')]||null:null,'limit':_0x4fa188[_0xb551('0x14')]?_0x4fa188[_0xb551('0x14')][_0xb551('0x17')]||null:null,'include':_0x4fa188['options']?_0x4fa188[_0xb551('0x14')]['include']?_['map'](_0x4fa188[_0xb551('0x14')][_0xb551('0x18')],function(_0x4ab1fa){return{'model':db[_0x4ab1fa['model']],'as':_0x4ab1fa['as'],'attributes':_0x4ab1fa[_0xb551('0x16')],'include':_0x4ab1fa['include']?_['map'](_0x4ab1fa[_0xb551('0x18')],function(_0x1cc958){return{'model':db[_0x1cc958[_0xb551('0x19')]],'as':_0x1cc958['as'],'attributes':_0x1cc958[_0xb551('0x16')],'include':_0x1cc958['include']?_['map'](_0x1cc958[_0xb551('0x18')],function(_0x363fe6){return{'model':db[_0x363fe6[_0xb551('0x19')]],'as':_0x363fe6['as'],'attributes':_0x363fe6[_0xb551('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x118938){logger[_0xb551('0xa')](_0xb551('0x1b'),_0x4fa188);logger['debug'](_0xb551('0x1b'),_0x4fa188,JSON[_0xb551('0x1c')](_0x118938));_0x12ace6(_0x118938);})[_0xb551('0x12')](function(_0x57f712){logger[_0xb551('0xf')](_0xb551('0x1b'),_0x57f712[_0xb551('0x10')],_0x4fa188);_0x1dc01a(_0x5eda1f[_0xb551('0xf')](0x1f4,_0x57f712[_0xb551('0x10')]));});});};exports[_0xb551('0x1d')]=function(_0x2bfb66){var _0x346cfe=this;return new Promise(function(_0x391626,_0x3cd7ab){return db['ZohoAccount']['find']({'raw':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x15')]===undefined?!![]:![]:!![],'where':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x1e')]||null:null,'attributes':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66['options'][_0xb551('0x16')]||null:null,'include':_0x2bfb66[_0xb551('0x14')]?_0x2bfb66[_0xb551('0x14')][_0xb551('0x18')]?_[_0xb551('0x1f')](_0x2bfb66['options']['include'],function(_0x5b4fd3){return{'model':db[_0x5b4fd3['model']],'as':_0x5b4fd3['as'],'attributes':_0x5b4fd3[_0xb551('0x16')],'include':_0x5b4fd3[_0xb551('0x18')]?_['map'](_0x5b4fd3[_0xb551('0x18')],function(_0xbf975e){return{'model':db[_0xbf975e[_0xb551('0x19')]],'as':_0xbf975e['as'],'attributes':_0xbf975e[_0xb551('0x16')],'include':_0xbf975e[_0xb551('0x18')]?_[_0xb551('0x1f')](_0xbf975e[_0xb551('0x18')],function(_0x104380){return{'model':db[_0x104380[_0xb551('0x19')]],'as':_0x104380['as'],'attributes':_0x104380['attributes']};}):[]};}):[]};}):[]:[]})[_0xb551('0x1a')](function(_0x4b7e23){logger[_0xb551('0xa')]('ShowZohoAccount',_0x2bfb66);logger[_0xb551('0xc')](_0xb551('0x1d'),_0x2bfb66,JSON[_0xb551('0x1c')](_0x4b7e23));_0x391626(_0x4b7e23);})['catch'](function(_0x3acea5){logger[_0xb551('0xf')]('ShowZohoAccount',_0x3acea5[_0xb551('0x10')],_0x2bfb66);_0x3cd7ab(_0x346cfe['error'](0x1f4,_0x3acea5[_0xb551('0x10')]));});});}; \ No newline at end of file +var _0x3fb4=['findAll','raw','options','where','attributes','include','map','model','then','ShowZohoAccount','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount'];(function(_0x1b94a2,_0x450ca7){var _0x5acbc8=function(_0x2164e6){while(--_0x2164e6){_0x1b94a2['push'](_0x1b94a2['shift']());}};_0x5acbc8(++_0x450ca7);}(_0x3fb4,0x97));var _0x43fb=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3fb4[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x43fb('0x0'));var util=require(_0x43fb('0x1'));var moment=require(_0x43fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x43fb('0x3'));var fs=require('fs');var Redis=require(_0x43fb('0x4'));var db=require(_0x43fb('0x5'))['db'];var utils=require(_0x43fb('0x6'));var logger=require(_0x43fb('0x7'))(_0x43fb('0x8'));var config=require(_0x43fb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x43fb('0xa')][_0x43fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43b24a,_0x4a2be4,_0x45cf38){return new BPromise(function(_0x43944e,_0x13b970){return client[_0x43fb('0xc')](_0x43b24a,_0x45cf38)['then'](function(_0x1c2252){logger[_0x43fb('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x43fb('0xe'));logger[_0x43fb('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4a2be4,_0x43fb('0xe'),JSON['stringify'](_0x1c2252));if(_0x1c2252[_0x43fb('0x10')]){if(_0x1c2252[_0x43fb('0x10')][_0x43fb('0x11')]===0x1f4){logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x1c2252[_0x43fb('0x10')][_0x43fb('0x12')]);return _0x13b970(_0x1c2252[_0x43fb('0x10')][_0x43fb('0x12')]);}logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x1c2252['error'][_0x43fb('0x12')]);return _0x43944e(_0x1c2252['error'][_0x43fb('0x12')]);}else{logger['info'](_0x43fb('0x13'),_0x4a2be4,_0x43fb('0xe'));_0x43944e(_0x1c2252[_0x43fb('0x14')]['message']);}})[_0x43fb('0x15')](function(_0x38c9dc){logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x38c9dc);_0x13b970(_0x38c9dc);});});}exports[_0x43fb('0x16')]=function(_0x5d0e69){var _0x155749=this;return new Promise(function(_0x445ace,_0xf1f181){return db[_0x43fb('0x17')][_0x43fb('0x18')]({'raw':_0x5d0e69['options']?_0x5d0e69['options'][_0x43fb('0x19')]===undefined?!![]:![]:!![],'where':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1b')]||null:null,'attributes':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1c')]||null:null,'limit':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')]['limit']||null:null,'include':_0x5d0e69['options']?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x5d0e69['options'][_0x43fb('0x1d')],function(_0x14e08d){return{'model':db[_0x14e08d[_0x43fb('0x1f')]],'as':_0x14e08d['as'],'attributes':_0x14e08d[_0x43fb('0x1c')],'include':_0x14e08d[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x14e08d[_0x43fb('0x1d')],function(_0x304806){return{'model':db[_0x304806[_0x43fb('0x1f')]],'as':_0x304806['as'],'attributes':_0x304806[_0x43fb('0x1c')],'include':_0x304806[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x304806['include'],function(_0x425c5b){return{'model':db[_0x425c5b[_0x43fb('0x1f')]],'as':_0x425c5b['as'],'attributes':_0x425c5b[_0x43fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43fb('0x20')](function(_0x33f538){logger[_0x43fb('0xd')](_0x43fb('0x16'),_0x5d0e69);logger[_0x43fb('0xf')](_0x43fb('0x16'),_0x5d0e69,JSON['stringify'](_0x33f538));_0x445ace(_0x33f538);})[_0x43fb('0x15')](function(_0xc09976){logger['error'](_0x43fb('0x16'),_0xc09976[_0x43fb('0x12')],_0x5d0e69);_0xf1f181(_0x155749[_0x43fb('0x10')](0x1f4,_0xc09976[_0x43fb('0x12')]));});});};exports['ShowZohoAccount']=function(_0x40c8df){var _0x3ee814=this;return new Promise(function(_0x3d91fd,_0x4ba030){return db[_0x43fb('0x17')]['find']({'raw':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df['options']['raw']===undefined?!![]:![]:!![],'where':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df[_0x43fb('0x1a')][_0x43fb('0x1b')]||null:null,'attributes':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df[_0x43fb('0x1a')]['attributes']||null:null,'include':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df['options'][_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x40c8df[_0x43fb('0x1a')][_0x43fb('0x1d')],function(_0x3b4f14){return{'model':db[_0x3b4f14[_0x43fb('0x1f')]],'as':_0x3b4f14['as'],'attributes':_0x3b4f14[_0x43fb('0x1c')],'include':_0x3b4f14[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x3b4f14[_0x43fb('0x1d')],function(_0x2bc728){return{'model':db[_0x2bc728['model']],'as':_0x2bc728['as'],'attributes':_0x2bc728['attributes'],'include':_0x2bc728[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x2bc728['include'],function(_0x3979f1){return{'model':db[_0x3979f1[_0x43fb('0x1f')]],'as':_0x3979f1['as'],'attributes':_0x3979f1[_0x43fb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x227bed){logger[_0x43fb('0xd')](_0x43fb('0x21'),_0x40c8df);logger[_0x43fb('0xf')](_0x43fb('0x21'),_0x40c8df,JSON[_0x43fb('0x22')](_0x227bed));_0x3d91fd(_0x227bed);})['catch'](function(_0x44313a){logger[_0x43fb('0x10')]('ShowZohoAccount',_0x44313a[_0x43fb('0x12')],_0x40c8df);_0x4ba030(_0x3ee814[_0x43fb('0x10')](0x1f4,_0x44313a[_0x43fb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 8ad7a31..15727ef 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 _0xa74f=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5ab684,_0x73e39a){var _0x3e0172=function(_0x32de79){while(--_0x32de79){_0x5ab684['push'](_0x5ab684['shift']());}};_0x3e0172(++_0x73e39a);}(_0xa74f,0x9a));var _0xfa74=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xa74f[_0x40be86];return _0xda3c3b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./intZohoConfiguration.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0x5')](_0xfa74('0xb'),auth[_0xfa74('0x7')](),controller['getSubjects']);router[_0xfa74('0x5')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xf')]);router['put'](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x10')]);router[_0xfa74('0x11')]('/:id',auth[_0xfa74('0x7')](),controller[_0xfa74('0x12')]);module[_0xfa74('0x13')]=router; \ No newline at end of file +var _0x9d62=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports'];(function(_0x521aef,_0x1dccbd){var _0x170172=function(_0x41eadc){while(--_0x41eadc){_0x521aef['push'](_0x521aef['shift']());}};_0x170172(++_0x1dccbd);}(_0x9d62,0xaf));var _0x29d6=function(_0x47432a,_0x31c4ed){_0x47432a=_0x47432a-0x0;var _0x21cd01=_0x9d62[_0x47432a];return _0x21cd01;};'use strict';var multer=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var path=require(_0x29d6('0x2'));var timeout=require(_0x29d6('0x3'));var express=require(_0x29d6('0x4'));var router=express['Router']();var auth=require(_0x29d6('0x5'));var interaction=require(_0x29d6('0x6'));var config=require(_0x29d6('0x7'));var controller=require(_0x29d6('0x8'));router[_0x29d6('0x9')]('/',auth['isAuthenticated'](),controller[_0x29d6('0xa')]);router[_0x29d6('0x9')](_0x29d6('0xb'),auth[_0x29d6('0xc')](),controller[_0x29d6('0xd')]);router[_0x29d6('0x9')]('/:id/fields',auth[_0x29d6('0xc')](),controller[_0x29d6('0xe')]);router[_0x29d6('0x9')](_0x29d6('0xf'),auth[_0x29d6('0xc')](),controller[_0x29d6('0x10')]);router[_0x29d6('0x9')](_0x29d6('0x11'),auth['isAuthenticated'](),controller[_0x29d6('0x12')]);router[_0x29d6('0x13')]('/',auth[_0x29d6('0xc')](),controller[_0x29d6('0x14')]);router[_0x29d6('0x15')](_0x29d6('0xb'),auth[_0x29d6('0xc')](),controller['update']);router[_0x29d6('0x16')]('/:id',auth[_0x29d6('0xc')](),controller[_0x29d6('0x17')]);module[_0x29d6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8cefac7..7174693 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 _0xcd93=['ENUM','lead','nothing','contact_lead','contact','sequelize','STRING'];(function(_0x3e363e,_0x1e90ce){var _0x42b492=function(_0x543efc){while(--_0x543efc){_0x3e363e['push'](_0x3e363e['shift']());}};_0x42b492(++_0x1e90ce);}(_0xcd93,0xde));var _0x3cd9=function(_0x4062a7,_0x2a62ae){_0x4062a7=_0x4062a7-0x0;var _0x17c1fe=_0xcd93[_0x4062a7];return _0x17c1fe;};'use strict';var Sequelize=require(_0x3cd9('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cd9('0x1')]},'moduleCreate':{'type':Sequelize[_0x3cd9('0x2')](_0x3cd9('0x3'),'contact',_0x3cd9('0x4')),'defaultValue':_0x3cd9('0x3')},'moduleSearch':{'type':Sequelize[_0x3cd9('0x2')](_0x3cd9('0x5'),_0x3cd9('0x6'),_0x3cd9('0x3')),'defaultValue':_0x3cd9('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2b31=['STRING','lead','contact','contact_lead','sequelize','exports'];(function(_0x14f681,_0xa0808e){var _0x1d4cb2=function(_0x66e474){while(--_0x66e474){_0x14f681['push'](_0x14f681['shift']());}};_0x1d4cb2(++_0xa0808e);}(_0x2b31,0xa0));var _0x12b3=function(_0x4e150b,_0x2bb913){_0x4e150b=_0x4e150b-0x0;var _0x433ace=_0x2b31[_0x4e150b];return _0x433ace;};'use strict';var Sequelize=require(_0x12b3('0x0'));module[_0x12b3('0x1')]={'name':{'type':Sequelize[_0x12b3('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x12b3('0x3'),_0x12b3('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x12b3('0x5'),_0x12b3('0x4'),'lead'),'defaultValue':_0x12b3('0x5')},'description':{'type':Sequelize[_0x12b3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index de4f1ca..2d82c39 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(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 8e78ecd..d078d6e 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 _0x9b95=['path','rimraf','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment'];(function(_0x181642,_0x5004d2){var _0x301bd9=function(_0x211c34){while(--_0x211c34){_0x181642['push'](_0x181642['shift']());}};_0x301bd9(++_0x5004d2);}(_0x9b95,0x9e));var _0x59b9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9b95[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x59b9('0x0'));var util=require(_0x59b9('0x1'));var logger=require('../../config/logger')(_0x59b9('0x2'));var moment=require(_0x59b9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59b9('0x4'));var rimraf=require(_0x59b9('0x5'));var config=require('../../config/environment');var attributes=require(_0x59b9('0x6'));module['exports']=function(_0x13130c,_0x338834){return _0x13130c['define'](_0x59b9('0x7'),attributes,{'tableName':_0x59b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b98=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','bluebird'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x0b98,0x1f4));var _0x80b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b98[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x80b9('0x0'));var util=require(_0x80b9('0x1'));var logger=require('../../config/logger')(_0x80b9('0x2'));var moment=require('moment');var BPromise=require(_0x80b9('0x3'));var rp=require(_0x80b9('0x4'));var fs=require('fs');var path=require(_0x80b9('0x5'));var rimraf=require(_0x80b9('0x6'));var config=require(_0x80b9('0x7'));var attributes=require(_0x80b9('0x8'));module['exports']=function(_0x3aa1e2,_0x48e543){return _0x3aa1e2[_0x80b9('0x9')](_0x80b9('0xa'),attributes,{'tableName':_0x80b9('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 bf9eb6f..0cd192f 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 _0x0e00=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0e00,0x6d));var _0x00e0=function(_0x1d8012,_0x519ed3){_0x1d8012=_0x1d8012-0x0;var _0x29f754=_0x0e00[_0x1d8012];return _0x29f754;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x00e0('0x0'));var BPromise=require(_0x00e0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00e0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x00e0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x00e0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x00e0('0x5')][_0x00e0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x226676,_0x3e8a7e,_0x2b62ac){return new BPromise(function(_0x337402,_0x5583de){return client[_0x00e0('0x7')](_0x226676,_0x2b62ac)[_0x00e0('0x8')](function(_0x3a4fed){logger['info'](_0x00e0('0x9'),_0x3e8a7e,_0x00e0('0xa'));logger[_0x00e0('0xb')](_0x00e0('0xc'),_0x3e8a7e,'request\x20sent',JSON[_0x00e0('0xd')](_0x3a4fed));if(_0x3a4fed[_0x00e0('0xe')]){if(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0xf')]===0x1f4){logger['error'](_0x00e0('0x9'),_0x3e8a7e,_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);return _0x5583de(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);}logger[_0x00e0('0xe')](_0x00e0('0x9'),_0x3e8a7e,_0x3a4fed[_0x00e0('0xe')]['message']);return _0x337402(_0x3a4fed[_0x00e0('0xe')][_0x00e0('0x10')]);}else{logger[_0x00e0('0x11')](_0x00e0('0x9'),_0x3e8a7e,_0x00e0('0xa'));_0x337402(_0x3a4fed[_0x00e0('0x12')][_0x00e0('0x10')]);}})[_0x00e0('0x13')](function(_0x120b66){logger[_0x00e0('0xe')](_0x00e0('0x9'),_0x3e8a7e,_0x120b66);_0x5583de(_0x120b66);});});} \ No newline at end of file +var _0xeb75=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','ZohoConfiguration,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x267120,_0x4aee8f){var _0x3d4afa=function(_0x49d4ef){while(--_0x49d4ef){_0x267120['push'](_0x267120['shift']());}};_0x3d4afa(++_0x4aee8f);}(_0xeb75,0x16d));var _0x5eb7=function(_0x1d3a31,_0xc57aec){_0x1d3a31=_0x1d3a31-0x0;var _0x8a808e=_0xeb75[_0x1d3a31];return _0x8a808e;};'use strict';var _=require('lodash');var util=require(_0x5eb7('0x0'));var moment=require(_0x5eb7('0x1'));var BPromise=require(_0x5eb7('0x2'));var rs=require(_0x5eb7('0x3'));var fs=require('fs');var Redis=require(_0x5eb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5eb7('0x5'));var logger=require('../../config/logger')(_0x5eb7('0x6'));var config=require(_0x5eb7('0x7'));var jayson=require(_0x5eb7('0x8'));var client=jayson[_0x5eb7('0x9')][_0x5eb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cb72,_0x48e4ac,_0x55a18a){return new BPromise(function(_0x1c1640,_0x12e9bc){return client[_0x5eb7('0xb')](_0x42cb72,_0x55a18a)['then'](function(_0x3318ab){logger[_0x5eb7('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x48e4ac,_0x5eb7('0xd'));logger[_0x5eb7('0xe')](_0x5eb7('0xf'),_0x48e4ac,_0x5eb7('0xd'),JSON[_0x5eb7('0x10')](_0x3318ab));if(_0x3318ab['error']){if(_0x3318ab['error']['code']===0x1f4){logger['error'](_0x5eb7('0x11'),_0x48e4ac,_0x3318ab[_0x5eb7('0x12')][_0x5eb7('0x13')]);return _0x12e9bc(_0x3318ab[_0x5eb7('0x12')]['message']);}logger[_0x5eb7('0x12')](_0x5eb7('0x11'),_0x48e4ac,_0x3318ab['error'][_0x5eb7('0x13')]);return _0x1c1640(_0x3318ab[_0x5eb7('0x12')]['message']);}else{logger[_0x5eb7('0xc')](_0x5eb7('0x11'),_0x48e4ac,_0x5eb7('0xd'));_0x1c1640(_0x3318ab[_0x5eb7('0x14')]['message']);}})['catch'](function(_0x3b2255){logger[_0x5eb7('0x12')](_0x5eb7('0x11'),_0x48e4ac,_0x3b2255);_0x12e9bc(_0x3b2255);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 66fb016..0675914 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 _0xfff0=['show','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','/:id'];(function(_0x4e4876,_0x10b99c){var _0x10fa1f=function(_0x18dd81){while(--_0x18dd81){_0x4e4876['push'](_0x4e4876['shift']());}};_0x10fa1f(++_0x10b99c);}(_0xfff0,0x139));var _0x0fff=function(_0x5300eb,_0x40a89b){_0x5300eb=_0x5300eb-0x0;var _0x3ee625=_0xfff0[_0x5300eb];return _0x3ee625;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['post']('/',auth[_0x0fff('0xb')](),controller['create']);router[_0x0fff('0xc')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xd')]);router[_0x0fff('0xe')](_0x0fff('0x9'),auth[_0x0fff('0xb')](),controller[_0x0fff('0xf')]);module[_0x0fff('0x10')]=router; \ No newline at end of file +var _0xe2cf=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x2b53b7,_0x2136f4){var _0x4c8a3e=function(_0x545407){while(--_0x545407){_0x2b53b7['push'](_0x2b53b7['shift']());}};_0x4c8a3e(++_0x2136f4);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x55fd40,_0x225b77){_0x55fd40=_0x55fd40-0x0;var _0x7979f1=_0xe2cf[_0x55fd40];return _0x7979f1;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var auth=require(_0xfe2c('0x3'));var interaction=require(_0xfe2c('0x4'));var config=require(_0xfe2c('0x5'));var controller=require('./intZohoField.controller');router[_0xfe2c('0x6')]('/',auth[_0xfe2c('0x7')](),controller['index']);router['get'](_0xfe2c('0x8'),auth[_0xfe2c('0x7')](),controller['show']);router['post']('/',auth[_0xfe2c('0x7')](),controller[_0xfe2c('0x9')]);router[_0xfe2c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfe2c('0xb')]);router[_0xfe2c('0xc')]('/:id',auth[_0xfe2c('0x7')](),controller[_0xfe2c('0xd')]);module[_0xfe2c('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 1fc5a68..2e76f79 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 _0xdbd0=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x40c5e5,_0x1c24a2){var _0x527a78=function(_0x503fa9){while(--_0x503fa9){_0x40c5e5['push'](_0x40c5e5['shift']());}};_0x527a78(++_0x1c24a2);}(_0xdbd0,0x88));var _0x0dbd=function(_0x52b505,_0x365bab){_0x52b505=_0x52b505-0x0;var _0x19a38a=_0xdbd0[_0x52b505];return _0x19a38a;};'use strict';var Sequelize=require(_0x0dbd('0x0'));module[_0x0dbd('0x1')]={'type':{'type':Sequelize[_0x0dbd('0x2')](_0x0dbd('0x3'),_0x0dbd('0x4'),'customVariable',_0x0dbd('0x5')),'defaultValue':_0x0dbd('0x3')},'content':{'type':Sequelize[_0x0dbd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0dbd('0x2')](_0x0dbd('0x3'),_0x0dbd('0x4'),_0x0dbd('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0dbd('0x6')]},'customField':{'type':Sequelize[_0x0dbd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0dbd('0x6')]}}; \ No newline at end of file +var _0xdbbe=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0xdbbe,0x148));var _0xedbb=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xdbbe[_0x8dc04d];return _0x2f5f28;};'use strict';var Sequelize=require('sequelize');module[_0xedbb('0x0')]={'type':{'type':Sequelize[_0xedbb('0x1')](_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'),_0xedbb('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xedbb('0x6')]},'key':{'type':Sequelize[_0xedbb('0x6')]},'keyType':{'type':Sequelize[_0xedbb('0x1')](_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'))},'keyContent':{'type':Sequelize[_0xedbb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedbb('0x6')]},'customField':{'type':Sequelize[_0xedbb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 44e488b..4419395 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 _0xf4e7=['ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','path','to-csv'];(function(_0x47d676,_0x47ad35){var _0x3bf7d3=function(_0x532122){while(--_0x532122){_0x47d676['push'](_0x47d676['shift']());}};_0x3bf7d3(++_0x47ad35);}(_0xf4e7,0x1e3));var _0x7f4e=function(_0x369811,_0x37e9df){_0x369811=_0x369811-0x0;var _0x1de129=_0xf4e7[_0x369811];return _0x1de129;};'use strict';var pdf=require(_0x7f4e('0x0'));var emlformat=require(_0x7f4e('0x1'));var rimraf=require(_0x7f4e('0x2'));var zipdir=require(_0x7f4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7f4e('0x5'));var sox=require('sox');var csv=require(_0x7f4e('0x6'));var ejs=require(_0x7f4e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f4e('0x8'));var crypto=require(_0x7f4e('0x9'));var jsforce=require(_0x7f4e('0xa'));var deskjs=require(_0x7f4e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7f4e('0xc'));var Papa=require(_0x7f4e('0xd'));var Redis=require(_0x7f4e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f4e('0xf'));var as=require(_0x7f4e('0x10'));var hardwareService=require(_0x7f4e('0x11'));var logger=require('../../config/logger')(_0x7f4e('0x12'));var utils=require(_0x7f4e('0x13'));var config=require(_0x7f4e('0x14'));var licenseUtil=require(_0x7f4e('0x15'));var db=require(_0x7f4e('0x16'))['db'];function respondWithStatusCode(_0x517190,_0xaa320d){_0xaa320d=_0xaa320d||0xcc;return function(_0x3c3c31){if(_0x3c3c31){return _0x517190[_0x7f4e('0x17')](_0xaa320d);}return _0x517190[_0x7f4e('0x18')](_0xaa320d)['end']();};}function respondWithResult(_0x2269d2,_0x1ebf5e){_0x1ebf5e=_0x1ebf5e||0xc8;return function(_0x31b24a){if(_0x31b24a){return _0x2269d2[_0x7f4e('0x18')](_0x1ebf5e)[_0x7f4e('0x19')](_0x31b24a);}};}function respondWithFilteredResult(_0x3d0b25,_0x5c111c){return function(_0x3555ee){if(_0x3555ee){var _0x2e0ac7=_0x3555ee[_0x7f4e('0x1a')],_0x53b4f7=_0x5c111c[_0x7f4e('0x1b')],_0x3206bd=_0x5c111c[_0x7f4e('0x1b')]+_0x5c111c[_0x7f4e('0x1c')],_0x4f29c3;if(_0x3206bd>=_0x2e0ac7){_0x3206bd=_0x2e0ac7;_0x4f29c3=0xc8;}else{_0x4f29c3=0xce;}_0x3d0b25['status'](_0x4f29c3);return _0x3d0b25['set'](_0x7f4e('0x1d'),_0x53b4f7+'-'+_0x3206bd+'/'+_0x2e0ac7)[_0x7f4e('0x19')](_0x3555ee);}return null;};}function patchUpdates(_0x1c7d3c){return function(_0x55d5c9){try{jsonpatch[_0x7f4e('0x1e')](_0x55d5c9,_0x1c7d3c,!![]);}catch(_0x5ab7e5){return BPromise[_0x7f4e('0x1f')](_0x5ab7e5);}return _0x55d5c9['save']();};}function saveUpdates(_0x26d773,_0x3ad923){return function(_0x39de21){if(_0x39de21){return _0x39de21[_0x7f4e('0x20')](_0x26d773)[_0x7f4e('0x21')](function(_0x38fb33){return _0x38fb33;});}return null;};}function removeEntity(_0x58d2a7,_0x3e91c7){return function(_0x1ec922){if(_0x1ec922){return _0x1ec922['destroy']()[_0x7f4e('0x21')](function(){_0x58d2a7[_0x7f4e('0x18')](0xcc)[_0x7f4e('0x22')]();});}};}function handleEntityNotFound(_0x1ec5b7,_0x4db874){return function(_0x5a0354){if(!_0x5a0354){_0x1ec5b7['sendStatus'](0x194);}return _0x5a0354;};}function handleError(_0x8ddc76,_0x14abc3){_0x14abc3=_0x14abc3||0x1f4;return function(_0x3e8bc3){logger['error'](_0x3e8bc3[_0x7f4e('0x23')]);if(_0x3e8bc3[_0x7f4e('0x24')]){delete _0x3e8bc3[_0x7f4e('0x24')];}_0x8ddc76[_0x7f4e('0x18')](_0x14abc3)[_0x7f4e('0x25')](_0x3e8bc3);};}exports[_0x7f4e('0x26')]=function(_0xa65ac9,_0x6ad19d){var _0x51f4c1={},_0x3035f1={},_0x2d54d4={'count':0x0,'rows':[]};var _0x1a2016=_[_0x7f4e('0x27')](db[_0x7f4e('0x28')][_0x7f4e('0x29')],function(_0x39b6ed){return{'name':_0x39b6ed[_0x7f4e('0x2a')],'type':_0x39b6ed[_0x7f4e('0x2b')]['key']};});_0x3035f1[_0x7f4e('0x2c')]=_[_0x7f4e('0x27')](_0x1a2016,_0x7f4e('0x24'));_0x3035f1[_0x7f4e('0x2d')]=_[_0x7f4e('0x2e')](_0xa65ac9[_0x7f4e('0x2d')]);_0x3035f1[_0x7f4e('0x2f')]=_[_0x7f4e('0x30')](_0x3035f1[_0x7f4e('0x2c')],_0x3035f1[_0x7f4e('0x2d')]);_0x51f4c1[_0x7f4e('0x31')]=_['intersection'](_0x3035f1[_0x7f4e('0x2c')],qs['fields'](_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x32')]));_0x51f4c1[_0x7f4e('0x31')]=_0x51f4c1[_0x7f4e('0x31')][_0x7f4e('0x33')]?_0x51f4c1[_0x7f4e('0x31')]:_0x3035f1['model'];if(!_0xa65ac9[_0x7f4e('0x2d')]['hasOwnProperty']('nolimit')){_0x51f4c1[_0x7f4e('0x1c')]=qs['limit'](_0xa65ac9['query'][_0x7f4e('0x1c')]);_0x51f4c1[_0x7f4e('0x1b')]=qs[_0x7f4e('0x1b')](_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x1b')]);}_0x51f4c1['order']=qs[_0x7f4e('0x34')](_0xa65ac9[_0x7f4e('0x2d')]['sort']);_0x51f4c1[_0x7f4e('0x35')]=qs['filters'](_[_0x7f4e('0x36')](_0xa65ac9['query'],_0x3035f1['filters']),_0x1a2016);if(_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x37')]){_0x51f4c1[_0x7f4e('0x35')]=_[_0x7f4e('0x38')](_0x51f4c1[_0x7f4e('0x35')],{'$or':_[_0x7f4e('0x27')](_0x1a2016,function(_0x4e706e){if(_0x4e706e[_0x7f4e('0x2b')]!==_0x7f4e('0x39')){var _0x20e281={};_0x20e281[_0x4e706e[_0x7f4e('0x24')]]={'$like':'%'+_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x37')]+'%'};return _0x20e281;}})});}_0x51f4c1=_[_0x7f4e('0x38')]({},_0x51f4c1,_0xa65ac9[_0x7f4e('0x3a')]);var _0x172a9c={'where':_0x51f4c1[_0x7f4e('0x35')]};return db[_0x7f4e('0x28')]['count'](_0x172a9c)[_0x7f4e('0x21')](function(_0x512f5f){_0x2d54d4[_0x7f4e('0x1a')]=_0x512f5f;if(_0xa65ac9[_0x7f4e('0x2d')][_0x7f4e('0x3b')]){_0x51f4c1['include']=[{'all':!![]}];}return db[_0x7f4e('0x28')][_0x7f4e('0x3c')](_0x51f4c1);})[_0x7f4e('0x21')](function(_0x1db9a7){_0x2d54d4[_0x7f4e('0x3d')]=_0x1db9a7;return _0x2d54d4;})[_0x7f4e('0x21')](respondWithFilteredResult(_0x6ad19d,_0x51f4c1))[_0x7f4e('0x3e')](handleError(_0x6ad19d,null));};exports[_0x7f4e('0x3f')]=function(_0x4f3ffd,_0x30e33c){var _0x168a07={'raw':!![],'where':{'id':_0x4f3ffd[_0x7f4e('0x40')]['id']}},_0x347c70={};_0x347c70['model']=_[_0x7f4e('0x2e')](db[_0x7f4e('0x28')][_0x7f4e('0x29')]);_0x347c70['query']=_[_0x7f4e('0x2e')](_0x4f3ffd[_0x7f4e('0x2d')]);_0x347c70[_0x7f4e('0x2f')]=_[_0x7f4e('0x30')](_0x347c70[_0x7f4e('0x2c')],_0x347c70[_0x7f4e('0x2d')]);_0x168a07['attributes']=_[_0x7f4e('0x30')](_0x347c70['model'],qs[_0x7f4e('0x32')](_0x4f3ffd[_0x7f4e('0x2d')]['fields']));_0x168a07['attributes']=_0x168a07['attributes'][_0x7f4e('0x33')]?_0x168a07[_0x7f4e('0x31')]:_0x347c70[_0x7f4e('0x2c')];if(_0x4f3ffd[_0x7f4e('0x2d')][_0x7f4e('0x3b')]){_0x168a07[_0x7f4e('0x41')]=[{'all':!![]}];}_0x168a07=_[_0x7f4e('0x38')]({},_0x168a07,_0x4f3ffd[_0x7f4e('0x3a')]);return db[_0x7f4e('0x28')][_0x7f4e('0x42')](_0x168a07)[_0x7f4e('0x21')](handleEntityNotFound(_0x30e33c,null))[_0x7f4e('0x21')](respondWithResult(_0x30e33c,null))[_0x7f4e('0x3e')](handleError(_0x30e33c,null));};exports['create']=function(_0xc3e95b,_0x48a62f){return db[_0x7f4e('0x28')][_0x7f4e('0x43')](_0xc3e95b[_0x7f4e('0x44')],{})[_0x7f4e('0x21')](respondWithResult(_0x48a62f,0xc9))[_0x7f4e('0x3e')](handleError(_0x48a62f,null));};exports[_0x7f4e('0x20')]=function(_0x2a4be7,_0x2fc8a5){if(_0x2a4be7['body']['id']){delete _0x2a4be7['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x2a4be7[_0x7f4e('0x40')]['id']}})[_0x7f4e('0x21')](handleEntityNotFound(_0x2fc8a5,null))[_0x7f4e('0x21')](saveUpdates(_0x2a4be7[_0x7f4e('0x44')],null))[_0x7f4e('0x21')](respondWithResult(_0x2fc8a5,null))['catch'](handleError(_0x2fc8a5,null));};exports[_0x7f4e('0x45')]=function(_0x5c5c63,_0x59440c){return db[_0x7f4e('0x28')]['find']({'where':{'id':_0x5c5c63[_0x7f4e('0x40')]['id']}})['then'](handleEntityNotFound(_0x59440c,null))[_0x7f4e('0x21')](removeEntity(_0x59440c,null))[_0x7f4e('0x3e')](handleError(_0x59440c,null));}; \ No newline at end of file +var _0xdeca=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ZohoField','rawAttributes','type','key','model','name','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x26c7c8,_0x1bbfff){var _0x47ffa9=function(_0x568d94){while(--_0x568d94){_0x26c7c8['push'](_0x26c7c8['shift']());}};_0x47ffa9(++_0x1bbfff);}(_0xdeca,0x164));var _0xadec=function(_0x6f9c8d,_0x24544a){_0x6f9c8d=_0x6f9c8d-0x0;var _0x2773e0=_0xdeca[_0x6f9c8d];return _0x2773e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadec('0x0'));var rimraf=require(_0xadec('0x1'));var zipdir=require(_0xadec('0x2'));var jsonpatch=require(_0xadec('0x3'));var rp=require(_0xadec('0x4'));var moment=require(_0xadec('0x5'));var BPromise=require(_0xadec('0x6'));var Mustache=require(_0xadec('0x7'));var util=require(_0xadec('0x8'));var path=require(_0xadec('0x9'));var sox=require(_0xadec('0xa'));var csv=require(_0xadec('0xb'));var ejs=require(_0xadec('0xc'));var fs=require('fs');var _=require(_0xadec('0xd'));var squel=require(_0xadec('0xe'));var crypto=require('crypto');var jsforce=require(_0xadec('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xadec('0xb'));var querystring=require(_0xadec('0x10'));var Papa=require(_0xadec('0x11'));var Redis=require(_0xadec('0x12'));var authService=require(_0xadec('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xadec('0x14'))(_0xadec('0x15'));var utils=require(_0xadec('0x16'));var config=require(_0xadec('0x17'));var licenseUtil=require(_0xadec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d42c5,_0x819418){_0x819418=_0x819418||0xcc;return function(_0x11f13a){if(_0x11f13a){return _0x5d42c5[_0xadec('0x19')](_0x819418);}return _0x5d42c5[_0xadec('0x1a')](_0x819418)[_0xadec('0x1b')]();};}function respondWithResult(_0x28c2ec,_0x14200c){_0x14200c=_0x14200c||0xc8;return function(_0xce0215){if(_0xce0215){return _0x28c2ec['status'](_0x14200c)[_0xadec('0x1c')](_0xce0215);}};}function respondWithFilteredResult(_0x50a961,_0x157f43){return function(_0xb8435d){if(_0xb8435d){var _0x45029b=_0xb8435d[_0xadec('0x1d')],_0x51c8a3=_0x157f43[_0xadec('0x1e')],_0x5d782b=_0x157f43[_0xadec('0x1e')]+_0x157f43['limit'],_0x1c6dd7;if(_0x5d782b>=_0x45029b){_0x5d782b=_0x45029b;_0x1c6dd7=0xc8;}else{_0x1c6dd7=0xce;}_0x50a961[_0xadec('0x1a')](_0x1c6dd7);return _0x50a961[_0xadec('0x1f')](_0xadec('0x20'),_0x51c8a3+'-'+_0x5d782b+'/'+_0x45029b)[_0xadec('0x1c')](_0xb8435d);}return null;};}function patchUpdates(_0x3b40d5){return function(_0x242056){try{jsonpatch[_0xadec('0x21')](_0x242056,_0x3b40d5,!![]);}catch(_0x3f64c3){return BPromise[_0xadec('0x22')](_0x3f64c3);}return _0x242056[_0xadec('0x23')]();};}function saveUpdates(_0xd4a2b0,_0x81846e){return function(_0x8f88b1){if(_0x8f88b1){return _0x8f88b1[_0xadec('0x24')](_0xd4a2b0)[_0xadec('0x25')](function(_0x75a3f1){return _0x75a3f1;});}return null;};}function removeEntity(_0x54fc91,_0x1e5fc8){return function(_0x59837d){if(_0x59837d){return _0x59837d[_0xadec('0x26')]()[_0xadec('0x25')](function(){_0x54fc91['status'](0xcc)[_0xadec('0x1b')]();});}};}function handleEntityNotFound(_0x5d44d2,_0x2821b7){return function(_0xc63851){if(!_0xc63851){_0x5d44d2['sendStatus'](0x194);}return _0xc63851;};}function handleError(_0x42133c,_0x181197){_0x181197=_0x181197||0x1f4;return function(_0x2a8ee9){logger[_0xadec('0x27')](_0x2a8ee9[_0xadec('0x28')]);if(_0x2a8ee9['name']){delete _0x2a8ee9['name'];}_0x42133c[_0xadec('0x1a')](_0x181197)[_0xadec('0x29')](_0x2a8ee9);};}exports['index']=function(_0xa9e15e,_0x5dd3bb){var _0x7a5063={},_0x2faf1e={},_0x268fad={'count':0x0,'rows':[]};var _0xda4d0a=_[_0xadec('0x2a')](db[_0xadec('0x2b')][_0xadec('0x2c')],function(_0x5c9a3c){return{'name':_0x5c9a3c['fieldName'],'type':_0x5c9a3c[_0xadec('0x2d')][_0xadec('0x2e')]};});_0x2faf1e[_0xadec('0x2f')]=_[_0xadec('0x2a')](_0xda4d0a,_0xadec('0x30'));_0x2faf1e[_0xadec('0x31')]=_['keys'](_0xa9e15e[_0xadec('0x31')]);_0x2faf1e['filters']=_[_0xadec('0x32')](_0x2faf1e['model'],_0x2faf1e['query']);_0x7a5063[_0xadec('0x33')]=_[_0xadec('0x32')](_0x2faf1e[_0xadec('0x2f')],qs['fields'](_0xa9e15e[_0xadec('0x31')]['fields']));_0x7a5063[_0xadec('0x33')]=_0x7a5063[_0xadec('0x33')][_0xadec('0x34')]?_0x7a5063['attributes']:_0x2faf1e[_0xadec('0x2f')];if(!_0xa9e15e['query'][_0xadec('0x35')](_0xadec('0x36'))){_0x7a5063[_0xadec('0x37')]=qs['limit'](_0xa9e15e[_0xadec('0x31')][_0xadec('0x37')]);_0x7a5063[_0xadec('0x1e')]=qs[_0xadec('0x1e')](_0xa9e15e[_0xadec('0x31')][_0xadec('0x1e')]);}_0x7a5063[_0xadec('0x38')]=qs[_0xadec('0x39')](_0xa9e15e['query']['sort']);_0x7a5063[_0xadec('0x3a')]=qs['filters'](_[_0xadec('0x3b')](_0xa9e15e[_0xadec('0x31')],_0x2faf1e[_0xadec('0x3c')]),_0xda4d0a);if(_0xa9e15e[_0xadec('0x31')]['filter']){_0x7a5063[_0xadec('0x3a')]=_[_0xadec('0x3d')](_0x7a5063[_0xadec('0x3a')],{'$or':_[_0xadec('0x2a')](_0xda4d0a,function(_0x286910){if(_0x286910[_0xadec('0x2d')]!==_0xadec('0x3e')){var _0x146e9c={};_0x146e9c[_0x286910[_0xadec('0x30')]]={'$like':'%'+_0xa9e15e[_0xadec('0x31')][_0xadec('0x3f')]+'%'};return _0x146e9c;}})});}_0x7a5063=_[_0xadec('0x3d')]({},_0x7a5063,_0xa9e15e[_0xadec('0x40')]);var _0x261896={'where':_0x7a5063['where']};return db['ZohoField'][_0xadec('0x1d')](_0x261896)[_0xadec('0x25')](function(_0x31063b){_0x268fad[_0xadec('0x1d')]=_0x31063b;if(_0xa9e15e[_0xadec('0x31')][_0xadec('0x41')]){_0x7a5063[_0xadec('0x42')]=[{'all':!![]}];}return db[_0xadec('0x2b')][_0xadec('0x43')](_0x7a5063);})['then'](function(_0x4cfc84){_0x268fad[_0xadec('0x44')]=_0x4cfc84;return _0x268fad;})[_0xadec('0x25')](respondWithFilteredResult(_0x5dd3bb,_0x7a5063))[_0xadec('0x45')](handleError(_0x5dd3bb,null));};exports[_0xadec('0x46')]=function(_0x3cc2c0,_0x4e9ba6){var _0x3e0e36={'raw':!![],'where':{'id':_0x3cc2c0[_0xadec('0x47')]['id']}},_0x4e16dc={};_0x4e16dc[_0xadec('0x2f')]=_[_0xadec('0x48')](db[_0xadec('0x2b')][_0xadec('0x2c')]);_0x4e16dc['query']=_[_0xadec('0x48')](_0x3cc2c0['query']);_0x4e16dc['filters']=_['intersection'](_0x4e16dc[_0xadec('0x2f')],_0x4e16dc[_0xadec('0x31')]);_0x3e0e36[_0xadec('0x33')]=_[_0xadec('0x32')](_0x4e16dc['model'],qs[_0xadec('0x49')](_0x3cc2c0[_0xadec('0x31')][_0xadec('0x49')]));_0x3e0e36[_0xadec('0x33')]=_0x3e0e36[_0xadec('0x33')]['length']?_0x3e0e36[_0xadec('0x33')]:_0x4e16dc[_0xadec('0x2f')];if(_0x3cc2c0[_0xadec('0x31')]['includeAll']){_0x3e0e36[_0xadec('0x42')]=[{'all':!![]}];}_0x3e0e36=_[_0xadec('0x3d')]({},_0x3e0e36,_0x3cc2c0[_0xadec('0x40')]);return db[_0xadec('0x2b')][_0xadec('0x4a')](_0x3e0e36)['then'](handleEntityNotFound(_0x4e9ba6,null))['then'](respondWithResult(_0x4e9ba6,null))[_0xadec('0x45')](handleError(_0x4e9ba6,null));};exports[_0xadec('0x4b')]=function(_0x523ee3,_0x22c2be){return db['ZohoField'][_0xadec('0x4b')](_0x523ee3['body'],{})[_0xadec('0x25')](respondWithResult(_0x22c2be,0xc9))[_0xadec('0x45')](handleError(_0x22c2be,null));};exports[_0xadec('0x24')]=function(_0x552fee,_0x199314){if(_0x552fee[_0xadec('0x4c')]['id']){delete _0x552fee[_0xadec('0x4c')]['id'];}return db[_0xadec('0x2b')][_0xadec('0x4a')]({'where':{'id':_0x552fee[_0xadec('0x47')]['id']}})[_0xadec('0x25')](handleEntityNotFound(_0x199314,null))['then'](saveUpdates(_0x552fee[_0xadec('0x4c')],null))[_0xadec('0x25')](respondWithResult(_0x199314,null))[_0xadec('0x45')](handleError(_0x199314,null));};exports[_0xadec('0x26')]=function(_0x252d59,_0x3714a1){return db[_0xadec('0x2b')][_0xadec('0x4a')]({'where':{'id':_0x252d59[_0xadec('0x47')]['id']}})[_0xadec('0x25')](handleEntityNotFound(_0x3714a1,null))[_0xadec('0x25')](removeEntity(_0x3714a1,null))[_0xadec('0x45')](handleError(_0x3714a1,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a38a9ef..d7e829f 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 _0xe789=['exports','define','ZohoField','int_zoho_fields','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes'];(function(_0x57bbd6,_0x1a661d){var _0xff8ce0=function(_0x5dbd96){while(--_0x5dbd96){_0x57bbd6['push'](_0x57bbd6['shift']());}};_0xff8ce0(++_0x1a661d);}(_0xe789,0x147));var _0x9e78=function(_0x1a2e8e,_0x4da2a1){_0x1a2e8e=_0x1a2e8e-0x0;var _0x5a0a8c=_0xe789[_0x1a2e8e];return _0x5a0a8c;};'use strict';var _=require('lodash');var util=require(_0x9e78('0x0'));var logger=require(_0x9e78('0x1'))(_0x9e78('0x2'));var moment=require(_0x9e78('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e78('0x4'));var fs=require('fs');var path=require(_0x9e78('0x5'));var rimraf=require(_0x9e78('0x6'));var config=require(_0x9e78('0x7'));var attributes=require(_0x9e78('0x8'));module[_0x9e78('0x9')]=function(_0x46701f,_0x4d0ea8){return _0x46701f[_0x9e78('0xa')](_0x9e78('0xb'),attributes,{'tableName':_0x9e78('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x9e78('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0444=['path','rimraf','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x213c63,_0x420de6){var _0x300bfb=function(_0x5d0b2e){while(--_0x5d0b2e){_0x213c63['push'](_0x213c63['shift']());}};_0x300bfb(++_0x420de6);}(_0x0444,0xe1));var _0x4044=function(_0x4c112e,_0x4276cd){_0x4c112e=_0x4c112e-0x0;var _0x4e8d90=_0x0444[_0x4c112e];return _0x4e8d90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4044('0x0'))(_0x4044('0x1'));var moment=require(_0x4044('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4044('0x3'));var rimraf=require(_0x4044('0x4'));var config=require(_0x4044('0x5'));var attributes=require(_0x4044('0x6'));module['exports']=function(_0x4b3e36,_0x2f0ed8){return _0x4b3e36['define'](_0x4044('0x7'),attributes,{'tableName':_0x4044('0x8'),'paranoid':![],'indexes':[{'name':_0x4044('0x9'),'fields':[_0x4044('0xa'),_0x4044('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 3dcb552..c645895 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 _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x116549,_0x210e8b){var _0x1321e5=function(_0x413542){while(--_0x413542){_0x116549['push'](_0x116549['shift']());}};_0x1321e5(++_0x210e8b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file +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(_0x405dc0,_0x5f2898){var _0x1ed46d=function(_0x5efad7){while(--_0x5efad7){_0x405dc0['push'](_0x405dc0['shift']());}};_0x1ed46d(++_0x5f2898);}(_0x9a19,0x114));var _0x99a1=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x9a19[_0x18cac4];return _0x2227c6;};'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 3dabfea..71502d4 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 _0x5528=['express','Router','../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x4f81fb,_0x8fe9aa){var _0x35fded=function(_0x59aff8){while(--_0x59aff8){_0x4f81fb['push'](_0x4f81fb['shift']());}};_0x35fded(++_0x8fe9aa);}(_0x5528,0x8d));var _0x8552=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x5528[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x8552('0x0'));var util=require(_0x8552('0x1'));var path=require('path');var timeout=require(_0x8552('0x2'));var express=require(_0x8552('0x3'));var router=express[_0x8552('0x4')]();var auth=require(_0x8552('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8552('0x6'));module[_0x8552('0x7')]=router; \ No newline at end of file +var _0xc244=['multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xc244,0x118));var _0x4c24=function(_0x1e68d6,_0x498fbd){_0x1e68d6=_0x1e68d6-0x0;var _0x7379fa=_0xc244[_0x1e68d6];return _0x7379fa;};'use strict';var multer=require(_0x4c24('0x0'));var util=require('util');var path=require(_0x4c24('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c24('0x2'));var router=express['Router']();var auth=require(_0x4c24('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4c24('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index be68d4e..f4ce87f 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 _0x2d43=['state','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x2e785e,_0x232c0a){var _0x230f26=function(_0x55570a){while(--_0x55570a){_0x2e785e['push'](_0x2e785e['shift']());}};_0x230f26(++_0x232c0a);}(_0x2d43,0x1d2));var _0x32d4=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x2d43[_0x32f26d];return _0x5d9ddc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32d4('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x32d4('0x0')],'allowNull':![],'unique':_0x32d4('0x1')},'main':{'type':Sequelize[_0x32d4('0x0')],'defaultValue':_0x32d4('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x32d4('0x0')]},'type':{'type':Sequelize[_0x32d4('0x0')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x32d4('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x32d4('0x0')]},'logo':{'type':Sequelize[_0x32d4('0x0')]},'state':{'type':Sequelize[_0x32d4('0x0')],'unique':_0x32d4('0x4')},'description':{'type':Sequelize[_0x32d4('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32d4('0x0')]},'link':{'type':Sequelize[_0x32d4('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x455e=['INTEGER','BOOLEAN','state','sequelize','STRING','app.js'];(function(_0x57bc41,_0x270339){var _0x3ebc9b=function(_0x383299){while(--_0x383299){_0x57bc41['push'](_0x57bc41['shift']());}};_0x3ebc9b(++_0x270339);}(_0x455e,0xab));var _0xe455=function(_0x25dd3b,_0x27e043){_0x25dd3b=_0x25dd3b-0x0;var _0x3084aa=_0x455e[_0x25dd3b];return _0x3084aa;};'use strict';var Sequelize=require(_0xe455('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe455('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xe455('0x2')},'filename':{'type':Sequelize[_0xe455('0x1')]},'path':{'type':Sequelize[_0xe455('0x1')]},'type':{'type':Sequelize[_0xe455('0x1')]},'size':{'type':Sequelize[_0xe455('0x3')]},'active':{'type':Sequelize[_0xe455('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xe455('0x1')]},'logo':{'type':Sequelize[_0xe455('0x1')]},'state':{'type':Sequelize[_0xe455('0x1')],'unique':_0xe455('0x5')},'description':{'type':Sequelize[_0xe455('0x1')]},'title':{'type':Sequelize[_0xe455('0x1')]},'remoteUri':{'type':Sequelize[_0xe455('0x1')]},'link':{'type':Sequelize[_0xe455('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 6f4dc4d..221ecca 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 _0x4e09=['attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','Integration','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e09,0xa2));var _0x94e0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e09[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x94e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94e0('0x2'));var rp=require(_0x94e0('0x3'));var moment=require(_0x94e0('0x4'));var BPromise=require(_0x94e0('0x5'));var Mustache=require(_0x94e0('0x6'));var util=require(_0x94e0('0x7'));var path=require(_0x94e0('0x8'));var sox=require(_0x94e0('0x9'));var csv=require(_0x94e0('0xa'));var ejs=require(_0x94e0('0xb'));var fs=require('fs');var _=require(_0x94e0('0xc'));var squel=require('squel');var crypto=require(_0x94e0('0xd'));var jsforce=require(_0x94e0('0xe'));var deskjs=require(_0x94e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x94e0('0x10'));var Papa=require(_0x94e0('0x11'));var Redis=require('ioredis');var authService=require(_0x94e0('0x12'));var qs=require(_0x94e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94e0('0x14'))(_0x94e0('0x15'));var utils=require(_0x94e0('0x16'));var config=require(_0x94e0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x94e0('0x18'))['db'];function respondWithStatusCode(_0x584f46,_0x314739){_0x314739=_0x314739||0xcc;return function(_0xec935e){if(_0xec935e){return _0x584f46[_0x94e0('0x19')](_0x314739);}return _0x584f46['status'](_0x314739)['end']();};}function respondWithResult(_0x147516,_0xf2675e){_0xf2675e=_0xf2675e||0xc8;return function(_0x3e7153){if(_0x3e7153){return _0x147516[_0x94e0('0x1a')](_0xf2675e)[_0x94e0('0x1b')](_0x3e7153);}};}function respondWithFilteredResult(_0x4ce86c,_0x29c0e5){return function(_0x4243fa){if(_0x4243fa){var _0x4192de=_0x4243fa[_0x94e0('0x1c')],_0x2c9eb1=_0x29c0e5[_0x94e0('0x1d')],_0x31101c=_0x29c0e5[_0x94e0('0x1d')]+_0x29c0e5[_0x94e0('0x1e')],_0x3480bb;if(_0x31101c>=_0x4192de){_0x31101c=_0x4192de;_0x3480bb=0xc8;}else{_0x3480bb=0xce;}_0x4ce86c[_0x94e0('0x1a')](_0x3480bb);return _0x4ce86c[_0x94e0('0x1f')](_0x94e0('0x20'),_0x2c9eb1+'-'+_0x31101c+'/'+_0x4192de)[_0x94e0('0x1b')](_0x4243fa);}return null;};}function patchUpdates(_0x47bedc){return function(_0x29465b){try{jsonpatch['apply'](_0x29465b,_0x47bedc,!![]);}catch(_0x227c3d){return BPromise[_0x94e0('0x21')](_0x227c3d);}return _0x29465b['save']();};}function saveUpdates(_0x44921d,_0x1d6e28){return function(_0x219469){if(_0x219469){return _0x219469[_0x94e0('0x22')](_0x44921d)['then'](function(_0x3e8be9){return _0x3e8be9;});}return null;};}function removeEntity(_0x240262,_0x3db0b4){return function(_0x915d42){if(_0x915d42){return _0x915d42[_0x94e0('0x23')]()[_0x94e0('0x24')](function(){_0x240262[_0x94e0('0x1a')](0xcc)[_0x94e0('0x25')]();});}};}function handleEntityNotFound(_0x40cf17,_0x3729ec){return function(_0x2c0b4c){if(!_0x2c0b4c){_0x40cf17[_0x94e0('0x19')](0x194);}return _0x2c0b4c;};}function handleError(_0x2aa2ae,_0x18f2e6){_0x18f2e6=_0x18f2e6||0x1f4;return function(_0x585eb6){logger['error'](_0x585eb6[_0x94e0('0x26')]);if(_0x585eb6[_0x94e0('0x27')]){delete _0x585eb6[_0x94e0('0x27')];}_0x2aa2ae[_0x94e0('0x1a')](_0x18f2e6)[_0x94e0('0x28')](_0x585eb6);};}exports[_0x94e0('0x29')]=function(_0x4135ad,_0x176a9e){var _0x14fd43={},_0x458eb3={},_0x27d4d7={'count':0x0,'rows':[]};var _0x3506df=_[_0x94e0('0x2a')](db['Integration'][_0x94e0('0x2b')],function(_0x331da1){return{'name':_0x331da1[_0x94e0('0x2c')],'type':_0x331da1[_0x94e0('0x2d')]['key']};});_0x458eb3[_0x94e0('0x2e')]=_['map'](_0x3506df,_0x94e0('0x27'));_0x458eb3['query']=_['keys'](_0x4135ad[_0x94e0('0x2f')]);_0x458eb3[_0x94e0('0x30')]=_[_0x94e0('0x31')](_0x458eb3[_0x94e0('0x2e')],_0x458eb3[_0x94e0('0x2f')]);_0x14fd43['attributes']=_[_0x94e0('0x31')](_0x458eb3['model'],qs['fields'](_0x4135ad['query'][_0x94e0('0x32')]));_0x14fd43['attributes']=_0x14fd43[_0x94e0('0x33')][_0x94e0('0x34')]?_0x14fd43[_0x94e0('0x33')]:_0x458eb3[_0x94e0('0x2e')];if(!_0x4135ad['query'][_0x94e0('0x35')]('nolimit')){_0x14fd43[_0x94e0('0x1e')]=qs[_0x94e0('0x1e')](_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x1e')]);_0x14fd43[_0x94e0('0x1d')]=qs[_0x94e0('0x1d')](_0x4135ad['query']['offset']);}_0x14fd43[_0x94e0('0x36')]=qs['sort'](_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x37')]);_0x14fd43[_0x94e0('0x38')]=qs[_0x94e0('0x30')](_['pick'](_0x4135ad['query'],_0x458eb3[_0x94e0('0x30')]),_0x3506df);if(_0x4135ad['query'][_0x94e0('0x39')]){_0x14fd43['where']=_[_0x94e0('0x3a')](_0x14fd43[_0x94e0('0x38')],{'$or':_[_0x94e0('0x2a')](_0x3506df,function(_0x30e43d){if(_0x30e43d[_0x94e0('0x2d')]!=='VIRTUAL'){var _0x55d337={};_0x55d337[_0x30e43d[_0x94e0('0x27')]]={'$like':'%'+_0x4135ad['query'][_0x94e0('0x39')]+'%'};return _0x55d337;}})});}_0x14fd43=_[_0x94e0('0x3a')]({},_0x14fd43,_0x4135ad[_0x94e0('0x3b')]);var _0x42726a={'where':_0x14fd43['where']};return db[_0x94e0('0x3c')]['count'](_0x42726a)[_0x94e0('0x24')](function(_0x299956){_0x27d4d7['count']=_0x299956;if(_0x4135ad[_0x94e0('0x2f')][_0x94e0('0x3d')]){_0x14fd43[_0x94e0('0x3e')]=[{'all':!![]}];}return db[_0x94e0('0x3c')][_0x94e0('0x3f')](_0x14fd43);})['then'](function(_0x1c33cf){_0x27d4d7['rows']=_0x1c33cf;return _0x27d4d7;})[_0x94e0('0x24')](respondWithFilteredResult(_0x176a9e,_0x14fd43))[_0x94e0('0x40')](handleError(_0x176a9e,null));};exports[_0x94e0('0x41')]=function(_0x4fa3e8,_0x81fbce){var _0x51b4b4={'raw':![],'where':{'id':_0x4fa3e8[_0x94e0('0x42')]['id']}},_0x50d004={};_0x50d004[_0x94e0('0x2e')]=_[_0x94e0('0x43')](db['Integration'][_0x94e0('0x2b')]);_0x50d004[_0x94e0('0x2f')]=_[_0x94e0('0x43')](_0x4fa3e8['query']);_0x50d004[_0x94e0('0x30')]=_['intersection'](_0x50d004[_0x94e0('0x2e')],_0x50d004['query']);_0x51b4b4['attributes']=_[_0x94e0('0x31')](_0x50d004[_0x94e0('0x2e')],qs[_0x94e0('0x32')](_0x4fa3e8[_0x94e0('0x2f')][_0x94e0('0x32')]));_0x51b4b4['attributes']=_0x51b4b4[_0x94e0('0x33')][_0x94e0('0x34')]?_0x51b4b4['attributes']:_0x50d004[_0x94e0('0x2e')];if(_0x4fa3e8['query'][_0x94e0('0x3d')]){_0x51b4b4[_0x94e0('0x3e')]=[{'all':!![]}];}_0x51b4b4=_['merge']({},_0x51b4b4,_0x4fa3e8[_0x94e0('0x3b')]);return db[_0x94e0('0x3c')][_0x94e0('0x44')](_0x51b4b4)[_0x94e0('0x24')](handleEntityNotFound(_0x81fbce,null))[_0x94e0('0x24')](respondWithResult(_0x81fbce,null))[_0x94e0('0x40')](handleError(_0x81fbce,null));};exports[_0x94e0('0x45')]=function(_0x271449,_0x42fcba){return db[_0x94e0('0x3c')][_0x94e0('0x45')](_0x271449['body'],{})['then'](respondWithResult(_0x42fcba,0xc9))['catch'](handleError(_0x42fcba,null));};exports[_0x94e0('0x22')]=function(_0x3dc6c8,_0x5839e1){if(_0x3dc6c8[_0x94e0('0x46')]['id']){delete _0x3dc6c8[_0x94e0('0x46')]['id'];}return db[_0x94e0('0x3c')]['find']({'where':{'id':_0x3dc6c8[_0x94e0('0x42')]['id']}})[_0x94e0('0x24')](handleEntityNotFound(_0x5839e1,null))['then'](saveUpdates(_0x3dc6c8[_0x94e0('0x46')],null))[_0x94e0('0x24')](respondWithResult(_0x5839e1,null))[_0x94e0('0x40')](handleError(_0x5839e1,null));};exports['destroy']=function(_0x458796,_0x5eeb92){return db[_0x94e0('0x3c')]['find']({'where':{'id':_0x458796[_0x94e0('0x42')]['id']}})[_0x94e0('0x24')](handleEntityNotFound(_0x5eeb92,null))['then'](removeEntity(_0x5eeb92,null))['catch'](handleError(_0x5eeb92,null));}; \ No newline at end of file +var _0x8d08=['mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','json','reject','update','then','end','error','stack','name','send','map','Integration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x44ace6,_0x448496){var _0x1b5359=function(_0x149c04){while(--_0x149c04){_0x44ace6['push'](_0x44ace6['shift']());}};_0x1b5359(++_0x448496);}(_0x8d08,0x118));var _0x88d0=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x8d08[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0x88d0('0x0'));var emlformat=require(_0x88d0('0x1'));var rimraf=require(_0x88d0('0x2'));var zipdir=require(_0x88d0('0x3'));var jsonpatch=require(_0x88d0('0x4'));var rp=require(_0x88d0('0x5'));var moment=require(_0x88d0('0x6'));var BPromise=require(_0x88d0('0x7'));var Mustache=require(_0x88d0('0x8'));var util=require(_0x88d0('0x9'));var path=require(_0x88d0('0xa'));var sox=require(_0x88d0('0xb'));var csv=require('to-csv');var ejs=require(_0x88d0('0xc'));var fs=require('fs');var _=require(_0x88d0('0xd'));var squel=require('squel');var crypto=require(_0x88d0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x88d0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88d0('0x10'));var Papa=require(_0x88d0('0x11'));var Redis=require(_0x88d0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88d0('0x13'));var as=require(_0x88d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88d0('0x15'))('api');var utils=require(_0x88d0('0x16'));var config=require(_0x88d0('0x17'));var licenseUtil=require(_0x88d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5de471,_0x5da161){_0x5da161=_0x5da161||0xcc;return function(_0x2854a5){if(_0x2854a5){return _0x5de471[_0x88d0('0x19')](_0x5da161);}return _0x5de471[_0x88d0('0x1a')](_0x5da161)['end']();};}function respondWithResult(_0x47a572,_0x57b18e){_0x57b18e=_0x57b18e||0xc8;return function(_0x461ae6){if(_0x461ae6){return _0x47a572[_0x88d0('0x1a')](_0x57b18e)['json'](_0x461ae6);}};}function respondWithFilteredResult(_0x2bba74,_0x189ea6){return function(_0x2b3ebd){if(_0x2b3ebd){var _0x37083a=_0x2b3ebd[_0x88d0('0x1b')],_0x5f10b4=_0x189ea6[_0x88d0('0x1c')],_0x36d3e2=_0x189ea6['offset']+_0x189ea6[_0x88d0('0x1d')],_0x371744;if(_0x36d3e2>=_0x37083a){_0x36d3e2=_0x37083a;_0x371744=0xc8;}else{_0x371744=0xce;}_0x2bba74[_0x88d0('0x1a')](_0x371744);return _0x2bba74['set'](_0x88d0('0x1e'),_0x5f10b4+'-'+_0x36d3e2+'/'+_0x37083a)[_0x88d0('0x1f')](_0x2b3ebd);}return null;};}function patchUpdates(_0x47bd00){return function(_0x1212a7){try{jsonpatch['apply'](_0x1212a7,_0x47bd00,!![]);}catch(_0x1b7acc){return BPromise[_0x88d0('0x20')](_0x1b7acc);}return _0x1212a7['save']();};}function saveUpdates(_0x463d67,_0x46aabb){return function(_0x251865){if(_0x251865){return _0x251865[_0x88d0('0x21')](_0x463d67)['then'](function(_0x6e5d5f){return _0x6e5d5f;});}return null;};}function removeEntity(_0xbeb2f9,_0x40155e){return function(_0x4e8b5a){if(_0x4e8b5a){return _0x4e8b5a['destroy']()[_0x88d0('0x22')](function(){_0xbeb2f9[_0x88d0('0x1a')](0xcc)[_0x88d0('0x23')]();});}};}function handleEntityNotFound(_0x3bd137,_0x2d2aac){return function(_0x24af46){if(!_0x24af46){_0x3bd137[_0x88d0('0x19')](0x194);}return _0x24af46;};}function handleError(_0x16cd98,_0x47481f){_0x47481f=_0x47481f||0x1f4;return function(_0x481a86){logger[_0x88d0('0x24')](_0x481a86[_0x88d0('0x25')]);if(_0x481a86[_0x88d0('0x26')]){delete _0x481a86[_0x88d0('0x26')];}_0x16cd98[_0x88d0('0x1a')](_0x47481f)[_0x88d0('0x27')](_0x481a86);};}exports['index']=function(_0x517d50,_0x16685c){var _0x10f155={},_0x2a5acb={},_0x2dcbeb={'count':0x0,'rows':[]};var _0x2d5690=_[_0x88d0('0x28')](db[_0x88d0('0x29')]['rawAttributes'],function(_0x28f306){return{'name':_0x28f306[_0x88d0('0x2a')],'type':_0x28f306[_0x88d0('0x2b')][_0x88d0('0x2c')]};});_0x2a5acb[_0x88d0('0x2d')]=_[_0x88d0('0x28')](_0x2d5690,_0x88d0('0x26'));_0x2a5acb[_0x88d0('0x2e')]=_[_0x88d0('0x2f')](_0x517d50[_0x88d0('0x2e')]);_0x2a5acb[_0x88d0('0x30')]=_[_0x88d0('0x31')](_0x2a5acb[_0x88d0('0x2d')],_0x2a5acb[_0x88d0('0x2e')]);_0x10f155['attributes']=_[_0x88d0('0x31')](_0x2a5acb[_0x88d0('0x2d')],qs[_0x88d0('0x32')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x32')]));_0x10f155[_0x88d0('0x33')]=_0x10f155[_0x88d0('0x33')][_0x88d0('0x34')]?_0x10f155[_0x88d0('0x33')]:_0x2a5acb['model'];if(!_0x517d50[_0x88d0('0x2e')][_0x88d0('0x35')](_0x88d0('0x36'))){_0x10f155[_0x88d0('0x1d')]=qs[_0x88d0('0x1d')](_0x517d50['query'][_0x88d0('0x1d')]);_0x10f155[_0x88d0('0x1c')]=qs[_0x88d0('0x1c')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x1c')]);}_0x10f155[_0x88d0('0x37')]=qs[_0x88d0('0x38')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x38')]);_0x10f155[_0x88d0('0x39')]=qs[_0x88d0('0x30')](_[_0x88d0('0x3a')](_0x517d50[_0x88d0('0x2e')],_0x2a5acb[_0x88d0('0x30')]),_0x2d5690);if(_0x517d50['query'][_0x88d0('0x3b')]){_0x10f155['where']=_[_0x88d0('0x3c')](_0x10f155['where'],{'$or':_[_0x88d0('0x28')](_0x2d5690,function(_0x353344){if(_0x353344[_0x88d0('0x2b')]!=='VIRTUAL'){var _0x343376={};_0x343376[_0x353344[_0x88d0('0x26')]]={'$like':'%'+_0x517d50[_0x88d0('0x2e')][_0x88d0('0x3b')]+'%'};return _0x343376;}})});}_0x10f155=_[_0x88d0('0x3c')]({},_0x10f155,_0x517d50['options']);var _0x3f7d74={'where':_0x10f155[_0x88d0('0x39')]};return db[_0x88d0('0x29')][_0x88d0('0x1b')](_0x3f7d74)[_0x88d0('0x22')](function(_0x5af9e4){_0x2dcbeb['count']=_0x5af9e4;if(_0x517d50[_0x88d0('0x2e')]['includeAll']){_0x10f155[_0x88d0('0x3d')]=[{'all':!![]}];}return db['Integration'][_0x88d0('0x3e')](_0x10f155);})['then'](function(_0x4492ea){_0x2dcbeb[_0x88d0('0x3f')]=_0x4492ea;return _0x2dcbeb;})[_0x88d0('0x22')](respondWithFilteredResult(_0x16685c,_0x10f155))['catch'](handleError(_0x16685c,null));};exports[_0x88d0('0x40')]=function(_0x2c3364,_0xa7bccb){var _0x355096={'raw':![],'where':{'id':_0x2c3364['params']['id']}},_0x414ca3={};_0x414ca3[_0x88d0('0x2d')]=_[_0x88d0('0x2f')](db[_0x88d0('0x29')][_0x88d0('0x41')]);_0x414ca3[_0x88d0('0x2e')]=_[_0x88d0('0x2f')](_0x2c3364[_0x88d0('0x2e')]);_0x414ca3[_0x88d0('0x30')]=_[_0x88d0('0x31')](_0x414ca3[_0x88d0('0x2d')],_0x414ca3[_0x88d0('0x2e')]);_0x355096['attributes']=_[_0x88d0('0x31')](_0x414ca3['model'],qs[_0x88d0('0x32')](_0x2c3364['query'][_0x88d0('0x32')]));_0x355096[_0x88d0('0x33')]=_0x355096['attributes'][_0x88d0('0x34')]?_0x355096['attributes']:_0x414ca3[_0x88d0('0x2d')];if(_0x2c3364['query'][_0x88d0('0x42')]){_0x355096[_0x88d0('0x3d')]=[{'all':!![]}];}_0x355096=_['merge']({},_0x355096,_0x2c3364[_0x88d0('0x43')]);return db[_0x88d0('0x29')]['find'](_0x355096)[_0x88d0('0x22')](handleEntityNotFound(_0xa7bccb,null))['then'](respondWithResult(_0xa7bccb,null))[_0x88d0('0x44')](handleError(_0xa7bccb,null));};exports['create']=function(_0x148ad8,_0x4666de){return db[_0x88d0('0x29')]['create'](_0x148ad8['body'],{})[_0x88d0('0x22')](respondWithResult(_0x4666de,0xc9))[_0x88d0('0x44')](handleError(_0x4666de,null));};exports[_0x88d0('0x21')]=function(_0x2f8956,_0x566ecc){if(_0x2f8956['body']['id']){delete _0x2f8956[_0x88d0('0x45')]['id'];}return db[_0x88d0('0x29')][_0x88d0('0x46')]({'where':{'id':_0x2f8956[_0x88d0('0x47')]['id']}})[_0x88d0('0x22')](handleEntityNotFound(_0x566ecc,null))[_0x88d0('0x22')](saveUpdates(_0x2f8956['body'],null))['then'](respondWithResult(_0x566ecc,null))[_0x88d0('0x44')](handleError(_0x566ecc,null));};exports['destroy']=function(_0x132923,_0xd9bd98){return db[_0x88d0('0x29')]['find']({'where':{'id':_0x132923[_0x88d0('0x47')]['id']}})[_0x88d0('0x22')](handleEntityNotFound(_0xd9bd98,null))[_0x88d0('0x22')](removeEntity(_0xd9bd98,null))[_0x88d0('0x44')](handleError(_0xd9bd98,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b204058..354d095 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 _0x8e08=['rimraf','./integration.attributes','exports','Integration','lodash','../../config/logger','request-promise','path'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x8e08,0x1ec));var _0x88e0=function(_0x188692,_0x23dd41){_0x188692=_0x188692-0x0;var _0x304c05=_0x8e08[_0x188692];return _0x304c05;};'use strict';var _=require(_0x88e0('0x0'));var util=require('util');var logger=require(_0x88e0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x88e0('0x2'));var fs=require('fs');var path=require(_0x88e0('0x3'));var rimraf=require(_0x88e0('0x4'));var config=require('../../config/environment');var attributes=require(_0x88e0('0x5'));module[_0x88e0('0x6')]=function(_0x42f1d5,_0x3cf559){return _0x42f1d5['define'](_0x88e0('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea6=['util','../../config/logger','api','moment','request-promise','rimraf','./integration.attributes','exports','define','Integration','lodash'];(function(_0x7a8365,_0x563ade){var _0x55359f=function(_0x344dc2){while(--_0x344dc2){_0x7a8365['push'](_0x7a8365['shift']());}};_0x55359f(++_0x563ade);}(_0xcea6,0x1b7));var _0x6cea=function(_0x21a854,_0x24257e){_0x21a854=_0x21a854-0x0;var _0x67b4c0=_0xcea6[_0x21a854];return _0x67b4c0;};'use strict';var _=require(_0x6cea('0x0'));var util=require(_0x6cea('0x1'));var logger=require(_0x6cea('0x2'))(_0x6cea('0x3'));var moment=require(_0x6cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cea('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cea('0x7'));module[_0x6cea('0x8')]=function(_0xc0c2b5,_0x429228){return _0xc0c2b5[_0x6cea('0x9')](_0x6cea('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 03286ea..3c47d9f 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 _0x17c4=['request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x501b67,_0x2c2917){var _0x436b9a=function(_0x4e71b4){while(--_0x4e71b4){_0x501b67['push'](_0x501b67['shift']());}};_0x436b9a(++_0x2c2917);}(_0x17c4,0x102));var _0x417c=function(_0x15070a,_0x522955){_0x15070a=_0x15070a-0x0;var _0x251d50=_0x17c4[_0x15070a];return _0x251d50;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require(_0x417c('0x2'));var BPromise=require(_0x417c('0x3'));var rs=require(_0x417c('0x4'));var fs=require('fs');var Redis=require(_0x417c('0x5'));var db=require(_0x417c('0x6'))['db'];var utils=require(_0x417c('0x7'));var logger=require(_0x417c('0x8'))(_0x417c('0x9'));var config=require(_0x417c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x417c('0xb')][_0x417c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340095,_0xc418d9,_0x1106df){return new BPromise(function(_0x4c6534,_0x5e75e6){return client[_0x417c('0xd')](_0x340095,_0x1106df)[_0x417c('0xe')](function(_0x36c36f){logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');logger[_0x417c('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0xc418d9,_0x417c('0x12'),JSON[_0x417c('0x13')](_0x36c36f));if(_0x36c36f[_0x417c('0x14')]){if(_0x36c36f[_0x417c('0x14')]['code']===0x1f4){logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f['error']['message']);return _0x5e75e6(_0x36c36f['error'][_0x417c('0x15')]);}logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f[_0x417c('0x14')]['message']);return _0x4c6534(_0x36c36f[_0x417c('0x14')][_0x417c('0x15')]);}else{logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');_0x4c6534(_0x36c36f['result'][_0x417c('0x15')]);}})[_0x417c('0x16')](function(_0x3f6058){logger['error'](_0x417c('0x10'),_0xc418d9,_0x3f6058);_0x5e75e6(_0x3f6058);});});} \ No newline at end of file +var _0x79c6=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x79c6,0x81));var _0x679c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x79c6[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x679c('0x0'));var util=require('util');var moment=require(_0x679c('0x1'));var BPromise=require(_0x679c('0x2'));var rs=require(_0x679c('0x3'));var fs=require('fs');var Redis=require(_0x679c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x679c('0x5'))(_0x679c('0x6'));var config=require(_0x679c('0x7'));var jayson=require(_0x679c('0x8'));var client=jayson[_0x679c('0x9')][_0x679c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43655d,_0x481173,_0x57b604){return new BPromise(function(_0x2898c2,_0x1f2ec3){return client[_0x679c('0xb')](_0x43655d,_0x57b604)[_0x679c('0xc')](function(_0xac3b1a){logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x481173,_0x679c('0xf'),JSON[_0x679c('0x10')](_0xac3b1a));if(_0xac3b1a['error']){if(_0xac3b1a['error'][_0x679c('0x11')]===0x1f4){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x1f2ec3(_0xac3b1a[_0x679c('0x12')]['message']);}logger[_0x679c('0x12')]('Integration,\x20%s,\x20%s',_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x2898c2(_0xac3b1a[_0x679c('0x12')][_0x679c('0x13')]);}else{logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,_0x679c('0xf'));_0x2898c2(_0xac3b1a['result'][_0x679c('0x13')]);}})[_0x679c('0x14')](function(_0x18117f){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0x18117f);_0x1f2ec3(_0x18117f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6b760be..08189ff 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 _0x3451=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d806,_0x171536){var _0x15ff58=function(_0x4dce37){while(--_0x4dce37){_0x29d806['push'](_0x29d806['shift']());}};_0x15ff58(++_0x171536);}(_0x3451,0x19a));var _0x1345=function(_0x5644a0,_0x1a9149){_0x5644a0=_0x5644a0-0x0;var _0x551843=_0x3451[_0x5644a0];return _0x551843;};'use strict';var multer=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var path=require('path');var timeout=require(_0x1345('0x2'));var express=require(_0x1345('0x3'));var router=express[_0x1345('0x4')]();var auth=require(_0x1345('0x5'));var interaction=require(_0x1345('0x6'));var config=require(_0x1345('0x7'));var controller=require(_0x1345('0x8'));router[_0x1345('0x9')]('/',auth[_0x1345('0xa')](),controller[_0x1345('0xb')]);router[_0x1345('0x9')](_0x1345('0xc'),auth['isAuthenticated'](),controller[_0x1345('0xd')]);router[_0x1345('0x9')]('/:id',auth[_0x1345('0xa')](),controller['show']);router['post']('/',auth[_0x1345('0xa')](),controller['create']);router[_0x1345('0xe')](_0x1345('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1345('0x10')]('/:id',auth[_0x1345('0xa')](),controller[_0x1345('0x11')]);module[_0x1345('0x12')]=router; \ No newline at end of file +var _0x0fd7=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x5378bb,_0xdbe6c2){var _0x32dc23=function(_0x4af2ab){while(--_0x4af2ab){_0x5378bb['push'](_0x5378bb['shift']());}};_0x32dc23(++_0xdbe6c2);}(_0x0fd7,0x9f));var _0x70fd=function(_0x5ab47a,_0x185cae){_0x5ab47a=_0x5ab47a-0x0;var _0x5cb084=_0x0fd7[_0x5ab47a];return _0x5cb084;};'use strict';var multer=require(_0x70fd('0x0'));var util=require(_0x70fd('0x1'));var path=require('path');var timeout=require(_0x70fd('0x2'));var express=require(_0x70fd('0x3'));var router=express[_0x70fd('0x4')]();var auth=require(_0x70fd('0x5'));var interaction=require(_0x70fd('0x6'));var config=require('../../config/environment');var controller=require(_0x70fd('0x7'));router[_0x70fd('0x8')]('/',auth[_0x70fd('0x9')](),controller['index']);router[_0x70fd('0x8')]('/describe',auth[_0x70fd('0x9')](),controller[_0x70fd('0xa')]);router[_0x70fd('0x8')](_0x70fd('0xb'),auth[_0x70fd('0x9')](),controller[_0x70fd('0xc')]);router['post']('/',auth[_0x70fd('0x9')](),controller[_0x70fd('0xd')]);router[_0x70fd('0xe')](_0x70fd('0xb'),auth['isAuthenticated'](),controller[_0x70fd('0xf')]);router[_0x70fd('0x10')](_0x70fd('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x70fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c0b7b8f..c0546f2 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 _0xd290=['TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4f79ca,_0x3f86b9){var _0x352e43=function(_0x526a7b){while(--_0x526a7b){_0x4f79ca['push'](_0x4f79ca['shift']());}};_0x352e43(++_0x3f86b9);}(_0xd290,0x126));var _0x0d29=function(_0x4ded9e,_0x40f5f1){_0x4ded9e=_0x4ded9e-0x0;var _0x5e06ae=_0xd290[_0x4ded9e];return _0x5e06ae;};'use strict';var Sequelize=require(_0x0d29('0x0'));module[_0x0d29('0x1')]={'integration':{'type':Sequelize[_0x0d29('0x2')]},'eventChannel':{'type':Sequelize[_0x0d29('0x2')]},'exitStatus':{'type':Sequelize[_0x0d29('0x2')]},'ticketId':{'type':Sequelize[_0x0d29('0x2')]},'integrationId':{'type':Sequelize[_0x0d29('0x3')]},'contacts':{'type':Sequelize[_0x0d29('0x2')]},'uniqueid':{'type':Sequelize[_0x0d29('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d29('0x2')]},'queue':{'type':Sequelize[_0x0d29('0x2')]},'interface':{'type':Sequelize[_0x0d29('0x2')]},'membername':{'type':Sequelize[_0x0d29('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0d29('0x4')]},'agentconnectAt':{'type':Sequelize[_0x0d29('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0d29('0x4')]},'talktime':{'type':Sequelize[_0x0d29('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0d29('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0d29('0x4')]},'agentdump':{'type':Sequelize[_0x0d29('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x0d29('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0d29('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0d29('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d29('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d29('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0d29('0x2')]},'exten':{'type':Sequelize[_0x0d29('0x2')]},'priority':{'type':Sequelize[_0x0d29('0x2')]},'destchannel':{'type':Sequelize[_0x0d29('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0d29('0x2')]},'destcalleridname':{'type':Sequelize[_0x0d29('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x0d29('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0d29('0x2')]},'destaccountcode':{'type':Sequelize[_0x0d29('0x2')]},'destcontext':{'type':Sequelize[_0x0d29('0x2')]},'destexten':{'type':Sequelize[_0x0d29('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x0d29('0x2')]},'messageId':{'type':Sequelize[_0x0d29('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x0d29('0x2')]},'from':{'type':Sequelize[_0x0d29('0x2')]},'to':{'type':Sequelize[_0x0d29('0x2')]},'cc':{'type':Sequelize[_0x0d29('0x2')]},'attachment':{'type':Sequelize[_0x0d29('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x0d29('0x7'),_0x0d29('0x8'),'RECEIVED',_0x0d29('0x9'))},'url':{'type':Sequelize[_0x0d29('0x2')]},'app':{'type':Sequelize[_0x0d29('0x2')]},'appdata':{'type':Sequelize[_0x0d29('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2a7a=['TEXT','ENUM','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3e4ae3,_0x4ef92c){var _0x3f4916=function(_0x16c841){while(--_0x16c841){_0x3e4ae3['push'](_0x3e4ae3['shift']());}};_0x3f4916(++_0x4ef92c);}(_0x2a7a,0x19b));var _0xa2a7=function(_0x33bcd9,_0x9663b6){_0x33bcd9=_0x33bcd9-0x0;var _0x30fa78=_0x2a7a[_0x33bcd9];return _0x30fa78;};'use strict';var Sequelize=require('sequelize');module[_0xa2a7('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xa2a7('0x1')]},'exitStatus':{'type':Sequelize[_0xa2a7('0x1')]},'ticketId':{'type':Sequelize[_0xa2a7('0x1')]},'integrationId':{'type':Sequelize[_0xa2a7('0x2')]},'contacts':{'type':Sequelize[_0xa2a7('0x1')]},'uniqueid':{'type':Sequelize[_0xa2a7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa2a7('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa2a7('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa2a7('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa2a7('0x2')]},'agentcomplete':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa2a7('0x3')]},'talktime':{'type':Sequelize[_0xa2a7('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa2a7('0x2')]},'reason':{'type':Sequelize[_0xa2a7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa2a7('0x3')]},'agentdump':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa2a7('0x1')]},'channelstate':{'type':Sequelize[_0xa2a7('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa2a7('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa2a7('0x1')]},'connectedlinename':{'type':Sequelize[_0xa2a7('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa2a7('0x1')]},'context':{'type':Sequelize[_0xa2a7('0x1')]},'exten':{'type':Sequelize[_0xa2a7('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa2a7('0x1')]},'destchannelstate':{'type':Sequelize[_0xa2a7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa2a7('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa2a7('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa2a7('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa2a7('0x1')]},'destlanguage':{'type':Sequelize[_0xa2a7('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa2a7('0x1')]},'destexten':{'type':Sequelize[_0xa2a7('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa2a7('0x1')]},'messageId':{'type':Sequelize[_0xa2a7('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xa2a7('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa2a7('0x1')]},'cc':{'type':Sequelize[_0xa2a7('0x1')]},'attachment':{'type':Sequelize[_0xa2a7('0x5')]},'html':{'type':Sequelize[_0xa2a7('0x5')]},'text':{'type':Sequelize[_0xa2a7('0x5')]},'status':{'type':Sequelize[_0xa2a7('0x6')]('SENT','SENDING','RECEIVED',_0xa2a7('0x7'))},'url':{'type':Sequelize[_0xa2a7('0x1')]},'app':{'type':Sequelize[_0xa2a7('0x1')]},'appdata':{'type':Sequelize[_0xa2a7('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ad22c9f..e5e39ae 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 _0xc908=['apply','update','then','destroy','sendStatus','error','name','send','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','Content-Range'];(function(_0x2bd364,_0x524650){var _0x34a685=function(_0xefe95c){while(--_0xefe95c){_0x2bd364['push'](_0x2bd364['shift']());}};_0x34a685(++_0x524650);}(_0xc908,0x110));var _0x8c90=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc908[_0x45d55e];return _0x29812a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8c90('0x0'));var zipdir=require(_0x8c90('0x1'));var jsonpatch=require(_0x8c90('0x2'));var rp=require(_0x8c90('0x3'));var moment=require(_0x8c90('0x4'));var BPromise=require(_0x8c90('0x5'));var Mustache=require(_0x8c90('0x6'));var util=require(_0x8c90('0x7'));var path=require(_0x8c90('0x8'));var sox=require(_0x8c90('0x9'));var csv=require(_0x8c90('0xa'));var ejs=require(_0x8c90('0xb'));var fs=require('fs');var _=require(_0x8c90('0xc'));var squel=require('squel');var crypto=require(_0x8c90('0xd'));var jsforce=require(_0x8c90('0xe'));var deskjs=require(_0x8c90('0xf'));var toCsv=require(_0x8c90('0xa'));var querystring=require(_0x8c90('0x10'));var Papa=require(_0x8c90('0x11'));var Redis=require(_0x8c90('0x12'));var authService=require(_0x8c90('0x13'));var qs=require(_0x8c90('0x14'));var as=require(_0x8c90('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c90('0x16'))(_0x8c90('0x17'));var utils=require(_0x8c90('0x18'));var config=require(_0x8c90('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c90('0x1a'))['db'];function respondWithStatusCode(_0x252392,_0x502042){_0x502042=_0x502042||0xcc;return function(_0x3c949e){if(_0x3c949e){return _0x252392['sendStatus'](_0x502042);}return _0x252392['status'](_0x502042)[_0x8c90('0x1b')]();};}function respondWithResult(_0x46373f,_0x4de54e){_0x4de54e=_0x4de54e||0xc8;return function(_0x42b7b0){if(_0x42b7b0){return _0x46373f[_0x8c90('0x1c')](_0x4de54e)[_0x8c90('0x1d')](_0x42b7b0);}};}function respondWithFilteredResult(_0x152ca1,_0x95c4b){return function(_0x2fd0ff){if(_0x2fd0ff){var _0x2f46fb=_0x2fd0ff['count'],_0x385a68=_0x95c4b[_0x8c90('0x1e')],_0x1558db=_0x95c4b['offset']+_0x95c4b['limit'],_0x58f5c0;if(_0x1558db>=_0x2f46fb){_0x1558db=_0x2f46fb;_0x58f5c0=0xc8;}else{_0x58f5c0=0xce;}_0x152ca1[_0x8c90('0x1c')](_0x58f5c0);return _0x152ca1['set'](_0x8c90('0x1f'),_0x385a68+'-'+_0x1558db+'/'+_0x2f46fb)[_0x8c90('0x1d')](_0x2fd0ff);}return null;};}function patchUpdates(_0x4b06c2){return function(_0x424655){try{jsonpatch[_0x8c90('0x20')](_0x424655,_0x4b06c2,!![]);}catch(_0x558930){return BPromise['reject'](_0x558930);}return _0x424655['save']();};}function saveUpdates(_0x179bb1,_0x55a2ed){return function(_0xbaa1ef){if(_0xbaa1ef){return _0xbaa1ef[_0x8c90('0x21')](_0x179bb1)[_0x8c90('0x22')](function(_0x2e724a){return _0x2e724a;});}return null;};}function removeEntity(_0x15ccc0,_0x2b9f7b){return function(_0x44742a){if(_0x44742a){return _0x44742a[_0x8c90('0x23')]()[_0x8c90('0x22')](function(){_0x15ccc0[_0x8c90('0x1c')](0xcc)[_0x8c90('0x1b')]();});}};}function handleEntityNotFound(_0x2851a1,_0x2e67a4){return function(_0x191817){if(!_0x191817){_0x2851a1[_0x8c90('0x24')](0x194);}return _0x191817;};}function handleError(_0x1d3842,_0x1fdbd9){_0x1fdbd9=_0x1fdbd9||0x1f4;return function(_0x30fcf2){logger[_0x8c90('0x25')](_0x30fcf2['stack']);if(_0x30fcf2['name']){delete _0x30fcf2[_0x8c90('0x26')];}_0x1d3842[_0x8c90('0x1c')](_0x1fdbd9)[_0x8c90('0x27')](_0x30fcf2);};}exports['index']=function(_0x2ee9e4,_0x2be256){var _0x4a5011={},_0x53dfa0={},_0x2ff0e7={'count':0x0,'rows':[]};var _0x211541=_['map'](db[_0x8c90('0x28')][_0x8c90('0x29')],function(_0x47e85f){return{'name':_0x47e85f[_0x8c90('0x2a')],'type':_0x47e85f['type'][_0x8c90('0x2b')]};});_0x53dfa0[_0x8c90('0x2c')]=_['map'](_0x211541,_0x8c90('0x26'));_0x53dfa0[_0x8c90('0x2d')]=_[_0x8c90('0x2e')](_0x2ee9e4[_0x8c90('0x2d')]);_0x53dfa0['filters']=_[_0x8c90('0x2f')](_0x53dfa0[_0x8c90('0x2c')],_0x53dfa0[_0x8c90('0x2d')]);_0x4a5011[_0x8c90('0x30')]=_[_0x8c90('0x2f')](_0x53dfa0[_0x8c90('0x2c')],qs[_0x8c90('0x31')](_0x2ee9e4['query'][_0x8c90('0x31')]));_0x4a5011[_0x8c90('0x30')]=_0x4a5011[_0x8c90('0x30')][_0x8c90('0x32')]?_0x4a5011[_0x8c90('0x30')]:_0x53dfa0[_0x8c90('0x2c')];if(!_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x33')](_0x8c90('0x34'))){_0x4a5011['limit']=qs[_0x8c90('0x35')](_0x2ee9e4['query'][_0x8c90('0x35')]);_0x4a5011[_0x8c90('0x1e')]=qs[_0x8c90('0x1e')](_0x2ee9e4['query'][_0x8c90('0x1e')]);}_0x4a5011[_0x8c90('0x36')]=qs[_0x8c90('0x37')](_0x2ee9e4['query']['sort']);_0x4a5011['where']=qs[_0x8c90('0x38')](_[_0x8c90('0x39')](_0x2ee9e4[_0x8c90('0x2d')],_0x53dfa0[_0x8c90('0x38')]),_0x211541);if(_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x3a')]){_0x4a5011[_0x8c90('0x3b')]=_[_0x8c90('0x3c')](_0x4a5011['where'],{'$or':_[_0x8c90('0x3d')](_0x211541,function(_0x2407e8){if(_0x2407e8[_0x8c90('0x3e')]!==_0x8c90('0x3f')){var _0x41de8e={};_0x41de8e[_0x2407e8[_0x8c90('0x26')]]={'$like':'%'+_0x2ee9e4['query'][_0x8c90('0x3a')]+'%'};return _0x41de8e;}})});}_0x4a5011=_[_0x8c90('0x3c')]({},_0x4a5011,_0x2ee9e4['options']);var _0x4eef68={'where':_0x4a5011[_0x8c90('0x3b')]};return db['IntegrationReport'][_0x8c90('0x40')](_0x4eef68)['then'](function(_0x4aa46a){_0x2ff0e7[_0x8c90('0x40')]=_0x4aa46a;if(_0x2ee9e4[_0x8c90('0x2d')][_0x8c90('0x41')]){_0x4a5011[_0x8c90('0x42')]=[{'all':!![]}];}return db[_0x8c90('0x28')][_0x8c90('0x43')](_0x4a5011);})[_0x8c90('0x22')](function(_0x4617f5){_0x2ff0e7[_0x8c90('0x44')]=_0x4617f5;return _0x2ff0e7;})['then'](respondWithFilteredResult(_0x2be256,_0x4a5011))[_0x8c90('0x45')](handleError(_0x2be256,null));};exports['show']=function(_0x4ab084,_0x7187a1){var _0x31803e={'raw':![],'where':{'id':_0x4ab084[_0x8c90('0x46')]['id']}},_0x4665db={};_0x4665db[_0x8c90('0x2c')]=_[_0x8c90('0x2e')](db[_0x8c90('0x28')]['rawAttributes']);_0x4665db[_0x8c90('0x2d')]=_[_0x8c90('0x2e')](_0x4ab084[_0x8c90('0x2d')]);_0x4665db['filters']=_[_0x8c90('0x2f')](_0x4665db[_0x8c90('0x2c')],_0x4665db[_0x8c90('0x2d')]);_0x31803e[_0x8c90('0x30')]=_[_0x8c90('0x2f')](_0x4665db[_0x8c90('0x2c')],qs['fields'](_0x4ab084[_0x8c90('0x2d')][_0x8c90('0x31')]));_0x31803e['attributes']=_0x31803e['attributes'][_0x8c90('0x32')]?_0x31803e[_0x8c90('0x30')]:_0x4665db[_0x8c90('0x2c')];if(_0x4ab084[_0x8c90('0x2d')]['includeAll']){_0x31803e[_0x8c90('0x42')]=[{'all':!![]}];}_0x31803e=_[_0x8c90('0x3c')]({},_0x31803e,_0x4ab084[_0x8c90('0x47')]);return db[_0x8c90('0x28')][_0x8c90('0x48')](_0x31803e)[_0x8c90('0x22')](handleEntityNotFound(_0x7187a1,null))[_0x8c90('0x22')](respondWithResult(_0x7187a1,null))[_0x8c90('0x45')](handleError(_0x7187a1,null));};exports[_0x8c90('0x49')]=function(_0x5c2f74,_0x39261d){return db[_0x8c90('0x28')]['create'](_0x5c2f74[_0x8c90('0x4a')],{})[_0x8c90('0x22')](respondWithResult(_0x39261d,0xc9))[_0x8c90('0x45')](handleError(_0x39261d,null));};exports[_0x8c90('0x21')]=function(_0x4a0b05,_0x1fc747){if(_0x4a0b05[_0x8c90('0x4a')]['id']){delete _0x4a0b05['body']['id'];}return db[_0x8c90('0x28')]['find']({'where':{'id':_0x4a0b05[_0x8c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fc747,null))[_0x8c90('0x22')](saveUpdates(_0x4a0b05[_0x8c90('0x4a')],null))[_0x8c90('0x22')](respondWithResult(_0x1fc747,null))[_0x8c90('0x45')](handleError(_0x1fc747,null));};exports['destroy']=function(_0x37c9ca,_0x1fb7e0){return db[_0x8c90('0x28')][_0x8c90('0x48')]({'where':{'id':_0x37c9ca['params']['id']}})[_0x8c90('0x22')](handleEntityNotFound(_0x1fb7e0,null))[_0x8c90('0x22')](removeEntity(_0x1fb7e0,null))[_0x8c90('0x45')](handleError(_0x1fb7e0,null));};exports[_0x8c90('0x4b')]=function(_0x5115ba,_0x379131){return db['IntegrationReport'][_0x8c90('0x4b')]()['then'](respondWithResult(_0x379131,null))[_0x8c90('0x45')](handleError(_0x379131,null));}; \ No newline at end of file +var _0x9e59=['params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','length','find','update','body'];(function(_0x177716,_0x7a2831){var _0x3363e1=function(_0x271e96){while(--_0x271e96){_0x177716['push'](_0x177716['shift']());}};_0x3363e1(++_0x7a2831);}(_0x9e59,0x160));var _0x99e5=function(_0x77df59,_0x37549c){_0x77df59=_0x77df59-0x0;var _0x4f5059=_0x9e59[_0x77df59];return _0x4f5059;};'use strict';var pdf=require(_0x99e5('0x0'));var emlformat=require(_0x99e5('0x1'));var rimraf=require(_0x99e5('0x2'));var zipdir=require(_0x99e5('0x3'));var jsonpatch=require(_0x99e5('0x4'));var rp=require(_0x99e5('0x5'));var moment=require(_0x99e5('0x6'));var BPromise=require(_0x99e5('0x7'));var Mustache=require(_0x99e5('0x8'));var util=require('util');var path=require(_0x99e5('0x9'));var sox=require('sox');var csv=require(_0x99e5('0xa'));var ejs=require(_0x99e5('0xb'));var fs=require('fs');var _=require(_0x99e5('0xc'));var squel=require('squel');var crypto=require(_0x99e5('0xd'));var jsforce=require(_0x99e5('0xe'));var deskjs=require(_0x99e5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x99e5('0x10'));var Redis=require(_0x99e5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x99e5('0x12'));var as=require(_0x99e5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99e5('0x14'));var utils=require(_0x99e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x99e5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x664948,_0x556b7f){_0x556b7f=_0x556b7f||0xcc;return function(_0x1def62){if(_0x1def62){return _0x664948[_0x99e5('0x17')](_0x556b7f);}return _0x664948['status'](_0x556b7f)[_0x99e5('0x18')]();};}function respondWithResult(_0x52982d,_0x191dc4){_0x191dc4=_0x191dc4||0xc8;return function(_0xfc1789){if(_0xfc1789){return _0x52982d[_0x99e5('0x19')](_0x191dc4)[_0x99e5('0x1a')](_0xfc1789);}};}function respondWithFilteredResult(_0x132e71,_0x5b6f30){return function(_0x4e9da9){if(_0x4e9da9){var _0xa70e16=_0x4e9da9[_0x99e5('0x1b')],_0x2b201d=_0x5b6f30[_0x99e5('0x1c')],_0x2468ec=_0x5b6f30['offset']+_0x5b6f30[_0x99e5('0x1d')],_0x398980;if(_0x2468ec>=_0xa70e16){_0x2468ec=_0xa70e16;_0x398980=0xc8;}else{_0x398980=0xce;}_0x132e71[_0x99e5('0x19')](_0x398980);return _0x132e71[_0x99e5('0x1e')](_0x99e5('0x1f'),_0x2b201d+'-'+_0x2468ec+'/'+_0xa70e16)[_0x99e5('0x1a')](_0x4e9da9);}return null;};}function patchUpdates(_0x329cfe){return function(_0xea4e92){try{jsonpatch['apply'](_0xea4e92,_0x329cfe,!![]);}catch(_0xd2e26d){return BPromise[_0x99e5('0x20')](_0xd2e26d);}return _0xea4e92[_0x99e5('0x21')]();};}function saveUpdates(_0x350217,_0x34aebf){return function(_0x4d79bd){if(_0x4d79bd){return _0x4d79bd['update'](_0x350217)[_0x99e5('0x22')](function(_0x9584a3){return _0x9584a3;});}return null;};}function removeEntity(_0x37a67a,_0x3f79fb){return function(_0x1de112){if(_0x1de112){return _0x1de112['destroy']()[_0x99e5('0x22')](function(){_0x37a67a['status'](0xcc)[_0x99e5('0x18')]();});}};}function handleEntityNotFound(_0x4ef078,_0x48dda7){return function(_0x22f40b){if(!_0x22f40b){_0x4ef078[_0x99e5('0x17')](0x194);}return _0x22f40b;};}function handleError(_0x814f24,_0x58a76e){_0x58a76e=_0x58a76e||0x1f4;return function(_0x514d74){logger['error'](_0x514d74[_0x99e5('0x23')]);if(_0x514d74[_0x99e5('0x24')]){delete _0x514d74['name'];}_0x814f24[_0x99e5('0x19')](_0x58a76e)['send'](_0x514d74);};}exports['index']=function(_0x35f529,_0x56af44){var _0x4a3a08={},_0x219e0d={},_0x4bed45={'count':0x0,'rows':[]};var _0x102b5b=_[_0x99e5('0x25')](db['IntegrationReport'][_0x99e5('0x26')],function(_0x1101d5){return{'name':_0x1101d5[_0x99e5('0x27')],'type':_0x1101d5['type'][_0x99e5('0x28')]};});_0x219e0d[_0x99e5('0x29')]=_[_0x99e5('0x25')](_0x102b5b,_0x99e5('0x24'));_0x219e0d[_0x99e5('0x2a')]=_[_0x99e5('0x2b')](_0x35f529[_0x99e5('0x2a')]);_0x219e0d[_0x99e5('0x2c')]=_[_0x99e5('0x2d')](_0x219e0d[_0x99e5('0x29')],_0x219e0d['query']);_0x4a3a08[_0x99e5('0x2e')]=_['intersection'](_0x219e0d[_0x99e5('0x29')],qs[_0x99e5('0x2f')](_0x35f529[_0x99e5('0x2a')]['fields']));_0x4a3a08[_0x99e5('0x2e')]=_0x4a3a08[_0x99e5('0x2e')]['length']?_0x4a3a08[_0x99e5('0x2e')]:_0x219e0d[_0x99e5('0x29')];if(!_0x35f529['query']['hasOwnProperty'](_0x99e5('0x30'))){_0x4a3a08['limit']=qs['limit'](_0x35f529['query']['limit']);_0x4a3a08['offset']=qs[_0x99e5('0x1c')](_0x35f529[_0x99e5('0x2a')]['offset']);}_0x4a3a08[_0x99e5('0x31')]=qs[_0x99e5('0x32')](_0x35f529['query'][_0x99e5('0x32')]);_0x4a3a08['where']=qs[_0x99e5('0x2c')](_['pick'](_0x35f529['query'],_0x219e0d[_0x99e5('0x2c')]),_0x102b5b);if(_0x35f529['query']['filter']){_0x4a3a08[_0x99e5('0x33')]=_['merge'](_0x4a3a08[_0x99e5('0x33')],{'$or':_[_0x99e5('0x25')](_0x102b5b,function(_0x1c7b19){if(_0x1c7b19[_0x99e5('0x34')]!==_0x99e5('0x35')){var _0x50f9b2={};_0x50f9b2[_0x1c7b19[_0x99e5('0x24')]]={'$like':'%'+_0x35f529[_0x99e5('0x2a')][_0x99e5('0x36')]+'%'};return _0x50f9b2;}})});}_0x4a3a08=_[_0x99e5('0x37')]({},_0x4a3a08,_0x35f529[_0x99e5('0x38')]);var _0x169197={'where':_0x4a3a08['where']};return db[_0x99e5('0x39')][_0x99e5('0x1b')](_0x169197)[_0x99e5('0x22')](function(_0x4ce657){_0x4bed45[_0x99e5('0x1b')]=_0x4ce657;if(_0x35f529[_0x99e5('0x2a')][_0x99e5('0x3a')]){_0x4a3a08[_0x99e5('0x3b')]=[{'all':!![]}];}return db[_0x99e5('0x39')][_0x99e5('0x3c')](_0x4a3a08);})['then'](function(_0x50cb3d){_0x4bed45[_0x99e5('0x3d')]=_0x50cb3d;return _0x4bed45;})[_0x99e5('0x22')](respondWithFilteredResult(_0x56af44,_0x4a3a08))[_0x99e5('0x3e')](handleError(_0x56af44,null));};exports[_0x99e5('0x3f')]=function(_0x3c43f5,_0x29098c){var _0x347584={'raw':![],'where':{'id':_0x3c43f5['params']['id']}},_0x3653af={};_0x3653af[_0x99e5('0x29')]=_[_0x99e5('0x2b')](db['IntegrationReport'][_0x99e5('0x26')]);_0x3653af[_0x99e5('0x2a')]=_[_0x99e5('0x2b')](_0x3c43f5['query']);_0x3653af[_0x99e5('0x2c')]=_[_0x99e5('0x2d')](_0x3653af['model'],_0x3653af[_0x99e5('0x2a')]);_0x347584[_0x99e5('0x2e')]=_[_0x99e5('0x2d')](_0x3653af[_0x99e5('0x29')],qs[_0x99e5('0x2f')](_0x3c43f5['query']['fields']));_0x347584[_0x99e5('0x2e')]=_0x347584['attributes'][_0x99e5('0x40')]?_0x347584['attributes']:_0x3653af[_0x99e5('0x29')];if(_0x3c43f5[_0x99e5('0x2a')][_0x99e5('0x3a')]){_0x347584[_0x99e5('0x3b')]=[{'all':!![]}];}_0x347584=_[_0x99e5('0x37')]({},_0x347584,_0x3c43f5[_0x99e5('0x38')]);return db['IntegrationReport'][_0x99e5('0x41')](_0x347584)[_0x99e5('0x22')](handleEntityNotFound(_0x29098c,null))[_0x99e5('0x22')](respondWithResult(_0x29098c,null))[_0x99e5('0x3e')](handleError(_0x29098c,null));};exports['create']=function(_0x54ed7c,_0x2e1be1){return db[_0x99e5('0x39')]['create'](_0x54ed7c['body'],{})[_0x99e5('0x22')](respondWithResult(_0x2e1be1,0xc9))[_0x99e5('0x3e')](handleError(_0x2e1be1,null));};exports[_0x99e5('0x42')]=function(_0x424566,_0x2ebf76){if(_0x424566[_0x99e5('0x43')]['id']){delete _0x424566[_0x99e5('0x43')]['id'];}return db['IntegrationReport'][_0x99e5('0x41')]({'where':{'id':_0x424566[_0x99e5('0x44')]['id']}})[_0x99e5('0x22')](handleEntityNotFound(_0x2ebf76,null))[_0x99e5('0x22')](saveUpdates(_0x424566[_0x99e5('0x43')],null))[_0x99e5('0x22')](respondWithResult(_0x2ebf76,null))[_0x99e5('0x3e')](handleError(_0x2ebf76,null));};exports['destroy']=function(_0x32defa,_0x5ad679){return db[_0x99e5('0x39')][_0x99e5('0x41')]({'where':{'id':_0x32defa[_0x99e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ad679,null))[_0x99e5('0x22')](removeEntity(_0x5ad679,null))[_0x99e5('0x3e')](handleError(_0x5ad679,null));};exports[_0x99e5('0x45')]=function(_0x1a4ca3,_0x48b0c7){return db[_0x99e5('0x39')][_0x99e5('0x45')]()[_0x99e5('0x22')](respondWithResult(_0x48b0c7,null))[_0x99e5('0x3e')](handleError(_0x48b0c7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 972fd22..3a74423 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 _0xd3af=['../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','request-promise'];(function(_0xa53897,_0x5395d4){var _0xc16163=function(_0x33d297){while(--_0x33d297){_0xa53897['push'](_0xa53897['shift']());}};_0xc16163(++_0x5395d4);}(_0xd3af,0xc1));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfd3a('0x0'));var util=require('util');var logger=require(_0xfd3a('0x1'))(_0xfd3a('0x2'));var moment=require(_0xfd3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd3a('0x5'));var attributes=require(_0xfd3a('0x6'));module['exports']=function(_0x23831b,_0x1dc3e0){return _0x23831b['define'](_0xfd3a('0x7'),attributes,{'tableName':_0xfd3a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85ce=['IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x85ce,0x120));var _0xe85c=function(_0x403593,_0x4eb3b1){_0x403593=_0x403593-0x0;var _0x4e9657=_0x85ce[_0x403593];return _0x4e9657;};'use strict';var _=require('lodash');var util=require(_0xe85c('0x0'));var logger=require(_0xe85c('0x1'))(_0xe85c('0x2'));var moment=require(_0xe85c('0x3'));var BPromise=require(_0xe85c('0x4'));var rp=require(_0xe85c('0x5'));var fs=require('fs');var path=require(_0xe85c('0x6'));var rimraf=require(_0xe85c('0x7'));var config=require(_0xe85c('0x8'));var attributes=require(_0xe85c('0x9'));module[_0xe85c('0xa')]=function(_0x1c476e,_0x4a8526){return _0x1c476e['define'](_0xe85c('0xb'),attributes,{'tableName':_0xe85c('0xc'),'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 86ea337..9ba56ce 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5d87bb,_0x2a7167){var _0x3d9eee=function(_0x58393e){while(--_0x58393e){_0x5d87bb['push'](_0x5d87bb['shift']());}};_0x3d9eee(++_0x2a7167);}(_0x2032,0xd9));var _0x2203=function(_0x2410bc,_0x5d3649){_0x2410bc=_0x2410bc-0x0;var _0x3f5d6c=_0x2032[_0x2410bc];return _0x3f5d6c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x40a344,_0x2c4a47){var _0x47c2f1=function(_0x9fa169){while(--_0x9fa169){_0x40a344['push'](_0x40a344['shift']());}};_0x47c2f1(++_0x2c4a47);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb7e7[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 17a3ecc..2d13a6e 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x55ca,0x126));var _0xa55c=function(_0x4a30f1,_0x2e75a8){_0x4a30f1=_0x4a30f1-0x0;var _0x1e0a09=_0x55ca[_0x4a30f1];return _0x1e0a09;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x533d5d,_0x400122){var _0x5518a1=function(_0x3d1117){while(--_0x3d1117){_0x533d5d['push'](_0x533d5d['shift']());}};_0x5518a1(++_0x400122);}(_0x3e74,0x175));var _0x43e7=function(_0x548c68,_0xff94a){_0x548c68=_0x548c68-0x0;var _0x249c4f=_0x3e74[_0x548c68];return _0x249c4f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c1ba3d8..51254ea 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 _0xf286=['STRING','sequelize','exports'];(function(_0x1dee1c,_0xa1cadb){var _0x16ac88=function(_0x46b1e2){while(--_0x46b1e2){_0x1dee1c['push'](_0x1dee1c['shift']());}};_0x16ac88(++_0xa1cadb);}(_0xf286,0x166));var _0x6f28=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xf286[_0x3f3f40];return _0x403b7a;};'use strict';var Sequelize=require(_0x6f28('0x0'));module[_0x6f28('0x1')]={'name':{'type':Sequelize[_0x6f28('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5346=['sequelize','STRING'];(function(_0x5ae761,_0x9afc7c){var _0x42add3=function(_0x5e0fa8){while(--_0x5e0fa8){_0x5ae761['push'](_0x5ae761['shift']());}};_0x42add3(++_0x9afc7c);}(_0x5346,0x1ce));var _0x6534=function(_0x29e899,_0x466a4c){_0x29e899=_0x29e899-0x0;var _0x40b248=_0x5346[_0x29e899];return _0x40b248;};'use strict';var Sequelize=require(_0x6534('0x0'));module['exports']={'name':{'type':Sequelize[_0x6534('0x1')]},'description':{'type':Sequelize[_0x6534('0x1')]},'interval':{'type':Sequelize[_0x6534('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 6d92c6a..ac74eab 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 _0xba54=['util','path','sox','to-csv','lodash','squel','desk.js','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','count','offset','set','reject','save','then','destroy','Intervals','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','length','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','options','Interval','includeAll','include','findAll','catch','params','intersection','fields','find','create','body','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getIntervals','findOne','addIntervals','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3ccc51,_0x73cc9e){var _0x15e3d0=function(_0x3ba6f8){while(--_0x3ba6f8){_0x3ccc51['push'](_0x3ccc51['shift']());}};_0x15e3d0(++_0x73cc9e);}(_0xba54,0x143));var _0x4ba5=function(_0x101e7f,_0x438427){_0x101e7f=_0x101e7f-0x0;var _0x56e8cc=_0xba54[_0x101e7f];return _0x56e8cc;};'use strict';var pdf=require(_0x4ba5('0x0'));var emlformat=require(_0x4ba5('0x1'));var rimraf=require(_0x4ba5('0x2'));var zipdir=require(_0x4ba5('0x3'));var jsonpatch=require(_0x4ba5('0x4'));var rp=require(_0x4ba5('0x5'));var moment=require(_0x4ba5('0x6'));var BPromise=require(_0x4ba5('0x7'));var Mustache=require(_0x4ba5('0x8'));var util=require(_0x4ba5('0x9'));var path=require(_0x4ba5('0xa'));var sox=require(_0x4ba5('0xb'));var csv=require(_0x4ba5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ba5('0xd'));var squel=require(_0x4ba5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ba5('0xf'));var toCsv=require(_0x4ba5('0xc'));var querystring=require('querystring');var Papa=require(_0x4ba5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4ba5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ba5('0x12'));var utils=require(_0x4ba5('0x13'));var config=require(_0x4ba5('0x14'));var licenseUtil=require(_0x4ba5('0x15'));var db=require(_0x4ba5('0x16'))['db'];var extensions=require(_0x4ba5('0x17'));function respondWithStatusCode(_0x566073,_0x4a009b){_0x4a009b=_0x4a009b||0xcc;return function(_0x298637){if(_0x298637){return _0x566073['sendStatus'](_0x4a009b);}return _0x566073[_0x4ba5('0x18')](_0x4a009b)[_0x4ba5('0x19')]();};}function respondWithResult(_0x3784d3,_0x32b615){_0x32b615=_0x32b615||0xc8;return function(_0x184afb){if(_0x184afb){return _0x3784d3['status'](_0x32b615)['json'](_0x184afb);}};}function respondWithFilteredResult(_0x2eec7a,_0x370ec5){return function(_0x1b39be){if(_0x1b39be){var _0x4ee45c=_0x1b39be[_0x4ba5('0x1a')],_0x309e80=_0x370ec5[_0x4ba5('0x1b')],_0x34388d=_0x370ec5[_0x4ba5('0x1b')]+_0x370ec5['limit'],_0x1167ed;if(_0x34388d>=_0x4ee45c){_0x34388d=_0x4ee45c;_0x1167ed=0xc8;}else{_0x1167ed=0xce;}_0x2eec7a[_0x4ba5('0x18')](_0x1167ed);return _0x2eec7a[_0x4ba5('0x1c')]('Content-Range',_0x309e80+'-'+_0x34388d+'/'+_0x4ee45c)['json'](_0x1b39be);}return null;};}function patchUpdates(_0x45d6ed){return function(_0x5af74c){try{jsonpatch['apply'](_0x5af74c,_0x45d6ed,!![]);}catch(_0x592cf2){return BPromise[_0x4ba5('0x1d')](_0x592cf2);}return _0x5af74c[_0x4ba5('0x1e')]();};}function saveUpdates(_0x55be98,_0x284a76){return function(_0xd72fab){if(_0xd72fab){return _0xd72fab['update'](_0x55be98)[_0x4ba5('0x1f')](function(_0x20f4f4){return _0x20f4f4;});}return null;};}function removeEntity(_0x37c623,_0x374364){return function(_0x1272a7){if(_0x1272a7){return _0x1272a7[_0x4ba5('0x20')]()[_0x4ba5('0x1f')](function(){var _0x2a82b3=_0x1272a7['get']({'plain':!![]});var _0x17f36c=_0x4ba5('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x17f36c,'resourceId':_0x2a82b3['id']}})['then'](function(){return _0x1272a7;});})[_0x4ba5('0x1f')](function(){_0x37c623[_0x4ba5('0x18')](0xcc)[_0x4ba5('0x19')]();});}};}function handleEntityNotFound(_0x33a8bb,_0x462630){return function(_0x1f8dce){if(!_0x1f8dce){_0x33a8bb[_0x4ba5('0x22')](0x194);}return _0x1f8dce;};}function handleError(_0x4e1480,_0x4a31ff){_0x4a31ff=_0x4a31ff||0x1f4;return function(_0x4499a7){logger[_0x4ba5('0x23')](_0x4499a7[_0x4ba5('0x24')]);if(_0x4499a7[_0x4ba5('0x25')]){delete _0x4499a7[_0x4ba5('0x25')];}_0x4e1480['status'](_0x4a31ff)[_0x4ba5('0x26')](_0x4499a7);};}exports[_0x4ba5('0x27')]=function(_0x5091d4,_0x4dae2b){var _0x19ca9e={},_0x1376b4={},_0x1fcf04={'count':0x0,'rows':[]};var _0x7226d0=_[_0x4ba5('0x28')](db['Interval'][_0x4ba5('0x29')],function(_0x246c90){return{'name':_0x246c90[_0x4ba5('0x2a')],'type':_0x246c90['type'][_0x4ba5('0x2b')]};});_0x1376b4[_0x4ba5('0x2c')]=_[_0x4ba5('0x28')](_0x7226d0,_0x4ba5('0x25'));_0x1376b4['query']=_[_0x4ba5('0x2d')](_0x5091d4[_0x4ba5('0x2e')]);_0x1376b4[_0x4ba5('0x2f')]=_['intersection'](_0x1376b4['model'],_0x1376b4[_0x4ba5('0x2e')]);_0x19ca9e['attributes']=_['intersection'](_0x1376b4[_0x4ba5('0x2c')],qs['fields'](_0x5091d4[_0x4ba5('0x2e')]['fields']));_0x19ca9e['attributes']=_0x19ca9e['attributes'][_0x4ba5('0x30')]?_0x19ca9e[_0x4ba5('0x31')]:_0x1376b4[_0x4ba5('0x2c')];if(!_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x32')](_0x4ba5('0x33'))){_0x19ca9e[_0x4ba5('0x34')]=qs[_0x4ba5('0x34')](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x34')]);_0x19ca9e[_0x4ba5('0x1b')]=qs['offset'](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x1b')]);}_0x19ca9e[_0x4ba5('0x35')]=qs[_0x4ba5('0x36')](_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x36')]);_0x19ca9e['where']=qs[_0x4ba5('0x2f')](_['pick'](_0x5091d4[_0x4ba5('0x2e')],_0x1376b4[_0x4ba5('0x2f')]),_0x7226d0);if(_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x37')]){_0x19ca9e[_0x4ba5('0x38')]=_[_0x4ba5('0x39')](_0x19ca9e[_0x4ba5('0x38')],{'$or':_['map'](_0x7226d0,function(_0x5ef7e0){if(_0x5ef7e0[_0x4ba5('0x3a')]!=='VIRTUAL'){var _0x3b545a={};_0x3b545a[_0x5ef7e0[_0x4ba5('0x25')]]={'$like':'%'+_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x37')]+'%'};return _0x3b545a;}})});}_0x19ca9e=_[_0x4ba5('0x39')]({},_0x19ca9e,_0x5091d4[_0x4ba5('0x3b')]);var _0xe26fc4={'where':_0x19ca9e[_0x4ba5('0x38')]};return db[_0x4ba5('0x3c')][_0x4ba5('0x1a')](_0xe26fc4)[_0x4ba5('0x1f')](function(_0x410b2f){_0x1fcf04[_0x4ba5('0x1a')]=_0x410b2f;if(_0x5091d4[_0x4ba5('0x2e')][_0x4ba5('0x3d')]){_0x19ca9e[_0x4ba5('0x3e')]=[{'all':!![]}];}return db[_0x4ba5('0x3c')][_0x4ba5('0x3f')](_0x19ca9e);})[_0x4ba5('0x1f')](function(_0x49a24a){_0x1fcf04['rows']=_0x49a24a;return _0x1fcf04;})[_0x4ba5('0x1f')](respondWithFilteredResult(_0x4dae2b,_0x19ca9e))[_0x4ba5('0x40')](handleError(_0x4dae2b,null));};exports['show']=function(_0x56c340,_0x422455){var _0x46dacf={'raw':!![],'where':{'id':_0x56c340[_0x4ba5('0x41')]['id']}},_0x3b45b7={};_0x3b45b7[_0x4ba5('0x2c')]=_['keys'](db['Interval'][_0x4ba5('0x29')]);_0x3b45b7['query']=_[_0x4ba5('0x2d')](_0x56c340[_0x4ba5('0x2e')]);_0x3b45b7[_0x4ba5('0x2f')]=_[_0x4ba5('0x42')](_0x3b45b7[_0x4ba5('0x2c')],_0x3b45b7[_0x4ba5('0x2e')]);_0x46dacf[_0x4ba5('0x31')]=_['intersection'](_0x3b45b7['model'],qs[_0x4ba5('0x43')](_0x56c340[_0x4ba5('0x2e')][_0x4ba5('0x43')]));_0x46dacf['attributes']=_0x46dacf[_0x4ba5('0x31')]['length']?_0x46dacf[_0x4ba5('0x31')]:_0x3b45b7[_0x4ba5('0x2c')];if(_0x56c340['query'][_0x4ba5('0x3d')]){_0x46dacf[_0x4ba5('0x3e')]=[{'all':!![]}];}_0x46dacf=_['merge']({},_0x46dacf,_0x56c340[_0x4ba5('0x3b')]);return db[_0x4ba5('0x3c')][_0x4ba5('0x44')](_0x46dacf)['then'](handleEntityNotFound(_0x422455,null))[_0x4ba5('0x1f')](respondWithResult(_0x422455,null))[_0x4ba5('0x40')](handleError(_0x422455,null));};exports['create']=function(_0x262332,_0x292ae7){return db['Interval'][_0x4ba5('0x45')](_0x262332[_0x4ba5('0x46')],{})['then'](function(_0x3657f2){var _0xea183a=_0x262332['user'][_0x4ba5('0x47')]({'plain':!![]});if(!_0xea183a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xea183a[_0x4ba5('0x48')]==='user'){var _0x5c78b7=_0x3657f2[_0x4ba5('0x47')]({'plain':!![]});var _0x1b71ab=_0x4ba5('0x21');return db[_0x4ba5('0x49')][_0x4ba5('0x44')]({'where':{'name':_0x1b71ab,'userProfileId':_0xea183a[_0x4ba5('0x4a')]},'raw':!![]})[_0x4ba5('0x1f')](function(_0x161475){if(_0x161475&&_0x161475['autoAssociation']===0x0){return db[_0x4ba5('0x4b')][_0x4ba5('0x45')]({'name':_0x5c78b7[_0x4ba5('0x25')],'resourceId':_0x5c78b7['id'],'type':_0x161475['name'],'sectionId':_0x161475['id']},{})[_0x4ba5('0x1f')](function(){return _0x3657f2;});}else{return _0x3657f2;}})[_0x4ba5('0x40')](function(_0x3c8157){logger[_0x4ba5('0x23')](_0x4ba5('0x4c'),_0x3c8157);throw _0x3c8157;});}return _0x3657f2;})[_0x4ba5('0x1f')](respondWithResult(_0x292ae7,0xc9))[_0x4ba5('0x40')](handleError(_0x292ae7,null));};exports[_0x4ba5('0x4d')]=function(_0x3be06c,_0x3ae201){if(_0x3be06c[_0x4ba5('0x46')]['id']){delete _0x3be06c[_0x4ba5('0x46')]['id'];}return db[_0x4ba5('0x3c')]['find']({'where':{'id':_0x3be06c['params']['id']}})['then'](handleEntityNotFound(_0x3ae201,null))[_0x4ba5('0x1f')](saveUpdates(_0x3be06c[_0x4ba5('0x46')],null))[_0x4ba5('0x1f')](respondWithResult(_0x3ae201,null))[_0x4ba5('0x40')](handleError(_0x3ae201,null));};exports[_0x4ba5('0x20')]=function(_0x41ea36,_0x156eb5){return db['Interval'][_0x4ba5('0x44')]({'where':{'id':_0x41ea36['params']['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0x156eb5,null))[_0x4ba5('0x1f')](removeEntity(_0x156eb5,null))[_0x4ba5('0x40')](handleError(_0x156eb5,null));};exports['addInterval']=function(_0x4758d8,_0x13cb99,_0x40fe45){if(_0x4758d8['body']['id']){delete _0x4758d8['body']['id'];}return db[_0x4ba5('0x3c')][_0x4ba5('0x44')]({'where':{'id':_0x4758d8[_0x4ba5('0x41')]['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0x13cb99,null))[_0x4ba5('0x1f')](function(_0x2c55ef){if(_0x2c55ef){_0x4758d8[_0x4ba5('0x46')]['IntervalId']=_0x2c55ef['id'];return db[_0x4ba5('0x3c')][_0x4ba5('0x45')](_0x4758d8[_0x4ba5('0x46')]);}})[_0x4ba5('0x1f')](respondWithResult(_0x13cb99,null))[_0x4ba5('0x40')](handleError(_0x13cb99,null));};exports[_0x4ba5('0x4e')]=function(_0x49a833,_0x5c2cd7,_0xcecae0){var _0x3854f1={};var _0x289eab={};var _0xd9f45c;var _0x41b237;return db[_0x4ba5('0x3c')][_0x4ba5('0x4f')]({'where':{'id':_0x49a833['params']['id']}})['then'](handleEntityNotFound(_0x5c2cd7,null))[_0x4ba5('0x1f')](function(_0x5b73a5){if(_0x5b73a5){_0xd9f45c=_0x5b73a5;_0x289eab['model']=_[_0x4ba5('0x2d')](db[_0x4ba5('0x3c')][_0x4ba5('0x29')]);_0x289eab['query']=_[_0x4ba5('0x2d')](_0x49a833['query']);_0x289eab[_0x4ba5('0x2f')]=_[_0x4ba5('0x42')](_0x289eab[_0x4ba5('0x2c')],_0x289eab[_0x4ba5('0x2e')]);_0x3854f1[_0x4ba5('0x31')]=_[_0x4ba5('0x42')](_0x289eab[_0x4ba5('0x2c')],qs['fields'](_0x49a833['query'][_0x4ba5('0x43')]));_0x3854f1['attributes']=_0x3854f1[_0x4ba5('0x31')][_0x4ba5('0x30')]?_0x3854f1['attributes']:_0x289eab[_0x4ba5('0x2c')];_0x3854f1['order']=qs[_0x4ba5('0x36')](_0x49a833[_0x4ba5('0x2e')][_0x4ba5('0x36')]);_0x3854f1[_0x4ba5('0x38')]=qs['filters'](_['pick'](_0x49a833[_0x4ba5('0x2e')],_0x289eab[_0x4ba5('0x2f')]));if(_0x49a833['query'][_0x4ba5('0x37')]){_0x3854f1['where']=_[_0x4ba5('0x39')](_0x3854f1[_0x4ba5('0x38')],{'$or':_[_0x4ba5('0x28')](_0x3854f1['attributes'],function(_0x9c87ef){var _0x1d7031={};_0x1d7031[_0x9c87ef]={'$like':'%'+_0x49a833[_0x4ba5('0x2e')]['filter']+'%'};return _0x1d7031;})});}_0x3854f1=_[_0x4ba5('0x39')]({},_0x3854f1,_0x49a833[_0x4ba5('0x3b')]);return _0xd9f45c['getIntervals'](_0x3854f1);}})['then'](function(_0x4292fd){if(_0x4292fd){_0x41b237=_0x4292fd['length'];if(!_0x49a833['query'][_0x4ba5('0x32')](_0x4ba5('0x33'))){_0x3854f1[_0x4ba5('0x34')]=qs[_0x4ba5('0x34')](_0x49a833[_0x4ba5('0x2e')]['limit']);_0x3854f1[_0x4ba5('0x1b')]=qs['offset'](_0x49a833[_0x4ba5('0x2e')][_0x4ba5('0x1b')]);}return _0xd9f45c[_0x4ba5('0x4e')](_0x3854f1);}})['then'](function(_0x1809b1){if(_0x1809b1){return _0x1809b1?{'count':_0x41b237,'rows':_0x1809b1}:null;}})[_0x4ba5('0x1f')](respondWithResult(_0x5c2cd7,null))[_0x4ba5('0x40')](handleError(_0x5c2cd7,null));};exports[_0x4ba5('0x50')]=function(_0x4e65f0,_0xd09ad3,_0x44ec25){return db[_0x4ba5('0x3c')][_0x4ba5('0x4f')]({'where':{'id':_0x4e65f0[_0x4ba5('0x41')]['id']}})[_0x4ba5('0x1f')](handleEntityNotFound(_0xd09ad3,null))[_0x4ba5('0x1f')](function(_0x1976ba){if(_0x1976ba){return db['sequelize']['transaction'](function(_0x57a352){return db[_0x4ba5('0x3c')][_0x4ba5('0x20')]({'where':{'IntervalId':_0x4e65f0[_0x4ba5('0x41')]['id']},'transaction':_0x57a352})[_0x4ba5('0x1f')](function(_0x4e0202){var _0x1fdc51=_[_0x4ba5('0x28')](_0x4e65f0[_0x4ba5('0x46')],function(_0x358f64){delete _0x358f64['id'];_0x358f64[_0x4ba5('0x51')]=_0x4e65f0[_0x4ba5('0x41')]['id'];return _0x358f64;});return db[_0x4ba5('0x3c')][_0x4ba5('0x52')](_0x1fdc51,{'transaction':_0x57a352});});})[_0x4ba5('0x1f')](function(){return db[_0x4ba5('0x3c')][_0x4ba5('0x3f')]({'where':{'IntervalId':_0x4e65f0['params']['id']}});});}})[_0x4ba5('0x1f')](respondWithResult(_0xd09ad3,null))[_0x4ba5('0x40')](handleError(_0xd09ad3,null));}; \ No newline at end of file +var _0xab4c=['count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','Interval','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','sort','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab4c,0x1dc));var _0xcab4=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xab4c[_0x34c063];return _0x2c63a3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcab4('0x1'));var jsonpatch=require(_0xcab4('0x2'));var rp=require(_0xcab4('0x3'));var moment=require(_0xcab4('0x4'));var BPromise=require(_0xcab4('0x5'));var Mustache=require(_0xcab4('0x6'));var util=require(_0xcab4('0x7'));var path=require(_0xcab4('0x8'));var sox=require('sox');var csv=require(_0xcab4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcab4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcab4('0xb'));var deskjs=require(_0xcab4('0xc'));var toCsv=require(_0xcab4('0x9'));var querystring=require(_0xcab4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcab4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcab4('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xcab4('0x10'));var config=require(_0xcab4('0x11'));var licenseUtil=require(_0xcab4('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0xcab4('0x13'));function respondWithStatusCode(_0x205f6d,_0x4368f2){_0x4368f2=_0x4368f2||0xcc;return function(_0x2f71d7){if(_0x2f71d7){return _0x205f6d[_0xcab4('0x14')](_0x4368f2);}return _0x205f6d[_0xcab4('0x15')](_0x4368f2)['end']();};}function respondWithResult(_0x2c1f69,_0x1db04d){_0x1db04d=_0x1db04d||0xc8;return function(_0x11774d){if(_0x11774d){return _0x2c1f69['status'](_0x1db04d)['json'](_0x11774d);}};}function respondWithFilteredResult(_0x30f9d6,_0x5248ea){return function(_0x57c59d){if(_0x57c59d){var _0x2afe95=_0x57c59d[_0xcab4('0x16')],_0x1ad1e1=_0x5248ea[_0xcab4('0x17')],_0x521a41=_0x5248ea['offset']+_0x5248ea[_0xcab4('0x18')],_0x6ff023;if(_0x521a41>=_0x2afe95){_0x521a41=_0x2afe95;_0x6ff023=0xc8;}else{_0x6ff023=0xce;}_0x30f9d6[_0xcab4('0x15')](_0x6ff023);return _0x30f9d6[_0xcab4('0x19')](_0xcab4('0x1a'),_0x1ad1e1+'-'+_0x521a41+'/'+_0x2afe95)[_0xcab4('0x1b')](_0x57c59d);}return null;};}function patchUpdates(_0x1726e1){return function(_0x3c483e){try{jsonpatch['apply'](_0x3c483e,_0x1726e1,!![]);}catch(_0x2c478e){return BPromise[_0xcab4('0x1c')](_0x2c478e);}return _0x3c483e[_0xcab4('0x1d')]();};}function saveUpdates(_0x159d48,_0x10d08f){return function(_0x54f8a6){if(_0x54f8a6){return _0x54f8a6[_0xcab4('0x1e')](_0x159d48)[_0xcab4('0x1f')](function(_0x84a8c3){return _0x84a8c3;});}return null;};}function removeEntity(_0x381557,_0xaa9c6f){return function(_0x1b9c15){if(_0x1b9c15){return _0x1b9c15[_0xcab4('0x20')]()[_0xcab4('0x1f')](function(){var _0x2070df=_0x1b9c15[_0xcab4('0x21')]({'plain':!![]});var _0x2a358a=_0xcab4('0x22');return db[_0xcab4('0x23')][_0xcab4('0x20')]({'where':{'type':_0x2a358a,'resourceId':_0x2070df['id']}})['then'](function(){return _0x1b9c15;});})[_0xcab4('0x1f')](function(){_0x381557[_0xcab4('0x15')](0xcc)[_0xcab4('0x24')]();});}};}function handleEntityNotFound(_0x53945a,_0x2fc924){return function(_0x349a17){if(!_0x349a17){_0x53945a[_0xcab4('0x14')](0x194);}return _0x349a17;};}function handleError(_0x1394c1,_0xb8ce72){_0xb8ce72=_0xb8ce72||0x1f4;return function(_0x4bb3ce){logger[_0xcab4('0x25')](_0x4bb3ce[_0xcab4('0x26')]);if(_0x4bb3ce[_0xcab4('0x27')]){delete _0x4bb3ce[_0xcab4('0x27')];}_0x1394c1[_0xcab4('0x15')](_0xb8ce72)[_0xcab4('0x28')](_0x4bb3ce);};}exports['index']=function(_0x5a6187,_0x4bb051){var _0x43f8b3={},_0xcc80d5={},_0x148564={'count':0x0,'rows':[]};var _0x1b5a2e=_['map'](db[_0xcab4('0x29')][_0xcab4('0x2a')],function(_0xe7f6ab){return{'name':_0xe7f6ab[_0xcab4('0x2b')],'type':_0xe7f6ab[_0xcab4('0x2c')][_0xcab4('0x2d')]};});_0xcc80d5[_0xcab4('0x2e')]=_[_0xcab4('0x2f')](_0x1b5a2e,'name');_0xcc80d5['query']=_[_0xcab4('0x30')](_0x5a6187['query']);_0xcc80d5[_0xcab4('0x31')]=_[_0xcab4('0x32')](_0xcc80d5[_0xcab4('0x2e')],_0xcc80d5[_0xcab4('0x33')]);_0x43f8b3[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0xcc80d5['model'],qs[_0xcab4('0x35')](_0x5a6187[_0xcab4('0x33')][_0xcab4('0x35')]));_0x43f8b3[_0xcab4('0x34')]=_0x43f8b3[_0xcab4('0x34')][_0xcab4('0x36')]?_0x43f8b3[_0xcab4('0x34')]:_0xcc80d5[_0xcab4('0x2e')];if(!_0x5a6187[_0xcab4('0x33')]['hasOwnProperty'](_0xcab4('0x37'))){_0x43f8b3[_0xcab4('0x18')]=qs[_0xcab4('0x18')](_0x5a6187[_0xcab4('0x33')][_0xcab4('0x18')]);_0x43f8b3['offset']=qs[_0xcab4('0x17')](_0x5a6187['query'][_0xcab4('0x17')]);}_0x43f8b3['order']=qs['sort'](_0x5a6187[_0xcab4('0x33')]['sort']);_0x43f8b3[_0xcab4('0x38')]=qs[_0xcab4('0x31')](_[_0xcab4('0x39')](_0x5a6187[_0xcab4('0x33')],_0xcc80d5[_0xcab4('0x31')]),_0x1b5a2e);if(_0x5a6187[_0xcab4('0x33')]['filter']){_0x43f8b3[_0xcab4('0x38')]=_[_0xcab4('0x3a')](_0x43f8b3[_0xcab4('0x38')],{'$or':_[_0xcab4('0x2f')](_0x1b5a2e,function(_0x252c15){if(_0x252c15[_0xcab4('0x2c')]!==_0xcab4('0x3b')){var _0x5b30f7={};_0x5b30f7[_0x252c15['name']]={'$like':'%'+_0x5a6187[_0xcab4('0x33')][_0xcab4('0x3c')]+'%'};return _0x5b30f7;}})});}_0x43f8b3=_[_0xcab4('0x3a')]({},_0x43f8b3,_0x5a6187['options']);var _0x45379a={'where':_0x43f8b3[_0xcab4('0x38')]};return db[_0xcab4('0x29')]['count'](_0x45379a)['then'](function(_0xfa63b7){_0x148564['count']=_0xfa63b7;if(_0x5a6187[_0xcab4('0x33')][_0xcab4('0x3d')]){_0x43f8b3[_0xcab4('0x3e')]=[{'all':!![]}];}return db[_0xcab4('0x29')][_0xcab4('0x3f')](_0x43f8b3);})[_0xcab4('0x1f')](function(_0x58eb5a){_0x148564['rows']=_0x58eb5a;return _0x148564;})[_0xcab4('0x1f')](respondWithFilteredResult(_0x4bb051,_0x43f8b3))[_0xcab4('0x40')](handleError(_0x4bb051,null));};exports['show']=function(_0x426234,_0x2bb43d){var _0x2c56cc={'raw':!![],'where':{'id':_0x426234[_0xcab4('0x41')]['id']}},_0x3890b9={};_0x3890b9['model']=_[_0xcab4('0x30')](db[_0xcab4('0x29')]['rawAttributes']);_0x3890b9['query']=_[_0xcab4('0x30')](_0x426234[_0xcab4('0x33')]);_0x3890b9[_0xcab4('0x31')]=_['intersection'](_0x3890b9['model'],_0x3890b9[_0xcab4('0x33')]);_0x2c56cc[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0x3890b9[_0xcab4('0x2e')],qs[_0xcab4('0x35')](_0x426234[_0xcab4('0x33')][_0xcab4('0x35')]));_0x2c56cc['attributes']=_0x2c56cc[_0xcab4('0x34')][_0xcab4('0x36')]?_0x2c56cc['attributes']:_0x3890b9[_0xcab4('0x2e')];if(_0x426234['query'][_0xcab4('0x3d')]){_0x2c56cc[_0xcab4('0x3e')]=[{'all':!![]}];}_0x2c56cc=_[_0xcab4('0x3a')]({},_0x2c56cc,_0x426234[_0xcab4('0x42')]);return db[_0xcab4('0x29')][_0xcab4('0x43')](_0x2c56cc)[_0xcab4('0x1f')](handleEntityNotFound(_0x2bb43d,null))[_0xcab4('0x1f')](respondWithResult(_0x2bb43d,null))[_0xcab4('0x40')](handleError(_0x2bb43d,null));};exports[_0xcab4('0x44')]=function(_0x4b4bb2,_0x346ba4){return db[_0xcab4('0x29')]['create'](_0x4b4bb2[_0xcab4('0x45')],{})[_0xcab4('0x1f')](function(_0x392252){var _0x5b0767=_0x4b4bb2[_0xcab4('0x46')][_0xcab4('0x21')]({'plain':!![]});if(!_0x5b0767)throw new Error(_0xcab4('0x47'));if(_0x5b0767[_0xcab4('0x48')]===_0xcab4('0x46')){var _0xeace8a=_0x392252[_0xcab4('0x21')]({'plain':!![]});var _0x13fea0=_0xcab4('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x13fea0,'userProfileId':_0x5b0767['userProfileId']},'raw':!![]})['then'](function(_0x552410){if(_0x552410&&_0x552410[_0xcab4('0x49')]===0x0){return db[_0xcab4('0x23')][_0xcab4('0x44')]({'name':_0xeace8a[_0xcab4('0x27')],'resourceId':_0xeace8a['id'],'type':_0x552410[_0xcab4('0x27')],'sectionId':_0x552410['id']},{})['then'](function(){return _0x392252;});}else{return _0x392252;}})[_0xcab4('0x40')](function(_0x286a5b){logger[_0xcab4('0x25')](_0xcab4('0x4a'),_0x286a5b);throw _0x286a5b;});}return _0x392252;})[_0xcab4('0x1f')](respondWithResult(_0x346ba4,0xc9))[_0xcab4('0x40')](handleError(_0x346ba4,null));};exports[_0xcab4('0x1e')]=function(_0x4a33f0,_0xb360){if(_0x4a33f0['body']['id']){delete _0x4a33f0[_0xcab4('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x4a33f0[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0xb360,null))[_0xcab4('0x1f')](saveUpdates(_0x4a33f0[_0xcab4('0x45')],null))[_0xcab4('0x1f')](respondWithResult(_0xb360,null))[_0xcab4('0x40')](handleError(_0xb360,null));};exports[_0xcab4('0x20')]=function(_0x44428a,_0x2390b4){return db[_0xcab4('0x29')][_0xcab4('0x43')]({'where':{'id':_0x44428a[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x2390b4,null))[_0xcab4('0x1f')](removeEntity(_0x2390b4,null))[_0xcab4('0x40')](handleError(_0x2390b4,null));};exports['addInterval']=function(_0x27cc9a,_0x1a679f,_0x5c0222){if(_0x27cc9a[_0xcab4('0x45')]['id']){delete _0x27cc9a[_0xcab4('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x27cc9a[_0xcab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a679f,null))[_0xcab4('0x1f')](function(_0x5136dc){if(_0x5136dc){_0x27cc9a[_0xcab4('0x45')][_0xcab4('0x4b')]=_0x5136dc['id'];return db[_0xcab4('0x29')][_0xcab4('0x44')](_0x27cc9a['body']);}})[_0xcab4('0x1f')](respondWithResult(_0x1a679f,null))[_0xcab4('0x40')](handleError(_0x1a679f,null));};exports[_0xcab4('0x4c')]=function(_0x30112e,_0x238a8a,_0x3f2362){var _0x490161={};var _0x3fca2a={};var _0x6ef9a1;var _0x29becf;return db[_0xcab4('0x29')][_0xcab4('0x4d')]({'where':{'id':_0x30112e['params']['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x238a8a,null))['then'](function(_0x147168){if(_0x147168){_0x6ef9a1=_0x147168;_0x3fca2a['model']=_[_0xcab4('0x30')](db[_0xcab4('0x29')][_0xcab4('0x2a')]);_0x3fca2a['query']=_[_0xcab4('0x30')](_0x30112e['query']);_0x3fca2a[_0xcab4('0x31')]=_['intersection'](_0x3fca2a[_0xcab4('0x2e')],_0x3fca2a[_0xcab4('0x33')]);_0x490161[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0x3fca2a[_0xcab4('0x2e')],qs[_0xcab4('0x35')](_0x30112e[_0xcab4('0x33')]['fields']));_0x490161['attributes']=_0x490161[_0xcab4('0x34')][_0xcab4('0x36')]?_0x490161[_0xcab4('0x34')]:_0x3fca2a[_0xcab4('0x2e')];_0x490161['order']=qs['sort'](_0x30112e[_0xcab4('0x33')][_0xcab4('0x4e')]);_0x490161[_0xcab4('0x38')]=qs['filters'](_[_0xcab4('0x39')](_0x30112e['query'],_0x3fca2a[_0xcab4('0x31')]));if(_0x30112e[_0xcab4('0x33')]['filter']){_0x490161[_0xcab4('0x38')]=_[_0xcab4('0x3a')](_0x490161[_0xcab4('0x38')],{'$or':_['map'](_0x490161[_0xcab4('0x34')],function(_0x32fd4e){var _0x59ee64={};_0x59ee64[_0x32fd4e]={'$like':'%'+_0x30112e[_0xcab4('0x33')][_0xcab4('0x3c')]+'%'};return _0x59ee64;})});}_0x490161=_[_0xcab4('0x3a')]({},_0x490161,_0x30112e['options']);return _0x6ef9a1[_0xcab4('0x4c')](_0x490161);}})[_0xcab4('0x1f')](function(_0x26f13d){if(_0x26f13d){_0x29becf=_0x26f13d[_0xcab4('0x36')];if(!_0x30112e[_0xcab4('0x33')][_0xcab4('0x4f')](_0xcab4('0x37'))){_0x490161[_0xcab4('0x18')]=qs['limit'](_0x30112e[_0xcab4('0x33')]['limit']);_0x490161['offset']=qs[_0xcab4('0x17')](_0x30112e[_0xcab4('0x33')][_0xcab4('0x17')]);}return _0x6ef9a1[_0xcab4('0x4c')](_0x490161);}})[_0xcab4('0x1f')](function(_0x44a4f6){if(_0x44a4f6){return _0x44a4f6?{'count':_0x29becf,'rows':_0x44a4f6}:null;}})[_0xcab4('0x1f')](respondWithResult(_0x238a8a,null))['catch'](handleError(_0x238a8a,null));};exports[_0xcab4('0x50')]=function(_0x2d5106,_0x203eec,_0x4e7553){return db[_0xcab4('0x29')][_0xcab4('0x4d')]({'where':{'id':_0x2d5106[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x203eec,null))[_0xcab4('0x1f')](function(_0x4f3eab){if(_0x4f3eab){return db[_0xcab4('0x51')][_0xcab4('0x52')](function(_0x5b0900){return db[_0xcab4('0x29')][_0xcab4('0x20')]({'where':{'IntervalId':_0x2d5106[_0xcab4('0x41')]['id']},'transaction':_0x5b0900})[_0xcab4('0x1f')](function(_0x2199e9){var _0x42d0f0=_[_0xcab4('0x2f')](_0x2d5106['body'],function(_0x5c5b71){delete _0x5c5b71['id'];_0x5c5b71[_0xcab4('0x4b')]=_0x2d5106[_0xcab4('0x41')]['id'];return _0x5c5b71;});return db[_0xcab4('0x29')]['bulkCreate'](_0x42d0f0,{'transaction':_0x5b0900});});})['then'](function(){return db[_0xcab4('0x29')][_0xcab4('0x3f')]({'where':{'IntervalId':_0x2d5106[_0xcab4('0x41')]['id']}});});}})['then'](respondWithResult(_0x203eec,null))['catch'](handleError(_0x203eec,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b2746b2..32c9685 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 _0x3a12=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite'];(function(_0x4631d4,_0x277a5a){var _0x4a576b=function(_0x1a1639){while(--_0x1a1639){_0x4631d4['push'](_0x4631d4['shift']());}};_0x4a576b(++_0x277a5a);}(_0x3a12,0x1ce));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var logger=require(_0x23a1('0x2'))('api');var moment=require(_0x23a1('0x3'));var BPromise=require(_0x23a1('0x4'));var rp=require(_0x23a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23a1('0x6'));var config=require(_0x23a1('0x7'));var attributes=require(_0x23a1('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x23a1('0x9')]=function(_0x3f41d6,_0x5070bb){return _0x3f41d6[_0x23a1('0xa')](_0x23a1('0xb'),attributes,{'tableName':_0x23a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x42cb4d,_0x2f1135){extensions[_0x23a1('0xd')](_0x3f41d6,_0x42cb4d);},'afterBulkCreate':function(_0x126bfe,_0x4381e3,_0xf5a263){_0xf5a263();extensions[_0x23a1('0xd')](_0x3f41d6,_0x126bfe[0x0]);},'afterUpdate':function(_0x5c69b7,_0x1a2377){extensions[_0x23a1('0xd')](_0x3f41d6,_0x5c69b7);},'afterDestroy':function(_0x4c1dd9,_0xfd2abd){extensions['rewrite'](_0x3f41d6,_0x4c1dd9);}}});}; \ No newline at end of file +var _0x57f8=['define','Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x2166a3,_0x237c50){var _0x260035=function(_0x2dbfa2){while(--_0x2dbfa2){_0x2166a3['push'](_0x2166a3['shift']());}};_0x260035(++_0x237c50);}(_0x57f8,0x198));var _0x857f=function(_0x2ff38f,_0xefceba){_0x2ff38f=_0x2ff38f-0x0;var _0x19a75f=_0x57f8[_0x2ff38f];return _0x19a75f;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var BPromise=require(_0x857f('0x4'));var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require(_0x857f('0x6'));var rimraf=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var attributes=require(_0x857f('0x9'));var extensions=require(_0x857f('0xa'));module[_0x857f('0xb')]=function(_0x5d22e4,_0x8380e8){return _0x5d22e4[_0x857f('0xc')](_0x857f('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f6a66,_0x135855){extensions[_0x857f('0xe')](_0x5d22e4,_0x5f6a66);},'afterBulkCreate':function(_0x4f2b09,_0x1e306e,_0x2ef315){_0x2ef315();extensions[_0x857f('0xe')](_0x5d22e4,_0x4f2b09[0x0]);},'afterUpdate':function(_0x5cc993,_0xefee53){extensions[_0x857f('0xe')](_0x5d22e4,_0x5cc993);},'afterDestroy':function(_0x2cba0d,_0x11adfd){extensions[_0x857f('0xe')](_0x5d22e4,_0x2cba0d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3eff9a5..5cbe29a 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 _0x4cc5=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetInterval','Interval','findAll','options','limit','include','model','attributes','map','catch','ShowInterval','raw','where','lodash','moment','randomstring','ioredis'];(function(_0x40b2d7,_0x5cc52f){var _0x57de7a=function(_0x3cebc4){while(--_0x3cebc4){_0x40b2d7['push'](_0x40b2d7['shift']());}};_0x57de7a(++_0x5cc52f);}(_0x4cc5,0xa6));var _0x54cc=function(_0x3185f0,_0xbb446c){_0x3185f0=_0x3185f0-0x0;var _0x4f8704=_0x4cc5[_0x3185f0];return _0x4f8704;};'use strict';var _=require(_0x54cc('0x0'));var util=require('util');var moment=require(_0x54cc('0x1'));var BPromise=require('bluebird');var rs=require(_0x54cc('0x2'));var fs=require('fs');var Redis=require(_0x54cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54cc('0x4'));var logger=require(_0x54cc('0x5'))(_0x54cc('0x6'));var config=require(_0x54cc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x54cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9f1af,_0x529032,_0x5ec096){return new BPromise(function(_0x30bdc0,_0x5e17e9){return client[_0x54cc('0x9')](_0x9f1af,_0x5ec096)[_0x54cc('0xa')](function(_0x4dbe91){logger[_0x54cc('0xb')](_0x54cc('0xc'),_0x529032,'request\x20sent');logger[_0x54cc('0xd')](_0x54cc('0xe'),_0x529032,_0x54cc('0xf'),JSON[_0x54cc('0x10')](_0x4dbe91));if(_0x4dbe91['error']){if(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x12')]===0x1f4){logger[_0x54cc('0x11')](_0x54cc('0xc'),_0x529032,_0x4dbe91['error'][_0x54cc('0x13')]);return _0x5e17e9(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);}logger[_0x54cc('0x11')](_0x54cc('0xc'),_0x529032,_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);return _0x30bdc0(_0x4dbe91[_0x54cc('0x11')][_0x54cc('0x13')]);}else{logger[_0x54cc('0xb')](_0x54cc('0xc'),_0x529032,'request\x20sent');_0x30bdc0(_0x4dbe91[_0x54cc('0x14')][_0x54cc('0x13')]);}})['catch'](function(_0xb75453){logger['error'](_0x54cc('0xc'),_0x529032,_0xb75453);_0x5e17e9(_0xb75453);});});}exports[_0x54cc('0x15')]=function(_0x519a85){var _0x48cce4=this;return new Promise(function(_0x35c95c,_0x5ac6d1){return db[_0x54cc('0x16')][_0x54cc('0x17')]({'raw':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')]['where']||null:null,'attributes':_0x519a85['options']?_0x519a85['options']['attributes']||null:null,'limit':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')][_0x54cc('0x19')]||null:null,'include':_0x519a85[_0x54cc('0x18')]?_0x519a85[_0x54cc('0x18')][_0x54cc('0x1a')]?_['map'](_0x519a85[_0x54cc('0x18')]['include'],function(_0x161164){return{'model':db[_0x161164[_0x54cc('0x1b')]],'as':_0x161164['as'],'attributes':_0x161164[_0x54cc('0x1c')],'include':_0x161164[_0x54cc('0x1a')]?_[_0x54cc('0x1d')](_0x161164[_0x54cc('0x1a')],function(_0x47f8dd){return{'model':db[_0x47f8dd[_0x54cc('0x1b')]],'as':_0x47f8dd['as'],'attributes':_0x47f8dd[_0x54cc('0x1c')],'include':_0x47f8dd[_0x54cc('0x1a')]?_[_0x54cc('0x1d')](_0x47f8dd[_0x54cc('0x1a')],function(_0x46efc8){return{'model':db[_0x46efc8[_0x54cc('0x1b')]],'as':_0x46efc8['as'],'attributes':_0x46efc8[_0x54cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54cc('0xa')](function(_0x176a36){logger[_0x54cc('0xb')](_0x54cc('0x15'),_0x519a85);logger[_0x54cc('0xd')]('GetInterval',_0x519a85,JSON[_0x54cc('0x10')](_0x176a36));_0x35c95c(_0x176a36);})[_0x54cc('0x1e')](function(_0x16ff8d){logger[_0x54cc('0x11')](_0x54cc('0x15'),_0x16ff8d['message'],_0x519a85);_0x5ac6d1(_0x48cce4['error'](0x1f4,_0x16ff8d[_0x54cc('0x13')]));});});};exports[_0x54cc('0x1f')]=function(_0x5975eb){var _0x4728bd=this;return new Promise(function(_0x3bb491,_0x211562){return db[_0x54cc('0x16')]['find']({'raw':_0x5975eb[_0x54cc('0x18')]?_0x5975eb['options'][_0x54cc('0x20')]===undefined?!![]:![]:!![],'where':_0x5975eb[_0x54cc('0x18')]?_0x5975eb['options'][_0x54cc('0x21')]||null:null,'attributes':_0x5975eb[_0x54cc('0x18')]?_0x5975eb[_0x54cc('0x18')][_0x54cc('0x1c')]||null:null,'include':_0x5975eb[_0x54cc('0x18')]?_0x5975eb[_0x54cc('0x18')]['include']?_[_0x54cc('0x1d')](_0x5975eb['options'][_0x54cc('0x1a')],function(_0x500b54){return{'model':db[_0x500b54['model']],'as':_0x500b54['as'],'attributes':_0x500b54[_0x54cc('0x1c')],'include':_0x500b54['include']?_['map'](_0x500b54[_0x54cc('0x1a')],function(_0x410b9a){return{'model':db[_0x410b9a[_0x54cc('0x1b')]],'as':_0x410b9a['as'],'attributes':_0x410b9a['attributes'],'include':_0x410b9a['include']?_[_0x54cc('0x1d')](_0x410b9a[_0x54cc('0x1a')],function(_0x93797a){return{'model':db[_0x93797a['model']],'as':_0x93797a['as'],'attributes':_0x93797a[_0x54cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54cc('0xa')](function(_0x1ba8dd){logger[_0x54cc('0xb')](_0x54cc('0x1f'),_0x5975eb);logger['debug'](_0x54cc('0x1f'),_0x5975eb,JSON[_0x54cc('0x10')](_0x1ba8dd));_0x3bb491(_0x1ba8dd);})['catch'](function(_0x2f1f52){logger[_0x54cc('0x11')](_0x54cc('0x1f'),_0x2f1f52['message'],_0x5975eb);_0x211562(_0x4728bd[_0x54cc('0x11')](0x1f4,_0x2f1f52[_0x54cc('0x13')]));});});}; \ No newline at end of file +var _0x8f77=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Interval','findAll','options','raw','limit','include','model','attributes','GetInterval','ShowInterval','where','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x12724a,_0x53a8c2){var _0x4f6d98=function(_0x3e3959){while(--_0x3e3959){_0x12724a['push'](_0x12724a['shift']());}};_0x4f6d98(++_0x53a8c2);}(_0x8f77,0x1d9));var _0x78f7=function(_0x3677ff,_0x31537d){_0x3677ff=_0x3677ff-0x0;var _0xdc338b=_0x8f77[_0x3677ff];return _0xdc338b;};'use strict';var _=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var moment=require(_0x78f7('0x2'));var BPromise=require(_0x78f7('0x3'));var rs=require(_0x78f7('0x4'));var fs=require('fs');var Redis=require(_0x78f7('0x5'));var db=require(_0x78f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78f7('0x7'))(_0x78f7('0x8'));var config=require(_0x78f7('0x9'));var jayson=require(_0x78f7('0xa'));var client=jayson[_0x78f7('0xb')][_0x78f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3daa3b,_0x2a4350,_0x486dc2){return new BPromise(function(_0x3d16db,_0x42cdff){return client[_0x78f7('0xd')](_0x3daa3b,_0x486dc2)[_0x78f7('0xe')](function(_0x1cddbf){logger[_0x78f7('0xf')](_0x78f7('0x10'),_0x2a4350,'request\x20sent');logger[_0x78f7('0x11')](_0x78f7('0x12'),_0x2a4350,'request\x20sent',JSON[_0x78f7('0x13')](_0x1cddbf));if(_0x1cddbf[_0x78f7('0x14')]){if(_0x1cddbf['error'][_0x78f7('0x15')]===0x1f4){logger[_0x78f7('0x14')](_0x78f7('0x10'),_0x2a4350,_0x1cddbf['error'][_0x78f7('0x16')]);return _0x42cdff(_0x1cddbf[_0x78f7('0x14')][_0x78f7('0x16')]);}logger[_0x78f7('0x14')]('Interval,\x20%s,\x20%s',_0x2a4350,_0x1cddbf[_0x78f7('0x14')][_0x78f7('0x16')]);return _0x3d16db(_0x1cddbf['error']['message']);}else{logger[_0x78f7('0xf')](_0x78f7('0x10'),_0x2a4350,'request\x20sent');_0x3d16db(_0x1cddbf[_0x78f7('0x17')][_0x78f7('0x16')]);}})[_0x78f7('0x18')](function(_0x2393d4){logger[_0x78f7('0x14')](_0x78f7('0x10'),_0x2a4350,_0x2393d4);_0x42cdff(_0x2393d4);});});}exports['GetInterval']=function(_0x234088){var _0x5a8a8d=this;return new Promise(function(_0x1c7190,_0x5fb40a){return db[_0x78f7('0x19')][_0x78f7('0x1a')]({'raw':_0x234088['options']?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x234088[_0x78f7('0x1b')]?_0x234088['options']['where']||null:null,'attributes':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')]['attributes']||null:null,'limit':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1d')]||null:null,'include':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1e')]?_['map'](_0x234088[_0x78f7('0x1b')][_0x78f7('0x1e')],function(_0x3816ed){return{'model':db[_0x3816ed[_0x78f7('0x1f')]],'as':_0x3816ed['as'],'attributes':_0x3816ed[_0x78f7('0x20')],'include':_0x3816ed[_0x78f7('0x1e')]?_['map'](_0x3816ed['include'],function(_0x411855){return{'model':db[_0x411855[_0x78f7('0x1f')]],'as':_0x411855['as'],'attributes':_0x411855[_0x78f7('0x20')],'include':_0x411855[_0x78f7('0x1e')]?_['map'](_0x411855[_0x78f7('0x1e')],function(_0x492b3d){return{'model':db[_0x492b3d[_0x78f7('0x1f')]],'as':_0x492b3d['as'],'attributes':_0x492b3d[_0x78f7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf241d0){logger['info'](_0x78f7('0x21'),_0x234088);logger['debug'](_0x78f7('0x21'),_0x234088,JSON[_0x78f7('0x13')](_0xf241d0));_0x1c7190(_0xf241d0);})[_0x78f7('0x18')](function(_0x1f649e){logger[_0x78f7('0x14')]('GetInterval',_0x1f649e[_0x78f7('0x16')],_0x234088);_0x5fb40a(_0x5a8a8d[_0x78f7('0x14')](0x1f4,_0x1f649e['message']));});});};exports[_0x78f7('0x22')]=function(_0x139c64){var _0x47f44e=this;return new Promise(function(_0xd54115,_0x16e1f6){return db[_0x78f7('0x19')]['find']({'raw':_0x139c64[_0x78f7('0x1b')]?_0x139c64['options']['raw']===undefined?!![]:![]:!![],'where':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')][_0x78f7('0x23')]||null:null,'attributes':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')]['attributes']||null:null,'include':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')]['include']?_[_0x78f7('0x24')](_0x139c64[_0x78f7('0x1b')][_0x78f7('0x1e')],function(_0x3e83ca){return{'model':db[_0x3e83ca['model']],'as':_0x3e83ca['as'],'attributes':_0x3e83ca[_0x78f7('0x20')],'include':_0x3e83ca[_0x78f7('0x1e')]?_[_0x78f7('0x24')](_0x3e83ca[_0x78f7('0x1e')],function(_0x2ba254){return{'model':db[_0x2ba254[_0x78f7('0x1f')]],'as':_0x2ba254['as'],'attributes':_0x2ba254[_0x78f7('0x20')],'include':_0x2ba254['include']?_['map'](_0x2ba254['include'],function(_0x3d1362){return{'model':db[_0x3d1362[_0x78f7('0x1f')]],'as':_0x3d1362['as'],'attributes':_0x3d1362[_0x78f7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x78f7('0xe')](function(_0x4472cd){logger[_0x78f7('0xf')](_0x78f7('0x22'),_0x139c64);logger[_0x78f7('0x11')](_0x78f7('0x22'),_0x139c64,JSON[_0x78f7('0x13')](_0x4472cd));_0xd54115(_0x4472cd);})[_0x78f7('0x18')](function(_0x2b3e9c){logger[_0x78f7('0x14')]('ShowInterval',_0x2b3e9c[_0x78f7('0x16')],_0x139c64);_0x16e1f6(_0x47f44e[_0x78f7('0x14')](0x1f4,_0x2b3e9c[_0x78f7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 30000e8..c09d506 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 _0xaa47=['express','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x4bd2f7,_0x4e1416){var _0x45a91d=function(_0x3d33c8){while(--_0x3d33c8){_0x4bd2f7['push'](_0x4bd2f7['shift']());}};_0x45a91d(++_0x4e1416);}(_0xaa47,0x127));var _0x7aa4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaa47[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7aa4('0x0'));var router=express['Router']();var auth=require(_0x7aa4('0x1'));var controller=require(_0x7aa4('0x2'));router[_0x7aa4('0x3')]('/',auth[_0x7aa4('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file +var _0xec6e=['express','Router','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x32da0d,_0x40ed00){var _0x31f978=function(_0x46e075){while(--_0x46e075){_0x32da0d['push'](_0x32da0d['shift']());}};_0x31f978(++_0x40ed00);}(_0xec6e,0x10a));var _0xeec6=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xec6e[_0x5d5bcb];return _0x4ea5eb;};'use strict';var express=require(_0xeec6('0x0'));var router=express[_0xeec6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xeec6('0x2'));router[_0xeec6('0x3')]('/',auth[_0xeec6('0x4')](),controller[_0xeec6('0x5')]);module[_0xeec6('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1054e68..3b4051e 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 _0xfb32=['fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','request','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug'];(function(_0x36ae11,_0x162776){var _0x44ae0e=function(_0x235aaf){while(--_0x235aaf){_0x36ae11['push'](_0x36ae11['shift']());}};_0x44ae0e(++_0x162776);}(_0xfb32,0x154));var _0x2fb3=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xfb32[_0x3005d5];return _0x547c7e;};'use strict';var BPromise=require(_0x2fb3('0x0'));var https=require(_0x2fb3('0x1'));var logger=require('../../config/logger')(_0x2fb3('0x2'));var USERNAME=_0x2fb3('0x3');var PASSWORD=_0x2fb3('0x4');function openIssue(_0x36aa04,_0x4ac79f){var _0x54e3ec={'fields':{'project':{'key':_0x36aa04['key']||_0x2fb3('0x5')},'summary':(_0x36aa04[_0x2fb3('0x6')]||'Report')+_0x2fb3('0x7')+_0x36aa04['ip'],'description':_0x36aa04[_0x2fb3('0x8')]||JSON[_0x2fb3('0x9')](_0x36aa04),'issuetype':{'name':_0x36aa04[_0x2fb3('0xa')]||_0x2fb3('0xb')}}};_0x54e3ec[_0x2fb3('0xc')][_0x2fb3('0xd')]=_0x36aa04[_0x2fb3('0xe')];_0x54e3ec[_0x2fb3('0xc')][_0x2fb3('0xf')]=_0x36aa04[_0x2fb3('0x10')];_0x54e3ec['fields']['customfield_11502']=_0x36aa04[_0x2fb3('0x11')];_0x54e3ec['fields'][_0x2fb3('0x12')]=_0x36aa04[_0x2fb3('0x13')];_0x54e3ec[_0x2fb3('0xc')]['customfield_11504']=_0x36aa04[_0x2fb3('0x14')];_0x54e3ec['fields'][_0x2fb3('0x15')]=_0x36aa04['ip'];var _0x2c9eff={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x2fb3('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x2fb3('0x17'),'Authorization':_0x2fb3('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2fb3('0x19')]('base64')}};var _0x5d3b6a=JSON[_0x2fb3('0x9')](_0x54e3ec);var _0x59e771=https[_0x2fb3('0x1a')](_0x2c9eff,function(_0x587113){_0x587113['setEncoding'](_0x2fb3('0x1b'));var _0x27467c='';_0x587113['on']('data',function(_0x3f5f2b){_0x27467c+=_0x3f5f2b;});_0x587113['on'](_0x2fb3('0x1c'),function(){if(_0x4ac79f){return _0x4ac79f[_0x2fb3('0x1d')](_0x587113[_0x2fb3('0x1e')])[_0x2fb3('0x1f')](JSON[_0x2fb3('0x20')](_0x27467c));}});});_0x59e771['on'](_0x2fb3('0x21'),function(_0xbc34b6){if(_0x4ac79f){return _0x4ac79f[_0x2fb3('0x1d')](0x1f4)[_0x2fb3('0x1f')]({'errors':[{'message':_0x2fb3('0x22'),'type':_0x2fb3('0x23')}]});}});_0x59e771['write'](_0x5d3b6a);_0x59e771[_0x2fb3('0x1c')]();}exports[_0x2fb3('0x24')]=openIssue;exports[_0x2fb3('0x25')]=function(_0x100e7c,_0x3880c4){_0x100e7c[_0x2fb3('0x26')]['ip']=_0x100e7c[_0x2fb3('0x27')][_0x2fb3('0x28')]||_0x100e7c[_0x2fb3('0x29')]['remoteAddress']||_0x100e7c[_0x2fb3('0x2a')][_0x2fb3('0x2b')]||_0x100e7c['connection'][_0x2fb3('0x2a')][_0x2fb3('0x2b')];return openIssue(_0x100e7c[_0x2fb3('0x26')],_0x3880c4);}; \ No newline at end of file +var _0xa7ec=['socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','connection','remoteAddress'];(function(_0xe127a9,_0x14731c){var _0x400f3b=function(_0x278877){while(--_0x278877){_0xe127a9['push'](_0xe127a9['shift']());}};_0x400f3b(++_0x14731c);}(_0xa7ec,0xe8));var _0xca7e=function(_0x599f5e,_0x36af9d){_0x599f5e=_0x599f5e-0x0;var _0xe80ca8=_0xa7ec[_0x599f5e];return _0xe80ca8;};'use strict';var BPromise=require(_0xca7e('0x0'));var https=require(_0xca7e('0x1'));var logger=require(_0xca7e('0x2'))(_0xca7e('0x3'));var USERNAME=_0xca7e('0x4');var PASSWORD=_0xca7e('0x5');function openIssue(_0x4ec073,_0x166d6f){var _0x222ea2={'fields':{'project':{'key':_0x4ec073[_0xca7e('0x6')]||_0xca7e('0x7')},'summary':(_0x4ec073['summary']||_0xca7e('0x8'))+_0xca7e('0x9')+_0x4ec073['ip'],'description':_0x4ec073['description']||JSON['stringify'](_0x4ec073),'issuetype':{'name':_0x4ec073[_0xca7e('0xa')]||_0xca7e('0xb')}}};_0x222ea2[_0xca7e('0xc')][_0xca7e('0xd')]=_0x4ec073[_0xca7e('0xe')];_0x222ea2[_0xca7e('0xc')]['customfield_11501']=_0x4ec073[_0xca7e('0xf')];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x10')]=_0x4ec073[_0xca7e('0x11')];_0x222ea2[_0xca7e('0xc')]['customfield_11503']=_0x4ec073[_0xca7e('0x12')];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x13')]=_0x4ec073['reason'];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x14')]=_0x4ec073['ip'];var _0x412604={'host':_0xca7e('0x15'),'port':0x1bb,'path':_0xca7e('0x16'),'method':_0xca7e('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xca7e('0x18'),'Authorization':_0xca7e('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xca7e('0x1a')](_0xca7e('0x1b'))}};var _0x41e32f=JSON[_0xca7e('0x1c')](_0x222ea2);var _0x5d6d1c=https[_0xca7e('0x1d')](_0x412604,function(_0x1adb07){_0x1adb07[_0xca7e('0x1e')](_0xca7e('0x1f'));var _0x5354e7='';_0x1adb07['on']('data',function(_0x1bf939){_0x5354e7+=_0x1bf939;});_0x1adb07['on'](_0xca7e('0x20'),function(){if(_0x166d6f){return _0x166d6f[_0xca7e('0x21')](_0x1adb07[_0xca7e('0x22')])['json'](JSON[_0xca7e('0x23')](_0x5354e7));}});});_0x5d6d1c['on']('error',function(_0x2304e5){if(_0x166d6f){return _0x166d6f[_0xca7e('0x21')](0x1f4)[_0xca7e('0x24')]({'errors':[{'message':_0xca7e('0x25'),'type':_0xca7e('0x26')}]});}});_0x5d6d1c[_0xca7e('0x27')](_0x41e32f);_0x5d6d1c[_0xca7e('0x20')]();}exports[_0xca7e('0x28')]=openIssue;exports[_0xca7e('0x29')]=function(_0x420f6f,_0x4afbcc){_0x420f6f['body']['ip']=_0x420f6f['headers']['x-forwarded-for']||_0x420f6f[_0xca7e('0x2a')][_0xca7e('0x2b')]||_0x420f6f[_0xca7e('0x2c')]['remoteAddress']||_0x420f6f['connection']['socket'][_0xca7e('0x2b')];return openIssue(_0x420f6f[_0xca7e('0x2d')],_0x4afbcc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 46ca973..075d73e 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 _0xb4fd=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','post','create','put','/:id','update'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0xb4fd,0x1bb));var _0xdb4f=function(_0x4e0fb5,_0x48f04d){_0x4e0fb5=_0x4e0fb5-0x0;var _0x192175=_0xb4fd[_0x4e0fb5];return _0x192175;};'use strict';var multer=require(_0xdb4f('0x0'));var util=require(_0xdb4f('0x1'));var path=require(_0xdb4f('0x2'));var timeout=require(_0xdb4f('0x3'));var express=require('express');var router=express[_0xdb4f('0x4')]();var auth=require(_0xdb4f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb4f('0x6'));var controller=require(_0xdb4f('0x7'));router['get']('/',auth[_0xdb4f('0x8')](),controller['index']);router[_0xdb4f('0x9')](_0xdb4f('0xa'),auth[_0xdb4f('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb4f('0xb')]('/',auth[_0xdb4f('0x8')](),controller[_0xdb4f('0xc')]);router[_0xdb4f('0xd')](_0xdb4f('0xe'),auth[_0xdb4f('0x8')](),controller[_0xdb4f('0xf')]);router['delete'](_0xdb4f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xdb4f('0x10')]=router; \ No newline at end of file +var _0xec7a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','multer'];(function(_0xadaff,_0x4c676e){var _0x2b69d0=function(_0x520179){while(--_0x520179){_0xadaff['push'](_0xadaff['shift']());}};_0x2b69d0(++_0x4c676e);}(_0xec7a,0x7d));var _0xaec7=function(_0x2b12f7,_0x4033ac){_0x2b12f7=_0x2b12f7-0x0;var _0x8cb277=_0xec7a[_0x2b12f7];return _0x8cb277;};'use strict';var multer=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var path=require(_0xaec7('0x2'));var timeout=require(_0xaec7('0x3'));var express=require(_0xaec7('0x4'));var router=express[_0xaec7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaec7('0x6'));var config=require(_0xaec7('0x7'));var controller=require(_0xaec7('0x8'));router[_0xaec7('0x9')]('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xb')]);router[_0xaec7('0x9')](_0xaec7('0xc'),auth[_0xaec7('0xa')](),controller[_0xaec7('0xd')]);router['get']('/:id',auth[_0xaec7('0xa')](),controller['show']);router[_0xaec7('0xe')]('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xf')]);router[_0xaec7('0x10')](_0xaec7('0x11'),auth['isAuthenticated'](),controller[_0xaec7('0x12')]);router[_0xaec7('0x13')](_0xaec7('0x11'),auth[_0xaec7('0xa')](),controller[_0xaec7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 74ab23e..e1ee33c 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 _0xb053=['STRING','sequelize','TEXT','long'];(function(_0x6ec798,_0x2af2e){var _0x48c829=function(_0x4e0b14){while(--_0x4e0b14){_0x6ec798['push'](_0x6ec798['shift']());}};_0x48c829(++_0x2af2e);}(_0xb053,0x10d));var _0x3b05=function(_0xe9ae4d,_0x8e268e){_0xe9ae4d=_0xe9ae4d-0x0;var _0x3a11da=_0xb053[_0xe9ae4d];return _0x3a11da;};'use strict';var Sequelize=require(_0x3b05('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x3b05('0x1')](_0x3b05('0x2'))},'membername':{'type':Sequelize[_0x3b05('0x3')]},'projectname':{'type':Sequelize[_0x3b05('0x3')]},'queue':{'type':Sequelize[_0x3b05('0x3')]},'uniqueid':{'type':Sequelize[_0x3b05('0x3')]},'calleridname':{'type':Sequelize[_0x3b05('0x3')]},'calleridnum':{'type':Sequelize[_0x3b05('0x3')]},'questionId':{'type':Sequelize[_0x3b05('0x3')]}}; \ No newline at end of file +var _0x8b2b=['exports','STRING','TEXT','long','sequelize'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x8b2b,0xb8));var _0xb8b2=function(_0x1ee28c,_0x496146){_0x1ee28c=_0x1ee28c-0x0;var _0x146073=_0x8b2b[_0x1ee28c];return _0x146073;};'use strict';var Sequelize=require(_0xb8b2('0x0'));module[_0xb8b2('0x1')]={'question':{'type':Sequelize[_0xb8b2('0x2')]},'answer':{'type':Sequelize[_0xb8b2('0x3')](_0xb8b2('0x4'))},'membername':{'type':Sequelize[_0xb8b2('0x2')]},'projectname':{'type':Sequelize[_0xb8b2('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb8b2('0x2')]},'calleridname':{'type':Sequelize[_0xb8b2('0x2')]},'calleridnum':{'type':Sequelize[_0xb8b2('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 2bfe259..b38b48b 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 _0x0a43=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','JscriptyAnswerReport','rows','catch','show','params','keys','intersection','fields','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','api'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x0a43,0x163));var _0x30a4=function(_0x4d0519,_0x321bb9){_0x4d0519=_0x4d0519-0x0;var _0x27e926=_0x0a43[_0x4d0519];return _0x27e926;};'use strict';var pdf=require(_0x30a4('0x0'));var emlformat=require(_0x30a4('0x1'));var rimraf=require(_0x30a4('0x2'));var zipdir=require(_0x30a4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30a4('0x4'));var moment=require(_0x30a4('0x5'));var BPromise=require(_0x30a4('0x6'));var Mustache=require(_0x30a4('0x7'));var util=require(_0x30a4('0x8'));var path=require(_0x30a4('0x9'));var sox=require('sox');var csv=require(_0x30a4('0xa'));var ejs=require(_0x30a4('0xb'));var fs=require('fs');var _=require(_0x30a4('0xc'));var squel=require(_0x30a4('0xd'));var crypto=require(_0x30a4('0xe'));var jsforce=require(_0x30a4('0xf'));var deskjs=require(_0x30a4('0x10'));var toCsv=require(_0x30a4('0xa'));var querystring=require(_0x30a4('0x11'));var Papa=require(_0x30a4('0x12'));var Redis=require('ioredis');var authService=require(_0x30a4('0x13'));var qs=require(_0x30a4('0x14'));var as=require(_0x30a4('0x15'));var hardwareService=require(_0x30a4('0x16'));var logger=require(_0x30a4('0x17'))(_0x30a4('0x18'));var utils=require(_0x30a4('0x19'));var config=require(_0x30a4('0x1a'));var licenseUtil=require(_0x30a4('0x1b'));var db=require(_0x30a4('0x1c'))['db'];function respondWithStatusCode(_0x37f4ae,_0x1e90c8){_0x1e90c8=_0x1e90c8||0xcc;return function(_0x6c0885){if(_0x6c0885){return _0x37f4ae[_0x30a4('0x1d')](_0x1e90c8);}return _0x37f4ae[_0x30a4('0x1e')](_0x1e90c8)[_0x30a4('0x1f')]();};}function respondWithResult(_0x6651ae,_0x4c03d7){_0x4c03d7=_0x4c03d7||0xc8;return function(_0x2c9a40){if(_0x2c9a40){return _0x6651ae['status'](_0x4c03d7)[_0x30a4('0x20')](_0x2c9a40);}};}function respondWithFilteredResult(_0x576715,_0x1bb9d8){return function(_0x2a678a){if(_0x2a678a){var _0x22aff6=_0x2a678a[_0x30a4('0x21')],_0x378863=_0x1bb9d8['offset'],_0x41c7df=_0x1bb9d8[_0x30a4('0x22')]+_0x1bb9d8[_0x30a4('0x23')],_0x3bea69;if(_0x41c7df>=_0x22aff6){_0x41c7df=_0x22aff6;_0x3bea69=0xc8;}else{_0x3bea69=0xce;}_0x576715['status'](_0x3bea69);return _0x576715[_0x30a4('0x24')]('Content-Range',_0x378863+'-'+_0x41c7df+'/'+_0x22aff6)[_0x30a4('0x20')](_0x2a678a);}return null;};}function patchUpdates(_0x5a6a67){return function(_0x4e5f3f){try{jsonpatch[_0x30a4('0x25')](_0x4e5f3f,_0x5a6a67,!![]);}catch(_0x30f7f1){return BPromise['reject'](_0x30f7f1);}return _0x4e5f3f[_0x30a4('0x26')]();};}function saveUpdates(_0x32fd84,_0x29f147){return function(_0x34df8e){if(_0x34df8e){return _0x34df8e[_0x30a4('0x27')](_0x32fd84)[_0x30a4('0x28')](function(_0x58753a){return _0x58753a;});}return null;};}function removeEntity(_0x2d1f0d,_0x2855f8){return function(_0x3d36a3){if(_0x3d36a3){return _0x3d36a3[_0x30a4('0x29')]()[_0x30a4('0x28')](function(){_0x2d1f0d[_0x30a4('0x1e')](0xcc)[_0x30a4('0x1f')]();});}};}function handleEntityNotFound(_0x20d1d6,_0x3dfcc6){return function(_0x46dc0e){if(!_0x46dc0e){_0x20d1d6[_0x30a4('0x1d')](0x194);}return _0x46dc0e;};}function handleError(_0x5405e6,_0x4de3d3){_0x4de3d3=_0x4de3d3||0x1f4;return function(_0x277561){logger[_0x30a4('0x2a')](_0x277561[_0x30a4('0x2b')]);if(_0x277561[_0x30a4('0x2c')]){delete _0x277561[_0x30a4('0x2c')];}_0x5405e6['status'](_0x4de3d3)[_0x30a4('0x2d')](_0x277561);};}exports[_0x30a4('0x2e')]=function(_0x1ffd3f,_0x59d21f){var _0x1757db={},_0x4bb300={},_0x58e7b5={'count':0x0,'rows':[]};var _0x517876=_[_0x30a4('0x2f')](db['JscriptyAnswerReport'][_0x30a4('0x30')],function(_0xb84145){return{'name':_0xb84145[_0x30a4('0x31')],'type':_0xb84145[_0x30a4('0x32')]['key']};});_0x4bb300[_0x30a4('0x33')]=_['map'](_0x517876,_0x30a4('0x2c'));_0x4bb300[_0x30a4('0x34')]=_['keys'](_0x1ffd3f[_0x30a4('0x34')]);_0x4bb300['filters']=_['intersection'](_0x4bb300[_0x30a4('0x33')],_0x4bb300['query']);_0x1757db[_0x30a4('0x35')]=_['intersection'](_0x4bb300[_0x30a4('0x33')],qs['fields'](_0x1ffd3f[_0x30a4('0x34')]['fields']));_0x1757db['attributes']=_0x1757db[_0x30a4('0x35')]['length']?_0x1757db[_0x30a4('0x35')]:_0x4bb300[_0x30a4('0x33')];if(!_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x36')](_0x30a4('0x37'))){_0x1757db[_0x30a4('0x23')]=qs[_0x30a4('0x23')](_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x23')]);_0x1757db[_0x30a4('0x22')]=qs[_0x30a4('0x22')](_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x22')]);}_0x1757db['order']=qs[_0x30a4('0x38')](_0x1ffd3f[_0x30a4('0x34')]['sort']);_0x1757db['where']=qs[_0x30a4('0x39')](_[_0x30a4('0x3a')](_0x1ffd3f[_0x30a4('0x34')],_0x4bb300[_0x30a4('0x39')]),_0x517876);if(_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x3b')]){_0x1757db[_0x30a4('0x3c')]=_[_0x30a4('0x3d')](_0x1757db['where'],{'$or':_[_0x30a4('0x2f')](_0x517876,function(_0x29af6e){if(_0x29af6e[_0x30a4('0x32')]!==_0x30a4('0x3e')){var _0x166477={};_0x166477[_0x29af6e['name']]={'$like':'%'+_0x1ffd3f[_0x30a4('0x34')][_0x30a4('0x3b')]+'%'};return _0x166477;}})});}_0x1757db=_[_0x30a4('0x3d')]({},_0x1757db,_0x1ffd3f['options']);var _0x5a4956={'where':_0x1757db[_0x30a4('0x3c')]};return db['JscriptyAnswerReport'][_0x30a4('0x21')](_0x5a4956)['then'](function(_0x336df6){_0x58e7b5[_0x30a4('0x21')]=_0x336df6;if(_0x1ffd3f[_0x30a4('0x34')]['includeAll']){_0x1757db[_0x30a4('0x3f')]=[{'all':!![]}];}return db[_0x30a4('0x40')]['findAll'](_0x1757db);})['then'](function(_0x59eec0){_0x58e7b5[_0x30a4('0x41')]=_0x59eec0;return _0x58e7b5;})[_0x30a4('0x28')](respondWithFilteredResult(_0x59d21f,_0x1757db))[_0x30a4('0x42')](handleError(_0x59d21f,null));};exports[_0x30a4('0x43')]=function(_0x314d1d,_0x4e0dc9){var _0x37998c={'raw':!![],'where':{'id':_0x314d1d[_0x30a4('0x44')]['id']}},_0xdaf14={};_0xdaf14[_0x30a4('0x33')]=_[_0x30a4('0x45')](db['JscriptyAnswerReport']['rawAttributes']);_0xdaf14[_0x30a4('0x34')]=_[_0x30a4('0x45')](_0x314d1d[_0x30a4('0x34')]);_0xdaf14[_0x30a4('0x39')]=_[_0x30a4('0x46')](_0xdaf14['model'],_0xdaf14['query']);_0x37998c[_0x30a4('0x35')]=_[_0x30a4('0x46')](_0xdaf14['model'],qs[_0x30a4('0x47')](_0x314d1d[_0x30a4('0x34')][_0x30a4('0x47')]));_0x37998c[_0x30a4('0x35')]=_0x37998c[_0x30a4('0x35')][_0x30a4('0x48')]?_0x37998c[_0x30a4('0x35')]:_0xdaf14['model'];if(_0x314d1d[_0x30a4('0x34')]['includeAll']){_0x37998c[_0x30a4('0x3f')]=[{'all':!![]}];}_0x37998c=_[_0x30a4('0x3d')]({},_0x37998c,_0x314d1d['options']);return db['JscriptyAnswerReport'][_0x30a4('0x49')](_0x37998c)['then'](handleEntityNotFound(_0x4e0dc9,null))['then'](respondWithResult(_0x4e0dc9,null))[_0x30a4('0x42')](handleError(_0x4e0dc9,null));};exports[_0x30a4('0x4a')]=function(_0x598175,_0xabfb){return db[_0x30a4('0x40')]['create'](_0x598175['body'],{})[_0x30a4('0x28')](respondWithResult(_0xabfb,0xc9))[_0x30a4('0x42')](handleError(_0xabfb,null));};exports[_0x30a4('0x27')]=function(_0x3c4662,_0x11b3c6){if(_0x3c4662['body']['id']){delete _0x3c4662[_0x30a4('0x4b')]['id'];}return db[_0x30a4('0x40')][_0x30a4('0x49')]({'where':{'id':_0x3c4662[_0x30a4('0x44')]['id']}})[_0x30a4('0x28')](handleEntityNotFound(_0x11b3c6,null))['then'](saveUpdates(_0x3c4662[_0x30a4('0x4b')],null))[_0x30a4('0x28')](respondWithResult(_0x11b3c6,null))['catch'](handleError(_0x11b3c6,null));};exports[_0x30a4('0x29')]=function(_0x403027,_0x29c115){return db[_0x30a4('0x40')]['find']({'where':{'id':_0x403027[_0x30a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x29c115,null))[_0x30a4('0x28')](removeEntity(_0x29c115,null))[_0x30a4('0x42')](handleError(_0x29c115,null));};exports['describe']=function(_0x36fdfb,_0x9139c9){return db[_0x30a4('0x40')]['describe']()[_0x30a4('0x28')](respondWithResult(_0x9139c9,null))[_0x30a4('0x42')](handleError(_0x9139c9,null));}; \ No newline at end of file +var _0x6763=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x351afa,_0x2ff8b0){var _0x4b979f=function(_0x41d55e){while(--_0x41d55e){_0x351afa['push'](_0x351afa['shift']());}};_0x4b979f(++_0x2ff8b0);}(_0x6763,0x1ba));var _0x3676=function(_0x3763da,_0x58158b){_0x3763da=_0x3763da-0x0;var _0x5d192f=_0x6763[_0x3763da];return _0x5d192f;};'use strict';var pdf=require(_0x3676('0x0'));var emlformat=require(_0x3676('0x1'));var rimraf=require(_0x3676('0x2'));var zipdir=require(_0x3676('0x3'));var jsonpatch=require(_0x3676('0x4'));var rp=require(_0x3676('0x5'));var moment=require('moment');var BPromise=require(_0x3676('0x6'));var Mustache=require(_0x3676('0x7'));var util=require(_0x3676('0x8'));var path=require('path');var sox=require(_0x3676('0x9'));var csv=require(_0x3676('0xa'));var ejs=require(_0x3676('0xb'));var fs=require('fs');var _=require(_0x3676('0xc'));var squel=require(_0x3676('0xd'));var crypto=require(_0x3676('0xe'));var jsforce=require(_0x3676('0xf'));var deskjs=require(_0x3676('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3676('0x11'));var Papa=require(_0x3676('0x12'));var Redis=require(_0x3676('0x13'));var authService=require(_0x3676('0x14'));var qs=require(_0x3676('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3676('0x16'));var logger=require(_0x3676('0x17'))(_0x3676('0x18'));var utils=require(_0x3676('0x19'));var config=require(_0x3676('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3676('0x1b'))['db'];function respondWithStatusCode(_0x315814,_0x14f51e){_0x14f51e=_0x14f51e||0xcc;return function(_0xf61671){if(_0xf61671){return _0x315814[_0x3676('0x1c')](_0x14f51e);}return _0x315814[_0x3676('0x1d')](_0x14f51e)[_0x3676('0x1e')]();};}function respondWithResult(_0x105f09,_0x90ab49){_0x90ab49=_0x90ab49||0xc8;return function(_0x4a3308){if(_0x4a3308){return _0x105f09[_0x3676('0x1d')](_0x90ab49)[_0x3676('0x1f')](_0x4a3308);}};}function respondWithFilteredResult(_0x2f799f,_0x185109){return function(_0x5c337a){if(_0x5c337a){var _0x4d3101=_0x5c337a[_0x3676('0x20')],_0x5ecfbd=_0x185109[_0x3676('0x21')],_0x2b756d=_0x185109[_0x3676('0x21')]+_0x185109['limit'],_0x342173;if(_0x2b756d>=_0x4d3101){_0x2b756d=_0x4d3101;_0x342173=0xc8;}else{_0x342173=0xce;}_0x2f799f[_0x3676('0x1d')](_0x342173);return _0x2f799f[_0x3676('0x22')](_0x3676('0x23'),_0x5ecfbd+'-'+_0x2b756d+'/'+_0x4d3101)['json'](_0x5c337a);}return null;};}function patchUpdates(_0x5a3486){return function(_0x26fb9b){try{jsonpatch[_0x3676('0x24')](_0x26fb9b,_0x5a3486,!![]);}catch(_0x27eedc){return BPromise[_0x3676('0x25')](_0x27eedc);}return _0x26fb9b['save']();};}function saveUpdates(_0x408b34,_0x390f39){return function(_0x182be3){if(_0x182be3){return _0x182be3['update'](_0x408b34)['then'](function(_0x1b130a){return _0x1b130a;});}return null;};}function removeEntity(_0x3d0c17,_0x3ce652){return function(_0x255c9f){if(_0x255c9f){return _0x255c9f[_0x3676('0x26')]()[_0x3676('0x27')](function(){_0x3d0c17[_0x3676('0x1d')](0xcc)[_0x3676('0x1e')]();});}};}function handleEntityNotFound(_0x3fadb5,_0x288c94){return function(_0x588dec){if(!_0x588dec){_0x3fadb5[_0x3676('0x1c')](0x194);}return _0x588dec;};}function handleError(_0x249130,_0x10e3bc){_0x10e3bc=_0x10e3bc||0x1f4;return function(_0x27b356){logger[_0x3676('0x28')](_0x27b356[_0x3676('0x29')]);if(_0x27b356[_0x3676('0x2a')]){delete _0x27b356[_0x3676('0x2a')];}_0x249130[_0x3676('0x1d')](_0x10e3bc)['send'](_0x27b356);};}exports[_0x3676('0x2b')]=function(_0x243fcd,_0x10ac19){var _0x413733={},_0x18a73a={},_0x1460d8={'count':0x0,'rows':[]};var _0x5cd430=_[_0x3676('0x2c')](db[_0x3676('0x2d')][_0x3676('0x2e')],function(_0x55d166){return{'name':_0x55d166[_0x3676('0x2f')],'type':_0x55d166[_0x3676('0x30')][_0x3676('0x31')]};});_0x18a73a[_0x3676('0x32')]=_['map'](_0x5cd430,_0x3676('0x2a'));_0x18a73a[_0x3676('0x33')]=_[_0x3676('0x34')](_0x243fcd[_0x3676('0x33')]);_0x18a73a[_0x3676('0x35')]=_[_0x3676('0x36')](_0x18a73a[_0x3676('0x32')],_0x18a73a[_0x3676('0x33')]);_0x413733[_0x3676('0x37')]=_[_0x3676('0x36')](_0x18a73a[_0x3676('0x32')],qs[_0x3676('0x38')](_0x243fcd[_0x3676('0x33')]['fields']));_0x413733[_0x3676('0x37')]=_0x413733['attributes']['length']?_0x413733[_0x3676('0x37')]:_0x18a73a[_0x3676('0x32')];if(!_0x243fcd[_0x3676('0x33')][_0x3676('0x39')](_0x3676('0x3a'))){_0x413733[_0x3676('0x3b')]=qs[_0x3676('0x3b')](_0x243fcd[_0x3676('0x33')][_0x3676('0x3b')]);_0x413733[_0x3676('0x21')]=qs[_0x3676('0x21')](_0x243fcd[_0x3676('0x33')][_0x3676('0x21')]);}_0x413733['order']=qs[_0x3676('0x3c')](_0x243fcd[_0x3676('0x33')][_0x3676('0x3c')]);_0x413733['where']=qs[_0x3676('0x35')](_['pick'](_0x243fcd[_0x3676('0x33')],_0x18a73a[_0x3676('0x35')]),_0x5cd430);if(_0x243fcd[_0x3676('0x33')][_0x3676('0x3d')]){_0x413733[_0x3676('0x3e')]=_[_0x3676('0x3f')](_0x413733['where'],{'$or':_[_0x3676('0x2c')](_0x5cd430,function(_0x45bb8d){if(_0x45bb8d['type']!==_0x3676('0x40')){var _0xa0733={};_0xa0733[_0x45bb8d[_0x3676('0x2a')]]={'$like':'%'+_0x243fcd[_0x3676('0x33')][_0x3676('0x3d')]+'%'};return _0xa0733;}})});}_0x413733=_[_0x3676('0x3f')]({},_0x413733,_0x243fcd[_0x3676('0x41')]);var _0x381c4e={'where':_0x413733[_0x3676('0x3e')]};return db[_0x3676('0x2d')][_0x3676('0x20')](_0x381c4e)[_0x3676('0x27')](function(_0x5aced4){_0x1460d8[_0x3676('0x20')]=_0x5aced4;if(_0x243fcd[_0x3676('0x33')]['includeAll']){_0x413733[_0x3676('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3676('0x43')](_0x413733);})[_0x3676('0x27')](function(_0x201038){_0x1460d8[_0x3676('0x44')]=_0x201038;return _0x1460d8;})[_0x3676('0x27')](respondWithFilteredResult(_0x10ac19,_0x413733))[_0x3676('0x45')](handleError(_0x10ac19,null));};exports[_0x3676('0x46')]=function(_0x2b4b19,_0x323bcb){var _0x385990={'raw':!![],'where':{'id':_0x2b4b19[_0x3676('0x47')]['id']}},_0x310d50={};_0x310d50['model']=_[_0x3676('0x34')](db[_0x3676('0x2d')]['rawAttributes']);_0x310d50[_0x3676('0x33')]=_[_0x3676('0x34')](_0x2b4b19['query']);_0x310d50[_0x3676('0x35')]=_[_0x3676('0x36')](_0x310d50[_0x3676('0x32')],_0x310d50['query']);_0x385990[_0x3676('0x37')]=_['intersection'](_0x310d50['model'],qs['fields'](_0x2b4b19[_0x3676('0x33')]['fields']));_0x385990[_0x3676('0x37')]=_0x385990['attributes'][_0x3676('0x48')]?_0x385990[_0x3676('0x37')]:_0x310d50[_0x3676('0x32')];if(_0x2b4b19[_0x3676('0x33')][_0x3676('0x49')]){_0x385990[_0x3676('0x42')]=[{'all':!![]}];}_0x385990=_['merge']({},_0x385990,_0x2b4b19[_0x3676('0x41')]);return db[_0x3676('0x2d')][_0x3676('0x4a')](_0x385990)['then'](handleEntityNotFound(_0x323bcb,null))[_0x3676('0x27')](respondWithResult(_0x323bcb,null))[_0x3676('0x45')](handleError(_0x323bcb,null));};exports[_0x3676('0x4b')]=function(_0x187f89,_0x55e908){return db[_0x3676('0x2d')][_0x3676('0x4b')](_0x187f89[_0x3676('0x4c')],{})[_0x3676('0x27')](respondWithResult(_0x55e908,0xc9))[_0x3676('0x45')](handleError(_0x55e908,null));};exports['update']=function(_0x50297c,_0x33c85d){if(_0x50297c[_0x3676('0x4c')]['id']){delete _0x50297c[_0x3676('0x4c')]['id'];}return db[_0x3676('0x2d')]['find']({'where':{'id':_0x50297c['params']['id']}})[_0x3676('0x27')](handleEntityNotFound(_0x33c85d,null))[_0x3676('0x27')](saveUpdates(_0x50297c['body'],null))['then'](respondWithResult(_0x33c85d,null))[_0x3676('0x45')](handleError(_0x33c85d,null));};exports[_0x3676('0x26')]=function(_0x5ab154,_0x30d265){return db[_0x3676('0x2d')][_0x3676('0x4a')]({'where':{'id':_0x5ab154[_0x3676('0x47')]['id']}})[_0x3676('0x27')](handleEntityNotFound(_0x30d265,null))[_0x3676('0x27')](removeEntity(_0x30d265,null))[_0x3676('0x45')](handleError(_0x30d265,null));};exports[_0x3676('0x4d')]=function(_0x1ab9ac,_0x2f8044){return db[_0x3676('0x2d')]['describe']()['then'](respondWithResult(_0x2f8044,null))[_0x3676('0x45')](handleError(_0x2f8044,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ad50668..9705808 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 _0xab1a=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','bluebird'];(function(_0x14eac5,_0x5d7549){var _0x223eb6=function(_0x892d56){while(--_0x892d56){_0x14eac5['push'](_0x14eac5['shift']());}};_0x223eb6(++_0x5d7549);}(_0xab1a,0x1d0));var _0xaab1=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xab1a[_0x548200];return _0x1a6d74;};'use strict';var _=require('lodash');var util=require(_0xaab1('0x0'));var logger=require(_0xaab1('0x1'))(_0xaab1('0x2'));var moment=require('moment');var BPromise=require(_0xaab1('0x3'));var rp=require(_0xaab1('0x4'));var fs=require('fs');var path=require(_0xaab1('0x5'));var rimraf=require('rimraf');var config=require(_0xaab1('0x6'));var attributes=require(_0xaab1('0x7'));module[_0xaab1('0x8')]=function(_0xfb40a2,_0x2ee709){return _0xfb40a2[_0xaab1('0x9')](_0xaab1('0xa'),attributes,{'tableName':_0xaab1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed81=['../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','path'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0xed81,0x163));var _0x1ed8=function(_0x38fadc,_0x5c1a9c){_0x38fadc=_0x38fadc-0x0;var _0x3c0c69=_0xed81[_0x38fadc];return _0x3c0c69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ed8('0x0'))(_0x1ed8('0x1'));var moment=require(_0x1ed8('0x2'));var BPromise=require(_0x1ed8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ed8('0x4'));var rimraf=require('rimraf');var config=require(_0x1ed8('0x5'));var attributes=require(_0x1ed8('0x6'));module['exports']=function(_0x26a0ef,_0x55f536){return _0x26a0ef['define'](_0x1ed8('0x7'),attributes,{'tableName':_0x1ed8('0x8'),'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 f095dc0..4ef8755 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 _0x7a77=['client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x7a77,0x157));var _0x77a7=function(_0x1454a5,_0x279153){_0x1454a5=_0x1454a5-0x0;var _0xc9b661=_0x7a77[_0x1454a5];return _0xc9b661;};'use strict';var _=require(_0x77a7('0x0'));var util=require('util');var moment=require(_0x77a7('0x1'));var BPromise=require(_0x77a7('0x2'));var rs=require(_0x77a7('0x3'));var fs=require('fs');var Redis=require(_0x77a7('0x4'));var db=require(_0x77a7('0x5'))['db'];var utils=require(_0x77a7('0x6'));var logger=require(_0x77a7('0x7'))('rpc');var config=require(_0x77a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1afd13,_0x140880,_0x12334f){return new BPromise(function(_0x560ea6,_0x413657){return client[_0x77a7('0xa')](_0x1afd13,_0x12334f)['then'](function(_0x2eb81b){logger[_0x77a7('0xb')](_0x77a7('0xc'),_0x140880,_0x77a7('0xd'));logger[_0x77a7('0xe')](_0x77a7('0xf'),_0x140880,'request\x20sent',JSON[_0x77a7('0x10')](_0x2eb81b));if(_0x2eb81b['error']){if(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x12')]===0x1f4){logger[_0x77a7('0x11')](_0x77a7('0xc'),_0x140880,_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);return _0x413657(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);}logger[_0x77a7('0x11')](_0x77a7('0xc'),_0x140880,_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);return _0x560ea6(_0x2eb81b[_0x77a7('0x11')][_0x77a7('0x13')]);}else{logger[_0x77a7('0xb')](_0x77a7('0xc'),_0x140880,_0x77a7('0xd'));_0x560ea6(_0x2eb81b[_0x77a7('0x14')][_0x77a7('0x13')]);}})[_0x77a7('0x15')](function(_0x12f23e){logger[_0x77a7('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x140880,_0x12f23e);_0x413657(_0x12f23e);});});} \ No newline at end of file +var _0xd41d=['result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x549a24,_0x35bca6){var _0x2a67c3=function(_0x108a24){while(--_0x108a24){_0x549a24['push'](_0x549a24['shift']());}};_0x2a67c3(++_0x35bca6);}(_0xd41d,0x12c));var _0xdd41=function(_0x53a13b,_0x316d7a){_0x53a13b=_0x53a13b-0x0;var _0x552340=_0xd41d[_0x53a13b];return _0x552340;};'use strict';var _=require('lodash');var util=require(_0xdd41('0x0'));var moment=require(_0xdd41('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd41('0x2'));var fs=require('fs');var Redis=require(_0xdd41('0x3'));var db=require(_0xdd41('0x4'))['db'];var utils=require(_0xdd41('0x5'));var logger=require(_0xdd41('0x6'))(_0xdd41('0x7'));var config=require(_0xdd41('0x8'));var jayson=require(_0xdd41('0x9'));var client=jayson[_0xdd41('0xa')][_0xdd41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259521,_0x21afb9,_0x48f3e8){return new BPromise(function(_0x30b164,_0x133dca){return client[_0xdd41('0xc')](_0x259521,_0x48f3e8)[_0xdd41('0xd')](function(_0xecd1e9){logger['info'](_0xdd41('0xe'),_0x21afb9,_0xdd41('0xf'));logger[_0xdd41('0x10')](_0xdd41('0x11'),_0x21afb9,_0xdd41('0xf'),JSON[_0xdd41('0x12')](_0xecd1e9));if(_0xecd1e9[_0xdd41('0x13')]){if(_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x14')]===0x1f4){logger[_0xdd41('0x13')](_0xdd41('0xe'),_0x21afb9,_0xecd1e9[_0xdd41('0x13')]['message']);return _0x133dca(_0xecd1e9['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x21afb9,_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x15')]);return _0x30b164(_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x15')]);}else{logger['info'](_0xdd41('0xe'),_0x21afb9,_0xdd41('0xf'));_0x30b164(_0xecd1e9[_0xdd41('0x16')][_0xdd41('0x15')]);}})['catch'](function(_0x5c8692){logger['error'](_0xdd41('0xe'),_0x21afb9,_0x5c8692);_0x133dca(_0x5c8692);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c970ee0..199de20 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 _0xd6ba=['get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','multer','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3aa5ef,_0x44d5aa){var _0x567c02=function(_0x396830){while(--_0x396830){_0x3aa5ef['push'](_0x3aa5ef['shift']());}};_0x567c02(++_0x44d5aa);}(_0xd6ba,0x1f2));var _0xad6b=function(_0x94dc02,_0x12ac8f){_0x94dc02=_0x94dc02-0x0;var _0x38c9ea=_0xd6ba[_0x94dc02];return _0x38c9ea;};'use strict';var multer=require(_0xad6b('0x0'));var util=require('util');var path=require(_0xad6b('0x1'));var timeout=require(_0xad6b('0x2'));var express=require(_0xad6b('0x3'));var router=express[_0xad6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad6b('0x5'));var controller=require('./jscriptyProject.controller');router[_0xad6b('0x6')]('/',auth['isAuthenticated'](),controller[_0xad6b('0x7')]);router[_0xad6b('0x6')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller[_0xad6b('0xa')]);router[_0xad6b('0x6')](_0xad6b('0xb'),auth[_0xad6b('0x9')](),controller[_0xad6b('0xc')]);router[_0xad6b('0x6')](_0xad6b('0xd'),auth['isAuthenticated'](),controller[_0xad6b('0xe')]);router[_0xad6b('0x6')]('/:id/summary',auth[_0xad6b('0x9')](),timeout(_0xad6b('0xf')),controller[_0xad6b('0x10')]);router[_0xad6b('0x11')]('/',auth[_0xad6b('0x9')](),controller[_0xad6b('0x12')]);router[_0xad6b('0x11')](_0xad6b('0x13'),auth['isAuthenticated'](),controller[_0xad6b('0x14')]);router[_0xad6b('0x15')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller[_0xad6b('0x16')]);router[_0xad6b('0x17')](_0xad6b('0x8'),auth[_0xad6b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc9ab=['show','/:id/sessions','/:id/summary','post','/:id/clone','clone','put','delete','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xc9ab,0x125));var _0xbc9a=function(_0x487c79,_0x146ce5){_0x487c79=_0x487c79-0x0;var _0x31929b=_0xc9ab[_0x487c79];return _0x31929b;};'use strict';var multer=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var path=require(_0xbc9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbc9a('0x3'));var interaction=require(_0xbc9a('0x4'));var config=require(_0xbc9a('0x5'));var controller=require(_0xbc9a('0x6'));router[_0xbc9a('0x7')]('/',auth[_0xbc9a('0x8')](),controller[_0xbc9a('0x9')]);router[_0xbc9a('0x7')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller[_0xbc9a('0xb')]);router[_0xbc9a('0x7')](_0xbc9a('0xc'),auth[_0xbc9a('0x8')](),controller['getSessions']);router['get']('/:id/answers',auth[_0xbc9a('0x8')](),controller['getAnswers']);router[_0xbc9a('0x7')](_0xbc9a('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router[_0xbc9a('0xe')]('/',auth[_0xbc9a('0x8')](),controller['create']);router[_0xbc9a('0xe')](_0xbc9a('0xf'),auth[_0xbc9a('0x8')](),controller[_0xbc9a('0x10')]);router[_0xbc9a('0x11')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller['update']);router[_0xbc9a('0x12')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 33cf28b..59edf24 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 _0x53a8=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x11361,_0xa95e07){var _0x376335=function(_0x18553f){while(--_0x18553f){_0x11361['push'](_0x11361['shift']());}};_0x376335(++_0xa95e07);}(_0x53a8,0x117));var _0x853a=function(_0x7714a4,_0x1c9595){_0x7714a4=_0x7714a4-0x0;var _0x532a5e=_0x53a8[_0x7714a4];return _0x532a5e;};'use strict';var Sequelize=require(_0x853a('0x0'));var _=require('lodash');var util=require(_0x853a('0x1'));module[_0x853a('0x2')]={'name':{'type':Sequelize[_0x853a('0x3')],'unique':_0x853a('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x853a('0x5')](_0x853a('0x6')),'set':function(_0x2edda2){if(_[_0x853a('0x7')](_0x2edda2)){this[_0x853a('0x8')](_0x853a('0x9'),JSON[_0x853a('0xa')](_0x2edda2));}else if(_[_0x853a('0xb')](_0x2edda2)){this[_0x853a('0x8')]('formData',_0x2edda2);}else{this[_0x853a('0x8')](_0x853a('0x9'),util[_0x853a('0xc')](_0x853a('0xd'),this[_0x853a('0xe')]('name')||'',this[_0x853a('0xe')](_0x853a('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x853a('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x853a('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xd7ff=['sequelize','STRING','name','isObjectLike','stringify','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd7ff,0x1b0));var _0xfd7f=function(_0x3cb788,_0x414fc8){_0x3cb788=_0x3cb788-0x0;var _0x391a9d=_0xd7ff[_0x3cb788];return _0x391a9d;};'use strict';var Sequelize=require(_0xfd7f('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xfd7f('0x1')],'unique':_0xfd7f('0x2')},'description':{'type':Sequelize[_0xfd7f('0x1')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x1f7929){if(_[_0xfd7f('0x3')](_0x1f7929)){this['setDataValue']('formData',JSON[_0xfd7f('0x4')](_0x1f7929));}else if(_['isString'](_0x1f7929)){this[_0xfd7f('0x5')](_0xfd7f('0x6'),_0x1f7929);}else{this[_0xfd7f('0x5')](_0xfd7f('0x6'),util[_0xfd7f('0x7')](_0xfd7f('0x8'),this[_0xfd7f('0x9')](_0xfd7f('0x2'))||'',this[_0xfd7f('0x9')](_0xfd7f('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfd7f('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 341681d..1c0658b 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 _0xdb76=['question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','status','update','then','Projects','UserProfileResource','destroy','stack','name','send','index','map','JscriptyProject','fieldName','key','keys','query','intersection','model','attributes','fields','length','nolimit','limit','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','error','params','omit','createdAt','updatedAt','body','JscriptySessionReport','rawAttributes','order','sort','pick','ProjectId','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','startTime','starttime','parse','-createdAt','questionId'];(function(_0x347ec9,_0x542714){var _0x131b5c=function(_0x22874c){while(--_0x22874c){_0x347ec9['push'](_0x347ec9['shift']());}};_0x131b5c(++_0x542714);}(_0xdb76,0x7c));var _0x6db7=function(_0x389d41,_0x2a0bb2){_0x389d41=_0x389d41-0x0;var _0x27c607=_0xdb76[_0x389d41];return _0x27c607;};'use strict';var pdf=require(_0x6db7('0x0'));var emlformat=require(_0x6db7('0x1'));var rimraf=require(_0x6db7('0x2'));var zipdir=require(_0x6db7('0x3'));var jsonpatch=require(_0x6db7('0x4'));var rp=require(_0x6db7('0x5'));var moment=require(_0x6db7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6db7('0x7'));var util=require(_0x6db7('0x8'));var path=require(_0x6db7('0x9'));var sox=require(_0x6db7('0xa'));var csv=require(_0x6db7('0xb'));var ejs=require(_0x6db7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6db7('0xd'));var crypto=require(_0x6db7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6db7('0xb'));var querystring=require(_0x6db7('0xf'));var Papa=require(_0x6db7('0x10'));var Redis=require(_0x6db7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6db7('0x12'));var as=require(_0x6db7('0x13'));var hardwareService=require(_0x6db7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6db7('0x15'));var config=require(_0x6db7('0x16'));var licenseUtil=require(_0x6db7('0x17'));var db=require(_0x6db7('0x18'))['db'];function respondWithStatusCode(_0x5ac03e,_0x55f48c){_0x55f48c=_0x55f48c||0xcc;return function(_0xc680de){if(_0xc680de){return _0x5ac03e['sendStatus'](_0x55f48c);}return _0x5ac03e['status'](_0x55f48c)[_0x6db7('0x19')]();};}function respondWithResult(_0x501af0,_0xdea08b){_0xdea08b=_0xdea08b||0xc8;return function(_0x36bc45){if(_0x36bc45){return _0x501af0['status'](_0xdea08b)[_0x6db7('0x1a')](_0x36bc45);}};}function respondWithFilteredResult(_0x575972,_0x4fb0dc){return function(_0xe353aa){if(_0xe353aa){var _0x5c12f1=_0xe353aa[_0x6db7('0x1b')],_0x127ba7=_0x4fb0dc[_0x6db7('0x1c')],_0x5ad9c8=_0x4fb0dc[_0x6db7('0x1c')]+_0x4fb0dc['limit'],_0x285394;if(_0x5ad9c8>=_0x5c12f1){_0x5ad9c8=_0x5c12f1;_0x285394=0xc8;}else{_0x285394=0xce;}_0x575972[_0x6db7('0x1d')](_0x285394);return _0x575972['set']('Content-Range',_0x127ba7+'-'+_0x5ad9c8+'/'+_0x5c12f1)[_0x6db7('0x1a')](_0xe353aa);}return null;};}function patchUpdates(_0x9c4369){return function(_0x23c451){try{jsonpatch['apply'](_0x23c451,_0x9c4369,!![]);}catch(_0x12f403){return BPromise['reject'](_0x12f403);}return _0x23c451['save']();};}function saveUpdates(_0xbc0de0,_0x573eb0){return function(_0x285a5d){if(_0x285a5d){return _0x285a5d[_0x6db7('0x1e')](_0xbc0de0)[_0x6db7('0x1f')](function(_0x532e22){return _0x532e22;});}return null;};}function removeEntity(_0x4143ed,_0x5548d2){return function(_0x173d95){if(_0x173d95){return _0x173d95['destroy']()[_0x6db7('0x1f')](function(){var _0x578455=_0x173d95['get']({'plain':!![]});var _0x4cda27=_0x6db7('0x20');return db[_0x6db7('0x21')][_0x6db7('0x22')]({'where':{'type':_0x4cda27,'resourceId':_0x578455['id']}})[_0x6db7('0x1f')](function(){return _0x173d95;});})['then'](function(){_0x4143ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4959df,_0x39896e){return function(_0x5ee952){if(!_0x5ee952){_0x4959df['sendStatus'](0x194);}return _0x5ee952;};}function handleError(_0x4a759a,_0x2ccbef){_0x2ccbef=_0x2ccbef||0x1f4;return function(_0xcf7dbe){logger['error'](_0xcf7dbe[_0x6db7('0x23')]);if(_0xcf7dbe[_0x6db7('0x24')]){delete _0xcf7dbe[_0x6db7('0x24')];}_0x4a759a[_0x6db7('0x1d')](_0x2ccbef)[_0x6db7('0x25')](_0xcf7dbe);};}exports[_0x6db7('0x26')]=function(_0x5ec6da,_0x4f8309){var _0xc3ad87={},_0x2f7131={},_0x1f32fb={'count':0x0,'rows':[]};var _0x94c124=_[_0x6db7('0x27')](db[_0x6db7('0x28')]['rawAttributes'],function(_0x27a16c){return{'name':_0x27a16c[_0x6db7('0x29')],'type':_0x27a16c['type'][_0x6db7('0x2a')]};});_0x2f7131['model']=_[_0x6db7('0x27')](_0x94c124,_0x6db7('0x24'));_0x2f7131['query']=_[_0x6db7('0x2b')](_0x5ec6da[_0x6db7('0x2c')]);_0x2f7131['filters']=_[_0x6db7('0x2d')](_0x2f7131[_0x6db7('0x2e')],_0x2f7131[_0x6db7('0x2c')]);_0xc3ad87[_0x6db7('0x2f')]=_['intersection'](_0x2f7131['model'],qs['fields'](_0x5ec6da['query'][_0x6db7('0x30')]));_0xc3ad87['attributes']=_0xc3ad87['attributes'][_0x6db7('0x31')]?_0xc3ad87[_0x6db7('0x2f')]:_0x2f7131['model'];if(!_0x5ec6da[_0x6db7('0x2c')]['hasOwnProperty'](_0x6db7('0x32'))){_0xc3ad87[_0x6db7('0x33')]=qs[_0x6db7('0x33')](_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x33')]);_0xc3ad87[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0xc3ad87['order']=qs['sort'](_0x5ec6da[_0x6db7('0x2c')]['sort']);_0xc3ad87[_0x6db7('0x34')]=qs['filters'](_['pick'](_0x5ec6da['query'],_0x2f7131[_0x6db7('0x35')]),_0x94c124);if(_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x36')]){_0xc3ad87[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0xc3ad87[_0x6db7('0x34')],{'$or':_[_0x6db7('0x27')](_0x94c124,function(_0x39b24d){if(_0x39b24d[_0x6db7('0x38')]!==_0x6db7('0x39')){var _0x395fad={};_0x395fad[_0x39b24d[_0x6db7('0x24')]]={'$like':'%'+_0x5ec6da[_0x6db7('0x2c')][_0x6db7('0x36')]+'%'};return _0x395fad;}})});}_0xc3ad87=_[_0x6db7('0x37')]({},_0xc3ad87,_0x5ec6da[_0x6db7('0x3a')]);var _0x47f637={'where':_0xc3ad87[_0x6db7('0x34')]};return db[_0x6db7('0x28')][_0x6db7('0x1b')](_0x47f637)[_0x6db7('0x1f')](function(_0x3aacba){_0x1f32fb[_0x6db7('0x1b')]=_0x3aacba;if(_0x5ec6da[_0x6db7('0x2c')]['includeAll']){_0xc3ad87[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x28')][_0x6db7('0x3c')](_0xc3ad87);})[_0x6db7('0x1f')](function(_0x2b5874){_0x1f32fb[_0x6db7('0x3d')]=_0x2b5874;return _0x1f32fb;})[_0x6db7('0x1f')](respondWithFilteredResult(_0x4f8309,_0xc3ad87))[_0x6db7('0x3e')](handleError(_0x4f8309,null));};exports[_0x6db7('0x3f')]=function(_0x480a51,_0x4c0a87){var _0x11b4a0={'raw':![],'where':{'id':_0x480a51['params']['id']}},_0x5d6947={};_0x5d6947[_0x6db7('0x2e')]=_[_0x6db7('0x2b')](db[_0x6db7('0x28')]['rawAttributes']);_0x5d6947[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x480a51['query']);_0x5d6947['filters']=_[_0x6db7('0x2d')](_0x5d6947['model'],_0x5d6947[_0x6db7('0x2c')]);_0x11b4a0[_0x6db7('0x2f')]=_['intersection'](_0x5d6947[_0x6db7('0x2e')],qs[_0x6db7('0x30')](_0x480a51['query'][_0x6db7('0x30')]));_0x11b4a0['attributes']=_0x11b4a0[_0x6db7('0x2f')]['length']?_0x11b4a0[_0x6db7('0x2f')]:_0x5d6947['model'];if(_0x480a51[_0x6db7('0x2c')][_0x6db7('0x40')]){_0x11b4a0[_0x6db7('0x3b')]=[{'all':!![]}];}_0x11b4a0=_['merge']({},_0x11b4a0,_0x480a51[_0x6db7('0x3a')]);return db[_0x6db7('0x28')]['find'](_0x11b4a0)['then'](handleEntityNotFound(_0x4c0a87,null))[_0x6db7('0x1f')](respondWithResult(_0x4c0a87,null))['catch'](handleError(_0x4c0a87,null));};exports[_0x6db7('0x41')]=function(_0x388f91,_0x1db6a7){return db[_0x6db7('0x28')][_0x6db7('0x41')](_0x388f91['body'],{})[_0x6db7('0x1f')](function(_0xf2ef69){var _0x120003=_0x388f91[_0x6db7('0x42')]['get']({'plain':!![]});if(!_0x120003)throw new Error(_0x6db7('0x43'));if(_0x120003[_0x6db7('0x44')]===_0x6db7('0x42')){var _0x41aa62=_0xf2ef69[_0x6db7('0x45')]({'plain':!![]});var _0x5a9fc6='Projects';return db['UserProfileSection'][_0x6db7('0x46')]({'where':{'name':_0x5a9fc6,'userProfileId':_0x120003[_0x6db7('0x47')]},'raw':!![]})[_0x6db7('0x1f')](function(_0x3a3d9f){if(_0x3a3d9f&&_0x3a3d9f[_0x6db7('0x48')]===0x0){return db[_0x6db7('0x21')][_0x6db7('0x41')]({'name':_0x41aa62[_0x6db7('0x24')],'resourceId':_0x41aa62['id'],'type':_0x3a3d9f['name'],'sectionId':_0x3a3d9f['id']},{})['then'](function(){return _0xf2ef69;});}else{return _0xf2ef69;}})[_0x6db7('0x3e')](function(_0x2648c9){logger[_0x6db7('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2648c9);throw _0x2648c9;});}return _0xf2ef69;})[_0x6db7('0x1f')](respondWithResult(_0x1db6a7,0xc9))[_0x6db7('0x3e')](handleError(_0x1db6a7,null));};exports['clone']=function(_0x4e11c7,_0x4d493d){var _0x106698={'where':{'id':_0x4e11c7[_0x6db7('0x4a')]['id']}},_0x4de5f8={};_0x4de5f8[_0x6db7('0x2e')]=_[_0x6db7('0x2b')](db[_0x6db7('0x28')]['rawAttributes']);_0x106698['attributes']=_[_0x6db7('0x2d')](_0x4de5f8[_0x6db7('0x2e')],qs['fields'](_0x4e11c7[_0x6db7('0x2c')][_0x6db7('0x30')]));_0x106698[_0x6db7('0x2f')]=_0x106698['attributes'][_0x6db7('0x31')]?_0x106698[_0x6db7('0x2f')]:_0x4de5f8['model'];if(_0x4e11c7[_0x6db7('0x2c')][_0x6db7('0x40')]){_0x106698[_0x6db7('0x3b')]=[{'all':!![]}];}_0x106698=_[_0x6db7('0x37')]({},_0x106698,_0x4e11c7[_0x6db7('0x3a')]);return db['JscriptyProject'][_0x6db7('0x46')](_0x106698)[_0x6db7('0x1f')](handleEntityNotFound(_0x4d493d,null))['then'](function(_0x3645fd){if(_0x3645fd){var _0x3a4dfc=_0x3645fd[_0x6db7('0x45')]({'plain':!![]});_0x3a4dfc=qs[_0x6db7('0x4b')](_0x3a4dfc,['id',_0x6db7('0x4c'),_0x6db7('0x4d')]);_0x4e11c7[_0x6db7('0x4e')]=_['omit'](_0x4e11c7['body'],['id',_0x6db7('0x4c'),_0x6db7('0x4d')]);return db[_0x6db7('0x28')][_0x6db7('0x41')](_[_0x6db7('0x37')](_0x3a4dfc,_0x4e11c7[_0x6db7('0x4e')]),{'include':_0x4e11c7['query'][_0x6db7('0x40')]?[{'all':!![]}]:undefined})[_0x6db7('0x1f')](function(_0xf21710){var _0x2c66ee=_0x4e11c7[_0x6db7('0x42')][_0x6db7('0x45')]({'plain':!![]});if(!_0x2c66ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c66ee['role']===_0x6db7('0x42')){var _0x3fdc25=_0xf21710[_0x6db7('0x45')]({'plain':!![]});var _0x363d05=_0x6db7('0x20');return db['UserProfileSection'][_0x6db7('0x46')]({'where':{'name':_0x363d05,'userProfileId':_0x2c66ee[_0x6db7('0x47')]},'raw':!![]})[_0x6db7('0x1f')](function(_0x183585){if(_0x183585&&_0x183585[_0x6db7('0x48')]===0x0){return db[_0x6db7('0x21')][_0x6db7('0x41')]({'name':_0x3fdc25[_0x6db7('0x24')],'resourceId':_0x3fdc25['id'],'type':_0x183585['name'],'sectionId':_0x183585['id']},{})[_0x6db7('0x1f')](function(){return _0xf21710;});}else{return _0xf21710;}})['catch'](function(_0x5a342e){logger[_0x6db7('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a342e);throw _0x5a342e;});}return _0xf21710;});}})[_0x6db7('0x1f')](respondWithResult(_0x4d493d,0xc9))[_0x6db7('0x3e')](handleError(_0x4d493d,null));};exports[_0x6db7('0x1e')]=function(_0x260693,_0x254ad0){if(_0x260693['body']['id']){delete _0x260693[_0x6db7('0x4e')]['id'];}return db['JscriptyProject'][_0x6db7('0x46')]({'where':{'id':_0x260693['params']['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x254ad0,null))[_0x6db7('0x1f')](saveUpdates(_0x260693['body'],null))[_0x6db7('0x1f')](respondWithResult(_0x254ad0,null))[_0x6db7('0x3e')](handleError(_0x254ad0,null));};exports[_0x6db7('0x22')]=function(_0x3343f5,_0x32eefd){return db[_0x6db7('0x28')][_0x6db7('0x46')]({'where':{'id':_0x3343f5[_0x6db7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32eefd,null))['then'](removeEntity(_0x32eefd,null))['catch'](handleError(_0x32eefd,null));};exports['getSessions']=function(_0x479766,_0x2ca49c,_0x4aa2ab){var _0x5cbf75={'raw':!![],'where':{}};var _0x394a26={};var _0x9a2587={'count':0x0,'rows':[]};return db[_0x6db7('0x28')]['findOne']({'where':{'id':_0x479766['params']['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x2ca49c,null))[_0x6db7('0x1f')](function(_0x6ce78f){if(_0x6ce78f){_0x394a26['model']=_[_0x6db7('0x2b')](db[_0x6db7('0x4f')][_0x6db7('0x50')]);_0x394a26[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x479766[_0x6db7('0x2c')]);_0x394a26[_0x6db7('0x35')]=_[_0x6db7('0x2d')](_0x394a26[_0x6db7('0x2e')],_0x394a26[_0x6db7('0x2c')]);_0x5cbf75[_0x6db7('0x2f')]=_['intersection'](_0x394a26[_0x6db7('0x2e')],qs['fields'](_0x479766[_0x6db7('0x2c')][_0x6db7('0x30')]));_0x5cbf75[_0x6db7('0x2f')]=_0x5cbf75[_0x6db7('0x2f')][_0x6db7('0x31')]?_0x5cbf75[_0x6db7('0x2f')]:_0x394a26[_0x6db7('0x2e')];if(!_0x479766[_0x6db7('0x2c')]['hasOwnProperty']('nolimit')){_0x5cbf75['limit']=qs[_0x6db7('0x33')](_0x479766[_0x6db7('0x2c')][_0x6db7('0x33')]);_0x5cbf75[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x479766[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0x5cbf75[_0x6db7('0x51')]=qs['sort'](_0x479766['query'][_0x6db7('0x52')]);_0x5cbf75['where']=qs[_0x6db7('0x35')](_[_0x6db7('0x53')](_0x479766[_0x6db7('0x2c')],_0x394a26[_0x6db7('0x35')]));_0x5cbf75[_0x6db7('0x34')][_0x6db7('0x54')]=_0x6ce78f['id'];if(_0x479766[_0x6db7('0x2c')]['filter']){_0x5cbf75[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0x5cbf75['where'],{'$or':_[_0x6db7('0x27')](_0x5cbf75[_0x6db7('0x2f')],function(_0x1c3233){var _0x1b3bfa={};_0x1b3bfa[_0x1c3233]={'$like':'%'+_0x479766[_0x6db7('0x2c')]['filter']+'%'};return _0x1b3bfa;})});}_0x5cbf75=_[_0x6db7('0x37')]({},_0x5cbf75,_0x479766[_0x6db7('0x3a')]);return db[_0x6db7('0x4f')][_0x6db7('0x1b')]({'where':_0x5cbf75[_0x6db7('0x34')]})[_0x6db7('0x1f')](function(_0x2bda1d){_0x9a2587['count']=_0x2bda1d;if(_0x479766['query'][_0x6db7('0x40')]){_0x5cbf75[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x4f')][_0x6db7('0x3c')](_0x5cbf75);})[_0x6db7('0x1f')](function(_0x41f55d){_0x9a2587[_0x6db7('0x3d')]=_0x41f55d;return _0x9a2587;});}})[_0x6db7('0x1f')](respondWithFilteredResult(_0x2ca49c,_0x5cbf75))[_0x6db7('0x3e')](handleError(_0x2ca49c,null));};exports['getAnswers']=function(_0x3d86aa,_0x99d6eb,_0x450335){var _0x1e95ff={'raw':!![],'where':{}};var _0x3d0ec4={};var _0x186ceb={'count':0x0,'rows':[]};return db[_0x6db7('0x28')][_0x6db7('0x55')]({'where':{'id':_0x3d86aa[_0x6db7('0x4a')]['id']}})[_0x6db7('0x1f')](handleEntityNotFound(_0x99d6eb,null))[_0x6db7('0x1f')](function(_0x521533){if(_0x521533){_0x3d0ec4[_0x6db7('0x2e')]=_['keys'](db[_0x6db7('0x56')][_0x6db7('0x50')]);_0x3d0ec4[_0x6db7('0x2c')]=_[_0x6db7('0x2b')](_0x3d86aa[_0x6db7('0x2c')]);_0x3d0ec4[_0x6db7('0x35')]=_['intersection'](_0x3d0ec4[_0x6db7('0x2e')],_0x3d0ec4[_0x6db7('0x2c')]);_0x1e95ff[_0x6db7('0x2f')]=_[_0x6db7('0x2d')](_0x3d0ec4[_0x6db7('0x2e')],qs[_0x6db7('0x30')](_0x3d86aa['query'][_0x6db7('0x30')]));_0x1e95ff[_0x6db7('0x2f')]=_0x1e95ff[_0x6db7('0x2f')][_0x6db7('0x31')]?_0x1e95ff[_0x6db7('0x2f')]:_0x3d0ec4[_0x6db7('0x2e')];if(!_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x57')](_0x6db7('0x32'))){_0x1e95ff[_0x6db7('0x33')]=qs[_0x6db7('0x33')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x33')]);_0x1e95ff[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x1c')]);}_0x1e95ff[_0x6db7('0x51')]=qs[_0x6db7('0x52')](_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x52')]);_0x1e95ff[_0x6db7('0x34')]=qs[_0x6db7('0x35')](_[_0x6db7('0x53')](_0x3d86aa[_0x6db7('0x2c')],_0x3d0ec4[_0x6db7('0x35')]));_0x1e95ff[_0x6db7('0x34')]['ProjectId']=_0x521533['id'];if(_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x36')]){_0x1e95ff[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0x1e95ff['where'],{'$or':_['map'](_0x1e95ff['attributes'],function(_0x27a56c){var _0x598295={};_0x598295[_0x27a56c]={'$like':'%'+_0x3d86aa[_0x6db7('0x2c')][_0x6db7('0x36')]+'%'};return _0x598295;})});}_0x1e95ff=_[_0x6db7('0x37')]({},_0x1e95ff,_0x3d86aa[_0x6db7('0x3a')]);return db[_0x6db7('0x56')][_0x6db7('0x1b')]({'where':_0x1e95ff[_0x6db7('0x34')]})[_0x6db7('0x1f')](function(_0x493783){_0x186ceb[_0x6db7('0x1b')]=_0x493783;if(_0x3d86aa[_0x6db7('0x2c')]['includeAll']){_0x1e95ff[_0x6db7('0x3b')]=[{'all':!![]}];}return db[_0x6db7('0x56')][_0x6db7('0x3c')](_0x1e95ff);})[_0x6db7('0x1f')](function(_0x478b29){_0x186ceb[_0x6db7('0x3d')]=_0x478b29;return _0x186ceb;});}})[_0x6db7('0x1f')](respondWithFilteredResult(_0x99d6eb,_0x1e95ff))['catch'](handleError(_0x99d6eb,null));};function char(_0x2e74cd){return'number'===typeof _0x2e74cd?String[_0x6db7('0x58')]['apply'](null,arguments):_0x2e74cd;}function needsEncapsulation(_0x4c3a52){return!!_0x4c3a52&&(_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0xd))>=0x0||_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0xa))>=0x0||_0x4c3a52[_0x6db7('0x59')]()[_0x6db7('0x5a')](char(0x2c))>=0x0||_0x4c3a52[_0x6db7('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x43c06a){var _0x49374a=char(0x22),_0x3ce5e8='\x5c'+char(0x22),_0x2d4b55=_0x43c06a['toString']()['replace'](new RegExp(_0x49374a,'g'),_0x3ce5e8);return _0x49374a+_0x2d4b55+_0x49374a;}exports['getSummary']=function(_0x1f9fb1,_0x209de6,_0x1b8592){var _0x3f0629,_0x38a98e;var _0x194793={'where':{'ProjectId':_0x1f9fb1['params']['id']}};if(_0x1f9fb1[_0x6db7('0x2c')][_0x6db7('0x5b')]){_0x194793[_0x6db7('0x34')][_0x6db7('0x5c')]=JSON[_0x6db7('0x5d')](_0x1f9fb1[_0x6db7('0x2c')][_0x6db7('0x5b')]);}return db[_0x6db7('0x4f')][_0x6db7('0x3c')](_0x194793)['then'](handleEntityNotFound(_0x209de6,null))['then'](function(_0x4a0682){if(_0x4a0682){_0x3f0629=_0x4a0682;return db['JscriptyQuestionReport'][_0x6db7('0x3c')]({'where':{'SessionId':{'$in':_[_0x6db7('0x27')](_0x3f0629,'id')},'ProjectId':_0x1f9fb1[_0x6db7('0x4a')]['id']},'order':_0x6db7('0x5e')});}})['then'](handleEntityNotFound(_0x209de6,null))[_0x6db7('0x1f')](function(_0xd177d4){if(_0xd177d4){_0x38a98e=_0xd177d4;var _0x5e6ba0={};for(var _0x4c2d11=0x0,_0x391319=_0x38a98e[_0x6db7('0x31')];_0x4c2d11<_0x391319;_0x4c2d11++){if(!_0x5e6ba0['hasOwnProperty'](_0x38a98e[_0x4c2d11]['questionId'])){_0x5e6ba0[_0x38a98e[_0x4c2d11][_0x6db7('0x5f')]]=needsEncapsulation(_0x38a98e[_0x4c2d11][_0x6db7('0x60')])?encapsulate(_0x38a98e[_0x4c2d11][_0x6db7('0x60')]):_0x38a98e[_0x4c2d11]['question'];}}var _0x30cf97=[],_0x33c438={};for(var _0x263bd0=0x0,_0x37cdf1=_0x3f0629[_0x6db7('0x31')];_0x263bd0<_0x37cdf1;_0x263bd0++){_0x33c438={'ProjectId':_0x1f9fb1['params']['id'],'SessionId':_0x3f0629[_0x263bd0]['id'],'StartTime':moment(_0x3f0629[_0x263bd0][_0x6db7('0x5c')])[_0x6db7('0x61')](_0x6db7('0x62'))};for(var _0x368802=0x0,_0x291ca0=_0x38a98e['length'];_0x368802<_0x291ca0;_0x368802++){if(_0x38a98e[_0x368802]['SessionId']==_0x3f0629[_0x263bd0]['id']&&_0x5e6ba0[_0x6db7('0x57')](_0x38a98e[_0x368802][_0x6db7('0x5f')])){_0x33c438[_0x5e6ba0[_0x38a98e[_0x368802][_0x6db7('0x5f')]]]=_0x38a98e[_0x368802][_0x6db7('0x63')];}}for(var _0x3aa9a5 in _0x5e6ba0){if(!_0x33c438[_0x6db7('0x57')](_0x5e6ba0[_0x3aa9a5])){_0x33c438[_0x5e6ba0[_0x3aa9a5]]=null;}}_0x30cf97['push'](_0x33c438);}return _0x30cf97;}})['then'](function(_0xdd7150){if(!_[_0x6db7('0x64')](_0xdd7150)){var _0x281054=toCsv(_0xdd7150);var _0x4e9bae=Date[_0x6db7('0x65')]();fs[_0x6db7('0x66')](util[_0x6db7('0x61')](_0x6db7('0x67'),_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae),_0x281054);_0x209de6[_0x6db7('0x68')]('Content-disposition','attachment;\x20filename='+util['format'](_0x6db7('0x69'),_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae));_0x209de6['setHeader'](_0x6db7('0x6a'),_0x6db7('0x6b'));return _0x209de6[_0x6db7('0x6c')](util[_0x6db7('0x61')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f9fb1[_0x6db7('0x4a')]['id'],_0x4e9bae));}else{return _0x209de6[_0x6db7('0x6d')](0xcc);}})[_0x6db7('0x3e')](handleError(_0x209de6,null));}; \ No newline at end of file +var _0x7425=['keys','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','createdAt','role','UserProfileSection','autoAssociation','UserProfileResource','destroy','getSessions','findOne','JscriptySessionReport','getAnswers','pick','JscriptyAnswerReport','findAll','number','fromCharCode','apply','indexOf','toString','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','reject','then','Projects','error','name','index','JscriptyProject','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','show','params'];(function(_0xb2cce7,_0x15a327){var _0x4d396a=function(_0x42e3f1){while(--_0x42e3f1){_0xb2cce7['push'](_0xb2cce7['shift']());}};_0x4d396a(++_0x15a327);}(_0x7425,0x10b));var _0x5742=function(_0x4df74a,_0x5cd66e){_0x4df74a=_0x4df74a-0x0;var _0x30909b=_0x7425[_0x4df74a];return _0x30909b;};'use strict';var pdf=require(_0x5742('0x0'));var emlformat=require(_0x5742('0x1'));var rimraf=require(_0x5742('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5742('0x3'));var rp=require(_0x5742('0x4'));var moment=require('moment');var BPromise=require(_0x5742('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5742('0x6'));var sox=require(_0x5742('0x7'));var csv=require(_0x5742('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5742('0x9'));var squel=require(_0x5742('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5742('0xb'));var toCsv=require(_0x5742('0x8'));var querystring=require(_0x5742('0xc'));var Papa=require(_0x5742('0xd'));var Redis=require(_0x5742('0xe'));var authService=require(_0x5742('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5742('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5742('0x11'));var utils=require(_0x5742('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5742('0x13'))['db'];function respondWithStatusCode(_0x1902b4,_0x41f5ae){_0x41f5ae=_0x41f5ae||0xcc;return function(_0x3b8659){if(_0x3b8659){return _0x1902b4[_0x5742('0x14')](_0x41f5ae);}return _0x1902b4['status'](_0x41f5ae)[_0x5742('0x15')]();};}function respondWithResult(_0x58fb3f,_0x4fb2b9){_0x4fb2b9=_0x4fb2b9||0xc8;return function(_0x470f7b){if(_0x470f7b){return _0x58fb3f[_0x5742('0x16')](_0x4fb2b9)['json'](_0x470f7b);}};}function respondWithFilteredResult(_0x364961,_0x45c91a){return function(_0x4169a8){if(_0x4169a8){var _0x324c65=_0x4169a8[_0x5742('0x17')],_0x47fec2=_0x45c91a[_0x5742('0x18')],_0x4ae50b=_0x45c91a[_0x5742('0x18')]+_0x45c91a[_0x5742('0x19')],_0x35d084;if(_0x4ae50b>=_0x324c65){_0x4ae50b=_0x324c65;_0x35d084=0xc8;}else{_0x35d084=0xce;}_0x364961[_0x5742('0x16')](_0x35d084);return _0x364961[_0x5742('0x1a')](_0x5742('0x1b'),_0x47fec2+'-'+_0x4ae50b+'/'+_0x324c65)['json'](_0x4169a8);}return null;};}function patchUpdates(_0x1e9386){return function(_0xe5ba1b){try{jsonpatch['apply'](_0xe5ba1b,_0x1e9386,!![]);}catch(_0x6da2f6){return BPromise[_0x5742('0x1c')](_0x6da2f6);}return _0xe5ba1b['save']();};}function saveUpdates(_0x3d8f04,_0xd59498){return function(_0x2f6021){if(_0x2f6021){return _0x2f6021['update'](_0x3d8f04)[_0x5742('0x1d')](function(_0x1ba65d){return _0x1ba65d;});}return null;};}function removeEntity(_0xc2eb45,_0x426016){return function(_0x12987a){if(_0x12987a){return _0x12987a['destroy']()[_0x5742('0x1d')](function(){var _0xb14e5b=_0x12987a['get']({'plain':!![]});var _0x30f0dc=_0x5742('0x1e');return db['UserProfileResource']['destroy']({'where':{'type':_0x30f0dc,'resourceId':_0xb14e5b['id']}})['then'](function(){return _0x12987a;});})['then'](function(){_0xc2eb45['status'](0xcc)[_0x5742('0x15')]();});}};}function handleEntityNotFound(_0x1a77c3,_0x45624f){return function(_0x2706db){if(!_0x2706db){_0x1a77c3[_0x5742('0x14')](0x194);}return _0x2706db;};}function handleError(_0x6166f0,_0x28a693){_0x28a693=_0x28a693||0x1f4;return function(_0x2f4242){logger[_0x5742('0x1f')](_0x2f4242['stack']);if(_0x2f4242[_0x5742('0x20')]){delete _0x2f4242[_0x5742('0x20')];}_0x6166f0[_0x5742('0x16')](_0x28a693)['send'](_0x2f4242);};}exports[_0x5742('0x21')]=function(_0x345128,_0x515c56){var _0x1f0628={},_0x3eff6e={},_0x253c06={'count':0x0,'rows':[]};var _0x5a591a=_['map'](db[_0x5742('0x22')][_0x5742('0x23')],function(_0x22f8c1){return{'name':_0x22f8c1[_0x5742('0x24')],'type':_0x22f8c1['type'][_0x5742('0x25')]};});_0x3eff6e[_0x5742('0x26')]=_[_0x5742('0x27')](_0x5a591a,_0x5742('0x20'));_0x3eff6e[_0x5742('0x28')]=_['keys'](_0x345128['query']);_0x3eff6e[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x3eff6e[_0x5742('0x26')],_0x3eff6e[_0x5742('0x28')]);_0x1f0628[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x3eff6e['model'],qs[_0x5742('0x2c')](_0x345128[_0x5742('0x28')][_0x5742('0x2c')]));_0x1f0628[_0x5742('0x2b')]=_0x1f0628[_0x5742('0x2b')]['length']?_0x1f0628[_0x5742('0x2b')]:_0x3eff6e[_0x5742('0x26')];if(!_0x345128[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x1f0628[_0x5742('0x19')]=qs[_0x5742('0x19')](_0x345128[_0x5742('0x28')][_0x5742('0x19')]);_0x1f0628['offset']=qs['offset'](_0x345128[_0x5742('0x28')]['offset']);}_0x1f0628[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0x345128[_0x5742('0x28')]['sort']);_0x1f0628[_0x5742('0x31')]=qs[_0x5742('0x29')](_['pick'](_0x345128[_0x5742('0x28')],_0x3eff6e[_0x5742('0x29')]),_0x5a591a);if(_0x345128[_0x5742('0x28')][_0x5742('0x32')]){_0x1f0628[_0x5742('0x31')]=_['merge'](_0x1f0628[_0x5742('0x31')],{'$or':_['map'](_0x5a591a,function(_0x590aeb){if(_0x590aeb['type']!=='VIRTUAL'){var _0x5ac1f0={};_0x5ac1f0[_0x590aeb[_0x5742('0x20')]]={'$like':'%'+_0x345128[_0x5742('0x28')][_0x5742('0x32')]+'%'};return _0x5ac1f0;}})});}_0x1f0628=_[_0x5742('0x33')]({},_0x1f0628,_0x345128[_0x5742('0x34')]);var _0x497779={'where':_0x1f0628[_0x5742('0x31')]};return db[_0x5742('0x22')][_0x5742('0x17')](_0x497779)[_0x5742('0x1d')](function(_0xd23b73){_0x253c06['count']=_0xd23b73;if(_0x345128[_0x5742('0x28')][_0x5742('0x35')]){_0x1f0628['include']=[{'all':!![]}];}return db[_0x5742('0x22')]['findAll'](_0x1f0628);})[_0x5742('0x1d')](function(_0x580eb3){_0x253c06[_0x5742('0x36')]=_0x580eb3;return _0x253c06;})['then'](respondWithFilteredResult(_0x515c56,_0x1f0628))['catch'](handleError(_0x515c56,null));};exports[_0x5742('0x37')]=function(_0x232b72,_0x150a43){var _0xaa3316={'raw':![],'where':{'id':_0x232b72[_0x5742('0x38')]['id']}},_0x17872b={};_0x17872b[_0x5742('0x26')]=_[_0x5742('0x39')](db[_0x5742('0x22')]['rawAttributes']);_0x17872b[_0x5742('0x28')]=_['keys'](_0x232b72[_0x5742('0x28')]);_0x17872b[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x17872b['model'],_0x17872b[_0x5742('0x28')]);_0xaa3316['attributes']=_[_0x5742('0x2a')](_0x17872b[_0x5742('0x26')],qs[_0x5742('0x2c')](_0x232b72['query']['fields']));_0xaa3316[_0x5742('0x2b')]=_0xaa3316['attributes']['length']?_0xaa3316[_0x5742('0x2b')]:_0x17872b[_0x5742('0x26')];if(_0x232b72[_0x5742('0x28')][_0x5742('0x35')]){_0xaa3316[_0x5742('0x3a')]=[{'all':!![]}];}_0xaa3316=_['merge']({},_0xaa3316,_0x232b72[_0x5742('0x34')]);return db[_0x5742('0x22')][_0x5742('0x3b')](_0xaa3316)[_0x5742('0x1d')](handleEntityNotFound(_0x150a43,null))[_0x5742('0x1d')](respondWithResult(_0x150a43,null))[_0x5742('0x3c')](handleError(_0x150a43,null));};exports[_0x5742('0x3d')]=function(_0x3802c6,_0x557bc9){return db[_0x5742('0x22')][_0x5742('0x3d')](_0x3802c6[_0x5742('0x3e')],{})[_0x5742('0x1d')](function(_0x4f36cf){var _0x501102=_0x3802c6['user'][_0x5742('0x3f')]({'plain':!![]});if(!_0x501102)throw new Error(_0x5742('0x40'));if(_0x501102['role']===_0x5742('0x41')){var _0x2a2274=_0x4f36cf['get']({'plain':!![]});var _0x40319c=_0x5742('0x1e');return db['UserProfileSection'][_0x5742('0x3b')]({'where':{'name':_0x40319c,'userProfileId':_0x501102['userProfileId']},'raw':!![]})[_0x5742('0x1d')](function(_0x2ea989){if(_0x2ea989&&_0x2ea989['autoAssociation']===0x0){return db['UserProfileResource'][_0x5742('0x3d')]({'name':_0x2a2274['name'],'resourceId':_0x2a2274['id'],'type':_0x2ea989[_0x5742('0x20')],'sectionId':_0x2ea989['id']},{})[_0x5742('0x1d')](function(){return _0x4f36cf;});}else{return _0x4f36cf;}})[_0x5742('0x3c')](function(_0x2e6f6d){logger['error'](_0x5742('0x42'),_0x2e6f6d);throw _0x2e6f6d;});}return _0x4f36cf;})[_0x5742('0x1d')](respondWithResult(_0x557bc9,0xc9))[_0x5742('0x3c')](handleError(_0x557bc9,null));};exports[_0x5742('0x43')]=function(_0x3e44e5,_0x53562a){var _0x473680={'where':{'id':_0x3e44e5[_0x5742('0x38')]['id']}},_0x1f9102={};_0x1f9102['model']=_[_0x5742('0x39')](db['JscriptyProject'][_0x5742('0x23')]);_0x473680[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x1f9102[_0x5742('0x26')],qs['fields'](_0x3e44e5[_0x5742('0x28')]['fields']));_0x473680[_0x5742('0x2b')]=_0x473680['attributes'][_0x5742('0x44')]?_0x473680[_0x5742('0x2b')]:_0x1f9102[_0x5742('0x26')];if(_0x3e44e5[_0x5742('0x28')][_0x5742('0x35')]){_0x473680[_0x5742('0x3a')]=[{'all':!![]}];}_0x473680=_[_0x5742('0x33')]({},_0x473680,_0x3e44e5[_0x5742('0x34')]);return db[_0x5742('0x22')][_0x5742('0x3b')](_0x473680)[_0x5742('0x1d')](handleEntityNotFound(_0x53562a,null))[_0x5742('0x1d')](function(_0x46809c){if(_0x46809c){var _0xa749a2=_0x46809c[_0x5742('0x3f')]({'plain':!![]});_0xa749a2=qs[_0x5742('0x45')](_0xa749a2,['id','createdAt',_0x5742('0x46')]);_0x3e44e5['body']=_[_0x5742('0x45')](_0x3e44e5[_0x5742('0x3e')],['id',_0x5742('0x47'),'updatedAt']);return db['JscriptyProject'][_0x5742('0x3d')](_['merge'](_0xa749a2,_0x3e44e5[_0x5742('0x3e')]),{'include':_0x3e44e5[_0x5742('0x28')][_0x5742('0x35')]?[{'all':!![]}]:undefined})[_0x5742('0x1d')](function(_0x5be315){var _0x2cf7ec=_0x3e44e5[_0x5742('0x41')][_0x5742('0x3f')]({'plain':!![]});if(!_0x2cf7ec)throw new Error(_0x5742('0x40'));if(_0x2cf7ec[_0x5742('0x48')]===_0x5742('0x41')){var _0x5493db=_0x5be315[_0x5742('0x3f')]({'plain':!![]});var _0x16f078=_0x5742('0x1e');return db[_0x5742('0x49')][_0x5742('0x3b')]({'where':{'name':_0x16f078,'userProfileId':_0x2cf7ec['userProfileId']},'raw':!![]})[_0x5742('0x1d')](function(_0x1a956f){if(_0x1a956f&&_0x1a956f[_0x5742('0x4a')]===0x0){return db[_0x5742('0x4b')][_0x5742('0x3d')]({'name':_0x5493db['name'],'resourceId':_0x5493db['id'],'type':_0x1a956f['name'],'sectionId':_0x1a956f['id']},{})[_0x5742('0x1d')](function(){return _0x5be315;});}else{return _0x5be315;}})[_0x5742('0x3c')](function(_0xad54b){logger[_0x5742('0x1f')](_0x5742('0x42'),_0xad54b);throw _0xad54b;});}return _0x5be315;});}})[_0x5742('0x1d')](respondWithResult(_0x53562a,0xc9))[_0x5742('0x3c')](handleError(_0x53562a,null));};exports['update']=function(_0x1d1032,_0x340e40){if(_0x1d1032[_0x5742('0x3e')]['id']){delete _0x1d1032[_0x5742('0x3e')]['id'];}return db['JscriptyProject'][_0x5742('0x3b')]({'where':{'id':_0x1d1032['params']['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x340e40,null))[_0x5742('0x1d')](saveUpdates(_0x1d1032['body'],null))['then'](respondWithResult(_0x340e40,null))[_0x5742('0x3c')](handleError(_0x340e40,null));};exports[_0x5742('0x4c')]=function(_0x3d4692,_0x39cc4a){return db[_0x5742('0x22')]['find']({'where':{'id':_0x3d4692['params']['id']}})['then'](handleEntityNotFound(_0x39cc4a,null))[_0x5742('0x1d')](removeEntity(_0x39cc4a,null))['catch'](handleError(_0x39cc4a,null));};exports[_0x5742('0x4d')]=function(_0x421550,_0x1fe9bb,_0x4fb2e8){var _0x4e02de={'raw':!![],'where':{}};var _0x2acd9e={};var _0x4f93b7={'count':0x0,'rows':[]};return db[_0x5742('0x22')][_0x5742('0x4e')]({'where':{'id':_0x421550[_0x5742('0x38')]['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x1fe9bb,null))[_0x5742('0x1d')](function(_0xd7e7f1){if(_0xd7e7f1){_0x2acd9e['model']=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x2acd9e[_0x5742('0x28')]=_[_0x5742('0x39')](_0x421550[_0x5742('0x28')]);_0x2acd9e[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x2acd9e[_0x5742('0x26')],_0x2acd9e[_0x5742('0x28')]);_0x4e02de[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x2acd9e['model'],qs[_0x5742('0x2c')](_0x421550[_0x5742('0x28')][_0x5742('0x2c')]));_0x4e02de[_0x5742('0x2b')]=_0x4e02de[_0x5742('0x2b')][_0x5742('0x44')]?_0x4e02de[_0x5742('0x2b')]:_0x2acd9e[_0x5742('0x26')];if(!_0x421550[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x4e02de[_0x5742('0x19')]=qs[_0x5742('0x19')](_0x421550[_0x5742('0x28')][_0x5742('0x19')]);_0x4e02de['offset']=qs[_0x5742('0x18')](_0x421550[_0x5742('0x28')][_0x5742('0x18')]);}_0x4e02de[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0x421550[_0x5742('0x28')][_0x5742('0x30')]);_0x4e02de[_0x5742('0x31')]=qs[_0x5742('0x29')](_['pick'](_0x421550[_0x5742('0x28')],_0x2acd9e['filters']));_0x4e02de[_0x5742('0x31')]['ProjectId']=_0xd7e7f1['id'];if(_0x421550['query'][_0x5742('0x32')]){_0x4e02de[_0x5742('0x31')]=_[_0x5742('0x33')](_0x4e02de[_0x5742('0x31')],{'$or':_[_0x5742('0x27')](_0x4e02de[_0x5742('0x2b')],function(_0x51f578){var _0x5afba5={};_0x5afba5[_0x51f578]={'$like':'%'+_0x421550[_0x5742('0x28')][_0x5742('0x32')]+'%'};return _0x5afba5;})});}_0x4e02de=_[_0x5742('0x33')]({},_0x4e02de,_0x421550['options']);return db[_0x5742('0x4f')][_0x5742('0x17')]({'where':_0x4e02de['where']})[_0x5742('0x1d')](function(_0x487763){_0x4f93b7['count']=_0x487763;if(_0x421550[_0x5742('0x28')][_0x5742('0x35')]){_0x4e02de[_0x5742('0x3a')]=[{'all':!![]}];}return db[_0x5742('0x4f')]['findAll'](_0x4e02de);})[_0x5742('0x1d')](function(_0x4d4d87){_0x4f93b7[_0x5742('0x36')]=_0x4d4d87;return _0x4f93b7;});}})['then'](respondWithFilteredResult(_0x1fe9bb,_0x4e02de))[_0x5742('0x3c')](handleError(_0x1fe9bb,null));};exports[_0x5742('0x50')]=function(_0xd034a4,_0x55e57c,_0xddd8f1){var _0x4b6eb2={'raw':!![],'where':{}};var _0x5d8407={};var _0x430956={'count':0x0,'rows':[]};return db[_0x5742('0x22')][_0x5742('0x4e')]({'where':{'id':_0xd034a4[_0x5742('0x38')]['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x55e57c,null))[_0x5742('0x1d')](function(_0x3f0c11){if(_0x3f0c11){_0x5d8407['model']=_[_0x5742('0x39')](db['JscriptyAnswerReport'][_0x5742('0x23')]);_0x5d8407[_0x5742('0x28')]=_[_0x5742('0x39')](_0xd034a4[_0x5742('0x28')]);_0x5d8407[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x5d8407[_0x5742('0x26')],_0x5d8407[_0x5742('0x28')]);_0x4b6eb2['attributes']=_['intersection'](_0x5d8407[_0x5742('0x26')],qs[_0x5742('0x2c')](_0xd034a4[_0x5742('0x28')][_0x5742('0x2c')]));_0x4b6eb2[_0x5742('0x2b')]=_0x4b6eb2[_0x5742('0x2b')][_0x5742('0x44')]?_0x4b6eb2[_0x5742('0x2b')]:_0x5d8407['model'];if(!_0xd034a4[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x4b6eb2[_0x5742('0x19')]=qs[_0x5742('0x19')](_0xd034a4[_0x5742('0x28')][_0x5742('0x19')]);_0x4b6eb2['offset']=qs['offset'](_0xd034a4[_0x5742('0x28')][_0x5742('0x18')]);}_0x4b6eb2[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0xd034a4[_0x5742('0x28')][_0x5742('0x30')]);_0x4b6eb2[_0x5742('0x31')]=qs[_0x5742('0x29')](_[_0x5742('0x51')](_0xd034a4[_0x5742('0x28')],_0x5d8407['filters']));_0x4b6eb2[_0x5742('0x31')]['ProjectId']=_0x3f0c11['id'];if(_0xd034a4[_0x5742('0x28')][_0x5742('0x32')]){_0x4b6eb2['where']=_['merge'](_0x4b6eb2[_0x5742('0x31')],{'$or':_[_0x5742('0x27')](_0x4b6eb2[_0x5742('0x2b')],function(_0x4b06af){var _0x27cc5d={};_0x27cc5d[_0x4b06af]={'$like':'%'+_0xd034a4[_0x5742('0x28')]['filter']+'%'};return _0x27cc5d;})});}_0x4b6eb2=_[_0x5742('0x33')]({},_0x4b6eb2,_0xd034a4['options']);return db[_0x5742('0x52')][_0x5742('0x17')]({'where':_0x4b6eb2[_0x5742('0x31')]})[_0x5742('0x1d')](function(_0x206c12){_0x430956[_0x5742('0x17')]=_0x206c12;if(_0xd034a4[_0x5742('0x28')][_0x5742('0x35')]){_0x4b6eb2[_0x5742('0x3a')]=[{'all':!![]}];}return db[_0x5742('0x52')][_0x5742('0x53')](_0x4b6eb2);})[_0x5742('0x1d')](function(_0x36e072){_0x430956[_0x5742('0x36')]=_0x36e072;return _0x430956;});}})[_0x5742('0x1d')](respondWithFilteredResult(_0x55e57c,_0x4b6eb2))[_0x5742('0x3c')](handleError(_0x55e57c,null));};function char(_0x510504){return _0x5742('0x54')===typeof _0x510504?String[_0x5742('0x55')][_0x5742('0x56')](null,arguments):_0x510504;}function needsEncapsulation(_0x2ca362){return!!_0x2ca362&&(_0x2ca362['toString']()['indexOf'](char(0xd))>=0x0||_0x2ca362['toString']()[_0x5742('0x57')](char(0xa))>=0x0||_0x2ca362[_0x5742('0x58')]()[_0x5742('0x57')](char(0x2c))>=0x0||_0x2ca362[_0x5742('0x58')]()[_0x5742('0x57')](char(0x22))>=0x0);}function encapsulate(_0x10ba4d){var _0xce20b3=char(0x22),_0x3f58a0='\x5c'+char(0x22),_0x440939=_0x10ba4d[_0x5742('0x58')]()['replace'](new RegExp(_0xce20b3,'g'),_0x3f58a0);return _0xce20b3+_0x440939+_0xce20b3;}exports[_0x5742('0x59')]=function(_0x4a3b3a,_0x3a5f1d,_0x3ba2d0){var _0x1cdfe9,_0x46af58;var _0xe2cd5f={'where':{'ProjectId':_0x4a3b3a['params']['id']}};if(_0x4a3b3a[_0x5742('0x28')]['startTime']){_0xe2cd5f[_0x5742('0x31')][_0x5742('0x5a')]=JSON[_0x5742('0x5b')](_0x4a3b3a[_0x5742('0x28')]['startTime']);}return db[_0x5742('0x4f')][_0x5742('0x53')](_0xe2cd5f)[_0x5742('0x1d')](handleEntityNotFound(_0x3a5f1d,null))[_0x5742('0x1d')](function(_0x3c9690){if(_0x3c9690){_0x1cdfe9=_0x3c9690;return db[_0x5742('0x5c')][_0x5742('0x53')]({'where':{'SessionId':{'$in':_['map'](_0x1cdfe9,'id')},'ProjectId':_0x4a3b3a[_0x5742('0x38')]['id']},'order':_0x5742('0x5d')});}})[_0x5742('0x1d')](handleEntityNotFound(_0x3a5f1d,null))[_0x5742('0x1d')](function(_0x2ed6be){if(_0x2ed6be){_0x46af58=_0x2ed6be;var _0x22f928={};for(var _0x1e6724=0x0,_0x489456=_0x46af58[_0x5742('0x44')];_0x1e6724<_0x489456;_0x1e6724++){if(!_0x22f928[_0x5742('0x2d')](_0x46af58[_0x1e6724][_0x5742('0x5e')])){_0x22f928[_0x46af58[_0x1e6724]['questionId']]=needsEncapsulation(_0x46af58[_0x1e6724][_0x5742('0x5f')])?encapsulate(_0x46af58[_0x1e6724][_0x5742('0x5f')]):_0x46af58[_0x1e6724]['question'];}}var _0x2b4979=[],_0x577cda={};for(var _0xf4eedb=0x0,_0x38af80=_0x1cdfe9[_0x5742('0x44')];_0xf4eedb<_0x38af80;_0xf4eedb++){_0x577cda={'ProjectId':_0x4a3b3a[_0x5742('0x38')]['id'],'SessionId':_0x1cdfe9[_0xf4eedb]['id'],'StartTime':moment(_0x1cdfe9[_0xf4eedb][_0x5742('0x5a')])[_0x5742('0x60')](_0x5742('0x61'))};for(var _0x3ae190=0x0,_0x47366e=_0x46af58[_0x5742('0x44')];_0x3ae190<_0x47366e;_0x3ae190++){if(_0x46af58[_0x3ae190][_0x5742('0x62')]==_0x1cdfe9[_0xf4eedb]['id']&&_0x22f928[_0x5742('0x2d')](_0x46af58[_0x3ae190]['questionId'])){_0x577cda[_0x22f928[_0x46af58[_0x3ae190]['questionId']]]=_0x46af58[_0x3ae190][_0x5742('0x63')];}}for(var _0x2f95de in _0x22f928){if(!_0x577cda[_0x5742('0x2d')](_0x22f928[_0x2f95de])){_0x577cda[_0x22f928[_0x2f95de]]=null;}}_0x2b4979[_0x5742('0x64')](_0x577cda);}return _0x2b4979;}})['then'](function(_0x459893){if(!_[_0x5742('0x65')](_0x459893)){var _0x1ee878=toCsv(_0x459893);var _0x78678e=Date[_0x5742('0x66')]();fs[_0x5742('0x67')](util[_0x5742('0x60')](_0x5742('0x68'),_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e),_0x1ee878);_0x3a5f1d[_0x5742('0x69')](_0x5742('0x6a'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e));_0x3a5f1d[_0x5742('0x69')]('Content-type',_0x5742('0x6b'));return _0x3a5f1d['download'](util[_0x5742('0x60')](_0x5742('0x68'),_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e));}else{return _0x3a5f1d['sendStatus'](0xcc);}})[_0x5742('0x3c')](handleError(_0x3a5f1d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0fa1e0d..e8dfdfc 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 _0x494a=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','lodash','util','../../config/logger','api'];(function(_0x5dc854,_0x31f860){var _0x2e7283=function(_0x590e08){while(--_0x590e08){_0x5dc854['push'](_0x5dc854['shift']());}};_0x2e7283(++_0x31f860);}(_0x494a,0x11c));var _0xa494=function(_0x10165c,_0x5ad2b4){_0x10165c=_0x10165c-0x0;var _0x454073=_0x494a[_0x10165c];return _0x454073;};'use strict';var _=require(_0xa494('0x0'));var util=require(_0xa494('0x1'));var logger=require(_0xa494('0x2'))(_0xa494('0x3'));var moment=require(_0xa494('0x4'));var BPromise=require(_0xa494('0x5'));var rp=require(_0xa494('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa494('0x7'));var config=require(_0xa494('0x8'));var attributes=require(_0xa494('0x9'));module['exports']=function(_0x266133,_0x1a912e){return _0x266133[_0xa494('0xa')](_0xa494('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96b0=['../../config/logger','api','moment','bluebird','path','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects'];(function(_0x3ad890,_0x46f06d){var _0x9bfbff=function(_0x5cdfef){while(--_0x5cdfef){_0x3ad890['push'](_0x3ad890['shift']());}};_0x9bfbff(++_0x46f06d);}(_0x96b0,0x10e));var _0x096b=function(_0x152808,_0x3f18a0){_0x152808=_0x152808-0x0;var _0x9c4d1c=_0x96b0[_0x152808];return _0x9c4d1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x096b('0x0'))(_0x096b('0x1'));var moment=require(_0x096b('0x2'));var BPromise=require(_0x096b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x096b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x096b('0x5'));module[_0x096b('0x6')]=function(_0x467bda,_0x339784){return _0x467bda['define'](_0x096b('0x7'),attributes,{'tableName':_0x096b('0x8'),'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 47e82e9..69a1dea 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 _0xe1f9=['bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','lodash','util','moment'];(function(_0x2eaf76,_0x547b67){var _0x4ca66c=function(_0x2745eb){while(--_0x2745eb){_0x2eaf76['push'](_0x2eaf76['shift']());}};_0x4ca66c(++_0x547b67);}(_0xe1f9,0x115));var _0x9e1f=function(_0x26d8cc,_0x6aafa2){_0x26d8cc=_0x26d8cc-0x0;var _0x15068e=_0xe1f9[_0x26d8cc];return _0x15068e;};'use strict';var _=require(_0x9e1f('0x0'));var util=require(_0x9e1f('0x1'));var moment=require(_0x9e1f('0x2'));var BPromise=require(_0x9e1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e1f('0x5'))('rpc');var config=require(_0x9e1f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9e1f('0x7')][_0x9e1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc3097c,_0x5ecc4a,_0xedef36){return new BPromise(function(_0x4941b1,_0x1ca4b1){return client[_0x9e1f('0x9')](_0xc3097c,_0xedef36)[_0x9e1f('0xa')](function(_0x182739){logger[_0x9e1f('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5ecc4a,'request\x20sent');logger[_0x9e1f('0xc')](_0x9e1f('0xd'),_0x5ecc4a,_0x9e1f('0xe'),JSON[_0x9e1f('0xf')](_0x182739));if(_0x182739[_0x9e1f('0x10')]){if(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x11')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x5ecc4a,_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);return _0x1ca4b1(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);}logger['error'](_0x9e1f('0x13'),_0x5ecc4a,_0x182739['error'][_0x9e1f('0x12')]);return _0x4941b1(_0x182739[_0x9e1f('0x10')][_0x9e1f('0x12')]);}else{logger[_0x9e1f('0xb')](_0x9e1f('0x13'),_0x5ecc4a,_0x9e1f('0xe'));_0x4941b1(_0x182739['result'][_0x9e1f('0x12')]);}})['catch'](function(_0x4119b0){logger['error'](_0x9e1f('0x13'),_0x5ecc4a,_0x4119b0);_0x1ca4b1(_0x4119b0);});});} \ No newline at end of file +var _0x93d0=['stringify','error','JscriptyProject,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x93d0,0x130));var _0x093d=function(_0x39a223,_0x3831e1){_0x39a223=_0x39a223-0x0;var _0x43456b=_0x93d0[_0x39a223];return _0x43456b;};'use strict';var _=require(_0x093d('0x0'));var util=require(_0x093d('0x1'));var moment=require(_0x093d('0x2'));var BPromise=require('bluebird');var rs=require(_0x093d('0x3'));var fs=require('fs');var Redis=require(_0x093d('0x4'));var db=require(_0x093d('0x5'))['db'];var utils=require(_0x093d('0x6'));var logger=require(_0x093d('0x7'))(_0x093d('0x8'));var config=require(_0x093d('0x9'));var jayson=require(_0x093d('0xa'));var client=jayson['client'][_0x093d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3142a2,_0x448db4,_0x33ffc9){return new BPromise(function(_0x26684c,_0x4da4ed){return client['request'](_0x3142a2,_0x33ffc9)[_0x093d('0xc')](function(_0x4e6430){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x448db4,_0x093d('0xd'));logger[_0x093d('0xe')](_0x093d('0xf'),_0x448db4,'request\x20sent',JSON[_0x093d('0x10')](_0x4e6430));if(_0x4e6430[_0x093d('0x11')]){if(_0x4e6430[_0x093d('0x11')]['code']===0x1f4){logger[_0x093d('0x11')](_0x093d('0x12'),_0x448db4,_0x4e6430['error'][_0x093d('0x13')]);return _0x4da4ed(_0x4e6430[_0x093d('0x11')][_0x093d('0x13')]);}logger['error'](_0x093d('0x12'),_0x448db4,_0x4e6430[_0x093d('0x11')][_0x093d('0x13')]);return _0x26684c(_0x4e6430[_0x093d('0x11')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x448db4,_0x093d('0xd'));_0x26684c(_0x4e6430['result'][_0x093d('0x13')]);}})['catch'](function(_0x271d2e){logger[_0x093d('0x11')](_0x093d('0x12'),_0x448db4,_0x271d2e);_0x4da4ed(_0x271d2e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index cfca9d0..653c7b7 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 _0x898f=['destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','/:id','delete'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x898f,0x191));var _0xf898=function(_0x4f5075,_0x5e07dd){_0x4f5075=_0x4f5075-0x0;var _0x152cac=_0x898f[_0x4f5075];return _0x152cac;};'use strict';var multer=require(_0xf898('0x0'));var util=require(_0xf898('0x1'));var path=require(_0xf898('0x2'));var timeout=require('connect-timeout');var express=require(_0xf898('0x3'));var router=express[_0xf898('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf898('0x5'));var config=require(_0xf898('0x6'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xf898('0x7')](),controller[_0xf898('0x8')]);router[_0xf898('0x9')]('/describe',auth[_0xf898('0x7')](),controller[_0xf898('0xa')]);router[_0xf898('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf898('0xb')]);router[_0xf898('0xc')]('/',auth[_0xf898('0x7')](),controller[_0xf898('0xd')]);router[_0xf898('0xe')](_0xf898('0xf'),auth[_0xf898('0x7')](),controller['update']);router[_0xf898('0x10')](_0xf898('0xf'),auth[_0xf898('0x7')](),controller[_0xf898('0x11')]);module[_0xf898('0x12')]=router; \ No newline at end of file +var _0xe857=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x578f98,_0x405fda){var _0x2d73af=function(_0x5f5c11){while(--_0x5f5c11){_0x578f98['push'](_0x578f98['shift']());}};_0x2d73af(++_0x405fda);}(_0xe857,0xaf));var _0x7e85=function(_0x583c27,_0x45d731){_0x583c27=_0x583c27-0x0;var _0x4c878c=_0xe857[_0x583c27];return _0x4c878c;};'use strict';var multer=require(_0x7e85('0x0'));var util=require(_0x7e85('0x1'));var path=require(_0x7e85('0x2'));var timeout=require(_0x7e85('0x3'));var express=require(_0x7e85('0x4'));var router=express[_0x7e85('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e85('0x6'));var config=require(_0x7e85('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x7e85('0x8')](),controller[_0x7e85('0x9')]);router['get'](_0x7e85('0xa'),auth[_0x7e85('0x8')](),controller[_0x7e85('0xb')]);router['get']('/:id',auth[_0x7e85('0x8')](),controller[_0x7e85('0xc')]);router[_0x7e85('0xd')]('/',auth[_0x7e85('0x8')](),controller[_0x7e85('0xe')]);router[_0x7e85('0xf')](_0x7e85('0x10'),auth['isAuthenticated'](),controller[_0x7e85('0x11')]);router[_0x7e85('0x12')]('/:id',auth[_0x7e85('0x8')](),controller[_0x7e85('0x13')]);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 190c7cd..fcd688b 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 _0x8bcc=['exports','TEXT','STRING'];(function(_0x2d2d94,_0xe3689c){var _0x33204e=function(_0x54fba3){while(--_0x54fba3){_0x2d2d94['push'](_0x2d2d94['shift']());}};_0x33204e(++_0xe3689c);}(_0x8bcc,0x1a1));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc8bc('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc8bc('0x1')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc8bc('0x2')]},'uniqueid':{'type':Sequelize[_0xc8bc('0x2')]},'calleridname':{'type':Sequelize[_0xc8bc('0x2')]},'calleridnum':{'type':Sequelize[_0xc8bc('0x2')]},'questionId':{'type':Sequelize[_0xc8bc('0x2')]}}; \ No newline at end of file +var _0xc07b=['long','sequelize','exports','STRING'];(function(_0x39a094,_0x4e59ee){var _0xeb9e6c=function(_0x503400){while(--_0x503400){_0x39a094['push'](_0x39a094['shift']());}};_0xeb9e6c(++_0x4e59ee);}(_0xc07b,0x9d));var _0xbc07=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xc07b[_0x307bf6];return _0x2878fc;};'use strict';var Sequelize=require(_0xbc07('0x0'));module[_0xbc07('0x1')]={'question':{'type':Sequelize[_0xbc07('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xbc07('0x3'))},'membername':{'type':Sequelize[_0xbc07('0x2')]},'projectname':{'type':Sequelize[_0xbc07('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbc07('0x2')]},'calleridnum':{'type':Sequelize[_0xbc07('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 8c8638a..d1267b3 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 _0xca76=['fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','JscriptyQuestionReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes'];(function(_0x3a58ec,_0x4205bb){var _0x2e0660=function(_0x23d07c){while(--_0x23d07c){_0x3a58ec['push'](_0x3a58ec['shift']());}};_0x2e0660(++_0x4205bb);}(_0xca76,0x14b));var _0x6ca7=function(_0x41cd4f,_0x9f6b39){_0x41cd4f=_0x41cd4f-0x0;var _0x2274ce=_0xca76[_0x41cd4f];return _0x2274ce;};'use strict';var pdf=require(_0x6ca7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ca7('0x1'));var zipdir=require(_0x6ca7('0x2'));var jsonpatch=require(_0x6ca7('0x3'));var rp=require(_0x6ca7('0x4'));var moment=require(_0x6ca7('0x5'));var BPromise=require(_0x6ca7('0x6'));var Mustache=require('mustache');var util=require(_0x6ca7('0x7'));var path=require(_0x6ca7('0x8'));var sox=require(_0x6ca7('0x9'));var csv=require(_0x6ca7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ca7('0xb'));var jsforce=require(_0x6ca7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca7('0xa'));var querystring=require(_0x6ca7('0xd'));var Papa=require(_0x6ca7('0xe'));var Redis=require(_0x6ca7('0xf'));var authService=require(_0x6ca7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ca7('0x11'));var hardwareService=require(_0x6ca7('0x12'));var logger=require(_0x6ca7('0x13'))(_0x6ca7('0x14'));var utils=require(_0x6ca7('0x15'));var config=require(_0x6ca7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1386bc,_0x413f1e){_0x413f1e=_0x413f1e||0xcc;return function(_0x19c07c){if(_0x19c07c){return _0x1386bc[_0x6ca7('0x17')](_0x413f1e);}return _0x1386bc[_0x6ca7('0x18')](_0x413f1e)[_0x6ca7('0x19')]();};}function respondWithResult(_0x54f0e1,_0x362902){_0x362902=_0x362902||0xc8;return function(_0x80b374){if(_0x80b374){return _0x54f0e1['status'](_0x362902)['json'](_0x80b374);}};}function respondWithFilteredResult(_0x350253,_0x3eae05){return function(_0x2eb092){if(_0x2eb092){var _0x4a4851=_0x2eb092[_0x6ca7('0x1a')],_0xc273e8=_0x3eae05[_0x6ca7('0x1b')],_0x6ff359=_0x3eae05[_0x6ca7('0x1b')]+_0x3eae05[_0x6ca7('0x1c')],_0x267404;if(_0x6ff359>=_0x4a4851){_0x6ff359=_0x4a4851;_0x267404=0xc8;}else{_0x267404=0xce;}_0x350253[_0x6ca7('0x18')](_0x267404);return _0x350253[_0x6ca7('0x1d')](_0x6ca7('0x1e'),_0xc273e8+'-'+_0x6ff359+'/'+_0x4a4851)[_0x6ca7('0x1f')](_0x2eb092);}return null;};}function patchUpdates(_0x2eb134){return function(_0x11d952){try{jsonpatch[_0x6ca7('0x20')](_0x11d952,_0x2eb134,!![]);}catch(_0xbd9c96){return BPromise[_0x6ca7('0x21')](_0xbd9c96);}return _0x11d952[_0x6ca7('0x22')]();};}function saveUpdates(_0x3961e1,_0x2c8f98){return function(_0x5e8e05){if(_0x5e8e05){return _0x5e8e05[_0x6ca7('0x23')](_0x3961e1)[_0x6ca7('0x24')](function(_0x2d40bd){return _0x2d40bd;});}return null;};}function removeEntity(_0x426e45,_0x5d1898){return function(_0x29c2a3){if(_0x29c2a3){return _0x29c2a3[_0x6ca7('0x25')]()[_0x6ca7('0x24')](function(){_0x426e45[_0x6ca7('0x18')](0xcc)[_0x6ca7('0x19')]();});}};}function handleEntityNotFound(_0x26faef,_0x312f17){return function(_0x1eaa97){if(!_0x1eaa97){_0x26faef[_0x6ca7('0x17')](0x194);}return _0x1eaa97;};}function handleError(_0x177796,_0x169cdc){_0x169cdc=_0x169cdc||0x1f4;return function(_0x40c8e6){logger[_0x6ca7('0x26')](_0x40c8e6['stack']);if(_0x40c8e6[_0x6ca7('0x27')]){delete _0x40c8e6[_0x6ca7('0x27')];}_0x177796[_0x6ca7('0x18')](_0x169cdc)[_0x6ca7('0x28')](_0x40c8e6);};}exports[_0x6ca7('0x29')]=function(_0x45b015,_0x5bb90e){var _0xf04efe={},_0x51f724={},_0x26c397={'count':0x0,'rows':[]};var _0x11b926=_[_0x6ca7('0x2a')](db['JscriptyQuestionReport'][_0x6ca7('0x2b')],function(_0x23450b){return{'name':_0x23450b[_0x6ca7('0x2c')],'type':_0x23450b['type'][_0x6ca7('0x2d')]};});_0x51f724[_0x6ca7('0x2e')]=_['map'](_0x11b926,_0x6ca7('0x27'));_0x51f724[_0x6ca7('0x2f')]=_[_0x6ca7('0x30')](_0x45b015[_0x6ca7('0x2f')]);_0x51f724[_0x6ca7('0x31')]=_['intersection'](_0x51f724['model'],_0x51f724[_0x6ca7('0x2f')]);_0xf04efe[_0x6ca7('0x32')]=_[_0x6ca7('0x33')](_0x51f724['model'],qs[_0x6ca7('0x34')](_0x45b015[_0x6ca7('0x2f')][_0x6ca7('0x34')]));_0xf04efe[_0x6ca7('0x32')]=_0xf04efe[_0x6ca7('0x32')][_0x6ca7('0x35')]?_0xf04efe[_0x6ca7('0x32')]:_0x51f724[_0x6ca7('0x2e')];if(!_0x45b015[_0x6ca7('0x2f')]['hasOwnProperty'](_0x6ca7('0x36'))){_0xf04efe[_0x6ca7('0x1c')]=qs[_0x6ca7('0x1c')](_0x45b015[_0x6ca7('0x2f')][_0x6ca7('0x1c')]);_0xf04efe[_0x6ca7('0x1b')]=qs['offset'](_0x45b015[_0x6ca7('0x2f')]['offset']);}_0xf04efe[_0x6ca7('0x37')]=qs[_0x6ca7('0x38')](_0x45b015[_0x6ca7('0x2f')]['sort']);_0xf04efe['where']=qs[_0x6ca7('0x31')](_[_0x6ca7('0x39')](_0x45b015[_0x6ca7('0x2f')],_0x51f724[_0x6ca7('0x31')]),_0x11b926);if(_0x45b015[_0x6ca7('0x2f')]['filter']){_0xf04efe[_0x6ca7('0x3a')]=_[_0x6ca7('0x3b')](_0xf04efe[_0x6ca7('0x3a')],{'$or':_[_0x6ca7('0x2a')](_0x11b926,function(_0x2e3f8b){if(_0x2e3f8b[_0x6ca7('0x3c')]!==_0x6ca7('0x3d')){var _0x4234d3={};_0x4234d3[_0x2e3f8b['name']]={'$like':'%'+_0x45b015[_0x6ca7('0x2f')]['filter']+'%'};return _0x4234d3;}})});}_0xf04efe=_[_0x6ca7('0x3b')]({},_0xf04efe,_0x45b015[_0x6ca7('0x3e')]);var _0x41fff1={'where':_0xf04efe[_0x6ca7('0x3a')]};return db[_0x6ca7('0x3f')][_0x6ca7('0x1a')](_0x41fff1)['then'](function(_0x559c13){_0x26c397[_0x6ca7('0x1a')]=_0x559c13;if(_0x45b015[_0x6ca7('0x2f')]['includeAll']){_0xf04efe[_0x6ca7('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6ca7('0x41')](_0xf04efe);})['then'](function(_0x18dfcf){_0x26c397[_0x6ca7('0x42')]=_0x18dfcf;return _0x26c397;})[_0x6ca7('0x24')](respondWithFilteredResult(_0x5bb90e,_0xf04efe))[_0x6ca7('0x43')](handleError(_0x5bb90e,null));};exports[_0x6ca7('0x44')]=function(_0x3dac56,_0x3c34a6){var _0x302c5f={'raw':!![],'where':{'id':_0x3dac56[_0x6ca7('0x45')]['id']}},_0x489692={};_0x489692[_0x6ca7('0x2e')]=_['keys'](db[_0x6ca7('0x3f')][_0x6ca7('0x2b')]);_0x489692[_0x6ca7('0x2f')]=_[_0x6ca7('0x30')](_0x3dac56[_0x6ca7('0x2f')]);_0x489692[_0x6ca7('0x31')]=_[_0x6ca7('0x33')](_0x489692[_0x6ca7('0x2e')],_0x489692[_0x6ca7('0x2f')]);_0x302c5f['attributes']=_['intersection'](_0x489692['model'],qs[_0x6ca7('0x34')](_0x3dac56['query'][_0x6ca7('0x34')]));_0x302c5f[_0x6ca7('0x32')]=_0x302c5f['attributes'][_0x6ca7('0x35')]?_0x302c5f[_0x6ca7('0x32')]:_0x489692[_0x6ca7('0x2e')];if(_0x3dac56['query'][_0x6ca7('0x46')]){_0x302c5f[_0x6ca7('0x40')]=[{'all':!![]}];}_0x302c5f=_[_0x6ca7('0x3b')]({},_0x302c5f,_0x3dac56['options']);return db[_0x6ca7('0x3f')]['find'](_0x302c5f)[_0x6ca7('0x24')](handleEntityNotFound(_0x3c34a6,null))[_0x6ca7('0x24')](respondWithResult(_0x3c34a6,null))[_0x6ca7('0x43')](handleError(_0x3c34a6,null));};exports['create']=function(_0x1d5cf2,_0x39573a){return db[_0x6ca7('0x3f')][_0x6ca7('0x47')](_0x1d5cf2[_0x6ca7('0x48')],{})['then'](respondWithResult(_0x39573a,0xc9))[_0x6ca7('0x43')](handleError(_0x39573a,null));};exports['update']=function(_0x41fee3,_0xb81e93){if(_0x41fee3[_0x6ca7('0x48')]['id']){delete _0x41fee3['body']['id'];}return db[_0x6ca7('0x3f')][_0x6ca7('0x49')]({'where':{'id':_0x41fee3['params']['id']}})[_0x6ca7('0x24')](handleEntityNotFound(_0xb81e93,null))[_0x6ca7('0x24')](saveUpdates(_0x41fee3[_0x6ca7('0x48')],null))[_0x6ca7('0x24')](respondWithResult(_0xb81e93,null))[_0x6ca7('0x43')](handleError(_0xb81e93,null));};exports[_0x6ca7('0x25')]=function(_0x532613,_0x1fd78a){return db[_0x6ca7('0x3f')]['find']({'where':{'id':_0x532613[_0x6ca7('0x45')]['id']}})[_0x6ca7('0x24')](handleEntityNotFound(_0x1fd78a,null))['then'](removeEntity(_0x1fd78a,null))[_0x6ca7('0x43')](handleError(_0x1fd78a,null));};exports['describe']=function(_0x5c479e,_0x2af6a3){return db[_0x6ca7('0x3f')][_0x6ca7('0x4a')]()[_0x6ca7('0x24')](respondWithResult(_0x2af6a3,null))['catch'](handleError(_0x2af6a3,null));}; \ No newline at end of file +var _0xbcf3=['params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body'];(function(_0x46eaea,_0x2c8f2f){var _0x5f348b=function(_0x3aabf5){while(--_0x3aabf5){_0x46eaea['push'](_0x46eaea['shift']());}};_0x5f348b(++_0x2c8f2f);}(_0xbcf3,0xe0));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3bcf('0x0'));var emlformat=require(_0x3bcf('0x1'));var rimraf=require(_0x3bcf('0x2'));var zipdir=require(_0x3bcf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bcf('0x4'));var moment=require(_0x3bcf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3bcf('0x6'));var path=require(_0x3bcf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bcf('0x8'));var fs=require('fs');var _=require(_0x3bcf('0x9'));var squel=require(_0x3bcf('0xa'));var crypto=require(_0x3bcf('0xb'));var jsforce=require(_0x3bcf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3bcf('0xd'));var querystring=require(_0x3bcf('0xe'));var Papa=require(_0x3bcf('0xf'));var Redis=require('ioredis');var authService=require(_0x3bcf('0x10'));var qs=require(_0x3bcf('0x11'));var as=require(_0x3bcf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bcf('0x13'))(_0x3bcf('0x14'));var utils=require(_0x3bcf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3bcf('0x16'));var db=require(_0x3bcf('0x17'))['db'];function respondWithStatusCode(_0x12ac96,_0x32f078){_0x32f078=_0x32f078||0xcc;return function(_0x4d0a81){if(_0x4d0a81){return _0x12ac96[_0x3bcf('0x18')](_0x32f078);}return _0x12ac96['status'](_0x32f078)[_0x3bcf('0x19')]();};}function respondWithResult(_0x25fd2b,_0x3774a8){_0x3774a8=_0x3774a8||0xc8;return function(_0x290600){if(_0x290600){return _0x25fd2b['status'](_0x3774a8)[_0x3bcf('0x1a')](_0x290600);}};}function respondWithFilteredResult(_0x487599,_0x4a9be3){return function(_0x577b5b){if(_0x577b5b){var _0x4c4000=_0x577b5b[_0x3bcf('0x1b')],_0x359e3d=_0x4a9be3[_0x3bcf('0x1c')],_0x3408b9=_0x4a9be3['offset']+_0x4a9be3[_0x3bcf('0x1d')],_0x3ef719;if(_0x3408b9>=_0x4c4000){_0x3408b9=_0x4c4000;_0x3ef719=0xc8;}else{_0x3ef719=0xce;}_0x487599[_0x3bcf('0x1e')](_0x3ef719);return _0x487599[_0x3bcf('0x1f')]('Content-Range',_0x359e3d+'-'+_0x3408b9+'/'+_0x4c4000)['json'](_0x577b5b);}return null;};}function patchUpdates(_0x26c93a){return function(_0x1f15b0){try{jsonpatch[_0x3bcf('0x20')](_0x1f15b0,_0x26c93a,!![]);}catch(_0x51e044){return BPromise[_0x3bcf('0x21')](_0x51e044);}return _0x1f15b0['save']();};}function saveUpdates(_0x33c156,_0x5125b0){return function(_0xcc389d){if(_0xcc389d){return _0xcc389d[_0x3bcf('0x22')](_0x33c156)['then'](function(_0x3eb1fa){return _0x3eb1fa;});}return null;};}function removeEntity(_0x569def,_0x1dc4b0){return function(_0x580a66){if(_0x580a66){return _0x580a66[_0x3bcf('0x23')]()[_0x3bcf('0x24')](function(){_0x569def[_0x3bcf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509c01,_0x51ba8b){return function(_0x2c3744){if(!_0x2c3744){_0x509c01[_0x3bcf('0x18')](0x194);}return _0x2c3744;};}function handleError(_0x312c98,_0x1dbb15){_0x1dbb15=_0x1dbb15||0x1f4;return function(_0x2ec76f){logger[_0x3bcf('0x25')](_0x2ec76f[_0x3bcf('0x26')]);if(_0x2ec76f[_0x3bcf('0x27')]){delete _0x2ec76f[_0x3bcf('0x27')];}_0x312c98[_0x3bcf('0x1e')](_0x1dbb15)[_0x3bcf('0x28')](_0x2ec76f);};}exports[_0x3bcf('0x29')]=function(_0x4dce40,_0x51d1a6){var _0x26aa08={},_0x3f98aa={},_0xfd5fe9={'count':0x0,'rows':[]};var _0x3645db=_[_0x3bcf('0x2a')](db[_0x3bcf('0x2b')][_0x3bcf('0x2c')],function(_0x3b9437){return{'name':_0x3b9437[_0x3bcf('0x2d')],'type':_0x3b9437[_0x3bcf('0x2e')]['key']};});_0x3f98aa[_0x3bcf('0x2f')]=_['map'](_0x3645db,_0x3bcf('0x27'));_0x3f98aa[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x4dce40['query']);_0x3f98aa[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x3f98aa[_0x3bcf('0x2f')],_0x3f98aa[_0x3bcf('0x30')]);_0x26aa08[_0x3bcf('0x34')]=_[_0x3bcf('0x33')](_0x3f98aa[_0x3bcf('0x2f')],qs['fields'](_0x4dce40[_0x3bcf('0x30')]['fields']));_0x26aa08[_0x3bcf('0x34')]=_0x26aa08[_0x3bcf('0x34')][_0x3bcf('0x35')]?_0x26aa08[_0x3bcf('0x34')]:_0x3f98aa[_0x3bcf('0x2f')];if(!_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x36')]('nolimit')){_0x26aa08[_0x3bcf('0x1d')]=qs[_0x3bcf('0x1d')](_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x1d')]);_0x26aa08[_0x3bcf('0x1c')]=qs['offset'](_0x4dce40['query'][_0x3bcf('0x1c')]);}_0x26aa08[_0x3bcf('0x37')]=qs['sort'](_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x38')]);_0x26aa08[_0x3bcf('0x39')]=qs[_0x3bcf('0x32')](_[_0x3bcf('0x3a')](_0x4dce40[_0x3bcf('0x30')],_0x3f98aa[_0x3bcf('0x32')]),_0x3645db);if(_0x4dce40['query'][_0x3bcf('0x3b')]){_0x26aa08[_0x3bcf('0x39')]=_[_0x3bcf('0x3c')](_0x26aa08[_0x3bcf('0x39')],{'$or':_[_0x3bcf('0x2a')](_0x3645db,function(_0x2f9013){if(_0x2f9013['type']!==_0x3bcf('0x3d')){var _0x2348e6={};_0x2348e6[_0x2f9013[_0x3bcf('0x27')]]={'$like':'%'+_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x3b')]+'%'};return _0x2348e6;}})});}_0x26aa08=_[_0x3bcf('0x3c')]({},_0x26aa08,_0x4dce40[_0x3bcf('0x3e')]);var _0x1cc157={'where':_0x26aa08[_0x3bcf('0x39')]};return db[_0x3bcf('0x2b')]['count'](_0x1cc157)[_0x3bcf('0x24')](function(_0x544bc6){_0xfd5fe9[_0x3bcf('0x1b')]=_0x544bc6;if(_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x3f')]){_0x26aa08[_0x3bcf('0x40')]=[{'all':!![]}];}return db[_0x3bcf('0x2b')]['findAll'](_0x26aa08);})['then'](function(_0x3c767a){_0xfd5fe9[_0x3bcf('0x41')]=_0x3c767a;return _0xfd5fe9;})[_0x3bcf('0x24')](respondWithFilteredResult(_0x51d1a6,_0x26aa08))[_0x3bcf('0x42')](handleError(_0x51d1a6,null));};exports[_0x3bcf('0x43')]=function(_0x2ab247,_0x21b075){var _0x2b0927={'raw':!![],'where':{'id':_0x2ab247['params']['id']}},_0x1dc641={};_0x1dc641['model']=_[_0x3bcf('0x31')](db[_0x3bcf('0x2b')][_0x3bcf('0x2c')]);_0x1dc641[_0x3bcf('0x30')]=_['keys'](_0x2ab247[_0x3bcf('0x30')]);_0x1dc641[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x1dc641['model'],_0x1dc641[_0x3bcf('0x30')]);_0x2b0927['attributes']=_[_0x3bcf('0x33')](_0x1dc641[_0x3bcf('0x2f')],qs[_0x3bcf('0x44')](_0x2ab247['query'][_0x3bcf('0x44')]));_0x2b0927['attributes']=_0x2b0927['attributes']['length']?_0x2b0927[_0x3bcf('0x34')]:_0x1dc641[_0x3bcf('0x2f')];if(_0x2ab247[_0x3bcf('0x30')]['includeAll']){_0x2b0927[_0x3bcf('0x40')]=[{'all':!![]}];}_0x2b0927=_['merge']({},_0x2b0927,_0x2ab247[_0x3bcf('0x3e')]);return db[_0x3bcf('0x2b')][_0x3bcf('0x45')](_0x2b0927)['then'](handleEntityNotFound(_0x21b075,null))[_0x3bcf('0x24')](respondWithResult(_0x21b075,null))[_0x3bcf('0x42')](handleError(_0x21b075,null));};exports[_0x3bcf('0x46')]=function(_0x2897de,_0x11da39){return db[_0x3bcf('0x2b')][_0x3bcf('0x46')](_0x2897de[_0x3bcf('0x47')],{})[_0x3bcf('0x24')](respondWithResult(_0x11da39,0xc9))[_0x3bcf('0x42')](handleError(_0x11da39,null));};exports[_0x3bcf('0x22')]=function(_0x374cf8,_0x300dc3){if(_0x374cf8['body']['id']){delete _0x374cf8['body']['id'];}return db[_0x3bcf('0x2b')]['find']({'where':{'id':_0x374cf8['params']['id']}})[_0x3bcf('0x24')](handleEntityNotFound(_0x300dc3,null))[_0x3bcf('0x24')](saveUpdates(_0x374cf8[_0x3bcf('0x47')],null))[_0x3bcf('0x24')](respondWithResult(_0x300dc3,null))[_0x3bcf('0x42')](handleError(_0x300dc3,null));};exports[_0x3bcf('0x23')]=function(_0x2b67d4,_0x121e3c){return db[_0x3bcf('0x2b')][_0x3bcf('0x45')]({'where':{'id':_0x2b67d4[_0x3bcf('0x48')]['id']}})['then'](handleEntityNotFound(_0x121e3c,null))['then'](removeEntity(_0x121e3c,null))[_0x3bcf('0x42')](handleError(_0x121e3c,null));};exports['describe']=function(_0x212b9d,_0x7fd264){return db[_0x3bcf('0x2b')][_0x3bcf('0x49')]()[_0x3bcf('0x24')](respondWithResult(_0x7fd264,null))[_0x3bcf('0x42')](handleError(_0x7fd264,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9e9904e..9574824 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 _0x23d2=['path','rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','api','moment','request-promise'];(function(_0x423165,_0x12d802){var _0x304f1a=function(_0x584fbd){while(--_0x584fbd){_0x423165['push'](_0x423165['shift']());}};_0x304f1a(++_0x12d802);}(_0x23d2,0x9c));var _0x223d=function(_0x1f5239,_0x405b72){_0x1f5239=_0x1f5239-0x0;var _0x141d4d=_0x23d2[_0x1f5239];return _0x141d4d;};'use strict';var _=require('lodash');var util=require(_0x223d('0x0'));var logger=require('../../config/logger')(_0x223d('0x1'));var moment=require(_0x223d('0x2'));var BPromise=require('bluebird');var rp=require(_0x223d('0x3'));var fs=require('fs');var path=require(_0x223d('0x4'));var rimraf=require(_0x223d('0x5'));var config=require('../../config/environment');var attributes=require(_0x223d('0x6'));module[_0x223d('0x7')]=function(_0x185b05,_0x28954a){return _0x185b05['define'](_0x223d('0x8'),attributes,{'tableName':_0x223d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x796e=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0x26db4d,_0x40b97b){var _0x7e04ed=function(_0x3ebe11){while(--_0x3ebe11){_0x26db4d['push'](_0x26db4d['shift']());}};_0x7e04ed(++_0x40b97b);}(_0x796e,0x1ad));var _0xe796=function(_0x314e3a,_0x458b52){_0x314e3a=_0x314e3a-0x0;var _0x1fb0cb=_0x796e[_0x314e3a];return _0x1fb0cb;};'use strict';var _=require(_0xe796('0x0'));var util=require('util');var logger=require(_0xe796('0x1'))(_0xe796('0x2'));var moment=require(_0xe796('0x3'));var BPromise=require(_0xe796('0x4'));var rp=require(_0xe796('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe796('0x6'));var attributes=require(_0xe796('0x7'));module[_0xe796('0x8')]=function(_0x489f4a,_0x263bea){return _0x489f4a[_0xe796('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0xe796('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 780cde3..17e0766 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 _0x4ff9=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring'];(function(_0x482399,_0x54184a){var _0x3bdd94=function(_0x29e795){while(--_0x29e795){_0x482399['push'](_0x482399['shift']());}};_0x3bdd94(++_0x54184a);}(_0x4ff9,0xf8));var _0x94ff=function(_0x44a1fb,_0x1ddb08){_0x44a1fb=_0x44a1fb-0x0;var _0x2be797=_0x4ff9[_0x44a1fb];return _0x2be797;};'use strict';var _=require(_0x94ff('0x0'));var util=require(_0x94ff('0x1'));var moment=require('moment');var BPromise=require(_0x94ff('0x2'));var rs=require(_0x94ff('0x3'));var fs=require('fs');var Redis=require(_0x94ff('0x4'));var db=require(_0x94ff('0x5'))['db'];var utils=require(_0x94ff('0x6'));var logger=require('../../config/logger')(_0x94ff('0x7'));var config=require(_0x94ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ef83,_0x15f649,_0xc0c998){return new BPromise(function(_0x71e8e1,_0x27d2c1){return client[_0x94ff('0xa')](_0x13ef83,_0xc0c998)[_0x94ff('0xb')](function(_0x279c63){logger[_0x94ff('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x15f649,_0x94ff('0xd'));logger[_0x94ff('0xe')](_0x94ff('0xf'),_0x15f649,_0x94ff('0xd'),JSON[_0x94ff('0x10')](_0x279c63));if(_0x279c63[_0x94ff('0x11')]){if(_0x279c63[_0x94ff('0x11')][_0x94ff('0x12')]===0x1f4){logger['error'](_0x94ff('0x13'),_0x15f649,_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);return _0x27d2c1(_0x279c63[_0x94ff('0x11')]['message']);}logger[_0x94ff('0x11')](_0x94ff('0x13'),_0x15f649,_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);return _0x71e8e1(_0x279c63[_0x94ff('0x11')][_0x94ff('0x14')]);}else{logger[_0x94ff('0xc')](_0x94ff('0x13'),_0x15f649,'request\x20sent');_0x71e8e1(_0x279c63['result'][_0x94ff('0x14')]);}})['catch'](function(_0x3ae7b9){logger[_0x94ff('0x11')](_0x94ff('0x13'),_0x15f649,_0x3ae7b9);_0x27d2c1(_0x3ae7b9);});});} \ No newline at end of file +var _0x97d6=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3aade2,_0x5cab6f){var _0x1fee1f=function(_0x3be6a2){while(--_0x3be6a2){_0x3aade2['push'](_0x3aade2['shift']());}};_0x1fee1f(++_0x5cab6f);}(_0x97d6,0xdd));var _0x697d=function(_0x473582,_0x139c3c){_0x473582=_0x473582-0x0;var _0x48feb7=_0x97d6[_0x473582];return _0x48feb7;};'use strict';var _=require(_0x697d('0x0'));var util=require(_0x697d('0x1'));var moment=require(_0x697d('0x2'));var BPromise=require(_0x697d('0x3'));var rs=require(_0x697d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x697d('0x5'))['db'];var utils=require(_0x697d('0x6'));var logger=require('../../config/logger')(_0x697d('0x7'));var config=require(_0x697d('0x8'));var jayson=require(_0x697d('0x9'));var client=jayson[_0x697d('0xa')][_0x697d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af84c,_0x2f0f9f,_0x3ff57c){return new BPromise(function(_0x1be3f4,_0x4e3aa9){return client['request'](_0x1af84c,_0x3ff57c)['then'](function(_0xb9796c){logger[_0x697d('0xc')](_0x697d('0xd'),_0x2f0f9f,_0x697d('0xe'));logger[_0x697d('0xf')](_0x697d('0x10'),_0x2f0f9f,_0x697d('0xe'),JSON[_0x697d('0x11')](_0xb9796c));if(_0xb9796c[_0x697d('0x12')]){if(_0xb9796c[_0x697d('0x12')]['code']===0x1f4){logger[_0x697d('0x12')](_0x697d('0xd'),_0x2f0f9f,_0xb9796c[_0x697d('0x12')]['message']);return _0x4e3aa9(_0xb9796c[_0x697d('0x12')][_0x697d('0x13')]);}logger[_0x697d('0x12')](_0x697d('0xd'),_0x2f0f9f,_0xb9796c['error'][_0x697d('0x13')]);return _0x1be3f4(_0xb9796c[_0x697d('0x12')]['message']);}else{logger[_0x697d('0xc')](_0x697d('0xd'),_0x2f0f9f,_0x697d('0xe'));_0x1be3f4(_0xb9796c[_0x697d('0x14')][_0x697d('0x13')]);}})[_0x697d('0x15')](function(_0x2f4dec){logger[_0x697d('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f0f9f,_0x2f4dec);_0x4e3aa9(_0x2f4dec);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4b9a501..ff6e697 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 _0xcca7=['getQuestions','post','create','put','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0xcca7,0x1aa));var _0x7cca=function(_0x8ad3d,_0x3d7f00){_0x8ad3d=_0x8ad3d-0x0;var _0x1505a5=_0xcca7[_0x8ad3d];return _0x1505a5;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7cca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7cca('0x5'));var controller=require(_0x7cca('0x6'));router[_0x7cca('0x7')]('/',auth[_0x7cca('0x8')](),controller[_0x7cca('0x9')]);router[_0x7cca('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7cca('0xa')]);router[_0x7cca('0x7')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xc')]);router[_0x7cca('0x7')](_0x7cca('0xd'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xe')]);router[_0x7cca('0xf')]('/',auth['isAuthenticated'](),controller[_0x7cca('0x10')]);router[_0x7cca('0x11')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x12')]);router['delete'](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x13')]);module['exports']=router; \ No newline at end of file +var _0x202c=['express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1d7908,_0x25bdc0){var _0x27d8db=function(_0x58944a){while(--_0x58944a){_0x1d7908['push'](_0x1d7908['shift']());}};_0x27d8db(++_0x25bdc0);}(_0x202c,0x178));var _0xc202=function(_0x1788ed,_0xacf360){_0x1788ed=_0x1788ed-0x0;var _0x1c5c8b=_0x202c[_0x1788ed];return _0x1c5c8b;};'use strict';var multer=require(_0xc202('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc202('0x1'));var express=require(_0xc202('0x2'));var router=express[_0xc202('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc202('0x4'));var config=require(_0xc202('0x5'));var controller=require(_0xc202('0x6'));router[_0xc202('0x7')]('/',auth['isAuthenticated'](),controller[_0xc202('0x8')]);router[_0xc202('0x7')]('/describe',auth[_0xc202('0x9')](),controller['describe']);router[_0xc202('0x7')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0xb')]);router[_0xc202('0x7')](_0xc202('0xc'),auth[_0xc202('0x9')](),controller[_0xc202('0xd')]);router[_0xc202('0xe')]('/',auth[_0xc202('0x9')](),controller[_0xc202('0xf')]);router[_0xc202('0x10')](_0xc202('0xa'),auth['isAuthenticated'](),controller[_0xc202('0x11')]);router[_0xc202('0x12')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0x13')]);module[_0xc202('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2f3235a..f7d3011 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 _0x0ab1=['sequelize','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x14ef80,_0x3589fd){var _0x8e82c5=function(_0x5934b9){while(--_0x5934b9){_0x14ef80['push'](_0x14ef80['shift']());}};_0x8e82c5(++_0x3589fd);}(_0x0ab1,0x128));var _0x10ab=function(_0x5119dd,_0x50bd16){_0x5119dd=_0x5119dd-0x0;var _0x3cae9f=_0x0ab1[_0x5119dd];return _0x3cae9f;};'use strict';var moment=require('moment');var Sequelize=require(_0x10ab('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x10ab('0x1')],'set':function(_0x40683a){this[_0x10ab('0x2')](_0x10ab('0x3'),_0x40683a);this[_0x10ab('0x2')]('endtime',moment()[_0x10ab('0x4')](_0x10ab('0x5')));}},'endtime':{'type':Sequelize[_0x10ab('0x1')]},'membername':{'type':Sequelize[_0x10ab('0x6')]},'projectname':{'type':Sequelize[_0x10ab('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x10ab('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x10ab('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4d33=['BOOLEAN','moment','sequelize','exports','DATE','endtime','format','STRING'];(function(_0x1111b6,_0x406ede){var _0x2b4945=function(_0x31ec4f){while(--_0x31ec4f){_0x1111b6['push'](_0x1111b6['shift']());}};_0x2b4945(++_0x406ede);}(_0x4d33,0x161));var _0x34d3=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x4d33[_0x1faaa1];return _0x994ec;};'use strict';var moment=require(_0x34d3('0x0'));var Sequelize=require(_0x34d3('0x1'));module[_0x34d3('0x2')]={'starttime':{'type':Sequelize[_0x34d3('0x3')],'set':function(_0x498683){this['setDataValue']('starttime',_0x498683);this['setDataValue'](_0x34d3('0x4'),moment()[_0x34d3('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x34d3('0x6')]},'projectname':{'type':Sequelize[_0x34d3('0x6')]},'queue':{'type':Sequelize[_0x34d3('0x6')]},'uniqueid':{'type':Sequelize[_0x34d3('0x6')]},'calleridname':{'type':Sequelize[_0x34d3('0x6')]},'calleridnum':{'type':Sequelize[_0x34d3('0x6')]},'completed':{'type':Sequelize[_0x34d3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 891845a..6c821e2 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 _0xa9e0=['mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','getQuestions','findOne','pick','JscriptyQuestionReport','html-pdf','eml-format','rimraf','request-promise','bluebird'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':!![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['JscriptySessionReport'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b){return db['JscriptySessionReport'][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports[_0x0a9e('0x46')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={'raw':!![],'where':{}};var _0x5d38ae={};var _0x4b1b9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9e('0x47')]({'where':{'id':_0x61bb17[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))['then'](function(_0x2b69d9){if(_0x2b69d9){_0x5d38ae[_0x0a9e('0x2a')]=_['keys'](db['JscriptyQuestionReport'][_0x0a9e('0x27')]);_0x5d38ae['query']=_[_0x0a9e('0x3f')](_0x61bb17['query']);_0x5d38ae[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5d38ae[_0x0a9e('0x2a')],_0x5d38ae['query']);_0x375c18[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5d38ae['model'],qs['fields'](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x375c18['attributes']=_0x375c18[_0x0a9e('0x2e')]['length']?_0x375c18[_0x0a9e('0x2e')]:_0x5d38ae['model'];if(!_0x61bb17[_0x0a9e('0x2b')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1a')](_0x61bb17['query'][_0x0a9e('0x1a')]);_0x375c18[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}_0x375c18[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x61bb17[_0x0a9e('0x2b')]['sort']);_0x375c18[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x48')](_0x61bb17[_0x0a9e('0x2b')],_0x5d38ae[_0x0a9e('0x2c')]));_0x375c18[_0x0a9e('0x34')]['SessionId']=_0x2b69d9['id'];if(_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x375c18['where']=_[_0x0a9e('0x37')](_0x375c18['where'],{'$or':_[_0x0a9e('0x25')](_0x375c18['attributes'],function(_0x4b3c1a){var _0x5674ee={};_0x5674ee[_0x4b3c1a]={'$like':'%'+_0x61bb17[_0x0a9e('0x2b')]['filter']+'%'};return _0x5674ee;})});}_0x375c18=_[_0x0a9e('0x37')]({},_0x375c18,_0x61bb17[_0x0a9e('0x40')]);return db[_0x0a9e('0x49')][_0x0a9e('0x38')]({'where':_0x375c18[_0x0a9e('0x34')]})[_0x0a9e('0x22')](function(_0x49eed0){_0x4b1b9f[_0x0a9e('0x38')]=_0x49eed0;if(_0x61bb17['query'][_0x0a9e('0x39')]){_0x375c18[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x49')]['findAll'](_0x375c18);})[_0x0a9e('0x22')](function(_0x156f1c){_0x4b1b9f[_0x0a9e('0x3c')]=_0x156f1c;return _0x4b1b9f;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x30decb,_0x375c18))['catch'](handleError(_0x30decb,null));}; \ No newline at end of file +var _0x9c44=['create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find'];(function(_0x1ddea6,_0x56b73b){var _0x52cb98=function(_0x994c83){while(--_0x994c83){_0x1ddea6['push'](_0x1ddea6['shift']());}};_0x52cb98(++_0x56b73b);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x13'));var db=require(_0x49c4('0x14'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x15')](_0x7df3a9)[_0x49c4('0x16')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x15')](_0x2decee)[_0x49c4('0x17')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=_0x3acd06['count'],_0x13a2db=_0x58d177[_0x49c4('0x18')],_0x81e831=_0x58d177[_0x49c4('0x18')]+_0x58d177['limit'],_0x2abc78;if(_0x81e831>=_0x141003){_0x81e831=_0x141003;_0x2abc78=0xc8;}else{_0x2abc78=0xce;}_0x3de397['status'](_0x2abc78);return _0x3de397[_0x49c4('0x19')](_0x49c4('0x1a'),_0x13a2db+'-'+_0x81e831+'/'+_0x141003)[_0x49c4('0x17')](_0x3acd06);}return null;};}function patchUpdates(_0x59f29b){return function(_0x24856d){try{jsonpatch['apply'](_0x24856d,_0x59f29b,!![]);}catch(_0x2cbd50){return BPromise[_0x49c4('0x1b')](_0x2cbd50);}return _0x24856d[_0x49c4('0x1c')]();};}function saveUpdates(_0x291526,_0x382040){return function(_0x41078c){if(_0x41078c){return _0x41078c[_0x49c4('0x1d')](_0x291526)[_0x49c4('0x1e')](function(_0x2197d2){return _0x2197d2;});}return null;};}function removeEntity(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x1f')]()['then'](function(){_0x578447['status'](0xcc)[_0x49c4('0x16')]();});}};}function handleEntityNotFound(_0x15581b,_0x26c640){return function(_0xd335e4){if(!_0xd335e4){_0x15581b['sendStatus'](0x194);}return _0xd335e4;};}function handleError(_0x5850f2,_0x180276){_0x180276=_0x180276||0x1f4;return function(_0x9cb797){logger['error'](_0x9cb797[_0x49c4('0x20')]);if(_0x9cb797[_0x49c4('0x21')]){delete _0x9cb797[_0x49c4('0x21')];}_0x5850f2[_0x49c4('0x15')](_0x180276)['send'](_0x9cb797);};}exports['index']=function(_0x449960,_0x53c199){var _0x3800b7={},_0x3852b2={},_0x3f1708={'count':0x0,'rows':[]};var _0x372a47=_['map'](db[_0x49c4('0x22')][_0x49c4('0x23')],function(_0x46e04d){return{'name':_0x46e04d[_0x49c4('0x24')],'type':_0x46e04d[_0x49c4('0x25')][_0x49c4('0x26')]};});_0x3852b2[_0x49c4('0x27')]=_[_0x49c4('0x28')](_0x372a47,_0x49c4('0x21'));_0x3852b2[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x449960['query']);_0x3852b2['filters']=_['intersection'](_0x3852b2[_0x49c4('0x27')],_0x3852b2[_0x49c4('0x29')]);_0x3800b7[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3852b2[_0x49c4('0x27')],qs['fields'](_0x449960[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x3800b7[_0x49c4('0x2b')]=_0x3800b7[_0x49c4('0x2b')]['length']?_0x3800b7['attributes']:_0x3852b2[_0x49c4('0x27')];if(!_0x449960[_0x49c4('0x29')][_0x49c4('0x2e')](_0x49c4('0x2f'))){_0x3800b7[_0x49c4('0x30')]=qs['limit'](_0x449960[_0x49c4('0x29')][_0x49c4('0x30')]);_0x3800b7[_0x49c4('0x18')]=qs['offset'](_0x449960['query'][_0x49c4('0x18')]);}_0x3800b7[_0x49c4('0x31')]=qs[_0x49c4('0x32')](_0x449960[_0x49c4('0x29')][_0x49c4('0x32')]);_0x3800b7[_0x49c4('0x33')]=qs[_0x49c4('0x34')](_[_0x49c4('0x35')](_0x449960[_0x49c4('0x29')],_0x3852b2['filters']),_0x372a47);if(_0x449960[_0x49c4('0x29')]['filter']){_0x3800b7[_0x49c4('0x33')]=_[_0x49c4('0x36')](_0x3800b7[_0x49c4('0x33')],{'$or':_[_0x49c4('0x28')](_0x372a47,function(_0x4ed4f8){if(_0x4ed4f8[_0x49c4('0x25')]!==_0x49c4('0x37')){var _0x1c910a={};_0x1c910a[_0x4ed4f8['name']]={'$like':'%'+_0x449960[_0x49c4('0x29')][_0x49c4('0x38')]+'%'};return _0x1c910a;}})});}_0x3800b7=_[_0x49c4('0x36')]({},_0x3800b7,_0x449960[_0x49c4('0x39')]);var _0x1ba7a0={'where':_0x3800b7[_0x49c4('0x33')]};return db[_0x49c4('0x22')][_0x49c4('0x3a')](_0x1ba7a0)[_0x49c4('0x1e')](function(_0x2f1105){_0x3f1708[_0x49c4('0x3a')]=_0x2f1105;if(_0x449960['query'][_0x49c4('0x3b')]){_0x3800b7[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x22')][_0x49c4('0x3d')](_0x3800b7);})[_0x49c4('0x1e')](function(_0x29dd5d){_0x3f1708[_0x49c4('0x3e')]=_0x29dd5d;return _0x3f1708;})[_0x49c4('0x1e')](respondWithFilteredResult(_0x53c199,_0x3800b7))[_0x49c4('0x3f')](handleError(_0x53c199,null));};exports[_0x49c4('0x40')]=function(_0x2dffb4,_0xa3d59e){var _0x326142={'raw':!![],'where':{'id':_0x2dffb4[_0x49c4('0x41')]['id']}},_0x4e38bc={};_0x4e38bc['model']=_[_0x49c4('0x2a')](db[_0x49c4('0x22')][_0x49c4('0x23')]);_0x4e38bc[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x2dffb4[_0x49c4('0x29')]);_0x4e38bc['filters']=_['intersection'](_0x4e38bc[_0x49c4('0x27')],_0x4e38bc[_0x49c4('0x29')]);_0x326142[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4e38bc['model'],qs[_0x49c4('0x2d')](_0x2dffb4[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x326142[_0x49c4('0x2b')]=_0x326142[_0x49c4('0x2b')][_0x49c4('0x42')]?_0x326142[_0x49c4('0x2b')]:_0x4e38bc[_0x49c4('0x27')];if(_0x2dffb4[_0x49c4('0x29')]['includeAll']){_0x326142[_0x49c4('0x3c')]=[{'all':!![]}];}_0x326142=_['merge']({},_0x326142,_0x2dffb4[_0x49c4('0x39')]);return db[_0x49c4('0x22')][_0x49c4('0x43')](_0x326142)[_0x49c4('0x1e')](handleEntityNotFound(_0xa3d59e,null))[_0x49c4('0x1e')](respondWithResult(_0xa3d59e,null))['catch'](handleError(_0xa3d59e,null));};exports[_0x49c4('0x44')]=function(_0x15b674,_0x384862){return db[_0x49c4('0x22')][_0x49c4('0x44')](_0x15b674[_0x49c4('0x45')],{})[_0x49c4('0x1e')](respondWithResult(_0x384862,0xc9))['catch'](handleError(_0x384862,null));};exports[_0x49c4('0x1d')]=function(_0x5cfff9,_0x3f7379){if(_0x5cfff9[_0x49c4('0x45')]['id']){delete _0x5cfff9[_0x49c4('0x45')]['id'];}return db[_0x49c4('0x22')][_0x49c4('0x43')]({'where':{'id':_0x5cfff9[_0x49c4('0x41')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x3f7379,null))['then'](saveUpdates(_0x5cfff9[_0x49c4('0x45')],null))[_0x49c4('0x1e')](respondWithResult(_0x3f7379,null))['catch'](handleError(_0x3f7379,null));};exports[_0x49c4('0x1f')]=function(_0xaece5f,_0xfbe179){return db[_0x49c4('0x22')]['find']({'where':{'id':_0xaece5f['params']['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0xfbe179,null))['then'](removeEntity(_0xfbe179,null))[_0x49c4('0x3f')](handleError(_0xfbe179,null));};exports[_0x49c4('0x46')]=function(_0x3811b2,_0x23d500){return db[_0x49c4('0x22')][_0x49c4('0x46')]()[_0x49c4('0x1e')](respondWithResult(_0x23d500,null))['catch'](handleError(_0x23d500,null));};exports[_0x49c4('0x47')]=function(_0x1550ce,_0x3936d3,_0x3d944c){var _0x17ef75={'raw':!![],'where':{}};var _0x2644c0={};var _0x156748={'count':0x0,'rows':[]};return db[_0x49c4('0x22')][_0x49c4('0x48')]({'where':{'id':_0x1550ce[_0x49c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x3936d3,null))['then'](function(_0x3fd647){if(_0x3fd647){_0x2644c0[_0x49c4('0x27')]=_['keys'](db['JscriptyQuestionReport'][_0x49c4('0x23')]);_0x2644c0['query']=_['keys'](_0x1550ce[_0x49c4('0x29')]);_0x2644c0[_0x49c4('0x34')]=_[_0x49c4('0x2c')](_0x2644c0[_0x49c4('0x27')],_0x2644c0[_0x49c4('0x29')]);_0x17ef75[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x2644c0['model'],qs[_0x49c4('0x2d')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x17ef75[_0x49c4('0x2b')]=_0x17ef75[_0x49c4('0x2b')][_0x49c4('0x42')]?_0x17ef75['attributes']:_0x2644c0['model'];if(!_0x1550ce[_0x49c4('0x29')][_0x49c4('0x2e')](_0x49c4('0x2f'))){_0x17ef75[_0x49c4('0x30')]=qs[_0x49c4('0x30')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x30')]);_0x17ef75['offset']=qs[_0x49c4('0x18')](_0x1550ce[_0x49c4('0x29')]['offset']);}_0x17ef75[_0x49c4('0x31')]=qs['sort'](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x32')]);_0x17ef75[_0x49c4('0x33')]=qs[_0x49c4('0x34')](_[_0x49c4('0x35')](_0x1550ce[_0x49c4('0x29')],_0x2644c0[_0x49c4('0x34')]));_0x17ef75[_0x49c4('0x33')]['SessionId']=_0x3fd647['id'];if(_0x1550ce[_0x49c4('0x29')][_0x49c4('0x38')]){_0x17ef75['where']=_[_0x49c4('0x36')](_0x17ef75[_0x49c4('0x33')],{'$or':_['map'](_0x17ef75[_0x49c4('0x2b')],function(_0x42e0e6){var _0x4f50bf={};_0x4f50bf[_0x42e0e6]={'$like':'%'+_0x1550ce['query']['filter']+'%'};return _0x4f50bf;})});}_0x17ef75=_['merge']({},_0x17ef75,_0x1550ce[_0x49c4('0x39')]);return db['JscriptyQuestionReport'][_0x49c4('0x3a')]({'where':_0x17ef75[_0x49c4('0x33')]})['then'](function(_0x679134){_0x156748[_0x49c4('0x3a')]=_0x679134;if(_0x1550ce['query'][_0x49c4('0x3b')]){_0x17ef75[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x49')][_0x49c4('0x3d')](_0x17ef75);})['then'](function(_0x431921){_0x156748[_0x49c4('0x3e')]=_0x431921;return _0x156748;});}})[_0x49c4('0x1e')](respondWithFilteredResult(_0x3936d3,_0x17ef75))[_0x49c4('0x3f')](handleError(_0x3936d3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index fcdf9f8..6d8d7ff 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 _0xfb7b=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x5986f6,_0x503843){var _0x147203=function(_0x1cded5){while(--_0x1cded5){_0x5986f6['push'](_0x5986f6['shift']());}};_0x147203(++_0x503843);}(_0xfb7b,0x1a3));var _0xbfb7=function(_0x4849ad,_0x18d02b){_0x4849ad=_0x4849ad-0x0;var _0x2151ce=_0xfb7b[_0x4849ad];return _0x2151ce;};'use strict';var _=require(_0xbfb7('0x0'));var util=require('util');var logger=require(_0xbfb7('0x1'))(_0xbfb7('0x2'));var moment=require(_0xbfb7('0x3'));var BPromise=require('bluebird');var rp=require(_0xbfb7('0x4'));var fs=require('fs');var path=require(_0xbfb7('0x5'));var rimraf=require(_0xbfb7('0x6'));var config=require(_0xbfb7('0x7'));var attributes=require(_0xbfb7('0x8'));module[_0xbfb7('0x9')]=function(_0x2180cb,_0x12f986){return _0x2180cb[_0xbfb7('0xa')](_0xbfb7('0xb'),attributes,{'tableName':_0xbfb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe070=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions'];(function(_0x46f140,_0x365170){var _0x281a87=function(_0xe5e40e){while(--_0xe5e40e){_0x46f140['push'](_0x46f140['shift']());}};_0x281a87(++_0x365170);}(_0xe070,0x108));var _0x0e07=function(_0x36c55d,_0x1c8efa){_0x36c55d=_0x36c55d-0x0;var _0xa16625=_0xe070[_0x36c55d];return _0xa16625;};'use strict';var _=require(_0x0e07('0x0'));var util=require(_0x0e07('0x1'));var logger=require(_0x0e07('0x2'))(_0x0e07('0x3'));var moment=require(_0x0e07('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e07('0x6'));var config=require(_0x0e07('0x7'));var attributes=require(_0x0e07('0x8'));module['exports']=function(_0x5d767e,_0x419c16){return _0x5d767e[_0x0e07('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x0e07('0xa'),'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 f04c675..0b11adb 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 _0x9901=['../../config/utils','rpc','../../config/environment','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','result','catch','util','moment','bluebird','randomstring'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x9901,0xcb));var _0x1990=function(_0x528b92,_0x2a3971){_0x528b92=_0x528b92-0x0;var _0x171eba=_0x9901[_0x528b92];return _0x171eba;};'use strict';var _=require('lodash');var util=require(_0x1990('0x0'));var moment=require(_0x1990('0x1'));var BPromise=require(_0x1990('0x2'));var rs=require(_0x1990('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1990('0x4'));var logger=require('../../config/logger')(_0x1990('0x5'));var config=require(_0x1990('0x6'));var jayson=require(_0x1990('0x7'));var client=jayson[_0x1990('0x8')][_0x1990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547543,_0x3b260c,_0xfd9513){return new BPromise(function(_0x33f5f4,_0x3a464f){return client[_0x1990('0xa')](_0x547543,_0xfd9513)[_0x1990('0xb')](function(_0x19a686){logger[_0x1990('0xc')](_0x1990('0xd'),_0x3b260c,_0x1990('0xe'));logger[_0x1990('0xf')](_0x1990('0x10'),_0x3b260c,'request\x20sent',JSON[_0x1990('0x11')](_0x19a686));if(_0x19a686['error']){if(_0x19a686[_0x1990('0x12')][_0x1990('0x13')]===0x1f4){logger[_0x1990('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b260c,_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);return _0x3a464f(_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);}logger['error'](_0x1990('0xd'),_0x3b260c,_0x19a686[_0x1990('0x12')][_0x1990('0x14')]);return _0x33f5f4(_0x19a686['error']['message']);}else{logger[_0x1990('0xc')](_0x1990('0xd'),_0x3b260c,'request\x20sent');_0x33f5f4(_0x19a686[_0x1990('0x15')][_0x1990('0x14')]);}})[_0x1990('0x16')](function(_0x578e56){logger[_0x1990('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b260c,_0x578e56);_0x3a464f(_0x578e56);});});} \ No newline at end of file +var _0xb74d=['request\x20sent','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb74d,0x16e));var _0xdb74=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xb74d[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xdb74('0x0'));var util=require('util');var moment=require(_0xdb74('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb74('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb74('0x3'))['db'];var utils=require(_0xdb74('0x4'));var logger=require(_0xdb74('0x5'))('rpc');var config=require(_0xdb74('0x6'));var jayson=require(_0xdb74('0x7'));var client=jayson[_0xdb74('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5183ae,_0xfc6f47,_0x4bf15e){return new BPromise(function(_0x3e44b7,_0x2655f3){return client['request'](_0x5183ae,_0x4bf15e)[_0xdb74('0x9')](function(_0x5370df){logger[_0xdb74('0xa')](_0xdb74('0xb'),_0xfc6f47,'request\x20sent');logger[_0xdb74('0xc')](_0xdb74('0xd'),_0xfc6f47,_0xdb74('0xe'),JSON['stringify'](_0x5370df));if(_0x5370df['error']){if(_0x5370df[_0xdb74('0xf')][_0xdb74('0x10')]===0x1f4){logger[_0xdb74('0xf')](_0xdb74('0xb'),_0xfc6f47,_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);return _0x2655f3(_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);}logger[_0xdb74('0xf')](_0xdb74('0xb'),_0xfc6f47,_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);return _0x3e44b7(_0x5370df[_0xdb74('0xf')]['message']);}else{logger[_0xdb74('0xa')](_0xdb74('0xb'),_0xfc6f47,_0xdb74('0xe'));_0x3e44b7(_0x5370df[_0xdb74('0x12')]['message']);}})['catch'](function(_0xc9548c){logger[_0xdb74('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xfc6f47,_0xc9548c);_0x2655f3(_0xc9548c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8c3c9bb..5b14fe9 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 _0xfb42=['../../components/interaction/service','./license.controller','index','put','/:id','exports','multer','express','Router','../../components/auth/service'];(function(_0x34cc0c,_0xd23b3c){var _0x3a363b=function(_0x8fb866){while(--_0x8fb866){_0x34cc0c['push'](_0x34cc0c['shift']());}};_0x3a363b(++_0xd23b3c);}(_0xfb42,0x132));var _0x2fb4=function(_0x13c69c,_0x3fce43){_0x13c69c=_0x13c69c-0x0;var _0x16e915=_0xfb42[_0x13c69c];return _0x16e915;};'use strict';var multer=require(_0x2fb4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fb4('0x1'));var router=express[_0x2fb4('0x2')]();var auth=require(_0x2fb4('0x3'));var interaction=require(_0x2fb4('0x4'));var config=require('../../config/environment');var controller=require(_0x2fb4('0x5'));router['get']('/',controller[_0x2fb4('0x6')]);router[_0x2fb4('0x7')](_0x2fb4('0x8'),auth['isAuthenticated'](),controller['update']);module[_0x2fb4('0x9')]=router; \ No newline at end of file +var _0x27ec=['connect-timeout','Router','../../components/auth/service','../../config/environment','get','put','isAuthenticated','update','exports','multer','util','path'];(function(_0xbd7b9b,_0x2a63d0){var _0x118910=function(_0xe2a59b){while(--_0xe2a59b){_0xbd7b9b['push'](_0xbd7b9b['shift']());}};_0x118910(++_0x2a63d0);}(_0x27ec,0x69));var _0xc27e=function(_0x5ffa2f,_0x1ba01c){_0x5ffa2f=_0x5ffa2f-0x0;var _0x3d7cd0=_0x27ec[_0x5ffa2f];return _0x3d7cd0;};'use strict';var multer=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var path=require(_0xc27e('0x2'));var timeout=require(_0xc27e('0x3'));var express=require('express');var router=express[_0xc27e('0x4')]();var auth=require(_0xc27e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc27e('0x6'));var controller=require('./license.controller');router[_0xc27e('0x7')]('/',controller['index']);router[_0xc27e('0x8')]('/:id',auth[_0xc27e('0x9')](),controller[_0xc27e('0xa')]);module[_0xc27e('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 1f4e19d..d568122 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 _0x326f=['STRING','INTEGER','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x326f,0xd1));var _0xf326=function(_0x37eaee,_0x58be87){_0x37eaee=_0x37eaee-0x0;var _0x43bb67=_0x326f[_0x37eaee];return _0x43bb67;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31f0=['TEXT','STRING','INTEGER','sequelize'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x31f0,0xb7));var _0x031f=function(_0x3ec68d,_0x223592){_0x3ec68d=_0x3ec68d-0x0;var _0x32105a=_0x31f0[_0x3ec68d];return _0x32105a;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'license':{'type':Sequelize[_0x031f('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x031f('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x031f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e108719..ed86c7b 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 _0xf6d1=['apply','save','update','then','destroy','error','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','getLicense','catch','body','find','params','get','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6d1,0x99));var _0x1f6d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf6d1[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0x1f6d('0x0'));var emlformat=require(_0x1f6d('0x1'));var rimraf=require(_0x1f6d('0x2'));var zipdir=require(_0x1f6d('0x3'));var jsonpatch=require(_0x1f6d('0x4'));var rp=require(_0x1f6d('0x5'));var moment=require(_0x1f6d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1f6d('0x7'));var util=require('util');var path=require(_0x1f6d('0x8'));var sox=require(_0x1f6d('0x9'));var csv=require(_0x1f6d('0xa'));var ejs=require(_0x1f6d('0xb'));var fs=require('fs');var _=require(_0x1f6d('0xc'));var squel=require(_0x1f6d('0xd'));var crypto=require(_0x1f6d('0xe'));var jsforce=require(_0x1f6d('0xf'));var deskjs=require(_0x1f6d('0x10'));var toCsv=require(_0x1f6d('0xa'));var querystring=require(_0x1f6d('0x11'));var Papa=require(_0x1f6d('0x12'));var Redis=require('ioredis');var authService=require(_0x1f6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1f6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6d('0x15'))(_0x1f6d('0x16'));var utils=require(_0x1f6d('0x17'));var config=require(_0x1f6d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45826e,_0x10975c){_0x10975c=_0x10975c||0xcc;return function(_0x1017b4){if(_0x1017b4){return _0x45826e[_0x1f6d('0x19')](_0x10975c);}return _0x45826e[_0x1f6d('0x1a')](_0x10975c)[_0x1f6d('0x1b')]();};}function respondWithResult(_0x24d3d8,_0x3d88da){_0x3d88da=_0x3d88da||0xc8;return function(_0x35d9eb){if(_0x35d9eb){return _0x24d3d8[_0x1f6d('0x1a')](_0x3d88da)['json'](_0x35d9eb);}};}function respondWithFilteredResult(_0x33f334,_0x43d3b6){return function(_0x43e1bf){if(_0x43e1bf){var _0x4fe53a=_0x43e1bf[_0x1f6d('0x1c')],_0x2b867a=_0x43d3b6[_0x1f6d('0x1d')],_0x309aa9=_0x43d3b6[_0x1f6d('0x1d')]+_0x43d3b6[_0x1f6d('0x1e')],_0x58b375;if(_0x309aa9>=_0x4fe53a){_0x309aa9=_0x4fe53a;_0x58b375=0xc8;}else{_0x58b375=0xce;}_0x33f334[_0x1f6d('0x1a')](_0x58b375);return _0x33f334[_0x1f6d('0x1f')]('Content-Range',_0x2b867a+'-'+_0x309aa9+'/'+_0x4fe53a)[_0x1f6d('0x20')](_0x43e1bf);}return null;};}function patchUpdates(_0x5cf52e){return function(_0x2cd064){try{jsonpatch[_0x1f6d('0x21')](_0x2cd064,_0x5cf52e,!![]);}catch(_0x251a17){return BPromise['reject'](_0x251a17);}return _0x2cd064[_0x1f6d('0x22')]();};}function saveUpdates(_0x19e32a,_0x4a55ae){return function(_0x4f4de4){if(_0x4f4de4){return _0x4f4de4[_0x1f6d('0x23')](_0x19e32a)[_0x1f6d('0x24')](function(_0x1beca9){return _0x1beca9;});}return null;};}function removeEntity(_0x499257,_0xeeb6d7){return function(_0x564c36){if(_0x564c36){return _0x564c36[_0x1f6d('0x25')]()[_0x1f6d('0x24')](function(){_0x499257['status'](0xcc)[_0x1f6d('0x1b')]();});}};}function handleEntityNotFound(_0x1bce2a,_0x2696de){return function(_0x4ff7f9){if(!_0x4ff7f9){_0x1bce2a[_0x1f6d('0x19')](0x194);}return _0x4ff7f9;};}function handleError(_0x46b0a8,_0x24543f){_0x24543f=_0x24543f||0x1f4;return function(_0x2cce5e){logger[_0x1f6d('0x26')](_0x2cce5e['stack']);if(_0x2cce5e['name']){delete _0x2cce5e[_0x1f6d('0x27')];}_0x46b0a8[_0x1f6d('0x1a')](_0x24543f)[_0x1f6d('0x28')](_0x2cce5e);};}var utilLicense=require(_0x1f6d('0x29'));exports[_0x1f6d('0x2a')]=function(_0x4750d4,_0x180286){var _0x3718dc={'raw':!![],'where':{'id':0x1}},_0x31dca9={};_0x31dca9[_0x1f6d('0x2b')]=_[_0x1f6d('0x2c')](db[_0x1f6d('0x2d')][_0x1f6d('0x2e')]);_0x31dca9['query']=_[_0x1f6d('0x2c')](_0x4750d4[_0x1f6d('0x2f')]);_0x31dca9[_0x1f6d('0x30')]=_[_0x1f6d('0x31')](_0x31dca9[_0x1f6d('0x2b')],_0x31dca9[_0x1f6d('0x2f')]);_0x3718dc['attributes']=_[_0x1f6d('0x31')](_0x31dca9['model'],qs['fields'](_0x4750d4[_0x1f6d('0x2f')][_0x1f6d('0x32')]));_0x3718dc[_0x1f6d('0x33')]=_0x3718dc['attributes'][_0x1f6d('0x34')]?_0x3718dc['attributes']:_0x31dca9[_0x1f6d('0x2b')];_0x3718dc=_[_0x1f6d('0x35')]({},_0x3718dc,_0x4750d4['options']);return utilLicense[_0x1f6d('0x36')](_0x3718dc)['then'](respondWithResult(_0x180286,null))[_0x1f6d('0x37')](handleError(_0x180286,null));};exports[_0x1f6d('0x23')]=function(_0x3e490c,_0x3a3ecb){if(_0x3e490c[_0x1f6d('0x38')]['id']){delete _0x3e490c['body']['id'];}return db[_0x1f6d('0x2d')][_0x1f6d('0x39')]({'where':{'id':_0x3e490c[_0x1f6d('0x3a')]['id']}})[_0x1f6d('0x24')](handleEntityNotFound(_0x3a3ecb,null))[_0x1f6d('0x24')](function(_0xefcfa9){var _0x556714=_0xefcfa9[_0x1f6d('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x556714,_0x3e490c[_0x1f6d('0x38')][_0x1f6d('0x3c')]);})[_0x1f6d('0x24')](function(_0x28d899){if(!_0x28d899[_0x1f6d('0x3d')]){return saveUpdates(_0x3e490c[_0x1f6d('0x38')],null);}return _0x28d899;})['then'](respondWithResult(_0x3a3ecb,null))[_0x1f6d('0x37')](handleError(_0x3a3ecb,null));}; \ No newline at end of file +var _0xdb2a=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','query','filters','attributes','intersection','fields','merge','options','update','body','License','params','get','demo','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xdb2a,0x16f));var _0xadb2=function(_0x10490a,_0x53a83d){_0x10490a=_0x10490a-0x0;var _0x3a3ce7=_0xdb2a[_0x10490a];return _0x3a3ce7;};'use strict';var pdf=require(_0xadb2('0x0'));var emlformat=require(_0xadb2('0x1'));var rimraf=require(_0xadb2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadb2('0x3'));var moment=require(_0xadb2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xadb2('0x5'));var util=require('util');var path=require(_0xadb2('0x6'));var sox=require(_0xadb2('0x7'));var csv=require(_0xadb2('0x8'));var ejs=require(_0xadb2('0x9'));var fs=require('fs');var _=require(_0xadb2('0xa'));var squel=require('squel');var crypto=require(_0xadb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xadb2('0xc'));var toCsv=require(_0xadb2('0x8'));var querystring=require(_0xadb2('0xd'));var Papa=require('papaparse');var Redis=require(_0xadb2('0xe'));var authService=require(_0xadb2('0xf'));var qs=require(_0xadb2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadb2('0x11'));var logger=require('../../config/logger')(_0xadb2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xadb2('0x13'));var db=require(_0xadb2('0x14'))['db'];function respondWithStatusCode(_0x13cf18,_0x6fbe0e){_0x6fbe0e=_0x6fbe0e||0xcc;return function(_0x4a2641){if(_0x4a2641){return _0x13cf18[_0xadb2('0x15')](_0x6fbe0e);}return _0x13cf18[_0xadb2('0x16')](_0x6fbe0e)[_0xadb2('0x17')]();};}function respondWithResult(_0x3d746e,_0x157e51){_0x157e51=_0x157e51||0xc8;return function(_0x40a41e){if(_0x40a41e){return _0x3d746e[_0xadb2('0x16')](_0x157e51)[_0xadb2('0x18')](_0x40a41e);}};}function respondWithFilteredResult(_0x22c30c,_0x52152f){return function(_0x380538){if(_0x380538){var _0x189bf8=_0x380538[_0xadb2('0x19')],_0x5a8a53=_0x52152f[_0xadb2('0x1a')],_0x31ddf1=_0x52152f[_0xadb2('0x1a')]+_0x52152f['limit'],_0x5b9662;if(_0x31ddf1>=_0x189bf8){_0x31ddf1=_0x189bf8;_0x5b9662=0xc8;}else{_0x5b9662=0xce;}_0x22c30c[_0xadb2('0x16')](_0x5b9662);return _0x22c30c[_0xadb2('0x1b')](_0xadb2('0x1c'),_0x5a8a53+'-'+_0x31ddf1+'/'+_0x189bf8)['json'](_0x380538);}return null;};}function patchUpdates(_0x972036){return function(_0x1e3c88){try{jsonpatch[_0xadb2('0x1d')](_0x1e3c88,_0x972036,!![]);}catch(_0x1eeefb){return BPromise[_0xadb2('0x1e')](_0x1eeefb);}return _0x1e3c88[_0xadb2('0x1f')]();};}function saveUpdates(_0xca90c4,_0x2fe01f){return function(_0x263014){if(_0x263014){return _0x263014['update'](_0xca90c4)[_0xadb2('0x20')](function(_0x3ab97e){return _0x3ab97e;});}return null;};}function removeEntity(_0x5ca203,_0x2f7d58){return function(_0x3591d0){if(_0x3591d0){return _0x3591d0[_0xadb2('0x21')]()['then'](function(){_0x5ca203[_0xadb2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6011,_0x33be36){return function(_0x408f3d){if(!_0x408f3d){_0x2f6011[_0xadb2('0x15')](0x194);}return _0x408f3d;};}function handleError(_0x24eb18,_0x1f1575){_0x1f1575=_0x1f1575||0x1f4;return function(_0x20dd83){logger[_0xadb2('0x22')](_0x20dd83[_0xadb2('0x23')]);if(_0x20dd83[_0xadb2('0x24')]){delete _0x20dd83['name'];}_0x24eb18['status'](_0x1f1575)[_0xadb2('0x25')](_0x20dd83);};}var utilLicense=require(_0xadb2('0x13'));exports[_0xadb2('0x26')]=function(_0x37b178,_0x421f05){var _0xec066a={'raw':!![],'where':{'id':0x1}},_0x39819f={};_0x39819f[_0xadb2('0x27')]=_[_0xadb2('0x28')](db['License']['rawAttributes']);_0x39819f[_0xadb2('0x29')]=_['keys'](_0x37b178['query']);_0x39819f[_0xadb2('0x2a')]=_['intersection'](_0x39819f['model'],_0x39819f[_0xadb2('0x29')]);_0xec066a[_0xadb2('0x2b')]=_[_0xadb2('0x2c')](_0x39819f[_0xadb2('0x27')],qs[_0xadb2('0x2d')](_0x37b178[_0xadb2('0x29')][_0xadb2('0x2d')]));_0xec066a[_0xadb2('0x2b')]=_0xec066a[_0xadb2('0x2b')]['length']?_0xec066a[_0xadb2('0x2b')]:_0x39819f[_0xadb2('0x27')];_0xec066a=_[_0xadb2('0x2e')]({},_0xec066a,_0x37b178[_0xadb2('0x2f')]);return utilLicense['getLicense'](_0xec066a)[_0xadb2('0x20')](respondWithResult(_0x421f05,null))['catch'](handleError(_0x421f05,null));};exports[_0xadb2('0x30')]=function(_0x2d8cf3,_0xaa3a0a){if(_0x2d8cf3[_0xadb2('0x31')]['id']){delete _0x2d8cf3[_0xadb2('0x31')]['id'];}return db[_0xadb2('0x32')]['find']({'where':{'id':_0x2d8cf3[_0xadb2('0x33')]['id']}})[_0xadb2('0x20')](handleEntityNotFound(_0xaa3a0a,null))[_0xadb2('0x20')](function(_0x411dcd){var _0x448676=_0x411dcd[_0xadb2('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x448676,_0x2d8cf3['body']['key']);})['then'](function(_0x468be3){if(!_0x468be3[_0xadb2('0x35')]){return saveUpdates(_0x2d8cf3[_0xadb2('0x31')],null);}return _0x468be3;})['then'](respondWithResult(_0xaa3a0a,null))['catch'](handleError(_0xaa3a0a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5654f99..ccfe3e8 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 _0xc70b=['define','License','license','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports'];(function(_0x192d7b,_0x538578){var _0x46d59f=function(_0x654622){while(--_0x654622){_0x192d7b['push'](_0x192d7b['shift']());}};_0x46d59f(++_0x538578);}(_0xc70b,0x13b));var _0xbc70=function(_0x181ec0,_0x550161){_0x181ec0=_0x181ec0-0x0;var _0x3b0b70=_0xc70b[_0x181ec0];return _0x3b0b70;};'use strict';var _=require(_0xbc70('0x0'));var util=require('util');var logger=require(_0xbc70('0x1'))('api');var moment=require(_0xbc70('0x2'));var BPromise=require(_0xbc70('0x3'));var rp=require(_0xbc70('0x4'));var fs=require('fs');var path=require(_0xbc70('0x5'));var rimraf=require(_0xbc70('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc70('0x7'));module[_0xbc70('0x8')]=function(_0x3722cd,_0x3a29ec){return _0x3722cd[_0xbc70('0x9')](_0xbc70('0xa'),attributes,{'tableName':_0xbc70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a8e=['moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','util','api'];(function(_0x156854,_0x1a7e34){var _0x10c4fb=function(_0x56e121){while(--_0x56e121){_0x156854['push'](_0x156854['shift']());}};_0x10c4fb(++_0x1a7e34);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x39414d,_0x26b932){_0x39414d=_0x39414d-0x0;var _0x5e2c82=_0x6a8e[_0x39414d];return _0x5e2c82;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index fff4c22..d9f4f88 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 _0xf9bc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x2ae89f,_0x470a01){_0x2ae89f=_0x2ae89f-0x0;var _0x333ebc=_0xf9bc[_0x2ae89f];return _0x333ebc;};'use strict';var _=require('lodash');var util=require(_0xcf9b('0x0'));var moment=require(_0xcf9b('0x1'));var BPromise=require(_0xcf9b('0x2'));var rs=require(_0xcf9b('0x3'));var fs=require('fs');var Redis=require(_0xcf9b('0x4'));var db=require(_0xcf9b('0x5'))['db'];var utils=require(_0xcf9b('0x6'));var logger=require(_0xcf9b('0x7'))(_0xcf9b('0x8'));var config=require(_0xcf9b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba407,_0xbf765c,_0x2493f0){return new BPromise(function(_0x1ec363,_0x2c0e77){return client[_0xcf9b('0xb')](_0x2ba407,_0x2493f0)[_0xcf9b('0xc')](function(_0x3447ef){logger['info'](_0xcf9b('0xd'),_0xbf765c,_0xcf9b('0xe'));logger['debug'](_0xcf9b('0xf'),_0xbf765c,'request\x20sent',JSON['stringify'](_0x3447ef));if(_0x3447ef['error']){if(_0x3447ef[_0xcf9b('0x10')]['code']===0x1f4){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x2c0e77(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x1ec363(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}else{logger[_0xcf9b('0x12')]('License,\x20%s,\x20%s',_0xbf765c,'request\x20sent');_0x1ec363(_0x3447ef[_0xcf9b('0x13')][_0xcf9b('0x11')]);}})[_0xcf9b('0x14')](function(_0x3276a8){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3276a8);_0x2c0e77(_0x3276a8);});});} \ No newline at end of file +var _0x115a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x115a,0x91));var _0xa115=function(_0x31c93b,_0x37c4af){_0x31c93b=_0x31c93b-0x0;var _0x20018e=_0x115a[_0x31c93b];return _0x20018e;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567cb3,_0x2499eb,_0x149d01){return new BPromise(function(_0x291bec,_0x2a7527){return client[_0xa115('0xc')](_0x567cb3,_0x149d01)[_0xa115('0xd')](function(_0xd6f607){logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));logger[_0xa115('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x2499eb,_0xa115('0x10'),JSON[_0xa115('0x12')](_0xd6f607));if(_0xd6f607[_0xa115('0x13')]){if(_0xd6f607[_0xa115('0x13')]['code']===0x1f4){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x2a7527(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}logger[_0xa115('0x13')]('License,\x20%s,\x20%s',_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x291bec(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}else{logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));_0x291bec(_0xd6f607[_0xa115('0x15')][_0xa115('0x14')]);}})[_0xa115('0x16')](function(_0x30c06b){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0x30c06b);_0x2a7527(_0x30c06b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2fb4d71..9c17611 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 _0x3665=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','/:id/canned_answers','addAnswer','post','/:id/in_servers','/:id/applications','addApplications','/:id/send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','destroy','/:id/users','removeAgents','exports','multer','util'];(function(_0x5e7a05,_0x19c092){var _0x3c4788=function(_0x669da2){while(--_0x669da2){_0x5e7a05['push'](_0x5e7a05['shift']());}};_0x3c4788(++_0x19c092);}(_0x3665,0x1d7));var _0x5366=function(_0x3405cb,_0x19ddc7){_0x3405cb=_0x3405cb-0x0;var _0x29810c=_0x3665[_0x3405cb];return _0x29810c;};'use strict';var multer=require(_0x5366('0x0'));var util=require(_0x5366('0x1'));var path=require(_0x5366('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5366('0x3')]();var auth=require(_0x5366('0x4'));var interaction=require(_0x5366('0x5'));var config=require(_0x5366('0x6'));var controller=require(_0x5366('0x7'));router[_0x5366('0x8')]('/',auth[_0x5366('0x9')](),controller[_0x5366('0xa')]);router[_0x5366('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5366('0x8')]('/:id',auth[_0x5366('0x9')](),controller[_0x5366('0xb')]);router[_0x5366('0x8')](_0x5366('0xc'),auth['isAuthenticated'](),controller[_0x5366('0xd')]);router[_0x5366('0x8')]('/:id/canned_answers',auth[_0x5366('0x9')](),controller['getAnswers']);router[_0x5366('0x8')]('/:id/in_servers',auth[_0x5366('0x9')](),controller[_0x5366('0xe')]);router['get'](_0x5366('0xf'),auth[_0x5366('0x9')](),controller[_0x5366('0x10')]);router[_0x5366('0x8')](_0x5366('0x11'),auth[_0x5366('0x9')](),controller[_0x5366('0x12')]);router['get']('/:id/applications',auth[_0x5366('0x9')](),controller[_0x5366('0x13')]);router['get'](_0x5366('0x14'),auth[_0x5366('0x9')](),controller[_0x5366('0x15')]);router['get']('/:id/verify',auth[_0x5366('0x9')](),controller[_0x5366('0x16')]);router[_0x5366('0x8')]('/:id/users',auth[_0x5366('0x9')](),controller[_0x5366('0x17')]);router['post'](_0x5366('0xc'),auth[_0x5366('0x9')](),controller['addDisposition']);router['post'](_0x5366('0x18'),auth[_0x5366('0x9')](),controller[_0x5366('0x19')]);router['post']('/',auth[_0x5366('0x9')](),controller['create']);router[_0x5366('0x1a')](_0x5366('0x1b'),auth[_0x5366('0x9')](),controller['addImap']);router['post'](_0x5366('0xf'),auth[_0x5366('0x9')](),controller['addSmtp']);router[_0x5366('0x1a')](_0x5366('0x11'),auth[_0x5366('0x9')](),controller['addInteraction']);router[_0x5366('0x1a')](_0x5366('0x1c'),auth['isAuthenticated'](),controller[_0x5366('0x1d')]);router[_0x5366('0x1a')](_0x5366('0x1e'),auth[_0x5366('0x9')](),controller['send']);router[_0x5366('0x1a')]('/:id/users',auth[_0x5366('0x9')](),controller[_0x5366('0x1f')]);router[_0x5366('0x20')](_0x5366('0x21'),auth[_0x5366('0x9')](),controller[_0x5366('0x22')]);router[_0x5366('0x23')](_0x5366('0xc'),auth[_0x5366('0x9')](),controller[_0x5366('0x24')]);router[_0x5366('0x23')](_0x5366('0x18'),auth[_0x5366('0x9')](),controller[_0x5366('0x25')]);router['delete'](_0x5366('0x1b'),auth[_0x5366('0x9')](),controller[_0x5366('0x26')]);router[_0x5366('0x23')](_0x5366('0xf'),auth[_0x5366('0x9')](),controller['removeSmtp']);router[_0x5366('0x23')](_0x5366('0x21'),auth[_0x5366('0x9')](),controller[_0x5366('0x27')]);router[_0x5366('0x23')](_0x5366('0x28'),auth[_0x5366('0x9')](),controller[_0x5366('0x29')]);module[_0x5366('0x2a')]=router; \ No newline at end of file +var _0xcedf=['post','/:id/dispositions','addDisposition','addAnswer','/:id/out_servers','addSmtp','addInteraction','addApplications','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./mailAccount.controller','isAuthenticated','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents'];(function(_0x262a19,_0x534cf7){var _0x2fcdc0=function(_0x4901ce){while(--_0x4901ce){_0x262a19['push'](_0x262a19['shift']());}};_0x2fcdc0(++_0x534cf7);}(_0xcedf,0x1b6));var _0xfced=function(_0x342a32,_0x8aeac1){_0x342a32=_0x342a32-0x0;var _0x4f52fd=_0xcedf[_0x342a32];return _0x4f52fd;};'use strict';var multer=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var path=require(_0xfced('0x2'));var timeout=require(_0xfced('0x3'));var express=require('express');var router=express[_0xfced('0x4')]();var auth=require(_0xfced('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfced('0x6'));router['get']('/',auth[_0xfced('0x7')](),controller['index']);router[_0xfced('0x8')]('/describe',auth[_0xfced('0x7')](),controller['describe']);router['get'](_0xfced('0x9'),auth[_0xfced('0x7')](),controller[_0xfced('0xa')]);router[_0xfced('0x8')]('/:id/dispositions',auth[_0xfced('0x7')](),controller[_0xfced('0xb')]);router[_0xfced('0x8')](_0xfced('0xc'),auth[_0xfced('0x7')](),controller[_0xfced('0xd')]);router[_0xfced('0x8')](_0xfced('0xe'),auth[_0xfced('0x7')](),controller['getImap']);router[_0xfced('0x8')]('/:id/out_servers',auth[_0xfced('0x7')](),controller[_0xfced('0xf')]);router[_0xfced('0x8')](_0xfced('0x10'),auth['isAuthenticated'](),controller[_0xfced('0x11')]);router[_0xfced('0x8')](_0xfced('0x12'),auth[_0xfced('0x7')](),controller[_0xfced('0x13')]);router[_0xfced('0x8')](_0xfced('0x14'),auth[_0xfced('0x7')](),controller['getMessages']);router[_0xfced('0x8')]('/:id/verify',auth[_0xfced('0x7')](),controller[_0xfced('0x15')]);router[_0xfced('0x8')](_0xfced('0x16'),auth[_0xfced('0x7')](),controller[_0xfced('0x17')]);router[_0xfced('0x18')](_0xfced('0x19'),auth[_0xfced('0x7')](),controller[_0xfced('0x1a')]);router['post'](_0xfced('0xc'),auth[_0xfced('0x7')](),controller[_0xfced('0x1b')]);router[_0xfced('0x18')]('/',auth[_0xfced('0x7')](),controller['create']);router['post'](_0xfced('0xe'),auth[_0xfced('0x7')](),controller['addImap']);router[_0xfced('0x18')](_0xfced('0x1c'),auth[_0xfced('0x7')](),controller[_0xfced('0x1d')]);router[_0xfced('0x18')](_0xfced('0x10'),auth['isAuthenticated'](),controller[_0xfced('0x1e')]);router[_0xfced('0x18')](_0xfced('0x12'),auth[_0xfced('0x7')](),controller[_0xfced('0x1f')]);router['post']('/:id/send',auth[_0xfced('0x7')](),controller[_0xfced('0x20')]);router[_0xfced('0x18')](_0xfced('0x16'),auth['isAuthenticated'](),controller[_0xfced('0x21')]);router['put']('/:id',auth[_0xfced('0x7')](),controller[_0xfced('0x22')]);router['delete'](_0xfced('0x19'),auth['isAuthenticated'](),controller[_0xfced('0x23')]);router[_0xfced('0x24')](_0xfced('0xc'),auth[_0xfced('0x7')](),controller['removeAnswers']);router[_0xfced('0x24')](_0xfced('0xe'),auth[_0xfced('0x7')](),controller[_0xfced('0x25')]);router['delete'](_0xfced('0x1c'),auth[_0xfced('0x7')](),controller[_0xfced('0x26')]);router['delete'](_0xfced('0x9'),auth[_0xfced('0x7')](),controller[_0xfced('0x27')]);router[_0xfced('0x24')](_0xfced('0x16'),auth[_0xfced('0x7')](),controller[_0xfced('0x28')]);module[_0xfced('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 02f8902..a79759c 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 _0x0781=['STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0781,0x77));var _0x1078=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0781[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1078('0x0'));module[_0x1078('0x1')]={'description':{'type':Sequelize[_0x1078('0x2')]},'name':{'type':Sequelize[_0x1078('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1078('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1078('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1078('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1078('0x4')]},'markAsUnread':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1078('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x1078('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1078('0x4')],'defaultValue':function(){return _0x1078('0x6');}},'notificationSound':{'type':Sequelize[_0x1078('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1078('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1078('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1078('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1078('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x213607){if(!_0x213607)this[_0x1078('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1078('0xa'),_0x213607);}}}; \ No newline at end of file +var _0xb06c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x5aba09,_0x5b2c04){var _0x42e5bd=function(_0x4d8a30){while(--_0x4d8a30){_0x5aba09['push'](_0x5aba09['shift']());}};_0x42e5bd(++_0x5b2c04);}(_0xb06c,0x12d));var _0xcb06=function(_0x6e43e5,_0x109a2a){_0x6e43e5=_0x6e43e5-0x0;var _0x53fff5=_0xb06c[_0x6e43e5];return _0x53fff5;};'use strict';var Sequelize=require(_0xcb06('0x0'));module['exports']={'description':{'type':Sequelize[_0xcb06('0x1')]},'name':{'type':Sequelize[_0xcb06('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcb06('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xcb06('0x2')]},'markAsUnread':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcb06('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xcb06('0x4')](0x2)[_0xcb06('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcb06('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb06('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcb06('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5af730){if(!_0x5af730)this[_0xcb06('0x8')](_0xcb06('0x9'),null);this['setDataValue'](_0xcb06('0xa'),_0x5af730);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 144bfec..be21c70 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 _0x3a0f=['VIRTUAL','options','MailAccount','includeAll','findAll','rows','params','MailServerIn','MailServerOut','update','body','find','Smtp','describe','addDisposition','MailAccountId','Disposition','create','findOne','include','ids','addAnswer','CannedAnswer','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','List','updatedAt','DESC','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','Contacts','defaults','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','./mailAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','MailAccounts','stack','name','index','Imap','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x147f18,_0x1854a5){var _0x5484af=function(_0x7a85a5){while(--_0x7a85a5){_0x147f18['push'](_0x147f18['shift']());}};_0x5484af(++_0x1854a5);}(_0x3a0f,0x136));var _0xf3a0=function(_0x1f2341,_0x2dae57){_0x1f2341=_0x1f2341-0x0;var _0x1db239=_0x3a0f[_0x1f2341];return _0x1db239;};'use strict';var pdf=require(_0xf3a0('0x0'));var emlformat=require(_0xf3a0('0x1'));var rimraf=require(_0xf3a0('0x2'));var zipdir=require(_0xf3a0('0x3'));var jsonpatch=require(_0xf3a0('0x4'));var rp=require(_0xf3a0('0x5'));var moment=require(_0xf3a0('0x6'));var BPromise=require(_0xf3a0('0x7'));var Mustache=require(_0xf3a0('0x8'));var util=require('util');var path=require(_0xf3a0('0x9'));var sox=require(_0xf3a0('0xa'));var csv=require('to-csv');var ejs=require(_0xf3a0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf3a0('0xc'));var crypto=require(_0xf3a0('0xd'));var jsforce=require(_0xf3a0('0xe'));var deskjs=require(_0xf3a0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3a0('0x10'));var Papa=require(_0xf3a0('0x11'));var Redis=require('ioredis');var authService=require(_0xf3a0('0x12'));var qs=require(_0xf3a0('0x13'));var as=require(_0xf3a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3a0('0x15'))(_0xf3a0('0x16'));var utils=require(_0xf3a0('0x17'));var config=require(_0xf3a0('0x18'));var licenseUtil=require(_0xf3a0('0x19'));var db=require('../../mysqldb')['db'];config[_0xf3a0('0x1a')]=_['defaults'](config[_0xf3a0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a0('0x1a')]));require(_0xf3a0('0x1b'))[_0xf3a0('0x1c')](socket);var jayson=require(_0xf3a0('0x1d'));var client=jayson[_0xf3a0('0x1e')][_0xf3a0('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x12fe4f,_0x19eab2,_0x1d9278,_0x104af5){return new BPromise(function(_0x58df4b,_0x128dca){var _0x20c511=_0x104af5||client;return _0x20c511[_0xf3a0('0x20')](_0x12fe4f,_0x1d9278)[_0xf3a0('0x21')](function(_0x4a5a55){logger['info']('MailAccount,\x20%s,\x20%s',_0x19eab2,_0xf3a0('0x22'));logger[_0xf3a0('0x23')](_0xf3a0('0x24'),_0x19eab2,_0xf3a0('0x22'),JSON['stringify'](_0x4a5a55));if(_0x4a5a55[_0xf3a0('0x25')]){if(_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x26')]===0x1f4){logger[_0xf3a0('0x25')](_0xf3a0('0x27'),_0x19eab2,_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x28')]);return _0x128dca(_0x4a5a55[_0xf3a0('0x25')][_0xf3a0('0x28')]);}logger['error'](_0xf3a0('0x27'),_0x19eab2,_0x4a5a55[_0xf3a0('0x25')]['message']);return _0x58df4b(_0x4a5a55['error'][_0xf3a0('0x28')]);}else{logger['info'](_0xf3a0('0x27'),_0x19eab2,_0xf3a0('0x22'));_0x58df4b(_0x4a5a55[_0xf3a0('0x29')][_0xf3a0('0x28')]);}})[_0xf3a0('0x2a')](function(_0x1599c7){logger['error'](_0xf3a0('0x27'),_0x19eab2,_0x1599c7);_0x128dca(_0x1599c7);});});}function respondWithStatusCode(_0x1492d1,_0x2de4b6){_0x2de4b6=_0x2de4b6||0xcc;return function(_0x548215){if(_0x548215){return _0x1492d1[_0xf3a0('0x2b')](_0x2de4b6);}return _0x1492d1[_0xf3a0('0x2c')](_0x2de4b6)[_0xf3a0('0x2d')]();};}function respondWithResult(_0x1fb0a6,_0x3445b9){_0x3445b9=_0x3445b9||0xc8;return function(_0x2336bf){if(_0x2336bf){return _0x1fb0a6['status'](_0x3445b9)[_0xf3a0('0x2e')](_0x2336bf);}};}function respondWithFilteredResult(_0x57ea05,_0x4603bd){return function(_0x3799fe){if(_0x3799fe){var _0x497a2b=_0x3799fe[_0xf3a0('0x2f')],_0x919c1c=_0x4603bd[_0xf3a0('0x30')],_0x323fbe=_0x4603bd[_0xf3a0('0x30')]+_0x4603bd[_0xf3a0('0x31')],_0x273c92;if(_0x323fbe>=_0x497a2b){_0x323fbe=_0x497a2b;_0x273c92=0xc8;}else{_0x273c92=0xce;}_0x57ea05[_0xf3a0('0x2c')](_0x273c92);return _0x57ea05[_0xf3a0('0x32')](_0xf3a0('0x33'),_0x919c1c+'-'+_0x323fbe+'/'+_0x497a2b)[_0xf3a0('0x2e')](_0x3799fe);}return null;};}function patchUpdates(_0xab966b){return function(_0x268b6f){try{jsonpatch[_0xf3a0('0x34')](_0x268b6f,_0xab966b,!![]);}catch(_0x48538f){return BPromise['reject'](_0x48538f);}return _0x268b6f['save']();};}function saveUpdates(_0x2d4dfa,_0x3b444b){return function(_0x289efb){if(_0x289efb){return _0x289efb['update'](_0x2d4dfa)[_0xf3a0('0x21')](function(_0x205861){return _0x205861;});}return null;};}function removeEntity(_0x3b20a1,_0x34765e){return function(_0xabd255){if(_0xabd255){return _0xabd255[_0xf3a0('0x35')]()[_0xf3a0('0x21')](function(){var _0x4cb452=_0xabd255['get']({'plain':!![]});var _0x2779a6=_0xf3a0('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x2779a6,'resourceId':_0x4cb452['id']}})[_0xf3a0('0x21')](function(){return _0xabd255;});})[_0xf3a0('0x21')](function(){_0x3b20a1[_0xf3a0('0x2c')](0xcc)[_0xf3a0('0x2d')]();});}};}function handleEntityNotFound(_0x2d0fbb,_0x516d2e){return function(_0x4d11ed){if(!_0x4d11ed){_0x2d0fbb[_0xf3a0('0x2b')](0x194);}return _0x4d11ed;};}function handleError(_0x45ac6a,_0x137057){_0x137057=_0x137057||0x1f4;return function(_0x48ba27){logger[_0xf3a0('0x25')](_0x48ba27[_0xf3a0('0x37')]);if(_0x48ba27[_0xf3a0('0x38')]){delete _0x48ba27[_0xf3a0('0x38')];}_0x45ac6a[_0xf3a0('0x2c')](_0x137057)['send'](_0x48ba27);};}exports[_0xf3a0('0x39')]=function(_0x21fa10,_0x317dee){var _0x56e504={'include':[{'model':db['MailServerIn'],'as':_0xf3a0('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xf3a0('0x3b')],'as':_0xf3a0('0x3c')}]},_0x23a7d3={},_0x49cc93={'count':0x0,'rows':[]};var _0x4e09c8=_['map'](db['MailAccount'][_0xf3a0('0x3d')],function(_0x43f086){return{'name':_0x43f086[_0xf3a0('0x3e')],'type':_0x43f086[_0xf3a0('0x3f')][_0xf3a0('0x40')]};});_0x23a7d3[_0xf3a0('0x41')]=_[_0xf3a0('0x42')](_0x4e09c8,_0xf3a0('0x38'));_0x23a7d3[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x21fa10[_0xf3a0('0x43')]);_0x23a7d3[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x23a7d3['model'],_0x23a7d3[_0xf3a0('0x43')]);_0x56e504['attributes']=_[_0xf3a0('0x46')](_0x23a7d3[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x56e504[_0xf3a0('0x48')]=_0x56e504[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x56e504[_0xf3a0('0x48')]:_0x23a7d3[_0xf3a0('0x41')];if(!_0x21fa10['query'][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x56e504[_0xf3a0('0x31')]=qs['limit'](_0x21fa10[_0xf3a0('0x43')]['limit']);_0x56e504[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x56e504[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0x56e504[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x21fa10[_0xf3a0('0x43')],_0x23a7d3[_0xf3a0('0x45')]),_0x4e09c8);if(_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x56e504['where']=_[_0xf3a0('0x51')](_0x56e504[_0xf3a0('0x4e')],{'$or':_['map'](_0x4e09c8,function(_0x5c39d9){if(_0x5c39d9[_0xf3a0('0x3f')]!==_0xf3a0('0x52')){var _0x3945c4={};_0x3945c4[_0x5c39d9[_0xf3a0('0x38')]]={'$like':'%'+_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x3945c4;}})});}_0x56e504=_[_0xf3a0('0x51')]({},_0x56e504,_0x21fa10[_0xf3a0('0x53')]);var _0x49244e={'where':_0x56e504[_0xf3a0('0x4e')]};return db[_0xf3a0('0x54')][_0xf3a0('0x2f')](_0x49244e)[_0xf3a0('0x21')](function(_0x8dd7e0){_0x49cc93['count']=_0x8dd7e0;if(_0x21fa10[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0x56e504['include']=[{'all':!![]}];}return db[_0xf3a0('0x54')][_0xf3a0('0x56')](_0x56e504);})['then'](function(_0x176732){_0x49cc93[_0xf3a0('0x57')]=_0x176732;return _0x49cc93;})[_0xf3a0('0x21')](respondWithFilteredResult(_0x317dee,_0x56e504))[_0xf3a0('0x2a')](handleError(_0x317dee,null));};exports['show']=function(_0x168ac3,_0x202042){var _0x1e64b2={'raw':![],'where':{'id':_0x168ac3[_0xf3a0('0x58')]['id']},'include':[{'model':db[_0xf3a0('0x59')],'as':_0xf3a0('0x3a')},{'model':db[_0xf3a0('0x5a')],'as':'Smtp'},{'model':db[_0xf3a0('0x3b')],'as':_0xf3a0('0x3c')}]},_0x32bd5a={};_0x32bd5a[_0xf3a0('0x41')]=_['keys'](db[_0xf3a0('0x54')][_0xf3a0('0x3d')]);_0x32bd5a[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x168ac3[_0xf3a0('0x43')]);_0x32bd5a[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x32bd5a[_0xf3a0('0x41')],_0x32bd5a[_0xf3a0('0x43')]);_0x1e64b2[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x32bd5a[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x168ac3[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x1e64b2[_0xf3a0('0x48')]=_0x1e64b2['attributes'][_0xf3a0('0x49')]?_0x1e64b2[_0xf3a0('0x48')]:_0x32bd5a[_0xf3a0('0x41')];if(_0x168ac3[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0x1e64b2['include']=[{'all':!![]}];}_0x1e64b2=_[_0xf3a0('0x51')]({},_0x1e64b2,_0x168ac3[_0xf3a0('0x53')]);return db[_0xf3a0('0x54')]['find'](_0x1e64b2)[_0xf3a0('0x21')](handleEntityNotFound(_0x202042,null))['then'](respondWithResult(_0x202042,null))[_0xf3a0('0x2a')](handleError(_0x202042,null));};exports[_0xf3a0('0x5b')]=function(_0x135482,_0xc2571d){if(_0x135482[_0xf3a0('0x5c')]['id']){delete _0x135482['body']['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x135482[_0xf3a0('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xf3a0('0x3a')},{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e')},{'model':db[_0xf3a0('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xf3a0('0x21')](handleEntityNotFound(_0xc2571d,null))[_0xf3a0('0x21')](saveUpdates(_0x135482[_0xf3a0('0x5c')],null))['then'](function(_0x58079f){if(_0x58079f&&_0x135482[_0xf3a0('0x5c')]['Imap']){return db[_0xf3a0('0x59')][_0xf3a0('0x5b')](_0x135482[_0xf3a0('0x5c')][_0xf3a0('0x3a')],{'where':{'MailAccountId':_0x58079f['id']}})[_0xf3a0('0x21')](function(){return _0x58079f;});}return _0x58079f;})['then'](function(_0x2874a5){if(_0x2874a5&&_0x135482[_0xf3a0('0x5c')]['Smtp']){return db[_0xf3a0('0x5a')]['update'](_0x135482[_0xf3a0('0x5c')][_0xf3a0('0x5e')],{'where':{'MailAccountId':_0x2874a5['id']}})[_0xf3a0('0x21')](function(){return _0x2874a5;});}return _0x2874a5;})[_0xf3a0('0x21')](respondWithResult(_0xc2571d,null))[_0xf3a0('0x2a')](handleError(_0xc2571d,null));};exports[_0xf3a0('0x5f')]=function(_0x51b948,_0x5705e6){return db[_0xf3a0('0x54')]['describe']()[_0xf3a0('0x21')](respondWithResult(_0x5705e6,null))['catch'](handleError(_0x5705e6,null));};exports[_0xf3a0('0x60')]=function(_0x1230a7,_0x5ede7a,_0x457077){if(_0x1230a7[_0xf3a0('0x5c')]['id']){delete _0x1230a7[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')]['find']({'where':{'id':_0x1230a7[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x5ede7a,null))[_0xf3a0('0x21')](function(_0xc36c9b){if(_0xc36c9b){_0x1230a7[_0xf3a0('0x5c')][_0xf3a0('0x61')]=_0xc36c9b['id'];return db[_0xf3a0('0x62')][_0xf3a0('0x63')](_0x1230a7['body']);}})[_0xf3a0('0x21')](respondWithResult(_0x5ede7a,null))[_0xf3a0('0x2a')](handleError(_0x5ede7a,null));};exports['getDispositions']=function(_0x425e12,_0x45239b,_0x39dd50){var _0x45d52c={'raw':![],'where':{}};var _0x50974c={};var _0x1a038f={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x425e12['params']['id']}})['then'](handleEntityNotFound(_0x45239b,null))[_0xf3a0('0x21')](function(_0x21bfd0){if(_0x21bfd0){_0x50974c[_0xf3a0('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x50974c[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x425e12[_0xf3a0('0x43')]);_0x50974c[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x50974c[_0xf3a0('0x41')],_0x50974c[_0xf3a0('0x43')]);_0x45d52c['attributes']=_['intersection'](_0x50974c[_0xf3a0('0x41')],qs['fields'](_0x425e12['query'][_0xf3a0('0x47')]));_0x45d52c['attributes']=_0x45d52c[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x45d52c['attributes']:_0x50974c[_0xf3a0('0x41')];if(!_0x425e12['query']['hasOwnProperty']('nolimit')){_0x45d52c['limit']=qs[_0xf3a0('0x31')](_0x425e12['query']['limit']);_0x45d52c[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x425e12[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x45d52c['order']=qs['sort'](_0x425e12['query'][_0xf3a0('0x4d')]);_0x45d52c[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x425e12['query'],_0x50974c[_0xf3a0('0x45')]));_0x45d52c[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x21bfd0['id'];if(_0x425e12[_0xf3a0('0x43')]['filter']){_0x45d52c[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x45d52c[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0x45d52c[_0xf3a0('0x48')],function(_0x5b149a){var _0x194821={};_0x194821[_0x5b149a]={'$like':'%'+_0x425e12[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x194821;})});}_0x45d52c=_[_0xf3a0('0x51')]({},_0x45d52c,_0x425e12[_0xf3a0('0x53')]);return db['Disposition']['count']({'where':_0x45d52c[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x1fd374){_0x1a038f[_0xf3a0('0x2f')]=_0x1fd374;if(_0x425e12[_0xf3a0('0x43')]['includeAll']){_0x45d52c[_0xf3a0('0x65')]=[{'all':!![]}];}return db['Disposition'][_0xf3a0('0x56')](_0x45d52c);})['then'](function(_0xf637f8){_0x1a038f[_0xf3a0('0x57')]=_0xf637f8;return _0x1a038f;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x45239b,_0x45d52c))['catch'](handleError(_0x45239b,null));};exports['removeDispositions']=function(_0x314a1d,_0x38ef76,_0x561196){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x314a1d['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x38ef76,null))[_0xf3a0('0x21')](function(_0xa1e046){if(_0xa1e046){return _0xa1e046['removeDispositions'](_0x314a1d[_0xf3a0('0x43')][_0xf3a0('0x66')]);}})[_0xf3a0('0x21')](respondWithStatusCode(_0x38ef76,null))[_0xf3a0('0x2a')](handleError(_0x38ef76,null));};exports[_0xf3a0('0x67')]=function(_0xa3cbd5,_0x423cb1,_0x5359d9){if(_0xa3cbd5['body']['id']){delete _0xa3cbd5[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0xa3cbd5[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x423cb1,null))['then'](function(_0x2bded9){if(_0x2bded9){_0xa3cbd5['body']['MailAccountId']=_0x2bded9['id'];return db['CannedAnswer']['create'](_0xa3cbd5[_0xf3a0('0x5c')]);}})[_0xf3a0('0x21')](respondWithResult(_0x423cb1,null))['catch'](handleError(_0x423cb1,null));};exports['getAnswers']=function(_0x1de256,_0x17cf66,_0x24331d){var _0x514391={'raw':![],'where':{}};var _0x350b06={};var _0x3a918b={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x1de256[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x17cf66,null))[_0xf3a0('0x21')](function(_0x5e7353){if(_0x5e7353){_0x350b06[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db['CannedAnswer'][_0xf3a0('0x3d')]);_0x350b06[_0xf3a0('0x43')]=_['keys'](_0x1de256[_0xf3a0('0x43')]);_0x350b06[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x350b06[_0xf3a0('0x41')],_0x350b06['query']);_0x514391['attributes']=_[_0xf3a0('0x46')](_0x350b06[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x514391[_0xf3a0('0x48')]=_0x514391[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x514391[_0xf3a0('0x48')]:_0x350b06[_0xf3a0('0x41')];if(!_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x4a')]('nolimit')){_0x514391[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x1de256[_0xf3a0('0x43')]['limit']);_0x514391[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0x514391[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x1de256[_0xf3a0('0x43')]['sort']);_0x514391['where']=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x1de256['query'],_0x350b06[_0xf3a0('0x45')]));_0x514391[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x5e7353['id'];if(_0x1de256[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x514391[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x514391[_0xf3a0('0x4e')],{'$or':_['map'](_0x514391[_0xf3a0('0x48')],function(_0x1e1e1f){var _0x5a0e1f={};_0x5a0e1f[_0x1e1e1f]={'$like':'%'+_0x1de256['query'][_0xf3a0('0x50')]+'%'};return _0x5a0e1f;})});}_0x514391=_['merge']({},_0x514391,_0x1de256[_0xf3a0('0x53')]);return db[_0xf3a0('0x68')][_0xf3a0('0x2f')]({'where':_0x514391[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x366171){_0x3a918b[_0xf3a0('0x2f')]=_0x366171;if(_0x1de256[_0xf3a0('0x43')]['includeAll']){_0x514391[_0xf3a0('0x65')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf3a0('0x56')](_0x514391);})[_0xf3a0('0x21')](function(_0x58b62e){_0x3a918b['rows']=_0x58b62e;return _0x3a918b;});}})['then'](respondWithFilteredResult(_0x17cf66,_0x514391))[_0xf3a0('0x2a')](handleError(_0x17cf66,null));};exports[_0xf3a0('0x69')]=function(_0x53938a,_0x23904f,_0x3a0a9d){return db['MailAccount']['find']({'where':{'id':_0x53938a[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x23904f,null))[_0xf3a0('0x21')](function(_0x3737c8){if(_0x3737c8){return _0x3737c8[_0xf3a0('0x69')](_0x53938a[_0xf3a0('0x43')][_0xf3a0('0x66')]);}})[_0xf3a0('0x21')](respondWithStatusCode(_0x23904f,null))[_0xf3a0('0x2a')](handleError(_0x23904f,null));};exports[_0xf3a0('0x63')]=function(_0x230564,_0x60b337){var _0x162c1b={'name':_0x230564['body'][_0xf3a0('0x38')],'key':_0x230564[_0xf3a0('0x5c')]['key'],'email':_0x230564[_0xf3a0('0x5c')]['email'],'ListId':_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6a')],'active':!_[_0xf3a0('0x6b')](_0x230564['body'][_0xf3a0('0x6c')])?_0x230564[_0xf3a0('0x5c')]['active']:!![],'description':_0x230564['body'][_0xf3a0('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0xf3a0('0x6b')](_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6e')])){if(_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6f')]){_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x70')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x70')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x71')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x72')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x73')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x74')];}else{_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x75')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x75')]=![];}_0x162c1b[_0xf3a0('0x3a')]['host']=_0x230564['body'][_0xf3a0('0x3a')][_0xf3a0('0x76')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x77')]=_0x230564[_0xf3a0('0x5c')]['Imap'][_0xf3a0('0x77')];_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x76')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x162c1b['Smtp'][_0xf3a0('0x77')]=_0x230564['body'][_0xf3a0('0x5e')][_0xf3a0('0x77')];}else{_0x162c1b[_0xf3a0('0x3a')]['service']=_0x162c1b['Smtp'][_0xf3a0('0x78')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x6e')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x70')]=_0x162c1b['Smtp'][_0xf3a0('0x70')]=_0x230564[_0xf3a0('0x5c')][_0xf3a0('0x71')];_0x162c1b[_0xf3a0('0x3a')][_0xf3a0('0x72')]=_0x162c1b[_0xf3a0('0x5e')][_0xf3a0('0x73')]=_0x230564['body'][_0xf3a0('0x74')];}return db['MailAccount'][_0xf3a0('0x63')](_0x162c1b,{'include':[{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e')},{'model':db[_0xf3a0('0x59')],'as':_0xf3a0('0x3a')}]})[_0xf3a0('0x21')](function(_0x5d36a4){var _0x491803=_0x230564[_0xf3a0('0x70')]['get']({'plain':!![]});if(!_0x491803)throw new Error(_0xf3a0('0x79'));if(_0x491803[_0xf3a0('0x7a')]===_0xf3a0('0x70')){var _0x97ce84=_0x5d36a4['get']({'plain':!![]});return db[_0xf3a0('0x7b')][_0xf3a0('0x5d')]({'where':{'name':_0xf3a0('0x36'),'userProfileId':_0x491803[_0xf3a0('0x7c')]},'raw':!![]})[_0xf3a0('0x21')](function(_0x5f1778){if(_0x5f1778&&_0x5f1778[_0xf3a0('0x7d')]===0x0){return db[_0xf3a0('0x7e')][_0xf3a0('0x63')]({'name':_0x97ce84['name'],'resourceId':_0x97ce84['id'],'type':_0x5f1778['name'],'sectionId':_0x5f1778['id']},{})[_0xf3a0('0x21')](function(){return _0x5d36a4;});}else{return _0x5d36a4;}})['catch'](function(_0x163b00){logger[_0xf3a0('0x25')](_0xf3a0('0x7f'),_0x163b00);throw _0x163b00;});}return _0x5d36a4;})[_0xf3a0('0x21')](respondWithResult(_0x60b337,0xc9))['catch'](handleError(_0x60b337,null));};exports[_0xf3a0('0x80')]=function(_0x312e8c,_0x340bb6,_0x9aa877){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x312e8c[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x340bb6,null))[_0xf3a0('0x21')](function(_0x238059){if(_0x238059){return _0x238059['getImap']();}return null;})[_0xf3a0('0x21')](respondWithResult(_0x340bb6,null))[_0xf3a0('0x2a')](handleError(_0x340bb6,null));};exports[_0xf3a0('0x81')]=function(_0x47a948,_0x1e156c,_0x2c4a56){if(_0x47a948[_0xf3a0('0x5c')]['id']){delete _0x47a948[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x47a948[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x1e156c,null))[_0xf3a0('0x21')](function(_0x48ebe8){if(_0x48ebe8){_0x47a948['body']['MailAccountId']=_0x48ebe8['id'];return db[_0xf3a0('0x59')][_0xf3a0('0x63')](_0x47a948[_0xf3a0('0x5c')]);}})[_0xf3a0('0x21')](respondWithResult(_0x1e156c,null))[_0xf3a0('0x2a')](handleError(_0x1e156c,null));};exports[_0xf3a0('0x82')]=function(_0x4bcd45,_0x203e05,_0xc64fee){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x4bcd45[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x203e05,null))[_0xf3a0('0x21')](function(_0x3c269a){if(_0x3c269a){return _0x3c269a[_0xf3a0('0x83')](null);}return null;})[_0xf3a0('0x21')](respondWithStatusCode(_0x203e05,null))[_0xf3a0('0x2a')](handleError(_0x203e05,null));};exports[_0xf3a0('0x84')]=function(_0x43d392,_0x27efa1,_0x270cb4){return db[_0xf3a0('0x54')]['findOne']({'where':{'id':_0x43d392[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x27efa1,null))[_0xf3a0('0x21')](function(_0x2b0521){if(_0x2b0521){return _0x2b0521[_0xf3a0('0x84')]();}return null;})['then'](respondWithResult(_0x27efa1,null))[_0xf3a0('0x2a')](handleError(_0x27efa1,null));};exports[_0xf3a0('0x85')]=function(_0x363de6,_0x48b1e8,_0x48c0b1){if(_0x363de6['body']['id']){delete _0x363de6[_0xf3a0('0x5c')]['id'];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x363de6[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x48b1e8,null))[_0xf3a0('0x21')](function(_0x4b6031){if(_0x4b6031){_0x363de6['body'][_0xf3a0('0x61')]=_0x4b6031['id'];return db[_0xf3a0('0x5a')][_0xf3a0('0x63')](_0x363de6['body']);}})[_0xf3a0('0x21')](respondWithResult(_0x48b1e8,null))['catch'](handleError(_0x48b1e8,null));};exports[_0xf3a0('0x86')]=function(_0x18e568,_0x40aeaa,_0x3f921d){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x18e568[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x40aeaa,null))['then'](function(_0x302a0e){if(_0x302a0e){return _0x302a0e[_0xf3a0('0x87')](null);}return null;})[_0xf3a0('0x21')](respondWithStatusCode(_0x40aeaa,null))[_0xf3a0('0x2a')](handleError(_0x40aeaa,null));};exports[_0xf3a0('0x88')]=function(_0x454b92,_0x26fd22,_0x48fd5a){return db['MailInteraction'][_0xf3a0('0x5d')]({'where':{'id':_0x454b92[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x26fd22,null))['then'](function(_0x580b14){if(_0x580b14){return _0x580b14[_0xf3a0('0x88')](_0x454b92['body'][_0xf3a0('0x66')],_[_0xf3a0('0x89')](_0x454b92['body'],[_0xf3a0('0x66'),'id'])||{});}})['then'](respondWithResult(_0x26fd22,null))[_0xf3a0('0x2a')](handleError(_0x26fd22,null));};exports[_0xf3a0('0x8a')]=function(_0x4c175f,_0x4f7800,_0x3f958b){var _0xd477f4={'raw':![],'where':{}};var _0x5a9b83={};var _0x34c3e3={'count':0x0,'rows':[]};return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x4c175f[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x4f7800,null))[_0xf3a0('0x21')](function(_0x5973ca){if(_0x5973ca){_0x5a9b83[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db[_0xf3a0('0x8b')][_0xf3a0('0x3d')]);_0x5a9b83[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x4c175f['query']);_0x5a9b83[_0xf3a0('0x45')]=_['intersection'](_0x5a9b83[_0xf3a0('0x41')],_0x5a9b83[_0xf3a0('0x43')]);_0xd477f4[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x5a9b83[_0xf3a0('0x41')],qs[_0xf3a0('0x47')](_0x4c175f['query'][_0xf3a0('0x47')]));_0xd477f4['attributes']=_0xd477f4[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0xd477f4['attributes']:_0x5a9b83[_0xf3a0('0x41')];if(!_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0xd477f4[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x31')]);_0xd477f4[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x4c175f['query'][_0xf3a0('0x30')]);}_0xd477f4[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0xd477f4['where']=qs['filters'](_[_0xf3a0('0x4f')](_0x4c175f['query'],_0x5a9b83[_0xf3a0('0x45')]));_0xd477f4[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x5973ca['id'];if(_0x4c175f['query'][_0xf3a0('0x50')]){_0xd477f4[_0xf3a0('0x4e')]=_['merge'](_0xd477f4[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0xd477f4['attributes'],function(_0x284b45){var _0x2b0a52={};_0x2b0a52[_0x284b45]={'$like':'%'+_0x4c175f[_0xf3a0('0x43')]['filter']+'%'};return _0x2b0a52;})});}_0xd477f4=_[_0xf3a0('0x51')]({},_0xd477f4,_0x4c175f[_0xf3a0('0x53')]);return db[_0xf3a0('0x8b')]['count']({'where':_0xd477f4[_0xf3a0('0x4e')]})[_0xf3a0('0x21')](function(_0x1b110a){_0x34c3e3['count']=_0x1b110a;if(_0x4c175f[_0xf3a0('0x43')]['includeAll']){_0xd477f4[_0xf3a0('0x65')]=[{'model':db[_0xf3a0('0x8c')],'as':'Contact','required':![]},{'model':db[_0xf3a0('0x8d')],'as':_0xf3a0('0x8e'),'attributes':[_0xf3a0('0x38'),_0xf3a0('0x8f'),_0xf3a0('0x90')],'required':![]},{'model':db[_0xf3a0('0x91')],'as':_0xf3a0('0x92'),'attributes':['id',_0xf3a0('0x38'),_0xf3a0('0x93')],'where':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]?{'id':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]}:undefined,'required':_0x4c175f[_0xf3a0('0x43')][_0xf3a0('0x94')]?!![]:![]}];}return db[_0xf3a0('0x8b')]['findAll'](_0xd477f4);})[_0xf3a0('0x21')](function(_0x502710){_0x34c3e3[_0xf3a0('0x57')]=_0x502710;return _0x34c3e3;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x4f7800,_0xd477f4))[_0xf3a0('0x2a')](handleError(_0x4f7800,null));};exports['addApplications']=function(_0x3ce2be,_0x30811d,_0x2df320){return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x3ce2be['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x30811d,null))['then'](function(_0x1b1c4c){if(_0x1b1c4c){return db[_0xf3a0('0x95')]['transaction'](function(_0x32d87f){return db[_0xf3a0('0x96')][_0xf3a0('0x35')]({'where':{'MailAccountId':_0x3ce2be[_0xf3a0('0x58')]['id']},'transaction':_0x32d87f})[_0xf3a0('0x21')](function(_0x4f917e){var _0x503106=_['map'](_0x3ce2be[_0xf3a0('0x5c')],function(_0x37d8b7){_0x37d8b7['MailAccountId']=_0x3ce2be[_0xf3a0('0x58')]['id'];return _0x37d8b7;});return db[_0xf3a0('0x96')][_0xf3a0('0x97')](_0x503106,{'transaction':_0x32d87f});});})[_0xf3a0('0x21')](function(){return db[_0xf3a0('0x96')][_0xf3a0('0x98')]({'where':{'MailAccountId':_0x3ce2be[_0xf3a0('0x58')]['id']},'order':_0xf3a0('0x99')});});}})[_0xf3a0('0x21')](respondWithResult(_0x30811d,null))[_0xf3a0('0x2a')](handleError(_0x30811d,null));};exports[_0xf3a0('0x9a')]=function(_0x1e8fd8,_0x1ad46a,_0xb06fc8){var _0x5cb624={};var _0x517c77={};var _0x28a4cb;var _0x3e5e31;return db['MailAccount'][_0xf3a0('0x64')]({'where':{'id':_0x1e8fd8[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ad46a,null))[_0xf3a0('0x21')](function(_0x32d997){if(_0x32d997){_0x28a4cb=_0x32d997;_0x517c77[_0xf3a0('0x41')]=_[_0xf3a0('0x44')](db['MailApplication'][_0xf3a0('0x3d')]);_0x517c77['query']=_[_0xf3a0('0x44')](_0x1e8fd8[_0xf3a0('0x43')]);_0x517c77[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x517c77['model'],_0x517c77[_0xf3a0('0x43')]);_0x5cb624[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x517c77[_0xf3a0('0x41')],qs['fields'](_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0x5cb624[_0xf3a0('0x48')]=_0x5cb624[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0x5cb624['attributes']:_0x517c77[_0xf3a0('0x41')];_0x5cb624['order']=qs['sort'](_0x1e8fd8[_0xf3a0('0x43')]['sort']);_0x5cb624[_0xf3a0('0x4e')]=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x1e8fd8['query'],_0x517c77[_0xf3a0('0x45')]));if(_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x5cb624[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0x5cb624[_0xf3a0('0x4e')],{'$or':_['map'](_0x5cb624[_0xf3a0('0x48')],function(_0x128b44){var _0x29d3f7={};_0x29d3f7[_0x128b44]={'$like':'%'+_0x1e8fd8['query']['filter']+'%'};return _0x29d3f7;})});}_0x5cb624=_[_0xf3a0('0x51')]({},_0x5cb624,_0x1e8fd8[_0xf3a0('0x53')]);return _0x28a4cb[_0xf3a0('0x9a')](_0x5cb624);}})[_0xf3a0('0x21')](function(_0x3125c0){if(_0x3125c0){_0x3e5e31=_0x3125c0[_0xf3a0('0x49')];if(!_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x5cb624[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x1e8fd8[_0xf3a0('0x43')][_0xf3a0('0x31')]);_0x5cb624[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x1e8fd8[_0xf3a0('0x43')]['offset']);}return _0x28a4cb[_0xf3a0('0x9a')](_0x5cb624);}})['then'](function(_0xa0dc60){if(_0xa0dc60){return _0xa0dc60?{'count':_0x3e5e31,'rows':_0xa0dc60}:null;}})[_0xf3a0('0x21')](respondWithResult(_0x1ad46a,null))[_0xf3a0('0x2a')](handleError(_0x1ad46a,null));};exports[_0xf3a0('0x9b')]=function(_0x3e5351,_0x169443,_0xa261c){var _0xb8023e={'raw':!![],'where':{}};var _0x3bd692={};var _0x598bae={'count':0x0,'rows':[]};return db['MailAccount'][_0xf3a0('0x64')]({'where':{'id':_0x3e5351[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x169443,null))['then'](function(_0x988cf6){if(_0x988cf6){_0x3bd692['model']=_[_0xf3a0('0x44')](db[_0xf3a0('0x9c')]['rawAttributes']);_0x3bd692['query']=_[_0xf3a0('0x44')](_0x3e5351[_0xf3a0('0x43')]);_0x3bd692[_0xf3a0('0x45')]=_[_0xf3a0('0x46')](_0x3bd692[_0xf3a0('0x41')],_0x3bd692[_0xf3a0('0x43')]);_0xb8023e[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x3bd692[_0xf3a0('0x41')],qs['fields'](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x47')]));_0xb8023e[_0xf3a0('0x48')]=_0xb8023e[_0xf3a0('0x48')][_0xf3a0('0x49')]?_0xb8023e[_0xf3a0('0x48')]:_0x3bd692[_0xf3a0('0x41')];if(!_0x3e5351[_0xf3a0('0x43')]['hasOwnProperty']('nolimit')){_0xb8023e['limit']=qs[_0xf3a0('0x31')](_0x3e5351['query']['limit']);_0xb8023e[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x30')]);}_0xb8023e['order']=qs[_0xf3a0('0x4d')](_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0xb8023e[_0xf3a0('0x4e')]=qs['filters'](_['pick'](_0x3e5351['query'],_0x3bd692[_0xf3a0('0x45')]));_0xb8023e[_0xf3a0('0x4e')][_0xf3a0('0x61')]=_0x988cf6['id'];if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0xb8023e[_0xf3a0('0x4e')]=_[_0xf3a0('0x51')](_0xb8023e['where'],{'$or':_['map'](_0xb8023e[_0xf3a0('0x48')],function(_0x2dc6f1){var _0x3f5c6b={};_0x3f5c6b[_0x2dc6f1]={'$like':'%'+_0x3e5351[_0xf3a0('0x43')]['filter']+'%'};return _0x3f5c6b;})});}if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x9d')]){var _0x3bfce2=_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x9d')]['split'](',');var _0xda2fd7={};_0xda2fd7[_0x3bfce2[0x0]]={'$gte':moment(_0x3bfce2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xb8023e[_0xf3a0('0x4e')]=_['merge'](_0xb8023e[_0xf3a0('0x4e')],_0xda2fd7);}_0xb8023e=_['merge']({},_0xb8023e,_0x3e5351[_0xf3a0('0x53')]);return db['MailMessage'][_0xf3a0('0x2f')]({'where':_0xb8023e[_0xf3a0('0x4e')]})['then'](function(_0x17585c){_0x598bae[_0xf3a0('0x2f')]=_0x17585c;if(_0x3e5351[_0xf3a0('0x43')][_0xf3a0('0x55')]){_0xb8023e[_0xf3a0('0x65')]=[{'all':!![]}];}return db[_0xf3a0('0x9c')][_0xf3a0('0x56')](_0xb8023e);})[_0xf3a0('0x21')](function(_0x5a1947){_0x598bae[_0xf3a0('0x57')]=_0x5a1947;return _0x598bae;});}})[_0xf3a0('0x21')](respondWithFilteredResult(_0x169443,_0xb8023e))[_0xf3a0('0x2a')](handleError(_0x169443,null));};exports['send']=function(_0xc98cd3,_0x39255f,_0x37f2da){var _0x2ca898,_0x48fe28={},_0x39277b;if(_0xc98cd3[_0xf3a0('0x5c')]['to']){_0x39277b=_0xc98cd3[_0xf3a0('0x5c')]['to'][_0xf3a0('0x9e')](',')[0x0];}return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0xc98cd3[_0xf3a0('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xf3a0('0x9f'),'include':[{'model':db[_0xf3a0('0x8c')],'as':'Contacts','where':{'email':_0x39277b},'limit':0x1,'order':[[_0xf3a0('0xa0'),_0xf3a0('0xa1')]]}]},{'model':db[_0xf3a0('0x5a')],'as':_0xf3a0('0x5e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x39255f,null))[_0xf3a0('0x21')](function(_0x33bae8){if(_0x33bae8){_0x2ca898=_0x33bae8;if(_0x33bae8[_0xf3a0('0x5e')]){if(_['isNil'](_0xc98cd3['body'][_0xf3a0('0xa2')])){_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa2')]=util[_0xf3a0('0xa3')](_0xf3a0('0xa4'),_0x33bae8[_0xf3a0('0x38')],_0x33bae8[_0xf3a0('0xa5')]||_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')]);}if(_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')]&&_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0xf3a0('0x49')]){for(var _0x1df540=0x0;_0x1df540<_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')]['length'];_0x1df540+=0x1){_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0x1df540]={'filename':_0xc98cd3[_0xf3a0('0x5c')]['attachments'][_0x1df540][_0xf3a0('0x38')],'path':path[_0xf3a0('0xa7')](config[_0xf3a0('0xa8')],_0xf3a0('0xa9'),_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xa6')][_0x1df540][_0xf3a0('0xaa')])};}}var _0x4c1583={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x78')])){if(_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x75')]){_0x4c1583['auth']={'user':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x33bae8['Smtp']['pass']};}_0x4c1583[_0xf3a0('0x76')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x4c1583[_0xf3a0('0x77')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x77')];_0x4c1583[_0xf3a0('0xab')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0xab')];}else{_0x4c1583[_0xf3a0('0x78')]=_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x78')];_0x4c1583[_0xf3a0('0xac')]={'user':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x33bae8[_0xf3a0('0x5e')][_0xf3a0('0x73')]};}return respondWithRpcPromise(_0xf3a0('0xad'),_0xf3a0('0xae'),{'account':_0x4c1583,'message':_0xc98cd3[_0xf3a0('0x5c')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x36005b){if(_0x36005b){_0x48fe28=_0x36005b;if(_0x2ca898[_0xf3a0('0x9f')]){if(_0x2ca898[_0xf3a0('0x9f')][_0xf3a0('0xaf')]['length']){return _0x2ca898[_0xf3a0('0x9f')][_0xf3a0('0xaf')][0x0];}else{return db['CmContact'][_0xf3a0('0x63')](_[_0xf3a0('0xb0')](_0xc98cd3[_0xf3a0('0x5c')],{'firstName':_0xc98cd3[_0xf3a0('0x5c')]['to'],'email':_0xc98cd3['body']['to'],'phone':_0xc98cd3['body']['to'],'ListId':_0x2ca898[_0xf3a0('0x6a')]}));}}else{throw new Error(_0xf3a0('0xb1'));}}})['then'](function(_0x19646f){if(_0x19646f){var _0x480897={'UserId':_0xc98cd3['user']['id'],'ContactId':_0x19646f['id'],'MailAccountId':_0x2ca898['id'],'inReplyTo':_0x48fe28[_0xf3a0('0xb2')],'to':_0xc98cd3[_0xf3a0('0x5c')]['from'],'cc':_0xc98cd3[_0xf3a0('0x5c')]['cc'],'subject':_0xc98cd3['body'][_0xf3a0('0xb3')],'attach':_0xc98cd3['body'][_0xf3a0('0xb4')],'firstMsgDirection':_0xf3a0('0xb5'),'lastMsgAt':moment()[_0xf3a0('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xf3a0('0xb5'),'lastMsgBody':_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0x5c')],'Messages':[_[_0xf3a0('0x51')](_0xc98cd3[_0xf3a0('0x5c')],{'messageId':_0x48fe28[_0xf3a0('0xb2')],'sentAt':moment()['format'](_0xf3a0('0xb6')),'read':!![],'MailAccountId':_0x2ca898['id'],'UserId':_0xc98cd3[_0xf3a0('0x70')]['id'],'ContactId':_0x19646f['id']})]};if(_0xc98cd3['body']['Interaction']){_0x480897=_[_0xf3a0('0x51')](_0x480897,_0xc98cd3[_0xf3a0('0x5c')][_0xf3a0('0xb7')]);}return db[_0xf3a0('0x8b')][_0xf3a0('0x63')](_0x480897,{'include':[{'model':db[_0xf3a0('0x9c')],'as':_0xf3a0('0xb8')}]});}})['then'](respondWithResult(_0x39255f,null))[_0xf3a0('0x2a')](handleError(_0x39255f,null));};exports['verifySmtp']=function(_0x5e8fc9,_0xe20207,_0x29c600){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x5e8fc9['params']['id']},'include':[{'model':db[_0xf3a0('0x5a')],'as':'Smtp','raw':!![]}]})[_0xf3a0('0x21')](handleEntityNotFound(_0xe20207,null))[_0xf3a0('0x21')](function(_0x49ec7d){if(_0x49ec7d&&_0x49ec7d[_0xf3a0('0x5e')]){var _0x3dce91={'id':_0x49ec7d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x49ec7d['Smtp'][_0xf3a0('0x78')]){_0x3dce91['service']=_0x49ec7d['Smtp'][_0xf3a0('0x78')];}else{_0x3dce91['host']=_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0x76')];_0x3dce91[_0xf3a0('0x77')]=_0x49ec7d['Smtp'][_0xf3a0('0x77')];_0x3dce91[_0xf3a0('0xab')]=_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0xab')];}if(_0x49ec7d[_0xf3a0('0x5e')]['authentication']){_0x3dce91[_0xf3a0('0xac')]={'user':_0x49ec7d[_0xf3a0('0x5e')][_0xf3a0('0x70')],'pass':_0x49ec7d['Smtp'][_0xf3a0('0x73')]};}return respondWithRpcPromise(_0xf3a0('0xb9'),_0xf3a0('0xba'),{'account':_0x3dce91});}})[_0xf3a0('0x21')](respondWithResult(_0xe20207,null))['catch'](handleError(_0xe20207,null));};exports[_0xf3a0('0x35')]=function(_0x27f0ea,_0x5d21cf){return db[_0xf3a0('0x54')]['find']({'where':{'id':_0x27f0ea[_0xf3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d21cf,null))[_0xf3a0('0x21')](function(_0x2d766c){if(_0x2d766c&&_0x2d766c['service']){throw new db[(_0xf3a0('0xbb'))][(_0xf3a0('0xbc'))](_0xf3a0('0xbd'));}return _0x2d766c;})['then'](removeEntity(_0x5d21cf,null))[_0xf3a0('0x2a')](handleError(_0x5d21cf,null));};exports['addAgents']=function(_0x1a35bb,_0x324afe,_0x599140){return db['MailAccount']['find']({'where':{'id':_0x1a35bb[_0xf3a0('0x58')]['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x324afe,null))[_0xf3a0('0x21')](function(_0x4536c7){if(_0x4536c7){return _0x4536c7['addAgents'](_0x1a35bb[_0xf3a0('0x5c')][_0xf3a0('0x66')],_[_0xf3a0('0x89')](_0x1a35bb[_0xf3a0('0x5c')],[_0xf3a0('0x66'),'id'])||{})[_0xf3a0('0xbe')](function(_0x32b49f){for(var _0x3f3c9e=0x0;_0x3f3c9e<_0x1a35bb[_0xf3a0('0x5c')][_0xf3a0('0x66')][_0xf3a0('0x49')];_0x3f3c9e+=0x1){socket[_0xf3a0('0xbf')](_0xf3a0('0xc0'),{'UserId':_0x1a35bb['body'][_0xf3a0('0x66')][_0x3f3c9e],'MailAccountId':_0x1a35bb[_0xf3a0('0x58')]['id']});}return _0x32b49f;});}})[_0xf3a0('0x21')](respondWithResult(_0x324afe,null))[_0xf3a0('0x2a')](handleError(_0x324afe,null));};exports[_0xf3a0('0xc1')]=function(_0x270656,_0x1bcc00,_0x431eee){return db[_0xf3a0('0x54')][_0xf3a0('0x5d')]({'where':{'id':_0x270656['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x1bcc00,null))[_0xf3a0('0x21')](function(_0x5eb5ec){if(_0x5eb5ec){return _0x5eb5ec[_0xf3a0('0xc1')](_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')])[_0xf3a0('0x21')](function(){if(_[_0xf3a0('0xc2')](_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')])){for(var _0x1c9d57=0x0;_0x1c9d57<_0x270656[_0xf3a0('0x43')][_0xf3a0('0x66')][_0xf3a0('0x49')];_0x1c9d57+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x270656['query']['ids'][_0x1c9d57]),'MailAccountId':Number(_0x270656['params']['id'])});}}else{socket[_0xf3a0('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x270656[_0xf3a0('0x43')]['ids']),'MailAccountId':Number(_0x270656['params']['id'])});}});}})[_0xf3a0('0x21')](respondWithStatusCode(_0x1bcc00,null))[_0xf3a0('0x2a')](handleError(_0x1bcc00,null));};exports[_0xf3a0('0xc3')]=function(_0x2e245b,_0x2ca196,_0x3ec597){var _0x4d6487={};var _0x363abb={};var _0x345153;var _0x1be376;return db[_0xf3a0('0x54')][_0xf3a0('0x64')]({'where':{'id':_0x2e245b['params']['id']}})[_0xf3a0('0x21')](handleEntityNotFound(_0x2ca196,null))[_0xf3a0('0x21')](function(_0x3d172e){if(_0x3d172e){_0x345153=_0x3d172e;_0x363abb[_0xf3a0('0x41')]=_['keys'](db['User']['rawAttributes']);_0x363abb[_0xf3a0('0x43')]=_[_0xf3a0('0x44')](_0x2e245b[_0xf3a0('0x43')]);_0x363abb['filters']=_[_0xf3a0('0x46')](_0x363abb[_0xf3a0('0x41')],_0x363abb['query']);_0x4d6487[_0xf3a0('0x48')]=_[_0xf3a0('0x46')](_0x363abb['model'],qs[_0xf3a0('0x47')](_0x2e245b['query'][_0xf3a0('0x47')]));_0x4d6487['attributes']=_0x4d6487['attributes'][_0xf3a0('0x49')]?_0x4d6487[_0xf3a0('0x48')]:_0x363abb[_0xf3a0('0x41')];_0x4d6487[_0xf3a0('0x4c')]=qs[_0xf3a0('0x4d')](_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x4d')]);_0x4d6487['where']=qs[_0xf3a0('0x45')](_[_0xf3a0('0x4f')](_0x2e245b[_0xf3a0('0x43')],_0x363abb['filters']));if(_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x50')]){_0x4d6487['where']=_[_0xf3a0('0x51')](_0x4d6487[_0xf3a0('0x4e')],{'$or':_[_0xf3a0('0x42')](_0x4d6487['attributes'],function(_0x2094ce){var _0x301845={};_0x301845[_0x2094ce]={'$like':'%'+_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x50')]+'%'};return _0x301845;})});}_0x4d6487=_[_0xf3a0('0x51')]({},_0x4d6487,_0x2e245b[_0xf3a0('0x53')]);return _0x345153['getAgents'](_0x4d6487);}})['then'](function(_0x5905cd){if(_0x5905cd){_0x1be376=_0x5905cd[_0xf3a0('0x49')];if(!_0x2e245b[_0xf3a0('0x43')][_0xf3a0('0x4a')](_0xf3a0('0x4b'))){_0x4d6487[_0xf3a0('0x31')]=qs[_0xf3a0('0x31')](_0x2e245b[_0xf3a0('0x43')]['limit']);_0x4d6487[_0xf3a0('0x30')]=qs[_0xf3a0('0x30')](_0x2e245b['query'][_0xf3a0('0x30')]);}return _0x345153['getAgents'](_0x4d6487);}})[_0xf3a0('0x21')](function(_0x273dcd){if(_0x273dcd){return _0x273dcd?{'count':_0x1be376,'rows':_0x273dcd}:null;}})['then'](respondWithResult(_0x2ca196,null))[_0xf3a0('0x2a')](handleError(_0x2ca196,null));}; \ No newline at end of file +var _0xa105=['mustache','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/utils','../../config/environment','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','MailAccount','fieldName','type','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','MailServerOut','Pause','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','removeDispositions','addAnswer','find','CannedAnswer','getAnswers','length','removeAnswers','ids','key','email','isNil','active','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','updatedAt','DESC','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','secure','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xa105,0xc1));var _0x5a10=function(_0x15bc50,_0x4becd6){_0x15bc50=_0x15bc50-0x0;var _0x55575b=_0xa105[_0x15bc50];return _0x55575b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a10('0x1'));var jsonpatch=require(_0x5a10('0x2'));var rp=require(_0x5a10('0x3'));var moment=require(_0x5a10('0x4'));var BPromise=require(_0x5a10('0x5'));var Mustache=require(_0x5a10('0x6'));var util=require('util');var path=require(_0x5a10('0x7'));var sox=require(_0x5a10('0x8'));var csv=require(_0x5a10('0x9'));var ejs=require(_0x5a10('0xa'));var fs=require('fs');var _=require(_0x5a10('0xb'));var squel=require(_0x5a10('0xc'));var crypto=require(_0x5a10('0xd'));var jsforce=require(_0x5a10('0xe'));var deskjs=require(_0x5a10('0xf'));var toCsv=require(_0x5a10('0x9'));var querystring=require('querystring');var Papa=require(_0x5a10('0x10'));var Redis=require(_0x5a10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a10('0x12'));var as=require(_0x5a10('0x13'));var hardwareService=require(_0x5a10('0x14'));var logger=require(_0x5a10('0x15'))(_0x5a10('0x16'));var utils=require(_0x5a10('0x17'));var config=require(_0x5a10('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5a10('0x19'),'port':0x18eb});var socket=require(_0x5a10('0x1a'))(new Redis(config[_0x5a10('0x1b')]));require(_0x5a10('0x1c'))[_0x5a10('0x1d')](socket);var jayson=require(_0x5a10('0x1e'));var client=jayson[_0x5a10('0x1f')][_0x5a10('0x20')]({'port':0x232b});function respondWithRpcPromise(_0xf0bc4e,_0x15459a,_0x490dd2,_0x20f60c){return new BPromise(function(_0x45c4d9,_0x6659e8){var _0x28b4b0=_0x20f60c||client;return _0x28b4b0[_0x5a10('0x21')](_0xf0bc4e,_0x490dd2)['then'](function(_0x265bf5){logger['info'](_0x5a10('0x22'),_0x15459a,_0x5a10('0x23'));logger[_0x5a10('0x24')](_0x5a10('0x25'),_0x15459a,_0x5a10('0x23'),JSON[_0x5a10('0x26')](_0x265bf5));if(_0x265bf5[_0x5a10('0x27')]){if(_0x265bf5[_0x5a10('0x27')]['code']===0x1f4){logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x265bf5[_0x5a10('0x27')]['message']);return _0x6659e8(_0x265bf5[_0x5a10('0x27')]['message']);}logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x265bf5[_0x5a10('0x27')][_0x5a10('0x28')]);return _0x45c4d9(_0x265bf5['error'][_0x5a10('0x28')]);}else{logger[_0x5a10('0x29')](_0x5a10('0x22'),_0x15459a,_0x5a10('0x23'));_0x45c4d9(_0x265bf5[_0x5a10('0x2a')][_0x5a10('0x28')]);}})[_0x5a10('0x2b')](function(_0x1cf1f6){logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x1cf1f6);_0x6659e8(_0x1cf1f6);});});}function respondWithStatusCode(_0xc18fa3,_0x143575){_0x143575=_0x143575||0xcc;return function(_0x1d70a2){if(_0x1d70a2){return _0xc18fa3['sendStatus'](_0x143575);}return _0xc18fa3[_0x5a10('0x2c')](_0x143575)[_0x5a10('0x2d')]();};}function respondWithResult(_0x9b5e85,_0x280d38){_0x280d38=_0x280d38||0xc8;return function(_0x54addd){if(_0x54addd){return _0x9b5e85[_0x5a10('0x2c')](_0x280d38)['json'](_0x54addd);}};}function respondWithFilteredResult(_0x4ac239,_0x54a837){return function(_0x555afd){if(_0x555afd){var _0x2f6b1e=_0x555afd[_0x5a10('0x2e')],_0x40559e=_0x54a837[_0x5a10('0x2f')],_0x44699b=_0x54a837[_0x5a10('0x2f')]+_0x54a837[_0x5a10('0x30')],_0x2b8dd5;if(_0x44699b>=_0x2f6b1e){_0x44699b=_0x2f6b1e;_0x2b8dd5=0xc8;}else{_0x2b8dd5=0xce;}_0x4ac239[_0x5a10('0x2c')](_0x2b8dd5);return _0x4ac239['set'](_0x5a10('0x31'),_0x40559e+'-'+_0x44699b+'/'+_0x2f6b1e)[_0x5a10('0x32')](_0x555afd);}return null;};}function patchUpdates(_0x17096c){return function(_0x405715){try{jsonpatch[_0x5a10('0x33')](_0x405715,_0x17096c,!![]);}catch(_0x130694){return BPromise[_0x5a10('0x34')](_0x130694);}return _0x405715[_0x5a10('0x35')]();};}function saveUpdates(_0x5cd036,_0x580b6c){return function(_0x3f78c4){if(_0x3f78c4){return _0x3f78c4[_0x5a10('0x36')](_0x5cd036)[_0x5a10('0x37')](function(_0x5ecb4e){return _0x5ecb4e;});}return null;};}function removeEntity(_0x173cde,_0x18db56){return function(_0x6ec09b){if(_0x6ec09b){return _0x6ec09b['destroy']()[_0x5a10('0x37')](function(){var _0x513d5b=_0x6ec09b[_0x5a10('0x38')]({'plain':!![]});var _0x2d9e7b='MailAccounts';return db[_0x5a10('0x39')][_0x5a10('0x3a')]({'where':{'type':_0x2d9e7b,'resourceId':_0x513d5b['id']}})['then'](function(){return _0x6ec09b;});})[_0x5a10('0x37')](function(){_0x173cde[_0x5a10('0x2c')](0xcc)[_0x5a10('0x2d')]();});}};}function handleEntityNotFound(_0x37233b,_0x3a9776){return function(_0x42d731){if(!_0x42d731){_0x37233b['sendStatus'](0x194);}return _0x42d731;};}function handleError(_0x36b55a,_0x4e980a){_0x4e980a=_0x4e980a||0x1f4;return function(_0xb3ce59){logger['error'](_0xb3ce59[_0x5a10('0x3b')]);if(_0xb3ce59[_0x5a10('0x3c')]){delete _0xb3ce59[_0x5a10('0x3c')];}_0x36b55a['status'](_0x4e980a)['send'](_0xb3ce59);};}exports[_0x5a10('0x3d')]=function(_0xeb57d2,_0xd2a655){var _0xd33e4e={'include':[{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')},{'model':db['MailServerOut'],'as':_0x5a10('0x40')},{'model':db['Pause'],'as':_0x5a10('0x41')}]},_0x4d82db={},_0xf5e82b={'count':0x0,'rows':[]};var _0x510f83=_['map'](db[_0x5a10('0x42')]['rawAttributes'],function(_0x561057){return{'name':_0x561057[_0x5a10('0x43')],'type':_0x561057[_0x5a10('0x44')]['key']};});_0x4d82db['model']=_[_0x5a10('0x45')](_0x510f83,_0x5a10('0x3c'));_0x4d82db[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0xeb57d2[_0x5a10('0x46')]);_0x4d82db['filters']=_[_0x5a10('0x48')](_0x4d82db[_0x5a10('0x49')],_0x4d82db['query']);_0xd33e4e['attributes']=_[_0x5a10('0x48')](_0x4d82db[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4a')]));_0xd33e4e[_0x5a10('0x4b')]=_0xd33e4e[_0x5a10('0x4b')]['length']?_0xd33e4e[_0x5a10('0x4b')]:_0x4d82db[_0x5a10('0x49')];if(!_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0xd33e4e[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x30')]);_0xd33e4e[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0xeb57d2['query'][_0x5a10('0x2f')]);}_0xd33e4e[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4f')]);_0xd33e4e[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0xeb57d2[_0x5a10('0x46')],_0x4d82db[_0x5a10('0x51')]),_0x510f83);if(_0xeb57d2['query']['filter']){_0xd33e4e[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0xd33e4e[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x510f83,function(_0x102f17){if(_0x102f17[_0x5a10('0x44')]!==_0x5a10('0x54')){var _0x39903f={};_0x39903f[_0x102f17[_0x5a10('0x3c')]]={'$like':'%'+_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x39903f;}})});}_0xd33e4e=_[_0x5a10('0x53')]({},_0xd33e4e,_0xeb57d2[_0x5a10('0x56')]);var _0xee710a={'where':_0xd33e4e[_0x5a10('0x50')]};return db['MailAccount'][_0x5a10('0x2e')](_0xee710a)[_0x5a10('0x37')](function(_0x3dd9f2){_0xf5e82b[_0x5a10('0x2e')]=_0x3dd9f2;if(_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x57')]){_0xd33e4e[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0x42')][_0x5a10('0x59')](_0xd33e4e);})[_0x5a10('0x37')](function(_0x3c5c9f){_0xf5e82b[_0x5a10('0x5a')]=_0x3c5c9f;return _0xf5e82b;})['then'](respondWithFilteredResult(_0xd2a655,_0xd33e4e))[_0x5a10('0x2b')](handleError(_0xd2a655,null));};exports[_0x5a10('0x5b')]=function(_0x132290,_0x4730ef){var _0x47bc33={'raw':![],'where':{'id':_0x132290[_0x5a10('0x5c')]['id']},'include':[{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')},{'model':db[_0x5a10('0x5d')],'as':'Smtp'},{'model':db[_0x5a10('0x5e')],'as':'mandatoryDispositionPause'}]},_0x535fbe={};_0x535fbe[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x42')]['rawAttributes']);_0x535fbe['query']=_[_0x5a10('0x47')](_0x132290['query']);_0x535fbe[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x535fbe[_0x5a10('0x49')],_0x535fbe[_0x5a10('0x46')]);_0x47bc33[_0x5a10('0x4b')]=_['intersection'](_0x535fbe[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x132290[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x47bc33['attributes']=_0x47bc33[_0x5a10('0x4b')]['length']?_0x47bc33[_0x5a10('0x4b')]:_0x535fbe[_0x5a10('0x49')];if(_0x132290['query'][_0x5a10('0x57')]){_0x47bc33['include']=[{'all':!![]}];}_0x47bc33=_['merge']({},_0x47bc33,_0x132290[_0x5a10('0x56')]);return db[_0x5a10('0x42')]['find'](_0x47bc33)[_0x5a10('0x37')](handleEntityNotFound(_0x4730ef,null))[_0x5a10('0x37')](respondWithResult(_0x4730ef,null))[_0x5a10('0x2b')](handleError(_0x4730ef,null));};exports[_0x5a10('0x36')]=function(_0x35a79d,_0x315b7f){if(_0x35a79d[_0x5a10('0x5f')]['id']){delete _0x35a79d[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')]['find']({'where':{'id':_0x35a79d['params']['id']},'include':[{'model':db[_0x5a10('0x3e')],'as':'Imap'},{'model':db[_0x5a10('0x5d')],'as':'Smtp'},{'model':db['Pause'],'as':_0x5a10('0x41')}]})[_0x5a10('0x37')](handleEntityNotFound(_0x315b7f,null))[_0x5a10('0x37')](saveUpdates(_0x35a79d[_0x5a10('0x5f')],null))['then'](function(_0x1e0d4a){if(_0x1e0d4a&&_0x35a79d['body'][_0x5a10('0x3f')]){return db[_0x5a10('0x3e')]['update'](_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x3f')],{'where':{'MailAccountId':_0x1e0d4a['id']}})[_0x5a10('0x37')](function(){return _0x1e0d4a;});}return _0x1e0d4a;})['then'](function(_0x316ba6){if(_0x316ba6&&_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x40')]){return db[_0x5a10('0x5d')][_0x5a10('0x36')](_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x40')],{'where':{'MailAccountId':_0x316ba6['id']}})['then'](function(){return _0x316ba6;});}return _0x316ba6;})['then'](respondWithResult(_0x315b7f,null))[_0x5a10('0x2b')](handleError(_0x315b7f,null));};exports[_0x5a10('0x60')]=function(_0x24c94b,_0x56e286){return db[_0x5a10('0x42')][_0x5a10('0x60')]()[_0x5a10('0x37')](respondWithResult(_0x56e286,null))[_0x5a10('0x2b')](handleError(_0x56e286,null));};exports[_0x5a10('0x61')]=function(_0x2bbddb,_0x53c715,_0x24a316){if(_0x2bbddb['body']['id']){delete _0x2bbddb[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')]['find']({'where':{'id':_0x2bbddb[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x53c715,null))[_0x5a10('0x37')](function(_0x597c24){if(_0x597c24){_0x2bbddb['body'][_0x5a10('0x62')]=_0x597c24['id'];return db[_0x5a10('0x63')][_0x5a10('0x64')](_0x2bbddb[_0x5a10('0x5f')]);}})['then'](respondWithResult(_0x53c715,null))[_0x5a10('0x2b')](handleError(_0x53c715,null));};exports[_0x5a10('0x65')]=function(_0x3cfce3,_0x5c8f3e,_0x59c617){var _0x373247={'raw':![],'where':{}};var _0x341352={};var _0x21579a={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x3cfce3['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x5c8f3e,null))[_0x5a10('0x37')](function(_0x48a964){if(_0x48a964){_0x341352[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x63')][_0x5a10('0x67')]);_0x341352[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0x3cfce3[_0x5a10('0x46')]);_0x341352[_0x5a10('0x51')]=_['intersection'](_0x341352['model'],_0x341352[_0x5a10('0x46')]);_0x373247[_0x5a10('0x4b')]=_['intersection'](_0x341352[_0x5a10('0x49')],qs['fields'](_0x3cfce3[_0x5a10('0x46')]['fields']));_0x373247[_0x5a10('0x4b')]=_0x373247[_0x5a10('0x4b')]['length']?_0x373247[_0x5a10('0x4b')]:_0x341352[_0x5a10('0x49')];if(!_0x3cfce3['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x373247['limit']=qs['limit'](_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x30')]);_0x373247[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x3cfce3[_0x5a10('0x46')]['offset']);}_0x373247[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x3cfce3[_0x5a10('0x46')]['sort']);_0x373247[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x3cfce3[_0x5a10('0x46')],_0x341352[_0x5a10('0x51')]));_0x373247[_0x5a10('0x50')][_0x5a10('0x62')]=_0x48a964['id'];if(_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x55')]){_0x373247['where']=_[_0x5a10('0x53')](_0x373247[_0x5a10('0x50')],{'$or':_['map'](_0x373247['attributes'],function(_0x180679){var _0x173aa5={};_0x173aa5[_0x180679]={'$like':'%'+_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x173aa5;})});}_0x373247=_[_0x5a10('0x53')]({},_0x373247,_0x3cfce3[_0x5a10('0x56')]);return db[_0x5a10('0x63')][_0x5a10('0x2e')]({'where':_0x373247[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x3c96e4){_0x21579a[_0x5a10('0x2e')]=_0x3c96e4;if(_0x3cfce3['query'][_0x5a10('0x57')]){_0x373247[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0x63')]['findAll'](_0x373247);})[_0x5a10('0x37')](function(_0x300dac){_0x21579a['rows']=_0x300dac;return _0x21579a;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x5c8f3e,_0x373247))['catch'](handleError(_0x5c8f3e,null));};exports[_0x5a10('0x68')]=function(_0x448cca,_0xc84012,_0x29953b){return db[_0x5a10('0x42')]['find']({'where':{'id':_0x448cca[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0xc84012,null))[_0x5a10('0x37')](function(_0x2a0f54){if(_0x2a0f54){return _0x2a0f54['removeDispositions'](_0x448cca[_0x5a10('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xc84012,null))[_0x5a10('0x2b')](handleError(_0xc84012,null));};exports[_0x5a10('0x69')]=function(_0xd5c66f,_0x1ba4ba,_0x4869d1){if(_0xd5c66f[_0x5a10('0x5f')]['id']){delete _0xd5c66f[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0xd5c66f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x1ba4ba,null))[_0x5a10('0x37')](function(_0x17efcb){if(_0x17efcb){_0xd5c66f[_0x5a10('0x5f')][_0x5a10('0x62')]=_0x17efcb['id'];return db[_0x5a10('0x6b')][_0x5a10('0x64')](_0xd5c66f[_0x5a10('0x5f')]);}})[_0x5a10('0x37')](respondWithResult(_0x1ba4ba,null))[_0x5a10('0x2b')](handleError(_0x1ba4ba,null));};exports[_0x5a10('0x6c')]=function(_0x34db3f,_0x56d0eb,_0x56d7c0){var _0xfb5207={'raw':![],'where':{}};var _0x2c9997={};var _0x429f91={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x34db3f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x56d0eb,null))[_0x5a10('0x37')](function(_0xa61c07){if(_0xa61c07){_0x2c9997[_0x5a10('0x49')]=_[_0x5a10('0x47')](db['CannedAnswer'][_0x5a10('0x67')]);_0x2c9997['query']=_[_0x5a10('0x47')](_0x34db3f[_0x5a10('0x46')]);_0x2c9997[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x2c9997['model'],_0x2c9997[_0x5a10('0x46')]);_0xfb5207[_0x5a10('0x4b')]=_['intersection'](_0x2c9997[_0x5a10('0x49')],qs['fields'](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x4a')]));_0xfb5207['attributes']=_0xfb5207[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0xfb5207[_0x5a10('0x4b')]:_0x2c9997[_0x5a10('0x49')];if(!_0x34db3f['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0xfb5207[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x34db3f[_0x5a10('0x46')]['limit']);_0xfb5207[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0xfb5207[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x4f')]);_0xfb5207[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x34db3f[_0x5a10('0x46')],_0x2c9997[_0x5a10('0x51')]));_0xfb5207['where']['MailAccountId']=_0xa61c07['id'];if(_0x34db3f[_0x5a10('0x46')]['filter']){_0xfb5207[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0xfb5207['where'],{'$or':_['map'](_0xfb5207[_0x5a10('0x4b')],function(_0x4eaf50){var _0x598196={};_0x598196[_0x4eaf50]={'$like':'%'+_0x34db3f['query'][_0x5a10('0x55')]+'%'};return _0x598196;})});}_0xfb5207=_['merge']({},_0xfb5207,_0x34db3f[_0x5a10('0x56')]);return db[_0x5a10('0x6b')][_0x5a10('0x2e')]({'where':_0xfb5207[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x3efc1c){_0x429f91[_0x5a10('0x2e')]=_0x3efc1c;if(_0x34db3f[_0x5a10('0x46')][_0x5a10('0x57')]){_0xfb5207[_0x5a10('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5a10('0x59')](_0xfb5207);})[_0x5a10('0x37')](function(_0x2c05b1){_0x429f91[_0x5a10('0x5a')]=_0x2c05b1;return _0x429f91;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x56d0eb,_0xfb5207))[_0x5a10('0x2b')](handleError(_0x56d0eb,null));};exports['removeAnswers']=function(_0x3ea06e,_0x341bac,_0x36e7be){return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x3ea06e[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x341bac,null))[_0x5a10('0x37')](function(_0x30530e){if(_0x30530e){return _0x30530e[_0x5a10('0x6e')](_0x3ea06e[_0x5a10('0x46')][_0x5a10('0x6f')]);}})['then'](respondWithStatusCode(_0x341bac,null))[_0x5a10('0x2b')](handleError(_0x341bac,null));};exports['create']=function(_0x591dc5,_0x29016f){var _0x3fa226={'name':_0x591dc5['body'][_0x5a10('0x3c')],'key':_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x70')],'email':_0x591dc5['body'][_0x5a10('0x71')],'ListId':_0x591dc5[_0x5a10('0x5f')]['ListId'],'active':!_[_0x5a10('0x72')](_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x73')])?_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x73')]:!![],'description':_0x591dc5[_0x5a10('0x5f')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x591dc5['body']['cservice'])){if(_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x74')]){_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x75')]=_0x3fa226[_0x5a10('0x40')]['user']=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x76')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x77')]=_0x3fa226[_0x5a10('0x40')][_0x5a10('0x78')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x79')];}else{_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7a')]=_0x3fa226['Smtp'][_0x5a10('0x7a')]=![];}_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7b')]=_0x591dc5['body'][_0x5a10('0x3f')][_0x5a10('0x7b')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7c')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x3f')][_0x5a10('0x7c')];_0x3fa226[_0x5a10('0x40')][_0x5a10('0x7b')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x40')]['host'];_0x3fa226[_0x5a10('0x40')][_0x5a10('0x7c')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x40')]['port'];}else{_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7d')]=_0x3fa226['Smtp'][_0x5a10('0x7d')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x7e')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x75')]=_0x3fa226[_0x5a10('0x40')]['user']=_0x591dc5['body']['cuser'];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x77')]=_0x3fa226[_0x5a10('0x40')]['pass']=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x79')];}return db[_0x5a10('0x42')][_0x5a10('0x64')](_0x3fa226,{'include':[{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40')},{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')}]})['then'](function(_0x3644c3){var _0x582fe4=_0x591dc5[_0x5a10('0x75')]['get']({'plain':!![]});if(!_0x582fe4)throw new Error(_0x5a10('0x7f'));if(_0x582fe4[_0x5a10('0x80')]===_0x5a10('0x75')){var _0x457918=_0x3644c3[_0x5a10('0x38')]({'plain':!![]});return db[_0x5a10('0x81')][_0x5a10('0x6a')]({'where':{'name':_0x5a10('0x82'),'userProfileId':_0x582fe4[_0x5a10('0x83')]},'raw':!![]})[_0x5a10('0x37')](function(_0x4a4cdd){if(_0x4a4cdd&&_0x4a4cdd[_0x5a10('0x84')]===0x0){return db[_0x5a10('0x39')][_0x5a10('0x64')]({'name':_0x457918[_0x5a10('0x3c')],'resourceId':_0x457918['id'],'type':_0x4a4cdd[_0x5a10('0x3c')],'sectionId':_0x4a4cdd['id']},{})[_0x5a10('0x37')](function(){return _0x3644c3;});}else{return _0x3644c3;}})['catch'](function(_0x36e2f5){logger[_0x5a10('0x27')](_0x5a10('0x85'),_0x36e2f5);throw _0x36e2f5;});}return _0x3644c3;})['then'](respondWithResult(_0x29016f,0xc9))[_0x5a10('0x2b')](handleError(_0x29016f,null));};exports[_0x5a10('0x86')]=function(_0x649cfb,_0x1c2051,_0x1238b9){return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x649cfb[_0x5a10('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1c2051,null))['then'](function(_0x4b7fb4){if(_0x4b7fb4){return _0x4b7fb4[_0x5a10('0x86')]();}return null;})[_0x5a10('0x37')](respondWithResult(_0x1c2051,null))[_0x5a10('0x2b')](handleError(_0x1c2051,null));};exports['addImap']=function(_0x21bf97,_0x2ca4ef,_0x3995f7){if(_0x21bf97[_0x5a10('0x5f')]['id']){delete _0x21bf97[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x21bf97[_0x5a10('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ca4ef,null))[_0x5a10('0x37')](function(_0x19a7bc){if(_0x19a7bc){_0x21bf97[_0x5a10('0x5f')][_0x5a10('0x62')]=_0x19a7bc['id'];return db[_0x5a10('0x3e')]['create'](_0x21bf97[_0x5a10('0x5f')]);}})['then'](respondWithResult(_0x2ca4ef,null))[_0x5a10('0x2b')](handleError(_0x2ca4ef,null));};exports[_0x5a10('0x87')]=function(_0x1c7005,_0x1bc3de,_0x2b84f2){return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x1c7005['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x1bc3de,null))['then'](function(_0x2fd5c9){if(_0x2fd5c9){return _0x2fd5c9[_0x5a10('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x1bc3de,null))[_0x5a10('0x2b')](handleError(_0x1bc3de,null));};exports[_0x5a10('0x89')]=function(_0x4b0661,_0x41fd3c,_0x160ccb){return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x4b0661[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x41fd3c,null))[_0x5a10('0x37')](function(_0x341de6){if(_0x341de6){return _0x341de6[_0x5a10('0x89')]();}return null;})[_0x5a10('0x37')](respondWithResult(_0x41fd3c,null))[_0x5a10('0x2b')](handleError(_0x41fd3c,null));};exports['addSmtp']=function(_0x20c3ec,_0x6175ac,_0x69a9f2){if(_0x20c3ec[_0x5a10('0x5f')]['id']){delete _0x20c3ec[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x20c3ec[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x6175ac,null))[_0x5a10('0x37')](function(_0x37124c){if(_0x37124c){_0x20c3ec['body'][_0x5a10('0x62')]=_0x37124c['id'];return db[_0x5a10('0x5d')][_0x5a10('0x64')](_0x20c3ec[_0x5a10('0x5f')]);}})[_0x5a10('0x37')](respondWithResult(_0x6175ac,null))[_0x5a10('0x2b')](handleError(_0x6175ac,null));};exports[_0x5a10('0x8a')]=function(_0x3502b6,_0x524a36,_0x4d6349){return db['MailAccount']['findOne']({'where':{'id':_0x3502b6['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x524a36,null))['then'](function(_0x24ddb5){if(_0x24ddb5){return _0x24ddb5[_0x5a10('0x8b')](null);}return null;})[_0x5a10('0x37')](respondWithStatusCode(_0x524a36,null))[_0x5a10('0x2b')](handleError(_0x524a36,null));};exports[_0x5a10('0x8c')]=function(_0x53a9c7,_0x50f052,_0x449cb8){return db[_0x5a10('0x8d')][_0x5a10('0x6a')]({'where':{'id':_0x53a9c7[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x50f052,null))[_0x5a10('0x37')](function(_0x5d117b){if(_0x5d117b){return _0x5d117b[_0x5a10('0x8c')](_0x53a9c7[_0x5a10('0x5f')]['ids'],_['omit'](_0x53a9c7[_0x5a10('0x5f')],[_0x5a10('0x6f'),'id'])||{});}})[_0x5a10('0x37')](respondWithResult(_0x50f052,null))[_0x5a10('0x2b')](handleError(_0x50f052,null));};exports[_0x5a10('0x8e')]=function(_0x5f34ab,_0x454ad2,_0x183953){var _0x183e40={'raw':![],'where':{}};var _0x38974d={};var _0x1fc0f9={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x5f34ab[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x454ad2,null))['then'](function(_0x4bd802){if(_0x4bd802){_0x38974d[_0x5a10('0x49')]=_[_0x5a10('0x47')](db['MailInteraction']['rawAttributes']);_0x38974d['query']=_[_0x5a10('0x47')](_0x5f34ab[_0x5a10('0x46')]);_0x38974d[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x38974d[_0x5a10('0x49')],_0x38974d[_0x5a10('0x46')]);_0x183e40[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x38974d['model'],qs[_0x5a10('0x4a')](_0x5f34ab[_0x5a10('0x46')]['fields']));_0x183e40[_0x5a10('0x4b')]=_0x183e40[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x183e40[_0x5a10('0x4b')]:_0x38974d[_0x5a10('0x49')];if(!_0x5f34ab['query']['hasOwnProperty'](_0x5a10('0x4d'))){_0x183e40[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x5f34ab[_0x5a10('0x46')]['limit']);_0x183e40[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0x183e40[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x5f34ab['query'][_0x5a10('0x4f')]);_0x183e40[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x5f34ab[_0x5a10('0x46')],_0x38974d['filters']));_0x183e40[_0x5a10('0x50')][_0x5a10('0x62')]=_0x4bd802['id'];if(_0x5f34ab[_0x5a10('0x46')]['filter']){_0x183e40['where']=_['merge'](_0x183e40[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x183e40[_0x5a10('0x4b')],function(_0x3bad10){var _0x359653={};_0x359653[_0x3bad10]={'$like':'%'+_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x359653;})});}_0x183e40=_[_0x5a10('0x53')]({},_0x183e40,_0x5f34ab[_0x5a10('0x56')]);return db[_0x5a10('0x8d')][_0x5a10('0x2e')]({'where':_0x183e40[_0x5a10('0x50')]})['then'](function(_0x55252c){_0x1fc0f9['count']=_0x55252c;if(_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x57')]){_0x183e40['include']=[{'model':db[_0x5a10('0x8f')],'as':_0x5a10('0x90'),'required':![]},{'model':db[_0x5a10('0x91')],'as':_0x5a10('0x92'),'attributes':[_0x5a10('0x3c'),_0x5a10('0x93'),_0x5a10('0x94')],'required':![]},{'model':db[_0x5a10('0x95')],'as':'Tags','attributes':['id',_0x5a10('0x3c'),_0x5a10('0x96')],'where':_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x97')]?{'id':_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x97')]}:undefined,'required':_0x5f34ab[_0x5a10('0x46')]['tag']?!![]:![]}];}return db[_0x5a10('0x8d')][_0x5a10('0x59')](_0x183e40);})[_0x5a10('0x37')](function(_0x31cfe2){_0x1fc0f9[_0x5a10('0x5a')]=_0x31cfe2;return _0x1fc0f9;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x454ad2,_0x183e40))['catch'](handleError(_0x454ad2,null));};exports[_0x5a10('0x98')]=function(_0x193f3f,_0x51ad55,_0x3ee1be){return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x193f3f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x51ad55,null))[_0x5a10('0x37')](function(_0x1ca00f){if(_0x1ca00f){return db[_0x5a10('0x99')][_0x5a10('0x9a')](function(_0x4f8bac){return db[_0x5a10('0x9b')][_0x5a10('0x3a')]({'where':{'MailAccountId':_0x193f3f[_0x5a10('0x5c')]['id']},'transaction':_0x4f8bac})['then'](function(_0x23dc65){var _0x586abd=_[_0x5a10('0x45')](_0x193f3f[_0x5a10('0x5f')],function(_0x32f023){_0x32f023['MailAccountId']=_0x193f3f[_0x5a10('0x5c')]['id'];return _0x32f023;});return db[_0x5a10('0x9b')][_0x5a10('0x9c')](_0x586abd,{'transaction':_0x4f8bac});});})['then'](function(){return db[_0x5a10('0x9b')]['findAndCountAll']({'where':{'MailAccountId':_0x193f3f['params']['id']},'order':_0x5a10('0x9d')});});}})[_0x5a10('0x37')](respondWithResult(_0x51ad55,null))[_0x5a10('0x2b')](handleError(_0x51ad55,null));};exports['getApplications']=function(_0x583ae7,_0x34d70b,_0xc01a0a){var _0x27e6b2={};var _0x146411={};var _0x5ab1ba;var _0x1e1685;return db[_0x5a10('0x42')]['findOne']({'where':{'id':_0x583ae7['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x34d70b,null))[_0x5a10('0x37')](function(_0x48b4b4){if(_0x48b4b4){_0x5ab1ba=_0x48b4b4;_0x146411['model']=_[_0x5a10('0x47')](db['MailApplication'][_0x5a10('0x67')]);_0x146411[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0x583ae7['query']);_0x146411['filters']=_[_0x5a10('0x48')](_0x146411['model'],_0x146411[_0x5a10('0x46')]);_0x27e6b2[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x146411['model'],qs['fields'](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x27e6b2[_0x5a10('0x4b')]=_0x27e6b2['attributes'][_0x5a10('0x6d')]?_0x27e6b2[_0x5a10('0x4b')]:_0x146411[_0x5a10('0x49')];_0x27e6b2[_0x5a10('0x4e')]=qs['sort'](_0x583ae7[_0x5a10('0x46')]['sort']);_0x27e6b2[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x583ae7[_0x5a10('0x46')],_0x146411[_0x5a10('0x51')]));if(_0x583ae7[_0x5a10('0x46')][_0x5a10('0x55')]){_0x27e6b2[_0x5a10('0x50')]=_['merge'](_0x27e6b2[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x27e6b2[_0x5a10('0x4b')],function(_0xdb80bd){var _0x3843a2={};_0x3843a2[_0xdb80bd]={'$like':'%'+_0x583ae7[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x3843a2;})});}_0x27e6b2=_[_0x5a10('0x53')]({},_0x27e6b2,_0x583ae7['options']);return _0x5ab1ba[_0x5a10('0x9e')](_0x27e6b2);}})['then'](function(_0x55a3ca){if(_0x55a3ca){_0x1e1685=_0x55a3ca['length'];if(!_0x583ae7['query']['hasOwnProperty'](_0x5a10('0x4d'))){_0x27e6b2['limit']=qs[_0x5a10('0x30')](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x30')]);_0x27e6b2[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x2f')]);}return _0x5ab1ba['getApplications'](_0x27e6b2);}})['then'](function(_0x58bff0){if(_0x58bff0){return _0x58bff0?{'count':_0x1e1685,'rows':_0x58bff0}:null;}})['then'](respondWithResult(_0x34d70b,null))[_0x5a10('0x2b')](handleError(_0x34d70b,null));};exports[_0x5a10('0x9f')]=function(_0x154bd1,_0x9e499,_0x5463b7){var _0x843181={'raw':!![],'where':{}};var _0x29b42b={};var _0x38acd9={'count':0x0,'rows':[]};return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x154bd1['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x9e499,null))[_0x5a10('0x37')](function(_0xbc9a1b){if(_0xbc9a1b){_0x29b42b[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0xa0')]['rawAttributes']);_0x29b42b[_0x5a10('0x46')]=_['keys'](_0x154bd1['query']);_0x29b42b['filters']=_[_0x5a10('0x48')](_0x29b42b[_0x5a10('0x49')],_0x29b42b[_0x5a10('0x46')]);_0x843181['attributes']=_[_0x5a10('0x48')](_0x29b42b[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x843181['attributes']=_0x843181[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x843181[_0x5a10('0x4b')]:_0x29b42b[_0x5a10('0x49')];if(!_0x154bd1[_0x5a10('0x46')][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x843181[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x30')]);_0x843181[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0x843181['order']=qs['sort'](_0x154bd1[_0x5a10('0x46')]['sort']);_0x843181[_0x5a10('0x50')]=qs['filters'](_[_0x5a10('0x52')](_0x154bd1[_0x5a10('0x46')],_0x29b42b[_0x5a10('0x51')]));_0x843181[_0x5a10('0x50')][_0x5a10('0x62')]=_0xbc9a1b['id'];if(_0x154bd1[_0x5a10('0x46')][_0x5a10('0x55')]){_0x843181[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x843181[_0x5a10('0x50')],{'$or':_['map'](_0x843181['attributes'],function(_0x504543){var _0x54b4c0={};_0x54b4c0[_0x504543]={'$like':'%'+_0x154bd1['query'][_0x5a10('0x55')]+'%'};return _0x54b4c0;})});}if(_0x154bd1['query'][_0x5a10('0xa1')]){var _0xec8f70=_0x154bd1[_0x5a10('0x46')][_0x5a10('0xa1')][_0x5a10('0xa2')](',');var _0x19cbe3={};_0x19cbe3[_0xec8f70[0x0]]={'$gte':moment(_0xec8f70[0x1])[_0x5a10('0xa3')](_0x5a10('0xa4'))};_0x843181[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x843181[_0x5a10('0x50')],_0x19cbe3);}_0x843181=_['merge']({},_0x843181,_0x154bd1[_0x5a10('0x56')]);return db[_0x5a10('0xa0')][_0x5a10('0x2e')]({'where':_0x843181[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x59b371){_0x38acd9[_0x5a10('0x2e')]=_0x59b371;if(_0x154bd1['query'][_0x5a10('0x57')]){_0x843181[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0xa0')][_0x5a10('0x59')](_0x843181);})[_0x5a10('0x37')](function(_0x46249e){_0x38acd9['rows']=_0x46249e;return _0x38acd9;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x9e499,_0x843181))[_0x5a10('0x2b')](handleError(_0x9e499,null));};exports[_0x5a10('0xa5')]=function(_0x23ce59,_0x5bc8ae,_0x4fa9d4){var _0x169392,_0xc0ccf9={},_0x52e0e0;if(_0x23ce59[_0x5a10('0x5f')]['to']){_0x52e0e0=_0x23ce59[_0x5a10('0x5f')]['to'][_0x5a10('0xa2')](',')[0x0];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x23ce59[_0x5a10('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x5a10('0xa6'),'include':[{'model':db[_0x5a10('0x8f')],'as':_0x5a10('0xa7'),'where':{'email':_0x52e0e0},'limit':0x1,'order':[[_0x5a10('0xa8'),_0x5a10('0xa9')]]}]},{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40'),'raw':!![]}]})[_0x5a10('0x37')](handleEntityNotFound(_0x5bc8ae,null))[_0x5a10('0x37')](function(_0x22e7be){if(_0x22e7be){_0x169392=_0x22e7be;if(_0x22e7be['Smtp']){if(_[_0x5a10('0x72')](_0x23ce59['body']['from'])){_0x23ce59[_0x5a10('0x5f')]['from']=util[_0x5a10('0xa3')](_0x5a10('0xaa'),_0x22e7be['name'],_0x22e7be[_0x5a10('0x71')]||_0x22e7be['Smtp'][_0x5a10('0x75')]);}if(_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')]&&_0x23ce59[_0x5a10('0x5f')]['attachments'][_0x5a10('0x6d')]){for(var _0x507fc9=0x0;_0x507fc9<_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x5a10('0x6d')];_0x507fc9+=0x1){_0x23ce59['body'][_0x5a10('0xab')][_0x507fc9]={'filename':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x507fc9]['name'],'path':path[_0x5a10('0xac')](config['root'],_0x5a10('0xad'),_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x507fc9][_0x5a10('0xae')])};}}var _0x241fc4={'tls':{'rejectUnauthorized':![]}};if(_[_0x5a10('0x72')](_0x22e7be[_0x5a10('0x40')][_0x5a10('0x7d')])){if(_0x22e7be['Smtp']['authentication']){_0x241fc4['auth']={'user':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x78')]};}_0x241fc4[_0x5a10('0x7b')]=_0x22e7be[_0x5a10('0x40')]['host'];_0x241fc4[_0x5a10('0x7c')]=_0x22e7be['Smtp']['port'];_0x241fc4['secure']=_0x22e7be[_0x5a10('0x40')]['secure'];}else{_0x241fc4[_0x5a10('0x7d')]=_0x22e7be['Smtp'][_0x5a10('0x7d')];_0x241fc4[_0x5a10('0xaf')]={'user':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x22e7be['Smtp'][_0x5a10('0x78')]};}return respondWithRpcPromise(_0x5a10('0xb0'),_0x5a10('0xb1'),{'account':_0x241fc4,'message':_0x23ce59[_0x5a10('0x5f')]});}else{throw new Error(_0x5a10('0xb2'));}}})['then'](function(_0x322caa){if(_0x322caa){_0xc0ccf9=_0x322caa;if(_0x169392['List']){if(_0x169392[_0x5a10('0xa6')][_0x5a10('0xa7')][_0x5a10('0x6d')]){return _0x169392[_0x5a10('0xa6')]['Contacts'][0x0];}else{return db[_0x5a10('0x8f')][_0x5a10('0x64')](_[_0x5a10('0xb3')](_0x23ce59[_0x5a10('0x5f')],{'firstName':_0x23ce59[_0x5a10('0x5f')]['to'],'email':_0x23ce59[_0x5a10('0x5f')]['to'],'phone':_0x23ce59[_0x5a10('0x5f')]['to'],'ListId':_0x169392[_0x5a10('0xb4')]}));}}else{throw new Error(_0x5a10('0xb2'));}}})[_0x5a10('0x37')](function(_0x135254){if(_0x135254){var _0x356e4a={'UserId':_0x23ce59[_0x5a10('0x75')]['id'],'ContactId':_0x135254['id'],'MailAccountId':_0x169392['id'],'inReplyTo':_0xc0ccf9[_0x5a10('0xb5')],'to':_0x23ce59['body']['from'],'cc':_0x23ce59['body']['cc'],'subject':_0x23ce59['body'][_0x5a10('0xb6')],'attach':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xb7')],'firstMsgDirection':_0x5a10('0xb8'),'lastMsgAt':moment()['format'](_0x5a10('0xa4')),'lastMsgDirection':_0x5a10('0xb8'),'lastMsgBody':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0x5f')],'Messages':[_[_0x5a10('0x53')](_0x23ce59[_0x5a10('0x5f')],{'messageId':_0xc0ccf9['messageId'],'sentAt':moment()[_0x5a10('0xa3')](_0x5a10('0xa4')),'read':!![],'MailAccountId':_0x169392['id'],'UserId':_0x23ce59[_0x5a10('0x75')]['id'],'ContactId':_0x135254['id']})]};if(_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xb9')]){_0x356e4a=_['merge'](_0x356e4a,_0x23ce59['body'][_0x5a10('0xb9')]);}return db['MailInteraction'][_0x5a10('0x64')](_0x356e4a,{'include':[{'model':db[_0x5a10('0xa0')],'as':_0x5a10('0xba')}]});}})[_0x5a10('0x37')](respondWithResult(_0x5bc8ae,null))[_0x5a10('0x2b')](handleError(_0x5bc8ae,null));};exports[_0x5a10('0xbb')]=function(_0x564a99,_0x587f2f,_0x31d9b4){return db['MailAccount'][_0x5a10('0x6a')]({'where':{'id':_0x564a99[_0x5a10('0x5c')]['id']},'include':[{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40'),'raw':!![]}]})[_0x5a10('0x37')](handleEntityNotFound(_0x587f2f,null))[_0x5a10('0x37')](function(_0x14496f){if(_0x14496f&&_0x14496f[_0x5a10('0x40')]){var _0xa2f278={'id':_0x14496f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14496f[_0x5a10('0x40')][_0x5a10('0x7d')]){_0xa2f278[_0x5a10('0x7d')]=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7d')];}else{_0xa2f278[_0x5a10('0x7b')]=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7b')];_0xa2f278['port']=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7c')];_0xa2f278['secure']=_0x14496f[_0x5a10('0x40')][_0x5a10('0xbc')];}if(_0x14496f[_0x5a10('0x40')][_0x5a10('0x7a')]){_0xa2f278[_0x5a10('0xaf')]={'user':_0x14496f[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x14496f[_0x5a10('0x40')][_0x5a10('0x78')]};}return respondWithRpcPromise(_0x5a10('0xbd'),_0x5a10('0xbb'),{'account':_0xa2f278});}})['then'](respondWithResult(_0x587f2f,null))[_0x5a10('0x2b')](handleError(_0x587f2f,null));};exports['destroy']=function(_0x3f836f,_0x50da26){return db['MailAccount'][_0x5a10('0x6a')]({'where':{'id':_0x3f836f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x50da26,null))[_0x5a10('0x37')](function(_0x32d692){if(_0x32d692&&_0x32d692[_0x5a10('0x7d')]){throw new db[(_0x5a10('0xbe'))][(_0x5a10('0xbf'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x32d692;})[_0x5a10('0x37')](removeEntity(_0x50da26,null))[_0x5a10('0x2b')](handleError(_0x50da26,null));};exports[_0x5a10('0xc0')]=function(_0x373917,_0x38b0af,_0x313e76){return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x373917['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x38b0af,null))[_0x5a10('0x37')](function(_0x1bc850){if(_0x1bc850){return _0x1bc850[_0x5a10('0xc0')](_0x373917[_0x5a10('0x5f')][_0x5a10('0x6f')],_['omit'](_0x373917['body'],[_0x5a10('0x6f'),'id'])||{})[_0x5a10('0xc1')](function(_0xf9ce35){for(var _0x20cdf5=0x0;_0x20cdf5<_0x373917[_0x5a10('0x5f')][_0x5a10('0x6f')][_0x5a10('0x6d')];_0x20cdf5+=0x1){socket[_0x5a10('0xc2')](_0x5a10('0xc3'),{'UserId':_0x373917['body']['ids'][_0x20cdf5],'MailAccountId':_0x373917[_0x5a10('0x5c')]['id']});}return _0xf9ce35;});}})['then'](respondWithResult(_0x38b0af,null))[_0x5a10('0x2b')](handleError(_0x38b0af,null));};exports['removeAgents']=function(_0x21d534,_0x319f82,_0x5c7435){return db[_0x5a10('0x42')]['find']({'where':{'id':_0x21d534['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x319f82,null))[_0x5a10('0x37')](function(_0x1770e7){if(_0x1770e7){return _0x1770e7['removeAgents'](_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')])[_0x5a10('0x37')](function(){if(_[_0x5a10('0xc4')](_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')])){for(var _0x209b50=0x0;_0x209b50<_0x21d534['query']['ids'][_0x5a10('0x6d')];_0x209b50+=0x1){socket[_0x5a10('0xc2')](_0x5a10('0xc5'),{'UserId':Number(_0x21d534['query'][_0x5a10('0x6f')][_0x209b50]),'MailAccountId':Number(_0x21d534[_0x5a10('0x5c')]['id'])});}}else{socket[_0x5a10('0xc2')](_0x5a10('0xc5'),{'UserId':Number(_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')]),'MailAccountId':Number(_0x21d534[_0x5a10('0x5c')]['id'])});}});}})[_0x5a10('0x37')](respondWithStatusCode(_0x319f82,null))[_0x5a10('0x2b')](handleError(_0x319f82,null));};exports['getAgents']=function(_0x57b8df,_0x2bbddc,_0x552d06){var _0x1f3beb={};var _0x536fa0={};var _0x480d73;var _0xd31b18;return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x57b8df[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x2bbddc,null))[_0x5a10('0x37')](function(_0x3035ce){if(_0x3035ce){_0x480d73=_0x3035ce;_0x536fa0[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x91')][_0x5a10('0x67')]);_0x536fa0['query']=_[_0x5a10('0x47')](_0x57b8df[_0x5a10('0x46')]);_0x536fa0[_0x5a10('0x51')]=_['intersection'](_0x536fa0[_0x5a10('0x49')],_0x536fa0[_0x5a10('0x46')]);_0x1f3beb[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x536fa0[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x1f3beb[_0x5a10('0x4b')]=_0x1f3beb[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x1f3beb[_0x5a10('0x4b')]:_0x536fa0[_0x5a10('0x49')];_0x1f3beb[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x57b8df['query']['sort']);_0x1f3beb[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x57b8df[_0x5a10('0x46')],_0x536fa0[_0x5a10('0x51')]));if(_0x57b8df[_0x5a10('0x46')][_0x5a10('0x55')]){_0x1f3beb[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x1f3beb['where'],{'$or':_[_0x5a10('0x45')](_0x1f3beb[_0x5a10('0x4b')],function(_0x2411a4){var _0x598716={};_0x598716[_0x2411a4]={'$like':'%'+_0x57b8df[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x598716;})});}_0x1f3beb=_[_0x5a10('0x53')]({},_0x1f3beb,_0x57b8df['options']);return _0x480d73[_0x5a10('0xc6')](_0x1f3beb);}})[_0x5a10('0x37')](function(_0x589da2){if(_0x589da2){_0xd31b18=_0x589da2['length'];if(!_0x57b8df['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x1f3beb[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x30')]);_0x1f3beb[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x2f')]);}return _0x480d73[_0x5a10('0xc6')](_0x1f3beb);}})[_0x5a10('0x37')](function(_0x3ef9b3){if(_0x3ef9b3){return _0x3ef9b3?{'count':_0xd31b18,'rows':_0x3ef9b3}:null;}})[_0x5a10('0x37')](respondWithResult(_0x2bbddc,null))[_0x5a10('0x2b')](handleError(_0x2bbddc,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d3c03f3..e4e3f12 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 _0xb073=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0xb073,0x187));var _0x3b07=function(_0x4b31b2,_0x1d53b2){_0x4b31b2=_0x4b31b2-0x0;var _0x5722e9=_0xb073[_0x4b31b2];return _0x5722e9;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x3b07('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3b07('0x1')](0x0);var events={'afterCreate':_0x3b07('0x2'),'afterUpdate':_0x3b07('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d1733){return function(_0x3112da,_0x31e382,_0x48cf22){MailAccountEvents[_0x3b07('0x4')](_0x3d1733+':'+_0x3112da['id'],_0x3112da);MailAccountEvents[_0x3b07('0x4')](_0x3d1733,_0x3112da);_0x48cf22(null);};}for(var e in events){if(events[_0x3b07('0x5')](e)){var event=events[e];MailAccount[_0x3b07('0x6')](e,emitEvent(event));}}module[_0x3b07('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xe3c1=['MailAccount','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x539f96,_0x4b5d54){var _0x4f977f=function(_0x6a1b3f){while(--_0x6a1b3f){_0x539f96['push'](_0x539f96['shift']());}};_0x4f977f(++_0x4b5d54);}(_0xe3c1,0xbf));var _0x1e3c=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xe3c1[_0x277721];return _0x286051;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1e3c('0x0'))['db'][_0x1e3c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e3c('0x2'),'afterUpdate':_0x1e3c('0x3'),'afterDestroy':_0x1e3c('0x4')};function emitEvent(_0x620092){return function(_0x339784,_0x755df5,_0x22d2ba){MailAccountEvents[_0x1e3c('0x5')](_0x620092+':'+_0x339784['id'],_0x339784);MailAccountEvents['emit'](_0x620092,_0x339784);_0x22d2ba(null);};}for(var e in events){if(events[_0x1e3c('0x6')](e)){var event=events[e];MailAccount[_0x1e3c('0x7')](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 92f64d8..e54281b 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 _0x1917=['mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x1fbf00,_0x233988){var _0x442c92=function(_0x4756e){while(--_0x4756e){_0x1fbf00['push'](_0x1fbf00['shift']());}};_0x442c92(++_0x233988);}(_0x1917,0x9b));var _0x7191=function(_0x2565c3,_0x26f328){_0x2565c3=_0x2565c3-0x0;var _0x3547e6=_0x1917[_0x2565c3];return _0x3547e6;};'use strict';var _=require(_0x7191('0x0'));var util=require('util');var logger=require(_0x7191('0x1'))(_0x7191('0x2'));var moment=require(_0x7191('0x3'));var BPromise=require(_0x7191('0x4'));var rp=require(_0x7191('0x5'));var fs=require('fs');var path=require(_0x7191('0x6'));var rimraf=require(_0x7191('0x7'));var config=require(_0x7191('0x8'));var attributes=require(_0x7191('0x9'));module[_0x7191('0xa')]=function(_0x45ba3e,_0xb5f22f){return _0x45ba3e[_0x7191('0xb')](_0x7191('0xc'),attributes,{'tableName':_0x7191('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5308=['bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','util','../../config/logger','api','moment'];(function(_0x65ca71,_0x126845){var _0x5cb16e=function(_0xe1143b){while(--_0xe1143b){_0x65ca71['push'](_0x65ca71['shift']());}};_0x5cb16e(++_0x126845);}(_0x5308,0x11c));var _0x8530=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x5308[_0x533e4e];return _0x1f14bb;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var logger=require(_0x8530('0x1'))(_0x8530('0x2'));var moment=require(_0x8530('0x3'));var BPromise=require(_0x8530('0x4'));var rp=require(_0x8530('0x5'));var fs=require('fs');var path=require(_0x8530('0x6'));var rimraf=require(_0x8530('0x7'));var config=require('../../config/environment');var attributes=require(_0x8530('0x8'));module[_0x8530('0x9')]=function(_0x3b6887,_0x1a2db3){return _0x3b6887[_0x8530('0xa')](_0x8530('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index cad11fa..fb184bd 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 _0x292b=['startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','MailAccount','find','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','orderBy','asc','autoclose','push','length','*,*,*,*','Contacts','create','contact','messageId','generate','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','Attachment','UserId','name','agent','Start'];(function(_0x1317a6,_0x2efc56){var _0x3694d0=function(_0x3c9112){while(--_0x3c9112){_0x1317a6['push'](_0x1317a6['shift']());}};_0x3694d0(++_0x2efc56);}(_0x292b,0x64));var _0xb292=function(_0x2c5d4d,_0x1d4d5e){_0x2c5d4d=_0x2c5d4d-0x0;var _0x14dfe0=_0x292b[_0x2c5d4d];return _0x14dfe0;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var moment=require(_0xb292('0x2'));var BPromise=require(_0xb292('0x3'));var rs=require(_0xb292('0x4'));var fs=require('fs');var Redis=require(_0xb292('0x5'));var db=require(_0xb292('0x6'))['db'];var utils=require(_0xb292('0x7'));var logger=require(_0xb292('0x8'))(_0xb292('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb292('0xa')]({'port':0x232c});config[_0xb292('0xb')]=_[_0xb292('0xc')](config['redis'],{'host':_0xb292('0xd'),'port':0x18eb});var socket=require(_0xb292('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xb292('0xf')](socket);function respondWithRpcPromise(_0xa30857,_0x36be8a,_0x5b4b7a){return new BPromise(function(_0x36517c,_0x3e4ac2){return client[_0xb292('0x10')](_0xa30857,_0x5b4b7a)[_0xb292('0x11')](function(_0x537d8b){logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,_0xb292('0x14'));logger[_0xb292('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x36be8a,_0xb292('0x14'),JSON[_0xb292('0x16')](_0x537d8b));if(_0x537d8b['error']){if(_0x537d8b['error']['code']===0x1f4){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x3e4ac2(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}logger[_0xb292('0x17')]('MailAccount,\x20%s,\x20%s',_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x36517c(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}else{logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,'request\x20sent');_0x36517c(_0x537d8b[_0xb292('0x19')][_0xb292('0x18')]);}})[_0xb292('0x1a')](function(_0x3ad738){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x3ad738);_0x3e4ac2(_0x3ad738);});});}exports[_0xb292('0x1b')]=function(_0x50e400){var _0x3a56eb=this;return new Promise(function(_0x336785,_0x4437d6){return db['MailAccount'][_0xb292('0x1c')]({'raw':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x50e400['options']?_0x50e400[_0xb292('0x1d')]['where']||null:null,'attributes':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1f')]||null:null,'limit':_0x50e400['options']?_0x50e400[_0xb292('0x1d')][_0xb292('0x20')]||null:null,'include':_0x50e400[_0xb292('0x1d')]?_0x50e400[_0xb292('0x1d')][_0xb292('0x21')]?_[_0xb292('0x22')](_0x50e400['options']['include'],function(_0x5537ee){return{'model':db[_0x5537ee['model']],'as':_0x5537ee['as'],'attributes':_0x5537ee[_0xb292('0x1f')],'include':_0x5537ee[_0xb292('0x21')]?_[_0xb292('0x22')](_0x5537ee['include'],function(_0x4a1575){return{'model':db[_0x4a1575[_0xb292('0x23')]],'as':_0x4a1575['as'],'attributes':_0x4a1575[_0xb292('0x1f')],'include':_0x4a1575['include']?_['map'](_0x4a1575[_0xb292('0x21')],function(_0xde939c){return{'model':db[_0xde939c[_0xb292('0x23')]],'as':_0xde939c['as'],'attributes':_0xde939c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x5e5a29){logger[_0xb292('0x12')](_0xb292('0x1b'),_0x50e400);logger[_0xb292('0x15')](_0xb292('0x1b'),_0x50e400,JSON[_0xb292('0x16')](_0x5e5a29));_0x336785(_0x5e5a29);})[_0xb292('0x1a')](function(_0xe01a3b){logger['error'](_0xb292('0x1b'),_0xe01a3b[_0xb292('0x18')],_0x50e400);_0x4437d6(_0x3a56eb[_0xb292('0x17')](0x1f4,_0xe01a3b[_0xb292('0x18')]));});});};exports['ShowMailAccount']=function(_0x234fdc){var _0x110384=this;return new Promise(function(_0x444dc0,_0x33b8cf){return db[_0xb292('0x24')][_0xb292('0x25')]({'raw':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')]['where']||null:null,'attributes':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1f')]||null:null,'include':_0x234fdc[_0xb292('0x1d')]?_0x234fdc['options']['include']?_[_0xb292('0x22')](_0x234fdc[_0xb292('0x1d')][_0xb292('0x21')],function(_0x7c58e3){return{'model':db[_0x7c58e3['model']],'as':_0x7c58e3['as'],'attributes':_0x7c58e3['attributes'],'include':_0x7c58e3[_0xb292('0x21')]?_[_0xb292('0x22')](_0x7c58e3[_0xb292('0x21')],function(_0xd1f9ae){return{'model':db[_0xd1f9ae[_0xb292('0x23')]],'as':_0xd1f9ae['as'],'attributes':_0xd1f9ae['attributes'],'include':_0xd1f9ae[_0xb292('0x21')]?_[_0xb292('0x22')](_0xd1f9ae[_0xb292('0x21')],function(_0x335d9c){return{'model':db[_0x335d9c[_0xb292('0x23')]],'as':_0x335d9c['as'],'attributes':_0x335d9c[_0xb292('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x1907e1){logger[_0xb292('0x12')](_0xb292('0x26'),_0x234fdc);logger[_0xb292('0x15')](_0xb292('0x26'),_0x234fdc,JSON[_0xb292('0x16')](_0x1907e1));_0x444dc0(_0x1907e1);})['catch'](function(_0x40d82c){logger[_0xb292('0x17')](_0xb292('0x26'),_0x40d82c[_0xb292('0x18')],_0x234fdc);_0x33b8cf(_0x110384[_0xb292('0x17')](0x1f4,_0x40d82c['message']));});});};exports[_0xb292('0x27')]=function(_0x4eb807){var _0x248bfb=this;return new Promise(function(_0x298cf3,_0x5ebccb){var _0x26c92b={'body':_0x4eb807[_0xb292('0x28')],'channel':'mail'};var _0x17e452=_[_0xb292('0x29')](_['keys'](db[_0xb292('0x2a')][_0xb292('0x2b')]),[_0xb292('0x2c'),_0xb292('0x2d'),_0xb292('0x2e'),_0xb292('0x2f')]);var _0x4e3431=![];if(_0x4eb807[_0xb292('0x28')]['id']){delete _0x4eb807[_0xb292('0x28')]['id'];}if(_['isNil'](_0x4eb807[_0xb292('0x28')][_0xb292('0x30')])){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x31')));}if(_[_0xb292('0x32')](_0x4eb807[_0xb292('0x28')][_0xb292('0x28')])||_0x4eb807[_0xb292('0x28')][_0xb292('0x28')]===''){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x33')));}if(_[_0xb292('0x32')](_0x4eb807[_0xb292('0x28')][_0xb292('0x34')])){return _0x5ebccb(_0x248bfb[_0xb292('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17e452));}if(!_[_0xb292('0x35')](_0x17e452,_0x4eb807[_0xb292('0x28')][_0xb292('0x34')])){return _0x5ebccb(_0x248bfb['error'](0x1f4,_0xb292('0x36')+_0x17e452));}var _0x373fff={};_0x373fff[_0x4eb807[_0xb292('0x28')][_0xb292('0x34')]]=_0x4eb807[_0xb292('0x28')][_0xb292('0x30')];return db[_0xb292('0x24')][_0xb292('0x25')]({'where':{'id':_0x4eb807[_0xb292('0x37')]['id']},'include':[{'model':db[_0xb292('0x38')],'as':_0xb292('0x39'),'include':[{'model':db[_0xb292('0x2a')],'as':'Contacts','where':_0x373fff,'limit':0x1,'order':[['updatedAt',_0xb292('0x3a')]]}]},{'model':db[_0xb292('0x3b')],'as':'Applications'},{'model':db[_0xb292('0x3c')],'as':_0xb292('0x3d')}]})[_0xb292('0x11')](function(_0x12f32f){if(_0x12f32f&&_0x12f32f[_0xb292('0x39')]){var _0x10bdd3=_0x12f32f[_0xb292('0x3e')]({'plain':!![]});_0x26c92b[_0xb292('0x37')]=_[_0xb292('0x3f')](_0x10bdd3,[_0xb292('0x40'),_0xb292('0x39')]);_0x26c92b['applications']=_0x10bdd3[_0xb292('0x40')];_0x26c92b['list']=_0x10bdd3['List'];_0x26c92b[_0xb292('0x41')]=_[_0xb292('0x42')](_0x26c92b['applications'],['priority'],[_0xb292('0x43')]);if(_0x26c92b['account']&&_0x26c92b[_0xb292('0x37')][_0xb292('0x44')]){_0x26c92b['applications'][_0xb292('0x45')]({'id':0x0,'priority':_0x26c92b[_0xb292('0x41')][_0xb292('0x46')]+0x1,'app':'close','appdata':_0xb292('0x44'),'interval':_0xb292('0x47')});}if(_0x26c92b[_0xb292('0x37')][_0xb292('0x40')]){delete _0x26c92b[_0xb292('0x37')][_0xb292('0x40')];}if(_0x26c92b[_0xb292('0x37')][_0xb292('0x39')]){delete _0x26c92b[_0xb292('0x37')][_0xb292('0x39')];}if(_0x10bdd3['List'][_0xb292('0x48')]['length']){return _0x10bdd3[_0xb292('0x39')][_0xb292('0x48')][0x0];}var _0x4bb50f=_[_0xb292('0xc')](_0x4eb807[_0xb292('0x28')],{'firstName':_0x4eb807[_0xb292('0x28')][_0xb292('0x30')],'ListId':_0x10bdd3[_0xb292('0x2f')]});_0x4bb50f[_0x4eb807[_0xb292('0x28')][_0xb292('0x34')]]=_0x4eb807[_0xb292('0x28')][_0xb292('0x30')];return db[_0xb292('0x2a')][_0xb292('0x49')](_0x4bb50f);}else{throw new Error('List\x20not\x20found');}})[_0xb292('0x11')](function(_0x3eaa51){_0x26c92b[_0xb292('0x4a')]=_0x3eaa51;if(_0x3eaa51){if(!_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')]){_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')]=rs[_0xb292('0x4c')]()+'\x20'+_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')];}var _0x2bd934={'ContactId':_0x3eaa51['id'],'MailAccountId':_0x4eb807['account']['id'],'inReplyTo':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x4b')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')],'cc':_0x4eb807[_0xb292('0x28')]['message']['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['subject'],'attach':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['attach'],'lastMsgAt':moment()[_0xb292('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4eb807[_0xb292('0x28')]['body']};return db[_0xb292('0x4e')][_0xb292('0x25')]({'where':{'closed':![],'MailAccountId':_0x4eb807[_0xb292('0x37')]['id']},'include':[{'model':db[_0xb292('0x4f')],'as':_0xb292('0x50'),'attributes':['messageId'],'where':{'messageId':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x51')]}}]})['then'](function(_0x28edc0){if(_0x28edc0){return[_0x28edc0,![]];}return db['MailInteraction']['create'](_0x2bd934)['then'](function(_0x5c5f6d){return[_0x5c5f6d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb292('0x52')](function(_0x38eb01,_0x196e8c){if(_0x38eb01){_0x4e3431=_0x196e8c;if(!_0x196e8c){return _0x38eb01[_0xb292('0x53')]({'inReplyTo':_0x4eb807['body']['message'][_0xb292('0x4b')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x30')],'cc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x54')],'attach':_0x38eb01[_0xb292('0x55')]?_0x38eb01['attach']:_0x4eb807['body'][_0xb292('0x18')][_0xb292('0x55')],'substatus':null,'substatusAt':moment()['format'](_0xb292('0x56')),'lastMsgAt':moment()[_0xb292('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4eb807[_0xb292('0x28')][_0xb292('0x28')]});}else{return _0x38eb01;}}})[_0xb292('0x11')](function(_0x5e6620){_0x26c92b[_0xb292('0x57')]=_0x5e6620[_0xb292('0x3e')]({'plain':!![]});_0x26c92b[_0xb292('0x57')][_0xb292('0x58')]=_0x4e3431;return db['MailMessage'][_0xb292('0x49')]({'body':_0x4eb807['body'][_0xb292('0x28')],'MailAccountId':_0x4eb807['account']['id'],'MailInteractionId':_0x5e6620['id'],'direction':'in','ContactId':_0x26c92b[_0xb292('0x4a')]['id'],'messageId':_0x4eb807[_0xb292('0x28')]['message'][_0xb292('0x4b')],'from':_0x4eb807['body'][_0xb292('0x18')][_0xb292('0x30')],'to':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['to'],'cc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['cc'],'subject':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x54')],'attach':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')]['attach'],'Attachments':_0x4eb807['body']['message'][_0xb292('0x59')],'originTo':_0x4eb807[_0xb292('0x28')]['message'][_0xb292('0x5a')],'originCc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x5b')],'bcc':_0x4eb807[_0xb292('0x28')][_0xb292('0x18')][_0xb292('0x5c')]},{'include':[{'model':db[_0xb292('0x5d')],'as':'Attachments'}]});})['then'](function(_0x3e5e8f){_0x26c92b[_0xb292('0x18')]=_0x3e5e8f;if(_0x26c92b[_0xb292('0x57')][_0xb292('0x5e')]){return db['User'][_0xb292('0x25')]({'attributes':['id',_0xb292('0x5f')],'where':{'id':_0x26c92b[_0xb292('0x57')][_0xb292('0x5e')]}})[_0xb292('0x11')](function(_0x25a5f9){if(_0x25a5f9){_0x26c92b[_0xb292('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb292('0x60'),'appdata':_0x25a5f9[_0xb292('0x5f')]+','+(_0x26c92b[_0xb292('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0xb292('0x47')});}return respondWithRpcPromise(_0xb292('0x61'),_0xb292('0x62'),_0x26c92b);});}return respondWithRpcPromise(_0xb292('0x61'),_0xb292('0x62'),_0x26c92b);})[_0xb292('0x11')](function(_0x245d67){_0x298cf3(_0x245d67);})[_0xb292('0x1a')](function(_0xc32b0c){_0x5ebccb(_0x248bfb['error'](0x1f4,_0xc32b0c[_0xb292('0x18')]));});});}; \ No newline at end of file +var _0xf958=['subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','get','created','MailMessage','attachments','originTo','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','List','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','defaults','create','contact','messageId','generate'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xf958,0xe6));var _0x8f95=function(_0x3284d4,_0x2108c2){_0x3284d4=_0x3284d4-0x0;var _0x1639fa=_0xf958[_0x3284d4];return _0x1639fa;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232c});config[_0x8f95('0x9')]=_['defaults'](config[_0x8f95('0x9')],{'host':_0x8f95('0xa'),'port':0x18eb});var socket=require(_0x8f95('0xb'))(new Redis(config[_0x8f95('0x9')]));require(_0x8f95('0xc'))['register'](socket);function respondWithRpcPromise(_0x378eb1,_0x604646,_0x56d8e2){return new BPromise(function(_0x382f2c,_0x4e97bd){return client[_0x8f95('0xd')](_0x378eb1,_0x56d8e2)['then'](function(_0x4192df){logger[_0x8f95('0xe')](_0x8f95('0xf'),_0x604646,'request\x20sent');logger[_0x8f95('0x10')](_0x8f95('0x11'),_0x604646,_0x8f95('0x12'),JSON['stringify'](_0x4192df));if(_0x4192df[_0x8f95('0x13')]){if(_0x4192df[_0x8f95('0x13')][_0x8f95('0x14')]===0x1f4){logger[_0x8f95('0x13')](_0x8f95('0xf'),_0x604646,_0x4192df[_0x8f95('0x13')][_0x8f95('0x15')]);return _0x4e97bd(_0x4192df['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x604646,_0x4192df['error'][_0x8f95('0x15')]);return _0x382f2c(_0x4192df[_0x8f95('0x13')][_0x8f95('0x15')]);}else{logger[_0x8f95('0xe')]('MailAccount,\x20%s,\x20%s',_0x604646,'request\x20sent');_0x382f2c(_0x4192df[_0x8f95('0x16')][_0x8f95('0x15')]);}})['catch'](function(_0x445db0){logger[_0x8f95('0x13')](_0x8f95('0xf'),_0x604646,_0x445db0);_0x4e97bd(_0x445db0);});});}exports[_0x8f95('0x17')]=function(_0x4f2f60){var _0x258003=this;return new Promise(function(_0x30e0c5,_0x2b90bf){return db[_0x8f95('0x18')]['findAll']({'raw':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f2f60[_0x8f95('0x19')]?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1b')]||null:null,'attributes':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1c')]||null:null,'limit':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1d')]||null:null,'include':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x4f2f60[_0x8f95('0x19')]['include'],function(_0x2ef192){return{'model':db[_0x2ef192['model']],'as':_0x2ef192['as'],'attributes':_0x2ef192['attributes'],'include':_0x2ef192[_0x8f95('0x1e')]?_['map'](_0x2ef192[_0x8f95('0x1e')],function(_0x5ccb23){return{'model':db[_0x5ccb23['model']],'as':_0x5ccb23['as'],'attributes':_0x5ccb23[_0x8f95('0x1c')],'include':_0x5ccb23['include']?_[_0x8f95('0x1f')](_0x5ccb23['include'],function(_0x43c843){return{'model':db[_0x43c843[_0x8f95('0x20')]],'as':_0x43c843['as'],'attributes':_0x43c843[_0x8f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f95('0x21')](function(_0x467956){logger[_0x8f95('0xe')](_0x8f95('0x17'),_0x4f2f60);logger[_0x8f95('0x10')](_0x8f95('0x17'),_0x4f2f60,JSON[_0x8f95('0x22')](_0x467956));_0x30e0c5(_0x467956);})[_0x8f95('0x23')](function(_0x5e11c4){logger[_0x8f95('0x13')](_0x8f95('0x17'),_0x5e11c4['message'],_0x4f2f60);_0x2b90bf(_0x258003['error'](0x1f4,_0x5e11c4['message']));});});};exports[_0x8f95('0x24')]=function(_0x5b55b2){var _0x214975=this;return new Promise(function(_0x576160,_0x5841d1){return db[_0x8f95('0x18')][_0x8f95('0x25')]({'raw':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1b')]||null:null,'attributes':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')]['attributes']||null:null,'include':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2['options'][_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1e')],function(_0x502689){return{'model':db[_0x502689[_0x8f95('0x20')]],'as':_0x502689['as'],'attributes':_0x502689[_0x8f95('0x1c')],'include':_0x502689[_0x8f95('0x1e')]?_['map'](_0x502689['include'],function(_0x45f4e9){return{'model':db[_0x45f4e9[_0x8f95('0x20')]],'as':_0x45f4e9['as'],'attributes':_0x45f4e9['attributes'],'include':_0x45f4e9[_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x45f4e9[_0x8f95('0x1e')],function(_0x21391f){return{'model':db[_0x21391f[_0x8f95('0x20')]],'as':_0x21391f['as'],'attributes':_0x21391f[_0x8f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f95('0x21')](function(_0x20da0b){logger[_0x8f95('0xe')](_0x8f95('0x24'),_0x5b55b2);logger[_0x8f95('0x10')](_0x8f95('0x24'),_0x5b55b2,JSON[_0x8f95('0x22')](_0x20da0b));_0x576160(_0x20da0b);})[_0x8f95('0x23')](function(_0x48efca){logger[_0x8f95('0x13')](_0x8f95('0x24'),_0x48efca[_0x8f95('0x15')],_0x5b55b2);_0x5841d1(_0x214975[_0x8f95('0x13')](0x1f4,_0x48efca[_0x8f95('0x15')]));});});};exports[_0x8f95('0x26')]=function(_0x220e47){var _0x2fc45f=this;return new Promise(function(_0x109840,_0x2ee915){var _0xd7bfec={'body':_0x220e47[_0x8f95('0x27')],'channel':_0x8f95('0x28')};var _0x2265bf=_['difference'](_[_0x8f95('0x29')](db[_0x8f95('0x2a')][_0x8f95('0x2b')]),[_0x8f95('0x2c'),_0x8f95('0x2d'),_0x8f95('0x2e'),_0x8f95('0x2f')]);var _0x423329=![];if(_0x220e47['body']['id']){delete _0x220e47[_0x8f95('0x27')]['id'];}if(_[_0x8f95('0x30')](_0x220e47[_0x8f95('0x27')][_0x8f95('0x31')])){return _0x2ee915(_0x2fc45f[_0x8f95('0x13')](0x1f4,_0x8f95('0x32')));}if(_['isNil'](_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')])||_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]===''){return _0x2ee915(_0x2fc45f['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')])){return _0x2ee915(_0x2fc45f['error'](0x1f4,_0x8f95('0x34')+_0x2265bf));}if(!_['includes'](_0x2265bf,_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')])){return _0x2ee915(_0x2fc45f['error'](0x1f4,_0x8f95('0x35')+_0x2265bf));}var _0xd051e9={};_0xd051e9[_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')]]=_0x220e47[_0x8f95('0x27')][_0x8f95('0x31')];return db[_0x8f95('0x18')][_0x8f95('0x25')]({'where':{'id':_0x220e47[_0x8f95('0x36')]['id']},'include':[{'model':db[_0x8f95('0x37')],'as':'List','include':[{'model':db[_0x8f95('0x2a')],'as':_0x8f95('0x38'),'where':_0xd051e9,'limit':0x1,'order':[[_0x8f95('0x2d'),_0x8f95('0x39')]]}]},{'model':db[_0x8f95('0x3a')],'as':_0x8f95('0x3b')},{'model':db[_0x8f95('0x3c')],'as':_0x8f95('0x3d')}]})[_0x8f95('0x21')](function(_0x2627e7){if(_0x2627e7&&_0x2627e7[_0x8f95('0x3e')]){var _0x704c2a=_0x2627e7['get']({'plain':!![]});_0xd7bfec[_0x8f95('0x36')]=_[_0x8f95('0x3f')](_0x704c2a,[_0x8f95('0x3b'),_0x8f95('0x3e')]);_0xd7bfec[_0x8f95('0x40')]=_0x704c2a[_0x8f95('0x3b')];_0xd7bfec[_0x8f95('0x41')]=_0x704c2a['List'];_0xd7bfec[_0x8f95('0x40')]=_[_0x8f95('0x42')](_0xd7bfec[_0x8f95('0x40')],[_0x8f95('0x43')],[_0x8f95('0x44')]);if(_0xd7bfec['account']&&_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x45')]){_0xd7bfec[_0x8f95('0x40')][_0x8f95('0x46')]({'id':0x0,'priority':_0xd7bfec['applications'][_0x8f95('0x47')]+0x1,'app':_0x8f95('0x48'),'appdata':_0x8f95('0x45'),'interval':_0x8f95('0x49')});}if(_0xd7bfec['account'][_0x8f95('0x3b')]){delete _0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3b')];}if(_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3e')]){delete _0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3e')];}if(_0x704c2a[_0x8f95('0x3e')][_0x8f95('0x38')][_0x8f95('0x47')]){return _0x704c2a[_0x8f95('0x3e')]['Contacts'][0x0];}var _0x4aaa74=_[_0x8f95('0x4a')](_0x220e47[_0x8f95('0x27')],{'firstName':_0x220e47['body'][_0x8f95('0x31')],'ListId':_0x704c2a['ListId']});_0x4aaa74[_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')]]=_0x220e47['body']['from'];return db[_0x8f95('0x2a')][_0x8f95('0x4b')](_0x4aaa74);}else{throw new Error('List\x20not\x20found');}})[_0x8f95('0x21')](function(_0x56fe61){_0xd7bfec[_0x8f95('0x4c')]=_0x56fe61;if(_0x56fe61){if(!_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4d')]){_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x4d')]=rs[_0x8f95('0x4e')]()+'\x20'+_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['from'];}var _0x2015a1={'ContactId':_0x56fe61['id'],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id'],'inReplyTo':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['messageId'],'to':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47['body'][_0x8f95('0x15')][_0x8f95('0x4f')],'attach':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x50')],'lastMsgAt':moment()[_0x8f95('0x51')](_0x8f95('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]};return db['MailInteraction'][_0x8f95('0x25')]({'where':{'closed':![],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8f95('0x53'),'attributes':['messageId'],'where':{'messageId':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x54')]}}]})[_0x8f95('0x21')](function(_0x28029){if(_0x28029){return[_0x28029,![]];}return db['MailInteraction'][_0x8f95('0x4b')](_0x2015a1)['then'](function(_0x133ce0){return[_0x133ce0,!![]];});});}else{throw new Error(_0x8f95('0x55'));}})[_0x8f95('0x56')](function(_0x26f41,_0xd7f2ee){if(_0x26f41){_0x423329=_0xd7f2ee;if(!_0xd7f2ee){return _0x26f41[_0x8f95('0x57')]({'inReplyTo':_0x220e47['body'][_0x8f95('0x15')][_0x8f95('0x4d')],'to':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4f')],'attach':_0x26f41[_0x8f95('0x50')]?_0x26f41[_0x8f95('0x50')]:_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x50')],'substatus':null,'substatusAt':moment()[_0x8f95('0x51')](_0x8f95('0x52')),'lastMsgAt':moment()[_0x8f95('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]});}else{return _0x26f41;}}})[_0x8f95('0x21')](function(_0x3f9b43){_0xd7bfec[_0x8f95('0x58')]=_0x3f9b43[_0x8f95('0x59')]({'plain':!![]});_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5a')]=_0x423329;return db[_0x8f95('0x5b')][_0x8f95('0x4b')]({'body':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id'],'MailInteractionId':_0x3f9b43['id'],'direction':'in','ContactId':_0xd7bfec[_0x8f95('0x4c')]['id'],'messageId':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x4d')],'from':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'to':_0x220e47['body'][_0x8f95('0x15')]['to'],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4f')],'attach':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x50')],'Attachments':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x5c')],'originTo':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x5d')],'originCc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['originCc'],'bcc':_0x220e47['body'][_0x8f95('0x15')]['bcc']},{'include':[{'model':db['Attachment'],'as':_0x8f95('0x5e')}]});})[_0x8f95('0x21')](function(_0x323072){_0xd7bfec[_0x8f95('0x15')]=_0x323072;if(_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5f')]){return db[_0x8f95('0x60')][_0x8f95('0x25')]({'attributes':['id',_0x8f95('0x61')],'where':{'id':_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5f')]}})[_0x8f95('0x21')](function(_0x3f0684){if(_0x3f0684){_0xd7bfec[_0x8f95('0x40')][_0x8f95('0x62')]({'id':0x0,'priority':0x0,'app':_0x8f95('0x63'),'appdata':_0x3f0684[_0x8f95('0x61')]+','+(_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8f95('0x65'),'startRouting',_0xd7bfec);});}return respondWithRpcPromise(_0x8f95('0x65'),_0x8f95('0x66'),_0xd7bfec);})[_0x8f95('0x21')](function(_0x47e5ab){_0x109840(_0x47e5ab);})[_0x8f95('0x23')](function(_0x3f31e4){_0x2ee915(_0x2fc45f['error'](0x1f4,_0x3f31e4[_0x8f95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2c5f552..3016363 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 _0xecb2=['mailAccount:','./mailAccount.events','update','emit','removeListener','register','length'];(function(_0x1dcad2,_0x28e38d){var _0x577a0c=function(_0x36192c){while(--_0x36192c){_0x1dcad2['push'](_0x1dcad2['shift']());}};_0x577a0c(++_0x28e38d);}(_0xecb2,0xf6));var _0x2ecb=function(_0x5c92fb,_0x4e9d67){_0x5c92fb=_0x5c92fb-0x0;var _0x5d9534=_0xecb2[_0x5c92fb];return _0x5d9534;};'use strict';var MailAccountEvents=require(_0x2ecb('0x0'));var events=['save','remove',_0x2ecb('0x1')];function createListener(_0x548b3c,_0x59d894){return function(_0x1bb230){_0x59d894[_0x2ecb('0x2')](_0x548b3c,_0x1bb230);};}function removeListener(_0x393e7c,_0x2a4fe5){return function(){MailAccountEvents[_0x2ecb('0x3')](_0x393e7c,_0x2a4fe5);};}exports[_0x2ecb('0x4')]=function(_0x4c169f){for(var _0x51b28c=0x0,_0x49de99=events[_0x2ecb('0x5')];_0x51b28c<_0x49de99;_0x51b28c++){var _0x3df4a0=events[_0x51b28c];var _0x15a959=createListener(_0x2ecb('0x6')+_0x3df4a0,_0x4c169f);MailAccountEvents['on'](_0x3df4a0,_0x15a959);}}; \ No newline at end of file +var _0xed1f=['removeListener','register','length','./mailAccount.events','save'];(function(_0x246834,_0x26557c){var _0x64c78d=function(_0x432845){while(--_0x432845){_0x246834['push'](_0x246834['shift']());}};_0x64c78d(++_0x26557c);}(_0xed1f,0x170));var _0xfed1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xed1f[_0x178e48];return _0x440d7e;};'use strict';var MailAccountEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),'remove','update'];function createListener(_0x2c9577,_0x5c56c8){return function(_0x36764e){_0x5c56c8['emit'](_0x2c9577,_0x36764e);};}function removeListener(_0x444ba8,_0x423af3){return function(){MailAccountEvents[_0xfed1('0x2')](_0x444ba8,_0x423af3);};}exports[_0xfed1('0x3')]=function(_0x465671){for(var _0x1f2391=0x0,_0x471095=events[_0xfed1('0x4')];_0x1f2391<_0x471095;_0x1f2391++){var _0x4e7fe7=events[_0x1f2391];var _0x37565a=createListener('mailAccount:'+_0x4e7fe7,_0x465671);MailAccountEvents['on'](_0x4e7fe7,_0x37565a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ec762aa..fe6a0c2 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 _0xb688=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','util'];(function(_0x530a62,_0xc626e){var _0x3163b4=function(_0x24f8ee){while(--_0x24f8ee){_0x530a62['push'](_0x530a62['shift']());}};_0x3163b4(++_0xc626e);}(_0xb688,0xcf));var _0x8b68=function(_0xb5f7a,_0x4314af){_0xb5f7a=_0xb5f7a-0x0;var _0x1ee16b=_0xb688[_0xb5f7a];return _0x1ee16b;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')](_0x8b68('0x9'),auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['put'](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xe')]);module[_0x8b68('0xf')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','util'];(function(_0x3a53b3,_0x18da88){var _0x4664fd=function(_0x121357){while(--_0x121357){_0x3a53b3['push'](_0x3a53b3['shift']());}};_0x4664fd(++_0x18da88);}(_0xb688,0xcf));var _0x8b68=function(_0x36e3bd,_0x201c77){_0x36e3bd=_0x36e3bd-0x0;var _0xdc68e=_0xb688[_0x36e3bd];return _0xdc68e;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')](_0x8b68('0x9'),auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['put'](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xe')]);module[_0x8b68('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 494be6b..71b393b 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 _0x8994=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2ce2b3,_0x272f46){var _0x2e9e2d=function(_0xa7ad76){while(--_0xa7ad76){_0x2ce2b3['push'](_0x2ce2b3['shift']());}};_0x2e9e2d(++_0x272f46);}(_0x8994,0x73));var _0x4899=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8994[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x4899('0x0'));module[_0x4899('0x1')]={'priority':{'type':Sequelize[_0x4899('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4899('0x3')],'allowNull':![],'defaultValue':_0x4899('0x4')},'appdata':{'type':Sequelize[_0x4899('0x5')]()},'description':{'type':Sequelize[_0x4899('0x3')]},'interval':{'type':Sequelize[_0x4899('0x3')],'defaultValue':_0x4899('0x6')}}; \ No newline at end of file +var _0xe6db=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4e93f4,_0x1c9b68){var _0x1f3031=function(_0x42cccc){while(--_0x42cccc){_0x4e93f4['push'](_0x4e93f4['shift']());}};_0x1f3031(++_0x1c9b68);}(_0xe6db,0xc6));var _0xbe6d=function(_0x5791d8,_0x820e85){_0x5791d8=_0x5791d8-0x0;var _0xdc0bd7=_0xe6db[_0x5791d8];return _0xdc0bd7;};'use strict';var Sequelize=require('sequelize');module[_0xbe6d('0x0')]={'priority':{'type':Sequelize[_0xbe6d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe6d('0x2')],'allowNull':![],'defaultValue':_0xbe6d('0x3')},'appdata':{'type':Sequelize[_0xbe6d('0x4')]()},'description':{'type':Sequelize[_0xbe6d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbe6d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 1608c76..dcaafeb 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 _0xc991=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','html-pdf','eml-format'];(function(_0x58b549,_0x2640b3){var _0x56b383=function(_0x1eb438){while(--_0x1eb438){_0x58b549['push'](_0x58b549['shift']());}};_0x56b383(++_0x2640b3);}(_0xc991,0x13e));var _0x1c99=function(_0x47c7e2,_0x7a1685){_0x47c7e2=_0x47c7e2-0x0;var _0x52139f=_0xc991[_0x47c7e2];return _0x52139f;};'use strict';var pdf=require(_0x1c99('0x0'));var emlformat=require(_0x1c99('0x1'));var rimraf=require(_0x1c99('0x2'));var zipdir=require(_0x1c99('0x3'));var jsonpatch=require(_0x1c99('0x4'));var rp=require(_0x1c99('0x5'));var moment=require(_0x1c99('0x6'));var BPromise=require(_0x1c99('0x7'));var Mustache=require(_0x1c99('0x8'));var util=require('util');var path=require(_0x1c99('0x9'));var sox=require(_0x1c99('0xa'));var csv=require(_0x1c99('0xb'));var ejs=require(_0x1c99('0xc'));var fs=require('fs');var _=require(_0x1c99('0xd'));var squel=require(_0x1c99('0xe'));var crypto=require(_0x1c99('0xf'));var jsforce=require(_0x1c99('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1c99('0xb'));var querystring=require('querystring');var Papa=require(_0x1c99('0x11'));var Redis=require(_0x1c99('0x12'));var authService=require(_0x1c99('0x13'));var qs=require(_0x1c99('0x14'));var as=require(_0x1c99('0x15'));var hardwareService=require(_0x1c99('0x16'));var logger=require(_0x1c99('0x17'))(_0x1c99('0x18'));var utils=require(_0x1c99('0x19'));var config=require(_0x1c99('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c99('0x1b'))['db'];function respondWithStatusCode(_0x2cae03,_0x27bf4b){_0x27bf4b=_0x27bf4b||0xcc;return function(_0x5cd076){if(_0x5cd076){return _0x2cae03[_0x1c99('0x1c')](_0x27bf4b);}return _0x2cae03[_0x1c99('0x1d')](_0x27bf4b)[_0x1c99('0x1e')]();};}function respondWithResult(_0x332383,_0x395c39){_0x395c39=_0x395c39||0xc8;return function(_0xc45e08){if(_0xc45e08){return _0x332383[_0x1c99('0x1d')](_0x395c39)[_0x1c99('0x1f')](_0xc45e08);}};}function respondWithFilteredResult(_0x2a8a7f,_0x125b86){return function(_0x707cbc){if(_0x707cbc){var _0x41db00=_0x707cbc[_0x1c99('0x20')],_0x53fc83=_0x125b86[_0x1c99('0x21')],_0x24d179=_0x125b86['offset']+_0x125b86['limit'],_0x279667;if(_0x24d179>=_0x41db00){_0x24d179=_0x41db00;_0x279667=0xc8;}else{_0x279667=0xce;}_0x2a8a7f['status'](_0x279667);return _0x2a8a7f[_0x1c99('0x22')](_0x1c99('0x23'),_0x53fc83+'-'+_0x24d179+'/'+_0x41db00)['json'](_0x707cbc);}return null;};}function patchUpdates(_0x5028e4){return function(_0x25b1b9){try{jsonpatch[_0x1c99('0x24')](_0x25b1b9,_0x5028e4,!![]);}catch(_0x4443a8){return BPromise[_0x1c99('0x25')](_0x4443a8);}return _0x25b1b9[_0x1c99('0x26')]();};}function saveUpdates(_0x1ff9b7,_0x18246e){return function(_0x4d8428){if(_0x4d8428){return _0x4d8428[_0x1c99('0x27')](_0x1ff9b7)[_0x1c99('0x28')](function(_0x5a24eb){return _0x5a24eb;});}return null;};}function removeEntity(_0xe9e0c,_0x5a7944){return function(_0xeebdb1){if(_0xeebdb1){return _0xeebdb1[_0x1c99('0x29')]()[_0x1c99('0x28')](function(){_0xe9e0c['status'](0xcc)[_0x1c99('0x1e')]();});}};}function handleEntityNotFound(_0x4a8c8c,_0x3f1c1a){return function(_0x13a438){if(!_0x13a438){_0x4a8c8c[_0x1c99('0x1c')](0x194);}return _0x13a438;};}function handleError(_0x355b49,_0x376862){_0x376862=_0x376862||0x1f4;return function(_0x859184){logger[_0x1c99('0x2a')](_0x859184[_0x1c99('0x2b')]);if(_0x859184[_0x1c99('0x2c')]){delete _0x859184[_0x1c99('0x2c')];}_0x355b49[_0x1c99('0x1d')](_0x376862)[_0x1c99('0x2d')](_0x859184);};}exports[_0x1c99('0x2e')]=function(_0x16f59a,_0xf98a27){var _0x277ce8={'raw':!![],'where':{'id':_0x16f59a[_0x1c99('0x2f')]['id']}},_0x13b032={};_0x13b032[_0x1c99('0x30')]=_['keys'](db[_0x1c99('0x31')][_0x1c99('0x32')]);_0x13b032[_0x1c99('0x33')]=_[_0x1c99('0x34')](_0x16f59a[_0x1c99('0x33')]);_0x13b032['filters']=_['intersection'](_0x13b032[_0x1c99('0x30')],_0x13b032['query']);_0x277ce8[_0x1c99('0x35')]=_[_0x1c99('0x36')](_0x13b032[_0x1c99('0x30')],qs[_0x1c99('0x37')](_0x16f59a[_0x1c99('0x33')]['fields']));_0x277ce8[_0x1c99('0x35')]=_0x277ce8[_0x1c99('0x35')][_0x1c99('0x38')]?_0x277ce8[_0x1c99('0x35')]:_0x13b032[_0x1c99('0x30')];if(_0x16f59a[_0x1c99('0x33')][_0x1c99('0x39')]){_0x277ce8[_0x1c99('0x3a')]=[{'all':!![]}];}_0x277ce8=_[_0x1c99('0x3b')]({},_0x277ce8,_0x16f59a[_0x1c99('0x3c')]);return db[_0x1c99('0x31')][_0x1c99('0x3d')](_0x277ce8)[_0x1c99('0x28')](handleEntityNotFound(_0xf98a27,null))[_0x1c99('0x28')](respondWithResult(_0xf98a27,null))['catch'](handleError(_0xf98a27,null));};exports[_0x1c99('0x27')]=function(_0x492a18,_0x293676){if(_0x492a18['body']['id']){delete _0x492a18[_0x1c99('0x3e')]['id'];}return db[_0x1c99('0x31')][_0x1c99('0x3d')]({'where':{'id':_0x492a18['params']['id']}})[_0x1c99('0x28')](handleEntityNotFound(_0x293676,null))['then'](saveUpdates(_0x492a18[_0x1c99('0x3e')],null))[_0x1c99('0x28')](respondWithResult(_0x293676,null))[_0x1c99('0x3f')](handleError(_0x293676,null));};exports[_0x1c99('0x29')]=function(_0x149d03,_0x3ab230){return db['MailApplication'][_0x1c99('0x3d')]({'where':{'id':_0x149d03[_0x1c99('0x2f')]['id']}})[_0x1c99('0x28')](handleEntityNotFound(_0x3ab230,null))[_0x1c99('0x28')](removeEntity(_0x3ab230,null))[_0x1c99('0x3f')](handleError(_0x3ab230,null));}; \ No newline at end of file +var _0x5431=['MailApplication','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','catch','update','body','find','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','show','model'];(function(_0x5fd04,_0x5d6fff){var _0x48c27b=function(_0x3fd78b){while(--_0x3fd78b){_0x5fd04['push'](_0x5fd04['shift']());}};_0x48c27b(++_0x5d6fff);}(_0x5431,0x13c));var _0x1543=function(_0x1eb0ab,_0x2628df){_0x1eb0ab=_0x1eb0ab-0x0;var _0x4c99b8=_0x5431[_0x1eb0ab];return _0x4c99b8;};'use strict';var pdf=require(_0x1543('0x0'));var emlformat=require(_0x1543('0x1'));var rimraf=require(_0x1543('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1543('0x3'));var rp=require(_0x1543('0x4'));var moment=require(_0x1543('0x5'));var BPromise=require(_0x1543('0x6'));var Mustache=require(_0x1543('0x7'));var util=require(_0x1543('0x8'));var path=require(_0x1543('0x9'));var sox=require(_0x1543('0xa'));var csv=require(_0x1543('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1543('0xc'));var squel=require(_0x1543('0xd'));var crypto=require('crypto');var jsforce=require(_0x1543('0xe'));var deskjs=require(_0x1543('0xf'));var toCsv=require(_0x1543('0xb'));var querystring=require(_0x1543('0x10'));var Papa=require(_0x1543('0x11'));var Redis=require('ioredis');var authService=require(_0x1543('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1543('0x13'));var hardwareService=require(_0x1543('0x14'));var logger=require(_0x1543('0x15'))(_0x1543('0x16'));var utils=require(_0x1543('0x17'));var config=require(_0x1543('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1543('0x19'))['db'];function respondWithStatusCode(_0xd54dee,_0x2a7433){_0x2a7433=_0x2a7433||0xcc;return function(_0xc97d0d){if(_0xc97d0d){return _0xd54dee[_0x1543('0x1a')](_0x2a7433);}return _0xd54dee[_0x1543('0x1b')](_0x2a7433)[_0x1543('0x1c')]();};}function respondWithResult(_0x108adc,_0x1e4ad9){_0x1e4ad9=_0x1e4ad9||0xc8;return function(_0x2e56dd){if(_0x2e56dd){return _0x108adc[_0x1543('0x1b')](_0x1e4ad9)[_0x1543('0x1d')](_0x2e56dd);}};}function respondWithFilteredResult(_0x4733a2,_0x2382e){return function(_0x62e9b9){if(_0x62e9b9){var _0x1c430b=_0x62e9b9[_0x1543('0x1e')],_0x161e9c=_0x2382e[_0x1543('0x1f')],_0x2880a6=_0x2382e[_0x1543('0x1f')]+_0x2382e[_0x1543('0x20')],_0x55d9cb;if(_0x2880a6>=_0x1c430b){_0x2880a6=_0x1c430b;_0x55d9cb=0xc8;}else{_0x55d9cb=0xce;}_0x4733a2[_0x1543('0x1b')](_0x55d9cb);return _0x4733a2[_0x1543('0x21')](_0x1543('0x22'),_0x161e9c+'-'+_0x2880a6+'/'+_0x1c430b)[_0x1543('0x1d')](_0x62e9b9);}return null;};}function patchUpdates(_0x2bdb46){return function(_0x4b1870){try{jsonpatch['apply'](_0x4b1870,_0x2bdb46,!![]);}catch(_0x196c95){return BPromise[_0x1543('0x23')](_0x196c95);}return _0x4b1870[_0x1543('0x24')]();};}function saveUpdates(_0x1e8b04,_0x103f5b){return function(_0xaa50aa){if(_0xaa50aa){return _0xaa50aa['update'](_0x1e8b04)[_0x1543('0x25')](function(_0x28f9ac){return _0x28f9ac;});}return null;};}function removeEntity(_0x4a24ee,_0x54ddf9){return function(_0x2efc6f){if(_0x2efc6f){return _0x2efc6f[_0x1543('0x26')]()[_0x1543('0x25')](function(){_0x4a24ee[_0x1543('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed8f8,_0x2e10f2){return function(_0x1ac596){if(!_0x1ac596){_0x5ed8f8[_0x1543('0x1a')](0x194);}return _0x1ac596;};}function handleError(_0x2da404,_0x471ec4){_0x471ec4=_0x471ec4||0x1f4;return function(_0x18a76b){logger['error'](_0x18a76b[_0x1543('0x27')]);if(_0x18a76b[_0x1543('0x28')]){delete _0x18a76b['name'];}_0x2da404[_0x1543('0x1b')](_0x471ec4)[_0x1543('0x29')](_0x18a76b);};}exports[_0x1543('0x2a')]=function(_0x56805c,_0x54ce5e){var _0x1068aa={'raw':!![],'where':{'id':_0x56805c['params']['id']}},_0x240021={};_0x240021[_0x1543('0x2b')]=_['keys'](db[_0x1543('0x2c')]['rawAttributes']);_0x240021[_0x1543('0x2d')]=_[_0x1543('0x2e')](_0x56805c[_0x1543('0x2d')]);_0x240021[_0x1543('0x2f')]=_[_0x1543('0x30')](_0x240021[_0x1543('0x2b')],_0x240021[_0x1543('0x2d')]);_0x1068aa[_0x1543('0x31')]=_[_0x1543('0x30')](_0x240021[_0x1543('0x2b')],qs[_0x1543('0x32')](_0x56805c[_0x1543('0x2d')][_0x1543('0x32')]));_0x1068aa[_0x1543('0x31')]=_0x1068aa[_0x1543('0x31')][_0x1543('0x33')]?_0x1068aa[_0x1543('0x31')]:_0x240021[_0x1543('0x2b')];if(_0x56805c[_0x1543('0x2d')][_0x1543('0x34')]){_0x1068aa[_0x1543('0x35')]=[{'all':!![]}];}_0x1068aa=_['merge']({},_0x1068aa,_0x56805c[_0x1543('0x36')]);return db[_0x1543('0x2c')]['find'](_0x1068aa)[_0x1543('0x25')](handleEntityNotFound(_0x54ce5e,null))[_0x1543('0x25')](respondWithResult(_0x54ce5e,null))[_0x1543('0x37')](handleError(_0x54ce5e,null));};exports[_0x1543('0x38')]=function(_0x33be30,_0x64751b){if(_0x33be30[_0x1543('0x39')]['id']){delete _0x33be30[_0x1543('0x39')]['id'];}return db[_0x1543('0x2c')][_0x1543('0x3a')]({'where':{'id':_0x33be30[_0x1543('0x3b')]['id']}})[_0x1543('0x25')](handleEntityNotFound(_0x64751b,null))['then'](saveUpdates(_0x33be30[_0x1543('0x39')],null))[_0x1543('0x25')](respondWithResult(_0x64751b,null))[_0x1543('0x37')](handleError(_0x64751b,null));};exports[_0x1543('0x26')]=function(_0x470251,_0x41952b){return db[_0x1543('0x2c')][_0x1543('0x3a')]({'where':{'id':_0x470251['params']['id']}})[_0x1543('0x25')](handleEntityNotFound(_0x41952b,null))[_0x1543('0x25')](removeEntity(_0x41952b,null))[_0x1543('0x37')](handleError(_0x41952b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e96a016..d20c206 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 _0x75b6=['MailApplication','utf8mb4','lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x675b('0x1'));var moment=require(_0x675b('0x2'));var BPromise=require(_0x675b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x675b('0x4'));var rimraf=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var attributes=require('./mailApplication.attributes');module[_0x675b('0x7')]=function(_0x5332ee,_0x20b740){return _0x5332ee[_0x675b('0x8')](_0x675b('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x675b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd48e=['../../config/environment','exports','MailApplication','mail_applications','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2db04a,_0x95de4a){var _0x36ee26=function(_0x331426){while(--_0x331426){_0x2db04a['push'](_0x2db04a['shift']());}};_0x36ee26(++_0x95de4a);}(_0xd48e,0x93));var _0xed48=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xd48e[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var logger=require(_0xed48('0x1'))(_0xed48('0x2'));var moment=require(_0xed48('0x3'));var BPromise=require(_0xed48('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed48('0x5'));var rimraf=require(_0xed48('0x6'));var config=require(_0xed48('0x7'));var attributes=require('./mailApplication.attributes');module[_0xed48('0x8')]=function(_0x2c937c,_0x400239){return _0x2c937c['define'](_0xed48('0x9'),attributes,{'tableName':_0xed48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8528aef..9431483 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 _0xa7a6=['raw','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','catch','UpdateMailApplication','MailApplication','update','options'];(function(_0x37eb04,_0x2d568d){var _0x2df232=function(_0x33d5e3){while(--_0x33d5e3){_0x37eb04['push'](_0x37eb04['shift']());}};_0x2df232(++_0x2d568d);}(_0xa7a6,0xac));var _0x6a7a=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0xa7a6[_0x3239f5];return _0x3559c8;};'use strict';var _=require(_0x6a7a('0x0'));var util=require(_0x6a7a('0x1'));var moment=require(_0x6a7a('0x2'));var BPromise=require(_0x6a7a('0x3'));var rs=require(_0x6a7a('0x4'));var fs=require('fs');var Redis=require(_0x6a7a('0x5'));var db=require(_0x6a7a('0x6'))['db'];var utils=require(_0x6a7a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6a7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x598c47,_0x1ddf47,_0x5b3a3e){return new BPromise(function(_0x42f40d,_0x551553){return client[_0x6a7a('0xa')](_0x598c47,_0x5b3a3e)['then'](function(_0x33bb8f){logger[_0x6a7a('0xb')]('MailApplication,\x20%s,\x20%s',_0x1ddf47,_0x6a7a('0xc'));logger[_0x6a7a('0xd')](_0x6a7a('0xe'),_0x1ddf47,_0x6a7a('0xc'),JSON[_0x6a7a('0xf')](_0x33bb8f));if(_0x33bb8f['error']){if(_0x33bb8f[_0x6a7a('0x10')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x1ddf47,_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);return _0x551553(_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);}logger[_0x6a7a('0x10')](_0x6a7a('0x12'),_0x1ddf47,_0x33bb8f[_0x6a7a('0x10')]['message']);return _0x42f40d(_0x33bb8f[_0x6a7a('0x10')][_0x6a7a('0x11')]);}else{logger[_0x6a7a('0xb')](_0x6a7a('0x12'),_0x1ddf47,_0x6a7a('0xc'));_0x42f40d(_0x33bb8f['result'][_0x6a7a('0x11')]);}})[_0x6a7a('0x13')](function(_0x3e61da){logger[_0x6a7a('0x10')](_0x6a7a('0x12'),_0x1ddf47,_0x3e61da);_0x551553(_0x3e61da);});});}exports[_0x6a7a('0x14')]=function(_0x2ca5b6){var _0x32cb0e=this;return new Promise(function(_0x88add5,_0x3b9808){return db[_0x6a7a('0x15')][_0x6a7a('0x16')](_0x2ca5b6['body'],{'raw':_0x2ca5b6[_0x6a7a('0x17')]?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x19')]||null:null,'attributes':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')][_0x6a7a('0x1a')]||null:null,'limit':_0x2ca5b6['options']?_0x2ca5b6[_0x6a7a('0x17')]['limit']||null:null})[_0x6a7a('0x1b')](function(_0xd7b87d){logger[_0x6a7a('0xb')]('UpdateMailApplication',_0x2ca5b6);logger[_0x6a7a('0xd')](_0x6a7a('0x14'),_0x2ca5b6,JSON[_0x6a7a('0xf')](_0xd7b87d));_0x88add5(_0xd7b87d);})[_0x6a7a('0x13')](function(_0xf458dc){logger[_0x6a7a('0x10')](_0x6a7a('0x14'),_0xf458dc['message'],_0x2ca5b6);_0x3b9808(_0x32cb0e[_0x6a7a('0x10')](0x1f4,_0xf458dc['message']));});});}; \ No newline at end of file +var _0x75e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','stringify','lodash','util','randomstring'];(function(_0x1e753b,_0x209149){var _0x13d34e=function(_0x338150){while(--_0x338150){_0x1e753b['push'](_0x1e753b['shift']());}};_0x13d34e(++_0x209149);}(_0x75e9,0x15d));var _0x975e=function(_0x49decb,_0x8a2bf5){_0x49decb=_0x49decb-0x0;var _0x4161e0=_0x75e9[_0x49decb];return _0x4161e0;};'use strict';var _=require(_0x975e('0x0'));var util=require(_0x975e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x975e('0x2'));var fs=require('fs');var Redis=require(_0x975e('0x3'));var db=require(_0x975e('0x4'))['db'];var utils=require(_0x975e('0x5'));var logger=require(_0x975e('0x6'))(_0x975e('0x7'));var config=require(_0x975e('0x8'));var jayson=require(_0x975e('0x9'));var client=jayson[_0x975e('0xa')][_0x975e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf85cd5,_0x502ff1,_0x17f8f4){return new BPromise(function(_0x2891d2,_0x1768ad){return client[_0x975e('0xc')](_0xf85cd5,_0x17f8f4)[_0x975e('0xd')](function(_0x31d544){logger[_0x975e('0xe')](_0x975e('0xf'),_0x502ff1,_0x975e('0x10'));logger[_0x975e('0x11')](_0x975e('0x12'),_0x502ff1,'request\x20sent',JSON['stringify'](_0x31d544));if(_0x31d544[_0x975e('0x13')]){if(_0x31d544[_0x975e('0x13')][_0x975e('0x14')]===0x1f4){logger['error'](_0x975e('0xf'),_0x502ff1,_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);return _0x1768ad(_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x502ff1,_0x31d544[_0x975e('0x13')]['message']);return _0x2891d2(_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);}else{logger['info'](_0x975e('0xf'),_0x502ff1,_0x975e('0x10'));_0x2891d2(_0x31d544[_0x975e('0x16')][_0x975e('0x15')]);}})['catch'](function(_0x1d49cc){logger['error'](_0x975e('0xf'),_0x502ff1,_0x1d49cc);_0x1768ad(_0x1d49cc);});});}exports[_0x975e('0x17')]=function(_0xf2ba8){var _0x58914=this;return new Promise(function(_0x68d6e7,_0x314002){return db[_0x975e('0x18')][_0x975e('0x19')](_0xf2ba8[_0x975e('0x1a')],{'raw':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')][_0x975e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')][_0x975e('0x1d')]||null:null,'attributes':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8['options'][_0x975e('0x1e')]||null:null,'limit':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')]['limit']||null:null})['then'](function(_0x1f337c){logger[_0x975e('0xe')](_0x975e('0x17'),_0xf2ba8);logger['debug']('UpdateMailApplication',_0xf2ba8,JSON[_0x975e('0x1f')](_0x1f337c));_0x68d6e7(_0x1f337c);})['catch'](function(_0x35b555){logger[_0x975e('0x13')](_0x975e('0x17'),_0x35b555['message'],_0xf2ba8);_0x314002(_0x58914[_0x975e('0x13')](0x1f4,_0x35b555['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6ec32e0..98908cc 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 _0xd51f=['express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','multer','util','connect-timeout'];(function(_0x100357,_0x5d551b){var _0x1939f2=function(_0x56f410){while(--_0x56f410){_0x100357['push'](_0x100357['shift']());}};_0x1939f2(++_0x5d551b);}(_0xd51f,0xf0));var _0xfd51=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd51f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var path=require('path');var timeout=require(_0xfd51('0x2'));var express=require(_0xfd51('0x3'));var router=express['Router']();var auth=require(_0xfd51('0x4'));var interaction=require(_0xfd51('0x5'));var config=require('../../config/environment');var controller=require(_0xfd51('0x6'));router[_0xfd51('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd51('0x8')]);router[_0xfd51('0x7')]('/describe',auth[_0xfd51('0x9')](),controller[_0xfd51('0xa')]);router[_0xfd51('0x7')](_0xfd51('0xb'),auth[_0xfd51('0x9')](),controller['show']);router[_0xfd51('0x7')](_0xfd51('0xc'),auth[_0xfd51('0x9')](),controller['getMessages']);router[_0xfd51('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xfd51('0xd')]);router[_0xfd51('0xe')]('/',auth[_0xfd51('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0xfd51('0x9')](),controller[_0xfd51('0xf')]);router[_0xfd51('0xe')](_0xfd51('0x10'),auth[_0xfd51('0x9')](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),'mailinteraction:addtags'),controller[_0xfd51('0x13')]);router[_0xfd51('0x14')](_0xfd51('0xb'),auth[_0xfd51('0x9')](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),_0xfd51('0x15')),controller[_0xfd51('0x16')]);router['delete'](_0xfd51('0xb'),auth['isAuthenticated'](),interaction[_0xfd51('0x11')](_0xfd51('0x12'),_0xfd51('0x17')),controller[_0xfd51('0x18')]);router[_0xfd51('0x19')](_0xfd51('0x10'),auth[_0xfd51('0x9')](),controller[_0xfd51('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa276=['index','get','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','put','/:id','update','delete','destroy','/:id/tags','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated'];(function(_0x1fe4c7,_0x42edec){var _0x2137db=function(_0x4d32a8){while(--_0x4d32a8){_0x1fe4c7['push'](_0x1fe4c7['shift']());}};_0x2137db(++_0x42edec);}(_0xa276,0x9a));var _0x6a27=function(_0x48aa68,_0x59952d){_0x48aa68=_0x48aa68-0x0;var _0x33fd78=_0xa276[_0x48aa68];return _0x33fd78;};'use strict';var multer=require('multer');var util=require(_0x6a27('0x0'));var path=require(_0x6a27('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a27('0x2'));var router=express[_0x6a27('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a27('0x4'));var config=require(_0x6a27('0x5'));var controller=require(_0x6a27('0x6'));router['get']('/',auth[_0x6a27('0x7')](),controller[_0x6a27('0x8')]);router[_0x6a27('0x9')]('/describe',auth[_0x6a27('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6a27('0xa')]);router[_0x6a27('0x9')](_0x6a27('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x6a27('0x9')](_0x6a27('0xc'),auth[_0x6a27('0x7')](),controller[_0x6a27('0xd')]);router[_0x6a27('0xe')]('/',auth[_0x6a27('0x7')](),controller[_0x6a27('0xf')]);router[_0x6a27('0xe')](_0x6a27('0xb'),auth['isAuthenticated'](),controller[_0x6a27('0x10')]);router['post']('/:id/tags',auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')](_0x6a27('0x12'),'mailinteraction:addtags'),controller[_0x6a27('0x13')]);router[_0x6a27('0x14')](_0x6a27('0x15'),auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')]('mail','mailinteraction:update'),controller[_0x6a27('0x16')]);router[_0x6a27('0x17')](_0x6a27('0x15'),auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')](_0x6a27('0x12'),'mailinteraction:destroy'),controller[_0x6a27('0x18')]);router[_0x6a27('0x17')](_0x6a27('0x19'),auth[_0x6a27('0x7')](),controller['removeTags']);module[_0x6a27('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a5efcdb..73a8300 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 _0x6748=['out','long','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x3986a2,_0x481a07){var _0x4e183f=function(_0x11301e){while(--_0x11301e){_0x3986a2['push'](_0x3986a2['shift']());}};_0x4e183f(++_0x481a07);}(_0x6748,0xbf));var _0x8674=function(_0xfe9743,_0xa4e157){_0xfe9743=_0xfe9743-0x0;var _0x342d6e=_0x6748[_0xfe9743];return _0x342d6e;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8674('0x0'));module[_0x8674('0x1')]={'closed':{'type':Sequelize[_0x8674('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8674('0x3')]},'disposition':{'type':Sequelize[_0x8674('0x4')]},'secondDisposition':{'type':Sequelize[_0x8674('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8674('0x4')]},'note':{'type':Sequelize[_0x8674('0x4')]},'inReplyTo':{'type':Sequelize[_0x8674('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8674('0x5')]('long')},'subject':{'type':Sequelize[_0x8674('0x5')]()},'attach':{'type':Sequelize[_0x8674('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8674('0x3')]},'substatus':{'type':Sequelize[_0x8674('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x8674('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8674('0x6')]('in',_0x8674('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8674('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8674('0x6')]('in',_0x8674('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x8674('0x8'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x8674('0x8'))}}; \ No newline at end of file +var _0x70cb=['BOOLEAN','DATE','ENUM','out','long','sequelize','iconv','exports','STRING','TEXT'];(function(_0x584c47,_0x690ace){var _0x8a24a6=function(_0x249369){while(--_0x249369){_0x584c47['push'](_0x584c47['shift']());}};_0x8a24a6(++_0x690ace);}(_0x70cb,0xaf));var _0xb70c=function(_0x311bed,_0x49f61e){_0x311bed=_0x311bed-0x0;var _0x12c58f=_0x70cb[_0x311bed];return _0x12c58f;};'use strict';var Sequelize=require(_0xb70c('0x0'));var iconv=require(_0xb70c('0x1'));module[_0xb70c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb70c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb70c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb70c('0x3')]},'note':{'type':Sequelize[_0xb70c('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb70c('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xb70c('0x4')]()},'attach':{'type':Sequelize[_0xb70c('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb70c('0x6')]},'substatus':{'type':Sequelize[_0xb70c('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb70c('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xb70c('0x7')]('in',_0xb70c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb70c('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb70c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb70c('0x4')](_0xb70c('0x9'))},'lastMsgText':{'type':Sequelize[_0xb70c('0x4')](_0xb70c('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6a009f3..17d21cc 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 _0x1416=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','unreadMessages','`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','include','merge','options','create','body','describe','addMessage','omit','ids','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','findAll','addTags','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','get','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','message%d.eml','log','unlinkSync','html-pdf','rimraf'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x1416,0xec));var _0x6141=function(_0x40451c,_0x248652){_0x40451c=_0x40451c-0x0;var _0x2c11f4=_0x1416[_0x40451c];return _0x2c11f4;};'use strict';var pdf=require(_0x6141('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6141('0x1'));var zipdir=require(_0x6141('0x2'));var jsonpatch=require(_0x6141('0x3'));var rp=require(_0x6141('0x4'));var moment=require('moment');var BPromise=require(_0x6141('0x5'));var Mustache=require(_0x6141('0x6'));var util=require(_0x6141('0x7'));var path=require(_0x6141('0x8'));var sox=require(_0x6141('0x9'));var csv=require(_0x6141('0xa'));var ejs=require(_0x6141('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6141('0xc'));var crypto=require('crypto');var jsforce=require(_0x6141('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6141('0xa'));var querystring=require(_0x6141('0xe'));var Papa=require(_0x6141('0xf'));var htmlToText=require(_0x6141('0x10'));var Redis=require(_0x6141('0x11'));var authService=require(_0x6141('0x12'));var qs=require(_0x6141('0x13'));var as=require(_0x6141('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6141('0x15'));var utils=require('../../config/utils');var config=require(_0x6141('0x16'));var licenseUtil=require(_0x6141('0x17'));var db=require(_0x6141('0x18'))['db'];config[_0x6141('0x19')]=_[_0x6141('0x1a')](config[_0x6141('0x19')],{'host':_0x6141('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6141('0x19')]));require(_0x6141('0x1c'))[_0x6141('0x1d')](socket);function respondWithStatusCode(_0x201961,_0xa51354){_0xa51354=_0xa51354||0xcc;return function(_0x30d2e1){if(_0x30d2e1){return _0x201961[_0x6141('0x1e')](_0xa51354);}return _0x201961[_0x6141('0x1f')](_0xa51354)[_0x6141('0x20')]();};}function respondWithResult(_0x3f8c60,_0x5763dc){_0x5763dc=_0x5763dc||0xc8;return function(_0xe8af1b){if(_0xe8af1b){return _0x3f8c60[_0x6141('0x1f')](_0x5763dc)[_0x6141('0x21')](_0xe8af1b);}};}function respondWithFilteredResult(_0x55d124,_0x133d13){return function(_0x5e7dae){if(_0x5e7dae){var _0x3de180=_0x5e7dae[_0x6141('0x22')],_0x434e40=_0x133d13[_0x6141('0x23')],_0x2f50bb=_0x133d13['offset']+_0x133d13[_0x6141('0x24')],_0x509d2e;if(_0x2f50bb>=_0x3de180){_0x2f50bb=_0x3de180;_0x509d2e=0xc8;}else{_0x509d2e=0xce;}_0x55d124['status'](_0x509d2e);return _0x55d124[_0x6141('0x25')]('Content-Range',_0x434e40+'-'+_0x2f50bb+'/'+_0x3de180)['json'](_0x5e7dae);}return null;};}function patchUpdates(_0x2c92a8){return function(_0x378928){try{jsonpatch[_0x6141('0x26')](_0x378928,_0x2c92a8,!![]);}catch(_0x3f0b2f){return BPromise['reject'](_0x3f0b2f);}return _0x378928[_0x6141('0x27')]();};}function saveUpdates(_0x538006,_0x27db12){return function(_0x47d021){if(_0x47d021){return _0x47d021[_0x6141('0x28')](_0x538006)['then'](function(_0x3cee79){return _0x3cee79;});}return null;};}function removeEntity(_0x539001,_0x2181a0){return function(_0x437bc4){if(_0x437bc4){return _0x437bc4[_0x6141('0x29')]()[_0x6141('0x2a')](function(){_0x539001[_0x6141('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2aa9,_0x26e4ce){return function(_0x3db6ad){if(!_0x3db6ad){_0x5b2aa9[_0x6141('0x1e')](0x194);}return _0x3db6ad;};}function handleError(_0xd24387,_0x391f37){_0x391f37=_0x391f37||0x1f4;return function(_0xc0fd0c){logger[_0x6141('0x2b')](_0xc0fd0c[_0x6141('0x2c')]);if(_0xc0fd0c[_0x6141('0x2d')]){delete _0xc0fd0c[_0x6141('0x2d')];}_0xd24387[_0x6141('0x1f')](_0x391f37)[_0x6141('0x2e')](_0xc0fd0c);};}function getInteractionUsers(_0xa0bee6,_0x12ab77){return new BPromise(function(_0x525950,_0x16c019){try{if(_0x12ab77[_0xa0bee6['id']]){_0xa0bee6[_0x6141('0x2f')]=_[_0x6141('0x30')](_0x12ab77[_0xa0bee6['id']],function(_0x21a7f0){return{'id':_0x21a7f0['id'],'fullname':_0x21a7f0[_0x6141('0x31')]};});}}catch(_0x45f867){_0x16c019(_0x45f867);}_0x525950(_0xa0bee6);});}function getInteractionTags(_0x1705c7,_0x17b9ca){return new BPromise(function(_0x5dc0aa,_0x1b1c2f){try{if(_0x1705c7[_0x6141('0x32')]){_0x1705c7['Tags']=[];_0x1705c7[_0x6141('0x32')]['split'](',')[_0x6141('0x33')](function(_0x4dac7f){_0x1705c7[_0x6141('0x34')][_0x6141('0x35')](_0x17b9ca[_0x4dac7f]);});}delete _0x1705c7['TagIds'];}catch(_0x27fd99){_0x1b1c2f(_0x27fd99);}_0x5dc0aa(_0x1705c7);});}function getLastMessageText(_0x5884de){return new BPromise(function(_0x12801b,_0x3efb83){return db[_0x6141('0x36')][_0x6141('0x37')]({'where':{'id':_0x5884de['id']},'attributes':['lastMsgBody',_0x6141('0x38')],'raw':!![]})[_0x6141('0x2a')](function(_0x49f07d){if(!_0x49f07d[_0x6141('0x38')]){_0x5884de[_0x6141('0x38')]=_[_0x6141('0x39')](htmlToText[_0x6141('0x3a')](_0x49f07d[_0x6141('0x3b')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x5884de[_0x6141('0x38')]=_0x49f07d[_0x6141('0x38')];}_0x12801b(_0x5884de);})[_0x6141('0x3c')](function(_0x2b0d8e){_0x3efb83(_0x2b0d8e);});});}function updateMailInteraction(_0x26d945,_0x9a9008,_0xe2e97f,_0x3e946f){return new BPromise(function(_0x225e07,_0x2178df){return getInteractionUsers(_0x26d945,_0xe2e97f)['then'](function(_0x639b05){return getInteractionTags(_0x639b05,_0x9a9008);})['then'](function(_0x5873da){if(_0x3e946f){_0x225e07(getLastMessageText(_0x5873da));}else{_0x225e07(_0x5873da);}})['catch'](function(_0x12a045){_0x2178df(_0x12a045);});});}exports[_0x6141('0x3d')]=function(_0x5d4b63,_0x152f67){var _0xebd6ca={},_0xd537f9={},_0x599b38={'count':0x0,'rows':[]};var _0x355885=_[_0x6141('0x30')](db['MailInteraction'][_0x6141('0x3e')],function(_0x5abff0){return{'name':_0x5abff0[_0x6141('0x3f')],'type':_0x5abff0[_0x6141('0x40')]['key']};});_0xd537f9['model']=_[_0x6141('0x30')](_0x355885,'name');_0xd537f9['query']=_[_0x6141('0x41')](_0x5d4b63['query']);_0xd537f9[_0x6141('0x42')]=_[_0x6141('0x43')](_0xd537f9[_0x6141('0x44')],_0xd537f9['query']);_0xebd6ca[_0x6141('0x45')]=_[_0x6141('0x43')](_0xd537f9[_0x6141('0x44')],qs[_0x6141('0x46')](_0x5d4b63[_0x6141('0x47')]['fields']));_0xebd6ca['attributes']=_0xebd6ca[_0x6141('0x45')]['length']?_0xebd6ca['attributes']:_0xd537f9[_0x6141('0x44')];if(!_0x5d4b63['query'][_0x6141('0x48')](_0x6141('0x49'))){_0xebd6ca[_0x6141('0x24')]=qs[_0x6141('0x24')](_0x5d4b63[_0x6141('0x47')][_0x6141('0x24')]);_0xebd6ca[_0x6141('0x23')]=qs[_0x6141('0x23')](_0x5d4b63[_0x6141('0x47')]['offset']);}_0xebd6ca[_0x6141('0x4a')]=qs['sort'](_0x5d4b63[_0x6141('0x47')][_0x6141('0x4b')]);_0xebd6ca[_0x6141('0x4c')]=qs[_0x6141('0x42')](_['pick'](_0x5d4b63[_0x6141('0x47')],_0xd537f9[_0x6141('0x42')]),_0x355885);var _0x4a4462=[];var _0x278f7d=squel[_0x6141('0x4d')]()[_0x6141('0x4e')]('id')[_0x6141('0x4e')]('name')[_0x6141('0x4e')](_0x6141('0x4f'))[_0x6141('0x50')]('tools_tags');var _0x152f0f=squel[_0x6141('0x4d')]()[_0x6141('0x4e')](_0x6141('0x51'))['field'](_0x6141('0x52'))[_0x6141('0x4e')](_0x6141('0x53'))['from'](_0x6141('0x54'),'ui')[_0x6141('0x55')]('users','u',_0x6141('0x56'));var _0x58573a=squel[_0x6141('0x4d')]()[_0x6141('0x50')](_0x6141('0x57'),'i')[_0x6141('0x55')](_0x6141('0x58'),'c',_0x6141('0x59'))['left_join'](_0x6141('0x5a'),'o',_0x6141('0x5b'))[_0x6141('0x55')](_0x6141('0x5c'),'a','a.id\x20=\x20i.MailAccountId')[_0x6141('0x55')]('mail_messages','me',_0x6141('0x5d'))[_0x6141('0x55')](_0x6141('0x5e'),'it',_0x6141('0x5f'))[_0x6141('0x55')](_0x6141('0x60'),'t',_0x6141('0x61'));var _0x17a141=squel[_0x6141('0x62')]();var _0x474fd4=[];var _0x188889=squel[_0x6141('0x62')]();var _0x2ab0be;if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x63')]){_0x2ab0be=as['parseSearch'](_0x5d4b63['query']['search']);var _0x15fe43=_0x2ab0be['sqlOperator'];for(var _0x525ddd=0x0;_0x525ddd<_0x2ab0be[_0x6141('0x64')][_0x6141('0x65')];_0x525ddd++){var _0x1009bc=_0x2ab0be[_0x6141('0x64')][_0x525ddd];var _0x5a87ff='i';var _0x1c9183=_[_0x6141('0x66')](_0x355885,['name',_0x1009bc['field']]);if(!_0x1c9183){switch(_0x1009bc[_0x6141('0x4e')]){case _0x6141('0x67'):if(_0x1009bc['value']==0x1){_0x58573a['having']('`'+_0x1009bc[_0x6141('0x4e')]+'`\x20=\x200');}else{_0x58573a['having']('`'+_0x1009bc[_0x6141('0x4e')]+_0x6141('0x68'));}break;case'Contact':if(_0x1009bc[_0x6141('0x69')]===_0x6141('0x6a')){if(_0x1009bc[_0x6141('0x6b')][_0x6141('0x6c')]('\x20')[_0x6141('0x65')]>0x1){_0x17a141[_0x15fe43](_0x6141('0x6d'),qs[_0x6141('0x6e')](_0x1009bc['value']),null);}else{var _0x3f8b21='%'+_0x1009bc[_0x6141('0x6b')]+'%';_0x17a141[_0x15fe43]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f8b21,_0x3f8b21,_0x3f8b21);}}else{_0x1c9183=_[_0x6141('0x66')](_0x355885,[_0x6141('0x2d'),_0x6141('0x6f')]);_0x1009bc[_0x6141('0x4e')]=_0x6141('0x6f');_0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183['type'],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}break;case _0x6141('0x73'):var _0x1be31a=_0x1009bc[_0x6141('0x6b')][_0x6141('0x6c')](',')[_0x6141('0x30')](function(_0x4773f2){return Number(_0x4773f2);});_0x1be31a['forEach'](function(_0x1e6ed7){_0x188889['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1e6ed7+',%');});_0x474fd4=_['union'](_0x474fd4,_0x1be31a);break;case _0x6141('0x74'):if(_0x1009bc[_0x6141('0x69')]===_0x6141('0x6a')){_0x17a141[_0x15fe43](_0x6141('0x75'),'%'+_0x1009bc['value']+'%',null);}else{_0x1c9183=_[_0x6141('0x66')](_0x355885,[_0x6141('0x2d'),_0x6141('0x76')]);_0x1009bc[_0x6141('0x4e')]='UserId';_0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183[_0x6141('0x40')],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa['text'],_0x4a08fa['value'][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}break;case'plainBody':_0x4a08fa=as[_0x6141('0x70')]('me',null,_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa['value']['end']);break;}}else{var _0x4a08fa=as[_0x6141('0x70')](_0x5a87ff,_0x1c9183[_0x6141('0x40')],_0x1009bc);_0x17a141[_0x15fe43](_0x4a08fa[_0x6141('0x71')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x72')],_0x4a08fa[_0x6141('0x6b')][_0x6141('0x20')]);}}}else{var _0x1535ae=_(_0x5d4b63[_0x6141('0x47')])[_0x6141('0x41')]()['map'](function(_0x403d64){return _[_0x6141('0x77')](_0x355885,[_0x6141('0x2d'),_0x403d64])?_0x403d64:undefined;})[_0x6141('0x78')]()[_0x6141('0x6b')]();if(!_[_0x6141('0x79')](_0x1535ae)){_0x1535ae[_0x6141('0x33')](function(_0x39cf73){if(_0x39cf73===_0x6141('0x7a')){_0x58573a[_0x6141('0x4c')]('i.MailAccountId\x20IN\x20?',[][_0x6141('0x7b')](_0x5d4b63[_0x6141('0x47')][_0x39cf73]));}else if(_0x39cf73===_0x6141('0x7c')){var _0x19305d=JSON[_0x6141('0x7d')](_0x5d4b63['query'][_0x39cf73])['$gte'];var _0xcdef30=JSON[_0x6141('0x7d')](_0x5d4b63[_0x6141('0x47')][_0x39cf73])[_0x6141('0x7e')];_0x58573a['where'](_0x6141('0x7f'),_0x19305d,_0xcdef30);}else{if(_0x5d4b63[_0x6141('0x47')][_0x39cf73]==='null'){_0x58573a[_0x6141('0x4c')]('i.'+_0x39cf73+_0x6141('0x80'));}else{_0x58573a[_0x6141('0x4c')]('i.'+_0x39cf73+_0x6141('0x81'),_0x5d4b63[_0x6141('0x47')][_0x39cf73]);}}});}if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x82')]){if(_0x5d4b63[_0x6141('0x47')]['read']==0x1){_0x58573a[_0x6141('0x83')](_0x6141('0x84'));}else{_0x58573a['having']('`unreadMessages`\x20>\x200');}}if(_0x5d4b63['query'][_0x6141('0x85')]){_0x474fd4=_[_0x6141('0x86')](_0x5d4b63[_0x6141('0x47')][_0x6141('0x85')])?_0x5d4b63[_0x6141('0x47')][_0x6141('0x85')]:new Array(_0x5d4b63['query'][_0x6141('0x85')]);_0x474fd4[_0x6141('0x33')](function(_0x58a34e){_0x188889['or'](_0x6141('0x87'),'%,'+_0x58a34e+',%');});}if(_0x5d4b63[_0x6141('0x47')]['filter']){var _0x427bc7=_0x5d4b63[_0x6141('0x47')]['filter'][_0x6141('0x88')]('\x5c','\x5c\x5c')[_0x6141('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x427bc7)){_0x17a141['or'](_0x6141('0x89'),_0x427bc7+'%');}else if(qs[_0x6141('0x8a')](_0x427bc7)){_0x17a141['or'](_0x6141('0x8b'),_0x427bc7+'%');}else{_0x17a141['or'](_0x6141('0x8c'),qs['getFullTextValue'](_0x427bc7))['or'](_0x6141('0x8d'),qs[_0x6141('0x6e')](_0x427bc7));}}}_0x58573a[_0x6141('0x4c')](_0x17a141);_0x58573a[_0x6141('0x8e')](_0x6141('0x8f'));var _0x2e86d0={'type':db[_0x6141('0x90')][_0x6141('0x91')][_0x6141('0x92')],'raw':!![]};var _0xd374c3=_0x58573a[_0x6141('0x93')]();_0xd374c3[_0x6141('0x4e')](_0x6141('0x8f'));_0xd374c3[_0x6141('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6141('0x67'));if(_0xebd6ca[_0x6141('0x4a')]){_0xebd6ca[_0x6141('0x4a')]['forEach'](function(_0x2357bd){var _0x562fae=_0x2357bd[0x0]==='contactName'?_0x2357bd[0x0]:'i.'+_0x2357bd[0x0];_0x58573a[_0x6141('0x4a')](_0x562fae,_0x2357bd[0x1]===_0x6141('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x474fd4)){_0x58573a['having'](_0x188889);_0xd374c3['where'](_0x6141('0x95'),_0x474fd4);}BPromise[_0x6141('0x96')]()[_0x6141('0x2a')](function(){if(!_0x2ab0be){if(_0x5d4b63[_0x6141('0x47')][_0x6141('0x7a')]||_0x5d4b63['query'][_0x6141('0x97')])return;_0xd374c3[_0x6141('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x58573a[_0x6141('0x4c')](_0x6141('0x98'));return;}if(_0x5d4b63['user'][_0x6141('0x99')]!==_0x6141('0x9a'))return;return _0x5d4b63['user'][_0x6141('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6141('0x2a')](function(_0x23b824){if(_[_0x6141('0x79')](_0x23b824)){_0xd374c3[_0x6141('0x4c')]('i.MailAccountId\x20IS\x20NULL');_0x58573a[_0x6141('0x4c')](_0x6141('0x9c'));}else{_0xd374c3[_0x6141('0x4c')](_0x6141('0x9d'),_[_0x6141('0x30')](_0x23b824,'id'));_0x58573a[_0x6141('0x4c')](_0x6141('0x9d'),_[_0x6141('0x30')](_0x23b824,'id'));}});})[_0x6141('0x2a')](function(){if(_0x5d4b63['user']['role']===_0x6141('0x9a')&&!_0x2ab0be&&!_0x5d4b63[_0x6141('0x47')]['MailAccountId'])return[];return db[_0x6141('0x9e')]['query'](_0xd374c3['toString'](),_0x2e86d0);})[_0x6141('0x2a')](function(_0x56036f){_0x599b38[_0x6141('0x22')]=_0x56036f[_0x6141('0x65')];if(_0x599b38[_0x6141('0x22')]===0x0)return[];return db[_0x6141('0x9e')]['query'](_0x278f7d[_0x6141('0x9f')](),_0x2e86d0)['then'](function(_0x408789){_0x4a4462=_['keyBy'](_0x408789,'id');_0x2e86d0=_['merge'](_0x2e86d0,{'model':db[_0x6141('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d4b63['query']['fields']){_0xebd6ca[_0x6141('0x45')]['forEach'](function(_0x404e90){_0x58573a[_0x6141('0x4e')]('i.'+_0x404e90);});}else{_0x58573a[_0x6141('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6141('0x67'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa0'),_0x6141('0xa1'));_0x58573a['field']('a.mandatoryDisposition',_0x6141('0xa2'));_0x58573a['field'](_0x6141('0xa3'),_0x6141('0xa4'));_0x58573a[_0x6141('0x4e')]('i.id');_0x58573a[_0x6141('0x4e')](_0x6141('0xa5'));_0x58573a['field'](_0x6141('0xa6'));_0x58573a[_0x6141('0x4e')]('i.closed');_0x58573a['field'](_0x6141('0xa7'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa8'));_0x58573a[_0x6141('0x4e')](_0x6141('0xa9'));_0x58573a[_0x6141('0x4e')]('i.lastMsgDirection');_0x58573a[_0x6141('0x4e')](_0x6141('0xaa'));_0x58573a[_0x6141('0x4e')](_0x6141('0xab'));_0x58573a[_0x6141('0x4e')](_0x6141('0xac'));_0x58573a['field']('i.thirdDisposition');_0x58573a['field'](_0x6141('0xad'));_0x58573a[_0x6141('0x4e')]('i.to');_0x58573a[_0x6141('0x4e')]('i.ContactId');_0x58573a['field'](_0x6141('0xae'));_0x58573a[_0x6141('0x4e')](_0x6141('0xaf'));_0x58573a[_0x6141('0x4e')]('c.firstName',_0x6141('0xb0'));_0x58573a['field']('c.lastName',_0x6141('0xb1'));_0x58573a['field']('c.email',_0x6141('0xb2'));_0x58573a[_0x6141('0x4e')]('c.phone',_0x6141('0xb3'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb4'),'Contact.mobile');_0x58573a[_0x6141('0x4e')]('c.fax',_0x6141('0xb5'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb6'),_0x6141('0xb7'));_0x58573a[_0x6141('0x4e')](_0x6141('0xb8'),_0x6141('0xb9'));_0x58573a[_0x6141('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6141('0x32'));}if(_0xebd6ca[_0x6141('0x24')])_0x58573a[_0x6141('0x24')](_0xebd6ca[_0x6141('0x24')]);if(_0xebd6ca[_0x6141('0x23')])_0x58573a[_0x6141('0x23')](_0xebd6ca[_0x6141('0x23')]);return db[_0x6141('0x9e')][_0x6141('0x47')](_0x58573a['toString'](),_0x2e86d0);})['then'](function(_0xecde2){_0x152f0f[_0x6141('0x4c')]('ui.MailInteractionId\x20IN\x20?',_[_0x6141('0x30')](_0xecde2,'id'));return db['sequelize']['query'](_0x152f0f[_0x6141('0x9f')](),_0x2e86d0)[_0x6141('0x2a')](function(_0x5cc4f1){var _0x63e8ac=_[_0x6141('0xba')](_0x5cc4f1,_0x6141('0xbb'));var _0x3cb075=[];return db[_0x6141('0xbc')][_0x6141('0x37')]({'attributes':[_0x6141('0xbd')],'raw':!![]})[_0x6141('0x2a')](function(_0x153385){var _0x1eb671=_0x153385['enableEmailPreview'];_0xecde2['forEach'](function(_0x54b00c){_0x3cb075['push'](updateMailInteraction(_0x54b00c,_0x4a4462,_0x63e8ac,_0x1eb671));});return BPromise[_0x6141('0xbe')](_0x3cb075);});});});})[_0x6141('0x2a')](function(_0x21041d){_0x599b38[_0x6141('0xbf')]=_0x21041d;return _0x599b38;})[_0x6141('0x2a')](respondWithFilteredResult(_0x152f67,_0xebd6ca))[_0x6141('0x3c')](handleError(_0x152f67,null));};exports['show']=function(_0x4197bf,_0x117c9e){var _0x504ce6={'raw':![],'where':{'id':_0x4197bf[_0x6141('0xc0')]['id']}},_0x2513b2={};_0x2513b2['model']=_[_0x6141('0x41')](db[_0x6141('0x36')][_0x6141('0x3e')]);_0x2513b2[_0x6141('0x47')]=_[_0x6141('0x41')](_0x4197bf[_0x6141('0x47')]);_0x2513b2['filters']=_[_0x6141('0x43')](_0x2513b2['model'],_0x2513b2[_0x6141('0x47')]);_0x504ce6['attributes']=_[_0x6141('0x43')](_0x2513b2['model'],qs['fields'](_0x4197bf[_0x6141('0x47')][_0x6141('0x46')]));_0x504ce6[_0x6141('0x45')]=_0x504ce6[_0x6141('0x45')][_0x6141('0x65')]?_0x504ce6[_0x6141('0x45')]:_0x2513b2['model'];if(_0x4197bf['query'][_0x6141('0xc1')]){_0x504ce6[_0x6141('0xc2')]=[{'all':!![]}];}_0x504ce6=_[_0x6141('0xc3')]({},_0x504ce6,_0x4197bf[_0x6141('0xc4')]);return db[_0x6141('0x36')][_0x6141('0x66')](_0x504ce6)[_0x6141('0x2a')](handleEntityNotFound(_0x117c9e,null))['then'](respondWithResult(_0x117c9e,null))[_0x6141('0x3c')](handleError(_0x117c9e,null));};exports[_0x6141('0xc5')]=function(_0x3d28af,_0x215ab7){return db[_0x6141('0x36')]['create'](_0x3d28af['body'],{})['then'](respondWithResult(_0x215ab7,0xc9))[_0x6141('0x3c')](handleError(_0x215ab7,null));};exports[_0x6141('0x28')]=function(_0x833089,_0x44c48b){if(_0x833089[_0x6141('0xc6')]['id']){delete _0x833089['body']['id'];}return db[_0x6141('0x36')][_0x6141('0x66')]({'where':{'id':_0x833089['params']['id']}})['then'](handleEntityNotFound(_0x44c48b,null))[_0x6141('0x2a')](saveUpdates(_0x833089[_0x6141('0xc6')],null))[_0x6141('0x2a')](respondWithResult(_0x44c48b,null))[_0x6141('0x3c')](handleError(_0x44c48b,null));};exports['destroy']=function(_0x199882,_0x2600ac){return db['MailInteraction'][_0x6141('0x66')]({'where':{'id':_0x199882[_0x6141('0xc0')]['id']}})['then'](handleEntityNotFound(_0x2600ac,null))[_0x6141('0x2a')](removeEntity(_0x2600ac,null))['catch'](handleError(_0x2600ac,null));};exports[_0x6141('0xc7')]=function(_0x573167,_0x711cf2){return db[_0x6141('0x36')]['describe']()[_0x6141('0x2a')](respondWithResult(_0x711cf2,null))[_0x6141('0x3c')](handleError(_0x711cf2,null));};exports[_0x6141('0xc8')]=function(_0x239622,_0x3956d4,_0x5353ee){return db['MailMessage'][_0x6141('0x66')]({'where':{'id':_0x239622['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x3956d4,null))[_0x6141('0x2a')](function(_0x3348bb){if(_0x3348bb){return _0x3348bb['addMessage'](_0x239622[_0x6141('0xc6')]['ids'],_[_0x6141('0xc9')](_0x239622[_0x6141('0xc6')],[_0x6141('0xca'),'id'])||{});}})[_0x6141('0x2a')](respondWithResult(_0x3956d4,null))[_0x6141('0x3c')](handleError(_0x3956d4,null));};exports['getMessages']=function(_0x1fb194,_0x33c30d,_0x22b6c3){var _0x5ae270={'raw':![],'where':{}};var _0x46d67b={};var _0x17b203={'count':0x0,'rows':[]};return db[_0x6141('0x36')][_0x6141('0x37')]({'where':{'id':_0x1fb194['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x33c30d,null))[_0x6141('0x2a')](function(_0x2e176b){if(_0x2e176b){_0x46d67b[_0x6141('0x44')]=_['keys'](db['MailMessage']['rawAttributes']);_0x46d67b[_0x6141('0x47')]=_[_0x6141('0x41')](_0x1fb194[_0x6141('0x47')]);_0x46d67b[_0x6141('0x42')]=_[_0x6141('0x43')](_0x46d67b[_0x6141('0x44')],_0x46d67b[_0x6141('0x47')]);_0x5ae270['attributes']=_[_0x6141('0x43')](_0x46d67b['model'],qs[_0x6141('0x46')](_0x1fb194['query'][_0x6141('0x46')]));_0x5ae270[_0x6141('0x45')]=_0x5ae270[_0x6141('0x45')]['length']?_0x5ae270[_0x6141('0x45')]:_0x46d67b[_0x6141('0x44')];if(!_0x1fb194[_0x6141('0x47')][_0x6141('0x48')](_0x6141('0x49'))){_0x5ae270[_0x6141('0x24')]=qs['limit'](_0x1fb194[_0x6141('0x47')][_0x6141('0x24')]);_0x5ae270['offset']=qs[_0x6141('0x23')](_0x1fb194[_0x6141('0x47')][_0x6141('0x23')]);}_0x5ae270[_0x6141('0x4a')]=qs[_0x6141('0x4b')](_0x1fb194[_0x6141('0x47')][_0x6141('0x4b')]);_0x5ae270['where']=qs[_0x6141('0x42')](_[_0x6141('0xcb')](_0x1fb194[_0x6141('0x47')],_0x46d67b[_0x6141('0x42')]));_0x5ae270['where'][_0x6141('0xbb')]=_0x2e176b['id'];if(_0x1fb194[_0x6141('0x47')][_0x6141('0xcc')]){_0x5ae270['where']=_[_0x6141('0xc3')](_0x5ae270[_0x6141('0x4c')],{'$or':_['map'](_0x5ae270[_0x6141('0x45')],function(_0x3cd9cb){var _0x4f1d5f={};_0x4f1d5f[_0x3cd9cb]={'$like':'%'+_0x1fb194[_0x6141('0x47')]['filter']+'%'};return _0x4f1d5f;})});}if(_0x1fb194[_0x6141('0x47')]['$gte']){var _0x4f4dda=_0x1fb194[_0x6141('0x47')][_0x6141('0xcd')]['split'](',');var _0x60af8={};_0x60af8[_0x4f4dda[0x0]]={'$gte':moment(_0x4f4dda[0x1])[_0x6141('0xce')](_0x6141('0xcf'))};_0x5ae270[_0x6141('0x4c')]=_['merge'](_0x5ae270[_0x6141('0x4c')],_0x60af8);}_0x5ae270=_[_0x6141('0xc3')]({},_0x5ae270,_0x1fb194[_0x6141('0xc4')]);return db['MailMessage']['count']({'where':_0x5ae270[_0x6141('0x4c')]})[_0x6141('0x2a')](function(_0x22f651){_0x17b203[_0x6141('0x22')]=_0x22f651;if(_0x1fb194[_0x6141('0x47')]['includeAll']){_0x5ae270['include']=[{'all':!![]}];}return db[_0x6141('0xd0')][_0x6141('0xd1')](_0x5ae270);})[_0x6141('0x2a')](function(_0x2e52ff){_0x17b203[_0x6141('0xbf')]=_0x2e52ff;return _0x17b203;});}})['then'](respondWithFilteredResult(_0x33c30d,_0x5ae270))[_0x6141('0x3c')](handleError(_0x33c30d,null));};exports[_0x6141('0xd2')]=function(_0x19c957,_0x76f688,_0x10f58c){return db['MailInteraction']['find']({'where':{'id':_0x19c957['params']['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x76f688,null))[_0x6141('0x2a')](function(_0x40c724){if(_0x40c724){return _0x40c724['setTags'](_0x19c957['body'][_0x6141('0xca')],_[_0x6141('0xc9')](_0x19c957[_0x6141('0xc6')],['ids','id'])||{})['spread'](function(){return db[_0x6141('0x73')][_0x6141('0xd1')]({'attributes':['id',_0x6141('0x2d'),_0x6141('0x4f')],'where':{'id':_0x19c957[_0x6141('0xc6')][_0x6141('0xca')]}});})[_0x6141('0x2a')](function(_0x57004d){socket['emit'](_0x6141('0xd3'),{'id':Number(_0x19c957[_0x6141('0xc0')]['id']),'tags':_0x57004d||[]});return{'id':Number(_0x19c957['params']['id']),'tags':_0x57004d||[]};});}})[_0x6141('0x2a')](respondWithResult(_0x76f688,null))[_0x6141('0x3c')](handleError(_0x76f688,null));};exports[_0x6141('0xd4')]=function(_0x1c72a1,_0x267fdb,_0x1cc6b3){return db[_0x6141('0x36')][_0x6141('0x66')]({'where':{'id':_0x1c72a1[_0x6141('0xc0')]['id']}})[_0x6141('0x2a')](handleEntityNotFound(_0x267fdb,null))['then'](function(_0x23cd78){if(_0x23cd78){return _0x23cd78[_0x6141('0xd4')](_0x1c72a1[_0x6141('0x47')][_0x6141('0xca')]);}})[_0x6141('0x2a')](respondWithStatusCode(_0x267fdb,null))[_0x6141('0x3c')](handleError(_0x267fdb,null));};exports[_0x6141('0xd5')]=function(_0x18e49c,_0x501cbf){var _0x1bc10d=moment()[_0x6141('0xd6')]()[_0x6141('0x9f')]();var _0x4ad7d2=path[_0x6141('0xd7')](config[_0x6141('0xd8')],_0x6141('0xd9'),_0x6141('0xda'),_0x6141('0xdb'));var _0x3275b4=path['join'](config[_0x6141('0xd8')],'server',_0x6141('0xda'),'attachments');var _0x1c823c=path[_0x6141('0xd7')](_0x4ad7d2,_0x1bc10d);var _0xfcca6f=util[_0x6141('0xce')](_0x6141('0xdc'),_0x18e49c[_0x6141('0xc0')]['id'],_0x1bc10d);var _0x5416f4=path[_0x6141('0xd7')](_0x4ad7d2,_0xfcca6f);var _0x167b8e=[];if(_0x18e49c[_0x6141('0x47')][_0x6141('0xdd')]){_0x167b8e[_0x6141('0x35')]({'model':db[_0x6141('0xde')],'as':_0x6141('0xdf'),'raw':!![]});}var _0x2cb4cd=[{'model':db[_0x6141('0xd0')],'as':_0x6141('0xe0'),'attributes':['id','body',_0x6141('0x50'),'to','cc',_0x6141('0xe1'),'subject',_0x6141('0x7c')],'where':{'secret':![]},'order':qs[_0x6141('0x4b')]('id'),'include':_0x167b8e}];return db['MailInteraction']['find']({'where':{'id':_0x18e49c[_0x6141('0xc0')]['id']},'include':_0x2cb4cd})[_0x6141('0x2a')](handleEntityNotFound(_0x501cbf,null))['then'](function(_0x142246){if(_0x142246&&_0x142246[_0x6141('0xe0')]){var _0x336bf2=_0x142246[_0x6141('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x1c823c);return BPromise[_0x6141('0xe3')](_0x336bf2[_0x6141('0xe0')],function(_0x512740,_0x564263){var _0x55a94b={'from':_0x512740[_0x6141('0x50')],'to':_0x512740['to'],'subject':_0x512740[_0x6141('0xe4')],'html':_0x512740[_0x6141('0xc6')],'headers':{'Date':moment(_0x512740[_0x6141('0x7c')])['format'](_0x6141('0xe5'))},'attachments':[]};if(_0x512740['cc']){_0x55a94b[_0x6141('0xe6')]['Cc']=_0x512740['cc'];}if(_0x512740[_0x6141('0xe1')]){_0x55a94b['headers']['Bcc']=_0x512740['bcc'];}return new BPromise(function(_0x45c9e0,_0x363ea4){if(_0x512740[_0x6141('0xdf')]){for(var _0x3b68aa=0x0;_0x3b68aa<_0x512740['Attachments'][_0x6141('0x65')];_0x3b68aa++){var _0x3a4527=_0x512740['Attachments'][_0x3b68aa];var _0x11081b=path[_0x6141('0xd7')](_0x3275b4,_0x3a4527[_0x6141('0xe7')]);if(fs[_0x6141('0xe8')](_0x11081b)){_0x55a94b[_0x6141('0xdd')][_0x6141('0x35')]({'name':_0x3a4527[_0x6141('0x2d')],'contentType':_0x3a4527[_0x6141('0x40')],'data':fs[_0x6141('0xe9')](_0x11081b)});}}}emlformat['build'](_0x55a94b,function(_0x3c7f32,_0x2ab710){if(_0x3c7f32)return _0x363ea4(_0x3c7f32);fs[_0x6141('0xea')](path['join'](_0x1c823c,util[_0x6141('0xce')](_0x6141('0xeb'),_0x564263)),_0x2ab710);return _0x45c9e0(_0x2ab710);});});})[_0x6141('0x2a')](function(){return new BPromise(function(_0xae30aa,_0x5d695f){zipdir(_0x1c823c,{'saveTo':_0x5416f4},function(_0x276b3e,_0x19d68f){if(_0x276b3e)return _0x5d695f(_0x276b3e);return _0xae30aa(_0x19d68f);});})[_0x6141('0x2a')](function(){return new BPromise(function(_0x440e34,_0x141fb7){rimraf(_0x1c823c,function(_0x23013e){if(_0x23013e)_0x141fb7(_0x23013e);return _0x440e34();});});})['then'](function(){return _0x501cbf['download'](_0x5416f4,_0xfcca6f,function(_0x37c97e){if(_0x37c97e){console[_0x6141('0xec')]('err',_0x37c97e);}else{fs[_0x6141('0xed')](_0x5416f4);}});});});}else{return _0x501cbf[_0x6141('0x1e')](0xc8);}})['catch'](handleError(_0x501cbf,null));}; \ No newline at end of file +var _0xc4f2=['set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','offset','order','sort','where','pick','field','color','tools_tags','select','u.id','ui.MailInteractionId','from','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','toString','count','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','filters','includeAll','include','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailInteraction.socket','sendStatus','status','end','limit'];(function(_0x6d2728,_0x42317e){var _0x78b013=function(_0x3a03eb){while(--_0x3a03eb){_0x6d2728['push'](_0x6d2728['shift']());}};_0x78b013(++_0x42317e);}(_0xc4f2,0xd8));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2c4f('0x0'));var emlformat=require(_0x2c4f('0x1'));var rimraf=require(_0x2c4f('0x2'));var zipdir=require(_0x2c4f('0x3'));var jsonpatch=require(_0x2c4f('0x4'));var rp=require(_0x2c4f('0x5'));var moment=require(_0x2c4f('0x6'));var BPromise=require(_0x2c4f('0x7'));var Mustache=require(_0x2c4f('0x8'));var util=require(_0x2c4f('0x9'));var path=require(_0x2c4f('0xa'));var sox=require(_0x2c4f('0xb'));var csv=require(_0x2c4f('0xc'));var ejs=require(_0x2c4f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c4f('0xe'));var crypto=require(_0x2c4f('0xf'));var jsforce=require(_0x2c4f('0x10'));var deskjs=require(_0x2c4f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2c4f('0x12'));var Papa=require(_0x2c4f('0x13'));var htmlToText=require(_0x2c4f('0x14'));var Redis=require(_0x2c4f('0x15'));var authService=require(_0x2c4f('0x16'));var qs=require(_0x2c4f('0x17'));var as=require(_0x2c4f('0x18'));var hardwareService=require(_0x2c4f('0x19'));var logger=require(_0x2c4f('0x1a'))('api');var utils=require(_0x2c4f('0x1b'));var config=require(_0x2c4f('0x1c'));var licenseUtil=require(_0x2c4f('0x1d'));var db=require(_0x2c4f('0x1e'))['db'];config['redis']=_['defaults'](config[_0x2c4f('0x1f')],{'host':_0x2c4f('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2c4f('0x21'))['register'](socket);function respondWithStatusCode(_0x518c19,_0x4ec06f){_0x4ec06f=_0x4ec06f||0xcc;return function(_0x333482){if(_0x333482){return _0x518c19[_0x2c4f('0x22')](_0x4ec06f);}return _0x518c19[_0x2c4f('0x23')](_0x4ec06f)[_0x2c4f('0x24')]();};}function respondWithResult(_0x706d25,_0x2a5e04){_0x2a5e04=_0x2a5e04||0xc8;return function(_0x7bb3b3){if(_0x7bb3b3){return _0x706d25[_0x2c4f('0x23')](_0x2a5e04)['json'](_0x7bb3b3);}};}function respondWithFilteredResult(_0x3ca3ed,_0x4cfd7b){return function(_0x522bdb){if(_0x522bdb){var _0x1d129c=_0x522bdb['count'],_0x3688c9=_0x4cfd7b['offset'],_0x3d7a4a=_0x4cfd7b['offset']+_0x4cfd7b[_0x2c4f('0x25')],_0xce1f3e;if(_0x3d7a4a>=_0x1d129c){_0x3d7a4a=_0x1d129c;_0xce1f3e=0xc8;}else{_0xce1f3e=0xce;}_0x3ca3ed['status'](_0xce1f3e);return _0x3ca3ed[_0x2c4f('0x26')](_0x2c4f('0x27'),_0x3688c9+'-'+_0x3d7a4a+'/'+_0x1d129c)[_0x2c4f('0x28')](_0x522bdb);}return null;};}function patchUpdates(_0xb1c501){return function(_0x12fdfa){try{jsonpatch[_0x2c4f('0x29')](_0x12fdfa,_0xb1c501,!![]);}catch(_0x451335){return BPromise[_0x2c4f('0x2a')](_0x451335);}return _0x12fdfa['save']();};}function saveUpdates(_0x34a8c5,_0x187f1e){return function(_0x5add59){if(_0x5add59){return _0x5add59[_0x2c4f('0x2b')](_0x34a8c5)[_0x2c4f('0x2c')](function(_0x221dc5){return _0x221dc5;});}return null;};}function removeEntity(_0x3e8486,_0x13057c){return function(_0x13647a){if(_0x13647a){return _0x13647a[_0x2c4f('0x2d')]()['then'](function(){_0x3e8486['status'](0xcc)[_0x2c4f('0x24')]();});}};}function handleEntityNotFound(_0x4ca0d9,_0x113d4e){return function(_0x15f2d2){if(!_0x15f2d2){_0x4ca0d9[_0x2c4f('0x22')](0x194);}return _0x15f2d2;};}function handleError(_0x5c3e23,_0x535024){_0x535024=_0x535024||0x1f4;return function(_0x2e521c){logger[_0x2c4f('0x2e')](_0x2e521c['stack']);if(_0x2e521c['name']){delete _0x2e521c[_0x2c4f('0x2f')];}_0x5c3e23['status'](_0x535024)[_0x2c4f('0x30')](_0x2e521c);};}function getInteractionUsers(_0x3e94b8,_0x4c2d79){return new BPromise(function(_0x36d838,_0x1d8a85){try{if(_0x4c2d79[_0x3e94b8['id']]){_0x3e94b8[_0x2c4f('0x31')]=_[_0x2c4f('0x32')](_0x4c2d79[_0x3e94b8['id']],function(_0xbfee6f){return{'id':_0xbfee6f['id'],'fullname':_0xbfee6f[_0x2c4f('0x33')]};});}}catch(_0x35437f){_0x1d8a85(_0x35437f);}_0x36d838(_0x3e94b8);});}function getInteractionTags(_0x170014,_0x4637a5){return new BPromise(function(_0x39ebd8,_0x2837d6){try{if(_0x170014['TagIds']){_0x170014['Tags']=[];_0x170014[_0x2c4f('0x34')]['split'](',')[_0x2c4f('0x35')](function(_0x2b6d1f){_0x170014[_0x2c4f('0x36')][_0x2c4f('0x37')](_0x4637a5[_0x2b6d1f]);});}delete _0x170014[_0x2c4f('0x34')];}catch(_0x42faa4){_0x2837d6(_0x42faa4);}_0x39ebd8(_0x170014);});}function getLastMessageText(_0x3fabea){return new BPromise(function(_0x463b66,_0x34d9cc){return db[_0x2c4f('0x38')]['findOne']({'where':{'id':_0x3fabea['id']},'attributes':[_0x2c4f('0x39'),'lastMsgText'],'raw':!![]})[_0x2c4f('0x2c')](function(_0x32d75a){if(!_0x32d75a[_0x2c4f('0x3a')]){_0x3fabea[_0x2c4f('0x3a')]=_[_0x2c4f('0x3b')](htmlToText[_0x2c4f('0x3c')](_0x32d75a[_0x2c4f('0x39')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3fabea[_0x2c4f('0x3a')]=_0x32d75a[_0x2c4f('0x3a')];}_0x463b66(_0x3fabea);})[_0x2c4f('0x3d')](function(_0x1e606b){_0x34d9cc(_0x1e606b);});});}function updateMailInteraction(_0x5f5345,_0xdf6519,_0x3c2efd,_0x173746){return new BPromise(function(_0x333d0f,_0x4ced62){return getInteractionUsers(_0x5f5345,_0x3c2efd)[_0x2c4f('0x2c')](function(_0x5c9b3e){return getInteractionTags(_0x5c9b3e,_0xdf6519);})[_0x2c4f('0x2c')](function(_0x28f95){if(_0x173746){_0x333d0f(getLastMessageText(_0x28f95));}else{_0x333d0f(_0x28f95);}})[_0x2c4f('0x3d')](function(_0x31e9e5){_0x4ced62(_0x31e9e5);});});}exports[_0x2c4f('0x3e')]=function(_0x14f401,_0x287b09){var _0x36963d={},_0x230d54={},_0x26962c={'count':0x0,'rows':[]};var _0x5b7a8f=_[_0x2c4f('0x32')](db[_0x2c4f('0x38')][_0x2c4f('0x3f')],function(_0x282dd1){return{'name':_0x282dd1['fieldName'],'type':_0x282dd1[_0x2c4f('0x40')][_0x2c4f('0x41')]};});_0x230d54['model']=_[_0x2c4f('0x32')](_0x5b7a8f,'name');_0x230d54[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x14f401[_0x2c4f('0x42')]);_0x230d54['filters']=_[_0x2c4f('0x44')](_0x230d54[_0x2c4f('0x45')],_0x230d54[_0x2c4f('0x42')]);_0x36963d[_0x2c4f('0x46')]=_[_0x2c4f('0x44')](_0x230d54['model'],qs[_0x2c4f('0x47')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x47')]));_0x36963d[_0x2c4f('0x46')]=_0x36963d[_0x2c4f('0x46')]['length']?_0x36963d[_0x2c4f('0x46')]:_0x230d54['model'];if(!_0x14f401['query']['hasOwnProperty'](_0x2c4f('0x48'))){_0x36963d[_0x2c4f('0x25')]=qs[_0x2c4f('0x25')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x25')]);_0x36963d[_0x2c4f('0x49')]=qs[_0x2c4f('0x49')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x49')]);}_0x36963d[_0x2c4f('0x4a')]=qs['sort'](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x4b')]);_0x36963d[_0x2c4f('0x4c')]=qs['filters'](_[_0x2c4f('0x4d')](_0x14f401[_0x2c4f('0x42')],_0x230d54['filters']),_0x5b7a8f);var _0x59cfc0=[];var _0xc4b466=squel['select']()[_0x2c4f('0x4e')]('id')[_0x2c4f('0x4e')]('name')[_0x2c4f('0x4e')](_0x2c4f('0x4f'))['from'](_0x2c4f('0x50'));var _0x8d070e=squel[_0x2c4f('0x51')]()['field'](_0x2c4f('0x52'))[_0x2c4f('0x4e')]('u.fullname')['field'](_0x2c4f('0x53'))[_0x2c4f('0x54')](_0x2c4f('0x55'),'ui')['left_join'](_0x2c4f('0x56'),'u',_0x2c4f('0x57'));var _0x2bf7b3=squel['select']()[_0x2c4f('0x54')](_0x2c4f('0x58'),'i')[_0x2c4f('0x59')](_0x2c4f('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2c4f('0x56'),'o',_0x2c4f('0x5b'))[_0x2c4f('0x59')](_0x2c4f('0x5c'),'a','a.id\x20=\x20i.MailAccountId')[_0x2c4f('0x59')](_0x2c4f('0x5d'),'me',_0x2c4f('0x5e'))[_0x2c4f('0x59')]('mail_interaction_has_tags','it',_0x2c4f('0x5f'))[_0x2c4f('0x59')](_0x2c4f('0x50'),'t',_0x2c4f('0x60'));var _0x1652c2=squel['expr']();var _0x4388c5=[];var _0x3b76dd=squel[_0x2c4f('0x61')]();var _0x5916b8;if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x62')]){_0x5916b8=as['parseSearch'](_0x14f401[_0x2c4f('0x42')]['search']);var _0x27d7f9=_0x5916b8[_0x2c4f('0x63')];for(var _0x22f142=0x0;_0x22f142<_0x5916b8[_0x2c4f('0x64')]['length'];_0x22f142++){var _0x25416b=_0x5916b8[_0x2c4f('0x64')][_0x22f142];var _0x75c44a='i';var _0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x25416b['field']]);if(!_0x391b11){switch(_0x25416b[_0x2c4f('0x4e')]){case _0x2c4f('0x66'):if(_0x25416b[_0x2c4f('0x67')]==0x1){_0x2bf7b3[_0x2c4f('0x68')]('`'+_0x25416b[_0x2c4f('0x4e')]+_0x2c4f('0x69'));}else{_0x2bf7b3[_0x2c4f('0x68')]('`'+_0x25416b[_0x2c4f('0x4e')]+_0x2c4f('0x6a'));}break;case _0x2c4f('0x6b'):if(_0x25416b[_0x2c4f('0x6c')]===_0x2c4f('0x6d')){if(_0x25416b[_0x2c4f('0x67')][_0x2c4f('0x6e')]('\x20')[_0x2c4f('0x6f')]>0x1){_0x1652c2[_0x27d7f9](_0x2c4f('0x70'),qs['getFullTextValue'](_0x25416b[_0x2c4f('0x67')]),null);}else{var _0x1f2bd7='%'+_0x25416b['value']+'%';_0x1652c2[_0x27d7f9](_0x2c4f('0x71'),_0x1f2bd7,_0x1f2bd7,_0x1f2bd7);}}else{_0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x2c4f('0x72')]);_0x25416b[_0x2c4f('0x4e')]=_0x2c4f('0x72');_0x4682ee=as['buildExpression'](_0x75c44a,_0x391b11[_0x2c4f('0x40')],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee['value'][_0x2c4f('0x74')],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x24')]);}break;case'Tag':var _0x362ec8=_0x25416b[_0x2c4f('0x67')][_0x2c4f('0x6e')](',')['map'](function(_0x33e689){return Number(_0x33e689);});_0x362ec8['forEach'](function(_0x44beaf){_0x3b76dd['or'](_0x2c4f('0x75'),'%,'+_0x44beaf+',%');});_0x4388c5=_[_0x2c4f('0x76')](_0x4388c5,_0x362ec8);break;case _0x2c4f('0x77'):if(_0x25416b[_0x2c4f('0x6c')]==='$substring'){_0x1652c2[_0x27d7f9](_0x2c4f('0x78'),'%'+_0x25416b['value']+'%',null);}else{_0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x2c4f('0x79')]);_0x25416b[_0x2c4f('0x4e')]=_0x2c4f('0x79');_0x4682ee=as[_0x2c4f('0x7a')](_0x75c44a,_0x391b11['type'],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee['value']['start'],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x24')]);}break;case'plainBody':_0x4682ee=as[_0x2c4f('0x7a')]('me',null,_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee['text'],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x74')],_0x4682ee['value'][_0x2c4f('0x24')]);break;}}else{var _0x4682ee=as[_0x2c4f('0x7a')](_0x75c44a,_0x391b11[_0x2c4f('0x40')],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x74')],_0x4682ee['value']['end']);}}}else{var _0x4ac23e=_(_0x14f401[_0x2c4f('0x42')])['keys']()[_0x2c4f('0x32')](function(_0x5670d8){return _[_0x2c4f('0x7b')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x5670d8])?_0x5670d8:undefined;})[_0x2c4f('0x7c')]()['value']();if(!_[_0x2c4f('0x7d')](_0x4ac23e)){_0x4ac23e[_0x2c4f('0x35')](function(_0x512257){if(_0x512257==='MailAccountId'){_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x7e'),[]['concat'](_0x14f401['query'][_0x512257]));}else if(_0x512257===_0x2c4f('0x7f')){var _0x2b2eb5=JSON['parse'](_0x14f401[_0x2c4f('0x42')][_0x512257])[_0x2c4f('0x80')];var _0x3b7b77=JSON['parse'](_0x14f401[_0x2c4f('0x42')][_0x512257])[_0x2c4f('0x81')];_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x82'),_0x2b2eb5,_0x3b7b77);}else{if(_0x14f401[_0x2c4f('0x42')][_0x512257]===_0x2c4f('0x83')){_0x2bf7b3[_0x2c4f('0x4c')]('i.'+_0x512257+_0x2c4f('0x84'));}else{_0x2bf7b3['where']('i.'+_0x512257+_0x2c4f('0x85'),_0x14f401[_0x2c4f('0x42')][_0x512257]);}}});}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x86')]){if(_0x14f401['query'][_0x2c4f('0x86')]==0x1){_0x2bf7b3[_0x2c4f('0x68')](_0x2c4f('0x87'));}else{_0x2bf7b3['having'](_0x2c4f('0x88'));}}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x89')]){_0x4388c5=_['isArray'](_0x14f401['query'][_0x2c4f('0x89')])?_0x14f401['query']['tag']:new Array(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x89')]);_0x4388c5[_0x2c4f('0x35')](function(_0x5a82ea){_0x3b76dd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5a82ea+',%');});}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x8a')]){var _0x10eb35=_0x14f401['query'][_0x2c4f('0x8a')][_0x2c4f('0x8b')]('\x5c','\x5c\x5c')[_0x2c4f('0x8b')](/'/g,'\x27\x27');if(qs[_0x2c4f('0x8c')](_0x10eb35)){_0x1652c2['or'](_0x2c4f('0x8d'),_0x10eb35+'%');}else if(qs[_0x2c4f('0x8e')](_0x10eb35)){_0x1652c2['or'](_0x2c4f('0x8f'),_0x10eb35+'%');}else{_0x1652c2['or'](_0x2c4f('0x90'),qs[_0x2c4f('0x91')](_0x10eb35))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2c4f('0x91')](_0x10eb35));}}}_0x2bf7b3[_0x2c4f('0x4c')](_0x1652c2);_0x2bf7b3[_0x2c4f('0x92')]('i.id');var _0x41605a={'type':db[_0x2c4f('0x93')][_0x2c4f('0x94')]['SELECT'],'raw':!![]};var _0x323cb7=_0x2bf7b3[_0x2c4f('0x95')]();_0x323cb7['field'](_0x2c4f('0x96'));_0x323cb7[_0x2c4f('0x4e')](_0x2c4f('0x97'),'unreadMessages');if(_0x36963d[_0x2c4f('0x4a')]){_0x36963d['order'][_0x2c4f('0x35')](function(_0x114cc3){var _0x51e17e=_0x114cc3[0x0]===_0x2c4f('0x98')?_0x114cc3[0x0]:'i.'+_0x114cc3[0x0];_0x2bf7b3[_0x2c4f('0x4a')](_0x51e17e,_0x114cc3[0x1]===_0x2c4f('0x99')?![]:!![]);});}if(!_[_0x2c4f('0x7d')](_0x4388c5)){_0x2bf7b3[_0x2c4f('0x68')](_0x3b76dd);_0x323cb7[_0x2c4f('0x4c')](_0x2c4f('0x9a'),_0x4388c5);}BPromise['resolve']()[_0x2c4f('0x2c')](function(){if(!_0x5916b8){if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9b')]||_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9c')])return;_0x323cb7[_0x2c4f('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x9d'));return;}if(_0x14f401[_0x2c4f('0x9e')]['role']!==_0x2c4f('0x9f'))return;return _0x14f401[_0x2c4f('0x9e')][_0x2c4f('0xa0')]({'attributes':['id'],'raw':!![]})[_0x2c4f('0x2c')](function(_0x344b92){if(_[_0x2c4f('0x7d')](_0x344b92)){_0x323cb7['where']('i.MailAccountId\x20IS\x20NULL');_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0xa1'));}else{_0x323cb7[_0x2c4f('0x4c')]('i.MailAccountId\x20IN\x20?',_['map'](_0x344b92,'id'));_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x7e'),_[_0x2c4f('0x32')](_0x344b92,'id'));}});})[_0x2c4f('0x2c')](function(){if(_0x14f401[_0x2c4f('0x9e')][_0x2c4f('0xa2')]==='agent'&&!_0x5916b8&&!_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9b')])return[];return db['sequelize']['query'](_0x323cb7[_0x2c4f('0xa3')](),_0x41605a);})[_0x2c4f('0x2c')](function(_0xc38434){_0x26962c[_0x2c4f('0xa4')]=_0xc38434[_0x2c4f('0x6f')];if(_0x26962c[_0x2c4f('0xa4')]===0x0)return[];return db[_0x2c4f('0xa5')][_0x2c4f('0x42')](_0xc4b466[_0x2c4f('0xa3')](),_0x41605a)[_0x2c4f('0x2c')](function(_0x45ac26){_0x59cfc0=_['keyBy'](_0x45ac26,'id');_0x41605a=_[_0x2c4f('0xa6')](_0x41605a,{'model':db[_0x2c4f('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x47')]){_0x36963d[_0x2c4f('0x46')][_0x2c4f('0x35')](function(_0x22681c){_0x2bf7b3[_0x2c4f('0x4e')]('i.'+_0x22681c);});}else{_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0x97'),_0x2c4f('0x66'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xa7'),_0x2c4f('0xa8'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xa9'),'Account.mandatoryDisposition');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xaa'),'contactName');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0x96'));_0x2bf7b3['field'](_0x2c4f('0xab'));_0x2bf7b3[_0x2c4f('0x4e')]('i.updatedAt');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xac'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xad'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xae'));_0x2bf7b3['field'](_0x2c4f('0xaf'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb0'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb1'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb2'));_0x2bf7b3['field'](_0x2c4f('0xb3'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb4'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb5'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb6'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb7'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb8'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb9'));_0x2bf7b3['field'](_0x2c4f('0xba'),_0x2c4f('0xbb'));_0x2bf7b3['field'](_0x2c4f('0xbc'),_0x2c4f('0xbd'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xbe'),'Contact.email');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xbf'),_0x2c4f('0xc0'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc1'),_0x2c4f('0xc2'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc3'),_0x2c4f('0xc4'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc5'),'Owner.fullname');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc6'),_0x2c4f('0xc7'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc8'),_0x2c4f('0x34'));}if(_0x36963d[_0x2c4f('0x25')])_0x2bf7b3['limit'](_0x36963d[_0x2c4f('0x25')]);if(_0x36963d[_0x2c4f('0x49')])_0x2bf7b3[_0x2c4f('0x49')](_0x36963d['offset']);return db[_0x2c4f('0xa5')][_0x2c4f('0x42')](_0x2bf7b3['toString'](),_0x41605a);})[_0x2c4f('0x2c')](function(_0x405226){_0x8d070e[_0x2c4f('0x4c')](_0x2c4f('0xc9'),_[_0x2c4f('0x32')](_0x405226,'id'));return db['sequelize']['query'](_0x8d070e[_0x2c4f('0xa3')](),_0x41605a)['then'](function(_0xd1fb92){var _0x2ee5c6=_['groupBy'](_0xd1fb92,_0x2c4f('0xca'));var _0x30d082=[];return db[_0x2c4f('0xcb')]['findOne']({'attributes':[_0x2c4f('0xcc')],'raw':!![]})['then'](function(_0x21e82c){var _0x1e9725=_0x21e82c['enableEmailPreview'];_0x405226[_0x2c4f('0x35')](function(_0x54269a){_0x30d082['push'](updateMailInteraction(_0x54269a,_0x59cfc0,_0x2ee5c6,_0x1e9725));});return BPromise[_0x2c4f('0xcd')](_0x30d082);});});});})['then'](function(_0x489a8d){_0x26962c[_0x2c4f('0xce')]=_0x489a8d;return _0x26962c;})[_0x2c4f('0x2c')](respondWithFilteredResult(_0x287b09,_0x36963d))[_0x2c4f('0x3d')](handleError(_0x287b09,null));};exports[_0x2c4f('0xcf')]=function(_0x4906c9,_0x36cfa1){var _0x2e1bc2={'raw':![],'where':{'id':_0x4906c9[_0x2c4f('0xd0')]['id']}},_0x18fb9b={};_0x18fb9b[_0x2c4f('0x45')]=_[_0x2c4f('0x43')](db[_0x2c4f('0x38')]['rawAttributes']);_0x18fb9b[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x4906c9['query']);_0x18fb9b[_0x2c4f('0xd1')]=_[_0x2c4f('0x44')](_0x18fb9b[_0x2c4f('0x45')],_0x18fb9b[_0x2c4f('0x42')]);_0x2e1bc2[_0x2c4f('0x46')]=_[_0x2c4f('0x44')](_0x18fb9b[_0x2c4f('0x45')],qs[_0x2c4f('0x47')](_0x4906c9[_0x2c4f('0x42')][_0x2c4f('0x47')]));_0x2e1bc2['attributes']=_0x2e1bc2[_0x2c4f('0x46')][_0x2c4f('0x6f')]?_0x2e1bc2[_0x2c4f('0x46')]:_0x18fb9b[_0x2c4f('0x45')];if(_0x4906c9[_0x2c4f('0x42')][_0x2c4f('0xd2')]){_0x2e1bc2[_0x2c4f('0xd3')]=[{'all':!![]}];}_0x2e1bc2=_[_0x2c4f('0xa6')]({},_0x2e1bc2,_0x4906c9['options']);return db[_0x2c4f('0x38')]['find'](_0x2e1bc2)[_0x2c4f('0x2c')](handleEntityNotFound(_0x36cfa1,null))[_0x2c4f('0x2c')](respondWithResult(_0x36cfa1,null))[_0x2c4f('0x3d')](handleError(_0x36cfa1,null));};exports[_0x2c4f('0xd4')]=function(_0x361e71,_0x3f3683){return db['MailInteraction']['create'](_0x361e71[_0x2c4f('0xd5')],{})['then'](respondWithResult(_0x3f3683,0xc9))[_0x2c4f('0x3d')](handleError(_0x3f3683,null));};exports[_0x2c4f('0x2b')]=function(_0xc13243,_0x405929){if(_0xc13243[_0x2c4f('0xd5')]['id']){delete _0xc13243[_0x2c4f('0xd5')]['id'];}return db[_0x2c4f('0x38')]['find']({'where':{'id':_0xc13243['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x405929,null))[_0x2c4f('0x2c')](saveUpdates(_0xc13243[_0x2c4f('0xd5')],null))['then'](respondWithResult(_0x405929,null))[_0x2c4f('0x3d')](handleError(_0x405929,null));};exports[_0x2c4f('0x2d')]=function(_0x5d0a07,_0x159c59){return db[_0x2c4f('0x38')][_0x2c4f('0x65')]({'where':{'id':_0x5d0a07[_0x2c4f('0xd0')]['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x159c59,null))['then'](removeEntity(_0x159c59,null))['catch'](handleError(_0x159c59,null));};exports[_0x2c4f('0xd6')]=function(_0xb3c109,_0x56740d){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x56740d,null))[_0x2c4f('0x3d')](handleError(_0x56740d,null));};exports[_0x2c4f('0xd7')]=function(_0x50cba3,_0x12c8c6,_0xd8ad31){return db[_0x2c4f('0xd8')][_0x2c4f('0x65')]({'where':{'id':_0x50cba3[_0x2c4f('0xd0')]['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x12c8c6,null))[_0x2c4f('0x2c')](function(_0x1372c3){if(_0x1372c3){return _0x1372c3[_0x2c4f('0xd7')](_0x50cba3[_0x2c4f('0xd5')][_0x2c4f('0xd9')],_[_0x2c4f('0xda')](_0x50cba3[_0x2c4f('0xd5')],[_0x2c4f('0xd9'),'id'])||{});}})[_0x2c4f('0x2c')](respondWithResult(_0x12c8c6,null))[_0x2c4f('0x3d')](handleError(_0x12c8c6,null));};exports[_0x2c4f('0xdb')]=function(_0x26c6a5,_0x19cae5,_0x5463fe){var _0x486804={'raw':![],'where':{}};var _0x2af0d={};var _0x6c58a5={'count':0x0,'rows':[]};return db[_0x2c4f('0x38')]['findOne']({'where':{'id':_0x26c6a5['params']['id']}})['then'](handleEntityNotFound(_0x19cae5,null))['then'](function(_0x1a8dd8){if(_0x1a8dd8){_0x2af0d['model']=_[_0x2c4f('0x43')](db[_0x2c4f('0xd8')][_0x2c4f('0x3f')]);_0x2af0d[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x26c6a5['query']);_0x2af0d['filters']=_['intersection'](_0x2af0d['model'],_0x2af0d[_0x2c4f('0x42')]);_0x486804['attributes']=_[_0x2c4f('0x44')](_0x2af0d[_0x2c4f('0x45')],qs['fields'](_0x26c6a5['query'][_0x2c4f('0x47')]));_0x486804[_0x2c4f('0x46')]=_0x486804[_0x2c4f('0x46')]['length']?_0x486804['attributes']:_0x2af0d[_0x2c4f('0x45')];if(!_0x26c6a5['query']['hasOwnProperty'](_0x2c4f('0x48'))){_0x486804['limit']=qs[_0x2c4f('0x25')](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x25')]);_0x486804['offset']=qs[_0x2c4f('0x49')](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x49')]);}_0x486804['order']=qs['sort'](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x4b')]);_0x486804['where']=qs['filters'](_['pick'](_0x26c6a5[_0x2c4f('0x42')],_0x2af0d[_0x2c4f('0xd1')]));_0x486804[_0x2c4f('0x4c')][_0x2c4f('0xca')]=_0x1a8dd8['id'];if(_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x8a')]){_0x486804[_0x2c4f('0x4c')]=_[_0x2c4f('0xa6')](_0x486804[_0x2c4f('0x4c')],{'$or':_['map'](_0x486804[_0x2c4f('0x46')],function(_0x1e0eff){var _0x86ccf0={};_0x86ccf0[_0x1e0eff]={'$like':'%'+_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x8a')]+'%'};return _0x86ccf0;})});}if(_0x26c6a5['query'][_0x2c4f('0x80')]){var _0x346ef3=_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x80')]['split'](',');var _0xe702fd={};_0xe702fd[_0x346ef3[0x0]]={'$gte':moment(_0x346ef3[0x1])[_0x2c4f('0xdc')](_0x2c4f('0xdd'))};_0x486804[_0x2c4f('0x4c')]=_[_0x2c4f('0xa6')](_0x486804['where'],_0xe702fd);}_0x486804=_['merge']({},_0x486804,_0x26c6a5['options']);return db[_0x2c4f('0xd8')][_0x2c4f('0xa4')]({'where':_0x486804[_0x2c4f('0x4c')]})['then'](function(_0x47bf30){_0x6c58a5[_0x2c4f('0xa4')]=_0x47bf30;if(_0x26c6a5['query'][_0x2c4f('0xd2')]){_0x486804[_0x2c4f('0xd3')]=[{'all':!![]}];}return db[_0x2c4f('0xd8')][_0x2c4f('0xde')](_0x486804);})[_0x2c4f('0x2c')](function(_0x5dec13){_0x6c58a5[_0x2c4f('0xce')]=_0x5dec13;return _0x6c58a5;});}})[_0x2c4f('0x2c')](respondWithFilteredResult(_0x19cae5,_0x486804))[_0x2c4f('0x3d')](handleError(_0x19cae5,null));};exports[_0x2c4f('0xdf')]=function(_0xa64b7f,_0x4540c7,_0x25f641){return db[_0x2c4f('0x38')][_0x2c4f('0x65')]({'where':{'id':_0xa64b7f['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x4540c7,null))['then'](function(_0x26b1bd){if(_0x26b1bd){return _0x26b1bd[_0x2c4f('0xe0')](_0xa64b7f[_0x2c4f('0xd5')][_0x2c4f('0xd9')],_['omit'](_0xa64b7f[_0x2c4f('0xd5')],[_0x2c4f('0xd9'),'id'])||{})[_0x2c4f('0xe1')](function(){return db[_0x2c4f('0xe2')]['findAll']({'attributes':['id',_0x2c4f('0x2f'),_0x2c4f('0x4f')],'where':{'id':_0xa64b7f[_0x2c4f('0xd5')][_0x2c4f('0xd9')]}});})[_0x2c4f('0x2c')](function(_0x1fed75){socket[_0x2c4f('0xe3')](_0x2c4f('0xe4'),{'id':Number(_0xa64b7f['params']['id']),'tags':_0x1fed75||[]});return{'id':Number(_0xa64b7f[_0x2c4f('0xd0')]['id']),'tags':_0x1fed75||[]};});}})[_0x2c4f('0x2c')](respondWithResult(_0x4540c7,null))[_0x2c4f('0x3d')](handleError(_0x4540c7,null));};exports['removeTags']=function(_0x58c743,_0x1b6264,_0x3adf87){return db['MailInteraction'][_0x2c4f('0x65')]({'where':{'id':_0x58c743['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x1b6264,null))[_0x2c4f('0x2c')](function(_0x28caf6){if(_0x28caf6){return _0x28caf6[_0x2c4f('0xe5')](_0x58c743[_0x2c4f('0x42')][_0x2c4f('0xd9')]);}})[_0x2c4f('0x2c')](respondWithStatusCode(_0x1b6264,null))[_0x2c4f('0x3d')](handleError(_0x1b6264,null));};exports[_0x2c4f('0xe6')]=function(_0x39b0dc,_0x1252e4){var _0x34840a=moment()[_0x2c4f('0xe7')]()[_0x2c4f('0xa3')]();var _0x1de6b4=path[_0x2c4f('0xe8')](config[_0x2c4f('0xe9')],'server',_0x2c4f('0xea'),'tmp');var _0x479b7e=path['join'](config[_0x2c4f('0xe9')],'server',_0x2c4f('0xea'),'attachments');var _0x44cb1f=path[_0x2c4f('0xe8')](_0x1de6b4,_0x34840a);var _0x5c07c3=util[_0x2c4f('0xdc')](_0x2c4f('0xeb'),_0x39b0dc['params']['id'],_0x34840a);var _0x236fe8=path[_0x2c4f('0xe8')](_0x1de6b4,_0x5c07c3);var _0x36e49c=[];if(_0x39b0dc[_0x2c4f('0x42')]['attachments']){_0x36e49c['push']({'model':db[_0x2c4f('0xec')],'as':_0x2c4f('0xed'),'raw':!![]});}var _0x14aa1f=[{'model':db[_0x2c4f('0xd8')],'as':_0x2c4f('0xee'),'attributes':['id',_0x2c4f('0xd5'),'from','to','cc','bcc',_0x2c4f('0xef'),_0x2c4f('0x7f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x36e49c}];return db[_0x2c4f('0x38')]['find']({'where':{'id':_0x39b0dc['params']['id']},'include':_0x14aa1f})[_0x2c4f('0x2c')](handleEntityNotFound(_0x1252e4,null))['then'](function(_0x544b39){if(_0x544b39&&_0x544b39['Messages']){var _0x486b2e=_0x544b39[_0x2c4f('0xf0')]({'plain':!![]});fs['mkdirSync'](_0x44cb1f);return BPromise[_0x2c4f('0xf1')](_0x486b2e[_0x2c4f('0xee')],function(_0x13f780,_0x5a41e3){var _0x33b710={'from':_0x13f780[_0x2c4f('0x54')],'to':_0x13f780['to'],'subject':_0x13f780[_0x2c4f('0xef')],'html':_0x13f780['body'],'headers':{'Date':moment(_0x13f780['createdAt'])[_0x2c4f('0xdc')](_0x2c4f('0xf2'))},'attachments':[]};if(_0x13f780['cc']){_0x33b710[_0x2c4f('0xf3')]['Cc']=_0x13f780['cc'];}if(_0x13f780[_0x2c4f('0xf4')]){_0x33b710[_0x2c4f('0xf3')][_0x2c4f('0xf5')]=_0x13f780[_0x2c4f('0xf4')];}return new BPromise(function(_0x252c37,_0x3f6477){if(_0x13f780[_0x2c4f('0xed')]){for(var _0x6a6046=0x0;_0x6a6046<_0x13f780[_0x2c4f('0xed')]['length'];_0x6a6046++){var _0x596c6d=_0x13f780[_0x2c4f('0xed')][_0x6a6046];var _0x5c6cae=path[_0x2c4f('0xe8')](_0x479b7e,_0x596c6d[_0x2c4f('0xf6')]);if(fs[_0x2c4f('0xf7')](_0x5c6cae)){_0x33b710['attachments'][_0x2c4f('0x37')]({'name':_0x596c6d[_0x2c4f('0x2f')],'contentType':_0x596c6d['type'],'data':fs[_0x2c4f('0xf8')](_0x5c6cae)});}}}emlformat[_0x2c4f('0xf9')](_0x33b710,function(_0x5350cf,_0x1fa8af){if(_0x5350cf)return _0x3f6477(_0x5350cf);fs[_0x2c4f('0xfa')](path[_0x2c4f('0xe8')](_0x44cb1f,util[_0x2c4f('0xdc')]('message%d.eml',_0x5a41e3)),_0x1fa8af);return _0x252c37(_0x1fa8af);});});})[_0x2c4f('0x2c')](function(){return new BPromise(function(_0x496475,_0x3230fd){zipdir(_0x44cb1f,{'saveTo':_0x236fe8},function(_0x5b983e,_0x41b352){if(_0x5b983e)return _0x3230fd(_0x5b983e);return _0x496475(_0x41b352);});})[_0x2c4f('0x2c')](function(){return new BPromise(function(_0x1fe463,_0x180463){rimraf(_0x44cb1f,function(_0x2d3184){if(_0x2d3184)_0x180463(_0x2d3184);return _0x1fe463();});});})[_0x2c4f('0x2c')](function(){return _0x1252e4[_0x2c4f('0xe6')](_0x236fe8,_0x5c07c3,function(_0x344a4a){if(_0x344a4a){console[_0x2c4f('0xfb')](_0x2c4f('0xfc'),_0x344a4a);}else{fs[_0x2c4f('0xfd')](_0x236fe8);}});});});}else{return _0x1252e4[_0x2c4f('0x22')](0xc8);}})[_0x2c4f('0x3d')](handleError(_0x1252e4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8ac63e4..512cae6 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 _0xb471=['setMaxListeners','save','update','remove','getUsers','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','MailInteraction','../../mysqldb','MailMessage'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xb471,0x1ed));var _0x1b47=function(_0x1f3746,_0x46e39b){_0x1f3746=_0x1f3746-0x0;var _0x1d098d=_0xb471[_0x1f3746];return _0x1d098d;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x1b47('0x0')];var MailMessage=require(_0x1b47('0x1'))['db'][_0x1b47('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1b47('0x3')](0x0);var events={'afterCreate':_0x1b47('0x4'),'afterUpdate':_0x1b47('0x5'),'afterDestroy':_0x1b47('0x6')};function emitEvent(_0x5778b5){return function(_0x13292a,_0x5a1f66,_0x4bbe5b){_0x13292a[_0x1b47('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x208440){_0x13292a['setDataValue'](_0x1b47('0x8'),_0x208440['map'](function(_0x1c1c96){return{'id':_0x1c1c96['id']};}));return MailMessage[_0x1b47('0x9')]({'where':{'MailInteractionId':_0x13292a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1b47('0xa')](function(_0x5c1db2){_0x13292a['setDataValue'](_0x1b47('0xb'),_0x5c1db2['length']);MailInteractionEvents[_0x1b47('0xc')](_0x5778b5+':'+_0x13292a['id'],_0x13292a);MailInteractionEvents[_0x1b47('0xc')](_0x5778b5,_0x13292a);_0x4bbe5b(null);})[_0x1b47('0xd')](_0x4bbe5b(null));};}for(var e in events){if(events[_0x1b47('0xe')](e)){var event=events[e];MailInteraction[_0x1b47('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xf8b0=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then'];(function(_0x5dd6d8,_0xe461ae){var _0x271126=function(_0x1536f8){while(--_0x1536f8){_0x5dd6d8['push'](_0x5dd6d8['shift']());}};_0x271126(++_0xe461ae);}(_0xf8b0,0x147));var _0x0f8b=function(_0x34f884,_0x138a7a){_0x34f884=_0x34f884-0x0;var _0x2305fa=_0xf8b0[_0x34f884];return _0x2305fa;};'use strict';var EventEmitter=require(_0x0f8b('0x0'));var MailInteraction=require(_0x0f8b('0x1'))['db'][_0x0f8b('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x0f8b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0f8b('0x4')](0x0);var events={'afterCreate':_0x0f8b('0x5'),'afterUpdate':_0x0f8b('0x6'),'afterDestroy':_0x0f8b('0x7')};function emitEvent(_0x23fd14){return function(_0x3185e4,_0x31dc01,_0x24c662){_0x3185e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x0f8b('0x8')](function(_0xbfc4f4){_0x3185e4[_0x0f8b('0x9')](_0x0f8b('0xa'),_0xbfc4f4[_0x0f8b('0xb')](function(_0x396a9c){return{'id':_0x396a9c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3185e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f8b('0x8')](function(_0x24fd06){_0x3185e4[_0x0f8b('0x9')](_0x0f8b('0xc'),_0x24fd06['length']);MailInteractionEvents[_0x0f8b('0xd')](_0x23fd14+':'+_0x3185e4['id'],_0x3185e4);MailInteractionEvents['emit'](_0x23fd14,_0x3185e4);_0x24c662(null);})[_0x0f8b('0xe')](_0x24c662(null));};}for(var e in events){if(events[_0x0f8b('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index dbb69ff..c55c51d 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 _0x325b=['subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x1c4669,_0x26d51f){var _0x16086c=function(_0x44b87d){while(--_0x44b87d){_0x1c4669['push'](_0x1c4669['shift']());}};_0x16086c(++_0x26d51f);}(_0x325b,0x8b));var _0xb325=function(_0x45b5a5,_0x3b6e10){_0x45b5a5=_0x45b5a5-0x0;var _0x2fb439=_0x325b[_0x45b5a5];return _0x2fb439;};'use strict';var _=require(_0xb325('0x0'));var util=require(_0xb325('0x1'));var logger=require(_0xb325('0x2'))('api');var moment=require(_0xb325('0x3'));var BPromise=require(_0xb325('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb325('0x5'));var config=require(_0xb325('0x6'));var attributes=require(_0xb325('0x7'));module['exports']=function(_0x4a1ea8,_0x33dcfc){return _0x4a1ea8['define'](_0xb325('0x8'),attributes,{'tableName':_0xb325('0x9'),'paranoid':![],'indexes':[{'name':_0xb325('0xa'),'fields':[_0xb325('0xb'),'to'],'type':_0xb325('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28910a,_0xb008cb,_0x237201){if(_0x28910a[_0xb325('0xd')]){_0x28910a[_0xb325('0xe')]=moment()[_0xb325('0xf')](_0xb325('0x10'));}if(_0x28910a[_0xb325('0x11')]){_0x28910a[_0xb325('0x12')]=moment()['format'](_0xb325('0x10'));}_0x237201(null,_0xb008cb);},'beforeUpdate':function(_0xff2cc3,_0x3d0e2d,_0x1ee42f){if(_0xff2cc3['changed'](_0xb325('0xd'))){_0xff2cc3[_0xb325('0xe')]=_0xff2cc3['substatus']?moment()[_0xb325('0xf')](_0xb325('0x10')):null;}if(_0xff2cc3[_0xb325('0x13')](_0xb325('0x11'))){_0xff2cc3['closedAt']=moment()[_0xb325('0xf')](_0xb325('0x10'));_0xff2cc3[_0xb325('0xd')]=null;_0xff2cc3[_0xb325('0xe')]=null;}_0x1ee42f(null,_0xff2cc3);},'afterUpdate':function(_0x2d7398,_0x2e3b1d,_0x7106c7){var _0xa4e6c6=_0x4a1ea8['models'];var _0x318598=_0x2d7398['get']({'plain':!![]});if(_0x318598[_0xb325('0x11')]){return _0xa4e6c6[_0xb325('0x14')][_0xb325('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x318598['id']}})['then'](function(){_0x7106c7();})[_0xb325('0x16')](function(_0x3f1893){_0x7106c7(_0x3f1893);});}else{_0x7106c7();}}},'charset':_0xb325('0x17'),'collate':_0xb325('0x18')});}; \ No newline at end of file +var _0xa74d=['update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage'];(function(_0x1002af,_0x41aa4a){var _0x215467=function(_0x28d36c){while(--_0x28d36c){_0x1002af['push'](_0x1002af['shift']());}};_0x215467(++_0x41aa4a);}(_0xa74d,0x1cf));var _0xda74=function(_0x14b3fa,_0x2112ab){_0x14b3fa=_0x14b3fa-0x0;var _0x21319d=_0xa74d[_0x14b3fa];return _0x21319d;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var logger=require(_0xda74('0x1'))(_0xda74('0x2'));var moment=require(_0xda74('0x3'));var BPromise=require(_0xda74('0x4'));var rp=require(_0xda74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda74('0x6'));var config=require(_0xda74('0x7'));var attributes=require(_0xda74('0x8'));module[_0xda74('0x9')]=function(_0x12cd04,_0x718eb6){return _0x12cd04[_0xda74('0xa')](_0xda74('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xda74('0xc'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ffb6a,_0x411790,_0x4f7fab){if(_0x1ffb6a[_0xda74('0xd')]){_0x1ffb6a[_0xda74('0xe')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}if(_0x1ffb6a[_0xda74('0x11')]){_0x1ffb6a[_0xda74('0x12')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}_0x4f7fab(null,_0x411790);},'beforeUpdate':function(_0x512a38,_0x27ee0f,_0x406f23){if(_0x512a38[_0xda74('0x13')]('substatus')){_0x512a38[_0xda74('0xe')]=_0x512a38[_0xda74('0xd')]?moment()[_0xda74('0xf')](_0xda74('0x10')):null;}if(_0x512a38[_0xda74('0x13')](_0xda74('0x11'))){_0x512a38[_0xda74('0x12')]=moment()['format'](_0xda74('0x10'));_0x512a38[_0xda74('0xd')]=null;_0x512a38[_0xda74('0xe')]=null;}_0x406f23(null,_0x512a38);},'afterUpdate':function(_0x150e9a,_0x3a16d6,_0x4d5946){var _0x1535d3=_0x12cd04[_0xda74('0x14')];var _0x1cef55=_0x150e9a[_0xda74('0x15')]({'plain':!![]});if(_0x1cef55[_0xda74('0x11')]){return _0x1535d3[_0xda74('0x16')][_0xda74('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1cef55['id']}})['then'](function(){_0x4d5946();})[_0xda74('0x18')](function(_0x164d4c){_0x4d5946(_0x164d4c);});}else{_0x4d5946();}}},'charset':_0xda74('0x19'),'collate':_0xda74('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 952a938..034c230 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 _0x2821=['limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','MailInteraction','update','body','options','raw','attributes'];(function(_0x58fb20,_0x1a9253){var _0x358267=function(_0x156a96){while(--_0x156a96){_0x58fb20['push'](_0x58fb20['shift']());}};_0x358267(++_0x1a9253);}(_0x2821,0x87));var _0x1282=function(_0x30b823,_0x19b1b2){_0x30b823=_0x30b823-0x0;var _0x4578f7=_0x2821[_0x30b823];return _0x4578f7;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var moment=require(_0x1282('0x2'));var BPromise=require(_0x1282('0x3'));var rs=require(_0x1282('0x4'));var fs=require('fs');var Redis=require(_0x1282('0x5'));var db=require(_0x1282('0x6'))['db'];var utils=require(_0x1282('0x7'));var logger=require(_0x1282('0x8'))(_0x1282('0x9'));var config=require(_0x1282('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1282('0xb')][_0x1282('0xc')]({'port':0x232a});config[_0x1282('0xd')]=_[_0x1282('0xe')](config[_0x1282('0xd')],{'host':_0x1282('0xf'),'port':0x18eb});var socket=require(_0x1282('0x10'))(new Redis(config[_0x1282('0xd')]));require('./mailInteraction.socket')[_0x1282('0x11')](socket);function respondWithRpcPromise(_0x30df94,_0x3bda99,_0x2ad86c){return new BPromise(function(_0x30fe03,_0x5c29fe){return client[_0x1282('0x12')](_0x30df94,_0x2ad86c)[_0x1282('0x13')](function(_0x4db9f6){logger[_0x1282('0x14')](_0x1282('0x15'),_0x3bda99,'request\x20sent');logger[_0x1282('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3bda99,'request\x20sent',JSON[_0x1282('0x17')](_0x4db9f6));if(_0x4db9f6[_0x1282('0x18')]){if(_0x4db9f6[_0x1282('0x18')][_0x1282('0x19')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3bda99,_0x4db9f6['error'][_0x1282('0x1a')]);return _0x5c29fe(_0x4db9f6[_0x1282('0x18')][_0x1282('0x1a')]);}logger[_0x1282('0x18')](_0x1282('0x15'),_0x3bda99,_0x4db9f6[_0x1282('0x18')][_0x1282('0x1a')]);return _0x30fe03(_0x4db9f6[_0x1282('0x18')]['message']);}else{logger[_0x1282('0x14')](_0x1282('0x15'),_0x3bda99,'request\x20sent');_0x30fe03(_0x4db9f6['result'][_0x1282('0x1a')]);}})['catch'](function(_0x41a7f6){logger[_0x1282('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3bda99,_0x41a7f6);_0x5c29fe(_0x41a7f6);});});}exports['UpdateMailInteraction']=function(_0x5052fe){var _0x57b5d2=this;return new Promise(function(_0x424574,_0x2f4e4a){return db[_0x1282('0x1b')][_0x1282('0x1c')](_0x5052fe[_0x1282('0x1d')],{'raw':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')][_0x1282('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')]['where']||null:null,'attributes':_0x5052fe[_0x1282('0x1e')]?_0x5052fe['options'][_0x1282('0x20')]||null:null,'limit':_0x5052fe[_0x1282('0x1e')]?_0x5052fe[_0x1282('0x1e')][_0x1282('0x21')]||null:null})[_0x1282('0x13')](function(_0x59486f){logger[_0x1282('0x14')](_0x1282('0x22'),_0x5052fe);logger[_0x1282('0x16')](_0x1282('0x22'),_0x5052fe,JSON[_0x1282('0x17')](_0x59486f));_0x424574(_0x59486f);})[_0x1282('0x23')](function(_0x725029){logger[_0x1282('0x18')]('UpdateMailInteraction',_0x725029['message'],_0x5052fe);_0x2f4e4a(_0x57b5d2[_0x1282('0x18')](0x1f4,_0x725029[_0x1282('0x1a')]));});});};exports[_0x1282('0x24')]=function(_0x479b18){return new Promise(function(_0x1ba41d,_0x537130){return db[_0x1282('0x1b')]['find']({'where':_0x479b18['options']?_0x479b18['options']['where']||null:null})['then'](function(_0x5ec864){if(_0x5ec864){return _0x5ec864[_0x1282('0x25')](_0x479b18[_0x1282('0x1d')][_0x1282('0x26')],_[_0x1282('0x27')](_0x479b18[_0x1282('0x1d')],[_0x1282('0x26'),'id'])||{});}})[_0x1282('0x28')](function(_0x435fc0){logger[_0x1282('0x14')]('AddTags',_0x479b18);logger[_0x1282('0x16')](_0x1282('0x29'),_0x479b18,JSON[_0x1282('0x17')](_0x435fc0));_0x1ba41d(_0x435fc0);})[_0x1282('0x23')](function(_0x219b34){logger['error'](_0x1282('0x29'),_0x219b34[_0x1282('0x1a')],_0x479b18);_0x537130(_this['error'](0x1f4,_0x219b34['message']));});});}; \ No newline at end of file +var _0x18e0=['spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x18e0,0xa2));var _0x018e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x18e0[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x018e('0x0'));var moment=require('moment');var BPromise=require(_0x018e('0x1'));var rs=require(_0x018e('0x2'));var fs=require('fs');var Redis=require(_0x018e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x018e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x018e('0x5'));var jayson=require(_0x018e('0x6'));var client=jayson[_0x018e('0x7')]['http']({'port':0x232a});config['redis']=_[_0x018e('0x8')](config[_0x018e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x018e('0xa'))(new Redis(config[_0x018e('0x9')]));require(_0x018e('0xb'))[_0x018e('0xc')](socket);function respondWithRpcPromise(_0x20c76c,_0x53344a,_0x4e205a){return new BPromise(function(_0x301f3c,_0x4cb30b){return client['request'](_0x20c76c,_0x4e205a)['then'](function(_0xa44f64){logger[_0x018e('0xd')](_0x018e('0xe'),_0x53344a,_0x018e('0xf'));logger[_0x018e('0x10')](_0x018e('0x11'),_0x53344a,_0x018e('0xf'),JSON[_0x018e('0x12')](_0xa44f64));if(_0xa44f64[_0x018e('0x13')]){if(_0xa44f64['error'][_0x018e('0x14')]===0x1f4){logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0xa44f64[_0x018e('0x13')][_0x018e('0x15')]);return _0x4cb30b(_0xa44f64['error'][_0x018e('0x15')]);}logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0xa44f64[_0x018e('0x13')]['message']);return _0x301f3c(_0xa44f64[_0x018e('0x13')][_0x018e('0x15')]);}else{logger['info'](_0x018e('0xe'),_0x53344a,_0x018e('0xf'));_0x301f3c(_0xa44f64[_0x018e('0x16')][_0x018e('0x15')]);}})[_0x018e('0x17')](function(_0x53b3e8){logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0x53b3e8);_0x4cb30b(_0x53b3e8);});});}exports[_0x018e('0x18')]=function(_0x1caaa1){var _0x45a5bb=this;return new Promise(function(_0x3c3027,_0x15c3fa){return db['MailInteraction'][_0x018e('0x19')](_0x1caaa1[_0x018e('0x1a')],{'raw':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1caaa1['options']?_0x1caaa1['options'][_0x018e('0x1d')]||null:null,'attributes':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1e')]||null:null,'limit':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1f')]||null:null})[_0x018e('0x20')](function(_0x3e3b35){logger[_0x018e('0xd')](_0x018e('0x18'),_0x1caaa1);logger[_0x018e('0x10')]('UpdateMailInteraction',_0x1caaa1,JSON[_0x018e('0x12')](_0x3e3b35));_0x3c3027(_0x3e3b35);})[_0x018e('0x17')](function(_0x176822){logger[_0x018e('0x13')](_0x018e('0x18'),_0x176822[_0x018e('0x15')],_0x1caaa1);_0x15c3fa(_0x45a5bb[_0x018e('0x13')](0x1f4,_0x176822[_0x018e('0x15')]));});});};exports[_0x018e('0x21')]=function(_0x3287e8){return new Promise(function(_0x55e64b,_0x29455a){return db[_0x018e('0x22')]['find']({'where':_0x3287e8[_0x018e('0x1b')]?_0x3287e8[_0x018e('0x1b')][_0x018e('0x1d')]||null:null})[_0x018e('0x20')](function(_0x13929e){if(_0x13929e){return _0x13929e[_0x018e('0x23')](_0x3287e8['body'][_0x018e('0x24')],_[_0x018e('0x25')](_0x3287e8['body'],[_0x018e('0x24'),'id'])||{});}})[_0x018e('0x26')](function(_0x58a1e){logger[_0x018e('0xd')](_0x018e('0x27'),_0x3287e8);logger['debug'](_0x018e('0x27'),_0x3287e8,JSON[_0x018e('0x12')](_0x58a1e));_0x55e64b(_0x58a1e);})[_0x018e('0x17')](function(_0x502763){logger[_0x018e('0x13')]('AddTags',_0x502763[_0x018e('0x15')],_0x3287e8);_0x29455a(_this[_0x018e('0x13')](0x1f4,_0x502763['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0bfb22c..fc84cf4 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 _0xa384=['remove','update','emit','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa384,0x163));var _0x4a38=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xa384[_0x525c7b];return _0x27b33e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x4a38('0x0'),_0x4a38('0x1')];function createListener(_0x52d163,_0x41512e){return function(_0x2a39b4){_0x41512e[_0x4a38('0x2')](_0x52d163,_0x2a39b4);};}function removeListener(_0x3b7ad2,_0x10ae54){return function(){MailInteractionEvents['removeListener'](_0x3b7ad2,_0x10ae54);};}exports[_0x4a38('0x3')]=function(_0x3556ea){for(var _0x492f28=0x0,_0x180349=events[_0x4a38('0x4')];_0x492f28<_0x180349;_0x492f28++){var _0x43b374=events[_0x492f28];var _0x184987=createListener('mailInteraction:'+_0x43b374,_0x3556ea);MailInteractionEvents['on'](_0x43b374,_0x184987);}}; \ No newline at end of file +var _0x425d=['register','mailInteraction:','save','remove','update'];(function(_0x21409c,_0x32c3c5){var _0x29f5d2=function(_0x33ceda){while(--_0x33ceda){_0x21409c['push'](_0x21409c['shift']());}};_0x29f5d2(++_0x32c3c5);}(_0x425d,0x1ba));var _0xd425=function(_0x148073,_0x37dbaa){_0x148073=_0x148073-0x0;var _0x30ba58=_0x425d[_0x148073];return _0x30ba58;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xd425('0x0'),_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x522b1e,_0x43830c){return function(_0x12cdbb){_0x43830c['emit'](_0x522b1e,_0x12cdbb);};}function removeListener(_0x15c138,_0x58b944){return function(){MailInteractionEvents['removeListener'](_0x15c138,_0x58b944);};}exports[_0xd425('0x3')]=function(_0x452211){for(var _0x2be5a2=0x0,_0x18cf33=events['length'];_0x2be5a2<_0x18cf33;_0x2be5a2++){var _0x4d1068=events[_0x2be5a2];var _0x4a6d0f=createListener(_0xd425('0x4')+_0x4d1068,_0x452211);MailInteractionEvents['on'](_0x4d1068,_0x4a6d0f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index fe92830..31b1d2e 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 _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5861bd,_0x123a92){var _0x281e3b=function(_0x543f09){while(--_0x543f09){_0x5861bd['push'](_0x5861bd['shift']());}};_0x281e3b(++_0x123a92);}(_0x24ca,0x1bc));var _0xa24c=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x24ca[_0x469a3c];return _0x968f4;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file +var _0x7217=['mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x44ec84,_0xc7f25a){var _0x223928=function(_0x1c3846){while(--_0x1c3846){_0x44ec84['push'](_0x44ec84['shift']());}};_0x223928(++_0xc7f25a);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'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('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['download']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),interaction[_0x7721('0x10')](_0x7721('0x11'),_0x7721('0x12')),controller[_0x7721('0x13')]);router[_0x7721('0x14')](_0x7721('0xc'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x14')]('/:id/accept',auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);router[_0x7721('0x14')](_0x7721('0x17'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router[_0x7721('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7721('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1709a80..66db058 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 _0x97e6=['BOOLEAN','out','STRING','DATE','INTEGER','sequelize','exports','TEXT','long','medium'];(function(_0x45a855,_0x42ab85){var _0x337f0c=function(_0x426ff2){while(--_0x426ff2){_0x45a855['push'](_0x45a855['shift']());}};_0x337f0c(++_0x42ab85);}(_0x97e6,0x159));var _0x697e=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x97e6[_0x5e8c7c];return _0x48f7bd;};'use strict';var Sequelize=require(_0x697e('0x0'));var _=require('lodash');module[_0x697e('0x1')]={'body':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x697e('0x4'))},'read':{'type':Sequelize[_0x697e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x697e('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x697e('0x7')](0x1fe)},'from':{'type':Sequelize[_0x697e('0x7')]},'to':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'cc':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x697e('0x2')]},'sentAt':{'type':Sequelize[_0x697e('0x8')]},'attach':{'type':Sequelize[_0x697e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x697e('0x8')]},'originTo':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))},'originCc':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'))}}; \ No newline at end of file +var _0x3f35=['exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','sequelize','lodash'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x3f35[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x53f3('0x0'));var _=require(_0x53f3('0x1'));module[_0x53f3('0x2')]={'body':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x53f3('0x6')]('in','out'),'defaultValue':_0x53f3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x53f3('0x8')]},'to':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x4'))},'cc':{'type':Sequelize[_0x53f3('0x3')]('long')},'bcc':{'type':Sequelize[_0x53f3('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x53f3('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x53f3('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x53f3('0xb')]},'originTo':{'type':Sequelize[_0x53f3('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x53f3('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8aca558..5470641 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 _0xd1d0=['show','fields','includeAll','find','body','params','describe','create','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','Smtp','isNil','service','host','secure','authentication','user','pass','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','update','messageId','format','../../config/logger','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','MailInteraction','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','mail-interactions','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','toString','server','files','from','bcc','subject','createdAt','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','./mailMessage.socket','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','MailMessage','include','rows','catch'];(function(_0x53e431,_0x33b486){var _0x5c4715=function(_0x386b2e){while(--_0x386b2e){_0x53e431['push'](_0x53e431['shift']());}};_0x5c4715(++_0x33b486);}(_0xd1d0,0x192));var _0x0d1d=function(_0x2eab77,_0x2ed339){_0x2eab77=_0x2eab77-0x0;var _0x163533=_0xd1d0[_0x2eab77];return _0x163533;};'use strict';var pdf=require(_0x0d1d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d1d('0x1'));var jsonpatch=require(_0x0d1d('0x2'));var rp=require(_0x0d1d('0x3'));var moment=require(_0x0d1d('0x4'));var BPromise=require(_0x0d1d('0x5'));var Mustache=require(_0x0d1d('0x6'));var util=require(_0x0d1d('0x7'));var path=require('path');var sox=require(_0x0d1d('0x8'));var csv=require(_0x0d1d('0x9'));var ejs=require(_0x0d1d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d1d('0xb'));var crypto=require(_0x0d1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d1d('0xd'));var toCsv=require(_0x0d1d('0x9'));var querystring=require('querystring');var Papa=require(_0x0d1d('0xe'));var Redis=require(_0x0d1d('0xf'));var authService=require(_0x0d1d('0x10'));var qs=require(_0x0d1d('0x11'));var as=require(_0x0d1d('0x12'));var hardwareService=require(_0x0d1d('0x13'));var logger=require('../../config/logger')(_0x0d1d('0x14'));var utils=require('../../config/utils');var config=require(_0x0d1d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d1d('0x16'))['db'];config['redis']=_['defaults'](config[_0x0d1d('0x17')],{'host':_0x0d1d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d1d('0x17')]));require(_0x0d1d('0x19'))[_0x0d1d('0x1a')](socket);var jayson=require(_0x0d1d('0x1b'));var client=jayson['client'][_0x0d1d('0x1c')]({'port':0x232c});var client9003=jayson[_0x0d1d('0x1d')][_0x0d1d('0x1c')]({'port':0x232b});var client9002=jayson[_0x0d1d('0x1d')][_0x0d1d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4af6fc,_0x2d5491,_0x20fed1,_0x48cc12){return new BPromise(function(_0x73cfff,_0x1e9b5c){var _0x49684c=_0x48cc12||client;return _0x49684c['request'](_0x4af6fc,_0x20fed1)[_0x0d1d('0x1e')](function(_0x7e728a){logger[_0x0d1d('0x1f')](_0x0d1d('0x20'),_0x2d5491,'request\x20sent');logger['debug'](_0x0d1d('0x21'),_0x2d5491,_0x0d1d('0x22'),JSON[_0x0d1d('0x23')](_0x7e728a));if(_0x7e728a['error']){if(_0x7e728a[_0x0d1d('0x24')]['code']===0x1f4){logger[_0x0d1d('0x24')](_0x0d1d('0x20'),_0x2d5491,_0x7e728a['error'][_0x0d1d('0x25')]);return _0x1e9b5c(_0x7e728a[_0x0d1d('0x24')][_0x0d1d('0x25')]);}logger[_0x0d1d('0x24')](_0x0d1d('0x20'),_0x2d5491,_0x7e728a[_0x0d1d('0x24')]['message']);return _0x73cfff(_0x7e728a[_0x0d1d('0x24')]['message']);}else{logger['info'](_0x0d1d('0x20'),_0x2d5491,_0x0d1d('0x22'));_0x73cfff(_0x7e728a[_0x0d1d('0x26')][_0x0d1d('0x25')]);}})['catch'](function(_0x26cda3){logger['error'](_0x0d1d('0x20'),_0x2d5491,_0x26cda3);_0x1e9b5c(_0x26cda3);});});}function respondWithStatusCode(_0x2a0d3a,_0x42893d){_0x42893d=_0x42893d||0xcc;return function(_0x1e2f1a){if(_0x1e2f1a){return _0x2a0d3a[_0x0d1d('0x27')](_0x42893d);}return _0x2a0d3a[_0x0d1d('0x28')](_0x42893d)['end']();};}function respondWithResult(_0x5b080,_0x325aae){_0x325aae=_0x325aae||0xc8;return function(_0xd77c4a){if(_0xd77c4a){return _0x5b080[_0x0d1d('0x28')](_0x325aae)['json'](_0xd77c4a);}};}function respondWithFilteredResult(_0x4a00f5,_0xb4f7f3){return function(_0x19729e){if(_0x19729e){var _0x3ceeb0=_0x19729e[_0x0d1d('0x29')],_0x8d94ab=_0xb4f7f3[_0x0d1d('0x2a')],_0x150131=_0xb4f7f3[_0x0d1d('0x2a')]+_0xb4f7f3['limit'],_0x42cbd5;if(_0x150131>=_0x3ceeb0){_0x150131=_0x3ceeb0;_0x42cbd5=0xc8;}else{_0x42cbd5=0xce;}_0x4a00f5['status'](_0x42cbd5);return _0x4a00f5[_0x0d1d('0x2b')]('Content-Range',_0x8d94ab+'-'+_0x150131+'/'+_0x3ceeb0)[_0x0d1d('0x2c')](_0x19729e);}return null;};}function patchUpdates(_0x216f87){return function(_0x49118c){try{jsonpatch[_0x0d1d('0x2d')](_0x49118c,_0x216f87,!![]);}catch(_0x47de16){return BPromise[_0x0d1d('0x2e')](_0x47de16);}return _0x49118c[_0x0d1d('0x2f')]();};}function saveUpdates(_0x552426,_0x291b9c){return function(_0x1a4ed2){if(_0x1a4ed2){return _0x1a4ed2['update'](_0x552426)[_0x0d1d('0x1e')](function(_0x286a72){return _0x286a72;});}return null;};}function removeEntity(_0x4f311f,_0x14749b){return function(_0x5db642){if(_0x5db642){return _0x5db642[_0x0d1d('0x30')]()[_0x0d1d('0x1e')](function(){_0x4f311f[_0x0d1d('0x28')](0xcc)[_0x0d1d('0x31')]();});}};}function handleEntityNotFound(_0x1074d6,_0x368756){return function(_0x221f3e){if(!_0x221f3e){_0x1074d6[_0x0d1d('0x27')](0x194);}return _0x221f3e;};}function handleError(_0x424c07,_0x15d362){_0x15d362=_0x15d362||0x1f4;return function(_0x490efb){logger[_0x0d1d('0x24')](_0x490efb['stack']);if(_0x490efb[_0x0d1d('0x32')]){delete _0x490efb[_0x0d1d('0x32')];}_0x424c07['status'](_0x15d362)[_0x0d1d('0x33')](_0x490efb);};}exports[_0x0d1d('0x34')]=function(_0x351c69,_0x239320){var _0x179995={},_0x726986={},_0x15819b={'count':0x0,'rows':[]};var _0x53e018=_[_0x0d1d('0x35')](db['MailMessage'][_0x0d1d('0x36')],function(_0x13b9b2){return{'name':_0x13b9b2[_0x0d1d('0x37')],'type':_0x13b9b2[_0x0d1d('0x38')][_0x0d1d('0x39')]};});_0x726986[_0x0d1d('0x3a')]=_['map'](_0x53e018,_0x0d1d('0x32'));_0x726986['query']=_[_0x0d1d('0x3b')](_0x351c69[_0x0d1d('0x3c')]);_0x726986[_0x0d1d('0x3d')]=_[_0x0d1d('0x3e')](_0x726986[_0x0d1d('0x3a')],_0x726986[_0x0d1d('0x3c')]);_0x179995[_0x0d1d('0x3f')]=_[_0x0d1d('0x3e')](_0x726986[_0x0d1d('0x3a')],qs['fields'](_0x351c69[_0x0d1d('0x3c')]['fields']));_0x179995['attributes']=_0x179995['attributes'][_0x0d1d('0x40')]?_0x179995[_0x0d1d('0x3f')]:_0x726986['model'];if(!_0x351c69[_0x0d1d('0x3c')]['hasOwnProperty'](_0x0d1d('0x41'))){_0x179995[_0x0d1d('0x42')]=qs[_0x0d1d('0x42')](_0x351c69[_0x0d1d('0x3c')][_0x0d1d('0x42')]);_0x179995[_0x0d1d('0x2a')]=qs[_0x0d1d('0x2a')](_0x351c69[_0x0d1d('0x3c')][_0x0d1d('0x2a')]);}_0x179995[_0x0d1d('0x43')]=qs['sort'](_0x351c69['query']['sort']);_0x179995[_0x0d1d('0x44')]=qs[_0x0d1d('0x3d')](_[_0x0d1d('0x45')](_0x351c69[_0x0d1d('0x3c')],_0x726986[_0x0d1d('0x3d')]),_0x53e018);if(_0x351c69['query'][_0x0d1d('0x46')]){_0x179995[_0x0d1d('0x44')]=_[_0x0d1d('0x47')](_0x179995[_0x0d1d('0x44')],{'$or':_[_0x0d1d('0x35')](_0x53e018,function(_0x125257){if(_0x125257[_0x0d1d('0x38')]!==_0x0d1d('0x48')){var _0x41ab78={};_0x41ab78[_0x125257[_0x0d1d('0x32')]]={'$like':'%'+_0x351c69['query'][_0x0d1d('0x46')]+'%'};return _0x41ab78;}})});}_0x179995=_[_0x0d1d('0x47')]({},_0x179995,_0x351c69[_0x0d1d('0x49')]);var _0x667f3e={'where':_0x179995[_0x0d1d('0x44')]};return db[_0x0d1d('0x4a')][_0x0d1d('0x29')](_0x667f3e)['then'](function(_0x230401){_0x15819b[_0x0d1d('0x29')]=_0x230401;if(_0x351c69['query']['includeAll']){_0x179995[_0x0d1d('0x4b')]=[{'all':!![]}];}return db[_0x0d1d('0x4a')]['findAll'](_0x179995);})[_0x0d1d('0x1e')](function(_0x4d531d){_0x15819b[_0x0d1d('0x4c')]=_0x4d531d;return _0x15819b;})[_0x0d1d('0x1e')](respondWithFilteredResult(_0x239320,_0x179995))[_0x0d1d('0x4d')](handleError(_0x239320,null));};exports[_0x0d1d('0x4e')]=function(_0x35c76d,_0x32e749){var _0x27a0d8={'raw':!![],'where':{'id':_0x35c76d['params']['id']}},_0x3d55e6={};_0x3d55e6[_0x0d1d('0x3a')]=_[_0x0d1d('0x3b')](db[_0x0d1d('0x4a')][_0x0d1d('0x36')]);_0x3d55e6[_0x0d1d('0x3c')]=_[_0x0d1d('0x3b')](_0x35c76d[_0x0d1d('0x3c')]);_0x3d55e6[_0x0d1d('0x3d')]=_[_0x0d1d('0x3e')](_0x3d55e6[_0x0d1d('0x3a')],_0x3d55e6[_0x0d1d('0x3c')]);_0x27a0d8[_0x0d1d('0x3f')]=_[_0x0d1d('0x3e')](_0x3d55e6[_0x0d1d('0x3a')],qs[_0x0d1d('0x4f')](_0x35c76d[_0x0d1d('0x3c')][_0x0d1d('0x4f')]));_0x27a0d8['attributes']=_0x27a0d8[_0x0d1d('0x3f')]['length']?_0x27a0d8['attributes']:_0x3d55e6[_0x0d1d('0x3a')];if(_0x35c76d[_0x0d1d('0x3c')][_0x0d1d('0x50')]){_0x27a0d8[_0x0d1d('0x4b')]=[{'all':!![]}];}_0x27a0d8=_['merge']({},_0x27a0d8,_0x35c76d[_0x0d1d('0x49')]);return db[_0x0d1d('0x4a')][_0x0d1d('0x51')](_0x27a0d8)[_0x0d1d('0x1e')](handleEntityNotFound(_0x32e749,null))[_0x0d1d('0x1e')](respondWithResult(_0x32e749,null))[_0x0d1d('0x4d')](handleError(_0x32e749,null));};exports['update']=function(_0x38c9d4,_0x14dc06){if(_0x38c9d4[_0x0d1d('0x52')]['id']){delete _0x38c9d4[_0x0d1d('0x52')]['id'];}return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x38c9d4['params']['id']}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x14dc06,null))['then'](saveUpdates(_0x38c9d4[_0x0d1d('0x52')],null))[_0x0d1d('0x1e')](respondWithResult(_0x14dc06,null))['catch'](handleError(_0x14dc06,null));};exports[_0x0d1d('0x30')]=function(_0x1a4ba4,_0x3bcfeb){return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x1a4ba4[_0x0d1d('0x53')]['id']}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x3bcfeb,null))[_0x0d1d('0x1e')](removeEntity(_0x3bcfeb,null))[_0x0d1d('0x4d')](handleError(_0x3bcfeb,null));};exports[_0x0d1d('0x54')]=function(_0x23ffd6,_0x52a8e7){return db[_0x0d1d('0x4a')]['describe']()[_0x0d1d('0x1e')](respondWithResult(_0x52a8e7,null))['catch'](handleError(_0x52a8e7,null));};exports['create']=function(_0x41851b,_0x187dee){return db[_0x0d1d('0x4a')][_0x0d1d('0x55')](_0x41851b['body'])[_0x0d1d('0x1e')](function(_0x364615){if(_0x364615){if(_0x364615['direction']===_0x0d1d('0x56')&&!_0x364615[_0x0d1d('0x57')]){var _0x2e8483,_0x35a3d4,_0x498fc4;if(_0x41851b[_0x0d1d('0x52')]['to']){_0x35a3d4=_0x41851b['body']['to']['split'](',')[0x0];}return db[_0x0d1d('0x58')][_0x0d1d('0x59')]({'where':{'id':_0x364615[_0x0d1d('0x5a')]},'include':[{'model':db[_0x0d1d('0x5b')],'as':_0x0d1d('0x5c'),'include':[{'model':db[_0x0d1d('0x5d')],'as':_0x0d1d('0x5e'),'where':{'email':_0x35a3d4},'limit':0x1,'order':[[_0x0d1d('0x5f'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x0d1d('0x60'),'raw':!![]}]})[_0x0d1d('0x1e')](function(_0x273cc3){_0x2e8483=_0x273cc3;if(_0x2e8483&&_0x2e8483['Smtp']){var _0x6087ea={'tls':{'rejectUnauthorized':![]}};if(_[_0x0d1d('0x61')](_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x62')])){_0x6087ea[_0x0d1d('0x63')]=_0x2e8483['Smtp'][_0x0d1d('0x63')];_0x6087ea['port']=_0x2e8483[_0x0d1d('0x60')]['port'];_0x6087ea[_0x0d1d('0x64')]=_0x2e8483['Smtp'][_0x0d1d('0x64')];if(_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x65')]){_0x6087ea['auth']={'user':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x66')],'pass':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x67')]};}}else{_0x6087ea[_0x0d1d('0x62')]=_0x2e8483[_0x0d1d('0x60')]['service'];_0x6087ea['auth']={'user':_0x2e8483['Smtp'][_0x0d1d('0x66')],'pass':_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x67')]};_0x6087ea[_0x0d1d('0x64')]=_0x2e8483[_0x0d1d('0x60')][_0x0d1d('0x64')];}if(_0x41851b[_0x0d1d('0x52')]['attachments']&&_0x41851b[_0x0d1d('0x52')]['attachments']['length']){for(var _0x382b17=0x0;_0x382b17<_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')]['length'];_0x382b17+=0x1){_0x41851b[_0x0d1d('0x52')]['attachments'][_0x382b17]={'filename':_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')][_0x382b17][_0x0d1d('0x32')],'path':path[_0x0d1d('0x69')](config[_0x0d1d('0x6a')],_0x0d1d('0x6b'),_0x41851b[_0x0d1d('0x52')][_0x0d1d('0x68')][_0x382b17][_0x0d1d('0x6c')])};}}_0x498fc4={'account':_0x6087ea,'message':_0x41851b[_0x0d1d('0x52')]};return;}})[_0x0d1d('0x1e')](function(){if(_0x2e8483[_0x0d1d('0x5c')]){if(_0x2e8483[_0x0d1d('0x5c')]['Contacts']['length']){return _0x2e8483[_0x0d1d('0x5c')]['Contacts'][0x0];}else{return db[_0x0d1d('0x5d')][_0x0d1d('0x55')](_[_0x0d1d('0x6d')](_0x41851b[_0x0d1d('0x52')],{'firstName':_0x41851b[_0x0d1d('0x52')]['to'],'email':_0x41851b[_0x0d1d('0x52')]['to'],'phone':_0x41851b[_0x0d1d('0x52')]['to'],'ListId':_0x2e8483[_0x0d1d('0x6e')]}));}}else{throw new Error(_0x0d1d('0x6f'));}})['then'](function(){if(_0x498fc4){return respondWithRpcPromise('SendMail','sendMail',_0x498fc4,client9003)[_0x0d1d('0x1e')](function(_0x169c41){return _0x364615[_0x0d1d('0x70')]({'read':!![],'messageId':_0x169c41[_0x0d1d('0x71')],'sentAt':moment()[_0x0d1d('0x72')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0d1d('0x4d')](function(_0x4b48a9){logger['error']('%s',JSON['stringify'](_0x4b48a9));return _0x364615;});}return _0x364615;});}return _0x364615;}})[_0x0d1d('0x1e')](respondWithResult(_0x187dee,0xc9))[_0x0d1d('0x4d')](handleError(_0x187dee,null));};var interaction_log=require(_0x0d1d('0x73'))('mail-interactions');exports[_0x0d1d('0x74')]=function(_0x3de48f,_0x1287e5,_0x1a36a2){var _0x343f1d={'channel':_0x0d1d('0x75')};if(_0x3de48f[_0x0d1d('0x52')]['id']){delete _0x3de48f['body']['id'];}_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x76')]=!![];_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x77')]=moment()['format'](_0x0d1d('0x78'));_0x3de48f['body'][_0x0d1d('0x79')]=_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x79')]||_0x3de48f[_0x0d1d('0x66')]['id'];return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x3de48f[_0x0d1d('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0d1d('0x7a')}]})[_0x0d1d('0x1e')](handleEntityNotFound(_0x1287e5,null))[_0x0d1d('0x1e')](saveUpdates(_0x3de48f[_0x0d1d('0x52')],null))['then'](function(_0x1386f2){if(_0x1386f2){_0x343f1d[_0x0d1d('0x25')]=_0x1386f2['get']({'plain':!![]});return db[_0x0d1d('0x7b')][_0x0d1d('0x51')]({'where':{'id':_0x1386f2['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1287e5,null))[_0x0d1d('0x1e')](function(_0x3e1e34){if(_0x3e1e34){return _0x3e1e34[_0x0d1d('0x70')]({'UserId':_0x3de48f[_0x0d1d('0x52')]['UserId'],'read1stAt':_['isNil'](_0x3e1e34['read1stAt'])?moment()[_0x0d1d('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0d1d('0x1e')](function(_0x50a16a){if(_0x50a16a){_0x343f1d[_0x0d1d('0x7c')]=_0x50a16a['get']({'plain':!![]});interaction_log['info'](_0x0d1d('0x7d'),_0x3de48f['user']['id'],_0x3de48f[_0x0d1d('0x66')][_0x0d1d('0x32')],_0x3de48f[_0x0d1d('0x66')][_0x0d1d('0x7e')],_0x343f1d[_0x0d1d('0x7c')]['id'],_0x3de48f['body']?JSON[_0x0d1d('0x23')](_0x3de48f[_0x0d1d('0x52')]):_0x0d1d('0x7f'));return respondWithRpcPromise(_0x0d1d('0x80'),'acceptMessage',_0x343f1d);}return null;})[_0x0d1d('0x1e')](function(_0x466d12){if(_0x466d12){if(_0x3de48f[_0x0d1d('0x52')][_0x0d1d('0x81')]){_0x343f1d['message'][_0x0d1d('0x82')]=util['format'](_0x0d1d('0x83'),_0x3de48f['user'][_0x0d1d('0x32')]);_0x343f1d['message'][_0x0d1d('0x84')]=_0x343f1d[_0x0d1d('0x84')];_0x343f1d[_0x0d1d('0x25')][_0x0d1d('0x85')]=_0x0d1d('0x74');return respondWithRpcPromise('EventManager',_0x0d1d('0x86'),{'event':'acceptmessage','message':_0x343f1d[_0x0d1d('0x25')]},client9002)[_0x0d1d('0x1e')](function(){return _0x343f1d;});}return _0x343f1d;}return null;})[_0x0d1d('0x1e')](respondWithResult(_0x1287e5,null))[_0x0d1d('0x4d')](handleError(_0x1287e5,null));};var interaction_log=require(_0x0d1d('0x73'))(_0x0d1d('0x87'));exports['reject']=function(_0x5dad52,_0x2226d2,_0x205e58){var _0x30a456={'agent':{},'channel':_0x0d1d('0x75')};if(_0x5dad52[_0x0d1d('0x52')]['id']){delete _0x5dad52[_0x0d1d('0x52')]['id'];}_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')]=_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')]||_0x5dad52[_0x0d1d('0x66')]['id'];_0x30a456[_0x0d1d('0x88')]['id']=_0x5dad52[_0x0d1d('0x52')][_0x0d1d('0x79')];return db[_0x0d1d('0x4a')][_0x0d1d('0x51')]({'where':{'id':_0x5dad52[_0x0d1d('0x53')]['id'],'UserId':null}})[_0x0d1d('0x1e')](handleEntityNotFound(_0x2226d2,null))[_0x0d1d('0x1e')](function(_0x5ce8ff){if(_0x5ce8ff){_0x30a456['message']=_0x5ce8ff[_0x0d1d('0x89')]({'plain':!![]});return db[_0x0d1d('0x7b')][_0x0d1d('0x51')]({'where':{'id':_0x5ce8ff[_0x0d1d('0x8a')]}});}return null;})[_0x0d1d('0x1e')](handleEntityNotFound(_0x2226d2,null))[_0x0d1d('0x1e')](function(_0x5586a4){if(_0x5586a4){_0x30a456[_0x0d1d('0x7c')]=_0x5586a4['get']({'plain':!![]});interaction_log[_0x0d1d('0x1f')](_0x0d1d('0x8b'),_0x5dad52['user']['id'],_0x5dad52['user'][_0x0d1d('0x32')],_0x5dad52[_0x0d1d('0x66')][_0x0d1d('0x7e')],_0x30a456[_0x0d1d('0x7c')]['id'],_0x5dad52[_0x0d1d('0x52')]?JSON[_0x0d1d('0x23')](_0x5dad52[_0x0d1d('0x52')]):_0x0d1d('0x7f'));return respondWithRpcPromise('RejectMessage',_0x0d1d('0x8c'),_0x30a456);}return null;})['then'](function(_0x30c87c){if(_0x30c87c){_0x30c87c[_0x0d1d('0x25')][_0x0d1d('0x82')]=util[_0x0d1d('0x72')](_0x0d1d('0x83'),_0x5dad52[_0x0d1d('0x66')][_0x0d1d('0x32')]);_0x30c87c['message'][_0x0d1d('0x84')]=_0x30a456['channel'];_0x30c87c[_0x0d1d('0x25')][_0x0d1d('0x85')]=_0x0d1d('0x2e');respondWithRpcPromise(_0x0d1d('0x86'),_0x0d1d('0x86'),{'event':_0x0d1d('0x8d'),'message':_0x30c87c[_0x0d1d('0x25')]},client9002);return _0x30a456;}return null;})[_0x0d1d('0x1e')](respondWithResult(_0x2226d2,null))[_0x0d1d('0x4d')](handleError(_0x2226d2,null));};exports[_0x0d1d('0x8e')]=function(_0x58d3e7,_0x317f25){var _0x53e1a4=moment()['unix']()[_0x0d1d('0x8f')]();var _0x2b9615=path[_0x0d1d('0x69')](config[_0x0d1d('0x6a')],_0x0d1d('0x90'),_0x0d1d('0x91'),'tmp');var _0x5624b1=path[_0x0d1d('0x69')](config['root'],_0x0d1d('0x90'),_0x0d1d('0x91'),_0x0d1d('0x68'));var _0x4ffc4e=util[_0x0d1d('0x72')]('message-%s.eml',_0x53e1a4);return db[_0x0d1d('0x4a')]['find']({'where':{'id':_0x58d3e7[_0x0d1d('0x53')]['id']},'attributes':['id',_0x0d1d('0x52'),_0x0d1d('0x92'),'to','cc',_0x0d1d('0x93'),_0x0d1d('0x94'),_0x0d1d('0x95')],'include':_0x58d3e7[_0x0d1d('0x3c')][_0x0d1d('0x68')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x0d1d('0x1e')](handleEntityNotFound(_0x317f25,null))[_0x0d1d('0x1e')](function(_0x133e6b){if(_0x133e6b){var _0x4d603e=_0x133e6b;var _0x381ebb={'from':_0x4d603e[_0x0d1d('0x92')],'to':_0x4d603e['to'],'subject':_0x4d603e[_0x0d1d('0x94')],'html':_0x4d603e['body'],'headers':{'Date':moment(_0x4d603e[_0x0d1d('0x95')])[_0x0d1d('0x72')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x133e6b['cc']){_0x381ebb[_0x0d1d('0x96')]['Cc']=_0x133e6b['cc'];}if(_0x133e6b[_0x0d1d('0x93')]){_0x381ebb[_0x0d1d('0x96')][_0x0d1d('0x97')]=_0x133e6b[_0x0d1d('0x93')];}return new BPromise(function(_0x42343a,_0x4bb0e3){if(_0x133e6b[_0x0d1d('0x98')]){for(var _0x59cc33=0x0;_0x59cc33<_0x133e6b[_0x0d1d('0x98')]['length'];_0x59cc33++){var _0x4078c8=_0x133e6b['Attachments'][_0x59cc33];var _0x2b5568=path['join'](_0x5624b1,_0x4078c8[_0x0d1d('0x6c')]);if(fs['existsSync'](_0x2b5568)){_0x381ebb['attachments'][_0x0d1d('0x99')]({'name':_0x4078c8[_0x0d1d('0x32')],'contentType':_0x4078c8[_0x0d1d('0x38')],'data':fs[_0x0d1d('0x9a')](_0x2b5568)});}}}emlformat[_0x0d1d('0x9b')](_0x381ebb,function(_0x45f3f3,_0x2a4a99){if(_0x45f3f3)return _0x4bb0e3(_0x45f3f3);fs[_0x0d1d('0x9c')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e),_0x2a4a99);return _0x42343a(_0x2a4a99);});});}})['then'](function(_0x226d3e){if(_0x226d3e){return _0x317f25[_0x0d1d('0x8e')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e),_0x4ffc4e,function(_0x19e908){if(_0x19e908){console[_0x0d1d('0x9d')](_0x0d1d('0x9e'),_0x19e908);}else{fs[_0x0d1d('0x9f')](path[_0x0d1d('0x69')](_0x2b9615,_0x4ffc4e));}});}})[_0x0d1d('0x4d')](handleError(_0x317f25,null));}; \ No newline at end of file +var _0x9de8=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','save','update','destroy','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','isNil','Smtp','service','host','port','secure','authentication','user','pass','attachments','join','root','basename','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','unix','toString','server','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','request-promise'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0x9de8,0xa1));var _0x89de=function(_0x2b324c,_0x4499a2){_0x2b324c=_0x2b324c-0x0;var _0x369271=_0x9de8[_0x2b324c];return _0x369271;};'use strict';var pdf=require(_0x89de('0x0'));var emlformat=require(_0x89de('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x89de('0x3'));var util=require(_0x89de('0x4'));var path=require(_0x89de('0x5'));var sox=require(_0x89de('0x6'));var csv=require(_0x89de('0x7'));var ejs=require(_0x89de('0x8'));var fs=require('fs');var _=require(_0x89de('0x9'));var squel=require(_0x89de('0xa'));var crypto=require(_0x89de('0xb'));var jsforce=require(_0x89de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89de('0x7'));var querystring=require('querystring');var Papa=require(_0x89de('0xd'));var Redis=require(_0x89de('0xe'));var authService=require(_0x89de('0xf'));var qs=require(_0x89de('0x10'));var as=require(_0x89de('0x11'));var hardwareService=require(_0x89de('0x12'));var logger=require(_0x89de('0x13'))(_0x89de('0x14'));var utils=require(_0x89de('0x15'));var config=require(_0x89de('0x16'));var licenseUtil=require(_0x89de('0x17'));var db=require(_0x89de('0x18'))['db'];config['redis']=_[_0x89de('0x19')](config[_0x89de('0x1a')],{'host':_0x89de('0x1b'),'port':0x18eb});var socket=require(_0x89de('0x1c'))(new Redis(config[_0x89de('0x1a')]));require(_0x89de('0x1d'))[_0x89de('0x1e')](socket);var jayson=require(_0x89de('0x1f'));var client=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232c});var client9003=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232b});var client9002=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xda00d6,_0x167a1f,_0x271df4,_0x54e331){return new BPromise(function(_0x5eb1f2,_0x3342e8){var _0x1c1d35=_0x54e331||client;return _0x1c1d35['request'](_0xda00d6,_0x271df4)[_0x89de('0x22')](function(_0x1d11bf){logger[_0x89de('0x23')](_0x89de('0x24'),_0x167a1f,_0x89de('0x25'));logger[_0x89de('0x26')](_0x89de('0x27'),_0x167a1f,_0x89de('0x25'),JSON['stringify'](_0x1d11bf));if(_0x1d11bf[_0x89de('0x28')]){if(_0x1d11bf['error'][_0x89de('0x29')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x167a1f,_0x1d11bf[_0x89de('0x28')]['message']);return _0x3342e8(_0x1d11bf[_0x89de('0x28')][_0x89de('0x2a')]);}logger['error'](_0x89de('0x24'),_0x167a1f,_0x1d11bf[_0x89de('0x28')][_0x89de('0x2a')]);return _0x5eb1f2(_0x1d11bf[_0x89de('0x28')]['message']);}else{logger[_0x89de('0x23')](_0x89de('0x24'),_0x167a1f,_0x89de('0x25'));_0x5eb1f2(_0x1d11bf[_0x89de('0x2b')][_0x89de('0x2a')]);}})['catch'](function(_0x4265e2){logger['error'](_0x89de('0x24'),_0x167a1f,_0x4265e2);_0x3342e8(_0x4265e2);});});}function respondWithStatusCode(_0x1e56f4,_0xc42625){_0xc42625=_0xc42625||0xcc;return function(_0x416274){if(_0x416274){return _0x1e56f4['sendStatus'](_0xc42625);}return _0x1e56f4[_0x89de('0x2c')](_0xc42625)[_0x89de('0x2d')]();};}function respondWithResult(_0xe43a03,_0x210aa3){_0x210aa3=_0x210aa3||0xc8;return function(_0x4a199b){if(_0x4a199b){return _0xe43a03[_0x89de('0x2c')](_0x210aa3)[_0x89de('0x2e')](_0x4a199b);}};}function respondWithFilteredResult(_0x363a99,_0x142351){return function(_0x2fa105){if(_0x2fa105){var _0xaae94d=_0x2fa105[_0x89de('0x2f')],_0x42c710=_0x142351[_0x89de('0x30')],_0x4649e1=_0x142351['offset']+_0x142351['limit'],_0x3da64f;if(_0x4649e1>=_0xaae94d){_0x4649e1=_0xaae94d;_0x3da64f=0xc8;}else{_0x3da64f=0xce;}_0x363a99[_0x89de('0x2c')](_0x3da64f);return _0x363a99['set']('Content-Range',_0x42c710+'-'+_0x4649e1+'/'+_0xaae94d)[_0x89de('0x2e')](_0x2fa105);}return null;};}function patchUpdates(_0x4bdd69){return function(_0x1a67b7){try{jsonpatch['apply'](_0x1a67b7,_0x4bdd69,!![]);}catch(_0x3bad44){return BPromise['reject'](_0x3bad44);}return _0x1a67b7[_0x89de('0x31')]();};}function saveUpdates(_0x4a2a9e,_0x2e13a3){return function(_0x29b08f){if(_0x29b08f){return _0x29b08f[_0x89de('0x32')](_0x4a2a9e)[_0x89de('0x22')](function(_0x116731){return _0x116731;});}return null;};}function removeEntity(_0x1dc77c,_0x206764){return function(_0x3fa913){if(_0x3fa913){return _0x3fa913[_0x89de('0x33')]()[_0x89de('0x22')](function(){_0x1dc77c[_0x89de('0x2c')](0xcc)[_0x89de('0x2d')]();});}};}function handleEntityNotFound(_0x591627,_0x2e95a4){return function(_0x491369){if(!_0x491369){_0x591627['sendStatus'](0x194);}return _0x491369;};}function handleError(_0x4749cb,_0x5b5d75){_0x5b5d75=_0x5b5d75||0x1f4;return function(_0x397da5){logger['error'](_0x397da5['stack']);if(_0x397da5[_0x89de('0x34')]){delete _0x397da5[_0x89de('0x34')];}_0x4749cb[_0x89de('0x2c')](_0x5b5d75)[_0x89de('0x35')](_0x397da5);};}exports[_0x89de('0x36')]=function(_0x3daccf,_0x3a06ec){var _0x1c9880={},_0x23fab2={},_0x1ac49a={'count':0x0,'rows':[]};var _0x2be503=_[_0x89de('0x37')](db[_0x89de('0x38')][_0x89de('0x39')],function(_0x5df17b){return{'name':_0x5df17b[_0x89de('0x3a')],'type':_0x5df17b[_0x89de('0x3b')]['key']};});_0x23fab2[_0x89de('0x3c')]=_['map'](_0x2be503,_0x89de('0x34'));_0x23fab2[_0x89de('0x3d')]=_[_0x89de('0x3e')](_0x3daccf[_0x89de('0x3d')]);_0x23fab2[_0x89de('0x3f')]=_[_0x89de('0x40')](_0x23fab2['model'],_0x23fab2['query']);_0x1c9880['attributes']=_[_0x89de('0x40')](_0x23fab2['model'],qs[_0x89de('0x41')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x41')]));_0x1c9880[_0x89de('0x42')]=_0x1c9880[_0x89de('0x42')]['length']?_0x1c9880['attributes']:_0x23fab2[_0x89de('0x3c')];if(!_0x3daccf['query'][_0x89de('0x43')](_0x89de('0x44'))){_0x1c9880[_0x89de('0x45')]=qs[_0x89de('0x45')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x45')]);_0x1c9880[_0x89de('0x30')]=qs[_0x89de('0x30')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x30')]);}_0x1c9880[_0x89de('0x46')]=qs[_0x89de('0x47')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x47')]);_0x1c9880['where']=qs[_0x89de('0x3f')](_[_0x89de('0x48')](_0x3daccf[_0x89de('0x3d')],_0x23fab2['filters']),_0x2be503);if(_0x3daccf[_0x89de('0x3d')][_0x89de('0x49')]){_0x1c9880[_0x89de('0x4a')]=_['merge'](_0x1c9880[_0x89de('0x4a')],{'$or':_[_0x89de('0x37')](_0x2be503,function(_0x1a8a47){if(_0x1a8a47[_0x89de('0x3b')]!=='VIRTUAL'){var _0x11556b={};_0x11556b[_0x1a8a47['name']]={'$like':'%'+_0x3daccf['query'][_0x89de('0x49')]+'%'};return _0x11556b;}})});}_0x1c9880=_[_0x89de('0x4b')]({},_0x1c9880,_0x3daccf[_0x89de('0x4c')]);var _0x27b5ff={'where':_0x1c9880[_0x89de('0x4a')]};return db['MailMessage'][_0x89de('0x2f')](_0x27b5ff)['then'](function(_0x7aae2a){_0x1ac49a[_0x89de('0x2f')]=_0x7aae2a;if(_0x3daccf[_0x89de('0x3d')][_0x89de('0x4d')]){_0x1c9880[_0x89de('0x4e')]=[{'all':!![]}];}return db[_0x89de('0x38')][_0x89de('0x4f')](_0x1c9880);})[_0x89de('0x22')](function(_0x2d24c0){_0x1ac49a[_0x89de('0x50')]=_0x2d24c0;return _0x1ac49a;})['then'](respondWithFilteredResult(_0x3a06ec,_0x1c9880))[_0x89de('0x51')](handleError(_0x3a06ec,null));};exports[_0x89de('0x52')]=function(_0xe3aae9,_0x52c15b){var _0x5056bf={'raw':!![],'where':{'id':_0xe3aae9[_0x89de('0x53')]['id']}},_0x241ebd={};_0x241ebd[_0x89de('0x3c')]=_[_0x89de('0x3e')](db[_0x89de('0x38')][_0x89de('0x39')]);_0x241ebd[_0x89de('0x3d')]=_[_0x89de('0x3e')](_0xe3aae9[_0x89de('0x3d')]);_0x241ebd['filters']=_[_0x89de('0x40')](_0x241ebd['model'],_0x241ebd[_0x89de('0x3d')]);_0x5056bf[_0x89de('0x42')]=_[_0x89de('0x40')](_0x241ebd['model'],qs[_0x89de('0x41')](_0xe3aae9[_0x89de('0x3d')][_0x89de('0x41')]));_0x5056bf[_0x89de('0x42')]=_0x5056bf[_0x89de('0x42')][_0x89de('0x54')]?_0x5056bf['attributes']:_0x241ebd[_0x89de('0x3c')];if(_0xe3aae9[_0x89de('0x3d')][_0x89de('0x4d')]){_0x5056bf[_0x89de('0x4e')]=[{'all':!![]}];}_0x5056bf=_[_0x89de('0x4b')]({},_0x5056bf,_0xe3aae9[_0x89de('0x4c')]);return db['MailMessage']['find'](_0x5056bf)[_0x89de('0x22')](handleEntityNotFound(_0x52c15b,null))[_0x89de('0x22')](respondWithResult(_0x52c15b,null))[_0x89de('0x51')](handleError(_0x52c15b,null));};exports['update']=function(_0x21be33,_0xf5e031){if(_0x21be33[_0x89de('0x55')]['id']){delete _0x21be33['body']['id'];}return db[_0x89de('0x38')][_0x89de('0x56')]({'where':{'id':_0x21be33[_0x89de('0x53')]['id']}})[_0x89de('0x22')](handleEntityNotFound(_0xf5e031,null))[_0x89de('0x22')](saveUpdates(_0x21be33['body'],null))['then'](respondWithResult(_0xf5e031,null))[_0x89de('0x51')](handleError(_0xf5e031,null));};exports['destroy']=function(_0x1a8292,_0x419fbe){return db[_0x89de('0x38')]['find']({'where':{'id':_0x1a8292[_0x89de('0x53')]['id']}})['then'](handleEntityNotFound(_0x419fbe,null))[_0x89de('0x22')](removeEntity(_0x419fbe,null))[_0x89de('0x51')](handleError(_0x419fbe,null));};exports['describe']=function(_0x44f4f8,_0x3b96ff){return db['MailMessage'][_0x89de('0x57')]()[_0x89de('0x22')](respondWithResult(_0x3b96ff,null))[_0x89de('0x51')](handleError(_0x3b96ff,null));};exports[_0x89de('0x58')]=function(_0x58fe36,_0x3d6b01){return db[_0x89de('0x38')]['create'](_0x58fe36['body'])[_0x89de('0x22')](function(_0x22dce1){if(_0x22dce1){if(_0x22dce1[_0x89de('0x59')]===_0x89de('0x5a')&&!_0x22dce1['secret']){var _0x3dcf5e,_0x2ef792,_0x571dee;if(_0x58fe36[_0x89de('0x55')]['to']){_0x2ef792=_0x58fe36['body']['to'][_0x89de('0x5b')](',')[0x0];}return db[_0x89de('0x5c')][_0x89de('0x5d')]({'where':{'id':_0x22dce1[_0x89de('0x5e')]},'include':[{'model':db[_0x89de('0x5f')],'as':_0x89de('0x60'),'include':[{'model':db['CmContact'],'as':_0x89de('0x61'),'where':{'email':_0x2ef792},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x89de('0x62')],'as':'Smtp','raw':!![]}]})[_0x89de('0x22')](function(_0x3cd8d5){_0x3dcf5e=_0x3cd8d5;if(_0x3dcf5e&&_0x3dcf5e['Smtp']){var _0x1582a3={'tls':{'rejectUnauthorized':![]}};if(_[_0x89de('0x63')](_0x3dcf5e[_0x89de('0x64')][_0x89de('0x65')])){_0x1582a3[_0x89de('0x66')]=_0x3dcf5e[_0x89de('0x64')][_0x89de('0x66')];_0x1582a3[_0x89de('0x67')]=_0x3dcf5e[_0x89de('0x64')][_0x89de('0x67')];_0x1582a3[_0x89de('0x68')]=_0x3dcf5e[_0x89de('0x64')]['secure'];if(_0x3dcf5e[_0x89de('0x64')][_0x89de('0x69')]){_0x1582a3['auth']={'user':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6a')],'pass':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6b')]};}}else{_0x1582a3[_0x89de('0x65')]=_0x3dcf5e['Smtp'][_0x89de('0x65')];_0x1582a3['auth']={'user':_0x3dcf5e['Smtp']['user'],'pass':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6b')]};_0x1582a3[_0x89de('0x68')]=_0x3dcf5e[_0x89de('0x64')]['secure'];}if(_0x58fe36['body']['attachments']&&_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x89de('0x54')]){for(var _0x163bcf=0x0;_0x163bcf<_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x89de('0x54')];_0x163bcf+=0x1){_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x163bcf]={'filename':_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x163bcf]['name'],'path':path[_0x89de('0x6d')](config[_0x89de('0x6e')],'server/files/attachments',_0x58fe36['body'][_0x89de('0x6c')][_0x163bcf][_0x89de('0x6f')])};}}_0x571dee={'account':_0x1582a3,'message':_0x58fe36['body']};return;}})[_0x89de('0x22')](function(){if(_0x3dcf5e['List']){if(_0x3dcf5e[_0x89de('0x60')][_0x89de('0x61')][_0x89de('0x54')]){return _0x3dcf5e['List'][_0x89de('0x61')][0x0];}else{return db['CmContact'][_0x89de('0x58')](_['defaults'](_0x58fe36[_0x89de('0x55')],{'firstName':_0x58fe36['body']['to'],'email':_0x58fe36[_0x89de('0x55')]['to'],'phone':_0x58fe36[_0x89de('0x55')]['to'],'ListId':_0x3dcf5e[_0x89de('0x70')]}));}}else{throw new Error(_0x89de('0x71'));}})[_0x89de('0x22')](function(){if(_0x571dee){return respondWithRpcPromise('SendMail',_0x89de('0x72'),_0x571dee,client9003)[_0x89de('0x22')](function(_0x4f2491){return _0x22dce1['update']({'read':!![],'messageId':_0x4f2491[_0x89de('0x73')],'sentAt':moment()[_0x89de('0x74')](_0x89de('0x75'))});})[_0x89de('0x51')](function(_0x31246c){logger[_0x89de('0x28')]('%s',JSON[_0x89de('0x76')](_0x31246c));return _0x22dce1;});}return _0x22dce1;});}return _0x22dce1;}})[_0x89de('0x22')](respondWithResult(_0x3d6b01,0xc9))[_0x89de('0x51')](handleError(_0x3d6b01,null));};var interaction_log=require(_0x89de('0x13'))(_0x89de('0x77'));exports['accept']=function(_0x29afd7,_0x5f4009,_0x2e65c8){var _0x479a79={'channel':'mail'};if(_0x29afd7[_0x89de('0x55')]['id']){delete _0x29afd7[_0x89de('0x55')]['id'];}_0x29afd7[_0x89de('0x55')]['read']=!![];_0x29afd7[_0x89de('0x55')][_0x89de('0x78')]=moment()[_0x89de('0x74')](_0x89de('0x75'));_0x29afd7[_0x89de('0x55')][_0x89de('0x79')]=_0x29afd7[_0x89de('0x55')][_0x89de('0x79')]||_0x29afd7[_0x89de('0x6a')]['id'];return db[_0x89de('0x38')]['find']({'where':{'id':_0x29afd7[_0x89de('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x89de('0x7a')}]})[_0x89de('0x22')](handleEntityNotFound(_0x5f4009,null))[_0x89de('0x22')](saveUpdates(_0x29afd7[_0x89de('0x55')],null))[_0x89de('0x22')](function(_0x4f9995){if(_0x4f9995){_0x479a79[_0x89de('0x2a')]=_0x4f9995[_0x89de('0x7b')]({'plain':!![]});return db[_0x89de('0x7c')][_0x89de('0x56')]({'where':{'id':_0x4f9995[_0x89de('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x5f4009,null))[_0x89de('0x22')](function(_0x33600a){if(_0x33600a){return _0x33600a[_0x89de('0x32')]({'UserId':_0x29afd7[_0x89de('0x55')][_0x89de('0x79')],'read1stAt':_['isNil'](_0x33600a[_0x89de('0x7e')])?moment()['format'](_0x89de('0x75')):undefined});}return null;})['then'](function(_0x56519e){if(_0x56519e){_0x479a79[_0x89de('0x7f')]=_0x56519e[_0x89de('0x7b')]({'plain':!![]});interaction_log[_0x89de('0x23')](_0x89de('0x80'),_0x29afd7[_0x89de('0x6a')]['id'],_0x29afd7[_0x89de('0x6a')][_0x89de('0x34')],_0x29afd7['user'][_0x89de('0x81')],_0x479a79[_0x89de('0x7f')]['id'],_0x29afd7['body']?JSON[_0x89de('0x76')](_0x29afd7[_0x89de('0x55')]):'null');return respondWithRpcPromise(_0x89de('0x82'),_0x89de('0x83'),_0x479a79);}return null;})[_0x89de('0x22')](function(_0x546da7){if(_0x546da7){if(_0x29afd7['body'][_0x89de('0x84')]){_0x479a79[_0x89de('0x2a')][_0x89de('0x85')]=util[_0x89de('0x74')]('SIP/%s',_0x29afd7[_0x89de('0x6a')][_0x89de('0x34')]);_0x479a79['message'][_0x89de('0x86')]=_0x479a79[_0x89de('0x86')];_0x479a79[_0x89de('0x2a')][_0x89de('0x87')]=_0x89de('0x88');return respondWithRpcPromise(_0x89de('0x89'),_0x89de('0x89'),{'event':'acceptmessage','message':_0x479a79['message']},client9002)['then'](function(){return _0x479a79;});}return _0x479a79;}return null;})[_0x89de('0x22')](respondWithResult(_0x5f4009,null))[_0x89de('0x51')](handleError(_0x5f4009,null));};var interaction_log=require('../../config/logger')(_0x89de('0x77'));exports[_0x89de('0x8a')]=function(_0x58db93,_0x5d333b,_0x56dfa0){var _0x504db6={'agent':{},'channel':_0x89de('0x8b')};if(_0x58db93[_0x89de('0x55')]['id']){delete _0x58db93[_0x89de('0x55')]['id'];}_0x58db93[_0x89de('0x55')][_0x89de('0x79')]=_0x58db93[_0x89de('0x55')]['UserId']||_0x58db93['user']['id'];_0x504db6['agent']['id']=_0x58db93[_0x89de('0x55')][_0x89de('0x79')];return db['MailMessage'][_0x89de('0x56')]({'where':{'id':_0x58db93[_0x89de('0x53')]['id'],'UserId':null}})[_0x89de('0x22')](handleEntityNotFound(_0x5d333b,null))[_0x89de('0x22')](function(_0x4c4752){if(_0x4c4752){_0x504db6[_0x89de('0x2a')]=_0x4c4752['get']({'plain':!![]});return db[_0x89de('0x7c')][_0x89de('0x56')]({'where':{'id':_0x4c4752['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5d333b,null))[_0x89de('0x22')](function(_0x9cd5a6){if(_0x9cd5a6){_0x504db6[_0x89de('0x7f')]=_0x9cd5a6[_0x89de('0x7b')]({'plain':!![]});interaction_log[_0x89de('0x23')](_0x89de('0x8c'),_0x58db93[_0x89de('0x6a')]['id'],_0x58db93['user'][_0x89de('0x34')],_0x58db93[_0x89de('0x6a')][_0x89de('0x81')],_0x504db6['interaction']['id'],_0x58db93[_0x89de('0x55')]?JSON[_0x89de('0x76')](_0x58db93[_0x89de('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x89de('0x8d'),_0x504db6);}return null;})['then'](function(_0x58109a){if(_0x58109a){_0x58109a['message'][_0x89de('0x85')]=util[_0x89de('0x74')]('SIP/%s',_0x58db93['user'][_0x89de('0x34')]);_0x58109a[_0x89de('0x2a')]['channel']=_0x504db6[_0x89de('0x86')];_0x58109a['message'][_0x89de('0x87')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x89de('0x8e'),'message':_0x58109a[_0x89de('0x2a')]},client9002);return _0x504db6;}return null;})[_0x89de('0x22')](respondWithResult(_0x5d333b,null))[_0x89de('0x51')](handleError(_0x5d333b,null));};exports['download']=function(_0x14be56,_0x3c24d5){var _0x2fa8e0=moment()[_0x89de('0x8f')]()[_0x89de('0x90')]();var _0x43369e=path[_0x89de('0x6d')](config[_0x89de('0x6e')],_0x89de('0x91'),'files',_0x89de('0x92'));var _0x1e9c4b=path['join'](config[_0x89de('0x6e')],_0x89de('0x91'),'files',_0x89de('0x6c'));var _0x39ea94=util[_0x89de('0x74')](_0x89de('0x93'),_0x2fa8e0);return db['MailMessage'][_0x89de('0x56')]({'where':{'id':_0x14be56[_0x89de('0x53')]['id']},'attributes':['id','body',_0x89de('0x94'),'to','cc','bcc','subject',_0x89de('0x95')],'include':_0x14be56['query'][_0x89de('0x6c')]?[{'model':db[_0x89de('0x96')],'as':_0x89de('0x97')}]:undefined})[_0x89de('0x22')](handleEntityNotFound(_0x3c24d5,null))[_0x89de('0x22')](function(_0x6dd3a8){if(_0x6dd3a8){var _0x2a65e8=_0x6dd3a8;var _0x30e49e={'from':_0x2a65e8[_0x89de('0x94')],'to':_0x2a65e8['to'],'subject':_0x2a65e8['subject'],'html':_0x2a65e8[_0x89de('0x55')],'headers':{'Date':moment(_0x2a65e8[_0x89de('0x95')])[_0x89de('0x74')](_0x89de('0x98'))},'attachments':[]};if(_0x6dd3a8['cc']){_0x30e49e[_0x89de('0x99')]['Cc']=_0x6dd3a8['cc'];}if(_0x6dd3a8[_0x89de('0x9a')]){_0x30e49e[_0x89de('0x99')][_0x89de('0x9b')]=_0x6dd3a8[_0x89de('0x9a')];}return new BPromise(function(_0x249687,_0x4c1c66){if(_0x6dd3a8[_0x89de('0x97')]){for(var _0x5f17c4=0x0;_0x5f17c4<_0x6dd3a8[_0x89de('0x97')][_0x89de('0x54')];_0x5f17c4++){var _0x1259aa=_0x6dd3a8[_0x89de('0x97')][_0x5f17c4];var _0x3bdbb0=path[_0x89de('0x6d')](_0x1e9c4b,_0x1259aa[_0x89de('0x6f')]);if(fs[_0x89de('0x9c')](_0x3bdbb0)){_0x30e49e[_0x89de('0x6c')][_0x89de('0x9d')]({'name':_0x1259aa[_0x89de('0x34')],'contentType':_0x1259aa[_0x89de('0x3b')],'data':fs[_0x89de('0x9e')](_0x3bdbb0)});}}}emlformat['build'](_0x30e49e,function(_0xd3c115,_0x5cf29b){if(_0xd3c115)return _0x4c1c66(_0xd3c115);fs[_0x89de('0x9f')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94),_0x5cf29b);return _0x249687(_0x5cf29b);});});}})[_0x89de('0x22')](function(_0x1e5e82){if(_0x1e5e82){return _0x3c24d5[_0x89de('0xa0')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94),_0x39ea94,function(_0xcd30ce){if(_0xcd30ce){console[_0x89de('0xa1')](_0x89de('0xa2'),_0xcd30ce);}else{fs[_0x89de('0xa3')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94));}});}})['catch'](handleError(_0x3c24d5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 02a3d1f..90e3728 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 _0x7fc9=['MailMessage','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x655ab,_0x3bf2e9){var _0x1c456a=function(_0x53d4dd){while(--_0x53d4dd){_0x655ab['push'](_0x655ab['shift']());}};_0x1c456a(++_0x3bf2e9);}(_0x7fc9,0xee));var _0x97fc=function(_0x3d4fc3,_0x4c1d67){_0x3d4fc3=_0x3d4fc3-0x0;var _0x1d0b82=_0x7fc9[_0x3d4fc3];return _0x1d0b82;};'use strict';var EventEmitter=require(_0x97fc('0x0'));var MailMessage=require(_0x97fc('0x1'))['db'][_0x97fc('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x97fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x97fc('0x4')};function emitEvent(_0x4db63d){return function(_0x37f542,_0xb61267,_0x52b1a0){MailMessageEvents[_0x97fc('0x5')](_0x4db63d+':'+_0x37f542['id'],_0x37f542);MailMessageEvents[_0x97fc('0x5')](_0x4db63d,_0x37f542);_0x52b1a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x97fc('0x6')](e,emitEvent(event));}}module[_0x97fc('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x65a9=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1c69f0,_0x1b1385){var _0x437044=function(_0x4da23d){while(--_0x4da23d){_0x1c69f0['push'](_0x1c69f0['shift']());}};_0x437044(++_0x1b1385);}(_0x65a9,0x1b5));var _0x965a=function(_0x315aca,_0x2e0efc){_0x315aca=_0x315aca-0x0;var _0x5ab262=_0x65a9[_0x315aca];return _0x5ab262;};'use strict';var EventEmitter=require(_0x965a('0x0'));var MailMessage=require(_0x965a('0x1'))['db'][_0x965a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x965a('0x3')](0x0);var events={'afterCreate':_0x965a('0x4'),'afterUpdate':_0x965a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5c33bc){return function(_0x42a00d,_0x5f1c09,_0x2a239f){MailMessageEvents[_0x965a('0x6')](_0x5c33bc+':'+_0x42a00d['id'],_0x42a00d);MailMessageEvents[_0x965a('0x6')](_0x5c33bc,_0x42a00d);_0x2a239f(null);};}for(var e in events){if(events[_0x965a('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x965a('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 239cf91..99c0551 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 _0x2d20=['error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2d20,0x11a));var _0x02d2=function(_0x393fed,_0xded501){_0x393fed=_0x393fed-0x0;var _0x26a7f7=_0x2d20[_0x393fed];return _0x26a7f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02d2('0x0'))(_0x02d2('0x1'));var moment=require(_0x02d2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x02d2('0x3'));var fs=require('fs');var path=require(_0x02d2('0x4'));var rimraf=require(_0x02d2('0x5'));var config=require(_0x02d2('0x6'));var attributes=require(_0x02d2('0x7'));module['exports']=function(_0x26965c,_0x59850f){return _0x26965c[_0x02d2('0x8')](_0x02d2('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x02d2('0xa')]},{'name':_0x02d2('0xb'),'fields':['plainBody','subject'],'type':_0x02d2('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19601b,_0x1a4c14,_0x1a4184){if(_0x19601b[_0x02d2('0xd')]){_0x19601b[_0x02d2('0xe')]=htmlToText[_0x02d2('0xf')](_0x19601b[_0x02d2('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1a4184(null,_0x1a4c14);},'afterCreate':function(_0x51f198,_0x5ba7ca,_0xfc7374){var _0x42dc49=_0x26965c[_0x02d2('0x10')];var _0x1c4068=_0x51f198['get']({'plain':!![]});if(_0x1c4068['direction'][_0x02d2('0x11')]()==='in'||_0x1c4068['direction'][_0x02d2('0x11')]()===_0x02d2('0x12')&&!_0x1c4068[_0x02d2('0x13')]&&!_[_0x02d2('0x14')](_0x1c4068[_0x02d2('0x15')])){_0x42dc49[_0x02d2('0x16')][_0x02d2('0x17')]({'where':{'id':_0x1c4068[_0x02d2('0x18')]}})[_0x02d2('0x19')](function(_0x197380){if(_0x197380){_0x197380[_0x02d2('0x1a')]({'lastMsgAt':_0x1c4068['createdAt'],'lastMsgDirection':_0x1c4068['direction'][_0x02d2('0x11')](),'lastMsgBody':_0x1c4068[_0x02d2('0xd')]});}})[_0x02d2('0x1b')](function(_0x85d194){console[_0x02d2('0x1c')](_0x85d194);});}_0xfc7374();}},'charset':_0x02d2('0x1d'),'collate':_0x02d2('0x1e')});}; \ No newline at end of file +var _0x90c6=['../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','update','catch','error','utf8mb4','lodash'];(function(_0x2e767e,_0x591c30){var _0x539d6c=function(_0x1122fc){while(--_0x1122fc){_0x2e767e['push'](_0x2e767e['shift']());}};_0x539d6c(++_0x591c30);}(_0x90c6,0xa9));var _0x690c=function(_0x51777b,_0x5ec89b){_0x51777b=_0x51777b-0x0;var _0x4b0e5d=_0x90c6[_0x51777b];return _0x4b0e5d;};'use strict';var _=require(_0x690c('0x0'));var util=require('util');var logger=require(_0x690c('0x1'))(_0x690c('0x2'));var moment=require(_0x690c('0x3'));var BPromise=require(_0x690c('0x4'));var rp=require(_0x690c('0x5'));var htmlToText=require(_0x690c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x690c('0x7'));var config=require(_0x690c('0x8'));var attributes=require(_0x690c('0x9'));module[_0x690c('0xa')]=function(_0x2ae017,_0x458f71){return _0x2ae017[_0x690c('0xb')](_0x690c('0xc'),attributes,{'tableName':_0x690c('0xd'),'paranoid':![],'indexes':[{'name':_0x690c('0xe'),'fields':[_0x690c('0xe')]},{'name':_0x690c('0xf'),'fields':[_0x690c('0x10'),_0x690c('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38b342,_0x492ab5,_0xcea4b3){if(_0x38b342[_0x690c('0x12')]){_0x38b342[_0x690c('0x10')]=htmlToText[_0x690c('0x13')](_0x38b342[_0x690c('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xcea4b3(null,_0x492ab5);},'afterCreate':function(_0xd30c35,_0x37be43,_0x20f346){var _0x426ee3=_0x2ae017[_0x690c('0x14')];var _0x2d6e83=_0xd30c35[_0x690c('0x15')]({'plain':!![]});if(_0x2d6e83[_0x690c('0x16')][_0x690c('0x17')]()==='in'||_0x2d6e83[_0x690c('0x16')][_0x690c('0x17')]()===_0x690c('0x18')&&!_0x2d6e83[_0x690c('0x19')]&&!_[_0x690c('0x1a')](_0x2d6e83['UserId'])){_0x426ee3['MailInteraction'][_0x690c('0x1b')]({'where':{'id':_0x2d6e83[_0x690c('0x1c')]}})[_0x690c('0x1d')](function(_0x2857c8){if(_0x2857c8){_0x2857c8[_0x690c('0x1e')]({'lastMsgAt':_0x2d6e83['createdAt'],'lastMsgDirection':_0x2d6e83[_0x690c('0x16')]['toLowerCase'](),'lastMsgBody':_0x2d6e83['body']});}})[_0x690c('0x1f')](function(_0x75d674){console[_0x690c('0x20')](_0x75d674);});}_0x20f346();}},'charset':_0x690c('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4181607..c0a8611 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 _0xde42=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify','lodash','randomstring'];(function(_0x3c1a4e,_0x36dabf){var _0x155a91=function(_0x367f0d){while(--_0x367f0d){_0x3c1a4e['push'](_0x3c1a4e['shift']());}};_0x155a91(++_0x36dabf);}(_0xde42,0x153));var _0x2de4=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xde42[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x2de4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2de4('0x1'));var fs=require('fs');var Redis=require(_0x2de4('0x2'));var db=require(_0x2de4('0x3'))['db'];var utils=require(_0x2de4('0x4'));var logger=require(_0x2de4('0x5'))(_0x2de4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2de4('0x7')]['http']({'port':0x232a});config[_0x2de4('0x8')]=_[_0x2de4('0x9')](config['redis'],{'host':_0x2de4('0xa'),'port':0x18eb});var socket=require(_0x2de4('0xb'))(new Redis(config[_0x2de4('0x8')]));require(_0x2de4('0xc'))['register'](socket);function respondWithRpcPromise(_0x2fa1f1,_0x5cb45a,_0x10b1b4){return new BPromise(function(_0x326f5c,_0x745029){return client[_0x2de4('0xd')](_0x2fa1f1,_0x10b1b4)[_0x2de4('0xe')](function(_0x4358cf){logger[_0x2de4('0xf')](_0x2de4('0x10'),_0x5cb45a,'request\x20sent');logger['debug'](_0x2de4('0x11'),_0x5cb45a,_0x2de4('0x12'),JSON['stringify'](_0x4358cf));if(_0x4358cf['error']){if(_0x4358cf[_0x2de4('0x13')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5cb45a,_0x4358cf[_0x2de4('0x13')][_0x2de4('0x14')]);return _0x745029(_0x4358cf['error']['message']);}logger[_0x2de4('0x13')](_0x2de4('0x10'),_0x5cb45a,_0x4358cf['error'][_0x2de4('0x14')]);return _0x326f5c(_0x4358cf['error'][_0x2de4('0x14')]);}else{logger[_0x2de4('0xf')](_0x2de4('0x10'),_0x5cb45a,_0x2de4('0x12'));_0x326f5c(_0x4358cf[_0x2de4('0x15')][_0x2de4('0x14')]);}})[_0x2de4('0x16')](function(_0x50f337){logger[_0x2de4('0x13')](_0x2de4('0x10'),_0x5cb45a,_0x50f337);_0x745029(_0x50f337);});});}exports[_0x2de4('0x17')]=function(_0x2e1621){var _0x3a1ce8=this;return new Promise(function(_0x441993,_0x438b6d){return db[_0x2de4('0x18')][_0x2de4('0x19')](_0x2e1621[_0x2de4('0x1a')],{'raw':_0x2e1621[_0x2de4('0x1b')]?_0x2e1621[_0x2de4('0x1b')][_0x2de4('0x1c')]===undefined?!![]:![]:!![]})[_0x2de4('0xe')](function(_0x3a5029){logger[_0x2de4('0xf')](_0x2de4('0x17'),_0x2e1621);logger[_0x2de4('0x1d')]('CreateMailMessage',_0x2e1621,JSON[_0x2de4('0x1e')](_0x3a5029));_0x441993(_0x3a5029);})['catch'](function(_0x23df56){logger[_0x2de4('0x13')](_0x2de4('0x17'),_0x23df56[_0x2de4('0x14')],_0x2e1621);_0x438b6d(_0x3a1ce8['error'](0x1f4,_0x23df56[_0x2de4('0x14')]));});});}; \ No newline at end of file +var _0xe306=['socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailMessage','create','body','options','raw','then','CreateMailMessage','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost'];(function(_0x3e2c1e,_0x1e8d40){var _0x1c6666=function(_0x190b73){while(--_0x190b73){_0x3e2c1e['push'](_0x3e2c1e['shift']());}};_0x1c6666(++_0x1e8d40);}(_0xe306,0x180));var _0x6e30=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xe306[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x6e30('0x0'));var util=require(_0x6e30('0x1'));var moment=require(_0x6e30('0x2'));var BPromise=require(_0x6e30('0x3'));var rs=require(_0x6e30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e30('0x5'));var logger=require(_0x6e30('0x6'))('rpc');var config=require(_0x6e30('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e30('0x8')]({'port':0x232a});config[_0x6e30('0x9')]=_[_0x6e30('0xa')](config['redis'],{'host':_0x6e30('0xb'),'port':0x18eb});var socket=require(_0x6e30('0xc'))(new Redis(config[_0x6e30('0x9')]));require(_0x6e30('0xd'))[_0x6e30('0xe')](socket);function respondWithRpcPromise(_0x3719fb,_0x3bf9fd,_0x1cefa6){return new BPromise(function(_0x3b5d39,_0x10c5e4){return client[_0x6e30('0xf')](_0x3719fb,_0x1cefa6)['then'](function(_0x1d2f72){logger[_0x6e30('0x10')](_0x6e30('0x11'),_0x3bf9fd,_0x6e30('0x12'));logger['debug'](_0x6e30('0x13'),_0x3bf9fd,'request\x20sent',JSON[_0x6e30('0x14')](_0x1d2f72));if(_0x1d2f72[_0x6e30('0x15')]){if(_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x16')]===0x1f4){logger['error'](_0x6e30('0x11'),_0x3bf9fd,_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x17')]);return _0x10c5e4(_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x17')]);}logger[_0x6e30('0x15')](_0x6e30('0x11'),_0x3bf9fd,_0x1d2f72['error'][_0x6e30('0x17')]);return _0x3b5d39(_0x1d2f72['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3bf9fd,_0x6e30('0x12'));_0x3b5d39(_0x1d2f72['result'][_0x6e30('0x17')]);}})[_0x6e30('0x18')](function(_0x311242){logger[_0x6e30('0x15')]('MailMessage,\x20%s,\x20%s',_0x3bf9fd,_0x311242);_0x10c5e4(_0x311242);});});}exports['CreateMailMessage']=function(_0x522766){var _0x246d94=this;return new Promise(function(_0x53bc7a,_0x56838e){return db[_0x6e30('0x19')][_0x6e30('0x1a')](_0x522766[_0x6e30('0x1b')],{'raw':_0x522766[_0x6e30('0x1c')]?_0x522766[_0x6e30('0x1c')][_0x6e30('0x1d')]===undefined?!![]:![]:!![]})[_0x6e30('0x1e')](function(_0x44cfb0){logger[_0x6e30('0x10')](_0x6e30('0x1f'),_0x522766);logger[_0x6e30('0x20')]('CreateMailMessage',_0x522766,JSON[_0x6e30('0x14')](_0x44cfb0));_0x53bc7a(_0x44cfb0);})[_0x6e30('0x18')](function(_0x223aff){logger[_0x6e30('0x15')]('CreateMailMessage',_0x223aff[_0x6e30('0x17')],_0x522766);_0x56838e(_0x246d94[_0x6e30('0x15')](0x1f4,_0x223aff[_0x6e30('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 285277d..d7648f7 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 _0x0aa7=['./mailMessage.events','save','emit','removeListener','register','length','mailMessage:'];(function(_0x45c4df,_0x168f60){var _0x151d61=function(_0x308c99){while(--_0x308c99){_0x45c4df['push'](_0x45c4df['shift']());}};_0x151d61(++_0x168f60);}(_0x0aa7,0x150));var _0x70aa=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x0aa7[_0x1558ab];return _0x53b64a;};'use strict';var MailMessageEvents=require(_0x70aa('0x0'));var events=[_0x70aa('0x1'),'remove','update'];function createListener(_0x7464e7,_0x166c93){return function(_0x386be8){_0x166c93[_0x70aa('0x2')](_0x7464e7,_0x386be8);};}function removeListener(_0xfd0fb7,_0x199406){return function(){MailMessageEvents[_0x70aa('0x3')](_0xfd0fb7,_0x199406);};}exports[_0x70aa('0x4')]=function(_0x24c7b6){for(var _0x33c2cf=0x0,_0x18439b=events[_0x70aa('0x5')];_0x33c2cf<_0x18439b;_0x33c2cf++){var _0x426d17=events[_0x33c2cf];var _0x1eba1d=createListener(_0x70aa('0x6')+_0x426d17,_0x24c7b6);MailMessageEvents['on'](_0x426d17,_0x1eba1d);}}; \ No newline at end of file +var _0x9874=['update','removeListener','register','length','mailMessage:','save'];(function(_0x491c3b,_0x48c956){var _0x3bdc02=function(_0x5c48de){while(--_0x5c48de){_0x491c3b['push'](_0x491c3b['shift']());}};_0x3bdc02(++_0x48c956);}(_0x9874,0x155));var _0x4987=function(_0x3dd8d3,_0x951169){_0x3dd8d3=_0x3dd8d3-0x0;var _0x37e8c6=_0x9874[_0x3dd8d3];return _0x37e8c6;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4987('0x0'),'remove',_0x4987('0x1')];function createListener(_0x10c0b8,_0x47eeb6){return function(_0x2210a6){_0x47eeb6['emit'](_0x10c0b8,_0x2210a6);};}function removeListener(_0x5c96d5,_0x1dd022){return function(){MailMessageEvents[_0x4987('0x2')](_0x5c96d5,_0x1dd022);};}exports[_0x4987('0x3')]=function(_0xf40c75){for(var _0x26f6b3=0x0,_0x55525f=events[_0x4987('0x4')];_0x26f6b3<_0x55525f;_0x26f6b3++){var _0x37f49b=events[_0x26f6b3];var _0x50f62a=createListener(_0x4987('0x5')+_0x37f49b,_0xf40c75);MailMessageEvents['on'](_0x37f49b,_0x50f62a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b919d86..9f905f7 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 _0x2749=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2749,0x1c0));var _0x9274=function(_0x202857,_0x30c098){_0x202857=_0x202857-0x0;var _0x182dac=_0x2749[_0x202857];return _0x182dac;};'use strict';var multer=require(_0x9274('0x0'));var util=require(_0x9274('0x1'));var path=require(_0x9274('0x2'));var timeout=require(_0x9274('0x3'));var express=require(_0x9274('0x4'));var router=express[_0x9274('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9274('0x6'));var config=require(_0x9274('0x7'));var controller=require(_0x9274('0x8'));router[_0x9274('0x9')]('/',auth[_0x9274('0xa')](),controller[_0x9274('0xb')]);router[_0x9274('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9274('0xc')]);router[_0x9274('0x9')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller['show']);router[_0x9274('0x9')](_0x9274('0xe'),auth[_0x9274('0xa')](),controller[_0x9274('0xf')]);router[_0x9274('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9274('0x10')]);router[_0x9274('0x9')](_0x9274('0x11'),auth[_0x9274('0xa')](),controller[_0x9274('0x12')]);router[_0x9274('0x13')]('/',auth[_0x9274('0xa')](),controller[_0x9274('0x14')]);router[_0x9274('0x13')](_0x9274('0x15'),auth[_0x9274('0xa')](),controller[_0x9274('0x16')]);router[_0x9274('0x13')]('/:id/users',auth[_0x9274('0xa')](),controller['addAgents']);router[_0x9274('0x17')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller[_0x9274('0x18')]);router[_0x9274('0x19')](_0x9274('0xd'),auth[_0x9274('0xa')](),controller[_0x9274('0x1a')]);router['delete'](_0x9274('0x15'),auth[_0x9274('0xa')](),controller[_0x9274('0x1b')]);router[_0x9274('0x19')]('/:id/users',auth[_0x9274('0xa')](),controller[_0x9274('0x1c')]);module[_0x9274('0x1d')]=router; \ No newline at end of file +var _0x3437=['/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put'];(function(_0x3412ab,_0x5a2b22){var _0x37ad1d=function(_0x46ef9b){while(--_0x46ef9b){_0x3412ab['push'](_0x3412ab['shift']());}};_0x37ad1d(++_0x5a2b22);}(_0x3437,0x10a));var _0x7343=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3437[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7343('0x0'));var util=require(_0x7343('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7343('0x2')]();var auth=require(_0x7343('0x3'));var interaction=require(_0x7343('0x4'));var config=require('../../config/environment');var controller=require(_0x7343('0x5'));router[_0x7343('0x6')]('/',auth[_0x7343('0x7')](),controller['index']);router[_0x7343('0x6')](_0x7343('0x8'),auth[_0x7343('0x7')](),controller[_0x7343('0x9')]);router[_0x7343('0x6')]('/:id',auth[_0x7343('0x7')](),controller['show']);router['get']('/:id/members',auth[_0x7343('0x7')](),controller[_0x7343('0xa')]);router[_0x7343('0x6')](_0x7343('0xb'),auth['isAuthenticated'](),controller[_0x7343('0xc')]);router[_0x7343('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x7343('0xd')]);router[_0x7343('0xe')]('/',auth[_0x7343('0x7')](),controller[_0x7343('0xf')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x7343('0x10')]);router['post'](_0x7343('0x11'),auth[_0x7343('0x7')](),controller[_0x7343('0x12')]);router[_0x7343('0x13')](_0x7343('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x7343('0x15')](_0x7343('0x14'),auth[_0x7343('0x7')](),controller[_0x7343('0x16')]);router[_0x7343('0x15')](_0x7343('0xb'),auth[_0x7343('0x7')](),controller[_0x7343('0x17')]);router[_0x7343('0x15')]('/:id/users',auth[_0x7343('0x7')](),controller[_0x7343('0x18')]);module[_0x7343('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index a085429..b46818d 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 _0x6b02=['beepall','roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x550bf2,_0x1b1535){var _0x24208a=function(_0x3b6f6a){while(--_0x3b6f6a){_0x550bf2['push'](_0x550bf2['shift']());}};_0x24208a(++_0x1b1535);}(_0x6b02,0x1d0));var _0x26b0=function(_0x56418c,_0xd90668){_0x56418c=_0x56418c-0x0;var _0x1c838d=_0x6b02[_0x56418c];return _0x1c838d;};'use strict';var Sequelize=require('sequelize');module[_0x26b0('0x0')]={'name':{'type':Sequelize[_0x26b0('0x1')],'unique':_0x26b0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x26b0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x26b0('0x3')](_0x26b0('0x4'),_0x26b0('0x5'),_0x26b0('0x6'))}}; \ No newline at end of file +var _0x2d03=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x1d96b1,_0x1062e9){var _0x12ddc6=function(_0x3cefff){while(--_0x3cefff){_0x1d96b1['push'](_0x1d96b1['shift']());}};_0x12ddc6(++_0x1062e9);}(_0x2d03,0x1e7));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x32d0('0x0')]={'name':{'type':Sequelize[_0x32d0('0x1')],'unique':_0x32d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x32d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32d0('0x4')](_0x32d0('0x5'),_0x32d0('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1afaeb4..2e72d87 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 _0x4dfc=['map','type','VIRTUAL','merge','options','count','include','rows','catch','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','get','MailQueues','destroy','then','error','stack','name','send','MailQueue','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x3ed3d6,_0x34a930){var _0x10e36e=function(_0x1c0832){while(--_0x1c0832){_0x3ed3d6['push'](_0x3ed3d6['shift']());}};_0x10e36e(++_0x34a930);}(_0x4dfc,0xda));var _0xc4df=function(_0x506002,_0x17ad62){_0x506002=_0x506002-0x0;var _0x5a020c=_0x4dfc[_0x506002];return _0x5a020c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc4df('0x0'));var jsonpatch=require(_0xc4df('0x1'));var rp=require(_0xc4df('0x2'));var moment=require(_0xc4df('0x3'));var BPromise=require(_0xc4df('0x4'));var Mustache=require(_0xc4df('0x5'));var util=require(_0xc4df('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4df('0x7'));var fs=require('fs');var _=require(_0xc4df('0x8'));var squel=require('squel');var crypto=require(_0xc4df('0x9'));var jsforce=require(_0xc4df('0xa'));var deskjs=require(_0xc4df('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc4df('0xc'));var Papa=require(_0xc4df('0xd'));var Redis=require(_0xc4df('0xe'));var authService=require(_0xc4df('0xf'));var qs=require(_0xc4df('0x10'));var as=require(_0xc4df('0x11'));var hardwareService=require(_0xc4df('0x12'));var logger=require(_0xc4df('0x13'))('api');var utils=require(_0xc4df('0x14'));var config=require(_0xc4df('0x15'));var licenseUtil=require(_0xc4df('0x16'));var db=require(_0xc4df('0x17'))['db'];config[_0xc4df('0x18')]=_[_0xc4df('0x19')](config[_0xc4df('0x18')],{'host':_0xc4df('0x1a'),'port':0x18eb});var socket=require(_0xc4df('0x1b'))(new Redis(config[_0xc4df('0x18')]));require(_0xc4df('0x1c'))[_0xc4df('0x1d')](socket);function respondWithStatusCode(_0x2d1005,_0x25cfbf){_0x25cfbf=_0x25cfbf||0xcc;return function(_0x814661){if(_0x814661){return _0x2d1005[_0xc4df('0x1e')](_0x25cfbf);}return _0x2d1005['status'](_0x25cfbf)[_0xc4df('0x1f')]();};}function respondWithResult(_0xc62bfa,_0x4d00bc){_0x4d00bc=_0x4d00bc||0xc8;return function(_0x570195){if(_0x570195){return _0xc62bfa[_0xc4df('0x20')](_0x4d00bc)[_0xc4df('0x21')](_0x570195);}};}function respondWithFilteredResult(_0x18d63,_0x14f055){return function(_0x5e3e48){if(_0x5e3e48){var _0x1c2ea7=_0x5e3e48['count'],_0x37e394=_0x14f055[_0xc4df('0x22')],_0xf87fb2=_0x14f055[_0xc4df('0x22')]+_0x14f055[_0xc4df('0x23')],_0x3d43b8;if(_0xf87fb2>=_0x1c2ea7){_0xf87fb2=_0x1c2ea7;_0x3d43b8=0xc8;}else{_0x3d43b8=0xce;}_0x18d63[_0xc4df('0x20')](_0x3d43b8);return _0x18d63[_0xc4df('0x24')](_0xc4df('0x25'),_0x37e394+'-'+_0xf87fb2+'/'+_0x1c2ea7)[_0xc4df('0x21')](_0x5e3e48);}return null;};}function patchUpdates(_0x2400ce){return function(_0x179764){try{jsonpatch[_0xc4df('0x26')](_0x179764,_0x2400ce,!![]);}catch(_0x39838b){return BPromise[_0xc4df('0x27')](_0x39838b);}return _0x179764['save']();};}function saveUpdates(_0x4fa99a,_0x4f492f){return function(_0x458269){if(_0x458269){return _0x458269['update'](_0x4fa99a)['then'](function(_0x58bf45){return _0x58bf45;});}return null;};}function removeEntity(_0x547c5b,_0x2faa83){return function(_0x1d8d5d){if(_0x1d8d5d){return _0x1d8d5d['destroy']()['then'](function(){var _0x3ee721=_0x1d8d5d[_0xc4df('0x28')]({'plain':!![]});var _0x13e7ed=_0xc4df('0x29');return db['UserProfileResource'][_0xc4df('0x2a')]({'where':{'type':_0x13e7ed,'resourceId':_0x3ee721['id']}})[_0xc4df('0x2b')](function(){return _0x1d8d5d;});})[_0xc4df('0x2b')](function(){_0x547c5b[_0xc4df('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21eef3,_0x41b91d){return function(_0x308749){if(!_0x308749){_0x21eef3[_0xc4df('0x1e')](0x194);}return _0x308749;};}function handleError(_0x2ce795,_0x533b31){_0x533b31=_0x533b31||0x1f4;return function(_0xa0526f){logger[_0xc4df('0x2c')](_0xa0526f[_0xc4df('0x2d')]);if(_0xa0526f['name']){delete _0xa0526f[_0xc4df('0x2e')];}_0x2ce795['status'](_0x533b31)[_0xc4df('0x2f')](_0xa0526f);};}exports['index']=function(_0x1cfbfb,_0x309181){var _0x3e76b1={},_0x1f6b30={},_0x5405cf={'count':0x0,'rows':[]};var _0x24442c=_['map'](db[_0xc4df('0x30')][_0xc4df('0x31')],function(_0x3d5f4d){return{'name':_0x3d5f4d[_0xc4df('0x32')],'type':_0x3d5f4d['type']['key']};});_0x1f6b30['model']=_['map'](_0x24442c,_0xc4df('0x2e'));_0x1f6b30[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x1cfbfb['query']);_0x1f6b30['filters']=_[_0xc4df('0x35')](_0x1f6b30[_0xc4df('0x36')],_0x1f6b30[_0xc4df('0x33')]);_0x3e76b1[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x1f6b30['model'],qs[_0xc4df('0x38')](_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x38')]));_0x3e76b1[_0xc4df('0x37')]=_0x3e76b1[_0xc4df('0x37')][_0xc4df('0x39')]?_0x3e76b1[_0xc4df('0x37')]:_0x1f6b30[_0xc4df('0x36')];if(!_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3a')]('nolimit')){_0x3e76b1['limit']=qs[_0xc4df('0x23')](_0x1cfbfb[_0xc4df('0x33')]['limit']);_0x3e76b1[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0x1cfbfb['query']['offset']);}_0x3e76b1[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3c')]);_0x3e76b1[_0xc4df('0x3d')]=qs['filters'](_[_0xc4df('0x3e')](_0x1cfbfb['query'],_0x1f6b30['filters']),_0x24442c);if(_0x1cfbfb[_0xc4df('0x33')][_0xc4df('0x3f')]){_0x3e76b1[_0xc4df('0x3d')]=_['merge'](_0x3e76b1['where'],{'$or':_[_0xc4df('0x40')](_0x24442c,function(_0x37c7c7){if(_0x37c7c7[_0xc4df('0x41')]!==_0xc4df('0x42')){var _0x167e4b={};_0x167e4b[_0x37c7c7['name']]={'$like':'%'+_0x1cfbfb[_0xc4df('0x33')]['filter']+'%'};return _0x167e4b;}})});}_0x3e76b1=_[_0xc4df('0x43')]({},_0x3e76b1,_0x1cfbfb[_0xc4df('0x44')]);var _0x4995e7={'where':_0x3e76b1[_0xc4df('0x3d')]};return db['MailQueue'][_0xc4df('0x45')](_0x4995e7)[_0xc4df('0x2b')](function(_0x1480cc){_0x5405cf[_0xc4df('0x45')]=_0x1480cc;if(_0x1cfbfb['query']['includeAll']){_0x3e76b1[_0xc4df('0x46')]=[{'all':!![]}];}return db[_0xc4df('0x30')]['findAll'](_0x3e76b1);})['then'](function(_0x1b42bb){_0x5405cf[_0xc4df('0x47')]=_0x1b42bb;return _0x5405cf;})[_0xc4df('0x2b')](respondWithFilteredResult(_0x309181,_0x3e76b1))[_0xc4df('0x48')](handleError(_0x309181,null));};exports['show']=function(_0x1118b4,_0x52794c){var _0x244901={'raw':!![],'where':{'id':_0x1118b4['params']['id']}},_0x572ff1={};_0x572ff1['model']=_[_0xc4df('0x34')](db['MailQueue'][_0xc4df('0x31')]);_0x572ff1['query']=_[_0xc4df('0x34')](_0x1118b4[_0xc4df('0x33')]);_0x572ff1[_0xc4df('0x49')]=_['intersection'](_0x572ff1[_0xc4df('0x36')],_0x572ff1[_0xc4df('0x33')]);_0x244901['attributes']=_[_0xc4df('0x35')](_0x572ff1[_0xc4df('0x36')],qs['fields'](_0x1118b4[_0xc4df('0x33')]['fields']));_0x244901['attributes']=_0x244901[_0xc4df('0x37')][_0xc4df('0x39')]?_0x244901[_0xc4df('0x37')]:_0x572ff1['model'];if(_0x1118b4['query']['includeAll']){_0x244901[_0xc4df('0x46')]=[{'all':!![]}];}_0x244901=_[_0xc4df('0x43')]({},_0x244901,_0x1118b4['options']);return db['MailQueue'][_0xc4df('0x4a')](_0x244901)[_0xc4df('0x2b')](handleEntityNotFound(_0x52794c,null))[_0xc4df('0x2b')](respondWithResult(_0x52794c,null))[_0xc4df('0x48')](handleError(_0x52794c,null));};exports[_0xc4df('0x4b')]=function(_0x575e4c,_0x1f5faf){return db['MailQueue'][_0xc4df('0x4b')](_0x575e4c[_0xc4df('0x4c')],{})[_0xc4df('0x2b')](function(_0x1117aa){var _0x5a902f=_0x575e4c['user'][_0xc4df('0x28')]({'plain':!![]});if(!_0x5a902f)throw new Error(_0xc4df('0x4d'));if(_0x5a902f[_0xc4df('0x4e')]===_0xc4df('0x4f')){var _0x2dc0fc=_0x1117aa[_0xc4df('0x28')]({'plain':!![]});var _0x20a5d9=_0xc4df('0x29');return db[_0xc4df('0x50')]['find']({'where':{'name':_0x20a5d9,'userProfileId':_0x5a902f[_0xc4df('0x51')]},'raw':!![]})[_0xc4df('0x2b')](function(_0x4d3c86){if(_0x4d3c86&&_0x4d3c86[_0xc4df('0x52')]===0x0){return db[_0xc4df('0x53')][_0xc4df('0x4b')]({'name':_0x2dc0fc[_0xc4df('0x2e')],'resourceId':_0x2dc0fc['id'],'type':_0x4d3c86[_0xc4df('0x2e')],'sectionId':_0x4d3c86['id']},{})[_0xc4df('0x2b')](function(){return _0x1117aa;});}else{return _0x1117aa;}})[_0xc4df('0x48')](function(_0x5a3150){logger[_0xc4df('0x2c')](_0xc4df('0x54'),_0x5a3150);throw _0x5a3150;});}return _0x1117aa;})[_0xc4df('0x2b')](respondWithResult(_0x1f5faf,0xc9))['catch'](handleError(_0x1f5faf,null));};exports[_0xc4df('0x55')]=function(_0xc42652,_0x42b2eb){if(_0xc42652[_0xc4df('0x4c')]['id']){delete _0xc42652['body']['id'];}return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0xc42652[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x42b2eb,null))['then'](saveUpdates(_0xc42652[_0xc4df('0x4c')],null))[_0xc4df('0x2b')](respondWithResult(_0x42b2eb,null))[_0xc4df('0x48')](handleError(_0x42b2eb,null));};exports[_0xc4df('0x2a')]=function(_0x526d47,_0x2bf34f){return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0x526d47[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x2bf34f,null))[_0xc4df('0x2b')](removeEntity(_0x2bf34f,null))[_0xc4df('0x48')](handleError(_0x2bf34f,null));};exports[_0xc4df('0x57')]=function(_0x14494c,_0x5b8ce3){return db['MailQueue'][_0xc4df('0x57')]()[_0xc4df('0x2b')](respondWithResult(_0x5b8ce3,null))['catch'](handleError(_0x5b8ce3,null));};exports[_0xc4df('0x58')]=function(_0x4ee438,_0x566f20,_0x5b0258){var _0x4c5ac0={'raw':!![],'where':{}},_0x31d0e7={},_0x295e0f;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0x4ee438[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x566f20,null))[_0xc4df('0x2b')](function(_0x1ef0a4){if(_0x1ef0a4){_0x295e0f=_0x1ef0a4[_0xc4df('0x28')]({'plain':!![]});_0x31d0e7[_0xc4df('0x36')]=_[_0xc4df('0x34')](db[_0xc4df('0x5a')][_0xc4df('0x31')]);_0x31d0e7[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x4ee438['query']);_0x31d0e7[_0xc4df('0x49')]=_[_0xc4df('0x35')](_0x31d0e7[_0xc4df('0x36')],_0x31d0e7[_0xc4df('0x33')]);_0x4c5ac0[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x31d0e7[_0xc4df('0x36')],qs['fields'](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x38')]));_0x4c5ac0[_0xc4df('0x37')]=_0x4c5ac0[_0xc4df('0x37')][_0xc4df('0x39')]?_0x4c5ac0[_0xc4df('0x37')]:_0x31d0e7['model'];if(!_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3a')](_0xc4df('0x5b'))){_0x4c5ac0[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x23')]);_0x4c5ac0[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0x4ee438['query'][_0xc4df('0x22')]);}_0x4c5ac0[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3c')]);_0x4c5ac0['where']=qs[_0xc4df('0x49')](_[_0xc4df('0x3e')](_0x4ee438[_0xc4df('0x33')],_0x31d0e7[_0xc4df('0x49')]));_0x4c5ac0[_0xc4df('0x3d')][_0xc4df('0x5c')]=_0x1ef0a4['id'];if(_0x4ee438[_0xc4df('0x33')]['filter']){_0x4c5ac0[_0xc4df('0x3d')]=_[_0xc4df('0x43')](_0x4c5ac0[_0xc4df('0x3d')],{'$or':_[_0xc4df('0x40')](_0x4c5ac0[_0xc4df('0x37')],function(_0x4f898b){var _0x225f25={};_0x225f25[_0x4f898b]={'$like':'%'+_0x4ee438[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x225f25;})});}_0x4c5ac0=_['merge']({},_0x4c5ac0,_0x4ee438['options']);return db[_0xc4df('0x5a')]['findAll'](_0x4c5ac0);}})[_0xc4df('0x2b')](function(_0x1a28c7){if(_0x1a28c7){return db['User'][_0xc4df('0x5d')]({'where':{'id':_[_0xc4df('0x40')](_0x1a28c7,_0xc4df('0x5e')),'role':_0xc4df('0x5f')},'attributes':['id',_0xc4df('0x2e'),_0xc4df('0x60'),'updatedAt',_0xc4df('0x61')]});}})[_0xc4df('0x2b')](function(_0x52c59f){if(_0x52c59f){return{'count':_0x52c59f[_0xc4df('0x45')],'rows':_[_0xc4df('0x40')](_0x52c59f[_0xc4df('0x47')],function(_0x3ae897){return{'membername':_0x3ae897[_0xc4df('0x2e')],'UserId':_0x3ae897['id'],'queue_name':_0x295e0f[_0xc4df('0x2e')],'MailQueueId':_0x295e0f['id'],'interface':util['format'](_0xc4df('0x62'),_0xc4df('0x63'),_0x3ae897['name']),'penalty':0x0,'paused':_0x3ae897[_0xc4df('0x60')],'createdAt':_0x3ae897[_0xc4df('0x61')],'updatedAt':_0x3ae897['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc4df('0x2b')](respondWithFilteredResult(_0x566f20,_0x4c5ac0))[_0xc4df('0x48')](handleError(_0x566f20,null));};exports[_0xc4df('0x64')]=function(_0x99eba4,_0x4a128a,_0x28577a){var _0x5673ab={};var _0x5b2f9b={};var _0x8dcaca;var _0x4afb94;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0x99eba4[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x4a128a,null))[_0xc4df('0x2b')](function(_0x5c8733){if(_0x5c8733){_0x8dcaca=_0x5c8733;_0x5b2f9b['model']=_[_0xc4df('0x34')](db[_0xc4df('0x65')][_0xc4df('0x31')]);_0x5b2f9b[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0x99eba4[_0xc4df('0x33')]);_0x5b2f9b[_0xc4df('0x49')]=_['intersection'](_0x5b2f9b[_0xc4df('0x36')],_0x5b2f9b[_0xc4df('0x33')]);_0x5673ab[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x5b2f9b['model'],qs['fields'](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x38')]));_0x5673ab[_0xc4df('0x37')]=_0x5673ab['attributes'][_0xc4df('0x39')]?_0x5673ab[_0xc4df('0x37')]:_0x5b2f9b['model'];_0x5673ab[_0xc4df('0x3b')]=qs[_0xc4df('0x3c')](_0x99eba4[_0xc4df('0x33')]['sort']);_0x5673ab[_0xc4df('0x3d')]=qs[_0xc4df('0x49')](_['pick'](_0x99eba4[_0xc4df('0x33')],_0x5b2f9b[_0xc4df('0x49')]));if(_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3f')]){_0x5673ab['where']=_[_0xc4df('0x43')](_0x5673ab['where'],{'$or':_[_0xc4df('0x40')](_0x5673ab[_0xc4df('0x37')],function(_0x3b0946){var _0x7e4fe2={};_0x7e4fe2[_0x3b0946]={'$like':'%'+_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x7e4fe2;})});}_0x5673ab=_['merge']({},_0x5673ab,_0x99eba4[_0xc4df('0x44')]);return _0x8dcaca[_0xc4df('0x64')](_0x5673ab);}})[_0xc4df('0x2b')](function(_0x192993){if(_0x192993){_0x4afb94=_0x192993[_0xc4df('0x39')];if(!_0x99eba4[_0xc4df('0x33')][_0xc4df('0x3a')]('nolimit')){_0x5673ab[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x23')]);_0x5673ab[_0xc4df('0x22')]=qs['offset'](_0x99eba4[_0xc4df('0x33')][_0xc4df('0x22')]);}return _0x8dcaca[_0xc4df('0x64')](_0x5673ab);}})[_0xc4df('0x2b')](function(_0x4c72b4){if(_0x4c72b4){return _0x4c72b4?{'count':_0x4afb94,'rows':_0x4c72b4}:null;}})[_0xc4df('0x2b')](respondWithResult(_0x4a128a,null))[_0xc4df('0x48')](handleError(_0x4a128a,null));};exports[_0xc4df('0x66')]=function(_0x4fba4b,_0x20dda6,_0x3998f3){var _0x5a700d=_0x4fba4b[_0xc4df('0x4c')][_0xc4df('0x67')];return db[_0xc4df('0x65')]['findAll']({'where':{'id':_0x5a700d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4df('0x68'),'attributes':['id',_0xc4df('0x2e'),_0xc4df('0x69'),'voicePause','interface'],'raw':!![]}]})[_0xc4df('0x2b')](function(_0x5c5746){if(_0x5c5746){var _0x52ebc5=_[_0xc4df('0x6a')](_0x5c5746,function(_0x327358){var _0x33e8f2=_0x327358[_0xc4df('0x28')]({'plain':!![]});return _0x33e8f2[_0xc4df('0x68')];});return db[_0xc4df('0x30')]['find']({'where':{'id':_0x4fba4b[_0xc4df('0x56')]['id']}})['then'](function(_0x7420b8){return db[_0xc4df('0x6b')][_0xc4df('0x6c')](function(_0x163e6f){return _0x7420b8[_0xc4df('0x66')](_0x5a700d,{'transaction':_0x163e6f})[_0xc4df('0x2b')](function(){return BPromise[_0xc4df('0x6d')](_0x52ebc5,function(_0x34c905){return db[_0xc4df('0x5a')][_0xc4df('0x6e')]({'where':{'UserId':_0x34c905['id'],'MailQueueId':_0x4fba4b[_0xc4df('0x56')]['id']},'transaction':_0x163e6f});});})['then'](function(){_0x52ebc5[_0xc4df('0x6f')](function(_0x4b6932){socket[_0xc4df('0x70')](_0xc4df('0x71'),{'UserId':_0x4b6932['id'],'MailQueueId':_0x7420b8['id']});});});});});}})['then'](respondWithStatusCode(_0x20dda6,null))['catch'](handleError(_0x20dda6,null));};exports[_0xc4df('0x72')]=function(_0x578195,_0x5016d2,_0x437c21){return db[_0xc4df('0x65')]['findAll']({'where':{'id':_0x578195['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc4df('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4df('0x2b')](handleEntityNotFound(_0x5016d2,null))[_0xc4df('0x2b')](function(_0xc76173){var _0x36b950=_[_0xc4df('0x40')](_0xc76173,'id');var _0x1bda8b=[];var _0x49fc82=[];var _0x5a5008=squel['select']();_0x5a5008[_0xc4df('0x74')](_0xc4df('0x75'))[_0xc4df('0x76')](_0xc4df('0x77'),'tq')[_0xc4df('0x78')](_0xc4df('0x79'),'ut',_0xc4df('0x7a'))[_0xc4df('0x3d')](_0xc4df('0x7b'),_0x578195[_0xc4df('0x56')]['id']);for(var _0x5f0144=0x0;_0x5f0144<_0xc76173['length'];_0x5f0144+=0x1){let _0x50bddd=_0xc76173[_0x5f0144];for(var _0x1bef4d=0x0;_0x1bef4d<_0x50bddd[_0xc4df('0x68')][_0xc4df('0x39')];_0x1bef4d+=0x1){let _0x1bc29c=_0x50bddd[_0xc4df('0x68')][_0x1bef4d];var _0x268bbb=_0x5a5008[_0xc4df('0x7c')]();_0x268bbb[_0xc4df('0x3d')](_0xc4df('0x7d'),_0x1bc29c['id']);_0x49fc82['push'](db[_0xc4df('0x6b')][_0xc4df('0x33')](_0x268bbb[_0xc4df('0x7e')](),{'type':db[_0xc4df('0x6b')][_0xc4df('0x7f')]['SELECT']})[_0xc4df('0x2b')](function(_0x2f5aab){if(_0x2f5aab['length']===0x1){return _0x1bc29c['id'];}else{var _0x94b2e7=_[_0xc4df('0x80')](_[_0xc4df('0x40')](_0x2f5aab,_0xc4df('0x81')),function(_0x2b5447){return _[_0xc4df('0x82')](_0x36b950,_0x2b5447);});if(_0x94b2e7){return _0x1bc29c['id'];}}}));}}return BPromise[_0xc4df('0x83')](_0x49fc82)['then'](function(_0x3ba929){_0x1bda8b=_(_0x1bda8b)[_0xc4df('0x84')](_0x3ba929)[_0xc4df('0x85')]()['value']();return db['MailQueue'][_0xc4df('0x4a')]({'where':{'id':_0x578195[_0xc4df('0x56')]['id']}})['then'](function(_0x1c1128){return db['sequelize'][_0xc4df('0x6c')](function(_0x570de0){return _0x1c1128[_0xc4df('0x72')](_0x578195[_0xc4df('0x33')][_0xc4df('0x67')],{'transaction':_0x570de0})[_0xc4df('0x2b')](function(){if(!_[_0xc4df('0x86')](_0x1bda8b)){return _0x1c1128[_0xc4df('0x87')](_0x1bda8b,{'transaction':_0x570de0});}})[_0xc4df('0x2b')](function(){_0x1bda8b['forEach'](function(_0xde4809){socket['emit'](_0xc4df('0x88'),{'UserId':_0xde4809,'MailQueueId':_0x1c1128['id']});});});});});});})[_0xc4df('0x2b')](respondWithStatusCode(_0x5016d2,null))[_0xc4df('0x48')](handleError(_0x5016d2,null));};exports[_0xc4df('0x89')]=function(_0x5c950e,_0x137eee,_0x41d050){return db[_0xc4df('0x30')]['find']({'where':{'id':_0x5c950e[_0xc4df('0x56')]['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x137eee,null))[_0xc4df('0x2b')](function(_0x3b9345){if(_0x3b9345){return _0x3b9345[_0xc4df('0x89')](_0x5c950e['body']['ids'],_[_0xc4df('0x8a')](_0x5c950e['body'],['ids','id'])||{})[_0xc4df('0x8b')](function(_0x2d45d6){for(var _0x314e30=0x0;_0x314e30<_0x5c950e[_0xc4df('0x4c')][_0xc4df('0x67')]['length'];_0x314e30+=0x1){socket[_0xc4df('0x70')]('userMailQueue:save',{'UserId':_0x5c950e['body']['ids'][_0x314e30],'MailQueueId':_0x5c950e[_0xc4df('0x56')]['id']});}return _0x2d45d6;});}})[_0xc4df('0x2b')](respondWithResult(_0x137eee,null))[_0xc4df('0x48')](handleError(_0x137eee,null));};exports[_0xc4df('0x87')]=function(_0x293559,_0x450261,_0xeaabbd){return db[_0xc4df('0x30')]['find']({'where':{'id':_0x293559['params']['id']}})[_0xc4df('0x2b')](handleEntityNotFound(_0x450261,null))[_0xc4df('0x2b')](function(_0x1d7ae3){if(_0x1d7ae3){return _0x1d7ae3[_0xc4df('0x87')](_0x293559[_0xc4df('0x33')]['ids'])[_0xc4df('0x2b')](function(){if(_['isArray'](_0x293559[_0xc4df('0x33')]['ids'])){for(var _0x55d604=0x0;_0x55d604<_0x293559[_0xc4df('0x33')][_0xc4df('0x67')][_0xc4df('0x39')];_0x55d604+=0x1){socket['emit'](_0xc4df('0x88'),{'UserId':Number(_0x293559['query'][_0xc4df('0x67')][_0x55d604]),'MailQueueId':Number(_0x293559[_0xc4df('0x56')]['id'])});}}else{socket[_0xc4df('0x70')](_0xc4df('0x88'),{'UserId':Number(_0x293559[_0xc4df('0x33')][_0xc4df('0x67')]),'MailQueueId':Number(_0x293559[_0xc4df('0x56')]['id'])});}});}})[_0xc4df('0x2b')](respondWithStatusCode(_0x450261,null))[_0xc4df('0x48')](handleError(_0x450261,null));};exports[_0xc4df('0x8c')]=function(_0xd52151,_0x379dde,_0x143345){var _0xccf6cc={};var _0x86fe66={};var _0x32644b;var _0x492ba6;return db[_0xc4df('0x30')][_0xc4df('0x59')]({'where':{'id':_0xd52151[_0xc4df('0x56')]['id']}})['then'](handleEntityNotFound(_0x379dde,null))[_0xc4df('0x2b')](function(_0x567634){if(_0x567634){_0x32644b=_0x567634;_0x86fe66[_0xc4df('0x36')]=_[_0xc4df('0x34')](db[_0xc4df('0x73')][_0xc4df('0x31')]);_0x86fe66[_0xc4df('0x33')]=_[_0xc4df('0x34')](_0xd52151[_0xc4df('0x33')]);_0x86fe66[_0xc4df('0x49')]=_[_0xc4df('0x35')](_0x86fe66[_0xc4df('0x36')],_0x86fe66[_0xc4df('0x33')]);_0xccf6cc[_0xc4df('0x37')]=_[_0xc4df('0x35')](_0x86fe66[_0xc4df('0x36')],qs[_0xc4df('0x38')](_0xd52151[_0xc4df('0x33')]['fields']));_0xccf6cc[_0xc4df('0x37')]=_0xccf6cc['attributes']['length']?_0xccf6cc[_0xc4df('0x37')]:_0x86fe66['model'];_0xccf6cc[_0xc4df('0x3b')]=qs['sort'](_0xd52151[_0xc4df('0x33')]['sort']);_0xccf6cc[_0xc4df('0x3d')]=qs['filters'](_[_0xc4df('0x3e')](_0xd52151[_0xc4df('0x33')],_0x86fe66['filters']));if(_0xd52151[_0xc4df('0x33')]['filter']){_0xccf6cc['where']=_[_0xc4df('0x43')](_0xccf6cc[_0xc4df('0x3d')],{'$or':_[_0xc4df('0x40')](_0xccf6cc[_0xc4df('0x37')],function(_0x5165bb){var _0x2a1dc9={};_0x2a1dc9[_0x5165bb]={'$like':'%'+_0xd52151[_0xc4df('0x33')][_0xc4df('0x3f')]+'%'};return _0x2a1dc9;})});}_0xccf6cc=_[_0xc4df('0x43')]({},_0xccf6cc,_0xd52151[_0xc4df('0x44')]);return _0x32644b['getAgents'](_0xccf6cc);}})['then'](function(_0x54aca4){if(_0x54aca4){_0x492ba6=_0x54aca4[_0xc4df('0x39')];if(!_0xd52151[_0xc4df('0x33')][_0xc4df('0x3a')](_0xc4df('0x5b'))){_0xccf6cc[_0xc4df('0x23')]=qs[_0xc4df('0x23')](_0xd52151[_0xc4df('0x33')][_0xc4df('0x23')]);_0xccf6cc[_0xc4df('0x22')]=qs[_0xc4df('0x22')](_0xd52151[_0xc4df('0x33')]['offset']);}return _0x32644b[_0xc4df('0x8c')](_0xccf6cc);}})['then'](function(_0x55f662){if(_0x55f662){return _0x55f662?{'count':_0x492ba6,'rows':_0x55f662}:null;}})[_0xc4df('0x2b')](respondWithResult(_0x379dde,null))[_0xc4df('0x48')](handleError(_0x379dde,null));}; \ No newline at end of file +var _0xd506=['QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','addAgents','spread','isArray','userMailQueue:remove','getAgents','html-pdf','mustache','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','../../mysqldb','redis','defaults','localhost','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','include','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd506,0x197));var _0x6d50=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xd506[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0x6d50('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d50('0x1'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6d50('0x2'));var ejs=require(_0x6d50('0x3'));var fs=require('fs');var _=require(_0x6d50('0x4'));var squel=require('squel');var crypto=require(_0x6d50('0x5'));var jsforce=require(_0x6d50('0x6'));var deskjs=require(_0x6d50('0x7'));var toCsv=require('to-csv');var querystring=require(_0x6d50('0x8'));var Papa=require('papaparse');var Redis=require(_0x6d50('0x9'));var authService=require(_0x6d50('0xa'));var qs=require(_0x6d50('0xb'));var as=require(_0x6d50('0xc'));var hardwareService=require(_0x6d50('0xd'));var logger=require(_0x6d50('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d50('0xf'));var db=require(_0x6d50('0x10'))['db'];config[_0x6d50('0x11')]=_[_0x6d50('0x12')](config['redis'],{'host':_0x6d50('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d50('0x11')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4da1c4,_0x3ea2e4){_0x3ea2e4=_0x3ea2e4||0xcc;return function(_0x5875d4){if(_0x5875d4){return _0x4da1c4[_0x6d50('0x14')](_0x3ea2e4);}return _0x4da1c4[_0x6d50('0x15')](_0x3ea2e4)['end']();};}function respondWithResult(_0x599f10,_0xcb07fd){_0xcb07fd=_0xcb07fd||0xc8;return function(_0x2ee296){if(_0x2ee296){return _0x599f10[_0x6d50('0x15')](_0xcb07fd)['json'](_0x2ee296);}};}function respondWithFilteredResult(_0x2ee037,_0x1ac038){return function(_0x466d5f){if(_0x466d5f){var _0x3e7898=_0x466d5f[_0x6d50('0x16')],_0x46e254=_0x1ac038[_0x6d50('0x17')],_0x5938d5=_0x1ac038['offset']+_0x1ac038[_0x6d50('0x18')],_0x4cca66;if(_0x5938d5>=_0x3e7898){_0x5938d5=_0x3e7898;_0x4cca66=0xc8;}else{_0x4cca66=0xce;}_0x2ee037['status'](_0x4cca66);return _0x2ee037[_0x6d50('0x19')](_0x6d50('0x1a'),_0x46e254+'-'+_0x5938d5+'/'+_0x3e7898)[_0x6d50('0x1b')](_0x466d5f);}return null;};}function patchUpdates(_0x578533){return function(_0x4fbe30){try{jsonpatch['apply'](_0x4fbe30,_0x578533,!![]);}catch(_0x305d1b){return BPromise[_0x6d50('0x1c')](_0x305d1b);}return _0x4fbe30['save']();};}function saveUpdates(_0x48d452,_0x5a06d9){return function(_0x4efc34){if(_0x4efc34){return _0x4efc34[_0x6d50('0x1d')](_0x48d452)[_0x6d50('0x1e')](function(_0x2095e3){return _0x2095e3;});}return null;};}function removeEntity(_0x35b711,_0x34d25e){return function(_0xd8e384){if(_0xd8e384){return _0xd8e384[_0x6d50('0x1f')]()['then'](function(){var _0x1ee589=_0xd8e384[_0x6d50('0x20')]({'plain':!![]});var _0x54d67e=_0x6d50('0x21');return db[_0x6d50('0x22')]['destroy']({'where':{'type':_0x54d67e,'resourceId':_0x1ee589['id']}})['then'](function(){return _0xd8e384;});})[_0x6d50('0x1e')](function(){_0x35b711[_0x6d50('0x15')](0xcc)[_0x6d50('0x23')]();});}};}function handleEntityNotFound(_0x520b57,_0x56a8e4){return function(_0x11b530){if(!_0x11b530){_0x520b57[_0x6d50('0x14')](0x194);}return _0x11b530;};}function handleError(_0x315be1,_0x1d1e73){_0x1d1e73=_0x1d1e73||0x1f4;return function(_0x377334){logger[_0x6d50('0x24')](_0x377334[_0x6d50('0x25')]);if(_0x377334[_0x6d50('0x26')]){delete _0x377334['name'];}_0x315be1[_0x6d50('0x15')](_0x1d1e73)[_0x6d50('0x27')](_0x377334);};}exports[_0x6d50('0x28')]=function(_0x5745a9,_0x123216){var _0x2d6db1={},_0x1ae5c7={},_0x2f8415={'count':0x0,'rows':[]};var _0x27b9e5=_[_0x6d50('0x29')](db[_0x6d50('0x2a')][_0x6d50('0x2b')],function(_0xe2a654){return{'name':_0xe2a654[_0x6d50('0x2c')],'type':_0xe2a654['type'][_0x6d50('0x2d')]};});_0x1ae5c7[_0x6d50('0x2e')]=_[_0x6d50('0x29')](_0x27b9e5,_0x6d50('0x26'));_0x1ae5c7[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x5745a9['query']);_0x1ae5c7[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x1ae5c7[_0x6d50('0x2e')],_0x1ae5c7[_0x6d50('0x2f')]);_0x2d6db1[_0x6d50('0x33')]=_['intersection'](_0x1ae5c7['model'],qs[_0x6d50('0x34')](_0x5745a9[_0x6d50('0x2f')]['fields']));_0x2d6db1[_0x6d50('0x33')]=_0x2d6db1[_0x6d50('0x33')][_0x6d50('0x35')]?_0x2d6db1[_0x6d50('0x33')]:_0x1ae5c7[_0x6d50('0x2e')];if(!_0x5745a9[_0x6d50('0x2f')]['hasOwnProperty']('nolimit')){_0x2d6db1[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x18')]);_0x2d6db1[_0x6d50('0x17')]=qs['offset'](_0x5745a9[_0x6d50('0x2f')]['offset']);}_0x2d6db1['order']=qs['sort'](_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x2d6db1[_0x6d50('0x37')]=qs['filters'](_['pick'](_0x5745a9[_0x6d50('0x2f')],_0x1ae5c7[_0x6d50('0x31')]),_0x27b9e5);if(_0x5745a9[_0x6d50('0x2f')]['filter']){_0x2d6db1[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x2d6db1[_0x6d50('0x37')],{'$or':_[_0x6d50('0x29')](_0x27b9e5,function(_0x105660){if(_0x105660['type']!=='VIRTUAL'){var _0xcf1496={};_0xcf1496[_0x105660[_0x6d50('0x26')]]={'$like':'%'+_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0xcf1496;}})});}_0x2d6db1=_[_0x6d50('0x38')]({},_0x2d6db1,_0x5745a9[_0x6d50('0x3a')]);var _0x3a5a0e={'where':_0x2d6db1[_0x6d50('0x37')]};return db[_0x6d50('0x2a')][_0x6d50('0x16')](_0x3a5a0e)[_0x6d50('0x1e')](function(_0x5905e6){_0x2f8415[_0x6d50('0x16')]=_0x5905e6;if(_0x5745a9[_0x6d50('0x2f')]['includeAll']){_0x2d6db1[_0x6d50('0x3b')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x2d6db1);})[_0x6d50('0x1e')](function(_0x50b493){_0x2f8415[_0x6d50('0x3c')]=_0x50b493;return _0x2f8415;})[_0x6d50('0x1e')](respondWithFilteredResult(_0x123216,_0x2d6db1))['catch'](handleError(_0x123216,null));};exports[_0x6d50('0x3d')]=function(_0x36edcf,_0x5345b9){var _0x5da7ac={'raw':!![],'where':{'id':_0x36edcf[_0x6d50('0x3e')]['id']}},_0x4afb7c={};_0x4afb7c[_0x6d50('0x2e')]=_[_0x6d50('0x30')](db['MailQueue'][_0x6d50('0x2b')]);_0x4afb7c[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x36edcf[_0x6d50('0x2f')]);_0x4afb7c[_0x6d50('0x31')]=_['intersection'](_0x4afb7c[_0x6d50('0x2e')],_0x4afb7c[_0x6d50('0x2f')]);_0x5da7ac[_0x6d50('0x33')]=_[_0x6d50('0x32')](_0x4afb7c['model'],qs['fields'](_0x36edcf[_0x6d50('0x2f')][_0x6d50('0x34')]));_0x5da7ac['attributes']=_0x5da7ac['attributes']['length']?_0x5da7ac['attributes']:_0x4afb7c[_0x6d50('0x2e')];if(_0x36edcf[_0x6d50('0x2f')][_0x6d50('0x3f')]){_0x5da7ac['include']=[{'all':!![]}];}_0x5da7ac=_[_0x6d50('0x38')]({},_0x5da7ac,_0x36edcf[_0x6d50('0x3a')]);return db[_0x6d50('0x2a')]['find'](_0x5da7ac)[_0x6d50('0x1e')](handleEntityNotFound(_0x5345b9,null))[_0x6d50('0x1e')](respondWithResult(_0x5345b9,null))[_0x6d50('0x40')](handleError(_0x5345b9,null));};exports['create']=function(_0x5e731a,_0x3ad350){return db[_0x6d50('0x2a')][_0x6d50('0x41')](_0x5e731a[_0x6d50('0x42')],{})[_0x6d50('0x1e')](function(_0x41921d){var _0xeabb2a=_0x5e731a[_0x6d50('0x43')][_0x6d50('0x20')]({'plain':!![]});if(!_0xeabb2a)throw new Error(_0x6d50('0x44'));if(_0xeabb2a['role']===_0x6d50('0x43')){var _0x1e4b16=_0x41921d[_0x6d50('0x20')]({'plain':!![]});var _0x434878=_0x6d50('0x21');return db[_0x6d50('0x45')]['find']({'where':{'name':_0x434878,'userProfileId':_0xeabb2a[_0x6d50('0x46')]},'raw':!![]})[_0x6d50('0x1e')](function(_0x428950){if(_0x428950&&_0x428950['autoAssociation']===0x0){return db['UserProfileResource'][_0x6d50('0x41')]({'name':_0x1e4b16[_0x6d50('0x26')],'resourceId':_0x1e4b16['id'],'type':_0x428950[_0x6d50('0x26')],'sectionId':_0x428950['id']},{})[_0x6d50('0x1e')](function(){return _0x41921d;});}else{return _0x41921d;}})[_0x6d50('0x40')](function(_0xe0a104){logger['error'](_0x6d50('0x47'),_0xe0a104);throw _0xe0a104;});}return _0x41921d;})[_0x6d50('0x1e')](respondWithResult(_0x3ad350,0xc9))[_0x6d50('0x40')](handleError(_0x3ad350,null));};exports[_0x6d50('0x1d')]=function(_0x4da8a0,_0x17dbf9){if(_0x4da8a0[_0x6d50('0x42')]['id']){delete _0x4da8a0[_0x6d50('0x42')]['id'];}return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x4da8a0[_0x6d50('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17dbf9,null))['then'](saveUpdates(_0x4da8a0[_0x6d50('0x42')],null))[_0x6d50('0x1e')](respondWithResult(_0x17dbf9,null))[_0x6d50('0x40')](handleError(_0x17dbf9,null));};exports['destroy']=function(_0x249437,_0x124abe){return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x249437['params']['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x124abe,null))['then'](removeEntity(_0x124abe,null))['catch'](handleError(_0x124abe,null));};exports[_0x6d50('0x49')]=function(_0xa18425,_0x4f5bfa){return db[_0x6d50('0x2a')]['describe']()[_0x6d50('0x1e')](respondWithResult(_0x4f5bfa,null))['catch'](handleError(_0x4f5bfa,null));};exports['getMembers']=function(_0x2da6b0,_0x133c2e,_0x310f41){var _0x5d3807={'raw':!![],'where':{}},_0x23cc58={},_0x4e3bd9;return db['MailQueue'][_0x6d50('0x4a')]({'where':{'id':_0x2da6b0[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x133c2e,null))[_0x6d50('0x1e')](function(_0x367a7c){if(_0x367a7c){_0x4e3bd9=_0x367a7c[_0x6d50('0x20')]({'plain':!![]});_0x23cc58['model']=_[_0x6d50('0x30')](db[_0x6d50('0x4b')][_0x6d50('0x2b')]);_0x23cc58[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x2da6b0[_0x6d50('0x2f')]);_0x23cc58[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x23cc58[_0x6d50('0x2e')],_0x23cc58[_0x6d50('0x2f')]);_0x5d3807[_0x6d50('0x33')]=_[_0x6d50('0x32')](_0x23cc58[_0x6d50('0x2e')],qs['fields'](_0x2da6b0['query'][_0x6d50('0x34')]));_0x5d3807[_0x6d50('0x33')]=_0x5d3807[_0x6d50('0x33')][_0x6d50('0x35')]?_0x5d3807['attributes']:_0x23cc58[_0x6d50('0x2e')];if(!_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x5d3807[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x2da6b0[_0x6d50('0x2f')]['limit']);_0x5d3807['offset']=qs[_0x6d50('0x17')](_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x17')]);}_0x5d3807[_0x6d50('0x4e')]=qs[_0x6d50('0x36')](_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x5d3807[_0x6d50('0x37')]=qs['filters'](_[_0x6d50('0x4f')](_0x2da6b0['query'],_0x23cc58[_0x6d50('0x31')]));_0x5d3807[_0x6d50('0x37')][_0x6d50('0x50')]=_0x367a7c['id'];if(_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x39')]){_0x5d3807['where']=_[_0x6d50('0x38')](_0x5d3807[_0x6d50('0x37')],{'$or':_['map'](_0x5d3807[_0x6d50('0x33')],function(_0x1723a5){var _0x36253e={};_0x36253e[_0x1723a5]={'$like':'%'+_0x2da6b0[_0x6d50('0x2f')]['filter']+'%'};return _0x36253e;})});}_0x5d3807=_[_0x6d50('0x38')]({},_0x5d3807,_0x2da6b0['options']);return db['UserMailQueue']['findAll'](_0x5d3807);}})[_0x6d50('0x1e')](function(_0x207fec){if(_0x207fec){return db[_0x6d50('0x51')][_0x6d50('0x52')]({'where':{'id':_[_0x6d50('0x29')](_0x207fec,_0x6d50('0x53')),'role':_0x6d50('0x54')},'attributes':['id',_0x6d50('0x26'),_0x6d50('0x55'),_0x6d50('0x56'),'createdAt']});}})[_0x6d50('0x1e')](function(_0x54a0fc){if(_0x54a0fc){return{'count':_0x54a0fc[_0x6d50('0x16')],'rows':_[_0x6d50('0x29')](_0x54a0fc[_0x6d50('0x3c')],function(_0x4b8cd0){return{'membername':_0x4b8cd0[_0x6d50('0x26')],'UserId':_0x4b8cd0['id'],'queue_name':_0x4e3bd9[_0x6d50('0x26')],'MailQueueId':_0x4e3bd9['id'],'interface':util['format'](_0x6d50('0x57'),_0x6d50('0x58'),_0x4b8cd0[_0x6d50('0x26')]),'penalty':0x0,'paused':_0x4b8cd0[_0x6d50('0x55')],'createdAt':_0x4b8cd0['createdAt'],'updatedAt':_0x4b8cd0[_0x6d50('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x133c2e,_0x5d3807))['catch'](handleError(_0x133c2e,null));};exports['getTeams']=function(_0x10a6d6,_0xf43a08,_0x31b418){var _0x28243e={};var _0x481019={};var _0x4c05c7;var _0x38d408;return db[_0x6d50('0x2a')][_0x6d50('0x4a')]({'where':{'id':_0x10a6d6[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0xf43a08,null))[_0x6d50('0x1e')](function(_0xe79209){if(_0xe79209){_0x4c05c7=_0xe79209;_0x481019[_0x6d50('0x2e')]=_[_0x6d50('0x30')](db[_0x6d50('0x59')][_0x6d50('0x2b')]);_0x481019[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x10a6d6[_0x6d50('0x2f')]);_0x481019['filters']=_[_0x6d50('0x32')](_0x481019[_0x6d50('0x2e')],_0x481019[_0x6d50('0x2f')]);_0x28243e[_0x6d50('0x33')]=_['intersection'](_0x481019[_0x6d50('0x2e')],qs['fields'](_0x10a6d6[_0x6d50('0x2f')]['fields']));_0x28243e['attributes']=_0x28243e[_0x6d50('0x33')][_0x6d50('0x35')]?_0x28243e['attributes']:_0x481019[_0x6d50('0x2e')];_0x28243e['order']=qs[_0x6d50('0x36')](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x28243e[_0x6d50('0x37')]=qs[_0x6d50('0x31')](_[_0x6d50('0x4f')](_0x10a6d6[_0x6d50('0x2f')],_0x481019[_0x6d50('0x31')]));if(_0x10a6d6[_0x6d50('0x2f')]['filter']){_0x28243e[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x28243e[_0x6d50('0x37')],{'$or':_[_0x6d50('0x29')](_0x28243e['attributes'],function(_0x92d101){var _0x3a0674={};_0x3a0674[_0x92d101]={'$like':'%'+_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0x3a0674;})});}_0x28243e=_[_0x6d50('0x38')]({},_0x28243e,_0x10a6d6[_0x6d50('0x3a')]);return _0x4c05c7[_0x6d50('0x5a')](_0x28243e);}})[_0x6d50('0x1e')](function(_0x24faf6){if(_0x24faf6){_0x38d408=_0x24faf6[_0x6d50('0x35')];if(!_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x28243e[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x18')]);_0x28243e[_0x6d50('0x17')]=qs['offset'](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x17')]);}return _0x4c05c7[_0x6d50('0x5a')](_0x28243e);}})[_0x6d50('0x1e')](function(_0x5426cb){if(_0x5426cb){return _0x5426cb?{'count':_0x38d408,'rows':_0x5426cb}:null;}})[_0x6d50('0x1e')](respondWithResult(_0xf43a08,null))[_0x6d50('0x40')](handleError(_0xf43a08,null));};exports[_0x6d50('0x5b')]=function(_0x349b2c,_0x1bb5d8,_0x298e62){var _0x47df3e=_0x349b2c[_0x6d50('0x42')][_0x6d50('0x5c')];return db[_0x6d50('0x59')]['findAll']({'where':{'id':_0x47df3e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x6d50('0x26'),_0x6d50('0x5d'),_0x6d50('0x5e'),_0x6d50('0x5f')],'raw':!![]}]})[_0x6d50('0x1e')](function(_0x2225fc){if(_0x2225fc){var _0x15b5ba=_[_0x6d50('0x60')](_0x2225fc,function(_0x370b8c){var _0x2df18d=_0x370b8c[_0x6d50('0x20')]({'plain':!![]});return _0x2df18d[_0x6d50('0x61')];});return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x349b2c[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](function(_0x43e738){return db[_0x6d50('0x62')][_0x6d50('0x63')](function(_0x41684b){return _0x43e738[_0x6d50('0x5b')](_0x47df3e,{'transaction':_0x41684b})['then'](function(){return BPromise[_0x6d50('0x64')](_0x15b5ba,function(_0xbf0e9e){return db['UserMailQueue'][_0x6d50('0x65')]({'where':{'UserId':_0xbf0e9e['id'],'MailQueueId':_0x349b2c[_0x6d50('0x3e')]['id']},'transaction':_0x41684b});});})[_0x6d50('0x1e')](function(){_0x15b5ba[_0x6d50('0x66')](function(_0x560e7a){socket[_0x6d50('0x67')](_0x6d50('0x68'),{'UserId':_0x560e7a['id'],'MailQueueId':_0x43e738['id']});});});});});}})[_0x6d50('0x1e')](respondWithStatusCode(_0x1bb5d8,null))[_0x6d50('0x40')](handleError(_0x1bb5d8,null));};exports[_0x6d50('0x69')]=function(_0x423c1d,_0x249525,_0x302a82){return db[_0x6d50('0x59')][_0x6d50('0x6a')]({'where':{'id':_0x423c1d[_0x6d50('0x2f')][_0x6d50('0x5c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6d50('0x61'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x249525,null))[_0x6d50('0x1e')](function(_0x195b63){var _0x30433e=_[_0x6d50('0x29')](_0x195b63,'id');var _0x2240f0=[];var _0x2a061e=[];var _0x59b14d=squel[_0x6d50('0x6b')]();_0x59b14d[_0x6d50('0x6c')](_0x6d50('0x6d'))[_0x6d50('0x6e')]('team_has_mail_queues','tq')['join'](_0x6d50('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6d50('0x37')](_0x6d50('0x70'),_0x423c1d[_0x6d50('0x3e')]['id']);for(var _0x40987b=0x0;_0x40987b<_0x195b63['length'];_0x40987b+=0x1){let _0x461dff=_0x195b63[_0x40987b];for(var _0x1ca5f1=0x0;_0x1ca5f1<_0x461dff[_0x6d50('0x61')]['length'];_0x1ca5f1+=0x1){let _0x56156a=_0x461dff[_0x6d50('0x61')][_0x1ca5f1];var _0x4514bc=_0x59b14d[_0x6d50('0x71')]();_0x4514bc[_0x6d50('0x37')](_0x6d50('0x72'),_0x56156a['id']);_0x2a061e[_0x6d50('0x73')](db[_0x6d50('0x62')][_0x6d50('0x2f')](_0x4514bc[_0x6d50('0x74')](),{'type':db[_0x6d50('0x62')][_0x6d50('0x75')][_0x6d50('0x76')]})[_0x6d50('0x1e')](function(_0x112f66){if(_0x112f66[_0x6d50('0x35')]===0x1){return _0x56156a['id'];}else{var _0x411cb4=_[_0x6d50('0x77')](_['map'](_0x112f66,'TeamId'),function(_0x5bafd7){return _[_0x6d50('0x78')](_0x30433e,_0x5bafd7);});if(_0x411cb4){return _0x56156a['id'];}}}));}}return BPromise[_0x6d50('0x79')](_0x2a061e)[_0x6d50('0x1e')](function(_0x3a8057){_0x2240f0=_(_0x2240f0)[_0x6d50('0x7a')](_0x3a8057)[_0x6d50('0x7b')]()[_0x6d50('0x7c')]();return db[_0x6d50('0x2a')]['find']({'where':{'id':_0x423c1d[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](function(_0x1e117e){return db['sequelize'][_0x6d50('0x63')](function(_0x1fda4c){return _0x1e117e[_0x6d50('0x69')](_0x423c1d[_0x6d50('0x2f')]['ids'],{'transaction':_0x1fda4c})[_0x6d50('0x1e')](function(){if(!_['isEmpty'](_0x2240f0)){return _0x1e117e[_0x6d50('0x7d')](_0x2240f0,{'transaction':_0x1fda4c});}})['then'](function(){_0x2240f0['forEach'](function(_0x427b7d){socket[_0x6d50('0x67')]('userMailQueue:remove',{'UserId':_0x427b7d,'MailQueueId':_0x1e117e['id']});});});});});});})[_0x6d50('0x1e')](respondWithStatusCode(_0x249525,null))[_0x6d50('0x40')](handleError(_0x249525,null));};exports[_0x6d50('0x7e')]=function(_0x5ea1b6,_0x43feb9,_0x3d6d31){return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x5ea1b6[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x43feb9,null))['then'](function(_0x5105f1){if(_0x5105f1){return _0x5105f1['addAgents'](_0x5ea1b6['body'][_0x6d50('0x5c')],_['omit'](_0x5ea1b6[_0x6d50('0x42')],[_0x6d50('0x5c'),'id'])||{})[_0x6d50('0x7f')](function(_0x591a10){for(var _0x4760bb=0x0;_0x4760bb<_0x5ea1b6[_0x6d50('0x42')][_0x6d50('0x5c')]['length'];_0x4760bb+=0x1){socket[_0x6d50('0x67')]('userMailQueue:save',{'UserId':_0x5ea1b6['body'][_0x6d50('0x5c')][_0x4760bb],'MailQueueId':_0x5ea1b6[_0x6d50('0x3e')]['id']});}return _0x591a10;});}})[_0x6d50('0x1e')](respondWithResult(_0x43feb9,null))[_0x6d50('0x40')](handleError(_0x43feb9,null));};exports[_0x6d50('0x7d')]=function(_0x3721e4,_0x3b535a,_0x52c076){return db['MailQueue'][_0x6d50('0x48')]({'where':{'id':_0x3721e4[_0x6d50('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b535a,null))['then'](function(_0x5e0066){if(_0x5e0066){return _0x5e0066['removeAgents'](_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')])['then'](function(){if(_[_0x6d50('0x80')](_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')])){for(var _0x364b56=0x0;_0x364b56<_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')]['length'];_0x364b56+=0x1){socket[_0x6d50('0x67')]('userMailQueue:remove',{'UserId':Number(_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')][_0x364b56]),'MailQueueId':Number(_0x3721e4[_0x6d50('0x3e')]['id'])});}}else{socket[_0x6d50('0x67')](_0x6d50('0x81'),{'UserId':Number(_0x3721e4['query']['ids']),'MailQueueId':Number(_0x3721e4[_0x6d50('0x3e')]['id'])});}});}})[_0x6d50('0x1e')](respondWithStatusCode(_0x3b535a,null))['catch'](handleError(_0x3b535a,null));};exports[_0x6d50('0x82')]=function(_0x3e63e3,_0x243022,_0x528bf1){var _0x436a4c={};var _0x18a015={};var _0x38427b;var _0x1b0ac7;return db[_0x6d50('0x2a')][_0x6d50('0x4a')]({'where':{'id':_0x3e63e3['params']['id']}})['then'](handleEntityNotFound(_0x243022,null))[_0x6d50('0x1e')](function(_0x58e3aa){if(_0x58e3aa){_0x38427b=_0x58e3aa;_0x18a015['model']=_[_0x6d50('0x30')](db[_0x6d50('0x51')][_0x6d50('0x2b')]);_0x18a015[_0x6d50('0x2f')]=_['keys'](_0x3e63e3[_0x6d50('0x2f')]);_0x18a015[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x18a015[_0x6d50('0x2e')],_0x18a015[_0x6d50('0x2f')]);_0x436a4c['attributes']=_[_0x6d50('0x32')](_0x18a015[_0x6d50('0x2e')],qs[_0x6d50('0x34')](_0x3e63e3[_0x6d50('0x2f')]['fields']));_0x436a4c[_0x6d50('0x33')]=_0x436a4c[_0x6d50('0x33')][_0x6d50('0x35')]?_0x436a4c[_0x6d50('0x33')]:_0x18a015[_0x6d50('0x2e')];_0x436a4c[_0x6d50('0x4e')]=qs['sort'](_0x3e63e3['query'][_0x6d50('0x36')]);_0x436a4c[_0x6d50('0x37')]=qs[_0x6d50('0x31')](_[_0x6d50('0x4f')](_0x3e63e3['query'],_0x18a015['filters']));if(_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x39')]){_0x436a4c[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x436a4c['where'],{'$or':_[_0x6d50('0x29')](_0x436a4c[_0x6d50('0x33')],function(_0x2d65a4){var _0xe9fe7b={};_0xe9fe7b[_0x2d65a4]={'$like':'%'+_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0xe9fe7b;})});}_0x436a4c=_[_0x6d50('0x38')]({},_0x436a4c,_0x3e63e3['options']);return _0x38427b['getAgents'](_0x436a4c);}})[_0x6d50('0x1e')](function(_0x4b33c5){if(_0x4b33c5){_0x1b0ac7=_0x4b33c5[_0x6d50('0x35')];if(!_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x436a4c[_0x6d50('0x18')]=qs['limit'](_0x3e63e3['query'][_0x6d50('0x18')]);_0x436a4c['offset']=qs[_0x6d50('0x17')](_0x3e63e3['query'][_0x6d50('0x17')]);}return _0x38427b['getAgents'](_0x436a4c);}})[_0x6d50('0x1e')](function(_0x5bd198){if(_0x5bd198){return _0x5bd198?{'count':_0x1b0ac7,'rows':_0x5bd198}:null;}})['then'](respondWithResult(_0x243022,null))[_0x6d50('0x40')](handleError(_0x243022,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5acc9c8..b24feca 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 _0x967c=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2bbdf3,_0x4764d3){var _0x1e324d=function(_0x42dfd7){while(--_0x42dfd7){_0x2bbdf3['push'](_0x2bbdf3['shift']());}};_0x1e324d(++_0x4764d3);}(_0x967c,0x14a));var _0xc967=function(_0x1d6ccd,_0x3e316c){_0x1d6ccd=_0x1d6ccd-0x0;var _0x1ba76c=_0x967c[_0x1d6ccd];return _0x1ba76c;};'use strict';var EventEmitter=require(_0xc967('0x0'));var MailQueue=require(_0xc967('0x1'))['db'][_0xc967('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc967('0x3')](0x0);var events={'afterCreate':_0xc967('0x4'),'afterUpdate':_0xc967('0x5'),'afterDestroy':_0xc967('0x6')};function emitEvent(_0x3fb3fe){return function(_0x425c42,_0x28f890,_0x44d440){MailQueueEvents[_0xc967('0x7')](_0x3fb3fe+':'+_0x425c42['id'],_0x425c42);MailQueueEvents['emit'](_0x3fb3fe,_0x425c42);_0x44d440(null);};}for(var e in events){if(events[_0xc967('0x8')](e)){var event=events[e];MailQueue[_0xc967('0x9')](e,emitEvent(event));}}module[_0xc967('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xdb57=['setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x1e67e0,_0x43cc4b){var _0x108b34=function(_0x5cc50e){while(--_0x5cc50e){_0x1e67e0['push'](_0x1e67e0['shift']());}};_0x108b34(++_0x43cc4b);}(_0xdb57,0x11d));var _0x7db5=function(_0x56753a,_0x269d41){_0x56753a=_0x56753a-0x0;var _0x7bc06d=_0xdb57[_0x56753a];return _0x7bc06d;};'use strict';var EventEmitter=require(_0x7db5('0x0'));var MailQueue=require(_0x7db5('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7db5('0x2')](0x0);var events={'afterCreate':_0x7db5('0x3'),'afterUpdate':_0x7db5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33dde8){return function(_0x26b752,_0x459186,_0x1ea8dc){MailQueueEvents[_0x7db5('0x5')](_0x33dde8+':'+_0x26b752['id'],_0x26b752);MailQueueEvents[_0x7db5('0x5')](_0x33dde8,_0x26b752);_0x1ea8dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7db5('0x6')](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 36fae3a..b4444bc 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 _0x0a96=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','../../config/logger','api','moment','bluebird'];(function(_0x96cefd,_0x25cb5d){var _0x4310c1=function(_0x4e9c5f){while(--_0x4e9c5f){_0x96cefd['push'](_0x96cefd['shift']());}};_0x4310c1(++_0x25cb5d);}(_0x0a96,0x141));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60a9('0x0'))(_0x60a9('0x1'));var moment=require(_0x60a9('0x2'));var BPromise=require(_0x60a9('0x3'));var rp=require(_0x60a9('0x4'));var fs=require('fs');var path=require(_0x60a9('0x5'));var rimraf=require(_0x60a9('0x6'));var config=require(_0x60a9('0x7'));var attributes=require(_0x60a9('0x8'));module[_0x60a9('0x9')]=function(_0x4eeb2c,_0x1fc1ff){return _0x4eeb2c[_0x60a9('0xa')](_0x60a9('0xb'),attributes,{'tableName':_0x60a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd987=['lodash','util','api','moment','bluebird','request-promise','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x528314,_0x4d6ed7){var _0x23d2d0=function(_0x3712a5){while(--_0x3712a5){_0x528314['push'](_0x528314['shift']());}};_0x23d2d0(++_0x4d6ed7);}(_0xd987,0x186));var _0x7d98=function(_0x2c4960,_0x44d821){_0x2c4960=_0x2c4960-0x0;var _0x2d08ab=_0xd987[_0x2c4960];return _0x2d08ab;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var logger=require('../../config/logger')(_0x7d98('0x2'));var moment=require(_0x7d98('0x3'));var BPromise=require(_0x7d98('0x4'));var rp=require(_0x7d98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d98('0x6'));module[_0x7d98('0x7')]=function(_0x4c0e50,_0x14a267){return _0x4c0e50[_0x7d98('0x8')](_0x7d98('0x9'),attributes,{'tableName':'mail_queues','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 63ac381..fd7b55a 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 _0xc4dd=['MailQueue,\x20%s,\x20%s','message','catch','MailQueue','options','raw','where','attributes','limit','include','map','model','GetMailQueue','stringify','ShowMailQueue','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','request','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x54aac5,_0x1118b3){var _0x443bcc=function(_0x4e8e4e){while(--_0x4e8e4e){_0x54aac5['push'](_0x54aac5['shift']());}};_0x443bcc(++_0x1118b3);}(_0xc4dd,0x1cd));var _0xdc4d=function(_0x2efb63,_0x3e1acd){_0x2efb63=_0x2efb63-0x0;var _0x557c62=_0xc4dd[_0x2efb63];return _0x557c62;};'use strict';var _=require('lodash');var util=require(_0xdc4d('0x0'));var moment=require(_0xdc4d('0x1'));var BPromise=require(_0xdc4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc4d('0x3'));var db=require(_0xdc4d('0x4'))['db'];var utils=require(_0xdc4d('0x5'));var logger=require(_0xdc4d('0x6'))(_0xdc4d('0x7'));var config=require(_0xdc4d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc4d('0x9')]({'port':0x232a});config[_0xdc4d('0xa')]=_[_0xdc4d('0xb')](config[_0xdc4d('0xa')],{'host':_0xdc4d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4100d8,_0x52ba9c,_0x593129){return new BPromise(function(_0x481975,_0x4ebf12){return client[_0xdc4d('0xd')](_0x4100d8,_0x593129)['then'](function(_0x21aba1){logger[_0xdc4d('0xe')]('MailQueue,\x20%s,\x20%s',_0x52ba9c,'request\x20sent');logger[_0xdc4d('0xf')](_0xdc4d('0x10'),_0x52ba9c,_0xdc4d('0x11'),JSON['stringify'](_0x21aba1));if(_0x21aba1['error']){if(_0x21aba1[_0xdc4d('0x12')][_0xdc4d('0x13')]===0x1f4){logger[_0xdc4d('0x12')](_0xdc4d('0x14'),_0x52ba9c,_0x21aba1[_0xdc4d('0x12')][_0xdc4d('0x15')]);return _0x4ebf12(_0x21aba1[_0xdc4d('0x12')]['message']);}logger[_0xdc4d('0x12')]('MailQueue,\x20%s,\x20%s',_0x52ba9c,_0x21aba1[_0xdc4d('0x12')]['message']);return _0x481975(_0x21aba1['error'][_0xdc4d('0x15')]);}else{logger['info'](_0xdc4d('0x14'),_0x52ba9c,_0xdc4d('0x11'));_0x481975(_0x21aba1['result'][_0xdc4d('0x15')]);}})[_0xdc4d('0x16')](function(_0x2d0117){logger['error']('MailQueue,\x20%s,\x20%s',_0x52ba9c,_0x2d0117);_0x4ebf12(_0x2d0117);});});}exports['GetMailQueue']=function(_0x5ddf4a){var _0x28823c=this;return new Promise(function(_0x23c03d,_0x3c388a){return db[_0xdc4d('0x17')]['findAll']({'raw':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x19')]===undefined?!![]:![]:!![],'where':_0x5ddf4a['options']?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1a')]||null:null,'attributes':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1b')]||null:null,'limit':_0x5ddf4a[_0xdc4d('0x18')]?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1c')]||null:null,'include':_0x5ddf4a['options']?_0x5ddf4a[_0xdc4d('0x18')][_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x5ddf4a[_0xdc4d('0x18')]['include'],function(_0x1a8985){return{'model':db[_0x1a8985[_0xdc4d('0x1f')]],'as':_0x1a8985['as'],'attributes':_0x1a8985[_0xdc4d('0x1b')],'include':_0x1a8985[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x1a8985[_0xdc4d('0x1d')],function(_0x2291ed){return{'model':db[_0x2291ed[_0xdc4d('0x1f')]],'as':_0x2291ed['as'],'attributes':_0x2291ed['attributes'],'include':_0x2291ed['include']?_['map'](_0x2291ed[_0xdc4d('0x1d')],function(_0x49c4b3){return{'model':db[_0x49c4b3[_0xdc4d('0x1f')]],'as':_0x49c4b3['as'],'attributes':_0x49c4b3[_0xdc4d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26af9f){logger['info'](_0xdc4d('0x20'),_0x5ddf4a);logger[_0xdc4d('0xf')]('GetMailQueue',_0x5ddf4a,JSON[_0xdc4d('0x21')](_0x26af9f));_0x23c03d(_0x26af9f);})[_0xdc4d('0x16')](function(_0x1b42ba){logger[_0xdc4d('0x12')](_0xdc4d('0x20'),_0x1b42ba['message'],_0x5ddf4a);_0x3c388a(_0x28823c[_0xdc4d('0x12')](0x1f4,_0x1b42ba['message']));});});};exports[_0xdc4d('0x22')]=function(_0x49f312){var _0x35cab0=this;return new Promise(function(_0x3bb473,_0x48c7b0){return db['MailQueue'][_0xdc4d('0x23')]({'raw':_0x49f312[_0xdc4d('0x18')]?_0x49f312['options'][_0xdc4d('0x19')]===undefined?!![]:![]:!![],'where':_0x49f312[_0xdc4d('0x18')]?_0x49f312['options'][_0xdc4d('0x1a')]||null:null,'attributes':_0x49f312[_0xdc4d('0x18')]?_0x49f312[_0xdc4d('0x18')][_0xdc4d('0x1b')]||null:null,'include':_0x49f312[_0xdc4d('0x18')]?_0x49f312[_0xdc4d('0x18')][_0xdc4d('0x1d')]?_['map'](_0x49f312['options'][_0xdc4d('0x1d')],function(_0xf9c6c3){return{'model':db[_0xf9c6c3[_0xdc4d('0x1f')]],'as':_0xf9c6c3['as'],'attributes':_0xf9c6c3[_0xdc4d('0x1b')],'include':_0xf9c6c3[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0xf9c6c3[_0xdc4d('0x1d')],function(_0x23aa1b){return{'model':db[_0x23aa1b[_0xdc4d('0x1f')]],'as':_0x23aa1b['as'],'attributes':_0x23aa1b['attributes'],'include':_0x23aa1b[_0xdc4d('0x1d')]?_[_0xdc4d('0x1e')](_0x23aa1b[_0xdc4d('0x1d')],function(_0x2b74c5){return{'model':db[_0x2b74c5['model']],'as':_0x2b74c5['as'],'attributes':_0x2b74c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc4d('0x24')](function(_0x5532a6){logger[_0xdc4d('0xe')](_0xdc4d('0x22'),_0x49f312);logger[_0xdc4d('0xf')](_0xdc4d('0x22'),_0x49f312,JSON[_0xdc4d('0x21')](_0x5532a6));_0x3bb473(_0x5532a6);})[_0xdc4d('0x16')](function(_0x40f88b){logger[_0xdc4d('0x12')](_0xdc4d('0x22'),_0x40f88b[_0xdc4d('0x15')],_0x49f312);_0x48c7b0(_0x35cab0['error'](0x1f4,_0x40f88b[_0xdc4d('0x15')]));});});}; \ No newline at end of file +var _0xbee5=['catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','map','model','ShowMailQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message'];(function(_0x38bdff,_0x4633e4){var _0x4ce52e=function(_0x2b35c1){while(--_0x2b35c1){_0x38bdff['push'](_0x38bdff['shift']());}};_0x4ce52e(++_0x4633e4);}(_0xbee5,0x110));var _0x5bee=function(_0x4735f9,_0x243a06){_0x4735f9=_0x4735f9-0x0;var _0x6f14d9=_0xbee5[_0x4735f9];return _0x6f14d9;};'use strict';var _=require(_0x5bee('0x0'));var util=require(_0x5bee('0x1'));var moment=require(_0x5bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bee('0x3'));var fs=require('fs');var Redis=require(_0x5bee('0x4'));var db=require(_0x5bee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bee('0x6'))('rpc');var config=require(_0x5bee('0x7'));var jayson=require(_0x5bee('0x8'));var client=jayson[_0x5bee('0x9')]['http']({'port':0x232a});config[_0x5bee('0xa')]=_[_0x5bee('0xb')](config[_0x5bee('0xa')],{'host':_0x5bee('0xc'),'port':0x18eb});var socket=require(_0x5bee('0xd'))(new Redis(config[_0x5bee('0xa')]));require(_0x5bee('0xe'))['register'](socket);function respondWithRpcPromise(_0x39ac3d,_0x161942,_0x44d6cb){return new BPromise(function(_0x127319,_0x17d164){return client['request'](_0x39ac3d,_0x44d6cb)[_0x5bee('0xf')](function(_0x438c45){logger[_0x5bee('0x10')]('MailQueue,\x20%s,\x20%s',_0x161942,_0x5bee('0x11'));logger[_0x5bee('0x12')](_0x5bee('0x13'),_0x161942,_0x5bee('0x11'),JSON[_0x5bee('0x14')](_0x438c45));if(_0x438c45[_0x5bee('0x15')]){if(_0x438c45[_0x5bee('0x15')]['code']===0x1f4){logger[_0x5bee('0x15')](_0x5bee('0x16'),_0x161942,_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);return _0x17d164(_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);}logger[_0x5bee('0x15')]('MailQueue,\x20%s,\x20%s',_0x161942,_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);return _0x127319(_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);}else{logger[_0x5bee('0x10')](_0x5bee('0x16'),_0x161942,_0x5bee('0x11'));_0x127319(_0x438c45['result'][_0x5bee('0x17')]);}})[_0x5bee('0x18')](function(_0x18490f){logger[_0x5bee('0x15')](_0x5bee('0x16'),_0x161942,_0x18490f);_0x17d164(_0x18490f);});});}exports[_0x5bee('0x19')]=function(_0xd53d8e){var _0xaad4a7=this;return new Promise(function(_0x375e56,_0x3f00ae){return db[_0x5bee('0x1a')][_0x5bee('0x1b')]({'raw':_0xd53d8e['options']?_0xd53d8e[_0x5bee('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options']['where']||null:null,'attributes':_0xd53d8e['options']?_0xd53d8e[_0x5bee('0x1c')][_0x5bee('0x1d')]||null:null,'limit':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options'][_0x5bee('0x1e')]||null:null,'include':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options'][_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0xd53d8e['options'][_0x5bee('0x1f')],function(_0x2abadc){return{'model':db[_0x2abadc[_0x5bee('0x21')]],'as':_0x2abadc['as'],'attributes':_0x2abadc[_0x5bee('0x1d')],'include':_0x2abadc[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x2abadc[_0x5bee('0x1f')],function(_0x102219){return{'model':db[_0x102219[_0x5bee('0x21')]],'as':_0x102219['as'],'attributes':_0x102219[_0x5bee('0x1d')],'include':_0x102219[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x102219['include'],function(_0x47cf06){return{'model':db[_0x47cf06[_0x5bee('0x21')]],'as':_0x47cf06['as'],'attributes':_0x47cf06[_0x5bee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5bee('0xf')](function(_0xe91c65){logger['info'](_0x5bee('0x19'),_0xd53d8e);logger[_0x5bee('0x12')](_0x5bee('0x19'),_0xd53d8e,JSON[_0x5bee('0x14')](_0xe91c65));_0x375e56(_0xe91c65);})[_0x5bee('0x18')](function(_0x22a63d){logger['error'](_0x5bee('0x19'),_0x22a63d[_0x5bee('0x17')],_0xd53d8e);_0x3f00ae(_0xaad4a7[_0x5bee('0x15')](0x1f4,_0x22a63d[_0x5bee('0x17')]));});});};exports[_0x5bee('0x22')]=function(_0x1bf360){var _0x305e8c=this;return new Promise(function(_0x441ed7,_0x193230){return db[_0x5bee('0x1a')][_0x5bee('0x23')]({'raw':_0x1bf360['options']?_0x1bf360[_0x5bee('0x1c')][_0x5bee('0x24')]===undefined?!![]:![]:!![],'where':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')]['where']||null:null,'attributes':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')]['attributes']||null:null,'include':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')][_0x5bee('0x1f')]?_['map'](_0x1bf360['options']['include'],function(_0x455cd6){return{'model':db[_0x455cd6[_0x5bee('0x21')]],'as':_0x455cd6['as'],'attributes':_0x455cd6[_0x5bee('0x1d')],'include':_0x455cd6[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x455cd6['include'],function(_0x3e0940){return{'model':db[_0x3e0940[_0x5bee('0x21')]],'as':_0x3e0940['as'],'attributes':_0x3e0940['attributes'],'include':_0x3e0940['include']?_[_0x5bee('0x20')](_0x3e0940[_0x5bee('0x1f')],function(_0x31cbbe){return{'model':db[_0x31cbbe[_0x5bee('0x21')]],'as':_0x31cbbe['as'],'attributes':_0x31cbbe[_0x5bee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5bee('0xf')](function(_0x370e04){logger['info']('ShowMailQueue',_0x1bf360);logger[_0x5bee('0x12')](_0x5bee('0x22'),_0x1bf360,JSON[_0x5bee('0x14')](_0x370e04));_0x441ed7(_0x370e04);})['catch'](function(_0x19f85f){logger['error'](_0x5bee('0x22'),_0x19f85f[_0x5bee('0x17')],_0x1bf360);_0x193230(_0x305e8c['error'](0x1f4,_0x19f85f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0a05f61..c10c1d8 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 _0x1185=['save','remove','update','emit','removeListener','register','./mailQueue.events'];(function(_0x42bad2,_0x3e870b){var _0x49ef6c=function(_0x2e336a){while(--_0x2e336a){_0x42bad2['push'](_0x42bad2['shift']());}};_0x49ef6c(++_0x3e870b);}(_0x1185,0x11e));var _0x5118=function(_0x375e02,_0x218683){_0x375e02=_0x375e02-0x0;var _0x53ae3d=_0x1185[_0x375e02];return _0x53ae3d;};'use strict';var MailQueueEvents=require(_0x5118('0x0'));var events=[_0x5118('0x1'),_0x5118('0x2'),_0x5118('0x3')];function createListener(_0x4e8731,_0x229a84){return function(_0x453c1d){_0x229a84[_0x5118('0x4')](_0x4e8731,_0x453c1d);};}function removeListener(_0x223185,_0x151186){return function(){MailQueueEvents[_0x5118('0x5')](_0x223185,_0x151186);};}exports[_0x5118('0x6')]=function(_0xd86ba3){for(var _0x591789=0x0,_0x7a8d48=events['length'];_0x591789<_0x7a8d48;_0x591789++){var _0xdbc58e=events[_0x591789];var _0xd04988=createListener('mailQueue:'+_0xdbc58e,_0xd86ba3);MailQueueEvents['on'](_0xdbc58e,_0xd04988);}}; \ No newline at end of file +var _0x5c57=['removeListener','register','mailQueue:','./mailQueue.events','save','update'];(function(_0x61e5ab,_0x37dbf7){var _0x48aff9=function(_0x4945f5){while(--_0x4945f5){_0x61e5ab['push'](_0x61e5ab['shift']());}};_0x48aff9(++_0x37dbf7);}(_0x5c57,0x189));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x75c5('0x0'));var events=[_0x75c5('0x1'),'remove',_0x75c5('0x2')];function createListener(_0xbe61a8,_0x374f25){return function(_0x3ccb8a){_0x374f25['emit'](_0xbe61a8,_0x3ccb8a);};}function removeListener(_0x437c31,_0x4cfa17){return function(){MailQueueEvents[_0x75c5('0x3')](_0x437c31,_0x4cfa17);};}exports[_0x75c5('0x4')]=function(_0x62c98a){for(var _0xb8b2e4=0x0,_0x4e566a=events['length'];_0xb8b2e4<_0x4e566a;_0xb8b2e4++){var _0x2f4de9=events[_0xb8b2e4];var _0x2a969f=createListener(_0x75c5('0x5')+_0x2f4de9,_0x62c98a);MailQueueEvents['on'](_0x2f4de9,_0x2a969f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0545bf7..642ba74 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 _0xcc11=['../../config/environment','./mailQueueReport.controller','get','describe','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53d18b,_0x1ccaf9){var _0x58f31e=function(_0x4b2733){while(--_0x4b2733){_0x53d18b['push'](_0x53d18b['shift']());}};_0x58f31e(++_0x1ccaf9);}(_0xcc11,0x162));var _0x1cc1=function(_0x5de97d,_0x1141ee){_0x5de97d=_0x5de97d-0x0;var _0x2da950=_0xcc11[_0x5de97d];return _0x2da950;};'use strict';var multer=require(_0x1cc1('0x0'));var util=require('util');var path=require(_0x1cc1('0x1'));var timeout=require('connect-timeout');var express=require(_0x1cc1('0x2'));var router=express[_0x1cc1('0x3')]();var auth=require(_0x1cc1('0x4'));var interaction=require(_0x1cc1('0x5'));var config=require(_0x1cc1('0x6'));var controller=require(_0x1cc1('0x7'));router[_0x1cc1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1cc1('0x9')]);router['get'](_0x1cc1('0xa'),auth[_0x1cc1('0xb')](),controller[_0x1cc1('0xc')]);router[_0x1cc1('0xd')]('/',auth[_0x1cc1('0xb')](),controller[_0x1cc1('0xe')]);router[_0x1cc1('0xf')](_0x1cc1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1cc1('0x10')](_0x1cc1('0xa'),auth[_0x1cc1('0xb')](),controller['destroy']);module[_0x1cc1('0x11')]=router; \ No newline at end of file +var _0x74c6=['destroy','exports','util','path','express','Router','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','isAuthenticated','/:id','create','update'];(function(_0x2955ed,_0x244239){var _0x1e5b07=function(_0x5e6b29){while(--_0x5e6b29){_0x2955ed['push'](_0x2955ed['shift']());}};_0x1e5b07(++_0x244239);}(_0x74c6,0xb6));var _0x674c=function(_0x1d37b5,_0x17e279){_0x1d37b5=_0x1d37b5-0x0;var _0x1c289c=_0x74c6[_0x1d37b5];return _0x1c289c;};'use strict';var multer=require('multer');var util=require(_0x674c('0x0'));var path=require(_0x674c('0x1'));var timeout=require('connect-timeout');var express=require(_0x674c('0x2'));var router=express[_0x674c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x674c('0x4'));var config=require('../../config/environment');var controller=require(_0x674c('0x5'));router[_0x674c('0x6')]('/',auth['isAuthenticated'](),controller[_0x674c('0x7')]);router[_0x674c('0x6')](_0x674c('0x8'),auth[_0x674c('0x9')](),controller['describe']);router['get'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller['show']);router['post']('/',auth[_0x674c('0x9')](),controller[_0x674c('0xb')]);router['put'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller[_0x674c('0xc')]);router['delete'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller[_0x674c('0xd')]);module[_0x674c('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d6eba7e..a735d8d 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 _0xdc1e=['sequelize','STRING','DATE','moment'];(function(_0x47fd17,_0x4f7037){var _0x353a4b=function(_0x16badc){while(--_0x16badc){_0x47fd17['push'](_0x47fd17['shift']());}};_0x353a4b(++_0x4f7037);}(_0xdc1e,0x1a3));var _0xedc1=function(_0x5230f1,_0x3e7346){_0x5230f1=_0x5230f1-0x0;var _0x1c0a48=_0xdc1e[_0x5230f1];return _0x1c0a48;};'use strict';var moment=require(_0xedc1('0x0'));var Sequelize=require(_0xedc1('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xedc1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xedc1('0x2')]},'joinAt':{'type':Sequelize[_0xedc1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xedc1('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xedc1('0x2')]}}; \ No newline at end of file +var _0xf02d=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf02d,0xc5));var _0xdf02=function(_0x423269,_0x355384){_0x423269=_0x423269-0x0;var _0x490e2b=_0xf02d[_0x423269];return _0x490e2b;};'use strict';var moment=require(_0xdf02('0x0'));var Sequelize=require(_0xdf02('0x1'));module[_0xdf02('0x2')]={'uniqueid':{'type':Sequelize[_0xdf02('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdf02('0x3')]},'joinAt':{'type':Sequelize[_0xdf02('0x4')]},'leaveAt':{'type':Sequelize[_0xdf02('0x4')]},'acceptAt':{'type':Sequelize[_0xdf02('0x4')]},'exitAt':{'type':Sequelize[_0xdf02('0x4')]},'reason':{'type':Sequelize[_0xdf02('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a224ab2..c52ec10 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 _0x2cc7=['status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','rows','fields','options','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x3aa138,_0x3a919c){var _0x4b2974=function(_0x35c1de){while(--_0x35c1de){_0x3aa138['push'](_0x3aa138['shift']());}};_0x4b2974(++_0x3a919c);}(_0x2cc7,0x7a));var _0x72cc=function(_0x43195c,_0x174aff){_0x43195c=_0x43195c-0x0;var _0x532de1=_0x2cc7[_0x43195c];return _0x532de1;};'use strict';var pdf=require(_0x72cc('0x0'));var emlformat=require(_0x72cc('0x1'));var rimraf=require(_0x72cc('0x2'));var zipdir=require(_0x72cc('0x3'));var jsonpatch=require(_0x72cc('0x4'));var rp=require(_0x72cc('0x5'));var moment=require(_0x72cc('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72cc('0x7'));var path=require(_0x72cc('0x8'));var sox=require(_0x72cc('0x9'));var csv=require(_0x72cc('0xa'));var ejs=require(_0x72cc('0xb'));var fs=require('fs');var _=require(_0x72cc('0xc'));var squel=require(_0x72cc('0xd'));var crypto=require(_0x72cc('0xe'));var jsforce=require(_0x72cc('0xf'));var deskjs=require(_0x72cc('0x10'));var toCsv=require(_0x72cc('0xa'));var querystring=require(_0x72cc('0x11'));var Papa=require(_0x72cc('0x12'));var Redis=require('ioredis');var authService=require(_0x72cc('0x13'));var qs=require(_0x72cc('0x14'));var as=require(_0x72cc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72cc('0x16'))('api');var utils=require(_0x72cc('0x17'));var config=require(_0x72cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x72cc('0x19'))['db'];function respondWithStatusCode(_0x5957ba,_0x14c98b){_0x14c98b=_0x14c98b||0xcc;return function(_0x1f00a5){if(_0x1f00a5){return _0x5957ba[_0x72cc('0x1a')](_0x14c98b);}return _0x5957ba['status'](_0x14c98b)[_0x72cc('0x1b')]();};}function respondWithResult(_0x26250a,_0x584f5c){_0x584f5c=_0x584f5c||0xc8;return function(_0x503e56){if(_0x503e56){return _0x26250a[_0x72cc('0x1c')](_0x584f5c)['json'](_0x503e56);}};}function respondWithFilteredResult(_0x581b90,_0x5d036f){return function(_0x40cc15){if(_0x40cc15){var _0x29ba14=_0x40cc15[_0x72cc('0x1d')],_0x198694=_0x5d036f[_0x72cc('0x1e')],_0x35f189=_0x5d036f[_0x72cc('0x1e')]+_0x5d036f[_0x72cc('0x1f')],_0x7efc1e;if(_0x35f189>=_0x29ba14){_0x35f189=_0x29ba14;_0x7efc1e=0xc8;}else{_0x7efc1e=0xce;}_0x581b90['status'](_0x7efc1e);return _0x581b90['set'](_0x72cc('0x20'),_0x198694+'-'+_0x35f189+'/'+_0x29ba14)[_0x72cc('0x21')](_0x40cc15);}return null;};}function patchUpdates(_0x3a2b5b){return function(_0x5f0da9){try{jsonpatch[_0x72cc('0x22')](_0x5f0da9,_0x3a2b5b,!![]);}catch(_0x4ae1ab){return BPromise[_0x72cc('0x23')](_0x4ae1ab);}return _0x5f0da9[_0x72cc('0x24')]();};}function saveUpdates(_0xab1563,_0x3c9350){return function(_0xb46012){if(_0xb46012){return _0xb46012[_0x72cc('0x25')](_0xab1563)[_0x72cc('0x26')](function(_0x28ed2b){return _0x28ed2b;});}return null;};}function removeEntity(_0x210cd7,_0x432638){return function(_0x5d6716){if(_0x5d6716){return _0x5d6716[_0x72cc('0x27')]()[_0x72cc('0x26')](function(){_0x210cd7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5edd81,_0x5c2f03){return function(_0x32b922){if(!_0x32b922){_0x5edd81[_0x72cc('0x1a')](0x194);}return _0x32b922;};}function handleError(_0xf1de6c,_0x5a16bc){_0x5a16bc=_0x5a16bc||0x1f4;return function(_0x59f91a){logger['error'](_0x59f91a[_0x72cc('0x28')]);if(_0x59f91a[_0x72cc('0x29')]){delete _0x59f91a[_0x72cc('0x29')];}_0xf1de6c[_0x72cc('0x1c')](_0x5a16bc)['send'](_0x59f91a);};}exports['index']=function(_0x292b54,_0x50ed67){var _0x487ce3={},_0x36478f={},_0x18e890={'count':0x0,'rows':[]};var _0x46ef0d=_[_0x72cc('0x2a')](db['MailQueueReport'][_0x72cc('0x2b')],function(_0x292cea){return{'name':_0x292cea['fieldName'],'type':_0x292cea['type'][_0x72cc('0x2c')]};});_0x36478f['model']=_[_0x72cc('0x2a')](_0x46ef0d,_0x72cc('0x29'));_0x36478f[_0x72cc('0x2d')]=_[_0x72cc('0x2e')](_0x292b54[_0x72cc('0x2d')]);_0x36478f[_0x72cc('0x2f')]=_['intersection'](_0x36478f[_0x72cc('0x30')],_0x36478f['query']);_0x487ce3[_0x72cc('0x31')]=_[_0x72cc('0x32')](_0x36478f['model'],qs['fields'](_0x292b54[_0x72cc('0x2d')]['fields']));_0x487ce3[_0x72cc('0x31')]=_0x487ce3[_0x72cc('0x31')][_0x72cc('0x33')]?_0x487ce3['attributes']:_0x36478f[_0x72cc('0x30')];if(!_0x292b54[_0x72cc('0x2d')][_0x72cc('0x34')](_0x72cc('0x35'))){_0x487ce3[_0x72cc('0x1f')]=qs['limit'](_0x292b54[_0x72cc('0x2d')][_0x72cc('0x1f')]);_0x487ce3[_0x72cc('0x1e')]=qs[_0x72cc('0x1e')](_0x292b54[_0x72cc('0x2d')]['offset']);}_0x487ce3[_0x72cc('0x36')]=qs['sort'](_0x292b54[_0x72cc('0x2d')][_0x72cc('0x37')]);_0x487ce3[_0x72cc('0x38')]=qs[_0x72cc('0x2f')](_[_0x72cc('0x39')](_0x292b54['query'],_0x36478f['filters']),_0x46ef0d);if(_0x292b54['query'][_0x72cc('0x3a')]){_0x487ce3['where']=_['merge'](_0x487ce3[_0x72cc('0x38')],{'$or':_[_0x72cc('0x2a')](_0x46ef0d,function(_0x22be09){if(_0x22be09[_0x72cc('0x3b')]!==_0x72cc('0x3c')){var _0x13e230={};_0x13e230[_0x22be09[_0x72cc('0x29')]]={'$like':'%'+_0x292b54['query']['filter']+'%'};return _0x13e230;}})});}_0x487ce3=_[_0x72cc('0x3d')]({},_0x487ce3,_0x292b54['options']);var _0x555385={'where':_0x487ce3['where']};return db[_0x72cc('0x3e')][_0x72cc('0x1d')](_0x555385)[_0x72cc('0x26')](function(_0x12cf85){_0x18e890[_0x72cc('0x1d')]=_0x12cf85;if(_0x292b54['query'][_0x72cc('0x3f')]){_0x487ce3[_0x72cc('0x40')]=[{'all':!![]}];}return db[_0x72cc('0x3e')][_0x72cc('0x41')](_0x487ce3);})[_0x72cc('0x26')](function(_0x231d89){_0x18e890[_0x72cc('0x42')]=_0x231d89;return _0x18e890;})['then'](respondWithFilteredResult(_0x50ed67,_0x487ce3))['catch'](handleError(_0x50ed67,null));};exports['show']=function(_0x450c17,_0x40009d){var _0x353bc9={'raw':!![],'where':{'id':_0x450c17['params']['id']}},_0x295e63={};_0x295e63[_0x72cc('0x30')]=_['keys'](db[_0x72cc('0x3e')][_0x72cc('0x2b')]);_0x295e63[_0x72cc('0x2d')]=_[_0x72cc('0x2e')](_0x450c17[_0x72cc('0x2d')]);_0x295e63[_0x72cc('0x2f')]=_[_0x72cc('0x32')](_0x295e63[_0x72cc('0x30')],_0x295e63[_0x72cc('0x2d')]);_0x353bc9[_0x72cc('0x31')]=_['intersection'](_0x295e63['model'],qs[_0x72cc('0x43')](_0x450c17['query']['fields']));_0x353bc9[_0x72cc('0x31')]=_0x353bc9['attributes'][_0x72cc('0x33')]?_0x353bc9[_0x72cc('0x31')]:_0x295e63['model'];if(_0x450c17[_0x72cc('0x2d')][_0x72cc('0x3f')]){_0x353bc9[_0x72cc('0x40')]=[{'all':!![]}];}_0x353bc9=_[_0x72cc('0x3d')]({},_0x353bc9,_0x450c17[_0x72cc('0x44')]);return db[_0x72cc('0x3e')][_0x72cc('0x45')](_0x353bc9)[_0x72cc('0x26')](handleEntityNotFound(_0x40009d,null))[_0x72cc('0x26')](respondWithResult(_0x40009d,null))[_0x72cc('0x46')](handleError(_0x40009d,null));};exports['create']=function(_0x52bd16,_0x18f228){return db[_0x72cc('0x3e')][_0x72cc('0x47')](_0x52bd16[_0x72cc('0x48')],{})[_0x72cc('0x26')](respondWithResult(_0x18f228,0xc9))[_0x72cc('0x46')](handleError(_0x18f228,null));};exports[_0x72cc('0x25')]=function(_0x50e7ae,_0x9fcb5f){if(_0x50e7ae['body']['id']){delete _0x50e7ae[_0x72cc('0x48')]['id'];}return db[_0x72cc('0x3e')][_0x72cc('0x45')]({'where':{'id':_0x50e7ae[_0x72cc('0x49')]['id']}})[_0x72cc('0x26')](handleEntityNotFound(_0x9fcb5f,null))['then'](saveUpdates(_0x50e7ae[_0x72cc('0x48')],null))[_0x72cc('0x26')](respondWithResult(_0x9fcb5f,null))[_0x72cc('0x46')](handleError(_0x9fcb5f,null));};exports[_0x72cc('0x27')]=function(_0x16efd2,_0x52152a){return db[_0x72cc('0x3e')]['find']({'where':{'id':_0x16efd2[_0x72cc('0x49')]['id']}})['then'](handleEntityNotFound(_0x52152a,null))[_0x72cc('0x26')](removeEntity(_0x52152a,null))[_0x72cc('0x46')](handleError(_0x52152a,null));};exports[_0x72cc('0x4a')]=function(_0x33a52e,_0x1bd78b){return db['MailQueueReport'][_0x72cc('0x4a')]()['then'](respondWithResult(_0x1bd78b,null))[_0x72cc('0x46')](handleError(_0x1bd78b,null));}; \ No newline at end of file +var _0x70b9=['show','intersection','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','MailQueueReport','count','includeAll','include','findAll','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x70b9,0x17a));var _0x970b=function(_0x1af10c,_0x54e3c3){_0x1af10c=_0x1af10c-0x0;var _0x46267c=_0x70b9[_0x1af10c];return _0x46267c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x970b('0x0'));var zipdir=require(_0x970b('0x1'));var jsonpatch=require(_0x970b('0x2'));var rp=require(_0x970b('0x3'));var moment=require(_0x970b('0x4'));var BPromise=require(_0x970b('0x5'));var Mustache=require(_0x970b('0x6'));var util=require(_0x970b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x970b('0x8'));var ejs=require(_0x970b('0x9'));var fs=require('fs');var _=require(_0x970b('0xa'));var squel=require('squel');var crypto=require(_0x970b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x970b('0xc'));var toCsv=require(_0x970b('0x8'));var querystring=require(_0x970b('0xd'));var Papa=require(_0x970b('0xe'));var Redis=require(_0x970b('0xf'));var authService=require(_0x970b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x970b('0x11'));var hardwareService=require(_0x970b('0x12'));var logger=require(_0x970b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x970b('0x14'));var licenseUtil=require(_0x970b('0x15'));var db=require(_0x970b('0x16'))['db'];function respondWithStatusCode(_0x2cce16,_0x1beb28){_0x1beb28=_0x1beb28||0xcc;return function(_0x2032fb){if(_0x2032fb){return _0x2cce16[_0x970b('0x17')](_0x1beb28);}return _0x2cce16[_0x970b('0x18')](_0x1beb28)['end']();};}function respondWithResult(_0x4056e8,_0x184ca8){_0x184ca8=_0x184ca8||0xc8;return function(_0x471bb5){if(_0x471bb5){return _0x4056e8[_0x970b('0x18')](_0x184ca8)[_0x970b('0x19')](_0x471bb5);}};}function respondWithFilteredResult(_0x1584dc,_0x443fca){return function(_0x4acced){if(_0x4acced){var _0x99ee4b=_0x4acced['count'],_0x397b89=_0x443fca[_0x970b('0x1a')],_0x41d361=_0x443fca['offset']+_0x443fca[_0x970b('0x1b')],_0x42d64c;if(_0x41d361>=_0x99ee4b){_0x41d361=_0x99ee4b;_0x42d64c=0xc8;}else{_0x42d64c=0xce;}_0x1584dc[_0x970b('0x18')](_0x42d64c);return _0x1584dc[_0x970b('0x1c')](_0x970b('0x1d'),_0x397b89+'-'+_0x41d361+'/'+_0x99ee4b)[_0x970b('0x19')](_0x4acced);}return null;};}function patchUpdates(_0x53f095){return function(_0x1daeb3){try{jsonpatch['apply'](_0x1daeb3,_0x53f095,!![]);}catch(_0x438181){return BPromise[_0x970b('0x1e')](_0x438181);}return _0x1daeb3[_0x970b('0x1f')]();};}function saveUpdates(_0x3397d1,_0x2baaec){return function(_0x2b89f8){if(_0x2b89f8){return _0x2b89f8[_0x970b('0x20')](_0x3397d1)[_0x970b('0x21')](function(_0x16bd3b){return _0x16bd3b;});}return null;};}function removeEntity(_0x255124,_0xd227a0){return function(_0x1415dd){if(_0x1415dd){return _0x1415dd['destroy']()[_0x970b('0x21')](function(){_0x255124['status'](0xcc)[_0x970b('0x22')]();});}};}function handleEntityNotFound(_0x1b285b,_0x228bb3){return function(_0x5a102e){if(!_0x5a102e){_0x1b285b[_0x970b('0x17')](0x194);}return _0x5a102e;};}function handleError(_0x13f51f,_0x57492d){_0x57492d=_0x57492d||0x1f4;return function(_0x29cc43){logger[_0x970b('0x23')](_0x29cc43[_0x970b('0x24')]);if(_0x29cc43['name']){delete _0x29cc43[_0x970b('0x25')];}_0x13f51f[_0x970b('0x18')](_0x57492d)['send'](_0x29cc43);};}exports[_0x970b('0x26')]=function(_0x4d8bf7,_0x1cc0de){var _0x1cb077={},_0x3f26d1={},_0x47033d={'count':0x0,'rows':[]};var _0x31313a=_[_0x970b('0x27')](db['MailQueueReport'][_0x970b('0x28')],function(_0x5794a9){return{'name':_0x5794a9[_0x970b('0x29')],'type':_0x5794a9[_0x970b('0x2a')][_0x970b('0x2b')]};});_0x3f26d1[_0x970b('0x2c')]=_[_0x970b('0x27')](_0x31313a,_0x970b('0x25'));_0x3f26d1['query']=_[_0x970b('0x2d')](_0x4d8bf7['query']);_0x3f26d1[_0x970b('0x2e')]=_['intersection'](_0x3f26d1[_0x970b('0x2c')],_0x3f26d1[_0x970b('0x2f')]);_0x1cb077['attributes']=_['intersection'](_0x3f26d1['model'],qs[_0x970b('0x30')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x30')]));_0x1cb077[_0x970b('0x31')]=_0x1cb077[_0x970b('0x31')][_0x970b('0x32')]?_0x1cb077[_0x970b('0x31')]:_0x3f26d1[_0x970b('0x2c')];if(!_0x4d8bf7['query'][_0x970b('0x33')](_0x970b('0x34'))){_0x1cb077[_0x970b('0x1b')]=qs[_0x970b('0x1b')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x1b')]);_0x1cb077[_0x970b('0x1a')]=qs[_0x970b('0x1a')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x1a')]);}_0x1cb077[_0x970b('0x35')]=qs[_0x970b('0x36')](_0x4d8bf7['query'][_0x970b('0x36')]);_0x1cb077[_0x970b('0x37')]=qs['filters'](_['pick'](_0x4d8bf7[_0x970b('0x2f')],_0x3f26d1[_0x970b('0x2e')]),_0x31313a);if(_0x4d8bf7['query']['filter']){_0x1cb077['where']=_['merge'](_0x1cb077[_0x970b('0x37')],{'$or':_[_0x970b('0x27')](_0x31313a,function(_0x4fdcc0){if(_0x4fdcc0[_0x970b('0x2a')]!==_0x970b('0x38')){var _0x3536f6={};_0x3536f6[_0x4fdcc0[_0x970b('0x25')]]={'$like':'%'+_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x39')]+'%'};return _0x3536f6;}})});}_0x1cb077=_[_0x970b('0x3a')]({},_0x1cb077,_0x4d8bf7[_0x970b('0x3b')]);var _0x5ebbda={'where':_0x1cb077[_0x970b('0x37')]};return db[_0x970b('0x3c')][_0x970b('0x3d')](_0x5ebbda)['then'](function(_0x515499){_0x47033d[_0x970b('0x3d')]=_0x515499;if(_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x3e')]){_0x1cb077[_0x970b('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0x970b('0x40')](_0x1cb077);})[_0x970b('0x21')](function(_0x19a8de){_0x47033d['rows']=_0x19a8de;return _0x47033d;})[_0x970b('0x21')](respondWithFilteredResult(_0x1cc0de,_0x1cb077))[_0x970b('0x41')](handleError(_0x1cc0de,null));};exports[_0x970b('0x42')]=function(_0x1ae6cb,_0x4719c8){var _0x266893={'raw':!![],'where':{'id':_0x1ae6cb['params']['id']}},_0x56af04={};_0x56af04[_0x970b('0x2c')]=_['keys'](db[_0x970b('0x3c')]['rawAttributes']);_0x56af04['query']=_[_0x970b('0x2d')](_0x1ae6cb['query']);_0x56af04['filters']=_[_0x970b('0x43')](_0x56af04[_0x970b('0x2c')],_0x56af04[_0x970b('0x2f')]);_0x266893[_0x970b('0x31')]=_['intersection'](_0x56af04[_0x970b('0x2c')],qs[_0x970b('0x30')](_0x1ae6cb['query'][_0x970b('0x30')]));_0x266893[_0x970b('0x31')]=_0x266893['attributes'][_0x970b('0x32')]?_0x266893['attributes']:_0x56af04[_0x970b('0x2c')];if(_0x1ae6cb[_0x970b('0x2f')][_0x970b('0x3e')]){_0x266893[_0x970b('0x3f')]=[{'all':!![]}];}_0x266893=_[_0x970b('0x3a')]({},_0x266893,_0x1ae6cb['options']);return db[_0x970b('0x3c')][_0x970b('0x44')](_0x266893)['then'](handleEntityNotFound(_0x4719c8,null))[_0x970b('0x21')](respondWithResult(_0x4719c8,null))[_0x970b('0x41')](handleError(_0x4719c8,null));};exports[_0x970b('0x45')]=function(_0x13c7fb,_0x2ecf8d){return db[_0x970b('0x3c')][_0x970b('0x45')](_0x13c7fb[_0x970b('0x46')],{})[_0x970b('0x21')](respondWithResult(_0x2ecf8d,0xc9))[_0x970b('0x41')](handleError(_0x2ecf8d,null));};exports[_0x970b('0x20')]=function(_0x13a0c3,_0x1a7f8a){if(_0x13a0c3[_0x970b('0x46')]['id']){delete _0x13a0c3['body']['id'];}return db[_0x970b('0x3c')][_0x970b('0x44')]({'where':{'id':_0x13a0c3[_0x970b('0x47')]['id']}})[_0x970b('0x21')](handleEntityNotFound(_0x1a7f8a,null))[_0x970b('0x21')](saveUpdates(_0x13a0c3[_0x970b('0x46')],null))[_0x970b('0x21')](respondWithResult(_0x1a7f8a,null))[_0x970b('0x41')](handleError(_0x1a7f8a,null));};exports[_0x970b('0x48')]=function(_0x2c7aa4,_0x4c6830){return db['MailQueueReport'][_0x970b('0x44')]({'where':{'id':_0x2c7aa4[_0x970b('0x47')]['id']}})[_0x970b('0x21')](handleEntityNotFound(_0x4c6830,null))['then'](removeEntity(_0x4c6830,null))[_0x970b('0x41')](handleError(_0x4c6830,null));};exports[_0x970b('0x49')]=function(_0x481de1,_0x2b0519){return db['MailQueueReport'][_0x970b('0x49')]()['then'](respondWithResult(_0x2b0519,null))['catch'](handleError(_0x2b0519,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d14e148..b3b05bb 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 _0xac22=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x279ab5,_0x35ab64){var _0x3d5a72=function(_0x48f8c5){while(--_0x48f8c5){_0x279ab5['push'](_0x279ab5['shift']());}};_0x3d5a72(++_0x35ab64);}(_0xac22,0x172));var _0x2ac2=function(_0x4fbf6f,_0x3aa1db){_0x4fbf6f=_0x4fbf6f-0x0;var _0x1730e9=_0xac22[_0x4fbf6f];return _0x1730e9;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var logger=require(_0x2ac2('0x2'))(_0x2ac2('0x3'));var moment=require('moment');var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require(_0x2ac2('0x7'));var config=require(_0x2ac2('0x8'));var attributes=require(_0x2ac2('0x9'));module[_0x2ac2('0xa')]=function(_0x57c3c3,_0x385015){return _0x57c3c3[_0x2ac2('0xb')](_0x2ac2('0xc'),attributes,{'tableName':_0x2ac2('0xd'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xe'),'fields':[_0x2ac2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b18=['util','api','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x4e2af7,_0x4d5fce){var _0x47a578=function(_0x159f07){while(--_0x159f07){_0x4e2af7['push'](_0x4e2af7['shift']());}};_0x47a578(++_0x4d5fce);}(_0x3b18,0xe4));var _0x83b1=function(_0x419a45,_0x34b2b1){_0x419a45=_0x419a45-0x0;var _0x13d057=_0x3b18[_0x419a45];return _0x13d057;};'use strict';var _=require('lodash');var util=require(_0x83b1('0x0'));var logger=require('../../config/logger')(_0x83b1('0x1'));var moment=require(_0x83b1('0x2'));var BPromise=require(_0x83b1('0x3'));var rp=require(_0x83b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83b1('0x5'));var attributes=require(_0x83b1('0x6'));module[_0x83b1('0x7')]=function(_0x12ca97,_0x51ec0d){return _0x12ca97[_0x83b1('0x8')](_0x83b1('0x9'),attributes,{'tableName':_0x83b1('0xa'),'paranoid':![],'indexes':[{'name':_0x83b1('0xb'),'fields':[_0x83b1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index bd74df1..cf8c907 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 _0x998d=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','util','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x998d,0x17e));var _0xd998=function(_0x4b07c0,_0x34e33a){_0x4b07c0=_0x4b07c0-0x0;var _0x2cdec3=_0x998d[_0x4b07c0];return _0x2cdec3;};'use strict';var _=require('lodash');var util=require(_0xd998('0x0'));var moment=require(_0xd998('0x1'));var BPromise=require(_0xd998('0x2'));var rs=require(_0xd998('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd998('0x4'))['db'];var utils=require(_0xd998('0x5'));var logger=require('../../config/logger')(_0xd998('0x6'));var config=require(_0xd998('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd998('0x8')][_0xd998('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x125e7b,_0x5dc5bb,_0x3b580a){return new BPromise(function(_0x3e8f11,_0x103ed7){return client[_0xd998('0xa')](_0x125e7b,_0x3b580a)[_0xd998('0xb')](function(_0x580de9){logger[_0xd998('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x5dc5bb,_0xd998('0xd'));logger[_0xd998('0xe')](_0xd998('0xf'),_0x5dc5bb,'request\x20sent',JSON[_0xd998('0x10')](_0x580de9));if(_0x580de9['error']){if(_0x580de9[_0xd998('0x11')]['code']===0x1f4){logger['error'](_0xd998('0x12'),_0x5dc5bb,_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);return _0x103ed7(_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);}logger[_0xd998('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x5dc5bb,_0x580de9['error'][_0xd998('0x13')]);return _0x3e8f11(_0x580de9[_0xd998('0x11')][_0xd998('0x13')]);}else{logger[_0xd998('0xc')](_0xd998('0x12'),_0x5dc5bb,'request\x20sent');_0x3e8f11(_0x580de9[_0xd998('0x14')][_0xd998('0x13')]);}})[_0xd998('0x15')](function(_0x1ba777){logger['error'](_0xd998('0x12'),_0x5dc5bb,_0x1ba777);_0x103ed7(_0x1ba777);});});}exports[_0xd998('0x16')]=function(_0x4564d1){var _0x303805=this;return new Promise(function(_0x34ad36,_0x330f97){return db[_0xd998('0x17')][_0xd998('0x18')](_0x4564d1[_0xd998('0x19')],{'raw':_0x4564d1['options']?_0x4564d1[_0xd998('0x1a')][_0xd998('0x1b')]===undefined?!![]:![]:!![]})[_0xd998('0xb')](function(_0x5c3fce){logger[_0xd998('0xc')](_0xd998('0x16'),_0x4564d1);logger['debug'](_0xd998('0x16'),_0x4564d1,JSON[_0xd998('0x10')](_0x5c3fce));_0x34ad36(_0x5c3fce);})[_0xd998('0x15')](function(_0x377f80){logger[_0xd998('0x11')]('CreateMailQueueReport',_0x377f80[_0xd998('0x13')],_0x4564d1);_0x330f97(_0x303805[_0xd998('0x11')](0x1f4,_0x377f80[_0xd998('0x13')]));});});};exports[_0xd998('0x1c')]=function(_0x2296aa){var _0x442418=this;return new Promise(function(_0x944080,_0x309671){return db[_0xd998('0x17')][_0xd998('0x1d')](_0x2296aa[_0xd998('0x19')],{'raw':_0x2296aa['options']?_0x2296aa['options'][_0xd998('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2296aa['options']?_0x2296aa[_0xd998('0x1a')]['where']||null:null,'attributes':_0x2296aa[_0xd998('0x1a')]?_0x2296aa[_0xd998('0x1a')][_0xd998('0x1e')]||null:null,'limit':_0x2296aa['options']?_0x2296aa[_0xd998('0x1a')][_0xd998('0x1f')]||null:null})[_0xd998('0xb')](function(_0xa2bc56){logger[_0xd998('0xc')](_0xd998('0x1c'),_0x2296aa);logger[_0xd998('0xe')]('UpdateMailQueueReport',_0x2296aa,JSON[_0xd998('0x10')](_0xa2bc56));_0x944080(_0xa2bc56);})[_0xd998('0x15')](function(_0x342175){logger[_0xd998('0x11')]('UpdateMailQueueReport',_0x342175[_0xd998('0x13')],_0x2296aa);_0x309671(_0x442418['error'](0x1f4,_0x342175[_0xd998('0x13')]));});});}; \ No newline at end of file +var _0xe5a0=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateMailQueueReport','MailQueueReport','create','options','raw','stringify','catch','update','body','where','attributes','limit','UpdateMailQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5a0,0xee));var _0x0e5a=function(_0x62bb34,_0x2aeffd){_0x62bb34=_0x62bb34-0x0;var _0x6f986a=_0xe5a0[_0x62bb34];return _0x6f986a;};'use strict';var _=require(_0x0e5a('0x0'));var util=require('util');var moment=require(_0x0e5a('0x1'));var BPromise=require(_0x0e5a('0x2'));var rs=require(_0x0e5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e5a('0x4'))['db'];var utils=require(_0x0e5a('0x5'));var logger=require(_0x0e5a('0x6'))(_0x0e5a('0x7'));var config=require(_0x0e5a('0x8'));var jayson=require(_0x0e5a('0x9'));var client=jayson[_0x0e5a('0xa')][_0x0e5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dd580,_0x49f190,_0x2fe6aa){return new BPromise(function(_0xf7304c,_0x48073a){return client[_0x0e5a('0xc')](_0x5dd580,_0x2fe6aa)[_0x0e5a('0xd')](function(_0x1c4b6f){logger['info'](_0x0e5a('0xe'),_0x49f190,_0x0e5a('0xf'));logger[_0x0e5a('0x10')](_0x0e5a('0x11'),_0x49f190,_0x0e5a('0xf'),JSON['stringify'](_0x1c4b6f));if(_0x1c4b6f['error']){if(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x13')]===0x1f4){logger[_0x0e5a('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x49f190,_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);return _0x48073a(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);}logger[_0x0e5a('0x12')](_0x0e5a('0xe'),_0x49f190,_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);return _0xf7304c(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);}else{logger[_0x0e5a('0x15')](_0x0e5a('0xe'),_0x49f190,_0x0e5a('0xf'));_0xf7304c(_0x1c4b6f[_0x0e5a('0x16')][_0x0e5a('0x14')]);}})['catch'](function(_0x5df670){logger[_0x0e5a('0x12')](_0x0e5a('0xe'),_0x49f190,_0x5df670);_0x48073a(_0x5df670);});});}exports[_0x0e5a('0x17')]=function(_0x16b399){var _0x303e89=this;return new Promise(function(_0xce3431,_0x5f4cb4){return db[_0x0e5a('0x18')][_0x0e5a('0x19')](_0x16b399['body'],{'raw':_0x16b399['options']?_0x16b399[_0x0e5a('0x1a')][_0x0e5a('0x1b')]===undefined?!![]:![]:!![]})[_0x0e5a('0xd')](function(_0x8f1899){logger[_0x0e5a('0x15')]('CreateMailQueueReport',_0x16b399);logger['debug'](_0x0e5a('0x17'),_0x16b399,JSON[_0x0e5a('0x1c')](_0x8f1899));_0xce3431(_0x8f1899);})[_0x0e5a('0x1d')](function(_0x108a8c){logger[_0x0e5a('0x12')]('CreateMailQueueReport',_0x108a8c['message'],_0x16b399);_0x5f4cb4(_0x303e89[_0x0e5a('0x12')](0x1f4,_0x108a8c[_0x0e5a('0x14')]));});});};exports['UpdateMailQueueReport']=function(_0x58eef5){var _0x4932df=this;return new Promise(function(_0x870747,_0x2dfe27){return db[_0x0e5a('0x18')][_0x0e5a('0x1e')](_0x58eef5[_0x0e5a('0x1f')],{'raw':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x20')]||null:null,'attributes':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x21')]||null:null,'limit':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5['options'][_0x0e5a('0x22')]||null:null})[_0x0e5a('0xd')](function(_0x51a0f8){logger[_0x0e5a('0x15')](_0x0e5a('0x23'),_0x58eef5);logger[_0x0e5a('0x10')]('UpdateMailQueueReport',_0x58eef5,JSON['stringify'](_0x51a0f8));_0x870747(_0x51a0f8);})[_0x0e5a('0x1d')](function(_0x325f24){logger[_0x0e5a('0x12')](_0x0e5a('0x23'),_0x325f24[_0x0e5a('0x14')],_0x58eef5);_0x2dfe27(_0x4932df[_0x0e5a('0x12')](0x1f4,_0x325f24[_0x0e5a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index fae37c5..2176abe 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 _0x7ab6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x101a1d,_0x3c1a33){var _0x5f5ef5=function(_0x402d83){while(--_0x402d83){_0x101a1d['push'](_0x101a1d['shift']());}};_0x5f5ef5(++_0x3c1a33);}(_0x7ab6,0x19b));var _0x67ab=function(_0x47852a,_0x50e312){_0x47852a=_0x47852a-0x0;var _0x28ccde=_0x7ab6[_0x47852a];return _0x28ccde;};'use strict';var multer=require(_0x67ab('0x0'));var util=require(_0x67ab('0x1'));var path=require('path');var timeout=require(_0x67ab('0x2'));var express=require(_0x67ab('0x3'));var router=express[_0x67ab('0x4')]();var auth=require(_0x67ab('0x5'));var interaction=require(_0x67ab('0x6'));var config=require(_0x67ab('0x7'));module[_0x67ab('0x8')]=router; \ No newline at end of file +var _0xc2aa=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x297ec5,_0x860cf4){var _0x367d44=function(_0x1d96b3){while(--_0x1d96b3){_0x297ec5['push'](_0x297ec5['shift']());}};_0x367d44(++_0x860cf4);}(_0xc2aa,0x1b8));var _0xac2a=function(_0x3a9b30,_0x35e205){_0x3a9b30=_0x3a9b30-0x0;var _0x3c3cb2=_0xc2aa[_0x3a9b30];return _0x3c3cb2;};'use strict';var multer=require('multer');var util=require(_0xac2a('0x0'));var path=require(_0xac2a('0x1'));var timeout=require(_0xac2a('0x2'));var express=require('express');var router=express[_0xac2a('0x3')]();var auth=require(_0xac2a('0x4'));var interaction=require(_0xac2a('0x5'));var config=require(_0xac2a('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 006e48d..5860e29 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 _0xccfc=['username','INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x13727d,_0x4df1bc){var _0x9c69a4=function(_0x4bb2c4){while(--_0x4bb2c4){_0x13727d['push'](_0x13727d['shift']());}};_0x9c69a4(++_0x4df1bc);}(_0xccfc,0x1b5));var _0xcccf=function(_0x41432a,_0x2b6d31){_0x41432a=_0x41432a-0x0;var _0x39366b=_0xccfc[_0x41432a];return _0x39366b;};'use strict';var Sequelize=require(_0xcccf('0x0'));module['exports']={'description':{'type':Sequelize[_0xcccf('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xcccf('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xcccf('0x3')},'password':{'type':Sequelize[_0xcccf('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcccf('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xcccf('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcccf('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xcccf('0x1')]}}; \ No newline at end of file +var _0x5af8=['INTEGER','exports','STRING','BOOLEAN'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x5af8,0x161));var _0x85af=function(_0x5ed980,_0x1da661){_0x5ed980=_0x5ed980-0x0;var _0x13611c=_0x5af8[_0x5ed980];return _0x13611c;};'use strict';var Sequelize=require('sequelize');module[_0x85af('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x85af('0x1')]},'authentication':{'type':Sequelize[_0x85af('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x85af('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x85af('0x1')]},'port':{'type':Sequelize[_0x85af('0x3')]},'tls':{'type':Sequelize[_0x85af('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x85af('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x85af('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 f569ec3..0c3d2e0 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 _0x6582=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define','MailServerIn','mail_servers_in'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6582,0x108));var _0x2658=function(_0x291c1b,_0x5216a6){_0x291c1b=_0x291c1b-0x0;var _0x2109c9=_0x6582[_0x291c1b];return _0x2109c9;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var logger=require(_0x2658('0x2'))(_0x2658('0x3'));var moment=require(_0x2658('0x4'));var BPromise=require('bluebird');var rp=require(_0x2658('0x5'));var fs=require('fs');var path=require(_0x2658('0x6'));var rimraf=require(_0x2658('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2ef520,_0x1702bd){return _0x2ef520[_0x2658('0x8')](_0x2658('0x9'),attributes,{'tableName':_0x2658('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b65=['api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x556870,_0x28a240){var _0x282064=function(_0x2dc84d){while(--_0x2dc84d){_0x556870['push'](_0x556870['shift']());}};_0x282064(++_0x28a240);}(_0x2b65,0x131));var _0x52b6=function(_0x2fb866,_0x59bc0c){_0x2fb866=_0x2fb866-0x0;var _0x5d310f=_0x2b65[_0x2fb866];return _0x5d310f;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('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 8bf52c6..ced8e95 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 _0xbe41=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','MailServerIn','findAll','options','raw','attributes','limit','map','model','include','then','GetMailServerIn','catch','lodash'];(function(_0x180b71,_0x59ccec){var _0x57c42c=function(_0x3b7a44){while(--_0x3b7a44){_0x180b71['push'](_0x180b71['shift']());}};_0x57c42c(++_0x59ccec);}(_0xbe41,0xa4));var _0x1be4=function(_0x3781d3,_0x22ec38){_0x3781d3=_0x3781d3-0x0;var _0x1b4f55=_0xbe41[_0x3781d3];return _0x1b4f55;};'use strict';var _=require(_0x1be4('0x0'));var util=require('util');var moment=require(_0x1be4('0x1'));var BPromise=require(_0x1be4('0x2'));var rs=require(_0x1be4('0x3'));var fs=require('fs');var Redis=require(_0x1be4('0x4'));var db=require(_0x1be4('0x5'))['db'];var utils=require(_0x1be4('0x6'));var logger=require(_0x1be4('0x7'))(_0x1be4('0x8'));var config=require(_0x1be4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1be4('0xa')][_0x1be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x161b13,_0x1d24ee,_0x2e2943){return new BPromise(function(_0x5e3299,_0x2f93d5){return client['request'](_0x161b13,_0x2e2943)['then'](function(_0x210cc6){logger[_0x1be4('0xc')](_0x1be4('0xd'),_0x1d24ee,_0x1be4('0xe'));logger[_0x1be4('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1d24ee,_0x1be4('0xe'),JSON[_0x1be4('0x10')](_0x210cc6));if(_0x210cc6['error']){if(_0x210cc6['error'][_0x1be4('0x11')]===0x1f4){logger[_0x1be4('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1d24ee,_0x210cc6[_0x1be4('0x12')]['message']);return _0x2f93d5(_0x210cc6[_0x1be4('0x12')]['message']);}logger[_0x1be4('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1d24ee,_0x210cc6[_0x1be4('0x12')][_0x1be4('0x13')]);return _0x5e3299(_0x210cc6[_0x1be4('0x12')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x1d24ee,'request\x20sent');_0x5e3299(_0x210cc6[_0x1be4('0x14')]['message']);}})['catch'](function(_0x4f30c3){logger['error'](_0x1be4('0xd'),_0x1d24ee,_0x4f30c3);_0x2f93d5(_0x4f30c3);});});}exports['GetMailServerIn']=function(_0x25e510){var _0x2e60b8=this;return new Promise(function(_0x55f8c1,_0x527667){return db[_0x1be4('0x15')][_0x1be4('0x16')]({'raw':_0x25e510[_0x1be4('0x17')]?_0x25e510[_0x1be4('0x17')][_0x1be4('0x18')]===undefined?!![]:![]:!![],'where':_0x25e510['options']?_0x25e510['options']['where']||null:null,'attributes':_0x25e510[_0x1be4('0x17')]?_0x25e510[_0x1be4('0x17')][_0x1be4('0x19')]||null:null,'limit':_0x25e510['options']?_0x25e510['options'][_0x1be4('0x1a')]||null:null,'include':_0x25e510[_0x1be4('0x17')]?_0x25e510['options']['include']?_[_0x1be4('0x1b')](_0x25e510[_0x1be4('0x17')]['include'],function(_0x255710){return{'model':db[_0x255710[_0x1be4('0x1c')]],'as':_0x255710['as'],'attributes':_0x255710['attributes'],'include':_0x255710[_0x1be4('0x1d')]?_['map'](_0x255710['include'],function(_0x51f724){return{'model':db[_0x51f724['model']],'as':_0x51f724['as'],'attributes':_0x51f724['attributes'],'include':_0x51f724[_0x1be4('0x1d')]?_[_0x1be4('0x1b')](_0x51f724['include'],function(_0x468fac){return{'model':db[_0x468fac[_0x1be4('0x1c')]],'as':_0x468fac['as'],'attributes':_0x468fac[_0x1be4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1be4('0x1e')](function(_0x2ba85d){logger[_0x1be4('0xc')](_0x1be4('0x1f'),_0x25e510);logger[_0x1be4('0xf')]('GetMailServerIn',_0x25e510,JSON['stringify'](_0x2ba85d));_0x55f8c1(_0x2ba85d);})[_0x1be4('0x20')](function(_0x48c7f8){logger['error'](_0x1be4('0x1f'),_0x48c7f8[_0x1be4('0x13')],_0x25e510);_0x527667(_0x2e60b8[_0x1be4('0x12')](0x1f4,_0x48c7f8[_0x1be4('0x13')]));});});}; \ No newline at end of file +var _0xaaf1=['client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','findAll','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x452141,_0x4b485f){var _0x9e6014=function(_0x25c3a8){while(--_0x25c3a8){_0x452141['push'](_0x452141['shift']());}};_0x9e6014(++_0x4b485f);}(_0xaaf1,0x80));var _0x1aaf=function(_0x334743,_0x1f9260){_0x334743=_0x334743-0x0;var _0xc3ed62=_0xaaf1[_0x334743];return _0xc3ed62;};'use strict';var _=require(_0x1aaf('0x0'));var util=require(_0x1aaf('0x1'));var moment=require(_0x1aaf('0x2'));var BPromise=require(_0x1aaf('0x3'));var rs=require(_0x1aaf('0x4'));var fs=require('fs');var Redis=require(_0x1aaf('0x5'));var db=require(_0x1aaf('0x6'))['db'];var utils=require(_0x1aaf('0x7'));var logger=require(_0x1aaf('0x8'))(_0x1aaf('0x9'));var config=require(_0x1aaf('0xa'));var jayson=require(_0x1aaf('0xb'));var client=jayson[_0x1aaf('0xc')][_0x1aaf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a5170,_0x285639,_0x2391bc){return new BPromise(function(_0x43459a,_0x194617){return client[_0x1aaf('0xe')](_0x3a5170,_0x2391bc)['then'](function(_0x240aa2){logger[_0x1aaf('0xf')]('MailServerIn,\x20%s,\x20%s',_0x285639,_0x1aaf('0x10'));logger[_0x1aaf('0x11')](_0x1aaf('0x12'),_0x285639,_0x1aaf('0x10'),JSON[_0x1aaf('0x13')](_0x240aa2));if(_0x240aa2[_0x1aaf('0x14')]){if(_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x15')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x285639,_0x240aa2['error']['message']);return _0x194617(_0x240aa2['error']['message']);}logger[_0x1aaf('0x14')](_0x1aaf('0x16'),_0x285639,_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x17')]);return _0x43459a(_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x17')]);}else{logger[_0x1aaf('0xf')](_0x1aaf('0x16'),_0x285639,_0x1aaf('0x10'));_0x43459a(_0x240aa2[_0x1aaf('0x18')][_0x1aaf('0x17')]);}})[_0x1aaf('0x19')](function(_0x13d05e){logger[_0x1aaf('0x14')](_0x1aaf('0x16'),_0x285639,_0x13d05e);_0x194617(_0x13d05e);});});}exports[_0x1aaf('0x1a')]=function(_0x259e6b){var _0xf96a90=this;return new Promise(function(_0x27f94d,_0x13606d){return db['MailServerIn'][_0x1aaf('0x1b')]({'raw':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1d')]||null:null,'attributes':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1e')]||null:null,'limit':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b['options']['limit']||null:null,'include':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1f')]?_[_0x1aaf('0x20')](_0x259e6b['options'][_0x1aaf('0x1f')],function(_0x40df80){return{'model':db[_0x40df80[_0x1aaf('0x21')]],'as':_0x40df80['as'],'attributes':_0x40df80['attributes'],'include':_0x40df80['include']?_['map'](_0x40df80['include'],function(_0x1d6c5b){return{'model':db[_0x1d6c5b['model']],'as':_0x1d6c5b['as'],'attributes':_0x1d6c5b['attributes'],'include':_0x1d6c5b[_0x1aaf('0x1f')]?_['map'](_0x1d6c5b['include'],function(_0x1d1021){return{'model':db[_0x1d1021[_0x1aaf('0x21')]],'as':_0x1d1021['as'],'attributes':_0x1d1021['attributes']};}):[]};}):[]};}):[]:[]})[_0x1aaf('0x22')](function(_0x2ce1f2){logger[_0x1aaf('0xf')](_0x1aaf('0x1a'),_0x259e6b);logger[_0x1aaf('0x11')](_0x1aaf('0x1a'),_0x259e6b,JSON[_0x1aaf('0x13')](_0x2ce1f2));_0x27f94d(_0x2ce1f2);})[_0x1aaf('0x19')](function(_0x39a85a){logger[_0x1aaf('0x14')](_0x1aaf('0x1a'),_0x39a85a[_0x1aaf('0x17')],_0x259e6b);_0x13606d(_0xf96a90[_0x1aaf('0x14')](0x1f4,_0x39a85a[_0x1aaf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 745447a..4f20502 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 _0x151a=['post','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show'];(function(_0x29c7a6,_0x1dc288){var _0x1da2a5=function(_0x38b861){while(--_0x38b861){_0x29c7a6['push'](_0x29c7a6['shift']());}};_0x1da2a5(++_0x1dc288);}(_0x151a,0x1b5));var _0xa151=function(_0x1829fd,_0x33b470){_0x1829fd=_0x1829fd-0x0;var _0x177d22=_0x151a[_0x1829fd];return _0x177d22;};'use strict';var multer=require('multer');var util=require(_0xa151('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa151('0x1')]();var auth=require(_0xa151('0x2'));var interaction=require(_0xa151('0x3'));var config=require(_0xa151('0x4'));var controller=require(_0xa151('0x5'));router[_0xa151('0x6')]('/',auth['isAuthenticated'](),controller[_0xa151('0x7')]);router['get'](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xa')]);router[_0xa151('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xc')]);router[_0xa151('0xd')](_0xa151('0x8'),auth[_0xa151('0x9')](),controller[_0xa151('0xe')]);module[_0xa151('0xf')]=router; \ No newline at end of file +var _0xe641=['../../config/environment','./mailServerOut.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3c715d,_0x1c2554){var _0x441f7d=function(_0x2b6a0f){while(--_0x2b6a0f){_0x3c715d['push'](_0x3c715d['shift']());}};_0x441f7d(++_0x1c2554);}(_0xe641,0xfd));var _0x1e64=function(_0x23a47b,_0x4964c8){_0x23a47b=_0x23a47b-0x0;var _0x296856=_0xe641[_0x23a47b];return _0x296856;};'use strict';var multer=require(_0x1e64('0x0'));var util=require(_0x1e64('0x1'));var path=require('path');var timeout=require(_0x1e64('0x2'));var express=require(_0x1e64('0x3'));var router=express[_0x1e64('0x4')]();var auth=require(_0x1e64('0x5'));var interaction=require(_0x1e64('0x6'));var config=require(_0x1e64('0x7'));var controller=require(_0x1e64('0x8'));router[_0x1e64('0x9')]('/',auth[_0x1e64('0xa')](),controller['index']);router['get']('/:id',auth[_0x1e64('0xa')](),controller[_0x1e64('0xb')]);router[_0x1e64('0xc')]('/',auth[_0x1e64('0xa')](),controller[_0x1e64('0xd')]);router[_0x1e64('0xe')]('/:id',auth[_0x1e64('0xa')](),controller[_0x1e64('0xf')]);router[_0x1e64('0x10')](_0x1e64('0x11'),auth[_0x1e64('0xa')](),controller[_0x1e64('0x12')]);module[_0x1e64('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 02017c7..906f2b7 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 _0xd916=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5eb02f,_0xb6c40d){var _0x5db2e7=function(_0x59c2f7){while(--_0x59c2f7){_0x5eb02f['push'](_0x5eb02f['shift']());}};_0x5db2e7(++_0xb6c40d);}(_0xd916,0x18a));var _0x6d91=function(_0xbaf699,_0x4aa945){_0xbaf699=_0xbaf699-0x0;var _0x55a131=_0xd916[_0xbaf699];return _0x55a131;};'use strict';var Sequelize=require(_0x6d91('0x0'));module[_0x6d91('0x1')]={'description':{'type':Sequelize[_0x6d91('0x2')]},'host':{'type':Sequelize[_0x6d91('0x2')]},'user':{'type':Sequelize[_0x6d91('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6d91('0x3')]},'secure':{'type':Sequelize[_0x6d91('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4fb4=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x4a78e8,_0x5fcb80){var _0x162881=function(_0x2cf79c){while(--_0x2cf79c){_0x4a78e8['push'](_0x4a78e8['shift']());}};_0x162881(++_0x5fcb80);}(_0x4fb4,0x190));var _0x44fb=function(_0x30e4d3,_0x5e937a){_0x30e4d3=_0x30e4d3-0x0;var _0x4e6a0c=_0x4fb4[_0x30e4d3];return _0x4e6a0c;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'description':{'type':Sequelize[_0x44fb('0x1')]},'host':{'type':Sequelize[_0x44fb('0x1')]},'user':{'type':Sequelize[_0x44fb('0x1')]},'pass':{'type':Sequelize[_0x44fb('0x1')]},'port':{'type':Sequelize[_0x44fb('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x44fb('0x1')]},'authentication':{'type':Sequelize[_0x44fb('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 58d6605..2a72919 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 _0xb8f1=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb8f1,0x8a));var _0x1b8f=function(_0x1368e0,_0x1241d4){_0x1368e0=_0x1368e0-0x0;var _0x37a764=_0xb8f1[_0x1368e0];return _0x37a764;};'use strict';var pdf=require(_0x1b8f('0x0'));var emlformat=require(_0x1b8f('0x1'));var rimraf=require(_0x1b8f('0x2'));var zipdir=require(_0x1b8f('0x3'));var jsonpatch=require(_0x1b8f('0x4'));var rp=require('request-promise');var moment=require(_0x1b8f('0x5'));var BPromise=require(_0x1b8f('0x6'));var Mustache=require(_0x1b8f('0x7'));var util=require(_0x1b8f('0x8'));var path=require('path');var sox=require(_0x1b8f('0x9'));var csv=require(_0x1b8f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b8f('0xb'));var squel=require(_0x1b8f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b8f('0xd'));var deskjs=require(_0x1b8f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b8f('0xf'));var Papa=require(_0x1b8f('0x10'));var Redis=require(_0x1b8f('0x11'));var authService=require(_0x1b8f('0x12'));var qs=require(_0x1b8f('0x13'));var as=require(_0x1b8f('0x14'));var hardwareService=require(_0x1b8f('0x15'));var logger=require('../../config/logger')(_0x1b8f('0x16'));var utils=require(_0x1b8f('0x17'));var config=require(_0x1b8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52504a,_0x269b78){_0x269b78=_0x269b78||0xcc;return function(_0xfe87cd){if(_0xfe87cd){return _0x52504a[_0x1b8f('0x19')](_0x269b78);}return _0x52504a[_0x1b8f('0x1a')](_0x269b78)[_0x1b8f('0x1b')]();};}function respondWithResult(_0x2bac20,_0x3618a7){_0x3618a7=_0x3618a7||0xc8;return function(_0x56f64c){if(_0x56f64c){return _0x2bac20[_0x1b8f('0x1a')](_0x3618a7)[_0x1b8f('0x1c')](_0x56f64c);}};}function respondWithFilteredResult(_0x332cfd,_0x3577b9){return function(_0x157b73){if(_0x157b73){var _0x2b3afa=_0x157b73[_0x1b8f('0x1d')],_0x3eccd9=_0x3577b9[_0x1b8f('0x1e')],_0x3f5ddf=_0x3577b9[_0x1b8f('0x1e')]+_0x3577b9[_0x1b8f('0x1f')],_0x3d4eca;if(_0x3f5ddf>=_0x2b3afa){_0x3f5ddf=_0x2b3afa;_0x3d4eca=0xc8;}else{_0x3d4eca=0xce;}_0x332cfd[_0x1b8f('0x1a')](_0x3d4eca);return _0x332cfd[_0x1b8f('0x20')](_0x1b8f('0x21'),_0x3eccd9+'-'+_0x3f5ddf+'/'+_0x2b3afa)['json'](_0x157b73);}return null;};}function patchUpdates(_0x23a14a){return function(_0x488c1a){try{jsonpatch[_0x1b8f('0x22')](_0x488c1a,_0x23a14a,!![]);}catch(_0x408459){return BPromise[_0x1b8f('0x23')](_0x408459);}return _0x488c1a[_0x1b8f('0x24')]();};}function saveUpdates(_0x5a0ac4,_0x4edc17){return function(_0x4b8a9b){if(_0x4b8a9b){return _0x4b8a9b[_0x1b8f('0x25')](_0x5a0ac4)[_0x1b8f('0x26')](function(_0x68dabd){return _0x68dabd;});}return null;};}function removeEntity(_0x4b5bde,_0x1f37c3){return function(_0x3c9b56){if(_0x3c9b56){return _0x3c9b56[_0x1b8f('0x27')]()[_0x1b8f('0x26')](function(){_0x4b5bde['status'](0xcc)[_0x1b8f('0x1b')]();});}};}function handleEntityNotFound(_0x2f9575,_0x4fd18f){return function(_0x3c1f8b){if(!_0x3c1f8b){_0x2f9575[_0x1b8f('0x19')](0x194);}return _0x3c1f8b;};}function handleError(_0xb0a0b0,_0x107a2d){_0x107a2d=_0x107a2d||0x1f4;return function(_0x250894){logger['error'](_0x250894[_0x1b8f('0x28')]);if(_0x250894[_0x1b8f('0x29')]){delete _0x250894[_0x1b8f('0x29')];}_0xb0a0b0[_0x1b8f('0x1a')](_0x107a2d)[_0x1b8f('0x2a')](_0x250894);};}exports[_0x1b8f('0x2b')]=function(_0x370fa1,_0x4b9f4e){var _0xb4594e={},_0x2a46d4={},_0x872faf={'count':0x0,'rows':[]};var _0x5150c1=_[_0x1b8f('0x2c')](db[_0x1b8f('0x2d')]['rawAttributes'],function(_0x3539c4){return{'name':_0x3539c4[_0x1b8f('0x2e')],'type':_0x3539c4[_0x1b8f('0x2f')][_0x1b8f('0x30')]};});_0x2a46d4['model']=_[_0x1b8f('0x2c')](_0x5150c1,_0x1b8f('0x29'));_0x2a46d4['query']=_[_0x1b8f('0x31')](_0x370fa1[_0x1b8f('0x32')]);_0x2a46d4[_0x1b8f('0x33')]=_[_0x1b8f('0x34')](_0x2a46d4[_0x1b8f('0x35')],_0x2a46d4['query']);_0xb4594e[_0x1b8f('0x36')]=_['intersection'](_0x2a46d4[_0x1b8f('0x35')],qs['fields'](_0x370fa1['query'][_0x1b8f('0x37')]));_0xb4594e[_0x1b8f('0x36')]=_0xb4594e['attributes'][_0x1b8f('0x38')]?_0xb4594e[_0x1b8f('0x36')]:_0x2a46d4['model'];if(!_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x39')](_0x1b8f('0x3a'))){_0xb4594e[_0x1b8f('0x1f')]=qs[_0x1b8f('0x1f')](_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x1f')]);_0xb4594e['offset']=qs[_0x1b8f('0x1e')](_0x370fa1[_0x1b8f('0x32')]['offset']);}_0xb4594e[_0x1b8f('0x3b')]=qs[_0x1b8f('0x3c')](_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3c')]);_0xb4594e['where']=qs[_0x1b8f('0x33')](_[_0x1b8f('0x3d')](_0x370fa1['query'],_0x2a46d4['filters']),_0x5150c1);if(_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3e')]){_0xb4594e[_0x1b8f('0x3f')]=_[_0x1b8f('0x40')](_0xb4594e['where'],{'$or':_['map'](_0x5150c1,function(_0x598faa){if(_0x598faa['type']!=='VIRTUAL'){var _0x464c98={};_0x464c98[_0x598faa[_0x1b8f('0x29')]]={'$like':'%'+_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x3e')]+'%'};return _0x464c98;}})});}_0xb4594e=_['merge']({},_0xb4594e,_0x370fa1['options']);var _0x1d3110={'where':_0xb4594e[_0x1b8f('0x3f')]};return db[_0x1b8f('0x2d')][_0x1b8f('0x1d')](_0x1d3110)[_0x1b8f('0x26')](function(_0x43fce2){_0x872faf['count']=_0x43fce2;if(_0x370fa1[_0x1b8f('0x32')][_0x1b8f('0x41')]){_0xb4594e[_0x1b8f('0x42')]=[{'all':!![]}];}return db[_0x1b8f('0x2d')][_0x1b8f('0x43')](_0xb4594e);})[_0x1b8f('0x26')](function(_0x342a55){_0x872faf['rows']=_0x342a55;return _0x872faf;})[_0x1b8f('0x26')](respondWithFilteredResult(_0x4b9f4e,_0xb4594e))[_0x1b8f('0x44')](handleError(_0x4b9f4e,null));};exports[_0x1b8f('0x45')]=function(_0x282b88,_0x91f43){var _0x256d93={'raw':!![],'where':{'id':_0x282b88[_0x1b8f('0x46')]['id']}},_0x2b95eb={};_0x2b95eb[_0x1b8f('0x35')]=_[_0x1b8f('0x31')](db['MailServerOut']['rawAttributes']);_0x2b95eb[_0x1b8f('0x32')]=_[_0x1b8f('0x31')](_0x282b88[_0x1b8f('0x32')]);_0x2b95eb['filters']=_[_0x1b8f('0x34')](_0x2b95eb[_0x1b8f('0x35')],_0x2b95eb[_0x1b8f('0x32')]);_0x256d93[_0x1b8f('0x36')]=_['intersection'](_0x2b95eb[_0x1b8f('0x35')],qs[_0x1b8f('0x37')](_0x282b88['query']['fields']));_0x256d93[_0x1b8f('0x36')]=_0x256d93[_0x1b8f('0x36')][_0x1b8f('0x38')]?_0x256d93[_0x1b8f('0x36')]:_0x2b95eb['model'];if(_0x282b88['query'][_0x1b8f('0x41')]){_0x256d93['include']=[{'all':!![]}];}_0x256d93=_['merge']({},_0x256d93,_0x282b88[_0x1b8f('0x47')]);return db[_0x1b8f('0x2d')]['find'](_0x256d93)[_0x1b8f('0x26')](handleEntityNotFound(_0x91f43,null))[_0x1b8f('0x26')](respondWithResult(_0x91f43,null))[_0x1b8f('0x44')](handleError(_0x91f43,null));};exports[_0x1b8f('0x48')]=function(_0x1caed8,_0x4aff65){return db[_0x1b8f('0x2d')][_0x1b8f('0x48')](_0x1caed8[_0x1b8f('0x49')],{})[_0x1b8f('0x26')](respondWithResult(_0x4aff65,0xc9))[_0x1b8f('0x44')](handleError(_0x4aff65,null));};exports[_0x1b8f('0x25')]=function(_0x527f8f,_0x854a46){if(_0x527f8f[_0x1b8f('0x49')]['id']){delete _0x527f8f[_0x1b8f('0x49')]['id'];}return db[_0x1b8f('0x2d')][_0x1b8f('0x4a')]({'where':{'id':_0x527f8f[_0x1b8f('0x46')]['id']}})[_0x1b8f('0x26')](handleEntityNotFound(_0x854a46,null))[_0x1b8f('0x26')](saveUpdates(_0x527f8f[_0x1b8f('0x49')],null))[_0x1b8f('0x26')](respondWithResult(_0x854a46,null))[_0x1b8f('0x44')](handleError(_0x854a46,null));};exports[_0x1b8f('0x27')]=function(_0x18faa4,_0x11457a){return db[_0x1b8f('0x2d')]['find']({'where':{'id':_0x18faa4[_0x1b8f('0x46')]['id']}})[_0x1b8f('0x26')](handleEntityNotFound(_0x11457a,null))['then'](removeEntity(_0x11457a,null))[_0x1b8f('0x44')](handleError(_0x11457a,null));}; \ No newline at end of file +var _0x5535=['hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5535,0x1ca));var _0x5553=function(_0x4dccfe,_0x361902){_0x4dccfe=_0x4dccfe-0x0;var _0x159065=_0x5535[_0x4dccfe];return _0x159065;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5553('0x0'));var rimraf=require(_0x5553('0x1'));var zipdir=require(_0x5553('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5553('0x3'));var moment=require(_0x5553('0x4'));var BPromise=require(_0x5553('0x5'));var Mustache=require(_0x5553('0x6'));var util=require(_0x5553('0x7'));var path=require(_0x5553('0x8'));var sox=require(_0x5553('0x9'));var csv=require(_0x5553('0xa'));var ejs=require(_0x5553('0xb'));var fs=require('fs');var _=require(_0x5553('0xc'));var squel=require(_0x5553('0xd'));var crypto=require(_0x5553('0xe'));var jsforce=require(_0x5553('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5553('0x10'));var Papa=require(_0x5553('0x11'));var Redis=require('ioredis');var authService=require(_0x5553('0x12'));var qs=require(_0x5553('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5553('0x14'));var logger=require('../../config/logger')(_0x5553('0x15'));var utils=require(_0x5553('0x16'));var config=require(_0x5553('0x17'));var licenseUtil=require(_0x5553('0x18'));var db=require(_0x5553('0x19'))['db'];function respondWithStatusCode(_0xfddbb3,_0x3ab6b8){_0x3ab6b8=_0x3ab6b8||0xcc;return function(_0x525a97){if(_0x525a97){return _0xfddbb3['sendStatus'](_0x3ab6b8);}return _0xfddbb3[_0x5553('0x1a')](_0x3ab6b8)['end']();};}function respondWithResult(_0x19e6f2,_0x2b1d54){_0x2b1d54=_0x2b1d54||0xc8;return function(_0x5e63a4){if(_0x5e63a4){return _0x19e6f2[_0x5553('0x1a')](_0x2b1d54)['json'](_0x5e63a4);}};}function respondWithFilteredResult(_0x9e5bd3,_0x50f3d3){return function(_0x4c1bf5){if(_0x4c1bf5){var _0x69a1c3=_0x4c1bf5[_0x5553('0x1b')],_0x590488=_0x50f3d3[_0x5553('0x1c')],_0x10a228=_0x50f3d3[_0x5553('0x1c')]+_0x50f3d3['limit'],_0x42732f;if(_0x10a228>=_0x69a1c3){_0x10a228=_0x69a1c3;_0x42732f=0xc8;}else{_0x42732f=0xce;}_0x9e5bd3[_0x5553('0x1a')](_0x42732f);return _0x9e5bd3['set'](_0x5553('0x1d'),_0x590488+'-'+_0x10a228+'/'+_0x69a1c3)['json'](_0x4c1bf5);}return null;};}function patchUpdates(_0x5ad219){return function(_0x3689f4){try{jsonpatch[_0x5553('0x1e')](_0x3689f4,_0x5ad219,!![]);}catch(_0x1375e9){return BPromise[_0x5553('0x1f')](_0x1375e9);}return _0x3689f4[_0x5553('0x20')]();};}function saveUpdates(_0x5a8037,_0x449b51){return function(_0x25e09c){if(_0x25e09c){return _0x25e09c[_0x5553('0x21')](_0x5a8037)[_0x5553('0x22')](function(_0x498450){return _0x498450;});}return null;};}function removeEntity(_0x1e6a86,_0x470c2f){return function(_0x499fc3){if(_0x499fc3){return _0x499fc3[_0x5553('0x23')]()['then'](function(){_0x1e6a86[_0x5553('0x1a')](0xcc)[_0x5553('0x24')]();});}};}function handleEntityNotFound(_0x54fab8,_0x1fe824){return function(_0x372222){if(!_0x372222){_0x54fab8[_0x5553('0x25')](0x194);}return _0x372222;};}function handleError(_0x4149ee,_0x1d1e78){_0x1d1e78=_0x1d1e78||0x1f4;return function(_0x14cd71){logger[_0x5553('0x26')](_0x14cd71['stack']);if(_0x14cd71[_0x5553('0x27')]){delete _0x14cd71[_0x5553('0x27')];}_0x4149ee['status'](_0x1d1e78)['send'](_0x14cd71);};}exports[_0x5553('0x28')]=function(_0x4e9a88,_0x460719){var _0x249d98={},_0x4232ee={},_0x1a7af7={'count':0x0,'rows':[]};var _0x184719=_[_0x5553('0x29')](db['MailServerOut'][_0x5553('0x2a')],function(_0x3184a3){return{'name':_0x3184a3['fieldName'],'type':_0x3184a3[_0x5553('0x2b')][_0x5553('0x2c')]};});_0x4232ee[_0x5553('0x2d')]=_[_0x5553('0x29')](_0x184719,_0x5553('0x27'));_0x4232ee[_0x5553('0x2e')]=_[_0x5553('0x2f')](_0x4e9a88['query']);_0x4232ee[_0x5553('0x30')]=_[_0x5553('0x31')](_0x4232ee[_0x5553('0x2d')],_0x4232ee[_0x5553('0x2e')]);_0x249d98['attributes']=_['intersection'](_0x4232ee['model'],qs[_0x5553('0x32')](_0x4e9a88[_0x5553('0x2e')][_0x5553('0x32')]));_0x249d98['attributes']=_0x249d98[_0x5553('0x33')][_0x5553('0x34')]?_0x249d98['attributes']:_0x4232ee[_0x5553('0x2d')];if(!_0x4e9a88['query'][_0x5553('0x35')](_0x5553('0x36'))){_0x249d98[_0x5553('0x37')]=qs[_0x5553('0x37')](_0x4e9a88['query'][_0x5553('0x37')]);_0x249d98['offset']=qs[_0x5553('0x1c')](_0x4e9a88[_0x5553('0x2e')]['offset']);}_0x249d98['order']=qs[_0x5553('0x38')](_0x4e9a88['query'][_0x5553('0x38')]);_0x249d98[_0x5553('0x39')]=qs[_0x5553('0x30')](_[_0x5553('0x3a')](_0x4e9a88[_0x5553('0x2e')],_0x4232ee[_0x5553('0x30')]),_0x184719);if(_0x4e9a88[_0x5553('0x2e')][_0x5553('0x3b')]){_0x249d98[_0x5553('0x39')]=_[_0x5553('0x3c')](_0x249d98['where'],{'$or':_[_0x5553('0x29')](_0x184719,function(_0x47ccc6){if(_0x47ccc6[_0x5553('0x2b')]!=='VIRTUAL'){var _0x496374={};_0x496374[_0x47ccc6[_0x5553('0x27')]]={'$like':'%'+_0x4e9a88[_0x5553('0x2e')]['filter']+'%'};return _0x496374;}})});}_0x249d98=_[_0x5553('0x3c')]({},_0x249d98,_0x4e9a88[_0x5553('0x3d')]);var _0x8d9323={'where':_0x249d98['where']};return db[_0x5553('0x3e')][_0x5553('0x1b')](_0x8d9323)['then'](function(_0x1595e8){_0x1a7af7[_0x5553('0x1b')]=_0x1595e8;if(_0x4e9a88[_0x5553('0x2e')][_0x5553('0x3f')]){_0x249d98[_0x5553('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x5553('0x41')](_0x249d98);})['then'](function(_0x4a2bf8){_0x1a7af7[_0x5553('0x42')]=_0x4a2bf8;return _0x1a7af7;})[_0x5553('0x22')](respondWithFilteredResult(_0x460719,_0x249d98))[_0x5553('0x43')](handleError(_0x460719,null));};exports[_0x5553('0x44')]=function(_0x3e344b,_0x486afe){var _0x3165a0={'raw':!![],'where':{'id':_0x3e344b[_0x5553('0x45')]['id']}},_0x56c9fd={};_0x56c9fd['model']=_[_0x5553('0x2f')](db['MailServerOut'][_0x5553('0x2a')]);_0x56c9fd['query']=_[_0x5553('0x2f')](_0x3e344b[_0x5553('0x2e')]);_0x56c9fd[_0x5553('0x30')]=_[_0x5553('0x31')](_0x56c9fd[_0x5553('0x2d')],_0x56c9fd[_0x5553('0x2e')]);_0x3165a0[_0x5553('0x33')]=_[_0x5553('0x31')](_0x56c9fd[_0x5553('0x2d')],qs['fields'](_0x3e344b[_0x5553('0x2e')][_0x5553('0x32')]));_0x3165a0['attributes']=_0x3165a0[_0x5553('0x33')][_0x5553('0x34')]?_0x3165a0[_0x5553('0x33')]:_0x56c9fd[_0x5553('0x2d')];if(_0x3e344b[_0x5553('0x2e')][_0x5553('0x3f')]){_0x3165a0[_0x5553('0x40')]=[{'all':!![]}];}_0x3165a0=_[_0x5553('0x3c')]({},_0x3165a0,_0x3e344b[_0x5553('0x3d')]);return db[_0x5553('0x3e')][_0x5553('0x46')](_0x3165a0)[_0x5553('0x22')](handleEntityNotFound(_0x486afe,null))[_0x5553('0x22')](respondWithResult(_0x486afe,null))[_0x5553('0x43')](handleError(_0x486afe,null));};exports[_0x5553('0x47')]=function(_0x155c9a,_0x293f4a){return db['MailServerOut'][_0x5553('0x47')](_0x155c9a['body'],{})[_0x5553('0x22')](respondWithResult(_0x293f4a,0xc9))[_0x5553('0x43')](handleError(_0x293f4a,null));};exports[_0x5553('0x21')]=function(_0x5a39a3,_0xcca01){if(_0x5a39a3[_0x5553('0x48')]['id']){delete _0x5a39a3[_0x5553('0x48')]['id'];}return db[_0x5553('0x3e')][_0x5553('0x46')]({'where':{'id':_0x5a39a3[_0x5553('0x45')]['id']}})[_0x5553('0x22')](handleEntityNotFound(_0xcca01,null))[_0x5553('0x22')](saveUpdates(_0x5a39a3[_0x5553('0x48')],null))['then'](respondWithResult(_0xcca01,null))[_0x5553('0x43')](handleError(_0xcca01,null));};exports[_0x5553('0x23')]=function(_0x484390,_0x832804){return db['MailServerOut'][_0x5553('0x46')]({'where':{'id':_0x484390['params']['id']}})[_0x5553('0x22')](handleEntityNotFound(_0x832804,null))[_0x5553('0x22')](removeEntity(_0x832804,null))[_0x5553('0x43')](handleError(_0x832804,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a64d5bf..bab6695 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0x32237e,_0x1bf4bd){var _0x3b73ff=function(_0x165ad9){while(--_0x165ad9){_0x32237e['push'](_0x32237e['shift']());}};_0x3b73ff(++_0x1bf4bd);}(_0xf494,0x1c6));var _0x4f49=function(_0x1a7eb3,_0x23bf97){_0x1a7eb3=_0x1a7eb3-0x0;var _0x19e176=_0xf494[_0x1a7eb3];return _0x19e176;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','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(_0x594ce7,_0x4f7dac){var _0x10d802=function(_0x4cf24a){while(--_0x4cf24a){_0x594ce7['push'](_0x594ce7['shift']());}};_0x10d802(++_0x4f7dac);}(_0xe14b,0x93));var _0xbe14=function(_0x1b24fa,_0x436522){_0x1b24fa=_0x1b24fa-0x0;var _0x2852bd=_0xe14b[_0x1b24fa];return _0x2852bd;};'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 3736583..a3b9f61 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 _0xa0dd=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xa0dd,0x15e));var _0xda0d=function(_0x44a710,_0x3f9200){_0x44a710=_0x44a710-0x0;var _0x5e970f=_0xa0dd[_0x44a710];return _0x5e970f;};'use strict';var _=require('lodash');var util=require(_0xda0d('0x0'));var moment=require(_0xda0d('0x1'));var BPromise=require(_0xda0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda0d('0x3'))['db'];var utils=require(_0xda0d('0x4'));var logger=require(_0xda0d('0x5'))(_0xda0d('0x6'));var config=require(_0xda0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xda0d('0x8')][_0xda0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17def0,_0x37e4c1,_0x49ed6e){return new BPromise(function(_0x2c71a6,_0x1022ab){return client[_0xda0d('0xa')](_0x17def0,_0x49ed6e)[_0xda0d('0xb')](function(_0x4ac824){logger[_0xda0d('0xc')](_0xda0d('0xd'),_0x37e4c1,_0xda0d('0xe'));logger[_0xda0d('0xf')](_0xda0d('0x10'),_0x37e4c1,_0xda0d('0xe'),JSON[_0xda0d('0x11')](_0x4ac824));if(_0x4ac824[_0xda0d('0x12')]){if(_0x4ac824[_0xda0d('0x12')][_0xda0d('0x13')]===0x1f4){logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4ac824[_0xda0d('0x12')][_0xda0d('0x14')]);return _0x1022ab(_0x4ac824['error'][_0xda0d('0x14')]);}logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4ac824['error'][_0xda0d('0x14')]);return _0x2c71a6(_0x4ac824[_0xda0d('0x12')][_0xda0d('0x14')]);}else{logger[_0xda0d('0xc')](_0xda0d('0xd'),_0x37e4c1,'request\x20sent');_0x2c71a6(_0x4ac824['result'][_0xda0d('0x14')]);}})[_0xda0d('0x15')](function(_0x4b642a){logger[_0xda0d('0x12')](_0xda0d('0xd'),_0x37e4c1,_0x4b642a);_0x1022ab(_0x4b642a);});});} \ No newline at end of file +var _0xb79e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','MailServerOut,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x40de64,_0x1472d4){var _0x491fdc=function(_0x3ee721){while(--_0x3ee721){_0x40de64['push'](_0x40de64['shift']());}};_0x491fdc(++_0x1472d4);}(_0xb79e,0xb7));var _0xeb79=function(_0x1d99b8,_0x154ea9){_0x1d99b8=_0x1d99b8-0x0;var _0xbb06d0=_0xb79e[_0x1d99b8];return _0xbb06d0;};'use strict';var _=require(_0xeb79('0x0'));var util=require(_0xeb79('0x1'));var moment=require(_0xeb79('0x2'));var BPromise=require(_0xeb79('0x3'));var rs=require(_0xeb79('0x4'));var fs=require('fs');var Redis=require(_0xeb79('0x5'));var db=require(_0xeb79('0x6'))['db'];var utils=require(_0xeb79('0x7'));var logger=require(_0xeb79('0x8'))(_0xeb79('0x9'));var config=require('../../config/environment');var jayson=require(_0xeb79('0xa'));var client=jayson[_0xeb79('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcee2f3,_0x4a455e,_0x585cfc){return new BPromise(function(_0x2b5eea,_0x2d1a6f){return client[_0xeb79('0xc')](_0xcee2f3,_0x585cfc)['then'](function(_0x4b85d5){logger['info']('MailServerOut,\x20%s,\x20%s',_0x4a455e,'request\x20sent');logger['debug'](_0xeb79('0xd'),_0x4a455e,_0xeb79('0xe'),JSON['stringify'](_0x4b85d5));if(_0x4b85d5['error']){if(_0x4b85d5['error'][_0xeb79('0xf')]===0x1f4){logger[_0xeb79('0x10')]('MailServerOut,\x20%s,\x20%s',_0x4a455e,_0x4b85d5[_0xeb79('0x10')][_0xeb79('0x11')]);return _0x2d1a6f(_0x4b85d5[_0xeb79('0x10')][_0xeb79('0x11')]);}logger['error'](_0xeb79('0x12'),_0x4a455e,_0x4b85d5['error']['message']);return _0x2b5eea(_0x4b85d5['error'][_0xeb79('0x11')]);}else{logger[_0xeb79('0x13')](_0xeb79('0x12'),_0x4a455e,_0xeb79('0xe'));_0x2b5eea(_0x4b85d5['result'][_0xeb79('0x11')]);}})[_0xeb79('0x14')](function(_0x213e5f){logger['error'](_0xeb79('0x12'),_0x4a455e,_0x213e5f);_0x2d1a6f(_0x213e5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e7c9301..48296cf 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 _0x92c4=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x1df0bb,_0x251c51){var _0x41a310=function(_0x4744c1){while(--_0x4744c1){_0x1df0bb['push'](_0x1df0bb['shift']());}};_0x41a310(++_0x251c51);}(_0x92c4,0x9a));var _0x492c=function(_0x4e944a,_0x54f6e0){_0x4e944a=_0x4e944a-0x0;var _0x2f81e2=_0x92c4[_0x4e944a];return _0x2f81e2;};'use strict';var multer=require('multer');var util=require(_0x492c('0x0'));var path=require('path');var timeout=require(_0x492c('0x1'));var express=require(_0x492c('0x2'));var router=express['Router']();var auth=require(_0x492c('0x3'));var interaction=require(_0x492c('0x4'));var config=require(_0x492c('0x5'));var controller=require(_0x492c('0x6'));router[_0x492c('0x7')]('/',auth['isAuthenticated'](),controller[_0x492c('0x8')]);router[_0x492c('0x7')]('/describe',auth[_0x492c('0x9')](),controller['describe']);router[_0x492c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x492c('0xa')]);router[_0x492c('0xb')]('/',auth[_0x492c('0x9')](),controller[_0x492c('0xc')]);router[_0x492c('0xd')](_0x492c('0xe'),auth[_0x492c('0x9')](),controller[_0x492c('0xf')]);router['delete'](_0x492c('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x492c('0x10')]=router; \ No newline at end of file +var _0x1c86=['destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','show','post','create','put','update','/:id'];(function(_0x2b6a8f,_0x294599){var _0x2d2036=function(_0x1ea077){while(--_0x1ea077){_0x2b6a8f['push'](_0x2b6a8f['shift']());}};_0x2d2036(++_0x294599);}(_0x1c86,0xe6));var _0x61c8=function(_0x4622fb,_0x272252){_0x4622fb=_0x4622fb-0x0;var _0x33629d=_0x1c86[_0x4622fb];return _0x33629d;};'use strict';var multer=require('multer');var util=require(_0x61c8('0x0'));var path=require(_0x61c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x61c8('0x2')]();var auth=require(_0x61c8('0x3'));var interaction=require(_0x61c8('0x4'));var config=require(_0x61c8('0x5'));var controller=require(_0x61c8('0x6'));router[_0x61c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x61c8('0x8')]);router['get']('/describe',auth[_0x61c8('0x9')](),controller[_0x61c8('0xa')]);router['get']('/:id',auth[_0x61c8('0x9')](),controller[_0x61c8('0xb')]);router[_0x61c8('0xc')]('/',auth[_0x61c8('0x9')](),controller[_0x61c8('0xd')]);router[_0x61c8('0xe')]('/:id',auth[_0x61c8('0x9')](),controller[_0x61c8('0xf')]);router['delete'](_0x61c8('0x10'),auth[_0x61c8('0x9')](),controller[_0x61c8('0x11')]);module[_0x61c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 81c3fc4..ffd7493 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 _0x39d2=['STRING','name','sequelize'];(function(_0x1dbf88,_0x5e01bb){var _0x3066c2=function(_0x30fb32){while(--_0x30fb32){_0x1dbf88['push'](_0x1dbf88['shift']());}};_0x3066c2(++_0x5e01bb);}(_0x39d2,0xf5));var _0x239d=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x39d2[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x239d('0x0'));module['exports']={'name':{'type':Sequelize[_0x239d('0x1')],'unique':_0x239d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x239d('0x1')]}}; \ No newline at end of file +var _0x187d=['sequelize','STRING','name'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x187d,0x93));var _0xd187=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x187d[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'name':{'type':Sequelize[_0xd187('0x1')],'unique':_0xd187('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd187('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index bdd845d..e21e4c4 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 _0x83bd=['stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error'];(function(_0x3ea4b1,_0x1c59b4){var _0x4fec31=function(_0x55fc7c){while(--_0x55fc7c){_0x3ea4b1['push'](_0x3ea4b1['shift']());}};_0x4fec31(++_0x1c59b4);}(_0x83bd,0x1ed));var _0xd83b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x83bd[_0x5bd426];return _0x23a7eb;};'use strict';var pdf=require(_0xd83b('0x0'));var emlformat=require(_0xd83b('0x1'));var rimraf=require(_0xd83b('0x2'));var zipdir=require(_0xd83b('0x3'));var jsonpatch=require(_0xd83b('0x4'));var rp=require(_0xd83b('0x5'));var moment=require(_0xd83b('0x6'));var BPromise=require(_0xd83b('0x7'));var Mustache=require(_0xd83b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd83b('0x9'));var csv=require(_0xd83b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd83b('0xb'));var squel=require('squel');var crypto=require(_0xd83b('0xc'));var jsforce=require(_0xd83b('0xd'));var deskjs=require(_0xd83b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd83b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd83b('0x10'));var as=require(_0xd83b('0x11'));var hardwareService=require(_0xd83b('0x12'));var logger=require(_0xd83b('0x13'))(_0xd83b('0x14'));var utils=require(_0xd83b('0x15'));var config=require(_0xd83b('0x16'));var licenseUtil=require(_0xd83b('0x17'));var db=require(_0xd83b('0x18'))['db'];function respondWithStatusCode(_0x2cceda,_0x100182){_0x100182=_0x100182||0xcc;return function(_0x287505){if(_0x287505){return _0x2cceda[_0xd83b('0x19')](_0x100182);}return _0x2cceda[_0xd83b('0x1a')](_0x100182)[_0xd83b('0x1b')]();};}function respondWithResult(_0x4f52f8,_0x2fff09){_0x2fff09=_0x2fff09||0xc8;return function(_0xa32312){if(_0xa32312){return _0x4f52f8['status'](_0x2fff09)[_0xd83b('0x1c')](_0xa32312);}};}function respondWithFilteredResult(_0x1e493b,_0x2fef5d){return function(_0x4d8e7b){if(_0x4d8e7b){var _0x297288=_0x4d8e7b[_0xd83b('0x1d')],_0x916d32=_0x2fef5d['offset'],_0x5c374b=_0x2fef5d[_0xd83b('0x1e')]+_0x2fef5d[_0xd83b('0x1f')],_0x2cc4d4;if(_0x5c374b>=_0x297288){_0x5c374b=_0x297288;_0x2cc4d4=0xc8;}else{_0x2cc4d4=0xce;}_0x1e493b['status'](_0x2cc4d4);return _0x1e493b[_0xd83b('0x20')]('Content-Range',_0x916d32+'-'+_0x5c374b+'/'+_0x297288)[_0xd83b('0x1c')](_0x4d8e7b);}return null;};}function patchUpdates(_0x47dad4){return function(_0x39ec33){try{jsonpatch['apply'](_0x39ec33,_0x47dad4,!![]);}catch(_0x5f12c6){return BPromise[_0xd83b('0x21')](_0x5f12c6);}return _0x39ec33[_0xd83b('0x22')]();};}function saveUpdates(_0xcbdee4,_0x26ae9a){return function(_0x313837){if(_0x313837){return _0x313837[_0xd83b('0x23')](_0xcbdee4)[_0xd83b('0x24')](function(_0x54f4ad){return _0x54f4ad;});}return null;};}function removeEntity(_0x1ab0d9,_0xfb64d9){return function(_0x31d23a){if(_0x31d23a){return _0x31d23a[_0xd83b('0x25')]()['then'](function(){_0x1ab0d9[_0xd83b('0x1a')](0xcc)[_0xd83b('0x1b')]();});}};}function handleEntityNotFound(_0x2111cb,_0x4657c0){return function(_0x4946e3){if(!_0x4946e3){_0x2111cb[_0xd83b('0x19')](0x194);}return _0x4946e3;};}function handleError(_0x1c101b,_0x41edb3){_0x41edb3=_0x41edb3||0x1f4;return function(_0x2a4ae2){logger[_0xd83b('0x26')](_0x2a4ae2[_0xd83b('0x27')]);if(_0x2a4ae2['name']){delete _0x2a4ae2[_0xd83b('0x28')];}_0x1c101b[_0xd83b('0x1a')](_0x41edb3)[_0xd83b('0x29')](_0x2a4ae2);};}exports[_0xd83b('0x2a')]=function(_0x13f2f2,_0x5b1161){var _0x4b17b1={},_0x5c9c5a={},_0x185825={'count':0x0,'rows':[]};var _0x5f439d=_['map'](db[_0xd83b('0x2b')][_0xd83b('0x2c')],function(_0x33b4fb){return{'name':_0x33b4fb[_0xd83b('0x2d')],'type':_0x33b4fb[_0xd83b('0x2e')][_0xd83b('0x2f')]};});_0x5c9c5a[_0xd83b('0x30')]=_[_0xd83b('0x31')](_0x5f439d,_0xd83b('0x28'));_0x5c9c5a[_0xd83b('0x32')]=_['keys'](_0x13f2f2['query']);_0x5c9c5a[_0xd83b('0x33')]=_[_0xd83b('0x34')](_0x5c9c5a[_0xd83b('0x30')],_0x5c9c5a[_0xd83b('0x32')]);_0x4b17b1[_0xd83b('0x35')]=_[_0xd83b('0x34')](_0x5c9c5a[_0xd83b('0x30')],qs[_0xd83b('0x36')](_0x13f2f2[_0xd83b('0x32')]['fields']));_0x4b17b1[_0xd83b('0x35')]=_0x4b17b1['attributes'][_0xd83b('0x37')]?_0x4b17b1[_0xd83b('0x35')]:_0x5c9c5a[_0xd83b('0x30')];if(!_0x13f2f2[_0xd83b('0x32')]['hasOwnProperty'](_0xd83b('0x38'))){_0x4b17b1[_0xd83b('0x1f')]=qs['limit'](_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x1f')]);_0x4b17b1['offset']=qs[_0xd83b('0x1e')](_0x13f2f2['query'][_0xd83b('0x1e')]);}_0x4b17b1[_0xd83b('0x39')]=qs[_0xd83b('0x3a')](_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x3a')]);_0x4b17b1[_0xd83b('0x3b')]=qs['filters'](_[_0xd83b('0x3c')](_0x13f2f2['query'],_0x5c9c5a['filters']),_0x5f439d);if(_0x13f2f2[_0xd83b('0x32')]['filter']){_0x4b17b1['where']=_[_0xd83b('0x3d')](_0x4b17b1[_0xd83b('0x3b')],{'$or':_[_0xd83b('0x31')](_0x5f439d,function(_0x6f8393){if(_0x6f8393[_0xd83b('0x2e')]!==_0xd83b('0x3e')){var _0x1ef732={};_0x1ef732[_0x6f8393['name']]={'$like':'%'+_0x13f2f2[_0xd83b('0x32')][_0xd83b('0x3f')]+'%'};return _0x1ef732;}})});}_0x4b17b1=_[_0xd83b('0x3d')]({},_0x4b17b1,_0x13f2f2['options']);var _0x5e829a={'where':_0x4b17b1[_0xd83b('0x3b')]};return db[_0xd83b('0x2b')][_0xd83b('0x1d')](_0x5e829a)[_0xd83b('0x24')](function(_0x3c1f66){_0x185825['count']=_0x3c1f66;if(_0x13f2f2[_0xd83b('0x32')]['includeAll']){_0x4b17b1['include']=[{'all':!![]}];}return db[_0xd83b('0x2b')][_0xd83b('0x40')](_0x4b17b1);})[_0xd83b('0x24')](function(_0x19b382){_0x185825[_0xd83b('0x41')]=_0x19b382;return _0x185825;})[_0xd83b('0x24')](respondWithFilteredResult(_0x5b1161,_0x4b17b1))[_0xd83b('0x42')](handleError(_0x5b1161,null));};exports[_0xd83b('0x43')]=function(_0x197b28,_0x160563){var _0x4cf143={'raw':!![],'where':{'id':_0x197b28['params']['id']}},_0xc18fc4={};_0xc18fc4[_0xd83b('0x30')]=_[_0xd83b('0x44')](db[_0xd83b('0x2b')][_0xd83b('0x2c')]);_0xc18fc4[_0xd83b('0x32')]=_[_0xd83b('0x44')](_0x197b28['query']);_0xc18fc4['filters']=_[_0xd83b('0x34')](_0xc18fc4[_0xd83b('0x30')],_0xc18fc4[_0xd83b('0x32')]);_0x4cf143['attributes']=_[_0xd83b('0x34')](_0xc18fc4[_0xd83b('0x30')],qs[_0xd83b('0x36')](_0x197b28['query'][_0xd83b('0x36')]));_0x4cf143[_0xd83b('0x35')]=_0x4cf143[_0xd83b('0x35')]['length']?_0x4cf143[_0xd83b('0x35')]:_0xc18fc4['model'];if(_0x197b28['query']['includeAll']){_0x4cf143[_0xd83b('0x45')]=[{'all':!![]}];}_0x4cf143=_[_0xd83b('0x3d')]({},_0x4cf143,_0x197b28[_0xd83b('0x46')]);return db[_0xd83b('0x2b')][_0xd83b('0x47')](_0x4cf143)[_0xd83b('0x24')](handleEntityNotFound(_0x160563,null))[_0xd83b('0x24')](respondWithResult(_0x160563,null))[_0xd83b('0x42')](handleError(_0x160563,null));};exports[_0xd83b('0x48')]=function(_0x19d5f8,_0x401e5f){return db[_0xd83b('0x2b')][_0xd83b('0x48')](_0x19d5f8[_0xd83b('0x49')],{})[_0xd83b('0x24')](respondWithResult(_0x401e5f,0xc9))[_0xd83b('0x42')](handleError(_0x401e5f,null));};exports['update']=function(_0x56c504,_0x1b76a3){if(_0x56c504[_0xd83b('0x49')]['id']){delete _0x56c504['body']['id'];}return db[_0xd83b('0x2b')][_0xd83b('0x47')]({'where':{'id':_0x56c504[_0xd83b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b76a3,null))[_0xd83b('0x24')](saveUpdates(_0x56c504[_0xd83b('0x49')],null))[_0xd83b('0x24')](respondWithResult(_0x1b76a3,null))[_0xd83b('0x42')](handleError(_0x1b76a3,null));};exports['destroy']=function(_0x556d6e,_0x4cd300){return db[_0xd83b('0x2b')][_0xd83b('0x47')]({'where':{'id':_0x556d6e[_0xd83b('0x4a')]['id']}})[_0xd83b('0x24')](handleEntityNotFound(_0x4cd300,null))[_0xd83b('0x24')](removeEntity(_0x4cd300,null))['catch'](handleError(_0x4cd300,null));};exports[_0xd83b('0x4b')]=function(_0xd398de,_0x7e0cb7){return db['MailSubstatus'][_0xd83b('0x4b')]()[_0xd83b('0x24')](respondWithResult(_0x7e0cb7,null))['catch'](handleError(_0x7e0cb7,null));}; \ No newline at end of file +var _0x49ca=['create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','show','params','rawAttributes','find','catch'];(function(_0x288c5a,_0x2ca88a){var _0x1a66e3=function(_0x3c9a57){while(--_0x3c9a57){_0x288c5a['push'](_0x288c5a['shift']());}};_0x1a66e3(++_0x2ca88a);}(_0x49ca,0x1dd));var _0xa49c=function(_0xacd3d5,_0x531902){_0xacd3d5=_0xacd3d5-0x0;var _0x4589df=_0x49ca[_0xacd3d5];return _0x4589df;};'use strict';var pdf=require(_0xa49c('0x0'));var emlformat=require(_0xa49c('0x1'));var rimraf=require(_0xa49c('0x2'));var zipdir=require(_0xa49c('0x3'));var jsonpatch=require(_0xa49c('0x4'));var rp=require(_0xa49c('0x5'));var moment=require('moment');var BPromise=require(_0xa49c('0x6'));var Mustache=require(_0xa49c('0x7'));var util=require(_0xa49c('0x8'));var path=require(_0xa49c('0x9'));var sox=require(_0xa49c('0xa'));var csv=require(_0xa49c('0xb'));var ejs=require(_0xa49c('0xc'));var fs=require('fs');var _=require(_0xa49c('0xd'));var squel=require(_0xa49c('0xe'));var crypto=require(_0xa49c('0xf'));var jsforce=require(_0xa49c('0x10'));var deskjs=require(_0xa49c('0x11'));var toCsv=require(_0xa49c('0xb'));var querystring=require(_0xa49c('0x12'));var Papa=require(_0xa49c('0x13'));var Redis=require('ioredis');var authService=require(_0xa49c('0x14'));var qs=require(_0xa49c('0x15'));var as=require(_0xa49c('0x16'));var hardwareService=require(_0xa49c('0x17'));var logger=require(_0xa49c('0x18'))(_0xa49c('0x19'));var utils=require(_0xa49c('0x1a'));var config=require(_0xa49c('0x1b'));var licenseUtil=require(_0xa49c('0x1c'));var db=require(_0xa49c('0x1d'))['db'];function respondWithStatusCode(_0x3af660,_0x1ce0c1){_0x1ce0c1=_0x1ce0c1||0xcc;return function(_0x5ad0fa){if(_0x5ad0fa){return _0x3af660[_0xa49c('0x1e')](_0x1ce0c1);}return _0x3af660[_0xa49c('0x1f')](_0x1ce0c1)['end']();};}function respondWithResult(_0x57242d,_0xb47fb7){_0xb47fb7=_0xb47fb7||0xc8;return function(_0x56d5f4){if(_0x56d5f4){return _0x57242d[_0xa49c('0x1f')](_0xb47fb7)[_0xa49c('0x20')](_0x56d5f4);}};}function respondWithFilteredResult(_0x36d872,_0x3371d3){return function(_0x5e7bc0){if(_0x5e7bc0){var _0x15b486=_0x5e7bc0[_0xa49c('0x21')],_0x2b562d=_0x3371d3['offset'],_0x4a8af5=_0x3371d3[_0xa49c('0x22')]+_0x3371d3['limit'],_0x508bd3;if(_0x4a8af5>=_0x15b486){_0x4a8af5=_0x15b486;_0x508bd3=0xc8;}else{_0x508bd3=0xce;}_0x36d872[_0xa49c('0x1f')](_0x508bd3);return _0x36d872[_0xa49c('0x23')](_0xa49c('0x24'),_0x2b562d+'-'+_0x4a8af5+'/'+_0x15b486)[_0xa49c('0x20')](_0x5e7bc0);}return null;};}function patchUpdates(_0x100660){return function(_0x4b9a55){try{jsonpatch[_0xa49c('0x25')](_0x4b9a55,_0x100660,!![]);}catch(_0x24bdde){return BPromise[_0xa49c('0x26')](_0x24bdde);}return _0x4b9a55[_0xa49c('0x27')]();};}function saveUpdates(_0x20d29f,_0x60ca0){return function(_0x510bf6){if(_0x510bf6){return _0x510bf6[_0xa49c('0x28')](_0x20d29f)[_0xa49c('0x29')](function(_0x56cc16){return _0x56cc16;});}return null;};}function removeEntity(_0x1cd4c1,_0x1aa165){return function(_0x18cccf){if(_0x18cccf){return _0x18cccf[_0xa49c('0x2a')]()['then'](function(){_0x1cd4c1[_0xa49c('0x1f')](0xcc)[_0xa49c('0x2b')]();});}};}function handleEntityNotFound(_0x165063,_0x43e33f){return function(_0x5501e6){if(!_0x5501e6){_0x165063[_0xa49c('0x1e')](0x194);}return _0x5501e6;};}function handleError(_0x562d29,_0x36958e){_0x36958e=_0x36958e||0x1f4;return function(_0x15ae7f){logger[_0xa49c('0x2c')](_0x15ae7f['stack']);if(_0x15ae7f[_0xa49c('0x2d')]){delete _0x15ae7f[_0xa49c('0x2d')];}_0x562d29['status'](_0x36958e)[_0xa49c('0x2e')](_0x15ae7f);};}exports['index']=function(_0x4f32ec,_0xcddd6e){var _0x25897b={},_0x67171f={},_0x3ae65f={'count':0x0,'rows':[]};var _0x3bb131=_[_0xa49c('0x2f')](db['MailSubstatus']['rawAttributes'],function(_0x1ba68e){return{'name':_0x1ba68e['fieldName'],'type':_0x1ba68e[_0xa49c('0x30')][_0xa49c('0x31')]};});_0x67171f[_0xa49c('0x32')]=_[_0xa49c('0x2f')](_0x3bb131,_0xa49c('0x2d'));_0x67171f[_0xa49c('0x33')]=_[_0xa49c('0x34')](_0x4f32ec[_0xa49c('0x33')]);_0x67171f[_0xa49c('0x35')]=_[_0xa49c('0x36')](_0x67171f[_0xa49c('0x32')],_0x67171f[_0xa49c('0x33')]);_0x25897b['attributes']=_['intersection'](_0x67171f[_0xa49c('0x32')],qs[_0xa49c('0x37')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x37')]));_0x25897b[_0xa49c('0x38')]=_0x25897b[_0xa49c('0x38')][_0xa49c('0x39')]?_0x25897b[_0xa49c('0x38')]:_0x67171f[_0xa49c('0x32')];if(!_0x4f32ec[_0xa49c('0x33')]['hasOwnProperty'](_0xa49c('0x3a'))){_0x25897b[_0xa49c('0x3b')]=qs[_0xa49c('0x3b')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x3b')]);_0x25897b[_0xa49c('0x22')]=qs[_0xa49c('0x22')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x22')]);}_0x25897b[_0xa49c('0x3c')]=qs[_0xa49c('0x3d')](_0x4f32ec['query'][_0xa49c('0x3d')]);_0x25897b['where']=qs['filters'](_['pick'](_0x4f32ec['query'],_0x67171f['filters']),_0x3bb131);if(_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x3e')]){_0x25897b[_0xa49c('0x3f')]=_[_0xa49c('0x40')](_0x25897b[_0xa49c('0x3f')],{'$or':_['map'](_0x3bb131,function(_0xc9551){if(_0xc9551[_0xa49c('0x30')]!==_0xa49c('0x41')){var _0x571f39={};_0x571f39[_0xc9551[_0xa49c('0x2d')]]={'$like':'%'+_0x4f32ec['query'][_0xa49c('0x3e')]+'%'};return _0x571f39;}})});}_0x25897b=_[_0xa49c('0x40')]({},_0x25897b,_0x4f32ec[_0xa49c('0x42')]);var _0x1092cd={'where':_0x25897b[_0xa49c('0x3f')]};return db[_0xa49c('0x43')]['count'](_0x1092cd)[_0xa49c('0x29')](function(_0x21923c){_0x3ae65f[_0xa49c('0x21')]=_0x21923c;if(_0x4f32ec['query'][_0xa49c('0x44')]){_0x25897b[_0xa49c('0x45')]=[{'all':!![]}];}return db['MailSubstatus'][_0xa49c('0x46')](_0x25897b);})[_0xa49c('0x29')](function(_0x55a63b){_0x3ae65f['rows']=_0x55a63b;return _0x3ae65f;})[_0xa49c('0x29')](respondWithFilteredResult(_0xcddd6e,_0x25897b))['catch'](handleError(_0xcddd6e,null));};exports[_0xa49c('0x47')]=function(_0x278a94,_0x3e4d68){var _0x39ac12={'raw':!![],'where':{'id':_0x278a94[_0xa49c('0x48')]['id']}},_0x4ac377={};_0x4ac377[_0xa49c('0x32')]=_[_0xa49c('0x34')](db[_0xa49c('0x43')][_0xa49c('0x49')]);_0x4ac377[_0xa49c('0x33')]=_[_0xa49c('0x34')](_0x278a94['query']);_0x4ac377[_0xa49c('0x35')]=_[_0xa49c('0x36')](_0x4ac377[_0xa49c('0x32')],_0x4ac377[_0xa49c('0x33')]);_0x39ac12['attributes']=_[_0xa49c('0x36')](_0x4ac377['model'],qs[_0xa49c('0x37')](_0x278a94['query'][_0xa49c('0x37')]));_0x39ac12[_0xa49c('0x38')]=_0x39ac12[_0xa49c('0x38')][_0xa49c('0x39')]?_0x39ac12[_0xa49c('0x38')]:_0x4ac377[_0xa49c('0x32')];if(_0x278a94[_0xa49c('0x33')]['includeAll']){_0x39ac12[_0xa49c('0x45')]=[{'all':!![]}];}_0x39ac12=_['merge']({},_0x39ac12,_0x278a94[_0xa49c('0x42')]);return db[_0xa49c('0x43')][_0xa49c('0x4a')](_0x39ac12)['then'](handleEntityNotFound(_0x3e4d68,null))['then'](respondWithResult(_0x3e4d68,null))[_0xa49c('0x4b')](handleError(_0x3e4d68,null));};exports[_0xa49c('0x4c')]=function(_0x234bf8,_0x136f93){return db['MailSubstatus'][_0xa49c('0x4c')](_0x234bf8[_0xa49c('0x4d')],{})[_0xa49c('0x29')](respondWithResult(_0x136f93,0xc9))[_0xa49c('0x4b')](handleError(_0x136f93,null));};exports[_0xa49c('0x28')]=function(_0x4403ac,_0x2c312f){if(_0x4403ac['body']['id']){delete _0x4403ac['body']['id'];}return db[_0xa49c('0x43')][_0xa49c('0x4a')]({'where':{'id':_0x4403ac[_0xa49c('0x48')]['id']}})[_0xa49c('0x29')](handleEntityNotFound(_0x2c312f,null))['then'](saveUpdates(_0x4403ac[_0xa49c('0x4d')],null))[_0xa49c('0x29')](respondWithResult(_0x2c312f,null))['catch'](handleError(_0x2c312f,null));};exports[_0xa49c('0x2a')]=function(_0x1b1c1d,_0x20f883){return db['MailSubstatus'][_0xa49c('0x4a')]({'where':{'id':_0x1b1c1d[_0xa49c('0x48')]['id']}})['then'](handleEntityNotFound(_0x20f883,null))[_0xa49c('0x29')](removeEntity(_0x20f883,null))[_0xa49c('0x4b')](handleError(_0x20f883,null));};exports[_0xa49c('0x4e')]=function(_0x5e2417,_0x5642cc){return db[_0xa49c('0x43')][_0xa49c('0x4e')]()[_0xa49c('0x29')](respondWithResult(_0x5642cc,null))[_0xa49c('0x4b')](handleError(_0x5642cc,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 362bc90..0560784 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 _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./mailSubstatus.attributes','exports','lodash'];(function(_0x2a1203,_0x20ddf0){var _0x44f4c8=function(_0x16c15a){while(--_0x16c15a){_0x2a1203['push'](_0x2a1203['shift']());}};_0x44f4c8(++_0x20ddf0);}(_0xed3c,0x1a6));var _0xced3=function(_0x4095b9,_0x17ac01){_0x4095b9=_0x4095b9-0x0;var _0x3f6909=_0xed3c[_0x4095b9];return _0x3f6909;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a2=['./mailSubstatus.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0xc2a2,0x84));var _0x2c2a=function(_0x2abbdf,_0x4cb409){_0x2abbdf=_0x2abbdf-0x0;var _0x12f4bc=_0xc2a2[_0x2abbdf];return _0x12f4bc;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e7ca90f..79962d6 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','MailSubstatus,\x20%s,\x20%s'];(function(_0xd1903e,_0xb833fa){var _0x1e0df7=function(_0x2004e8){while(--_0x2004e8){_0xd1903e['push'](_0xd1903e['shift']());}};_0x1e0df7(++_0xb833fa);}(_0x5ff3,0x17d));var _0x35ff=function(_0xfb5562,_0x146be){_0xfb5562=_0xfb5562-0x0;var _0x53e37e=_0x5ff3[_0xfb5562];return _0x53e37e;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x1be1,0x192));var _0x11be=function(_0x5b2c8b,_0x283c0f){_0x5b2c8b=_0x5b2c8b-0x0;var _0x184438=_0x1be1[_0x5b2c8b];return _0x184438;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6ff69fe..ffefa69 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 _0xc67f=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','put','update'];(function(_0x1f2204,_0x2c6d0f){var _0x35439e=function(_0x4ef2e3){while(--_0x4ef2e3){_0x1f2204['push'](_0x1f2204['shift']());}};_0x35439e(++_0x2c6d0f);}(_0xc67f,0xdb));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var path=require(_0xfc67('0x2'));var timeout=require(_0xfc67('0x3'));var express=require('express');var router=express[_0xfc67('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfc67('0x5'));var controller=require(_0xfc67('0x6'));router[_0xfc67('0x7')]('/',auth[_0xfc67('0x8')](),controller[_0xfc67('0x9')]);router[_0xfc67('0x7')]('/describe',auth[_0xfc67('0x8')](),controller[_0xfc67('0xa')]);router[_0xfc67('0x7')](_0xfc67('0xb'),auth[_0xfc67('0x8')](),controller[_0xfc67('0xc')]);router['post']('/',auth[_0xfc67('0x8')](),controller['create']);router[_0xfc67('0xd')](_0xfc67('0xb'),auth[_0xfc67('0x8')](),controller[_0xfc67('0xe')]);router[_0xfc67('0xf')]('/:id',auth[_0xfc67('0x8')](),controller[_0xfc67('0x10')]);module[_0xfc67('0x11')]=router; \ No newline at end of file +var _0x13f3=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x13f3,0x155));var _0x313f=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x13f3[_0x160248];return _0x4e589d;};'use strict';var multer=require(_0x313f('0x0'));var util=require(_0x313f('0x1'));var path=require('path');var timeout=require(_0x313f('0x2'));var express=require(_0x313f('0x3'));var router=express[_0x313f('0x4')]();var auth=require(_0x313f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x313f('0x6'));var controller=require('./mailTransferReport.controller');router[_0x313f('0x7')]('/',auth[_0x313f('0x8')](),controller[_0x313f('0x9')]);router[_0x313f('0x7')](_0x313f('0xa'),auth[_0x313f('0x8')](),controller[_0x313f('0xb')]);router['get'](_0x313f('0xc'),auth[_0x313f('0x8')](),controller[_0x313f('0xd')]);router['post']('/',auth[_0x313f('0x8')](),controller[_0x313f('0xe')]);router[_0x313f('0xf')](_0x313f('0xc'),auth[_0x313f('0x8')](),controller[_0x313f('0x10')]);router[_0x313f('0x11')]('/:id',auth[_0x313f('0x8')](),controller['destroy']);module[_0x313f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2b7dabd..a0bde3f 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 _0x59ad=['queue','DATE','NOW','moment','exports','STRING','ENUM','agent'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x59ad,0xc3));var _0xd59a=function(_0x4813d4,_0x2fa3ce){_0x4813d4=_0x4813d4-0x0;var _0x1d6425=_0x59ad[_0x4813d4];return _0x1d6425;};'use strict';var moment=require(_0xd59a('0x0'));var Sequelize=require('sequelize');module[_0xd59a('0x1')]={'uniqueid':{'type':Sequelize[_0xd59a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd59a('0x3')]('account',_0xd59a('0x4'),_0xd59a('0x5')),'allowNull':![],'defaultValue':_0xd59a('0x5')},'transferredAt':{'type':Sequelize[_0xd59a('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xd59a('0x7')]}}; \ No newline at end of file +var _0x75f7=['account','agent','queue','NOW','moment'];(function(_0xf1a8c3,_0x3a475a){var _0x573384=function(_0x2f5dd0){while(--_0x2f5dd0){_0xf1a8c3['push'](_0xf1a8c3['shift']());}};_0x573384(++_0x3a475a);}(_0x75f7,0xc7));var _0x775f=function(_0x4d2806,_0x4449c1){_0x4d2806=_0x4d2806-0x0;var _0x587a38=_0x75f7[_0x4d2806];return _0x587a38;};'use strict';var moment=require(_0x775f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x775f('0x1'),_0x775f('0x2'),_0x775f('0x3')),'allowNull':![],'defaultValue':_0x775f('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x775f('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a202b21..64adb7f 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 _0x9c36=['destroy','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','length','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c36,0xbf));var _0x69c3=function(_0x44824d,_0x31d115){_0x44824d=_0x44824d-0x0;var _0x36f3c7=_0x9c36[_0x44824d];return _0x36f3c7;};'use strict';var pdf=require(_0x69c3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69c3('0x1'));var zipdir=require(_0x69c3('0x2'));var jsonpatch=require(_0x69c3('0x3'));var rp=require(_0x69c3('0x4'));var moment=require(_0x69c3('0x5'));var BPromise=require(_0x69c3('0x6'));var Mustache=require(_0x69c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x69c3('0x8'));var csv=require(_0x69c3('0x9'));var ejs=require(_0x69c3('0xa'));var fs=require('fs');var _=require(_0x69c3('0xb'));var squel=require('squel');var crypto=require(_0x69c3('0xc'));var jsforce=require(_0x69c3('0xd'));var deskjs=require(_0x69c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69c3('0xf'));var Papa=require(_0x69c3('0x10'));var Redis=require(_0x69c3('0x11'));var authService=require(_0x69c3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69c3('0x13'));var hardwareService=require(_0x69c3('0x14'));var logger=require(_0x69c3('0x15'))(_0x69c3('0x16'));var utils=require('../../config/utils');var config=require(_0x69c3('0x17'));var licenseUtil=require(_0x69c3('0x18'));var db=require(_0x69c3('0x19'))['db'];function respondWithStatusCode(_0x5d8462,_0x9cc727){_0x9cc727=_0x9cc727||0xcc;return function(_0xb76c14){if(_0xb76c14){return _0x5d8462['sendStatus'](_0x9cc727);}return _0x5d8462[_0x69c3('0x1a')](_0x9cc727)[_0x69c3('0x1b')]();};}function respondWithResult(_0x13e6d5,_0x4a7f3c){_0x4a7f3c=_0x4a7f3c||0xc8;return function(_0x447b43){if(_0x447b43){return _0x13e6d5['status'](_0x4a7f3c)[_0x69c3('0x1c')](_0x447b43);}};}function respondWithFilteredResult(_0x3f5ca7,_0x4f039d){return function(_0x348716){if(_0x348716){var _0x4d3de0=_0x348716[_0x69c3('0x1d')],_0x2a827f=_0x4f039d[_0x69c3('0x1e')],_0x35534c=_0x4f039d['offset']+_0x4f039d[_0x69c3('0x1f')],_0x411d9e;if(_0x35534c>=_0x4d3de0){_0x35534c=_0x4d3de0;_0x411d9e=0xc8;}else{_0x411d9e=0xce;}_0x3f5ca7['status'](_0x411d9e);return _0x3f5ca7[_0x69c3('0x20')](_0x69c3('0x21'),_0x2a827f+'-'+_0x35534c+'/'+_0x4d3de0)['json'](_0x348716);}return null;};}function patchUpdates(_0x2b2e1f){return function(_0x6d8117){try{jsonpatch[_0x69c3('0x22')](_0x6d8117,_0x2b2e1f,!![]);}catch(_0x46aed0){return BPromise[_0x69c3('0x23')](_0x46aed0);}return _0x6d8117[_0x69c3('0x24')]();};}function saveUpdates(_0x2dac50,_0x261262){return function(_0x543bd5){if(_0x543bd5){return _0x543bd5['update'](_0x2dac50)['then'](function(_0xf5035d){return _0xf5035d;});}return null;};}function removeEntity(_0x41b5d1,_0x4e8354){return function(_0x22ad82){if(_0x22ad82){return _0x22ad82[_0x69c3('0x25')]()[_0x69c3('0x26')](function(){_0x41b5d1['status'](0xcc)[_0x69c3('0x1b')]();});}};}function handleEntityNotFound(_0x1bb8bc,_0xe92b55){return function(_0x238040){if(!_0x238040){_0x1bb8bc['sendStatus'](0x194);}return _0x238040;};}function handleError(_0x238ee0,_0x5bb625){_0x5bb625=_0x5bb625||0x1f4;return function(_0x17af97){logger[_0x69c3('0x27')](_0x17af97[_0x69c3('0x28')]);if(_0x17af97[_0x69c3('0x29')]){delete _0x17af97['name'];}_0x238ee0[_0x69c3('0x1a')](_0x5bb625)[_0x69c3('0x2a')](_0x17af97);};}exports[_0x69c3('0x2b')]=function(_0x5ab838,_0x5a839f){var _0x4119df={},_0x37b7fd={},_0x1f771d={'count':0x0,'rows':[]};var _0xb30484=_[_0x69c3('0x2c')](db[_0x69c3('0x2d')][_0x69c3('0x2e')],function(_0x47bc51){return{'name':_0x47bc51[_0x69c3('0x2f')],'type':_0x47bc51['type'][_0x69c3('0x30')]};});_0x37b7fd[_0x69c3('0x31')]=_[_0x69c3('0x2c')](_0xb30484,_0x69c3('0x29'));_0x37b7fd[_0x69c3('0x32')]=_[_0x69c3('0x33')](_0x5ab838[_0x69c3('0x32')]);_0x37b7fd[_0x69c3('0x34')]=_[_0x69c3('0x35')](_0x37b7fd['model'],_0x37b7fd[_0x69c3('0x32')]);_0x4119df[_0x69c3('0x36')]=_['intersection'](_0x37b7fd[_0x69c3('0x31')],qs['fields'](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x37')]));_0x4119df['attributes']=_0x4119df['attributes']['length']?_0x4119df[_0x69c3('0x36')]:_0x37b7fd[_0x69c3('0x31')];if(!_0x5ab838['query'][_0x69c3('0x38')](_0x69c3('0x39'))){_0x4119df[_0x69c3('0x1f')]=qs[_0x69c3('0x1f')](_0x5ab838['query'][_0x69c3('0x1f')]);_0x4119df[_0x69c3('0x1e')]=qs['offset'](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x1e')]);}_0x4119df[_0x69c3('0x3a')]=qs[_0x69c3('0x3b')](_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3b')]);_0x4119df[_0x69c3('0x3c')]=qs[_0x69c3('0x34')](_[_0x69c3('0x3d')](_0x5ab838['query'],_0x37b7fd[_0x69c3('0x34')]),_0xb30484);if(_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3e')]){_0x4119df[_0x69c3('0x3c')]=_['merge'](_0x4119df['where'],{'$or':_['map'](_0xb30484,function(_0x174144){if(_0x174144['type']!=='VIRTUAL'){var _0x556a4a={};_0x556a4a[_0x174144[_0x69c3('0x29')]]={'$like':'%'+_0x5ab838[_0x69c3('0x32')][_0x69c3('0x3e')]+'%'};return _0x556a4a;}})});}_0x4119df=_['merge']({},_0x4119df,_0x5ab838[_0x69c3('0x3f')]);var _0x4326d9={'where':_0x4119df[_0x69c3('0x3c')]};return db[_0x69c3('0x2d')][_0x69c3('0x1d')](_0x4326d9)[_0x69c3('0x26')](function(_0x4a1e88){_0x1f771d['count']=_0x4a1e88;if(_0x5ab838['query'][_0x69c3('0x40')]){_0x4119df[_0x69c3('0x41')]=[{'all':!![]}];}return db[_0x69c3('0x2d')]['findAll'](_0x4119df);})[_0x69c3('0x26')](function(_0x2d22d2){_0x1f771d[_0x69c3('0x42')]=_0x2d22d2;return _0x1f771d;})[_0x69c3('0x26')](respondWithFilteredResult(_0x5a839f,_0x4119df))[_0x69c3('0x43')](handleError(_0x5a839f,null));};exports[_0x69c3('0x44')]=function(_0x134208,_0x4ff07e){var _0x18ef2f={'raw':!![],'where':{'id':_0x134208[_0x69c3('0x45')]['id']}},_0x672368={};_0x672368[_0x69c3('0x31')]=_[_0x69c3('0x33')](db['MailTransferReport'][_0x69c3('0x2e')]);_0x672368[_0x69c3('0x32')]=_[_0x69c3('0x33')](_0x134208['query']);_0x672368[_0x69c3('0x34')]=_[_0x69c3('0x35')](_0x672368[_0x69c3('0x31')],_0x672368[_0x69c3('0x32')]);_0x18ef2f[_0x69c3('0x36')]=_[_0x69c3('0x35')](_0x672368['model'],qs[_0x69c3('0x37')](_0x134208[_0x69c3('0x32')][_0x69c3('0x37')]));_0x18ef2f['attributes']=_0x18ef2f['attributes'][_0x69c3('0x46')]?_0x18ef2f[_0x69c3('0x36')]:_0x672368[_0x69c3('0x31')];if(_0x134208[_0x69c3('0x32')][_0x69c3('0x40')]){_0x18ef2f[_0x69c3('0x41')]=[{'all':!![]}];}_0x18ef2f=_[_0x69c3('0x47')]({},_0x18ef2f,_0x134208['options']);return db[_0x69c3('0x2d')][_0x69c3('0x48')](_0x18ef2f)[_0x69c3('0x26')](handleEntityNotFound(_0x4ff07e,null))[_0x69c3('0x26')](respondWithResult(_0x4ff07e,null))[_0x69c3('0x43')](handleError(_0x4ff07e,null));};exports[_0x69c3('0x49')]=function(_0x2b778f,_0x536d05){return db[_0x69c3('0x2d')][_0x69c3('0x49')](_0x2b778f[_0x69c3('0x4a')],{})['then'](respondWithResult(_0x536d05,0xc9))['catch'](handleError(_0x536d05,null));};exports['update']=function(_0x109765,_0x37784c){if(_0x109765[_0x69c3('0x4a')]['id']){delete _0x109765[_0x69c3('0x4a')]['id'];}return db[_0x69c3('0x2d')][_0x69c3('0x48')]({'where':{'id':_0x109765[_0x69c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x37784c,null))[_0x69c3('0x26')](saveUpdates(_0x109765[_0x69c3('0x4a')],null))[_0x69c3('0x26')](respondWithResult(_0x37784c,null))[_0x69c3('0x43')](handleError(_0x37784c,null));};exports[_0x69c3('0x25')]=function(_0x2b07b8,_0x29aea6){return db[_0x69c3('0x2d')][_0x69c3('0x48')]({'where':{'id':_0x2b07b8[_0x69c3('0x45')]['id']}})[_0x69c3('0x26')](handleEntityNotFound(_0x29aea6,null))[_0x69c3('0x26')](removeEntity(_0x29aea6,null))[_0x69c3('0x43')](handleError(_0x29aea6,null));};exports[_0x69c3('0x4b')]=function(_0x4b5679,_0x4d2a31){return db[_0x69c3('0x2d')][_0x69c3('0x4b')]()[_0x69c3('0x26')](respondWithResult(_0x4d2a31,null))[_0x69c3('0x43')](handleError(_0x4d2a31,null));}; \ No newline at end of file +var _0x059b=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir'];(function(_0x51ad04,_0x45989b){var _0x43204a=function(_0x8951c1){while(--_0x8951c1){_0x51ad04['push'](_0x51ad04['shift']());}};_0x43204a(++_0x45989b);}(_0x059b,0xde));var _0xb059=function(_0x5f2fb0,_0x42644d){_0x5f2fb0=_0x5f2fb0-0x0;var _0x5798b4=_0x059b[_0x5f2fb0];return _0x5798b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb059('0x0'));var rimraf=require(_0xb059('0x1'));var zipdir=require(_0xb059('0x2'));var jsonpatch=require(_0xb059('0x3'));var rp=require(_0xb059('0x4'));var moment=require(_0xb059('0x5'));var BPromise=require(_0xb059('0x6'));var Mustache=require(_0xb059('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb059('0x8'));var csv=require('to-csv');var ejs=require(_0xb059('0x9'));var fs=require('fs');var _=require(_0xb059('0xa'));var squel=require(_0xb059('0xb'));var crypto=require('crypto');var jsforce=require(_0xb059('0xc'));var deskjs=require(_0xb059('0xd'));var toCsv=require(_0xb059('0xe'));var querystring=require(_0xb059('0xf'));var Papa=require(_0xb059('0x10'));var Redis=require('ioredis');var authService=require(_0xb059('0x11'));var qs=require(_0xb059('0x12'));var as=require(_0xb059('0x13'));var hardwareService=require(_0xb059('0x14'));var logger=require('../../config/logger')(_0xb059('0x15'));var utils=require(_0xb059('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb059('0x17'));var db=require(_0xb059('0x18'))['db'];function respondWithStatusCode(_0x5eb69d,_0x43420a){_0x43420a=_0x43420a||0xcc;return function(_0x1fb936){if(_0x1fb936){return _0x5eb69d[_0xb059('0x19')](_0x43420a);}return _0x5eb69d[_0xb059('0x1a')](_0x43420a)[_0xb059('0x1b')]();};}function respondWithResult(_0x57f18d,_0x2637b2){_0x2637b2=_0x2637b2||0xc8;return function(_0x5e1df4){if(_0x5e1df4){return _0x57f18d[_0xb059('0x1a')](_0x2637b2)['json'](_0x5e1df4);}};}function respondWithFilteredResult(_0x4ae0f0,_0x4a18a5){return function(_0x41263d){if(_0x41263d){var _0x5a1342=_0x41263d['count'],_0x22a9b0=_0x4a18a5['offset'],_0x2ca82a=_0x4a18a5[_0xb059('0x1c')]+_0x4a18a5['limit'],_0x423f68;if(_0x2ca82a>=_0x5a1342){_0x2ca82a=_0x5a1342;_0x423f68=0xc8;}else{_0x423f68=0xce;}_0x4ae0f0[_0xb059('0x1a')](_0x423f68);return _0x4ae0f0[_0xb059('0x1d')]('Content-Range',_0x22a9b0+'-'+_0x2ca82a+'/'+_0x5a1342)[_0xb059('0x1e')](_0x41263d);}return null;};}function patchUpdates(_0x45bff){return function(_0x45e2e9){try{jsonpatch[_0xb059('0x1f')](_0x45e2e9,_0x45bff,!![]);}catch(_0x62bfa2){return BPromise[_0xb059('0x20')](_0x62bfa2);}return _0x45e2e9[_0xb059('0x21')]();};}function saveUpdates(_0x5493a5,_0x2f46b1){return function(_0x4a0345){if(_0x4a0345){return _0x4a0345[_0xb059('0x22')](_0x5493a5)[_0xb059('0x23')](function(_0x48cf54){return _0x48cf54;});}return null;};}function removeEntity(_0x1ab032,_0xc150dc){return function(_0x40261c){if(_0x40261c){return _0x40261c[_0xb059('0x24')]()[_0xb059('0x23')](function(){_0x1ab032['status'](0xcc)[_0xb059('0x1b')]();});}};}function handleEntityNotFound(_0x5d5123,_0x235318){return function(_0x54fd0a){if(!_0x54fd0a){_0x5d5123[_0xb059('0x19')](0x194);}return _0x54fd0a;};}function handleError(_0x2c9b2e,_0x4bcd75){_0x4bcd75=_0x4bcd75||0x1f4;return function(_0xe64e29){logger[_0xb059('0x25')](_0xe64e29['stack']);if(_0xe64e29[_0xb059('0x26')]){delete _0xe64e29[_0xb059('0x26')];}_0x2c9b2e[_0xb059('0x1a')](_0x4bcd75)['send'](_0xe64e29);};}exports[_0xb059('0x27')]=function(_0x104987,_0x943f26){var _0x39c765={},_0x3c81e2={},_0x486038={'count':0x0,'rows':[]};var _0x5eb740=_[_0xb059('0x28')](db[_0xb059('0x29')][_0xb059('0x2a')],function(_0x322dbf){return{'name':_0x322dbf[_0xb059('0x2b')],'type':_0x322dbf[_0xb059('0x2c')][_0xb059('0x2d')]};});_0x3c81e2[_0xb059('0x2e')]=_[_0xb059('0x28')](_0x5eb740,_0xb059('0x26'));_0x3c81e2[_0xb059('0x2f')]=_['keys'](_0x104987[_0xb059('0x2f')]);_0x3c81e2['filters']=_[_0xb059('0x30')](_0x3c81e2[_0xb059('0x2e')],_0x3c81e2[_0xb059('0x2f')]);_0x39c765['attributes']=_[_0xb059('0x30')](_0x3c81e2[_0xb059('0x2e')],qs['fields'](_0x104987[_0xb059('0x2f')][_0xb059('0x31')]));_0x39c765['attributes']=_0x39c765[_0xb059('0x32')][_0xb059('0x33')]?_0x39c765['attributes']:_0x3c81e2[_0xb059('0x2e')];if(!_0x104987[_0xb059('0x2f')][_0xb059('0x34')]('nolimit')){_0x39c765[_0xb059('0x35')]=qs[_0xb059('0x35')](_0x104987[_0xb059('0x2f')][_0xb059('0x35')]);_0x39c765[_0xb059('0x1c')]=qs[_0xb059('0x1c')](_0x104987[_0xb059('0x2f')][_0xb059('0x1c')]);}_0x39c765[_0xb059('0x36')]=qs['sort'](_0x104987[_0xb059('0x2f')][_0xb059('0x37')]);_0x39c765['where']=qs[_0xb059('0x38')](_[_0xb059('0x39')](_0x104987[_0xb059('0x2f')],_0x3c81e2[_0xb059('0x38')]),_0x5eb740);if(_0x104987['query'][_0xb059('0x3a')]){_0x39c765['where']=_[_0xb059('0x3b')](_0x39c765[_0xb059('0x3c')],{'$or':_[_0xb059('0x28')](_0x5eb740,function(_0x1318a6){if(_0x1318a6[_0xb059('0x2c')]!==_0xb059('0x3d')){var _0x444ab6={};_0x444ab6[_0x1318a6['name']]={'$like':'%'+_0x104987[_0xb059('0x2f')][_0xb059('0x3a')]+'%'};return _0x444ab6;}})});}_0x39c765=_[_0xb059('0x3b')]({},_0x39c765,_0x104987[_0xb059('0x3e')]);var _0x4358db={'where':_0x39c765[_0xb059('0x3c')]};return db['MailTransferReport']['count'](_0x4358db)[_0xb059('0x23')](function(_0x18a403){_0x486038[_0xb059('0x3f')]=_0x18a403;if(_0x104987['query']['includeAll']){_0x39c765[_0xb059('0x40')]=[{'all':!![]}];}return db[_0xb059('0x29')][_0xb059('0x41')](_0x39c765);})['then'](function(_0x91047a){_0x486038[_0xb059('0x42')]=_0x91047a;return _0x486038;})[_0xb059('0x23')](respondWithFilteredResult(_0x943f26,_0x39c765))[_0xb059('0x43')](handleError(_0x943f26,null));};exports[_0xb059('0x44')]=function(_0x43bd34,_0x3fcb06){var _0x4cea27={'raw':!![],'where':{'id':_0x43bd34['params']['id']}},_0x17f011={};_0x17f011[_0xb059('0x2e')]=_[_0xb059('0x45')](db[_0xb059('0x29')][_0xb059('0x2a')]);_0x17f011[_0xb059('0x2f')]=_[_0xb059('0x45')](_0x43bd34[_0xb059('0x2f')]);_0x17f011['filters']=_[_0xb059('0x30')](_0x17f011[_0xb059('0x2e')],_0x17f011[_0xb059('0x2f')]);_0x4cea27[_0xb059('0x32')]=_[_0xb059('0x30')](_0x17f011[_0xb059('0x2e')],qs[_0xb059('0x31')](_0x43bd34[_0xb059('0x2f')]['fields']));_0x4cea27[_0xb059('0x32')]=_0x4cea27[_0xb059('0x32')]['length']?_0x4cea27[_0xb059('0x32')]:_0x17f011[_0xb059('0x2e')];if(_0x43bd34[_0xb059('0x2f')]['includeAll']){_0x4cea27[_0xb059('0x40')]=[{'all':!![]}];}_0x4cea27=_[_0xb059('0x3b')]({},_0x4cea27,_0x43bd34[_0xb059('0x3e')]);return db[_0xb059('0x29')][_0xb059('0x46')](_0x4cea27)['then'](handleEntityNotFound(_0x3fcb06,null))['then'](respondWithResult(_0x3fcb06,null))[_0xb059('0x43')](handleError(_0x3fcb06,null));};exports[_0xb059('0x47')]=function(_0x22b1fb,_0x29fe69){return db[_0xb059('0x29')][_0xb059('0x47')](_0x22b1fb[_0xb059('0x48')],{})[_0xb059('0x23')](respondWithResult(_0x29fe69,0xc9))[_0xb059('0x43')](handleError(_0x29fe69,null));};exports[_0xb059('0x22')]=function(_0x488a10,_0x459c4f){if(_0x488a10['body']['id']){delete _0x488a10[_0xb059('0x48')]['id'];}return db[_0xb059('0x29')]['find']({'where':{'id':_0x488a10[_0xb059('0x49')]['id']}})[_0xb059('0x23')](handleEntityNotFound(_0x459c4f,null))[_0xb059('0x23')](saveUpdates(_0x488a10[_0xb059('0x48')],null))[_0xb059('0x23')](respondWithResult(_0x459c4f,null))[_0xb059('0x43')](handleError(_0x459c4f,null));};exports[_0xb059('0x24')]=function(_0x3d81ba,_0x1b613b){return db[_0xb059('0x29')][_0xb059('0x46')]({'where':{'id':_0x3d81ba['params']['id']}})['then'](handleEntityNotFound(_0x1b613b,null))[_0xb059('0x23')](removeEntity(_0x1b613b,null))['catch'](handleError(_0x1b613b,null));};exports[_0xb059('0x4a')]=function(_0x2829fe,_0x1a0028){return db[_0xb059('0x29')][_0xb059('0x4a')]()[_0xb059('0x23')](respondWithResult(_0x1a0028,null))[_0xb059('0x43')](handleError(_0x1a0028,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3f3c839..89fc93b 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 _0x3647=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x23b89f,_0x5dbf46){var _0x1be820=function(_0x28b027){while(--_0x28b027){_0x23b89f['push'](_0x23b89f['shift']());}};_0x1be820(++_0x5dbf46);}(_0x3647,0x1a0));var _0x7364=function(_0x2cf60c,_0xaa6755){_0x2cf60c=_0x2cf60c-0x0;var _0x2466ef=_0x3647[_0x2cf60c];return _0x2466ef;};'use strict';var _=require(_0x7364('0x0'));var util=require(_0x7364('0x1'));var logger=require(_0x7364('0x2'))('api');var moment=require(_0x7364('0x3'));var BPromise=require(_0x7364('0x4'));var rp=require(_0x7364('0x5'));var fs=require('fs');var path=require(_0x7364('0x6'));var rimraf=require(_0x7364('0x7'));var config=require(_0x7364('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x7364('0x9')]=function(_0x1efcb7,_0x3ddaf3){return _0x1efcb7[_0x7364('0xa')](_0x7364('0xb'),attributes,{'tableName':_0x7364('0xc'),'paranoid':![],'indexes':[{'name':_0x7364('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc844=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','rimraf','exports','define','MailTransferReport'];(function(_0x4e0d2c,_0x11df2a){var _0x221088=function(_0x2e5b5a){while(--_0x2e5b5a){_0x4e0d2c['push'](_0x4e0d2c['shift']());}};_0x221088(++_0x11df2a);}(_0xc844,0x1d0));var _0x4c84=function(_0x3672da,_0x2084de){_0x3672da=_0x3672da-0x0;var _0x4a951a=_0xc844[_0x3672da];return _0x4a951a;};'use strict';var _=require(_0x4c84('0x0'));var util=require('util');var logger=require(_0x4c84('0x1'))(_0x4c84('0x2'));var moment=require(_0x4c84('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c84('0x5'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x4c84('0x6')]=function(_0x238bf8,_0x4bbdc6){return _0x238bf8[_0x4c84('0x7')](_0x4c84('0x8'),attributes,{'tableName':_0x4c84('0x9'),'paranoid':![],'indexes':[{'name':_0x4c84('0xa'),'fields':[_0x4c84('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index bb8210e..b670fa0 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 _0x999e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','catch','lodash','util'];(function(_0x259cd5,_0x287d95){var _0x35835a=function(_0x5d7a07){while(--_0x5d7a07){_0x259cd5['push'](_0x259cd5['shift']());}};_0x35835a(++_0x287d95);}(_0x999e,0xcd));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe999('0x0'));var util=require(_0xe999('0x1'));var moment=require(_0xe999('0x2'));var BPromise=require(_0xe999('0x3'));var rs=require(_0xe999('0x4'));var fs=require('fs');var Redis=require(_0xe999('0x5'));var db=require(_0xe999('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe999('0x7'))(_0xe999('0x8'));var config=require(_0xe999('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe999('0xa')][_0xe999('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x234554,_0x5b6d37,_0x3cb264){return new BPromise(function(_0x44a1db,_0x44f32f){return client[_0xe999('0xc')](_0x234554,_0x3cb264)[_0xe999('0xd')](function(_0x1efad3){logger[_0xe999('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,'request\x20sent');logger['debug'](_0xe999('0xf'),_0x5b6d37,_0xe999('0x10'),JSON[_0xe999('0x11')](_0x1efad3));if(_0x1efad3[_0xe999('0x12')]){if(_0x1efad3['error'][_0xe999('0x13')]===0x1f4){logger[_0xe999('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,_0x1efad3['error'][_0xe999('0x14')]);return _0x44f32f(_0x1efad3[_0xe999('0x12')]['message']);}logger['error'](_0xe999('0x15'),_0x5b6d37,_0x1efad3[_0xe999('0x12')][_0xe999('0x14')]);return _0x44a1db(_0x1efad3[_0xe999('0x12')]['message']);}else{logger[_0xe999('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5b6d37,_0xe999('0x10'));_0x44a1db(_0x1efad3['result']['message']);}})[_0xe999('0x16')](function(_0x5643c3){logger[_0xe999('0x12')](_0xe999('0x15'),_0x5b6d37,_0x5643c3);_0x44f32f(_0x5643c3);});});} \ No newline at end of file +var _0xd4d5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xd4d5,0xad));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x5d4d('0x0'));var moment=require('moment');var BPromise=require(_0x5d4d('0x1'));var rs=require(_0x5d4d('0x2'));var fs=require('fs');var Redis=require(_0x5d4d('0x3'));var db=require(_0x5d4d('0x4'))['db'];var utils=require(_0x5d4d('0x5'));var logger=require('../../config/logger')(_0x5d4d('0x6'));var config=require(_0x5d4d('0x7'));var jayson=require(_0x5d4d('0x8'));var client=jayson['client'][_0x5d4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521b48,_0x410599,_0x3affcf){return new BPromise(function(_0x3b630f,_0x38a9be){return client['request'](_0x521b48,_0x3affcf)[_0x5d4d('0xa')](function(_0x15fe39){logger['info'](_0x5d4d('0xb'),_0x410599,_0x5d4d('0xc'));logger[_0x5d4d('0xd')](_0x5d4d('0xe'),_0x410599,_0x5d4d('0xc'),JSON[_0x5d4d('0xf')](_0x15fe39));if(_0x15fe39[_0x5d4d('0x10')]){if(_0x15fe39[_0x5d4d('0x10')][_0x5d4d('0x11')]===0x1f4){logger[_0x5d4d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x410599,_0x15fe39[_0x5d4d('0x10')]['message']);return _0x38a9be(_0x15fe39['error']['message']);}logger[_0x5d4d('0x10')](_0x5d4d('0xb'),_0x410599,_0x15fe39[_0x5d4d('0x10')][_0x5d4d('0x12')]);return _0x3b630f(_0x15fe39['error'][_0x5d4d('0x12')]);}else{logger['info'](_0x5d4d('0xb'),_0x410599,_0x5d4d('0xc'));_0x3b630f(_0x15fe39[_0x5d4d('0x13')]['message']);}})[_0x5d4d('0x14')](function(_0x4e157f){logger[_0x5d4d('0x10')](_0x5d4d('0xb'),_0x410599,_0x4e157f);_0x38a9be(_0x4e157f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2a8eac7..dc49e6a 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 _0xeb15=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4f1431,_0x17258e){var _0x511450=function(_0x2ec64c){while(--_0x2ec64c){_0x4f1431['push'](_0x4f1431['shift']());}};_0x511450(++_0x17258e);}(_0xeb15,0x1d3));var _0x5eb1=function(_0x18fd21,_0x4af3d1){_0x18fd21=_0x18fd21-0x0;var _0x113f67=_0xeb15[_0x18fd21];return _0x113f67;};'use strict';var multer=require(_0x5eb1('0x0'));var util=require(_0x5eb1('0x1'));var path=require(_0x5eb1('0x2'));var timeout=require(_0x5eb1('0x3'));var express=require('express');var router=express[_0x5eb1('0x4')]();var auth=require(_0x5eb1('0x5'));var interaction=require(_0x5eb1('0x6'));var config=require(_0x5eb1('0x7'));var controller=require(_0x5eb1('0x8'));router[_0x5eb1('0x9')]('/',auth['isAuthenticated'](),controller[_0x5eb1('0xa')]);router[_0x5eb1('0x9')](_0x5eb1('0xb'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0xd')]);router[_0x5eb1('0x9')](_0x5eb1('0xe'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0xf')]);router['post']('/',auth[_0x5eb1('0xc')](),controller[_0x5eb1('0x10')]);router[_0x5eb1('0x11')](_0x5eb1('0xe'),auth[_0x5eb1('0xc')](),controller[_0x5eb1('0x12')]);router[_0x5eb1('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5eb1('0x14')]=router; \ No newline at end of file +var _0x17e0=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x2d72be,_0x560ce4){var _0x53421d=function(_0x1affc2){while(--_0x1affc2){_0x2d72be['push'](_0x2d72be['shift']());}};_0x53421d(++_0x560ce4);}(_0x17e0,0x1f1));var _0x017e=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x17e0[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0x017e('0x0'));var path=require(_0x017e('0x1'));var timeout=require(_0x017e('0x2'));var express=require(_0x017e('0x3'));var router=express[_0x017e('0x4')]();var auth=require(_0x017e('0x5'));var interaction=require(_0x017e('0x6'));var config=require(_0x017e('0x7'));var controller=require(_0x017e('0x8'));router[_0x017e('0x9')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0xb')]);router[_0x017e('0x9')](_0x017e('0xc'),auth[_0x017e('0xa')](),controller[_0x017e('0xd')]);router['get'](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0xf')]);router[_0x017e('0x10')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0x11')]);router[_0x017e('0x12')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0x13')]);router[_0x017e('0x14')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0x15')]);module[_0x017e('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 63075fd..ac52bc8 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 _0x3127=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x46a6d2,_0x3e66f1){var _0x345284=function(_0x9d9bd7){while(--_0x9d9bd7){_0x46a6d2['push'](_0x46a6d2['shift']());}};_0x345284(++_0x3e66f1);}(_0x3127,0x1b8));var _0x7312=function(_0x220d63,_0x2ac173){_0x220d63=_0x220d63-0x0;var _0xffccaa=_0x3127[_0x220d63];return _0xffccaa;};'use strict';var Sequelize=require(_0x7312('0x0'));var moment=require('moment');module[_0x7312('0x1')]={'channel':{'type':Sequelize[_0x7312('0x2')]},'membername':{'type':Sequelize[_0x7312('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7312('0x2')],'defaultValue':_0x7312('0x3'),'comment':_0x7312('0x4')},'duration':{'type':Sequelize[_0x7312('0x5')]},'enterAt':{'type':Sequelize[_0x7312('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x29477c){var _0x1dc7b4=moment(_0x29477c);var _0x20afa7=moment(this[_0x7312('0x7')](_0x7312('0x8')));var _0x48c501=_0x1dc7b4[_0x7312('0x9')](_0x20afa7,_0x7312('0xa'));this[_0x7312('0xb')](_0x7312('0xc'),_0x29477c);this[_0x7312('0xb')](_0x7312('0xd'),_0x48c501||null);}},'data1':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0x7312('0xf')},'data3':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0x10')},'data4':{'type':Sequelize[_0x7312('0x2')],'comment':_0x7312('0x11')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x7312('0x2')]},'internal':{'type':Sequelize[_0x7312('0x5')]},'uniqueid':{'type':Sequelize[_0x7312('0x2')]}}; \ No newline at end of file +var _0x276b=['talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration','talk:[start]','talk:[dial\x20string]'];(function(_0x4a277b,_0x3c7a5b){var _0x30d050=function(_0x100613){while(--_0x100613){_0x4a277b['push'](_0x4a277b['shift']());}};_0x30d050(++_0x3c7a5b);}(_0x276b,0x6a));var _0xb276=function(_0x5f42f9,_0x2fddb4){_0x5f42f9=_0x5f42f9-0x0;var _0x5aefc5=_0x276b[_0x5f42f9];return _0x5aefc5;};'use strict';var Sequelize=require(_0xb276('0x0'));var moment=require(_0xb276('0x1'));module['exports']={'channel':{'type':Sequelize[_0xb276('0x2')]},'membername':{'type':Sequelize[_0xb276('0x2')]},'interface':{'type':Sequelize[_0xb276('0x2')]},'type':{'type':Sequelize[_0xb276('0x2')],'defaultValue':_0xb276('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb276('0x4')]},'enterAt':{'type':Sequelize[_0xb276('0x5')]},'exitAt':{'type':Sequelize[_0xb276('0x5')],'set':function(_0x5954ef){var _0x5d2f7b=moment(_0x5954ef);var _0x3a645a=moment(this[_0xb276('0x6')](_0xb276('0x7')));var _0x389904=_0x5d2f7b['diff'](_0x3a645a,_0xb276('0x8'));this['setDataValue'](_0xb276('0x9'),_0x5954ef);this[_0xb276('0xa')](_0xb276('0xb'),_0x389904||null);}},'data1':{'type':Sequelize[_0xb276('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb276('0x2')],'comment':_0xb276('0xc')},'data3':{'type':Sequelize[_0xb276('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xb276('0x2')],'comment':_0xb276('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0xb276('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb276('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index cc7a8b4..207090c 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 _0x9bca=['crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x9bca,0x16a));var _0xa9bc=function(_0xf686b2,_0x5c5866){_0xf686b2=_0xf686b2-0x0;var _0x307a5f=_0x9bca[_0xf686b2];return _0x307a5f;};'use strict';var pdf=require(_0xa9bc('0x0'));var emlformat=require(_0xa9bc('0x1'));var rimraf=require(_0xa9bc('0x2'));var zipdir=require(_0xa9bc('0x3'));var jsonpatch=require(_0xa9bc('0x4'));var rp=require('request-promise');var moment=require(_0xa9bc('0x5'));var BPromise=require(_0xa9bc('0x6'));var Mustache=require(_0xa9bc('0x7'));var util=require(_0xa9bc('0x8'));var path=require('path');var sox=require(_0xa9bc('0x9'));var csv=require(_0xa9bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9bc('0xb'));var squel=require(_0xa9bc('0xc'));var crypto=require(_0xa9bc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9bc('0xa'));var querystring=require(_0xa9bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa9bc('0xf'));var qs=require(_0xa9bc('0x10'));var as=require(_0xa9bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9bc('0x12'))(_0xa9bc('0x13'));var utils=require(_0xa9bc('0x14'));var config=require(_0xa9bc('0x15'));var licenseUtil=require(_0xa9bc('0x16'));var db=require(_0xa9bc('0x17'))['db'];function respondWithStatusCode(_0x29deda,_0x36654c){_0x36654c=_0x36654c||0xcc;return function(_0x5edc30){if(_0x5edc30){return _0x29deda[_0xa9bc('0x18')](_0x36654c);}return _0x29deda['status'](_0x36654c)[_0xa9bc('0x19')]();};}function respondWithResult(_0x2e754e,_0x18be01){_0x18be01=_0x18be01||0xc8;return function(_0x521ad2){if(_0x521ad2){return _0x2e754e[_0xa9bc('0x1a')](_0x18be01)[_0xa9bc('0x1b')](_0x521ad2);}};}function respondWithFilteredResult(_0x3f81ed,_0x4dbd19){return function(_0x2e6166){if(_0x2e6166){var _0x26c965=_0x2e6166[_0xa9bc('0x1c')],_0x51076c=_0x4dbd19[_0xa9bc('0x1d')],_0xbdb289=_0x4dbd19[_0xa9bc('0x1d')]+_0x4dbd19[_0xa9bc('0x1e')],_0xc28f24;if(_0xbdb289>=_0x26c965){_0xbdb289=_0x26c965;_0xc28f24=0xc8;}else{_0xc28f24=0xce;}_0x3f81ed[_0xa9bc('0x1a')](_0xc28f24);return _0x3f81ed[_0xa9bc('0x1f')](_0xa9bc('0x20'),_0x51076c+'-'+_0xbdb289+'/'+_0x26c965)[_0xa9bc('0x1b')](_0x2e6166);}return null;};}function patchUpdates(_0xfbf042){return function(_0x509f11){try{jsonpatch[_0xa9bc('0x21')](_0x509f11,_0xfbf042,!![]);}catch(_0x27149d){return BPromise[_0xa9bc('0x22')](_0x27149d);}return _0x509f11[_0xa9bc('0x23')]();};}function saveUpdates(_0x17bec3,_0x1c52e8){return function(_0x27f286){if(_0x27f286){return _0x27f286[_0xa9bc('0x24')](_0x17bec3)[_0xa9bc('0x25')](function(_0x16ef6e){return _0x16ef6e;});}return null;};}function removeEntity(_0x344793,_0x12797d){return function(_0x34b6fb){if(_0x34b6fb){return _0x34b6fb[_0xa9bc('0x26')]()['then'](function(){_0x344793[_0xa9bc('0x1a')](0xcc)[_0xa9bc('0x19')]();});}};}function handleEntityNotFound(_0x4d80fd,_0x1d700c){return function(_0x5d3d40){if(!_0x5d3d40){_0x4d80fd['sendStatus'](0x194);}return _0x5d3d40;};}function handleError(_0xb57637,_0x4547de){_0x4547de=_0x4547de||0x1f4;return function(_0x2e30b4){logger[_0xa9bc('0x27')](_0x2e30b4[_0xa9bc('0x28')]);if(_0x2e30b4[_0xa9bc('0x29')]){delete _0x2e30b4[_0xa9bc('0x29')];}_0xb57637[_0xa9bc('0x1a')](_0x4547de)[_0xa9bc('0x2a')](_0x2e30b4);};}exports[_0xa9bc('0x2b')]=function(_0x423418,_0x3fde1e){var _0x17eef4={},_0x4b8cb8={},_0x683d1c={'count':0x0,'rows':[]};var _0x554f4c=_[_0xa9bc('0x2c')](db[_0xa9bc('0x2d')]['rawAttributes'],function(_0x471bb7){return{'name':_0x471bb7[_0xa9bc('0x2e')],'type':_0x471bb7['type'][_0xa9bc('0x2f')]};});_0x4b8cb8[_0xa9bc('0x30')]=_[_0xa9bc('0x2c')](_0x554f4c,_0xa9bc('0x29'));_0x4b8cb8[_0xa9bc('0x31')]=_[_0xa9bc('0x32')](_0x423418['query']);_0x4b8cb8[_0xa9bc('0x33')]=_[_0xa9bc('0x34')](_0x4b8cb8['model'],_0x4b8cb8[_0xa9bc('0x31')]);_0x17eef4[_0xa9bc('0x35')]=_[_0xa9bc('0x34')](_0x4b8cb8[_0xa9bc('0x30')],qs[_0xa9bc('0x36')](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x36')]));_0x17eef4[_0xa9bc('0x35')]=_0x17eef4['attributes']['length']?_0x17eef4[_0xa9bc('0x35')]:_0x4b8cb8[_0xa9bc('0x30')];if(!_0x423418[_0xa9bc('0x31')][_0xa9bc('0x37')](_0xa9bc('0x38'))){_0x17eef4['limit']=qs['limit'](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x1e')]);_0x17eef4['offset']=qs[_0xa9bc('0x1d')](_0x423418['query'][_0xa9bc('0x1d')]);}_0x17eef4['order']=qs[_0xa9bc('0x39')](_0x423418[_0xa9bc('0x31')][_0xa9bc('0x39')]);_0x17eef4['where']=qs['filters'](_['pick'](_0x423418[_0xa9bc('0x31')],_0x4b8cb8[_0xa9bc('0x33')]),_0x554f4c);if(_0x423418[_0xa9bc('0x31')][_0xa9bc('0x3a')]){_0x17eef4[_0xa9bc('0x3b')]=_[_0xa9bc('0x3c')](_0x17eef4['where'],{'$or':_[_0xa9bc('0x2c')](_0x554f4c,function(_0x69eb30){if(_0x69eb30[_0xa9bc('0x3d')]!=='VIRTUAL'){var _0x34e352={};_0x34e352[_0x69eb30[_0xa9bc('0x29')]]={'$like':'%'+_0x423418[_0xa9bc('0x31')][_0xa9bc('0x3a')]+'%'};return _0x34e352;}})});}_0x17eef4=_['merge']({},_0x17eef4,_0x423418[_0xa9bc('0x3e')]);var _0x261420={'where':_0x17eef4[_0xa9bc('0x3b')]};return db['MemberReport'][_0xa9bc('0x1c')](_0x261420)[_0xa9bc('0x25')](function(_0x1c0e5b){_0x683d1c[_0xa9bc('0x1c')]=_0x1c0e5b;if(_0x423418['query'][_0xa9bc('0x3f')]){_0x17eef4[_0xa9bc('0x40')]=[{'all':!![]}];}return db[_0xa9bc('0x2d')][_0xa9bc('0x41')](_0x17eef4);})[_0xa9bc('0x25')](function(_0x1e3157){_0x683d1c[_0xa9bc('0x42')]=_0x1e3157;return _0x683d1c;})[_0xa9bc('0x25')](respondWithFilteredResult(_0x3fde1e,_0x17eef4))[_0xa9bc('0x43')](handleError(_0x3fde1e,null));};exports['show']=function(_0x89b57d,_0x474f6e){var _0x572c53={'raw':!![],'where':{'id':_0x89b57d['params']['id']}},_0x1f85f1={};_0x1f85f1['model']=_[_0xa9bc('0x32')](db[_0xa9bc('0x2d')][_0xa9bc('0x44')]);_0x1f85f1['query']=_[_0xa9bc('0x32')](_0x89b57d['query']);_0x1f85f1[_0xa9bc('0x33')]=_[_0xa9bc('0x34')](_0x1f85f1['model'],_0x1f85f1[_0xa9bc('0x31')]);_0x572c53['attributes']=_[_0xa9bc('0x34')](_0x1f85f1[_0xa9bc('0x30')],qs[_0xa9bc('0x36')](_0x89b57d[_0xa9bc('0x31')]['fields']));_0x572c53[_0xa9bc('0x35')]=_0x572c53[_0xa9bc('0x35')][_0xa9bc('0x45')]?_0x572c53[_0xa9bc('0x35')]:_0x1f85f1[_0xa9bc('0x30')];if(_0x89b57d[_0xa9bc('0x31')][_0xa9bc('0x3f')]){_0x572c53[_0xa9bc('0x40')]=[{'all':!![]}];}_0x572c53=_[_0xa9bc('0x3c')]({},_0x572c53,_0x89b57d[_0xa9bc('0x3e')]);return db[_0xa9bc('0x2d')][_0xa9bc('0x46')](_0x572c53)[_0xa9bc('0x25')](handleEntityNotFound(_0x474f6e,null))['then'](respondWithResult(_0x474f6e,null))['catch'](handleError(_0x474f6e,null));};exports[_0xa9bc('0x47')]=function(_0x3bc717,_0x3c12f4){return db['MemberReport'][_0xa9bc('0x47')](_0x3bc717[_0xa9bc('0x48')],{})[_0xa9bc('0x25')](respondWithResult(_0x3c12f4,0xc9))[_0xa9bc('0x43')](handleError(_0x3c12f4,null));};exports[_0xa9bc('0x24')]=function(_0x18083a,_0x468bbe){if(_0x18083a[_0xa9bc('0x48')]['id']){delete _0x18083a[_0xa9bc('0x48')]['id'];}return db[_0xa9bc('0x2d')][_0xa9bc('0x46')]({'where':{'id':_0x18083a[_0xa9bc('0x49')]['id']}})[_0xa9bc('0x25')](handleEntityNotFound(_0x468bbe,null))[_0xa9bc('0x25')](saveUpdates(_0x18083a[_0xa9bc('0x48')],null))[_0xa9bc('0x25')](respondWithResult(_0x468bbe,null))[_0xa9bc('0x43')](handleError(_0x468bbe,null));};exports[_0xa9bc('0x26')]=function(_0x1f6830,_0x216439){return db['MemberReport'][_0xa9bc('0x46')]({'where':{'id':_0x1f6830[_0xa9bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x216439,null))[_0xa9bc('0x25')](removeEntity(_0x216439,null))['catch'](handleError(_0x216439,null));};exports[_0xa9bc('0x4a')]=function(_0x74bd50,_0x13f42e){return db[_0xa9bc('0x2d')]['describe']()['then'](respondWithResult(_0x13f42e,null))[_0xa9bc('0x43')](handleError(_0x13f42e,null));}; \ No newline at end of file +var _0x079d=['find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','filter','merge','type','VIRTUAL','MemberReport','includeAll','include','findAll','catch','show','params','options'];(function(_0x34cbb3,_0x377ea0){var _0x46d8f5=function(_0x2c9584){while(--_0x2c9584){_0x34cbb3['push'](_0x34cbb3['shift']());}};_0x46d8f5(++_0x377ea0);}(_0x079d,0xdc));var _0xd079=function(_0x262500,_0x2d0777){_0x262500=_0x262500-0x0;var _0x2abb47=_0x079d[_0x262500];return _0x2abb47;};'use strict';var pdf=require(_0xd079('0x0'));var emlformat=require(_0xd079('0x1'));var rimraf=require(_0xd079('0x2'));var zipdir=require(_0xd079('0x3'));var jsonpatch=require(_0xd079('0x4'));var rp=require(_0xd079('0x5'));var moment=require(_0xd079('0x6'));var BPromise=require(_0xd079('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd079('0x8'));var sox=require('sox');var csv=require(_0xd079('0x9'));var ejs=require(_0xd079('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd079('0xb'));var jsforce=require(_0xd079('0xc'));var deskjs=require(_0xd079('0xd'));var toCsv=require(_0xd079('0x9'));var querystring=require(_0xd079('0xe'));var Papa=require(_0xd079('0xf'));var Redis=require(_0xd079('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd079('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd079('0x12'));var logger=require(_0xd079('0x13'))(_0xd079('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd079('0x15'));var db=require(_0xd079('0x16'))['db'];function respondWithStatusCode(_0x2847d0,_0x4a64be){_0x4a64be=_0x4a64be||0xcc;return function(_0x115a4b){if(_0x115a4b){return _0x2847d0['sendStatus'](_0x4a64be);}return _0x2847d0['status'](_0x4a64be)['end']();};}function respondWithResult(_0x1df399,_0x7d9e37){_0x7d9e37=_0x7d9e37||0xc8;return function(_0x3be511){if(_0x3be511){return _0x1df399[_0xd079('0x17')](_0x7d9e37)[_0xd079('0x18')](_0x3be511);}};}function respondWithFilteredResult(_0x5bc50b,_0x5ecfc9){return function(_0x5f1d61){if(_0x5f1d61){var _0x132d0f=_0x5f1d61[_0xd079('0x19')],_0x429d36=_0x5ecfc9[_0xd079('0x1a')],_0x2785bf=_0x5ecfc9[_0xd079('0x1a')]+_0x5ecfc9['limit'],_0x4afbf2;if(_0x2785bf>=_0x132d0f){_0x2785bf=_0x132d0f;_0x4afbf2=0xc8;}else{_0x4afbf2=0xce;}_0x5bc50b[_0xd079('0x17')](_0x4afbf2);return _0x5bc50b[_0xd079('0x1b')](_0xd079('0x1c'),_0x429d36+'-'+_0x2785bf+'/'+_0x132d0f)['json'](_0x5f1d61);}return null;};}function patchUpdates(_0x2a3e29){return function(_0x31eb7c){try{jsonpatch[_0xd079('0x1d')](_0x31eb7c,_0x2a3e29,!![]);}catch(_0x1cf954){return BPromise[_0xd079('0x1e')](_0x1cf954);}return _0x31eb7c[_0xd079('0x1f')]();};}function saveUpdates(_0x3307cb,_0x2d123e){return function(_0x289025){if(_0x289025){return _0x289025[_0xd079('0x20')](_0x3307cb)[_0xd079('0x21')](function(_0x1fede2){return _0x1fede2;});}return null;};}function removeEntity(_0x1e931c,_0x41a7c3){return function(_0x3b6ccf){if(_0x3b6ccf){return _0x3b6ccf[_0xd079('0x22')]()[_0xd079('0x21')](function(){_0x1e931c[_0xd079('0x17')](0xcc)[_0xd079('0x23')]();});}};}function handleEntityNotFound(_0xc3701e,_0x4f4dcf){return function(_0x3aba95){if(!_0x3aba95){_0xc3701e[_0xd079('0x24')](0x194);}return _0x3aba95;};}function handleError(_0x3495e0,_0x3db644){_0x3db644=_0x3db644||0x1f4;return function(_0x5291b9){logger[_0xd079('0x25')](_0x5291b9['stack']);if(_0x5291b9[_0xd079('0x26')]){delete _0x5291b9[_0xd079('0x26')];}_0x3495e0[_0xd079('0x17')](_0x3db644)[_0xd079('0x27')](_0x5291b9);};}exports['index']=function(_0x1d7b69,_0x129e05){var _0x58d88f={},_0x2d7040={},_0x36df51={'count':0x0,'rows':[]};var _0x17c43c=_[_0xd079('0x28')](db['MemberReport'][_0xd079('0x29')],function(_0x2d7882){return{'name':_0x2d7882['fieldName'],'type':_0x2d7882['type'][_0xd079('0x2a')]};});_0x2d7040[_0xd079('0x2b')]=_[_0xd079('0x28')](_0x17c43c,_0xd079('0x26'));_0x2d7040['query']=_[_0xd079('0x2c')](_0x1d7b69[_0xd079('0x2d')]);_0x2d7040[_0xd079('0x2e')]=_[_0xd079('0x2f')](_0x2d7040['model'],_0x2d7040[_0xd079('0x2d')]);_0x58d88f[_0xd079('0x30')]=_['intersection'](_0x2d7040['model'],qs[_0xd079('0x31')](_0x1d7b69[_0xd079('0x2d')][_0xd079('0x31')]));_0x58d88f[_0xd079('0x30')]=_0x58d88f[_0xd079('0x30')][_0xd079('0x32')]?_0x58d88f['attributes']:_0x2d7040[_0xd079('0x2b')];if(!_0x1d7b69[_0xd079('0x2d')][_0xd079('0x33')]('nolimit')){_0x58d88f[_0xd079('0x34')]=qs[_0xd079('0x34')](_0x1d7b69[_0xd079('0x2d')]['limit']);_0x58d88f['offset']=qs[_0xd079('0x1a')](_0x1d7b69[_0xd079('0x2d')][_0xd079('0x1a')]);}_0x58d88f[_0xd079('0x35')]=qs['sort'](_0x1d7b69[_0xd079('0x2d')]['sort']);_0x58d88f[_0xd079('0x36')]=qs[_0xd079('0x2e')](_[_0xd079('0x37')](_0x1d7b69[_0xd079('0x2d')],_0x2d7040[_0xd079('0x2e')]),_0x17c43c);if(_0x1d7b69['query'][_0xd079('0x38')]){_0x58d88f[_0xd079('0x36')]=_[_0xd079('0x39')](_0x58d88f['where'],{'$or':_[_0xd079('0x28')](_0x17c43c,function(_0xc72acd){if(_0xc72acd[_0xd079('0x3a')]!==_0xd079('0x3b')){var _0x3b59e3={};_0x3b59e3[_0xc72acd[_0xd079('0x26')]]={'$like':'%'+_0x1d7b69[_0xd079('0x2d')]['filter']+'%'};return _0x3b59e3;}})});}_0x58d88f=_['merge']({},_0x58d88f,_0x1d7b69['options']);var _0xe92715={'where':_0x58d88f[_0xd079('0x36')]};return db[_0xd079('0x3c')][_0xd079('0x19')](_0xe92715)[_0xd079('0x21')](function(_0x347020){_0x36df51[_0xd079('0x19')]=_0x347020;if(_0x1d7b69[_0xd079('0x2d')][_0xd079('0x3d')]){_0x58d88f[_0xd079('0x3e')]=[{'all':!![]}];}return db[_0xd079('0x3c')][_0xd079('0x3f')](_0x58d88f);})[_0xd079('0x21')](function(_0x1d7356){_0x36df51['rows']=_0x1d7356;return _0x36df51;})[_0xd079('0x21')](respondWithFilteredResult(_0x129e05,_0x58d88f))[_0xd079('0x40')](handleError(_0x129e05,null));};exports[_0xd079('0x41')]=function(_0x5020ab,_0x1ce19e){var _0x141213={'raw':!![],'where':{'id':_0x5020ab[_0xd079('0x42')]['id']}},_0x2bcece={};_0x2bcece[_0xd079('0x2b')]=_[_0xd079('0x2c')](db['MemberReport'][_0xd079('0x29')]);_0x2bcece[_0xd079('0x2d')]=_['keys'](_0x5020ab[_0xd079('0x2d')]);_0x2bcece['filters']=_['intersection'](_0x2bcece[_0xd079('0x2b')],_0x2bcece['query']);_0x141213[_0xd079('0x30')]=_[_0xd079('0x2f')](_0x2bcece[_0xd079('0x2b')],qs[_0xd079('0x31')](_0x5020ab[_0xd079('0x2d')]['fields']));_0x141213[_0xd079('0x30')]=_0x141213['attributes'][_0xd079('0x32')]?_0x141213['attributes']:_0x2bcece[_0xd079('0x2b')];if(_0x5020ab[_0xd079('0x2d')]['includeAll']){_0x141213[_0xd079('0x3e')]=[{'all':!![]}];}_0x141213=_[_0xd079('0x39')]({},_0x141213,_0x5020ab[_0xd079('0x43')]);return db[_0xd079('0x3c')][_0xd079('0x44')](_0x141213)[_0xd079('0x21')](handleEntityNotFound(_0x1ce19e,null))[_0xd079('0x21')](respondWithResult(_0x1ce19e,null))[_0xd079('0x40')](handleError(_0x1ce19e,null));};exports[_0xd079('0x45')]=function(_0x4fdfe9,_0x977cee){return db[_0xd079('0x3c')][_0xd079('0x45')](_0x4fdfe9[_0xd079('0x46')],{})['then'](respondWithResult(_0x977cee,0xc9))[_0xd079('0x40')](handleError(_0x977cee,null));};exports[_0xd079('0x20')]=function(_0x26ac49,_0x2e2a2f){if(_0x26ac49['body']['id']){delete _0x26ac49['body']['id'];}return db[_0xd079('0x3c')][_0xd079('0x44')]({'where':{'id':_0x26ac49['params']['id']}})[_0xd079('0x21')](handleEntityNotFound(_0x2e2a2f,null))[_0xd079('0x21')](saveUpdates(_0x26ac49[_0xd079('0x46')],null))[_0xd079('0x21')](respondWithResult(_0x2e2a2f,null))[_0xd079('0x40')](handleError(_0x2e2a2f,null));};exports[_0xd079('0x22')]=function(_0x280568,_0x28054e){return db['MemberReport'][_0xd079('0x44')]({'where':{'id':_0x280568[_0xd079('0x42')]['id']}})[_0xd079('0x21')](handleEntityNotFound(_0x28054e,null))['then'](removeEntity(_0x28054e,null))[_0xd079('0x40')](handleError(_0x28054e,null));};exports[_0xd079('0x47')]=function(_0x179a1f,_0xbb3623){return db[_0xd079('0x3c')][_0xd079('0x47')]()['then'](respondWithResult(_0xbb3623,null))[_0xd079('0x40')](handleError(_0xbb3623,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 44d0d6c..231ce03 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 _0xda80=['util','api','moment','request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','lodash'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0xda80,0x83));var _0x0da8=function(_0x2de2c4,_0x21f72e){_0x2de2c4=_0x2de2c4-0x0;var _0xfef4cd=_0xda80[_0x2de2c4];return _0xfef4cd;};'use strict';var _=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var logger=require('../../config/logger')(_0x0da8('0x2'));var moment=require(_0x0da8('0x3'));var BPromise=require('bluebird');var rp=require(_0x0da8('0x4'));var fs=require('fs');var path=require(_0x0da8('0x5'));var rimraf=require(_0x0da8('0x6'));var config=require('../../config/environment');var attributes=require(_0x0da8('0x7'));module[_0x0da8('0x8')]=function(_0x514894,_0x581758){return _0x514894[_0x0da8('0x9')]('MemberReport',attributes,{'tableName':_0x0da8('0xa'),'paranoid':![],'indexes':[{'name':_0x0da8('0xb'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x96fc=['rimraf','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','request-promise'];(function(_0xa1f542,_0x4e58f5){var _0x13a361=function(_0x4169b3){while(--_0x4169b3){_0xa1f542['push'](_0xa1f542['shift']());}};_0x13a361(++_0x4e58f5);}(_0x96fc,0x1f3));var _0xc96f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96fc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc96f('0x0'));var util=require('util');var logger=require(_0xc96f('0x1'))(_0xc96f('0x2'));var moment=require(_0xc96f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc96f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc96f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc96f('0x6'));module['exports']=function(_0xf39de1,_0x32e43f){return _0xf39de1['define'](_0xc96f('0x7'),attributes,{'tableName':_0xc96f('0x8'),'paranoid':![],'indexes':[{'name':_0xc96f('0x9'),'fields':[_0xc96f('0xa'),_0xc96f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8ea5c39..f0f97c0 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 _0x07c7=['ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','limit','include','map','attributes','model','GetMemberReport','debug','create','body','CreateMemberReport','UpdateMemberReport','update','moment','bluebird','randomstring'];(function(_0x49813b,_0x4f170a){var _0x491ece=function(_0x45c465){while(--_0x45c465){_0x49813b['push'](_0x49813b['shift']());}};_0x491ece(++_0x4f170a);}(_0x07c7,0x1c5));var _0x707c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x07c7[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x707c('0x0'));var BPromise=require(_0x707c('0x1'));var rs=require(_0x707c('0x2'));var fs=require('fs');var Redis=require(_0x707c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x707c('0x4'));var logger=require(_0x707c('0x5'))(_0x707c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x707c('0x7')][_0x707c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a869,_0x23dfd5,_0x240ace){return new BPromise(function(_0x529e2c,_0x543207){return client[_0x707c('0x9')](_0x52a869,_0x240ace)[_0x707c('0xa')](function(_0x3598d3){logger[_0x707c('0xb')](_0x707c('0xc'),_0x23dfd5,'request\x20sent');logger['debug'](_0x707c('0xd'),_0x23dfd5,_0x707c('0xe'),JSON[_0x707c('0xf')](_0x3598d3));if(_0x3598d3[_0x707c('0x10')]){if(_0x3598d3['error'][_0x707c('0x11')]===0x1f4){logger['error'](_0x707c('0xc'),_0x23dfd5,_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);return _0x543207(_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);}logger[_0x707c('0x10')]('MemberReport,\x20%s,\x20%s',_0x23dfd5,_0x3598d3[_0x707c('0x10')]['message']);return _0x529e2c(_0x3598d3[_0x707c('0x10')][_0x707c('0x12')]);}else{logger[_0x707c('0xb')](_0x707c('0xc'),_0x23dfd5,_0x707c('0xe'));_0x529e2c(_0x3598d3[_0x707c('0x13')][_0x707c('0x12')]);}})[_0x707c('0x14')](function(_0x3227c8){logger['error'](_0x707c('0xc'),_0x23dfd5,_0x3227c8);_0x543207(_0x3227c8);});});}exports['GetMemberReport']=function(_0x12167b){var _0x57bca0=this;return new Promise(function(_0x57a204,_0x418e3d){return db[_0x707c('0x15')][_0x707c('0x16')]({'raw':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x18')]===undefined?!![]:![]:!![],'where':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x19')]||null:null,'attributes':_0x12167b['options']?_0x12167b[_0x707c('0x17')]['attributes']||null:null,'limit':_0x12167b[_0x707c('0x17')]?_0x12167b[_0x707c('0x17')][_0x707c('0x1a')]||null:null,'include':_0x12167b[_0x707c('0x17')]?_0x12167b['options'][_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x12167b[_0x707c('0x17')][_0x707c('0x1b')],function(_0x5c239e){return{'model':db[_0x5c239e['model']],'as':_0x5c239e['as'],'attributes':_0x5c239e['attributes'],'include':_0x5c239e[_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x5c239e['include'],function(_0x58b523){return{'model':db[_0x58b523['model']],'as':_0x58b523['as'],'attributes':_0x58b523[_0x707c('0x1d')],'include':_0x58b523[_0x707c('0x1b')]?_[_0x707c('0x1c')](_0x58b523['include'],function(_0x3a3973){return{'model':db[_0x3a3973[_0x707c('0x1e')]],'as':_0x3a3973['as'],'attributes':_0x3a3973[_0x707c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x707c('0xa')](function(_0x325354){logger[_0x707c('0xb')](_0x707c('0x1f'),_0x12167b);logger[_0x707c('0x20')](_0x707c('0x1f'),_0x12167b,JSON[_0x707c('0xf')](_0x325354));_0x57a204(_0x325354);})['catch'](function(_0x340391){logger['error'](_0x707c('0x1f'),_0x340391['message'],_0x12167b);_0x418e3d(_0x57bca0[_0x707c('0x10')](0x1f4,_0x340391[_0x707c('0x12')]));});});};exports['CreateMemberReport']=function(_0x25ab49){var _0x5d3ec7=this;return new Promise(function(_0x407092,_0x385f6f){return db['MemberReport'][_0x707c('0x21')](_0x25ab49[_0x707c('0x22')],{'raw':_0x25ab49[_0x707c('0x17')]?_0x25ab49['options'][_0x707c('0x18')]===undefined?!![]:![]:!![]})[_0x707c('0xa')](function(_0x3f7bfa){logger['info'](_0x707c('0x23'),_0x25ab49);logger[_0x707c('0x20')](_0x707c('0x23'),_0x25ab49,JSON[_0x707c('0xf')](_0x3f7bfa));_0x407092(_0x3f7bfa);})[_0x707c('0x14')](function(_0x4d4e2d){logger[_0x707c('0x10')](_0x707c('0x23'),_0x4d4e2d[_0x707c('0x12')],_0x25ab49);_0x385f6f(_0x5d3ec7[_0x707c('0x10')](0x1f4,_0x4d4e2d['message']));});});};exports[_0x707c('0x24')]=function(_0x4a9c40){var _0x5d9f66=this;return new Promise(function(_0x2dbd27,_0x1e54e1){return db['MemberReport'][_0x707c('0x25')](_0x4a9c40[_0x707c('0x22')],{'raw':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40['options'][_0x707c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40[_0x707c('0x17')][_0x707c('0x19')]||null:null,'attributes':_0x4a9c40[_0x707c('0x17')]?_0x4a9c40[_0x707c('0x17')][_0x707c('0x1d')]||null:null,'limit':_0x4a9c40['options']?_0x4a9c40['options'][_0x707c('0x1a')]||null:null})[_0x707c('0xa')](function(_0x34e3db){logger[_0x707c('0xb')](_0x707c('0x24'),_0x4a9c40);logger['debug'](_0x707c('0x24'),_0x4a9c40,JSON['stringify'](_0x34e3db));_0x2dbd27(_0x34e3db);})[_0x707c('0x14')](function(_0x5913d3){logger[_0x707c('0x10')](_0x707c('0x24'),_0x5913d3[_0x707c('0x12')],_0x4a9c40);_0x1e54e1(_0x5d9f66['error'](0x1f4,_0x5913d3[_0x707c('0x12')]));});});}; \ No newline at end of file +var _0xddec=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','MemberReport,\x20%s,\x20%s','error','message','result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','debug','catch','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5c64bc,_0x2cc502){var _0x5b0023=function(_0x44590c){while(--_0x44590c){_0x5c64bc['push'](_0x5c64bc['shift']());}};_0x5b0023(++_0x2cc502);}(_0xddec,0x100));var _0xcdde=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xddec[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var moment=require(_0xcdde('0x2'));var BPromise=require(_0xcdde('0x3'));var rs=require(_0xcdde('0x4'));var fs=require('fs');var Redis=require(_0xcdde('0x5'));var db=require(_0xcdde('0x6'))['db'];var utils=require(_0xcdde('0x7'));var logger=require(_0xcdde('0x8'))(_0xcdde('0x9'));var config=require('../../config/environment');var jayson=require(_0xcdde('0xa'));var client=jayson[_0xcdde('0xb')][_0xcdde('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36177a,_0x4dc155,_0xf5dd5d){return new BPromise(function(_0x3f0160,_0xd137c1){return client[_0xcdde('0xd')](_0x36177a,_0xf5dd5d)[_0xcdde('0xe')](function(_0xe1af21){logger[_0xcdde('0xf')]('MemberReport,\x20%s,\x20%s',_0x4dc155,_0xcdde('0x10'));logger['debug'](_0xcdde('0x11'),_0x4dc155,_0xcdde('0x10'),JSON[_0xcdde('0x12')](_0xe1af21));if(_0xe1af21['error']){if(_0xe1af21['error']['code']===0x1f4){logger['error'](_0xcdde('0x13'),_0x4dc155,_0xe1af21[_0xcdde('0x14')][_0xcdde('0x15')]);return _0xd137c1(_0xe1af21[_0xcdde('0x14')]['message']);}logger[_0xcdde('0x14')](_0xcdde('0x13'),_0x4dc155,_0xe1af21[_0xcdde('0x14')]['message']);return _0x3f0160(_0xe1af21[_0xcdde('0x14')][_0xcdde('0x15')]);}else{logger[_0xcdde('0xf')](_0xcdde('0x13'),_0x4dc155,'request\x20sent');_0x3f0160(_0xe1af21[_0xcdde('0x16')]['message']);}})['catch'](function(_0x5e8325){logger['error'](_0xcdde('0x13'),_0x4dc155,_0x5e8325);_0xd137c1(_0x5e8325);});});}exports[_0xcdde('0x17')]=function(_0x1e289d){var _0x1a765b=this;return new Promise(function(_0x45c1ad,_0x41f806){return db[_0xcdde('0x18')]['findAll']({'raw':_0x1e289d['options']?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1b')]||null:null,'attributes':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1c')]||null:null,'limit':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1d')]||null:null,'include':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1e')]?_['map'](_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1e')],function(_0x56ec78){return{'model':db[_0x56ec78[_0xcdde('0x1f')]],'as':_0x56ec78['as'],'attributes':_0x56ec78['attributes'],'include':_0x56ec78[_0xcdde('0x1e')]?_[_0xcdde('0x20')](_0x56ec78['include'],function(_0x2be428){return{'model':db[_0x2be428[_0xcdde('0x1f')]],'as':_0x2be428['as'],'attributes':_0x2be428[_0xcdde('0x1c')],'include':_0x2be428[_0xcdde('0x1e')]?_[_0xcdde('0x20')](_0x2be428[_0xcdde('0x1e')],function(_0x24cdc1){return{'model':db[_0x24cdc1[_0xcdde('0x1f')]],'as':_0x24cdc1['as'],'attributes':_0x24cdc1[_0xcdde('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5718b4){logger[_0xcdde('0xf')](_0xcdde('0x17'),_0x1e289d);logger[_0xcdde('0x21')](_0xcdde('0x17'),_0x1e289d,JSON[_0xcdde('0x12')](_0x5718b4));_0x45c1ad(_0x5718b4);})[_0xcdde('0x22')](function(_0x2d293c){logger[_0xcdde('0x14')](_0xcdde('0x17'),_0x2d293c[_0xcdde('0x15')],_0x1e289d);_0x41f806(_0x1a765b['error'](0x1f4,_0x2d293c['message']));});});};exports[_0xcdde('0x23')]=function(_0x256570){var _0x59bdbc=this;return new Promise(function(_0x4a0efc,_0x5638ea){return db['MemberReport'][_0xcdde('0x24')](_0x256570[_0xcdde('0x25')],{'raw':_0x256570[_0xcdde('0x19')]?_0x256570[_0xcdde('0x19')][_0xcdde('0x1a')]===undefined?!![]:![]:!![]})[_0xcdde('0xe')](function(_0x13e7bc){logger['info'](_0xcdde('0x23'),_0x256570);logger[_0xcdde('0x21')]('CreateMemberReport',_0x256570,JSON[_0xcdde('0x12')](_0x13e7bc));_0x4a0efc(_0x13e7bc);})[_0xcdde('0x22')](function(_0x434dd1){logger[_0xcdde('0x14')](_0xcdde('0x23'),_0x434dd1[_0xcdde('0x15')],_0x256570);_0x5638ea(_0x59bdbc[_0xcdde('0x14')](0x1f4,_0x434dd1['message']));});});};exports[_0xcdde('0x26')]=function(_0x35d841){var _0xbd967e=this;return new Promise(function(_0x4a3fe4,_0x1703b4){return db[_0xcdde('0x18')]['update'](_0x35d841[_0xcdde('0x25')],{'raw':_0x35d841[_0xcdde('0x19')]?_0x35d841['options'][_0xcdde('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d841['options']?_0x35d841[_0xcdde('0x19')][_0xcdde('0x1b')]||null:null,'attributes':_0x35d841['options']?_0x35d841['options'][_0xcdde('0x1c')]||null:null,'limit':_0x35d841[_0xcdde('0x19')]?_0x35d841[_0xcdde('0x19')][_0xcdde('0x1d')]||null:null})[_0xcdde('0xe')](function(_0x2e1e6d){logger['info']('UpdateMemberReport',_0x35d841);logger['debug']('UpdateMemberReport',_0x35d841,JSON[_0xcdde('0x12')](_0x2e1e6d));_0x4a3fe4(_0x2e1e6d);})['catch'](function(_0x139d69){logger[_0xcdde('0x14')](_0xcdde('0x26'),_0x139d69[_0xcdde('0x15')],_0x35d841);_0x1703b4(_0xbd967e[_0xcdde('0x14')](0x1f4,_0x139d69[_0xcdde('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d21dbb1..8c7da7f 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 _0x02ce=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x379537,_0x3909c9){var _0xb1efdc=function(_0x758a0e){while(--_0x758a0e){_0x379537['push'](_0x379537['shift']());}};_0xb1efdc(++_0x3909c9);}(_0x02ce,0x1ac));var _0xe02c=function(_0x47a0b1,_0x103afb){_0x47a0b1=_0x47a0b1-0x0;var _0x2b588c=_0x02ce[_0x47a0b1];return _0x2b588c;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',controller[_0xe02c('0x9')]);module[_0xe02c('0xa')]=router; \ No newline at end of file +var _0x57f8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x93b7ce,_0x26be04){var _0x57053b=function(_0x492e41){while(--_0x492e41){_0x93b7ce['push'](_0x93b7ce['shift']());}};_0x57053b(++_0x26be04);}(_0x57f8,0x198));var _0x857f=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x57f8[_0x397bfb];return _0x16c9b9;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var auth=require(_0x857f('0x5'));var interaction=require(_0x857f('0x6'));var config=require(_0x857f('0x7'));var controller=require(_0x857f('0x8'));router[_0x857f('0x9')]('/',controller[_0x857f('0xa')]);module[_0x857f('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 40ee02a..dfdee40 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 _0x1ab3=['exports','STRING','version','sequelize'];(function(_0x55cc83,_0x492a0b){var _0x39880e=function(_0x40eed8){while(--_0x40eed8){_0x55cc83['push'](_0x55cc83['shift']());}};_0x39880e(++_0x492a0b);}(_0x1ab3,0x133));var _0x31ab=function(_0x290149,_0x10b077){_0x290149=_0x290149-0x0;var _0x341702=_0x1ab3[_0x290149];return _0x341702;};'use strict';var Sequelize=require(_0x31ab('0x0'));module[_0x31ab('0x1')]={'version':{'type':Sequelize[_0x31ab('0x2')],'unique':_0x31ab('0x3')}}; \ No newline at end of file +var _0xca5a=['sequelize'];(function(_0x292498,_0x255ef3){var _0x455029=function(_0x110e95){while(--_0x110e95){_0x292498['push'](_0x292498['shift']());}};_0x455029(++_0x255ef3);}(_0xca5a,0xd0));var _0xaca5=function(_0x1b3672,_0xf0a37f){_0x1b3672=_0x1b3672-0x0;var _0x18a82e=_0xca5a[_0x1b3672];return _0x18a82e;};'use strict';var Sequelize=require(_0xaca5('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'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 16c7ec8..3ebad4a 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 _0xbad3=['catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','filters','filter','options','includeAll','findAll','rows'];(function(_0x577b0f,_0x3ffbba){var _0x4b0ee0=function(_0xb3df86){while(--_0xb3df86){_0x577b0f['push'](_0x577b0f['shift']());}};_0x4b0ee0(++_0x3ffbba);}(_0xbad3,0x8d));var _0x3bad=function(_0x1aae68,_0x53905a){_0x1aae68=_0x1aae68-0x0;var _0x1e9b5c=_0xbad3[_0x1aae68];return _0x1e9b5c;};'use strict';var pdf=require(_0x3bad('0x0'));var emlformat=require(_0x3bad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3bad('0x2'));var jsonpatch=require(_0x3bad('0x3'));var rp=require('request-promise');var moment=require(_0x3bad('0x4'));var BPromise=require(_0x3bad('0x5'));var Mustache=require(_0x3bad('0x6'));var util=require(_0x3bad('0x7'));var path=require(_0x3bad('0x8'));var sox=require(_0x3bad('0x9'));var csv=require('to-csv');var ejs=require(_0x3bad('0xa'));var fs=require('fs');var _=require(_0x3bad('0xb'));var squel=require(_0x3bad('0xc'));var crypto=require(_0x3bad('0xd'));var jsforce=require(_0x3bad('0xe'));var deskjs=require(_0x3bad('0xf'));var toCsv=require(_0x3bad('0x10'));var querystring=require(_0x3bad('0x11'));var Papa=require(_0x3bad('0x12'));var Redis=require(_0x3bad('0x13'));var authService=require(_0x3bad('0x14'));var qs=require(_0x3bad('0x15'));var as=require(_0x3bad('0x16'));var hardwareService=require(_0x3bad('0x17'));var logger=require(_0x3bad('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x3bad('0x19'));var licenseUtil=require(_0x3bad('0x1a'));var db=require(_0x3bad('0x1b'))['db'];function respondWithStatusCode(_0xac3057,_0x296dcb){_0x296dcb=_0x296dcb||0xcc;return function(_0x3ea608){if(_0x3ea608){return _0xac3057[_0x3bad('0x1c')](_0x296dcb);}return _0xac3057['status'](_0x296dcb)[_0x3bad('0x1d')]();};}function respondWithResult(_0x3ecabf,_0x31b201){_0x31b201=_0x31b201||0xc8;return function(_0x44055e){if(_0x44055e){return _0x3ecabf[_0x3bad('0x1e')](_0x31b201)[_0x3bad('0x1f')](_0x44055e);}};}function respondWithFilteredResult(_0x218014,_0x5b53b2){return function(_0x25e91f){if(_0x25e91f){var _0x120959=_0x25e91f[_0x3bad('0x20')],_0x3eaf06=_0x5b53b2[_0x3bad('0x21')],_0x18b8f7=_0x5b53b2[_0x3bad('0x21')]+_0x5b53b2[_0x3bad('0x22')],_0x555b33;if(_0x18b8f7>=_0x120959){_0x18b8f7=_0x120959;_0x555b33=0xc8;}else{_0x555b33=0xce;}_0x218014[_0x3bad('0x1e')](_0x555b33);return _0x218014[_0x3bad('0x23')]('Content-Range',_0x3eaf06+'-'+_0x18b8f7+'/'+_0x120959)['json'](_0x25e91f);}return null;};}function patchUpdates(_0x3c3e10){return function(_0x3efb38){try{jsonpatch[_0x3bad('0x24')](_0x3efb38,_0x3c3e10,!![]);}catch(_0x4e1978){return BPromise[_0x3bad('0x25')](_0x4e1978);}return _0x3efb38[_0x3bad('0x26')]();};}function saveUpdates(_0x3d854b,_0xda61cb){return function(_0x449f5d){if(_0x449f5d){return _0x449f5d[_0x3bad('0x27')](_0x3d854b)[_0x3bad('0x28')](function(_0x186f2d){return _0x186f2d;});}return null;};}function removeEntity(_0x1a3289,_0x9a9684){return function(_0x15ad98){if(_0x15ad98){return _0x15ad98[_0x3bad('0x29')]()['then'](function(){_0x1a3289[_0x3bad('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x793d05,_0x669259){return function(_0x4164c5){if(!_0x4164c5){_0x793d05[_0x3bad('0x1c')](0x194);}return _0x4164c5;};}function handleError(_0x3e1d7d,_0x46c7ad){_0x46c7ad=_0x46c7ad||0x1f4;return function(_0x4d6b5b){logger[_0x3bad('0x2a')](_0x4d6b5b['stack']);if(_0x4d6b5b[_0x3bad('0x2b')]){delete _0x4d6b5b[_0x3bad('0x2b')];}_0x3e1d7d[_0x3bad('0x1e')](_0x46c7ad)[_0x3bad('0x2c')](_0x4d6b5b);};}exports[_0x3bad('0x2d')]=function(_0x3d8fe8,_0x5072f5){var _0x35b51e={},_0x33b772={},_0x53ab91={'count':0x0,'rows':[]};var _0x59504a=_[_0x3bad('0x2e')](db[_0x3bad('0x2f')][_0x3bad('0x30')],function(_0x5b3eef){return{'name':_0x5b3eef[_0x3bad('0x31')],'type':_0x5b3eef[_0x3bad('0x32')][_0x3bad('0x33')]};});_0x33b772['model']=_[_0x3bad('0x2e')](_0x59504a,_0x3bad('0x2b'));_0x33b772[_0x3bad('0x34')]=_[_0x3bad('0x35')](_0x3d8fe8[_0x3bad('0x34')]);_0x33b772['filters']=_[_0x3bad('0x36')](_0x33b772['model'],_0x33b772[_0x3bad('0x34')]);_0x35b51e[_0x3bad('0x37')]=_['intersection'](_0x33b772['model'],qs[_0x3bad('0x38')](_0x3d8fe8['query'][_0x3bad('0x38')]));_0x35b51e['attributes']=_0x35b51e['attributes'][_0x3bad('0x39')]?_0x35b51e['attributes']:_0x33b772[_0x3bad('0x3a')];if(!_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x3b')]('nolimit')){_0x35b51e[_0x3bad('0x22')]=qs[_0x3bad('0x22')](_0x3d8fe8[_0x3bad('0x34')]['limit']);_0x35b51e[_0x3bad('0x21')]=qs[_0x3bad('0x21')](_0x3d8fe8['query'][_0x3bad('0x21')]);}_0x35b51e[_0x3bad('0x3c')]=qs['sort'](_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x3d')]);_0x35b51e[_0x3bad('0x3e')]=qs['filters'](_['pick'](_0x3d8fe8[_0x3bad('0x34')],_0x33b772[_0x3bad('0x3f')]),_0x59504a);if(_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x40')]){_0x35b51e[_0x3bad('0x3e')]=_['merge'](_0x35b51e[_0x3bad('0x3e')],{'$or':_[_0x3bad('0x2e')](_0x59504a,function(_0x4c1e31){if(_0x4c1e31['type']!=='VIRTUAL'){var _0x3921ed={};_0x3921ed[_0x4c1e31[_0x3bad('0x2b')]]={'$like':'%'+_0x3d8fe8[_0x3bad('0x34')][_0x3bad('0x40')]+'%'};return _0x3921ed;}})});}_0x35b51e=_['merge']({},_0x35b51e,_0x3d8fe8[_0x3bad('0x41')]);var _0x13b0c9={'where':_0x35b51e['where']};return db['Migration'][_0x3bad('0x20')](_0x13b0c9)[_0x3bad('0x28')](function(_0x444c7b){_0x53ab91[_0x3bad('0x20')]=_0x444c7b;if(_0x3d8fe8['query'][_0x3bad('0x42')]){_0x35b51e['include']=[{'all':!![]}];}return db[_0x3bad('0x2f')][_0x3bad('0x43')](_0x35b51e);})[_0x3bad('0x28')](function(_0x1bcc30){_0x53ab91[_0x3bad('0x44')]=_0x1bcc30;return _0x53ab91;})['then'](respondWithFilteredResult(_0x5072f5,_0x35b51e))[_0x3bad('0x45')](handleError(_0x5072f5,null));}; \ No newline at end of file +var _0x0380=['apply','reject','save','update','then','destroy','error','stack','name','send','map','Migration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','Content-Range'];(function(_0x465316,_0x30b1be){var _0x474e8a=function(_0x4e1544){while(--_0x4e1544){_0x465316['push'](_0x465316['shift']());}};_0x474e8a(++_0x30b1be);}(_0x0380,0x140));var _0x0038=function(_0x1cbcc2,_0x4bcd4a){_0x1cbcc2=_0x1cbcc2-0x0;var _0xce27e7=_0x0380[_0x1cbcc2];return _0xce27e7;};'use strict';var pdf=require(_0x0038('0x0'));var emlformat=require(_0x0038('0x1'));var rimraf=require(_0x0038('0x2'));var zipdir=require(_0x0038('0x3'));var jsonpatch=require(_0x0038('0x4'));var rp=require(_0x0038('0x5'));var moment=require(_0x0038('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0038('0x7'));var util=require(_0x0038('0x8'));var path=require(_0x0038('0x9'));var sox=require(_0x0038('0xa'));var csv=require(_0x0038('0xb'));var ejs=require(_0x0038('0xc'));var fs=require('fs');var _=require(_0x0038('0xd'));var squel=require(_0x0038('0xe'));var crypto=require(_0x0038('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0038('0xb'));var querystring=require(_0x0038('0x10'));var Papa=require('papaparse');var Redis=require(_0x0038('0x11'));var authService=require(_0x0038('0x12'));var qs=require(_0x0038('0x13'));var as=require(_0x0038('0x14'));var hardwareService=require(_0x0038('0x15'));var logger=require(_0x0038('0x16'))('api');var utils=require(_0x0038('0x17'));var config=require(_0x0038('0x18'));var licenseUtil=require(_0x0038('0x19'));var db=require(_0x0038('0x1a'))['db'];function respondWithStatusCode(_0x50b0f6,_0x3d1fbf){_0x3d1fbf=_0x3d1fbf||0xcc;return function(_0x4ff0c5){if(_0x4ff0c5){return _0x50b0f6[_0x0038('0x1b')](_0x3d1fbf);}return _0x50b0f6[_0x0038('0x1c')](_0x3d1fbf)[_0x0038('0x1d')]();};}function respondWithResult(_0x1dc761,_0x587dc5){_0x587dc5=_0x587dc5||0xc8;return function(_0x2eb3cb){if(_0x2eb3cb){return _0x1dc761[_0x0038('0x1c')](_0x587dc5)[_0x0038('0x1e')](_0x2eb3cb);}};}function respondWithFilteredResult(_0x1cb2ab,_0x3f7e8c){return function(_0x51bc88){if(_0x51bc88){var _0x55d3f9=_0x51bc88[_0x0038('0x1f')],_0x23674d=_0x3f7e8c[_0x0038('0x20')],_0x4526f6=_0x3f7e8c[_0x0038('0x20')]+_0x3f7e8c['limit'],_0x19cd8e;if(_0x4526f6>=_0x55d3f9){_0x4526f6=_0x55d3f9;_0x19cd8e=0xc8;}else{_0x19cd8e=0xce;}_0x1cb2ab[_0x0038('0x1c')](_0x19cd8e);return _0x1cb2ab[_0x0038('0x21')](_0x0038('0x22'),_0x23674d+'-'+_0x4526f6+'/'+_0x55d3f9)[_0x0038('0x1e')](_0x51bc88);}return null;};}function patchUpdates(_0x20d900){return function(_0xa8f9a9){try{jsonpatch[_0x0038('0x23')](_0xa8f9a9,_0x20d900,!![]);}catch(_0x2b8d09){return BPromise[_0x0038('0x24')](_0x2b8d09);}return _0xa8f9a9[_0x0038('0x25')]();};}function saveUpdates(_0x34f576,_0x2785ed){return function(_0x39f98f){if(_0x39f98f){return _0x39f98f[_0x0038('0x26')](_0x34f576)[_0x0038('0x27')](function(_0x9f645a){return _0x9f645a;});}return null;};}function removeEntity(_0x3b02e7,_0x318b22){return function(_0x95747e){if(_0x95747e){return _0x95747e[_0x0038('0x28')]()['then'](function(){_0x3b02e7[_0x0038('0x1c')](0xcc)[_0x0038('0x1d')]();});}};}function handleEntityNotFound(_0x562b37,_0x53120e){return function(_0x2f6576){if(!_0x2f6576){_0x562b37['sendStatus'](0x194);}return _0x2f6576;};}function handleError(_0x13f19a,_0x184876){_0x184876=_0x184876||0x1f4;return function(_0x442adc){logger[_0x0038('0x29')](_0x442adc[_0x0038('0x2a')]);if(_0x442adc[_0x0038('0x2b')]){delete _0x442adc[_0x0038('0x2b')];}_0x13f19a[_0x0038('0x1c')](_0x184876)[_0x0038('0x2c')](_0x442adc);};}exports['index']=function(_0x5f6f4b,_0x59d986){var _0x32f702={},_0x47a134={},_0x28eac1={'count':0x0,'rows':[]};var _0x1553b1=_[_0x0038('0x2d')](db[_0x0038('0x2e')][_0x0038('0x2f')],function(_0x30a9fa){return{'name':_0x30a9fa[_0x0038('0x30')],'type':_0x30a9fa['type'][_0x0038('0x31')]};});_0x47a134['model']=_['map'](_0x1553b1,_0x0038('0x2b'));_0x47a134[_0x0038('0x32')]=_[_0x0038('0x33')](_0x5f6f4b[_0x0038('0x32')]);_0x47a134[_0x0038('0x34')]=_[_0x0038('0x35')](_0x47a134[_0x0038('0x36')],_0x47a134['query']);_0x32f702['attributes']=_[_0x0038('0x35')](_0x47a134[_0x0038('0x36')],qs[_0x0038('0x37')](_0x5f6f4b['query'][_0x0038('0x37')]));_0x32f702[_0x0038('0x38')]=_0x32f702[_0x0038('0x38')][_0x0038('0x39')]?_0x32f702[_0x0038('0x38')]:_0x47a134[_0x0038('0x36')];if(!_0x5f6f4b[_0x0038('0x32')][_0x0038('0x3a')]('nolimit')){_0x32f702[_0x0038('0x3b')]=qs[_0x0038('0x3b')](_0x5f6f4b[_0x0038('0x32')]['limit']);_0x32f702[_0x0038('0x20')]=qs[_0x0038('0x20')](_0x5f6f4b[_0x0038('0x32')][_0x0038('0x20')]);}_0x32f702[_0x0038('0x3c')]=qs[_0x0038('0x3d')](_0x5f6f4b[_0x0038('0x32')][_0x0038('0x3d')]);_0x32f702[_0x0038('0x3e')]=qs[_0x0038('0x34')](_[_0x0038('0x3f')](_0x5f6f4b[_0x0038('0x32')],_0x47a134['filters']),_0x1553b1);if(_0x5f6f4b['query'][_0x0038('0x40')]){_0x32f702[_0x0038('0x3e')]=_[_0x0038('0x41')](_0x32f702[_0x0038('0x3e')],{'$or':_[_0x0038('0x2d')](_0x1553b1,function(_0x236b6c){if(_0x236b6c[_0x0038('0x42')]!==_0x0038('0x43')){var _0x5805ff={};_0x5805ff[_0x236b6c[_0x0038('0x2b')]]={'$like':'%'+_0x5f6f4b[_0x0038('0x32')]['filter']+'%'};return _0x5805ff;}})});}_0x32f702=_['merge']({},_0x32f702,_0x5f6f4b[_0x0038('0x44')]);var _0x12d659={'where':_0x32f702[_0x0038('0x3e')]};return db[_0x0038('0x2e')][_0x0038('0x1f')](_0x12d659)[_0x0038('0x27')](function(_0x23dd01){_0x28eac1[_0x0038('0x1f')]=_0x23dd01;if(_0x5f6f4b['query']['includeAll']){_0x32f702['include']=[{'all':!![]}];}return db[_0x0038('0x2e')][_0x0038('0x45')](_0x32f702);})[_0x0038('0x27')](function(_0x225c75){_0x28eac1['rows']=_0x225c75;return _0x28eac1;})['then'](respondWithFilteredResult(_0x59d986,_0x32f702))[_0x0038('0x46')](handleError(_0x59d986,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 842e965..49a7502 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 _0xe09e=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x4a878b,_0x47078d){var _0x13d337=function(_0x32833b){while(--_0x32833b){_0x4a878b['push'](_0x4a878b['shift']());}};_0x13d337(++_0x47078d);}(_0xe09e,0x13e));var _0xee09=function(_0x491ee7,_0x34c385){_0x491ee7=_0x491ee7-0x0;var _0x4374d3=_0xe09e[_0x491ee7];return _0x4374d3;};'use strict';var _=require(_0xee09('0x0'));var util=require('util');var logger=require(_0xee09('0x1'))(_0xee09('0x2'));var moment=require(_0xee09('0x3'));var BPromise=require(_0xee09('0x4'));var rp=require(_0xee09('0x5'));var fs=require('fs');var path=require(_0xee09('0x6'));var rimraf=require(_0xee09('0x7'));var config=require(_0xee09('0x8'));var attributes=require(_0xee09('0x9'));module[_0xee09('0xa')]=function(_0x46d362,_0x2ed5d8){return _0x46d362[_0xee09('0xb')](_0xee09('0xc'),attributes,{'tableName':_0xee09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dd4=['request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','moment'];(function(_0x4f1b16,_0x324ae0){var _0x212558=function(_0x49ca49){while(--_0x49ca49){_0x4f1b16['push'](_0x4f1b16['shift']());}};_0x212558(++_0x324ae0);}(_0x5dd4,0x1ca));var _0x45dd=function(_0x5538a5,_0x3c6937){_0x5538a5=_0x5538a5-0x0;var _0x176b65=_0x5dd4[_0x5538a5];return _0x176b65;};'use strict';var _=require(_0x45dd('0x0'));var util=require(_0x45dd('0x1'));var logger=require(_0x45dd('0x2'))('api');var moment=require(_0x45dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x45dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45dd('0x5'));var config=require(_0x45dd('0x6'));var attributes=require(_0x45dd('0x7'));module[_0x45dd('0x8')]=function(_0x96d662,_0x4e5c98){return _0x96d662[_0x45dd('0x9')]('Migration',attributes,{'tableName':_0x45dd('0xa'),'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 959b986..c12df11 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 _0x983f=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x983f,0xd3));var _0xf983=function(_0x48cc9d,_0x5f2c54){_0x48cc9d=_0x48cc9d-0x0;var _0x477f55=_0x983f[_0x48cc9d];return _0x477f55;};'use strict';var _=require('lodash');var util=require(_0xf983('0x0'));var moment=require(_0xf983('0x1'));var BPromise=require('bluebird');var rs=require(_0xf983('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf983('0x3'))['db'];var utils=require(_0xf983('0x4'));var logger=require(_0xf983('0x5'))(_0xf983('0x6'));var config=require(_0xf983('0x7'));var jayson=require(_0xf983('0x8'));var client=jayson['client'][_0xf983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117fa4,_0x1b4d92,_0x164d82){return new BPromise(function(_0x4ab230,_0x560d0e){return client[_0xf983('0xa')](_0x117fa4,_0x164d82)[_0xf983('0xb')](function(_0x14ef3f){logger[_0xf983('0xc')](_0xf983('0xd'),_0x1b4d92,_0xf983('0xe'));logger['debug'](_0xf983('0xf'),_0x1b4d92,'request\x20sent',JSON[_0xf983('0x10')](_0x14ef3f));if(_0x14ef3f[_0xf983('0x11')]){if(_0x14ef3f['error'][_0xf983('0x12')]===0x1f4){logger[_0xf983('0x11')]('Migration,\x20%s,\x20%s',_0x1b4d92,_0x14ef3f['error'][_0xf983('0x13')]);return _0x560d0e(_0x14ef3f[_0xf983('0x11')][_0xf983('0x13')]);}logger['error'](_0xf983('0xd'),_0x1b4d92,_0x14ef3f[_0xf983('0x11')]['message']);return _0x4ab230(_0x14ef3f[_0xf983('0x11')][_0xf983('0x13')]);}else{logger[_0xf983('0xc')](_0xf983('0xd'),_0x1b4d92,'request\x20sent');_0x4ab230(_0x14ef3f[_0xf983('0x14')][_0xf983('0x13')]);}})[_0xf983('0x15')](function(_0x36a2d0){logger[_0xf983('0x11')](_0xf983('0xd'),_0x1b4d92,_0x36a2d0);_0x560d0e(_0x36a2d0);});});} \ No newline at end of file +var _0x05ed=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2e811c,_0xd53821){var _0xc0c312=function(_0x4ab63c){while(--_0x4ab63c){_0x2e811c['push'](_0x2e811c['shift']());}};_0xc0c312(++_0xd53821);}(_0x05ed,0x14b));var _0xd05e=function(_0x5488cc,_0x57b187){_0x5488cc=_0x5488cc-0x0;var _0xa8962e=_0x05ed[_0x5488cc];return _0xa8962e;};'use strict';var _=require(_0xd05e('0x0'));var util=require('util');var moment=require(_0xd05e('0x1'));var BPromise=require(_0xd05e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd05e('0x3'));var db=require(_0xd05e('0x4'))['db'];var utils=require(_0xd05e('0x5'));var logger=require(_0xd05e('0x6'))(_0xd05e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd05e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32c075,_0x173350,_0x5ee5df){return new BPromise(function(_0x5b6ccc,_0x7bd4b2){return client[_0xd05e('0x9')](_0x32c075,_0x5ee5df)[_0xd05e('0xa')](function(_0x5f056e){logger[_0xd05e('0xb')](_0xd05e('0xc'),_0x173350,'request\x20sent');logger[_0xd05e('0xd')](_0xd05e('0xe'),_0x173350,_0xd05e('0xf'),JSON['stringify'](_0x5f056e));if(_0x5f056e[_0xd05e('0x10')]){if(_0x5f056e[_0xd05e('0x10')][_0xd05e('0x11')]===0x1f4){logger[_0xd05e('0x10')](_0xd05e('0xc'),_0x173350,_0x5f056e[_0xd05e('0x10')]['message']);return _0x7bd4b2(_0x5f056e[_0xd05e('0x10')]['message']);}logger[_0xd05e('0x10')]('Migration,\x20%s,\x20%s',_0x173350,_0x5f056e['error']['message']);return _0x5b6ccc(_0x5f056e[_0xd05e('0x10')][_0xd05e('0x12')]);}else{logger[_0xd05e('0xb')](_0xd05e('0xc'),_0x173350,'request\x20sent');_0x5b6ccc(_0x5f056e[_0xd05e('0x13')][_0xd05e('0x12')]);}})[_0xd05e('0x14')](function(_0x4f0004){logger[_0xd05e('0x10')](_0xd05e('0xc'),_0x173350,_0x4f0004);_0x7bd4b2(_0x4f0004);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 85513b4..8a01eb1 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 _0x4325=['util','connect-timeout','express','Router','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports'];(function(_0x12a815,_0x472253){var _0x5dbdb5=function(_0x53eb88){while(--_0x53eb88){_0x12a815['push'](_0x12a815['shift']());}};_0x5dbdb5(++_0x472253);}(_0x4325,0x159));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x5432('0x0'));var path=require('path');var timeout=require(_0x5432('0x1'));var express=require(_0x5432('0x2'));var router=express[_0x5432('0x3')]();var auth=require(_0x5432('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5432('0x5'));router[_0x5432('0x6')]('/',auth[_0x5432('0x7')](),controller[_0x5432('0x8')]);router[_0x5432('0x6')](_0x5432('0x9'),auth['isAuthenticated'](),controller[_0x5432('0xa')]);router['post']('/',auth[_0x5432('0x7')](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0x9'),auth[_0x5432('0x7')](),controller[_0x5432('0xd')]);router['delete'](_0x5432('0x9'),auth[_0x5432('0x7')](),controller['destroy']);module[_0x5432('0xe')]=router; \ No newline at end of file +var _0x3336=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1aa75c,_0x184345){var _0x55f3d9=function(_0x574232){while(--_0x574232){_0x1aa75c['push'](_0x1aa75c['shift']());}};_0x55f3d9(++_0x184345);}(_0x3336,0x106));var _0x6333=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x3336[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x6333('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6333('0x1'));var express=require(_0x6333('0x2'));var router=express[_0x6333('0x3')]();var auth=require(_0x6333('0x4'));var interaction=require(_0x6333('0x5'));var config=require(_0x6333('0x6'));var controller=require('./network.controller');router[_0x6333('0x7')]('/',auth[_0x6333('0x8')](),controller[_0x6333('0x9')]);router[_0x6333('0x7')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0xb')]);router[_0x6333('0xc')]('/',auth[_0x6333('0x8')](),controller['create']);router[_0x6333('0xd')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0xe')]);router[_0x6333('0xf')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0x10')]);module[_0x6333('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e70a778..bfcc291 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(_0x15ef42,_0x4d62d3){var _0x3184b1=function(_0x8ea0df){while(--_0x8ea0df){_0x15ef42['push'](_0x15ef42['shift']());}};_0x3184b1(++_0x4d62d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0xcfd944,_0xfc8222){var _0x8b6354=function(_0xcf80a2){while(--_0xcf80a2){_0xcfd944['push'](_0xcfd944['shift']());}};_0x8b6354(++_0xfc8222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 fbd1358..e571b95 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 _0xbfeb=['toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','Network','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','create','sequelize','transaction','body','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0xef5f0f,_0x35b798){var _0xd3b8d=function(_0x18abe4){while(--_0x18abe4){_0xef5f0f['push'](_0xef5f0f['shift']());}};_0xd3b8d(++_0x35b798);}(_0xbfeb,0x6c));var _0xbbfe=function(_0x5e18f2,_0x43d1ee){_0x5e18f2=_0x5e18f2-0x0;var _0x14d1ac=_0xbfeb[_0x5e18f2];return _0x14d1ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbfe('0x0'));var rimraf=require(_0xbbfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbfe('0x2'));var moment=require(_0xbbfe('0x3'));var BPromise=require(_0xbbfe('0x4'));var Mustache=require('mustache');var util=require(_0xbbfe('0x5'));var path=require(_0xbbfe('0x6'));var sox=require(_0xbbfe('0x7'));var csv=require(_0xbbfe('0x8'));var ejs=require(_0xbbfe('0x9'));var fs=require('fs');var _=require(_0xbbfe('0xa'));var squel=require('squel');var crypto=require(_0xbbfe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbbfe('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbbfe('0xd'));var Papa=require(_0xbbfe('0xe'));var Redis=require(_0xbbfe('0xf'));var authService=require(_0xbbfe('0x10'));var qs=require(_0xbbfe('0x11'));var as=require(_0xbbfe('0x12'));var hardwareService=require(_0xbbfe('0x13'));var logger=require(_0xbbfe('0x14'))(_0xbbfe('0x15'));var utils=require(_0xbbfe('0x16'));var config=require(_0xbbfe('0x17'));var licenseUtil=require(_0xbbfe('0x18'));var db=require(_0xbbfe('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x570a26,_0x164dfa,_0x5c9c85,_0x5e34bd){return new BPromise(function(_0x4b1c19,_0x298bf5){var _0x443ee1=_0x5e34bd||client;return _0x443ee1[_0xbbfe('0x1a')](_0x570a26,_0x5c9c85)[_0xbbfe('0x1b')](function(_0x7e51cb){logger[_0xbbfe('0x1c')](_0xbbfe('0x1d'),_0x164dfa,_0xbbfe('0x1e'));logger['debug'](_0xbbfe('0x1f'),_0x164dfa,_0xbbfe('0x1e'),JSON[_0xbbfe('0x20')](_0x7e51cb));if(_0x7e51cb[_0xbbfe('0x21')]){if(_0x7e51cb[_0xbbfe('0x21')]['code']===0x1f4){logger[_0xbbfe('0x21')]('Network,\x20%s,\x20%s',_0x164dfa,_0x7e51cb['error'][_0xbbfe('0x22')]);return _0x298bf5(_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);}logger[_0xbbfe('0x21')]('Network,\x20%s,\x20%s',_0x164dfa,_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);return _0x4b1c19(_0x7e51cb[_0xbbfe('0x21')][_0xbbfe('0x22')]);}else{logger[_0xbbfe('0x1c')]('Network,\x20%s,\x20%s',_0x164dfa,_0xbbfe('0x1e'));_0x4b1c19(_0x7e51cb['result']['message']);}})[_0xbbfe('0x23')](function(_0x5dee9e){logger['error'](_0xbbfe('0x1d'),_0x164dfa,_0x5dee9e);_0x298bf5(_0x5dee9e);});});}function respondWithStatusCode(_0x50b7d3,_0x1a9f48){_0x1a9f48=_0x1a9f48||0xcc;return function(_0x11d47f){if(_0x11d47f){return _0x50b7d3['sendStatus'](_0x1a9f48);}return _0x50b7d3['status'](_0x1a9f48)[_0xbbfe('0x24')]();};}function respondWithResult(_0x2887c7,_0x59c76a){_0x59c76a=_0x59c76a||0xc8;return function(_0x1472b1){if(_0x1472b1){return _0x2887c7[_0xbbfe('0x25')](_0x59c76a)[_0xbbfe('0x26')](_0x1472b1);}};}function respondWithFilteredResult(_0x1fb41e,_0x144a94){return function(_0x5460f2){if(_0x5460f2){var _0xed1e03=_0x5460f2['count'],_0x3a6cdd=_0x144a94['offset'],_0xc2dc59=_0x144a94[_0xbbfe('0x27')]+_0x144a94[_0xbbfe('0x28')],_0x427a6a;if(_0xc2dc59>=_0xed1e03){_0xc2dc59=_0xed1e03;_0x427a6a=0xc8;}else{_0x427a6a=0xce;}_0x1fb41e['status'](_0x427a6a);return _0x1fb41e[_0xbbfe('0x29')](_0xbbfe('0x2a'),_0x3a6cdd+'-'+_0xc2dc59+'/'+_0xed1e03)[_0xbbfe('0x26')](_0x5460f2);}return null;};}function patchUpdates(_0x3c074a){return function(_0x29359c){try{jsonpatch['apply'](_0x29359c,_0x3c074a,!![]);}catch(_0x207657){return BPromise[_0xbbfe('0x2b')](_0x207657);}return _0x29359c[_0xbbfe('0x2c')]();};}function saveUpdates(_0x1594ec,_0x1af057){return function(_0x316107){if(_0x316107){return _0x316107[_0xbbfe('0x2d')](_0x1594ec)[_0xbbfe('0x1b')](function(_0x3aa3a4){return _0x3aa3a4;});}return null;};}function removeEntity(_0xff3af3,_0x4f2952){return function(_0x3dfcb8){if(_0x3dfcb8){return _0x3dfcb8[_0xbbfe('0x2e')]()[_0xbbfe('0x1b')](function(){_0xff3af3[_0xbbfe('0x25')](0xcc)[_0xbbfe('0x24')]();});}};}function handleEntityNotFound(_0x25f870,_0x21b98a){return function(_0x2b5667){if(!_0x2b5667){_0x25f870[_0xbbfe('0x2f')](0x194);}return _0x2b5667;};}function handleError(_0x20f2c2,_0x4aea72){_0x4aea72=_0x4aea72||0x1f4;return function(_0x13e830){logger['error'](_0x13e830[_0xbbfe('0x30')]);if(_0x13e830[_0xbbfe('0x31')]){delete _0x13e830[_0xbbfe('0x31')];}_0x20f2c2[_0xbbfe('0x25')](_0x4aea72)[_0xbbfe('0x32')](_0x13e830);};}exports['index']=function(_0x2d966d,_0x1f0759){var _0xdc08eb={},_0x3e8e3b={},_0x154aa6={'count':0x0,'rows':[]};var _0x4070a7=_['map'](db[_0xbbfe('0x33')][_0xbbfe('0x34')],function(_0x1d1bda){return{'name':_0x1d1bda[_0xbbfe('0x35')],'type':_0x1d1bda[_0xbbfe('0x36')]['key']};});_0x3e8e3b[_0xbbfe('0x37')]=_[_0xbbfe('0x38')](_0x4070a7,'name');_0x3e8e3b[_0xbbfe('0x39')]=_['keys'](_0x2d966d[_0xbbfe('0x39')]);_0x3e8e3b[_0xbbfe('0x3a')]=_['intersection'](_0x3e8e3b[_0xbbfe('0x37')],_0x3e8e3b[_0xbbfe('0x39')]);_0xdc08eb[_0xbbfe('0x3b')]=_[_0xbbfe('0x3c')](_0x3e8e3b[_0xbbfe('0x37')],qs[_0xbbfe('0x3d')](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x3d')]));_0xdc08eb[_0xbbfe('0x3b')]=_0xdc08eb[_0xbbfe('0x3b')][_0xbbfe('0x3e')]?_0xdc08eb[_0xbbfe('0x3b')]:_0x3e8e3b[_0xbbfe('0x37')];if(!_0x2d966d['query'][_0xbbfe('0x3f')](_0xbbfe('0x40'))){_0xdc08eb['limit']=qs[_0xbbfe('0x28')](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x28')]);_0xdc08eb[_0xbbfe('0x27')]=qs[_0xbbfe('0x27')](_0x2d966d['query']['offset']);}_0xdc08eb['order']=qs['sort'](_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x41')]);_0xdc08eb[_0xbbfe('0x42')]=qs['filters'](_['pick'](_0x2d966d['query'],_0x3e8e3b[_0xbbfe('0x3a')]),_0x4070a7);if(_0x2d966d[_0xbbfe('0x39')]['filter']){_0xdc08eb['where']=_[_0xbbfe('0x43')](_0xdc08eb[_0xbbfe('0x42')],{'$or':_[_0xbbfe('0x38')](_0x4070a7,function(_0x594d3c){if(_0x594d3c[_0xbbfe('0x36')]!==_0xbbfe('0x44')){var _0x43d5af={};_0x43d5af[_0x594d3c[_0xbbfe('0x31')]]={'$like':'%'+_0x2d966d[_0xbbfe('0x39')][_0xbbfe('0x45')]+'%'};return _0x43d5af;}})});}_0xdc08eb=_['merge']({},_0xdc08eb,_0x2d966d[_0xbbfe('0x46')]);var _0x5b98a9={'where':_0xdc08eb['where']};return db[_0xbbfe('0x33')][_0xbbfe('0x47')](_0x5b98a9)[_0xbbfe('0x1b')](function(_0x1db055){_0x154aa6[_0xbbfe('0x47')]=_0x1db055;if(_0x2d966d['query'][_0xbbfe('0x48')]){_0xdc08eb[_0xbbfe('0x49')]=[{'all':!![]}];}return db[_0xbbfe('0x33')][_0xbbfe('0x4a')](_0xdc08eb);})['then'](function(_0x9bcda2){_0x154aa6[_0xbbfe('0x4b')]=_0x9bcda2;return _0x154aa6;})[_0xbbfe('0x1b')](respondWithFilteredResult(_0x1f0759,_0xdc08eb))[_0xbbfe('0x23')](handleError(_0x1f0759,null));};exports['show']=function(_0x112c7e,_0x5a1043){var _0x139e29={'raw':!![],'where':{'id':_0x112c7e[_0xbbfe('0x4c')]['id']}},_0x15557e={};_0x15557e[_0xbbfe('0x37')]=_['keys'](db['Network']['rawAttributes']);_0x15557e['query']=_['keys'](_0x112c7e[_0xbbfe('0x39')]);_0x15557e['filters']=_[_0xbbfe('0x3c')](_0x15557e['model'],_0x15557e[_0xbbfe('0x39')]);_0x139e29[_0xbbfe('0x3b')]=_[_0xbbfe('0x3c')](_0x15557e[_0xbbfe('0x37')],qs[_0xbbfe('0x3d')](_0x112c7e[_0xbbfe('0x39')][_0xbbfe('0x3d')]));_0x139e29[_0xbbfe('0x3b')]=_0x139e29[_0xbbfe('0x3b')][_0xbbfe('0x3e')]?_0x139e29[_0xbbfe('0x3b')]:_0x15557e[_0xbbfe('0x37')];if(_0x112c7e['query'][_0xbbfe('0x48')]){_0x139e29[_0xbbfe('0x49')]=[{'all':!![]}];}_0x139e29=_[_0xbbfe('0x43')]({},_0x139e29,_0x112c7e['options']);return db[_0xbbfe('0x33')][_0xbbfe('0x4d')](_0x139e29)[_0xbbfe('0x1b')](handleEntityNotFound(_0x5a1043,null))[_0xbbfe('0x1b')](respondWithResult(_0x5a1043,null))['catch'](handleError(_0x5a1043,null));};exports[_0xbbfe('0x4e')]=function(_0x1ac47f,_0x30d957,_0x524af1){var _0x422da3;return db[_0xbbfe('0x4f')][_0xbbfe('0x50')](function(_0x8c440b){return db[_0xbbfe('0x33')][_0xbbfe('0x4e')](_0x1ac47f[_0xbbfe('0x51')],{'raw':!![]})[_0xbbfe('0x1b')](function(_0x178eed){_0x422da3=_0x178eed;return db[_0xbbfe('0x33')][_0xbbfe('0x4a')]({'where':{'type':_0x1ac47f[_0xbbfe('0x51')]['type']},'raw':!![]});})[_0xbbfe('0x1b')](function(_0x91c010){if(_0x422da3[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x39a612=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],'server/files/templates/stun_multiple.ejs'),_0xbbfe('0x56'));var _0x46e374=ejs[_0xbbfe('0x57')](_0x39a612,{'networks':_0x91c010||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x59'),_0x46e374);return respondWithRpcPromise('Reload',_0xbbfe('0x4e'),{'module':_0xbbfe('0x5a')});}else if(_0x422da3['type']['toUpperCase']()=='TURN'){var _0x5e8750=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],'server/files/templates/turn_multiple.ejs'),_0xbbfe('0x56'));var _0x495825=ejs[_0xbbfe('0x57')](_0x5e8750,{'networks':_0x91c010||[]});fs['writeFileSync'](_0xbbfe('0x5b'),_0x495825);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x4e'),{'module':_0xbbfe('0x5a')});}else{var _0x327d6d=fs[_0xbbfe('0x5d')](path['join'](config[_0xbbfe('0x55')],'server/files/templates/network.ejs'),_0xbbfe('0x56'));var _0x36bb12=ejs[_0xbbfe('0x57')](_0x327d6d,{'networks':_0x91c010||[]});fs[_0xbbfe('0x58')](util[_0xbbfe('0x5e')](_0xbbfe('0x5f'),_0x1ac47f[_0xbbfe('0x51')][_0xbbfe('0x36')][_0xbbfe('0x60')]()),_0x36bb12);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x4e'),{'module':_0xbbfe('0x61')});}return null;})[_0xbbfe('0x1b')](function(){return _0x422da3;});})[_0xbbfe('0x1b')](respondWithResult(_0x30d957,0xc9))[_0xbbfe('0x23')](handleError(_0x30d957,null));};exports[_0xbbfe('0x2d')]=function(_0x165e51,_0x2d5177,_0x12faea){var _0x31d254;return db[_0xbbfe('0x4f')]['transaction'](function(_0x5c6454){return db[_0xbbfe('0x33')]['find']({'where':{'id':_0x165e51[_0xbbfe('0x4c')]['id']}})[_0xbbfe('0x1b')](handleEntityNotFound(_0x2d5177,null))['then'](saveUpdates(_0x165e51['body'],null))[_0xbbfe('0x1b')](function(_0x4630e3){if(_0x4630e3){_0x31d254=_0x4630e3;return db[_0xbbfe('0x33')][_0xbbfe('0x4a')]({'where':{'type':_0x31d254['type']},'raw':!![]});}return null;})[_0xbbfe('0x1b')](function(_0x36e7b2){if(_0x31d254[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x1edef1=fs['readFileSync'](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x62')),_0xbbfe('0x56'));var _0x3fcbcf=ejs[_0xbbfe('0x57')](_0x1edef1,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x59'),_0x3fcbcf);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x31d254[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x63')){var _0x1dd21f=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x64')),_0xbbfe('0x56'));var _0x452ff1=ejs[_0xbbfe('0x57')](_0x1dd21f,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](_0xbbfe('0x5b'),_0x452ff1);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x3c3447=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x65')),_0xbbfe('0x56'));var _0x4e2fa5=ejs[_0xbbfe('0x57')](_0x3c3447,{'networks':_0x36e7b2||[]});fs[_0xbbfe('0x58')](util['format'](_0xbbfe('0x5f'),_0x165e51['body'][_0xbbfe('0x36')]['toLowerCase']()),_0x4e2fa5);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2d'),{'module':'chan_sip.so'});}return null;})[_0xbbfe('0x1b')](function(_0x6efcf){if(_0x6efcf){return _0x31d254;}return null;});})[_0xbbfe('0x1b')](respondWithResult(_0x2d5177,null))[_0xbbfe('0x23')](handleError(_0x2d5177,null));};exports[_0xbbfe('0x2e')]=function(_0x239628,_0x256a0c,_0x1f7b15){var _0x347be7;return db[_0xbbfe('0x33')]['find']({'where':{'id':_0x239628['params']['id']}})[_0xbbfe('0x1b')](function(_0x53e2ba){_0x347be7=_0x53e2ba;return _0x53e2ba;})[_0xbbfe('0x1b')](handleEntityNotFound(_0x256a0c,null))['then'](removeEntity(_0x256a0c,null))[_0xbbfe('0x1b')](function(){if(_0x347be7){return db[_0xbbfe('0x33')]['findAll']({'where':{'type':_0x347be7[_0xbbfe('0x36')]},'raw':!![]});}})['then'](function(_0x360d10){if(_0x347be7[_0xbbfe('0x36')][_0xbbfe('0x52')]()==_0xbbfe('0x53')){var _0x52876b=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x62')),'utf8');var _0x49e9bb=ejs[_0xbbfe('0x57')](_0x52876b,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')]('/etc/asterisk/stun_xcally.conf',_0x49e9bb);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2e'),{'module':_0xbbfe('0x5a')});}else if(_0x347be7['type'][_0xbbfe('0x52')]()==_0xbbfe('0x63')){var _0x1477d3=fs[_0xbbfe('0x5d')](path[_0xbbfe('0x54')](config[_0xbbfe('0x55')],_0xbbfe('0x64')),_0xbbfe('0x56'));var _0x30a1b0=ejs[_0xbbfe('0x57')](_0x1477d3,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')]('/etc/asterisk/turn_xcally.conf',_0x30a1b0);return respondWithRpcPromise(_0xbbfe('0x5c'),'destroy',{'module':_0xbbfe('0x5a')});}else{var _0x542a04=fs['readFileSync'](path[_0xbbfe('0x54')](config['root'],_0xbbfe('0x65')),_0xbbfe('0x56'));var _0xe8766d=ejs[_0xbbfe('0x57')](_0x542a04,{'networks':_0x360d10||[]});fs[_0xbbfe('0x58')](util['format'](_0xbbfe('0x5f'),_0x239628[_0xbbfe('0x51')]['type'][_0xbbfe('0x60')]()),_0xe8766d);return respondWithRpcPromise(_0xbbfe('0x5c'),_0xbbfe('0x2e'),{'module':_0xbbfe('0x61')});}return null;})['catch'](handleError(_0x256a0c,null));}; \ No newline at end of file +var _0x34b6=['server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','STUN','server/files/templates/turn_multiple.ejs','destroy','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','sequelize','transaction','body','toUpperCase','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','create','res_stun_monitor.so','TURN','join','writeFileSync','/etc/asterisk/turn_xcally.conf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b6,0xda));var _0x634b=function(_0x74fe1a,_0xc8b539){_0x74fe1a=_0x74fe1a-0x0;var _0x20c71f=_0x34b6[_0x74fe1a];return _0x20c71f;};'use strict';var pdf=require(_0x634b('0x0'));var emlformat=require(_0x634b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x634b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x634b('0x3'));var moment=require(_0x634b('0x4'));var BPromise=require(_0x634b('0x5'));var Mustache=require('mustache');var util=require(_0x634b('0x6'));var path=require(_0x634b('0x7'));var sox=require(_0x634b('0x8'));var csv=require('to-csv');var ejs=require(_0x634b('0x9'));var fs=require('fs');var _=require(_0x634b('0xa'));var squel=require(_0x634b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x634b('0xc'));var toCsv=require(_0x634b('0xd'));var querystring=require(_0x634b('0xe'));var Papa=require(_0x634b('0xf'));var Redis=require(_0x634b('0x10'));var authService=require(_0x634b('0x11'));var qs=require(_0x634b('0x12'));var as=require(_0x634b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x634b('0x14'))(_0x634b('0x15'));var utils=require('../../config/utils');var config=require(_0x634b('0x16'));var licenseUtil=require(_0x634b('0x17'));var db=require(_0x634b('0x18'))['db'];var jayson=require(_0x634b('0x19'));var client=jayson[_0x634b('0x1a')][_0x634b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x309224,_0x3bf367,_0x5096c2,_0x5be1e4){return new BPromise(function(_0x273398,_0x4990d0){var _0x582df8=_0x5be1e4||client;return _0x582df8[_0x634b('0x1c')](_0x309224,_0x5096c2)[_0x634b('0x1d')](function(_0x2cc761){logger['info'](_0x634b('0x1e'),_0x3bf367,_0x634b('0x1f'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x3bf367,'request\x20sent',JSON['stringify'](_0x2cc761));if(_0x2cc761[_0x634b('0x20')]){if(_0x2cc761[_0x634b('0x20')][_0x634b('0x21')]===0x1f4){logger[_0x634b('0x20')](_0x634b('0x1e'),_0x3bf367,_0x2cc761['error']['message']);return _0x4990d0(_0x2cc761[_0x634b('0x20')][_0x634b('0x22')]);}logger['error'](_0x634b('0x1e'),_0x3bf367,_0x2cc761[_0x634b('0x20')][_0x634b('0x22')]);return _0x273398(_0x2cc761['error'][_0x634b('0x22')]);}else{logger[_0x634b('0x23')](_0x634b('0x1e'),_0x3bf367,_0x634b('0x1f'));_0x273398(_0x2cc761['result'][_0x634b('0x22')]);}})['catch'](function(_0x5d570a){logger[_0x634b('0x20')](_0x634b('0x1e'),_0x3bf367,_0x5d570a);_0x4990d0(_0x5d570a);});});}function respondWithStatusCode(_0xc63666,_0xcdf7e9){_0xcdf7e9=_0xcdf7e9||0xcc;return function(_0x24d8fb){if(_0x24d8fb){return _0xc63666[_0x634b('0x24')](_0xcdf7e9);}return _0xc63666[_0x634b('0x25')](_0xcdf7e9)[_0x634b('0x26')]();};}function respondWithResult(_0xcef5dc,_0x348e34){_0x348e34=_0x348e34||0xc8;return function(_0xd36aef){if(_0xd36aef){return _0xcef5dc[_0x634b('0x25')](_0x348e34)[_0x634b('0x27')](_0xd36aef);}};}function respondWithFilteredResult(_0x57e531,_0x170413){return function(_0x4cf49d){if(_0x4cf49d){var _0x40976e=_0x4cf49d[_0x634b('0x28')],_0x151411=_0x170413[_0x634b('0x29')],_0x240ac1=_0x170413[_0x634b('0x29')]+_0x170413[_0x634b('0x2a')],_0x25356d;if(_0x240ac1>=_0x40976e){_0x240ac1=_0x40976e;_0x25356d=0xc8;}else{_0x25356d=0xce;}_0x57e531[_0x634b('0x25')](_0x25356d);return _0x57e531[_0x634b('0x2b')](_0x634b('0x2c'),_0x151411+'-'+_0x240ac1+'/'+_0x40976e)[_0x634b('0x27')](_0x4cf49d);}return null;};}function patchUpdates(_0xf13cf1){return function(_0x4503a6){try{jsonpatch['apply'](_0x4503a6,_0xf13cf1,!![]);}catch(_0x2a348a){return BPromise[_0x634b('0x2d')](_0x2a348a);}return _0x4503a6[_0x634b('0x2e')]();};}function saveUpdates(_0x49bcdf,_0x302b12){return function(_0x1d838c){if(_0x1d838c){return _0x1d838c[_0x634b('0x2f')](_0x49bcdf)[_0x634b('0x1d')](function(_0x23ae4c){return _0x23ae4c;});}return null;};}function removeEntity(_0x39dfa9,_0x3009e4){return function(_0x2b255a){if(_0x2b255a){return _0x2b255a['destroy']()[_0x634b('0x1d')](function(){_0x39dfa9[_0x634b('0x25')](0xcc)[_0x634b('0x26')]();});}};}function handleEntityNotFound(_0x2b6a80,_0x1ce131){return function(_0x5081e6){if(!_0x5081e6){_0x2b6a80[_0x634b('0x24')](0x194);}return _0x5081e6;};}function handleError(_0x2826cd,_0x306d33){_0x306d33=_0x306d33||0x1f4;return function(_0x576fff){logger[_0x634b('0x20')](_0x576fff[_0x634b('0x30')]);if(_0x576fff['name']){delete _0x576fff[_0x634b('0x31')];}_0x2826cd[_0x634b('0x25')](_0x306d33)[_0x634b('0x32')](_0x576fff);};}exports['index']=function(_0x57aa3b,_0x3719f9){var _0x51bc22={},_0x54f7f1={},_0x254af1={'count':0x0,'rows':[]};var _0x5983ce=_[_0x634b('0x33')](db[_0x634b('0x34')][_0x634b('0x35')],function(_0x3dc83a){return{'name':_0x3dc83a[_0x634b('0x36')],'type':_0x3dc83a[_0x634b('0x37')][_0x634b('0x38')]};});_0x54f7f1[_0x634b('0x39')]=_['map'](_0x5983ce,'name');_0x54f7f1['query']=_[_0x634b('0x3a')](_0x57aa3b[_0x634b('0x3b')]);_0x54f7f1['filters']=_[_0x634b('0x3c')](_0x54f7f1[_0x634b('0x39')],_0x54f7f1[_0x634b('0x3b')]);_0x51bc22[_0x634b('0x3d')]=_[_0x634b('0x3c')](_0x54f7f1[_0x634b('0x39')],qs[_0x634b('0x3e')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x3e')]));_0x51bc22[_0x634b('0x3d')]=_0x51bc22[_0x634b('0x3d')]['length']?_0x51bc22[_0x634b('0x3d')]:_0x54f7f1[_0x634b('0x39')];if(!_0x57aa3b[_0x634b('0x3b')][_0x634b('0x3f')]('nolimit')){_0x51bc22[_0x634b('0x2a')]=qs[_0x634b('0x2a')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x2a')]);_0x51bc22[_0x634b('0x29')]=qs[_0x634b('0x29')](_0x57aa3b[_0x634b('0x3b')]['offset']);}_0x51bc22['order']=qs[_0x634b('0x40')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x40')]);_0x51bc22[_0x634b('0x41')]=qs[_0x634b('0x42')](_[_0x634b('0x43')](_0x57aa3b[_0x634b('0x3b')],_0x54f7f1[_0x634b('0x42')]),_0x5983ce);if(_0x57aa3b[_0x634b('0x3b')][_0x634b('0x44')]){_0x51bc22[_0x634b('0x41')]=_[_0x634b('0x45')](_0x51bc22[_0x634b('0x41')],{'$or':_['map'](_0x5983ce,function(_0x47f34d){if(_0x47f34d['type']!=='VIRTUAL'){var _0x6ce954={};_0x6ce954[_0x47f34d['name']]={'$like':'%'+_0x57aa3b[_0x634b('0x3b')][_0x634b('0x44')]+'%'};return _0x6ce954;}})});}_0x51bc22=_[_0x634b('0x45')]({},_0x51bc22,_0x57aa3b[_0x634b('0x46')]);var _0x22a67b={'where':_0x51bc22[_0x634b('0x41')]};return db[_0x634b('0x34')]['count'](_0x22a67b)[_0x634b('0x1d')](function(_0xbd7092){_0x254af1[_0x634b('0x28')]=_0xbd7092;if(_0x57aa3b[_0x634b('0x3b')][_0x634b('0x47')]){_0x51bc22[_0x634b('0x48')]=[{'all':!![]}];}return db[_0x634b('0x34')][_0x634b('0x49')](_0x51bc22);})['then'](function(_0x179bed){_0x254af1[_0x634b('0x4a')]=_0x179bed;return _0x254af1;})[_0x634b('0x1d')](respondWithFilteredResult(_0x3719f9,_0x51bc22))[_0x634b('0x4b')](handleError(_0x3719f9,null));};exports[_0x634b('0x4c')]=function(_0x4d7be4,_0x31b968){var _0x34b08f={'raw':!![],'where':{'id':_0x4d7be4[_0x634b('0x4d')]['id']}},_0x204dd1={};_0x204dd1[_0x634b('0x39')]=_['keys'](db[_0x634b('0x34')][_0x634b('0x35')]);_0x204dd1[_0x634b('0x3b')]=_[_0x634b('0x3a')](_0x4d7be4[_0x634b('0x3b')]);_0x204dd1[_0x634b('0x42')]=_[_0x634b('0x3c')](_0x204dd1[_0x634b('0x39')],_0x204dd1[_0x634b('0x3b')]);_0x34b08f[_0x634b('0x3d')]=_[_0x634b('0x3c')](_0x204dd1[_0x634b('0x39')],qs[_0x634b('0x3e')](_0x4d7be4['query'][_0x634b('0x3e')]));_0x34b08f[_0x634b('0x3d')]=_0x34b08f[_0x634b('0x3d')]['length']?_0x34b08f[_0x634b('0x3d')]:_0x204dd1['model'];if(_0x4d7be4[_0x634b('0x3b')]['includeAll']){_0x34b08f[_0x634b('0x48')]=[{'all':!![]}];}_0x34b08f=_['merge']({},_0x34b08f,_0x4d7be4['options']);return db[_0x634b('0x34')]['find'](_0x34b08f)[_0x634b('0x1d')](handleEntityNotFound(_0x31b968,null))[_0x634b('0x1d')](respondWithResult(_0x31b968,null))[_0x634b('0x4b')](handleError(_0x31b968,null));};exports['create']=function(_0xcd2020,_0x1b0cb3,_0x127735){var _0x4b7a10;return db[_0x634b('0x4e')][_0x634b('0x4f')](function(_0x1b39e1){return db['Network']['create'](_0xcd2020[_0x634b('0x50')],{'raw':!![]})[_0x634b('0x1d')](function(_0x586b58){_0x4b7a10=_0x586b58;return db[_0x634b('0x34')][_0x634b('0x49')]({'where':{'type':_0xcd2020['body'][_0x634b('0x37')]},'raw':!![]});})[_0x634b('0x1d')](function(_0x47fed6){if(_0x4b7a10[_0x634b('0x37')][_0x634b('0x51')]()=='STUN'){var _0xf661dc=fs[_0x634b('0x52')](path['join'](config[_0x634b('0x53')],_0x634b('0x54')),_0x634b('0x55'));var _0x2d7b0f=ejs[_0x634b('0x56')](_0xf661dc,{'networks':_0x47fed6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2d7b0f);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':_0x634b('0x59')});}else if(_0x4b7a10[_0x634b('0x37')][_0x634b('0x51')]()==_0x634b('0x5a')){var _0x500ce6=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x634b('0x55'));var _0xbc6005=ejs['render'](_0x500ce6,{'networks':_0x47fed6||[]});fs[_0x634b('0x5c')](_0x634b('0x5d'),_0xbc6005);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':'res_stun_monitor.so'});}else{var _0x5081f9=fs['readFileSync'](path[_0x634b('0x5b')](config['root'],_0x634b('0x5e')),'utf8');var _0x50a606=ejs[_0x634b('0x56')](_0x5081f9,{'networks':_0x47fed6||[]});fs[_0x634b('0x5c')](util[_0x634b('0x5f')](_0x634b('0x60'),_0xcd2020[_0x634b('0x50')][_0x634b('0x37')][_0x634b('0x61')]()),_0x50a606);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':_0x634b('0x62')});}return null;})[_0x634b('0x1d')](function(){return _0x4b7a10;});})[_0x634b('0x1d')](respondWithResult(_0x1b0cb3,0xc9))[_0x634b('0x4b')](handleError(_0x1b0cb3,null));};exports[_0x634b('0x2f')]=function(_0x47c598,_0x757dff,_0x18d26f){var _0x55e436;return db[_0x634b('0x4e')][_0x634b('0x4f')](function(_0x2cc33c){return db[_0x634b('0x34')][_0x634b('0x63')]({'where':{'id':_0x47c598[_0x634b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x757dff,null))[_0x634b('0x1d')](saveUpdates(_0x47c598['body'],null))['then'](function(_0x16d1d9){if(_0x16d1d9){_0x55e436=_0x16d1d9;return db['Network'][_0x634b('0x49')]({'where':{'type':_0x55e436['type']},'raw':!![]});}return null;})[_0x634b('0x1d')](function(_0x5d2b79){if(_0x55e436['type'][_0x634b('0x51')]()==_0x634b('0x64')){var _0x3a6b8b=fs['readFileSync'](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x54')),_0x634b('0x55'));var _0x232dda=ejs[_0x634b('0x56')](_0x3a6b8b,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x232dda);return respondWithRpcPromise(_0x634b('0x57'),'update',{'module':'res_stun_monitor.so'});}else if(_0x55e436[_0x634b('0x37')][_0x634b('0x51')]()==_0x634b('0x5a')){var _0xaef17f=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x65')),_0x634b('0x55'));var _0x262b17=ejs['render'](_0xaef17f,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')](_0x634b('0x5d'),_0x262b17);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x2f'),{'module':_0x634b('0x59')});}else{var _0x423fb1=fs['readFileSync'](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x5e')),_0x634b('0x55'));var _0x2c09c7=ejs[_0x634b('0x56')](_0x423fb1,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')](util[_0x634b('0x5f')](_0x634b('0x60'),_0x47c598[_0x634b('0x50')][_0x634b('0x37')]['toLowerCase']()),_0x2c09c7);return respondWithRpcPromise(_0x634b('0x57'),'update',{'module':_0x634b('0x62')});}return null;})[_0x634b('0x1d')](function(_0x137c1a){if(_0x137c1a){return _0x55e436;}return null;});})[_0x634b('0x1d')](respondWithResult(_0x757dff,null))[_0x634b('0x4b')](handleError(_0x757dff,null));};exports[_0x634b('0x66')]=function(_0x18830c,_0x2e9ecd,_0x3817df){var _0x19cd1f;return db[_0x634b('0x34')]['find']({'where':{'id':_0x18830c[_0x634b('0x4d')]['id']}})[_0x634b('0x1d')](function(_0x576d93){_0x19cd1f=_0x576d93;return _0x576d93;})[_0x634b('0x1d')](handleEntityNotFound(_0x2e9ecd,null))[_0x634b('0x1d')](removeEntity(_0x2e9ecd,null))[_0x634b('0x1d')](function(){if(_0x19cd1f){return db[_0x634b('0x34')][_0x634b('0x49')]({'where':{'type':_0x19cd1f[_0x634b('0x37')]},'raw':!![]});}})[_0x634b('0x1d')](function(_0x290eca){if(_0x19cd1f['type'][_0x634b('0x51')]()==_0x634b('0x64')){var _0x1de040=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x54')),'utf8');var _0x346d11=ejs[_0x634b('0x56')](_0x1de040,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')](_0x634b('0x67'),_0x346d11);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x59')});}else if(_0x19cd1f['type']['toUpperCase']()==_0x634b('0x5a')){var _0x436005=fs[_0x634b('0x52')](path['join'](config[_0x634b('0x53')],'server/files/templates/turn_multiple.ejs'),_0x634b('0x55'));var _0x21d418=ejs[_0x634b('0x56')](_0x436005,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x21d418);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x59')});}else{var _0x3260be=fs[_0x634b('0x52')](path['join'](config['root'],_0x634b('0x5e')),_0x634b('0x55'));var _0x5a2c44=ejs['render'](_0x3260be,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x18830c[_0x634b('0x50')]['type'][_0x634b('0x61')]()),_0x5a2c44);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x62')});}return null;})['catch'](handleError(_0x2e9ecd,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 84c5756..70ac3ea 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 _0x769d=['rimraf','../../config/environment','exports','define','Network','lodash','../../config/logger','moment','request-promise','path'];(function(_0x1e0486,_0x129fcc){var _0x1363b9=function(_0x4e2857){while(--_0x4e2857){_0x1e0486['push'](_0x1e0486['shift']());}};_0x1363b9(++_0x129fcc);}(_0x769d,0x1e5));var _0xd769=function(_0x3cc09f,_0x1b8c98){_0x3cc09f=_0x3cc09f-0x0;var _0xc4c46f=_0x769d[_0x3cc09f];return _0xc4c46f;};'use strict';var _=require(_0xd769('0x0'));var util=require('util');var logger=require(_0xd769('0x1'))('api');var moment=require(_0xd769('0x2'));var BPromise=require('bluebird');var rp=require(_0xd769('0x3'));var fs=require('fs');var path=require(_0xd769('0x4'));var rimraf=require(_0xd769('0x5'));var config=require(_0xd769('0x6'));var attributes=require('./network.attributes');module[_0xd769('0x7')]=function(_0x2dc519,_0x1a8737){return _0x2dc519[_0xd769('0x8')](_0xd769('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc234=['define','Network','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','./network.attributes'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xc234,0x18f));var _0x4c23=function(_0x417b62,_0x2fd510){_0x417b62=_0x417b62-0x0;var _0x8d5a54=_0xc234[_0x417b62];return _0x8d5a54;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var logger=require(_0x4c23('0x2'))(_0x4c23('0x3'));var moment=require('moment');var BPromise=require(_0x4c23('0x4'));var rp=require(_0x4c23('0x5'));var fs=require('fs');var path=require(_0x4c23('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c23('0x7'));module['exports']=function(_0x3d81cd,_0x1cac0e){return _0x3d81cd[_0x4c23('0x8')](_0x4c23('0x9'),attributes,{'tableName':_0x4c23('0xa'),'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 40bd9e9..85a2900 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 _0x131c=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x131c,0xe5));var _0xc131=function(_0x10b518,_0x48181b){_0x10b518=_0x10b518-0x0;var _0x5cb26a=_0x131c[_0x10b518];return _0x5cb26a;};'use strict';var _=require(_0xc131('0x0'));var util=require(_0xc131('0x1'));var moment=require(_0xc131('0x2'));var BPromise=require('bluebird');var rs=require(_0xc131('0x3'));var fs=require('fs');var Redis=require(_0xc131('0x4'));var db=require(_0xc131('0x5'))['db'];var utils=require(_0xc131('0x6'));var logger=require(_0xc131('0x7'))(_0xc131('0x8'));var config=require(_0xc131('0x9'));var jayson=require(_0xc131('0xa'));var client=jayson['client'][_0xc131('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3388af,_0x4508fd,_0x25b9fe){return new BPromise(function(_0x515810,_0x29a387){return client['request'](_0x3388af,_0x25b9fe)['then'](function(_0x8bd4fe){logger[_0xc131('0xc')](_0xc131('0xd'),_0x4508fd,_0xc131('0xe'));logger[_0xc131('0xf')](_0xc131('0x10'),_0x4508fd,_0xc131('0xe'),JSON[_0xc131('0x11')](_0x8bd4fe));if(_0x8bd4fe[_0xc131('0x12')]){if(_0x8bd4fe[_0xc131('0x12')][_0xc131('0x13')]===0x1f4){logger[_0xc131('0x12')](_0xc131('0xd'),_0x4508fd,_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);return _0x29a387(_0x8bd4fe['error'][_0xc131('0x14')]);}logger[_0xc131('0x12')]('Network,\x20%s,\x20%s',_0x4508fd,_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);return _0x515810(_0x8bd4fe[_0xc131('0x12')][_0xc131('0x14')]);}else{logger[_0xc131('0xc')]('Network,\x20%s,\x20%s',_0x4508fd,'request\x20sent');_0x515810(_0x8bd4fe[_0xc131('0x15')][_0xc131('0x14')]);}})['catch'](function(_0x230a9b){logger[_0xc131('0x12')]('Network,\x20%s,\x20%s',_0x4508fd,_0x230a9b);_0x29a387(_0x230a9b);});});} \ No newline at end of file +var _0xcce1=['info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xcce1,0xfb));var _0x1cce=function(_0x110bb7,_0x56c479){_0x110bb7=_0x110bb7-0x0;var _0x1e6ac2=_0xcce1[_0x110bb7];return _0x1e6ac2;};'use strict';var _=require(_0x1cce('0x0'));var util=require(_0x1cce('0x1'));var moment=require(_0x1cce('0x2'));var BPromise=require(_0x1cce('0x3'));var rs=require(_0x1cce('0x4'));var fs=require('fs');var Redis=require(_0x1cce('0x5'));var db=require(_0x1cce('0x6'))['db'];var utils=require(_0x1cce('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1cce('0x8'));var jayson=require(_0x1cce('0x9'));var client=jayson[_0x1cce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc2a4ea,_0x3f8c86,_0x4aee6c){return new BPromise(function(_0x166676,_0xf9be8f){return client[_0x1cce('0xb')](_0xc2a4ea,_0x4aee6c)[_0x1cce('0xc')](function(_0x5bbab7){logger[_0x1cce('0xd')](_0x1cce('0xe'),_0x3f8c86,_0x1cce('0xf'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x3f8c86,_0x1cce('0xf'),JSON[_0x1cce('0x10')](_0x5bbab7));if(_0x5bbab7[_0x1cce('0x11')]){if(_0x5bbab7['error'][_0x1cce('0x12')]===0x1f4){logger[_0x1cce('0x11')](_0x1cce('0xe'),_0x3f8c86,_0x5bbab7[_0x1cce('0x11')]['message']);return _0xf9be8f(_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);}logger[_0x1cce('0x11')](_0x1cce('0xe'),_0x3f8c86,_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);return _0x166676(_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);}else{logger['info'](_0x1cce('0xe'),_0x3f8c86,_0x1cce('0xf'));_0x166676(_0x5bbab7[_0x1cce('0x14')][_0x1cce('0x13')]);}})[_0x1cce('0x15')](function(_0x31f805){logger['error'](_0x1cce('0xe'),_0x3f8c86,_0x31f805);_0xf9be8f(_0x31f805);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 6965fcd..19592eb 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 _0xd5f5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','exports','util','connect-timeout','express'];(function(_0xe34243,_0x2744e5){var _0x3db09d=function(_0xeef42b){while(--_0xeef42b){_0xe34243['push'](_0xe34243['shift']());}};_0x3db09d(++_0x2744e5);}(_0xd5f5,0xe4));var _0x5d5f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd5f5[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require(_0x5d5f('0x0'));var path=require('path');var timeout=require(_0x5d5f('0x1'));var express=require(_0x5d5f('0x2'));var router=express[_0x5d5f('0x3')]();var auth=require(_0x5d5f('0x4'));var interaction=require(_0x5d5f('0x5'));var config=require(_0x5d5f('0x6'));var controller=require('./notification.controller');router[_0x5d5f('0x7')]('/',auth[_0x5d5f('0x8')](),controller[_0x5d5f('0x9')]);module[_0x5d5f('0xa')]=router; \ No newline at end of file +var _0x2f2d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','path'];(function(_0x14e001,_0x569bf){var _0x2c09da=function(_0x2efab1){while(--_0x2efab1){_0x14e001['push'](_0x14e001['shift']());}};_0x2c09da(++_0x569bf);}(_0x2f2d,0x176));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var path=require(_0xd2f2('0x2'));var timeout=require(_0xd2f2('0x3'));var express=require(_0xd2f2('0x4'));var router=express[_0xd2f2('0x5')]();var auth=require(_0xd2f2('0x6'));var interaction=require(_0xd2f2('0x7'));var config=require(_0xd2f2('0x8'));var controller=require(_0xd2f2('0x9'));router['post']('/',auth[_0xd2f2('0xa')](),controller[_0xd2f2('0xb')]);module[_0xd2f2('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index b3d04e0..4a472e8 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 _0x84a2=['sequelize','TEXT','STRING'];(function(_0x2cced8,_0x41bcf0){var _0x2faa3c=function(_0x31f2d6){while(--_0x31f2d6){_0x2cced8['push'](_0x2cced8['shift']());}};_0x2faa3c(++_0x41bcf0);}(_0x84a2,0x13b));var _0x284a=function(_0x3b6d96,_0x5d3241){_0x3b6d96=_0x3b6d96-0x0;var _0x1e6b1c=_0x84a2[_0x3b6d96];return _0x1e6b1c;};'use strict';var Sequelize=require(_0x284a('0x0'));module['exports']={'body':{'type':Sequelize[_0x284a('0x1')]},'senderName':{'type':Sequelize[_0x284a('0x2')]},'recipientsId':{'type':Sequelize[_0x284a('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x81a3=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x81a3,0x149));var _0x381a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x81a3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x381a('0x0'));module[_0x381a('0x1')]={'body':{'type':Sequelize[_0x381a('0x2')]},'senderName':{'type':Sequelize[_0x381a('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x381a('0x3')]},'beep':{'type':Sequelize[_0x381a('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index d72a6bb..b427b17 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 _0x8a2d=['redis','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','Notification','create','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','replace','queue','Queue','ids','push','all','flatten','map','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults'];(function(_0x5ccab3,_0x5c7df5){var _0x8a5eb3=function(_0x13156f){while(--_0x13156f){_0x5ccab3['push'](_0x5ccab3['shift']());}};_0x8a5eb3(++_0x5c7df5);}(_0x8a2d,0x17f));var _0xd8a2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8a2d[_0x42245d];return _0x4b211a;};'use strict';var pdf=require(_0xd8a2('0x0'));var emlformat=require(_0xd8a2('0x1'));var rimraf=require(_0xd8a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8a2('0x3'));var moment=require(_0xd8a2('0x4'));var BPromise=require(_0xd8a2('0x5'));var Mustache=require(_0xd8a2('0x6'));var util=require(_0xd8a2('0x7'));var path=require(_0xd8a2('0x8'));var sox=require(_0xd8a2('0x9'));var csv=require(_0xd8a2('0xa'));var ejs=require(_0xd8a2('0xb'));var fs=require('fs');var _=require(_0xd8a2('0xc'));var squel=require(_0xd8a2('0xd'));var crypto=require(_0xd8a2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd8a2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8a2('0x10'));var Redis=require(_0xd8a2('0x11'));var authService=require(_0xd8a2('0x12'));var qs=require(_0xd8a2('0x13'));var as=require(_0xd8a2('0x14'));var hardwareService=require(_0xd8a2('0x15'));var logger=require(_0xd8a2('0x16'))(_0xd8a2('0x17'));var utils=require(_0xd8a2('0x18'));var config=require(_0xd8a2('0x19'));var licenseUtil=require(_0xd8a2('0x1a'));var db=require(_0xd8a2('0x1b'))['db'];config['redis']=_[_0xd8a2('0x1c')](config[_0xd8a2('0x1d')],{'host':_0xd8a2('0x1e'),'port':0x18eb});var socket=require(_0xd8a2('0x1f'))(new Redis(config[_0xd8a2('0x1d')]));require(_0xd8a2('0x20'))[_0xd8a2('0x21')](socket);function respondWithStatusCode(_0x540a1d,_0x250760){_0x250760=_0x250760||0xcc;return function(_0x17f21d){if(_0x17f21d){return _0x540a1d[_0xd8a2('0x22')](_0x250760);}return _0x540a1d[_0xd8a2('0x23')](_0x250760)[_0xd8a2('0x24')]();};}function respondWithResult(_0x4b0874,_0x457e0b){_0x457e0b=_0x457e0b||0xc8;return function(_0x3b58fc){if(_0x3b58fc){return _0x4b0874[_0xd8a2('0x23')](_0x457e0b)['json'](_0x3b58fc);}};}function respondWithFilteredResult(_0x3358b3,_0x57ae2d){return function(_0x30a618){if(_0x30a618){var _0x6cc202=_0x30a618[_0xd8a2('0x25')],_0x37c2db=_0x57ae2d[_0xd8a2('0x26')],_0x506572=_0x57ae2d['offset']+_0x57ae2d[_0xd8a2('0x27')],_0x5a9431;if(_0x506572>=_0x6cc202){_0x506572=_0x6cc202;_0x5a9431=0xc8;}else{_0x5a9431=0xce;}_0x3358b3[_0xd8a2('0x23')](_0x5a9431);return _0x3358b3[_0xd8a2('0x28')](_0xd8a2('0x29'),_0x37c2db+'-'+_0x506572+'/'+_0x6cc202)[_0xd8a2('0x2a')](_0x30a618);}return null;};}function patchUpdates(_0x3e3ae1){return function(_0x2297d){try{jsonpatch[_0xd8a2('0x2b')](_0x2297d,_0x3e3ae1,!![]);}catch(_0x193043){return BPromise[_0xd8a2('0x2c')](_0x193043);}return _0x2297d['save']();};}function saveUpdates(_0xc7d781,_0x3fc4b5){return function(_0x58e192){if(_0x58e192){return _0x58e192[_0xd8a2('0x2d')](_0xc7d781)[_0xd8a2('0x2e')](function(_0x4fc301){return _0x4fc301;});}return null;};}function removeEntity(_0x596715,_0x44de70){return function(_0x14caa9){if(_0x14caa9){return _0x14caa9[_0xd8a2('0x2f')]()[_0xd8a2('0x2e')](function(){_0x596715[_0xd8a2('0x23')](0xcc)[_0xd8a2('0x24')]();});}};}function handleEntityNotFound(_0x415505,_0x75536d){return function(_0x1d6d2f){if(!_0x1d6d2f){_0x415505['sendStatus'](0x194);}return _0x1d6d2f;};}function handleError(_0x1d1d85,_0x4d1da1){_0x4d1da1=_0x4d1da1||0x1f4;return function(_0x36dc24){logger['error'](_0x36dc24[_0xd8a2('0x30')]);if(_0x36dc24[_0xd8a2('0x31')]){delete _0x36dc24['name'];}_0x1d1d85['status'](_0x4d1da1)['send'](_0x36dc24);};}exports[_0xd8a2('0x32')]=function(_0x44fb4f,_0x2dfae5,_0x44a35b){if(!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x35'))&&!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x36'))){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x39'));}else{if(_0x44fb4f[_0xd8a2('0x33')]['hasOwnProperty']('TemplateId')&&!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')]('view')){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3a'));}if(!_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x34')](_0xd8a2('0x3b'))){throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3c'));}else{try{var _0xc4c991=JSON[_0xd8a2('0x3d')](_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x3b')]);}catch(_0x21ba60){logger['error'](_0x21ba60);throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x3e'));}var _0x20624e=[_0xd8a2('0x3f'),_0xd8a2('0x40'),_0xd8a2('0x41'),_0xd8a2('0x42'),'smsqueue','voicequeue','whatsappqueue',_0xd8a2('0x43'),'user'];if(_[_0xd8a2('0x44')](_0xc4c991,function(_0x3d3a43){return!_[_0xd8a2('0x45')](_0x20624e,_0x3d3a43[_0xd8a2('0x46')]['toLowerCase']());})){throw new db['Sequelize'][(_0xd8a2('0x38'))](_0xd8a2('0x47'));}}}var _0x25f78f={};_0x25f78f[_0xd8a2('0x48')]=_0x44fb4f[_0xd8a2('0x33')]['hasOwnProperty'](_0xd8a2('0x48'))?_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x48')]:_0x44fb4f[_0xd8a2('0x49')][_0xd8a2('0x4a')];_0x25f78f['recipientsDescription']=_[_0xd8a2('0x4b')](_0x44fb4f[_0xd8a2('0x33')][_0xd8a2('0x4c')])?null:_0x44fb4f['body'][_0xd8a2('0x4c')];_0x25f78f[_0xd8a2('0x4d')]=_0x44fb4f[_0xd8a2('0x33')]['beep']||![];_0x25f78f[_0xd8a2('0x4e')]=_0x44fb4f[_0xd8a2('0x49')]['id'];return getContent(_0x44fb4f[_0xd8a2('0x33')])[_0xd8a2('0x2e')](function(_0x483dc3){_0x25f78f[_0xd8a2('0x33')]=_0x483dc3;return getRecipients(_0xc4c991);})['then'](function(_0x260982){_0x25f78f[_0xd8a2('0x4f')]=_[_0xd8a2('0x50')](_0x260982)['join'](',');return db['sequelize']['transaction'](function(_0x459d47){return db[_0xd8a2('0x51')][_0xd8a2('0x52')](_0x25f78f,{'raw':!![],'transaction':_0x459d47})[_0xd8a2('0x2e')](function(_0x3d07fc){var _0x1f2608={'sender':_0x25f78f[_0xd8a2('0x48')],'description':_0x25f78f[_0xd8a2('0x4c')],'content':_0x25f78f[_0xd8a2('0x33')],'beep':_0x25f78f[_0xd8a2('0x4d')]};_0x260982[_0xd8a2('0x53')](function(_0x5dbcfc){_0x1f2608[_0xd8a2('0x54')]=_0x5dbcfc;socket[_0xd8a2('0x55')]('notification:send',_0x1f2608);});return _0x3d07fc;});});})[_0xd8a2('0x2e')](respondWithResult(_0x2dfae5,0xc9))[_0xd8a2('0x56')](handleError(_0x2dfae5,null));};function getContent(_0x4794d8){return new BPromise(function(_0x1728bc,_0xa095ed){if(_0x4794d8[_0xd8a2('0x35')]){_0x1728bc(_0x4794d8[_0xd8a2('0x35')]);return;}return db[_0xd8a2('0x57')][_0xd8a2('0x58')]({'attributes':[_0xd8a2('0x59')],'where':{'id':_0x4794d8[_0xd8a2('0x36')]},'raw':!![]})[_0xd8a2('0x2e')](function(_0x4cd931){if(!_0x4cd931)throw new db[(_0xd8a2('0x37'))][(_0xd8a2('0x38'))](_0xd8a2('0x5a'));var _0x5652e9=Mustache[_0xd8a2('0x5b')](_0x4cd931[_0xd8a2('0x59')],_0x4794d8['view']);_0x1728bc(_0x5652e9);})[_0xd8a2('0x56')](function(_0x4f78d5){_0xa095ed(_0x4f78d5);});});}function getRecipients(_0x464b93){return new BPromise(function(_0x93e078,_0x553e72){var _0x2a96aa=[];var _0x186c7d=[];_0x464b93['forEach'](function(_0x54edc2){var _0x4de00d=_['startCase'](_0x54edc2[_0xd8a2('0x46')][_0xd8a2('0x5c')]());if(_0x4de00d===_0xd8a2('0x5d')){_0x2a96aa=_[_0xd8a2('0x5e')](_0x2a96aa,_0x54edc2['ids']);}else{if(_[_0xd8a2('0x45')](_0x4de00d,'queue'))_0x4de00d=_0x4de00d[_0xd8a2('0x5f')](_0xd8a2('0x60'),_0xd8a2('0x61'));_0x54edc2[_0xd8a2('0x62')][_0xd8a2('0x53')](function(_0x4592b6){_0x186c7d[_0xd8a2('0x63')](getAgents(_0x4de00d,_0x4592b6));});}});return BPromise[_0xd8a2('0x64')](_0x186c7d)[_0xd8a2('0x2e')](function(_0x535085){_0x2a96aa=_[_0xd8a2('0x5e')](_0x2a96aa,_[_0xd8a2('0x65')](_0x535085));_0x93e078(_0x2a96aa);})[_0xd8a2('0x56')](function(_0x5462a7){_0x553e72(_0x5462a7);});});}function getAgents(_0x3df009,_0x2f03ee){return new BPromise(function(_0x58104e,_0x117713){return db[_0x3df009]['findOne']({'where':{'id':_0x2f03ee}})[_0xd8a2('0x2e')](function(_0x35521a){return _0x35521a['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1e80d3){var _0x44bd97=_[_0xd8a2('0x66')](_0x1e80d3,'id');_0x58104e(_0x44bd97);});})[_0xd8a2('0x56')](function(_0x5cf0e8){_0x117713(_0x5cf0e8);});});} \ No newline at end of file +var _0xda3f=['voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','create','forEach','recipient','emit','notification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','model','User','ids','queue','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x1b3343,_0x85a7dc){var _0x3151d5=function(_0x549c71){while(--_0x549c71){_0x1b3343['push'](_0x1b3343['shift']());}};_0x3151d5(++_0x85a7dc);}(_0xda3f,0xec));var _0xfda3=function(_0x23f1e4,_0x2bf381){_0x23f1e4=_0x23f1e4-0x0;var _0x11907f=_0xda3f[_0x23f1e4];return _0x11907f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];config['redis']=_[_0xfda3('0x17')](config['redis'],{'host':_0xfda3('0x18'),'port':0x18eb});var socket=require(_0xfda3('0x19'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x227d72,_0x477fc0){_0x477fc0=_0x477fc0||0xcc;return function(_0x5ea793){if(_0x5ea793){return _0x227d72['sendStatus'](_0x477fc0);}return _0x227d72['status'](_0x477fc0)[_0xfda3('0x1a')]();};}function respondWithResult(_0x474707,_0x249dc6){_0x249dc6=_0x249dc6||0xc8;return function(_0x3d8bcd){if(_0x3d8bcd){return _0x474707[_0xfda3('0x1b')](_0x249dc6)[_0xfda3('0x1c')](_0x3d8bcd);}};}function respondWithFilteredResult(_0x2aadcb,_0x93c8ef){return function(_0x4680bf){if(_0x4680bf){var _0xc62ae6=_0x4680bf[_0xfda3('0x1d')],_0x54a7c6=_0x93c8ef[_0xfda3('0x1e')],_0x15ddb9=_0x93c8ef['offset']+_0x93c8ef[_0xfda3('0x1f')],_0x1bbdda;if(_0x15ddb9>=_0xc62ae6){_0x15ddb9=_0xc62ae6;_0x1bbdda=0xc8;}else{_0x1bbdda=0xce;}_0x2aadcb[_0xfda3('0x1b')](_0x1bbdda);return _0x2aadcb[_0xfda3('0x20')]('Content-Range',_0x54a7c6+'-'+_0x15ddb9+'/'+_0xc62ae6)['json'](_0x4680bf);}return null;};}function patchUpdates(_0xa0449d){return function(_0x38d428){try{jsonpatch[_0xfda3('0x21')](_0x38d428,_0xa0449d,!![]);}catch(_0x545320){return BPromise[_0xfda3('0x22')](_0x545320);}return _0x38d428[_0xfda3('0x23')]();};}function saveUpdates(_0x1e15a8,_0x2c0ae9){return function(_0xfb4ee9){if(_0xfb4ee9){return _0xfb4ee9[_0xfda3('0x24')](_0x1e15a8)[_0xfda3('0x25')](function(_0xc6fb9a){return _0xc6fb9a;});}return null;};}function removeEntity(_0x16eaa6,_0x5499f5){return function(_0x82341b){if(_0x82341b){return _0x82341b[_0xfda3('0x26')]()[_0xfda3('0x25')](function(){_0x16eaa6['status'](0xcc)[_0xfda3('0x1a')]();});}};}function handleEntityNotFound(_0x39e246,_0x172cfb){return function(_0x38946d){if(!_0x38946d){_0x39e246[_0xfda3('0x27')](0x194);}return _0x38946d;};}function handleError(_0xad9f7b,_0x514d2a){_0x514d2a=_0x514d2a||0x1f4;return function(_0x3c6d7d){logger[_0xfda3('0x28')](_0x3c6d7d[_0xfda3('0x29')]);if(_0x3c6d7d[_0xfda3('0x2a')]){delete _0x3c6d7d[_0xfda3('0x2a')];}_0xad9f7b['status'](_0x514d2a)[_0xfda3('0x2b')](_0x3c6d7d);};}exports[_0xfda3('0x2c')]=function(_0x301509,_0x474992,_0xe21ec6){if(!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')]('text')&&!_0x301509['body'][_0xfda3('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0xfda3('0x2f'))](_0xfda3('0x30'));}else{if(_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x31'))&&!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x32'))){throw new db[(_0xfda3('0x33'))]['ValidationError'](_0xfda3('0x34'));}if(!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x35'))){throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x36'));}else{try{var _0x210763=JSON[_0xfda3('0x37')](_0x301509['body']['recipients']);}catch(_0x30e63e){logger[_0xfda3('0x28')](_0x30e63e);throw new db['Sequelize'][(_0xfda3('0x2f'))](_0xfda3('0x38'));}var _0x28ca96=['chatqueue',_0xfda3('0x39'),_0xfda3('0x3a'),_0xfda3('0x3b'),_0xfda3('0x3c'),_0xfda3('0x3d'),'whatsappqueue',_0xfda3('0x3e'),_0xfda3('0x3f')];if(_[_0xfda3('0x40')](_0x210763,function(_0x56bed2){return!_[_0xfda3('0x41')](_0x28ca96,_0x56bed2['model'][_0xfda3('0x42')]());})){throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x43'));}}}var _0x21c5cc={};_0x21c5cc[_0xfda3('0x44')]=_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')]('senderName')?_0x301509[_0xfda3('0x2d')][_0xfda3('0x44')]:_0x301509[_0xfda3('0x3f')][_0xfda3('0x45')];_0x21c5cc['recipientsDescription']=_[_0xfda3('0x46')](_0x301509[_0xfda3('0x2d')][_0xfda3('0x47')])?null:_0x301509['body']['recipientsDescription'];_0x21c5cc[_0xfda3('0x48')]=_0x301509[_0xfda3('0x2d')][_0xfda3('0x48')]||![];_0x21c5cc[_0xfda3('0x49')]=_0x301509[_0xfda3('0x3f')]['id'];return getContent(_0x301509[_0xfda3('0x2d')])[_0xfda3('0x25')](function(_0x278708){_0x21c5cc[_0xfda3('0x2d')]=_0x278708;return getRecipients(_0x210763);})[_0xfda3('0x25')](function(_0x4d3b1c){_0x21c5cc[_0xfda3('0x4a')]=_[_0xfda3('0x4b')](_0x4d3b1c)['join'](',');return db[_0xfda3('0x4c')]['transaction'](function(_0x51a314){return db['Notification'][_0xfda3('0x4d')](_0x21c5cc,{'raw':!![],'transaction':_0x51a314})[_0xfda3('0x25')](function(_0x260977){var _0x209918={'sender':_0x21c5cc['senderName'],'description':_0x21c5cc[_0xfda3('0x47')],'content':_0x21c5cc[_0xfda3('0x2d')],'beep':_0x21c5cc[_0xfda3('0x48')]};_0x4d3b1c[_0xfda3('0x4e')](function(_0x564ccd){_0x209918[_0xfda3('0x4f')]=_0x564ccd;socket[_0xfda3('0x50')](_0xfda3('0x51'),_0x209918);});return _0x260977;});});})['then'](respondWithResult(_0x474992,0xc9))['catch'](handleError(_0x474992,null));};function getContent(_0x1849fe){return new BPromise(function(_0xb3a539,_0x1eea02){if(_0x1849fe[_0xfda3('0x52')]){_0xb3a539(_0x1849fe[_0xfda3('0x52')]);return;}return db[_0xfda3('0x53')][_0xfda3('0x54')]({'attributes':[_0xfda3('0x55')],'where':{'id':_0x1849fe[_0xfda3('0x31')]},'raw':!![]})[_0xfda3('0x25')](function(_0x1749f7){if(!_0x1749f7)throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x56'));var _0x57013b=Mustache['render'](_0x1749f7[_0xfda3('0x55')],_0x1849fe[_0xfda3('0x32')]);_0xb3a539(_0x57013b);})[_0xfda3('0x57')](function(_0x270b9a){_0x1eea02(_0x270b9a);});});}function getRecipients(_0x597e5a){return new BPromise(function(_0x60a89d,_0x192133){var _0x125f5a=[];var _0x1372ee=[];_0x597e5a[_0xfda3('0x4e')](function(_0x5131da){var _0x257839=_[_0xfda3('0x58')](_0x5131da[_0xfda3('0x59')][_0xfda3('0x42')]());if(_0x257839===_0xfda3('0x5a')){_0x125f5a=_['union'](_0x125f5a,_0x5131da[_0xfda3('0x5b')]);}else{if(_[_0xfda3('0x41')](_0x257839,_0xfda3('0x5c')))_0x257839=_0x257839['replace'](_0xfda3('0x5c'),_0xfda3('0x5d'));_0x5131da[_0xfda3('0x5b')]['forEach'](function(_0x30c01c){_0x1372ee[_0xfda3('0x5e')](getAgents(_0x257839,_0x30c01c));});}});return BPromise[_0xfda3('0x5f')](_0x1372ee)[_0xfda3('0x25')](function(_0x1ab4a8){_0x125f5a=_['union'](_0x125f5a,_[_0xfda3('0x60')](_0x1ab4a8));_0x60a89d(_0x125f5a);})['catch'](function(_0x17fe20){_0x192133(_0x17fe20);});});}function getAgents(_0x587eef,_0x1b5e89){return new BPromise(function(_0x6447,_0x322b66){return db[_0x587eef][_0xfda3('0x54')]({'where':{'id':_0x1b5e89}})['then'](function(_0x244c24){return _0x244c24[_0xfda3('0x61')]({'attributes':['id'],'raw':!![]})[_0xfda3('0x25')](function(_0x372f15){var _0x18425a=_[_0xfda3('0x62')](_0x372f15,'id');_0x6447(_0x18425a);});})[_0xfda3('0x57')](function(_0x54fba2){_0x322b66(_0x54fba2);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 451b467..b066449 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x3e6058,_0x597b83){var _0x96eca0=function(_0x33cc7f){while(--_0x33cc7f){_0x3e6058['push'](_0x3e6058['shift']());}};_0x96eca0(++_0x597b83);}(_0x757a,0xde));var _0xa757=function(_0x19ff33,_0x1f3de3){_0x19ff33=_0x19ff33-0x0;var _0x3b4cdd=_0x757a[_0x19ff33];return _0x3b4cdd;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x4091d4,_0x25b9c7){var _0x139e34=function(_0x5d87ce){while(--_0x5d87ce){_0x4091d4['push'](_0x4091d4['shift']());}};_0x139e34(++_0x25b9c7);}(_0x757a,0xde));var _0xa757=function(_0x29c582,_0x556774){_0x29c582=_0x29c582-0x0;var _0x506fad=_0x757a[_0x29c582];return _0x506fad;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index dd23e0c..9fa238d 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 _0xdc95=['Notification','notifications','utf8mb4_unicode_ci','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x5b8685,_0x1a1c28){var _0xa3ef57=function(_0xa91aad){while(--_0xa91aad){_0x5b8685['push'](_0x5b8685['shift']());}};_0xa3ef57(++_0x1a1c28);}(_0xdc95,0x16b));var _0x5dc9=function(_0x2dbdac,_0x4d1e91){_0x2dbdac=_0x2dbdac-0x0;var _0x9a611e=_0xdc95[_0x2dbdac];return _0x9a611e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5dc9('0x0'))(_0x5dc9('0x1'));var moment=require('moment');var BPromise=require(_0x5dc9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dc9('0x3'));var config=require(_0x5dc9('0x4'));var attributes=require('./notification.attributes');module[_0x5dc9('0x5')]=function(_0x527b5f,_0x80d580){return _0x527b5f[_0x5dc9('0x6')](_0x5dc9('0x7'),attributes,{'tableName':_0x5dc9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5dc9('0x9')});}; \ No newline at end of file +var _0x35c5=['bluebird','request-promise','path','rimraf','./notification.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x290316,_0x2445ed){var _0x22c75d=function(_0x45a7ac){while(--_0x45a7ac){_0x290316['push'](_0x290316['shift']());}};_0x22c75d(++_0x2445ed);}(_0x35c5,0x141));var _0x535c=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x35c5[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x535c('0x0'));var util=require('util');var logger=require(_0x535c('0x1'))(_0x535c('0x2'));var moment=require(_0x535c('0x3'));var BPromise=require(_0x535c('0x4'));var rp=require(_0x535c('0x5'));var fs=require('fs');var path=require(_0x535c('0x6'));var rimraf=require(_0x535c('0x7'));var config=require('../../config/environment');var attributes=require(_0x535c('0x8'));module[_0x535c('0x9')]=function(_0x25e42f,_0x6fef75){return _0x25e42f[_0x535c('0xa')]('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x535c('0xb'),'collate':_0x535c('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 0567a45..2e48716 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 _0x2c73=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38dc5a,_0x3f48f4){var _0x65cf62=function(_0x57af7a){while(--_0x57af7a){_0x38dc5a['push'](_0x38dc5a['shift']());}};_0x65cf62(++_0x3f48f4);}(_0x2c73,0x162));var _0x32c7=function(_0x47e221,_0x20b0ec){_0x47e221=_0x47e221-0x0;var _0x2068bc=_0x2c73[_0x47e221];return _0x2068bc;};'use strict';var _=require(_0x32c7('0x0'));var util=require(_0x32c7('0x1'));var moment=require(_0x32c7('0x2'));var BPromise=require(_0x32c7('0x3'));var rs=require(_0x32c7('0x4'));var fs=require('fs');var Redis=require(_0x32c7('0x5'));var db=require(_0x32c7('0x6'))['db'];var utils=require(_0x32c7('0x7'));var logger=require('../../config/logger')(_0x32c7('0x8'));var config=require(_0x32c7('0x9'));var jayson=require(_0x32c7('0xa'));var client=jayson[_0x32c7('0xb')][_0x32c7('0xc')]({'port':0x232a});config['redis']=_[_0x32c7('0xd')](config[_0x32c7('0xe')],{'host':_0x32c7('0xf'),'port':0x18eb});var socket=require(_0x32c7('0x10'))(new Redis(config['redis']));require(_0x32c7('0x11'))[_0x32c7('0x12')](socket);function respondWithRpcPromise(_0x1bcc67,_0x6788d9,_0x5357d4){return new BPromise(function(_0x2b0432,_0x46ac09){return client[_0x32c7('0x13')](_0x1bcc67,_0x5357d4)[_0x32c7('0x14')](function(_0xfbe643){logger[_0x32c7('0x15')]('Notification,\x20%s,\x20%s',_0x6788d9,_0x32c7('0x16'));logger[_0x32c7('0x17')](_0x32c7('0x18'),_0x6788d9,_0x32c7('0x16'),JSON[_0x32c7('0x19')](_0xfbe643));if(_0xfbe643[_0x32c7('0x1a')]){if(_0xfbe643[_0x32c7('0x1a')]['code']===0x1f4){logger['error'](_0x32c7('0x1b'),_0x6788d9,_0xfbe643['error'][_0x32c7('0x1c')]);return _0x46ac09(_0xfbe643[_0x32c7('0x1a')]['message']);}logger[_0x32c7('0x1a')]('Notification,\x20%s,\x20%s',_0x6788d9,_0xfbe643[_0x32c7('0x1a')][_0x32c7('0x1c')]);return _0x2b0432(_0xfbe643[_0x32c7('0x1a')]['message']);}else{logger[_0x32c7('0x15')](_0x32c7('0x1b'),_0x6788d9,_0x32c7('0x16'));_0x2b0432(_0xfbe643[_0x32c7('0x1d')][_0x32c7('0x1c')]);}})['catch'](function(_0x21e2dc){logger['error'](_0x32c7('0x1b'),_0x6788d9,_0x21e2dc);_0x46ac09(_0x21e2dc);});});} \ No newline at end of file +var _0x0aa3=['defaults','redis','localhost','socket.io-emitter','register','then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x0aa3,0x103));var _0x30aa=function(_0x98011a,_0x1a7b4d){_0x98011a=_0x98011a-0x0;var _0x39f9ed=_0x0aa3[_0x98011a];return _0x39f9ed;};'use strict';var _=require(_0x30aa('0x0'));var util=require(_0x30aa('0x1'));var moment=require(_0x30aa('0x2'));var BPromise=require(_0x30aa('0x3'));var rs=require(_0x30aa('0x4'));var fs=require('fs');var Redis=require(_0x30aa('0x5'));var db=require(_0x30aa('0x6'))['db'];var utils=require(_0x30aa('0x7'));var logger=require(_0x30aa('0x8'))('rpc');var config=require(_0x30aa('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30aa('0xa')]({'port':0x232a});config['redis']=_[_0x30aa('0xb')](config[_0x30aa('0xc')],{'host':_0x30aa('0xd'),'port':0x18eb});var socket=require(_0x30aa('0xe'))(new Redis(config[_0x30aa('0xc')]));require('./notification.socket')[_0x30aa('0xf')](socket);function respondWithRpcPromise(_0x484fd1,_0x7e7e1e,_0x2684e2){return new BPromise(function(_0x1105bb,_0x177f6b){return client['request'](_0x484fd1,_0x2684e2)[_0x30aa('0x10')](function(_0x2b983a){logger['info'](_0x30aa('0x11'),_0x7e7e1e,'request\x20sent');logger[_0x30aa('0x12')](_0x30aa('0x13'),_0x7e7e1e,_0x30aa('0x14'),JSON[_0x30aa('0x15')](_0x2b983a));if(_0x2b983a['error']){if(_0x2b983a[_0x30aa('0x16')][_0x30aa('0x17')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x2b983a['error']['message']);return _0x177f6b(_0x2b983a[_0x30aa('0x16')][_0x30aa('0x18')]);}logger[_0x30aa('0x16')]('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x2b983a[_0x30aa('0x16')]['message']);return _0x1105bb(_0x2b983a[_0x30aa('0x16')]['message']);}else{logger['info'](_0x30aa('0x11'),_0x7e7e1e,'request\x20sent');_0x1105bb(_0x2b983a[_0x30aa('0x19')]['message']);}})[_0x30aa('0x1a')](function(_0x18cdaa){logger[_0x30aa('0x16')]('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x18cdaa);_0x177f6b(_0x18cdaa);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index ee92a0d..fabf1a7 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 _0x2558=['remove','update','emit','removeListener','register','notification:','save'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x2558,0x1cd));var _0x8255=function(_0x20c19f,_0xe79d0e){_0x20c19f=_0x20c19f-0x0;var _0x4e6151=_0x2558[_0x20c19f];return _0x4e6151;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x8255('0x0'),_0x8255('0x1'),_0x8255('0x2')];function createListener(_0x4b9601,_0xb1da24){return function(_0xba87fb){_0xb1da24[_0x8255('0x3')](_0x4b9601,_0xba87fb);};}function removeListener(_0x14a73b,_0x4fcd3d){return function(){NotificationEvents[_0x8255('0x4')](_0x14a73b,_0x4fcd3d);};}exports[_0x8255('0x5')]=function(_0x4b6066){for(var _0x458289=0x0,_0x1e9bd6=events['length'];_0x458289<_0x1e9bd6;_0x458289++){var _0xfae012=events[_0x458289];var _0x54faee=createListener(_0x8255('0x6')+_0xfae012,_0x4b6066);NotificationEvents['on'](_0xfae012,_0x54faee);}}; \ No newline at end of file +var _0x992f=['emit','notification:','./notification.events','save','remove','update'];(function(_0x32f59b,_0x3f3d17){var _0x44e713=function(_0x59a35e){while(--_0x59a35e){_0x32f59b['push'](_0x32f59b['shift']());}};_0x44e713(++_0x3f3d17);}(_0x992f,0x1b8));var _0xf992=function(_0x583823,_0x1f2c50){_0x583823=_0x583823-0x0;var _0x2b1844=_0x992f[_0x583823];return _0x2b1844;};'use strict';var NotificationEvents=require(_0xf992('0x0'));var events=[_0xf992('0x1'),_0xf992('0x2'),_0xf992('0x3')];function createListener(_0x1bff61,_0x3aef7d){return function(_0x3e47d5){_0x3aef7d[_0xf992('0x4')](_0x1bff61,_0x3e47d5);};}function removeListener(_0x3ae6c2,_0x5d34eb){return function(){NotificationEvents['removeListener'](_0x3ae6c2,_0x5d34eb);};}exports['register']=function(_0x3036c1){for(var _0x2e53de=0x0,_0x21ff0e=events['length'];_0x2e53de<_0x21ff0e;_0x2e53de++){var _0xd2361c=events[_0x2e53de];var _0x212233=createListener(_0xf992('0x5')+_0xd2361c,_0x3036c1);NotificationEvents['on'](_0xd2361c,_0x212233);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index fae54ca..738d490 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 _0x1301=['addAgents','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','post','addAnswer','/:id/applications','addApplications'];(function(_0x28d2b9,_0x1caa3d){var _0x5a9b88=function(_0x1d2a2d){while(--_0x1d2a2d){_0x28d2b9['push'](_0x28d2b9['shift']());}};_0x5a9b88(++_0x1caa3d);}(_0x1301,0x16a));var _0x1130=function(_0x156e85,_0x222ba6){_0x156e85=_0x156e85-0x0;var _0x1dbf1e=_0x1301[_0x156e85];return _0x1dbf1e;};'use strict';var multer=require(_0x1130('0x0'));var util=require('util');var path=require(_0x1130('0x1'));var timeout=require(_0x1130('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1130('0x3'));var interaction=require(_0x1130('0x4'));var config=require('../../config/environment');var controller=require(_0x1130('0x5'));router[_0x1130('0x6')]('/',auth[_0x1130('0x7')](),controller[_0x1130('0x8')]);router[_0x1130('0x6')](_0x1130('0x9'),auth[_0x1130('0x7')](),controller['describe']);router[_0x1130('0x6')]('/:id',auth[_0x1130('0x7')](),controller[_0x1130('0xa')]);router[_0x1130('0x6')](_0x1130('0xb'),auth[_0x1130('0x7')](),controller[_0x1130('0xc')]);router[_0x1130('0x6')](_0x1130('0xd'),auth['isAuthenticated'](),controller[_0x1130('0xe')]);router[_0x1130('0x6')]('/:id/applications',auth[_0x1130('0x7')](),controller[_0x1130('0xf')]);router[_0x1130('0x6')]('/:id/interactions',auth[_0x1130('0x7')](),controller[_0x1130('0x10')]);router[_0x1130('0x6')](_0x1130('0x11'),auth[_0x1130('0x7')](),controller['getAgents']);router[_0x1130('0x12')]('/',auth[_0x1130('0x7')](),controller['create']);router[_0x1130('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1130('0x12')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1130('0x13')]);router[_0x1130('0x12')]('/:id/notify',controller['notify']);router[_0x1130('0x12')](_0x1130('0x14'),auth[_0x1130('0x7')](),controller[_0x1130('0x15')]);router[_0x1130('0x12')]('/:id/users',auth[_0x1130('0x7')](),controller[_0x1130('0x16')]);router[_0x1130('0x12')](_0x1130('0x17'),auth[_0x1130('0x7')](),controller['send']);router[_0x1130('0x18')](_0x1130('0x19'),auth[_0x1130('0x7')](),controller[_0x1130('0x1a')]);router[_0x1130('0x1b')](_0x1130('0x19'),auth[_0x1130('0x7')](),controller[_0x1130('0x1c')]);router[_0x1130('0x1b')](_0x1130('0xb'),auth[_0x1130('0x7')](),controller[_0x1130('0x1d')]);router['delete'](_0x1130('0xd'),auth[_0x1130('0x7')](),controller[_0x1130('0x1e')]);router[_0x1130('0x1b')](_0x1130('0x11'),auth[_0x1130('0x7')](),controller['removeAgents']);module[_0x1130('0x1f')]=router; \ No newline at end of file +var _0x6f94=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x5c3093,_0x3e7acb){var _0x1fa178=function(_0x4dadfa){while(--_0x4dadfa){_0x5c3093['push'](_0x5c3093['shift']());}};_0x1fa178(++_0x3e7acb);}(_0x6f94,0x198));var _0x46f9=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6f94[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require(_0x46f9('0x0'));var path=require(_0x46f9('0x1'));var timeout=require(_0x46f9('0x2'));var express=require(_0x46f9('0x3'));var router=express['Router']();var auth=require(_0x46f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x46f9('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x46f9('0x6')](),controller[_0x46f9('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x46f9('0x8')]);router[_0x46f9('0x9')](_0x46f9('0xa'),auth[_0x46f9('0x6')](),controller['show']);router['get'](_0x46f9('0xb'),auth[_0x46f9('0x6')](),controller[_0x46f9('0xc')]);router[_0x46f9('0x9')](_0x46f9('0xd'),auth[_0x46f9('0x6')](),controller[_0x46f9('0xe')]);router[_0x46f9('0x9')]('/:id/applications',auth[_0x46f9('0x6')](),controller[_0x46f9('0xf')]);router['get'](_0x46f9('0x10'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x11')]);router[_0x46f9('0x9')](_0x46f9('0x12'),auth['isAuthenticated'](),controller[_0x46f9('0x13')]);router['post']('/',auth[_0x46f9('0x6')](),controller[_0x46f9('0x14')]);router[_0x46f9('0x15')]('/:id/dispositions',auth[_0x46f9('0x6')](),controller[_0x46f9('0x16')]);router[_0x46f9('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x46f9('0x17')]);router[_0x46f9('0x15')](_0x46f9('0x18'),controller[_0x46f9('0x19')]);router[_0x46f9('0x15')](_0x46f9('0x1a'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x1b')]);router[_0x46f9('0x15')]('/:id/users',auth[_0x46f9('0x6')](),controller[_0x46f9('0x1c')]);router[_0x46f9('0x15')]('/:id/send',auth[_0x46f9('0x6')](),controller[_0x46f9('0x1d')]);router[_0x46f9('0x1e')](_0x46f9('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x46f9('0xa'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x1f')]);router[_0x46f9('0x20')](_0x46f9('0xb'),auth['isAuthenticated'](),controller[_0x46f9('0x21')]);router[_0x46f9('0x20')](_0x46f9('0xd'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x22')]);router[_0x46f9('0x20')](_0x46f9('0x12'),auth['isAuthenticated'](),controller[_0x46f9('0x23')]);module[_0x46f9('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e7dd2e6..61876fc 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 _0x97ea=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x47baa4,_0x522480){var _0x484801=function(_0x4a1c32){while(--_0x4a1c32){_0x47baa4['push'](_0x47baa4['shift']());}};_0x484801(++_0x522480);}(_0x97ea,0xc5));var _0xa97e=function(_0x540701,_0x20df75){_0x540701=_0x540701-0x0;var _0xce5aa5=_0x97ea[_0x540701];return _0xce5aa5;};'use strict';var Sequelize=require(_0xa97e('0x0'));var rs=require(_0xa97e('0x1'));module[_0xa97e('0x2')]={'name':{'type':Sequelize[_0xa97e('0x3')],'unique':_0xa97e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa97e('0x3')]},'token':{'type':Sequelize[_0xa97e('0x3')],'defaultValue':function(){return rs[_0xa97e('0x5')]();}},'replyUri':{'type':Sequelize[_0xa97e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa97e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa97e('0x6')],'defaultValue':function(){return _0xa97e('0x7');}},'notificationSound':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa97e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa97e('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa97e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa97e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa97e('0x8')],'defaultValue':![],'comment':_0xa97e('0xb'),'set':function(_0x43bb0d){if(!_0x43bb0d)this[_0xa97e('0xc')](_0xa97e('0xd'),null);this[_0xa97e('0xc')](_0xa97e('0xe'),_0x43bb0d);}}}; \ No newline at end of file +var _0x6c9e=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x204fee,_0x5605a4){var _0x36a7ce=function(_0x4eb5b4){while(--_0x4eb5b4){_0x204fee['push'](_0x204fee['shift']());}};_0x36a7ce(++_0x5605a4);}(_0x6c9e,0xd6));var _0xe6c9=function(_0x331f62,_0x5a2bc2){_0x331f62=_0x331f62-0x0;var _0x5872a5=_0x6c9e[_0x331f62];return _0x5872a5;};'use strict';var Sequelize=require(_0xe6c9('0x0'));var rs=require(_0xe6c9('0x1'));module[_0xe6c9('0x2')]={'name':{'type':Sequelize[_0xe6c9('0x3')],'unique':_0xe6c9('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe6c9('0x3')]},'token':{'type':Sequelize[_0xe6c9('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe6c9('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe6c9('0x5')],'defaultValue':function(){return _0xe6c9('0x6');}},'notificationSound':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe6c9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe6c9('0x3')]},'queueTransfer':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe6c9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe6c9('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe6c9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![],'comment':_0xe6c9('0xa'),'set':function(_0x5512aa){if(!_0x5512aa)this[_0xe6c9('0xb')](_0xe6c9('0xc'),null);this[_0xe6c9('0xb')](_0xe6c9('0xd'),_0x5512aa);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8f28a7d..a7e0af9 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 _0x038b=['merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addDisposition','Disposition','getDispositions','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','Applications','account','applications','List','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','forcedOwnership','startRouting','Start','EventManager','notify','sequelize','transaction','OpenchannelApplication','priority','getApplications','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','getAgents','isNil','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x527159,_0x4a4993){_0x527159=_0x527159-0x0;var _0x555c11=_0x038b[_0x527159];return _0x555c11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb038('0x0'));var rimraf=require(_0xb038('0x1'));var zipdir=require(_0xb038('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb038('0x3'));var moment=require('moment');var BPromise=require(_0xb038('0x4'));var Mustache=require(_0xb038('0x5'));var util=require('util');var path=require(_0xb038('0x6'));var sox=require(_0xb038('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0xb'));var querystring=require(_0xb038('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xd'));var qs=require(_0xb038('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xf'));var logger=require(_0xb038('0x10'))(_0xb038('0x11'));var utils=require(_0xb038('0x12'));var config=require(_0xb038('0x13'));var licenseUtil=require(_0xb038('0x14'));var db=require(_0xb038('0x15'))['db'];config[_0xb038('0x16')]=_[_0xb038('0x17')](config[_0xb038('0x16')],{'host':_0xb038('0x18'),'port':0x18eb});var socket=require(_0xb038('0x19'))(new Redis(config[_0xb038('0x16')]));require(_0xb038('0x1a'))[_0xb038('0x1b')](socket);var jayson=require(_0xb038('0x1c'));var client=jayson[_0xb038('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xb038('0x1d')][_0xb038('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x183141,_0x39323e,_0xdef213,_0x2b4173){return new BPromise(function(_0x5246c3,_0x2a4134){var _0x3039b0=_0x2b4173||client;return _0x3039b0[_0xb038('0x1f')](_0x183141,_0xdef213)[_0xb038('0x20')](function(_0x4aa892){logger['info'](_0xb038('0x21'),_0x39323e,_0xb038('0x22'));logger[_0xb038('0x23')](_0xb038('0x24'),_0x39323e,'request\x20sent',JSON[_0xb038('0x25')](_0x4aa892));if(_0x4aa892[_0xb038('0x26')]){if(_0x4aa892[_0xb038('0x26')][_0xb038('0x27')]===0x1f4){logger[_0xb038('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x39323e,_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);return _0x2a4134(_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);}logger['error'](_0xb038('0x21'),_0x39323e,_0x4aa892[_0xb038('0x26')]['message']);return _0x5246c3(_0x4aa892[_0xb038('0x26')][_0xb038('0x28')]);}else{logger['info'](_0xb038('0x21'),_0x39323e,'request\x20sent');_0x5246c3(_0x4aa892[_0xb038('0x29')][_0xb038('0x28')]);}})[_0xb038('0x2a')](function(_0x1df7c4){logger[_0xb038('0x26')](_0xb038('0x21'),_0x39323e,_0x1df7c4);_0x2a4134(_0x1df7c4);});});}function respondWithStatusCode(_0x3f7cff,_0x576be5){_0x576be5=_0x576be5||0xcc;return function(_0xb6d93f){if(_0xb6d93f){return _0x3f7cff[_0xb038('0x2b')](_0x576be5);}return _0x3f7cff[_0xb038('0x2c')](_0x576be5)['end']();};}function respondWithResult(_0xa8fe18,_0x3af191){_0x3af191=_0x3af191||0xc8;return function(_0x1fa72d){if(_0x1fa72d){return _0xa8fe18['status'](_0x3af191)[_0xb038('0x2d')](_0x1fa72d);}};}function respondWithFilteredResult(_0x2855a6,_0x28a6a9){return function(_0x12b3b6){if(_0x12b3b6){var _0xc387d=_0x12b3b6[_0xb038('0x2e')],_0x551b55=_0x28a6a9[_0xb038('0x2f')],_0x1783d4=_0x28a6a9[_0xb038('0x2f')]+_0x28a6a9[_0xb038('0x30')],_0x1a8aa5;if(_0x1783d4>=_0xc387d){_0x1783d4=_0xc387d;_0x1a8aa5=0xc8;}else{_0x1a8aa5=0xce;}_0x2855a6[_0xb038('0x2c')](_0x1a8aa5);return _0x2855a6[_0xb038('0x31')](_0xb038('0x32'),_0x551b55+'-'+_0x1783d4+'/'+_0xc387d)[_0xb038('0x2d')](_0x12b3b6);}return null;};}function patchUpdates(_0x1599c9){return function(_0x1a741f){try{jsonpatch[_0xb038('0x33')](_0x1a741f,_0x1599c9,!![]);}catch(_0x4f6837){return BPromise[_0xb038('0x34')](_0x4f6837);}return _0x1a741f['save']();};}function saveUpdates(_0x908d1f,_0x13bf20){return function(_0x495253){if(_0x495253){return _0x495253[_0xb038('0x35')](_0x908d1f)[_0xb038('0x20')](function(_0x424b81){return _0x424b81;});}return null;};}function removeEntity(_0x3a393d,_0x3e6373){return function(_0x22fac4){if(_0x22fac4){return _0x22fac4[_0xb038('0x36')]()['then'](function(){var _0x2cac56=_0x22fac4[_0xb038('0x37')]({'plain':!![]});var _0x460599='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x460599,'resourceId':_0x2cac56['id']}})[_0xb038('0x20')](function(){return _0x22fac4;});})[_0xb038('0x20')](function(){_0x3a393d[_0xb038('0x2c')](0xcc)[_0xb038('0x38')]();});}};}function handleEntityNotFound(_0x5340d6,_0x268f1b){return function(_0x48f777){if(!_0x48f777){_0x5340d6[_0xb038('0x2b')](0x194);}return _0x48f777;};}function handleError(_0x378cae,_0x1b6f1e){_0x1b6f1e=_0x1b6f1e||0x1f4;return function(_0x17c445){logger['error'](_0x17c445[_0xb038('0x39')]);if(_0x17c445[_0xb038('0x3a')]){delete _0x17c445['name'];}_0x378cae['status'](_0x1b6f1e)[_0xb038('0x3b')](_0x17c445);};}exports[_0xb038('0x3c')]=function(_0x1e960c,_0x26cf19){var _0x1393e6={'include':[{'model':db[_0xb038('0x3d')],'as':_0xb038('0x3e')}]},_0x5cb540={},_0x404f82={'count':0x0,'rows':[]};var _0x2d1e57=_['map'](db[_0xb038('0x3f')][_0xb038('0x40')],function(_0x7d2f79){return{'name':_0x7d2f79['fieldName'],'type':_0x7d2f79[_0xb038('0x41')]['key']};});_0x5cb540[_0xb038('0x42')]=_[_0xb038('0x43')](_0x2d1e57,_0xb038('0x3a'));_0x5cb540['query']=_[_0xb038('0x44')](_0x1e960c[_0xb038('0x45')]);_0x5cb540[_0xb038('0x46')]=_['intersection'](_0x5cb540[_0xb038('0x42')],_0x5cb540[_0xb038('0x45')]);_0x1393e6[_0xb038('0x47')]=_[_0xb038('0x48')](_0x5cb540['model'],qs[_0xb038('0x49')](_0x1e960c[_0xb038('0x45')][_0xb038('0x49')]));_0x1393e6[_0xb038('0x47')]=_0x1393e6['attributes'][_0xb038('0x4a')]?_0x1393e6[_0xb038('0x47')]:_0x5cb540['model'];if(!_0x1e960c[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x1393e6['limit']=qs[_0xb038('0x30')](_0x1e960c[_0xb038('0x45')]['limit']);_0x1393e6['offset']=qs[_0xb038('0x2f')](_0x1e960c[_0xb038('0x45')][_0xb038('0x2f')]);}_0x1393e6[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x1e960c[_0xb038('0x45')][_0xb038('0x4e')]);_0x1393e6[_0xb038('0x4f')]=qs['filters'](_['pick'](_0x1e960c['query'],_0x5cb540[_0xb038('0x46')]),_0x2d1e57);if(_0x1e960c[_0xb038('0x45')]['filter']){_0x1393e6[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x1393e6[_0xb038('0x4f')],{'$or':_['map'](_0x2d1e57,function(_0x1a3d73){if(_0x1a3d73['type']!=='VIRTUAL'){var _0xaf1567={};_0xaf1567[_0x1a3d73[_0xb038('0x3a')]]={'$like':'%'+_0x1e960c[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xaf1567;}})});}_0x1393e6=_[_0xb038('0x50')]({},_0x1393e6,_0x1e960c[_0xb038('0x52')]);var _0x2f053a={'where':_0x1393e6[_0xb038('0x4f')]};return db[_0xb038('0x3f')][_0xb038('0x2e')](_0x2f053a)['then'](function(_0x2faf54){_0x404f82[_0xb038('0x2e')]=_0x2faf54;if(_0x1e960c['query'][_0xb038('0x53')]){_0x1393e6[_0xb038('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xb038('0x55')](_0x1393e6);})[_0xb038('0x20')](function(_0x1e7162){_0x404f82[_0xb038('0x56')]=_0x1e7162;return _0x404f82;})[_0xb038('0x20')](respondWithFilteredResult(_0x26cf19,_0x1393e6))[_0xb038('0x2a')](handleError(_0x26cf19,null));};exports[_0xb038('0x57')]=function(_0x19ed8d,_0x3a291d){var _0x54a826={'raw':![],'where':{'id':_0x19ed8d[_0xb038('0x58')]['id']},'include':[{'model':db[_0xb038('0x3d')],'as':_0xb038('0x3e')}]},_0x62daba={};_0x62daba[_0xb038('0x42')]=_[_0xb038('0x44')](db['OpenchannelAccount'][_0xb038('0x40')]);_0x62daba[_0xb038('0x45')]=_[_0xb038('0x44')](_0x19ed8d[_0xb038('0x45')]);_0x62daba[_0xb038('0x46')]=_[_0xb038('0x48')](_0x62daba[_0xb038('0x42')],_0x62daba['query']);_0x54a826[_0xb038('0x47')]=_['intersection'](_0x62daba[_0xb038('0x42')],qs[_0xb038('0x49')](_0x19ed8d[_0xb038('0x45')][_0xb038('0x49')]));_0x54a826[_0xb038('0x47')]=_0x54a826['attributes']['length']?_0x54a826['attributes']:_0x62daba[_0xb038('0x42')];if(_0x19ed8d[_0xb038('0x45')][_0xb038('0x53')]){_0x54a826[_0xb038('0x54')]=[{'all':!![]}];}_0x54a826=_[_0xb038('0x50')]({},_0x54a826,_0x19ed8d[_0xb038('0x52')]);return db['OpenchannelAccount'][_0xb038('0x59')](_0x54a826)[_0xb038('0x20')](handleEntityNotFound(_0x3a291d,null))['then'](respondWithResult(_0x3a291d,null))['catch'](handleError(_0x3a291d,null));};exports[_0xb038('0x5a')]=function(_0x4b7557,_0x199971){return db['OpenchannelAccount'][_0xb038('0x5a')](_0x4b7557[_0xb038('0x5b')],{})[_0xb038('0x20')](function(_0x4300e9){var _0x4ee38b=_0x4b7557[_0xb038('0x5c')][_0xb038('0x37')]({'plain':!![]});if(!_0x4ee38b)throw new Error(_0xb038('0x5d'));if(_0x4ee38b[_0xb038('0x5e')]===_0xb038('0x5c')){var _0x1246c8=_0x4300e9[_0xb038('0x37')]({'plain':!![]});var _0x401f4c=_0xb038('0x5f');return db[_0xb038('0x60')][_0xb038('0x59')]({'where':{'name':_0x401f4c,'userProfileId':_0x4ee38b[_0xb038('0x61')]},'raw':!![]})['then'](function(_0x29e11e){if(_0x29e11e&&_0x29e11e[_0xb038('0x62')]===0x0){return db[_0xb038('0x63')][_0xb038('0x5a')]({'name':_0x1246c8[_0xb038('0x3a')],'resourceId':_0x1246c8['id'],'type':_0x29e11e['name'],'sectionId':_0x29e11e['id']},{})[_0xb038('0x20')](function(){return _0x4300e9;});}else{return _0x4300e9;}})['catch'](function(_0xfb3ce6){logger[_0xb038('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb3ce6);throw _0xfb3ce6;});}return _0x4300e9;})[_0xb038('0x20')](respondWithResult(_0x199971,0xc9))[_0xb038('0x2a')](handleError(_0x199971,null));};exports[_0xb038('0x35')]=function(_0x4137cc,_0x120cc7){if(_0x4137cc[_0xb038('0x5b')]['id']){delete _0x4137cc[_0xb038('0x5b')]['id'];}return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x4137cc[_0xb038('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb038('0x3e')}]})['then'](handleEntityNotFound(_0x120cc7,null))[_0xb038('0x20')](saveUpdates(_0x4137cc[_0xb038('0x5b')],null))[_0xb038('0x20')](respondWithResult(_0x120cc7,null))[_0xb038('0x2a')](handleError(_0x120cc7,null));};exports[_0xb038('0x36')]=function(_0x23fb92,_0x1d6cf5){return db['OpenchannelAccount']['find']({'where':{'id':_0x23fb92[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x1d6cf5,null))[_0xb038('0x20')](removeEntity(_0x1d6cf5,null))['catch'](handleError(_0x1d6cf5,null));};exports['describe']=function(_0x2fe359,_0x4b807f){return db[_0xb038('0x3f')]['describe']()[_0xb038('0x20')](respondWithResult(_0x4b807f,null))['catch'](handleError(_0x4b807f,null));};exports[_0xb038('0x64')]=function(_0x3d0ee1,_0x13e42f,_0x112d77){if(_0x3d0ee1[_0xb038('0x5b')]['id']){delete _0x3d0ee1[_0xb038('0x5b')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3d0ee1[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x13e42f,null))[_0xb038('0x20')](function(_0x42f5dc){if(_0x42f5dc){_0x3d0ee1[_0xb038('0x5b')]['OpenchannelAccountId']=_0x42f5dc['id'];return db[_0xb038('0x65')]['create'](_0x3d0ee1[_0xb038('0x5b')]);}})[_0xb038('0x20')](respondWithResult(_0x13e42f,null))[_0xb038('0x2a')](handleError(_0x13e42f,null));};exports[_0xb038('0x66')]=function(_0x40abb7,_0x41b1d1,_0x3e2b92){var _0x137d26={'raw':![],'where':{}};var _0x195a49={};var _0x494fe5={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40abb7[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x41b1d1,null))[_0xb038('0x20')](function(_0x5a995c){if(_0x5a995c){_0x195a49[_0xb038('0x42')]=_[_0xb038('0x44')](db[_0xb038('0x65')][_0xb038('0x40')]);_0x195a49[_0xb038('0x45')]=_[_0xb038('0x44')](_0x40abb7[_0xb038('0x45')]);_0x195a49[_0xb038('0x46')]=_[_0xb038('0x48')](_0x195a49[_0xb038('0x42')],_0x195a49[_0xb038('0x45')]);_0x137d26[_0xb038('0x47')]=_[_0xb038('0x48')](_0x195a49[_0xb038('0x42')],qs[_0xb038('0x49')](_0x40abb7[_0xb038('0x45')][_0xb038('0x49')]));_0x137d26[_0xb038('0x47')]=_0x137d26[_0xb038('0x47')]['length']?_0x137d26[_0xb038('0x47')]:_0x195a49[_0xb038('0x42')];if(!_0x40abb7[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x137d26['limit']=qs[_0xb038('0x30')](_0x40abb7[_0xb038('0x45')][_0xb038('0x30')]);_0x137d26[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x40abb7[_0xb038('0x45')][_0xb038('0x2f')]);}_0x137d26[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x40abb7['query']['sort']);_0x137d26[_0xb038('0x4f')]=qs['filters'](_[_0xb038('0x67')](_0x40abb7['query'],_0x195a49['filters']));_0x137d26['where'][_0xb038('0x68')]=_0x5a995c['id'];if(_0x40abb7[_0xb038('0x45')]['filter']){_0x137d26[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x137d26[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x137d26[_0xb038('0x47')],function(_0x1f960b){var _0xac08cf={};_0xac08cf[_0x1f960b]={'$like':'%'+_0x40abb7[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xac08cf;})});}_0x137d26=_[_0xb038('0x50')]({},_0x137d26,_0x40abb7['options']);return db[_0xb038('0x65')][_0xb038('0x2e')]({'where':_0x137d26[_0xb038('0x4f')]})[_0xb038('0x20')](function(_0xfd78cf){_0x494fe5[_0xb038('0x2e')]=_0xfd78cf;if(_0x40abb7[_0xb038('0x45')]['includeAll']){_0x137d26[_0xb038('0x54')]=[{'all':!![]}];}return db[_0xb038('0x65')][_0xb038('0x55')](_0x137d26);})['then'](function(_0x551fcc){_0x494fe5[_0xb038('0x56')]=_0x551fcc;return _0x494fe5;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x41b1d1,_0x137d26))[_0xb038('0x2a')](handleError(_0x41b1d1,null));};exports['removeDispositions']=function(_0x3af6a2,_0x2c8d17,_0x5b003a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x3af6a2[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x2c8d17,null))[_0xb038('0x20')](function(_0x3dc0ba){if(_0x3dc0ba){return _0x3dc0ba[_0xb038('0x69')](_0x3af6a2[_0xb038('0x45')][_0xb038('0x6a')]);}})[_0xb038('0x20')](respondWithStatusCode(_0x2c8d17,null))[_0xb038('0x2a')](handleError(_0x2c8d17,null));};exports[_0xb038('0x6b')]=function(_0x2ee9c5,_0x394c62,_0x5d1410){if(_0x2ee9c5[_0xb038('0x5b')]['id']){delete _0x2ee9c5[_0xb038('0x5b')]['id'];}return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x2ee9c5[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x394c62,null))[_0xb038('0x20')](function(_0xf9caa5){if(_0xf9caa5){_0x2ee9c5['body'][_0xb038('0x68')]=_0xf9caa5['id'];return db[_0xb038('0x6c')]['create'](_0x2ee9c5[_0xb038('0x5b')]);}})['then'](respondWithResult(_0x394c62,null))['catch'](handleError(_0x394c62,null));};exports[_0xb038('0x6d')]=function(_0x5ca2b0,_0x22e5d4,_0x4ff6cf){var _0x3493da={'raw':![],'where':{}};var _0x1d15df={};var _0x231ba1={'count':0x0,'rows':[]};return db[_0xb038('0x3f')][_0xb038('0x6e')]({'where':{'id':_0x5ca2b0[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x22e5d4,null))[_0xb038('0x20')](function(_0x4f82f4){if(_0x4f82f4){_0x1d15df['model']=_[_0xb038('0x44')](db[_0xb038('0x6c')][_0xb038('0x40')]);_0x1d15df[_0xb038('0x45')]=_['keys'](_0x5ca2b0[_0xb038('0x45')]);_0x1d15df[_0xb038('0x46')]=_[_0xb038('0x48')](_0x1d15df[_0xb038('0x42')],_0x1d15df[_0xb038('0x45')]);_0x3493da[_0xb038('0x47')]=_[_0xb038('0x48')](_0x1d15df[_0xb038('0x42')],qs[_0xb038('0x49')](_0x5ca2b0[_0xb038('0x45')]['fields']));_0x3493da['attributes']=_0x3493da[_0xb038('0x47')][_0xb038('0x4a')]?_0x3493da[_0xb038('0x47')]:_0x1d15df[_0xb038('0x42')];if(!_0x5ca2b0[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x3493da['limit']=qs[_0xb038('0x30')](_0x5ca2b0[_0xb038('0x45')][_0xb038('0x30')]);_0x3493da[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x5ca2b0[_0xb038('0x45')]['offset']);}_0x3493da[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x5ca2b0[_0xb038('0x45')][_0xb038('0x4e')]);_0x3493da[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x5ca2b0[_0xb038('0x45')],_0x1d15df[_0xb038('0x46')]));_0x3493da[_0xb038('0x4f')][_0xb038('0x68')]=_0x4f82f4['id'];if(_0x5ca2b0[_0xb038('0x45')][_0xb038('0x51')]){_0x3493da[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x3493da[_0xb038('0x4f')],{'$or':_['map'](_0x3493da['attributes'],function(_0x183048){var _0x17870b={};_0x17870b[_0x183048]={'$like':'%'+_0x5ca2b0[_0xb038('0x45')]['filter']+'%'};return _0x17870b;})});}_0x3493da=_[_0xb038('0x50')]({},_0x3493da,_0x5ca2b0[_0xb038('0x52')]);return db[_0xb038('0x6c')][_0xb038('0x2e')]({'where':_0x3493da['where']})['then'](function(_0xd6037){_0x231ba1[_0xb038('0x2e')]=_0xd6037;if(_0x5ca2b0['query'][_0xb038('0x53')]){_0x3493da[_0xb038('0x54')]=[{'all':!![]}];}return db[_0xb038('0x6c')][_0xb038('0x55')](_0x3493da);})['then'](function(_0xb204f3){_0x231ba1[_0xb038('0x56')]=_0xb204f3;return _0x231ba1;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x22e5d4,_0x3493da))[_0xb038('0x2a')](handleError(_0x22e5d4,null));};exports[_0xb038('0x6f')]=function(_0x42642a,_0x108021,_0x4b6d6a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x42642a[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x108021,null))[_0xb038('0x20')](function(_0x5842c8){if(_0x5842c8){return _0x5842c8[_0xb038('0x6f')](_0x42642a['query'][_0xb038('0x6a')]);}})[_0xb038('0x20')](respondWithStatusCode(_0x108021,null))[_0xb038('0x2a')](handleError(_0x108021,null));};exports['notify']=function(_0x4cc9c6,_0x50a6f3,_0x1ef260){var _0x37a24f={'body':_0x4cc9c6[_0xb038('0x5b')],'channel':'openchannel'};var _0x3d737f=[];var _0x55131f=[];var _0x364bec={};var _0x4a2841=![];return db['CmContact'][_0xb038('0x70')]()[_0xb038('0x20')](function(_0x8e49ae){if(!_0x8e49ae){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x73'));}_0x3d737f=_[_0xb038('0x74')](_['keys'](_0x8e49ae),[_0xb038('0x75'),'updatedAt']);_0x55131f=_['difference'](_[_0xb038('0x44')](_0x8e49ae),[_0xb038('0x75'),_0xb038('0x76'),_0xb038('0x77'),_0xb038('0x78')]);if(_0x4cc9c6[_0xb038('0x5b')]['id']){delete _0x4cc9c6[_0xb038('0x5b')]['id'];}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')])){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x7a'));}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x5b')])||_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x5b')]===''){throw new db['Sequelize'][(_0xb038('0x72'))](_0xb038('0x7b'));}if(_['isNil'](_0x4cc9c6[_0xb038('0x5b')]['mapKey'])){throw new db[(_0xb038('0x71'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55131f);}if(!_['includes'](_0x55131f,_0x4cc9c6[_0xb038('0x5b')]['mapKey'])){throw new db[(_0xb038('0x71'))][(_0xb038('0x72'))](_0xb038('0x7c')+_0x55131f);}_0x364bec[_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x7d')]]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')];})[_0xb038('0x20')](function(){return db['OpenchannelAccount'][_0xb038('0x59')]({'where':{'id':_0x4cc9c6[_0xb038('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xb038('0x7e'),'where':_0x364bec,'limit':0x1,'order':[[_0xb038('0x76'),_0xb038('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb038('0x80')}]});})[_0xb038('0x20')](handleEntityNotFound(_0x50a6f3,null))[_0xb038('0x20')](function(_0x3e56b2){if(_0x3e56b2&&_0x3e56b2['List']){_0x37a24f[_0xb038('0x81')]=_0x3e56b2;_0x37a24f[_0xb038('0x82')]=_0x3e56b2[_0xb038('0x80')];_0x37a24f['list']=_0x3e56b2[_0xb038('0x83')];_0x37a24f[_0xb038('0x82')]=_['orderBy'](_0x37a24f[_0xb038('0x82')],['priority'],['asc']);if(_0x37a24f[_0xb038('0x81')][_0xb038('0x80')]){delete _0x37a24f['account']['Applications'];}if(_0x37a24f[_0xb038('0x81')][_0xb038('0x83')]&&_0x37a24f[_0xb038('0x81')][_0xb038('0x83')][_0xb038('0x7e')][_0xb038('0x4a')]){return _0x37a24f[_0xb038('0x81')][_0xb038('0x83')][_0xb038('0x7e')][0x0];}var _0xf6b7da=_[_0xb038('0x17')](_0x4cc9c6[_0xb038('0x5b')],{'firstName':_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x79')],'ListId':_0x3e56b2[_0xb038('0x78')]});_0xf6b7da[_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x7d')]]=_0x4cc9c6[_0xb038('0x5b')]['from'];return db[_0xb038('0x84')]['create'](_0xf6b7da,{'fields':_0x3d737f,'raw':!![]});}})['then'](handleEntityNotFound(_0x50a6f3,null))['then'](function(_0x1b387b){_0x37a24f[_0xb038('0x85')]=_0x1b387b;if(_0x1b387b){var _0x2267df={'ContactId':_0x1b387b['id'],'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'from':(_0x1b387b[_0xb038('0x86')]||'')+'\x20'+(_0x1b387b[_0xb038('0x87')]||'')};var _0x18c1c6={'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'closed':![]};if(_0x4cc9c6[_0xb038('0x5b')]['threadId']){_0x18c1c6[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x88')];return db[_0xb038('0x89')]['find']({'where':_0x18c1c6})[_0xb038('0x20')](function(_0x5054a8){if(_0x5054a8){return[_0x5054a8,![]];}_0x2267df[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x88')];_0x2267df[_0xb038('0x8a')]=_0x4cc9c6['body'][_0xb038('0x8a')];return db[_0xb038('0x89')][_0xb038('0x5a')](_0x2267df)[_0xb038('0x20')](function(_0x3bb82c){return[_0x3bb82c,!![]];});});}else{_0x18c1c6[_0xb038('0x88')]=null;}_0x18c1c6[_0xb038('0x8b')]=_0x1b387b['id'];return db['OpenchannelInteraction']['find']({'where':_0x18c1c6})[_0xb038('0x20')](function(_0x3df6f7){if(_0x3df6f7){return[_0x3df6f7,![]];}return db['OpenchannelInteraction']['create'](_0x2267df)[_0xb038('0x20')](function(_0x5b6b6b){return[_0x5b6b6b,!![]];});});}})[_0xb038('0x8c')](function(_0x2a7471,_0x3c6a48){if(_0x2a7471){_0x4a2841=_0x3c6a48;if(!_0x3c6a48){var _0x1f42a2={'from':(_0x37a24f['contact']['firstName']||'')+'\x20'+(_0x37a24f[_0xb038('0x85')][_0xb038('0x87')]||'')};if(_0x4cc9c6[_0xb038('0x5b')]['threadId']&&_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x8d')]&&_0x4cc9c6['body'][_0xb038('0x88')]!=_0x4cc9c6['body'][_0xb038('0x8d')]){_0x1f42a2[_0xb038('0x88')]=_0x4cc9c6[_0xb038('0x5b')][_0xb038('0x8d')];}return _0x2a7471[_0xb038('0x35')](_0x1f42a2);}else{return _0x2a7471;}}})[_0xb038('0x20')](function(_0x24472e){_0x37a24f[_0xb038('0x8e')]=_0x24472e[_0xb038('0x37')]({'plain':!![]});_0x37a24f[_0xb038('0x8e')]['created']=_0x4a2841;if(_0x37a24f[_0xb038('0x8e')]['created']){if(_0x37a24f[_0xb038('0x81')][_0xb038('0x8f')]){_0x37a24f[_0xb038('0x82')][_0xb038('0x90')]({'id':0x0,'priority':_0x37a24f['applications']['length']+0x1,'app':_0xb038('0x91'),'appdata':_0xb038('0x92'),'interval':_0xb038('0x93')});}}return db[_0xb038('0x94')][_0xb038('0x5a')]({'body':_0x4cc9c6['body'][_0xb038('0x5b')],'OpenchannelAccountId':_0x4cc9c6[_0xb038('0x58')]['id'],'OpenchannelInteractionId':_0x24472e['id'],'direction':'in','ContactId':_0x37a24f[_0xb038('0x85')]['id'],'AttachmentId':_0x4cc9c6[_0xb038('0x5b')]['AttachmentId']});})[_0xb038('0x20')](function(_0x47f490){_0x37a24f[_0xb038('0x28')]=_0x47f490;if(_0x37a24f[_0xb038('0x8e')][_0xb038('0x95')]){return db[_0xb038('0x96')][_0xb038('0x59')]({'attributes':['id','name'],'where':{'id':_0x37a24f['interaction'][_0xb038('0x95')]}})[_0xb038('0x20')](function(_0x5298eb){if(_0x5298eb){_0x37a24f['applications'][_0xb038('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5298eb[_0xb038('0x3a')]+','+(_0x37a24f[_0xb038('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xb038('0x93')});_0x37a24f[_0xb038('0x98')]=![];}return respondWithRpcPromise('Start',_0xb038('0x99'),_0x37a24f);});}return respondWithRpcPromise(_0xb038('0x9a'),_0xb038('0x99'),_0x37a24f);})[_0xb038('0x20')](function(_0x3be3e4){respondWithRpcPromise(_0xb038('0x9b'),_0xb038('0x9b'),{'event':_0xb038('0x9c'),'message':_0x3be3e4},client9002);return _0x3be3e4;})[_0xb038('0x20')](respondWithResult(_0x50a6f3,null))[_0xb038('0x2a')](handleError(_0x50a6f3,null));};exports['addApplications']=function(_0x5b61a0,_0x1c79b8,_0x5b4e1d){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5b61a0['params']['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x1c79b8,null))[_0xb038('0x20')](function(_0x3f6506){if(_0x3f6506){return db[_0xb038('0x9d')][_0xb038('0x9e')](function(_0x30667a){return db['OpenchannelApplication'][_0xb038('0x36')]({'where':{'OpenchannelAccountId':_0x5b61a0['params']['id']},'transaction':_0x30667a})['then'](function(_0x405fae){var _0x260a66=_[_0xb038('0x43')](_0x5b61a0[_0xb038('0x5b')],function(_0x5b82d0){_0x5b82d0[_0xb038('0x68')]=_0x5b61a0[_0xb038('0x58')]['id'];return _0x5b82d0;});return db[_0xb038('0x9f')]['bulkCreate'](_0x260a66,{'transaction':_0x30667a});});})[_0xb038('0x20')](function(){return db[_0xb038('0x9f')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5b61a0['params']['id']},'order':_0xb038('0xa0')});});}})[_0xb038('0x20')](respondWithResult(_0x1c79b8,null))[_0xb038('0x2a')](handleError(_0x1c79b8,null));};exports[_0xb038('0xa1')]=function(_0x212139,_0x4ca7a9,_0x1f4881){var _0x11c3a2={};var _0x3069e4={};var _0x2806c5;var _0x5865a6;return db[_0xb038('0x3f')]['findOne']({'where':{'id':_0x212139[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x4ca7a9,null))['then'](function(_0x5437a1){if(_0x5437a1){_0x2806c5=_0x5437a1;_0x3069e4['model']=_[_0xb038('0x44')](db[_0xb038('0x9f')][_0xb038('0x40')]);_0x3069e4['query']=_[_0xb038('0x44')](_0x212139[_0xb038('0x45')]);_0x3069e4[_0xb038('0x46')]=_[_0xb038('0x48')](_0x3069e4[_0xb038('0x42')],_0x3069e4['query']);_0x11c3a2['attributes']=_[_0xb038('0x48')](_0x3069e4['model'],qs[_0xb038('0x49')](_0x212139[_0xb038('0x45')][_0xb038('0x49')]));_0x11c3a2['attributes']=_0x11c3a2[_0xb038('0x47')][_0xb038('0x4a')]?_0x11c3a2['attributes']:_0x3069e4[_0xb038('0x42')];_0x11c3a2[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x212139[_0xb038('0x45')][_0xb038('0x4e')]);_0x11c3a2[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x212139['query'],_0x3069e4['filters']));if(_0x212139[_0xb038('0x45')][_0xb038('0x51')]){_0x11c3a2[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x11c3a2[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x11c3a2[_0xb038('0x47')],function(_0x3dfdd9){var _0x513785={};_0x513785[_0x3dfdd9]={'$like':'%'+_0x212139[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0x513785;})});}_0x11c3a2=_['merge']({},_0x11c3a2,_0x212139[_0xb038('0x52')]);return _0x2806c5[_0xb038('0xa1')](_0x11c3a2);}})[_0xb038('0x20')](function(_0xe40f97){if(_0xe40f97){_0x5865a6=_0xe40f97[_0xb038('0x4a')];if(!_0x212139[_0xb038('0x45')][_0xb038('0x4b')](_0xb038('0x4c'))){_0x11c3a2[_0xb038('0x30')]=qs['limit'](_0x212139[_0xb038('0x45')][_0xb038('0x30')]);_0x11c3a2[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x212139[_0xb038('0x45')][_0xb038('0x2f')]);}return _0x2806c5[_0xb038('0xa1')](_0x11c3a2);}})[_0xb038('0x20')](function(_0x304f2e){if(_0x304f2e){return _0x304f2e?{'count':_0x5865a6,'rows':_0x304f2e}:null;}})[_0xb038('0x20')](respondWithResult(_0x4ca7a9,null))[_0xb038('0x2a')](handleError(_0x4ca7a9,null));};exports['getInteractions']=function(_0x58fd38,_0x76e7d6,_0x3a3c9b){var _0x591c9c={'raw':![],'where':{}};var _0x17eee3={};var _0x22e37e={'count':0x0,'rows':[]};return db[_0xb038('0x3f')]['findOne']({'where':{'id':_0x58fd38['params']['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x76e7d6,null))[_0xb038('0x20')](function(_0x4cd719){if(_0x4cd719){_0x17eee3['model']=_[_0xb038('0x44')](db[_0xb038('0x89')][_0xb038('0x40')]);_0x17eee3[_0xb038('0x45')]=_[_0xb038('0x44')](_0x58fd38['query']);_0x17eee3[_0xb038('0x46')]=_[_0xb038('0x48')](_0x17eee3[_0xb038('0x42')],_0x17eee3['query']);_0x591c9c[_0xb038('0x47')]=_[_0xb038('0x48')](_0x17eee3['model'],qs[_0xb038('0x49')](_0x58fd38[_0xb038('0x45')][_0xb038('0x49')]));_0x591c9c[_0xb038('0x47')]=_0x591c9c['attributes']['length']?_0x591c9c['attributes']:_0x17eee3[_0xb038('0x42')];if(!_0x58fd38['query'][_0xb038('0x4b')](_0xb038('0x4c'))){_0x591c9c[_0xb038('0x30')]=qs[_0xb038('0x30')](_0x58fd38[_0xb038('0x45')][_0xb038('0x30')]);_0x591c9c[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x58fd38['query'][_0xb038('0x2f')]);}_0x591c9c[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x58fd38['query']['sort']);_0x591c9c[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x58fd38[_0xb038('0x45')],_0x17eee3['filters']));_0x591c9c[_0xb038('0x4f')][_0xb038('0x68')]=_0x4cd719['id'];if(_0x58fd38[_0xb038('0x45')]['filter']){_0x591c9c['where']=_[_0xb038('0x50')](_0x591c9c[_0xb038('0x4f')],{'$or':_[_0xb038('0x43')](_0x591c9c[_0xb038('0x47')],function(_0x222e9a){var _0x51c64b={};_0x51c64b[_0x222e9a]={'$like':'%'+_0x58fd38[_0xb038('0x45')]['filter']+'%'};return _0x51c64b;})});}_0x591c9c=_[_0xb038('0x50')]({},_0x591c9c,_0x58fd38['options']);return db['OpenchannelInteraction'][_0xb038('0x2e')]({'where':_0x591c9c[_0xb038('0x4f')]})[_0xb038('0x20')](function(_0x4f1755){_0x22e37e[_0xb038('0x2e')]=_0x4f1755;if(_0x58fd38['query']['includeAll']){_0x591c9c['include']=[{'model':db[_0xb038('0x84')],'as':'Contact','required':![]},{'model':db[_0xb038('0x96')],'as':_0xb038('0xa2'),'attributes':[_0xb038('0x3a'),_0xb038('0xa3'),'internal'],'required':![]},{'model':db[_0xb038('0xa4')],'as':'Tags','attributes':['id',_0xb038('0x3a'),_0xb038('0xa5')],'where':_0x58fd38[_0xb038('0x45')][_0xb038('0xa6')]?{'id':_0x58fd38[_0xb038('0x45')][_0xb038('0xa6')]}:undefined,'required':_0x58fd38['query'][_0xb038('0xa6')]?!![]:![]}];}return db[_0xb038('0x89')][_0xb038('0x55')](_0x591c9c);})[_0xb038('0x20')](function(_0x27e37d){_0x22e37e['rows']=_0x27e37d;return _0x22e37e;});}})[_0xb038('0x20')](respondWithFilteredResult(_0x76e7d6,_0x591c9c))[_0xb038('0x2a')](handleError(_0x76e7d6,null));};exports[_0xb038('0xa7')]=function(_0x1b1750,_0x5c5edb,_0x30191a){return db[_0xb038('0x3f')][_0xb038('0x59')]({'where':{'id':_0x1b1750[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x5c5edb,null))[_0xb038('0x20')](function(_0x1322a8){if(_0x1322a8){return _0x1322a8[_0xb038('0xa7')](_0x1b1750['body'][_0xb038('0x6a')],_[_0xb038('0xa8')](_0x1b1750['body'],['ids','id'])||{})[_0xb038('0x8c')](function(_0x33225e){for(var _0x310ddc=0x0;_0x310ddc<_0x1b1750[_0xb038('0x5b')][_0xb038('0x6a')]['length'];_0x310ddc+=0x1){socket[_0xb038('0xa9')](_0xb038('0xaa'),{'UserId':_0x1b1750[_0xb038('0x5b')][_0xb038('0x6a')][_0x310ddc],'OpenchannelAccountId':_0x1b1750[_0xb038('0x58')]['id']});}return _0x33225e;});}})[_0xb038('0x20')](respondWithResult(_0x5c5edb,null))[_0xb038('0x2a')](handleError(_0x5c5edb,null));};exports[_0xb038('0xab')]=function(_0x3a0ce9,_0x24c951,_0xd0b234){return db[_0xb038('0x3f')]['find']({'where':{'id':_0x3a0ce9[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x24c951,null))[_0xb038('0x20')](function(_0x5ce44e){if(_0x5ce44e){return _0x5ce44e[_0xb038('0xab')](_0x3a0ce9[_0xb038('0x45')]['ids'])[_0xb038('0x20')](function(){if(_['isArray'](_0x3a0ce9[_0xb038('0x45')]['ids'])){for(var _0x18cc50=0x0;_0x18cc50<_0x3a0ce9[_0xb038('0x45')]['ids'][_0xb038('0x4a')];_0x18cc50+=0x1){socket[_0xb038('0xa9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3a0ce9['query']['ids'][_0x18cc50]),'OpenchannelAccountId':Number(_0x3a0ce9[_0xb038('0x58')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3a0ce9[_0xb038('0x45')]['ids']),'OpenchannelAccountId':Number(_0x3a0ce9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x24c951,null))[_0xb038('0x2a')](handleError(_0x24c951,null));};exports[_0xb038('0xac')]=function(_0x18797a,_0x29403e,_0x2b9627){var _0x112b57={};var _0x13207a={};var _0x2de2a5;var _0x48f70b;return db[_0xb038('0x3f')][_0xb038('0x6e')]({'where':{'id':_0x18797a[_0xb038('0x58')]['id']}})['then'](handleEntityNotFound(_0x29403e,null))[_0xb038('0x20')](function(_0xef58f){if(_0xef58f){_0x2de2a5=_0xef58f;_0x13207a[_0xb038('0x42')]=_[_0xb038('0x44')](db['User']['rawAttributes']);_0x13207a[_0xb038('0x45')]=_[_0xb038('0x44')](_0x18797a['query']);_0x13207a['filters']=_[_0xb038('0x48')](_0x13207a['model'],_0x13207a[_0xb038('0x45')]);_0x112b57[_0xb038('0x47')]=_[_0xb038('0x48')](_0x13207a['model'],qs[_0xb038('0x49')](_0x18797a[_0xb038('0x45')]['fields']));_0x112b57[_0xb038('0x47')]=_0x112b57[_0xb038('0x47')][_0xb038('0x4a')]?_0x112b57[_0xb038('0x47')]:_0x13207a[_0xb038('0x42')];_0x112b57[_0xb038('0x4d')]=qs[_0xb038('0x4e')](_0x18797a[_0xb038('0x45')]['sort']);_0x112b57[_0xb038('0x4f')]=qs[_0xb038('0x46')](_[_0xb038('0x67')](_0x18797a[_0xb038('0x45')],_0x13207a[_0xb038('0x46')]));if(_0x18797a[_0xb038('0x45')][_0xb038('0x51')]){_0x112b57[_0xb038('0x4f')]=_[_0xb038('0x50')](_0x112b57['where'],{'$or':_[_0xb038('0x43')](_0x112b57[_0xb038('0x47')],function(_0x2687fc){var _0xc54892={};_0xc54892[_0x2687fc]={'$like':'%'+_0x18797a[_0xb038('0x45')][_0xb038('0x51')]+'%'};return _0xc54892;})});}_0x112b57=_['merge']({},_0x112b57,_0x18797a['options']);return _0x2de2a5[_0xb038('0xac')](_0x112b57);}})['then'](function(_0x46947d){if(_0x46947d){_0x48f70b=_0x46947d[_0xb038('0x4a')];if(!_0x18797a[_0xb038('0x45')][_0xb038('0x4b')]('nolimit')){_0x112b57['limit']=qs['limit'](_0x18797a[_0xb038('0x45')][_0xb038('0x30')]);_0x112b57[_0xb038('0x2f')]=qs[_0xb038('0x2f')](_0x18797a[_0xb038('0x45')][_0xb038('0x2f')]);}return _0x2de2a5['getAgents'](_0x112b57);}})[_0xb038('0x20')](function(_0x48e14f){if(_0x48e14f){return _0x48e14f?{'count':_0x48f70b,'rows':_0x48e14f}:null;}})[_0xb038('0x20')](respondWithResult(_0x29403e,null))['catch'](handleError(_0x29403e,null));};exports[_0xb038('0x3b')]=function(_0x387ee5,_0x5ae389,_0x15d479){var _0x1a782e,_0x39e5ef,_0x37a25d;if(_[_0xb038('0xad')](_0x387ee5[_0xb038('0x5b')][_0xb038('0x5b')])||_0x387ee5[_0xb038('0x5b')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb038('0xad')](_0x387ee5['body']['to'])){}_0x1a782e=_0x387ee5[_0xb038('0x5b')]['to'];return db['OpenchannelAccount'][_0xb038('0x6e')]({'where':{'id':_0x387ee5[_0xb038('0x58')]['id']}})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x1cf562){if(_0x1cf562){return db['OpenchannelAccount']['find']({'where':{'id':_0x1cf562['id']},'include':[{'model':db[_0xb038('0xae')],'as':_0xb038('0x83'),'include':[{'model':db[_0xb038('0x84')],'as':'Contacts','where':{[_0x1cf562[_0xb038('0x7d')]]:_0x1a782e},'limit':0x1,'order':[[_0xb038('0x76'),'DESC']]}]}]})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x53db21){if(_0x53db21&&_0x53db21[_0xb038('0x83')]){_0x39e5ef=_0x53db21[_0xb038('0x37')]({'plain':!![]});if(_0x39e5ef[_0xb038('0x83')]&&_0x39e5ef[_0xb038('0x83')][_0xb038('0x7e')]['length']){return _0x39e5ef[_0xb038('0x83')][_0xb038('0x7e')][0x0];}return db['CmContact'][_0xb038('0x5a')](_['defaults'](_0x387ee5['body'],{'firstName':_0x1a782e,[_0x53db21[_0xb038('0x7d')]]:_0x1a782e,'phone':_0x1a782e,'ListId':_0x39e5ef[_0xb038('0x78')]}));}})[_0xb038('0x20')](handleEntityNotFound(_0x5ae389,null))[_0xb038('0x20')](function(_0x2b6e67){if(_0x2b6e67){_0x37a25d=_0x2b6e67;return db[_0xb038('0x89')][_0xb038('0x59')]({'where':{'ContactId':_0x37a25d['id'],'closed':![],'OpenchannelAccountId':_0x39e5ef['id']}})[_0xb038('0x20')](function(_0x1c5659){if(_0x1c5659){return[_0x1c5659,![]];}return db[_0xb038('0x89')][_0xb038('0x5a')]({'UserId':_0x387ee5[_0xb038('0x5c')]['id'],'ContactId':_0x37a25d['id'],'OpenchannelAccountId':_0x39e5ef['id'],'lastMsgDirection':_0xb038('0xaf'),'Messages':[_[_0xb038('0x50')](_0x387ee5[_0xb038('0x5b')],{'read':![],'body':_0x387ee5['body']['body'],'OpenchannelAccountId':_0x39e5ef['id'],'UserId':_0x387ee5['user']['id'],'ContactId':_0x37a25d['id']})]},{'include':[{'model':db[_0xb038('0x94')],'as':_0xb038('0xb0')}]})[_0xb038('0x20')](function(_0x42faf6){return[_0x42faf6,!![]];});});}})[_0xb038('0x8c')](function(_0x4045aa,_0xed0386){if(_0xed0386){return _0x4045aa;}return db[_0xb038('0x94')][_0xb038('0x5a')](_[_0xb038('0x50')](_0x387ee5['body'],{'read':![],'body':_0x387ee5[_0xb038('0x5b')][_0xb038('0x5b')],'OpenchannelAccountId':_0x39e5ef['id'],'OpenchannelInteractionId':_0x4045aa['id'],'UserId':_0x387ee5[_0xb038('0x5c')]['id'],'ContactId':_0x37a25d['id']}))[_0xb038('0x20')](function(_0x503679){_0x4045aa[_0xb038('0xb1')][_0xb038('0xb0')]=[];_0x4045aa['dataValues'][_0xb038('0xb0')][_0xb038('0x90')](_0x503679[_0xb038('0xb1')]);return _0x4045aa;});});}})['then'](respondWithResult(_0x5ae389,null))['catch'](handleError(_0x5ae389,null));}; \ No newline at end of file +var _0x46ed=['../../config/environment','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','order','sort','filters','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','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','List','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','Contacts','defaults','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','ListId','out','Messages','spread','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x46ed,0x168));var _0xd46e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46ed[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];config['redis']=_['defaults'](config[_0xd46e('0x1a')],{'host':_0xd46e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd46e('0x1c'))[_0xd46e('0x1d')](socket);var jayson=require(_0xd46e('0x1e'));var client=jayson[_0xd46e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xd46e('0x1f')][_0xd46e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x417402,_0x3d72ce,_0x36a317,_0x47fa8f){return new BPromise(function(_0x1d50a5,_0x305ff1){var _0x3583a5=_0x47fa8f||client;return _0x3583a5['request'](_0x417402,_0x36a317)['then'](function(_0x2e8f6d){logger[_0xd46e('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d72ce,'request\x20sent');logger[_0xd46e('0x22')](_0xd46e('0x23'),_0x3d72ce,_0xd46e('0x24'),JSON[_0xd46e('0x25')](_0x2e8f6d));if(_0x2e8f6d[_0xd46e('0x26')]){if(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x27')]===0x1f4){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x305ff1(_0x2e8f6d['error'][_0xd46e('0x29')]);}logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x1d50a5(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);}else{logger[_0xd46e('0x21')](_0xd46e('0x28'),_0x3d72ce,'request\x20sent');_0x1d50a5(_0x2e8f6d[_0xd46e('0x2a')]['message']);}})['catch'](function(_0x371054){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x371054);_0x305ff1(_0x371054);});});}function respondWithStatusCode(_0x42afc7,_0x247b9f){_0x247b9f=_0x247b9f||0xcc;return function(_0x180851){if(_0x180851){return _0x42afc7[_0xd46e('0x2b')](_0x247b9f);}return _0x42afc7['status'](_0x247b9f)[_0xd46e('0x2c')]();};}function respondWithResult(_0x3c301a,_0xddbce9){_0xddbce9=_0xddbce9||0xc8;return function(_0x17db79){if(_0x17db79){return _0x3c301a[_0xd46e('0x2d')](_0xddbce9)[_0xd46e('0x2e')](_0x17db79);}};}function respondWithFilteredResult(_0x58aeef,_0x465d54){return function(_0x3a1ced){if(_0x3a1ced){var _0x2d1afe=_0x3a1ced[_0xd46e('0x2f')],_0xa716ce=_0x465d54[_0xd46e('0x30')],_0x106edc=_0x465d54[_0xd46e('0x30')]+_0x465d54[_0xd46e('0x31')],_0x423ea3;if(_0x106edc>=_0x2d1afe){_0x106edc=_0x2d1afe;_0x423ea3=0xc8;}else{_0x423ea3=0xce;}_0x58aeef[_0xd46e('0x2d')](_0x423ea3);return _0x58aeef[_0xd46e('0x32')](_0xd46e('0x33'),_0xa716ce+'-'+_0x106edc+'/'+_0x2d1afe)['json'](_0x3a1ced);}return null;};}function patchUpdates(_0x1248ce){return function(_0x1fc7f0){try{jsonpatch[_0xd46e('0x34')](_0x1fc7f0,_0x1248ce,!![]);}catch(_0x3f01a7){return BPromise['reject'](_0x3f01a7);}return _0x1fc7f0[_0xd46e('0x35')]();};}function saveUpdates(_0x3e2eca,_0x5ab9df){return function(_0x4e7246){if(_0x4e7246){return _0x4e7246[_0xd46e('0x36')](_0x3e2eca)['then'](function(_0x306458){return _0x306458;});}return null;};}function removeEntity(_0x1c15c9,_0x1016e2){return function(_0x4b5e50){if(_0x4b5e50){return _0x4b5e50['destroy']()[_0xd46e('0x37')](function(){var _0x19e116=_0x4b5e50[_0xd46e('0x38')]({'plain':!![]});var _0x1072d6=_0xd46e('0x39');return db[_0xd46e('0x3a')][_0xd46e('0x3b')]({'where':{'type':_0x1072d6,'resourceId':_0x19e116['id']}})[_0xd46e('0x37')](function(){return _0x4b5e50;});})['then'](function(){_0x1c15c9[_0xd46e('0x2d')](0xcc)[_0xd46e('0x2c')]();});}};}function handleEntityNotFound(_0x15e35c,_0x83aec1){return function(_0x1fa66c){if(!_0x1fa66c){_0x15e35c[_0xd46e('0x2b')](0x194);}return _0x1fa66c;};}function handleError(_0x42ddde,_0x5158e6){_0x5158e6=_0x5158e6||0x1f4;return function(_0x163dd0){logger[_0xd46e('0x26')](_0x163dd0['stack']);if(_0x163dd0[_0xd46e('0x3c')]){delete _0x163dd0[_0xd46e('0x3c')];}_0x42ddde[_0xd46e('0x2d')](_0x5158e6)[_0xd46e('0x3d')](_0x163dd0);};}exports['index']=function(_0x3ab607,_0x3ecf34){var _0x217fab={'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')}]},_0x42dbaf={},_0xefe5f4={'count':0x0,'rows':[]};var _0x411318=_['map'](db[_0xd46e('0x40')][_0xd46e('0x41')],function(_0xc83ea1){return{'name':_0xc83ea1[_0xd46e('0x42')],'type':_0xc83ea1[_0xd46e('0x43')]['key']};});_0x42dbaf[_0xd46e('0x44')]=_['map'](_0x411318,'name');_0x42dbaf['query']=_['keys'](_0x3ab607[_0xd46e('0x45')]);_0x42dbaf['filters']=_[_0xd46e('0x46')](_0x42dbaf[_0xd46e('0x44')],_0x42dbaf['query']);_0x217fab[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0x42dbaf[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x48')]));_0x217fab[_0xd46e('0x47')]=_0x217fab[_0xd46e('0x47')][_0xd46e('0x49')]?_0x217fab[_0xd46e('0x47')]:_0x42dbaf[_0xd46e('0x44')];if(!_0x3ab607['query']['hasOwnProperty']('nolimit')){_0x217fab[_0xd46e('0x31')]=qs['limit'](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x31')]);_0x217fab[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x217fab[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x3ab607['query'][_0xd46e('0x4b')]);_0x217fab['where']=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x3ab607[_0xd46e('0x45')],_0x42dbaf[_0xd46e('0x4c')]),_0x411318);if(_0x3ab607[_0xd46e('0x45')]['filter']){_0x217fab[_0xd46e('0x4e')]=_[_0xd46e('0x4f')](_0x217fab[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x411318,function(_0x2f1278){if(_0x2f1278['type']!==_0xd46e('0x51')){var _0x369001={};_0x369001[_0x2f1278[_0xd46e('0x3c')]]={'$like':'%'+_0x3ab607[_0xd46e('0x45')][_0xd46e('0x52')]+'%'};return _0x369001;}})});}_0x217fab=_['merge']({},_0x217fab,_0x3ab607[_0xd46e('0x53')]);var _0x3ea9e6={'where':_0x217fab[_0xd46e('0x4e')]};return db[_0xd46e('0x40')][_0xd46e('0x2f')](_0x3ea9e6)[_0xd46e('0x37')](function(_0x433204){_0xefe5f4[_0xd46e('0x2f')]=_0x433204;if(_0x3ab607['query'][_0xd46e('0x54')]){_0x217fab[_0xd46e('0x55')]=[{'all':!![]}];}return db[_0xd46e('0x40')][_0xd46e('0x56')](_0x217fab);})[_0xd46e('0x37')](function(_0x4e84c8){_0xefe5f4['rows']=_0x4e84c8;return _0xefe5f4;})[_0xd46e('0x37')](respondWithFilteredResult(_0x3ecf34,_0x217fab))[_0xd46e('0x57')](handleError(_0x3ecf34,null));};exports[_0xd46e('0x58')]=function(_0x5ca18b,_0x479711){var _0x2ab5d8={'raw':![],'where':{'id':_0x5ca18b['params']['id']},'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')}]},_0x9d8638={};_0x9d8638[_0xd46e('0x44')]=_[_0xd46e('0x59')](db[_0xd46e('0x40')][_0xd46e('0x41')]);_0x9d8638[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x5ca18b['query']);_0x9d8638[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x9d8638[_0xd46e('0x44')],_0x9d8638[_0xd46e('0x45')]);_0x2ab5d8['attributes']=_['intersection'](_0x9d8638[_0xd46e('0x44')],qs['fields'](_0x5ca18b[_0xd46e('0x45')][_0xd46e('0x48')]));_0x2ab5d8[_0xd46e('0x47')]=_0x2ab5d8[_0xd46e('0x47')][_0xd46e('0x49')]?_0x2ab5d8[_0xd46e('0x47')]:_0x9d8638['model'];if(_0x5ca18b[_0xd46e('0x45')][_0xd46e('0x54')]){_0x2ab5d8[_0xd46e('0x55')]=[{'all':!![]}];}_0x2ab5d8=_['merge']({},_0x2ab5d8,_0x5ca18b[_0xd46e('0x53')]);return db[_0xd46e('0x40')][_0xd46e('0x5a')](_0x2ab5d8)[_0xd46e('0x37')](handleEntityNotFound(_0x479711,null))[_0xd46e('0x37')](respondWithResult(_0x479711,null))[_0xd46e('0x57')](handleError(_0x479711,null));};exports[_0xd46e('0x5b')]=function(_0x381256,_0x3508f4){return db[_0xd46e('0x40')][_0xd46e('0x5b')](_0x381256[_0xd46e('0x5c')],{})[_0xd46e('0x37')](function(_0x402df2){var _0x47a86c=_0x381256[_0xd46e('0x5d')][_0xd46e('0x38')]({'plain':!![]});if(!_0x47a86c)throw new Error(_0xd46e('0x5e'));if(_0x47a86c[_0xd46e('0x5f')]==='user'){var _0x636f15=_0x402df2[_0xd46e('0x38')]({'plain':!![]});var _0xaf9641=_0xd46e('0x39');return db['UserProfileSection'][_0xd46e('0x5a')]({'where':{'name':_0xaf9641,'userProfileId':_0x47a86c[_0xd46e('0x60')]},'raw':!![]})['then'](function(_0x5a5832){if(_0x5a5832&&_0x5a5832[_0xd46e('0x61')]===0x0){return db[_0xd46e('0x3a')][_0xd46e('0x5b')]({'name':_0x636f15['name'],'resourceId':_0x636f15['id'],'type':_0x5a5832['name'],'sectionId':_0x5a5832['id']},{})[_0xd46e('0x37')](function(){return _0x402df2;});}else{return _0x402df2;}})[_0xd46e('0x57')](function(_0x1f310d){logger[_0xd46e('0x26')](_0xd46e('0x62'),_0x1f310d);throw _0x1f310d;});}return _0x402df2;})[_0xd46e('0x37')](respondWithResult(_0x3508f4,0xc9))[_0xd46e('0x57')](handleError(_0x3508f4,null));};exports[_0xd46e('0x36')]=function(_0x27bdfd,_0x2a172c){if(_0x27bdfd[_0xd46e('0x5c')]['id']){delete _0x27bdfd[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x27bdfd[_0xd46e('0x63')]['id']},'include':[{'model':db[_0xd46e('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xd46e('0x37')](handleEntityNotFound(_0x2a172c,null))[_0xd46e('0x37')](saveUpdates(_0x27bdfd[_0xd46e('0x5c')],null))['then'](respondWithResult(_0x2a172c,null))[_0xd46e('0x57')](handleError(_0x2a172c,null));};exports[_0xd46e('0x3b')]=function(_0x4dec29,_0x37ce99){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x4dec29['params']['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x37ce99,null))[_0xd46e('0x37')](removeEntity(_0x37ce99,null))[_0xd46e('0x57')](handleError(_0x37ce99,null));};exports['describe']=function(_0xe5f8cd,_0x516e7d){return db[_0xd46e('0x40')][_0xd46e('0x64')]()[_0xd46e('0x37')](respondWithResult(_0x516e7d,null))['catch'](handleError(_0x516e7d,null));};exports[_0xd46e('0x65')]=function(_0x3edadc,_0x27a3eb,_0xbce76f){if(_0x3edadc[_0xd46e('0x5c')]['id']){delete _0x3edadc[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x3edadc[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x27a3eb,null))[_0xd46e('0x37')](function(_0x1f5323){if(_0x1f5323){_0x3edadc[_0xd46e('0x5c')][_0xd46e('0x66')]=_0x1f5323['id'];return db['Disposition']['create'](_0x3edadc[_0xd46e('0x5c')]);}})[_0xd46e('0x37')](respondWithResult(_0x27a3eb,null))[_0xd46e('0x57')](handleError(_0x27a3eb,null));};exports[_0xd46e('0x67')]=function(_0x249938,_0x4e368a,_0x1ed069){var _0x9ea442={'raw':![],'where':{}};var _0xfb4073={};var _0x7fa262={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd46e('0x68')]({'where':{'id':_0x249938[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x4e368a,null))[_0xd46e('0x37')](function(_0x3e0df4){if(_0x3e0df4){_0xfb4073['model']=_[_0xd46e('0x59')](db[_0xd46e('0x69')]['rawAttributes']);_0xfb4073[_0xd46e('0x45')]=_['keys'](_0x249938[_0xd46e('0x45')]);_0xfb4073[_0xd46e('0x4c')]=_['intersection'](_0xfb4073['model'],_0xfb4073[_0xd46e('0x45')]);_0x9ea442[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0xfb4073[_0xd46e('0x44')],qs['fields'](_0x249938[_0xd46e('0x45')][_0xd46e('0x48')]));_0x9ea442['attributes']=_0x9ea442[_0xd46e('0x47')][_0xd46e('0x49')]?_0x9ea442[_0xd46e('0x47')]:_0xfb4073[_0xd46e('0x44')];if(!_0x249938[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x9ea442[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x249938['query'][_0xd46e('0x31')]);_0x9ea442[_0xd46e('0x30')]=qs['offset'](_0x249938[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x9ea442[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x249938[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x9ea442['where']=qs['filters'](_[_0xd46e('0x4d')](_0x249938[_0xd46e('0x45')],_0xfb4073['filters']));_0x9ea442['where']['OpenchannelAccountId']=_0x3e0df4['id'];if(_0x249938[_0xd46e('0x45')][_0xd46e('0x52')]){_0x9ea442[_0xd46e('0x4e')]=_['merge'](_0x9ea442[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x9ea442[_0xd46e('0x47')],function(_0x5186c9){var _0x4c60c0={};_0x4c60c0[_0x5186c9]={'$like':'%'+_0x249938['query']['filter']+'%'};return _0x4c60c0;})});}_0x9ea442=_[_0xd46e('0x4f')]({},_0x9ea442,_0x249938['options']);return db[_0xd46e('0x69')]['count']({'where':_0x9ea442['where']})[_0xd46e('0x37')](function(_0x4550a7){_0x7fa262[_0xd46e('0x2f')]=_0x4550a7;if(_0x249938[_0xd46e('0x45')][_0xd46e('0x54')]){_0x9ea442[_0xd46e('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x9ea442);})[_0xd46e('0x37')](function(_0x383919){_0x7fa262[_0xd46e('0x6c')]=_0x383919;return _0x7fa262;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x4e368a,_0x9ea442))['catch'](handleError(_0x4e368a,null));};exports[_0xd46e('0x6d')]=function(_0xeccb76,_0x4ca21f,_0x1309b5){return db['OpenchannelAccount'][_0xd46e('0x5a')]({'where':{'id':_0xeccb76[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x4ca21f,null))['then'](function(_0x1161f8){if(_0x1161f8){return _0x1161f8[_0xd46e('0x6d')](_0xeccb76[_0xd46e('0x45')]['ids']);}})[_0xd46e('0x37')](respondWithStatusCode(_0x4ca21f,null))[_0xd46e('0x57')](handleError(_0x4ca21f,null));};exports[_0xd46e('0x6e')]=function(_0x36edb9,_0x2da882,_0x88460a){if(_0x36edb9[_0xd46e('0x5c')]['id']){delete _0x36edb9[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x36edb9[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x2da882,null))[_0xd46e('0x37')](function(_0x1b2a6d){if(_0x1b2a6d){_0x36edb9[_0xd46e('0x5c')][_0xd46e('0x66')]=_0x1b2a6d['id'];return db[_0xd46e('0x6f')][_0xd46e('0x5b')](_0x36edb9['body']);}})[_0xd46e('0x37')](respondWithResult(_0x2da882,null))['catch'](handleError(_0x2da882,null));};exports[_0xd46e('0x70')]=function(_0x22d712,_0x515ae1,_0x36fa80){var _0x21b837={'raw':![],'where':{}};var _0xf22c0c={};var _0x20730a={'count':0x0,'rows':[]};return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x22d712[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x515ae1,null))[_0xd46e('0x37')](function(_0x3fa34d){if(_0x3fa34d){_0xf22c0c[_0xd46e('0x44')]=_['keys'](db['CannedAnswer'][_0xd46e('0x41')]);_0xf22c0c[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x22d712[_0xd46e('0x45')]);_0xf22c0c[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0xf22c0c['model'],_0xf22c0c[_0xd46e('0x45')]);_0x21b837[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0xf22c0c[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x22d712[_0xd46e('0x45')]['fields']));_0x21b837[_0xd46e('0x47')]=_0x21b837[_0xd46e('0x47')]['length']?_0x21b837[_0xd46e('0x47')]:_0xf22c0c[_0xd46e('0x44')];if(!_0x22d712[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x21b837[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x22d712[_0xd46e('0x45')][_0xd46e('0x31')]);_0x21b837[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x22d712[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x21b837[_0xd46e('0x4a')]=qs['sort'](_0x22d712['query'][_0xd46e('0x4b')]);_0x21b837[_0xd46e('0x4e')]=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x22d712[_0xd46e('0x45')],_0xf22c0c[_0xd46e('0x4c')]));_0x21b837['where'][_0xd46e('0x66')]=_0x3fa34d['id'];if(_0x22d712[_0xd46e('0x45')][_0xd46e('0x52')]){_0x21b837[_0xd46e('0x4e')]=_['merge'](_0x21b837[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x21b837['attributes'],function(_0xdf967c){var _0x4b3371={};_0x4b3371[_0xdf967c]={'$like':'%'+_0x22d712['query'][_0xd46e('0x52')]+'%'};return _0x4b3371;})});}_0x21b837=_[_0xd46e('0x4f')]({},_0x21b837,_0x22d712[_0xd46e('0x53')]);return db[_0xd46e('0x6f')]['count']({'where':_0x21b837['where']})[_0xd46e('0x37')](function(_0x5e59b7){_0x20730a[_0xd46e('0x2f')]=_0x5e59b7;if(_0x22d712['query']['includeAll']){_0x21b837[_0xd46e('0x55')]=[{'all':!![]}];}return db[_0xd46e('0x6f')]['findAll'](_0x21b837);})['then'](function(_0xd15f89){_0x20730a[_0xd46e('0x6c')]=_0xd15f89;return _0x20730a;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x515ae1,_0x21b837))[_0xd46e('0x57')](handleError(_0x515ae1,null));};exports['removeAnswers']=function(_0x27faad,_0x2d9cc0,_0x57252b){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x27faad[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x2d9cc0,null))[_0xd46e('0x37')](function(_0x2c4a1d){if(_0x2c4a1d){return _0x2c4a1d['removeAnswers'](_0x27faad[_0xd46e('0x45')][_0xd46e('0x71')]);}})['then'](respondWithStatusCode(_0x2d9cc0,null))['catch'](handleError(_0x2d9cc0,null));};exports[_0xd46e('0x72')]=function(_0x1810fd,_0x5212d6,_0x5e637d){var _0x18c939={'body':_0x1810fd[_0xd46e('0x5c')],'channel':'openchannel'};var _0x38ce73=[];var _0x3f37e6=[];var _0x19e218={};var _0x3c9521=![];return db[_0xd46e('0x73')][_0xd46e('0x64')]()['then'](function(_0xb80fbf){if(!_0xb80fbf){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x76'));}_0x38ce73=_[_0xd46e('0x77')](_[_0xd46e('0x59')](_0xb80fbf),[_0xd46e('0x78'),_0xd46e('0x79')]);_0x3f37e6=_[_0xd46e('0x77')](_[_0xd46e('0x59')](_0xb80fbf),[_0xd46e('0x78'),'updatedAt',_0xd46e('0x7a'),'ListId']);if(_0x1810fd['body']['id']){delete _0x1810fd[_0xd46e('0x5c')]['id'];}if(_[_0xd46e('0x7b')](_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')])){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x7d'));}if(_[_0xd46e('0x7b')](_0x1810fd['body'][_0xd46e('0x5c')])||_0x1810fd['body'][_0xd46e('0x5c')]===''){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x7e'));}if(_[_0xd46e('0x7b')](_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7f')])){throw new db[(_0xd46e('0x74'))]['ValidationError'](_0xd46e('0x80')+_0x3f37e6);}if(!_[_0xd46e('0x81')](_0x3f37e6,_0x1810fd[_0xd46e('0x5c')]['mapKey'])){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x82')+_0x3f37e6);}_0x19e218[_0x1810fd['body'][_0xd46e('0x7f')]]=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')];})[_0xd46e('0x37')](function(){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x1810fd['params']['id']},'include':[{'model':db['CmList'],'as':_0xd46e('0x83'),'include':[{'model':db[_0xd46e('0x73')],'as':'Contacts','where':_0x19e218,'limit':0x1,'order':[[_0xd46e('0x79'),_0xd46e('0x84')]]}]},{'model':db[_0xd46e('0x85')],'as':_0xd46e('0x86')}]});})[_0xd46e('0x37')](handleEntityNotFound(_0x5212d6,null))[_0xd46e('0x37')](function(_0x4bb76b){if(_0x4bb76b&&_0x4bb76b['List']){_0x18c939[_0xd46e('0x87')]=_0x4bb76b;_0x18c939['applications']=_0x4bb76b[_0xd46e('0x86')];_0x18c939[_0xd46e('0x88')]=_0x4bb76b['List'];_0x18c939[_0xd46e('0x89')]=_[_0xd46e('0x8a')](_0x18c939[_0xd46e('0x89')],[_0xd46e('0x8b')],[_0xd46e('0x8c')]);if(_0x18c939['account'][_0xd46e('0x86')]){delete _0x18c939[_0xd46e('0x87')][_0xd46e('0x86')];}if(_0x18c939[_0xd46e('0x87')][_0xd46e('0x83')]&&_0x18c939[_0xd46e('0x87')][_0xd46e('0x83')][_0xd46e('0x8d')][_0xd46e('0x49')]){return _0x18c939[_0xd46e('0x87')][_0xd46e('0x83')][_0xd46e('0x8d')][0x0];}var _0x3b9664=_[_0xd46e('0x8e')](_0x1810fd['body'],{'firstName':_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')],'ListId':_0x4bb76b['ListId']});_0x3b9664[_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7f')]]=_0x1810fd[_0xd46e('0x5c')]['from'];return db[_0xd46e('0x73')][_0xd46e('0x5b')](_0x3b9664,{'fields':_0x38ce73,'raw':!![]});}})[_0xd46e('0x37')](handleEntityNotFound(_0x5212d6,null))[_0xd46e('0x37')](function(_0x5031cf){_0x18c939[_0xd46e('0x8f')]=_0x5031cf;if(_0x5031cf){var _0x16aaf9={'ContactId':_0x5031cf['id'],'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'from':(_0x5031cf['firstName']||'')+'\x20'+(_0x5031cf['lastName']||'')};var _0x30efe6={'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'closed':![]};if(_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x90')]){_0x30efe6[_0xd46e('0x90')]=_0x1810fd[_0xd46e('0x5c')]['threadId'];return db[_0xd46e('0x91')]['find']({'where':_0x30efe6})[_0xd46e('0x37')](function(_0x49c2ba){if(_0x49c2ba){return[_0x49c2ba,![]];}_0x16aaf9[_0xd46e('0x90')]=_0x1810fd['body']['threadId'];_0x16aaf9[_0xd46e('0x92')]=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x92')];return db[_0xd46e('0x91')][_0xd46e('0x5b')](_0x16aaf9)[_0xd46e('0x37')](function(_0x417068){return[_0x417068,!![]];});});}else{_0x30efe6['threadId']=null;}_0x30efe6[_0xd46e('0x93')]=_0x5031cf['id'];return db[_0xd46e('0x91')][_0xd46e('0x5a')]({'where':_0x30efe6})[_0xd46e('0x37')](function(_0x333f7c){if(_0x333f7c){return[_0x333f7c,![]];}return db['OpenchannelInteraction'][_0xd46e('0x5b')](_0x16aaf9)[_0xd46e('0x37')](function(_0x1d08bb){return[_0x1d08bb,!![]];});});}})['spread'](function(_0x187581,_0x8c6ed1){if(_0x187581){_0x3c9521=_0x8c6ed1;if(!_0x8c6ed1){var _0x5eed72={'from':(_0x18c939['contact']['firstName']||'')+'\x20'+(_0x18c939[_0xd46e('0x8f')][_0xd46e('0x94')]||'')};if(_0x1810fd['body'][_0xd46e('0x90')]&&_0x1810fd[_0xd46e('0x5c')]['messageId']&&_0x1810fd['body'][_0xd46e('0x90')]!=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x95')]){_0x5eed72[_0xd46e('0x90')]=_0x1810fd['body']['messageId'];}return _0x187581[_0xd46e('0x36')](_0x5eed72);}else{return _0x187581;}}})[_0xd46e('0x37')](function(_0x363f1d){_0x18c939[_0xd46e('0x96')]=_0x363f1d[_0xd46e('0x38')]({'plain':!![]});_0x18c939[_0xd46e('0x96')][_0xd46e('0x97')]=_0x3c9521;if(_0x18c939['interaction'][_0xd46e('0x97')]){if(_0x18c939[_0xd46e('0x87')]['autoclose']){_0x18c939[_0xd46e('0x89')][_0xd46e('0x98')]({'id':0x0,'priority':_0x18c939[_0xd46e('0x89')][_0xd46e('0x49')]+0x1,'app':_0xd46e('0x99'),'appdata':_0xd46e('0x9a'),'interval':_0xd46e('0x9b')});}}return db[_0xd46e('0x9c')]['create']({'body':_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x5c')],'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'OpenchannelInteractionId':_0x363f1d['id'],'direction':'in','ContactId':_0x18c939[_0xd46e('0x8f')]['id'],'AttachmentId':_0x1810fd[_0xd46e('0x5c')]['AttachmentId']});})[_0xd46e('0x37')](function(_0x40151d){_0x18c939[_0xd46e('0x29')]=_0x40151d;if(_0x18c939[_0xd46e('0x96')][_0xd46e('0x9d')]){return db[_0xd46e('0x9e')][_0xd46e('0x5a')]({'attributes':['id',_0xd46e('0x3c')],'where':{'id':_0x18c939[_0xd46e('0x96')]['UserId']}})[_0xd46e('0x37')](function(_0x1dbb04){if(_0x1dbb04){_0x18c939[_0xd46e('0x89')][_0xd46e('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1dbb04['name']+','+(_0x18c939[_0xd46e('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0xd46e('0x9b')});_0x18c939[_0xd46e('0xa0')]=![];}return respondWithRpcPromise(_0xd46e('0xa1'),_0xd46e('0xa2'),_0x18c939);});}return respondWithRpcPromise('Start',_0xd46e('0xa2'),_0x18c939);})[_0xd46e('0x37')](function(_0xa20e92){respondWithRpcPromise(_0xd46e('0xa3'),_0xd46e('0xa3'),{'event':_0xd46e('0x72'),'message':_0xa20e92},client9002);return _0xa20e92;})[_0xd46e('0x37')](respondWithResult(_0x5212d6,null))[_0xd46e('0x57')](handleError(_0x5212d6,null));};exports[_0xd46e('0xa4')]=function(_0x4e1665,_0x52106d,_0x595040){return db['OpenchannelAccount'][_0xd46e('0x68')]({'where':{'id':_0x4e1665[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x52106d,null))['then'](function(_0x341946){if(_0x341946){return db[_0xd46e('0xa5')][_0xd46e('0xa6')](function(_0x48f49d){return db['OpenchannelApplication'][_0xd46e('0x3b')]({'where':{'OpenchannelAccountId':_0x4e1665[_0xd46e('0x63')]['id']},'transaction':_0x48f49d})[_0xd46e('0x37')](function(_0x2fbfd7){var _0xf68c7f=_['map'](_0x4e1665[_0xd46e('0x5c')],function(_0x3d0915){_0x3d0915[_0xd46e('0x66')]=_0x4e1665[_0xd46e('0x63')]['id'];return _0x3d0915;});return db[_0xd46e('0x85')]['bulkCreate'](_0xf68c7f,{'transaction':_0x48f49d});});})[_0xd46e('0x37')](function(){return db[_0xd46e('0x85')][_0xd46e('0xa7')]({'where':{'OpenchannelAccountId':_0x4e1665[_0xd46e('0x63')]['id']},'order':'priority'});});}})[_0xd46e('0x37')](respondWithResult(_0x52106d,null))[_0xd46e('0x57')](handleError(_0x52106d,null));};exports[_0xd46e('0xa8')]=function(_0x813a81,_0x464169,_0xdd713c){var _0x1144ba={};var _0x2ab895={};var _0x25fa78;var _0x2410c5;return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x813a81[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x464169,null))['then'](function(_0x5ca720){if(_0x5ca720){_0x25fa78=_0x5ca720;_0x2ab895['model']=_[_0xd46e('0x59')](db['OpenchannelApplication'][_0xd46e('0x41')]);_0x2ab895[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x813a81[_0xd46e('0x45')]);_0x2ab895[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x2ab895[_0xd46e('0x44')],_0x2ab895[_0xd46e('0x45')]);_0x1144ba['attributes']=_[_0xd46e('0x46')](_0x2ab895[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x813a81['query']['fields']));_0x1144ba[_0xd46e('0x47')]=_0x1144ba[_0xd46e('0x47')][_0xd46e('0x49')]?_0x1144ba[_0xd46e('0x47')]:_0x2ab895[_0xd46e('0x44')];_0x1144ba[_0xd46e('0x4a')]=qs['sort'](_0x813a81[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x1144ba[_0xd46e('0x4e')]=qs['filters'](_[_0xd46e('0x4d')](_0x813a81[_0xd46e('0x45')],_0x2ab895['filters']));if(_0x813a81[_0xd46e('0x45')]['filter']){_0x1144ba[_0xd46e('0x4e')]=_[_0xd46e('0x4f')](_0x1144ba[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x1144ba[_0xd46e('0x47')],function(_0xed0763){var _0x53baf2={};_0x53baf2[_0xed0763]={'$like':'%'+_0x813a81['query']['filter']+'%'};return _0x53baf2;})});}_0x1144ba=_[_0xd46e('0x4f')]({},_0x1144ba,_0x813a81[_0xd46e('0x53')]);return _0x25fa78[_0xd46e('0xa8')](_0x1144ba);}})[_0xd46e('0x37')](function(_0x47c610){if(_0x47c610){_0x2410c5=_0x47c610[_0xd46e('0x49')];if(!_0x813a81[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x1144ba[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x813a81[_0xd46e('0x45')][_0xd46e('0x31')]);_0x1144ba[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x813a81['query'][_0xd46e('0x30')]);}return _0x25fa78[_0xd46e('0xa8')](_0x1144ba);}})[_0xd46e('0x37')](function(_0x5e653e){if(_0x5e653e){return _0x5e653e?{'count':_0x2410c5,'rows':_0x5e653e}:null;}})[_0xd46e('0x37')](respondWithResult(_0x464169,null))[_0xd46e('0x57')](handleError(_0x464169,null));};exports[_0xd46e('0xa9')]=function(_0x22046d,_0x399cb9,_0xb72e54){var _0x5ecc44={'raw':![],'where':{}};var _0x47d186={};var _0xeb90f6={'count':0x0,'rows':[]};return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x22046d[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x399cb9,null))[_0xd46e('0x37')](function(_0xe30f8e){if(_0xe30f8e){_0x47d186[_0xd46e('0x44')]=_[_0xd46e('0x59')](db[_0xd46e('0x91')][_0xd46e('0x41')]);_0x47d186[_0xd46e('0x45')]=_['keys'](_0x22046d['query']);_0x47d186['filters']=_[_0xd46e('0x46')](_0x47d186['model'],_0x47d186['query']);_0x5ecc44[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0x47d186['model'],qs[_0xd46e('0x48')](_0x22046d[_0xd46e('0x45')]['fields']));_0x5ecc44[_0xd46e('0x47')]=_0x5ecc44['attributes'][_0xd46e('0x49')]?_0x5ecc44[_0xd46e('0x47')]:_0x47d186[_0xd46e('0x44')];if(!_0x22046d['query'][_0xd46e('0x6a')]('nolimit')){_0x5ecc44[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x22046d[_0xd46e('0x45')][_0xd46e('0x31')]);_0x5ecc44[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x22046d[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x5ecc44['order']=qs['sort'](_0x22046d['query'][_0xd46e('0x4b')]);_0x5ecc44['where']=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x22046d[_0xd46e('0x45')],_0x47d186[_0xd46e('0x4c')]));_0x5ecc44[_0xd46e('0x4e')][_0xd46e('0x66')]=_0xe30f8e['id'];if(_0x22046d[_0xd46e('0x45')][_0xd46e('0x52')]){_0x5ecc44[_0xd46e('0x4e')]=_['merge'](_0x5ecc44[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x5ecc44[_0xd46e('0x47')],function(_0x29a2dd){var _0x1767c1={};_0x1767c1[_0x29a2dd]={'$like':'%'+_0x22046d[_0xd46e('0x45')][_0xd46e('0x52')]+'%'};return _0x1767c1;})});}_0x5ecc44=_['merge']({},_0x5ecc44,_0x22046d[_0xd46e('0x53')]);return db[_0xd46e('0x91')][_0xd46e('0x2f')]({'where':_0x5ecc44[_0xd46e('0x4e')]})[_0xd46e('0x37')](function(_0x3a0161){_0xeb90f6['count']=_0x3a0161;if(_0x22046d[_0xd46e('0x45')]['includeAll']){_0x5ecc44[_0xd46e('0x55')]=[{'model':db[_0xd46e('0x73')],'as':_0xd46e('0xaa'),'required':![]},{'model':db[_0xd46e('0x9e')],'as':_0xd46e('0xab'),'attributes':[_0xd46e('0x3c'),_0xd46e('0xac'),_0xd46e('0xad')],'required':![]},{'model':db[_0xd46e('0xae')],'as':_0xd46e('0xaf'),'attributes':['id',_0xd46e('0x3c'),_0xd46e('0xb0')],'where':_0x22046d[_0xd46e('0x45')]['tag']?{'id':_0x22046d['query'][_0xd46e('0xb1')]}:undefined,'required':_0x22046d['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xd46e('0x56')](_0x5ecc44);})[_0xd46e('0x37')](function(_0x208a22){_0xeb90f6[_0xd46e('0x6c')]=_0x208a22;return _0xeb90f6;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x399cb9,_0x5ecc44))[_0xd46e('0x57')](handleError(_0x399cb9,null));};exports[_0xd46e('0xb2')]=function(_0x3e81c4,_0x31333c,_0x8126f0){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x3e81c4['params']['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x31333c,null))[_0xd46e('0x37')](function(_0x5d5f72){if(_0x5d5f72){return _0x5d5f72['addAgents'](_0x3e81c4[_0xd46e('0x5c')]['ids'],_[_0xd46e('0xb3')](_0x3e81c4[_0xd46e('0x5c')],['ids','id'])||{})['spread'](function(_0x8215a1){for(var _0x5b8f22=0x0;_0x5b8f22<_0x3e81c4[_0xd46e('0x5c')]['ids'][_0xd46e('0x49')];_0x5b8f22+=0x1){socket[_0xd46e('0xb4')](_0xd46e('0xb5'),{'UserId':_0x3e81c4[_0xd46e('0x5c')][_0xd46e('0x71')][_0x5b8f22],'OpenchannelAccountId':_0x3e81c4[_0xd46e('0x63')]['id']});}return _0x8215a1;});}})[_0xd46e('0x37')](respondWithResult(_0x31333c,null))[_0xd46e('0x57')](handleError(_0x31333c,null));};exports[_0xd46e('0xb6')]=function(_0x195643,_0x404403,_0x456544){return db[_0xd46e('0x40')]['find']({'where':{'id':_0x195643[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x404403,null))[_0xd46e('0x37')](function(_0x3bad91){if(_0x3bad91){return _0x3bad91['removeAgents'](_0x195643[_0xd46e('0x45')][_0xd46e('0x71')])[_0xd46e('0x37')](function(){if(_[_0xd46e('0xb7')](_0x195643[_0xd46e('0x45')]['ids'])){for(var _0xab708c=0x0;_0xab708c<_0x195643[_0xd46e('0x45')][_0xd46e('0x71')][_0xd46e('0x49')];_0xab708c+=0x1){socket[_0xd46e('0xb4')](_0xd46e('0xb8'),{'UserId':Number(_0x195643[_0xd46e('0x45')][_0xd46e('0x71')][_0xab708c]),'OpenchannelAccountId':Number(_0x195643['params']['id'])});}}else{socket[_0xd46e('0xb4')](_0xd46e('0xb8'),{'UserId':Number(_0x195643[_0xd46e('0x45')][_0xd46e('0x71')]),'OpenchannelAccountId':Number(_0x195643[_0xd46e('0x63')]['id'])});}});}})[_0xd46e('0x37')](respondWithStatusCode(_0x404403,null))['catch'](handleError(_0x404403,null));};exports[_0xd46e('0xb9')]=function(_0x1de6b7,_0x19005e,_0x18bb82){var _0x567b21={};var _0x9c9f75={};var _0x10106b;var _0x1c7faa;return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x1de6b7[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x19005e,null))[_0xd46e('0x37')](function(_0x174514){if(_0x174514){_0x10106b=_0x174514;_0x9c9f75['model']=_[_0xd46e('0x59')](db[_0xd46e('0x9e')][_0xd46e('0x41')]);_0x9c9f75[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x1de6b7[_0xd46e('0x45')]);_0x9c9f75[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x9c9f75[_0xd46e('0x44')],_0x9c9f75[_0xd46e('0x45')]);_0x567b21['attributes']=_[_0xd46e('0x46')](_0x9c9f75[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x48')]));_0x567b21[_0xd46e('0x47')]=_0x567b21[_0xd46e('0x47')][_0xd46e('0x49')]?_0x567b21['attributes']:_0x9c9f75['model'];_0x567b21[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x567b21[_0xd46e('0x4e')]=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x1de6b7[_0xd46e('0x45')],_0x9c9f75[_0xd46e('0x4c')]));if(_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x52')]){_0x567b21['where']=_[_0xd46e('0x4f')](_0x567b21['where'],{'$or':_[_0xd46e('0x50')](_0x567b21[_0xd46e('0x47')],function(_0x1caa70){var _0x3f015f={};_0x3f015f[_0x1caa70]={'$like':'%'+_0x1de6b7['query'][_0xd46e('0x52')]+'%'};return _0x3f015f;})});}_0x567b21=_[_0xd46e('0x4f')]({},_0x567b21,_0x1de6b7[_0xd46e('0x53')]);return _0x10106b[_0xd46e('0xb9')](_0x567b21);}})[_0xd46e('0x37')](function(_0x1076b2){if(_0x1076b2){_0x1c7faa=_0x1076b2[_0xd46e('0x49')];if(!_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x567b21[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x1de6b7['query'][_0xd46e('0x31')]);_0x567b21[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x1de6b7['query'][_0xd46e('0x30')]);}return _0x10106b[_0xd46e('0xb9')](_0x567b21);}})[_0xd46e('0x37')](function(_0x3778df){if(_0x3778df){return _0x3778df?{'count':_0x1c7faa,'rows':_0x3778df}:null;}})[_0xd46e('0x37')](respondWithResult(_0x19005e,null))['catch'](handleError(_0x19005e,null));};exports['send']=function(_0x2587ff,_0x320747,_0x7c7b62){var _0x59b38b,_0x1c681b,_0x3d37f4;if(_[_0xd46e('0x7b')](_0x2587ff[_0xd46e('0x5c')]['body'])||_0x2587ff[_0xd46e('0x5c')]['body']===''){throw new db['Sequelize'][(_0xd46e('0x75'))](_0xd46e('0x7e'));}if(_['isNil'](_0x2587ff[_0xd46e('0x5c')]['to'])){}_0x59b38b=_0x2587ff[_0xd46e('0x5c')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2587ff['params']['id']}})['then'](handleEntityNotFound(_0x320747,null))[_0xd46e('0x37')](function(_0xf12bb){if(_0xf12bb){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0xf12bb['id']},'include':[{'model':db[_0xd46e('0xba')],'as':_0xd46e('0x83'),'include':[{'model':db['CmContact'],'as':_0xd46e('0x8d'),'where':{[_0xf12bb[_0xd46e('0x7f')]]:_0x59b38b},'limit':0x1,'order':[[_0xd46e('0x79'),_0xd46e('0x84')]]}]}]})[_0xd46e('0x37')](handleEntityNotFound(_0x320747,null))['then'](function(_0x1f74cf){if(_0x1f74cf&&_0x1f74cf[_0xd46e('0x83')]){_0x1c681b=_0x1f74cf[_0xd46e('0x38')]({'plain':!![]});if(_0x1c681b['List']&&_0x1c681b[_0xd46e('0x83')][_0xd46e('0x8d')][_0xd46e('0x49')]){return _0x1c681b[_0xd46e('0x83')]['Contacts'][0x0];}return db[_0xd46e('0x73')][_0xd46e('0x5b')](_['defaults'](_0x2587ff[_0xd46e('0x5c')],{'firstName':_0x59b38b,[_0x1f74cf[_0xd46e('0x7f')]]:_0x59b38b,'phone':_0x59b38b,'ListId':_0x1c681b[_0xd46e('0xbb')]}));}})[_0xd46e('0x37')](handleEntityNotFound(_0x320747,null))[_0xd46e('0x37')](function(_0x459a76){if(_0x459a76){_0x3d37f4=_0x459a76;return db[_0xd46e('0x91')][_0xd46e('0x5a')]({'where':{'ContactId':_0x3d37f4['id'],'closed':![],'OpenchannelAccountId':_0x1c681b['id']}})[_0xd46e('0x37')](function(_0x14cf23){if(_0x14cf23){return[_0x14cf23,![]];}return db[_0xd46e('0x91')][_0xd46e('0x5b')]({'UserId':_0x2587ff[_0xd46e('0x5d')]['id'],'ContactId':_0x3d37f4['id'],'OpenchannelAccountId':_0x1c681b['id'],'lastMsgDirection':_0xd46e('0xbc'),'Messages':[_['merge'](_0x2587ff[_0xd46e('0x5c')],{'read':![],'body':_0x2587ff[_0xd46e('0x5c')][_0xd46e('0x5c')],'OpenchannelAccountId':_0x1c681b['id'],'UserId':_0x2587ff[_0xd46e('0x5d')]['id'],'ContactId':_0x3d37f4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd46e('0xbd')}]})['then'](function(_0x3a0407){return[_0x3a0407,!![]];});});}})[_0xd46e('0xbe')](function(_0x127583,_0x50b8d4){if(_0x50b8d4){return _0x127583;}return db['OpenchannelMessage'][_0xd46e('0x5b')](_[_0xd46e('0x4f')](_0x2587ff[_0xd46e('0x5c')],{'read':![],'body':_0x2587ff['body']['body'],'OpenchannelAccountId':_0x1c681b['id'],'OpenchannelInteractionId':_0x127583['id'],'UserId':_0x2587ff['user']['id'],'ContactId':_0x3d37f4['id']}))['then'](function(_0x4ab8fd){_0x127583[_0xd46e('0xbf')][_0xd46e('0xbd')]=[];_0x127583[_0xd46e('0xbf')][_0xd46e('0xbd')][_0xd46e('0x98')](_0x4ab8fd[_0xd46e('0xbf')]);return _0x127583;});});}})[_0xd46e('0x37')](respondWithResult(_0x320747,null))[_0xd46e('0x57')](handleError(_0x320747,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e729af8..72529f6 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 _0xd807=['OpenchannelAccount','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x42766f,_0x4cd443){var _0x5268bc=function(_0x25c4a2){while(--_0x25c4a2){_0x42766f['push'](_0x42766f['shift']());}};_0x5268bc(++_0x4cd443);}(_0xd807,0x102));var _0x7d80=function(_0x4e5fab,_0x131bbe){_0x4e5fab=_0x4e5fab-0x0;var _0x43c714=_0xd807[_0x4e5fab];return _0x43c714;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7d80('0x0'))['db'][_0x7d80('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7d80('0x2')](0x0);var events={'afterCreate':_0x7d80('0x3'),'afterUpdate':_0x7d80('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a66a5){return function(_0x1e89b9,_0x344039,_0x210fcc){OpenchannelAccountEvents['emit'](_0x5a66a5+':'+_0x1e89b9['id'],_0x1e89b9);OpenchannelAccountEvents[_0x7d80('0x5')](_0x5a66a5,_0x1e89b9);_0x210fcc(null);};}for(var e in events){if(events[_0x7d80('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xf679=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save'];(function(_0x2729fd,_0x5ecee9){var _0x472934=function(_0x20785a){while(--_0x20785a){_0x2729fd['push'](_0x2729fd['shift']());}};_0x472934(++_0x5ecee9);}(_0xf679,0x1f0));var _0x9f67=function(_0x1978e9,_0x53c682){_0x1978e9=_0x1978e9-0x0;var _0x1cd319=_0xf679[_0x1978e9];return _0x1cd319;};'use strict';var EventEmitter=require(_0x9f67('0x0'));var OpenchannelAccount=require(_0x9f67('0x1'))['db'][_0x9f67('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f67('0x3'),'afterUpdate':_0x9f67('0x4'),'afterDestroy':_0x9f67('0x5')};function emitEvent(_0x312a10){return function(_0x13ebee,_0x54cdac,_0x418d5d){OpenchannelAccountEvents['emit'](_0x312a10+':'+_0x13ebee['id'],_0x13ebee);OpenchannelAccountEvents[_0x9f67('0x6')](_0x312a10,_0x13ebee);_0x418d5d(null);};}for(var e in events){if(events[_0x9f67('0x7')](e)){var event=events[e];OpenchannelAccount[_0x9f67('0x8')](e,emitEvent(event));}}module[_0x9f67('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1fbb198..fd4a2d6 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 _0xbab3=['api','moment','request-promise','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0xbab3,0x130));var _0x3bab=function(_0x40f4cc,_0x432f55){_0x40f4cc=_0x40f4cc-0x0;var _0x458315=_0xbab3[_0x40f4cc];return _0x458315;};'use strict';var _=require(_0x3bab('0x0'));var util=require('util');var logger=require(_0x3bab('0x1'))(_0x3bab('0x2'));var moment=require(_0x3bab('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3bab('0x5'));module['exports']=function(_0xb78bb2,_0x11a9e0){return _0xb78bb2[_0x3bab('0x6')](_0x3bab('0x7'),attributes,{'tableName':_0x3bab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f8e=['define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x27a4fe,_0x44b38e){var _0x4195c4=function(_0x4b0dc4){while(--_0x4b0dc4){_0x27a4fe['push'](_0x27a4fe['shift']());}};_0x4195c4(++_0x44b38e);}(_0x0f8e,0x92));var _0xe0f8=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x0f8e[_0x27bd2c];return _0x3784ea;};'use strict';var _=require('lodash');var util=require(_0xe0f8('0x0'));var logger=require(_0xe0f8('0x1'))('api');var moment=require(_0xe0f8('0x2'));var BPromise=require(_0xe0f8('0x3'));var rp=require(_0xe0f8('0x4'));var fs=require('fs');var path=require(_0xe0f8('0x5'));var rimraf=require(_0xe0f8('0x6'));var config=require(_0xe0f8('0x7'));var attributes=require(_0xe0f8('0x8'));module[_0xe0f8('0x9')]=function(_0x271c9f,_0x17337d){return _0x271c9f[_0xe0f8('0xa')](_0xe0f8('0xb'),attributes,{'tableName':_0xe0f8('0xc'),'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 d9c637c..e8973a1 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 _0x4102=['error','message','info','catch','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4102,0x122));var _0x2410=function(_0x58fad4,_0x489631){_0x58fad4=_0x58fad4-0x0;var _0x10db9c=_0x4102[_0x58fad4];return _0x10db9c;};'use strict';var _=require('lodash');var util=require(_0x2410('0x0'));var moment=require(_0x2410('0x1'));var BPromise=require('bluebird');var rs=require(_0x2410('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2410('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2410('0x4'));var config=require('../../config/environment');var jayson=require(_0x2410('0x5'));var client=jayson[_0x2410('0x6')][_0x2410('0x7')]({'port':0x232a});config['redis']=_[_0x2410('0x8')](config[_0x2410('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2410('0x9')]));require(_0x2410('0xa'))[_0x2410('0xb')](socket);function respondWithRpcPromise(_0x214739,_0x598c1b,_0x576bc4){return new BPromise(function(_0x43ae80,_0x1bb151){return client[_0x2410('0xc')](_0x214739,_0x576bc4)[_0x2410('0xd')](function(_0x4bd107){logger['info'](_0x2410('0xe'),_0x598c1b,_0x2410('0xf'));logger[_0x2410('0x10')](_0x2410('0x11'),_0x598c1b,_0x2410('0xf'),JSON['stringify'](_0x4bd107));if(_0x4bd107['error']){if(_0x4bd107[_0x2410('0x12')]['code']===0x1f4){logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);return _0x1bb151(_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);}logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x4bd107['error'][_0x2410('0x13')]);return _0x43ae80(_0x4bd107[_0x2410('0x12')][_0x2410('0x13')]);}else{logger[_0x2410('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x598c1b,_0x2410('0xf'));_0x43ae80(_0x4bd107['result']['message']);}})[_0x2410('0x15')](function(_0x3bf3b1){logger[_0x2410('0x12')](_0x2410('0xe'),_0x598c1b,_0x3bf3b1);_0x1bb151(_0x3bf3b1);});});} \ No newline at end of file +var _0x7786=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x7786,0xd1));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var moment=require(_0x6778('0x2'));var BPromise=require('bluebird');var rs=require(_0x6778('0x3'));var fs=require('fs');var Redis=require(_0x6778('0x4'));var db=require(_0x6778('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6778('0x6'));var config=require('../../config/environment');var jayson=require(_0x6778('0x7'));var client=jayson[_0x6778('0x8')][_0x6778('0x9')]({'port':0x232a});config[_0x6778('0xa')]=_[_0x6778('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6778('0xa')]));require(_0x6778('0xc'))['register'](socket);function respondWithRpcPromise(_0x147212,_0x5ade39,_0x27879a){return new BPromise(function(_0x4daed2,_0x42b577){return client['request'](_0x147212,_0x27879a)[_0x6778('0xd')](function(_0x1b5d55){logger[_0x6778('0xe')](_0x6778('0xf'),_0x5ade39,_0x6778('0x10'));logger[_0x6778('0x11')](_0x6778('0x12'),_0x5ade39,_0x6778('0x10'),JSON[_0x6778('0x13')](_0x1b5d55));if(_0x1b5d55[_0x6778('0x14')]){if(_0x1b5d55[_0x6778('0x14')]['code']===0x1f4){logger[_0x6778('0x14')](_0x6778('0xf'),_0x5ade39,_0x1b5d55['error'][_0x6778('0x15')]);return _0x42b577(_0x1b5d55[_0x6778('0x14')][_0x6778('0x15')]);}logger[_0x6778('0x14')](_0x6778('0xf'),_0x5ade39,_0x1b5d55[_0x6778('0x14')]['message']);return _0x4daed2(_0x1b5d55[_0x6778('0x14')][_0x6778('0x15')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5ade39,_0x6778('0x10'));_0x4daed2(_0x1b5d55['result']['message']);}})[_0x6778('0x16')](function(_0x103ab5){logger[_0x6778('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ade39,_0x103ab5);_0x42b577(_0x103ab5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0623870..bdc20c6 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 _0x2a50=['update','removeListener','register','length','openchannelAccount:','remove'];(function(_0x2d3f1d,_0x2a0715){var _0x19b6fc=function(_0x58bec8){while(--_0x58bec8){_0x2d3f1d['push'](_0x2d3f1d['shift']());}};_0x19b6fc(++_0x2a0715);}(_0x2a50,0x1df));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x02a5('0x0'),_0x02a5('0x1')];function createListener(_0x5b5bad,_0x5560dc){return function(_0x180f32){_0x5560dc['emit'](_0x5b5bad,_0x180f32);};}function removeListener(_0x9b33fd,_0x10341c){return function(){OpenchannelAccountEvents[_0x02a5('0x2')](_0x9b33fd,_0x10341c);};}exports[_0x02a5('0x3')]=function(_0x39b750){for(var _0x157388=0x0,_0x2625fb=events[_0x02a5('0x4')];_0x157388<_0x2625fb;_0x157388++){var _0xc5ebf2=events[_0x157388];var _0x5b772e=createListener(_0x02a5('0x5')+_0xc5ebf2,_0x39b750);OpenchannelAccountEvents['on'](_0xc5ebf2,_0x5b772e);}}; \ No newline at end of file +var _0x9a3e=['removeListener','register','openchannelAccount:','save','emit'];(function(_0x58cd66,_0x8f3958){var _0x389e53=function(_0xfa6603){while(--_0xfa6603){_0x58cd66['push'](_0x58cd66['shift']());}};_0x389e53(++_0x8f3958);}(_0x9a3e,0x148));var _0xe9a3=function(_0x2c792c,_0x2c968a){_0x2c792c=_0x2c792c-0x0;var _0x4ab7b1=_0x9a3e[_0x2c792c];return _0x4ab7b1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe9a3('0x0'),'remove','update'];function createListener(_0x16e734,_0x9e1d24){return function(_0x46ad44){_0x9e1d24[_0xe9a3('0x1')](_0x16e734,_0x46ad44);};}function removeListener(_0x18af43,_0x52a612){return function(){OpenchannelAccountEvents[_0xe9a3('0x2')](_0x18af43,_0x52a612);};}exports[_0xe9a3('0x3')]=function(_0x1195f5){for(var _0x197994=0x0,_0x2c66a9=events['length'];_0x197994<_0x2c66a9;_0x197994++){var _0x42cc3d=events[_0x197994];var _0x37a1b0=createListener(_0xe9a3('0x4')+_0x42cc3d,_0x1195f5);OpenchannelAccountEvents['on'](_0x42cc3d,_0x37a1b0);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ac4020a..a4b7eaa 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 _0x85c2=['delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x251530,_0x1211a4){var _0x4b0683=function(_0x4ef876){while(--_0x4ef876){_0x251530['push'](_0x251530['shift']());}};_0x4b0683(++_0x1211a4);}(_0x85c2,0x17c));var _0x285c=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x85c2[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0x285c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x285c('0x1'));var express=require(_0x285c('0x2'));var router=express[_0x285c('0x3')]();var auth=require(_0x285c('0x4'));var interaction=require(_0x285c('0x5'));var config=require(_0x285c('0x6'));var controller=require(_0x285c('0x7'));router['get']('/',auth[_0x285c('0x8')](),controller[_0x285c('0x9')]);router[_0x285c('0xa')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller['show']);router[_0x285c('0xc')]('/',auth[_0x285c('0x8')](),controller[_0x285c('0xd')]);router[_0x285c('0xe')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller[_0x285c('0xf')]);router[_0x285c('0x10')](_0x285c('0xb'),auth[_0x285c('0x8')](),controller[_0x285c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7ab1=['multer','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x27cb48,_0x1b896f){var _0x323cee=function(_0x2e8a91){while(--_0x2e8a91){_0x27cb48['push'](_0x27cb48['shift']());}};_0x323cee(++_0x1b896f);}(_0x7ab1,0x1e0));var _0x17ab=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x7ab1[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0x17ab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ab('0x1'));var router=express[_0x17ab('0x2')]();var auth=require(_0x17ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ab('0x4'));var controller=require(_0x17ab('0x5'));router[_0x17ab('0x6')]('/',auth[_0x17ab('0x7')](),controller[_0x17ab('0x8')]);router[_0x17ab('0x6')](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xa')]);router[_0x17ab('0xb')]('/',auth[_0x17ab('0x7')](),controller[_0x17ab('0xc')]);router['put'](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xd')]);router[_0x17ab('0xe')](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2e0d330..a474d07 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 _0x9077=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x9077,0x1cf));var _0x7907=function(_0x4bf9aa,_0xafa1ec){_0x4bf9aa=_0x4bf9aa-0x0;var _0x1db38a=_0x9077[_0x4bf9aa];return _0x1db38a;};'use strict';var Sequelize=require(_0x7907('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7907('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7907('0x2')],'allowNull':![],'defaultValue':_0x7907('0x3')},'appdata':{'type':Sequelize[_0x7907('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7907('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xff8d=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x2f63c6,_0x30b981){var _0x3c0769=function(_0x20994c){while(--_0x20994c){_0x2f63c6['push'](_0x2f63c6['shift']());}};_0x3c0769(++_0x30b981);}(_0xff8d,0x7d));var _0xdff8=function(_0x695267,_0x4cba23){_0x695267=_0x695267-0x0;var _0x2e4ef2=_0xff8d[_0x695267];return _0x2e4ef2;};'use strict';var Sequelize=require('sequelize');module[_0xdff8('0x0')]={'priority':{'type':Sequelize[_0xdff8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdff8('0x2')]()},'description':{'type':Sequelize[_0xdff8('0x3')]},'interval':{'type':Sequelize[_0xdff8('0x3')],'defaultValue':_0xdff8('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b39c3fb..eecc4ca 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 _0xaaeb=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','offset','sort','where','merge','findAll','rows','catch','params','includeAll','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelApplication'];(function(_0x177fe0,_0x2036da){var _0x78f8fa=function(_0xd8658f){while(--_0xd8658f){_0x177fe0['push'](_0x177fe0['shift']());}};_0x78f8fa(++_0x2036da);}(_0xaaeb,0xa9));var _0xbaae=function(_0x4dedd3,_0x175841){_0x4dedd3=_0x4dedd3-0x0;var _0x48f768=_0xaaeb[_0x4dedd3];return _0x48f768;};'use strict';var pdf=require(_0xbaae('0x0'));var emlformat=require(_0xbaae('0x1'));var rimraf=require(_0xbaae('0x2'));var zipdir=require(_0xbaae('0x3'));var jsonpatch=require(_0xbaae('0x4'));var rp=require(_0xbaae('0x5'));var moment=require(_0xbaae('0x6'));var BPromise=require(_0xbaae('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbaae('0x8'));var csv=require(_0xbaae('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbaae('0xa'));var squel=require(_0xbaae('0xb'));var crypto=require('crypto');var jsforce=require(_0xbaae('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbaae('0x9'));var querystring=require(_0xbaae('0xd'));var Papa=require(_0xbaae('0xe'));var Redis=require(_0xbaae('0xf'));var authService=require(_0xbaae('0x10'));var qs=require(_0xbaae('0x11'));var as=require(_0xbaae('0x12'));var hardwareService=require(_0xbaae('0x13'));var logger=require(_0xbaae('0x14'))('api');var utils=require(_0xbaae('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbaae('0x16'));var db=require(_0xbaae('0x17'))['db'];function respondWithStatusCode(_0x30a7d8,_0x2f4cc2){_0x2f4cc2=_0x2f4cc2||0xcc;return function(_0x15a83b){if(_0x15a83b){return _0x30a7d8['sendStatus'](_0x2f4cc2);}return _0x30a7d8[_0xbaae('0x18')](_0x2f4cc2)[_0xbaae('0x19')]();};}function respondWithResult(_0x55260a,_0x45fbc2){_0x45fbc2=_0x45fbc2||0xc8;return function(_0x161f14){if(_0x161f14){return _0x55260a[_0xbaae('0x18')](_0x45fbc2)['json'](_0x161f14);}};}function respondWithFilteredResult(_0x1b17bf,_0xd1bbae){return function(_0x1c8261){if(_0x1c8261){var _0x1e7699=_0x1c8261[_0xbaae('0x1a')],_0x52e0b1=_0xd1bbae['offset'],_0x44d486=_0xd1bbae['offset']+_0xd1bbae[_0xbaae('0x1b')],_0x2ccb6e;if(_0x44d486>=_0x1e7699){_0x44d486=_0x1e7699;_0x2ccb6e=0xc8;}else{_0x2ccb6e=0xce;}_0x1b17bf[_0xbaae('0x18')](_0x2ccb6e);return _0x1b17bf[_0xbaae('0x1c')](_0xbaae('0x1d'),_0x52e0b1+'-'+_0x44d486+'/'+_0x1e7699)[_0xbaae('0x1e')](_0x1c8261);}return null;};}function patchUpdates(_0xfe7718){return function(_0x579623){try{jsonpatch[_0xbaae('0x1f')](_0x579623,_0xfe7718,!![]);}catch(_0x4511e6){return BPromise[_0xbaae('0x20')](_0x4511e6);}return _0x579623[_0xbaae('0x21')]();};}function saveUpdates(_0x4a3d42,_0x353110){return function(_0x5c72f3){if(_0x5c72f3){return _0x5c72f3[_0xbaae('0x22')](_0x4a3d42)[_0xbaae('0x23')](function(_0x5828f2){return _0x5828f2;});}return null;};}function removeEntity(_0x2b6c91,_0x27be60){return function(_0x233797){if(_0x233797){return _0x233797[_0xbaae('0x24')]()[_0xbaae('0x23')](function(){_0x2b6c91[_0xbaae('0x18')](0xcc)[_0xbaae('0x19')]();});}};}function handleEntityNotFound(_0x1be6d8,_0x4cea96){return function(_0x27dec1){if(!_0x27dec1){_0x1be6d8[_0xbaae('0x25')](0x194);}return _0x27dec1;};}function handleError(_0x1fd905,_0x48b8e5){_0x48b8e5=_0x48b8e5||0x1f4;return function(_0x522ad1){logger['error'](_0x522ad1[_0xbaae('0x26')]);if(_0x522ad1[_0xbaae('0x27')]){delete _0x522ad1['name'];}_0x1fd905['status'](_0x48b8e5)[_0xbaae('0x28')](_0x522ad1);};}exports[_0xbaae('0x29')]=function(_0xc6dc79,_0x565796){var _0x2341dc={},_0x7bb2e={},_0x39cab3={'count':0x0,'rows':[]};var _0x37b4f1=_[_0xbaae('0x2a')](db[_0xbaae('0x2b')][_0xbaae('0x2c')],function(_0x4f51bf){return{'name':_0x4f51bf[_0xbaae('0x2d')],'type':_0x4f51bf[_0xbaae('0x2e')][_0xbaae('0x2f')]};});_0x7bb2e['model']=_[_0xbaae('0x2a')](_0x37b4f1,'name');_0x7bb2e[_0xbaae('0x30')]=_[_0xbaae('0x31')](_0xc6dc79[_0xbaae('0x30')]);_0x7bb2e[_0xbaae('0x32')]=_[_0xbaae('0x33')](_0x7bb2e['model'],_0x7bb2e['query']);_0x2341dc[_0xbaae('0x34')]=_[_0xbaae('0x33')](_0x7bb2e[_0xbaae('0x35')],qs[_0xbaae('0x36')](_0xc6dc79['query'][_0xbaae('0x36')]));_0x2341dc[_0xbaae('0x34')]=_0x2341dc['attributes'][_0xbaae('0x37')]?_0x2341dc[_0xbaae('0x34')]:_0x7bb2e[_0xbaae('0x35')];if(!_0xc6dc79['query']['hasOwnProperty'](_0xbaae('0x38'))){_0x2341dc[_0xbaae('0x1b')]=qs[_0xbaae('0x1b')](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x1b')]);_0x2341dc[_0xbaae('0x39')]=qs[_0xbaae('0x39')](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x39')]);}_0x2341dc['order']=qs['sort'](_0xc6dc79[_0xbaae('0x30')][_0xbaae('0x3a')]);_0x2341dc[_0xbaae('0x3b')]=qs[_0xbaae('0x32')](_['pick'](_0xc6dc79[_0xbaae('0x30')],_0x7bb2e[_0xbaae('0x32')]),_0x37b4f1);if(_0xc6dc79[_0xbaae('0x30')]['filter']){_0x2341dc[_0xbaae('0x3b')]=_[_0xbaae('0x3c')](_0x2341dc[_0xbaae('0x3b')],{'$or':_['map'](_0x37b4f1,function(_0x477b8c){if(_0x477b8c[_0xbaae('0x2e')]!=='VIRTUAL'){var _0x2ddfbf={};_0x2ddfbf[_0x477b8c[_0xbaae('0x27')]]={'$like':'%'+_0xc6dc79[_0xbaae('0x30')]['filter']+'%'};return _0x2ddfbf;}})});}_0x2341dc=_['merge']({},_0x2341dc,_0xc6dc79['options']);var _0x54bdb1={'where':_0x2341dc[_0xbaae('0x3b')]};return db[_0xbaae('0x2b')]['count'](_0x54bdb1)[_0xbaae('0x23')](function(_0x1397c4){_0x39cab3[_0xbaae('0x1a')]=_0x1397c4;if(_0xc6dc79['query']['includeAll']){_0x2341dc['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xbaae('0x3d')](_0x2341dc);})[_0xbaae('0x23')](function(_0x191010){_0x39cab3[_0xbaae('0x3e')]=_0x191010;return _0x39cab3;})[_0xbaae('0x23')](respondWithFilteredResult(_0x565796,_0x2341dc))[_0xbaae('0x3f')](handleError(_0x565796,null));};exports['show']=function(_0x86c82b,_0x35992a){var _0x289264={'raw':!![],'where':{'id':_0x86c82b[_0xbaae('0x40')]['id']}},_0xb10619={};_0xb10619[_0xbaae('0x35')]=_[_0xbaae('0x31')](db[_0xbaae('0x2b')][_0xbaae('0x2c')]);_0xb10619[_0xbaae('0x30')]=_['keys'](_0x86c82b[_0xbaae('0x30')]);_0xb10619[_0xbaae('0x32')]=_[_0xbaae('0x33')](_0xb10619[_0xbaae('0x35')],_0xb10619['query']);_0x289264['attributes']=_[_0xbaae('0x33')](_0xb10619[_0xbaae('0x35')],qs[_0xbaae('0x36')](_0x86c82b[_0xbaae('0x30')][_0xbaae('0x36')]));_0x289264[_0xbaae('0x34')]=_0x289264[_0xbaae('0x34')][_0xbaae('0x37')]?_0x289264[_0xbaae('0x34')]:_0xb10619[_0xbaae('0x35')];if(_0x86c82b['query'][_0xbaae('0x41')]){_0x289264[_0xbaae('0x42')]=[{'all':!![]}];}_0x289264=_[_0xbaae('0x3c')]({},_0x289264,_0x86c82b[_0xbaae('0x43')]);return db[_0xbaae('0x2b')][_0xbaae('0x44')](_0x289264)[_0xbaae('0x23')](handleEntityNotFound(_0x35992a,null))[_0xbaae('0x23')](respondWithResult(_0x35992a,null))[_0xbaae('0x3f')](handleError(_0x35992a,null));};exports[_0xbaae('0x45')]=function(_0x240a2f,_0x59d545){return db['OpenchannelApplication'][_0xbaae('0x45')](_0x240a2f[_0xbaae('0x46')],{})[_0xbaae('0x23')](respondWithResult(_0x59d545,0xc9))['catch'](handleError(_0x59d545,null));};exports[_0xbaae('0x22')]=function(_0x59d1aa,_0x160369){if(_0x59d1aa[_0xbaae('0x46')]['id']){delete _0x59d1aa['body']['id'];}return db[_0xbaae('0x2b')][_0xbaae('0x44')]({'where':{'id':_0x59d1aa['params']['id']}})[_0xbaae('0x23')](handleEntityNotFound(_0x160369,null))[_0xbaae('0x23')](saveUpdates(_0x59d1aa[_0xbaae('0x46')],null))[_0xbaae('0x23')](respondWithResult(_0x160369,null))['catch'](handleError(_0x160369,null));};exports[_0xbaae('0x24')]=function(_0x52c63f,_0x12106e){return db['OpenchannelApplication']['find']({'where':{'id':_0x52c63f[_0xbaae('0x40')]['id']}})[_0xbaae('0x23')](handleEntityNotFound(_0x12106e,null))[_0xbaae('0x23')](removeEntity(_0x12106e,null))[_0xbaae('0x3f')](handleError(_0x12106e,null));}; \ No newline at end of file +var _0xe8f6=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','OpenchannelApplication','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js'];(function(_0x3a2591,_0x31449f){var _0x439c48=function(_0x3ea499){while(--_0x3ea499){_0x3a2591['push'](_0x3a2591['shift']());}};_0x439c48(++_0x31449f);}(_0xe8f6,0x160));var _0x6e8f=function(_0x5dcfc6,_0x4d4e4f){_0x5dcfc6=_0x5dcfc6-0x0;var _0x3bd788=_0xe8f6[_0x5dcfc6];return _0x3bd788;};'use strict';var pdf=require(_0x6e8f('0x0'));var emlformat=require(_0x6e8f('0x1'));var rimraf=require(_0x6e8f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e8f('0x3'));var moment=require(_0x6e8f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e8f('0x5'));var path=require(_0x6e8f('0x6'));var sox=require(_0x6e8f('0x7'));var csv=require('to-csv');var ejs=require(_0x6e8f('0x8'));var fs=require('fs');var _=require(_0x6e8f('0x9'));var squel=require(_0x6e8f('0xa'));var crypto=require(_0x6e8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6e8f('0xc'));var toCsv=require(_0x6e8f('0xd'));var querystring=require('querystring');var Papa=require(_0x6e8f('0xe'));var Redis=require(_0x6e8f('0xf'));var authService=require(_0x6e8f('0x10'));var qs=require(_0x6e8f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e8f('0x12'));var logger=require(_0x6e8f('0x13'))(_0x6e8f('0x14'));var utils=require('../../config/utils');var config=require(_0x6e8f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e8f('0x16'))['db'];function respondWithStatusCode(_0x27af47,_0x5dc2ee){_0x5dc2ee=_0x5dc2ee||0xcc;return function(_0x2da264){if(_0x2da264){return _0x27af47[_0x6e8f('0x17')](_0x5dc2ee);}return _0x27af47[_0x6e8f('0x18')](_0x5dc2ee)[_0x6e8f('0x19')]();};}function respondWithResult(_0x1c16d2,_0x1473ec){_0x1473ec=_0x1473ec||0xc8;return function(_0x53ea14){if(_0x53ea14){return _0x1c16d2['status'](_0x1473ec)[_0x6e8f('0x1a')](_0x53ea14);}};}function respondWithFilteredResult(_0x81e71a,_0x4b2f79){return function(_0x40234c){if(_0x40234c){var _0x541f14=_0x40234c[_0x6e8f('0x1b')],_0x399804=_0x4b2f79[_0x6e8f('0x1c')],_0x2506f4=_0x4b2f79[_0x6e8f('0x1c')]+_0x4b2f79[_0x6e8f('0x1d')],_0x3f32e1;if(_0x2506f4>=_0x541f14){_0x2506f4=_0x541f14;_0x3f32e1=0xc8;}else{_0x3f32e1=0xce;}_0x81e71a[_0x6e8f('0x18')](_0x3f32e1);return _0x81e71a[_0x6e8f('0x1e')](_0x6e8f('0x1f'),_0x399804+'-'+_0x2506f4+'/'+_0x541f14)[_0x6e8f('0x1a')](_0x40234c);}return null;};}function patchUpdates(_0x144cb5){return function(_0x2c6e7f){try{jsonpatch[_0x6e8f('0x20')](_0x2c6e7f,_0x144cb5,!![]);}catch(_0x3efab1){return BPromise[_0x6e8f('0x21')](_0x3efab1);}return _0x2c6e7f['save']();};}function saveUpdates(_0x565e89,_0x3afdf6){return function(_0x14c341){if(_0x14c341){return _0x14c341[_0x6e8f('0x22')](_0x565e89)['then'](function(_0x4d4318){return _0x4d4318;});}return null;};}function removeEntity(_0x2c94a4,_0x371701){return function(_0x8ed67e){if(_0x8ed67e){return _0x8ed67e[_0x6e8f('0x23')]()['then'](function(){_0x2c94a4[_0x6e8f('0x18')](0xcc)[_0x6e8f('0x19')]();});}};}function handleEntityNotFound(_0x522b0e,_0x7bc72d){return function(_0x320ec4){if(!_0x320ec4){_0x522b0e[_0x6e8f('0x17')](0x194);}return _0x320ec4;};}function handleError(_0x28abf3,_0x7d47f3){_0x7d47f3=_0x7d47f3||0x1f4;return function(_0x640100){logger['error'](_0x640100[_0x6e8f('0x24')]);if(_0x640100[_0x6e8f('0x25')]){delete _0x640100[_0x6e8f('0x25')];}_0x28abf3['status'](_0x7d47f3)[_0x6e8f('0x26')](_0x640100);};}exports[_0x6e8f('0x27')]=function(_0x4a01f6,_0x56ee04){var _0x22fff1={},_0x26fe8b={},_0x20a5f1={'count':0x0,'rows':[]};var _0x541e33=_['map'](db[_0x6e8f('0x28')][_0x6e8f('0x29')],function(_0x4ebff8){return{'name':_0x4ebff8['fieldName'],'type':_0x4ebff8[_0x6e8f('0x2a')][_0x6e8f('0x2b')]};});_0x26fe8b[_0x6e8f('0x2c')]=_[_0x6e8f('0x2d')](_0x541e33,_0x6e8f('0x25'));_0x26fe8b[_0x6e8f('0x2e')]=_[_0x6e8f('0x2f')](_0x4a01f6[_0x6e8f('0x2e')]);_0x26fe8b['filters']=_[_0x6e8f('0x30')](_0x26fe8b[_0x6e8f('0x2c')],_0x26fe8b[_0x6e8f('0x2e')]);_0x22fff1[_0x6e8f('0x31')]=_[_0x6e8f('0x30')](_0x26fe8b[_0x6e8f('0x2c')],qs[_0x6e8f('0x32')](_0x4a01f6[_0x6e8f('0x2e')]['fields']));_0x22fff1['attributes']=_0x22fff1['attributes']['length']?_0x22fff1[_0x6e8f('0x31')]:_0x26fe8b[_0x6e8f('0x2c')];if(!_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x33')]('nolimit')){_0x22fff1['limit']=qs[_0x6e8f('0x1d')](_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x1d')]);_0x22fff1[_0x6e8f('0x1c')]=qs[_0x6e8f('0x1c')](_0x4a01f6['query'][_0x6e8f('0x1c')]);}_0x22fff1[_0x6e8f('0x34')]=qs[_0x6e8f('0x35')](_0x4a01f6[_0x6e8f('0x2e')]['sort']);_0x22fff1['where']=qs[_0x6e8f('0x36')](_[_0x6e8f('0x37')](_0x4a01f6[_0x6e8f('0x2e')],_0x26fe8b[_0x6e8f('0x36')]),_0x541e33);if(_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x38')]){_0x22fff1[_0x6e8f('0x39')]=_[_0x6e8f('0x3a')](_0x22fff1[_0x6e8f('0x39')],{'$or':_['map'](_0x541e33,function(_0x2da0dd){if(_0x2da0dd[_0x6e8f('0x2a')]!==_0x6e8f('0x3b')){var _0x1d806d={};_0x1d806d[_0x2da0dd[_0x6e8f('0x25')]]={'$like':'%'+_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x38')]+'%'};return _0x1d806d;}})});}_0x22fff1=_[_0x6e8f('0x3a')]({},_0x22fff1,_0x4a01f6[_0x6e8f('0x3c')]);var _0x599227={'where':_0x22fff1['where']};return db[_0x6e8f('0x28')][_0x6e8f('0x1b')](_0x599227)[_0x6e8f('0x3d')](function(_0x2a2290){_0x20a5f1['count']=_0x2a2290;if(_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x3e')]){_0x22fff1['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6e8f('0x3f')](_0x22fff1);})[_0x6e8f('0x3d')](function(_0x1802c3){_0x20a5f1[_0x6e8f('0x40')]=_0x1802c3;return _0x20a5f1;})[_0x6e8f('0x3d')](respondWithFilteredResult(_0x56ee04,_0x22fff1))['catch'](handleError(_0x56ee04,null));};exports[_0x6e8f('0x41')]=function(_0x3e337b,_0x3fc164){var _0x2af59a={'raw':!![],'where':{'id':_0x3e337b[_0x6e8f('0x42')]['id']}},_0x426ff1={};_0x426ff1[_0x6e8f('0x2c')]=_['keys'](db[_0x6e8f('0x28')][_0x6e8f('0x29')]);_0x426ff1[_0x6e8f('0x2e')]=_[_0x6e8f('0x2f')](_0x3e337b[_0x6e8f('0x2e')]);_0x426ff1[_0x6e8f('0x36')]=_[_0x6e8f('0x30')](_0x426ff1[_0x6e8f('0x2c')],_0x426ff1[_0x6e8f('0x2e')]);_0x2af59a['attributes']=_[_0x6e8f('0x30')](_0x426ff1[_0x6e8f('0x2c')],qs['fields'](_0x3e337b[_0x6e8f('0x2e')][_0x6e8f('0x32')]));_0x2af59a['attributes']=_0x2af59a[_0x6e8f('0x31')][_0x6e8f('0x43')]?_0x2af59a['attributes']:_0x426ff1[_0x6e8f('0x2c')];if(_0x3e337b['query'][_0x6e8f('0x3e')]){_0x2af59a[_0x6e8f('0x44')]=[{'all':!![]}];}_0x2af59a=_[_0x6e8f('0x3a')]({},_0x2af59a,_0x3e337b[_0x6e8f('0x3c')]);return db[_0x6e8f('0x28')][_0x6e8f('0x45')](_0x2af59a)[_0x6e8f('0x3d')](handleEntityNotFound(_0x3fc164,null))[_0x6e8f('0x3d')](respondWithResult(_0x3fc164,null))[_0x6e8f('0x46')](handleError(_0x3fc164,null));};exports[_0x6e8f('0x47')]=function(_0x37ff9e,_0x665247){return db[_0x6e8f('0x28')][_0x6e8f('0x47')](_0x37ff9e[_0x6e8f('0x48')],{})['then'](respondWithResult(_0x665247,0xc9))[_0x6e8f('0x46')](handleError(_0x665247,null));};exports[_0x6e8f('0x22')]=function(_0x37c71d,_0xf2bd44){if(_0x37c71d[_0x6e8f('0x48')]['id']){delete _0x37c71d[_0x6e8f('0x48')]['id'];}return db[_0x6e8f('0x28')][_0x6e8f('0x45')]({'where':{'id':_0x37c71d[_0x6e8f('0x42')]['id']}})['then'](handleEntityNotFound(_0xf2bd44,null))[_0x6e8f('0x3d')](saveUpdates(_0x37c71d[_0x6e8f('0x48')],null))['then'](respondWithResult(_0xf2bd44,null))[_0x6e8f('0x46')](handleError(_0xf2bd44,null));};exports[_0x6e8f('0x23')]=function(_0x34d2a7,_0x4ea9bc){return db[_0x6e8f('0x28')][_0x6e8f('0x45')]({'where':{'id':_0x34d2a7[_0x6e8f('0x42')]['id']}})[_0x6e8f('0x3d')](handleEntityNotFound(_0x4ea9bc,null))[_0x6e8f('0x3d')](removeEntity(_0x4ea9bc,null))[_0x6e8f('0x46')](handleError(_0x4ea9bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ca1b625..6f266f7 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 _0x1e3d=['exports','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x89628a,_0x4db523){var _0x40f563=function(_0xfcdb3f){while(--_0xfcdb3f){_0x89628a['push'](_0x89628a['shift']());}};_0x40f563(++_0x4db523);}(_0x1e3d,0x120));var _0xd1e3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1e3d[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xd1e3('0x0'));var util=require(_0xd1e3('0x1'));var logger=require(_0xd1e3('0x2'))(_0xd1e3('0x3'));var moment=require(_0xd1e3('0x4'));var BPromise=require(_0xd1e3('0x5'));var rp=require(_0xd1e3('0x6'));var fs=require('fs');var path=require(_0xd1e3('0x7'));var rimraf=require('rimraf');var config=require(_0xd1e3('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xd1e3('0x9')]=function(_0x594766,_0x3a9a4e){return _0x594766['define']('OpenchannelApplication',attributes,{'tableName':_0xd1e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x422a=['rimraf','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x388412,_0x11b8bb){var _0xe25c45=function(_0x2a66d6){while(--_0x2a66d6){_0x388412['push'](_0x388412['shift']());}};_0xe25c45(++_0x11b8bb);}(_0x422a,0x131));var _0xa422=function(_0x2a06d5,_0x57f681){_0x2a06d5=_0x2a06d5-0x0;var _0x451fca=_0x422a[_0x2a06d5];return _0x451fca;};'use strict';var _=require(_0xa422('0x0'));var util=require(_0xa422('0x1'));var logger=require(_0xa422('0x2'))(_0xa422('0x3'));var moment=require('moment');var BPromise=require(_0xa422('0x4'));var rp=require(_0xa422('0x5'));var fs=require('fs');var path=require(_0xa422('0x6'));var rimraf=require(_0xa422('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xa422('0x8')]=function(_0x1ab4c9,_0x1bc58a){return _0x1ab4c9[_0xa422('0x9')](_0xa422('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa422('0xb'),'collate':_0xa422('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index fe90b10..72a90df 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(_0x21f659,_0x229f6e){var _0x310e2b=function(_0x41ebc5){while(--_0x41ebc5){_0x21f659['push'](_0x21f659['shift']());}};_0x310e2b(++_0x229f6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5f1d,_0x3359d8){_0x5a5f1d=_0x5a5f1d-0x0;var _0x597cf4=_0xb10b[_0x5a5f1d];return _0x597cf4;};'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(_0x163347,_0xf0f25a){var _0x28913c=function(_0x5f3763){while(--_0x5f3763){_0x163347['push'](_0x163347['shift']());}};_0x28913c(++_0xf0f25a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32ff1d,_0x3e29bb){_0x32ff1d=_0x32ff1d-0x0;var _0x50489e=_0xb10b[_0x32ff1d];return _0x50489e;};'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 15abc54..43e472b 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 _0x6a5b=['/:id/download','post','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages'];(function(_0x2411b0,_0x10949b){var _0x1980c4=function(_0x59026d){while(--_0x59026d){_0x2411b0['push'](_0x2411b0['shift']());}};_0x1980c4(++_0x10949b);}(_0x6a5b,0xc8));var _0xb6a5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6a5b[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xb6a5('0x0'));var path=require(_0xb6a5('0x1'));var timeout=require(_0xb6a5('0x2'));var express=require(_0xb6a5('0x3'));var router=express[_0xb6a5('0x4')]();var auth=require(_0xb6a5('0x5'));var interaction=require(_0xb6a5('0x6'));var config=require(_0xb6a5('0x7'));var controller=require(_0xb6a5('0x8'));router[_0xb6a5('0x9')]('/',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xb')]);router['get']('/describe',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xc')]);router[_0xb6a5('0x9')](_0xb6a5('0xd'),auth['isAuthenticated'](),controller[_0xb6a5('0xe')]);router[_0xb6a5('0x9')]('/:id/messages',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xf')]);router[_0xb6a5('0x9')](_0xb6a5('0x10'),auth[_0xb6a5('0xa')](),controller['download']);router[_0xb6a5('0x11')]('/',auth[_0xb6a5('0xa')](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xb6a5('0x11')]('/:id/tags',auth[_0xb6a5('0xa')](),interaction['tracked'](_0xb6a5('0x12'),_0xb6a5('0x13')),controller[_0xb6a5('0x14')]);router[_0xb6a5('0x15')]('/:id',auth[_0xb6a5('0xa')](),interaction[_0xb6a5('0x16')](_0xb6a5('0x12'),_0xb6a5('0x17')),controller[_0xb6a5('0x18')]);router[_0xb6a5('0x19')](_0xb6a5('0xd'),auth[_0xb6a5('0xa')](),interaction[_0xb6a5('0x16')](_0xb6a5('0x12'),'openchannelinteraction:destroy'),controller[_0xb6a5('0x1a')]);router['delete']('/:id/tags',auth[_0xb6a5('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x68e7=['util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','post','create','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x5ef1f0,_0x63038d){var _0x545554=function(_0x35cec9){while(--_0x35cec9){_0x5ef1f0['push'](_0x5ef1f0['shift']());}};_0x545554(++_0x63038d);}(_0x68e7,0x10d));var _0x768e=function(_0x2ec72b,_0x4bfe14){_0x2ec72b=_0x2ec72b-0x0;var _0x13e869=_0x68e7[_0x2ec72b];return _0x13e869;};'use strict';var multer=require(_0x768e('0x0'));var util=require(_0x768e('0x1'));var path=require(_0x768e('0x2'));var timeout=require('connect-timeout');var express=require(_0x768e('0x3'));var router=express[_0x768e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x768e('0x5'));var config=require(_0x768e('0x6'));var controller=require(_0x768e('0x7'));router[_0x768e('0x8')]('/',auth['isAuthenticated'](),controller[_0x768e('0x9')]);router[_0x768e('0x8')](_0x768e('0xa'),auth[_0x768e('0xb')](),controller['describe']);router[_0x768e('0x8')](_0x768e('0xc'),auth[_0x768e('0xb')](),controller['show']);router[_0x768e('0x8')]('/:id/messages',auth[_0x768e('0xb')](),controller[_0x768e('0xd')]);router[_0x768e('0x8')](_0x768e('0xe'),auth[_0x768e('0xb')](),controller['download']);router[_0x768e('0xf')]('/',auth['isAuthenticated'](),controller[_0x768e('0x10')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x768e('0xf')](_0x768e('0x11'),auth['isAuthenticated'](),interaction[_0x768e('0x12')]('openchannel',_0x768e('0x13')),controller[_0x768e('0x14')]);router[_0x768e('0x15')](_0x768e('0xc'),auth[_0x768e('0xb')](),interaction['tracked'](_0x768e('0x16'),_0x768e('0x17')),controller[_0x768e('0x18')]);router[_0x768e('0x19')](_0x768e('0xc'),auth[_0x768e('0xb')](),interaction['tracked'](_0x768e('0x16'),_0x768e('0x1a')),controller[_0x768e('0x1b')]);router[_0x768e('0x19')](_0x768e('0x11'),auth['isAuthenticated'](),controller[_0x768e('0x1c')]);module[_0x768e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d1f5ad5..43a441c 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 _0x8f83=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x8f83,0x6d));var _0x38f8=function(_0x4f5bd4,_0xbde35b){_0x4f5bd4=_0x4f5bd4-0x0;var _0x464848=_0x8f83[_0x4f5bd4];return _0x464848;};'use strict';var Sequelize=require(_0x38f8('0x0'));module[_0x38f8('0x1')]={'closed':{'type':Sequelize[_0x38f8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x38f8('0x3')]},'disposition':{'type':Sequelize[_0x38f8('0x4')]},'secondDisposition':{'type':Sequelize[_0x38f8('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x38f8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x38f8('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x38f8('0x5')]('in',_0x38f8('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x38f8('0x4')]}}; \ No newline at end of file +var _0x8da1=['STRING','out','BOOLEAN','DATE'];(function(_0x4b594f,_0x1f02cc){var _0x56738a=function(_0x27599f){while(--_0x27599f){_0x4b594f['push'](_0x4b594f['shift']());}};_0x56738a(++_0x1f02cc);}(_0x8da1,0x1a6));var _0x18da=function(_0x10eb11,_0x1c2aaa){_0x10eb11=_0x10eb11-0x0;var _0x1aad42=_0x8da1[_0x10eb11];return _0x1aad42;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x18da('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x18da('0x1')]},'disposition':{'type':Sequelize[_0x18da('0x2')]},'secondDisposition':{'type':Sequelize[_0x18da('0x2')]},'thirdDisposition':{'type':Sequelize[_0x18da('0x2')]},'note':{'type':Sequelize[_0x18da('0x2')]},'read1stAt':{'type':Sequelize[_0x18da('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x18da('0x2')]},'lastMsgAt':{'type':Sequelize[_0x18da('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x18da('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 95196ee..5bade17 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 _0x55f6=['UserId','body','some','compact','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.key','Account.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','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','Owner','N.A.','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','direction','renderFile','views','create','toFile','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','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','defaults','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','select','field','color','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0x55f6,0x17a));var _0x655f=function(_0x1a0d09,_0x228e8f){_0x1a0d09=_0x1a0d09-0x0;var _0x507f0a=_0x55f6[_0x1a0d09];return _0x507f0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x655f('0x0'));var rimraf=require(_0x655f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x655f('0x2'));var rp=require(_0x655f('0x3'));var moment=require(_0x655f('0x4'));var BPromise=require(_0x655f('0x5'));var Mustache=require(_0x655f('0x6'));var util=require(_0x655f('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x655f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x655f('0x9'));var crypto=require(_0x655f('0xa'));var jsforce=require(_0x655f('0xb'));var deskjs=require(_0x655f('0xc'));var toCsv=require(_0x655f('0xd'));var querystring=require(_0x655f('0xe'));var Papa=require(_0x655f('0xf'));var Redis=require(_0x655f('0x10'));var authService=require(_0x655f('0x11'));var qs=require(_0x655f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x655f('0x13'));var logger=require(_0x655f('0x14'))(_0x655f('0x15'));var utils=require(_0x655f('0x16'));var config=require(_0x655f('0x17'));var licenseUtil=require(_0x655f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x655f('0x19')](config[_0x655f('0x1a')],{'host':_0x655f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x655f('0x1a')]));require(_0x655f('0x1c'))[_0x655f('0x1d')](socket);function respondWithStatusCode(_0x203b64,_0x1c3492){_0x1c3492=_0x1c3492||0xcc;return function(_0x382cfe){if(_0x382cfe){return _0x203b64[_0x655f('0x1e')](_0x1c3492);}return _0x203b64[_0x655f('0x1f')](_0x1c3492)[_0x655f('0x20')]();};}function respondWithResult(_0x15d938,_0x6ce5d6){_0x6ce5d6=_0x6ce5d6||0xc8;return function(_0x4fdade){if(_0x4fdade){return _0x15d938[_0x655f('0x1f')](_0x6ce5d6)['json'](_0x4fdade);}};}function respondWithFilteredResult(_0xb7abf2,_0x4a9b23){return function(_0x2d0674){if(_0x2d0674){var _0x30927b=_0x2d0674[_0x655f('0x21')],_0x68be57=_0x4a9b23[_0x655f('0x22')],_0x4954a4=_0x4a9b23['offset']+_0x4a9b23[_0x655f('0x23')],_0x5552d7;if(_0x4954a4>=_0x30927b){_0x4954a4=_0x30927b;_0x5552d7=0xc8;}else{_0x5552d7=0xce;}_0xb7abf2['status'](_0x5552d7);return _0xb7abf2['set'](_0x655f('0x24'),_0x68be57+'-'+_0x4954a4+'/'+_0x30927b)[_0x655f('0x25')](_0x2d0674);}return null;};}function patchUpdates(_0x2c7768){return function(_0x193eb0){try{jsonpatch[_0x655f('0x26')](_0x193eb0,_0x2c7768,!![]);}catch(_0x47190b){return BPromise['reject'](_0x47190b);}return _0x193eb0['save']();};}function saveUpdates(_0x2eb59b,_0x32108e){return function(_0x2c4d06){if(_0x2c4d06){return _0x2c4d06[_0x655f('0x27')](_0x2eb59b)[_0x655f('0x28')](function(_0x3fc5cf){return _0x3fc5cf;});}return null;};}function removeEntity(_0xe5be77,_0x233a06){return function(_0x28b1cf){if(_0x28b1cf){return _0x28b1cf[_0x655f('0x29')]()[_0x655f('0x28')](function(){_0xe5be77[_0x655f('0x1f')](0xcc)[_0x655f('0x20')]();});}};}function handleEntityNotFound(_0x52a061,_0x1c3b76){return function(_0x43c3b7){if(!_0x43c3b7){_0x52a061[_0x655f('0x1e')](0x194);}return _0x43c3b7;};}function handleError(_0x5823cc,_0x41bdc8){_0x41bdc8=_0x41bdc8||0x1f4;return function(_0x4ef92d){logger[_0x655f('0x2a')](_0x4ef92d[_0x655f('0x2b')]);if(_0x4ef92d[_0x655f('0x2c')]){delete _0x4ef92d[_0x655f('0x2c')];}_0x5823cc[_0x655f('0x1f')](_0x41bdc8)[_0x655f('0x2d')](_0x4ef92d);};}function getInteractionUsers(_0x1c35f1,_0x1ed77c){return new BPromise(function(_0x4b3108,_0x3bc2be){try{if(_0x1ed77c[_0x1c35f1['id']]){_0x1c35f1[_0x655f('0x2e')]=_[_0x655f('0x2f')](_0x1ed77c[_0x1c35f1['id']],function(_0x21e803){return{'id':_0x21e803['id'],'fullname':_0x21e803[_0x655f('0x30')]};});}}catch(_0x4a0071){_0x3bc2be(_0x4a0071);}_0x4b3108(_0x1c35f1);});}function getInteractionTags(_0x5123a3,_0x2d24f3){return new BPromise(function(_0x1dbc8d,_0x106108){try{if(_0x5123a3['TagIds']){_0x5123a3[_0x655f('0x31')]=[];_0x5123a3[_0x655f('0x32')][_0x655f('0x33')](',')[_0x655f('0x34')](function(_0x4e84c0){_0x5123a3[_0x655f('0x31')]['push'](_0x2d24f3[_0x4e84c0]);});}delete _0x5123a3['TagIds'];}catch(_0x390e36){_0x106108(_0x390e36);}_0x1dbc8d(_0x5123a3);});}function updateOpenchannelInteraction(_0x316ecc,_0x2c3d57,_0xf03e51){return new BPromise(function(_0x3f9979,_0x30a861){return getInteractionUsers(_0x316ecc,_0xf03e51)[_0x655f('0x28')](function(_0x5304f4){return getInteractionTags(_0x5304f4,_0x2c3d57);})[_0x655f('0x28')](function(_0x14c917){_0x3f9979(_0x14c917);})[_0x655f('0x35')](function(_0x1b0848){_0x30a861(_0x1b0848);});});}exports['index']=function(_0x4fc22b,_0x57e97c){var _0x3f4c42={},_0x34b799={},_0x2ab879={'count':0x0,'rows':[]};var _0x374f47=_[_0x655f('0x2f')](db[_0x655f('0x36')][_0x655f('0x37')],function(_0xda0272){return{'name':_0xda0272[_0x655f('0x38')],'type':_0xda0272[_0x655f('0x39')][_0x655f('0x3a')]};});_0x34b799[_0x655f('0x3b')]=_['map'](_0x374f47,'name');_0x34b799[_0x655f('0x3c')]=_[_0x655f('0x3d')](_0x4fc22b[_0x655f('0x3c')]);_0x34b799[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x34b799[_0x655f('0x3b')],_0x34b799[_0x655f('0x3c')]);_0x3f4c42[_0x655f('0x40')]=_[_0x655f('0x3f')](_0x34b799[_0x655f('0x3b')],qs['fields'](_0x4fc22b[_0x655f('0x3c')]['fields']));_0x3f4c42[_0x655f('0x40')]=_0x3f4c42[_0x655f('0x40')][_0x655f('0x41')]?_0x3f4c42[_0x655f('0x40')]:_0x34b799['model'];if(!_0x4fc22b[_0x655f('0x3c')][_0x655f('0x42')](_0x655f('0x43'))){_0x3f4c42[_0x655f('0x23')]=qs[_0x655f('0x23')](_0x4fc22b[_0x655f('0x3c')]['limit']);_0x3f4c42[_0x655f('0x22')]=qs[_0x655f('0x22')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x22')]);}_0x3f4c42['order']=qs[_0x655f('0x44')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x44')]);_0x3f4c42['where']=qs[_0x655f('0x3e')](_['pick'](_0x4fc22b[_0x655f('0x3c')],_0x34b799['filters']),_0x374f47);var _0x573108=[];var _0x3b5b99=squel[_0x655f('0x45')]()[_0x655f('0x46')]('id')[_0x655f('0x46')](_0x655f('0x2c'))['field'](_0x655f('0x47'))[_0x655f('0x48')](_0x655f('0x49'));var _0x336766=squel[_0x655f('0x45')]()[_0x655f('0x46')]('u.id')[_0x655f('0x46')](_0x655f('0x4a'))[_0x655f('0x46')]('ui.OpenchannelInteractionId')[_0x655f('0x48')](_0x655f('0x4b'),'ui')[_0x655f('0x4c')](_0x655f('0x4d'),'u',_0x655f('0x4e'));var _0x14c175=squel[_0x655f('0x45')]()[_0x655f('0x48')](_0x655f('0x4f'),'i')[_0x655f('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x655f('0x4c')](_0x655f('0x4d'),'o',_0x655f('0x50'))[_0x655f('0x4c')](_0x655f('0x51'),'a',_0x655f('0x52'))['left_join'](_0x655f('0x53'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x655f('0x4c')](_0x655f('0x54'),'it',_0x655f('0x55'))[_0x655f('0x4c')](_0x655f('0x49'),'t','t.id\x20=\x20it.TagId');var _0x239fde=squel[_0x655f('0x56')]();var _0xd92e18=[];var _0x14ba62=squel[_0x655f('0x56')]();var _0x3aece5;if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x57')]){_0x3aece5=as[_0x655f('0x58')](_0x4fc22b[_0x655f('0x3c')][_0x655f('0x57')]);var _0x41d4f3=_0x3aece5['sqlOperator'];for(var _0x3e9f06=0x0;_0x3e9f06<_0x3aece5[_0x655f('0x59')][_0x655f('0x41')];_0x3e9f06++){var _0x421132=_0x3aece5['conditions'][_0x3e9f06];var _0x441eed='i';var _0xaabbbb=_[_0x655f('0x5a')](_0x374f47,[_0x655f('0x2c'),_0x421132['field']]);if(!_0xaabbbb){switch(_0x421132['field']){case _0x655f('0x5b'):if(_0x421132['value']==0x1){_0x14c175[_0x655f('0x5c')]('`'+_0x421132[_0x655f('0x46')]+_0x655f('0x5d'));}else{_0x14c175[_0x655f('0x5c')]('`'+_0x421132[_0x655f('0x46')]+_0x655f('0x5e'));}break;case _0x655f('0x5f'):if(_0x421132[_0x655f('0x60')]===_0x655f('0x61')){if(_0x421132[_0x655f('0x62')][_0x655f('0x33')]('\x20')['length']>0x1){_0x239fde[_0x41d4f3](_0x655f('0x63'),qs[_0x655f('0x64')](_0x421132[_0x655f('0x62')]),null);}else{var _0x32c23b='%'+_0x421132[_0x655f('0x62')]+'%';_0x239fde[_0x41d4f3](_0x655f('0x65'),_0x32c23b,_0x32c23b,_0x32c23b);}}else{_0xaabbbb=_[_0x655f('0x5a')](_0x374f47,['name',_0x655f('0x66')]);_0x421132['field']='ContactId';_0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7[_0x655f('0x68')],_0x1ee8d7['value'][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);}break;case _0x655f('0x6a'):var _0x39474a=_0x421132[_0x655f('0x62')][_0x655f('0x33')](',')['map'](function(_0x240257){return Number(_0x240257);});_0x39474a[_0x655f('0x34')](function(_0x3bcc9f){_0x14ba62['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3bcc9f+',%');});_0xd92e18=_[_0x655f('0x6b')](_0xd92e18,_0x39474a);break;case _0x655f('0x6c'):if(_0x421132[_0x655f('0x60')]===_0x655f('0x61')){_0x239fde[_0x41d4f3](_0x655f('0x6d'),'%'+_0x421132[_0x655f('0x62')]+'%',null);}else{_0xaabbbb=_[_0x655f('0x5a')](_0x374f47,[_0x655f('0x2c'),_0x655f('0x6e')]);_0x421132[_0x655f('0x46')]=_0x655f('0x6e');_0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7['text'],_0x1ee8d7[_0x655f('0x62')]['start'],_0x1ee8d7[_0x655f('0x62')]['end']);}break;case _0x655f('0x6f'):_0x1ee8d7=as['buildExpression']('me',null,_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7[_0x655f('0x68')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);break;}}else{var _0x1ee8d7=as[_0x655f('0x67')](_0x441eed,_0xaabbbb[_0x655f('0x39')],_0x421132);_0x239fde[_0x41d4f3](_0x1ee8d7['text'],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x69')],_0x1ee8d7[_0x655f('0x62')][_0x655f('0x20')]);}}}else{var _0x335630=_(_0x4fc22b[_0x655f('0x3c')])['keys']()['map'](function(_0x397381){return _[_0x655f('0x70')](_0x374f47,[_0x655f('0x2c'),_0x397381])?_0x397381:undefined;})[_0x655f('0x71')]()[_0x655f('0x62')]();if(!_['isEmpty'](_0x335630)){_0x335630[_0x655f('0x34')](function(_0x26b646){if(_0x26b646===_0x655f('0x72')){_0x14c175[_0x655f('0x73')](_0x655f('0x74'),[][_0x655f('0x75')](_0x4fc22b[_0x655f('0x3c')][_0x26b646]));}else if(_0x26b646===_0x655f('0x76')){var _0xd9c137=JSON[_0x655f('0x77')](_0x4fc22b['query'][_0x26b646])[_0x655f('0x78')];var _0x1c9b4f=JSON[_0x655f('0x77')](_0x4fc22b[_0x655f('0x3c')][_0x26b646])['$lte'];_0x14c175[_0x655f('0x73')](_0x655f('0x79'),_0xd9c137,_0x1c9b4f);}else{if(_0x4fc22b['query'][_0x26b646]===_0x655f('0x7a')){_0x14c175[_0x655f('0x73')]('i.'+_0x26b646+_0x655f('0x7b'));}else{_0x14c175[_0x655f('0x73')]('i.'+_0x26b646+_0x655f('0x7c'),_0x4fc22b['query'][_0x26b646]);}}});}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x7d')]){if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x7d')]==0x1){_0x14c175[_0x655f('0x5c')](_0x655f('0x7e'));}else{_0x14c175['having'](_0x655f('0x7f'));}}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x80')]){_0xd92e18=_[_0x655f('0x81')](_0x4fc22b[_0x655f('0x3c')]['tag'])?_0x4fc22b['query']['tag']:new Array(_0x4fc22b['query']['tag']);_0xd92e18[_0x655f('0x34')](function(_0x2eb465){_0x14ba62['or'](_0x655f('0x82'),'%,'+_0x2eb465+',%');});}if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x83')]){var _0x217a38=_0x4fc22b[_0x655f('0x3c')][_0x655f('0x83')][_0x655f('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x655f('0x85')](_0x217a38)){_0x239fde['or'](_0x655f('0x86'),_0x217a38+'%');}else{_0x239fde['or'](_0x655f('0x87'),qs[_0x655f('0x64')](_0x217a38))['or'](_0x655f('0x88'),_0x217a38+'%')['or'](_0x655f('0x89'),_0x217a38+'%');}}}_0x14c175['where'](_0x239fde);_0x14c175[_0x655f('0x8a')](_0x655f('0x8b'));var _0x4f7f10={'type':db[_0x655f('0x8c')][_0x655f('0x8d')]['SELECT'],'raw':!![]};var _0xcf1459=_0x14c175['clone']();_0xcf1459['field'](_0x655f('0x8b'));_0xcf1459['field'](_0x655f('0x8e'),_0x655f('0x5b'));if(_0x3f4c42[_0x655f('0x8f')]){_0x3f4c42[_0x655f('0x8f')][_0x655f('0x34')](function(_0x36ca31){var _0xb17ea2=_0x36ca31[0x0]===_0x655f('0x90')?_0x36ca31[0x0]:'i.'+_0x36ca31[0x0];_0x14c175[_0x655f('0x8f')](_0xb17ea2,_0x36ca31[0x1]===_0x655f('0x91')?![]:!![]);});}if(!_[_0x655f('0x92')](_0xd92e18)){_0x14c175['having'](_0x14ba62);_0xcf1459[_0x655f('0x73')](_0x655f('0x93'),_0xd92e18);}BPromise[_0x655f('0x94')]()['then'](function(){if(!_0x3aece5){if(_0x4fc22b[_0x655f('0x3c')]['OpenchannelAccountId']||_0x4fc22b[_0x655f('0x3c')][_0x655f('0x95')])return;_0xcf1459[_0x655f('0x73')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x14c175[_0x655f('0x73')](_0x655f('0x96'));return;}if(_0x4fc22b[_0x655f('0x97')][_0x655f('0x98')]!==_0x655f('0x99'))return;return _0x4fc22b[_0x655f('0x97')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x655f('0x28')](function(_0x40935c){if(_[_0x655f('0x92')](_0x40935c)){_0xcf1459[_0x655f('0x73')](_0x655f('0x9a'));_0x14c175[_0x655f('0x73')](_0x655f('0x9a'));}else{_0xcf1459[_0x655f('0x73')](_0x655f('0x74'),_[_0x655f('0x2f')](_0x40935c,'id'));_0x14c175[_0x655f('0x73')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x40935c,'id'));}});})['then'](function(){if(_0x4fc22b[_0x655f('0x97')][_0x655f('0x98')]==='agent'&&!_0x3aece5&&!_0x4fc22b['query'][_0x655f('0x72')])return[];return db[_0x655f('0x9b')][_0x655f('0x3c')](_0xcf1459[_0x655f('0x9c')](),_0x4f7f10);})[_0x655f('0x28')](function(_0x18ee03){_0x2ab879[_0x655f('0x21')]=_0x18ee03[_0x655f('0x41')];if(_0x2ab879[_0x655f('0x21')]===0x0)return[];return db[_0x655f('0x9b')][_0x655f('0x3c')](_0x3b5b99[_0x655f('0x9c')](),_0x4f7f10)['then'](function(_0x1f4937){_0x573108=_[_0x655f('0x9d')](_0x1f4937,'id');_0x4f7f10=_[_0x655f('0x9e')](_0x4f7f10,{'model':db[_0x655f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4fc22b[_0x655f('0x3c')][_0x655f('0x9f')]){_0x3f4c42[_0x655f('0x40')][_0x655f('0x34')](function(_0x3c03c9){_0x14c175[_0x655f('0x46')]('i.'+_0x3c03c9);});}else{_0x14c175[_0x655f('0x46')](_0x655f('0x8e'),'unreadMessages');_0x14c175[_0x655f('0x46')](_0x655f('0xa0'),_0x655f('0xa1'));_0x14c175[_0x655f('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x14c175[_0x655f('0x46')](_0x655f('0xa2'),'contactName');_0x14c175[_0x655f('0x46')](_0x655f('0xa3'));_0x14c175[_0x655f('0x46')](_0x655f('0xa4'),_0x655f('0xa5'));_0x14c175[_0x655f('0x46')](_0x655f('0xa6'),_0x655f('0xa7'));_0x14c175[_0x655f('0x46')](_0x655f('0xa8'),_0x655f('0xa9'));_0x14c175[_0x655f('0x46')](_0x655f('0xaa'),_0x655f('0xab'));_0x14c175['field'](_0x655f('0xac'),_0x655f('0xad'));_0x14c175['field'](_0x655f('0xae'),_0x655f('0xaf'));_0x14c175['field'](_0x655f('0xb0'),_0x655f('0xb1'));_0x14c175[_0x655f('0x46')](_0x655f('0xb2'),_0x655f('0xb3'));_0x14c175[_0x655f('0x46')](_0x655f('0xb4'),_0x655f('0x32'));}if(_0x3f4c42[_0x655f('0x23')])_0x14c175[_0x655f('0x23')](_0x3f4c42[_0x655f('0x23')]);if(_0x3f4c42[_0x655f('0x22')])_0x14c175['offset'](_0x3f4c42['offset']);return db[_0x655f('0x9b')][_0x655f('0x3c')](_0x14c175[_0x655f('0x9c')](),_0x4f7f10);})['then'](function(_0x2d2c1e){_0x336766[_0x655f('0x73')](_0x655f('0xb5'),_['map'](_0x2d2c1e,'id'));return db['sequelize'][_0x655f('0x3c')](_0x336766[_0x655f('0x9c')](),_0x4f7f10)[_0x655f('0x28')](function(_0x507b40){var _0x49c99b=_[_0x655f('0xb6')](_0x507b40,_0x655f('0xb7'));var _0x4151f0=[];_0x2d2c1e['forEach'](function(_0x41139f){_0x4151f0['push'](updateOpenchannelInteraction(_0x41139f,_0x573108,_0x49c99b));});return BPromise[_0x655f('0xb8')](_0x4151f0);});});})['then'](function(_0x43ec9f){_0x2ab879[_0x655f('0xb9')]=_0x43ec9f;return _0x2ab879;})[_0x655f('0x28')](respondWithFilteredResult(_0x57e97c,_0x3f4c42))[_0x655f('0x35')](handleError(_0x57e97c,null));};exports[_0x655f('0xba')]=function(_0x23623a,_0x58ecb8){var _0x112122={};if(_0x23623a['query'][_0x655f('0x39')]&&_0x23623a[_0x655f('0x3c')][_0x655f('0x39')]===_0x655f('0x48')){_0x112122[_0x655f('0x48')]=_0x23623a[_0x655f('0xbb')]['id'];}else{_0x112122['id']=_0x23623a[_0x655f('0xbb')]['id'];}var _0x1758b3={'raw':![],'where':_0x112122},_0x3a5110={};_0x3a5110['model']=_['keys'](db[_0x655f('0x36')]['rawAttributes']);_0x3a5110['query']=_['keys'](_0x23623a[_0x655f('0x3c')]);_0x3a5110[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x3a5110[_0x655f('0x3b')],_0x3a5110['query']);_0x1758b3[_0x655f('0x40')]=_['intersection'](_0x3a5110[_0x655f('0x3b')],qs[_0x655f('0x9f')](_0x23623a['query'][_0x655f('0x9f')]));_0x1758b3['attributes']=_0x1758b3[_0x655f('0x40')][_0x655f('0x41')]?_0x1758b3[_0x655f('0x40')]:_0x3a5110[_0x655f('0x3b')];if(_0x23623a[_0x655f('0x3c')][_0x655f('0xbc')]){_0x1758b3['include']=[{'all':!![]}];}_0x1758b3=_[_0x655f('0x9e')]({},_0x1758b3,_0x23623a['options']);return db[_0x655f('0x36')]['find'](_0x1758b3)['then'](handleEntityNotFound(_0x58ecb8,null))[_0x655f('0x28')](respondWithResult(_0x58ecb8,null))[_0x655f('0x35')](handleError(_0x58ecb8,null));};exports['create']=function(_0x12030d,_0x3a4b76){return db[_0x655f('0x36')]['create'](_0x12030d[_0x655f('0x6f')],{})[_0x655f('0x28')](respondWithResult(_0x3a4b76,0xc9))['catch'](handleError(_0x3a4b76,null));};exports['update']=function(_0xcf7453,_0x16a09f){if(_0xcf7453[_0x655f('0x6f')]['id']){delete _0xcf7453['body']['id'];}return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0xcf7453[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x16a09f,null))[_0x655f('0x28')](saveUpdates(_0xcf7453[_0x655f('0x6f')],null))[_0x655f('0x28')](respondWithResult(_0x16a09f,null))['catch'](handleError(_0x16a09f,null));};exports[_0x655f('0x29')]=function(_0x1a8527,_0x1d9fcb){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x1a8527[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x1d9fcb,null))[_0x655f('0x28')](removeEntity(_0x1d9fcb,null))['catch'](handleError(_0x1d9fcb,null));};exports['describe']=function(_0x4868ea,_0x51a92b){return db[_0x655f('0x36')][_0x655f('0xbd')]()[_0x655f('0x28')](respondWithResult(_0x51a92b,null))['catch'](handleError(_0x51a92b,null));};exports[_0x655f('0xbe')]=function(_0x157868,_0x6533fb,_0x18560d){return db[_0x655f('0xbf')][_0x655f('0x5a')]({'where':{'id':_0x157868[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x6533fb,null))[_0x655f('0x28')](function(_0x54d73c){if(_0x54d73c){return _0x54d73c[_0x655f('0xbe')](_0x157868[_0x655f('0x6f')][_0x655f('0xc0')],_[_0x655f('0xc1')](_0x157868[_0x655f('0x6f')],[_0x655f('0xc0'),'id'])||{});}})[_0x655f('0x28')](respondWithResult(_0x6533fb,null))['catch'](handleError(_0x6533fb,null));};exports[_0x655f('0xc2')]=function(_0x5db969,_0x384173,_0x42066a){var _0x122f51={'raw':![],'where':{}};var _0x146e31={};var _0x27fac7={'count':0x0,'rows':[]};return db[_0x655f('0x36')]['findOne']({'where':{'id':_0x5db969[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x384173,null))['then'](function(_0x23692c){if(_0x23692c){_0x146e31[_0x655f('0x3b')]=_[_0x655f('0x3d')](db['OpenchannelMessage'][_0x655f('0x37')]);_0x146e31[_0x655f('0x3c')]=_[_0x655f('0x3d')](_0x5db969[_0x655f('0x3c')]);_0x146e31[_0x655f('0x3e')]=_[_0x655f('0x3f')](_0x146e31['model'],_0x146e31[_0x655f('0x3c')]);_0x122f51[_0x655f('0x40')]=_[_0x655f('0x3f')](_0x146e31[_0x655f('0x3b')],qs[_0x655f('0x9f')](_0x5db969[_0x655f('0x3c')][_0x655f('0x9f')]));_0x122f51[_0x655f('0x40')]=_0x122f51[_0x655f('0x40')][_0x655f('0x41')]?_0x122f51[_0x655f('0x40')]:_0x146e31[_0x655f('0x3b')];if(!_0x5db969[_0x655f('0x3c')][_0x655f('0x42')](_0x655f('0x43'))){_0x122f51[_0x655f('0x23')]=qs[_0x655f('0x23')](_0x5db969[_0x655f('0x3c')][_0x655f('0x23')]);_0x122f51[_0x655f('0x22')]=qs[_0x655f('0x22')](_0x5db969[_0x655f('0x3c')][_0x655f('0x22')]);}_0x122f51[_0x655f('0x8f')]=qs[_0x655f('0x44')](_0x5db969['query'][_0x655f('0x44')]);_0x122f51[_0x655f('0x73')]=qs[_0x655f('0x3e')](_['pick'](_0x5db969[_0x655f('0x3c')],_0x146e31[_0x655f('0x3e')]));_0x122f51[_0x655f('0x73')][_0x655f('0xb7')]=_0x23692c['id'];if(_0x5db969[_0x655f('0x3c')]['filter']){_0x122f51[_0x655f('0x73')]=_[_0x655f('0x9e')](_0x122f51['where'],{'$or':_[_0x655f('0x2f')](_0x122f51[_0x655f('0x40')],function(_0xc663c1){var _0x4a4ce3={};_0x4a4ce3[_0xc663c1]={'$like':'%'+_0x5db969[_0x655f('0x3c')][_0x655f('0x83')]+'%'};return _0x4a4ce3;})});}if(_0x5db969[_0x655f('0x3c')][_0x655f('0x78')]){var _0x4ceced=_0x5db969[_0x655f('0x3c')][_0x655f('0x78')][_0x655f('0x33')](',');var _0x557bf4={};_0x557bf4[_0x4ceced[0x0]]={'$gte':moment(_0x4ceced[0x1])[_0x655f('0xc3')](_0x655f('0xc4'))};_0x122f51[_0x655f('0x73')]=_[_0x655f('0x9e')](_0x122f51['where'],_0x557bf4);}_0x122f51=_[_0x655f('0x9e')]({},_0x122f51,_0x5db969[_0x655f('0xc5')]);return db[_0x655f('0xbf')][_0x655f('0x21')]({'where':_0x122f51['where']})[_0x655f('0x28')](function(_0xb01427){_0x27fac7[_0x655f('0x21')]=_0xb01427;if(_0x5db969[_0x655f('0x3c')][_0x655f('0xbc')]){_0x122f51[_0x655f('0xc6')]=[{'all':!![]}];}return db[_0x655f('0xbf')][_0x655f('0xc7')](_0x122f51);})[_0x655f('0x28')](function(_0x5a3b7d){_0x27fac7[_0x655f('0xb9')]=_0x5a3b7d;return _0x27fac7;});}})[_0x655f('0x28')](respondWithFilteredResult(_0x384173,_0x122f51))[_0x655f('0x35')](handleError(_0x384173,null));};exports['addTags']=function(_0x81df35,_0x3fe873,_0x34cf51){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x81df35[_0x655f('0xbb')]['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x3fe873,null))[_0x655f('0x28')](function(_0x410470){if(_0x410470){return _0x410470['setTags'](_0x81df35[_0x655f('0x6f')]['ids'],_[_0x655f('0xc1')](_0x81df35['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x655f('0xc7')]({'attributes':['id',_0x655f('0x2c'),_0x655f('0x47')],'where':{'id':_0x81df35['body'][_0x655f('0xc0')]}});})['then'](function(_0x26b863){socket[_0x655f('0xc8')](_0x655f('0xc9'),{'id':Number(_0x81df35['params']['id']),'tags':_0x26b863||[]});return{'id':Number(_0x81df35[_0x655f('0xbb')]['id']),'tags':_0x26b863||[]};});}})['then'](respondWithResult(_0x3fe873,null))['catch'](handleError(_0x3fe873,null));};exports[_0x655f('0xca')]=function(_0x5de090,_0x3f82cc,_0x59b8a6){return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x5de090['params']['id']}})[_0x655f('0x28')](handleEntityNotFound(_0x3f82cc,null))['then'](function(_0x3ff61e){if(_0x3ff61e){return _0x3ff61e[_0x655f('0xca')](_0x5de090[_0x655f('0x3c')][_0x655f('0xc0')]);}})[_0x655f('0x28')](respondWithStatusCode(_0x3f82cc,null))[_0x655f('0x35')](handleError(_0x3f82cc,null));};exports['download']=function(_0x67a605,_0x2bea7d){var _0x48221f=moment()[_0x655f('0xcb')]()[_0x655f('0x9c')]();var _0x27a7ce=path[_0x655f('0xcc')](config[_0x655f('0xcd')],_0x655f('0xce'),_0x655f('0xcf'),_0x655f('0xd0'));var _0x56379f=path[_0x655f('0xcc')](config[_0x655f('0xcd')],_0x655f('0xce'),_0x655f('0xcf'),'attachments');var _0x425219=path['join'](_0x27a7ce,_0x48221f);var _0x375466=util[_0x655f('0xc3')](_0x655f('0xd1'),_0x67a605['params']['id'],_0x48221f);var _0x52e584=path[_0x655f('0xcc')](_0x27a7ce,_0x375466);var _0x26296f=[];_0x26296f[_0x655f('0xd2')]({'model':db[_0x655f('0x6c')],'as':_0x655f('0x6c'),'attributes':['id',_0x655f('0x30')],'raw':!![]});_0x26296f[_0x655f('0xd2')]({'model':db[_0x655f('0xd3')],'as':_0x655f('0x5f'),'attributes':['id',_0x655f('0xd4'),_0x655f('0xd5')],'raw':!![]});if(_0x67a605['query']['attachments']){_0x26296f['push']({'model':db['Attachment'],'as':_0x655f('0xd6'),'raw':!![]});}var _0x585728=[{'model':db[_0x655f('0xbf')],'as':_0x655f('0xd7'),'attributes':['id','body',_0x655f('0x76'),'direction',_0x655f('0xd8'),'read'],'include':_0x26296f}];_0x585728[_0x655f('0xd2')]({'model':db[_0x655f('0xd9')],'as':_0x655f('0xda'),'attributes':['id',_0x655f('0x2c')]});_0x585728[_0x655f('0xd2')]({'model':db[_0x655f('0x6c')],'as':'Owner','attributes':['id',_0x655f('0x30')]});return db[_0x655f('0x36')][_0x655f('0x5a')]({'where':{'id':_0x67a605[_0x655f('0xbb')]['id']},'include':_0x585728})['then'](handleEntityNotFound(_0x2bea7d,null))[_0x655f('0x28')](function(_0x6cebb8){if(_0x6cebb8){var _0xe118c1=_0x6cebb8['get']({'plain':!![]});fs['mkdirSync'](_0x425219);var _0x46f87e={'format':'A4','border':_0x655f('0xdb'),'header':{'height':'40px','contents':{'first':_0x655f('0xdc')}},'footer':{'height':_0x655f('0xdd'),'contents':{'default':util[_0x655f('0xc3')](_0x655f('0xde'),util[_0x655f('0xc3')](_0x655f('0xdf'),_0x655f('0xe0'),_0xe118c1['id']),moment()[_0x655f('0xc3')](_0x655f('0xe1'))[_0x655f('0x9c')]())}}};var _0x4bf280={'channel':'Openchannel','account':_0xe118c1['Account'][_0x655f('0x2c')],'agent':_0xe118c1['Owner']?_0xe118c1[_0x655f('0xe2')][_0x655f('0x30')]:_0x655f('0xe3'),'createdAt':moment(_0xe118c1[_0x655f('0x76')])['format'](_0x655f('0xc4'))[_0x655f('0x9c')](),'closedAt':_0xe118c1['closed']?moment(_0xe118c1['closedAt'])['format'](_0x655f('0xc4'))[_0x655f('0x9c')]():'','disposition':_0xe118c1['disposition'],'visibility':_0xe118c1['threadId']?_0x655f('0xe4'):_0x655f('0xe5'),'messages':_(_0xe118c1[_0x655f('0xd7')])['filter']({'secret':![]})[_0x655f('0x2f')](function(_0x38a5cf){if(_0x38a5cf['Attachment']){var _0xfff834=path['join'](_0x56379f,_0x38a5cf['Attachment'][_0x655f('0xe6')]);if(fs[_0x655f('0xe7')](_0xfff834)){fs[_0x655f('0xe8')](_0xfff834)['pipe'](fs[_0x655f('0xe9')](path[_0x655f('0xcc')](_0x425219,_0x38a5cf[_0x655f('0xd6')][_0x655f('0xe6')])));}}return{'date':moment(_0x38a5cf[_0x655f('0x76')])['format'](_0x655f('0xc4'))['toString'](),'sender':_0x38a5cf['direction']===_0x655f('0xea')?_0x38a5cf[_0x655f('0x6c')]?_0x38a5cf['User'][_0x655f('0x30')]:_0x655f('0xeb'):_0x38a5cf[_0x655f('0x5f')]['firstName']+(_0x38a5cf[_0x655f('0x5f')][_0x655f('0xd5')]?'\x20'+_0x38a5cf[_0x655f('0x5f')][_0x655f('0xd5')]:''),'body':_0x38a5cf[_0x655f('0xd6')]?_0x38a5cf['Attachment'][_0x655f('0xe6')]:_0x38a5cf[_0x655f('0x6f')],'direction':_0x38a5cf[_0x655f('0xec')]===_0x655f('0xea')?'A':'C','secret':_0x38a5cf[_0x655f('0xd8')],'read':_0x38a5cf[_0x655f('0x7d')],'attachment':_0x38a5cf[_0x655f('0xd6')]};})['value']()};return ejs[_0x655f('0xed')](path[_0x655f('0xcc')](config['root'],_0x655f('0xce'),_0x655f('0xee'),'downloadInteraction.html'),{'interaction':_0x4bf280})[_0x655f('0x28')](function(_0x55b393){return new BPromise(function(_0x5a983d,_0x20c099){pdf[_0x655f('0xef')](_0x55b393,_0x46f87e)[_0x655f('0xf0')](path[_0x655f('0xcc')](_0x425219,'transcript-'+_0xe118c1['id']+'-'+_0x48221f+'.pdf'),function(_0x4dbaf3,_0x1aa720){if(_0x4dbaf3)return _0x20c099(_0x4dbaf3);_0x5a983d(_0x1aa720);});});})[_0x655f('0x28')](function(){return new BPromise(function(_0x3d0c8b,_0x373e52){zipdir(_0x425219,{'saveTo':_0x52e584},function(_0x18a7f6,_0x33016e){if(_0x18a7f6)return _0x373e52(_0x18a7f6);return _0x3d0c8b(_0x33016e);});})[_0x655f('0x28')](function(){return new BPromise(function(_0xe6ec3e,_0xe730a0){rimraf(_0x425219,function(_0x176c92){if(_0x176c92)_0xe730a0(_0x176c92);return _0xe6ec3e();});});})[_0x655f('0x28')](function(){return _0x2bea7d['download'](_0x52e584,_0x375466,function(_0x410151){if(_0x410151){console[_0x655f('0xf1')](_0x655f('0xf2'),_0x410151);}else{fs[_0x655f('0xf3')](_0x52e584);}});});});}else{return _0x2bea7d[_0x655f('0x1e')](0xc8);}})[_0x655f('0x35')](handleError(_0x2bea7d,null));}; \ No newline at end of file +var _0xdfc3=['err','unlinkSync','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','end','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','rows','catch','show','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','addMessage','omit','ids','getMessages','findOne','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','format','CmContact','Contact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','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\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','threadId','Public','Private','existsSync','createWriteStream','basename','System','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf'];(function(_0x5ee99e,_0x10c80a){var _0x5d17e1=function(_0x3a5af8){while(--_0x3a5af8){_0x5ee99e['push'](_0x5ee99e['shift']());}};_0x5d17e1(++_0x10c80a);}(_0xdfc3,0xf4));var _0x3dfc=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdfc3[_0x82129b];return _0x2ae5dc;};'use strict';var pdf=require(_0x3dfc('0x0'));var emlformat=require(_0x3dfc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3dfc('0x3'));var BPromise=require(_0x3dfc('0x4'));var Mustache=require(_0x3dfc('0x5'));var util=require(_0x3dfc('0x6'));var path=require(_0x3dfc('0x7'));var sox=require(_0x3dfc('0x8'));var csv=require(_0x3dfc('0x9'));var ejs=require(_0x3dfc('0xa'));var fs=require('fs');var _=require(_0x3dfc('0xb'));var squel=require('squel');var crypto=require(_0x3dfc('0xc'));var jsforce=require(_0x3dfc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dfc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3dfc('0xe'));var authService=require(_0x3dfc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3dfc('0x10'));var hardwareService=require(_0x3dfc('0x11'));var logger=require(_0x3dfc('0x12'))('api');var utils=require(_0x3dfc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3dfc('0x14'));var db=require(_0x3dfc('0x15'))['db'];config[_0x3dfc('0x16')]=_[_0x3dfc('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3dfc('0x16')]));require(_0x3dfc('0x18'))[_0x3dfc('0x19')](socket);function respondWithStatusCode(_0x2b8b88,_0x12a5c3){_0x12a5c3=_0x12a5c3||0xcc;return function(_0x434e92){if(_0x434e92){return _0x2b8b88[_0x3dfc('0x1a')](_0x12a5c3);}return _0x2b8b88[_0x3dfc('0x1b')](_0x12a5c3)['end']();};}function respondWithResult(_0x4fc163,_0x1726e4){_0x1726e4=_0x1726e4||0xc8;return function(_0xb4b554){if(_0xb4b554){return _0x4fc163[_0x3dfc('0x1b')](_0x1726e4)['json'](_0xb4b554);}};}function respondWithFilteredResult(_0x3ca47e,_0x2962d3){return function(_0x4d21b4){if(_0x4d21b4){var _0x41174d=_0x4d21b4[_0x3dfc('0x1c')],_0x5bc1de=_0x2962d3[_0x3dfc('0x1d')],_0x1ad2e6=_0x2962d3['offset']+_0x2962d3[_0x3dfc('0x1e')],_0x53e4c1;if(_0x1ad2e6>=_0x41174d){_0x1ad2e6=_0x41174d;_0x53e4c1=0xc8;}else{_0x53e4c1=0xce;}_0x3ca47e[_0x3dfc('0x1b')](_0x53e4c1);return _0x3ca47e[_0x3dfc('0x1f')](_0x3dfc('0x20'),_0x5bc1de+'-'+_0x1ad2e6+'/'+_0x41174d)[_0x3dfc('0x21')](_0x4d21b4);}return null;};}function patchUpdates(_0x49785e){return function(_0x1a3d25){try{jsonpatch[_0x3dfc('0x22')](_0x1a3d25,_0x49785e,!![]);}catch(_0x55fcaf){return BPromise['reject'](_0x55fcaf);}return _0x1a3d25[_0x3dfc('0x23')]();};}function saveUpdates(_0x4f0636,_0x4ae238){return function(_0x49ae07){if(_0x49ae07){return _0x49ae07[_0x3dfc('0x24')](_0x4f0636)[_0x3dfc('0x25')](function(_0x3bab41){return _0x3bab41;});}return null;};}function removeEntity(_0x9f5463,_0x565a63){return function(_0x369a02){if(_0x369a02){return _0x369a02[_0x3dfc('0x26')]()['then'](function(){_0x9f5463[_0x3dfc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8d8b,_0x962335){return function(_0x1283e6){if(!_0x1283e6){_0x4b8d8b[_0x3dfc('0x1a')](0x194);}return _0x1283e6;};}function handleError(_0x840140,_0x427450){_0x427450=_0x427450||0x1f4;return function(_0x85e5fc){logger[_0x3dfc('0x27')](_0x85e5fc[_0x3dfc('0x28')]);if(_0x85e5fc[_0x3dfc('0x29')]){delete _0x85e5fc[_0x3dfc('0x29')];}_0x840140[_0x3dfc('0x1b')](_0x427450)[_0x3dfc('0x2a')](_0x85e5fc);};}function getInteractionUsers(_0xe5df08,_0xb8bfe0){return new BPromise(function(_0x48e885,_0x4a13ac){try{if(_0xb8bfe0[_0xe5df08['id']]){_0xe5df08[_0x3dfc('0x2b')]=_[_0x3dfc('0x2c')](_0xb8bfe0[_0xe5df08['id']],function(_0x4bad52){return{'id':_0x4bad52['id'],'fullname':_0x4bad52[_0x3dfc('0x2d')]};});}}catch(_0x2c1bdd){_0x4a13ac(_0x2c1bdd);}_0x48e885(_0xe5df08);});}function getInteractionTags(_0x23476e,_0x38cec2){return new BPromise(function(_0x3bfa9c,_0x4b2bda){try{if(_0x23476e[_0x3dfc('0x2e')]){_0x23476e[_0x3dfc('0x2f')]=[];_0x23476e[_0x3dfc('0x2e')][_0x3dfc('0x30')](',')[_0x3dfc('0x31')](function(_0x7762c){_0x23476e[_0x3dfc('0x2f')]['push'](_0x38cec2[_0x7762c]);});}delete _0x23476e[_0x3dfc('0x2e')];}catch(_0x1a2abd){_0x4b2bda(_0x1a2abd);}_0x3bfa9c(_0x23476e);});}function updateOpenchannelInteraction(_0x331785,_0x7da256,_0x2640e1){return new BPromise(function(_0x129e8a,_0x4eab8d){return getInteractionUsers(_0x331785,_0x2640e1)[_0x3dfc('0x25')](function(_0x201bf2){return getInteractionTags(_0x201bf2,_0x7da256);})[_0x3dfc('0x25')](function(_0x97a32d){_0x129e8a(_0x97a32d);})['catch'](function(_0x5509c4){_0x4eab8d(_0x5509c4);});});}exports[_0x3dfc('0x32')]=function(_0x94b785,_0x54dbf6){var _0x343f32={},_0x128eec={},_0x3b0c3e={'count':0x0,'rows':[]};var _0x4faf0e=_[_0x3dfc('0x2c')](db[_0x3dfc('0x33')][_0x3dfc('0x34')],function(_0x21bbff){return{'name':_0x21bbff[_0x3dfc('0x35')],'type':_0x21bbff[_0x3dfc('0x36')][_0x3dfc('0x37')]};});_0x128eec[_0x3dfc('0x38')]=_['map'](_0x4faf0e,_0x3dfc('0x29'));_0x128eec['query']=_[_0x3dfc('0x39')](_0x94b785[_0x3dfc('0x3a')]);_0x128eec[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x128eec[_0x3dfc('0x38')],_0x128eec['query']);_0x343f32[_0x3dfc('0x3d')]=_[_0x3dfc('0x3c')](_0x128eec[_0x3dfc('0x38')],qs['fields'](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x3e')]));_0x343f32['attributes']=_0x343f32[_0x3dfc('0x3d')][_0x3dfc('0x3f')]?_0x343f32['attributes']:_0x128eec['model'];if(!_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x40')](_0x3dfc('0x41'))){_0x343f32[_0x3dfc('0x1e')]=qs[_0x3dfc('0x1e')](_0x94b785[_0x3dfc('0x3a')]['limit']);_0x343f32[_0x3dfc('0x1d')]=qs[_0x3dfc('0x1d')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x1d')]);}_0x343f32[_0x3dfc('0x42')]=qs[_0x3dfc('0x43')](_0x94b785[_0x3dfc('0x3a')]['sort']);_0x343f32[_0x3dfc('0x44')]=qs['filters'](_[_0x3dfc('0x45')](_0x94b785[_0x3dfc('0x3a')],_0x128eec[_0x3dfc('0x3b')]),_0x4faf0e);var _0x1ef0f1=[];var _0x19352c=squel['select']()[_0x3dfc('0x46')]('id')['field'](_0x3dfc('0x29'))[_0x3dfc('0x46')](_0x3dfc('0x47'))[_0x3dfc('0x48')]('tools_tags');var _0x3b55cf=squel['select']()[_0x3dfc('0x46')]('u.id')[_0x3dfc('0x46')](_0x3dfc('0x49'))[_0x3dfc('0x46')]('ui.OpenchannelInteractionId')[_0x3dfc('0x48')](_0x3dfc('0x4a'),'ui')[_0x3dfc('0x4b')]('users','u',_0x3dfc('0x4c'));var _0x625abd=squel[_0x3dfc('0x4d')]()[_0x3dfc('0x48')]('openchannel_interactions','i')[_0x3dfc('0x4b')](_0x3dfc('0x4e'),'c',_0x3dfc('0x4f'))[_0x3dfc('0x4b')](_0x3dfc('0x50'),'o',_0x3dfc('0x51'))['left_join'](_0x3dfc('0x52'),'a',_0x3dfc('0x53'))['left_join']('openchannel_messages','me',_0x3dfc('0x54'))[_0x3dfc('0x4b')](_0x3dfc('0x55'),'it',_0x3dfc('0x56'))[_0x3dfc('0x4b')](_0x3dfc('0x57'),'t',_0x3dfc('0x58'));var _0x4243c6=squel[_0x3dfc('0x59')]();var _0x2ed2af=[];var _0x2a61be=squel[_0x3dfc('0x59')]();var _0x371151;if(_0x94b785['query'][_0x3dfc('0x5a')]){_0x371151=as[_0x3dfc('0x5b')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x5a')]);var _0x3b105b=_0x371151['sqlOperator'];for(var _0x52f3a1=0x0;_0x52f3a1<_0x371151[_0x3dfc('0x5c')]['length'];_0x52f3a1++){var _0xf3811=_0x371151[_0x3dfc('0x5c')][_0x52f3a1];var _0x57c77e='i';var _0x2aaba7=_[_0x3dfc('0x5d')](_0x4faf0e,[_0x3dfc('0x29'),_0xf3811[_0x3dfc('0x46')]]);if(!_0x2aaba7){switch(_0xf3811['field']){case _0x3dfc('0x5e'):if(_0xf3811[_0x3dfc('0x5f')]==0x1){_0x625abd[_0x3dfc('0x60')]('`'+_0xf3811[_0x3dfc('0x46')]+'`\x20=\x200');}else{_0x625abd[_0x3dfc('0x60')]('`'+_0xf3811[_0x3dfc('0x46')]+_0x3dfc('0x61'));}break;case'Contact':if(_0xf3811[_0x3dfc('0x62')]==='$substring'){if(_0xf3811[_0x3dfc('0x5f')][_0x3dfc('0x30')]('\x20')[_0x3dfc('0x3f')]>0x1){_0x4243c6[_0x3b105b](_0x3dfc('0x63'),qs[_0x3dfc('0x64')](_0xf3811[_0x3dfc('0x5f')]),null);}else{var _0x542ca6='%'+_0xf3811[_0x3dfc('0x5f')]+'%';_0x4243c6[_0x3b105b](_0x3dfc('0x65'),_0x542ca6,_0x542ca6,_0x542ca6);}}else{_0x2aaba7=_['find'](_0x4faf0e,['name',_0x3dfc('0x66')]);_0xf3811[_0x3dfc('0x46')]='ContactId';_0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9['text'],_0x35d8a9['value'][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')]['end']);}break;case'Tag':var _0x2e870e=_0xf3811[_0x3dfc('0x5f')][_0x3dfc('0x30')](',')[_0x3dfc('0x2c')](function(_0x296fd9){return Number(_0x296fd9);});_0x2e870e[_0x3dfc('0x31')](function(_0x2f985f){_0x2a61be['or'](_0x3dfc('0x69'),'%,'+_0x2f985f+',%');});_0x2ed2af=_[_0x3dfc('0x6a')](_0x2ed2af,_0x2e870e);break;case _0x3dfc('0x6b'):if(_0xf3811['operator']===_0x3dfc('0x6c')){_0x4243c6[_0x3b105b](_0x3dfc('0x6d'),'%'+_0xf3811[_0x3dfc('0x5f')]+'%',null);}else{_0x2aaba7=_[_0x3dfc('0x5d')](_0x4faf0e,[_0x3dfc('0x29'),'UserId']);_0xf3811[_0x3dfc('0x46')]=_0x3dfc('0x6e');_0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9[_0x3dfc('0x6f')],_0x35d8a9['value'][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x70')]);}break;case _0x3dfc('0x71'):_0x35d8a9=as['buildExpression']('me',null,_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9[_0x3dfc('0x6f')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x68')],_0x35d8a9['value'][_0x3dfc('0x70')]);break;}}else{var _0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9['text'],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x70')]);}}}else{var _0x2fec55=_(_0x94b785[_0x3dfc('0x3a')])[_0x3dfc('0x39')]()[_0x3dfc('0x2c')](function(_0x4495c1){return _[_0x3dfc('0x72')](_0x4faf0e,['name',_0x4495c1])?_0x4495c1:undefined;})[_0x3dfc('0x73')]()[_0x3dfc('0x5f')]();if(!_[_0x3dfc('0x74')](_0x2fec55)){_0x2fec55[_0x3dfc('0x31')](function(_0xd5f793){if(_0xd5f793===_0x3dfc('0x75')){_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x76'),[]['concat'](_0x94b785[_0x3dfc('0x3a')][_0xd5f793]));}else if(_0xd5f793===_0x3dfc('0x77')){var _0x126025=JSON[_0x3dfc('0x78')](_0x94b785[_0x3dfc('0x3a')][_0xd5f793])['$gte'];var _0x43ae5d=JSON['parse'](_0x94b785['query'][_0xd5f793])['$lte'];_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x79'),_0x126025,_0x43ae5d);}else{if(_0x94b785[_0x3dfc('0x3a')][_0xd5f793]==='null'){_0x625abd[_0x3dfc('0x44')]('i.'+_0xd5f793+_0x3dfc('0x7a'));}else{_0x625abd[_0x3dfc('0x44')]('i.'+_0xd5f793+'\x20=\x20?',_0x94b785[_0x3dfc('0x3a')][_0xd5f793]);}}});}if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7b')]){if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7b')]==0x1){_0x625abd['having']('`unreadMessages`\x20=\x200');}else{_0x625abd[_0x3dfc('0x60')](_0x3dfc('0x7c'));}}if(_0x94b785['query']['tag']){_0x2ed2af=_[_0x3dfc('0x7d')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')])?_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')]:new Array(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')]);_0x2ed2af[_0x3dfc('0x31')](function(_0x5ef9ee){_0x2a61be['or'](_0x3dfc('0x69'),'%,'+_0x5ef9ee+',%');});}if(_0x94b785['query']['filter']){var _0x25a99e=_0x94b785[_0x3dfc('0x3a')]['filter'][_0x3dfc('0x7f')]('\x5c','\x5c\x5c')[_0x3dfc('0x7f')](/'/g,'\x27\x27');if(qs[_0x3dfc('0x80')](_0x25a99e)){_0x4243c6['or'](_0x3dfc('0x81'),_0x25a99e+'%');}else{_0x4243c6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3dfc('0x64')](_0x25a99e))['or'](_0x3dfc('0x82'),_0x25a99e+'%')['or'](_0x3dfc('0x83'),_0x25a99e+'%');}}}_0x625abd['where'](_0x4243c6);_0x625abd[_0x3dfc('0x84')](_0x3dfc('0x85'));var _0x2262d9={'type':db[_0x3dfc('0x86')][_0x3dfc('0x87')][_0x3dfc('0x88')],'raw':!![]};var _0x1ba7e0=_0x625abd[_0x3dfc('0x89')]();_0x1ba7e0[_0x3dfc('0x46')](_0x3dfc('0x85'));_0x1ba7e0[_0x3dfc('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x343f32[_0x3dfc('0x42')]){_0x343f32[_0x3dfc('0x42')][_0x3dfc('0x31')](function(_0x5b7223){var _0x4eecb7=_0x5b7223[0x0]===_0x3dfc('0x8a')?_0x5b7223[0x0]:'i.'+_0x5b7223[0x0];_0x625abd[_0x3dfc('0x42')](_0x4eecb7,_0x5b7223[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3dfc('0x74')](_0x2ed2af)){_0x625abd[_0x3dfc('0x60')](_0x2a61be);_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x8b'),_0x2ed2af);}BPromise[_0x3dfc('0x8c')]()['then'](function(){if(!_0x371151){if(_0x94b785['query']['OpenchannelAccountId']||_0x94b785['query'][_0x3dfc('0x8d')])return;_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x8e'));_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x8e'));return;}if(_0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x90')]!==_0x3dfc('0x91'))return;return _0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x92')]({'attributes':['id'],'raw':!![]})[_0x3dfc('0x25')](function(_0x5cb392){if(_[_0x3dfc('0x74')](_0x5cb392)){_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x93'));_0x625abd['where'](_0x3dfc('0x93'));}else{_0x1ba7e0[_0x3dfc('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5cb392,'id'));_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x76'),_['map'](_0x5cb392,'id'));}});})[_0x3dfc('0x25')](function(){if(_0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x90')]===_0x3dfc('0x91')&&!_0x371151&&!_0x94b785[_0x3dfc('0x3a')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x3dfc('0x3a')](_0x1ba7e0[_0x3dfc('0x94')](),_0x2262d9);})[_0x3dfc('0x25')](function(_0x26f600){_0x3b0c3e[_0x3dfc('0x1c')]=_0x26f600[_0x3dfc('0x3f')];if(_0x3b0c3e[_0x3dfc('0x1c')]===0x0)return[];return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x19352c[_0x3dfc('0x94')](),_0x2262d9)['then'](function(_0x4c4625){_0x1ef0f1=_[_0x3dfc('0x96')](_0x4c4625,'id');_0x2262d9=_['merge'](_0x2262d9,{'model':db[_0x3dfc('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x3e')]){_0x343f32[_0x3dfc('0x3d')]['forEach'](function(_0xa44c50){_0x625abd[_0x3dfc('0x46')]('i.'+_0xa44c50);});}else{_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x97'),'unreadMessages');_0x625abd['field'](_0x3dfc('0x98'),'Account.key');_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x99'),_0x3dfc('0x9a'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9b'),_0x3dfc('0x8a'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9c'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9d'),_0x3dfc('0x9e'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9f'),_0x3dfc('0xa0'));_0x625abd[_0x3dfc('0x46')]('c.email',_0x3dfc('0xa1'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0xa2'),_0x3dfc('0xa3'));_0x625abd[_0x3dfc('0x46')]('c.mobile',_0x3dfc('0xa4'));_0x625abd[_0x3dfc('0x46')]('c.fax',_0x3dfc('0xa5'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0xa6'),_0x3dfc('0xa7'));_0x625abd['field']('o.internal',_0x3dfc('0xa8'));_0x625abd[_0x3dfc('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3dfc('0x2e'));}if(_0x343f32[_0x3dfc('0x1e')])_0x625abd[_0x3dfc('0x1e')](_0x343f32[_0x3dfc('0x1e')]);if(_0x343f32[_0x3dfc('0x1d')])_0x625abd[_0x3dfc('0x1d')](_0x343f32[_0x3dfc('0x1d')]);return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x625abd[_0x3dfc('0x94')](),_0x2262d9);})[_0x3dfc('0x25')](function(_0x3088c0){_0x3b55cf[_0x3dfc('0x44')](_0x3dfc('0xa9'),_[_0x3dfc('0x2c')](_0x3088c0,'id'));return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x3b55cf['toString'](),_0x2262d9)['then'](function(_0x369076){var _0x947199=_['groupBy'](_0x369076,_0x3dfc('0xaa'));var _0x3c8014=[];_0x3088c0['forEach'](function(_0x14b62c){_0x3c8014[_0x3dfc('0xab')](updateOpenchannelInteraction(_0x14b62c,_0x1ef0f1,_0x947199));});return BPromise[_0x3dfc('0xac')](_0x3c8014);});});})[_0x3dfc('0x25')](function(_0xf79b6d){_0x3b0c3e[_0x3dfc('0xad')]=_0xf79b6d;return _0x3b0c3e;})[_0x3dfc('0x25')](respondWithFilteredResult(_0x54dbf6,_0x343f32))[_0x3dfc('0xae')](handleError(_0x54dbf6,null));};exports[_0x3dfc('0xaf')]=function(_0x598003,_0x2dbd69){var _0x10c007={};if(_0x598003[_0x3dfc('0x3a')]['type']&&_0x598003[_0x3dfc('0x3a')][_0x3dfc('0x36')]===_0x3dfc('0x48')){_0x10c007[_0x3dfc('0x48')]=_0x598003[_0x3dfc('0xb0')]['id'];}else{_0x10c007['id']=_0x598003[_0x3dfc('0xb0')]['id'];}var _0x3d2a86={'raw':![],'where':_0x10c007},_0x20a672={};_0x20a672[_0x3dfc('0x38')]=_['keys'](db[_0x3dfc('0x33')][_0x3dfc('0x34')]);_0x20a672[_0x3dfc('0x3a')]=_[_0x3dfc('0x39')](_0x598003[_0x3dfc('0x3a')]);_0x20a672[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x20a672[_0x3dfc('0x38')],_0x20a672[_0x3dfc('0x3a')]);_0x3d2a86[_0x3dfc('0x3d')]=_[_0x3dfc('0x3c')](_0x20a672[_0x3dfc('0x38')],qs['fields'](_0x598003['query'][_0x3dfc('0x3e')]));_0x3d2a86[_0x3dfc('0x3d')]=_0x3d2a86[_0x3dfc('0x3d')][_0x3dfc('0x3f')]?_0x3d2a86['attributes']:_0x20a672[_0x3dfc('0x38')];if(_0x598003[_0x3dfc('0x3a')][_0x3dfc('0xb1')]){_0x3d2a86[_0x3dfc('0xb2')]=[{'all':!![]}];}_0x3d2a86=_[_0x3dfc('0xb3')]({},_0x3d2a86,_0x598003[_0x3dfc('0xb4')]);return db[_0x3dfc('0x33')][_0x3dfc('0x5d')](_0x3d2a86)[_0x3dfc('0x25')](handleEntityNotFound(_0x2dbd69,null))[_0x3dfc('0x25')](respondWithResult(_0x2dbd69,null))['catch'](handleError(_0x2dbd69,null));};exports[_0x3dfc('0xb5')]=function(_0x174a72,_0x537570){return db[_0x3dfc('0x33')][_0x3dfc('0xb5')](_0x174a72[_0x3dfc('0x71')],{})[_0x3dfc('0x25')](respondWithResult(_0x537570,0xc9))[_0x3dfc('0xae')](handleError(_0x537570,null));};exports['update']=function(_0x42c50b,_0x3234e3){if(_0x42c50b[_0x3dfc('0x71')]['id']){delete _0x42c50b['body']['id'];}return db[_0x3dfc('0x33')]['find']({'where':{'id':_0x42c50b[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x3234e3,null))['then'](saveUpdates(_0x42c50b[_0x3dfc('0x71')],null))['then'](respondWithResult(_0x3234e3,null))['catch'](handleError(_0x3234e3,null));};exports[_0x3dfc('0x26')]=function(_0x445de0,_0x48648e){return db['OpenchannelInteraction']['find']({'where':{'id':_0x445de0[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x48648e,null))[_0x3dfc('0x25')](removeEntity(_0x48648e,null))['catch'](handleError(_0x48648e,null));};exports[_0x3dfc('0xb6')]=function(_0x4e58a0,_0x1171fd){return db[_0x3dfc('0x33')]['describe']()[_0x3dfc('0x25')](respondWithResult(_0x1171fd,null))[_0x3dfc('0xae')](handleError(_0x1171fd,null));};exports['addMessage']=function(_0x43ff25,_0x5aed40,_0x4b4064){return db[_0x3dfc('0xb7')]['find']({'where':{'id':_0x43ff25[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x5aed40,null))[_0x3dfc('0x25')](function(_0x40a22c){if(_0x40a22c){return _0x40a22c[_0x3dfc('0xb8')](_0x43ff25['body']['ids'],_[_0x3dfc('0xb9')](_0x43ff25[_0x3dfc('0x71')],[_0x3dfc('0xba'),'id'])||{});}})[_0x3dfc('0x25')](respondWithResult(_0x5aed40,null))[_0x3dfc('0xae')](handleError(_0x5aed40,null));};exports[_0x3dfc('0xbb')]=function(_0x57538d,_0x30f4a4,_0x172406){var _0x111282={'raw':![],'where':{}};var _0x1e6f06={};var _0x2a09d={'count':0x0,'rows':[]};return db[_0x3dfc('0x33')][_0x3dfc('0xbc')]({'where':{'id':_0x57538d[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x30f4a4,null))[_0x3dfc('0x25')](function(_0x275435){if(_0x275435){_0x1e6f06[_0x3dfc('0x38')]=_[_0x3dfc('0x39')](db['OpenchannelMessage'][_0x3dfc('0x34')]);_0x1e6f06[_0x3dfc('0x3a')]=_[_0x3dfc('0x39')](_0x57538d[_0x3dfc('0x3a')]);_0x1e6f06[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x1e6f06[_0x3dfc('0x38')],_0x1e6f06['query']);_0x111282[_0x3dfc('0x3d')]=_['intersection'](_0x1e6f06[_0x3dfc('0x38')],qs[_0x3dfc('0x3e')](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x3e')]));_0x111282['attributes']=_0x111282[_0x3dfc('0x3d')]['length']?_0x111282[_0x3dfc('0x3d')]:_0x1e6f06[_0x3dfc('0x38')];if(!_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x40')](_0x3dfc('0x41'))){_0x111282['limit']=qs['limit'](_0x57538d[_0x3dfc('0x3a')]['limit']);_0x111282[_0x3dfc('0x1d')]=qs['offset'](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x1d')]);}_0x111282[_0x3dfc('0x42')]=qs[_0x3dfc('0x43')](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x43')]);_0x111282[_0x3dfc('0x44')]=qs[_0x3dfc('0x3b')](_[_0x3dfc('0x45')](_0x57538d[_0x3dfc('0x3a')],_0x1e6f06[_0x3dfc('0x3b')]));_0x111282[_0x3dfc('0x44')][_0x3dfc('0xaa')]=_0x275435['id'];if(_0x57538d[_0x3dfc('0x3a')]['filter']){_0x111282['where']=_[_0x3dfc('0xb3')](_0x111282[_0x3dfc('0x44')],{'$or':_[_0x3dfc('0x2c')](_0x111282[_0x3dfc('0x3d')],function(_0x2c6ae3){var _0x3a951a={};_0x3a951a[_0x2c6ae3]={'$like':'%'+_0x57538d['query'][_0x3dfc('0xbd')]+'%'};return _0x3a951a;})});}if(_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0xbe')]){var _0x493736=_0x57538d['query'][_0x3dfc('0xbe')]['split'](',');var _0x186864={};_0x186864[_0x493736[0x0]]={'$gte':moment(_0x493736[0x1])['format'](_0x3dfc('0xbf'))};_0x111282['where']=_['merge'](_0x111282[_0x3dfc('0x44')],_0x186864);}_0x111282=_[_0x3dfc('0xb3')]({},_0x111282,_0x57538d[_0x3dfc('0xb4')]);return db[_0x3dfc('0xb7')]['count']({'where':_0x111282[_0x3dfc('0x44')]})[_0x3dfc('0x25')](function(_0x53d1eb){_0x2a09d[_0x3dfc('0x1c')]=_0x53d1eb;if(_0x57538d['query'][_0x3dfc('0xb1')]){_0x111282[_0x3dfc('0xb2')]=[{'all':!![]}];}return db[_0x3dfc('0xb7')][_0x3dfc('0xc0')](_0x111282);})[_0x3dfc('0x25')](function(_0x1b0b37){_0x2a09d['rows']=_0x1b0b37;return _0x2a09d;});}})[_0x3dfc('0x25')](respondWithFilteredResult(_0x30f4a4,_0x111282))[_0x3dfc('0xae')](handleError(_0x30f4a4,null));};exports[_0x3dfc('0xc1')]=function(_0x4b361f,_0x29d6b9,_0x4bc7ee){return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x4b361f['params']['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x29d6b9,null))[_0x3dfc('0x25')](function(_0x4a3fee){if(_0x4a3fee){return _0x4a3fee[_0x3dfc('0xc2')](_0x4b361f[_0x3dfc('0x71')][_0x3dfc('0xba')],_[_0x3dfc('0xb9')](_0x4b361f[_0x3dfc('0x71')],[_0x3dfc('0xba'),'id'])||{})[_0x3dfc('0xc3')](function(){return db[_0x3dfc('0xc4')]['findAll']({'attributes':['id',_0x3dfc('0x29'),_0x3dfc('0x47')],'where':{'id':_0x4b361f[_0x3dfc('0x71')][_0x3dfc('0xba')]}});})['then'](function(_0x2b8f13){socket[_0x3dfc('0xc5')]('openchannelInteractionTags:save',{'id':Number(_0x4b361f[_0x3dfc('0xb0')]['id']),'tags':_0x2b8f13||[]});return{'id':Number(_0x4b361f[_0x3dfc('0xb0')]['id']),'tags':_0x2b8f13||[]};});}})[_0x3dfc('0x25')](respondWithResult(_0x29d6b9,null))['catch'](handleError(_0x29d6b9,null));};exports[_0x3dfc('0xc6')]=function(_0x579635,_0x54e0d0,_0x427a49){return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x579635[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x54e0d0,null))[_0x3dfc('0x25')](function(_0x512a75){if(_0x512a75){return _0x512a75[_0x3dfc('0xc6')](_0x579635[_0x3dfc('0x3a')][_0x3dfc('0xba')]);}})[_0x3dfc('0x25')](respondWithStatusCode(_0x54e0d0,null))[_0x3dfc('0xae')](handleError(_0x54e0d0,null));};exports[_0x3dfc('0xc7')]=function(_0x28bc09,_0x5b7086){var _0x141db4=moment()[_0x3dfc('0xc8')]()[_0x3dfc('0x94')]();var _0x12c1f8=path['join'](config[_0x3dfc('0xc9')],_0x3dfc('0xca'),_0x3dfc('0xcb'),_0x3dfc('0xcc'));var _0x481d86=path[_0x3dfc('0xcd')](config['root'],_0x3dfc('0xca'),_0x3dfc('0xcb'),_0x3dfc('0xce'));var _0x23be26=path['join'](_0x12c1f8,_0x141db4);var _0x2993c9=util[_0x3dfc('0xcf')]('transcript-%d-%s.zip',_0x28bc09['params']['id'],_0x141db4);var _0x31a9c9=path['join'](_0x12c1f8,_0x2993c9);var _0x52f5f5=[];_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0x6b')],'as':_0x3dfc('0x6b'),'attributes':['id',_0x3dfc('0x2d')],'raw':!![]});_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd0')],'as':_0x3dfc('0xd1'),'attributes':['id',_0x3dfc('0xd2'),'lastName'],'raw':!![]});if(_0x28bc09['query']['attachments']){_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd3')],'as':_0x3dfc('0xd3'),'raw':!![]});}var _0x4faafd=[{'model':db['OpenchannelMessage'],'as':_0x3dfc('0xd4'),'attributes':['id',_0x3dfc('0x71'),'createdAt',_0x3dfc('0xd5'),_0x3dfc('0xd6'),_0x3dfc('0x7b')],'include':_0x52f5f5}];_0x4faafd[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd7')],'as':_0x3dfc('0xd8'),'attributes':['id',_0x3dfc('0x29')]});_0x4faafd[_0x3dfc('0xab')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x28bc09[_0x3dfc('0xb0')]['id']},'include':_0x4faafd})[_0x3dfc('0x25')](handleEntityNotFound(_0x5b7086,null))[_0x3dfc('0x25')](function(_0x570951){if(_0x570951){var _0x45c09e=_0x570951['get']({'plain':!![]});fs[_0x3dfc('0xd9')](_0x23be26);var _0x4553a5={'format':'A4','border':_0x3dfc('0xda'),'header':{'height':_0x3dfc('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util[_0x3dfc('0xcf')](_0x3dfc('0xdc'),util[_0x3dfc('0xcf')]('%s\x20#%d',_0x3dfc('0xdd'),_0x45c09e['id']),moment()[_0x3dfc('0xcf')](_0x3dfc('0xde'))[_0x3dfc('0x94')]())}}};var _0x1bad93={'channel':'Openchannel','account':_0x45c09e[_0x3dfc('0xd8')][_0x3dfc('0x29')],'agent':_0x45c09e[_0x3dfc('0xdf')]?_0x45c09e['Owner'][_0x3dfc('0x2d')]:_0x3dfc('0xe0'),'createdAt':moment(_0x45c09e['createdAt'])[_0x3dfc('0xcf')](_0x3dfc('0xbf'))['toString'](),'closedAt':_0x45c09e[_0x3dfc('0xe1')]?moment(_0x45c09e[_0x3dfc('0xe2')])[_0x3dfc('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3dfc('0x94')]():'','disposition':_0x45c09e['disposition'],'visibility':_0x45c09e[_0x3dfc('0xe3')]?_0x3dfc('0xe4'):_0x3dfc('0xe5'),'messages':_(_0x45c09e['Messages'])['filter']({'secret':![]})[_0x3dfc('0x2c')](function(_0x238b9b){if(_0x238b9b['Attachment']){var _0x5c4c75=path[_0x3dfc('0xcd')](_0x481d86,_0x238b9b[_0x3dfc('0xd3')]['basename']);if(fs[_0x3dfc('0xe6')](_0x5c4c75)){fs['createReadStream'](_0x5c4c75)['pipe'](fs[_0x3dfc('0xe7')](path[_0x3dfc('0xcd')](_0x23be26,_0x238b9b[_0x3dfc('0xd3')][_0x3dfc('0xe8')])));}}return{'date':moment(_0x238b9b[_0x3dfc('0x77')])['format'](_0x3dfc('0xbf'))['toString'](),'sender':_0x238b9b[_0x3dfc('0xd5')]==='out'?_0x238b9b['User']?_0x238b9b[_0x3dfc('0x6b')][_0x3dfc('0x2d')]:_0x3dfc('0xe9'):_0x238b9b[_0x3dfc('0xd1')][_0x3dfc('0xd2')]+(_0x238b9b[_0x3dfc('0xd1')]['lastName']?'\x20'+_0x238b9b[_0x3dfc('0xd1')][_0x3dfc('0xea')]:''),'body':_0x238b9b[_0x3dfc('0xd3')]?_0x238b9b[_0x3dfc('0xd3')][_0x3dfc('0xe8')]:_0x238b9b['body'],'direction':_0x238b9b[_0x3dfc('0xd5')]==='out'?'A':'C','secret':_0x238b9b[_0x3dfc('0xd6')],'read':_0x238b9b[_0x3dfc('0x7b')],'attachment':_0x238b9b[_0x3dfc('0xd3')]};})['value']()};return ejs[_0x3dfc('0xeb')](path[_0x3dfc('0xcd')](config[_0x3dfc('0xc9')],'server',_0x3dfc('0xec'),_0x3dfc('0xed')),{'interaction':_0x1bad93})[_0x3dfc('0x25')](function(_0x28dda1){return new BPromise(function(_0x105241,_0x386538){pdf[_0x3dfc('0xb5')](_0x28dda1,_0x4553a5)[_0x3dfc('0xee')](path[_0x3dfc('0xcd')](_0x23be26,'transcript-'+_0x45c09e['id']+'-'+_0x141db4+_0x3dfc('0xef')),function(_0x8896e8,_0x176ab5){if(_0x8896e8)return _0x386538(_0x8896e8);_0x105241(_0x176ab5);});});})[_0x3dfc('0x25')](function(){return new BPromise(function(_0x454cf2,_0xdfba39){zipdir(_0x23be26,{'saveTo':_0x31a9c9},function(_0x43b112,_0x3b377b){if(_0x43b112)return _0xdfba39(_0x43b112);return _0x454cf2(_0x3b377b);});})[_0x3dfc('0x25')](function(){return new BPromise(function(_0x11b2ff,_0x451cae){rimraf(_0x23be26,function(_0x2f5f55){if(_0x2f5f55)_0x451cae(_0x2f5f55);return _0x11b2ff();});});})[_0x3dfc('0x25')](function(){return _0x5b7086[_0x3dfc('0xc7')](_0x31a9c9,_0x2993c9,function(_0xdeee91){if(_0xdeee91){console['log'](_0x3dfc('0xf0'),_0xdeee91);}else{fs[_0x3dfc('0xf1')](_0x31a9c9);}});});});}else{return _0x5b7086[_0x3dfc('0x1a')](0xc8);}})['catch'](handleError(_0x5b7086,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2e03f26..7641fba 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 _0x081f=['save','update','remove','getUsers','setDataValue','Users','map','unreadMessages','length','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0x081f,0x83));var _0xf081=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x081f[_0x2c3255];return _0x282aba;};'use strict';var EventEmitter=require(_0xf081('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xf081('0x1'))['db'][_0xf081('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf081('0x3')](0x0);var events={'afterCreate':_0xf081('0x4'),'afterUpdate':_0xf081('0x5'),'afterDestroy':_0xf081('0x6')};function emitEvent(_0x1756c4){return function(_0x3f7e0a,_0x38c988,_0x28b562){_0x3f7e0a[_0xf081('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5427a2){_0x3f7e0a[_0xf081('0x8')](_0xf081('0x9'),_0x5427a2[_0xf081('0xa')](function(_0x2df422){return{'id':_0x2df422['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3f7e0a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x875ff){_0x3f7e0a[_0xf081('0x8')](_0xf081('0xb'),_0x875ff[_0xf081('0xc')]);OpenchannelInteractionEvents[_0xf081('0xd')](_0x1756c4+':'+_0x3f7e0a['id'],_0x3f7e0a);OpenchannelInteractionEvents[_0xf081('0xd')](_0x1756c4,_0x3f7e0a);_0x28b562(null);})['catch'](_0x28b562(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xf081('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xaae4=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','unreadMessages','length','emit','hook','exports','events'];(function(_0x5c0c5e,_0x1f38f1){var _0x59bcb6=function(_0x52f879){while(--_0x52f879){_0x5c0c5e['push'](_0x5c0c5e['shift']());}};_0x59bcb6(++_0x1f38f1);}(_0xaae4,0x149));var _0x4aae=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaae4[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x4aae('0x0'));var OpenchannelInteraction=require(_0x4aae('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x4aae('0x1'))['db'][_0x4aae('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4aae('0x3')](0x0);var events={'afterCreate':_0x4aae('0x4'),'afterUpdate':_0x4aae('0x5'),'afterDestroy':_0x4aae('0x6')};function emitEvent(_0x1c4662){return function(_0x3c4fd7,_0x171f78,_0x4267f1){_0x3c4fd7['getUsers']({'attributes':['id'],'raw':!![]})[_0x4aae('0x7')](function(_0x5e096f){_0x3c4fd7['setDataValue'](_0x4aae('0x8'),_0x5e096f[_0x4aae('0x9')](function(_0x4d6cf7){return{'id':_0x4d6cf7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3c4fd7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4aae('0x7')](function(_0x39331c){_0x3c4fd7['setDataValue'](_0x4aae('0xa'),_0x39331c[_0x4aae('0xb')]);OpenchannelInteractionEvents[_0x4aae('0xc')](_0x1c4662+':'+_0x3c4fd7['id'],_0x3c4fd7);OpenchannelInteractionEvents['emit'](_0x1c4662,_0x3c4fd7);_0x4267f1(null);})['catch'](_0x4267f1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x4aae('0xd')](e,emitEvent(event));}}module[_0x4aae('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index cb7a19d..e87d55f 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 _0xfd7b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x423249,_0xacbaf6){var _0x1bffab=function(_0x16b599){while(--_0x16b599){_0x423249['push'](_0x423249['shift']());}};_0x1bffab(++_0xacbaf6);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xfd7b[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33dab1,_0x5cee3d,_0x3cf120){if(_0x33dab1[_0xbfd7('0xc')](_0xbfd7('0xd'))){_0x33dab1[_0xbfd7('0xe')]=moment()['format'](_0xbfd7('0xf'));}_0x3cf120(null,_0x33dab1);}}});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x58fe6d,_0x33f94f){var _0x32309f=function(_0x2f8065){while(--_0x2f8065){_0x58fe6d['push'](_0x58fe6d['shift']());}};_0x32309f(++_0x33f94f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x2eb2[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33ddef,_0x3375d6,_0x419601){if(_0x33ddef[_0x22eb('0xb')](_0x22eb('0xc'))){_0x33ddef[_0x22eb('0xd')]=moment()['format'](_0x22eb('0xe'));}_0x419601(null,_0x33ddef);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c472b58..f48492d 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 _0x508a=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','where','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x433605,_0x18201b){var _0x1736c6=function(_0x1ac461){while(--_0x1ac461){_0x433605['push'](_0x433605['shift']());}};_0x1736c6(++_0x18201b);}(_0x508a,0x1da));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require(_0xa508('0x1'));var moment=require(_0xa508('0x2'));var BPromise=require(_0xa508('0x3'));var rs=require(_0xa508('0x4'));var fs=require('fs');var Redis=require(_0xa508('0x5'));var db=require(_0xa508('0x6'))['db'];var utils=require(_0xa508('0x7'));var logger=require(_0xa508('0x8'))(_0xa508('0x9'));var config=require('../../config/environment');var jayson=require(_0xa508('0xa'));var client=jayson[_0xa508('0xb')][_0xa508('0xc')]({'port':0x232a});config[_0xa508('0xd')]=_[_0xa508('0xe')](config[_0xa508('0xd')],{'host':_0xa508('0xf'),'port':0x18eb});var socket=require(_0xa508('0x10'))(new Redis(config[_0xa508('0xd')]));require(_0xa508('0x11'))[_0xa508('0x12')](socket);function respondWithRpcPromise(_0x461e1b,_0x2ee6,_0x103d56){return new BPromise(function(_0x38d5b8,_0x1ec018){return client[_0xa508('0x13')](_0x461e1b,_0x103d56)[_0xa508('0x14')](function(_0x143f95){logger[_0xa508('0x15')](_0xa508('0x16'),_0x2ee6,_0xa508('0x17'));logger[_0xa508('0x18')](_0xa508('0x19'),_0x2ee6,_0xa508('0x17'),JSON[_0xa508('0x1a')](_0x143f95));if(_0x143f95['error']){if(_0x143f95['error'][_0xa508('0x1b')]===0x1f4){logger[_0xa508('0x1c')](_0xa508('0x16'),_0x2ee6,_0x143f95[_0xa508('0x1c')]['message']);return _0x1ec018(_0x143f95[_0xa508('0x1c')][_0xa508('0x1d')]);}logger['error'](_0xa508('0x16'),_0x2ee6,_0x143f95[_0xa508('0x1c')][_0xa508('0x1d')]);return _0x38d5b8(_0x143f95[_0xa508('0x1c')]['message']);}else{logger[_0xa508('0x15')](_0xa508('0x16'),_0x2ee6,'request\x20sent');_0x38d5b8(_0x143f95[_0xa508('0x1e')][_0xa508('0x1d')]);}})[_0xa508('0x1f')](function(_0x16143c){logger[_0xa508('0x1c')](_0xa508('0x16'),_0x2ee6,_0x16143c);_0x1ec018(_0x16143c);});});}exports[_0xa508('0x20')]=function(_0x254240){var _0x2fea03=this;return new Promise(function(_0x29714d,_0x24aecc){return db[_0xa508('0x21')][_0xa508('0x22')](_0x254240[_0xa508('0x23')],{'raw':_0x254240['options']?_0x254240['options'][_0xa508('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254240[_0xa508('0x25')]?_0x254240[_0xa508('0x25')][_0xa508('0x26')]||null:null,'attributes':_0x254240[_0xa508('0x25')]?_0x254240[_0xa508('0x25')]['attributes']||null:null,'limit':_0x254240['options']?_0x254240[_0xa508('0x25')][_0xa508('0x27')]||null:null})[_0xa508('0x14')](function(_0x39a35a){logger[_0xa508('0x15')](_0xa508('0x20'),_0x254240);logger[_0xa508('0x18')]('UpdateOpenchannelInteraction',_0x254240,JSON['stringify'](_0x39a35a));_0x29714d(_0x39a35a);})[_0xa508('0x1f')](function(_0x396f7d){logger[_0xa508('0x1c')]('UpdateOpenchannelInteraction',_0x396f7d[_0xa508('0x1d')],_0x254240);_0x24aecc(_0x2fea03[_0xa508('0x1c')](0x1f4,_0x396f7d[_0xa508('0x1d')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x222fc3){return new Promise(function(_0x4adaed,_0x2ebe9c){return db[_0xa508('0x21')][_0xa508('0x28')]({'where':_0x222fc3[_0xa508('0x25')]?_0x222fc3['options'][_0xa508('0x26')]||null:null})['then'](function(_0x5e8bdc){if(_0x5e8bdc){return _0x5e8bdc[_0xa508('0x29')](_0x222fc3[_0xa508('0x23')][_0xa508('0x2a')],_[_0xa508('0x2b')](_0x222fc3[_0xa508('0x23')],[_0xa508('0x2a'),'id'])||{});}})[_0xa508('0x2c')](function(_0x5bba52){logger[_0xa508('0x15')](_0xa508('0x2d'),_0x222fc3);logger[_0xa508('0x18')](_0xa508('0x2d'),_0x222fc3,JSON[_0xa508('0x1a')](_0x5bba52));_0x4adaed(_0x5bba52);})[_0xa508('0x1f')](function(_0x3717cb){logger['error'](_0xa508('0x2d'),_0x3717cb[_0xa508('0x1d')],_0x222fc3);_0x2ebe9c(_this[_0xa508('0x1c')](0x1f4,_0x3717cb['message']));});});}; \ No newline at end of file +var _0xa163=['AddTagsToOpenchannelInteraction','find','body','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes'];(function(_0xae8375,_0x542d59){var _0x189cdf=function(_0x9215cf){while(--_0x9215cf){_0xae8375['push'](_0xae8375['shift']());}};_0x189cdf(++_0x542d59);}(_0xa163,0x12d));var _0x3a16=function(_0x50d83c,_0x2cea1d){_0x50d83c=_0x50d83c-0x0;var _0x12f92f=_0xa163[_0x50d83c];return _0x12f92f;};'use strict';var _=require(_0x3a16('0x0'));var util=require(_0x3a16('0x1'));var moment=require(_0x3a16('0x2'));var BPromise=require(_0x3a16('0x3'));var rs=require(_0x3a16('0x4'));var fs=require('fs');var Redis=require(_0x3a16('0x5'));var db=require(_0x3a16('0x6'))['db'];var utils=require(_0x3a16('0x7'));var logger=require(_0x3a16('0x8'))('rpc');var config=require(_0x3a16('0x9'));var jayson=require(_0x3a16('0xa'));var client=jayson[_0x3a16('0xb')][_0x3a16('0xc')]({'port':0x232a});config[_0x3a16('0xd')]=_['defaults'](config[_0x3a16('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a16('0xe'))(new Redis(config[_0x3a16('0xd')]));require(_0x3a16('0xf'))['register'](socket);function respondWithRpcPromise(_0x22ca7b,_0xc07920,_0x7fbb73){return new BPromise(function(_0x41c75d,_0xd88c86){return client[_0x3a16('0x10')](_0x22ca7b,_0x7fbb73)[_0x3a16('0x11')](function(_0x358725){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x3a16('0x12'));logger[_0x3a16('0x13')](_0x3a16('0x14'),_0xc07920,_0x3a16('0x12'),JSON[_0x3a16('0x15')](_0x358725));if(_0x358725[_0x3a16('0x16')]){if(_0x358725[_0x3a16('0x16')][_0x3a16('0x17')]===0x1f4){logger[_0x3a16('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x358725['error']['message']);return _0xd88c86(_0x358725[_0x3a16('0x16')]['message']);}logger[_0x3a16('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x358725[_0x3a16('0x16')]['message']);return _0x41c75d(_0x358725[_0x3a16('0x16')][_0x3a16('0x18')]);}else{logger[_0x3a16('0x19')](_0x3a16('0x1a'),_0xc07920,_0x3a16('0x12'));_0x41c75d(_0x358725[_0x3a16('0x1b')][_0x3a16('0x18')]);}})['catch'](function(_0x5e6a5e){logger[_0x3a16('0x16')](_0x3a16('0x1a'),_0xc07920,_0x5e6a5e);_0xd88c86(_0x5e6a5e);});});}exports[_0x3a16('0x1c')]=function(_0x2443a7){var _0x1a177c=this;return new Promise(function(_0x579cd5,_0x1c292a){return db[_0x3a16('0x1d')][_0x3a16('0x1e')](_0x2443a7['body'],{'raw':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7['options'][_0x3a16('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7['options'][_0x3a16('0x21')]||null:null,'attributes':_0x2443a7['options']?_0x2443a7[_0x3a16('0x1f')][_0x3a16('0x22')]||null:null,'limit':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7[_0x3a16('0x1f')]['limit']||null:null})[_0x3a16('0x11')](function(_0x30e75f){logger[_0x3a16('0x19')]('UpdateOpenchannelInteraction',_0x2443a7);logger[_0x3a16('0x13')](_0x3a16('0x1c'),_0x2443a7,JSON[_0x3a16('0x15')](_0x30e75f));_0x579cd5(_0x30e75f);})['catch'](function(_0x4241c2){logger[_0x3a16('0x16')](_0x3a16('0x1c'),_0x4241c2[_0x3a16('0x18')],_0x2443a7);_0x1c292a(_0x1a177c[_0x3a16('0x16')](0x1f4,_0x4241c2[_0x3a16('0x18')]));});});};exports[_0x3a16('0x23')]=function(_0x3dce3a){return new Promise(function(_0x97c78f,_0x2e52b6){return db[_0x3a16('0x1d')][_0x3a16('0x24')]({'where':_0x3dce3a['options']?_0x3dce3a[_0x3a16('0x1f')][_0x3a16('0x21')]||null:null})[_0x3a16('0x11')](function(_0xff0f8a){if(_0xff0f8a){return _0xff0f8a['addTags'](_0x3dce3a[_0x3a16('0x25')]['ids'],_['omit'](_0x3dce3a['body'],[_0x3a16('0x26'),'id'])||{});}})[_0x3a16('0x27')](function(_0x2e06e3){logger['info'](_0x3a16('0x28'),_0x3dce3a);logger[_0x3a16('0x13')]('AddTags',_0x3dce3a,JSON[_0x3a16('0x15')](_0x2e06e3));_0x97c78f(_0x2e06e3);})[_0x3a16('0x29')](function(_0x508e53){logger[_0x3a16('0x16')]('AddTags',_0x508e53['message'],_0x3dce3a);_0x2e52b6(_this[_0x3a16('0x16')](0x1f4,_0x508e53[_0x3a16('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7b4bffa..b9acac0 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 _0xc7b7=['length','openchannelInteraction:','save','update','emit','removeListener','register'];(function(_0x44ac5f,_0xbfa9f8){var _0x4624be=function(_0x377a3e){while(--_0x377a3e){_0x44ac5f['push'](_0x44ac5f['shift']());}};_0x4624be(++_0xbfa9f8);}(_0xc7b7,0xcd));var _0x7c7b=function(_0x49df93,_0x2bb7ac){_0x49df93=_0x49df93-0x0;var _0x471bac=_0xc7b7[_0x49df93];return _0x471bac;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7c7b('0x0'),'remove',_0x7c7b('0x1')];function createListener(_0x4d45dc,_0x1ae124){return function(_0x44c112){_0x1ae124[_0x7c7b('0x2')](_0x4d45dc,_0x44c112);};}function removeListener(_0x1e9b6f,_0x3c8d52){return function(){OpenchannelInteractionEvents[_0x7c7b('0x3')](_0x1e9b6f,_0x3c8d52);};}exports[_0x7c7b('0x4')]=function(_0x2f1372){for(var _0x4034c5=0x0,_0x27c67b=events[_0x7c7b('0x5')];_0x4034c5<_0x27c67b;_0x4034c5++){var _0x5c7b99=events[_0x4034c5];var _0x564f14=createListener(_0x7c7b('0x6')+_0x5c7b99,_0x2f1372);OpenchannelInteractionEvents['on'](_0x5c7b99,_0x564f14);}}; \ No newline at end of file +var _0x9cbe=['openchannelInteraction:','save','remove','emit','removeListener','register','length'];(function(_0x28e258,_0x3c296c){var _0x233ac6=function(_0x379183){while(--_0x379183){_0x28e258['push'](_0x28e258['shift']());}};_0x233ac6(++_0x3c296c);}(_0x9cbe,0x1eb));var _0xe9cb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9cbe[_0x46e363];return _0x3fb059;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xe9cb('0x0'),_0xe9cb('0x1'),'update'];function createListener(_0x2e4d65,_0x5d0430){return function(_0x3c3e4b){_0x5d0430[_0xe9cb('0x2')](_0x2e4d65,_0x3c3e4b);};}function removeListener(_0xbec405,_0x25299e){return function(){OpenchannelInteractionEvents[_0xe9cb('0x3')](_0xbec405,_0x25299e);};}exports[_0xe9cb('0x4')]=function(_0x4e08ec){for(var _0x50b9bf=0x0,_0x3562d8=events[_0xe9cb('0x5')];_0x50b9bf<_0x3562d8;_0x50b9bf++){var _0x401f59=events[_0x50b9bf];var _0x10f78a=createListener(_0xe9cb('0x6')+_0x401f59,_0x4e08ec);OpenchannelInteractionEvents['on'](_0x401f59,_0x10f78a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3a313aa..ebe7ab7 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 _0xbaf4=['put','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0xbaf4,0x1e6));var _0x4baf=function(_0x1959af,_0x4784c6){_0x1959af=_0x1959af-0x0;var _0xe7eaf6=_0xbaf4[_0x1959af];return _0xe7eaf6;};'use strict';var multer=require(_0x4baf('0x0'));var util=require('util');var path=require(_0x4baf('0x1'));var timeout=require(_0x4baf('0x2'));var express=require(_0x4baf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4baf('0x4'));var config=require(_0x4baf('0x5'));var controller=require(_0x4baf('0x6'));router['get']('/',auth[_0x4baf('0x7')](),controller[_0x4baf('0x8')]);router[_0x4baf('0x9')](_0x4baf('0xa'),auth[_0x4baf('0x7')](),controller[_0x4baf('0xb')]);router['get'](_0x4baf('0xc'),auth['isAuthenticated'](),controller[_0x4baf('0xd')]);router[_0x4baf('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4baf('0xf'),_0x4baf('0x10')),controller[_0x4baf('0x11')]);router['put'](_0x4baf('0xc'),auth[_0x4baf('0x7')](),controller['update']);router[_0x4baf('0x12')]('/:id/accept',auth[_0x4baf('0x7')](),controller[_0x4baf('0x13')]);router[_0x4baf('0x12')](_0x4baf('0x14'),auth[_0x4baf('0x7')](),controller[_0x4baf('0x15')]);router[_0x4baf('0x16')](_0x4baf('0xc'),auth[_0x4baf('0x7')](),controller['destroy']);module[_0x4baf('0x17')]=router; \ No newline at end of file +var _0x8f98=['show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','describe','/:id'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x8f98,0x1e8));var _0x88f9=function(_0x4ef4d3,_0x22f87d){_0x4ef4d3=_0x4ef4d3-0x0;var _0x422a0e=_0x8f98[_0x4ef4d3];return _0x422a0e;};'use strict';var multer=require(_0x88f9('0x0'));var util=require(_0x88f9('0x1'));var path=require(_0x88f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x88f9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x88f9('0x4'));var config=require(_0x88f9('0x5'));var controller=require(_0x88f9('0x6'));router[_0x88f9('0x7')]('/',auth['isAuthenticated'](),controller[_0x88f9('0x8')]);router['get'](_0x88f9('0x9'),auth['isAuthenticated'](),controller[_0x88f9('0xa')]);router[_0x88f9('0x7')](_0x88f9('0xb'),auth['isAuthenticated'](),controller[_0x88f9('0xc')]);router[_0x88f9('0xd')]('/',auth[_0x88f9('0xe')](),interaction[_0x88f9('0xf')](_0x88f9('0x10'),_0x88f9('0x11')),controller['create']);router[_0x88f9('0x12')](_0x88f9('0xb'),auth[_0x88f9('0xe')](),controller[_0x88f9('0x13')]);router['put']('/:id/accept',auth[_0x88f9('0xe')](),controller[_0x88f9('0x14')]);router['put'](_0x88f9('0x15'),auth[_0x88f9('0xe')](),controller['reject']);router[_0x88f9('0x16')](_0x88f9('0xb'),auth[_0x88f9('0xe')](),controller[_0x88f9('0x17')]);module[_0x88f9('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5f6b55b..4497440 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 _0xb524=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xb524,0x132));var _0x4b52=function(_0x5817d8,_0x22c438){_0x5817d8=_0x5817d8-0x0;var _0x40505f=_0xb524[_0x5817d8];return _0x40505f;};'use strict';var Sequelize=require(_0x4b52('0x0'));module['exports']={'body':{'type':Sequelize[_0x4b52('0x1')](_0x4b52('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4b52('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4b52('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b52('0x4')]('in',_0x4b52('0x5')),'defaultValue':_0x4b52('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4b52('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4b52('0x1')]}}; \ No newline at end of file +var _0xc239=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x309540,_0x1b49b0){var _0x168416=function(_0x540219){while(--_0x540219){_0x309540['push'](_0x309540['shift']());}};_0x168416(++_0x1b49b0);}(_0xc239,0xc7));var _0x9c23=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xc239[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0x9c23('0x0'));module[_0x9c23('0x1')]={'body':{'type':Sequelize[_0x9c23('0x2')](_0x9c23('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9c23('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9c23('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c23('0x5')]('in','out'),'defaultValue':_0x9c23('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9c23('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9c23('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 20ab180..da779b3 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 _0x38a5=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','intersection','options','body','find','describe','openchannel','read','readAt','format','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','openchannel-interactions','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x151b2a,_0x2b88b8){var _0x5c2c04=function(_0x1786d0){while(--_0x1786d0){_0x151b2a['push'](_0x151b2a['shift']());}};_0x5c2c04(++_0x2b88b8);}(_0x38a5,0x69));var _0x538a=function(_0x1d37f7,_0x4ff671){_0x1d37f7=_0x1d37f7-0x0;var _0x1521de=_0x38a5[_0x1d37f7];return _0x1521de;};'use strict';var pdf=require(_0x538a('0x0'));var emlformat=require(_0x538a('0x1'));var rimraf=require(_0x538a('0x2'));var zipdir=require(_0x538a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x538a('0x4'));var moment=require(_0x538a('0x5'));var BPromise=require(_0x538a('0x6'));var Mustache=require(_0x538a('0x7'));var util=require(_0x538a('0x8'));var path=require(_0x538a('0x9'));var sox=require(_0x538a('0xa'));var csv=require(_0x538a('0xb'));var ejs=require(_0x538a('0xc'));var fs=require('fs');var _=require(_0x538a('0xd'));var squel=require(_0x538a('0xe'));var crypto=require(_0x538a('0xf'));var jsforce=require(_0x538a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538a('0x11'));var Papa=require(_0x538a('0x12'));var Redis=require(_0x538a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x538a('0x14'));var as=require(_0x538a('0x15'));var hardwareService=require(_0x538a('0x16'));var logger=require(_0x538a('0x17'))(_0x538a('0x18'));var utils=require(_0x538a('0x19'));var config=require(_0x538a('0x1a'));var licenseUtil=require(_0x538a('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x538a('0x1c')](config[_0x538a('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x538a('0x1d')]));require(_0x538a('0x1e'))[_0x538a('0x1f')](socket);var jayson=require(_0x538a('0x20'));var client=jayson[_0x538a('0x21')][_0x538a('0x22')]({'port':0x232c});var client9002=jayson[_0x538a('0x21')][_0x538a('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4c8fe1,_0xe56b7b,_0x29d92e,_0x3e1263){return new BPromise(function(_0x547adf,_0x4c0a3e){var _0x485be0=_0x3e1263||client;return _0x485be0['request'](_0x4c8fe1,_0x29d92e)[_0x538a('0x23')](function(_0x344b64){logger[_0x538a('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xe56b7b,_0x538a('0x25'));logger[_0x538a('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe56b7b,_0x538a('0x25'),JSON[_0x538a('0x27')](_0x344b64));if(_0x344b64[_0x538a('0x28')]){if(_0x344b64[_0x538a('0x28')][_0x538a('0x29')]===0x1f4){logger['error'](_0x538a('0x2a'),_0xe56b7b,_0x344b64[_0x538a('0x28')]['message']);return _0x4c0a3e(_0x344b64[_0x538a('0x28')][_0x538a('0x2b')]);}logger[_0x538a('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0xe56b7b,_0x344b64[_0x538a('0x28')]['message']);return _0x547adf(_0x344b64[_0x538a('0x28')]['message']);}else{logger[_0x538a('0x24')](_0x538a('0x2a'),_0xe56b7b,'request\x20sent');_0x547adf(_0x344b64[_0x538a('0x2c')][_0x538a('0x2b')]);}})[_0x538a('0x2d')](function(_0x52824a){logger[_0x538a('0x28')](_0x538a('0x2a'),_0xe56b7b,_0x52824a);_0x4c0a3e(_0x52824a);});});}function respondWithStatusCode(_0x412209,_0x5c7874){_0x5c7874=_0x5c7874||0xcc;return function(_0x4f2188){if(_0x4f2188){return _0x412209[_0x538a('0x2e')](_0x5c7874);}return _0x412209['status'](_0x5c7874)['end']();};}function respondWithResult(_0x5523f9,_0x3ec7d4){_0x3ec7d4=_0x3ec7d4||0xc8;return function(_0x35ef91){if(_0x35ef91){return _0x5523f9[_0x538a('0x2f')](_0x3ec7d4)[_0x538a('0x30')](_0x35ef91);}};}function respondWithFilteredResult(_0x430b46,_0x42068a){return function(_0x4d5ece){if(_0x4d5ece){var _0x55b5c6=_0x4d5ece[_0x538a('0x31')],_0x3cc681=_0x42068a[_0x538a('0x32')],_0x5e6965=_0x42068a['offset']+_0x42068a[_0x538a('0x33')],_0x36a852;if(_0x5e6965>=_0x55b5c6){_0x5e6965=_0x55b5c6;_0x36a852=0xc8;}else{_0x36a852=0xce;}_0x430b46[_0x538a('0x2f')](_0x36a852);return _0x430b46[_0x538a('0x34')](_0x538a('0x35'),_0x3cc681+'-'+_0x5e6965+'/'+_0x55b5c6)[_0x538a('0x30')](_0x4d5ece);}return null;};}function patchUpdates(_0x20f1a0){return function(_0x55d808){try{jsonpatch[_0x538a('0x36')](_0x55d808,_0x20f1a0,!![]);}catch(_0x4b0ef1){return BPromise[_0x538a('0x37')](_0x4b0ef1);}return _0x55d808[_0x538a('0x38')]();};}function saveUpdates(_0x19d9a2,_0x2b36bf){return function(_0x210af5){if(_0x210af5){return _0x210af5[_0x538a('0x39')](_0x19d9a2)['then'](function(_0x5bfae1){return _0x5bfae1;});}return null;};}function removeEntity(_0x5de910,_0x18f72c){return function(_0x146bcf){if(_0x146bcf){return _0x146bcf[_0x538a('0x3a')]()[_0x538a('0x23')](function(){_0x5de910[_0x538a('0x2f')](0xcc)[_0x538a('0x3b')]();});}};}function handleEntityNotFound(_0x240f85,_0x383fb3){return function(_0x385b72){if(!_0x385b72){_0x240f85[_0x538a('0x2e')](0x194);}return _0x385b72;};}function handleError(_0x402c08,_0xe120f9){_0xe120f9=_0xe120f9||0x1f4;return function(_0x283776){logger[_0x538a('0x28')](_0x283776[_0x538a('0x3c')]);if(_0x283776[_0x538a('0x3d')]){delete _0x283776[_0x538a('0x3d')];}_0x402c08['status'](_0xe120f9)[_0x538a('0x3e')](_0x283776);};}exports['index']=function(_0x53205d,_0x462518){var _0x246ab9={},_0x25a3c4={},_0x5029f4={'count':0x0,'rows':[]};var _0x370966=_[_0x538a('0x3f')](db[_0x538a('0x40')][_0x538a('0x41')],function(_0x30aaf0){return{'name':_0x30aaf0[_0x538a('0x42')],'type':_0x30aaf0[_0x538a('0x43')]['key']};});_0x25a3c4[_0x538a('0x44')]=_[_0x538a('0x3f')](_0x370966,_0x538a('0x3d'));_0x25a3c4[_0x538a('0x45')]=_['keys'](_0x53205d[_0x538a('0x45')]);_0x25a3c4[_0x538a('0x46')]=_['intersection'](_0x25a3c4['model'],_0x25a3c4[_0x538a('0x45')]);_0x246ab9[_0x538a('0x47')]=_['intersection'](_0x25a3c4[_0x538a('0x44')],qs[_0x538a('0x48')](_0x53205d[_0x538a('0x45')]['fields']));_0x246ab9['attributes']=_0x246ab9[_0x538a('0x47')][_0x538a('0x49')]?_0x246ab9['attributes']:_0x25a3c4[_0x538a('0x44')];if(!_0x53205d['query'][_0x538a('0x4a')](_0x538a('0x4b'))){_0x246ab9['limit']=qs[_0x538a('0x33')](_0x53205d['query']['limit']);_0x246ab9['offset']=qs[_0x538a('0x32')](_0x53205d[_0x538a('0x45')][_0x538a('0x32')]);}_0x246ab9[_0x538a('0x4c')]=qs['sort'](_0x53205d[_0x538a('0x45')][_0x538a('0x4d')]);_0x246ab9[_0x538a('0x4e')]=qs['filters'](_['pick'](_0x53205d['query'],_0x25a3c4[_0x538a('0x46')]),_0x370966);if(_0x53205d['query'][_0x538a('0x4f')]){_0x246ab9['where']=_[_0x538a('0x50')](_0x246ab9[_0x538a('0x4e')],{'$or':_[_0x538a('0x3f')](_0x370966,function(_0x3e5b12){if(_0x3e5b12[_0x538a('0x43')]!==_0x538a('0x51')){var _0x6ad0b7={};_0x6ad0b7[_0x3e5b12[_0x538a('0x3d')]]={'$like':'%'+_0x53205d['query'][_0x538a('0x4f')]+'%'};return _0x6ad0b7;}})});}_0x246ab9=_[_0x538a('0x50')]({},_0x246ab9,_0x53205d['options']);var _0x4f202b={'where':_0x246ab9[_0x538a('0x4e')]};return db[_0x538a('0x40')]['count'](_0x4f202b)[_0x538a('0x23')](function(_0x3b8e11){_0x5029f4[_0x538a('0x31')]=_0x3b8e11;if(_0x53205d[_0x538a('0x45')][_0x538a('0x52')]){_0x246ab9['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x538a('0x53')](_0x246ab9);})[_0x538a('0x23')](function(_0x4f32d5){_0x5029f4[_0x538a('0x54')]=_0x4f32d5;return _0x5029f4;})[_0x538a('0x23')](respondWithFilteredResult(_0x462518,_0x246ab9))[_0x538a('0x2d')](handleError(_0x462518,null));};exports[_0x538a('0x55')]=function(_0x3b7ff7,_0x88b8ef){var _0x56e8e5={'raw':!![],'where':{'id':_0x3b7ff7[_0x538a('0x56')]['id']}},_0x2657d5={};_0x2657d5[_0x538a('0x44')]=_[_0x538a('0x57')](db['OpenchannelMessage']['rawAttributes']);_0x2657d5[_0x538a('0x45')]=_[_0x538a('0x57')](_0x3b7ff7[_0x538a('0x45')]);_0x2657d5[_0x538a('0x46')]=_['intersection'](_0x2657d5[_0x538a('0x44')],_0x2657d5[_0x538a('0x45')]);_0x56e8e5[_0x538a('0x47')]=_[_0x538a('0x58')](_0x2657d5[_0x538a('0x44')],qs['fields'](_0x3b7ff7[_0x538a('0x45')][_0x538a('0x48')]));_0x56e8e5[_0x538a('0x47')]=_0x56e8e5[_0x538a('0x47')][_0x538a('0x49')]?_0x56e8e5[_0x538a('0x47')]:_0x2657d5['model'];if(_0x3b7ff7[_0x538a('0x45')][_0x538a('0x52')]){_0x56e8e5['include']=[{'all':!![]}];}_0x56e8e5=_['merge']({},_0x56e8e5,_0x3b7ff7[_0x538a('0x59')]);return db[_0x538a('0x40')]['find'](_0x56e8e5)[_0x538a('0x23')](handleEntityNotFound(_0x88b8ef,null))[_0x538a('0x23')](respondWithResult(_0x88b8ef,null))[_0x538a('0x2d')](handleError(_0x88b8ef,null));};exports['create']=function(_0x21470f,_0x4415f8){return db['OpenchannelMessage']['create'](_0x21470f[_0x538a('0x5a')],{})[_0x538a('0x23')](respondWithResult(_0x4415f8,0xc9))[_0x538a('0x2d')](handleError(_0x4415f8,null));};exports[_0x538a('0x39')]=function(_0x199a53,_0x53a93f){if(_0x199a53[_0x538a('0x5a')]['id']){delete _0x199a53[_0x538a('0x5a')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x199a53['params']['id']}})['then'](handleEntityNotFound(_0x53a93f,null))[_0x538a('0x23')](saveUpdates(_0x199a53[_0x538a('0x5a')],null))[_0x538a('0x23')](respondWithResult(_0x53a93f,null))[_0x538a('0x2d')](handleError(_0x53a93f,null));};exports[_0x538a('0x3a')]=function(_0x3b294e,_0x24cc7a){return db[_0x538a('0x40')][_0x538a('0x5b')]({'where':{'id':_0x3b294e[_0x538a('0x56')]['id']}})[_0x538a('0x23')](handleEntityNotFound(_0x24cc7a,null))['then'](removeEntity(_0x24cc7a,null))['catch'](handleError(_0x24cc7a,null));};exports['describe']=function(_0x1ddc48,_0x32111e){return db[_0x538a('0x40')][_0x538a('0x5c')]()[_0x538a('0x23')](respondWithResult(_0x32111e,null))[_0x538a('0x2d')](handleError(_0x32111e,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x2400d2,_0x2f4d21,_0x2e0420){var _0xb7f9fa={'channel':_0x538a('0x5d')};if(_0x2400d2[_0x538a('0x5a')]['id']){delete _0x2400d2['body']['id'];}_0x2400d2[_0x538a('0x5a')][_0x538a('0x5e')]=!![];_0x2400d2[_0x538a('0x5a')][_0x538a('0x5f')]=moment()[_0x538a('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2400d2[_0x538a('0x5a')]['UserId']=_0x2400d2[_0x538a('0x5a')][_0x538a('0x61')]||_0x2400d2[_0x538a('0x62')]['id'];return db[_0x538a('0x40')]['find']({'where':{'id':_0x2400d2[_0x538a('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x538a('0x63')}]})['then'](handleEntityNotFound(_0x2f4d21,null))[_0x538a('0x23')](saveUpdates(_0x2400d2['body'],null))['then'](function(_0x2b1550){if(_0x2b1550){_0xb7f9fa['message']=_0x2b1550[_0x538a('0x64')]({'plain':!![]});return db[_0x538a('0x65')][_0x538a('0x5b')]({'where':{'id':_0x2b1550[_0x538a('0x66')]}});}return null;})[_0x538a('0x23')](handleEntityNotFound(_0x2f4d21,null))[_0x538a('0x23')](function(_0x40a652){if(_0x40a652){return _0x40a652[_0x538a('0x39')]({'UserId':_0x2400d2[_0x538a('0x5a')]['UserId'],'read1stAt':_[_0x538a('0x67')](_0x40a652[_0x538a('0x68')])?moment()['format'](_0x538a('0x69')):undefined});}return null;})[_0x538a('0x23')](function(_0x328bcf){if(_0x328bcf){_0xb7f9fa[_0x538a('0x6a')]=_0x328bcf[_0x538a('0x64')]({'plain':!![]});interaction_log[_0x538a('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2400d2[_0x538a('0x62')]['id'],_0x2400d2['user'][_0x538a('0x3d')],_0x2400d2[_0x538a('0x62')]['role'],_0xb7f9fa[_0x538a('0x6a')]['id'],_0x2400d2['body']?JSON[_0x538a('0x27')](_0x2400d2['body']):_0x538a('0x6b'));return respondWithRpcPromise(_0x538a('0x6c'),_0x538a('0x6d'),_0xb7f9fa);}return null;})['then'](function(_0x36115f){if(_0x36115f){if(_0x2400d2[_0x538a('0x5a')][_0x538a('0x6e')]){_0xb7f9fa[_0x538a('0x2b')]['interface']=util[_0x538a('0x60')]('SIP/%s',_0x2400d2[_0x538a('0x62')]['name']);_0xb7f9fa[_0x538a('0x2b')][_0x538a('0x6f')]=_0xb7f9fa['channel'];_0xb7f9fa[_0x538a('0x2b')][_0x538a('0x70')]='accept';return respondWithRpcPromise(_0x538a('0x71'),_0x538a('0x71'),{'event':'acceptmessage','message':_0xb7f9fa[_0x538a('0x2b')]},client9002)['then'](function(){return _0xb7f9fa;});}return _0xb7f9fa;}return null;})[_0x538a('0x23')](respondWithResult(_0x2f4d21,null))[_0x538a('0x2d')](handleError(_0x2f4d21,null));};var interaction_log=require(_0x538a('0x17'))(_0x538a('0x72'));exports['reject']=function(_0xcb3771,_0x20491f,_0x1a5c8f){var _0x4854e6={'agent':{},'channel':_0x538a('0x5d')};if(_0xcb3771['body']['id']){delete _0xcb3771['body']['id'];}_0xcb3771[_0x538a('0x5a')]['UserId']=_0xcb3771[_0x538a('0x5a')][_0x538a('0x61')]||_0xcb3771['user']['id'];_0x4854e6[_0x538a('0x73')]['id']=_0xcb3771['body'][_0x538a('0x61')];return db[_0x538a('0x40')][_0x538a('0x5b')]({'where':{'id':_0xcb3771[_0x538a('0x56')]['id'],'UserId':null}})[_0x538a('0x23')](handleEntityNotFound(_0x20491f,null))['then'](function(_0x3a2a79){if(_0x3a2a79){_0x4854e6[_0x538a('0x2b')]=_0x3a2a79[_0x538a('0x64')]({'plain':!![]});return db[_0x538a('0x65')][_0x538a('0x5b')]({'where':{'id':_0x3a2a79[_0x538a('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x20491f,null))[_0x538a('0x23')](function(_0x161680){if(_0x161680){_0x4854e6[_0x538a('0x6a')]=_0x161680[_0x538a('0x64')]({'plain':!![]});interaction_log[_0x538a('0x24')](_0x538a('0x74'),_0xcb3771[_0x538a('0x62')]['id'],_0xcb3771[_0x538a('0x62')][_0x538a('0x3d')],_0xcb3771['user'][_0x538a('0x75')],_0x4854e6['interaction']['id'],_0xcb3771[_0x538a('0x5a')]?JSON[_0x538a('0x27')](_0xcb3771[_0x538a('0x5a')]):_0x538a('0x6b'));return respondWithRpcPromise(_0x538a('0x76'),'rejectMessage',_0x4854e6);}return null;})[_0x538a('0x23')](function(_0x41bdab){if(_0x41bdab){_0x41bdab['message']['interface']=util['format'](_0x538a('0x77'),_0xcb3771['user']['name']);_0x41bdab[_0x538a('0x2b')][_0x538a('0x6f')]=_0x4854e6[_0x538a('0x6f')];_0x41bdab[_0x538a('0x2b')][_0x538a('0x70')]=_0x538a('0x37');respondWithRpcPromise(_0x538a('0x71'),_0x538a('0x71'),{'event':_0x538a('0x78'),'message':_0x41bdab['message']},client9002);return _0x4854e6;}return null;})['then'](respondWithResult(_0x20491f,null))[_0x538a('0x2d')](handleError(_0x20491f,null));}; \ No newline at end of file +var _0x7948=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','count','offset','limit','set','json','reject','save','update','destroy','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','type','filter','includeAll','include','findAll','rows','show','params','keys','intersection','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir'];(function(_0xb93450,_0x17605b){var _0x54387d=function(_0x5e9795){while(--_0x5e9795){_0xb93450['push'](_0xb93450['shift']());}};_0x54387d(++_0x17605b);}(_0x7948,0x185));var _0x8794=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x7948[_0x1911ed];return _0x11edaa;};'use strict';var pdf=require(_0x8794('0x0'));var emlformat=require(_0x8794('0x1'));var rimraf=require(_0x8794('0x2'));var zipdir=require(_0x8794('0x3'));var jsonpatch=require(_0x8794('0x4'));var rp=require(_0x8794('0x5'));var moment=require(_0x8794('0x6'));var BPromise=require(_0x8794('0x7'));var Mustache=require(_0x8794('0x8'));var util=require(_0x8794('0x9'));var path=require(_0x8794('0xa'));var sox=require(_0x8794('0xb'));var csv=require(_0x8794('0xc'));var ejs=require(_0x8794('0xd'));var fs=require('fs');var _=require(_0x8794('0xe'));var squel=require(_0x8794('0xf'));var crypto=require(_0x8794('0x10'));var jsforce=require(_0x8794('0x11'));var deskjs=require(_0x8794('0x12'));var toCsv=require(_0x8794('0xc'));var querystring=require(_0x8794('0x13'));var Papa=require(_0x8794('0x14'));var Redis=require(_0x8794('0x15'));var authService=require(_0x8794('0x16'));var qs=require(_0x8794('0x17'));var as=require(_0x8794('0x18'));var hardwareService=require(_0x8794('0x19'));var logger=require(_0x8794('0x1a'))(_0x8794('0x1b'));var utils=require(_0x8794('0x1c'));var config=require(_0x8794('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x8794('0x1e'))['db'];config[_0x8794('0x1f')]=_[_0x8794('0x20')](config[_0x8794('0x1f')],{'host':_0x8794('0x21'),'port':0x18eb});var socket=require(_0x8794('0x22'))(new Redis(config[_0x8794('0x1f')]));require(_0x8794('0x23'))[_0x8794('0x24')](socket);var jayson=require(_0x8794('0x25'));var client=jayson[_0x8794('0x26')][_0x8794('0x27')]({'port':0x232c});var client9002=jayson[_0x8794('0x26')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7500eb,_0x4f8b21,_0x5623d7,_0x31f66c){return new BPromise(function(_0x8b862a,_0x247365){var _0x4b240b=_0x31f66c||client;return _0x4b240b[_0x8794('0x28')](_0x7500eb,_0x5623d7)[_0x8794('0x29')](function(_0x46be4d){logger['info'](_0x8794('0x2a'),_0x4f8b21,_0x8794('0x2b'));logger[_0x8794('0x2c')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4f8b21,_0x8794('0x2b'),JSON[_0x8794('0x2d')](_0x46be4d));if(_0x46be4d[_0x8794('0x2e')]){if(_0x46be4d['error'][_0x8794('0x2f')]===0x1f4){logger['error'](_0x8794('0x2a'),_0x4f8b21,_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);return _0x247365(_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);}logger[_0x8794('0x2e')](_0x8794('0x2a'),_0x4f8b21,_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);return _0x8b862a(_0x46be4d[_0x8794('0x2e')]['message']);}else{logger[_0x8794('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f8b21,_0x8794('0x2b'));_0x8b862a(_0x46be4d[_0x8794('0x32')]['message']);}})[_0x8794('0x33')](function(_0x50bf48){logger[_0x8794('0x2e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f8b21,_0x50bf48);_0x247365(_0x50bf48);});});}function respondWithStatusCode(_0x1f56f6,_0x5452dd){_0x5452dd=_0x5452dd||0xcc;return function(_0x17cbd2){if(_0x17cbd2){return _0x1f56f6[_0x8794('0x34')](_0x5452dd);}return _0x1f56f6[_0x8794('0x35')](_0x5452dd)['end']();};}function respondWithResult(_0x5e3afc,_0x4214d2){_0x4214d2=_0x4214d2||0xc8;return function(_0x3d6c3a){if(_0x3d6c3a){return _0x5e3afc[_0x8794('0x35')](_0x4214d2)['json'](_0x3d6c3a);}};}function respondWithFilteredResult(_0x1044b9,_0x536fed){return function(_0x4cb01c){if(_0x4cb01c){var _0x2c357b=_0x4cb01c[_0x8794('0x36')],_0x25f9f6=_0x536fed['offset'],_0x7ca073=_0x536fed[_0x8794('0x37')]+_0x536fed[_0x8794('0x38')],_0x45bbde;if(_0x7ca073>=_0x2c357b){_0x7ca073=_0x2c357b;_0x45bbde=0xc8;}else{_0x45bbde=0xce;}_0x1044b9[_0x8794('0x35')](_0x45bbde);return _0x1044b9[_0x8794('0x39')]('Content-Range',_0x25f9f6+'-'+_0x7ca073+'/'+_0x2c357b)[_0x8794('0x3a')](_0x4cb01c);}return null;};}function patchUpdates(_0x1b867c){return function(_0x57aaea){try{jsonpatch['apply'](_0x57aaea,_0x1b867c,!![]);}catch(_0xcbf239){return BPromise[_0x8794('0x3b')](_0xcbf239);}return _0x57aaea[_0x8794('0x3c')]();};}function saveUpdates(_0x455278,_0x4e1844){return function(_0x588297){if(_0x588297){return _0x588297[_0x8794('0x3d')](_0x455278)[_0x8794('0x29')](function(_0x1da4a2){return _0x1da4a2;});}return null;};}function removeEntity(_0x18a1a7,_0xcac6cd){return function(_0x5fcd1e){if(_0x5fcd1e){return _0x5fcd1e[_0x8794('0x3e')]()[_0x8794('0x29')](function(){_0x18a1a7[_0x8794('0x35')](0xcc)[_0x8794('0x3f')]();});}};}function handleEntityNotFound(_0x35e1a7,_0x5ba80f){return function(_0x3e149b){if(!_0x3e149b){_0x35e1a7[_0x8794('0x34')](0x194);}return _0x3e149b;};}function handleError(_0x18530d,_0x249921){_0x249921=_0x249921||0x1f4;return function(_0x5f2464){logger['error'](_0x5f2464[_0x8794('0x40')]);if(_0x5f2464[_0x8794('0x41')]){delete _0x5f2464[_0x8794('0x41')];}_0x18530d[_0x8794('0x35')](_0x249921)[_0x8794('0x42')](_0x5f2464);};}exports[_0x8794('0x43')]=function(_0x3ef23e,_0x42cbe8){var _0x58bfe7={},_0x32c443={},_0x426860={'count':0x0,'rows':[]};var _0x279a01=_['map'](db[_0x8794('0x44')][_0x8794('0x45')],function(_0xd99acb){return{'name':_0xd99acb[_0x8794('0x46')],'type':_0xd99acb['type'][_0x8794('0x47')]};});_0x32c443[_0x8794('0x48')]=_[_0x8794('0x49')](_0x279a01,_0x8794('0x41'));_0x32c443[_0x8794('0x4a')]=_['keys'](_0x3ef23e[_0x8794('0x4a')]);_0x32c443['filters']=_['intersection'](_0x32c443[_0x8794('0x48')],_0x32c443[_0x8794('0x4a')]);_0x58bfe7[_0x8794('0x4b')]=_['intersection'](_0x32c443[_0x8794('0x48')],qs[_0x8794('0x4c')](_0x3ef23e[_0x8794('0x4a')][_0x8794('0x4c')]));_0x58bfe7['attributes']=_0x58bfe7[_0x8794('0x4b')]['length']?_0x58bfe7[_0x8794('0x4b')]:_0x32c443[_0x8794('0x48')];if(!_0x3ef23e[_0x8794('0x4a')][_0x8794('0x4d')](_0x8794('0x4e'))){_0x58bfe7['limit']=qs[_0x8794('0x38')](_0x3ef23e['query'][_0x8794('0x38')]);_0x58bfe7['offset']=qs[_0x8794('0x37')](_0x3ef23e[_0x8794('0x4a')]['offset']);}_0x58bfe7[_0x8794('0x4f')]=qs[_0x8794('0x50')](_0x3ef23e[_0x8794('0x4a')][_0x8794('0x50')]);_0x58bfe7['where']=qs['filters'](_[_0x8794('0x51')](_0x3ef23e[_0x8794('0x4a')],_0x32c443[_0x8794('0x52')]),_0x279a01);if(_0x3ef23e[_0x8794('0x4a')]['filter']){_0x58bfe7['where']=_[_0x8794('0x53')](_0x58bfe7[_0x8794('0x54')],{'$or':_[_0x8794('0x49')](_0x279a01,function(_0x2ebfbe){if(_0x2ebfbe[_0x8794('0x55')]!=='VIRTUAL'){var _0x53f7fe={};_0x53f7fe[_0x2ebfbe[_0x8794('0x41')]]={'$like':'%'+_0x3ef23e['query'][_0x8794('0x56')]+'%'};return _0x53f7fe;}})});}_0x58bfe7=_[_0x8794('0x53')]({},_0x58bfe7,_0x3ef23e['options']);var _0xe59546={'where':_0x58bfe7[_0x8794('0x54')]};return db[_0x8794('0x44')][_0x8794('0x36')](_0xe59546)[_0x8794('0x29')](function(_0x25857d){_0x426860['count']=_0x25857d;if(_0x3ef23e[_0x8794('0x4a')][_0x8794('0x57')]){_0x58bfe7[_0x8794('0x58')]=[{'all':!![]}];}return db[_0x8794('0x44')][_0x8794('0x59')](_0x58bfe7);})['then'](function(_0x25e896){_0x426860[_0x8794('0x5a')]=_0x25e896;return _0x426860;})[_0x8794('0x29')](respondWithFilteredResult(_0x42cbe8,_0x58bfe7))[_0x8794('0x33')](handleError(_0x42cbe8,null));};exports[_0x8794('0x5b')]=function(_0x337aa9,_0x211a19){var _0x2b7512={'raw':!![],'where':{'id':_0x337aa9[_0x8794('0x5c')]['id']}},_0x5310a2={};_0x5310a2[_0x8794('0x48')]=_[_0x8794('0x5d')](db[_0x8794('0x44')][_0x8794('0x45')]);_0x5310a2[_0x8794('0x4a')]=_[_0x8794('0x5d')](_0x337aa9[_0x8794('0x4a')]);_0x5310a2[_0x8794('0x52')]=_[_0x8794('0x5e')](_0x5310a2[_0x8794('0x48')],_0x5310a2[_0x8794('0x4a')]);_0x2b7512['attributes']=_['intersection'](_0x5310a2['model'],qs[_0x8794('0x4c')](_0x337aa9[_0x8794('0x4a')][_0x8794('0x4c')]));_0x2b7512['attributes']=_0x2b7512[_0x8794('0x4b')]['length']?_0x2b7512[_0x8794('0x4b')]:_0x5310a2['model'];if(_0x337aa9[_0x8794('0x4a')]['includeAll']){_0x2b7512[_0x8794('0x58')]=[{'all':!![]}];}_0x2b7512=_['merge']({},_0x2b7512,_0x337aa9[_0x8794('0x5f')]);return db[_0x8794('0x44')][_0x8794('0x60')](_0x2b7512)['then'](handleEntityNotFound(_0x211a19,null))['then'](respondWithResult(_0x211a19,null))[_0x8794('0x33')](handleError(_0x211a19,null));};exports[_0x8794('0x61')]=function(_0x3f7785,_0x2997d1){return db[_0x8794('0x44')][_0x8794('0x61')](_0x3f7785['body'],{})[_0x8794('0x29')](respondWithResult(_0x2997d1,0xc9))[_0x8794('0x33')](handleError(_0x2997d1,null));};exports[_0x8794('0x3d')]=function(_0x14f2a5,_0x2fdc78){if(_0x14f2a5[_0x8794('0x62')]['id']){delete _0x14f2a5['body']['id'];}return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x14f2a5[_0x8794('0x5c')]['id']}})[_0x8794('0x29')](handleEntityNotFound(_0x2fdc78,null))['then'](saveUpdates(_0x14f2a5[_0x8794('0x62')],null))['then'](respondWithResult(_0x2fdc78,null))[_0x8794('0x33')](handleError(_0x2fdc78,null));};exports[_0x8794('0x3e')]=function(_0x226466,_0x202dfe){return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x226466['params']['id']}})[_0x8794('0x29')](handleEntityNotFound(_0x202dfe,null))[_0x8794('0x29')](removeEntity(_0x202dfe,null))[_0x8794('0x33')](handleError(_0x202dfe,null));};exports[_0x8794('0x63')]=function(_0x540898,_0x53d0dd){return db['OpenchannelMessage'][_0x8794('0x63')]()['then'](respondWithResult(_0x53d0dd,null))[_0x8794('0x33')](handleError(_0x53d0dd,null));};var interaction_log=require(_0x8794('0x1a'))(_0x8794('0x64'));exports[_0x8794('0x65')]=function(_0x46b204,_0x289942,_0x2307ec){var _0x4c9a59={'channel':_0x8794('0x66')};if(_0x46b204[_0x8794('0x62')]['id']){delete _0x46b204['body']['id'];}_0x46b204[_0x8794('0x62')][_0x8794('0x67')]=!![];_0x46b204[_0x8794('0x62')][_0x8794('0x68')]=moment()['format'](_0x8794('0x69'));_0x46b204[_0x8794('0x62')][_0x8794('0x6a')]=_0x46b204[_0x8794('0x62')][_0x8794('0x6a')]||_0x46b204[_0x8794('0x6b')]['id'];return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x46b204[_0x8794('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x8794('0x6c')],'as':_0x8794('0x6d')}]})['then'](handleEntityNotFound(_0x289942,null))[_0x8794('0x29')](saveUpdates(_0x46b204[_0x8794('0x62')],null))[_0x8794('0x29')](function(_0x410563){if(_0x410563){_0x4c9a59[_0x8794('0x30')]=_0x410563[_0x8794('0x6e')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x410563[_0x8794('0x6f')]}});}return null;})[_0x8794('0x29')](handleEntityNotFound(_0x289942,null))['then'](function(_0x3e8a5e){if(_0x3e8a5e){return _0x3e8a5e[_0x8794('0x3d')]({'UserId':_0x46b204[_0x8794('0x62')][_0x8794('0x6a')],'read1stAt':_[_0x8794('0x70')](_0x3e8a5e['read1stAt'])?moment()[_0x8794('0x71')](_0x8794('0x69')):undefined});}return null;})[_0x8794('0x29')](function(_0x56da44){if(_0x56da44){_0x4c9a59[_0x8794('0x72')]=_0x56da44['get']({'plain':!![]});interaction_log[_0x8794('0x31')](_0x8794('0x73'),_0x46b204[_0x8794('0x6b')]['id'],_0x46b204[_0x8794('0x6b')][_0x8794('0x41')],_0x46b204[_0x8794('0x6b')][_0x8794('0x74')],_0x4c9a59[_0x8794('0x72')]['id'],_0x46b204['body']?JSON[_0x8794('0x2d')](_0x46b204['body']):_0x8794('0x75'));return respondWithRpcPromise(_0x8794('0x76'),'acceptMessage',_0x4c9a59);}return null;})[_0x8794('0x29')](function(_0x78df3b){if(_0x78df3b){if(_0x46b204[_0x8794('0x62')][_0x8794('0x77')]){_0x4c9a59[_0x8794('0x30')][_0x8794('0x78')]=util[_0x8794('0x71')]('SIP/%s',_0x46b204['user'][_0x8794('0x41')]);_0x4c9a59['message']['channel']=_0x4c9a59[_0x8794('0x79')];_0x4c9a59[_0x8794('0x30')]['event']=_0x8794('0x65');return respondWithRpcPromise(_0x8794('0x7a'),_0x8794('0x7a'),{'event':_0x8794('0x7b'),'message':_0x4c9a59['message']},client9002)[_0x8794('0x29')](function(){return _0x4c9a59;});}return _0x4c9a59;}return null;})[_0x8794('0x29')](respondWithResult(_0x289942,null))[_0x8794('0x33')](handleError(_0x289942,null));};var interaction_log=require(_0x8794('0x1a'))(_0x8794('0x64'));exports['reject']=function(_0x1c4132,_0x2186ea,_0x2dd42e){var _0x2c1afc={'agent':{},'channel':_0x8794('0x66')};if(_0x1c4132[_0x8794('0x62')]['id']){delete _0x1c4132[_0x8794('0x62')]['id'];}_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')]=_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')]||_0x1c4132[_0x8794('0x6b')]['id'];_0x2c1afc[_0x8794('0x7c')]['id']=_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')];return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x1c4132[_0x8794('0x5c')]['id'],'UserId':null}})[_0x8794('0x29')](handleEntityNotFound(_0x2186ea,null))[_0x8794('0x29')](function(_0x2aca2a){if(_0x2aca2a){_0x2c1afc[_0x8794('0x30')]=_0x2aca2a[_0x8794('0x6e')]({'plain':!![]});return db[_0x8794('0x7d')]['find']({'where':{'id':_0x2aca2a['OpenchannelInteractionId']}});}return null;})[_0x8794('0x29')](handleEntityNotFound(_0x2186ea,null))[_0x8794('0x29')](function(_0x34743a){if(_0x34743a){_0x2c1afc['interaction']=_0x34743a['get']({'plain':!![]});interaction_log[_0x8794('0x31')](_0x8794('0x7e'),_0x1c4132[_0x8794('0x6b')]['id'],_0x1c4132[_0x8794('0x6b')][_0x8794('0x41')],_0x1c4132['user']['role'],_0x2c1afc[_0x8794('0x72')]['id'],_0x1c4132[_0x8794('0x62')]?JSON[_0x8794('0x2d')](_0x1c4132['body']):_0x8794('0x75'));return respondWithRpcPromise(_0x8794('0x7f'),_0x8794('0x80'),_0x2c1afc);}return null;})[_0x8794('0x29')](function(_0xd41bf5){if(_0xd41bf5){_0xd41bf5['message'][_0x8794('0x78')]=util['format'](_0x8794('0x81'),_0x1c4132[_0x8794('0x6b')]['name']);_0xd41bf5[_0x8794('0x30')][_0x8794('0x79')]=_0x2c1afc[_0x8794('0x79')];_0xd41bf5[_0x8794('0x30')]['event']=_0x8794('0x3b');respondWithRpcPromise(_0x8794('0x7a'),_0x8794('0x7a'),{'event':_0x8794('0x82'),'message':_0xd41bf5[_0x8794('0x30')]},client9002);return _0x2c1afc;}return null;})[_0x8794('0x29')](respondWithResult(_0x2186ea,null))[_0x8794('0x33')](handleError(_0x2186ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 255ca41..9b3b938 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 _0xf57c=['exports','events','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x52cc94,_0xeff2c2){var _0x281529=function(_0x4171e7){while(--_0x4171e7){_0x52cc94['push'](_0x52cc94['shift']());}};_0x281529(++_0xeff2c2);}(_0xf57c,0xe8));var _0xcf57=function(_0x485277,_0x58702a){_0x485277=_0x485277-0x0;var _0xf553c5=_0xf57c[_0x485277];return _0xf553c5;};'use strict';var EventEmitter=require(_0xcf57('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcf57('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcf57('0x2')};function emitEvent(_0x15bf7e){return function(_0xef8b5b,_0x491075,_0x165f3e){OpenchannelMessageEvents[_0xcf57('0x3')](_0x15bf7e+':'+_0xef8b5b['id'],_0xef8b5b);OpenchannelMessageEvents[_0xcf57('0x3')](_0x15bf7e,_0xef8b5b);_0x165f3e(null);};}for(var e in events){if(events[_0xcf57('0x4')](e)){var event=events[e];OpenchannelMessage[_0xcf57('0x5')](e,emitEvent(event));}}module[_0xcf57('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd2e6=['../../mysqldb','OpenchannelMessage','save','remove','hasOwnProperty','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd2e6,0x131));var _0x6d2e=function(_0x407593,_0x33dbf0){_0x407593=_0x407593-0x0;var _0x357aac=_0xd2e6[_0x407593];return _0x357aac;};'use strict';var EventEmitter=require(_0x6d2e('0x0'));var OpenchannelMessage=require(_0x6d2e('0x1'))['db'][_0x6d2e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d2e('0x3'),'afterUpdate':'update','afterDestroy':_0x6d2e('0x4')};function emitEvent(_0x51212e){return function(_0x36046b,_0x4191e6,_0x15ffe5){OpenchannelMessageEvents['emit'](_0x51212e+':'+_0x36046b['id'],_0x36046b);OpenchannelMessageEvents['emit'](_0x51212e,_0x36046b);_0x15ffe5(null);};}for(var e in events){if(events[_0x6d2e('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 746a8cf..b691676 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 _0x16bd=['omit','Contact','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16bd,0x1a8));var _0xd16b=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x16bd[_0x36a469];return _0x3347fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd16b('0x0'));var moment=require('moment');var BPromise=require(_0xd16b('0x1'));var rp=require(_0xd16b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd16b('0x3'));var config=require(_0xd16b('0x4'));var attributes=require(_0xd16b('0x5'));module[_0xd16b('0x6')]=function(_0x3d6dd9,_0x36f533){return _0x3d6dd9['define'](_0xd16b('0x7'),attributes,{'tableName':_0xd16b('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xd16b('0x9')],'type':_0xd16b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x490d31,_0xb1b898,_0x499f8e){var _0x49d5a6=_0x3d6dd9['models'];var _0x3f3731=_0x490d31[_0xd16b('0xb')]({'plain':!![]});if(_0x3f3731['direction'][_0xd16b('0xc')]()==='in'||_0x3f3731[_0xd16b('0xd')][_0xd16b('0xc')]()==='out'&&!_0x3f3731[_0xd16b('0xe')]&&!_[_0xd16b('0xf')](_0x3f3731['UserId'])){_0x49d5a6[_0xd16b('0x10')][_0xd16b('0x11')]({'where':{'id':_0x3f3731[_0xd16b('0x12')]}})[_0xd16b('0x13')](function(_0x253dde){if(_0x253dde){_0x253dde[_0xd16b('0x14')]({'lastMsgAt':_0x3f3731['createdAt'],'lastMsgDirection':_0x3f3731['direction']['toLowerCase']()});}})[_0xd16b('0x15')](function(_0x3e0c90){console[_0xd16b('0x16')](_0x3e0c90);});}if(_0x3f3731[_0xd16b('0xd')]===_0xd16b('0x17')&&!_0x3f3731[_0xd16b('0xe')]){var _0x471424;_0x49d5a6[_0xd16b('0x18')][_0xd16b('0x19')]()[_0xd16b('0x13')](function(_0x1f2ec5){return _0x49d5a6[_0xd16b('0x1a')][_0xd16b('0x1b')]({'where':{'id':_0x3f3731[_0xd16b('0x1c')]},'include':[{'model':_0x49d5a6[_0xd16b('0x10')],'as':_0xd16b('0x1d'),'where':{'id':_0x3f3731['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x49d5a6[_0xd16b('0x18')],'as':'Contact','attributes':_[_0xd16b('0x1e')](_0x1f2ec5)}]}]});})[_0xd16b('0x13')](function(_0x28d1f6){_0x471424=_0x28d1f6[_0xd16b('0xb')]({'plain':!![]});if(_0x471424&&_0x471424[_0xd16b('0x1f')]){logger[_0xd16b('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xd16b('0x21'),util[_0xd16b('0x22')](_0xd16b('0x23'),_0x3f3731['id'],_0x471424[_0xd16b('0x1f')]));if(_0x471424[_0xd16b('0x1d')]&&_0x471424[_0xd16b('0x1d')]['length']){_0x3f3731['Interaction']=_[_0xd16b('0x24')](_0x471424[_0xd16b('0x1d')][0x0],_0xd16b('0x25'));_0x3f3731['Contact']=_0x471424[_0xd16b('0x1d')][0x0][_0xd16b('0x25')];}var _0xb1b898={'method':'POST','uri':encodeURI(_0x471424['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb1b898['method']){case _0xd16b('0x26'):_0xb1b898['qs']=_0x3f3731;break;case'POST':_0xb1b898[_0xd16b('0x9')]=_0x3f3731;break;}return rp(_0xb1b898)[_0xd16b('0x13')](function(_0x25c94b){logger[_0xd16b('0x20')](_0xd16b('0x27'),'afterCreate',util[_0xd16b('0x22')](_0xd16b('0x28'),_0x3f3731['id'],_0x471424[_0xd16b('0x1f')]));if(_0x25c94b[_0xd16b('0x9')][_0xd16b('0x29')]&&_0x25c94b['body'][_0xd16b('0x29')]!=_0x3f3731[_0xd16b('0x2a')]['threadId']){return _0x49d5a6[_0xd16b('0x10')]['update']({'threadId':_0x25c94b[_0xd16b('0x9')][_0xd16b('0x29')]},{'logging':!![],'where':{'id':_0x3f3731[_0xd16b('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x490d31[_0xd16b('0x14')]({'read':!![]});})[_0xd16b('0x15')](function(_0x484ad1){logger[_0xd16b('0x16')](_0xd16b('0x27'),_0xd16b('0x21'),util[_0xd16b('0x2b')](_0x484ad1,{'showHidden':![],'depth':null}));_0x499f8e();});}else{_0x499f8e();}})[_0xd16b('0x2c')](function(){_0x499f8e();});}else{_0x499f8e();}}},'charset':'utf8mb4','collate':_0xd16b('0x2d')});}; \ No newline at end of file +var _0xc67d=['out','secret','isNil','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x35ecc9,_0x22d5b4){var _0x53d5fc=function(_0x4cbebd){while(--_0x4cbebd){_0x35ecc9['push'](_0x35ecc9['shift']());}};_0x53d5fc(++_0x22d5b4);}(_0xc67d,0xab));var _0xdc67=function(_0x3caa2e,_0x170250){_0x3caa2e=_0x3caa2e-0x0;var _0x5b214e=_0xc67d[_0x3caa2e];return _0x5b214e;};'use strict';var _=require(_0xdc67('0x0'));var util=require(_0xdc67('0x1'));var logger=require('../../config/logger')(_0xdc67('0x2'));var moment=require(_0xdc67('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc67('0x4'));var fs=require('fs');var path=require(_0xdc67('0x5'));var rimraf=require(_0xdc67('0x6'));var config=require(_0xdc67('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xdc67('0x8')]=function(_0x3f0079,_0x534ee0){return _0x3f0079[_0xdc67('0x9')](_0xdc67('0xa'),attributes,{'tableName':_0xdc67('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xdc67('0xc')],'type':_0xdc67('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fa0c0,_0x1a431a,_0x5b571b){var _0x5ee3d5=_0x3f0079['models'];var _0x4f3321=_0x4fa0c0[_0xdc67('0xe')]({'plain':!![]});if(_0x4f3321[_0xdc67('0xf')][_0xdc67('0x10')]()==='in'||_0x4f3321[_0xdc67('0xf')]['toLowerCase']()===_0xdc67('0x11')&&!_0x4f3321[_0xdc67('0x12')]&&!_[_0xdc67('0x13')](_0x4f3321['UserId'])){_0x5ee3d5['OpenchannelInteraction'][_0xdc67('0x14')]({'where':{'id':_0x4f3321[_0xdc67('0x15')]}})[_0xdc67('0x16')](function(_0x1af14d){if(_0x1af14d){_0x1af14d[_0xdc67('0x17')]({'lastMsgAt':_0x4f3321['createdAt'],'lastMsgDirection':_0x4f3321[_0xdc67('0xf')]['toLowerCase']()});}})[_0xdc67('0x18')](function(_0x3dd8e8){console[_0xdc67('0x19')](_0x3dd8e8);});}if(_0x4f3321['direction']===_0xdc67('0x11')&&!_0x4f3321['secret']){var _0x3548df;_0x5ee3d5[_0xdc67('0x1a')][_0xdc67('0x1b')]()[_0xdc67('0x16')](function(_0x47ec67){return _0x5ee3d5[_0xdc67('0x1c')]['find']({'where':{'id':_0x4f3321['OpenchannelAccountId']},'include':[{'model':_0x5ee3d5[_0xdc67('0x1d')],'as':_0xdc67('0x1e'),'where':{'id':_0x4f3321[_0xdc67('0x15')]},'limit':0x1,'include':[{'model':_0x5ee3d5['CmContact'],'as':_0xdc67('0x1f'),'attributes':_[_0xdc67('0x20')](_0x47ec67)}]}]});})[_0xdc67('0x16')](function(_0x1183ed){_0x3548df=_0x1183ed['get']({'plain':!![]});if(_0x3548df&&_0x3548df[_0xdc67('0x21')]){logger[_0xdc67('0x22')](_0xdc67('0x23'),_0xdc67('0x24'),util['format'](_0xdc67('0x25'),_0x4f3321['id'],_0x3548df[_0xdc67('0x21')]));if(_0x3548df[_0xdc67('0x1e')]&&_0x3548df[_0xdc67('0x1e')]['length']){_0x4f3321[_0xdc67('0x26')]=_['omit'](_0x3548df[_0xdc67('0x1e')][0x0],'Contact');_0x4f3321[_0xdc67('0x1f')]=_0x3548df['Interactions'][0x0][_0xdc67('0x1f')];}var _0x1a431a={'method':_0xdc67('0x27'),'uri':encodeURI(_0x3548df[_0xdc67('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1a431a['method']){case _0xdc67('0x28'):_0x1a431a['qs']=_0x4f3321;break;case _0xdc67('0x27'):_0x1a431a[_0xdc67('0xc')]=_0x4f3321;break;}return rp(_0x1a431a)[_0xdc67('0x16')](function(_0x2c69bd){logger[_0xdc67('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xdc67('0x29')](_0xdc67('0x2a'),_0x4f3321['id'],_0x3548df[_0xdc67('0x21')]));if(_0x2c69bd['body'][_0xdc67('0x2b')]&&_0x2c69bd['body'][_0xdc67('0x2b')]!=_0x4f3321[_0xdc67('0x26')][_0xdc67('0x2b')]){return _0x5ee3d5[_0xdc67('0x1d')]['update']({'threadId':_0x2c69bd[_0xdc67('0xc')][_0xdc67('0x2b')]},{'logging':!![],'where':{'id':_0x4f3321['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4fa0c0[_0xdc67('0x17')]({'read':!![]});})[_0xdc67('0x18')](function(_0x4d9bc7){logger[_0xdc67('0x19')](_0xdc67('0x23'),_0xdc67('0x24'),util[_0xdc67('0x2c')](_0x4d9bc7,{'showHidden':![],'depth':null}));_0x5b571b();});}else{_0x5b571b();}})[_0xdc67('0x2d')](function(){_0x5b571b();});}else{_0x5b571b();}}},'charset':_0xdc67('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d63c161..03d8ffc 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 _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(_0x516565,_0x17b691){var _0x3ced91=function(_0x10dc80){while(--_0x10dc80){_0x516565['push'](_0x516565['shift']());}};_0x3ced91(++_0x17b691);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file +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(_0x193a53,_0x3d7f81){var _0x385908=function(_0x1a7d4a){while(--_0x1a7d4a){_0x193a53['push'](_0x193a53['shift']());}};_0x385908(++_0x3d7f81);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x5f2f[_0x15cbce];return _0x257f29;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index bd8e59f..81f4e27 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 _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x99b64,_0x2d3c2f){_0x99b64=_0x99b64-0x0;var _0x4d8eee=_0x9bde[_0x99b64];return _0x4d8eee;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file +var _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x4a2917,_0xeb4863){var _0x410b4a=function(_0x351e3e){while(--_0x351e3e){_0x4a2917['push'](_0x4a2917['shift']());}};_0x410b4a(++_0xeb4863);}(_0xda3f,0xec));var _0xfda3=function(_0x17414c,_0x33b3c8){_0x17414c=_0x17414c-0x0;var _0x3f7130=_0xda3f[_0x17414c];return _0x3f7130;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 725ceb3..31a94a6 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 _0x9c63=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getTeams','/:id/users','getAgents','create','post','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c63,0x1a7));var _0x39c6=function(_0xc63ce3,_0xbe2d8c){_0xc63ce3=_0xc63ce3-0x0;var _0x4b3f31=_0x9c63[_0xc63ce3];return _0x4b3f31;};'use strict';var multer=require(_0x39c6('0x0'));var util=require(_0x39c6('0x1'));var path=require(_0x39c6('0x2'));var timeout=require(_0x39c6('0x3'));var express=require(_0x39c6('0x4'));var router=express['Router']();var auth=require(_0x39c6('0x5'));var interaction=require(_0x39c6('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x39c6('0x7')]('/',auth[_0x39c6('0x8')](),controller[_0x39c6('0x9')]);router[_0x39c6('0x7')](_0x39c6('0xa'),auth[_0x39c6('0x8')](),controller['describe']);router[_0x39c6('0x7')](_0x39c6('0xb'),auth[_0x39c6('0x8')](),controller[_0x39c6('0xc')]);router[_0x39c6('0x7')]('/:id/members',auth[_0x39c6('0x8')](),controller['getMembers']);router[_0x39c6('0x7')]('/:id/teams',auth[_0x39c6('0x8')](),controller[_0x39c6('0xd')]);router[_0x39c6('0x7')](_0x39c6('0xe'),auth['isAuthenticated'](),controller[_0x39c6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x39c6('0x10')]);router[_0x39c6('0x11')](_0x39c6('0x12'),auth[_0x39c6('0x8')](),controller['addTeams']);router[_0x39c6('0x11')]('/:id/users',auth[_0x39c6('0x8')](),controller[_0x39c6('0x13')]);router[_0x39c6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x39c6('0x15')]);router[_0x39c6('0x16')]('/:id',auth[_0x39c6('0x8')](),controller[_0x39c6('0x17')]);router[_0x39c6('0x16')](_0x39c6('0x12'),auth[_0x39c6('0x8')](),controller[_0x39c6('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xbe3b=['express','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','exports','util','path'];(function(_0x4c65fd,_0x2ba5cc){var _0x315e4b=function(_0x557969){while(--_0x557969){_0x4c65fd['push'](_0x4c65fd['shift']());}};_0x315e4b(++_0x2ba5cc);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x28b7a2,_0x40aa58){_0x28b7a2=_0x28b7a2-0x0;var _0x404e08=_0xbe3b[_0x28b7a2];return _0x404e08;};'use strict';var multer=require('multer');var util=require(_0xbbe3('0x0'));var path=require(_0xbbe3('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbe3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbbe3('0x3'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xbbe3('0x4')]('/',auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x6')]);router[_0xbbe3('0x4')]('/describe',auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x7')]);router[_0xbbe3('0x4')](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller['show']);router[_0xbbe3('0x4')](_0xbbe3('0x9'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xa')]);router[_0xbbe3('0x4')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xc')]);router['get'](_0xbbe3('0xd'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xe')]);router[_0xbbe3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbbe3('0xf')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x10')]);router[_0xbbe3('0xf')](_0xbbe3('0xd'),auth['isAuthenticated'](),controller[_0xbbe3('0x11')]);router['put'](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x12')]);router[_0xbbe3('0x13')](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x14')]);router[_0xbbe3('0x13')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x15')]);router[_0xbbe3('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xbbe3('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 0a20a50..ee75e13 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 _0x932a=['sequelize','exports','STRING','name','ENUM','beepall'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x932a,0x96));var _0xa932=function(_0x958fff,_0x468916){_0x958fff=_0x958fff-0x0;var _0x54a665=_0x932a[_0x958fff];return _0x54a665;};'use strict';var Sequelize=require(_0xa932('0x0'));module[_0xa932('0x1')]={'name':{'type':Sequelize[_0xa932('0x2')],'unique':_0xa932('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa932('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa932('0x4')]('rrmemory',_0xa932('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5046=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5046,0x6d));var _0x6504=function(_0x15a768,_0xfe3901){_0x15a768=_0x15a768-0x0;var _0x332c93=_0x5046[_0x15a768];return _0x332c93;};'use strict';var Sequelize=require(_0x6504('0x0'));module[_0x6504('0x1')]={'name':{'type':Sequelize[_0x6504('0x2')],'unique':_0x6504('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6504('0x2')]},'timeout':{'type':Sequelize[_0x6504('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6504('0x5')](_0x6504('0x6'),_0x6504('0x7'),_0x6504('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3c46744..a4701ae 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 _0xc2e5=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','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','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','end','error','name','send','map','OpenchannelQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','User','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','html-pdf'];(function(_0xfe3d61,_0x158867){var _0x29132f=function(_0x48999c){while(--_0x48999c){_0xfe3d61['push'](_0xfe3d61['shift']());}};_0x29132f(++_0x158867);}(_0xc2e5,0x87));var _0x5c2e=function(_0x117417,_0x214c67){_0x117417=_0x117417-0x0;var _0x5ba86d=_0xc2e5[_0x117417];return _0x5ba86d;};'use strict';var pdf=require(_0x5c2e('0x0'));var emlformat=require(_0x5c2e('0x1'));var rimraf=require(_0x5c2e('0x2'));var zipdir=require(_0x5c2e('0x3'));var jsonpatch=require(_0x5c2e('0x4'));var rp=require('request-promise');var moment=require(_0x5c2e('0x5'));var BPromise=require(_0x5c2e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5c2e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c2e('0x8'));var fs=require('fs');var _=require(_0x5c2e('0x9'));var squel=require(_0x5c2e('0xa'));var crypto=require(_0x5c2e('0xb'));var jsforce=require(_0x5c2e('0xc'));var deskjs=require(_0x5c2e('0xd'));var toCsv=require(_0x5c2e('0xe'));var querystring=require(_0x5c2e('0xf'));var Papa=require(_0x5c2e('0x10'));var Redis=require(_0x5c2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5c2e('0x12'));var as=require(_0x5c2e('0x13'));var hardwareService=require(_0x5c2e('0x14'));var logger=require(_0x5c2e('0x15'))(_0x5c2e('0x16'));var utils=require(_0x5c2e('0x17'));var config=require(_0x5c2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c2e('0x19'))['db'];config[_0x5c2e('0x1a')]=_['defaults'](config['redis'],{'host':_0x5c2e('0x1b'),'port':0x18eb});var socket=require(_0x5c2e('0x1c'))(new Redis(config[_0x5c2e('0x1a')]));require(_0x5c2e('0x1d'))[_0x5c2e('0x1e')](socket);function respondWithStatusCode(_0x15e616,_0x1c791e){_0x1c791e=_0x1c791e||0xcc;return function(_0x1893a5){if(_0x1893a5){return _0x15e616[_0x5c2e('0x1f')](_0x1c791e);}return _0x15e616[_0x5c2e('0x20')](_0x1c791e)['end']();};}function respondWithResult(_0x42b3cd,_0x46e47d){_0x46e47d=_0x46e47d||0xc8;return function(_0x4b04d7){if(_0x4b04d7){return _0x42b3cd['status'](_0x46e47d)[_0x5c2e('0x21')](_0x4b04d7);}};}function respondWithFilteredResult(_0x5463fd,_0x7f0cad){return function(_0x1b1f67){if(_0x1b1f67){var _0x5237e3=_0x1b1f67[_0x5c2e('0x22')],_0x3f4d44=_0x7f0cad['offset'],_0x1aafdc=_0x7f0cad[_0x5c2e('0x23')]+_0x7f0cad[_0x5c2e('0x24')],_0x11e7f0;if(_0x1aafdc>=_0x5237e3){_0x1aafdc=_0x5237e3;_0x11e7f0=0xc8;}else{_0x11e7f0=0xce;}_0x5463fd[_0x5c2e('0x20')](_0x11e7f0);return _0x5463fd[_0x5c2e('0x25')](_0x5c2e('0x26'),_0x3f4d44+'-'+_0x1aafdc+'/'+_0x5237e3)[_0x5c2e('0x21')](_0x1b1f67);}return null;};}function patchUpdates(_0x5205ae){return function(_0x588df1){try{jsonpatch[_0x5c2e('0x27')](_0x588df1,_0x5205ae,!![]);}catch(_0x4ec069){return BPromise[_0x5c2e('0x28')](_0x4ec069);}return _0x588df1['save']();};}function saveUpdates(_0x509c48,_0x569321){return function(_0x1e52a3){if(_0x1e52a3){return _0x1e52a3[_0x5c2e('0x29')](_0x509c48)[_0x5c2e('0x2a')](function(_0x1660f3){return _0x1660f3;});}return null;};}function removeEntity(_0x5f051d,_0x819453){return function(_0x24b09f){if(_0x24b09f){return _0x24b09f[_0x5c2e('0x2b')]()[_0x5c2e('0x2a')](function(){var _0x317e3e=_0x24b09f['get']({'plain':!![]});var _0x35a56b=_0x5c2e('0x2c');return db[_0x5c2e('0x2d')]['destroy']({'where':{'type':_0x35a56b,'resourceId':_0x317e3e['id']}})[_0x5c2e('0x2a')](function(){return _0x24b09f;});})['then'](function(){_0x5f051d[_0x5c2e('0x20')](0xcc)[_0x5c2e('0x2e')]();});}};}function handleEntityNotFound(_0x28aa56,_0x214926){return function(_0x518af3){if(!_0x518af3){_0x28aa56[_0x5c2e('0x1f')](0x194);}return _0x518af3;};}function handleError(_0x37d727,_0x412eb5){_0x412eb5=_0x412eb5||0x1f4;return function(_0x3b3bac){logger[_0x5c2e('0x2f')](_0x3b3bac['stack']);if(_0x3b3bac['name']){delete _0x3b3bac[_0x5c2e('0x30')];}_0x37d727[_0x5c2e('0x20')](_0x412eb5)[_0x5c2e('0x31')](_0x3b3bac);};}exports['index']=function(_0xb245b6,_0x2e5546){var _0x3a2a39={},_0x1efebd={},_0x35ca3f={'count':0x0,'rows':[]};var _0xebf254=_[_0x5c2e('0x32')](db[_0x5c2e('0x33')]['rawAttributes'],function(_0x2519fe){return{'name':_0x2519fe[_0x5c2e('0x34')],'type':_0x2519fe[_0x5c2e('0x35')][_0x5c2e('0x36')]};});_0x1efebd[_0x5c2e('0x37')]=_[_0x5c2e('0x32')](_0xebf254,_0x5c2e('0x30'));_0x1efebd[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0xb245b6[_0x5c2e('0x38')]);_0x1efebd[_0x5c2e('0x3a')]=_[_0x5c2e('0x3b')](_0x1efebd[_0x5c2e('0x37')],_0x1efebd[_0x5c2e('0x38')]);_0x3a2a39[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0x1efebd[_0x5c2e('0x37')],qs['fields'](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x3a2a39[_0x5c2e('0x3c')]=_0x3a2a39['attributes'][_0x5c2e('0x3e')]?_0x3a2a39['attributes']:_0x1efebd[_0x5c2e('0x37')];if(!_0xb245b6['query'][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x3a2a39[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x3a2a39[_0x5c2e('0x23')]=qs[_0x5c2e('0x23')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x23')]);}_0x3a2a39['order']=qs[_0x5c2e('0x41')](_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x41')]);_0x3a2a39[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0xb245b6[_0x5c2e('0x38')],_0x1efebd[_0x5c2e('0x3a')]),_0xebf254);if(_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x3a2a39[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x3a2a39[_0x5c2e('0x42')],{'$or':_[_0x5c2e('0x32')](_0xebf254,function(_0x46faa5){if(_0x46faa5[_0x5c2e('0x35')]!==_0x5c2e('0x46')){var _0x249651={};_0x249651[_0x46faa5['name']]={'$like':'%'+_0xb245b6[_0x5c2e('0x38')]['filter']+'%'};return _0x249651;}})});}_0x3a2a39=_[_0x5c2e('0x45')]({},_0x3a2a39,_0xb245b6[_0x5c2e('0x47')]);var _0x39c6be={'where':_0x3a2a39[_0x5c2e('0x42')]};return db[_0x5c2e('0x33')][_0x5c2e('0x22')](_0x39c6be)[_0x5c2e('0x2a')](function(_0x31b28a){_0x35ca3f[_0x5c2e('0x22')]=_0x31b28a;if(_0xb245b6[_0x5c2e('0x38')][_0x5c2e('0x48')]){_0x3a2a39[_0x5c2e('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5c2e('0x4a')](_0x3a2a39);})[_0x5c2e('0x2a')](function(_0x265c69){_0x35ca3f[_0x5c2e('0x4b')]=_0x265c69;return _0x35ca3f;})[_0x5c2e('0x2a')](respondWithFilteredResult(_0x2e5546,_0x3a2a39))[_0x5c2e('0x4c')](handleError(_0x2e5546,null));};exports[_0x5c2e('0x4d')]=function(_0x49d44b,_0x3db546){var _0x580cc1={'raw':!![],'where':{'id':_0x49d44b[_0x5c2e('0x4e')]['id']}},_0x3df394={};_0x3df394['model']=_[_0x5c2e('0x39')](db['OpenchannelQueue'][_0x5c2e('0x4f')]);_0x3df394['query']=_[_0x5c2e('0x39')](_0x49d44b['query']);_0x3df394[_0x5c2e('0x3a')]=_['intersection'](_0x3df394[_0x5c2e('0x37')],_0x3df394[_0x5c2e('0x38')]);_0x580cc1[_0x5c2e('0x3c')]=_['intersection'](_0x3df394[_0x5c2e('0x37')],qs[_0x5c2e('0x3d')](_0x49d44b[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x580cc1['attributes']=_0x580cc1[_0x5c2e('0x3c')][_0x5c2e('0x3e')]?_0x580cc1[_0x5c2e('0x3c')]:_0x3df394['model'];if(_0x49d44b[_0x5c2e('0x38')]['includeAll']){_0x580cc1['include']=[{'all':!![]}];}_0x580cc1=_[_0x5c2e('0x45')]({},_0x580cc1,_0x49d44b[_0x5c2e('0x47')]);return db[_0x5c2e('0x33')]['find'](_0x580cc1)[_0x5c2e('0x2a')](handleEntityNotFound(_0x3db546,null))[_0x5c2e('0x2a')](respondWithResult(_0x3db546,null))['catch'](handleError(_0x3db546,null));};exports[_0x5c2e('0x50')]=function(_0x36157c,_0xaa6061){return db[_0x5c2e('0x33')]['create'](_0x36157c[_0x5c2e('0x51')],{})[_0x5c2e('0x2a')](function(_0x53a385){var _0x62f836=_0x36157c[_0x5c2e('0x52')][_0x5c2e('0x53')]({'plain':!![]});if(!_0x62f836)throw new Error(_0x5c2e('0x54'));if(_0x62f836[_0x5c2e('0x55')]==='user'){var _0x5e27e1=_0x53a385[_0x5c2e('0x53')]({'plain':!![]});var _0xac5da5='OpenchannelQueues';return db[_0x5c2e('0x56')][_0x5c2e('0x57')]({'where':{'name':_0xac5da5,'userProfileId':_0x62f836['userProfileId']},'raw':!![]})[_0x5c2e('0x2a')](function(_0x1fed00){if(_0x1fed00&&_0x1fed00[_0x5c2e('0x58')]===0x0){return db[_0x5c2e('0x2d')][_0x5c2e('0x50')]({'name':_0x5e27e1['name'],'resourceId':_0x5e27e1['id'],'type':_0x1fed00[_0x5c2e('0x30')],'sectionId':_0x1fed00['id']},{})[_0x5c2e('0x2a')](function(){return _0x53a385;});}else{return _0x53a385;}})[_0x5c2e('0x4c')](function(_0x1da7e4){logger[_0x5c2e('0x2f')](_0x5c2e('0x59'),_0x1da7e4);throw _0x1da7e4;});}return _0x53a385;})[_0x5c2e('0x2a')](respondWithResult(_0xaa6061,0xc9))[_0x5c2e('0x4c')](handleError(_0xaa6061,null));};exports[_0x5c2e('0x29')]=function(_0x3cb3c0,_0x9a316b){if(_0x3cb3c0[_0x5c2e('0x51')]['id']){delete _0x3cb3c0[_0x5c2e('0x51')]['id'];}return db['OpenchannelQueue'][_0x5c2e('0x57')]({'where':{'id':_0x3cb3c0[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x9a316b,null))['then'](saveUpdates(_0x3cb3c0['body'],null))['then'](respondWithResult(_0x9a316b,null))[_0x5c2e('0x4c')](handleError(_0x9a316b,null));};exports[_0x5c2e('0x2b')]=function(_0x5fb670,_0x53f300){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x5fb670[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x53f300,null))[_0x5c2e('0x2a')](removeEntity(_0x53f300,null))['catch'](handleError(_0x53f300,null));};exports['describe']=function(_0x139a7a,_0x4556ae){return db[_0x5c2e('0x33')]['describe']()['then'](respondWithResult(_0x4556ae,null))['catch'](handleError(_0x4556ae,null));};exports[_0x5c2e('0x5a')]=function(_0x365672,_0x123d4f,_0x23901e){var _0x33140b={'raw':!![],'where':{}},_0x59f440={},_0x2a7a31;return db['OpenchannelQueue'][_0x5c2e('0x5b')]({'where':{'id':_0x365672[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x123d4f,null))['then'](function(_0x4e58c9){if(_0x4e58c9){_0x2a7a31=_0x4e58c9[_0x5c2e('0x53')]({'plain':!![]});_0x59f440[_0x5c2e('0x37')]=_['keys'](db[_0x5c2e('0x5c')][_0x5c2e('0x4f')]);_0x59f440[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0x365672['query']);_0x59f440['filters']=_[_0x5c2e('0x3b')](_0x59f440[_0x5c2e('0x37')],_0x59f440[_0x5c2e('0x38')]);_0x33140b[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0x59f440['model'],qs[_0x5c2e('0x3d')](_0x365672['query'][_0x5c2e('0x3d')]));_0x33140b[_0x5c2e('0x3c')]=_0x33140b[_0x5c2e('0x3c')]['length']?_0x33140b[_0x5c2e('0x3c')]:_0x59f440[_0x5c2e('0x37')];if(!_0x365672[_0x5c2e('0x38')][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x33140b[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x365672['query'][_0x5c2e('0x24')]);_0x33140b['offset']=qs[_0x5c2e('0x23')](_0x365672['query'][_0x5c2e('0x23')]);}_0x33140b[_0x5c2e('0x5d')]=qs[_0x5c2e('0x41')](_0x365672[_0x5c2e('0x38')][_0x5c2e('0x41')]);_0x33140b[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x365672[_0x5c2e('0x38')],_0x59f440[_0x5c2e('0x3a')]));_0x33140b[_0x5c2e('0x42')][_0x5c2e('0x5e')]=_0x4e58c9['id'];if(_0x365672[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x33140b[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x33140b[_0x5c2e('0x42')],{'$or':_['map'](_0x33140b[_0x5c2e('0x3c')],function(_0x2ab3dd){var _0x41f23f={};_0x41f23f[_0x2ab3dd]={'$like':'%'+_0x365672['query']['filter']+'%'};return _0x41f23f;})});}_0x33140b=_['merge']({},_0x33140b,_0x365672[_0x5c2e('0x47')]);return db[_0x5c2e('0x5c')][_0x5c2e('0x4a')](_0x33140b);}})[_0x5c2e('0x2a')](function(_0x27b657){if(_0x27b657){return db['User'][_0x5c2e('0x5f')]({'where':{'id':_[_0x5c2e('0x32')](_0x27b657,_0x5c2e('0x60')),'role':'agent'},'attributes':['id',_0x5c2e('0x30'),_0x5c2e('0x61'),_0x5c2e('0x62'),_0x5c2e('0x63')]});}})[_0x5c2e('0x2a')](function(_0x21ab75){if(_0x21ab75){return{'count':_0x21ab75['count'],'rows':_[_0x5c2e('0x32')](_0x21ab75[_0x5c2e('0x4b')],function(_0x50676c){return{'membername':_0x50676c[_0x5c2e('0x30')],'UserId':_0x50676c['id'],'queue_name':_0x2a7a31[_0x5c2e('0x30')],'OpenchannelQueueId':_0x2a7a31['id'],'interface':util['format'](_0x5c2e('0x64'),_0x5c2e('0x65'),_0x50676c[_0x5c2e('0x30')]),'penalty':0x0,'paused':_0x50676c[_0x5c2e('0x61')],'createdAt':_0x50676c[_0x5c2e('0x63')],'updatedAt':_0x50676c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c2e('0x2a')](respondWithFilteredResult(_0x123d4f,_0x33140b))[_0x5c2e('0x4c')](handleError(_0x123d4f,null));};exports[_0x5c2e('0x66')]=function(_0x97eed3,_0x40977f,_0x5be375){var _0x5f03ea={};var _0x4eab15={};var _0x1688f8;var _0x4a13b8;return db[_0x5c2e('0x33')]['findOne']({'where':{'id':_0x97eed3[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x40977f,null))[_0x5c2e('0x2a')](function(_0x8c8c11){if(_0x8c8c11){_0x1688f8=_0x8c8c11;_0x4eab15['model']=_['keys'](db['Team'][_0x5c2e('0x4f')]);_0x4eab15['query']=_[_0x5c2e('0x39')](_0x97eed3[_0x5c2e('0x38')]);_0x4eab15[_0x5c2e('0x3a')]=_[_0x5c2e('0x3b')](_0x4eab15[_0x5c2e('0x37')],_0x4eab15['query']);_0x5f03ea['attributes']=_[_0x5c2e('0x3b')](_0x4eab15[_0x5c2e('0x37')],qs['fields'](_0x97eed3['query'][_0x5c2e('0x3d')]));_0x5f03ea['attributes']=_0x5f03ea['attributes'][_0x5c2e('0x3e')]?_0x5f03ea[_0x5c2e('0x3c')]:_0x4eab15[_0x5c2e('0x37')];_0x5f03ea[_0x5c2e('0x5d')]=qs[_0x5c2e('0x41')](_0x97eed3['query']['sort']);_0x5f03ea[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x97eed3[_0x5c2e('0x38')],_0x4eab15[_0x5c2e('0x3a')]));if(_0x97eed3['query'][_0x5c2e('0x44')]){_0x5f03ea[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x5f03ea[_0x5c2e('0x42')],{'$or':_[_0x5c2e('0x32')](_0x5f03ea['attributes'],function(_0x5480c9){var _0x3e83b8={};_0x3e83b8[_0x5480c9]={'$like':'%'+_0x97eed3[_0x5c2e('0x38')][_0x5c2e('0x44')]+'%'};return _0x3e83b8;})});}_0x5f03ea=_[_0x5c2e('0x45')]({},_0x5f03ea,_0x97eed3['options']);return _0x1688f8[_0x5c2e('0x66')](_0x5f03ea);}})['then'](function(_0x7063fd){if(_0x7063fd){_0x4a13b8=_0x7063fd[_0x5c2e('0x3e')];if(!_0x97eed3['query'][_0x5c2e('0x3f')](_0x5c2e('0x40'))){_0x5f03ea[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x97eed3[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x5f03ea['offset']=qs[_0x5c2e('0x23')](_0x97eed3[_0x5c2e('0x38')]['offset']);}return _0x1688f8[_0x5c2e('0x66')](_0x5f03ea);}})[_0x5c2e('0x2a')](function(_0x1a2d8c){if(_0x1a2d8c){return _0x1a2d8c?{'count':_0x4a13b8,'rows':_0x1a2d8c}:null;}})[_0x5c2e('0x2a')](respondWithResult(_0x40977f,null))['catch'](handleError(_0x40977f,null));};exports['addTeams']=function(_0x38b206,_0x5e79cc,_0x378bd3){var _0x4d5bce=_0x38b206[_0x5c2e('0x51')][_0x5c2e('0x67')];return db[_0x5c2e('0x68')][_0x5c2e('0x4a')]({'where':{'id':_0x4d5bce},'attributes':['id'],'include':[{'model':db[_0x5c2e('0x69')],'as':_0x5c2e('0x6a'),'attributes':['id',_0x5c2e('0x30'),'online',_0x5c2e('0x6b'),'interface'],'raw':!![]}]})[_0x5c2e('0x2a')](function(_0x22d75b){if(_0x22d75b){var _0x4353a8=_[_0x5c2e('0x6c')](_0x22d75b,function(_0x5ca037){var _0xc90426=_0x5ca037['get']({'plain':!![]});return _0xc90426['Agents'];});return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x38b206[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](function(_0x15507e){return db[_0x5c2e('0x6d')][_0x5c2e('0x6e')](function(_0x238bb7){return _0x15507e[_0x5c2e('0x6f')](_0x4d5bce,{'transaction':_0x238bb7})['then'](function(){return BPromise[_0x5c2e('0x70')](_0x4353a8,function(_0x2469dd){return db[_0x5c2e('0x5c')][_0x5c2e('0x71')]({'where':{'UserId':_0x2469dd['id'],'OpenchannelQueueId':_0x38b206[_0x5c2e('0x4e')]['id']},'transaction':_0x238bb7});});})['then'](function(){_0x4353a8[_0x5c2e('0x72')](function(_0x15b08f){socket[_0x5c2e('0x73')](_0x5c2e('0x74'),{'UserId':_0x15b08f['id'],'OpenchannelQueueId':_0x15507e['id']});});});});});}})['then'](respondWithStatusCode(_0x5e79cc,null))[_0x5c2e('0x4c')](handleError(_0x5e79cc,null));};exports['removeTeams']=function(_0x43c78d,_0x1f5f87,_0x330225){return db[_0x5c2e('0x68')][_0x5c2e('0x4a')]({'where':{'id':_0x43c78d[_0x5c2e('0x38')][_0x5c2e('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5c2e('0x69')],'as':_0x5c2e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5c2e('0x2a')](handleEntityNotFound(_0x1f5f87,null))[_0x5c2e('0x2a')](function(_0x5c4aa5){var _0x53e580=_[_0x5c2e('0x32')](_0x5c4aa5,'id');var _0x4ceaa0=[];var _0x23697e=[];var _0x1c6c7a=squel[_0x5c2e('0x75')]();_0x1c6c7a['field'](_0x5c2e('0x76'))['from']('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x5c2e('0x77'))['where']('OpenchannelQueueId\x20=\x20?',_0x43c78d[_0x5c2e('0x4e')]['id']);for(var _0x49326f=0x0;_0x49326f<_0x5c4aa5[_0x5c2e('0x3e')];_0x49326f+=0x1){let _0x47d2bb=_0x5c4aa5[_0x49326f];for(var _0x589147=0x0;_0x589147<_0x47d2bb[_0x5c2e('0x6a')][_0x5c2e('0x3e')];_0x589147+=0x1){let _0x316fd2=_0x47d2bb[_0x5c2e('0x6a')][_0x589147];var _0x52bde4=_0x1c6c7a[_0x5c2e('0x78')]();_0x52bde4['where'](_0x5c2e('0x79'),_0x316fd2['id']);_0x23697e[_0x5c2e('0x7a')](db[_0x5c2e('0x6d')][_0x5c2e('0x38')](_0x52bde4[_0x5c2e('0x7b')](),{'type':db[_0x5c2e('0x6d')]['QueryTypes'][_0x5c2e('0x7c')]})['then'](function(_0x4f01e1){if(_0x4f01e1[_0x5c2e('0x3e')]===0x1){return _0x316fd2['id'];}else{var _0x3c1105=_[_0x5c2e('0x7d')](_['map'](_0x4f01e1,'TeamId'),function(_0x411189){return _[_0x5c2e('0x7e')](_0x53e580,_0x411189);});if(_0x3c1105){return _0x316fd2['id'];}}}));}}return BPromise[_0x5c2e('0x7f')](_0x23697e)[_0x5c2e('0x2a')](function(_0x32dc4b){_0x4ceaa0=_(_0x4ceaa0)['union'](_0x32dc4b)[_0x5c2e('0x80')]()['value']();return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x43c78d[_0x5c2e('0x4e')]['id']}})['then'](function(_0x5c8f5a){return db[_0x5c2e('0x6d')][_0x5c2e('0x6e')](function(_0x35be58){return _0x5c8f5a[_0x5c2e('0x81')](_0x43c78d[_0x5c2e('0x38')]['ids'],{'transaction':_0x35be58})[_0x5c2e('0x2a')](function(){if(!_[_0x5c2e('0x82')](_0x4ceaa0)){return _0x5c8f5a[_0x5c2e('0x83')](_0x4ceaa0,{'transaction':_0x35be58});}})[_0x5c2e('0x2a')](function(){_0x4ceaa0[_0x5c2e('0x72')](function(_0x4f74b8){socket['emit'](_0x5c2e('0x84'),{'UserId':_0x4f74b8,'OpenchannelQueueId':_0x5c8f5a['id']});});});});});});})[_0x5c2e('0x2a')](respondWithStatusCode(_0x1f5f87,null))[_0x5c2e('0x4c')](handleError(_0x1f5f87,null));};exports[_0x5c2e('0x85')]=function(_0x24063a,_0x2ecc64,_0x411676){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x24063a[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x2ecc64,null))[_0x5c2e('0x2a')](function(_0x209734){if(_0x209734){return _0x209734['addAgents'](_0x24063a[_0x5c2e('0x51')][_0x5c2e('0x67')],_['omit'](_0x24063a[_0x5c2e('0x51')],[_0x5c2e('0x67'),'id'])||{})[_0x5c2e('0x86')](function(_0x4a432f){for(var _0x48a2b4=0x0;_0x48a2b4<_0x24063a['body']['ids'][_0x5c2e('0x3e')];_0x48a2b4+=0x1){socket[_0x5c2e('0x73')](_0x5c2e('0x74'),{'UserId':_0x24063a['body'][_0x5c2e('0x67')][_0x48a2b4],'OpenchannelQueueId':_0x24063a[_0x5c2e('0x4e')]['id']});}return _0x4a432f;});}})[_0x5c2e('0x2a')](respondWithResult(_0x2ecc64,null))[_0x5c2e('0x4c')](handleError(_0x2ecc64,null));};exports['removeAgents']=function(_0x3cf65b,_0x473ecb,_0x1b091d){return db[_0x5c2e('0x33')][_0x5c2e('0x57')]({'where':{'id':_0x3cf65b[_0x5c2e('0x4e')]['id']}})[_0x5c2e('0x2a')](handleEntityNotFound(_0x473ecb,null))['then'](function(_0x2bfb0c){if(_0x2bfb0c){return _0x2bfb0c[_0x5c2e('0x83')](_0x3cf65b[_0x5c2e('0x38')][_0x5c2e('0x67')])[_0x5c2e('0x2a')](function(){if(_['isArray'](_0x3cf65b['query']['ids'])){for(var _0x5a8344=0x0;_0x5a8344<_0x3cf65b[_0x5c2e('0x38')]['ids'][_0x5c2e('0x3e')];_0x5a8344+=0x1){socket[_0x5c2e('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3cf65b['query']['ids'][_0x5a8344]),'OpenchannelQueueId':Number(_0x3cf65b[_0x5c2e('0x4e')]['id'])});}}else{socket['emit'](_0x5c2e('0x84'),{'UserId':Number(_0x3cf65b[_0x5c2e('0x38')][_0x5c2e('0x67')]),'OpenchannelQueueId':Number(_0x3cf65b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x473ecb,null))[_0x5c2e('0x4c')](handleError(_0x473ecb,null));};exports[_0x5c2e('0x87')]=function(_0x59bd72,_0x8b26ff,_0x44081e){var _0x3f5e5e={};var _0xf948bd={};var _0x2c38b5;var _0x11de1d;return db[_0x5c2e('0x33')][_0x5c2e('0x5b')]({'where':{'id':_0x59bd72[_0x5c2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8b26ff,null))['then'](function(_0x1dae59){if(_0x1dae59){_0x2c38b5=_0x1dae59;_0xf948bd[_0x5c2e('0x37')]=_[_0x5c2e('0x39')](db[_0x5c2e('0x69')]['rawAttributes']);_0xf948bd[_0x5c2e('0x38')]=_[_0x5c2e('0x39')](_0x59bd72['query']);_0xf948bd['filters']=_[_0x5c2e('0x3b')](_0xf948bd['model'],_0xf948bd[_0x5c2e('0x38')]);_0x3f5e5e[_0x5c2e('0x3c')]=_[_0x5c2e('0x3b')](_0xf948bd[_0x5c2e('0x37')],qs[_0x5c2e('0x3d')](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x3d')]));_0x3f5e5e[_0x5c2e('0x3c')]=_0x3f5e5e[_0x5c2e('0x3c')][_0x5c2e('0x3e')]?_0x3f5e5e['attributes']:_0xf948bd['model'];_0x3f5e5e[_0x5c2e('0x5d')]=qs['sort'](_0x59bd72['query']['sort']);_0x3f5e5e[_0x5c2e('0x42')]=qs[_0x5c2e('0x3a')](_[_0x5c2e('0x43')](_0x59bd72['query'],_0xf948bd[_0x5c2e('0x3a')]));if(_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x44')]){_0x3f5e5e[_0x5c2e('0x42')]=_[_0x5c2e('0x45')](_0x3f5e5e[_0x5c2e('0x42')],{'$or':_['map'](_0x3f5e5e[_0x5c2e('0x3c')],function(_0x27c576){var _0x361198={};_0x361198[_0x27c576]={'$like':'%'+_0x59bd72['query'][_0x5c2e('0x44')]+'%'};return _0x361198;})});}_0x3f5e5e=_[_0x5c2e('0x45')]({},_0x3f5e5e,_0x59bd72['options']);return _0x2c38b5[_0x5c2e('0x87')](_0x3f5e5e);}})[_0x5c2e('0x2a')](function(_0x3a162f){if(_0x3a162f){_0x11de1d=_0x3a162f[_0x5c2e('0x3e')];if(!_0x59bd72['query'][_0x5c2e('0x3f')]('nolimit')){_0x3f5e5e[_0x5c2e('0x24')]=qs[_0x5c2e('0x24')](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x24')]);_0x3f5e5e['offset']=qs['offset'](_0x59bd72[_0x5c2e('0x38')][_0x5c2e('0x23')]);}return _0x2c38b5[_0x5c2e('0x87')](_0x3f5e5e);}})[_0x5c2e('0x2a')](function(_0x7c3d88){if(_0x7c3d88){return _0x7c3d88?{'count':_0x11de1d,'rows':_0x7c3d88}:null;}})[_0x5c2e('0x2a')](respondWithResult(_0x8b26ff,null))['catch'](handleError(_0x8b26ff,null));}; \ No newline at end of file +var _0x4d8e=['value','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','OpenchannelQueues','UserProfileResource','destroy','stack','name','send','index','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','OpenchannelQueue','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','order','OpenchannelQueueId','map','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4d8e,0x128));var _0xe4d8=function(_0x1faa02,_0x2b2b65){_0x1faa02=_0x1faa02-0x0;var _0x25b362=_0x4d8e[_0x1faa02];return _0x25b362;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4d8('0x0'));var rimraf=require(_0xe4d8('0x1'));var zipdir=require(_0xe4d8('0x2'));var jsonpatch=require(_0xe4d8('0x3'));var rp=require(_0xe4d8('0x4'));var moment=require(_0xe4d8('0x5'));var BPromise=require(_0xe4d8('0x6'));var Mustache=require(_0xe4d8('0x7'));var util=require(_0xe4d8('0x8'));var path=require(_0xe4d8('0x9'));var sox=require(_0xe4d8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4d8('0xb'));var jsforce=require(_0xe4d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe4d8('0xd'));var querystring=require(_0xe4d8('0xe'));var Papa=require(_0xe4d8('0xf'));var Redis=require(_0xe4d8('0x10'));var authService=require(_0xe4d8('0x11'));var qs=require(_0xe4d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4d8('0x13'));var logger=require(_0xe4d8('0x14'))(_0xe4d8('0x15'));var utils=require(_0xe4d8('0x16'));var config=require(_0xe4d8('0x17'));var licenseUtil=require(_0xe4d8('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe4d8('0x19')](config[_0xe4d8('0x1a')],{'host':_0xe4d8('0x1b'),'port':0x18eb});var socket=require(_0xe4d8('0x1c'))(new Redis(config[_0xe4d8('0x1a')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f7448,_0x169842){_0x169842=_0x169842||0xcc;return function(_0x445f42){if(_0x445f42){return _0x4f7448[_0xe4d8('0x1d')](_0x169842);}return _0x4f7448[_0xe4d8('0x1e')](_0x169842)[_0xe4d8('0x1f')]();};}function respondWithResult(_0x59c186,_0x442cae){_0x442cae=_0x442cae||0xc8;return function(_0x469bdd){if(_0x469bdd){return _0x59c186[_0xe4d8('0x1e')](_0x442cae)[_0xe4d8('0x20')](_0x469bdd);}};}function respondWithFilteredResult(_0x4f677e,_0x324c32){return function(_0x46772a){if(_0x46772a){var _0x57ea17=_0x46772a[_0xe4d8('0x21')],_0x32844a=_0x324c32[_0xe4d8('0x22')],_0x4a45fe=_0x324c32[_0xe4d8('0x22')]+_0x324c32[_0xe4d8('0x23')],_0x4c188e;if(_0x4a45fe>=_0x57ea17){_0x4a45fe=_0x57ea17;_0x4c188e=0xc8;}else{_0x4c188e=0xce;}_0x4f677e[_0xe4d8('0x1e')](_0x4c188e);return _0x4f677e[_0xe4d8('0x24')](_0xe4d8('0x25'),_0x32844a+'-'+_0x4a45fe+'/'+_0x57ea17)['json'](_0x46772a);}return null;};}function patchUpdates(_0x6aa63d){return function(_0xfa2357){try{jsonpatch[_0xe4d8('0x26')](_0xfa2357,_0x6aa63d,!![]);}catch(_0x486a35){return BPromise[_0xe4d8('0x27')](_0x486a35);}return _0xfa2357[_0xe4d8('0x28')]();};}function saveUpdates(_0x289e90,_0x1fac1a){return function(_0x1436ae){if(_0x1436ae){return _0x1436ae['update'](_0x289e90)['then'](function(_0x4e3010){return _0x4e3010;});}return null;};}function removeEntity(_0x5f2df3,_0x59d13c){return function(_0x3230e5){if(_0x3230e5){return _0x3230e5['destroy']()[_0xe4d8('0x29')](function(){var _0x53592c=_0x3230e5['get']({'plain':!![]});var _0xc2957b=_0xe4d8('0x2a');return db[_0xe4d8('0x2b')][_0xe4d8('0x2c')]({'where':{'type':_0xc2957b,'resourceId':_0x53592c['id']}})[_0xe4d8('0x29')](function(){return _0x3230e5;});})[_0xe4d8('0x29')](function(){_0x5f2df3[_0xe4d8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f78d,_0x35a424){return function(_0x5ecd63){if(!_0x5ecd63){_0x45f78d[_0xe4d8('0x1d')](0x194);}return _0x5ecd63;};}function handleError(_0xdb1d2e,_0x235f54){_0x235f54=_0x235f54||0x1f4;return function(_0x396524){logger['error'](_0x396524[_0xe4d8('0x2d')]);if(_0x396524[_0xe4d8('0x2e')]){delete _0x396524[_0xe4d8('0x2e')];}_0xdb1d2e['status'](_0x235f54)[_0xe4d8('0x2f')](_0x396524);};}exports[_0xe4d8('0x30')]=function(_0xe5c183,_0x31a6b4){var _0x3d39cb={},_0x5816ca={},_0x27ad97={'count':0x0,'rows':[]};var _0x586d45=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x19e34a){return{'name':_0x19e34a['fieldName'],'type':_0x19e34a['type'][_0xe4d8('0x31')]};});_0x5816ca[_0xe4d8('0x32')]=_['map'](_0x586d45,_0xe4d8('0x2e'));_0x5816ca[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0xe5c183['query']);_0x5816ca['filters']=_[_0xe4d8('0x35')](_0x5816ca[_0xe4d8('0x32')],_0x5816ca['query']);_0x3d39cb[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x5816ca[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x3d39cb[_0xe4d8('0x36')]=_0x3d39cb[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x3d39cb[_0xe4d8('0x36')]:_0x5816ca[_0xe4d8('0x32')];if(!_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x3d39cb[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0xe5c183['query'][_0xe4d8('0x23')]);_0x3d39cb[_0xe4d8('0x22')]=qs[_0xe4d8('0x22')](_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x22')]);}_0x3d39cb['order']=qs[_0xe4d8('0x3b')](_0xe5c183['query'][_0xe4d8('0x3b')]);_0x3d39cb[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0xe5c183[_0xe4d8('0x33')],_0x5816ca['filters']),_0x586d45);if(_0xe5c183[_0xe4d8('0x33')]['filter']){_0x3d39cb[_0xe4d8('0x3c')]=_['merge'](_0x3d39cb[_0xe4d8('0x3c')],{'$or':_['map'](_0x586d45,function(_0x1f1897){if(_0x1f1897[_0xe4d8('0x3f')]!==_0xe4d8('0x40')){var _0x1bb6fd={};_0x1bb6fd[_0x1f1897['name']]={'$like':'%'+_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x1bb6fd;}})});}_0x3d39cb=_[_0xe4d8('0x42')]({},_0x3d39cb,_0xe5c183[_0xe4d8('0x43')]);var _0x39ef4d={'where':_0x3d39cb[_0xe4d8('0x3c')]};return db['OpenchannelQueue'][_0xe4d8('0x21')](_0x39ef4d)[_0xe4d8('0x29')](function(_0x451bfd){_0x27ad97['count']=_0x451bfd;if(_0xe5c183[_0xe4d8('0x33')]['includeAll']){_0x3d39cb[_0xe4d8('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xe4d8('0x45')](_0x3d39cb);})['then'](function(_0x46a4d5){_0x27ad97[_0xe4d8('0x46')]=_0x46a4d5;return _0x27ad97;})[_0xe4d8('0x29')](respondWithFilteredResult(_0x31a6b4,_0x3d39cb))[_0xe4d8('0x47')](handleError(_0x31a6b4,null));};exports[_0xe4d8('0x48')]=function(_0xff5d7a,_0x2035cd){var _0x8ab037={'raw':!![],'where':{'id':_0xff5d7a[_0xe4d8('0x49')]['id']}},_0x33c954={};_0x33c954[_0xe4d8('0x32')]=_[_0xe4d8('0x34')](db['OpenchannelQueue'][_0xe4d8('0x4a')]);_0x33c954[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0xff5d7a['query']);_0x33c954[_0xe4d8('0x3d')]=_[_0xe4d8('0x35')](_0x33c954['model'],_0x33c954[_0xe4d8('0x33')]);_0x8ab037[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x33c954[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0xff5d7a[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x8ab037[_0xe4d8('0x36')]=_0x8ab037[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x8ab037[_0xe4d8('0x36')]:_0x33c954[_0xe4d8('0x32')];if(_0xff5d7a[_0xe4d8('0x33')][_0xe4d8('0x4b')]){_0x8ab037[_0xe4d8('0x44')]=[{'all':!![]}];}_0x8ab037=_[_0xe4d8('0x42')]({},_0x8ab037,_0xff5d7a[_0xe4d8('0x43')]);return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')](_0x8ab037)[_0xe4d8('0x29')](handleEntityNotFound(_0x2035cd,null))[_0xe4d8('0x29')](respondWithResult(_0x2035cd,null))[_0xe4d8('0x47')](handleError(_0x2035cd,null));};exports[_0xe4d8('0x4e')]=function(_0xc33c9a,_0x293446){return db['OpenchannelQueue'][_0xe4d8('0x4e')](_0xc33c9a[_0xe4d8('0x4f')],{})[_0xe4d8('0x29')](function(_0x1c5ca0){var _0x2ea119=_0xc33c9a[_0xe4d8('0x50')]['get']({'plain':!![]});if(!_0x2ea119)throw new Error(_0xe4d8('0x51'));if(_0x2ea119[_0xe4d8('0x52')]===_0xe4d8('0x50')){var _0x30d1a8=_0x1c5ca0[_0xe4d8('0x53')]({'plain':!![]});var _0xde734e=_0xe4d8('0x2a');return db[_0xe4d8('0x54')][_0xe4d8('0x4d')]({'where':{'name':_0xde734e,'userProfileId':_0x2ea119[_0xe4d8('0x55')]},'raw':!![]})[_0xe4d8('0x29')](function(_0x484073){if(_0x484073&&_0x484073[_0xe4d8('0x56')]===0x0){return db[_0xe4d8('0x2b')]['create']({'name':_0x30d1a8[_0xe4d8('0x2e')],'resourceId':_0x30d1a8['id'],'type':_0x484073['name'],'sectionId':_0x484073['id']},{})[_0xe4d8('0x29')](function(){return _0x1c5ca0;});}else{return _0x1c5ca0;}})[_0xe4d8('0x47')](function(_0x1f88ef){logger[_0xe4d8('0x57')](_0xe4d8('0x58'),_0x1f88ef);throw _0x1f88ef;});}return _0x1c5ca0;})['then'](respondWithResult(_0x293446,0xc9))[_0xe4d8('0x47')](handleError(_0x293446,null));};exports['update']=function(_0x4edbee,_0x188b2c){if(_0x4edbee[_0xe4d8('0x4f')]['id']){delete _0x4edbee[_0xe4d8('0x4f')]['id'];}return db[_0xe4d8('0x4c')]['find']({'where':{'id':_0x4edbee['params']['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x188b2c,null))[_0xe4d8('0x29')](saveUpdates(_0x4edbee[_0xe4d8('0x4f')],null))[_0xe4d8('0x29')](respondWithResult(_0x188b2c,null))['catch'](handleError(_0x188b2c,null));};exports['destroy']=function(_0x4971b4,_0x2ea9a9){return db['OpenchannelQueue'][_0xe4d8('0x4d')]({'where':{'id':_0x4971b4[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ea9a9,null))[_0xe4d8('0x29')](removeEntity(_0x2ea9a9,null))[_0xe4d8('0x47')](handleError(_0x2ea9a9,null));};exports[_0xe4d8('0x59')]=function(_0x172b5c,_0x32e83d){return db[_0xe4d8('0x4c')][_0xe4d8('0x59')]()[_0xe4d8('0x29')](respondWithResult(_0x32e83d,null))['catch'](handleError(_0x32e83d,null));};exports['getMembers']=function(_0x110067,_0x336ae9,_0x8b2dea){var _0x491797={'raw':!![],'where':{}},_0x5b9333={},_0x5c0e24;return db[_0xe4d8('0x4c')]['findOne']({'where':{'id':_0x110067[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x336ae9,null))['then'](function(_0x2910e7){if(_0x2910e7){_0x5c0e24=_0x2910e7[_0xe4d8('0x53')]({'plain':!![]});_0x5b9333['model']=_[_0xe4d8('0x34')](db['UserOpenchannelQueue']['rawAttributes']);_0x5b9333['query']=_[_0xe4d8('0x34')](_0x110067[_0xe4d8('0x33')]);_0x5b9333[_0xe4d8('0x3d')]=_['intersection'](_0x5b9333['model'],_0x5b9333[_0xe4d8('0x33')]);_0x491797[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x5b9333[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x491797[_0xe4d8('0x36')]=_0x491797[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x491797[_0xe4d8('0x36')]:_0x5b9333[_0xe4d8('0x32')];if(!_0x110067[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x491797[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x110067[_0xe4d8('0x33')]['limit']);_0x491797[_0xe4d8('0x22')]=qs['offset'](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x22')]);}_0x491797[_0xe4d8('0x5a')]=qs[_0xe4d8('0x3b')](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0x491797[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0x110067[_0xe4d8('0x33')],_0x5b9333[_0xe4d8('0x3d')]));_0x491797[_0xe4d8('0x3c')][_0xe4d8('0x5b')]=_0x2910e7['id'];if(_0x110067[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0x491797[_0xe4d8('0x3c')]=_['merge'](_0x491797[_0xe4d8('0x3c')],{'$or':_[_0xe4d8('0x5c')](_0x491797[_0xe4d8('0x36')],function(_0x1be6d1){var _0x260f32={};_0x260f32[_0x1be6d1]={'$like':'%'+_0x110067[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x260f32;})});}_0x491797=_[_0xe4d8('0x42')]({},_0x491797,_0x110067['options']);return db[_0xe4d8('0x5d')][_0xe4d8('0x45')](_0x491797);}})[_0xe4d8('0x29')](function(_0x5f2f59){if(_0x5f2f59){return db[_0xe4d8('0x5e')][_0xe4d8('0x5f')]({'where':{'id':_[_0xe4d8('0x5c')](_0x5f2f59,'UserId'),'role':_0xe4d8('0x60')},'attributes':['id',_0xe4d8('0x2e'),_0xe4d8('0x61'),_0xe4d8('0x62'),_0xe4d8('0x63')]});}})['then'](function(_0x4a7b00){if(_0x4a7b00){return{'count':_0x4a7b00[_0xe4d8('0x21')],'rows':_[_0xe4d8('0x5c')](_0x4a7b00[_0xe4d8('0x46')],function(_0x1d5f37){return{'membername':_0x1d5f37[_0xe4d8('0x2e')],'UserId':_0x1d5f37['id'],'queue_name':_0x5c0e24[_0xe4d8('0x2e')],'OpenchannelQueueId':_0x5c0e24['id'],'interface':util[_0xe4d8('0x64')](_0xe4d8('0x65'),_0xe4d8('0x66'),_0x1d5f37['name']),'penalty':0x0,'paused':_0x1d5f37['openchannelPause'],'createdAt':_0x1d5f37[_0xe4d8('0x63')],'updatedAt':_0x1d5f37[_0xe4d8('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4d8('0x29')](respondWithFilteredResult(_0x336ae9,_0x491797))[_0xe4d8('0x47')](handleError(_0x336ae9,null));};exports[_0xe4d8('0x67')]=function(_0x586fdf,_0x37671e,_0x55ad5a){var _0xfb12eb={};var _0x799362={};var _0x1b45be;var _0x1d3bbf;return db[_0xe4d8('0x4c')][_0xe4d8('0x68')]({'where':{'id':_0x586fdf[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x37671e,null))['then'](function(_0x50f352){if(_0x50f352){_0x1b45be=_0x50f352;_0x799362[_0xe4d8('0x32')]=_[_0xe4d8('0x34')](db[_0xe4d8('0x69')][_0xe4d8('0x4a')]);_0x799362[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0x586fdf[_0xe4d8('0x33')]);_0x799362['filters']=_['intersection'](_0x799362['model'],_0x799362['query']);_0xfb12eb[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x799362[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x586fdf[_0xe4d8('0x33')]['fields']));_0xfb12eb[_0xe4d8('0x36')]=_0xfb12eb[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0xfb12eb['attributes']:_0x799362['model'];_0xfb12eb['order']=qs[_0xe4d8('0x3b')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0xfb12eb[_0xe4d8('0x3c')]=qs['filters'](_[_0xe4d8('0x3e')](_0x586fdf['query'],_0x799362['filters']));if(_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0xfb12eb[_0xe4d8('0x3c')]=_[_0xe4d8('0x42')](_0xfb12eb[_0xe4d8('0x3c')],{'$or':_['map'](_0xfb12eb[_0xe4d8('0x36')],function(_0x568d50){var _0x364167={};_0x364167[_0x568d50]={'$like':'%'+_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x364167;})});}_0xfb12eb=_[_0xe4d8('0x42')]({},_0xfb12eb,_0x586fdf[_0xe4d8('0x43')]);return _0x1b45be[_0xe4d8('0x67')](_0xfb12eb);}})['then'](function(_0x439ddd){if(_0x439ddd){_0x1d3bbf=_0x439ddd[_0xe4d8('0x38')];if(!_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x39')]('nolimit')){_0xfb12eb[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x23')]);_0xfb12eb['offset']=qs[_0xe4d8('0x22')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x22')]);}return _0x1b45be[_0xe4d8('0x67')](_0xfb12eb);}})['then'](function(_0x5eaefb){if(_0x5eaefb){return _0x5eaefb?{'count':_0x1d3bbf,'rows':_0x5eaefb}:null;}})[_0xe4d8('0x29')](respondWithResult(_0x37671e,null))[_0xe4d8('0x47')](handleError(_0x37671e,null));};exports['addTeams']=function(_0x5258e6,_0x4f9df5,_0x5b20bd){var _0x54dcde=_0x5258e6[_0xe4d8('0x4f')][_0xe4d8('0x6a')];return db[_0xe4d8('0x69')][_0xe4d8('0x45')]({'where':{'id':_0x54dcde},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4d8('0x6b'),'attributes':['id',_0xe4d8('0x2e'),_0xe4d8('0x6c'),_0xe4d8('0x6d'),_0xe4d8('0x6e')],'raw':!![]}]})['then'](function(_0x53cc48){if(_0x53cc48){var _0x427a9c=_[_0xe4d8('0x6f')](_0x53cc48,function(_0x3ab535){var _0x1193d8=_0x3ab535[_0xe4d8('0x53')]({'plain':!![]});return _0x1193d8[_0xe4d8('0x6b')];});return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x5258e6['params']['id']}})[_0xe4d8('0x29')](function(_0x5014f5){return db[_0xe4d8('0x70')][_0xe4d8('0x71')](function(_0x2a0f87){return _0x5014f5[_0xe4d8('0x72')](_0x54dcde,{'transaction':_0x2a0f87})[_0xe4d8('0x29')](function(){return BPromise['each'](_0x427a9c,function(_0x5e4574){return db[_0xe4d8('0x5d')][_0xe4d8('0x73')]({'where':{'UserId':_0x5e4574['id'],'OpenchannelQueueId':_0x5258e6[_0xe4d8('0x49')]['id']},'transaction':_0x2a0f87});});})[_0xe4d8('0x29')](function(){_0x427a9c[_0xe4d8('0x74')](function(_0xedfa8e){socket[_0xe4d8('0x75')](_0xe4d8('0x76'),{'UserId':_0xedfa8e['id'],'OpenchannelQueueId':_0x5014f5['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9df5,null))[_0xe4d8('0x47')](handleError(_0x4f9df5,null));};exports[_0xe4d8('0x77')]=function(_0x38c9fb,_0x43f768,_0x2c11aa){return db['Team'][_0xe4d8('0x45')]({'where':{'id':_0x38c9fb['query'][_0xe4d8('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xe4d8('0x5e')],'as':_0xe4d8('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe4d8('0x29')](handleEntityNotFound(_0x43f768,null))[_0xe4d8('0x29')](function(_0x5be62e){var _0x2f20c0=_[_0xe4d8('0x5c')](_0x5be62e,'id');var _0x1a7e76=[];var _0x480a07=[];var _0x19beca=squel[_0xe4d8('0x78')]();_0x19beca[_0xe4d8('0x79')](_0xe4d8('0x7a'))[_0xe4d8('0x7b')](_0xe4d8('0x7c'),'tq')['join']('user_has_teams','ut',_0xe4d8('0x7d'))['where'](_0xe4d8('0x7e'),_0x38c9fb[_0xe4d8('0x49')]['id']);for(var _0x3eb455=0x0;_0x3eb455<_0x5be62e['length'];_0x3eb455+=0x1){let _0x3dd959=_0x5be62e[_0x3eb455];for(var _0x503877=0x0;_0x503877<_0x3dd959[_0xe4d8('0x6b')]['length'];_0x503877+=0x1){let _0x3ea000=_0x3dd959['Agents'][_0x503877];var _0x1b973e=_0x19beca[_0xe4d8('0x7f')]();_0x1b973e[_0xe4d8('0x3c')](_0xe4d8('0x80'),_0x3ea000['id']);_0x480a07['push'](db[_0xe4d8('0x70')]['query'](_0x1b973e[_0xe4d8('0x81')](),{'type':db[_0xe4d8('0x70')][_0xe4d8('0x82')][_0xe4d8('0x83')]})['then'](function(_0x51485e){if(_0x51485e[_0xe4d8('0x38')]===0x1){return _0x3ea000['id'];}else{var _0x579ba8=_['every'](_[_0xe4d8('0x5c')](_0x51485e,'TeamId'),function(_0x5450ad){return _[_0xe4d8('0x84')](_0x2f20c0,_0x5450ad);});if(_0x579ba8){return _0x3ea000['id'];}}}));}}return BPromise[_0xe4d8('0x85')](_0x480a07)['then'](function(_0x586a17){_0x1a7e76=_(_0x1a7e76)[_0xe4d8('0x86')](_0x586a17)[_0xe4d8('0x87')]()[_0xe4d8('0x88')]();return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x38c9fb[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](function(_0x1d3f79){return db[_0xe4d8('0x70')]['transaction'](function(_0x3c99f3){return _0x1d3f79['removeTeams'](_0x38c9fb[_0xe4d8('0x33')][_0xe4d8('0x6a')],{'transaction':_0x3c99f3})[_0xe4d8('0x29')](function(){if(!_[_0xe4d8('0x89')](_0x1a7e76)){return _0x1d3f79[_0xe4d8('0x8a')](_0x1a7e76,{'transaction':_0x3c99f3});}})[_0xe4d8('0x29')](function(){_0x1a7e76[_0xe4d8('0x74')](function(_0x59a220){socket[_0xe4d8('0x75')]('userOpenchannelQueue:remove',{'UserId':_0x59a220,'OpenchannelQueueId':_0x1d3f79['id']});});});});});});})[_0xe4d8('0x29')](respondWithStatusCode(_0x43f768,null))[_0xe4d8('0x47')](handleError(_0x43f768,null));};exports[_0xe4d8('0x8b')]=function(_0x5ab494,_0x33e2ef,_0x3b3c21){return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x5ab494[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x33e2ef,null))['then'](function(_0xd6a1f3){if(_0xd6a1f3){return _0xd6a1f3['addAgents'](_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')],_[_0xe4d8('0x8c')](_0x5ab494[_0xe4d8('0x4f')],[_0xe4d8('0x6a'),'id'])||{})['spread'](function(_0x3aabda){for(var _0x254599=0x0;_0x254599<_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')][_0xe4d8('0x38')];_0x254599+=0x1){socket[_0xe4d8('0x75')]('userOpenchannelQueue:save',{'UserId':_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')][_0x254599],'OpenchannelQueueId':_0x5ab494['params']['id']});}return _0x3aabda;});}})[_0xe4d8('0x29')](respondWithResult(_0x33e2ef,null))[_0xe4d8('0x47')](handleError(_0x33e2ef,null));};exports[_0xe4d8('0x8a')]=function(_0xceab2b,_0x4f0d41,_0x1fc4f2){return db[_0xe4d8('0x4c')]['find']({'where':{'id':_0xceab2b[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f0d41,null))[_0xe4d8('0x29')](function(_0x224292){if(_0x224292){return _0x224292[_0xe4d8('0x8a')](_0xceab2b['query'][_0xe4d8('0x6a')])[_0xe4d8('0x29')](function(){if(_[_0xe4d8('0x8d')](_0xceab2b[_0xe4d8('0x33')]['ids'])){for(var _0x183723=0x0;_0x183723<_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')][_0xe4d8('0x38')];_0x183723+=0x1){socket[_0xe4d8('0x75')](_0xe4d8('0x8e'),{'UserId':Number(_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')][_0x183723]),'OpenchannelQueueId':Number(_0xceab2b[_0xe4d8('0x49')]['id'])});}}else{socket[_0xe4d8('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')]),'OpenchannelQueueId':Number(_0xceab2b[_0xe4d8('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f0d41,null))['catch'](handleError(_0x4f0d41,null));};exports[_0xe4d8('0x8f')]=function(_0x5a03b9,_0x593aff,_0x53e460){var _0x2432b7={};var _0xd8f5ed={};var _0xfdfa5b;var _0x6c0785;return db[_0xe4d8('0x4c')][_0xe4d8('0x68')]({'where':{'id':_0x5a03b9[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x593aff,null))[_0xe4d8('0x29')](function(_0x492d12){if(_0x492d12){_0xfdfa5b=_0x492d12;_0xd8f5ed[_0xe4d8('0x32')]=_['keys'](db[_0xe4d8('0x5e')][_0xe4d8('0x4a')]);_0xd8f5ed[_0xe4d8('0x33')]=_['keys'](_0x5a03b9['query']);_0xd8f5ed[_0xe4d8('0x3d')]=_[_0xe4d8('0x35')](_0xd8f5ed[_0xe4d8('0x32')],_0xd8f5ed[_0xe4d8('0x33')]);_0x2432b7[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0xd8f5ed[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x5a03b9['query'][_0xe4d8('0x37')]));_0x2432b7[_0xe4d8('0x36')]=_0x2432b7[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x2432b7['attributes']:_0xd8f5ed[_0xe4d8('0x32')];_0x2432b7[_0xe4d8('0x5a')]=qs[_0xe4d8('0x3b')](_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0x2432b7[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0x5a03b9[_0xe4d8('0x33')],_0xd8f5ed['filters']));if(_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0x2432b7[_0xe4d8('0x3c')]=_[_0xe4d8('0x42')](_0x2432b7[_0xe4d8('0x3c')],{'$or':_[_0xe4d8('0x5c')](_0x2432b7['attributes'],function(_0x58a9b2){var _0x371dd6={};_0x371dd6[_0x58a9b2]={'$like':'%'+_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x371dd6;})});}_0x2432b7=_[_0xe4d8('0x42')]({},_0x2432b7,_0x5a03b9[_0xe4d8('0x43')]);return _0xfdfa5b['getAgents'](_0x2432b7);}})[_0xe4d8('0x29')](function(_0x250059){if(_0x250059){_0x6c0785=_0x250059['length'];if(!_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x2432b7[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x5a03b9[_0xe4d8('0x33')]['limit']);_0x2432b7[_0xe4d8('0x22')]=qs[_0xe4d8('0x22')](_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x22')]);}return _0xfdfa5b[_0xe4d8('0x8f')](_0x2432b7);}})['then'](function(_0x3c4e68){if(_0x3c4e68){return _0x3c4e68?{'count':_0x6c0785,'rows':_0x3c4e68}:null;}})[_0xe4d8('0x29')](respondWithResult(_0x593aff,null))[_0xe4d8('0x47')](handleError(_0x593aff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d5f88ab..d9cddcd 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 _0x1c98=['OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x70582f,_0x94c2c){var _0x244a1f=function(_0x1c715c){while(--_0x1c715c){_0x70582f['push'](_0x70582f['shift']());}};_0x244a1f(++_0x94c2c);}(_0x1c98,0x1c9));var _0x81c9=function(_0x4691fc,_0x36dcd3){_0x4691fc=_0x4691fc-0x0;var _0xe54241=_0x1c98[_0x4691fc];return _0xe54241;};'use strict';var EventEmitter=require(_0x81c9('0x0'));var OpenchannelQueue=require(_0x81c9('0x1'))['db'][_0x81c9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x81c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81c9('0x4')};function emitEvent(_0xdccfd9){return function(_0x3ac02e,_0x3c8bfc,_0x44b577){OpenchannelQueueEvents[_0x81c9('0x5')](_0xdccfd9+':'+_0x3ac02e['id'],_0x3ac02e);OpenchannelQueueEvents['emit'](_0xdccfd9,_0x3ac02e);_0x44b577(null);};}for(var e in events){if(events[_0x81c9('0x6')](e)){var event=events[e];OpenchannelQueue[_0x81c9('0x7')](e,emitEvent(event));}}module[_0x81c9('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x972a=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0xcde227,_0x14c6f8){var _0x369846=function(_0x456570){while(--_0x456570){_0xcde227['push'](_0xcde227['shift']());}};_0x369846(++_0x14c6f8);}(_0x972a,0x11c));var _0xa972=function(_0x1a61c1,_0x2f064d){_0x1a61c1=_0x1a61c1-0x0;var _0x2240bf=_0x972a[_0x1a61c1];return _0x2240bf;};'use strict';var EventEmitter=require(_0xa972('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa972('0x1')](0x0);var events={'afterCreate':_0xa972('0x2'),'afterUpdate':_0xa972('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37c9f9){return function(_0x30db9b,_0x15bd5a,_0xb8ea30){OpenchannelQueueEvents[_0xa972('0x4')](_0x37c9f9+':'+_0x30db9b['id'],_0x30db9b);OpenchannelQueueEvents[_0xa972('0x4')](_0x37c9f9,_0x30db9b);_0xb8ea30(null);};}for(var e in events){if(events[_0xa972('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa972('0x6')](e,emitEvent(event));}}module[_0xa972('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index abc4491..d45621a 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 _0xa2a1=['../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','api','moment','bluebird'];(function(_0x52ac03,_0x2d0cdb){var _0x419c19=function(_0x4f6acb){while(--_0x4f6acb){_0x52ac03['push'](_0x52ac03['shift']());}};_0x419c19(++_0x2d0cdb);}(_0xa2a1,0x1b5));var _0x1a2a=function(_0x105ae7,_0x187a6f){_0x105ae7=_0x105ae7-0x0;var _0x1e7641=_0xa2a1[_0x105ae7];return _0x1e7641;};'use strict';var _=require('lodash');var util=require(_0x1a2a('0x0'));var logger=require('../../config/logger')(_0x1a2a('0x1'));var moment=require(_0x1a2a('0x2'));var BPromise=require(_0x1a2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a2a('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x1a2a('0x5')]=function(_0x498096,_0x82d075){return _0x498096[_0x1a2a('0x6')](_0x1a2a('0x7'),attributes,{'tableName':_0x1a2a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aac=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x555ebb,_0x5cf17b){var _0x22c6e9=function(_0x4064be){while(--_0x4064be){_0x555ebb['push'](_0x555ebb['shift']());}};_0x22c6e9(++_0x5cf17b);}(_0x8aac,0x6f));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8aa('0x0'));var util=require(_0xc8aa('0x1'));var logger=require(_0xc8aa('0x2'))(_0xc8aa('0x3'));var moment=require('moment');var BPromise=require(_0xc8aa('0x4'));var rp=require(_0xc8aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8aa('0x6'));var config=require(_0xc8aa('0x7'));var attributes=require(_0xc8aa('0x8'));module[_0xc8aa('0x9')]=function(_0x4975be,_0x54e1b3){return _0x4975be[_0xc8aa('0xa')](_0xc8aa('0xb'),attributes,{'tableName':_0xc8aa('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 d78bd18..da4853d 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 _0x7a84=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis'];(function(_0x584985,_0x31a01f){var _0x123c16=function(_0x54ae33){while(--_0x54ae33){_0x584985['push'](_0x584985['shift']());}};_0x123c16(++_0x31a01f);}(_0x7a84,0xf8));var _0x47a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a84[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x47a8('0x0'));var util=require('util');var moment=require(_0x47a8('0x1'));var BPromise=require(_0x47a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47a8('0x3'));var db=require(_0x47a8('0x4'))['db'];var utils=require(_0x47a8('0x5'));var logger=require(_0x47a8('0x6'))(_0x47a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x47a8('0x8'));var client=jayson[_0x47a8('0x9')]['http']({'port':0x232a});config[_0x47a8('0xa')]=_[_0x47a8('0xb')](config[_0x47a8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a8('0xa')]));require('./openchannelQueue.socket')[_0x47a8('0xc')](socket);function respondWithRpcPromise(_0x512bcc,_0x1e8de4,_0x166936){return new BPromise(function(_0xb29598,_0x250790){return client[_0x47a8('0xd')](_0x512bcc,_0x166936)[_0x47a8('0xe')](function(_0x22ddb4){logger[_0x47a8('0xf')](_0x47a8('0x10'),_0x1e8de4,_0x47a8('0x11'));logger[_0x47a8('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e8de4,_0x47a8('0x11'),JSON['stringify'](_0x22ddb4));if(_0x22ddb4['error']){if(_0x22ddb4['error']['code']===0x1f4){logger[_0x47a8('0x13')](_0x47a8('0x10'),_0x1e8de4,_0x22ddb4['error'][_0x47a8('0x14')]);return _0x250790(_0x22ddb4[_0x47a8('0x13')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,_0x22ddb4['error'][_0x47a8('0x14')]);return _0xb29598(_0x22ddb4[_0x47a8('0x13')][_0x47a8('0x14')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,'request\x20sent');_0xb29598(_0x22ddb4[_0x47a8('0x15')]['message']);}})[_0x47a8('0x16')](function(_0x154ff7){logger[_0x47a8('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e8de4,_0x154ff7);_0x250790(_0x154ff7);});});}exports[_0x47a8('0x17')]=function(_0x4f1193){var _0x15d7bd=this;return new Promise(function(_0x3a0ca2,_0x2a2644){return db['OpenchannelQueue'][_0x47a8('0x18')]({'raw':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1b')]||null:null,'attributes':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1c')]||null:null,'limit':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1d')]||null:null,'include':_0x4f1193[_0x47a8('0x19')]?_0x4f1193[_0x47a8('0x19')]['include']?_[_0x47a8('0x1e')](_0x4f1193[_0x47a8('0x19')][_0x47a8('0x1f')],function(_0x2760cf){return{'model':db[_0x2760cf[_0x47a8('0x20')]],'as':_0x2760cf['as'],'attributes':_0x2760cf[_0x47a8('0x1c')],'include':_0x2760cf['include']?_[_0x47a8('0x1e')](_0x2760cf['include'],function(_0x3731e6){return{'model':db[_0x3731e6['model']],'as':_0x3731e6['as'],'attributes':_0x3731e6[_0x47a8('0x1c')],'include':_0x3731e6[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x3731e6['include'],function(_0xc193f2){return{'model':db[_0xc193f2[_0x47a8('0x20')]],'as':_0xc193f2['as'],'attributes':_0xc193f2[_0x47a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x47a8('0xe')](function(_0x512a9b){logger[_0x47a8('0xf')](_0x47a8('0x17'),_0x4f1193);logger[_0x47a8('0x12')]('GetOpenchannelQueue',_0x4f1193,JSON[_0x47a8('0x21')](_0x512a9b));_0x3a0ca2(_0x512a9b);})['catch'](function(_0x58f684){logger[_0x47a8('0x13')](_0x47a8('0x17'),_0x58f684['message'],_0x4f1193);_0x2a2644(_0x15d7bd[_0x47a8('0x13')](0x1f4,_0x58f684['message']));});});};exports[_0x47a8('0x22')]=function(_0x16c551){var _0x6db51b=this;return new Promise(function(_0x4e71db,_0x47db84){return db['OpenchannelQueue'][_0x47a8('0x23')]({'raw':_0x16c551[_0x47a8('0x19')]?_0x16c551['options'][_0x47a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x16c551[_0x47a8('0x19')]?_0x16c551['options']['where']||null:null,'attributes':_0x16c551['options']?_0x16c551[_0x47a8('0x19')][_0x47a8('0x1c')]||null:null,'include':_0x16c551[_0x47a8('0x19')]?_0x16c551[_0x47a8('0x19')][_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x16c551[_0x47a8('0x19')][_0x47a8('0x1f')],function(_0x16142a){return{'model':db[_0x16142a[_0x47a8('0x20')]],'as':_0x16142a['as'],'attributes':_0x16142a['attributes'],'include':_0x16142a[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x16142a[_0x47a8('0x1f')],function(_0x5d906c){return{'model':db[_0x5d906c[_0x47a8('0x20')]],'as':_0x5d906c['as'],'attributes':_0x5d906c[_0x47a8('0x1c')],'include':_0x5d906c[_0x47a8('0x1f')]?_[_0x47a8('0x1e')](_0x5d906c[_0x47a8('0x1f')],function(_0x26bb7c){return{'model':db[_0x26bb7c['model']],'as':_0x26bb7c['as'],'attributes':_0x26bb7c[_0x47a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x47a8('0xe')](function(_0x5757c0){logger[_0x47a8('0xf')]('ShowOpenchannelQueue',_0x16c551);logger['debug'](_0x47a8('0x22'),_0x16c551,JSON['stringify'](_0x5757c0));_0x4e71db(_0x5757c0);})['catch'](function(_0x1c4547){logger[_0x47a8('0x13')](_0x47a8('0x22'),_0x1c4547[_0x47a8('0x14')],_0x16c551);_0x47db84(_0x6db51b['error'](0x1f4,_0x1c4547[_0x47a8('0x14')]));});});}; \ No newline at end of file +var _0xb248=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','raw','options','where','include','map','attributes','model','GetOpenchannelQueue','OpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11ae28,_0x5a2fa9){var _0x5012ec=function(_0x520237){while(--_0x520237){_0x11ae28['push'](_0x11ae28['shift']());}};_0x5012ec(++_0x5a2fa9);}(_0xb248,0x71));var _0x8b24=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb248[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x8b24('0x0'));var util=require(_0x8b24('0x1'));var moment=require(_0x8b24('0x2'));var BPromise=require(_0x8b24('0x3'));var rs=require(_0x8b24('0x4'));var fs=require('fs');var Redis=require(_0x8b24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x6'));var logger=require(_0x8b24('0x7'))(_0x8b24('0x8'));var config=require(_0x8b24('0x9'));var jayson=require(_0x8b24('0xa'));var client=jayson[_0x8b24('0xb')]['http']({'port':0x232a});config[_0x8b24('0xc')]=_[_0x8b24('0xd')](config['redis'],{'host':_0x8b24('0xe'),'port':0x18eb});var socket=require(_0x8b24('0xf'))(new Redis(config[_0x8b24('0xc')]));require(_0x8b24('0x10'))[_0x8b24('0x11')](socket);function respondWithRpcPromise(_0x17e98c,_0x5ae472,_0x4bf381){return new BPromise(function(_0x368a1b,_0x192876){return client[_0x8b24('0x12')](_0x17e98c,_0x4bf381)[_0x8b24('0x13')](function(_0x1f694a){logger[_0x8b24('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,_0x8b24('0x15'));logger[_0x8b24('0x16')](_0x8b24('0x17'),_0x5ae472,'request\x20sent',JSON[_0x8b24('0x18')](_0x1f694a));if(_0x1f694a['error']){if(_0x1f694a[_0x8b24('0x19')][_0x8b24('0x1a')]===0x1f4){logger[_0x8b24('0x19')](_0x8b24('0x1b'),_0x5ae472,_0x1f694a['error'][_0x8b24('0x1c')]);return _0x192876(_0x1f694a[_0x8b24('0x19')][_0x8b24('0x1c')]);}logger[_0x8b24('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,_0x1f694a[_0x8b24('0x19')]['message']);return _0x368a1b(_0x1f694a['error'][_0x8b24('0x1c')]);}else{logger[_0x8b24('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,'request\x20sent');_0x368a1b(_0x1f694a[_0x8b24('0x1d')][_0x8b24('0x1c')]);}})[_0x8b24('0x1e')](function(_0x7891c0){logger[_0x8b24('0x19')](_0x8b24('0x1b'),_0x5ae472,_0x7891c0);_0x192876(_0x7891c0);});});}exports['GetOpenchannelQueue']=function(_0x1ef827){var _0x181cac=this;return new Promise(function(_0x377a8f,_0x40d629){return db['OpenchannelQueue']['findAll']({'raw':_0x1ef827['options']?_0x1ef827['options'][_0x8b24('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')][_0x8b24('0x21')]||null:null,'attributes':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')]['attributes']||null:null,'limit':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')]['limit']||null:null,'include':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')][_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x1ef827[_0x8b24('0x20')][_0x8b24('0x22')],function(_0x355128){return{'model':db[_0x355128['model']],'as':_0x355128['as'],'attributes':_0x355128['attributes'],'include':_0x355128[_0x8b24('0x22')]?_['map'](_0x355128[_0x8b24('0x22')],function(_0x225cd9){return{'model':db[_0x225cd9['model']],'as':_0x225cd9['as'],'attributes':_0x225cd9[_0x8b24('0x24')],'include':_0x225cd9[_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x225cd9[_0x8b24('0x22')],function(_0xc0b7e2){return{'model':db[_0xc0b7e2[_0x8b24('0x25')]],'as':_0xc0b7e2['as'],'attributes':_0xc0b7e2[_0x8b24('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x13')](function(_0x1b79b6){logger[_0x8b24('0x14')](_0x8b24('0x26'),_0x1ef827);logger['debug'](_0x8b24('0x26'),_0x1ef827,JSON['stringify'](_0x1b79b6));_0x377a8f(_0x1b79b6);})[_0x8b24('0x1e')](function(_0x750aea){logger['error'](_0x8b24('0x26'),_0x750aea[_0x8b24('0x1c')],_0x1ef827);_0x40d629(_0x181cac[_0x8b24('0x19')](0x1f4,_0x750aea[_0x8b24('0x1c')]));});});};exports['ShowOpenchannelQueue']=function(_0xfd1bed){var _0x425653=this;return new Promise(function(_0x365a64,_0x27b75b){return db[_0x8b24('0x27')]['find']({'raw':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed[_0x8b24('0x20')][_0x8b24('0x1f')]===undefined?!![]:![]:!![],'where':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed[_0x8b24('0x20')][_0x8b24('0x21')]||null:null,'attributes':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed['options'][_0x8b24('0x24')]||null:null,'include':_0xfd1bed['options']?_0xfd1bed['options'][_0x8b24('0x22')]?_[_0x8b24('0x23')](_0xfd1bed['options']['include'],function(_0x32649f){return{'model':db[_0x32649f[_0x8b24('0x25')]],'as':_0x32649f['as'],'attributes':_0x32649f[_0x8b24('0x24')],'include':_0x32649f[_0x8b24('0x22')]?_['map'](_0x32649f[_0x8b24('0x22')],function(_0x79f5d9){return{'model':db[_0x79f5d9[_0x8b24('0x25')]],'as':_0x79f5d9['as'],'attributes':_0x79f5d9[_0x8b24('0x24')],'include':_0x79f5d9[_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x79f5d9['include'],function(_0x631dd8){return{'model':db[_0x631dd8[_0x8b24('0x25')]],'as':_0x631dd8['as'],'attributes':_0x631dd8[_0x8b24('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x13')](function(_0x12efff){logger['info'](_0x8b24('0x28'),_0xfd1bed);logger['debug'](_0x8b24('0x28'),_0xfd1bed,JSON[_0x8b24('0x18')](_0x12efff));_0x365a64(_0x12efff);})[_0x8b24('0x1e')](function(_0x34c2ed){logger[_0x8b24('0x19')]('ShowOpenchannelQueue',_0x34c2ed[_0x8b24('0x1c')],_0xfd1bed);_0x27b75b(_0x425653['error'](0x1f4,_0x34c2ed[_0x8b24('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 76625b0..91a7f43 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 _0x540d=['register','length','openchannelQueue:','save','remove'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x540d,0x71));var _0xd540=function(_0x301ef6,_0x25e340){_0x301ef6=_0x301ef6-0x0;var _0x5da2ef=_0x540d[_0x301ef6];return _0x5da2ef;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xd540('0x0'),_0xd540('0x1'),'update'];function createListener(_0x2aa3a1,_0x32e2a6){return function(_0x5e1ddb){_0x32e2a6['emit'](_0x2aa3a1,_0x5e1ddb);};}function removeListener(_0x398a43,_0x10227c){return function(){OpenchannelQueueEvents['removeListener'](_0x398a43,_0x10227c);};}exports[_0xd540('0x2')]=function(_0x3af909){for(var _0x9f6faf=0x0,_0x17caf3=events[_0xd540('0x3')];_0x9f6faf<_0x17caf3;_0x9f6faf++){var _0x2d1869=events[_0x9f6faf];var _0x4c6bd6=createListener(_0xd540('0x4')+_0x2d1869,_0x3af909);OpenchannelQueueEvents['on'](_0x2d1869,_0x4c6bd6);}}; \ No newline at end of file +var _0xaad7=['openchannelQueue:','./openchannelQueue.events','save','remove','update','length'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xaad7,0x15d));var _0x7aad=function(_0x3fe610,_0x47e914){_0x3fe610=_0x3fe610-0x0;var _0x2830c9=_0xaad7[_0x3fe610];return _0x2830c9;};'use strict';var OpenchannelQueueEvents=require(_0x7aad('0x0'));var events=[_0x7aad('0x1'),_0x7aad('0x2'),_0x7aad('0x3')];function createListener(_0x39c3da,_0x5e8839){return function(_0x3c9563){_0x5e8839['emit'](_0x39c3da,_0x3c9563);};}function removeListener(_0x17d130,_0x2bd340){return function(){OpenchannelQueueEvents['removeListener'](_0x17d130,_0x2bd340);};}exports['register']=function(_0x1d6ed7){for(var _0xd1513a=0x0,_0x1d09d9=events[_0x7aad('0x4')];_0xd1513a<_0x1d09d9;_0xd1513a++){var _0x519b2b=events[_0xd1513a];var _0x434c22=createListener(_0x7aad('0x5')+_0x519b2b,_0x1d6ed7);OpenchannelQueueEvents['on'](_0x519b2b,_0x434c22);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 12a6634..87616d5 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 _0xfe28=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xfe28,0x1a8));var _0x8fe2=function(_0x1336af,_0xa87e6){_0x1336af=_0x1336af-0x0;var _0x220134=_0xfe28[_0x1336af];return _0x220134;};'use strict';var multer=require(_0x8fe2('0x0'));var util=require(_0x8fe2('0x1'));var path=require(_0x8fe2('0x2'));var timeout=require(_0x8fe2('0x3'));var express=require(_0x8fe2('0x4'));var router=express[_0x8fe2('0x5')]();var auth=require(_0x8fe2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8fe2('0x7'));var controller=require(_0x8fe2('0x8'));router['get']('/',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0xa')]);router[_0x8fe2('0xb')](_0x8fe2('0xc'),auth[_0x8fe2('0x9')](),controller[_0x8fe2('0xd')]);router[_0x8fe2('0xb')](_0x8fe2('0xe'),auth['isAuthenticated'](),controller[_0x8fe2('0xf')]);router[_0x8fe2('0x10')]('/',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x11')]);router[_0x8fe2('0x12')](_0x8fe2('0xe'),auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x13')]);router[_0x8fe2('0x14')]('/:id',auth[_0x8fe2('0x9')](),controller[_0x8fe2('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8678=['put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8678,0x159));var _0x8867=function(_0x3cb0e6,_0x7638bb){_0x3cb0e6=_0x3cb0e6-0x0;var _0x31d53c=_0x8678[_0x3cb0e6];return _0x31d53c;};'use strict';var multer=require(_0x8867('0x0'));var util=require(_0x8867('0x1'));var path=require(_0x8867('0x2'));var timeout=require(_0x8867('0x3'));var express=require(_0x8867('0x4'));var router=express['Router']();var auth=require(_0x8867('0x5'));var interaction=require(_0x8867('0x6'));var config=require(_0x8867('0x7'));var controller=require(_0x8867('0x8'));router[_0x8867('0x9')]('/',auth[_0x8867('0xa')](),controller[_0x8867('0xb')]);router['get'](_0x8867('0xc'),auth[_0x8867('0xa')](),controller['describe']);router[_0x8867('0x9')](_0x8867('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8867('0xa')](),controller[_0x8867('0xe')]);router[_0x8867('0xf')](_0x8867('0xd'),auth[_0x8867('0xa')](),controller['update']);router['delete'](_0x8867('0xd'),auth[_0x8867('0xa')](),controller[_0x8867('0x10')]);module[_0x8867('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c2581b1..abf0c30 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 _0x9b28=['sequelize','STRING','DATE'];(function(_0x3a7ace,_0x21a68e){var _0x537598=function(_0xe3a017){while(--_0xe3a017){_0x3a7ace['push'](_0x3a7ace['shift']());}};_0x537598(++_0x21a68e);}(_0x9b28,0x87));var _0x89b2=function(_0x217b21,_0x53d0d5){_0x217b21=_0x217b21-0x0;var _0x449d78=_0x9b28[_0x217b21];return _0x449d78;};'use strict';var moment=require('moment');var Sequelize=require(_0x89b2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x89b2('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x89b2('0x1')]},'joinAt':{'type':Sequelize[_0x89b2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x89b2('0x2')]},'reason':{'type':Sequelize[_0x89b2('0x1')]}}; \ No newline at end of file +var _0x9225=['sequelize','STRING','DATE','moment'];(function(_0x202272,_0x4fc1c6){var _0x2ec82c=function(_0x4e4009){while(--_0x4e4009){_0x202272['push'](_0x202272['shift']());}};_0x2ec82c(++_0x4fc1c6);}(_0x9225,0x11b));var _0x5922=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9225[_0x2064e5];return _0x21a233;};'use strict';var moment=require(_0x5922('0x0'));var Sequelize=require(_0x5922('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5922('0x2')]},'joinAt':{'type':Sequelize[_0x5922('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5922('0x3')]},'exitAt':{'type':Sequelize[_0x5922('0x3')]},'reason':{'type':Sequelize[_0x5922('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a2d1abc..9d3f117 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 _0xe3ee=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','merge','map','filter','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','rimraf','zip-dir','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x74e783,_0x15bae7){var _0x92276f=function(_0x4db513){while(--_0x4db513){_0x74e783['push'](_0x74e783['shift']());}};_0x92276f(++_0x15bae7);}(_0xe3ee,0x116));var _0xee3e=function(_0x58cd83,_0x5172f7){_0x58cd83=_0x58cd83-0x0;var _0x12cd94=_0xe3ee[_0x58cd83];return _0x12cd94;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xee3e('0x0'));var zipdir=require(_0xee3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee3e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee3e('0x3'));var path=require('path');var sox=require(_0xee3e('0x4'));var csv=require(_0xee3e('0x5'));var ejs=require(_0xee3e('0x6'));var fs=require('fs');var _=require(_0xee3e('0x7'));var squel=require(_0xee3e('0x8'));var crypto=require(_0xee3e('0x9'));var jsforce=require(_0xee3e('0xa'));var deskjs=require(_0xee3e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xee3e('0xc'));var Papa=require(_0xee3e('0xd'));var Redis=require('ioredis');var authService=require(_0xee3e('0xe'));var qs=require(_0xee3e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee3e('0x10'));var logger=require(_0xee3e('0x11'))(_0xee3e('0x12'));var utils=require(_0xee3e('0x13'));var config=require(_0xee3e('0x14'));var licenseUtil=require(_0xee3e('0x15'));var db=require(_0xee3e('0x16'))['db'];function respondWithStatusCode(_0x239052,_0x48506e){_0x48506e=_0x48506e||0xcc;return function(_0x4faeb8){if(_0x4faeb8){return _0x239052[_0xee3e('0x17')](_0x48506e);}return _0x239052[_0xee3e('0x18')](_0x48506e)['end']();};}function respondWithResult(_0x209595,_0x1c0eb0){_0x1c0eb0=_0x1c0eb0||0xc8;return function(_0xccec54){if(_0xccec54){return _0x209595['status'](_0x1c0eb0)[_0xee3e('0x19')](_0xccec54);}};}function respondWithFilteredResult(_0x4743d3,_0x502f47){return function(_0x51e498){if(_0x51e498){var _0x370f32=_0x51e498['count'],_0x450c5b=_0x502f47['offset'],_0x266449=_0x502f47['offset']+_0x502f47[_0xee3e('0x1a')],_0x512609;if(_0x266449>=_0x370f32){_0x266449=_0x370f32;_0x512609=0xc8;}else{_0x512609=0xce;}_0x4743d3[_0xee3e('0x18')](_0x512609);return _0x4743d3[_0xee3e('0x1b')](_0xee3e('0x1c'),_0x450c5b+'-'+_0x266449+'/'+_0x370f32)[_0xee3e('0x19')](_0x51e498);}return null;};}function patchUpdates(_0x4b1d63){return function(_0x2d1f93){try{jsonpatch[_0xee3e('0x1d')](_0x2d1f93,_0x4b1d63,!![]);}catch(_0x2200f1){return BPromise[_0xee3e('0x1e')](_0x2200f1);}return _0x2d1f93[_0xee3e('0x1f')]();};}function saveUpdates(_0x3b6d40,_0x5528f9){return function(_0x121166){if(_0x121166){return _0x121166[_0xee3e('0x20')](_0x3b6d40)[_0xee3e('0x21')](function(_0x30f0e3){return _0x30f0e3;});}return null;};}function removeEntity(_0x236de7,_0xfbf279){return function(_0x374847){if(_0x374847){return _0x374847[_0xee3e('0x22')]()[_0xee3e('0x21')](function(){_0x236de7[_0xee3e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4100,_0x4b0d94){return function(_0x4aaf22){if(!_0x4aaf22){_0x5e4100[_0xee3e('0x17')](0x194);}return _0x4aaf22;};}function handleError(_0xc1a5af,_0x48555e){_0x48555e=_0x48555e||0x1f4;return function(_0xbfc488){logger[_0xee3e('0x23')](_0xbfc488[_0xee3e('0x24')]);if(_0xbfc488['name']){delete _0xbfc488[_0xee3e('0x25')];}_0xc1a5af[_0xee3e('0x18')](_0x48555e)[_0xee3e('0x26')](_0xbfc488);};}exports[_0xee3e('0x27')]=function(_0x5ec872,_0x59baf3){var _0x1c687c={},_0x3b6c7e={},_0x300b39={'count':0x0,'rows':[]};var _0x59f17f=_['map'](db[_0xee3e('0x28')][_0xee3e('0x29')],function(_0x179406){return{'name':_0x179406[_0xee3e('0x2a')],'type':_0x179406[_0xee3e('0x2b')][_0xee3e('0x2c')]};});_0x3b6c7e[_0xee3e('0x2d')]=_['map'](_0x59f17f,'name');_0x3b6c7e[_0xee3e('0x2e')]=_[_0xee3e('0x2f')](_0x5ec872['query']);_0x3b6c7e[_0xee3e('0x30')]=_['intersection'](_0x3b6c7e[_0xee3e('0x2d')],_0x3b6c7e[_0xee3e('0x2e')]);_0x1c687c[_0xee3e('0x31')]=_[_0xee3e('0x32')](_0x3b6c7e['model'],qs[_0xee3e('0x33')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x33')]));_0x1c687c[_0xee3e('0x31')]=_0x1c687c[_0xee3e('0x31')][_0xee3e('0x34')]?_0x1c687c[_0xee3e('0x31')]:_0x3b6c7e[_0xee3e('0x2d')];if(!_0x5ec872[_0xee3e('0x2e')]['hasOwnProperty'](_0xee3e('0x35'))){_0x1c687c[_0xee3e('0x1a')]=qs[_0xee3e('0x1a')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x1a')]);_0x1c687c[_0xee3e('0x36')]=qs[_0xee3e('0x36')](_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x36')]);}_0x1c687c[_0xee3e('0x37')]=qs[_0xee3e('0x38')](_0x5ec872['query'][_0xee3e('0x38')]);_0x1c687c[_0xee3e('0x39')]=qs['filters'](_[_0xee3e('0x3a')](_0x5ec872[_0xee3e('0x2e')],_0x3b6c7e[_0xee3e('0x30')]),_0x59f17f);if(_0x5ec872[_0xee3e('0x2e')]['filter']){_0x1c687c[_0xee3e('0x39')]=_[_0xee3e('0x3b')](_0x1c687c[_0xee3e('0x39')],{'$or':_[_0xee3e('0x3c')](_0x59f17f,function(_0x471057){if(_0x471057[_0xee3e('0x2b')]!=='VIRTUAL'){var _0x44c8bf={};_0x44c8bf[_0x471057['name']]={'$like':'%'+_0x5ec872[_0xee3e('0x2e')][_0xee3e('0x3d')]+'%'};return _0x44c8bf;}})});}_0x1c687c=_['merge']({},_0x1c687c,_0x5ec872['options']);var _0x1a18db={'where':_0x1c687c[_0xee3e('0x39')]};return db[_0xee3e('0x28')]['count'](_0x1a18db)[_0xee3e('0x21')](function(_0x5437d9){_0x300b39[_0xee3e('0x3e')]=_0x5437d9;if(_0x5ec872[_0xee3e('0x2e')]['includeAll']){_0x1c687c[_0xee3e('0x3f')]=[{'all':!![]}];}return db[_0xee3e('0x28')][_0xee3e('0x40')](_0x1c687c);})['then'](function(_0x29c267){_0x300b39[_0xee3e('0x41')]=_0x29c267;return _0x300b39;})['then'](respondWithFilteredResult(_0x59baf3,_0x1c687c))[_0xee3e('0x42')](handleError(_0x59baf3,null));};exports[_0xee3e('0x43')]=function(_0x21110f,_0x11c10a){var _0x8cdcbb={'raw':!![],'where':{'id':_0x21110f[_0xee3e('0x44')]['id']}},_0x1e278a={};_0x1e278a['model']=_[_0xee3e('0x2f')](db[_0xee3e('0x28')][_0xee3e('0x29')]);_0x1e278a['query']=_[_0xee3e('0x2f')](_0x21110f[_0xee3e('0x2e')]);_0x1e278a[_0xee3e('0x30')]=_[_0xee3e('0x32')](_0x1e278a[_0xee3e('0x2d')],_0x1e278a[_0xee3e('0x2e')]);_0x8cdcbb['attributes']=_[_0xee3e('0x32')](_0x1e278a['model'],qs[_0xee3e('0x33')](_0x21110f[_0xee3e('0x2e')][_0xee3e('0x33')]));_0x8cdcbb[_0xee3e('0x31')]=_0x8cdcbb[_0xee3e('0x31')]['length']?_0x8cdcbb['attributes']:_0x1e278a['model'];if(_0x21110f[_0xee3e('0x2e')][_0xee3e('0x45')]){_0x8cdcbb[_0xee3e('0x3f')]=[{'all':!![]}];}_0x8cdcbb=_[_0xee3e('0x3b')]({},_0x8cdcbb,_0x21110f['options']);return db[_0xee3e('0x28')]['find'](_0x8cdcbb)[_0xee3e('0x21')](handleEntityNotFound(_0x11c10a,null))[_0xee3e('0x21')](respondWithResult(_0x11c10a,null))[_0xee3e('0x42')](handleError(_0x11c10a,null));};exports[_0xee3e('0x46')]=function(_0x408347,_0x18c769){return db[_0xee3e('0x28')]['create'](_0x408347[_0xee3e('0x47')],{})[_0xee3e('0x21')](respondWithResult(_0x18c769,0xc9))['catch'](handleError(_0x18c769,null));};exports['update']=function(_0x57697d,_0x55f087){if(_0x57697d[_0xee3e('0x47')]['id']){delete _0x57697d['body']['id'];}return db['OpenchannelQueueReport'][_0xee3e('0x48')]({'where':{'id':_0x57697d[_0xee3e('0x44')]['id']}})[_0xee3e('0x21')](handleEntityNotFound(_0x55f087,null))[_0xee3e('0x21')](saveUpdates(_0x57697d[_0xee3e('0x47')],null))[_0xee3e('0x21')](respondWithResult(_0x55f087,null))['catch'](handleError(_0x55f087,null));};exports[_0xee3e('0x22')]=function(_0x158c4d,_0x3473a3){return db[_0xee3e('0x28')][_0xee3e('0x48')]({'where':{'id':_0x158c4d['params']['id']}})['then'](handleEntityNotFound(_0x3473a3,null))[_0xee3e('0x21')](removeEntity(_0x3473a3,null))[_0xee3e('0x42')](handleError(_0x3473a3,null));};exports[_0xee3e('0x49')]=function(_0x151255,_0x347e61){return db[_0xee3e('0x28')][_0xee3e('0x49')]()[_0xee3e('0x21')](respondWithResult(_0x347e61,null))[_0xee3e('0x42')](handleError(_0x347e61,null));}; \ No newline at end of file +var _0xe43c=['update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelQueueReport','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject'];(function(_0x583829,_0x188b0e){var _0x34d994=function(_0x568753){while(--_0x568753){_0x583829['push'](_0x583829['shift']());}};_0x34d994(++_0x188b0e);}(_0xe43c,0x180));var _0xce43=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe43c[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xce43('0x0'));var emlformat=require(_0xce43('0x1'));var rimraf=require(_0xce43('0x2'));var zipdir=require(_0xce43('0x3'));var jsonpatch=require(_0xce43('0x4'));var rp=require(_0xce43('0x5'));var moment=require('moment');var BPromise=require(_0xce43('0x6'));var Mustache=require('mustache');var util=require(_0xce43('0x7'));var path=require(_0xce43('0x8'));var sox=require(_0xce43('0x9'));var csv=require(_0xce43('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];function respondWithStatusCode(_0x193861,_0x4c092b){_0x4c092b=_0x4c092b||0xcc;return function(_0x226f21){if(_0x226f21){return _0x193861[_0xce43('0x14')](_0x4c092b);}return _0x193861[_0xce43('0x15')](_0x4c092b)[_0xce43('0x16')]();};}function respondWithResult(_0x4b7970,_0x3034c7){_0x3034c7=_0x3034c7||0xc8;return function(_0x607d92){if(_0x607d92){return _0x4b7970[_0xce43('0x15')](_0x3034c7)[_0xce43('0x17')](_0x607d92);}};}function respondWithFilteredResult(_0x4cb58a,_0x588ddb){return function(_0x3c0948){if(_0x3c0948){var _0x3e4218=_0x3c0948[_0xce43('0x18')],_0x2eb70b=_0x588ddb['offset'],_0x2a9cb4=_0x588ddb[_0xce43('0x19')]+_0x588ddb[_0xce43('0x1a')],_0xd5282;if(_0x2a9cb4>=_0x3e4218){_0x2a9cb4=_0x3e4218;_0xd5282=0xc8;}else{_0xd5282=0xce;}_0x4cb58a[_0xce43('0x15')](_0xd5282);return _0x4cb58a[_0xce43('0x1b')]('Content-Range',_0x2eb70b+'-'+_0x2a9cb4+'/'+_0x3e4218)[_0xce43('0x17')](_0x3c0948);}return null;};}function patchUpdates(_0x403606){return function(_0x1976eb){try{jsonpatch[_0xce43('0x1c')](_0x1976eb,_0x403606,!![]);}catch(_0x2685fe){return BPromise[_0xce43('0x1d')](_0x2685fe);}return _0x1976eb['save']();};}function saveUpdates(_0x5bd459,_0x383f69){return function(_0x5973b9){if(_0x5973b9){return _0x5973b9[_0xce43('0x1e')](_0x5bd459)[_0xce43('0x1f')](function(_0x85b5a8){return _0x85b5a8;});}return null;};}function removeEntity(_0x5a5bd1,_0x57dcd4){return function(_0x37b34e){if(_0x37b34e){return _0x37b34e[_0xce43('0x20')]()[_0xce43('0x1f')](function(){_0x5a5bd1[_0xce43('0x15')](0xcc)[_0xce43('0x16')]();});}};}function handleEntityNotFound(_0x2b9874,_0x118a89){return function(_0x4e7611){if(!_0x4e7611){_0x2b9874[_0xce43('0x14')](0x194);}return _0x4e7611;};}function handleError(_0x2e58b0,_0x1edcda){_0x1edcda=_0x1edcda||0x1f4;return function(_0x2ae225){logger['error'](_0x2ae225[_0xce43('0x21')]);if(_0x2ae225[_0xce43('0x22')]){delete _0x2ae225[_0xce43('0x22')];}_0x2e58b0[_0xce43('0x15')](_0x1edcda)[_0xce43('0x23')](_0x2ae225);};}exports[_0xce43('0x24')]=function(_0x49e958,_0x371985){var _0x5cb93a={},_0xe9a34c={},_0x394280={'count':0x0,'rows':[]};var _0x453981=_[_0xce43('0x25')](db['OpenchannelQueueReport'][_0xce43('0x26')],function(_0x4402f8){return{'name':_0x4402f8[_0xce43('0x27')],'type':_0x4402f8[_0xce43('0x28')]['key']};});_0xe9a34c[_0xce43('0x29')]=_[_0xce43('0x25')](_0x453981,'name');_0xe9a34c[_0xce43('0x2a')]=_[_0xce43('0x2b')](_0x49e958[_0xce43('0x2a')]);_0xe9a34c[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0xe9a34c[_0xce43('0x29')],_0xe9a34c['query']);_0x5cb93a['attributes']=_[_0xce43('0x2d')](_0xe9a34c[_0xce43('0x29')],qs['fields'](_0x49e958[_0xce43('0x2a')][_0xce43('0x2e')]));_0x5cb93a[_0xce43('0x2f')]=_0x5cb93a[_0xce43('0x2f')][_0xce43('0x30')]?_0x5cb93a['attributes']:_0xe9a34c[_0xce43('0x29')];if(!_0x49e958[_0xce43('0x2a')][_0xce43('0x31')](_0xce43('0x32'))){_0x5cb93a[_0xce43('0x1a')]=qs[_0xce43('0x1a')](_0x49e958[_0xce43('0x2a')][_0xce43('0x1a')]);_0x5cb93a[_0xce43('0x19')]=qs[_0xce43('0x19')](_0x49e958[_0xce43('0x2a')][_0xce43('0x19')]);}_0x5cb93a[_0xce43('0x33')]=qs[_0xce43('0x34')](_0x49e958[_0xce43('0x2a')][_0xce43('0x34')]);_0x5cb93a[_0xce43('0x35')]=qs[_0xce43('0x2c')](_['pick'](_0x49e958[_0xce43('0x2a')],_0xe9a34c[_0xce43('0x2c')]),_0x453981);if(_0x49e958[_0xce43('0x2a')][_0xce43('0x36')]){_0x5cb93a[_0xce43('0x35')]=_[_0xce43('0x37')](_0x5cb93a['where'],{'$or':_[_0xce43('0x25')](_0x453981,function(_0x1af0c2){if(_0x1af0c2[_0xce43('0x28')]!==_0xce43('0x38')){var _0x15ea6b={};_0x15ea6b[_0x1af0c2['name']]={'$like':'%'+_0x49e958['query'][_0xce43('0x36')]+'%'};return _0x15ea6b;}})});}_0x5cb93a=_[_0xce43('0x37')]({},_0x5cb93a,_0x49e958['options']);var _0x338c54={'where':_0x5cb93a[_0xce43('0x35')]};return db[_0xce43('0x39')][_0xce43('0x18')](_0x338c54)['then'](function(_0x42b73e){_0x394280['count']=_0x42b73e;if(_0x49e958[_0xce43('0x2a')][_0xce43('0x3a')]){_0x5cb93a['include']=[{'all':!![]}];}return db[_0xce43('0x39')][_0xce43('0x3b')](_0x5cb93a);})[_0xce43('0x1f')](function(_0x51cf3f){_0x394280['rows']=_0x51cf3f;return _0x394280;})[_0xce43('0x1f')](respondWithFilteredResult(_0x371985,_0x5cb93a))[_0xce43('0x3c')](handleError(_0x371985,null));};exports[_0xce43('0x3d')]=function(_0x4bf26d,_0xf20a50){var _0x149f6a={'raw':!![],'where':{'id':_0x4bf26d[_0xce43('0x3e')]['id']}},_0x43f171={};_0x43f171['model']=_[_0xce43('0x2b')](db[_0xce43('0x39')][_0xce43('0x26')]);_0x43f171[_0xce43('0x2a')]=_[_0xce43('0x2b')](_0x4bf26d[_0xce43('0x2a')]);_0x43f171[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0x43f171[_0xce43('0x29')],_0x43f171['query']);_0x149f6a['attributes']=_[_0xce43('0x2d')](_0x43f171[_0xce43('0x29')],qs[_0xce43('0x2e')](_0x4bf26d[_0xce43('0x2a')][_0xce43('0x2e')]));_0x149f6a[_0xce43('0x2f')]=_0x149f6a[_0xce43('0x2f')][_0xce43('0x30')]?_0x149f6a[_0xce43('0x2f')]:_0x43f171[_0xce43('0x29')];if(_0x4bf26d[_0xce43('0x2a')][_0xce43('0x3a')]){_0x149f6a[_0xce43('0x3f')]=[{'all':!![]}];}_0x149f6a=_[_0xce43('0x37')]({},_0x149f6a,_0x4bf26d[_0xce43('0x40')]);return db[_0xce43('0x39')][_0xce43('0x41')](_0x149f6a)[_0xce43('0x1f')](handleEntityNotFound(_0xf20a50,null))['then'](respondWithResult(_0xf20a50,null))[_0xce43('0x3c')](handleError(_0xf20a50,null));};exports[_0xce43('0x42')]=function(_0x1021f4,_0x519e46){return db['OpenchannelQueueReport'][_0xce43('0x42')](_0x1021f4['body'],{})['then'](respondWithResult(_0x519e46,0xc9))['catch'](handleError(_0x519e46,null));};exports['update']=function(_0x3de6ec,_0x1b37ab){if(_0x3de6ec['body']['id']){delete _0x3de6ec[_0xce43('0x43')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3de6ec[_0xce43('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b37ab,null))['then'](saveUpdates(_0x3de6ec[_0xce43('0x43')],null))[_0xce43('0x1f')](respondWithResult(_0x1b37ab,null))['catch'](handleError(_0x1b37ab,null));};exports['destroy']=function(_0x440cc0,_0x4a5f2d){return db[_0xce43('0x39')][_0xce43('0x41')]({'where':{'id':_0x440cc0['params']['id']}})[_0xce43('0x1f')](handleEntityNotFound(_0x4a5f2d,null))[_0xce43('0x1f')](removeEntity(_0x4a5f2d,null))[_0xce43('0x3c')](handleError(_0x4a5f2d,null));};exports[_0xce43('0x44')]=function(_0x24a969,_0x3dc610){return db[_0xce43('0x39')][_0xce43('0x44')]()[_0xce43('0x1f')](respondWithResult(_0x3dc610,null))['catch'](handleError(_0x3dc610,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index bca4cd7..95eecfd 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 _0xf53f=['../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37c065,_0x4f3ac5){var _0x414f2a=function(_0x1daa7c){while(--_0x1daa7c){_0x37c065['push'](_0x37c065['shift']());}};_0x414f2a(++_0x4f3ac5);}(_0xf53f,0x8d));var _0xff53=function(_0xdd37de,_0x281b6e){_0xdd37de=_0xdd37de-0x0;var _0x563d53=_0xf53f[_0xdd37de];return _0x563d53;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var moment=require(_0xff53('0x4'));var BPromise=require(_0xff53('0x5'));var rp=require(_0xff53('0x6'));var fs=require('fs');var path=require(_0xff53('0x7'));var rimraf=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var attributes=require(_0xff53('0xa'));module[_0xff53('0xb')]=function(_0x54d39c,_0x54e637){return _0x54d39c[_0xff53('0xc')]('OpenchannelQueueReport',attributes,{'tableName':_0xff53('0xd'),'paranoid':![],'indexes':[{'name':_0xff53('0xe'),'fields':[_0xff53('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x971d=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x5e2116,_0x4a1748){var _0x18f0ed=function(_0x481f73){while(--_0x481f73){_0x5e2116['push'](_0x5e2116['shift']());}};_0x18f0ed(++_0x4a1748);}(_0x971d,0xc5));var _0xd971=function(_0x1492ec,_0x401196){_0x1492ec=_0x1492ec-0x0;var _0x278614=_0x971d[_0x1492ec];return _0x278614;};'use strict';var _=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var logger=require(_0xd971('0x2'))(_0xd971('0x3'));var moment=require('moment');var BPromise=require(_0xd971('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd971('0x5'));var rimraf=require(_0xd971('0x6'));var config=require(_0xd971('0x7'));var attributes=require(_0xd971('0x8'));module[_0xd971('0x9')]=function(_0x2e19c7,_0x1c82ee){return _0x2e19c7[_0xd971('0xa')](_0xd971('0xb'),attributes,{'tableName':_0xd971('0xc'),'paranoid':![],'indexes':[{'name':_0xd971('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 209b20a..a690a73 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 _0xdb25=['error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','debug','catch','update','where','attributes','limit','UpdateOpenchannelQueueReport','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c469b,_0x247c81){var _0x4e5014=function(_0x43a906){while(--_0x43a906){_0x1c469b['push'](_0x1c469b['shift']());}};_0x4e5014(++_0x247c81);}(_0xdb25,0x185));var _0x5db2=function(_0x5bdd2c,_0x5cd637){_0x5bdd2c=_0x5bdd2c-0x0;var _0x593f56=_0xdb25[_0x5bdd2c];return _0x593f56;};'use strict';var _=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var moment=require('moment');var BPromise=require(_0x5db2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5db2('0x3'));var db=require(_0x5db2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5db2('0x5'));var jayson=require(_0x5db2('0x6'));var client=jayson[_0x5db2('0x7')][_0x5db2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1846d1,_0x3199db,_0x5b097b){return new BPromise(function(_0xf57163,_0x22cd22){return client[_0x5db2('0x9')](_0x1846d1,_0x5b097b)[_0x5db2('0xa')](function(_0x5ba364){logger[_0x5db2('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3199db,'request\x20sent');logger['debug'](_0x5db2('0xc'),_0x3199db,_0x5db2('0xd'),JSON['stringify'](_0x5ba364));if(_0x5ba364['error']){if(_0x5ba364[_0x5db2('0xe')][_0x5db2('0xf')]===0x1f4){logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x5ba364['error'][_0x5db2('0x11')]);return _0x22cd22(_0x5ba364[_0x5db2('0xe')][_0x5db2('0x11')]);}logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x5ba364[_0x5db2('0xe')]['message']);return _0xf57163(_0x5ba364['error'][_0x5db2('0x11')]);}else{logger['info'](_0x5db2('0x10'),_0x3199db,_0x5db2('0xd'));_0xf57163(_0x5ba364['result'][_0x5db2('0x11')]);}})['catch'](function(_0x22b410){logger[_0x5db2('0xe')](_0x5db2('0x10'),_0x3199db,_0x22b410);_0x22cd22(_0x22b410);});});}exports[_0x5db2('0x12')]=function(_0x134990){var _0x29c5c4=this;return new Promise(function(_0x1ba3df,_0x3d7fcd){return db[_0x5db2('0x13')][_0x5db2('0x14')](_0x134990[_0x5db2('0x15')],{'raw':_0x134990['options']?_0x134990[_0x5db2('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5db2('0xa')](function(_0xe3f768){logger['info'](_0x5db2('0x12'),_0x134990);logger[_0x5db2('0x17')](_0x5db2('0x12'),_0x134990,JSON['stringify'](_0xe3f768));_0x1ba3df(_0xe3f768);})[_0x5db2('0x18')](function(_0x649118){logger[_0x5db2('0xe')](_0x5db2('0x12'),_0x649118['message'],_0x134990);_0x3d7fcd(_0x29c5c4[_0x5db2('0xe')](0x1f4,_0x649118['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x26c532){var _0x30303e=this;return new Promise(function(_0x19b1ab,_0x31c5d8){return db[_0x5db2('0x13')][_0x5db2('0x19')](_0x26c532[_0x5db2('0x15')],{'raw':_0x26c532[_0x5db2('0x16')]?_0x26c532['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c532[_0x5db2('0x16')]?_0x26c532[_0x5db2('0x16')][_0x5db2('0x1a')]||null:null,'attributes':_0x26c532[_0x5db2('0x16')]?_0x26c532['options'][_0x5db2('0x1b')]||null:null,'limit':_0x26c532[_0x5db2('0x16')]?_0x26c532[_0x5db2('0x16')][_0x5db2('0x1c')]||null:null})[_0x5db2('0xa')](function(_0x3c1bac){logger[_0x5db2('0xb')](_0x5db2('0x1d'),_0x26c532);logger[_0x5db2('0x17')]('UpdateOpenchannelQueueReport',_0x26c532,JSON[_0x5db2('0x1e')](_0x3c1bac));_0x19b1ab(_0x3c1bac);})['catch'](function(_0x5123b6){logger[_0x5db2('0xe')](_0x5db2('0x1d'),_0x5123b6['message'],_0x26c532);_0x31c5d8(_0x30303e[_0x5db2('0xe')](0x1f4,_0x5123b6['message']));});});}; \ No newline at end of file +var _0x0ee4=['result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','info','catch','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x0ee4,0x77));var _0x40ee=function(_0x3228c7,_0x85629b){_0x3228c7=_0x3228c7-0x0;var _0x215147=_0x0ee4[_0x3228c7];return _0x215147;};'use strict';var _=require(_0x40ee('0x0'));var util=require('util');var moment=require(_0x40ee('0x1'));var BPromise=require(_0x40ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40ee('0x3'));var db=require(_0x40ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x40ee('0x5'))(_0x40ee('0x6'));var config=require(_0x40ee('0x7'));var jayson=require(_0x40ee('0x8'));var client=jayson[_0x40ee('0x9')][_0x40ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5916a3,_0x3376f7,_0x4394de){return new BPromise(function(_0x9f1aad,_0x2d3b62){return client[_0x40ee('0xb')](_0x5916a3,_0x4394de)[_0x40ee('0xc')](function(_0x498bf3){logger['info'](_0x40ee('0xd'),_0x3376f7,'request\x20sent');logger[_0x40ee('0xe')](_0x40ee('0xf'),_0x3376f7,_0x40ee('0x10'),JSON[_0x40ee('0x11')](_0x498bf3));if(_0x498bf3[_0x40ee('0x12')]){if(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x13')]===0x1f4){logger['error'](_0x40ee('0xd'),_0x3376f7,_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);return _0x2d3b62(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);}logger['error'](_0x40ee('0xd'),_0x3376f7,_0x498bf3['error'][_0x40ee('0x14')]);return _0x9f1aad(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);}else{logger['info'](_0x40ee('0xd'),_0x3376f7,_0x40ee('0x10'));_0x9f1aad(_0x498bf3[_0x40ee('0x15')][_0x40ee('0x14')]);}})['catch'](function(_0x38c55b){logger[_0x40ee('0x12')](_0x40ee('0xd'),_0x3376f7,_0x38c55b);_0x2d3b62(_0x38c55b);});});}exports[_0x40ee('0x16')]=function(_0x4562b1){var _0x45751a=this;return new Promise(function(_0x4a8943,_0x219996){return db[_0x40ee('0x17')][_0x40ee('0x18')](_0x4562b1['body'],{'raw':_0x4562b1[_0x40ee('0x19')]?_0x4562b1[_0x40ee('0x19')][_0x40ee('0x1a')]===undefined?!![]:![]:!![]})[_0x40ee('0xc')](function(_0x50887e){logger[_0x40ee('0x1b')]('CreateOpenchannelQueueReport',_0x4562b1);logger[_0x40ee('0xe')](_0x40ee('0x16'),_0x4562b1,JSON['stringify'](_0x50887e));_0x4a8943(_0x50887e);})[_0x40ee('0x1c')](function(_0x5422bc){logger[_0x40ee('0x12')](_0x40ee('0x16'),_0x5422bc[_0x40ee('0x14')],_0x4562b1);_0x219996(_0x45751a[_0x40ee('0x12')](0x1f4,_0x5422bc[_0x40ee('0x14')]));});});};exports[_0x40ee('0x1d')]=function(_0x2f2822){var _0x5b664f=this;return new Promise(function(_0x3da420,_0x371fc0){return db['OpenchannelQueueReport'][_0x40ee('0x1e')](_0x2f2822[_0x40ee('0x1f')],{'raw':_0x2f2822['options']?_0x2f2822[_0x40ee('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x20')]||null:null,'attributes':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x21')]||null:null,'limit':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x22')]||null:null})[_0x40ee('0xc')](function(_0x1ea89e){logger[_0x40ee('0x1b')](_0x40ee('0x1d'),_0x2f2822);logger[_0x40ee('0xe')]('UpdateOpenchannelQueueReport',_0x2f2822,JSON[_0x40ee('0x11')](_0x1ea89e));_0x3da420(_0x1ea89e);})[_0x40ee('0x1c')](function(_0x415baa){logger[_0x40ee('0x12')](_0x40ee('0x1d'),_0x415baa[_0x40ee('0x14')],_0x2f2822);_0x371fc0(_0x5b664f[_0x40ee('0x12')](0x1f4,_0x415baa[_0x40ee('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c17d250..4a24d10 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(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 d9e36a7..a63b522 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 _0x3a17=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x213569,_0x3554f4){var _0xb450e6=function(_0x5c5847){while(--_0x5c5847){_0x213569['push'](_0x213569['shift']());}};_0xb450e6(++_0x3554f4);}(_0x3a17,0x8c));var _0x73a1=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x3a17[_0x3e44fa];return _0x2a0aba;};'use strict';var moment=require(_0x73a1('0x0'));var Sequelize=require(_0x73a1('0x1'));module[_0x73a1('0x2')]={'uniqueid':{'type':Sequelize[_0x73a1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x73a1('0x4')](_0x73a1('0x5'),_0x73a1('0x6'),_0x73a1('0x7')),'allowNull':![],'defaultValue':_0x73a1('0x7')},'transferredAt':{'type':Sequelize[_0x73a1('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x73a1('0x9')]}}; \ No newline at end of file +var _0x2656=['STRING','account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x56b067,_0x536dec){var _0x27f66a=function(_0x18ecf6){while(--_0x18ecf6){_0x56b067['push'](_0x56b067['shift']());}};_0x27f66a(++_0x536dec);}(_0x2656,0x165));var _0x6265=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x2656[_0x3e3bee];return _0x3ae14c;};'use strict';var moment=require(_0x6265('0x0'));var Sequelize=require(_0x6265('0x1'));module[_0x6265('0x2')]={'uniqueid':{'type':Sequelize[_0x6265('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6265('0x4'),'agent',_0x6265('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6265('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6265('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f5416f1..aad63cd 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 _0xef98=['sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x45c6dc,_0x46b21b){var _0x29623e=function(_0x23959a){while(--_0x23959a){_0x45c6dc['push'](_0x45c6dc['shift']());}};_0x29623e(++_0x46b21b);}(_0xef98,0x1c2));var _0x8ef9=function(_0xb63d5c,_0x509748){_0xb63d5c=_0xb63d5c-0x0;var _0x5c2ae0=_0xef98[_0xb63d5c];return _0x5c2ae0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8ef9('0x0'));var zipdir=require(_0x8ef9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ef9('0x2'));var moment=require('moment');var BPromise=require(_0x8ef9('0x3'));var Mustache=require(_0x8ef9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8ef9('0x5'));var csv=require('to-csv');var ejs=require(_0x8ef9('0x6'));var fs=require('fs');var _=require(_0x8ef9('0x7'));var squel=require('squel');var crypto=require(_0x8ef9('0x8'));var jsforce=require(_0x8ef9('0x9'));var deskjs=require(_0x8ef9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8ef9('0xb'));var Papa=require(_0x8ef9('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ef9('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x8ef9('0xe'));var config=require(_0x8ef9('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ef9('0x10'))['db'];function respondWithStatusCode(_0x1b67fe,_0x295b08){_0x295b08=_0x295b08||0xcc;return function(_0x1267f8){if(_0x1267f8){return _0x1b67fe[_0x8ef9('0x11')](_0x295b08);}return _0x1b67fe[_0x8ef9('0x12')](_0x295b08)['end']();};}function respondWithResult(_0x325d1d,_0x38c73b){_0x38c73b=_0x38c73b||0xc8;return function(_0x44c861){if(_0x44c861){return _0x325d1d[_0x8ef9('0x12')](_0x38c73b)[_0x8ef9('0x13')](_0x44c861);}};}function respondWithFilteredResult(_0x5cbcf6,_0x1b33b8){return function(_0x4fdb0b){if(_0x4fdb0b){var _0x3f7300=_0x4fdb0b[_0x8ef9('0x14')],_0x304128=_0x1b33b8['offset'],_0x231e8a=_0x1b33b8[_0x8ef9('0x15')]+_0x1b33b8['limit'],_0x3fe308;if(_0x231e8a>=_0x3f7300){_0x231e8a=_0x3f7300;_0x3fe308=0xc8;}else{_0x3fe308=0xce;}_0x5cbcf6[_0x8ef9('0x12')](_0x3fe308);return _0x5cbcf6['set'](_0x8ef9('0x16'),_0x304128+'-'+_0x231e8a+'/'+_0x3f7300)[_0x8ef9('0x13')](_0x4fdb0b);}return null;};}function patchUpdates(_0x2b6ec4){return function(_0x5c34e8){try{jsonpatch[_0x8ef9('0x17')](_0x5c34e8,_0x2b6ec4,!![]);}catch(_0x13f434){return BPromise['reject'](_0x13f434);}return _0x5c34e8[_0x8ef9('0x18')]();};}function saveUpdates(_0x23492f,_0x3301b5){return function(_0xc4a320){if(_0xc4a320){return _0xc4a320[_0x8ef9('0x19')](_0x23492f)[_0x8ef9('0x1a')](function(_0x10d34c){return _0x10d34c;});}return null;};}function removeEntity(_0x5ee59e,_0x302aee){return function(_0x153c21){if(_0x153c21){return _0x153c21['destroy']()[_0x8ef9('0x1a')](function(){_0x5ee59e[_0x8ef9('0x12')](0xcc)[_0x8ef9('0x1b')]();});}};}function handleEntityNotFound(_0x55a779,_0x57e381){return function(_0x6a21df){if(!_0x6a21df){_0x55a779[_0x8ef9('0x11')](0x194);}return _0x6a21df;};}function handleError(_0x28b5e2,_0x50455c){_0x50455c=_0x50455c||0x1f4;return function(_0x337693){logger[_0x8ef9('0x1c')](_0x337693[_0x8ef9('0x1d')]);if(_0x337693[_0x8ef9('0x1e')]){delete _0x337693[_0x8ef9('0x1e')];}_0x28b5e2[_0x8ef9('0x12')](_0x50455c)['send'](_0x337693);};}exports['index']=function(_0x17d226,_0x401400){var _0x575ae4={},_0x3d84ca={},_0x35418a={'count':0x0,'rows':[]};var _0x5a5cbc=_['map'](db[_0x8ef9('0x1f')][_0x8ef9('0x20')],function(_0x28d499){return{'name':_0x28d499[_0x8ef9('0x21')],'type':_0x28d499[_0x8ef9('0x22')][_0x8ef9('0x23')]};});_0x3d84ca['model']=_[_0x8ef9('0x24')](_0x5a5cbc,_0x8ef9('0x1e'));_0x3d84ca[_0x8ef9('0x25')]=_[_0x8ef9('0x26')](_0x17d226[_0x8ef9('0x25')]);_0x3d84ca['filters']=_[_0x8ef9('0x27')](_0x3d84ca[_0x8ef9('0x28')],_0x3d84ca[_0x8ef9('0x25')]);_0x575ae4['attributes']=_[_0x8ef9('0x27')](_0x3d84ca[_0x8ef9('0x28')],qs[_0x8ef9('0x29')](_0x17d226[_0x8ef9('0x25')]['fields']));_0x575ae4['attributes']=_0x575ae4[_0x8ef9('0x2a')][_0x8ef9('0x2b')]?_0x575ae4['attributes']:_0x3d84ca[_0x8ef9('0x28')];if(!_0x17d226['query'][_0x8ef9('0x2c')]('nolimit')){_0x575ae4[_0x8ef9('0x2d')]=qs[_0x8ef9('0x2d')](_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x2d')]);_0x575ae4[_0x8ef9('0x15')]=qs[_0x8ef9('0x15')](_0x17d226[_0x8ef9('0x25')]['offset']);}_0x575ae4[_0x8ef9('0x2e')]=qs['sort'](_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x2f')]);_0x575ae4['where']=qs[_0x8ef9('0x30')](_['pick'](_0x17d226[_0x8ef9('0x25')],_0x3d84ca['filters']),_0x5a5cbc);if(_0x17d226['query'][_0x8ef9('0x31')]){_0x575ae4['where']=_[_0x8ef9('0x32')](_0x575ae4[_0x8ef9('0x33')],{'$or':_[_0x8ef9('0x24')](_0x5a5cbc,function(_0x24126b){if(_0x24126b['type']!==_0x8ef9('0x34')){var _0x49d045={};_0x49d045[_0x24126b[_0x8ef9('0x1e')]]={'$like':'%'+_0x17d226[_0x8ef9('0x25')][_0x8ef9('0x31')]+'%'};return _0x49d045;}})});}_0x575ae4=_['merge']({},_0x575ae4,_0x17d226[_0x8ef9('0x35')]);var _0x20f679={'where':_0x575ae4[_0x8ef9('0x33')]};return db[_0x8ef9('0x1f')][_0x8ef9('0x14')](_0x20f679)[_0x8ef9('0x1a')](function(_0x5460d7){_0x35418a[_0x8ef9('0x14')]=_0x5460d7;if(_0x17d226['query'][_0x8ef9('0x36')]){_0x575ae4[_0x8ef9('0x37')]=[{'all':!![]}];}return db[_0x8ef9('0x1f')][_0x8ef9('0x38')](_0x575ae4);})[_0x8ef9('0x1a')](function(_0x5c9322){_0x35418a[_0x8ef9('0x39')]=_0x5c9322;return _0x35418a;})[_0x8ef9('0x1a')](respondWithFilteredResult(_0x401400,_0x575ae4))[_0x8ef9('0x3a')](handleError(_0x401400,null));};exports[_0x8ef9('0x3b')]=function(_0x1173bb,_0x150319){var _0x2d7441={'raw':!![],'where':{'id':_0x1173bb[_0x8ef9('0x3c')]['id']}},_0x256231={};_0x256231[_0x8ef9('0x28')]=_[_0x8ef9('0x26')](db[_0x8ef9('0x1f')][_0x8ef9('0x20')]);_0x256231[_0x8ef9('0x25')]=_[_0x8ef9('0x26')](_0x1173bb[_0x8ef9('0x25')]);_0x256231[_0x8ef9('0x30')]=_[_0x8ef9('0x27')](_0x256231['model'],_0x256231[_0x8ef9('0x25')]);_0x2d7441['attributes']=_[_0x8ef9('0x27')](_0x256231[_0x8ef9('0x28')],qs['fields'](_0x1173bb[_0x8ef9('0x25')]['fields']));_0x2d7441[_0x8ef9('0x2a')]=_0x2d7441['attributes']['length']?_0x2d7441[_0x8ef9('0x2a')]:_0x256231[_0x8ef9('0x28')];if(_0x1173bb[_0x8ef9('0x25')][_0x8ef9('0x36')]){_0x2d7441['include']=[{'all':!![]}];}_0x2d7441=_[_0x8ef9('0x32')]({},_0x2d7441,_0x1173bb[_0x8ef9('0x35')]);return db[_0x8ef9('0x1f')][_0x8ef9('0x3d')](_0x2d7441)[_0x8ef9('0x1a')](handleEntityNotFound(_0x150319,null))[_0x8ef9('0x1a')](respondWithResult(_0x150319,null))['catch'](handleError(_0x150319,null));};exports[_0x8ef9('0x3e')]=function(_0x1098d3,_0x41161f){return db['OpenchannelTransferReport'][_0x8ef9('0x3e')](_0x1098d3[_0x8ef9('0x3f')],{})[_0x8ef9('0x1a')](respondWithResult(_0x41161f,0xc9))[_0x8ef9('0x3a')](handleError(_0x41161f,null));};exports[_0x8ef9('0x19')]=function(_0x3682b8,_0x16d2e8){if(_0x3682b8[_0x8ef9('0x3f')]['id']){delete _0x3682b8['body']['id'];}return db['OpenchannelTransferReport'][_0x8ef9('0x3d')]({'where':{'id':_0x3682b8[_0x8ef9('0x3c')]['id']}})[_0x8ef9('0x1a')](handleEntityNotFound(_0x16d2e8,null))[_0x8ef9('0x1a')](saveUpdates(_0x3682b8[_0x8ef9('0x3f')],null))[_0x8ef9('0x1a')](respondWithResult(_0x16d2e8,null))[_0x8ef9('0x3a')](handleError(_0x16d2e8,null));};exports['destroy']=function(_0x450472,_0x1bee53){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x450472[_0x8ef9('0x3c')]['id']}})[_0x8ef9('0x1a')](handleEntityNotFound(_0x1bee53,null))[_0x8ef9('0x1a')](removeEntity(_0x1bee53,null))[_0x8ef9('0x3a')](handleError(_0x1bee53,null));};exports[_0x8ef9('0x40')]=function(_0x26d394,_0x1d32b0){return db['OpenchannelTransferReport']['describe']()[_0x8ef9('0x1a')](respondWithResult(_0x1d32b0,null))[_0x8ef9('0x3a')](handleError(_0x1d32b0,null));}; \ No newline at end of file +var _0x4e0a=['sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','count','then','include','findAll','params','includeAll','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path'];(function(_0x1eafb6,_0xc72fa7){var _0x4f3b20=function(_0xcb472){while(--_0xcb472){_0x1eafb6['push'](_0x1eafb6['shift']());}};_0x4f3b20(++_0xc72fa7);}(_0x4e0a,0xd3));var _0xa4e0=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x4e0a[_0x1f0724];return _0x253ffb;};'use strict';var pdf=require(_0xa4e0('0x0'));var emlformat=require(_0xa4e0('0x1'));var rimraf=require(_0xa4e0('0x2'));var zipdir=require(_0xa4e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa4e0('0x4'));var BPromise=require(_0xa4e0('0x5'));var Mustache=require(_0xa4e0('0x6'));var util=require('util');var path=require(_0xa4e0('0x7'));var sox=require(_0xa4e0('0x8'));var csv=require(_0xa4e0('0x9'));var ejs=require(_0xa4e0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4e0('0xb'));var crypto=require('crypto');var jsforce=require(_0xa4e0('0xc'));var deskjs=require(_0xa4e0('0xd'));var toCsv=require(_0xa4e0('0x9'));var querystring=require(_0xa4e0('0xe'));var Papa=require(_0xa4e0('0xf'));var Redis=require('ioredis');var authService=require(_0xa4e0('0x10'));var qs=require(_0xa4e0('0x11'));var as=require(_0xa4e0('0x12'));var hardwareService=require(_0xa4e0('0x13'));var logger=require(_0xa4e0('0x14'))(_0xa4e0('0x15'));var utils=require(_0xa4e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa4e0('0x17'));var db=require(_0xa4e0('0x18'))['db'];function respondWithStatusCode(_0x33bee9,_0x3482f1){_0x3482f1=_0x3482f1||0xcc;return function(_0x138dd7){if(_0x138dd7){return _0x33bee9[_0xa4e0('0x19')](_0x3482f1);}return _0x33bee9[_0xa4e0('0x1a')](_0x3482f1)[_0xa4e0('0x1b')]();};}function respondWithResult(_0x5b5dee,_0x20b8db){_0x20b8db=_0x20b8db||0xc8;return function(_0x24d3f7){if(_0x24d3f7){return _0x5b5dee[_0xa4e0('0x1a')](_0x20b8db)['json'](_0x24d3f7);}};}function respondWithFilteredResult(_0xb0f329,_0x2f53ed){return function(_0x15d243){if(_0x15d243){var _0x41dea1=_0x15d243['count'],_0x2cc3d7=_0x2f53ed['offset'],_0x8915fe=_0x2f53ed['offset']+_0x2f53ed[_0xa4e0('0x1c')],_0x36bc88;if(_0x8915fe>=_0x41dea1){_0x8915fe=_0x41dea1;_0x36bc88=0xc8;}else{_0x36bc88=0xce;}_0xb0f329['status'](_0x36bc88);return _0xb0f329[_0xa4e0('0x1d')]('Content-Range',_0x2cc3d7+'-'+_0x8915fe+'/'+_0x41dea1)['json'](_0x15d243);}return null;};}function patchUpdates(_0x55dec8){return function(_0x26ab89){try{jsonpatch[_0xa4e0('0x1e')](_0x26ab89,_0x55dec8,!![]);}catch(_0xc4fa07){return BPromise[_0xa4e0('0x1f')](_0xc4fa07);}return _0x26ab89[_0xa4e0('0x20')]();};}function saveUpdates(_0x4ec53d,_0x5cfaad){return function(_0xdd99c9){if(_0xdd99c9){return _0xdd99c9[_0xa4e0('0x21')](_0x4ec53d)['then'](function(_0x5b047e){return _0x5b047e;});}return null;};}function removeEntity(_0x5a6f66,_0xeefe7d){return function(_0x5f5b12){if(_0x5f5b12){return _0x5f5b12[_0xa4e0('0x22')]()['then'](function(){_0x5a6f66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2129,_0x572d2f){return function(_0x4d1fd8){if(!_0x4d1fd8){_0x5b2129[_0xa4e0('0x19')](0x194);}return _0x4d1fd8;};}function handleError(_0xb5212b,_0x49ed07){_0x49ed07=_0x49ed07||0x1f4;return function(_0x4568b1){logger[_0xa4e0('0x23')](_0x4568b1[_0xa4e0('0x24')]);if(_0x4568b1['name']){delete _0x4568b1[_0xa4e0('0x25')];}_0xb5212b[_0xa4e0('0x1a')](_0x49ed07)[_0xa4e0('0x26')](_0x4568b1);};}exports[_0xa4e0('0x27')]=function(_0x21da72,_0x171061){var _0x495e32={},_0x127c1e={},_0x2c1541={'count':0x0,'rows':[]};var _0x2c4a71=_[_0xa4e0('0x28')](db[_0xa4e0('0x29')][_0xa4e0('0x2a')],function(_0x1d1dbf){return{'name':_0x1d1dbf['fieldName'],'type':_0x1d1dbf[_0xa4e0('0x2b')][_0xa4e0('0x2c')]};});_0x127c1e[_0xa4e0('0x2d')]=_['map'](_0x2c4a71,_0xa4e0('0x25'));_0x127c1e[_0xa4e0('0x2e')]=_[_0xa4e0('0x2f')](_0x21da72[_0xa4e0('0x2e')]);_0x127c1e[_0xa4e0('0x30')]=_[_0xa4e0('0x31')](_0x127c1e[_0xa4e0('0x2d')],_0x127c1e[_0xa4e0('0x2e')]);_0x495e32[_0xa4e0('0x32')]=_[_0xa4e0('0x31')](_0x127c1e[_0xa4e0('0x2d')],qs[_0xa4e0('0x33')](_0x21da72[_0xa4e0('0x2e')]['fields']));_0x495e32[_0xa4e0('0x32')]=_0x495e32['attributes'][_0xa4e0('0x34')]?_0x495e32[_0xa4e0('0x32')]:_0x127c1e['model'];if(!_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x35')](_0xa4e0('0x36'))){_0x495e32[_0xa4e0('0x1c')]=qs[_0xa4e0('0x1c')](_0x21da72[_0xa4e0('0x2e')]['limit']);_0x495e32[_0xa4e0('0x37')]=qs[_0xa4e0('0x37')](_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x37')]);}_0x495e32['order']=qs[_0xa4e0('0x38')](_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x38')]);_0x495e32[_0xa4e0('0x39')]=qs[_0xa4e0('0x30')](_['pick'](_0x21da72['query'],_0x127c1e[_0xa4e0('0x30')]),_0x2c4a71);if(_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x3a')]){_0x495e32[_0xa4e0('0x39')]=_[_0xa4e0('0x3b')](_0x495e32[_0xa4e0('0x39')],{'$or':_[_0xa4e0('0x28')](_0x2c4a71,function(_0x5000df){if(_0x5000df[_0xa4e0('0x2b')]!==_0xa4e0('0x3c')){var _0x3e9a68={};_0x3e9a68[_0x5000df['name']]={'$like':'%'+_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x3a')]+'%'};return _0x3e9a68;}})});}_0x495e32=_[_0xa4e0('0x3b')]({},_0x495e32,_0x21da72['options']);var _0x2b2e32={'where':_0x495e32['where']};return db[_0xa4e0('0x29')][_0xa4e0('0x3d')](_0x2b2e32)[_0xa4e0('0x3e')](function(_0x52a643){_0x2c1541['count']=_0x52a643;if(_0x21da72['query']['includeAll']){_0x495e32[_0xa4e0('0x3f')]=[{'all':!![]}];}return db[_0xa4e0('0x29')][_0xa4e0('0x40')](_0x495e32);})[_0xa4e0('0x3e')](function(_0x5986f2){_0x2c1541['rows']=_0x5986f2;return _0x2c1541;})[_0xa4e0('0x3e')](respondWithFilteredResult(_0x171061,_0x495e32))['catch'](handleError(_0x171061,null));};exports['show']=function(_0x8158ef,_0x4c9eb5){var _0x40cf31={'raw':!![],'where':{'id':_0x8158ef[_0xa4e0('0x41')]['id']}},_0x1f7cbf={};_0x1f7cbf[_0xa4e0('0x2d')]=_[_0xa4e0('0x2f')](db[_0xa4e0('0x29')][_0xa4e0('0x2a')]);_0x1f7cbf[_0xa4e0('0x2e')]=_['keys'](_0x8158ef[_0xa4e0('0x2e')]);_0x1f7cbf[_0xa4e0('0x30')]=_[_0xa4e0('0x31')](_0x1f7cbf[_0xa4e0('0x2d')],_0x1f7cbf[_0xa4e0('0x2e')]);_0x40cf31[_0xa4e0('0x32')]=_[_0xa4e0('0x31')](_0x1f7cbf[_0xa4e0('0x2d')],qs[_0xa4e0('0x33')](_0x8158ef[_0xa4e0('0x2e')]['fields']));_0x40cf31['attributes']=_0x40cf31['attributes']['length']?_0x40cf31[_0xa4e0('0x32')]:_0x1f7cbf[_0xa4e0('0x2d')];if(_0x8158ef[_0xa4e0('0x2e')][_0xa4e0('0x42')]){_0x40cf31[_0xa4e0('0x3f')]=[{'all':!![]}];}_0x40cf31=_['merge']({},_0x40cf31,_0x8158ef[_0xa4e0('0x43')]);return db['OpenchannelTransferReport'][_0xa4e0('0x44')](_0x40cf31)[_0xa4e0('0x3e')](handleEntityNotFound(_0x4c9eb5,null))[_0xa4e0('0x3e')](respondWithResult(_0x4c9eb5,null))[_0xa4e0('0x45')](handleError(_0x4c9eb5,null));};exports[_0xa4e0('0x46')]=function(_0x5e97b0,_0x4dc8d6){return db['OpenchannelTransferReport'][_0xa4e0('0x46')](_0x5e97b0[_0xa4e0('0x47')],{})['then'](respondWithResult(_0x4dc8d6,0xc9))['catch'](handleError(_0x4dc8d6,null));};exports['update']=function(_0x1a16e9,_0x2d6a89){if(_0x1a16e9[_0xa4e0('0x47')]['id']){delete _0x1a16e9[_0xa4e0('0x47')]['id'];}return db[_0xa4e0('0x29')][_0xa4e0('0x44')]({'where':{'id':_0x1a16e9[_0xa4e0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d6a89,null))[_0xa4e0('0x3e')](saveUpdates(_0x1a16e9['body'],null))[_0xa4e0('0x3e')](respondWithResult(_0x2d6a89,null))['catch'](handleError(_0x2d6a89,null));};exports[_0xa4e0('0x22')]=function(_0x2ad125,_0x18d560){return db[_0xa4e0('0x29')]['find']({'where':{'id':_0x2ad125['params']['id']}})[_0xa4e0('0x3e')](handleEntityNotFound(_0x18d560,null))[_0xa4e0('0x3e')](removeEntity(_0x18d560,null))[_0xa4e0('0x45')](handleError(_0x18d560,null));};exports[_0xa4e0('0x48')]=function(_0x2aa002,_0x61cf6b){return db[_0xa4e0('0x29')][_0xa4e0('0x48')]()[_0xa4e0('0x3e')](respondWithResult(_0x61cf6b,null))[_0xa4e0('0x45')](handleError(_0x61cf6b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0ae2f36..4dcd060 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 _0x6cda=['uniqueid','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x5cb9d5,_0x5cc135){var _0x5b916b=function(_0x8233ea){while(--_0x8233ea){_0x5cb9d5['push'](_0x5cb9d5['shift']());}};_0x5b916b(++_0x5cc135);}(_0x6cda,0x1d5));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6cd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa6cd('0x1'));var rp=require(_0xa6cd('0x2'));var fs=require('fs');var path=require(_0xa6cd('0x3'));var rimraf=require(_0xa6cd('0x4'));var config=require(_0xa6cd('0x5'));var attributes=require(_0xa6cd('0x6'));module[_0xa6cd('0x7')]=function(_0xe8c69d,_0x7b1130){return _0xe8c69d[_0xa6cd('0x8')](_0xa6cd('0x9'),attributes,{'tableName':_0xa6cd('0xa'),'paranoid':![],'indexes':[{'name':_0xa6cd('0xb'),'fields':[_0xa6cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80aa=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x27fcd6,_0xc05845){var _0x244158=function(_0x56fbf5){while(--_0x56fbf5){_0x27fcd6['push'](_0x27fcd6['shift']());}};_0x244158(++_0xc05845);}(_0x80aa,0xb3));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa80a('0x0'))(_0xa80a('0x1'));var moment=require(_0xa80a('0x2'));var BPromise=require(_0xa80a('0x3'));var rp=require(_0xa80a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa80a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa80a('0x6'));module[_0xa80a('0x7')]=function(_0x17f0a5,_0x1c4d73){return _0x17f0a5['define'](_0xa80a('0x8'),attributes,{'tableName':_0xa80a('0x9'),'paranoid':![],'indexes':[{'name':_0xa80a('0xa'),'fields':[_0xa80a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c8859b1..28b0dab 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 _0xe3aa=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe3aa,0x1e3));var _0xae3a=function(_0xdca029,_0xb32dcc){_0xdca029=_0xdca029-0x0;var _0x1fe14f=_0xe3aa[_0xdca029];return _0x1fe14f;};'use strict';var _=require(_0xae3a('0x0'));var util=require('util');var moment=require(_0xae3a('0x1'));var BPromise=require(_0xae3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae3a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae3a('0x4'))(_0xae3a('0x5'));var config=require(_0xae3a('0x6'));var jayson=require(_0xae3a('0x7'));var client=jayson['client'][_0xae3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x133ee6,_0x881969,_0x2a55d3){return new BPromise(function(_0x30638c,_0x4fe6b8){return client['request'](_0x133ee6,_0x2a55d3)[_0xae3a('0x9')](function(_0x2c4446){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x881969,_0xae3a('0xa'));logger[_0xae3a('0xb')](_0xae3a('0xc'),_0x881969,_0xae3a('0xa'),JSON['stringify'](_0x2c4446));if(_0x2c4446[_0xae3a('0xd')]){if(_0x2c4446[_0xae3a('0xd')]['code']===0x1f4){logger[_0xae3a('0xd')](_0xae3a('0xe'),_0x881969,_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);return _0x4fe6b8(_0x2c4446['error']['message']);}logger[_0xae3a('0xd')](_0xae3a('0xe'),_0x881969,_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);return _0x30638c(_0x2c4446[_0xae3a('0xd')][_0xae3a('0xf')]);}else{logger[_0xae3a('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x881969,'request\x20sent');_0x30638c(_0x2c4446['result'][_0xae3a('0xf')]);}})['catch'](function(_0x230010){logger['error'](_0xae3a('0xe'),_0x881969,_0x230010);_0x4fe6b8(_0x230010);});});} \ No newline at end of file +var _0x2436=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4d1409,_0x27aad3){var _0x3ae822=function(_0x15acd3){while(--_0x15acd3){_0x4d1409['push'](_0x4d1409['shift']());}};_0x3ae822(++_0x27aad3);}(_0x2436,0x1e7));var _0x6243=function(_0x32d825,_0x18af65){_0x32d825=_0x32d825-0x0;var _0x488bd0=_0x2436[_0x32d825];return _0x488bd0;};'use strict';var _=require('lodash');var util=require(_0x6243('0x0'));var moment=require(_0x6243('0x1'));var BPromise=require(_0x6243('0x2'));var rs=require(_0x6243('0x3'));var fs=require('fs');var Redis=require(_0x6243('0x4'));var db=require(_0x6243('0x5'))['db'];var utils=require(_0x6243('0x6'));var logger=require(_0x6243('0x7'))(_0x6243('0x8'));var config=require(_0x6243('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6243('0xa')][_0x6243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x443aad,_0x2ef23c,_0x1f7a31){return new BPromise(function(_0x24709a,_0x3517b4){return client['request'](_0x443aad,_0x1f7a31)[_0x6243('0xc')](function(_0x3c22fd){logger['info'](_0x6243('0xd'),_0x2ef23c,_0x6243('0xe'));logger[_0x6243('0xf')](_0x6243('0x10'),_0x2ef23c,'request\x20sent',JSON['stringify'](_0x3c22fd));if(_0x3c22fd['error']){if(_0x3c22fd[_0x6243('0x11')][_0x6243('0x12')]===0x1f4){logger['error'](_0x6243('0xd'),_0x2ef23c,_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);return _0x3517b4(_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);}logger[_0x6243('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ef23c,_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);return _0x24709a(_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);}else{logger[_0x6243('0x14')](_0x6243('0xd'),_0x2ef23c,_0x6243('0xe'));_0x24709a(_0x3c22fd['result'][_0x6243('0x13')]);}})[_0x6243('0x15')](function(_0x2bbde5){logger[_0x6243('0x11')](_0x6243('0xd'),_0x2ef23c,_0x2bbde5);_0x3517b4(_0x2bbde5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ea5e0aa..6df7b09 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 _0x08d4=['index','/:id','post','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','./pause.controller','get','isAuthenticated'];(function(_0x226a1c,_0x31af06){var _0x11b6af=function(_0x45d9da){while(--_0x45d9da){_0x226a1c['push'](_0x226a1c['shift']());}};_0x11b6af(++_0x31af06);}(_0x08d4,0x157));var _0x408d=function(_0x2984c7,_0x2adf0a){_0x2984c7=_0x2984c7-0x0;var _0x45151f=_0x08d4[_0x2984c7];return _0x45151f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x408d('0x0'));var express=require(_0x408d('0x1'));var router=express[_0x408d('0x2')]();var auth=require(_0x408d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x408d('0x4'));router[_0x408d('0x5')]('/',auth[_0x408d('0x6')](),controller[_0x408d('0x7')]);router[_0x408d('0x5')](_0x408d('0x8'),auth[_0x408d('0x6')](),controller['show']);router[_0x408d('0x9')]('/',auth[_0x408d('0x6')](),controller['create']);router['put']('/:id',auth[_0x408d('0x6')](),controller[_0x408d('0xa')]);router[_0x408d('0xb')](_0x408d('0x8'),auth[_0x408d('0x6')](),controller[_0x408d('0xc')]);module[_0x408d('0xd')]=router; \ No newline at end of file +var _0xac30=['get','/:id','show','post','create','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xc5c4a9,_0x260a6c){var _0x233feb=function(_0x2c78bf){while(--_0x2c78bf){_0xc5c4a9['push'](_0xc5c4a9['shift']());}};_0x233feb(++_0x260a6c);}(_0xac30,0x16f));var _0x0ac3=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xac30[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require('multer');var util=require(_0x0ac3('0x0'));var path=require(_0x0ac3('0x1'));var timeout=require(_0x0ac3('0x2'));var express=require(_0x0ac3('0x3'));var router=express[_0x0ac3('0x4')]();var auth=require(_0x0ac3('0x5'));var interaction=require(_0x0ac3('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0x0ac3('0x7')](),controller['index']);router[_0x0ac3('0x8')](_0x0ac3('0x9'),auth[_0x0ac3('0x7')](),controller[_0x0ac3('0xa')]);router[_0x0ac3('0xb')]('/',auth[_0x0ac3('0x7')](),controller[_0x0ac3('0xc')]);router['put'](_0x0ac3('0x9'),auth[_0x0ac3('0x7')](),controller['update']);router[_0x0ac3('0xd')](_0x0ac3('0x9'),auth['isAuthenticated'](),controller[_0x0ac3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index c3b183f..7f40cfa 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 _0xe005=['exports','STRING','name','sequelize'];(function(_0x4b2f9d,_0x4093fd){var _0x1c9bd1=function(_0xdb3d12){while(--_0xdb3d12){_0x4b2f9d['push'](_0x4b2f9d['shift']());}};_0x1c9bd1(++_0x4093fd);}(_0xe005,0x1d7));var _0x5e00=function(_0x4a01a9,_0x2a5833){_0x4a01a9=_0x4a01a9-0x0;var _0x4ffd79=_0xe005[_0x4a01a9];return _0x4ffd79;};'use strict';var Sequelize=require(_0x5e00('0x0'));module[_0x5e00('0x1')]={'name':{'type':Sequelize[_0x5e00('0x2')],'unique':_0x5e00('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5e00('0x2')]}}; \ No newline at end of file +var _0x3067=['STRING','name','sequelize','exports'];(function(_0x1378e2,_0x52a6ee){var _0x865b40=function(_0x3c323d){while(--_0x3c323d){_0x1378e2['push'](_0x1378e2['shift']());}};_0x865b40(++_0x52a6ee);}(_0x3067,0xa6));var _0x7306=function(_0x2d9059,_0x536df5){_0x2d9059=_0x2d9059-0x0;var _0x39abdb=_0x3067[_0x2d9059];return _0x39abdb;};'use strict';var Sequelize=require(_0x7306('0x0'));module[_0x7306('0x1')]={'name':{'type':Sequelize[_0x7306('0x2')],'unique':_0x7306('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7306('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 98da9c6..65e8954 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 _0xdd03=['offset','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','Pause','findAll','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','set','Content-Range','save','update','then','destroy','get','Pauses','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length'];(function(_0x3d141f,_0x436724){var _0x4e214b=function(_0x467151){while(--_0x467151){_0x3d141f['push'](_0x3d141f['shift']());}};_0x4e214b(++_0x436724);}(_0xdd03,0xb8));var _0x3dd0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdd03[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3dd0('0x0'));var zipdir=require(_0x3dd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3dd0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3dd0('0x3'));var util=require('util');var path=require(_0x3dd0('0x4'));var sox=require(_0x3dd0('0x5'));var csv=require(_0x3dd0('0x6'));var ejs=require(_0x3dd0('0x7'));var fs=require('fs');var _=require(_0x3dd0('0x8'));var squel=require(_0x3dd0('0x9'));var crypto=require(_0x3dd0('0xa'));var jsforce=require(_0x3dd0('0xb'));var deskjs=require(_0x3dd0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3dd0('0xd'));var Redis=require(_0x3dd0('0xe'));var authService=require(_0x3dd0('0xf'));var qs=require(_0x3dd0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dd0('0x11'))(_0x3dd0('0x12'));var utils=require(_0x3dd0('0x13'));var config=require(_0x3dd0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3dd0('0x15'))['db'];function respondWithStatusCode(_0x594bc9,_0x576148){_0x576148=_0x576148||0xcc;return function(_0x4de4ce){if(_0x4de4ce){return _0x594bc9[_0x3dd0('0x16')](_0x576148);}return _0x594bc9['status'](_0x576148)[_0x3dd0('0x17')]();};}function respondWithResult(_0xe70a00,_0x3e156b){_0x3e156b=_0x3e156b||0xc8;return function(_0xb37029){if(_0xb37029){return _0xe70a00[_0x3dd0('0x18')](_0x3e156b)[_0x3dd0('0x19')](_0xb37029);}};}function respondWithFilteredResult(_0xde009b,_0x5de596){return function(_0xa74cf1){if(_0xa74cf1){var _0x44e85d=_0xa74cf1['count'],_0x7cbfac=_0x5de596['offset'],_0x8ce164=_0x5de596['offset']+_0x5de596[_0x3dd0('0x1a')],_0x414008;if(_0x8ce164>=_0x44e85d){_0x8ce164=_0x44e85d;_0x414008=0xc8;}else{_0x414008=0xce;}_0xde009b[_0x3dd0('0x18')](_0x414008);return _0xde009b[_0x3dd0('0x1b')](_0x3dd0('0x1c'),_0x7cbfac+'-'+_0x8ce164+'/'+_0x44e85d)[_0x3dd0('0x19')](_0xa74cf1);}return null;};}function patchUpdates(_0x56209b){return function(_0x383688){try{jsonpatch['apply'](_0x383688,_0x56209b,!![]);}catch(_0x11ef3a){return BPromise['reject'](_0x11ef3a);}return _0x383688[_0x3dd0('0x1d')]();};}function saveUpdates(_0x108e25,_0x44a7cb){return function(_0x317b41){if(_0x317b41){return _0x317b41[_0x3dd0('0x1e')](_0x108e25)[_0x3dd0('0x1f')](function(_0x55b56d){return _0x55b56d;});}return null;};}function removeEntity(_0x113776,_0x33426f){return function(_0x4b8425){if(_0x4b8425){return _0x4b8425[_0x3dd0('0x20')]()['then'](function(){var _0x5a1ec9=_0x4b8425[_0x3dd0('0x21')]({'plain':!![]});var _0x25364b=_0x3dd0('0x22');return db['UserProfileResource'][_0x3dd0('0x20')]({'where':{'type':_0x25364b,'resourceId':_0x5a1ec9['id']}})[_0x3dd0('0x1f')](function(){return _0x4b8425;});})[_0x3dd0('0x1f')](function(){_0x113776[_0x3dd0('0x18')](0xcc)[_0x3dd0('0x17')]();});}};}function handleEntityNotFound(_0x26b615,_0x320703){return function(_0x3f520c){if(!_0x3f520c){_0x26b615['sendStatus'](0x194);}return _0x3f520c;};}function handleError(_0x301c2c,_0x143c5a){_0x143c5a=_0x143c5a||0x1f4;return function(_0x56d71c){logger['error'](_0x56d71c[_0x3dd0('0x23')]);if(_0x56d71c['name']){delete _0x56d71c[_0x3dd0('0x24')];}_0x301c2c[_0x3dd0('0x18')](_0x143c5a)['send'](_0x56d71c);};}exports[_0x3dd0('0x25')]=function(_0x28374d,_0x30dc3c){var _0x315fce={},_0x37f7e7={},_0x4a94c6={'count':0x0,'rows':[]};var _0x5b5c23=_[_0x3dd0('0x26')](db['Pause'][_0x3dd0('0x27')],function(_0x576625){return{'name':_0x576625[_0x3dd0('0x28')],'type':_0x576625['type'][_0x3dd0('0x29')]};});_0x37f7e7['model']=_[_0x3dd0('0x26')](_0x5b5c23,_0x3dd0('0x24'));_0x37f7e7[_0x3dd0('0x2a')]=_[_0x3dd0('0x2b')](_0x28374d[_0x3dd0('0x2a')]);_0x37f7e7[_0x3dd0('0x2c')]=_['intersection'](_0x37f7e7[_0x3dd0('0x2d')],_0x37f7e7[_0x3dd0('0x2a')]);_0x315fce[_0x3dd0('0x2e')]=_[_0x3dd0('0x2f')](_0x37f7e7['model'],qs[_0x3dd0('0x30')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x30')]));_0x315fce[_0x3dd0('0x2e')]=_0x315fce[_0x3dd0('0x2e')][_0x3dd0('0x31')]?_0x315fce['attributes']:_0x37f7e7[_0x3dd0('0x2d')];if(!_0x28374d[_0x3dd0('0x2a')]['hasOwnProperty']('nolimit')){_0x315fce['limit']=qs[_0x3dd0('0x1a')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x1a')]);_0x315fce[_0x3dd0('0x32')]=qs[_0x3dd0('0x32')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x32')]);}_0x315fce[_0x3dd0('0x33')]=qs[_0x3dd0('0x34')](_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x34')]);_0x315fce[_0x3dd0('0x35')]=qs['filters'](_[_0x3dd0('0x36')](_0x28374d[_0x3dd0('0x2a')],_0x37f7e7[_0x3dd0('0x2c')]),_0x5b5c23);if(_0x28374d[_0x3dd0('0x2a')]['filter']){_0x315fce['where']=_[_0x3dd0('0x37')](_0x315fce['where'],{'$or':_[_0x3dd0('0x26')](_0x5b5c23,function(_0x2dc6e4){if(_0x2dc6e4['type']!==_0x3dd0('0x38')){var _0x20c10f={};_0x20c10f[_0x2dc6e4[_0x3dd0('0x24')]]={'$like':'%'+_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x39')]+'%'};return _0x20c10f;}})});}_0x315fce=_[_0x3dd0('0x37')]({},_0x315fce,_0x28374d[_0x3dd0('0x3a')]);var _0x217ac3={'where':_0x315fce['where']};return db['Pause'][_0x3dd0('0x3b')](_0x217ac3)[_0x3dd0('0x1f')](function(_0x3557bf){_0x4a94c6['count']=_0x3557bf;if(_0x28374d[_0x3dd0('0x2a')][_0x3dd0('0x3c')]){_0x315fce[_0x3dd0('0x3d')]=[{'all':!![]}];}return db[_0x3dd0('0x3e')][_0x3dd0('0x3f')](_0x315fce);})[_0x3dd0('0x1f')](function(_0x146d6c){_0x4a94c6['rows']=_0x146d6c;return _0x4a94c6;})[_0x3dd0('0x1f')](respondWithFilteredResult(_0x30dc3c,_0x315fce))['catch'](handleError(_0x30dc3c,null));};exports[_0x3dd0('0x40')]=function(_0x424a5c,_0x1608c5){var _0x26699c={'raw':!![],'where':{'id':_0x424a5c[_0x3dd0('0x41')]['id']}},_0x4b40fd={};_0x4b40fd[_0x3dd0('0x2d')]=_[_0x3dd0('0x2b')](db[_0x3dd0('0x3e')][_0x3dd0('0x27')]);_0x4b40fd[_0x3dd0('0x2a')]=_[_0x3dd0('0x2b')](_0x424a5c['query']);_0x4b40fd[_0x3dd0('0x2c')]=_[_0x3dd0('0x2f')](_0x4b40fd['model'],_0x4b40fd['query']);_0x26699c[_0x3dd0('0x2e')]=_[_0x3dd0('0x2f')](_0x4b40fd[_0x3dd0('0x2d')],qs[_0x3dd0('0x30')](_0x424a5c[_0x3dd0('0x2a')][_0x3dd0('0x30')]));_0x26699c[_0x3dd0('0x2e')]=_0x26699c[_0x3dd0('0x2e')][_0x3dd0('0x31')]?_0x26699c[_0x3dd0('0x2e')]:_0x4b40fd[_0x3dd0('0x2d')];if(_0x424a5c[_0x3dd0('0x2a')][_0x3dd0('0x3c')]){_0x26699c[_0x3dd0('0x3d')]=[{'all':!![]}];}_0x26699c=_[_0x3dd0('0x37')]({},_0x26699c,_0x424a5c[_0x3dd0('0x3a')]);return db['Pause'][_0x3dd0('0x42')](_0x26699c)['then'](handleEntityNotFound(_0x1608c5,null))[_0x3dd0('0x1f')](respondWithResult(_0x1608c5,null))[_0x3dd0('0x43')](handleError(_0x1608c5,null));};exports[_0x3dd0('0x44')]=function(_0x3d3468,_0x569d04){return db[_0x3dd0('0x3e')]['create'](_0x3d3468[_0x3dd0('0x45')],{})[_0x3dd0('0x1f')](function(_0x7616d1){var _0x1c9f8a=_0x3d3468['user'][_0x3dd0('0x21')]({'plain':!![]});if(!_0x1c9f8a)throw new Error(_0x3dd0('0x46'));if(_0x1c9f8a[_0x3dd0('0x47')]==='user'){var _0x431712=_0x7616d1[_0x3dd0('0x21')]({'plain':!![]});var _0x5e7103='Pauses';return db[_0x3dd0('0x48')][_0x3dd0('0x42')]({'where':{'name':_0x5e7103,'userProfileId':_0x1c9f8a[_0x3dd0('0x49')]},'raw':!![]})['then'](function(_0x5cfc0b){if(_0x5cfc0b&&_0x5cfc0b[_0x3dd0('0x4a')]===0x0){return db[_0x3dd0('0x4b')]['create']({'name':_0x431712[_0x3dd0('0x24')],'resourceId':_0x431712['id'],'type':_0x5cfc0b['name'],'sectionId':_0x5cfc0b['id']},{})[_0x3dd0('0x1f')](function(){return _0x7616d1;});}else{return _0x7616d1;}})[_0x3dd0('0x43')](function(_0x3925d1){logger[_0x3dd0('0x4c')](_0x3dd0('0x4d'),_0x3925d1);throw _0x3925d1;});}return _0x7616d1;})[_0x3dd0('0x1f')](respondWithResult(_0x569d04,0xc9))[_0x3dd0('0x43')](handleError(_0x569d04,null));};exports[_0x3dd0('0x1e')]=function(_0xfc7594,_0x1fbc38){if(_0xfc7594[_0x3dd0('0x45')]['id']){delete _0xfc7594[_0x3dd0('0x45')]['id'];}return db[_0x3dd0('0x3e')][_0x3dd0('0x42')]({'where':{'id':_0xfc7594['params']['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x1fbc38,null))['then'](saveUpdates(_0xfc7594[_0x3dd0('0x45')],null))[_0x3dd0('0x1f')](respondWithResult(_0x1fbc38,null))[_0x3dd0('0x43')](handleError(_0x1fbc38,null));};exports[_0x3dd0('0x20')]=function(_0x798151,_0x292f1c){return db[_0x3dd0('0x3e')][_0x3dd0('0x42')]({'where':{'id':_0x798151[_0x3dd0('0x41')]['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x292f1c,null))[_0x3dd0('0x1f')](removeEntity(_0x292f1c,null))['catch'](handleError(_0x292f1c,null));}; \ No newline at end of file +var _0x668d=['util','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','then','UserProfileResource','error','name','index','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','options','count','includeAll','findAll','rows','catch','show','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x362b7b,_0x1fe138){var _0x11c182=function(_0x5c5cea){while(--_0x5c5cea){_0x362b7b['push'](_0x362b7b['shift']());}};_0x11c182(++_0x1fe138);}(_0x668d,0xe7));var _0xd668=function(_0x5e7dd3,_0x1eecaf){_0x5e7dd3=_0x5e7dd3-0x0;var _0x48b3a8=_0x668d[_0x5e7dd3];return _0x48b3a8;};'use strict';var pdf=require(_0xd668('0x0'));var emlformat=require(_0xd668('0x1'));var rimraf=require(_0xd668('0x2'));var zipdir=require(_0xd668('0x3'));var jsonpatch=require(_0xd668('0x4'));var rp=require(_0xd668('0x5'));var moment=require(_0xd668('0x6'));var BPromise=require(_0xd668('0x7'));var Mustache=require(_0xd668('0x8'));var util=require(_0xd668('0x9'));var path=require('path');var sox=require(_0xd668('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd668('0xb'));var crypto=require(_0xd668('0xc'));var jsforce=require(_0xd668('0xd'));var deskjs=require(_0xd668('0xe'));var toCsv=require(_0xd668('0xf'));var querystring=require('querystring');var Papa=require(_0xd668('0x10'));var Redis=require(_0xd668('0x11'));var authService=require(_0xd668('0x12'));var qs=require(_0xd668('0x13'));var as=require(_0xd668('0x14'));var hardwareService=require(_0xd668('0x15'));var logger=require(_0xd668('0x16'))(_0xd668('0x17'));var utils=require(_0xd668('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd668('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1435aa,_0x2a5d1a){_0x2a5d1a=_0x2a5d1a||0xcc;return function(_0x38157e){if(_0x38157e){return _0x1435aa[_0xd668('0x1a')](_0x2a5d1a);}return _0x1435aa[_0xd668('0x1b')](_0x2a5d1a)[_0xd668('0x1c')]();};}function respondWithResult(_0x49bc08,_0x21bd01){_0x21bd01=_0x21bd01||0xc8;return function(_0x3f1621){if(_0x3f1621){return _0x49bc08[_0xd668('0x1b')](_0x21bd01)[_0xd668('0x1d')](_0x3f1621);}};}function respondWithFilteredResult(_0x1fb7a8,_0x55b240){return function(_0x31b30b){if(_0x31b30b){var _0x62a051=_0x31b30b['count'],_0x6bd9f2=_0x55b240[_0xd668('0x1e')],_0x22663b=_0x55b240[_0xd668('0x1e')]+_0x55b240['limit'],_0x153577;if(_0x22663b>=_0x62a051){_0x22663b=_0x62a051;_0x153577=0xc8;}else{_0x153577=0xce;}_0x1fb7a8[_0xd668('0x1b')](_0x153577);return _0x1fb7a8['set'](_0xd668('0x1f'),_0x6bd9f2+'-'+_0x22663b+'/'+_0x62a051)[_0xd668('0x1d')](_0x31b30b);}return null;};}function patchUpdates(_0x415abe){return function(_0x8f0b5b){try{jsonpatch['apply'](_0x8f0b5b,_0x415abe,!![]);}catch(_0x3b50d8){return BPromise[_0xd668('0x20')](_0x3b50d8);}return _0x8f0b5b[_0xd668('0x21')]();};}function saveUpdates(_0x2ff77c,_0x2b1c15){return function(_0x35cae1){if(_0x35cae1){return _0x35cae1[_0xd668('0x22')](_0x2ff77c)['then'](function(_0xb9304e){return _0xb9304e;});}return null;};}function removeEntity(_0x2937c3,_0x35c7fd){return function(_0x18560c){if(_0x18560c){return _0x18560c[_0xd668('0x23')]()[_0xd668('0x24')](function(){var _0x448d1e=_0x18560c['get']({'plain':!![]});var _0x2d2593='Pauses';return db[_0xd668('0x25')][_0xd668('0x23')]({'where':{'type':_0x2d2593,'resourceId':_0x448d1e['id']}})[_0xd668('0x24')](function(){return _0x18560c;});})['then'](function(){_0x2937c3[_0xd668('0x1b')](0xcc)[_0xd668('0x1c')]();});}};}function handleEntityNotFound(_0x2164fd,_0x17a67d){return function(_0x438139){if(!_0x438139){_0x2164fd[_0xd668('0x1a')](0x194);}return _0x438139;};}function handleError(_0x2556a8,_0xa4b68f){_0xa4b68f=_0xa4b68f||0x1f4;return function(_0x182083){logger[_0xd668('0x26')](_0x182083['stack']);if(_0x182083[_0xd668('0x27')]){delete _0x182083[_0xd668('0x27')];}_0x2556a8['status'](_0xa4b68f)['send'](_0x182083);};}exports[_0xd668('0x28')]=function(_0x4cdfb9,_0x5c57c7){var _0x5d50c0={},_0x37e53f={},_0x6e170={'count':0x0,'rows':[]};var _0x2edc5c=_['map'](db[_0xd668('0x29')][_0xd668('0x2a')],function(_0x201ce3){return{'name':_0x201ce3[_0xd668('0x2b')],'type':_0x201ce3['type'][_0xd668('0x2c')]};});_0x37e53f[_0xd668('0x2d')]=_['map'](_0x2edc5c,_0xd668('0x27'));_0x37e53f[_0xd668('0x2e')]=_['keys'](_0x4cdfb9[_0xd668('0x2e')]);_0x37e53f[_0xd668('0x2f')]=_[_0xd668('0x30')](_0x37e53f[_0xd668('0x2d')],_0x37e53f[_0xd668('0x2e')]);_0x5d50c0[_0xd668('0x31')]=_[_0xd668('0x30')](_0x37e53f[_0xd668('0x2d')],qs['fields'](_0x4cdfb9['query'][_0xd668('0x32')]));_0x5d50c0[_0xd668('0x31')]=_0x5d50c0[_0xd668('0x31')][_0xd668('0x33')]?_0x5d50c0[_0xd668('0x31')]:_0x37e53f[_0xd668('0x2d')];if(!_0x4cdfb9['query'][_0xd668('0x34')](_0xd668('0x35'))){_0x5d50c0[_0xd668('0x36')]=qs[_0xd668('0x36')](_0x4cdfb9['query'][_0xd668('0x36')]);_0x5d50c0[_0xd668('0x1e')]=qs[_0xd668('0x1e')](_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x1e')]);}_0x5d50c0[_0xd668('0x37')]=qs[_0xd668('0x38')](_0x4cdfb9['query'][_0xd668('0x38')]);_0x5d50c0[_0xd668('0x39')]=qs[_0xd668('0x2f')](_['pick'](_0x4cdfb9[_0xd668('0x2e')],_0x37e53f['filters']),_0x2edc5c);if(_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x3a')]){_0x5d50c0['where']=_[_0xd668('0x3b')](_0x5d50c0['where'],{'$or':_[_0xd668('0x3c')](_0x2edc5c,function(_0x30f8c0){if(_0x30f8c0['type']!=='VIRTUAL'){var _0x43787e={};_0x43787e[_0x30f8c0[_0xd668('0x27')]]={'$like':'%'+_0x4cdfb9['query']['filter']+'%'};return _0x43787e;}})});}_0x5d50c0=_[_0xd668('0x3b')]({},_0x5d50c0,_0x4cdfb9[_0xd668('0x3d')]);var _0xb7b6ce={'where':_0x5d50c0[_0xd668('0x39')]};return db[_0xd668('0x29')][_0xd668('0x3e')](_0xb7b6ce)[_0xd668('0x24')](function(_0x5431b5){_0x6e170[_0xd668('0x3e')]=_0x5431b5;if(_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x3f')]){_0x5d50c0['include']=[{'all':!![]}];}return db[_0xd668('0x29')][_0xd668('0x40')](_0x5d50c0);})[_0xd668('0x24')](function(_0x5c62a8){_0x6e170[_0xd668('0x41')]=_0x5c62a8;return _0x6e170;})[_0xd668('0x24')](respondWithFilteredResult(_0x5c57c7,_0x5d50c0))[_0xd668('0x42')](handleError(_0x5c57c7,null));};exports[_0xd668('0x43')]=function(_0x310999,_0x4b6965){var _0x3ebccc={'raw':!![],'where':{'id':_0x310999['params']['id']}},_0x565ad6={};_0x565ad6[_0xd668('0x2d')]=_[_0xd668('0x44')](db[_0xd668('0x29')][_0xd668('0x2a')]);_0x565ad6[_0xd668('0x2e')]=_['keys'](_0x310999[_0xd668('0x2e')]);_0x565ad6[_0xd668('0x2f')]=_[_0xd668('0x30')](_0x565ad6[_0xd668('0x2d')],_0x565ad6[_0xd668('0x2e')]);_0x3ebccc[_0xd668('0x31')]=_[_0xd668('0x30')](_0x565ad6[_0xd668('0x2d')],qs[_0xd668('0x32')](_0x310999[_0xd668('0x2e')][_0xd668('0x32')]));_0x3ebccc[_0xd668('0x31')]=_0x3ebccc[_0xd668('0x31')]['length']?_0x3ebccc['attributes']:_0x565ad6[_0xd668('0x2d')];if(_0x310999['query']['includeAll']){_0x3ebccc['include']=[{'all':!![]}];}_0x3ebccc=_['merge']({},_0x3ebccc,_0x310999[_0xd668('0x3d')]);return db[_0xd668('0x29')][_0xd668('0x45')](_0x3ebccc)['then'](handleEntityNotFound(_0x4b6965,null))[_0xd668('0x24')](respondWithResult(_0x4b6965,null))['catch'](handleError(_0x4b6965,null));};exports[_0xd668('0x46')]=function(_0x1d9cc5,_0x1baa42){return db[_0xd668('0x29')]['create'](_0x1d9cc5[_0xd668('0x47')],{})['then'](function(_0x3eeb0e){var _0x560c57=_0x1d9cc5['user'][_0xd668('0x48')]({'plain':!![]});if(!_0x560c57)throw new Error(_0xd668('0x49'));if(_0x560c57[_0xd668('0x4a')]===_0xd668('0x4b')){var _0x31ef44=_0x3eeb0e['get']({'plain':!![]});var _0x4d20bf='Pauses';return db['UserProfileSection'][_0xd668('0x45')]({'where':{'name':_0x4d20bf,'userProfileId':_0x560c57[_0xd668('0x4c')]},'raw':!![]})[_0xd668('0x24')](function(_0x146b67){if(_0x146b67&&_0x146b67[_0xd668('0x4d')]===0x0){return db[_0xd668('0x25')]['create']({'name':_0x31ef44[_0xd668('0x27')],'resourceId':_0x31ef44['id'],'type':_0x146b67[_0xd668('0x27')],'sectionId':_0x146b67['id']},{})['then'](function(){return _0x3eeb0e;});}else{return _0x3eeb0e;}})[_0xd668('0x42')](function(_0x21b20d){logger['error'](_0xd668('0x4e'),_0x21b20d);throw _0x21b20d;});}return _0x3eeb0e;})['then'](respondWithResult(_0x1baa42,0xc9))[_0xd668('0x42')](handleError(_0x1baa42,null));};exports['update']=function(_0x5020cb,_0xce01a9){if(_0x5020cb[_0xd668('0x47')]['id']){delete _0x5020cb[_0xd668('0x47')]['id'];}return db['Pause'][_0xd668('0x45')]({'where':{'id':_0x5020cb[_0xd668('0x4f')]['id']}})[_0xd668('0x24')](handleEntityNotFound(_0xce01a9,null))[_0xd668('0x24')](saveUpdates(_0x5020cb[_0xd668('0x47')],null))[_0xd668('0x24')](respondWithResult(_0xce01a9,null))['catch'](handleError(_0xce01a9,null));};exports[_0xd668('0x23')]=function(_0x1a1636,_0x1ca735){return db['Pause']['find']({'where':{'id':_0x1a1636[_0xd668('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ca735,null))['then'](removeEntity(_0x1ca735,null))[_0xd668('0x42')](handleError(_0x1ca735,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 86c99be..0c36089 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 _0x5a3c=['moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0x5a3c,0x176));var _0xc5a3=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5a3c[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var logger=require(_0xc5a3('0x2'))('api');var moment=require(_0xc5a3('0x3'));var BPromise=require(_0xc5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5a3('0x5'));var rimraf=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var attributes=require(_0xc5a3('0x8'));module[_0xc5a3('0x9')]=function(_0x44a036,_0xb0f633){return _0x44a036[_0xc5a3('0xa')](_0xc5a3('0xb'),attributes,{'tableName':_0xc5a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed9=['moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','define','Pause','tools_pauses','lodash','util','api'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5ed9[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var logger=require('../../config/logger')(_0x95ed('0x2'));var moment=require(_0x95ed('0x3'));var BPromise=require(_0x95ed('0x4'));var rp=require(_0x95ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95ed('0x6'));var config=require(_0x95ed('0x7'));var attributes=require(_0x95ed('0x8'));module['exports']=function(_0x2c9009,_0x5a5117){return _0x2c9009[_0x95ed('0x9')](_0x95ed('0xa'),attributes,{'tableName':_0x95ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 66877f0..68d26b2 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 _0xfb16=['error','code','message','catch','Pause','find','options','raw','where','include','model','attributes','map','then','ShowPause','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x133f28,_0x183bd9){var _0x39f67b=function(_0x4d705b){while(--_0x4d705b){_0x133f28['push'](_0x133f28['shift']());}};_0x39f67b(++_0x183bd9);}(_0xfb16,0xd6));var _0x6fb1=function(_0x4635bc,_0x89606d){_0x4635bc=_0x4635bc-0x0;var _0x505aec=_0xfb16[_0x4635bc];return _0x505aec;};'use strict';var _=require(_0x6fb1('0x0'));var util=require(_0x6fb1('0x1'));var moment=require(_0x6fb1('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fb1('0x3'));var fs=require('fs');var Redis=require(_0x6fb1('0x4'));var db=require(_0x6fb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fb1('0x6'))(_0x6fb1('0x7'));var config=require(_0x6fb1('0x8'));var jayson=require(_0x6fb1('0x9'));var client=jayson['client'][_0x6fb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6672,_0xd7fa1b,_0x3aaa52){return new BPromise(function(_0x1d9f80,_0x204dc5){return client[_0x6fb1('0xb')](_0x1f6672,_0x3aaa52)['then'](function(_0x59fdcc){logger[_0x6fb1('0xc')](_0x6fb1('0xd'),_0xd7fa1b,_0x6fb1('0xe'));logger['debug'](_0x6fb1('0xf'),_0xd7fa1b,'request\x20sent',JSON[_0x6fb1('0x10')](_0x59fdcc));if(_0x59fdcc[_0x6fb1('0x11')]){if(_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x12')]===0x1f4){logger[_0x6fb1('0x11')](_0x6fb1('0xd'),_0xd7fa1b,_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x13')]);return _0x204dc5(_0x59fdcc['error'][_0x6fb1('0x13')]);}logger[_0x6fb1('0x11')](_0x6fb1('0xd'),_0xd7fa1b,_0x59fdcc['error'][_0x6fb1('0x13')]);return _0x1d9f80(_0x59fdcc[_0x6fb1('0x11')][_0x6fb1('0x13')]);}else{logger[_0x6fb1('0xc')](_0x6fb1('0xd'),_0xd7fa1b,'request\x20sent');_0x1d9f80(_0x59fdcc['result'][_0x6fb1('0x13')]);}})[_0x6fb1('0x14')](function(_0x55bdf6){logger['error'](_0x6fb1('0xd'),_0xd7fa1b,_0x55bdf6);_0x204dc5(_0x55bdf6);});});}exports['ShowPause']=function(_0xae1417){var _0x17e350=this;return new Promise(function(_0x5a0371,_0x10a5c2){return db[_0x6fb1('0x15')][_0x6fb1('0x16')]({'raw':_0xae1417[_0x6fb1('0x17')]?_0xae1417[_0x6fb1('0x17')][_0x6fb1('0x18')]===undefined?!![]:![]:!![],'where':_0xae1417['options']?_0xae1417['options'][_0x6fb1('0x19')]||null:null,'attributes':_0xae1417['options']?_0xae1417[_0x6fb1('0x17')]['attributes']||null:null,'include':_0xae1417[_0x6fb1('0x17')]?_0xae1417['options'][_0x6fb1('0x1a')]?_['map'](_0xae1417[_0x6fb1('0x17')]['include'],function(_0x5771c5){return{'model':db[_0x5771c5[_0x6fb1('0x1b')]],'as':_0x5771c5['as'],'attributes':_0x5771c5['attributes'],'include':_0x5771c5[_0x6fb1('0x1a')]?_['map'](_0x5771c5[_0x6fb1('0x1a')],function(_0x1505de){return{'model':db[_0x1505de[_0x6fb1('0x1b')]],'as':_0x1505de['as'],'attributes':_0x1505de[_0x6fb1('0x1c')],'include':_0x1505de[_0x6fb1('0x1a')]?_[_0x6fb1('0x1d')](_0x1505de['include'],function(_0x156cb1){return{'model':db[_0x156cb1['model']],'as':_0x156cb1['as'],'attributes':_0x156cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fb1('0x1e')](function(_0x104a97){logger[_0x6fb1('0xc')](_0x6fb1('0x1f'),_0xae1417);logger[_0x6fb1('0x20')](_0x6fb1('0x1f'),_0xae1417,JSON[_0x6fb1('0x10')](_0x104a97));_0x5a0371(_0x104a97);})[_0x6fb1('0x14')](function(_0x3f26cc){logger['error'](_0x6fb1('0x1f'),_0x3f26cc[_0x6fb1('0x13')],_0xae1417);_0x10a5c2(_0x17e350[_0x6fb1('0x11')](0x1f4,_0x3f26cc[_0x6fb1('0x13')]));});});}; \ No newline at end of file +var _0x897d=['find','options','where','attributes','map','include','model','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowPause','Pause'];(function(_0x4239c8,_0x2c0c6e){var _0x40323b=function(_0x598d03){while(--_0x598d03){_0x4239c8['push'](_0x4239c8['shift']());}};_0x40323b(++_0x2c0c6e);}(_0x897d,0x1ca));var _0xd897=function(_0x34870c,_0x57435c){_0x34870c=_0x34870c-0x0;var _0x3315a9=_0x897d[_0x34870c];return _0x3315a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd897('0x0'));var BPromise=require(_0xd897('0x1'));var rs=require(_0xd897('0x2'));var fs=require('fs');var Redis=require(_0xd897('0x3'));var db=require(_0xd897('0x4'))['db'];var utils=require(_0xd897('0x5'));var logger=require(_0xd897('0x6'))(_0xd897('0x7'));var config=require(_0xd897('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd897('0x9')][_0xd897('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dbfaa,_0x294235,_0x74e183){return new BPromise(function(_0x8ae91f,_0x328ed0){return client['request'](_0x2dbfaa,_0x74e183)['then'](function(_0x48a113){logger['info'](_0xd897('0xb'),_0x294235,_0xd897('0xc'));logger[_0xd897('0xd')](_0xd897('0xe'),_0x294235,_0xd897('0xc'),JSON['stringify'](_0x48a113));if(_0x48a113[_0xd897('0xf')]){if(_0x48a113['error'][_0xd897('0x10')]===0x1f4){logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x48a113['error'][_0xd897('0x11')]);return _0x328ed0(_0x48a113[_0xd897('0xf')][_0xd897('0x11')]);}logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x48a113[_0xd897('0xf')]['message']);return _0x8ae91f(_0x48a113[_0xd897('0xf')][_0xd897('0x11')]);}else{logger[_0xd897('0x12')]('Pause,\x20%s,\x20%s',_0x294235,_0xd897('0xc'));_0x8ae91f(_0x48a113[_0xd897('0x13')]['message']);}})['catch'](function(_0x2a75ed){logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x2a75ed);_0x328ed0(_0x2a75ed);});});}exports[_0xd897('0x14')]=function(_0x3a254c){var _0x499148=this;return new Promise(function(_0x4b5f34,_0x362db6){return db[_0xd897('0x15')][_0xd897('0x16')]({'raw':_0x3a254c[_0xd897('0x17')]?_0x3a254c[_0xd897('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3a254c[_0xd897('0x17')]?_0x3a254c['options'][_0xd897('0x18')]||null:null,'attributes':_0x3a254c[_0xd897('0x17')]?_0x3a254c[_0xd897('0x17')][_0xd897('0x19')]||null:null,'include':_0x3a254c[_0xd897('0x17')]?_0x3a254c['options']['include']?_[_0xd897('0x1a')](_0x3a254c[_0xd897('0x17')][_0xd897('0x1b')],function(_0x2af696){return{'model':db[_0x2af696[_0xd897('0x1c')]],'as':_0x2af696['as'],'attributes':_0x2af696[_0xd897('0x19')],'include':_0x2af696[_0xd897('0x1b')]?_[_0xd897('0x1a')](_0x2af696[_0xd897('0x1b')],function(_0x321b29){return{'model':db[_0x321b29[_0xd897('0x1c')]],'as':_0x321b29['as'],'attributes':_0x321b29[_0xd897('0x19')],'include':_0x321b29[_0xd897('0x1b')]?_[_0xd897('0x1a')](_0x321b29[_0xd897('0x1b')],function(_0x42ec8b){return{'model':db[_0x42ec8b[_0xd897('0x1c')]],'as':_0x42ec8b['as'],'attributes':_0x42ec8b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2700cb){logger[_0xd897('0x12')](_0xd897('0x14'),_0x3a254c);logger[_0xd897('0xd')](_0xd897('0x14'),_0x3a254c,JSON['stringify'](_0x2700cb));_0x4b5f34(_0x2700cb);})[_0xd897('0x1d')](function(_0x2ea413){logger['error'](_0xd897('0x14'),_0x2ea413['message'],_0x3a254c);_0x362db6(_0x499148[_0xd897('0xf')](0x1f4,_0x2ea413[_0xd897('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 6ef5ed0..58df7f3 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 _0x20b5=['get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller'];(function(_0x117475,_0xb11d93){var _0xdb578b=function(_0x5eb15a){while(--_0x5eb15a){_0x117475['push'](_0x117475['shift']());}};_0xdb578b(++_0xb11d93);}(_0x20b5,0xf8));var _0x520b=function(_0x589914,_0x202fff){_0x589914=_0x589914-0x0;var _0x17ef31=_0x20b5[_0x589914];return _0x17ef31;};'use strict';var multer=require(_0x520b('0x0'));var util=require(_0x520b('0x1'));var path=require(_0x520b('0x2'));var timeout=require('connect-timeout');var express=require(_0x520b('0x3'));var router=express['Router']();var auth=require(_0x520b('0x4'));var interaction=require(_0x520b('0x5'));var config=require(_0x520b('0x6'));var controller=require(_0x520b('0x7'));router[_0x520b('0x8')]('/',auth[_0x520b('0x9')](),controller[_0x520b('0xa')]);router['get'](_0x520b('0xb'),controller[_0x520b('0xc')]);router[_0x520b('0x8')]('/:id',auth[_0x520b('0x9')](),controller[_0x520b('0xd')]);router['get'](_0x520b('0xe'),auth[_0x520b('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x520b('0xf')]({'destination':function(_0x1afe85,_0x33d05c,_0x2274c2){_0x2274c2(null,path['join'](config[_0x520b('0x10')],'server/files/plugins'));},'filename':function(_0xe3a7b0,_0xc18fb2,_0x24d692){_0xc18fb2[_0x520b('0x11')]=_0xc18fb2[_0x520b('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x24d692(null,util[_0x520b('0x12')](_0x520b('0x13'),path[_0x520b('0x14')](_0xc18fb2[_0x520b('0x11')],path[_0x520b('0x15')](_0xc18fb2[_0x520b('0x11')])),Date[_0x520b('0x16')](),path[_0x520b('0x15')](_0xc18fb2[_0x520b('0x11')])));}})});router[_0x520b('0x17')]('/',upload[_0x520b('0x18')](_0x520b('0x19')),controller[_0x520b('0x1a')]);router[_0x520b('0x17')](_0x520b('0xb'),controller[_0x520b('0x1b')]);router[_0x520b('0x1c')](_0x520b('0x1d'),auth[_0x520b('0x9')](),controller[_0x520b('0x1e')]);router[_0x520b('0x1f')](_0x520b('0x1d'),auth[_0x520b('0x9')](),controller[_0x520b('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3542=['../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57255b,_0x48f42c){var _0x5a8ab0=function(_0x38a7ad){while(--_0x38a7ad){_0x57255b['push'](_0x57255b['shift']());}};_0x5a8ab0(++_0x48f42c);}(_0x3542,0x158));var _0x2354=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x3542[_0xef4cf0];return _0x497ad2;};'use strict';var multer=require(_0x2354('0x0'));var util=require(_0x2354('0x1'));var path=require(_0x2354('0x2'));var timeout=require(_0x2354('0x3'));var express=require(_0x2354('0x4'));var router=express[_0x2354('0x5')]();var auth=require(_0x2354('0x6'));var interaction=require(_0x2354('0x7'));var config=require(_0x2354('0x8'));var controller=require(_0x2354('0x9'));router[_0x2354('0xa')]('/',auth[_0x2354('0xb')](),controller['index']);router[_0x2354('0xa')](_0x2354('0xc'),controller[_0x2354('0xd')]);router[_0x2354('0xa')](_0x2354('0xe'),auth[_0x2354('0xb')](),controller['show']);router[_0x2354('0xa')]('/:id/download',auth[_0x2354('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x2354('0xf')]({'destination':function(_0x2b406c,_0x18abbf,_0xf2cead){_0xf2cead(null,path['join'](config[_0x2354('0x10')],_0x2354('0x11')));},'filename':function(_0x55bff7,_0x207f2d,_0x286d30){_0x207f2d[_0x2354('0x12')]=_0x207f2d[_0x2354('0x12')][_0x2354('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x286d30(null,util['format'](_0x2354('0x14'),path[_0x2354('0x15')](_0x207f2d['originalname'],path[_0x2354('0x16')](_0x207f2d[_0x2354('0x12')])),Date['now'](),path[_0x2354('0x16')](_0x207f2d[_0x2354('0x12')])));}})});router['post']('/',upload[_0x2354('0x17')](_0x2354('0x18')),controller[_0x2354('0x19')]);router[_0x2354('0x1a')](_0x2354('0xc'),controller[_0x2354('0x1b')]);router[_0x2354('0x1c')]('/:id',auth[_0x2354('0xb')](),controller[_0x2354('0x1d')]);router[_0x2354('0x1e')](_0x2354('0xe'),auth['isAuthenticated'](),controller[_0x2354('0x1e')]);module[_0x2354('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 441f183..74823a8 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 _0xd688=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd688,0x13c));var _0x8d68=function(_0x4172e8,_0x324975){_0x4172e8=_0x4172e8-0x0;var _0x235ee2=_0xd688[_0x4172e8];return _0x235ee2;};'use strict';var Sequelize=require(_0x8d68('0x0'));module[_0x8d68('0x1')]={'name':{'type':Sequelize[_0x8d68('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x8d68('0x3'))},'description':{'type':Sequelize[_0x8d68('0x4')]},'version':{'type':Sequelize[_0x8d68('0x4')]},'path':{'type':Sequelize[_0x8d68('0x2')],'comment':_0x8d68('0x5')},'active':{'type':Sequelize[_0x8d68('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x8d68('0x7')](_0x8d68('0x8'),_0x8d68('0x9'),_0x8d68('0xa'),_0x8d68('0xb')),'defaultValue':_0x8d68('0xa'),'comment':_0x8d68('0xc')},'icon':{'type':Sequelize[_0x8d68('0x2')]},'adminUrl':{'type':Sequelize[_0x8d68('0x2')]},'agentUrl':{'type':Sequelize[_0x8d68('0x2')]},'scriptName':{'type':Sequelize[_0x8d68('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4284=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4284,0x7d));var _0x4428=function(_0x487788,_0x69aae1){_0x487788=_0x487788-0x0;var _0x5cbcfa=_0x4284[_0x487788];return _0x5cbcfa;};'use strict';var Sequelize=require(_0x4428('0x0'));module[_0x4428('0x1')]={'name':{'type':Sequelize[_0x4428('0x2')]},'type':{'type':Sequelize[_0x4428('0x3')]('html',_0x4428('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4428('0x5')]},'path':{'type':Sequelize[_0x4428('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4428('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x4428('0x7'),_0x4428('0x8'),_0x4428('0x9'),_0x4428('0xa')),'defaultValue':_0x4428('0x9'),'comment':_0x4428('0xb')},'icon':{'type':Sequelize[_0x4428('0x2')]},'adminUrl':{'type':Sequelize[_0x4428('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4428('0x2')]},'scriptPath':{'type':Sequelize[_0x4428('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6871135..f76462c 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 _0xee3b=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','Plugins','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','download','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','basename','finalize','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','user','get'];(function(_0x332684,_0x4c5b5b){var _0x42c520=function(_0x443b9b){while(--_0x443b9b){_0x332684['push'](_0x332684['shift']());}};_0x42c520(++_0x4c5b5b);}(_0xee3b,0xc1));var _0xbee3=function(_0x5f558d,_0x4f3ed9){_0x5f558d=_0x5f558d-0x0;var _0x5a2d56=_0xee3b[_0x5f558d];return _0x5a2d56;};'use strict';var pdf=require(_0xbee3('0x0'));var emlformat=require(_0xbee3('0x1'));var rimraf=require(_0xbee3('0x2'));var zipdir=require(_0xbee3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbee3('0x4'));var moment=require('moment');var BPromise=require(_0xbee3('0x5'));var Mustache=require('mustache');var util=require(_0xbee3('0x6'));var path=require(_0xbee3('0x7'));var sox=require(_0xbee3('0x8'));var csv=require(_0xbee3('0x9'));var ejs=require(_0xbee3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbee3('0xb'));var crypto=require(_0xbee3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbee3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xbee3('0xe'));var rimraf=require(_0xbee3('0x2'));var archiver=require(_0xbee3('0xf'));var Redis=require(_0xbee3('0x10'));var authService=require(_0xbee3('0x11'));var qs=require(_0xbee3('0x12'));var as=require(_0xbee3('0x13'));var hardwareService=require(_0xbee3('0x14'));var logger=require('../../config/logger')(_0xbee3('0x15'));var utils=require(_0xbee3('0x16'));var config=require(_0xbee3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbee3('0x18'))['db'];config[_0xbee3('0x19')]=_['defaults'](config['redis'],{'host':_0xbee3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbee3('0x19')]));require(_0xbee3('0x1b'))[_0xbee3('0x1c')](socket);function respondWithStatusCode(_0x377c5f,_0x573c66){_0x573c66=_0x573c66||0xcc;return function(_0x430d29){if(_0x430d29){return _0x377c5f[_0xbee3('0x1d')](_0x573c66);}return _0x377c5f[_0xbee3('0x1e')](_0x573c66)[_0xbee3('0x1f')]();};}function respondWithResult(_0x2c08fe,_0x23f618){_0x23f618=_0x23f618||0xc8;return function(_0x22e9e2){if(_0x22e9e2){return _0x2c08fe['status'](_0x23f618)[_0xbee3('0x20')](_0x22e9e2);}};}function respondWithFilteredResult(_0xbf678f,_0x2e88ec){return function(_0x42baa7){if(_0x42baa7){var _0x1a6f0c=_0x42baa7[_0xbee3('0x21')],_0x326212=_0x2e88ec[_0xbee3('0x22')],_0x364c78=_0x2e88ec[_0xbee3('0x22')]+_0x2e88ec[_0xbee3('0x23')],_0x5ca84;if(_0x364c78>=_0x1a6f0c){_0x364c78=_0x1a6f0c;_0x5ca84=0xc8;}else{_0x5ca84=0xce;}_0xbf678f[_0xbee3('0x1e')](_0x5ca84);return _0xbf678f[_0xbee3('0x24')]('Content-Range',_0x326212+'-'+_0x364c78+'/'+_0x1a6f0c)['json'](_0x42baa7);}return null;};}function patchUpdates(_0x3931cb){return function(_0x65631c){try{jsonpatch[_0xbee3('0x25')](_0x65631c,_0x3931cb,!![]);}catch(_0x1d7231){return BPromise[_0xbee3('0x26')](_0x1d7231);}return _0x65631c[_0xbee3('0x27')]();};}function saveUpdates(_0x1f8d48,_0x3fb435){return function(_0x31127f){if(_0x31127f){return _0x31127f['update'](_0x1f8d48)[_0xbee3('0x28')](function(_0x33bc46){return _0x33bc46;});}return null;};}function removeEntity(_0x54b364,_0x59522d){return function(_0x370076){if(_0x370076){return _0x370076[_0xbee3('0x29')]()[_0xbee3('0x28')](function(){var _0x5aa8ff=_0x370076['get']({'plain':!![]});var _0x13e12e=_0xbee3('0x2a');return db[_0xbee3('0x2b')]['destroy']({'where':{'type':_0x13e12e,'resourceId':_0x5aa8ff['id']}})[_0xbee3('0x28')](function(){return _0x370076;});})[_0xbee3('0x28')](function(){_0x54b364[_0xbee3('0x1e')](0xcc)[_0xbee3('0x1f')]();});}};}function handleEntityNotFound(_0x507f19,_0x1dde47){return function(_0x20f072){if(!_0x20f072){_0x507f19[_0xbee3('0x1d')](0x194);}return _0x20f072;};}function handleError(_0x10ee6b,_0x27fe31){_0x27fe31=_0x27fe31||0x1f4;return function(_0x40ac56){logger[_0xbee3('0x2c')](_0x40ac56[_0xbee3('0x2d')]);if(_0x40ac56[_0xbee3('0x2e')]){delete _0x40ac56['name'];}_0x10ee6b[_0xbee3('0x1e')](_0x27fe31)['send'](_0x40ac56);};}exports['index']=function(_0x1dca84,_0x20cdbc){var _0x43545a={},_0x26dc4a={},_0x352743={'count':0x0,'rows':[]};var _0x1ade65=_[_0xbee3('0x2f')](db[_0xbee3('0x30')][_0xbee3('0x31')],function(_0x492739){return{'name':_0x492739[_0xbee3('0x32')],'type':_0x492739[_0xbee3('0x33')]['key']};});_0x26dc4a[_0xbee3('0x34')]=_[_0xbee3('0x2f')](_0x1ade65,_0xbee3('0x2e'));_0x26dc4a[_0xbee3('0x35')]=_['keys'](_0x1dca84['query']);_0x26dc4a[_0xbee3('0x36')]=_[_0xbee3('0x37')](_0x26dc4a[_0xbee3('0x34')],_0x26dc4a['query']);_0x43545a[_0xbee3('0x38')]=_[_0xbee3('0x37')](_0x26dc4a[_0xbee3('0x34')],qs[_0xbee3('0x39')](_0x1dca84['query'][_0xbee3('0x39')]));_0x43545a[_0xbee3('0x38')]=_0x43545a[_0xbee3('0x38')][_0xbee3('0x3a')]?_0x43545a[_0xbee3('0x38')]:_0x26dc4a[_0xbee3('0x34')];if(!_0x1dca84[_0xbee3('0x35')][_0xbee3('0x3b')](_0xbee3('0x3c'))){_0x43545a[_0xbee3('0x23')]=qs[_0xbee3('0x23')](_0x1dca84['query']['limit']);_0x43545a[_0xbee3('0x22')]=qs[_0xbee3('0x22')](_0x1dca84[_0xbee3('0x35')]['offset']);}_0x43545a[_0xbee3('0x3d')]=qs[_0xbee3('0x3e')](_0x1dca84[_0xbee3('0x35')][_0xbee3('0x3e')]);_0x43545a[_0xbee3('0x3f')]=qs[_0xbee3('0x36')](_['pick'](_0x1dca84[_0xbee3('0x35')],_0x26dc4a[_0xbee3('0x36')]),_0x1ade65);if(_0x1dca84['query'][_0xbee3('0x40')]){_0x43545a['where']=_[_0xbee3('0x41')](_0x43545a[_0xbee3('0x3f')],{'$or':_[_0xbee3('0x2f')](_0x1ade65,function(_0x350116){if(_0x350116['type']!==_0xbee3('0x42')){var _0x221bb0={};_0x221bb0[_0x350116[_0xbee3('0x2e')]]={'$like':'%'+_0x1dca84[_0xbee3('0x35')][_0xbee3('0x40')]+'%'};return _0x221bb0;}})});}_0x43545a=_[_0xbee3('0x41')]({},_0x43545a,_0x1dca84[_0xbee3('0x43')]);var _0x216264={'where':_0x43545a[_0xbee3('0x3f')]};return db['Plugin'][_0xbee3('0x21')](_0x216264)[_0xbee3('0x28')](function(_0x27c5fb){_0x352743[_0xbee3('0x21')]=_0x27c5fb;if(_0x1dca84[_0xbee3('0x35')][_0xbee3('0x44')]){_0x43545a[_0xbee3('0x45')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x43545a);})[_0xbee3('0x28')](function(_0x20121b){_0x352743[_0xbee3('0x46')]=_0x20121b;return _0x352743;})[_0xbee3('0x28')](respondWithFilteredResult(_0x20cdbc,_0x43545a))[_0xbee3('0x47')](handleError(_0x20cdbc,null));};exports[_0xbee3('0x48')]=function(_0x39ff11,_0x2655f5){var _0x189d64={'raw':!![],'where':{'id':_0x39ff11[_0xbee3('0x49')]['id']}},_0x2c9e4a={};_0x2c9e4a['model']=_[_0xbee3('0x4a')](db[_0xbee3('0x30')]['rawAttributes']);_0x2c9e4a['query']=_[_0xbee3('0x4a')](_0x39ff11[_0xbee3('0x35')]);_0x2c9e4a[_0xbee3('0x36')]=_[_0xbee3('0x37')](_0x2c9e4a[_0xbee3('0x34')],_0x2c9e4a['query']);_0x189d64['attributes']=_[_0xbee3('0x37')](_0x2c9e4a['model'],qs[_0xbee3('0x39')](_0x39ff11[_0xbee3('0x35')]['fields']));_0x189d64['attributes']=_0x189d64[_0xbee3('0x38')][_0xbee3('0x3a')]?_0x189d64[_0xbee3('0x38')]:_0x2c9e4a[_0xbee3('0x34')];if(_0x39ff11[_0xbee3('0x35')][_0xbee3('0x44')]){_0x189d64['include']=[{'all':!![]}];}_0x189d64=_['merge']({},_0x189d64,_0x39ff11[_0xbee3('0x43')]);return db[_0xbee3('0x30')][_0xbee3('0x4b')](_0x189d64)[_0xbee3('0x28')](handleEntityNotFound(_0x2655f5,null))[_0xbee3('0x28')](respondWithResult(_0x2655f5,null))[_0xbee3('0x47')](handleError(_0x2655f5,null));};exports[_0xbee3('0x4c')]=function(_0x461152,_0x1d85f6,_0x1ac8c1){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x461152['params']['id']},'attributes':[_0xbee3('0x2e'),_0xbee3('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x1d85f6,null))['then'](function(_0x54fd7d){if(_0x54fd7d){var _0x4db800=path['join'](config['root'],_0xbee3('0x4d'),util[_0xbee3('0x4e')](_0xbee3('0x4f'),path['basename'](_0x54fd7d[_0xbee3('0x7')])));var _0x349bf3=fs[_0xbee3('0x50')](_0x4db800);var _0x4bb610=archiver(_0xbee3('0x51'),{'zlib':{'level':0x9}});_0x4bb610['on'](_0xbee3('0x52'),function(_0x3480f1){if(_0x3480f1[_0xbee3('0x53')]===_0xbee3('0x54')){logger['error'](_0x3480f1);}else{throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))](_0xbee3('0x57'));}});_0x4bb610['on']('error',function(_0x53f6d3){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4bb610[_0xbee3('0x58')](_0x349bf3);_0x4bb610[_0xbee3('0x59')](_0xbee3('0x5a'),{'cwd':path[_0xbee3('0x5b')](config['root'],_0xbee3('0x4d'),path[_0xbee3('0x5c')](_0x54fd7d[_0xbee3('0x7')])),'ignore':[path[_0xbee3('0x5b')](path['basename'](_0x54fd7d[_0xbee3('0x7')]),_0xbee3('0x5d')),path[_0xbee3('0x5b')](path[_0xbee3('0x5e')](_0x54fd7d[_0xbee3('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xbee3('0x5f')]();_0x349bf3['on']('close',function(){if(!fs['existsSync'](_0x4db800)){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))](_0xbee3('0x60'));}return _0x1d85f6[_0xbee3('0x4c')](_0x4db800,util[_0xbee3('0x4e')](_0xbee3('0x4f'),path[_0xbee3('0x5e')](_0x54fd7d[_0xbee3('0x7')])),function(_0x634ec7){if(_0x634ec7){throw new db[(_0xbee3('0x55'))][(_0xbee3('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xbee3('0x61')](_0x4db800);logger[_0xbee3('0x62')]('Download\x20completed');logger[_0xbee3('0x62')](_0xbee3('0x63'));});});}return null;})[_0xbee3('0x47')](handleError(_0x1d85f6,null));};exports[_0xbee3('0x64')]=function(_0x1ee8eb,_0x1ef3e6,_0x25dc71){var _0x19df73=path[_0xbee3('0x5e')](_0x1ee8eb[_0xbee3('0x65')][_0xbee3('0x66')],path[_0xbee3('0x67')](_0x1ee8eb[_0xbee3('0x65')]['filename']));var _0x378c49=path[_0xbee3('0x5b')](config['root'],_0xbee3('0x4d'),_0x1ee8eb[_0xbee3('0x65')][_0xbee3('0x66')]);var _0x45cb09=path[_0xbee3('0x5b')](config[_0xbee3('0x68')],_0xbee3('0x4d'),_0x19df73);logger[_0xbee3('0x62')](_0xbee3('0x69'),_0x378c49);logger[_0xbee3('0x62')](_0xbee3('0x6a'),_0x45cb09);try{fs[_0xbee3('0x6b')](_0x378c49,parseInt('0777',0x8));extract(_0x378c49,{'dir':_0x45cb09},function(_0x29cb7d){if(_0x29cb7d){logger['error'](_0x29cb7d);handleError(_0x29cb7d,!![]);};var _0x3abea0=fs['readdirSync'](_0x45cb09);if(_0x3abea0[_0xbee3('0x3a')]>0x1){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')]('Invalid\x20plugin\x20structure');return _0x25dc71(new Error(_0xbee3('0x6c')));}var _0x3c6c54=fs['lstatSync'](path[_0xbee3('0x5b')](_0x45cb09,_0x3abea0[0x0]));if(_0x3c6c54[_0xbee3('0x6d')]()){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')](_0xbee3('0x6c'));return _0x25dc71(new Error(_0xbee3('0x6c')));}if(_0x3c6c54['isDirectory']()){var _0x453c64=fs[_0xbee3('0x6e')](path['join'](_0x45cb09,_0x3abea0[0x0]));if(_0x453c64[_0xbee3('0x3a')]===0x0){removeReferences(_0x378c49,_0x45cb09);logger[_0xbee3('0x2c')](_0xbee3('0x6c'));return _0x25dc71(new Error(_0xbee3('0x6c')));}var _0x2cba44=_0x453c64[_0xbee3('0x6f')](function(_0x46d47f){return _0x46d47f==='manifest.json';});if(!_0x2cba44){return _0x25dc71(new Error(_0xbee3('0x70')));}var _0x2eafd0=fs[_0xbee3('0x71')](path[_0xbee3('0x5b')](_0x45cb09,_0x3abea0[0x0],_0xbee3('0x72')));var _0x40c394=JSON[_0xbee3('0x73')](_0x2eafd0);if(_0xbee3('0x74')==typeof _0x40c394['name']){return _0x25dc71(new Error(_0xbee3('0x75')));}if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x33')]){return _0x25dc71(new Error(_0xbee3('0x76')));}if('undefined'==typeof _0x40c394[_0xbee3('0x77')]){return _0x25dc71(new Error(_0xbee3('0x78')));}if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')]){return _0x25dc71(new Error(_0xbee3('0x7a')));}if(_0x40c394[_0xbee3('0x33')]==='html'){if(_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')]){return _0x25dc71(new Error(_0xbee3('0x7c')));}if('undefined'==typeof _0x40c394['parameters'][_0xbee3('0x7b')]['admin']&&_0xbee3('0x74')==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){return _0x25dc71(new Error(_0xbee3('0x7e')));}}else if(_0x40c394[_0xbee3('0x33')]===_0xbee3('0x7f')){if(_0xbee3('0x74')==typeof _0x40c394['parameters'][_0xbee3('0x80')]){return _0x25dc71(new Error(_0xbee3('0x81')));}if('undefined'==typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x82')]){return _0x25dc71(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x25dc71(new Error(_0xbee3('0x83')));}var _0x33cce5=_0x40c394[_0xbee3('0x2e')];var _0x14d8c1=_0x40c394['description'];var _0x4c3d88=_0x40c394[_0xbee3('0x33')];var _0x18cc7c=_0x40c394[_0xbee3('0x84')]?_0x40c394['sidebar']:_0xbee3('0x85');var _0x682223=_0x40c394[_0xbee3('0x86')]?_0x40c394[_0xbee3('0x86')]:_0xbee3('0x87');var _0x5d9df8='';var _0x174258='';var _0x5b6e50='';var _0x59559e='';var _0xd5f84b=_0x40c394[_0xbee3('0x77')];if(_0x4c3d88===_0xbee3('0x88')){if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')]['views'][_0xbee3('0x89')]){var _0x4bcc68=_0x40c394['parameters']['views'][_0xbee3('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x4bcc68)){_0x5d9df8=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x4bcc68);}else{_0x5d9df8=_0x4bcc68;}}else{logger[_0xbee3('0x62')](_0xbee3('0x8c'));}if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){var _0x25c17f=_0x40c394['parameters'][_0xbee3('0x7b')][_0xbee3('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x25c17f)){_0x174258=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x25c17f);}else{_0x174258=_0x25c17f;}}else{logger[_0xbee3('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4c3d88===_0xbee3('0x7f')){_0x5b6e50=_0x40c394[_0xbee3('0x79')][_0xbee3('0x80')];_0x59559e=_0x40c394[_0xbee3('0x79')][_0xbee3('0x82')];if(_0xbee3('0x74')!=typeof _0x40c394['parameters'][_0xbee3('0x7b')]){if(_0xbee3('0x74')!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x89')]){var _0x4bcc68=_0x40c394['parameters'][_0xbee3('0x7b')][_0xbee3('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4bcc68)){_0x5d9df8=path[_0xbee3('0x5b')](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x4bcc68);}else{_0x5d9df8=_0x4bcc68;}}if('undefined'!=typeof _0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')][_0xbee3('0x7d')]){var _0x25c17f=_0x40c394[_0xbee3('0x79')][_0xbee3('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbee3('0x8a')](_0x25c17f)){_0x174258=path['join'](_0xbee3('0x8b'),_0x19df73,_0x3abea0[0x0],_0x25c17f);}else{_0x174258=_0x25c17f;}}}}var _0x290f62={'name':_0x33cce5,'description':_0x14d8c1,'path':path[_0xbee3('0x5b')](_0x19df73,_0x3abea0[0x0]),'type':_0x4c3d88,'sidebar':_0x18cc7c,'icon':_0x682223,'adminUrl':_0x5d9df8,'agentUrl':_0x174258,'scriptName':_0x5b6e50,'scriptPath':_0x59559e,'version':_0xd5f84b};removeReferences(_0x378c49,null);return db['Plugin'][_0xbee3('0x8d')](_0x290f62)['then'](function(_0x1d08e6){var _0x426302={'role':_0x1ee8eb[_0xbee3('0x8e')][_0xbee3('0x8f')],'userProfileId':_0x1ee8eb[_0xbee3('0x8e')][_0xbee3('0x90')]};if(!_0x426302)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x426302['role']===_0xbee3('0x91')){var _0x272645=_0x1d08e6[_0xbee3('0x92')]({'plain':!![]});return db[_0xbee3('0x93')][_0xbee3('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x426302['userProfileId']},'raw':!![]})[_0xbee3('0x28')](function(_0x43ecb7){if(_0x43ecb7&&_0x43ecb7[_0xbee3('0x94')]===0x0){return db[_0xbee3('0x2b')][_0xbee3('0x8d')]({'name':_0x272645[_0xbee3('0x2e')],'resourceId':_0x272645['id'],'type':_0x43ecb7[_0xbee3('0x2e')],'sectionId':_0x43ecb7['id']},{})[_0xbee3('0x28')](function(){return _0x1d08e6;});}else{return _0x1d08e6;}})[_0xbee3('0x47')](function(_0x3aa7fe){logger[_0xbee3('0x2c')](_0xbee3('0x95'),_0x3aa7fe);throw _0x3aa7fe;});}return _0x1d08e6;})[_0xbee3('0x28')](respondWithResult(_0x1ef3e6,null))[_0xbee3('0x47')](handleError(_0x1ef3e6,null));}});}catch(_0x1e5397){_0x1ef3e6['status'](0x1f4)[_0xbee3('0x96')](_0x1e5397);}};function removeReferences(_0x2403dd,_0x5ee3a4){try{if(_0x2403dd){fs[_0xbee3('0x61')](_0x2403dd);logger[_0xbee3('0x62')]('Zip\x20archive\x20removed');}if(_0x5ee3a4){rimraf(_0x5ee3a4,function(){});logger[_0xbee3('0x62')](_0xbee3('0x97'));}}catch(_0x3e8735){logger['error'](_0x3e8735);}}exports[_0xbee3('0x98')]=function(_0x4b3e41,_0x146ffa,_0x5ab71c){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x4b3e41[_0xbee3('0x49')]['id']}})[_0xbee3('0x28')](handleEntityNotFound(_0x146ffa,null))[_0xbee3('0x28')](saveUpdates(_0x4b3e41[_0xbee3('0x8e')],null))[_0xbee3('0x28')](respondWithResult(_0x146ffa,null))[_0xbee3('0x47')](handleError(_0x146ffa,null));};exports[_0xbee3('0x99')]=function(_0x1f6f81,_0x4e854a,_0x26d138){return db[_0xbee3('0x30')][_0xbee3('0x4b')]({'where':{'id':_0x1f6f81['params']['id']}})[_0xbee3('0x28')](function(_0x5b317f){if(_0x5b317f){return _0x5b317f[_0xbee3('0x29')]();}})[_0xbee3('0x28')](function(_0x31de8a){rimraf(path[_0xbee3('0x5b')](config[_0xbee3('0x68')],_0xbee3('0x4d'),path[_0xbee3('0x5c')](_0x31de8a[_0xbee3('0x7')])),function(){});return _0x31de8a;})[_0xbee3('0x28')](handleEntityNotFound(_0x4e854a,null))[_0xbee3('0x28')](respondWithStatusCode(_0x4e854a,null))[_0xbee3('0x47')](handleError(_0x4e854a,null));};exports[_0xbee3('0x9a')]=function(_0x22af22,_0x3fb366,_0x4b2ab4){return BPromise[_0xbee3('0x9b')]()['then'](function(){if(!_0x22af22[_0xbee3('0x35')][_0xbee3('0x7')]){throw new Error(_0xbee3('0x9c'));}if(!_0x22af22[_0xbee3('0x35')][_0xbee3('0x9d')]){throw new Error(_0xbee3('0x9e'));}var _0x5e84f0=_0x22af22[_0xbee3('0x35')]['hostname']?_0x22af22[_0xbee3('0x35')][_0xbee3('0x9f')]+':'+_0x22af22[_0xbee3('0x35')]['port']:_0xbee3('0xa0')+_0x22af22[_0xbee3('0x35')]['port'];var _0x3e68a1=_0x22af22['query'][_0xbee3('0x20')]?_0x22af22[_0xbee3('0x35')][_0xbee3('0x20')]:!![];var _0x1b1d93=_0x22af22['query'][_0xbee3('0xa1')]?_0x22af22[_0xbee3('0x35')]['encoding']:null;var _0x2c2d67={'method':_0x22af22[_0xbee3('0xa2')],'uri':util[_0xbee3('0x4e')](_0xbee3('0xa3'),_0x5e84f0,_0x22af22[_0xbee3('0x35')]['path']),'json':_0x3e68a1,'resolveWithFullResponse':!![],'encoding':_0x1b1d93,'qs':_0x22af22['query']};if(_0x22af22['headers']){_0x2c2d67[_0xbee3('0xa4')]=_0x22af22[_0xbee3('0xa4')];if(_0x2c2d67[_0xbee3('0xa4')]['content-length']){delete _0x2c2d67['headers'][_0xbee3('0xa5')];}}if(_0x2c2d67[_0xbee3('0xa4')][_0xbee3('0xa6')]){delete _0x2c2d67[_0xbee3('0xa4')][_0xbee3('0xa6')];}return rp(_0x2c2d67);})[_0xbee3('0x28')](function(_0x4e2429){if(_0x4e2429){_0x3fb366[_0xbee3('0x24')](_0x4e2429['headers']);logger[_0xbee3('0x62')](_0x4e2429['body']);if(_[_0xbee3('0xa7')](_0x22af22['query'][_0xbee3('0x7')],'download')&&_0x4e2429[_0xbee3('0xa8')]==0x1f4){return _0x3fb366['sendStatus'](_0x4e2429[_0xbee3('0xa8')]);}else{return _0x3fb366[_0xbee3('0x1e')](_0x4e2429[_0xbee3('0xa8')])['send'](_0x4e2429['body']);}}else{return _0x3fb366[_0xbee3('0x1d')](0xc8);}})[_0xbee3('0x47')](handleError(_0x3fb366,null));};exports[_0xbee3('0xa9')]=function(_0x5d0431,_0xab1ec5,_0x50f3ce){return BPromise['resolve']()[_0xbee3('0x28')](function(){if(!_0x5d0431[_0xbee3('0x35')][_0xbee3('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5d0431[_0xbee3('0x35')]['port']){throw new Error(_0xbee3('0x9e'));}var _0x2b650a=_0x5d0431['query']['hostname']?_0x5d0431['query'][_0xbee3('0x9f')]+':'+_0x5d0431[_0xbee3('0x35')][_0xbee3('0x9d')]:_0xbee3('0xa0')+_0x5d0431[_0xbee3('0x35')][_0xbee3('0x9d')];var _0x48728f=_0x5d0431[_0xbee3('0x35')][_0xbee3('0x20')]?_0x5d0431[_0xbee3('0x35')][_0xbee3('0x20')]:!![];var _0x3e7e7e=_0x5d0431[_0xbee3('0x35')][_0xbee3('0xa1')]?_0x5d0431[_0xbee3('0x35')][_0xbee3('0xa1')]:null;var _0x53cda7={'method':_0x5d0431[_0xbee3('0xa2')],'uri':util[_0xbee3('0x4e')](_0xbee3('0xa3'),_0x2b650a,_0x5d0431['query'][_0xbee3('0x7')]),'json':_0x48728f,'resolveWithFullResponse':!![],'encoding':_0x3e7e7e,'body':_0x5d0431['body']};if(_0x5d0431[_0xbee3('0xa4')]){_0x53cda7[_0xbee3('0xa4')]=_0x5d0431[_0xbee3('0xa4')];if(_0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa5')]){delete _0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa5')];}}if(_0x53cda7['headers'][_0xbee3('0xa6')]){delete _0x53cda7[_0xbee3('0xa4')][_0xbee3('0xa6')];}return rp(_0x53cda7);})['then'](function(_0x13bb54){if(_0x13bb54){_0xab1ec5['set'](_0x13bb54[_0xbee3('0xa4')]);logger['info'](_0x13bb54['body']);return _0xab1ec5[_0xbee3('0x1e')](_0x13bb54[_0xbee3('0xa8')])[_0xbee3('0x96')](_0x13bb54[_0xbee3('0x8e')]);}else{return _0xab1ec5[_0xbee3('0x1d')](0xc8);}})[_0xbee3('0x47')](handleError(_0xab1ec5,null));}; \ No newline at end of file +var _0x66e3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','model','find','server/files/plugins','format','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','join','basename','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','catch','upload','filename','extname','root','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','extract-zip'];(function(_0x54750e,_0x59ccdb){var _0x568a1e=function(_0x425e11){while(--_0x425e11){_0x54750e['push'](_0x54750e['shift']());}};_0x568a1e(++_0x59ccdb);}(_0x66e3,0x9b));var _0x366e=function(_0x5a0fc7,_0x382add){_0x5a0fc7=_0x5a0fc7-0x0;var _0xe721e7=_0x66e3[_0x5a0fc7];return _0xe721e7;};'use strict';var pdf=require(_0x366e('0x0'));var emlformat=require(_0x366e('0x1'));var rimraf=require(_0x366e('0x2'));var zipdir=require(_0x366e('0x3'));var jsonpatch=require(_0x366e('0x4'));var rp=require(_0x366e('0x5'));var moment=require('moment');var BPromise=require(_0x366e('0x6'));var Mustache=require(_0x366e('0x7'));var util=require(_0x366e('0x8'));var path=require(_0x366e('0x9'));var sox=require(_0x366e('0xa'));var csv=require(_0x366e('0xb'));var ejs=require(_0x366e('0xc'));var fs=require('fs');var _=require(_0x366e('0xd'));var squel=require('squel');var crypto=require(_0x366e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x366e('0xf'));var toCsv=require(_0x366e('0xb'));var querystring=require(_0x366e('0x10'));var Papa=require(_0x366e('0x11'));var extract=require(_0x366e('0x12'));var rimraf=require(_0x366e('0x2'));var archiver=require('archiver');var Redis=require(_0x366e('0x13'));var authService=require(_0x366e('0x14'));var qs=require(_0x366e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x366e('0x16'));var logger=require(_0x366e('0x17'))(_0x366e('0x18'));var utils=require(_0x366e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x366e('0x1a'));var db=require(_0x366e('0x1b'))['db'];config[_0x366e('0x1c')]=_[_0x366e('0x1d')](config[_0x366e('0x1c')],{'host':_0x366e('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x366e('0x1c')]));require(_0x366e('0x1f'))[_0x366e('0x20')](socket);function respondWithStatusCode(_0xdbe528,_0x507a69){_0x507a69=_0x507a69||0xcc;return function(_0x3624d3){if(_0x3624d3){return _0xdbe528[_0x366e('0x21')](_0x507a69);}return _0xdbe528[_0x366e('0x22')](_0x507a69)[_0x366e('0x23')]();};}function respondWithResult(_0x5694db,_0x3cdb1d){_0x3cdb1d=_0x3cdb1d||0xc8;return function(_0x45ae87){if(_0x45ae87){return _0x5694db[_0x366e('0x22')](_0x3cdb1d)['json'](_0x45ae87);}};}function respondWithFilteredResult(_0x2c6a94,_0x1e0fac){return function(_0x44cfeb){if(_0x44cfeb){var _0x5729b0=_0x44cfeb['count'],_0x2df106=_0x1e0fac[_0x366e('0x24')],_0x259793=_0x1e0fac[_0x366e('0x24')]+_0x1e0fac[_0x366e('0x25')],_0x22bbb0;if(_0x259793>=_0x5729b0){_0x259793=_0x5729b0;_0x22bbb0=0xc8;}else{_0x22bbb0=0xce;}_0x2c6a94[_0x366e('0x22')](_0x22bbb0);return _0x2c6a94['set'](_0x366e('0x26'),_0x2df106+'-'+_0x259793+'/'+_0x5729b0)[_0x366e('0x27')](_0x44cfeb);}return null;};}function patchUpdates(_0x1a96e2){return function(_0x577f9a){try{jsonpatch[_0x366e('0x28')](_0x577f9a,_0x1a96e2,!![]);}catch(_0x24904f){return BPromise['reject'](_0x24904f);}return _0x577f9a[_0x366e('0x29')]();};}function saveUpdates(_0x71c6b4,_0x38c31a){return function(_0x414bc6){if(_0x414bc6){return _0x414bc6['update'](_0x71c6b4)[_0x366e('0x2a')](function(_0x2d03b7){return _0x2d03b7;});}return null;};}function removeEntity(_0x4ca83e,_0x3cf3eb){return function(_0xb6235a){if(_0xb6235a){return _0xb6235a[_0x366e('0x2b')]()[_0x366e('0x2a')](function(){var _0x26ce18=_0xb6235a[_0x366e('0x2c')]({'plain':!![]});var _0x1db0f2='Plugins';return db[_0x366e('0x2d')][_0x366e('0x2b')]({'where':{'type':_0x1db0f2,'resourceId':_0x26ce18['id']}})[_0x366e('0x2a')](function(){return _0xb6235a;});})[_0x366e('0x2a')](function(){_0x4ca83e[_0x366e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39dc8d,_0x41a172){return function(_0xe5e7ca){if(!_0xe5e7ca){_0x39dc8d[_0x366e('0x21')](0x194);}return _0xe5e7ca;};}function handleError(_0x251805,_0x5d558c){_0x5d558c=_0x5d558c||0x1f4;return function(_0x2f9334){logger[_0x366e('0x2e')](_0x2f9334['stack']);if(_0x2f9334[_0x366e('0x2f')]){delete _0x2f9334['name'];}_0x251805['status'](_0x5d558c)[_0x366e('0x30')](_0x2f9334);};}exports[_0x366e('0x31')]=function(_0x486a80,_0x2a3364){var _0x446e71={},_0x119731={},_0x193d91={'count':0x0,'rows':[]};var _0x59a5a8=_[_0x366e('0x32')](db[_0x366e('0x33')][_0x366e('0x34')],function(_0x59b206){return{'name':_0x59b206[_0x366e('0x35')],'type':_0x59b206[_0x366e('0x36')]['key']};});_0x119731['model']=_[_0x366e('0x32')](_0x59a5a8,_0x366e('0x2f'));_0x119731[_0x366e('0x37')]=_[_0x366e('0x38')](_0x486a80['query']);_0x119731[_0x366e('0x39')]=_[_0x366e('0x3a')](_0x119731['model'],_0x119731[_0x366e('0x37')]);_0x446e71[_0x366e('0x3b')]=_[_0x366e('0x3a')](_0x119731['model'],qs[_0x366e('0x3c')](_0x486a80['query'][_0x366e('0x3c')]));_0x446e71[_0x366e('0x3b')]=_0x446e71[_0x366e('0x3b')][_0x366e('0x3d')]?_0x446e71['attributes']:_0x119731['model'];if(!_0x486a80[_0x366e('0x37')][_0x366e('0x3e')](_0x366e('0x3f'))){_0x446e71[_0x366e('0x25')]=qs[_0x366e('0x25')](_0x486a80[_0x366e('0x37')]['limit']);_0x446e71['offset']=qs[_0x366e('0x24')](_0x486a80[_0x366e('0x37')][_0x366e('0x24')]);}_0x446e71['order']=qs[_0x366e('0x40')](_0x486a80[_0x366e('0x37')][_0x366e('0x40')]);_0x446e71[_0x366e('0x41')]=qs[_0x366e('0x39')](_[_0x366e('0x42')](_0x486a80[_0x366e('0x37')],_0x119731[_0x366e('0x39')]),_0x59a5a8);if(_0x486a80[_0x366e('0x37')][_0x366e('0x43')]){_0x446e71[_0x366e('0x41')]=_[_0x366e('0x44')](_0x446e71[_0x366e('0x41')],{'$or':_[_0x366e('0x32')](_0x59a5a8,function(_0x4009f2){if(_0x4009f2['type']!==_0x366e('0x45')){var _0x59ea4e={};_0x59ea4e[_0x4009f2[_0x366e('0x2f')]]={'$like':'%'+_0x486a80[_0x366e('0x37')][_0x366e('0x43')]+'%'};return _0x59ea4e;}})});}_0x446e71=_[_0x366e('0x44')]({},_0x446e71,_0x486a80[_0x366e('0x46')]);var _0x253439={'where':_0x446e71[_0x366e('0x41')]};return db[_0x366e('0x33')][_0x366e('0x47')](_0x253439)[_0x366e('0x2a')](function(_0x2683f2){_0x193d91[_0x366e('0x47')]=_0x2683f2;if(_0x486a80[_0x366e('0x37')][_0x366e('0x48')]){_0x446e71[_0x366e('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x446e71);})[_0x366e('0x2a')](function(_0x141f60){_0x193d91[_0x366e('0x4a')]=_0x141f60;return _0x193d91;})[_0x366e('0x2a')](respondWithFilteredResult(_0x2a3364,_0x446e71))['catch'](handleError(_0x2a3364,null));};exports[_0x366e('0x4b')]=function(_0x3cb00e,_0x31952b){var _0x271808={'raw':!![],'where':{'id':_0x3cb00e[_0x366e('0x4c')]['id']}},_0x5c59d4={};_0x5c59d4[_0x366e('0x4d')]=_[_0x366e('0x38')](db[_0x366e('0x33')][_0x366e('0x34')]);_0x5c59d4[_0x366e('0x37')]=_['keys'](_0x3cb00e[_0x366e('0x37')]);_0x5c59d4[_0x366e('0x39')]=_['intersection'](_0x5c59d4[_0x366e('0x4d')],_0x5c59d4[_0x366e('0x37')]);_0x271808[_0x366e('0x3b')]=_[_0x366e('0x3a')](_0x5c59d4[_0x366e('0x4d')],qs[_0x366e('0x3c')](_0x3cb00e['query']['fields']));_0x271808[_0x366e('0x3b')]=_0x271808[_0x366e('0x3b')][_0x366e('0x3d')]?_0x271808[_0x366e('0x3b')]:_0x5c59d4[_0x366e('0x4d')];if(_0x3cb00e['query'][_0x366e('0x48')]){_0x271808[_0x366e('0x49')]=[{'all':!![]}];}_0x271808=_[_0x366e('0x44')]({},_0x271808,_0x3cb00e[_0x366e('0x46')]);return db['Plugin']['find'](_0x271808)[_0x366e('0x2a')](handleEntityNotFound(_0x31952b,null))[_0x366e('0x2a')](respondWithResult(_0x31952b,null))['catch'](handleError(_0x31952b,null));};exports['download']=function(_0x586485,_0x48bc30,_0x16d4ef){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x586485[_0x366e('0x4c')]['id']},'attributes':['name',_0x366e('0x9')],'raw':!![]})[_0x366e('0x2a')](handleEntityNotFound(_0x48bc30,null))[_0x366e('0x2a')](function(_0x3c0d74){if(_0x3c0d74){var _0x276fe1=path['join'](config['root'],_0x366e('0x4f'),util[_0x366e('0x50')]('%s.zip',path['basename'](_0x3c0d74[_0x366e('0x9')])));var _0x3384d5=fs['createWriteStream'](_0x276fe1);var _0x4f3b34=archiver(_0x366e('0x51'),{'zlib':{'level':0x9}});_0x4f3b34['on'](_0x366e('0x52'),function(_0x5dde7a){if(_0x5dde7a[_0x366e('0x53')]===_0x366e('0x54')){logger[_0x366e('0x2e')](_0x5dde7a);}else{throw new db[(_0x366e('0x55'))][(_0x366e('0x56'))](_0x366e('0x57'));}});_0x4f3b34['on'](_0x366e('0x2e'),function(_0x5ca311){throw new db[(_0x366e('0x55'))]['Error'](_0x366e('0x57'));});_0x4f3b34['pipe'](_0x3384d5);_0x4f3b34[_0x366e('0x58')](_0x366e('0x59'),{'cwd':path['join'](config['root'],_0x366e('0x4f'),path[_0x366e('0x5a')](_0x3c0d74['path'])),'ignore':[path[_0x366e('0x5b')](path[_0x366e('0x5c')](_0x3c0d74['path']),_0x366e('0x5d')),path[_0x366e('0x5b')](path[_0x366e('0x5c')](_0x3c0d74['path']),_0x366e('0x5e'))],'nodir':!![]})[_0x366e('0x5f')]();_0x3384d5['on']('close',function(){if(!fs['existsSync'](_0x276fe1)){throw new db['Sequelize'][(_0x366e('0x56'))](_0x366e('0x60'));}return _0x48bc30[_0x366e('0x61')](_0x276fe1,util[_0x366e('0x50')](_0x366e('0x62'),path['basename'](_0x3c0d74[_0x366e('0x9')])),function(_0x2ef1b2){if(_0x2ef1b2){throw new db[(_0x366e('0x55'))]['Error'](_0x366e('0x63'));}fs[_0x366e('0x64')](_0x276fe1);logger['info'](_0x366e('0x65'));logger[_0x366e('0x66')](_0x366e('0x67'));});});}return null;})[_0x366e('0x68')](handleError(_0x48bc30,null));};exports[_0x366e('0x69')]=function(_0x428fd3,_0x4a412d,_0x16142c){var _0x5a5cad=path[_0x366e('0x5c')](_0x428fd3['file'][_0x366e('0x6a')],path[_0x366e('0x6b')](_0x428fd3['file'][_0x366e('0x6a')]));var _0x14ca5f=path[_0x366e('0x5b')](config[_0x366e('0x6c')],_0x366e('0x4f'),_0x428fd3[_0x366e('0x6d')][_0x366e('0x6a')]);var _0xf2a6ae=path['join'](config[_0x366e('0x6c')],_0x366e('0x4f'),_0x5a5cad);logger[_0x366e('0x66')](_0x366e('0x6e'),_0x14ca5f);logger[_0x366e('0x66')](_0x366e('0x6f'),_0xf2a6ae);try{fs['chmodSync'](_0x14ca5f,parseInt('0777',0x8));extract(_0x14ca5f,{'dir':_0xf2a6ae},function(_0x22844a){if(_0x22844a){logger[_0x366e('0x2e')](_0x22844a);handleError(_0x22844a,!![]);};var _0x957e3d=fs['readdirSync'](_0xf2a6ae);if(_0x957e3d[_0x366e('0x3d')]>0x1){removeReferences(_0x14ca5f,_0xf2a6ae);logger['error']('Invalid\x20plugin\x20structure');return _0x16142c(new Error(_0x366e('0x70')));}var _0x45e9e3=fs[_0x366e('0x71')](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0]));if(_0x45e9e3[_0x366e('0x72')]()){removeReferences(_0x14ca5f,_0xf2a6ae);logger[_0x366e('0x2e')](_0x366e('0x70'));return _0x16142c(new Error(_0x366e('0x70')));}if(_0x45e9e3[_0x366e('0x73')]()){var _0x4fff1d=fs['readdirSync'](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0]));if(_0x4fff1d['length']===0x0){removeReferences(_0x14ca5f,_0xf2a6ae);logger[_0x366e('0x2e')](_0x366e('0x70'));return _0x16142c(new Error(_0x366e('0x70')));}var _0x33e0d6=_0x4fff1d[_0x366e('0x74')](function(_0x576c43){return _0x576c43===_0x366e('0x75');});if(!_0x33e0d6){return _0x16142c(new Error(_0x366e('0x76')));}var _0xd9044d=fs[_0x366e('0x77')](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0],_0x366e('0x75')));var _0x5d55b1=JSON[_0x366e('0x78')](_0xd9044d);if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x2f')]){return _0x16142c(new Error(_0x366e('0x7a')));}if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x36')]){return _0x16142c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7b')]){return _0x16142c(new Error(_0x366e('0x7c')));}if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')]){return _0x16142c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5d55b1[_0x366e('0x36')]===_0x366e('0x7e')){if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')]){return _0x16142c(new Error(_0x366e('0x80')));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')]['admin']&&_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){return _0x16142c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5d55b1[_0x366e('0x36')]===_0x366e('0x82')){if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x83')]){return _0x16142c(new Error(_0x366e('0x84')));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')]['scriptPath']){return _0x16142c(new Error(_0x366e('0x85')));}}else{return _0x16142c(new Error(_0x366e('0x86')));}var _0x30dc70=_0x5d55b1[_0x366e('0x2f')];var _0x625afe=_0x5d55b1[_0x366e('0x87')];var _0x56bdbb=_0x5d55b1[_0x366e('0x36')];var _0x20d9c4=_0x5d55b1[_0x366e('0x88')]?_0x5d55b1[_0x366e('0x88')]:_0x366e('0x89');var _0x3b621a=_0x5d55b1[_0x366e('0x8a')]?_0x5d55b1['icon']:_0x366e('0x8b');var _0x370281='';var _0x2d815d='';var _0x1d4a10='';var _0x1a9265='';var _0x3448c5=_0x5d55b1[_0x366e('0x7b')];if(_0x56bdbb===_0x366e('0x7e')){if(_0x366e('0x79')!=typeof _0x5d55b1['parameters'][_0x366e('0x7f')]['admin']){var _0x1e11f1=_0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x1e11f1)){_0x370281=path[_0x366e('0x5b')]('plugins',_0x5a5cad,_0x957e3d[0x0],_0x1e11f1);}else{_0x370281=_0x1e11f1;}}else{logger['info'](_0x366e('0x8e'));}if(_0x366e('0x79')!=typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){var _0x3819c6=_0x5d55b1['parameters'][_0x366e('0x7f')][_0x366e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x3819c6)){_0x2d815d=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x3819c6);}else{_0x2d815d=_0x3819c6;}}else{logger[_0x366e('0x66')](_0x366e('0x90'));}}else if(_0x56bdbb===_0x366e('0x82')){_0x1d4a10=_0x5d55b1[_0x366e('0x7d')]['scriptName'];_0x1a9265=_0x5d55b1['parameters'][_0x366e('0x91')];if(_0x366e('0x79')!=typeof _0x5d55b1[_0x366e('0x7d')]['views']){if(_0x366e('0x79')!=typeof _0x5d55b1['parameters'][_0x366e('0x7f')][_0x366e('0x8c')]){var _0x1e11f1=_0x5d55b1[_0x366e('0x7d')]['views'][_0x366e('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1e11f1)){_0x370281=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x1e11f1);}else{_0x370281=_0x1e11f1;}}if('undefined'!=typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){var _0x3819c6=_0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x3819c6)){_0x2d815d=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x3819c6);}else{_0x2d815d=_0x3819c6;}}}}var _0x5695fb={'name':_0x30dc70,'description':_0x625afe,'path':path[_0x366e('0x5b')](_0x5a5cad,_0x957e3d[0x0]),'type':_0x56bdbb,'sidebar':_0x20d9c4,'icon':_0x3b621a,'adminUrl':_0x370281,'agentUrl':_0x2d815d,'scriptName':_0x1d4a10,'scriptPath':_0x1a9265,'version':_0x3448c5};removeReferences(_0x14ca5f,null);return db['Plugin'][_0x366e('0x92')](_0x5695fb)[_0x366e('0x2a')](function(_0x376ac1){var _0x51eb62={'role':_0x428fd3['body'][_0x366e('0x93')],'userProfileId':_0x428fd3[_0x366e('0x94')][_0x366e('0x95')]};if(!_0x51eb62)throw new Error(_0x366e('0x96'));if(_0x51eb62['role']===_0x366e('0x97')){var _0x1dc1dd=_0x376ac1[_0x366e('0x2c')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x366e('0x98'),'userProfileId':_0x51eb62[_0x366e('0x95')]},'raw':!![]})['then'](function(_0x221ad8){if(_0x221ad8&&_0x221ad8['autoAssociation']===0x0){return db[_0x366e('0x2d')][_0x366e('0x92')]({'name':_0x1dc1dd[_0x366e('0x2f')],'resourceId':_0x1dc1dd['id'],'type':_0x221ad8[_0x366e('0x2f')],'sectionId':_0x221ad8['id']},{})['then'](function(){return _0x376ac1;});}else{return _0x376ac1;}})[_0x366e('0x68')](function(_0x5e9954){logger[_0x366e('0x2e')](_0x366e('0x99'),_0x5e9954);throw _0x5e9954;});}return _0x376ac1;})[_0x366e('0x2a')](respondWithResult(_0x4a412d,null))[_0x366e('0x68')](handleError(_0x4a412d,null));}});}catch(_0x2751aa){_0x4a412d[_0x366e('0x22')](0x1f4)[_0x366e('0x30')](_0x2751aa);}};function removeReferences(_0x487b85,_0x4e9ec5){try{if(_0x487b85){fs[_0x366e('0x64')](_0x487b85);logger[_0x366e('0x66')](_0x366e('0x9a'));}if(_0x4e9ec5){rimraf(_0x4e9ec5,function(){});logger['info'](_0x366e('0x9b'));}}catch(_0x79718b){logger['error'](_0x79718b);}}exports[_0x366e('0x9c')]=function(_0x55829a,_0x3438e0,_0xf1cbb8){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x55829a[_0x366e('0x4c')]['id']}})[_0x366e('0x2a')](handleEntityNotFound(_0x3438e0,null))['then'](saveUpdates(_0x55829a[_0x366e('0x94')],null))['then'](respondWithResult(_0x3438e0,null))[_0x366e('0x68')](handleError(_0x3438e0,null));};exports[_0x366e('0x9d')]=function(_0x1fd980,_0x759f0f,_0x53f01a){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x1fd980[_0x366e('0x4c')]['id']}})[_0x366e('0x2a')](function(_0x2b06a6){if(_0x2b06a6){return _0x2b06a6['destroy']();}})[_0x366e('0x2a')](function(_0x5e23f7){rimraf(path[_0x366e('0x5b')](config[_0x366e('0x6c')],_0x366e('0x4f'),path['dirname'](_0x5e23f7[_0x366e('0x9')])),function(){});return _0x5e23f7;})[_0x366e('0x2a')](handleEntityNotFound(_0x759f0f,null))[_0x366e('0x2a')](respondWithStatusCode(_0x759f0f,null))[_0x366e('0x68')](handleError(_0x759f0f,null));};exports[_0x366e('0x9e')]=function(_0x3af03b,_0x32fcd7,_0x165787){return BPromise[_0x366e('0x9f')]()[_0x366e('0x2a')](function(){if(!_0x3af03b[_0x366e('0x37')][_0x366e('0x9')]){throw new Error(_0x366e('0xa0'));}if(!_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xec725e=_0x3af03b[_0x366e('0x37')][_0x366e('0xa2')]?_0x3af03b[_0x366e('0x37')]['hostname']+':'+_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')]:_0x366e('0xa3')+_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')];var _0x5113a3=_0x3af03b[_0x366e('0x37')]['json']?_0x3af03b[_0x366e('0x37')][_0x366e('0x27')]:!![];var _0x35fcbb=_0x3af03b[_0x366e('0x37')][_0x366e('0xa4')]?_0x3af03b['query'][_0x366e('0xa4')]:null;var _0x66ba12={'method':_0x3af03b[_0x366e('0xa5')],'uri':util[_0x366e('0x50')](_0x366e('0xa6'),_0xec725e,_0x3af03b[_0x366e('0x37')][_0x366e('0x9')]),'json':_0x5113a3,'resolveWithFullResponse':!![],'encoding':_0x35fcbb,'qs':_0x3af03b[_0x366e('0x37')]};if(_0x3af03b[_0x366e('0xa7')]){_0x66ba12['headers']=_0x3af03b[_0x366e('0xa7')];if(_0x66ba12['headers'][_0x366e('0xa8')]){delete _0x66ba12[_0x366e('0xa7')][_0x366e('0xa8')];}}if(_0x66ba12['headers'][_0x366e('0xa9')]){delete _0x66ba12['headers'][_0x366e('0xa9')];}return rp(_0x66ba12);})[_0x366e('0x2a')](function(_0x25cdbb){if(_0x25cdbb){_0x32fcd7[_0x366e('0xaa')](_0x25cdbb[_0x366e('0xa7')]);logger['info'](_0x25cdbb[_0x366e('0x94')]);if(_[_0x366e('0xab')](_0x3af03b[_0x366e('0x37')][_0x366e('0x9')],'download')&&_0x25cdbb[_0x366e('0xac')]==0x1f4){return _0x32fcd7[_0x366e('0x21')](_0x25cdbb[_0x366e('0xac')]);}else{return _0x32fcd7[_0x366e('0x22')](_0x25cdbb[_0x366e('0xac')])['send'](_0x25cdbb[_0x366e('0x94')]);}}else{return _0x32fcd7[_0x366e('0x21')](0xc8);}})[_0x366e('0x68')](handleError(_0x32fcd7,null));};exports[_0x366e('0xad')]=function(_0x21ad2e,_0x5a88d5,_0x25d7a7){return BPromise[_0x366e('0x9f')]()[_0x366e('0x2a')](function(){if(!_0x21ad2e[_0x366e('0x37')]['path']){throw new Error(_0x366e('0xa0'));}if(!_0x21ad2e[_0x366e('0x37')][_0x366e('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x249f86=_0x21ad2e[_0x366e('0x37')][_0x366e('0xa2')]?_0x21ad2e[_0x366e('0x37')]['hostname']+':'+_0x21ad2e[_0x366e('0x37')][_0x366e('0xa1')]:_0x366e('0xa3')+_0x21ad2e[_0x366e('0x37')]['port'];var _0x3c5ab0=_0x21ad2e[_0x366e('0x37')][_0x366e('0x27')]?_0x21ad2e['query']['json']:!![];var _0x494206=_0x21ad2e['query'][_0x366e('0xa4')]?_0x21ad2e[_0x366e('0x37')][_0x366e('0xa4')]:null;var _0x1e93ad={'method':_0x21ad2e[_0x366e('0xa5')],'uri':util[_0x366e('0x50')]('%s%s',_0x249f86,_0x21ad2e[_0x366e('0x37')][_0x366e('0x9')]),'json':_0x3c5ab0,'resolveWithFullResponse':!![],'encoding':_0x494206,'body':_0x21ad2e[_0x366e('0x94')]};if(_0x21ad2e['headers']){_0x1e93ad[_0x366e('0xa7')]=_0x21ad2e['headers'];if(_0x1e93ad[_0x366e('0xa7')][_0x366e('0xa8')]){delete _0x1e93ad[_0x366e('0xa7')][_0x366e('0xa8')];}}if(_0x1e93ad[_0x366e('0xa7')][_0x366e('0xa9')]){delete _0x1e93ad[_0x366e('0xa7')][_0x366e('0xa9')];}return rp(_0x1e93ad);})['then'](function(_0x18b815){if(_0x18b815){_0x5a88d5[_0x366e('0xaa')](_0x18b815[_0x366e('0xa7')]);logger['info'](_0x18b815['body']);return _0x5a88d5[_0x366e('0x22')](_0x18b815[_0x366e('0xac')])['send'](_0x18b815[_0x366e('0x94')]);}else{return _0x5a88d5[_0x366e('0x21')](0xc8);}})[_0x366e('0x68')](handleError(_0x5a88d5,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 15ec5eb..572f0c6 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 _0xf2e3=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','setMaxListeners','save','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf2e3[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var Plugin=require('../../mysqldb')['db'][_0x3f2e('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x3f2e('0x2')](0x0);var events={'afterCreate':_0x3f2e('0x3'),'afterUpdate':_0x3f2e('0x4'),'afterDestroy':_0x3f2e('0x5')};function emitEvent(_0x1634cd){return function(_0x3938e2,_0xabcf5c,_0x216b26){PluginEvents['emit'](_0x1634cd+':'+_0x3938e2['id'],_0x3938e2);PluginEvents[_0x3f2e('0x6')](_0x1634cd,_0x3938e2);_0x216b26(null);};}for(var e in events){if(events[_0x3f2e('0x7')](e)){var event=events[e];Plugin[_0x3f2e('0x8')](e,emitEvent(event));}}module[_0x3f2e('0x9')]=PluginEvents; \ No newline at end of file +var _0x7b84=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x7b84,0x17c));var _0x47b8=function(_0x527b0b,_0xc537ce){_0x527b0b=_0x527b0b-0x0;var _0x413aed=_0x7b84[_0x527b0b];return _0x413aed;};'use strict';var EventEmitter=require(_0x47b8('0x0'));var Plugin=require(_0x47b8('0x1'))['db'][_0x47b8('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x47b8('0x3')](0x0);var events={'afterCreate':_0x47b8('0x4'),'afterUpdate':_0x47b8('0x5'),'afterDestroy':_0x47b8('0x6')};function emitEvent(_0x5c7cda){return function(_0x445a5f,_0x1fa41a,_0x2279ea){PluginEvents[_0x47b8('0x7')](_0x5c7cda+':'+_0x445a5f['id'],_0x445a5f);PluginEvents[_0x47b8('0x7')](_0x5c7cda,_0x445a5f);_0x2279ea(null);};}for(var e in events){if(events[_0x47b8('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47b8('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9b2889b..d861ae9 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 _0x33c5=['Plugin','plugins','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x33c5,0xe6));var _0x533c=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0x33c5[_0x493cea];return _0x1c32ba;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c12=['./plugin.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa7215f,_0x3db0d2){var _0x29df74=function(_0x14fc00){while(--_0x14fc00){_0xa7215f['push'](_0xa7215f['shift']());}};_0x29df74(++_0x3db0d2);}(_0x5c12,0x188));var _0x25c1=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x5c12[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 8445c63..f8b9ff6 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 _0x46bf=['client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x46bf,0x1a2));var _0xf46b=function(_0x38ae4f,_0x1d3180){_0x38ae4f=_0x38ae4f-0x0;var _0x1e92db=_0x46bf[_0x38ae4f];return _0x1e92db;};'use strict';var _=require(_0xf46b('0x0'));var util=require(_0xf46b('0x1'));var moment=require(_0xf46b('0x2'));var BPromise=require(_0xf46b('0x3'));var rs=require(_0xf46b('0x4'));var fs=require('fs');var Redis=require(_0xf46b('0x5'));var db=require(_0xf46b('0x6'))['db'];var utils=require(_0xf46b('0x7'));var logger=require(_0xf46b('0x8'))('rpc');var config=require(_0xf46b('0x9'));var jayson=require(_0xf46b('0xa'));var client=jayson[_0xf46b('0xb')][_0xf46b('0xc')]({'port':0x232a});config[_0xf46b('0xd')]=_['defaults'](config[_0xf46b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf46b('0xe'))(new Redis(config[_0xf46b('0xd')]));require(_0xf46b('0xf'))[_0xf46b('0x10')](socket);function respondWithRpcPromise(_0x31ff33,_0x3af2e4,_0x2ae89c){return new BPromise(function(_0x14525e,_0x5baee1){return client[_0xf46b('0x11')](_0x31ff33,_0x2ae89c)[_0xf46b('0x12')](function(_0x58e645){logger[_0xf46b('0x13')]('Plugin,\x20%s,\x20%s',_0x3af2e4,'request\x20sent');logger[_0xf46b('0x14')](_0xf46b('0x15'),_0x3af2e4,_0xf46b('0x16'),JSON[_0xf46b('0x17')](_0x58e645));if(_0x58e645[_0xf46b('0x18')]){if(_0x58e645[_0xf46b('0x18')][_0xf46b('0x19')]===0x1f4){logger['error'](_0xf46b('0x1a'),_0x3af2e4,_0x58e645['error'][_0xf46b('0x1b')]);return _0x5baee1(_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);}logger[_0xf46b('0x18')](_0xf46b('0x1a'),_0x3af2e4,_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);return _0x14525e(_0x58e645[_0xf46b('0x18')][_0xf46b('0x1b')]);}else{logger[_0xf46b('0x13')]('Plugin,\x20%s,\x20%s',_0x3af2e4,_0xf46b('0x16'));_0x14525e(_0x58e645[_0xf46b('0x1c')][_0xf46b('0x1b')]);}})['catch'](function(_0x2c2272){logger[_0xf46b('0x18')](_0xf46b('0x1a'),_0x3af2e4,_0x2c2272);_0x5baee1(_0x2c2272);});});}exports[_0xf46b('0x1d')]=function(_0x3f972e){var _0x1f0916=this;return new Promise(function(_0x5e2377,_0x1283fc){return db['Plugin'][_0xf46b('0x1e')](_0x3f972e['body'],{'raw':_0x3f972e[_0xf46b('0x1f')]?_0x3f972e['options'][_0xf46b('0x20')]===undefined?!![]:![]:!![]})[_0xf46b('0x12')](function(_0x3dc458){logger[_0xf46b('0x13')](_0xf46b('0x1d'),_0x3f972e);logger[_0xf46b('0x14')](_0xf46b('0x1d'),_0x3f972e,JSON[_0xf46b('0x17')](_0x3dc458));_0x5e2377(_0x3dc458);})['catch'](function(_0x3393b2){logger[_0xf46b('0x18')](_0xf46b('0x1d'),_0x3393b2[_0xf46b('0x1b')],_0x3f972e);_0x1283fc(_0x1f0916[_0xf46b('0x18')](0x1f4,_0x3393b2[_0xf46b('0x1b')]));});});}; \ No newline at end of file +var _0x248f=['body','options','info','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','CreatePlugin','Plugin','create'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x248f,0xb2));var _0xf248=function(_0x1fe4f2,_0xba736b){_0x1fe4f2=_0x1fe4f2-0x0;var _0x5d9333=_0x248f[_0x1fe4f2];return _0x5d9333;};'use strict';var _=require(_0xf248('0x0'));var util=require('util');var moment=require(_0xf248('0x1'));var BPromise=require(_0xf248('0x2'));var rs=require(_0xf248('0x3'));var fs=require('fs');var Redis=require(_0xf248('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf248('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf248('0x6'));var jayson=require(_0xf248('0x7'));var client=jayson[_0xf248('0x8')]['http']({'port':0x232a});config[_0xf248('0x9')]=_[_0xf248('0xa')](config[_0xf248('0x9')],{'host':_0xf248('0xb'),'port':0x18eb});var socket=require(_0xf248('0xc'))(new Redis(config[_0xf248('0x9')]));require(_0xf248('0xd'))[_0xf248('0xe')](socket);function respondWithRpcPromise(_0x5b78ab,_0x1b29a4,_0x12480e){return new BPromise(function(_0x4b4b71,_0x174fd1){return client['request'](_0x5b78ab,_0x12480e)[_0xf248('0xf')](function(_0x38a1c5){logger['info'](_0xf248('0x10'),_0x1b29a4,'request\x20sent');logger['debug'](_0xf248('0x11'),_0x1b29a4,'request\x20sent',JSON['stringify'](_0x38a1c5));if(_0x38a1c5['error']){if(_0x38a1c5['error']['code']===0x1f4){logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x38a1c5[_0xf248('0x12')]['message']);return _0x174fd1(_0x38a1c5['error'][_0xf248('0x13')]);}logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x38a1c5[_0xf248('0x12')]['message']);return _0x4b4b71(_0x38a1c5[_0xf248('0x12')][_0xf248('0x13')]);}else{logger['info'](_0xf248('0x10'),_0x1b29a4,_0xf248('0x14'));_0x4b4b71(_0x38a1c5['result'][_0xf248('0x13')]);}})[_0xf248('0x15')](function(_0x31918e){logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x31918e);_0x174fd1(_0x31918e);});});}exports[_0xf248('0x16')]=function(_0x5e1371){var _0x2df2fc=this;return new Promise(function(_0x2b4a24,_0x2f7983){return db[_0xf248('0x17')][_0xf248('0x18')](_0x5e1371[_0xf248('0x19')],{'raw':_0x5e1371[_0xf248('0x1a')]?_0x5e1371[_0xf248('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf248('0xf')](function(_0x4f0ce9){logger[_0xf248('0x1b')](_0xf248('0x16'),_0x5e1371);logger[_0xf248('0x1c')]('CreatePlugin',_0x5e1371,JSON['stringify'](_0x4f0ce9));_0x2b4a24(_0x4f0ce9);})[_0xf248('0x15')](function(_0x49a23d){logger[_0xf248('0x12')](_0xf248('0x16'),_0x49a23d['message'],_0x5e1371);_0x2f7983(_0x2df2fc[_0xf248('0x12')](0x1f4,_0x49a23d[_0xf248('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f3db648..1980a4b 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 _0x1a40=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x1a40,0xb7));var _0x01a4=function(_0x8d2363,_0x5e83a3){_0x8d2363=_0x8d2363-0x0;var _0x2f2a1b=_0x1a40[_0x8d2363];return _0x2f2a1b;};'use strict';var PluginEvents=require(_0x01a4('0x0'));var events=[_0x01a4('0x1'),_0x01a4('0x2'),_0x01a4('0x3')];function createListener(_0x39ac21,_0x39f40a){return function(_0x32ecae){_0x39f40a[_0x01a4('0x4')](_0x39ac21,_0x32ecae);};}function removeListener(_0x3c096a,_0x4762fc){return function(){PluginEvents[_0x01a4('0x5')](_0x3c096a,_0x4762fc);};}exports[_0x01a4('0x6')]=function(_0x2e6cde){for(var _0xce027e=0x0,_0x14b7bc=events[_0x01a4('0x7')];_0xce027e<_0x14b7bc;_0xce027e++){var _0x167c0a=events[_0xce027e];var _0x5d4544=createListener(_0x01a4('0x8')+_0x167c0a,_0x2e6cde);PluginEvents['on'](_0x167c0a,_0x5d4544);}}; \ No newline at end of file +var _0x6c1f=['register','plugin:','save','remove','update','emit'];(function(_0x2b863a,_0x3b0871){var _0x2e2783=function(_0x188866){while(--_0x188866){_0x2b863a['push'](_0x2b863a['shift']());}};_0x2e2783(++_0x3b0871);}(_0x6c1f,0x158));var _0xf6c1=function(_0x22d7ae,_0x588bec){_0x22d7ae=_0x22d7ae-0x0;var _0x4155da=_0x6c1f[_0x22d7ae];return _0x4155da;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf6c1('0x0'),_0xf6c1('0x1'),_0xf6c1('0x2')];function createListener(_0x465107,_0x118ec3){return function(_0x30e6e4){_0x118ec3[_0xf6c1('0x3')](_0x465107,_0x30e6e4);};}function removeListener(_0x348e05,_0x2fd698){return function(){PluginEvents['removeListener'](_0x348e05,_0x2fd698);};}exports[_0xf6c1('0x4')]=function(_0x2819ba){for(var _0x548416=0x0,_0x5a29bc=events['length'];_0x548416<_0x5a29bc;_0x548416++){var _0x2f5f21=events[_0x548416];var _0x5cd5de=createListener(_0xf6c1('0x5')+_0x2f5f21,_0x2819ba);PluginEvents['on'](_0x2f5f21,_0x5cd5de);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 7015890..8e876b2 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 _0xe1e2=['show','post','isAuthenticated','create','put','delete','exports','express','Router','get','index','/:id'];(function(_0x2d70e5,_0x297b6a){var _0x118960=function(_0x2d0ae2){while(--_0x2d0ae2){_0x2d70e5['push'](_0x2d70e5['shift']());}};_0x118960(++_0x297b6a);}(_0xe1e2,0x187));var _0x2e1e=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0xe1e2[_0x937379];return _0x465709;};'use strict';var express=require(_0x2e1e('0x0'));var router=express[_0x2e1e('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x2e1e('0x2')]('/',auth['isAuthenticated'](),controller[_0x2e1e('0x3')]);router[_0x2e1e('0x2')](_0x2e1e('0x4'),auth['isAuthenticated'](),controller[_0x2e1e('0x5')]);router[_0x2e1e('0x6')]('/',auth[_0x2e1e('0x7')](),controller[_0x2e1e('0x8')]);router[_0x2e1e('0x9')]('/:id',auth[_0x2e1e('0x7')](),controller['update']);router[_0x2e1e('0xa')]('/:id',auth[_0x2e1e('0x7')](),controller['destroy']);module[_0x2e1e('0xb')]=router; \ No newline at end of file +var _0xb037=['index','/:id','isAuthenticated','show','update','delete','destroy','exports','express','Router','./pm2.controller','get'];(function(_0x56f80e,_0xc1e088){var _0xbff200=function(_0x4145fa){while(--_0x4145fa){_0x56f80e['push'](_0x56f80e['shift']());}};_0xbff200(++_0xc1e088);}(_0xb037,0x1c4));var _0x7b03=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xb037[_0x257642];return _0x3d813b;};'use strict';var express=require(_0x7b03('0x0'));var router=express[_0x7b03('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7b03('0x2'));router[_0x7b03('0x3')]('/',auth['isAuthenticated'](),controller[_0x7b03('0x4')]);router['get'](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0x7')]);router['post']('/',auth[_0x7b03('0x6')](),controller['create']);router['put'](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0x8')]);router[_0x7b03('0x9')](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0xa')]);module[_0x7b03('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index b63ab0b..841458b 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 _0xc041=['motion2','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','json','error','name','send','npm\x20install','info','index','then'];(function(_0x49d0ae,_0x3bebf3){var _0x4d6723=function(_0x2824a1){while(--_0x2824a1){_0x49d0ae['push'](_0x49d0ae['shift']());}};_0x4d6723(++_0x3bebf3);}(_0xc041,0x9b));var _0x1c04=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0xc041[_0x245c4f];return _0x3157a1;};'use strict';var _=require('lodash');var pm2=require(_0x1c04('0x0'));var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var path=require(_0x1c04('0x3'));var exec=require('child_process')[_0x1c04('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5c6ce6,_0x2e07e8){return function(_0x5bb1d9){if(!_0x5bb1d9){_0x5c6ce6[_0x1c04('0x5')](0x194);;}return _0x5bb1d9;};}function respondWithResult(_0x23c6e7,_0x2f15dd){_0x2f15dd=_0x2f15dd||0xc8;return function(_0x40c5f4){if(_0x40c5f4){return _0x23c6e7[_0x1c04('0x6')](_0x2f15dd)[_0x1c04('0x7')](_0x40c5f4);}return null;};}function handleError(_0x453238,_0xb73257){_0xb73257=_0xb73257||0x1f4;return function(_0x575ddb){logger[_0x1c04('0x8')](_0x575ddb['stack']);if(_0x575ddb[_0x1c04('0x9')]){delete _0x575ddb[_0x1c04('0x9')];}_0x453238[_0x1c04('0x6')](_0xb73257)[_0x1c04('0xa')](_0x575ddb);};}function execChildProcess(){return new BPromise(function(_0x53e636,_0x3f9a9e){exec(_0x1c04('0xb'),function(_0xefe7f2,_0x3b05c7,_0x4cbb4a){logger[_0x1c04('0xc')](_0x3b05c7);logger[_0x1c04('0xc')](_0x4cbb4a);if(_0xefe7f2){logger[_0x1c04('0x8')](_0xefe7f2);return _0x3f9a9e(_0xefe7f2);}return _0x53e636(_0x3b05c7);});});}exports[_0x1c04('0xd')]=function(_0x274135,_0x32f826){return pm2['list']()[_0x1c04('0xe')](function(_0x142b3d){if(_0x142b3d){var _0x3be972=_['reject'](_0x142b3d,function(_0x18827f){return _0x18827f[_0x1c04('0x9')]==='express'||_0x18827f[_0x1c04('0x9')]===_0x1c04('0xf');});return{'rows':_0x3be972,'count':_0x3be972['length']};}return null;})['then'](respondWithResult(_0x32f826,null))[_0x1c04('0x10')](handleError(_0x32f826,null));};exports[_0x1c04('0x11')]=function(_0x5b01e1,_0x43fc4f){return pm2[_0x1c04('0x12')](_0x5b01e1[_0x1c04('0x13')]['id'])[_0x1c04('0xe')](respondWithResult(_0x43fc4f,null))[_0x1c04('0xe')](handleEntityNotFound(_0x43fc4f,null))[_0x1c04('0x10')](handleError(_0x43fc4f,null));};exports[_0x1c04('0x14')]=function(_0x1f815d,_0x4361b8){if(_0x1f815d[_0x1c04('0x15')][_0x1c04('0x9')]&&_0x1f815d[_0x1c04('0x15')][_0x1c04('0x16')]){var _0x4f524d=path['join'](__dirname,_0x1c04('0x17'),_0x1f815d['body'][_0x1c04('0x16')]);var _0x5384cf=process[_0x1c04('0x18')]();process[_0x1c04('0x19')](path[_0x1c04('0x1a')](_0x4f524d));return execChildProcess()['then'](function(_0x2ac3be){process[_0x1c04('0x19')](_0x5384cf);return pm2['start']({'name':_0x1f815d[_0x1c04('0x15')][_0x1c04('0x9')],'script':_0x4f524d});})[_0x1c04('0xe')](function(_0x491369){pm2[_0x1c04('0x1b')]();return _0x491369[0x0];})[_0x1c04('0xe')](respondWithResult(_0x4361b8,0xc9))[_0x1c04('0x10')](handleError(_0x4361b8,null));}else{return _0x4361b8[_0x1c04('0x6')](0x1f4)[_0x1c04('0xa')]({'message':_0x1c04('0x1c')});}};exports['update']=function(_0x11676d,_0x54fa5e){if(_0x11676d[_0x1c04('0x15')]['id']){delete _0x11676d['body']['id'];}var _0x5bcddb={'online':_0x1c04('0x1d'),'stopped':'stop'};if(_0x5bcddb[_0x1c04('0x1e')](_0x11676d[_0x1c04('0x15')][_0x1c04('0x6')])){return pm2[_0x5bcddb[_0x11676d[_0x1c04('0x15')][_0x1c04('0x6')]]](_0x11676d[_0x1c04('0x13')]['id'])['then'](respondWithResult(_0x54fa5e,0xc8))[_0x1c04('0x10')](handleError(_0x54fa5e,null));}else{return _0x54fa5e[_0x1c04('0x6')](0x1f4)[_0x1c04('0xa')]({'message':_0x1c04('0x1f')});}};exports[_0x1c04('0x20')]=function(_0x727617,_0x3ebbbc){if(_0x727617[_0x1c04('0x15')]['id']){delete _0x727617['body']['id'];}if(_0x727617[_0x1c04('0x13')]['id']){return pm2['delete'](_0x727617[_0x1c04('0x13')]['id'])[_0x1c04('0xe')](function(_0x204b30){pm2[_0x1c04('0x1b')]();return _0x204b30[0x0];})['then'](respondWithResult(_0x3ebbbc,null))[_0x1c04('0x10')](handleError(_0x3ebbbc,null));}else{return _0x3ebbbc[_0x1c04('0x6')](0x1f4)['send']({'message':_0x1c04('0x21')});}}; \ No newline at end of file +var _0x417f=['then','express','motion2','length','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','catch','Unknown\x20id','lodash','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x417f,0x6d));var _0xf417=function(_0x5baa2d,_0x53c700){_0x5baa2d=_0x5baa2d-0x0;var _0x4c67e3=_0x417f[_0x5baa2d];return _0x4c67e3;};'use strict';var _=require(_0xf417('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xf417('0x1'))(_0xf417('0x2'));var path=require(_0xf417('0x3'));var exec=require('child_process')[_0xf417('0x4')];var BPromise=require(_0xf417('0x5'));function handleEntityNotFound(_0x55d32a,_0x347687){return function(_0x333f9b){if(!_0x333f9b){_0x55d32a[_0xf417('0x6')](0x194);;}return _0x333f9b;};}function respondWithResult(_0x5481ed,_0x2b4834){_0x2b4834=_0x2b4834||0xc8;return function(_0x1cb83b){if(_0x1cb83b){return _0x5481ed[_0xf417('0x7')](_0x2b4834)[_0xf417('0x8')](_0x1cb83b);}return null;};}function handleError(_0xfe02aa,_0x5e72e3){_0x5e72e3=_0x5e72e3||0x1f4;return function(_0xfa1537){logger[_0xf417('0x9')](_0xfa1537[_0xf417('0xa')]);if(_0xfa1537[_0xf417('0xb')]){delete _0xfa1537['name'];}_0xfe02aa[_0xf417('0x7')](_0x5e72e3)[_0xf417('0xc')](_0xfa1537);};}function execChildProcess(){return new BPromise(function(_0x27e478,_0x418d0f){exec(_0xf417('0xd'),function(_0x3e2313,_0x4763dd,_0x54f918){logger[_0xf417('0xe')](_0x4763dd);logger[_0xf417('0xe')](_0x54f918);if(_0x3e2313){logger[_0xf417('0x9')](_0x3e2313);return _0x418d0f(_0x3e2313);}return _0x27e478(_0x4763dd);});});}exports[_0xf417('0xf')]=function(_0x78d6da,_0x71c538){return pm2[_0xf417('0x10')]()[_0xf417('0x11')](function(_0x4606b7){if(_0x4606b7){var _0x1dedda=_['reject'](_0x4606b7,function(_0x5e47f3){return _0x5e47f3[_0xf417('0xb')]===_0xf417('0x12')||_0x5e47f3[_0xf417('0xb')]===_0xf417('0x13');});return{'rows':_0x1dedda,'count':_0x1dedda[_0xf417('0x14')]};}return null;})[_0xf417('0x11')](respondWithResult(_0x71c538,null))['catch'](handleError(_0x71c538,null));};exports[_0xf417('0x15')]=function(_0x113272,_0x2e6fc7){return pm2[_0xf417('0x16')](_0x113272[_0xf417('0x17')]['id'])[_0xf417('0x11')](respondWithResult(_0x2e6fc7,null))[_0xf417('0x11')](handleEntityNotFound(_0x2e6fc7,null))['catch'](handleError(_0x2e6fc7,null));};exports[_0xf417('0x18')]=function(_0x20c857,_0x437c9a){if(_0x20c857[_0xf417('0x19')][_0xf417('0xb')]&&_0x20c857[_0xf417('0x19')][_0xf417('0x1a')]){var _0x152234=path['join'](__dirname,_0xf417('0x1b'),_0x20c857[_0xf417('0x19')][_0xf417('0x1a')]);var _0x2554fb=process[_0xf417('0x1c')]();process[_0xf417('0x1d')](path[_0xf417('0x1e')](_0x152234));return execChildProcess()[_0xf417('0x11')](function(_0x4a4cc0){process[_0xf417('0x1d')](_0x2554fb);return pm2[_0xf417('0x1f')]({'name':_0x20c857[_0xf417('0x19')]['name'],'script':_0x152234});})[_0xf417('0x11')](function(_0x3a5ac4){pm2[_0xf417('0x20')]();return _0x3a5ac4[0x0];})['then'](respondWithResult(_0x437c9a,0xc9))['catch'](handleError(_0x437c9a,null));}else{return _0x437c9a['status'](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x21')});}};exports[_0xf417('0x22')]=function(_0x474412,_0x5c9c4f){if(_0x474412['body']['id']){delete _0x474412[_0xf417('0x19')]['id'];}var _0x595a81={'online':_0xf417('0x23'),'stopped':_0xf417('0x24')};if(_0x595a81[_0xf417('0x25')](_0x474412['body']['status'])){return pm2[_0x595a81[_0x474412['body'][_0xf417('0x7')]]](_0x474412[_0xf417('0x17')]['id'])[_0xf417('0x11')](respondWithResult(_0x5c9c4f,0xc8))['catch'](handleError(_0x5c9c4f,null));}else{return _0x5c9c4f[_0xf417('0x7')](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x26')});}};exports['destroy']=function(_0x33de56,_0x562e78){if(_0x33de56[_0xf417('0x19')]['id']){delete _0x33de56[_0xf417('0x19')]['id'];}if(_0x33de56[_0xf417('0x17')]['id']){return pm2[_0xf417('0x27')](_0x33de56[_0xf417('0x17')]['id'])[_0xf417('0x11')](function(_0x408e9f){pm2[_0xf417('0x20')]();return _0x408e9f[0x0];})[_0xf417('0x11')](respondWithResult(_0x562e78,null))[_0xf417('0x28')](handleError(_0x562e78,null));}else{return _0x562e78['status'](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x29')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 28062f4..b3c3ec5 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 _0xcef4=['multer','path','express','../../components/interaction/service','../../config/environment'];(function(_0x21308a,_0x16b4a4){var _0x390f9a=function(_0x1a58ba){while(--_0x1a58ba){_0x21308a['push'](_0x21308a['shift']());}};_0x390f9a(++_0x16b4a4);}(_0xcef4,0x7d));var _0x4cef=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0xcef4[_0x2afb44];return _0x15ccc2;};'use strict';var multer=require(_0x4cef('0x0'));var util=require('util');var path=require(_0x4cef('0x1'));var timeout=require('connect-timeout');var express=require(_0x4cef('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4cef('0x3'));var config=require(_0x4cef('0x4'));module['exports']=router; \ No newline at end of file +var _0xd75e=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','express'];(function(_0x757f83,_0x5b3ce4){var _0x2416a3=function(_0x39e4ee){while(--_0x39e4ee){_0x757f83['push'](_0x757f83['shift']());}};_0x2416a3(++_0x5b3ce4);}(_0xd75e,0x89));var _0xed75=function(_0xc8d73b,_0x533590){_0xc8d73b=_0xc8d73b-0x0;var _0x466f09=_0xd75e[_0xc8d73b];return _0x466f09;};'use strict';var multer=require(_0xed75('0x0'));var util=require(_0xed75('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed75('0x2'));var router=express[_0xed75('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xed75('0x4'));var config=require(_0xed75('0x5'));module[_0xed75('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 253733d..9695306 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 _0x29e8=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2ef004,_0x22b0e4){var _0x55728c=function(_0x2add31){while(--_0x2add31){_0x2ef004['push'](_0x2ef004['shift']());}};_0x55728c(++_0x22b0e4);}(_0x29e8,0xdf));var _0x829e=function(_0x556631,_0x22a74c){_0x556631=_0x556631-0x0;var _0x3e10c6=_0x29e8[_0x556631];return _0x3e10c6;};'use strict';var Sequelize=require(_0x829e('0x0'));module[_0x829e('0x1')]={'state':{'type':Sequelize[_0x829e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x829e('0x3')]},'scheduledat':{'type':Sequelize[_0x829e('0x4')]},'uniqueid':{'type':Sequelize[_0x829e('0x3')]},'starttime':{'type':Sequelize[_0x829e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x829e('0x3')]},'campaigntype':{'type':Sequelize[_0x829e('0x3')]},'membername':{'type':Sequelize[_0x829e('0x3')]}}; \ No newline at end of file +var _0x3faf=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x47b472,_0x33e6ba){var _0x1d3567=function(_0x4f23c1){while(--_0x4f23c1){_0x47b472['push'](_0x47b472['shift']());}};_0x1d3567(++_0x33e6ba);}(_0x3faf,0x1e8));var _0xf3fa=function(_0x3fa5f7,_0xfc23ec){_0x3fa5f7=_0x3fa5f7-0x0;var _0x5544bd=_0x3faf[_0x3fa5f7];return _0x5544bd;};'use strict';var Sequelize=require(_0xf3fa('0x0'));module[_0xf3fa('0x1')]={'state':{'type':Sequelize[_0xf3fa('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf3fa('0x3')]},'scheduledat':{'type':Sequelize[_0xf3fa('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf3fa('0x4')]},'responsetime':{'type':Sequelize[_0xf3fa('0x4')]},'ringtime':{'type':Sequelize[_0xf3fa('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf3fa('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 68c5e0e..65006e9 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 _0xa4da=['bluebird','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview','api','moment'];(function(_0x570b67,_0x5d27d3){var _0x2bb6ce=function(_0x2a44b8){while(--_0x2a44b8){_0x570b67['push'](_0x570b67['shift']());}};_0x2bb6ce(++_0x5d27d3);}(_0xa4da,0x1ae));var _0xaa4d=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xa4da[_0x1bb58c];return _0x277586;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaa4d('0x0'));var moment=require(_0xaa4d('0x1'));var BPromise=require(_0xaa4d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa4d('0x3'));var rimraf=require(_0xaa4d('0x4'));var config=require(_0xaa4d('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0xaa4d('0x6')]=function(_0x2a799c,_0x2b1a8c){return _0x2a799c['define'](_0xaa4d('0x7'),attributes,{'tableName':_0xaa4d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b2e=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','moment','bluebird','request-promise'];(function(_0x357ef2,_0x50fff8){var _0x4fb7b9=function(_0x4e6e50){while(--_0x4e6e50){_0x357ef2['push'](_0x357ef2['shift']());}};_0x4fb7b9(++_0x50fff8);}(_0x2b2e,0xba));var _0xe2b2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2b2e[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xe2b2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe2b2('0x1'));var BPromise=require(_0xe2b2('0x2'));var rp=require(_0xe2b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe2b2('0x4'));var attributes=require(_0xe2b2('0x5'));module[_0xe2b2('0x6')]=function(_0x5a3de5,_0x1d6dfb){return _0x5a3de5[_0xe2b2('0x7')](_0xe2b2('0x8'),attributes,{'tableName':_0xe2b2('0x9'),'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 7af03bc..c0075b5 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 _0x66b0=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x42b8ab,_0x4b7771){var _0x5cb9ef=function(_0x591f1c){while(--_0x591f1c){_0x42b8ab['push'](_0x42b8ab['shift']());}};_0x5cb9ef(++_0x4b7771);}(_0x66b0,0x6c));var _0x066b=function(_0x20c8fe,_0x10ecf3){_0x20c8fe=_0x20c8fe-0x0;var _0x3e727f=_0x66b0[_0x20c8fe];return _0x3e727f;};'use strict';var _=require(_0x066b('0x0'));var util=require('util');var moment=require(_0x066b('0x1'));var BPromise=require(_0x066b('0x2'));var rs=require(_0x066b('0x3'));var fs=require('fs');var Redis=require(_0x066b('0x4'));var db=require(_0x066b('0x5'))['db'];var utils=require(_0x066b('0x6'));var logger=require(_0x066b('0x7'))(_0x066b('0x8'));var config=require(_0x066b('0x9'));var jayson=require(_0x066b('0xa'));var client=jayson[_0x066b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514c49,_0x54ae26,_0xa5dbeb){return new BPromise(function(_0x43cb4d,_0x296895){return client[_0x066b('0xc')](_0x514c49,_0xa5dbeb)[_0x066b('0xd')](function(_0x228c44){logger[_0x066b('0xe')](_0x066b('0xf'),_0x54ae26,_0x066b('0x10'));logger[_0x066b('0x11')](_0x066b('0x12'),_0x54ae26,_0x066b('0x10'),JSON[_0x066b('0x13')](_0x228c44));if(_0x228c44['error']){if(_0x228c44[_0x066b('0x14')][_0x066b('0x15')]===0x1f4){logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x228c44[_0x066b('0x14')]['message']);return _0x296895(_0x228c44[_0x066b('0x14')][_0x066b('0x16')]);}logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x228c44['error'][_0x066b('0x16')]);return _0x43cb4d(_0x228c44[_0x066b('0x14')][_0x066b('0x16')]);}else{logger['info'](_0x066b('0xf'),_0x54ae26,_0x066b('0x10'));_0x43cb4d(_0x228c44[_0x066b('0x17')]['message']);}})[_0x066b('0x18')](function(_0x563c57){logger[_0x066b('0x14')](_0x066b('0xf'),_0x54ae26,_0x563c57);_0x296895(_0x563c57);});});}exports[_0x066b('0x19')]=function(_0x43522a){var _0x6440a0=this;return new Promise(function(_0x730155,_0x3f3ced){return db[_0x066b('0x1a')][_0x066b('0x1b')](_0x43522a[_0x066b('0x1c')],{'raw':_0x43522a[_0x066b('0x1d')]?_0x43522a['options'][_0x066b('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5273ed){logger[_0x066b('0xe')](_0x066b('0x19'),_0x43522a);logger[_0x066b('0x11')](_0x066b('0x19'),_0x43522a,JSON[_0x066b('0x13')](_0x5273ed));_0x730155(_0x5273ed);})[_0x066b('0x18')](function(_0x5b4dab){logger[_0x066b('0x14')](_0x066b('0x19'),_0x5b4dab[_0x066b('0x16')],_0x43522a);_0x3f3ced(_0x6440a0[_0x066b('0x14')](0x1f4,_0x5b4dab[_0x066b('0x16')]));});});}; \ No newline at end of file +var _0x93cd=['stringify','error','message','result','catch','ReportAgentPreview','options','raw','CreateReportAgentPreview','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x3b0550,_0x3eede2){var _0xea40ee=function(_0x182c3b){while(--_0x182c3b){_0x3b0550['push'](_0x3b0550['shift']());}};_0xea40ee(++_0x3eede2);}(_0x93cd,0x14f));var _0xd93c=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x93cd[_0x3f0b30];return _0x2748a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd93c('0x0'));var BPromise=require(_0xd93c('0x1'));var rs=require(_0xd93c('0x2'));var fs=require('fs');var Redis=require(_0xd93c('0x3'));var db=require(_0xd93c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd93c('0x5'))(_0xd93c('0x6'));var config=require(_0xd93c('0x7'));var jayson=require(_0xd93c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6a2a,_0x4c301d,_0x46c941){return new BPromise(function(_0x403636,_0x5abaf6){return client[_0xd93c('0x9')](_0x4d6a2a,_0x46c941)[_0xd93c('0xa')](function(_0x21ae33){logger[_0xd93c('0xb')](_0xd93c('0xc'),_0x4c301d,_0xd93c('0xd'));logger['debug'](_0xd93c('0xe'),_0x4c301d,_0xd93c('0xd'),JSON[_0xd93c('0xf')](_0x21ae33));if(_0x21ae33['error']){if(_0x21ae33[_0xd93c('0x10')]['code']===0x1f4){logger[_0xd93c('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c301d,_0x21ae33[_0xd93c('0x10')][_0xd93c('0x11')]);return _0x5abaf6(_0x21ae33['error'][_0xd93c('0x11')]);}logger[_0xd93c('0x10')](_0xd93c('0xc'),_0x4c301d,_0x21ae33[_0xd93c('0x10')]['message']);return _0x403636(_0x21ae33['error']['message']);}else{logger['info'](_0xd93c('0xc'),_0x4c301d,_0xd93c('0xd'));_0x403636(_0x21ae33[_0xd93c('0x12')]['message']);}})[_0xd93c('0x13')](function(_0x5b2096){logger[_0xd93c('0x10')](_0xd93c('0xc'),_0x4c301d,_0x5b2096);_0x5abaf6(_0x5b2096);});});}exports['CreateReportAgentPreview']=function(_0x3fd2a9){var _0x4ae622=this;return new Promise(function(_0x44251a,_0xc25047){return db[_0xd93c('0x14')]['create'](_0x3fd2a9['body'],{'raw':_0x3fd2a9[_0xd93c('0x15')]?_0x3fd2a9[_0xd93c('0x15')][_0xd93c('0x16')]===undefined?!![]:![]:!![]})[_0xd93c('0xa')](function(_0x20d632){logger['info'](_0xd93c('0x17'),_0x3fd2a9);logger[_0xd93c('0x18')](_0xd93c('0x17'),_0x3fd2a9,JSON['stringify'](_0x20d632));_0x44251a(_0x20d632);})['catch'](function(_0x1c0acf){logger['error'](_0xd93c('0x17'),_0x1c0acf[_0xd93c('0x11')],_0x3fd2a9);_0xc25047(_0x4ae622[_0xd93c('0x10')](0x1f4,_0x1c0acf[_0xd93c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8291f9b..7edd0ee 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 _0x80b0=['smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','mail','showMailQueues','queueNotify','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x80b0,0x139));var _0x080b=function(_0x1cfaba,_0x55d5a1){_0x1cfaba=_0x1cfaba-0x0;var _0x3a9e1b=_0x80b0[_0x1cfaba];return _0x3a9e1b;};'use strict';var multer=require(_0x080b('0x0'));var util=require(_0x080b('0x1'));var path=require(_0x080b('0x2'));var express=require(_0x080b('0x3'));var router=express[_0x080b('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x080b('0x5')]('/voice/channels',auth[_0x080b('0x6')](),controller[_0x080b('0x7')]);router[_0x080b('0x5')](_0x080b('0x8'),auth[_0x080b('0x6')](),controller['voiceChannelMixMonitor']);router[_0x080b('0x5')](_0x080b('0x9'),auth[_0x080b('0x6')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x080b('0xa'),auth[_0x080b('0x6')](),controller[_0x080b('0xb')]);router['get']('/chat/queues',auth[_0x080b('0x6')](),controller['chatQueues']);router[_0x080b('0x5')](_0x080b('0xc'),auth[_0x080b('0x6')](),controller[_0x080b('0xd')]);router[_0x080b('0x5')](_0x080b('0xe'),auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0x080b('0xf'),auth[_0x080b('0x6')](),controller[_0x080b('0x10')]);router[_0x080b('0x5')](_0x080b('0x11'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x080b('0x5')](_0x080b('0x12'),auth[_0x080b('0x6')](),controller[_0x080b('0x13')]);router[_0x080b('0x5')](_0x080b('0x14'),auth[_0x080b('0x6')](),controller[_0x080b('0x15')]);router['get'](_0x080b('0x16'),auth[_0x080b('0x6')](),controller[_0x080b('0x17')]);router[_0x080b('0x5')](_0x080b('0x18'),auth[_0x080b('0x6')](),controller[_0x080b('0x19')]);router[_0x080b('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x080b('0x1a')]);router[_0x080b('0x5')](_0x080b('0x1b'),auth[_0x080b('0x6')](),controller[_0x080b('0x1c')]);router[_0x080b('0x5')](_0x080b('0x1d'),auth[_0x080b('0x6')](),controller[_0x080b('0x1e')]);router[_0x080b('0x5')]('/voice/queues/:id',auth[_0x080b('0x6')](),controller['showVoiceQueues']);router[_0x080b('0x5')](_0x080b('0x1f'),auth[_0x080b('0x6')](),controller[_0x080b('0x20')]);router['get']('/outbound/channels',auth[_0x080b('0x6')](),controller[_0x080b('0x21')]);router[_0x080b('0x5')](_0x080b('0x22'),auth[_0x080b('0x6')](),controller[_0x080b('0x23')]);router[_0x080b('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x080b('0x25')]);router['get'](_0x080b('0x26'),auth[_0x080b('0x6')](),controller[_0x080b('0x27')]);router['get'](_0x080b('0x28'),auth[_0x080b('0x6')](),controller[_0x080b('0x29')]);router[_0x080b('0x5')](_0x080b('0x2a'),auth[_0x080b('0x6')](),controller[_0x080b('0x2b')]);router[_0x080b('0x5')](_0x080b('0x2c'),auth[_0x080b('0x6')](),controller[_0x080b('0x2d')]);router[_0x080b('0x5')]('/chat/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x2e')]);router[_0x080b('0x5')](_0x080b('0x2f'),auth[_0x080b('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x080b('0x5')](_0x080b('0x30'),auth['isAuthenticated'](),controller[_0x080b('0x31')]);router[_0x080b('0x5')](_0x080b('0x32'),auth[_0x080b('0x6')](),controller[_0x080b('0x33')]);router['get']('/sms/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x34')]);router[_0x080b('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x080b('0x6')](),controller[_0x080b('0x35')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x080b('0x36')]);router[_0x080b('0x37')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x080b('0x38')));router[_0x080b('0x5')]('/mail/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x39')]);router['post']('/chat/queues/:id/notify',auth[_0x080b('0x6')](),controller[_0x080b('0x3a')]('chat'));router['get']('/chat/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x3b')]);router[_0x080b('0x37')](_0x080b('0x3c'),auth['isAuthenticated'](),controller[_0x080b('0x3a')]('fax'));router[_0x080b('0x5')]('/fax/queues/:id',auth[_0x080b('0x6')](),controller[_0x080b('0x3d')]);router[_0x080b('0x37')](_0x080b('0x3e'),auth[_0x080b('0x6')](),controller[_0x080b('0x3a')](_0x080b('0x3f')));router['get'](_0x080b('0x40'),auth[_0x080b('0x6')](),controller['showOpenchannelQueues']);router[_0x080b('0x37')](_0x080b('0x41'),auth[_0x080b('0x6')](),controller[_0x080b('0x3a')](_0x080b('0x42')));router[_0x080b('0x37')]('/whatsapp/queues/:id/notify',auth[_0x080b('0x6')](),controller[_0x080b('0x3a')]('whatsapp'));router[_0x080b('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x080b('0x43')]);router['get'](_0x080b('0x44'),auth[_0x080b('0x6')](),controller[_0x080b('0x45')]);router[_0x080b('0x37')](_0x080b('0x46'),auth[_0x080b('0x6')](),controller[_0x080b('0x47')]);module[_0x080b('0x48')]=router; \ No newline at end of file +var _0xcfb8=['/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xcfb8,0x192));var _0x8cfb=function(_0x524c72,_0x4f6bd9){_0x524c72=_0x524c72-0x0;var _0x336f36=_0xcfb8[_0x524c72];return _0x336f36;};'use strict';var multer=require(_0x8cfb('0x0'));var util=require(_0x8cfb('0x1'));var path=require(_0x8cfb('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x8cfb('0x3'));router[_0x8cfb('0x4')](_0x8cfb('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x6'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x8')]);router[_0x8cfb('0x4')](_0x8cfb('0x9'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xa')]);router['get'](_0x8cfb('0xb'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xc')]);router[_0x8cfb('0x4')](_0x8cfb('0xd'),auth[_0x8cfb('0x7')](),controller['chatQueues']);router[_0x8cfb('0x4')](_0x8cfb('0xe'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xf')]);router[_0x8cfb('0x4')](_0x8cfb('0x10'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x11')]);router[_0x8cfb('0x4')](_0x8cfb('0x12'),auth[_0x8cfb('0x7')](),controller['openchannelQueues']);router[_0x8cfb('0x4')](_0x8cfb('0x13'),auth[_0x8cfb('0x7')](),controller['smsQueues']);router['get'](_0x8cfb('0x14'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x15')]);router[_0x8cfb('0x4')](_0x8cfb('0x16'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x17')]);router[_0x8cfb('0x4')](_0x8cfb('0x18'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x19')]);router[_0x8cfb('0x4')]('/voice/queues/channels',auth[_0x8cfb('0x7')](),controller['voiceQueuesChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x1a'),auth['isAuthenticated'](),controller[_0x8cfb('0x1b')]);router[_0x8cfb('0x4')](_0x8cfb('0x1c'),auth['isAuthenticated'](),controller[_0x8cfb('0x1d')]);router[_0x8cfb('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x8cfb('0x1e')]);router[_0x8cfb('0x4')](_0x8cfb('0x1f'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x20')]);router[_0x8cfb('0x4')]('/outbound',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x21')]);router['get'](_0x8cfb('0x22'),auth[_0x8cfb('0x7')](),controller['outboundChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x23'),auth[_0x8cfb('0x7')](),controller['agents']);router[_0x8cfb('0x24')]('/agents/:id/capacity',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x25')]);router[_0x8cfb('0x4')](_0x8cfb('0x26'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x27')]);router[_0x8cfb('0x4')](_0x8cfb('0x28'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x29')]);router[_0x8cfb('0x4')](_0x8cfb('0x2a'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x2b')]);router[_0x8cfb('0x4')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x8cfb('0x2c')]);router[_0x8cfb('0x4')]('/chat/queues/waitinginteractions',auth[_0x8cfb('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x2d'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x2e')]);router[_0x8cfb('0x4')](_0x8cfb('0x2f'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x30'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x31')]);router[_0x8cfb('0x4')](_0x8cfb('0x32'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x33')]);router[_0x8cfb('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x8cfb('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x34'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x35')]);router[_0x8cfb('0x36')](_0x8cfb('0x37'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x38')](_0x8cfb('0x39')));router['get'](_0x8cfb('0x3a'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x3b')]);router[_0x8cfb('0x36')](_0x8cfb('0x3c'),auth[_0x8cfb('0x7')](),controller['queueNotify']('chat'));router[_0x8cfb('0x4')]('/chat/queues/:id',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x3d')]);router[_0x8cfb('0x36')](_0x8cfb('0x3e'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x38')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x8cfb('0x3f')]);router[_0x8cfb('0x36')](_0x8cfb('0x40'),auth[_0x8cfb('0x7')](),controller['queueNotify']('openchannel'));router['get'](_0x8cfb('0x41'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x42')]);router[_0x8cfb('0x36')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8cfb('0x38')](_0x8cfb('0x43')));router[_0x8cfb('0x36')](_0x8cfb('0x44'),auth['isAuthenticated'](),controller[_0x8cfb('0x38')](_0x8cfb('0x45')));router['get']('/sms/queues/:id',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x46')]);router[_0x8cfb('0x4')](_0x8cfb('0x47'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x48')]);router[_0x8cfb('0x36')]('/agents/:id/notify',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x49')]);module[_0x8cfb('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 06eb516..e088cff 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 _0x68be=['../../config/logger','api','http','client','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','user','interface','SIP/%s','agent','internal','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','From','agentTransferTimeout','moment','lodash','util','../../mysqldb'];(function(_0x6884ee,_0x520f13){var _0x1f4b04=function(_0x5434b3){while(--_0x5434b3){_0x6884ee['push'](_0x6884ee['shift']());}};_0x1f4b04(++_0x520f13);}(_0x68be,0xf6));var _0xe68b=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x68be[_0x3513a0];return _0x2bdeb9;};'use strict';var BPromise=require('bluebird');var moment=require(_0xe68b('0x0'));var _=require(_0xe68b('0x1'));var util=require(_0xe68b('0x2'));var db=require(_0xe68b('0x3'))['db'];var logger=require(_0xe68b('0x4'))(_0xe68b('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xe68b('0x6')]({'port':0x232a});var mailClient=jayson[_0xe68b('0x7')][_0xe68b('0x6')]({'port':0x232b});var routingClient=jayson[_0xe68b('0x7')][_0xe68b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x569558,_0x3b0cdc,_0x110de4){return new BPromise(function(_0x345e18,_0x200715){var _0x390127=_0x110de4?_0x110de4:amiClient;return _0x390127[_0xe68b('0x8')](_0x569558,_0x3b0cdc)[_0xe68b('0x9')](function(_0x57a1b0){if(_0x57a1b0[_0xe68b('0xa')]){if(_0x57a1b0['error'][_0xe68b('0xb')]===0x1f4){return _0x200715(_0x57a1b0[_0xe68b('0xa')][_0xe68b('0xc')]);}return _0x345e18(_0x57a1b0[_0xe68b('0xa')][_0xe68b('0xc')]);}else{_0x345e18(_0x57a1b0['result']);}})[_0xe68b('0xd')](function(_0xd64f94){_0x200715(_0xd64f94);});});}function respondWithResult(_0x1c2e03,_0x294969){_0x294969=_0x294969||0xc8;return function(_0x393109){if(_0x393109){return _0x1c2e03[_0xe68b('0xe')](_0x294969)[_0xe68b('0xf')](_0x393109);}return _0x1c2e03[_0xe68b('0x10')](0x194);};}function handleError(_0x1f6de8,_0x53c5ea){_0x53c5ea=_0x53c5ea||0x1f4;return function(_0x188a93){logger['error'](_0x188a93[_0xe68b('0x11')]);if(_0x188a93[_0xe68b('0x12')]){delete _0x188a93['name'];}_0x1f6de8[_0xe68b('0xe')](_0x53c5ea)[_0xe68b('0x13')](_0x188a93);};}function findById(_0x173e48){return function(_0x1f62dc){if(!_['isNil'](_0x173e48)&&!_[_0xe68b('0x14')](_0x1f62dc)&&!_[_0xe68b('0x14')](_0x1f62dc[_0xe68b('0x15')])){return _['find'](_0x1f62dc['rows'],function(_0x262e89){return _0x262e89['id']==_0x173e48;});}return null;};}exports[_0xe68b('0x16')]=function(_0x2461be,_0x3fe0b9){return respondWithRpcPromise(_0xe68b('0x17'),_0x2461be[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x3fe0b9,null))['catch'](handleError(_0x3fe0b9,null));};exports['voiceChannelMixMonitor']=function(_0x53b082,_0x46509c){return respondWithRpcPromise(_0xe68b('0x19'),_[_0xe68b('0x1a')](_0x53b082['query'],_0x53b082[_0xe68b('0x1b')]))['then'](respondWithResult(_0x46509c,null))[_0xe68b('0xd')](handleError(_0x46509c,null));};exports[_0xe68b('0x1c')]=function(_0xe76478,_0x3adf2a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xe68b('0x1a')](_0xe76478[_0xe68b('0x18')],_0xe76478[_0xe68b('0x1b')]))[_0xe68b('0x9')](respondWithResult(_0x3adf2a,null))[_0xe68b('0xd')](handleError(_0x3adf2a,null));};exports[_0xe68b('0x1d')]=function(_0x2d7ce8,_0x1af349){return respondWithRpcPromise('VoiceQueues',_0x2d7ce8[_0xe68b('0x18')])['then'](respondWithResult(_0x1af349,null))['catch'](handleError(_0x1af349,null));};exports[_0xe68b('0x1e')]=function(_0xcc85f0,_0x3c6b50){return respondWithRpcPromise('VoiceQueues',_0xcc85f0[_0xe68b('0x18')])[_0xe68b('0x9')](findById(_0xcc85f0[_0xe68b('0x1b')]['id']))[_0xe68b('0x9')](respondWithResult(_0x3c6b50,null))[_0xe68b('0xd')](handleError(_0x3c6b50,null));};exports[_0xe68b('0x1f')]=function(_0x10daa7,_0x14e4c9){return respondWithRpcPromise(_0xe68b('0x20'),_['merge'](_0x10daa7['query'],_0x10daa7[_0xe68b('0x1b')]))[_0xe68b('0x9')](respondWithResult(_0x14e4c9,null))[_0xe68b('0xd')](handleError(_0x14e4c9,null));};exports[_0xe68b('0x21')]=function(_0xb1df00,_0x2ed1af){return respondWithRpcPromise(_0xe68b('0x22'),_0xb1df00[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x2ed1af,null))['catch'](handleError(_0x2ed1af,null));};exports['voiceQueuesChannel']=function(_0x2e835b,_0x4855f2){return respondWithRpcPromise(_0xe68b('0x23'),_['merge'](_0x2e835b[_0xe68b('0x18')],_0x2e835b['params']))[_0xe68b('0x9')](respondWithResult(_0x4855f2,null))[_0xe68b('0xd')](handleError(_0x4855f2,null));};exports['voiceQueuesChannelHangup']=function(_0x139f60,_0x112210){return respondWithRpcPromise(_0xe68b('0x24'),_[_0xe68b('0x1a')](_0x139f60[_0xe68b('0x18')],_0x139f60[_0xe68b('0x1b')]))['then'](respondWithResult(_0x112210,null))[_0xe68b('0xd')](handleError(_0x112210,null));};exports['voiceQueuesChannelRedirect']=function(_0x24f038,_0x2ba5e4){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xe68b('0x1a')](_0x24f038[_0xe68b('0x18')],_0x24f038['params']))[_0xe68b('0x9')](respondWithResult(_0x2ba5e4,null))['catch'](handleError(_0x2ba5e4,null));};exports[_0xe68b('0x25')]=function(_0x45d73a,_0x3e2c40){return respondWithRpcPromise('Outbound',_0x45d73a[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0x3e2c40,null))[_0xe68b('0xd')](handleError(_0x3e2c40,null));};exports[_0xe68b('0x26')]=function(_0xf4838b,_0xfbd9f){return respondWithRpcPromise(_0xe68b('0x27'),_0xf4838b[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0xfbd9f,null))[_0xe68b('0xd')](handleError(_0xfbd9f,null));};exports['agents']=function(_0x17ca39,_0xe1b2c1){var _0x236e73;return respondWithRpcPromise(_0xe68b('0x28'),_0x17ca39[_0xe68b('0x18')])[_0xe68b('0x9')](function(_0x2221e4){_0x236e73=_0x2221e4;return respondWithRpcPromise(_0xe68b('0x28'),_0x17ca39[_0xe68b('0x18')],routingClient);})['then'](function(_0x2bdb86){return _[_0xe68b('0x1a')]({},_0x2bdb86,_0x236e73);})[_0xe68b('0x9')](respondWithResult(_0xe1b2c1,null))[_0xe68b('0xd')](handleError(_0xe1b2c1,null));};exports[_0xe68b('0x29')]=function(_0x46b7ee,_0x36f97c){if(_0x46b7ee['body']&&_0x46b7ee[_0xe68b('0x2a')]['interaction']&&_0x46b7ee['user']&&_0x46b7ee['user'][_0xe68b('0x12')]){for(var _0x58b8ca in _0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')]){if(_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0xe68b('0x2c')](_0x58b8ca)){db[_0xe68b('0x2d')][_0xe68b('0x2e')]({'where':{'channel':_0x58b8ca,'membername':_0x46b7ee['user'][_0xe68b('0x12')],'type':_0xe68b('0x2f'),'exitAt':null,'uniqueid':_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0x58b8ca]&&_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca][_0xe68b('0x30')]?{'$notIn':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca]}:{'$ne':null}}})['then'](function(_0x647b03){var _0x2ace90=moment()[_0xe68b('0x31')](_0xe68b('0x32'));for(var _0x4e177c=0x0,_0x3dc9a0=_0x647b03[_0xe68b('0x30')];_0x4e177c<_0x3dc9a0;_0x4e177c+=0x1){_0x647b03[_0x4e177c]['updateAttributes']({'exitAt':_0x2ace90});}});for(var _0x5b94bb=0x0;_0x5b94bb<_0x46b7ee['body'][_0xe68b('0x2b')][_0x58b8ca][_0xe68b('0x30')];_0x5b94bb+=0x1){db['MemberReport'][_0xe68b('0x33')]({'where':{'channel':_0x58b8ca,'membername':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')],'type':_0xe68b('0x2f'),'uniqueid':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x2b')][_0x58b8ca][_0x5b94bb],'exitAt':null},'defaults':{'channel':_0x58b8ca,'membername':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')],'interface':_[_0xe68b('0x14')](_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x35')])?util[_0xe68b('0x31')](_0xe68b('0x36'),_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x12')]):_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x35')],'type':_0xe68b('0x2f'),'enterAt':moment()[_0xe68b('0x31')](_0xe68b('0x32')),'role':_0xe68b('0x37'),'internal':_0x46b7ee[_0xe68b('0x34')][_0xe68b('0x38')],'uniqueid':_0x46b7ee[_0xe68b('0x2a')]['interaction'][_0x58b8ca][_0x5b94bb]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x46b7ee[_0xe68b('0x1b')]['id'],'capacity':_0x46b7ee[_0xe68b('0x2a')][_0xe68b('0x39')]},routingClient)['then'](respondWithResult(_0x36f97c,null))[_0xe68b('0xd')](handleError(_0x36f97c,null));};exports[_0xe68b('0x3a')]=function(_0x197c13,_0x486cc9){return respondWithRpcPromise('Telephones',_0x197c13['query'])['then'](respondWithResult(_0x486cc9,null))[_0xe68b('0xd')](handleError(_0x486cc9,null));};exports[_0xe68b('0x3b')]=function(_0x2a8999,_0x3d3f85){return respondWithRpcPromise(_0xe68b('0x3c'),_0x2a8999[_0xe68b('0x18')])['then'](respondWithResult(_0x3d3f85,null))[_0xe68b('0xd')](handleError(_0x3d3f85,null));};exports[_0xe68b('0x3d')]=function(_0x21d58e,_0x546f4a){return respondWithRpcPromise(_0xe68b('0x3e'),_0x21d58e[_0xe68b('0x18')])['then'](respondWithResult(_0x546f4a,null))[_0xe68b('0xd')](handleError(_0x546f4a,null));};exports[_0xe68b('0x3f')]=function(_0x21004a,_0x4a55fc){return respondWithRpcPromise(_0xe68b('0x40'),_0x21004a['query'],routingClient)[_0xe68b('0x9')](respondWithResult(_0x4a55fc,null))[_0xe68b('0xd')](handleError(_0x4a55fc,null));};exports[_0xe68b('0x41')]=function(_0x54cb38,_0x22856f){return respondWithRpcPromise('ChatQueues',_0x54cb38[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x54cb38['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x22856f,null))['catch'](handleError(_0x22856f,null));};exports['mailQueues']=function(_0x128aef,_0x102db9){return respondWithRpcPromise(_0xe68b('0x42'),_0x128aef['query'],routingClient)['then'](respondWithResult(_0x102db9,null))[_0xe68b('0xd')](handleError(_0x102db9,null));};exports[_0xe68b('0x43')]=function(_0x4388c1,_0x5638e){return respondWithRpcPromise('MailQueues',_0x4388c1[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x4388c1['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x5638e,null))[_0xe68b('0xd')](handleError(_0x5638e,null));};exports[_0xe68b('0x44')]=function(_0x2d0f5f,_0xe8e003){return respondWithRpcPromise(_0xe68b('0x45'),_0x2d0f5f['query'],mailClient)[_0xe68b('0x9')](respondWithResult(_0xe8e003,null))[_0xe68b('0xd')](handleError(_0xe8e003,null));};exports[_0xe68b('0x46')]=function(_0x17a3e0,_0x52bbd2){return respondWithRpcPromise('OpenchannelQueues',_0x17a3e0[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x52bbd2,null))[_0xe68b('0xd')](handleError(_0x52bbd2,null));};exports[_0xe68b('0x47')]=function(_0x13eb8a,_0x149d41){return respondWithRpcPromise(_0xe68b('0x48'),_0x13eb8a[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x13eb8a['params']['id']))[_0xe68b('0x9')](respondWithResult(_0x149d41,null))[_0xe68b('0xd')](handleError(_0x149d41,null));};exports[_0xe68b('0x49')]=function(_0x25f7a9,_0x257f55){return respondWithRpcPromise(_0xe68b('0x4a'),_0x25f7a9[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x257f55,null))[_0xe68b('0xd')](handleError(_0x257f55,null));};exports[_0xe68b('0x4b')]=function(_0x5ef8c4,_0x5c5bdb){return respondWithRpcPromise('SmsQueues',_0x5ef8c4[_0xe68b('0x18')],routingClient)['then'](findById(_0x5ef8c4[_0xe68b('0x1b')]['id']))['then'](respondWithResult(_0x5c5bdb,null))['catch'](handleError(_0x5c5bdb,null));};exports[_0xe68b('0x4c')]=function(_0x15b5a7,_0x20eea5){return respondWithRpcPromise(_0xe68b('0x4d'),_0x15b5a7[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x20eea5,null))[_0xe68b('0xd')](handleError(_0x20eea5,null));};exports[_0xe68b('0x4e')]=function(_0x1e20ac,_0x4a3e81){return respondWithRpcPromise('WhatsappQueues',_0x1e20ac[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0x1e20ac[_0xe68b('0x1b')]['id']))[_0xe68b('0x9')](respondWithResult(_0x4a3e81,null))[_0xe68b('0xd')](handleError(_0x4a3e81,null));};exports['faxQueues']=function(_0x59057b,_0x384c19){return respondWithRpcPromise(_0xe68b('0x4f'),_0x59057b[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x384c19,null))[_0xe68b('0xd')](handleError(_0x384c19,null));};exports[_0xe68b('0x50')]=function(_0xd40b30,_0x275c4f){return respondWithRpcPromise(_0xe68b('0x4f'),_0xd40b30[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](findById(_0xd40b30['params']['id']))['then'](respondWithResult(_0x275c4f,null))[_0xe68b('0xd')](handleError(_0x275c4f,null));};exports['faxAccounts']=function(_0x4bd664,_0xf3b027){return respondWithRpcPromise(_0xe68b('0x51'),_0x4bd664[_0xe68b('0x18')])[_0xe68b('0x9')](respondWithResult(_0xf3b027,null))[_0xe68b('0xd')](handleError(_0xf3b027,null));};exports[_0xe68b('0x52')]=function(_0x1f5f74,_0x2c02c0){return respondWithRpcPromise(_0xe68b('0x53'),_0x1f5f74['query'],routingClient)[_0xe68b('0x9')](respondWithResult(_0x2c02c0,null))[_0xe68b('0xd')](handleError(_0x2c02c0,null));};exports['mailQueuesWaitingInteractions']=function(_0x340cb9,_0x51cf3e){return respondWithRpcPromise(_0xe68b('0x54'),_0x340cb9[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x51cf3e,null))[_0xe68b('0xd')](handleError(_0x51cf3e,null));};exports[_0xe68b('0x55')]=function(_0x8b508e,_0x40cc16){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x8b508e[_0xe68b('0x18')],routingClient)['then'](respondWithResult(_0x40cc16,null))[_0xe68b('0xd')](handleError(_0x40cc16,null));};exports[_0xe68b('0x56')]=function(_0x5e45ab,_0x11f0c9){return respondWithRpcPromise(_0xe68b('0x57'),_0x5e45ab[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](function(_0x410929){if(_0x5e45ab['query'][_0xe68b('0x58')]!==undefined){var _0x5ea9e3=_(_0x410929[_0xe68b('0x15')])[_0xe68b('0x59')]([_0x5e45ab[_0xe68b('0x18')][_0xe68b('0x58')],_0x5e45ab[_0xe68b('0x1b')]['id']])[_0xe68b('0x5a')](_0xe68b('0x5b'))['uniq']()[_0xe68b('0x5c')]();return _0x410929['rows'][_0xe68b('0x59')](function(_0x161967){return _0x5ea9e3[_0xe68b('0x5d')](_0x161967[_0xe68b('0x5b')])>-0x1;});}else{return _0x410929[_0xe68b('0x15')][_0xe68b('0x59')](function(_0x19d628){return _0x19d628[_0xe68b('0x5b')]===parseInt(_0x5e45ab[_0xe68b('0x1b')]['id']);});}})[_0xe68b('0x9')](respondWithResult(_0x11f0c9,null))[_0xe68b('0xd')](handleError(_0x11f0c9,null));};exports[_0xe68b('0x5e')]=function(_0x458442,_0x55452d){return respondWithRpcPromise(_0xe68b('0x5f'),_0x458442[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x55452d,null))[_0xe68b('0xd')](handleError(_0x55452d,null));};exports[_0xe68b('0x60')]=function(_0x56a904,_0x418b0d){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x56a904[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x418b0d,null))[_0xe68b('0xd')](handleError(_0x418b0d,null));};exports[_0xe68b('0x61')]=function(_0x124a59,_0x215865){return respondWithRpcPromise(_0xe68b('0x62'),_0x124a59[_0xe68b('0x18')],routingClient)[_0xe68b('0x9')](respondWithResult(_0x215865,null))[_0xe68b('0xd')](handleError(_0x215865,null));};exports[_0xe68b('0x63')]=function(_0x27016a){return function(_0x53d7a0,_0x187de4){var _0xb492ad,_0xee3a2a;var _0x4e64f2=_[_0xe68b('0x64')](_0x27016a);var _0x23d024=_0x27016a===_0xe68b('0x65')?_0xe68b('0x66'):'Account';return db[_0x4e64f2+_0xe68b('0x67')][_0xe68b('0x68')]({'raw':!![],'where':{'id':_0x53d7a0[_0xe68b('0x1b')]['id']}})[_0xe68b('0x9')](function(_0x70e377){if(_[_0xe68b('0x14')](_0x70e377)){throw new Error(_0x4e64f2+_0xe68b('0x69'));}_0xb492ad=_0x70e377;return db[_0x4e64f2+_0xe68b('0x6a')][_0xe68b('0x68')]({'where':{'id':_0x53d7a0['body'][_0xe68b('0x6b')]},'include':[{'model':db[_0x4e64f2+_0xe68b('0x6c')],'as':_0xe68b('0x6c')},{'model':db[_0x4e64f2+_0x23d024],'as':_0xe68b('0x6d')}]});})[_0xe68b('0x9')](function(_0x5d52bc){if(_[_0xe68b('0x14')](_0x5d52bc)){throw new Error(_0x4e64f2+_0xe68b('0x6e'));}_0xee3a2a=_0x5d52bc;return _0x5d52bc[_0xe68b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x567516={'uniqueid':_0x27016a+'.'+_0xee3a2a['id']+'.'+_0xee3a2a[_0xe68b('0x6c')]['id'],'FromUserId':_0x53d7a0['user']['id'],'type':_0xe68b('0x70')};_0x567516[_0x4e64f2+'MessageId']=_0xee3a2a['id'];_0x567516[_0x4e64f2+_0xe68b('0x71')]=_0xee3a2a[_0xe68b('0x6c')]['id'];_0x567516['From'+_0x4e64f2+_0x23d024+'Id']=_0xee3a2a['Account']['id'];_0x567516['To'+_0x4e64f2+'QueueId']=_0xb492ad['id'];return db[_0x4e64f2+_0xe68b('0x72')][_0xe68b('0x73')](_0x567516);})[_0xe68b('0x9')](function(){return respondWithRpcPromise(_0xe68b('0x74'),{'channel':_0x27016a,'interaction':_0xee3a2a[_0xe68b('0x6c')],'message':_0xee3a2a,'account':_0xee3a2a[_0xe68b('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe68b('0x70'),'appdata':_0xb492ad['name']+','+(_0xee3a2a[_0xe68b('0x6d')][_0xe68b('0x75')]||0x12c),'interval':_0xe68b('0x76')}]},routingClient);})[_0xe68b('0x9')](respondWithResult(_0x187de4,null))[_0xe68b('0xd')](handleError(_0x187de4,null));};};exports[_0xe68b('0x77')]=function(_0x25b308,_0x4ca9c1){var _0x3daeaf,_0x25b8fe;if(_[_0xe68b('0x14')](_0x25b308['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x508bde=_0x25b308[_0xe68b('0x2a')][_0xe68b('0x78')];var _0x5d3d9f=_[_0xe68b('0x64')](_0x508bde);var _0x1ed47e=_0x508bde===_0xe68b('0x65')?'Website':_0xe68b('0x6d');return db[_0xe68b('0x79')][_0xe68b('0x68')]({'raw':!![],'where':{'id':_0x25b308['params']['id'],'role':_0xe68b('0x37')}})[_0xe68b('0x9')](function(_0x37861c){if(_[_0xe68b('0x14')](_0x37861c)){throw new Error(_0xe68b('0x7a'));}_0x3daeaf=_0x37861c;return db[_0x5d3d9f+_0xe68b('0x6a')][_0xe68b('0x68')]({'where':{'id':_0x25b308[_0xe68b('0x2a')]['messageId']},'include':[{'model':db[_0x5d3d9f+_0xe68b('0x6c')],'as':_0xe68b('0x6c')},{'model':db[_0x5d3d9f+_0x1ed47e],'as':_0xe68b('0x6d')}]});})['then'](function(_0x50aadd){if(_['isNil'](_0x50aadd)){throw new Error(_0x5d3d9f+_0xe68b('0x6e'));}_0x25b8fe=_0x50aadd;return _0x50aadd['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xe68b('0x9')](function(){var _0x278b4f={'uniqueid':_0x508bde+'.'+_0x25b8fe['id']+'.'+_0x25b8fe['Interaction']['id'],'FromUserId':_0x25b308[_0xe68b('0x34')]['id'],'type':_0xe68b('0x70'),'ToUserId':_0x3daeaf['id']};_0x278b4f[_0x5d3d9f+'MessageId']=_0x25b8fe['id'];_0x278b4f[_0x5d3d9f+'InteractionId']=_0x25b8fe[_0xe68b('0x6c')]['id'];_0x278b4f[_0xe68b('0x7b')+_0x5d3d9f+_0x1ed47e+'Id']=_0x25b8fe[_0xe68b('0x6d')]['id'];return db[_0x5d3d9f+'TransferReport'][_0xe68b('0x73')](_0x278b4f);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x508bde,'interaction':_0x25b8fe[_0xe68b('0x6c')],'message':_0x25b8fe,'account':_0x25b8fe['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe68b('0x37'),'appdata':_0x3daeaf[_0xe68b('0x12')]+','+(_0x25b8fe[_0xe68b('0x6d')][_0xe68b('0x7c')]||0x12c),'interval':_0xe68b('0x76')}]},routingClient);})['then'](respondWithResult(_0x4ca9c1,null))[_0xe68b('0xd')](handleError(_0x4ca9c1,null));}; \ No newline at end of file +var _0x55be=['voiceChannels','query','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','AgentCapacity','capacity','telephones','trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Queue','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','TransferReport','create','agent','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find'];(function(_0x4856bd,_0x3a74fb){var _0x1d047e=function(_0x4370fe){while(--_0x4370fe){_0x4856bd['push'](_0x4856bd['shift']());}};_0x1d047e(++_0x3a74fb);}(_0x55be,0x1ce));var _0xe55b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x55be[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0xe55b('0x0'));var moment=require(_0xe55b('0x1'));var _=require(_0xe55b('0x2'));var util=require('util');var db=require(_0xe55b('0x3'))['db'];var logger=require(_0xe55b('0x4'))('api');var jayson=require(_0xe55b('0x5'));var amiClient=jayson[_0xe55b('0x6')][_0xe55b('0x7')]({'port':0x232a});var mailClient=jayson[_0xe55b('0x6')][_0xe55b('0x7')]({'port':0x232b});var routingClient=jayson[_0xe55b('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x22eb43,_0x1aa7d6,_0x4aebfe){return new BPromise(function(_0x466967,_0x150441){var _0x32df4f=_0x4aebfe?_0x4aebfe:amiClient;return _0x32df4f[_0xe55b('0x8')](_0x22eb43,_0x1aa7d6)[_0xe55b('0x9')](function(_0x2df905){if(_0x2df905[_0xe55b('0xa')]){if(_0x2df905[_0xe55b('0xa')]['code']===0x1f4){return _0x150441(_0x2df905[_0xe55b('0xa')][_0xe55b('0xb')]);}return _0x466967(_0x2df905[_0xe55b('0xa')]['message']);}else{_0x466967(_0x2df905[_0xe55b('0xc')]);}})[_0xe55b('0xd')](function(_0x32812b){_0x150441(_0x32812b);});});}function respondWithResult(_0x415f7f,_0x5ca881){_0x5ca881=_0x5ca881||0xc8;return function(_0x4f483f){if(_0x4f483f){return _0x415f7f[_0xe55b('0xe')](_0x5ca881)[_0xe55b('0xf')](_0x4f483f);}return _0x415f7f[_0xe55b('0x10')](0x194);};}function handleError(_0x9c02c7,_0xd2ba87){_0xd2ba87=_0xd2ba87||0x1f4;return function(_0xa9476e){logger['error'](_0xa9476e['stack']);if(_0xa9476e[_0xe55b('0x11')]){delete _0xa9476e[_0xe55b('0x11')];}_0x9c02c7[_0xe55b('0xe')](_0xd2ba87)[_0xe55b('0x12')](_0xa9476e);};}function findById(_0x3e7fca){return function(_0x43b565){if(!_[_0xe55b('0x13')](_0x3e7fca)&&!_[_0xe55b('0x13')](_0x43b565)&&!_[_0xe55b('0x13')](_0x43b565[_0xe55b('0x14')])){return _[_0xe55b('0x15')](_0x43b565[_0xe55b('0x14')],function(_0x6ba40f){return _0x6ba40f['id']==_0x3e7fca;});}return null;};}exports[_0xe55b('0x16')]=function(_0x21336d,_0x319e00){return respondWithRpcPromise('VoiceChannels',_0x21336d[_0xe55b('0x17')])['then'](respondWithResult(_0x319e00,null))['catch'](handleError(_0x319e00,null));};exports['voiceChannelMixMonitor']=function(_0x239edd,_0x431d1){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xe55b('0x18')](_0x239edd[_0xe55b('0x17')],_0x239edd[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x431d1,null))[_0xe55b('0xd')](handleError(_0x431d1,null));};exports['voiceChannelStopMixMonitor']=function(_0x3552d1,_0x134980){return respondWithRpcPromise(_0xe55b('0x1a'),_['merge'](_0x3552d1[_0xe55b('0x17')],_0x3552d1['params']))[_0xe55b('0x9')](respondWithResult(_0x134980,null))[_0xe55b('0xd')](handleError(_0x134980,null));};exports['voiceQueues']=function(_0x42e430,_0x188634){return respondWithRpcPromise(_0xe55b('0x1b'),_0x42e430[_0xe55b('0x17')])['then'](respondWithResult(_0x188634,null))[_0xe55b('0xd')](handleError(_0x188634,null));};exports['showVoiceQueues']=function(_0x531a9c,_0x5cc149){return respondWithRpcPromise(_0xe55b('0x1b'),_0x531a9c[_0xe55b('0x17')])[_0xe55b('0x9')](findById(_0x531a9c['params']['id']))['then'](respondWithResult(_0x5cc149,null))['catch'](handleError(_0x5cc149,null));};exports[_0xe55b('0x1c')]=function(_0xd30332,_0x22e8c0){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe55b('0x18')](_0xd30332['query'],_0xd30332[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x22e8c0,null))[_0xe55b('0xd')](handleError(_0x22e8c0,null));};exports[_0xe55b('0x1d')]=function(_0xa24aae,_0x2a85a8){return respondWithRpcPromise(_0xe55b('0x1e'),_0xa24aae[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x2a85a8,null))['catch'](handleError(_0x2a85a8,null));};exports['voiceQueuesChannel']=function(_0x120969,_0x34027e){return respondWithRpcPromise(_0xe55b('0x1f'),_[_0xe55b('0x18')](_0x120969['query'],_0x120969[_0xe55b('0x19')]))['then'](respondWithResult(_0x34027e,null))['catch'](handleError(_0x34027e,null));};exports[_0xe55b('0x20')]=function(_0x2c8c11,_0x2bbc38){return respondWithRpcPromise(_0xe55b('0x21'),_[_0xe55b('0x18')](_0x2c8c11[_0xe55b('0x17')],_0x2c8c11[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x2bbc38,null))[_0xe55b('0xd')](handleError(_0x2bbc38,null));};exports[_0xe55b('0x22')]=function(_0xc2f6a2,_0x3109b0){return respondWithRpcPromise(_0xe55b('0x23'),_['merge'](_0xc2f6a2['query'],_0xc2f6a2[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x3109b0,null))[_0xe55b('0xd')](handleError(_0x3109b0,null));};exports[_0xe55b('0x24')]=function(_0x4b5bed,_0x56fa9a){return respondWithRpcPromise('Outbound',_0x4b5bed[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x56fa9a,null))['catch'](handleError(_0x56fa9a,null));};exports[_0xe55b('0x25')]=function(_0x5d5f9e,_0x59a90b){return respondWithRpcPromise('OutboundChannels',_0x5d5f9e[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x59a90b,null))[_0xe55b('0xd')](handleError(_0x59a90b,null));};exports[_0xe55b('0x26')]=function(_0x37c34a,_0x5467bd){var _0xeceea9;return respondWithRpcPromise(_0xe55b('0x27'),_0x37c34a[_0xe55b('0x17')])[_0xe55b('0x9')](function(_0x1f09a1){_0xeceea9=_0x1f09a1;return respondWithRpcPromise('Agents',_0x37c34a[_0xe55b('0x17')],routingClient);})[_0xe55b('0x9')](function(_0x42fbc6){return _[_0xe55b('0x18')]({},_0x42fbc6,_0xeceea9);})[_0xe55b('0x9')](respondWithResult(_0x5467bd,null))[_0xe55b('0xd')](handleError(_0x5467bd,null));};exports[_0xe55b('0x28')]=function(_0x34c40c,_0x51a501){if(_0x34c40c[_0xe55b('0x29')]&&_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')]&&_0x34c40c[_0xe55b('0x2b')]&&_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')]){for(var _0x1a53aa in _0x34c40c['body'][_0xe55b('0x2a')]){if(_0x34c40c[_0xe55b('0x29')]['interaction'][_0xe55b('0x2c')](_0x1a53aa)){db['MemberReport'][_0xe55b('0x2d')]({'where':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'type':_0xe55b('0x2e'),'exitAt':null,'uniqueid':_0x34c40c['body'][_0xe55b('0x2a')][_0x1a53aa]&&_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0xe55b('0x2f')]?{'$notIn':_0x34c40c['body'][_0xe55b('0x2a')][_0x1a53aa]}:{'$ne':null}}})['then'](function(_0x1c2e8f){var _0x26e150=moment()['format'](_0xe55b('0x30'));for(var _0x25e0a=0x0,_0x2318c7=_0x1c2e8f['length'];_0x25e0a<_0x2318c7;_0x25e0a+=0x1){_0x1c2e8f[_0x25e0a][_0xe55b('0x31')]({'exitAt':_0x26e150});}});for(var _0x25f33e=0x0;_0x25f33e<_0x34c40c[_0xe55b('0x29')]['interaction'][_0x1a53aa][_0xe55b('0x2f')];_0x25f33e+=0x1){db['MemberReport'][_0xe55b('0x32')]({'where':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'type':_0xe55b('0x2e'),'uniqueid':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0x25f33e],'exitAt':null},'defaults':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'interface':_[_0xe55b('0x13')](_0x34c40c['user'][_0xe55b('0x33')])?util[_0xe55b('0x34')]('SIP/%s',_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')]):_0x34c40c['user'][_0xe55b('0x33')],'type':_0xe55b('0x2e'),'enterAt':moment()[_0xe55b('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x34c40c[_0xe55b('0x2b')]['internal'],'uniqueid':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0x25f33e]}});}}}}return respondWithRpcPromise(_0xe55b('0x35'),{'id':_0x34c40c[_0xe55b('0x19')]['id'],'capacity':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x36')]},routingClient)[_0xe55b('0x9')](respondWithResult(_0x51a501,null))[_0xe55b('0xd')](handleError(_0x51a501,null));};exports[_0xe55b('0x37')]=function(_0xf1d789,_0x45a344){return respondWithRpcPromise('Telephones',_0xf1d789[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x45a344,null))['catch'](handleError(_0x45a344,null));};exports[_0xe55b('0x38')]=function(_0x104ec1,_0x287f6b){return respondWithRpcPromise('Trunks',_0x104ec1[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x287f6b,null))[_0xe55b('0xd')](handleError(_0x287f6b,null));};exports['campaigns']=function(_0x1f5bb2,_0x458786){return respondWithRpcPromise(_0xe55b('0x39'),_0x1f5bb2[_0xe55b('0x17')])['then'](respondWithResult(_0x458786,null))[_0xe55b('0xd')](handleError(_0x458786,null));};exports[_0xe55b('0x3a')]=function(_0x4fdf86,_0x450802){return respondWithRpcPromise(_0xe55b('0x3b'),_0x4fdf86[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x450802,null))[_0xe55b('0xd')](handleError(_0x450802,null));};exports['showChatQueues']=function(_0x338ed9,_0x3d4c29){return respondWithRpcPromise(_0xe55b('0x3b'),_0x338ed9[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](findById(_0x338ed9['params']['id']))[_0xe55b('0x9')](respondWithResult(_0x3d4c29,null))[_0xe55b('0xd')](handleError(_0x3d4c29,null));};exports[_0xe55b('0x3c')]=function(_0xc34855,_0x2e581a){return respondWithRpcPromise(_0xe55b('0x3d'),_0xc34855[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x2e581a,null))['catch'](handleError(_0x2e581a,null));};exports[_0xe55b('0x3e')]=function(_0x5f4552,_0xf249bb){return respondWithRpcPromise(_0xe55b('0x3d'),_0x5f4552['query'],routingClient)[_0xe55b('0x9')](findById(_0x5f4552['params']['id']))[_0xe55b('0x9')](respondWithResult(_0xf249bb,null))['catch'](handleError(_0xf249bb,null));};exports[_0xe55b('0x3f')]=function(_0x4944b8,_0xb6e28c){return respondWithRpcPromise(_0xe55b('0x40'),_0x4944b8[_0xe55b('0x17')],mailClient)[_0xe55b('0x9')](respondWithResult(_0xb6e28c,null))[_0xe55b('0xd')](handleError(_0xb6e28c,null));};exports[_0xe55b('0x41')]=function(_0x1e6573,_0x558c9a){return respondWithRpcPromise(_0xe55b('0x42'),_0x1e6573[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x558c9a,null))[_0xe55b('0xd')](handleError(_0x558c9a,null));};exports[_0xe55b('0x43')]=function(_0x51957d,_0x920672){return respondWithRpcPromise(_0xe55b('0x42'),_0x51957d[_0xe55b('0x17')],routingClient)['then'](findById(_0x51957d[_0xe55b('0x19')]['id']))[_0xe55b('0x9')](respondWithResult(_0x920672,null))[_0xe55b('0xd')](handleError(_0x920672,null));};exports[_0xe55b('0x44')]=function(_0x50798a,_0x566b87){return respondWithRpcPromise(_0xe55b('0x45'),_0x50798a[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x566b87,null))[_0xe55b('0xd')](handleError(_0x566b87,null));};exports[_0xe55b('0x46')]=function(_0x30dc22,_0x4b5c60){return respondWithRpcPromise('SmsQueues',_0x30dc22[_0xe55b('0x17')],routingClient)['then'](findById(_0x30dc22[_0xe55b('0x19')]['id']))[_0xe55b('0x9')](respondWithResult(_0x4b5c60,null))[_0xe55b('0xd')](handleError(_0x4b5c60,null));};exports[_0xe55b('0x47')]=function(_0x157d51,_0x1b0934){return respondWithRpcPromise(_0xe55b('0x48'),_0x157d51[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x1b0934,null))['catch'](handleError(_0x1b0934,null));};exports[_0xe55b('0x49')]=function(_0x3b3ae9,_0x463361){return respondWithRpcPromise(_0xe55b('0x48'),_0x3b3ae9['query'],routingClient)[_0xe55b('0x9')](findById(_0x3b3ae9['params']['id']))['then'](respondWithResult(_0x463361,null))['catch'](handleError(_0x463361,null));};exports[_0xe55b('0x4a')]=function(_0x4f609a,_0x47f154){return respondWithRpcPromise(_0xe55b('0x4b'),_0x4f609a[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x47f154,null))[_0xe55b('0xd')](handleError(_0x47f154,null));};exports[_0xe55b('0x4c')]=function(_0x7671f5,_0x5eb16d){return respondWithRpcPromise(_0xe55b('0x4b'),_0x7671f5[_0xe55b('0x17')],routingClient)['then'](findById(_0x7671f5['params']['id']))[_0xe55b('0x9')](respondWithResult(_0x5eb16d,null))[_0xe55b('0xd')](handleError(_0x5eb16d,null));};exports['faxAccounts']=function(_0x41564b,_0x1cb356){return respondWithRpcPromise('FaxAccounts',_0x41564b[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x1cb356,null))[_0xe55b('0xd')](handleError(_0x1cb356,null));};exports[_0xe55b('0x4d')]=function(_0x2414a2,_0x31a45b){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2414a2[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x31a45b,null))['catch'](handleError(_0x31a45b,null));};exports[_0xe55b('0x4e')]=function(_0x5380f0,_0x4f9907){return respondWithRpcPromise(_0xe55b('0x4f'),_0x5380f0[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x4f9907,null))[_0xe55b('0xd')](handleError(_0x4f9907,null));};exports[_0xe55b('0x50')]=function(_0x1c4073,_0x49efdc){return respondWithRpcPromise(_0xe55b('0x51'),_0x1c4073['query'],routingClient)[_0xe55b('0x9')](respondWithResult(_0x49efdc,null))[_0xe55b('0xd')](handleError(_0x49efdc,null));};exports[_0xe55b('0x52')]=function(_0x333ca8,_0x425d56){return respondWithRpcPromise(_0xe55b('0x51'),_0x333ca8['query'],routingClient)[_0xe55b('0x9')](function(_0xf264f7){if(_0x333ca8['query'][_0xe55b('0x53')]!==undefined){var _0x1f1bd2=_(_0xf264f7[_0xe55b('0x14')])[_0xe55b('0x54')]([_0x333ca8[_0xe55b('0x17')][_0xe55b('0x53')],_0x333ca8[_0xe55b('0x19')]['id']])[_0xe55b('0x55')](_0xe55b('0x56'))[_0xe55b('0x57')]()['value']();return _0xf264f7[_0xe55b('0x14')][_0xe55b('0x54')](function(_0x21a966){return _0x1f1bd2[_0xe55b('0x58')](_0x21a966[_0xe55b('0x56')])>-0x1;});}else{return _0xf264f7[_0xe55b('0x14')][_0xe55b('0x54')](function(_0x41de92){return _0x41de92[_0xe55b('0x56')]===parseInt(_0x333ca8['params']['id']);});}})[_0xe55b('0x9')](respondWithResult(_0x425d56,null))[_0xe55b('0xd')](handleError(_0x425d56,null));};exports[_0xe55b('0x59')]=function(_0x55534c,_0x185d37){return respondWithRpcPromise(_0xe55b('0x5a'),_0x55534c[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x185d37,null))['catch'](handleError(_0x185d37,null));};exports[_0xe55b('0x5b')]=function(_0x5358ba,_0x2bdfd4){return respondWithRpcPromise(_0xe55b('0x5c'),_0x5358ba['query'],routingClient)['then'](respondWithResult(_0x2bdfd4,null))['catch'](handleError(_0x2bdfd4,null));};exports[_0xe55b('0x5d')]=function(_0x186474,_0x54f102){return respondWithRpcPromise(_0xe55b('0x5e'),_0x186474[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x54f102,null))[_0xe55b('0xd')](handleError(_0x54f102,null));};exports['queueNotify']=function(_0x4960e6){return function(_0x82023d,_0x6957f2){var _0x2b543d,_0x18b49e;var _0x15af6b=_[_0xe55b('0x5f')](_0x4960e6);var _0x14a49e=_0x4960e6==='chat'?_0xe55b('0x60'):'Account';return db[_0x15af6b+_0xe55b('0x61')]['findOne']({'raw':!![],'where':{'id':_0x82023d[_0xe55b('0x19')]['id']}})[_0xe55b('0x9')](function(_0x1c42c2){if(_['isNil'](_0x1c42c2)){throw new Error(_0x15af6b+'\x20Queue\x20not\x20found');}_0x2b543d=_0x1c42c2;return db[_0x15af6b+_0xe55b('0x62')][_0xe55b('0x63')]({'where':{'id':_0x82023d[_0xe55b('0x29')][_0xe55b('0x64')]},'include':[{'model':db[_0x15af6b+_0xe55b('0x65')],'as':_0xe55b('0x65')},{'model':db[_0x15af6b+_0x14a49e],'as':'Account'}]});})['then'](function(_0x4f853c){if(_[_0xe55b('0x13')](_0x4f853c)){throw new Error(_0x15af6b+_0xe55b('0x66'));}_0x18b49e=_0x4f853c;return _0x4f853c[_0xe55b('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe55b('0x9')](function(){var _0x35c436={'uniqueid':_0x4960e6+'.'+_0x18b49e['id']+'.'+_0x18b49e[_0xe55b('0x65')]['id'],'FromUserId':_0x82023d[_0xe55b('0x2b')]['id'],'type':_0xe55b('0x68')};_0x35c436[_0x15af6b+_0xe55b('0x69')]=_0x18b49e['id'];_0x35c436[_0x15af6b+_0xe55b('0x6a')]=_0x18b49e[_0xe55b('0x65')]['id'];_0x35c436[_0xe55b('0x6b')+_0x15af6b+_0x14a49e+'Id']=_0x18b49e[_0xe55b('0x6c')]['id'];_0x35c436['To'+_0x15af6b+'QueueId']=_0x2b543d['id'];return db[_0x15af6b+'TransferReport']['create'](_0x35c436);})[_0xe55b('0x9')](function(){return respondWithRpcPromise(_0xe55b('0x6d'),{'channel':_0x4960e6,'interaction':_0x18b49e[_0xe55b('0x65')],'message':_0x18b49e,'account':_0x18b49e[_0xe55b('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2b543d[_0xe55b('0x11')]+','+(_0x18b49e[_0xe55b('0x6c')][_0xe55b('0x6e')]||0x12c),'interval':_0xe55b('0x6f')}]},routingClient);})[_0xe55b('0x9')](respondWithResult(_0x6957f2,null))[_0xe55b('0xd')](handleError(_0x6957f2,null));};};exports[_0xe55b('0x70')]=function(_0x40ffac,_0x1ab482){var _0x16b74e,_0x32b488;if(_[_0xe55b('0x13')](_0x40ffac[_0xe55b('0x29')][_0xe55b('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x33bde2=_0x40ffac[_0xe55b('0x29')][_0xe55b('0x71')];var _0x39ec60=_[_0xe55b('0x5f')](_0x33bde2);var _0xb4ab66=_0x33bde2===_0xe55b('0x72')?_0xe55b('0x60'):_0xe55b('0x6c');return db[_0xe55b('0x73')][_0xe55b('0x63')]({'raw':!![],'where':{'id':_0x40ffac['params']['id'],'role':'agent'}})['then'](function(_0x581748){if(_[_0xe55b('0x13')](_0x581748)){throw new Error(_0xe55b('0x74'));}_0x16b74e=_0x581748;return db[_0x39ec60+_0xe55b('0x62')][_0xe55b('0x63')]({'where':{'id':_0x40ffac[_0xe55b('0x29')][_0xe55b('0x64')]},'include':[{'model':db[_0x39ec60+_0xe55b('0x65')],'as':'Interaction'},{'model':db[_0x39ec60+_0xb4ab66],'as':_0xe55b('0x6c')}]});})[_0xe55b('0x9')](function(_0x4f015d){if(_['isNil'](_0x4f015d)){throw new Error(_0x39ec60+_0xe55b('0x66'));}_0x32b488=_0x4f015d;return _0x4f015d[_0xe55b('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe55b('0x9')](function(){var _0x30bd75={'uniqueid':_0x33bde2+'.'+_0x32b488['id']+'.'+_0x32b488[_0xe55b('0x65')]['id'],'FromUserId':_0x40ffac[_0xe55b('0x2b')]['id'],'type':'queue','ToUserId':_0x16b74e['id']};_0x30bd75[_0x39ec60+_0xe55b('0x69')]=_0x32b488['id'];_0x30bd75[_0x39ec60+'InteractionId']=_0x32b488[_0xe55b('0x65')]['id'];_0x30bd75[_0xe55b('0x6b')+_0x39ec60+_0xb4ab66+'Id']=_0x32b488[_0xe55b('0x6c')]['id'];return db[_0x39ec60+_0xe55b('0x75')][_0xe55b('0x76')](_0x30bd75);})[_0xe55b('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x33bde2,'interaction':_0x32b488[_0xe55b('0x65')],'message':_0x32b488,'account':_0x32b488[_0xe55b('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe55b('0x77'),'appdata':_0x16b74e[_0xe55b('0x11')]+','+(_0x32b488['Account'][_0xe55b('0x78')]||0x12c),'interval':_0xe55b('0x6f')}]},routingClient);})[_0xe55b('0x9')](respondWithResult(_0x1ab482,null))['catch'](handleError(_0x1ab482,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 02d7474..3842b8f 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 _0x51ce=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x285378,_0x388380){var _0x47f299=function(_0x31a8d7){while(--_0x31a8d7){_0x285378['push'](_0x285378['shift']());}};_0x47f299(++_0x388380);}(_0x51ce,0x1ba));var _0xe51c=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0x51ce[_0x2daef6];return _0x62d030;};'use strict';var multer=require(_0xe51c('0x0'));var util=require(_0xe51c('0x1'));var path=require('path');var timeout=require(_0xe51c('0x2'));var express=require('express');var router=express[_0xe51c('0x3')]();var auth=require(_0xe51c('0x4'));var interaction=require(_0xe51c('0x5'));var config=require(_0xe51c('0x6'));var controller=require(_0xe51c('0x7'));router[_0xe51c('0x8')]('/',auth[_0xe51c('0x9')](),controller[_0xe51c('0xa')]);router['get'](_0xe51c('0xb'),auth[_0xe51c('0x9')](),controller[_0xe51c('0xc')]);router[_0xe51c('0x8')]('/:id/run',auth[_0xe51c('0x9')](),controller['run']);router[_0xe51c('0xd')]('/',auth[_0xe51c('0x9')](),controller[_0xe51c('0xe')]);router[_0xe51c('0xf')]('/:id',auth[_0xe51c('0x9')](),controller[_0xe51c('0x10')]);router[_0xe51c('0x11')](_0xe51c('0xb'),auth[_0xe51c('0x9')](),controller[_0xe51c('0x12')]);module[_0xe51c('0x13')]=router; \ No newline at end of file +var _0x84fe=['get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x4743ef,_0x29ff88){var _0x426d30=function(_0x4b6557){while(--_0x4b6557){_0x4743ef['push'](_0x4743ef['shift']());}};_0x426d30(++_0x29ff88);}(_0x84fe,0x1cd));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe84f('0x2')]();var auth=require(_0xe84f('0x3'));var interaction=require(_0xe84f('0x4'));var config=require(_0xe84f('0x5'));var controller=require(_0xe84f('0x6'));router[_0xe84f('0x7')]('/',auth[_0xe84f('0x8')](),controller[_0xe84f('0x9')]);router[_0xe84f('0x7')](_0xe84f('0xa'),auth[_0xe84f('0x8')](),controller[_0xe84f('0xb')]);router[_0xe84f('0x7')](_0xe84f('0xc'),auth[_0xe84f('0x8')](),controller[_0xe84f('0xd')]);router[_0xe84f('0xe')]('/',auth['isAuthenticated'](),controller[_0xe84f('0xf')]);router[_0xe84f('0x10')](_0xe84f('0xa'),auth[_0xe84f('0x8')](),controller['update']);router['delete'](_0xe84f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xe84f('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8cc29ee..f9b82a2 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 _0x2f74=['xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','months','weeks','days','hours','minutes','ENUM','csv'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x2f74,0x7b));var _0x42f7=function(_0x211d4a,_0x9d4244){_0x211d4a=_0x211d4a-0x0;var _0x208576=_0x2f74[_0x211d4a];return _0x208576;};'use strict';var Sequelize=require(_0x42f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x42f7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x42f7('0x1')]},'active':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x42f7('0x1')],'allowNull':![],'defaultValue':_0x42f7('0x3')},'startAt':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x42f7('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0x42f7('0x6'),_0x42f7('0x7'),_0x42f7('0x8'),_0x42f7('0x9'),_0x42f7('0xa')),'allowNull':![],'defaultValue':_0x42f7('0x8')},'output':{'type':Sequelize[_0x42f7('0xb')](_0x42f7('0xc'),'pdf',_0x42f7('0xd')),'allowNull':![],'defaultValue':_0x42f7('0xc')},'type':{'type':Sequelize[_0x42f7('0xb')](_0x42f7('0xe'),_0x42f7('0xf')),'allowNull':![],'defaultValue':_0x42f7('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x42f7('0x1')]},'cc':{'type':Sequelize[_0x42f7('0x10')]},'bcc':{'type':Sequelize[_0x42f7('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x42f7('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdbf5=['exports','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','TEXT'];(function(_0x433b40,_0x47a559){var _0xc927c=function(_0x2c0dfb){while(--_0x2c0dfb){_0x433b40['push'](_0x433b40['shift']());}};_0xc927c(++_0x47a559);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x66c81a,_0x3bbf8c){_0x66c81a=_0x66c81a-0x0;var _0x4dd38b=_0xdbf5[_0x66c81a];return _0x4dd38b;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5dbf('0x2')],'allowNull':![],'defaultValue':_0x5dbf('0x3')},'startAt':{'type':Sequelize[_0x5dbf('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5dbf('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5dbf('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5dbf('0x6')](_0x5dbf('0x7'),_0x5dbf('0x8'),_0x5dbf('0x9'),_0x5dbf('0xa'),_0x5dbf('0xb'),_0x5dbf('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x5dbf('0xb')},'output':{'type':Sequelize['ENUM'](_0x5dbf('0xd'),_0x5dbf('0xe'),_0x5dbf('0xf')),'allowNull':![],'defaultValue':_0x5dbf('0xd')},'type':{'type':Sequelize['ENUM'](_0x5dbf('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x5dbf('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index fbdf86a..c448eed 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 _0x26bf=['limit','set','Content-Range','json','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Schedule','fieldName','type','key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset'];(function(_0x148c65,_0x4a6a20){var _0x406635=function(_0x451146){while(--_0x451146){_0x148c65['push'](_0x148c65['shift']());}};_0x406635(++_0x4a6a20);}(_0x26bf,0x85));var _0xf26b=function(_0x27466b,_0x5bdb3d){_0x27466b=_0x27466b-0x0;var _0x4f4726=_0x26bf[_0x27466b];return _0x4f4726;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf26b('0x0'));var rimraf=require(_0xf26b('0x1'));var zipdir=require(_0xf26b('0x2'));var jsonpatch=require(_0xf26b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf26b('0x4'));var util=require('util');var path=require(_0xf26b('0x5'));var sox=require('sox');var csv=require(_0xf26b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf26b('0x7'));var squel=require('squel');var crypto=require(_0xf26b('0x8'));var jsforce=require(_0xf26b('0x9'));var deskjs=require(_0xf26b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf26b('0xb'));var authService=require(_0xf26b('0xc'));var qs=require(_0xf26b('0xd'));var as=require(_0xf26b('0xe'));var hardwareService=require(_0xf26b('0xf'));var logger=require(_0xf26b('0x10'))(_0xf26b('0x11'));var utils=require(_0xf26b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf26b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62e78c,_0xc2b20f){_0xc2b20f=_0xc2b20f||0xcc;return function(_0x59c88c){if(_0x59c88c){return _0x62e78c[_0xf26b('0x14')](_0xc2b20f);}return _0x62e78c[_0xf26b('0x15')](_0xc2b20f)[_0xf26b('0x16')]();};}function respondWithResult(_0x5382a7,_0x113ac6){_0x113ac6=_0x113ac6||0xc8;return function(_0x1fee2c){if(_0x1fee2c){return _0x5382a7[_0xf26b('0x15')](_0x113ac6)['json'](_0x1fee2c);}};}function respondWithFilteredResult(_0x43c414,_0xb81b15){return function(_0x14407d){if(_0x14407d){var _0x2f8ea2=_0x14407d[_0xf26b('0x17')],_0x4ffa95=_0xb81b15[_0xf26b('0x18')],_0x21b893=_0xb81b15[_0xf26b('0x18')]+_0xb81b15[_0xf26b('0x19')],_0x53f854;if(_0x21b893>=_0x2f8ea2){_0x21b893=_0x2f8ea2;_0x53f854=0xc8;}else{_0x53f854=0xce;}_0x43c414[_0xf26b('0x15')](_0x53f854);return _0x43c414[_0xf26b('0x1a')](_0xf26b('0x1b'),_0x4ffa95+'-'+_0x21b893+'/'+_0x2f8ea2)[_0xf26b('0x1c')](_0x14407d);}return null;};}function patchUpdates(_0x235146){return function(_0xd070a1){try{jsonpatch['apply'](_0xd070a1,_0x235146,!![]);}catch(_0xead887){return BPromise['reject'](_0xead887);}return _0xd070a1[_0xf26b('0x1d')]();};}function saveUpdates(_0x4278b5,_0xfa93c4){return function(_0x2c1b46){if(_0x2c1b46){return _0x2c1b46['update'](_0x4278b5)[_0xf26b('0x1e')](function(_0x3c0025){return _0x3c0025;});}return null;};}function removeEntity(_0x443d8c,_0x4c52e7){return function(_0x6336bd){if(_0x6336bd){return _0x6336bd[_0xf26b('0x1f')]()[_0xf26b('0x1e')](function(){var _0x4c49e1=_0x6336bd[_0xf26b('0x20')]({'plain':!![]});var _0xc1219d='Scheduler';return db[_0xf26b('0x21')][_0xf26b('0x1f')]({'where':{'type':_0xc1219d,'resourceId':_0x4c49e1['id']}})[_0xf26b('0x1e')](function(){return _0x6336bd;});})[_0xf26b('0x1e')](function(){_0x443d8c[_0xf26b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa65510,_0x30ff47){return function(_0x5e3df0){if(!_0x5e3df0){_0xa65510[_0xf26b('0x14')](0x194);}return _0x5e3df0;};}function handleError(_0x19c2e2,_0x1a48c4){_0x1a48c4=_0x1a48c4||0x1f4;return function(_0x1e83f8){logger[_0xf26b('0x22')](_0x1e83f8[_0xf26b('0x23')]);if(_0x1e83f8[_0xf26b('0x24')]){delete _0x1e83f8[_0xf26b('0x24')];}_0x19c2e2['status'](_0x1a48c4)[_0xf26b('0x25')](_0x1e83f8);};}exports['index']=function(_0x4b8865,_0x61b786){var _0x2abee2={},_0x4cd9e8={},_0x6ddeb6={'count':0x0,'rows':[]};var _0x255fb7=_[_0xf26b('0x26')](db[_0xf26b('0x27')]['rawAttributes'],function(_0x33df15){return{'name':_0x33df15[_0xf26b('0x28')],'type':_0x33df15[_0xf26b('0x29')][_0xf26b('0x2a')]};});_0x4cd9e8['model']=_[_0xf26b('0x26')](_0x255fb7,_0xf26b('0x24'));_0x4cd9e8[_0xf26b('0x2b')]=_[_0xf26b('0x2c')](_0x4b8865[_0xf26b('0x2b')]);_0x4cd9e8['filters']=_['intersection'](_0x4cd9e8[_0xf26b('0x2d')],_0x4cd9e8[_0xf26b('0x2b')]);_0x2abee2['attributes']=_[_0xf26b('0x2e')](_0x4cd9e8[_0xf26b('0x2d')],qs['fields'](_0x4b8865['query'][_0xf26b('0x2f')]));_0x2abee2['attributes']=_0x2abee2['attributes']['length']?_0x2abee2[_0xf26b('0x30')]:_0x4cd9e8[_0xf26b('0x2d')];if(!_0x4b8865['query'][_0xf26b('0x31')](_0xf26b('0x32'))){_0x2abee2[_0xf26b('0x19')]=qs['limit'](_0x4b8865[_0xf26b('0x2b')]['limit']);_0x2abee2[_0xf26b('0x18')]=qs['offset'](_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x18')]);}_0x2abee2[_0xf26b('0x33')]=qs[_0xf26b('0x34')](_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x34')]);_0x2abee2[_0xf26b('0x35')]=qs[_0xf26b('0x36')](_[_0xf26b('0x37')](_0x4b8865['query'],_0x4cd9e8[_0xf26b('0x36')]),_0x255fb7);if(_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x38')]){_0x2abee2[_0xf26b('0x35')]=_[_0xf26b('0x39')](_0x2abee2[_0xf26b('0x35')],{'$or':_['map'](_0x255fb7,function(_0x1ce5ce){if(_0x1ce5ce[_0xf26b('0x29')]!==_0xf26b('0x3a')){var _0x4f4378={};_0x4f4378[_0x1ce5ce[_0xf26b('0x24')]]={'$like':'%'+_0x4b8865['query'][_0xf26b('0x38')]+'%'};return _0x4f4378;}})});}_0x2abee2=_[_0xf26b('0x39')]({},_0x2abee2,_0x4b8865[_0xf26b('0x3b')]);var _0x12c4e4={'where':_0x2abee2[_0xf26b('0x35')]};return db[_0xf26b('0x27')][_0xf26b('0x17')](_0x12c4e4)[_0xf26b('0x1e')](function(_0xe5d79b){_0x6ddeb6[_0xf26b('0x17')]=_0xe5d79b;if(_0x4b8865[_0xf26b('0x2b')][_0xf26b('0x3c')]){_0x2abee2[_0xf26b('0x3d')]=[{'all':!![]}];}return db[_0xf26b('0x27')][_0xf26b('0x3e')](_0x2abee2);})[_0xf26b('0x1e')](function(_0x2682f2){_0x6ddeb6[_0xf26b('0x3f')]=_0x2682f2;return _0x6ddeb6;})[_0xf26b('0x1e')](respondWithFilteredResult(_0x61b786,_0x2abee2))[_0xf26b('0x40')](handleError(_0x61b786,null));};exports['show']=function(_0x55fcba,_0x40af02){var _0x16be13={'raw':![],'where':{'id':_0x55fcba[_0xf26b('0x41')]['id']}},_0x575d17={};_0x575d17['model']=_[_0xf26b('0x2c')](db['Schedule'][_0xf26b('0x42')]);_0x575d17[_0xf26b('0x2b')]=_[_0xf26b('0x2c')](_0x55fcba[_0xf26b('0x2b')]);_0x575d17[_0xf26b('0x36')]=_[_0xf26b('0x2e')](_0x575d17[_0xf26b('0x2d')],_0x575d17[_0xf26b('0x2b')]);_0x16be13[_0xf26b('0x30')]=_['intersection'](_0x575d17['model'],qs['fields'](_0x55fcba[_0xf26b('0x2b')][_0xf26b('0x2f')]));_0x16be13[_0xf26b('0x30')]=_0x16be13[_0xf26b('0x30')][_0xf26b('0x43')]?_0x16be13['attributes']:_0x575d17[_0xf26b('0x2d')];if(_0x55fcba[_0xf26b('0x2b')]['includeAll']){_0x16be13[_0xf26b('0x3d')]=[{'all':!![]}];}_0x16be13=_[_0xf26b('0x39')]({},_0x16be13,_0x55fcba[_0xf26b('0x3b')]);return db[_0xf26b('0x27')][_0xf26b('0x44')](_0x16be13)[_0xf26b('0x1e')](handleEntityNotFound(_0x40af02,null))[_0xf26b('0x1e')](respondWithResult(_0x40af02,null))[_0xf26b('0x40')](handleError(_0x40af02,null));};exports[_0xf26b('0x45')]=function(_0x3e2472,_0x579a81){return db[_0xf26b('0x27')][_0xf26b('0x45')](_0x3e2472[_0xf26b('0x46')],{})[_0xf26b('0x1e')](function(_0x10c97c){var _0x263fde=_0x3e2472[_0xf26b('0x47')][_0xf26b('0x20')]({'plain':!![]});if(!_0x263fde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x263fde[_0xf26b('0x48')]===_0xf26b('0x47')){var _0x3a5d97=_0x10c97c['get']({'plain':!![]});var _0x283273=_0xf26b('0x49');return db[_0xf26b('0x4a')]['find']({'where':{'name':_0x283273,'userProfileId':_0x263fde[_0xf26b('0x4b')]},'raw':!![]})[_0xf26b('0x1e')](function(_0x554e96){if(_0x554e96&&_0x554e96[_0xf26b('0x4c')]===0x0){return db[_0xf26b('0x21')][_0xf26b('0x45')]({'name':_0x3a5d97[_0xf26b('0x24')],'resourceId':_0x3a5d97['id'],'type':_0x554e96['name'],'sectionId':_0x554e96['id']},{})['then'](function(){return _0x10c97c;});}else{return _0x10c97c;}})[_0xf26b('0x40')](function(_0xadc5eb){logger[_0xf26b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadc5eb);throw _0xadc5eb;});}return _0x10c97c;})[_0xf26b('0x1e')](respondWithResult(_0x579a81,0xc9))[_0xf26b('0x40')](handleError(_0x579a81,null));};exports['update']=function(_0x1ddef9,_0x488a04){if(_0x1ddef9[_0xf26b('0x46')]['id']){delete _0x1ddef9[_0xf26b('0x46')]['id'];}return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x1ddef9[_0xf26b('0x41')]['id']}})[_0xf26b('0x1e')](handleEntityNotFound(_0x488a04,null))[_0xf26b('0x1e')](saveUpdates(_0x1ddef9['body'],null))[_0xf26b('0x1e')](respondWithResult(_0x488a04,null))[_0xf26b('0x40')](handleError(_0x488a04,null));};exports[_0xf26b('0x1f')]=function(_0x2cfcce,_0xa488f3){return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x2cfcce[_0xf26b('0x41')]['id']}})[_0xf26b('0x1e')](handleEntityNotFound(_0xa488f3,null))['then'](removeEntity(_0xa488f3,null))['catch'](handleError(_0xa488f3,null));};exports[_0xf26b('0x4d')]=function(_0x10f225,_0x3b0e29,_0x1fa75b){var _0xbe7c85=require(_0xf26b('0x4e'));return db[_0xf26b('0x27')][_0xf26b('0x44')]({'where':{'id':_0x10f225[_0xf26b('0x41')]['id']},'raw':!![]})[_0xf26b('0x1e')](handleEntityNotFound(_0x3b0e29,null))[_0xf26b('0x1e')](function(){_0xbe7c85[_0xf26b('0x4d')](_0x10f225[_0xf26b('0x41')]['id']);})[_0xf26b('0x1e')](respondWithStatusCode(_0x3b0e29,null))[_0xf26b('0x40')](handleError(_0x3b0e29,null));}; \ No newline at end of file +var _0x0a12=['catch','params','intersection','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','status','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll'];(function(_0x1526a7,_0x2a94f4){var _0x14d22b=function(_0x3266be){while(--_0x3266be){_0x1526a7['push'](_0x1526a7['shift']());}};_0x14d22b(++_0x2a94f4);}(_0x0a12,0x10a));var _0x20a1=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0a12[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x20a1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x20a1('0x1'));var zipdir=require(_0x20a1('0x2'));var jsonpatch=require(_0x20a1('0x3'));var rp=require(_0x20a1('0x4'));var moment=require(_0x20a1('0x5'));var BPromise=require(_0x20a1('0x6'));var Mustache=require(_0x20a1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x20a1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x20a1('0x9'));var squel=require('squel');var crypto=require(_0x20a1('0xa'));var jsforce=require(_0x20a1('0xb'));var deskjs=require(_0x20a1('0xc'));var toCsv=require(_0x20a1('0xd'));var querystring=require(_0x20a1('0xe'));var Papa=require(_0x20a1('0xf'));var Redis=require('ioredis');var authService=require(_0x20a1('0x10'));var qs=require(_0x20a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20a1('0x12'));var logger=require(_0x20a1('0x13'))(_0x20a1('0x14'));var utils=require('../../config/utils');var config=require(_0x20a1('0x15'));var licenseUtil=require(_0x20a1('0x16'));var db=require(_0x20a1('0x17'))['db'];function respondWithStatusCode(_0xba9a11,_0x307c0a){_0x307c0a=_0x307c0a||0xcc;return function(_0x3d0cb2){if(_0x3d0cb2){return _0xba9a11[_0x20a1('0x18')](_0x307c0a);}return _0xba9a11['status'](_0x307c0a)[_0x20a1('0x19')]();};}function respondWithResult(_0x265db2,_0x182003){_0x182003=_0x182003||0xc8;return function(_0x3f046f){if(_0x3f046f){return _0x265db2['status'](_0x182003)[_0x20a1('0x1a')](_0x3f046f);}};}function respondWithFilteredResult(_0x5b28a7,_0x193c6b){return function(_0x4d9649){if(_0x4d9649){var _0x2d14f8=_0x4d9649[_0x20a1('0x1b')],_0x103e16=_0x193c6b[_0x20a1('0x1c')],_0x2e371c=_0x193c6b[_0x20a1('0x1c')]+_0x193c6b[_0x20a1('0x1d')],_0x1b99b4;if(_0x2e371c>=_0x2d14f8){_0x2e371c=_0x2d14f8;_0x1b99b4=0xc8;}else{_0x1b99b4=0xce;}_0x5b28a7['status'](_0x1b99b4);return _0x5b28a7['set'](_0x20a1('0x1e'),_0x103e16+'-'+_0x2e371c+'/'+_0x2d14f8)[_0x20a1('0x1a')](_0x4d9649);}return null;};}function patchUpdates(_0x2222cc){return function(_0x1a896a){try{jsonpatch['apply'](_0x1a896a,_0x2222cc,!![]);}catch(_0x3d5c45){return BPromise[_0x20a1('0x1f')](_0x3d5c45);}return _0x1a896a['save']();};}function saveUpdates(_0x530c5c,_0x1ed3d6){return function(_0x264f2c){if(_0x264f2c){return _0x264f2c[_0x20a1('0x20')](_0x530c5c)[_0x20a1('0x21')](function(_0x28cc2b){return _0x28cc2b;});}return null;};}function removeEntity(_0xf9786e,_0x40999c){return function(_0x392766){if(_0x392766){return _0x392766[_0x20a1('0x22')]()[_0x20a1('0x21')](function(){var _0x3312a3=_0x392766[_0x20a1('0x23')]({'plain':!![]});var _0x4bd64e=_0x20a1('0x24');return db[_0x20a1('0x25')]['destroy']({'where':{'type':_0x4bd64e,'resourceId':_0x3312a3['id']}})[_0x20a1('0x21')](function(){return _0x392766;});})[_0x20a1('0x21')](function(){_0xf9786e[_0x20a1('0x26')](0xcc)[_0x20a1('0x19')]();});}};}function handleEntityNotFound(_0x4fa510,_0x3e4815){return function(_0x4ed4be){if(!_0x4ed4be){_0x4fa510[_0x20a1('0x18')](0x194);}return _0x4ed4be;};}function handleError(_0x2b3ac6,_0x4e5261){_0x4e5261=_0x4e5261||0x1f4;return function(_0x322120){logger['error'](_0x322120[_0x20a1('0x27')]);if(_0x322120[_0x20a1('0x28')]){delete _0x322120['name'];}_0x2b3ac6[_0x20a1('0x26')](_0x4e5261)[_0x20a1('0x29')](_0x322120);};}exports[_0x20a1('0x2a')]=function(_0x3a7326,_0x4073c9){var _0x1deb4b={},_0x4dd992={},_0x1e6531={'count':0x0,'rows':[]};var _0x2843d8=_[_0x20a1('0x2b')](db[_0x20a1('0x2c')][_0x20a1('0x2d')],function(_0x25b467){return{'name':_0x25b467[_0x20a1('0x2e')],'type':_0x25b467[_0x20a1('0x2f')]['key']};});_0x4dd992[_0x20a1('0x30')]=_[_0x20a1('0x2b')](_0x2843d8,'name');_0x4dd992[_0x20a1('0x31')]=_[_0x20a1('0x32')](_0x3a7326[_0x20a1('0x31')]);_0x4dd992[_0x20a1('0x33')]=_['intersection'](_0x4dd992['model'],_0x4dd992['query']);_0x1deb4b[_0x20a1('0x34')]=_['intersection'](_0x4dd992['model'],qs[_0x20a1('0x35')](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x35')]));_0x1deb4b[_0x20a1('0x34')]=_0x1deb4b['attributes'][_0x20a1('0x36')]?_0x1deb4b[_0x20a1('0x34')]:_0x4dd992[_0x20a1('0x30')];if(!_0x3a7326['query'][_0x20a1('0x37')](_0x20a1('0x38'))){_0x1deb4b[_0x20a1('0x1d')]=qs[_0x20a1('0x1d')](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x1d')]);_0x1deb4b[_0x20a1('0x1c')]=qs['offset'](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x1c')]);}_0x1deb4b[_0x20a1('0x39')]=qs[_0x20a1('0x3a')](_0x3a7326['query'][_0x20a1('0x3a')]);_0x1deb4b[_0x20a1('0x3b')]=qs[_0x20a1('0x33')](_[_0x20a1('0x3c')](_0x3a7326['query'],_0x4dd992[_0x20a1('0x33')]),_0x2843d8);if(_0x3a7326['query'][_0x20a1('0x3d')]){_0x1deb4b[_0x20a1('0x3b')]=_[_0x20a1('0x3e')](_0x1deb4b[_0x20a1('0x3b')],{'$or':_[_0x20a1('0x2b')](_0x2843d8,function(_0x36caa0){if(_0x36caa0['type']!==_0x20a1('0x3f')){var _0x4494a2={};_0x4494a2[_0x36caa0[_0x20a1('0x28')]]={'$like':'%'+_0x3a7326['query'][_0x20a1('0x3d')]+'%'};return _0x4494a2;}})});}_0x1deb4b=_['merge']({},_0x1deb4b,_0x3a7326[_0x20a1('0x40')]);var _0x139c64={'where':_0x1deb4b[_0x20a1('0x3b')]};return db[_0x20a1('0x2c')][_0x20a1('0x1b')](_0x139c64)[_0x20a1('0x21')](function(_0x331899){_0x1e6531[_0x20a1('0x1b')]=_0x331899;if(_0x3a7326[_0x20a1('0x31')]['includeAll']){_0x1deb4b['include']=[{'all':!![]}];}return db[_0x20a1('0x2c')][_0x20a1('0x41')](_0x1deb4b);})[_0x20a1('0x21')](function(_0x370741){_0x1e6531['rows']=_0x370741;return _0x1e6531;})[_0x20a1('0x21')](respondWithFilteredResult(_0x4073c9,_0x1deb4b))[_0x20a1('0x42')](handleError(_0x4073c9,null));};exports['show']=function(_0x1d121c,_0x53cb24){var _0xde6d91={'raw':![],'where':{'id':_0x1d121c[_0x20a1('0x43')]['id']}},_0x369df7={};_0x369df7['model']=_[_0x20a1('0x32')](db[_0x20a1('0x2c')]['rawAttributes']);_0x369df7[_0x20a1('0x31')]=_[_0x20a1('0x32')](_0x1d121c[_0x20a1('0x31')]);_0x369df7['filters']=_[_0x20a1('0x44')](_0x369df7[_0x20a1('0x30')],_0x369df7[_0x20a1('0x31')]);_0xde6d91[_0x20a1('0x34')]=_[_0x20a1('0x44')](_0x369df7[_0x20a1('0x30')],qs[_0x20a1('0x35')](_0x1d121c[_0x20a1('0x31')][_0x20a1('0x35')]));_0xde6d91[_0x20a1('0x34')]=_0xde6d91[_0x20a1('0x34')][_0x20a1('0x36')]?_0xde6d91[_0x20a1('0x34')]:_0x369df7[_0x20a1('0x30')];if(_0x1d121c[_0x20a1('0x31')][_0x20a1('0x45')]){_0xde6d91[_0x20a1('0x46')]=[{'all':!![]}];}_0xde6d91=_[_0x20a1('0x3e')]({},_0xde6d91,_0x1d121c['options']);return db[_0x20a1('0x2c')][_0x20a1('0x47')](_0xde6d91)[_0x20a1('0x21')](handleEntityNotFound(_0x53cb24,null))['then'](respondWithResult(_0x53cb24,null))[_0x20a1('0x42')](handleError(_0x53cb24,null));};exports[_0x20a1('0x48')]=function(_0x545cd5,_0x2f0328){return db['Schedule'][_0x20a1('0x48')](_0x545cd5[_0x20a1('0x49')],{})[_0x20a1('0x21')](function(_0x2ce84e){var _0x532863=_0x545cd5[_0x20a1('0x4a')][_0x20a1('0x23')]({'plain':!![]});if(!_0x532863)throw new Error(_0x20a1('0x4b'));if(_0x532863[_0x20a1('0x4c')]===_0x20a1('0x4a')){var _0x4f54f2=_0x2ce84e[_0x20a1('0x23')]({'plain':!![]});var _0x1c1165=_0x20a1('0x24');return db[_0x20a1('0x4d')]['find']({'where':{'name':_0x1c1165,'userProfileId':_0x532863[_0x20a1('0x4e')]},'raw':!![]})[_0x20a1('0x21')](function(_0x2535de){if(_0x2535de&&_0x2535de['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4f54f2[_0x20a1('0x28')],'resourceId':_0x4f54f2['id'],'type':_0x2535de['name'],'sectionId':_0x2535de['id']},{})[_0x20a1('0x21')](function(){return _0x2ce84e;});}else{return _0x2ce84e;}})['catch'](function(_0x371357){logger[_0x20a1('0x4f')](_0x20a1('0x50'),_0x371357);throw _0x371357;});}return _0x2ce84e;})[_0x20a1('0x21')](respondWithResult(_0x2f0328,0xc9))[_0x20a1('0x42')](handleError(_0x2f0328,null));};exports[_0x20a1('0x20')]=function(_0x18f48a,_0x46a0fc){if(_0x18f48a[_0x20a1('0x49')]['id']){delete _0x18f48a['body']['id'];}return db[_0x20a1('0x2c')][_0x20a1('0x47')]({'where':{'id':_0x18f48a[_0x20a1('0x43')]['id']}})['then'](handleEntityNotFound(_0x46a0fc,null))['then'](saveUpdates(_0x18f48a[_0x20a1('0x49')],null))[_0x20a1('0x21')](respondWithResult(_0x46a0fc,null))[_0x20a1('0x42')](handleError(_0x46a0fc,null));};exports['destroy']=function(_0x2bf403,_0x2be8b5){return db[_0x20a1('0x2c')][_0x20a1('0x47')]({'where':{'id':_0x2bf403[_0x20a1('0x43')]['id']}})[_0x20a1('0x21')](handleEntityNotFound(_0x2be8b5,null))['then'](removeEntity(_0x2be8b5,null))[_0x20a1('0x42')](handleError(_0x2be8b5,null));};exports[_0x20a1('0x51')]=function(_0x2d1d6e,_0xe9af5e,_0x16c4cf){var _0xc43f28=require(_0x20a1('0x52'));return db['Schedule']['find']({'where':{'id':_0x2d1d6e['params']['id']},'raw':!![]})[_0x20a1('0x21')](handleEntityNotFound(_0xe9af5e,null))['then'](function(){_0xc43f28[_0x20a1('0x51')](_0x2d1d6e[_0x20a1('0x43')]['id']);})[_0x20a1('0x21')](respondWithStatusCode(_0xe9af5e,null))[_0x20a1('0x42')](handleError(_0xe9af5e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 80b2bcf..12d781f 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 _0xa589=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_schedules'];(function(_0x4b80eb,_0x392b29){var _0x42ec95=function(_0x36d2ea){while(--_0x36d2ea){_0x4b80eb['push'](_0x4b80eb['shift']());}};_0x42ec95(++_0x392b29);}(_0xa589,0xe1));var _0x9a58=function(_0x3cec7e,_0x9decf5){_0x3cec7e=_0x3cec7e-0x0;var _0xdb488d=_0xa589[_0x3cec7e];return _0xdb488d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9a58('0x0'));var moment=require(_0x9a58('0x1'));var BPromise=require(_0x9a58('0x2'));var rp=require(_0x9a58('0x3'));var fs=require('fs');var path=require(_0x9a58('0x4'));var rimraf=require(_0x9a58('0x5'));var config=require(_0x9a58('0x6'));var attributes=require('./schedule.attributes');module[_0x9a58('0x7')]=function(_0x216637,_0xa62ab7){return _0x216637['define']('Schedule',attributes,{'tableName':_0x9a58('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa63e=['./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x44c271,_0x2a3f7c){var _0x38b5bc=function(_0x42a94c){while(--_0x42a94c){_0x44c271['push'](_0x44c271['shift']());}};_0x38b5bc(++_0x2a3f7c);}(_0xa63e,0x13c));var _0xea63=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa63e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xea63('0x0'));var util=require(_0xea63('0x1'));var logger=require(_0xea63('0x2'))(_0xea63('0x3'));var moment=require('moment');var BPromise=require(_0xea63('0x4'));var rp=require(_0xea63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea63('0x6'));var config=require(_0xea63('0x7'));var attributes=require(_0xea63('0x8'));module['exports']=function(_0x28ec3a,_0x278052){return _0x28ec3a[_0xea63('0x9')](_0xea63('0xa'),attributes,{'tableName':_0xea63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 48d39f5..26b1093 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 _0x307c=['catch','lodash','moment','../../mysqldb','../../config/environment','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x307c,0x1a1));var _0xc307=function(_0x87e53f,_0x37a3b9){_0x87e53f=_0x87e53f-0x0;var _0x5177ac=_0x307c[_0x87e53f];return _0x5177ac;};'use strict';var _=require(_0xc307('0x0'));var util=require('util');var moment=require(_0xc307('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc307('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc307('0x3'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bee40,_0x24269d,_0x3e48a2){return new BPromise(function(_0x32ac4,_0x370e49){return client[_0xc307('0x4')](_0x5bee40,_0x3e48a2)['then'](function(_0x3b6190){logger['info'](_0xc307('0x5'),_0x24269d,_0xc307('0x6'));logger['debug'](_0xc307('0x7'),_0x24269d,_0xc307('0x6'),JSON['stringify'](_0x3b6190));if(_0x3b6190[_0xc307('0x8')]){if(_0x3b6190[_0xc307('0x8')][_0xc307('0x9')]===0x1f4){logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x3b6190['error']['message']);return _0x370e49(_0x3b6190['error'][_0xc307('0xa')]);}logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x3b6190[_0xc307('0x8')][_0xc307('0xa')]);return _0x32ac4(_0x3b6190['error'][_0xc307('0xa')]);}else{logger['info'](_0xc307('0x5'),_0x24269d,_0xc307('0x6'));_0x32ac4(_0x3b6190[_0xc307('0xb')]['message']);}})[_0xc307('0xc')](function(_0x216568){logger[_0xc307('0x8')](_0xc307('0x5'),_0x24269d,_0x216568);_0x370e49(_0x216568);});});} \ No newline at end of file +var _0xb76f=['../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x511019,_0x57e5a7){var _0x101183=function(_0x58ab2a){while(--_0x58ab2a){_0x511019['push'](_0x511019['shift']());}};_0x101183(++_0x57e5a7);}(_0xb76f,0x16e));var _0xfb76=function(_0x3299c2,_0x51f479){_0x3299c2=_0x3299c2-0x0;var _0x2cdc44=_0xb76f[_0x3299c2];return _0x2cdc44;};'use strict';var _=require(_0xfb76('0x0'));var util=require(_0xfb76('0x1'));var moment=require(_0xfb76('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb76('0x4'))['db'];var utils=require(_0xfb76('0x5'));var logger=require(_0xfb76('0x6'))(_0xfb76('0x7'));var config=require(_0xfb76('0x8'));var jayson=require(_0xfb76('0x9'));var client=jayson[_0xfb76('0xa')][_0xfb76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b69e,_0x5086b7,_0x2a2784){return new BPromise(function(_0xb1fc65,_0x118f5f){return client[_0xfb76('0xc')](_0x33b69e,_0x2a2784)['then'](function(_0x42dc74){logger[_0xfb76('0xd')](_0xfb76('0xe'),_0x5086b7,_0xfb76('0xf'));logger[_0xfb76('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5086b7,'request\x20sent',JSON[_0xfb76('0x11')](_0x42dc74));if(_0x42dc74[_0xfb76('0x12')]){if(_0x42dc74[_0xfb76('0x12')][_0xfb76('0x13')]===0x1f4){logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x42dc74['error'][_0xfb76('0x14')]);return _0x118f5f(_0x42dc74['error'][_0xfb76('0x14')]);}logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x42dc74['error'][_0xfb76('0x14')]);return _0xb1fc65(_0x42dc74[_0xfb76('0x12')][_0xfb76('0x14')]);}else{logger[_0xfb76('0xd')](_0xfb76('0xe'),_0x5086b7,'request\x20sent');_0xb1fc65(_0x42dc74[_0xfb76('0x15')][_0xfb76('0x14')]);}})['catch'](function(_0x4470d8){logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x4470d8);_0x118f5f(_0x4470d8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fe51870..c455bcc 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 _0xf75e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x24ba52,_0x572ede){var _0x5b6197=function(_0x4641bf){while(--_0x4641bf){_0x24ba52['push'](_0x24ba52['shift']());}};_0x5b6197(++_0x572ede);}(_0xf75e,0x11d));var _0xef75=function(_0x3cf519,_0x205bb4){_0x3cf519=_0x3cf519-0x0;var _0x30c5ae=_0xf75e[_0x3cf519];return _0x30c5ae;};'use strict';var multer=require(_0xef75('0x0'));var util=require(_0xef75('0x1'));var path=require(_0xef75('0x2'));var timeout=require(_0xef75('0x3'));var express=require('express');var router=express[_0xef75('0x4')]();var auth=require(_0xef75('0x5'));var interaction=require(_0xef75('0x6'));var config=require(_0xef75('0x7'));var controller=require('./screenRecording.controller');router[_0xef75('0x8')]('/',auth[_0xef75('0x9')](),controller[_0xef75('0xa')]);router[_0xef75('0x8')](_0xef75('0xb'),auth['isAuthenticated'](),controller[_0xef75('0xc')]);router[_0xef75('0x8')](_0xef75('0xd'),auth[_0xef75('0x9')](),controller[_0xef75('0xe')]);router[_0xef75('0x8')](_0xef75('0xf'),auth[_0xef75('0x9')](),controller[_0xef75('0x10')]);router[_0xef75('0x11')]('/',auth['isAuthenticated'](),controller[_0xef75('0x12')]);router[_0xef75('0x13')](_0xef75('0xd'),auth[_0xef75('0x9')](),controller[_0xef75('0x14')]);router[_0xef75('0x15')]('/:id',auth[_0xef75('0x9')](),controller[_0xef75('0x16')]);module[_0xef75('0x17')]=router; \ No newline at end of file +var _0xcb4e=['delete','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','download','post','put','update'];(function(_0x411f8d,_0x34f587){var _0x7997a5=function(_0x194de0){while(--_0x194de0){_0x411f8d['push'](_0x411f8d['shift']());}};_0x7997a5(++_0x34f587);}(_0xcb4e,0x134));var _0xecb4=function(_0x3eaf3b,_0xc8ebc3){_0x3eaf3b=_0x3eaf3b-0x0;var _0x9bc405=_0xcb4e[_0x3eaf3b];return _0x9bc405;};'use strict';var multer=require(_0xecb4('0x0'));var util=require(_0xecb4('0x1'));var path=require('path');var timeout=require(_0xecb4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xecb4('0x3'));var config=require(_0xecb4('0x4'));var controller=require('./screenRecording.controller');router[_0xecb4('0x5')]('/',auth[_0xecb4('0x6')](),controller[_0xecb4('0x7')]);router['get'](_0xecb4('0x8'),auth[_0xecb4('0x6')](),controller[_0xecb4('0x9')]);router[_0xecb4('0x5')]('/:id',auth[_0xecb4('0x6')](),controller[_0xecb4('0xa')]);router[_0xecb4('0x5')]('/:id/download',auth[_0xecb4('0x6')](),controller[_0xecb4('0xb')]);router[_0xecb4('0xc')]('/',auth[_0xecb4('0x6')](),controller['create']);router[_0xecb4('0xd')]('/:id',auth[_0xecb4('0x6')](),controller[_0xecb4('0xe')]);router[_0xecb4('0xf')]('/:id',auth[_0xecb4('0x6')](),controller['destroy']);module[_0xecb4('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index fcf7c9f..9994905 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 _0x2bd8=['sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt'];(function(_0x470223,_0x401b00){var _0x2fde5a=function(_0x46fc84){while(--_0x46fc84){_0x470223['push'](_0x470223['shift']());}};_0x2fde5a(++_0x401b00);}(_0x2bd8,0x130));var _0x82bd=function(_0x46fe32,_0x58700f){_0x46fe32=_0x46fe32-0x0;var _0x5195ce=_0x2bd8[_0x46fe32];return _0x5195ce;};'use strict';var Sequelize=require(_0x82bd('0x0'));var moment=require('moment');var path=require(_0x82bd('0x1'));var config=require(_0x82bd('0x2'));module[_0x82bd('0x3')]={'format':{'type':Sequelize[_0x82bd('0x4')],'get':function(){return this[_0x82bd('0x5')](_0x82bd('0x6'))?path[_0x82bd('0x7')](this['getDataValue'](_0x82bd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x82bd('0x8')]},'channel':{'type':Sequelize[_0x82bd('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x19dbb1){var _0x77d7a9=_0x19dbb1[_0x82bd('0x9')](/\\/g,'/');this[_0x82bd('0xa')]('value',_0x77d7a9);}},'rating':{'type':Sequelize[_0x82bd('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4a9b2c){this['setDataValue'](_0x82bd('0xc'),moment()['subtract'](_0x4a9b2c,'ms'));this['setDataValue'](_0x82bd('0xd'),moment());this['setDataValue']('duration',_0x4a9b2c);}},'startedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('startedAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0xd')))[_0x82bd('0xf')](_0x82bd('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('createdAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'updatedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0x12')))[_0x82bd('0xf')](_0x82bd('0x11'))[_0x82bd('0x10')]();}}}; \ No newline at end of file +var _0x55ca=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','extname','value'];(function(_0x34ef44,_0x462e43){var _0x5ca03b=function(_0x40be90){while(--_0x40be90){_0x34ef44['push'](_0x34ef44['shift']());}};_0x5ca03b(++_0x462e43);}(_0x55ca,0x126));var _0xa55c=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x55ca[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xa55c('0x2')],'get':function(){return this[_0xa55c('0x3')]('value')?path[_0xa55c('0x4')](this[_0xa55c('0x3')](_0xa55c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa55c('0x6')]},'channel':{'type':Sequelize[_0xa55c('0x6')]},'value':{'type':Sequelize[_0xa55c('0x6')],'set':function(_0x36b623){var _0x4d0624=_0x36b623[_0xa55c('0x7')](/\\/g,'/');this[_0xa55c('0x8')]('value',_0x4d0624);}},'rating':{'type':Sequelize[_0xa55c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa55c('0x9')],'set':function(_0x52a3bc){this['setDataValue'](_0xa55c('0xa'),moment()[_0xa55c('0xb')](_0x52a3bc,'ms'));this[_0xa55c('0x8')](_0xa55c('0xc'),moment());this[_0xa55c('0x8')](_0xa55c('0xd'),_0x52a3bc);}},'startedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0xa')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0xa55c('0x10'))[_0xa55c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x12')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xa55c('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x13')))[_0xa55c('0xf')](_0xa55c('0x10'))[_0xa55c('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ccebe62..2ace8ee 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 _0x93dc=['util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x93dc,0xc8));var _0xc93d=function(_0x3a3853,_0x336839){_0x3a3853=_0x3a3853-0x0;var _0x112a71=_0x93dc[_0x3a3853];return _0x112a71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc93d('0x0'));var rimraf=require(_0xc93d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc93d('0x2'));var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var Mustache=require(_0xc93d('0x5'));var util=require(_0xc93d('0x6'));var path=require('path');var sox=require(_0xc93d('0x7'));var csv=require(_0xc93d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc93d('0x9'));var crypto=require(_0xc93d('0xa'));var jsforce=require(_0xc93d('0xb'));var deskjs=require(_0xc93d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc93d('0xd'));var Papa=require('papaparse');var Redis=require(_0xc93d('0xe'));var authService=require(_0xc93d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93d('0x10'));var logger=require(_0xc93d('0x11'))(_0xc93d('0x12'));var utils=require(_0xc93d('0x13'));var config=require(_0xc93d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc93d('0x15'))['db'];function respondWithStatusCode(_0x47a8db,_0x2d3ef3){_0x2d3ef3=_0x2d3ef3||0xcc;return function(_0x3e42fa){if(_0x3e42fa){return _0x47a8db[_0xc93d('0x16')](_0x2d3ef3);}return _0x47a8db['status'](_0x2d3ef3)[_0xc93d('0x17')]();};}function respondWithResult(_0x3d7714,_0x2feaac){_0x2feaac=_0x2feaac||0xc8;return function(_0x52dd21){if(_0x52dd21){return _0x3d7714[_0xc93d('0x18')](_0x2feaac)[_0xc93d('0x19')](_0x52dd21);}};}function respondWithFilteredResult(_0x5424e2,_0x2f18bc){return function(_0x3794c1){if(_0x3794c1){var _0x46a227=_0x3794c1[_0xc93d('0x1a')],_0x539995=_0x2f18bc[_0xc93d('0x1b')],_0x38bbdb=_0x2f18bc['offset']+_0x2f18bc['limit'],_0x1eecfe;if(_0x38bbdb>=_0x46a227){_0x38bbdb=_0x46a227;_0x1eecfe=0xc8;}else{_0x1eecfe=0xce;}_0x5424e2[_0xc93d('0x18')](_0x1eecfe);return _0x5424e2[_0xc93d('0x1c')](_0xc93d('0x1d'),_0x539995+'-'+_0x38bbdb+'/'+_0x46a227)[_0xc93d('0x19')](_0x3794c1);}return null;};}function patchUpdates(_0x33a923){return function(_0x441dce){try{jsonpatch[_0xc93d('0x1e')](_0x441dce,_0x33a923,!![]);}catch(_0x46ff2b){return BPromise[_0xc93d('0x1f')](_0x46ff2b);}return _0x441dce['save']();};}function saveUpdates(_0x516586,_0x45f591){return function(_0x2e0927){if(_0x2e0927){return _0x2e0927[_0xc93d('0x20')](_0x516586)['then'](function(_0xde6340){return _0xde6340;});}return null;};}function removeEntity(_0x546c21,_0x119eb5){return function(_0x59654d){if(_0x59654d){return _0x59654d[_0xc93d('0x21')]()[_0xc93d('0x22')](function(){_0x546c21[_0xc93d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x414346,_0x21c1e8){return function(_0x500a99){if(!_0x500a99){_0x414346[_0xc93d('0x16')](0x194);}return _0x500a99;};}function handleError(_0x241281,_0x4e3d2e){_0x4e3d2e=_0x4e3d2e||0x1f4;return function(_0x104333){logger[_0xc93d('0x23')](_0x104333[_0xc93d('0x24')]);if(_0x104333[_0xc93d('0x25')]){delete _0x104333[_0xc93d('0x25')];}_0x241281[_0xc93d('0x18')](_0x4e3d2e)['send'](_0x104333);};}exports[_0xc93d('0x26')]=function(_0xe2caa7,_0x1535db){var _0xe48a87={},_0x51da1c={},_0x2485d1={'count':0x0,'rows':[]};var _0x527ff2=_['map'](db[_0xc93d('0x27')][_0xc93d('0x28')],function(_0x5cf6ce){return{'name':_0x5cf6ce['fieldName'],'type':_0x5cf6ce['type'][_0xc93d('0x29')]};});_0x51da1c[_0xc93d('0x2a')]=_[_0xc93d('0x2b')](_[_0xc93d('0x2c')](_0x527ff2,_0xc93d('0x25')),[_0xc93d('0x2d')]);_0x51da1c[_0xc93d('0x2e')]=_['keys'](_0xe2caa7[_0xc93d('0x2e')]);_0x51da1c[_0xc93d('0x2f')]=_[_0xc93d('0x30')](_0x51da1c[_0xc93d('0x2a')],_0x51da1c[_0xc93d('0x2e')]);_0xe48a87[_0xc93d('0x31')]=_[_0xc93d('0x30')](_0x51da1c[_0xc93d('0x2a')],qs['fields'](_0xe2caa7['query'][_0xc93d('0x32')]));_0xe48a87['attributes']=_0xe48a87[_0xc93d('0x31')][_0xc93d('0x33')]?_0xe48a87[_0xc93d('0x31')]:_0x51da1c[_0xc93d('0x2a')];if(!_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x34')](_0xc93d('0x35'))){_0xe48a87[_0xc93d('0x36')]=qs[_0xc93d('0x36')](_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x36')]);_0xe48a87[_0xc93d('0x1b')]=qs[_0xc93d('0x1b')](_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x1b')]);}_0xe48a87[_0xc93d('0x37')]=qs[_0xc93d('0x38')](_0xe2caa7[_0xc93d('0x2e')]['sort']);_0xe48a87[_0xc93d('0x39')]=qs[_0xc93d('0x2f')](_['pick'](_0xe2caa7[_0xc93d('0x2e')],_0x51da1c[_0xc93d('0x2f')]),_0x527ff2);if(_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3a')]){_0xe48a87['where']=_[_0xc93d('0x3b')](_0xe48a87[_0xc93d('0x39')],{'$or':_['map'](_0x527ff2,function(_0x4af415){if(_0x4af415[_0xc93d('0x3c')]!==_0xc93d('0x3d')){var _0x7e8ba0={};_0x7e8ba0[_0x4af415[_0xc93d('0x25')]]={'$like':'%'+_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3a')]+'%'};return _0x7e8ba0;}})});}_0xe48a87=_[_0xc93d('0x3b')]({},_0xe48a87,_0xe2caa7[_0xc93d('0x3e')]);var _0x130c63={'where':_0xe48a87[_0xc93d('0x39')]};return db[_0xc93d('0x27')][_0xc93d('0x1a')](_0x130c63)[_0xc93d('0x22')](function(_0x2ca403){_0x2485d1[_0xc93d('0x1a')]=_0x2ca403;if(_0xe2caa7[_0xc93d('0x2e')][_0xc93d('0x3f')]){_0xe48a87[_0xc93d('0x40')]=[{'all':!![]}];}return db[_0xc93d('0x27')][_0xc93d('0x41')](_0xe48a87);})[_0xc93d('0x22')](function(_0x4ba60a){_0x2485d1['rows']=_0x4ba60a;return _0x2485d1;})[_0xc93d('0x22')](respondWithFilteredResult(_0x1535db,_0xe48a87))[_0xc93d('0x42')](handleError(_0x1535db,null));};exports[_0xc93d('0x43')]=function(_0x3c0cc2,_0x6966f5){var _0xec2d7c={'raw':![],'where':{'id':_0x3c0cc2[_0xc93d('0x44')]['id']}},_0x390f01={};_0x390f01[_0xc93d('0x2a')]=_[_0xc93d('0x45')](db[_0xc93d('0x27')][_0xc93d('0x28')]);_0x390f01[_0xc93d('0x2e')]=_[_0xc93d('0x45')](_0x3c0cc2[_0xc93d('0x2e')]);_0x390f01[_0xc93d('0x2f')]=_[_0xc93d('0x30')](_0x390f01[_0xc93d('0x2a')],_0x390f01['query']);_0xec2d7c[_0xc93d('0x31')]=_['intersection'](_0x390f01[_0xc93d('0x2a')],qs[_0xc93d('0x32')](_0x3c0cc2[_0xc93d('0x2e')]['fields']));_0xec2d7c[_0xc93d('0x31')]=_0xec2d7c[_0xc93d('0x31')][_0xc93d('0x33')]?_0xec2d7c['attributes']:_0x390f01[_0xc93d('0x2a')];if(_0x3c0cc2[_0xc93d('0x2e')]['includeAll']){_0xec2d7c[_0xc93d('0x40')]=[{'all':!![]}];}_0xec2d7c=_[_0xc93d('0x3b')]({},_0xec2d7c,_0x3c0cc2[_0xc93d('0x3e')]);return db[_0xc93d('0x27')][_0xc93d('0x46')](_0xec2d7c)[_0xc93d('0x22')](handleEntityNotFound(_0x6966f5,null))[_0xc93d('0x22')](respondWithResult(_0x6966f5,null))[_0xc93d('0x42')](handleError(_0x6966f5,null));};exports[_0xc93d('0x47')]=function(_0x357266,_0x42bed2){return db['ScreenRecording'][_0xc93d('0x47')](_0x357266[_0xc93d('0x48')],{})['then'](respondWithResult(_0x42bed2,0xc9))[_0xc93d('0x42')](handleError(_0x42bed2,null));};exports[_0xc93d('0x20')]=function(_0x2f441b,_0x3094bd){if(_0x2f441b[_0xc93d('0x48')]['id']){delete _0x2f441b[_0xc93d('0x48')]['id'];}delete _0x2f441b['body'][_0xc93d('0x49')];delete _0x2f441b['body'][_0xc93d('0x4a')];delete _0x2f441b[_0xc93d('0x48')][_0xc93d('0x4b')];delete _0x2f441b[_0xc93d('0x48')][_0xc93d('0x4c')];return db['ScreenRecording'][_0xc93d('0x46')]({'where':{'id':_0x2f441b[_0xc93d('0x44')]['id']}})[_0xc93d('0x22')](handleEntityNotFound(_0x3094bd,null))[_0xc93d('0x22')](saveUpdates(_0x2f441b['body'],null))[_0xc93d('0x22')](respondWithResult(_0x3094bd,null))[_0xc93d('0x42')](handleError(_0x3094bd,null));};exports['describe']=function(_0xb43af0,_0x1c022a){return db[_0xc93d('0x27')][_0xc93d('0x4d')]()[_0xc93d('0x22')](respondWithResult(_0x1c022a,null))[_0xc93d('0x42')](handleError(_0x1c022a,null));};exports[_0xc93d('0x4e')]=function(_0x21ee98,_0x26eada,_0x40d275){var _0x4f70fd=require(_0xc93d('0x4f'));var _0x476699=![];var _0x42318b={};if(_0x21ee98[_0xc93d('0x2e')][_0xc93d('0x3c')]&&_0x21ee98[_0xc93d('0x2e')][_0xc93d('0x3c')]===_0xc93d('0x50')){_0x42318b[_0xc93d('0x50')]=_0x21ee98[_0xc93d('0x44')]['id'];}else{_0x42318b['id']=_0x21ee98[_0xc93d('0x44')]['id'];}return db[_0xc93d('0x27')][_0xc93d('0x46')]({'where':_0x42318b,'attributes':['id',_0xc93d('0x4c')],'raw':!![]})[_0xc93d('0x22')](handleEntityNotFound(_0x26eada,null))['then'](function(_0x5d26e9){if(_0x5d26e9){var _0x4a75d9=path[_0xc93d('0x51')](config[_0xc93d('0x52')],_0xc93d('0x53'),_0x5d26e9[_0xc93d('0x4c')]);var _0x24711c=util[_0xc93d('0x2d')](_0xc93d('0x54'),_0x4a75d9);if(fs[_0xc93d('0x55')](_0x24711c)){_0x476699=!![];return _0x4f70fd[_0xc93d('0x56')](_0x24711c,_0x4a75d9,config['secrets'][_0xc93d('0x57')])[_0xc93d('0x22')](function(){return _0x5d26e9;});}return _0x5d26e9;}})[_0xc93d('0x22')](function(_0x23199f){if(_0x23199f){var _0x201519=path['join'](config['root'],_0xc93d('0x53'),_0x23199f['value']);if(!fs[_0xc93d('0x55')](_0x201519)){throw new db[(_0xc93d('0x58'))][(_0xc93d('0x59'))](_0xc93d('0x5a'));}if(_0x23199f[_0xc93d('0x5b')]){return _0x26eada[_0xc93d('0x4e')](_0x201519,_0x23199f[_0xc93d('0x5b')]+path[_0xc93d('0x5c')](_0x201519),function(){if(_0x476699){fs[_0xc93d('0x5d')](_0x201519);}});}else{return _0x26eada[_0xc93d('0x4e')](_0x201519,function(_0x5411ec){if(_0x476699){fs[_0xc93d('0x5d')](_0x201519);}});}}})['catch'](function(_0x54a2e0){if(_0x54a2e0[_0xc93d('0x5e')]===_0xc93d('0x5a')){_0x26eada['status'](0x194)[_0xc93d('0x5f')]('Not\x20found');}else{return handleError(_0x26eada,null);}});};exports[_0xc93d('0x21')]=function(_0x5b9d6f,_0x20d3c9){return db[_0xc93d('0x27')][_0xc93d('0x46')]({'where':{'id':_0x5b9d6f[_0xc93d('0x44')]['id']}})['then'](function(_0x3a843b){if(!_0x3a843b)throw new ReferenceError(_0xc93d('0x60'));return _0x3a843b;})[_0xc93d('0x22')](function(_0xb77a19){var _0x19aedd=path[_0xc93d('0x51')](config[_0xc93d('0x52')],_0xc93d('0x53'),_0xb77a19[_0xc93d('0x4c')]);logger[_0xc93d('0x61')](_0xc93d('0x62'),_0x19aedd);if(!_['isNil'](_0xb77a19[_0xc93d('0x4c')])&&fs[_0xc93d('0x55')](_0x19aedd)){logger[_0xc93d('0x61')](_0xc93d('0x63')+_0x19aedd+_0xc93d('0x64'));fs['unlinkSync'](_0x19aedd);}_0x19aedd=_0x19aedd+_0xc93d('0x65');if(!_['isNil'](_0xb77a19[_0xc93d('0x4c')])&&fs[_0xc93d('0x55')](_0x19aedd)){logger[_0xc93d('0x61')](_0xc93d('0x63')+_0x19aedd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc93d('0x66')](_0x19aedd);}return _0xb77a19;})[_0xc93d('0x22')](function(_0x39488d){if(!_0x39488d)throw new InternalError();return _0x39488d[_0xc93d('0x21')]();})['then'](function(){_0x20d3c9[_0xc93d('0x18')](0xcc)[_0xc93d('0x17')]();})['catch'](handleError(_0x20d3c9,null));}; \ No newline at end of file +var _0xcf60=['findAll','params','rawAttributes','length','find','catch','create','body','duration','createdAt','describe','download','../../components/encryptor','uniqueid','value','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','join','root','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ScreenRecording','fieldName','type','key','differenceBy','format','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll'];(function(_0x4d38b9,_0x323a8b){var _0x5c734d=function(_0x4d2185){while(--_0x4d2185){_0x4d38b9['push'](_0x4d38b9['shift']());}};_0x5c734d(++_0x323a8b);}(_0xcf60,0x1d1));var _0x0cf6=function(_0x160665,_0x2504f0){_0x160665=_0x160665-0x0;var _0x469385=_0xcf60[_0x160665];return _0x469385;};'use strict';var pdf=require(_0x0cf6('0x0'));var emlformat=require(_0x0cf6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0cf6('0x2'));var jsonpatch=require(_0x0cf6('0x3'));var rp=require(_0x0cf6('0x4'));var moment=require('moment');var BPromise=require(_0x0cf6('0x5'));var Mustache=require(_0x0cf6('0x6'));var util=require(_0x0cf6('0x7'));var path=require(_0x0cf6('0x8'));var sox=require(_0x0cf6('0x9'));var csv=require(_0x0cf6('0xa'));var ejs=require(_0x0cf6('0xb'));var fs=require('fs');var _=require(_0x0cf6('0xc'));var squel=require(_0x0cf6('0xd'));var crypto=require('crypto');var jsforce=require(_0x0cf6('0xe'));var deskjs=require(_0x0cf6('0xf'));var toCsv=require(_0x0cf6('0xa'));var querystring=require(_0x0cf6('0x10'));var Papa=require(_0x0cf6('0x11'));var Redis=require('ioredis');var authService=require(_0x0cf6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0cf6('0x13'));var hardwareService=require(_0x0cf6('0x14'));var logger=require(_0x0cf6('0x15'))(_0x0cf6('0x16'));var utils=require('../../config/utils');var config=require(_0x0cf6('0x17'));var licenseUtil=require(_0x0cf6('0x18'));var db=require(_0x0cf6('0x19'))['db'];function respondWithStatusCode(_0x1c9c6e,_0x330c13){_0x330c13=_0x330c13||0xcc;return function(_0x451789){if(_0x451789){return _0x1c9c6e[_0x0cf6('0x1a')](_0x330c13);}return _0x1c9c6e[_0x0cf6('0x1b')](_0x330c13)[_0x0cf6('0x1c')]();};}function respondWithResult(_0x4145f1,_0x3e3c4e){_0x3e3c4e=_0x3e3c4e||0xc8;return function(_0x35fa5b){if(_0x35fa5b){return _0x4145f1['status'](_0x3e3c4e)[_0x0cf6('0x1d')](_0x35fa5b);}};}function respondWithFilteredResult(_0x4ce5a9,_0x291cbf){return function(_0x1e5bab){if(_0x1e5bab){var _0x5bc6a6=_0x1e5bab['count'],_0x408dc3=_0x291cbf[_0x0cf6('0x1e')],_0x1cd2e2=_0x291cbf[_0x0cf6('0x1e')]+_0x291cbf[_0x0cf6('0x1f')],_0x336bf4;if(_0x1cd2e2>=_0x5bc6a6){_0x1cd2e2=_0x5bc6a6;_0x336bf4=0xc8;}else{_0x336bf4=0xce;}_0x4ce5a9[_0x0cf6('0x1b')](_0x336bf4);return _0x4ce5a9[_0x0cf6('0x20')](_0x0cf6('0x21'),_0x408dc3+'-'+_0x1cd2e2+'/'+_0x5bc6a6)[_0x0cf6('0x1d')](_0x1e5bab);}return null;};}function patchUpdates(_0x535f08){return function(_0x172847){try{jsonpatch[_0x0cf6('0x22')](_0x172847,_0x535f08,!![]);}catch(_0x473527){return BPromise[_0x0cf6('0x23')](_0x473527);}return _0x172847[_0x0cf6('0x24')]();};}function saveUpdates(_0x4037bc,_0x3f8297){return function(_0x2742f4){if(_0x2742f4){return _0x2742f4[_0x0cf6('0x25')](_0x4037bc)[_0x0cf6('0x26')](function(_0xcf957d){return _0xcf957d;});}return null;};}function removeEntity(_0x4a95d6,_0x938b37){return function(_0x9db8e3){if(_0x9db8e3){return _0x9db8e3[_0x0cf6('0x27')]()[_0x0cf6('0x26')](function(){_0x4a95d6['status'](0xcc)[_0x0cf6('0x1c')]();});}};}function handleEntityNotFound(_0x33b051,_0x265209){return function(_0x1f72f0){if(!_0x1f72f0){_0x33b051['sendStatus'](0x194);}return _0x1f72f0;};}function handleError(_0xa2be10,_0x1e78b3){_0x1e78b3=_0x1e78b3||0x1f4;return function(_0x18b533){logger[_0x0cf6('0x28')](_0x18b533['stack']);if(_0x18b533['name']){delete _0x18b533[_0x0cf6('0x29')];}_0xa2be10[_0x0cf6('0x1b')](_0x1e78b3)[_0x0cf6('0x2a')](_0x18b533);};}exports[_0x0cf6('0x2b')]=function(_0x2c0ff3,_0xb2995a){var _0x35b785={},_0x24c091={},_0x3ac5e3={'count':0x0,'rows':[]};var _0x5232f2=_[_0x0cf6('0x2c')](db[_0x0cf6('0x2d')]['rawAttributes'],function(_0x4396ba){return{'name':_0x4396ba[_0x0cf6('0x2e')],'type':_0x4396ba[_0x0cf6('0x2f')][_0x0cf6('0x30')]};});_0x24c091['model']=_[_0x0cf6('0x31')](_[_0x0cf6('0x2c')](_0x5232f2,'name'),[_0x0cf6('0x32')]);_0x24c091[_0x0cf6('0x33')]=_[_0x0cf6('0x34')](_0x2c0ff3[_0x0cf6('0x33')]);_0x24c091[_0x0cf6('0x35')]=_['intersection'](_0x24c091[_0x0cf6('0x36')],_0x24c091[_0x0cf6('0x33')]);_0x35b785['attributes']=_[_0x0cf6('0x37')](_0x24c091[_0x0cf6('0x36')],qs[_0x0cf6('0x38')](_0x2c0ff3['query'][_0x0cf6('0x38')]));_0x35b785[_0x0cf6('0x39')]=_0x35b785[_0x0cf6('0x39')]['length']?_0x35b785[_0x0cf6('0x39')]:_0x24c091[_0x0cf6('0x36')];if(!_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3a')](_0x0cf6('0x3b'))){_0x35b785['limit']=qs[_0x0cf6('0x1f')](_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x1f')]);_0x35b785[_0x0cf6('0x1e')]=qs[_0x0cf6('0x1e')](_0x2c0ff3['query'][_0x0cf6('0x1e')]);}_0x35b785[_0x0cf6('0x3c')]=qs['sort'](_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3d')]);_0x35b785['where']=qs['filters'](_[_0x0cf6('0x3e')](_0x2c0ff3[_0x0cf6('0x33')],_0x24c091[_0x0cf6('0x35')]),_0x5232f2);if(_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3f')]){_0x35b785[_0x0cf6('0x40')]=_['merge'](_0x35b785[_0x0cf6('0x40')],{'$or':_[_0x0cf6('0x2c')](_0x5232f2,function(_0x54fee0){if(_0x54fee0[_0x0cf6('0x2f')]!==_0x0cf6('0x41')){var _0xaf43c8={};_0xaf43c8[_0x54fee0[_0x0cf6('0x29')]]={'$like':'%'+_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3f')]+'%'};return _0xaf43c8;}})});}_0x35b785=_[_0x0cf6('0x42')]({},_0x35b785,_0x2c0ff3[_0x0cf6('0x43')]);var _0x377452={'where':_0x35b785[_0x0cf6('0x40')]};return db[_0x0cf6('0x2d')]['count'](_0x377452)[_0x0cf6('0x26')](function(_0x759303){_0x3ac5e3[_0x0cf6('0x44')]=_0x759303;if(_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x45')]){_0x35b785['include']=[{'all':!![]}];}return db[_0x0cf6('0x2d')][_0x0cf6('0x46')](_0x35b785);})[_0x0cf6('0x26')](function(_0x5cc204){_0x3ac5e3['rows']=_0x5cc204;return _0x3ac5e3;})['then'](respondWithFilteredResult(_0xb2995a,_0x35b785))['catch'](handleError(_0xb2995a,null));};exports['show']=function(_0x4c73ad,_0x5f5a62){var _0x21bbce={'raw':![],'where':{'id':_0x4c73ad[_0x0cf6('0x47')]['id']}},_0x563ce2={};_0x563ce2[_0x0cf6('0x36')]=_[_0x0cf6('0x34')](db[_0x0cf6('0x2d')][_0x0cf6('0x48')]);_0x563ce2[_0x0cf6('0x33')]=_[_0x0cf6('0x34')](_0x4c73ad['query']);_0x563ce2[_0x0cf6('0x35')]=_[_0x0cf6('0x37')](_0x563ce2[_0x0cf6('0x36')],_0x563ce2[_0x0cf6('0x33')]);_0x21bbce[_0x0cf6('0x39')]=_[_0x0cf6('0x37')](_0x563ce2['model'],qs['fields'](_0x4c73ad[_0x0cf6('0x33')][_0x0cf6('0x38')]));_0x21bbce[_0x0cf6('0x39')]=_0x21bbce[_0x0cf6('0x39')][_0x0cf6('0x49')]?_0x21bbce[_0x0cf6('0x39')]:_0x563ce2['model'];if(_0x4c73ad[_0x0cf6('0x33')][_0x0cf6('0x45')]){_0x21bbce['include']=[{'all':!![]}];}_0x21bbce=_[_0x0cf6('0x42')]({},_0x21bbce,_0x4c73ad['options']);return db[_0x0cf6('0x2d')][_0x0cf6('0x4a')](_0x21bbce)['then'](handleEntityNotFound(_0x5f5a62,null))[_0x0cf6('0x26')](respondWithResult(_0x5f5a62,null))[_0x0cf6('0x4b')](handleError(_0x5f5a62,null));};exports[_0x0cf6('0x4c')]=function(_0x4cace1,_0x35c827){return db[_0x0cf6('0x2d')][_0x0cf6('0x4c')](_0x4cace1[_0x0cf6('0x4d')],{})[_0x0cf6('0x26')](respondWithResult(_0x35c827,0xc9))['catch'](handleError(_0x35c827,null));};exports[_0x0cf6('0x25')]=function(_0x603b00,_0x3412de){if(_0x603b00['body']['id']){delete _0x603b00[_0x0cf6('0x4d')]['id'];}delete _0x603b00[_0x0cf6('0x4d')][_0x0cf6('0x4e')];delete _0x603b00[_0x0cf6('0x4d')][_0x0cf6('0x4f')];delete _0x603b00[_0x0cf6('0x4d')]['closedAt'];delete _0x603b00['body']['value'];return db[_0x0cf6('0x2d')]['find']({'where':{'id':_0x603b00[_0x0cf6('0x47')]['id']}})[_0x0cf6('0x26')](handleEntityNotFound(_0x3412de,null))[_0x0cf6('0x26')](saveUpdates(_0x603b00[_0x0cf6('0x4d')],null))[_0x0cf6('0x26')](respondWithResult(_0x3412de,null))['catch'](handleError(_0x3412de,null));};exports[_0x0cf6('0x50')]=function(_0x44145f,_0x3f4f5f){return db[_0x0cf6('0x2d')]['describe']()[_0x0cf6('0x26')](respondWithResult(_0x3f4f5f,null))[_0x0cf6('0x4b')](handleError(_0x3f4f5f,null));};exports[_0x0cf6('0x51')]=function(_0x3f4fcb,_0x6e1763,_0x205b09){var _0x527c75=require(_0x0cf6('0x52'));var _0x381432=![];var _0x2d5f59={};if(_0x3f4fcb[_0x0cf6('0x33')]['type']&&_0x3f4fcb[_0x0cf6('0x33')]['type']==='uniqueid'){_0x2d5f59[_0x0cf6('0x53')]=_0x3f4fcb[_0x0cf6('0x47')]['id'];}else{_0x2d5f59['id']=_0x3f4fcb[_0x0cf6('0x47')]['id'];}return db[_0x0cf6('0x2d')]['find']({'where':_0x2d5f59,'attributes':['id',_0x0cf6('0x54')],'raw':!![]})[_0x0cf6('0x26')](handleEntityNotFound(_0x6e1763,null))[_0x0cf6('0x26')](function(_0x57fada){if(_0x57fada){var _0x314a0d=path['join'](config['root'],_0x0cf6('0x55'),_0x57fada[_0x0cf6('0x54')]);var _0x10e186=util['format'](_0x0cf6('0x56'),_0x314a0d);if(fs[_0x0cf6('0x57')](_0x10e186)){_0x381432=!![];return _0x527c75['decryptFile'](_0x10e186,_0x314a0d,config[_0x0cf6('0x58')][_0x0cf6('0x59')])[_0x0cf6('0x26')](function(){return _0x57fada;});}return _0x57fada;}})['then'](function(_0x1d9326){if(_0x1d9326){var _0x409856=path['join'](config['root'],_0x0cf6('0x55'),_0x1d9326[_0x0cf6('0x54')]);if(!fs['existsSync'](_0x409856)){throw new db[(_0x0cf6('0x5a'))][(_0x0cf6('0x5b'))](_0x0cf6('0x5c'));}if(_0x1d9326[_0x0cf6('0x5d')]){return _0x6e1763[_0x0cf6('0x51')](_0x409856,_0x1d9326[_0x0cf6('0x5d')]+path[_0x0cf6('0x5e')](_0x409856),function(){if(_0x381432){fs[_0x0cf6('0x5f')](_0x409856);}});}else{return _0x6e1763[_0x0cf6('0x51')](_0x409856,function(_0x47457b){if(_0x381432){fs[_0x0cf6('0x5f')](_0x409856);}});}}})[_0x0cf6('0x4b')](function(_0x41dfa7){if(_0x41dfa7[_0x0cf6('0x60')]==='ScreenRecording\x20not\x20found'){_0x6e1763['status'](0x194)[_0x0cf6('0x2a')](_0x0cf6('0x61'));}else{return handleError(_0x6e1763,null);}});};exports[_0x0cf6('0x27')]=function(_0x10127d,_0x2c38e7){return db['ScreenRecording'][_0x0cf6('0x4a')]({'where':{'id':_0x10127d[_0x0cf6('0x47')]['id']}})['then'](function(_0x262fd6){if(!_0x262fd6)throw new ReferenceError(_0x0cf6('0x62'));return _0x262fd6;})[_0x0cf6('0x26')](function(_0x53d503){var _0x5ccaf0=path[_0x0cf6('0x63')](config[_0x0cf6('0x64')],_0x0cf6('0x55'),_0x53d503[_0x0cf6('0x54')]);logger[_0x0cf6('0x65')](_0x0cf6('0x66'),_0x5ccaf0);if(!_[_0x0cf6('0x67')](_0x53d503[_0x0cf6('0x54')])&&fs[_0x0cf6('0x57')](_0x5ccaf0)){logger['info']('File:\x20\x22'+_0x5ccaf0+_0x0cf6('0x68'));fs['unlinkSync'](_0x5ccaf0);}_0x5ccaf0=_0x5ccaf0+'.cypher';if(!_[_0x0cf6('0x67')](_0x53d503['value'])&&fs[_0x0cf6('0x57')](_0x5ccaf0)){logger['info'](_0x0cf6('0x69')+_0x5ccaf0+_0x0cf6('0x68'));fs[_0x0cf6('0x6a')](_0x5ccaf0);}return _0x53d503;})['then'](function(_0x238b2b){if(!_0x238b2b)throw new InternalError();return _0x238b2b[_0x0cf6('0x27')]();})[_0x0cf6('0x26')](function(){_0x2c38e7[_0x0cf6('0x1b')](0xcc)[_0x0cf6('0x1c')]();})[_0x0cf6('0x4b')](handleError(_0x2c38e7,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a333b6a..ccdbbfa 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 _0x488d=['screen_recordings','interactionid','lodash','util','bluebird','request-promise','path','rimraf','exports','define','ScreenRecording'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x488d,0x16d));var _0xd488=function(_0x5f0f9e,_0x5bb27c){_0x5f0f9e=_0x5f0f9e-0x0;var _0x53dc00=_0x488d[_0x5f0f9e];return _0x53dc00;};'use strict';var _=require(_0xd488('0x0'));var util=require(_0xd488('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd488('0x2'));var rp=require(_0xd488('0x3'));var fs=require('fs');var path=require(_0xd488('0x4'));var rimraf=require(_0xd488('0x5'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xd488('0x6')]=function(_0x507777,_0x46bd8d){return _0x507777[_0xd488('0x7')](_0xd488('0x8'),attributes,{'tableName':_0xd488('0x9'),'paranoid':![],'indexes':[{'name':_0xd488('0xa'),'fields':[_0xd488('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92f0=['interactionid','../../config/logger','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings'];(function(_0x5ae136,_0x5c7498){var _0x3a59b3=function(_0x5ee88f){while(--_0x5ee88f){_0x5ae136['push'](_0x5ae136['shift']());}};_0x3a59b3(++_0x5c7498);}(_0x92f0,0xf3));var _0x092f=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x92f0[_0x2134b7];return _0x6c5914;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x092f('0x0'))('api');var moment=require(_0x092f('0x1'));var BPromise=require(_0x092f('0x2'));var rp=require(_0x092f('0x3'));var fs=require('fs');var path=require(_0x092f('0x4'));var rimraf=require(_0x092f('0x5'));var config=require('../../config/environment');var attributes=require(_0x092f('0x6'));module['exports']=function(_0xe3aadb,_0x6b720d){return _0xe3aadb[_0x092f('0x7')](_0x092f('0x8'),attributes,{'tableName':_0x092f('0x9'),'paranoid':![],'indexes':[{'name':_0x092f('0xa'),'fields':[_0x092f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2abaf8d..c0bf41a 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(_0x2ea14,_0x222899){var _0x41817f=function(_0x2f94a4){while(--_0x2f94a4){_0x2ea14['push'](_0x2ea14['shift']());}};_0x41817f(++_0x222899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x44b7d1,_0x1d8689){var _0x4fea3d=function(_0x1ba82e){while(--_0x1ba82e){_0x44b7d1['push'](_0x44b7d1['shift']());}};_0x4fea3d(++_0x1d8689);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 03ad6ba..9481dca 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 _0xec07=['single','file','preferred','extname','addPreferred','favicon','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','root','format','%s%s','logo','originalname','addLogo','diskStorage','join','server/files/images/logos/','logologin','post','/:id/logo_login'];(function(_0x245eeb,_0x2e4663){var _0x28fbc5=function(_0x381c83){while(--_0x381c83){_0x245eeb['push'](_0x245eeb['shift']());}};_0x28fbc5(++_0x2e4663);}(_0xec07,0x1db));var _0x7ec0=function(_0x34429c,_0x544b66){_0x34429c=_0x34429c-0x0;var _0x315b3=_0xec07[_0x34429c];return _0x315b3;};'use strict';var multer=require(_0x7ec0('0x0'));var util=require(_0x7ec0('0x1'));var path=require(_0x7ec0('0x2'));var timeout=require(_0x7ec0('0x3'));var express=require('express');var router=express[_0x7ec0('0x4')]();var auth=require(_0x7ec0('0x5'));var interaction=require(_0x7ec0('0x6'));var config=require(_0x7ec0('0x7'));var controller=require(_0x7ec0('0x8'));router[_0x7ec0('0x9')]('/',auth[_0x7ec0('0xa')](),controller[_0x7ec0('0xb')]);router[_0x7ec0('0x9')]('/now',controller['getDate']);router['get'](_0x7ec0('0xc'),controller['show']);router[_0x7ec0('0x9')](_0x7ec0('0xd'),controller[_0x7ec0('0xe')]);router['get']('/:id/logo_login',controller[_0x7ec0('0xf')]);router[_0x7ec0('0x9')](_0x7ec0('0x10'),controller[_0x7ec0('0x11')]);router['get'](_0x7ec0('0x12'),controller['getPreferred']);router['get'](_0x7ec0('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x247fef,_0x2c57e0,_0x2c6166){_0x2c6166(null,path['join'](config[_0x7ec0('0x14')],'server/files/images/logos/'));},'filename':function(_0x43ae2e,_0x564c00,_0x207797){_0x207797(null,util[_0x7ec0('0x15')](_0x7ec0('0x16'),_0x7ec0('0x17'),path['extname'](_0x564c00[_0x7ec0('0x18')])));}})});router['post']('/:id/logo',upload['single']('file'),controller[_0x7ec0('0x19')]);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x47b6a6,_0x324b0e,_0x1231a4){_0x1231a4(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x279cdc,_0xafe3de,_0x52dc65){_0x52dc65(null,util['format'](_0x7ec0('0x16'),_0x7ec0('0x1d'),path['extname'](_0xafe3de[_0x7ec0('0x18')])));}})});router[_0x7ec0('0x1e')](_0x7ec0('0x1f'),upload[_0x7ec0('0x20')](_0x7ec0('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x3b01b5,_0x5cde60,_0x27995d){_0x27995d(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x567447,_0x343a9c,_0x51cce1){_0x51cce1(null,util[_0x7ec0('0x15')]('%s%s',_0x7ec0('0x22'),path[_0x7ec0('0x23')](_0x343a9c[_0x7ec0('0x18')])));}})});router[_0x7ec0('0x1e')]('/:id/preferred',upload['single'](_0x7ec0('0x21')),controller[_0x7ec0('0x24')]);var upload=multer({'storage':multer[_0x7ec0('0x1a')]({'destination':function(_0x831a3c,_0x552d51,_0x1abfe7){_0x1abfe7(null,path[_0x7ec0('0x1b')](config[_0x7ec0('0x14')],_0x7ec0('0x1c')));},'filename':function(_0x272a59,_0x390105,_0x2a52ef){_0x2a52ef(null,util['format']('%s%s',_0x7ec0('0x25'),path[_0x7ec0('0x23')](_0x390105['originalname'])));}})});router['post'](_0x7ec0('0x13'),upload[_0x7ec0('0x20')](_0x7ec0('0x21')),controller['addFavicon']);router['put'](_0x7ec0('0xc'),auth[_0x7ec0('0xa')](),controller[_0x7ec0('0x26')]);module['exports']=router; \ No newline at end of file +var _0x0f0c=['getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','root','logologin','preferred','addPreferred','favicon','/:id/favicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0f0c,0x111));var _0xc0f0=function(_0x25d68d,_0x69adf9){_0x25d68d=_0x25d68d-0x0;var _0x3f5c89=_0x0f0c[_0x25d68d];return _0x3f5c89;};'use strict';var multer=require(_0xc0f0('0x0'));var util=require(_0xc0f0('0x1'));var path=require(_0xc0f0('0x2'));var timeout=require(_0xc0f0('0x3'));var express=require(_0xc0f0('0x4'));var router=express[_0xc0f0('0x5')]();var auth=require(_0xc0f0('0x6'));var interaction=require(_0xc0f0('0x7'));var config=require(_0xc0f0('0x8'));var controller=require(_0xc0f0('0x9'));router[_0xc0f0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc0f0('0xa')]('/now',controller[_0xc0f0('0xb')]);router[_0xc0f0('0xa')](_0xc0f0('0xc'),controller['show']);router[_0xc0f0('0xa')](_0xc0f0('0xd'),controller[_0xc0f0('0xe')]);router[_0xc0f0('0xa')](_0xc0f0('0xf'),controller[_0xc0f0('0x10')]);router[_0xc0f0('0xa')](_0xc0f0('0x11'),controller[_0xc0f0('0x12')]);router['get'](_0xc0f0('0x13'),controller[_0xc0f0('0x14')]);router[_0xc0f0('0xa')]('/:id/favicon',controller[_0xc0f0('0x15')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x35ccbb,_0x316fa2,_0x4d582d){_0x4d582d(null,path[_0xc0f0('0x17')](config['root'],_0xc0f0('0x18')));},'filename':function(_0xd966d0,_0x162b64,_0x45a130){_0x45a130(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x1b'),path[_0xc0f0('0x1c')](_0x162b64[_0xc0f0('0x1d')])));}})});router[_0xc0f0('0x1e')](_0xc0f0('0xd'),upload[_0xc0f0('0x1f')](_0xc0f0('0x20')),controller[_0xc0f0('0x21')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x159c4a,_0x1aae76,_0x33be42){_0x33be42(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x55e39b,_0x195f3d,_0x559fc9){_0x559fc9(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x23'),path[_0xc0f0('0x1c')](_0x195f3d[_0xc0f0('0x1d')])));}})});router['post'](_0xc0f0('0xf'),upload['single'](_0xc0f0('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x7a6d37,_0x4386f3,_0x15c242){_0x15c242(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x416d73,_0x936c95,_0x293399){_0x293399(null,util[_0xc0f0('0x19')]('%s%s',_0xc0f0('0x24'),path[_0xc0f0('0x1c')](_0x936c95[_0xc0f0('0x1d')])));}})});router['post'](_0xc0f0('0x13'),upload[_0xc0f0('0x1f')](_0xc0f0('0x20')),controller[_0xc0f0('0x25')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x1742ca,_0x42e339,_0x55698c){_0x55698c(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x241c36,_0x1ed95e,_0x4d775e){_0x4d775e(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x26'),path['extname'](_0x1ed95e[_0xc0f0('0x1d')])));}})});router[_0xc0f0('0x1e')](_0xc0f0('0x27'),upload[_0xc0f0('0x1f')]('file'),controller['addFavicon']);router[_0xc0f0('0x28')](_0xc0f0('0xc'),auth['isAuthenticated'](),controller[_0xc0f0('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 2eac60e..addd4c9 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 _0x6e5e=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x3fb2f9,_0x39863f){var _0x481813=function(_0x407b1e){while(--_0x407b1e){_0x3fb2f9['push'](_0x3fb2f9['shift']());}};_0x481813(++_0x39863f);}(_0x6e5e,0x111));var _0xe6e5=function(_0x35eaaf,_0x3bad0d){_0x35eaaf=_0x35eaaf-0x0;var _0x5e704c=_0x6e5e[_0x35eaaf];return _0x5e704c;};'use strict';var Sequelize=require('sequelize');module[_0xe6e5('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe6e5('0x1')](0xb),'unique':_0xe6e5('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe6e5('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x4')},'logo':{'type':Sequelize[_0xe6e5('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe6e5('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe6e5('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe6e5('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xe6e5('0x3')]},'turnpassword':{'type':Sequelize[_0xe6e5('0x3')]},'pageTitle':{'type':Sequelize[_0xe6e5('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xe6e5('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x6')},'enableEmailPreview':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe6e5('0x3')],'defaultValue':_0xe6e5('0x7')},'chatTimeout':{'type':Sequelize[_0xe6e5('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xe6e5('0x3')]},'defaultPreferred':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe6e5('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xe6e5('0x3')]},'defaultFavicon':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xe6e5('0x1')]},'transcribeRegion':{'type':Sequelize[_0xe6e5('0x3')]},'sentiment':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe6e5('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe6e5('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe6e5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xe6e5('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa179=['BOOLEAN','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xa179,0x17b));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9a17('0x0')]={'min_internal':{'type':Sequelize[_0x9a17('0x1')](0xb),'unique':_0x9a17('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9a17('0x1')](0xb),'unique':_0x9a17('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9a17('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9a17('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x9a17('0x4')]},'defaultLogo':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9a17('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9a17('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9a17('0x4')]},'turnaddr':{'type':Sequelize[_0x9a17('0x4')]},'turnusername':{'type':Sequelize[_0x9a17('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x9a17('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9a17('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9a17('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9a17('0x6')},'chatTimeout':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9a17('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9a17('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9a17('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9a17('0x4')]},'bucket':{'type':Sequelize[_0x9a17('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9a17('0x1')](0x2)[_0x9a17('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7c33a1b..b26e060 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 _0xf98c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','include','show','params','body','find','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','custom','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','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','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xf98c,0x12a));var _0xcf98=function(_0xc0866a,_0x3b8164){_0xc0866a=_0xc0866a-0x0;var _0x2d850c=_0xf98c[_0xc0866a];return _0x2d850c;};'use strict';var pdf=require(_0xcf98('0x0'));var emlformat=require(_0xcf98('0x1'));var rimraf=require(_0xcf98('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf98('0x3'));var BPromise=require(_0xcf98('0x4'));var Mustache=require(_0xcf98('0x5'));var util=require(_0xcf98('0x6'));var path=require(_0xcf98('0x7'));var sox=require(_0xcf98('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf98('0x9'));var squel=require(_0xcf98('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf98('0xb'));var toCsv=require(_0xcf98('0xc'));var querystring=require(_0xcf98('0xd'));var Papa=require(_0xcf98('0xe'));var Redis=require(_0xcf98('0xf'));var authService=require(_0xcf98('0x10'));var qs=require(_0xcf98('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf98('0x12'));var logger=require(_0xcf98('0x13'))(_0xcf98('0x14'));var utils=require('../../config/utils');var config=require(_0xcf98('0x15'));var licenseUtil=require(_0xcf98('0x16'));var db=require(_0xcf98('0x17'))['db'];var jayson=require(_0xcf98('0x18'));var client=jayson[_0xcf98('0x19')][_0xcf98('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x382050,_0x2a8b0e,_0x452980,_0x3f4491){return new BPromise(function(_0x4ce3d0,_0x4028e1){var _0x96a20e=_0x3f4491||client;return _0x96a20e[_0xcf98('0x1b')](_0x382050,_0x452980)[_0xcf98('0x1c')](function(_0x1489dd){logger['info'](_0xcf98('0x1d'),_0x2a8b0e,_0xcf98('0x1e'));logger['debug'](_0xcf98('0x1f'),_0x2a8b0e,_0xcf98('0x1e'),JSON[_0xcf98('0x20')](_0x1489dd));if(_0x1489dd[_0xcf98('0x21')]){if(_0x1489dd['error'][_0xcf98('0x22')]===0x1f4){logger[_0xcf98('0x21')](_0xcf98('0x1d'),_0x2a8b0e,_0x1489dd[_0xcf98('0x21')][_0xcf98('0x23')]);return _0x4028e1(_0x1489dd[_0xcf98('0x21')]['message']);}logger[_0xcf98('0x21')](_0xcf98('0x1d'),_0x2a8b0e,_0x1489dd['error'][_0xcf98('0x23')]);return _0x4ce3d0(_0x1489dd[_0xcf98('0x21')][_0xcf98('0x23')]);}else{logger[_0xcf98('0x24')](_0xcf98('0x1d'),_0x2a8b0e,_0xcf98('0x1e'));_0x4ce3d0(_0x1489dd[_0xcf98('0x25')][_0xcf98('0x23')]);}})[_0xcf98('0x26')](function(_0x25ce72){logger['error']('Setting,\x20%s,\x20%s',_0x2a8b0e,_0x25ce72);_0x4028e1(_0x25ce72);});});}function respondWithStatusCode(_0x42df43,_0x58564c){_0x58564c=_0x58564c||0xcc;return function(_0x4cf1a7){if(_0x4cf1a7){return _0x42df43[_0xcf98('0x27')](_0x58564c);}return _0x42df43[_0xcf98('0x28')](_0x58564c)[_0xcf98('0x29')]();};}function respondWithResult(_0x2af53e,_0x543198){_0x543198=_0x543198||0xc8;return function(_0x35924f){if(_0x35924f){return _0x2af53e['status'](_0x543198)[_0xcf98('0x2a')](_0x35924f);}};}function respondWithFilteredResult(_0x589874,_0x109272){return function(_0x1e5abc){if(_0x1e5abc){var _0x331de0=_0x1e5abc[_0xcf98('0x2b')],_0x1657da=_0x109272[_0xcf98('0x2c')],_0x4d3a22=_0x109272[_0xcf98('0x2c')]+_0x109272[_0xcf98('0x2d')],_0x19d06a;if(_0x4d3a22>=_0x331de0){_0x4d3a22=_0x331de0;_0x19d06a=0xc8;}else{_0x19d06a=0xce;}_0x589874[_0xcf98('0x28')](_0x19d06a);return _0x589874[_0xcf98('0x2e')]('Content-Range',_0x1657da+'-'+_0x4d3a22+'/'+_0x331de0)[_0xcf98('0x2a')](_0x1e5abc);}return null;};}function patchUpdates(_0x37c137){return function(_0x3ba294){try{jsonpatch[_0xcf98('0x2f')](_0x3ba294,_0x37c137,!![]);}catch(_0x167835){return BPromise[_0xcf98('0x30')](_0x167835);}return _0x3ba294['save']();};}function saveUpdates(_0x4bc9a,_0x3e9d46){return function(_0x27e64e){if(_0x27e64e){return _0x27e64e[_0xcf98('0x31')](_0x4bc9a)[_0xcf98('0x1c')](function(_0x1ce518){return _0x1ce518;});}return null;};}function removeEntity(_0x471170,_0x28c743){return function(_0x4072f9){if(_0x4072f9){return _0x4072f9[_0xcf98('0x32')]()['then'](function(){_0x471170[_0xcf98('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x992d0a,_0x260c69){return function(_0x29514e){if(!_0x29514e){_0x992d0a['sendStatus'](0x194);}return _0x29514e;};}function handleError(_0x4259bc,_0x215cf1){_0x215cf1=_0x215cf1||0x1f4;return function(_0xd72fec){logger['error'](_0xd72fec['stack']);if(_0xd72fec[_0xcf98('0x33')]){delete _0xd72fec[_0xcf98('0x33')];}_0x4259bc[_0xcf98('0x28')](_0x215cf1)['send'](_0xd72fec);};}exports[_0xcf98('0x34')]=function(_0x5bb871,_0x291868){var _0x125e79={},_0x3cc98f={},_0xdcdabd={'count':0x0,'rows':[]};var _0x545410=_[_0xcf98('0x35')](db['Setting'][_0xcf98('0x36')],function(_0x5b2a30){return{'name':_0x5b2a30[_0xcf98('0x37')],'type':_0x5b2a30[_0xcf98('0x38')]['key']};});_0x3cc98f[_0xcf98('0x39')]=_[_0xcf98('0x35')](_0x545410,_0xcf98('0x33'));_0x3cc98f[_0xcf98('0x3a')]=_[_0xcf98('0x3b')](_0x5bb871[_0xcf98('0x3a')]);_0x3cc98f[_0xcf98('0x3c')]=_[_0xcf98('0x3d')](_0x3cc98f[_0xcf98('0x39')],_0x3cc98f[_0xcf98('0x3a')]);_0x125e79['attributes']=_['intersection'](_0x3cc98f[_0xcf98('0x39')],qs['fields'](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x3e')]));_0x125e79['attributes']=_0x125e79[_0xcf98('0x3f')][_0xcf98('0x40')]?_0x125e79['attributes']:_0x3cc98f['model'];if(!_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x41')](_0xcf98('0x42'))){_0x125e79['limit']=qs[_0xcf98('0x2d')](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x2d')]);_0x125e79['offset']=qs[_0xcf98('0x2c')](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x2c')]);}_0x125e79[_0xcf98('0x43')]=qs['sort'](_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x44')]);_0x125e79[_0xcf98('0x45')]=qs['filters'](_[_0xcf98('0x46')](_0x5bb871['query'],_0x3cc98f[_0xcf98('0x3c')]),_0x545410);if(_0x5bb871['query'][_0xcf98('0x47')]){_0x125e79[_0xcf98('0x45')]=_[_0xcf98('0x48')](_0x125e79[_0xcf98('0x45')],{'$or':_['map'](_0x545410,function(_0x4c3874){if(_0x4c3874[_0xcf98('0x38')]!==_0xcf98('0x49')){var _0x2905a8={};_0x2905a8[_0x4c3874[_0xcf98('0x33')]]={'$like':'%'+_0x5bb871[_0xcf98('0x3a')][_0xcf98('0x47')]+'%'};return _0x2905a8;}})});}_0x125e79=_[_0xcf98('0x48')]({},_0x125e79,_0x5bb871[_0xcf98('0x4a')]);var _0x28ec23={'where':_0x125e79['where']};return db[_0xcf98('0x4b')][_0xcf98('0x2b')](_0x28ec23)[_0xcf98('0x1c')](function(_0x4fcdcd){_0xdcdabd['count']=_0x4fcdcd;if(_0x5bb871[_0xcf98('0x3a')]['includeAll']){_0x125e79[_0xcf98('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x125e79);})[_0xcf98('0x1c')](function(_0x5b98f7){_0xdcdabd['rows']=_0x5b98f7;return _0xdcdabd;})[_0xcf98('0x1c')](respondWithFilteredResult(_0x291868,_0x125e79))['catch'](handleError(_0x291868,null));};exports[_0xcf98('0x4d')]=function(_0x5487e9,_0x1156de){var _0x1f57cb={'raw':![],'where':{'id':_0x5487e9[_0xcf98('0x4e')]['id']}},_0x5c255f={};_0x5c255f[_0xcf98('0x39')]=_['keys'](db[_0xcf98('0x4b')]['rawAttributes']);_0x5c255f['query']=_[_0xcf98('0x3b')](_0x5487e9[_0xcf98('0x3a')]);_0x5c255f[_0xcf98('0x3c')]=_['intersection'](_0x5c255f[_0xcf98('0x39')],_0x5c255f[_0xcf98('0x3a')]);_0x1f57cb[_0xcf98('0x3f')]=_[_0xcf98('0x3d')](_0x5c255f['model'],qs[_0xcf98('0x3e')](_0x5487e9[_0xcf98('0x3a')]['fields']));_0x1f57cb['attributes']=_0x1f57cb[_0xcf98('0x3f')]['length']?_0x1f57cb[_0xcf98('0x3f')]:_0x5c255f[_0xcf98('0x39')];if(_0x5487e9['query']['includeAll']){_0x1f57cb['include']=[{'all':!![]}];}_0x1f57cb=_[_0xcf98('0x48')]({},_0x1f57cb,_0x5487e9[_0xcf98('0x4a')]);return db[_0xcf98('0x4b')]['find'](_0x1f57cb)[_0xcf98('0x1c')](handleEntityNotFound(_0x1156de,null))['then'](respondWithResult(_0x1156de,null))['catch'](handleError(_0x1156de,null));};exports[_0xcf98('0x31')]=function(_0x1558ba,_0x927283){if(_0x1558ba[_0xcf98('0x4f')]['id']){delete _0x1558ba['body']['id'];}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x1558ba[_0xcf98('0x4e')]['id']}})['then'](handleEntityNotFound(_0x927283,null))[_0xcf98('0x1c')](saveUpdates(_0x1558ba[_0xcf98('0x4f')],null))[_0xcf98('0x1c')](respondWithResult(_0x927283,null))[_0xcf98('0x26')](handleError(_0x927283,null));};exports[_0xcf98('0x51')]=function(_0x13647d,_0x1be3b4,_0xbfd029){if(_0x13647d[_0xcf98('0x52')]&&_0x13647d[_0xcf98('0x52')][_0xcf98('0x53')]){_0x13647d[_0xcf98('0x4f')]['logo']=_0x13647d['file']['filename'];}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x13647d[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x1be3b4,null))[_0xcf98('0x1c')](saveUpdates(_0x13647d[_0xcf98('0x4f')],null))['then'](respondWithResult(_0x1be3b4,null))[_0xcf98('0x26')](handleError(_0x1be3b4,null));};exports['addLogoLogin']=function(_0x25c664,_0x2b8ae8,_0x21dcfe){if(_0x25c664[_0xcf98('0x52')]&&_0x25c664['file'][_0xcf98('0x53')]){_0x25c664[_0xcf98('0x4f')][_0xcf98('0x54')]=_0x25c664[_0xcf98('0x52')][_0xcf98('0x53')];}return db['Setting']['find']({'where':{'id':_0x25c664[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x2b8ae8,null))[_0xcf98('0x1c')](saveUpdates(_0x25c664['body'],null))['then'](respondWithResult(_0x2b8ae8,null))[_0xcf98('0x26')](handleError(_0x2b8ae8,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x55')]=function(_0x42581d,_0x2a6b5d,_0x1b1cae){var _0x487257=_0xcf98('0x56');var _0x277442={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0xb3ae89){if(_0xb3ae89){_0x277442=_0xb3ae89;}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0x42581d[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),'favicon',_0xcf98('0x5a'),_0xcf98('0x5b'),_0xcf98('0x5c'),_0xcf98('0x5d')],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0x2a6b5d,null))[_0xcf98('0x1c')](function(_0xe6a173){if(_0xe6a173){var _0x2f38f1=_0xe6a173[_0xcf98('0x58')]&&fs[_0xcf98('0x5e')](path[_0xcf98('0x5f')](config['root'],_0x487257,_[_0xcf98('0x60')](_0xe6a173[_0xcf98('0x58')])))?path[_0xcf98('0x5f')](config['root'],_0x487257,_[_0xcf98('0x60')](_0xe6a173[_0xcf98('0x58')])):path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x487257,_['toLower'](_0xcf98('0x62')));var _0x259008=_0xcf98('0x63')+_[_0xcf98('0x64')]('logo');if(_0xe6a173[_0x259008]||!_0x277442['custom']){_0x2f38f1=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x487257,_[_0xcf98('0x60')](_0xcf98('0x62')));}if(!fs[_0xcf98('0x5e')](_0x2f38f1)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')](_0xcf98('0x58'))+_0xcf98('0x67'));}return _0x2a6b5d[_0xcf98('0x68')](_0x2f38f1);}})[_0xcf98('0x26')](handleError(_0x2a6b5d,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x69')]=function(_0x1431d6,_0x2a8028,_0x591c19){var _0x35b78b=_0xcf98('0x56');var _0x5f0d02={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x577e41){if(_0x577e41){_0x5f0d02=_0x577e41;}return db[_0xcf98('0x4b')]['find']({'where':{'id':_0x1431d6['params']['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),_0xcf98('0x5a'),_0xcf98('0x5b'),'defaultPreferred',_0xcf98('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x2a8028,null))[_0xcf98('0x1c')](function(_0x5bccc8){if(_0x5bccc8){var _0x4c7e10=_0x5bccc8[_0xcf98('0x54')]&&fs['existsSync'](path['join'](config['root'],_0x35b78b,_[_0xcf98('0x60')](_0x5bccc8[_0xcf98('0x54')])))?path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x35b78b,_['toLower'](_0x5bccc8['loginLogo'])):path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x35b78b,_[_0xcf98('0x60')]('default_loginLogo.svg'));var _0x5d2053=_0xcf98('0x63')+_[_0xcf98('0x64')](_0xcf98('0x54'));if(_0x5bccc8[_0x5d2053]||!_0x5f0d02[_0xcf98('0x6b')]){_0x4c7e10=path['join'](config['root'],_0x35b78b,_['toLower'](_0xcf98('0x6c')));}if(!fs[_0xcf98('0x5e')](_0x4c7e10)){throw new db[(_0xcf98('0x65'))]['ValidationError'](_[_0xcf98('0x64')](_0xcf98('0x54'))+'\x20not\x20found');}return _0x2a8028[_0xcf98('0x68')](_0x4c7e10);}})['catch'](handleError(_0x2a8028,null));};exports[_0xcf98('0x6d')]=function(_0x264b18,_0x52286f){return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x264b18[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x6e')]})[_0xcf98('0x1c')](respondWithResult(_0x52286f,null))[_0xcf98('0x26')](handleError(_0x52286f,null));};exports[_0xcf98('0x6f')]=function(_0x89b95e,_0x4503c7,_0x1b8f5f){if(_0x89b95e['file']&&_0x89b95e[_0xcf98('0x52')][_0xcf98('0x53')]){_0x89b95e['body']['preferred']=_0x89b95e['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x89b95e[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x4503c7,null))['then'](saveUpdates(_0x89b95e[_0xcf98('0x4f')],null))['then'](respondWithResult(_0x4503c7,null))[_0xcf98('0x26')](handleError(_0x4503c7,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x70')]=function(_0x45df98,_0x3c0249,_0x369fa8){var _0x48f474=_0xcf98('0x56');var _0x3bddf3={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0x4ef979){if(_0x4ef979){_0x3bddf3=_0x4ef979;}return db[_0xcf98('0x4b')][_0xcf98('0x50')]({'where':{'id':_0x45df98[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),_0xcf98('0x5a'),_0xcf98('0x5b'),_0xcf98('0x5c'),_0xcf98('0x5d')],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0x3c0249,null))['then'](function(_0x4bcae4){if(_0x4bcae4){var _0x424dc3=_0x4bcae4[_0xcf98('0x59')]&&fs[_0xcf98('0x5e')](path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x48f474,_[_0xcf98('0x60')](_0x4bcae4[_0xcf98('0x59')])))?path[_0xcf98('0x5f')](config['root'],_0x48f474,_[_0xcf98('0x60')](_0x4bcae4[_0xcf98('0x59')])):path[_0xcf98('0x5f')](config['root'],_0x48f474,_[_0xcf98('0x60')](_0xcf98('0x71')));var _0x1f6a8a=_0xcf98('0x63')+_[_0xcf98('0x64')](_0xcf98('0x59'));if(_0x4bcae4[_0x1f6a8a]||!_0x3bddf3[_0xcf98('0x6b')]||!_0x3bddf3['preferred']){_0x424dc3=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x48f474,_[_0xcf98('0x60')](_0xcf98('0x71')));}if(!fs['existsSync'](_0x424dc3)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')]('preferred')+_0xcf98('0x67'));}return _0x3c0249[_0xcf98('0x68')](_0x424dc3);}})[_0xcf98('0x26')](handleError(_0x3c0249,null));};exports[_0xcf98('0x72')]=function(_0x5e98e1,_0x52fd02,_0x3c8089){if(_0x5e98e1[_0xcf98('0x52')]&&_0x5e98e1[_0xcf98('0x52')][_0xcf98('0x53')]){_0x5e98e1['body'][_0xcf98('0x6a')]=_0x5e98e1[_0xcf98('0x52')][_0xcf98('0x53')];}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0x5e98e1[_0xcf98('0x4e')]['id']}})[_0xcf98('0x1c')](handleEntityNotFound(_0x52fd02,null))[_0xcf98('0x1c')](saveUpdates(_0x5e98e1[_0xcf98('0x4f')],null))[_0xcf98('0x1c')](respondWithResult(_0x52fd02,null))[_0xcf98('0x26')](handleError(_0x52fd02,null));};var utilLicense=require(_0xcf98('0x16'));exports[_0xcf98('0x73')]=function(_0xe174dd,_0xfe207f,_0x222a5e){var _0x4ff2f3=_0xcf98('0x56');var _0x347fd5={'custom':![]};return utilLicense[_0xcf98('0x57')]()[_0xcf98('0x1c')](function(_0x3c45eb){if(_0x3c45eb){_0x347fd5=_0x3c45eb;}return db['Setting'][_0xcf98('0x50')]({'where':{'id':_0xe174dd[_0xcf98('0x4e')]['id']},'attributes':[_0xcf98('0x58'),_0xcf98('0x54'),_0xcf98('0x59'),_0xcf98('0x6a'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xcf98('0x1c')](handleEntityNotFound(_0xfe207f,null))[_0xcf98('0x1c')](function(_0x109b40){if(_0x109b40){var _0x2893bc=_0x109b40[_0xcf98('0x6a')]&&fs['existsSync'](path['join'](config['root'],_0x4ff2f3,_[_0xcf98('0x60')](_0x109b40['favicon'])))?path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x4ff2f3,_[_0xcf98('0x60')](_0x109b40['favicon'])):path['join'](config['root'],_0x4ff2f3,_[_0xcf98('0x60')](_0xcf98('0x74')));var _0x2e1c1b='default'+_[_0xcf98('0x64')](_0xcf98('0x6a'));if(_0x109b40[_0x2e1c1b]||!_0x347fd5['custom']){_0x2893bc=path[_0xcf98('0x5f')](config[_0xcf98('0x61')],_0x4ff2f3,_[_0xcf98('0x60')]('default_favicon.ico'));}if(!fs['existsSync'](_0x2893bc)){throw new db[(_0xcf98('0x65'))][(_0xcf98('0x66'))](_[_0xcf98('0x64')](_0xcf98('0x6a'))+_0xcf98('0x67'));}return _0xfe207f[_0xcf98('0x68')](_0x2893bc);}})[_0xcf98('0x26')](handleError(_0xfe207f,null));};exports['getDate']=function(_0x18adb3,_0x159d03){var _0x4bb7ec={'offset':moment()[_0xcf98('0x75')]()};_0x4bb7ec[_0xcf98('0x76')]=moment()[_0xcf98('0x75')](_0x4bb7ec[_0xcf98('0x2c')])[_0xcf98('0x77')](_0xcf98('0x78'));return _0x159d03[_0xcf98('0x28')](0xc8)['send'](_0x4bb7ec);}; \ No newline at end of file +var _0xfc04=['findAll','rows','catch','show','params','length','options','find','body','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','defaultFavicon','default_loginLogo.svg','Sequelize','gdpr','securePassword','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','end','json','count','offset','limit','status','Content-Range','reject','save','destroy','sendStatus','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x4e9d7f,_0x383253){var _0x51f0bc=function(_0x367d9c){while(--_0x367d9c){_0x4e9d7f['push'](_0x4e9d7f['shift']());}};_0x51f0bc(++_0x383253);}(_0xfc04,0x11d));var _0x4fc0=function(_0x427b9b,_0x4d2c97){_0x427b9b=_0x427b9b-0x0;var _0x2fdd95=_0xfc04[_0x427b9b];return _0x2fdd95;};'use strict';var pdf=require(_0x4fc0('0x0'));var emlformat=require(_0x4fc0('0x1'));var rimraf=require(_0x4fc0('0x2'));var zipdir=require(_0x4fc0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fc0('0x4'));var moment=require('moment');var BPromise=require(_0x4fc0('0x5'));var Mustache=require('mustache');var util=require(_0x4fc0('0x6'));var path=require('path');var sox=require(_0x4fc0('0x7'));var csv=require('to-csv');var ejs=require(_0x4fc0('0x8'));var fs=require('fs');var _=require(_0x4fc0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fc0('0xa'));var deskjs=require(_0x4fc0('0xb'));var toCsv=require(_0x4fc0('0xc'));var querystring=require(_0x4fc0('0xd'));var Papa=require(_0x4fc0('0xe'));var Redis=require('ioredis');var authService=require(_0x4fc0('0xf'));var qs=require(_0x4fc0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fc0('0x11'));var logger=require(_0x4fc0('0x12'))(_0x4fc0('0x13'));var utils=require(_0x4fc0('0x14'));var config=require(_0x4fc0('0x15'));var licenseUtil=require(_0x4fc0('0x16'));var db=require(_0x4fc0('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4fc0('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504b35,_0x3e502a,_0x450cc6,_0x2e9f7b){return new BPromise(function(_0x26398e,_0x33b531){var _0x4f098a=_0x2e9f7b||client;return _0x4f098a[_0x4fc0('0x19')](_0x504b35,_0x450cc6)[_0x4fc0('0x1a')](function(_0x396d40){logger['info'](_0x4fc0('0x1b'),_0x3e502a,'request\x20sent');logger[_0x4fc0('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x3e502a,_0x4fc0('0x1d'),JSON[_0x4fc0('0x1e')](_0x396d40));if(_0x396d40['error']){if(_0x396d40['error'][_0x4fc0('0x1f')]===0x1f4){logger[_0x4fc0('0x20')](_0x4fc0('0x1b'),_0x3e502a,_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);return _0x33b531(_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);}logger[_0x4fc0('0x20')](_0x4fc0('0x1b'),_0x3e502a,_0x396d40['error']['message']);return _0x26398e(_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);}else{logger[_0x4fc0('0x22')](_0x4fc0('0x1b'),_0x3e502a,_0x4fc0('0x1d'));_0x26398e(_0x396d40[_0x4fc0('0x23')]['message']);}})['catch'](function(_0x2387e1){logger['error']('Setting,\x20%s,\x20%s',_0x3e502a,_0x2387e1);_0x33b531(_0x2387e1);});});}function respondWithStatusCode(_0xb7a6b2,_0x223fe9){_0x223fe9=_0x223fe9||0xcc;return function(_0x33f5a8){if(_0x33f5a8){return _0xb7a6b2['sendStatus'](_0x223fe9);}return _0xb7a6b2['status'](_0x223fe9)[_0x4fc0('0x24')]();};}function respondWithResult(_0x5c6ed,_0x476520){_0x476520=_0x476520||0xc8;return function(_0x4754e7){if(_0x4754e7){return _0x5c6ed['status'](_0x476520)[_0x4fc0('0x25')](_0x4754e7);}};}function respondWithFilteredResult(_0x2c2cb5,_0x1a006a){return function(_0x1b307f){if(_0x1b307f){var _0x41d8c1=_0x1b307f[_0x4fc0('0x26')],_0x3a2a95=_0x1a006a[_0x4fc0('0x27')],_0x5de8d4=_0x1a006a[_0x4fc0('0x27')]+_0x1a006a[_0x4fc0('0x28')],_0x2fffcf;if(_0x5de8d4>=_0x41d8c1){_0x5de8d4=_0x41d8c1;_0x2fffcf=0xc8;}else{_0x2fffcf=0xce;}_0x2c2cb5[_0x4fc0('0x29')](_0x2fffcf);return _0x2c2cb5['set'](_0x4fc0('0x2a'),_0x3a2a95+'-'+_0x5de8d4+'/'+_0x41d8c1)['json'](_0x1b307f);}return null;};}function patchUpdates(_0x1d85b2){return function(_0x4b0338){try{jsonpatch['apply'](_0x4b0338,_0x1d85b2,!![]);}catch(_0x3d79d4){return BPromise[_0x4fc0('0x2b')](_0x3d79d4);}return _0x4b0338[_0x4fc0('0x2c')]();};}function saveUpdates(_0x256729,_0x12770e){return function(_0x952a04){if(_0x952a04){return _0x952a04['update'](_0x256729)['then'](function(_0x33ff99){return _0x33ff99;});}return null;};}function removeEntity(_0x44b23e,_0x3bde89){return function(_0x16653d){if(_0x16653d){return _0x16653d[_0x4fc0('0x2d')]()[_0x4fc0('0x1a')](function(){_0x44b23e[_0x4fc0('0x29')](0xcc)[_0x4fc0('0x24')]();});}};}function handleEntityNotFound(_0x5586a4,_0x2b4843){return function(_0x220600){if(!_0x220600){_0x5586a4[_0x4fc0('0x2e')](0x194);}return _0x220600;};}function handleError(_0x4f8463,_0x2336d9){_0x2336d9=_0x2336d9||0x1f4;return function(_0x327582){logger[_0x4fc0('0x20')](_0x327582[_0x4fc0('0x2f')]);if(_0x327582[_0x4fc0('0x30')]){delete _0x327582[_0x4fc0('0x30')];}_0x4f8463[_0x4fc0('0x29')](_0x2336d9)[_0x4fc0('0x31')](_0x327582);};}exports['index']=function(_0x2b66d7,_0x18d59d){var _0x328e6={},_0x2cf1a8={},_0x2be68c={'count':0x0,'rows':[]};var _0x54d4d9=_[_0x4fc0('0x32')](db[_0x4fc0('0x33')][_0x4fc0('0x34')],function(_0x2b6896){return{'name':_0x2b6896[_0x4fc0('0x35')],'type':_0x2b6896[_0x4fc0('0x36')][_0x4fc0('0x37')]};});_0x2cf1a8['model']=_[_0x4fc0('0x32')](_0x54d4d9,'name');_0x2cf1a8['query']=_[_0x4fc0('0x38')](_0x2b66d7[_0x4fc0('0x39')]);_0x2cf1a8[_0x4fc0('0x3a')]=_[_0x4fc0('0x3b')](_0x2cf1a8['model'],_0x2cf1a8[_0x4fc0('0x39')]);_0x328e6[_0x4fc0('0x3c')]=_[_0x4fc0('0x3b')](_0x2cf1a8[_0x4fc0('0x3d')],qs[_0x4fc0('0x3e')](_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x3e')]));_0x328e6['attributes']=_0x328e6['attributes']['length']?_0x328e6[_0x4fc0('0x3c')]:_0x2cf1a8[_0x4fc0('0x3d')];if(!_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x3f')](_0x4fc0('0x40'))){_0x328e6['limit']=qs['limit'](_0x2b66d7['query'][_0x4fc0('0x28')]);_0x328e6[_0x4fc0('0x27')]=qs[_0x4fc0('0x27')](_0x2b66d7['query'][_0x4fc0('0x27')]);}_0x328e6[_0x4fc0('0x41')]=qs['sort'](_0x2b66d7[_0x4fc0('0x39')]['sort']);_0x328e6['where']=qs['filters'](_['pick'](_0x2b66d7[_0x4fc0('0x39')],_0x2cf1a8[_0x4fc0('0x3a')]),_0x54d4d9);if(_0x2b66d7['query'][_0x4fc0('0x42')]){_0x328e6[_0x4fc0('0x43')]=_[_0x4fc0('0x44')](_0x328e6[_0x4fc0('0x43')],{'$or':_['map'](_0x54d4d9,function(_0x1e1d3c){if(_0x1e1d3c['type']!==_0x4fc0('0x45')){var _0x1f6ff0={};_0x1f6ff0[_0x1e1d3c['name']]={'$like':'%'+_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x42')]+'%'};return _0x1f6ff0;}})});}_0x328e6=_[_0x4fc0('0x44')]({},_0x328e6,_0x2b66d7['options']);var _0x1fc9b1={'where':_0x328e6[_0x4fc0('0x43')]};return db[_0x4fc0('0x33')][_0x4fc0('0x26')](_0x1fc9b1)['then'](function(_0x1d6a56){_0x2be68c['count']=_0x1d6a56;if(_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x46')]){_0x328e6[_0x4fc0('0x47')]=[{'all':!![]}];}return db[_0x4fc0('0x33')][_0x4fc0('0x48')](_0x328e6);})[_0x4fc0('0x1a')](function(_0x50ada1){_0x2be68c[_0x4fc0('0x49')]=_0x50ada1;return _0x2be68c;})['then'](respondWithFilteredResult(_0x18d59d,_0x328e6))[_0x4fc0('0x4a')](handleError(_0x18d59d,null));};exports[_0x4fc0('0x4b')]=function(_0x191554,_0x1ab5b2){var _0x54d5d8={'raw':![],'where':{'id':_0x191554[_0x4fc0('0x4c')]['id']}},_0x3ae198={};_0x3ae198[_0x4fc0('0x3d')]=_[_0x4fc0('0x38')](db['Setting'][_0x4fc0('0x34')]);_0x3ae198[_0x4fc0('0x39')]=_[_0x4fc0('0x38')](_0x191554['query']);_0x3ae198[_0x4fc0('0x3a')]=_[_0x4fc0('0x3b')](_0x3ae198['model'],_0x3ae198[_0x4fc0('0x39')]);_0x54d5d8[_0x4fc0('0x3c')]=_[_0x4fc0('0x3b')](_0x3ae198['model'],qs['fields'](_0x191554[_0x4fc0('0x39')][_0x4fc0('0x3e')]));_0x54d5d8[_0x4fc0('0x3c')]=_0x54d5d8[_0x4fc0('0x3c')][_0x4fc0('0x4d')]?_0x54d5d8[_0x4fc0('0x3c')]:_0x3ae198['model'];if(_0x191554[_0x4fc0('0x39')][_0x4fc0('0x46')]){_0x54d5d8[_0x4fc0('0x47')]=[{'all':!![]}];}_0x54d5d8=_[_0x4fc0('0x44')]({},_0x54d5d8,_0x191554[_0x4fc0('0x4e')]);return db[_0x4fc0('0x33')][_0x4fc0('0x4f')](_0x54d5d8)[_0x4fc0('0x1a')](handleEntityNotFound(_0x1ab5b2,null))[_0x4fc0('0x1a')](respondWithResult(_0x1ab5b2,null))['catch'](handleError(_0x1ab5b2,null));};exports['update']=function(_0x27a65f,_0x3a3e04){if(_0x27a65f['body']['id']){delete _0x27a65f[_0x4fc0('0x50')]['id'];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x27a65f['params']['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x3a3e04,null))[_0x4fc0('0x1a')](saveUpdates(_0x27a65f['body'],null))[_0x4fc0('0x1a')](respondWithResult(_0x3a3e04,null))[_0x4fc0('0x4a')](handleError(_0x3a3e04,null));};exports['addLogo']=function(_0x390165,_0x1a4c8c,_0x592b7d){if(_0x390165[_0x4fc0('0x51')]&&_0x390165['file'][_0x4fc0('0x52')]){_0x390165[_0x4fc0('0x50')]['logo']=_0x390165[_0x4fc0('0x51')]['filename'];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x390165['params']['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1a4c8c,null))['then'](saveUpdates(_0x390165[_0x4fc0('0x50')],null))[_0x4fc0('0x1a')](respondWithResult(_0x1a4c8c,null))[_0x4fc0('0x4a')](handleError(_0x1a4c8c,null));};exports[_0x4fc0('0x53')]=function(_0x3df62d,_0x49e036,_0x2b6392){if(_0x3df62d['file']&&_0x3df62d[_0x4fc0('0x51')]['filename']){_0x3df62d[_0x4fc0('0x50')][_0x4fc0('0x54')]=_0x3df62d[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db['Setting']['find']({'where':{'id':_0x3df62d[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x49e036,null))['then'](saveUpdates(_0x3df62d['body'],null))['then'](respondWithResult(_0x49e036,null))[_0x4fc0('0x4a')](handleError(_0x49e036,null));};var utilLicense=require(_0x4fc0('0x16'));exports[_0x4fc0('0x55')]=function(_0x320b27,_0x1b279e,_0x3e5722){var _0x43383a='server/files/images/logos';var _0x4d390f={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x527f3b){if(_0x527f3b){_0x4d390f=_0x527f3b;}return db['Setting'][_0x4fc0('0x4f')]({'where':{'id':_0x320b27['params']['id']},'attributes':[_0x4fc0('0x57'),'loginLogo',_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),_0x4fc0('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1b279e,null))[_0x4fc0('0x1a')](function(_0x3d9608){if(_0x3d9608){var _0x1e5c7c=_0x3d9608[_0x4fc0('0x57')]&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x43383a,_[_0x4fc0('0x5f')](_0x3d9608[_0x4fc0('0x57')])))?path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x43383a,_[_0x4fc0('0x5f')](_0x3d9608[_0x4fc0('0x57')])):path[_0x4fc0('0x5d')](config['root'],_0x43383a,_['toLower'](_0x4fc0('0x60')));var _0x20f0c9=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x57'));if(_0x3d9608[_0x20f0c9]||!_0x4d390f[_0x4fc0('0x63')]){_0x1e5c7c=path[_0x4fc0('0x5d')](config['root'],_0x43383a,_['toLower'](_0x4fc0('0x60')));}if(!fs[_0x4fc0('0x5c')](_0x1e5c7c)){throw new db['Sequelize'][(_0x4fc0('0x64'))](_[_0x4fc0('0x62')](_0x4fc0('0x57'))+_0x4fc0('0x65'));}return _0x1b279e[_0x4fc0('0x66')](_0x1e5c7c);}})['catch'](handleError(_0x1b279e,null));};var utilLicense=require('../../config/license/util');exports[_0x4fc0('0x67')]=function(_0x4ca63c,_0x9a9b0b,_0x599b5b){var _0x57c245='server/files/images/logos';var _0x50153c={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x83e15f){if(_0x83e15f){_0x50153c=_0x83e15f;}return db[_0x4fc0('0x33')]['find']({'where':{'id':_0x4ca63c[_0x4fc0('0x4c')]['id']},'attributes':['logo',_0x4fc0('0x54'),_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),_0x4fc0('0x5b'),_0x4fc0('0x68'),_0x4fc0('0x69')],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x9a9b0b,null))[_0x4fc0('0x1a')](function(_0x29ad2a){if(_0x29ad2a){var _0x44228e=_0x29ad2a[_0x4fc0('0x54')]&&fs[_0x4fc0('0x5c')](path['join'](config['root'],_0x57c245,_[_0x4fc0('0x5f')](_0x29ad2a[_0x4fc0('0x54')])))?path['join'](config['root'],_0x57c245,_[_0x4fc0('0x5f')](_0x29ad2a[_0x4fc0('0x54')])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x57c245,_[_0x4fc0('0x5f')](_0x4fc0('0x6a')));var _0x3d83c2=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x54'));if(_0x29ad2a[_0x3d83c2]||!_0x50153c[_0x4fc0('0x63')]){_0x44228e=path['join'](config[_0x4fc0('0x5e')],_0x57c245,_[_0x4fc0('0x5f')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x44228e)){throw new db[(_0x4fc0('0x6b'))]['ValidationError'](_[_0x4fc0('0x62')]('loginLogo')+_0x4fc0('0x65'));}return _0x9a9b0b[_0x4fc0('0x66')](_0x44228e);}})['catch'](handleError(_0x9a9b0b,null));};exports[_0x4fc0('0x6c')]=function(_0x5db3ce,_0x14467f){return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x5db3ce[_0x4fc0('0x4c')]['id']},'attributes':[_0x4fc0('0x6d')]})[_0x4fc0('0x1a')](respondWithResult(_0x14467f,null))['catch'](handleError(_0x14467f,null));};exports['addPreferred']=function(_0x1d4abc,_0x5b3f10,_0x436186){if(_0x1d4abc[_0x4fc0('0x51')]&&_0x1d4abc[_0x4fc0('0x51')][_0x4fc0('0x52')]){_0x1d4abc[_0x4fc0('0x50')][_0x4fc0('0x58')]=_0x1d4abc[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x1d4abc[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x5b3f10,null))['then'](saveUpdates(_0x1d4abc['body'],null))['then'](respondWithResult(_0x5b3f10,null))['catch'](handleError(_0x5b3f10,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x192322,_0x58caef,_0x1324a3){var _0x368ca7=_0x4fc0('0x6e');var _0x421a65={'custom':![]};return utilLicense['getLicense']()[_0x4fc0('0x1a')](function(_0x2995d6){if(_0x2995d6){_0x421a65=_0x2995d6;}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x192322[_0x4fc0('0x4c')]['id']},'attributes':[_0x4fc0('0x57'),_0x4fc0('0x54'),'preferred','favicon',_0x4fc0('0x5a'),_0x4fc0('0x5b'),'defaultPreferred',_0x4fc0('0x69')],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x58caef,null))[_0x4fc0('0x1a')](function(_0x875840){if(_0x875840){var _0x5971a9=_0x875840[_0x4fc0('0x58')]&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config['root'],_0x368ca7,_[_0x4fc0('0x5f')](_0x875840[_0x4fc0('0x58')])))?path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x368ca7,_[_0x4fc0('0x5f')](_0x875840[_0x4fc0('0x58')])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x368ca7,_[_0x4fc0('0x5f')](_0x4fc0('0x6f')));var _0x1dbd83=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x58'));if(_0x875840[_0x1dbd83]||!_0x421a65[_0x4fc0('0x63')]||!_0x421a65[_0x4fc0('0x58')]){_0x5971a9=path[_0x4fc0('0x5d')](config['root'],_0x368ca7,_[_0x4fc0('0x5f')](_0x4fc0('0x6f')));}if(!fs[_0x4fc0('0x5c')](_0x5971a9)){throw new db[(_0x4fc0('0x6b'))]['ValidationError'](_['upperFirst'](_0x4fc0('0x58'))+'\x20not\x20found');}return _0x58caef[_0x4fc0('0x66')](_0x5971a9);}})[_0x4fc0('0x4a')](handleError(_0x58caef,null));};exports[_0x4fc0('0x70')]=function(_0x118c80,_0x1f9def,_0x2af6de){if(_0x118c80[_0x4fc0('0x51')]&&_0x118c80[_0x4fc0('0x51')]['filename']){_0x118c80[_0x4fc0('0x50')]['favicon']=_0x118c80[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x118c80[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1f9def,null))['then'](saveUpdates(_0x118c80[_0x4fc0('0x50')],null))['then'](respondWithResult(_0x1f9def,null))[_0x4fc0('0x4a')](handleError(_0x1f9def,null));};var utilLicense=require(_0x4fc0('0x16'));exports[_0x4fc0('0x71')]=function(_0x608e,_0x21f8c5,_0x526971){var _0x12f636=_0x4fc0('0x6e');var _0x3e2943={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x170d20){if(_0x170d20){_0x3e2943=_0x170d20;}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x608e['params']['id']},'attributes':[_0x4fc0('0x57'),_0x4fc0('0x54'),_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x21f8c5,null))[_0x4fc0('0x1a')](function(_0x5cf948){if(_0x5cf948){var _0x53849e=_0x5cf948['favicon']&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')](_0x5cf948[_0x4fc0('0x59')])))?path[_0x4fc0('0x5d')](config['root'],_0x12f636,_[_0x4fc0('0x5f')](_0x5cf948['favicon'])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')]('default_favicon.ico'));var _0x522542=_0x4fc0('0x61')+_['upperFirst']('favicon');if(_0x5cf948[_0x522542]||!_0x3e2943['custom']){_0x53849e=path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')](_0x4fc0('0x72')));}if(!fs[_0x4fc0('0x5c')](_0x53849e)){throw new db['Sequelize'][(_0x4fc0('0x64'))](_[_0x4fc0('0x62')]('favicon')+_0x4fc0('0x65'));}return _0x21f8c5[_0x4fc0('0x66')](_0x53849e);}})[_0x4fc0('0x4a')](handleError(_0x21f8c5,null));};exports[_0x4fc0('0x73')]=function(_0x234d27,_0x518044){var _0xbb8925={'offset':moment()[_0x4fc0('0x74')]()};_0xbb8925['now']=moment()[_0x4fc0('0x74')](_0xbb8925['offset'])[_0x4fc0('0x75')](_0x4fc0('0x76'));return _0x518044[_0x4fc0('0x29')](0xc8)['send'](_0xbb8925);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e7d8998..737d4b2 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 _0xd69b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','util'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0xd69b,0x137));var _0xbd69=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xd69b[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require('lodash');var util=require(_0xbd69('0x0'));var logger=require(_0xbd69('0x1'))(_0xbd69('0x2'));var moment=require(_0xbd69('0x3'));var BPromise=require(_0xbd69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd69('0x5'));var rimraf=require(_0xbd69('0x6'));var config=require(_0xbd69('0x7'));var attributes=require(_0xbd69('0x8'));module[_0xbd69('0x9')]=function(_0x2b93c0,_0x355a17){return _0x2b93c0[_0xbd69('0xa')](_0xbd69('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc239=['define','Setting','settings','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x267fe7,_0x356d98){var _0x19fd55=function(_0xf18753){while(--_0xf18753){_0x267fe7['push'](_0x267fe7['shift']());}};_0x19fd55(++_0x356d98);}(_0xc239,0x12e));var _0x9c23=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc239[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x9c23('0x0'));var util=require(_0x9c23('0x1'));var logger=require('../../config/logger')(_0x9c23('0x2'));var moment=require('moment');var BPromise=require(_0x9c23('0x3'));var rp=require(_0x9c23('0x4'));var fs=require('fs');var path=require(_0x9c23('0x5'));var rimraf=require(_0x9c23('0x6'));var config=require(_0x9c23('0x7'));var attributes=require(_0x9c23('0x8'));module[_0x9c23('0x9')]=function(_0x58580d,_0x28a254){return _0x58580d[_0x9c23('0xa')](_0x9c23('0xb'),attributes,{'tableName':_0x9c23('0xc'),'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 7f0a922..3aa1361 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 _0x6164=['client','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Setting,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4dd745,_0x19b66e){var _0x5893b1=function(_0x18deb3){while(--_0x18deb3){_0x4dd745['push'](_0x4dd745['shift']());}};_0x5893b1(++_0x19b66e);}(_0x6164,0x74));var _0x4616=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x6164[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x4616('0x0'));var util=require(_0x4616('0x1'));var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rs=require(_0x4616('0x4'));var fs=require('fs');var Redis=require(_0x4616('0x5'));var db=require(_0x4616('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4616('0x7'))('rpc');var config=require(_0x4616('0x8'));var jayson=require(_0x4616('0x9'));var client=jayson[_0x4616('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24af69,_0x4b638f,_0x4bc0d0){return new BPromise(function(_0x830b24,_0x2f3bf6){return client['request'](_0x24af69,_0x4bc0d0)['then'](function(_0x2d14e9){logger['info']('Setting,\x20%s,\x20%s',_0x4b638f,_0x4616('0xb'));logger[_0x4616('0xc')](_0x4616('0xd'),_0x4b638f,_0x4616('0xb'),JSON[_0x4616('0xe')](_0x2d14e9));if(_0x2d14e9[_0x4616('0xf')]){if(_0x2d14e9['error'][_0x4616('0x10')]===0x1f4){logger[_0x4616('0xf')]('Setting,\x20%s,\x20%s',_0x4b638f,_0x2d14e9[_0x4616('0xf')][_0x4616('0x11')]);return _0x2f3bf6(_0x2d14e9[_0x4616('0xf')][_0x4616('0x11')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4b638f,_0x2d14e9[_0x4616('0xf')]['message']);return _0x830b24(_0x2d14e9['error'][_0x4616('0x11')]);}else{logger[_0x4616('0x12')](_0x4616('0x13'),_0x4b638f,_0x4616('0xb'));_0x830b24(_0x2d14e9[_0x4616('0x14')][_0x4616('0x11')]);}})['catch'](function(_0x154866){logger[_0x4616('0xf')](_0x4616('0x13'),_0x4b638f,_0x154866);_0x2f3bf6(_0x154866);});});} \ No newline at end of file +var _0xd132=['../../config/environment','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2b3669,_0x3cd96b){var _0x10fe0c=function(_0x2d380c){while(--_0x2d380c){_0x2b3669['push'](_0x2b3669['shift']());}};_0x10fe0c(++_0x3cd96b);}(_0xd132,0xd3));var _0x2d13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd132[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d13('0x0'));var util=require(_0x2d13('0x1'));var moment=require(_0x2d13('0x2'));var BPromise=require(_0x2d13('0x3'));var rs=require(_0x2d13('0x4'));var fs=require('fs');var Redis=require(_0x2d13('0x5'));var db=require(_0x2d13('0x6'))['db'];var utils=require(_0x2d13('0x7'));var logger=require('../../config/logger')(_0x2d13('0x8'));var config=require(_0x2d13('0x9'));var jayson=require(_0x2d13('0xa'));var client=jayson[_0x2d13('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb78612,_0x337a0d,_0x67333e){return new BPromise(function(_0x11a8d3,_0x4987bc){return client[_0x2d13('0xc')](_0xb78612,_0x67333e)['then'](function(_0x284cb2){logger[_0x2d13('0xd')](_0x2d13('0xe'),_0x337a0d,_0x2d13('0xf'));logger[_0x2d13('0x10')](_0x2d13('0x11'),_0x337a0d,_0x2d13('0xf'),JSON['stringify'](_0x284cb2));if(_0x284cb2[_0x2d13('0x12')]){if(_0x284cb2['error']['code']===0x1f4){logger[_0x2d13('0x12')]('Setting,\x20%s,\x20%s',_0x337a0d,_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);return _0x4987bc(_0x284cb2[_0x2d13('0x12')]['message']);}logger[_0x2d13('0x12')]('Setting,\x20%s,\x20%s',_0x337a0d,_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);return _0x11a8d3(_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);}else{logger[_0x2d13('0xd')]('Setting,\x20%s,\x20%s',_0x337a0d,'request\x20sent');_0x11a8d3(_0x284cb2[_0x2d13('0x14')][_0x2d13('0x13')]);}})[_0x2d13('0x15')](function(_0x17ef20){logger[_0x2d13('0x12')](_0x2d13('0xe'),_0x337a0d,_0x17ef20);_0x4987bc(_0x17ef20);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index adfcc06..4f0e162 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 _0xe706=['getInteractions','/:id/users','post','addDisposition','/:id/notify','addApplications','/:id/send','send','/:id/status','status','addAgents','update','delete','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x446a54,_0x25dc8a){var _0x28df98=function(_0x5d74e8){while(--_0x5d74e8){_0x446a54['push'](_0x446a54['shift']());}};_0x28df98(++_0x25dc8a);}(_0xe706,0xa3));var _0x6e70=function(_0x41a93b,_0x2fc19d){_0x41a93b=_0x41a93b-0x0;var _0x220a7e=_0xe706[_0x41a93b];return _0x220a7e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['getAnswers']);router['get'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x9')](_0x6e70('0x15'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x9')]('/:id/status',controller['statusGet']);router['get'](_0x6e70('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6e70('0x18')]('/',auth[_0x6e70('0xa')](),controller['create']);router[_0x6e70('0x18')]('/:id/dispositions',auth[_0x6e70('0xa')](),controller[_0x6e70('0x19')]);router['post']('/:id/canned_answers',auth[_0x6e70('0xa')](),controller['addAnswer']);router[_0x6e70('0x18')](_0x6e70('0x1a'),controller['notify']);router['post'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1b')]);router[_0x6e70('0x18')](_0x6e70('0x1c'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1d')]);router[_0x6e70('0x18')](_0x6e70('0x1e'),controller[_0x6e70('0x1f')]);router['post'](_0x6e70('0x17'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x20')]);router['put'](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x21')]);router['delete'](_0x6e70('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller['removeDispositions']);router[_0x6e70('0x22')](_0x6e70('0x12'),auth['isAuthenticated'](),controller[_0x6e70('0x23')]);router[_0x6e70('0x22')](_0x6e70('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6e70('0x24')]=router; \ No newline at end of file +var _0xbaf0=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x362057,_0x448ff9){var _0x397f79=function(_0x22b0ff){while(--_0x22b0ff){_0x362057['push'](_0x362057['shift']());}};_0x397f79(++_0x448ff9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0baf('0x8')](_0x0baf('0x14'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router['get'](_0x0baf('0x16'),controller['statusGet']);router[_0x0baf('0x8')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x19')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller['addAnswer']);router[_0x0baf('0x19')](_0x0baf('0x1b'),controller[_0x0baf('0x1c')]);router[_0x0baf('0x19')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller['addApplications']);router['post'](_0x0baf('0x1d'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1e')]);router[_0x0baf('0x19')](_0x0baf('0x16'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x19')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);router['put'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0x21')]);router['delete']('/:id',auth[_0x0baf('0x9')](),controller['destroy']);router['delete'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x25')]);module[_0x0baf('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 37c3d80..f27957f 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 _0x5b3f=['INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','connectel','clicksend','plivo','clickatell','csc','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2dbb8a,_0x36d853){var _0x4774c5=function(_0xdef0f6){while(--_0xdef0f6){_0x2dbb8a['push'](_0x2dbb8a['shift']());}};_0x4774c5(++_0x36d853);}(_0x5b3f,0xa7));var _0xf5b3=function(_0x3c46d6,_0x365bb5){_0x3c46d6=_0x3c46d6-0x0;var _0x5ec4bd=_0x5b3f[_0x3c46d6];return _0x5ec4bd;};'use strict';var Sequelize=require(_0xf5b3('0x0'));var rs=require('randomstring');module[_0xf5b3('0x1')]={'name':{'type':Sequelize[_0xf5b3('0x2')],'unique':_0xf5b3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf5b3('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf5b3('0x2')],'defaultValue':function(){return rs[_0xf5b3('0x4')]();}},'phone':{'type':Sequelize[_0xf5b3('0x2')]},'type':{'type':Sequelize[_0xf5b3('0x5')]('twilio','skebby',_0xf5b3('0x6'),_0xf5b3('0x7'),_0xf5b3('0x8'),_0xf5b3('0x9'),_0xf5b3('0xa'),'infobip',_0xf5b3('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xf5b3('0x2')]},'authToken':{'type':Sequelize[_0xf5b3('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xf5b3('0x2')]},'password':{'type':Sequelize[_0xf5b3('0x2')]},'apiKey':{'type':Sequelize[_0xf5b3('0x2')]},'senderString':{'type':Sequelize[_0xf5b3('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf5b3('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf5b3('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf5b3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5b3('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5b3('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5b3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf5b3('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5b3('0xd')],'comment':_0xf5b3('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5b3('0x10'),'set':function(_0x3df45f){if(!_0x3df45f)this['setDataValue'](_0xf5b3('0x11'),null);this[_0xf5b3('0x12')](_0xf5b3('0x13'),_0x3df45f);}}}; \ No newline at end of file +var _0x0b63=['TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','BOOLEAN'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x0b63,0x16e));var _0x30b6=function(_0x70772a,_0x51fba4){_0x70772a=_0x70772a-0x0;var _0x2c9bec=_0x0b63[_0x70772a];return _0x2c9bec;};'use strict';var Sequelize=require(_0x30b6('0x0'));var rs=require(_0x30b6('0x1'));module[_0x30b6('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x30b6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x30b6('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x30b6('0x4')]();}},'phone':{'type':Sequelize[_0x30b6('0x3')]},'type':{'type':Sequelize[_0x30b6('0x5')]('twilio',_0x30b6('0x6'),_0x30b6('0x7'),_0x30b6('0x8'),_0x30b6('0x9'),_0x30b6('0xa'),_0x30b6('0xb'),_0x30b6('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x30b6('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x30b6('0x3')]},'smsMethod':{'type':Sequelize[_0x30b6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x30b6('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x30b6('0x3')]},'senderString':{'type':Sequelize[_0x30b6('0x3')]},'deliveryReport':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x30b6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x30b6('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x30b6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30b6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x30b6('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x30b6('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1fbf33){if(!_0x1fbf33)this['setDataValue'](_0x30b6('0x11'),null);this[_0x30b6('0x12')]('mandatoryDisposition',_0x1fbf33);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2f94584..eed84d5 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 _0xdc98=['mapKey','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','defaults','Messages','dataValues','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','SmsAccounts','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','SmsAccount','includeAll','include','findAll','rows','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','order','removeDispositions','CannedAnswer','nolimit','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','messageId','text','connectel','plivo','From','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x5cdefc,_0x252cc2){var _0x5a066d=function(_0x208f8e){while(--_0x208f8e){_0x5cdefc['push'](_0x5cdefc['shift']());}};_0x5a066d(++_0x252cc2);}(_0xdc98,0x122));var _0x8dc9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xdc98[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x8dc9('0x0'));var emlformat=require(_0x8dc9('0x1'));var rimraf=require(_0x8dc9('0x2'));var zipdir=require(_0x8dc9('0x3'));var jsonpatch=require(_0x8dc9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8dc9('0x5'));var Mustache=require(_0x8dc9('0x6'));var util=require(_0x8dc9('0x7'));var path=require(_0x8dc9('0x8'));var sox=require(_0x8dc9('0x9'));var csv=require(_0x8dc9('0xa'));var ejs=require(_0x8dc9('0xb'));var fs=require('fs');var _=require(_0x8dc9('0xc'));var squel=require(_0x8dc9('0xd'));var crypto=require(_0x8dc9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8dc9('0xf'));var toCsv=require(_0x8dc9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8dc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8dc9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dc9('0x12'));var logger=require(_0x8dc9('0x13'))(_0x8dc9('0x14'));var utils=require('../../config/utils');var config=require(_0x8dc9('0x15'));var licenseUtil=require(_0x8dc9('0x16'));var db=require(_0x8dc9('0x17'))['db'];config['redis']=_['defaults'](config[_0x8dc9('0x18')],{'host':_0x8dc9('0x19'),'port':0x18eb});var socket=require(_0x8dc9('0x1a'))(new Redis(config['redis']));require(_0x8dc9('0x1b'))['register'](socket);var jayson=require(_0x8dc9('0x1c'));var client=jayson[_0x8dc9('0x1d')][_0x8dc9('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x40d563,_0x365c3c,_0xe09cf9,_0x2ef9d7){return new BPromise(function(_0x2f1125,_0x541fa9){var _0x101035=_0x2ef9d7||client;return _0x101035[_0x8dc9('0x1f')](_0x40d563,_0xe09cf9)['then'](function(_0xfe4428){logger[_0x8dc9('0x20')](_0x8dc9('0x21'),_0x365c3c,_0x8dc9('0x22'));logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x365c3c,_0x8dc9('0x22'),JSON[_0x8dc9('0x25')](_0xfe4428));if(_0xfe4428[_0x8dc9('0x26')]){if(_0xfe4428[_0x8dc9('0x26')]['code']===0x1f4){logger[_0x8dc9('0x26')]('SmsAccount,\x20%s,\x20%s',_0x365c3c,_0xfe4428[_0x8dc9('0x26')][_0x8dc9('0x27')]);return _0x541fa9(_0xfe4428[_0x8dc9('0x26')]['message']);}logger[_0x8dc9('0x26')](_0x8dc9('0x21'),_0x365c3c,_0xfe4428[_0x8dc9('0x26')][_0x8dc9('0x27')]);return _0x2f1125(_0xfe4428[_0x8dc9('0x26')]['message']);}else{logger[_0x8dc9('0x20')]('SmsAccount,\x20%s,\x20%s',_0x365c3c,_0x8dc9('0x22'));_0x2f1125(_0xfe4428[_0x8dc9('0x28')][_0x8dc9('0x27')]);}})[_0x8dc9('0x29')](function(_0x56fd34){logger[_0x8dc9('0x26')](_0x8dc9('0x21'),_0x365c3c,_0x56fd34);_0x541fa9(_0x56fd34);});});}function respondWithStatusCode(_0x376a1a,_0x48e4c7){_0x48e4c7=_0x48e4c7||0xcc;return function(_0x53e57){if(_0x53e57){return _0x376a1a[_0x8dc9('0x2a')](_0x48e4c7);}return _0x376a1a[_0x8dc9('0x2b')](_0x48e4c7)['end']();};}function respondWithResult(_0x6a402b,_0x377bd1){_0x377bd1=_0x377bd1||0xc8;return function(_0x78ad9f){if(_0x78ad9f){return _0x6a402b['status'](_0x377bd1)[_0x8dc9('0x2c')](_0x78ad9f);}};}function respondWithFilteredResult(_0x4e3460,_0x19370c){return function(_0x3e8198){if(_0x3e8198){var _0x33e6d1=_0x3e8198[_0x8dc9('0x2d')],_0x1feb23=_0x19370c[_0x8dc9('0x2e')],_0x44f9a4=_0x19370c[_0x8dc9('0x2e')]+_0x19370c[_0x8dc9('0x2f')],_0x4f824c;if(_0x44f9a4>=_0x33e6d1){_0x44f9a4=_0x33e6d1;_0x4f824c=0xc8;}else{_0x4f824c=0xce;}_0x4e3460[_0x8dc9('0x2b')](_0x4f824c);return _0x4e3460[_0x8dc9('0x30')](_0x8dc9('0x31'),_0x1feb23+'-'+_0x44f9a4+'/'+_0x33e6d1)[_0x8dc9('0x2c')](_0x3e8198);}return null;};}function patchUpdates(_0x45151f){return function(_0x4f03de){try{jsonpatch['apply'](_0x4f03de,_0x45151f,!![]);}catch(_0x3ba847){return BPromise['reject'](_0x3ba847);}return _0x4f03de[_0x8dc9('0x32')]();};}function saveUpdates(_0x180f51,_0x22d96a){return function(_0x1c4109){if(_0x1c4109){return _0x1c4109[_0x8dc9('0x33')](_0x180f51)[_0x8dc9('0x34')](function(_0x1c1a94){return _0x1c1a94;});}return null;};}function removeEntity(_0x13cc31,_0xaddf51){return function(_0x49dc97){if(_0x49dc97){return _0x49dc97[_0x8dc9('0x35')]()['then'](function(){var _0xfdf9b=_0x49dc97['get']({'plain':!![]});var _0x1190fe=_0x8dc9('0x36');return db[_0x8dc9('0x37')][_0x8dc9('0x35')]({'where':{'type':_0x1190fe,'resourceId':_0xfdf9b['id']}})[_0x8dc9('0x34')](function(){return _0x49dc97;});})[_0x8dc9('0x34')](function(){_0x13cc31[_0x8dc9('0x2b')](0xcc)[_0x8dc9('0x38')]();});}};}function handleEntityNotFound(_0x196232,_0x151d40){return function(_0x135168){if(!_0x135168){_0x196232[_0x8dc9('0x2a')](0x194);}return _0x135168;};}function handleError(_0x27fd39,_0x1f31d6){_0x1f31d6=_0x1f31d6||0x1f4;return function(_0x59a642){logger[_0x8dc9('0x26')](_0x59a642[_0x8dc9('0x39')]);if(_0x59a642[_0x8dc9('0x3a')]){delete _0x59a642[_0x8dc9('0x3a')];}_0x27fd39[_0x8dc9('0x2b')](_0x1f31d6)['send'](_0x59a642);};}exports['index']=function(_0x3a7d7e,_0x41c20f){var _0x24f69f={'include':[{'model':db[_0x8dc9('0x3b')],'as':_0x8dc9('0x3c')}]},_0x251e63={},_0x51bfb8={'count':0x0,'rows':[]};var _0x1bf57f=_[_0x8dc9('0x3d')](db['SmsAccount']['rawAttributes'],function(_0x465458){return{'name':_0x465458[_0x8dc9('0x3e')],'type':_0x465458[_0x8dc9('0x3f')][_0x8dc9('0x40')]};});_0x251e63[_0x8dc9('0x41')]=_[_0x8dc9('0x3d')](_0x1bf57f,'name');_0x251e63[_0x8dc9('0x42')]=_['keys'](_0x3a7d7e[_0x8dc9('0x42')]);_0x251e63[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x251e63[_0x8dc9('0x41')],_0x251e63[_0x8dc9('0x42')]);_0x24f69f['attributes']=_[_0x8dc9('0x44')](_0x251e63[_0x8dc9('0x41')],qs['fields'](_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x45')]));_0x24f69f['attributes']=_0x24f69f[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x24f69f[_0x8dc9('0x46')]:_0x251e63['model'];if(!_0x3a7d7e['query'][_0x8dc9('0x48')]('nolimit')){_0x24f69f[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x3a7d7e['query'][_0x8dc9('0x2f')]);_0x24f69f[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x24f69f['order']=qs[_0x8dc9('0x49')](_0x3a7d7e['query'][_0x8dc9('0x49')]);_0x24f69f[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0x3a7d7e[_0x8dc9('0x42')],_0x251e63[_0x8dc9('0x43')]),_0x1bf57f);if(_0x3a7d7e[_0x8dc9('0x42')]['filter']){_0x24f69f[_0x8dc9('0x4a')]=_['merge'](_0x24f69f[_0x8dc9('0x4a')],{'$or':_['map'](_0x1bf57f,function(_0x1ac01a){if(_0x1ac01a[_0x8dc9('0x3f')]!==_0x8dc9('0x4c')){var _0x569966={};_0x569966[_0x1ac01a[_0x8dc9('0x3a')]]={'$like':'%'+_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x569966;}})});}_0x24f69f=_[_0x8dc9('0x4e')]({},_0x24f69f,_0x3a7d7e[_0x8dc9('0x4f')]);var _0x29e076={'where':_0x24f69f['where']};return db[_0x8dc9('0x50')]['count'](_0x29e076)[_0x8dc9('0x34')](function(_0x2cb573){_0x51bfb8[_0x8dc9('0x2d')]=_0x2cb573;if(_0x3a7d7e[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x24f69f[_0x8dc9('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x8dc9('0x53')](_0x24f69f);})['then'](function(_0x39073a){_0x51bfb8[_0x8dc9('0x54')]=_0x39073a;return _0x51bfb8;})[_0x8dc9('0x34')](respondWithFilteredResult(_0x41c20f,_0x24f69f))[_0x8dc9('0x29')](handleError(_0x41c20f,null));};exports['show']=function(_0x347a5c,_0xcbcca8){var _0x5c5b68={'raw':![],'where':{'id':_0x347a5c['params']['id']},'include':[{'model':db[_0x8dc9('0x3b')],'as':'mandatoryDispositionPause'}]},_0x30b3e7={};_0x30b3e7['model']=_[_0x8dc9('0x55')](db[_0x8dc9('0x50')][_0x8dc9('0x56')]);_0x30b3e7[_0x8dc9('0x42')]=_[_0x8dc9('0x55')](_0x347a5c['query']);_0x30b3e7[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x30b3e7['model'],_0x30b3e7[_0x8dc9('0x42')]);_0x5c5b68['attributes']=_[_0x8dc9('0x44')](_0x30b3e7[_0x8dc9('0x41')],qs['fields'](_0x347a5c[_0x8dc9('0x42')]['fields']));_0x5c5b68[_0x8dc9('0x46')]=_0x5c5b68[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x5c5b68[_0x8dc9('0x46')]:_0x30b3e7['model'];if(_0x347a5c[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x5c5b68[_0x8dc9('0x52')]=[{'all':!![]}];}_0x5c5b68=_[_0x8dc9('0x4e')]({},_0x5c5b68,_0x347a5c[_0x8dc9('0x4f')]);return db[_0x8dc9('0x50')][_0x8dc9('0x57')](_0x5c5b68)['then'](handleEntityNotFound(_0xcbcca8,null))[_0x8dc9('0x34')](respondWithResult(_0xcbcca8,null))[_0x8dc9('0x29')](handleError(_0xcbcca8,null));};exports['create']=function(_0x2d262e,_0x1237d2){return db[_0x8dc9('0x50')][_0x8dc9('0x58')](_0x2d262e[_0x8dc9('0x59')],{})[_0x8dc9('0x34')](function(_0xe31492){var _0x222c1f=_0x2d262e[_0x8dc9('0x5a')]['get']({'plain':!![]});if(!_0x222c1f)throw new Error(_0x8dc9('0x5b'));if(_0x222c1f[_0x8dc9('0x5c')]===_0x8dc9('0x5a')){var _0x4e1b44=_0xe31492[_0x8dc9('0x5d')]({'plain':!![]});var _0x40907f=_0x8dc9('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x40907f,'userProfileId':_0x222c1f['userProfileId']},'raw':!![]})['then'](function(_0x581c08){if(_0x581c08&&_0x581c08[_0x8dc9('0x5e')]===0x0){return db[_0x8dc9('0x37')][_0x8dc9('0x58')]({'name':_0x4e1b44['name'],'resourceId':_0x4e1b44['id'],'type':_0x581c08[_0x8dc9('0x3a')],'sectionId':_0x581c08['id']},{})[_0x8dc9('0x34')](function(){return _0xe31492;});}else{return _0xe31492;}})[_0x8dc9('0x29')](function(_0x4d0df3){logger[_0x8dc9('0x26')](_0x8dc9('0x5f'),_0x4d0df3);throw _0x4d0df3;});}return _0xe31492;})['then'](respondWithResult(_0x1237d2,0xc9))[_0x8dc9('0x29')](handleError(_0x1237d2,null));};exports['update']=function(_0x412d2a,_0x219e94){if(_0x412d2a['body']['id']){delete _0x412d2a['body']['id'];}return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x412d2a[_0x8dc9('0x60')]['id']},'include':[{'model':db[_0x8dc9('0x3b')],'as':_0x8dc9('0x3c')}]})['then'](handleEntityNotFound(_0x219e94,null))[_0x8dc9('0x34')](saveUpdates(_0x412d2a[_0x8dc9('0x59')],null))[_0x8dc9('0x34')](respondWithResult(_0x219e94,null))[_0x8dc9('0x29')](handleError(_0x219e94,null));};exports[_0x8dc9('0x35')]=function(_0xc0f047,_0x4fc352){return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0xc0f047[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x4fc352,null))[_0x8dc9('0x34')](removeEntity(_0x4fc352,null))[_0x8dc9('0x29')](handleError(_0x4fc352,null));};exports[_0x8dc9('0x61')]=function(_0x2605f8,_0x569b86){return db[_0x8dc9('0x50')][_0x8dc9('0x61')]()[_0x8dc9('0x34')](respondWithResult(_0x569b86,null))[_0x8dc9('0x29')](handleError(_0x569b86,null));};exports[_0x8dc9('0x62')]=function(_0x177072,_0x18a0cc,_0x56bb79){if(_0x177072[_0x8dc9('0x59')]['id']){delete _0x177072['body']['id'];}return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x177072[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x18a0cc,null))['then'](function(_0x5e1ba8){if(_0x5e1ba8){_0x177072['body'][_0x8dc9('0x63')]=_0x5e1ba8['id'];return db['Disposition'][_0x8dc9('0x58')](_0x177072[_0x8dc9('0x59')]);}})[_0x8dc9('0x34')](respondWithResult(_0x18a0cc,null))[_0x8dc9('0x29')](handleError(_0x18a0cc,null));};exports[_0x8dc9('0x64')]=function(_0x540cc9,_0x49cbc5,_0x11023a){var _0x3c40c0={'raw':![],'where':{}};var _0x2e5e16={};var _0x5d3941={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x540cc9[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x49cbc5,null))['then'](function(_0x4ed502){if(_0x4ed502){_0x2e5e16['model']=_[_0x8dc9('0x55')](db[_0x8dc9('0x66')][_0x8dc9('0x56')]);_0x2e5e16['query']=_[_0x8dc9('0x55')](_0x540cc9['query']);_0x2e5e16[_0x8dc9('0x43')]=_['intersection'](_0x2e5e16[_0x8dc9('0x41')],_0x2e5e16['query']);_0x3c40c0[_0x8dc9('0x46')]=_['intersection'](_0x2e5e16['model'],qs[_0x8dc9('0x45')](_0x540cc9['query']['fields']));_0x3c40c0[_0x8dc9('0x46')]=_0x3c40c0[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x3c40c0[_0x8dc9('0x46')]:_0x2e5e16[_0x8dc9('0x41')];if(!_0x540cc9[_0x8dc9('0x42')]['hasOwnProperty']('nolimit')){_0x3c40c0[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x540cc9['query']['limit']);_0x3c40c0[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x3c40c0[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x540cc9[_0x8dc9('0x42')]['sort']);_0x3c40c0[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0x540cc9['query'],_0x2e5e16[_0x8dc9('0x43')]));_0x3c40c0[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x4ed502['id'];if(_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x3c40c0[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x3c40c0[_0x8dc9('0x4a')],{'$or':_['map'](_0x3c40c0['attributes'],function(_0x24d0ff){var _0x315fb8={};_0x315fb8[_0x24d0ff]={'$like':'%'+_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x315fb8;})});}_0x3c40c0=_['merge']({},_0x3c40c0,_0x540cc9[_0x8dc9('0x4f')]);return db['Disposition']['count']({'where':_0x3c40c0[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x127dd3){_0x5d3941[_0x8dc9('0x2d')]=_0x127dd3;if(_0x540cc9[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x3c40c0[_0x8dc9('0x52')]=[{'all':!![]}];}return db[_0x8dc9('0x66')][_0x8dc9('0x53')](_0x3c40c0);})[_0x8dc9('0x34')](function(_0x56adbf){_0x5d3941[_0x8dc9('0x54')]=_0x56adbf;return _0x5d3941;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0x49cbc5,_0x3c40c0))['catch'](handleError(_0x49cbc5,null));};exports[_0x8dc9('0x68')]=function(_0x46d7c4,_0x595735,_0x2eb016){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x46d7c4[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x595735,null))['then'](function(_0x2cf3fb){if(_0x2cf3fb){return _0x2cf3fb[_0x8dc9('0x68')](_0x46d7c4[_0x8dc9('0x42')]['ids']);}})[_0x8dc9('0x34')](respondWithStatusCode(_0x595735,null))[_0x8dc9('0x29')](handleError(_0x595735,null));};exports['addAnswer']=function(_0x322a03,_0x30f1f3,_0x47367c){if(_0x322a03['body']['id']){delete _0x322a03[_0x8dc9('0x59')]['id'];}return db['SmsAccount'][_0x8dc9('0x57')]({'where':{'id':_0x322a03[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x30f1f3,null))['then'](function(_0x35b24a){if(_0x35b24a){_0x322a03[_0x8dc9('0x59')][_0x8dc9('0x63')]=_0x35b24a['id'];return db[_0x8dc9('0x69')][_0x8dc9('0x58')](_0x322a03[_0x8dc9('0x59')]);}})[_0x8dc9('0x34')](respondWithResult(_0x30f1f3,null))[_0x8dc9('0x29')](handleError(_0x30f1f3,null));};exports['getAnswers']=function(_0x379be7,_0x4d17b7,_0x1e9b10){var _0x46b006={'raw':![],'where':{}};var _0x3eda54={};var _0x52323a={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x379be7[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x4d17b7,null))['then'](function(_0x1f7e25){if(_0x1f7e25){_0x3eda54[_0x8dc9('0x41')]=_[_0x8dc9('0x55')](db[_0x8dc9('0x69')][_0x8dc9('0x56')]);_0x3eda54[_0x8dc9('0x42')]=_['keys'](_0x379be7['query']);_0x3eda54[_0x8dc9('0x43')]=_['intersection'](_0x3eda54[_0x8dc9('0x41')],_0x3eda54['query']);_0x46b006[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x3eda54[_0x8dc9('0x41')],qs['fields'](_0x379be7[_0x8dc9('0x42')]['fields']));_0x46b006[_0x8dc9('0x46')]=_0x46b006[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x46b006[_0x8dc9('0x46')]:_0x3eda54[_0x8dc9('0x41')];if(!_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x46b006[_0x8dc9('0x2f')]=qs['limit'](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x2f')]);_0x46b006[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x46b006['order']=qs[_0x8dc9('0x49')](_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x46b006[_0x8dc9('0x4a')]=qs['filters'](_[_0x8dc9('0x4b')](_0x379be7[_0x8dc9('0x42')],_0x3eda54[_0x8dc9('0x43')]));_0x46b006[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x1f7e25['id'];if(_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x46b006[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x46b006[_0x8dc9('0x4a')],{'$or':_[_0x8dc9('0x3d')](_0x46b006[_0x8dc9('0x46')],function(_0x90362a){var _0x5e295d={};_0x5e295d[_0x90362a]={'$like':'%'+_0x379be7['query'][_0x8dc9('0x4d')]+'%'};return _0x5e295d;})});}_0x46b006=_[_0x8dc9('0x4e')]({},_0x46b006,_0x379be7[_0x8dc9('0x4f')]);return db[_0x8dc9('0x69')]['count']({'where':_0x46b006[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x5bb468){_0x52323a[_0x8dc9('0x2d')]=_0x5bb468;if(_0x379be7[_0x8dc9('0x42')][_0x8dc9('0x51')]){_0x46b006[_0x8dc9('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x46b006);})[_0x8dc9('0x34')](function(_0x38b280){_0x52323a[_0x8dc9('0x54')]=_0x38b280;return _0x52323a;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0x4d17b7,_0x46b006))[_0x8dc9('0x29')](handleError(_0x4d17b7,null));};exports[_0x8dc9('0x6b')]=function(_0x375d25,_0x2998ff,_0x42682e){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x375d25[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2998ff,null))[_0x8dc9('0x34')](function(_0x4a015c){if(_0x4a015c){return _0x4a015c['removeAnswers'](_0x375d25[_0x8dc9('0x42')][_0x8dc9('0x6c')]);}})[_0x8dc9('0x34')](respondWithStatusCode(_0x2998ff,null))['catch'](handleError(_0x2998ff,null));};exports[_0x8dc9('0x6d')]=function(_0x3024ed,_0x1f0556,_0x328700){var _0x455625={'channel':_0x8dc9('0x6e')};var _0x15612e=[];var _0x2106e2=[];var _0xb523c9={};return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x3024ed[_0x8dc9('0x60')]['id']},'include':[{'model':db[_0x8dc9('0x6f')],'as':_0x8dc9('0x70')}]})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))[_0x8dc9('0x34')](function(_0x5aebdd){_0x455625[_0x8dc9('0x71')]=_0x5aebdd;_0x455625[_0x8dc9('0x72')]=_[_0x8dc9('0x73')](_0x5aebdd[_0x8dc9('0x70')],[_0x8dc9('0x74')],[_0x8dc9('0x75')]);if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x70')]){delete _0x455625['account']['Applications'];}return db[_0x8dc9('0x76')][_0x8dc9('0x61')]();})[_0x8dc9('0x34')](function(_0x3a6558){if(!_0x3a6558){throw new db[(_0x8dc9('0x77'))]['ValidationError'](_0x8dc9('0x78'));}_0x15612e=_[_0x8dc9('0x79')](_[_0x8dc9('0x55')](_0x3a6558),[_0x8dc9('0x7a'),_0x8dc9('0x7b')]);_0x2106e2=_[_0x8dc9('0x79')](_[_0x8dc9('0x55')](_0x3a6558),[_0x8dc9('0x7a'),'updatedAt',_0x8dc9('0x7c'),_0x8dc9('0x7d')]);_0x455625[_0x8dc9('0x59')]={'mapKey':'mobile'};if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]){switch(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]){case _0x8dc9('0x7e'):_0x455625['body'][_0x8dc9('0x7f')]=_0x3024ed['body']['From'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x80')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['MessageSid'];break;case'skebby':_0x455625['body'][_0x8dc9('0x7f')]='+'+_0x3024ed[_0x8dc9('0x59')]['sender'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed['body'][_0x8dc9('0x82')];break;case _0x8dc9('0x83'):_0x455625[_0x8dc9('0x59')]['from']=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x27')];break;case'clicksend':_0x455625['body'][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')]['body']=_0x3024ed['body'][_0x8dc9('0x59')];_0x455625['body'][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['message_id'];break;case _0x8dc9('0x84'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed['body'][_0x8dc9('0x85')];_0x455625['body'][_0x8dc9('0x59')]=_0x3024ed['body'][_0x8dc9('0x86')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x87')];break;case _0x8dc9('0x88'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]='+'+_0x3024ed['body'][_0x8dc9('0x89')][0x0][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed['body']['results'][0x0][_0x8dc9('0x82')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')]['results'][0x0][_0x8dc9('0x81')];break;case _0x8dc9('0x8a'):_0x455625[_0x8dc9('0x59')]['from']=_0x3024ed[_0x8dc9('0x59')]['originatingAddress'];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8b')]['message'];break;case _0x8dc9('0x8c'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8d')];_0x455625['body'][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x82')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x8e')];break;case _0x8dc9('0x8f'):_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x7f')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x27')];_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')]=_0x3024ed[_0x8dc9('0x59')][_0x8dc9('0x90')];break;}}if(_0x455625['body']['id']){delete _0x455625[_0x8dc9('0x59')]['id'];}if(_[_0x8dc9('0x91')](_0x455625['body'][_0x8dc9('0x7f')])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x93'));}if(_['isNil'](_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')])||_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')]===''){throw new db['Sequelize'][(_0x8dc9('0x92'))](_0x8dc9('0x94'));}if(_[_0x8dc9('0x91')](_0x455625[_0x8dc9('0x59')]['mapKey'])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x95')+_0x2106e2);}if(!_['includes'](_0x2106e2,_0x455625[_0x8dc9('0x59')][_0x8dc9('0x96')])){throw new db['Sequelize'][(_0x8dc9('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2106e2);}_0xb523c9[_0x455625[_0x8dc9('0x59')][_0x8dc9('0x96')]]=_0x455625[_0x8dc9('0x59')][_0x8dc9('0x7f')];return db[_0x8dc9('0x97')]['find']({'where':{'id':_0x455625[_0x8dc9('0x71')][_0x8dc9('0x7d')]},'include':[{'model':db[_0x8dc9('0x76')],'as':_0x8dc9('0x98'),'where':_0xb523c9,'limit':0x1,'order':[[_0x8dc9('0x7b'),_0x8dc9('0x99')]]}]});})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))['then'](function(_0xc8b1f5){if(_0xc8b1f5){_0x455625['list']=_['omit'](_0xc8b1f5,[_0x8dc9('0x98')]);if(_0xc8b1f5[_0x8dc9('0x98')][_0x8dc9('0x47')]){return _0xc8b1f5[_0x8dc9('0x98')][0x0];}var _0x5199fd=_['defaults'](_0x455625[_0x8dc9('0x59')],{'firstName':_0x455625['body'][_0x8dc9('0x7f')],'ListId':_0xc8b1f5['id']});_0x5199fd[_0x455625[_0x8dc9('0x59')]['mapKey']]=_0x455625['body'][_0x8dc9('0x7f')];return db[_0x8dc9('0x76')][_0x8dc9('0x58')](_0x5199fd,{'fields':_0x15612e,'raw':!![]});}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1f0556,null))[_0x8dc9('0x34')](function(_0x14151e){if(_0x14151e){_0x455625[_0x8dc9('0x9a')]=_0x14151e;var _0x2e4b96={'ContactId':_0x14151e['id'],'phone':_0x455625['body'][_0x8dc9('0x7f')],'SmsAccountId':_0x3024ed['params']['id']};var _0x2aa739={'ContactId':_0x14151e['id'],'SmsAccountId':_0x3024ed[_0x8dc9('0x60')]['id'],'closed':![]};return db[_0x8dc9('0x9b')][_0x8dc9('0x57')]({'where':_0x2aa739})['then'](function(_0x4f16e7){if(_0x4f16e7){return[_0x4f16e7,![]];}return db[_0x8dc9('0x9b')][_0x8dc9('0x58')](_0x2e4b96)[_0x8dc9('0x34')](function(_0x286f23){return[_0x286f23,!![]];});});}})[_0x8dc9('0x9c')](function(_0x5c8418,_0x41926c){_0x455625['interaction']=_0x5c8418[_0x8dc9('0x5d')]({'plain':!![]});_0x455625[_0x8dc9('0x9d')][_0x8dc9('0x9e')]=![];if(_0x41926c){if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x9f')]){_0x455625[_0x8dc9('0x72')][_0x8dc9('0xa0')]({'id':0x0,'priority':_0x455625[_0x8dc9('0x72')]['length']+0x1,'app':'close','appdata':_0x8dc9('0xa1'),'interval':_0x8dc9('0xa2')});}_0x455625[_0x8dc9('0x9d')]['created']=!![];}return db[_0x8dc9('0xa3')][_0x8dc9('0x58')]({'phone':_0x455625[_0x8dc9('0x59')]['from'],'messageId':_0x455625[_0x8dc9('0x59')][_0x8dc9('0x81')],'body':_0x455625[_0x8dc9('0x59')][_0x8dc9('0x59')],'SmsAccountId':_0x3024ed[_0x8dc9('0x60')]['id'],'SmsInteractionId':_0x5c8418['id'],'direction':'in','ContactId':_0x5c8418[_0x8dc9('0xa4')],'AttachmentId':_0x455625['body'][_0x8dc9('0xa5')]});})['then'](function(_0x5a09a8){_0x455625[_0x8dc9('0x27')]=_0x5a09a8;if(_0x455625[_0x8dc9('0x9d')][_0x8dc9('0xa6')]){return db[_0x8dc9('0xa7')][_0x8dc9('0x57')]({'attributes':['id',_0x8dc9('0x3a')],'where':{'id':_0x455625['interaction'][_0x8dc9('0xa6')]}})[_0x8dc9('0x34')](function(_0x11389b){if(_0x11389b){_0x455625[_0x8dc9('0x72')][_0x8dc9('0xa8')]({'id':0x0,'priority':0x0,'app':_0x8dc9('0xa9'),'appdata':_0x11389b[_0x8dc9('0x3a')]+','+(_0x455625['account'][_0x8dc9('0xaa')]||0xa),'interval':_0x8dc9('0xa2')});}return respondWithRpcPromise(_0x8dc9('0xab'),'startRouting',_0x455625);});}return respondWithRpcPromise(_0x8dc9('0xab'),'startRouting',_0x455625);})[_0x8dc9('0x34')](function(_0x41ca4d){if(_0x41ca4d){var _0x5e17fc=0xc8;var _0x226bb4=_0x8dc9('0xac');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x226bb4,_0x5e17fc,_0x8dc9('0xad'));logger[_0x8dc9('0x23')](_0x8dc9('0xae'),_0x226bb4,_0x5e17fc,_0x8dc9('0xad'),JSON[_0x8dc9('0x25')](_0x41ca4d));if(_0x455625[_0x8dc9('0x71')][_0x8dc9('0x3f')]===_0x8dc9('0x7e')){return _0x1f0556['status'](_0x5e17fc)['set']('Content-Type',_0x8dc9('0xaf'))[_0x8dc9('0xb0')]('\x0a');}else{return _0x1f0556[_0x8dc9('0x2b')](_0x5e17fc)[_0x8dc9('0x2c')](_0x41ca4d);}}})['catch'](handleError(_0x1f0556,null));};exports['addApplications']=function(_0x5f370d,_0x2ce674,_0x565687){return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0x5f370d[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2ce674,null))[_0x8dc9('0x34')](function(_0x428934){if(_0x428934){return db[_0x8dc9('0xb1')][_0x8dc9('0xb2')](function(_0x356c5a){return db[_0x8dc9('0x6f')][_0x8dc9('0x35')]({'where':{'SmsAccountId':_0x5f370d[_0x8dc9('0x60')]['id']},'transaction':_0x356c5a})[_0x8dc9('0x34')](function(_0x1ff694){var _0x4c076d=_[_0x8dc9('0x3d')](_0x5f370d[_0x8dc9('0x59')],function(_0x3328f3){_0x3328f3[_0x8dc9('0x63')]=_0x5f370d[_0x8dc9('0x60')]['id'];return _0x3328f3;});return db['SmsApplication'][_0x8dc9('0xb3')](_0x4c076d,{'transaction':_0x356c5a});});})[_0x8dc9('0x34')](function(){return db['SmsApplication'][_0x8dc9('0xb4')]({'where':{'SmsAccountId':_0x5f370d['params']['id']},'order':_0x8dc9('0x74')});});}})[_0x8dc9('0x34')](respondWithResult(_0x2ce674,null))[_0x8dc9('0x29')](handleError(_0x2ce674,null));};exports[_0x8dc9('0xb5')]=function(_0x7c76e4,_0x51c37a,_0x206b48){var _0x32129a={};var _0x449454={};var _0x4a59ba;var _0x1f8a0b;return db[_0x8dc9('0x50')]['findOne']({'where':{'id':_0x7c76e4[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x51c37a,null))[_0x8dc9('0x34')](function(_0x3444aa){if(_0x3444aa){_0x4a59ba=_0x3444aa;_0x449454[_0x8dc9('0x41')]=_[_0x8dc9('0x55')](db[_0x8dc9('0x6f')][_0x8dc9('0x56')]);_0x449454['query']=_['keys'](_0x7c76e4[_0x8dc9('0x42')]);_0x449454['filters']=_[_0x8dc9('0x44')](_0x449454[_0x8dc9('0x41')],_0x449454[_0x8dc9('0x42')]);_0x32129a[_0x8dc9('0x46')]=_['intersection'](_0x449454[_0x8dc9('0x41')],qs['fields'](_0x7c76e4[_0x8dc9('0x42')]['fields']));_0x32129a[_0x8dc9('0x46')]=_0x32129a[_0x8dc9('0x46')]['length']?_0x32129a[_0x8dc9('0x46')]:_0x449454[_0x8dc9('0x41')];_0x32129a[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x7c76e4[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x32129a[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_['pick'](_0x7c76e4[_0x8dc9('0x42')],_0x449454[_0x8dc9('0x43')]));if(_0x7c76e4[_0x8dc9('0x42')]['filter']){_0x32129a[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x32129a['where'],{'$or':_[_0x8dc9('0x3d')](_0x32129a[_0x8dc9('0x46')],function(_0x2e5dfe){var _0x55ef9b={};_0x55ef9b[_0x2e5dfe]={'$like':'%'+_0x7c76e4[_0x8dc9('0x42')]['filter']+'%'};return _0x55ef9b;})});}_0x32129a=_[_0x8dc9('0x4e')]({},_0x32129a,_0x7c76e4['options']);return _0x4a59ba[_0x8dc9('0xb5')](_0x32129a);}})['then'](function(_0x4553cf){if(_0x4553cf){_0x1f8a0b=_0x4553cf[_0x8dc9('0x47')];if(!_0x7c76e4[_0x8dc9('0x42')][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x32129a['limit']=qs[_0x8dc9('0x2f')](_0x7c76e4[_0x8dc9('0x42')]['limit']);_0x32129a[_0x8dc9('0x2e')]=qs[_0x8dc9('0x2e')](_0x7c76e4[_0x8dc9('0x42')]['offset']);}return _0x4a59ba[_0x8dc9('0xb5')](_0x32129a);}})[_0x8dc9('0x34')](function(_0x56a7ff){if(_0x56a7ff){return _0x56a7ff?{'count':_0x1f8a0b,'rows':_0x56a7ff}:null;}})[_0x8dc9('0x34')](respondWithResult(_0x51c37a,null))[_0x8dc9('0x29')](handleError(_0x51c37a,null));};exports[_0x8dc9('0xb6')]=function(_0xb8cb6f,_0xde7eaf,_0x9e54f6){var _0x34e78e={'raw':![],'where':{}};var _0x356737={};var _0x9db5fe={'count':0x0,'rows':[]};return db[_0x8dc9('0x50')][_0x8dc9('0x65')]({'where':{'id':_0xb8cb6f[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0xde7eaf,null))['then'](function(_0x68a0ea){if(_0x68a0ea){_0x356737['model']=_['keys'](db[_0x8dc9('0x9b')][_0x8dc9('0x56')]);_0x356737[_0x8dc9('0x42')]=_[_0x8dc9('0x55')](_0xb8cb6f[_0x8dc9('0x42')]);_0x356737[_0x8dc9('0x43')]=_['intersection'](_0x356737['model'],_0x356737[_0x8dc9('0x42')]);_0x34e78e[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x356737[_0x8dc9('0x41')],qs[_0x8dc9('0x45')](_0xb8cb6f['query'][_0x8dc9('0x45')]));_0x34e78e[_0x8dc9('0x46')]=_0x34e78e[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x34e78e[_0x8dc9('0x46')]:_0x356737['model'];if(!_0xb8cb6f['query'][_0x8dc9('0x48')](_0x8dc9('0x6a'))){_0x34e78e[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x2f')]);_0x34e78e[_0x8dc9('0x2e')]=qs['offset'](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}_0x34e78e['order']=qs[_0x8dc9('0x49')](_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x34e78e['where']=qs[_0x8dc9('0x43')](_[_0x8dc9('0x4b')](_0xb8cb6f[_0x8dc9('0x42')],_0x356737['filters']));_0x34e78e[_0x8dc9('0x4a')][_0x8dc9('0x63')]=_0x68a0ea['id'];if(_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x34e78e[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x34e78e['where'],{'$or':_['map'](_0x34e78e[_0x8dc9('0x46')],function(_0x33a7cf){var _0x172b72={};_0x172b72[_0x33a7cf]={'$like':'%'+_0xb8cb6f['query'][_0x8dc9('0x4d')]+'%'};return _0x172b72;})});}_0x34e78e=_[_0x8dc9('0x4e')]({},_0x34e78e,_0xb8cb6f['options']);return db[_0x8dc9('0x9b')][_0x8dc9('0x2d')]({'where':_0x34e78e[_0x8dc9('0x4a')]})[_0x8dc9('0x34')](function(_0x5ba421){_0x9db5fe[_0x8dc9('0x2d')]=_0x5ba421;if(_0xb8cb6f[_0x8dc9('0x42')]['includeAll']){_0x34e78e[_0x8dc9('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8dc9('0xa7')],'as':'Owner','attributes':[_0x8dc9('0x3a'),_0x8dc9('0xb7'),'internal'],'required':![]},{'model':db[_0x8dc9('0xb8')],'as':_0x8dc9('0xb9'),'attributes':['id',_0x8dc9('0x3a'),_0x8dc9('0xba')],'where':_0xb8cb6f['query'][_0x8dc9('0xbb')]?{'id':_0xb8cb6f[_0x8dc9('0x42')]['tag']}:undefined,'required':_0xb8cb6f[_0x8dc9('0x42')][_0x8dc9('0xbb')]?!![]:![]}];}return db['SmsInteraction'][_0x8dc9('0x53')](_0x34e78e);})['then'](function(_0x4288a8){_0x9db5fe[_0x8dc9('0x54')]=_0x4288a8;return _0x9db5fe;});}})[_0x8dc9('0x34')](respondWithFilteredResult(_0xde7eaf,_0x34e78e))['catch'](handleError(_0xde7eaf,null));};exports[_0x8dc9('0xb0')]=function(_0x27af6b,_0x6783d4,_0x663d28){var _0x4795ea,_0x5c4e3f,_0x562681;if(_['isNil'](_0x27af6b[_0x8dc9('0x59')][_0x8dc9('0x59')])||_0x27af6b[_0x8dc9('0x59')]['body']===''){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0x94'));}if(_[_0x8dc9('0x91')](_0x27af6b[_0x8dc9('0x59')]['to'])){throw new db[(_0x8dc9('0x77'))][(_0x8dc9('0x92'))](_0x8dc9('0xbc'));}_0x4795ea=_0x27af6b['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x27af6b['params']['id']},'include':[{'model':db[_0x8dc9('0x97')],'as':_0x8dc9('0xbd'),'include':[{'model':db[_0x8dc9('0x76')],'as':_0x8dc9('0x98'),'where':{'mobile':_0x4795ea},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8dc9('0x34')](handleEntityNotFound(_0x6783d4,null))[_0x8dc9('0x34')](function(_0x42b5e0){if(_0x42b5e0&&_0x42b5e0['List']){_0x5c4e3f=_0x42b5e0[_0x8dc9('0x5d')]({'plain':!![]});if(_0x5c4e3f['List']&&_0x5c4e3f[_0x8dc9('0xbd')]['Contacts'][_0x8dc9('0x47')]){return _0x5c4e3f[_0x8dc9('0xbd')][_0x8dc9('0x98')][0x0];}return db['CmContact'][_0x8dc9('0x58')](_[_0x8dc9('0xbe')](_0x27af6b[_0x8dc9('0x59')],{'firstName':_0x4795ea,'mobile':_0x4795ea,'phone':_0x4795ea,'ListId':_0x5c4e3f[_0x8dc9('0x7d')]}));}})[_0x8dc9('0x34')](handleEntityNotFound(_0x6783d4,null))['then'](function(_0x59d2f6){if(_0x59d2f6){_0x562681=_0x59d2f6;return db[_0x8dc9('0x9b')][_0x8dc9('0x57')]({'where':{'ContactId':_0x562681['id'],'closed':![],'SmsAccountId':_0x5c4e3f['id']}})[_0x8dc9('0x34')](function(_0x127b61){if(_0x127b61){return[_0x127b61,![]];}return db[_0x8dc9('0x9b')]['create']({'UserId':_0x27af6b[_0x8dc9('0x5a')]['id'],'ContactId':_0x562681['id'],'SmsAccountId':_0x5c4e3f['id'],'phone':_0x4795ea,'firstMsgDirection':'out','Messages':[_[_0x8dc9('0x4e')](_0x27af6b[_0x8dc9('0x59')],{'read':![],'body':_0x27af6b[_0x8dc9('0x59')]['body'],'phone':_0x4795ea,'SmsAccountId':_0x5c4e3f['id'],'UserId':_0x27af6b['user']['id'],'ContactId':_0x562681['id']})]},{'include':[{'model':db[_0x8dc9('0xa3')],'as':_0x8dc9('0xbf')}]})[_0x8dc9('0x34')](function(_0x576e89){return[_0x576e89,!![]];});});}})[_0x8dc9('0x9c')](function(_0x4737df,_0x42e1f1){if(_0x42e1f1){return _0x4737df;}return db[_0x8dc9('0xa3')][_0x8dc9('0x58')](_[_0x8dc9('0x4e')](_0x27af6b['body'],{'read':![],'body':_0x27af6b[_0x8dc9('0x59')][_0x8dc9('0x59')],'phone':_0x4795ea,'SmsAccountId':_0x5c4e3f['id'],'SmsInteractionId':_0x4737df['id'],'UserId':_0x27af6b['user']['id'],'ContactId':_0x562681['id']}))[_0x8dc9('0x34')](function(_0x2bbff4){_0x4737df[_0x8dc9('0xc0')][_0x8dc9('0xbf')]=[];_0x4737df['dataValues'][_0x8dc9('0xbf')][_0x8dc9('0xa0')](_0x2bbff4[_0x8dc9('0xc0')]);return _0x4737df;});})[_0x8dc9('0x34')](respondWithResult(_0x6783d4,null))[_0x8dc9('0x29')](handleError(_0x6783d4,null));};exports['status']=function(_0x3af2e5,_0x1edbb1,_0x45138a){if(_0x3af2e5[_0x8dc9('0x59')]['id']){delete _0x3af2e5[_0x8dc9('0x59')]['id'];}console['log'](_0x8dc9('0xc1'),_0x3af2e5[_0x8dc9('0x59')]);var _0x70ee6f,_0x97c29a,_0x3fca6d;return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x3af2e5[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1edbb1,null))[_0x8dc9('0x34')](function(_0x51ca50){if(_0x51ca50){_0x3fca6d=_0x51ca50;logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc2'),_0x51ca50['type'],util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));switch(_0x51ca50['type']){case'skebby':if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc4')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')]['status'];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc4')]}});}break;case'connectel':if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc5')]&&_0x3af2e5['body']['statusInt']){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc6')];return db[_0x8dc9('0xa3')][_0x8dc9('0x57')]({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc5')]}});}break;case _0x8dc9('0xc7'):if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc8')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc9')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc9')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xc8')]}});}break;case _0x8dc9('0x88'):var _0x37475b=_0x3af2e5[_0x8dc9('0x59')]['results'][0x0];if(_0x37475b[_0x8dc9('0x81')]&&_0x37475b[_0x8dc9('0x2b')][_0x8dc9('0xca')]===_0x8dc9('0xcb')){_0x97c29a=_0x37475b[_0x8dc9('0x2b')][_0x8dc9('0xca')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x37475b[_0x8dc9('0x81')]}});}break;case _0x8dc9('0x8c'):if(_0x3af2e5[_0x8dc9('0x59')]['messageId']&&_0x3af2e5[_0x8dc9('0x59')]['status']){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')];return db[_0x8dc9('0xa3')][_0x8dc9('0x57')]({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')]['messageId']}});}break;case _0x8dc9('0x8f'):if(_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xcc')]&&_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')]){_0x97c29a=_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0x2b')];return db[_0x8dc9('0xa3')]['find']({'where':{'messageId':_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xcc')]}});}break;}}})[_0x8dc9('0x34')](handleEntityNotFound(_0x1edbb1,null))[_0x8dc9('0x34')](function(_0x2021f4){if(_0x2021f4){_0x70ee6f=_0x2021f4;switch(_0x3fca6d['type']){case _0x8dc9('0xcd'):if(_0x97c29a===_0x8dc9('0xcb')){return _0x70ee6f[_0x8dc9('0x33')]({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xcd'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x83'):if(_0x97c29a==='1'){return _0x70ee6f[_0x8dc9('0x33')]({'read':!![]});}else{logger['error'](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xcd'),util[_0x8dc9('0xc3')](_0x3af2e5['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3af2e5[_0x8dc9('0x59')][_0x8dc9('0xce')]&&_0x97c29a>=0xc8&&_0x97c29a<=0xce){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc7'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x88'):var _0x15abda=_0x3af2e5[_0x8dc9('0x59')]['results'][0x0];if(_0x15abda[_0x8dc9('0x2b')][_0x8dc9('0xca')]===_0x8dc9('0xcb')){return _0x70ee6f['update']({'read':!![]});}else{logger['error'](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x88'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x8c'):if(_0x97c29a==_0x8dc9('0xcf')||_0x97c29a==_0x8dc9('0xd0')){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x8c'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8dc9('0x8f'):if(_0x97c29a==='DELIVRD'||_0x97c29a===_0x8dc9('0xd1')){return _0x70ee6f['update']({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),'status',_0x8dc9('0x8f'),util[_0x8dc9('0xc3')](_0x3af2e5[_0x8dc9('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x70ee6f;}})['then'](respondWithResult(_0x1edbb1,null))[_0x8dc9('0x29')](handleError(_0x1edbb1,null));};exports[_0x8dc9('0xd2')]=function(_0x24c648,_0x2198aa,_0x15860e){var _0x3f3a33,_0x41dfef,_0x215cd2;return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x24c648[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x2198aa,null))[_0x8dc9('0x34')](function(_0x37f8e8){if(_0x37f8e8){_0x215cd2=_0x37f8e8;logger[_0x8dc9('0x23')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0xc2'),_0x37f8e8[_0x8dc9('0x3f')],util[_0x8dc9('0xc3')](_0x24c648[_0x8dc9('0x42')],{'showHidden':![],'depth':null}));switch(_0x37f8e8['type']){case _0x8dc9('0x8a'):if(_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd3')]&&_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd4')]){_0x41dfef=_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd4')];return db['SmsMessage'][_0x8dc9('0x57')]({'where':{'messageId':_0x24c648[_0x8dc9('0x42')][_0x8dc9('0xd3')]}});}break;}}})[_0x8dc9('0x34')](handleEntityNotFound(_0x2198aa,null))[_0x8dc9('0x34')](function(_0x2bf85d){if(_0x2bf85d){_0x3f3a33=_0x2bf85d;switch(_0x215cd2[_0x8dc9('0x3f')]){case _0x8dc9('0x8a'):if(_0x41dfef==='2'||_0x41dfef==='6'){return _0x3f3a33[_0x8dc9('0x33')]({'read':!![]});}else{logger[_0x8dc9('0x26')](_0x8dc9('0x24'),_0x8dc9('0x2b'),_0x8dc9('0x8a'),util['inspect'](_0x24c648[_0x8dc9('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x3f3a33;}})[_0x8dc9('0x34')](respondWithResult(_0x2198aa,null))['catch'](handleError(_0x2198aa,null));};exports[_0x8dc9('0xd5')]=function(_0x5ad9fa,_0x38c702,_0x538e7d){return db[_0x8dc9('0x50')][_0x8dc9('0x57')]({'where':{'id':_0x5ad9fa[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x38c702,null))['then'](function(_0x457db1){if(_0x457db1){return _0x457db1[_0x8dc9('0xd5')](_0x5ad9fa[_0x8dc9('0x59')][_0x8dc9('0x6c')],_[_0x8dc9('0xd6')](_0x5ad9fa[_0x8dc9('0x59')],[_0x8dc9('0x6c'),'id'])||{})[_0x8dc9('0x9c')](function(_0xe213a7){for(var _0x522c64=0x0;_0x522c64<_0x5ad9fa[_0x8dc9('0x59')][_0x8dc9('0x6c')][_0x8dc9('0x47')];_0x522c64+=0x1){socket[_0x8dc9('0xd7')](_0x8dc9('0xd8'),{'UserId':_0x5ad9fa['body'][_0x8dc9('0x6c')][_0x522c64],'SmsAccountId':_0x5ad9fa[_0x8dc9('0x60')]['id']});}return _0xe213a7;});}})[_0x8dc9('0x34')](respondWithResult(_0x38c702,null))[_0x8dc9('0x29')](handleError(_0x38c702,null));};exports['removeAgents']=function(_0x3a26f0,_0x39b015,_0x184ed5){return db[_0x8dc9('0x50')]['find']({'where':{'id':_0x3a26f0[_0x8dc9('0x60')]['id']}})['then'](handleEntityNotFound(_0x39b015,null))[_0x8dc9('0x34')](function(_0x15e471){if(_0x15e471){return _0x15e471[_0x8dc9('0xd9')](_0x3a26f0['query']['ids'])['then'](function(){if(_['isArray'](_0x3a26f0['query'][_0x8dc9('0x6c')])){for(var _0x5b204a=0x0;_0x5b204a<_0x3a26f0['query'][_0x8dc9('0x6c')][_0x8dc9('0x47')];_0x5b204a+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x3a26f0[_0x8dc9('0x42')][_0x8dc9('0x6c')][_0x5b204a]),'SmsAccountId':Number(_0x3a26f0[_0x8dc9('0x60')]['id'])});}}else{socket[_0x8dc9('0xd7')](_0x8dc9('0xda'),{'UserId':Number(_0x3a26f0[_0x8dc9('0x42')][_0x8dc9('0x6c')]),'SmsAccountId':Number(_0x3a26f0[_0x8dc9('0x60')]['id'])});}});}})[_0x8dc9('0x34')](respondWithStatusCode(_0x39b015,null))[_0x8dc9('0x29')](handleError(_0x39b015,null));};exports[_0x8dc9('0xdb')]=function(_0x5c0461,_0x56e1cf,_0x3bfdea){var _0x4165db={};var _0x58440e={};var _0x4f2aa0;var _0x213d2b;return db[_0x8dc9('0x50')]['findOne']({'where':{'id':_0x5c0461[_0x8dc9('0x60')]['id']}})[_0x8dc9('0x34')](handleEntityNotFound(_0x56e1cf,null))['then'](function(_0x419f37){if(_0x419f37){_0x4f2aa0=_0x419f37;_0x58440e[_0x8dc9('0x41')]=_['keys'](db['User'][_0x8dc9('0x56')]);_0x58440e[_0x8dc9('0x42')]=_['keys'](_0x5c0461['query']);_0x58440e[_0x8dc9('0x43')]=_[_0x8dc9('0x44')](_0x58440e[_0x8dc9('0x41')],_0x58440e[_0x8dc9('0x42')]);_0x4165db[_0x8dc9('0x46')]=_[_0x8dc9('0x44')](_0x58440e[_0x8dc9('0x41')],qs[_0x8dc9('0x45')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x45')]));_0x4165db['attributes']=_0x4165db[_0x8dc9('0x46')][_0x8dc9('0x47')]?_0x4165db[_0x8dc9('0x46')]:_0x58440e['model'];_0x4165db[_0x8dc9('0x67')]=qs[_0x8dc9('0x49')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x49')]);_0x4165db[_0x8dc9('0x4a')]=qs[_0x8dc9('0x43')](_['pick'](_0x5c0461['query'],_0x58440e[_0x8dc9('0x43')]));if(_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x4d')]){_0x4165db[_0x8dc9('0x4a')]=_[_0x8dc9('0x4e')](_0x4165db[_0x8dc9('0x4a')],{'$or':_['map'](_0x4165db[_0x8dc9('0x46')],function(_0x10f98f){var _0x5bbe9f={};_0x5bbe9f[_0x10f98f]={'$like':'%'+_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x4d')]+'%'};return _0x5bbe9f;})});}_0x4165db=_['merge']({},_0x4165db,_0x5c0461[_0x8dc9('0x4f')]);return _0x4f2aa0[_0x8dc9('0xdb')](_0x4165db);}})[_0x8dc9('0x34')](function(_0x1547c5){if(_0x1547c5){_0x213d2b=_0x1547c5[_0x8dc9('0x47')];if(!_0x5c0461[_0x8dc9('0x42')]['hasOwnProperty']('nolimit')){_0x4165db[_0x8dc9('0x2f')]=qs[_0x8dc9('0x2f')](_0x5c0461['query'][_0x8dc9('0x2f')]);_0x4165db['offset']=qs[_0x8dc9('0x2e')](_0x5c0461[_0x8dc9('0x42')][_0x8dc9('0x2e')]);}return _0x4f2aa0[_0x8dc9('0xdb')](_0x4165db);}})[_0x8dc9('0x34')](function(_0x544f6d){if(_0x544f6d){return _0x544f6d?{'count':_0x213d2b,'rows':_0x544f6d}:null;}})[_0x8dc9('0x34')](respondWithResult(_0x56e1cf,null))[_0x8dc9('0x29')](handleError(_0x56e1cf,null));}; \ No newline at end of file +var _0x954d=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','name','index','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','Pause','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','include','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','Body','messageId','MessageSid','skebby','sender','text','connectel','from','plivo','From','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','infobip','groupName','clickatell','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','intelepeer','ACCEPTD','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x292f6d,_0x47073b){var _0x21a98=function(_0x4246f7){while(--_0x4246f7){_0x292f6d['push'](_0x292f6d['shift']());}};_0x21a98(++_0x47073b);}(_0x954d,0x1c3));var _0xd954=function(_0x32ffb5,_0x3866b5){_0x32ffb5=_0x32ffb5-0x0;var _0x3cbd7a=_0x954d[_0x32ffb5];return _0x3cbd7a;};'use strict';var pdf=require(_0xd954('0x0'));var emlformat=require(_0xd954('0x1'));var rimraf=require(_0xd954('0x2'));var zipdir=require(_0xd954('0x3'));var jsonpatch=require(_0xd954('0x4'));var rp=require(_0xd954('0x5'));var moment=require('moment');var BPromise=require(_0xd954('0x6'));var Mustache=require(_0xd954('0x7'));var util=require(_0xd954('0x8'));var path=require(_0xd954('0x9'));var sox=require(_0xd954('0xa'));var csv=require(_0xd954('0xb'));var ejs=require(_0xd954('0xc'));var fs=require('fs');var _=require(_0xd954('0xd'));var squel=require(_0xd954('0xe'));var crypto=require(_0xd954('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd954('0x10'));var toCsv=require(_0xd954('0xb'));var querystring=require(_0xd954('0x11'));var Papa=require('papaparse');var Redis=require(_0xd954('0x12'));var authService=require(_0xd954('0x13'));var qs=require(_0xd954('0x14'));var as=require(_0xd954('0x15'));var hardwareService=require(_0xd954('0x16'));var logger=require(_0xd954('0x17'))('api');var utils=require(_0xd954('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd954('0x19'));var db=require(_0xd954('0x1a'))['db'];config['redis']=_[_0xd954('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd954('0x1c'))(new Redis(config[_0xd954('0x1d')]));require(_0xd954('0x1e'))['register'](socket);var jayson=require(_0xd954('0x1f'));var client=jayson[_0xd954('0x20')][_0xd954('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3a6677,_0x5e56a8,_0x3bfb6b,_0x208dd4){return new BPromise(function(_0x426873,_0x487928){var _0x57c5e6=_0x208dd4||client;return _0x57c5e6[_0xd954('0x22')](_0x3a6677,_0x3bfb6b)[_0xd954('0x23')](function(_0x495a77){logger[_0xd954('0x24')](_0xd954('0x25'),_0x5e56a8,_0xd954('0x26'));logger['debug'](_0xd954('0x27'),_0x5e56a8,'request\x20sent',JSON[_0xd954('0x28')](_0x495a77));if(_0x495a77[_0xd954('0x29')]){if(_0x495a77[_0xd954('0x29')]['code']===0x1f4){logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s',_0x5e56a8,_0x495a77['error'][_0xd954('0x2a')]);return _0x487928(_0x495a77['error'][_0xd954('0x2a')]);}logger['error'](_0xd954('0x25'),_0x5e56a8,_0x495a77[_0xd954('0x29')][_0xd954('0x2a')]);return _0x426873(_0x495a77[_0xd954('0x29')][_0xd954('0x2a')]);}else{logger['info'](_0xd954('0x25'),_0x5e56a8,'request\x20sent');_0x426873(_0x495a77[_0xd954('0x2b')][_0xd954('0x2a')]);}})['catch'](function(_0x5b7ffe){logger['error'](_0xd954('0x25'),_0x5e56a8,_0x5b7ffe);_0x487928(_0x5b7ffe);});});}function respondWithStatusCode(_0xe7531a,_0x4c7dc4){_0x4c7dc4=_0x4c7dc4||0xcc;return function(_0x123382){if(_0x123382){return _0xe7531a[_0xd954('0x2c')](_0x4c7dc4);}return _0xe7531a[_0xd954('0x2d')](_0x4c7dc4)[_0xd954('0x2e')]();};}function respondWithResult(_0x56e005,_0x303ac1){_0x303ac1=_0x303ac1||0xc8;return function(_0x4dd336){if(_0x4dd336){return _0x56e005['status'](_0x303ac1)[_0xd954('0x2f')](_0x4dd336);}};}function respondWithFilteredResult(_0x35a27a,_0x24d6bd){return function(_0x137483){if(_0x137483){var _0x1f6a7d=_0x137483[_0xd954('0x30')],_0x5ab319=_0x24d6bd[_0xd954('0x31')],_0x4f2c3c=_0x24d6bd[_0xd954('0x31')]+_0x24d6bd[_0xd954('0x32')],_0x5aaf96;if(_0x4f2c3c>=_0x1f6a7d){_0x4f2c3c=_0x1f6a7d;_0x5aaf96=0xc8;}else{_0x5aaf96=0xce;}_0x35a27a['status'](_0x5aaf96);return _0x35a27a[_0xd954('0x33')]('Content-Range',_0x5ab319+'-'+_0x4f2c3c+'/'+_0x1f6a7d)['json'](_0x137483);}return null;};}function patchUpdates(_0x26d1bd){return function(_0x17ea37){try{jsonpatch[_0xd954('0x34')](_0x17ea37,_0x26d1bd,!![]);}catch(_0x43ed8e){return BPromise[_0xd954('0x35')](_0x43ed8e);}return _0x17ea37[_0xd954('0x36')]();};}function saveUpdates(_0x59574f,_0x3ce160){return function(_0x253170){if(_0x253170){return _0x253170[_0xd954('0x37')](_0x59574f)[_0xd954('0x23')](function(_0x173cd8){return _0x173cd8;});}return null;};}function removeEntity(_0x5e047c,_0x51f8e1){return function(_0x31b48b){if(_0x31b48b){return _0x31b48b['destroy']()[_0xd954('0x23')](function(){var _0x38140c=_0x31b48b[_0xd954('0x38')]({'plain':!![]});var _0x4bfdc1='SmsAccounts';return db[_0xd954('0x39')][_0xd954('0x3a')]({'where':{'type':_0x4bfdc1,'resourceId':_0x38140c['id']}})['then'](function(){return _0x31b48b;});})[_0xd954('0x23')](function(){_0x5e047c[_0xd954('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300cc5,_0x2f9b20){return function(_0x5395f7){if(!_0x5395f7){_0x300cc5[_0xd954('0x2c')](0x194);}return _0x5395f7;};}function handleError(_0xe0fb1,_0x2620d7){_0x2620d7=_0x2620d7||0x1f4;return function(_0x52d937){logger['error'](_0x52d937['stack']);if(_0x52d937[_0xd954('0x3b')]){delete _0x52d937[_0xd954('0x3b')];}_0xe0fb1['status'](_0x2620d7)['send'](_0x52d937);};}exports[_0xd954('0x3c')]=function(_0x3194d8,_0x48cd37){var _0xd9a813={'include':[{'model':db['Pause'],'as':_0xd954('0x3d')}]},_0x483ddd={},_0x508ab2={'count':0x0,'rows':[]};var _0x3b4723=_[_0xd954('0x3e')](db[_0xd954('0x3f')]['rawAttributes'],function(_0xaab520){return{'name':_0xaab520[_0xd954('0x40')],'type':_0xaab520[_0xd954('0x41')]['key']};});_0x483ddd[_0xd954('0x42')]=_[_0xd954('0x3e')](_0x3b4723,_0xd954('0x3b'));_0x483ddd['query']=_[_0xd954('0x43')](_0x3194d8[_0xd954('0x44')]);_0x483ddd['filters']=_[_0xd954('0x45')](_0x483ddd[_0xd954('0x42')],_0x483ddd[_0xd954('0x44')]);_0xd9a813[_0xd954('0x46')]=_['intersection'](_0x483ddd[_0xd954('0x42')],qs[_0xd954('0x47')](_0x3194d8[_0xd954('0x44')][_0xd954('0x47')]));_0xd9a813[_0xd954('0x46')]=_0xd9a813[_0xd954('0x46')][_0xd954('0x48')]?_0xd9a813['attributes']:_0x483ddd[_0xd954('0x42')];if(!_0x3194d8[_0xd954('0x44')][_0xd954('0x49')](_0xd954('0x4a'))){_0xd9a813[_0xd954('0x32')]=qs['limit'](_0x3194d8['query'][_0xd954('0x32')]);_0xd9a813[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x3194d8[_0xd954('0x44')]['offset']);}_0xd9a813['order']=qs['sort'](_0x3194d8[_0xd954('0x44')][_0xd954('0x4b')]);_0xd9a813[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x3194d8[_0xd954('0x44')],_0x483ddd[_0xd954('0x4d')]),_0x3b4723);if(_0x3194d8[_0xd954('0x44')]['filter']){_0xd9a813[_0xd954('0x4c')]=_[_0xd954('0x4f')](_0xd9a813[_0xd954('0x4c')],{'$or':_['map'](_0x3b4723,function(_0x5e693d){if(_0x5e693d[_0xd954('0x41')]!==_0xd954('0x50')){var _0x5ecfa9={};_0x5ecfa9[_0x5e693d[_0xd954('0x3b')]]={'$like':'%'+_0x3194d8[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x5ecfa9;}})});}_0xd9a813=_[_0xd954('0x4f')]({},_0xd9a813,_0x3194d8[_0xd954('0x52')]);var _0x3778d7={'where':_0xd9a813[_0xd954('0x4c')]};return db[_0xd954('0x3f')][_0xd954('0x30')](_0x3778d7)[_0xd954('0x23')](function(_0xb6622){_0x508ab2['count']=_0xb6622;if(_0x3194d8[_0xd954('0x44')][_0xd954('0x53')]){_0xd9a813['include']=[{'all':!![]}];}return db[_0xd954('0x3f')]['findAll'](_0xd9a813);})[_0xd954('0x23')](function(_0x4e90ea){_0x508ab2[_0xd954('0x54')]=_0x4e90ea;return _0x508ab2;})[_0xd954('0x23')](respondWithFilteredResult(_0x48cd37,_0xd9a813))[_0xd954('0x55')](handleError(_0x48cd37,null));};exports[_0xd954('0x56')]=function(_0x475845,_0x549834){var _0x2ae540={'raw':![],'where':{'id':_0x475845[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0x58')],'as':_0xd954('0x3d')}]},_0x43680f={};_0x43680f[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x3f')][_0xd954('0x59')]);_0x43680f[_0xd954('0x44')]=_[_0xd954('0x43')](_0x475845[_0xd954('0x44')]);_0x43680f[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x43680f[_0xd954('0x42')],_0x43680f['query']);_0x2ae540[_0xd954('0x46')]=_[_0xd954('0x45')](_0x43680f[_0xd954('0x42')],qs[_0xd954('0x47')](_0x475845[_0xd954('0x44')]['fields']));_0x2ae540['attributes']=_0x2ae540[_0xd954('0x46')]['length']?_0x2ae540['attributes']:_0x43680f[_0xd954('0x42')];if(_0x475845[_0xd954('0x44')][_0xd954('0x53')]){_0x2ae540['include']=[{'all':!![]}];}_0x2ae540=_[_0xd954('0x4f')]({},_0x2ae540,_0x475845[_0xd954('0x52')]);return db[_0xd954('0x3f')][_0xd954('0x5a')](_0x2ae540)[_0xd954('0x23')](handleEntityNotFound(_0x549834,null))[_0xd954('0x23')](respondWithResult(_0x549834,null))['catch'](handleError(_0x549834,null));};exports[_0xd954('0x5b')]=function(_0xaa3ca8,_0x44e448){return db[_0xd954('0x3f')][_0xd954('0x5b')](_0xaa3ca8[_0xd954('0x5c')],{})[_0xd954('0x23')](function(_0x3e6770){var _0x299fbb=_0xaa3ca8['user']['get']({'plain':!![]});if(!_0x299fbb)throw new Error(_0xd954('0x5d'));if(_0x299fbb[_0xd954('0x5e')]===_0xd954('0x5f')){var _0x34941f=_0x3e6770['get']({'plain':!![]});var _0x233d2a=_0xd954('0x60');return db[_0xd954('0x61')][_0xd954('0x5a')]({'where':{'name':_0x233d2a,'userProfileId':_0x299fbb['userProfileId']},'raw':!![]})[_0xd954('0x23')](function(_0x179111){if(_0x179111&&_0x179111[_0xd954('0x62')]===0x0){return db['UserProfileResource'][_0xd954('0x5b')]({'name':_0x34941f[_0xd954('0x3b')],'resourceId':_0x34941f['id'],'type':_0x179111[_0xd954('0x3b')],'sectionId':_0x179111['id']},{})['then'](function(){return _0x3e6770;});}else{return _0x3e6770;}})[_0xd954('0x55')](function(_0x5e680a){logger[_0xd954('0x29')](_0xd954('0x63'),_0x5e680a);throw _0x5e680a;});}return _0x3e6770;})[_0xd954('0x23')](respondWithResult(_0x44e448,0xc9))[_0xd954('0x55')](handleError(_0x44e448,null));};exports['update']=function(_0x4da352,_0x9020e7){if(_0x4da352[_0xd954('0x5c')]['id']){delete _0x4da352['body']['id'];}return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x4da352['params']['id']},'include':[{'model':db['Pause'],'as':_0xd954('0x3d')}]})['then'](handleEntityNotFound(_0x9020e7,null))[_0xd954('0x23')](saveUpdates(_0x4da352[_0xd954('0x5c')],null))[_0xd954('0x23')](respondWithResult(_0x9020e7,null))[_0xd954('0x55')](handleError(_0x9020e7,null));};exports[_0xd954('0x3a')]=function(_0x5537e3,_0x4f2e39){return db['SmsAccount']['find']({'where':{'id':_0x5537e3['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x4f2e39,null))[_0xd954('0x23')](removeEntity(_0x4f2e39,null))[_0xd954('0x55')](handleError(_0x4f2e39,null));};exports[_0xd954('0x64')]=function(_0x4e0e18,_0x34a662){return db[_0xd954('0x3f')]['describe']()[_0xd954('0x23')](respondWithResult(_0x34a662,null))[_0xd954('0x55')](handleError(_0x34a662,null));};exports[_0xd954('0x65')]=function(_0x5c13e1,_0x1de2e8,_0x11ec41){if(_0x5c13e1[_0xd954('0x5c')]['id']){delete _0x5c13e1[_0xd954('0x5c')]['id'];}return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x5c13e1[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x1de2e8,null))[_0xd954('0x23')](function(_0xe725ce){if(_0xe725ce){_0x5c13e1[_0xd954('0x5c')][_0xd954('0x66')]=_0xe725ce['id'];return db[_0xd954('0x67')]['create'](_0x5c13e1[_0xd954('0x5c')]);}})[_0xd954('0x23')](respondWithResult(_0x1de2e8,null))[_0xd954('0x55')](handleError(_0x1de2e8,null));};exports[_0xd954('0x68')]=function(_0x157370,_0x47be25,_0x4de3fd){var _0x381b77={'raw':![],'where':{}};var _0x5e6a66={};var _0x1eb32e={'count':0x0,'rows':[]};return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x157370[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x47be25,null))[_0xd954('0x23')](function(_0x11cbf2){if(_0x11cbf2){_0x5e6a66['model']=_[_0xd954('0x43')](db[_0xd954('0x67')][_0xd954('0x59')]);_0x5e6a66['query']=_['keys'](_0x157370[_0xd954('0x44')]);_0x5e6a66[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x5e6a66[_0xd954('0x42')],_0x5e6a66[_0xd954('0x44')]);_0x381b77[_0xd954('0x46')]=_['intersection'](_0x5e6a66[_0xd954('0x42')],qs[_0xd954('0x47')](_0x157370[_0xd954('0x44')][_0xd954('0x47')]));_0x381b77[_0xd954('0x46')]=_0x381b77[_0xd954('0x46')][_0xd954('0x48')]?_0x381b77[_0xd954('0x46')]:_0x5e6a66['model'];if(!_0x157370['query'][_0xd954('0x49')](_0xd954('0x4a'))){_0x381b77['limit']=qs[_0xd954('0x32')](_0x157370[_0xd954('0x44')][_0xd954('0x32')]);_0x381b77[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x157370[_0xd954('0x44')][_0xd954('0x31')]);}_0x381b77[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x157370['query'][_0xd954('0x4b')]);_0x381b77['where']=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x157370[_0xd954('0x44')],_0x5e6a66[_0xd954('0x4d')]));_0x381b77['where'][_0xd954('0x66')]=_0x11cbf2['id'];if(_0x157370[_0xd954('0x44')][_0xd954('0x51')]){_0x381b77[_0xd954('0x4c')]=_[_0xd954('0x4f')](_0x381b77[_0xd954('0x4c')],{'$or':_['map'](_0x381b77['attributes'],function(_0x2a46ef){var _0x416979={};_0x416979[_0x2a46ef]={'$like':'%'+_0x157370['query'][_0xd954('0x51')]+'%'};return _0x416979;})});}_0x381b77=_['merge']({},_0x381b77,_0x157370[_0xd954('0x52')]);return db['Disposition']['count']({'where':_0x381b77[_0xd954('0x4c')]})[_0xd954('0x23')](function(_0x2ae150){_0x1eb32e[_0xd954('0x30')]=_0x2ae150;if(_0x157370[_0xd954('0x44')][_0xd954('0x53')]){_0x381b77[_0xd954('0x6b')]=[{'all':!![]}];}return db[_0xd954('0x67')]['findAll'](_0x381b77);})[_0xd954('0x23')](function(_0xdc8534){_0x1eb32e['rows']=_0xdc8534;return _0x1eb32e;});}})[_0xd954('0x23')](respondWithFilteredResult(_0x47be25,_0x381b77))[_0xd954('0x55')](handleError(_0x47be25,null));};exports[_0xd954('0x6c')]=function(_0x516345,_0x1af0c4,_0x1160f8){return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x516345[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x1af0c4,null))[_0xd954('0x23')](function(_0x22ac04){if(_0x22ac04){return _0x22ac04['removeDispositions'](_0x516345[_0xd954('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x1af0c4,null))[_0xd954('0x55')](handleError(_0x1af0c4,null));};exports[_0xd954('0x6d')]=function(_0x4c4641,_0x455270,_0x317deb){if(_0x4c4641[_0xd954('0x5c')]['id']){delete _0x4c4641[_0xd954('0x5c')]['id'];}return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x4c4641['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x455270,null))[_0xd954('0x23')](function(_0x29aaaf){if(_0x29aaaf){_0x4c4641['body'][_0xd954('0x66')]=_0x29aaaf['id'];return db['CannedAnswer'][_0xd954('0x5b')](_0x4c4641[_0xd954('0x5c')]);}})['then'](respondWithResult(_0x455270,null))[_0xd954('0x55')](handleError(_0x455270,null));};exports[_0xd954('0x6e')]=function(_0x1b8c29,_0x36b1a9,_0x567984){var _0xdabd67={'raw':![],'where':{}};var _0xf9756c={};var _0x424e42={'count':0x0,'rows':[]};return db[_0xd954('0x3f')]['findOne']({'where':{'id':_0x1b8c29[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x36b1a9,null))[_0xd954('0x23')](function(_0x3d6ece){if(_0x3d6ece){_0xf9756c[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x6f')][_0xd954('0x59')]);_0xf9756c[_0xd954('0x44')]=_[_0xd954('0x43')](_0x1b8c29[_0xd954('0x44')]);_0xf9756c[_0xd954('0x4d')]=_[_0xd954('0x45')](_0xf9756c[_0xd954('0x42')],_0xf9756c[_0xd954('0x44')]);_0xdabd67[_0xd954('0x46')]=_[_0xd954('0x45')](_0xf9756c[_0xd954('0x42')],qs[_0xd954('0x47')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x47')]));_0xdabd67[_0xd954('0x46')]=_0xdabd67[_0xd954('0x46')][_0xd954('0x48')]?_0xdabd67[_0xd954('0x46')]:_0xf9756c['model'];if(!_0x1b8c29[_0xd954('0x44')][_0xd954('0x49')]('nolimit')){_0xdabd67[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x1b8c29['query'][_0xd954('0x32')]);_0xdabd67[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x31')]);}_0xdabd67['order']=qs[_0xd954('0x4b')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x4b')]);_0xdabd67[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x1b8c29[_0xd954('0x44')],_0xf9756c['filters']));_0xdabd67[_0xd954('0x4c')][_0xd954('0x66')]=_0x3d6ece['id'];if(_0x1b8c29[_0xd954('0x44')]['filter']){_0xdabd67[_0xd954('0x4c')]=_['merge'](_0xdabd67['where'],{'$or':_[_0xd954('0x3e')](_0xdabd67[_0xd954('0x46')],function(_0x1ed87c){var _0x5c739d={};_0x5c739d[_0x1ed87c]={'$like':'%'+_0x1b8c29[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x5c739d;})});}_0xdabd67=_['merge']({},_0xdabd67,_0x1b8c29[_0xd954('0x52')]);return db[_0xd954('0x6f')][_0xd954('0x30')]({'where':_0xdabd67[_0xd954('0x4c')]})[_0xd954('0x23')](function(_0xa2bf92){_0x424e42[_0xd954('0x30')]=_0xa2bf92;if(_0x1b8c29[_0xd954('0x44')][_0xd954('0x53')]){_0xdabd67['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd954('0x70')](_0xdabd67);})['then'](function(_0x8ef4db){_0x424e42[_0xd954('0x54')]=_0x8ef4db;return _0x424e42;});}})['then'](respondWithFilteredResult(_0x36b1a9,_0xdabd67))[_0xd954('0x55')](handleError(_0x36b1a9,null));};exports[_0xd954('0x71')]=function(_0x5c2c9e,_0x434742,_0x36e2a0){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x5c2c9e[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x434742,null))[_0xd954('0x23')](function(_0x1755b7){if(_0x1755b7){return _0x1755b7[_0xd954('0x71')](_0x5c2c9e['query'][_0xd954('0x72')]);}})[_0xd954('0x23')](respondWithStatusCode(_0x434742,null))['catch'](handleError(_0x434742,null));};exports[_0xd954('0x73')]=function(_0x3fc552,_0x406a52,_0xdf7cc9){var _0xdec31f={'channel':_0xd954('0x74')};var _0x1ef74d=[];var _0x378190=[];var _0x585840={};return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x3fc552[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0x75')],'as':_0xd954('0x76')}]})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))['then'](function(_0x50d49b){_0xdec31f[_0xd954('0x77')]=_0x50d49b;_0xdec31f[_0xd954('0x78')]=_[_0xd954('0x79')](_0x50d49b['Applications'],[_0xd954('0x7a')],[_0xd954('0x7b')]);if(_0xdec31f[_0xd954('0x77')][_0xd954('0x76')]){delete _0xdec31f['account'][_0xd954('0x76')];}return db[_0xd954('0x7c')]['describe']();})[_0xd954('0x23')](function(_0x901e7f){if(!_0x901e7f){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))](_0xd954('0x7f'));}_0x1ef74d=_[_0xd954('0x80')](_[_0xd954('0x43')](_0x901e7f),[_0xd954('0x81'),_0xd954('0x82')]);_0x378190=_[_0xd954('0x80')](_[_0xd954('0x43')](_0x901e7f),[_0xd954('0x81'),_0xd954('0x82'),_0xd954('0x83'),_0xd954('0x84')]);_0xdec31f[_0xd954('0x5c')]={'mapKey':'mobile'};if(_0xdec31f['account'][_0xd954('0x41')]){switch(_0xdec31f[_0xd954('0x77')]['type']){case _0xd954('0x85'):_0xdec31f[_0xd954('0x5c')]['from']=_0x3fc552[_0xd954('0x5c')]['From'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x86')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x88')];break;case _0xd954('0x89'):_0xdec31f[_0xd954('0x5c')]['from']='+'+_0x3fc552['body'][_0xd954('0x8a')];_0xdec31f[_0xd954('0x5c')]['body']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8b')];break;case _0xd954('0x8c'):_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body']['message'];break;case'clicksend':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x5c')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552[_0xd954('0x5c')]['message_id'];break;case _0xd954('0x8e'):_0xdec31f['body']['from']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8f')];_0xdec31f[_0xd954('0x5c')]['body']=_0x3fc552[_0xd954('0x5c')]['Text'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552['body']['MessageUUID'];break;case'infobip':_0xdec31f['body'][_0xd954('0x8d')]='+'+_0x3fc552['body']['results'][0x0]['from'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x90')][0x0][_0xd954('0x8b')];_0xdec31f[_0xd954('0x5c')]['messageId']=_0x3fc552[_0xd954('0x5c')]['results'][0x0][_0xd954('0x87')];break;case _0xd954('0x91'):_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x92')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x93')][_0xd954('0x2a')];break;case'clickatell':_0xdec31f['body'][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x94')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552[_0xd954('0x5c')]['text'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552['body'][_0xd954('0x95')];break;case'intelepeer':_0xdec31f['body']['from']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f['body'][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x2a')];_0xdec31f[_0xd954('0x5c')]['messageId']=_0x3fc552['body'][_0xd954('0x96')];break;}}if(_0xdec31f[_0xd954('0x5c')]['id']){delete _0xdec31f['body']['id'];}if(_[_0xd954('0x97')](_0xdec31f['body'][_0xd954('0x8d')])){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))](_0xd954('0x98'));}if(_[_0xd954('0x97')](_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')])||_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xd954('0x99'));}if(_[_0xd954('0x97')](_0xdec31f['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd954('0x9a')+_0x378190);}if(!_[_0xd954('0x9b')](_0x378190,_0xdec31f['body']['mapKey'])){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x378190);}_0x585840[_0xdec31f['body'][_0xd954('0x9c')]]=_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')];return db['CmList'][_0xd954('0x5a')]({'where':{'id':_0xdec31f['account']['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x585840,'limit':0x1,'order':[[_0xd954('0x82'),_0xd954('0x9d')]]}]});})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))['then'](function(_0x2e1e9b){if(_0x2e1e9b){_0xdec31f[_0xd954('0x9e')]=_['omit'](_0x2e1e9b,['Contacts']);if(_0x2e1e9b[_0xd954('0x9f')][_0xd954('0x48')]){return _0x2e1e9b[_0xd954('0x9f')][0x0];}var _0x154dd9=_[_0xd954('0x1b')](_0xdec31f[_0xd954('0x5c')],{'firstName':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')],'ListId':_0x2e1e9b['id']});_0x154dd9[_0xdec31f[_0xd954('0x5c')][_0xd954('0x9c')]]=_0xdec31f['body'][_0xd954('0x8d')];return db[_0xd954('0x7c')][_0xd954('0x5b')](_0x154dd9,{'fields':_0x1ef74d,'raw':!![]});}})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))[_0xd954('0x23')](function(_0x176cb5){if(_0x176cb5){_0xdec31f[_0xd954('0xa0')]=_0x176cb5;var _0x54691e={'ContactId':_0x176cb5['id'],'phone':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id']};var _0x2e18fd={'ContactId':_0x176cb5['id'],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id'],'closed':![]};return db[_0xd954('0xa1')][_0xd954('0x5a')]({'where':_0x2e18fd})['then'](function(_0x5a286d){if(_0x5a286d){return[_0x5a286d,![]];}return db[_0xd954('0xa1')]['create'](_0x54691e)[_0xd954('0x23')](function(_0x2038ee){return[_0x2038ee,!![]];});});}})[_0xd954('0xa2')](function(_0x3651ca,_0x4ceb78){_0xdec31f[_0xd954('0xa3')]=_0x3651ca[_0xd954('0x38')]({'plain':!![]});_0xdec31f[_0xd954('0xa3')]['created']=![];if(_0x4ceb78){if(_0xdec31f['account'][_0xd954('0xa4')]){_0xdec31f[_0xd954('0x78')][_0xd954('0xa5')]({'id':0x0,'priority':_0xdec31f[_0xd954('0x78')]['length']+0x1,'app':_0xd954('0xa6'),'appdata':_0xd954('0xa7'),'interval':_0xd954('0xa8')});}_0xdec31f[_0xd954('0xa3')]['created']=!![];}return db[_0xd954('0xa9')][_0xd954('0x5b')]({'phone':_0xdec31f[_0xd954('0x5c')]['from'],'messageId':_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')],'body':_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id'],'SmsInteractionId':_0x3651ca['id'],'direction':'in','ContactId':_0x3651ca['ContactId'],'AttachmentId':_0xdec31f['body'][_0xd954('0xaa')]});})['then'](function(_0x29b7e0){_0xdec31f[_0xd954('0x2a')]=_0x29b7e0;if(_0xdec31f[_0xd954('0xa3')][_0xd954('0xab')]){return db[_0xd954('0xac')]['find']({'attributes':['id',_0xd954('0x3b')],'where':{'id':_0xdec31f[_0xd954('0xa3')]['UserId']}})[_0xd954('0x23')](function(_0x16badd){if(_0x16badd){_0xdec31f[_0xd954('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd954('0xad'),'appdata':_0x16badd[_0xd954('0x3b')]+','+(_0xdec31f[_0xd954('0x77')][_0xd954('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd954('0xaf'),_0xdec31f);});}return respondWithRpcPromise(_0xd954('0xb0'),_0xd954('0xaf'),_0xdec31f);})[_0xd954('0x23')](function(_0x31db22){if(_0x31db22){var _0x5c269c=0xc8;var _0x36c11c='receiveMessage';logger[_0xd954('0x24')](_0xd954('0x27'),_0x36c11c,_0x5c269c,_0xd954('0xb1'));logger[_0xd954('0xb2')](_0xd954('0xb3'),_0x36c11c,_0x5c269c,'entity\x20found',JSON[_0xd954('0x28')](_0x31db22));if(_0xdec31f[_0xd954('0x77')][_0xd954('0x41')]===_0xd954('0x85')){return _0x406a52[_0xd954('0x2d')](_0x5c269c)[_0xd954('0x33')]('Content-Type',_0xd954('0xb4'))[_0xd954('0xb5')](_0xd954('0xb6'));}else{return _0x406a52[_0xd954('0x2d')](_0x5c269c)['json'](_0x31db22);}}})[_0xd954('0x55')](handleError(_0x406a52,null));};exports[_0xd954('0xb7')]=function(_0x21eaf9,_0x485881,_0x265b9d){return db['SmsAccount'][_0xd954('0x69')]({'where':{'id':_0x21eaf9[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x485881,null))[_0xd954('0x23')](function(_0x3faf4b){if(_0x3faf4b){return db[_0xd954('0xb8')][_0xd954('0xb9')](function(_0x49bb9d){return db[_0xd954('0x75')]['destroy']({'where':{'SmsAccountId':_0x21eaf9[_0xd954('0x57')]['id']},'transaction':_0x49bb9d})[_0xd954('0x23')](function(_0x5778f5){var _0x2a1251=_[_0xd954('0x3e')](_0x21eaf9[_0xd954('0x5c')],function(_0x1fb08c){_0x1fb08c[_0xd954('0x66')]=_0x21eaf9[_0xd954('0x57')]['id'];return _0x1fb08c;});return db[_0xd954('0x75')][_0xd954('0xba')](_0x2a1251,{'transaction':_0x49bb9d});});})[_0xd954('0x23')](function(){return db[_0xd954('0x75')][_0xd954('0xbb')]({'where':{'SmsAccountId':_0x21eaf9[_0xd954('0x57')]['id']},'order':_0xd954('0x7a')});});}})['then'](respondWithResult(_0x485881,null))[_0xd954('0x55')](handleError(_0x485881,null));};exports[_0xd954('0xbc')]=function(_0x2ff91e,_0x4f6303,_0x3120ca){var _0x5f15b7={};var _0x41179f={};var _0x4f611b;var _0x2e1b24;return db[_0xd954('0x3f')]['findOne']({'where':{'id':_0x2ff91e['params']['id']}})['then'](handleEntityNotFound(_0x4f6303,null))[_0xd954('0x23')](function(_0x855881){if(_0x855881){_0x4f611b=_0x855881;_0x41179f[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x75')][_0xd954('0x59')]);_0x41179f[_0xd954('0x44')]=_[_0xd954('0x43')](_0x2ff91e[_0xd954('0x44')]);_0x41179f[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x41179f[_0xd954('0x42')],_0x41179f[_0xd954('0x44')]);_0x5f15b7[_0xd954('0x46')]=_[_0xd954('0x45')](_0x41179f['model'],qs[_0xd954('0x47')](_0x2ff91e[_0xd954('0x44')][_0xd954('0x47')]));_0x5f15b7[_0xd954('0x46')]=_0x5f15b7[_0xd954('0x46')]['length']?_0x5f15b7[_0xd954('0x46')]:_0x41179f['model'];_0x5f15b7[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x2ff91e[_0xd954('0x44')][_0xd954('0x4b')]);_0x5f15b7[_0xd954('0x4c')]=qs['filters'](_[_0xd954('0x4e')](_0x2ff91e[_0xd954('0x44')],_0x41179f[_0xd954('0x4d')]));if(_0x2ff91e[_0xd954('0x44')][_0xd954('0x51')]){_0x5f15b7[_0xd954('0x4c')]=_['merge'](_0x5f15b7[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x5f15b7[_0xd954('0x46')],function(_0x2bf3df){var _0x2d4bbd={};_0x2d4bbd[_0x2bf3df]={'$like':'%'+_0x2ff91e[_0xd954('0x44')]['filter']+'%'};return _0x2d4bbd;})});}_0x5f15b7=_['merge']({},_0x5f15b7,_0x2ff91e[_0xd954('0x52')]);return _0x4f611b[_0xd954('0xbc')](_0x5f15b7);}})['then'](function(_0x24f66a){if(_0x24f66a){_0x2e1b24=_0x24f66a[_0xd954('0x48')];if(!_0x2ff91e[_0xd954('0x44')]['hasOwnProperty'](_0xd954('0x4a'))){_0x5f15b7[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x2ff91e['query']['limit']);_0x5f15b7[_0xd954('0x31')]=qs['offset'](_0x2ff91e[_0xd954('0x44')][_0xd954('0x31')]);}return _0x4f611b[_0xd954('0xbc')](_0x5f15b7);}})[_0xd954('0x23')](function(_0x967de0){if(_0x967de0){return _0x967de0?{'count':_0x2e1b24,'rows':_0x967de0}:null;}})[_0xd954('0x23')](respondWithResult(_0x4f6303,null))['catch'](handleError(_0x4f6303,null));};exports[_0xd954('0xbd')]=function(_0x41bd0d,_0x58ad00,_0x3723fc){var _0x1bd136={'raw':![],'where':{}};var _0x4d62dd={};var _0x4dfd7e={'count':0x0,'rows':[]};return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x41bd0d['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x58ad00,null))[_0xd954('0x23')](function(_0x5e926b){if(_0x5e926b){_0x4d62dd['model']=_[_0xd954('0x43')](db['SmsInteraction'][_0xd954('0x59')]);_0x4d62dd[_0xd954('0x44')]=_['keys'](_0x41bd0d[_0xd954('0x44')]);_0x4d62dd['filters']=_[_0xd954('0x45')](_0x4d62dd[_0xd954('0x42')],_0x4d62dd[_0xd954('0x44')]);_0x1bd136[_0xd954('0x46')]=_[_0xd954('0x45')](_0x4d62dd[_0xd954('0x42')],qs[_0xd954('0x47')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x47')]));_0x1bd136[_0xd954('0x46')]=_0x1bd136[_0xd954('0x46')][_0xd954('0x48')]?_0x1bd136['attributes']:_0x4d62dd[_0xd954('0x42')];if(!_0x41bd0d[_0xd954('0x44')][_0xd954('0x49')](_0xd954('0x4a'))){_0x1bd136[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x41bd0d[_0xd954('0x44')]['limit']);_0x1bd136[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x31')]);}_0x1bd136[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x4b')]);_0x1bd136['where']=qs['filters'](_[_0xd954('0x4e')](_0x41bd0d[_0xd954('0x44')],_0x4d62dd[_0xd954('0x4d')]));_0x1bd136['where'][_0xd954('0x66')]=_0x5e926b['id'];if(_0x41bd0d[_0xd954('0x44')][_0xd954('0x51')]){_0x1bd136['where']=_['merge'](_0x1bd136[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x1bd136[_0xd954('0x46')],function(_0x45b790){var _0x57df99={};_0x57df99[_0x45b790]={'$like':'%'+_0x41bd0d[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x57df99;})});}_0x1bd136=_[_0xd954('0x4f')]({},_0x1bd136,_0x41bd0d[_0xd954('0x52')]);return db[_0xd954('0xa1')]['count']({'where':_0x1bd136[_0xd954('0x4c')]})['then'](function(_0x112c9c){_0x4dfd7e['count']=_0x112c9c;if(_0x41bd0d['query'][_0xd954('0x53')]){_0x1bd136[_0xd954('0x6b')]=[{'model':db['CmContact'],'as':_0xd954('0xbe'),'required':![]},{'model':db[_0xd954('0xac')],'as':_0xd954('0xbf'),'attributes':[_0xd954('0x3b'),_0xd954('0xc0'),'internal'],'required':![]},{'model':db[_0xd954('0xc1')],'as':_0xd954('0xc2'),'attributes':['id','name','color'],'where':_0x41bd0d[_0xd954('0x44')][_0xd954('0xc3')]?{'id':_0x41bd0d[_0xd954('0x44')][_0xd954('0xc3')]}:undefined,'required':_0x41bd0d['query'][_0xd954('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0xd954('0x70')](_0x1bd136);})['then'](function(_0x27dc0b){_0x4dfd7e[_0xd954('0x54')]=_0x27dc0b;return _0x4dfd7e;});}})[_0xd954('0x23')](respondWithFilteredResult(_0x58ad00,_0x1bd136))[_0xd954('0x55')](handleError(_0x58ad00,null));};exports[_0xd954('0xb5')]=function(_0x29067a,_0xbd011f,_0x289e8c){var _0x262c81,_0x45d918,_0x2ab1e3;if(_['isNil'](_0x29067a['body'][_0xd954('0x5c')])||_0x29067a[_0xd954('0x5c')][_0xd954('0x5c')]===''){throw new db['Sequelize'][(_0xd954('0x7e'))](_0xd954('0x99'));}if(_['isNil'](_0x29067a['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xd954('0xc4'));}_0x262c81=_0x29067a[_0xd954('0x5c')]['to'];return db[_0xd954('0x3f')]['find']({'where':{'id':_0x29067a[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0xc5')],'as':_0xd954('0xc6'),'include':[{'model':db[_0xd954('0x7c')],'as':'Contacts','where':{'mobile':_0x262c81},'limit':0x1,'order':[[_0xd954('0x82'),_0xd954('0x9d')]]}]}]})[_0xd954('0x23')](handleEntityNotFound(_0xbd011f,null))['then'](function(_0x20f8e7){if(_0x20f8e7&&_0x20f8e7[_0xd954('0xc6')]){_0x45d918=_0x20f8e7['get']({'plain':!![]});if(_0x45d918['List']&&_0x45d918[_0xd954('0xc6')][_0xd954('0x9f')]['length']){return _0x45d918[_0xd954('0xc6')]['Contacts'][0x0];}return db[_0xd954('0x7c')][_0xd954('0x5b')](_[_0xd954('0x1b')](_0x29067a[_0xd954('0x5c')],{'firstName':_0x262c81,'mobile':_0x262c81,'phone':_0x262c81,'ListId':_0x45d918[_0xd954('0x84')]}));}})[_0xd954('0x23')](handleEntityNotFound(_0xbd011f,null))[_0xd954('0x23')](function(_0x7b16aa){if(_0x7b16aa){_0x2ab1e3=_0x7b16aa;return db[_0xd954('0xa1')][_0xd954('0x5a')]({'where':{'ContactId':_0x2ab1e3['id'],'closed':![],'SmsAccountId':_0x45d918['id']}})['then'](function(_0x3cb056){if(_0x3cb056){return[_0x3cb056,![]];}return db[_0xd954('0xa1')][_0xd954('0x5b')]({'UserId':_0x29067a[_0xd954('0x5f')]['id'],'ContactId':_0x2ab1e3['id'],'SmsAccountId':_0x45d918['id'],'phone':_0x262c81,'firstMsgDirection':_0xd954('0xc7'),'Messages':[_['merge'](_0x29067a[_0xd954('0x5c')],{'read':![],'body':_0x29067a['body'][_0xd954('0x5c')],'phone':_0x262c81,'SmsAccountId':_0x45d918['id'],'UserId':_0x29067a[_0xd954('0x5f')]['id'],'ContactId':_0x2ab1e3['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd954('0xc8')}]})[_0xd954('0x23')](function(_0x1b56e2){return[_0x1b56e2,!![]];});});}})[_0xd954('0xa2')](function(_0x5ed38c,_0x493934){if(_0x493934){return _0x5ed38c;}return db[_0xd954('0xa9')][_0xd954('0x5b')](_[_0xd954('0x4f')](_0x29067a[_0xd954('0x5c')],{'read':![],'body':_0x29067a[_0xd954('0x5c')][_0xd954('0x5c')],'phone':_0x262c81,'SmsAccountId':_0x45d918['id'],'SmsInteractionId':_0x5ed38c['id'],'UserId':_0x29067a['user']['id'],'ContactId':_0x2ab1e3['id']}))['then'](function(_0xc54d6d){_0x5ed38c['dataValues'][_0xd954('0xc8')]=[];_0x5ed38c['dataValues']['Messages'][_0xd954('0xa5')](_0xc54d6d[_0xd954('0xc9')]);return _0x5ed38c;});})[_0xd954('0x23')](respondWithResult(_0xbd011f,null))['catch'](handleError(_0xbd011f,null));};exports[_0xd954('0x2d')]=function(_0x31483b,_0x36e8df,_0x25d26a){if(_0x31483b['body']['id']){delete _0x31483b[_0xd954('0x5c')]['id'];}console[_0xd954('0xca')](_0xd954('0xcb'),_0x31483b[_0xd954('0x5c')]);var _0x5f5239,_0x552bef,_0x3dac64;return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x31483b[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x36e8df,null))[_0xd954('0x23')](function(_0x1b74b0){if(_0x1b74b0){_0x3dac64=_0x1b74b0;logger[_0xd954('0xb2')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0xcc'),_0x1b74b0['type'],util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1b74b0[_0xd954('0x41')]){case _0xd954('0x89'):if(_0x31483b[_0xd954('0x5c')]['skebby_dispatch_id']&&_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')]){_0x552bef=_0x31483b['body'][_0xd954('0x2d')];return db['SmsMessage'][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0xce')]}});}break;case _0xd954('0x8c'):if(_0x31483b['body'][_0xd954('0xcf')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0xd0')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0xd0')];return db[_0xd954('0xa9')][_0xd954('0x5a')]({'where':{'messageId':_0x31483b['body'][_0xd954('0xcf')]}});}break;case _0xd954('0xd1'):if(_0x31483b[_0xd954('0x5c')][_0xd954('0xd2')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0xd3')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0xd3')];return db[_0xd954('0xa9')][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0xd2')]}});}break;case _0xd954('0xd4'):var _0x4d28bb=_0x31483b[_0xd954('0x5c')][_0xd954('0x90')][0x0];if(_0x4d28bb[_0xd954('0x87')]&&_0x4d28bb[_0xd954('0x2d')][_0xd954('0xd5')]==='DELIVERED'){_0x552bef=_0x4d28bb[_0xd954('0x2d')][_0xd954('0xd5')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x4d28bb[_0xd954('0x87')]}});}break;case _0xd954('0xd6'):if(_0x31483b[_0xd954('0x5c')][_0xd954('0x87')]&&_0x31483b[_0xd954('0x5c')]['status']){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')];return db['SmsMessage'][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0x87')]}});}break;case'intelepeer':if(_0x31483b[_0xd954('0x5c')][_0xd954('0xd7')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x31483b['body']['redif']}});}break;}}})[_0xd954('0x23')](handleEntityNotFound(_0x36e8df,null))['then'](function(_0x441e4a){if(_0x441e4a){_0x5f5239=_0x441e4a;switch(_0x3dac64[_0xd954('0x41')]){case'skebby':if(_0x552bef===_0xd954('0xd8')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0x89'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0x8c'):if(_0x552bef==='1'){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x31483b[_0xd954('0x5c')][_0xd954('0xd9')]&&_0x552bef>=0xc8&&_0x552bef<=0xce){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0xd1'),util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd954('0xd4'):var _0x394cfa=_0x31483b['body'][_0xd954('0x90')][0x0];if(_0x394cfa['status'][_0xd954('0xd5')]===_0xd954('0xd8')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xd4'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0xd6'):if(_0x552bef=='DELIVERED_TO_GATEWAY'||_0x552bef==_0xd954('0xda')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),'status',_0xd954('0xd6'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0xdb'):if(_0x552bef==='DELIVRD'||_0x552bef===_0xd954('0xdc')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xdb'),util['inspect'](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5f5239;}})[_0xd954('0x23')](respondWithResult(_0x36e8df,null))[_0xd954('0x55')](handleError(_0x36e8df,null));};exports['statusGet']=function(_0x3eb191,_0x4962cf,_0x8873b5){var _0x2198b0,_0x17e212,_0x264eca;return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x3eb191[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x4962cf,null))['then'](function(_0x514bc9){if(_0x514bc9){_0x264eca=_0x514bc9;logger['debug'](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xcc'),_0x514bc9[_0xd954('0x41')],util[_0xd954('0xcd')](_0x3eb191[_0xd954('0x44')],{'showHidden':![],'depth':null}));switch(_0x514bc9[_0xd954('0x41')]){case'csc':if(_0x3eb191[_0xd954('0x44')][_0xd954('0xdd')]&&_0x3eb191[_0xd954('0x44')][_0xd954('0xde')]){_0x17e212=_0x3eb191[_0xd954('0x44')][_0xd954('0xde')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x3eb191[_0xd954('0x44')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x4962cf,null))[_0xd954('0x23')](function(_0x5b9c26){if(_0x5b9c26){_0x2198b0=_0x5b9c26;switch(_0x264eca[_0xd954('0x41')]){case _0xd954('0x91'):if(_0x17e212==='2'||_0x17e212==='6'){return _0x2198b0[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),'csc',util['inspect'](_0x3eb191['query'],{'showHidden':![],'depth':null}));};break;}return _0x2198b0;}})['then'](respondWithResult(_0x4962cf,null))[_0xd954('0x55')](handleError(_0x4962cf,null));};exports[_0xd954('0xdf')]=function(_0x4f9059,_0x47838c,_0x2a4d0e){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x4f9059[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x47838c,null))[_0xd954('0x23')](function(_0x2f0b1f){if(_0x2f0b1f){return _0x2f0b1f['addAgents'](_0x4f9059['body']['ids'],_[_0xd954('0xe0')](_0x4f9059[_0xd954('0x5c')],[_0xd954('0x72'),'id'])||{})[_0xd954('0xa2')](function(_0x54a94a){for(var _0x54badc=0x0;_0x54badc<_0x4f9059['body']['ids'][_0xd954('0x48')];_0x54badc+=0x1){socket['emit'](_0xd954('0xe1'),{'UserId':_0x4f9059[_0xd954('0x5c')][_0xd954('0x72')][_0x54badc],'SmsAccountId':_0x4f9059[_0xd954('0x57')]['id']});}return _0x54a94a;});}})[_0xd954('0x23')](respondWithResult(_0x47838c,null))[_0xd954('0x55')](handleError(_0x47838c,null));};exports[_0xd954('0xe2')]=function(_0x419c3a,_0x22c9ce,_0x5968b6){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x419c3a[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x22c9ce,null))['then'](function(_0x825df){if(_0x825df){return _0x825df[_0xd954('0xe2')](_0x419c3a['query']['ids'])[_0xd954('0x23')](function(){if(_[_0xd954('0xe3')](_0x419c3a[_0xd954('0x44')][_0xd954('0x72')])){for(var _0x5a2862=0x0;_0x5a2862<_0x419c3a[_0xd954('0x44')][_0xd954('0x72')]['length'];_0x5a2862+=0x1){socket['emit'](_0xd954('0xe4'),{'UserId':Number(_0x419c3a[_0xd954('0x44')][_0xd954('0x72')][_0x5a2862]),'SmsAccountId':Number(_0x419c3a['params']['id'])});}}else{socket[_0xd954('0xe5')](_0xd954('0xe4'),{'UserId':Number(_0x419c3a[_0xd954('0x44')]['ids']),'SmsAccountId':Number(_0x419c3a[_0xd954('0x57')]['id'])});}});}})[_0xd954('0x23')](respondWithStatusCode(_0x22c9ce,null))[_0xd954('0x55')](handleError(_0x22c9ce,null));};exports[_0xd954('0xe6')]=function(_0x4dc4ea,_0x12568a,_0x402997){var _0x511f72={};var _0x409fc5={};var _0xa1601d;var _0x41f132;return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x4dc4ea[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x12568a,null))[_0xd954('0x23')](function(_0x4dad31){if(_0x4dad31){_0xa1601d=_0x4dad31;_0x409fc5[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0xac')]['rawAttributes']);_0x409fc5['query']=_[_0xd954('0x43')](_0x4dc4ea['query']);_0x409fc5[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x409fc5[_0xd954('0x42')],_0x409fc5[_0xd954('0x44')]);_0x511f72[_0xd954('0x46')]=_[_0xd954('0x45')](_0x409fc5['model'],qs[_0xd954('0x47')](_0x4dc4ea[_0xd954('0x44')][_0xd954('0x47')]));_0x511f72[_0xd954('0x46')]=_0x511f72[_0xd954('0x46')][_0xd954('0x48')]?_0x511f72[_0xd954('0x46')]:_0x409fc5['model'];_0x511f72[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x4dc4ea[_0xd954('0x44')]['sort']);_0x511f72[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x4dc4ea[_0xd954('0x44')],_0x409fc5['filters']));if(_0x4dc4ea[_0xd954('0x44')][_0xd954('0x51')]){_0x511f72[_0xd954('0x4c')]=_['merge'](_0x511f72[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x511f72[_0xd954('0x46')],function(_0x23225e){var _0x522db0={};_0x522db0[_0x23225e]={'$like':'%'+_0x4dc4ea[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x522db0;})});}_0x511f72=_[_0xd954('0x4f')]({},_0x511f72,_0x4dc4ea[_0xd954('0x52')]);return _0xa1601d[_0xd954('0xe6')](_0x511f72);}})[_0xd954('0x23')](function(_0x479552){if(_0x479552){_0x41f132=_0x479552[_0xd954('0x48')];if(!_0x4dc4ea['query'][_0xd954('0x49')]('nolimit')){_0x511f72['limit']=qs['limit'](_0x4dc4ea[_0xd954('0x44')]['limit']);_0x511f72['offset']=qs[_0xd954('0x31')](_0x4dc4ea['query'][_0xd954('0x31')]);}return _0xa1601d['getAgents'](_0x511f72);}})[_0xd954('0x23')](function(_0x1e9648){if(_0x1e9648){return _0x1e9648?{'count':_0x41f132,'rows':_0x1e9648}:null;}})[_0xd954('0x23')](respondWithResult(_0x12568a,null))[_0xd954('0x55')](handleError(_0x12568a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5c810b9..ac35f18 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 _0xcccf=['hook','exports','../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x15434a,_0x10a30){var _0x1a310e=function(_0x426743){while(--_0x426743){_0x15434a['push'](_0x15434a['shift']());}};_0x1a310e(++_0x10a30);}(_0xcccf,0xb2));var _0xfccc=function(_0x216d8f,_0x2fe842){_0x216d8f=_0x216d8f-0x0;var _0x1013c0=_0xcccf[_0x216d8f];return _0x1013c0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xfccc('0x0'))['db'][_0xfccc('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfccc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfccc('0x3')};function emitEvent(_0x2931ce){return function(_0x7e8665,_0x1ca353,_0x457aac){SmsAccountEvents[_0xfccc('0x4')](_0x2931ce+':'+_0x7e8665['id'],_0x7e8665);SmsAccountEvents[_0xfccc('0x4')](_0x2931ce,_0x7e8665);_0x457aac(null);};}for(var e in events){if(events[_0xfccc('0x5')](e)){var event=events[e];SmsAccount[_0xfccc('0x6')](e,emitEvent(event));}}module[_0xfccc('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x34a1=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','save'];(function(_0x256910,_0x270d4e){var _0x16ed34=function(_0x18d892){while(--_0x18d892){_0x256910['push'](_0x256910['shift']());}};_0x16ed34(++_0x270d4e);}(_0x34a1,0x19a));var _0x134a=function(_0x3adf24,_0x45ed8a){_0x3adf24=_0x3adf24-0x0;var _0x4ec313=_0x34a1[_0x3adf24];return _0x4ec313;};'use strict';var EventEmitter=require(_0x134a('0x0'));var SmsAccount=require(_0x134a('0x1'))['db'][_0x134a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x134a('0x3'),'afterUpdate':_0x134a('0x4'),'afterDestroy':_0x134a('0x5')};function emitEvent(_0x35a272){return function(_0x4adfbb,_0x3879c9,_0x29c136){SmsAccountEvents[_0x134a('0x6')](_0x35a272+':'+_0x4adfbb['id'],_0x4adfbb);SmsAccountEvents[_0x134a('0x6')](_0x35a272,_0x4adfbb);_0x29c136(null);};}for(var e in events){if(events[_0x134a('0x7')](e)){var event=events[e];SmsAccount[_0x134a('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3c70c42..0a0a64f 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 _0x33dd=['path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','moment','bluebird','request-promise'];(function(_0x2cc136,_0x159126){var _0x4ad9fc=function(_0x15ed7f){while(--_0x15ed7f){_0x2cc136['push'](_0x2cc136['shift']());}};_0x4ad9fc(++_0x159126);}(_0x33dd,0x73));var _0xd33d=function(_0x5454fd,_0x25d702){_0x5454fd=_0x5454fd-0x0;var _0x3fa091=_0x33dd[_0x5454fd];return _0x3fa091;};'use strict';var _=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd33d('0x2'));var BPromise=require(_0xd33d('0x3'));var rp=require(_0xd33d('0x4'));var fs=require('fs');var path=require(_0xd33d('0x5'));var rimraf=require('rimraf');var config=require(_0xd33d('0x6'));var attributes=require(_0xd33d('0x7'));module[_0xd33d('0x8')]=function(_0xfb1fe3,_0x660123){return _0xfb1fe3[_0xd33d('0x9')](_0xd33d('0xa'),attributes,{'tableName':_0xd33d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64ab=['path','rimraf','../../config/environment','exports','define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42d002,_0x4dbc43){var _0x5b7320=function(_0x4a20eb){while(--_0x4a20eb){_0x42d002['push'](_0x42d002['shift']());}};_0x5b7320(++_0x4dbc43);}(_0x64ab,0xa2));var _0xb64a=function(_0x53fa81,_0x4cfbb3){_0x53fa81=_0x53fa81-0x0;var _0x49cda8=_0x64ab[_0x53fa81];return _0x49cda8;};'use strict';var _=require(_0xb64a('0x0'));var util=require(_0xb64a('0x1'));var logger=require(_0xb64a('0x2'))(_0xb64a('0x3'));var moment=require(_0xb64a('0x4'));var BPromise=require(_0xb64a('0x5'));var rp=require(_0xb64a('0x6'));var fs=require('fs');var path=require(_0xb64a('0x7'));var rimraf=require(_0xb64a('0x8'));var config=require(_0xb64a('0x9'));var attributes=require('./smsAccount.attributes');module[_0xb64a('0xa')]=function(_0x2ee273,_0x58307f){return _0x2ee273[_0xb64a('0xb')]('SmsAccount',attributes,{'tableName':_0xb64a('0xc'),'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 0cf8a9e..c0a45f3 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 _0x280d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x280d,0x1b8));var _0xd280=function(_0x2180af,_0x5ed02d){_0x2180af=_0x2180af-0x0;var _0xe9e097=_0x280d[_0x2180af];return _0xe9e097;};'use strict';var _=require(_0xd280('0x0'));var util=require(_0xd280('0x1'));var moment=require('moment');var BPromise=require(_0xd280('0x2'));var rs=require(_0xd280('0x3'));var fs=require('fs');var Redis=require(_0xd280('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd280('0x5'));var config=require(_0xd280('0x6'));var jayson=require(_0xd280('0x7'));var client=jayson[_0xd280('0x8')][_0xd280('0x9')]({'port':0x232a});config[_0xd280('0xa')]=_[_0xd280('0xb')](config['redis'],{'host':_0xd280('0xc'),'port':0x18eb});var socket=require(_0xd280('0xd'))(new Redis(config['redis']));require(_0xd280('0xe'))['register'](socket);function respondWithRpcPromise(_0xaad512,_0x231afa,_0x30dc42){return new BPromise(function(_0x52a76e,_0x55208d){return client['request'](_0xaad512,_0x30dc42)[_0xd280('0xf')](function(_0x1fabe7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x231afa,_0xd280('0x10'));logger['debug'](_0xd280('0x11'),_0x231afa,_0xd280('0x10'),JSON['stringify'](_0x1fabe7));if(_0x1fabe7[_0xd280('0x12')]){if(_0x1fabe7[_0xd280('0x12')][_0xd280('0x13')]===0x1f4){logger[_0xd280('0x12')]('SmsAccount,\x20%s,\x20%s',_0x231afa,_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);return _0x55208d(_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);}logger[_0xd280('0x12')]('SmsAccount,\x20%s,\x20%s',_0x231afa,_0x1fabe7[_0xd280('0x12')][_0xd280('0x14')]);return _0x52a76e(_0x1fabe7[_0xd280('0x12')]['message']);}else{logger[_0xd280('0x15')](_0xd280('0x16'),_0x231afa,'request\x20sent');_0x52a76e(_0x1fabe7[_0xd280('0x17')][_0xd280('0x14')]);}})[_0xd280('0x18')](function(_0x51cf03){logger[_0xd280('0x12')](_0xd280('0x16'),_0x231afa,_0x51cf03);_0x55208d(_0x51cf03);});});}exports[_0xd280('0x19')]=function(_0x4b3f6d){var _0x1027ce=this;return new Promise(function(_0x583d5d,_0x3dd198){return db[_0xd280('0x1a')][_0xd280('0x1b')]({'raw':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d[_0xd280('0x1c')][_0xd280('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d['options']['where']||null:null,'attributes':_0x4b3f6d['options']?_0x4b3f6d['options'][_0xd280('0x1e')]||null:null,'include':_0x4b3f6d[_0xd280('0x1c')]?_0x4b3f6d[_0xd280('0x1c')]['include']?_['map'](_0x4b3f6d[_0xd280('0x1c')][_0xd280('0x1f')],function(_0x5a4630){return{'model':db[_0x5a4630[_0xd280('0x20')]],'as':_0x5a4630['as'],'attributes':_0x5a4630[_0xd280('0x1e')],'include':_0x5a4630[_0xd280('0x1f')]?_[_0xd280('0x21')](_0x5a4630[_0xd280('0x1f')],function(_0x2d9b11){return{'model':db[_0x2d9b11[_0xd280('0x20')]],'as':_0x2d9b11['as'],'attributes':_0x2d9b11[_0xd280('0x1e')],'include':_0x2d9b11['include']?_[_0xd280('0x21')](_0x2d9b11['include'],function(_0x48a091){return{'model':db[_0x48a091[_0xd280('0x20')]],'as':_0x48a091['as'],'attributes':_0x48a091[_0xd280('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd9674a){logger[_0xd280('0x15')](_0xd280('0x19'),_0x4b3f6d);logger['debug'](_0xd280('0x19'),_0x4b3f6d,JSON['stringify'](_0xd9674a));_0x583d5d(_0xd9674a);})['catch'](function(_0x47545e){logger['error'](_0xd280('0x19'),_0x47545e['message'],_0x4b3f6d);_0x3dd198(_0x1027ce[_0xd280('0x12')](0x1f4,_0x47545e[_0xd280('0x14')]));});});}; \ No newline at end of file +var _0x9a65=['stringify','error','code','message','result','catch','ShowSmsAccount','find','options','where','include','model','map','attributes','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1bd247,_0x14f195){var _0x54d8d5=function(_0x2aaf14){while(--_0x2aaf14){_0x1bd247['push'](_0x1bd247['shift']());}};_0x54d8d5(++_0x14f195);}(_0x9a65,0x11f));var _0x59a6=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x9a65[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x59a6('0x0'));var util=require('util');var moment=require(_0x59a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x59a6('0x2'));var fs=require('fs');var Redis=require(_0x59a6('0x3'));var db=require(_0x59a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x59a6('0x5'));var jayson=require(_0x59a6('0x6'));var client=jayson[_0x59a6('0x7')]['http']({'port':0x232a});config[_0x59a6('0x8')]=_[_0x59a6('0x9')](config[_0x59a6('0x8')],{'host':_0x59a6('0xa'),'port':0x18eb});var socket=require(_0x59a6('0xb'))(new Redis(config[_0x59a6('0x8')]));require(_0x59a6('0xc'))['register'](socket);function respondWithRpcPromise(_0x2a5dfd,_0x2d2832,_0x4d5d2f){return new BPromise(function(_0x1f7570,_0xfc120d){return client[_0x59a6('0xd')](_0x2a5dfd,_0x4d5d2f)[_0x59a6('0xe')](function(_0x358b64){logger[_0x59a6('0xf')](_0x59a6('0x10'),_0x2d2832,_0x59a6('0x11'));logger['debug'](_0x59a6('0x12'),_0x2d2832,_0x59a6('0x11'),JSON[_0x59a6('0x13')](_0x358b64));if(_0x358b64['error']){if(_0x358b64[_0x59a6('0x14')][_0x59a6('0x15')]===0x1f4){logger[_0x59a6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2d2832,_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);return _0xfc120d(_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);}logger[_0x59a6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2d2832,_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);return _0x1f7570(_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);}else{logger[_0x59a6('0xf')](_0x59a6('0x10'),_0x2d2832,_0x59a6('0x11'));_0x1f7570(_0x358b64[_0x59a6('0x17')][_0x59a6('0x16')]);}})[_0x59a6('0x18')](function(_0x20c1b4){logger[_0x59a6('0x14')](_0x59a6('0x10'),_0x2d2832,_0x20c1b4);_0xfc120d(_0x20c1b4);});});}exports[_0x59a6('0x19')]=function(_0x2736db){var _0x4380e6=this;return new Promise(function(_0x35901e,_0x1be69c){return db['SmsAccount'][_0x59a6('0x1a')]({'raw':_0x2736db['options']?_0x2736db[_0x59a6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2736db[_0x59a6('0x1b')]?_0x2736db[_0x59a6('0x1b')][_0x59a6('0x1c')]||null:null,'attributes':_0x2736db['options']?_0x2736db[_0x59a6('0x1b')]['attributes']||null:null,'include':_0x2736db[_0x59a6('0x1b')]?_0x2736db[_0x59a6('0x1b')][_0x59a6('0x1d')]?_['map'](_0x2736db['options']['include'],function(_0x2b2069){return{'model':db[_0x2b2069[_0x59a6('0x1e')]],'as':_0x2b2069['as'],'attributes':_0x2b2069['attributes'],'include':_0x2b2069[_0x59a6('0x1d')]?_[_0x59a6('0x1f')](_0x2b2069[_0x59a6('0x1d')],function(_0x24675f){return{'model':db[_0x24675f['model']],'as':_0x24675f['as'],'attributes':_0x24675f[_0x59a6('0x20')],'include':_0x24675f[_0x59a6('0x1d')]?_[_0x59a6('0x1f')](_0x24675f['include'],function(_0x341086){return{'model':db[_0x341086[_0x59a6('0x1e')]],'as':_0x341086['as'],'attributes':_0x341086['attributes']};}):[]};}):[]};}):[]:[]})[_0x59a6('0xe')](function(_0xa229c1){logger[_0x59a6('0xf')](_0x59a6('0x19'),_0x2736db);logger[_0x59a6('0x21')]('ShowSmsAccount',_0x2736db,JSON[_0x59a6('0x13')](_0xa229c1));_0x35901e(_0xa229c1);})['catch'](function(_0x1a39d7){logger[_0x59a6('0x14')](_0x59a6('0x19'),_0x1a39d7['message'],_0x2736db);_0x1be69c(_0x4380e6[_0x59a6('0x14')](0x1f4,_0x1a39d7[_0x59a6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index eab5e70..b23c14a 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 _0xe455=['removeListener','register','smsAccount:','save','remove','update','emit'];(function(_0x25f404,_0x485a38){var _0x2c0e38=function(_0x4dcbf2){while(--_0x4dcbf2){_0x25f404['push'](_0x25f404['shift']());}};_0x2c0e38(++_0x485a38);}(_0xe455,0x1ca));var _0x5e45=function(_0x6cc9d2,_0x203201){_0x6cc9d2=_0x6cc9d2-0x0;var _0x2daba6=_0xe455[_0x6cc9d2];return _0x2daba6;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x5e45('0x0'),_0x5e45('0x1'),_0x5e45('0x2')];function createListener(_0x48c432,_0x523dc1){return function(_0x441b49){_0x523dc1[_0x5e45('0x3')](_0x48c432,_0x441b49);};}function removeListener(_0x4b7711,_0x32082d){return function(){SmsAccountEvents[_0x5e45('0x4')](_0x4b7711,_0x32082d);};}exports[_0x5e45('0x5')]=function(_0x5c692f){for(var _0x1d7e39=0x0,_0x571584=events['length'];_0x1d7e39<_0x571584;_0x1d7e39++){var _0x5a581d=events[_0x1d7e39];var _0x592e35=createListener(_0x5e45('0x6')+_0x5a581d,_0x5c692f);SmsAccountEvents['on'](_0x5a581d,_0x592e35);}}; \ No newline at end of file +var _0x7d14=['smsAccount:','./smsAccount.events','save','update','removeListener','register'];(function(_0x4bfe5f,_0x45399e){var _0x2a2522=function(_0x58f426){while(--_0x58f426){_0x4bfe5f['push'](_0x4bfe5f['shift']());}};_0x2a2522(++_0x45399e);}(_0x7d14,0x6d));var _0x47d1=function(_0x43091a,_0x48ce84){_0x43091a=_0x43091a-0x0;var _0x1921f1=_0x7d14[_0x43091a];return _0x1921f1;};'use strict';var SmsAccountEvents=require(_0x47d1('0x0'));var events=[_0x47d1('0x1'),'remove',_0x47d1('0x2')];function createListener(_0x325761,_0x21f244){return function(_0x8645d1){_0x21f244['emit'](_0x325761,_0x8645d1);};}function removeListener(_0x37d8f2,_0x33fe33){return function(){SmsAccountEvents[_0x47d1('0x3')](_0x37d8f2,_0x33fe33);};}exports[_0x47d1('0x4')]=function(_0x1b2f47){for(var _0x550ee2=0x0,_0x533402=events['length'];_0x550ee2<_0x533402;_0x550ee2++){var _0x38e165=events[_0x550ee2];var _0x57d410=createListener(_0x47d1('0x5')+_0x38e165,_0x1b2f47);SmsAccountEvents['on'](_0x38e165,_0x57d410);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index e7b379c..7b8ab7a 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 _0x01a5=['post','put','/:id','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show'];(function(_0x160a68,_0x837a75){var _0x43334f=function(_0xdbdefc){while(--_0xdbdefc){_0x160a68['push'](_0x160a68['shift']());}};_0x43334f(++_0x837a75);}(_0x01a5,0x193));var _0x501a=function(_0x10676c,_0x2bb532){_0x10676c=_0x10676c-0x0;var _0x376ae4=_0x01a5[_0x10676c];return _0x376ae4;};'use strict';var multer=require('multer');var util=require(_0x501a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x501a('0x1'));var router=express[_0x501a('0x2')]();var auth=require(_0x501a('0x3'));var interaction=require(_0x501a('0x4'));var config=require(_0x501a('0x5'));var controller=require(_0x501a('0x6'));router[_0x501a('0x7')]('/',auth[_0x501a('0x8')](),controller[_0x501a('0x9')]);router[_0x501a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x501a('0xa')]);router[_0x501a('0xb')]('/',auth[_0x501a('0x8')](),controller['create']);router[_0x501a('0xc')](_0x501a('0xd'),auth[_0x501a('0x8')](),controller[_0x501a('0xe')]);router[_0x501a('0xf')](_0x501a('0xd'),auth['isAuthenticated'](),controller[_0x501a('0x10')]);module[_0x501a('0x11')]=router; \ No newline at end of file +var _0xb176=['update','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x132d2c,_0x1e4a9b){var _0x419e6f=function(_0x202017){while(--_0x202017){_0x132d2c['push'](_0x132d2c['shift']());}};_0x419e6f(++_0x1e4a9b);}(_0xb176,0x1de));var _0x6b17=function(_0x9eafd4,_0x6c31df){_0x9eafd4=_0x9eafd4-0x0;var _0x390716=_0xb176[_0x9eafd4];return _0x390716;};'use strict';var multer=require(_0x6b17('0x0'));var util=require(_0x6b17('0x1'));var path=require(_0x6b17('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b17('0x3'));var router=express[_0x6b17('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6b17('0x5'));var config=require(_0x6b17('0x6'));var controller=require('./smsApplication.controller');router[_0x6b17('0x7')]('/',auth[_0x6b17('0x8')](),controller[_0x6b17('0x9')]);router['get'](_0x6b17('0xa'),auth['isAuthenticated'](),controller[_0x6b17('0xb')]);router[_0x6b17('0xc')]('/',auth[_0x6b17('0x8')](),controller[_0x6b17('0xd')]);router[_0x6b17('0xe')]('/:id',auth[_0x6b17('0x8')](),controller[_0x6b17('0xf')]);router['delete'](_0x6b17('0xa'),auth[_0x6b17('0x8')](),controller[_0x6b17('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ec5a7d6..fe8b6dd 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 _0x3270=['TEXT','STRING','exports','INTEGER'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x3270,0x10e));var _0x0327=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x3270[_0x527824];return _0xc8b8ed;};'use strict';var Sequelize=require('sequelize');module[_0x0327('0x0')]={'priority':{'type':Sequelize[_0x0327('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0327('0x2')]()},'description':{'type':Sequelize[_0x0327('0x3')]},'interval':{'type':Sequelize[_0x0327('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x80de=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4fe8ce,_0x4007e3){var _0x338fa0=function(_0x444ecd){while(--_0x444ecd){_0x4fe8ce['push'](_0x4fe8ce['shift']());}};_0x338fa0(++_0x4007e3);}(_0x80de,0xb5));var _0xe80d=function(_0x445436,_0x3c462f){_0x445436=_0x445436-0x0;var _0x1c199f=_0x80de[_0x445436];return _0x1c199f;};'use strict';var Sequelize=require(_0xe80d('0x0'));module[_0xe80d('0x1')]={'priority':{'type':Sequelize[_0xe80d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe80d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe80d('0x3')]},'interval':{'type':Sequelize[_0xe80d('0x3')],'defaultValue':_0xe80d('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index af9aa6d..56dbf3a 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 _0x6bae=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsApplication','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','include','merge','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x4eefe6,_0x1202ce){var _0x22b387=function(_0xb34c64){while(--_0xb34c64){_0x4eefe6['push'](_0x4eefe6['shift']());}};_0x22b387(++_0x1202ce);}(_0x6bae,0x84));var _0xe6ba=function(_0x4159e3,_0x53a785){_0x4159e3=_0x4159e3-0x0;var _0x47db5e=_0x6bae[_0x4159e3];return _0x47db5e;};'use strict';var pdf=require(_0xe6ba('0x0'));var emlformat=require(_0xe6ba('0x1'));var rimraf=require(_0xe6ba('0x2'));var zipdir=require(_0xe6ba('0x3'));var jsonpatch=require(_0xe6ba('0x4'));var rp=require(_0xe6ba('0x5'));var moment=require(_0xe6ba('0x6'));var BPromise=require(_0xe6ba('0x7'));var Mustache=require(_0xe6ba('0x8'));var util=require(_0xe6ba('0x9'));var path=require(_0xe6ba('0xa'));var sox=require(_0xe6ba('0xb'));var csv=require('to-csv');var ejs=require(_0xe6ba('0xc'));var fs=require('fs');var _=require(_0xe6ba('0xd'));var squel=require(_0xe6ba('0xe'));var crypto=require(_0xe6ba('0xf'));var jsforce=require(_0xe6ba('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe6ba('0x11'));var querystring=require('querystring');var Papa=require(_0xe6ba('0x12'));var Redis=require(_0xe6ba('0x13'));var authService=require(_0xe6ba('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6ba('0x15'));var logger=require(_0xe6ba('0x16'))('api');var utils=require(_0xe6ba('0x17'));var config=require(_0xe6ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6ba('0x19'))['db'];function respondWithStatusCode(_0x7c832f,_0xae3c32){_0xae3c32=_0xae3c32||0xcc;return function(_0x9d34dc){if(_0x9d34dc){return _0x7c832f[_0xe6ba('0x1a')](_0xae3c32);}return _0x7c832f[_0xe6ba('0x1b')](_0xae3c32)[_0xe6ba('0x1c')]();};}function respondWithResult(_0x13a1f9,_0x5c5274){_0x5c5274=_0x5c5274||0xc8;return function(_0x923d3c){if(_0x923d3c){return _0x13a1f9[_0xe6ba('0x1b')](_0x5c5274)[_0xe6ba('0x1d')](_0x923d3c);}};}function respondWithFilteredResult(_0x50db7a,_0x2e889d){return function(_0xb22699){if(_0xb22699){var _0x4f1b39=_0xb22699[_0xe6ba('0x1e')],_0x1f7a69=_0x2e889d['offset'],_0x3c0f39=_0x2e889d[_0xe6ba('0x1f')]+_0x2e889d[_0xe6ba('0x20')],_0x1ef695;if(_0x3c0f39>=_0x4f1b39){_0x3c0f39=_0x4f1b39;_0x1ef695=0xc8;}else{_0x1ef695=0xce;}_0x50db7a[_0xe6ba('0x1b')](_0x1ef695);return _0x50db7a[_0xe6ba('0x21')](_0xe6ba('0x22'),_0x1f7a69+'-'+_0x3c0f39+'/'+_0x4f1b39)[_0xe6ba('0x1d')](_0xb22699);}return null;};}function patchUpdates(_0x3f3d65){return function(_0x488b88){try{jsonpatch[_0xe6ba('0x23')](_0x488b88,_0x3f3d65,!![]);}catch(_0x99e5e3){return BPromise[_0xe6ba('0x24')](_0x99e5e3);}return _0x488b88[_0xe6ba('0x25')]();};}function saveUpdates(_0x378a81,_0x5f428c){return function(_0x505e45){if(_0x505e45){return _0x505e45[_0xe6ba('0x26')](_0x378a81)[_0xe6ba('0x27')](function(_0x2b1c86){return _0x2b1c86;});}return null;};}function removeEntity(_0x19f591,_0x54fd53){return function(_0x43c79b){if(_0x43c79b){return _0x43c79b[_0xe6ba('0x28')]()[_0xe6ba('0x27')](function(){_0x19f591[_0xe6ba('0x1b')](0xcc)[_0xe6ba('0x1c')]();});}};}function handleEntityNotFound(_0x2acb66,_0x1717aa){return function(_0x150c8b){if(!_0x150c8b){_0x2acb66['sendStatus'](0x194);}return _0x150c8b;};}function handleError(_0x405296,_0x28e1c4){_0x28e1c4=_0x28e1c4||0x1f4;return function(_0x2c4e5c){logger[_0xe6ba('0x29')](_0x2c4e5c[_0xe6ba('0x2a')]);if(_0x2c4e5c['name']){delete _0x2c4e5c[_0xe6ba('0x2b')];}_0x405296['status'](_0x28e1c4)[_0xe6ba('0x2c')](_0x2c4e5c);};}exports['index']=function(_0x1711fb,_0x1e84bb){var _0x11c203={},_0x731ae7={},_0x37d3ed={'count':0x0,'rows':[]};var _0x3a48c4=_['map'](db[_0xe6ba('0x2d')]['rawAttributes'],function(_0x1670a1){return{'name':_0x1670a1[_0xe6ba('0x2e')],'type':_0x1670a1[_0xe6ba('0x2f')][_0xe6ba('0x30')]};});_0x731ae7[_0xe6ba('0x31')]=_[_0xe6ba('0x32')](_0x3a48c4,_0xe6ba('0x2b'));_0x731ae7[_0xe6ba('0x33')]=_[_0xe6ba('0x34')](_0x1711fb['query']);_0x731ae7[_0xe6ba('0x35')]=_[_0xe6ba('0x36')](_0x731ae7[_0xe6ba('0x31')],_0x731ae7[_0xe6ba('0x33')]);_0x11c203['attributes']=_[_0xe6ba('0x36')](_0x731ae7['model'],qs[_0xe6ba('0x37')](_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x37')]));_0x11c203[_0xe6ba('0x38')]=_0x11c203['attributes']['length']?_0x11c203[_0xe6ba('0x38')]:_0x731ae7[_0xe6ba('0x31')];if(!_0x1711fb['query'][_0xe6ba('0x39')](_0xe6ba('0x3a'))){_0x11c203[_0xe6ba('0x20')]=qs['limit'](_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x20')]);_0x11c203[_0xe6ba('0x1f')]=qs['offset'](_0x1711fb['query'][_0xe6ba('0x1f')]);}_0x11c203['order']=qs['sort'](_0x1711fb['query']['sort']);_0x11c203[_0xe6ba('0x3b')]=qs[_0xe6ba('0x35')](_['pick'](_0x1711fb['query'],_0x731ae7['filters']),_0x3a48c4);if(_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x3c')]){_0x11c203[_0xe6ba('0x3b')]=_['merge'](_0x11c203['where'],{'$or':_[_0xe6ba('0x32')](_0x3a48c4,function(_0xb1553b){if(_0xb1553b['type']!==_0xe6ba('0x3d')){var _0x10c471={};_0x10c471[_0xb1553b[_0xe6ba('0x2b')]]={'$like':'%'+_0x1711fb[_0xe6ba('0x33')][_0xe6ba('0x3c')]+'%'};return _0x10c471;}})});}_0x11c203=_['merge']({},_0x11c203,_0x1711fb[_0xe6ba('0x3e')]);var _0x36c5d4={'where':_0x11c203[_0xe6ba('0x3b')]};return db[_0xe6ba('0x2d')][_0xe6ba('0x1e')](_0x36c5d4)[_0xe6ba('0x27')](function(_0x461b49){_0x37d3ed[_0xe6ba('0x1e')]=_0x461b49;if(_0x1711fb['query']['includeAll']){_0x11c203['include']=[{'all':!![]}];}return db[_0xe6ba('0x2d')][_0xe6ba('0x3f')](_0x11c203);})[_0xe6ba('0x27')](function(_0x3c191b){_0x37d3ed[_0xe6ba('0x40')]=_0x3c191b;return _0x37d3ed;})['then'](respondWithFilteredResult(_0x1e84bb,_0x11c203))[_0xe6ba('0x41')](handleError(_0x1e84bb,null));};exports[_0xe6ba('0x42')]=function(_0x4508d3,_0xc71fe8){var _0x527982={'raw':!![],'where':{'id':_0x4508d3[_0xe6ba('0x43')]['id']}},_0x54c262={};_0x54c262[_0xe6ba('0x31')]=_['keys'](db[_0xe6ba('0x2d')][_0xe6ba('0x44')]);_0x54c262[_0xe6ba('0x33')]=_[_0xe6ba('0x34')](_0x4508d3[_0xe6ba('0x33')]);_0x54c262[_0xe6ba('0x35')]=_['intersection'](_0x54c262['model'],_0x54c262[_0xe6ba('0x33')]);_0x527982[_0xe6ba('0x38')]=_[_0xe6ba('0x36')](_0x54c262[_0xe6ba('0x31')],qs[_0xe6ba('0x37')](_0x4508d3[_0xe6ba('0x33')][_0xe6ba('0x37')]));_0x527982[_0xe6ba('0x38')]=_0x527982[_0xe6ba('0x38')][_0xe6ba('0x45')]?_0x527982[_0xe6ba('0x38')]:_0x54c262[_0xe6ba('0x31')];if(_0x4508d3[_0xe6ba('0x33')]['includeAll']){_0x527982[_0xe6ba('0x46')]=[{'all':!![]}];}_0x527982=_[_0xe6ba('0x47')]({},_0x527982,_0x4508d3[_0xe6ba('0x3e')]);return db[_0xe6ba('0x2d')]['find'](_0x527982)[_0xe6ba('0x27')](handleEntityNotFound(_0xc71fe8,null))[_0xe6ba('0x27')](respondWithResult(_0xc71fe8,null))[_0xe6ba('0x41')](handleError(_0xc71fe8,null));};exports[_0xe6ba('0x48')]=function(_0x5f4adb,_0x5ed4cd){return db[_0xe6ba('0x2d')]['create'](_0x5f4adb[_0xe6ba('0x49')],{})[_0xe6ba('0x27')](respondWithResult(_0x5ed4cd,0xc9))[_0xe6ba('0x41')](handleError(_0x5ed4cd,null));};exports[_0xe6ba('0x26')]=function(_0x3f3670,_0x18f820){if(_0x3f3670[_0xe6ba('0x49')]['id']){delete _0x3f3670[_0xe6ba('0x49')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3f3670[_0xe6ba('0x43')]['id']}})[_0xe6ba('0x27')](handleEntityNotFound(_0x18f820,null))[_0xe6ba('0x27')](saveUpdates(_0x3f3670[_0xe6ba('0x49')],null))[_0xe6ba('0x27')](respondWithResult(_0x18f820,null))['catch'](handleError(_0x18f820,null));};exports['destroy']=function(_0x5a168a,_0x249735){return db[_0xe6ba('0x2d')][_0xe6ba('0x4a')]({'where':{'id':_0x5a168a[_0xe6ba('0x43')]['id']}})[_0xe6ba('0x27')](handleEntityNotFound(_0x249735,null))['then'](removeEntity(_0x249735,null))[_0xe6ba('0x41')](handleError(_0x249735,null));}; \ No newline at end of file +var _0xb2a6=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','SmsApplication','includeAll','include','catch','show','find','create','body','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x20e7c6,_0x11d21f){_0x20e7c6=_0x20e7c6-0x0;var _0x23b888=_0xb2a6[_0x20e7c6];return _0x23b888;};'use strict';var pdf=require(_0x6b2a('0x0'));var emlformat=require(_0x6b2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6b2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b2a('0x3'));var moment=require(_0x6b2a('0x4'));var BPromise=require(_0x6b2a('0x5'));var Mustache=require(_0x6b2a('0x6'));var util=require(_0x6b2a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b2a('0x8'));var fs=require('fs');var _=require(_0x6b2a('0x9'));var squel=require(_0x6b2a('0xa'));var crypto=require(_0x6b2a('0xb'));var jsforce=require(_0x6b2a('0xc'));var deskjs=require(_0x6b2a('0xd'));var toCsv=require(_0x6b2a('0xe'));var querystring=require(_0x6b2a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b2a('0x10'));var authService=require(_0x6b2a('0x11'));var qs=require(_0x6b2a('0x12'));var as=require(_0x6b2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b2a('0x14'))(_0x6b2a('0x15'));var utils=require(_0x6b2a('0x16'));var config=require(_0x6b2a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b2a('0x18'))['db'];function respondWithStatusCode(_0x2e8f05,_0x57047a){_0x57047a=_0x57047a||0xcc;return function(_0x461c95){if(_0x461c95){return _0x2e8f05[_0x6b2a('0x19')](_0x57047a);}return _0x2e8f05[_0x6b2a('0x1a')](_0x57047a)[_0x6b2a('0x1b')]();};}function respondWithResult(_0xb6c388,_0x246f92){_0x246f92=_0x246f92||0xc8;return function(_0x1ad2b1){if(_0x1ad2b1){return _0xb6c388['status'](_0x246f92)[_0x6b2a('0x1c')](_0x1ad2b1);}};}function respondWithFilteredResult(_0x261727,_0x20c428){return function(_0xd8c0f3){if(_0xd8c0f3){var _0x1f4d73=_0xd8c0f3[_0x6b2a('0x1d')],_0x58ad9f=_0x20c428[_0x6b2a('0x1e')],_0x5ad266=_0x20c428[_0x6b2a('0x1e')]+_0x20c428[_0x6b2a('0x1f')],_0x101bd5;if(_0x5ad266>=_0x1f4d73){_0x5ad266=_0x1f4d73;_0x101bd5=0xc8;}else{_0x101bd5=0xce;}_0x261727[_0x6b2a('0x1a')](_0x101bd5);return _0x261727['set']('Content-Range',_0x58ad9f+'-'+_0x5ad266+'/'+_0x1f4d73)[_0x6b2a('0x1c')](_0xd8c0f3);}return null;};}function patchUpdates(_0x4a71e1){return function(_0xfe576e){try{jsonpatch[_0x6b2a('0x20')](_0xfe576e,_0x4a71e1,!![]);}catch(_0x5cdda6){return BPromise[_0x6b2a('0x21')](_0x5cdda6);}return _0xfe576e[_0x6b2a('0x22')]();};}function saveUpdates(_0x9a61d8,_0x180726){return function(_0x4b39d1){if(_0x4b39d1){return _0x4b39d1[_0x6b2a('0x23')](_0x9a61d8)[_0x6b2a('0x24')](function(_0x5c5808){return _0x5c5808;});}return null;};}function removeEntity(_0x32fa10,_0x5ebf6a){return function(_0x2fbfd8){if(_0x2fbfd8){return _0x2fbfd8[_0x6b2a('0x25')]()['then'](function(){_0x32fa10[_0x6b2a('0x1a')](0xcc)[_0x6b2a('0x1b')]();});}};}function handleEntityNotFound(_0x5b669f,_0x30e47c){return function(_0x937c8b){if(!_0x937c8b){_0x5b669f[_0x6b2a('0x19')](0x194);}return _0x937c8b;};}function handleError(_0x1d92ad,_0x26da03){_0x26da03=_0x26da03||0x1f4;return function(_0x2284a3){logger[_0x6b2a('0x26')](_0x2284a3[_0x6b2a('0x27')]);if(_0x2284a3[_0x6b2a('0x28')]){delete _0x2284a3[_0x6b2a('0x28')];}_0x1d92ad[_0x6b2a('0x1a')](_0x26da03)[_0x6b2a('0x29')](_0x2284a3);};}exports[_0x6b2a('0x2a')]=function(_0x193e5a,_0xd01fdc){var _0x1b51f0={},_0x18b917={},_0x5acbbf={'count':0x0,'rows':[]};var _0x97b9b2=_[_0x6b2a('0x2b')](db['SmsApplication'][_0x6b2a('0x2c')],function(_0x52d110){return{'name':_0x52d110[_0x6b2a('0x2d')],'type':_0x52d110[_0x6b2a('0x2e')][_0x6b2a('0x2f')]};});_0x18b917[_0x6b2a('0x30')]=_[_0x6b2a('0x2b')](_0x97b9b2,_0x6b2a('0x28'));_0x18b917[_0x6b2a('0x31')]=_[_0x6b2a('0x32')](_0x193e5a[_0x6b2a('0x31')]);_0x18b917[_0x6b2a('0x33')]=_[_0x6b2a('0x34')](_0x18b917['model'],_0x18b917['query']);_0x1b51f0[_0x6b2a('0x35')]=_[_0x6b2a('0x34')](_0x18b917[_0x6b2a('0x30')],qs['fields'](_0x193e5a['query'][_0x6b2a('0x36')]));_0x1b51f0[_0x6b2a('0x35')]=_0x1b51f0[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x1b51f0[_0x6b2a('0x35')]:_0x18b917[_0x6b2a('0x30')];if(!_0x193e5a[_0x6b2a('0x31')][_0x6b2a('0x38')](_0x6b2a('0x39'))){_0x1b51f0[_0x6b2a('0x1f')]=qs[_0x6b2a('0x1f')](_0x193e5a[_0x6b2a('0x31')][_0x6b2a('0x1f')]);_0x1b51f0[_0x6b2a('0x1e')]=qs[_0x6b2a('0x1e')](_0x193e5a['query'][_0x6b2a('0x1e')]);}_0x1b51f0[_0x6b2a('0x3a')]=qs[_0x6b2a('0x3b')](_0x193e5a['query'][_0x6b2a('0x3b')]);_0x1b51f0[_0x6b2a('0x3c')]=qs[_0x6b2a('0x33')](_['pick'](_0x193e5a[_0x6b2a('0x31')],_0x18b917[_0x6b2a('0x33')]),_0x97b9b2);if(_0x193e5a[_0x6b2a('0x31')]['filter']){_0x1b51f0['where']=_['merge'](_0x1b51f0['where'],{'$or':_['map'](_0x97b9b2,function(_0x43598c){if(_0x43598c['type']!==_0x6b2a('0x3d')){var _0x316ab5={};_0x316ab5[_0x43598c[_0x6b2a('0x28')]]={'$like':'%'+_0x193e5a[_0x6b2a('0x31')]['filter']+'%'};return _0x316ab5;}})});}_0x1b51f0=_[_0x6b2a('0x3e')]({},_0x1b51f0,_0x193e5a[_0x6b2a('0x3f')]);var _0x2b5659={'where':_0x1b51f0[_0x6b2a('0x3c')]};return db[_0x6b2a('0x40')]['count'](_0x2b5659)['then'](function(_0x486ce9){_0x5acbbf[_0x6b2a('0x1d')]=_0x486ce9;if(_0x193e5a['query'][_0x6b2a('0x41')]){_0x1b51f0[_0x6b2a('0x42')]=[{'all':!![]}];}return db[_0x6b2a('0x40')]['findAll'](_0x1b51f0);})['then'](function(_0x5e3b5d){_0x5acbbf['rows']=_0x5e3b5d;return _0x5acbbf;})[_0x6b2a('0x24')](respondWithFilteredResult(_0xd01fdc,_0x1b51f0))[_0x6b2a('0x43')](handleError(_0xd01fdc,null));};exports[_0x6b2a('0x44')]=function(_0x5d652f,_0x4a83e3){var _0x37c8e6={'raw':!![],'where':{'id':_0x5d652f['params']['id']}},_0x4caa1e={};_0x4caa1e[_0x6b2a('0x30')]=_[_0x6b2a('0x32')](db['SmsApplication'][_0x6b2a('0x2c')]);_0x4caa1e[_0x6b2a('0x31')]=_[_0x6b2a('0x32')](_0x5d652f[_0x6b2a('0x31')]);_0x4caa1e['filters']=_['intersection'](_0x4caa1e['model'],_0x4caa1e[_0x6b2a('0x31')]);_0x37c8e6[_0x6b2a('0x35')]=_['intersection'](_0x4caa1e[_0x6b2a('0x30')],qs['fields'](_0x5d652f[_0x6b2a('0x31')][_0x6b2a('0x36')]));_0x37c8e6[_0x6b2a('0x35')]=_0x37c8e6[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x37c8e6['attributes']:_0x4caa1e[_0x6b2a('0x30')];if(_0x5d652f[_0x6b2a('0x31')][_0x6b2a('0x41')]){_0x37c8e6[_0x6b2a('0x42')]=[{'all':!![]}];}_0x37c8e6=_[_0x6b2a('0x3e')]({},_0x37c8e6,_0x5d652f[_0x6b2a('0x3f')]);return db[_0x6b2a('0x40')][_0x6b2a('0x45')](_0x37c8e6)[_0x6b2a('0x24')](handleEntityNotFound(_0x4a83e3,null))[_0x6b2a('0x24')](respondWithResult(_0x4a83e3,null))[_0x6b2a('0x43')](handleError(_0x4a83e3,null));};exports[_0x6b2a('0x46')]=function(_0x5548ab,_0x3059ed){return db[_0x6b2a('0x40')][_0x6b2a('0x46')](_0x5548ab[_0x6b2a('0x47')],{})['then'](respondWithResult(_0x3059ed,0xc9))[_0x6b2a('0x43')](handleError(_0x3059ed,null));};exports[_0x6b2a('0x23')]=function(_0x2ca15b,_0x2bf58b){if(_0x2ca15b[_0x6b2a('0x47')]['id']){delete _0x2ca15b[_0x6b2a('0x47')]['id'];}return db['SmsApplication'][_0x6b2a('0x45')]({'where':{'id':_0x2ca15b[_0x6b2a('0x48')]['id']}})[_0x6b2a('0x24')](handleEntityNotFound(_0x2bf58b,null))[_0x6b2a('0x24')](saveUpdates(_0x2ca15b[_0x6b2a('0x47')],null))['then'](respondWithResult(_0x2bf58b,null))[_0x6b2a('0x43')](handleError(_0x2bf58b,null));};exports[_0x6b2a('0x25')]=function(_0x2fb896,_0x85b62a){return db[_0x6b2a('0x40')][_0x6b2a('0x45')]({'where':{'id':_0x2fb896['params']['id']}})[_0x6b2a('0x24')](handleEntityNotFound(_0x85b62a,null))['then'](removeEntity(_0x85b62a,null))[_0x6b2a('0x43')](handleError(_0x85b62a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 88e4800..8172d93 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 _0xc905=['path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','bluebird','request-promise'];(function(_0x5786df,_0x33b73c){var _0x424302=function(_0x226e4a){while(--_0x226e4a){_0x5786df['push'](_0x5786df['shift']());}};_0x424302(++_0x33b73c);}(_0xc905,0x97));var _0x5c90=function(_0x4d9b80,_0x3deb54){_0x4d9b80=_0x4d9b80-0x0;var _0x3e6b70=_0xc905[_0x4d9b80];return _0x3e6b70;};'use strict';var _=require('lodash');var util=require(_0x5c90('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5c90('0x1'));var rp=require(_0x5c90('0x2'));var fs=require('fs');var path=require(_0x5c90('0x3'));var rimraf=require(_0x5c90('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c90('0x5'));module[_0x5c90('0x6')]=function(_0x51c4c3,_0x241713){return _0x51c4c3[_0x5c90('0x7')](_0x5c90('0x8'),attributes,{'tableName':_0x5c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c90('0xa')});}; \ No newline at end of file +var _0x0a2c=['./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0x0a2c,0x123));var _0xc0a2=function(_0x3aee09,_0x3c77c8){_0x3aee09=_0x3aee09-0x0;var _0x4329d4=_0x0a2c[_0x3aee09];return _0x4329d4;};'use strict';var _=require(_0xc0a2('0x0'));var util=require('util');var logger=require(_0xc0a2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc0a2('0x2'));var rp=require(_0xc0a2('0x3'));var fs=require('fs');var path=require(_0xc0a2('0x4'));var rimraf=require(_0xc0a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xc0a2('0x6'));module['exports']=function(_0x6544e9,_0x56d751){return _0x6544e9[_0xc0a2('0x7')](_0xc0a2('0x8'),attributes,{'tableName':_0xc0a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0a2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 9dd5081..de95330 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 _0xd206=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsApplication,\x20%s,\x20%s'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xd206,0x107));var _0x6d20=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xd206[_0x616290];return _0x453879;};'use strict';var _=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var moment=require('moment');var BPromise=require(_0x6d20('0x2'));var rs=require(_0x6d20('0x3'));var fs=require('fs');var Redis=require(_0x6d20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d20('0x5'));var logger=require(_0x6d20('0x6'))(_0x6d20('0x7'));var config=require(_0x6d20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc981,_0x125a39,_0x3080fb){return new BPromise(function(_0x5b4154,_0x2b338c){return client['request'](_0x4dc981,_0x3080fb)[_0x6d20('0xa')](function(_0x4222dc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x125a39,'request\x20sent');logger[_0x6d20('0xb')](_0x6d20('0xc'),_0x125a39,'request\x20sent',JSON[_0x6d20('0xd')](_0x4222dc));if(_0x4222dc['error']){if(_0x4222dc[_0x6d20('0xe')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x125a39,_0x4222dc['error'][_0x6d20('0xf')]);return _0x2b338c(_0x4222dc[_0x6d20('0xe')][_0x6d20('0xf')]);}logger[_0x6d20('0xe')](_0x6d20('0x10'),_0x125a39,_0x4222dc[_0x6d20('0xe')]['message']);return _0x5b4154(_0x4222dc[_0x6d20('0xe')]['message']);}else{logger[_0x6d20('0x11')](_0x6d20('0x10'),_0x125a39,'request\x20sent');_0x5b4154(_0x4222dc[_0x6d20('0x12')][_0x6d20('0xf')]);}})[_0x6d20('0x13')](function(_0x133cd0){logger['error']('SmsApplication,\x20%s,\x20%s',_0x125a39,_0x133cd0);_0x2b338c(_0x133cd0);});});} \ No newline at end of file +var _0x49df=['../../config/environment','jayson/promise','client','http','request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SmsApplication,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e266f,_0x134719){var _0x2e531c=function(_0x6076e1){while(--_0x6076e1){_0x5e266f['push'](_0x5e266f['shift']());}};_0x2e531c(++_0x134719);}(_0x49df,0xad));var _0xf49d=function(_0xbcbd76,_0x25722b){_0xbcbd76=_0xbcbd76-0x0;var _0x503680=_0x49df[_0xbcbd76];return _0x503680;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf49d('0x0'));var BPromise=require(_0xf49d('0x1'));var rs=require(_0xf49d('0x2'));var fs=require('fs');var Redis=require(_0xf49d('0x3'));var db=require(_0xf49d('0x4'))['db'];var utils=require(_0xf49d('0x5'));var logger=require(_0xf49d('0x6'))('rpc');var config=require(_0xf49d('0x7'));var jayson=require(_0xf49d('0x8'));var client=jayson[_0xf49d('0x9')][_0xf49d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aaf37,_0x29b82e,_0x4e8b5e){return new BPromise(function(_0xadfde5,_0x36ed1d){return client[_0xf49d('0xb')](_0x1aaf37,_0x4e8b5e)['then'](function(_0x5aca77){logger[_0xf49d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x29b82e,'request\x20sent');logger[_0xf49d('0xd')](_0xf49d('0xe'),_0x29b82e,_0xf49d('0xf'),JSON['stringify'](_0x5aca77));if(_0x5aca77[_0xf49d('0x10')]){if(_0x5aca77[_0xf49d('0x10')]['code']===0x1f4){logger[_0xf49d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0x36ed1d(_0x5aca77['error'][_0xf49d('0x11')]);}logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0xadfde5(_0x5aca77[_0xf49d('0x10')][_0xf49d('0x11')]);}else{logger['info'](_0xf49d('0x12'),_0x29b82e,_0xf49d('0xf'));_0xadfde5(_0x5aca77[_0xf49d('0x13')][_0xf49d('0x11')]);}})['catch'](function(_0x2927b9){logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x2927b9);_0x36ed1d(_0x2927b9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 51fef2c..5df7f1a 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 _0x2a75=['/describe','describe','/:id','isAuthenticated','show','getMessages','post','create','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get'];(function(_0x2b46ac,_0x3e056d){var _0xe79fea=function(_0x249c3b){while(--_0x249c3b){_0x2b46ac['push'](_0x2b46ac['shift']());}};_0xe79fea(++_0x3e056d);}(_0x2a75,0x175));var _0x52a7=function(_0x15b2ba,_0x32637b){_0x15b2ba=_0x15b2ba-0x0;var _0x4c6689=_0x2a75[_0x15b2ba];return _0x4c6689;};'use strict';var multer=require(_0x52a7('0x0'));var util=require('util');var path=require(_0x52a7('0x1'));var timeout=require(_0x52a7('0x2'));var express=require(_0x52a7('0x3'));var router=express[_0x52a7('0x4')]();var auth=require(_0x52a7('0x5'));var interaction=require(_0x52a7('0x6'));var config=require(_0x52a7('0x7'));var controller=require(_0x52a7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x52a7('0x9')]);router[_0x52a7('0xa')](_0x52a7('0xb'),auth['isAuthenticated'](),controller[_0x52a7('0xc')]);router[_0x52a7('0xa')](_0x52a7('0xd'),auth[_0x52a7('0xe')](),controller[_0x52a7('0xf')]);router[_0x52a7('0xa')]('/:id/messages',auth[_0x52a7('0xe')](),controller[_0x52a7('0x10')]);router[_0x52a7('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x52a7('0x11')]('/',auth['isAuthenticated'](),controller[_0x52a7('0x12')]);router[_0x52a7('0x11')](_0x52a7('0x13'),auth[_0x52a7('0xe')](),controller['addMessage']);router[_0x52a7('0x11')](_0x52a7('0x14'),auth[_0x52a7('0xe')](),interaction[_0x52a7('0x15')](_0x52a7('0x16'),_0x52a7('0x17')),controller['addTags']);router[_0x52a7('0x18')](_0x52a7('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x52a7('0x16'),_0x52a7('0x19')),controller[_0x52a7('0x1a')]);router[_0x52a7('0x1b')](_0x52a7('0xd'),auth['isAuthenticated'](),interaction[_0x52a7('0x15')](_0x52a7('0x16'),_0x52a7('0x1c')),controller[_0x52a7('0x1d')]);router[_0x52a7('0x1b')](_0x52a7('0x14'),auth[_0x52a7('0xe')](),controller[_0x52a7('0x1e')]);module[_0x52a7('0x1f')]=router; \ No newline at end of file +var _0xd515=['/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xd515,0x168));var _0x5d51=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xd515[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0x5d51('0x0'));var util=require('util');var path=require(_0x5d51('0x1'));var timeout=require(_0x5d51('0x2'));var express=require('express');var router=express[_0x5d51('0x3')]();var auth=require(_0x5d51('0x4'));var interaction=require(_0x5d51('0x5'));var config=require(_0x5d51('0x6'));var controller=require(_0x5d51('0x7'));router[_0x5d51('0x8')]('/',auth[_0x5d51('0x9')](),controller[_0x5d51('0xa')]);router['get']('/describe',auth[_0x5d51('0x9')](),controller[_0x5d51('0xb')]);router[_0x5d51('0x8')](_0x5d51('0xc'),auth[_0x5d51('0x9')](),controller[_0x5d51('0xd')]);router[_0x5d51('0x8')]('/:id/messages',auth[_0x5d51('0x9')](),controller[_0x5d51('0xe')]);router['get'](_0x5d51('0xf'),auth[_0x5d51('0x9')](),controller['download']);router[_0x5d51('0x10')]('/',auth[_0x5d51('0x9')](),controller[_0x5d51('0x11')]);router[_0x5d51('0x10')](_0x5d51('0x12'),auth[_0x5d51('0x9')](),controller[_0x5d51('0x13')]);router[_0x5d51('0x10')](_0x5d51('0x14'),auth[_0x5d51('0x9')](),interaction['tracked'](_0x5d51('0x15'),_0x5d51('0x16')),controller[_0x5d51('0x17')]);router[_0x5d51('0x18')](_0x5d51('0xc'),auth[_0x5d51('0x9')](),interaction[_0x5d51('0x19')](_0x5d51('0x15'),_0x5d51('0x1a')),controller[_0x5d51('0x1b')]);router['delete'](_0x5d51('0xc'),auth[_0x5d51('0x9')](),interaction[_0x5d51('0x19')]('sms',_0x5d51('0x1c')),controller[_0x5d51('0x1d')]);router[_0x5d51('0x1e')](_0x5d51('0x14'),auth[_0x5d51('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a715904..f52941a 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 _0x7a1b=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x4af7c3,_0x5de577){var _0x4652c8=function(_0x4a5ec8){while(--_0x4a5ec8){_0x4af7c3['push'](_0x4af7c3['shift']());}};_0x4652c8(++_0x5de577);}(_0x7a1b,0x76));var _0xb7a1=function(_0x17b488,_0x9ab8e5){_0x17b488=_0x17b488-0x0;var _0x45d4ba=_0x7a1b[_0x17b488];return _0x45d4ba;};'use strict';var Sequelize=require(_0xb7a1('0x0'));var moment=require(_0xb7a1('0x1'));module[_0xb7a1('0x2')]={'closed':{'type':Sequelize[_0xb7a1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb7a1('0x4')]},'disposition':{'type':Sequelize[_0xb7a1('0x5')]},'secondDisposition':{'type':Sequelize[_0xb7a1('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb7a1('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb7a1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb7a1('0x6')]('in',_0xb7a1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb7a1('0x6')]('in',_0xb7a1('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x35c4=['out','sequelize','moment','DATE','STRING','ENUM'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0x35c4,0x73));var _0x435c=function(_0x1dbd39,_0x1c9841){_0x1dbd39=_0x1dbd39-0x0;var _0x2eb447=_0x35c4[_0x1dbd39];return _0x2eb447;};'use strict';var Sequelize=require(_0x435c('0x0'));var moment=require(_0x435c('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x435c('0x2')]},'disposition':{'type':Sequelize[_0x435c('0x3')]},'secondDisposition':{'type':Sequelize[_0x435c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x435c('0x3')]},'phone':{'type':Sequelize[_0x435c('0x3')]},'read1stAt':{'type':Sequelize[_0x435c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x435c('0x4')]('in',_0x435c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x435c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x435c('0x4')]('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 a034486..fb04e16 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 _0x8dd0=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','u.id','u.fullname','ui.SmsInteractionId','from','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','show','params','includeAll','include','merge','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','findAll','color','emit','smsInteractionTags:save','removeTags','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','lastName','Messages','direction','secret','Account','get','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','YYYY-MM-DD','Sms','Owner','disposition','out','System','firstName','views','downloadInteraction.html','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','catch','map','SmsInteraction','rawAttributes','fieldName','type'];(function(_0x500b8e,_0x32b7e1){var _0xc549a8=function(_0x4e0545){while(--_0x4e0545){_0x500b8e['push'](_0x500b8e['shift']());}};_0xc549a8(++_0x32b7e1);}(_0x8dd0,0x19c));var _0x08dd=function(_0xe72bbb,_0x4100a4){_0xe72bbb=_0xe72bbb-0x0;var _0x5c15f2=_0x8dd0[_0xe72bbb];return _0x5c15f2;};'use strict';var pdf=require(_0x08dd('0x0'));var emlformat=require(_0x08dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08dd('0x2'));var jsonpatch=require(_0x08dd('0x3'));var rp=require(_0x08dd('0x4'));var moment=require('moment');var BPromise=require(_0x08dd('0x5'));var Mustache=require(_0x08dd('0x6'));var util=require(_0x08dd('0x7'));var path=require(_0x08dd('0x8'));var sox=require('sox');var csv=require(_0x08dd('0x9'));var ejs=require(_0x08dd('0xa'));var fs=require('fs');var _=require(_0x08dd('0xb'));var squel=require(_0x08dd('0xc'));var crypto=require(_0x08dd('0xd'));var jsforce=require(_0x08dd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08dd('0xf'));var Papa=require(_0x08dd('0x10'));var Redis=require('ioredis');var authService=require(_0x08dd('0x11'));var qs=require(_0x08dd('0x12'));var as=require(_0x08dd('0x13'));var hardwareService=require(_0x08dd('0x14'));var logger=require(_0x08dd('0x15'))(_0x08dd('0x16'));var utils=require(_0x08dd('0x17'));var config=require(_0x08dd('0x18'));var licenseUtil=require(_0x08dd('0x19'));var db=require(_0x08dd('0x1a'))['db'];config[_0x08dd('0x1b')]=_[_0x08dd('0x1c')](config['redis'],{'host':_0x08dd('0x1d'),'port':0x18eb});var socket=require(_0x08dd('0x1e'))(new Redis(config[_0x08dd('0x1b')]));require(_0x08dd('0x1f'))['register'](socket);function respondWithStatusCode(_0x27d3e6,_0xf104d4){_0xf104d4=_0xf104d4||0xcc;return function(_0x47bbb4){if(_0x47bbb4){return _0x27d3e6[_0x08dd('0x20')](_0xf104d4);}return _0x27d3e6['status'](_0xf104d4)[_0x08dd('0x21')]();};}function respondWithResult(_0x148106,_0x333681){_0x333681=_0x333681||0xc8;return function(_0x513423){if(_0x513423){return _0x148106[_0x08dd('0x22')](_0x333681)[_0x08dd('0x23')](_0x513423);}};}function respondWithFilteredResult(_0x216576,_0x2066a2){return function(_0x482a83){if(_0x482a83){var _0x33dd61=_0x482a83[_0x08dd('0x24')],_0x1b947e=_0x2066a2[_0x08dd('0x25')],_0x128d84=_0x2066a2[_0x08dd('0x25')]+_0x2066a2[_0x08dd('0x26')],_0x142b07;if(_0x128d84>=_0x33dd61){_0x128d84=_0x33dd61;_0x142b07=0xc8;}else{_0x142b07=0xce;}_0x216576[_0x08dd('0x22')](_0x142b07);return _0x216576[_0x08dd('0x27')](_0x08dd('0x28'),_0x1b947e+'-'+_0x128d84+'/'+_0x33dd61)[_0x08dd('0x23')](_0x482a83);}return null;};}function patchUpdates(_0x25e76a){return function(_0x223e94){try{jsonpatch[_0x08dd('0x29')](_0x223e94,_0x25e76a,!![]);}catch(_0x44a1a9){return BPromise[_0x08dd('0x2a')](_0x44a1a9);}return _0x223e94[_0x08dd('0x2b')]();};}function saveUpdates(_0x201440,_0x16661f){return function(_0x27a86c){if(_0x27a86c){return _0x27a86c[_0x08dd('0x2c')](_0x201440)['then'](function(_0x397d8e){return _0x397d8e;});}return null;};}function removeEntity(_0x241651,_0x13d99d){return function(_0xeb4871){if(_0xeb4871){return _0xeb4871[_0x08dd('0x2d')]()[_0x08dd('0x2e')](function(){_0x241651[_0x08dd('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14274b,_0x3681f8){return function(_0x570510){if(!_0x570510){_0x14274b['sendStatus'](0x194);}return _0x570510;};}function handleError(_0x2afbb9,_0x3184b8){_0x3184b8=_0x3184b8||0x1f4;return function(_0x21e5b7){logger['error'](_0x21e5b7[_0x08dd('0x2f')]);if(_0x21e5b7[_0x08dd('0x30')]){delete _0x21e5b7[_0x08dd('0x30')];}_0x2afbb9[_0x08dd('0x22')](_0x3184b8)[_0x08dd('0x31')](_0x21e5b7);};}function getInteractionUsers(_0x42824f,_0x42c7da){return new BPromise(function(_0x525a90,_0x1184e6){try{if(_0x42c7da[_0x42824f['id']]){_0x42824f[_0x08dd('0x32')]=_['map'](_0x42c7da[_0x42824f['id']],function(_0x1638f6){return{'id':_0x1638f6['id'],'fullname':_0x1638f6[_0x08dd('0x33')]};});}}catch(_0x424af3){_0x1184e6(_0x424af3);}_0x525a90(_0x42824f);});}function getInteractionTags(_0x1d4942,_0x6ac0cf){return new BPromise(function(_0x7abfe2,_0x48b0f5){try{if(_0x1d4942[_0x08dd('0x34')]){_0x1d4942[_0x08dd('0x35')]=[];_0x1d4942[_0x08dd('0x34')]['split'](',')[_0x08dd('0x36')](function(_0xc75f25){_0x1d4942[_0x08dd('0x35')][_0x08dd('0x37')](_0x6ac0cf[_0xc75f25]);});}delete _0x1d4942['TagIds'];}catch(_0x4ed46a){_0x48b0f5(_0x4ed46a);}_0x7abfe2(_0x1d4942);});}function updateSmsInteraction(_0x3bd14e,_0x20a174,_0x131f64){return new BPromise(function(_0x185ac5,_0x5af7a3){return getInteractionUsers(_0x3bd14e,_0x131f64)['then'](function(_0x2f859a){return getInteractionTags(_0x2f859a,_0x20a174);})[_0x08dd('0x2e')](function(_0x37d09d){_0x185ac5(_0x37d09d);})[_0x08dd('0x38')](function(_0x4d1828){_0x5af7a3(_0x4d1828);});});}exports['index']=function(_0x1c0422,_0x31dae2){var _0x4ce803={},_0x47778c={},_0x51b71f={'count':0x0,'rows':[]};var _0x3fa4a2=_[_0x08dd('0x39')](db[_0x08dd('0x3a')][_0x08dd('0x3b')],function(_0x270757){return{'name':_0x270757[_0x08dd('0x3c')],'type':_0x270757[_0x08dd('0x3d')][_0x08dd('0x3e')]};});_0x47778c[_0x08dd('0x3f')]=_[_0x08dd('0x39')](_0x3fa4a2,'name');_0x47778c[_0x08dd('0x40')]=_[_0x08dd('0x41')](_0x1c0422[_0x08dd('0x40')]);_0x47778c[_0x08dd('0x42')]=_['intersection'](_0x47778c[_0x08dd('0x3f')],_0x47778c['query']);_0x4ce803[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x47778c['model'],qs[_0x08dd('0x45')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x45')]));_0x4ce803[_0x08dd('0x43')]=_0x4ce803[_0x08dd('0x43')][_0x08dd('0x46')]?_0x4ce803[_0x08dd('0x43')]:_0x47778c['model'];if(!_0x1c0422[_0x08dd('0x40')][_0x08dd('0x47')](_0x08dd('0x48'))){_0x4ce803[_0x08dd('0x26')]=qs['limit'](_0x1c0422[_0x08dd('0x40')]['limit']);_0x4ce803[_0x08dd('0x25')]=qs[_0x08dd('0x25')](_0x1c0422[_0x08dd('0x40')]['offset']);}_0x4ce803[_0x08dd('0x49')]=qs[_0x08dd('0x4a')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x4a')]);_0x4ce803[_0x08dd('0x4b')]=qs[_0x08dd('0x42')](_[_0x08dd('0x4c')](_0x1c0422[_0x08dd('0x40')],_0x47778c['filters']),_0x3fa4a2);var _0x410a9f=[];var _0x319eea=squel[_0x08dd('0x4d')]()[_0x08dd('0x4e')]('id')[_0x08dd('0x4e')]('name')[_0x08dd('0x4e')]('color')['from']('tools_tags');var _0x1df771=squel[_0x08dd('0x4d')]()[_0x08dd('0x4e')](_0x08dd('0x4f'))[_0x08dd('0x4e')](_0x08dd('0x50'))['field'](_0x08dd('0x51'))[_0x08dd('0x52')]('user_has_sms_interactions','ui')[_0x08dd('0x53')]('users','u',_0x08dd('0x54'));var _0x2c2d89=squel[_0x08dd('0x4d')]()['from'](_0x08dd('0x55'),'i')['left_join'](_0x08dd('0x56'),'c',_0x08dd('0x57'))[_0x08dd('0x53')]('users','o',_0x08dd('0x58'))[_0x08dd('0x53')]('sms_accounts','a',_0x08dd('0x59'))[_0x08dd('0x53')]('sms_messages','me',_0x08dd('0x5a'))[_0x08dd('0x53')](_0x08dd('0x5b'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x08dd('0x5c'));var _0x53e03d=squel[_0x08dd('0x5d')]();var _0x308393=[];var _0x1df273=squel[_0x08dd('0x5d')]();var _0x2c0a90;if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x5e')]){_0x2c0a90=as[_0x08dd('0x5f')](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x5e')]);var _0x1fd3ea=_0x2c0a90['sqlOperator'];for(var _0xe7a017=0x0;_0xe7a017<_0x2c0a90[_0x08dd('0x60')]['length'];_0xe7a017++){var _0x3a2ced=_0x2c0a90[_0x08dd('0x60')][_0xe7a017];var _0x2fcf71='i';var _0x57af33=_[_0x08dd('0x61')](_0x3fa4a2,[_0x08dd('0x30'),_0x3a2ced[_0x08dd('0x4e')]]);if(!_0x57af33){switch(_0x3a2ced[_0x08dd('0x4e')]){case _0x08dd('0x62'):if(_0x3a2ced[_0x08dd('0x63')]==0x1){_0x2c2d89['having']('`'+_0x3a2ced['field']+_0x08dd('0x64'));}else{_0x2c2d89['having']('`'+_0x3a2ced[_0x08dd('0x4e')]+_0x08dd('0x65'));}break;case _0x08dd('0x66'):if(_0x3a2ced['operator']==='$substring'){if(_0x3a2ced[_0x08dd('0x63')][_0x08dd('0x67')]('\x20')['length']>0x1){_0x53e03d[_0x1fd3ea](_0x08dd('0x68'),qs[_0x08dd('0x69')](_0x3a2ced[_0x08dd('0x63')]),null);}else{var _0x178c6a='%'+_0x3a2ced[_0x08dd('0x63')]+'%';_0x53e03d[_0x1fd3ea](_0x08dd('0x6a'),_0x178c6a,_0x178c6a,_0x178c6a);}}else{_0x57af33=_['find'](_0x3fa4a2,[_0x08dd('0x30'),_0x08dd('0x6b')]);_0x3a2ced[_0x08dd('0x4e')]=_0x08dd('0x6b');_0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33[_0x08dd('0x3d')],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f['value']['end']);}break;case _0x08dd('0x6f'):var _0x2f735e=_0x3a2ced[_0x08dd('0x63')][_0x08dd('0x67')](',')[_0x08dd('0x39')](function(_0x26828c){return Number(_0x26828c);});_0x2f735e[_0x08dd('0x36')](function(_0xaf457){_0x1df273['or'](_0x08dd('0x70'),'%,'+_0xaf457+',%');});_0x308393=_['union'](_0x308393,_0x2f735e);break;case _0x08dd('0x71'):if(_0x3a2ced[_0x08dd('0x72')]==='$substring'){_0x53e03d[_0x1fd3ea](_0x08dd('0x73'),'%'+_0x3a2ced[_0x08dd('0x63')]+'%',null);}else{_0x57af33=_[_0x08dd('0x61')](_0x3fa4a2,['name','UserId']);_0x3a2ced[_0x08dd('0x4e')]='UserId';_0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33[_0x08dd('0x3d')],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f['text'],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x21')]);}break;case _0x08dd('0x74'):_0x3b6f6f=as[_0x08dd('0x6c')]('me',null,_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x6e')],_0x3b6f6f['value']['end']);break;}}else{var _0x3b6f6f=as[_0x08dd('0x6c')](_0x2fcf71,_0x57af33['type'],_0x3a2ced);_0x53e03d[_0x1fd3ea](_0x3b6f6f[_0x08dd('0x6d')],_0x3b6f6f['value'][_0x08dd('0x6e')],_0x3b6f6f[_0x08dd('0x63')][_0x08dd('0x21')]);}}}else{var _0x52d6fc=_(_0x1c0422[_0x08dd('0x40')])[_0x08dd('0x41')]()['map'](function(_0x1c8fb8){return _[_0x08dd('0x75')](_0x3fa4a2,[_0x08dd('0x30'),_0x1c8fb8])?_0x1c8fb8:undefined;})[_0x08dd('0x76')]()[_0x08dd('0x63')]();if(!_[_0x08dd('0x77')](_0x52d6fc)){_0x52d6fc['forEach'](function(_0x5d9cff){if(_0x5d9cff===_0x08dd('0x78')){_0x2c2d89['where'](_0x08dd('0x79'),[][_0x08dd('0x7a')](_0x1c0422[_0x08dd('0x40')][_0x5d9cff]));}else if(_0x5d9cff===_0x08dd('0x7b')){var _0x2b6a64=JSON['parse'](_0x1c0422['query'][_0x5d9cff])[_0x08dd('0x7c')];var _0x43f866=JSON[_0x08dd('0x7d')](_0x1c0422['query'][_0x5d9cff])['$lte'];_0x2c2d89[_0x08dd('0x4b')](_0x08dd('0x7e'),_0x2b6a64,_0x43f866);}else{if(_0x1c0422['query'][_0x5d9cff]===_0x08dd('0x7f')){_0x2c2d89[_0x08dd('0x4b')]('i.'+_0x5d9cff+_0x08dd('0x80'));}else{_0x2c2d89[_0x08dd('0x4b')]('i.'+_0x5d9cff+_0x08dd('0x81'),_0x1c0422['query'][_0x5d9cff]);}}});}if(_0x1c0422[_0x08dd('0x40')]['read']){if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x82')]==0x1){_0x2c2d89[_0x08dd('0x83')](_0x08dd('0x84'));}else{_0x2c2d89[_0x08dd('0x83')](_0x08dd('0x85'));}}if(_0x1c0422['query']['tag']){_0x308393=_['isArray'](_0x1c0422[_0x08dd('0x40')][_0x08dd('0x86')])?_0x1c0422[_0x08dd('0x40')][_0x08dd('0x86')]:new Array(_0x1c0422['query'][_0x08dd('0x86')]);_0x308393[_0x08dd('0x36')](function(_0x29434c){_0x1df273['or'](_0x08dd('0x70'),'%,'+_0x29434c+',%');});}if(_0x1c0422[_0x08dd('0x40')][_0x08dd('0x87')]){var _0x46b178=_0x1c0422[_0x08dd('0x40')][_0x08dd('0x87')][_0x08dd('0x88')]('\x5c','\x5c\x5c')[_0x08dd('0x88')](/'/g,'\x27\x27');if(qs[_0x08dd('0x89')](_0x46b178)){_0x53e03d['or'](_0x08dd('0x8a'),_0x46b178+'%')['or'](_0x08dd('0x8b'),_0x46b178+'%');}else{_0x53e03d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x08dd('0x69')](_0x46b178))['or'](_0x08dd('0x8c'),_0x46b178+'%');}}}_0x2c2d89[_0x08dd('0x4b')](_0x53e03d);_0x2c2d89[_0x08dd('0x8d')](_0x08dd('0x8e'));var _0x1b6598={'type':db[_0x08dd('0x8f')]['QueryTypes'][_0x08dd('0x90')],'raw':!![]};var _0x55b5e9=_0x2c2d89[_0x08dd('0x91')]();_0x55b5e9[_0x08dd('0x4e')](_0x08dd('0x8e'));_0x55b5e9[_0x08dd('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4ce803['order']){_0x4ce803[_0x08dd('0x49')][_0x08dd('0x36')](function(_0x213017){var _0xf999f9=_0x213017[0x0]===_0x08dd('0x92')?_0x213017[0x0]:'i.'+_0x213017[0x0];_0x2c2d89[_0x08dd('0x49')](_0xf999f9,_0x213017[0x1]===_0x08dd('0x93')?![]:!![]);});}if(!_[_0x08dd('0x77')](_0x308393)){_0x2c2d89['having'](_0x1df273);_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x94'),_0x308393);}BPromise[_0x08dd('0x95')]()['then'](function(){if(!_0x2c0a90){if(_0x1c0422['query']['SmsAccountId']||_0x1c0422['query'][_0x08dd('0x96')])return;_0x55b5e9['where'](_0x08dd('0x97'));_0x2c2d89['where'](_0x08dd('0x97'));return;}if(_0x1c0422[_0x08dd('0x98')]['role']!==_0x08dd('0x99'))return;return _0x1c0422['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x08dd('0x2e')](function(_0x587dd5){if(_['isEmpty'](_0x587dd5)){_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x9a'));_0x2c2d89['where'](_0x08dd('0x9a'));}else{_0x55b5e9[_0x08dd('0x4b')](_0x08dd('0x79'),_[_0x08dd('0x39')](_0x587dd5,'id'));_0x2c2d89[_0x08dd('0x4b')](_0x08dd('0x79'),_['map'](_0x587dd5,'id'));}});})[_0x08dd('0x2e')](function(){if(_0x1c0422['user'][_0x08dd('0x9b')]==='agent'&&!_0x2c0a90&&!_0x1c0422['query'][_0x08dd('0x78')])return[];return db[_0x08dd('0x9c')][_0x08dd('0x40')](_0x55b5e9[_0x08dd('0x9d')](),_0x1b6598);})[_0x08dd('0x2e')](function(_0x3f8179){_0x51b71f[_0x08dd('0x24')]=_0x3f8179[_0x08dd('0x46')];if(_0x51b71f[_0x08dd('0x24')]===0x0)return[];return db[_0x08dd('0x9c')]['query'](_0x319eea[_0x08dd('0x9d')](),_0x1b6598)['then'](function(_0x42b05e){_0x410a9f=_[_0x08dd('0x9e')](_0x42b05e,'id');_0x1b6598=_['merge'](_0x1b6598,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0422['query'][_0x08dd('0x45')]){_0x4ce803[_0x08dd('0x43')]['forEach'](function(_0x400607){_0x2c2d89[_0x08dd('0x4e')]('i.'+_0x400607);});}else{_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0x9f'),_0x08dd('0x62'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa0'),'Account.key');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa1'),'Account.mandatoryDisposition');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa2'),'contactName');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa3'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa4'),_0x08dd('0xa5'));_0x2c2d89[_0x08dd('0x4e')]('c.lastName',_0x08dd('0xa6'));_0x2c2d89[_0x08dd('0x4e')]('c.email',_0x08dd('0xa7'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa8'),'Contact.phone');_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xa9'),_0x08dd('0xaa'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xab'),_0x08dd('0xac'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xad'),_0x08dd('0xae'));_0x2c2d89[_0x08dd('0x4e')](_0x08dd('0xaf'),_0x08dd('0xb0'));_0x2c2d89[_0x08dd('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4ce803[_0x08dd('0x26')])_0x2c2d89[_0x08dd('0x26')](_0x4ce803[_0x08dd('0x26')]);if(_0x4ce803[_0x08dd('0x25')])_0x2c2d89[_0x08dd('0x25')](_0x4ce803[_0x08dd('0x25')]);return db['sequelize'][_0x08dd('0x40')](_0x2c2d89[_0x08dd('0x9d')](),_0x1b6598);})[_0x08dd('0x2e')](function(_0x5bfceb){_0x1df771[_0x08dd('0x4b')](_0x08dd('0xb1'),_[_0x08dd('0x39')](_0x5bfceb,'id'));return db[_0x08dd('0x9c')][_0x08dd('0x40')](_0x1df771[_0x08dd('0x9d')](),_0x1b6598)[_0x08dd('0x2e')](function(_0x34b35c){var _0x1a76e3=_['groupBy'](_0x34b35c,_0x08dd('0xb2'));var _0x52ac88=[];_0x5bfceb[_0x08dd('0x36')](function(_0x1a8a8a){_0x52ac88[_0x08dd('0x37')](updateSmsInteraction(_0x1a8a8a,_0x410a9f,_0x1a76e3));});return BPromise[_0x08dd('0xb3')](_0x52ac88);});});})[_0x08dd('0x2e')](function(_0x54d86e){_0x51b71f['rows']=_0x54d86e;return _0x51b71f;})[_0x08dd('0x2e')](respondWithFilteredResult(_0x31dae2,_0x4ce803))['catch'](handleError(_0x31dae2,null));};exports[_0x08dd('0xb4')]=function(_0x684b2d,_0x44a784){var _0x2a0f1b={'raw':![],'where':{'id':_0x684b2d[_0x08dd('0xb5')]['id']}},_0x2c6dfa={};_0x2c6dfa[_0x08dd('0x3f')]=_[_0x08dd('0x41')](db[_0x08dd('0x3a')][_0x08dd('0x3b')]);_0x2c6dfa[_0x08dd('0x40')]=_[_0x08dd('0x41')](_0x684b2d[_0x08dd('0x40')]);_0x2c6dfa[_0x08dd('0x42')]=_[_0x08dd('0x44')](_0x2c6dfa['model'],_0x2c6dfa[_0x08dd('0x40')]);_0x2a0f1b[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x2c6dfa[_0x08dd('0x3f')],qs['fields'](_0x684b2d[_0x08dd('0x40')][_0x08dd('0x45')]));_0x2a0f1b[_0x08dd('0x43')]=_0x2a0f1b[_0x08dd('0x43')][_0x08dd('0x46')]?_0x2a0f1b[_0x08dd('0x43')]:_0x2c6dfa['model'];if(_0x684b2d['query'][_0x08dd('0xb6')]){_0x2a0f1b[_0x08dd('0xb7')]=[{'all':!![]}];}_0x2a0f1b=_[_0x08dd('0xb8')]({},_0x2a0f1b,_0x684b2d[_0x08dd('0xb9')]);return db[_0x08dd('0x3a')]['find'](_0x2a0f1b)[_0x08dd('0x2e')](handleEntityNotFound(_0x44a784,null))['then'](respondWithResult(_0x44a784,null))[_0x08dd('0x38')](handleError(_0x44a784,null));};exports[_0x08dd('0xba')]=function(_0x1212d6,_0x5ab7ce){return db[_0x08dd('0x3a')]['create'](_0x1212d6[_0x08dd('0x74')],{})[_0x08dd('0x2e')](respondWithResult(_0x5ab7ce,0xc9))['catch'](handleError(_0x5ab7ce,null));};exports['update']=function(_0x17bc7a,_0x4c1db8){if(_0x17bc7a[_0x08dd('0x74')]['id']){delete _0x17bc7a[_0x08dd('0x74')]['id'];}return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x17bc7a[_0x08dd('0xb5')]['id']}})[_0x08dd('0x2e')](handleEntityNotFound(_0x4c1db8,null))[_0x08dd('0x2e')](saveUpdates(_0x17bc7a[_0x08dd('0x74')],null))[_0x08dd('0x2e')](respondWithResult(_0x4c1db8,null))[_0x08dd('0x38')](handleError(_0x4c1db8,null));};exports[_0x08dd('0x2d')]=function(_0x33d565,_0x1d0de7){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x33d565[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1d0de7,null))[_0x08dd('0x2e')](removeEntity(_0x1d0de7,null))[_0x08dd('0x38')](handleError(_0x1d0de7,null));};exports[_0x08dd('0xbb')]=function(_0x53151b,_0x4e84c1){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x4e84c1,null))['catch'](handleError(_0x4e84c1,null));};exports[_0x08dd('0xbc')]=function(_0x23fae1,_0xee4e16,_0x902d4b){return db[_0x08dd('0xbd')]['find']({'where':{'id':_0x23fae1[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0xee4e16,null))[_0x08dd('0x2e')](function(_0x524bf2){if(_0x524bf2){return _0x524bf2[_0x08dd('0xbc')](_0x23fae1[_0x08dd('0x74')][_0x08dd('0xbe')],_[_0x08dd('0xbf')](_0x23fae1[_0x08dd('0x74')],[_0x08dd('0xbe'),'id'])||{});}})[_0x08dd('0x2e')](respondWithResult(_0xee4e16,null))[_0x08dd('0x38')](handleError(_0xee4e16,null));};exports[_0x08dd('0xc0')]=function(_0xfe5668,_0x5abba0,_0x1f4914){var _0x5ee349={'raw':![],'where':{}};var _0x2468b6={};var _0x39ec12={'count':0x0,'rows':[]};return db[_0x08dd('0x3a')][_0x08dd('0xc1')]({'where':{'id':_0xfe5668[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5abba0,null))[_0x08dd('0x2e')](function(_0x5d2fea){if(_0x5d2fea){_0x2468b6[_0x08dd('0x3f')]=_[_0x08dd('0x41')](db[_0x08dd('0xbd')][_0x08dd('0x3b')]);_0x2468b6[_0x08dd('0x40')]=_['keys'](_0xfe5668[_0x08dd('0x40')]);_0x2468b6[_0x08dd('0x42')]=_[_0x08dd('0x44')](_0x2468b6['model'],_0x2468b6[_0x08dd('0x40')]);_0x5ee349[_0x08dd('0x43')]=_[_0x08dd('0x44')](_0x2468b6['model'],qs[_0x08dd('0x45')](_0xfe5668[_0x08dd('0x40')]['fields']));_0x5ee349[_0x08dd('0x43')]=_0x5ee349['attributes'][_0x08dd('0x46')]?_0x5ee349['attributes']:_0x2468b6[_0x08dd('0x3f')];if(!_0xfe5668[_0x08dd('0x40')][_0x08dd('0x47')](_0x08dd('0x48'))){_0x5ee349['limit']=qs[_0x08dd('0x26')](_0xfe5668[_0x08dd('0x40')][_0x08dd('0x26')]);_0x5ee349[_0x08dd('0x25')]=qs[_0x08dd('0x25')](_0xfe5668['query'][_0x08dd('0x25')]);}_0x5ee349[_0x08dd('0x49')]=qs['sort'](_0xfe5668[_0x08dd('0x40')][_0x08dd('0x4a')]);_0x5ee349[_0x08dd('0x4b')]=qs[_0x08dd('0x42')](_[_0x08dd('0x4c')](_0xfe5668[_0x08dd('0x40')],_0x2468b6[_0x08dd('0x42')]));_0x5ee349[_0x08dd('0x4b')]['SmsInteractionId']=_0x5d2fea['id'];if(_0xfe5668[_0x08dd('0x40')][_0x08dd('0x87')]){_0x5ee349[_0x08dd('0x4b')]=_['merge'](_0x5ee349[_0x08dd('0x4b')],{'$or':_[_0x08dd('0x39')](_0x5ee349[_0x08dd('0x43')],function(_0x2785be){var _0x17066c={};_0x17066c[_0x2785be]={'$like':'%'+_0xfe5668[_0x08dd('0x40')][_0x08dd('0x87')]+'%'};return _0x17066c;})});}if(_0xfe5668[_0x08dd('0x40')]['$gte']){var _0x526873=_0xfe5668[_0x08dd('0x40')][_0x08dd('0x7c')][_0x08dd('0x67')](',');var _0x36b942={};_0x36b942[_0x526873[0x0]]={'$gte':moment(_0x526873[0x1])['format'](_0x08dd('0xc2'))};_0x5ee349[_0x08dd('0x4b')]=_[_0x08dd('0xb8')](_0x5ee349[_0x08dd('0x4b')],_0x36b942);}_0x5ee349=_[_0x08dd('0xb8')]({},_0x5ee349,_0xfe5668['options']);return db[_0x08dd('0xbd')]['count']({'where':_0x5ee349[_0x08dd('0x4b')]})[_0x08dd('0x2e')](function(_0xc1be91){_0x39ec12[_0x08dd('0x24')]=_0xc1be91;if(_0xfe5668[_0x08dd('0x40')][_0x08dd('0xb6')]){_0x5ee349['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5ee349);})[_0x08dd('0x2e')](function(_0x3739f5){_0x39ec12[_0x08dd('0xc3')]=_0x3739f5;return _0x39ec12;});}})[_0x08dd('0x2e')](respondWithFilteredResult(_0x5abba0,_0x5ee349))[_0x08dd('0x38')](handleError(_0x5abba0,null));};exports['addTags']=function(_0x700265,_0x307a45,_0x55dd5c){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x700265[_0x08dd('0xb5')]['id']}})[_0x08dd('0x2e')](handleEntityNotFound(_0x307a45,null))[_0x08dd('0x2e')](function(_0x1a7f38){if(_0x1a7f38){return _0x1a7f38[_0x08dd('0xc4')](_0x700265[_0x08dd('0x74')][_0x08dd('0xbe')],_['omit'](_0x700265['body'],[_0x08dd('0xbe'),'id'])||{})[_0x08dd('0xc5')](function(){return db[_0x08dd('0x6f')][_0x08dd('0xc6')]({'attributes':['id',_0x08dd('0x30'),_0x08dd('0xc7')],'where':{'id':_0x700265[_0x08dd('0x74')][_0x08dd('0xbe')]}});})['then'](function(_0x22969b){socket[_0x08dd('0xc8')](_0x08dd('0xc9'),{'id':Number(_0x700265[_0x08dd('0xb5')]['id']),'tags':_0x22969b||[]});return{'id':Number(_0x700265['params']['id']),'tags':_0x22969b||[]};});}})[_0x08dd('0x2e')](respondWithResult(_0x307a45,null))[_0x08dd('0x38')](handleError(_0x307a45,null));};exports['removeTags']=function(_0x5753ea,_0x13f48b,_0x438eb9){return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x5753ea[_0x08dd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x13f48b,null))[_0x08dd('0x2e')](function(_0x273541){if(_0x273541){return _0x273541[_0x08dd('0xca')](_0x5753ea['query'][_0x08dd('0xbe')]);}})['then'](respondWithStatusCode(_0x13f48b,null))['catch'](handleError(_0x13f48b,null));};exports['download']=function(_0x4c8559,_0x24f128){var _0x17657e=moment()['unix']()['toString']();var _0x15d8c9=path[_0x08dd('0xcb')](config['root'],_0x08dd('0xcc'),_0x08dd('0xcd'),_0x08dd('0xce'));var _0x1e4f5e=path[_0x08dd('0xcb')](config[_0x08dd('0xcf')],'server',_0x08dd('0xcd'),_0x08dd('0xd0'));var _0x427232=path[_0x08dd('0xcb')](_0x15d8c9,_0x17657e);var _0x535c06=util[_0x08dd('0xd1')](_0x08dd('0xd2'),_0x4c8559[_0x08dd('0xb5')]['id'],_0x17657e);var _0x5bc680=path[_0x08dd('0xcb')](_0x15d8c9,_0x535c06);var _0x508d6b=[];_0x508d6b[_0x08dd('0x37')]({'model':db['User'],'as':_0x08dd('0x71'),'attributes':['id',_0x08dd('0x33')],'raw':!![]});_0x508d6b[_0x08dd('0x37')]({'model':db['CmContact'],'as':_0x08dd('0x66'),'attributes':['id','firstName',_0x08dd('0xd3')],'raw':!![]});var _0x20bb8e=[{'model':db['SmsMessage'],'as':_0x08dd('0xd4'),'attributes':['id',_0x08dd('0x74'),_0x08dd('0x7b'),_0x08dd('0xd5'),_0x08dd('0xd6'),_0x08dd('0x82')],'include':_0x508d6b}];_0x20bb8e[_0x08dd('0x37')]({'model':db['SmsAccount'],'as':_0x08dd('0xd7'),'attributes':['id','name']});_0x20bb8e['push']({'model':db[_0x08dd('0x71')],'as':'Owner','attributes':['id',_0x08dd('0x33')]});return db[_0x08dd('0x3a')][_0x08dd('0x61')]({'where':{'id':_0x4c8559['params']['id']},'include':_0x20bb8e})[_0x08dd('0x2e')](handleEntityNotFound(_0x24f128,null))['then'](function(_0x36ad27){if(_0x36ad27){var _0x207a54=_0x36ad27[_0x08dd('0xd8')]({'plain':!![]});fs[_0x08dd('0xd9')](_0x427232);var _0x4fdf8b={'format':'A4','border':_0x08dd('0xda'),'header':{'height':_0x08dd('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x08dd('0xdc'),'contents':{'default':util['format'](_0x08dd('0xdd'),util['format'](_0x08dd('0xde'),'Sms',_0x207a54['id']),moment()['format'](_0x08dd('0xdf'))[_0x08dd('0x9d')]())}}};var _0x4b3522={'channel':_0x08dd('0xe0'),'account':_0x207a54[_0x08dd('0xd7')][_0x08dd('0x30')],'agent':_0x207a54[_0x08dd('0xe1')]?_0x207a54[_0x08dd('0xe1')]['fullname']:'N.A.','createdAt':moment(_0x207a54[_0x08dd('0x7b')])[_0x08dd('0xd1')](_0x08dd('0xc2'))[_0x08dd('0x9d')](),'closedAt':_0x207a54['closed']?moment(_0x207a54['closedAt'])[_0x08dd('0xd1')](_0x08dd('0xc2'))[_0x08dd('0x9d')]():'','disposition':_0x207a54[_0x08dd('0xe2')],'messages':_(_0x207a54[_0x08dd('0xd4')])[_0x08dd('0x87')]({'secret':![]})[_0x08dd('0x39')](function(_0x57378d){return{'date':moment(_0x57378d[_0x08dd('0x7b')])['format'](_0x08dd('0xc2'))[_0x08dd('0x9d')](),'sender':_0x57378d[_0x08dd('0xd5')]===_0x08dd('0xe3')?_0x57378d[_0x08dd('0x71')]?_0x57378d['User'][_0x08dd('0x33')]:_0x08dd('0xe4'):_0x57378d[_0x08dd('0x66')][_0x08dd('0xe5')]+(_0x57378d[_0x08dd('0x66')][_0x08dd('0xd3')]?'\x20'+_0x57378d[_0x08dd('0x66')]['lastName']:''),'body':_0x57378d[_0x08dd('0x74')],'direction':_0x57378d['direction']===_0x08dd('0xe3')?'A':'C','secret':_0x57378d[_0x08dd('0xd6')],'read':_0x57378d[_0x08dd('0x82')]};})['value']()};return ejs['renderFile'](path[_0x08dd('0xcb')](config[_0x08dd('0xcf')],_0x08dd('0xcc'),_0x08dd('0xe6'),_0x08dd('0xe7')),{'interaction':_0x4b3522})['then'](function(_0x120fba){return new BPromise(function(_0x25a65b,_0x46862e){pdf[_0x08dd('0xba')](_0x120fba,_0x4fdf8b)['toFile'](path[_0x08dd('0xcb')](_0x427232,_0x08dd('0xe8')+_0x207a54['id']+'-'+_0x17657e+_0x08dd('0xe9')),function(_0x44d778,_0x3d52f1){if(_0x44d778)return _0x46862e(_0x44d778);_0x25a65b(_0x3d52f1);});});})[_0x08dd('0x2e')](function(){return new BPromise(function(_0x55144b,_0x3b7f1c){zipdir(_0x427232,{'saveTo':_0x5bc680},function(_0x437142,_0x19a4de){if(_0x437142)return _0x3b7f1c(_0x437142);return _0x55144b(_0x19a4de);});})[_0x08dd('0x2e')](function(){return new BPromise(function(_0x27c1d3,_0x1cbfa5){rimraf(_0x427232,function(_0x34d2d7){if(_0x34d2d7)_0x1cbfa5(_0x34d2d7);return _0x27c1d3();});});})['then'](function(){return _0x24f128[_0x08dd('0xea')](_0x5bc680,_0x535c06,function(_0xc8085d){if(_0xc8085d){console['log'](_0x08dd('0xeb'),_0xc8085d);}else{fs[_0x08dd('0xec')](_0x5bc680);}});});});}else{return _0x24f128['sendStatus'](0xc8);}})['catch'](handleError(_0x24f128,null));}; \ No newline at end of file +var _0x7548=['isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','a.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','omit','ids','getMessages','findOne','rawAttributes','pick','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','lastName','direction','SmsAccount','Account','get','mkdirSync','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','Sms','Owner','N.A.','closedAt','disposition','Messages','out','System','Contact','firstName','secret','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','SmsInteraction','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','$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','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0x7548,0x15c));var _0x8754=function(_0x5e4d39,_0x4bc6a3){_0x5e4d39=_0x5e4d39-0x0;var _0x57657f=_0x7548[_0x5e4d39];return _0x57657f;};'use strict';var pdf=require(_0x8754('0x0'));var emlformat=require(_0x8754('0x1'));var rimraf=require(_0x8754('0x2'));var zipdir=require(_0x8754('0x3'));var jsonpatch=require(_0x8754('0x4'));var rp=require(_0x8754('0x5'));var moment=require(_0x8754('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8754('0x7'));var path=require(_0x8754('0x8'));var sox=require(_0x8754('0x9'));var csv=require(_0x8754('0xa'));var ejs=require(_0x8754('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8754('0xc'));var crypto=require(_0x8754('0xd'));var jsforce=require(_0x8754('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8754('0xf'));var Redis=require(_0x8754('0x10'));var authService=require(_0x8754('0x11'));var qs=require(_0x8754('0x12'));var as=require(_0x8754('0x13'));var hardwareService=require(_0x8754('0x14'));var logger=require(_0x8754('0x15'))(_0x8754('0x16'));var utils=require(_0x8754('0x17'));var config=require(_0x8754('0x18'));var licenseUtil=require(_0x8754('0x19'));var db=require(_0x8754('0x1a'))['db'];config[_0x8754('0x1b')]=_[_0x8754('0x1c')](config[_0x8754('0x1b')],{'host':_0x8754('0x1d'),'port':0x18eb});var socket=require(_0x8754('0x1e'))(new Redis(config['redis']));require(_0x8754('0x1f'))[_0x8754('0x20')](socket);function respondWithStatusCode(_0x5b53ea,_0xf31c29){_0xf31c29=_0xf31c29||0xcc;return function(_0xabaacd){if(_0xabaacd){return _0x5b53ea[_0x8754('0x21')](_0xf31c29);}return _0x5b53ea['status'](_0xf31c29)[_0x8754('0x22')]();};}function respondWithResult(_0x424c2e,_0x1b7372){_0x1b7372=_0x1b7372||0xc8;return function(_0x11943a){if(_0x11943a){return _0x424c2e[_0x8754('0x23')](_0x1b7372)[_0x8754('0x24')](_0x11943a);}};}function respondWithFilteredResult(_0x3644e5,_0x418f0a){return function(_0x41fcde){if(_0x41fcde){var _0x3c04f7=_0x41fcde['count'],_0xe0fa60=_0x418f0a[_0x8754('0x25')],_0x500391=_0x418f0a[_0x8754('0x25')]+_0x418f0a[_0x8754('0x26')],_0x55612b;if(_0x500391>=_0x3c04f7){_0x500391=_0x3c04f7;_0x55612b=0xc8;}else{_0x55612b=0xce;}_0x3644e5[_0x8754('0x23')](_0x55612b);return _0x3644e5[_0x8754('0x27')](_0x8754('0x28'),_0xe0fa60+'-'+_0x500391+'/'+_0x3c04f7)['json'](_0x41fcde);}return null;};}function patchUpdates(_0x37b8fc){return function(_0x5335c1){try{jsonpatch[_0x8754('0x29')](_0x5335c1,_0x37b8fc,!![]);}catch(_0x4e9f41){return BPromise[_0x8754('0x2a')](_0x4e9f41);}return _0x5335c1['save']();};}function saveUpdates(_0x2e07cd,_0x2dbbab){return function(_0x9a7cf8){if(_0x9a7cf8){return _0x9a7cf8[_0x8754('0x2b')](_0x2e07cd)[_0x8754('0x2c')](function(_0x347d9c){return _0x347d9c;});}return null;};}function removeEntity(_0x2bfbd6,_0x253812){return function(_0x1c31ea){if(_0x1c31ea){return _0x1c31ea[_0x8754('0x2d')]()[_0x8754('0x2c')](function(){_0x2bfbd6[_0x8754('0x23')](0xcc)[_0x8754('0x22')]();});}};}function handleEntityNotFound(_0x4882af,_0x3b04b1){return function(_0x38d80c){if(!_0x38d80c){_0x4882af['sendStatus'](0x194);}return _0x38d80c;};}function handleError(_0x2def92,_0x304e16){_0x304e16=_0x304e16||0x1f4;return function(_0x261468){logger[_0x8754('0x2e')](_0x261468[_0x8754('0x2f')]);if(_0x261468[_0x8754('0x30')]){delete _0x261468[_0x8754('0x30')];}_0x2def92[_0x8754('0x23')](_0x304e16)[_0x8754('0x31')](_0x261468);};}function getInteractionUsers(_0x358924,_0x17b684){return new BPromise(function(_0x4a6514,_0xf2f3fb){try{if(_0x17b684[_0x358924['id']]){_0x358924[_0x8754('0x32')]=_[_0x8754('0x33')](_0x17b684[_0x358924['id']],function(_0x4ec781){return{'id':_0x4ec781['id'],'fullname':_0x4ec781[_0x8754('0x34')]};});}}catch(_0x483c80){_0xf2f3fb(_0x483c80);}_0x4a6514(_0x358924);});}function getInteractionTags(_0x37d379,_0x3cf18f){return new BPromise(function(_0x40f0f8,_0x44ecbc){try{if(_0x37d379['TagIds']){_0x37d379['Tags']=[];_0x37d379[_0x8754('0x35')][_0x8754('0x36')](',')[_0x8754('0x37')](function(_0x31f50f){_0x37d379[_0x8754('0x38')][_0x8754('0x39')](_0x3cf18f[_0x31f50f]);});}delete _0x37d379[_0x8754('0x35')];}catch(_0x439991){_0x44ecbc(_0x439991);}_0x40f0f8(_0x37d379);});}function updateSmsInteraction(_0x5840e4,_0x34970a,_0x5e9c1f){return new BPromise(function(_0x48f9e6,_0xe1afc4){return getInteractionUsers(_0x5840e4,_0x5e9c1f)[_0x8754('0x2c')](function(_0x29d1c7){return getInteractionTags(_0x29d1c7,_0x34970a);})[_0x8754('0x2c')](function(_0x397186){_0x48f9e6(_0x397186);})['catch'](function(_0x369046){_0xe1afc4(_0x369046);});});}exports['index']=function(_0x3bab81,_0x414bef){var _0x3846be={},_0x1a6244={},_0x4be467={'count':0x0,'rows':[]};var _0x53105f=_[_0x8754('0x33')](db[_0x8754('0x3a')]['rawAttributes'],function(_0x1e112e){return{'name':_0x1e112e[_0x8754('0x3b')],'type':_0x1e112e[_0x8754('0x3c')]['key']};});_0x1a6244[_0x8754('0x3d')]=_[_0x8754('0x33')](_0x53105f,_0x8754('0x30'));_0x1a6244[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x3bab81[_0x8754('0x3e')]);_0x1a6244['filters']=_[_0x8754('0x40')](_0x1a6244[_0x8754('0x3d')],_0x1a6244[_0x8754('0x3e')]);_0x3846be[_0x8754('0x41')]=_[_0x8754('0x40')](_0x1a6244[_0x8754('0x3d')],qs['fields'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x42')]));_0x3846be[_0x8754('0x41')]=_0x3846be[_0x8754('0x41')][_0x8754('0x43')]?_0x3846be[_0x8754('0x41')]:_0x1a6244[_0x8754('0x3d')];if(!_0x3bab81[_0x8754('0x3e')][_0x8754('0x44')](_0x8754('0x45'))){_0x3846be[_0x8754('0x26')]=qs[_0x8754('0x26')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x26')]);_0x3846be['offset']=qs[_0x8754('0x25')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x25')]);}_0x3846be[_0x8754('0x46')]=qs['sort'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x47')]);_0x3846be['where']=qs['filters'](_['pick'](_0x3bab81[_0x8754('0x3e')],_0x1a6244[_0x8754('0x48')]),_0x53105f);var _0x58ea77=[];var _0x286ac5=squel['select']()[_0x8754('0x49')]('id')[_0x8754('0x49')]('name')['field'](_0x8754('0x4a'))[_0x8754('0x4b')](_0x8754('0x4c'));var _0x5beb3d=squel['select']()[_0x8754('0x49')](_0x8754('0x4d'))[_0x8754('0x49')](_0x8754('0x4e'))[_0x8754('0x49')](_0x8754('0x4f'))[_0x8754('0x4b')](_0x8754('0x50'),'ui')[_0x8754('0x51')](_0x8754('0x52'),'u',_0x8754('0x53'));var _0x54918c=squel[_0x8754('0x54')]()[_0x8754('0x4b')](_0x8754('0x55'),'i')[_0x8754('0x51')](_0x8754('0x56'),'c',_0x8754('0x57'))[_0x8754('0x51')](_0x8754('0x52'),'o',_0x8754('0x58'))['left_join']('sms_accounts','a',_0x8754('0x59'))['left_join'](_0x8754('0x5a'),'me',_0x8754('0x5b'))[_0x8754('0x51')](_0x8754('0x5c'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x8754('0x51')](_0x8754('0x4c'),'t',_0x8754('0x5d'));var _0x36ab9f=squel[_0x8754('0x5e')]();var _0x18b9fa=[];var _0x5e12b3=squel[_0x8754('0x5e')]();var _0x3dfb96;if(_0x3bab81['query']['search']){_0x3dfb96=as['parseSearch'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x5f')]);var _0x1477ff=_0x3dfb96['sqlOperator'];for(var _0x7a2189=0x0;_0x7a2189<_0x3dfb96['conditions'][_0x8754('0x43')];_0x7a2189++){var _0x1f2494=_0x3dfb96[_0x8754('0x60')][_0x7a2189];var _0x29d725='i';var _0x2f4e55=_[_0x8754('0x61')](_0x53105f,[_0x8754('0x30'),_0x1f2494[_0x8754('0x49')]]);if(!_0x2f4e55){switch(_0x1f2494[_0x8754('0x49')]){case'unreadMessages':if(_0x1f2494[_0x8754('0x62')]==0x1){_0x54918c[_0x8754('0x63')]('`'+_0x1f2494[_0x8754('0x49')]+_0x8754('0x64'));}else{_0x54918c[_0x8754('0x63')]('`'+_0x1f2494[_0x8754('0x49')]+_0x8754('0x65'));}break;case'Contact':if(_0x1f2494[_0x8754('0x66')]===_0x8754('0x67')){if(_0x1f2494[_0x8754('0x62')][_0x8754('0x36')]('\x20')[_0x8754('0x43')]>0x1){_0x36ab9f[_0x1477ff](_0x8754('0x68'),qs[_0x8754('0x69')](_0x1f2494[_0x8754('0x62')]),null);}else{var _0x59d105='%'+_0x1f2494[_0x8754('0x62')]+'%';_0x36ab9f[_0x1477ff]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x59d105,_0x59d105,_0x59d105);}}else{_0x2f4e55=_[_0x8754('0x61')](_0x53105f,[_0x8754('0x30'),_0x8754('0x6a')]);_0x1f2494[_0x8754('0x49')]=_0x8754('0x6a');_0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55['type'],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db['text'],_0x4be4db['value']['start'],_0x4be4db[_0x8754('0x62')][_0x8754('0x22')]);}break;case _0x8754('0x6c'):var _0x5f3fe4=_0x1f2494[_0x8754('0x62')][_0x8754('0x36')](',')[_0x8754('0x33')](function(_0x248fe4){return Number(_0x248fe4);});_0x5f3fe4[_0x8754('0x37')](function(_0x26e026){_0x5e12b3['or'](_0x8754('0x6d'),'%,'+_0x26e026+',%');});_0x18b9fa=_[_0x8754('0x6e')](_0x18b9fa,_0x5f3fe4);break;case _0x8754('0x6f'):if(_0x1f2494['operator']===_0x8754('0x67')){_0x36ab9f[_0x1477ff](_0x8754('0x70'),'%'+_0x1f2494[_0x8754('0x62')]+'%',null);}else{_0x2f4e55=_[_0x8754('0x61')](_0x53105f,['name',_0x8754('0x71')]);_0x1f2494[_0x8754('0x49')]=_0x8754('0x71');_0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55['type'],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')][_0x8754('0x73')],_0x4be4db['value']['end']);}break;case _0x8754('0x74'):_0x4be4db=as[_0x8754('0x6b')]('me',null,_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')][_0x8754('0x73')],_0x4be4db['value'][_0x8754('0x22')]);break;}}else{var _0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55[_0x8754('0x3c')],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')]['start'],_0x4be4db['value'][_0x8754('0x22')]);}}}else{var _0x44ac1c=_(_0x3bab81[_0x8754('0x3e')])[_0x8754('0x3f')]()[_0x8754('0x33')](function(_0x317707){return _[_0x8754('0x75')](_0x53105f,[_0x8754('0x30'),_0x317707])?_0x317707:undefined;})[_0x8754('0x76')]()[_0x8754('0x62')]();if(!_[_0x8754('0x77')](_0x44ac1c)){_0x44ac1c[_0x8754('0x37')](function(_0x36774c){if(_0x36774c===_0x8754('0x78')){_0x54918c['where'](_0x8754('0x79'),[][_0x8754('0x7a')](_0x3bab81['query'][_0x36774c]));}else if(_0x36774c===_0x8754('0x7b')){var _0x3550d2=JSON[_0x8754('0x7c')](_0x3bab81[_0x8754('0x3e')][_0x36774c])[_0x8754('0x7d')];var _0x122669=JSON['parse'](_0x3bab81[_0x8754('0x3e')][_0x36774c])[_0x8754('0x7e')];_0x54918c['where'](_0x8754('0x7f'),_0x3550d2,_0x122669);}else{if(_0x3bab81[_0x8754('0x3e')][_0x36774c]===_0x8754('0x80')){_0x54918c[_0x8754('0x81')]('i.'+_0x36774c+'\x20IS\x20NULL');}else{_0x54918c['where']('i.'+_0x36774c+'\x20=\x20?',_0x3bab81[_0x8754('0x3e')][_0x36774c]);}}});}if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x82')]){if(_0x3bab81['query']['read']==0x1){_0x54918c['having'](_0x8754('0x83'));}else{_0x54918c[_0x8754('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x3bab81[_0x8754('0x3e')]['tag']){_0x18b9fa=_[_0x8754('0x84')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x85')])?_0x3bab81[_0x8754('0x3e')]['tag']:new Array(_0x3bab81['query'][_0x8754('0x85')]);_0x18b9fa[_0x8754('0x37')](function(_0x2513fe){_0x5e12b3['or'](_0x8754('0x6d'),'%,'+_0x2513fe+',%');});}if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x86')]){var _0x28e5f5=_0x3bab81[_0x8754('0x3e')]['filter'][_0x8754('0x87')]('\x5c','\x5c\x5c')[_0x8754('0x87')](/'/g,'\x27\x27');if(qs[_0x8754('0x88')](_0x28e5f5)){_0x36ab9f['or']('i.id\x20LIKE\x20?',_0x28e5f5+'%')['or']('i.phone\x20LIKE\x20?',_0x28e5f5+'%');}else{_0x36ab9f['or'](_0x8754('0x89'),qs[_0x8754('0x69')](_0x28e5f5))['or'](_0x8754('0x8a'),_0x28e5f5+'%');}}}_0x54918c['where'](_0x36ab9f);_0x54918c[_0x8754('0x8b')](_0x8754('0x8c'));var _0x33a881={'type':db[_0x8754('0x8d')][_0x8754('0x8e')][_0x8754('0x8f')],'raw':!![]};var _0x431772=_0x54918c['clone']();_0x431772['field'](_0x8754('0x8c'));_0x431772[_0x8754('0x49')](_0x8754('0x90'),_0x8754('0x91'));if(_0x3846be[_0x8754('0x46')]){_0x3846be[_0x8754('0x46')][_0x8754('0x37')](function(_0x92fdb8){var _0x2e4ce4=_0x92fdb8[0x0]===_0x8754('0x92')?_0x92fdb8[0x0]:'i.'+_0x92fdb8[0x0];_0x54918c[_0x8754('0x46')](_0x2e4ce4,_0x92fdb8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8754('0x77')](_0x18b9fa)){_0x54918c[_0x8754('0x63')](_0x5e12b3);_0x431772[_0x8754('0x81')](_0x8754('0x93'),_0x18b9fa);}BPromise[_0x8754('0x94')]()[_0x8754('0x2c')](function(){if(!_0x3dfb96){if(_0x3bab81['query'][_0x8754('0x78')]||_0x3bab81[_0x8754('0x3e')][_0x8754('0x95')])return;_0x431772[_0x8754('0x81')](_0x8754('0x96'));_0x54918c['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3bab81[_0x8754('0x97')]['role']!==_0x8754('0x98'))return;return _0x3bab81[_0x8754('0x97')][_0x8754('0x99')]({'attributes':['id'],'raw':!![]})[_0x8754('0x2c')](function(_0x3e89fa){if(_[_0x8754('0x77')](_0x3e89fa)){_0x431772[_0x8754('0x81')](_0x8754('0x9a'));_0x54918c['where'](_0x8754('0x9a'));}else{_0x431772[_0x8754('0x81')]('i.SmsAccountId\x20IN\x20?',_[_0x8754('0x33')](_0x3e89fa,'id'));_0x54918c[_0x8754('0x81')](_0x8754('0x79'),_['map'](_0x3e89fa,'id'));}});})[_0x8754('0x2c')](function(){if(_0x3bab81[_0x8754('0x97')][_0x8754('0x9b')]==='agent'&&!_0x3dfb96&&!_0x3bab81[_0x8754('0x3e')][_0x8754('0x78')])return[];return db[_0x8754('0x9c')][_0x8754('0x3e')](_0x431772[_0x8754('0x9d')](),_0x33a881);})[_0x8754('0x2c')](function(_0x3d630f){_0x4be467[_0x8754('0x9e')]=_0x3d630f['length'];if(_0x4be467['count']===0x0)return[];return db[_0x8754('0x9c')][_0x8754('0x3e')](_0x286ac5['toString'](),_0x33a881)[_0x8754('0x2c')](function(_0x4191ee){_0x58ea77=_[_0x8754('0x9f')](_0x4191ee,'id');_0x33a881=_['merge'](_0x33a881,{'model':db[_0x8754('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x42')]){_0x3846be[_0x8754('0x41')][_0x8754('0x37')](function(_0x3371d0){_0x54918c[_0x8754('0x49')]('i.'+_0x3371d0);});}else{_0x54918c[_0x8754('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8754('0x91'));_0x54918c[_0x8754('0x49')](_0x8754('0xa0'),'Account.key');_0x54918c[_0x8754('0x49')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x54918c['field'](_0x8754('0xa1'),_0x8754('0x92'));_0x54918c[_0x8754('0x49')](_0x8754('0xa2'));_0x54918c['field'](_0x8754('0xa3'),_0x8754('0xa4'));_0x54918c[_0x8754('0x49')](_0x8754('0xa5'),'Contact.lastName');_0x54918c[_0x8754('0x49')]('c.email',_0x8754('0xa6'));_0x54918c[_0x8754('0x49')](_0x8754('0xa7'),_0x8754('0xa8'));_0x54918c[_0x8754('0x49')](_0x8754('0xa9'),_0x8754('0xaa'));_0x54918c[_0x8754('0x49')](_0x8754('0xab'),'Contact.fax');_0x54918c[_0x8754('0x49')](_0x8754('0xac'),_0x8754('0xad'));_0x54918c[_0x8754('0x49')](_0x8754('0xae'),'Owner.internal');_0x54918c[_0x8754('0x49')](_0x8754('0xaf'),_0x8754('0x35'));}if(_0x3846be[_0x8754('0x26')])_0x54918c[_0x8754('0x26')](_0x3846be[_0x8754('0x26')]);if(_0x3846be[_0x8754('0x25')])_0x54918c[_0x8754('0x25')](_0x3846be[_0x8754('0x25')]);return db['sequelize'][_0x8754('0x3e')](_0x54918c[_0x8754('0x9d')](),_0x33a881);})['then'](function(_0x131d4e){_0x5beb3d[_0x8754('0x81')](_0x8754('0xb0'),_[_0x8754('0x33')](_0x131d4e,'id'));return db['sequelize']['query'](_0x5beb3d['toString'](),_0x33a881)[_0x8754('0x2c')](function(_0x1ba26a){var _0x38e506=_['groupBy'](_0x1ba26a,_0x8754('0xb1'));var _0x4deaa8=[];_0x131d4e['forEach'](function(_0x2ca289){_0x4deaa8[_0x8754('0x39')](updateSmsInteraction(_0x2ca289,_0x58ea77,_0x38e506));});return BPromise[_0x8754('0xb2')](_0x4deaa8);});});})['then'](function(_0x97c446){_0x4be467[_0x8754('0xb3')]=_0x97c446;return _0x4be467;})[_0x8754('0x2c')](respondWithFilteredResult(_0x414bef,_0x3846be))[_0x8754('0xb4')](handleError(_0x414bef,null));};exports[_0x8754('0xb5')]=function(_0x347cda,_0x585d9d){var _0x421302={'raw':![],'where':{'id':_0x347cda[_0x8754('0xb6')]['id']}},_0x1c1973={};_0x1c1973['model']=_[_0x8754('0x3f')](db[_0x8754('0x3a')]['rawAttributes']);_0x1c1973[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x347cda['query']);_0x1c1973['filters']=_['intersection'](_0x1c1973['model'],_0x1c1973[_0x8754('0x3e')]);_0x421302[_0x8754('0x41')]=_[_0x8754('0x40')](_0x1c1973['model'],qs['fields'](_0x347cda[_0x8754('0x3e')][_0x8754('0x42')]));_0x421302[_0x8754('0x41')]=_0x421302['attributes'][_0x8754('0x43')]?_0x421302[_0x8754('0x41')]:_0x1c1973['model'];if(_0x347cda[_0x8754('0x3e')][_0x8754('0xb7')]){_0x421302[_0x8754('0xb8')]=[{'all':!![]}];}_0x421302=_[_0x8754('0xb9')]({},_0x421302,_0x347cda[_0x8754('0xba')]);return db[_0x8754('0x3a')][_0x8754('0x61')](_0x421302)[_0x8754('0x2c')](handleEntityNotFound(_0x585d9d,null))[_0x8754('0x2c')](respondWithResult(_0x585d9d,null))['catch'](handleError(_0x585d9d,null));};exports['create']=function(_0x2684c7,_0x1217b0){return db[_0x8754('0x3a')][_0x8754('0xbb')](_0x2684c7['body'],{})[_0x8754('0x2c')](respondWithResult(_0x1217b0,0xc9))[_0x8754('0xb4')](handleError(_0x1217b0,null));};exports[_0x8754('0x2b')]=function(_0x513ba3,_0x131ebe){if(_0x513ba3[_0x8754('0x74')]['id']){delete _0x513ba3[_0x8754('0x74')]['id'];}return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x513ba3['params']['id']}})['then'](handleEntityNotFound(_0x131ebe,null))['then'](saveUpdates(_0x513ba3[_0x8754('0x74')],null))[_0x8754('0x2c')](respondWithResult(_0x131ebe,null))['catch'](handleError(_0x131ebe,null));};exports['destroy']=function(_0x2e5969,_0x2a9dc2){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x2e5969[_0x8754('0xb6')]['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0x2a9dc2,null))[_0x8754('0x2c')](removeEntity(_0x2a9dc2,null))['catch'](handleError(_0x2a9dc2,null));};exports[_0x8754('0xbc')]=function(_0x2d3b82,_0x5384f0){return db[_0x8754('0x3a')][_0x8754('0xbc')]()[_0x8754('0x2c')](respondWithResult(_0x5384f0,null))[_0x8754('0xb4')](handleError(_0x5384f0,null));};exports[_0x8754('0xbd')]=function(_0x44ac3a,_0x54749d,_0x5b25f6){return db['SmsMessage'][_0x8754('0x61')]({'where':{'id':_0x44ac3a[_0x8754('0xb6')]['id']}})['then'](handleEntityNotFound(_0x54749d,null))['then'](function(_0x51b2b0){if(_0x51b2b0){return _0x51b2b0[_0x8754('0xbd')](_0x44ac3a[_0x8754('0x74')]['ids'],_[_0x8754('0xbe')](_0x44ac3a[_0x8754('0x74')],[_0x8754('0xbf'),'id'])||{});}})[_0x8754('0x2c')](respondWithResult(_0x54749d,null))[_0x8754('0xb4')](handleError(_0x54749d,null));};exports[_0x8754('0xc0')]=function(_0x498b4b,_0x287032,_0x120398){var _0x2e44ce={'raw':![],'where':{}};var _0x2cd453={};var _0x4a3c99={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8754('0xc1')]({'where':{'id':_0x498b4b[_0x8754('0xb6')]['id']}})['then'](handleEntityNotFound(_0x287032,null))[_0x8754('0x2c')](function(_0x42ad00){if(_0x42ad00){_0x2cd453[_0x8754('0x3d')]=_[_0x8754('0x3f')](db['SmsMessage'][_0x8754('0xc2')]);_0x2cd453[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x498b4b[_0x8754('0x3e')]);_0x2cd453[_0x8754('0x48')]=_[_0x8754('0x40')](_0x2cd453[_0x8754('0x3d')],_0x2cd453[_0x8754('0x3e')]);_0x2e44ce[_0x8754('0x41')]=_[_0x8754('0x40')](_0x2cd453[_0x8754('0x3d')],qs[_0x8754('0x42')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x42')]));_0x2e44ce[_0x8754('0x41')]=_0x2e44ce[_0x8754('0x41')][_0x8754('0x43')]?_0x2e44ce[_0x8754('0x41')]:_0x2cd453['model'];if(!_0x498b4b[_0x8754('0x3e')]['hasOwnProperty'](_0x8754('0x45'))){_0x2e44ce[_0x8754('0x26')]=qs[_0x8754('0x26')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x26')]);_0x2e44ce[_0x8754('0x25')]=qs[_0x8754('0x25')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x25')]);}_0x2e44ce[_0x8754('0x46')]=qs[_0x8754('0x47')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x47')]);_0x2e44ce[_0x8754('0x81')]=qs[_0x8754('0x48')](_[_0x8754('0xc3')](_0x498b4b[_0x8754('0x3e')],_0x2cd453[_0x8754('0x48')]));_0x2e44ce['where'][_0x8754('0xb1')]=_0x42ad00['id'];if(_0x498b4b[_0x8754('0x3e')][_0x8754('0x86')]){_0x2e44ce[_0x8754('0x81')]=_[_0x8754('0xb9')](_0x2e44ce[_0x8754('0x81')],{'$or':_[_0x8754('0x33')](_0x2e44ce[_0x8754('0x41')],function(_0x4ad979){var _0x37da25={};_0x37da25[_0x4ad979]={'$like':'%'+_0x498b4b[_0x8754('0x3e')][_0x8754('0x86')]+'%'};return _0x37da25;})});}if(_0x498b4b[_0x8754('0x3e')]['$gte']){var _0x470f0a=_0x498b4b['query'][_0x8754('0x7d')][_0x8754('0x36')](',');var _0x29b9f3={};_0x29b9f3[_0x470f0a[0x0]]={'$gte':moment(_0x470f0a[0x1])[_0x8754('0xc4')](_0x8754('0xc5'))};_0x2e44ce['where']=_['merge'](_0x2e44ce['where'],_0x29b9f3);}_0x2e44ce=_[_0x8754('0xb9')]({},_0x2e44ce,_0x498b4b[_0x8754('0xba')]);return db[_0x8754('0xc6')][_0x8754('0x9e')]({'where':_0x2e44ce[_0x8754('0x81')]})[_0x8754('0x2c')](function(_0x20a892){_0x4a3c99[_0x8754('0x9e')]=_0x20a892;if(_0x498b4b[_0x8754('0x3e')][_0x8754('0xb7')]){_0x2e44ce[_0x8754('0xb8')]=[{'all':!![]}];}return db[_0x8754('0xc6')][_0x8754('0xc7')](_0x2e44ce);})[_0x8754('0x2c')](function(_0x538ba2){_0x4a3c99[_0x8754('0xb3')]=_0x538ba2;return _0x4a3c99;});}})[_0x8754('0x2c')](respondWithFilteredResult(_0x287032,_0x2e44ce))[_0x8754('0xb4')](handleError(_0x287032,null));};exports[_0x8754('0xc8')]=function(_0x3e2b1f,_0xc76574,_0xd7610d){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x3e2b1f['params']['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0xc76574,null))[_0x8754('0x2c')](function(_0xf96dbc){if(_0xf96dbc){return _0xf96dbc[_0x8754('0xc9')](_0x3e2b1f[_0x8754('0x74')][_0x8754('0xbf')],_[_0x8754('0xbe')](_0x3e2b1f[_0x8754('0x74')],[_0x8754('0xbf'),'id'])||{})[_0x8754('0xca')](function(){return db[_0x8754('0x6c')][_0x8754('0xc7')]({'attributes':['id',_0x8754('0x30'),_0x8754('0x4a')],'where':{'id':_0x3e2b1f['body'][_0x8754('0xbf')]}});})['then'](function(_0x475ace){socket[_0x8754('0xcb')](_0x8754('0xcc'),{'id':Number(_0x3e2b1f[_0x8754('0xb6')]['id']),'tags':_0x475ace||[]});return{'id':Number(_0x3e2b1f[_0x8754('0xb6')]['id']),'tags':_0x475ace||[]};});}})['then'](respondWithResult(_0xc76574,null))['catch'](handleError(_0xc76574,null));};exports[_0x8754('0xcd')]=function(_0x4de373,_0x5b8e40,_0x20b4d0){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x4de373[_0x8754('0xb6')]['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0x5b8e40,null))[_0x8754('0x2c')](function(_0x15c5fb){if(_0x15c5fb){return _0x15c5fb[_0x8754('0xcd')](_0x4de373[_0x8754('0x3e')][_0x8754('0xbf')]);}})[_0x8754('0x2c')](respondWithStatusCode(_0x5b8e40,null))[_0x8754('0xb4')](handleError(_0x5b8e40,null));};exports[_0x8754('0xce')]=function(_0x349026,_0x5cda63){var _0x1c8cce=moment()[_0x8754('0xcf')]()[_0x8754('0x9d')]();var _0x15fbbb=path[_0x8754('0xd0')](config[_0x8754('0xd1')],_0x8754('0xd2'),_0x8754('0xd3'),'tmp');var _0x27dd07=path[_0x8754('0xd0')](config['root'],'server','files','attachments');var _0x414316=path[_0x8754('0xd0')](_0x15fbbb,_0x1c8cce);var _0xe0f440=util['format'](_0x8754('0xd4'),_0x349026[_0x8754('0xb6')]['id'],_0x1c8cce);var _0x5312f9=path[_0x8754('0xd0')](_0x15fbbb,_0xe0f440);var _0x3e49f7=[];_0x3e49f7[_0x8754('0x39')]({'model':db[_0x8754('0x6f')],'as':_0x8754('0x6f'),'attributes':['id',_0x8754('0x34')],'raw':!![]});_0x3e49f7['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x8754('0xd5')],'raw':!![]});var _0x4c0adf=[{'model':db[_0x8754('0xc6')],'as':'Messages','attributes':['id',_0x8754('0x74'),_0x8754('0x7b'),_0x8754('0xd6'),'secret',_0x8754('0x82')],'include':_0x3e49f7}];_0x4c0adf[_0x8754('0x39')]({'model':db[_0x8754('0xd7')],'as':_0x8754('0xd8'),'attributes':['id',_0x8754('0x30')]});_0x4c0adf['push']({'model':db[_0x8754('0x6f')],'as':'Owner','attributes':['id',_0x8754('0x34')]});return db[_0x8754('0x3a')]['find']({'where':{'id':_0x349026[_0x8754('0xb6')]['id']},'include':_0x4c0adf})[_0x8754('0x2c')](handleEntityNotFound(_0x5cda63,null))['then'](function(_0x5ef8a3){if(_0x5ef8a3){var _0x42db47=_0x5ef8a3[_0x8754('0xd9')]({'plain':!![]});fs[_0x8754('0xda')](_0x414316);var _0x56a194={'format':'A4','border':'10px','header':{'height':_0x8754('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x8754('0xdc'),'contents':{'default':util[_0x8754('0xc4')](_0x8754('0xdd'),util[_0x8754('0xc4')](_0x8754('0xde'),'Sms',_0x42db47['id']),moment()[_0x8754('0xc4')]('YYYY-MM-DD')[_0x8754('0x9d')]())}}};var _0xf8d2e7={'channel':_0x8754('0xdf'),'account':_0x42db47[_0x8754('0xd8')][_0x8754('0x30')],'agent':_0x42db47[_0x8754('0xe0')]?_0x42db47[_0x8754('0xe0')][_0x8754('0x34')]:_0x8754('0xe1'),'createdAt':moment(_0x42db47[_0x8754('0x7b')])['format'](_0x8754('0xc5'))[_0x8754('0x9d')](),'closedAt':_0x42db47['closed']?moment(_0x42db47[_0x8754('0xe2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8754('0x9d')]():'','disposition':_0x42db47[_0x8754('0xe3')],'messages':_(_0x42db47[_0x8754('0xe4')])[_0x8754('0x86')]({'secret':![]})[_0x8754('0x33')](function(_0x3de7b0){return{'date':moment(_0x3de7b0[_0x8754('0x7b')])['format'](_0x8754('0xc5'))['toString'](),'sender':_0x3de7b0[_0x8754('0xd6')]===_0x8754('0xe5')?_0x3de7b0[_0x8754('0x6f')]?_0x3de7b0[_0x8754('0x6f')][_0x8754('0x34')]:_0x8754('0xe6'):_0x3de7b0[_0x8754('0xe7')][_0x8754('0xe8')]+(_0x3de7b0[_0x8754('0xe7')][_0x8754('0xd5')]?'\x20'+_0x3de7b0['Contact'][_0x8754('0xd5')]:''),'body':_0x3de7b0['body'],'direction':_0x3de7b0['direction']===_0x8754('0xe5')?'A':'C','secret':_0x3de7b0[_0x8754('0xe9')],'read':_0x3de7b0['read']};})[_0x8754('0x62')]()};return ejs['renderFile'](path[_0x8754('0xd0')](config[_0x8754('0xd1')],'server',_0x8754('0xea'),_0x8754('0xeb')),{'interaction':_0xf8d2e7})[_0x8754('0x2c')](function(_0x37e4ec){return new BPromise(function(_0x1d9ecb,_0x4f03ef){pdf[_0x8754('0xbb')](_0x37e4ec,_0x56a194)[_0x8754('0xec')](path['join'](_0x414316,_0x8754('0xed')+_0x42db47['id']+'-'+_0x1c8cce+_0x8754('0xee')),function(_0x179286,_0x1e5df2){if(_0x179286)return _0x4f03ef(_0x179286);_0x1d9ecb(_0x1e5df2);});});})['then'](function(){return new BPromise(function(_0x389955,_0x5f1c42){zipdir(_0x414316,{'saveTo':_0x5312f9},function(_0x5b5b9e,_0x38970c){if(_0x5b5b9e)return _0x5f1c42(_0x5b5b9e);return _0x389955(_0x38970c);});})[_0x8754('0x2c')](function(){return new BPromise(function(_0x20e92f,_0x2ed501){rimraf(_0x414316,function(_0x25165d){if(_0x25165d)_0x2ed501(_0x25165d);return _0x20e92f();});});})['then'](function(){return _0x5cda63[_0x8754('0xce')](_0x5312f9,_0xe0f440,function(_0x3a7b14){if(_0x3a7b14){console[_0x8754('0xef')](_0x8754('0xf0'),_0x3a7b14);}else{fs[_0x8754('0xf1')](_0x5312f9);}});});});}else{return _0x5cda63[_0x8754('0x21')](0xc8);}})[_0x8754('0xb4')](handleError(_0x5cda63,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4656935..d78afd7 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 _0x207c=['then','Users','map','setDataValue','unreadMessages','length','emit','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x207c,0x1e8));var _0xc207=function(_0x5b26be,_0x24893b){_0x5b26be=_0x5b26be-0x0;var _0x4c02c9=_0x207c[_0x5b26be];return _0x4c02c9;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var SmsMessage=require(_0xc207('0x0'))['db'][_0xc207('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc207('0x3')](0x0);var events={'afterCreate':_0xc207('0x4'),'afterUpdate':_0xc207('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38ff02){return function(_0x59bc89,_0x5a727b,_0x55023e){_0x59bc89[_0xc207('0x6')]({'attributes':['id'],'raw':!![]})[_0xc207('0x7')](function(_0x3395e4){_0x59bc89['setDataValue'](_0xc207('0x8'),_0x3395e4[_0xc207('0x9')](function(_0x3c579f){return{'id':_0x3c579f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x59bc89['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc207('0x7')](function(_0x817576){_0x59bc89[_0xc207('0xa')](_0xc207('0xb'),_0x817576[_0xc207('0xc')]);SmsInteractionEvents[_0xc207('0xd')](_0x38ff02+':'+_0x59bc89['id'],_0x59bc89);SmsInteractionEvents['emit'](_0x38ff02,_0x59bc89);_0x55023e(null);})['catch'](_0x55023e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc207('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xf725=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xf725,0x7e));var _0x5f72=function(_0x487351,_0x3c9a65){_0x487351=_0x487351-0x0;var _0x293d80=_0xf725[_0x487351];return _0x293d80;};'use strict';var EventEmitter=require(_0x5f72('0x0'));var SmsInteraction=require(_0x5f72('0x1'))['db'][_0x5f72('0x2')];var SmsMessage=require(_0x5f72('0x1'))['db'][_0x5f72('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5f72('0x4')](0x0);var events={'afterCreate':_0x5f72('0x5'),'afterUpdate':_0x5f72('0x6'),'afterDestroy':_0x5f72('0x7')};function emitEvent(_0x17a5bc){return function(_0x557be3,_0x453992,_0x14a92d){_0x557be3[_0x5f72('0x8')]({'attributes':['id'],'raw':!![]})[_0x5f72('0x9')](function(_0x148af8){_0x557be3[_0x5f72('0xa')](_0x5f72('0xb'),_0x148af8['map'](function(_0x499e28){return{'id':_0x499e28['id']};}));return SmsMessage[_0x5f72('0xc')]({'where':{'SmsInteractionId':_0x557be3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f72('0x9')](function(_0x5b74cf){_0x557be3[_0x5f72('0xa')](_0x5f72('0xd'),_0x5b74cf['length']);SmsInteractionEvents[_0x5f72('0xe')](_0x17a5bc+':'+_0x557be3['id'],_0x557be3);SmsInteractionEvents[_0x5f72('0xe')](_0x17a5bc,_0x557be3);_0x14a92d(null);})[_0x5f72('0xf')](_0x14a92d(null));};}for(var e in events){if(events[_0x5f72('0x10')](e)){var event=events[e];SmsInteraction[_0x5f72('0x11')](e,emitEvent(event));}}module[_0x5f72('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5b4c14d..7aff339 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 _0xe838=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x489e1c,_0x28fc3e){var _0x491aa7=function(_0x3e4a86){while(--_0x3e4a86){_0x489e1c['push'](_0x489e1c['shift']());}};_0x491aa7(++_0x28fc3e);}(_0xe838,0xfc));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e83('0x0'));var util=require(_0x8e83('0x1'));var logger=require(_0x8e83('0x2'))(_0x8e83('0x3'));var moment=require(_0x8e83('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e83('0x5'));var fs=require('fs');var path=require(_0x8e83('0x6'));var rimraf=require(_0x8e83('0x7'));var config=require(_0x8e83('0x8'));var attributes=require(_0x8e83('0x9'));module[_0x8e83('0xa')]=function(_0x361d8f,_0x278dec){return _0x361d8f[_0x8e83('0xb')](_0x8e83('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43fe91,_0x20d31f,_0x4b9288){if(_0x43fe91[_0x8e83('0xd')](_0x8e83('0xe'))){_0x43fe91[_0x8e83('0xf')]=moment()[_0x8e83('0x10')](_0x8e83('0x11'));}_0x4b9288(null,_0x43fe91);}}});}; \ No newline at end of file +var _0xfb6a=['closed','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfb6a,0x79));var _0xafb6=function(_0x10d341,_0x57ff35){_0x10d341=_0x10d341-0x0;var _0xddc36d=_0xfb6a[_0x10d341];return _0xddc36d;};'use strict';var _=require(_0xafb6('0x0'));var util=require('util');var logger=require(_0xafb6('0x1'))(_0xafb6('0x2'));var moment=require('moment');var BPromise=require(_0xafb6('0x3'));var rp=require(_0xafb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafb6('0x5'));var attributes=require(_0xafb6('0x6'));module[_0xafb6('0x7')]=function(_0x5b6795,_0xc92b9b){return _0x5b6795[_0xafb6('0x8')]('SmsInteraction',attributes,{'tableName':_0xafb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3532bd,_0x92024f,_0x229ce0){if(_0x3532bd[_0xafb6('0xa')](_0xafb6('0xb'))){_0x3532bd['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x229ce0(null,_0x3532bd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ce5f6cf..ad46a9b 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 _0x6c1e=['result','catch','UpdateSmsInteraction','update','body','options','raw','where','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1b3470,_0x3fadda){var _0x2f54cb=function(_0x3c8028){while(--_0x3c8028){_0x1b3470['push'](_0x1b3470['shift']());}};_0x2f54cb(++_0x3fadda);}(_0x6c1e,0x1bf));var _0xe6c1=function(_0x15ece6,_0x51a965){_0x15ece6=_0x15ece6-0x0;var _0x3dc05c=_0x6c1e[_0x15ece6];return _0x3dc05c;};'use strict';var _=require(_0xe6c1('0x0'));var util=require(_0xe6c1('0x1'));var moment=require('moment');var BPromise=require(_0xe6c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6c1('0x3'));var db=require(_0xe6c1('0x4'))['db'];var utils=require(_0xe6c1('0x5'));var logger=require('../../config/logger')(_0xe6c1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe6c1('0x7')][_0xe6c1('0x8')]({'port':0x232a});config[_0xe6c1('0x9')]=_[_0xe6c1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6c1('0x9')]));require('./smsInteraction.socket')[_0xe6c1('0xb')](socket);function respondWithRpcPromise(_0x4a4a10,_0x15b78c,_0x41f90c){return new BPromise(function(_0x2c4de4,_0x1a1aa2){return client['request'](_0x4a4a10,_0x41f90c)[_0xe6c1('0xc')](function(_0x1d7a11){logger['info'](_0xe6c1('0xd'),_0x15b78c,_0xe6c1('0xe'));logger['debug'](_0xe6c1('0xf'),_0x15b78c,_0xe6c1('0xe'),JSON[_0xe6c1('0x10')](_0x1d7a11));if(_0x1d7a11['error']){if(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x12')]===0x1f4){logger[_0xe6c1('0x11')](_0xe6c1('0xd'),_0x15b78c,_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);return _0x1a1aa2(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);}logger[_0xe6c1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x15b78c,_0x1d7a11['error'][_0xe6c1('0x13')]);return _0x2c4de4(_0x1d7a11['error'][_0xe6c1('0x13')]);}else{logger[_0xe6c1('0x14')](_0xe6c1('0xd'),_0x15b78c,'request\x20sent');_0x2c4de4(_0x1d7a11[_0xe6c1('0x15')]['message']);}})[_0xe6c1('0x16')](function(_0x20723a){logger[_0xe6c1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x15b78c,_0x20723a);_0x1a1aa2(_0x20723a);});});}exports[_0xe6c1('0x17')]=function(_0x128f78){var _0x2772b0=this;return new Promise(function(_0x59bc9b,_0xe87a7d){return db['SmsInteraction'][_0xe6c1('0x18')](_0x128f78[_0xe6c1('0x19')],{'raw':_0x128f78[_0xe6c1('0x1a')]?_0x128f78[_0xe6c1('0x1a')][_0xe6c1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x128f78[_0xe6c1('0x1a')]?_0x128f78['options'][_0xe6c1('0x1c')]||null:null,'attributes':_0x128f78['options']?_0x128f78[_0xe6c1('0x1a')]['attributes']||null:null,'limit':_0x128f78[_0xe6c1('0x1a')]?_0x128f78[_0xe6c1('0x1a')]['limit']||null:null})[_0xe6c1('0xc')](function(_0xc1783e){logger[_0xe6c1('0x14')](_0xe6c1('0x17'),_0x128f78);logger['debug'](_0xe6c1('0x17'),_0x128f78,JSON[_0xe6c1('0x10')](_0xc1783e));_0x59bc9b(_0xc1783e);})['catch'](function(_0x571757){logger[_0xe6c1('0x11')](_0xe6c1('0x17'),_0x571757['message'],_0x128f78);_0xe87a7d(_0x2772b0[_0xe6c1('0x11')](0x1f4,_0x571757[_0xe6c1('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1788ad){return new Promise(function(_0x8e412f,_0x7647d3){return db['SmsInteraction'][_0xe6c1('0x1d')]({'where':_0x1788ad['options']?_0x1788ad[_0xe6c1('0x1a')][_0xe6c1('0x1c')]||null:null})[_0xe6c1('0xc')](function(_0x4eac78){if(_0x4eac78){return _0x4eac78[_0xe6c1('0x1e')](_0x1788ad[_0xe6c1('0x19')][_0xe6c1('0x1f')],_[_0xe6c1('0x20')](_0x1788ad[_0xe6c1('0x19')],['ids','id'])||{});}})[_0xe6c1('0x21')](function(_0x4367fc){logger[_0xe6c1('0x14')]('AddTags',_0x1788ad);logger[_0xe6c1('0x22')](_0xe6c1('0x23'),_0x1788ad,JSON['stringify'](_0x4367fc));_0x8e412f(_0x4367fc);})[_0xe6c1('0x16')](function(_0x7b6357){logger[_0xe6c1('0x11')](_0xe6c1('0x23'),_0x7b6357[_0xe6c1('0x13')],_0x1788ad);_0x7647d3(_this[_0xe6c1('0x11')](0x1f4,_0x7b6357[_0xe6c1('0x13')]));});});}; \ No newline at end of file +var _0xa831=['AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit','spread','AddTags','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','update','body','options','where'];(function(_0x35c4d8,_0x90c257){var _0xeb1b20=function(_0x1ec7c7){while(--_0x1ec7c7){_0x35c4d8['push'](_0x35c4d8['shift']());}};_0xeb1b20(++_0x90c257);}(_0xa831,0xca));var _0x1a83=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xa831[_0x319e2e];return _0x302524;};'use strict';var _=require('lodash');var util=require(_0x1a83('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a83('0x1'));var db=require(_0x1a83('0x2'))['db'];var utils=require(_0x1a83('0x3'));var logger=require(_0x1a83('0x4'))(_0x1a83('0x5'));var config=require(_0x1a83('0x6'));var jayson=require(_0x1a83('0x7'));var client=jayson['client'][_0x1a83('0x8')]({'port':0x232a});config['redis']=_[_0x1a83('0x9')](config['redis'],{'host':_0x1a83('0xa'),'port':0x18eb});var socket=require(_0x1a83('0xb'))(new Redis(config[_0x1a83('0xc')]));require(_0x1a83('0xd'))[_0x1a83('0xe')](socket);function respondWithRpcPromise(_0x4ab75a,_0x172955,_0x2d6ea6){return new BPromise(function(_0x177b84,_0x5a658e){return client['request'](_0x4ab75a,_0x2d6ea6)[_0x1a83('0xf')](function(_0x28a913){logger['info'](_0x1a83('0x10'),_0x172955,_0x1a83('0x11'));logger[_0x1a83('0x12')](_0x1a83('0x13'),_0x172955,_0x1a83('0x11'),JSON[_0x1a83('0x14')](_0x28a913));if(_0x28a913[_0x1a83('0x15')]){if(_0x28a913['error'][_0x1a83('0x16')]===0x1f4){logger['error'](_0x1a83('0x10'),_0x172955,_0x28a913['error'][_0x1a83('0x17')]);return _0x5a658e(_0x28a913[_0x1a83('0x15')][_0x1a83('0x17')]);}logger[_0x1a83('0x15')](_0x1a83('0x10'),_0x172955,_0x28a913[_0x1a83('0x15')][_0x1a83('0x17')]);return _0x177b84(_0x28a913['error'][_0x1a83('0x17')]);}else{logger[_0x1a83('0x18')](_0x1a83('0x10'),_0x172955,_0x1a83('0x11'));_0x177b84(_0x28a913[_0x1a83('0x19')][_0x1a83('0x17')]);}})[_0x1a83('0x1a')](function(_0x3a4769){logger[_0x1a83('0x15')](_0x1a83('0x10'),_0x172955,_0x3a4769);_0x5a658e(_0x3a4769);});});}exports[_0x1a83('0x1b')]=function(_0x4abe2d){var _0x506bec=this;return new Promise(function(_0x3fe9c1,_0x3af58a){return db['SmsInteraction'][_0x1a83('0x1c')](_0x4abe2d[_0x1a83('0x1d')],{'raw':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')][_0x1a83('0x1f')]||null:null,'attributes':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['attributes']||null:null,'limit':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['limit']||null:null})[_0x1a83('0xf')](function(_0x5113df){logger[_0x1a83('0x18')]('UpdateSmsInteraction',_0x4abe2d);logger['debug'](_0x1a83('0x1b'),_0x4abe2d,JSON[_0x1a83('0x14')](_0x5113df));_0x3fe9c1(_0x5113df);})[_0x1a83('0x1a')](function(_0x408897){logger[_0x1a83('0x15')](_0x1a83('0x1b'),_0x408897[_0x1a83('0x17')],_0x4abe2d);_0x3af58a(_0x506bec[_0x1a83('0x15')](0x1f4,_0x408897['message']));});});};exports[_0x1a83('0x20')]=function(_0x30eed3){return new Promise(function(_0x1651b1,_0x2e1f76){return db[_0x1a83('0x21')]['find']({'where':_0x30eed3[_0x1a83('0x1e')]?_0x30eed3[_0x1a83('0x1e')]['where']||null:null})['then'](function(_0x1f9d66){if(_0x1f9d66){return _0x1f9d66[_0x1a83('0x22')](_0x30eed3[_0x1a83('0x1d')][_0x1a83('0x23')],_[_0x1a83('0x24')](_0x30eed3[_0x1a83('0x1d')],[_0x1a83('0x23'),'id'])||{});}})[_0x1a83('0x25')](function(_0x454a6d){logger['info'](_0x1a83('0x26'),_0x30eed3);logger[_0x1a83('0x12')]('AddTags',_0x30eed3,JSON[_0x1a83('0x14')](_0x454a6d));_0x1651b1(_0x454a6d);})['catch'](function(_0x1414e1){logger[_0x1a83('0x15')](_0x1a83('0x26'),_0x1414e1[_0x1a83('0x17')],_0x30eed3);_0x2e1f76(_this[_0x1a83('0x15')](0x1f4,_0x1414e1[_0x1a83('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f285b6e..d99b52b 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x4809b0,_0xcedc2b){var _0x244cd5=function(_0x17425e){while(--_0x17425e){_0x4809b0['push'](_0x4809b0['shift']());}};_0x244cd5(++_0xcedc2b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x27bd60,_0x10e9fb){var _0x1784c0=function(_0x5a23f0){while(--_0x5a23f0){_0x27bd60['push'](_0x27bd60['shift']());}};_0x1784c0(++_0x10e9fb);}(_0x757a,0xde));var _0xa757=function(_0x39ddd2,_0x1626b4){_0x39ddd2=_0x39ddd2-0x0;var _0x1424c1=_0x757a[_0x39ddd2];return _0x1424c1;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index fde1a88..a1181b6 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 _0xd2b7=['index','isAuthenticated','describe','/:id','tracked','create','/:id/status','status','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0xcd07c,_0x8f566c){var _0xb99e27=function(_0x2d19d2){while(--_0x2d19d2){_0xcd07c['push'](_0xcd07c['shift']());}};_0xb99e27(++_0x8f566c);}(_0xd2b7,0x184));var _0x7d2b=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xd2b7[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var path=require(_0x7d2b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7d2b('0x3'));var interaction=require(_0x7d2b('0x4'));var config=require(_0x7d2b('0x5'));var controller=require(_0x7d2b('0x6'));router[_0x7d2b('0x7')]('/',auth['isAuthenticated'](),controller[_0x7d2b('0x8')]);router[_0x7d2b('0x7')]('/describe',auth[_0x7d2b('0x9')](),controller[_0x7d2b('0xa')]);router[_0x7d2b('0x7')](_0x7d2b('0xb'),auth[_0x7d2b('0x9')](),controller['show']);router['post']('/',auth[_0x7d2b('0x9')](),interaction[_0x7d2b('0xc')]('sms','smsmessage:create'),controller[_0x7d2b('0xd')]);router['post'](_0x7d2b('0xe'),controller[_0x7d2b('0xf')]);router['put'](_0x7d2b('0xb'),auth[_0x7d2b('0x9')](),controller[_0x7d2b('0x10')]);router['put'](_0x7d2b('0x11'),auth['isAuthenticated'](),controller[_0x7d2b('0x12')]);router['put']('/:id/reject',auth[_0x7d2b('0x9')](),controller[_0x7d2b('0x13')]);router['delete'](_0x7d2b('0xb'),auth['isAuthenticated'](),controller[_0x7d2b('0x14')]);module[_0x7d2b('0x15')]=router; \ No newline at end of file +var _0x98e9=['express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','show','post','sms','smsmessage:create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','path','connect-timeout'];(function(_0x21ae6f,_0x2ca34d){var _0x4d0e36=function(_0x595217){while(--_0x595217){_0x21ae6f['push'](_0x21ae6f['shift']());}};_0x4d0e36(++_0x2ca34d);}(_0x98e9,0x14e));var _0x998e=function(_0x292e3c,_0xc94a85){_0x292e3c=_0x292e3c-0x0;var _0xc9a35c=_0x98e9[_0x292e3c];return _0xc9a35c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x998e('0x0'));var timeout=require(_0x998e('0x1'));var express=require(_0x998e('0x2'));var router=express[_0x998e('0x3')]();var auth=require(_0x998e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x998e('0x5'));var controller=require(_0x998e('0x6'));router[_0x998e('0x7')]('/',auth['isAuthenticated'](),controller[_0x998e('0x8')]);router['get']('/describe',auth[_0x998e('0x9')](),controller[_0x998e('0xa')]);router[_0x998e('0x7')]('/:id',auth[_0x998e('0x9')](),controller[_0x998e('0xb')]);router[_0x998e('0xc')]('/',auth[_0x998e('0x9')](),interaction['tracked'](_0x998e('0xd'),_0x998e('0xe')),controller['create']);router[_0x998e('0xc')](_0x998e('0xf'),controller[_0x998e('0x10')]);router[_0x998e('0x11')](_0x998e('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x998e('0x11')](_0x998e('0x13'),auth[_0x998e('0x9')](),controller[_0x998e('0x14')]);router[_0x998e('0x11')](_0x998e('0x15'),auth['isAuthenticated'](),controller[_0x998e('0x16')]);router[_0x998e('0x17')](_0x998e('0x12'),auth['isAuthenticated'](),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 db576b7..a6d4b63 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 _0x94ee=['out','DATE','sequelize','TEXT','medium','ENUM'];(function(_0x1d0343,_0x472470){var _0xeba613=function(_0x241b24){while(--_0x241b24){_0x1d0343['push'](_0x1d0343['shift']());}};_0xeba613(++_0x472470);}(_0x94ee,0x152));var _0xe94e=function(_0x410fc6,_0x99dadd){_0x410fc6=_0x410fc6-0x0;var _0x4d79c0=_0x94ee[_0x410fc6];return _0x4d79c0;};'use strict';var Sequelize=require(_0xe94e('0x0'));module['exports']={'body':{'type':Sequelize[_0xe94e('0x1')](_0xe94e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe94e('0x3')]('in',_0xe94e('0x4')),'defaultValue':_0xe94e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe94e('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe94e('0x1')]}}; \ No newline at end of file +var _0x7262=['STRING','DATE','BOOLEAN','sequelize','ENUM','out'];(function(_0x4a7fc8,_0x3d2a12){var _0xc6bf=function(_0x5a6003){while(--_0x5a6003){_0x4a7fc8['push'](_0x4a7fc8['shift']());}};_0xc6bf(++_0x3d2a12);}(_0x7262,0x8d));var _0x2726=function(_0x11dba1,_0x54dff2){_0x11dba1=_0x11dba1-0x0;var _0x50ef22=_0x7262[_0x11dba1];return _0x50ef22;};'use strict';var Sequelize=require(_0x2726('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2726('0x1')]('in',_0x2726('0x2')),'defaultValue':_0x2726('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2726('0x3')](0xbe)},'phone':{'type':Sequelize[_0x2726('0x3')]},'readAt':{'type':Sequelize[_0x2726('0x4')]},'secret':{'type':Sequelize[_0x2726('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2726('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d2a3146..c1af6fe 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 _0xb3f6=['CmContact','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','SmsMessage','rawAttributes','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','keys','options','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x2c80bc,_0x473f91){var _0x11829f=function(_0x319c0a){while(--_0x319c0a){_0x2c80bc['push'](_0x2c80bc['shift']());}};_0x11829f(++_0x473f91);}(_0xb3f6,0x1bb));var _0x6b3f=function(_0x358437,_0x204fae){_0x358437=_0x358437-0x0;var _0x43eca9=_0xb3f6[_0x358437];return _0x43eca9;};'use strict';var pdf=require(_0x6b3f('0x0'));var emlformat=require(_0x6b3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6b3f('0x2'));var jsonpatch=require(_0x6b3f('0x3'));var rp=require(_0x6b3f('0x4'));var moment=require(_0x6b3f('0x5'));var BPromise=require(_0x6b3f('0x6'));var Mustache=require(_0x6b3f('0x7'));var util=require(_0x6b3f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6b3f('0x9'));var ejs=require(_0x6b3f('0xa'));var fs=require('fs');var _=require(_0x6b3f('0xb'));var squel=require('squel');var crypto=require(_0x6b3f('0xc'));var jsforce=require(_0x6b3f('0xd'));var deskjs=require(_0x6b3f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6b3f('0xf'));var Papa=require(_0x6b3f('0x10'));var Redis=require(_0x6b3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6b3f('0x12'));var as=require(_0x6b3f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b3f('0x14'))(_0x6b3f('0x15'));var utils=require(_0x6b3f('0x16'));var config=require(_0x6b3f('0x17'));var licenseUtil=require(_0x6b3f('0x18'));var db=require('../../mysqldb')['db'];config[_0x6b3f('0x19')]=_[_0x6b3f('0x1a')](config[_0x6b3f('0x19')],{'host':_0x6b3f('0x1b'),'port':0x18eb});var socket=require(_0x6b3f('0x1c'))(new Redis(config[_0x6b3f('0x19')]));require(_0x6b3f('0x1d'))[_0x6b3f('0x1e')](socket);var jayson=require(_0x6b3f('0x1f'));var client=jayson[_0x6b3f('0x20')][_0x6b3f('0x21')]({'port':0x232c});var client9002=jayson[_0x6b3f('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7ecf,_0x1cf52e,_0x5b403d,_0x9bdba6){return new BPromise(function(_0x58a449,_0x1c45cf){var _0x310397=_0x9bdba6||client;return _0x310397['request'](_0x5b7ecf,_0x5b403d)['then'](function(_0x541ce5){logger[_0x6b3f('0x22')](_0x6b3f('0x23'),_0x1cf52e,_0x6b3f('0x24'));logger[_0x6b3f('0x25')](_0x6b3f('0x26'),_0x1cf52e,'request\x20sent',JSON[_0x6b3f('0x27')](_0x541ce5));if(_0x541ce5[_0x6b3f('0x28')]){if(_0x541ce5[_0x6b3f('0x28')]['code']===0x1f4){logger[_0x6b3f('0x28')](_0x6b3f('0x23'),_0x1cf52e,_0x541ce5[_0x6b3f('0x28')][_0x6b3f('0x29')]);return _0x1c45cf(_0x541ce5['error'][_0x6b3f('0x29')]);}logger[_0x6b3f('0x28')](_0x6b3f('0x23'),_0x1cf52e,_0x541ce5['error']['message']);return _0x58a449(_0x541ce5['error'][_0x6b3f('0x29')]);}else{logger[_0x6b3f('0x22')](_0x6b3f('0x23'),_0x1cf52e,'request\x20sent');_0x58a449(_0x541ce5[_0x6b3f('0x2a')][_0x6b3f('0x29')]);}})[_0x6b3f('0x2b')](function(_0x3b054e){logger['error'](_0x6b3f('0x23'),_0x1cf52e,_0x3b054e);_0x1c45cf(_0x3b054e);});});}function respondWithStatusCode(_0x2751a7,_0x2493ed){_0x2493ed=_0x2493ed||0xcc;return function(_0x3ed6cf){if(_0x3ed6cf){return _0x2751a7[_0x6b3f('0x2c')](_0x2493ed);}return _0x2751a7[_0x6b3f('0x2d')](_0x2493ed)[_0x6b3f('0x2e')]();};}function respondWithResult(_0x27802d,_0x528c8f){_0x528c8f=_0x528c8f||0xc8;return function(_0xb3f12){if(_0xb3f12){return _0x27802d[_0x6b3f('0x2d')](_0x528c8f)[_0x6b3f('0x2f')](_0xb3f12);}};}function respondWithFilteredResult(_0x79aee3,_0x53fe0b){return function(_0x1bc4ed){if(_0x1bc4ed){var _0x5dd165=_0x1bc4ed[_0x6b3f('0x30')],_0x513fa5=_0x53fe0b[_0x6b3f('0x31')],_0x4c656d=_0x53fe0b['offset']+_0x53fe0b[_0x6b3f('0x32')],_0x237663;if(_0x4c656d>=_0x5dd165){_0x4c656d=_0x5dd165;_0x237663=0xc8;}else{_0x237663=0xce;}_0x79aee3[_0x6b3f('0x2d')](_0x237663);return _0x79aee3['set']('Content-Range',_0x513fa5+'-'+_0x4c656d+'/'+_0x5dd165)[_0x6b3f('0x2f')](_0x1bc4ed);}return null;};}function patchUpdates(_0x107a84){return function(_0x3c686e){try{jsonpatch[_0x6b3f('0x33')](_0x3c686e,_0x107a84,!![]);}catch(_0x3a8352){return BPromise[_0x6b3f('0x34')](_0x3a8352);}return _0x3c686e[_0x6b3f('0x35')]();};}function saveUpdates(_0x272c1e,_0x470098){return function(_0x1d615a){if(_0x1d615a){return _0x1d615a[_0x6b3f('0x36')](_0x272c1e)[_0x6b3f('0x37')](function(_0x18245e){return _0x18245e;});}return null;};}function removeEntity(_0x4e26fe,_0x28864a){return function(_0x47e42b){if(_0x47e42b){return _0x47e42b[_0x6b3f('0x38')]()[_0x6b3f('0x37')](function(){_0x4e26fe[_0x6b3f('0x2d')](0xcc)[_0x6b3f('0x2e')]();});}};}function handleEntityNotFound(_0x47a304,_0x51d056){return function(_0x30d6fd){if(!_0x30d6fd){_0x47a304[_0x6b3f('0x2c')](0x194);}return _0x30d6fd;};}function handleError(_0x4d5155,_0x43d6f6){_0x43d6f6=_0x43d6f6||0x1f4;return function(_0x155e6b){logger['error'](_0x155e6b[_0x6b3f('0x39')]);if(_0x155e6b[_0x6b3f('0x3a')]){delete _0x155e6b[_0x6b3f('0x3a')];}_0x4d5155[_0x6b3f('0x2d')](_0x43d6f6)[_0x6b3f('0x3b')](_0x155e6b);};}exports['index']=function(_0x112b98,_0x443b00){var _0xefb908={},_0x18a380={},_0x3ac818={'count':0x0,'rows':[]};var _0x19ea02=_['map'](db[_0x6b3f('0x3c')][_0x6b3f('0x3d')],function(_0x1b3f5c){return{'name':_0x1b3f5c['fieldName'],'type':_0x1b3f5c['type'][_0x6b3f('0x3e')]};});_0x18a380[_0x6b3f('0x3f')]=_[_0x6b3f('0x40')](_0x19ea02,_0x6b3f('0x3a'));_0x18a380[_0x6b3f('0x41')]=_['keys'](_0x112b98[_0x6b3f('0x41')]);_0x18a380[_0x6b3f('0x42')]=_['intersection'](_0x18a380[_0x6b3f('0x3f')],_0x18a380[_0x6b3f('0x41')]);_0xefb908[_0x6b3f('0x43')]=_[_0x6b3f('0x44')](_0x18a380[_0x6b3f('0x3f')],qs[_0x6b3f('0x45')](_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x45')]));_0xefb908[_0x6b3f('0x43')]=_0xefb908[_0x6b3f('0x43')][_0x6b3f('0x46')]?_0xefb908['attributes']:_0x18a380[_0x6b3f('0x3f')];if(!_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x47')](_0x6b3f('0x48'))){_0xefb908[_0x6b3f('0x32')]=qs['limit'](_0x112b98['query'][_0x6b3f('0x32')]);_0xefb908[_0x6b3f('0x31')]=qs[_0x6b3f('0x31')](_0x112b98[_0x6b3f('0x41')]['offset']);}_0xefb908[_0x6b3f('0x49')]=qs[_0x6b3f('0x4a')](_0x112b98[_0x6b3f('0x41')]['sort']);_0xefb908[_0x6b3f('0x4b')]=qs[_0x6b3f('0x42')](_[_0x6b3f('0x4c')](_0x112b98[_0x6b3f('0x41')],_0x18a380[_0x6b3f('0x42')]),_0x19ea02);if(_0x112b98['query'][_0x6b3f('0x4d')]){_0xefb908[_0x6b3f('0x4b')]=_[_0x6b3f('0x4e')](_0xefb908['where'],{'$or':_['map'](_0x19ea02,function(_0x14499e){if(_0x14499e[_0x6b3f('0x4f')]!==_0x6b3f('0x50')){var _0xc65c11={};_0xc65c11[_0x14499e[_0x6b3f('0x3a')]]={'$like':'%'+_0x112b98[_0x6b3f('0x41')][_0x6b3f('0x4d')]+'%'};return _0xc65c11;}})});}_0xefb908=_[_0x6b3f('0x4e')]({},_0xefb908,_0x112b98['options']);var _0x1688ad={'where':_0xefb908[_0x6b3f('0x4b')]};return db[_0x6b3f('0x3c')]['count'](_0x1688ad)['then'](function(_0x5d0fff){_0x3ac818[_0x6b3f('0x30')]=_0x5d0fff;if(_0x112b98['query'][_0x6b3f('0x51')]){_0xefb908[_0x6b3f('0x52')]=[{'all':!![]}];}return db[_0x6b3f('0x3c')][_0x6b3f('0x53')](_0xefb908);})['then'](function(_0x371613){_0x3ac818['rows']=_0x371613;return _0x3ac818;})[_0x6b3f('0x37')](respondWithFilteredResult(_0x443b00,_0xefb908))[_0x6b3f('0x2b')](handleError(_0x443b00,null));};exports[_0x6b3f('0x54')]=function(_0xbc031b,_0x229238){var _0x5dcc15={'raw':!![],'where':{'id':_0xbc031b['params']['id']}},_0x1b0d51={};_0x1b0d51[_0x6b3f('0x3f')]=_[_0x6b3f('0x55')](db[_0x6b3f('0x3c')]['rawAttributes']);_0x1b0d51[_0x6b3f('0x41')]=_[_0x6b3f('0x55')](_0xbc031b['query']);_0x1b0d51[_0x6b3f('0x42')]=_[_0x6b3f('0x44')](_0x1b0d51['model'],_0x1b0d51[_0x6b3f('0x41')]);_0x5dcc15[_0x6b3f('0x43')]=_[_0x6b3f('0x44')](_0x1b0d51[_0x6b3f('0x3f')],qs[_0x6b3f('0x45')](_0xbc031b['query']['fields']));_0x5dcc15[_0x6b3f('0x43')]=_0x5dcc15['attributes'][_0x6b3f('0x46')]?_0x5dcc15[_0x6b3f('0x43')]:_0x1b0d51[_0x6b3f('0x3f')];if(_0xbc031b[_0x6b3f('0x41')][_0x6b3f('0x51')]){_0x5dcc15[_0x6b3f('0x52')]=[{'all':!![]}];}_0x5dcc15=_[_0x6b3f('0x4e')]({},_0x5dcc15,_0xbc031b[_0x6b3f('0x56')]);return db['SmsMessage'][_0x6b3f('0x57')](_0x5dcc15)[_0x6b3f('0x37')](handleEntityNotFound(_0x229238,null))[_0x6b3f('0x37')](respondWithResult(_0x229238,null))[_0x6b3f('0x2b')](handleError(_0x229238,null));};exports[_0x6b3f('0x58')]=function(_0x2c6df5,_0x1028ed){return db[_0x6b3f('0x3c')]['create'](_0x2c6df5['body'],{})['then'](respondWithResult(_0x1028ed,0xc9))['catch'](handleError(_0x1028ed,null));};exports[_0x6b3f('0x36')]=function(_0x3162ab,_0x1bf223){if(_0x3162ab[_0x6b3f('0x59')]['id']){delete _0x3162ab[_0x6b3f('0x59')]['id'];}return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x3162ab[_0x6b3f('0x5a')]['id']}})[_0x6b3f('0x37')](handleEntityNotFound(_0x1bf223,null))[_0x6b3f('0x37')](saveUpdates(_0x3162ab[_0x6b3f('0x59')],null))[_0x6b3f('0x37')](respondWithResult(_0x1bf223,null))['catch'](handleError(_0x1bf223,null));};exports[_0x6b3f('0x38')]=function(_0x5100da,_0x3bbd63){return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x5100da[_0x6b3f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3bbd63,null))[_0x6b3f('0x37')](removeEntity(_0x3bbd63,null))[_0x6b3f('0x2b')](handleError(_0x3bbd63,null));};exports[_0x6b3f('0x5b')]=function(_0x172b9f,_0x3856bc){return db[_0x6b3f('0x3c')][_0x6b3f('0x5b')]()['then'](respondWithResult(_0x3856bc,null))[_0x6b3f('0x2b')](handleError(_0x3856bc,null));};var interaction_log=require(_0x6b3f('0x14'))(_0x6b3f('0x5c'));exports[_0x6b3f('0x5d')]=function(_0x4d0181,_0x2dae60,_0x3a6c99){var _0x176561={'channel':_0x6b3f('0x5e')};if(_0x4d0181[_0x6b3f('0x59')]['id']){delete _0x4d0181[_0x6b3f('0x59')]['id'];}_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x5f')]=!![];_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x60')]=moment()[_0x6b3f('0x61')](_0x6b3f('0x62'));_0x4d0181[_0x6b3f('0x59')][_0x6b3f('0x63')]=_0x4d0181[_0x6b3f('0x59')]['UserId']||_0x4d0181[_0x6b3f('0x64')]['id'];return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x4d0181[_0x6b3f('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x6b3f('0x65')],'as':'Contact'}]})[_0x6b3f('0x37')](handleEntityNotFound(_0x2dae60,null))[_0x6b3f('0x37')](saveUpdates(_0x4d0181[_0x6b3f('0x59')],null))[_0x6b3f('0x37')](function(_0x3005c5){if(_0x3005c5){_0x176561[_0x6b3f('0x29')]=_0x3005c5[_0x6b3f('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3005c5[_0x6b3f('0x67')]}});}return null;})[_0x6b3f('0x37')](handleEntityNotFound(_0x2dae60,null))['then'](function(_0x2f909d){if(_0x2f909d){return _0x2f909d[_0x6b3f('0x36')]({'UserId':_0x4d0181[_0x6b3f('0x59')]['UserId'],'read1stAt':_['isNil'](_0x2f909d[_0x6b3f('0x68')])?moment()[_0x6b3f('0x61')](_0x6b3f('0x62')):undefined});}return null;})['then'](function(_0x54fb82){if(_0x54fb82){_0x176561[_0x6b3f('0x69')]=_0x54fb82[_0x6b3f('0x66')]({'plain':!![]});interaction_log[_0x6b3f('0x22')](_0x6b3f('0x6a'),_0x4d0181[_0x6b3f('0x64')]['id'],_0x4d0181[_0x6b3f('0x64')][_0x6b3f('0x3a')],_0x4d0181[_0x6b3f('0x64')]['role'],_0x176561[_0x6b3f('0x69')]['id'],_0x4d0181[_0x6b3f('0x59')]?JSON['stringify'](_0x4d0181[_0x6b3f('0x59')]):_0x6b3f('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x6b3f('0x6c'),_0x176561);}return null;})[_0x6b3f('0x37')](function(_0x216264){if(_0x216264){if(_0x4d0181[_0x6b3f('0x59')]['manual']){_0x176561[_0x6b3f('0x29')][_0x6b3f('0x6d')]=util['format'](_0x6b3f('0x6e'),_0x4d0181[_0x6b3f('0x64')][_0x6b3f('0x3a')]);_0x176561[_0x6b3f('0x29')]['channel']=_0x176561[_0x6b3f('0x6f')];_0x176561['message']['event']=_0x6b3f('0x5d');return respondWithRpcPromise(_0x6b3f('0x70'),_0x6b3f('0x70'),{'event':_0x6b3f('0x71'),'message':_0x176561[_0x6b3f('0x29')]},client9002)[_0x6b3f('0x37')](function(){return _0x176561;});}return _0x176561;}return null;})[_0x6b3f('0x37')](respondWithResult(_0x2dae60,null))[_0x6b3f('0x2b')](handleError(_0x2dae60,null));};var interaction_log=require(_0x6b3f('0x14'))(_0x6b3f('0x5c'));exports[_0x6b3f('0x34')]=function(_0x2905a0,_0x56cfa1,_0x448a0a){var _0x12cd23={'agent':{},'channel':_0x6b3f('0x5e')};if(_0x2905a0[_0x6b3f('0x59')]['id']){delete _0x2905a0[_0x6b3f('0x59')]['id'];}_0x2905a0[_0x6b3f('0x59')][_0x6b3f('0x63')]=_0x2905a0[_0x6b3f('0x59')][_0x6b3f('0x63')]||_0x2905a0[_0x6b3f('0x64')]['id'];_0x12cd23[_0x6b3f('0x72')]['id']=_0x2905a0[_0x6b3f('0x59')]['UserId'];return db[_0x6b3f('0x3c')]['find']({'where':{'id':_0x2905a0[_0x6b3f('0x5a')]['id'],'UserId':null}})[_0x6b3f('0x37')](handleEntityNotFound(_0x56cfa1,null))['then'](function(_0x5e5d30){if(_0x5e5d30){_0x12cd23[_0x6b3f('0x29')]=_0x5e5d30[_0x6b3f('0x66')]({'plain':!![]});return db['SmsInteraction'][_0x6b3f('0x57')]({'where':{'id':_0x5e5d30[_0x6b3f('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x56cfa1,null))[_0x6b3f('0x37')](function(_0x5bd58b){if(_0x5bd58b){_0x12cd23[_0x6b3f('0x69')]=_0x5bd58b[_0x6b3f('0x66')]({'plain':!![]});interaction_log['info'](_0x6b3f('0x73'),_0x2905a0[_0x6b3f('0x64')]['id'],_0x2905a0[_0x6b3f('0x64')][_0x6b3f('0x3a')],_0x2905a0[_0x6b3f('0x64')]['role'],_0x12cd23[_0x6b3f('0x69')]['id'],_0x2905a0[_0x6b3f('0x59')]?JSON[_0x6b3f('0x27')](_0x2905a0['body']):_0x6b3f('0x6b'));return respondWithRpcPromise(_0x6b3f('0x74'),_0x6b3f('0x75'),_0x12cd23);}return null;})[_0x6b3f('0x37')](function(_0x5c6f03){if(_0x5c6f03){_0x5c6f03[_0x6b3f('0x29')][_0x6b3f('0x6d')]=util['format'](_0x6b3f('0x6e'),_0x2905a0[_0x6b3f('0x64')][_0x6b3f('0x3a')]);_0x5c6f03[_0x6b3f('0x29')]['channel']=_0x12cd23['channel'];_0x5c6f03[_0x6b3f('0x29')][_0x6b3f('0x76')]='reject';respondWithRpcPromise(_0x6b3f('0x70'),'EventManager',{'event':_0x6b3f('0x77'),'message':_0x5c6f03[_0x6b3f('0x29')]},client9002);return _0x12cd23;}return null;})[_0x6b3f('0x37')](respondWithResult(_0x56cfa1,null))[_0x6b3f('0x2b')](handleError(_0x56cfa1,null));};exports[_0x6b3f('0x2d')]=function(_0x34d302,_0x53bd9b,_0x302deb){if(_0x34d302[_0x6b3f('0x59')]['id']){delete _0x34d302['body']['id'];}var _0x315b2a;return db[_0x6b3f('0x3c')][_0x6b3f('0x57')]({'where':{'id':_0x34d302[_0x6b3f('0x5a')]['id']}})[_0x6b3f('0x37')](handleEntityNotFound(_0x53bd9b,null))[_0x6b3f('0x37')](function(_0x2f0555){if(_0x2f0555){_0x315b2a=_0x2f0555;return db['SmsAccount'][_0x6b3f('0x57')]({'where':{'id':_0x2f0555[_0x6b3f('0x78')]}});}})[_0x6b3f('0x37')](handleEntityNotFound(_0x53bd9b,null))[_0x6b3f('0x37')](function(_0x3a4038){if(_0x3a4038){logger[_0x6b3f('0x25')](_0x6b3f('0x26'),_0x6b3f('0x2d'),_0x6b3f('0x79'),_0x3a4038[_0x6b3f('0x4f')],util['inspect'](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));switch(_0x3a4038[_0x6b3f('0x4f')]){case _0x6b3f('0x7a'):if(_0x34d302[_0x6b3f('0x59')]['MessageSid']&&_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7b')]===_0x315b2a[_0x6b3f('0x7c')]){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b3f('0x2d'),_0x6b3f('0x7a'),util[_0x6b3f('0x7d')](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6b3f('0x7e'):if(_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7f')]&&_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x7f')]===_0x315b2a[_0x6b3f('0x7c')]&&_[_0x6b3f('0x80')](['sent',_0x6b3f('0x81')],_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x82')])>=0x0){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger[_0x6b3f('0x28')](_0x6b3f('0x83'),_0x6b3f('0x2d'),_0x6b3f('0x84'),util[_0x6b3f('0x7d')](_0x34d302['body'],{'showHidden':![],'depth':null}));}break;case _0x6b3f('0x85'):var _0x47b29e=_0x34d302[_0x6b3f('0x59')][_0x6b3f('0x86')][0x0];if(_0x47b29e['status'][_0x6b3f('0x87')]==='DELIVERED'){return _0x315b2a[_0x6b3f('0x36')]({'read':!![]});}else{logger[_0x6b3f('0x28')](_0x6b3f('0x83'),_0x6b3f('0x2d'),_0x6b3f('0x85'),util[_0x6b3f('0x7d')](_0x34d302[_0x6b3f('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x315b2a;}})[_0x6b3f('0x37')](respondWithResult(_0x53bd9b,null))['catch'](handleError(_0x53bd9b,null));}; \ No newline at end of file +var _0x7026=['count','offset','limit','Content-Range','apply','reject','update','destroy','then','send','index','map','SmsMessage','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','include','show','params','includeAll','options','find','create','body','sms-interactions','sms','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','SmsInteractionId','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','json'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7026,0x152));var _0x6702=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7026[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x6702('0x0'));var emlformat=require(_0x6702('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6702('0x2'));var jsonpatch=require(_0x6702('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6702('0x4'));var util=require(_0x6702('0x5'));var path=require('path');var sox=require(_0x6702('0x6'));var csv=require(_0x6702('0x7'));var ejs=require(_0x6702('0x8'));var fs=require('fs');var _=require(_0x6702('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6702('0xa'));var toCsv=require(_0x6702('0x7'));var querystring=require(_0x6702('0xb'));var Papa=require(_0x6702('0xc'));var Redis=require(_0x6702('0xd'));var authService=require(_0x6702('0xe'));var qs=require(_0x6702('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6702('0x10'))('api');var utils=require(_0x6702('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6702('0x12')]=_[_0x6702('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6702('0x14'))(new Redis(config[_0x6702('0x12')]));require(_0x6702('0x15'))[_0x6702('0x16')](socket);var jayson=require(_0x6702('0x17'));var client=jayson[_0x6702('0x18')][_0x6702('0x19')]({'port':0x232c});var client9002=jayson[_0x6702('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4198bd,_0x1c8294,_0x11b263,_0x4e2b02){return new BPromise(function(_0x517c5f,_0x14e49b){var _0xf38ab3=_0x4e2b02||client;return _0xf38ab3[_0x6702('0x1a')](_0x4198bd,_0x11b263)['then'](function(_0x3af4df){logger['info'](_0x6702('0x1b'),_0x1c8294,'request\x20sent');logger[_0x6702('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c8294,'request\x20sent',JSON[_0x6702('0x1d')](_0x3af4df));if(_0x3af4df[_0x6702('0x1e')]){if(_0x3af4df['error'][_0x6702('0x1f')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);return _0x14e49b(_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);}logger[_0x6702('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);return _0x517c5f(_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);}else{logger[_0x6702('0x21')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,'request\x20sent');_0x517c5f(_0x3af4df[_0x6702('0x22')][_0x6702('0x20')]);}})[_0x6702('0x23')](function(_0x205277){logger[_0x6702('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x205277);_0x14e49b(_0x205277);});});}function respondWithStatusCode(_0x241341,_0x379f94){_0x379f94=_0x379f94||0xcc;return function(_0x3a447f){if(_0x3a447f){return _0x241341[_0x6702('0x24')](_0x379f94);}return _0x241341['status'](_0x379f94)[_0x6702('0x25')]();};}function respondWithResult(_0x3be04d,_0x17eac4){_0x17eac4=_0x17eac4||0xc8;return function(_0x472665){if(_0x472665){return _0x3be04d[_0x6702('0x26')](_0x17eac4)[_0x6702('0x27')](_0x472665);}};}function respondWithFilteredResult(_0x4792c0,_0x5ce1d7){return function(_0x4f295b){if(_0x4f295b){var _0x36818d=_0x4f295b[_0x6702('0x28')],_0x12da73=_0x5ce1d7['offset'],_0x489e45=_0x5ce1d7[_0x6702('0x29')]+_0x5ce1d7[_0x6702('0x2a')],_0x1ff473;if(_0x489e45>=_0x36818d){_0x489e45=_0x36818d;_0x1ff473=0xc8;}else{_0x1ff473=0xce;}_0x4792c0[_0x6702('0x26')](_0x1ff473);return _0x4792c0['set'](_0x6702('0x2b'),_0x12da73+'-'+_0x489e45+'/'+_0x36818d)[_0x6702('0x27')](_0x4f295b);}return null;};}function patchUpdates(_0x395885){return function(_0x21a27f){try{jsonpatch[_0x6702('0x2c')](_0x21a27f,_0x395885,!![]);}catch(_0x5a8c8e){return BPromise[_0x6702('0x2d')](_0x5a8c8e);}return _0x21a27f['save']();};}function saveUpdates(_0x4eb6dc,_0x153deb){return function(_0x16cb3a){if(_0x16cb3a){return _0x16cb3a[_0x6702('0x2e')](_0x4eb6dc)['then'](function(_0x27ef90){return _0x27ef90;});}return null;};}function removeEntity(_0x2c94ac,_0x38ca1b){return function(_0x257f83){if(_0x257f83){return _0x257f83[_0x6702('0x2f')]()[_0x6702('0x30')](function(){_0x2c94ac[_0x6702('0x26')](0xcc)[_0x6702('0x25')]();});}};}function handleEntityNotFound(_0xc5bf2c,_0x12f57a){return function(_0x4b8cd5){if(!_0x4b8cd5){_0xc5bf2c[_0x6702('0x24')](0x194);}return _0x4b8cd5;};}function handleError(_0x431ed9,_0x6ba486){_0x6ba486=_0x6ba486||0x1f4;return function(_0x123118){logger[_0x6702('0x1e')](_0x123118['stack']);if(_0x123118['name']){delete _0x123118['name'];}_0x431ed9['status'](_0x6ba486)[_0x6702('0x31')](_0x123118);};}exports[_0x6702('0x32')]=function(_0x2c07de,_0x388544){var _0x16d6b8={},_0x2d1987={},_0xfa59bb={'count':0x0,'rows':[]};var _0x143539=_[_0x6702('0x33')](db[_0x6702('0x34')][_0x6702('0x35')],function(_0x52b70a){return{'name':_0x52b70a[_0x6702('0x36')],'type':_0x52b70a['type']['key']};});_0x2d1987[_0x6702('0x37')]=_[_0x6702('0x33')](_0x143539,_0x6702('0x38'));_0x2d1987[_0x6702('0x39')]=_[_0x6702('0x3a')](_0x2c07de['query']);_0x2d1987[_0x6702('0x3b')]=_[_0x6702('0x3c')](_0x2d1987[_0x6702('0x37')],_0x2d1987[_0x6702('0x39')]);_0x16d6b8[_0x6702('0x3d')]=_[_0x6702('0x3c')](_0x2d1987[_0x6702('0x37')],qs[_0x6702('0x3e')](_0x2c07de[_0x6702('0x39')][_0x6702('0x3e')]));_0x16d6b8[_0x6702('0x3d')]=_0x16d6b8[_0x6702('0x3d')][_0x6702('0x3f')]?_0x16d6b8[_0x6702('0x3d')]:_0x2d1987[_0x6702('0x37')];if(!_0x2c07de[_0x6702('0x39')][_0x6702('0x40')](_0x6702('0x41'))){_0x16d6b8['limit']=qs[_0x6702('0x2a')](_0x2c07de[_0x6702('0x39')][_0x6702('0x2a')]);_0x16d6b8[_0x6702('0x29')]=qs[_0x6702('0x29')](_0x2c07de[_0x6702('0x39')][_0x6702('0x29')]);}_0x16d6b8[_0x6702('0x42')]=qs['sort'](_0x2c07de[_0x6702('0x39')]['sort']);_0x16d6b8['where']=qs['filters'](_['pick'](_0x2c07de[_0x6702('0x39')],_0x2d1987[_0x6702('0x3b')]),_0x143539);if(_0x2c07de[_0x6702('0x39')][_0x6702('0x43')]){_0x16d6b8['where']=_[_0x6702('0x44')](_0x16d6b8[_0x6702('0x45')],{'$or':_[_0x6702('0x33')](_0x143539,function(_0x682fb3){if(_0x682fb3['type']!==_0x6702('0x46')){var _0x22894d={};_0x22894d[_0x682fb3['name']]={'$like':'%'+_0x2c07de[_0x6702('0x39')][_0x6702('0x43')]+'%'};return _0x22894d;}})});}_0x16d6b8=_[_0x6702('0x44')]({},_0x16d6b8,_0x2c07de['options']);var _0x3a0e37={'where':_0x16d6b8[_0x6702('0x45')]};return db['SmsMessage'][_0x6702('0x28')](_0x3a0e37)[_0x6702('0x30')](function(_0x23deb2){_0xfa59bb[_0x6702('0x28')]=_0x23deb2;if(_0x2c07de[_0x6702('0x39')]['includeAll']){_0x16d6b8[_0x6702('0x47')]=[{'all':!![]}];}return db[_0x6702('0x34')]['findAll'](_0x16d6b8);})['then'](function(_0x2921c5){_0xfa59bb['rows']=_0x2921c5;return _0xfa59bb;})[_0x6702('0x30')](respondWithFilteredResult(_0x388544,_0x16d6b8))[_0x6702('0x23')](handleError(_0x388544,null));};exports[_0x6702('0x48')]=function(_0x5342d2,_0x3434a3){var _0x1fbde8={'raw':!![],'where':{'id':_0x5342d2[_0x6702('0x49')]['id']}},_0x5793bb={};_0x5793bb[_0x6702('0x37')]=_[_0x6702('0x3a')](db[_0x6702('0x34')][_0x6702('0x35')]);_0x5793bb[_0x6702('0x39')]=_[_0x6702('0x3a')](_0x5342d2[_0x6702('0x39')]);_0x5793bb[_0x6702('0x3b')]=_[_0x6702('0x3c')](_0x5793bb[_0x6702('0x37')],_0x5793bb['query']);_0x1fbde8[_0x6702('0x3d')]=_[_0x6702('0x3c')](_0x5793bb['model'],qs[_0x6702('0x3e')](_0x5342d2[_0x6702('0x39')][_0x6702('0x3e')]));_0x1fbde8[_0x6702('0x3d')]=_0x1fbde8[_0x6702('0x3d')][_0x6702('0x3f')]?_0x1fbde8[_0x6702('0x3d')]:_0x5793bb[_0x6702('0x37')];if(_0x5342d2[_0x6702('0x39')][_0x6702('0x4a')]){_0x1fbde8[_0x6702('0x47')]=[{'all':!![]}];}_0x1fbde8=_[_0x6702('0x44')]({},_0x1fbde8,_0x5342d2[_0x6702('0x4b')]);return db[_0x6702('0x34')][_0x6702('0x4c')](_0x1fbde8)[_0x6702('0x30')](handleEntityNotFound(_0x3434a3,null))[_0x6702('0x30')](respondWithResult(_0x3434a3,null))[_0x6702('0x23')](handleError(_0x3434a3,null));};exports[_0x6702('0x4d')]=function(_0x34e9f3,_0x585637){return db[_0x6702('0x34')][_0x6702('0x4d')](_0x34e9f3['body'],{})['then'](respondWithResult(_0x585637,0xc9))[_0x6702('0x23')](handleError(_0x585637,null));};exports['update']=function(_0x5e61c9,_0x3aa338){if(_0x5e61c9[_0x6702('0x4e')]['id']){delete _0x5e61c9[_0x6702('0x4e')]['id'];}return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x5e61c9[_0x6702('0x49')]['id']}})['then'](handleEntityNotFound(_0x3aa338,null))['then'](saveUpdates(_0x5e61c9[_0x6702('0x4e')],null))[_0x6702('0x30')](respondWithResult(_0x3aa338,null))[_0x6702('0x23')](handleError(_0x3aa338,null));};exports[_0x6702('0x2f')]=function(_0x99b209,_0x4342f2){return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x99b209[_0x6702('0x49')]['id']}})[_0x6702('0x30')](handleEntityNotFound(_0x4342f2,null))[_0x6702('0x30')](removeEntity(_0x4342f2,null))[_0x6702('0x23')](handleError(_0x4342f2,null));};exports['describe']=function(_0x4a64c8,_0x411bda){return db[_0x6702('0x34')]['describe']()['then'](respondWithResult(_0x411bda,null))[_0x6702('0x23')](handleError(_0x411bda,null));};var interaction_log=require(_0x6702('0x10'))(_0x6702('0x4f'));exports['accept']=function(_0x19c4a0,_0x4a8406,_0x8c298a){var _0x181e7c={'channel':_0x6702('0x50')};if(_0x19c4a0[_0x6702('0x4e')]['id']){delete _0x19c4a0[_0x6702('0x4e')]['id'];}_0x19c4a0[_0x6702('0x4e')]['read']=!![];_0x19c4a0['body']['readAt']=moment()['format'](_0x6702('0x51'));_0x19c4a0['body']['UserId']=_0x19c4a0[_0x6702('0x4e')][_0x6702('0x52')]||_0x19c4a0[_0x6702('0x53')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x19c4a0[_0x6702('0x49')]['id'],'UserId':null},'include':[{'model':db[_0x6702('0x54')],'as':_0x6702('0x55')}]})[_0x6702('0x30')](handleEntityNotFound(_0x4a8406,null))[_0x6702('0x30')](saveUpdates(_0x19c4a0[_0x6702('0x4e')],null))[_0x6702('0x30')](function(_0x2c39fc){if(_0x2c39fc){_0x181e7c[_0x6702('0x20')]=_0x2c39fc[_0x6702('0x56')]({'plain':!![]});return db[_0x6702('0x57')][_0x6702('0x4c')]({'where':{'id':_0x2c39fc['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4a8406,null))['then'](function(_0x59c4af){if(_0x59c4af){return _0x59c4af[_0x6702('0x2e')]({'UserId':_0x19c4a0[_0x6702('0x4e')][_0x6702('0x52')],'read1stAt':_[_0x6702('0x58')](_0x59c4af[_0x6702('0x59')])?moment()[_0x6702('0x5a')](_0x6702('0x51')):undefined});}return null;})[_0x6702('0x30')](function(_0x40eed2){if(_0x40eed2){_0x181e7c[_0x6702('0x5b')]=_0x40eed2[_0x6702('0x56')]({'plain':!![]});interaction_log[_0x6702('0x21')](_0x6702('0x5c'),_0x19c4a0[_0x6702('0x53')]['id'],_0x19c4a0[_0x6702('0x53')][_0x6702('0x38')],_0x19c4a0['user'][_0x6702('0x5d')],_0x181e7c['interaction']['id'],_0x19c4a0[_0x6702('0x4e')]?JSON[_0x6702('0x1d')](_0x19c4a0[_0x6702('0x4e')]):_0x6702('0x5e'));return respondWithRpcPromise(_0x6702('0x5f'),_0x6702('0x60'),_0x181e7c);}return null;})[_0x6702('0x30')](function(_0x5bc97a){if(_0x5bc97a){if(_0x19c4a0[_0x6702('0x4e')][_0x6702('0x61')]){_0x181e7c[_0x6702('0x20')]['interface']=util[_0x6702('0x5a')](_0x6702('0x62'),_0x19c4a0[_0x6702('0x53')][_0x6702('0x38')]);_0x181e7c['message'][_0x6702('0x63')]=_0x181e7c[_0x6702('0x63')];_0x181e7c['message'][_0x6702('0x64')]=_0x6702('0x65');return respondWithRpcPromise(_0x6702('0x66'),'EventManager',{'event':_0x6702('0x67'),'message':_0x181e7c[_0x6702('0x20')]},client9002)[_0x6702('0x30')](function(){return _0x181e7c;});}return _0x181e7c;}return null;})[_0x6702('0x30')](respondWithResult(_0x4a8406,null))['catch'](handleError(_0x4a8406,null));};var interaction_log=require('../../config/logger')(_0x6702('0x4f'));exports[_0x6702('0x2d')]=function(_0x52ad9a,_0x3a1269,_0xce68b2){var _0x5eac0d={'agent':{},'channel':_0x6702('0x50')};if(_0x52ad9a['body']['id']){delete _0x52ad9a[_0x6702('0x4e')]['id'];}_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')]=_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')]||_0x52ad9a[_0x6702('0x53')]['id'];_0x5eac0d['agent']['id']=_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')];return db['SmsMessage']['find']({'where':{'id':_0x52ad9a[_0x6702('0x49')]['id'],'UserId':null}})[_0x6702('0x30')](handleEntityNotFound(_0x3a1269,null))[_0x6702('0x30')](function(_0x206e21){if(_0x206e21){_0x5eac0d['message']=_0x206e21[_0x6702('0x56')]({'plain':!![]});return db[_0x6702('0x57')][_0x6702('0x4c')]({'where':{'id':_0x206e21[_0x6702('0x68')]}});}return null;})[_0x6702('0x30')](handleEntityNotFound(_0x3a1269,null))[_0x6702('0x30')](function(_0x5158ce){if(_0x5158ce){_0x5eac0d[_0x6702('0x5b')]=_0x5158ce[_0x6702('0x56')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52ad9a['user']['id'],_0x52ad9a['user'][_0x6702('0x38')],_0x52ad9a[_0x6702('0x53')][_0x6702('0x5d')],_0x5eac0d['interaction']['id'],_0x52ad9a[_0x6702('0x4e')]?JSON['stringify'](_0x52ad9a[_0x6702('0x4e')]):_0x6702('0x5e'));return respondWithRpcPromise(_0x6702('0x69'),_0x6702('0x6a'),_0x5eac0d);}return null;})['then'](function(_0x308aa8){if(_0x308aa8){_0x308aa8[_0x6702('0x20')][_0x6702('0x6b')]=util['format'](_0x6702('0x62'),_0x52ad9a[_0x6702('0x53')][_0x6702('0x38')]);_0x308aa8[_0x6702('0x20')]['channel']=_0x5eac0d[_0x6702('0x63')];_0x308aa8[_0x6702('0x20')][_0x6702('0x64')]=_0x6702('0x2d');respondWithRpcPromise(_0x6702('0x66'),_0x6702('0x66'),{'event':_0x6702('0x6c'),'message':_0x308aa8[_0x6702('0x20')]},client9002);return _0x5eac0d;}return null;})[_0x6702('0x30')](respondWithResult(_0x3a1269,null))['catch'](handleError(_0x3a1269,null));};exports[_0x6702('0x26')]=function(_0x447bb6,_0x11016d,_0x5206cc){if(_0x447bb6[_0x6702('0x4e')]['id']){delete _0x447bb6[_0x6702('0x4e')]['id'];}var _0x183c29;return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x447bb6[_0x6702('0x49')]['id']}})['then'](handleEntityNotFound(_0x11016d,null))[_0x6702('0x30')](function(_0x108c3e){if(_0x108c3e){_0x183c29=_0x108c3e;return db[_0x6702('0x6d')][_0x6702('0x4c')]({'where':{'id':_0x108c3e['SmsAccountId']}});}})[_0x6702('0x30')](handleEntityNotFound(_0x11016d,null))[_0x6702('0x30')](function(_0x27d67d){if(_0x27d67d){logger[_0x6702('0x1c')](_0x6702('0x6e'),_0x6702('0x26'),_0x6702('0x6f'),_0x27d67d[_0x6702('0x70')],util[_0x6702('0x71')](_0x447bb6[_0x6702('0x4e')],{'showHidden':![],'depth':null}));switch(_0x27d67d[_0x6702('0x70')]){case _0x6702('0x72'):if(_0x447bb6[_0x6702('0x4e')][_0x6702('0x73')]&&_0x447bb6[_0x6702('0x4e')][_0x6702('0x73')]===_0x183c29[_0x6702('0x74')]){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger[_0x6702('0x1e')](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x72'),util[_0x6702('0x71')](_0x447bb6['body'],{'showHidden':![],'depth':null}));}break;case _0x6702('0x76'):if(_0x447bb6[_0x6702('0x4e')][_0x6702('0x77')]&&_0x447bb6['body'][_0x6702('0x77')]===_0x183c29[_0x6702('0x74')]&&_[_0x6702('0x78')]([_0x6702('0x79'),'delivered'],_0x447bb6['body']['Status'])>=0x0){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger['error'](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x7a'),util[_0x6702('0x71')](_0x447bb6[_0x6702('0x4e')],{'showHidden':![],'depth':null}));}break;case _0x6702('0x7b'):var _0x3dbde7=_0x447bb6[_0x6702('0x4e')][_0x6702('0x7c')][0x0];if(_0x3dbde7['status'][_0x6702('0x7d')]==='DELIVERED'){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger[_0x6702('0x1e')](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x7b'),util[_0x6702('0x71')](_0x447bb6['body'],{'showHidden':![],'depth':null}));}break;}return _0x183c29;}})['then'](respondWithResult(_0x11016d,null))[_0x6702('0x23')](handleError(_0x11016d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 94caf70..7533004 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 _0x30e7=['exports','events','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30e7,0x12d));var _0x730e=function(_0x243c79,_0x27b2cc){_0x243c79=_0x243c79-0x0;var _0x55a0d6=_0x30e7[_0x243c79];return _0x55a0d6;};'use strict';var EventEmitter=require(_0x730e('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x730e('0x1')](0x0);var events={'afterCreate':_0x730e('0x2'),'afterUpdate':_0x730e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3bfa3d){return function(_0x295a47,_0xf546dd,_0x33dc1a){SmsMessageEvents[_0x730e('0x4')](_0x3bfa3d+':'+_0x295a47['id'],_0x295a47);SmsMessageEvents[_0x730e('0x4')](_0x3bfa3d,_0x295a47);_0x33dc1a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x730e('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x0d8c=['update','remove','emit','exports','events','../../mysqldb','save'];(function(_0x3e4a22,_0x2f9159){var _0x11fa59=function(_0x530512){while(--_0x530512){_0x3e4a22['push'](_0x3e4a22['shift']());}};_0x11fa59(++_0x2f9159);}(_0x0d8c,0x89));var _0xc0d8=function(_0x1c13d7,_0x47be22){_0x1c13d7=_0x1c13d7-0x0;var _0x59b6ce=_0x0d8c[_0x1c13d7];return _0x59b6ce;};'use strict';var EventEmitter=require(_0xc0d8('0x0'));var SmsMessage=require(_0xc0d8('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc0d8('0x2'),'afterUpdate':_0xc0d8('0x3'),'afterDestroy':_0xc0d8('0x4')};function emitEvent(_0x592007){return function(_0x5999f4,_0x111d5b,_0x29a50f){SmsMessageEvents[_0xc0d8('0x5')](_0x592007+':'+_0x5999f4['id'],_0x5999f4);SmsMessageEvents[_0xc0d8('0x5')](_0x592007,_0x5999f4);_0x29a50f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc0d8('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index cd4c8a7..cdf7195 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 _0x0e76=['sender','login?username=','&password=','GET','POST','session_key','total_sent','internal_order_id','deliveryReport','connectel','senderString','requestid','read','clicksend','password','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','http_code','data','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','/status?token=','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','body','remote','/api/sms/messages/','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0e76,0x1a4));var _0x60e7=function(_0x5ef70d,_0x1b14c0){_0x5ef70d=_0x5ef70d-0x0;var _0x307667=_0x0e76[_0x5ef70d];return _0x307667;};'use strict';var _=require('lodash');var util=require(_0x60e7('0x0'));var logger=require(_0x60e7('0x1'))(_0x60e7('0x2'));var moment=require(_0x60e7('0x3'));var BPromise=require(_0x60e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60e7('0x5'));var rimraf=require(_0x60e7('0x6'));var config=require(_0x60e7('0x7'));var attributes=require(_0x60e7('0x8'));module[_0x60e7('0x9')]=function(_0x385d02,_0x45c725){return _0x385d02[_0x60e7('0xa')](_0x60e7('0xb'),attributes,{'tableName':_0x60e7('0xc'),'paranoid':![],'indexes':[{'name':_0x60e7('0xd'),'fields':['messageId']},{'name':_0x60e7('0xe'),'fields':['body'],'type':_0x60e7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27c2cb,_0x1e3be0,_0x13f888){var _0xf66c8f=_0x385d02['models'];var _0x2aace6=_0x27c2cb[_0x60e7('0x10')]({'plain':!![]});if(_0x2aace6[_0x60e7('0x11')]['toLowerCase']()==='in'||_0x2aace6[_0x60e7('0x11')][_0x60e7('0x12')]()===_0x60e7('0x13')&&!_0x2aace6[_0x60e7('0x14')]&&!_[_0x60e7('0x15')](_0x2aace6[_0x60e7('0x16')])){_0xf66c8f[_0x60e7('0x17')][_0x60e7('0x18')]({'where':{'id':_0x2aace6[_0x60e7('0x19')]}})[_0x60e7('0x1a')](function(_0x30deab){if(_0x30deab){_0x30deab['update']({'lastMsgAt':_0x2aace6[_0x60e7('0x1b')],'lastMsgDirection':_0x2aace6[_0x60e7('0x11')]['toLowerCase']()});}})['catch'](function(_0x48c4ab){console[_0x60e7('0x1c')](_0x48c4ab);});}if(_0x2aace6[_0x60e7('0x11')]===_0x60e7('0x13')&&!_0x2aace6[_0x60e7('0x14')]){var _0x21b05b;_0xf66c8f[_0x60e7('0x1d')][_0x60e7('0x1e')]({'where':{'id':_0x2aace6[_0x60e7('0x1f')]},'raw':!![]})['then'](function(_0x3c15af){_0x21b05b=_0x3c15af;if(_0x21b05b&&_0x21b05b[_0x60e7('0x20')]){switch(_0x21b05b[_0x60e7('0x20')]){case'twilio':var _0x390801=require(_0x60e7('0x21'));if(_0x21b05b[_0x60e7('0x22')]&&_0x21b05b[_0x60e7('0x23')]&&_0x21b05b[_0x60e7('0x24')]){var _0xb7585=new _0x390801(_0x21b05b[_0x60e7('0x22')],_0x21b05b['authToken']);_0xb7585['messages'][_0x60e7('0x25')]({'body':_0x2aace6[_0x60e7('0x26')],'to':_0x2aace6['phone'],'from':_0x21b05b[_0x60e7('0x24')],'statusCallback':_0x21b05b[_0x60e7('0x27')]+_0x60e7('0x28')+_0x2aace6['id']+'/status?token='+_0x21b05b[_0x60e7('0x29')]})['then'](function(_0x804606){if(_0x804606[_0x60e7('0x2a')]){return _0x27c2cb[_0x60e7('0x2b')]({'messageId':_0x804606[_0x60e7('0x2a')]});}})[_0x60e7('0x2c')](function(_0x1b25cf){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x21'),util[_0x60e7('0x2e')](_0x1b25cf,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x60e7('0x30'):var _0x51a8fd=_0x60e7('0x31');if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b['password']){var _0x33ca67={'recipient':[_0x2aace6['phone']],'message':_0x2aace6[_0x60e7('0x26')],'message_type':_0x21b05b[_0x60e7('0x33')]};if(_0x21b05b[_0x60e7('0x33')]&&_0x21b05b[_0x60e7('0x33')]!=='SI'){_0x33ca67[_0x60e7('0x34')]=_0x21b05b['phone'];}var _0x23a7f9={'url':_0x51a8fd+_0x60e7('0x35')+_0x21b05b[_0x60e7('0x32')]+_0x60e7('0x36')+_0x21b05b['password'],'method':_0x60e7('0x37')};rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x5690ce){var _0x1bd332=_0x5690ce['split'](';');var _0x44477f={'user_key':_0x1bd332[0x0],'session_key':_0x1bd332[0x1]};_0x23a7f9={'url':_0x51a8fd+'sms','method':_0x60e7('0x38'),'headers':{'user_key':_0x44477f['user_key'],'Session_key':_0x44477f[_0x60e7('0x39')]},'json':!![],'body':_0x33ca67};return rp(_0x23a7f9);})[_0x60e7('0x1a')](function(_0xe2de17){if(_0xe2de17[_0x60e7('0x3a')]>=0x1){var _0x423dcc={'messageId':_0xe2de17[_0x60e7('0x3b')]};if(_0x21b05b['smsMethod']!=='GP'||!_0x21b05b[_0x60e7('0x3c')]){_0x423dcc['read']=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x423dcc);}else{return logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),'skebby',util['inspect'](_0xe2de17,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x4f0314){return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),_0x60e7('0x30'),util[_0x60e7('0x2e')](_0x4f0314,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x60e7('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x60e7('0x3d'):if(_0x21b05b[_0x60e7('0x23')]){var _0x349961={'recipient':_0x2aace6[_0x60e7('0x24')],'message':_0x2aace6[_0x60e7('0x26')],'sender':_0x21b05b[_0x60e7('0x3e')]||_0x21b05b[_0x60e7('0x24')],'authorization':_0x21b05b[_0x60e7('0x23')]};var _0x1e3be0={'method':_0x60e7('0x38'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x349961,'json':!![]};rp(_0x1e3be0)[_0x60e7('0x1a')](function(_0x4e0893){var _0x29205e={'messageId':_0x4e0893[_0x60e7('0x3f')]};if(!_0x21b05b['deliveryReport']){_0x29205e[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x29205e);})[_0x60e7('0x2c')](function(_0x5444dc){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x3d'),util['inspect'](_0x5444dc,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0x60e7('0x41'):if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b[_0x60e7('0x42')]){var _0x349961={'messages':[{'source':_0x60e7('0x43'),'to':_0x2aace6[_0x60e7('0x24')],'body':_0x2aace6[_0x60e7('0x26')],'from':_0x21b05b[_0x60e7('0x3e')]||_0x21b05b[_0x60e7('0x24')]}]};var _0x31bed4=util['format'](_0x60e7('0x44'),_0x21b05b[_0x60e7('0x32')],_0x21b05b[_0x60e7('0x42')]);var _0x1e3be0={'method':_0x60e7('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x349961,'headers':{'Authorization':util[_0x60e7('0x45')](_0x60e7('0x46'),new Buffer(_0x31bed4)[_0x60e7('0x47')]('base64'))},'json':!![]};rp(_0x1e3be0)['then'](function(_0x47da53){if(_0x47da53[_0x60e7('0x48')]>=0xc8&&_0x47da53[_0x60e7('0x48')]<=0xce){if(_0x47da53['data']&&_0x47da53[_0x60e7('0x49')]['queued_count']>0x0){var _0x18b73d=_['head'](_0x47da53[_0x60e7('0x49')][_0x60e7('0x4a')]);var _0x28de11={'messageId':_0x18b73d[_0x60e7('0x4b')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0x28de11[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x28de11);}else{logger['error'](_0x60e7('0x2d'),'afterCreate','clickSend',util[_0x60e7('0x2e')](_0x47da53,{'showHidden':![],'depth':null}));}}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'clickSend',util[_0x60e7('0x2e')](_0x47da53,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x4a41d0){logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x4c'),util[_0x60e7('0x2e')](_0x4a41d0,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','clickSend',_0x60e7('0x4d'));}break;case'plivo':if(_0x21b05b['authId']&&_0x21b05b[_0x60e7('0x23')]){var _0x349961={'dst':_0x2aace6['phone'],'text':_0x2aace6[_0x60e7('0x26')],'src':_0x21b05b['senderString']||_0x21b05b[_0x60e7('0x24')],'url':_0x21b05b[_0x60e7('0x27')]+'/api/sms/messages/'+_0x2aace6['id']+_0x60e7('0x4e')+_0x21b05b['token']};var _0x31bed4=util[_0x60e7('0x45')](_0x60e7('0x44'),_0x21b05b['authId'],_0x21b05b['authToken']);var _0x1e3be0={'method':_0x60e7('0x38'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x21b05b['authId']),'body':_0x349961,'headers':{'Authorization':util[_0x60e7('0x45')](_0x60e7('0x46'),new Buffer(_0x31bed4)['toString'](_0x60e7('0x4f')))},'json':!![]};rp(_0x1e3be0)[_0x60e7('0x1a')](function(_0x45df7a){var _0x15fad9={'messageId':_0x45df7a[_0x60e7('0x50')][0x0]};return _0x27c2cb[_0x60e7('0x2b')](_0x15fad9);})[_0x60e7('0x2c')](function(_0x4d5531){logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x51'),util[_0x60e7('0x2e')](_0x4d5531,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x51'),_0x60e7('0x52'));}break;case _0x60e7('0x53'):if(_0x21b05b[_0x60e7('0x32')]&&_0x21b05b[_0x60e7('0x42')]){if(_0x21b05b[_0x60e7('0x54')]){var _0x19eb1a={'method':_0x60e7('0x38'),'uri':_0x21b05b[_0x60e7('0x54')]+_0x60e7('0x55'),'body':{'username':_0x21b05b[_0x60e7('0x32')],'password':_0x21b05b[_0x60e7('0x42')]},'json':!![]};return rp(_0x19eb1a)[_0x60e7('0x1a')](function(_0x52c4bc){var _0x17f9bc={'method':_0x60e7('0x38'),'uri':_0x21b05b[_0x60e7('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x21b05b['phone'],'destinations':[{'to':_0x2aace6[_0x60e7('0x24')]}],'text':_0x2aace6['body'],'notifyUrl':_0x21b05b[_0x60e7('0x27')]+_0x60e7('0x28')+_0x2aace6['id']+_0x60e7('0x4e')+_0x21b05b[_0x60e7('0x29')],'notifyContentType':_0x60e7('0x56'),'callbackData':_0x21b05b[_0x60e7('0x24')]+';'+_0x2aace6[_0x60e7('0x26')]}]},'headers':{'Authorization':_0x60e7('0x57')+_0x52c4bc[_0x60e7('0x29')]},'json':!![]};return rp(_0x17f9bc)['then'](function(_0x5e0791){if(_0x5e0791[_0x60e7('0x4a')]){var _0x187d95={'messageId':_0x5e0791[_0x60e7('0x4a')][0x0][_0x60e7('0xd')]};if(!_0x21b05b['deliveryReport']){_0x187d95[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x187d95);}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate',_0x60e7('0x53'),util[_0x60e7('0x2e')](_0x5e0791,{'showHidden':![],'depth':null}));}});})[_0x60e7('0x2c')](function(_0x47d2fd){return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x53'),util[_0x60e7('0x2e')](_0x47d2fd,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'infobip',_0x60e7('0x58'));}}else{logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),_0x60e7('0x53'),_0x60e7('0x4d'));}break;case _0x60e7('0x59'):var _0x5bee41=require('crypto');if(_0x21b05b[_0x60e7('0x5a')]){var _0x162e82={};_0x162e82[_0x60e7('0x5b')]=_0x21b05b['username'];_0x162e82[_0x60e7('0x24')]=_0x2aace6[_0x60e7('0x24')];_0x162e82[_0x60e7('0x34')]=_0x21b05b[_0x60e7('0x24')];_0x162e82[_0x60e7('0x5c')]=_0x2aace6[_0x60e7('0x26')];_0x162e82[_0x60e7('0x5d')]=+new Date();var _0x2d4a35='';var _0x2f589f='';var _0x1fdbcc=Object['keys'](_0x162e82);_0x1fdbcc[_0x60e7('0x5e')]();for(var _0x3822f5=0x0;_0x3822f5<_0x1fdbcc[_0x60e7('0x5f')];_0x3822f5++){if(_0x2d4a35!=''){_0x2d4a35+='&';}_0x2d4a35+=_0x1fdbcc[_0x3822f5]+'='+encodeURIComponent(_0x162e82[_0x1fdbcc[_0x3822f5]]);_0x2f589f+=_0x162e82[_0x1fdbcc[_0x3822f5]];}_0x2f589f+=_0x21b05b['apiKey'];_0x2f589f=_0x5bee41[_0x60e7('0x60')](_0x60e7('0x61'))[_0x60e7('0x2b')](_0x2f589f)[_0x60e7('0x62')](_0x60e7('0x63'));if(_0x2d4a35!==''){_0x2d4a35+='&';}_0x2d4a35+=_0x60e7('0x64')+_0x2f589f;var _0x23a7f9={'method':'GET','uri':_0x21b05b[_0x60e7('0x54')]+'/external/get/send.php?'+_0x2d4a35,'json':!![]};return rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x2f6dc4){var _0x3402ce=Object[_0x60e7('0x65')](_0x2f6dc4);if(_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x1c')]&&parseInt(_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x1c')])===0x0){var _0xb0af1c={'messageId':_0x2f6dc4[_0x3402ce[0x0]][_0x60e7('0x66')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0xb0af1c[_0x60e7('0x40')]=!![];}return _0x27c2cb['update'](_0xb0af1c);}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x59'),util[_0x60e7('0x2e')](_0x2f6dc4[_0x60e7('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a8c1a){return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','csc',util['inspect'](_0x2a8c1a,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x59'),_0x60e7('0x67'));}break;case _0x60e7('0x68'):if(_0x21b05b[_0x60e7('0x5a')]){var _0x5563d1={'method':_0x60e7('0x38'),'uri':_0x60e7('0x69'),'headers':{'Authorization':_0x21b05b[_0x60e7('0x5a')]},'body':{'content':_0x2aace6['body'],'to':[_0x2aace6['phone']],'from':_0x21b05b[_0x60e7('0x24')],'binary':![],'clientMessageId':_0x60e7('0x6a'),'charset':_0x60e7('0x6b')},'json':!![]};rp(_0x5563d1)[_0x60e7('0x1a')](function(_0x2a1adf){if(!_0x2a1adf[_0x60e7('0x1c')]){var _0x46e490={'messageId':_0x2a1adf[_0x60e7('0x4a')][0x0][_0x60e7('0x6c')]};if(!_0x21b05b[_0x60e7('0x3c')]){_0x46e490[_0x60e7('0x40')]=!![];}return _0x27c2cb[_0x60e7('0x2b')](_0x46e490);}else{return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x60e7('0x2f'),'clickatell',util[_0x60e7('0x2e')](_0x2a1adf[_0x60e7('0x1c')],{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x28b370){return logger['error'](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x68'),util[_0x60e7('0x2e')](_0x28b370,{'showHidden':![],'depth':null}));});}else{logger[_0x60e7('0x1c')](_0x60e7('0x2d'),'afterCreate','clickatell',_0x60e7('0x67'));}break;case _0x60e7('0x6d'):if(_0x21b05b[_0x60e7('0x5a')]){var _0x287f35={};var _0x23a7f9={'method':_0x60e7('0x38'),'uri':_0x60e7('0x6e'),'headers':{'Authorization':_0x60e7('0x6f')+_0x21b05b[_0x60e7('0x5a')],'Content-Type':'application/json'},'body':{'from':_0x21b05b['phone'],'to':_0x2aace6['phone'],'text':_0x2aace6['body']},'json':!![]};return rp(_0x23a7f9)[_0x60e7('0x1a')](function(_0x229de5){if(_0x229de5['code']==0xca){_0x287f35['message']=_0x229de5;var _0x71b90={'method':_0x60e7('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x60e7('0x6f')+_0x21b05b[_0x60e7('0x5a')],'Content-Type':_0x60e7('0x56')},'body':{'refid':_0x287f35[_0x60e7('0x70')][_0x60e7('0x71')]},'json':!![]};return rp(_0x71b90)[_0x60e7('0x1a')](function(_0x21ab5f){_0x287f35[_0x60e7('0x72')]=_0x21ab5f;var _0x24c01c={'messageId':_0x287f35['message'][_0x60e7('0x71')],'read':!![]};return _0x27c2cb['update'](_0x24c01c);});}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),_0x60e7('0x6d'),util[_0x60e7('0x2e')](_0x229de5,{'showHidden':![],'depth':null}));}})[_0x60e7('0x2c')](function(_0x5458e4){return logger[_0x60e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x60e7('0x2e')](_0x5458e4,{'showHidden':![],'depth':null}));});}else{return logger[_0x60e7('0x1c')](_0x60e7('0x2d'),_0x60e7('0x2f'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x60e7('0x73')](function(){_0x13f888();});}else{_0x13f888();}}},'charset':_0x60e7('0x74'),'collate':_0x60e7('0x75')});}; \ No newline at end of file +var _0x193f=['fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','SmsInteractionId','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','GET','split','POST','user_key','session_key','then','total_sent','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','plivo','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','hex','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId'];(function(_0x11be93,_0x4a816d){var _0x4438b7=function(_0x59c882){while(--_0x59c882){_0x11be93['push'](_0x11be93['shift']());}};_0x4438b7(++_0x4a816d);}(_0x193f,0xd6));var _0xf193=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x193f[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0xf193('0x0'));var util=require(_0xf193('0x1'));var logger=require('../../config/logger')(_0xf193('0x2'));var moment=require(_0xf193('0x3'));var BPromise=require('bluebird');var rp=require(_0xf193('0x4'));var fs=require('fs');var path=require(_0xf193('0x5'));var rimraf=require('rimraf');var config=require(_0xf193('0x6'));var attributes=require(_0xf193('0x7'));module[_0xf193('0x8')]=function(_0x2e6e85,_0x15e2be){return _0x2e6e85[_0xf193('0x9')]('SmsMessage',attributes,{'tableName':_0xf193('0xa'),'paranoid':![],'indexes':[{'name':_0xf193('0xb'),'fields':['messageId']},{'name':_0xf193('0xc'),'fields':[_0xf193('0xd')],'type':_0xf193('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27a2df,_0xa46f89,_0x1e32fe){var _0x3d5a24=_0x2e6e85[_0xf193('0xf')];var _0x380d7c=_0x27a2df[_0xf193('0x10')]({'plain':!![]});if(_0x380d7c[_0xf193('0x11')][_0xf193('0x12')]()==='in'||_0x380d7c['direction'][_0xf193('0x12')]()===_0xf193('0x13')&&!_0x380d7c['secret']&&!_['isNil'](_0x380d7c[_0xf193('0x14')])){_0x3d5a24['SmsInteraction'][_0xf193('0x15')]({'where':{'id':_0x380d7c[_0xf193('0x16')]}})['then'](function(_0x54d087){if(_0x54d087){_0x54d087['update']({'lastMsgAt':_0x380d7c[_0xf193('0x17')],'lastMsgDirection':_0x380d7c[_0xf193('0x11')]['toLowerCase']()});}})[_0xf193('0x18')](function(_0x29fd83){console[_0xf193('0x19')](_0x29fd83);});}if(_0x380d7c[_0xf193('0x11')]===_0xf193('0x13')&&!_0x380d7c[_0xf193('0x1a')]){var _0x17a727;_0x3d5a24[_0xf193('0x1b')][_0xf193('0x1c')]({'where':{'id':_0x380d7c[_0xf193('0x1d')]},'raw':!![]})['then'](function(_0x28cbf5){_0x17a727=_0x28cbf5;if(_0x17a727&&_0x17a727['type']){switch(_0x17a727[_0xf193('0x1e')]){case _0xf193('0x1f'):var _0x5bcaca=require(_0xf193('0x1f'));if(_0x17a727[_0xf193('0x20')]&&_0x17a727['authToken']&&_0x17a727[_0xf193('0x21')]){var _0x28ef71=new _0x5bcaca(_0x17a727[_0xf193('0x20')],_0x17a727[_0xf193('0x22')]);_0x28ef71[_0xf193('0x23')][_0xf193('0x24')]({'body':_0x380d7c[_0xf193('0xd')],'to':_0x380d7c['phone'],'from':_0x17a727['phone'],'statusCallback':_0x17a727['remote']+_0xf193('0x25')+_0x380d7c['id']+'/status?token='+_0x17a727[_0xf193('0x26')]})['then'](function(_0x59cea0){if(_0x59cea0['sid']){return _0x27a2df['update']({'messageId':_0x59cea0[_0xf193('0x27')]});}})[_0xf193('0x18')](function(_0x315805){logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x1f'),util[_0xf193('0x2a')](_0x315805,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x1f'),_0xf193('0x2b'));}break;case _0xf193('0x2c'):var _0x2600e6='https://api.skebby.it/API/v1.0/REST/';if(_0x17a727[_0xf193('0x2d')]&&_0x17a727[_0xf193('0x2e')]){var _0x1e02a5={'recipient':[_0x380d7c[_0xf193('0x21')]],'message':_0x380d7c[_0xf193('0xd')],'message_type':_0x17a727[_0xf193('0x2f')]};if(_0x17a727[_0xf193('0x2f')]&&_0x17a727[_0xf193('0x2f')]!=='SI'){_0x1e02a5[_0xf193('0x30')]=_0x17a727[_0xf193('0x21')];}var _0x100ed4={'url':_0x2600e6+'login?username='+_0x17a727[_0xf193('0x2d')]+'&password='+_0x17a727[_0xf193('0x2e')],'method':_0xf193('0x31')};rp(_0x100ed4)['then'](function(_0x54471f){var _0x32c1bc=_0x54471f[_0xf193('0x32')](';');var _0x3a1a3f={'user_key':_0x32c1bc[0x0],'session_key':_0x32c1bc[0x1]};_0x100ed4={'url':_0x2600e6+'sms','method':_0xf193('0x33'),'headers':{'user_key':_0x3a1a3f[_0xf193('0x34')],'Session_key':_0x3a1a3f[_0xf193('0x35')]},'json':!![],'body':_0x1e02a5};return rp(_0x100ed4);})[_0xf193('0x36')](function(_0x2f1f0b){if(_0x2f1f0b[_0xf193('0x37')]>=0x1){var _0x10fc54={'messageId':_0x2f1f0b['internal_order_id']};if(_0x17a727['smsMethod']!=='GP'||!_0x17a727[_0xf193('0x38')]){_0x10fc54[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x10fc54);}else{return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x2c'),util[_0xf193('0x2a')](_0x2f1f0b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x37c1f0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),'skebby',util[_0xf193('0x2a')](_0x37c1f0,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x2c'),_0xf193('0x3b'));}break;case _0xf193('0x3c'):if(_0x17a727[_0xf193('0x22')]){var _0x5086f1={'recipient':_0x380d7c[_0xf193('0x21')],'message':_0x380d7c['body'],'sender':_0x17a727[_0xf193('0x3d')]||_0x17a727[_0xf193('0x21')],'authorization':_0x17a727[_0xf193('0x22')]};var _0xa46f89={'method':'POST','uri':_0xf193('0x3e'),'body':_0x5086f1,'json':!![]};rp(_0xa46f89)[_0xf193('0x36')](function(_0x1d9a67){var _0x5df67e={'messageId':_0x1d9a67[_0xf193('0x3f')]};if(!_0x17a727[_0xf193('0x38')]){_0x5df67e[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x5df67e);})['catch'](function(_0x57e189){logger['error'](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x3c'),util[_0xf193('0x2a')](_0x57e189,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x3c'),_0xf193('0x40'));}break;case'clicksend':if(_0x17a727['username']&&_0x17a727[_0xf193('0x2e')]){var _0x5086f1={'messages':[{'source':_0xf193('0x41'),'to':_0x380d7c['phone'],'body':_0x380d7c[_0xf193('0xd')],'from':_0x17a727[_0xf193('0x3d')]||_0x17a727[_0xf193('0x21')]}]};var _0x2b440f=util[_0xf193('0x42')](_0xf193('0x43'),_0x17a727[_0xf193('0x2d')],_0x17a727['password']);var _0xa46f89={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5086f1,'headers':{'Authorization':util[_0xf193('0x42')](_0xf193('0x44'),new Buffer(_0x2b440f)[_0xf193('0x45')](_0xf193('0x46')))},'json':!![]};rp(_0xa46f89)['then'](function(_0x237954){if(_0x237954['http_code']>=0xc8&&_0x237954[_0xf193('0x47')]<=0xce){if(_0x237954['data']&&_0x237954['data'][_0xf193('0x48')]>0x0){var _0x2977b9=_['head'](_0x237954[_0xf193('0x49')][_0xf193('0x23')]);var _0x1b85cc={'messageId':_0x2977b9[_0xf193('0x4a')]};if(!_0x17a727[_0xf193('0x38')]){_0x1b85cc[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x1b85cc);}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x237954,{'showHidden':![],'depth':null}));}}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x237954,{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x324b01){logger['error'](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x324b01,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0xf193('0x3b'));}break;case _0xf193('0x4c'):if(_0x17a727['authId']&&_0x17a727[_0xf193('0x22')]){var _0x5086f1={'dst':_0x380d7c[_0xf193('0x21')],'text':_0x380d7c[_0xf193('0xd')],'src':_0x17a727['senderString']||_0x17a727['phone'],'url':_0x17a727['remote']+'/api/sms/messages/'+_0x380d7c['id']+_0xf193('0x4d')+_0x17a727[_0xf193('0x26')]};var _0x2b440f=util[_0xf193('0x42')](_0xf193('0x43'),_0x17a727[_0xf193('0x4e')],_0x17a727[_0xf193('0x22')]);var _0xa46f89={'method':_0xf193('0x33'),'uri':util[_0xf193('0x42')](_0xf193('0x4f'),_0x17a727[_0xf193('0x4e')]),'body':_0x5086f1,'headers':{'Authorization':util[_0xf193('0x42')]('Basic\x20%s',new Buffer(_0x2b440f)[_0xf193('0x45')](_0xf193('0x46')))},'json':!![]};rp(_0xa46f89)[_0xf193('0x36')](function(_0x17c062){var _0x2fece0={'messageId':_0x17c062[_0xf193('0x50')][0x0]};return _0x27a2df['update'](_0x2fece0);})[_0xf193('0x18')](function(_0x5a7d89){logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x4c'),util[_0xf193('0x2a')](_0x5a7d89,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf193('0x51'):if(_0x17a727['username']&&_0x17a727['password']){if(_0x17a727[_0xf193('0x52')]){var _0x51769c={'method':_0xf193('0x33'),'uri':_0x17a727['baseUrl']+'/auth/1/session','body':{'username':_0x17a727[_0xf193('0x2d')],'password':_0x17a727[_0xf193('0x2e')]},'json':!![]};return rp(_0x51769c)[_0xf193('0x36')](function(_0x42ef93){var _0x13772e={'method':_0xf193('0x33'),'uri':_0x17a727['baseUrl']+_0xf193('0x53'),'body':{'messages':[{'from':_0x17a727[_0xf193('0x21')],'destinations':[{'to':_0x380d7c[_0xf193('0x21')]}],'text':_0x380d7c[_0xf193('0xd')],'notifyUrl':_0x17a727[_0xf193('0x54')]+'/api/sms/messages/'+_0x380d7c['id']+'/status?token='+_0x17a727[_0xf193('0x26')],'notifyContentType':_0xf193('0x55'),'callbackData':_0x17a727[_0xf193('0x21')]+';'+_0x380d7c[_0xf193('0xd')]}]},'headers':{'Authorization':_0xf193('0x56')+_0x42ef93[_0xf193('0x26')]},'json':!![]};return rp(_0x13772e)[_0xf193('0x36')](function(_0x33ee7a){if(_0x33ee7a[_0xf193('0x23')]){var _0x328153={'messageId':_0x33ee7a[_0xf193('0x23')][0x0][_0xf193('0xb')]};if(!_0x17a727[_0xf193('0x38')]){_0x328153[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x328153);}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x51'),util[_0xf193('0x2a')](_0x33ee7a,{'showHidden':![],'depth':null}));}});})[_0xf193('0x18')](function(_0x441ad5){return logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x51'),util[_0xf193('0x2a')](_0x441ad5,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'infobip',_0xf193('0x57'));}}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x51'),_0xf193('0x3b'));}break;case _0xf193('0x58'):var _0x4a1c7c=require('crypto');if(_0x17a727[_0xf193('0x59')]){var _0x20b15e={};_0x20b15e[_0xf193('0x5a')]=_0x17a727[_0xf193('0x2d')];_0x20b15e[_0xf193('0x21')]=_0x380d7c[_0xf193('0x21')];_0x20b15e['sender']=_0x17a727['phone'];_0x20b15e[_0xf193('0x5b')]=_0x380d7c[_0xf193('0xd')];_0x20b15e[_0xf193('0x5c')]=+new Date();var _0x4755f4='';var _0x1dd2dd='';var _0xe20da3=Object[_0xf193('0x5d')](_0x20b15e);_0xe20da3[_0xf193('0x5e')]();for(var _0x1ccc82=0x0;_0x1ccc82<_0xe20da3[_0xf193('0x5f')];_0x1ccc82++){if(_0x4755f4!=''){_0x4755f4+='&';}_0x4755f4+=_0xe20da3[_0x1ccc82]+'='+encodeURIComponent(_0x20b15e[_0xe20da3[_0x1ccc82]]);_0x1dd2dd+=_0x20b15e[_0xe20da3[_0x1ccc82]];}_0x1dd2dd+=_0x17a727[_0xf193('0x59')];_0x1dd2dd=_0x4a1c7c['createHash']('md5')[_0xf193('0x3a')](_0x1dd2dd)['digest'](_0xf193('0x60'));if(_0x4755f4!==''){_0x4755f4+='&';}_0x4755f4+='signature='+_0x1dd2dd;var _0x100ed4={'method':_0xf193('0x31'),'uri':_0x17a727[_0xf193('0x52')]+_0xf193('0x61')+_0x4755f4,'json':!![]};return rp(_0x100ed4)['then'](function(_0x35040d){var _0x1ecc9f=Object['keys'](_0x35040d);if(_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x19')]&&parseInt(_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x19')])===0x0){var _0x1e57a2={'messageId':_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x62')]};if(!_0x17a727[_0xf193('0x38')]){_0x1e57a2[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x1e57a2);}else{return logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x58'),util[_0xf193('0x2a')](_0x35040d[_0xf193('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x491930){return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),'csc',util[_0xf193('0x2a')](_0x491930,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x58'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x17a727['apiKey']){var _0x1ac2b8={'method':'POST','uri':_0xf193('0x63'),'headers':{'Authorization':_0x17a727[_0xf193('0x59')]},'body':{'content':_0x380d7c['body'],'to':[_0x380d7c['phone']],'from':_0x17a727[_0xf193('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xf193('0x64')},'json':!![]};rp(_0x1ac2b8)[_0xf193('0x36')](function(_0x48f228){if(!_0x48f228[_0xf193('0x19')]){var _0x5bc5c4={'messageId':_0x48f228[_0xf193('0x23')][0x0][_0xf193('0x65')]};if(!_0x17a727['deliveryReport']){_0x5bc5c4['read']=!![];}return _0x27a2df['update'](_0x5bc5c4);}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf193('0x66'),util[_0xf193('0x2a')](_0x48f228['error'],{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x5aa8aa){return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x66'),util['inspect'](_0x5aa8aa,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0xf193('0x67'):if(_0x17a727[_0xf193('0x59')]){var _0x35115c={};var _0x100ed4={'method':_0xf193('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf193('0x68')+_0x17a727[_0xf193('0x59')],'Content-Type':_0xf193('0x55')},'body':{'from':_0x17a727[_0xf193('0x21')],'to':_0x380d7c[_0xf193('0x21')],'text':_0x380d7c['body']},'json':!![]};return rp(_0x100ed4)['then'](function(_0x3b621f){if(_0x3b621f[_0xf193('0x69')]==0xca){_0x35115c['message']=_0x3b621f;var _0x21a743={'method':_0xf193('0x33'),'uri':_0xf193('0x6a'),'headers':{'Authorization':_0xf193('0x68')+_0x17a727[_0xf193('0x59')],'Content-Type':_0xf193('0x55')},'body':{'refid':_0x35115c[_0xf193('0x6b')][_0xf193('0x6c')]},'json':!![]};return rp(_0x21a743)[_0xf193('0x36')](function(_0x55117d){_0x35115c[_0xf193('0x6d')]=_0x55117d;var _0x178a8c={'messageId':_0x35115c[_0xf193('0x6b')][_0xf193('0x6c')],'read':!![]};return _0x27a2df[_0xf193('0x3a')](_0x178a8c);});}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x67'),util['inspect'](_0x3b621f,{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x3f7432){return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'intelepeer',util['inspect'](_0x3f7432,{'showHidden':![],'depth':null}));});}else{return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'intelepeer',_0xf193('0x6e'));}break;}}})['finally'](function(){_0x1e32fe();});}else{_0x1e32fe();}}},'charset':_0xf193('0x6f'),'collate':_0xf193('0x70')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6f97d7c..4c83ba1 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 _0x08c8=['rpc','../../config/environment','redis','defaults','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3c1348,_0x34923e){var _0x1995fd=function(_0x954685){while(--_0x954685){_0x3c1348['push'](_0x3c1348['shift']());}};_0x1995fd(++_0x34923e);}(_0x08c8,0x1bb));var _0x808c=function(_0x2a5a8d,_0x59d06c){_0x2a5a8d=_0x2a5a8d-0x0;var _0x364fd2=_0x08c8[_0x2a5a8d];return _0x364fd2;};'use strict';var _=require(_0x808c('0x0'));var util=require(_0x808c('0x1'));var moment=require(_0x808c('0x2'));var BPromise=require('bluebird');var rs=require(_0x808c('0x3'));var fs=require('fs');var Redis=require(_0x808c('0x4'));var db=require(_0x808c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x808c('0x6'))(_0x808c('0x7'));var config=require(_0x808c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x808c('0x9')]=_[_0x808c('0xa')](config[_0x808c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x808c('0xb'))[_0x808c('0xc')](socket);function respondWithRpcPromise(_0x4bc2a0,_0x29ed2e,_0x235476){return new BPromise(function(_0x3ef165,_0x294904){return client[_0x808c('0xd')](_0x4bc2a0,_0x235476)['then'](function(_0x2598d7){logger[_0x808c('0xe')](_0x808c('0xf'),_0x29ed2e,_0x808c('0x10'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29ed2e,_0x808c('0x10'),JSON[_0x808c('0x11')](_0x2598d7));if(_0x2598d7[_0x808c('0x12')]){if(_0x2598d7[_0x808c('0x12')][_0x808c('0x13')]===0x1f4){logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);return _0x294904(_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);}logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x2598d7['error'][_0x808c('0x14')]);return _0x3ef165(_0x2598d7[_0x808c('0x12')][_0x808c('0x14')]);}else{logger['info'](_0x808c('0xf'),_0x29ed2e,_0x808c('0x10'));_0x3ef165(_0x2598d7[_0x808c('0x15')][_0x808c('0x14')]);}})['catch'](function(_0x864a0e){logger[_0x808c('0x12')](_0x808c('0xf'),_0x29ed2e,_0x864a0e);_0x294904(_0x864a0e);});});}exports[_0x808c('0x16')]=function(_0x30f2e5){var _0xd758ca=this;return new Promise(function(_0xf99498,_0x100336){return db[_0x808c('0x17')][_0x808c('0x18')](_0x30f2e5[_0x808c('0x19')],{'raw':_0x30f2e5['options']?_0x30f2e5[_0x808c('0x1a')][_0x808c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3683e1){logger[_0x808c('0xe')](_0x808c('0x16'),_0x30f2e5);logger[_0x808c('0x1c')](_0x808c('0x16'),_0x30f2e5,JSON['stringify'](_0x3683e1));_0xf99498(_0x3683e1);})[_0x808c('0x1d')](function(_0x38b72b){logger[_0x808c('0x12')](_0x808c('0x16'),_0x38b72b['message'],_0x30f2e5);_0x100336(_0xd758ca[_0x808c('0x12')](0x1f4,_0x38b72b[_0x808c('0x14')]));});});}; \ No newline at end of file +var _0x449f=['localhost','socket.io-emitter','redis','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults'];(function(_0x289f73,_0xf18b3a){var _0x10f03e=function(_0x86a0a4){while(--_0x86a0a4){_0x289f73['push'](_0x289f73['shift']());}};_0x10f03e(++_0xf18b3a);}(_0x449f,0x14a));var _0xf449=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x449f[_0x28f1de];return _0x5b5dad;};'use strict';var _=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var moment=require(_0xf449('0x2'));var BPromise=require(_0xf449('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf449('0x4'));var db=require(_0xf449('0x5'))['db'];var utils=require(_0xf449('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf449('0x7'));var jayson=require(_0xf449('0x8'));var client=jayson['client'][_0xf449('0x9')]({'port':0x232a});config['redis']=_[_0xf449('0xa')](config['redis'],{'host':_0xf449('0xb'),'port':0x18eb});var socket=require(_0xf449('0xc'))(new Redis(config[_0xf449('0xd')]));require('./smsMessage.socket')[_0xf449('0xe')](socket);function respondWithRpcPromise(_0x27877d,_0x402798,_0x445f7e){return new BPromise(function(_0x1854c2,_0x59a1aa){return client[_0xf449('0xf')](_0x27877d,_0x445f7e)[_0xf449('0x10')](function(_0x1d3e80){logger[_0xf449('0x11')](_0xf449('0x12'),_0x402798,_0xf449('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x402798,_0xf449('0x13'),JSON[_0xf449('0x14')](_0x1d3e80));if(_0x1d3e80[_0xf449('0x15')]){if(_0x1d3e80[_0xf449('0x15')][_0xf449('0x16')]===0x1f4){logger['error'](_0xf449('0x12'),_0x402798,_0x1d3e80[_0xf449('0x15')][_0xf449('0x17')]);return _0x59a1aa(_0x1d3e80[_0xf449('0x15')]['message']);}logger[_0xf449('0x15')](_0xf449('0x12'),_0x402798,_0x1d3e80[_0xf449('0x15')]['message']);return _0x1854c2(_0x1d3e80[_0xf449('0x15')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x402798,_0xf449('0x13'));_0x1854c2(_0x1d3e80[_0xf449('0x18')][_0xf449('0x17')]);}})[_0xf449('0x19')](function(_0x5c2a93){logger['error'](_0xf449('0x12'),_0x402798,_0x5c2a93);_0x59a1aa(_0x5c2a93);});});}exports['CreateSmsMessage']=function(_0x272c11){var _0x58cdb2=this;return new Promise(function(_0x17567c,_0x2ee217){return db['SmsMessage'][_0xf449('0x1a')](_0x272c11[_0xf449('0x1b')],{'raw':_0x272c11[_0xf449('0x1c')]?_0x272c11[_0xf449('0x1c')][_0xf449('0x1d')]===undefined?!![]:![]:!![]})[_0xf449('0x10')](function(_0x15a2ea){logger['info']('CreateSmsMessage',_0x272c11);logger['debug'](_0xf449('0x1e'),_0x272c11,JSON[_0xf449('0x14')](_0x15a2ea));_0x17567c(_0x15a2ea);})['catch'](function(_0x4a6e3e){logger['error']('CreateSmsMessage',_0x4a6e3e[_0xf449('0x17')],_0x272c11);_0x2ee217(_0x58cdb2[_0xf449('0x15')](0x1f4,_0x4a6e3e[_0xf449('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8826461..c68fa98 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 _0x1e70=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0xb91f14,_0x1795cb){var _0xa826f0=function(_0x16733d){while(--_0x16733d){_0xb91f14['push'](_0xb91f14['shift']());}};_0xa826f0(++_0x1795cb);}(_0x1e70,0x19e));var _0x01e7=function(_0x16d06c,_0x60b541){_0x16d06c=_0x16d06c-0x0;var _0x22e0a8=_0x1e70[_0x16d06c];return _0x22e0a8;};'use strict';var SmsMessageEvents=require(_0x01e7('0x0'));var events=[_0x01e7('0x1'),_0x01e7('0x2'),_0x01e7('0x3')];function createListener(_0x4b626f,_0x107c16){return function(_0x1e8b79){_0x107c16[_0x01e7('0x4')](_0x4b626f,_0x1e8b79);};}function removeListener(_0x43690d,_0x168d2d){return function(){SmsMessageEvents[_0x01e7('0x5')](_0x43690d,_0x168d2d);};}exports[_0x01e7('0x6')]=function(_0x420208){for(var _0x5db71c=0x0,_0x166135=events[_0x01e7('0x7')];_0x5db71c<_0x166135;_0x5db71c++){var _0x25d101=events[_0x5db71c];var _0x5e7731=createListener(_0x01e7('0x8')+_0x25d101,_0x420208);SmsMessageEvents['on'](_0x25d101,_0x5e7731);}}; \ No newline at end of file +var _0x787f=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x48a84a,_0x22222e){var _0x470b42=function(_0x274811){while(--_0x274811){_0x48a84a['push'](_0x48a84a['shift']());}};_0x470b42(++_0x22222e);}(_0x787f,0x1f1));var _0xf787=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0x787f[_0x48e885];return _0x3830a4;};'use strict';var SmsMessageEvents=require(_0xf787('0x0'));var events=[_0xf787('0x1'),_0xf787('0x2'),'update'];function createListener(_0x9eb528,_0x5aa41c){return function(_0x148b00){_0x5aa41c[_0xf787('0x3')](_0x9eb528,_0x148b00);};}function removeListener(_0xa1ad07,_0x40850e){return function(){SmsMessageEvents[_0xf787('0x4')](_0xa1ad07,_0x40850e);};}exports[_0xf787('0x5')]=function(_0x346865){for(var _0x4cd47b=0x0,_0x3a3b19=events[_0xf787('0x6')];_0x4cd47b<_0x3a3b19;_0x4cd47b++){var _0x1e21e7=events[_0x4cd47b];var _0x56fd41=createListener(_0xf787('0x7')+_0x1e21e7,_0x346865);SmsMessageEvents['on'](_0x1e21e7,_0x56fd41);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8a3635f..90e9806 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 _0x9a14=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','/describe','isAuthenticated','describe','/:id','show','/:id/members','get','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x3a1a2c,_0x530568){var _0x37d134=function(_0x5acf44){while(--_0x5acf44){_0x3a1a2c['push'](_0x3a1a2c['shift']());}};_0x37d134(++_0x530568);}(_0x9a14,0xa8));var _0x49a1=function(_0xfd16a3,_0x31b475){_0xfd16a3=_0xfd16a3-0x0;var _0x348ef1=_0x9a14[_0xfd16a3];return _0x348ef1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var auth=require(_0x49a1('0x4'));var interaction=require(_0x49a1('0x5'));var config=require(_0x49a1('0x6'));var controller=require(_0x49a1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x49a1('0x8'),auth[_0x49a1('0x9')](),controller[_0x49a1('0xa')]);router['get'](_0x49a1('0xb'),auth[_0x49a1('0x9')](),controller[_0x49a1('0xc')]);router['get'](_0x49a1('0xd'),auth[_0x49a1('0x9')](),controller['getMembers']);router[_0x49a1('0xe')](_0x49a1('0xf'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x10')]);router[_0x49a1('0xe')]('/:id/users',auth[_0x49a1('0x9')](),controller[_0x49a1('0x11')]);router[_0x49a1('0x12')]('/',auth[_0x49a1('0x9')](),controller[_0x49a1('0x13')]);router[_0x49a1('0x12')](_0x49a1('0xf'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x14')]);router[_0x49a1('0x12')](_0x49a1('0x15'),auth[_0x49a1('0x9')](),controller[_0x49a1('0x16')]);router[_0x49a1('0x17')](_0x49a1('0xb'),auth['isAuthenticated'](),controller[_0x49a1('0x18')]);router[_0x49a1('0x19')](_0x49a1('0xb'),auth['isAuthenticated'](),controller[_0x49a1('0x1a')]);router[_0x49a1('0x19')]('/:id/teams',auth[_0x49a1('0x9')](),controller['removeTeams']);router[_0x49a1('0x19')](_0x49a1('0x15'),auth['isAuthenticated'](),controller[_0x49a1('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5d59=['getMembers','get','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x34090a,_0x5e94ec){var _0xf1051=function(_0x4ee37e){while(--_0x4ee37e){_0x34090a['push'](_0x34090a['shift']());}};_0xf1051(++_0x5e94ec);}(_0x5d59,0x15f));var _0x95d5=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x5d59[_0x55969b];return _0x3d7fc1;};'use strict';var multer=require('multer');var util=require(_0x95d5('0x0'));var path=require(_0x95d5('0x1'));var timeout=require(_0x95d5('0x2'));var express=require(_0x95d5('0x3'));var router=express[_0x95d5('0x4')]();var auth=require(_0x95d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95d5('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x95d5('0x7')](),controller['index']);router['get'](_0x95d5('0x8'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x9')]);router['get'](_0x95d5('0xa'),auth['isAuthenticated'](),controller[_0x95d5('0xb')]);router['get'](_0x95d5('0xc'),auth[_0x95d5('0x7')](),controller[_0x95d5('0xd')]);router[_0x95d5('0xe')](_0x95d5('0xf'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x10')]);router[_0x95d5('0xe')]('/:id/users',auth[_0x95d5('0x7')](),controller['getAgents']);router['post']('/',auth[_0x95d5('0x7')](),controller[_0x95d5('0x11')]);router[_0x95d5('0x12')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x13')]);router[_0x95d5('0x12')](_0x95d5('0x14'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x15')]);router[_0x95d5('0x16')](_0x95d5('0xa'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x17')]);router['delete']('/:id',auth[_0x95d5('0x7')](),controller['destroy']);router[_0x95d5('0x18')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x19')]);router[_0x95d5('0x18')](_0x95d5('0x14'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x1a')]);module[_0x95d5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 97a05fd..32a4c7c 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 _0x6444=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x6444,0x1a8));var _0x4644=function(_0x490eba,_0x518ea9){_0x490eba=_0x490eba-0x0;var _0x37ac7b=_0x6444[_0x490eba];return _0x37ac7b;};'use strict';var Sequelize=require(_0x4644('0x0'));module[_0x4644('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4644('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4644('0x3')]},'timeout':{'type':Sequelize[_0x4644('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4644('0x5')](_0x4644('0x6'),_0x4644('0x7'),_0x4644('0x8'))}}; \ No newline at end of file +var _0x4196=['sequelize','exports','STRING','INTEGER','ENUM','roundrobin'];(function(_0x4c56d1,_0x11d94b){var _0x33bb7e=function(_0x12725b){while(--_0x12725b){_0x4c56d1['push'](_0x4c56d1['shift']());}};_0x33bb7e(++_0x11d94b);}(_0x4196,0x14a));var _0x6419=function(_0x441034,_0x1b5912){_0x441034=_0x441034-0x0;var _0x13cb8c=_0x4196[_0x441034];return _0x13cb8c;};'use strict';var Sequelize=require(_0x6419('0x0'));module[_0x6419('0x1')]={'name':{'type':Sequelize[_0x6419('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6419('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6419('0x4')]('rrmemory','beepall',_0x6419('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f100353..4359f82 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 _0x5ad3=['params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','keys','nolimit','SmsQueueId','UserSmsQueue','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','addTeams','ids','Team','User','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','json','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SmsQueue','include','findAll','rows','catch','show'];(function(_0xfc38ec,_0x452395){var _0x3bf341=function(_0x2ba79e){while(--_0x2ba79e){_0xfc38ec['push'](_0xfc38ec['shift']());}};_0x3bf341(++_0x452395);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x506b51,_0x2d2b6d){_0x506b51=_0x506b51-0x0;var _0xca5779=_0x5ad3[_0x506b51];return _0xca5779;};'use strict';var pdf=require(_0x35ad('0x0'));var emlformat=require(_0x35ad('0x1'));var rimraf=require(_0x35ad('0x2'));var zipdir=require(_0x35ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ad('0x4'));var moment=require(_0x35ad('0x5'));var BPromise=require(_0x35ad('0x6'));var Mustache=require(_0x35ad('0x7'));var util=require(_0x35ad('0x8'));var path=require(_0x35ad('0x9'));var sox=require(_0x35ad('0xa'));var csv=require(_0x35ad('0xb'));var ejs=require(_0x35ad('0xc'));var fs=require('fs');var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var licenseUtil=require(_0x35ad('0x17'));var db=require('../../mysqldb')['db'];config[_0x35ad('0x18')]=_[_0x35ad('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35ad('0x1a'))(new Redis(config[_0x35ad('0x18')]));require(_0x35ad('0x1b'))['register'](socket);function respondWithStatusCode(_0x3e2676,_0x2ebceb){_0x2ebceb=_0x2ebceb||0xcc;return function(_0x591917){if(_0x591917){return _0x3e2676[_0x35ad('0x1c')](_0x2ebceb);}return _0x3e2676['status'](_0x2ebceb)['end']();};}function respondWithResult(_0x3a981a,_0x3ff2f0){_0x3ff2f0=_0x3ff2f0||0xc8;return function(_0x27efeb){if(_0x27efeb){return _0x3a981a['status'](_0x3ff2f0)[_0x35ad('0x1d')](_0x27efeb);}};}function respondWithFilteredResult(_0x2f3f27,_0x233394){return function(_0x3158a1){if(_0x3158a1){var _0x3a73c8=_0x3158a1[_0x35ad('0x1e')],_0x418416=_0x233394['offset'],_0x49e960=_0x233394['offset']+_0x233394[_0x35ad('0x1f')],_0xd32a43;if(_0x49e960>=_0x3a73c8){_0x49e960=_0x3a73c8;_0xd32a43=0xc8;}else{_0xd32a43=0xce;}_0x2f3f27[_0x35ad('0x20')](_0xd32a43);return _0x2f3f27['set'](_0x35ad('0x21'),_0x418416+'-'+_0x49e960+'/'+_0x3a73c8)[_0x35ad('0x1d')](_0x3158a1);}return null;};}function patchUpdates(_0x496620){return function(_0x37c03d){try{jsonpatch[_0x35ad('0x22')](_0x37c03d,_0x496620,!![]);}catch(_0x504cbc){return BPromise[_0x35ad('0x23')](_0x504cbc);}return _0x37c03d[_0x35ad('0x24')]();};}function saveUpdates(_0x43a6a8,_0x45e041){return function(_0x1e0527){if(_0x1e0527){return _0x1e0527[_0x35ad('0x25')](_0x43a6a8)[_0x35ad('0x26')](function(_0x4c5740){return _0x4c5740;});}return null;};}function removeEntity(_0x1cb9da,_0x1b3d01){return function(_0x47e818){if(_0x47e818){return _0x47e818[_0x35ad('0x27')]()[_0x35ad('0x26')](function(){var _0xa3cb9f=_0x47e818[_0x35ad('0x28')]({'plain':!![]});var _0x368468='SmsQueues';return db[_0x35ad('0x29')][_0x35ad('0x27')]({'where':{'type':_0x368468,'resourceId':_0xa3cb9f['id']}})[_0x35ad('0x26')](function(){return _0x47e818;});})[_0x35ad('0x26')](function(){_0x1cb9da[_0x35ad('0x20')](0xcc)[_0x35ad('0x2a')]();});}};}function handleEntityNotFound(_0x2e601a,_0xaf7237){return function(_0x5418c2){if(!_0x5418c2){_0x2e601a[_0x35ad('0x1c')](0x194);}return _0x5418c2;};}function handleError(_0x11da54,_0x2f8b3){_0x2f8b3=_0x2f8b3||0x1f4;return function(_0x34b8b9){logger[_0x35ad('0x2b')](_0x34b8b9['stack']);if(_0x34b8b9['name']){delete _0x34b8b9[_0x35ad('0x2c')];}_0x11da54['status'](_0x2f8b3)[_0x35ad('0x2d')](_0x34b8b9);};}exports['index']=function(_0x53603f,_0x589e4a){var _0x5380e5={},_0x55906e={},_0x5a60e1={'count':0x0,'rows':[]};var _0x4dc5ee=_[_0x35ad('0x2e')](db['SmsQueue'][_0x35ad('0x2f')],function(_0x51cf37){return{'name':_0x51cf37[_0x35ad('0x30')],'type':_0x51cf37['type'][_0x35ad('0x31')]};});_0x55906e['model']=_[_0x35ad('0x2e')](_0x4dc5ee,_0x35ad('0x2c'));_0x55906e[_0x35ad('0x32')]=_['keys'](_0x53603f[_0x35ad('0x32')]);_0x55906e[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x55906e[_0x35ad('0x35')],_0x55906e[_0x35ad('0x32')]);_0x5380e5['attributes']=_['intersection'](_0x55906e[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x36')]));_0x5380e5['attributes']=_0x5380e5[_0x35ad('0x37')][_0x35ad('0x38')]?_0x5380e5[_0x35ad('0x37')]:_0x55906e[_0x35ad('0x35')];if(!_0x53603f[_0x35ad('0x32')][_0x35ad('0x39')]('nolimit')){_0x5380e5['limit']=qs[_0x35ad('0x1f')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x5380e5[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x53603f[_0x35ad('0x32')][_0x35ad('0x3a')]);}_0x5380e5[_0x35ad('0x3b')]=qs[_0x35ad('0x3c')](_0x53603f['query'][_0x35ad('0x3c')]);_0x5380e5['where']=qs[_0x35ad('0x33')](_[_0x35ad('0x3d')](_0x53603f[_0x35ad('0x32')],_0x55906e[_0x35ad('0x33')]),_0x4dc5ee);if(_0x53603f[_0x35ad('0x32')][_0x35ad('0x3e')]){_0x5380e5[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x5380e5[_0x35ad('0x3f')],{'$or':_['map'](_0x4dc5ee,function(_0x200e4d){if(_0x200e4d[_0x35ad('0x41')]!==_0x35ad('0x42')){var _0x4b8453={};_0x4b8453[_0x200e4d[_0x35ad('0x2c')]]={'$like':'%'+_0x53603f[_0x35ad('0x32')][_0x35ad('0x3e')]+'%'};return _0x4b8453;}})});}_0x5380e5=_[_0x35ad('0x40')]({},_0x5380e5,_0x53603f[_0x35ad('0x43')]);var _0x2d0f86={'where':_0x5380e5[_0x35ad('0x3f')]};return db[_0x35ad('0x44')][_0x35ad('0x1e')](_0x2d0f86)[_0x35ad('0x26')](function(_0x21d730){_0x5a60e1['count']=_0x21d730;if(_0x53603f[_0x35ad('0x32')]['includeAll']){_0x5380e5[_0x35ad('0x45')]=[{'all':!![]}];}return db[_0x35ad('0x44')][_0x35ad('0x46')](_0x5380e5);})[_0x35ad('0x26')](function(_0x1785b5){_0x5a60e1[_0x35ad('0x47')]=_0x1785b5;return _0x5a60e1;})[_0x35ad('0x26')](respondWithFilteredResult(_0x589e4a,_0x5380e5))[_0x35ad('0x48')](handleError(_0x589e4a,null));};exports[_0x35ad('0x49')]=function(_0x564407,_0xdf7e22){var _0x253d02={'raw':!![],'where':{'id':_0x564407[_0x35ad('0x4a')]['id']}},_0xd184f7={};_0xd184f7[_0x35ad('0x35')]=_['keys'](db[_0x35ad('0x44')][_0x35ad('0x2f')]);_0xd184f7['query']=_['keys'](_0x564407[_0x35ad('0x32')]);_0xd184f7[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0xd184f7[_0x35ad('0x35')],_0xd184f7['query']);_0x253d02[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0xd184f7[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x564407[_0x35ad('0x32')][_0x35ad('0x36')]));_0x253d02[_0x35ad('0x37')]=_0x253d02['attributes'][_0x35ad('0x38')]?_0x253d02[_0x35ad('0x37')]:_0xd184f7[_0x35ad('0x35')];if(_0x564407['query']['includeAll']){_0x253d02['include']=[{'all':!![]}];}_0x253d02=_[_0x35ad('0x40')]({},_0x253d02,_0x564407[_0x35ad('0x43')]);return db[_0x35ad('0x44')][_0x35ad('0x4b')](_0x253d02)['then'](handleEntityNotFound(_0xdf7e22,null))[_0x35ad('0x26')](respondWithResult(_0xdf7e22,null))[_0x35ad('0x48')](handleError(_0xdf7e22,null));};exports[_0x35ad('0x4c')]=function(_0x2e384a,_0x43d1ab){return db[_0x35ad('0x44')]['create'](_0x2e384a['body'],{})[_0x35ad('0x26')](function(_0x3e5d31){var _0x5acc34=_0x2e384a['user'][_0x35ad('0x28')]({'plain':!![]});if(!_0x5acc34)throw new Error(_0x35ad('0x4d'));if(_0x5acc34[_0x35ad('0x4e')]==='user'){var _0x486a11=_0x3e5d31[_0x35ad('0x28')]({'plain':!![]});var _0x19bc07=_0x35ad('0x4f');return db['UserProfileSection'][_0x35ad('0x4b')]({'where':{'name':_0x19bc07,'userProfileId':_0x5acc34[_0x35ad('0x50')]},'raw':!![]})[_0x35ad('0x26')](function(_0x467887){if(_0x467887&&_0x467887[_0x35ad('0x51')]===0x0){return db[_0x35ad('0x29')]['create']({'name':_0x486a11[_0x35ad('0x2c')],'resourceId':_0x486a11['id'],'type':_0x467887[_0x35ad('0x2c')],'sectionId':_0x467887['id']},{})[_0x35ad('0x26')](function(){return _0x3e5d31;});}else{return _0x3e5d31;}})['catch'](function(_0x325b2a){logger[_0x35ad('0x2b')](_0x35ad('0x52'),_0x325b2a);throw _0x325b2a;});}return _0x3e5d31;})[_0x35ad('0x26')](respondWithResult(_0x43d1ab,0xc9))['catch'](handleError(_0x43d1ab,null));};exports['update']=function(_0x19ae62,_0x14101f){if(_0x19ae62[_0x35ad('0x53')]['id']){delete _0x19ae62[_0x35ad('0x53')]['id'];}return db[_0x35ad('0x44')]['find']({'where':{'id':_0x19ae62[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x14101f,null))[_0x35ad('0x26')](saveUpdates(_0x19ae62[_0x35ad('0x53')],null))[_0x35ad('0x26')](respondWithResult(_0x14101f,null))[_0x35ad('0x48')](handleError(_0x14101f,null));};exports['destroy']=function(_0x579090,_0x33da9c){return db[_0x35ad('0x44')][_0x35ad('0x4b')]({'where':{'id':_0x579090[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x33da9c,null))[_0x35ad('0x26')](removeEntity(_0x33da9c,null))[_0x35ad('0x48')](handleError(_0x33da9c,null));};exports['describe']=function(_0x1da9a7,_0x13229d){return db[_0x35ad('0x44')][_0x35ad('0x54')]()['then'](respondWithResult(_0x13229d,null))[_0x35ad('0x48')](handleError(_0x13229d,null));};exports[_0x35ad('0x55')]=function(_0x4baa80,_0x1d66c6,_0x1aed75){var _0x1da9ca={'raw':!![],'where':{}},_0x3f9607={},_0x12895c;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x4baa80[_0x35ad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d66c6,null))[_0x35ad('0x26')](function(_0x1b8823){if(_0x1b8823){_0x12895c=_0x1b8823[_0x35ad('0x28')]({'plain':!![]});_0x3f9607['model']=_[_0x35ad('0x57')](db['UserSmsQueue'][_0x35ad('0x2f')]);_0x3f9607[_0x35ad('0x32')]=_[_0x35ad('0x57')](_0x4baa80[_0x35ad('0x32')]);_0x3f9607['filters']=_[_0x35ad('0x34')](_0x3f9607[_0x35ad('0x35')],_0x3f9607[_0x35ad('0x32')]);_0x1da9ca[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x3f9607['model'],qs[_0x35ad('0x36')](_0x4baa80['query'][_0x35ad('0x36')]));_0x1da9ca[_0x35ad('0x37')]=_0x1da9ca['attributes'][_0x35ad('0x38')]?_0x1da9ca['attributes']:_0x3f9607[_0x35ad('0x35')];if(!_0x4baa80[_0x35ad('0x32')]['hasOwnProperty'](_0x35ad('0x58'))){_0x1da9ca[_0x35ad('0x1f')]=qs[_0x35ad('0x1f')](_0x4baa80[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x1da9ca[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x4baa80['query'][_0x35ad('0x3a')]);}_0x1da9ca[_0x35ad('0x3b')]=qs[_0x35ad('0x3c')](_0x4baa80[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x1da9ca[_0x35ad('0x3f')]=qs[_0x35ad('0x33')](_['pick'](_0x4baa80[_0x35ad('0x32')],_0x3f9607[_0x35ad('0x33')]));_0x1da9ca[_0x35ad('0x3f')][_0x35ad('0x59')]=_0x1b8823['id'];if(_0x4baa80[_0x35ad('0x32')]['filter']){_0x1da9ca[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x1da9ca['where'],{'$or':_[_0x35ad('0x2e')](_0x1da9ca[_0x35ad('0x37')],function(_0x891ab4){var _0x286543={};_0x286543[_0x891ab4]={'$like':'%'+_0x4baa80['query'][_0x35ad('0x3e')]+'%'};return _0x286543;})});}_0x1da9ca=_['merge']({},_0x1da9ca,_0x4baa80[_0x35ad('0x43')]);return db[_0x35ad('0x5a')][_0x35ad('0x46')](_0x1da9ca);}})['then'](function(_0x395370){if(_0x395370){return db['User'][_0x35ad('0x5b')]({'where':{'id':_['map'](_0x395370,'UserId'),'role':_0x35ad('0x5c')},'attributes':['id',_0x35ad('0x2c'),'smsPause',_0x35ad('0x5d'),_0x35ad('0x5e')]});}})[_0x35ad('0x26')](function(_0x511bbb){if(_0x511bbb){return{'count':_0x511bbb['count'],'rows':_['map'](_0x511bbb['rows'],function(_0x3f98a2){return{'membername':_0x3f98a2[_0x35ad('0x2c')],'UserId':_0x3f98a2['id'],'queue_name':_0x12895c[_0x35ad('0x2c')],'SmsQueueId':_0x12895c['id'],'interface':util[_0x35ad('0x5f')](_0x35ad('0x60'),_0x35ad('0x61'),_0x3f98a2['name']),'penalty':0x0,'paused':_0x3f98a2[_0x35ad('0x62')],'createdAt':_0x3f98a2[_0x35ad('0x5e')],'updatedAt':_0x3f98a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x35ad('0x26')](respondWithFilteredResult(_0x1d66c6,_0x1da9ca))[_0x35ad('0x48')](handleError(_0x1d66c6,null));};exports['getTeams']=function(_0x18436d,_0x31f8bb,_0x4409db){var _0x2c710={};var _0x5324f4={};var _0x1e7722;var _0x11af74;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x18436d[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x31f8bb,null))[_0x35ad('0x26')](function(_0x3dc5e5){if(_0x3dc5e5){_0x1e7722=_0x3dc5e5;_0x5324f4[_0x35ad('0x35')]=_[_0x35ad('0x57')](db['Team']['rawAttributes']);_0x5324f4[_0x35ad('0x32')]=_[_0x35ad('0x57')](_0x18436d['query']);_0x5324f4[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x5324f4[_0x35ad('0x35')],_0x5324f4[_0x35ad('0x32')]);_0x2c710[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x5324f4['model'],qs[_0x35ad('0x36')](_0x18436d[_0x35ad('0x32')][_0x35ad('0x36')]));_0x2c710[_0x35ad('0x37')]=_0x2c710[_0x35ad('0x37')][_0x35ad('0x38')]?_0x2c710[_0x35ad('0x37')]:_0x5324f4[_0x35ad('0x35')];_0x2c710['order']=qs[_0x35ad('0x3c')](_0x18436d[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x2c710[_0x35ad('0x3f')]=qs['filters'](_[_0x35ad('0x3d')](_0x18436d['query'],_0x5324f4[_0x35ad('0x33')]));if(_0x18436d['query']['filter']){_0x2c710[_0x35ad('0x3f')]=_[_0x35ad('0x40')](_0x2c710[_0x35ad('0x3f')],{'$or':_['map'](_0x2c710[_0x35ad('0x37')],function(_0x52c478){var _0x4125ed={};_0x4125ed[_0x52c478]={'$like':'%'+_0x18436d[_0x35ad('0x32')][_0x35ad('0x3e')]+'%'};return _0x4125ed;})});}_0x2c710=_[_0x35ad('0x40')]({},_0x2c710,_0x18436d['options']);return _0x1e7722[_0x35ad('0x63')](_0x2c710);}})['then'](function(_0x1c3862){if(_0x1c3862){_0x11af74=_0x1c3862['length'];if(!_0x18436d[_0x35ad('0x32')][_0x35ad('0x39')]('nolimit')){_0x2c710['limit']=qs['limit'](_0x18436d[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x2c710[_0x35ad('0x3a')]=qs[_0x35ad('0x3a')](_0x18436d[_0x35ad('0x32')]['offset']);}return _0x1e7722['getTeams'](_0x2c710);}})[_0x35ad('0x26')](function(_0x5ee19d){if(_0x5ee19d){return _0x5ee19d?{'count':_0x11af74,'rows':_0x5ee19d}:null;}})[_0x35ad('0x26')](respondWithResult(_0x31f8bb,null))['catch'](handleError(_0x31f8bb,null));};exports[_0x35ad('0x64')]=function(_0x343eb4,_0x777835,_0x6d8f0c){var _0x5b2b32=_0x343eb4[_0x35ad('0x53')][_0x35ad('0x65')];return db[_0x35ad('0x66')][_0x35ad('0x46')]({'where':{'id':_0x5b2b32},'attributes':['id'],'include':[{'model':db[_0x35ad('0x67')],'as':_0x35ad('0x68'),'attributes':['id',_0x35ad('0x2c'),_0x35ad('0x69'),'voicePause',_0x35ad('0x6a')],'raw':!![]}]})[_0x35ad('0x26')](function(_0x47aa75){if(_0x47aa75){var _0x496e31=_['flatMap'](_0x47aa75,function(_0x3daf3f){var _0x331090=_0x3daf3f[_0x35ad('0x28')]({'plain':!![]});return _0x331090[_0x35ad('0x68')];});return db['SmsQueue'][_0x35ad('0x4b')]({'where':{'id':_0x343eb4[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](function(_0x21a774){return db[_0x35ad('0x6b')][_0x35ad('0x6c')](function(_0x9e55cc){return _0x21a774[_0x35ad('0x64')](_0x5b2b32,{'transaction':_0x9e55cc})[_0x35ad('0x26')](function(){return BPromise[_0x35ad('0x6d')](_0x496e31,function(_0x356888){return db['UserSmsQueue'][_0x35ad('0x6e')]({'where':{'UserId':_0x356888['id'],'SmsQueueId':_0x343eb4[_0x35ad('0x4a')]['id']},'transaction':_0x9e55cc});});})[_0x35ad('0x26')](function(){_0x496e31[_0x35ad('0x6f')](function(_0xbff7b7){socket['emit']('userSmsQueue:save',{'UserId':_0xbff7b7['id'],'SmsQueueId':_0x21a774['id']});});});});});}})[_0x35ad('0x26')](respondWithStatusCode(_0x777835,null))[_0x35ad('0x48')](handleError(_0x777835,null));};exports[_0x35ad('0x70')]=function(_0xaa4bac,_0x39e513,_0xf7b5dc){return db[_0x35ad('0x66')][_0x35ad('0x46')]({'where':{'id':_0xaa4bac[_0x35ad('0x32')][_0x35ad('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35ad('0x68'),'attributes':['id'],'raw':!![]}]})[_0x35ad('0x26')](handleEntityNotFound(_0x39e513,null))[_0x35ad('0x26')](function(_0x2bdaf3){var _0x32e675=_['map'](_0x2bdaf3,'id');var _0x1a6ad4=[];var _0x1540fa=[];var _0x321530=squel[_0x35ad('0x71')]();_0x321530['field'](_0x35ad('0x72'))[_0x35ad('0x73')]('team_has_sms_queues','tq')['join'](_0x35ad('0x74'),'ut',_0x35ad('0x75'))['where'](_0x35ad('0x76'),_0xaa4bac[_0x35ad('0x4a')]['id']);for(var _0x42f2d8=0x0;_0x42f2d8<_0x2bdaf3['length'];_0x42f2d8+=0x1){let _0xb2c023=_0x2bdaf3[_0x42f2d8];for(var _0x550020=0x0;_0x550020<_0xb2c023[_0x35ad('0x68')]['length'];_0x550020+=0x1){let _0x2eb824=_0xb2c023[_0x35ad('0x68')][_0x550020];var _0xdec48a=_0x321530[_0x35ad('0x77')]();_0xdec48a[_0x35ad('0x3f')]('ut.UserId\x20=\x20?',_0x2eb824['id']);_0x1540fa[_0x35ad('0x78')](db[_0x35ad('0x6b')][_0x35ad('0x32')](_0xdec48a[_0x35ad('0x79')](),{'type':db['sequelize']['QueryTypes'][_0x35ad('0x7a')]})['then'](function(_0x1cf545){if(_0x1cf545['length']===0x1){return _0x2eb824['id'];}else{var _0xc8d2b7=_['every'](_['map'](_0x1cf545,_0x35ad('0x7b')),function(_0x5c69e3){return _[_0x35ad('0x7c')](_0x32e675,_0x5c69e3);});if(_0xc8d2b7){return _0x2eb824['id'];}}}));}}return BPromise[_0x35ad('0x7d')](_0x1540fa)[_0x35ad('0x26')](function(_0x19df6d){_0x1a6ad4=_(_0x1a6ad4)[_0x35ad('0x7e')](_0x19df6d)[_0x35ad('0x7f')]()[_0x35ad('0x80')]();return db[_0x35ad('0x44')]['find']({'where':{'id':_0xaa4bac[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](function(_0x2312a2){return db[_0x35ad('0x6b')]['transaction'](function(_0x32515d){return _0x2312a2[_0x35ad('0x70')](_0xaa4bac['query']['ids'],{'transaction':_0x32515d})[_0x35ad('0x26')](function(){if(!_[_0x35ad('0x81')](_0x1a6ad4)){return _0x2312a2[_0x35ad('0x82')](_0x1a6ad4,{'transaction':_0x32515d});}})['then'](function(){_0x1a6ad4[_0x35ad('0x6f')](function(_0x52bd6d){socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':_0x52bd6d,'SmsQueueId':_0x2312a2['id']});});});});});});})[_0x35ad('0x26')](respondWithStatusCode(_0x39e513,null))[_0x35ad('0x48')](handleError(_0x39e513,null));};exports[_0x35ad('0x85')]=function(_0x3dfda9,_0x142327,_0xce3f){return db[_0x35ad('0x44')]['find']({'where':{'id':_0x3dfda9[_0x35ad('0x4a')]['id']}})[_0x35ad('0x26')](handleEntityNotFound(_0x142327,null))[_0x35ad('0x26')](function(_0x56c2e6){if(_0x56c2e6){return _0x56c2e6['addAgents'](_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')],_[_0x35ad('0x86')](_0x3dfda9[_0x35ad('0x53')],['ids','id'])||{})[_0x35ad('0x87')](function(_0x290af7){for(var _0x340b3a=0x0;_0x340b3a<_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')][_0x35ad('0x38')];_0x340b3a+=0x1){socket[_0x35ad('0x83')](_0x35ad('0x88'),{'UserId':_0x3dfda9[_0x35ad('0x53')][_0x35ad('0x65')][_0x340b3a],'SmsQueueId':_0x3dfda9['params']['id']});}return _0x290af7;});}})['then'](respondWithResult(_0x142327,null))[_0x35ad('0x48')](handleError(_0x142327,null));};exports[_0x35ad('0x82')]=function(_0x408092,_0x12e640,_0x3475da){return db[_0x35ad('0x44')][_0x35ad('0x4b')]({'where':{'id':_0x408092['params']['id']}})['then'](handleEntityNotFound(_0x12e640,null))[_0x35ad('0x26')](function(_0x1b7d67){if(_0x1b7d67){return _0x1b7d67['removeAgents'](_0x408092['query'][_0x35ad('0x65')])['then'](function(){if(_[_0x35ad('0x89')](_0x408092[_0x35ad('0x32')][_0x35ad('0x65')])){for(var _0x5e45dc=0x0;_0x5e45dc<_0x408092['query']['ids'][_0x35ad('0x38')];_0x5e45dc+=0x1){socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':Number(_0x408092[_0x35ad('0x32')][_0x35ad('0x65')][_0x5e45dc]),'SmsQueueId':Number(_0x408092[_0x35ad('0x4a')]['id'])});}}else{socket[_0x35ad('0x83')](_0x35ad('0x84'),{'UserId':Number(_0x408092['query'][_0x35ad('0x65')]),'SmsQueueId':Number(_0x408092[_0x35ad('0x4a')]['id'])});}});}})[_0x35ad('0x26')](respondWithStatusCode(_0x12e640,null))[_0x35ad('0x48')](handleError(_0x12e640,null));};exports['getAgents']=function(_0x3e8acb,_0x4eefd5,_0x42446f){var _0x2e376b={};var _0x2318fc={};var _0x7fccfc;var _0x5e742a;return db[_0x35ad('0x44')][_0x35ad('0x56')]({'where':{'id':_0x3e8acb[_0x35ad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eefd5,null))[_0x35ad('0x26')](function(_0x104537){if(_0x104537){_0x7fccfc=_0x104537;_0x2318fc[_0x35ad('0x35')]=_[_0x35ad('0x57')](db[_0x35ad('0x67')][_0x35ad('0x2f')]);_0x2318fc['query']=_[_0x35ad('0x57')](_0x3e8acb[_0x35ad('0x32')]);_0x2318fc[_0x35ad('0x33')]=_[_0x35ad('0x34')](_0x2318fc[_0x35ad('0x35')],_0x2318fc[_0x35ad('0x32')]);_0x2e376b[_0x35ad('0x37')]=_[_0x35ad('0x34')](_0x2318fc[_0x35ad('0x35')],qs[_0x35ad('0x36')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x36')]));_0x2e376b[_0x35ad('0x37')]=_0x2e376b[_0x35ad('0x37')][_0x35ad('0x38')]?_0x2e376b[_0x35ad('0x37')]:_0x2318fc[_0x35ad('0x35')];_0x2e376b['order']=qs[_0x35ad('0x3c')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3c')]);_0x2e376b[_0x35ad('0x3f')]=qs[_0x35ad('0x33')](_[_0x35ad('0x3d')](_0x3e8acb[_0x35ad('0x32')],_0x2318fc[_0x35ad('0x33')]));if(_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3e')]){_0x2e376b[_0x35ad('0x3f')]=_['merge'](_0x2e376b[_0x35ad('0x3f')],{'$or':_['map'](_0x2e376b[_0x35ad('0x37')],function(_0x5b0f18){var _0x44cd29={};_0x44cd29[_0x5b0f18]={'$like':'%'+_0x3e8acb['query'][_0x35ad('0x3e')]+'%'};return _0x44cd29;})});}_0x2e376b=_[_0x35ad('0x40')]({},_0x2e376b,_0x3e8acb[_0x35ad('0x43')]);return _0x7fccfc[_0x35ad('0x8a')](_0x2e376b);}})[_0x35ad('0x26')](function(_0x4867a9){if(_0x4867a9){_0x5e742a=_0x4867a9[_0x35ad('0x38')];if(!_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x39')](_0x35ad('0x58'))){_0x2e376b['limit']=qs[_0x35ad('0x1f')](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x1f')]);_0x2e376b['offset']=qs['offset'](_0x3e8acb[_0x35ad('0x32')][_0x35ad('0x3a')]);}return _0x7fccfc[_0x35ad('0x8a')](_0x2e376b);}})[_0x35ad('0x26')](function(_0x1ed24d){if(_0x1ed24d){return _0x1ed24d?{'count':_0x5e742a,'rows':_0x1ed24d}:null;}})[_0x35ad('0x26')](respondWithResult(_0x4eefd5,null))[_0x35ad('0x48')](handleError(_0x4eefd5,null));}; \ No newline at end of file +var _0x7da7=['getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','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','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','count','offset','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','status','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','include','findAll','rows','catch','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','pick','getTeams','Agents','online','interface','flatMap','sequelize','transaction','each','emit','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x7da7,0x10d));var _0x77da=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x7da7[_0x531cb8];return _0x5cf297;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];config[_0x77da('0x17')]=_['defaults'](config['redis'],{'host':_0x77da('0x18'),'port':0x18eb});var socket=require(_0x77da('0x19'))(new Redis(config['redis']));require(_0x77da('0x1a'))[_0x77da('0x1b')](socket);function respondWithStatusCode(_0x355719,_0x3c87c2){_0x3c87c2=_0x3c87c2||0xcc;return function(_0x519253){if(_0x519253){return _0x355719[_0x77da('0x1c')](_0x3c87c2);}return _0x355719['status'](_0x3c87c2)[_0x77da('0x1d')]();};}function respondWithResult(_0x366443,_0x1b0e17){_0x1b0e17=_0x1b0e17||0xc8;return function(_0x4500c4){if(_0x4500c4){return _0x366443['status'](_0x1b0e17)['json'](_0x4500c4);}};}function respondWithFilteredResult(_0x514016,_0x482b87){return function(_0x103e46){if(_0x103e46){var _0x295bef=_0x103e46[_0x77da('0x1e')],_0x289887=_0x482b87[_0x77da('0x1f')],_0x335dcb=_0x482b87[_0x77da('0x1f')]+_0x482b87['limit'],_0x19a00c;if(_0x335dcb>=_0x295bef){_0x335dcb=_0x295bef;_0x19a00c=0xc8;}else{_0x19a00c=0xce;}_0x514016['status'](_0x19a00c);return _0x514016[_0x77da('0x20')](_0x77da('0x21'),_0x289887+'-'+_0x335dcb+'/'+_0x295bef)['json'](_0x103e46);}return null;};}function patchUpdates(_0x45a122){return function(_0x304a2b){try{jsonpatch[_0x77da('0x22')](_0x304a2b,_0x45a122,!![]);}catch(_0x5ab79a){return BPromise['reject'](_0x5ab79a);}return _0x304a2b[_0x77da('0x23')]();};}function saveUpdates(_0x58f6c1,_0x175ac4){return function(_0x1c27aa){if(_0x1c27aa){return _0x1c27aa[_0x77da('0x24')](_0x58f6c1)[_0x77da('0x25')](function(_0x10399a){return _0x10399a;});}return null;};}function removeEntity(_0x270318,_0x95b5db){return function(_0x50799d){if(_0x50799d){return _0x50799d['destroy']()[_0x77da('0x25')](function(){var _0x2d009f=_0x50799d[_0x77da('0x26')]({'plain':!![]});var _0xbd06b7='SmsQueues';return db[_0x77da('0x27')][_0x77da('0x28')]({'where':{'type':_0xbd06b7,'resourceId':_0x2d009f['id']}})[_0x77da('0x25')](function(){return _0x50799d;});})[_0x77da('0x25')](function(){_0x270318[_0x77da('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce24b8,_0x3e090d){return function(_0x1f2279){if(!_0x1f2279){_0xce24b8[_0x77da('0x1c')](0x194);}return _0x1f2279;};}function handleError(_0x496ecd,_0x5b4638){_0x5b4638=_0x5b4638||0x1f4;return function(_0x4d395a){logger[_0x77da('0x2a')](_0x4d395a[_0x77da('0x2b')]);if(_0x4d395a[_0x77da('0x2c')]){delete _0x4d395a[_0x77da('0x2c')];}_0x496ecd[_0x77da('0x29')](_0x5b4638)['send'](_0x4d395a);};}exports[_0x77da('0x2d')]=function(_0x26f5a0,_0x356bfb){var _0x1d381b={},_0x1e7853={},_0x46e6b4={'count':0x0,'rows':[]};var _0x52c5be=_[_0x77da('0x2e')](db[_0x77da('0x2f')][_0x77da('0x30')],function(_0x38643a){return{'name':_0x38643a[_0x77da('0x31')],'type':_0x38643a[_0x77da('0x32')][_0x77da('0x33')]};});_0x1e7853[_0x77da('0x34')]=_['map'](_0x52c5be,'name');_0x1e7853[_0x77da('0x35')]=_[_0x77da('0x36')](_0x26f5a0['query']);_0x1e7853[_0x77da('0x37')]=_[_0x77da('0x38')](_0x1e7853[_0x77da('0x34')],_0x1e7853[_0x77da('0x35')]);_0x1d381b[_0x77da('0x39')]=_[_0x77da('0x38')](_0x1e7853[_0x77da('0x34')],qs['fields'](_0x26f5a0[_0x77da('0x35')]['fields']));_0x1d381b['attributes']=_0x1d381b['attributes'][_0x77da('0x3a')]?_0x1d381b['attributes']:_0x1e7853[_0x77da('0x34')];if(!_0x26f5a0[_0x77da('0x35')][_0x77da('0x3b')](_0x77da('0x3c'))){_0x1d381b[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x26f5a0[_0x77da('0x35')]['limit']);_0x1d381b[_0x77da('0x1f')]=qs[_0x77da('0x1f')](_0x26f5a0[_0x77da('0x35')][_0x77da('0x1f')]);}_0x1d381b[_0x77da('0x3e')]=qs[_0x77da('0x3f')](_0x26f5a0['query'][_0x77da('0x3f')]);_0x1d381b[_0x77da('0x40')]=qs[_0x77da('0x37')](_['pick'](_0x26f5a0[_0x77da('0x35')],_0x1e7853['filters']),_0x52c5be);if(_0x26f5a0['query']['filter']){_0x1d381b['where']=_[_0x77da('0x41')](_0x1d381b[_0x77da('0x40')],{'$or':_[_0x77da('0x2e')](_0x52c5be,function(_0x4e4351){if(_0x4e4351[_0x77da('0x32')]!=='VIRTUAL'){var _0xf79c20={};_0xf79c20[_0x4e4351['name']]={'$like':'%'+_0x26f5a0[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0xf79c20;}})});}_0x1d381b=_[_0x77da('0x41')]({},_0x1d381b,_0x26f5a0[_0x77da('0x43')]);var _0x240bee={'where':_0x1d381b['where']};return db[_0x77da('0x2f')][_0x77da('0x1e')](_0x240bee)[_0x77da('0x25')](function(_0x2f14f4){_0x46e6b4[_0x77da('0x1e')]=_0x2f14f4;if(_0x26f5a0[_0x77da('0x35')]['includeAll']){_0x1d381b[_0x77da('0x44')]=[{'all':!![]}];}return db[_0x77da('0x2f')][_0x77da('0x45')](_0x1d381b);})[_0x77da('0x25')](function(_0x7d11f9){_0x46e6b4[_0x77da('0x46')]=_0x7d11f9;return _0x46e6b4;})['then'](respondWithFilteredResult(_0x356bfb,_0x1d381b))[_0x77da('0x47')](handleError(_0x356bfb,null));};exports['show']=function(_0x1ae806,_0x373fb2){var _0x40a492={'raw':!![],'where':{'id':_0x1ae806[_0x77da('0x48')]['id']}},_0x514355={};_0x514355[_0x77da('0x34')]=_[_0x77da('0x36')](db[_0x77da('0x2f')][_0x77da('0x30')]);_0x514355[_0x77da('0x35')]=_[_0x77da('0x36')](_0x1ae806[_0x77da('0x35')]);_0x514355[_0x77da('0x37')]=_['intersection'](_0x514355[_0x77da('0x34')],_0x514355[_0x77da('0x35')]);_0x40a492[_0x77da('0x39')]=_[_0x77da('0x38')](_0x514355[_0x77da('0x34')],qs[_0x77da('0x49')](_0x1ae806['query']['fields']));_0x40a492[_0x77da('0x39')]=_0x40a492[_0x77da('0x39')][_0x77da('0x3a')]?_0x40a492[_0x77da('0x39')]:_0x514355[_0x77da('0x34')];if(_0x1ae806[_0x77da('0x35')]['includeAll']){_0x40a492[_0x77da('0x44')]=[{'all':!![]}];}_0x40a492=_[_0x77da('0x41')]({},_0x40a492,_0x1ae806[_0x77da('0x43')]);return db[_0x77da('0x2f')]['find'](_0x40a492)[_0x77da('0x25')](handleEntityNotFound(_0x373fb2,null))['then'](respondWithResult(_0x373fb2,null))['catch'](handleError(_0x373fb2,null));};exports[_0x77da('0x4a')]=function(_0x176f01,_0x143a68){return db[_0x77da('0x2f')]['create'](_0x176f01[_0x77da('0x4b')],{})[_0x77da('0x25')](function(_0x56a3d9){var _0x731995=_0x176f01[_0x77da('0x4c')]['get']({'plain':!![]});if(!_0x731995)throw new Error(_0x77da('0x4d'));if(_0x731995[_0x77da('0x4e')]===_0x77da('0x4c')){var _0xef2496=_0x56a3d9[_0x77da('0x26')]({'plain':!![]});var _0x1043c7=_0x77da('0x4f');return db[_0x77da('0x50')][_0x77da('0x51')]({'where':{'name':_0x1043c7,'userProfileId':_0x731995[_0x77da('0x52')]},'raw':!![]})['then'](function(_0x3d04a3){if(_0x3d04a3&&_0x3d04a3['autoAssociation']===0x0){return db[_0x77da('0x27')][_0x77da('0x4a')]({'name':_0xef2496[_0x77da('0x2c')],'resourceId':_0xef2496['id'],'type':_0x3d04a3[_0x77da('0x2c')],'sectionId':_0x3d04a3['id']},{})[_0x77da('0x25')](function(){return _0x56a3d9;});}else{return _0x56a3d9;}})[_0x77da('0x47')](function(_0x3a78d2){logger['error'](_0x77da('0x53'),_0x3a78d2);throw _0x3a78d2;});}return _0x56a3d9;})[_0x77da('0x25')](respondWithResult(_0x143a68,0xc9))[_0x77da('0x47')](handleError(_0x143a68,null));};exports[_0x77da('0x24')]=function(_0x4f30a1,_0x2c4f68){if(_0x4f30a1[_0x77da('0x4b')]['id']){delete _0x4f30a1[_0x77da('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4f30a1[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x2c4f68,null))[_0x77da('0x25')](saveUpdates(_0x4f30a1[_0x77da('0x4b')],null))[_0x77da('0x25')](respondWithResult(_0x2c4f68,null))['catch'](handleError(_0x2c4f68,null));};exports['destroy']=function(_0x365e91,_0x36f161){return db['SmsQueue'][_0x77da('0x51')]({'where':{'id':_0x365e91[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x36f161,null))['then'](removeEntity(_0x36f161,null))[_0x77da('0x47')](handleError(_0x36f161,null));};exports[_0x77da('0x54')]=function(_0x5a5309,_0x3ae855){return db[_0x77da('0x2f')][_0x77da('0x54')]()[_0x77da('0x25')](respondWithResult(_0x3ae855,null))[_0x77da('0x47')](handleError(_0x3ae855,null));};exports[_0x77da('0x55')]=function(_0x1dc4ab,_0x1719f5,_0x1ecb28){var _0x4831ce={'raw':!![],'where':{}},_0x3076ea={},_0x11c240;return db[_0x77da('0x2f')][_0x77da('0x56')]({'where':{'id':_0x1dc4ab[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x1719f5,null))['then'](function(_0x316666){if(_0x316666){_0x11c240=_0x316666[_0x77da('0x26')]({'plain':!![]});_0x3076ea[_0x77da('0x34')]=_['keys'](db[_0x77da('0x57')][_0x77da('0x30')]);_0x3076ea[_0x77da('0x35')]=_[_0x77da('0x36')](_0x1dc4ab[_0x77da('0x35')]);_0x3076ea[_0x77da('0x37')]=_[_0x77da('0x38')](_0x3076ea['model'],_0x3076ea[_0x77da('0x35')]);_0x4831ce['attributes']=_[_0x77da('0x38')](_0x3076ea[_0x77da('0x34')],qs[_0x77da('0x49')](_0x1dc4ab['query'][_0x77da('0x49')]));_0x4831ce[_0x77da('0x39')]=_0x4831ce[_0x77da('0x39')][_0x77da('0x3a')]?_0x4831ce['attributes']:_0x3076ea['model'];if(!_0x1dc4ab['query'][_0x77da('0x3b')](_0x77da('0x3c'))){_0x4831ce[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x1dc4ab[_0x77da('0x35')][_0x77da('0x3d')]);_0x4831ce[_0x77da('0x1f')]=qs[_0x77da('0x1f')](_0x1dc4ab[_0x77da('0x35')][_0x77da('0x1f')]);}_0x4831ce['order']=qs[_0x77da('0x3f')](_0x1dc4ab[_0x77da('0x35')]['sort']);_0x4831ce['where']=qs[_0x77da('0x37')](_['pick'](_0x1dc4ab[_0x77da('0x35')],_0x3076ea[_0x77da('0x37')]));_0x4831ce[_0x77da('0x40')]['SmsQueueId']=_0x316666['id'];if(_0x1dc4ab[_0x77da('0x35')][_0x77da('0x42')]){_0x4831ce[_0x77da('0x40')]=_[_0x77da('0x41')](_0x4831ce[_0x77da('0x40')],{'$or':_['map'](_0x4831ce[_0x77da('0x39')],function(_0x20a636){var _0x5f0938={};_0x5f0938[_0x20a636]={'$like':'%'+_0x1dc4ab[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0x5f0938;})});}_0x4831ce=_[_0x77da('0x41')]({},_0x4831ce,_0x1dc4ab[_0x77da('0x43')]);return db[_0x77da('0x57')][_0x77da('0x45')](_0x4831ce);}})[_0x77da('0x25')](function(_0x4b7260){if(_0x4b7260){return db[_0x77da('0x58')]['findAndCountAll']({'where':{'id':_[_0x77da('0x2e')](_0x4b7260,_0x77da('0x59')),'role':_0x77da('0x5a')},'attributes':['id',_0x77da('0x2c'),_0x77da('0x5b'),_0x77da('0x5c'),_0x77da('0x5d')]});}})[_0x77da('0x25')](function(_0x195a34){if(_0x195a34){return{'count':_0x195a34[_0x77da('0x1e')],'rows':_[_0x77da('0x2e')](_0x195a34[_0x77da('0x46')],function(_0x4e0fd5){return{'membername':_0x4e0fd5[_0x77da('0x2c')],'UserId':_0x4e0fd5['id'],'queue_name':_0x11c240[_0x77da('0x2c')],'SmsQueueId':_0x11c240['id'],'interface':util[_0x77da('0x5e')](_0x77da('0x5f'),'SIP',_0x4e0fd5[_0x77da('0x2c')]),'penalty':0x0,'paused':_0x4e0fd5[_0x77da('0x5b')],'createdAt':_0x4e0fd5[_0x77da('0x5d')],'updatedAt':_0x4e0fd5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x77da('0x25')](respondWithFilteredResult(_0x1719f5,_0x4831ce))['catch'](handleError(_0x1719f5,null));};exports['getTeams']=function(_0x2a4f85,_0x4015f0,_0x11f029){var _0x371d38={};var _0x3cb69e={};var _0x337621;var _0x14dec8;return db[_0x77da('0x2f')][_0x77da('0x56')]({'where':{'id':_0x2a4f85['params']['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x4015f0,null))[_0x77da('0x25')](function(_0x2d3ab4){if(_0x2d3ab4){_0x337621=_0x2d3ab4;_0x3cb69e[_0x77da('0x34')]=_[_0x77da('0x36')](db['Team'][_0x77da('0x30')]);_0x3cb69e[_0x77da('0x35')]=_[_0x77da('0x36')](_0x2a4f85[_0x77da('0x35')]);_0x3cb69e[_0x77da('0x37')]=_[_0x77da('0x38')](_0x3cb69e[_0x77da('0x34')],_0x3cb69e[_0x77da('0x35')]);_0x371d38[_0x77da('0x39')]=_[_0x77da('0x38')](_0x3cb69e['model'],qs['fields'](_0x2a4f85['query'][_0x77da('0x49')]));_0x371d38[_0x77da('0x39')]=_0x371d38[_0x77da('0x39')]['length']?_0x371d38['attributes']:_0x3cb69e[_0x77da('0x34')];_0x371d38[_0x77da('0x3e')]=qs[_0x77da('0x3f')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x3f')]);_0x371d38[_0x77da('0x40')]=qs[_0x77da('0x37')](_[_0x77da('0x60')](_0x2a4f85[_0x77da('0x35')],_0x3cb69e[_0x77da('0x37')]));if(_0x2a4f85[_0x77da('0x35')][_0x77da('0x42')]){_0x371d38[_0x77da('0x40')]=_['merge'](_0x371d38['where'],{'$or':_[_0x77da('0x2e')](_0x371d38['attributes'],function(_0x4f9121){var _0x22de60={};_0x22de60[_0x4f9121]={'$like':'%'+_0x2a4f85[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0x22de60;})});}_0x371d38=_['merge']({},_0x371d38,_0x2a4f85['options']);return _0x337621[_0x77da('0x61')](_0x371d38);}})['then'](function(_0x278f20){if(_0x278f20){_0x14dec8=_0x278f20[_0x77da('0x3a')];if(!_0x2a4f85['query'][_0x77da('0x3b')]('nolimit')){_0x371d38[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x3d')]);_0x371d38['offset']=qs[_0x77da('0x1f')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x1f')]);}return _0x337621[_0x77da('0x61')](_0x371d38);}})[_0x77da('0x25')](function(_0x227739){if(_0x227739){return _0x227739?{'count':_0x14dec8,'rows':_0x227739}:null;}})[_0x77da('0x25')](respondWithResult(_0x4015f0,null))['catch'](handleError(_0x4015f0,null));};exports['addTeams']=function(_0x115876,_0x32676b,_0x3c96b9){var _0x55ee92=_0x115876['body']['ids'];return db['Team'][_0x77da('0x45')]({'where':{'id':_0x55ee92},'attributes':['id'],'include':[{'model':db[_0x77da('0x58')],'as':_0x77da('0x62'),'attributes':['id','name',_0x77da('0x63'),'voicePause',_0x77da('0x64')],'raw':!![]}]})['then'](function(_0x202365){if(_0x202365){var _0x5bbf75=_[_0x77da('0x65')](_0x202365,function(_0x415b56){var _0x54c5bf=_0x415b56[_0x77da('0x26')]({'plain':!![]});return _0x54c5bf[_0x77da('0x62')];});return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x115876[_0x77da('0x48')]['id']}})[_0x77da('0x25')](function(_0x2059ba){return db[_0x77da('0x66')][_0x77da('0x67')](function(_0x485e38){return _0x2059ba['addTeams'](_0x55ee92,{'transaction':_0x485e38})['then'](function(){return BPromise[_0x77da('0x68')](_0x5bbf75,function(_0x330db7){return db[_0x77da('0x57')]['findOrCreate']({'where':{'UserId':_0x330db7['id'],'SmsQueueId':_0x115876[_0x77da('0x48')]['id']},'transaction':_0x485e38});});})['then'](function(){_0x5bbf75['forEach'](function(_0x3474c2){socket[_0x77da('0x69')]('userSmsQueue:save',{'UserId':_0x3474c2['id'],'SmsQueueId':_0x2059ba['id']});});});});});}})['then'](respondWithStatusCode(_0x32676b,null))[_0x77da('0x47')](handleError(_0x32676b,null));};exports[_0x77da('0x6a')]=function(_0x35bd7f,_0x5d9750,_0x17536b){return db['Team'][_0x77da('0x45')]({'where':{'id':_0x35bd7f[_0x77da('0x35')][_0x77da('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x77da('0x58')],'as':_0x77da('0x62'),'attributes':['id'],'raw':!![]}]})[_0x77da('0x25')](handleEntityNotFound(_0x5d9750,null))['then'](function(_0x304029){var _0x2410ae=_[_0x77da('0x2e')](_0x304029,'id');var _0x2c8d07=[];var _0x49c170=[];var _0x33ad4f=squel['select']();_0x33ad4f[_0x77da('0x6c')](_0x77da('0x6d'))[_0x77da('0x6e')](_0x77da('0x6f'),'tq')[_0x77da('0x70')](_0x77da('0x71'),'ut',_0x77da('0x72'))[_0x77da('0x40')]('SmsQueueId\x20=\x20?',_0x35bd7f[_0x77da('0x48')]['id']);for(var _0x3132f0=0x0;_0x3132f0<_0x304029[_0x77da('0x3a')];_0x3132f0+=0x1){let _0x651f1a=_0x304029[_0x3132f0];for(var _0x384cff=0x0;_0x384cff<_0x651f1a[_0x77da('0x62')][_0x77da('0x3a')];_0x384cff+=0x1){let _0x12299f=_0x651f1a['Agents'][_0x384cff];var _0x531cc6=_0x33ad4f[_0x77da('0x73')]();_0x531cc6[_0x77da('0x40')](_0x77da('0x74'),_0x12299f['id']);_0x49c170['push'](db[_0x77da('0x66')]['query'](_0x531cc6[_0x77da('0x75')](),{'type':db[_0x77da('0x66')][_0x77da('0x76')]['SELECT']})['then'](function(_0x20ae0a){if(_0x20ae0a['length']===0x1){return _0x12299f['id'];}else{var _0x517621=_[_0x77da('0x77')](_[_0x77da('0x2e')](_0x20ae0a,_0x77da('0x78')),function(_0xdc2773){return _['includes'](_0x2410ae,_0xdc2773);});if(_0x517621){return _0x12299f['id'];}}}));}}return BPromise[_0x77da('0x79')](_0x49c170)['then'](function(_0x490dd8){_0x2c8d07=_(_0x2c8d07)['union'](_0x490dd8)[_0x77da('0x7a')]()[_0x77da('0x7b')]();return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x35bd7f[_0x77da('0x48')]['id']}})[_0x77da('0x25')](function(_0xd8218e){return db[_0x77da('0x66')]['transaction'](function(_0x91641b){return _0xd8218e[_0x77da('0x6a')](_0x35bd7f['query'][_0x77da('0x6b')],{'transaction':_0x91641b})['then'](function(){if(!_[_0x77da('0x7c')](_0x2c8d07)){return _0xd8218e[_0x77da('0x7d')](_0x2c8d07,{'transaction':_0x91641b});}})[_0x77da('0x25')](function(){_0x2c8d07[_0x77da('0x7e')](function(_0xdd97a){socket['emit'](_0x77da('0x7f'),{'UserId':_0xdd97a,'SmsQueueId':_0xd8218e['id']});});});});});});})[_0x77da('0x25')](respondWithStatusCode(_0x5d9750,null))['catch'](handleError(_0x5d9750,null));};exports[_0x77da('0x80')]=function(_0x4cc398,_0x5e5d6d,_0x2ef41b){return db['SmsQueue']['find']({'where':{'id':_0x4cc398[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x5e5d6d,null))[_0x77da('0x25')](function(_0x42a225){if(_0x42a225){return _0x42a225['addAgents'](_0x4cc398[_0x77da('0x4b')]['ids'],_[_0x77da('0x81')](_0x4cc398['body'],['ids','id'])||{})[_0x77da('0x82')](function(_0x515bd8){for(var _0x29116c=0x0;_0x29116c<_0x4cc398[_0x77da('0x4b')]['ids'][_0x77da('0x3a')];_0x29116c+=0x1){socket[_0x77da('0x69')](_0x77da('0x83'),{'UserId':_0x4cc398['body'][_0x77da('0x6b')][_0x29116c],'SmsQueueId':_0x4cc398[_0x77da('0x48')]['id']});}return _0x515bd8;});}})[_0x77da('0x25')](respondWithResult(_0x5e5d6d,null))[_0x77da('0x47')](handleError(_0x5e5d6d,null));};exports['removeAgents']=function(_0x38b861,_0x5c1e1b,_0x15cd24){return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x38b861[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x5c1e1b,null))[_0x77da('0x25')](function(_0x1015f4){if(_0x1015f4){return _0x1015f4[_0x77da('0x7d')](_0x38b861[_0x77da('0x35')][_0x77da('0x6b')])[_0x77da('0x25')](function(){if(_[_0x77da('0x84')](_0x38b861[_0x77da('0x35')]['ids'])){for(var _0x27e0e9=0x0;_0x27e0e9<_0x38b861['query']['ids'][_0x77da('0x3a')];_0x27e0e9+=0x1){socket['emit'](_0x77da('0x7f'),{'UserId':Number(_0x38b861[_0x77da('0x35')]['ids'][_0x27e0e9]),'SmsQueueId':Number(_0x38b861[_0x77da('0x48')]['id'])});}}else{socket[_0x77da('0x69')](_0x77da('0x7f'),{'UserId':Number(_0x38b861[_0x77da('0x35')][_0x77da('0x6b')]),'SmsQueueId':Number(_0x38b861[_0x77da('0x48')]['id'])});}});}})[_0x77da('0x25')](respondWithStatusCode(_0x5c1e1b,null))[_0x77da('0x47')](handleError(_0x5c1e1b,null));};exports[_0x77da('0x85')]=function(_0x2e7460,_0x41d7e2,_0x2267c4){var _0x3def5c={};var _0x53d153={};var _0x1a2bd8;var _0x2cf6d2;return db['SmsQueue']['findOne']({'where':{'id':_0x2e7460[_0x77da('0x48')]['id']}})['then'](handleEntityNotFound(_0x41d7e2,null))[_0x77da('0x25')](function(_0x58ffcd){if(_0x58ffcd){_0x1a2bd8=_0x58ffcd;_0x53d153[_0x77da('0x34')]=_['keys'](db[_0x77da('0x58')][_0x77da('0x30')]);_0x53d153[_0x77da('0x35')]=_['keys'](_0x2e7460['query']);_0x53d153[_0x77da('0x37')]=_[_0x77da('0x38')](_0x53d153['model'],_0x53d153[_0x77da('0x35')]);_0x3def5c[_0x77da('0x39')]=_[_0x77da('0x38')](_0x53d153[_0x77da('0x34')],qs[_0x77da('0x49')](_0x2e7460[_0x77da('0x35')][_0x77da('0x49')]));_0x3def5c[_0x77da('0x39')]=_0x3def5c[_0x77da('0x39')][_0x77da('0x3a')]?_0x3def5c[_0x77da('0x39')]:_0x53d153[_0x77da('0x34')];_0x3def5c[_0x77da('0x3e')]=qs['sort'](_0x2e7460[_0x77da('0x35')]['sort']);_0x3def5c['where']=qs[_0x77da('0x37')](_[_0x77da('0x60')](_0x2e7460[_0x77da('0x35')],_0x53d153[_0x77da('0x37')]));if(_0x2e7460['query'][_0x77da('0x42')]){_0x3def5c[_0x77da('0x40')]=_['merge'](_0x3def5c[_0x77da('0x40')],{'$or':_[_0x77da('0x2e')](_0x3def5c[_0x77da('0x39')],function(_0x211853){var _0x2fdd40={};_0x2fdd40[_0x211853]={'$like':'%'+_0x2e7460[_0x77da('0x35')]['filter']+'%'};return _0x2fdd40;})});}_0x3def5c=_[_0x77da('0x41')]({},_0x3def5c,_0x2e7460['options']);return _0x1a2bd8[_0x77da('0x85')](_0x3def5c);}})[_0x77da('0x25')](function(_0x4beafb){if(_0x4beafb){_0x2cf6d2=_0x4beafb[_0x77da('0x3a')];if(!_0x2e7460['query']['hasOwnProperty'](_0x77da('0x3c'))){_0x3def5c[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x2e7460['query']['limit']);_0x3def5c['offset']=qs[_0x77da('0x1f')](_0x2e7460[_0x77da('0x35')][_0x77da('0x1f')]);}return _0x1a2bd8[_0x77da('0x85')](_0x3def5c);}})[_0x77da('0x25')](function(_0x171987){if(_0x171987){return _0x171987?{'count':_0x2cf6d2,'rows':_0x171987}:null;}})[_0x77da('0x25')](respondWithResult(_0x41d7e2,null))['catch'](handleError(_0x41d7e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 93abbdd..7991a65 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 _0x916c=['save','update','emit','exports','events','SmsQueue','setMaxListeners'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x916c,0x6d));var _0xc916=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x916c[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0xc916('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc916('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc916('0x2')](0x0);var events={'afterCreate':_0xc916('0x3'),'afterUpdate':_0xc916('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f6379){return function(_0xc6419e,_0x4aa50e,_0x19bd36){SmsQueueEvents[_0xc916('0x5')](_0x2f6379+':'+_0xc6419e['id'],_0xc6419e);SmsQueueEvents[_0xc916('0x5')](_0x2f6379,_0xc6419e);_0x19bd36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc916('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x8131=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','save'];(function(_0x31244f,_0x4a775f){var _0x4e9957=function(_0x4991ff){while(--_0x4991ff){_0x31244f['push'](_0x31244f['shift']());}};_0x4e9957(++_0x4a775f);}(_0x8131,0x71));var _0x1813=function(_0x3c473e,_0x42a012){_0x3c473e=_0x3c473e-0x0;var _0xa8295=_0x8131[_0x3c473e];return _0xa8295;};'use strict';var EventEmitter=require(_0x1813('0x0'));var SmsQueue=require(_0x1813('0x1'))['db'][_0x1813('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1813('0x3'),'afterUpdate':_0x1813('0x4'),'afterDestroy':_0x1813('0x5')};function emitEvent(_0x1860da){return function(_0x3ad84f,_0x599ca8,_0x34e4d8){SmsQueueEvents[_0x1813('0x6')](_0x1860da+':'+_0x3ad84f['id'],_0x3ad84f);SmsQueueEvents[_0x1813('0x6')](_0x1860da,_0x3ad84f);_0x34e4d8(null);};}for(var e in events){if(events[_0x1813('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1813('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0a682be..b2d058e 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 _0x2882=['../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0x2882,0xb8));var _0x2288=function(_0x4efe53,_0x4fbfc5){_0x4efe53=_0x4efe53-0x0;var _0x5846d2=_0x2882[_0x4efe53];return _0x5846d2;};'use strict';var _=require(_0x2288('0x0'));var util=require(_0x2288('0x1'));var logger=require(_0x2288('0x2'))(_0x2288('0x3'));var moment=require(_0x2288('0x4'));var BPromise=require(_0x2288('0x5'));var rp=require(_0x2288('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2288('0x7'));var config=require(_0x2288('0x8'));var attributes=require(_0x2288('0x9'));module['exports']=function(_0x4dce99,_0x4b7061){return _0x4dce99['define'](_0x2288('0xa'),attributes,{'tableName':_0x2288('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2420=['define','SmsQueue','sms_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x476575,_0x3aa617){var _0x1f2bb8=function(_0x4da296){while(--_0x4da296){_0x476575['push'](_0x476575['shift']());}};_0x1f2bb8(++_0x3aa617);}(_0x2420,0x1e3));var _0x0242=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x2420[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0242('0x2'));var rp=require(_0x0242('0x3'));var fs=require('fs');var path=require(_0x0242('0x4'));var rimraf=require(_0x0242('0x5'));var config=require(_0x0242('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x3717fb,_0x447859){return _0x3717fb[_0x0242('0x7')](_0x0242('0x8'),attributes,{'tableName':_0x0242('0x9'),'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 b8e9f24..b9a78ce 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 _0xdc45=['defaults','localhost','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','options','where','attributes','limit','include','model','map','ShowSmsQueue','find','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x4a3823,_0x2f868f){var _0x146fb0=function(_0x200502){while(--_0x200502){_0x4a3823['push'](_0x4a3823['shift']());}};_0x146fb0(++_0x2f868f);}(_0xdc45,0xd4));var _0x5dc4=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0xdc45[_0x28cddc];return _0x5ce855;};'use strict';var _=require(_0x5dc4('0x0'));var util=require(_0x5dc4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dc4('0x2'));var db=require(_0x5dc4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dc4('0x4'))(_0x5dc4('0x5'));var config=require(_0x5dc4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5dc4('0x7')][_0x5dc4('0x8')]({'port':0x232a});config[_0x5dc4('0x9')]=_[_0x5dc4('0xa')](config[_0x5dc4('0x9')],{'host':_0x5dc4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5dc4('0x9')]));require(_0x5dc4('0xc'))[_0x5dc4('0xd')](socket);function respondWithRpcPromise(_0x23106e,_0x13384e,_0x5e9d9e){return new BPromise(function(_0x42de15,_0x218a4c){return client['request'](_0x23106e,_0x5e9d9e)[_0x5dc4('0xe')](function(_0x3c7b21){logger['info']('SmsQueue,\x20%s,\x20%s',_0x13384e,_0x5dc4('0xf'));logger[_0x5dc4('0x10')](_0x5dc4('0x11'),_0x13384e,_0x5dc4('0xf'),JSON[_0x5dc4('0x12')](_0x3c7b21));if(_0x3c7b21[_0x5dc4('0x13')]){if(_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x14')]===0x1f4){logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x16')]);return _0x218a4c(_0x3c7b21[_0x5dc4('0x13')]['message']);}logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x3c7b21['error'][_0x5dc4('0x16')]);return _0x42de15(_0x3c7b21[_0x5dc4('0x13')][_0x5dc4('0x16')]);}else{logger[_0x5dc4('0x17')](_0x5dc4('0x15'),_0x13384e,'request\x20sent');_0x42de15(_0x3c7b21[_0x5dc4('0x18')][_0x5dc4('0x16')]);}})[_0x5dc4('0x19')](function(_0x19f3ef){logger[_0x5dc4('0x13')](_0x5dc4('0x15'),_0x13384e,_0x19f3ef);_0x218a4c(_0x19f3ef);});});}exports[_0x5dc4('0x1a')]=function(_0x37216d){var _0x1bf57b=this;return new Promise(function(_0x5befc0,_0x1d7b39){return db[_0x5dc4('0x1b')]['findAll']({'raw':_0x37216d['options']?_0x37216d[_0x5dc4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x37216d[_0x5dc4('0x1c')]?_0x37216d['options'][_0x5dc4('0x1d')]||null:null,'attributes':_0x37216d[_0x5dc4('0x1c')]?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x1e')]||null:null,'limit':_0x37216d[_0x5dc4('0x1c')]?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x1f')]||null:null,'include':_0x37216d['options']?_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x20')]?_['map'](_0x37216d[_0x5dc4('0x1c')][_0x5dc4('0x20')],function(_0x528e7c){return{'model':db[_0x528e7c[_0x5dc4('0x21')]],'as':_0x528e7c['as'],'attributes':_0x528e7c['attributes'],'include':_0x528e7c['include']?_[_0x5dc4('0x22')](_0x528e7c[_0x5dc4('0x20')],function(_0x3c9484){return{'model':db[_0x3c9484[_0x5dc4('0x21')]],'as':_0x3c9484['as'],'attributes':_0x3c9484[_0x5dc4('0x1e')],'include':_0x3c9484['include']?_[_0x5dc4('0x22')](_0x3c9484[_0x5dc4('0x20')],function(_0x44971c){return{'model':db[_0x44971c['model']],'as':_0x44971c['as'],'attributes':_0x44971c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5dc4('0xe')](function(_0x1cf23b){logger[_0x5dc4('0x17')]('GetSmsQueue',_0x37216d);logger['debug'](_0x5dc4('0x1a'),_0x37216d,JSON[_0x5dc4('0x12')](_0x1cf23b));_0x5befc0(_0x1cf23b);})[_0x5dc4('0x19')](function(_0x4b9f60){logger[_0x5dc4('0x13')](_0x5dc4('0x1a'),_0x4b9f60[_0x5dc4('0x16')],_0x37216d);_0x1d7b39(_0x1bf57b[_0x5dc4('0x13')](0x1f4,_0x4b9f60[_0x5dc4('0x16')]));});});};exports[_0x5dc4('0x23')]=function(_0x468016){var _0x299da0=this;return new Promise(function(_0x4ca818,_0x372836){return db[_0x5dc4('0x1b')][_0x5dc4('0x24')]({'raw':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x468016['options']?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x1d')]||null:null,'attributes':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x1e')]||null:null,'include':_0x468016[_0x5dc4('0x1c')]?_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x20')]?_[_0x5dc4('0x22')](_0x468016[_0x5dc4('0x1c')][_0x5dc4('0x20')],function(_0x22d400){return{'model':db[_0x22d400['model']],'as':_0x22d400['as'],'attributes':_0x22d400[_0x5dc4('0x1e')],'include':_0x22d400[_0x5dc4('0x20')]?_['map'](_0x22d400[_0x5dc4('0x20')],function(_0x5783ad){return{'model':db[_0x5783ad[_0x5dc4('0x21')]],'as':_0x5783ad['as'],'attributes':_0x5783ad[_0x5dc4('0x1e')],'include':_0x5783ad[_0x5dc4('0x20')]?_['map'](_0x5783ad['include'],function(_0x15e9a7){return{'model':db[_0x15e9a7[_0x5dc4('0x21')]],'as':_0x15e9a7['as'],'attributes':_0x15e9a7[_0x5dc4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc4('0xe')](function(_0x3bc8d2){logger[_0x5dc4('0x17')]('ShowSmsQueue',_0x468016);logger[_0x5dc4('0x10')](_0x5dc4('0x23'),_0x468016,JSON[_0x5dc4('0x12')](_0x3bc8d2));_0x4ca818(_0x3bc8d2);})[_0x5dc4('0x19')](function(_0x28d142){logger['error'](_0x5dc4('0x23'),_0x28d142[_0x5dc4('0x16')],_0x468016);_0x372836(_0x299da0[_0x5dc4('0x13')](0x1f4,_0x28d142['message']));});});}; \ No newline at end of file +var _0x9d19=['http','redis','defaults','localhost','./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','SmsQueue','options','where','attributes','limit','include','map','model','GetSmsQueue','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9d19,0x10e));var _0x99d1=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x9d19[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x99d1('0x0'));var util=require(_0x99d1('0x1'));var moment=require(_0x99d1('0x2'));var BPromise=require(_0x99d1('0x3'));var rs=require(_0x99d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99d1('0x5'));var logger=require(_0x99d1('0x6'))(_0x99d1('0x7'));var config=require(_0x99d1('0x8'));var jayson=require(_0x99d1('0x9'));var client=jayson['client'][_0x99d1('0xa')]({'port':0x232a});config[_0x99d1('0xb')]=_[_0x99d1('0xc')](config[_0x99d1('0xb')],{'host':_0x99d1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99d1('0xb')]));require(_0x99d1('0xe'))[_0x99d1('0xf')](socket);function respondWithRpcPromise(_0x323539,_0x326f6e,_0x18e0fc){return new BPromise(function(_0x1787f9,_0x70123b){return client[_0x99d1('0x10')](_0x323539,_0x18e0fc)[_0x99d1('0x11')](function(_0x3c2bb3){logger[_0x99d1('0x12')](_0x99d1('0x13'),_0x326f6e,'request\x20sent');logger[_0x99d1('0x14')](_0x99d1('0x15'),_0x326f6e,_0x99d1('0x16'),JSON[_0x99d1('0x17')](_0x3c2bb3));if(_0x3c2bb3[_0x99d1('0x18')]){if(_0x3c2bb3[_0x99d1('0x18')]['code']===0x1f4){logger['error'](_0x99d1('0x13'),_0x326f6e,_0x3c2bb3[_0x99d1('0x18')][_0x99d1('0x19')]);return _0x70123b(_0x3c2bb3[_0x99d1('0x18')][_0x99d1('0x19')]);}logger[_0x99d1('0x18')](_0x99d1('0x13'),_0x326f6e,_0x3c2bb3['error'][_0x99d1('0x19')]);return _0x1787f9(_0x3c2bb3['error'][_0x99d1('0x19')]);}else{logger[_0x99d1('0x12')](_0x99d1('0x13'),_0x326f6e,'request\x20sent');_0x1787f9(_0x3c2bb3[_0x99d1('0x1a')][_0x99d1('0x19')]);}})[_0x99d1('0x1b')](function(_0x411910){logger[_0x99d1('0x18')]('SmsQueue,\x20%s,\x20%s',_0x326f6e,_0x411910);_0x70123b(_0x411910);});});}exports['GetSmsQueue']=function(_0x2ac991){var _0x1262fd=this;return new Promise(function(_0xf5684b,_0x177d83){return db[_0x99d1('0x1c')]['findAll']({'raw':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991[_0x99d1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2ac991['options']?_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x1e')]||null:null,'attributes':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991['options'][_0x99d1('0x1f')]||null:null,'limit':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991['options'][_0x99d1('0x20')]||null:null,'include':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x21')],function(_0x3db792){return{'model':db[_0x3db792['model']],'as':_0x3db792['as'],'attributes':_0x3db792[_0x99d1('0x1f')],'include':_0x3db792[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x3db792[_0x99d1('0x21')],function(_0x5d98f8){return{'model':db[_0x5d98f8[_0x99d1('0x23')]],'as':_0x5d98f8['as'],'attributes':_0x5d98f8[_0x99d1('0x1f')],'include':_0x5d98f8[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x5d98f8['include'],function(_0x1338cf){return{'model':db[_0x1338cf[_0x99d1('0x23')]],'as':_0x1338cf['as'],'attributes':_0x1338cf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25012d){logger[_0x99d1('0x12')]('GetSmsQueue',_0x2ac991);logger[_0x99d1('0x14')](_0x99d1('0x24'),_0x2ac991,JSON['stringify'](_0x25012d));_0xf5684b(_0x25012d);})[_0x99d1('0x1b')](function(_0x281aec){logger[_0x99d1('0x18')](_0x99d1('0x24'),_0x281aec[_0x99d1('0x19')],_0x2ac991);_0x177d83(_0x1262fd[_0x99d1('0x18')](0x1f4,_0x281aec['message']));});});};exports['ShowSmsQueue']=function(_0x4af9fb){var _0xf3b5e4=this;return new Promise(function(_0x2ec0e5,_0x37a90b){return db['SmsQueue'][_0x99d1('0x25')]({'raw':_0x4af9fb[_0x99d1('0x1d')]?_0x4af9fb[_0x99d1('0x1d')][_0x99d1('0x26')]===undefined?!![]:![]:!![],'where':_0x4af9fb['options']?_0x4af9fb[_0x99d1('0x1d')][_0x99d1('0x1e')]||null:null,'attributes':_0x4af9fb['options']?_0x4af9fb['options']['attributes']||null:null,'include':_0x4af9fb[_0x99d1('0x1d')]?_0x4af9fb['options']['include']?_[_0x99d1('0x22')](_0x4af9fb['options']['include'],function(_0x4c97be){return{'model':db[_0x4c97be[_0x99d1('0x23')]],'as':_0x4c97be['as'],'attributes':_0x4c97be[_0x99d1('0x1f')],'include':_0x4c97be[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x4c97be[_0x99d1('0x21')],function(_0x4d1960){return{'model':db[_0x4d1960['model']],'as':_0x4d1960['as'],'attributes':_0x4d1960[_0x99d1('0x1f')],'include':_0x4d1960[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x4d1960[_0x99d1('0x21')],function(_0x285520){return{'model':db[_0x285520['model']],'as':_0x285520['as'],'attributes':_0x285520[_0x99d1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ffe0c){logger['info'](_0x99d1('0x27'),_0x4af9fb);logger[_0x99d1('0x14')]('ShowSmsQueue',_0x4af9fb,JSON[_0x99d1('0x17')](_0x2ffe0c));_0x2ec0e5(_0x2ffe0c);})[_0x99d1('0x1b')](function(_0x471b7a){logger[_0x99d1('0x18')](_0x99d1('0x27'),_0x471b7a[_0x99d1('0x19')],_0x4af9fb);_0x37a90b(_0xf3b5e4['error'](0x1f4,_0x471b7a[_0x99d1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 464b4ae..7102c42 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 _0xf22c=['removeListener','register','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0x412d17,_0x298f1d){var _0x7e9095=function(_0x3e6a7a){while(--_0x3e6a7a){_0x412d17['push'](_0x412d17['shift']());}};_0x7e9095(++_0x298f1d);}(_0xf22c,0x9d));var _0xcf22=function(_0x258caf,_0x34ec5b){_0x258caf=_0x258caf-0x0;var _0x47a00c=_0xf22c[_0x258caf];return _0x47a00c;};'use strict';var SmsQueueEvents=require(_0xcf22('0x0'));var events=[_0xcf22('0x1'),'remove',_0xcf22('0x2')];function createListener(_0x68e0aa,_0x523562){return function(_0x191876){_0x523562[_0xcf22('0x3')](_0x68e0aa,_0x191876);};}function removeListener(_0x4a6bb9,_0x3a0418){return function(){SmsQueueEvents[_0xcf22('0x4')](_0x4a6bb9,_0x3a0418);};}exports[_0xcf22('0x5')]=function(_0x559cbf){for(var _0x3288f8=0x0,_0x24ee57=events['length'];_0x3288f8<_0x24ee57;_0x3288f8++){var _0x8781a8=events[_0x3288f8];var _0x1e627=createListener(_0xcf22('0x6')+_0x8781a8,_0x559cbf);SmsQueueEvents['on'](_0x8781a8,_0x1e627);}}; \ No newline at end of file +var _0x8226=['smsQueue:','./smsQueue.events','save','update','emit','removeListener','length'];(function(_0x5700ed,_0x3b72f9){var _0x2a60bf=function(_0x6694f2){while(--_0x6694f2){_0x5700ed['push'](_0x5700ed['shift']());}};_0x2a60bf(++_0x3b72f9);}(_0x8226,0xbe));var _0x6822=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x8226[_0x150bff];return _0x296f9a;};'use strict';var SmsQueueEvents=require(_0x6822('0x0'));var events=[_0x6822('0x1'),'remove',_0x6822('0x2')];function createListener(_0x6ab579,_0x2001b1){return function(_0xc09c7b){_0x2001b1[_0x6822('0x3')](_0x6ab579,_0xc09c7b);};}function removeListener(_0x52bf21,_0x4cd34e){return function(){SmsQueueEvents[_0x6822('0x4')](_0x52bf21,_0x4cd34e);};}exports['register']=function(_0x1a8c97){for(var _0x3070f0=0x0,_0x5c7cf5=events[_0x6822('0x5')];_0x3070f0<_0x5c7cf5;_0x3070f0++){var _0x503c56=events[_0x3070f0];var _0x605236=createListener(_0x6822('0x6')+_0x503c56,_0x1a8c97);SmsQueueEvents['on'](_0x503c56,_0x605236);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b4bc067..b62109e 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 _0xf6ef=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xf6ef,0xcc));var _0xff6e=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0xf6ef[_0x16b77e];return _0x3ae284;};'use strict';var multer=require(_0xff6e('0x0'));var util=require('util');var path=require(_0xff6e('0x1'));var timeout=require('connect-timeout');var express=require(_0xff6e('0x2'));var router=express['Router']();var auth=require(_0xff6e('0x3'));var interaction=require(_0xff6e('0x4'));var config=require(_0xff6e('0x5'));var controller=require('./smsQueueReport.controller');router[_0xff6e('0x6')]('/',auth[_0xff6e('0x7')](),controller[_0xff6e('0x8')]);router[_0xff6e('0x6')]('/describe',auth[_0xff6e('0x7')](),controller['describe']);router[_0xff6e('0x6')]('/:id',auth[_0xff6e('0x7')](),controller[_0xff6e('0x9')]);router[_0xff6e('0xa')]('/',auth[_0xff6e('0x7')](),controller[_0xff6e('0xb')]);router[_0xff6e('0xc')](_0xff6e('0xd'),auth[_0xff6e('0x7')](),controller[_0xff6e('0xe')]);router['delete'](_0xff6e('0xd'),auth[_0xff6e('0x7')](),controller[_0xff6e('0xf')]);module[_0xff6e('0x10')]=router; \ No newline at end of file +var _0x6d41=['update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x237e11,_0x2cb7e5){var _0xa0bf6b=function(_0x5c783e){while(--_0x5c783e){_0x237e11['push'](_0x237e11['shift']());}};_0xa0bf6b(++_0x2cb7e5);}(_0x6d41,0x7b));var _0x16d4=function(_0x12a535,_0x2ec3d3){_0x12a535=_0x12a535-0x0;var _0x2677b4=_0x6d41[_0x12a535];return _0x2677b4;};'use strict';var multer=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var path=require('path');var timeout=require(_0x16d4('0x2'));var express=require(_0x16d4('0x3'));var router=express['Router']();var auth=require(_0x16d4('0x4'));var interaction=require(_0x16d4('0x5'));var config=require(_0x16d4('0x6'));var controller=require(_0x16d4('0x7'));router[_0x16d4('0x8')]('/',auth['isAuthenticated'](),controller[_0x16d4('0x9')]);router[_0x16d4('0x8')](_0x16d4('0xa'),auth[_0x16d4('0xb')](),controller[_0x16d4('0xc')]);router['get'](_0x16d4('0xd'),auth['isAuthenticated'](),controller[_0x16d4('0xe')]);router['post']('/',auth[_0x16d4('0xb')](),controller[_0x16d4('0xf')]);router[_0x16d4('0x10')]('/:id',auth[_0x16d4('0xb')](),controller[_0x16d4('0x11')]);router[_0x16d4('0x12')](_0x16d4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x16d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b1203a3..ca3a89a 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 _0x2b3d=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b3d,0x1c7));var _0xd2b3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b3d[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xd2b3('0x0'));var Sequelize=require(_0xd2b3('0x1'));module[_0xd2b3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd2b3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd2b3('0x4')]},'acceptAt':{'type':Sequelize[_0xd2b3('0x4')]},'exitAt':{'type':Sequelize[_0xd2b3('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01fb=['sequelize','DATE','STRING','moment'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x01fb,0x17f));var _0xb01f=function(_0x5a0e57,_0x2cd966){_0x5a0e57=_0x5a0e57-0x0;var _0xf8a6a1=_0x01fb[_0x5a0e57];return _0xf8a6a1;};'use strict';var moment=require(_0xb01f('0x0'));var Sequelize=require(_0xb01f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb01f('0x2')]},'leaveAt':{'type':Sequelize[_0xb01f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb01f('0x2')]},'reason':{'type':Sequelize[_0xb01f('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a104ec1..e549748 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 _0x9186=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','findAll','show','params','keys','include','find','create','body','catch','update','destroy'];(function(_0x270e5f,_0x550ce1){var _0x418c39=function(_0x5da3f6){while(--_0x5da3f6){_0x270e5f['push'](_0x270e5f['shift']());}};_0x418c39(++_0x550ce1);}(_0x9186,0x97));var _0x6918=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x9186[_0x8afdd0];return _0x3de7ac;};'use strict';var pdf=require(_0x6918('0x0'));var emlformat=require(_0x6918('0x1'));var rimraf=require(_0x6918('0x2'));var zipdir=require(_0x6918('0x3'));var jsonpatch=require(_0x6918('0x4'));var rp=require('request-promise');var moment=require(_0x6918('0x5'));var BPromise=require(_0x6918('0x6'));var Mustache=require(_0x6918('0x7'));var util=require(_0x6918('0x8'));var path=require(_0x6918('0x9'));var sox=require(_0x6918('0xa'));var csv=require(_0x6918('0xb'));var ejs=require(_0x6918('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6918('0xd'));var crypto=require(_0x6918('0xe'));var jsforce=require(_0x6918('0xf'));var deskjs=require(_0x6918('0x10'));var toCsv=require(_0x6918('0xb'));var querystring=require(_0x6918('0x11'));var Papa=require(_0x6918('0x12'));var Redis=require(_0x6918('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6918('0x14'));var as=require(_0x6918('0x15'));var hardwareService=require(_0x6918('0x16'));var logger=require(_0x6918('0x17'))(_0x6918('0x18'));var utils=require('../../config/utils');var config=require(_0x6918('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6918('0x1a'))['db'];function respondWithStatusCode(_0x43c864,_0x1c8078){_0x1c8078=_0x1c8078||0xcc;return function(_0x19cd71){if(_0x19cd71){return _0x43c864[_0x6918('0x1b')](_0x1c8078);}return _0x43c864[_0x6918('0x1c')](_0x1c8078)['end']();};}function respondWithResult(_0x3cd926,_0x234d1e){_0x234d1e=_0x234d1e||0xc8;return function(_0xf1a52d){if(_0xf1a52d){return _0x3cd926[_0x6918('0x1c')](_0x234d1e)[_0x6918('0x1d')](_0xf1a52d);}};}function respondWithFilteredResult(_0x33c9e6,_0x1b545f){return function(_0x108ac4){if(_0x108ac4){var _0x587cdc=_0x108ac4[_0x6918('0x1e')],_0x551baa=_0x1b545f[_0x6918('0x1f')],_0x396f30=_0x1b545f[_0x6918('0x1f')]+_0x1b545f[_0x6918('0x20')],_0x4dea2e;if(_0x396f30>=_0x587cdc){_0x396f30=_0x587cdc;_0x4dea2e=0xc8;}else{_0x4dea2e=0xce;}_0x33c9e6[_0x6918('0x1c')](_0x4dea2e);return _0x33c9e6[_0x6918('0x21')]('Content-Range',_0x551baa+'-'+_0x396f30+'/'+_0x587cdc)['json'](_0x108ac4);}return null;};}function patchUpdates(_0x1298f9){return function(_0x10da56){try{jsonpatch[_0x6918('0x22')](_0x10da56,_0x1298f9,!![]);}catch(_0x1a8d42){return BPromise[_0x6918('0x23')](_0x1a8d42);}return _0x10da56[_0x6918('0x24')]();};}function saveUpdates(_0x342858,_0x2cf43e){return function(_0x277163){if(_0x277163){return _0x277163['update'](_0x342858)[_0x6918('0x25')](function(_0xf9fbe5){return _0xf9fbe5;});}return null;};}function removeEntity(_0x58912,_0x39fe2f){return function(_0x357c57){if(_0x357c57){return _0x357c57['destroy']()['then'](function(){_0x58912[_0x6918('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28162e,_0x593202){return function(_0x1221d8){if(!_0x1221d8){_0x28162e[_0x6918('0x1b')](0x194);}return _0x1221d8;};}function handleError(_0x4bbaba,_0x8651f3){_0x8651f3=_0x8651f3||0x1f4;return function(_0x4853bb){logger['error'](_0x4853bb[_0x6918('0x26')]);if(_0x4853bb[_0x6918('0x27')]){delete _0x4853bb['name'];}_0x4bbaba['status'](_0x8651f3)[_0x6918('0x28')](_0x4853bb);};}exports[_0x6918('0x29')]=function(_0x449c1f,_0x1f1454){var _0xb26e34={},_0x1e4ffd={},_0x38fbc8={'count':0x0,'rows':[]};var _0x75ed57=_[_0x6918('0x2a')](db['SmsQueueReport'][_0x6918('0x2b')],function(_0x15c345){return{'name':_0x15c345['fieldName'],'type':_0x15c345[_0x6918('0x2c')][_0x6918('0x2d')]};});_0x1e4ffd['model']=_['map'](_0x75ed57,_0x6918('0x27'));_0x1e4ffd[_0x6918('0x2e')]=_['keys'](_0x449c1f[_0x6918('0x2e')]);_0x1e4ffd[_0x6918('0x2f')]=_[_0x6918('0x30')](_0x1e4ffd['model'],_0x1e4ffd[_0x6918('0x2e')]);_0xb26e34[_0x6918('0x31')]=_[_0x6918('0x30')](_0x1e4ffd['model'],qs[_0x6918('0x32')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x32')]));_0xb26e34['attributes']=_0xb26e34['attributes'][_0x6918('0x33')]?_0xb26e34[_0x6918('0x31')]:_0x1e4ffd[_0x6918('0x34')];if(!_0x449c1f[_0x6918('0x2e')]['hasOwnProperty'](_0x6918('0x35'))){_0xb26e34['limit']=qs[_0x6918('0x20')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x20')]);_0xb26e34[_0x6918('0x1f')]=qs['offset'](_0x449c1f[_0x6918('0x2e')]['offset']);}_0xb26e34[_0x6918('0x36')]=qs[_0x6918('0x37')](_0x449c1f[_0x6918('0x2e')][_0x6918('0x37')]);_0xb26e34[_0x6918('0x38')]=qs[_0x6918('0x2f')](_[_0x6918('0x39')](_0x449c1f[_0x6918('0x2e')],_0x1e4ffd[_0x6918('0x2f')]),_0x75ed57);if(_0x449c1f[_0x6918('0x2e')][_0x6918('0x3a')]){_0xb26e34[_0x6918('0x38')]=_[_0x6918('0x3b')](_0xb26e34[_0x6918('0x38')],{'$or':_['map'](_0x75ed57,function(_0x17f477){if(_0x17f477[_0x6918('0x2c')]!=='VIRTUAL'){var _0x2f60c9={};_0x2f60c9[_0x17f477[_0x6918('0x27')]]={'$like':'%'+_0x449c1f[_0x6918('0x2e')][_0x6918('0x3a')]+'%'};return _0x2f60c9;}})});}_0xb26e34=_[_0x6918('0x3b')]({},_0xb26e34,_0x449c1f[_0x6918('0x3c')]);var _0x4b906a={'where':_0xb26e34[_0x6918('0x38')]};return db[_0x6918('0x3d')][_0x6918('0x1e')](_0x4b906a)[_0x6918('0x25')](function(_0x5bed74){_0x38fbc8[_0x6918('0x1e')]=_0x5bed74;if(_0x449c1f[_0x6918('0x2e')][_0x6918('0x3e')]){_0xb26e34['include']=[{'all':!![]}];}return db[_0x6918('0x3d')][_0x6918('0x3f')](_0xb26e34);})[_0x6918('0x25')](function(_0x40afb6){_0x38fbc8['rows']=_0x40afb6;return _0x38fbc8;})[_0x6918('0x25')](respondWithFilteredResult(_0x1f1454,_0xb26e34))['catch'](handleError(_0x1f1454,null));};exports[_0x6918('0x40')]=function(_0x54805e,_0x146152){var _0x3cb2ac={'raw':!![],'where':{'id':_0x54805e[_0x6918('0x41')]['id']}},_0x3ed015={};_0x3ed015[_0x6918('0x34')]=_[_0x6918('0x42')](db['SmsQueueReport'][_0x6918('0x2b')]);_0x3ed015[_0x6918('0x2e')]=_[_0x6918('0x42')](_0x54805e[_0x6918('0x2e')]);_0x3ed015[_0x6918('0x2f')]=_[_0x6918('0x30')](_0x3ed015[_0x6918('0x34')],_0x3ed015[_0x6918('0x2e')]);_0x3cb2ac[_0x6918('0x31')]=_['intersection'](_0x3ed015[_0x6918('0x34')],qs[_0x6918('0x32')](_0x54805e['query']['fields']));_0x3cb2ac[_0x6918('0x31')]=_0x3cb2ac[_0x6918('0x31')]['length']?_0x3cb2ac[_0x6918('0x31')]:_0x3ed015[_0x6918('0x34')];if(_0x54805e[_0x6918('0x2e')][_0x6918('0x3e')]){_0x3cb2ac[_0x6918('0x43')]=[{'all':!![]}];}_0x3cb2ac=_[_0x6918('0x3b')]({},_0x3cb2ac,_0x54805e['options']);return db[_0x6918('0x3d')][_0x6918('0x44')](_0x3cb2ac)[_0x6918('0x25')](handleEntityNotFound(_0x146152,null))[_0x6918('0x25')](respondWithResult(_0x146152,null))['catch'](handleError(_0x146152,null));};exports['create']=function(_0x551ed9,_0x269bad){return db['SmsQueueReport'][_0x6918('0x45')](_0x551ed9[_0x6918('0x46')],{})[_0x6918('0x25')](respondWithResult(_0x269bad,0xc9))[_0x6918('0x47')](handleError(_0x269bad,null));};exports[_0x6918('0x48')]=function(_0x407286,_0x42c0bc){if(_0x407286[_0x6918('0x46')]['id']){delete _0x407286[_0x6918('0x46')]['id'];}return db[_0x6918('0x3d')][_0x6918('0x44')]({'where':{'id':_0x407286[_0x6918('0x41')]['id']}})[_0x6918('0x25')](handleEntityNotFound(_0x42c0bc,null))[_0x6918('0x25')](saveUpdates(_0x407286[_0x6918('0x46')],null))[_0x6918('0x25')](respondWithResult(_0x42c0bc,null))['catch'](handleError(_0x42c0bc,null));};exports[_0x6918('0x49')]=function(_0x4bf28d,_0x7c2f73){return db[_0x6918('0x3d')][_0x6918('0x44')]({'where':{'id':_0x4bf28d[_0x6918('0x41')]['id']}})[_0x6918('0x25')](handleEntityNotFound(_0x7c2f73,null))[_0x6918('0x25')](removeEntity(_0x7c2f73,null))[_0x6918('0x47')](handleError(_0x7c2f73,null));};exports['describe']=function(_0x484dc2,_0x2b7c31){return db[_0x6918('0x3d')][_0x6918('0x4a')]()[_0x6918('0x25')](respondWithResult(_0x2b7c31,null))[_0x6918('0x47')](handleError(_0x2b7c31,null));}; \ No newline at end of file +var _0x6f94=['json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4b4e8f,_0x3ab560){var _0x347232=function(_0xc04d11){while(--_0xc04d11){_0x4b4e8f['push'](_0x4b4e8f['shift']());}};_0x347232(++_0x3ab560);}(_0x6f94,0x198));var _0x46f9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x6f94[_0x1b6186];return _0x186121;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46f9('0x0'));var rimraf=require(_0x46f9('0x1'));var zipdir=require(_0x46f9('0x2'));var jsonpatch=require(_0x46f9('0x3'));var rp=require('request-promise');var moment=require(_0x46f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46f9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x46f9('0x6'));var csv=require(_0x46f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x46f9('0x8'));var jsforce=require(_0x46f9('0x9'));var deskjs=require(_0x46f9('0xa'));var toCsv=require(_0x46f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46f9('0xb'));var authService=require(_0x46f9('0xc'));var qs=require(_0x46f9('0xd'));var as=require(_0x46f9('0xe'));var hardwareService=require(_0x46f9('0xf'));var logger=require(_0x46f9('0x10'))(_0x46f9('0x11'));var utils=require(_0x46f9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x46f9('0x13'));var db=require(_0x46f9('0x14'))['db'];function respondWithStatusCode(_0x5a5cec,_0x200df8){_0x200df8=_0x200df8||0xcc;return function(_0xe48ef7){if(_0xe48ef7){return _0x5a5cec[_0x46f9('0x15')](_0x200df8);}return _0x5a5cec[_0x46f9('0x16')](_0x200df8)[_0x46f9('0x17')]();};}function respondWithResult(_0x4c02c3,_0x3101c8){_0x3101c8=_0x3101c8||0xc8;return function(_0x4bc594){if(_0x4bc594){return _0x4c02c3[_0x46f9('0x16')](_0x3101c8)[_0x46f9('0x18')](_0x4bc594);}};}function respondWithFilteredResult(_0x45a6e6,_0x595790){return function(_0x241425){if(_0x241425){var _0xba4de7=_0x241425[_0x46f9('0x19')],_0x1552fe=_0x595790[_0x46f9('0x1a')],_0x4b8993=_0x595790[_0x46f9('0x1a')]+_0x595790[_0x46f9('0x1b')],_0x485500;if(_0x4b8993>=_0xba4de7){_0x4b8993=_0xba4de7;_0x485500=0xc8;}else{_0x485500=0xce;}_0x45a6e6[_0x46f9('0x16')](_0x485500);return _0x45a6e6[_0x46f9('0x1c')](_0x46f9('0x1d'),_0x1552fe+'-'+_0x4b8993+'/'+_0xba4de7)[_0x46f9('0x18')](_0x241425);}return null;};}function patchUpdates(_0x420f0d){return function(_0x492906){try{jsonpatch[_0x46f9('0x1e')](_0x492906,_0x420f0d,!![]);}catch(_0x1f1ecf){return BPromise[_0x46f9('0x1f')](_0x1f1ecf);}return _0x492906['save']();};}function saveUpdates(_0x417169,_0xf90a93){return function(_0x220097){if(_0x220097){return _0x220097[_0x46f9('0x20')](_0x417169)['then'](function(_0x569b89){return _0x569b89;});}return null;};}function removeEntity(_0x530ae9,_0x28911f){return function(_0x41af01){if(_0x41af01){return _0x41af01[_0x46f9('0x21')]()[_0x46f9('0x22')](function(){_0x530ae9[_0x46f9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da8be,_0x3a301e){return function(_0x2da87a){if(!_0x2da87a){_0x3da8be[_0x46f9('0x15')](0x194);}return _0x2da87a;};}function handleError(_0x6a535e,_0x430b49){_0x430b49=_0x430b49||0x1f4;return function(_0x3e2190){logger['error'](_0x3e2190[_0x46f9('0x23')]);if(_0x3e2190[_0x46f9('0x24')]){delete _0x3e2190[_0x46f9('0x24')];}_0x6a535e['status'](_0x430b49)[_0x46f9('0x25')](_0x3e2190);};}exports[_0x46f9('0x26')]=function(_0x5631b3,_0x5b4952){var _0x255199={},_0x390b89={},_0x28a635={'count':0x0,'rows':[]};var _0x1ace61=_[_0x46f9('0x27')](db[_0x46f9('0x28')][_0x46f9('0x29')],function(_0x13ff4c){return{'name':_0x13ff4c[_0x46f9('0x2a')],'type':_0x13ff4c[_0x46f9('0x2b')][_0x46f9('0x2c')]};});_0x390b89[_0x46f9('0x2d')]=_['map'](_0x1ace61,_0x46f9('0x24'));_0x390b89[_0x46f9('0x2e')]=_[_0x46f9('0x2f')](_0x5631b3[_0x46f9('0x2e')]);_0x390b89[_0x46f9('0x30')]=_[_0x46f9('0x31')](_0x390b89['model'],_0x390b89['query']);_0x255199[_0x46f9('0x32')]=_[_0x46f9('0x31')](_0x390b89[_0x46f9('0x2d')],qs['fields'](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x33')]));_0x255199['attributes']=_0x255199[_0x46f9('0x32')][_0x46f9('0x34')]?_0x255199[_0x46f9('0x32')]:_0x390b89[_0x46f9('0x2d')];if(!_0x5631b3['query']['hasOwnProperty'](_0x46f9('0x35'))){_0x255199[_0x46f9('0x1b')]=qs[_0x46f9('0x1b')](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x1b')]);_0x255199[_0x46f9('0x1a')]=qs[_0x46f9('0x1a')](_0x5631b3['query'][_0x46f9('0x1a')]);}_0x255199[_0x46f9('0x36')]=qs['sort'](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x37')]);_0x255199['where']=qs[_0x46f9('0x30')](_[_0x46f9('0x38')](_0x5631b3[_0x46f9('0x2e')],_0x390b89[_0x46f9('0x30')]),_0x1ace61);if(_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x39')]){_0x255199[_0x46f9('0x3a')]=_[_0x46f9('0x3b')](_0x255199[_0x46f9('0x3a')],{'$or':_[_0x46f9('0x27')](_0x1ace61,function(_0x5c2d85){if(_0x5c2d85[_0x46f9('0x2b')]!==_0x46f9('0x3c')){var _0x291816={};_0x291816[_0x5c2d85[_0x46f9('0x24')]]={'$like':'%'+_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x39')]+'%'};return _0x291816;}})});}_0x255199=_[_0x46f9('0x3b')]({},_0x255199,_0x5631b3[_0x46f9('0x3d')]);var _0x13e521={'where':_0x255199['where']};return db[_0x46f9('0x28')][_0x46f9('0x19')](_0x13e521)[_0x46f9('0x22')](function(_0xe97461){_0x28a635['count']=_0xe97461;if(_0x5631b3['query'][_0x46f9('0x3e')]){_0x255199[_0x46f9('0x3f')]=[{'all':!![]}];}return db[_0x46f9('0x28')][_0x46f9('0x40')](_0x255199);})[_0x46f9('0x22')](function(_0xc2f36d){_0x28a635['rows']=_0xc2f36d;return _0x28a635;})['then'](respondWithFilteredResult(_0x5b4952,_0x255199))[_0x46f9('0x41')](handleError(_0x5b4952,null));};exports[_0x46f9('0x42')]=function(_0x353739,_0x3b438f){var _0x3af0c7={'raw':!![],'where':{'id':_0x353739[_0x46f9('0x43')]['id']}},_0x4952fd={};_0x4952fd[_0x46f9('0x2d')]=_['keys'](db[_0x46f9('0x28')][_0x46f9('0x29')]);_0x4952fd[_0x46f9('0x2e')]=_[_0x46f9('0x2f')](_0x353739['query']);_0x4952fd[_0x46f9('0x30')]=_['intersection'](_0x4952fd[_0x46f9('0x2d')],_0x4952fd[_0x46f9('0x2e')]);_0x3af0c7[_0x46f9('0x32')]=_['intersection'](_0x4952fd[_0x46f9('0x2d')],qs[_0x46f9('0x33')](_0x353739[_0x46f9('0x2e')]['fields']));_0x3af0c7[_0x46f9('0x32')]=_0x3af0c7[_0x46f9('0x32')][_0x46f9('0x34')]?_0x3af0c7['attributes']:_0x4952fd[_0x46f9('0x2d')];if(_0x353739['query'][_0x46f9('0x3e')]){_0x3af0c7[_0x46f9('0x3f')]=[{'all':!![]}];}_0x3af0c7=_[_0x46f9('0x3b')]({},_0x3af0c7,_0x353739[_0x46f9('0x3d')]);return db[_0x46f9('0x28')][_0x46f9('0x44')](_0x3af0c7)[_0x46f9('0x22')](handleEntityNotFound(_0x3b438f,null))['then'](respondWithResult(_0x3b438f,null))['catch'](handleError(_0x3b438f,null));};exports[_0x46f9('0x45')]=function(_0x28c06e,_0x448b88){return db[_0x46f9('0x28')][_0x46f9('0x45')](_0x28c06e[_0x46f9('0x46')],{})[_0x46f9('0x22')](respondWithResult(_0x448b88,0xc9))[_0x46f9('0x41')](handleError(_0x448b88,null));};exports[_0x46f9('0x20')]=function(_0x2390f7,_0x207ca4){if(_0x2390f7[_0x46f9('0x46')]['id']){delete _0x2390f7[_0x46f9('0x46')]['id'];}return db[_0x46f9('0x28')][_0x46f9('0x44')]({'where':{'id':_0x2390f7[_0x46f9('0x43')]['id']}})[_0x46f9('0x22')](handleEntityNotFound(_0x207ca4,null))['then'](saveUpdates(_0x2390f7[_0x46f9('0x46')],null))[_0x46f9('0x22')](respondWithResult(_0x207ca4,null))[_0x46f9('0x41')](handleError(_0x207ca4,null));};exports[_0x46f9('0x21')]=function(_0x1d38d8,_0x31b5b5){return db['SmsQueueReport'][_0x46f9('0x44')]({'where':{'id':_0x1d38d8[_0x46f9('0x43')]['id']}})[_0x46f9('0x22')](handleEntityNotFound(_0x31b5b5,null))[_0x46f9('0x22')](removeEntity(_0x31b5b5,null))[_0x46f9('0x41')](handleError(_0x31b5b5,null));};exports[_0x46f9('0x47')]=function(_0x147600,_0x2a5149){return db['SmsQueueReport'][_0x46f9('0x47')]()[_0x46f9('0x22')](respondWithResult(_0x2a5149,null))[_0x46f9('0x41')](handleError(_0x2a5149,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ff38153..e70eb29 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 _0x0ce2=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5899df,_0x56dce4){var _0xd39505=function(_0x145d55){while(--_0x145d55){_0x5899df['push'](_0x5899df['shift']());}};_0xd39505(++_0x56dce4);}(_0x0ce2,0xfd));var _0x20ce=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0ce2[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x20ce('0x0'));var util=require('util');var logger=require(_0x20ce('0x1'))(_0x20ce('0x2'));var moment=require(_0x20ce('0x3'));var BPromise=require(_0x20ce('0x4'));var rp=require(_0x20ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x20ce('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0x20ce('0x7')]=function(_0x208e54,_0x5ae7b2){return _0x208e54['define'](_0x20ce('0x8'),attributes,{'tableName':_0x20ce('0x9'),'paranoid':![],'indexes':[{'name':_0x20ce('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['report_sms_queue','uniqueid','util','../../config/logger','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x53821e,_0x31f58d){var _0x40cc4d=function(_0x17bdee){while(--_0x17bdee){_0x53821e['push'](_0x53821e['shift']());}};_0x40cc4d(++_0x31f58d);}(_0xb821,0xa7));var _0x1b82=function(_0x3bc111,_0x137248){_0x3bc111=_0x3bc111-0x0;var _0x3431d1=_0xb821[_0x3bc111];return _0x3431d1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[{'name':_0x1b82('0xa'),'fields':[_0x1b82('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 7593dce..555a111 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 _0x2c4e=['create','options','update','body','raw','where','attributes','limit','UpdateSmsQueueReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport'];(function(_0x250d1f,_0x19c348){var _0x5356fe=function(_0x18de1f){while(--_0x18de1f){_0x250d1f['push'](_0x250d1f['shift']());}};_0x5356fe(++_0x19c348);}(_0x2c4e,0xca));var _0xe2c4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x2c4e[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xe2c4('0x0'));var util=require(_0xe2c4('0x1'));var moment=require(_0xe2c4('0x2'));var BPromise=require(_0xe2c4('0x3'));var rs=require(_0xe2c4('0x4'));var fs=require('fs');var Redis=require(_0xe2c4('0x5'));var db=require(_0xe2c4('0x6'))['db'];var utils=require(_0xe2c4('0x7'));var logger=require(_0xe2c4('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe2c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360394,_0x25809d,_0x277c5c){return new BPromise(function(_0x3fd279,_0x431c3d){return client[_0xe2c4('0xa')](_0x360394,_0x277c5c)[_0xe2c4('0xb')](function(_0x2e608c){logger[_0xe2c4('0xc')](_0xe2c4('0xd'),_0x25809d,_0xe2c4('0xe'));logger[_0xe2c4('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x25809d,'request\x20sent',JSON[_0xe2c4('0x10')](_0x2e608c));if(_0x2e608c['error']){if(_0x2e608c[_0xe2c4('0x11')]['code']===0x1f4){logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x2e608c['error'][_0xe2c4('0x12')]);return _0x431c3d(_0x2e608c[_0xe2c4('0x11')]['message']);}logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x2e608c[_0xe2c4('0x11')][_0xe2c4('0x12')]);return _0x3fd279(_0x2e608c[_0xe2c4('0x11')]['message']);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x25809d,_0xe2c4('0xe'));_0x3fd279(_0x2e608c[_0xe2c4('0x13')][_0xe2c4('0x12')]);}})['catch'](function(_0x436c21){logger[_0xe2c4('0x11')](_0xe2c4('0xd'),_0x25809d,_0x436c21);_0x431c3d(_0x436c21);});});}exports[_0xe2c4('0x14')]=function(_0x502133){var _0x2ad2c0=this;return new Promise(function(_0x23985a,_0x11dbfc){return db[_0xe2c4('0x15')][_0xe2c4('0x16')](_0x502133['body'],{'raw':_0x502133[_0xe2c4('0x17')]?_0x502133[_0xe2c4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xe2c4('0xb')](function(_0x40bd58){logger[_0xe2c4('0xc')](_0xe2c4('0x14'),_0x502133);logger[_0xe2c4('0xf')](_0xe2c4('0x14'),_0x502133,JSON[_0xe2c4('0x10')](_0x40bd58));_0x23985a(_0x40bd58);})['catch'](function(_0x30d340){logger[_0xe2c4('0x11')](_0xe2c4('0x14'),_0x30d340['message'],_0x502133);_0x11dbfc(_0x2ad2c0['error'](0x1f4,_0x30d340[_0xe2c4('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x20c30f){var _0x429f84=this;return new Promise(function(_0x118e6d,_0x5ade22){return db[_0xe2c4('0x15')][_0xe2c4('0x18')](_0x20c30f[_0xe2c4('0x19')],{'raw':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f['options'][_0xe2c4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f[_0xe2c4('0x17')][_0xe2c4('0x1b')]||null:null,'attributes':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f[_0xe2c4('0x17')][_0xe2c4('0x1c')]||null:null,'limit':_0x20c30f[_0xe2c4('0x17')]?_0x20c30f['options'][_0xe2c4('0x1d')]||null:null})[_0xe2c4('0xb')](function(_0x5a7482){logger['info'](_0xe2c4('0x1e'),_0x20c30f);logger[_0xe2c4('0xf')](_0xe2c4('0x1e'),_0x20c30f,JSON[_0xe2c4('0x10')](_0x5a7482));_0x118e6d(_0x5a7482);})[_0xe2c4('0x1f')](function(_0x1f5907){logger[_0xe2c4('0x11')]('UpdateSmsQueueReport',_0x1f5907[_0xe2c4('0x12')],_0x20c30f);_0x5ade22(_0x429f84[_0xe2c4('0x11')](0x1f4,_0x1f5907[_0xe2c4('0x12')]));});});}; \ No newline at end of file +var _0xe203=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','message','SmsQueueReport,\x20%s,\x20%s','info','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','where','limit','lodash','util','moment'];(function(_0x5091c0,_0x10cab3){var _0x2d065f=function(_0x16b026){while(--_0x16b026){_0x5091c0['push'](_0x5091c0['shift']());}};_0x2d065f(++_0x10cab3);}(_0xe203,0x1a1));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var util=require(_0x3e20('0x1'));var moment=require(_0x3e20('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e20('0x4'));var logger=require(_0x3e20('0x5'))(_0x3e20('0x6'));var config=require(_0x3e20('0x7'));var jayson=require(_0x3e20('0x8'));var client=jayson[_0x3e20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174a07,_0x185ed3,_0x331d44){return new BPromise(function(_0x20717d,_0x59dd42){return client[_0x3e20('0xa')](_0x174a07,_0x331d44)[_0x3e20('0xb')](function(_0x4209c0){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x185ed3,_0x3e20('0xc'));logger[_0x3e20('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x185ed3,_0x3e20('0xc'),JSON['stringify'](_0x4209c0));if(_0x4209c0['error']){if(_0x4209c0[_0x3e20('0xe')][_0x3e20('0xf')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x185ed3,_0x4209c0['error'][_0x3e20('0x10')]);return _0x59dd42(_0x4209c0[_0x3e20('0xe')][_0x3e20('0x10')]);}logger['error'](_0x3e20('0x11'),_0x185ed3,_0x4209c0[_0x3e20('0xe')][_0x3e20('0x10')]);return _0x20717d(_0x4209c0['error']['message']);}else{logger[_0x3e20('0x12')](_0x3e20('0x11'),_0x185ed3,'request\x20sent');_0x20717d(_0x4209c0['result'][_0x3e20('0x10')]);}})['catch'](function(_0x30fb6d){logger[_0x3e20('0xe')](_0x3e20('0x11'),_0x185ed3,_0x30fb6d);_0x59dd42(_0x30fb6d);});});}exports[_0x3e20('0x13')]=function(_0x3e8c90){var _0x2afb1d=this;return new Promise(function(_0x461521,_0x5bffac){return db[_0x3e20('0x14')][_0x3e20('0x15')](_0x3e8c90[_0x3e20('0x16')],{'raw':_0x3e8c90[_0x3e20('0x17')]?_0x3e8c90['options'][_0x3e20('0x18')]===undefined?!![]:![]:!![]})[_0x3e20('0xb')](function(_0x35d0c2){logger['info'](_0x3e20('0x13'),_0x3e8c90);logger[_0x3e20('0xd')](_0x3e20('0x13'),_0x3e8c90,JSON[_0x3e20('0x19')](_0x35d0c2));_0x461521(_0x35d0c2);})['catch'](function(_0x31422f){logger[_0x3e20('0xe')](_0x3e20('0x13'),_0x31422f[_0x3e20('0x10')],_0x3e8c90);_0x5bffac(_0x2afb1d['error'](0x1f4,_0x31422f[_0x3e20('0x10')]));});});};exports[_0x3e20('0x1a')]=function(_0x1b8f1e){var _0x5e48c9=this;return new Promise(function(_0x13b92d,_0x23f117){return db[_0x3e20('0x14')][_0x3e20('0x1b')](_0x1b8f1e[_0x3e20('0x16')],{'raw':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e[_0x3e20('0x17')][_0x3e20('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e['options'][_0x3e20('0x1c')]||null:null,'attributes':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e[_0x3e20('0x17')]['attributes']||null:null,'limit':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e['options'][_0x3e20('0x1d')]||null:null})[_0x3e20('0xb')](function(_0x56844a){logger[_0x3e20('0x12')]('UpdateSmsQueueReport',_0x1b8f1e);logger[_0x3e20('0xd')](_0x3e20('0x1a'),_0x1b8f1e,JSON[_0x3e20('0x19')](_0x56844a));_0x13b92d(_0x56844a);})['catch'](function(_0x2b538f){logger[_0x3e20('0xe')]('UpdateSmsQueueReport',_0x2b538f['message'],_0x1b8f1e);_0x23f117(_0x5e48c9[_0x3e20('0xe')](0x1f4,_0x2b538f[_0x3e20('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2ca5768..63f0080 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 _0xb62e=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var auth=require(_0xeb62('0x5'));var interaction=require(_0xeb62('0x6'));var config=require(_0xeb62('0x7'));var controller=require(_0xeb62('0x8'));router[_0xeb62('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb62('0xa')]);router[_0xeb62('0x9')](_0xeb62('0xb'),auth['isAuthenticated'](),controller[_0xeb62('0xc')]);router[_0xeb62('0x9')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller['show']);router['post']('/',auth[_0xeb62('0xe')](),controller[_0xeb62('0xf')]);router[_0xeb62('0x10')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller[_0xeb62('0x11')]);router[_0xeb62('0x12')](_0xeb62('0xd'),auth[_0xeb62('0xe')](),controller[_0xeb62('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','path','connect-timeout','express','Router'];(function(_0x2dc098,_0x48eb28){var _0x391d8d=function(_0x54bdb7){while(--_0x54bdb7){_0x2dc098['push'](_0x2dc098['shift']());}};_0x391d8d(++_0x48eb28);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3342('0x10')](_0x3342('0xd'),auth['isAuthenticated'](),controller[_0x3342('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3922f07..5d3efea 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 _0x629f=['queue','moment','sequelize','STRING','ENUM','account'];(function(_0x24bba0,_0x6d581f){var _0x11b8cd=function(_0x55893f){while(--_0x55893f){_0x24bba0['push'](_0x24bba0['shift']());}};_0x11b8cd(++_0x6d581f);}(_0x629f,0xb5));var _0xf629=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x629f[_0x406696];return _0x10e35c;};'use strict';var moment=require(_0xf629('0x0'));var Sequelize=require(_0xf629('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf629('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf629('0x3')](_0xf629('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0xf629('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x200c=['exports','STRING','account','queue','DATE','NOW','moment','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x200c,0x1c6));var _0xc200=function(_0x3a41df,_0x37f11d){_0x3a41df=_0x3a41df-0x0;var _0x46a76f=_0x200c[_0x3a41df];return _0x46a76f;};'use strict';var moment=require(_0xc200('0x0'));var Sequelize=require(_0xc200('0x1'));module[_0xc200('0x2')]={'uniqueid':{'type':Sequelize[_0xc200('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc200('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0xc200('0x5')},'transferredAt':{'type':Sequelize[_0xc200('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc200('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 57daae2..fdeef55 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 _0xd957=['end','offset','limit','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','count','include','findAll','rows','catch','params','keys','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x7d95('0x0'));var emlformat=require(_0x7d95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7d95('0x2'));var jsonpatch=require(_0x7d95('0x3'));var rp=require('request-promise');var moment=require(_0x7d95('0x4'));var BPromise=require(_0x7d95('0x5'));var Mustache=require(_0x7d95('0x6'));var util=require(_0x7d95('0x7'));var path=require(_0x7d95('0x8'));var sox=require(_0x7d95('0x9'));var csv=require(_0x7d95('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d95('0xb'));var squel=require(_0x7d95('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d95('0xd'));var deskjs=require(_0x7d95('0xe'));var toCsv=require(_0x7d95('0xa'));var querystring=require(_0x7d95('0xf'));var Papa=require(_0x7d95('0x10'));var Redis=require('ioredis');var authService=require(_0x7d95('0x11'));var qs=require(_0x7d95('0x12'));var as=require(_0x7d95('0x13'));var hardwareService=require(_0x7d95('0x14'));var logger=require(_0x7d95('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d95('0x16'));var licenseUtil=require(_0x7d95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8aea6,_0x1d6b13){_0x1d6b13=_0x1d6b13||0xcc;return function(_0x310657){if(_0x310657){return _0x8aea6[_0x7d95('0x18')](_0x1d6b13);}return _0x8aea6[_0x7d95('0x19')](_0x1d6b13)[_0x7d95('0x1a')]();};}function respondWithResult(_0x4da709,_0x82ac5f){_0x82ac5f=_0x82ac5f||0xc8;return function(_0x56e18f){if(_0x56e18f){return _0x4da709[_0x7d95('0x19')](_0x82ac5f)['json'](_0x56e18f);}};}function respondWithFilteredResult(_0x9b5091,_0x4f333d){return function(_0x3b519a){if(_0x3b519a){var _0x30c2f8=_0x3b519a['count'],_0x293f87=_0x4f333d[_0x7d95('0x1b')],_0x45bf02=_0x4f333d[_0x7d95('0x1b')]+_0x4f333d[_0x7d95('0x1c')],_0x5ab72e;if(_0x45bf02>=_0x30c2f8){_0x45bf02=_0x30c2f8;_0x5ab72e=0xc8;}else{_0x5ab72e=0xce;}_0x9b5091[_0x7d95('0x19')](_0x5ab72e);return _0x9b5091['set'](_0x7d95('0x1d'),_0x293f87+'-'+_0x45bf02+'/'+_0x30c2f8)[_0x7d95('0x1e')](_0x3b519a);}return null;};}function patchUpdates(_0x55e083){return function(_0x3c264b){try{jsonpatch[_0x7d95('0x1f')](_0x3c264b,_0x55e083,!![]);}catch(_0x2d0627){return BPromise[_0x7d95('0x20')](_0x2d0627);}return _0x3c264b[_0x7d95('0x21')]();};}function saveUpdates(_0x1a058c,_0x3ae23a){return function(_0x45bec0){if(_0x45bec0){return _0x45bec0[_0x7d95('0x22')](_0x1a058c)['then'](function(_0x30c121){return _0x30c121;});}return null;};}function removeEntity(_0x5a0f78,_0x1e2b58){return function(_0x4c0133){if(_0x4c0133){return _0x4c0133['destroy']()[_0x7d95('0x23')](function(){_0x5a0f78[_0x7d95('0x19')](0xcc)[_0x7d95('0x1a')]();});}};}function handleEntityNotFound(_0x54c0a2,_0x2f54c4){return function(_0xd7d5){if(!_0xd7d5){_0x54c0a2['sendStatus'](0x194);}return _0xd7d5;};}function handleError(_0x1938a5,_0x4e97c9){_0x4e97c9=_0x4e97c9||0x1f4;return function(_0x4ec676){logger['error'](_0x4ec676[_0x7d95('0x24')]);if(_0x4ec676[_0x7d95('0x25')]){delete _0x4ec676['name'];}_0x1938a5[_0x7d95('0x19')](_0x4e97c9)[_0x7d95('0x26')](_0x4ec676);};}exports[_0x7d95('0x27')]=function(_0x51f5c6,_0x2583e2){var _0x16ebff={},_0x2ff04c={},_0x5c0664={'count':0x0,'rows':[]};var _0x41c8c1=_['map'](db[_0x7d95('0x28')][_0x7d95('0x29')],function(_0x3d3bb8){return{'name':_0x3d3bb8[_0x7d95('0x2a')],'type':_0x3d3bb8[_0x7d95('0x2b')][_0x7d95('0x2c')]};});_0x2ff04c[_0x7d95('0x2d')]=_[_0x7d95('0x2e')](_0x41c8c1,'name');_0x2ff04c[_0x7d95('0x2f')]=_['keys'](_0x51f5c6[_0x7d95('0x2f')]);_0x2ff04c['filters']=_[_0x7d95('0x30')](_0x2ff04c[_0x7d95('0x2d')],_0x2ff04c[_0x7d95('0x2f')]);_0x16ebff[_0x7d95('0x31')]=_[_0x7d95('0x30')](_0x2ff04c[_0x7d95('0x2d')],qs['fields'](_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x32')]));_0x16ebff[_0x7d95('0x31')]=_0x16ebff[_0x7d95('0x31')][_0x7d95('0x33')]?_0x16ebff[_0x7d95('0x31')]:_0x2ff04c['model'];if(!_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x34')]('nolimit')){_0x16ebff['limit']=qs[_0x7d95('0x1c')](_0x51f5c6[_0x7d95('0x2f')]['limit']);_0x16ebff[_0x7d95('0x1b')]=qs[_0x7d95('0x1b')](_0x51f5c6[_0x7d95('0x2f')][_0x7d95('0x1b')]);}_0x16ebff[_0x7d95('0x35')]=qs[_0x7d95('0x36')](_0x51f5c6[_0x7d95('0x2f')]['sort']);_0x16ebff[_0x7d95('0x37')]=qs[_0x7d95('0x38')](_[_0x7d95('0x39')](_0x51f5c6['query'],_0x2ff04c[_0x7d95('0x38')]),_0x41c8c1);if(_0x51f5c6[_0x7d95('0x2f')]['filter']){_0x16ebff[_0x7d95('0x37')]=_[_0x7d95('0x3a')](_0x16ebff[_0x7d95('0x37')],{'$or':_[_0x7d95('0x2e')](_0x41c8c1,function(_0x4d102b){if(_0x4d102b['type']!=='VIRTUAL'){var _0x586480={};_0x586480[_0x4d102b['name']]={'$like':'%'+_0x51f5c6['query']['filter']+'%'};return _0x586480;}})});}_0x16ebff=_[_0x7d95('0x3a')]({},_0x16ebff,_0x51f5c6[_0x7d95('0x3b')]);var _0x40f2ae={'where':_0x16ebff[_0x7d95('0x37')]};return db[_0x7d95('0x28')][_0x7d95('0x3c')](_0x40f2ae)[_0x7d95('0x23')](function(_0x19496e){_0x5c0664[_0x7d95('0x3c')]=_0x19496e;if(_0x51f5c6[_0x7d95('0x2f')]['includeAll']){_0x16ebff[_0x7d95('0x3d')]=[{'all':!![]}];}return db[_0x7d95('0x28')][_0x7d95('0x3e')](_0x16ebff);})[_0x7d95('0x23')](function(_0x753179){_0x5c0664[_0x7d95('0x3f')]=_0x753179;return _0x5c0664;})[_0x7d95('0x23')](respondWithFilteredResult(_0x2583e2,_0x16ebff))[_0x7d95('0x40')](handleError(_0x2583e2,null));};exports['show']=function(_0x265fab,_0x3b9c54){var _0x543bb7={'raw':!![],'where':{'id':_0x265fab[_0x7d95('0x41')]['id']}},_0xb2f72a={};_0xb2f72a['model']=_[_0x7d95('0x42')](db['SmsTransferReport']['rawAttributes']);_0xb2f72a[_0x7d95('0x2f')]=_[_0x7d95('0x42')](_0x265fab[_0x7d95('0x2f')]);_0xb2f72a[_0x7d95('0x38')]=_[_0x7d95('0x30')](_0xb2f72a[_0x7d95('0x2d')],_0xb2f72a[_0x7d95('0x2f')]);_0x543bb7[_0x7d95('0x31')]=_[_0x7d95('0x30')](_0xb2f72a['model'],qs[_0x7d95('0x32')](_0x265fab['query'][_0x7d95('0x32')]));_0x543bb7[_0x7d95('0x31')]=_0x543bb7[_0x7d95('0x31')][_0x7d95('0x33')]?_0x543bb7[_0x7d95('0x31')]:_0xb2f72a[_0x7d95('0x2d')];if(_0x265fab[_0x7d95('0x2f')][_0x7d95('0x43')]){_0x543bb7[_0x7d95('0x3d')]=[{'all':!![]}];}_0x543bb7=_[_0x7d95('0x3a')]({},_0x543bb7,_0x265fab['options']);return db[_0x7d95('0x28')][_0x7d95('0x44')](_0x543bb7)[_0x7d95('0x23')](handleEntityNotFound(_0x3b9c54,null))[_0x7d95('0x23')](respondWithResult(_0x3b9c54,null))[_0x7d95('0x40')](handleError(_0x3b9c54,null));};exports[_0x7d95('0x45')]=function(_0x53bd0e,_0x55301e){return db[_0x7d95('0x28')][_0x7d95('0x45')](_0x53bd0e['body'],{})[_0x7d95('0x23')](respondWithResult(_0x55301e,0xc9))[_0x7d95('0x40')](handleError(_0x55301e,null));};exports['update']=function(_0x476d06,_0xb5e531){if(_0x476d06[_0x7d95('0x46')]['id']){delete _0x476d06[_0x7d95('0x46')]['id'];}return db[_0x7d95('0x28')][_0x7d95('0x44')]({'where':{'id':_0x476d06[_0x7d95('0x41')]['id']}})[_0x7d95('0x23')](handleEntityNotFound(_0xb5e531,null))[_0x7d95('0x23')](saveUpdates(_0x476d06['body'],null))[_0x7d95('0x23')](respondWithResult(_0xb5e531,null))['catch'](handleError(_0xb5e531,null));};exports[_0x7d95('0x47')]=function(_0x4af396,_0x29d3c2){return db[_0x7d95('0x28')][_0x7d95('0x44')]({'where':{'id':_0x4af396[_0x7d95('0x41')]['id']}})[_0x7d95('0x23')](handleEntityNotFound(_0x29d3c2,null))[_0x7d95('0x23')](removeEntity(_0x29d3c2,null))[_0x7d95('0x40')](handleError(_0x29d3c2,null));};exports[_0x7d95('0x48')]=function(_0x3f7944,_0x54176c){return db[_0x7d95('0x28')][_0x7d95('0x48')]()[_0x7d95('0x23')](respondWithResult(_0x54176c,null))[_0x7d95('0x40')](handleError(_0x54176c,null));}; \ No newline at end of file +var _0x61a1=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','params','destroy','describe','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xf2f6,_0x38fba6){var _0x4321fc=function(_0x52eb50){while(--_0x52eb50){_0xf2f6['push'](_0xf2f6['shift']());}};_0x4321fc(++_0x38fba6);}(_0x61a1,0x127));var _0x161a=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x61a1[_0x56e4e7];return _0x383618;};'use strict';var pdf=require(_0x161a('0x0'));var emlformat=require(_0x161a('0x1'));var rimraf=require(_0x161a('0x2'));var zipdir=require(_0x161a('0x3'));var jsonpatch=require(_0x161a('0x4'));var rp=require('request-promise');var moment=require(_0x161a('0x5'));var BPromise=require(_0x161a('0x6'));var Mustache=require('mustache');var util=require(_0x161a('0x7'));var path=require(_0x161a('0x8'));var sox=require(_0x161a('0x9'));var csv=require(_0x161a('0xa'));var ejs=require(_0x161a('0xb'));var fs=require('fs');var _=require(_0x161a('0xc'));var squel=require(_0x161a('0xd'));var crypto=require(_0x161a('0xe'));var jsforce=require(_0x161a('0xf'));var deskjs=require(_0x161a('0x10'));var toCsv=require(_0x161a('0xa'));var querystring=require(_0x161a('0x11'));var Papa=require(_0x161a('0x12'));var Redis=require(_0x161a('0x13'));var authService=require(_0x161a('0x14'));var qs=require(_0x161a('0x15'));var as=require(_0x161a('0x16'));var hardwareService=require(_0x161a('0x17'));var logger=require(_0x161a('0x18'))(_0x161a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561e37,_0x2f61f0){_0x2f61f0=_0x2f61f0||0xcc;return function(_0xe588d6){if(_0xe588d6){return _0x561e37[_0x161a('0x1a')](_0x2f61f0);}return _0x561e37[_0x161a('0x1b')](_0x2f61f0)[_0x161a('0x1c')]();};}function respondWithResult(_0x2f6a2c,_0x891d45){_0x891d45=_0x891d45||0xc8;return function(_0x4a16a8){if(_0x4a16a8){return _0x2f6a2c['status'](_0x891d45)['json'](_0x4a16a8);}};}function respondWithFilteredResult(_0x2b2a3e,_0x42eebf){return function(_0x4cbdb3){if(_0x4cbdb3){var _0x359ccd=_0x4cbdb3[_0x161a('0x1d')],_0x32b1a3=_0x42eebf[_0x161a('0x1e')],_0x510209=_0x42eebf[_0x161a('0x1e')]+_0x42eebf[_0x161a('0x1f')],_0x31dcc6;if(_0x510209>=_0x359ccd){_0x510209=_0x359ccd;_0x31dcc6=0xc8;}else{_0x31dcc6=0xce;}_0x2b2a3e[_0x161a('0x1b')](_0x31dcc6);return _0x2b2a3e[_0x161a('0x20')](_0x161a('0x21'),_0x32b1a3+'-'+_0x510209+'/'+_0x359ccd)[_0x161a('0x22')](_0x4cbdb3);}return null;};}function patchUpdates(_0x22132c){return function(_0x4118fe){try{jsonpatch[_0x161a('0x23')](_0x4118fe,_0x22132c,!![]);}catch(_0x1744ae){return BPromise['reject'](_0x1744ae);}return _0x4118fe[_0x161a('0x24')]();};}function saveUpdates(_0x172488,_0x8243dd){return function(_0x411007){if(_0x411007){return _0x411007[_0x161a('0x25')](_0x172488)[_0x161a('0x26')](function(_0x1adf3c){return _0x1adf3c;});}return null;};}function removeEntity(_0x79e925,_0xffe8e1){return function(_0xa11a84){if(_0xa11a84){return _0xa11a84['destroy']()[_0x161a('0x26')](function(){_0x79e925['status'](0xcc)[_0x161a('0x1c')]();});}};}function handleEntityNotFound(_0x2e7a46,_0x4da7fa){return function(_0x1b4937){if(!_0x1b4937){_0x2e7a46[_0x161a('0x1a')](0x194);}return _0x1b4937;};}function handleError(_0x46695c,_0x210bc7){_0x210bc7=_0x210bc7||0x1f4;return function(_0x1541c6){logger[_0x161a('0x27')](_0x1541c6[_0x161a('0x28')]);if(_0x1541c6[_0x161a('0x29')]){delete _0x1541c6['name'];}_0x46695c[_0x161a('0x1b')](_0x210bc7)[_0x161a('0x2a')](_0x1541c6);};}exports['index']=function(_0x4be3ca,_0x46a1e1){var _0x3b5779={},_0x49f7a1={},_0x1472c7={'count':0x0,'rows':[]};var _0x4a3eb6=_['map'](db[_0x161a('0x2b')][_0x161a('0x2c')],function(_0x2c5039){return{'name':_0x2c5039[_0x161a('0x2d')],'type':_0x2c5039[_0x161a('0x2e')][_0x161a('0x2f')]};});_0x49f7a1[_0x161a('0x30')]=_['map'](_0x4a3eb6,_0x161a('0x29'));_0x49f7a1[_0x161a('0x31')]=_[_0x161a('0x32')](_0x4be3ca[_0x161a('0x31')]);_0x49f7a1['filters']=_['intersection'](_0x49f7a1[_0x161a('0x30')],_0x49f7a1[_0x161a('0x31')]);_0x3b5779[_0x161a('0x33')]=_[_0x161a('0x34')](_0x49f7a1[_0x161a('0x30')],qs[_0x161a('0x35')](_0x4be3ca[_0x161a('0x31')][_0x161a('0x35')]));_0x3b5779['attributes']=_0x3b5779[_0x161a('0x33')][_0x161a('0x36')]?_0x3b5779[_0x161a('0x33')]:_0x49f7a1[_0x161a('0x30')];if(!_0x4be3ca['query'][_0x161a('0x37')](_0x161a('0x38'))){_0x3b5779[_0x161a('0x1f')]=qs[_0x161a('0x1f')](_0x4be3ca[_0x161a('0x31')][_0x161a('0x1f')]);_0x3b5779[_0x161a('0x1e')]=qs[_0x161a('0x1e')](_0x4be3ca['query'][_0x161a('0x1e')]);}_0x3b5779[_0x161a('0x39')]=qs[_0x161a('0x3a')](_0x4be3ca[_0x161a('0x31')]['sort']);_0x3b5779[_0x161a('0x3b')]=qs[_0x161a('0x3c')](_['pick'](_0x4be3ca[_0x161a('0x31')],_0x49f7a1[_0x161a('0x3c')]),_0x4a3eb6);if(_0x4be3ca['query'][_0x161a('0x3d')]){_0x3b5779[_0x161a('0x3b')]=_[_0x161a('0x3e')](_0x3b5779[_0x161a('0x3b')],{'$or':_[_0x161a('0x3f')](_0x4a3eb6,function(_0x430cbc){if(_0x430cbc[_0x161a('0x2e')]!==_0x161a('0x40')){var _0x132d5d={};_0x132d5d[_0x430cbc[_0x161a('0x29')]]={'$like':'%'+_0x4be3ca[_0x161a('0x31')][_0x161a('0x3d')]+'%'};return _0x132d5d;}})});}_0x3b5779=_[_0x161a('0x3e')]({},_0x3b5779,_0x4be3ca[_0x161a('0x41')]);var _0x36deef={'where':_0x3b5779[_0x161a('0x3b')]};return db[_0x161a('0x2b')][_0x161a('0x1d')](_0x36deef)[_0x161a('0x26')](function(_0x2b8b37){_0x1472c7[_0x161a('0x1d')]=_0x2b8b37;if(_0x4be3ca['query'][_0x161a('0x42')]){_0x3b5779[_0x161a('0x43')]=[{'all':!![]}];}return db[_0x161a('0x2b')][_0x161a('0x44')](_0x3b5779);})['then'](function(_0x1808ae){_0x1472c7[_0x161a('0x45')]=_0x1808ae;return _0x1472c7;})[_0x161a('0x26')](respondWithFilteredResult(_0x46a1e1,_0x3b5779))['catch'](handleError(_0x46a1e1,null));};exports['show']=function(_0x4c533c,_0x1e6bc0){var _0x15c055={'raw':!![],'where':{'id':_0x4c533c['params']['id']}},_0x3b3399={};_0x3b3399[_0x161a('0x30')]=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x3b3399[_0x161a('0x31')]=_[_0x161a('0x32')](_0x4c533c['query']);_0x3b3399[_0x161a('0x3c')]=_[_0x161a('0x34')](_0x3b3399[_0x161a('0x30')],_0x3b3399[_0x161a('0x31')]);_0x15c055['attributes']=_[_0x161a('0x34')](_0x3b3399[_0x161a('0x30')],qs[_0x161a('0x35')](_0x4c533c['query'][_0x161a('0x35')]));_0x15c055['attributes']=_0x15c055[_0x161a('0x33')][_0x161a('0x36')]?_0x15c055[_0x161a('0x33')]:_0x3b3399[_0x161a('0x30')];if(_0x4c533c[_0x161a('0x31')][_0x161a('0x42')]){_0x15c055[_0x161a('0x43')]=[{'all':!![]}];}_0x15c055=_[_0x161a('0x3e')]({},_0x15c055,_0x4c533c['options']);return db[_0x161a('0x2b')][_0x161a('0x46')](_0x15c055)[_0x161a('0x26')](handleEntityNotFound(_0x1e6bc0,null))[_0x161a('0x26')](respondWithResult(_0x1e6bc0,null))['catch'](handleError(_0x1e6bc0,null));};exports[_0x161a('0x47')]=function(_0x39d3b0,_0x29429e){return db[_0x161a('0x2b')][_0x161a('0x47')](_0x39d3b0['body'],{})[_0x161a('0x26')](respondWithResult(_0x29429e,0xc9))['catch'](handleError(_0x29429e,null));};exports[_0x161a('0x25')]=function(_0x4185b2,_0xe83c49){if(_0x4185b2[_0x161a('0x48')]['id']){delete _0x4185b2[_0x161a('0x48')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x4185b2[_0x161a('0x49')]['id']}})[_0x161a('0x26')](handleEntityNotFound(_0xe83c49,null))['then'](saveUpdates(_0x4185b2[_0x161a('0x48')],null))[_0x161a('0x26')](respondWithResult(_0xe83c49,null))['catch'](handleError(_0xe83c49,null));};exports[_0x161a('0x4a')]=function(_0xfa0639,_0x6cd3c0){return db[_0x161a('0x2b')][_0x161a('0x46')]({'where':{'id':_0xfa0639['params']['id']}})['then'](handleEntityNotFound(_0x6cd3c0,null))[_0x161a('0x26')](removeEntity(_0x6cd3c0,null))['catch'](handleError(_0x6cd3c0,null));};exports[_0x161a('0x4b')]=function(_0x4d8cd8,_0x1e47eb){return db[_0x161a('0x2b')][_0x161a('0x4b')]()['then'](respondWithResult(_0x1e47eb,null))[_0x161a('0x4c')](handleError(_0x1e47eb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b332aee..6420877 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 _0x7a54=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x187ba8,_0x246f24){var _0x227546=function(_0x259fa5){while(--_0x259fa5){_0x187ba8['push'](_0x187ba8['shift']());}};_0x227546(++_0x246f24);}(_0x7a54,0x106));var _0x47a5=function(_0x5828f5,_0xd391c4){_0x5828f5=_0x5828f5-0x0;var _0x39af8d=_0x7a54[_0x5828f5];return _0x39af8d;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0xb7c5f9,_0x1d27c7){var _0x185287=function(_0x36a191){while(--_0x36a191){_0xb7c5f9['push'](_0xb7c5f9['shift']());}};_0x185287(++_0x1d27c7);}(_0x4c60,0xc1));var _0x04c6=function(_0x44e9af,_0x50094e){_0x44e9af=_0x44e9af-0x0;var _0x452e81=_0x4c60[_0x44e9af];return _0x452e81;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04c6('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 537f805..b2dd4bc 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 _0x48aa=['error','code','message','SmsTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5edbe2,_0x4ca04a){var _0x2f1264=function(_0xb5d23a){while(--_0xb5d23a){_0x5edbe2['push'](_0x5edbe2['shift']());}};_0x2f1264(++_0x4ca04a);}(_0x48aa,0x155));var _0xa48a=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x48aa[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0xa48a('0x0'));var util=require(_0xa48a('0x1'));var moment=require('moment');var BPromise=require(_0xa48a('0x2'));var rs=require(_0xa48a('0x3'));var fs=require('fs');var Redis=require(_0xa48a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa48a('0x5'));var config=require(_0xa48a('0x6'));var jayson=require(_0xa48a('0x7'));var client=jayson[_0xa48a('0x8')][_0xa48a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48aeb9,_0x13eb6e,_0xd190be){return new BPromise(function(_0x34b9a3,_0x262cbd){return client[_0xa48a('0xa')](_0x48aeb9,_0xd190be)['then'](function(_0x6e12c0){logger[_0xa48a('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0xa48a('0xc'));logger[_0xa48a('0xd')](_0xa48a('0xe'),_0x13eb6e,'request\x20sent',JSON[_0xa48a('0xf')](_0x6e12c0));if(_0x6e12c0['error']){if(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x11')]===0x1f4){logger[_0xa48a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);return _0x262cbd(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);}logger[_0xa48a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x13eb6e,_0x6e12c0[_0xa48a('0x10')]['message']);return _0x34b9a3(_0x6e12c0[_0xa48a('0x10')][_0xa48a('0x12')]);}else{logger[_0xa48a('0xb')](_0xa48a('0x13'),_0x13eb6e,_0xa48a('0xc'));_0x34b9a3(_0x6e12c0[_0xa48a('0x14')]['message']);}})['catch'](function(_0x43e7a3){logger[_0xa48a('0x10')](_0xa48a('0x13'),_0x13eb6e,_0x43e7a3);_0x262cbd(_0x43e7a3);});});} \ No newline at end of file +var _0x6883=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x57b90a,_0x246933){var _0x9b9abd=function(_0x347cc9){while(--_0x347cc9){_0x57b90a['push'](_0x57b90a['shift']());}};_0x9b9abd(++_0x246933);}(_0x6883,0x139));var _0x3688=function(_0x4e1386,_0x2bc8a0){_0x4e1386=_0x4e1386-0x0;var _0x240049=_0x6883[_0x4e1386];return _0x240049;};'use strict';var _=require(_0x3688('0x0'));var util=require(_0x3688('0x1'));var moment=require(_0x3688('0x2'));var BPromise=require(_0x3688('0x3'));var rs=require(_0x3688('0x4'));var fs=require('fs');var Redis=require(_0x3688('0x5'));var db=require(_0x3688('0x6'))['db'];var utils=require(_0x3688('0x7'));var logger=require(_0x3688('0x8'))(_0x3688('0x9'));var config=require(_0x3688('0xa'));var jayson=require(_0x3688('0xb'));var client=jayson['client'][_0x3688('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4541c,_0x58a59e,_0x2dd817){return new BPromise(function(_0x566c8c,_0x8f603f){return client['request'](_0x4541c,_0x2dd817)[_0x3688('0xd')](function(_0x2309ef){logger[_0x3688('0xe')](_0x3688('0xf'),_0x58a59e,_0x3688('0x10'));logger[_0x3688('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x58a59e,'request\x20sent',JSON[_0x3688('0x12')](_0x2309ef));if(_0x2309ef['error']){if(_0x2309ef['error'][_0x3688('0x13')]===0x1f4){logger['error'](_0x3688('0xf'),_0x58a59e,_0x2309ef[_0x3688('0x14')]['message']);return _0x8f603f(_0x2309ef['error'][_0x3688('0x15')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x58a59e,_0x2309ef[_0x3688('0x14')][_0x3688('0x15')]);return _0x566c8c(_0x2309ef['error'][_0x3688('0x15')]);}else{logger[_0x3688('0xe')](_0x3688('0xf'),_0x58a59e,_0x3688('0x10'));_0x566c8c(_0x2309ef[_0x3688('0x16')]['message']);}})[_0x3688('0x17')](function(_0x2981f7){logger[_0x3688('0x14')](_0x3688('0xf'),_0x58a59e,_0x2981f7);_0x8f603f(_0x2981f7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fb13cc3..16bdeaa 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 _0x6436=['replace','format','%s-%s%s','basename','now','extname','post','single','file','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname'];(function(_0x57ca7e,_0x353397){var _0x708dd4=function(_0x503444){while(--_0x503444){_0x57ca7e['push'](_0x57ca7e['shift']());}};_0x708dd4(++_0x353397);}(_0x6436,0x1bc));var _0x6643=function(_0x40159a,_0x16d91d){_0x40159a=_0x40159a-0x0;var _0x2c6a57=_0x6436[_0x40159a];return _0x2c6a57;};'use strict';var multer=require('multer');var util=require(_0x6643('0x0'));var path=require(_0x6643('0x1'));var timeout=require(_0x6643('0x2'));var express=require(_0x6643('0x3'));var router=express[_0x6643('0x4')]();var auth=require(_0x6643('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6643('0x6'));var controller=require(_0x6643('0x7'));router[_0x6643('0x8')]('/',auth[_0x6643('0x9')](),controller[_0x6643('0xa')]);router[_0x6643('0x8')](_0x6643('0xb'),auth[_0x6643('0x9')](),controller[_0x6643('0xc')]);router[_0x6643('0x8')](_0x6643('0xd'),auth['isAuthenticated'](),controller[_0x6643('0xe')]);var upload=multer({'storage':multer[_0x6643('0xf')]({'destination':function(_0x1d5fe2,_0x185d46,_0x8f30d2){_0x8f30d2(null,path[_0x6643('0x10')](config[_0x6643('0x11')],_0x6643('0x12')));},'filename':function(_0x3397dc,_0x4283ec,_0x4c4af8){_0x4283ec[_0x6643('0x13')]=_0x4283ec[_0x6643('0x13')][_0x6643('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c4af8(null,util[_0x6643('0x15')](_0x6643('0x16'),path[_0x6643('0x17')](_0x4283ec[_0x6643('0x13')],path['extname'](_0x4283ec[_0x6643('0x13')])),Date[_0x6643('0x18')](),path[_0x6643('0x19')](_0x4283ec[_0x6643('0x13')])));}})});router[_0x6643('0x1a')]('/',upload[_0x6643('0x1b')](_0x6643('0x1c')),controller['create']);router['put'](_0x6643('0xb'),auth[_0x6643('0x9')](),controller['update']);router['delete']('/:id',auth[_0x6643('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x7aca=['file','create','put','update','delete','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x7aca,0x114));var _0xa7ac=function(_0x4c63d8,_0x50e70d){_0x4c63d8=_0x4c63d8-0x0;var _0x5f1fd1=_0x7aca[_0x4c63d8];return _0x5f1fd1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7ac('0x0'));var timeout=require(_0xa7ac('0x1'));var express=require(_0xa7ac('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa7ac('0x3'));var config=require(_0xa7ac('0x4'));var controller=require(_0xa7ac('0x5'));router[_0xa7ac('0x6')]('/',auth[_0xa7ac('0x7')](),controller['index']);router[_0xa7ac('0x6')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x9')]);router['get'](_0xa7ac('0xa'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcf4577,_0x3bec4b,_0x3e274d){_0x3e274d(null,path['join'](config[_0xa7ac('0xc')],_0xa7ac('0xd')));},'filename':function(_0x21765e,_0x3fbeed,_0x4ba8c8){_0x3fbeed[_0xa7ac('0xe')]=_0x3fbeed[_0xa7ac('0xe')][_0xa7ac('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ba8c8(null,util[_0xa7ac('0x10')](_0xa7ac('0x11'),path['basename'](_0x3fbeed['originalname'],path[_0xa7ac('0x12')](_0x3fbeed[_0xa7ac('0xe')])),Date[_0xa7ac('0x13')](),path[_0xa7ac('0x12')](_0x3fbeed[_0xa7ac('0xe')])));}})});router[_0xa7ac('0x14')]('/',upload['single'](_0xa7ac('0x15')),controller[_0xa7ac('0x16')]);router[_0xa7ac('0x17')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x18')]);router[_0xa7ac('0x19')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x19')]);module[_0xa7ac('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 91a46a6..a5c9822 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 _0x2a60=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x370c9c,_0x3a9218){var _0x426c30=function(_0x324bc8){while(--_0x324bc8){_0x370c9c['push'](_0x370c9c['shift']());}};_0x426c30(++_0x3a9218);}(_0x2a60,0x1e6));var _0x02a6=function(_0x4f6ecc,_0x562169){_0x4f6ecc=_0x4f6ecc-0x0;var _0x1627a7=_0x2a60[_0x4f6ecc];return _0x1627a7;};'use strict';var Sequelize=require(_0x02a6('0x0'));module[_0x02a6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x02a6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x02a6('0x2')]},'original_format':{'type':Sequelize[_0x02a6('0x2')]},'original_duration':{'type':Sequelize[_0x02a6('0x3')]},'original_sampleCount':{'type':Sequelize[_0x02a6('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x02a6('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x02a6('0x2')]},'converted_duration':{'type':Sequelize[_0x02a6('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x02a6('0x4')]},'converted_channelCount':{'type':Sequelize[_0x02a6('0x5')]},'converted_bitRate':{'type':Sequelize[_0x02a6('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x02a6('0x5')]}}; \ No newline at end of file +var _0xe875=['INTEGER','FLOAT','exports','STRING','name','BIGINT'];(function(_0x1413c4,_0x47f820){var _0x1edec3=function(_0x59966d){while(--_0x59966d){_0x1413c4['push'](_0x1413c4['shift']());}};_0x1edec3(++_0x47f820);}(_0xe875,0x15e));var _0x5e87=function(_0x9c9561,_0x26fd2b){_0x9c9561=_0x9c9561-0x0;var _0x212afa=_0xe875[_0x9c9561];return _0x212afa;};'use strict';var Sequelize=require('sequelize');module[_0x5e87('0x0')]={'name':{'type':Sequelize[_0x5e87('0x1')],'unique':_0x5e87('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x5e87('0x3')]},'original_channelCount':{'type':Sequelize[_0x5e87('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5e87('0x4')]},'converted_format':{'type':Sequelize[_0x5e87('0x1')]},'converted_duration':{'type':Sequelize[_0x5e87('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x5e87('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5e87('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5e87('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 47e1fa1..b76403c 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 _0x1d5d=['info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','start','description','delete','server/files/sounds/original','original_format','unlinkSync','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','join','Sound\x20upload\x20filepath:\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1d5d,0x1a5));var _0xd1d5=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x1d5d[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1d5('0x0'));var rimraf=require(_0xd1d5('0x1'));var zipdir=require(_0xd1d5('0x2'));var jsonpatch=require(_0xd1d5('0x3'));var rp=require(_0xd1d5('0x4'));var moment=require(_0xd1d5('0x5'));var BPromise=require(_0xd1d5('0x6'));var Mustache=require(_0xd1d5('0x7'));var util=require(_0xd1d5('0x8'));var path=require(_0xd1d5('0x9'));var sox=require(_0xd1d5('0xa'));var csv=require(_0xd1d5('0xb'));var ejs=require(_0xd1d5('0xc'));var fs=require('fs');var _=require(_0xd1d5('0xd'));var squel=require('squel');var crypto=require(_0xd1d5('0xe'));var jsforce=require(_0xd1d5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd1d5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1d5('0x10'));var qs=require(_0xd1d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1d5('0x12'));var logger=require(_0xd1d5('0x13'))(_0xd1d5('0x14'));var utils=require(_0xd1d5('0x15'));var config=require(_0xd1d5('0x16'));var licenseUtil=require(_0xd1d5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfa86c0,_0x2eed26){_0x2eed26=_0x2eed26||0xcc;return function(_0x1bebb8){if(_0x1bebb8){return _0xfa86c0[_0xd1d5('0x18')](_0x2eed26);}return _0xfa86c0[_0xd1d5('0x19')](_0x2eed26)['end']();};}function respondWithResult(_0x22ce4a,_0x1dd450){_0x1dd450=_0x1dd450||0xc8;return function(_0x4e771c){if(_0x4e771c){return _0x22ce4a[_0xd1d5('0x19')](_0x1dd450)[_0xd1d5('0x1a')](_0x4e771c);}};}function respondWithFilteredResult(_0x4a7cc2,_0xef3b79){return function(_0x11ded2){if(_0x11ded2){var _0xe2acb5=_0x11ded2[_0xd1d5('0x1b')],_0x37fb9b=_0xef3b79['offset'],_0x39d8d0=_0xef3b79['offset']+_0xef3b79[_0xd1d5('0x1c')],_0x4970ac;if(_0x39d8d0>=_0xe2acb5){_0x39d8d0=_0xe2acb5;_0x4970ac=0xc8;}else{_0x4970ac=0xce;}_0x4a7cc2[_0xd1d5('0x19')](_0x4970ac);return _0x4a7cc2[_0xd1d5('0x1d')](_0xd1d5('0x1e'),_0x37fb9b+'-'+_0x39d8d0+'/'+_0xe2acb5)[_0xd1d5('0x1a')](_0x11ded2);}return null;};}function patchUpdates(_0xfc161d){return function(_0x69f5fb){try{jsonpatch[_0xd1d5('0x1f')](_0x69f5fb,_0xfc161d,!![]);}catch(_0x1da95d){return BPromise[_0xd1d5('0x20')](_0x1da95d);}return _0x69f5fb[_0xd1d5('0x21')]();};}function saveUpdates(_0x3a584c,_0x2f6361){return function(_0x575d6e){if(_0x575d6e){return _0x575d6e[_0xd1d5('0x22')](_0x3a584c)[_0xd1d5('0x23')](function(_0x2bc76b){return _0x2bc76b;});}return null;};}function removeEntity(_0x1c2c5e,_0x5bb8ad){return function(_0x5b5db1){if(_0x5b5db1){return _0x5b5db1[_0xd1d5('0x24')]()['then'](function(){var _0xcd4c60=_0x5b5db1[_0xd1d5('0x25')]({'plain':!![]});var _0x3361c5=_0xd1d5('0x26');return db[_0xd1d5('0x27')][_0xd1d5('0x24')]({'where':{'type':_0x3361c5,'resourceId':_0xcd4c60['id']}})[_0xd1d5('0x23')](function(){return _0x5b5db1;});})[_0xd1d5('0x23')](function(){_0x1c2c5e[_0xd1d5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb951,_0x3ba5c2){return function(_0x2eee5c){if(!_0x2eee5c){_0x1eb951[_0xd1d5('0x18')](0x194);}return _0x2eee5c;};}function handleError(_0x386702,_0x133cbd){_0x133cbd=_0x133cbd||0x1f4;return function(_0x4bf006){logger[_0xd1d5('0x28')](_0x4bf006[_0xd1d5('0x29')]);if(_0x4bf006[_0xd1d5('0x2a')]){delete _0x4bf006[_0xd1d5('0x2a')];}_0x386702[_0xd1d5('0x19')](_0x133cbd)[_0xd1d5('0x2b')](_0x4bf006);};}exports[_0xd1d5('0x2c')]=function(_0x46bfaa,_0x38da47){var _0xcb5b16={},_0x2aef86={},_0x41740d={'count':0x0,'rows':[]};var _0x5e2edb=_[_0xd1d5('0x2d')](db[_0xd1d5('0x2e')]['rawAttributes'],function(_0x55bb09){return{'name':_0x55bb09['fieldName'],'type':_0x55bb09['type'][_0xd1d5('0x2f')]};});_0x2aef86[_0xd1d5('0x30')]=_['map'](_0x5e2edb,_0xd1d5('0x2a'));_0x2aef86['query']=_[_0xd1d5('0x31')](_0x46bfaa['query']);_0x2aef86[_0xd1d5('0x32')]=_[_0xd1d5('0x33')](_0x2aef86[_0xd1d5('0x30')],_0x2aef86['query']);_0xcb5b16[_0xd1d5('0x34')]=_[_0xd1d5('0x33')](_0x2aef86[_0xd1d5('0x30')],qs[_0xd1d5('0x35')](_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x35')]));_0xcb5b16['attributes']=_0xcb5b16[_0xd1d5('0x34')][_0xd1d5('0x37')]?_0xcb5b16[_0xd1d5('0x34')]:_0x2aef86['model'];if(!_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x38')](_0xd1d5('0x39'))){_0xcb5b16[_0xd1d5('0x1c')]=qs[_0xd1d5('0x1c')](_0x46bfaa['query'][_0xd1d5('0x1c')]);_0xcb5b16['offset']=qs[_0xd1d5('0x3a')](_0x46bfaa['query']['offset']);}_0xcb5b16[_0xd1d5('0x3b')]=qs['sort'](_0x46bfaa['query'][_0xd1d5('0x3c')]);_0xcb5b16[_0xd1d5('0x3d')]=qs[_0xd1d5('0x32')](_[_0xd1d5('0x3e')](_0x46bfaa[_0xd1d5('0x36')],_0x2aef86[_0xd1d5('0x32')]),_0x5e2edb);if(_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x3f')]){_0xcb5b16['where']=_['merge'](_0xcb5b16[_0xd1d5('0x3d')],{'$or':_[_0xd1d5('0x2d')](_0x5e2edb,function(_0x5c860b){if(_0x5c860b[_0xd1d5('0x40')]!=='VIRTUAL'){var _0x4307ac={};_0x4307ac[_0x5c860b[_0xd1d5('0x2a')]]={'$like':'%'+_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x3f')]+'%'};return _0x4307ac;}})});}_0xcb5b16=_[_0xd1d5('0x41')]({},_0xcb5b16,_0x46bfaa[_0xd1d5('0x42')]);var _0x13cd6a={'where':_0xcb5b16[_0xd1d5('0x3d')]};return db[_0xd1d5('0x2e')][_0xd1d5('0x1b')](_0x13cd6a)['then'](function(_0x4f4c4e){_0x41740d[_0xd1d5('0x1b')]=_0x4f4c4e;if(_0x46bfaa[_0xd1d5('0x36')][_0xd1d5('0x43')]){_0xcb5b16[_0xd1d5('0x44')]=[{'all':!![]}];}return db[_0xd1d5('0x2e')][_0xd1d5('0x45')](_0xcb5b16);})['then'](function(_0x3d2a49){_0x41740d['rows']=_0x3d2a49;return _0x41740d;})['then'](respondWithFilteredResult(_0x38da47,_0xcb5b16))[_0xd1d5('0x46')](handleError(_0x38da47,null));};exports[_0xd1d5('0x47')]=function(_0x473d01,_0x54681f){var _0x5cdcda={'raw':!![],'where':{'id':_0x473d01[_0xd1d5('0x48')]['id']}},_0x4e0d6b={};_0x4e0d6b['model']=_['keys'](db[_0xd1d5('0x2e')][_0xd1d5('0x49')]);_0x4e0d6b[_0xd1d5('0x36')]=_['keys'](_0x473d01['query']);_0x4e0d6b[_0xd1d5('0x32')]=_[_0xd1d5('0x33')](_0x4e0d6b[_0xd1d5('0x30')],_0x4e0d6b[_0xd1d5('0x36')]);_0x5cdcda[_0xd1d5('0x34')]=_['intersection'](_0x4e0d6b['model'],qs[_0xd1d5('0x35')](_0x473d01[_0xd1d5('0x36')][_0xd1d5('0x35')]));_0x5cdcda[_0xd1d5('0x34')]=_0x5cdcda['attributes'][_0xd1d5('0x37')]?_0x5cdcda[_0xd1d5('0x34')]:_0x4e0d6b[_0xd1d5('0x30')];if(_0x473d01[_0xd1d5('0x36')]['includeAll']){_0x5cdcda['include']=[{'all':!![]}];}_0x5cdcda=_['merge']({},_0x5cdcda,_0x473d01[_0xd1d5('0x42')]);return db[_0xd1d5('0x2e')][_0xd1d5('0x4a')](_0x5cdcda)[_0xd1d5('0x23')](handleEntityNotFound(_0x54681f,null))['then'](respondWithResult(_0x54681f,null))[_0xd1d5('0x46')](handleError(_0x54681f,null));};exports[_0xd1d5('0x4b')]=function(_0x111e09,_0x9163d2,_0x32f66e){return db['Sound']['find']({'where':{'id':_0x111e09['params']['id']},'attributes':[_0xd1d5('0x2a'),_0xd1d5('0x4c'),_0xd1d5('0x4d')],'raw':!![]})[_0xd1d5('0x23')](handleEntityNotFound(_0x9163d2,null))['then'](function(_0x4c549d){if(_0x4c549d){if(!fs[_0xd1d5('0x4e')](path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),_0x4c549d[_0xd1d5('0x4c')]+'.'+_0x4c549d[_0xd1d5('0x4d')]))){throw new db['Sequelize'][(_0xd1d5('0x51'))](_0xd1d5('0x52'));}return _0x9163d2[_0xd1d5('0x4b')](path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),util['format'](_0xd1d5('0x53'),_0x4c549d['save_name'],_0x4c549d[_0xd1d5('0x4d')])),util[_0xd1d5('0x54')](_0xd1d5('0x53'),_0x4c549d[_0xd1d5('0x2a')],_0x4c549d[_0xd1d5('0x4d')]));}return null;})[_0xd1d5('0x46')](handleError(_0x9163d2,null));};exports[_0xd1d5('0x55')]=function(_0x5983c9,_0x497741,_0xc99da5){var _0x59781f={'name':path[_0xd1d5('0x56')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')],path[_0xd1d5('0x59')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')])),'save_name':path[_0xd1d5('0x56')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')],path['extname'](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')])),'original_format':path[_0xd1d5('0x59')](_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x58')])[_0xd1d5('0x5b')](0x1),'converted_format':_0xd1d5('0x5c')};var _0x529010=path['join'](config[_0xd1d5('0x4f')],'server/files/sounds/original',_0x5983c9[_0xd1d5('0x57')][_0xd1d5('0x5a')]);var _0x206929=path[_0xd1d5('0x5d')](config[_0xd1d5('0x4f')],'server/files/sounds/converted',util[_0xd1d5('0x54')](_0xd1d5('0x53'),path[_0xd1d5('0x56')](_0x5983c9['file'][_0xd1d5('0x5a')],path[_0xd1d5('0x59')](_0x5983c9['file']['filename'])),_0x59781f['converted_format']));logger['info'](_0xd1d5('0x5e'),_0x529010);logger[_0xd1d5('0x5f')](_0xd1d5('0x60'),_0x206929);try{fs[_0xd1d5('0x61')](_0x529010,parseInt(_0xd1d5('0x62'),0x8));var _0x154b90=sox[_0xd1d5('0x63')](_0x529010,_0x206929,{'sampleRate':0x1f40,'format':_0xd1d5('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x154b90['on'](_0xd1d5('0x28'),function(_0x3f424a){fs['unlinkSync'](_0x529010);_0x497741[_0xd1d5('0x19')](0x1f4)['send'](_0x3f424a);});_0x154b90['on'](_0xd1d5('0x64'),function(_0x29bf47){_0x59781f[_0xd1d5('0x65')]=isNaN(_0x29bf47[_0xd1d5('0x66')])?null:_0x29bf47['duration']*0x3e8;_0x59781f[_0xd1d5('0x67')]=isNaN(_0x29bf47[_0xd1d5('0x68')])?null:_0x29bf47[_0xd1d5('0x68')];_0x59781f[_0xd1d5('0x69')]=isNaN(_0x29bf47[_0xd1d5('0x6a')])?null:_0x29bf47[_0xd1d5('0x6a')];_0x59781f[_0xd1d5('0x6b')]=isNaN(_0x29bf47[_0xd1d5('0x6c')])?null:_0x29bf47[_0xd1d5('0x6c')];_0x59781f[_0xd1d5('0x6d')]=isNaN(_0x29bf47[_0xd1d5('0x6e')])?null:_0x29bf47[_0xd1d5('0x6e')];});_0x154b90['on'](_0xd1d5('0x6f'),function(_0x1bddc0){_0x59781f[_0xd1d5('0x70')]=isNaN(_0x1bddc0[_0xd1d5('0x66')])?null:_0x1bddc0[_0xd1d5('0x66')]*0x3e8;_0x59781f[_0xd1d5('0x71')]=isNaN(_0x1bddc0['sampleCount'])?null:_0x1bddc0[_0xd1d5('0x68')];_0x59781f['converted_channelCount']=isNaN(_0x1bddc0[_0xd1d5('0x6a')])?null:_0x1bddc0[_0xd1d5('0x6a')];_0x59781f[_0xd1d5('0x72')]=isNaN(_0x1bddc0[_0xd1d5('0x6c')])?null:_0x1bddc0[_0xd1d5('0x6c')];_0x59781f['converted_sampleRate']=isNaN(_0x1bddc0[_0xd1d5('0x6e')])?null:_0x1bddc0[_0xd1d5('0x6e')];});_0x154b90['on']('end',function(){fs[_0xd1d5('0x61')](_0x206929,parseInt(_0xd1d5('0x62'),0x8));return db[_0xd1d5('0x2e')]['create'](_0x59781f)[_0xd1d5('0x23')](function(_0x396931){var _0xc0b6ee={'role':_0x5983c9[_0xd1d5('0x73')]['role'],'userProfileId':_0x5983c9[_0xd1d5('0x73')][_0xd1d5('0x74')]};if(!_0xc0b6ee)throw new Error(_0xd1d5('0x75'));if(_0xc0b6ee[_0xd1d5('0x76')]===_0xd1d5('0x77')){var _0x1d43ec=_0x396931[_0xd1d5('0x25')]({'plain':!![]});return db[_0xd1d5('0x78')][_0xd1d5('0x4a')]({'where':{'name':_0xd1d5('0x26'),'userProfileId':_0xc0b6ee[_0xd1d5('0x74')]},'raw':!![]})[_0xd1d5('0x23')](function(_0x1817f1){if(_0x1817f1&&_0x1817f1[_0xd1d5('0x79')]===0x0){return db[_0xd1d5('0x27')][_0xd1d5('0x55')]({'name':_0x1d43ec['name'],'resourceId':_0x1d43ec['id'],'type':_0x1817f1['name'],'sectionId':_0x1817f1['id']},{})['then'](function(){return _0x396931;});}else{return _0x396931;}})[_0xd1d5('0x46')](function(_0x4617b8){logger[_0xd1d5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4617b8);throw _0x4617b8;});}return _0x396931;})[_0xd1d5('0x23')](respondWithResult(_0x497741,null))['catch'](handleError(_0x497741,null));});_0x154b90[_0xd1d5('0x7a')]();}catch(_0x261083){_0x497741['status'](0x1f4)[_0xd1d5('0x2b')](_0x261083);}};exports[_0xd1d5('0x22')]=function(_0x164eb7,_0x4c3ce9,_0x1dfa60){return db[_0xd1d5('0x2e')][_0xd1d5('0x4a')]({'where':{'id':_0x164eb7[_0xd1d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c3ce9,null))[_0xd1d5('0x23')](saveUpdates(_[_0xd1d5('0x3e')](_0x164eb7[_0xd1d5('0x73')],[_0xd1d5('0x2a'),_0xd1d5('0x7b')]),null))[_0xd1d5('0x23')](respondWithResult(_0x4c3ce9,null))[_0xd1d5('0x46')](handleError(_0x4c3ce9,null));};exports[_0xd1d5('0x7c')]=function(_0x3d23c2,_0x5c5d8f,_0x35e84e){return db['Sound'][_0xd1d5('0x4a')]({'where':{'id':_0x3d23c2[_0xd1d5('0x48')]['id']}})[_0xd1d5('0x23')](function(_0x42a9e7){if(_0x42a9e7){return _0x42a9e7['destroy']();}})['then'](function(_0x33f6f6){var _0x36ade3=path[_0xd1d5('0x5d')](config[_0xd1d5('0x4f')],_0xd1d5('0x7d'),util['format'](_0xd1d5('0x53'),_0x33f6f6['save_name'],_0x33f6f6[_0xd1d5('0x7e')]));var _0x6cd709=path['join'](config[_0xd1d5('0x4f')],_0xd1d5('0x50'),util[_0xd1d5('0x54')](_0xd1d5('0x53'),_0x33f6f6['save_name'],_0x33f6f6['converted_format']));fs[_0xd1d5('0x7f')](_0x36ade3);fs[_0xd1d5('0x7f')](_0x6cd709);return _0x33f6f6;})['then'](function(_0x19dc9a){if(_0x19dc9a){return _0x5c5d8f[_0xd1d5('0x19')](0xcc)[_0xd1d5('0x80')]();}})[_0xd1d5('0x23')](handleEntityNotFound(_0x5c5d8f,null))[_0xd1d5('0x46')](handleError(_0x5c5d8f,null));}; \ No newline at end of file +var _0x67c4=['stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','Sounds','sendStatus','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67c4,0xd6));var _0x467c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x67c4[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require(_0x467c('0x0'));var emlformat=require(_0x467c('0x1'));var rimraf=require(_0x467c('0x2'));var zipdir=require(_0x467c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x467c('0x4'));var util=require(_0x467c('0x5'));var path=require('path');var sox=require(_0x467c('0x6'));var csv=require(_0x467c('0x7'));var ejs=require(_0x467c('0x8'));var fs=require('fs');var _=require(_0x467c('0x9'));var squel=require('squel');var crypto=require(_0x467c('0xa'));var jsforce=require(_0x467c('0xb'));var deskjs=require(_0x467c('0xc'));var toCsv=require(_0x467c('0x7'));var querystring=require(_0x467c('0xd'));var Papa=require(_0x467c('0xe'));var Redis=require(_0x467c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x467c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x467c('0x11'))(_0x467c('0x12'));var utils=require(_0x467c('0x13'));var config=require(_0x467c('0x14'));var licenseUtil=require(_0x467c('0x15'));var db=require(_0x467c('0x16'))['db'];function respondWithStatusCode(_0x366673,_0x27f000){_0x27f000=_0x27f000||0xcc;return function(_0x487264){if(_0x487264){return _0x366673['sendStatus'](_0x27f000);}return _0x366673[_0x467c('0x17')](_0x27f000)[_0x467c('0x18')]();};}function respondWithResult(_0x5b97c7,_0xa5bdba){_0xa5bdba=_0xa5bdba||0xc8;return function(_0x53be6a){if(_0x53be6a){return _0x5b97c7[_0x467c('0x17')](_0xa5bdba)[_0x467c('0x19')](_0x53be6a);}};}function respondWithFilteredResult(_0x111eb8,_0x14df2c){return function(_0x4424c7){if(_0x4424c7){var _0x334888=_0x4424c7[_0x467c('0x1a')],_0x4ccc8e=_0x14df2c[_0x467c('0x1b')],_0x3e88a7=_0x14df2c['offset']+_0x14df2c[_0x467c('0x1c')],_0x393379;if(_0x3e88a7>=_0x334888){_0x3e88a7=_0x334888;_0x393379=0xc8;}else{_0x393379=0xce;}_0x111eb8[_0x467c('0x17')](_0x393379);return _0x111eb8['set'](_0x467c('0x1d'),_0x4ccc8e+'-'+_0x3e88a7+'/'+_0x334888)[_0x467c('0x19')](_0x4424c7);}return null;};}function patchUpdates(_0x3767cb){return function(_0x23534a){try{jsonpatch['apply'](_0x23534a,_0x3767cb,!![]);}catch(_0x1f20a6){return BPromise[_0x467c('0x1e')](_0x1f20a6);}return _0x23534a['save']();};}function saveUpdates(_0x3a6cc0,_0x155f39){return function(_0x121885){if(_0x121885){return _0x121885[_0x467c('0x1f')](_0x3a6cc0)[_0x467c('0x20')](function(_0x4b1756){return _0x4b1756;});}return null;};}function removeEntity(_0x243208,_0x4e34f4){return function(_0x5322b7){if(_0x5322b7){return _0x5322b7[_0x467c('0x21')]()[_0x467c('0x20')](function(){var _0x45f17a=_0x5322b7[_0x467c('0x22')]({'plain':!![]});var _0xa4192f=_0x467c('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0xa4192f,'resourceId':_0x45f17a['id']}})[_0x467c('0x20')](function(){return _0x5322b7;});})['then'](function(){_0x243208['status'](0xcc)[_0x467c('0x18')]();});}};}function handleEntityNotFound(_0xa19d28,_0x8b3f2f){return function(_0x97c0e0){if(!_0x97c0e0){_0xa19d28[_0x467c('0x24')](0x194);}return _0x97c0e0;};}function handleError(_0x21e6ac,_0x26d90a){_0x26d90a=_0x26d90a||0x1f4;return function(_0x1c3945){logger[_0x467c('0x25')](_0x1c3945[_0x467c('0x26')]);if(_0x1c3945[_0x467c('0x27')]){delete _0x1c3945[_0x467c('0x27')];}_0x21e6ac[_0x467c('0x17')](_0x26d90a)[_0x467c('0x28')](_0x1c3945);};}exports[_0x467c('0x29')]=function(_0x584f9b,_0x3a99dd){var _0x4e53e7={},_0x3a911a={},_0x556e1c={'count':0x0,'rows':[]};var _0x37eb30=_[_0x467c('0x2a')](db['Sound'][_0x467c('0x2b')],function(_0x39d068){return{'name':_0x39d068['fieldName'],'type':_0x39d068[_0x467c('0x2c')][_0x467c('0x2d')]};});_0x3a911a['model']=_[_0x467c('0x2a')](_0x37eb30,_0x467c('0x27'));_0x3a911a[_0x467c('0x2e')]=_[_0x467c('0x2f')](_0x584f9b['query']);_0x3a911a[_0x467c('0x30')]=_['intersection'](_0x3a911a[_0x467c('0x31')],_0x3a911a['query']);_0x4e53e7['attributes']=_['intersection'](_0x3a911a[_0x467c('0x31')],qs[_0x467c('0x32')](_0x584f9b['query'][_0x467c('0x32')]));_0x4e53e7[_0x467c('0x33')]=_0x4e53e7[_0x467c('0x33')]['length']?_0x4e53e7[_0x467c('0x33')]:_0x3a911a['model'];if(!_0x584f9b[_0x467c('0x2e')][_0x467c('0x34')](_0x467c('0x35'))){_0x4e53e7[_0x467c('0x1c')]=qs[_0x467c('0x1c')](_0x584f9b[_0x467c('0x2e')][_0x467c('0x1c')]);_0x4e53e7['offset']=qs['offset'](_0x584f9b[_0x467c('0x2e')][_0x467c('0x1b')]);}_0x4e53e7[_0x467c('0x36')]=qs[_0x467c('0x37')](_0x584f9b['query'][_0x467c('0x37')]);_0x4e53e7[_0x467c('0x38')]=qs[_0x467c('0x30')](_['pick'](_0x584f9b['query'],_0x3a911a[_0x467c('0x30')]),_0x37eb30);if(_0x584f9b['query'][_0x467c('0x39')]){_0x4e53e7[_0x467c('0x38')]=_[_0x467c('0x3a')](_0x4e53e7[_0x467c('0x38')],{'$or':_['map'](_0x37eb30,function(_0x537a5c){if(_0x537a5c[_0x467c('0x2c')]!==_0x467c('0x3b')){var _0x14c27a={};_0x14c27a[_0x537a5c[_0x467c('0x27')]]={'$like':'%'+_0x584f9b['query'][_0x467c('0x39')]+'%'};return _0x14c27a;}})});}_0x4e53e7=_[_0x467c('0x3a')]({},_0x4e53e7,_0x584f9b[_0x467c('0x3c')]);var _0x101d09={'where':_0x4e53e7[_0x467c('0x38')]};return db[_0x467c('0x3d')][_0x467c('0x1a')](_0x101d09)['then'](function(_0x127e64){_0x556e1c[_0x467c('0x1a')]=_0x127e64;if(_0x584f9b[_0x467c('0x2e')][_0x467c('0x3e')]){_0x4e53e7['include']=[{'all':!![]}];}return db[_0x467c('0x3d')][_0x467c('0x3f')](_0x4e53e7);})['then'](function(_0x341e4f){_0x556e1c[_0x467c('0x40')]=_0x341e4f;return _0x556e1c;})['then'](respondWithFilteredResult(_0x3a99dd,_0x4e53e7))[_0x467c('0x41')](handleError(_0x3a99dd,null));};exports[_0x467c('0x42')]=function(_0x1005eb,_0x55fcb1){var _0x395a44={'raw':!![],'where':{'id':_0x1005eb[_0x467c('0x43')]['id']}},_0x1ce021={};_0x1ce021[_0x467c('0x31')]=_[_0x467c('0x2f')](db[_0x467c('0x3d')][_0x467c('0x2b')]);_0x1ce021[_0x467c('0x2e')]=_[_0x467c('0x2f')](_0x1005eb[_0x467c('0x2e')]);_0x1ce021[_0x467c('0x30')]=_[_0x467c('0x44')](_0x1ce021[_0x467c('0x31')],_0x1ce021[_0x467c('0x2e')]);_0x395a44[_0x467c('0x33')]=_[_0x467c('0x44')](_0x1ce021[_0x467c('0x31')],qs[_0x467c('0x32')](_0x1005eb[_0x467c('0x2e')]['fields']));_0x395a44['attributes']=_0x395a44[_0x467c('0x33')][_0x467c('0x45')]?_0x395a44[_0x467c('0x33')]:_0x1ce021[_0x467c('0x31')];if(_0x1005eb[_0x467c('0x2e')][_0x467c('0x3e')]){_0x395a44[_0x467c('0x46')]=[{'all':!![]}];}_0x395a44=_[_0x467c('0x3a')]({},_0x395a44,_0x1005eb[_0x467c('0x3c')]);return db[_0x467c('0x3d')][_0x467c('0x47')](_0x395a44)['then'](handleEntityNotFound(_0x55fcb1,null))['then'](respondWithResult(_0x55fcb1,null))[_0x467c('0x41')](handleError(_0x55fcb1,null));};exports[_0x467c('0x48')]=function(_0xbfff88,_0x399d35,_0x3ef716){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0xbfff88[_0x467c('0x43')]['id']},'attributes':['name',_0x467c('0x49'),_0x467c('0x4a')],'raw':!![]})[_0x467c('0x20')](handleEntityNotFound(_0x399d35,null))[_0x467c('0x20')](function(_0x56a797){if(_0x56a797){if(!fs['existsSync'](path[_0x467c('0x4b')](config[_0x467c('0x4c')],_0x467c('0x4d'),_0x56a797[_0x467c('0x49')]+'.'+_0x56a797[_0x467c('0x4a')]))){throw new db[(_0x467c('0x4e'))]['ValidationError'](_0x467c('0x4f'));}return _0x399d35['download'](path[_0x467c('0x4b')](config[_0x467c('0x4c')],'server/files/sounds/converted',util[_0x467c('0x50')](_0x467c('0x51'),_0x56a797[_0x467c('0x49')],_0x56a797['converted_format'])),util[_0x467c('0x50')](_0x467c('0x51'),_0x56a797[_0x467c('0x27')],_0x56a797['converted_format']));}return null;})[_0x467c('0x41')](handleError(_0x399d35,null));};exports['create']=function(_0x4017a5,_0x2c754b,_0x578654){var _0x2744f5={'name':path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')],path['extname'](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')])),'save_name':path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')]['filename'],path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x56')])),'original_format':path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')])[_0x467c('0x57')](0x1),'converted_format':_0x467c('0x58')};var _0x235aa9=path['join'](config[_0x467c('0x4c')],'server/files/sounds/original',_0x4017a5['file'][_0x467c('0x56')]);var _0x19dc3a=path['join'](config[_0x467c('0x4c')],_0x467c('0x4d'),util[_0x467c('0x50')](_0x467c('0x51'),path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')]['filename'],path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x56')])),_0x2744f5['converted_format']));logger[_0x467c('0x59')](_0x467c('0x5a'),_0x235aa9);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x19dc3a);try{fs[_0x467c('0x5b')](_0x235aa9,parseInt(_0x467c('0x5c'),0x8));var _0x3641f0=sox[_0x467c('0x5d')](_0x235aa9,_0x19dc3a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3641f0['on'](_0x467c('0x25'),function(_0x16db34){fs[_0x467c('0x5e')](_0x235aa9);_0x2c754b[_0x467c('0x17')](0x1f4)[_0x467c('0x28')](_0x16db34);});_0x3641f0['on'](_0x467c('0x5f'),function(_0x2872c9){_0x2744f5[_0x467c('0x60')]=isNaN(_0x2872c9[_0x467c('0x61')])?null:_0x2872c9['duration']*0x3e8;_0x2744f5[_0x467c('0x62')]=isNaN(_0x2872c9['sampleCount'])?null:_0x2872c9['sampleCount'];_0x2744f5['original_channelCount']=isNaN(_0x2872c9[_0x467c('0x63')])?null:_0x2872c9[_0x467c('0x63')];_0x2744f5[_0x467c('0x64')]=isNaN(_0x2872c9['bitRate'])?null:_0x2872c9['bitRate'];_0x2744f5[_0x467c('0x65')]=isNaN(_0x2872c9[_0x467c('0x66')])?null:_0x2872c9['sampleRate'];});_0x3641f0['on'](_0x467c('0x67'),function(_0x1c09f8){_0x2744f5[_0x467c('0x68')]=isNaN(_0x1c09f8[_0x467c('0x61')])?null:_0x1c09f8[_0x467c('0x61')]*0x3e8;_0x2744f5[_0x467c('0x69')]=isNaN(_0x1c09f8[_0x467c('0x6a')])?null:_0x1c09f8[_0x467c('0x6a')];_0x2744f5[_0x467c('0x6b')]=isNaN(_0x1c09f8['channelCount'])?null:_0x1c09f8[_0x467c('0x63')];_0x2744f5[_0x467c('0x6c')]=isNaN(_0x1c09f8[_0x467c('0x6d')])?null:_0x1c09f8['bitRate'];_0x2744f5[_0x467c('0x6e')]=isNaN(_0x1c09f8[_0x467c('0x66')])?null:_0x1c09f8[_0x467c('0x66')];});_0x3641f0['on']('end',function(){fs[_0x467c('0x5b')](_0x19dc3a,parseInt(_0x467c('0x5c'),0x8));return db['Sound']['create'](_0x2744f5)[_0x467c('0x20')](function(_0x2cff9a){var _0x590506={'role':_0x4017a5[_0x467c('0x6f')][_0x467c('0x70')],'userProfileId':_0x4017a5['body']['userProfileId']};if(!_0x590506)throw new Error(_0x467c('0x71'));if(_0x590506['role']===_0x467c('0x72')){var _0x290553=_0x2cff9a[_0x467c('0x22')]({'plain':!![]});return db[_0x467c('0x73')][_0x467c('0x47')]({'where':{'name':_0x467c('0x23'),'userProfileId':_0x590506[_0x467c('0x74')]},'raw':!![]})['then'](function(_0x263293){if(_0x263293&&_0x263293[_0x467c('0x75')]===0x0){return db[_0x467c('0x76')][_0x467c('0x77')]({'name':_0x290553[_0x467c('0x27')],'resourceId':_0x290553['id'],'type':_0x263293['name'],'sectionId':_0x263293['id']},{})[_0x467c('0x20')](function(){return _0x2cff9a;});}else{return _0x2cff9a;}})[_0x467c('0x41')](function(_0x500289){logger['error'](_0x467c('0x78'),_0x500289);throw _0x500289;});}return _0x2cff9a;})[_0x467c('0x20')](respondWithResult(_0x2c754b,null))[_0x467c('0x41')](handleError(_0x2c754b,null));});_0x3641f0[_0x467c('0x79')]();}catch(_0x3ed1f1){_0x2c754b[_0x467c('0x17')](0x1f4)[_0x467c('0x28')](_0x3ed1f1);}};exports[_0x467c('0x1f')]=function(_0x58ad3a,_0x558832,_0x37c14b){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0x58ad3a[_0x467c('0x43')]['id']}})['then'](handleEntityNotFound(_0x558832,null))[_0x467c('0x20')](saveUpdates(_['pick'](_0x58ad3a[_0x467c('0x6f')],[_0x467c('0x27'),_0x467c('0x7a')]),null))[_0x467c('0x20')](respondWithResult(_0x558832,null))[_0x467c('0x41')](handleError(_0x558832,null));};exports[_0x467c('0x7b')]=function(_0x244f48,_0x51a603,_0xc2495d){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0x244f48[_0x467c('0x43')]['id']}})['then'](function(_0x21169d){if(_0x21169d){return _0x21169d[_0x467c('0x21')]();}})[_0x467c('0x20')](function(_0x5cfd86){var _0x415c03=path[_0x467c('0x4b')](config['root'],_0x467c('0x7c'),util[_0x467c('0x50')](_0x467c('0x51'),_0x5cfd86['save_name'],_0x5cfd86[_0x467c('0x7d')]));var _0x4b5e4d=path[_0x467c('0x4b')](config['root'],_0x467c('0x4d'),util[_0x467c('0x50')](_0x467c('0x51'),_0x5cfd86['save_name'],_0x5cfd86[_0x467c('0x4a')]));fs['unlinkSync'](_0x415c03);fs[_0x467c('0x5e')](_0x4b5e4d);return _0x5cfd86;})[_0x467c('0x20')](function(_0x445abd){if(_0x445abd){return _0x51a603[_0x467c('0x17')](0xcc)[_0x467c('0x18')]();}})[_0x467c('0x20')](handleEntityNotFound(_0x51a603,null))['catch'](handleError(_0x51a603,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8f10133..a5ae06f 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 _0x7ef7=['api','moment','bluebird','path','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x31c79d,_0x2d70d8){var _0x4c04b6=function(_0x4586d6){while(--_0x4586d6){_0x31c79d['push'](_0x31c79d['shift']());}};_0x4c04b6(++_0x2d70d8);}(_0x7ef7,0x81));var _0x77ef=function(_0x3b552,_0x3a6075){_0x3b552=_0x3b552-0x0;var _0x39578f=_0x7ef7[_0x3b552];return _0x39578f;};'use strict';var _=require(_0x77ef('0x0'));var util=require(_0x77ef('0x1'));var logger=require(_0x77ef('0x2'))(_0x77ef('0x3'));var moment=require(_0x77ef('0x4'));var BPromise=require(_0x77ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ef('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77ef('0x7'));module[_0x77ef('0x8')]=function(_0x2dd0d2,_0x126195){return _0x2dd0d2[_0x77ef('0x9')]('Sound',attributes,{'tableName':_0x77ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3d0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x4d1d2c,_0x44f4d8){var _0x2c4cb9=function(_0x4b0c5f){while(--_0x4b0c5f){_0x4d1d2c['push'](_0x4d1d2c['shift']());}};_0x2c4cb9(++_0x44f4d8);}(_0xf3d0,0x1b2));var _0x0f3d=function(_0x21e8f9,_0x569e33){_0x21e8f9=_0x21e8f9-0x0;var _0x196c7f=_0xf3d0[_0x21e8f9];return _0x196c7f;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var logger=require(_0x0f3d('0x2'))(_0x0f3d('0x3'));var moment=require(_0x0f3d('0x4'));var BPromise=require(_0x0f3d('0x5'));var rp=require(_0x0f3d('0x6'));var fs=require('fs');var path=require(_0x0f3d('0x7'));var rimraf=require(_0x0f3d('0x8'));var config=require(_0x0f3d('0x9'));var attributes=require(_0x0f3d('0xa'));module[_0x0f3d('0xb')]=function(_0xf5611b,_0xa034af){return _0xf5611b[_0x0f3d('0xc')](_0x0f3d('0xd'),attributes,{'tableName':_0x0f3d('0xe'),'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 c7eea79..8444f11 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 _0x9dff=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','code','error','message','Sound,\x20%s,\x20%s','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','stringify','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9dff,0x15b));var _0xf9df=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9dff[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xf9df('0x0'));var moment=require(_0xf9df('0x1'));var BPromise=require(_0xf9df('0x2'));var rs=require(_0xf9df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9df('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9df('0x5'))(_0xf9df('0x6'));var config=require(_0xf9df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf9df('0x8')][_0xf9df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467bb9,_0x416b6e,_0x47f2e7){return new BPromise(function(_0x440b49,_0x2c0a7a){return client[_0xf9df('0xa')](_0x467bb9,_0x47f2e7)['then'](function(_0x446a6d){logger[_0xf9df('0xb')]('Sound,\x20%s,\x20%s',_0x416b6e,_0xf9df('0xc'));logger[_0xf9df('0xd')](_0xf9df('0xe'),_0x416b6e,_0xf9df('0xc'),JSON['stringify'](_0x446a6d));if(_0x446a6d['error']){if(_0x446a6d['error'][_0xf9df('0xf')]===0x1f4){logger[_0xf9df('0x10')]('Sound,\x20%s,\x20%s',_0x416b6e,_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);return _0x2c0a7a(_0x446a6d['error']['message']);}logger[_0xf9df('0x10')](_0xf9df('0x12'),_0x416b6e,_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);return _0x440b49(_0x446a6d[_0xf9df('0x10')][_0xf9df('0x11')]);}else{logger[_0xf9df('0xb')](_0xf9df('0x12'),_0x416b6e,'request\x20sent');_0x440b49(_0x446a6d[_0xf9df('0x13')][_0xf9df('0x11')]);}})['catch'](function(_0x3bb5cd){logger['error']('Sound,\x20%s,\x20%s',_0x416b6e,_0x3bb5cd);_0x2c0a7a(_0x3bb5cd);});});}exports[_0xf9df('0x14')]=function(_0x58a71d){var _0x453b5a=this;return new Promise(function(_0x46b0a8,_0x235e81){return db[_0xf9df('0x15')][_0xf9df('0x16')]({'raw':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x18')]===undefined?!![]:![]:!![],'where':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x19')]||null:null,'attributes':_0x58a71d[_0xf9df('0x17')]?_0x58a71d[_0xf9df('0x17')][_0xf9df('0x1a')]||null:null,'include':_0x58a71d['options']?_0x58a71d['options'][_0xf9df('0x1b')]?_[_0xf9df('0x1c')](_0x58a71d[_0xf9df('0x17')][_0xf9df('0x1b')],function(_0xa6d23c){return{'model':db[_0xa6d23c[_0xf9df('0x1d')]],'as':_0xa6d23c['as'],'attributes':_0xa6d23c['attributes'],'include':_0xa6d23c[_0xf9df('0x1b')]?_[_0xf9df('0x1c')](_0xa6d23c['include'],function(_0x48579f){return{'model':db[_0x48579f[_0xf9df('0x1d')]],'as':_0x48579f['as'],'attributes':_0x48579f[_0xf9df('0x1a')],'include':_0x48579f[_0xf9df('0x1b')]?_['map'](_0x48579f['include'],function(_0x5b5311){return{'model':db[_0x5b5311[_0xf9df('0x1d')]],'as':_0x5b5311['as'],'attributes':_0x5b5311['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9df('0x1e')](function(_0x383291){logger[_0xf9df('0xb')]('ShowSound',_0x58a71d);logger['debug'](_0xf9df('0x14'),_0x58a71d,JSON[_0xf9df('0x1f')](_0x383291));_0x46b0a8(_0x383291);})['catch'](function(_0x2c6423){logger[_0xf9df('0x10')](_0xf9df('0x14'),_0x2c6423[_0xf9df('0x11')],_0x58a71d);_0x235e81(_0x453b5a[_0xf9df('0x10')](0x1f4,_0x2c6423['message']));});});}; \ No newline at end of file +var _0xbeec=['Sound,\x20%s,\x20%s','info','result','catch','ShowSound','Sound','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0xbeec,0xdf));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcbee('0x0'));var moment=require('moment');var BPromise=require(_0xcbee('0x1'));var rs=require(_0xcbee('0x2'));var fs=require('fs');var Redis=require(_0xcbee('0x3'));var db=require(_0xcbee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbee('0x5'))(_0xcbee('0x6'));var config=require('../../config/environment');var jayson=require(_0xcbee('0x7'));var client=jayson[_0xcbee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26d02a,_0x1245ea,_0x107083){return new BPromise(function(_0x319659,_0x100a4b){return client[_0xcbee('0x9')](_0x26d02a,_0x107083)[_0xcbee('0xa')](function(_0x33a5ce){logger['info']('Sound,\x20%s,\x20%s',_0x1245ea,_0xcbee('0xb'));logger[_0xcbee('0xc')](_0xcbee('0xd'),_0x1245ea,_0xcbee('0xb'),JSON[_0xcbee('0xe')](_0x33a5ce));if(_0x33a5ce[_0xcbee('0xf')]){if(_0x33a5ce[_0xcbee('0xf')]['code']===0x1f4){logger[_0xcbee('0xf')]('Sound,\x20%s,\x20%s',_0x1245ea,_0x33a5ce['error'][_0xcbee('0x10')]);return _0x100a4b(_0x33a5ce[_0xcbee('0xf')][_0xcbee('0x10')]);}logger[_0xcbee('0xf')](_0xcbee('0x11'),_0x1245ea,_0x33a5ce['error'][_0xcbee('0x10')]);return _0x319659(_0x33a5ce[_0xcbee('0xf')][_0xcbee('0x10')]);}else{logger[_0xcbee('0x12')]('Sound,\x20%s,\x20%s',_0x1245ea,'request\x20sent');_0x319659(_0x33a5ce[_0xcbee('0x13')][_0xcbee('0x10')]);}})[_0xcbee('0x14')](function(_0x4a1c00){logger[_0xcbee('0xf')](_0xcbee('0x11'),_0x1245ea,_0x4a1c00);_0x100a4b(_0x4a1c00);});});}exports[_0xcbee('0x15')]=function(_0x1165ac){var _0x36fc1f=this;return new Promise(function(_0x31f37a,_0x379bd5){return db[_0xcbee('0x16')]['find']({'raw':_0x1165ac[_0xcbee('0x17')]?_0x1165ac['options'][_0xcbee('0x18')]===undefined?!![]:![]:!![],'where':_0x1165ac[_0xcbee('0x17')]?_0x1165ac[_0xcbee('0x17')][_0xcbee('0x19')]||null:null,'attributes':_0x1165ac['options']?_0x1165ac['options']['attributes']||null:null,'include':_0x1165ac[_0xcbee('0x17')]?_0x1165ac[_0xcbee('0x17')][_0xcbee('0x1a')]?_[_0xcbee('0x1b')](_0x1165ac[_0xcbee('0x17')][_0xcbee('0x1a')],function(_0xe780c5){return{'model':db[_0xe780c5[_0xcbee('0x1c')]],'as':_0xe780c5['as'],'attributes':_0xe780c5[_0xcbee('0x1d')],'include':_0xe780c5['include']?_[_0xcbee('0x1b')](_0xe780c5['include'],function(_0x37ee9e){return{'model':db[_0x37ee9e['model']],'as':_0x37ee9e['as'],'attributes':_0x37ee9e[_0xcbee('0x1d')],'include':_0x37ee9e[_0xcbee('0x1a')]?_['map'](_0x37ee9e[_0xcbee('0x1a')],function(_0x50750d){return{'model':db[_0x50750d['model']],'as':_0x50750d['as'],'attributes':_0x50750d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbee('0xa')](function(_0x1856ec){logger[_0xcbee('0x12')](_0xcbee('0x15'),_0x1165ac);logger[_0xcbee('0xc')](_0xcbee('0x15'),_0x1165ac,JSON[_0xcbee('0xe')](_0x1856ec));_0x31f37a(_0x1856ec);})[_0xcbee('0x14')](function(_0x3168df){logger[_0xcbee('0xf')](_0xcbee('0x15'),_0x3168df[_0xcbee('0x10')],_0x1165ac);_0x379bd5(_0x36fc1f['error'](0x1f4,_0x3168df[_0xcbee('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4b33c29..3663293 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 _0x37e9=['../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0x37e9,0x1d7));var _0x937e=function(_0x26b3c7,_0x14891f){_0x26b3c7=_0x26b3c7-0x0;var _0x443e56=_0x37e9[_0x26b3c7];return _0x443e56;};'use strict';var multer=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var path=require('path');var timeout=require(_0x937e('0x2'));var express=require(_0x937e('0x3'));var router=express[_0x937e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x937e('0x5'));var controller=require(_0x937e('0x6'));router[_0x937e('0x7')]('/',auth[_0x937e('0x8')](),controller['index']);router['get'](_0x937e('0x9'),auth['isAuthenticated'](),controller[_0x937e('0xa')]);router[_0x937e('0xb')]('/',auth['isAuthenticated'](),controller[_0x937e('0xc')]);router['put']('/:id',auth[_0x937e('0x8')](),controller[_0x937e('0xd')]);router[_0x937e('0xe')](_0x937e('0x9'),auth[_0x937e('0x8')](),controller[_0x937e('0xf')]);module[_0x937e('0x10')]=router; \ No newline at end of file +var _0x7fcb=['index','show','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get','isAuthenticated'];(function(_0x378bf4,_0x3c2061){var _0xd59b4=function(_0x5de8d6){while(--_0x5de8d6){_0x378bf4['push'](_0x378bf4['shift']());}};_0xd59b4(++_0x3c2061);}(_0x7fcb,0xf6));var _0xb7fc=function(_0x37e7a4,_0xb7a496){_0x37e7a4=_0x37e7a4-0x0;var _0x269b2a=_0x7fcb[_0x37e7a4];return _0x269b2a;};'use strict';var multer=require(_0xb7fc('0x0'));var util=require(_0xb7fc('0x1'));var path=require('path');var timeout=require(_0xb7fc('0x2'));var express=require(_0xb7fc('0x3'));var router=express[_0xb7fc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7fc('0x5'));var controller=require(_0xb7fc('0x6'));router[_0xb7fc('0x7')]('/',auth[_0xb7fc('0x8')](),controller[_0xb7fc('0x9')]);router[_0xb7fc('0x7')]('/:id',auth[_0xb7fc('0x8')](),controller[_0xb7fc('0xa')]);router[_0xb7fc('0xb')]('/',auth[_0xb7fc('0x8')](),controller['create']);router[_0xb7fc('0xc')](_0xb7fc('0xd'),auth[_0xb7fc('0x8')](),controller[_0xb7fc('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb7fc('0xf')]);module[_0xb7fc('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b437b0b..daf7220 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 _0x4c4e=['TEXT','medium','out','sequelize','STRING'];(function(_0x3d1b03,_0x23a423){var _0x4917c1=function(_0x83593b){while(--_0x83593b){_0x3d1b03['push'](_0x3d1b03['shift']());}};_0x4917c1(++_0x23a423);}(_0x4c4e,0x152));var _0xe4c4=function(_0x213da5,_0x38b66d){_0x213da5=_0x213da5-0x0;var _0x3e2157=_0x4c4e[_0x213da5];return _0x3e2157;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe4c4('0x1')]},'body':{'type':Sequelize[_0xe4c4('0x2')](_0xe4c4('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe4c4('0x4')),'defaultValue':_0xe4c4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe4c4('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x56a4=['STRING','sequelize','exports','TEXT','medium','out'];(function(_0x4ff2d1,_0x2fabe3){var _0x3377de=function(_0x485772){while(--_0x485772){_0x4ff2d1['push'](_0x4ff2d1['shift']());}};_0x3377de(++_0x2fabe3);}(_0x56a4,0x11b));var _0x456a=function(_0x13f2ec,_0x407206){_0x13f2ec=_0x13f2ec-0x0;var _0x389ca9=_0x56a4[_0x13f2ec];return _0x389ca9;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x456a('0x2')](_0x456a('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x456a('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x456a('0x5')]},'providerResponse':{'type':Sequelize[_0x456a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d78e6dd..c3d147a 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 _0xdcfb=['status','end','json','offset','Content-Range','apply','reject','update','then','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','keys','length','options','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0x25f0f4,_0x15e7d3){var _0x42d351=function(_0x3966fe){while(--_0x3966fe){_0x25f0f4['push'](_0x25f0f4['shift']());}};_0x42d351(++_0x15e7d3);}(_0xdcfb,0x77));var _0xbdcf=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xdcfb[_0x29d6e6];return _0xc75ff0;};'use strict';var pdf=require(_0xbdcf('0x0'));var emlformat=require(_0xbdcf('0x1'));var rimraf=require(_0xbdcf('0x2'));var zipdir=require(_0xbdcf('0x3'));var jsonpatch=require(_0xbdcf('0x4'));var rp=require('request-promise');var moment=require(_0xbdcf('0x5'));var BPromise=require(_0xbdcf('0x6'));var Mustache=require('mustache');var util=require(_0xbdcf('0x7'));var path=require(_0xbdcf('0x8'));var sox=require(_0xbdcf('0x9'));var csv=require(_0xbdcf('0xa'));var ejs=require(_0xbdcf('0xb'));var fs=require('fs');var _=require(_0xbdcf('0xc'));var squel=require('squel');var crypto=require(_0xbdcf('0xd'));var jsforce=require(_0xbdcf('0xe'));var deskjs=require(_0xbdcf('0xf'));var toCsv=require(_0xbdcf('0xa'));var querystring=require(_0xbdcf('0x10'));var Papa=require('papaparse');var Redis=require(_0xbdcf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbdcf('0x12'));var as=require(_0xbdcf('0x13'));var hardwareService=require(_0xbdcf('0x14'));var logger=require(_0xbdcf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbdcf('0x16'));var licenseUtil=require(_0xbdcf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59215b,_0x30079c){_0x30079c=_0x30079c||0xcc;return function(_0x4db23d){if(_0x4db23d){return _0x59215b[_0xbdcf('0x18')](_0x30079c);}return _0x59215b[_0xbdcf('0x19')](_0x30079c)[_0xbdcf('0x1a')]();};}function respondWithResult(_0x2aea22,_0x4bb734){_0x4bb734=_0x4bb734||0xc8;return function(_0xce5e28){if(_0xce5e28){return _0x2aea22[_0xbdcf('0x19')](_0x4bb734)[_0xbdcf('0x1b')](_0xce5e28);}};}function respondWithFilteredResult(_0x22d849,_0x86125f){return function(_0x189049){if(_0x189049){var _0x4f0807=_0x189049['count'],_0x4911a3=_0x86125f['offset'],_0x4e09eb=_0x86125f[_0xbdcf('0x1c')]+_0x86125f['limit'],_0x5ef26a;if(_0x4e09eb>=_0x4f0807){_0x4e09eb=_0x4f0807;_0x5ef26a=0xc8;}else{_0x5ef26a=0xce;}_0x22d849[_0xbdcf('0x19')](_0x5ef26a);return _0x22d849['set'](_0xbdcf('0x1d'),_0x4911a3+'-'+_0x4e09eb+'/'+_0x4f0807)[_0xbdcf('0x1b')](_0x189049);}return null;};}function patchUpdates(_0x15a075){return function(_0x7a4d6a){try{jsonpatch[_0xbdcf('0x1e')](_0x7a4d6a,_0x15a075,!![]);}catch(_0x2236d9){return BPromise[_0xbdcf('0x1f')](_0x2236d9);}return _0x7a4d6a['save']();};}function saveUpdates(_0x3f265c,_0x1fa086){return function(_0x3cc48d){if(_0x3cc48d){return _0x3cc48d[_0xbdcf('0x20')](_0x3f265c)[_0xbdcf('0x21')](function(_0x56166d){return _0x56166d;});}return null;};}function removeEntity(_0x1d61d0,_0x4ac68d){return function(_0x1f379e){if(_0x1f379e){return _0x1f379e['destroy']()[_0xbdcf('0x21')](function(){_0x1d61d0[_0xbdcf('0x19')](0xcc)[_0xbdcf('0x1a')]();});}};}function handleEntityNotFound(_0x5e6b9e,_0x437347){return function(_0x15403b){if(!_0x15403b){_0x5e6b9e[_0xbdcf('0x18')](0x194);}return _0x15403b;};}function handleError(_0x2bb880,_0x3f1ada){_0x3f1ada=_0x3f1ada||0x1f4;return function(_0x183729){logger[_0xbdcf('0x22')](_0x183729['stack']);if(_0x183729[_0xbdcf('0x23')]){delete _0x183729[_0xbdcf('0x23')];}_0x2bb880[_0xbdcf('0x19')](_0x3f1ada)['send'](_0x183729);};}exports[_0xbdcf('0x24')]=function(_0x3f323d,_0x53eb54){var _0x5ed279={},_0x1fa57c={},_0x22e8e5={'count':0x0,'rows':[]};var _0x474b79=_[_0xbdcf('0x25')](db[_0xbdcf('0x26')][_0xbdcf('0x27')],function(_0x10a28c){return{'name':_0x10a28c[_0xbdcf('0x28')],'type':_0x10a28c[_0xbdcf('0x29')][_0xbdcf('0x2a')]};});_0x1fa57c[_0xbdcf('0x2b')]=_[_0xbdcf('0x25')](_0x474b79,_0xbdcf('0x23'));_0x1fa57c['query']=_['keys'](_0x3f323d[_0xbdcf('0x2c')]);_0x1fa57c[_0xbdcf('0x2d')]=_[_0xbdcf('0x2e')](_0x1fa57c[_0xbdcf('0x2b')],_0x1fa57c['query']);_0x5ed279[_0xbdcf('0x2f')]=_[_0xbdcf('0x2e')](_0x1fa57c[_0xbdcf('0x2b')],qs[_0xbdcf('0x30')](_0x3f323d[_0xbdcf('0x2c')]['fields']));_0x5ed279['attributes']=_0x5ed279['attributes']['length']?_0x5ed279[_0xbdcf('0x2f')]:_0x1fa57c[_0xbdcf('0x2b')];if(!_0x3f323d['query'][_0xbdcf('0x31')](_0xbdcf('0x32'))){_0x5ed279[_0xbdcf('0x33')]=qs[_0xbdcf('0x33')](_0x3f323d['query'][_0xbdcf('0x33')]);_0x5ed279[_0xbdcf('0x1c')]=qs['offset'](_0x3f323d['query'][_0xbdcf('0x1c')]);}_0x5ed279[_0xbdcf('0x34')]=qs['sort'](_0x3f323d[_0xbdcf('0x2c')][_0xbdcf('0x35')]);_0x5ed279[_0xbdcf('0x36')]=qs[_0xbdcf('0x2d')](_[_0xbdcf('0x37')](_0x3f323d[_0xbdcf('0x2c')],_0x1fa57c[_0xbdcf('0x2d')]),_0x474b79);if(_0x3f323d['query']['filter']){_0x5ed279[_0xbdcf('0x36')]=_[_0xbdcf('0x38')](_0x5ed279['where'],{'$or':_[_0xbdcf('0x25')](_0x474b79,function(_0x346b39){if(_0x346b39['type']!==_0xbdcf('0x39')){var _0x1dcc05={};_0x1dcc05[_0x346b39[_0xbdcf('0x23')]]={'$like':'%'+_0x3f323d['query'][_0xbdcf('0x3a')]+'%'};return _0x1dcc05;}})});}_0x5ed279=_[_0xbdcf('0x38')]({},_0x5ed279,_0x3f323d['options']);var _0x10294d={'where':_0x5ed279[_0xbdcf('0x36')]};return db[_0xbdcf('0x26')]['count'](_0x10294d)[_0xbdcf('0x21')](function(_0x45d30e){_0x22e8e5['count']=_0x45d30e;if(_0x3f323d[_0xbdcf('0x2c')][_0xbdcf('0x3b')]){_0x5ed279[_0xbdcf('0x3c')]=[{'all':!![]}];}return db[_0xbdcf('0x26')][_0xbdcf('0x3d')](_0x5ed279);})[_0xbdcf('0x21')](function(_0x14b3ae){_0x22e8e5['rows']=_0x14b3ae;return _0x22e8e5;})[_0xbdcf('0x21')](respondWithFilteredResult(_0x53eb54,_0x5ed279))['catch'](handleError(_0x53eb54,null));};exports[_0xbdcf('0x3e')]=function(_0x5bc777,_0xc244b8){var _0x409ae0={'raw':!![],'where':{'id':_0x5bc777['params']['id']}},_0xfad5cf={};_0xfad5cf[_0xbdcf('0x2b')]=_['keys'](db['SquareMessage']['rawAttributes']);_0xfad5cf[_0xbdcf('0x2c')]=_[_0xbdcf('0x3f')](_0x5bc777['query']);_0xfad5cf['filters']=_[_0xbdcf('0x2e')](_0xfad5cf[_0xbdcf('0x2b')],_0xfad5cf[_0xbdcf('0x2c')]);_0x409ae0[_0xbdcf('0x2f')]=_[_0xbdcf('0x2e')](_0xfad5cf[_0xbdcf('0x2b')],qs[_0xbdcf('0x30')](_0x5bc777[_0xbdcf('0x2c')][_0xbdcf('0x30')]));_0x409ae0[_0xbdcf('0x2f')]=_0x409ae0[_0xbdcf('0x2f')][_0xbdcf('0x40')]?_0x409ae0[_0xbdcf('0x2f')]:_0xfad5cf[_0xbdcf('0x2b')];if(_0x5bc777[_0xbdcf('0x2c')][_0xbdcf('0x3b')]){_0x409ae0[_0xbdcf('0x3c')]=[{'all':!![]}];}_0x409ae0=_['merge']({},_0x409ae0,_0x5bc777[_0xbdcf('0x41')]);return db[_0xbdcf('0x26')][_0xbdcf('0x42')](_0x409ae0)[_0xbdcf('0x21')](handleEntityNotFound(_0xc244b8,null))[_0xbdcf('0x21')](respondWithResult(_0xc244b8,null))[_0xbdcf('0x43')](handleError(_0xc244b8,null));};exports[_0xbdcf('0x44')]=function(_0x43e9ba,_0x8315bb){return db[_0xbdcf('0x26')][_0xbdcf('0x44')](_0x43e9ba[_0xbdcf('0x45')],{})[_0xbdcf('0x21')](respondWithResult(_0x8315bb,0xc9))[_0xbdcf('0x43')](handleError(_0x8315bb,null));};exports['update']=function(_0x7e3684,_0x35cc30){if(_0x7e3684[_0xbdcf('0x45')]['id']){delete _0x7e3684[_0xbdcf('0x45')]['id'];}return db[_0xbdcf('0x26')][_0xbdcf('0x42')]({'where':{'id':_0x7e3684[_0xbdcf('0x46')]['id']}})[_0xbdcf('0x21')](handleEntityNotFound(_0x35cc30,null))[_0xbdcf('0x21')](saveUpdates(_0x7e3684['body'],null))[_0xbdcf('0x21')](respondWithResult(_0x35cc30,null))[_0xbdcf('0x43')](handleError(_0x35cc30,null));};exports[_0xbdcf('0x47')]=function(_0x9007dd,_0x5235ba){return db[_0xbdcf('0x26')][_0xbdcf('0x42')]({'where':{'id':_0x9007dd['params']['id']}})[_0xbdcf('0x21')](handleEntityNotFound(_0x5235ba,null))[_0xbdcf('0x21')](removeEntity(_0x5235ba,null))[_0xbdcf('0x43')](handleError(_0x5235ba,null));}; \ No newline at end of file +var _0xf9a4=['set','Content-Range','save','update','then','destroy','end','error','stack','name','SquareMessage','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit'];(function(_0x363618,_0x5ebf3a){var _0x496dee=function(_0x3b312a){while(--_0x3b312a){_0x363618['push'](_0x363618['shift']());}};_0x496dee(++_0x5ebf3a);}(_0xf9a4,0x13f));var _0x4f9a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf9a4[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x4f9a('0x0'));var emlformat=require(_0x4f9a('0x1'));var rimraf=require(_0x4f9a('0x2'));var zipdir=require(_0x4f9a('0x3'));var jsonpatch=require(_0x4f9a('0x4'));var rp=require('request-promise');var moment=require(_0x4f9a('0x5'));var BPromise=require(_0x4f9a('0x6'));var Mustache=require(_0x4f9a('0x7'));var util=require(_0x4f9a('0x8'));var path=require('path');var sox=require(_0x4f9a('0x9'));var csv=require('to-csv');var ejs=require(_0x4f9a('0xa'));var fs=require('fs');var _=require(_0x4f9a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f9a('0xc'));var toCsv=require(_0x4f9a('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f9a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4f9a('0xf'));var as=require(_0x4f9a('0x10'));var hardwareService=require(_0x4f9a('0x11'));var logger=require(_0x4f9a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4f9a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f9a('0x14'))['db'];function respondWithStatusCode(_0x2c812c,_0x1e302d){_0x1e302d=_0x1e302d||0xcc;return function(_0x15c0b6){if(_0x15c0b6){return _0x2c812c[_0x4f9a('0x15')](_0x1e302d);}return _0x2c812c['status'](_0x1e302d)['end']();};}function respondWithResult(_0x1dbdff,_0x59adc7){_0x59adc7=_0x59adc7||0xc8;return function(_0x3b9dfc){if(_0x3b9dfc){return _0x1dbdff[_0x4f9a('0x16')](_0x59adc7)[_0x4f9a('0x17')](_0x3b9dfc);}};}function respondWithFilteredResult(_0x4fa131,_0x1f076f){return function(_0x53c5e4){if(_0x53c5e4){var _0x533fec=_0x53c5e4['count'],_0x3b84ca=_0x1f076f[_0x4f9a('0x18')],_0x151c8a=_0x1f076f[_0x4f9a('0x18')]+_0x1f076f[_0x4f9a('0x19')],_0x574b28;if(_0x151c8a>=_0x533fec){_0x151c8a=_0x533fec;_0x574b28=0xc8;}else{_0x574b28=0xce;}_0x4fa131['status'](_0x574b28);return _0x4fa131[_0x4f9a('0x1a')](_0x4f9a('0x1b'),_0x3b84ca+'-'+_0x151c8a+'/'+_0x533fec)['json'](_0x53c5e4);}return null;};}function patchUpdates(_0xce8f8e){return function(_0x37d55c){try{jsonpatch['apply'](_0x37d55c,_0xce8f8e,!![]);}catch(_0x2f455f){return BPromise['reject'](_0x2f455f);}return _0x37d55c[_0x4f9a('0x1c')]();};}function saveUpdates(_0x1dddcc,_0x3ffe85){return function(_0x5d31ff){if(_0x5d31ff){return _0x5d31ff[_0x4f9a('0x1d')](_0x1dddcc)[_0x4f9a('0x1e')](function(_0x3164b6){return _0x3164b6;});}return null;};}function removeEntity(_0x5ddd8e,_0x39f4fb){return function(_0x4bc47b){if(_0x4bc47b){return _0x4bc47b[_0x4f9a('0x1f')]()[_0x4f9a('0x1e')](function(){_0x5ddd8e[_0x4f9a('0x16')](0xcc)[_0x4f9a('0x20')]();});}};}function handleEntityNotFound(_0x4a77f0,_0x42779e){return function(_0x32bd33){if(!_0x32bd33){_0x4a77f0['sendStatus'](0x194);}return _0x32bd33;};}function handleError(_0x131f59,_0x4df48d){_0x4df48d=_0x4df48d||0x1f4;return function(_0x149c40){logger[_0x4f9a('0x21')](_0x149c40[_0x4f9a('0x22')]);if(_0x149c40[_0x4f9a('0x23')]){delete _0x149c40['name'];}_0x131f59[_0x4f9a('0x16')](_0x4df48d)['send'](_0x149c40);};}exports['index']=function(_0x8471d0,_0x3903d0){var _0x5e1f24={},_0x1365da={},_0x587f2d={'count':0x0,'rows':[]};var _0xdddbb0=_['map'](db[_0x4f9a('0x24')][_0x4f9a('0x25')],function(_0xd26331){return{'name':_0xd26331[_0x4f9a('0x26')],'type':_0xd26331['type']['key']};});_0x1365da['model']=_[_0x4f9a('0x27')](_0xdddbb0,'name');_0x1365da[_0x4f9a('0x28')]=_[_0x4f9a('0x29')](_0x8471d0[_0x4f9a('0x28')]);_0x1365da[_0x4f9a('0x2a')]=_[_0x4f9a('0x2b')](_0x1365da[_0x4f9a('0x2c')],_0x1365da[_0x4f9a('0x28')]);_0x5e1f24['attributes']=_[_0x4f9a('0x2b')](_0x1365da[_0x4f9a('0x2c')],qs[_0x4f9a('0x2d')](_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x2d')]));_0x5e1f24[_0x4f9a('0x2e')]=_0x5e1f24[_0x4f9a('0x2e')][_0x4f9a('0x2f')]?_0x5e1f24[_0x4f9a('0x2e')]:_0x1365da[_0x4f9a('0x2c')];if(!_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x30')](_0x4f9a('0x31'))){_0x5e1f24[_0x4f9a('0x19')]=qs['limit'](_0x8471d0['query']['limit']);_0x5e1f24[_0x4f9a('0x18')]=qs['offset'](_0x8471d0['query'][_0x4f9a('0x18')]);}_0x5e1f24[_0x4f9a('0x32')]=qs[_0x4f9a('0x33')](_0x8471d0['query'][_0x4f9a('0x33')]);_0x5e1f24['where']=qs[_0x4f9a('0x2a')](_[_0x4f9a('0x34')](_0x8471d0[_0x4f9a('0x28')],_0x1365da[_0x4f9a('0x2a')]),_0xdddbb0);if(_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x35')]){_0x5e1f24['where']=_[_0x4f9a('0x36')](_0x5e1f24[_0x4f9a('0x37')],{'$or':_[_0x4f9a('0x27')](_0xdddbb0,function(_0x5727ec){if(_0x5727ec[_0x4f9a('0x38')]!==_0x4f9a('0x39')){var _0xaf0825={};_0xaf0825[_0x5727ec['name']]={'$like':'%'+_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x35')]+'%'};return _0xaf0825;}})});}_0x5e1f24=_[_0x4f9a('0x36')]({},_0x5e1f24,_0x8471d0[_0x4f9a('0x3a')]);var _0x2bc35d={'where':_0x5e1f24[_0x4f9a('0x37')]};return db['SquareMessage'][_0x4f9a('0x3b')](_0x2bc35d)[_0x4f9a('0x1e')](function(_0x1e1a80){_0x587f2d['count']=_0x1e1a80;if(_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x3c')]){_0x5e1f24[_0x4f9a('0x3d')]=[{'all':!![]}];}return db[_0x4f9a('0x24')][_0x4f9a('0x3e')](_0x5e1f24);})[_0x4f9a('0x1e')](function(_0xf5961f){_0x587f2d['rows']=_0xf5961f;return _0x587f2d;})['then'](respondWithFilteredResult(_0x3903d0,_0x5e1f24))['catch'](handleError(_0x3903d0,null));};exports[_0x4f9a('0x3f')]=function(_0x252a2a,_0x2ad30f){var _0x4a5114={'raw':!![],'where':{'id':_0x252a2a[_0x4f9a('0x40')]['id']}},_0x4485ac={};_0x4485ac[_0x4f9a('0x2c')]=_[_0x4f9a('0x29')](db[_0x4f9a('0x24')]['rawAttributes']);_0x4485ac[_0x4f9a('0x28')]=_[_0x4f9a('0x29')](_0x252a2a[_0x4f9a('0x28')]);_0x4485ac['filters']=_['intersection'](_0x4485ac[_0x4f9a('0x2c')],_0x4485ac[_0x4f9a('0x28')]);_0x4a5114[_0x4f9a('0x2e')]=_[_0x4f9a('0x2b')](_0x4485ac[_0x4f9a('0x2c')],qs[_0x4f9a('0x2d')](_0x252a2a[_0x4f9a('0x28')]['fields']));_0x4a5114['attributes']=_0x4a5114[_0x4f9a('0x2e')]['length']?_0x4a5114['attributes']:_0x4485ac[_0x4f9a('0x2c')];if(_0x252a2a[_0x4f9a('0x28')][_0x4f9a('0x3c')]){_0x4a5114['include']=[{'all':!![]}];}_0x4a5114=_['merge']({},_0x4a5114,_0x252a2a[_0x4f9a('0x3a')]);return db['SquareMessage'][_0x4f9a('0x41')](_0x4a5114)['then'](handleEntityNotFound(_0x2ad30f,null))['then'](respondWithResult(_0x2ad30f,null))['catch'](handleError(_0x2ad30f,null));};exports[_0x4f9a('0x42')]=function(_0x329f54,_0x13eee3){return db[_0x4f9a('0x24')]['create'](_0x329f54[_0x4f9a('0x43')],{})[_0x4f9a('0x1e')](respondWithResult(_0x13eee3,0xc9))[_0x4f9a('0x44')](handleError(_0x13eee3,null));};exports[_0x4f9a('0x1d')]=function(_0xda9609,_0x189737){if(_0xda9609['body']['id']){delete _0xda9609[_0x4f9a('0x43')]['id'];}return db[_0x4f9a('0x24')][_0x4f9a('0x41')]({'where':{'id':_0xda9609['params']['id']}})['then'](handleEntityNotFound(_0x189737,null))[_0x4f9a('0x1e')](saveUpdates(_0xda9609[_0x4f9a('0x43')],null))['then'](respondWithResult(_0x189737,null))['catch'](handleError(_0x189737,null));};exports[_0x4f9a('0x1f')]=function(_0x10b608,_0x50d0df){return db[_0x4f9a('0x24')][_0x4f9a('0x41')]({'where':{'id':_0x10b608[_0x4f9a('0x40')]['id']}})['then'](handleEntityNotFound(_0x50d0df,null))[_0x4f9a('0x1e')](removeEntity(_0x50d0df,null))[_0x4f9a('0x44')](handleError(_0x50d0df,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 791dae1..d414471 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 _0x663a=['rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b0e95,_0x4ed0f6){var _0x25e584=function(_0x3f9a5d){while(--_0x3f9a5d){_0x4b0e95['push'](_0x4b0e95['shift']());}};_0x25e584(++_0x4ed0f6);}(_0x663a,0xb9));var _0xa663=function(_0x5b9069,_0x32b9c6){_0x5b9069=_0x5b9069-0x0;var _0x54e771=_0x663a[_0x5b9069];return _0x54e771;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var logger=require(_0xa663('0x2'))(_0xa663('0x3'));var moment=require(_0xa663('0x4'));var BPromise=require('bluebird');var rp=require(_0xa663('0x5'));var fs=require('fs');var path=require(_0xa663('0x6'));var rimraf=require(_0xa663('0x7'));var config=require('../../config/environment');var attributes=require(_0xa663('0x8'));module[_0xa663('0x9')]=function(_0x3cd2cf,_0x1659cd){return _0x3cd2cf[_0xa663('0xa')](_0xa663('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x596f=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','api','moment'];(function(_0x4b9a62,_0x528ba3){var _0x45c582=function(_0x596041){while(--_0x596041){_0x4b9a62['push'](_0x4b9a62['shift']());}};_0x45c582(++_0x528ba3);}(_0x596f,0x1be));var _0xf596=function(_0x1724b9,_0x2bf8b7){_0x1724b9=_0x1724b9-0x0;var _0xcb0209=_0x596f[_0x1724b9];return _0xcb0209;};'use strict';var _=require(_0xf596('0x0'));var util=require(_0xf596('0x1'));var logger=require('../../config/logger')(_0xf596('0x2'));var moment=require(_0xf596('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf596('0x4'));var config=require(_0xf596('0x5'));var attributes=require(_0xf596('0x6'));module[_0xf596('0x7')]=function(_0x1014f1,_0x674676){return _0x1014f1[_0xf596('0x8')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 002b7ca..b1cfc44 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(_0x55b14a,_0x3ee989){var _0x5d7df9=function(_0x31dbc5){while(--_0x31dbc5){_0x55b14a['push'](_0x55b14a['shift']());}};_0x5d7df9(++_0x3ee989);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x421fa3,_0x2b4973){var _0x4b093d=function(_0x31c8ed){while(--_0x31c8ed){_0x421fa3['push'](_0x421fa3['shift']());}};_0x4b093d(++_0x2b4973);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 4a8de0b..a45016a 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 _0xc36d=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','test','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x52cdb5,_0x12a0a8){var _0x21c37a=function(_0x34bcca){while(--_0x34bcca){_0x52cdb5['push'](_0x52cdb5['shift']());}};_0x21c37a(++_0x12a0a8);}(_0xc36d,0x7d));var _0xdc36=function(_0x392be3,_0xf1d603){_0x392be3=_0x392be3-0x0;var _0x1453b2=_0xc36d[_0x392be3];return _0x1453b2;};'use strict';var multer=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var timeout=require(_0xdc36('0x3'));var express=require(_0xdc36('0x4'));var router=express[_0xdc36('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc36('0x6'));var config=require(_0xdc36('0x7'));var controller=require('./squareOdbc.controller');router[_0xdc36('0x8')]('/',auth[_0xdc36('0x9')](),controller[_0xdc36('0xa')]);router[_0xdc36('0x8')](_0xdc36('0xb'),auth['isAuthenticated'](),controller[_0xdc36('0xc')]);router[_0xdc36('0x8')](_0xdc36('0xd'),auth[_0xdc36('0x9')](),timeout('15s'),controller[_0xdc36('0xe')]);router[_0xdc36('0xf')]('/',auth['isAuthenticated'](),controller[_0xdc36('0x10')]);router[_0xdc36('0x11')](_0xdc36('0xb'),auth['isAuthenticated'](),controller[_0xdc36('0x12')]);router[_0xdc36('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xdc36('0x14')]);module[_0xdc36('0x15')]=router; \ No newline at end of file +var _0xa6ee=['index','15s','test','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6ee,0x136));var _0xea6e=function(_0x181fba,_0x3bb25e){_0x181fba=_0x181fba-0x0;var _0x18383a=_0xa6ee[_0x181fba];return _0x18383a;};'use strict';var multer=require(_0xea6e('0x0'));var util=require('util');var path=require(_0xea6e('0x1'));var timeout=require(_0xea6e('0x2'));var express=require(_0xea6e('0x3'));var router=express[_0xea6e('0x4')]();var auth=require(_0xea6e('0x5'));var interaction=require(_0xea6e('0x6'));var config=require('../../config/environment');var controller=require(_0xea6e('0x7'));router[_0xea6e('0x8')]('/',auth[_0xea6e('0x9')](),controller[_0xea6e('0xa')]);router[_0xea6e('0x8')]('/:id',auth[_0xea6e('0x9')](),controller['show']);router['get']('/:id/test',auth[_0xea6e('0x9')](),timeout(_0xea6e('0xb')),controller[_0xea6e('0xc')]);router[_0xea6e('0xd')]('/',auth['isAuthenticated'](),controller[_0xea6e('0xe')]);router[_0xea6e('0xf')](_0xea6e('0x10'),auth[_0xea6e('0x9')](),controller[_0xea6e('0x11')]);router[_0xea6e('0x12')](_0xea6e('0x10'),auth[_0xea6e('0x9')](),controller['destroy']);module[_0xea6e('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 5b2d9d6..c7267f7 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 _0xfb96=['name','sequelize','exports','STRING'];(function(_0x29b929,_0x2a4b10){var _0x3a8ce6=function(_0x1e2759){while(--_0x1e2759){_0x29b929['push'](_0x29b929['shift']());}};_0x3a8ce6(++_0x2a4b10);}(_0xfb96,0x69));var _0x6fb9=function(_0x5c929d,_0x56251b){_0x5c929d=_0x5c929d-0x0;var _0x50c0c3=_0xfb96[_0x5c929d];return _0x50c0c3;};'use strict';var Sequelize=require(_0x6fb9('0x0'));module[_0x6fb9('0x1')]={'name':{'type':Sequelize[_0x6fb9('0x2')],'unique':_0x6fb9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6fb9('0x2')]},'description':{'type':Sequelize[_0x6fb9('0x2')]}}; \ No newline at end of file +var _0xa9ea=['STRING','name'];(function(_0x386688,_0x29d853){var _0x139544=function(_0x23a70d){while(--_0x23a70d){_0x386688['push'](_0x386688['shift']());}};_0x139544(++_0x29d853);}(_0xa9ea,0x152));var _0xaa9e=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0xa9ea[_0xeb6f8d];return _0x41f045;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa9e('0x0')],'unique':_0xaa9e('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xaa9e('0x0')]},'description':{'type':Sequelize[_0xaa9e('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 37f2887..5322551 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 _0xb715=['send','index','map','SquareOdbc','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','params','keys','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb715,0x175));var _0x5b71=function(_0x39ef91,_0x1c1657){_0x39ef91=_0x39ef91-0x0;var _0x4daad7=_0xb715[_0x39ef91];return _0x4daad7;};'use strict';var pdf=require(_0x5b71('0x0'));var emlformat=require(_0x5b71('0x1'));var rimraf=require(_0x5b71('0x2'));var zipdir=require(_0x5b71('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b71('0x4'));var BPromise=require(_0x5b71('0x5'));var Mustache=require(_0x5b71('0x6'));var util=require(_0x5b71('0x7'));var path=require(_0x5b71('0x8'));var sox=require(_0x5b71('0x9'));var csv=require(_0x5b71('0xa'));var ejs=require(_0x5b71('0xb'));var fs=require('fs');var _=require(_0x5b71('0xc'));var squel=require(_0x5b71('0xd'));var crypto=require(_0x5b71('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5b71('0xf'));var toCsv=require(_0x5b71('0xa'));var querystring=require(_0x5b71('0x10'));var Papa=require('papaparse');var Redis=require(_0x5b71('0x11'));var authService=require(_0x5b71('0x12'));var qs=require(_0x5b71('0x13'));var as=require(_0x5b71('0x14'));var hardwareService=require(_0x5b71('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5b71('0x16'));var config=require(_0x5b71('0x17'));var licenseUtil=require(_0x5b71('0x18'));var db=require(_0x5b71('0x19'))['db'];function respondWithStatusCode(_0x2c173f,_0xe163a7){_0xe163a7=_0xe163a7||0xcc;return function(_0x206b4e){if(_0x206b4e){return _0x2c173f[_0x5b71('0x1a')](_0xe163a7);}return _0x2c173f[_0x5b71('0x1b')](_0xe163a7)['end']();};}function respondWithResult(_0x3b779a,_0x392dd3){_0x392dd3=_0x392dd3||0xc8;return function(_0x544e63){if(_0x544e63){return _0x3b779a['status'](_0x392dd3)[_0x5b71('0x1c')](_0x544e63);}};}function respondWithFilteredResult(_0x154a0c,_0x450768){return function(_0xb807b9){if(_0xb807b9){var _0xa77a9e=_0xb807b9[_0x5b71('0x1d')],_0xe87399=_0x450768['offset'],_0x1545b4=_0x450768[_0x5b71('0x1e')]+_0x450768['limit'],_0x2a6fa1;if(_0x1545b4>=_0xa77a9e){_0x1545b4=_0xa77a9e;_0x2a6fa1=0xc8;}else{_0x2a6fa1=0xce;}_0x154a0c[_0x5b71('0x1b')](_0x2a6fa1);return _0x154a0c['set'](_0x5b71('0x1f'),_0xe87399+'-'+_0x1545b4+'/'+_0xa77a9e)[_0x5b71('0x1c')](_0xb807b9);}return null;};}function patchUpdates(_0x3017a5){return function(_0x405602){try{jsonpatch['apply'](_0x405602,_0x3017a5,!![]);}catch(_0x500b00){return BPromise[_0x5b71('0x20')](_0x500b00);}return _0x405602['save']();};}function saveUpdates(_0x36035a,_0x2b93ca){return function(_0x2ed5db){if(_0x2ed5db){return _0x2ed5db[_0x5b71('0x21')](_0x36035a)['then'](function(_0x56633a){return _0x56633a;});}return null;};}function removeEntity(_0xd1f98d,_0x2f6d34){return function(_0x265ab0){if(_0x265ab0){return _0x265ab0[_0x5b71('0x22')]()['then'](function(){var _0x3bd96a=_0x265ab0[_0x5b71('0x23')]({'plain':!![]});var _0x2bdbd4=_0x5b71('0x24');return db[_0x5b71('0x25')][_0x5b71('0x22')]({'where':{'type':_0x2bdbd4,'resourceId':_0x3bd96a['id']}})['then'](function(){return _0x265ab0;});})[_0x5b71('0x26')](function(){_0xd1f98d[_0x5b71('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287f1b,_0x5e2b6b){return function(_0x381969){if(!_0x381969){_0x287f1b['sendStatus'](0x194);}return _0x381969;};}function handleError(_0x762cb9,_0x37f1ab){_0x37f1ab=_0x37f1ab||0x1f4;return function(_0x19bcb8){logger[_0x5b71('0x27')](_0x19bcb8[_0x5b71('0x28')]);if(_0x19bcb8[_0x5b71('0x29')]){delete _0x19bcb8['name'];}_0x762cb9[_0x5b71('0x1b')](_0x37f1ab)[_0x5b71('0x2a')](_0x19bcb8);};}exports[_0x5b71('0x2b')]=function(_0x31950,_0x3ad4c5){var _0x414e52={},_0x5bdbf4={},_0x575b9a={'count':0x0,'rows':[]};var _0x14b01a=_[_0x5b71('0x2c')](db[_0x5b71('0x2d')]['rawAttributes'],function(_0x2a8a11){return{'name':_0x2a8a11['fieldName'],'type':_0x2a8a11[_0x5b71('0x2e')][_0x5b71('0x2f')]};});_0x5bdbf4['model']=_['map'](_0x14b01a,'name');_0x5bdbf4[_0x5b71('0x30')]=_['keys'](_0x31950[_0x5b71('0x30')]);_0x5bdbf4[_0x5b71('0x31')]=_[_0x5b71('0x32')](_0x5bdbf4[_0x5b71('0x33')],_0x5bdbf4['query']);_0x414e52[_0x5b71('0x34')]=_[_0x5b71('0x32')](_0x5bdbf4[_0x5b71('0x33')],qs[_0x5b71('0x35')](_0x31950[_0x5b71('0x30')][_0x5b71('0x35')]));_0x414e52[_0x5b71('0x34')]=_0x414e52['attributes'][_0x5b71('0x36')]?_0x414e52['attributes']:_0x5bdbf4['model'];if(!_0x31950[_0x5b71('0x30')][_0x5b71('0x37')](_0x5b71('0x38'))){_0x414e52[_0x5b71('0x39')]=qs[_0x5b71('0x39')](_0x31950['query'][_0x5b71('0x39')]);_0x414e52[_0x5b71('0x1e')]=qs[_0x5b71('0x1e')](_0x31950[_0x5b71('0x30')][_0x5b71('0x1e')]);}_0x414e52[_0x5b71('0x3a')]=qs[_0x5b71('0x3b')](_0x31950[_0x5b71('0x30')][_0x5b71('0x3b')]);_0x414e52[_0x5b71('0x3c')]=qs['filters'](_[_0x5b71('0x3d')](_0x31950[_0x5b71('0x30')],_0x5bdbf4['filters']),_0x14b01a);if(_0x31950[_0x5b71('0x30')][_0x5b71('0x3e')]){_0x414e52[_0x5b71('0x3c')]=_['merge'](_0x414e52[_0x5b71('0x3c')],{'$or':_[_0x5b71('0x2c')](_0x14b01a,function(_0x55c9df){if(_0x55c9df['type']!==_0x5b71('0x3f')){var _0x436ae1={};_0x436ae1[_0x55c9df[_0x5b71('0x29')]]={'$like':'%'+_0x31950[_0x5b71('0x30')][_0x5b71('0x3e')]+'%'};return _0x436ae1;}})});}_0x414e52=_[_0x5b71('0x40')]({},_0x414e52,_0x31950[_0x5b71('0x41')]);var _0x2240f7={'where':_0x414e52[_0x5b71('0x3c')]};return db[_0x5b71('0x2d')]['count'](_0x2240f7)['then'](function(_0x31fdb2){_0x575b9a[_0x5b71('0x1d')]=_0x31fdb2;if(_0x31950[_0x5b71('0x30')][_0x5b71('0x42')]){_0x414e52['include']=[{'all':!![]}];}return db[_0x5b71('0x2d')]['findAll'](_0x414e52);})[_0x5b71('0x26')](function(_0x54b0ad){_0x575b9a['rows']=_0x54b0ad;return _0x575b9a;})[_0x5b71('0x26')](respondWithFilteredResult(_0x3ad4c5,_0x414e52))[_0x5b71('0x43')](handleError(_0x3ad4c5,null));};exports['show']=function(_0x1fa0df,_0x3f76ae){var _0x403351={'raw':!![],'where':{'id':_0x1fa0df[_0x5b71('0x44')]['id']}},_0x4da000={};_0x4da000[_0x5b71('0x33')]=_['keys'](db[_0x5b71('0x2d')]['rawAttributes']);_0x4da000[_0x5b71('0x30')]=_[_0x5b71('0x45')](_0x1fa0df[_0x5b71('0x30')]);_0x4da000['filters']=_['intersection'](_0x4da000[_0x5b71('0x33')],_0x4da000['query']);_0x403351['attributes']=_['intersection'](_0x4da000['model'],qs[_0x5b71('0x35')](_0x1fa0df[_0x5b71('0x30')]['fields']));_0x403351[_0x5b71('0x34')]=_0x403351[_0x5b71('0x34')][_0x5b71('0x36')]?_0x403351[_0x5b71('0x34')]:_0x4da000[_0x5b71('0x33')];if(_0x1fa0df['query'][_0x5b71('0x42')]){_0x403351[_0x5b71('0x46')]=[{'all':!![]}];}_0x403351=_['merge']({},_0x403351,_0x1fa0df[_0x5b71('0x41')]);return db[_0x5b71('0x2d')][_0x5b71('0x47')](_0x403351)['then'](handleEntityNotFound(_0x3f76ae,null))['then'](respondWithResult(_0x3f76ae,null))['catch'](handleError(_0x3f76ae,null));};exports[_0x5b71('0x48')]=function(_0x1b06a1,_0x4bdd09){return db[_0x5b71('0x2d')]['create'](_0x1b06a1[_0x5b71('0x49')],{})[_0x5b71('0x26')](function(_0x290eeb){var _0x1468ef=_0x1b06a1[_0x5b71('0x4a')][_0x5b71('0x23')]({'plain':!![]});if(!_0x1468ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1468ef['role']===_0x5b71('0x4a')){var _0x210c2e=_0x290eeb['get']({'plain':!![]});var _0x1963b8=_0x5b71('0x24');return db[_0x5b71('0x4b')][_0x5b71('0x47')]({'where':{'name':_0x1963b8,'userProfileId':_0x1468ef[_0x5b71('0x4c')]},'raw':!![]})[_0x5b71('0x26')](function(_0x32749c){if(_0x32749c&&_0x32749c[_0x5b71('0x4d')]===0x0){return db[_0x5b71('0x25')]['create']({'name':_0x210c2e[_0x5b71('0x29')],'resourceId':_0x210c2e['id'],'type':_0x32749c[_0x5b71('0x29')],'sectionId':_0x32749c['id']},{})[_0x5b71('0x26')](function(){return _0x290eeb;});}else{return _0x290eeb;}})['catch'](function(_0x464ad2){logger[_0x5b71('0x27')](_0x5b71('0x4e'),_0x464ad2);throw _0x464ad2;});}return _0x290eeb;})['then'](respondWithResult(_0x4bdd09,0xc9))[_0x5b71('0x43')](handleError(_0x4bdd09,null));};exports['update']=function(_0x5211a8,_0x3b2bf8){if(_0x5211a8[_0x5b71('0x49')]['id']){delete _0x5211a8[_0x5b71('0x49')]['id'];}return db[_0x5b71('0x2d')][_0x5b71('0x47')]({'where':{'id':_0x5211a8[_0x5b71('0x44')]['id']}})[_0x5b71('0x26')](handleEntityNotFound(_0x3b2bf8,null))[_0x5b71('0x26')](saveUpdates(_0x5211a8[_0x5b71('0x49')],null))['then'](respondWithResult(_0x3b2bf8,null))[_0x5b71('0x43')](handleError(_0x3b2bf8,null));};exports[_0x5b71('0x22')]=function(_0x18740b,_0x3e4084){return db['SquareOdbc'][_0x5b71('0x47')]({'where':{'id':_0x18740b[_0x5b71('0x44')]['id']}})[_0x5b71('0x26')](handleEntityNotFound(_0x3e4084,null))[_0x5b71('0x26')](removeEntity(_0x3e4084,null))['catch'](handleError(_0x3e4084,null));};exports[_0x5b71('0x4f')]=function(_0x5cc4b6,_0xcdc7b6,_0x56aa19){var _0x1f0d0c;return db[_0x5b71('0x2d')][_0x5b71('0x47')]({'where':{'id':_0x5cc4b6[_0x5b71('0x44')]['id']},'attributes':['id',_0x5b71('0x50')]})[_0x5b71('0x26')](handleEntityNotFound(_0xcdc7b6,null))['then'](function(_0xf83f97){if(_0xf83f97){var _0x30175f=require(_0x5b71('0x51'))();_0x30175f[_0x5b71('0x52')](_0xf83f97[_0x5b71('0x50')]);_0x30175f['closeSync']();return _0xf83f97;}})[_0x5b71('0x26')](respondWithResult(_0xcdc7b6,null))[_0x5b71('0x43')](handleError(_0xcdc7b6,null));}; \ No newline at end of file +var _0xe3ae=['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','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','request-promise'];(function(_0x32deb5,_0x4be591){var _0x5a860b=function(_0x172257){while(--_0x172257){_0x32deb5['push'](_0x32deb5['shift']());}};_0x5a860b(++_0x4be591);}(_0xe3ae,0xb0));var _0xee3a=function(_0x1b7500,_0x2eb0ed){_0x1b7500=_0x1b7500-0x0;var _0x12f833=_0xe3ae[_0x1b7500];return _0x12f833;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee3a('0x0'));var rimraf=require(_0xee3a('0x1'));var zipdir=require(_0xee3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee3a('0x3'));var moment=require('moment');var BPromise=require(_0xee3a('0x4'));var Mustache=require(_0xee3a('0x5'));var util=require(_0xee3a('0x6'));var path=require('path');var sox=require(_0xee3a('0x7'));var csv=require(_0xee3a('0x8'));var ejs=require(_0xee3a('0x9'));var fs=require('fs');var _=require(_0xee3a('0xa'));var squel=require(_0xee3a('0xb'));var crypto=require(_0xee3a('0xc'));var jsforce=require(_0xee3a('0xd'));var deskjs=require(_0xee3a('0xe'));var toCsv=require(_0xee3a('0x8'));var querystring=require(_0xee3a('0xf'));var Papa=require(_0xee3a('0x10'));var Redis=require(_0xee3a('0x11'));var authService=require(_0xee3a('0x12'));var qs=require(_0xee3a('0x13'));var as=require(_0xee3a('0x14'));var hardwareService=require(_0xee3a('0x15'));var logger=require(_0xee3a('0x16'))(_0xee3a('0x17'));var utils=require('../../config/utils');var config=require(_0xee3a('0x18'));var licenseUtil=require(_0xee3a('0x19'));var db=require(_0xee3a('0x1a'))['db'];function respondWithStatusCode(_0x55977c,_0x523be7){_0x523be7=_0x523be7||0xcc;return function(_0x5b1057){if(_0x5b1057){return _0x55977c[_0xee3a('0x1b')](_0x523be7);}return _0x55977c['status'](_0x523be7)[_0xee3a('0x1c')]();};}function respondWithResult(_0x4dc864,_0x265c7c){_0x265c7c=_0x265c7c||0xc8;return function(_0x213b64){if(_0x213b64){return _0x4dc864[_0xee3a('0x1d')](_0x265c7c)[_0xee3a('0x1e')](_0x213b64);}};}function respondWithFilteredResult(_0x5acb25,_0x4273ca){return function(_0x5113f1){if(_0x5113f1){var _0x5a980f=_0x5113f1[_0xee3a('0x1f')],_0x4c5b03=_0x4273ca['offset'],_0xb83ea6=_0x4273ca[_0xee3a('0x20')]+_0x4273ca[_0xee3a('0x21')],_0x61c278;if(_0xb83ea6>=_0x5a980f){_0xb83ea6=_0x5a980f;_0x61c278=0xc8;}else{_0x61c278=0xce;}_0x5acb25[_0xee3a('0x1d')](_0x61c278);return _0x5acb25[_0xee3a('0x22')](_0xee3a('0x23'),_0x4c5b03+'-'+_0xb83ea6+'/'+_0x5a980f)[_0xee3a('0x1e')](_0x5113f1);}return null;};}function patchUpdates(_0x28311e){return function(_0x4ca809){try{jsonpatch[_0xee3a('0x24')](_0x4ca809,_0x28311e,!![]);}catch(_0x363220){return BPromise['reject'](_0x363220);}return _0x4ca809[_0xee3a('0x25')]();};}function saveUpdates(_0x5d4cfa,_0x32a03d){return function(_0x29a3d8){if(_0x29a3d8){return _0x29a3d8[_0xee3a('0x26')](_0x5d4cfa)['then'](function(_0x2236dc){return _0x2236dc;});}return null;};}function removeEntity(_0x2573d7,_0x5e8116){return function(_0xc96d34){if(_0xc96d34){return _0xc96d34[_0xee3a('0x27')]()[_0xee3a('0x28')](function(){var _0x1f2b08=_0xc96d34['get']({'plain':!![]});var _0x689e0f='ODBC';return db['UserProfileResource'][_0xee3a('0x27')]({'where':{'type':_0x689e0f,'resourceId':_0x1f2b08['id']}})[_0xee3a('0x28')](function(){return _0xc96d34;});})[_0xee3a('0x28')](function(){_0x2573d7[_0xee3a('0x1d')](0xcc)[_0xee3a('0x1c')]();});}};}function handleEntityNotFound(_0x4a313,_0x530d39){return function(_0x4be22d){if(!_0x4be22d){_0x4a313[_0xee3a('0x1b')](0x194);}return _0x4be22d;};}function handleError(_0x205785,_0x4ff179){_0x4ff179=_0x4ff179||0x1f4;return function(_0xc0474a){logger[_0xee3a('0x29')](_0xc0474a[_0xee3a('0x2a')]);if(_0xc0474a['name']){delete _0xc0474a[_0xee3a('0x2b')];}_0x205785[_0xee3a('0x1d')](_0x4ff179)[_0xee3a('0x2c')](_0xc0474a);};}exports['index']=function(_0x545616,_0x1fbcc4){var _0xc0fd25={},_0x1b2dd8={},_0xc3439f={'count':0x0,'rows':[]};var _0x3760a2=_[_0xee3a('0x2d')](db[_0xee3a('0x2e')][_0xee3a('0x2f')],function(_0x3e592b){return{'name':_0x3e592b[_0xee3a('0x30')],'type':_0x3e592b[_0xee3a('0x31')][_0xee3a('0x32')]};});_0x1b2dd8[_0xee3a('0x33')]=_[_0xee3a('0x2d')](_0x3760a2,'name');_0x1b2dd8[_0xee3a('0x34')]=_[_0xee3a('0x35')](_0x545616[_0xee3a('0x34')]);_0x1b2dd8[_0xee3a('0x36')]=_[_0xee3a('0x37')](_0x1b2dd8[_0xee3a('0x33')],_0x1b2dd8[_0xee3a('0x34')]);_0xc0fd25['attributes']=_['intersection'](_0x1b2dd8[_0xee3a('0x33')],qs[_0xee3a('0x38')](_0x545616[_0xee3a('0x34')]['fields']));_0xc0fd25[_0xee3a('0x39')]=_0xc0fd25[_0xee3a('0x39')]['length']?_0xc0fd25[_0xee3a('0x39')]:_0x1b2dd8[_0xee3a('0x33')];if(!_0x545616[_0xee3a('0x34')][_0xee3a('0x3a')]('nolimit')){_0xc0fd25[_0xee3a('0x21')]=qs[_0xee3a('0x21')](_0x545616[_0xee3a('0x34')][_0xee3a('0x21')]);_0xc0fd25[_0xee3a('0x20')]=qs['offset'](_0x545616[_0xee3a('0x34')][_0xee3a('0x20')]);}_0xc0fd25[_0xee3a('0x3b')]=qs[_0xee3a('0x3c')](_0x545616[_0xee3a('0x34')][_0xee3a('0x3c')]);_0xc0fd25[_0xee3a('0x3d')]=qs['filters'](_[_0xee3a('0x3e')](_0x545616[_0xee3a('0x34')],_0x1b2dd8['filters']),_0x3760a2);if(_0x545616['query'][_0xee3a('0x3f')]){_0xc0fd25[_0xee3a('0x3d')]=_[_0xee3a('0x40')](_0xc0fd25['where'],{'$or':_[_0xee3a('0x2d')](_0x3760a2,function(_0x3ad80b){if(_0x3ad80b[_0xee3a('0x31')]!==_0xee3a('0x41')){var _0x12e7cd={};_0x12e7cd[_0x3ad80b[_0xee3a('0x2b')]]={'$like':'%'+_0x545616[_0xee3a('0x34')][_0xee3a('0x3f')]+'%'};return _0x12e7cd;}})});}_0xc0fd25=_[_0xee3a('0x40')]({},_0xc0fd25,_0x545616[_0xee3a('0x42')]);var _0x406936={'where':_0xc0fd25[_0xee3a('0x3d')]};return db[_0xee3a('0x2e')][_0xee3a('0x1f')](_0x406936)['then'](function(_0x44db08){_0xc3439f[_0xee3a('0x1f')]=_0x44db08;if(_0x545616['query'][_0xee3a('0x43')]){_0xc0fd25[_0xee3a('0x44')]=[{'all':!![]}];}return db[_0xee3a('0x2e')][_0xee3a('0x45')](_0xc0fd25);})[_0xee3a('0x28')](function(_0x3041bb){_0xc3439f['rows']=_0x3041bb;return _0xc3439f;})[_0xee3a('0x28')](respondWithFilteredResult(_0x1fbcc4,_0xc0fd25))[_0xee3a('0x46')](handleError(_0x1fbcc4,null));};exports[_0xee3a('0x47')]=function(_0x594135,_0x367452){var _0x2d24e9={'raw':!![],'where':{'id':_0x594135[_0xee3a('0x48')]['id']}},_0x48c5c2={};_0x48c5c2[_0xee3a('0x33')]=_[_0xee3a('0x35')](db['SquareOdbc'][_0xee3a('0x2f')]);_0x48c5c2[_0xee3a('0x34')]=_[_0xee3a('0x35')](_0x594135[_0xee3a('0x34')]);_0x48c5c2[_0xee3a('0x36')]=_[_0xee3a('0x37')](_0x48c5c2[_0xee3a('0x33')],_0x48c5c2[_0xee3a('0x34')]);_0x2d24e9[_0xee3a('0x39')]=_[_0xee3a('0x37')](_0x48c5c2[_0xee3a('0x33')],qs['fields'](_0x594135['query'][_0xee3a('0x38')]));_0x2d24e9[_0xee3a('0x39')]=_0x2d24e9['attributes'][_0xee3a('0x49')]?_0x2d24e9['attributes']:_0x48c5c2[_0xee3a('0x33')];if(_0x594135[_0xee3a('0x34')]['includeAll']){_0x2d24e9[_0xee3a('0x44')]=[{'all':!![]}];}_0x2d24e9=_[_0xee3a('0x40')]({},_0x2d24e9,_0x594135[_0xee3a('0x42')]);return db[_0xee3a('0x2e')][_0xee3a('0x4a')](_0x2d24e9)['then'](handleEntityNotFound(_0x367452,null))[_0xee3a('0x28')](respondWithResult(_0x367452,null))[_0xee3a('0x46')](handleError(_0x367452,null));};exports[_0xee3a('0x4b')]=function(_0x450b19,_0x22ebfd){return db[_0xee3a('0x2e')][_0xee3a('0x4b')](_0x450b19[_0xee3a('0x4c')],{})[_0xee3a('0x28')](function(_0x1d061d){var _0x4f2cb7=_0x450b19[_0xee3a('0x4d')][_0xee3a('0x4e')]({'plain':!![]});if(!_0x4f2cb7)throw new Error(_0xee3a('0x4f'));if(_0x4f2cb7[_0xee3a('0x50')]===_0xee3a('0x4d')){var _0x45a3fc=_0x1d061d[_0xee3a('0x4e')]({'plain':!![]});var _0x5dd33a=_0xee3a('0x51');return db[_0xee3a('0x52')][_0xee3a('0x4a')]({'where':{'name':_0x5dd33a,'userProfileId':_0x4f2cb7['userProfileId']},'raw':!![]})[_0xee3a('0x28')](function(_0x5209e8){if(_0x5209e8&&_0x5209e8[_0xee3a('0x53')]===0x0){return db[_0xee3a('0x54')]['create']({'name':_0x45a3fc[_0xee3a('0x2b')],'resourceId':_0x45a3fc['id'],'type':_0x5209e8[_0xee3a('0x2b')],'sectionId':_0x5209e8['id']},{})[_0xee3a('0x28')](function(){return _0x1d061d;});}else{return _0x1d061d;}})[_0xee3a('0x46')](function(_0x104520){logger[_0xee3a('0x29')](_0xee3a('0x55'),_0x104520);throw _0x104520;});}return _0x1d061d;})[_0xee3a('0x28')](respondWithResult(_0x22ebfd,0xc9))[_0xee3a('0x46')](handleError(_0x22ebfd,null));};exports[_0xee3a('0x26')]=function(_0x1b6900,_0x756846){if(_0x1b6900[_0xee3a('0x4c')]['id']){delete _0x1b6900[_0xee3a('0x4c')]['id'];}return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x1b6900[_0xee3a('0x48')]['id']}})[_0xee3a('0x28')](handleEntityNotFound(_0x756846,null))[_0xee3a('0x28')](saveUpdates(_0x1b6900[_0xee3a('0x4c')],null))[_0xee3a('0x28')](respondWithResult(_0x756846,null))['catch'](handleError(_0x756846,null));};exports['destroy']=function(_0x465639,_0x12da21){return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x465639['params']['id']}})[_0xee3a('0x28')](handleEntityNotFound(_0x12da21,null))[_0xee3a('0x28')](removeEntity(_0x12da21,null))['catch'](handleError(_0x12da21,null));};exports[_0xee3a('0x56')]=function(_0x537642,_0x840b8d,_0xa67136){var _0x553806;return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x537642[_0xee3a('0x48')]['id']},'attributes':['id',_0xee3a('0x57')]})[_0xee3a('0x28')](handleEntityNotFound(_0x840b8d,null))[_0xee3a('0x28')](function(_0x577bfb){if(_0x577bfb){var _0x39036b=require(_0xee3a('0x58'))();_0x39036b[_0xee3a('0x59')](_0x577bfb['dsn']);_0x39036b['closeSync']();return _0x577bfb;}})[_0xee3a('0x28')](respondWithResult(_0x840b8d,null))[_0xee3a('0x46')](handleError(_0x840b8d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 80d1d16..c33381a 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 _0x8ae2=['util','api','bluebird','path','rimraf','../../config/environment','define','square_odbc','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ae2,0x143));var _0x28ae=function(_0xe7ded8,_0x27189e){_0xe7ded8=_0xe7ded8-0x0;var _0x312c1d=_0x8ae2[_0xe7ded8];return _0x312c1d;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var logger=require('../../config/logger')(_0x28ae('0x2'));var moment=require('moment');var BPromise=require(_0x28ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28ae('0x4'));var rimraf=require(_0x28ae('0x5'));var config=require(_0x28ae('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x442ce4,_0x1fb778){return _0x442ce4[_0x28ae('0x7')]('SquareOdbc',attributes,{'tableName':_0x28ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb251=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api','moment','bluebird'];(function(_0x1560f5,_0x52a673){var _0x2ad9d0=function(_0x3125dc){while(--_0x3125dc){_0x1560f5['push'](_0x1560f5['shift']());}};_0x2ad9d0(++_0x52a673);}(_0xb251,0x15a));var _0x1b25=function(_0x1bfc4c,_0x13383e){_0x1bfc4c=_0x1bfc4c-0x0;var _0x141d23=_0xb251[_0x1bfc4c];return _0x141d23;};'use strict';var _=require(_0x1b25('0x0'));var util=require(_0x1b25('0x1'));var logger=require('../../config/logger')(_0x1b25('0x2'));var moment=require(_0x1b25('0x3'));var BPromise=require(_0x1b25('0x4'));var rp=require(_0x1b25('0x5'));var fs=require('fs');var path=require(_0x1b25('0x6'));var rimraf=require(_0x1b25('0x7'));var config=require(_0x1b25('0x8'));var attributes=require(_0x1b25('0x9'));module[_0x1b25('0xa')]=function(_0x363b8c,_0x5bbbbf){return _0x363b8c[_0x1b25('0xb')]('SquareOdbc',attributes,{'tableName':_0x1b25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4fd2e03..feadf13 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x26462e,_0x416ff7){var _0x31c3f0=function(_0xd387ea){while(--_0xd387ea){_0x26462e['push'](_0x26462e['shift']());}};_0x31c3f0(++_0x416ff7);}(_0xe14b,0x93));var _0xbe14=function(_0x495ae1,_0xf0af00){_0x495ae1=_0x495ae1-0x0;var _0x245e58=_0xe14b[_0x495ae1];return _0x245e58;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x5b312a,_0x4dc09b){var _0x448b0b=function(_0x56e870){while(--_0x56e870){_0x5b312a['push'](_0x5b312a['shift']());}};_0x448b0b(++_0x4dc09b);}(_0x008c,0x188));var _0xc008=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x008c[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index db478e3..2f88673 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 _0xf043=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getUsers','post','/:id/users','addUsers','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x70338f,_0x28b42a){var _0x1748de=function(_0xf04f5f){while(--_0xf04f5f){_0x70338f['push'](_0x70338f['shift']());}};_0x1748de(++_0x28b42a);}(_0xf043,0x93));var _0x3f04=function(_0x378432,_0x640f2){_0x378432=_0x378432-0x0;var _0x2f98fa=_0xf043[_0x378432];return _0x2f98fa;};'use strict';var multer=require(_0x3f04('0x0'));var util=require(_0x3f04('0x1'));var path=require(_0x3f04('0x2'));var timeout=require(_0x3f04('0x3'));var express=require(_0x3f04('0x4'));var router=express[_0x3f04('0x5')]();var auth=require(_0x3f04('0x6'));var interaction=require(_0x3f04('0x7'));var config=require(_0x3f04('0x8'));var controller=require('./squareProject.controller');router[_0x3f04('0x9')]('/',auth[_0x3f04('0xa')](),controller['index']);router['get'](_0x3f04('0xb'),auth[_0x3f04('0xa')](),controller['show']);router[_0x3f04('0x9')]('/:id/users',auth[_0x3f04('0xa')](),controller[_0x3f04('0xc')]);router[_0x3f04('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f04('0xd')](_0x3f04('0xe'),auth[_0x3f04('0xa')](),controller[_0x3f04('0xf')]);router[_0x3f04('0x10')](_0x3f04('0xb'),auth[_0x3f04('0xa')](),controller['update']);router[_0x3f04('0x11')](_0x3f04('0xb'),auth['isAuthenticated'](),controller[_0x3f04('0x12')]);router['delete'](_0x3f04('0xe'),auth[_0x3f04('0xa')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x3b0b=['post','put','destroy','removeUsers','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','getUsers'];(function(_0xd2826b,_0x295fc3){var _0x5a0dc5=function(_0x4fb436){while(--_0x4fb436){_0xd2826b['push'](_0xd2826b['shift']());}};_0x5a0dc5(++_0x295fc3);}(_0x3b0b,0x194));var _0xb3b0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3b0b[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xb3b0('0x0'));var util=require(_0xb3b0('0x1'));var path=require(_0xb3b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3b0('0x3'));var router=express[_0xb3b0('0x4')]();var auth=require(_0xb3b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b0('0x6'));var controller=require(_0xb3b0('0x7'));router[_0xb3b0('0x8')]('/',auth[_0xb3b0('0x9')](),controller[_0xb3b0('0xa')]);router[_0xb3b0('0x8')](_0xb3b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb3b0('0x8')](_0xb3b0('0xc'),auth['isAuthenticated'](),controller[_0xb3b0('0xd')]);router[_0xb3b0('0xe')]('/',auth[_0xb3b0('0x9')](),controller['create']);router[_0xb3b0('0xe')](_0xb3b0('0xc'),auth[_0xb3b0('0x9')](),controller['addUsers']);router[_0xb3b0('0xf')](_0xb3b0('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb3b0('0x9')](),controller[_0xb3b0('0x10')]);router['delete'](_0xb3b0('0xc'),auth[_0xb3b0('0x9')](),controller[_0xb3b0('0x11')]);module[_0xb3b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 60a0c6e..029c414 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 _0xbc0c=['production','DATE','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xbc0c,0x98));var _0xcbc0=function(_0x545081,_0x19c0b5){_0x545081=_0x545081-0x0;var _0x388046=_0xbc0c[_0x545081];return _0x388046;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbc0('0x0')],'unique':_0xcbc0('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xcbc0('0x2')]},'preproduction':{'type':Sequelize[_0xcbc0('0x3')]('long'),'get':function(){if(this[_0xcbc0('0x4')]('preproduction')){return this[_0xcbc0('0x4')](_0xcbc0('0x5'))[_0xcbc0('0x6')](_0xcbc0('0x7'));}}},'production':{'type':Sequelize[_0xcbc0('0x3')]('long'),'get':function(){if(this['getDataValue'](_0xcbc0('0x8'))){return this['getDataValue'](_0xcbc0('0x8'))[_0xcbc0('0x6')](_0xcbc0('0x7'));}}},'savedAt':{'type':Sequelize[_0xcbc0('0x9')]},'publishedAt':{'type':Sequelize[_0xcbc0('0x9')]}}; \ No newline at end of file +var _0x8d05=['DATE','sequelize','exports','STRING','name','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x544eb6,_0x2f4757){var _0x318db2=function(_0x23002d){while(--_0x23002d){_0x544eb6['push'](_0x544eb6['shift']());}};_0x318db2(++_0x2f4757);}(_0x8d05,0xe8));var _0x58d0=function(_0x4ce03d,_0x57e13a){_0x4ce03d=_0x4ce03d-0x0;var _0xeb61be=_0x8d05[_0x4ce03d];return _0xeb61be;};'use strict';var Sequelize=require(_0x58d0('0x0'));module[_0x58d0('0x1')]={'name':{'type':Sequelize[_0x58d0('0x2')],'unique':_0x58d0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x58d0('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x58d0('0x4')),'get':function(){if(this[_0x58d0('0x5')](_0x58d0('0x6'))){return this[_0x58d0('0x5')]('preproduction')[_0x58d0('0x7')](_0x58d0('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x58d0('0x4')),'get':function(){if(this['getDataValue'](_0x58d0('0x9'))){return this[_0x58d0('0x5')](_0x58d0('0x9'))[_0x58d0('0x7')](_0x58d0('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x58d0('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 520b2de..bbfaff8 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 _0x83b6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','sort','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x13bb0b,_0x4c6d55){var _0x1ccebc=function(_0xca60e){while(--_0xca60e){_0x13bb0b['push'](_0x13bb0b['shift']());}};_0x1ccebc(++_0x4c6d55);}(_0x83b6,0x187));var _0x683b=function(_0x395688,_0x3ff6be){_0x395688=_0x395688-0x0;var _0x50533a=_0x83b6[_0x395688];return _0x50533a;};'use strict';var pdf=require(_0x683b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x683b('0x1'));var zipdir=require(_0x683b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x683b('0x3'));var moment=require(_0x683b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x683b('0x5'));var util=require('util');var path=require(_0x683b('0x6'));var sox=require(_0x683b('0x7'));var csv=require('to-csv');var ejs=require(_0x683b('0x8'));var fs=require('fs');var _=require(_0x683b('0x9'));var squel=require('squel');var crypto=require(_0x683b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x683b('0xb'));var toCsv=require(_0x683b('0xc'));var querystring=require(_0x683b('0xd'));var Papa=require(_0x683b('0xe'));var Redis=require('ioredis');var authService=require(_0x683b('0xf'));var qs=require(_0x683b('0x10'));var as=require(_0x683b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x683b('0x12'))(_0x683b('0x13'));var utils=require(_0x683b('0x14'));var config=require(_0x683b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x683b('0x16'))['db'];config[_0x683b('0x17')]=_[_0x683b('0x18')](config[_0x683b('0x17')],{'host':_0x683b('0x19'),'port':0x18eb});var socket=require(_0x683b('0x1a'))(new Redis(config[_0x683b('0x17')]));require(_0x683b('0x1b'))[_0x683b('0x1c')](socket);function respondWithStatusCode(_0x342a07,_0x4d04c9){_0x4d04c9=_0x4d04c9||0xcc;return function(_0x2ec5e5){if(_0x2ec5e5){return _0x342a07['sendStatus'](_0x4d04c9);}return _0x342a07[_0x683b('0x1d')](_0x4d04c9)[_0x683b('0x1e')]();};}function respondWithResult(_0x149ced,_0x2e09f1){_0x2e09f1=_0x2e09f1||0xc8;return function(_0x25f1b5){if(_0x25f1b5){return _0x149ced['status'](_0x2e09f1)[_0x683b('0x1f')](_0x25f1b5);}};}function respondWithFilteredResult(_0x59a34d,_0xabebc3){return function(_0x536b90){if(_0x536b90){var _0x2f9201=_0x536b90[_0x683b('0x20')],_0x5476a5=_0xabebc3[_0x683b('0x21')],_0x1f834a=_0xabebc3[_0x683b('0x21')]+_0xabebc3[_0x683b('0x22')],_0x4ddebc;if(_0x1f834a>=_0x2f9201){_0x1f834a=_0x2f9201;_0x4ddebc=0xc8;}else{_0x4ddebc=0xce;}_0x59a34d[_0x683b('0x1d')](_0x4ddebc);return _0x59a34d[_0x683b('0x23')](_0x683b('0x24'),_0x5476a5+'-'+_0x1f834a+'/'+_0x2f9201)[_0x683b('0x1f')](_0x536b90);}return null;};}function patchUpdates(_0x2bb7ba){return function(_0x33bc4d){try{jsonpatch[_0x683b('0x25')](_0x33bc4d,_0x2bb7ba,!![]);}catch(_0x3c413d){return BPromise[_0x683b('0x26')](_0x3c413d);}return _0x33bc4d[_0x683b('0x27')]();};}function saveUpdates(_0x12b057,_0x26a8f9){return function(_0x492f8d){if(_0x492f8d){return _0x492f8d[_0x683b('0x28')](_0x12b057)[_0x683b('0x29')](function(_0x3cffbf){return _0x3cffbf;});}return null;};}function removeEntity(_0x3d479a,_0x1e3882){return function(_0x14e9f7){if(_0x14e9f7){return _0x14e9f7[_0x683b('0x2a')]()['then'](function(){var _0x2b0d13=_0x14e9f7[_0x683b('0x2b')]({'plain':!![]});var _0x552b90='SquareProjects';return db[_0x683b('0x2c')][_0x683b('0x2a')]({'where':{'type':_0x552b90,'resourceId':_0x2b0d13['id']}})[_0x683b('0x29')](function(){return _0x14e9f7;});})[_0x683b('0x29')](function(){_0x3d479a[_0x683b('0x1d')](0xcc)[_0x683b('0x1e')]();});}};}function handleEntityNotFound(_0xe51221,_0x478207){return function(_0x58146f){if(!_0x58146f){_0xe51221[_0x683b('0x2d')](0x194);}return _0x58146f;};}function handleError(_0x139288,_0x467e2a){_0x467e2a=_0x467e2a||0x1f4;return function(_0x1465c7){logger['error'](_0x1465c7[_0x683b('0x2e')]);if(_0x1465c7[_0x683b('0x2f')]){delete _0x1465c7[_0x683b('0x2f')];}_0x139288[_0x683b('0x1d')](_0x467e2a)[_0x683b('0x30')](_0x1465c7);};}exports[_0x683b('0x31')]=function(_0x11d3d9,_0x358484){var _0x1e7ff1={},_0x585e66={},_0x3bc30f={'count':0x0,'rows':[]};var _0x2873a1=_[_0x683b('0x32')](db[_0x683b('0x33')][_0x683b('0x34')],function(_0x5e0045){return{'name':_0x5e0045['fieldName'],'type':_0x5e0045[_0x683b('0x35')][_0x683b('0x36')]};});_0x585e66['model']=_[_0x683b('0x32')](_0x2873a1,_0x683b('0x2f'));_0x585e66[_0x683b('0x37')]=_[_0x683b('0x38')](_0x11d3d9[_0x683b('0x37')]);_0x585e66[_0x683b('0x39')]=_['intersection'](_0x585e66['model'],_0x585e66['query']);_0x1e7ff1['attributes']=_[_0x683b('0x3a')](_0x585e66[_0x683b('0x3b')],qs[_0x683b('0x3c')](_0x11d3d9[_0x683b('0x37')][_0x683b('0x3c')]));_0x1e7ff1[_0x683b('0x3d')]=_0x1e7ff1[_0x683b('0x3d')]['length']?_0x1e7ff1[_0x683b('0x3d')]:_0x585e66[_0x683b('0x3b')];if(!_0x11d3d9[_0x683b('0x37')][_0x683b('0x3e')](_0x683b('0x3f'))){_0x1e7ff1[_0x683b('0x22')]=qs[_0x683b('0x22')](_0x11d3d9[_0x683b('0x37')]['limit']);_0x1e7ff1['offset']=qs['offset'](_0x11d3d9[_0x683b('0x37')][_0x683b('0x21')]);}_0x1e7ff1[_0x683b('0x40')]=qs['sort'](_0x11d3d9[_0x683b('0x37')]['sort']);_0x1e7ff1[_0x683b('0x41')]=qs[_0x683b('0x39')](_['pick'](_0x11d3d9[_0x683b('0x37')],_0x585e66[_0x683b('0x39')]),_0x2873a1);if(_0x11d3d9[_0x683b('0x37')][_0x683b('0x42')]){_0x1e7ff1[_0x683b('0x41')]=_[_0x683b('0x43')](_0x1e7ff1[_0x683b('0x41')],{'$or':_[_0x683b('0x32')](_0x2873a1,function(_0x415813){if(_0x415813['type']!=='VIRTUAL'){var _0x5def25={};_0x5def25[_0x415813['name']]={'$like':'%'+_0x11d3d9['query']['filter']+'%'};return _0x5def25;}})});}_0x1e7ff1=_[_0x683b('0x43')]({},_0x1e7ff1,_0x11d3d9['options']);var _0xf37cbb={'where':_0x1e7ff1[_0x683b('0x41')]};return db['SquareProject'][_0x683b('0x20')](_0xf37cbb)[_0x683b('0x29')](function(_0x4b6963){_0x3bc30f[_0x683b('0x20')]=_0x4b6963;if(_0x11d3d9['query'][_0x683b('0x44')]){_0x1e7ff1[_0x683b('0x45')]=[{'all':!![]}];}return db[_0x683b('0x33')][_0x683b('0x46')](_0x1e7ff1);})[_0x683b('0x29')](function(_0x1b403d){_0x3bc30f[_0x683b('0x47')]=_0x1b403d;return _0x3bc30f;})[_0x683b('0x29')](respondWithFilteredResult(_0x358484,_0x1e7ff1))['catch'](handleError(_0x358484,null));};exports[_0x683b('0x48')]=function(_0x2ef83d,_0x29e7f2){var _0x7c728={'raw':![],'where':{'id':_0x2ef83d[_0x683b('0x49')]['id']}},_0x5149ad={};_0x5149ad[_0x683b('0x3b')]=_['keys'](db[_0x683b('0x33')][_0x683b('0x34')]);_0x5149ad[_0x683b('0x37')]=_['keys'](_0x2ef83d[_0x683b('0x37')]);_0x5149ad[_0x683b('0x39')]=_[_0x683b('0x3a')](_0x5149ad[_0x683b('0x3b')],_0x5149ad['query']);_0x7c728[_0x683b('0x3d')]=_['intersection'](_0x5149ad[_0x683b('0x3b')],qs['fields'](_0x2ef83d['query'][_0x683b('0x3c')]));_0x7c728[_0x683b('0x3d')]=_0x7c728['attributes'][_0x683b('0x4a')]?_0x7c728[_0x683b('0x3d')]:_0x5149ad['model'];if(_0x2ef83d[_0x683b('0x37')][_0x683b('0x44')]){_0x7c728[_0x683b('0x45')]=[{'all':!![]}];}_0x7c728=_[_0x683b('0x43')]({},_0x7c728,_0x2ef83d['options']);return db['SquareProject'][_0x683b('0x4b')](_0x7c728)['then'](handleEntityNotFound(_0x29e7f2,null))[_0x683b('0x29')](respondWithResult(_0x29e7f2,null))[_0x683b('0x4c')](handleError(_0x29e7f2,null));};exports[_0x683b('0x4d')]=function(_0x35d86f,_0x172187){return db['SquareProject'][_0x683b('0x4d')](_0x35d86f['body'],{})[_0x683b('0x29')](function(_0x1a29b2){var _0x4f5806=_0x35d86f[_0x683b('0x4e')][_0x683b('0x2b')]({'plain':!![]});if(!_0x4f5806)throw new Error(_0x683b('0x4f'));if(_0x4f5806[_0x683b('0x50')]===_0x683b('0x4e')){var _0x2cd043=_0x1a29b2[_0x683b('0x2b')]({'plain':!![]});var _0x33216d='SquareProjects';return db[_0x683b('0x51')]['find']({'where':{'name':_0x33216d,'userProfileId':_0x4f5806[_0x683b('0x52')]},'raw':!![]})[_0x683b('0x29')](function(_0x295e52){if(_0x295e52&&_0x295e52[_0x683b('0x53')]===0x0){return db[_0x683b('0x2c')][_0x683b('0x4d')]({'name':_0x2cd043[_0x683b('0x2f')],'resourceId':_0x2cd043['id'],'type':_0x295e52[_0x683b('0x2f')],'sectionId':_0x295e52['id']},{})[_0x683b('0x29')](function(){return _0x1a29b2;});}else{return _0x1a29b2;}})[_0x683b('0x4c')](function(_0x37c07c){logger['error'](_0x683b('0x54'),_0x37c07c);throw _0x37c07c;});}return _0x1a29b2;})[_0x683b('0x29')](respondWithResult(_0x172187,0xc9))['catch'](handleError(_0x172187,null));};exports[_0x683b('0x28')]=function(_0x167019,_0x2055a2){if(_0x167019[_0x683b('0x55')]['id']){delete _0x167019[_0x683b('0x55')]['id'];}return db[_0x683b('0x33')][_0x683b('0x4b')]({'where':{'id':_0x167019[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x2055a2,null))[_0x683b('0x29')](saveUpdates(_0x167019[_0x683b('0x55')],null))['then'](respondWithResult(_0x2055a2,null))[_0x683b('0x4c')](handleError(_0x2055a2,null));};exports[_0x683b('0x2a')]=function(_0xbf911e,_0xdde971){return db['SquareProject'][_0x683b('0x4b')]({'where':{'id':_0xbf911e['params']['id']}})[_0x683b('0x29')](handleEntityNotFound(_0xdde971,null))[_0x683b('0x29')](removeEntity(_0xdde971,null))[_0x683b('0x4c')](handleError(_0xdde971,null));};exports[_0x683b('0x56')]=function(_0x425991,_0x3e5262,_0x42f3f4){return db[_0x683b('0x33')]['find']({'where':{'id':_0x425991[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x3e5262,null))[_0x683b('0x29')](function(_0x58d71a){if(_0x58d71a){return _0x58d71a['addUsers'](_0x425991['body'][_0x683b('0x57')],_[_0x683b('0x58')](_0x425991['body'],[_0x683b('0x57'),'id'])||{});}})['then'](respondWithResult(_0x3e5262,null))[_0x683b('0x4c')](handleError(_0x3e5262,null));};exports[_0x683b('0x59')]=function(_0x370a25,_0x199d0d,_0xb07eba){return db[_0x683b('0x33')]['find']({'where':{'id':_0x370a25['params']['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x199d0d,null))[_0x683b('0x29')](function(_0x5f356a){if(_0x5f356a){return _0x5f356a[_0x683b('0x59')](_0x370a25[_0x683b('0x37')]['ids'])[_0x683b('0x29')](function(){if(_['isArray'](_0x370a25[_0x683b('0x37')][_0x683b('0x57')])){for(var _0x4afd57=0x0;_0x4afd57<_0x370a25[_0x683b('0x37')][_0x683b('0x57')][_0x683b('0x4a')];_0x4afd57+=0x1){socket[_0x683b('0x5a')](_0x683b('0x5b'),{'UserId':Number(_0x370a25[_0x683b('0x37')]['ids'][_0x4afd57]),'SquareProjectId':Number(_0x370a25[_0x683b('0x49')]['id'])});}}else{socket[_0x683b('0x5a')](_0x683b('0x5b'),{'UserId':Number(_0x370a25[_0x683b('0x37')][_0x683b('0x57')]),'SquareProjectId':Number(_0x370a25[_0x683b('0x49')]['id'])});}});}})[_0x683b('0x29')](respondWithStatusCode(_0x199d0d,null))[_0x683b('0x4c')](handleError(_0x199d0d,null));};exports[_0x683b('0x5c')]=function(_0xdc3ddf,_0x2f0d94,_0x2558c4){var _0xf65ad={};var _0x5861c0={};var _0x5f3329;var _0x2d8371;return db['SquareProject'][_0x683b('0x5d')]({'where':{'id':_0xdc3ddf[_0x683b('0x49')]['id']}})[_0x683b('0x29')](handleEntityNotFound(_0x2f0d94,null))[_0x683b('0x29')](function(_0x3b392a){if(_0x3b392a){_0x5f3329=_0x3b392a;_0x5861c0[_0x683b('0x3b')]=_[_0x683b('0x38')](db['User'][_0x683b('0x34')]);_0x5861c0[_0x683b('0x37')]=_[_0x683b('0x38')](_0xdc3ddf[_0x683b('0x37')]);_0x5861c0[_0x683b('0x39')]=_[_0x683b('0x3a')](_0x5861c0[_0x683b('0x3b')],_0x5861c0['query']);_0xf65ad['attributes']=_[_0x683b('0x3a')](_0x5861c0['model'],qs['fields'](_0xdc3ddf[_0x683b('0x37')]['fields']));_0xf65ad[_0x683b('0x3d')]=_0xf65ad[_0x683b('0x3d')][_0x683b('0x4a')]?_0xf65ad[_0x683b('0x3d')]:_0x5861c0[_0x683b('0x3b')];_0xf65ad[_0x683b('0x40')]=qs[_0x683b('0x5e')](_0xdc3ddf['query'][_0x683b('0x5e')]);_0xf65ad['where']=qs[_0x683b('0x39')](_['pick'](_0xdc3ddf[_0x683b('0x37')],_0x5861c0['filters']));if(_0xdc3ddf['query']['filter']){_0xf65ad[_0x683b('0x41')]=_['merge'](_0xf65ad[_0x683b('0x41')],{'$or':_['map'](_0xf65ad[_0x683b('0x3d')],function(_0x6555ad){var _0x354d67={};_0x354d67[_0x6555ad]={'$like':'%'+_0xdc3ddf['query'][_0x683b('0x42')]+'%'};return _0x354d67;})});}_0xf65ad=_[_0x683b('0x43')]({},_0xf65ad,_0xdc3ddf['options']);return _0x5f3329['getUsers'](_0xf65ad);}})[_0x683b('0x29')](function(_0x1cf2fe){if(_0x1cf2fe){_0x2d8371=_0x1cf2fe[_0x683b('0x4a')];if(!_0xdc3ddf['query']['hasOwnProperty'](_0x683b('0x3f'))){_0xf65ad[_0x683b('0x22')]=qs[_0x683b('0x22')](_0xdc3ddf[_0x683b('0x37')][_0x683b('0x22')]);_0xf65ad[_0x683b('0x21')]=qs[_0x683b('0x21')](_0xdc3ddf['query'][_0x683b('0x21')]);}return _0x5f3329['getUsers'](_0xf65ad);}})[_0x683b('0x29')](function(_0x638000){if(_0x638000){return _0x638000?{'count':_0x2d8371,'rows':_0x638000}:null;}})[_0x683b('0x29')](respondWithResult(_0x2f0d94,null))[_0x683b('0x4c')](handleError(_0x2f0d94,null));}; \ No newline at end of file +var _0xf503=['pick','filter','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','SquareProjects','UserProfileResource','end','error','send','index','SquareProject','rawAttributes','fieldName','type','key','map','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3d27fd,_0x5eb681){var _0x4fcc8c=function(_0x2ce57b){while(--_0x2ce57b){_0x3d27fd['push'](_0x3d27fd['shift']());}};_0x4fcc8c(++_0x5eb681);}(_0xf503,0x1a4));var _0x3f50=function(_0x422469,_0x180fc5){_0x422469=_0x422469-0x0;var _0x39eab6=_0xf503[_0x422469];return _0x39eab6;};'use strict';var pdf=require(_0x3f50('0x0'));var emlformat=require(_0x3f50('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f50('0x2'));var jsonpatch=require(_0x3f50('0x3'));var rp=require(_0x3f50('0x4'));var moment=require(_0x3f50('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f50('0x6'));var path=require(_0x3f50('0x7'));var sox=require(_0x3f50('0x8'));var csv=require(_0x3f50('0x9'));var ejs=require(_0x3f50('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f50('0xb'));var crypto=require(_0x3f50('0xc'));var jsforce=require(_0x3f50('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f50('0xe'));var Papa=require(_0x3f50('0xf'));var Redis=require('ioredis');var authService=require(_0x3f50('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f50('0x11'));var logger=require(_0x3f50('0x12'))(_0x3f50('0x13'));var utils=require(_0x3f50('0x14'));var config=require(_0x3f50('0x15'));var licenseUtil=require(_0x3f50('0x16'));var db=require(_0x3f50('0x17'))['db'];config[_0x3f50('0x18')]=_['defaults'](config['redis'],{'host':_0x3f50('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f50('0x18')]));require('./squareProject.socket')[_0x3f50('0x1a')](socket);function respondWithStatusCode(_0x5a7e5f,_0x122b58){_0x122b58=_0x122b58||0xcc;return function(_0x521e06){if(_0x521e06){return _0x5a7e5f[_0x3f50('0x1b')](_0x122b58);}return _0x5a7e5f[_0x3f50('0x1c')](_0x122b58)['end']();};}function respondWithResult(_0x348dbb,_0x581aa1){_0x581aa1=_0x581aa1||0xc8;return function(_0xaa4f8c){if(_0xaa4f8c){return _0x348dbb[_0x3f50('0x1c')](_0x581aa1)['json'](_0xaa4f8c);}};}function respondWithFilteredResult(_0x5e5f77,_0x3a8e61){return function(_0x1aef85){if(_0x1aef85){var _0x404009=_0x1aef85[_0x3f50('0x1d')],_0x153188=_0x3a8e61[_0x3f50('0x1e')],_0x27dab2=_0x3a8e61[_0x3f50('0x1e')]+_0x3a8e61[_0x3f50('0x1f')],_0x5eb2dc;if(_0x27dab2>=_0x404009){_0x27dab2=_0x404009;_0x5eb2dc=0xc8;}else{_0x5eb2dc=0xce;}_0x5e5f77[_0x3f50('0x1c')](_0x5eb2dc);return _0x5e5f77['set'](_0x3f50('0x20'),_0x153188+'-'+_0x27dab2+'/'+_0x404009)[_0x3f50('0x21')](_0x1aef85);}return null;};}function patchUpdates(_0x22e6b7){return function(_0x4649e7){try{jsonpatch[_0x3f50('0x22')](_0x4649e7,_0x22e6b7,!![]);}catch(_0x49de99){return BPromise[_0x3f50('0x23')](_0x49de99);}return _0x4649e7[_0x3f50('0x24')]();};}function saveUpdates(_0x1b204e,_0x13bf02){return function(_0x14b5bb){if(_0x14b5bb){return _0x14b5bb['update'](_0x1b204e)[_0x3f50('0x25')](function(_0x257c3d){return _0x257c3d;});}return null;};}function removeEntity(_0x38564d,_0x5ccbe1){return function(_0x28dd16){if(_0x28dd16){return _0x28dd16[_0x3f50('0x26')]()[_0x3f50('0x25')](function(){var _0x3ffb63=_0x28dd16['get']({'plain':!![]});var _0x401710=_0x3f50('0x27');return db[_0x3f50('0x28')][_0x3f50('0x26')]({'where':{'type':_0x401710,'resourceId':_0x3ffb63['id']}})[_0x3f50('0x25')](function(){return _0x28dd16;});})[_0x3f50('0x25')](function(){_0x38564d[_0x3f50('0x1c')](0xcc)[_0x3f50('0x29')]();});}};}function handleEntityNotFound(_0x5ca5cc,_0x33261e){return function(_0xc2601f){if(!_0xc2601f){_0x5ca5cc[_0x3f50('0x1b')](0x194);}return _0xc2601f;};}function handleError(_0x288b7d,_0x3e113a){_0x3e113a=_0x3e113a||0x1f4;return function(_0x44794d){logger[_0x3f50('0x2a')](_0x44794d['stack']);if(_0x44794d['name']){delete _0x44794d['name'];}_0x288b7d[_0x3f50('0x1c')](_0x3e113a)[_0x3f50('0x2b')](_0x44794d);};}exports[_0x3f50('0x2c')]=function(_0x3d68e6,_0x19690d){var _0x314af9={},_0x1d334e={},_0x487843={'count':0x0,'rows':[]};var _0x151ba9=_['map'](db[_0x3f50('0x2d')][_0x3f50('0x2e')],function(_0x52ec85){return{'name':_0x52ec85[_0x3f50('0x2f')],'type':_0x52ec85[_0x3f50('0x30')][_0x3f50('0x31')]};});_0x1d334e['model']=_[_0x3f50('0x32')](_0x151ba9,_0x3f50('0x33'));_0x1d334e['query']=_[_0x3f50('0x34')](_0x3d68e6[_0x3f50('0x35')]);_0x1d334e['filters']=_[_0x3f50('0x36')](_0x1d334e[_0x3f50('0x37')],_0x1d334e[_0x3f50('0x35')]);_0x314af9[_0x3f50('0x38')]=_['intersection'](_0x1d334e[_0x3f50('0x37')],qs[_0x3f50('0x39')](_0x3d68e6[_0x3f50('0x35')]['fields']));_0x314af9['attributes']=_0x314af9[_0x3f50('0x38')][_0x3f50('0x3a')]?_0x314af9[_0x3f50('0x38')]:_0x1d334e[_0x3f50('0x37')];if(!_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x3b')](_0x3f50('0x3c'))){_0x314af9[_0x3f50('0x1f')]=qs[_0x3f50('0x1f')](_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x1f')]);_0x314af9[_0x3f50('0x1e')]=qs[_0x3f50('0x1e')](_0x3d68e6['query'][_0x3f50('0x1e')]);}_0x314af9[_0x3f50('0x3d')]=qs['sort'](_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x3e')]);_0x314af9[_0x3f50('0x3f')]=qs[_0x3f50('0x40')](_[_0x3f50('0x41')](_0x3d68e6[_0x3f50('0x35')],_0x1d334e[_0x3f50('0x40')]),_0x151ba9);if(_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x42')]){_0x314af9[_0x3f50('0x3f')]=_[_0x3f50('0x43')](_0x314af9[_0x3f50('0x3f')],{'$or':_[_0x3f50('0x32')](_0x151ba9,function(_0x31a54f){if(_0x31a54f[_0x3f50('0x30')]!=='VIRTUAL'){var _0x528dbd={};_0x528dbd[_0x31a54f[_0x3f50('0x33')]]={'$like':'%'+_0x3d68e6[_0x3f50('0x35')]['filter']+'%'};return _0x528dbd;}})});}_0x314af9=_['merge']({},_0x314af9,_0x3d68e6['options']);var _0x753601={'where':_0x314af9[_0x3f50('0x3f')]};return db[_0x3f50('0x2d')][_0x3f50('0x1d')](_0x753601)[_0x3f50('0x25')](function(_0x34dc28){_0x487843[_0x3f50('0x1d')]=_0x34dc28;if(_0x3d68e6[_0x3f50('0x35')]['includeAll']){_0x314af9['include']=[{'all':!![]}];}return db['SquareProject'][_0x3f50('0x44')](_0x314af9);})[_0x3f50('0x25')](function(_0x390b20){_0x487843[_0x3f50('0x45')]=_0x390b20;return _0x487843;})['then'](respondWithFilteredResult(_0x19690d,_0x314af9))[_0x3f50('0x46')](handleError(_0x19690d,null));};exports[_0x3f50('0x47')]=function(_0xe5f0be,_0x4f1425){var _0x2b9025={'raw':![],'where':{'id':_0xe5f0be[_0x3f50('0x48')]['id']}},_0x410f9d={};_0x410f9d['model']=_[_0x3f50('0x34')](db[_0x3f50('0x2d')][_0x3f50('0x2e')]);_0x410f9d[_0x3f50('0x35')]=_[_0x3f50('0x34')](_0xe5f0be[_0x3f50('0x35')]);_0x410f9d[_0x3f50('0x40')]=_['intersection'](_0x410f9d[_0x3f50('0x37')],_0x410f9d[_0x3f50('0x35')]);_0x2b9025['attributes']=_[_0x3f50('0x36')](_0x410f9d['model'],qs[_0x3f50('0x39')](_0xe5f0be[_0x3f50('0x35')][_0x3f50('0x39')]));_0x2b9025[_0x3f50('0x38')]=_0x2b9025[_0x3f50('0x38')][_0x3f50('0x3a')]?_0x2b9025[_0x3f50('0x38')]:_0x410f9d[_0x3f50('0x37')];if(_0xe5f0be[_0x3f50('0x35')][_0x3f50('0x49')]){_0x2b9025[_0x3f50('0x4a')]=[{'all':!![]}];}_0x2b9025=_[_0x3f50('0x43')]({},_0x2b9025,_0xe5f0be[_0x3f50('0x4b')]);return db['SquareProject'][_0x3f50('0x4c')](_0x2b9025)['then'](handleEntityNotFound(_0x4f1425,null))['then'](respondWithResult(_0x4f1425,null))[_0x3f50('0x46')](handleError(_0x4f1425,null));};exports['create']=function(_0x34aa7f,_0x964900){return db[_0x3f50('0x2d')][_0x3f50('0x4d')](_0x34aa7f[_0x3f50('0x4e')],{})['then'](function(_0x33df6a){var _0x315a14=_0x34aa7f[_0x3f50('0x4f')][_0x3f50('0x50')]({'plain':!![]});if(!_0x315a14)throw new Error(_0x3f50('0x51'));if(_0x315a14[_0x3f50('0x52')]==='user'){var _0x4bbf89=_0x33df6a[_0x3f50('0x50')]({'plain':!![]});var _0x354d65=_0x3f50('0x27');return db[_0x3f50('0x53')]['find']({'where':{'name':_0x354d65,'userProfileId':_0x315a14[_0x3f50('0x54')]},'raw':!![]})['then'](function(_0x3c2f2d){if(_0x3c2f2d&&_0x3c2f2d[_0x3f50('0x55')]===0x0){return db[_0x3f50('0x28')][_0x3f50('0x4d')]({'name':_0x4bbf89[_0x3f50('0x33')],'resourceId':_0x4bbf89['id'],'type':_0x3c2f2d[_0x3f50('0x33')],'sectionId':_0x3c2f2d['id']},{})['then'](function(){return _0x33df6a;});}else{return _0x33df6a;}})[_0x3f50('0x46')](function(_0x394433){logger[_0x3f50('0x2a')](_0x3f50('0x56'),_0x394433);throw _0x394433;});}return _0x33df6a;})[_0x3f50('0x25')](respondWithResult(_0x964900,0xc9))[_0x3f50('0x46')](handleError(_0x964900,null));};exports['update']=function(_0x28416e,_0xdb0f0c){if(_0x28416e['body']['id']){delete _0x28416e[_0x3f50('0x4e')]['id'];}return db[_0x3f50('0x2d')][_0x3f50('0x4c')]({'where':{'id':_0x28416e[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0xdb0f0c,null))[_0x3f50('0x25')](saveUpdates(_0x28416e[_0x3f50('0x4e')],null))[_0x3f50('0x25')](respondWithResult(_0xdb0f0c,null))[_0x3f50('0x46')](handleError(_0xdb0f0c,null));};exports[_0x3f50('0x26')]=function(_0x11056a,_0x3925b2){return db[_0x3f50('0x2d')]['find']({'where':{'id':_0x11056a[_0x3f50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3925b2,null))[_0x3f50('0x25')](removeEntity(_0x3925b2,null))[_0x3f50('0x46')](handleError(_0x3925b2,null));};exports[_0x3f50('0x57')]=function(_0x2731d5,_0x20e046,_0x55cdb9){return db[_0x3f50('0x2d')][_0x3f50('0x4c')]({'where':{'id':_0x2731d5[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0x20e046,null))[_0x3f50('0x25')](function(_0xab8079){if(_0xab8079){return _0xab8079['addUsers'](_0x2731d5[_0x3f50('0x4e')]['ids'],_[_0x3f50('0x58')](_0x2731d5[_0x3f50('0x4e')],[_0x3f50('0x59'),'id'])||{});}})[_0x3f50('0x25')](respondWithResult(_0x20e046,null))[_0x3f50('0x46')](handleError(_0x20e046,null));};exports[_0x3f50('0x5a')]=function(_0x30418a,_0x3eef48,_0x56a34c){return db[_0x3f50('0x2d')]['find']({'where':{'id':_0x30418a[_0x3f50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3eef48,null))[_0x3f50('0x25')](function(_0x3a0dc2){if(_0x3a0dc2){return _0x3a0dc2['removeUsers'](_0x30418a[_0x3f50('0x35')]['ids'])[_0x3f50('0x25')](function(){if(_[_0x3f50('0x5b')](_0x30418a[_0x3f50('0x35')][_0x3f50('0x59')])){for(var _0x2d3ebf=0x0;_0x2d3ebf<_0x30418a[_0x3f50('0x35')]['ids'][_0x3f50('0x3a')];_0x2d3ebf+=0x1){socket['emit'](_0x3f50('0x5c'),{'UserId':Number(_0x30418a[_0x3f50('0x35')]['ids'][_0x2d3ebf]),'SquareProjectId':Number(_0x30418a['params']['id'])});}}else{socket[_0x3f50('0x5d')](_0x3f50('0x5c'),{'UserId':Number(_0x30418a[_0x3f50('0x35')][_0x3f50('0x59')]),'SquareProjectId':Number(_0x30418a['params']['id'])});}});}})[_0x3f50('0x25')](respondWithStatusCode(_0x3eef48,null))[_0x3f50('0x46')](handleError(_0x3eef48,null));};exports[_0x3f50('0x5e')]=function(_0x597ebd,_0x90f334,_0x130e72){var _0x5e1a40={};var _0x8fc8ca={};var _0x2f9689;var _0x17649c;return db[_0x3f50('0x2d')][_0x3f50('0x5f')]({'where':{'id':_0x597ebd[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0x90f334,null))[_0x3f50('0x25')](function(_0x1069c9){if(_0x1069c9){_0x2f9689=_0x1069c9;_0x8fc8ca[_0x3f50('0x37')]=_[_0x3f50('0x34')](db[_0x3f50('0x60')][_0x3f50('0x2e')]);_0x8fc8ca[_0x3f50('0x35')]=_[_0x3f50('0x34')](_0x597ebd[_0x3f50('0x35')]);_0x8fc8ca[_0x3f50('0x40')]=_[_0x3f50('0x36')](_0x8fc8ca['model'],_0x8fc8ca[_0x3f50('0x35')]);_0x5e1a40[_0x3f50('0x38')]=_['intersection'](_0x8fc8ca['model'],qs[_0x3f50('0x39')](_0x597ebd['query'][_0x3f50('0x39')]));_0x5e1a40['attributes']=_0x5e1a40[_0x3f50('0x38')]['length']?_0x5e1a40[_0x3f50('0x38')]:_0x8fc8ca[_0x3f50('0x37')];_0x5e1a40[_0x3f50('0x3d')]=qs[_0x3f50('0x3e')](_0x597ebd['query'][_0x3f50('0x3e')]);_0x5e1a40['where']=qs[_0x3f50('0x40')](_[_0x3f50('0x41')](_0x597ebd[_0x3f50('0x35')],_0x8fc8ca[_0x3f50('0x40')]));if(_0x597ebd[_0x3f50('0x35')][_0x3f50('0x42')]){_0x5e1a40[_0x3f50('0x3f')]=_['merge'](_0x5e1a40[_0x3f50('0x3f')],{'$or':_['map'](_0x5e1a40[_0x3f50('0x38')],function(_0x2e6a01){var _0x38e890={};_0x38e890[_0x2e6a01]={'$like':'%'+_0x597ebd['query'][_0x3f50('0x42')]+'%'};return _0x38e890;})});}_0x5e1a40=_[_0x3f50('0x43')]({},_0x5e1a40,_0x597ebd[_0x3f50('0x4b')]);return _0x2f9689[_0x3f50('0x5e')](_0x5e1a40);}})[_0x3f50('0x25')](function(_0x3f5764){if(_0x3f5764){_0x17649c=_0x3f5764[_0x3f50('0x3a')];if(!_0x597ebd[_0x3f50('0x35')][_0x3f50('0x3b')](_0x3f50('0x3c'))){_0x5e1a40['limit']=qs['limit'](_0x597ebd[_0x3f50('0x35')]['limit']);_0x5e1a40[_0x3f50('0x1e')]=qs[_0x3f50('0x1e')](_0x597ebd[_0x3f50('0x35')][_0x3f50('0x1e')]);}return _0x2f9689[_0x3f50('0x5e')](_0x5e1a40);}})[_0x3f50('0x25')](function(_0x513aad){if(_0x513aad){return _0x513aad?{'count':_0x17649c,'rows':_0x513aad}:null;}})[_0x3f50('0x25')](respondWithResult(_0x90f334,null))[_0x3f50('0x46')](handleError(_0x90f334,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f259f18..7f46a15 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 _0xbfb8=['../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0xbfb8,0x194));var _0x8bfb=function(_0x5d7b9c,_0x160f4d){_0x5d7b9c=_0x5d7b9c-0x0;var _0x443cc7=_0xbfb8[_0x5d7b9c];return _0x443cc7;};'use strict';var EventEmitter=require(_0x8bfb('0x0'));var SquareProject=require(_0x8bfb('0x1'))['db'][_0x8bfb('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8bfb('0x3')](0x0);var events={'afterCreate':_0x8bfb('0x4'),'afterUpdate':_0x8bfb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x14da9c){return function(_0x41c5d1,_0x5b3558,_0x4a7426){SquareProjectEvents[_0x8bfb('0x6')](_0x14da9c+':'+_0x41c5d1['id'],_0x41c5d1);SquareProjectEvents['emit'](_0x14da9c,_0x41c5d1);_0x4a7426(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8bfb('0x7')](e,emitEvent(event));}}module[_0x8bfb('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xe349=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0xa9eac1,_0x39a4f7){var _0x282f35=function(_0x30dbd4){while(--_0x30dbd4){_0xa9eac1['push'](_0xa9eac1['shift']());}};_0x282f35(++_0x39a4f7);}(_0xe349,0x107));var _0x9e34=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0xe349[_0x1faaa1];return _0x994ec;};'use strict';var EventEmitter=require(_0x9e34('0x0'));var SquareProject=require(_0x9e34('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9e34('0x2')](0x0);var events={'afterCreate':_0x9e34('0x3'),'afterUpdate':_0x9e34('0x4'),'afterDestroy':'remove'};function emitEvent(_0x92037e){return function(_0x14f1ef,_0x1915b4,_0x214c05){SquareProjectEvents['emit'](_0x92037e+':'+_0x14f1ef['id'],_0x14f1ef);SquareProjectEvents[_0x9e34('0x5')](_0x92037e,_0x14f1ef);_0x214c05(null);};}for(var e in events){if(events[_0x9e34('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x9e34('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 98de01f..14a5f88 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 _0x2356=['request-promise','../../config/environment','define','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird'];(function(_0x1b9607,_0x5d799a){var _0x170046=function(_0x1a9ccc){while(--_0x1a9ccc){_0x1b9607['push'](_0x1b9607['shift']());}};_0x170046(++_0x5d799a);}(_0x2356,0x14f));var _0x6235=function(_0x1e3be7,_0x35c632){_0x1e3be7=_0x1e3be7-0x0;var _0x5b4a55=_0x2356[_0x1e3be7];return _0x5b4a55;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var logger=require(_0x6235('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6235('0x2'));var rp=require(_0x6235('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6235('0x4'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x390c55,_0x17e08f){return _0x390c55[_0x6235('0x5')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x547159,_0x3a5750,_0x5a8e7c){if(_0x547159[_0x6235('0x6')](_0x6235('0x7'))){_0x547159[_0x6235('0x8')]=moment()[_0x6235('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x547159[_0x6235('0x6')](_0x6235('0xa'))){_0x547159[_0x6235('0xb')]=moment()[_0x6235('0x9')](_0x6235('0xc'));}_0x5a8e7c(null,_0x547159);}}});}; \ No newline at end of file +var _0x3fec=['square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','api','moment','request-promise','../../config/environment','exports','define','SquareProject'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3fe('0x1'));var moment=require(_0xc3fe('0x2'));var BPromise=require('bluebird');var rp=require(_0xc3fe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3fe('0x4'));var attributes=require('./squareProject.attributes');module[_0xc3fe('0x5')]=function(_0x327d2f,_0x22dd19){return _0x327d2f[_0xc3fe('0x6')](_0xc3fe('0x7'),attributes,{'tableName':_0xc3fe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e532e,_0x849ec7,_0x25b1eb){if(_0x1e532e[_0xc3fe('0x9')](_0xc3fe('0xa'))){_0x1e532e[_0xc3fe('0xb')]=moment()[_0xc3fe('0xc')](_0xc3fe('0xd'));}if(_0x1e532e[_0xc3fe('0x9')](_0xc3fe('0xe'))){_0x1e532e['publishedAt']=moment()[_0xc3fe('0xc')](_0xc3fe('0xd'));}_0x25b1eb(null,_0x1e532e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2466dec..39161a6 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 _0x0886=['message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x0886,0x1ed));var _0x6088=function(_0x269a32,_0x2774ae){_0x269a32=_0x269a32-0x0;var _0x36dc48=_0x0886[_0x269a32];return _0x36dc48;};'use strict';var _=require(_0x6088('0x0'));var util=require('util');var moment=require(_0x6088('0x1'));var BPromise=require(_0x6088('0x2'));var rs=require(_0x6088('0x3'));var fs=require('fs');var Redis=require(_0x6088('0x4'));var db=require(_0x6088('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6088('0x6'))('rpc');var config=require(_0x6088('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6088('0x8')][_0x6088('0x9')]({'port':0x232a});config[_0x6088('0xa')]=_[_0x6088('0xb')](config[_0x6088('0xa')],{'host':_0x6088('0xc'),'port':0x18eb});var socket=require(_0x6088('0xd'))(new Redis(config['redis']));require(_0x6088('0xe'))[_0x6088('0xf')](socket);function respondWithRpcPromise(_0x4f6be2,_0x15ee4d,_0x2c36f){return new BPromise(function(_0xd3a856,_0x51d6c3){return client[_0x6088('0x10')](_0x4f6be2,_0x2c36f)[_0x6088('0x11')](function(_0x2431ee){logger[_0x6088('0x12')](_0x6088('0x13'),_0x15ee4d,_0x6088('0x14'));logger[_0x6088('0x15')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x15ee4d,_0x6088('0x14'),JSON[_0x6088('0x16')](_0x2431ee));if(_0x2431ee['error']){if(_0x2431ee['error'][_0x6088('0x17')]===0x1f4){logger[_0x6088('0x18')](_0x6088('0x13'),_0x15ee4d,_0x2431ee[_0x6088('0x18')]['message']);return _0x51d6c3(_0x2431ee['error'][_0x6088('0x19')]);}logger['error'](_0x6088('0x13'),_0x15ee4d,_0x2431ee[_0x6088('0x18')][_0x6088('0x19')]);return _0xd3a856(_0x2431ee['error'][_0x6088('0x19')]);}else{logger[_0x6088('0x12')]('SquareProject,\x20%s,\x20%s',_0x15ee4d,_0x6088('0x14'));_0xd3a856(_0x2431ee['result']['message']);}})[_0x6088('0x1a')](function(_0x5bc5a5){logger['error'](_0x6088('0x13'),_0x15ee4d,_0x5bc5a5);_0x51d6c3(_0x5bc5a5);});});}exports[_0x6088('0x1b')]=function(_0x4777a7){var _0x2bfbb1=this;return new Promise(function(_0x3af70e,_0x9a4a5){return db[_0x6088('0x1c')][_0x6088('0x1d')]({'raw':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x1f')]===undefined?!![]:![]:!![],'where':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x20')]||null:null,'attributes':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x21')]||null:null,'include':_0x4777a7[_0x6088('0x1e')]?_0x4777a7[_0x6088('0x1e')][_0x6088('0x22')]?_[_0x6088('0x23')](_0x4777a7[_0x6088('0x1e')][_0x6088('0x22')],function(_0x8c5b8d){return{'model':db[_0x8c5b8d[_0x6088('0x24')]],'as':_0x8c5b8d['as'],'attributes':_0x8c5b8d[_0x6088('0x21')],'include':_0x8c5b8d[_0x6088('0x22')]?_[_0x6088('0x23')](_0x8c5b8d[_0x6088('0x22')],function(_0x220c56){return{'model':db[_0x220c56['model']],'as':_0x220c56['as'],'attributes':_0x220c56[_0x6088('0x21')],'include':_0x220c56[_0x6088('0x22')]?_[_0x6088('0x23')](_0x220c56[_0x6088('0x22')],function(_0x215e63){return{'model':db[_0x215e63[_0x6088('0x24')]],'as':_0x215e63['as'],'attributes':_0x215e63[_0x6088('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca462){logger[_0x6088('0x12')]('ShowSquareProject',_0x4777a7);logger['debug'](_0x6088('0x1b'),_0x4777a7,JSON['stringify'](_0x1ca462));_0x3af70e(_0x1ca462);})[_0x6088('0x1a')](function(_0x3ab857){logger[_0x6088('0x18')](_0x6088('0x1b'),_0x3ab857[_0x6088('0x19')],_0x4777a7);_0x9a4a5(_0x2bfbb1[_0x6088('0x18')](0x1f4,_0x3ab857[_0x6088('0x19')]));});});}; \ No newline at end of file +var _0xfe9a=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xdb2714,_0x5420d8){var _0x4842dc=function(_0x1eca66){while(--_0x1eca66){_0xdb2714['push'](_0xdb2714['shift']());}};_0x4842dc(++_0x5420d8);}(_0xfe9a,0xb1));var _0xafe9=function(_0x3a27de,_0x5b3849){_0x3a27de=_0x3a27de-0x0;var _0x134c04=_0xfe9a[_0x3a27de];return _0x134c04;};'use strict';var _=require(_0xafe9('0x0'));var util=require('util');var moment=require(_0xafe9('0x1'));var BPromise=require('bluebird');var rs=require(_0xafe9('0x2'));var fs=require('fs');var Redis=require(_0xafe9('0x3'));var db=require(_0xafe9('0x4'))['db'];var utils=require(_0xafe9('0x5'));var logger=require('../../config/logger')(_0xafe9('0x6'));var config=require(_0xafe9('0x7'));var jayson=require(_0xafe9('0x8'));var client=jayson[_0xafe9('0x9')][_0xafe9('0xa')]({'port':0x232a});config[_0xafe9('0xb')]=_[_0xafe9('0xc')](config['redis'],{'host':_0xafe9('0xd'),'port':0x18eb});var socket=require(_0xafe9('0xe'))(new Redis(config['redis']));require(_0xafe9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c39f4,_0x3ffbf8,_0x4c91e3){return new BPromise(function(_0x2fb84a,_0x485857){return client[_0xafe9('0x10')](_0x2c39f4,_0x4c91e3)[_0xafe9('0x11')](function(_0x592575){logger[_0xafe9('0x12')](_0xafe9('0x13'),_0x3ffbf8,'request\x20sent');logger[_0xafe9('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3ffbf8,_0xafe9('0x15'),JSON[_0xafe9('0x16')](_0x592575));if(_0x592575[_0xafe9('0x17')]){if(_0x592575['error'][_0xafe9('0x18')]===0x1f4){logger['error'](_0xafe9('0x13'),_0x3ffbf8,_0x592575[_0xafe9('0x17')]['message']);return _0x485857(_0x592575[_0xafe9('0x17')][_0xafe9('0x19')]);}logger[_0xafe9('0x17')]('SquareProject,\x20%s,\x20%s',_0x3ffbf8,_0x592575[_0xafe9('0x17')]['message']);return _0x2fb84a(_0x592575[_0xafe9('0x17')][_0xafe9('0x19')]);}else{logger[_0xafe9('0x12')](_0xafe9('0x13'),_0x3ffbf8,_0xafe9('0x15'));_0x2fb84a(_0x592575[_0xafe9('0x1a')]['message']);}})['catch'](function(_0x29a493){logger[_0xafe9('0x17')]('SquareProject,\x20%s,\x20%s',_0x3ffbf8,_0x29a493);_0x485857(_0x29a493);});});}exports[_0xafe9('0x1b')]=function(_0x23a8c8){var _0x57e385=this;return new Promise(function(_0x23d0f2,_0x43f416){return db[_0xafe9('0x1c')][_0xafe9('0x1d')]({'raw':_0x23a8c8['options']?_0x23a8c8[_0xafe9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x23a8c8['options']?_0x23a8c8[_0xafe9('0x1e')][_0xafe9('0x1f')]||null:null,'attributes':_0x23a8c8[_0xafe9('0x1e')]?_0x23a8c8[_0xafe9('0x1e')][_0xafe9('0x20')]||null:null,'include':_0x23a8c8[_0xafe9('0x1e')]?_0x23a8c8['options'][_0xafe9('0x21')]?_[_0xafe9('0x22')](_0x23a8c8['options'][_0xafe9('0x21')],function(_0xf9df31){return{'model':db[_0xf9df31['model']],'as':_0xf9df31['as'],'attributes':_0xf9df31[_0xafe9('0x20')],'include':_0xf9df31[_0xafe9('0x21')]?_[_0xafe9('0x22')](_0xf9df31['include'],function(_0x15ca76){return{'model':db[_0x15ca76[_0xafe9('0x23')]],'as':_0x15ca76['as'],'attributes':_0x15ca76['attributes'],'include':_0x15ca76[_0xafe9('0x21')]?_[_0xafe9('0x22')](_0x15ca76[_0xafe9('0x21')],function(_0x45dd0a){return{'model':db[_0x45dd0a[_0xafe9('0x23')]],'as':_0x45dd0a['as'],'attributes':_0x45dd0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xafe9('0x11')](function(_0x354db6){logger[_0xafe9('0x12')](_0xafe9('0x1b'),_0x23a8c8);logger[_0xafe9('0x14')](_0xafe9('0x1b'),_0x23a8c8,JSON['stringify'](_0x354db6));_0x23d0f2(_0x354db6);})[_0xafe9('0x24')](function(_0x4766f0){logger[_0xafe9('0x17')](_0xafe9('0x1b'),_0x4766f0[_0xafe9('0x19')],_0x23a8c8);_0x43f416(_0x57e385[_0xafe9('0x17')](0x1f4,_0x4766f0[_0xafe9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 02d6e1e..720c209 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 _0x687b=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x687b,0x14a));var _0xb687=function(_0x371b25,_0x224870){_0x371b25=_0x371b25-0x0;var _0x5588e8=_0x687b[_0x371b25];return _0x5588e8;};'use strict';var SquareProjectEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){SquareProjectEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);SquareProjectEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file +var _0x1883=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x197b97,_0x9a1b0){var _0x169f4e=function(_0x594b63){while(--_0x594b63){_0x197b97['push'](_0x197b97['shift']());}};_0x169f4e(++_0x9a1b0);}(_0x1883,0xab));var _0x3188=function(_0x19a3df,_0x464053){_0x19a3df=_0x19a3df-0x0;var _0x3935b2=_0x1883[_0x19a3df];return _0x3935b2;};'use strict';var SquareProjectEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){SquareProjectEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);SquareProjectEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 00eed3b..9693062 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 _0xfeff=['isAuthenticated','download','post','create','put','update','/:id/delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','/:id/download'];(function(_0x228e70,_0x3b3a7e){var _0x1f5890=function(_0x5dd0fc){while(--_0x5dd0fc){_0x228e70['push'](_0x228e70['shift']());}};_0x1f5890(++_0x3b3a7e);}(_0xfeff,0x1ac));var _0xffef=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xfeff[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xffef('0x0'));var util=require(_0xffef('0x1'));var path=require(_0xffef('0x2'));var timeout=require('connect-timeout');var express=require(_0xffef('0x3'));var router=express[_0xffef('0x4')]();var auth=require(_0xffef('0x5'));var interaction=require(_0xffef('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xffef('0x7')]('/',auth['isAuthenticated'](),controller[_0xffef('0x8')]);router['get'](_0xffef('0x9'),auth['isAuthenticated'](),controller[_0xffef('0xa')]);router[_0xffef('0x7')](_0xffef('0xb'),auth[_0xffef('0xc')](),controller[_0xffef('0xd')]);router[_0xffef('0xe')]('/',auth[_0xffef('0xc')](),controller[_0xffef('0xf')]);router[_0xffef('0x10')](_0xffef('0x9'),auth[_0xffef('0xc')](),controller[_0xffef('0x11')]);router['delete'](_0xffef('0x12'),auth[_0xffef('0xc')](),controller[_0xffef('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8e62=['get','isAuthenticated','index','show','/:id/download','download','create','/:id','update','/:id/delete','exports','multer','util','path','connect-timeout','express','Router','./squareRecording.controller'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x8e62,0xe3));var _0x28e6=function(_0x13573c,_0x585238){_0x13573c=_0x13573c-0x0;var _0x37bc6e=_0x8e62[_0x13573c];return _0x37bc6e;};'use strict';var multer=require(_0x28e6('0x0'));var util=require(_0x28e6('0x1'));var path=require(_0x28e6('0x2'));var timeout=require(_0x28e6('0x3'));var express=require(_0x28e6('0x4'));var router=express[_0x28e6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28e6('0x6'));router[_0x28e6('0x7')]('/',auth[_0x28e6('0x8')](),controller[_0x28e6('0x9')]);router['get']('/:id',auth[_0x28e6('0x8')](),controller[_0x28e6('0xa')]);router[_0x28e6('0x7')](_0x28e6('0xb'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xc')]);router['post']('/',auth[_0x28e6('0x8')](),controller[_0x28e6('0xd')]);router['put'](_0x28e6('0xe'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xf')]);router['delete'](_0x28e6('0x10'),auth[_0x28e6('0x8')](),controller['destroy']);module[_0x28e6('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 933b0ee..4a6d806 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 _0xf2d8=['getDataValue','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x571d37,_0x456e70){var _0x171f06=function(_0x479950){while(--_0x479950){_0x571d37['push'](_0x571d37['shift']());}};_0x171f06(++_0x456e70);}(_0xf2d8,0xe6));var _0x8f2d=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xf2d8[_0x5e1b91];return _0x59b52f;};'use strict';var Sequelize=require(_0x8f2d('0x0'));module[_0x8f2d('0x1')]={'uniqueid':{'type':Sequelize[_0x8f2d('0x2')]},'callerid':{'type':Sequelize[_0x8f2d('0x2')]},'calleridname':{'type':Sequelize[_0x8f2d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8f2d('0x2')]},'dnid':{'type':Sequelize[_0x8f2d('0x2')]},'projectName':{'type':Sequelize[_0x8f2d('0x2')]},'saveName':{'type':Sequelize[_0x8f2d('0x2')]},'filename':{'type':Sequelize[_0x8f2d('0x2')]},'savePath':{'type':Sequelize[_0x8f2d('0x2')]},'format':{'type':Sequelize[_0x8f2d('0x3')],'get':function(){var _0x196edb='';var _0x7ccb5c=this[_0x8f2d('0x4')]('savePath');if(_0x7ccb5c){_0x196edb=_0x7ccb5c['substring'](_0x7ccb5c[_0x8f2d('0x5')]('.'));}return _0x196edb;}}}; \ No newline at end of file +var _0xe1de=['lastIndexOf','sequelize','exports','STRING','getDataValue','savePath','substring'];(function(_0x201c57,_0x58d3b1){var _0x251ce4=function(_0x41714b){while(--_0x41714b){_0x201c57['push'](_0x201c57['shift']());}};_0x251ce4(++_0x58d3b1);}(_0xe1de,0x14a));var _0xee1d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe1de[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0xee1d('0x0'));module[_0xee1d('0x1')]={'uniqueid':{'type':Sequelize[_0xee1d('0x2')]},'callerid':{'type':Sequelize[_0xee1d('0x2')]},'calleridname':{'type':Sequelize[_0xee1d('0x2')]},'context':{'type':Sequelize[_0xee1d('0x2')]},'extension':{'type':Sequelize[_0xee1d('0x2')]},'priority':{'type':Sequelize[_0xee1d('0x2')]},'accountcode':{'type':Sequelize[_0xee1d('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xee1d('0x2')]},'filename':{'type':Sequelize[_0xee1d('0x2')]},'savePath':{'type':Sequelize[_0xee1d('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x46f1f3='';var _0x3e470b=this[_0xee1d('0x3')](_0xee1d('0x4'));if(_0x3e470b){_0x46f1f3=_0x3e470b[_0xee1d('0x5')](_0x3e470b[_0xee1d('0x6')]('.'));}return _0x46f1f3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 274b7fc..e8dd101 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 _0xfd40=['count','offset','Content-Range','reject','save','update','then','destroy','stack','name','SquareRecording','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','ValidationError','extname','unlink','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x330304,_0x4e9347){var _0x288a85=function(_0x2d3583){while(--_0x2d3583){_0x330304['push'](_0x330304['shift']());}};_0x288a85(++_0x4e9347);}(_0xfd40,0x155));var _0x0fd4=function(_0x426270,_0x4d02fb){_0x426270=_0x426270-0x0;var _0xa8e620=_0xfd40[_0x426270];return _0xa8e620;};'use strict';var pdf=require(_0x0fd4('0x0'));var emlformat=require(_0x0fd4('0x1'));var rimraf=require(_0x0fd4('0x2'));var zipdir=require(_0x0fd4('0x3'));var jsonpatch=require(_0x0fd4('0x4'));var rp=require(_0x0fd4('0x5'));var moment=require('moment');var BPromise=require(_0x0fd4('0x6'));var Mustache=require('mustache');var util=require(_0x0fd4('0x7'));var path=require(_0x0fd4('0x8'));var sox=require('sox');var csv=require(_0x0fd4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0fd4('0xa'));var squel=require(_0x0fd4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0fd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0fd4('0x9'));var querystring=require(_0x0fd4('0xd'));var Papa=require(_0x0fd4('0xe'));var Redis=require(_0x0fd4('0xf'));var authService=require(_0x0fd4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0fd4('0x11'));var hardwareService=require(_0x0fd4('0x12'));var logger=require(_0x0fd4('0x13'))('api');var utils=require(_0x0fd4('0x14'));var config=require(_0x0fd4('0x15'));var licenseUtil=require(_0x0fd4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2233,_0x198edf){_0x198edf=_0x198edf||0xcc;return function(_0x21798d){if(_0x21798d){return _0x5b2233[_0x0fd4('0x17')](_0x198edf);}return _0x5b2233['status'](_0x198edf)[_0x0fd4('0x18')]();};}function respondWithResult(_0x422ece,_0x273b4a){_0x273b4a=_0x273b4a||0xc8;return function(_0x3800f9){if(_0x3800f9){return _0x422ece[_0x0fd4('0x19')](_0x273b4a)[_0x0fd4('0x1a')](_0x3800f9);}};}function respondWithFilteredResult(_0x5941e0,_0x43c005){return function(_0x3d9435){if(_0x3d9435){var _0x360327=_0x3d9435[_0x0fd4('0x1b')],_0x1f4fda=_0x43c005[_0x0fd4('0x1c')],_0x11d562=_0x43c005[_0x0fd4('0x1c')]+_0x43c005['limit'],_0x5acbd4;if(_0x11d562>=_0x360327){_0x11d562=_0x360327;_0x5acbd4=0xc8;}else{_0x5acbd4=0xce;}_0x5941e0[_0x0fd4('0x19')](_0x5acbd4);return _0x5941e0['set'](_0x0fd4('0x1d'),_0x1f4fda+'-'+_0x11d562+'/'+_0x360327)[_0x0fd4('0x1a')](_0x3d9435);}return null;};}function patchUpdates(_0x153f10){return function(_0x64472a){try{jsonpatch['apply'](_0x64472a,_0x153f10,!![]);}catch(_0x41eb09){return BPromise[_0x0fd4('0x1e')](_0x41eb09);}return _0x64472a[_0x0fd4('0x1f')]();};}function saveUpdates(_0x236995,_0x54883a){return function(_0x16fd1a){if(_0x16fd1a){return _0x16fd1a[_0x0fd4('0x20')](_0x236995)[_0x0fd4('0x21')](function(_0x29ed94){return _0x29ed94;});}return null;};}function removeEntity(_0x187b0d,_0x22cfd4){return function(_0x18bbe1){if(_0x18bbe1){return _0x18bbe1[_0x0fd4('0x22')]()[_0x0fd4('0x21')](function(){_0x187b0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53bfbc,_0x32c18c){return function(_0x2ebeac){if(!_0x2ebeac){_0x53bfbc[_0x0fd4('0x17')](0x194);}return _0x2ebeac;};}function handleError(_0x20bdb5,_0x25caba){_0x25caba=_0x25caba||0x1f4;return function(_0x5d0e2c){logger['error'](_0x5d0e2c[_0x0fd4('0x23')]);if(_0x5d0e2c[_0x0fd4('0x24')]){delete _0x5d0e2c[_0x0fd4('0x24')];}_0x20bdb5['status'](_0x25caba)['send'](_0x5d0e2c);};}exports['index']=function(_0x216d14,_0x627dda){var _0x2e26a4={},_0x453a81={},_0x472105={'count':0x0,'rows':[]};var _0x39481d=_['map'](db[_0x0fd4('0x25')]['rawAttributes'],function(_0x49a1b0){return{'name':_0x49a1b0[_0x0fd4('0x26')],'type':_0x49a1b0['type'][_0x0fd4('0x27')]};});_0x453a81[_0x0fd4('0x28')]=_[_0x0fd4('0x29')](_0x39481d,_0x0fd4('0x24'));_0x453a81[_0x0fd4('0x2a')]=_[_0x0fd4('0x2b')](_0x216d14[_0x0fd4('0x2a')]);_0x453a81[_0x0fd4('0x2c')]=_[_0x0fd4('0x2d')](_0x453a81[_0x0fd4('0x28')],_0x453a81[_0x0fd4('0x2a')]);_0x2e26a4[_0x0fd4('0x2e')]=_['intersection'](_0x453a81[_0x0fd4('0x28')],qs[_0x0fd4('0x2f')](_0x216d14['query'][_0x0fd4('0x2f')]));_0x2e26a4[_0x0fd4('0x2e')]=_0x2e26a4[_0x0fd4('0x2e')]['length']?_0x2e26a4['attributes']:_0x453a81[_0x0fd4('0x28')];if(!_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x30')](_0x0fd4('0x31'))){_0x2e26a4[_0x0fd4('0x32')]=qs[_0x0fd4('0x32')](_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x32')]);_0x2e26a4[_0x0fd4('0x1c')]=qs[_0x0fd4('0x1c')](_0x216d14['query'][_0x0fd4('0x1c')]);}_0x2e26a4[_0x0fd4('0x33')]=qs['sort'](_0x216d14[_0x0fd4('0x2a')]['sort']);_0x2e26a4[_0x0fd4('0x34')]=qs['filters'](_['pick'](_0x216d14[_0x0fd4('0x2a')],_0x453a81['filters']),_0x39481d);if(_0x216d14['query'][_0x0fd4('0x35')]){_0x2e26a4['where']=_[_0x0fd4('0x36')](_0x2e26a4[_0x0fd4('0x34')],{'$or':_['map'](_0x39481d,function(_0x55d4f5){if(_0x55d4f5[_0x0fd4('0x37')]!==_0x0fd4('0x38')){var _0x14bb5e={};_0x14bb5e[_0x55d4f5[_0x0fd4('0x24')]]={'$like':'%'+_0x216d14[_0x0fd4('0x2a')]['filter']+'%'};return _0x14bb5e;}})});}_0x2e26a4=_[_0x0fd4('0x36')]({},_0x2e26a4,_0x216d14[_0x0fd4('0x39')]);var _0x45d5de={'where':_0x2e26a4[_0x0fd4('0x34')]};return db[_0x0fd4('0x25')][_0x0fd4('0x1b')](_0x45d5de)[_0x0fd4('0x21')](function(_0x4d1f62){_0x472105[_0x0fd4('0x1b')]=_0x4d1f62;if(_0x216d14[_0x0fd4('0x2a')][_0x0fd4('0x3a')]){_0x2e26a4[_0x0fd4('0x3b')]=[{'all':!![]}];}return db[_0x0fd4('0x25')][_0x0fd4('0x3c')](_0x2e26a4);})[_0x0fd4('0x21')](function(_0x58a5c4){_0x472105[_0x0fd4('0x3d')]=_0x58a5c4;return _0x472105;})[_0x0fd4('0x21')](respondWithFilteredResult(_0x627dda,_0x2e26a4))[_0x0fd4('0x3e')](handleError(_0x627dda,null));};exports[_0x0fd4('0x3f')]=function(_0x286a35,_0x451c3a){var _0x3fbc24={'raw':!![],'where':{'id':_0x286a35['params']['id']}},_0x3b31f6={};_0x3b31f6[_0x0fd4('0x28')]=_[_0x0fd4('0x2b')](db[_0x0fd4('0x25')][_0x0fd4('0x40')]);_0x3b31f6['query']=_[_0x0fd4('0x2b')](_0x286a35[_0x0fd4('0x2a')]);_0x3b31f6['filters']=_[_0x0fd4('0x2d')](_0x3b31f6[_0x0fd4('0x28')],_0x3b31f6[_0x0fd4('0x2a')]);_0x3fbc24['attributes']=_[_0x0fd4('0x2d')](_0x3b31f6['model'],qs[_0x0fd4('0x2f')](_0x286a35[_0x0fd4('0x2a')][_0x0fd4('0x2f')]));_0x3fbc24[_0x0fd4('0x2e')]=_0x3fbc24[_0x0fd4('0x2e')]['length']?_0x3fbc24[_0x0fd4('0x2e')]:_0x3b31f6[_0x0fd4('0x28')];if(_0x286a35[_0x0fd4('0x2a')]['includeAll']){_0x3fbc24['include']=[{'all':!![]}];}_0x3fbc24=_[_0x0fd4('0x36')]({},_0x3fbc24,_0x286a35[_0x0fd4('0x39')]);return db[_0x0fd4('0x25')][_0x0fd4('0x41')](_0x3fbc24)[_0x0fd4('0x21')](handleEntityNotFound(_0x451c3a,null))[_0x0fd4('0x21')](respondWithResult(_0x451c3a,null))['catch'](handleError(_0x451c3a,null));};exports[_0x0fd4('0x42')]=function(_0x1bd138,_0x4b0511){return db['SquareRecording'][_0x0fd4('0x42')](_0x1bd138[_0x0fd4('0x43')],{})['then'](respondWithResult(_0x4b0511,0xc9))[_0x0fd4('0x3e')](handleError(_0x4b0511,null));};exports['update']=function(_0x1d4200,_0x185805){if(_0x1d4200[_0x0fd4('0x43')]['id']){delete _0x1d4200[_0x0fd4('0x43')]['id'];}return db[_0x0fd4('0x25')][_0x0fd4('0x41')]({'where':{'id':_0x1d4200[_0x0fd4('0x44')]['id']}})[_0x0fd4('0x21')](handleEntityNotFound(_0x185805,null))['then'](saveUpdates(_0x1d4200[_0x0fd4('0x43')],null))['then'](respondWithResult(_0x185805,null))[_0x0fd4('0x3e')](handleError(_0x185805,null));};exports[_0x0fd4('0x45')]=function(_0x200cdb,_0x5bab1b,_0xe9c29f){var _0x42595c=require(_0x0fd4('0x46'));var _0x133a5=![];var _0x23101d={};if(_0x200cdb[_0x0fd4('0x2a')]['type']&&_0x200cdb[_0x0fd4('0x2a')][_0x0fd4('0x37')]===_0x0fd4('0x47')){_0x23101d[_0x0fd4('0x47')]=_0x200cdb[_0x0fd4('0x44')]['id'];}else{_0x23101d['id']=_0x200cdb[_0x0fd4('0x44')]['id'];}return db['SquareRecording'][_0x0fd4('0x41')]({'where':_0x23101d,'attributes':['id',_0x0fd4('0x48'),_0x0fd4('0x49')],'raw':!![]})[_0x0fd4('0x21')](handleEntityNotFound(_0x5bab1b,null))['then'](function(_0x18800f){if(_0x18800f){var _0x4c8f1c=_0x18800f[_0x0fd4('0x48')];var _0x2b2b12=util[_0x0fd4('0x4a')](_0x0fd4('0x4b'),_0x4c8f1c);if(fs[_0x0fd4('0x4c')](_0x2b2b12)){_0x133a5=!![];return _0x42595c['decryptFile'](_0x2b2b12,_0x4c8f1c,config[_0x0fd4('0x4d')][_0x0fd4('0x4e')])[_0x0fd4('0x21')](function(){return _0x18800f;});}return _0x18800f;}})[_0x0fd4('0x21')](function(_0x2fe89f){if(_0x2fe89f){var _0x53f02e=_0x2fe89f[_0x0fd4('0x48')];if(!fs[_0x0fd4('0x4c')](_0x53f02e)){throw new db['Sequelize'][(_0x0fd4('0x4f'))]('SquareRecording\x20not\x20found');}if(_0x2fe89f[_0x0fd4('0x49')]){return _0x5bab1b[_0x0fd4('0x45')](_0x53f02e,_0x2fe89f[_0x0fd4('0x49')]+path[_0x0fd4('0x50')](_0x53f02e),function(){if(_0x133a5){fs[_0x0fd4('0x51')](_0x53f02e);}});}else{return _0x5bab1b['download'](_0x53f02e,function(_0x36214a){if(_0x133a5){fs[_0x0fd4('0x51')](_0x53f02e);}});}}})[_0x0fd4('0x3e')](function(_0x466db6){if(_0x466db6['message']==='SquareRecording\x20not\x20found'){_0x5bab1b[_0x0fd4('0x19')](0x194)[_0x0fd4('0x52')](_0x0fd4('0x53'));}else{return handleError(_0x5bab1b,null);}});};exports[_0x0fd4('0x22')]=function(_0x59b547,_0x3be8d6){return db[_0x0fd4('0x25')][_0x0fd4('0x41')]({'where':{'id':_0x59b547[_0x0fd4('0x44')]['id']}})[_0x0fd4('0x21')](function(_0x42e15a){if(!_0x42e15a)throw new ReferenceError(_0x0fd4('0x54'));return _0x42e15a;})[_0x0fd4('0x21')](function(_0x1a1861){var _0x4cc5d8=_0x1a1861['savePath'];logger[_0x0fd4('0x55')](_0x0fd4('0x56'),_0x4cc5d8);if(!_[_0x0fd4('0x57')](_0x1a1861[_0x0fd4('0x48')])&&fs[_0x0fd4('0x4c')](_0x4cc5d8)){logger[_0x0fd4('0x55')](_0x0fd4('0x58')+_0x4cc5d8+_0x0fd4('0x59'));fs[_0x0fd4('0x5a')](_0x4cc5d8);}_0x4cc5d8=_0x4cc5d8+_0x0fd4('0x5b');if(!_[_0x0fd4('0x57')](_0x1a1861['savePath'])&&fs[_0x0fd4('0x4c')](_0x4cc5d8)){logger[_0x0fd4('0x55')]('File:\x20\x22'+_0x4cc5d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0fd4('0x5a')](_0x4cc5d8);}return _0x1a1861;})[_0x0fd4('0x21')](function(_0x5c4f53){if(!_0x5c4f53)throw new InternalError();return _0x5c4f53[_0x0fd4('0x22')]();})['then'](function(){_0x3be8d6[_0x0fd4('0x19')](0xcc)[_0x0fd4('0x18')]();})[_0x0fd4('0x3e')](handleError(_0x3be8d6,null));}; \ No newline at end of file +var _0x35fa=['count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x35fa,0x1c7));var _0xa35f=function(_0x23f81d,_0x74a4c5){_0x23f81d=_0x23f81d-0x0;var _0x244b49=_0x35fa[_0x23f81d];return _0x244b49;};'use strict';var pdf=require(_0xa35f('0x0'));var emlformat=require(_0xa35f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa35f('0x2'));var jsonpatch=require(_0xa35f('0x3'));var rp=require(_0xa35f('0x4'));var moment=require(_0xa35f('0x5'));var BPromise=require(_0xa35f('0x6'));var Mustache=require(_0xa35f('0x7'));var util=require(_0xa35f('0x8'));var path=require(_0xa35f('0x9'));var sox=require(_0xa35f('0xa'));var csv=require(_0xa35f('0xb'));var ejs=require(_0xa35f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa35f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa35f('0xb'));var querystring=require(_0xa35f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa35f('0xf'));var authService=require(_0xa35f('0x10'));var qs=require(_0xa35f('0x11'));var as=require(_0xa35f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa35f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa35f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5f39,_0x8e01b5){_0x8e01b5=_0x8e01b5||0xcc;return function(_0x1076da){if(_0x1076da){return _0x1a5f39[_0xa35f('0x15')](_0x8e01b5);}return _0x1a5f39[_0xa35f('0x16')](_0x8e01b5)[_0xa35f('0x17')]();};}function respondWithResult(_0x19e45d,_0x1d724c){_0x1d724c=_0x1d724c||0xc8;return function(_0x450eb3){if(_0x450eb3){return _0x19e45d['status'](_0x1d724c)[_0xa35f('0x18')](_0x450eb3);}};}function respondWithFilteredResult(_0x454428,_0x50234e){return function(_0x2d36b4){if(_0x2d36b4){var _0x56e027=_0x2d36b4[_0xa35f('0x19')],_0x186971=_0x50234e[_0xa35f('0x1a')],_0x5c309c=_0x50234e[_0xa35f('0x1a')]+_0x50234e['limit'],_0x365ed8;if(_0x5c309c>=_0x56e027){_0x5c309c=_0x56e027;_0x365ed8=0xc8;}else{_0x365ed8=0xce;}_0x454428[_0xa35f('0x16')](_0x365ed8);return _0x454428['set'](_0xa35f('0x1b'),_0x186971+'-'+_0x5c309c+'/'+_0x56e027)[_0xa35f('0x18')](_0x2d36b4);}return null;};}function patchUpdates(_0x524167){return function(_0x650b74){try{jsonpatch[_0xa35f('0x1c')](_0x650b74,_0x524167,!![]);}catch(_0x244c83){return BPromise[_0xa35f('0x1d')](_0x244c83);}return _0x650b74['save']();};}function saveUpdates(_0x32e038,_0x161d46){return function(_0xeb85e2){if(_0xeb85e2){return _0xeb85e2[_0xa35f('0x1e')](_0x32e038)[_0xa35f('0x1f')](function(_0x3b5c7e){return _0x3b5c7e;});}return null;};}function removeEntity(_0x19e775,_0x263d68){return function(_0x555ac4){if(_0x555ac4){return _0x555ac4[_0xa35f('0x20')]()['then'](function(){_0x19e775['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c526,_0x2bec47){return function(_0x57b9e5){if(!_0x57b9e5){_0x29c526[_0xa35f('0x15')](0x194);}return _0x57b9e5;};}function handleError(_0x50c426,_0x3ee86a){_0x3ee86a=_0x3ee86a||0x1f4;return function(_0x55b6fc){logger[_0xa35f('0x21')](_0x55b6fc[_0xa35f('0x22')]);if(_0x55b6fc[_0xa35f('0x23')]){delete _0x55b6fc[_0xa35f('0x23')];}_0x50c426[_0xa35f('0x16')](_0x3ee86a)[_0xa35f('0x24')](_0x55b6fc);};}exports[_0xa35f('0x25')]=function(_0x22e561,_0x132de1){var _0x1481f7={},_0x5c0750={},_0x3ae4e1={'count':0x0,'rows':[]};var _0xdad901=_[_0xa35f('0x26')](db['SquareRecording'][_0xa35f('0x27')],function(_0x1e3429){return{'name':_0x1e3429[_0xa35f('0x28')],'type':_0x1e3429[_0xa35f('0x29')][_0xa35f('0x2a')]};});_0x5c0750[_0xa35f('0x2b')]=_[_0xa35f('0x26')](_0xdad901,'name');_0x5c0750[_0xa35f('0x2c')]=_[_0xa35f('0x2d')](_0x22e561['query']);_0x5c0750[_0xa35f('0x2e')]=_['intersection'](_0x5c0750[_0xa35f('0x2b')],_0x5c0750[_0xa35f('0x2c')]);_0x1481f7[_0xa35f('0x2f')]=_[_0xa35f('0x30')](_0x5c0750['model'],qs[_0xa35f('0x31')](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x31')]));_0x1481f7[_0xa35f('0x2f')]=_0x1481f7['attributes'][_0xa35f('0x32')]?_0x1481f7[_0xa35f('0x2f')]:_0x5c0750[_0xa35f('0x2b')];if(!_0x22e561[_0xa35f('0x2c')]['hasOwnProperty'](_0xa35f('0x33'))){_0x1481f7[_0xa35f('0x34')]=qs[_0xa35f('0x34')](_0x22e561['query'][_0xa35f('0x34')]);_0x1481f7[_0xa35f('0x1a')]=qs['offset'](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x1a')]);}_0x1481f7[_0xa35f('0x35')]=qs[_0xa35f('0x36')](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x36')]);_0x1481f7[_0xa35f('0x37')]=qs[_0xa35f('0x2e')](_[_0xa35f('0x38')](_0x22e561[_0xa35f('0x2c')],_0x5c0750[_0xa35f('0x2e')]),_0xdad901);if(_0x22e561['query'][_0xa35f('0x39')]){_0x1481f7[_0xa35f('0x37')]=_[_0xa35f('0x3a')](_0x1481f7['where'],{'$or':_[_0xa35f('0x26')](_0xdad901,function(_0x27b8f8){if(_0x27b8f8[_0xa35f('0x29')]!=='VIRTUAL'){var _0x57b3e4={};_0x57b3e4[_0x27b8f8[_0xa35f('0x23')]]={'$like':'%'+_0x22e561[_0xa35f('0x2c')]['filter']+'%'};return _0x57b3e4;}})});}_0x1481f7=_[_0xa35f('0x3a')]({},_0x1481f7,_0x22e561[_0xa35f('0x3b')]);var _0x4e6657={'where':_0x1481f7[_0xa35f('0x37')]};return db[_0xa35f('0x3c')][_0xa35f('0x19')](_0x4e6657)[_0xa35f('0x1f')](function(_0x28ffcb){_0x3ae4e1['count']=_0x28ffcb;if(_0x22e561[_0xa35f('0x2c')][_0xa35f('0x3d')]){_0x1481f7[_0xa35f('0x3e')]=[{'all':!![]}];}return db[_0xa35f('0x3c')][_0xa35f('0x3f')](_0x1481f7);})[_0xa35f('0x1f')](function(_0x1f2083){_0x3ae4e1[_0xa35f('0x40')]=_0x1f2083;return _0x3ae4e1;})[_0xa35f('0x1f')](respondWithFilteredResult(_0x132de1,_0x1481f7))[_0xa35f('0x41')](handleError(_0x132de1,null));};exports[_0xa35f('0x42')]=function(_0x376197,_0xabfadf){var _0x243f64={'raw':!![],'where':{'id':_0x376197[_0xa35f('0x43')]['id']}},_0x4f4b08={};_0x4f4b08[_0xa35f('0x2b')]=_[_0xa35f('0x2d')](db[_0xa35f('0x3c')][_0xa35f('0x27')]);_0x4f4b08['query']=_[_0xa35f('0x2d')](_0x376197[_0xa35f('0x2c')]);_0x4f4b08['filters']=_[_0xa35f('0x30')](_0x4f4b08[_0xa35f('0x2b')],_0x4f4b08[_0xa35f('0x2c')]);_0x243f64['attributes']=_[_0xa35f('0x30')](_0x4f4b08[_0xa35f('0x2b')],qs[_0xa35f('0x31')](_0x376197[_0xa35f('0x2c')]['fields']));_0x243f64[_0xa35f('0x2f')]=_0x243f64[_0xa35f('0x2f')][_0xa35f('0x32')]?_0x243f64[_0xa35f('0x2f')]:_0x4f4b08[_0xa35f('0x2b')];if(_0x376197[_0xa35f('0x2c')][_0xa35f('0x3d')]){_0x243f64[_0xa35f('0x3e')]=[{'all':!![]}];}_0x243f64=_[_0xa35f('0x3a')]({},_0x243f64,_0x376197[_0xa35f('0x3b')]);return db[_0xa35f('0x3c')][_0xa35f('0x44')](_0x243f64)[_0xa35f('0x1f')](handleEntityNotFound(_0xabfadf,null))[_0xa35f('0x1f')](respondWithResult(_0xabfadf,null))[_0xa35f('0x41')](handleError(_0xabfadf,null));};exports[_0xa35f('0x45')]=function(_0x14c3c5,_0x614a3a){return db['SquareRecording'][_0xa35f('0x45')](_0x14c3c5[_0xa35f('0x46')],{})[_0xa35f('0x1f')](respondWithResult(_0x614a3a,0xc9))['catch'](handleError(_0x614a3a,null));};exports[_0xa35f('0x1e')]=function(_0xa95eb2,_0x4ca041){if(_0xa95eb2['body']['id']){delete _0xa95eb2['body']['id'];}return db[_0xa35f('0x3c')][_0xa35f('0x44')]({'where':{'id':_0xa95eb2[_0xa35f('0x43')]['id']}})[_0xa35f('0x1f')](handleEntityNotFound(_0x4ca041,null))[_0xa35f('0x1f')](saveUpdates(_0xa95eb2[_0xa35f('0x46')],null))[_0xa35f('0x1f')](respondWithResult(_0x4ca041,null))[_0xa35f('0x41')](handleError(_0x4ca041,null));};exports[_0xa35f('0x47')]=function(_0x4e8ebc,_0x140d9e,_0x59601d){var _0x5764b1=require(_0xa35f('0x48'));var _0x4e020a=![];var _0x1790f6={};if(_0x4e8ebc['query'][_0xa35f('0x29')]&&_0x4e8ebc[_0xa35f('0x2c')]['type']===_0xa35f('0x49')){_0x1790f6[_0xa35f('0x49')]=_0x4e8ebc[_0xa35f('0x43')]['id'];}else{_0x1790f6['id']=_0x4e8ebc[_0xa35f('0x43')]['id'];}return db['SquareRecording']['find']({'where':_0x1790f6,'attributes':['id',_0xa35f('0x4a'),_0xa35f('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x140d9e,null))[_0xa35f('0x1f')](function(_0x142159){if(_0x142159){var _0xccd36d=_0x142159[_0xa35f('0x4a')];var _0xcf158=util[_0xa35f('0x4c')](_0xa35f('0x4d'),_0xccd36d);if(fs[_0xa35f('0x4e')](_0xcf158)){_0x4e020a=!![];return _0x5764b1[_0xa35f('0x4f')](_0xcf158,_0xccd36d,config[_0xa35f('0x50')][_0xa35f('0x51')])[_0xa35f('0x1f')](function(){return _0x142159;});}return _0x142159;}})['then'](function(_0x43dfc6){if(_0x43dfc6){var _0x33bcdb=_0x43dfc6[_0xa35f('0x4a')];if(!fs[_0xa35f('0x4e')](_0x33bcdb)){throw new db[(_0xa35f('0x52'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x43dfc6[_0xa35f('0x4b')]){return _0x140d9e[_0xa35f('0x47')](_0x33bcdb,_0x43dfc6['filename']+path[_0xa35f('0x53')](_0x33bcdb),function(){if(_0x4e020a){fs[_0xa35f('0x54')](_0x33bcdb);}});}else{return _0x140d9e[_0xa35f('0x47')](_0x33bcdb,function(_0x565832){if(_0x4e020a){fs['unlink'](_0x33bcdb);}});}}})[_0xa35f('0x41')](function(_0x40f682){if(_0x40f682[_0xa35f('0x55')]===_0xa35f('0x56')){_0x140d9e[_0xa35f('0x16')](0x194)['send'](_0xa35f('0x57'));}else{return handleError(_0x140d9e,null);}});};exports[_0xa35f('0x20')]=function(_0x49211f,_0x30af7a){return db['SquareRecording'][_0xa35f('0x44')]({'where':{'id':_0x49211f[_0xa35f('0x43')]['id']}})[_0xa35f('0x1f')](function(_0x10db86){if(!_0x10db86)throw new ReferenceError(_0xa35f('0x58'));return _0x10db86;})[_0xa35f('0x1f')](function(_0x1c1dc9){var _0x152969=_0x1c1dc9['savePath'];logger[_0xa35f('0x59')](_0xa35f('0x5a'),_0x152969);if(!_['isNil'](_0x1c1dc9['savePath'])&&fs[_0xa35f('0x4e')](_0x152969)){logger[_0xa35f('0x59')](_0xa35f('0x5b')+_0x152969+_0xa35f('0x5c'));fs[_0xa35f('0x5d')](_0x152969);}_0x152969=_0x152969+_0xa35f('0x5e');if(!_[_0xa35f('0x5f')](_0x1c1dc9['savePath'])&&fs[_0xa35f('0x4e')](_0x152969)){logger[_0xa35f('0x59')](_0xa35f('0x5b')+_0x152969+_0xa35f('0x5c'));fs[_0xa35f('0x5d')](_0x152969);}return _0x1c1dc9;})[_0xa35f('0x1f')](function(_0x16e4f9){if(!_0x16e4f9)throw new InternalError();return _0x16e4f9[_0xa35f('0x20')]();})[_0xa35f('0x1f')](function(){_0x30af7a[_0xa35f('0x16')](0xcc)[_0xa35f('0x17')]();})['catch'](handleError(_0x30af7a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f1cd7bc..d5f9592 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 _0x9f0e=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3152b0,_0x5a0cfe){_0x3152b0=_0x3152b0-0x0;var _0x53e5ba=_0x9f0e[_0x3152b0];return _0x53e5ba;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9eb=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x246194,_0x27cdd9){var _0x4fed0e=function(_0x5a92bc){while(--_0x5a92bc){_0x246194['push'](_0x246194['shift']());}};_0x4fed0e(++_0x27cdd9);}(_0xd9eb,0xca));var _0xbd9e=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0xd9eb[_0x317bf0];return _0x225932;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'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 2b123f2..37b9aee 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 _0x04ae=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','body','options','lodash','moment','bluebird'];(function(_0x4cb9d0,_0x2e0b00){var _0xbe1647=function(_0x534790){while(--_0x534790){_0x4cb9d0['push'](_0x4cb9d0['shift']());}};_0xbe1647(++_0x2e0b00);}(_0x04ae,0xc1));var _0xe04a=function(_0x14655a,_0xe801e1){_0x14655a=_0x14655a-0x0;var _0x34b158=_0x04ae[_0x14655a];return _0x34b158;};'use strict';var _=require(_0xe04a('0x0'));var util=require('util');var moment=require(_0xe04a('0x1'));var BPromise=require(_0xe04a('0x2'));var rs=require(_0xe04a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe04a('0x4'))['db'];var utils=require(_0xe04a('0x5'));var logger=require(_0xe04a('0x6'))(_0xe04a('0x7'));var config=require(_0xe04a('0x8'));var jayson=require(_0xe04a('0x9'));var client=jayson[_0xe04a('0xa')][_0xe04a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf0d5,_0xdc60aa,_0x39c345){return new BPromise(function(_0x22bd49,_0x56c97b){return client[_0xe04a('0xc')](_0x3bf0d5,_0x39c345)[_0xe04a('0xd')](function(_0x21980f){logger[_0xe04a('0xe')](_0xe04a('0xf'),_0xdc60aa,_0xe04a('0x10'));logger[_0xe04a('0x11')](_0xe04a('0x12'),_0xdc60aa,_0xe04a('0x10'),JSON[_0xe04a('0x13')](_0x21980f));if(_0x21980f[_0xe04a('0x14')]){if(_0x21980f[_0xe04a('0x14')]['code']===0x1f4){logger[_0xe04a('0x14')]('SquareRecording,\x20%s,\x20%s',_0xdc60aa,_0x21980f['error']['message']);return _0x56c97b(_0x21980f['error'][_0xe04a('0x15')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0xdc60aa,_0x21980f[_0xe04a('0x14')][_0xe04a('0x15')]);return _0x22bd49(_0x21980f[_0xe04a('0x14')][_0xe04a('0x15')]);}else{logger[_0xe04a('0xe')](_0xe04a('0xf'),_0xdc60aa,_0xe04a('0x10'));_0x22bd49(_0x21980f[_0xe04a('0x16')][_0xe04a('0x15')]);}})['catch'](function(_0x4c4cc5){logger[_0xe04a('0x14')](_0xe04a('0xf'),_0xdc60aa,_0x4c4cc5);_0x56c97b(_0x4c4cc5);});});}exports[_0xe04a('0x17')]=function(_0x18e6b5){var _0xe03691=this;return new Promise(function(_0x1aa438,_0x1a1e06){return db[_0xe04a('0x18')][_0xe04a('0x19')](_0x18e6b5[_0xe04a('0x1a')],{'raw':_0x18e6b5['options']?_0x18e6b5[_0xe04a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xe04a('0xd')](function(_0x1f42bb){logger[_0xe04a('0xe')](_0xe04a('0x17'),_0x18e6b5);logger[_0xe04a('0x11')]('CreateSquareRecording',_0x18e6b5,JSON[_0xe04a('0x13')](_0x1f42bb));_0x1aa438(_0x1f42bb);})['catch'](function(_0x3a12f8){logger[_0xe04a('0x14')](_0xe04a('0x17'),_0x3a12f8[_0xe04a('0x15')],_0x18e6b5);_0x1a1e06(_0xe03691[_0xe04a('0x14')](0x1f4,_0x3a12f8[_0xe04a('0x15')]));});});}; \ No newline at end of file +var _0xba5a=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareRecording','create','body','options','raw','stringify','catch','util'];(function(_0x1266bc,_0x4aa145){var _0x5e8426=function(_0x5c1c1d){while(--_0x5c1c1d){_0x1266bc['push'](_0x1266bc['shift']());}};_0x5e8426(++_0x4aa145);}(_0xba5a,0x67));var _0xaba5=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0xba5a[_0x569fef];return _0x11f20b;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var moment=require(_0xaba5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x2'))['db'];var utils=require(_0xaba5('0x3'));var logger=require(_0xaba5('0x4'))(_0xaba5('0x5'));var config=require(_0xaba5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaba5('0x7')][_0xaba5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13cd28,_0x2c342f,_0x4cb8f7){return new BPromise(function(_0x5f0691,_0x3fcf49){return client['request'](_0x13cd28,_0x4cb8f7)[_0xaba5('0x9')](function(_0x2ffee6){logger[_0xaba5('0xa')](_0xaba5('0xb'),_0x2c342f,_0xaba5('0xc'));logger[_0xaba5('0xd')](_0xaba5('0xe'),_0x2c342f,_0xaba5('0xc'),JSON['stringify'](_0x2ffee6));if(_0x2ffee6[_0xaba5('0xf')]){if(_0x2ffee6[_0xaba5('0xf')][_0xaba5('0x10')]===0x1f4){logger[_0xaba5('0xf')](_0xaba5('0xb'),_0x2c342f,_0x2ffee6['error'][_0xaba5('0x11')]);return _0x3fcf49(_0x2ffee6[_0xaba5('0xf')]['message']);}logger[_0xaba5('0xf')](_0xaba5('0xb'),_0x2c342f,_0x2ffee6['error'][_0xaba5('0x11')]);return _0x5f0691(_0x2ffee6[_0xaba5('0xf')][_0xaba5('0x11')]);}else{logger[_0xaba5('0xa')]('SquareRecording,\x20%s,\x20%s',_0x2c342f,_0xaba5('0xc'));_0x5f0691(_0x2ffee6[_0xaba5('0x12')][_0xaba5('0x11')]);}})['catch'](function(_0x178568){logger['error'](_0xaba5('0xb'),_0x2c342f,_0x178568);_0x3fcf49(_0x178568);});});}exports[_0xaba5('0x13')]=function(_0x3f9312){var _0x3cf30f=this;return new Promise(function(_0x19c3ba,_0x1b45c9){return db['SquareRecording'][_0xaba5('0x14')](_0x3f9312[_0xaba5('0x15')],{'raw':_0x3f9312[_0xaba5('0x16')]?_0x3f9312[_0xaba5('0x16')][_0xaba5('0x17')]===undefined?!![]:![]:!![]})[_0xaba5('0x9')](function(_0x1b5e7d){logger[_0xaba5('0xa')]('CreateSquareRecording',_0x3f9312);logger['debug'](_0xaba5('0x13'),_0x3f9312,JSON[_0xaba5('0x18')](_0x1b5e7d));_0x19c3ba(_0x1b5e7d);})[_0xaba5('0x19')](function(_0x32f241){logger[_0xaba5('0xf')](_0xaba5('0x13'),_0x32f241[_0xaba5('0x11')],_0x3f9312);_0x1b45c9(_0x3cf30f[_0xaba5('0xf')](0x1f4,_0x32f241['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a8a85c0..ee970ef 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 _0x38ab=['index','/describe','describe','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x232bc8,_0x5362d6){var _0x573007=function(_0x4efc29){while(--_0x4efc29){_0x232bc8['push'](_0x232bc8['shift']());}};_0x573007(++_0x5362d6);}(_0x38ab,0x1d1));var _0xb38a=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x38ab[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require(_0xb38a('0x0'));var util=require('util');var path=require(_0xb38a('0x1'));var timeout=require(_0xb38a('0x2'));var express=require(_0xb38a('0x3'));var router=express['Router']();var auth=require(_0xb38a('0x4'));var interaction=require(_0xb38a('0x5'));var config=require(_0xb38a('0x6'));var controller=require(_0xb38a('0x7'));router[_0xb38a('0x8')]('/',auth[_0xb38a('0x9')](),controller[_0xb38a('0xa')]);router[_0xb38a('0x8')](_0xb38a('0xb'),auth['isAuthenticated'](),controller[_0xb38a('0xc')]);router[_0xb38a('0x8')]('/:id',auth[_0xb38a('0x9')](),controller['show']);router[_0xb38a('0xd')]('/',auth['isAuthenticated'](),controller[_0xb38a('0xe')]);router[_0xb38a('0xf')](_0xb38a('0x10'),auth[_0xb38a('0x9')](),controller[_0xb38a('0x11')]);router[_0xb38a('0x12')](_0xb38a('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d9f=['post','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x403132,_0x302532){var _0x4a88ff=function(_0x29c1aa){while(--_0x29c1aa){_0x403132['push'](_0x403132['shift']());}};_0x4a88ff(++_0x302532);}(_0x3d9f,0x16e));var _0xf3d9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3d9f[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0xf3d9('0x0'));var path=require('path');var timeout=require(_0xf3d9('0x1'));var express=require(_0xf3d9('0x2'));var router=express['Router']();var auth=require(_0xf3d9('0x3'));var interaction=require(_0xf3d9('0x4'));var config=require('../../config/environment');var controller=require(_0xf3d9('0x5'));router['get']('/',auth[_0xf3d9('0x6')](),controller[_0xf3d9('0x7')]);router[_0xf3d9('0x8')](_0xf3d9('0x9'),auth['isAuthenticated'](),controller[_0xf3d9('0xa')]);router[_0xf3d9('0x8')](_0xf3d9('0xb'),auth[_0xf3d9('0x6')](),controller['show']);router[_0xf3d9('0xc')]('/',auth[_0xf3d9('0x6')](),controller['create']);router[_0xf3d9('0xd')](_0xf3d9('0xb'),auth[_0xf3d9('0x6')](),controller[_0xf3d9('0xe')]);router[_0xf3d9('0xf')]('/:id',auth[_0xf3d9('0x6')](),controller[_0xf3d9('0x10')]);module[_0xf3d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fb7b685..f9128c1 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 _0xbaf3=['exports','STRING','DATE','sequelize'];(function(_0x201d87,_0x4096fa){var _0xfe8c99=function(_0x500809){while(--_0x500809){_0x201d87['push'](_0x201d87['shift']());}};_0xfe8c99(++_0x4096fa);}(_0xbaf3,0x1d3));var _0x3baf=function(_0x5a2199,_0x5bebe6){_0x5a2199=_0x5a2199-0x0;var _0xe34487=_0xbaf3[_0x5a2199];return _0xe34487;};'use strict';var Sequelize=require(_0x3baf('0x0'));module[_0x3baf('0x1')]={'network':{'type':Sequelize[_0x3baf('0x2')]},'network_script':{'type':Sequelize[_0x3baf('0x2')]},'request':{'type':Sequelize[_0x3baf('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3baf('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x3baf('0x2')]},'callerid':{'type':Sequelize[_0x3baf('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x3baf('0x2')]},'callingani2':{'type':Sequelize[_0x3baf('0x2')]},'callington':{'type':Sequelize[_0x3baf('0x2')]},'callingtns':{'type':Sequelize[_0x3baf('0x2')]},'dnid':{'type':Sequelize[_0x3baf('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3baf('0x2')]},'extension':{'type':Sequelize[_0x3baf('0x2')]},'priority':{'type':Sequelize[_0x3baf('0x2')]},'enhanced':{'type':Sequelize[_0x3baf('0x2')]},'accountcode':{'type':Sequelize[_0x3baf('0x2')]},'threadid':{'type':Sequelize[_0x3baf('0x2')]},'project_name':{'type':Sequelize[_0x3baf('0x2')]},'joinAt':{'type':Sequelize[_0x3baf('0x3')]},'leaveAt':{'type':Sequelize[_0x3baf('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0e40=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x0e40,0x1c2));var _0x00e4=function(_0x401557,_0x4a160d){_0x401557=_0x401557-0x0;var _0x20cc44=_0x0e40[_0x401557];return _0x20cc44;};'use strict';var Sequelize=require(_0x00e4('0x0'));module[_0x00e4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x00e4('0x2')]},'channel':{'type':Sequelize[_0x00e4('0x2')]},'language':{'type':Sequelize[_0x00e4('0x2')]},'type':{'type':Sequelize[_0x00e4('0x2')]},'uniqueid':{'type':Sequelize[_0x00e4('0x2')]},'version':{'type':Sequelize[_0x00e4('0x2')]},'callerid':{'type':Sequelize[_0x00e4('0x2')]},'calleridname':{'type':Sequelize[_0x00e4('0x2')]},'callingpres':{'type':Sequelize[_0x00e4('0x2')]},'callingani2':{'type':Sequelize[_0x00e4('0x2')]},'callington':{'type':Sequelize[_0x00e4('0x2')]},'callingtns':{'type':Sequelize[_0x00e4('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x00e4('0x2')]},'extension':{'type':Sequelize[_0x00e4('0x2')]},'priority':{'type':Sequelize[_0x00e4('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x00e4('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x00e4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x00e4('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 13f2939..2c453dc 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 _0x50e5=['name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','sort','filters','merge','where','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack'];(function(_0x1c9786,_0x26dd12){var _0x255c3d=function(_0x1c1f98){while(--_0x1c1f98){_0x1c9786['push'](_0x1c9786['shift']());}};_0x255c3d(++_0x26dd12);}(_0x50e5,0xb7));var _0x550e=function(_0x1f9577,_0x24cafd){_0x1f9577=_0x1f9577-0x0;var _0x4222c5=_0x50e5[_0x1f9577];return _0x4222c5;};'use strict';var pdf=require(_0x550e('0x0'));var emlformat=require(_0x550e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x550e('0x2'));var jsonpatch=require(_0x550e('0x3'));var rp=require(_0x550e('0x4'));var moment=require(_0x550e('0x5'));var BPromise=require(_0x550e('0x6'));var Mustache=require(_0x550e('0x7'));var util=require(_0x550e('0x8'));var path=require(_0x550e('0x9'));var sox=require(_0x550e('0xa'));var csv=require(_0x550e('0xb'));var ejs=require(_0x550e('0xc'));var fs=require('fs');var _=require(_0x550e('0xd'));var squel=require('squel');var crypto=require(_0x550e('0xe'));var jsforce=require(_0x550e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x550e('0xb'));var querystring=require(_0x550e('0x10'));var Papa=require(_0x550e('0x11'));var Redis=require('ioredis');var authService=require(_0x550e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x550e('0x13'));var logger=require(_0x550e('0x14'))('api');var utils=require(_0x550e('0x15'));var config=require(_0x550e('0x16'));var licenseUtil=require(_0x550e('0x17'));var db=require(_0x550e('0x18'))['db'];function respondWithStatusCode(_0x518cad,_0x335cba){_0x335cba=_0x335cba||0xcc;return function(_0x57214a){if(_0x57214a){return _0x518cad[_0x550e('0x19')](_0x335cba);}return _0x518cad['status'](_0x335cba)[_0x550e('0x1a')]();};}function respondWithResult(_0x4c6070,_0x393055){_0x393055=_0x393055||0xc8;return function(_0x2d4b79){if(_0x2d4b79){return _0x4c6070[_0x550e('0x1b')](_0x393055)['json'](_0x2d4b79);}};}function respondWithFilteredResult(_0x302be0,_0x49787c){return function(_0xf28ba7){if(_0xf28ba7){var _0x49474f=_0xf28ba7['count'],_0x4a5f7a=_0x49787c['offset'],_0x31f4bf=_0x49787c['offset']+_0x49787c[_0x550e('0x1c')],_0xabb30d;if(_0x31f4bf>=_0x49474f){_0x31f4bf=_0x49474f;_0xabb30d=0xc8;}else{_0xabb30d=0xce;}_0x302be0['status'](_0xabb30d);return _0x302be0['set'](_0x550e('0x1d'),_0x4a5f7a+'-'+_0x31f4bf+'/'+_0x49474f)[_0x550e('0x1e')](_0xf28ba7);}return null;};}function patchUpdates(_0x6c7178){return function(_0x846ad){try{jsonpatch[_0x550e('0x1f')](_0x846ad,_0x6c7178,!![]);}catch(_0x29f2db){return BPromise[_0x550e('0x20')](_0x29f2db);}return _0x846ad[_0x550e('0x21')]();};}function saveUpdates(_0x1b9799,_0x47e6e1){return function(_0x23adb1){if(_0x23adb1){return _0x23adb1[_0x550e('0x22')](_0x1b9799)['then'](function(_0x4f70bd){return _0x4f70bd;});}return null;};}function removeEntity(_0x3e9822,_0x2663c7){return function(_0x5769bb){if(_0x5769bb){return _0x5769bb[_0x550e('0x23')]()[_0x550e('0x24')](function(){_0x3e9822[_0x550e('0x1b')](0xcc)[_0x550e('0x1a')]();});}};}function handleEntityNotFound(_0x3aa1b8,_0x3bbca3){return function(_0x56f6a2){if(!_0x56f6a2){_0x3aa1b8[_0x550e('0x19')](0x194);}return _0x56f6a2;};}function handleError(_0x205e3a,_0x45d972){_0x45d972=_0x45d972||0x1f4;return function(_0x2d10f3){logger[_0x550e('0x25')](_0x2d10f3[_0x550e('0x26')]);if(_0x2d10f3[_0x550e('0x27')]){delete _0x2d10f3[_0x550e('0x27')];}_0x205e3a[_0x550e('0x1b')](_0x45d972)[_0x550e('0x28')](_0x2d10f3);};}exports[_0x550e('0x29')]=function(_0x362d21,_0x5e0434){var _0x291976={},_0x11bec0={},_0x48d367={'count':0x0,'rows':[]};var _0x3a1d62=_[_0x550e('0x2a')](db[_0x550e('0x2b')][_0x550e('0x2c')],function(_0x1a4caa){return{'name':_0x1a4caa[_0x550e('0x2d')],'type':_0x1a4caa[_0x550e('0x2e')][_0x550e('0x2f')]};});_0x11bec0[_0x550e('0x30')]=_[_0x550e('0x2a')](_0x3a1d62,_0x550e('0x27'));_0x11bec0[_0x550e('0x31')]=_[_0x550e('0x32')](_0x362d21[_0x550e('0x31')]);_0x11bec0['filters']=_[_0x550e('0x33')](_0x11bec0[_0x550e('0x30')],_0x11bec0['query']);_0x291976[_0x550e('0x34')]=_[_0x550e('0x33')](_0x11bec0['model'],qs[_0x550e('0x35')](_0x362d21[_0x550e('0x31')][_0x550e('0x35')]));_0x291976[_0x550e('0x34')]=_0x291976[_0x550e('0x34')][_0x550e('0x36')]?_0x291976[_0x550e('0x34')]:_0x11bec0[_0x550e('0x30')];if(!_0x362d21['query'][_0x550e('0x37')]('nolimit')){_0x291976[_0x550e('0x1c')]=qs[_0x550e('0x1c')](_0x362d21['query'][_0x550e('0x1c')]);_0x291976[_0x550e('0x38')]=qs['offset'](_0x362d21['query']['offset']);}_0x291976['order']=qs[_0x550e('0x39')](_0x362d21[_0x550e('0x31')][_0x550e('0x39')]);_0x291976['where']=qs['filters'](_['pick'](_0x362d21[_0x550e('0x31')],_0x11bec0[_0x550e('0x3a')]),_0x3a1d62);if(_0x362d21['query']['filter']){_0x291976['where']=_[_0x550e('0x3b')](_0x291976[_0x550e('0x3c')],{'$or':_[_0x550e('0x2a')](_0x3a1d62,function(_0x575e0b){if(_0x575e0b['type']!==_0x550e('0x3d')){var _0x380f85={};_0x380f85[_0x575e0b[_0x550e('0x27')]]={'$like':'%'+_0x362d21[_0x550e('0x31')]['filter']+'%'};return _0x380f85;}})});}_0x291976=_[_0x550e('0x3b')]({},_0x291976,_0x362d21[_0x550e('0x3e')]);var _0x4cfde4={'where':_0x291976['where']};return db[_0x550e('0x2b')][_0x550e('0x3f')](_0x4cfde4)[_0x550e('0x24')](function(_0x437716){_0x48d367['count']=_0x437716;if(_0x362d21[_0x550e('0x31')][_0x550e('0x40')]){_0x291976[_0x550e('0x41')]=[{'all':!![]}];}return db[_0x550e('0x2b')]['findAll'](_0x291976);})[_0x550e('0x24')](function(_0x24532e){_0x48d367[_0x550e('0x42')]=_0x24532e;return _0x48d367;})[_0x550e('0x24')](respondWithFilteredResult(_0x5e0434,_0x291976))[_0x550e('0x43')](handleError(_0x5e0434,null));};exports[_0x550e('0x44')]=function(_0x489571,_0x2f8cf5){var _0x1e3550={'raw':!![],'where':{'id':_0x489571[_0x550e('0x45')]['id']}},_0x3db475={};_0x3db475[_0x550e('0x30')]=_['keys'](db[_0x550e('0x2b')][_0x550e('0x2c')]);_0x3db475['query']=_[_0x550e('0x32')](_0x489571[_0x550e('0x31')]);_0x3db475[_0x550e('0x3a')]=_['intersection'](_0x3db475['model'],_0x3db475[_0x550e('0x31')]);_0x1e3550[_0x550e('0x34')]=_['intersection'](_0x3db475[_0x550e('0x30')],qs[_0x550e('0x35')](_0x489571['query'][_0x550e('0x35')]));_0x1e3550[_0x550e('0x34')]=_0x1e3550[_0x550e('0x34')][_0x550e('0x36')]?_0x1e3550[_0x550e('0x34')]:_0x3db475[_0x550e('0x30')];if(_0x489571['query'][_0x550e('0x40')]){_0x1e3550['include']=[{'all':!![]}];}_0x1e3550=_[_0x550e('0x3b')]({},_0x1e3550,_0x489571[_0x550e('0x3e')]);return db['SquareReport'][_0x550e('0x46')](_0x1e3550)[_0x550e('0x24')](handleEntityNotFound(_0x2f8cf5,null))[_0x550e('0x24')](respondWithResult(_0x2f8cf5,null))[_0x550e('0x43')](handleError(_0x2f8cf5,null));};exports[_0x550e('0x47')]=function(_0x35881f,_0x5e4596){return db[_0x550e('0x2b')][_0x550e('0x47')](_0x35881f[_0x550e('0x48')],{})[_0x550e('0x24')](respondWithResult(_0x5e4596,0xc9))[_0x550e('0x43')](handleError(_0x5e4596,null));};exports[_0x550e('0x22')]=function(_0x3e1c3e,_0xf4b987){if(_0x3e1c3e[_0x550e('0x48')]['id']){delete _0x3e1c3e[_0x550e('0x48')]['id'];}return db[_0x550e('0x2b')][_0x550e('0x46')]({'where':{'id':_0x3e1c3e[_0x550e('0x45')]['id']}})[_0x550e('0x24')](handleEntityNotFound(_0xf4b987,null))[_0x550e('0x24')](saveUpdates(_0x3e1c3e[_0x550e('0x48')],null))[_0x550e('0x24')](respondWithResult(_0xf4b987,null))[_0x550e('0x43')](handleError(_0xf4b987,null));};exports[_0x550e('0x23')]=function(_0x203b32,_0x3b437f){return db[_0x550e('0x2b')]['find']({'where':{'id':_0x203b32[_0x550e('0x45')]['id']}})[_0x550e('0x24')](handleEntityNotFound(_0x3b437f,null))[_0x550e('0x24')](removeEntity(_0x3b437f,null))[_0x550e('0x43')](handleError(_0x3b437f,null));};exports[_0x550e('0x49')]=function(_0x8a5c64,_0x1e95c3){return db['SquareReport'][_0x550e('0x49')]()[_0x550e('0x24')](respondWithResult(_0x1e95c3,null))[_0x550e('0x43')](handleError(_0x1e95c3,null));}; \ No newline at end of file +var _0x6d5e=['reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','fields','find','create','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','Content-Range'];(function(_0x355f27,_0x14f185){var _0x4e183c=function(_0x29e334){while(--_0x29e334){_0x355f27['push'](_0x355f27['shift']());}};_0x4e183c(++_0x14f185);}(_0x6d5e,0x103));var _0xe6d5=function(_0x10a7f3,_0x4dc2c7){_0x10a7f3=_0x10a7f3-0x0;var _0x3e1bf7=_0x6d5e[_0x10a7f3];return _0x3e1bf7;};'use strict';var pdf=require(_0xe6d5('0x0'));var emlformat=require(_0xe6d5('0x1'));var rimraf=require(_0xe6d5('0x2'));var zipdir=require(_0xe6d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6d5('0x4'));var moment=require(_0xe6d5('0x5'));var BPromise=require(_0xe6d5('0x6'));var Mustache=require(_0xe6d5('0x7'));var util=require(_0xe6d5('0x8'));var path=require(_0xe6d5('0x9'));var sox=require(_0xe6d5('0xa'));var csv=require('to-csv');var ejs=require(_0xe6d5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe6d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6d5('0xd'));var Papa=require(_0xe6d5('0xe'));var Redis=require(_0xe6d5('0xf'));var authService=require(_0xe6d5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d5('0x11'));var hardwareService=require(_0xe6d5('0x12'));var logger=require(_0xe6d5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe6d5('0x14'));var licenseUtil=require(_0xe6d5('0x15'));var db=require(_0xe6d5('0x16'))['db'];function respondWithStatusCode(_0x35455a,_0x3b1948){_0x3b1948=_0x3b1948||0xcc;return function(_0x24c8f9){if(_0x24c8f9){return _0x35455a[_0xe6d5('0x17')](_0x3b1948);}return _0x35455a['status'](_0x3b1948)[_0xe6d5('0x18')]();};}function respondWithResult(_0x188ca1,_0x317352){_0x317352=_0x317352||0xc8;return function(_0x32dbdb){if(_0x32dbdb){return _0x188ca1[_0xe6d5('0x19')](_0x317352)[_0xe6d5('0x1a')](_0x32dbdb);}};}function respondWithFilteredResult(_0x35599f,_0x37ff40){return function(_0x3c7b7a){if(_0x3c7b7a){var _0x49adf8=_0x3c7b7a['count'],_0x2a8aa7=_0x37ff40[_0xe6d5('0x1b')],_0x2adb34=_0x37ff40[_0xe6d5('0x1b')]+_0x37ff40['limit'],_0x268ced;if(_0x2adb34>=_0x49adf8){_0x2adb34=_0x49adf8;_0x268ced=0xc8;}else{_0x268ced=0xce;}_0x35599f[_0xe6d5('0x19')](_0x268ced);return _0x35599f['set'](_0xe6d5('0x1c'),_0x2a8aa7+'-'+_0x2adb34+'/'+_0x49adf8)['json'](_0x3c7b7a);}return null;};}function patchUpdates(_0x4d2fd2){return function(_0x3d9ccb){try{jsonpatch['apply'](_0x3d9ccb,_0x4d2fd2,!![]);}catch(_0x35c3ee){return BPromise[_0xe6d5('0x1d')](_0x35c3ee);}return _0x3d9ccb[_0xe6d5('0x1e')]();};}function saveUpdates(_0x542db8,_0x480e7a){return function(_0xe35cc4){if(_0xe35cc4){return _0xe35cc4[_0xe6d5('0x1f')](_0x542db8)[_0xe6d5('0x20')](function(_0x10ea01){return _0x10ea01;});}return null;};}function removeEntity(_0x27d667,_0x569fc6){return function(_0x19e2b4){if(_0x19e2b4){return _0x19e2b4[_0xe6d5('0x21')]()['then'](function(){_0x27d667[_0xe6d5('0x19')](0xcc)[_0xe6d5('0x18')]();});}};}function handleEntityNotFound(_0x150aaf,_0x49bd97){return function(_0x1fdacf){if(!_0x1fdacf){_0x150aaf[_0xe6d5('0x17')](0x194);}return _0x1fdacf;};}function handleError(_0x11af80,_0x32bd59){_0x32bd59=_0x32bd59||0x1f4;return function(_0x1be7b0){logger[_0xe6d5('0x22')](_0x1be7b0[_0xe6d5('0x23')]);if(_0x1be7b0[_0xe6d5('0x24')]){delete _0x1be7b0['name'];}_0x11af80[_0xe6d5('0x19')](_0x32bd59)[_0xe6d5('0x25')](_0x1be7b0);};}exports[_0xe6d5('0x26')]=function(_0x2e4bde,_0x543934){var _0x3c90dc={},_0x4a4b27={},_0x21ba91={'count':0x0,'rows':[]};var _0x20e1b4=_['map'](db[_0xe6d5('0x27')]['rawAttributes'],function(_0x4377bc){return{'name':_0x4377bc[_0xe6d5('0x28')],'type':_0x4377bc[_0xe6d5('0x29')][_0xe6d5('0x2a')]};});_0x4a4b27[_0xe6d5('0x2b')]=_[_0xe6d5('0x2c')](_0x20e1b4,_0xe6d5('0x24'));_0x4a4b27['query']=_[_0xe6d5('0x2d')](_0x2e4bde[_0xe6d5('0x2e')]);_0x4a4b27[_0xe6d5('0x2f')]=_[_0xe6d5('0x30')](_0x4a4b27['model'],_0x4a4b27[_0xe6d5('0x2e')]);_0x3c90dc[_0xe6d5('0x31')]=_['intersection'](_0x4a4b27[_0xe6d5('0x2b')],qs['fields'](_0x2e4bde[_0xe6d5('0x2e')]['fields']));_0x3c90dc[_0xe6d5('0x31')]=_0x3c90dc['attributes'][_0xe6d5('0x32')]?_0x3c90dc[_0xe6d5('0x31')]:_0x4a4b27[_0xe6d5('0x2b')];if(!_0x2e4bde[_0xe6d5('0x2e')]['hasOwnProperty'](_0xe6d5('0x33'))){_0x3c90dc[_0xe6d5('0x34')]=qs['limit'](_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x34')]);_0x3c90dc['offset']=qs[_0xe6d5('0x1b')](_0x2e4bde[_0xe6d5('0x2e')]['offset']);}_0x3c90dc[_0xe6d5('0x35')]=qs[_0xe6d5('0x36')](_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x36')]);_0x3c90dc[_0xe6d5('0x37')]=qs[_0xe6d5('0x2f')](_[_0xe6d5('0x38')](_0x2e4bde[_0xe6d5('0x2e')],_0x4a4b27['filters']),_0x20e1b4);if(_0x2e4bde['query'][_0xe6d5('0x39')]){_0x3c90dc[_0xe6d5('0x37')]=_[_0xe6d5('0x3a')](_0x3c90dc[_0xe6d5('0x37')],{'$or':_[_0xe6d5('0x2c')](_0x20e1b4,function(_0x4f604d){if(_0x4f604d[_0xe6d5('0x29')]!==_0xe6d5('0x3b')){var _0x7cc756={};_0x7cc756[_0x4f604d[_0xe6d5('0x24')]]={'$like':'%'+_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x39')]+'%'};return _0x7cc756;}})});}_0x3c90dc=_[_0xe6d5('0x3a')]({},_0x3c90dc,_0x2e4bde[_0xe6d5('0x3c')]);var _0x46fd58={'where':_0x3c90dc[_0xe6d5('0x37')]};return db[_0xe6d5('0x27')][_0xe6d5('0x3d')](_0x46fd58)[_0xe6d5('0x20')](function(_0xc90dfc){_0x21ba91[_0xe6d5('0x3d')]=_0xc90dfc;if(_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x3e')]){_0x3c90dc[_0xe6d5('0x3f')]=[{'all':!![]}];}return db[_0xe6d5('0x27')]['findAll'](_0x3c90dc);})[_0xe6d5('0x20')](function(_0xac9be2){_0x21ba91[_0xe6d5('0x40')]=_0xac9be2;return _0x21ba91;})[_0xe6d5('0x20')](respondWithFilteredResult(_0x543934,_0x3c90dc))[_0xe6d5('0x41')](handleError(_0x543934,null));};exports[_0xe6d5('0x42')]=function(_0x242c2e,_0x31ff1a){var _0x1e543e={'raw':!![],'where':{'id':_0x242c2e['params']['id']}},_0x4370fb={};_0x4370fb['model']=_[_0xe6d5('0x2d')](db['SquareReport']['rawAttributes']);_0x4370fb[_0xe6d5('0x2e')]=_[_0xe6d5('0x2d')](_0x242c2e[_0xe6d5('0x2e')]);_0x4370fb[_0xe6d5('0x2f')]=_[_0xe6d5('0x30')](_0x4370fb[_0xe6d5('0x2b')],_0x4370fb['query']);_0x1e543e[_0xe6d5('0x31')]=_['intersection'](_0x4370fb[_0xe6d5('0x2b')],qs[_0xe6d5('0x43')](_0x242c2e['query'][_0xe6d5('0x43')]));_0x1e543e['attributes']=_0x1e543e['attributes'][_0xe6d5('0x32')]?_0x1e543e['attributes']:_0x4370fb[_0xe6d5('0x2b')];if(_0x242c2e[_0xe6d5('0x2e')][_0xe6d5('0x3e')]){_0x1e543e['include']=[{'all':!![]}];}_0x1e543e=_[_0xe6d5('0x3a')]({},_0x1e543e,_0x242c2e[_0xe6d5('0x3c')]);return db[_0xe6d5('0x27')][_0xe6d5('0x44')](_0x1e543e)[_0xe6d5('0x20')](handleEntityNotFound(_0x31ff1a,null))['then'](respondWithResult(_0x31ff1a,null))[_0xe6d5('0x41')](handleError(_0x31ff1a,null));};exports[_0xe6d5('0x45')]=function(_0xf82a13,_0x5effad){return db[_0xe6d5('0x27')][_0xe6d5('0x45')](_0xf82a13['body'],{})[_0xe6d5('0x20')](respondWithResult(_0x5effad,0xc9))[_0xe6d5('0x41')](handleError(_0x5effad,null));};exports[_0xe6d5('0x1f')]=function(_0x3a805b,_0x5a9fd7){if(_0x3a805b['body']['id']){delete _0x3a805b['body']['id'];}return db[_0xe6d5('0x27')][_0xe6d5('0x44')]({'where':{'id':_0x3a805b[_0xe6d5('0x46')]['id']}})[_0xe6d5('0x20')](handleEntityNotFound(_0x5a9fd7,null))[_0xe6d5('0x20')](saveUpdates(_0x3a805b['body'],null))[_0xe6d5('0x20')](respondWithResult(_0x5a9fd7,null))[_0xe6d5('0x41')](handleError(_0x5a9fd7,null));};exports[_0xe6d5('0x21')]=function(_0x5a8bcb,_0x1d5281){return db[_0xe6d5('0x27')][_0xe6d5('0x44')]({'where':{'id':_0x5a8bcb[_0xe6d5('0x46')]['id']}})[_0xe6d5('0x20')](handleEntityNotFound(_0x1d5281,null))['then'](removeEntity(_0x1d5281,null))[_0xe6d5('0x41')](handleError(_0x1d5281,null));};exports[_0xe6d5('0x47')]=function(_0x49f3d9,_0xfd9c2c){return db[_0xe6d5('0x27')][_0xe6d5('0x47')]()[_0xe6d5('0x20')](respondWithResult(_0xfd9c2c,null))[_0xe6d5('0x41')](handleError(_0xfd9c2c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 133cde1..1d5f3ac 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 _0xd87d=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','define','report_square'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0xd87d,0x1e4));var _0xdd87=function(_0xc290eb,_0x4bb6c4){_0xc290eb=_0xc290eb-0x0;var _0x45b953=_0xd87d[_0xc290eb];return _0x45b953;};'use strict';var _=require(_0xdd87('0x0'));var util=require(_0xdd87('0x1'));var logger=require(_0xdd87('0x2'))(_0xdd87('0x3'));var moment=require(_0xdd87('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd87('0x5'));var rimraf=require(_0xdd87('0x6'));var config=require(_0xdd87('0x7'));var attributes=require(_0xdd87('0x8'));module['exports']=function(_0x1aae5,_0x21c2dc){return _0x1aae5[_0xdd87('0x9')]('SquareReport',attributes,{'tableName':_0xdd87('0xa'),'paranoid':![],'indexes':[{'name':_0xdd87('0xb'),'fields':[_0xdd87('0xc'),_0xdd87('0xd')]},{'name':_0xdd87('0xe'),'fields':[_0xdd87('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x839b=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','leaveAt','util'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x839b,0x192));var _0xb839=function(_0x1b7181,_0x17403d){_0x1b7181=_0x1b7181-0x0;var _0x5b165d=_0x839b[_0x1b7181];return _0x5b165d;};'use strict';var _=require('lodash');var util=require(_0xb839('0x0'));var logger=require(_0xb839('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb839('0x2'));var rp=require(_0xb839('0x3'));var fs=require('fs');var path=require(_0xb839('0x4'));var rimraf=require(_0xb839('0x5'));var config=require(_0xb839('0x6'));var attributes=require(_0xb839('0x7'));module[_0xb839('0x8')]=function(_0x463ef1,_0x162f9d){return _0x463ef1[_0xb839('0x9')](_0xb839('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xb839('0xb'),'fields':['uniqueid','project_name']},{'name':_0xb839('0xc'),'fields':[_0xb839('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0702376..795db42 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 _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','update','raw','where','limit','UpdateSquareReport','lodash','util','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x55ca[_0x2a7b8e];return _0x29b5c8;};'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')]('SquareReport,\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')]('SquareReport,\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')](_0x24783b[_0xa55c('0x1a')],{'raw':_0x24783b[_0xa55c('0x1b')]?_0x24783b['options']['raw']===undefined?!![]:![]:!![]})[_0xa55c('0xb')](function(_0x3776ac){logger[_0xa55c('0x14')]('CreateSquareReport',_0x24783b);logger[_0xa55c('0xe')](_0xa55c('0x17'),_0x24783b,JSON['stringify'](_0x3776ac));_0x3d4c9e(_0x3776ac);})[_0xa55c('0x16')](function(_0x133096){logger[_0xa55c('0x11')](_0xa55c('0x17'),_0x133096[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c['error'](0x1f4,_0x133096[_0xa55c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5ba836){var _0x59d89a=this;return new Promise(function(_0x19ae88,_0x54b038){return db[_0xa55c('0x18')][_0xa55c('0x1c')](_0x5ba836[_0xa55c('0x1a')],{'raw':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1e')]||null:null,'attributes':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')]['attributes']||null:null,'limit':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1f')]||null:null})[_0xa55c('0xb')](function(_0x5d940d){logger[_0xa55c('0x14')](_0xa55c('0x20'),_0x5ba836);logger[_0xa55c('0xe')](_0xa55c('0x20'),_0x5ba836,JSON[_0xa55c('0x10')](_0x5d940d));_0x19ae88(_0x5d940d);})[_0xa55c('0x16')](function(_0x52d37f){logger[_0xa55c('0x11')]('UpdateSquareReport',_0x52d37f[_0xa55c('0x13')],_0x5ba836);_0x54b038(_0x59d89a[_0xa55c('0x11')](0x1f4,_0x52d37f[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x9c5a=['stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x72a767,_0x59bdb1){_0x72a767=_0x72a767-0x0;var _0x19b82b=_0x9c5a[_0x72a767];return _0x19b82b;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('SquareReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});}exports[_0xa9c5('0x14')]=function(_0x1142d9){var _0x2b9ac5=this;return new Promise(function(_0x3b8cf7,_0x452a9b){return db[_0xa9c5('0x15')][_0xa9c5('0x16')](_0x1142d9[_0xa9c5('0x17')],{'raw':_0x1142d9[_0xa9c5('0x18')]?_0x1142d9[_0xa9c5('0x18')][_0xa9c5('0x19')]===undefined?!![]:![]:!![]})[_0xa9c5('0xa')](function(_0x54f8b9){logger[_0xa9c5('0x11')](_0xa9c5('0x14'),_0x1142d9);logger['debug']('CreateSquareReport',_0x1142d9,JSON[_0xa9c5('0xd')](_0x54f8b9));_0x3b8cf7(_0x54f8b9);})[_0xa9c5('0x13')](function(_0x10b208){logger[_0xa9c5('0xe')](_0xa9c5('0x14'),_0x10b208[_0xa9c5('0x10')],_0x1142d9);_0x452a9b(_0x2b9ac5['error'](0x1f4,_0x10b208['message']));});});};exports[_0xa9c5('0x1a')]=function(_0x11d395){var _0x4b0f05=this;return new Promise(function(_0x6819b3,_0x424b4c){return db[_0xa9c5('0x15')][_0xa9c5('0x1b')](_0x11d395[_0xa9c5('0x17')],{'raw':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d395['options']?_0x11d395[_0xa9c5('0x18')]['where']||null:null,'attributes':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['attributes']||null:null,'limit':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['limit']||null:null})[_0xa9c5('0xa')](function(_0x32baf9){logger[_0xa9c5('0x11')](_0xa9c5('0x1a'),_0x11d395);logger[_0xa9c5('0x1c')]('UpdateSquareReport',_0x11d395,JSON[_0xa9c5('0xd')](_0x32baf9));_0x6819b3(_0x32baf9);})['catch'](function(_0x3c3da7){logger[_0xa9c5('0xe')](_0xa9c5('0x1a'),_0x3c3da7['message'],_0x11d395);_0x424b4c(_0x4b0f05[_0xa9c5('0xe')](0x1f4,_0x3c3da7[_0xa9c5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c0397e7..a447200 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(_0x5f10c9,_0x375acb){var _0x297815=function(_0x4c2781){while(--_0x4c2781){_0x5f10c9['push'](_0x5f10c9['shift']());}};_0x297815(++_0x375acb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x313a5f,_0x4a4342){_0x313a5f=_0x313a5f-0x0;var _0x24e749=_0x5f2f[_0x313a5f];return _0x24e749;};'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 _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(_0x45af42,_0x5e67b0){var _0x6c1c8f=function(_0x390e32){while(--_0x390e32){_0x45af42['push'](_0x45af42['shift']());}};_0x6c1c8f(++_0x5e67b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1210a3,_0x123054){_0x1210a3=_0x1210a3-0x0;var _0x7aa841=_0x5f2f[_0x1210a3];return _0x7aa841;};'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 diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6d2620a..5376501 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 _0xf9e3=['exports','STRING','TEXT','sequelize'];(function(_0x1d8387,_0xd6a8d6){var _0x1eb713=function(_0x5752c8){while(--_0x5752c8){_0x1d8387['push'](_0x1d8387['shift']());}};_0x1eb713(++_0xd6a8d6);}(_0xf9e3,0x1eb));var _0x3f9e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf9e3[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x3f9e('0x0'));module[_0x3f9e('0x1')]={'uniqueid':{'type':Sequelize[_0x3f9e('0x2')]},'node':{'type':Sequelize[_0x3f9e('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3f9e('0x3')]},'project_name':{'type':Sequelize[_0x3f9e('0x2')]},'callerid':{'type':Sequelize[_0x3f9e('0x2')]}}; \ No newline at end of file +var _0x7d6a=['exports','STRING','TEXT','sequelize'];(function(_0x3ad014,_0x1df303){var _0x47eff0=function(_0x580f2a){while(--_0x580f2a){_0x3ad014['push'](_0x3ad014['shift']());}};_0x47eff0(++_0x1df303);}(_0x7d6a,0x1a3));var _0xa7d6=function(_0x484652,_0x9f771f){_0x484652=_0x484652-0x0;var _0x5c3e01=_0x7d6a[_0x484652];return _0x5c3e01;};'use strict';var Sequelize=require(_0xa7d6('0x0'));module[_0xa7d6('0x1')]={'uniqueid':{'type':Sequelize[_0xa7d6('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xa7d6('0x2')]},'data':{'type':Sequelize[_0xa7d6('0x3')]},'project_name':{'type':Sequelize[_0xa7d6('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7050fd5..7b0fe67 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 _0xf2e3=['describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','SquareDetailsReport','findAll','rows','params','includeAll','find','catch','create','body'];(function(_0x365abc,_0x15dc0f){var _0x58c8ca=function(_0x4d720d){while(--_0x4d720d){_0x365abc['push'](_0x365abc['shift']());}};_0x58c8ca(++_0x15dc0f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf2e3[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require(_0x3f2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f2e('0x1'));var zipdir=require(_0x3f2e('0x2'));var jsonpatch=require(_0x3f2e('0x3'));var rp=require(_0x3f2e('0x4'));var moment=require(_0x3f2e('0x5'));var BPromise=require(_0x3f2e('0x6'));var Mustache=require(_0x3f2e('0x7'));var util=require(_0x3f2e('0x8'));var path=require(_0x3f2e('0x9'));var sox=require('sox');var csv=require(_0x3f2e('0xa'));var ejs=require(_0x3f2e('0xb'));var fs=require('fs');var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0xa'));var querystring=require(_0x3f2e('0x11'));var Papa=require(_0x3f2e('0x12'));var Redis=require(_0x3f2e('0x13'));var authService=require(_0x3f2e('0x14'));var qs=require(_0x3f2e('0x15'));var as=require(_0x3f2e('0x16'));var hardwareService=require(_0x3f2e('0x17'));var logger=require(_0x3f2e('0x18'))(_0x3f2e('0x19'));var utils=require(_0x3f2e('0x1a'));var config=require(_0x3f2e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1c'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1d')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9)[_0x3f2e('0x1f')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1e')](_0x57cba7)[_0x3f2e('0x20')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=_0x218b44[_0x3f2e('0x21')],_0x2c4feb=_0x43f69e[_0x3f2e('0x22')],_0x1dc5d0=_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x23')],_0x2fef73;if(_0x1dc5d0>=_0x17ef58){_0x1dc5d0=_0x17ef58;_0x2fef73=0xc8;}else{_0x2fef73=0xce;}_0x4f2e38[_0x3f2e('0x1e')](_0x2fef73);return _0x4f2e38['set'](_0x3f2e('0x24'),_0x2c4feb+'-'+_0x1dc5d0+'/'+_0x17ef58)[_0x3f2e('0x20')](_0x218b44);}return null;};}function patchUpdates(_0x38925f){return function(_0xbe899c){try{jsonpatch[_0x3f2e('0x25')](_0xbe899c,_0x38925f,!![]);}catch(_0x4eb1e7){return BPromise['reject'](_0x4eb1e7);}return _0xbe899c[_0x3f2e('0x26')]();};}function saveUpdates(_0x11f84c,_0x38bbae){return function(_0x2ac500){if(_0x2ac500){return _0x2ac500[_0x3f2e('0x27')](_0x11f84c)[_0x3f2e('0x28')](function(_0x552443){return _0x552443;});}return null;};}function removeEntity(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['destroy']()['then'](function(){_0x5a7047[_0x3f2e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8c67,_0x401ed9){return function(_0x515e32){if(!_0x515e32){_0x1b8c67['sendStatus'](0x194);}return _0x515e32;};}function handleError(_0x52803d,_0x265bf1){_0x265bf1=_0x265bf1||0x1f4;return function(_0x3d7631){logger['error'](_0x3d7631[_0x3f2e('0x29')]);if(_0x3d7631['name']){delete _0x3d7631[_0x3f2e('0x2a')];}_0x52803d['status'](_0x265bf1)[_0x3f2e('0x2b')](_0x3d7631);};}exports[_0x3f2e('0x2c')]=function(_0x12926e,_0x9c6c34){var _0x11bad1={},_0x4799d3={},_0x426d68={'count':0x0,'rows':[]};var _0x28ef64=_['map'](db['SquareDetailsReport'][_0x3f2e('0x2d')],function(_0x1e5db4){return{'name':_0x1e5db4[_0x3f2e('0x2e')],'type':_0x1e5db4[_0x3f2e('0x2f')]['key']};});_0x4799d3[_0x3f2e('0x30')]=_[_0x3f2e('0x31')](_0x28ef64,_0x3f2e('0x2a'));_0x4799d3['query']=_[_0x3f2e('0x32')](_0x12926e[_0x3f2e('0x33')]);_0x4799d3[_0x3f2e('0x34')]=_['intersection'](_0x4799d3[_0x3f2e('0x30')],_0x4799d3[_0x3f2e('0x33')]);_0x11bad1[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x4799d3[_0x3f2e('0x30')],qs[_0x3f2e('0x37')](_0x12926e['query'][_0x3f2e('0x37')]));_0x11bad1[_0x3f2e('0x35')]=_0x11bad1[_0x3f2e('0x35')][_0x3f2e('0x38')]?_0x11bad1[_0x3f2e('0x35')]:_0x4799d3[_0x3f2e('0x30')];if(!_0x12926e[_0x3f2e('0x33')]['hasOwnProperty'](_0x3f2e('0x39'))){_0x11bad1[_0x3f2e('0x23')]=qs[_0x3f2e('0x23')](_0x12926e[_0x3f2e('0x33')]['limit']);_0x11bad1['offset']=qs[_0x3f2e('0x22')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x22')]);}_0x11bad1[_0x3f2e('0x3a')]=qs[_0x3f2e('0x3b')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3b')]);_0x11bad1[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_[_0x3f2e('0x3d')](_0x12926e['query'],_0x4799d3[_0x3f2e('0x34')]),_0x28ef64);if(_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3e')]){_0x11bad1[_0x3f2e('0x3c')]=_['merge'](_0x11bad1[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x31')](_0x28ef64,function(_0x3f41af){if(_0x3f41af[_0x3f2e('0x2f')]!==_0x3f2e('0x3f')){var _0x69f940={};_0x69f940[_0x3f41af[_0x3f2e('0x2a')]]={'$like':'%'+_0x12926e[_0x3f2e('0x33')]['filter']+'%'};return _0x69f940;}})});}_0x11bad1=_[_0x3f2e('0x40')]({},_0x11bad1,_0x12926e[_0x3f2e('0x41')]);var _0x238b6b={'where':_0x11bad1[_0x3f2e('0x3c')]};return db['SquareDetailsReport'][_0x3f2e('0x21')](_0x238b6b)[_0x3f2e('0x28')](function(_0x4cb56b){_0x426d68[_0x3f2e('0x21')]=_0x4cb56b;if(_0x12926e[_0x3f2e('0x33')]['includeAll']){_0x11bad1[_0x3f2e('0x42')]=[{'all':!![]}];}return db[_0x3f2e('0x43')][_0x3f2e('0x44')](_0x11bad1);})[_0x3f2e('0x28')](function(_0x59e383){_0x426d68[_0x3f2e('0x45')]=_0x59e383;return _0x426d68;})[_0x3f2e('0x28')](respondWithFilteredResult(_0x9c6c34,_0x11bad1))['catch'](handleError(_0x9c6c34,null));};exports['show']=function(_0x2be69f,_0x23de01){var _0xe67d03={'raw':!![],'where':{'id':_0x2be69f[_0x3f2e('0x46')]['id']}},_0x5b5dc2={};_0x5b5dc2[_0x3f2e('0x30')]=_[_0x3f2e('0x32')](db[_0x3f2e('0x43')][_0x3f2e('0x2d')]);_0x5b5dc2[_0x3f2e('0x33')]=_[_0x3f2e('0x32')](_0x2be69f[_0x3f2e('0x33')]);_0x5b5dc2[_0x3f2e('0x34')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],_0x5b5dc2['query']);_0xe67d03[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],qs['fields'](_0x2be69f[_0x3f2e('0x33')][_0x3f2e('0x37')]));_0xe67d03[_0x3f2e('0x35')]=_0xe67d03['attributes'][_0x3f2e('0x38')]?_0xe67d03[_0x3f2e('0x35')]:_0x5b5dc2[_0x3f2e('0x30')];if(_0x2be69f['query'][_0x3f2e('0x47')]){_0xe67d03[_0x3f2e('0x42')]=[{'all':!![]}];}_0xe67d03=_[_0x3f2e('0x40')]({},_0xe67d03,_0x2be69f['options']);return db[_0x3f2e('0x43')][_0x3f2e('0x48')](_0xe67d03)[_0x3f2e('0x28')](handleEntityNotFound(_0x23de01,null))['then'](respondWithResult(_0x23de01,null))[_0x3f2e('0x49')](handleError(_0x23de01,null));};exports['create']=function(_0x3dc995,_0x538a4f){return db['SquareDetailsReport'][_0x3f2e('0x4a')](_0x3dc995[_0x3f2e('0x4b')],{})[_0x3f2e('0x28')](respondWithResult(_0x538a4f,0xc9))[_0x3f2e('0x49')](handleError(_0x538a4f,null));};exports[_0x3f2e('0x27')]=function(_0x5c9cda,_0x5e2abd){if(_0x5c9cda[_0x3f2e('0x4b')]['id']){delete _0x5c9cda[_0x3f2e('0x4b')]['id'];}return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x5c9cda[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5e2abd,null))[_0x3f2e('0x28')](saveUpdates(_0x5c9cda[_0x3f2e('0x4b')],null))[_0x3f2e('0x28')](respondWithResult(_0x5e2abd,null))['catch'](handleError(_0x5e2abd,null));};exports['destroy']=function(_0x2fe0c3,_0x5bdea1){return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x2fe0c3[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5bdea1,null))['then'](removeEntity(_0x5bdea1,null))[_0x3f2e('0x49')](handleError(_0x5bdea1,null));};exports['describe']=function(_0x1ec348,_0x7ed57d){return db['SquareDetailsReport'][_0x3f2e('0x4c')]()['then'](respondWithResult(_0x7ed57d,null))[_0x3f2e('0x49')](handleError(_0x7ed57d,null));}; \ No newline at end of file +var _0x689b=['merge','VIRTUAL','options','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0x209cf1,_0x2de964){var _0x5486ce=function(_0x12edbe){while(--_0x12edbe){_0x209cf1['push'](_0x209cf1['shift']());}};_0x5486ce(++_0x2de964);}(_0x689b,0x142));var _0xb689=function(_0x240078,_0x449e05){_0x240078=_0x240078-0x0;var _0x4c936f=_0x689b[_0x240078];return _0x4c936f;};'use strict';var pdf=require(_0xb689('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb689('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb689('0x2'));var moment=require(_0xb689('0x3'));var BPromise=require(_0xb689('0x4'));var Mustache=require(_0xb689('0x5'));var util=require(_0xb689('0x6'));var path=require(_0xb689('0x7'));var sox=require(_0xb689('0x8'));var csv=require('to-csv');var ejs=require(_0xb689('0x9'));var fs=require('fs');var _=require(_0xb689('0xa'));var squel=require(_0xb689('0xb'));var crypto=require(_0xb689('0xc'));var jsforce=require(_0xb689('0xd'));var deskjs=require(_0xb689('0xe'));var toCsv=require(_0xb689('0xf'));var querystring=require('querystring');var Papa=require(_0xb689('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb689('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb689('0x12'));var logger=require('../../config/logger')(_0xb689('0x13'));var utils=require(_0xb689('0x14'));var config=require(_0xb689('0x15'));var licenseUtil=require(_0xb689('0x16'));var db=require(_0xb689('0x17'))['db'];function respondWithStatusCode(_0x3b8460,_0x18a8f6){_0x18a8f6=_0x18a8f6||0xcc;return function(_0x3160a7){if(_0x3160a7){return _0x3b8460[_0xb689('0x18')](_0x18a8f6);}return _0x3b8460['status'](_0x18a8f6)[_0xb689('0x19')]();};}function respondWithResult(_0x320640,_0xa8ddb){_0xa8ddb=_0xa8ddb||0xc8;return function(_0x45f044){if(_0x45f044){return _0x320640[_0xb689('0x1a')](_0xa8ddb)[_0xb689('0x1b')](_0x45f044);}};}function respondWithFilteredResult(_0x59094e,_0xf09cd4){return function(_0x1ec1b4){if(_0x1ec1b4){var _0x5f2456=_0x1ec1b4['count'],_0x23a825=_0xf09cd4['offset'],_0x51647d=_0xf09cd4[_0xb689('0x1c')]+_0xf09cd4[_0xb689('0x1d')],_0xf950eb;if(_0x51647d>=_0x5f2456){_0x51647d=_0x5f2456;_0xf950eb=0xc8;}else{_0xf950eb=0xce;}_0x59094e['status'](_0xf950eb);return _0x59094e[_0xb689('0x1e')]('Content-Range',_0x23a825+'-'+_0x51647d+'/'+_0x5f2456)[_0xb689('0x1b')](_0x1ec1b4);}return null;};}function patchUpdates(_0x4dfd1b){return function(_0x3091eb){try{jsonpatch[_0xb689('0x1f')](_0x3091eb,_0x4dfd1b,!![]);}catch(_0x27fe5a){return BPromise[_0xb689('0x20')](_0x27fe5a);}return _0x3091eb[_0xb689('0x21')]();};}function saveUpdates(_0x4a9b09,_0x36000e){return function(_0xdd8dcd){if(_0xdd8dcd){return _0xdd8dcd['update'](_0x4a9b09)[_0xb689('0x22')](function(_0x3419cb){return _0x3419cb;});}return null;};}function removeEntity(_0x5a1970,_0x5aea04){return function(_0x404435){if(_0x404435){return _0x404435[_0xb689('0x23')]()[_0xb689('0x22')](function(){_0x5a1970[_0xb689('0x1a')](0xcc)[_0xb689('0x19')]();});}};}function handleEntityNotFound(_0x1db07b,_0x17a31d){return function(_0xba2b33){if(!_0xba2b33){_0x1db07b[_0xb689('0x18')](0x194);}return _0xba2b33;};}function handleError(_0x1a9cf6,_0xf821f2){_0xf821f2=_0xf821f2||0x1f4;return function(_0x3855b6){logger[_0xb689('0x24')](_0x3855b6[_0xb689('0x25')]);if(_0x3855b6[_0xb689('0x26')]){delete _0x3855b6['name'];}_0x1a9cf6[_0xb689('0x1a')](_0xf821f2)[_0xb689('0x27')](_0x3855b6);};}exports[_0xb689('0x28')]=function(_0x134db6,_0x2dca44){var _0x1e9cdd={},_0x3a77fb={},_0x9dc1be={'count':0x0,'rows':[]};var _0x2ad1fa=_['map'](db['SquareDetailsReport'][_0xb689('0x29')],function(_0x363443){return{'name':_0x363443[_0xb689('0x2a')],'type':_0x363443[_0xb689('0x2b')][_0xb689('0x2c')]};});_0x3a77fb[_0xb689('0x2d')]=_[_0xb689('0x2e')](_0x2ad1fa,'name');_0x3a77fb['query']=_['keys'](_0x134db6[_0xb689('0x2f')]);_0x3a77fb[_0xb689('0x30')]=_[_0xb689('0x31')](_0x3a77fb[_0xb689('0x2d')],_0x3a77fb[_0xb689('0x2f')]);_0x1e9cdd[_0xb689('0x32')]=_['intersection'](_0x3a77fb[_0xb689('0x2d')],qs[_0xb689('0x33')](_0x134db6[_0xb689('0x2f')][_0xb689('0x33')]));_0x1e9cdd['attributes']=_0x1e9cdd[_0xb689('0x32')][_0xb689('0x34')]?_0x1e9cdd['attributes']:_0x3a77fb[_0xb689('0x2d')];if(!_0x134db6[_0xb689('0x2f')]['hasOwnProperty'](_0xb689('0x35'))){_0x1e9cdd['limit']=qs[_0xb689('0x1d')](_0x134db6[_0xb689('0x2f')][_0xb689('0x1d')]);_0x1e9cdd['offset']=qs[_0xb689('0x1c')](_0x134db6[_0xb689('0x2f')][_0xb689('0x1c')]);}_0x1e9cdd[_0xb689('0x36')]=qs['sort'](_0x134db6[_0xb689('0x2f')][_0xb689('0x37')]);_0x1e9cdd[_0xb689('0x38')]=qs[_0xb689('0x30')](_['pick'](_0x134db6[_0xb689('0x2f')],_0x3a77fb[_0xb689('0x30')]),_0x2ad1fa);if(_0x134db6['query'][_0xb689('0x39')]){_0x1e9cdd[_0xb689('0x38')]=_[_0xb689('0x3a')](_0x1e9cdd[_0xb689('0x38')],{'$or':_['map'](_0x2ad1fa,function(_0x442860){if(_0x442860[_0xb689('0x2b')]!==_0xb689('0x3b')){var _0x3df38d={};_0x3df38d[_0x442860[_0xb689('0x26')]]={'$like':'%'+_0x134db6[_0xb689('0x2f')]['filter']+'%'};return _0x3df38d;}})});}_0x1e9cdd=_['merge']({},_0x1e9cdd,_0x134db6[_0xb689('0x3c')]);var _0x1b7c63={'where':_0x1e9cdd[_0xb689('0x38')]};return db[_0xb689('0x3d')][_0xb689('0x3e')](_0x1b7c63)[_0xb689('0x22')](function(_0x26ec12){_0x9dc1be['count']=_0x26ec12;if(_0x134db6[_0xb689('0x2f')][_0xb689('0x3f')]){_0x1e9cdd[_0xb689('0x40')]=[{'all':!![]}];}return db[_0xb689('0x3d')][_0xb689('0x41')](_0x1e9cdd);})[_0xb689('0x22')](function(_0x11dab9){_0x9dc1be[_0xb689('0x42')]=_0x11dab9;return _0x9dc1be;})[_0xb689('0x22')](respondWithFilteredResult(_0x2dca44,_0x1e9cdd))[_0xb689('0x43')](handleError(_0x2dca44,null));};exports[_0xb689('0x44')]=function(_0x1d3170,_0x2ba4a2){var _0x59024e={'raw':!![],'where':{'id':_0x1d3170[_0xb689('0x45')]['id']}},_0x56e0f2={};_0x56e0f2['model']=_[_0xb689('0x46')](db[_0xb689('0x3d')][_0xb689('0x29')]);_0x56e0f2['query']=_['keys'](_0x1d3170[_0xb689('0x2f')]);_0x56e0f2['filters']=_[_0xb689('0x31')](_0x56e0f2['model'],_0x56e0f2['query']);_0x59024e[_0xb689('0x32')]=_['intersection'](_0x56e0f2[_0xb689('0x2d')],qs[_0xb689('0x33')](_0x1d3170[_0xb689('0x2f')]['fields']));_0x59024e['attributes']=_0x59024e[_0xb689('0x32')][_0xb689('0x34')]?_0x59024e[_0xb689('0x32')]:_0x56e0f2[_0xb689('0x2d')];if(_0x1d3170[_0xb689('0x2f')][_0xb689('0x3f')]){_0x59024e['include']=[{'all':!![]}];}_0x59024e=_[_0xb689('0x3a')]({},_0x59024e,_0x1d3170[_0xb689('0x3c')]);return db[_0xb689('0x3d')]['find'](_0x59024e)[_0xb689('0x22')](handleEntityNotFound(_0x2ba4a2,null))[_0xb689('0x22')](respondWithResult(_0x2ba4a2,null))['catch'](handleError(_0x2ba4a2,null));};exports[_0xb689('0x47')]=function(_0x18254b,_0x23fa31){return db[_0xb689('0x3d')]['create'](_0x18254b['body'],{})[_0xb689('0x22')](respondWithResult(_0x23fa31,0xc9))[_0xb689('0x43')](handleError(_0x23fa31,null));};exports[_0xb689('0x48')]=function(_0x166c7f,_0x5a3171){if(_0x166c7f[_0xb689('0x49')]['id']){delete _0x166c7f[_0xb689('0x49')]['id'];}return db[_0xb689('0x3d')]['find']({'where':{'id':_0x166c7f[_0xb689('0x45')]['id']}})[_0xb689('0x22')](handleEntityNotFound(_0x5a3171,null))[_0xb689('0x22')](saveUpdates(_0x166c7f[_0xb689('0x49')],null))[_0xb689('0x22')](respondWithResult(_0x5a3171,null))[_0xb689('0x43')](handleError(_0x5a3171,null));};exports['destroy']=function(_0x579790,_0x3ddd01){return db['SquareDetailsReport'][_0xb689('0x4a')]({'where':{'id':_0x579790[_0xb689('0x45')]['id']}})[_0xb689('0x22')](handleEntityNotFound(_0x3ddd01,null))['then'](removeEntity(_0x3ddd01,null))[_0xb689('0x43')](handleError(_0x3ddd01,null));};exports[_0xb689('0x4b')]=function(_0x4df6a4,_0x1eaa4f){return db['SquareDetailsReport'][_0xb689('0x4b')]()[_0xb689('0x22')](respondWithResult(_0x1eaa4f,null))[_0xb689('0x43')](handleError(_0x1eaa4f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4675075..715232f 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 _0x7cbc=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash'];(function(_0x2f7190,_0x12aa73){var _0x1d2f75=function(_0x524256){while(--_0x524256){_0x2f7190['push'](_0x2f7190['shift']());}};_0x1d2f75(++_0x12aa73);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x205899,_0x3794c8){_0x205899=_0x205899-0x0;var _0x17c5a7=_0x7cbc[_0x205899];return _0x17c5a7;};'use strict';var _=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var logger=require(_0xc7cb('0x2'))(_0xc7cb('0x3'));var moment=require('moment');var BPromise=require(_0xc7cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7cb('0x5'));var rimraf=require(_0xc7cb('0x6'));var config=require(_0xc7cb('0x7'));var attributes=require(_0xc7cb('0x8'));module['exports']=function(_0x3819a3,_0x5c0dae){return _0x3819a3[_0xc7cb('0x9')](_0xc7cb('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76f4=['request-promise','path','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','../../config/logger','api','moment','bluebird'];(function(_0x1c1dc4,_0x58f27c){var _0x1a0c35=function(_0x82fc2f){while(--_0x82fc2f){_0x1c1dc4['push'](_0x1c1dc4['shift']());}};_0x1a0c35(++_0x58f27c);}(_0x76f4,0x1e0));var _0x476f=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x76f4[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x476f('0x0'))(_0x476f('0x1'));var moment=require(_0x476f('0x2'));var BPromise=require(_0x476f('0x3'));var rp=require(_0x476f('0x4'));var fs=require('fs');var path=require(_0x476f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x476f('0x6'));module[_0x476f('0x7')]=function(_0x2c9b54,_0x2350d6){return _0x2c9b54[_0x476f('0x8')](_0x476f('0x9'),attributes,{'tableName':_0x476f('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 787ec35..525316e 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 _0x5677=['stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','info','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4936fb,_0x10fda9){var _0x4430ab=function(_0xd722c3){while(--_0xd722c3){_0x4936fb['push'](_0x4936fb['shift']());}};_0x4430ab(++_0x10fda9);}(_0x5677,0x6c));var _0x7567=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x5677[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require(_0x7567('0x0'));var util=require(_0x7567('0x1'));var moment=require('moment');var BPromise=require(_0x7567('0x2'));var rs=require(_0x7567('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7567('0x4'))('rpc');var config=require(_0x7567('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9b007d,_0x16e692,_0x36a7d4){return new BPromise(function(_0x6cdb88,_0x1b5605){return client[_0x7567('0x6')](_0x9b007d,_0x36a7d4)[_0x7567('0x7')](function(_0x293742){logger['info'](_0x7567('0x8'),_0x16e692,'request\x20sent');logger[_0x7567('0x9')](_0x7567('0xa'),_0x16e692,_0x7567('0xb'),JSON[_0x7567('0xc')](_0x293742));if(_0x293742[_0x7567('0xd')]){if(_0x293742[_0x7567('0xd')][_0x7567('0xe')]===0x1f4){logger[_0x7567('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,_0x293742[_0x7567('0xd')][_0x7567('0xf')]);return _0x1b5605(_0x293742[_0x7567('0xd')][_0x7567('0xf')]);}logger[_0x7567('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,_0x293742[_0x7567('0xd')][_0x7567('0xf')]);return _0x6cdb88(_0x293742['error'][_0x7567('0xf')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x16e692,'request\x20sent');_0x6cdb88(_0x293742[_0x7567('0x10')][_0x7567('0xf')]);}})['catch'](function(_0x102d28){logger['error'](_0x7567('0x8'),_0x16e692,_0x102d28);_0x1b5605(_0x102d28);});});}exports[_0x7567('0x11')]=function(_0x50e159){var _0x492b7c=this;return new Promise(function(_0x999d09,_0x1cc8cf){return db[_0x7567('0x12')][_0x7567('0x13')](_0x50e159[_0x7567('0x14')],{'raw':_0x50e159[_0x7567('0x15')]?_0x50e159['options']['raw']===undefined?!![]:![]:!![]})[_0x7567('0x7')](function(_0x2d0d58){logger[_0x7567('0x16')](_0x7567('0x11'),_0x50e159);logger[_0x7567('0x9')](_0x7567('0x11'),_0x50e159,JSON[_0x7567('0xc')](_0x2d0d58));_0x999d09(_0x2d0d58);})[_0x7567('0x17')](function(_0xd20fd4){logger[_0x7567('0xd')]('CreateSquareDetailsReport',_0xd20fd4[_0x7567('0xf')],_0x50e159);_0x1cc8cf(_0x492b7c[_0x7567('0xd')](0x1f4,_0xd20fd4[_0x7567('0xf')]));});});}; \ No newline at end of file +var _0x5593=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x5593,0x1c4));var _0x3559=function(_0x1dda39,_0x221826){_0x1dda39=_0x1dda39-0x0;var _0x269408=_0x5593[_0x1dda39];return _0x269408;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3559('0x0'));var BPromise=require(_0x3559('0x1'));var rs=require(_0x3559('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3559('0x3'))['db'];var utils=require(_0x3559('0x4'));var logger=require(_0x3559('0x5'))(_0x3559('0x6'));var config=require(_0x3559('0x7'));var jayson=require(_0x3559('0x8'));var client=jayson['client'][_0x3559('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa65e,_0x246dd1,_0x51aed6){return new BPromise(function(_0x4159c8,_0x5aa513){return client['request'](_0x2aa65e,_0x51aed6)['then'](function(_0x3af5e5){logger[_0x3559('0xa')](_0x3559('0xb'),_0x246dd1,_0x3559('0xc'));logger[_0x3559('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x246dd1,_0x3559('0xc'),JSON[_0x3559('0xe')](_0x3af5e5));if(_0x3af5e5[_0x3559('0xf')]){if(_0x3af5e5['error']['code']===0x1f4){logger['error'](_0x3559('0xb'),_0x246dd1,_0x3af5e5[_0x3559('0xf')]['message']);return _0x5aa513(_0x3af5e5[_0x3559('0xf')]['message']);}logger[_0x3559('0xf')](_0x3559('0xb'),_0x246dd1,_0x3af5e5[_0x3559('0xf')][_0x3559('0x10')]);return _0x4159c8(_0x3af5e5[_0x3559('0xf')][_0x3559('0x10')]);}else{logger[_0x3559('0xa')](_0x3559('0xb'),_0x246dd1,_0x3559('0xc'));_0x4159c8(_0x3af5e5[_0x3559('0x11')]['message']);}})[_0x3559('0x12')](function(_0x1c4b64){logger[_0x3559('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x246dd1,_0x1c4b64);_0x5aa513(_0x1c4b64);});});}exports[_0x3559('0x13')]=function(_0x4b13c9){var _0x529925=this;return new Promise(function(_0x34875a,_0x7962b2){return db[_0x3559('0x14')][_0x3559('0x15')](_0x4b13c9[_0x3559('0x16')],{'raw':_0x4b13c9[_0x3559('0x17')]?_0x4b13c9[_0x3559('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x17fcc8){logger[_0x3559('0xa')](_0x3559('0x13'),_0x4b13c9);logger['debug'](_0x3559('0x13'),_0x4b13c9,JSON[_0x3559('0xe')](_0x17fcc8));_0x34875a(_0x17fcc8);})[_0x3559('0x12')](function(_0x166e02){logger[_0x3559('0xf')]('CreateSquareDetailsReport',_0x166e02[_0x3559('0x10')],_0x4b13c9);_0x7962b2(_0x529925[_0x3559('0xf')](0x1f4,_0x166e02[_0x3559('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3a4b9ea..49afc97 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 _0xd626=['index','/process/:pid/kill','isAuthenticated','exports','./system.controller'];(function(_0x5efa49,_0x177a05){var _0x4287fc=function(_0x131bd7){while(--_0x131bd7){_0x5efa49['push'](_0x5efa49['shift']());}};_0x4287fc(++_0x177a05);}(_0xd626,0x1a8));var _0x6d62=function(_0x2328a7,_0x3c1e62){_0x2328a7=_0x2328a7-0x0;var _0x17ef7a=_0xd626[_0x2328a7];return _0x17ef7a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x6d62('0x0'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d62('0x1')]);router['get'](_0x6d62('0x2'),auth[_0x6d62('0x3')](),controller['killProcess']);module[_0x6d62('0x4')]=router; \ No newline at end of file +var _0x02d4=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x326c2a,_0x12ed32){var _0x386496=function(_0x47de9d){while(--_0x47de9d){_0x326c2a['push'](_0x326c2a['shift']());}};_0x386496(++_0x12ed32);}(_0x02d4,0x18b));var _0x402d=function(_0x1cc8b2,_0xf292e0){_0x1cc8b2=_0x1cc8b2-0x0;var _0x4f3059=_0x02d4[_0x1cc8b2];return _0x4f3059;};'use strict';var express=require(_0x402d('0x0'));var router=express['Router']();var auth=require(_0x402d('0x1'));var controller=require(_0x402d('0x2'));router[_0x402d('0x3')]('/',auth[_0x402d('0x4')](),controller[_0x402d('0x5')]);router[_0x402d('0x3')](_0x402d('0x6'),auth[_0x402d('0x4')](),controller[_0x402d('0x7')]);module[_0x402d('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 307ef3c..cec27a7 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 _0x8784=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','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','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash'];(function(_0x4b8aaf,_0x7bd566){var _0x21589e=function(_0x2322a6){while(--_0x2322a6){_0x4b8aaf['push'](_0x4b8aaf['shift']());}};_0x21589e(++_0x7bd566);}(_0x8784,0x172));var _0x4878=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x8784[_0xf4666e];return _0x1853f1;};'use strict';var info=require(_0x4878('0x0'));var exec=require(_0x4878('0x1'))['exec'];var logger=require(_0x4878('0x2'))(_0x4878('0x3'));var util=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var _=require(_0x4878('0x6'));function handleError(_0x55969c,_0x509521,_0x101d58){_0x509521=_0x509521||0x1f4;return function(_0x254097){logger[_0x4878('0x7')](_0x4878('0x8'),_0x101d58,_0x509521,util[_0x4878('0x9')](_0x254097,{'showHidden':![],'depth':null}));delete _0x254097[_0x4878('0xa')];_0x55969c[_0x4878('0xb')](_0x509521)[_0x4878('0xc')](_0x254097);};}exports[_0x4878('0xd')]=function(_0x5ea144,_0x10a0cf){return info[_0x4878('0xe')]()[_0x4878('0xf')](function(_0x2b28a8){return _0x10a0cf[_0x4878('0xb')](0xc8)[_0x4878('0x10')](_0x2b28a8);})[_0x4878('0x11')](function(_0xfcbf9e){return _0x10a0cf[_0x4878('0xb')](0x1f4)[_0x4878('0x10')](_0xfcbf9e);});};exports[_0x4878('0x12')]=function(_0x1d5f30,_0x4fdc75){var _0xa3b6c=[_0x4878('0x13')];return new BPromise(function(_0x188e81,_0x566468){return exec(util[_0x4878('0x14')](_0x4878('0x15'),_0x1d5f30['params'][_0x4878('0x16')]),function(_0x5e67cc,_0x4ec9f8,_0x1b9209){if(_0x5e67cc){return _0x566468(_0x5e67cc);}return _0x188e81(_0x4ec9f8);});})[_0x4878('0xf')](function(_0x2b7ccc){var _0x297b43=![];var _0x37a150=_0x2b7ccc['split'](/\n/);for(var _0x27ed83=0x0,_0x25282f=_0xa3b6c['length'];_0x27ed83<_0x25282f,_0x297b43===![];_0x27ed83+=0x1){if(_0x2b7ccc[_0x4878('0x17')](_0xa3b6c[_0x27ed83])>=0x0){_0x297b43=!![];}}if(!_0x297b43){throw new Error(util['format'](_0x4878('0x18'),_0x1d5f30['params']['pid']));}process[_0x4878('0x19')](_0x1d5f30[_0x4878('0x1a')][_0x4878('0x16')],_0x4878('0x1b'));return _0x4fdc75[_0x4878('0xb')](0xc8)['json']({'message':util[_0x4878('0x14')](_0x4878('0x1c'),_0x1d5f30[_0x4878('0x1a')][_0x4878('0x16')])});})[_0x4878('0x11')](handleError(_0x4fdc75,null,_0x4878('0x12')));}; \ No newline at end of file +var _0x2ca0=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','json','status','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','kill','SIGINT','catch','systeminformation','util'];(function(_0x495c65,_0x1325c1){var _0x1e70b9=function(_0x3b2bac){while(--_0x3b2bac){_0x495c65['push'](_0x495c65['shift']());}};_0x1e70b9(++_0x1325c1);}(_0x2ca0,0x143));var _0x02ca=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x2ca0[_0x1ca4c3];return _0x4426a6;};'use strict';var info=require(_0x02ca('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')('api');var util=require(_0x02ca('0x1'));var BPromise=require(_0x02ca('0x2'));var _=require(_0x02ca('0x3'));function handleError(_0x45b705,_0x292047,_0x4cf96f){_0x292047=_0x292047||0x1f4;return function(_0x35cafe){logger[_0x02ca('0x4')](_0x02ca('0x5'),_0x4cf96f,_0x292047,util[_0x02ca('0x6')](_0x35cafe,{'showHidden':![],'depth':null}));delete _0x35cafe[_0x02ca('0x7')];_0x45b705['status'](_0x292047)[_0x02ca('0x8')](_0x35cafe);};}exports[_0x02ca('0x9')]=function(_0x2ce03a,_0x2ef003){return info[_0x02ca('0xa')]()['then'](function(_0x12cec5){return _0x2ef003['status'](0xc8)[_0x02ca('0xb')](_0x12cec5);})['catch'](function(_0x48c2be){return _0x2ef003[_0x02ca('0xc')](0x1f4)['json'](_0x48c2be);});};exports[_0x02ca('0xd')]=function(_0x1d5409,_0x530dd7){var _0x5e95fa=[_0x02ca('0xe')];return new BPromise(function(_0x4b68e1,_0x4bdda1){return exec(util[_0x02ca('0xf')](_0x02ca('0x10'),_0x1d5409[_0x02ca('0x11')][_0x02ca('0x12')]),function(_0x516eea,_0x59bb7f,_0x5b5683){if(_0x516eea){return _0x4bdda1(_0x516eea);}return _0x4b68e1(_0x59bb7f);});})[_0x02ca('0x13')](function(_0x55e8a0){var _0x3e04d8=![];var _0x116b4a=_0x55e8a0[_0x02ca('0x14')](/\n/);for(var _0x5c5c18=0x0,_0x4dbe7e=_0x5e95fa['length'];_0x5c5c18<_0x4dbe7e,_0x3e04d8===![];_0x5c5c18+=0x1){if(_0x55e8a0[_0x02ca('0x15')](_0x5e95fa[_0x5c5c18])>=0x0){_0x3e04d8=!![];}}if(!_0x3e04d8){throw new Error(util[_0x02ca('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1d5409['params'][_0x02ca('0x12')]));}process[_0x02ca('0x16')](_0x1d5409[_0x02ca('0x11')][_0x02ca('0x12')],_0x02ca('0x17'));return _0x530dd7[_0x02ca('0xc')](0xc8)[_0x02ca('0xb')]({'message':util[_0x02ca('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1d5409['params'][_0x02ca('0x12')])});})[_0x02ca('0x18')](handleError(_0x530dd7,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ded868a..675bb96 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 _0x6f0d=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0xc28abb,_0x465bc9){var _0x335a2e=function(_0x121d5d){while(--_0x121d5d){_0xc28abb['push'](_0xc28abb['shift']());}};_0x335a2e(++_0x465bc9);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x171ec7,_0x3a0305){_0x171ec7=_0x171ec7-0x0;var _0x18ee70=_0x6f0d[_0x171ec7];return _0x18ee70;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xf')]);router[_0xd6f0('0x10')]('/:id',auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file +var _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x49e1d5,_0x30d540){var _0x303960=function(_0x39b8a8){while(--_0x39b8a8){_0x49e1d5['push'](_0x49e1d5['shift']());}};_0x303960(++_0x30d540);}(_0x750a,0x140));var _0xa750=function(_0x257abb,_0x3d1d2f){_0x257abb=_0x257abb-0x0;var _0x40ba4c=_0x750a[_0x257abb];return _0x40ba4c;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a5fa4f2..b84f9fe 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 _0x4024=['STRING','sequelize','exports','name'];(function(_0x410565,_0x3f1785){var _0x48f9be=function(_0x28e6ea){while(--_0x28e6ea){_0x410565['push'](_0x410565['shift']());}};_0x48f9be(++_0x3f1785);}(_0x4024,0x89));var _0x4402=function(_0x3ce0e2,_0x18661b){_0x3ce0e2=_0x3ce0e2-0x0;var _0x5dc8f3=_0x4024[_0x3ce0e2];return _0x5dc8f3;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file +var _0xda3f=['exports','STRING'];(function(_0x437a33,_0xcd1d22){var _0x2ab9c8=function(_0x432d6a){while(--_0x432d6a){_0x437a33['push'](_0x437a33['shift']());}};_0x2ab9c8(++_0xcd1d22);}(_0xda3f,0xec));var _0xfda3=function(_0x48da35,_0x1dfbc2){_0x48da35=_0x48da35-0x0;var _0x261f9a=_0xda3f[_0x48da35];return _0x261f9a;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e84af5e..affe7f5 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 _0x62cd=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','apply','reject','save','update','then','destroy','Tags','error','stack','name','send','index','Tag','rawAttributes','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4b3b41,_0x3bf24c){var _0x2000ae=function(_0x975acd){while(--_0x975acd){_0x4b3b41['push'](_0x4b3b41['shift']());}};_0x2000ae(++_0x3bf24c);}(_0x62cd,0x8c));var _0xd62c=function(_0x122315,_0x20a4f6){_0x122315=_0x122315-0x0;var _0x39cd5e=_0x62cd[_0x122315];return _0x39cd5e;};'use strict';var pdf=require(_0xd62c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd62c('0x1'));var zipdir=require(_0xd62c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd62c('0x3'));var BPromise=require(_0xd62c('0x4'));var Mustache=require(_0xd62c('0x5'));var util=require(_0xd62c('0x6'));var path=require('path');var sox=require(_0xd62c('0x7'));var csv=require('to-csv');var ejs=require(_0xd62c('0x8'));var fs=require('fs');var _=require(_0xd62c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd62c('0xa'));var deskjs=require(_0xd62c('0xb'));var toCsv=require(_0xd62c('0xc'));var querystring=require(_0xd62c('0xd'));var Papa=require(_0xd62c('0xe'));var Redis=require(_0xd62c('0xf'));var authService=require(_0xd62c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd62c('0x11'));var hardwareService=require(_0xd62c('0x12'));var logger=require(_0xd62c('0x13'))('api');var utils=require(_0xd62c('0x14'));var config=require(_0xd62c('0x15'));var licenseUtil=require(_0xd62c('0x16'));var db=require(_0xd62c('0x17'))['db'];function respondWithStatusCode(_0x340243,_0x376c12){_0x376c12=_0x376c12||0xcc;return function(_0x2ce20d){if(_0x2ce20d){return _0x340243[_0xd62c('0x18')](_0x376c12);}return _0x340243['status'](_0x376c12)[_0xd62c('0x19')]();};}function respondWithResult(_0x37c575,_0x572834){_0x572834=_0x572834||0xc8;return function(_0x424be1){if(_0x424be1){return _0x37c575[_0xd62c('0x1a')](_0x572834)['json'](_0x424be1);}};}function respondWithFilteredResult(_0x52f707,_0x221868){return function(_0x4c9efe){if(_0x4c9efe){var _0x5243d9=_0x4c9efe[_0xd62c('0x1b')],_0x5e42eb=_0x221868[_0xd62c('0x1c')],_0xf8b905=_0x221868[_0xd62c('0x1c')]+_0x221868[_0xd62c('0x1d')],_0x2c5ff4;if(_0xf8b905>=_0x5243d9){_0xf8b905=_0x5243d9;_0x2c5ff4=0xc8;}else{_0x2c5ff4=0xce;}_0x52f707[_0xd62c('0x1a')](_0x2c5ff4);return _0x52f707[_0xd62c('0x1e')]('Content-Range',_0x5e42eb+'-'+_0xf8b905+'/'+_0x5243d9)['json'](_0x4c9efe);}return null;};}function patchUpdates(_0x1a5208){return function(_0x5712bc){try{jsonpatch[_0xd62c('0x1f')](_0x5712bc,_0x1a5208,!![]);}catch(_0x9ff325){return BPromise[_0xd62c('0x20')](_0x9ff325);}return _0x5712bc[_0xd62c('0x21')]();};}function saveUpdates(_0x45eff5,_0xf986eb){return function(_0x46daa9){if(_0x46daa9){return _0x46daa9[_0xd62c('0x22')](_0x45eff5)[_0xd62c('0x23')](function(_0x51c67f){return _0x51c67f;});}return null;};}function removeEntity(_0x21b4f7,_0x10d8bf){return function(_0x1587ba){if(_0x1587ba){return _0x1587ba[_0xd62c('0x24')]()[_0xd62c('0x23')](function(){var _0x59a64e=_0x1587ba['get']({'plain':!![]});var _0x520f7b=_0xd62c('0x25');return db['UserProfileResource'][_0xd62c('0x24')]({'where':{'type':_0x520f7b,'resourceId':_0x59a64e['id']}})[_0xd62c('0x23')](function(){return _0x1587ba;});})[_0xd62c('0x23')](function(){_0x21b4f7[_0xd62c('0x1a')](0xcc)[_0xd62c('0x19')]();});}};}function handleEntityNotFound(_0x193d56,_0xcc11b4){return function(_0x3d4847){if(!_0x3d4847){_0x193d56[_0xd62c('0x18')](0x194);}return _0x3d4847;};}function handleError(_0xbe1459,_0x3c2894){_0x3c2894=_0x3c2894||0x1f4;return function(_0x2ad658){logger[_0xd62c('0x26')](_0x2ad658[_0xd62c('0x27')]);if(_0x2ad658[_0xd62c('0x28')]){delete _0x2ad658['name'];}_0xbe1459[_0xd62c('0x1a')](_0x3c2894)[_0xd62c('0x29')](_0x2ad658);};}exports[_0xd62c('0x2a')]=function(_0x11dcc2,_0x59109e){var _0x2e772e={},_0x12b77f={},_0x13a2de={'count':0x0,'rows':[]};var _0x37aa6a=_['map'](db[_0xd62c('0x2b')][_0xd62c('0x2c')],function(_0x213509){return{'name':_0x213509['fieldName'],'type':_0x213509['type'][_0xd62c('0x2d')]};});_0x12b77f['model']=_[_0xd62c('0x2e')](_0x37aa6a,_0xd62c('0x28'));_0x12b77f[_0xd62c('0x2f')]=_[_0xd62c('0x30')](_0x11dcc2['query']);_0x12b77f['filters']=_[_0xd62c('0x31')](_0x12b77f[_0xd62c('0x32')],_0x12b77f[_0xd62c('0x2f')]);_0x2e772e[_0xd62c('0x33')]=_[_0xd62c('0x31')](_0x12b77f['model'],qs['fields'](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x34')]));_0x2e772e[_0xd62c('0x33')]=_0x2e772e[_0xd62c('0x33')][_0xd62c('0x35')]?_0x2e772e[_0xd62c('0x33')]:_0x12b77f[_0xd62c('0x32')];if(!_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x36')](_0xd62c('0x37'))){_0x2e772e['limit']=qs['limit'](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x1d')]);_0x2e772e['offset']=qs[_0xd62c('0x1c')](_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x1c')]);}_0x2e772e[_0xd62c('0x38')]=qs[_0xd62c('0x39')](_0x11dcc2['query'][_0xd62c('0x39')]);_0x2e772e[_0xd62c('0x3a')]=qs[_0xd62c('0x3b')](_['pick'](_0x11dcc2[_0xd62c('0x2f')],_0x12b77f[_0xd62c('0x3b')]),_0x37aa6a);if(_0x11dcc2[_0xd62c('0x2f')][_0xd62c('0x3c')]){_0x2e772e['where']=_[_0xd62c('0x3d')](_0x2e772e[_0xd62c('0x3a')],{'$or':_['map'](_0x37aa6a,function(_0x138a0d){if(_0x138a0d[_0xd62c('0x3e')]!==_0xd62c('0x3f')){var _0x2703ec={};_0x2703ec[_0x138a0d['name']]={'$like':'%'+_0x11dcc2['query'][_0xd62c('0x3c')]+'%'};return _0x2703ec;}})});}_0x2e772e=_[_0xd62c('0x3d')]({},_0x2e772e,_0x11dcc2[_0xd62c('0x40')]);var _0x102102={'where':_0x2e772e[_0xd62c('0x3a')]};return db[_0xd62c('0x2b')][_0xd62c('0x1b')](_0x102102)['then'](function(_0x4e15de){_0x13a2de['count']=_0x4e15de;if(_0x11dcc2[_0xd62c('0x2f')]['includeAll']){_0x2e772e['include']=[{'all':!![]}];}return db[_0xd62c('0x2b')]['findAll'](_0x2e772e);})['then'](function(_0x467e75){_0x13a2de['rows']=_0x467e75;return _0x13a2de;})['then'](respondWithFilteredResult(_0x59109e,_0x2e772e))[_0xd62c('0x41')](handleError(_0x59109e,null));};exports[_0xd62c('0x42')]=function(_0x453fe5,_0x4b06ac){var _0x12ca77={'raw':!![],'where':{'id':_0x453fe5[_0xd62c('0x43')]['id']}},_0x26e91d={};_0x26e91d[_0xd62c('0x32')]=_[_0xd62c('0x30')](db['Tag']['rawAttributes']);_0x26e91d[_0xd62c('0x2f')]=_[_0xd62c('0x30')](_0x453fe5['query']);_0x26e91d['filters']=_[_0xd62c('0x31')](_0x26e91d[_0xd62c('0x32')],_0x26e91d[_0xd62c('0x2f')]);_0x12ca77['attributes']=_['intersection'](_0x26e91d['model'],qs['fields'](_0x453fe5[_0xd62c('0x2f')]['fields']));_0x12ca77[_0xd62c('0x33')]=_0x12ca77[_0xd62c('0x33')][_0xd62c('0x35')]?_0x12ca77[_0xd62c('0x33')]:_0x26e91d[_0xd62c('0x32')];if(_0x453fe5[_0xd62c('0x2f')][_0xd62c('0x44')]){_0x12ca77[_0xd62c('0x45')]=[{'all':!![]}];}_0x12ca77=_['merge']({},_0x12ca77,_0x453fe5[_0xd62c('0x40')]);return db[_0xd62c('0x2b')][_0xd62c('0x46')](_0x12ca77)[_0xd62c('0x23')](handleEntityNotFound(_0x4b06ac,null))['then'](respondWithResult(_0x4b06ac,null))[_0xd62c('0x41')](handleError(_0x4b06ac,null));};exports[_0xd62c('0x47')]=function(_0x55d5cb,_0x982b7a){return db[_0xd62c('0x2b')][_0xd62c('0x47')](_0x55d5cb[_0xd62c('0x48')],{})[_0xd62c('0x23')](function(_0x1a7538){var _0x3308a8=_0x55d5cb[_0xd62c('0x49')][_0xd62c('0x4a')]({'plain':!![]});if(!_0x3308a8)throw new Error(_0xd62c('0x4b'));if(_0x3308a8['role']===_0xd62c('0x49')){var _0x127864=_0x1a7538['get']({'plain':!![]});var _0x55f91e=_0xd62c('0x25');return db[_0xd62c('0x4c')][_0xd62c('0x46')]({'where':{'name':_0x55f91e,'userProfileId':_0x3308a8[_0xd62c('0x4d')]},'raw':!![]})[_0xd62c('0x23')](function(_0x72ec9c){if(_0x72ec9c&&_0x72ec9c[_0xd62c('0x4e')]===0x0){return db['UserProfileResource'][_0xd62c('0x47')]({'name':_0x127864[_0xd62c('0x28')],'resourceId':_0x127864['id'],'type':_0x72ec9c['name'],'sectionId':_0x72ec9c['id']},{})['then'](function(){return _0x1a7538;});}else{return _0x1a7538;}})[_0xd62c('0x41')](function(_0x35614a){logger[_0xd62c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35614a);throw _0x35614a;});}return _0x1a7538;})[_0xd62c('0x23')](respondWithResult(_0x982b7a,0xc9))[_0xd62c('0x41')](handleError(_0x982b7a,null));};exports[_0xd62c('0x22')]=function(_0xc3d7c9,_0x1ebf55){if(_0xc3d7c9[_0xd62c('0x48')]['id']){delete _0xc3d7c9[_0xd62c('0x48')]['id'];}return db['Tag'][_0xd62c('0x46')]({'where':{'id':_0xc3d7c9[_0xd62c('0x43')]['id']}})[_0xd62c('0x23')](handleEntityNotFound(_0x1ebf55,null))[_0xd62c('0x23')](saveUpdates(_0xc3d7c9[_0xd62c('0x48')],null))[_0xd62c('0x23')](respondWithResult(_0x1ebf55,null))['catch'](handleError(_0x1ebf55,null));};exports[_0xd62c('0x24')]=function(_0x570b62,_0x5e97cd){return db['Tag']['find']({'where':{'id':_0x570b62[_0xd62c('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e97cd,null))[_0xd62c('0x23')](removeEntity(_0x5e97cd,null))['catch'](handleError(_0x5e97cd,null));}; \ No newline at end of file +var _0x4e3b=['../../config/logger','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Tag','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x36456c,_0x47427b){var _0x97b131=function(_0x223387){while(--_0x223387){_0x36456c['push'](_0x36456c['shift']());}};_0x97b131(++_0x47427b);}(_0x4e3b,0x8f));var _0xb4e3=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x4e3b[_0x582f72];return _0x4cd5fe;};'use strict';var pdf=require(_0xb4e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb4e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4e3('0x2'));var rp=require(_0xb4e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb4e3('0x4'));var util=require(_0xb4e3('0x5'));var path=require(_0xb4e3('0x6'));var sox=require(_0xb4e3('0x7'));var csv=require(_0xb4e3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4e3('0x9'));var squel=require(_0xb4e3('0xa'));var crypto=require(_0xb4e3('0xb'));var jsforce=require(_0xb4e3('0xc'));var deskjs=require(_0xb4e3('0xd'));var toCsv=require(_0xb4e3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb4e3('0xe'));var authService=require(_0xb4e3('0xf'));var qs=require(_0xb4e3('0x10'));var as=require(_0xb4e3('0x11'));var hardwareService=require(_0xb4e3('0x12'));var logger=require(_0xb4e3('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb4e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3badd9,_0x3c3259){_0x3c3259=_0x3c3259||0xcc;return function(_0x4be2ca){if(_0x4be2ca){return _0x3badd9[_0xb4e3('0x15')](_0x3c3259);}return _0x3badd9[_0xb4e3('0x16')](_0x3c3259)['end']();};}function respondWithResult(_0x31265e,_0x15221a){_0x15221a=_0x15221a||0xc8;return function(_0x569a05){if(_0x569a05){return _0x31265e[_0xb4e3('0x16')](_0x15221a)[_0xb4e3('0x17')](_0x569a05);}};}function respondWithFilteredResult(_0x13592d,_0x1ccada){return function(_0x2d8691){if(_0x2d8691){var _0x1207f6=_0x2d8691['count'],_0x2132c8=_0x1ccada[_0xb4e3('0x18')],_0xf00f8b=_0x1ccada[_0xb4e3('0x18')]+_0x1ccada[_0xb4e3('0x19')],_0xb10d6;if(_0xf00f8b>=_0x1207f6){_0xf00f8b=_0x1207f6;_0xb10d6=0xc8;}else{_0xb10d6=0xce;}_0x13592d[_0xb4e3('0x16')](_0xb10d6);return _0x13592d['set'](_0xb4e3('0x1a'),_0x2132c8+'-'+_0xf00f8b+'/'+_0x1207f6)[_0xb4e3('0x17')](_0x2d8691);}return null;};}function patchUpdates(_0x40b61a){return function(_0x4cf20f){try{jsonpatch[_0xb4e3('0x1b')](_0x4cf20f,_0x40b61a,!![]);}catch(_0xdb3a85){return BPromise[_0xb4e3('0x1c')](_0xdb3a85);}return _0x4cf20f[_0xb4e3('0x1d')]();};}function saveUpdates(_0x357acc,_0x5f4185){return function(_0x4a1e3b){if(_0x4a1e3b){return _0x4a1e3b[_0xb4e3('0x1e')](_0x357acc)['then'](function(_0x37d0bd){return _0x37d0bd;});}return null;};}function removeEntity(_0x498cb7,_0x43743d){return function(_0x497b2e){if(_0x497b2e){return _0x497b2e[_0xb4e3('0x1f')]()[_0xb4e3('0x20')](function(){var _0x2b6056=_0x497b2e[_0xb4e3('0x21')]({'plain':!![]});var _0x4a27bc=_0xb4e3('0x22');return db[_0xb4e3('0x23')][_0xb4e3('0x1f')]({'where':{'type':_0x4a27bc,'resourceId':_0x2b6056['id']}})['then'](function(){return _0x497b2e;});})['then'](function(){_0x498cb7[_0xb4e3('0x16')](0xcc)[_0xb4e3('0x24')]();});}};}function handleEntityNotFound(_0x516fd3,_0x1eda12){return function(_0x4dbd03){if(!_0x4dbd03){_0x516fd3[_0xb4e3('0x15')](0x194);}return _0x4dbd03;};}function handleError(_0x332d17,_0x33a087){_0x33a087=_0x33a087||0x1f4;return function(_0x4cca69){logger['error'](_0x4cca69[_0xb4e3('0x25')]);if(_0x4cca69[_0xb4e3('0x26')]){delete _0x4cca69['name'];}_0x332d17[_0xb4e3('0x16')](_0x33a087)[_0xb4e3('0x27')](_0x4cca69);};}exports['index']=function(_0x48ffd6,_0xab9a7b){var _0x171b34={},_0x710853={},_0x4f8108={'count':0x0,'rows':[]};var _0x106d4c=_[_0xb4e3('0x28')](db['Tag'][_0xb4e3('0x29')],function(_0x4f8cb8){return{'name':_0x4f8cb8[_0xb4e3('0x2a')],'type':_0x4f8cb8[_0xb4e3('0x2b')][_0xb4e3('0x2c')]};});_0x710853['model']=_[_0xb4e3('0x28')](_0x106d4c,'name');_0x710853[_0xb4e3('0x2d')]=_['keys'](_0x48ffd6[_0xb4e3('0x2d')]);_0x710853[_0xb4e3('0x2e')]=_['intersection'](_0x710853[_0xb4e3('0x2f')],_0x710853[_0xb4e3('0x2d')]);_0x171b34[_0xb4e3('0x30')]=_[_0xb4e3('0x31')](_0x710853[_0xb4e3('0x2f')],qs[_0xb4e3('0x32')](_0x48ffd6[_0xb4e3('0x2d')]['fields']));_0x171b34[_0xb4e3('0x30')]=_0x171b34[_0xb4e3('0x30')][_0xb4e3('0x33')]?_0x171b34[_0xb4e3('0x30')]:_0x710853[_0xb4e3('0x2f')];if(!_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x34')](_0xb4e3('0x35'))){_0x171b34[_0xb4e3('0x19')]=qs[_0xb4e3('0x19')](_0x48ffd6[_0xb4e3('0x2d')]['limit']);_0x171b34['offset']=qs[_0xb4e3('0x18')](_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x18')]);}_0x171b34['order']=qs['sort'](_0x48ffd6['query'][_0xb4e3('0x36')]);_0x171b34[_0xb4e3('0x37')]=qs[_0xb4e3('0x2e')](_[_0xb4e3('0x38')](_0x48ffd6[_0xb4e3('0x2d')],_0x710853[_0xb4e3('0x2e')]),_0x106d4c);if(_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x39')]){_0x171b34[_0xb4e3('0x37')]=_[_0xb4e3('0x3a')](_0x171b34[_0xb4e3('0x37')],{'$or':_[_0xb4e3('0x28')](_0x106d4c,function(_0x232c6a){if(_0x232c6a[_0xb4e3('0x2b')]!==_0xb4e3('0x3b')){var _0x1d7dc4={};_0x1d7dc4[_0x232c6a[_0xb4e3('0x26')]]={'$like':'%'+_0x48ffd6['query'][_0xb4e3('0x39')]+'%'};return _0x1d7dc4;}})});}_0x171b34=_[_0xb4e3('0x3a')]({},_0x171b34,_0x48ffd6[_0xb4e3('0x3c')]);var _0x5e824f={'where':_0x171b34[_0xb4e3('0x37')]};return db[_0xb4e3('0x3d')][_0xb4e3('0x3e')](_0x5e824f)[_0xb4e3('0x20')](function(_0x4e00b8){_0x4f8108[_0xb4e3('0x3e')]=_0x4e00b8;if(_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x3f')]){_0x171b34[_0xb4e3('0x40')]=[{'all':!![]}];}return db[_0xb4e3('0x3d')][_0xb4e3('0x41')](_0x171b34);})[_0xb4e3('0x20')](function(_0x283cef){_0x4f8108[_0xb4e3('0x42')]=_0x283cef;return _0x4f8108;})['then'](respondWithFilteredResult(_0xab9a7b,_0x171b34))[_0xb4e3('0x43')](handleError(_0xab9a7b,null));};exports[_0xb4e3('0x44')]=function(_0x117ed2,_0x40a508){var _0x589d16={'raw':!![],'where':{'id':_0x117ed2[_0xb4e3('0x45')]['id']}},_0x55d961={};_0x55d961['model']=_[_0xb4e3('0x46')](db[_0xb4e3('0x3d')][_0xb4e3('0x29')]);_0x55d961[_0xb4e3('0x2d')]=_[_0xb4e3('0x46')](_0x117ed2['query']);_0x55d961['filters']=_['intersection'](_0x55d961['model'],_0x55d961[_0xb4e3('0x2d')]);_0x589d16[_0xb4e3('0x30')]=_['intersection'](_0x55d961[_0xb4e3('0x2f')],qs[_0xb4e3('0x32')](_0x117ed2['query'][_0xb4e3('0x32')]));_0x589d16[_0xb4e3('0x30')]=_0x589d16[_0xb4e3('0x30')][_0xb4e3('0x33')]?_0x589d16[_0xb4e3('0x30')]:_0x55d961[_0xb4e3('0x2f')];if(_0x117ed2['query'][_0xb4e3('0x3f')]){_0x589d16[_0xb4e3('0x40')]=[{'all':!![]}];}_0x589d16=_[_0xb4e3('0x3a')]({},_0x589d16,_0x117ed2[_0xb4e3('0x3c')]);return db['Tag'][_0xb4e3('0x47')](_0x589d16)[_0xb4e3('0x20')](handleEntityNotFound(_0x40a508,null))[_0xb4e3('0x20')](respondWithResult(_0x40a508,null))[_0xb4e3('0x43')](handleError(_0x40a508,null));};exports['create']=function(_0x2fc381,_0x7e49e2){return db['Tag'][_0xb4e3('0x48')](_0x2fc381[_0xb4e3('0x49')],{})[_0xb4e3('0x20')](function(_0xae3bcc){var _0x4203a4=_0x2fc381['user'][_0xb4e3('0x21')]({'plain':!![]});if(!_0x4203a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4203a4[_0xb4e3('0x4a')]===_0xb4e3('0x4b')){var _0x40d6e3=_0xae3bcc[_0xb4e3('0x21')]({'plain':!![]});var _0x5e79ce=_0xb4e3('0x22');return db[_0xb4e3('0x4c')]['find']({'where':{'name':_0x5e79ce,'userProfileId':_0x4203a4[_0xb4e3('0x4d')]},'raw':!![]})[_0xb4e3('0x20')](function(_0x21ca34){if(_0x21ca34&&_0x21ca34[_0xb4e3('0x4e')]===0x0){return db[_0xb4e3('0x23')]['create']({'name':_0x40d6e3[_0xb4e3('0x26')],'resourceId':_0x40d6e3['id'],'type':_0x21ca34[_0xb4e3('0x26')],'sectionId':_0x21ca34['id']},{})[_0xb4e3('0x20')](function(){return _0xae3bcc;});}else{return _0xae3bcc;}})[_0xb4e3('0x43')](function(_0x485f0e){logger[_0xb4e3('0x4f')](_0xb4e3('0x50'),_0x485f0e);throw _0x485f0e;});}return _0xae3bcc;})[_0xb4e3('0x20')](respondWithResult(_0x7e49e2,0xc9))['catch'](handleError(_0x7e49e2,null));};exports['update']=function(_0xb83e3,_0x34b083){if(_0xb83e3[_0xb4e3('0x49')]['id']){delete _0xb83e3[_0xb4e3('0x49')]['id'];}return db[_0xb4e3('0x3d')]['find']({'where':{'id':_0xb83e3[_0xb4e3('0x45')]['id']}})[_0xb4e3('0x20')](handleEntityNotFound(_0x34b083,null))[_0xb4e3('0x20')](saveUpdates(_0xb83e3[_0xb4e3('0x49')],null))[_0xb4e3('0x20')](respondWithResult(_0x34b083,null))[_0xb4e3('0x43')](handleError(_0x34b083,null));};exports['destroy']=function(_0x317d59,_0x4fbd32){return db[_0xb4e3('0x3d')][_0xb4e3('0x47')]({'where':{'id':_0x317d59[_0xb4e3('0x45')]['id']}})[_0xb4e3('0x20')](handleEntityNotFound(_0x4fbd32,null))[_0xb4e3('0x20')](removeEntity(_0x4fbd32,null))[_0xb4e3('0x43')](handleError(_0x4fbd32,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7e6dafc..6f3af54 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 _0xbada=['api','rimraf','./tag.attributes','exports','define','Tag','lodash','util'];(function(_0x42a0c0,_0x374ca0){var _0x344726=function(_0x4d8051){while(--_0x4d8051){_0x42a0c0['push'](_0x42a0c0['shift']());}};_0x344726(++_0x374ca0);}(_0xbada,0x18e));var _0xabad=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbada[_0x35da42];return _0x370035;};'use strict';var _=require(_0xabad('0x0'));var util=require(_0xabad('0x1'));var logger=require('../../config/logger')(_0xabad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xabad('0x3'));var config=require('../../config/environment');var attributes=require(_0xabad('0x4'));module[_0xabad('0x5')]=function(_0x1aaf3,_0x204186){return _0x1aaf3[_0xabad('0x6')](_0xabad('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x009e=['../../config/logger','api','moment','request-promise','rimraf','./tag.attributes','exports','Tag','tools_tags','lodash','util'];(function(_0x59622b,_0x5cba34){var _0x2edf4b=function(_0x729c0a){while(--_0x729c0a){_0x59622b['push'](_0x59622b['shift']());}};_0x2edf4b(++_0x5cba34);}(_0x009e,0x11c));var _0xe009=function(_0x285d03,_0x12c298){_0x285d03=_0x285d03-0x0;var _0x4a9ec8=_0x009e[_0x285d03];return _0x4a9ec8;};'use strict';var _=require(_0xe009('0x0'));var util=require(_0xe009('0x1'));var logger=require(_0xe009('0x2'))(_0xe009('0x3'));var moment=require(_0xe009('0x4'));var BPromise=require('bluebird');var rp=require(_0xe009('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe009('0x6'));var config=require('../../config/environment');var attributes=require(_0xe009('0x7'));module[_0xe009('0x8')]=function(_0x49d0aa,_0x4091ca){return _0x49d0aa['define'](_0xe009('0x9'),attributes,{'tableName':_0xe009('0xa'),'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 b5e2d7d..5ea07fc 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 _0x76dc=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3d0946,_0x51edd3){var _0x2599e6=function(_0x846cab){while(--_0x846cab){_0x3d0946['push'](_0x3d0946['shift']());}};_0x2599e6(++_0x51edd3);}(_0x76dc,0x1f2));var _0xc76d=function(_0x424b80,_0x4845b5){_0x424b80=_0x424b80-0x0;var _0xfe67ca=_0x76dc[_0x424b80];return _0xfe67ca;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('Tag,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});} \ No newline at end of file +var _0x5ec6=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','debug'];(function(_0x3d8c28,_0x5b7233){var _0x409a65=function(_0x43ef27){while(--_0x43ef27){_0x3d8c28['push'](_0x3d8c28['shift']());}};_0x409a65(++_0x5b7233);}(_0x5ec6,0x7f));var _0x65ec=function(_0x511a6a,_0x3dac82){_0x511a6a=_0x511a6a-0x0;var _0x5a248d=_0x5ec6[_0x511a6a];return _0x5a248d;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('Tag,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0c01d3e..a591809 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 _0x19c6=['../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','put','update','delete','destroy','removeQueues','removeAgents','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x33a3c8,_0x40d91e){var _0x298219=function(_0x3eab9b){while(--_0x3eab9b){_0x33a3c8['push'](_0x33a3c8['shift']());}};_0x298219(++_0x40d91e);}(_0x19c6,0x85));var _0x619c=function(_0x312663,_0x145fc5){_0x312663=_0x312663-0x0;var _0x3a0bea=_0x19c6[_0x312663];return _0x3a0bea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x619c('0x0'));var timeout=require(_0x619c('0x1'));var express=require(_0x619c('0x2'));var router=express[_0x619c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x619c('0x4'));var config=require(_0x619c('0x5'));var controller=require(_0x619c('0x6'));router[_0x619c('0x7')]('/',auth[_0x619c('0x8')](),controller[_0x619c('0x9')]);router[_0x619c('0x7')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller['show']);router[_0x619c('0x7')](_0x619c('0xb'),auth[_0x619c('0x8')](),controller[_0x619c('0xc')]);router[_0x619c('0x7')](_0x619c('0xd'),auth[_0x619c('0x8')](),controller[_0x619c('0xe')]);router[_0x619c('0xf')]('/',auth[_0x619c('0x8')](),controller['create']);router[_0x619c('0xf')](_0x619c('0xb'),auth[_0x619c('0x8')](),controller[_0x619c('0x10')]);router[_0x619c('0xf')](_0x619c('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x619c('0x11')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller[_0x619c('0x12')]);router[_0x619c('0x13')](_0x619c('0xa'),auth[_0x619c('0x8')](),controller[_0x619c('0x14')]);router[_0x619c('0x13')]('/:id/queues',auth['isAuthenticated'](),controller[_0x619c('0x15')]);router['delete'](_0x619c('0xd'),auth['isAuthenticated'](),controller[_0x619c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x148f=['put','/:id','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','./team.controller','isAuthenticated','index','get','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x148f,0xf2));var _0xf148=function(_0x3b2165,_0x5455ef){_0x3b2165=_0x3b2165-0x0;var _0x361ed8=_0x148f[_0x3b2165];return _0x361ed8;};'use strict';var multer=require(_0xf148('0x0'));var util=require(_0xf148('0x1'));var path=require(_0xf148('0x2'));var timeout=require(_0xf148('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf148('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf148('0x5'));router['get']('/',auth[_0xf148('0x6')](),controller[_0xf148('0x7')]);router[_0xf148('0x8')]('/:id',auth[_0xf148('0x6')](),controller[_0xf148('0x9')]);router[_0xf148('0x8')](_0xf148('0xa'),auth['isAuthenticated'](),controller[_0xf148('0xb')]);router['get'](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0xd')]);router[_0xf148('0xe')]('/',auth[_0xf148('0x6')](),controller[_0xf148('0xf')]);router['post'](_0xf148('0xa'),auth[_0xf148('0x6')](),controller[_0xf148('0x10')]);router[_0xf148('0xe')](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0x11')]);router[_0xf148('0x12')](_0xf148('0x13'),auth['isAuthenticated'](),controller[_0xf148('0x14')]);router[_0xf148('0x15')](_0xf148('0x13'),auth['isAuthenticated'](),controller[_0xf148('0x16')]);router[_0xf148('0x15')](_0xf148('0xa'),auth['isAuthenticated'](),controller[_0xf148('0x17')]);router[_0xf148('0x15')](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0x18')]);module[_0xf148('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index d47b1ff..1049248 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 _0x8dd6=['exports','name','STRING','sequelize'];(function(_0x5f0707,_0x4debdf){var _0x4220d7=function(_0x184eae){while(--_0x184eae){_0x5f0707['push'](_0x5f0707['shift']());}};_0x4220d7(++_0x4debdf);}(_0x8dd6,0x15b));var _0x68dd=function(_0x5d9cae,_0x705712){_0x5d9cae=_0x5d9cae-0x0;var _0x129be9=_0x8dd6[_0x5d9cae];return _0x129be9;};'use strict';var Sequelize=require(_0x68dd('0x0'));module[_0x68dd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x68dd('0x2')},'description':{'type':Sequelize[_0x68dd('0x3')]}}; \ No newline at end of file +var _0x5c8b=['exports','STRING','name','sequelize'];(function(_0x4a8c57,_0x419a69){var _0x3b1d79=function(_0x287baf){while(--_0x287baf){_0x4a8c57['push'](_0x4a8c57['shift']());}};_0x3b1d79(++_0x419a69);}(_0x5c8b,0x97));var _0xb5c8=function(_0x33e5c1,_0x1c9ea3){_0x33e5c1=_0x33e5c1-0x0;var _0x3edda9=_0x5c8b[_0x33e5c1];return _0x3edda9;};'use strict';var Sequelize=require(_0xb5c8('0x0'));module[_0xb5c8('0x1')]={'name':{'type':Sequelize[_0xb5c8('0x2')],'allowNull':![],'unique':_0xb5c8('0x3')},'description':{'type':Sequelize[_0xb5c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f94e1df..688e196 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 _0x32c2=['isNil','interface','format','SIP/%s','spread','emit','userTeam:save','removeAgents','voice','chat','sms','fax','openchannel','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Teams','UserProfileResource','destroy','error','stack','name','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','getQueues','findOne','isValidChannel','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','pick','capitalize','Queues','ValidationError','removeQueues','remove','ids','Voice','Chat','Sms','Fax','each','User','voicePause','upsert'];(function(_0x53d1f4,_0x7967b7){var _0x339f51=function(_0x22212a){while(--_0x22212a){_0x53d1f4['push'](_0x53d1f4['shift']());}};_0x339f51(++_0x7967b7);}(_0x32c2,0x113));var _0x232c=function(_0xb5b5bf,_0x3b7283){_0xb5b5bf=_0xb5b5bf-0x0;var _0x2f841f=_0x32c2[_0xb5b5bf];return _0x2f841f;};'use strict';var pdf=require(_0x232c('0x0'));var emlformat=require(_0x232c('0x1'));var rimraf=require(_0x232c('0x2'));var zipdir=require(_0x232c('0x3'));var jsonpatch=require(_0x232c('0x4'));var rp=require(_0x232c('0x5'));var moment=require(_0x232c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x232c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x232c('0x8'));var csv=require('to-csv');var ejs=require(_0x232c('0x9'));var fs=require('fs');var _=require(_0x232c('0xa'));var squel=require(_0x232c('0xb'));var crypto=require(_0x232c('0xc'));var jsforce=require(_0x232c('0xd'));var deskjs=require(_0x232c('0xe'));var toCsv=require(_0x232c('0xf'));var querystring=require(_0x232c('0x10'));var Papa=require(_0x232c('0x11'));var Redis=require(_0x232c('0x12'));var authService=require(_0x232c('0x13'));var qs=require(_0x232c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x232c('0x15'))(_0x232c('0x16'));var utils=require(_0x232c('0x17'));var config=require(_0x232c('0x18'));var licenseUtil=require(_0x232c('0x19'));var db=require(_0x232c('0x1a'))['db'];config[_0x232c('0x1b')]=_[_0x232c('0x1c')](config[_0x232c('0x1b')],{'host':_0x232c('0x1d'),'port':0x18eb});var socket=require(_0x232c('0x1e'))(new Redis(config[_0x232c('0x1b')]));require(_0x232c('0x1f'))['register'](socket);function respondWithStatusCode(_0x4c462c,_0x5bcf4e){_0x5bcf4e=_0x5bcf4e||0xcc;return function(_0x35f2ee){if(_0x35f2ee){return _0x4c462c[_0x232c('0x20')](_0x5bcf4e);}return _0x4c462c[_0x232c('0x21')](_0x5bcf4e)[_0x232c('0x22')]();};}function respondWithResult(_0x3257e7,_0xda435a){_0xda435a=_0xda435a||0xc8;return function(_0x1caea9){if(_0x1caea9){return _0x3257e7['status'](_0xda435a)[_0x232c('0x23')](_0x1caea9);}};}function respondWithFilteredResult(_0x203c31,_0x3625be){return function(_0x37f2ec){if(_0x37f2ec){var _0x64463f=_0x37f2ec[_0x232c('0x24')],_0x34288c=_0x3625be['offset'],_0x283b90=_0x3625be[_0x232c('0x25')]+_0x3625be[_0x232c('0x26')],_0x36b498;if(_0x283b90>=_0x64463f){_0x283b90=_0x64463f;_0x36b498=0xc8;}else{_0x36b498=0xce;}_0x203c31[_0x232c('0x21')](_0x36b498);return _0x203c31[_0x232c('0x27')](_0x232c('0x28'),_0x34288c+'-'+_0x283b90+'/'+_0x64463f)[_0x232c('0x23')](_0x37f2ec);}return null;};}function patchUpdates(_0x443db1){return function(_0x4f8511){try{jsonpatch[_0x232c('0x29')](_0x4f8511,_0x443db1,!![]);}catch(_0x592b17){return BPromise[_0x232c('0x2a')](_0x592b17);}return _0x4f8511[_0x232c('0x2b')]();};}function saveUpdates(_0x2011e2,_0x1d2751){return function(_0x371470){if(_0x371470){return _0x371470[_0x232c('0x2c')](_0x2011e2)['then'](function(_0x27ca52){return _0x27ca52;});}return null;};}function removeEntity(_0x2ee42e,_0x68c300){return function(_0x50a9e2){if(_0x50a9e2){return _0x50a9e2['destroy']()[_0x232c('0x2d')](function(){var _0x356f9e=_0x50a9e2['get']({'plain':!![]});var _0x58314f=_0x232c('0x2e');return db[_0x232c('0x2f')][_0x232c('0x30')]({'where':{'type':_0x58314f,'resourceId':_0x356f9e['id']}})[_0x232c('0x2d')](function(){return _0x50a9e2;});})[_0x232c('0x2d')](function(){_0x2ee42e[_0x232c('0x21')](0xcc)[_0x232c('0x22')]();});}};}function handleEntityNotFound(_0x50db43,_0x20730b){return function(_0x152606){if(!_0x152606){_0x50db43['sendStatus'](0x194);}return _0x152606;};}function handleError(_0x12d176,_0x16ebf6){_0x16ebf6=_0x16ebf6||0x1f4;return function(_0x325e5c){logger[_0x232c('0x31')](_0x325e5c[_0x232c('0x32')]);if(_0x325e5c[_0x232c('0x33')]){delete _0x325e5c[_0x232c('0x33')];}_0x12d176[_0x232c('0x21')](_0x16ebf6)['send'](_0x325e5c);};}exports['index']=function(_0x24a3af,_0x122371){var _0x33c10f={},_0x54cb85={},_0x1cc3a6={'count':0x0,'rows':[]};var _0x3d4d6a=_[_0x232c('0x34')](db[_0x232c('0x35')][_0x232c('0x36')],function(_0x40ccda){return{'name':_0x40ccda['fieldName'],'type':_0x40ccda[_0x232c('0x37')][_0x232c('0x38')]};});_0x54cb85[_0x232c('0x39')]=_[_0x232c('0x34')](_0x3d4d6a,_0x232c('0x33'));_0x54cb85[_0x232c('0x3a')]=_['keys'](_0x24a3af[_0x232c('0x3a')]);_0x54cb85[_0x232c('0x3b')]=_['intersection'](_0x54cb85[_0x232c('0x39')],_0x54cb85['query']);_0x33c10f[_0x232c('0x3c')]=_[_0x232c('0x3d')](_0x54cb85[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x24a3af['query']['fields']));_0x33c10f[_0x232c('0x3c')]=_0x33c10f[_0x232c('0x3c')][_0x232c('0x3f')]?_0x33c10f[_0x232c('0x3c')]:_0x54cb85[_0x232c('0x39')];if(!_0x24a3af['query'][_0x232c('0x40')](_0x232c('0x41'))){_0x33c10f['limit']=qs[_0x232c('0x26')](_0x24a3af[_0x232c('0x3a')]['limit']);_0x33c10f['offset']=qs['offset'](_0x24a3af[_0x232c('0x3a')][_0x232c('0x25')]);}_0x33c10f[_0x232c('0x42')]=qs[_0x232c('0x43')](_0x24a3af[_0x232c('0x3a')][_0x232c('0x43')]);_0x33c10f[_0x232c('0x44')]=qs[_0x232c('0x3b')](_['pick'](_0x24a3af[_0x232c('0x3a')],_0x54cb85[_0x232c('0x3b')]),_0x3d4d6a);if(_0x24a3af['query'][_0x232c('0x45')]){_0x33c10f[_0x232c('0x44')]=_['merge'](_0x33c10f[_0x232c('0x44')],{'$or':_['map'](_0x3d4d6a,function(_0x519422){if(_0x519422['type']!==_0x232c('0x46')){var _0x27d046={};_0x27d046[_0x519422[_0x232c('0x33')]]={'$like':'%'+_0x24a3af['query'][_0x232c('0x45')]+'%'};return _0x27d046;}})});}_0x33c10f=_[_0x232c('0x47')]({},_0x33c10f,_0x24a3af[_0x232c('0x48')]);var _0x526dc6={'where':_0x33c10f[_0x232c('0x44')]};return db[_0x232c('0x35')][_0x232c('0x24')](_0x526dc6)[_0x232c('0x2d')](function(_0x3e0f70){_0x1cc3a6[_0x232c('0x24')]=_0x3e0f70;if(_0x24a3af[_0x232c('0x3a')][_0x232c('0x49')]){_0x33c10f[_0x232c('0x4a')]=[{'all':!![]}];}return db[_0x232c('0x35')][_0x232c('0x4b')](_0x33c10f);})[_0x232c('0x2d')](function(_0xc81bfc){_0x1cc3a6['rows']=_0xc81bfc;return _0x1cc3a6;})[_0x232c('0x2d')](respondWithFilteredResult(_0x122371,_0x33c10f))[_0x232c('0x4c')](handleError(_0x122371,null));};exports['show']=function(_0x371800,_0xa45591){var _0x3e6898={'raw':![],'where':{'id':_0x371800[_0x232c('0x4d')]['id']}},_0x2abb02={};_0x2abb02[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_0x232c('0x35')][_0x232c('0x36')]);_0x2abb02[_0x232c('0x3a')]=_[_0x232c('0x4e')](_0x371800[_0x232c('0x3a')]);_0x2abb02[_0x232c('0x3b')]=_[_0x232c('0x3d')](_0x2abb02[_0x232c('0x39')],_0x2abb02[_0x232c('0x3a')]);_0x3e6898['attributes']=_[_0x232c('0x3d')](_0x2abb02[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x371800['query']['fields']));_0x3e6898[_0x232c('0x3c')]=_0x3e6898[_0x232c('0x3c')][_0x232c('0x3f')]?_0x3e6898[_0x232c('0x3c')]:_0x2abb02[_0x232c('0x39')];if(_0x371800[_0x232c('0x3a')][_0x232c('0x49')]){_0x3e6898['include']=[{'all':!![]}];}_0x3e6898=_[_0x232c('0x47')]({},_0x3e6898,_0x371800['options']);return db[_0x232c('0x35')]['find'](_0x3e6898)['then'](handleEntityNotFound(_0xa45591,null))[_0x232c('0x2d')](respondWithResult(_0xa45591,null))[_0x232c('0x4c')](handleError(_0xa45591,null));};exports[_0x232c('0x4f')]=function(_0x3a9602,_0x59bfb5){return db[_0x232c('0x35')][_0x232c('0x4f')](_0x3a9602[_0x232c('0x50')],{})[_0x232c('0x2d')](function(_0x2bb528){var _0x49bc07=_0x3a9602[_0x232c('0x51')][_0x232c('0x52')]({'plain':!![]});if(!_0x49bc07)throw new Error(_0x232c('0x53'));if(_0x49bc07[_0x232c('0x54')]===_0x232c('0x51')){var _0x19d47d=_0x2bb528[_0x232c('0x52')]({'plain':!![]});var _0x1f8eab=_0x232c('0x2e');return db[_0x232c('0x55')]['find']({'where':{'name':_0x1f8eab,'userProfileId':_0x49bc07[_0x232c('0x56')]},'raw':!![]})[_0x232c('0x2d')](function(_0x2b4576){if(_0x2b4576&&_0x2b4576[_0x232c('0x57')]===0x0){return db[_0x232c('0x2f')][_0x232c('0x4f')]({'name':_0x19d47d[_0x232c('0x33')],'resourceId':_0x19d47d['id'],'type':_0x2b4576[_0x232c('0x33')],'sectionId':_0x2b4576['id']},{})[_0x232c('0x2d')](function(){return _0x2bb528;});}else{return _0x2bb528;}})[_0x232c('0x4c')](function(_0x2820b4){logger[_0x232c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2820b4);throw _0x2820b4;});}return _0x2bb528;})[_0x232c('0x2d')](respondWithResult(_0x59bfb5,0xc9))[_0x232c('0x4c')](handleError(_0x59bfb5,null));};exports[_0x232c('0x2c')]=function(_0x25993a,_0x492035){if(_0x25993a['body']['id']){delete _0x25993a[_0x232c('0x50')]['id'];}return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x25993a[_0x232c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x492035,null))[_0x232c('0x2d')](saveUpdates(_0x25993a['body'],null))[_0x232c('0x2d')](respondWithResult(_0x492035,null))[_0x232c('0x4c')](handleError(_0x492035,null));};exports['destroy']=function(_0x18768,_0x5ede39){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x18768[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x5ede39,null))[_0x232c('0x2d')](removeEntity(_0x5ede39,null))[_0x232c('0x4c')](handleError(_0x5ede39,null));};exports[_0x232c('0x59')]=function(_0x13471a,_0x29d22c,_0x30b2ff){return db['Team'][_0x232c('0x5a')]({'where':{'id':_0x13471a['params']['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x29d22c,null))['then'](function(_0x1564e2){if(!_0x13471a[_0x232c('0x3a')]['channel']||!utils[_0x232c('0x5b')](_0x13471a[_0x232c('0x3a')][_0x232c('0x5c')])){throw new db[(_0x232c('0x5d'))]['ValidationError'](_0x232c('0x5e'));}var _0x45aa25={};var _0x48bf55={};_0x48bf55[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_['capitalize'](_0x13471a[_0x232c('0x3a')][_0x232c('0x5c')][_0x232c('0x5f')]())+_0x232c('0x60')]['rawAttributes']);_0x48bf55['query']=_['keys'](_0x13471a[_0x232c('0x3a')]);_0x48bf55[_0x232c('0x3b')]=_['intersection'](_0x48bf55[_0x232c('0x39')],_0x48bf55[_0x232c('0x3a')]);_0x45aa25['attributes']=_[_0x232c('0x3d')](_0x48bf55['model'],qs['fields'](_0x13471a[_0x232c('0x3a')][_0x232c('0x3e')]));_0x45aa25[_0x232c('0x3c')]=_0x45aa25['attributes'][_0x232c('0x3f')]?_0x45aa25[_0x232c('0x3c')]:_0x48bf55[_0x232c('0x39')];_0x45aa25[_0x232c('0x26')]=qs['limit'](_0x13471a[_0x232c('0x3a')][_0x232c('0x26')]);_0x45aa25[_0x232c('0x25')]=qs['offset'](_0x13471a[_0x232c('0x3a')][_0x232c('0x25')]);_0x45aa25['order']=qs['sort'](_0x13471a[_0x232c('0x3a')]['sort']);_0x45aa25[_0x232c('0x44')]=qs['filters'](_[_0x232c('0x61')](_0x13471a[_0x232c('0x3a')],_0x48bf55[_0x232c('0x3b')]));_0x45aa25=_[_0x232c('0x47')]({},_0x45aa25,_0x13471a[_0x232c('0x48')]);return _0x1564e2[_0x232c('0x52')+_[_0x232c('0x62')](_0x13471a['query'][_0x232c('0x5c')]['toLowerCase']())+_0x232c('0x63')](_0x45aa25);})[_0x232c('0x2d')](respondWithResult(_0x29d22c,null))['catch'](handleError(_0x29d22c,null));};exports['addQueues']=function(_0x3b4d07,_0x2875f3,_0x202969){return db['Team'][_0x232c('0x5a')]({'where':{'id':_0x3b4d07[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](function(_0x11a5d6){if(_0x11a5d6){if(!_0x3b4d07[_0x232c('0x50')][_0x232c('0x5c')]||!utils[_0x232c('0x5b')](_0x3b4d07[_0x232c('0x50')]['channel'])){throw new db[(_0x232c('0x5d'))][(_0x232c('0x64'))](_0x232c('0x5e'));}return _0x11a5d6['add'+_[_0x232c('0x62')](_0x3b4d07['body'][_0x232c('0x5c')][_0x232c('0x5f')]())+'Queues'](_0x3b4d07[_0x232c('0x50')]['ids']);}return null;})['then'](handleEntityNotFound(_0x2875f3,null))['then'](respondWithStatusCode(_0x2875f3,null))[_0x232c('0x4c')](handleError(_0x2875f3,null));};exports[_0x232c('0x65')]=function(_0x1d2061,_0x29f5f5,_0x5f4a9b){return db[_0x232c('0x35')][_0x232c('0x5a')]({'where':{'id':_0x1d2061['params']['id']}})[_0x232c('0x2d')](function(_0x4f58bd){if(_0x4f58bd){if(!_0x1d2061[_0x232c('0x3a')][_0x232c('0x5c')]||!utils['isValidChannel'](_0x1d2061[_0x232c('0x3a')][_0x232c('0x5c')])){throw new db[(_0x232c('0x5d'))][(_0x232c('0x64'))]('Unknown\x20channel');}return _0x4f58bd[_0x232c('0x66')+_[_0x232c('0x62')](_0x1d2061['query'][_0x232c('0x5c')][_0x232c('0x5f')]())+_0x232c('0x63')](_0x1d2061[_0x232c('0x3a')][_0x232c('0x67')]);}return null;})[_0x232c('0x2d')](handleEntityNotFound(_0x29f5f5,null))[_0x232c('0x2d')](respondWithStatusCode(_0x29f5f5,null))[_0x232c('0x4c')](handleError(_0x29f5f5,null));};exports['addAgents']=function(_0x358b19,_0x64f409,_0x399cfe){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x358b19[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x64f409,null))[_0x232c('0x2d')](function(_0x3d3060){if(_0x3d3060){var _0x439b19=[_0x232c('0x68'),_0x232c('0x69'),'Mail',_0x232c('0x6a'),_0x232c('0x6b'),'Openchannel','Whatsapp'];return BPromise[_0x232c('0x6c')](_0x439b19,function(_0x2c0bc4){return _0x3d3060['get'+_0x2c0bc4+_0x232c('0x63')]({'attributes':['id',_0x232c('0x33')]})['then'](function(_0x284774){return BPromise['each'](_0x284774,function(_0x4210bf){return _0x4210bf['addAgents'](_0x358b19[_0x232c('0x50')][_0x232c('0x67')])[_0x232c('0x2d')](function(){if(_0x2c0bc4===_0x232c('0x68')){return db[_0x232c('0x6d')][_0x232c('0x4b')]({'where':{'id':_0x358b19['body'][_0x232c('0x67')]},'attributes':['id',_0x232c('0x33'),'online',_0x232c('0x6e'),'interface'],'raw':!![]})['then'](function(_0x2a011c){return BPromise[_0x232c('0x6c')](_[_0x232c('0x45')](_0x2a011c,{'online':0x1}),function(_0x293a11){return db['UserVoiceQueueRt'][_0x232c('0x6f')]({'membername':_0x293a11[_0x232c('0x33')],'UserId':_0x293a11['id'],'queue_name':_0x4210bf[_0x232c('0x33')],'VoiceQueueId':_0x4210bf['id'],'interface':_[_0x232c('0x70')](_0x293a11[_0x232c('0x71')])?util[_0x232c('0x72')](_0x232c('0x73'),_0x293a11[_0x232c('0x33')]):_0x293a11[_0x232c('0x71')],'paused':_0x293a11[_0x232c('0x6e')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3d3060;});})[_0x232c('0x2d')](function(){return _0x3d3060;});}})[_0x232c('0x2d')](function(_0x3e99f2){if(_0x3e99f2){return _0x3e99f2['addAgents'](_0x358b19['body']['ids'],_['omit'](_0x358b19[_0x232c('0x50')],['ids','id'])||{})[_0x232c('0x74')](function(_0x41c063){for(var _0x2f6ce5=0x0;_0x2f6ce5<_0x358b19[_0x232c('0x50')][_0x232c('0x67')]['length'];_0x2f6ce5+=0x1){socket[_0x232c('0x75')](_0x232c('0x76'),{'UserId':_0x358b19['body'][_0x232c('0x67')][_0x2f6ce5],'TeamId':_0x358b19[_0x232c('0x4d')]['id']});}return _0x41c063;});}})[_0x232c('0x2d')](respondWithResult(_0x64f409,null))[_0x232c('0x4c')](handleError(_0x64f409,null));};exports[_0x232c('0x77')]=function(_0x5026e0,_0x33667d,_0x6d56a7){return db[_0x232c('0x35')][_0x232c('0x58')]({'where':{'id':_0x5026e0[_0x232c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33667d,null))[_0x232c('0x2d')](function(_0x1ddb0f){if(_0x1ddb0f){return BPromise[_0x232c('0x6c')]([_0x232c('0x78'),_0x232c('0x79'),'mail',_0x232c('0x7a'),_0x232c('0x7b'),_0x232c('0x7c'),'whatsapp'],function(_0x15911b){return _0x1ddb0f['get'+_[_0x232c('0x62')](_0x15911b)+'Queues']({'attributes':['id',_0x232c('0x33')]})['then'](function(_0x336fdc){return BPromise[_0x232c('0x6c')](_0x336fdc,function(_0x4955f9){return _0x4955f9['removeAgents'](_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')])['then'](function(){if(_0x15911b==='voice'){return db[_0x232c('0x7d')][_0x232c('0x30')]({'where':{'VoiceQueueId':_0x4955f9['id'],'UserId':_0x5026e0[_0x232c('0x3a')]['ids']}});}});});})[_0x232c('0x2d')](function(){return _0x1ddb0f;});})[_0x232c('0x2d')](function(){return _0x1ddb0f;});}})[_0x232c('0x2d')](function(_0x484017){if(_0x484017){return _0x484017['removeAgents'](_0x5026e0['query']['ids'])['then'](function(){if(_[_0x232c('0x7e')](_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')])){for(var _0x3d8efc=0x0;_0x3d8efc<_0x5026e0['query'][_0x232c('0x67')][_0x232c('0x3f')];_0x3d8efc+=0x1){socket[_0x232c('0x75')]('userTeam:remove',{'UserId':Number(_0x5026e0[_0x232c('0x3a')][_0x232c('0x67')][_0x3d8efc]),'TeamId':Number(_0x5026e0[_0x232c('0x4d')]['id'])});}}else{socket[_0x232c('0x75')](_0x232c('0x7f'),{'UserId':Number(_0x5026e0['query'][_0x232c('0x67')]),'TeamId':Number(_0x5026e0['params']['id'])});}});}})[_0x232c('0x2d')](respondWithStatusCode(_0x33667d,null))[_0x232c('0x4c')](handleError(_0x33667d,null));};exports[_0x232c('0x80')]=function(_0x10aa78,_0x22d396,_0x5e7cd5){var _0x2463b3={};var _0x51f013={};var _0x1cade2;var _0x3e998d;return db[_0x232c('0x35')]['findOne']({'where':{'id':_0x10aa78[_0x232c('0x4d')]['id']}})[_0x232c('0x2d')](handleEntityNotFound(_0x22d396,null))[_0x232c('0x2d')](function(_0x35d3e5){if(_0x35d3e5){_0x1cade2=_0x35d3e5;_0x51f013[_0x232c('0x39')]=_[_0x232c('0x4e')](db[_0x232c('0x6d')][_0x232c('0x36')]);_0x51f013[_0x232c('0x3a')]=_[_0x232c('0x4e')](_0x10aa78[_0x232c('0x3a')]);_0x51f013[_0x232c('0x3b')]=_[_0x232c('0x3d')](_0x51f013['model'],_0x51f013[_0x232c('0x3a')]);_0x2463b3[_0x232c('0x3c')]=_[_0x232c('0x3d')](_0x51f013[_0x232c('0x39')],qs[_0x232c('0x3e')](_0x10aa78[_0x232c('0x3a')]['fields']));_0x2463b3['attributes']=_0x2463b3[_0x232c('0x3c')][_0x232c('0x3f')]?_0x2463b3[_0x232c('0x3c')]:_0x51f013[_0x232c('0x39')];_0x2463b3['order']=qs[_0x232c('0x43')](_0x10aa78[_0x232c('0x3a')][_0x232c('0x43')]);_0x2463b3[_0x232c('0x44')]=qs['filters'](_[_0x232c('0x61')](_0x10aa78[_0x232c('0x3a')],_0x51f013[_0x232c('0x3b')]));if(_0x10aa78[_0x232c('0x3a')][_0x232c('0x45')]){_0x2463b3[_0x232c('0x44')]=_[_0x232c('0x47')](_0x2463b3[_0x232c('0x44')],{'$or':_[_0x232c('0x34')](_0x2463b3[_0x232c('0x3c')],function(_0x3d0d4d){var _0x4fc62e={};_0x4fc62e[_0x3d0d4d]={'$like':'%'+_0x10aa78['query'][_0x232c('0x45')]+'%'};return _0x4fc62e;})});}_0x2463b3=_[_0x232c('0x47')]({},_0x2463b3,_0x10aa78[_0x232c('0x48')]);return _0x1cade2[_0x232c('0x80')](_0x2463b3);}})['then'](function(_0x198f67){if(_0x198f67){_0x3e998d=_0x198f67[_0x232c('0x3f')];if(!_0x10aa78[_0x232c('0x3a')][_0x232c('0x40')](_0x232c('0x41'))){_0x2463b3['limit']=qs[_0x232c('0x26')](_0x10aa78[_0x232c('0x3a')]['limit']);_0x2463b3[_0x232c('0x25')]=qs[_0x232c('0x25')](_0x10aa78['query'][_0x232c('0x25')]);}return _0x1cade2['getAgents'](_0x2463b3);}})['then'](function(_0x529d5a){if(_0x529d5a){return _0x529d5a?{'count':_0x3e998d,'rows':_0x529d5a}:null;}})[_0x232c('0x2d')](respondWithResult(_0x22d396,null))[_0x232c('0x4c')](handleError(_0x22d396,null));}; \ No newline at end of file +var _0xa4c6=['each','chat','mail','sms','whatsapp','voice','isArray','emit','userTeam:remove','getAgents','User','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','addQueues','add','ids','removeQueues','Queues','Chat','Sms','Fax','Openchannel','addAgents','Voice','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','omit','spread','userTeam:save','removeAgents'];(function(_0x3b0d35,_0x29fd12){var _0xbb303f=function(_0x331757){while(--_0x331757){_0x3b0d35['push'](_0x3b0d35['shift']());}};_0xbb303f(++_0x29fd12);}(_0xa4c6,0x8f));var _0x6a4c=function(_0x4329cf,_0x1258ba){_0x4329cf=_0x4329cf-0x0;var _0x30fe54=_0xa4c6[_0x4329cf];return _0x30fe54;};'use strict';var pdf=require(_0x6a4c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a4c('0x1'));var jsonpatch=require(_0x6a4c('0x2'));var rp=require(_0x6a4c('0x3'));var moment=require('moment');var BPromise=require(_0x6a4c('0x4'));var Mustache=require(_0x6a4c('0x5'));var util=require(_0x6a4c('0x6'));var path=require(_0x6a4c('0x7'));var sox=require(_0x6a4c('0x8'));var csv=require(_0x6a4c('0x9'));var ejs=require(_0x6a4c('0xa'));var fs=require('fs');var _=require(_0x6a4c('0xb'));var squel=require(_0x6a4c('0xc'));var crypto=require(_0x6a4c('0xd'));var jsforce=require(_0x6a4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a4c('0x9'));var querystring=require('querystring');var Papa=require(_0x6a4c('0xf'));var Redis=require(_0x6a4c('0x10'));var authService=require(_0x6a4c('0x11'));var qs=require(_0x6a4c('0x12'));var as=require(_0x6a4c('0x13'));var hardwareService=require(_0x6a4c('0x14'));var logger=require(_0x6a4c('0x15'))(_0x6a4c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a4c('0x17'))['db'];config['redis']=_['defaults'](config[_0x6a4c('0x18')],{'host':_0x6a4c('0x19'),'port':0x18eb});var socket=require(_0x6a4c('0x1a'))(new Redis(config[_0x6a4c('0x18')]));require(_0x6a4c('0x1b'))['register'](socket);function respondWithStatusCode(_0x7c8592,_0x42f60b){_0x42f60b=_0x42f60b||0xcc;return function(_0x3a48b2){if(_0x3a48b2){return _0x7c8592[_0x6a4c('0x1c')](_0x42f60b);}return _0x7c8592[_0x6a4c('0x1d')](_0x42f60b)[_0x6a4c('0x1e')]();};}function respondWithResult(_0x18e831,_0x164a91){_0x164a91=_0x164a91||0xc8;return function(_0x21927f){if(_0x21927f){return _0x18e831[_0x6a4c('0x1d')](_0x164a91)[_0x6a4c('0x1f')](_0x21927f);}};}function respondWithFilteredResult(_0x2e5498,_0x142720){return function(_0xc700c){if(_0xc700c){var _0x39c4c9=_0xc700c[_0x6a4c('0x20')],_0x470e85=_0x142720[_0x6a4c('0x21')],_0x3fa985=_0x142720[_0x6a4c('0x21')]+_0x142720['limit'],_0x37d483;if(_0x3fa985>=_0x39c4c9){_0x3fa985=_0x39c4c9;_0x37d483=0xc8;}else{_0x37d483=0xce;}_0x2e5498['status'](_0x37d483);return _0x2e5498[_0x6a4c('0x22')](_0x6a4c('0x23'),_0x470e85+'-'+_0x3fa985+'/'+_0x39c4c9)[_0x6a4c('0x1f')](_0xc700c);}return null;};}function patchUpdates(_0xfc9347){return function(_0x1dea49){try{jsonpatch['apply'](_0x1dea49,_0xfc9347,!![]);}catch(_0x18b1b8){return BPromise['reject'](_0x18b1b8);}return _0x1dea49[_0x6a4c('0x24')]();};}function saveUpdates(_0x218f8c,_0x2010ad){return function(_0x311f7){if(_0x311f7){return _0x311f7[_0x6a4c('0x25')](_0x218f8c)[_0x6a4c('0x26')](function(_0x4859b3){return _0x4859b3;});}return null;};}function removeEntity(_0x31f81d,_0x1e42b7){return function(_0x1f8aff){if(_0x1f8aff){return _0x1f8aff['destroy']()[_0x6a4c('0x26')](function(){var _0x47bb4f=_0x1f8aff[_0x6a4c('0x27')]({'plain':!![]});var _0x4cdb73=_0x6a4c('0x28');return db[_0x6a4c('0x29')]['destroy']({'where':{'type':_0x4cdb73,'resourceId':_0x47bb4f['id']}})[_0x6a4c('0x26')](function(){return _0x1f8aff;});})[_0x6a4c('0x26')](function(){_0x31f81d['status'](0xcc)[_0x6a4c('0x1e')]();});}};}function handleEntityNotFound(_0x237ef3,_0x8649cc){return function(_0xb75702){if(!_0xb75702){_0x237ef3['sendStatus'](0x194);}return _0xb75702;};}function handleError(_0x325866,_0x473944){_0x473944=_0x473944||0x1f4;return function(_0x26a938){logger[_0x6a4c('0x2a')](_0x26a938[_0x6a4c('0x2b')]);if(_0x26a938[_0x6a4c('0x2c')]){delete _0x26a938[_0x6a4c('0x2c')];}_0x325866['status'](_0x473944)[_0x6a4c('0x2d')](_0x26a938);};}exports[_0x6a4c('0x2e')]=function(_0x2b2678,_0x4b09fb){var _0x161b58={},_0x159cc7={},_0x1a8d35={'count':0x0,'rows':[]};var _0xc9dff0=_[_0x6a4c('0x2f')](db[_0x6a4c('0x30')][_0x6a4c('0x31')],function(_0x13373b){return{'name':_0x13373b[_0x6a4c('0x32')],'type':_0x13373b[_0x6a4c('0x33')][_0x6a4c('0x34')]};});_0x159cc7[_0x6a4c('0x35')]=_['map'](_0xc9dff0,_0x6a4c('0x2c'));_0x159cc7[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x2b2678[_0x6a4c('0x36')]);_0x159cc7['filters']=_[_0x6a4c('0x38')](_0x159cc7[_0x6a4c('0x35')],_0x159cc7[_0x6a4c('0x36')]);_0x161b58['attributes']=_[_0x6a4c('0x38')](_0x159cc7[_0x6a4c('0x35')],qs['fields'](_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x161b58[_0x6a4c('0x3a')]=_0x161b58['attributes'][_0x6a4c('0x3b')]?_0x161b58['attributes']:_0x159cc7[_0x6a4c('0x35')];if(!_0x2b2678['query'][_0x6a4c('0x3c')](_0x6a4c('0x3d'))){_0x161b58[_0x6a4c('0x3e')]=qs['limit'](_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x3e')]);_0x161b58['offset']=qs[_0x6a4c('0x21')](_0x2b2678['query']['offset']);}_0x161b58[_0x6a4c('0x3f')]=qs[_0x6a4c('0x40')](_0x2b2678['query'][_0x6a4c('0x40')]);_0x161b58[_0x6a4c('0x41')]=qs[_0x6a4c('0x42')](_[_0x6a4c('0x43')](_0x2b2678[_0x6a4c('0x36')],_0x159cc7['filters']),_0xc9dff0);if(_0x2b2678['query'][_0x6a4c('0x44')]){_0x161b58[_0x6a4c('0x41')]=_[_0x6a4c('0x45')](_0x161b58[_0x6a4c('0x41')],{'$or':_['map'](_0xc9dff0,function(_0xb99590){if(_0xb99590[_0x6a4c('0x33')]!==_0x6a4c('0x46')){var _0x2f4574={};_0x2f4574[_0xb99590['name']]={'$like':'%'+_0x2b2678[_0x6a4c('0x36')]['filter']+'%'};return _0x2f4574;}})});}_0x161b58=_[_0x6a4c('0x45')]({},_0x161b58,_0x2b2678['options']);var _0x425dc7={'where':_0x161b58['where']};return db[_0x6a4c('0x30')][_0x6a4c('0x20')](_0x425dc7)[_0x6a4c('0x26')](function(_0x3f623b){_0x1a8d35[_0x6a4c('0x20')]=_0x3f623b;if(_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x47')]){_0x161b58[_0x6a4c('0x48')]=[{'all':!![]}];}return db[_0x6a4c('0x30')][_0x6a4c('0x49')](_0x161b58);})['then'](function(_0x21718a){_0x1a8d35['rows']=_0x21718a;return _0x1a8d35;})[_0x6a4c('0x26')](respondWithFilteredResult(_0x4b09fb,_0x161b58))['catch'](handleError(_0x4b09fb,null));};exports[_0x6a4c('0x4a')]=function(_0x574593,_0x4e659d){var _0x1a5e84={'raw':![],'where':{'id':_0x574593['params']['id']}},_0x31b2c8={};_0x31b2c8[_0x6a4c('0x35')]=_[_0x6a4c('0x37')](db[_0x6a4c('0x30')][_0x6a4c('0x31')]);_0x31b2c8[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x574593[_0x6a4c('0x36')]);_0x31b2c8['filters']=_[_0x6a4c('0x38')](_0x31b2c8[_0x6a4c('0x35')],_0x31b2c8[_0x6a4c('0x36')]);_0x1a5e84[_0x6a4c('0x3a')]=_[_0x6a4c('0x38')](_0x31b2c8[_0x6a4c('0x35')],qs[_0x6a4c('0x39')](_0x574593[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x1a5e84['attributes']=_0x1a5e84['attributes'][_0x6a4c('0x3b')]?_0x1a5e84[_0x6a4c('0x3a')]:_0x31b2c8[_0x6a4c('0x35')];if(_0x574593['query']['includeAll']){_0x1a5e84[_0x6a4c('0x48')]=[{'all':!![]}];}_0x1a5e84=_[_0x6a4c('0x45')]({},_0x1a5e84,_0x574593[_0x6a4c('0x4b')]);return db[_0x6a4c('0x30')]['find'](_0x1a5e84)[_0x6a4c('0x26')](handleEntityNotFound(_0x4e659d,null))[_0x6a4c('0x26')](respondWithResult(_0x4e659d,null))['catch'](handleError(_0x4e659d,null));};exports[_0x6a4c('0x4c')]=function(_0xe5300e,_0x369beb){return db['Team'][_0x6a4c('0x4c')](_0xe5300e[_0x6a4c('0x4d')],{})['then'](function(_0x45cf47){var _0x102a1f=_0xe5300e[_0x6a4c('0x4e')][_0x6a4c('0x27')]({'plain':!![]});if(!_0x102a1f)throw new Error(_0x6a4c('0x4f'));if(_0x102a1f[_0x6a4c('0x50')]===_0x6a4c('0x4e')){var _0x24678c=_0x45cf47[_0x6a4c('0x27')]({'plain':!![]});var _0x3cce16=_0x6a4c('0x28');return db[_0x6a4c('0x51')][_0x6a4c('0x52')]({'where':{'name':_0x3cce16,'userProfileId':_0x102a1f[_0x6a4c('0x53')]},'raw':!![]})[_0x6a4c('0x26')](function(_0x2452ff){if(_0x2452ff&&_0x2452ff[_0x6a4c('0x54')]===0x0){return db[_0x6a4c('0x29')][_0x6a4c('0x4c')]({'name':_0x24678c[_0x6a4c('0x2c')],'resourceId':_0x24678c['id'],'type':_0x2452ff['name'],'sectionId':_0x2452ff['id']},{})[_0x6a4c('0x26')](function(){return _0x45cf47;});}else{return _0x45cf47;}})[_0x6a4c('0x55')](function(_0x3dbc42){logger[_0x6a4c('0x2a')](_0x6a4c('0x56'),_0x3dbc42);throw _0x3dbc42;});}return _0x45cf47;})['then'](respondWithResult(_0x369beb,0xc9))[_0x6a4c('0x55')](handleError(_0x369beb,null));};exports[_0x6a4c('0x25')]=function(_0x169705,_0x58a8c5){if(_0x169705[_0x6a4c('0x4d')]['id']){delete _0x169705[_0x6a4c('0x4d')]['id'];}return db[_0x6a4c('0x30')]['find']({'where':{'id':_0x169705[_0x6a4c('0x57')]['id']}})['then'](handleEntityNotFound(_0x58a8c5,null))[_0x6a4c('0x26')](saveUpdates(_0x169705[_0x6a4c('0x4d')],null))['then'](respondWithResult(_0x58a8c5,null))[_0x6a4c('0x55')](handleError(_0x58a8c5,null));};exports[_0x6a4c('0x58')]=function(_0x117a6a,_0x329d71){return db['Team'][_0x6a4c('0x52')]({'where':{'id':_0x117a6a['params']['id']}})['then'](handleEntityNotFound(_0x329d71,null))[_0x6a4c('0x26')](removeEntity(_0x329d71,null))[_0x6a4c('0x55')](handleError(_0x329d71,null));};exports[_0x6a4c('0x59')]=function(_0x4b8771,_0xbc5ae6,_0x5bbedd){return db[_0x6a4c('0x30')][_0x6a4c('0x5a')]({'where':{'id':_0x4b8771[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0xbc5ae6,null))[_0x6a4c('0x26')](function(_0x1ae1f8){if(!_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x5b')]||!utils[_0x6a4c('0x5c')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x5b')])){throw new db[(_0x6a4c('0x5d'))][(_0x6a4c('0x5e'))](_0x6a4c('0x5f'));}var _0x928e0b={};var _0x247bf0={};_0x247bf0[_0x6a4c('0x35')]=_[_0x6a4c('0x37')](db[_[_0x6a4c('0x60')](_0x4b8771[_0x6a4c('0x36')]['channel']['toLowerCase']())+_0x6a4c('0x61')][_0x6a4c('0x31')]);_0x247bf0[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x4b8771[_0x6a4c('0x36')]);_0x247bf0[_0x6a4c('0x42')]=_['intersection'](_0x247bf0['model'],_0x247bf0[_0x6a4c('0x36')]);_0x928e0b[_0x6a4c('0x3a')]=_[_0x6a4c('0x38')](_0x247bf0['model'],qs[_0x6a4c('0x39')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x928e0b[_0x6a4c('0x3a')]=_0x928e0b['attributes'][_0x6a4c('0x3b')]?_0x928e0b[_0x6a4c('0x3a')]:_0x247bf0[_0x6a4c('0x35')];_0x928e0b['limit']=qs[_0x6a4c('0x3e')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x3e')]);_0x928e0b[_0x6a4c('0x21')]=qs['offset'](_0x4b8771['query']['offset']);_0x928e0b[_0x6a4c('0x3f')]=qs[_0x6a4c('0x40')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x40')]);_0x928e0b[_0x6a4c('0x41')]=qs['filters'](_[_0x6a4c('0x43')](_0x4b8771['query'],_0x247bf0[_0x6a4c('0x42')]));_0x928e0b=_[_0x6a4c('0x45')]({},_0x928e0b,_0x4b8771[_0x6a4c('0x4b')]);return _0x1ae1f8['get'+_[_0x6a4c('0x60')](_0x4b8771[_0x6a4c('0x36')]['channel'][_0x6a4c('0x62')]())+'Queues'](_0x928e0b);})['then'](respondWithResult(_0xbc5ae6,null))[_0x6a4c('0x55')](handleError(_0xbc5ae6,null));};exports[_0x6a4c('0x63')]=function(_0x5d7b06,_0x337c8c,_0x18df53){return db['Team'][_0x6a4c('0x5a')]({'where':{'id':_0x5d7b06[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](function(_0x4c42e0){if(_0x4c42e0){if(!_0x5d7b06[_0x6a4c('0x4d')]['channel']||!utils[_0x6a4c('0x5c')](_0x5d7b06[_0x6a4c('0x4d')]['channel'])){throw new db[(_0x6a4c('0x5d'))][(_0x6a4c('0x5e'))]('Unknown\x20channel');}return _0x4c42e0[_0x6a4c('0x64')+_['capitalize'](_0x5d7b06[_0x6a4c('0x4d')][_0x6a4c('0x5b')]['toLowerCase']())+'Queues'](_0x5d7b06[_0x6a4c('0x4d')][_0x6a4c('0x65')]);}return null;})[_0x6a4c('0x26')](handleEntityNotFound(_0x337c8c,null))[_0x6a4c('0x26')](respondWithStatusCode(_0x337c8c,null))[_0x6a4c('0x55')](handleError(_0x337c8c,null));};exports[_0x6a4c('0x66')]=function(_0x152361,_0x159f29,_0x21c57c){return db[_0x6a4c('0x30')]['findOne']({'where':{'id':_0x152361[_0x6a4c('0x57')]['id']}})['then'](function(_0x3188d7){if(_0x3188d7){if(!_0x152361['query'][_0x6a4c('0x5b')]||!utils[_0x6a4c('0x5c')](_0x152361[_0x6a4c('0x36')]['channel'])){throw new db[(_0x6a4c('0x5d'))]['ValidationError'](_0x6a4c('0x5f'));}return _0x3188d7['remove'+_[_0x6a4c('0x60')](_0x152361[_0x6a4c('0x36')][_0x6a4c('0x5b')][_0x6a4c('0x62')]())+_0x6a4c('0x67')](_0x152361[_0x6a4c('0x36')]['ids']);}return null;})['then'](handleEntityNotFound(_0x159f29,null))[_0x6a4c('0x26')](respondWithStatusCode(_0x159f29,null))[_0x6a4c('0x55')](handleError(_0x159f29,null));};exports['addAgents']=function(_0x4c4eb7,_0x589fce,_0x3615f2){return db[_0x6a4c('0x30')][_0x6a4c('0x52')]({'where':{'id':_0x4c4eb7[_0x6a4c('0x57')]['id']}})['then'](handleEntityNotFound(_0x589fce,null))['then'](function(_0xfe957e){if(_0xfe957e){var _0x1700b3=['Voice',_0x6a4c('0x68'),'Mail',_0x6a4c('0x69'),_0x6a4c('0x6a'),_0x6a4c('0x6b'),'Whatsapp'];return BPromise['each'](_0x1700b3,function(_0x744e7c){return _0xfe957e[_0x6a4c('0x27')+_0x744e7c+_0x6a4c('0x67')]({'attributes':['id','name']})[_0x6a4c('0x26')](function(_0x397b1e){return BPromise['each'](_0x397b1e,function(_0x3f4bfb){return _0x3f4bfb[_0x6a4c('0x6c')](_0x4c4eb7[_0x6a4c('0x4d')][_0x6a4c('0x65')])['then'](function(){if(_0x744e7c===_0x6a4c('0x6d')){return db['User'][_0x6a4c('0x49')]({'where':{'id':_0x4c4eb7['body'][_0x6a4c('0x65')]},'attributes':['id',_0x6a4c('0x2c'),_0x6a4c('0x6e'),_0x6a4c('0x6f'),_0x6a4c('0x70')],'raw':!![]})[_0x6a4c('0x26')](function(_0x3f3ce4){return BPromise['each'](_['filter'](_0x3f3ce4,{'online':0x1}),function(_0x3bd148){return db[_0x6a4c('0x71')]['upsert']({'membername':_0x3bd148[_0x6a4c('0x2c')],'UserId':_0x3bd148['id'],'queue_name':_0x3f4bfb[_0x6a4c('0x2c')],'VoiceQueueId':_0x3f4bfb['id'],'interface':_[_0x6a4c('0x72')](_0x3bd148[_0x6a4c('0x70')])?util[_0x6a4c('0x73')](_0x6a4c('0x74'),_0x3bd148['name']):_0x3bd148[_0x6a4c('0x70')],'paused':_0x3bd148[_0x6a4c('0x6f')]||![],'penalty':0x0});});});}});});})[_0x6a4c('0x26')](function(){return _0xfe957e;});})[_0x6a4c('0x26')](function(){return _0xfe957e;});}})[_0x6a4c('0x26')](function(_0x1e3051){if(_0x1e3051){return _0x1e3051[_0x6a4c('0x6c')](_0x4c4eb7[_0x6a4c('0x4d')][_0x6a4c('0x65')],_[_0x6a4c('0x75')](_0x4c4eb7[_0x6a4c('0x4d')],[_0x6a4c('0x65'),'id'])||{})[_0x6a4c('0x76')](function(_0x13e94c){for(var _0x46dbd0=0x0;_0x46dbd0<_0x4c4eb7[_0x6a4c('0x4d')]['ids'][_0x6a4c('0x3b')];_0x46dbd0+=0x1){socket['emit'](_0x6a4c('0x77'),{'UserId':_0x4c4eb7[_0x6a4c('0x4d')]['ids'][_0x46dbd0],'TeamId':_0x4c4eb7['params']['id']});}return _0x13e94c;});}})['then'](respondWithResult(_0x589fce,null))[_0x6a4c('0x55')](handleError(_0x589fce,null));};exports[_0x6a4c('0x78')]=function(_0x129ac8,_0x5af19b,_0x4499d2){return db['Team'][_0x6a4c('0x52')]({'where':{'id':_0x129ac8['params']['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0x5af19b,null))[_0x6a4c('0x26')](function(_0x5d46a1){if(_0x5d46a1){return BPromise[_0x6a4c('0x79')](['voice',_0x6a4c('0x7a'),_0x6a4c('0x7b'),_0x6a4c('0x7c'),'fax','openchannel',_0x6a4c('0x7d')],function(_0x422a6d){return _0x5d46a1[_0x6a4c('0x27')+_[_0x6a4c('0x60')](_0x422a6d)+_0x6a4c('0x67')]({'attributes':['id',_0x6a4c('0x2c')]})[_0x6a4c('0x26')](function(_0x5b6547){return BPromise[_0x6a4c('0x79')](_0x5b6547,function(_0x4c8c1f){return _0x4c8c1f[_0x6a4c('0x78')](_0x129ac8[_0x6a4c('0x36')]['ids'])[_0x6a4c('0x26')](function(){if(_0x422a6d===_0x6a4c('0x7e')){return db[_0x6a4c('0x71')][_0x6a4c('0x58')]({'where':{'VoiceQueueId':_0x4c8c1f['id'],'UserId':_0x129ac8[_0x6a4c('0x36')]['ids']}});}});});})['then'](function(){return _0x5d46a1;});})[_0x6a4c('0x26')](function(){return _0x5d46a1;});}})[_0x6a4c('0x26')](function(_0xea68b1){if(_0xea68b1){return _0xea68b1[_0x6a4c('0x78')](_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')])[_0x6a4c('0x26')](function(){if(_[_0x6a4c('0x7f')](_0x129ac8[_0x6a4c('0x36')]['ids'])){for(var _0x3aa7ba=0x0;_0x3aa7ba<_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')][_0x6a4c('0x3b')];_0x3aa7ba+=0x1){socket[_0x6a4c('0x80')](_0x6a4c('0x81'),{'UserId':Number(_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')][_0x3aa7ba]),'TeamId':Number(_0x129ac8[_0x6a4c('0x57')]['id'])});}}else{socket[_0x6a4c('0x80')]('userTeam:remove',{'UserId':Number(_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')]),'TeamId':Number(_0x129ac8['params']['id'])});}});}})[_0x6a4c('0x26')](respondWithStatusCode(_0x5af19b,null))[_0x6a4c('0x55')](handleError(_0x5af19b,null));};exports[_0x6a4c('0x82')]=function(_0x4587a0,_0x3e874d,_0x104351){var _0x416b6e={};var _0x579db7={};var _0x4befce;var _0x3b47e7;return db[_0x6a4c('0x30')]['findOne']({'where':{'id':_0x4587a0[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0x3e874d,null))[_0x6a4c('0x26')](function(_0x4e15ef){if(_0x4e15ef){_0x4befce=_0x4e15ef;_0x579db7['model']=_[_0x6a4c('0x37')](db[_0x6a4c('0x83')][_0x6a4c('0x31')]);_0x579db7[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x4587a0[_0x6a4c('0x36')]);_0x579db7[_0x6a4c('0x42')]=_[_0x6a4c('0x38')](_0x579db7[_0x6a4c('0x35')],_0x579db7[_0x6a4c('0x36')]);_0x416b6e[_0x6a4c('0x3a')]=_['intersection'](_0x579db7[_0x6a4c('0x35')],qs[_0x6a4c('0x39')](_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x416b6e[_0x6a4c('0x3a')]=_0x416b6e['attributes'][_0x6a4c('0x3b')]?_0x416b6e[_0x6a4c('0x3a')]:_0x579db7[_0x6a4c('0x35')];_0x416b6e[_0x6a4c('0x3f')]=qs['sort'](_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x40')]);_0x416b6e[_0x6a4c('0x41')]=qs[_0x6a4c('0x42')](_[_0x6a4c('0x43')](_0x4587a0['query'],_0x579db7[_0x6a4c('0x42')]));if(_0x4587a0['query']['filter']){_0x416b6e[_0x6a4c('0x41')]=_[_0x6a4c('0x45')](_0x416b6e[_0x6a4c('0x41')],{'$or':_[_0x6a4c('0x2f')](_0x416b6e[_0x6a4c('0x3a')],function(_0x29d800){var _0x4537b4={};_0x4537b4[_0x29d800]={'$like':'%'+_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x44')]+'%'};return _0x4537b4;})});}_0x416b6e=_[_0x6a4c('0x45')]({},_0x416b6e,_0x4587a0[_0x6a4c('0x4b')]);return _0x4befce['getAgents'](_0x416b6e);}})[_0x6a4c('0x26')](function(_0x10c780){if(_0x10c780){_0x3b47e7=_0x10c780[_0x6a4c('0x3b')];if(!_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x3c')](_0x6a4c('0x3d'))){_0x416b6e[_0x6a4c('0x3e')]=qs['limit'](_0x4587a0[_0x6a4c('0x36')]['limit']);_0x416b6e['offset']=qs[_0x6a4c('0x21')](_0x4587a0['query'][_0x6a4c('0x21')]);}return _0x4befce[_0x6a4c('0x82')](_0x416b6e);}})[_0x6a4c('0x26')](function(_0x483890){if(_0x483890){return _0x483890?{'count':_0x3b47e7,'rows':_0x483890}:null;}})[_0x6a4c('0x26')](respondWithResult(_0x3e874d,null))[_0x6a4c('0x55')](handleError(_0x3e874d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c812bf2..1a8bbb4 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 _0x99d6=['emit','hook','events','../../mysqldb','save','update'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x99d6,0xf2));var _0x699d=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x99d6[_0x237da8];return _0x558825;};'use strict';var EventEmitter=require(_0x699d('0x0'));var Team=require(_0x699d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x699d('0x2'),'afterUpdate':_0x699d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5efbc9){return function(_0x4ff457,_0x502fd0,_0x21011e){TeamEvents[_0x699d('0x4')](_0x5efbc9+':'+_0x4ff457['id'],_0x4ff457);TeamEvents['emit'](_0x5efbc9,_0x4ff457);_0x21011e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x699d('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x80b8=['Team','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x80b8,0x19d));var _0x880b=function(_0x4c3869,_0x5375d){_0x4c3869=_0x4c3869-0x0;var _0x375b92=_0x80b8[_0x4c3869];return _0x375b92;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x880b('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x880b('0x1')](0x0);var events={'afterCreate':_0x880b('0x2'),'afterUpdate':'update','afterDestroy':_0x880b('0x3')};function emitEvent(_0x4e53f5){return function(_0x417447,_0x4512de,_0x39870a){TeamEvents[_0x880b('0x4')](_0x4e53f5+':'+_0x417447['id'],_0x417447);TeamEvents[_0x880b('0x4')](_0x4e53f5,_0x417447);_0x39870a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x880b('0x5')](e,emitEvent(event));}}module[_0x880b('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 800f56e..4b26a86 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 _0xe7cc=['bluebird','path','../../config/environment','./team.attributes','define','Team','teams','lodash','util','../../config/logger','api'];(function(_0x3b5524,_0xff6ab3){var _0x3b1331=function(_0xc5dbda){while(--_0xc5dbda){_0x3b5524['push'](_0x3b5524['shift']());}};_0x3b1331(++_0xff6ab3);}(_0xe7cc,0xc2));var _0xce7c=function(_0x31f6a9,_0x3b5ddb){_0x31f6a9=_0x31f6a9-0x0;var _0x153f35=_0xe7cc[_0x31f6a9];return _0x153f35;};'use strict';var _=require(_0xce7c('0x0'));var util=require(_0xce7c('0x1'));var logger=require(_0xce7c('0x2'))(_0xce7c('0x3'));var moment=require('moment');var BPromise=require(_0xce7c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce7c('0x5'));var rimraf=require('rimraf');var config=require(_0xce7c('0x6'));var attributes=require(_0xce7c('0x7'));module['exports']=function(_0x39ac6c,_0x38abc1){return _0x39ac6c[_0xce7c('0x8')](_0xce7c('0x9'),attributes,{'tableName':_0xce7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a1=['Team','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./team.attributes','exports','define'];(function(_0x21e062,_0x27b032){var _0xc4cd51=function(_0x16176d){while(--_0x16176d){_0x21e062['push'](_0x21e062['shift']());}};_0xc4cd51(++_0x27b032);}(_0x63a1,0x140));var _0x163a=function(_0x13040d,_0x436867){_0x13040d=_0x13040d-0x0;var _0x580759=_0x63a1[_0x13040d];return _0x580759;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x163a('0x0'))(_0x163a('0x1'));var moment=require(_0x163a('0x2'));var BPromise=require(_0x163a('0x3'));var rp=require(_0x163a('0x4'));var fs=require('fs');var path=require(_0x163a('0x5'));var rimraf=require(_0x163a('0x6'));var config=require('../../config/environment');var attributes=require(_0x163a('0x7'));module[_0x163a('0x8')]=function(_0xd23044,_0x123bf0){return _0xd23044[_0x163a('0x9')](_0x163a('0xa'),attributes,{'tableName':'teams','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 241be23..6bbbe4a 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 _0x0689=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31a9d9,_0x32ae74){var _0x3832da=function(_0x5a4c10){while(--_0x5a4c10){_0x31a9d9['push'](_0x31a9d9['shift']());}};_0x3832da(++_0x32ae74);}(_0x0689,0xc4));var _0x9068=function(_0x221b76,_0x3ecddd){_0x221b76=_0x221b76-0x0;var _0x37d2eb=_0x0689[_0x221b76];return _0x37d2eb;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require(_0x9068('0x1'));var BPromise=require(_0x9068('0x2'));var rs=require(_0x9068('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))('rpc');var config=require(_0x9068('0x7'));var jayson=require(_0x9068('0x8'));var client=jayson[_0x9068('0x9')][_0x9068('0xa')]({'port':0x232a});config[_0x9068('0xb')]=_[_0x9068('0xc')](config[_0x9068('0xb')],{'host':_0x9068('0xd'),'port':0x18eb});var socket=require(_0x9068('0xe'))(new Redis(config[_0x9068('0xb')]));require(_0x9068('0xf'))[_0x9068('0x10')](socket);function respondWithRpcPromise(_0x4ecdd8,_0x5b1e38,_0x145053){return new BPromise(function(_0x371ed6,_0x4b5882){return client[_0x9068('0x11')](_0x4ecdd8,_0x145053)[_0x9068('0x12')](function(_0x4d894f){logger['info'](_0x9068('0x13'),_0x5b1e38,'request\x20sent');logger['debug'](_0x9068('0x14'),_0x5b1e38,'request\x20sent',JSON[_0x9068('0x15')](_0x4d894f));if(_0x4d894f['error']){if(_0x4d894f['error'][_0x9068('0x16')]===0x1f4){logger[_0x9068('0x17')](_0x9068('0x13'),_0x5b1e38,_0x4d894f['error'][_0x9068('0x18')]);return _0x4b5882(_0x4d894f[_0x9068('0x17')]['message']);}logger[_0x9068('0x17')](_0x9068('0x13'),_0x5b1e38,_0x4d894f[_0x9068('0x17')][_0x9068('0x18')]);return _0x371ed6(_0x4d894f[_0x9068('0x17')][_0x9068('0x18')]);}else{logger[_0x9068('0x19')](_0x9068('0x13'),_0x5b1e38,_0x9068('0x1a'));_0x371ed6(_0x4d894f[_0x9068('0x1b')][_0x9068('0x18')]);}})[_0x9068('0x1c')](function(_0x439db1){logger[_0x9068('0x17')]('Team,\x20%s,\x20%s',_0x5b1e38,_0x439db1);_0x4b5882(_0x439db1);});});} \ No newline at end of file +var _0xf5aa=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket'];(function(_0x32acd4,_0x5f34fd){var _0x342d89=function(_0x1671f8){while(--_0x1671f8){_0x32acd4['push'](_0x32acd4['shift']());}};_0x342d89(++_0x5f34fd);}(_0xf5aa,0x140));var _0xaf5a=function(_0xec0bfb,_0x19018d){_0xec0bfb=_0xec0bfb-0x0;var _0x5a1611=_0xf5aa[_0xec0bfb];return _0x5a1611;};'use strict';var _=require(_0xaf5a('0x0'));var util=require(_0xaf5a('0x1'));var moment=require(_0xaf5a('0x2'));var BPromise=require(_0xaf5a('0x3'));var rs=require(_0xaf5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf5a('0x5'));var logger=require(_0xaf5a('0x6'))(_0xaf5a('0x7'));var config=require(_0xaf5a('0x8'));var jayson=require(_0xaf5a('0x9'));var client=jayson[_0xaf5a('0xa')][_0xaf5a('0xb')]({'port':0x232a});config[_0xaf5a('0xc')]=_[_0xaf5a('0xd')](config[_0xaf5a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf5a('0xe'))(new Redis(config['redis']));require(_0xaf5a('0xf'))['register'](socket);function respondWithRpcPromise(_0x4fd2a1,_0x22b3dd,_0x5a31fe){return new BPromise(function(_0x4c41f1,_0x34ab98){return client[_0xaf5a('0x10')](_0x4fd2a1,_0x5a31fe)[_0xaf5a('0x11')](function(_0xcf035d){logger[_0xaf5a('0x12')](_0xaf5a('0x13'),_0x22b3dd,_0xaf5a('0x14'));logger['debug'](_0xaf5a('0x15'),_0x22b3dd,_0xaf5a('0x14'),JSON[_0xaf5a('0x16')](_0xcf035d));if(_0xcf035d[_0xaf5a('0x17')]){if(_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x18')]===0x1f4){logger[_0xaf5a('0x17')]('Team,\x20%s,\x20%s',_0x22b3dd,_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);return _0x34ab98(_0xcf035d[_0xaf5a('0x17')]['message']);}logger[_0xaf5a('0x17')]('Team,\x20%s,\x20%s',_0x22b3dd,_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);return _0x4c41f1(_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);}else{logger[_0xaf5a('0x12')](_0xaf5a('0x13'),_0x22b3dd,_0xaf5a('0x14'));_0x4c41f1(_0xcf035d[_0xaf5a('0x1a')]['message']);}})[_0xaf5a('0x1b')](function(_0x3b0321){logger['error'](_0xaf5a('0x13'),_0x22b3dd,_0x3b0321);_0x34ab98(_0x3b0321);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f68ccf2..86b1cc9 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 _0xf78f=['remove','update','length','team:','save'];(function(_0x12276f,_0x308738){var _0x4c2383=function(_0x4e4392){while(--_0x4e4392){_0x12276f['push'](_0x12276f['shift']());}};_0x4c2383(++_0x308738);}(_0xf78f,0x72));var _0xff78=function(_0x25a228,_0x77fd54){_0x25a228=_0x25a228-0x0;var _0x3aa8db=_0xf78f[_0x25a228];return _0x3aa8db;};'use strict';var TeamEvents=require('./team.events');var events=[_0xff78('0x0'),_0xff78('0x1'),_0xff78('0x2')];function createListener(_0x2be014,_0x1c54c2){return function(_0x2cf009){_0x1c54c2['emit'](_0x2be014,_0x2cf009);};}function removeListener(_0x48fe97,_0x5b8499){return function(){TeamEvents['removeListener'](_0x48fe97,_0x5b8499);};}exports['register']=function(_0x35f208){for(var _0x487ec1=0x0,_0x14edec=events[_0xff78('0x3')];_0x487ec1<_0x14edec;_0x487ec1++){var _0x437ed4=events[_0x487ec1];var _0x32df40=createListener(_0xff78('0x4')+_0x437ed4,_0x35f208);TeamEvents['on'](_0x437ed4,_0x32df40);}}; \ No newline at end of file +var _0x4af9=['./team.events','save','emit','removeListener','length','team:'];(function(_0x5d3fec,_0x3990a3){var _0x5b8963=function(_0x2c9c7d){while(--_0x2c9c7d){_0x5d3fec['push'](_0x5d3fec['shift']());}};_0x5b8963(++_0x3990a3);}(_0x4af9,0x12c));var _0x94af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4af9[_0x3ab51d];return _0x29a04e;};'use strict';var TeamEvents=require(_0x94af('0x0'));var events=[_0x94af('0x1'),'remove','update'];function createListener(_0x11a2c7,_0x1fc2ed){return function(_0x3a5ecc){_0x1fc2ed[_0x94af('0x2')](_0x11a2c7,_0x3a5ecc);};}function removeListener(_0x1362cc,_0x14d407){return function(){TeamEvents[_0x94af('0x3')](_0x1362cc,_0x14d407);};}exports['register']=function(_0x28a640){for(var _0x360a33=0x0,_0x3e19c9=events[_0x94af('0x4')];_0x360a33<_0x3e19c9;_0x360a33++){var _0x5ad956=events[_0x360a33];var _0x2f84d4=createListener(_0x94af('0x5')+_0x5ad956,_0x28a640);TeamEvents['on'](_0x5ad956,_0x2f84d4);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d19f811..c6cbc82 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 _0x3155=['/:id','show','post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3d4e91,_0x3218ed){var _0x47f62d=function(_0x50cea5){while(--_0x50cea5){_0x3d4e91['push'](_0x3d4e91['shift']());}};_0x47f62d(++_0x3218ed);}(_0x3155,0x179));var _0x5315=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x3155[_0x14e27a];return _0x288688;};'use strict';var multer=require(_0x5315('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5315('0x1'));var router=express[_0x5315('0x2')]();var auth=require(_0x5315('0x3'));var interaction=require(_0x5315('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x5315('0x5')]('/',auth[_0x5315('0x6')](),controller['index']);router[_0x5315('0x5')](_0x5315('0x7'),auth[_0x5315('0x6')](),controller[_0x5315('0x8')]);router[_0x5315('0x9')]('/',auth['isAuthenticated'](),controller[_0x5315('0xa')]);router[_0x5315('0xb')](_0x5315('0x7'),auth['isAuthenticated'](),controller[_0x5315('0xc')]);router[_0x5315('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5315('0xe')]);module[_0x5315('0xf')]=router; \ No newline at end of file +var _0x5f0f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5f0f,0x18a));var _0xf5f0=function(_0x127122,_0x145860){_0x127122=_0x127122-0x0;var _0x2b5158=_0x5f0f[_0x127122];return _0x2b5158;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5f0('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5f0('0x1'));var router=express[_0xf5f0('0x2')]();var auth=require(_0xf5f0('0x3'));var interaction=require(_0xf5f0('0x4'));var config=require(_0xf5f0('0x5'));var controller=require(_0xf5f0('0x6'));router[_0xf5f0('0x7')]('/',auth[_0xf5f0('0x8')](),controller[_0xf5f0('0x9')]);router[_0xf5f0('0x7')](_0xf5f0('0xa'),auth['isAuthenticated'](),controller[_0xf5f0('0xb')]);router[_0xf5f0('0xc')]('/',auth[_0xf5f0('0x8')](),controller[_0xf5f0('0xd')]);router[_0xf5f0('0xe')]('/:id',auth[_0xf5f0('0x8')](),controller['update']);router[_0xf5f0('0xf')](_0xf5f0('0xa'),auth[_0xf5f0('0x8')](),controller[_0xf5f0('0x10')]);module[_0xf5f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8a8a11a..5aa484e 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 _0xe060=['sequelize','exports','STRING','TEXT'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0xe060,0x150));var _0x0e06=function(_0x24f0b8,_0x3ce0ab){_0x24f0b8=_0x24f0b8-0x0;var _0x43b0d4=_0xe060[_0x24f0b8];return _0x43b0d4;};'use strict';var Sequelize=require(_0x0e06('0x0'));module[_0x0e06('0x1')]={'name':{'type':Sequelize[_0x0e06('0x2')]},'description':{'type':Sequelize[_0x0e06('0x2')]},'html':{'type':Sequelize[_0x0e06('0x3')]}}; \ No newline at end of file +var _0xaef2=['TEXT','sequelize','exports'];(function(_0x577f7f,_0x34b78a){var _0x40625a=function(_0xbeb647){while(--_0xbeb647){_0x577f7f['push'](_0x577f7f['shift']());}};_0x40625a(++_0x34b78a);}(_0xaef2,0x169));var _0x2aef=function(_0x243473,_0x462a89){_0x243473=_0x243473-0x0;var _0x5cbea7=_0xaef2[_0x243473];return _0x5cbea7;};'use strict';var Sequelize=require(_0x2aef('0x0'));module[_0x2aef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x2aef('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1935eca..5a6a0d9 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x3ccc1c,_0x37ed12){var _0x3bc6a1=function(_0x1b64f2){while(--_0x1b64f2){_0x3ccc1c['push'](_0x3ccc1c['shift']());}};_0x3bc6a1(++_0x37ed12);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file +var _0x1261=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','name','send','index','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x308ee4,_0x2331fe){var _0x353ed9=function(_0x262145){while(--_0x262145){_0x308ee4['push'](_0x308ee4['shift']());}};_0x353ed9(++_0x2331fe);}(_0x1261,0x144));var _0x1126=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x1261[_0x2dadb9];return _0x2f0097;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){var _0x48a08d=_0x526ca1[_0x1126('0x23')]({'plain':!![]});var _0x59cd8e='Templates';return db['UserProfileResource'][_0x1126('0x22')]({'where':{'type':_0x59cd8e,'resourceId':_0x48a08d['id']}})[_0x1126('0x21')](function(){return _0x526ca1;});})[_0x1126('0x21')](function(){_0x25b24b[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x1b07a7,_0xea0971){return function(_0x38119d){if(!_0x38119d){_0x1b07a7['sendStatus'](0x194);}return _0x38119d;};}function handleError(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0x1f4;return function(_0xa293f4){logger['error'](_0xa293f4['stack']);if(_0xa293f4[_0x1126('0x24')]){delete _0xa293f4[_0x1126('0x24')];}_0x35eec3['status'](_0x375e59)[_0x1126('0x25')](_0xa293f4);};}exports[_0x1126('0x26')]=function(_0x4a334a,_0x3fa694){var _0x4bf807={},_0xc62460={},_0x4bd50b={'count':0x0,'rows':[]};var _0x771bb8=_['map'](db[_0x1126('0x27')]['rawAttributes'],function(_0x5252e0){return{'name':_0x5252e0['fieldName'],'type':_0x5252e0[_0x1126('0x28')][_0x1126('0x29')]};});_0xc62460[_0x1126('0x2a')]=_['map'](_0x771bb8,_0x1126('0x24'));_0xc62460[_0x1126('0x2b')]=_['keys'](_0x4a334a[_0x1126('0x2b')]);_0xc62460[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],_0xc62460['query']);_0x4bf807['attributes']=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],qs[_0x1126('0x2e')](_0x4a334a[_0x1126('0x2b')]['fields']));_0x4bf807[_0x1126('0x2f')]=_0x4bf807[_0x1126('0x2f')][_0x1126('0x30')]?_0x4bf807[_0x1126('0x2f')]:_0xc62460[_0x1126('0x2a')];if(!_0x4a334a['query'][_0x1126('0x31')](_0x1126('0x32'))){_0x4bf807[_0x1126('0x33')]=qs[_0x1126('0x33')](_0x4a334a['query']['limit']);_0x4bf807[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x4a334a['query'][_0x1126('0x1c')]);}_0x4bf807[_0x1126('0x34')]=qs[_0x1126('0x35')](_0x4a334a['query']['sort']);_0x4bf807[_0x1126('0x36')]=qs[_0x1126('0x2c')](_[_0x1126('0x37')](_0x4a334a[_0x1126('0x2b')],_0xc62460['filters']),_0x771bb8);if(_0x4a334a[_0x1126('0x2b')]['filter']){_0x4bf807[_0x1126('0x36')]=_[_0x1126('0x38')](_0x4bf807[_0x1126('0x36')],{'$or':_[_0x1126('0x39')](_0x771bb8,function(_0x57e5d2){if(_0x57e5d2['type']!==_0x1126('0x3a')){var _0x3ea9de={};_0x3ea9de[_0x57e5d2[_0x1126('0x24')]]={'$like':'%'+_0x4a334a[_0x1126('0x2b')][_0x1126('0x3b')]+'%'};return _0x3ea9de;}})});}_0x4bf807=_[_0x1126('0x38')]({},_0x4bf807,_0x4a334a[_0x1126('0x3c')]);var _0x4faaa3={'where':_0x4bf807[_0x1126('0x36')]};return db[_0x1126('0x27')][_0x1126('0x3d')](_0x4faaa3)[_0x1126('0x21')](function(_0xcf0483){_0x4bd50b['count']=_0xcf0483;if(_0x4a334a['query'][_0x1126('0x3e')]){_0x4bf807[_0x1126('0x3f')]=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x40')](_0x4bf807);})[_0x1126('0x21')](function(_0x276fd5){_0x4bd50b['rows']=_0x276fd5;return _0x4bd50b;})['then'](respondWithFilteredResult(_0x3fa694,_0x4bf807))['catch'](handleError(_0x3fa694,null));};exports[_0x1126('0x41')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':!![],'where':{'id':_0x5d4194[_0x1126('0x42')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x27')][_0x1126('0x43')]);_0x3584a3[_0x1126('0x2b')]=_['keys'](_0x5d4194[_0x1126('0x2b')]);_0x3584a3['filters']=_[_0x1126('0x2d')](_0x3584a3['model'],_0x3584a3[_0x1126('0x2b')]);_0x462da8[_0x1126('0x2f')]=_[_0x1126('0x2d')](_0x3584a3['model'],qs[_0x1126('0x2e')](_0x5d4194[_0x1126('0x2b')][_0x1126('0x2e')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x2f')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x2b')]['includeAll']){_0x462da8[_0x1126('0x3f')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x38')]({},_0x462da8,_0x5d4194[_0x1126('0x3c')]);return db[_0x1126('0x27')][_0x1126('0x44')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x21')](respondWithResult(_0xf84005,null))[_0x1126('0x45')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['Template'][_0x1126('0x46')](_0x1a15f8[_0x1126('0x47')],{})['then'](function(_0x3e4eeb){var _0xbdde58=_0x1a15f8[_0x1126('0x48')]['get']({'plain':!![]});if(!_0xbdde58)throw new Error(_0x1126('0x49'));if(_0xbdde58[_0x1126('0x4a')]===_0x1126('0x48')){var _0x5878bb=_0x3e4eeb[_0x1126('0x23')]({'plain':!![]});var _0x2081f2=_0x1126('0x4b');return db[_0x1126('0x4c')]['find']({'where':{'name':_0x2081f2,'userProfileId':_0xbdde58[_0x1126('0x4d')]},'raw':!![]})['then'](function(_0x40168e){if(_0x40168e&&_0x40168e[_0x1126('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5878bb[_0x1126('0x24')],'resourceId':_0x5878bb['id'],'type':_0x40168e[_0x1126('0x24')],'sectionId':_0x40168e['id']},{})[_0x1126('0x21')](function(){return _0x3e4eeb;});}else{return _0x3e4eeb;}})['catch'](function(_0x3cb44c){logger[_0x1126('0x4f')](_0x1126('0x50'),_0x3cb44c);throw _0x3cb44c;});}return _0x3e4eeb;})[_0x1126('0x21')](respondWithResult(_0x13dc39,0xc9))['catch'](handleError(_0x13dc39,null));};exports[_0x1126('0x51')]=function(_0x46551f,_0x5c36b9){if(_0x46551f['body']['id']){delete _0x46551f['body']['id'];}return db['Template'][_0x1126('0x44')]({'where':{'id':_0x46551f[_0x1126('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c36b9,null))[_0x1126('0x21')](saveUpdates(_0x46551f[_0x1126('0x47')],null))[_0x1126('0x21')](respondWithResult(_0x5c36b9,null))[_0x1126('0x45')](handleError(_0x5c36b9,null));};exports[_0x1126('0x22')]=function(_0x4e4d49,_0x41cbb6){return db[_0x1126('0x27')]['find']({'where':{'id':_0x4e4d49[_0x1126('0x42')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x41cbb6,null))[_0x1126('0x21')](removeEntity(_0x41cbb6,null))[_0x1126('0x45')](handleError(_0x41cbb6,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a40a469..a736da1 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 _0xf13c=['util','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','tools_templates','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf13c,0x1b7));var _0xcf13=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xf13c[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0xcf13('0x0'));var util=require(_0xcf13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf13('0x2'));var BPromise=require(_0xcf13('0x3'));var rp=require(_0xcf13('0x4'));var fs=require('fs');var path=require(_0xcf13('0x5'));var rimraf=require(_0xcf13('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf13('0x7'));module[_0xcf13('0x8')]=function(_0x8af4fe,_0x4952ca){return _0x8af4fe[_0xcf13('0x9')]('Template',attributes,{'tableName':_0xcf13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48d2=['bluebird','request-promise','path','rimraf','../../config/environment','define','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x48d2,0x1e1));var _0x248d=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x48d2[_0x211fef];return _0x5447bf;};'use strict';var _=require(_0x248d('0x0'));var util=require('util');var logger=require(_0x248d('0x1'))(_0x248d('0x2'));var moment=require('moment');var BPromise=require(_0x248d('0x3'));var rp=require(_0x248d('0x4'));var fs=require('fs');var path=require(_0x248d('0x5'));var rimraf=require(_0x248d('0x6'));var config=require(_0x248d('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x3fda73,_0x85f63c){return _0x3fda73[_0x248d('0x8')](_0x248d('0x9'),attributes,{'tableName':_0x248d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index bb8ff9e..e64d6b5 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 _0xb69b=['attributes','limit','include','map','model','debug','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTemplate','findAll','options'];(function(_0x226054,_0x159a6c){var _0x44f7d8=function(_0xcd629e){while(--_0xcd629e){_0x226054['push'](_0x226054['shift']());}};_0x44f7d8(++_0x159a6c);}(_0xb69b,0x93));var _0xbb69=function(_0x2199ea,_0x52ee8e){_0x2199ea=_0x2199ea-0x0;var _0x4a7a43=_0xb69b[_0x2199ea];return _0x4a7a43;};'use strict';var _=require('lodash');var util=require(_0xbb69('0x0'));var moment=require('moment');var BPromise=require(_0xbb69('0x1'));var rs=require(_0xbb69('0x2'));var fs=require('fs');var Redis=require(_0xbb69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb69('0x4'));var logger=require(_0xbb69('0x5'))(_0xbb69('0x6'));var config=require(_0xbb69('0x7'));var jayson=require(_0xbb69('0x8'));var client=jayson['client'][_0xbb69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dbcf6,_0x1bf03a,_0x1681e1){return new BPromise(function(_0x34cc02,_0x21ac1d){return client['request'](_0x1dbcf6,_0x1681e1)[_0xbb69('0xa')](function(_0x5d09da){logger[_0xbb69('0xb')](_0xbb69('0xc'),_0x1bf03a,_0xbb69('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1bf03a,_0xbb69('0xd'),JSON[_0xbb69('0xe')](_0x5d09da));if(_0x5d09da[_0xbb69('0xf')]){if(_0x5d09da[_0xbb69('0xf')][_0xbb69('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x1bf03a,_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);return _0x21ac1d(_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);}logger[_0xbb69('0xf')](_0xbb69('0xc'),_0x1bf03a,_0x5d09da[_0xbb69('0xf')][_0xbb69('0x11')]);return _0x34cc02(_0x5d09da[_0xbb69('0xf')]['message']);}else{logger['info'](_0xbb69('0xc'),_0x1bf03a,_0xbb69('0xd'));_0x34cc02(_0x5d09da['result']['message']);}})['catch'](function(_0x5dd193){logger[_0xbb69('0xf')](_0xbb69('0xc'),_0x1bf03a,_0x5dd193);_0x21ac1d(_0x5dd193);});});}exports[_0xbb69('0x12')]=function(_0x593e45){var _0x1d4cd0=this;return new Promise(function(_0x2e1154,_0x4422e2){return db['Template'][_0xbb69('0x13')]({'raw':_0x593e45['options']?_0x593e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')]['where']||null:null,'attributes':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')][_0xbb69('0x15')]||null:null,'limit':_0x593e45[_0xbb69('0x14')]?_0x593e45[_0xbb69('0x14')][_0xbb69('0x16')]||null:null,'include':_0x593e45[_0xbb69('0x14')]?_0x593e45['options'][_0xbb69('0x17')]?_[_0xbb69('0x18')](_0x593e45[_0xbb69('0x14')][_0xbb69('0x17')],function(_0x386eec){return{'model':db[_0x386eec['model']],'as':_0x386eec['as'],'attributes':_0x386eec[_0xbb69('0x15')],'include':_0x386eec[_0xbb69('0x17')]?_[_0xbb69('0x18')](_0x386eec[_0xbb69('0x17')],function(_0x29de0f){return{'model':db[_0x29de0f[_0xbb69('0x19')]],'as':_0x29de0f['as'],'attributes':_0x29de0f[_0xbb69('0x15')],'include':_0x29de0f['include']?_[_0xbb69('0x18')](_0x29de0f[_0xbb69('0x17')],function(_0x4b507e){return{'model':db[_0x4b507e[_0xbb69('0x19')]],'as':_0x4b507e['as'],'attributes':_0x4b507e[_0xbb69('0x15')]};}):[]};}):[]};}):[]:[]})[_0xbb69('0xa')](function(_0x11fbd2){logger['info']('GetTemplate',_0x593e45);logger[_0xbb69('0x1a')]('GetTemplate',_0x593e45,JSON[_0xbb69('0xe')](_0x11fbd2));_0x2e1154(_0x11fbd2);})[_0xbb69('0x1b')](function(_0x2903e3){logger['error'](_0xbb69('0x12'),_0x2903e3[_0xbb69('0x11')],_0x593e45);_0x4422e2(_0x1d4cd0[_0xbb69('0xf')](0x1f4,_0x2903e3[_0xbb69('0x11')]));});});}; \ No newline at end of file +var _0x75e3=['catch','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','GetTemplate','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','info','result','message'];(function(_0x2d3ef7,_0x2fb595){var _0x25b7e4=function(_0xe09595){while(--_0xe09595){_0x2d3ef7['push'](_0x2d3ef7['shift']());}};_0x25b7e4(++_0x2fb595);}(_0x75e3,0x1ed));var _0x375e=function(_0x17b2ab,_0xf4e367){_0x17b2ab=_0x17b2ab-0x0;var _0xd57d00=_0x75e3[_0x17b2ab];return _0xd57d00;};'use strict';var _=require('lodash');var util=require(_0x375e('0x0'));var moment=require(_0x375e('0x1'));var BPromise=require(_0x375e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x375e('0x3'));var db=require(_0x375e('0x4'))['db'];var utils=require(_0x375e('0x5'));var logger=require(_0x375e('0x6'))(_0x375e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x375e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dfa7d,_0x369b30,_0x45d18a){return new BPromise(function(_0x40bbae,_0x2a50d6){return client[_0x375e('0x9')](_0x1dfa7d,_0x45d18a)['then'](function(_0x1cd23a){logger['info'](_0x375e('0xa'),_0x369b30,'request\x20sent');logger[_0x375e('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x369b30,_0x375e('0xc'),JSON[_0x375e('0xd')](_0x1cd23a));if(_0x1cd23a[_0x375e('0xe')]){if(_0x1cd23a[_0x375e('0xe')][_0x375e('0xf')]===0x1f4){logger[_0x375e('0xe')](_0x375e('0xa'),_0x369b30,_0x1cd23a[_0x375e('0xe')]['message']);return _0x2a50d6(_0x1cd23a[_0x375e('0xe')]['message']);}logger[_0x375e('0xe')](_0x375e('0xa'),_0x369b30,_0x1cd23a[_0x375e('0xe')]['message']);return _0x40bbae(_0x1cd23a['error']['message']);}else{logger[_0x375e('0x10')]('Template,\x20%s,\x20%s',_0x369b30,_0x375e('0xc'));_0x40bbae(_0x1cd23a[_0x375e('0x11')][_0x375e('0x12')]);}})[_0x375e('0x13')](function(_0x5eca46){logger[_0x375e('0xe')]('Template,\x20%s,\x20%s',_0x369b30,_0x5eca46);_0x2a50d6(_0x5eca46);});});}exports['GetTemplate']=function(_0x18734f){var _0x5fd2c9=this;return new Promise(function(_0x8a6b51,_0x5e3233){return db[_0x375e('0x14')][_0x375e('0x15')]({'raw':_0x18734f['options']?_0x18734f[_0x375e('0x16')][_0x375e('0x17')]===undefined?!![]:![]:!![],'where':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x18')]||null:null,'attributes':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x19')]||null:null,'limit':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x1a')]||null:null,'include':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')]['include']?_[_0x375e('0x1b')](_0x18734f[_0x375e('0x16')][_0x375e('0x1c')],function(_0x2ed014){return{'model':db[_0x2ed014[_0x375e('0x1d')]],'as':_0x2ed014['as'],'attributes':_0x2ed014['attributes'],'include':_0x2ed014[_0x375e('0x1c')]?_[_0x375e('0x1b')](_0x2ed014['include'],function(_0x5162a9){return{'model':db[_0x5162a9['model']],'as':_0x5162a9['as'],'attributes':_0x5162a9[_0x375e('0x19')],'include':_0x5162a9[_0x375e('0x1c')]?_[_0x375e('0x1b')](_0x5162a9[_0x375e('0x1c')],function(_0x6fdc6a){return{'model':db[_0x6fdc6a[_0x375e('0x1d')]],'as':_0x6fdc6a['as'],'attributes':_0x6fdc6a[_0x375e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x375e('0x1e')](function(_0x4adf5d){logger[_0x375e('0x10')](_0x375e('0x1f'),_0x18734f);logger[_0x375e('0xb')]('GetTemplate',_0x18734f,JSON[_0x375e('0xd')](_0x4adf5d));_0x8a6b51(_0x4adf5d);})[_0x375e('0x13')](function(_0x1e9303){logger[_0x375e('0xe')](_0x375e('0x1f'),_0x1e9303[_0x375e('0x12')],_0x18734f);_0x5e3233(_0x5fd2c9[_0x375e('0xe')](0x1f4,_0x1e9303[_0x375e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6be870b..b496bb7 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 _0xbad4=['/:id/all_conditions','addAllCondition','addAnyCondition','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post'];(function(_0x4ef483,_0x5e7c0b){var _0x3f0475=function(_0x37c0ae){while(--_0x37c0ae){_0x4ef483['push'](_0x4ef483['shift']());}};_0x3f0475(++_0x5e7c0b);}(_0xbad4,0x104));var _0x4bad=function(_0x1dbd89,_0x3805bf){_0x1dbd89=_0x1dbd89-0x0;var _0x40ed9b=_0xbad4[_0x1dbd89];return _0x40ed9b;};'use strict';var multer=require(_0x4bad('0x0'));var util=require(_0x4bad('0x1'));var path=require(_0x4bad('0x2'));var timeout=require(_0x4bad('0x3'));var express=require(_0x4bad('0x4'));var router=express[_0x4bad('0x5')]();var auth=require(_0x4bad('0x6'));var interaction=require(_0x4bad('0x7'));var config=require(_0x4bad('0x8'));var controller=require(_0x4bad('0x9'));router[_0x4bad('0xa')]('/',auth[_0x4bad('0xb')](),controller[_0x4bad('0xc')]);router['get'](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0xe')]);router['get']('/:id/all_conditions',auth[_0x4bad('0xb')](),controller[_0x4bad('0xf')]);router[_0x4bad('0xa')](_0x4bad('0x10'),auth[_0x4bad('0xb')](),controller['getAnyConditions']);router['get'](_0x4bad('0x11'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x12')]);router[_0x4bad('0x13')]('/',auth[_0x4bad('0xb')](),controller['create']);router['post'](_0x4bad('0x14'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x15')]);router[_0x4bad('0x13')]('/:id/any_conditions',auth[_0x4bad('0xb')](),controller[_0x4bad('0x16')]);router[_0x4bad('0x13')](_0x4bad('0x11'),auth[_0x4bad('0xb')](),controller['addAction']);router[_0x4bad('0x17')](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x18')]);router[_0x4bad('0x19')](_0x4bad('0xd'),auth[_0x4bad('0xb')](),controller[_0x4bad('0x1a')]);module[_0x4bad('0x1b')]=router; \ No newline at end of file +var _0x40a0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x40a0,0x101));var _0x040a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x40a0[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0x040a('0x0'));var path=require(_0x040a('0x1'));var timeout=require(_0x040a('0x2'));var express=require(_0x040a('0x3'));var router=express[_0x040a('0x4')]();var auth=require(_0x040a('0x5'));var interaction=require(_0x040a('0x6'));var config=require(_0x040a('0x7'));var controller=require('./trigger.controller');router[_0x040a('0x8')]('/',auth[_0x040a('0x9')](),controller[_0x040a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x040a('0x8')](_0x040a('0xb'),auth['isAuthenticated'](),controller[_0x040a('0xc')]);router[_0x040a('0x8')](_0x040a('0xd'),auth[_0x040a('0x9')](),controller[_0x040a('0xe')]);router['get'](_0x040a('0xf'),auth[_0x040a('0x9')](),controller[_0x040a('0x10')]);router[_0x040a('0x11')]('/',auth[_0x040a('0x9')](),controller[_0x040a('0x12')]);router[_0x040a('0x11')](_0x040a('0xb'),auth[_0x040a('0x9')](),controller[_0x040a('0x13')]);router[_0x040a('0x11')]('/:id/any_conditions',auth[_0x040a('0x9')](),controller[_0x040a('0x14')]);router['post'](_0x040a('0xf'),auth[_0x040a('0x9')](),controller['addAction']);router['put'](_0x040a('0x15'),auth[_0x040a('0x9')](),controller[_0x040a('0x16')]);router[_0x040a('0x17')](_0x040a('0x15'),auth[_0x040a('0x9')](),controller[_0x040a('0x18')]);module[_0x040a('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 427dbc1..dfba753 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 _0xcbca=['sequelize','exports','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbca,0xac));var _0xacbc=function(_0x54a117,_0x240c61){_0x54a117=_0x54a117-0x0;var _0x16fca6=_0xcbca[_0x54a117];return _0x16fca6;};'use strict';var Sequelize=require(_0xacbc('0x0'));module[_0xacbc('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xacbc('0x2')]},'description':{'type':Sequelize[_0xacbc('0x2')]},'status':{'type':Sequelize[_0xacbc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x81fb=['BOOLEAN','STRING'];(function(_0x5322eb,_0x38596c){var _0x2dc225=function(_0x5ed302){while(--_0x5ed302){_0x5322eb['push'](_0x5322eb['shift']());}};_0x2dc225(++_0x38596c);}(_0x81fb,0x1d7));var _0xb81f=function(_0x4764da,_0x4c2812){_0x4764da=_0x4764da-0x0;var _0x3f17a6=_0x81fb[_0x4764da];return _0x3f17a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb81f('0x0')]},'channel':{'type':Sequelize[_0xb81f('0x0')]},'description':{'type':Sequelize[_0xb81f('0x0')]},'status':{'type':Sequelize[_0xb81f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index f97e890..779cc7c 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 _0x80ce=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','Trigger','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','order','pick','options','getAnyConditions','addAction','TriggerId','Action','getActions','hasOwnProperty','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x80ce,0xae));var _0xe80c=function(_0x36b7fe,_0x353b66){_0x36b7fe=_0x36b7fe-0x0;var _0x281dd2=_0x80ce[_0x36b7fe];return _0x281dd2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe80c('0x0'));var jsonpatch=require(_0xe80c('0x1'));var rp=require('request-promise');var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe80c('0x5'));var ejs=require(_0xe80c('0x6'));var fs=require('fs');var _=require(_0xe80c('0x7'));var squel=require(_0xe80c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0x9'));var toCsv=require(_0xe80c('0x5'));var querystring=require('querystring');var Papa=require(_0xe80c('0xa'));var Redis=require(_0xe80c('0xb'));var authService=require(_0xe80c('0xc'));var qs=require(_0xe80c('0xd'));var as=require(_0xe80c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe80c('0xf'));var config=require(_0xe80c('0x10'));var licenseUtil=require(_0xe80c('0x11'));var db=require(_0xe80c('0x12'))['db'];function respondWithStatusCode(_0xfc0809,_0x3cd7ba){_0x3cd7ba=_0x3cd7ba||0xcc;return function(_0xefba08){if(_0xefba08){return _0xfc0809[_0xe80c('0x13')](_0x3cd7ba);}return _0xfc0809[_0xe80c('0x14')](_0x3cd7ba)[_0xe80c('0x15')]();};}function respondWithResult(_0x185a51,_0x46f217){_0x46f217=_0x46f217||0xc8;return function(_0x24bbd2){if(_0x24bbd2){return _0x185a51['status'](_0x46f217)[_0xe80c('0x16')](_0x24bbd2);}};}function respondWithFilteredResult(_0x52801b,_0x451535){return function(_0x2a118e){if(_0x2a118e){var _0x100606=_0x2a118e['count'],_0x532e00=_0x451535[_0xe80c('0x17')],_0x6ff463=_0x451535[_0xe80c('0x17')]+_0x451535['limit'],_0x35d108;if(_0x6ff463>=_0x100606){_0x6ff463=_0x100606;_0x35d108=0xc8;}else{_0x35d108=0xce;}_0x52801b[_0xe80c('0x14')](_0x35d108);return _0x52801b[_0xe80c('0x18')]('Content-Range',_0x532e00+'-'+_0x6ff463+'/'+_0x100606)['json'](_0x2a118e);}return null;};}function patchUpdates(_0x1ba731){return function(_0x752469){try{jsonpatch[_0xe80c('0x19')](_0x752469,_0x1ba731,!![]);}catch(_0xdc8b26){return BPromise[_0xe80c('0x1a')](_0xdc8b26);}return _0x752469[_0xe80c('0x1b')]();};}function saveUpdates(_0x534471,_0x5da513){return function(_0x5417c4){if(_0x5417c4){return _0x5417c4['update'](_0x534471)[_0xe80c('0x1c')](function(_0x5078f8){return _0x5078f8;});}return null;};}function removeEntity(_0x39996f,_0x3efad0){return function(_0x3e6058){if(_0x3e6058){return _0x3e6058[_0xe80c('0x1d')]()[_0xe80c('0x1c')](function(){var _0x3fd5ba=_0x3e6058[_0xe80c('0x1e')]({'plain':!![]});var _0x360d8b=_0xe80c('0x1f');return db[_0xe80c('0x20')][_0xe80c('0x1d')]({'where':{'type':_0x360d8b,'resourceId':_0x3fd5ba['id']}})[_0xe80c('0x1c')](function(){return _0x3e6058;});})['then'](function(){_0x39996f[_0xe80c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e778,_0x4ef883){return function(_0x270ded){if(!_0x270ded){_0x31e778['sendStatus'](0x194);}return _0x270ded;};}function handleError(_0x468875,_0x43f290){_0x43f290=_0x43f290||0x1f4;return function(_0x54595d){logger[_0xe80c('0x21')](_0x54595d[_0xe80c('0x22')]);if(_0x54595d[_0xe80c('0x23')]){delete _0x54595d[_0xe80c('0x23')];}_0x468875[_0xe80c('0x14')](_0x43f290)[_0xe80c('0x24')](_0x54595d);};}exports[_0xe80c('0x25')]=function(_0x2936bf,_0x1e1b23){var _0x5bb254={},_0x415690={},_0x460cef={'count':0x0,'rows':[]};var _0x512c94=_[_0xe80c('0x26')](db['Trigger'][_0xe80c('0x27')],function(_0x3be1d2){return{'name':_0x3be1d2[_0xe80c('0x28')],'type':_0x3be1d2[_0xe80c('0x29')][_0xe80c('0x2a')]};});_0x415690[_0xe80c('0x2b')]=_[_0xe80c('0x26')](_0x512c94,_0xe80c('0x23'));_0x415690[_0xe80c('0x2c')]=_['keys'](_0x2936bf['query']);_0x415690['filters']=_[_0xe80c('0x2d')](_0x415690[_0xe80c('0x2b')],_0x415690[_0xe80c('0x2c')]);_0x5bb254[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x415690['model'],qs[_0xe80c('0x2f')](_0x2936bf['query']['fields']));_0x5bb254[_0xe80c('0x2e')]=_0x5bb254[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x5bb254[_0xe80c('0x2e')]:_0x415690[_0xe80c('0x2b')];if(!_0x2936bf[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x5bb254[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x5bb254[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x17')]);}_0x5bb254['order']=qs['sort'](_0x2936bf['query'][_0xe80c('0x33')]);_0x5bb254[_0xe80c('0x34')]=qs[_0xe80c('0x35')](_['pick'](_0x2936bf[_0xe80c('0x2c')],_0x415690[_0xe80c('0x35')]),_0x512c94);if(_0x2936bf[_0xe80c('0x2c')]['filter']){_0x5bb254[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x5bb254[_0xe80c('0x34')],{'$or':_[_0xe80c('0x26')](_0x512c94,function(_0x2e22b0){if(_0x2e22b0[_0xe80c('0x29')]!==_0xe80c('0x37')){var _0xbfeb3d={};_0xbfeb3d[_0x2e22b0['name']]={'$like':'%'+_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0xbfeb3d;}})});}_0x5bb254=_[_0xe80c('0x36')]({},_0x5bb254,_0x2936bf['options']);var _0x5b628e={'where':_0x5bb254[_0xe80c('0x34')]};return db[_0xe80c('0x39')]['count'](_0x5b628e)[_0xe80c('0x1c')](function(_0x1e9dff){_0x460cef[_0xe80c('0x3a')]=_0x1e9dff;if(_0x2936bf['query'][_0xe80c('0x3b')]){_0x5bb254[_0xe80c('0x3c')]=[{'all':!![]}];}return db[_0xe80c('0x39')][_0xe80c('0x3d')](_0x5bb254);})[_0xe80c('0x1c')](function(_0x17d0e6){_0x460cef[_0xe80c('0x3e')]=_0x17d0e6;return _0x460cef;})['then'](respondWithFilteredResult(_0x1e1b23,_0x5bb254))['catch'](handleError(_0x1e1b23,null));};exports[_0xe80c('0x3f')]=function(_0x90219d,_0xef04bf){var _0x1bd916={'raw':![],'where':{'id':_0x90219d[_0xe80c('0x40')]['id']}},_0x41cc60={};_0x41cc60['model']=_[_0xe80c('0x41')](db[_0xe80c('0x39')]['rawAttributes']);_0x41cc60['query']=_[_0xe80c('0x41')](_0x90219d[_0xe80c('0x2c')]);_0x41cc60[_0xe80c('0x35')]=_['intersection'](_0x41cc60['model'],_0x41cc60[_0xe80c('0x2c')]);_0x1bd916[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x41cc60[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x90219d['query']['fields']));_0x1bd916[_0xe80c('0x2e')]=_0x1bd916[_0xe80c('0x2e')]['length']?_0x1bd916['attributes']:_0x41cc60[_0xe80c('0x2b')];if(_0x90219d[_0xe80c('0x2c')][_0xe80c('0x3b')]){_0x1bd916[_0xe80c('0x3c')]=[{'all':!![]}];}_0x1bd916=_[_0xe80c('0x36')]({},_0x1bd916,_0x90219d['options']);return db[_0xe80c('0x39')][_0xe80c('0x42')](_0x1bd916)[_0xe80c('0x1c')](handleEntityNotFound(_0xef04bf,null))[_0xe80c('0x1c')](respondWithResult(_0xef04bf,null))[_0xe80c('0x43')](handleError(_0xef04bf,null));};exports[_0xe80c('0x44')]=function(_0x4ddf5c,_0x28013f){return db[_0xe80c('0x39')][_0xe80c('0x44')](_0x4ddf5c['body'],{})[_0xe80c('0x1c')](function(_0x2dde4d){var _0x4e6d7e=_0x4ddf5c[_0xe80c('0x45')][_0xe80c('0x1e')]({'plain':!![]});if(!_0x4e6d7e)throw new Error(_0xe80c('0x46'));if(_0x4e6d7e[_0xe80c('0x47')]===_0xe80c('0x45')){var _0x3dc0b1=_0x2dde4d[_0xe80c('0x1e')]({'plain':!![]});var _0x50bee9=_0xe80c('0x1f');return db[_0xe80c('0x48')][_0xe80c('0x42')]({'where':{'name':_0x50bee9,'userProfileId':_0x4e6d7e[_0xe80c('0x49')]},'raw':!![]})[_0xe80c('0x1c')](function(_0x5e1b32){if(_0x5e1b32&&_0x5e1b32[_0xe80c('0x4a')]===0x0){return db[_0xe80c('0x20')][_0xe80c('0x44')]({'name':_0x3dc0b1[_0xe80c('0x23')],'resourceId':_0x3dc0b1['id'],'type':_0x5e1b32[_0xe80c('0x23')],'sectionId':_0x5e1b32['id']},{})['then'](function(){return _0x2dde4d;});}else{return _0x2dde4d;}})[_0xe80c('0x43')](function(_0x192b7f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192b7f);throw _0x192b7f;});}return _0x2dde4d;})[_0xe80c('0x1c')](respondWithResult(_0x28013f,0xc9))[_0xe80c('0x43')](handleError(_0x28013f,null));};exports['update']=function(_0x5088ef,_0x376cc4){if(_0x5088ef['body']['id']){delete _0x5088ef[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x5088ef['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x376cc4,null))['then'](saveUpdates(_0x5088ef['body'],null))[_0xe80c('0x1c')](respondWithResult(_0x376cc4,null))[_0xe80c('0x43')](handleError(_0x376cc4,null));};exports[_0xe80c('0x1d')]=function(_0xa54742,_0x3e4ce2){return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0xa54742[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3e4ce2,null))[_0xe80c('0x1c')](removeEntity(_0x3e4ce2,null))[_0xe80c('0x43')](handleError(_0x3e4ce2,null));};exports[_0xe80c('0x4c')]=function(_0x29518a,_0x475e32,_0x12bcf5){if(_0x29518a[_0xe80c('0x4b')]['id']){delete _0x29518a[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x29518a[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x475e32,null))[_0xe80c('0x1c')](function(_0x3be7f1){if(_0x3be7f1){_0x29518a[_0xe80c('0x4b')]['TriggerAllId']=_0x3be7f1['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x29518a[_0xe80c('0x4b')]);}})['then'](respondWithResult(_0x475e32,null))['catch'](handleError(_0x475e32,null));};exports[_0xe80c('0x4e')]=function(_0x4e6c95,_0x303603,_0x3d5e5e){if(_0x4e6c95[_0xe80c('0x4b')]['id']){delete _0x4e6c95[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x4e6c95[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x303603,null))['then'](function(_0x34d843){if(_0x34d843){_0x4e6c95['body']['TriggerAnyId']=_0x34d843['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x4e6c95[_0xe80c('0x4b')]);}})[_0xe80c('0x1c')](respondWithResult(_0x303603,null))[_0xe80c('0x43')](handleError(_0x303603,null));};exports[_0xe80c('0x4f')]=function(_0x13b623,_0x4a920f,_0x515876){var _0x554401={};var _0x5ddab3={};var _0x15c541;var _0x5d46b9;return db[_0xe80c('0x39')][_0xe80c('0x50')]({'where':{'id':_0x13b623[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x4a920f,null))[_0xe80c('0x1c')](function(_0x100418){if(_0x100418){_0x15c541=_0x100418;_0x5ddab3[_0xe80c('0x2b')]=_['keys'](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x5ddab3[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x13b623[_0xe80c('0x2c')]);_0x5ddab3[_0xe80c('0x35')]=_['intersection'](_0x5ddab3['model'],_0x5ddab3['query']);_0x554401['attributes']=_[_0xe80c('0x2d')](_0x5ddab3[_0xe80c('0x2b')],qs['fields'](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x2f')]));_0x554401['attributes']=_0x554401['attributes'][_0xe80c('0x30')]?_0x554401['attributes']:_0x5ddab3[_0xe80c('0x2b')];_0x554401[_0xe80c('0x51')]=qs['sort'](_0x13b623['query']['sort']);_0x554401['where']=qs[_0xe80c('0x35')](_[_0xe80c('0x52')](_0x13b623[_0xe80c('0x2c')],_0x5ddab3[_0xe80c('0x35')]));if(_0x13b623[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x554401[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x554401[_0xe80c('0x34')],{'$or':_['map'](_0x554401[_0xe80c('0x2e')],function(_0x183d9f){var _0x3e3e32={};_0x3e3e32[_0x183d9f]={'$like':'%'+_0x13b623[_0xe80c('0x2c')]['filter']+'%'};return _0x3e3e32;})});}_0x554401=_[_0xe80c('0x36')]({},_0x554401,_0x13b623[_0xe80c('0x53')]);return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x584c65){if(_0x584c65){_0x5d46b9=_0x584c65[_0xe80c('0x30')];if(!_0x13b623[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x554401[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x554401[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x31efbc){if(_0x31efbc){return _0x31efbc?{'count':_0x5d46b9,'rows':_0x31efbc}:null;}})['then'](respondWithResult(_0x4a920f,null))[_0xe80c('0x43')](handleError(_0x4a920f,null));};exports[_0xe80c('0x54')]=function(_0x7bd4c4,_0x3bc71b,_0x2ca24e){var _0x550d71={};var _0x26e58c={};var _0x28b5b7;var _0x50ae66;return db[_0xe80c('0x39')]['findOne']({'where':{'id':_0x7bd4c4[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3bc71b,null))[_0xe80c('0x1c')](function(_0x4acb25){if(_0x4acb25){_0x28b5b7=_0x4acb25;_0x26e58c['model']=_[_0xe80c('0x41')](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x26e58c[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x7bd4c4[_0xe80c('0x2c')]);_0x26e58c[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],_0x26e58c[_0xe80c('0x2c')]);_0x550d71[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x7bd4c4['query']['fields']));_0x550d71[_0xe80c('0x2e')]=_0x550d71['attributes'][_0xe80c('0x30')]?_0x550d71[_0xe80c('0x2e')]:_0x26e58c[_0xe80c('0x2b')];_0x550d71[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x7bd4c4[_0xe80c('0x2c')]['sort']);_0x550d71['where']=qs['filters'](_['pick'](_0x7bd4c4[_0xe80c('0x2c')],_0x26e58c[_0xe80c('0x35')]));if(_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x550d71[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x550d71[_0xe80c('0x34')],{'$or':_['map'](_0x550d71[_0xe80c('0x2e')],function(_0xfcd2fc){var _0x3e103a={};_0x3e103a[_0xfcd2fc]={'$like':'%'+_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x3e103a;})});}_0x550d71=_['merge']({},_0x550d71,_0x7bd4c4[_0xe80c('0x53')]);return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0x40d4a8){if(_0x40d4a8){_0x50ae66=_0x40d4a8[_0xe80c('0x30')];if(!_0x7bd4c4[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x550d71[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x7bd4c4[_0xe80c('0x2c')]['limit']);_0x550d71[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x7bd4c4[_0xe80c('0x2c')]['offset']);}return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0xa7f199){if(_0xa7f199){return _0xa7f199?{'count':_0x50ae66,'rows':_0xa7f199}:null;}})['then'](respondWithResult(_0x3bc71b,null))[_0xe80c('0x43')](handleError(_0x3bc71b,null));};exports[_0xe80c('0x55')]=function(_0x419e48,_0x80fe71,_0x1542bc){if(_0x419e48[_0xe80c('0x4b')]['id']){delete _0x419e48[_0xe80c('0x4b')]['id'];}return db['Trigger'][_0xe80c('0x42')]({'where':{'id':_0x419e48[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x80fe71,null))['then'](function(_0x48e26f){if(_0x48e26f){_0x419e48[_0xe80c('0x4b')][_0xe80c('0x56')]=_0x48e26f['id'];return db[_0xe80c('0x57')][_0xe80c('0x44')](_0x419e48['body']);}})[_0xe80c('0x1c')](respondWithResult(_0x80fe71,null))[_0xe80c('0x43')](handleError(_0x80fe71,null));};exports[_0xe80c('0x58')]=function(_0x24b2a9,_0xaf2bca,_0x4a32d7){var _0x3daf19={};var _0x4713ce={};var _0x236bad;var _0x44397b;return db['Trigger'][_0xe80c('0x50')]({'where':{'id':_0x24b2a9['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0xaf2bca,null))[_0xe80c('0x1c')](function(_0x18cdd2){if(_0x18cdd2){_0x236bad=_0x18cdd2;_0x4713ce['model']=_[_0xe80c('0x41')](db[_0xe80c('0x57')]['rawAttributes']);_0x4713ce[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x24b2a9[_0xe80c('0x2c')]);_0x4713ce[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x4713ce[_0xe80c('0x2b')],_0x4713ce[_0xe80c('0x2c')]);_0x3daf19[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x4713ce['model'],qs[_0xe80c('0x2f')](_0x24b2a9['query']['fields']));_0x3daf19['attributes']=_0x3daf19[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x3daf19[_0xe80c('0x2e')]:_0x4713ce[_0xe80c('0x2b')];_0x3daf19[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x33')]);_0x3daf19[_0xe80c('0x34')]=qs['filters'](_[_0xe80c('0x52')](_0x24b2a9[_0xe80c('0x2c')],_0x4713ce[_0xe80c('0x35')]));if(_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x3daf19[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x3daf19['where'],{'$or':_[_0xe80c('0x26')](_0x3daf19['attributes'],function(_0x6e1d81){var _0x347f87={};_0x347f87[_0x6e1d81]={'$like':'%'+_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x347f87;})});}_0x3daf19=_[_0xe80c('0x36')]({},_0x3daf19,_0x24b2a9[_0xe80c('0x53')]);return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x4caa8c){if(_0x4caa8c){_0x44397b=_0x4caa8c[_0xe80c('0x30')];if(!_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x59')](_0xe80c('0x31'))){_0x3daf19['limit']=qs['limit'](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x3daf19['offset']=qs[_0xe80c('0x17')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x329c88){if(_0x329c88){return _0x329c88?{'count':_0x44397b,'rows':_0x329c88}:null;}})[_0xe80c('0x1c')](respondWithResult(_0xaf2bca,null))['catch'](handleError(_0xaf2bca,null));}; \ No newline at end of file +var _0x5e11=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','name','send','index','map','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','Trigger','findAll','rows','show','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','TriggerAnyId','getAllConditions','sort','pick','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x5878ee,_0x406ff5){var _0x2068a0=function(_0x345719){while(--_0x345719){_0x5878ee['push'](_0x5878ee['shift']());}};_0x2068a0(++_0x406ff5);}(_0x5e11,0x1c3));var _0x15e1=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x5e11[_0x251e8c];return _0x1e0c1d;};'use strict';var pdf=require(_0x15e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15e1('0x1'));var zipdir=require(_0x15e1('0x2'));var jsonpatch=require(_0x15e1('0x3'));var rp=require(_0x15e1('0x4'));var moment=require(_0x15e1('0x5'));var BPromise=require(_0x15e1('0x6'));var Mustache=require('mustache');var util=require(_0x15e1('0x7'));var path=require('path');var sox=require(_0x15e1('0x8'));var csv=require(_0x15e1('0x9'));var ejs=require(_0x15e1('0xa'));var fs=require('fs');var _=require(_0x15e1('0xb'));var squel=require(_0x15e1('0xc'));var crypto=require('crypto');var jsforce=require(_0x15e1('0xd'));var deskjs=require(_0x15e1('0xe'));var toCsv=require(_0x15e1('0x9'));var querystring=require(_0x15e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x15e1('0x10'));var authService=require(_0x15e1('0x11'));var qs=require(_0x15e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15e1('0x13'));var logger=require(_0x15e1('0x14'))(_0x15e1('0x15'));var utils=require(_0x15e1('0x16'));var config=require(_0x15e1('0x17'));var licenseUtil=require(_0x15e1('0x18'));var db=require(_0x15e1('0x19'))['db'];function respondWithStatusCode(_0xacda2f,_0x3d423c){_0x3d423c=_0x3d423c||0xcc;return function(_0x11486f){if(_0x11486f){return _0xacda2f[_0x15e1('0x1a')](_0x3d423c);}return _0xacda2f[_0x15e1('0x1b')](_0x3d423c)['end']();};}function respondWithResult(_0x3629ea,_0x158d0f){_0x158d0f=_0x158d0f||0xc8;return function(_0x3db265){if(_0x3db265){return _0x3629ea['status'](_0x158d0f)[_0x15e1('0x1c')](_0x3db265);}};}function respondWithFilteredResult(_0x4647a0,_0x499bd3){return function(_0x381bb4){if(_0x381bb4){var _0xa1ba90=_0x381bb4[_0x15e1('0x1d')],_0x36f758=_0x499bd3[_0x15e1('0x1e')],_0x448d59=_0x499bd3[_0x15e1('0x1e')]+_0x499bd3[_0x15e1('0x1f')],_0x36d214;if(_0x448d59>=_0xa1ba90){_0x448d59=_0xa1ba90;_0x36d214=0xc8;}else{_0x36d214=0xce;}_0x4647a0[_0x15e1('0x1b')](_0x36d214);return _0x4647a0[_0x15e1('0x20')](_0x15e1('0x21'),_0x36f758+'-'+_0x448d59+'/'+_0xa1ba90)[_0x15e1('0x1c')](_0x381bb4);}return null;};}function patchUpdates(_0x38f496){return function(_0x1b3b13){try{jsonpatch[_0x15e1('0x22')](_0x1b3b13,_0x38f496,!![]);}catch(_0x533e00){return BPromise[_0x15e1('0x23')](_0x533e00);}return _0x1b3b13[_0x15e1('0x24')]();};}function saveUpdates(_0x5de6d9,_0x4712fe){return function(_0x3d6c99){if(_0x3d6c99){return _0x3d6c99[_0x15e1('0x25')](_0x5de6d9)[_0x15e1('0x26')](function(_0x57339c){return _0x57339c;});}return null;};}function removeEntity(_0x522dd0,_0x1648f4){return function(_0x160c65){if(_0x160c65){return _0x160c65[_0x15e1('0x27')]()[_0x15e1('0x26')](function(){var _0x2d91ee=_0x160c65[_0x15e1('0x28')]({'plain':!![]});var _0x2e8796='Triggers';return db['UserProfileResource'][_0x15e1('0x27')]({'where':{'type':_0x2e8796,'resourceId':_0x2d91ee['id']}})[_0x15e1('0x26')](function(){return _0x160c65;});})['then'](function(){_0x522dd0['status'](0xcc)[_0x15e1('0x29')]();});}};}function handleEntityNotFound(_0x130ed6,_0x4c3cdb){return function(_0x477ff1){if(!_0x477ff1){_0x130ed6[_0x15e1('0x1a')](0x194);}return _0x477ff1;};}function handleError(_0x21d188,_0x3bcb9f){_0x3bcb9f=_0x3bcb9f||0x1f4;return function(_0x3ecffa){logger['error'](_0x3ecffa['stack']);if(_0x3ecffa['name']){delete _0x3ecffa[_0x15e1('0x2a')];}_0x21d188['status'](_0x3bcb9f)[_0x15e1('0x2b')](_0x3ecffa);};}exports[_0x15e1('0x2c')]=function(_0x201b53,_0x16c14e){var _0x40f5ef={},_0x4e1dcf={},_0x29f2a7={'count':0x0,'rows':[]};var _0x55513b=_[_0x15e1('0x2d')](db['Trigger']['rawAttributes'],function(_0x2bc1e6){return{'name':_0x2bc1e6['fieldName'],'type':_0x2bc1e6['type']['key']};});_0x4e1dcf[_0x15e1('0x2e')]=_[_0x15e1('0x2d')](_0x55513b,'name');_0x4e1dcf[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x201b53['query']);_0x4e1dcf[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x4e1dcf[_0x15e1('0x2e')],_0x4e1dcf[_0x15e1('0x2f')]);_0x40f5ef['attributes']=_[_0x15e1('0x32')](_0x4e1dcf[_0x15e1('0x2e')],qs['fields'](_0x201b53['query'][_0x15e1('0x33')]));_0x40f5ef['attributes']=_0x40f5ef['attributes']['length']?_0x40f5ef[_0x15e1('0x34')]:_0x4e1dcf[_0x15e1('0x2e')];if(!_0x201b53[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0x40f5ef[_0x15e1('0x1f')]=qs[_0x15e1('0x1f')](_0x201b53[_0x15e1('0x2f')][_0x15e1('0x1f')]);_0x40f5ef[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x201b53[_0x15e1('0x2f')]['offset']);}_0x40f5ef['order']=qs['sort'](_0x201b53[_0x15e1('0x2f')]['sort']);_0x40f5ef[_0x15e1('0x37')]=qs['filters'](_['pick'](_0x201b53[_0x15e1('0x2f')],_0x4e1dcf[_0x15e1('0x31')]),_0x55513b);if(_0x201b53[_0x15e1('0x2f')][_0x15e1('0x38')]){_0x40f5ef[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x40f5ef['where'],{'$or':_[_0x15e1('0x2d')](_0x55513b,function(_0x350826){if(_0x350826['type']!=='VIRTUAL'){var _0x554329={};_0x554329[_0x350826[_0x15e1('0x2a')]]={'$like':'%'+_0x201b53[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x554329;}})});}_0x40f5ef=_[_0x15e1('0x39')]({},_0x40f5ef,_0x201b53[_0x15e1('0x3a')]);var _0x23cb2a={'where':_0x40f5ef[_0x15e1('0x37')]};return db['Trigger'][_0x15e1('0x1d')](_0x23cb2a)[_0x15e1('0x26')](function(_0x2c6734){_0x29f2a7['count']=_0x2c6734;if(_0x201b53[_0x15e1('0x2f')][_0x15e1('0x3b')]){_0x40f5ef[_0x15e1('0x3c')]=[{'all':!![]}];}return db[_0x15e1('0x3d')][_0x15e1('0x3e')](_0x40f5ef);})[_0x15e1('0x26')](function(_0x4c0997){_0x29f2a7[_0x15e1('0x3f')]=_0x4c0997;return _0x29f2a7;})['then'](respondWithFilteredResult(_0x16c14e,_0x40f5ef))['catch'](handleError(_0x16c14e,null));};exports[_0x15e1('0x40')]=function(_0x5d782e,_0x27c1a3){var _0x23e343={'raw':![],'where':{'id':_0x5d782e['params']['id']}},_0x1702b8={};_0x1702b8[_0x15e1('0x2e')]=_[_0x15e1('0x30')](db[_0x15e1('0x3d')][_0x15e1('0x41')]);_0x1702b8[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x5d782e[_0x15e1('0x2f')]);_0x1702b8['filters']=_[_0x15e1('0x32')](_0x1702b8[_0x15e1('0x2e')],_0x1702b8['query']);_0x23e343[_0x15e1('0x34')]=_['intersection'](_0x1702b8[_0x15e1('0x2e')],qs[_0x15e1('0x33')](_0x5d782e[_0x15e1('0x2f')]['fields']));_0x23e343[_0x15e1('0x34')]=_0x23e343['attributes'][_0x15e1('0x42')]?_0x23e343[_0x15e1('0x34')]:_0x1702b8[_0x15e1('0x2e')];if(_0x5d782e[_0x15e1('0x2f')]['includeAll']){_0x23e343[_0x15e1('0x3c')]=[{'all':!![]}];}_0x23e343=_[_0x15e1('0x39')]({},_0x23e343,_0x5d782e[_0x15e1('0x3a')]);return db[_0x15e1('0x3d')][_0x15e1('0x43')](_0x23e343)[_0x15e1('0x26')](handleEntityNotFound(_0x27c1a3,null))[_0x15e1('0x26')](respondWithResult(_0x27c1a3,null))[_0x15e1('0x44')](handleError(_0x27c1a3,null));};exports['create']=function(_0x53f9ef,_0x1abac3){return db[_0x15e1('0x3d')][_0x15e1('0x45')](_0x53f9ef[_0x15e1('0x46')],{})[_0x15e1('0x26')](function(_0x189a01){var _0x40a4f2=_0x53f9ef[_0x15e1('0x47')][_0x15e1('0x28')]({'plain':!![]});if(!_0x40a4f2)throw new Error(_0x15e1('0x48'));if(_0x40a4f2[_0x15e1('0x49')]===_0x15e1('0x47')){var _0x31a27e=_0x189a01['get']({'plain':!![]});var _0x42e3b2=_0x15e1('0x4a');return db['UserProfileSection'][_0x15e1('0x43')]({'where':{'name':_0x42e3b2,'userProfileId':_0x40a4f2[_0x15e1('0x4b')]},'raw':!![]})[_0x15e1('0x26')](function(_0x15012e){if(_0x15012e&&_0x15012e['autoAssociation']===0x0){return db[_0x15e1('0x4c')][_0x15e1('0x45')]({'name':_0x31a27e[_0x15e1('0x2a')],'resourceId':_0x31a27e['id'],'type':_0x15012e[_0x15e1('0x2a')],'sectionId':_0x15012e['id']},{})[_0x15e1('0x26')](function(){return _0x189a01;});}else{return _0x189a01;}})['catch'](function(_0x171db0){logger['error'](_0x15e1('0x4d'),_0x171db0);throw _0x171db0;});}return _0x189a01;})[_0x15e1('0x26')](respondWithResult(_0x1abac3,0xc9))[_0x15e1('0x44')](handleError(_0x1abac3,null));};exports[_0x15e1('0x25')]=function(_0x53863b,_0x161112){if(_0x53863b['body']['id']){delete _0x53863b['body']['id'];}return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x53863b[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x161112,null))[_0x15e1('0x26')](saveUpdates(_0x53863b[_0x15e1('0x46')],null))['then'](respondWithResult(_0x161112,null))[_0x15e1('0x44')](handleError(_0x161112,null));};exports[_0x15e1('0x27')]=function(_0x5cbc70,_0x2ff63c){return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x5cbc70[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x2ff63c,null))['then'](removeEntity(_0x2ff63c,null))['catch'](handleError(_0x2ff63c,null));};exports[_0x15e1('0x4f')]=function(_0x355803,_0x2a0981,_0x631c60){if(_0x355803[_0x15e1('0x46')]['id']){delete _0x355803[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x3d')]['find']({'where':{'id':_0x355803[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x2a0981,null))['then'](function(_0x29f209){if(_0x29f209){_0x355803[_0x15e1('0x46')]['TriggerAllId']=_0x29f209['id'];return db[_0x15e1('0x50')][_0x15e1('0x45')](_0x355803[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x2a0981,null))[_0x15e1('0x44')](handleError(_0x2a0981,null));};exports['addAnyCondition']=function(_0x17a0ff,_0x4bb4ee,_0x2fb635){if(_0x17a0ff[_0x15e1('0x46')]['id']){delete _0x17a0ff[_0x15e1('0x46')]['id'];}return db['Trigger'][_0x15e1('0x43')]({'where':{'id':_0x17a0ff[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x4bb4ee,null))[_0x15e1('0x26')](function(_0x31bc5f){if(_0x31bc5f){_0x17a0ff[_0x15e1('0x46')][_0x15e1('0x51')]=_0x31bc5f['id'];return db[_0x15e1('0x50')][_0x15e1('0x45')](_0x17a0ff[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x4bb4ee,null))[_0x15e1('0x44')](handleError(_0x4bb4ee,null));};exports[_0x15e1('0x52')]=function(_0x18b6ec,_0x3a0bbb,_0x5f025f){var _0xffa5d2={};var _0x47a342={};var _0x209354;var _0x20282d;return db[_0x15e1('0x3d')]['findOne']({'where':{'id':_0x18b6ec[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x3a0bbb,null))['then'](function(_0x487293){if(_0x487293){_0x209354=_0x487293;_0x47a342[_0x15e1('0x2e')]=_['keys'](db[_0x15e1('0x50')][_0x15e1('0x41')]);_0x47a342[_0x15e1('0x2f')]=_['keys'](_0x18b6ec['query']);_0x47a342['filters']=_['intersection'](_0x47a342['model'],_0x47a342['query']);_0xffa5d2['attributes']=_[_0x15e1('0x32')](_0x47a342[_0x15e1('0x2e')],qs[_0x15e1('0x33')](_0x18b6ec[_0x15e1('0x2f')]['fields']));_0xffa5d2[_0x15e1('0x34')]=_0xffa5d2[_0x15e1('0x34')][_0x15e1('0x42')]?_0xffa5d2[_0x15e1('0x34')]:_0x47a342[_0x15e1('0x2e')];_0xffa5d2['order']=qs['sort'](_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x53')]);_0xffa5d2['where']=qs[_0x15e1('0x31')](_[_0x15e1('0x54')](_0x18b6ec[_0x15e1('0x2f')],_0x47a342[_0x15e1('0x31')]));if(_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x38')]){_0xffa5d2['where']=_['merge'](_0xffa5d2[_0x15e1('0x37')],{'$or':_[_0x15e1('0x2d')](_0xffa5d2[_0x15e1('0x34')],function(_0x1cad54){var _0x33f500={};_0x33f500[_0x1cad54]={'$like':'%'+_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x33f500;})});}_0xffa5d2=_[_0x15e1('0x39')]({},_0xffa5d2,_0x18b6ec[_0x15e1('0x3a')]);return _0x209354[_0x15e1('0x52')](_0xffa5d2);}})[_0x15e1('0x26')](function(_0x13a4f0){if(_0x13a4f0){_0x20282d=_0x13a4f0[_0x15e1('0x42')];if(!_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0xffa5d2['limit']=qs[_0x15e1('0x1f')](_0x18b6ec['query'][_0x15e1('0x1f')]);_0xffa5d2[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x18b6ec['query']['offset']);}return _0x209354[_0x15e1('0x52')](_0xffa5d2);}})[_0x15e1('0x26')](function(_0x2bfddc){if(_0x2bfddc){return _0x2bfddc?{'count':_0x20282d,'rows':_0x2bfddc}:null;}})[_0x15e1('0x26')](respondWithResult(_0x3a0bbb,null))[_0x15e1('0x44')](handleError(_0x3a0bbb,null));};exports['getAnyConditions']=function(_0x157d01,_0x43c505,_0x62e148){var _0x313e86={};var _0x29c758={};var _0x411e6d;var _0x4551bb;return db[_0x15e1('0x3d')][_0x15e1('0x55')]({'where':{'id':_0x157d01[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x43c505,null))[_0x15e1('0x26')](function(_0x25646a){if(_0x25646a){_0x411e6d=_0x25646a;_0x29c758[_0x15e1('0x2e')]=_[_0x15e1('0x30')](db[_0x15e1('0x50')][_0x15e1('0x41')]);_0x29c758[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x157d01[_0x15e1('0x2f')]);_0x29c758[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x29c758[_0x15e1('0x2e')],_0x29c758[_0x15e1('0x2f')]);_0x313e86[_0x15e1('0x34')]=_[_0x15e1('0x32')](_0x29c758['model'],qs[_0x15e1('0x33')](_0x157d01[_0x15e1('0x2f')]['fields']));_0x313e86['attributes']=_0x313e86['attributes'][_0x15e1('0x42')]?_0x313e86[_0x15e1('0x34')]:_0x29c758[_0x15e1('0x2e')];_0x313e86['order']=qs[_0x15e1('0x53')](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x53')]);_0x313e86[_0x15e1('0x37')]=qs['filters'](_[_0x15e1('0x54')](_0x157d01['query'],_0x29c758[_0x15e1('0x31')]));if(_0x157d01['query']['filter']){_0x313e86[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x313e86[_0x15e1('0x37')],{'$or':_[_0x15e1('0x2d')](_0x313e86['attributes'],function(_0x238b01){var _0x45bbd5={};_0x45bbd5[_0x238b01]={'$like':'%'+_0x157d01['query'][_0x15e1('0x38')]+'%'};return _0x45bbd5;})});}_0x313e86=_['merge']({},_0x313e86,_0x157d01[_0x15e1('0x3a')]);return _0x411e6d[_0x15e1('0x56')](_0x313e86);}})[_0x15e1('0x26')](function(_0x2e9baa){if(_0x2e9baa){_0x4551bb=_0x2e9baa[_0x15e1('0x42')];if(!_0x157d01[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0x313e86[_0x15e1('0x1f')]=qs['limit'](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x1f')]);_0x313e86[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x1e')]);}return _0x411e6d[_0x15e1('0x56')](_0x313e86);}})[_0x15e1('0x26')](function(_0x4099e7){if(_0x4099e7){return _0x4099e7?{'count':_0x4551bb,'rows':_0x4099e7}:null;}})[_0x15e1('0x26')](respondWithResult(_0x43c505,null))[_0x15e1('0x44')](handleError(_0x43c505,null));};exports[_0x15e1('0x57')]=function(_0x52b5a2,_0x2f573b,_0x1404fc){if(_0x52b5a2[_0x15e1('0x46')]['id']){delete _0x52b5a2[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x52b5a2[_0x15e1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f573b,null))[_0x15e1('0x26')](function(_0x36e4cf){if(_0x36e4cf){_0x52b5a2[_0x15e1('0x46')][_0x15e1('0x58')]=_0x36e4cf['id'];return db[_0x15e1('0x59')][_0x15e1('0x45')](_0x52b5a2[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x2f573b,null))[_0x15e1('0x44')](handleError(_0x2f573b,null));};exports[_0x15e1('0x5a')]=function(_0x50d341,_0x1bafb2,_0x46fee4){var _0x391726={};var _0x295a7c={};var _0x1682d4;var _0x8d595a;return db[_0x15e1('0x3d')][_0x15e1('0x55')]({'where':{'id':_0x50d341[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x1bafb2,null))[_0x15e1('0x26')](function(_0x24b653){if(_0x24b653){_0x1682d4=_0x24b653;_0x295a7c['model']=_[_0x15e1('0x30')](db[_0x15e1('0x59')][_0x15e1('0x41')]);_0x295a7c[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x50d341[_0x15e1('0x2f')]);_0x295a7c[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x295a7c[_0x15e1('0x2e')],_0x295a7c['query']);_0x391726[_0x15e1('0x34')]=_[_0x15e1('0x32')](_0x295a7c[_0x15e1('0x2e')],qs['fields'](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x33')]));_0x391726[_0x15e1('0x34')]=_0x391726[_0x15e1('0x34')][_0x15e1('0x42')]?_0x391726['attributes']:_0x295a7c[_0x15e1('0x2e')];_0x391726[_0x15e1('0x5b')]=qs[_0x15e1('0x53')](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x53')]);_0x391726[_0x15e1('0x37')]=qs[_0x15e1('0x31')](_[_0x15e1('0x54')](_0x50d341['query'],_0x295a7c[_0x15e1('0x31')]));if(_0x50d341[_0x15e1('0x2f')][_0x15e1('0x38')]){_0x391726[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x391726['where'],{'$or':_[_0x15e1('0x2d')](_0x391726[_0x15e1('0x34')],function(_0xd0a1e1){var _0x5e55a6={};_0x5e55a6[_0xd0a1e1]={'$like':'%'+_0x50d341[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x5e55a6;})});}_0x391726=_[_0x15e1('0x39')]({},_0x391726,_0x50d341[_0x15e1('0x3a')]);return _0x1682d4['getActions'](_0x391726);}})['then'](function(_0x24aefa){if(_0x24aefa){_0x8d595a=_0x24aefa['length'];if(!_0x50d341[_0x15e1('0x2f')]['hasOwnProperty'](_0x15e1('0x36'))){_0x391726[_0x15e1('0x1f')]=qs[_0x15e1('0x1f')](_0x50d341[_0x15e1('0x2f')]['limit']);_0x391726[_0x15e1('0x1e')]=qs['offset'](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x1e')]);}return _0x1682d4[_0x15e1('0x5a')](_0x391726);}})[_0x15e1('0x26')](function(_0x3d19ef){if(_0x3d19ef){return _0x3d19ef?{'count':_0x8d595a,'rows':_0x3d19ef}:null;}})[_0x15e1('0x26')](respondWithResult(_0x1bafb2,null))[_0x15e1('0x44')](handleError(_0x1bafb2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 649072b..1e35886 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 _0x10fe=['moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger'];(function(_0x7e5e6,_0x3e0055){var _0x1434cb=function(_0x39eacc){while(--_0x39eacc){_0x7e5e6['push'](_0x7e5e6['shift']());}};_0x1434cb(++_0x3e0055);}(_0x10fe,0x159));var _0xe10f=function(_0xbbcd26,_0x17ba2b){_0xbbcd26=_0xbbcd26-0x0;var _0x272bd0=_0x10fe[_0xbbcd26];return _0x272bd0;};'use strict';var _=require(_0xe10f('0x0'));var util=require(_0xe10f('0x1'));var logger=require(_0xe10f('0x2'))('api');var moment=require(_0xe10f('0x3'));var BPromise=require(_0xe10f('0x4'));var rp=require(_0xe10f('0x5'));var fs=require('fs');var path=require(_0xe10f('0x6'));var rimraf=require('rimraf');var config=require(_0xe10f('0x7'));var attributes=require(_0xe10f('0x8'));module[_0xe10f('0x9')]=function(_0x53a3da,_0x1762e4){return _0x53a3da[_0xe10f('0xa')](_0xe10f('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x677b=['moment','request-promise','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','../../config/logger'];(function(_0x31e982,_0x521c6a){var _0x3efb59=function(_0x9a5416){while(--_0x9a5416){_0x31e982['push'](_0x31e982['shift']());}};_0x3efb59(++_0x521c6a);}(_0x677b,0x1d3));var _0xb677=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x677b[_0x587fb5];return _0x551105;};'use strict';var _=require(_0xb677('0x0'));var util=require(_0xb677('0x1'));var logger=require(_0xb677('0x2'))('api');var moment=require(_0xb677('0x3'));var BPromise=require('bluebird');var rp=require(_0xb677('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb677('0x5'));var attributes=require(_0xb677('0x6'));module[_0xb677('0x7')]=function(_0x4679c5,_0x4d251c){return _0x4679c5['define'](_0xb677('0x8'),attributes,{'tableName':_0xb677('0x9'),'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 c34c12c..8a3a9ec 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 _0x1eba=['find','where','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','catch','ShowTrigger'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x1eba[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')]({'raw':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')]['where']||null:null,'attributes':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3['options'][_0xa1eb('0x1a')]||null:null,'limit':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x1b')]||null:null,'include':_0x33c4e3['options']?_0x33c4e3['options'][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x33c4e3['options'][_0xa1eb('0x1c')],function(_0x250728){return{'model':db[_0x250728[_0xa1eb('0x1e')]],'as':_0x250728['as'],'attributes':_0x250728[_0xa1eb('0x1a')],'include':_0x250728[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x250728[_0xa1eb('0x1c')],function(_0x364b1c){return{'model':db[_0x364b1c[_0xa1eb('0x1e')]],'as':_0x364b1c['as'],'attributes':_0x364b1c[_0xa1eb('0x1a')],'include':_0x364b1c[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x364b1c['include'],function(_0x7c617e){return{'model':db[_0x7c617e[_0xa1eb('0x1e')]],'as':_0x7c617e['as'],'attributes':_0x7c617e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x4e2aa7){logger[_0xa1eb('0xd')](_0xa1eb('0x15'),_0x33c4e3);logger['debug'](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4e2aa7));_0x49bfaa(_0x4e2aa7);})[_0xa1eb('0x1f')](function(_0x4f64bb){logger[_0xa1eb('0x11')](_0xa1eb('0x15'),_0x4f64bb['message'],_0x33c4e3);_0x1dd621(_0x1a5d2c[_0xa1eb('0x11')](0x1f4,_0x4f64bb[_0xa1eb('0x13')]));});});};exports[_0xa1eb('0x20')]=function(_0x2e281a){var _0x5a6544=this;return new Promise(function(_0x52f9c7,_0x9d49d8){return db[_0xa1eb('0x16')][_0xa1eb('0x21')]({'raw':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x22')]||null:null,'attributes':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')]['attributes']||null:null,'include':_0x2e281a['options']?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')],function(_0x58d336){return{'model':db[_0x58d336['model']],'as':_0x58d336['as'],'attributes':_0x58d336[_0xa1eb('0x1a')],'include':_0x58d336[_0xa1eb('0x1c')]?_['map'](_0x58d336['include'],function(_0x3761bf){return{'model':db[_0x3761bf['model']],'as':_0x3761bf['as'],'attributes':_0x3761bf[_0xa1eb('0x1a')],'include':_0x3761bf['include']?_[_0xa1eb('0x1d')](_0x3761bf[_0xa1eb('0x1c')],function(_0x229931){return{'model':db[_0x229931['model']],'as':_0x229931['as'],'attributes':_0x229931[_0xa1eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x35ed30){logger['info'](_0xa1eb('0x20'),_0x2e281a);logger[_0xa1eb('0x23')](_0xa1eb('0x20'),_0x2e281a,JSON[_0xa1eb('0x10')](_0x35ed30));_0x52f9c7(_0x35ed30);})[_0xa1eb('0x1f')](function(_0x5912d5){logger[_0xa1eb('0x11')](_0xa1eb('0x20'),_0x5912d5[_0xa1eb('0x13')],_0x2e281a);_0x9d49d8(_0x5a6544[_0xa1eb('0x11')](0x1f4,_0x5912d5[_0xa1eb('0x13')]));});});}; \ No newline at end of file +var _0x3de3=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x20e8e2,_0x56f78a){var _0x50f868=function(_0x24d74e){while(--_0x24d74e){_0x20e8e2['push'](_0x20e8e2['shift']());}};_0x50f868(++_0x56f78a);}(_0x3de3,0x1ce));var _0x33de=function(_0x38aa8d,_0x19e3e0){_0x38aa8d=_0x38aa8d-0x0;var _0x1b1683=_0x3de3[_0x38aa8d];return _0x1b1683;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['Trigger'][_0x33de('0x17')]({'raw':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x1a')]||null:null,'attributes':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')]['attributes']||null:null,'limit':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')]['limit']||null:null,'include':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0['options'][_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x52cfa0['options'][_0x33de('0x1b')],function(_0x5cd77e){return{'model':db[_0x5cd77e[_0x33de('0x1d')]],'as':_0x5cd77e['as'],'attributes':_0x5cd77e['attributes'],'include':_0x5cd77e[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x5cd77e[_0x33de('0x1b')],function(_0x5b79d7){return{'model':db[_0x5b79d7[_0x33de('0x1d')]],'as':_0x5b79d7['as'],'attributes':_0x5b79d7[_0x33de('0x1e')],'include':_0x5b79d7[_0x33de('0x1b')]?_['map'](_0x5b79d7[_0x33de('0x1b')],function(_0x5585a2){return{'model':db[_0x5585a2['model']],'as':_0x5585a2['as'],'attributes':_0x5585a2[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x1a870a){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger[_0x33de('0xe')](_0x33de('0x16'),_0x52cfa0,JSON[_0x33de('0x10')](_0x1a870a));_0x201ff3(_0x1a870a);})['catch'](function(_0x5ae0e8){logger[_0x33de('0x11')](_0x33de('0x16'),_0x5ae0e8[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7[_0x33de('0x11')](0x1f4,_0x5ae0e8[_0x33de('0x13')]));});});};exports[_0x33de('0x1f')]=function(_0x427e82){var _0x4e1898=this;return new Promise(function(_0x282158,_0x1cee91){return db[_0x33de('0x20')][_0x33de('0x21')]({'raw':_0x427e82['options']?_0x427e82[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x427e82['options']?_0x427e82['options']['where']||null:null,'attributes':_0x427e82[_0x33de('0x18')]?_0x427e82[_0x33de('0x18')]['attributes']||null:null,'include':_0x427e82[_0x33de('0x18')]?_0x427e82['options']['include']?_[_0x33de('0x1c')](_0x427e82[_0x33de('0x18')][_0x33de('0x1b')],function(_0x335794){return{'model':db[_0x335794[_0x33de('0x1d')]],'as':_0x335794['as'],'attributes':_0x335794[_0x33de('0x1e')],'include':_0x335794[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x335794['include'],function(_0x26d2a5){return{'model':db[_0x26d2a5['model']],'as':_0x26d2a5['as'],'attributes':_0x26d2a5[_0x33de('0x1e')],'include':_0x26d2a5['include']?_['map'](_0x26d2a5[_0x33de('0x1b')],function(_0x3614e0){return{'model':db[_0x3614e0[_0x33de('0x1d')]],'as':_0x3614e0['as'],'attributes':_0x3614e0[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x173ae6){logger['info'](_0x33de('0x1f'),_0x427e82);logger[_0x33de('0xe')](_0x33de('0x1f'),_0x427e82,JSON[_0x33de('0x10')](_0x173ae6));_0x282158(_0x173ae6);})[_0x33de('0x15')](function(_0x9f5688){logger[_0x33de('0x11')]('ShowTrigger',_0x9f5688[_0x33de('0x13')],_0x427e82);_0x1cee91(_0x4e1898[_0x33de('0x11')](0x1f4,_0x9f5688[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6a4931b..e68c313 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 _0x3e74=['/:id/clone','put','/:id','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post'];(function(_0x39ff0c,_0x2069c7){var _0x5c4ca6=function(_0xa4ffba){while(--_0xa4ffba){_0x39ff0c['push'](_0x39ff0c['shift']());}};_0x5c4ca6(++_0x2069c7);}(_0x3e74,0x175));var _0x43e7=function(_0x3fe085,_0x739bf9){_0x3fe085=_0x3fe085-0x0;var _0x599686=_0x3e74[_0x3fe085];return _0x599686;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')](_0x43e7('0xb'),auth[_0x43e7('0x7')](),controller['clone']);router[_0x43e7('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['delete'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['destroy']);module[_0x43e7('0xf')]=router; \ No newline at end of file +var _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy'];(function(_0x2ade3e,_0x505087){var _0x4d648c=function(_0x3afb53){while(--_0x3afb53){_0x2ade3e['push'](_0x2ade3e['shift']());}};_0x4d648c(++_0x505087);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0xf2ca[_0x15f8ad];return _0xc0238a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id/clone',auth[_0xaf2c('0x9')](),controller['clone']);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['update']);router['delete'](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x11')]);module[_0xaf2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6836c74..4f4d4c2 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 _0x569f=['fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','exports','STRING','ENUM','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','uac','uas'];(function(_0x4a49f2,_0x2be437){var _0x37e097=function(_0x5f2b0d){while(--_0x5f2b0d){_0x4a49f2['push'](_0x4a49f2['shift']());}};_0x37e097(++_0x2be437);}(_0x569f,0x15e));var _0xf569=function(_0x4a6a4c,_0x5149d1){_0x4a6a4c=_0x4a6a4c-0x0;var _0xdb0e5b=_0x569f[_0x4a6a4c];return _0xdb0e5b;};'use strict';var Sequelize=require('sequelize');module[_0xf569('0x0')]={'name':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf569('0x2')]('friend',_0xf569('0x3'),_0xf569('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'defaultValue':_0xf569('0x5')},'callingpres':{'type':Sequelize[_0xf569('0x2')]('ALLOWED_NOT_SCREENED',_0xf569('0x6'),_0xf569('0x7'),_0xf569('0x8'),_0xf569('0x9'),_0xf569('0xa'),_0xf569('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xf569('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf569('0x1')]},'md5secret':{'type':Sequelize[_0xf569('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0xc'),'set':function(_0x192629){this['setDataValue'](_0xf569('0xd'),_0x192629?_0x192629[_0xf569('0xe')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xf569('0xf')]('transport')[_0xf569('0x10')](','):null;},'comment':_0xf569('0x11')},'dtmfmode':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x12'),_0xf569('0x13'),'shortinfo',_0xf569('0x14'),_0xf569('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf569('0x2')]('yes','no',_0xf569('0x16'),_0xf569('0x17'),_0xf569('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x4cdda9){this['setDataValue']('nat',_0x4cdda9?_0x4cdda9[_0xf569('0xe')](','):null);},'get':function(){return this[_0xf569('0xf')]('nat')?this['getDataValue'](_0xf569('0x1a'))['split'](','):null;},'comment':_0xf569('0x1b')},'callgroup':{'type':Sequelize[_0xf569('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf569('0x1')]},'pickupgroup':{'type':Sequelize[_0xf569('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x1c')},'allow':{'type':Sequelize[_0xf569('0x1')],'allowNull':![],'defaultValue':_0xf569('0x1d'),'set':function(_0x510df8){this[_0xf569('0x1e')](_0xf569('0x1f'),_0x510df8?_0x510df8[_0xf569('0xe')](';'):_0xf569('0x1d'));},'get':function(){return this[_0xf569('0xf')](_0xf569('0x1f'))?this[_0xf569('0xf')](_0xf569('0x1f'))[_0xf569('0x10')](';'):null;},'comment':_0xf569('0x20')},'autoframing':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x46b974){this[_0xf569('0x1e')](_0xf569('0x21'),_0x46b974?_0x46b974[_0xf569('0xe')](','):null);},'get':function(){return this[_0xf569('0xf')]('insecure')?this['getDataValue'](_0xf569('0x21'))[_0xf569('0x10')](','):null;},'comment':_0xf569('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf569('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x23'))},'promiscredir':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xf569('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf569('0x19')},'busylevel':{'type':Sequelize[_0xf569('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf569('0x1')]},'videosupport':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf569('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'mailbox':{'type':Sequelize[_0xf569('0x1')]},'session_timers':{'type':Sequelize[_0xf569('0x2')]('accept',_0xf569('0x27'),'originate')},'session_expires':{'type':Sequelize[_0xf569('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf569('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x28'),_0xf569('0x29')),'defaultValue':_0xf569('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xf569('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf569('0x24')](0x5)},'qualify':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no'),'defaultValue':_0xf569('0x19')},'keepalive':{'type':Sequelize[_0xf569('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xf569('0x1')]},'defaultuser':{'type':Sequelize[_0xf569('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf569('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf569('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf569('0x1')]},'callbackextension':{'type':Sequelize[_0xf569('0x1')]},'timert1':{'type':Sequelize[_0xf569('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf569('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf569('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf569('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf569('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf569('0x1')]},'maxforwards':{'type':Sequelize[_0xf569('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'force_avp':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf569('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf569('0x2')]('yes','no',_0xf569('0x2a'),_0xf569('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf569('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf569('0x1')]},'dtlscipher':{'type':Sequelize[_0xf569('0x1')]},'dtlscafile':{'type':Sequelize[_0xf569('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x2c'),_0xf569('0x2d'),_0xf569('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf569('0x1')]},'recordofffeature':{'type':Sequelize[_0xf569('0x1')]},'call_limit':{'type':Sequelize[_0xf569('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf569('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf569('0x1')]},'mohinterpret':{'type':Sequelize[_0xf569('0x1')]},'mohsuggest':{'type':Sequelize[_0xf569('0x1')]},'parkinglot':{'type':Sequelize[_0xf569('0x1')]},'description':{'type':Sequelize[_0xf569('0x1')]},'host':{'type':Sequelize[_0xf569('0x1')],'defaultValue':_0xf569('0x2f')},'canreinvite':{'type':Sequelize[_0xf569('0x2')](_0xf569('0x19'),'no',_0xf569('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf569('0x1')]},'active':{'type':Sequelize[_0xf569('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf569('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x39fd=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm'];(function(_0x80fc01,_0x3f8ecd){var _0x854b02=function(_0x243329){while(--_0x243329){_0x80fc01['push'](_0x80fc01['shift']());}};_0x854b02(++_0x3f8ecd);}(_0x39fd,0x13e));var _0xd39f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39fd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xd39f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd39f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x3'),_0xd39f('0x4'),_0xd39f('0x5')),'allowNull':![],'defaultValue':_0xd39f('0x3')},'context':{'type':Sequelize[_0xd39f('0x6')],'allowNull':![],'defaultValue':_0xd39f('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xd39f('0x8'),_0xd39f('0x9'),'ALLOWED_FAILED_SCREEN',_0xd39f('0xa'),_0xd39f('0xb'),'PROHIB_PASSED_SCREEN',_0xd39f('0xc'),_0xd39f('0xd'))},'deny':{'type':Sequelize[_0xd39f('0x6')]},'permit':{'type':Sequelize[_0xd39f('0x6')]},'secret':{'type':Sequelize[_0xd39f('0x6')]},'md5secret':{'type':Sequelize[_0xd39f('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd39f('0xe'),'set':function(_0x270890){this[_0xd39f('0xf')](_0xd39f('0x10'),_0x270890?_0x270890[_0xd39f('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xd39f('0x10'))?this[_0xd39f('0x12')](_0xd39f('0x10'))[_0xd39f('0x13')](','):null;},'comment':_0xd39f('0x14')},'dtmfmode':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x15'),'info','shortinfo',_0xd39f('0x16'),_0xd39f('0x17')),'defaultValue':_0xd39f('0x15')},'directmedia':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x19'),_0xd39f('0x1a'),_0xd39f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd39f('0x6')]},'directmediadeny':{'type':Sequelize[_0xd39f('0x6')]},'nat':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':_0xd39f('0x1c'),'set':function(_0x16df61){this['setDataValue'](_0xd39f('0x1d'),_0x16df61?_0x16df61[_0xd39f('0x11')](','):null);},'get':function(){return this[_0xd39f('0x12')](_0xd39f('0x1d'))?this[_0xd39f('0x12')](_0xd39f('0x1d'))[_0xd39f('0x13')](','):null;},'comment':_0xd39f('0x1e')},'callgroup':{'type':Sequelize[_0xd39f('0x6')]},'namedcallgroup':{'type':Sequelize[_0xd39f('0x6')]},'pickupgroup':{'type':Sequelize[_0xd39f('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xd39f('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd39f('0x6')],'allowNull':![],'defaultValue':_0xd39f('0x1f'),'set':function(_0x5251e1){this['setDataValue'](_0xd39f('0x20'),_0x5251e1?_0x5251e1[_0xd39f('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xd39f('0x20'))?this[_0xd39f('0x12')](_0xd39f('0x20'))['split'](';'):null;},'comment':_0xd39f('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'insecure':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':_0xd39f('0x22'),'set':function(_0x1f7d7f){this[_0xd39f('0xf')](_0xd39f('0x23'),_0x1f7d7f?_0x1f7d7f[_0xd39f('0x11')](','):null);},'get':function(){return this[_0xd39f('0x12')](_0xd39f('0x23'))?this[_0xd39f('0x12')](_0xd39f('0x23'))[_0xd39f('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xd39f('0x25')](0xb)},'setvar':{'type':Sequelize[_0xd39f('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd39f('0x6')]},'callcounter':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':_0xd39f('0x18')},'busylevel':{'type':Sequelize[_0xd39f('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xd39f('0x6')]},'template':{'type':Sequelize[_0xd39f('0x6')]},'videosupport':{'type':Sequelize[_0xd39f('0x2')]('yes','no',_0xd39f('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd39f('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0xd39f('0x6')]},'session_timers':{'type':Sequelize[_0xd39f('0x2')]('accept',_0xd39f('0x27'),_0xd39f('0x28'))},'session_expires':{'type':Sequelize[_0xd39f('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xd39f('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd39f('0x29'),_0xd39f('0x2a')),'defaultValue':_0xd39f('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xd39f('0x6')]},'regexten':{'type':Sequelize[_0xd39f('0x6')]},'fromdomain':{'type':Sequelize[_0xd39f('0x6')]},'fromuser':{'type':Sequelize[_0xd39f('0x6')]},'port':{'type':Sequelize[_0xd39f('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xd39f('0x6')]},'defaultuser':{'type':Sequelize[_0xd39f('0x6')]},'rtptimeout':{'type':Sequelize[_0xd39f('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xd39f('0x6')]},'timert1':{'type':Sequelize[_0xd39f('0x25')](0xb)},'timerb':{'type':Sequelize[_0xd39f('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd39f('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xd39f('0x6')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xd39f('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xd39f('0x6')]},'use_q850_reason':{'type':Sequelize[_0xd39f('0x6')]},'maxforwards':{'type':Sequelize[_0xd39f('0x25')](0xb)},'encryption':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'icesupport':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xd39f('0x2c'),_0xd39f('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xd39f('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd39f('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xd39f('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xd39f('0x2e'),_0xd39f('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd39f('0x6')]},'recordofffeature':{'type':Sequelize[_0xd39f('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'vmexten':{'type':Sequelize[_0xd39f('0x6')]},'mohinterpret':{'type':Sequelize[_0xd39f('0x6')]},'mohsuggest':{'type':Sequelize[_0xd39f('0x6')]},'parkinglot':{'type':Sequelize[_0xd39f('0x6')]},'description':{'type':Sequelize[_0xd39f('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd39f('0x30')},'canreinvite':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x19'),_0xd39f('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd39f('0x6')]},'otherFields':{'type':Sequelize[_0xd39f('0x6')]},'active':{'type':Sequelize[_0xd39f('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 2839af0..15ed62d 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 _0x53ee=['../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','set','apply','reject','destroy','get','UserProfileResource','name','send','index','map','Trunk','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','clone','find','updatedAt','body','omit','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','/etc/asterisk/sip_xcally_trunks.conf','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','update','readFileSync','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0x53ee,0xbd));var _0xe53e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53ee[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xe53e('0x0'));var emlformat=require(_0xe53e('0x1'));var rimraf=require(_0xe53e('0x2'));var zipdir=require(_0xe53e('0x3'));var jsonpatch=require(_0xe53e('0x4'));var rp=require('request-promise');var moment=require(_0xe53e('0x5'));var BPromise=require(_0xe53e('0x6'));var Mustache=require(_0xe53e('0x7'));var util=require(_0xe53e('0x8'));var path=require(_0xe53e('0x9'));var sox=require(_0xe53e('0xa'));var csv=require(_0xe53e('0xb'));var ejs=require(_0xe53e('0xc'));var fs=require('fs');var _=require(_0xe53e('0xd'));var squel=require(_0xe53e('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe53e('0xf'));var toCsv=require(_0xe53e('0xb'));var querystring=require(_0xe53e('0x10'));var Papa=require(_0xe53e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe53e('0x12'));var as=require(_0xe53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe53e('0x14'));var db=require(_0xe53e('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe53e('0x16')][_0xe53e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x10d519,_0x598f8c,_0x7fe7ae,_0x1601a5){return new BPromise(function(_0x19db7d,_0x403ce6){var _0x4bb631=_0x1601a5||client;return _0x4bb631[_0xe53e('0x18')](_0x10d519,_0x7fe7ae)[_0xe53e('0x19')](function(_0x32b7a7){logger['info'](_0xe53e('0x1a'),_0x598f8c,_0xe53e('0x1b'));logger[_0xe53e('0x1c')](_0xe53e('0x1d'),_0x598f8c,'request\x20sent',JSON[_0xe53e('0x1e')](_0x32b7a7));if(_0x32b7a7['error']){if(_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x20')]===0x1f4){logger['error'](_0xe53e('0x1a'),_0x598f8c,_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x21')]);return _0x403ce6(_0x32b7a7[_0xe53e('0x1f')]['message']);}logger[_0xe53e('0x1f')](_0xe53e('0x1a'),_0x598f8c,_0x32b7a7[_0xe53e('0x1f')]['message']);return _0x19db7d(_0x32b7a7[_0xe53e('0x1f')][_0xe53e('0x21')]);}else{logger['info'](_0xe53e('0x1a'),_0x598f8c,_0xe53e('0x1b'));_0x19db7d(_0x32b7a7['result'][_0xe53e('0x21')]);}})['catch'](function(_0x301094){logger[_0xe53e('0x1f')](_0xe53e('0x1a'),_0x598f8c,_0x301094);_0x403ce6(_0x301094);});});}function respondWithStatusCode(_0x34a2a4,_0x321470){_0x321470=_0x321470||0xcc;return function(_0x1c8de5){if(_0x1c8de5){return _0x34a2a4[_0xe53e('0x22')](_0x321470);}return _0x34a2a4['status'](_0x321470)[_0xe53e('0x23')]();};}function respondWithResult(_0x5d537d,_0x3d5ad3){_0x3d5ad3=_0x3d5ad3||0xc8;return function(_0x5399b2){if(_0x5399b2){return _0x5d537d[_0xe53e('0x24')](_0x3d5ad3)[_0xe53e('0x25')](_0x5399b2);}};}function respondWithFilteredResult(_0x1d7f4e,_0x56d881){return function(_0x417e55){if(_0x417e55){var _0x83da7e=_0x417e55[_0xe53e('0x26')],_0x2bc761=_0x56d881[_0xe53e('0x27')],_0x420b7c=_0x56d881[_0xe53e('0x27')]+_0x56d881[_0xe53e('0x28')],_0x50916e;if(_0x420b7c>=_0x83da7e){_0x420b7c=_0x83da7e;_0x50916e=0xc8;}else{_0x50916e=0xce;}_0x1d7f4e[_0xe53e('0x24')](_0x50916e);return _0x1d7f4e[_0xe53e('0x29')]('Content-Range',_0x2bc761+'-'+_0x420b7c+'/'+_0x83da7e)['json'](_0x417e55);}return null;};}function patchUpdates(_0x3effed){return function(_0x283cfa){try{jsonpatch[_0xe53e('0x2a')](_0x283cfa,_0x3effed,!![]);}catch(_0x3996df){return BPromise[_0xe53e('0x2b')](_0x3996df);}return _0x283cfa['save']();};}function saveUpdates(_0x160d99,_0x5daa29){return function(_0x27e7c4){if(_0x27e7c4){return _0x27e7c4['update'](_0x160d99)[_0xe53e('0x19')](function(_0x376dbe){return _0x376dbe;});}return null;};}function removeEntity(_0x58f4db,_0x597511){return function(_0x25f11b){if(_0x25f11b){return _0x25f11b[_0xe53e('0x2c')]()[_0xe53e('0x19')](function(){var _0x2fcfea=_0x25f11b[_0xe53e('0x2d')]({'plain':!![]});var _0x31abb1='Trunks';return db[_0xe53e('0x2e')][_0xe53e('0x2c')]({'where':{'type':_0x31abb1,'resourceId':_0x2fcfea['id']}})[_0xe53e('0x19')](function(){return _0x25f11b;});})['then'](function(){_0x58f4db[_0xe53e('0x24')](0xcc)[_0xe53e('0x23')]();});}};}function handleEntityNotFound(_0x4ef514,_0xbf28d8){return function(_0x2522ae){if(!_0x2522ae){_0x4ef514[_0xe53e('0x22')](0x194);}return _0x2522ae;};}function handleError(_0x1b5f35,_0x2d4677){_0x2d4677=_0x2d4677||0x1f4;return function(_0x2e9dba){logger['error'](_0x2e9dba['stack']);if(_0x2e9dba[_0xe53e('0x2f')]){delete _0x2e9dba['name'];}_0x1b5f35['status'](_0x2d4677)[_0xe53e('0x30')](_0x2e9dba);};}exports[_0xe53e('0x31')]=function(_0x41cdfe,_0x3bc804){var _0x13a393={},_0x599ac1={},_0x587c15={'count':0x0,'rows':[]};var _0x8adebc=_[_0xe53e('0x32')](db[_0xe53e('0x33')]['rawAttributes'],function(_0x2f6d65){return{'name':_0x2f6d65[_0xe53e('0x34')],'type':_0x2f6d65['type'][_0xe53e('0x35')]};});_0x599ac1[_0xe53e('0x36')]=_[_0xe53e('0x32')](_0x8adebc,_0xe53e('0x2f'));_0x599ac1['query']=_[_0xe53e('0x37')](_0x41cdfe[_0xe53e('0x38')]);_0x599ac1[_0xe53e('0x39')]=_[_0xe53e('0x3a')](_0x599ac1[_0xe53e('0x36')],_0x599ac1['query']);_0x13a393[_0xe53e('0x3b')]=_[_0xe53e('0x3a')](_0x599ac1['model'],qs['fields'](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x13a393[_0xe53e('0x3b')]=_0x13a393[_0xe53e('0x3b')][_0xe53e('0x3d')]?_0x13a393[_0xe53e('0x3b')]:_0x599ac1[_0xe53e('0x36')];if(!_0x41cdfe[_0xe53e('0x38')]['hasOwnProperty']('nolimit')){_0x13a393[_0xe53e('0x28')]=qs[_0xe53e('0x28')](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x28')]);_0x13a393[_0xe53e('0x27')]=qs['offset'](_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x27')]);}_0x13a393[_0xe53e('0x3e')]=qs[_0xe53e('0x3f')](_0x41cdfe['query']['sort']);_0x13a393[_0xe53e('0x40')]=qs[_0xe53e('0x39')](_['pick'](_0x41cdfe[_0xe53e('0x38')],_0x599ac1[_0xe53e('0x39')]),_0x8adebc);if(_0x41cdfe[_0xe53e('0x38')]['filter']){_0x13a393[_0xe53e('0x40')]=_['merge'](_0x13a393['where'],{'$or':_['map'](_0x8adebc,function(_0x500aa6){if(_0x500aa6[_0xe53e('0x41')]!==_0xe53e('0x42')){var _0xc7ce79={};_0xc7ce79[_0x500aa6[_0xe53e('0x2f')]]={'$like':'%'+_0x41cdfe[_0xe53e('0x38')]['filter']+'%'};return _0xc7ce79;}})});}_0x13a393=_['merge']({},_0x13a393,_0x41cdfe[_0xe53e('0x43')]);var _0x1104dc={'where':_0x13a393[_0xe53e('0x40')]};return db[_0xe53e('0x33')][_0xe53e('0x26')](_0x1104dc)[_0xe53e('0x19')](function(_0x4753bd){_0x587c15[_0xe53e('0x26')]=_0x4753bd;if(_0x41cdfe[_0xe53e('0x38')][_0xe53e('0x44')]){_0x13a393[_0xe53e('0x45')]=[{'all':!![]}];}return db['Trunk'][_0xe53e('0x46')](_0x13a393);})[_0xe53e('0x19')](function(_0x30e0ca){_0x587c15[_0xe53e('0x47')]=_0x30e0ca;return _0x587c15;})[_0xe53e('0x19')](respondWithFilteredResult(_0x3bc804,_0x13a393))[_0xe53e('0x48')](handleError(_0x3bc804,null));};exports[_0xe53e('0x49')]=function(_0x3abfe9,_0x4cd20c){var _0x10a298={'raw':![],'where':{'id':_0x3abfe9[_0xe53e('0x4a')]['id']}},_0x528d74={};_0x528d74['model']=_[_0xe53e('0x37')](db[_0xe53e('0x33')][_0xe53e('0x4b')]);_0x528d74[_0xe53e('0x38')]=_[_0xe53e('0x37')](_0x3abfe9[_0xe53e('0x38')]);_0x528d74[_0xe53e('0x39')]=_[_0xe53e('0x3a')](_0x528d74['model'],_0x528d74[_0xe53e('0x38')]);_0x10a298['attributes']=_['intersection'](_0x528d74[_0xe53e('0x36')],qs['fields'](_0x3abfe9[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x10a298[_0xe53e('0x3b')]=_0x10a298['attributes']['length']?_0x10a298[_0xe53e('0x3b')]:_0x528d74[_0xe53e('0x36')];if(_0x3abfe9[_0xe53e('0x38')][_0xe53e('0x44')]){_0x10a298[_0xe53e('0x45')]=[{'all':!![]}];}_0x10a298=_[_0xe53e('0x4c')]({},_0x10a298,_0x3abfe9[_0xe53e('0x43')]);return db['Trunk']['find'](_0x10a298)['then'](handleEntityNotFound(_0x4cd20c,null))[_0xe53e('0x19')](respondWithResult(_0x4cd20c,null))[_0xe53e('0x48')](handleError(_0x4cd20c,null));};exports[_0xe53e('0x4d')]=function(_0x19fbd5,_0x3aeade){var _0x4bc991={'where':{'id':_0x19fbd5[_0xe53e('0x4a')]['id']}},_0x43e1fd={};_0x43e1fd[_0xe53e('0x36')]=_[_0xe53e('0x37')](db[_0xe53e('0x33')][_0xe53e('0x4b')]);_0x4bc991[_0xe53e('0x3b')]=_[_0xe53e('0x3a')](_0x43e1fd[_0xe53e('0x36')],qs[_0xe53e('0x3c')](_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x3c')]));_0x4bc991['attributes']=_0x4bc991['attributes'][_0xe53e('0x3d')]?_0x4bc991[_0xe53e('0x3b')]:_0x43e1fd['model'];if(_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x44')]){_0x4bc991[_0xe53e('0x45')]=[{'all':!![]}];}_0x4bc991=_[_0xe53e('0x4c')]({},_0x4bc991,_0x19fbd5['options']);return db[_0xe53e('0x33')][_0xe53e('0x4e')](_0x4bc991)[_0xe53e('0x19')](handleEntityNotFound(_0x3aeade,null))[_0xe53e('0x19')](function(_0x242946){if(_0x242946){var _0x33750d=_0x242946[_0xe53e('0x2d')]({'plain':!![]});_0x33750d=qs['omit'](_0x33750d,['id','createdAt',_0xe53e('0x4f')]);_0x19fbd5[_0xe53e('0x50')]=_[_0xe53e('0x51')](_0x19fbd5[_0xe53e('0x50')],['id',_0xe53e('0x52'),_0xe53e('0x4f')]);return db[_0xe53e('0x33')][_0xe53e('0x53')](_[_0xe53e('0x4c')](_0x33750d,_0x19fbd5[_0xe53e('0x50')]),{'include':_0x19fbd5[_0xe53e('0x38')][_0xe53e('0x44')]?[{'all':!![]}]:undefined})[_0xe53e('0x19')](function(_0x85acf4){var _0x2a14ee=_0x19fbd5[_0xe53e('0x54')][_0xe53e('0x2d')]({'plain':!![]});if(!_0x2a14ee)throw new Error(_0xe53e('0x55'));if(_0x2a14ee[_0xe53e('0x56')]===_0xe53e('0x54')){var _0x1438e5=_0x85acf4[_0xe53e('0x2d')]({'plain':!![]});var _0x2f95eb=_0xe53e('0x57');return db[_0xe53e('0x58')]['find']({'where':{'name':_0x2f95eb,'userProfileId':_0x2a14ee[_0xe53e('0x59')]},'raw':!![]})[_0xe53e('0x19')](function(_0x1c6dcc){if(_0x1c6dcc&&_0x1c6dcc['autoAssociation']===0x0){return db[_0xe53e('0x2e')]['create']({'name':_0x1438e5[_0xe53e('0x2f')],'resourceId':_0x1438e5['id'],'type':_0x1c6dcc[_0xe53e('0x2f')],'sectionId':_0x1c6dcc['id']},{})[_0xe53e('0x19')](function(){return _0x85acf4;});}else{return _0x85acf4;}})[_0xe53e('0x48')](function(_0x14fc30){logger['error'](_0xe53e('0x5a'),_0x14fc30);throw _0x14fc30;});}return _0x85acf4;});}})[_0xe53e('0x19')](respondWithResult(_0x3aeade,0xc9))[_0xe53e('0x48')](handleError(_0x3aeade,null));};exports[_0xe53e('0x53')]=function(_0x2e092e,_0x7c2d31,_0x4c2d27){var _0x29dc8e;return db[_0xe53e('0x33')][_0xe53e('0x53')](_0x2e092e[_0xe53e('0x50')],{'raw':!![]})[_0xe53e('0x19')](function(_0x2c5986){_0x29dc8e=_0x2c5986;return db['Trunk'][_0xe53e('0x46')]({'raw':!![]});})[_0xe53e('0x19')](function(_0x1237a6){var _0x93aa23=fs['readFileSync'](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x47e416=fs['readFileSync'](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),_0xe53e('0x5f'));var _0x2ec384=ejs['render'](_0x93aa23,{'trunks':_0x1237a6||[]});fs['writeFileSync'](_0xe53e('0x60'),_0x2ec384);if(_0x29dc8e['registry']){var _0xf1575b=ejs[_0xe53e('0x61')](_0x47e416,{'trunks':_0x1237a6||[]});fs[_0xe53e('0x62')](_0xe53e('0x63'),_0xf1575b);}})[_0xe53e('0x19')](function(){return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x53'),{'module':'chan_sip.so'});})[_0xe53e('0x19')](function(){var _0x3a53e5=_0x2e092e['user'][_0xe53e('0x2d')]({'plain':!![]});if(!_0x3a53e5)throw new Error(_0xe53e('0x55'));if(_0x3a53e5[_0xe53e('0x56')]===_0xe53e('0x54')){var _0x3b7b36=_0x29dc8e[_0xe53e('0x2d')]({'plain':!![]});return db[_0xe53e('0x58')][_0xe53e('0x4e')]({'where':{'name':_0xe53e('0x57'),'userProfileId':_0x3a53e5[_0xe53e('0x59')]},'raw':!![]})[_0xe53e('0x19')](function(_0x39e644){if(_0x39e644&&_0x39e644['autoAssociation']===0x0){return db[_0xe53e('0x2e')][_0xe53e('0x53')]({'name':_0x3b7b36[_0xe53e('0x2f')],'resourceId':_0x3b7b36['id'],'type':_0x39e644[_0xe53e('0x2f')],'sectionId':_0x39e644['id']},{})[_0xe53e('0x19')](function(){return _0x29dc8e;});}else{return _0x29dc8e;}})[_0xe53e('0x48')](function(_0x33a5d3){logger[_0xe53e('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33a5d3);throw _0x33a5d3;});}return _0x29dc8e;})[_0xe53e('0x19')](respondWithResult(_0x7c2d31,0xc9))[_0xe53e('0x48')](handleError(_0x7c2d31,null));};exports[_0xe53e('0x65')]=function(_0x57b79d,_0x42ea84,_0xe443a4){var _0x10a4b6;return db[_0xe53e('0x33')][_0xe53e('0x4e')]({'where':{'id':_0x57b79d['params']['id']}})['then'](handleEntityNotFound(_0x42ea84,null))[_0xe53e('0x19')](saveUpdates(_0x57b79d[_0xe53e('0x50')],null))[_0xe53e('0x19')](function(_0x4e28ca){if(_0x4e28ca){_0x10a4b6=_0x4e28ca;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x18fb62){if(_0x18fb62){var _0x29ab4c=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x561a3a=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),_0xe53e('0x5f'));var _0x139f6b=ejs[_0xe53e('0x61')](_0x29ab4c,{'trunks':_0x18fb62||[]});fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x139f6b);var _0x4380cc=ejs['render'](_0x561a3a,{'trunks':_0x18fb62||[]});fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x4380cc);return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x65'),{'module':_0xe53e('0x67')});}return null;})['then'](function(_0x4dbb01){if(_0x4dbb01){return _0x10a4b6;}})[_0xe53e('0x19')](respondWithResult(_0x42ea84,null))['catch'](handleError(_0x42ea84,null));};exports[_0xe53e('0x2c')]=function(_0x2682ee,_0x5ed464,_0x3adf90){var _0x433c7e;return db[_0xe53e('0x33')]['find']({'where':{'id':_0x2682ee[_0xe53e('0x4a')]['id']}})[_0xe53e('0x19')](handleEntityNotFound(_0x5ed464,null))[_0xe53e('0x19')](removeEntity(_0x5ed464,null))[_0xe53e('0x19')](function(){return db[_0xe53e('0x33')][_0xe53e('0x46')]({'raw':!![]});})[_0xe53e('0x19')](function(_0x32655c){var _0x2ee85e=fs[_0xe53e('0x66')](path['join'](config[_0xe53e('0x5c')],_0xe53e('0x5d')),'utf8');var _0x5925e0=fs[_0xe53e('0x66')](path[_0xe53e('0x5b')](config[_0xe53e('0x5c')],_0xe53e('0x5e')),'utf8');var _0x36bcf8=ejs[_0xe53e('0x61')](_0x2ee85e,{'trunks':_0x32655c});var _0x6ebb44=ejs[_0xe53e('0x61')](_0x5925e0,{'trunks':_0x32655c});fs['writeFileSync'](_0xe53e('0x60'),_0x36bcf8);fs[_0xe53e('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x6ebb44);return respondWithRpcPromise(_0xe53e('0x64'),_0xe53e('0x2c'),{'module':'chan_sip.so'});})[_0xe53e('0x48')](handleError(_0x5ed464,null));}; \ No newline at end of file +var _0x32b3=['../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','Trunks','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Trunk','findAll','rows','show','params','keys','length','includeAll','include','find','clone','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x439bf5,_0x4aa8bf){var _0x452d97=function(_0x5152ad){while(--_0x5152ad){_0x439bf5['push'](_0x439bf5['shift']());}};_0x452d97(++_0x4aa8bf);}(_0x32b3,0x138));var _0x332b=function(_0x3e72da,_0x7909e3){_0x3e72da=_0x3e72da-0x0;var _0x20a27d=_0x32b3[_0x3e72da];return _0x20a27d;};'use strict';var pdf=require(_0x332b('0x0'));var emlformat=require(_0x332b('0x1'));var rimraf=require(_0x332b('0x2'));var zipdir=require(_0x332b('0x3'));var jsonpatch=require(_0x332b('0x4'));var rp=require(_0x332b('0x5'));var moment=require(_0x332b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x332b('0x7'));var path=require(_0x332b('0x8'));var sox=require(_0x332b('0x9'));var csv=require(_0x332b('0xa'));var ejs=require(_0x332b('0xb'));var fs=require('fs');var _=require(_0x332b('0xc'));var squel=require(_0x332b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x332b('0xe'));var toCsv=require(_0x332b('0xa'));var querystring=require('querystring');var Papa=require(_0x332b('0xf'));var Redis=require(_0x332b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x332b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x332b('0x12'));var logger=require(_0x332b('0x13'))(_0x332b('0x14'));var utils=require(_0x332b('0x15'));var config=require(_0x332b('0x16'));var licenseUtil=require(_0x332b('0x17'));var db=require(_0x332b('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x332b('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8ccb5,_0x25b066,_0x31a750,_0x1c08eb){return new BPromise(function(_0x448da4,_0x311920){var _0x5b91e9=_0x1c08eb||client;return _0x5b91e9[_0x332b('0x1a')](_0xe8ccb5,_0x31a750)[_0x332b('0x1b')](function(_0x558201){logger[_0x332b('0x1c')](_0x332b('0x1d'),_0x25b066,_0x332b('0x1e'));logger[_0x332b('0x1f')](_0x332b('0x20'),_0x25b066,_0x332b('0x1e'),JSON[_0x332b('0x21')](_0x558201));if(_0x558201[_0x332b('0x22')]){if(_0x558201[_0x332b('0x22')][_0x332b('0x23')]===0x1f4){logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x558201['error'][_0x332b('0x24')]);return _0x311920(_0x558201[_0x332b('0x22')]['message']);}logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x558201[_0x332b('0x22')]['message']);return _0x448da4(_0x558201[_0x332b('0x22')][_0x332b('0x24')]);}else{logger['info'](_0x332b('0x1d'),_0x25b066,_0x332b('0x1e'));_0x448da4(_0x558201['result'][_0x332b('0x24')]);}})[_0x332b('0x25')](function(_0x5162e9){logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x5162e9);_0x311920(_0x5162e9);});});}function respondWithStatusCode(_0x408265,_0x3cd9b8){_0x3cd9b8=_0x3cd9b8||0xcc;return function(_0x6fa5b6){if(_0x6fa5b6){return _0x408265[_0x332b('0x26')](_0x3cd9b8);}return _0x408265[_0x332b('0x27')](_0x3cd9b8)[_0x332b('0x28')]();};}function respondWithResult(_0x36aaa4,_0x4838df){_0x4838df=_0x4838df||0xc8;return function(_0x1ae297){if(_0x1ae297){return _0x36aaa4[_0x332b('0x27')](_0x4838df)[_0x332b('0x29')](_0x1ae297);}};}function respondWithFilteredResult(_0x157aa7,_0x56595c){return function(_0xe8f848){if(_0xe8f848){var _0x557573=_0xe8f848[_0x332b('0x2a')],_0x2dc433=_0x56595c[_0x332b('0x2b')],_0x29d679=_0x56595c[_0x332b('0x2b')]+_0x56595c[_0x332b('0x2c')],_0x37a5d8;if(_0x29d679>=_0x557573){_0x29d679=_0x557573;_0x37a5d8=0xc8;}else{_0x37a5d8=0xce;}_0x157aa7['status'](_0x37a5d8);return _0x157aa7[_0x332b('0x2d')](_0x332b('0x2e'),_0x2dc433+'-'+_0x29d679+'/'+_0x557573)[_0x332b('0x29')](_0xe8f848);}return null;};}function patchUpdates(_0x49c4f3){return function(_0x28b7b5){try{jsonpatch[_0x332b('0x2f')](_0x28b7b5,_0x49c4f3,!![]);}catch(_0x1d02c2){return BPromise['reject'](_0x1d02c2);}return _0x28b7b5['save']();};}function saveUpdates(_0x4a691a,_0x5c6311){return function(_0x5b1b03){if(_0x5b1b03){return _0x5b1b03[_0x332b('0x30')](_0x4a691a)[_0x332b('0x1b')](function(_0x1c44b8){return _0x1c44b8;});}return null;};}function removeEntity(_0x375274,_0x425ffb){return function(_0x1f87df){if(_0x1f87df){return _0x1f87df[_0x332b('0x31')]()[_0x332b('0x1b')](function(){var _0x2b13cb=_0x1f87df['get']({'plain':!![]});var _0x322638=_0x332b('0x32');return db[_0x332b('0x33')][_0x332b('0x31')]({'where':{'type':_0x322638,'resourceId':_0x2b13cb['id']}})['then'](function(){return _0x1f87df;});})[_0x332b('0x1b')](function(){_0x375274[_0x332b('0x27')](0xcc)[_0x332b('0x28')]();});}};}function handleEntityNotFound(_0x544500,_0x462b2f){return function(_0x472394){if(!_0x472394){_0x544500[_0x332b('0x26')](0x194);}return _0x472394;};}function handleError(_0x315142,_0x2b0bb2){_0x2b0bb2=_0x2b0bb2||0x1f4;return function(_0x40195c){logger[_0x332b('0x22')](_0x40195c['stack']);if(_0x40195c[_0x332b('0x34')]){delete _0x40195c[_0x332b('0x34')];}_0x315142[_0x332b('0x27')](_0x2b0bb2)[_0x332b('0x35')](_0x40195c);};}exports['index']=function(_0x4786d5,_0x262ebf){var _0x583143={},_0x2a6c94={},_0x3514ee={'count':0x0,'rows':[]};var _0x2a1a83=_[_0x332b('0x36')](db['Trunk'][_0x332b('0x37')],function(_0x1ccb43){return{'name':_0x1ccb43[_0x332b('0x38')],'type':_0x1ccb43[_0x332b('0x39')][_0x332b('0x3a')]};});_0x2a6c94[_0x332b('0x3b')]=_[_0x332b('0x36')](_0x2a1a83,_0x332b('0x34'));_0x2a6c94[_0x332b('0x3c')]=_['keys'](_0x4786d5[_0x332b('0x3c')]);_0x2a6c94[_0x332b('0x3d')]=_[_0x332b('0x3e')](_0x2a6c94['model'],_0x2a6c94[_0x332b('0x3c')]);_0x583143[_0x332b('0x3f')]=_['intersection'](_0x2a6c94['model'],qs[_0x332b('0x40')](_0x4786d5[_0x332b('0x3c')][_0x332b('0x40')]));_0x583143[_0x332b('0x3f')]=_0x583143[_0x332b('0x3f')]['length']?_0x583143[_0x332b('0x3f')]:_0x2a6c94[_0x332b('0x3b')];if(!_0x4786d5[_0x332b('0x3c')][_0x332b('0x41')](_0x332b('0x42'))){_0x583143[_0x332b('0x2c')]=qs[_0x332b('0x2c')](_0x4786d5[_0x332b('0x3c')]['limit']);_0x583143[_0x332b('0x2b')]=qs['offset'](_0x4786d5[_0x332b('0x3c')][_0x332b('0x2b')]);}_0x583143[_0x332b('0x43')]=qs[_0x332b('0x44')](_0x4786d5['query']['sort']);_0x583143[_0x332b('0x45')]=qs[_0x332b('0x3d')](_[_0x332b('0x46')](_0x4786d5[_0x332b('0x3c')],_0x2a6c94[_0x332b('0x3d')]),_0x2a1a83);if(_0x4786d5['query'][_0x332b('0x47')]){_0x583143[_0x332b('0x45')]=_['merge'](_0x583143[_0x332b('0x45')],{'$or':_[_0x332b('0x36')](_0x2a1a83,function(_0x312a1e){if(_0x312a1e[_0x332b('0x39')]!==_0x332b('0x48')){var _0x12285d={};_0x12285d[_0x312a1e[_0x332b('0x34')]]={'$like':'%'+_0x4786d5[_0x332b('0x3c')][_0x332b('0x47')]+'%'};return _0x12285d;}})});}_0x583143=_[_0x332b('0x49')]({},_0x583143,_0x4786d5[_0x332b('0x4a')]);var _0x10a8a7={'where':_0x583143['where']};return db['Trunk'][_0x332b('0x2a')](_0x10a8a7)[_0x332b('0x1b')](function(_0x57c980){_0x3514ee[_0x332b('0x2a')]=_0x57c980;if(_0x4786d5[_0x332b('0x3c')]['includeAll']){_0x583143['include']=[{'all':!![]}];}return db[_0x332b('0x4b')][_0x332b('0x4c')](_0x583143);})[_0x332b('0x1b')](function(_0x21328a){_0x3514ee[_0x332b('0x4d')]=_0x21328a;return _0x3514ee;})['then'](respondWithFilteredResult(_0x262ebf,_0x583143))[_0x332b('0x25')](handleError(_0x262ebf,null));};exports[_0x332b('0x4e')]=function(_0x4cb0bc,_0x168828){var _0x398f59={'raw':![],'where':{'id':_0x4cb0bc[_0x332b('0x4f')]['id']}},_0x3ca711={};_0x3ca711[_0x332b('0x3b')]=_[_0x332b('0x50')](db[_0x332b('0x4b')][_0x332b('0x37')]);_0x3ca711[_0x332b('0x3c')]=_['keys'](_0x4cb0bc[_0x332b('0x3c')]);_0x3ca711[_0x332b('0x3d')]=_[_0x332b('0x3e')](_0x3ca711['model'],_0x3ca711[_0x332b('0x3c')]);_0x398f59[_0x332b('0x3f')]=_['intersection'](_0x3ca711['model'],qs[_0x332b('0x40')](_0x4cb0bc['query'][_0x332b('0x40')]));_0x398f59[_0x332b('0x3f')]=_0x398f59[_0x332b('0x3f')][_0x332b('0x51')]?_0x398f59[_0x332b('0x3f')]:_0x3ca711[_0x332b('0x3b')];if(_0x4cb0bc[_0x332b('0x3c')][_0x332b('0x52')]){_0x398f59[_0x332b('0x53')]=[{'all':!![]}];}_0x398f59=_['merge']({},_0x398f59,_0x4cb0bc[_0x332b('0x4a')]);return db[_0x332b('0x4b')][_0x332b('0x54')](_0x398f59)['then'](handleEntityNotFound(_0x168828,null))[_0x332b('0x1b')](respondWithResult(_0x168828,null))[_0x332b('0x25')](handleError(_0x168828,null));};exports[_0x332b('0x55')]=function(_0x9e861e,_0xb77e6d){var _0x31d5a2={'where':{'id':_0x9e861e[_0x332b('0x4f')]['id']}},_0x2a8770={};_0x2a8770['model']=_['keys'](db[_0x332b('0x4b')][_0x332b('0x37')]);_0x31d5a2[_0x332b('0x3f')]=_[_0x332b('0x3e')](_0x2a8770[_0x332b('0x3b')],qs[_0x332b('0x40')](_0x9e861e[_0x332b('0x3c')]['fields']));_0x31d5a2[_0x332b('0x3f')]=_0x31d5a2[_0x332b('0x3f')]['length']?_0x31d5a2['attributes']:_0x2a8770[_0x332b('0x3b')];if(_0x9e861e[_0x332b('0x3c')]['includeAll']){_0x31d5a2[_0x332b('0x53')]=[{'all':!![]}];}_0x31d5a2=_['merge']({},_0x31d5a2,_0x9e861e[_0x332b('0x4a')]);return db[_0x332b('0x4b')][_0x332b('0x54')](_0x31d5a2)['then'](handleEntityNotFound(_0xb77e6d,null))['then'](function(_0x525844){if(_0x525844){var _0x201719=_0x525844[_0x332b('0x56')]({'plain':!![]});_0x201719=qs[_0x332b('0x57')](_0x201719,['id',_0x332b('0x58'),_0x332b('0x59')]);_0x9e861e[_0x332b('0x5a')]=_['omit'](_0x9e861e[_0x332b('0x5a')],['id','createdAt',_0x332b('0x59')]);return db[_0x332b('0x4b')][_0x332b('0x5b')](_['merge'](_0x201719,_0x9e861e[_0x332b('0x5a')]),{'include':_0x9e861e['query'][_0x332b('0x52')]?[{'all':!![]}]:undefined})[_0x332b('0x1b')](function(_0x45b3df){var _0x5a7908=_0x9e861e['user'][_0x332b('0x56')]({'plain':!![]});if(!_0x5a7908)throw new Error(_0x332b('0x5c'));if(_0x5a7908[_0x332b('0x5d')]===_0x332b('0x5e')){var _0x19898a=_0x45b3df[_0x332b('0x56')]({'plain':!![]});var _0x18e297=_0x332b('0x32');return db[_0x332b('0x5f')]['find']({'where':{'name':_0x18e297,'userProfileId':_0x5a7908[_0x332b('0x60')]},'raw':!![]})[_0x332b('0x1b')](function(_0x3893fb){if(_0x3893fb&&_0x3893fb[_0x332b('0x61')]===0x0){return db[_0x332b('0x33')][_0x332b('0x5b')]({'name':_0x19898a['name'],'resourceId':_0x19898a['id'],'type':_0x3893fb[_0x332b('0x34')],'sectionId':_0x3893fb['id']},{})[_0x332b('0x1b')](function(){return _0x45b3df;});}else{return _0x45b3df;}})[_0x332b('0x25')](function(_0x374fec){logger[_0x332b('0x22')](_0x332b('0x62'),_0x374fec);throw _0x374fec;});}return _0x45b3df;});}})[_0x332b('0x1b')](respondWithResult(_0xb77e6d,0xc9))[_0x332b('0x25')](handleError(_0xb77e6d,null));};exports[_0x332b('0x5b')]=function(_0x7fc30d,_0x182349,_0x36fc08){var _0x120e3a;return db[_0x332b('0x4b')][_0x332b('0x5b')](_0x7fc30d[_0x332b('0x5a')],{'raw':!![]})[_0x332b('0x1b')](function(_0x554a86){_0x120e3a=_0x554a86;return db[_0x332b('0x4b')][_0x332b('0x4c')]({'raw':!![]});})[_0x332b('0x1b')](function(_0x8788b2){var _0xbc6253=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),'utf8');var _0x303ebf=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0x5212c1=ejs['render'](_0xbc6253,{'trunks':_0x8788b2||[]});fs[_0x332b('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5212c1);if(_0x120e3a[_0x332b('0x6a')]){var _0x376941=ejs[_0x332b('0x6b')](_0x303ebf,{'trunks':_0x8788b2||[]});fs[_0x332b('0x69')](_0x332b('0x6c'),_0x376941);}})['then'](function(){return respondWithRpcPromise('Reload',_0x332b('0x5b'),{'module':'chan_sip.so'});})['then'](function(){var _0x54f553=_0x7fc30d['user'][_0x332b('0x56')]({'plain':!![]});if(!_0x54f553)throw new Error(_0x332b('0x5c'));if(_0x54f553[_0x332b('0x5d')]==='user'){var _0x4caa39=_0x120e3a[_0x332b('0x56')]({'plain':!![]});return db[_0x332b('0x5f')][_0x332b('0x54')]({'where':{'name':_0x332b('0x32'),'userProfileId':_0x54f553['userProfileId']},'raw':!![]})[_0x332b('0x1b')](function(_0x5d6e00){if(_0x5d6e00&&_0x5d6e00[_0x332b('0x61')]===0x0){return db[_0x332b('0x33')][_0x332b('0x5b')]({'name':_0x4caa39['name'],'resourceId':_0x4caa39['id'],'type':_0x5d6e00['name'],'sectionId':_0x5d6e00['id']},{})[_0x332b('0x1b')](function(){return _0x120e3a;});}else{return _0x120e3a;}})['catch'](function(_0x5312d5){logger[_0x332b('0x22')](_0x332b('0x62'),_0x5312d5);throw _0x5312d5;});}return _0x120e3a;})[_0x332b('0x1b')](respondWithResult(_0x182349,0xc9))['catch'](handleError(_0x182349,null));};exports[_0x332b('0x30')]=function(_0xe5f69e,_0x126fd3,_0x3d74f0){var _0x85ac78;return db[_0x332b('0x4b')][_0x332b('0x54')]({'where':{'id':_0xe5f69e[_0x332b('0x4f')]['id']}})[_0x332b('0x1b')](handleEntityNotFound(_0x126fd3,null))[_0x332b('0x1b')](saveUpdates(_0xe5f69e['body'],null))[_0x332b('0x1b')](function(_0x207f9c){if(_0x207f9c){_0x85ac78=_0x207f9c;return db[_0x332b('0x4b')]['findAll']({'raw':!![]});}})[_0x332b('0x1b')](function(_0x1494e4){if(_0x1494e4){var _0x330b0f=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),_0x332b('0x68'));var _0x2f4c61=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0x1a5713=ejs['render'](_0x330b0f,{'trunks':_0x1494e4||[]});fs[_0x332b('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a5713);var _0x1c7ed6=ejs[_0x332b('0x6b')](_0x2f4c61,{'trunks':_0x1494e4||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1c7ed6);return respondWithRpcPromise(_0x332b('0x6d'),'update',{'module':_0x332b('0x6e')});}return null;})[_0x332b('0x1b')](function(_0x28981e){if(_0x28981e){return _0x85ac78;}})[_0x332b('0x1b')](respondWithResult(_0x126fd3,null))[_0x332b('0x25')](handleError(_0x126fd3,null));};exports['destroy']=function(_0x4157d9,_0x1e747e,_0x52e63e){var _0x539dd7;return db[_0x332b('0x4b')][_0x332b('0x54')]({'where':{'id':_0x4157d9[_0x332b('0x4f')]['id']}})[_0x332b('0x1b')](handleEntityNotFound(_0x1e747e,null))[_0x332b('0x1b')](removeEntity(_0x1e747e,null))[_0x332b('0x1b')](function(){return db['Trunk'][_0x332b('0x4c')]({'raw':!![]});})['then'](function(_0x57dc28){var _0x3d2512=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),_0x332b('0x68'));var _0x282925=fs['readFileSync'](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0xfd4a42=ejs[_0x332b('0x6b')](_0x3d2512,{'trunks':_0x57dc28});var _0x3f9136=ejs[_0x332b('0x6b')](_0x282925,{'trunks':_0x57dc28});fs['writeFileSync'](_0x332b('0x6f'),_0xfd4a42);fs['writeFileSync'](_0x332b('0x6c'),_0x3f9136);return respondWithRpcPromise('Reload','destroy',{'module':_0x332b('0x6e')});})['catch'](handleError(_0x1e747e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8cc2462..3b710b0 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 _0x4e73=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','lodash','util','../../config/logger','moment'];(function(_0x3db128,_0x5d1bae){var _0x8ea5ac=function(_0x484bf1){while(--_0x484bf1){_0x3db128['push'](_0x3db128['shift']());}};_0x8ea5ac(++_0x5d1bae);}(_0x4e73,0x167));var _0x34e7=function(_0x48633c,_0x4a41cb){_0x48633c=_0x48633c-0x0;var _0x2a9e26=_0x4e73[_0x48633c];return _0x2a9e26;};'use strict';var _=require(_0x34e7('0x0'));var util=require(_0x34e7('0x1'));var logger=require(_0x34e7('0x2'))('api');var moment=require(_0x34e7('0x3'));var BPromise=require(_0x34e7('0x4'));var rp=require(_0x34e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34e7('0x6'));var config=require(_0x34e7('0x7'));var attributes=require('./trunk.attributes');module[_0x34e7('0x8')]=function(_0x340ba1,_0x200cb3){return _0x340ba1[_0x34e7('0x9')](_0x34e7('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5854=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0xe988b8,_0x56616a){var _0x119f53=function(_0x296219){while(--_0x296219){_0xe988b8['push'](_0xe988b8['shift']());}};_0x119f53(++_0x56616a);}(_0x5854,0x115));var _0x4585=function(_0x298769,_0x231c31){_0x298769=_0x298769-0x0;var _0x5def73=_0x5854[_0x298769];return _0x5def73;};'use strict';var _=require(_0x4585('0x0'));var util=require(_0x4585('0x1'));var logger=require(_0x4585('0x2'))('api');var moment=require(_0x4585('0x3'));var BPromise=require(_0x4585('0x4'));var rp=require(_0x4585('0x5'));var fs=require('fs');var path=require(_0x4585('0x6'));var rimraf=require('rimraf');var config=require(_0x4585('0x7'));var attributes=require(_0x4585('0x8'));module[_0x4585('0x9')]=function(_0x263e3a,_0x26eed9){return _0x263e3a[_0x4585('0xa')](_0x4585('0xb'),attributes,{'tableName':_0x4585('0xc'),'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 8d95b83..ee76a94 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 _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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1a85,0x178));var _0x51a8=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x1a85[_0x1499c4];return _0x3cf45a;};'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 +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(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1a85,0x178));var _0x51a8=function(_0x28e919,_0x145939){_0x28e919=_0x28e919-0x0;var _0x692b7e=_0x1a85[_0x28e919];return _0x692b7e;};'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 42ede17..1b5a8ff 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 _0x5783=['removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','join','root','server/files/images/','format','%s-%s','originalname','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x5ae1dc,_0x26bcc1){var _0x723cab=function(_0x169dca){while(--_0x169dca){_0x5ae1dc['push'](_0x5ae1dc['shift']());}};_0x723cab(++_0x26bcc1);}(_0x5783,0x72));var _0x3578=function(_0x118616,_0x476beb){_0x118616=_0x118616-0x0;var _0x26302d=_0x5783[_0x118616];return _0x26302d;};'use strict';var multer=require(_0x3578('0x0'));var util=require(_0x3578('0x1'));var path=require('path');var timeout=require(_0x3578('0x2'));var express=require('express');var router=express[_0x3578('0x3')]();var auth=require(_0x3578('0x4'));var interaction=require(_0x3578('0x5'));var config=require(_0x3578('0x6'));var controller=require(_0x3578('0x7'));router[_0x3578('0x8')]('/',auth[_0x3578('0x9')](),controller[_0x3578('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3578('0x8')](_0x3578('0xb'),auth['isAuthenticated'](),controller[_0x3578('0xc')]);router['get'](_0x3578('0xd'),auth[_0x3578('0x9')](),controller[_0x3578('0xe')]);router[_0x3578('0x8')](_0x3578('0xf'),controller[_0x3578('0x10')]);router[_0x3578('0x8')](_0x3578('0x11'),auth[_0x3578('0x9')](),controller[_0x3578('0x12')]);router[_0x3578('0x8')](_0x3578('0x13'),auth[_0x3578('0x9')](),controller['getQueues']);router[_0x3578('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x3578('0x8')](_0x3578('0x14'),auth['isAuthenticated'](),controller[_0x3578('0x15')]);router[_0x3578('0x8')](_0x3578('0x16'),auth[_0x3578('0x9')](),controller[_0x3578('0x17')]);router[_0x3578('0x8')](_0x3578('0x18'),auth[_0x3578('0x9')](),controller[_0x3578('0x19')]);router[_0x3578('0x8')](_0x3578('0x1a'),auth[_0x3578('0x9')](),controller[_0x3578('0x1b')]);router[_0x3578('0x8')](_0x3578('0x1c'),auth[_0x3578('0x9')](),controller['getOpenchannelInteractions']);router['get']('/:id/mail/interactions',auth[_0x3578('0x9')](),controller[_0x3578('0x1d')]);router[_0x3578('0x8')](_0x3578('0x1e'),auth['isAuthenticated'](),controller[_0x3578('0x1f')]);router[_0x3578('0x8')](_0x3578('0x20'),auth[_0x3578('0x9')](),controller['getFaxInteractions']);router[_0x3578('0x8')](_0x3578('0x21'),auth[_0x3578('0x9')](),controller[_0x3578('0x22')]);router[_0x3578('0x8')](_0x3578('0x23'),auth[_0x3578('0x9')](),controller[_0x3578('0x24')]);router[_0x3578('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0x3578('0x25')]);router[_0x3578('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0x3578('0x26')]);router[_0x3578('0x8')](_0x3578('0x27'),auth[_0x3578('0x9')](),controller[_0x3578('0x28')]);router[_0x3578('0x8')](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x2a')]);router[_0x3578('0x8')](_0x3578('0x2b'),auth[_0x3578('0x9')](),controller[_0x3578('0x2c')]);router['get'](_0x3578('0x2d'),auth['isAuthenticated'](),controller[_0x3578('0x2e')]);router[_0x3578('0x8')](_0x3578('0x2f'),auth['isAuthenticated'](),controller[_0x3578('0x30')]);router['get']('/:id/chat_websites',auth[_0x3578('0x9')](),controller['getChatWebsites']);router[_0x3578('0x8')](_0x3578('0x31'),auth[_0x3578('0x9')](),controller[_0x3578('0x32')]);router['get'](_0x3578('0x33'),auth[_0x3578('0x9')](),controller[_0x3578('0x34')]);router[_0x3578('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x3578('0x35')]);router['get'](_0x3578('0x36'),auth[_0x3578('0x9')](),controller[_0x3578('0x37')]);router[_0x3578('0x38')](_0x3578('0x11'),auth[_0x3578('0x9')](),controller['addContacts']);router[_0x3578('0x38')]('/',auth[_0x3578('0x9')](),controller[_0x3578('0x39')]);router[_0x3578('0x38')]('/create_many',auth[_0x3578('0x9')](),controller[_0x3578('0x3a')]);router[_0x3578('0x38')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11f478,_0x2c6d94,_0x13122d){_0x13122d(null,path[_0x3578('0x3b')](config[_0x3578('0x3c')],_0x3578('0x3d')));},'filename':function(_0x41afd0,_0xb4f87e,_0x38bb7f){_0x38bb7f(null,util[_0x3578('0x3e')](_0x3578('0x3f'),Date['now'](),_0xb4f87e[_0x3578('0x40')]));}})});router[_0x3578('0x38')](_0x3578('0xf'),upload[_0x3578('0x41')](_0x3578('0x42')),controller['addAvatar']);router['post'](_0x3578('0x43'),auth[_0x3578('0x9')](),controller[_0x3578('0x44')]);router[_0x3578('0x38')](_0x3578('0x45'),auth[_0x3578('0x9')](),controller['logout']);router['post'](_0x3578('0x46'),auth['isAuthenticated'](),controller[_0x3578('0x47')]);router[_0x3578('0x38')](_0x3578('0x48'),auth[_0x3578('0x9')](),controller[_0x3578('0x49')]);router[_0x3578('0x38')](_0x3578('0x23'),auth[_0x3578('0x9')](),controller[_0x3578('0x4a')]);router['post'](_0x3578('0x4b'),auth[_0x3578('0x9')](),controller[_0x3578('0x4c')]);router['post'](_0x3578('0x4d'),auth[_0x3578('0x9')](),controller[_0x3578('0x4e')]);router['post'](_0x3578('0x4f'),auth[_0x3578('0x9')](),controller[_0x3578('0x50')]);router[_0x3578('0x38')](_0x3578('0x51'),auth['isAuthenticated'](),controller[_0x3578('0x52')]);router[_0x3578('0x38')](_0x3578('0x53'),auth[_0x3578('0x9')](),controller[_0x3578('0x54')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x55')]);router[_0x3578('0x38')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3578('0x56')]);router['post'](_0x3578('0x2d'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x3578('0x9')](),controller[_0x3578('0x57')]);router[_0x3578('0x38')](_0x3578('0x58'),auth[_0x3578('0x9')](),controller['addChatWebsites']);router[_0x3578('0x38')](_0x3578('0x31'),auth['isAuthenticated'](),controller[_0x3578('0x59')]);router[_0x3578('0x38')](_0x3578('0x33'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x3578('0x38')](_0x3578('0x36'),auth[_0x3578('0x9')](),controller['createApiKey']);router['put']('/:id',auth[_0x3578('0x9')](),controller[_0x3578('0x5a')]);router[_0x3578('0x5b')](_0x3578('0x5c'),auth[_0x3578('0x9')](),controller[_0x3578('0x5d')]);router[_0x3578('0x5e')]('/:id/queues',auth[_0x3578('0x9')](),controller[_0x3578('0x5f')]);router['delete']('/:id/teams',auth[_0x3578('0x9')](),controller[_0x3578('0x60')]);router[_0x3578('0x5e')]('/:id',auth[_0x3578('0x9')](),controller['destroy']);router[_0x3578('0x5e')](_0x3578('0x4b'),auth[_0x3578('0x9')](),controller['removeChatInteractions']);router[_0x3578('0x5e')](_0x3578('0x4d'),auth[_0x3578('0x9')](),controller[_0x3578('0x61')]);router[_0x3578('0x5e')](_0x3578('0x4f'),auth['isAuthenticated'](),controller[_0x3578('0x62')]);router[_0x3578('0x5e')](_0x3578('0x51'),auth[_0x3578('0x9')](),controller[_0x3578('0x63')]);router[_0x3578('0x5e')](_0x3578('0x53'),auth['isAuthenticated'](),controller[_0x3578('0x64')]);router['delete'](_0x3578('0x65'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x3578('0x5e')](_0x3578('0x29'),auth[_0x3578('0x9')](),controller[_0x3578('0x66')]);router[_0x3578('0x5e')](_0x3578('0x2b'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x3578('0x5e')](_0x3578('0x2d'),auth['isAuthenticated'](),controller[_0x3578('0x67')]);router[_0x3578('0x5e')](_0x3578('0x2f'),auth[_0x3578('0x9')](),controller[_0x3578('0x68')]);router[_0x3578('0x5e')]('/:id/chat_websites',auth[_0x3578('0x9')](),controller[_0x3578('0x69')]);router[_0x3578('0x5e')](_0x3578('0x31'),auth[_0x3578('0x9')](),controller[_0x3578('0x6a')]);router['delete'](_0x3578('0x33'),auth[_0x3578('0x9')](),controller[_0x3578('0x6b')]);router['delete'](_0x3578('0x36'),auth[_0x3578('0x9')](),controller[_0x3578('0x6c')]);module[_0x3578('0x6d')]=router; \ No newline at end of file +var _0xc084=['createApiKey','put','update','delete','removeQueues','removeTeams','destroy','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts'];(function(_0xe5f4a,_0x4753dd){var _0x5ce9a2=function(_0xf147b1){while(--_0xf147b1){_0xe5f4a['push'](_0xe5f4a['shift']());}};_0x5ce9a2(++_0x4753dd);}(_0xc084,0x159));var _0x4c08=function(_0x11ad65,_0x352d3c){_0x11ad65=_0x11ad65-0x0;var _0x35590c=_0xc084[_0x11ad65];return _0x35590c;};'use strict';var multer=require(_0x4c08('0x0'));var util=require(_0x4c08('0x1'));var path=require(_0x4c08('0x2'));var timeout=require(_0x4c08('0x3'));var express=require(_0x4c08('0x4'));var router=express[_0x4c08('0x5')]();var auth=require(_0x4c08('0x6'));var interaction=require(_0x4c08('0x7'));var config=require(_0x4c08('0x8'));var controller=require(_0x4c08('0x9'));router['get']('/',auth[_0x4c08('0xa')](),controller['index']);router[_0x4c08('0xb')](_0x4c08('0xc'),auth[_0x4c08('0xa')](),controller['describe']);router[_0x4c08('0xb')](_0x4c08('0xd'),auth[_0x4c08('0xa')](),controller['whoami']);router['get'](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0xf')]);router[_0x4c08('0xb')](_0x4c08('0x10'),controller[_0x4c08('0x11')]);router[_0x4c08('0xb')](_0x4c08('0x12'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x13')]);router[_0x4c08('0xb')](_0x4c08('0x14'),auth['isAuthenticated'](),controller[_0x4c08('0x15')]);router[_0x4c08('0xb')](_0x4c08('0x16'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x17')]);router['get'](_0x4c08('0x18'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x19')]);router['get']('/:id/recordings',auth[_0x4c08('0xa')](),controller[_0x4c08('0x1a')]);router[_0x4c08('0xb')]('/:id/screen_recordings',auth[_0x4c08('0xa')](),controller['getScreenRecordings']);router['get'](_0x4c08('0x1b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x1c')]);router[_0x4c08('0xb')](_0x4c08('0x1d'),auth[_0x4c08('0xa')](),controller['getOpenchannelInteractions']);router[_0x4c08('0xb')]('/:id/mail/interactions',auth[_0x4c08('0xa')](),controller[_0x4c08('0x1e')]);router[_0x4c08('0xb')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x4c08('0xb')](_0x4c08('0x1f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x20')]);router[_0x4c08('0xb')](_0x4c08('0x21'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x22')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x4c08('0x23')]);router[_0x4c08('0xb')](_0x4c08('0x24'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x25')]);router['get'](_0x4c08('0x26'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x27')]);router['get']('/:id/prefixes',auth[_0x4c08('0xa')](),controller[_0x4c08('0x28')]);router[_0x4c08('0xb')](_0x4c08('0x29'),auth['isAuthenticated'](),controller[_0x4c08('0x2a')]);router[_0x4c08('0xb')](_0x4c08('0x2b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x2c')]);router[_0x4c08('0xb')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x2d')]);router[_0x4c08('0xb')]('/:id/sms_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x2e')]);router[_0x4c08('0xb')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller['getChatWebsites']);router[_0x4c08('0xb')](_0x4c08('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x4c08('0xb')]('/:id/square_projects',auth[_0x4c08('0xa')](),controller[_0x4c08('0x31')]);router[_0x4c08('0xb')](_0x4c08('0x32'),auth[_0x4c08('0xa')](),controller['getScheduledCalls']);router[_0x4c08('0xb')](_0x4c08('0x33'),auth[_0x4c08('0xa')](),controller['getApiKey']);router[_0x4c08('0x34')](_0x4c08('0x12'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x35')]);router[_0x4c08('0x34')]('/',auth['isAuthenticated'](),controller[_0x4c08('0x36')]);router[_0x4c08('0x34')](_0x4c08('0x37'),auth['isAuthenticated'](),controller[_0x4c08('0x38')]);router[_0x4c08('0x34')](_0x4c08('0x14'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x39')]);var upload=multer({'storage':multer[_0x4c08('0x3a')]({'destination':function(_0x3567b4,_0x276b6d,_0x176d2e){_0x176d2e(null,path[_0x4c08('0x3b')](config[_0x4c08('0x3c')],_0x4c08('0x3d')));},'filename':function(_0x4c51cd,_0x517748,_0x31cd28){_0x31cd28(null,util[_0x4c08('0x3e')](_0x4c08('0x3f'),Date[_0x4c08('0x40')](),_0x517748[_0x4c08('0x41')]));}})});router['post'](_0x4c08('0x10'),upload[_0x4c08('0x42')](_0x4c08('0x43')),controller[_0x4c08('0x44')]);router[_0x4c08('0x34')]('/:id/login',auth['isAuthenticated'](),controller[_0x4c08('0x45')]);router['post'](_0x4c08('0x46'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x47')]);router[_0x4c08('0x34')](_0x4c08('0x48'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x49')]);router[_0x4c08('0x34')]('/:id/unpause',auth[_0x4c08('0xa')](),controller[_0x4c08('0x4a')]);router['post'](_0x4c08('0x4b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x4c')]);router[_0x4c08('0x34')](_0x4c08('0x4d'),auth[_0x4c08('0xa')](),controller['addChatInteractions']);router[_0x4c08('0x34')](_0x4c08('0x4e'),auth['isAuthenticated'](),controller[_0x4c08('0x4f')]);router[_0x4c08('0x34')](_0x4c08('0x50'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x51')]);router[_0x4c08('0x34')](_0x4c08('0x52'),auth[_0x4c08('0xa')](),controller['addSmsInteractions']);router[_0x4c08('0x34')](_0x4c08('0x53'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x4c08('0x34')]('/:id/whatsapp_interactions',auth[_0x4c08('0xa')](),controller[_0x4c08('0x54')]);router['post'](_0x4c08('0x29'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x4c08('0x34')](_0x4c08('0x2b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x55')]);router[_0x4c08('0x34')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x56')]);router['post'](_0x4c08('0x57'),auth['isAuthenticated'](),controller[_0x4c08('0x58')]);router[_0x4c08('0x34')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x59')]);router['post'](_0x4c08('0x30'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x5a')]);router['post']('/:id/square_projects',auth[_0x4c08('0xa')](),controller['addSquareProjects']);router[_0x4c08('0x34')]('/:id/api_key',auth[_0x4c08('0xa')](),controller[_0x4c08('0x5b')]);router[_0x4c08('0x5c')](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x5d')]);router[_0x4c08('0x5c')]('/:id/password',auth[_0x4c08('0xa')](),controller['changePassword']);router[_0x4c08('0x5e')](_0x4c08('0x14'),auth['isAuthenticated'](),controller[_0x4c08('0x5f')]);router[_0x4c08('0x5e')](_0x4c08('0x4b'),auth['isAuthenticated'](),controller[_0x4c08('0x60')]);router[_0x4c08('0x5e')](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x61')]);router[_0x4c08('0x5e')]('/:id/chat_interactions',auth[_0x4c08('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x4c08('0xa')](),controller['removeMailInteractions']);router[_0x4c08('0x5e')]('/:id/fax_interactions',auth[_0x4c08('0xa')](),controller['removeFaxInteractions']);router[_0x4c08('0x5e')](_0x4c08('0x52'),auth[_0x4c08('0xa')](),controller['removeSmsInteractions']);router[_0x4c08('0x5e')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x4c08('0x62')]);router[_0x4c08('0x5e')](_0x4c08('0x63'),auth[_0x4c08('0xa')](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x64')]);router['delete'](_0x4c08('0x2b'),auth['isAuthenticated'](),controller[_0x4c08('0x65')]);router[_0x4c08('0x5e')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x66')]);router['delete'](_0x4c08('0x57'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x67')]);router[_0x4c08('0x5e')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x68')]);router[_0x4c08('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x4c08('0x69')]);router['delete'](_0x4c08('0x6a'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x6b')]);router[_0x4c08('0x5e')](_0x4c08('0x33'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x6c')]);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 e1c5f4a..969bf42 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 _0x77d4=['uas','certificate','active','passive','actpass','update,nonat','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','getDataValue','email','toLowerCase','admin','user','telephone','INTEGER','internal','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','originate','uac'];(function(_0x486c1b,_0x5893b3){var _0x19e4d4=function(_0xec78bb){while(--_0xec78bb){_0x486c1b['push'](_0x486c1b['shift']());}};_0x19e4d4(++_0x5893b3);}(_0x77d4,0xd0));var _0x477d=function(_0x15c420,_0x1a8ef1){_0x15c420=_0x15c420-0x0;var _0x23f862=_0x77d4[_0x15c420];return _0x23f862;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x477d('0x0'));module[_0x477d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x477d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e2b18){this[_0x477d('0x3')]('name',_0x3e2b18);this[_0x477d('0x3')](_0x477d('0x4'),_0x3e2b18);},'comment':_0x477d('0x5')},'fullname':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'set':function(_0x31b6dd){this[_0x477d('0x3')]('fullname',_0x31b6dd);this[_0x477d('0x3')](_0x477d('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x31b6dd,this[_0x477d('0x8')]('internal')));}},'alias':{'type':Sequelize[_0x477d('0x6')]},'email':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'unique':_0x477d('0x9'),'validate':{'isEmail':!![]},'set':function(_0x27fb71){if(_0x27fb71){this[_0x477d('0x3')](_0x477d('0x9'),_0x27fb71[_0x477d('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x477d('0xb'),_0x477d('0xc'),'agent',_0x477d('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x477d('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':![],'unique':'internal','set':function(_0x23635b){this[_0x477d('0x3')](_0x477d('0xf'),_0x23635b);this[_0x477d('0x3')]('accountcode',_0x23635b);this[_0x477d('0x3')](_0x477d('0x7'),util[_0x477d('0x10')]('\x22%s\x22\x20<%s>',this[_0x477d('0x8')](_0x477d('0x11')),_0x23635b));}},'salt':{'type':Sequelize[_0x477d('0x6')]},'phone':{'type':Sequelize[_0x477d('0x6')]},'mobile':{'type':Sequelize[_0x477d('0x6')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x477d('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x477d('0x6')]},'online':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x477d('0x13')]},'voicePause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x477d('0x6')],'defaultValue':_0x477d('0x14')},'lastPauseAt':{'type':Sequelize[_0x477d('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x477d('0xe')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x477d('0xe')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x15')},'ipaddr':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x477d('0xe')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x17'),_0x477d('0xc'),_0x477d('0x18')),'allowNull':!![],'defaultValue':_0x477d('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x477d('0x19')},'callingpres':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x1a'),'ALLOWED_PASSED_SCREEN',_0x477d('0x1b'),_0x477d('0x1c'),_0x477d('0x1d'),_0x477d('0x1e'),_0x477d('0x1f'),_0x477d('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x21'),'set':function(_0x48d40c){this[_0x477d('0x3')](_0x477d('0x22'),_0x48d40c?_0x48d40c[_0x477d('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x477d('0x8')](_0x477d('0x22'))[_0x477d('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x25'),_0x477d('0x26'),'shortinfo',_0x477d('0x27'),_0x477d('0x28')),'allowNull':!![],'defaultValue':_0x477d('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no',_0x477d('0x2a'),_0x477d('0x2b'),_0x477d('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x477d('0x2d'),'set':function(_0x10ed7b){this['setDataValue'](_0x477d('0x2e'),_0x10ed7b?_0x10ed7b['join'](','):null);},'get':function(){return this[_0x477d('0x8')]('nat')?this[_0x477d('0x8')](_0x477d('0x2e'))[_0x477d('0x24')](','):null;},'comment':_0x477d('0x2f')},'callgroup':{'type':Sequelize[_0x477d('0x6')]},'namedcallgroup':{'type':Sequelize[_0x477d('0x6')]},'pickupgroup':{'type':Sequelize[_0x477d('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x477d('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'defaultValue':_0x477d('0x30')},'allow':{'type':Sequelize[_0x477d('0x6')],'allowNull':![],'defaultValue':_0x477d('0x31'),'set':function(_0xaa9759){this['setDataValue']('allow',_0xaa9759?_0xaa9759[_0x477d('0x23')](';'):_0x477d('0x31'));},'get':function(){return this['getDataValue'](_0x477d('0x32'))?this['getDataValue'](_0x477d('0x32'))[_0x477d('0x24')](';'):null;},'comment':_0x477d('0x33')},'autoframing':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'set':function(_0x43a661){this[_0x477d('0x3')](_0x477d('0x34'),_0x43a661?_0x43a661[_0x477d('0x23')](','):null);},'get':function(){return this[_0x477d('0x8')]('insecure')?this['getDataValue'](_0x477d('0x34'))[_0x477d('0x24')](','):null;},'comment':_0x477d('0x35')},'trustrpid':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![],'defaultValue':_0x477d('0x36')},'amaflags':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':_0x477d('0x29')},'busylevel':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x477d('0x16')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x477d('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x38'),'refuse',_0x477d('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x3a'),_0x477d('0x3b')),'allowNull':!![],'defaultValue':_0x477d('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':_0x477d('0x29')},'keepalive':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no','fingerprint',_0x477d('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x3d'),_0x477d('0x3e'),_0x477d('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x477d('0xe')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x477d('0x16')](_0x477d('0x29'),'no',_0x477d('0x2a'),_0x477d('0x2b'),_0x477d('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x477d('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x477d('0x13')]},'passwordResetAt':{'type':Sequelize[_0x477d('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x477d('0x6')]},'showWebBar':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0,'set':function(_0x53f916){this['setDataValue']('showWebBar',_0x53f916);var _0x42fd46=this[_0x477d('0x41')]({'plain':!![]});switch(_0x53f916){case 0x0:case 0x1:var _0x88a7db=_0x42fd46[_0x477d('0x22')]?_[_0x477d('0x42')](_0x42fd46[_0x477d('0x22')])?_0x42fd46[_0x477d('0x22')][_0x477d('0x23')]():_0x42fd46['transport']:_0x477d('0x21');if(_0x88a7db===_0x477d('0x43')){_0x88a7db=_0x477d('0x21');}this[_0x477d('0x3')](_0x477d('0x22'),_0x88a7db);this[_0x477d('0x3')](_0x477d('0x44'),'no');this[_0x477d('0x3')]('avpf',null);this[_0x477d('0x3')](_0x477d('0x45'),null);this[_0x477d('0x3')](_0x477d('0x46'),null);this[_0x477d('0x3')](_0x477d('0x47'),null);this[_0x477d('0x3')](_0x477d('0x48'),null);this[_0x477d('0x3')](_0x477d('0x49'),null);this[_0x477d('0x3')](_0x477d('0x4a'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x477d('0x3')](_0x477d('0x4b'),'no');break;case 0x2:this[_0x477d('0x3')](_0x477d('0x22'),_0x477d('0x43'));this[_0x477d('0x3')](_0x477d('0x44'),_0x477d('0x29'));this['setDataValue'](_0x477d('0x4c'),_0x477d('0x29'));this[_0x477d('0x3')](_0x477d('0x45'),_0x477d('0x29'));this[_0x477d('0x3')]('icesupport',_0x477d('0x29'));this[_0x477d('0x3')](_0x477d('0x47'),_0x477d('0x29'));this[_0x477d('0x3')]('dtlsverify','no');this[_0x477d('0x3')]('dtlssetup',_0x477d('0x3f'));this['setDataValue'](_0x477d('0x4a'),_0x42fd46[_0x477d('0x4a')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x477d('0x4d'),_0x42fd46[_0x477d('0x4d')]||_0x477d('0x4e'));this['setDataValue'](_0x477d('0x4b'),_0x477d('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x477d('0x4f')],'set':function(_0x2a59ee){this[_0x477d('0x3')](_0x477d('0x50'),_0x2a59ee?_0x2a59ee[_0x477d('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x477d('0x50'))?_[_0x477d('0x51')](this[_0x477d('0x8')](_0x477d('0x50'))[_0x477d('0x24')](','),function(_0x99b172){return parseInt(_0x99b172,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x477d('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x477d('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x477d('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x477d('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x477d('0x6')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x477d('0x52')],'get':function(){return this[_0x477d('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x477d('0x8')](_0x477d('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x477d('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![],'set':function(_0x187627){if(typeof _0x187627==='string'){var _0x4eb30b=_0x187627==='1'?!![]:_0x187627==='0'?![]:_0x187627===_0x477d('0x54')?!![]:_0x187627===_0x477d('0x55')?![]:![];this[_0x477d('0x3')]('screenrecording',_0x4eb30b);}else{this[_0x477d('0x3')](_0x477d('0x56'),_0x187627);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x242025){this['setDataValue']('blocked',_0x242025);if(_0x242025===!![]){this[_0x477d('0x3')](_0x477d('0x57'),moment());this['setDataValue'](_0x477d('0x58'),0x0);}else{this[_0x477d('0x3')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x477d('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x477d('0xe')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x477d('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1ab1=['nonat','update','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','true','false','screenrecording','blockedAt','loginAttempts','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','rfc2833','yes','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass'];(function(_0xc16403,_0x19f30c){var _0x4e351d=function(_0x4fe512){while(--_0x4fe512){_0xc16403['push'](_0xc16403['shift']());}};_0x4e351d(++_0x19f30c);}(_0x1ab1,0x1cd));var _0x11ab=function(_0x378820,_0x42c20e){_0x378820=_0x378820-0x0;var _0x45d922=_0x1ab1[_0x378820];return _0x45d922;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x11ab('0x0'));var _=require(_0x11ab('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11ab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1837a0){this[_0x11ab('0x3')](_0x11ab('0x2'),_0x1837a0);this[_0x11ab('0x3')](_0x11ab('0x4'),_0x1837a0);},'comment':_0x11ab('0x5')},'fullname':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'set':function(_0x3e7490){this['setDataValue'](_0x11ab('0x7'),_0x3e7490);this[_0x11ab('0x3')](_0x11ab('0x8'),util[_0x11ab('0x9')](_0x11ab('0xa'),_0x3e7490,this[_0x11ab('0xb')](_0x11ab('0xc'))));}},'alias':{'type':Sequelize[_0x11ab('0x6')]},'email':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'unique':_0x11ab('0xd'),'validate':{'isEmail':!![]},'set':function(_0x4f555e){if(_0x4f555e){this[_0x11ab('0x3')]('email',_0x4f555e[_0x11ab('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x11ab('0xf'),_0x11ab('0x10'),_0x11ab('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x11ab('0xc'),'set':function(_0x409b00){this[_0x11ab('0x3')]('internal',_0x409b00);this[_0x11ab('0x3')](_0x11ab('0x12'),_0x409b00);this[_0x11ab('0x3')](_0x11ab('0x8'),util[_0x11ab('0x9')](_0x11ab('0xa'),this[_0x11ab('0xb')](_0x11ab('0x7')),_0x409b00));}},'salt':{'type':Sequelize[_0x11ab('0x6')]},'phone':{'type':Sequelize[_0x11ab('0x6')]},'mobile':{'type':Sequelize[_0x11ab('0x6')]},'address':{'type':Sequelize[_0x11ab('0x6')]},'zipcode':{'type':Sequelize[_0x11ab('0x6')]},'userpic':{'type':Sequelize[_0x11ab('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x11ab('0x6')]},'online':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x11ab('0x14')]},'voicePause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':_0x11ab('0x15')},'lastPauseAt':{'type':Sequelize[_0x11ab('0x14')]},'chatCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x11ab('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x11ab('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x19'),_0x11ab('0x10'),_0x11ab('0x1a')),'allowNull':!![],'defaultValue':_0x11ab('0x19')},'context':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x11ab('0x18')]('ALLOWED_NOT_SCREENED',_0x11ab('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x11ab('0x1c'),_0x11ab('0x1d'),_0x11ab('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x1f'),'set':function(_0x476758){this[_0x11ab('0x3')](_0x11ab('0x20'),_0x476758?_0x476758['join'](','):null);},'get':function(){return this['getDataValue'](_0x11ab('0x20'))?this[_0x11ab('0xb')]('transport')[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x22')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x11ab('0x23'),_0x11ab('0x24'),'inband','auto'),'allowNull':!![],'defaultValue':_0x11ab('0x25')},'directmedia':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no','nonat','update',_0x11ab('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x28'),'set':function(_0x5a6967){this[_0x11ab('0x3')]('nat',_0x5a6967?_0x5a6967[_0x11ab('0x29')](','):null);},'get':function(){return this['getDataValue'](_0x11ab('0x2a'))?this['getDataValue'](_0x11ab('0x2a'))[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x2b')},'callgroup':{'type':Sequelize[_0x11ab('0x6')]},'namedcallgroup':{'type':Sequelize[_0x11ab('0x6')]},'pickupgroup':{'type':Sequelize[_0x11ab('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'defaultValue':_0x11ab('0x2c')},'allow':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'defaultValue':_0x11ab('0x2d'),'set':function(_0x49bbd2){this[_0x11ab('0x3')]('allow',_0x49bbd2?_0x49bbd2['join'](';'):_0x11ab('0x2d'));},'get':function(){return this[_0x11ab('0xb')](_0x11ab('0x2e'))?this[_0x11ab('0xb')]('allow')[_0x11ab('0x21')](';'):null;},'comment':_0x11ab('0x2f')},'autoframing':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x18beca){this[_0x11ab('0x3')](_0x11ab('0x30'),_0x18beca?_0x18beca[_0x11ab('0x29')](','):null);},'get':function(){return this[_0x11ab('0xb')](_0x11ab('0x30'))?this[_0x11ab('0xb')](_0x11ab('0x30'))[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x31')},'trustrpid':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no',_0x11ab('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x33')},'amaflags':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':_0x11ab('0x26')},'busylevel':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x11ab('0x18')]('yes','no',_0x11ab('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x35'),'refuse',_0x11ab('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x11ab('0x37'),_0x11ab('0x38')),'allowNull':!![],'defaultValue':_0x11ab('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no','fingerprint',_0x11ab('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x3a'),_0x11ab('0x3b'),_0x11ab('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no',_0x11ab('0x3d'),_0x11ab('0x3e'),_0x11ab('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x11ab('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x11ab('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x11ab('0x6')]},'showWebBar':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0,'set':function(_0x39362a){this['setDataValue'](_0x11ab('0x40'),_0x39362a);var _0x31e4d6=this[_0x11ab('0x41')]({'plain':!![]});switch(_0x39362a){case 0x0:case 0x1:var _0xbd944f=_0x31e4d6['transport']?_[_0x11ab('0x42')](_0x31e4d6[_0x11ab('0x20')])?_0x31e4d6[_0x11ab('0x20')][_0x11ab('0x29')]():_0x31e4d6[_0x11ab('0x20')]:'udp';if(_0xbd944f===_0x11ab('0x43')){_0xbd944f='udp';}this['setDataValue']('transport',_0xbd944f);this[_0x11ab('0x3')](_0x11ab('0x44'),'no');this[_0x11ab('0x3')](_0x11ab('0x45'),null);this['setDataValue'](_0x11ab('0x46'),null);this[_0x11ab('0x3')]('icesupport',null);this[_0x11ab('0x3')](_0x11ab('0x47'),null);this['setDataValue'](_0x11ab('0x48'),null);this['setDataValue'](_0x11ab('0x49'),null);this['setDataValue'](_0x11ab('0x4a'),null);this[_0x11ab('0x3')](_0x11ab('0x4b'),null);this[_0x11ab('0x3')]('rtcp_mux','no');break;case 0x2:this[_0x11ab('0x3')]('transport',_0x11ab('0x43'));this[_0x11ab('0x3')](_0x11ab('0x44'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x45'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x46'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x4c'),'yes');this[_0x11ab('0x3')](_0x11ab('0x47'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x48'),'no');this[_0x11ab('0x3')](_0x11ab('0x49'),_0x11ab('0x3c'));this[_0x11ab('0x3')](_0x11ab('0x4a'),_0x31e4d6[_0x11ab('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0x11ab('0x3')]('dtlsprivatekey',_0x31e4d6[_0x11ab('0x4b')]||_0x11ab('0x4d'));this[_0x11ab('0x3')](_0x11ab('0x4e'),_0x11ab('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x74c763){this[_0x11ab('0x3')](_0x11ab('0x4f'),_0x74c763?_0x74c763[_0x11ab('0x29')](','):[]);},'get':function(){return this['getDataValue'](_0x11ab('0x4f'))?_[_0x11ab('0x50')](this[_0x11ab('0xb')](_0x11ab('0x4f'))['split'](','),function(_0x30d0a3){return parseInt(_0x30d0a3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x11ab('0x51')],'get':function(){return this[_0x11ab('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x11ab('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![],'set':function(_0x5d6995){if(typeof _0x5d6995==='string'){var _0x109e4c=_0x5d6995==='1'?!![]:_0x5d6995==='0'?![]:_0x5d6995===_0x11ab('0x52')?!![]:_0x5d6995===_0x11ab('0x53')?![]:![];this[_0x11ab('0x3')]('screenrecording',_0x109e4c);}else{this['setDataValue'](_0x11ab('0x54'),_0x5d6995);}}},'blocked':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![],'set':function(_0x596789){this[_0x11ab('0x3')]('blocked',_0x596789);if(_0x596789===!![]){this[_0x11ab('0x3')](_0x11ab('0x55'),moment());this[_0x11ab('0x3')](_0x11ab('0x56'),0x0);}else{this[_0x11ab('0x3')](_0x11ab('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x11ab('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a076ad2..f82e561 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 _0xc012=['getWhatsappInteractions','mobile','intrf','user:%s','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','logout','pause','updateAttributes','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','mail','fax','sms','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','removeTeams','online','getDataValue','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notIn','$notLike','$notILike','$like','$contains','$contained','$any','lastName','phone','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','role','admin','Users','user','agent','Telephones','telephone','value','includes','name','UserProfileResource','sendStatus','send','index','map','rawAttributes','fieldName','key','model','differenceBy','password','salt','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','sequelize','lower','col','filter','options','User','findAll','rows','params','includeAll','include','find','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','104','105','106','107','108','100','create','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','Agents','isEmpty','compact','changePassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','VoiceQueue','voice','format','SIP/%s','each','removeQueues','Unknown\x20channel','remove','emit','Queue:remove','UserVoiceQueueRt','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','getContacts','CmContact','order','CmList','List','Tag','color','tag','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','UserId','VoiceRecording','getScreenRecordings','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc012,0x97));var _0x2c01=function(_0x549e70,_0x8a5460){_0x549e70=_0x549e70-0x0;var _0x9a9d8c=_0xc012[_0x549e70];return _0x9a9d8c;};'use strict';var pdf=require(_0x2c01('0x0'));var emlformat=require(_0x2c01('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2c01('0x2'));var jsonpatch=require(_0x2c01('0x3'));var rp=require(_0x2c01('0x4'));var moment=require('moment');var BPromise=require(_0x2c01('0x5'));var Mustache=require(_0x2c01('0x6'));var util=require(_0x2c01('0x7'));var path=require(_0x2c01('0x8'));var sox=require(_0x2c01('0x9'));var csv=require(_0x2c01('0xa'));var ejs=require(_0x2c01('0xb'));var fs=require('fs');var _=require(_0x2c01('0xc'));var squel=require(_0x2c01('0xd'));var crypto=require(_0x2c01('0xe'));var jsforce=require(_0x2c01('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c01('0x10'));var Papa=require(_0x2c01('0x11'));var Redis=require(_0x2c01('0x12'));var authService=require(_0x2c01('0x13'));var qs=require(_0x2c01('0x14'));var as=require(_0x2c01('0x15'));var hardwareService=require(_0x2c01('0x16'));var logger=require(_0x2c01('0x17'))(_0x2c01('0x18'));var utils=require(_0x2c01('0x19'));var config=require(_0x2c01('0x1a'));var licenseUtil=require(_0x2c01('0x1b'));var db=require(_0x2c01('0x1c'))['db'];config[_0x2c01('0x1d')]=_[_0x2c01('0x1e')](config[_0x2c01('0x1d')],{'host':_0x2c01('0x1f'),'port':0x18eb});var socket=require(_0x2c01('0x20'))(new Redis(config[_0x2c01('0x1d')]));require(_0x2c01('0x21'))[_0x2c01('0x22')](socket);var jayson=require(_0x2c01('0x23'));var client=jayson[_0x2c01('0x24')][_0x2c01('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x4c1c6a,_0x27a079,_0x458ff9,_0x47494b){return new BPromise(function(_0x2ef888,_0xbc37de){var _0x36b23a=_0x47494b||client;return _0x36b23a[_0x2c01('0x26')](_0x4c1c6a,_0x458ff9)[_0x2c01('0x27')](function(_0x18fb32){logger[_0x2c01('0x28')](_0x2c01('0x29'),_0x27a079,_0x2c01('0x2a'));logger['debug'](_0x2c01('0x2b'),_0x27a079,_0x2c01('0x2a'),JSON['stringify'](_0x18fb32));if(_0x18fb32[_0x2c01('0x2c')]){if(_0x18fb32[_0x2c01('0x2c')]['code']===0x1f4){logger[_0x2c01('0x2c')](_0x2c01('0x29'),_0x27a079,_0x18fb32['error'][_0x2c01('0x2d')]);return _0xbc37de(_0x18fb32[_0x2c01('0x2c')][_0x2c01('0x2d')]);}logger['error']('User,\x20%s,\x20%s',_0x27a079,_0x18fb32[_0x2c01('0x2c')]['message']);return _0x2ef888(_0x18fb32[_0x2c01('0x2c')]['message']);}else{logger[_0x2c01('0x28')]('User,\x20%s,\x20%s',_0x27a079,_0x2c01('0x2a'));_0x2ef888(_0x18fb32[_0x2c01('0x2e')][_0x2c01('0x2d')]);}})[_0x2c01('0x2f')](function(_0x19df7e){logger['error'](_0x2c01('0x29'),_0x27a079,_0x19df7e);_0xbc37de(_0x19df7e);});});}function respondWithStatusCode(_0x546220,_0x508654){_0x508654=_0x508654||0xcc;return function(_0x5b991b){if(_0x5b991b){return _0x546220['sendStatus'](_0x508654);}return _0x546220['status'](_0x508654)[_0x2c01('0x30')]();};}function respondWithResult(_0x460636,_0x11b61a){_0x11b61a=_0x11b61a||0xc8;return function(_0x1051a2){if(_0x1051a2){return _0x460636[_0x2c01('0x31')](_0x11b61a)['json'](_0x1051a2);}};}function respondWithFilteredResult(_0x22ff38,_0x6a5f63){return function(_0x27b41b){if(_0x27b41b){var _0x3d842c=_0x27b41b[_0x2c01('0x32')],_0x3e0075=_0x6a5f63[_0x2c01('0x33')],_0x4409b2=_0x6a5f63[_0x2c01('0x33')]+_0x6a5f63[_0x2c01('0x34')],_0x5bc97f;if(_0x4409b2>=_0x3d842c){_0x4409b2=_0x3d842c;_0x5bc97f=0xc8;}else{_0x5bc97f=0xce;}_0x22ff38[_0x2c01('0x31')](_0x5bc97f);return _0x22ff38[_0x2c01('0x35')](_0x2c01('0x36'),_0x3e0075+'-'+_0x4409b2+'/'+_0x3d842c)[_0x2c01('0x37')](_0x27b41b);}return null;};}function patchUpdates(_0x17822c){return function(_0x33eaef){try{jsonpatch[_0x2c01('0x38')](_0x33eaef,_0x17822c,!![]);}catch(_0x32450f){return BPromise[_0x2c01('0x39')](_0x32450f);}return _0x33eaef[_0x2c01('0x3a')]();};}function saveUpdates(_0x1d5056,_0x23f66a){return function(_0x42999a){if(_0x42999a){return _0x42999a[_0x2c01('0x3b')](_0x1d5056)[_0x2c01('0x27')](function(_0x10ad6c){return _0x10ad6c;});}return null;};}function removeEntity(_0x450083,_0x101b6f){return function(_0x22f184){if(_0x22f184){return _0x22f184[_0x2c01('0x3c')]()[_0x2c01('0x27')](function(){var _0x342b47=_0x22f184[_0x2c01('0x3d')]({'plain':!![]});if(_0x342b47[_0x2c01('0x3e')]===_0x2c01('0x3f'))return;var _0x2c545b=[{'name':_0x2c01('0x40'),'value':_0x2c01('0x41'),'ignore':!![]},{'name':'Agents','value':_0x2c01('0x42'),'ignore':![]},{'name':_0x2c01('0x43'),'value':_0x2c01('0x44'),'ignore':![]}];var _0x5859a1=_(_0x2c545b)['filter']('ignore')['map'](_0x2c01('0x45'))[_0x2c01('0x45')]();if(_[_0x2c01('0x46')](_0x5859a1,_0x342b47[_0x2c01('0x3e')])){return;}var _0xcaa774=_['find'](_0x2c545b,[_0x2c01('0x45'),_0x342b47[_0x2c01('0x3e')]])[_0x2c01('0x47')];return db[_0x2c01('0x48')][_0x2c01('0x3c')]({'where':{'type':_0xcaa774,'resourceId':_0x342b47['id']}})[_0x2c01('0x27')](function(){return _0x22f184;});})[_0x2c01('0x27')](function(){_0x450083[_0x2c01('0x31')](0xcc)[_0x2c01('0x30')]();});}};}function handleEntityNotFound(_0x118578,_0x499c2b){return function(_0x23a7b0){if(!_0x23a7b0){_0x118578[_0x2c01('0x49')](0x194);}return _0x23a7b0;};}function handleError(_0x25e6c8,_0x2a36d0){_0x2a36d0=_0x2a36d0||0x1f4;return function(_0xad372b){logger['error'](_0xad372b['stack']);if(_0xad372b['name']){delete _0xad372b[_0x2c01('0x47')];}_0x25e6c8[_0x2c01('0x31')](_0x2a36d0)[_0x2c01('0x4a')](_0xad372b);};}exports[_0x2c01('0x4b')]=function(_0x5d6158,_0x26cd28){var _0x507aa2={},_0x37aa52={},_0x438de0={'count':0x0,'rows':[]};var _0x7ec4af=_[_0x2c01('0x4c')](db['User'][_0x2c01('0x4d')],function(_0x158805){return{'name':_0x158805[_0x2c01('0x4e')],'type':_0x158805['type'][_0x2c01('0x4f')]};});_0x37aa52[_0x2c01('0x50')]=_[_0x2c01('0x51')](_['map'](_0x7ec4af,_0x2c01('0x47')),[_0x2c01('0x52'),_0x2c01('0x53')]);_0x37aa52['query']=_[_0x2c01('0x54')](_0x5d6158[_0x2c01('0x55')]);_0x37aa52['filters']=_['intersection'](_0x37aa52['model'],_0x37aa52[_0x2c01('0x55')]);_0x507aa2[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x37aa52[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x5d6158['query']['fields']));_0x507aa2[_0x2c01('0x56')]=_0x507aa2[_0x2c01('0x56')][_0x2c01('0x59')]?_0x507aa2[_0x2c01('0x56')]:_0x37aa52[_0x2c01('0x50')];if(!_0x5d6158[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0x507aa2[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x34')]);_0x507aa2['offset']=qs[_0x2c01('0x33')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x33')]);}_0x507aa2['order']=qs[_0x2c01('0x5c')](_0x5d6158[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x507aa2[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x5d6158['query'],_0x37aa52[_0x2c01('0x5e')]),_0x7ec4af);if(_0x5d6158['query']['filter']){_0x507aa2['where']=_[_0x2c01('0x60')](_0x507aa2[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x7ec4af,function(_0x293478){if(_0x293478[_0x2c01('0x61')]!==_0x2c01('0x62')){return db[_0x2c01('0x63')]['where'](db[_0x2c01('0x63')]['fn'](_0x2c01('0x64'),db[_0x2c01('0x63')][_0x2c01('0x65')](_0x293478[_0x2c01('0x47')])),{'$like':db[_0x2c01('0x63')]['fn'](_0x2c01('0x64'),'%'+_0x5d6158[_0x2c01('0x55')][_0x2c01('0x66')]+'%')});}})});}_0x507aa2=_[_0x2c01('0x60')]({},_0x507aa2,_0x5d6158[_0x2c01('0x67')]);var _0x181326={'where':_0x507aa2[_0x2c01('0x5d')]};return db[_0x2c01('0x68')]['count'](_0x181326)[_0x2c01('0x27')](function(_0x44d668){_0x438de0[_0x2c01('0x32')]=_0x44d668;if(_0x5d6158[_0x2c01('0x55')]['includeAll']){_0x507aa2['include']=[{'all':!![]}];}return db[_0x2c01('0x68')][_0x2c01('0x69')](_0x507aa2);})['then'](function(_0xf265fa){_0x438de0[_0x2c01('0x6a')]=_0xf265fa;return _0x438de0;})[_0x2c01('0x27')](respondWithFilteredResult(_0x26cd28,_0x507aa2))[_0x2c01('0x2f')](handleError(_0x26cd28,null));};exports['show']=function(_0x129a16,_0x28a253){var _0x480458={'raw':![],'where':{'id':_0x129a16[_0x2c01('0x6b')]['id']}},_0x22ab20={};_0x22ab20['model']=_[_0x2c01('0x51')](_[_0x2c01('0x54')](db[_0x2c01('0x68')][_0x2c01('0x4d')]),[_0x2c01('0x52'),'salt']);_0x22ab20['query']=_[_0x2c01('0x54')](_0x129a16['query']);_0x22ab20['filters']=_[_0x2c01('0x57')](_0x22ab20[_0x2c01('0x50')],_0x22ab20[_0x2c01('0x55')]);_0x480458[_0x2c01('0x56')]=_['intersection'](_0x22ab20[_0x2c01('0x50')],qs['fields'](_0x129a16[_0x2c01('0x55')][_0x2c01('0x58')]));_0x480458[_0x2c01('0x56')]=_0x480458[_0x2c01('0x56')][_0x2c01('0x59')]?_0x480458[_0x2c01('0x56')]:_0x22ab20[_0x2c01('0x50')];if(_0x129a16[_0x2c01('0x55')][_0x2c01('0x6c')]){_0x480458[_0x2c01('0x6d')]=[{'all':!![]}];}_0x480458=_[_0x2c01('0x60')]({},_0x480458,_0x129a16[_0x2c01('0x67')]);return db['User'][_0x2c01('0x6e')](_0x480458)[_0x2c01('0x27')](handleEntityNotFound(_0x28a253,null))[_0x2c01('0x27')](respondWithResult(_0x28a253,null))['catch'](handleError(_0x28a253,null));};exports['update']=function(_0xcfec96,_0x869b08){if(_0xcfec96[_0x2c01('0x6f')]['id']){delete _0xcfec96['body']['id'];}delete _0xcfec96[_0x2c01('0x6f')][_0x2c01('0x3e')];return db['User'][_0x2c01('0x6e')]({'where':{'id':_0xcfec96[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x869b08,null))['then'](saveUpdates(_0xcfec96[_0x2c01('0x6f')],null))['then'](respondWithResult(_0x869b08,null))[_0x2c01('0x2f')](handleError(_0x869b08,null));};exports[_0x2c01('0x70')]=function(_0x42dd34,_0x270090){return db[_0x2c01('0x68')]['describe']()[_0x2c01('0x27')](respondWithResult(_0x270090,null))[_0x2c01('0x2f')](handleError(_0x270090,null));};exports[_0x2c01('0x71')]=function(_0x40cf5b,_0x8f8945,_0x4cbeeb){return db[_0x2c01('0x68')]['find']({'where':{'id':_0x40cf5b[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x8f8945,null))[_0x2c01('0x27')](function(_0x41169a){if(_0x41169a){return _0x41169a[_0x2c01('0x71')](_0x40cf5b[_0x2c01('0x6f')][_0x2c01('0x72')],_[_0x2c01('0x73')](_0x40cf5b[_0x2c01('0x6f')],[_0x2c01('0x72'),'id'])||{});}})[_0x2c01('0x27')](respondWithResult(_0x8f8945,null))[_0x2c01('0x2f')](handleError(_0x8f8945,null));};function validateUser(_0x2212f9){return new BPromise(function(_0x1aec00,_0x2990f5){if(_0x2212f9[_0x2c01('0x74')])return _0x1aec00(_0x2212f9);return db[_0x2c01('0x75')][_0x2c01('0x76')](0x1)[_0x2c01('0x27')](function(_0x17bfb5){if(_0x17bfb5[_0x2c01('0x77')])authService[_0x2c01('0x78')](_0x2212f9['password']);db[_0x2c01('0x68')]['max'](_0x2c01('0x74'))['then'](function(_0x4e868c){if(_['isNil'](_0x4e868c)){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')]||0x1;return;}if(_[_0x2c01('0x7a')](_0x17bfb5['min_internal'])||_0x17bfb5[_0x2c01('0x79')]===_0x4e868c){_0x2212f9[_0x2c01('0x74')]=_0x4e868c+0x1;return;}if(_0x17bfb5[_0x2c01('0x79')]>_0x4e868c){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')];return;}return db[_0x2c01('0x63')][_0x2c01('0x55')](_0x2c01('0x7b'),{'type':db[_0x2c01('0x63')]['QueryTypes'][_0x2c01('0x7c')]})['then'](function(_0x165f91){if(_0x165f91&&_0x165f91[_0x2c01('0x59')]){for(var _0x3404aa=0x0,_0x4bd3a8=_0x165f91['length'];_0x3404aa<_0x4bd3a8&&_[_0x2c01('0x7a')](_0x2212f9[_0x2c01('0x74')]);_0x3404aa++){if(_0x17bfb5[_0x2c01('0x79')]<=_0x165f91[_0x3404aa]['from']){_0x2212f9['internal']=_0x165f91[_0x3404aa][_0x2c01('0x7d')];}else if(_0x17bfb5[_0x2c01('0x79')]>_0x165f91[_0x3404aa]['from']&&_0x17bfb5[_0x2c01('0x79')]<=_0x165f91[_0x3404aa]['to']){_0x2212f9[_0x2c01('0x74')]=_0x17bfb5[_0x2c01('0x79')];}}}if(_['isNil'](_0x2212f9[_0x2c01('0x74')])){_0x2212f9[_0x2c01('0x74')]=_0x4e868c+0x1;}return _0x1aec00(_0x2212f9);});});})[_0x2c01('0x2f')](function(_0x4b062f){_0x2990f5(_0x4b062f);});});}function updateUser(_0x524699){return new BPromise(function(_0x5df913,_0x25c9fb){try{if(_0x524699['voicemail']){_0x524699[_0x2c01('0x7e')]=_0x524699['internal'];_0x524699[_0x2c01('0x7f')]={'mailbox':_0x524699[_0x2c01('0x74')],'password':_0x524699['password'],'fullname':_0x524699[_0x2c01('0x80')],'email':_0x524699['email']};}if(_0x524699[_0x2c01('0x3e')]===_0x2c01('0x42')){if(!_0x524699[_0x2c01('0x81')])_0x524699[_0x2c01('0x81')]=[_0x2c01('0x82'),_0x2c01('0x83'),_0x2c01('0x84'),_0x2c01('0x85'),_0x2c01('0x86'),_0x2c01('0x87'),_0x2c01('0x88'),_0x2c01('0x89'),_0x2c01('0x8a'),_0x2c01('0x8b'),'109',_0x2c01('0x8c'),'111','114'];}_0x5df913(_0x524699);}catch(_0xda0664){_0x25c9fb(_0xda0664);}});}exports[_0x2c01('0x8d')]=function(_0x267b98,_0x3348d8){if(_0x267b98[_0x2c01('0x41')]['role']===_0x2c01('0x42'))throw new Error(_0x2c01('0x8e'));if(_0x267b98[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user'&&_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x3f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x267b98['body'][_0x2c01('0x3e')]===_0x2c01('0x3f')&&_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x3f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2c01('0x8f')]([_0x267b98[_0x2c01('0x6f')]])['then'](function(){return validateUser(_0x267b98['body']);})[_0x2c01('0x27')](function(_0xf51005){return updateUser(_0xf51005)[_0x2c01('0x27')](function(_0x57614a){if(_0x57614a[_0x2c01('0x3e')]===_0x2c01('0x3f')){_0x57614a[_0x2c01('0x90')]=_0x267b98[_0x2c01('0x41')][_0x2c01('0x90')];delete _0x57614a[_0x2c01('0x91')];}return _0x57614a;});})[_0x2c01('0x27')](function(_0x24f0cf){return db[_0x2c01('0x68')][_0x2c01('0x8d')](_0x24f0cf,{'include':[{'model':db[_0x2c01('0x7f')],'as':_0x2c01('0x7f')}]});})['then'](function(_0x32eee9){if(_0x267b98[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user')return _0x32eee9;if(_0x267b98[_0x2c01('0x41')][_0x2c01('0x3e')]!==_0x2c01('0x41'))return _0x32eee9;return db[_0x2c01('0x92')][_0x2c01('0x6e')]({'where':{'name':_0x32eee9[_0x2c01('0x3e')]==='agent'?'Agents':_0x2c01('0x43'),'userProfileId':_0x267b98[_0x2c01('0x41')][_0x2c01('0x91')]},'raw':!![]})[_0x2c01('0x27')](function(_0xe99331){if(!_0xe99331||_0xe99331[_0x2c01('0x93')]!=0x0)return _0x32eee9;return db[_0x2c01('0x48')][_0x2c01('0x8d')]({'name':_0x32eee9['name'],'resourceId':_0x32eee9['id'],'type':_0xe99331[_0x2c01('0x47')],'sectionId':_0xe99331['id']},{})[_0x2c01('0x27')](function(){return _0x32eee9;});})[_0x2c01('0x2f')](function(_0x296531){logger[_0x2c01('0x2c')](_0x2c01('0x94'),_0x296531);throw _0x296531;});})[_0x2c01('0x27')](respondWithResult(_0x3348d8,0xc9))[_0x2c01('0x2f')](handleError(_0x3348d8,null));};exports['bulkCreate']=function(_0x7731cb,_0xcb8d49){var _0x1d033c=_0x7731cb[_0x2c01('0x6f')];var _0x1fe9a5=[];if(_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]===_0x2c01('0x42'))throw new Error(_0x2c01('0x8e'));if(_[_0x2c01('0x95')](_0x1d033c,['role',_0x2c01('0x41')])&&_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='admin'){throw new Error(_0x2c01('0x96'));}if(_[_0x2c01('0x95')](_0x1d033c,[_0x2c01('0x3e'),_0x2c01('0x3f')])&&_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='admin'){throw new Error(_0x2c01('0x97'));}return licenseUtil[_0x2c01('0x8f')](_0x1d033c)['then'](function(){return validateUser(_0x1d033c[0x0]);})[_0x2c01('0x27')](function(){for(var _0x47352f=0x1;_0x47352f<_0x1d033c['length'];_0x47352f++){var _0x8dac47=_0x1d033c[_0x47352f-0x1]['internal'];if(!_0x1d033c[_0x47352f][_0x2c01('0x74')])_0x1d033c[_0x47352f][_0x2c01('0x74')]=_0x8dac47+0x1;_0x1fe9a5[_0x2c01('0x98')](validateUser(_0x1d033c[_0x47352f]));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](function(){_0x1fe9a5=[];for(var _0x357993=0x0;_0x357993<_0x1d033c[_0x2c01('0x59')];_0x357993++){_0x1fe9a5[_0x2c01('0x98')](updateUser(_0x1d033c[_0x357993]));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](function(){return BPromise['each'](_0x1d033c,function(_0x4cfe4f){return db['User'][_0x2c01('0x8d')](_0x4cfe4f,{'include':[{'model':db['VoiceMail'],'as':_0x2c01('0x7f')}]})[_0x2c01('0x27')](function(_0x7ce75d){_0x4cfe4f['id']=_0x7ce75d['id'];return _0x4cfe4f;});});})['then'](function(_0x4d03b8){if(_0x7731cb[_0x2c01('0x6f')][_0x2c01('0x3e')]==='user')return _0x4d03b8;if(_0x7731cb[_0x2c01('0x41')][_0x2c01('0x3e')]!=='user')return _0x4d03b8;var _0x47aa39=_[_0x2c01('0x95')](_0x4d03b8,function(_0x34b8e9){return _0x34b8e9[_0x2c01('0x3e')]===_0x2c01('0x42')||_0x34b8e9[_0x2c01('0x3e')]===_0x2c01('0x44');});if(!_0x47aa39)return _0x4d03b8;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x2c01('0x9a'),'Telephones']},'userProfileId':_0x7731cb[_0x2c01('0x41')][_0x2c01('0x91')]},'raw':!![]})[_0x2c01('0x27')](function(_0x3ffa03){if(_[_0x2c01('0x9b')](_0x3ffa03)||!_[_0x2c01('0x95')](_0x3ffa03,[_0x2c01('0x93'),0x0]))return _0x4d03b8;_0x1fe9a5=[];var _0x3b07b1=_(_0x3ffa03)[_0x2c01('0x4c')](function(_0x2cf1bb){if(_0x2cf1bb['autoAssociation']===0x1)return;return _0x2cf1bb[_0x2c01('0x47')]===_0x2c01('0x9a')?_0x2c01('0x42'):_0x2c01('0x44');})[_0x2c01('0x9c')]()['value']();for(var _0x2d6088=0x0;_0x2d6088<_0x4d03b8[_0x2c01('0x59')];_0x2d6088++){if(!_[_0x2c01('0x46')](_0x3b07b1,_0x4d03b8[_0x2d6088][_0x2c01('0x3e')]))return;var _0x1bcc4d=_0x4d03b8[_0x2d6088][_0x2c01('0x3e')]===_0x2c01('0x42')?_0x2c01('0x9a'):_0x2c01('0x43');_0x1fe9a5[_0x2c01('0x98')](db[_0x2c01('0x48')]['create']({'name':_0x4d03b8[_0x2d6088][_0x2c01('0x47')],'resourceId':_0x4d03b8[_0x2d6088]['id'],'type':_0x1bcc4d,'sectionId':_[_0x2c01('0x6e')](_0x3ffa03,[_0x2c01('0x47'),_0x1bcc4d])['id']},{}));}return BPromise[_0x2c01('0x99')](_0x1fe9a5);})[_0x2c01('0x27')](respondWithResult(_0xcb8d49,0xc9))[_0x2c01('0x2f')](handleError(_0xcb8d49,null));});};exports[_0x2c01('0x9d')]=function(_0x1c6c3c,_0x10928a,_0x244f73){if(_0x1c6c3c[_0x2c01('0x6f')]['id']){delete _0x1c6c3c[_0x2c01('0x6f')]['id'];}return db[_0x2c01('0x68')]['find']({'where':{'id':_0x1c6c3c[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](function(_0x36df75){if(!_0x36df75)return null;if(_0x36df75['id']===_0x1c6c3c[_0x2c01('0x41')]['id']){if(!_0x1c6c3c[_0x2c01('0x6f')]['oldPassword']||!_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xa0'));}if(!_0x36df75['authenticate'](_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0xa1')])){throw new db['Sequelize'][(_0x2c01('0xa2'))]('Wrong\x20credentials');}if(_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0xa1')]===_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xa3'));}}else if(_0x1c6c3c[_0x2c01('0x41')][_0x2c01('0x3e')]===_0x2c01('0x3f')){if(!_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1c6c3c[_0x2c01('0x41')]['role']===_0x2c01('0x41')){if(!_0x1c6c3c['body'][_0x2c01('0x9e')]){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x36df75[_0x2c01('0x3e')]!=='agent'){throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0x8e'));}}else{throw new db['Sequelize'][(_0x2c01('0xa2'))](_0x2c01('0x8e'));}return _0x36df75;})[_0x2c01('0x27')](handleEntityNotFound(_0x10928a,null))[_0x2c01('0x27')](function(_0x317ada){return db['Setting'][_0x2c01('0xa4')]({'attributes':['id',_0x2c01('0x77'),_0x2c01('0xa5'),'passwordHistoryLimit']})[_0x2c01('0x27')](function(_0x447e9f){if(_0x447e9f[_0x2c01('0x77')])authService[_0x2c01('0x78')](_0x1c6c3c[_0x2c01('0x6f')]['newPassword']);if(!_0x447e9f[_0x2c01('0xa5')]||!_0x317ada[_0x2c01('0xa6')])return _0x317ada;authService[_0x2c01('0xa7')](_0x1c6c3c['body'][_0x2c01('0x9e')],_0x317ada[_0x2c01('0xa6')],_0x447e9f['passwordHistoryLimit']);return _0x317ada;})[_0x2c01('0x27')](saveUpdates({'password':_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')],'passwordResetAt':_0x1c6c3c['user']['id']==_0x1c6c3c[_0x2c01('0x6b')]['id']?moment():null,'previousPasswords':authService[_0x2c01('0xa8')](_0x1c6c3c[_0x2c01('0x6f')][_0x2c01('0x9e')],_0x317ada[_0x2c01('0xa6')])},null));})[_0x2c01('0x27')](respondWithResult(_0x10928a,null))[_0x2c01('0x2f')](handleError(_0x10928a,null));};exports[_0x2c01('0xa9')]=function(_0x5dab81,_0x183a0a,_0x3a8f31){var _0x3e39c2=_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xaa')];return db['User']['find']({'where':{'id':_0x5dab81[_0x2c01('0x6b')]['id']},'attributes':['id',_0x2c01('0x47'),'role','online',_0x2c01('0xab'),_0x2c01('0xac'),_0x2c01('0xad')]})['then'](handleEntityNotFound(_0x183a0a,null))[_0x2c01('0x27')](function(_0x3467ec){if(_0x3467ec){if(!utils[_0x2c01('0xae')](_0x3e39c2)){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))]('Unknown\x20channel');}return _0x3467ec[_0x2c01('0xaf')+_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb2')](_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')],{'penalty':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xb3')]||0x0})[_0x2c01('0xb4')](function(_0x3de5b4){for(var _0x3479e8=0x0;_0x3479e8<_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')]['length'];_0x3479e8+=0x1){var _0x201998={'UserId':_0x5dab81[_0x2c01('0x6b')]['id']};_0x201998[_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb5')]=_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')][_0x3479e8];socket['emit'](_0x2c01('0x41')+_[_0x2c01('0xb0')](_0x3e39c2[_0x2c01('0xb1')]())+_0x2c01('0xb6'),_0x201998);}return _0x3de5b4;})['then'](function(){if(_0x3e39c2==='voice'){return db[_0x2c01('0xb7')][_0x2c01('0x69')]({'where':{'id':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0x72')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2c01('0x27')](function(_0x2be48a){var _0x2229d9=_0x3467ec[_0x2c01('0x3d')]({'plain':!![]});var _0x23f872=[];if(_0x3e39c2===_0x2c01('0xb8')&&_0x2229d9[_0x2c01('0x3e')]===_0x2c01('0x42')&&_0x2229d9['online']){for(var _0x19d6c9=0x0;_0x19d6c9<_0x2be48a['length'];_0x19d6c9+=0x1){_0x23f872[_0x2c01('0x98')]({'membername':_0x2229d9['name'],'UserId':_0x2229d9['id'],'queue_name':_0x2be48a[_0x19d6c9][_0x2c01('0x47')],'VoiceQueueId':_0x2be48a[_0x19d6c9]['id'],'interface':_[_0x2c01('0x7a')](_0x2229d9['interface'])?util[_0x2c01('0xb9')](_0x2c01('0xba'),_0x2229d9['name']):_0x2229d9[_0x2c01('0xad')],'paused':_0x2229d9['voicePause']||![],'penalty':_0x5dab81[_0x2c01('0x6f')][_0x2c01('0xb3')]||0x0});}return BPromise[_0x2c01('0xbb')](_0x23f872,function(_0x5f235d){return db['UserVoiceQueueRt']['upsert'](_0x5f235d);});}return _0x3467ec;});}})[_0x2c01('0x27')](respondWithStatusCode(_0x183a0a,null))[_0x2c01('0x2f')](handleError(_0x183a0a,null));};exports[_0x2c01('0xbc')]=function(_0x37e561,_0x449917,_0xe17e81){var _0x4b4197;return db[_0x2c01('0x68')]['find']({'where':{'id':_0x37e561[_0x2c01('0x6b')]['id']},'attributes':['id',_0x2c01('0x47'),'role']})[_0x2c01('0x27')](handleEntityNotFound(_0x449917,null))[_0x2c01('0x27')](function(_0x444573){if(_0x444573){_0x4b4197=_0x444573;if(!_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]||!utils['isValidChannel'](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')])){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))](_0x2c01('0xbd'));}return _0x444573[_0x2c01('0xbe')+_[_0x2c01('0xb0')](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]['toLowerCase']())+_0x2c01('0xb2')](_0x37e561[_0x2c01('0x55')][_0x2c01('0x72')]);}})[_0x2c01('0x27')](function(_0x3cc30b){for(var _0x5d5d33=0x0;_0x5d5d33<_0x37e561['query'][_0x2c01('0x72')][_0x2c01('0x59')];_0x5d5d33+=0x1){var _0x374137={'UserId':_0x37e561[_0x2c01('0x6b')]['id']};_0x374137[_['capitalize'](_0x37e561[_0x2c01('0x55')]['channel'][_0x2c01('0xb1')]())+_0x2c01('0xb5')]=_0x37e561['query'][_0x2c01('0x72')][_0x5d5d33];socket[_0x2c01('0xbf')](_0x2c01('0x41')+_[_0x2c01('0xb0')](_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')][_0x2c01('0xb1')]())+_0x2c01('0xc0'),_0x374137);}return _0x3cc30b;})[_0x2c01('0x27')](function(){if(_0x37e561[_0x2c01('0x55')][_0x2c01('0xaa')]==='voice'){return db[_0x2c01('0xc1')]['destroy']({'where':{'UserId':_0x37e561['params']['id'],'VoiceQueueId':_0x37e561[_0x2c01('0x55')][_0x2c01('0x72')]},'individualHooks':!![]})[_0x2c01('0x27')](function(){return _0x4b4197;});}return _0x4b4197;})[_0x2c01('0x27')](respondWithStatusCode(_0x449917,null))[_0x2c01('0x2f')](handleError(_0x449917,null));};exports['addAvatar']=function(_0x1e1e4d,_0x433f1f,_0x23be7f){_0x1e1e4d[_0x2c01('0x6f')][_0x2c01('0xc2')]=_0x1e1e4d[_0x2c01('0xc3')][_0x2c01('0xc4')];return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x1e1e4d[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x433f1f,null))[_0x2c01('0x27')](saveUpdates(_0x1e1e4d[_0x2c01('0x6f')],null))[_0x2c01('0x27')](respondWithResult(_0x433f1f,null))[_0x2c01('0x2f')](handleError(_0x433f1f,null));};exports[_0x2c01('0xc5')]=function(_0x37b0fb,_0x1a1adb,_0x1930e8){var _0x1fe79c=path[_0x2c01('0xc6')](config['root'],_0x2c01('0xc7'));return db[_0x2c01('0x68')]['find']({'where':{'id':_0x37b0fb[_0x2c01('0x6b')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x2c01('0x27')](handleEntityNotFound(_0x1a1adb,null))['then'](function(_0x1c8cce){if(_0x1c8cce){if(_[_0x2c01('0x7a')](_0x1c8cce[_0x2c01('0xc2')])){return _0x1a1adb['download'](_0x1fe79c);}else{if(!fs[_0x2c01('0xc8')](path[_0x2c01('0xc6')](config[_0x2c01('0xc9')],_0x2c01('0xca'),_0x1c8cce[_0x2c01('0xc2')]))){return _0x1a1adb[_0x2c01('0xcb')](_0x1fe79c);}return _0x1a1adb[_0x2c01('0xcb')](path[_0x2c01('0xc6')](config[_0x2c01('0xc9')],_0x2c01('0xca'),_0x1c8cce['userpic']));}}})[_0x2c01('0x2f')](handleError(_0x1a1adb,null));};exports[_0x2c01('0xcc')]=function(_0x524173,_0xf2106e,_0x43c7a9){var _0x1a9334={};var _0x5e95c9={};var _0x49f924;var _0x54adcd;return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x524173[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0xf2106e,null))[_0x2c01('0x27')](function(_0x248a6a){if(_0x248a6a){_0x49f924=_0x248a6a;_0x5e95c9[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0xcd')][_0x2c01('0x4d')]);_0x5e95c9['query']=_[_0x2c01('0x54')](_0x524173[_0x2c01('0x55')]);_0x5e95c9[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x5e95c9[_0x2c01('0x50')],_0x5e95c9[_0x2c01('0x55')]);_0x1a9334[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x5e95c9[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x524173[_0x2c01('0x55')][_0x2c01('0x58')]));_0x1a9334[_0x2c01('0x56')]=_0x1a9334['attributes'][_0x2c01('0x59')]?_0x1a9334[_0x2c01('0x56')]:_0x5e95c9[_0x2c01('0x50')];_0x1a9334[_0x2c01('0xce')]=qs['sort'](_0x524173[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x1a9334['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x524173[_0x2c01('0x55')],_0x5e95c9[_0x2c01('0x5e')]));if(_0x524173[_0x2c01('0x55')]['filter']){_0x1a9334[_0x2c01('0x5d')]=_['merge'](_0x1a9334[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x1a9334[_0x2c01('0x56')],function(_0x4941ec){var _0x2f49c0={};_0x2f49c0[_0x4941ec]={'$like':'%'+_0x524173[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x2f49c0;})});}_0x1a9334=_['merge']({},_0x1a9334,_0x524173[_0x2c01('0x67')]);return _0x49f924[_0x2c01('0xcc')](_0x1a9334);}})[_0x2c01('0x27')](function(_0x4c76f5){if(_0x4c76f5){_0x54adcd=_0x4c76f5['length'];if(_0x524173[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x6c'))){_0x1a9334[_0x2c01('0x6d')]=[{'model':db[_0x2c01('0xcf')],'as':_0x2c01('0xd0'),'required':![]},{'model':db[_0x2c01('0xd1')],'as':'Tags','attributes':['id',_0x2c01('0x47'),_0x2c01('0xd2')],'where':_0x524173[_0x2c01('0x55')][_0x2c01('0xd3')]?{'id':_0x524173[_0x2c01('0x55')][_0x2c01('0xd3')]}:undefined,'required':_0x524173['query'][_0x2c01('0xd3')]?!![]:![]}];}if(!_0x524173[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x1a9334[_0x2c01('0x34')]=qs['limit'](_0x524173[_0x2c01('0x55')]['limit']);_0x1a9334[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x524173[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x49f924[_0x2c01('0xcc')](_0x1a9334);}})[_0x2c01('0x27')](function(_0x7d8783){if(_0x7d8783){return _0x7d8783?{'count':_0x54adcd,'rows':_0x7d8783}:null;}})['then'](respondWithResult(_0xf2106e,null))[_0x2c01('0x2f')](handleError(_0xf2106e,null));};exports[_0x2c01('0xd4')]=function(_0x34020f,_0x2bf59,_0x3ebafb){var _0x5d5b0f;var _0x5ca5d0;var _0x1a80bb={};var _0x462267;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x34020f[_0x2c01('0x6b')]['id']},'attributes':['id','name',_0x2c01('0x3e')]})[_0x2c01('0x27')](handleEntityNotFound(_0x2bf59,null))[_0x2c01('0x27')](function(_0x5663bb){if(!utils[_0x2c01('0xae')](_0x34020f['query'][_0x2c01('0xaa')])){throw new db[(_0x2c01('0x9f'))][(_0x2c01('0xa2'))](_0x2c01('0xbd'));}_0x5d5b0f=_0x5663bb;var _0xfd16f1={};_0xfd16f1['model']=_[_0x2c01('0x54')](db[_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xd5')][_0x2c01('0x4d')]);_0xfd16f1[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x34020f['query']);_0xfd16f1[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0xfd16f1[_0x2c01('0x50')],_0xfd16f1[_0x2c01('0x55')]);_0x1a80bb[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0xfd16f1['model'],qs[_0x2c01('0x58')](_0x34020f['query']['fields']));_0x1a80bb['attributes']=_0x1a80bb[_0x2c01('0x56')][_0x2c01('0x59')]?_0x1a80bb[_0x2c01('0x56')]:_0xfd16f1[_0x2c01('0x50')];_0x1a80bb[_0x2c01('0xce')]=qs['sort'](_0x34020f[_0x2c01('0x55')]['sort']);_0x1a80bb[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x34020f[_0x2c01('0x55')],_0xfd16f1[_0x2c01('0x5e')]));if(_0x34020f[_0x2c01('0x55')]['filter']){_0x1a80bb[_0x2c01('0x5d')]=_['merge'](_0x1a80bb['where'],{'$or':_[_0x2c01('0x4c')](_0x1a80bb[_0x2c01('0x56')],function(_0x20cbbf){var _0x5b751f={};_0x5b751f[_0x20cbbf]={'$like':'%'+_0x34020f[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x5b751f;})});}_0x1a80bb=_['merge']({},_0x1a80bb,_0x34020f['options']);switch(_0x5d5b0f[_0x2c01('0x3e')]){case _0x2c01('0x3f'):return db[_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xd5')]['findAll'](_0x1a80bb);case _0x2c01('0x41'):case _0x2c01('0x42'):return _0x5d5b0f[_0x2c01('0x3d')+_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xb2')](_0x1a80bb);default:throw new db[(_0x2c01('0x9f'))]['ValidationError']('Unknown\x20role');}})[_0x2c01('0x27')](function(_0x231947){_0x462267=_0x231947[_0x2c01('0x59')];if(!_0x34020f[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0x1a80bb[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x34020f[_0x2c01('0x55')][_0x2c01('0x34')]);_0x1a80bb[_0x2c01('0x33')]=qs['offset'](_0x34020f[_0x2c01('0x55')][_0x2c01('0x33')]);}switch(_0x5d5b0f[_0x2c01('0x3e')]){case _0x2c01('0x3f'):return db[_[_0x2c01('0xb0')](_0x34020f['query'][_0x2c01('0xaa')])+_0x2c01('0xd5')][_0x2c01('0x69')](_0x1a80bb);case _0x2c01('0x41'):case'agent':return _0x5d5b0f['get'+_[_0x2c01('0xb0')](_0x34020f[_0x2c01('0x55')][_0x2c01('0xaa')])+_0x2c01('0xb2')](_0x1a80bb);}})[_0x2c01('0x27')](function(_0x1ee115){return{'count':_0x462267,'rows':_0x1ee115};})['then'](respondWithResult(_0x2bf59,null))[_0x2c01('0x2f')](handleError(_0x2bf59,null));};exports[_0x2c01('0xd6')]=function(_0xbca968,_0x28d3a6,_0x6788ef){var _0x5d2daa={};var _0x4b08b8={};var _0xeab796;var _0x5a2daa;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xbca968[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x28d3a6,null))[_0x2c01('0x27')](function(_0x21c648){if(_0x21c648){_0xeab796=_0x21c648;_0x4b08b8['model']=_[_0x2c01('0x54')](db[_0x2c01('0xc1')][_0x2c01('0x4d')]);_0x4b08b8[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0xbca968[_0x2c01('0x55')]);_0x4b08b8['filters']=_[_0x2c01('0x57')](_0x4b08b8[_0x2c01('0x50')],_0x4b08b8[_0x2c01('0x55')]);_0x5d2daa[_0x2c01('0x56')]=_['intersection'](_0x4b08b8[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0xbca968[_0x2c01('0x55')][_0x2c01('0x58')]));_0x5d2daa[_0x2c01('0x56')]=_0x5d2daa[_0x2c01('0x56')][_0x2c01('0x59')]?_0x5d2daa['attributes']:_0x4b08b8[_0x2c01('0x50')];_0x5d2daa['order']=qs['sort'](_0xbca968[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x5d2daa[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0xbca968[_0x2c01('0x55')],_0x4b08b8['filters']));if(_0xbca968[_0x2c01('0x55')][_0x2c01('0x66')]){_0x5d2daa[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x5d2daa[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x5d2daa[_0x2c01('0x56')],function(_0x4570e3){var _0x3496d0={};_0x3496d0[_0x4570e3]={'$like':'%'+_0xbca968['query']['filter']+'%'};return _0x3496d0;})});}_0x5d2daa=_['merge']({},_0x5d2daa,_0xbca968[_0x2c01('0x67')]);return _0xeab796[_0x2c01('0xd6')](_0x5d2daa);}})['then'](function(_0x339af4){if(_0x339af4){_0x5a2daa=_0x339af4[_0x2c01('0x59')];if(!_0xbca968[_0x2c01('0x55')][_0x2c01('0x5a')]('nolimit')){_0x5d2daa[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xbca968['query'][_0x2c01('0x34')]);_0x5d2daa['offset']=qs[_0x2c01('0x33')](_0xbca968[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0xeab796['getVoiceQueuesRt'](_0x5d2daa);}})[_0x2c01('0x27')](function(_0x329da3){if(_0x329da3){return _0x329da3?{'count':_0x5a2daa,'rows':_0x329da3}:null;}})[_0x2c01('0x27')](respondWithResult(_0x28d3a6,null))[_0x2c01('0x2f')](handleError(_0x28d3a6,null));};exports[_0x2c01('0xd7')]=function(_0x4951ef,_0x1ce93b,_0x21d6a1){var _0x530ee4={};var _0x29b6cd={};var _0x382dd8;var _0x1859fd;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x4951ef[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1ce93b,null))['then'](function(_0x3119a9){if(_0x3119a9){_0x382dd8=_0x3119a9;_0x29b6cd[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0xd8')][_0x2c01('0x4d')]);_0x29b6cd[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x4951ef[_0x2c01('0x55')]);_0x29b6cd[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x29b6cd[_0x2c01('0x50')],_0x29b6cd[_0x2c01('0x55')]);_0x530ee4['attributes']=_[_0x2c01('0x57')](_0x29b6cd['model'],qs['fields'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x58')]));_0x530ee4[_0x2c01('0x56')]=_0x530ee4[_0x2c01('0x56')][_0x2c01('0x59')]?_0x530ee4[_0x2c01('0x56')]:_0x29b6cd[_0x2c01('0x50')];_0x530ee4[_0x2c01('0xce')]=qs['sort'](_0x4951ef['query']['sort']);_0x530ee4[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_['pick'](_0x4951ef[_0x2c01('0x55')],_0x29b6cd['filters']));if(_0x4951ef['query']['filter']){_0x530ee4[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x530ee4['where'],{'$or':_[_0x2c01('0x4c')](_0x530ee4['attributes'],function(_0x3dfcff){var _0x423245={};_0x423245[_0x3dfcff]={'$like':'%'+_0x4951ef[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x423245;})});}_0x530ee4=_[_0x2c01('0x60')]({},_0x530ee4,_0x4951ef[_0x2c01('0x67')]);return _0x382dd8[_0x2c01('0xd7')](_0x530ee4);}})[_0x2c01('0x27')](function(_0x4fdedc){if(_0x4fdedc){_0x1859fd=_0x4fdedc[_0x2c01('0x59')];if(!_0x4951ef['query']['hasOwnProperty'](_0x2c01('0x5b'))){_0x530ee4[_0x2c01('0x34')]=qs['limit'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x34')]);_0x530ee4[_0x2c01('0x33')]=qs['offset'](_0x4951ef[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x382dd8['getGroups'](_0x530ee4);}})['then'](function(_0x577290){if(_0x577290){return _0x577290?{'count':_0x1859fd,'rows':_0x577290}:null;}})[_0x2c01('0x27')](respondWithResult(_0x1ce93b,null))[_0x2c01('0x2f')](handleError(_0x1ce93b,null));};exports['getRecordings']=function(_0x1a1f84,_0x520922,_0x52ba26){var _0xba5436={'raw':!![],'where':{}};var _0x4f204c={};var _0x171f93={'count':0x0,'rows':[]};return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x1a1f84[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x520922,null))[_0x2c01('0x27')](function(_0x11b9b3){if(_0x11b9b3){_0x4f204c[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['VoiceRecording'][_0x2c01('0x4d')]);_0x4f204c[_0x2c01('0x55')]=_['keys'](_0x1a1f84[_0x2c01('0x55')]);_0x4f204c['filters']=_['intersection'](_0x4f204c['model'],_0x4f204c[_0x2c01('0x55')]);_0xba5436['attributes']=_[_0x2c01('0x57')](_0x4f204c['model'],qs[_0x2c01('0x58')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x58')]));_0xba5436[_0x2c01('0x56')]=_0xba5436[_0x2c01('0x56')][_0x2c01('0x59')]?_0xba5436[_0x2c01('0x56')]:_0x4f204c[_0x2c01('0x50')];if(!_0x1a1f84['query'][_0x2c01('0x5a')]('nolimit')){_0xba5436['limit']=qs[_0x2c01('0x34')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x34')]);_0xba5436['offset']=qs[_0x2c01('0x33')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x33')]);}_0xba5436['order']=qs[_0x2c01('0x5c')](_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x5c')]);_0xba5436[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x1a1f84[_0x2c01('0x55')],_0x4f204c[_0x2c01('0x5e')]));_0xba5436[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x11b9b3['id'];if(_0x1a1f84[_0x2c01('0x55')]['filter']){_0xba5436[_0x2c01('0x5d')]=_['merge'](_0xba5436[_0x2c01('0x5d')],{'$or':_['map'](_0xba5436[_0x2c01('0x56')],function(_0x2d2e90){var _0x3211af={};_0x3211af[_0x2d2e90]={'$like':'%'+_0x1a1f84[_0x2c01('0x55')]['filter']+'%'};return _0x3211af;})});}_0xba5436=_[_0x2c01('0x60')]({},_0xba5436,_0x1a1f84['options']);return db[_0x2c01('0xda')]['count']({'where':_0xba5436['where']})['then'](function(_0x5f1eb3){_0x171f93['count']=_0x5f1eb3;if(_0x1a1f84[_0x2c01('0x55')][_0x2c01('0x6c')]){_0xba5436['include']=[{'all':!![]}];}return db[_0x2c01('0xda')][_0x2c01('0x69')](_0xba5436);})[_0x2c01('0x27')](function(_0x400287){_0x171f93[_0x2c01('0x6a')]=_0x400287;return _0x171f93;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x520922,_0xba5436))[_0x2c01('0x2f')](handleError(_0x520922,null));};exports[_0x2c01('0xdb')]=function(_0x388f1b,_0x5f2d1b,_0x2ecd19){var _0xaa997={'raw':!![],'where':{}};var _0x930e8e={};var _0x198697={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x388f1b[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x5f2d1b,null))[_0x2c01('0x27')](function(_0x4d34ee){if(_0x4d34ee){_0x930e8e[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['ScreenRecording'][_0x2c01('0x4d')]);_0x930e8e[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x388f1b[_0x2c01('0x55')]);_0x930e8e[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x930e8e[_0x2c01('0x50')],_0x930e8e[_0x2c01('0x55')]);_0xaa997[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x930e8e[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x388f1b['query']['fields']));_0xaa997[_0x2c01('0x56')]=_0xaa997['attributes'][_0x2c01('0x59')]?_0xaa997[_0x2c01('0x56')]:_0x930e8e[_0x2c01('0x50')];if(!_0x388f1b['query']['hasOwnProperty'](_0x2c01('0x5b'))){_0xaa997[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x388f1b[_0x2c01('0x55')][_0x2c01('0x34')]);_0xaa997['offset']=qs['offset'](_0x388f1b[_0x2c01('0x55')][_0x2c01('0x33')]);}_0xaa997[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x388f1b['query'][_0x2c01('0x5c')]);_0xaa997['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x388f1b[_0x2c01('0x55')],_0x930e8e[_0x2c01('0x5e')]));_0xaa997[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x4d34ee['id'];if(_0x388f1b['query'][_0x2c01('0x66')]){_0xaa997[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0xaa997[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0xaa997['attributes'],function(_0x568b50){var _0x409e18={};_0x409e18[_0x568b50]={'$like':'%'+_0x388f1b[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x409e18;})});}_0xaa997=_[_0x2c01('0x60')]({},_0xaa997,_0x388f1b[_0x2c01('0x67')]);return db['ScreenRecording'][_0x2c01('0x32')]({'where':_0xaa997[_0x2c01('0x5d')]})[_0x2c01('0x27')](function(_0x271bb6){_0x198697[_0x2c01('0x32')]=_0x271bb6;if(_0x388f1b['query']['includeAll']){_0xaa997[_0x2c01('0x6d')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0xaa997);})['then'](function(_0x3ed2b2){_0x198697[_0x2c01('0x6a')]=_0x3ed2b2;return _0x198697;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x5f2d1b,_0xaa997))['catch'](handleError(_0x5f2d1b,null));};exports['getChatInteractions']=function(_0xc1ec38,_0xbac2d6,_0x23a6ff){var _0x5d0de7={};var _0x4daca8={};var _0x3a95e1;var _0x15671e;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xc1ec38[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xbac2d6,null))[_0x2c01('0x27')](function(_0x5c1baf){if(_0x5c1baf){_0x3a95e1=_0x5c1baf;_0x4daca8[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xdc')]['rawAttributes']);_0x4daca8['query']=_['keys'](_0xc1ec38['query']);_0x4daca8[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4daca8[_0x2c01('0x50')],_0x4daca8[_0x2c01('0x55')]);_0x5d0de7[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4daca8[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0xc1ec38[_0x2c01('0x55')][_0x2c01('0x58')]));_0x5d0de7['attributes']=_0x5d0de7['attributes'][_0x2c01('0x59')]?_0x5d0de7[_0x2c01('0x56')]:_0x4daca8[_0x2c01('0x50')];_0x5d0de7['order']=qs['sort'](_0xc1ec38['query'][_0x2c01('0x5c')]);_0x5d0de7[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0xc1ec38[_0x2c01('0x55')],_0x4daca8['filters']));if(_0xc1ec38['query']['filter']){_0x5d0de7['where']=_[_0x2c01('0x60')](_0x5d0de7[_0x2c01('0x5d')],{'$or':_['map'](_0x5d0de7[_0x2c01('0x56')],function(_0x30aa64){var _0xbdbed4={};_0xbdbed4[_0x30aa64]={'$like':'%'+_0xc1ec38['query'][_0x2c01('0x66')]+'%'};return _0xbdbed4;})});}_0x5d0de7=_[_0x2c01('0x60')]({},_0x5d0de7,_0xc1ec38[_0x2c01('0x67')]);return _0x3a95e1[_0x2c01('0xdd')](_0x5d0de7);}})[_0x2c01('0x27')](function(_0x2d9c5e){if(_0x2d9c5e){_0x15671e=_0x2d9c5e[_0x2c01('0x59')];if(!_0xc1ec38[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x5d0de7[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xc1ec38['query'][_0x2c01('0x34')]);_0x5d0de7['offset']=qs['offset'](_0xc1ec38[_0x2c01('0x55')]['offset']);}return _0x3a95e1['getChatInteractions'](_0x5d0de7);}})[_0x2c01('0x27')](function(_0x411f60){if(_0x411f60){return _0x411f60?{'count':_0x15671e,'rows':_0x411f60}:null;}})[_0x2c01('0x27')](respondWithResult(_0xbac2d6,null))[_0x2c01('0x2f')](handleError(_0xbac2d6,null));};exports[_0x2c01('0xde')]=function(_0x24d36e,_0xc81954,_0x3b9d23){var _0x121f5c={};var _0x17cb50={};var _0x5119eb;var _0x211f52;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x24d36e[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xc81954,null))[_0x2c01('0x27')](function(_0x58b3a1){if(_0x58b3a1){_0x5119eb=_0x58b3a1;_0x17cb50[_0x2c01('0x50')]=_[_0x2c01('0x54')](db['OpenchannelInteraction'][_0x2c01('0x4d')]);_0x17cb50[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x24d36e[_0x2c01('0x55')]);_0x17cb50['filters']=_[_0x2c01('0x57')](_0x17cb50[_0x2c01('0x50')],_0x17cb50['query']);_0x121f5c['attributes']=_[_0x2c01('0x57')](_0x17cb50[_0x2c01('0x50')],qs['fields'](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x58')]));_0x121f5c[_0x2c01('0x56')]=_0x121f5c[_0x2c01('0x56')]['length']?_0x121f5c[_0x2c01('0x56')]:_0x17cb50['model'];_0x121f5c[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x121f5c[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x24d36e[_0x2c01('0x55')],_0x17cb50[_0x2c01('0x5e')]));if(_0x24d36e[_0x2c01('0x55')][_0x2c01('0x66')]){_0x121f5c['where']=_[_0x2c01('0x60')](_0x121f5c[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x121f5c[_0x2c01('0x56')],function(_0x31f819){var _0x10d57a={};_0x10d57a[_0x31f819]={'$like':'%'+_0x24d36e[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x10d57a;})});}_0x121f5c=_['merge']({},_0x121f5c,_0x24d36e[_0x2c01('0x67')]);return _0x5119eb[_0x2c01('0xde')](_0x121f5c);}})[_0x2c01('0x27')](function(_0x34ba2a){if(_0x34ba2a){_0x211f52=_0x34ba2a[_0x2c01('0x59')];if(!_0x24d36e[_0x2c01('0x55')]['hasOwnProperty']('nolimit')){_0x121f5c[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x34')]);_0x121f5c[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x24d36e[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x5119eb[_0x2c01('0xde')](_0x121f5c);}})[_0x2c01('0x27')](function(_0x10f6db){if(_0x10f6db){return _0x10f6db?{'count':_0x211f52,'rows':_0x10f6db}:null;}})['then'](respondWithResult(_0xc81954,null))[_0x2c01('0x2f')](handleError(_0xc81954,null));};exports[_0x2c01('0xdf')]=function(_0x535862,_0x2ea8c3,_0x2ecd6c){var _0x3716ee={'raw':!![],'where':{}};var _0x43ee77={};var _0x587bbb={'count':0x0,'rows':[]};return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x535862[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2ea8c3,null))['then'](function(_0x3524d1){if(_0x3524d1){_0x43ee77[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xe0')][_0x2c01('0x4d')]);_0x43ee77[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x535862['query']);_0x43ee77[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x43ee77[_0x2c01('0x50')],_0x43ee77[_0x2c01('0x55')]);_0x3716ee['attributes']=_[_0x2c01('0x57')](_0x43ee77[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x535862['query'][_0x2c01('0x58')]));_0x3716ee[_0x2c01('0x56')]=_0x3716ee[_0x2c01('0x56')]['length']?_0x3716ee['attributes']:_0x43ee77[_0x2c01('0x50')];if(!_0x535862[_0x2c01('0x55')]['hasOwnProperty']('nolimit')){_0x3716ee[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x535862[_0x2c01('0x55')]['limit']);_0x3716ee[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x535862[_0x2c01('0x55')][_0x2c01('0x33')]);}_0x3716ee[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x535862['query']['sort']);_0x3716ee[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x535862['query'],_0x43ee77[_0x2c01('0x5e')]));_0x3716ee[_0x2c01('0x5d')][_0x2c01('0xd9')]=_0x3524d1['id'];if(_0x535862[_0x2c01('0x55')]['filter']){_0x3716ee[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x3716ee[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x3716ee[_0x2c01('0x56')],function(_0x326c94){var _0x4593d8={};_0x4593d8[_0x326c94]={'$like':'%'+_0x535862[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x4593d8;})});}_0x3716ee=_[_0x2c01('0x60')]({},_0x3716ee,_0x535862[_0x2c01('0x67')]);return db['MailInteraction'][_0x2c01('0x32')]({'where':_0x3716ee[_0x2c01('0x5d')]})[_0x2c01('0x27')](function(_0x5f2665){_0x587bbb[_0x2c01('0x32')]=_0x5f2665;if(_0x535862['query'][_0x2c01('0x6c')]){_0x3716ee['include']=[{'all':!![]}];}return db[_0x2c01('0xe0')]['findAll'](_0x3716ee);})['then'](function(_0x4dd5ec){_0x587bbb[_0x2c01('0x6a')]=_0x4dd5ec;return _0x587bbb;});}})[_0x2c01('0x27')](respondWithFilteredResult(_0x2ea8c3,_0x3716ee))[_0x2c01('0x2f')](handleError(_0x2ea8c3,null));};exports[_0x2c01('0xe1')]=function(_0x2f5a2e,_0x48b1ab,_0x30c40a){var _0xfe373e={};var _0x21aa99={};var _0x274315;var _0x3327a0;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x2f5a2e[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x48b1ab,null))[_0x2c01('0x27')](function(_0x208900){if(_0x208900){_0x274315=_0x208900;_0x21aa99[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xe2')]['rawAttributes']);_0x21aa99[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x2f5a2e[_0x2c01('0x55')]);_0x21aa99[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x21aa99[_0x2c01('0x50')],_0x21aa99[_0x2c01('0x55')]);_0xfe373e['attributes']=_['intersection'](_0x21aa99[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x2f5a2e['query'][_0x2c01('0x58')]));_0xfe373e[_0x2c01('0x56')]=_0xfe373e[_0x2c01('0x56')][_0x2c01('0x59')]?_0xfe373e[_0x2c01('0x56')]:_0x21aa99[_0x2c01('0x50')];_0xfe373e[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x5c')]);_0xfe373e[_0x2c01('0x5d')]=qs['filters'](_['pick'](_0x2f5a2e[_0x2c01('0x55')],_0x21aa99['filters']));if(_0x2f5a2e['query']['filter']){_0xfe373e[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0xfe373e[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0xfe373e[_0x2c01('0x56')],function(_0x542aa5){var _0x4cde04={};_0x4cde04[_0x542aa5]={'$like':'%'+_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x4cde04;})});}_0xfe373e=_[_0x2c01('0x60')]({},_0xfe373e,_0x2f5a2e[_0x2c01('0x67')]);return _0x274315[_0x2c01('0xe1')](_0xfe373e);}})[_0x2c01('0x27')](function(_0x8defae){if(_0x8defae){_0x3327a0=_0x8defae[_0x2c01('0x59')];if(!_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x5a')](_0x2c01('0x5b'))){_0xfe373e[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x34')]);_0xfe373e['offset']=qs[_0x2c01('0x33')](_0x2f5a2e[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x274315[_0x2c01('0xe1')](_0xfe373e);}})[_0x2c01('0x27')](function(_0x28e065){if(_0x28e065){return _0x28e065?{'count':_0x3327a0,'rows':_0x28e065}:null;}})[_0x2c01('0x27')](respondWithResult(_0x48b1ab,null))[_0x2c01('0x2f')](handleError(_0x48b1ab,null));};exports[_0x2c01('0xe3')]=function(_0x29728a,_0x43770b,_0x3ad0c8){var _0x3eb4ca={};var _0x1c8131={};var _0x57b3e7;var _0x307bdc;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x29728a[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x43770b,null))['then'](function(_0x333f1b){if(_0x333f1b){_0x57b3e7=_0x333f1b;_0x1c8131['model']=_['keys'](db[_0x2c01('0xe4')][_0x2c01('0x4d')]);_0x1c8131[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x29728a[_0x2c01('0x55')]);_0x1c8131[_0x2c01('0x5e')]=_['intersection'](_0x1c8131[_0x2c01('0x50')],_0x1c8131['query']);_0x3eb4ca[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x1c8131[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x29728a[_0x2c01('0x55')][_0x2c01('0x58')]));_0x3eb4ca[_0x2c01('0x56')]=_0x3eb4ca[_0x2c01('0x56')][_0x2c01('0x59')]?_0x3eb4ca['attributes']:_0x1c8131['model'];_0x3eb4ca[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x29728a[_0x2c01('0x55')]['sort']);_0x3eb4ca[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x29728a['query'],_0x1c8131['filters']));if(_0x29728a[_0x2c01('0x55')][_0x2c01('0x66')]){_0x3eb4ca[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x3eb4ca[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x3eb4ca[_0x2c01('0x56')],function(_0x1d6daa){var _0x21b6b6={};_0x21b6b6[_0x1d6daa]={'$like':'%'+_0x29728a[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x21b6b6;})});}_0x3eb4ca=_[_0x2c01('0x60')]({},_0x3eb4ca,_0x29728a[_0x2c01('0x67')]);return _0x57b3e7[_0x2c01('0xe3')](_0x3eb4ca);}})['then'](function(_0x186553){if(_0x186553){_0x307bdc=_0x186553[_0x2c01('0x59')];if(!_0x29728a[_0x2c01('0x55')][_0x2c01('0x5a')]('nolimit')){_0x3eb4ca[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0x29728a[_0x2c01('0x55')]['limit']);_0x3eb4ca[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x29728a[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x57b3e7['getFaxInteractions'](_0x3eb4ca);}})[_0x2c01('0x27')](function(_0x5faed0){if(_0x5faed0){return _0x5faed0?{'count':_0x307bdc,'rows':_0x5faed0}:null;}})['then'](respondWithResult(_0x43770b,null))[_0x2c01('0x2f')](handleError(_0x43770b,null));};exports['getWhatsappInteractions']=function(_0x33e86f,_0x55f7e9,_0x1e031e){var _0x23a223={};var _0x1d7cdd={};var _0x1ef5ea;var _0x25fd18;return db[_0x2c01('0x68')]['findOne']({'where':{'id':_0x33e86f[_0x2c01('0x6b')]['id']}})['then'](handleEntityNotFound(_0x55f7e9,null))[_0x2c01('0x27')](function(_0xaf577){if(_0xaf577){_0x1ef5ea=_0xaf577;_0x1d7cdd['model']=_['keys'](db[_0x2c01('0xe5')]['rawAttributes']);_0x1d7cdd[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x33e86f['query']);_0x1d7cdd[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x1d7cdd[_0x2c01('0x50')],_0x1d7cdd[_0x2c01('0x55')]);_0x23a223[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x1d7cdd[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x33e86f[_0x2c01('0x55')][_0x2c01('0x58')]));_0x23a223['attributes']=_0x23a223[_0x2c01('0x56')]['length']?_0x23a223['attributes']:_0x1d7cdd['model'];_0x23a223[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x33e86f['query'][_0x2c01('0x5c')]);_0x23a223['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x33e86f[_0x2c01('0x55')],_0x1d7cdd['filters']));if(_0x33e86f['query'][_0x2c01('0x66')]){_0x23a223[_0x2c01('0x5d')]=_['merge'](_0x23a223[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x23a223[_0x2c01('0x56')],function(_0x4931d7){var _0x2e8c35={};_0x2e8c35[_0x4931d7]={'$like':'%'+_0x33e86f[_0x2c01('0x55')]['filter']+'%'};return _0x2e8c35;})});}_0x23a223=_[_0x2c01('0x60')]({},_0x23a223,_0x33e86f[_0x2c01('0x67')]);return _0x1ef5ea[_0x2c01('0xe6')](_0x23a223);}})[_0x2c01('0x27')](function(_0x4f63ce){if(_0x4f63ce){_0x25fd18=_0x4f63ce[_0x2c01('0x59')];if(!_0x33e86f[_0x2c01('0x55')]['hasOwnProperty'](_0x2c01('0x5b'))){_0x23a223['limit']=qs[_0x2c01('0x34')](_0x33e86f['query'][_0x2c01('0x34')]);_0x23a223[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x33e86f[_0x2c01('0x55')]['offset']);}return _0x1ef5ea[_0x2c01('0xe6')](_0x23a223);}})['then'](function(_0x38828a){if(_0x38828a){return _0x38828a?{'count':_0x25fd18,'rows':_0x38828a}:null;}})['then'](respondWithResult(_0x55f7e9,null))['catch'](handleError(_0x55f7e9,null));};exports['login']=function(_0x55313d,_0x518359,_0x1c9359){var _0x506bc0;var _0x142c40;var _0x270403;var _0x63caee=!_[_0x2c01('0x7a')](_0x55313d[_0x2c01('0x6b')]['id'])?_0x55313d[_0x2c01('0x6b')]['id']:!_[_0x2c01('0x7a')](_0x55313d[_0x2c01('0x41')]['id'])?_0x55313d['user']['id']:null;return db[_0x2c01('0x68')]['find']({'where':{'id':_0x63caee,'role':{'$or':[_0x2c01('0x3f'),_0x2c01('0x41'),'agent']}},'attributes':['id',_0x2c01('0x47'),'phone',_0x2c01('0xe7'),_0x2c01('0x3e'),_0x2c01('0x74'),'loginInPause']})['then'](function(_0x1b6b54){if(_0x1b6b54){if(_0x1b6b54[_0x2c01('0x3e')]===_0x2c01('0x42')){_0x506bc0=_0x1b6b54;if(_0x55313d[_0x2c01('0x6f')]['interface']){_0x270403=util[_0x2c01('0xb9')]('LOCAL/%s@from-sip/n',_0x506bc0[_0x55313d[_0x2c01('0x6f')][_0x2c01('0xad')]]);}else if(_0x55313d[_0x2c01('0x6f')][_0x2c01('0xe8')]){_0x270403=util['format'](_0x2c01('0xba'),_0x55313d[_0x2c01('0x6f')][_0x2c01('0xe8')]);}else{_0x270403=util[_0x2c01('0xb9')](_0x2c01('0xba'),_0x506bc0[_0x2c01('0x47')]);}socket['to'](util[_0x2c01('0xb9')](_0x2c01('0xe9'),_0x506bc0[_0x2c01('0x47')]))[_0x2c01('0xbf')]('user:forcelogout',{'ip':_0x55313d['headers'][_0x2c01('0xea')]||_0x55313d[_0x2c01('0xeb')][_0x2c01('0xec')]||_0x55313d[_0x2c01('0xed')][_0x2c01('0xec')]||_0x55313d[_0x2c01('0xeb')][_0x2c01('0xed')][_0x2c01('0xec')]});return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'membername':_0x506bc0['name']},'individualHooks':!![]});}}else{throw new db[(_0x2c01('0x9f'))]['ValidationError'](_0x2c01('0xee'));}})['then'](function(){if(_0x506bc0){return _0x506bc0[_0x2c01('0xef')]({'raw':!![]});}})[_0x2c01('0x27')](function(_0x25aade){if(_0x506bc0){var _0x37b3fa=[];if(_0x25aade){_0x142c40=_0x25aade;if(_0x142c40['length']){for(var _0x192067=0x0;_0x192067<_0x142c40[_0x2c01('0x59')];_0x192067++){_0x37b3fa[_0x2c01('0x98')]({'membername':_0x506bc0['name'],'UserId':_0x506bc0['id'],'queue_name':_0x142c40[_0x192067][_0x2c01('0x47')],'VoiceQueueId':_0x142c40[_0x192067]['id'],'interface':_0x270403,'paused':_0x506bc0[_0x2c01('0xab')]||![],'penalty':_0x142c40[_0x192067][_0x2c01('0xf0')]||0x0});}return BPromise[_0x2c01('0xbb')](_0x37b3fa,function(_0x171445){return db[_0x2c01('0xc1')][_0x2c01('0xf1')](_0x171445);});}}}})[_0x2c01('0x27')](function(){if(_0x506bc0){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x506bc0[_0x2c01('0x47')],'exitAt':null}});}})[_0x2c01('0x27')](function(_0x455a48){if(_0x506bc0){var _0x176f29=[];_0x455a48[_0x2c01('0xf3')](function(_0xfefaf2){_0x176f29[_0x2c01('0x98')](_0xfefaf2[_0x2c01('0x3b')]({'exitAt':moment()['format'](_0x2c01('0xf4'))}));});return BPromise[_0x2c01('0x99')](_0x176f29);}})[_0x2c01('0x27')](function(){if(_0x506bc0){var _0x430be9=[];var _0x5e6e96=[];var _0x263803=utils[_0x2c01('0xf5')]();var _0x426b19={'membername':_0x506bc0[_0x2c01('0x47')],'interface':_0x270403,'enterAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4')),'role':_0x506bc0[_0x2c01('0x3e')],'internal':_0x506bc0[_0x2c01('0x74')]};_0x263803[_0x2c01('0xf3')](function(_0x428ce0){_0x430be9[_0x2c01('0x98')](_[_0x2c01('0x60')]({'channel':_0x428ce0,'type':_0x2c01('0xf6'),'data1':_0x55313d[_0x2c01('0x6f')][_0x2c01('0xf7')],'data2':_0x270403},_0x426b19));if(_0x506bc0[_0x2c01('0xab')]){_0x5e6e96[_0x2c01('0x98')](_[_0x2c01('0x60')]({'channel':_0x428ce0,'type':_0x2c01('0xf8'),'data1':_0x2c01('0xf9')},_0x426b19));}});return db['MemberReport'][_0x2c01('0xfa')](_0x430be9[_0x2c01('0xfb')](_0x5e6e96),{'individualHooks':!![]});}})[_0x2c01('0x27')](function(){if(_0x506bc0){return _0x506bc0['update']({'online':!![],'lastLoginAt':moment()[_0x2c01('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x506bc0[_0x2c01('0xab')]||![],'mailPause':_0x506bc0[_0x2c01('0xab')]||![],'chatPause':_0x506bc0[_0x2c01('0xab')]||![],'faxPause':_0x506bc0[_0x2c01('0xab')]||![],'smsPause':_0x506bc0['loginInPause']||![],'openchannelPause':_0x506bc0[_0x2c01('0xab')]||![],'whatsappPause':_0x506bc0[_0x2c01('0xab')]||![],'pauseType':_0x506bc0[_0x2c01('0xab')]?_0x2c01('0xf9'):null,'interface':_0x270403,'lastPauseAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))});}})['then'](function(_0x146a3d){if(_0x55313d[_0x2c01('0xfc')]){return _0x1c9359();}else{return BPromise['resolve'](_0x146a3d)[_0x2c01('0x27')](respondWithResult(_0x518359,null));}})[_0x2c01('0x2f')](handleError(_0x518359,null));};exports[_0x2c01('0xfd')]=function(_0x4c0b9d,_0x4743e7,_0x3689ce){var _0x590d09;return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x4c0b9d[_0x2c01('0x6b')]['id'],'role':_0x2c01('0x42')},'attributes':['id',_0x2c01('0x47'),_0x2c01('0x3e')]})[_0x2c01('0x27')](handleEntityNotFound(_0x4743e7,null))[_0x2c01('0x27')](function(_0x194fb4){if(_0x194fb4){_0x590d09=_0x194fb4;return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'membername':_0x590d09[_0x2c01('0x47')]},'individualHooks':!![]});}})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x590d09[_0x2c01('0x47')],'exitAt':null}});})['then'](function(_0x1105b1){var _0x4e4fae=[];_0x1105b1[_0x2c01('0xf3')](function(_0xd2bc39){_0x4e4fae['push'](_0xd2bc39['update']({'exitAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))}));});return BPromise[_0x2c01('0x99')](_0x4e4fae);})['then'](function(){return _0x590d09['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2c01('0x27')](respondWithResult(_0x4743e7,null))[_0x2c01('0x2f')](handleError(_0x4743e7,null));};exports[_0x2c01('0xfe')]=function(_0x5b0224,_0x4ca58c,_0x6e1b2e){var _0x3a6de3;return db[_0x2c01('0xc1')][_0x2c01('0x3b')]({'paused':0x1},{'where':{'UserId':_0x5b0224[_0x2c01('0x6b')]['id']},'individualHooks':!![]})[_0x2c01('0x27')](function(){return db['User'][_0x2c01('0x6e')]({'where':{'id':_0x5b0224[_0x2c01('0x6b')]['id'],'role':'agent'},'attributes':['id','name',_0x2c01('0x3e'),'internal','interface']});})[_0x2c01('0x27')](handleEntityNotFound(_0x4ca58c,null))[_0x2c01('0x27')](function(_0x4df9ad){if(_0x4df9ad){_0x3a6de3=_0x4df9ad;return respondWithRpcPromise('QueuePause',_0x2c01('0xfe'),{'id':_0x3a6de3['id'],'name':_0x3a6de3['name'],'pause':!![]});}})['then'](function(){if(_0x3a6de3){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x3a6de3[_0x2c01('0x47')],'type':_0x2c01('0xf8'),'exitAt':null}});}})[_0x2c01('0x27')](function(_0x28037c){if(_0x28037c['length']){var _0x492002=moment()[_0x2c01('0xb9')](_0x2c01('0xf4'));for(var _0x1e3e61=0x0,_0x272fea=_0x28037c['length'];_0x1e3e61<_0x272fea;_0x1e3e61++){_0x28037c[_0x1e3e61][_0x2c01('0xff')]({'exitAt':_0x492002});}}})[_0x2c01('0x27')](function(){var _0x2a8ec5=[];var _0x225d11=utils[_0x2c01('0xf5')]();_0x225d11[_0x2c01('0xf3')](function(_0x102227){_0x2a8ec5['push']({'channel':_0x102227,'membername':_0x3a6de3[_0x2c01('0x47')],'interface':_[_0x2c01('0x7a')](_0x3a6de3[_0x2c01('0xad')])?util[_0x2c01('0xb9')]('SIP/%s',_0x3a6de3[_0x2c01('0x47')]):_0x3a6de3['interface'],'type':_0x2c01('0xf8'),'enterAt':moment()[_0x2c01('0xb9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5b0224['body']['type']||'DEFAULT\x20PAUSE','role':_0x3a6de3[_0x2c01('0x3e')],'internal':_0x3a6de3['internal']});});return db[_0x2c01('0xf2')][_0x2c01('0xfa')](_0x2a8ec5,{'individualHooks':!![]});})[_0x2c01('0x27')](function(){return _0x3a6de3[_0x2c01('0x3b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b0224['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2c01('0xb9')](_0x2c01('0xf4'))});})[_0x2c01('0x27')](respondWithResult(_0x4ca58c,null))[_0x2c01('0x2f')](handleError(_0x4ca58c,null));};exports[_0x2c01('0x100')]=function(_0x59086b,_0x2a8740,_0x291fac){var _0x2167ab;return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x59086b['params']['id']},'attributes':['id',_0x2c01('0x47'),_0x2c01('0x3e'),_0x2c01('0xac'),_0x2c01('0x101'),_0x2c01('0x102'),_0x2c01('0x103'),_0x2c01('0x104'),_0x2c01('0x105'),_0x2c01('0x106'),_0x2c01('0x107'),_0x2c01('0x108')]})[_0x2c01('0x27')](handleEntityNotFound(_0x2a8740,null))['then'](function(_0xfe2c93){if(_0xfe2c93){_0x2167ab=_0xfe2c93;if(_0x59086b['body'][_0x2c01('0xaa')]&&!utils['isValidChannel'](_0x59086b[_0x2c01('0x6f')][_0x2c01('0xaa')])){throw new db['Sequelize'][(_0x2c01('0xa2'))]('Unknown\x20channel');}switch(_0x59086b[_0x2c01('0x6f')][_0x2c01('0xaa')]){case _0x2c01('0xb8'):return respondWithRpcPromise(_0x2c01('0x109'),_0x2c01('0x100'),{'id':_0x2167ab['id'],'name':_0x2167ab[_0x2c01('0x47')],'pause':![]})[_0x2c01('0x27')](function(){return db[_0x2c01('0xc1')]['update']({'paused':0x0},{'where':{'UserId':_0x2167ab['id']},'individualHooks':!![]});})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x6e')]({'where':{'channel':_0x59086b['body'][_0x2c01('0xaa')],'membername':_0x2167ab[_0x2c01('0x47')],'type':'PAUSE','exitAt':null}});})[_0x2c01('0x27')](function(_0x11fbd){if(_0x11fbd){return _0x11fbd['update']({'exitAt':moment()['format'](_0x2c01('0xf4')),'data2':_0x2c01('0x10a')},{'individualHooks':!![]});}return null;})[_0x2c01('0x27')](function(){return _0x2167ab['update']({'voicePause':![]});});case _0x2c01('0x10b'):case'chat':case _0x2c01('0x10c'):case _0x2c01('0x10d'):case _0x2c01('0x10e'):case _0x2c01('0x10f'):return db[_0x2c01('0xf2')][_0x2c01('0x6e')]({'where':{'channel':_0x59086b[_0x2c01('0x6f')]['channel'],'membername':_0x2167ab[_0x2c01('0x47')],'type':_0x2c01('0xf8'),'exitAt':null}})[_0x2c01('0x27')](function(_0x117fd6){if(_0x117fd6){return _0x117fd6[_0x2c01('0x3b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2c01('0x10a')},{'individualHooks':!![]});}return null;})[_0x2c01('0x27')](function(){var _0x46edcb={};_[_0x2c01('0x35')](_0x46edcb,util['format'](_0x2c01('0x110'),_0x59086b['body'][_0x2c01('0xaa')],_0x2c01('0x111')),![]);return _0x2167ab[_0x2c01('0x3b')](_0x46edcb);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x2167ab['id'],'name':_0x2167ab[_0x2c01('0x47')],'pause':![]})[_0x2c01('0x27')](function(){return db[_0x2c01('0xc1')][_0x2c01('0x3b')]({'paused':0x0},{'where':{'UserId':_0x2167ab['id']}});})[_0x2c01('0x27')](function(){return db[_0x2c01('0xf2')][_0x2c01('0x69')]({'where':{'membername':_0x2167ab['name'],'type':'PAUSE','exitAt':null}});})[_0x2c01('0x27')](function(_0x25b5d5){var _0x4fa9ba=[];_0x25b5d5['forEach'](function(_0x3f7284){_0x4fa9ba['push'](_0x3f7284[_0x2c01('0x3b')]({'exitAt':moment()['format'](_0x2c01('0xf4')),'data2':_0x2c01('0x10a')}));});return BPromise[_0x2c01('0x99')](_0x4fa9ba);})[_0x2c01('0x27')](function(){return _0x2167ab[_0x2c01('0x3b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2c01('0x27')](respondWithResult(_0x2a8740,null))[_0x2c01('0x2f')](handleError(_0x2a8740,null));};exports[_0x2c01('0x112')]=function(_0x493990,_0x2b272c,_0x20bb74){var _0x203abe={};var _0x4f3a1c={};var _0x7bac5d;var _0xcb846;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x493990['params']['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x2b272c,null))[_0x2c01('0x27')](function(_0x1a3138){if(_0x1a3138){_0x7bac5d=_0x1a3138;_0x4f3a1c[_0x2c01('0x50')]=_['keys'](db[_0x2c01('0x113')][_0x2c01('0x4d')]);_0x4f3a1c[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x493990[_0x2c01('0x55')]);_0x4f3a1c[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4f3a1c[_0x2c01('0x50')],_0x4f3a1c[_0x2c01('0x55')]);_0x203abe[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4f3a1c[_0x2c01('0x50')],qs[_0x2c01('0x58')](_0x493990[_0x2c01('0x55')][_0x2c01('0x58')]));_0x203abe[_0x2c01('0x56')]=_0x203abe[_0x2c01('0x56')][_0x2c01('0x59')]?_0x203abe['attributes']:_0x4f3a1c[_0x2c01('0x50')];_0x203abe[_0x2c01('0xce')]=qs['sort'](_0x493990[_0x2c01('0x55')]['sort']);_0x203abe['where']=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x493990[_0x2c01('0x55')],_0x4f3a1c['filters']));if(_0x493990[_0x2c01('0x55')]['filter']){_0x203abe[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x203abe['where'],{'$or':_[_0x2c01('0x4c')](_0x203abe[_0x2c01('0x56')],function(_0x46d1f6){var _0xea12b6={};_0xea12b6[_0x46d1f6]={'$like':'%'+_0x493990[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0xea12b6;})});}_0x203abe=_[_0x2c01('0x60')]({},_0x203abe,_0x493990['options']);return _0x7bac5d[_0x2c01('0x112')](_0x203abe);}})[_0x2c01('0x27')](function(_0x58d1ac){if(_0x58d1ac){_0xcb846=_0x58d1ac[_0x2c01('0x59')];if(!_0x493990['query']['hasOwnProperty']('nolimit')){_0x203abe[_0x2c01('0x34')]=qs['limit'](_0x493990[_0x2c01('0x55')]['limit']);_0x203abe[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0x493990[_0x2c01('0x55')][_0x2c01('0x33')]);}return _0x7bac5d['getTeams'](_0x203abe);}})[_0x2c01('0x27')](function(_0x4f6350){if(_0x4f6350){return _0x4f6350?{'count':_0xcb846,'rows':_0x4f6350}:null;}})[_0x2c01('0x27')](respondWithResult(_0x2b272c,null))['catch'](handleError(_0x2b272c,null));};exports[_0x2c01('0x114')]=function(_0x5d1b8b,_0xa48eda){return db[_0x2c01('0x68')][_0x2c01('0x6e')]({'where':{'id':_0x5d1b8b[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0xa48eda,null))[_0x2c01('0x27')](function(_0xa95f8d){if(_0xa95f8d){var _0x242069=_0xa95f8d[_0x2c01('0x3d')]({'plain':!![]});return _0xa95f8d[_0x2c01('0x114')](_0x5d1b8b['body'][_0x2c01('0x72')],_[_0x2c01('0x73')](_0x5d1b8b['body'],['ids','id'])||{})[_0x2c01('0x27')](function(){for(var _0x47ae3d=0x0;_0x47ae3d<_0x5d1b8b['body']['ids'][_0x2c01('0x59')];_0x47ae3d++){var _0x56f814=[];db[_0x2c01('0x113')][_0x2c01('0xa4')]({'where':{'id':_0x5d1b8b[_0x2c01('0x6f')][_0x2c01('0x72')][_0x47ae3d]}})[_0x2c01('0x27')](function(_0x16fb43){_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0xef')]()[_0x2c01('0x27')](function(_0x5ad1f7){for(var _0x221287=0x0;_0x221287<_0x5ad1f7[_0x2c01('0x59')];_0x221287++){_0x5ad1f7[_0x221287][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x116'));}return _0x5ad1f7;}));_0x56f814['push'](_0x16fb43[_0x2c01('0x117')]()['then'](function(_0x109ab3){for(var _0x3fa7da=0x0;_0x3fa7da<_0x109ab3[_0x2c01('0x59')];_0x3fa7da++){_0x109ab3[_0x3fa7da][_0x2c01('0x115')]('channel',_0x2c01('0x118'));}return _0x109ab3;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x119')]()[_0x2c01('0x27')](function(_0x1e699d){for(var _0x7bd1c1=0x0;_0x7bd1c1<_0x1e699d[_0x2c01('0x59')];_0x7bd1c1++){_0x1e699d[_0x7bd1c1][_0x2c01('0x115')]('channel',_0x2c01('0x11a'));}return _0x1e699d;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x11b')]()[_0x2c01('0x27')](function(_0x2f889b){for(var _0x1c56fe=0x0;_0x1c56fe<_0x2f889b[_0x2c01('0x59')];_0x1c56fe++){_0x2f889b[_0x1c56fe]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x11c'));}return _0x2f889b;}));_0x56f814['push'](_0x16fb43[_0x2c01('0x11d')]()[_0x2c01('0x27')](function(_0x4d8bb0){for(var _0x2b06b0=0x0;_0x2b06b0<_0x4d8bb0[_0x2c01('0x59')];_0x2b06b0++){_0x4d8bb0[_0x2b06b0][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11e'));}return _0x4d8bb0;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x11f')]()[_0x2c01('0x27')](function(_0xf33fb8){for(var _0x5f21c8=0x0;_0x5f21c8<_0xf33fb8[_0x2c01('0x59')];_0x5f21c8++){_0xf33fb8[_0x5f21c8][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x120'));}return _0xf33fb8;}));_0x56f814[_0x2c01('0x98')](_0x16fb43[_0x2c01('0x121')]()['then'](function(_0x4932eb){for(var _0x5c5871=0x0;_0x5c5871<_0x4932eb[_0x2c01('0x59')];_0x5c5871++){_0x4932eb[_0x5c5871][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x122'));}return _0x4932eb;}));return BPromise[_0x2c01('0x99')](_0x56f814);})['then'](function(_0x1a0457){var _0x4be4d8=_[_0x2c01('0x123')](_0x1a0457);_0x56f814=[];return db['sequelize'][_0x2c01('0x124')](function(_0x4a7117){for(var _0x5be70a=0x0;_0x5be70a<_0x4be4d8[_0x2c01('0x59')];_0x5be70a++){_0x56f814['push'](_0x4be4d8[_0x5be70a][_0x2c01('0x125')](_0x242069['id']),{'transaction':_0x4a7117});}return BPromise[_0x2c01('0x99')](_0x56f814)[_0x2c01('0x27')](function(){if(_0x242069['online']){return BPromise[_0x2c01('0xbb')](_[_0x2c01('0x66')](_0x4be4d8,function(_0x32b10d){return _0x32b10d['getDataValue'](_0x2c01('0xaa'))===_0x2c01('0x116');}),function(_0x4eeb90){return db[_0x2c01('0xc1')][_0x2c01('0xf1')]({'membername':_0x242069[_0x2c01('0x47')],'UserId':_0x242069['id'],'queue_name':_0x4eeb90['name'],'VoiceQueueId':_0x4eeb90['id'],'interface':_[_0x2c01('0x7a')](_0x242069[_0x2c01('0xad')])?util[_0x2c01('0xb9')]('SIP/%s',_0x242069[_0x2c01('0x47')]):_0x242069[_0x2c01('0xad')],'paused':_0x242069[_0x2c01('0xac')]||![],'penalty':_0x242069[_0x2c01('0xb3')]},{'transaction':_0x4a7117});});}else{return;}})['then'](function(){for(var _0x457529=0x0;_0x457529<_0x4be4d8[_0x2c01('0x59')];_0x457529++){var _0x4176d1=_0x4be4d8[_0x457529]['getDataValue'](_0x2c01('0xaa'));var _0x4a18fd=_0x4176d1+'QueueId';socket[_0x2c01('0xbf')](_0x2c01('0x41')+_0x4176d1+_0x2c01('0xb6'),{'UserId':_0x242069['id'],['queueField']:_0x4be4d8[_0x457529]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xa48eda,null))['catch'](handleError(_0xa48eda,null));};exports[_0x2c01('0x126')]=function(_0x416bd2,_0x4f9b03){return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0x416bd2[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x4f9b03,null))['then'](function(_0xf135b7){if(_0xf135b7){var _0x4dd2e6=_0xf135b7[_0x2c01('0x3d')]({'plain':!![]});var _0x4910de=_0x416bd2[_0x2c01('0x55')][_0x2c01('0x72')];return _0xf135b7[_0x2c01('0x126')](_0x4910de)[_0x2c01('0x27')](function(){for(var _0x53d0a3=0x0;_0x53d0a3<_0x4910de[_0x2c01('0x59')];_0x53d0a3++){var _0x3a7b16=[];db['Team'][_0x2c01('0xa4')]({'where':{'id':_0x4910de[_0x53d0a3]}})[_0x2c01('0x27')](function(_0x1e966b){_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0xef')]()['then'](function(_0x1d06d9){for(var _0x13e5ec=0x0;_0x13e5ec<_0x1d06d9[_0x2c01('0x59')];_0x13e5ec++){_0x1d06d9[_0x13e5ec][_0x2c01('0x115')](_0x2c01('0xaa'),'Voice');}return _0x1d06d9;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x117')]()[_0x2c01('0x27')](function(_0x5b92cb){for(var _0xf5f3cc=0x0;_0xf5f3cc<_0x5b92cb[_0x2c01('0x59')];_0xf5f3cc++){_0x5b92cb[_0xf5f3cc]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x118'));}return _0x5b92cb;}));_0x3a7b16['push'](_0x1e966b[_0x2c01('0x119')]()[_0x2c01('0x27')](function(_0x3c796d){for(var _0x38a6c1=0x0;_0x38a6c1<_0x3c796d[_0x2c01('0x59')];_0x38a6c1++){_0x3c796d[_0x38a6c1][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11a'));}return _0x3c796d;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11b')]()[_0x2c01('0x27')](function(_0x40e935){for(var _0x5c5fda=0x0;_0x5c5fda<_0x40e935['length'];_0x5c5fda++){_0x40e935[_0x5c5fda][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11c'));}return _0x40e935;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11d')]()['then'](function(_0x1fbb74){for(var _0x204d6a=0x0;_0x204d6a<_0x1fbb74['length'];_0x204d6a++){_0x1fbb74[_0x204d6a][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x11e'));}return _0x1fbb74;}));_0x3a7b16[_0x2c01('0x98')](_0x1e966b[_0x2c01('0x11f')]()[_0x2c01('0x27')](function(_0x41098d){for(var _0x21b040=0x0;_0x21b040<_0x41098d[_0x2c01('0x59')];_0x21b040++){_0x41098d[_0x21b040][_0x2c01('0x115')](_0x2c01('0xaa'),_0x2c01('0x120'));}return _0x41098d;}));_0x3a7b16['push'](_0x1e966b[_0x2c01('0x121')]()['then'](function(_0x1d8190){for(var _0x11f2a9=0x0;_0x11f2a9<_0x1d8190['length'];_0x11f2a9++){_0x1d8190[_0x11f2a9]['setDataValue'](_0x2c01('0xaa'),_0x2c01('0x122'));}return _0x1d8190;}));return BPromise[_0x2c01('0x99')](_0x3a7b16);})['then'](function(_0x5103ba){var _0x24a575=_[_0x2c01('0x123')](_0x5103ba);_0x3a7b16=[];return db['sequelize'][_0x2c01('0x124')](function(_0x43de87){for(var _0x266601=0x0;_0x266601<_0x24a575[_0x2c01('0x59')];_0x266601++){_0x3a7b16[_0x2c01('0x98')](_0x24a575[_0x266601]['removeAgent'](_0x4dd2e6['id']),{'transaction':_0x43de87});}return BPromise[_0x2c01('0x99')](_0x3a7b16)[_0x2c01('0x27')](function(){if(_0x4dd2e6[_0x2c01('0x127')]){return BPromise[_0x2c01('0xbb')](_[_0x2c01('0x66')](_0x24a575,function(_0x127963){return _0x127963[_0x2c01('0x128')](_0x2c01('0xaa'))==='Voice';}),function(_0x5d38d8){return db['UserVoiceQueueRt'][_0x2c01('0x3c')]({'where':{'VoiceQueueId':_0x5d38d8['id'],'UserId':_0x4dd2e6['id']},'transaction':_0x43de87});});}else{return;}})[_0x2c01('0x27')](function(){for(var _0x173798=0x0;_0x173798<_0x24a575[_0x2c01('0x59')];_0x173798++){var _0x3b306e=_0x24a575[_0x173798][_0x2c01('0x128')](_0x2c01('0xaa'));var _0x578616=_0x3b306e+'QueueId';socket[_0x2c01('0xbf')]('user'+_0x3b306e+'Queue:remove',{'UserId':_0x4dd2e6['id'],['queueField']:_0x24a575[_0x173798]['id']});}});});});}});}})[_0x2c01('0x27')](respondWithStatusCode(_0x4f9b03,null))[_0x2c01('0x2f')](handleError(_0x4f9b03,null));};exports[_0x2c01('0x129')]=function(_0xd10f46,_0x3d00d9,_0x35d7fd){var _0x4765e5={};var _0x9688c={};var _0x1e1da1;var _0x3b96a8;return db[_0x2c01('0x68')][_0x2c01('0xa4')]({'where':{'id':_0xd10f46[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x3d00d9,null))[_0x2c01('0x27')](function(_0x27ca6e){if(_0x27ca6e){_0x1e1da1=_0x27ca6e;_0x9688c[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0xcf')][_0x2c01('0x4d')]);_0x9688c[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0xd10f46[_0x2c01('0x55')]);_0x9688c[_0x2c01('0x5e')]=_['intersection'](_0x9688c[_0x2c01('0x50')],_0x9688c[_0x2c01('0x55')]);_0x4765e5['attributes']=_['intersection'](_0x9688c[_0x2c01('0x50')],qs['fields'](_0xd10f46[_0x2c01('0x55')][_0x2c01('0x58')]));_0x4765e5[_0x2c01('0x56')]=_0x4765e5[_0x2c01('0x56')]['length']?_0x4765e5[_0x2c01('0x56')]:_0x9688c[_0x2c01('0x50')];_0x4765e5[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0xd10f46[_0x2c01('0x55')][_0x2c01('0x5c')]);_0x4765e5[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_['pick'](_0xd10f46[_0x2c01('0x55')],_0x9688c['filters']));if(_0xd10f46[_0x2c01('0x55')]['filter']){_0x4765e5[_0x2c01('0x5d')]=_[_0x2c01('0x60')](_0x4765e5[_0x2c01('0x5d')],{'$or':_[_0x2c01('0x4c')](_0x4765e5['attributes'],function(_0x313c5d){var _0x11557c={};_0x11557c[_0x313c5d]={'$like':'%'+_0xd10f46[_0x2c01('0x55')][_0x2c01('0x66')]+'%'};return _0x11557c;})});}_0x4765e5=_[_0x2c01('0x60')]({},_0x4765e5,_0xd10f46[_0x2c01('0x67')]);return _0x1e1da1['getLists'](_0x4765e5);}})[_0x2c01('0x27')](function(_0x35c713){if(_0x35c713){_0x3b96a8=_0x35c713[_0x2c01('0x59')];if(!_0xd10f46['query'][_0x2c01('0x5a')]('nolimit')){_0x4765e5[_0x2c01('0x34')]=qs[_0x2c01('0x34')](_0xd10f46['query'][_0x2c01('0x34')]);_0x4765e5[_0x2c01('0x33')]=qs[_0x2c01('0x33')](_0xd10f46[_0x2c01('0x55')]['offset']);}return _0x1e1da1[_0x2c01('0x129')](_0x4765e5);}})[_0x2c01('0x27')](function(_0x157f40){if(_0x157f40){return _0x157f40?{'count':_0x3b96a8,'rows':_0x157f40}:null;}})[_0x2c01('0x27')](respondWithResult(_0x3d00d9,null))[_0x2c01('0x2f')](handleError(_0x3d00d9,null));};exports[_0x2c01('0x12a')]=function(_0x29b38f,_0x2fd769,_0x260750){var _0x106cf8={};var _0x4a39ad={};var _0x1f6178;var _0x405dc8;return db['User'][_0x2c01('0xa4')]({'where':{'id':_0x29b38f[_0x2c01('0x6b')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x2fd769,null))['then'](function(_0x54c83c){if(_0x54c83c){_0x1f6178=_0x54c83c;_0x4a39ad[_0x2c01('0x50')]=_[_0x2c01('0x54')](db[_0x2c01('0x68')][_0x2c01('0x4d')]);_0x4a39ad[_0x2c01('0x55')]=_[_0x2c01('0x54')](_0x29b38f[_0x2c01('0x55')]);_0x4a39ad[_0x2c01('0x5e')]=_[_0x2c01('0x57')](_0x4a39ad[_0x2c01('0x50')],_0x4a39ad[_0x2c01('0x55')]);_0x106cf8[_0x2c01('0x56')]=_[_0x2c01('0x57')](_0x4a39ad[_0x2c01('0x50')],qs['fields'](_0x29b38f[_0x2c01('0x55')]['fields']));_0x106cf8[_0x2c01('0x56')]=_0x106cf8[_0x2c01('0x56')][_0x2c01('0x59')]?_0x106cf8[_0x2c01('0x56')]:_0x4a39ad[_0x2c01('0x50')];_0x106cf8[_0x2c01('0xce')]=qs[_0x2c01('0x5c')](_0x29b38f['query'][_0x2c01('0x5c')]);_0x106cf8[_0x2c01('0x5d')]=qs[_0x2c01('0x5e')](_[_0x2c01('0x5f')](_0x29b38f[_0x2c01('0x55')],_0x4a39ad['filters']));if(_0x29b38f[_0x2c01('0x55')][_0x2c01('0x66')]){_0x106cf8[_0x2c01('0x5d')]=_['merge'](_0x106cf8['where'],{'$or':_[_0x2c01('0x4c')](_0x106cf8['attributes'],function(_0x3f9096){var _0x55f43d={};_0x55f43d[_0x3f9096]={'$like':'%'+_0x29b38f[_0x2c01('0x55')]['filter']+'%'};return _0x55f43d;})});}_0x106cf8[_0x2c01('0x50')]=db[_0x2c01('0x68')];_0x106cf8['as']=_0x2c01('0x9a');_0x106cf8=_[_0x2c01('0x60')]({},_0x106cf8,_0x29b38f[_0x2c01('0x67')]);return _0x1f6178[_0x2c01('0xef')]({'include':[_0x106cf8]});}})['then'](function(_0x182aee){if(_0x182aee){var _0x441f5d={},_0x58ef3f=[],_0x13a8c7=0x0;for(var _0x2cc907=0x0;_0x2cc907<_0x182aee['length'];_0x2cc907+=0x1){for(var _0xc2c31b=0x0,_0xacb478;_0xc2c31b<_0x182aee[_0x2cc907]['Agents'][_0x2c01('0x59')];_0xc2c31b+=0x1){_0xacb478=_0x182aee[_0x2cc907]['Agents'][_0xc2c31b][_0x2c01('0x3d')]({'plain':!![]});_0x441f5d[_0xacb478['id']]=_0xacb478;}}_0x441f5d=_[_0x2c01('0x12b')](_0x441f5d);for(var _0x2953e0=qs[_0x2c01('0x33')](_0x29b38f[_0x2c01('0x55')][_0x2c01('0x33')]);_0x2953e0<_0x441f5d[_0x2c01('0x59')]&&_0x58ef3f[_0x2c01('0x59')]=_0x43918a){_0x20c158=_0x43918a;_0x4663b4=0xc8;}else{_0x4663b4=0xce;}_0xcd5f20[_0x4f98('0x28')](_0x4663b4);return _0xcd5f20[_0x4f98('0x2e')](_0x4f98('0x2f'),_0x5563d0+'-'+_0x20c158+'/'+_0x43918a)[_0x4f98('0x2a')](_0x5b0d2a);}return null;};}function patchUpdates(_0x3bbaf4){return function(_0x4f956f){try{jsonpatch[_0x4f98('0x30')](_0x4f956f,_0x3bbaf4,!![]);}catch(_0x7bd913){return BPromise[_0x4f98('0x31')](_0x7bd913);}return _0x4f956f[_0x4f98('0x32')]();};}function saveUpdates(_0x5baf02,_0x1a88fe){return function(_0x705178){if(_0x705178){return _0x705178[_0x4f98('0x33')](_0x5baf02)[_0x4f98('0x34')](function(_0x5065ee){return _0x5065ee;});}return null;};}function removeEntity(_0x6aafa9,_0x246bef){return function(_0x533661){if(_0x533661){return _0x533661['destroy']()[_0x4f98('0x34')](function(){var _0x62bdbb=_0x533661[_0x4f98('0x35')]({'plain':!![]});if(_0x62bdbb[_0x4f98('0x36')]===_0x4f98('0x37'))return;var _0x5c5c4a=[{'name':'Users','value':_0x4f98('0x38'),'ignore':!![]},{'name':'Agents','value':_0x4f98('0x39'),'ignore':![]},{'name':_0x4f98('0x3a'),'value':'telephone','ignore':![]}];var _0x5429bb=_(_0x5c5c4a)[_0x4f98('0x3b')](_0x4f98('0x3c'))['map'](_0x4f98('0x3d'))[_0x4f98('0x3d')]();if(_[_0x4f98('0x3e')](_0x5429bb,_0x62bdbb[_0x4f98('0x36')])){return;}var _0x2ae0c4=_['find'](_0x5c5c4a,[_0x4f98('0x3d'),_0x62bdbb[_0x4f98('0x36')]])[_0x4f98('0x3f')];return db['UserProfileResource'][_0x4f98('0x40')]({'where':{'type':_0x2ae0c4,'resourceId':_0x62bdbb['id']}})[_0x4f98('0x34')](function(){return _0x533661;});})[_0x4f98('0x34')](function(){_0x6aafa9[_0x4f98('0x28')](0xcc)[_0x4f98('0x29')]();});}};}function handleEntityNotFound(_0x892b2b,_0xaae01){return function(_0x5f5ccb){if(!_0x5f5ccb){_0x892b2b[_0x4f98('0x27')](0x194);}return _0x5f5ccb;};}function handleError(_0x4fcc54,_0x469bfc){_0x469bfc=_0x469bfc||0x1f4;return function(_0x3b15b1){logger['error'](_0x3b15b1[_0x4f98('0x41')]);if(_0x3b15b1[_0x4f98('0x3f')]){delete _0x3b15b1[_0x4f98('0x3f')];}_0x4fcc54['status'](_0x469bfc)[_0x4f98('0x42')](_0x3b15b1);};}exports[_0x4f98('0x43')]=function(_0x202fd2,_0x3d813b){var _0x22dc6f={},_0x5f2516={},_0x43f4f4={'count':0x0,'rows':[]};var _0x204fe6=_[_0x4f98('0x44')](db['User'][_0x4f98('0x45')],function(_0x216859){return{'name':_0x216859[_0x4f98('0x46')],'type':_0x216859[_0x4f98('0x47')]['key']};});_0x5f2516['model']=_[_0x4f98('0x48')](_[_0x4f98('0x44')](_0x204fe6,'name'),['password',_0x4f98('0x49')]);_0x5f2516[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x202fd2['query']);_0x5f2516[_0x4f98('0x4c')]=_['intersection'](_0x5f2516[_0x4f98('0x4d')],_0x5f2516[_0x4f98('0x4a')]);_0x22dc6f[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x5f2516['model'],qs[_0x4f98('0x50')](_0x202fd2[_0x4f98('0x4a')]['fields']));_0x22dc6f[_0x4f98('0x4e')]=_0x22dc6f[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x22dc6f[_0x4f98('0x4e')]:_0x5f2516[_0x4f98('0x4d')];if(!_0x202fd2[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x22dc6f['limit']=qs[_0x4f98('0x2d')](_0x202fd2[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x22dc6f['offset']=qs[_0x4f98('0x2c')](_0x202fd2[_0x4f98('0x4a')]['offset']);}_0x22dc6f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x202fd2[_0x4f98('0x4a')]['sort']);_0x22dc6f[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x202fd2[_0x4f98('0x4a')],_0x5f2516[_0x4f98('0x4c')]),_0x204fe6);if(_0x202fd2['query'][_0x4f98('0x3b')]){_0x22dc6f['where']=_[_0x4f98('0x57')](_0x22dc6f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x204fe6,function(_0x378c16){if(_0x378c16[_0x4f98('0x47')]!=='VIRTUAL'){return db[_0x4f98('0x58')][_0x4f98('0x55')](db[_0x4f98('0x58')]['fn'](_0x4f98('0x59'),db['sequelize'][_0x4f98('0x5a')](_0x378c16[_0x4f98('0x3f')])),{'$like':db[_0x4f98('0x58')]['fn'](_0x4f98('0x59'),'%'+_0x202fd2[_0x4f98('0x4a')]['filter']+'%')});}})});}_0x22dc6f=_['merge']({},_0x22dc6f,_0x202fd2[_0x4f98('0x5b')]);var _0x17e550={'where':_0x22dc6f[_0x4f98('0x55')]};return db[_0x4f98('0x5c')][_0x4f98('0x2b')](_0x17e550)[_0x4f98('0x34')](function(_0x171da8){_0x43f4f4['count']=_0x171da8;if(_0x202fd2['query'][_0x4f98('0x5d')]){_0x22dc6f[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0x5c')][_0x4f98('0x5f')](_0x22dc6f);})['then'](function(_0x187c47){_0x43f4f4['rows']=_0x187c47;return _0x43f4f4;})['then'](respondWithFilteredResult(_0x3d813b,_0x22dc6f))['catch'](handleError(_0x3d813b,null));};exports[_0x4f98('0x60')]=function(_0x3d0870,_0x4ef8b4){var _0xa97608={'raw':![],'where':{'id':_0x3d0870['params']['id']}},_0x171da2={};_0x171da2[_0x4f98('0x4d')]=_[_0x4f98('0x48')](_[_0x4f98('0x4b')](db[_0x4f98('0x5c')][_0x4f98('0x45')]),[_0x4f98('0x61'),_0x4f98('0x49')]);_0x171da2['query']=_[_0x4f98('0x4b')](_0x3d0870[_0x4f98('0x4a')]);_0x171da2['filters']=_[_0x4f98('0x4f')](_0x171da2['model'],_0x171da2[_0x4f98('0x4a')]);_0xa97608[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x171da2[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x3d0870[_0x4f98('0x4a')][_0x4f98('0x50')]));_0xa97608[_0x4f98('0x4e')]=_0xa97608['attributes'][_0x4f98('0x51')]?_0xa97608[_0x4f98('0x4e')]:_0x171da2[_0x4f98('0x4d')];if(_0x3d0870[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0xa97608[_0x4f98('0x5e')]=[{'all':!![]}];}_0xa97608=_[_0x4f98('0x57')]({},_0xa97608,_0x3d0870[_0x4f98('0x5b')]);return db['User'][_0x4f98('0x62')](_0xa97608)[_0x4f98('0x34')](handleEntityNotFound(_0x4ef8b4,null))[_0x4f98('0x34')](respondWithResult(_0x4ef8b4,null))[_0x4f98('0x63')](handleError(_0x4ef8b4,null));};exports['update']=function(_0x3a2dfa,_0x2964c4){if(_0x3a2dfa[_0x4f98('0x64')]['id']){delete _0x3a2dfa['body']['id'];}delete _0x3a2dfa[_0x4f98('0x64')][_0x4f98('0x36')];return db['User'][_0x4f98('0x62')]({'where':{'id':_0x3a2dfa[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x2964c4,null))[_0x4f98('0x34')](saveUpdates(_0x3a2dfa['body'],null))[_0x4f98('0x34')](respondWithResult(_0x2964c4,null))[_0x4f98('0x63')](handleError(_0x2964c4,null));};exports[_0x4f98('0x66')]=function(_0x1b8988,_0x44af94){return db[_0x4f98('0x5c')][_0x4f98('0x66')]()[_0x4f98('0x34')](respondWithResult(_0x44af94,null))[_0x4f98('0x63')](handleError(_0x44af94,null));};exports['addContacts']=function(_0x3450b6,_0x151524,_0x2e3c6f){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x3450b6[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x151524,null))[_0x4f98('0x34')](function(_0x3bae37){if(_0x3bae37){return _0x3bae37[_0x4f98('0x67')](_0x3450b6[_0x4f98('0x64')][_0x4f98('0x68')],_[_0x4f98('0x69')](_0x3450b6[_0x4f98('0x64')],[_0x4f98('0x68'),'id'])||{});}})[_0x4f98('0x34')](respondWithResult(_0x151524,null))[_0x4f98('0x63')](handleError(_0x151524,null));};function validateUser(_0x4d3309){return new BPromise(function(_0xfc1e20,_0x324932){if(_0x4d3309['internal'])return _0xfc1e20(_0x4d3309);return db['Setting'][_0x4f98('0x6a')](0x1)['then'](function(_0x4ba692){if(_0x4ba692[_0x4f98('0x6b')])authService[_0x4f98('0x6c')](_0x4d3309[_0x4f98('0x61')]);db[_0x4f98('0x5c')]['max'](_0x4f98('0x6d'))[_0x4f98('0x34')](function(_0x5a165b){if(_['isNil'](_0x5a165b)){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692[_0x4f98('0x6e')]||0x1;return;}if(_[_0x4f98('0x6f')](_0x4ba692[_0x4f98('0x6e')])||_0x4ba692[_0x4f98('0x6e')]===_0x5a165b){_0x4d3309[_0x4f98('0x6d')]=_0x5a165b+0x1;return;}if(_0x4ba692['min_internal']>_0x5a165b){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692[_0x4f98('0x6e')];return;}return db[_0x4f98('0x58')]['query'](_0x4f98('0x70'),{'type':db[_0x4f98('0x58')][_0x4f98('0x71')][_0x4f98('0x72')]})['then'](function(_0x38d96a){if(_0x38d96a&&_0x38d96a[_0x4f98('0x51')]){for(var _0x4d8bf6=0x0,_0x5e9bcd=_0x38d96a['length'];_0x4d8bf6<_0x5e9bcd&&_[_0x4f98('0x6f')](_0x4d3309['internal']);_0x4d8bf6++){if(_0x4ba692['min_internal']<=_0x38d96a[_0x4d8bf6][_0x4f98('0x73')]){_0x4d3309[_0x4f98('0x6d')]=_0x38d96a[_0x4d8bf6][_0x4f98('0x73')];}else if(_0x4ba692[_0x4f98('0x6e')]>_0x38d96a[_0x4d8bf6][_0x4f98('0x73')]&&_0x4ba692['min_internal']<=_0x38d96a[_0x4d8bf6]['to']){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692['min_internal'];}}}if(_[_0x4f98('0x6f')](_0x4d3309['internal'])){_0x4d3309['internal']=_0x5a165b+0x1;}return _0xfc1e20(_0x4d3309);});});})[_0x4f98('0x63')](function(_0x44c13f){_0x324932(_0x44c13f);});});}function updateUser(_0x2ed50b){return new BPromise(function(_0x44b5a6,_0x583239){try{if(_0x2ed50b[_0x4f98('0x74')]){_0x2ed50b[_0x4f98('0x75')]=_0x2ed50b[_0x4f98('0x6d')];_0x2ed50b[_0x4f98('0x76')]={'mailbox':_0x2ed50b[_0x4f98('0x6d')],'password':_0x2ed50b[_0x4f98('0x61')],'fullname':_0x2ed50b['fullname'],'email':_0x2ed50b[_0x4f98('0x77')]};}if(_0x2ed50b['role']===_0x4f98('0x39')){if(!_0x2ed50b[_0x4f98('0x78')])_0x2ed50b[_0x4f98('0x78')]=[_0x4f98('0x79'),_0x4f98('0x7a'),'103',_0x4f98('0x7b'),'110',_0x4f98('0x7c'),_0x4f98('0x7d'),_0x4f98('0x7e'),_0x4f98('0x7f'),_0x4f98('0x80'),_0x4f98('0x81'),'100',_0x4f98('0x82'),_0x4f98('0x83')];}_0x44b5a6(_0x2ed50b);}catch(_0x305feb){_0x583239(_0x305feb);}});}exports['create']=function(_0x5f4881,_0xc19bd6){if(_0x5f4881['user'][_0x4f98('0x36')]===_0x4f98('0x39'))throw new Error(_0x4f98('0x84'));if(_0x5f4881[_0x4f98('0x64')][_0x4f98('0x36')]===_0x4f98('0x38')&&_0x5f4881[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x37')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5f4881['body']['role']===_0x4f98('0x37')&&_0x5f4881[_0x4f98('0x38')]['role']!==_0x4f98('0x37')){throw new Error(_0x4f98('0x85'));}return licenseUtil[_0x4f98('0x86')]([_0x5f4881[_0x4f98('0x64')]])[_0x4f98('0x34')](function(){return validateUser(_0x5f4881['body']);})[_0x4f98('0x34')](function(_0x5e2f5f){return updateUser(_0x5e2f5f)['then'](function(_0x3a79c){if(_0x3a79c['role']==='admin'){_0x3a79c[_0x4f98('0x87')]=_0x5f4881['user']['settingsEnabled'];delete _0x3a79c[_0x4f98('0x88')];}return _0x3a79c;});})[_0x4f98('0x34')](function(_0x3389f2){return db['User'][_0x4f98('0x89')](_0x3389f2,{'include':[{'model':db['VoiceMail'],'as':_0x4f98('0x76')}]});})[_0x4f98('0x34')](function(_0xe4bb65){if(_0x5f4881[_0x4f98('0x64')][_0x4f98('0x36')]===_0x4f98('0x38'))return _0xe4bb65;if(_0x5f4881[_0x4f98('0x38')]['role']!==_0x4f98('0x38'))return _0xe4bb65;return db[_0x4f98('0x8a')][_0x4f98('0x62')]({'where':{'name':_0xe4bb65[_0x4f98('0x36')]===_0x4f98('0x39')?_0x4f98('0x8b'):_0x4f98('0x3a'),'userProfileId':_0x5f4881[_0x4f98('0x38')]['userProfileId']},'raw':!![]})[_0x4f98('0x34')](function(_0x300419){if(!_0x300419||_0x300419[_0x4f98('0x8c')]!=0x0)return _0xe4bb65;return db[_0x4f98('0x8d')][_0x4f98('0x89')]({'name':_0xe4bb65[_0x4f98('0x3f')],'resourceId':_0xe4bb65['id'],'type':_0x300419[_0x4f98('0x3f')],'sectionId':_0x300419['id']},{})['then'](function(){return _0xe4bb65;});})['catch'](function(_0x500fac){logger[_0x4f98('0x23')](_0x4f98('0x8e'),_0x500fac);throw _0x500fac;});})['then'](respondWithResult(_0xc19bd6,0xc9))[_0x4f98('0x63')](handleError(_0xc19bd6,null));};exports[_0x4f98('0x8f')]=function(_0x50517c,_0x266b9d){var _0x180f52=_0x50517c[_0x4f98('0x64')];var _0xd79545=[];if(_0x50517c['user'][_0x4f98('0x36')]==='agent')throw new Error(_0x4f98('0x84'));if(_['some'](_0x180f52,[_0x4f98('0x36'),_0x4f98('0x38')])&&_0x50517c[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x37')){throw new Error(_0x4f98('0x90'));}if(_['some'](_0x180f52,[_0x4f98('0x36'),_0x4f98('0x37')])&&_0x50517c[_0x4f98('0x38')]['role']!==_0x4f98('0x37')){throw new Error(_0x4f98('0x91'));}return licenseUtil[_0x4f98('0x86')](_0x180f52)[_0x4f98('0x34')](function(){return validateUser(_0x180f52[0x0]);})[_0x4f98('0x34')](function(){for(var _0x19bb9f=0x1;_0x19bb9f<_0x180f52['length'];_0x19bb9f++){var _0xa21148=_0x180f52[_0x19bb9f-0x1][_0x4f98('0x6d')];if(!_0x180f52[_0x19bb9f][_0x4f98('0x6d')])_0x180f52[_0x19bb9f][_0x4f98('0x6d')]=_0xa21148+0x1;_0xd79545[_0x4f98('0x92')](validateUser(_0x180f52[_0x19bb9f]));}return BPromise[_0x4f98('0x93')](_0xd79545);})[_0x4f98('0x34')](function(){_0xd79545=[];for(var _0xf5001a=0x0;_0xf5001a<_0x180f52['length'];_0xf5001a++){_0xd79545[_0x4f98('0x92')](updateUser(_0x180f52[_0xf5001a]));}return BPromise[_0x4f98('0x93')](_0xd79545);})[_0x4f98('0x34')](function(){return BPromise['each'](_0x180f52,function(_0xbba2d9){return db[_0x4f98('0x5c')]['create'](_0xbba2d9,{'include':[{'model':db[_0x4f98('0x76')],'as':_0x4f98('0x76')}]})[_0x4f98('0x34')](function(_0x4f08b2){_0xbba2d9['id']=_0x4f08b2['id'];return _0xbba2d9;});});})[_0x4f98('0x34')](function(_0x468f25){if(_0x50517c[_0x4f98('0x64')][_0x4f98('0x36')]==='user')return _0x468f25;if(_0x50517c[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x38'))return _0x468f25;var _0x1b46a6=_[_0x4f98('0x94')](_0x468f25,function(_0x32b157){return _0x32b157[_0x4f98('0x36')]===_0x4f98('0x39')||_0x32b157['role']===_0x4f98('0x95');});if(!_0x1b46a6)return _0x468f25;return db[_0x4f98('0x8a')][_0x4f98('0x5f')]({'where':{'name':{'$or':[_0x4f98('0x8b'),'Telephones']},'userProfileId':_0x50517c['user'][_0x4f98('0x88')]},'raw':!![]})[_0x4f98('0x34')](function(_0x37c669){if(_[_0x4f98('0x96')](_0x37c669)||!_[_0x4f98('0x94')](_0x37c669,[_0x4f98('0x8c'),0x0]))return _0x468f25;_0xd79545=[];var _0x7d5a5f=_(_0x37c669)[_0x4f98('0x44')](function(_0x4c2257){if(_0x4c2257['autoAssociation']===0x1)return;return _0x4c2257[_0x4f98('0x3f')]===_0x4f98('0x8b')?_0x4f98('0x39'):_0x4f98('0x95');})[_0x4f98('0x97')]()[_0x4f98('0x3d')]();for(var _0x235309=0x0;_0x235309<_0x468f25[_0x4f98('0x51')];_0x235309++){if(!_[_0x4f98('0x3e')](_0x7d5a5f,_0x468f25[_0x235309][_0x4f98('0x36')]))return;var _0xd79bb7=_0x468f25[_0x235309]['role']===_0x4f98('0x39')?_0x4f98('0x8b'):_0x4f98('0x3a');_0xd79545[_0x4f98('0x92')](db['UserProfileResource'][_0x4f98('0x89')]({'name':_0x468f25[_0x235309][_0x4f98('0x3f')],'resourceId':_0x468f25[_0x235309]['id'],'type':_0xd79bb7,'sectionId':_[_0x4f98('0x62')](_0x37c669,[_0x4f98('0x3f'),_0xd79bb7])['id']},{}));}return BPromise[_0x4f98('0x93')](_0xd79545);})['then'](respondWithResult(_0x266b9d,0xc9))[_0x4f98('0x63')](handleError(_0x266b9d,null));});};exports[_0x4f98('0x98')]=function(_0x48407d,_0x383a82,_0x40884a){if(_0x48407d[_0x4f98('0x64')]['id']){delete _0x48407d[_0x4f98('0x64')]['id'];}return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x48407d[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](function(_0x52c5c6){if(!_0x52c5c6)return null;if(_0x52c5c6['id']===_0x48407d['user']['id']){if(!_0x48407d[_0x4f98('0x64')]['oldPassword']||!_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x52c5c6[_0x4f98('0x9b')](_0x48407d[_0x4f98('0x64')][_0x4f98('0x9c')])){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9d'));}if(_0x48407d[_0x4f98('0x64')]['oldPassword']===_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))]['ValidationError'](_0x4f98('0x9e'));}}else if(_0x48407d[_0x4f98('0x38')][_0x4f98('0x36')]===_0x4f98('0x37')){if(!_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9f'));}}else if(_0x48407d['user'][_0x4f98('0x36')]===_0x4f98('0x38')){if(!_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')]){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9f'));}if(_0x52c5c6[_0x4f98('0x36')]!==_0x4f98('0x39')){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x84'));}}else{throw new db['Sequelize'][(_0x4f98('0x9a'))](_0x4f98('0x84'));}return _0x52c5c6;})['then'](handleEntityNotFound(_0x383a82,null))[_0x4f98('0x34')](function(_0x1c0517){return db[_0x4f98('0xa1')]['findOne']({'attributes':['id',_0x4f98('0x6b'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x4f98('0x34')](function(_0x55e5d0){if(_0x55e5d0['securePassword'])authService[_0x4f98('0x6c')](_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')]);if(!_0x55e5d0[_0x4f98('0xa2')]||!_0x1c0517['previousPasswords'])return _0x1c0517;authService[_0x4f98('0xa3')](_0x48407d['body']['newPassword'],_0x1c0517[_0x4f98('0xa4')],_0x55e5d0[_0x4f98('0xa5')]);return _0x1c0517;})['then'](saveUpdates({'password':_0x48407d['body'][_0x4f98('0xa0')],'passwordResetAt':_0x48407d['user']['id']==_0x48407d[_0x4f98('0x65')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')],_0x1c0517[_0x4f98('0xa4')])},null));})['then'](respondWithResult(_0x383a82,null))[_0x4f98('0x63')](handleError(_0x383a82,null));};exports[_0x4f98('0xa6')]=function(_0xe81623,_0x8a6f04,_0x36bff5){var _0x409734=_0xe81623[_0x4f98('0x64')][_0x4f98('0xa7')];return db['User']['find']({'where':{'id':_0xe81623[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),'role',_0x4f98('0xa8'),_0x4f98('0xa9'),'voicePause',_0x4f98('0xaa')]})[_0x4f98('0x34')](handleEntityNotFound(_0x8a6f04,null))['then'](function(_0x33c7f8){if(_0x33c7f8){if(!utils[_0x4f98('0xab')](_0x409734)){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xac'));}return _0x33c7f8[_0x4f98('0xad')+_[_0x4f98('0xae')](_0x409734[_0x4f98('0xaf')]())+_0x4f98('0xb0')](_0xe81623['body'][_0x4f98('0x68')],{'penalty':_0xe81623['body']['penalty']||0x0})[_0x4f98('0xb1')](function(_0x757933){for(var _0x55ee7e=0x0;_0x55ee7e<_0xe81623[_0x4f98('0x64')]['ids']['length'];_0x55ee7e+=0x1){var _0x24b9d7={'UserId':_0xe81623[_0x4f98('0x65')]['id']};_0x24b9d7[_['capitalize'](_0x409734[_0x4f98('0xaf')]())+'QueueId']=_0xe81623[_0x4f98('0x64')][_0x4f98('0x68')][_0x55ee7e];socket['emit'](_0x4f98('0x38')+_['capitalize'](_0x409734['toLowerCase']())+_0x4f98('0xb2'),_0x24b9d7);}return _0x757933;})['then'](function(){if(_0x409734==='voice'){return db['VoiceQueue'][_0x4f98('0x5f')]({'where':{'id':_0xe81623[_0x4f98('0x64')][_0x4f98('0x68')]||[]},'raw':!![],'attributes':['id',_0x4f98('0x3f')]});}})[_0x4f98('0x34')](function(_0x3df862){var _0x30b3bf=_0x33c7f8[_0x4f98('0x35')]({'plain':!![]});var _0x5d61b2=[];if(_0x409734==='voice'&&_0x30b3bf['role']===_0x4f98('0x39')&&_0x30b3bf[_0x4f98('0xa8')]){for(var _0xe01a1=0x0;_0xe01a1<_0x3df862['length'];_0xe01a1+=0x1){_0x5d61b2['push']({'membername':_0x30b3bf[_0x4f98('0x3f')],'UserId':_0x30b3bf['id'],'queue_name':_0x3df862[_0xe01a1][_0x4f98('0x3f')],'VoiceQueueId':_0x3df862[_0xe01a1]['id'],'interface':_[_0x4f98('0x6f')](_0x30b3bf[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x30b3bf[_0x4f98('0x3f')]):_0x30b3bf['interface'],'paused':_0x30b3bf['voicePause']||![],'penalty':_0xe81623[_0x4f98('0x64')][_0x4f98('0xb5')]||0x0});}return BPromise[_0x4f98('0xb6')](_0x5d61b2,function(_0xa6c03d){return db[_0x4f98('0xb7')][_0x4f98('0xb8')](_0xa6c03d);});}return _0x33c7f8;});}})[_0x4f98('0x34')](respondWithStatusCode(_0x8a6f04,null))[_0x4f98('0x63')](handleError(_0x8a6f04,null));};exports[_0x4f98('0xb9')]=function(_0x34b676,_0x14a100,_0x321845){var _0x42170d;return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x34b676[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36')]})[_0x4f98('0x34')](handleEntityNotFound(_0x14a100,null))[_0x4f98('0x34')](function(_0x438ecf){if(_0x438ecf){_0x42170d=_0x438ecf;if(!_0x34b676['query']['channel']||!utils[_0x4f98('0xab')](_0x34b676[_0x4f98('0x4a')][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))]['ValidationError']('Unknown\x20channel');}return _0x438ecf[_0x4f98('0xba')+_['capitalize'](_0x34b676['query'][_0x4f98('0xa7')][_0x4f98('0xaf')]())+_0x4f98('0xb0')](_0x34b676[_0x4f98('0x4a')][_0x4f98('0x68')]);}})['then'](function(_0x4a8324){for(var _0x1c0fbb=0x0;_0x1c0fbb<_0x34b676[_0x4f98('0x4a')][_0x4f98('0x68')]['length'];_0x1c0fbb+=0x1){var _0x2619cd={'UserId':_0x34b676['params']['id']};_0x2619cd[_[_0x4f98('0xae')](_0x34b676['query'][_0x4f98('0xa7')]['toLowerCase']())+_0x4f98('0xbb')]=_0x34b676[_0x4f98('0x4a')]['ids'][_0x1c0fbb];socket[_0x4f98('0xbc')](_0x4f98('0x38')+_['capitalize'](_0x34b676['query']['channel'][_0x4f98('0xaf')]())+_0x4f98('0xbd'),_0x2619cd);}return _0x4a8324;})['then'](function(){if(_0x34b676[_0x4f98('0x4a')]['channel']===_0x4f98('0xbe')){return db['UserVoiceQueueRt'][_0x4f98('0x40')]({'where':{'UserId':_0x34b676[_0x4f98('0x65')]['id'],'VoiceQueueId':_0x34b676['query'][_0x4f98('0x68')]},'individualHooks':!![]})[_0x4f98('0x34')](function(){return _0x42170d;});}return _0x42170d;})[_0x4f98('0x34')](respondWithStatusCode(_0x14a100,null))[_0x4f98('0x63')](handleError(_0x14a100,null));};exports[_0x4f98('0xbf')]=function(_0x4bbacc,_0xf962ce,_0xf68429){_0x4bbacc[_0x4f98('0x64')][_0x4f98('0xc0')]=_0x4bbacc['file']['filename'];return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x4bbacc['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xf962ce,null))[_0x4f98('0x34')](saveUpdates(_0x4bbacc[_0x4f98('0x64')],null))['then'](respondWithResult(_0xf962ce,null))['catch'](handleError(_0xf962ce,null));};exports[_0x4f98('0xc1')]=function(_0x4260ad,_0x3235f1,_0x5e5e9f){var _0x16274e=path[_0x4f98('0xc2')](config[_0x4f98('0xc3')],_0x4f98('0xc4'));return db[_0x4f98('0x5c')]['find']({'where':{'id':_0x4260ad[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0xc0')],'raw':!![]})[_0x4f98('0x34')](handleEntityNotFound(_0x3235f1,null))[_0x4f98('0x34')](function(_0x50ec1d){if(_0x50ec1d){if(_['isNil'](_0x50ec1d[_0x4f98('0xc0')])){return _0x3235f1[_0x4f98('0xc5')](_0x16274e);}else{if(!fs[_0x4f98('0xc6')](path[_0x4f98('0xc2')](config['root'],_0x4f98('0xc7'),_0x50ec1d[_0x4f98('0xc0')]))){return _0x3235f1['download'](_0x16274e);}return _0x3235f1[_0x4f98('0xc5')](path[_0x4f98('0xc2')](config[_0x4f98('0xc3')],'server/files/images/',_0x50ec1d['userpic']));}}})[_0x4f98('0x63')](handleError(_0x3235f1,null));};exports[_0x4f98('0xc8')]=function(_0x35540b,_0x32c863,_0x550ab8){var _0x4a4a70={};var _0x17560c={};var _0x5b2ea2;var _0x5871fc;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x35540b[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x32c863,null))[_0x4f98('0x34')](function(_0x35693c){if(_0x35693c){_0x5b2ea2=_0x35693c;_0x17560c['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xca')][_0x4f98('0x45')]);_0x17560c[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x35540b['query']);_0x17560c[_0x4f98('0x4c')]=_['intersection'](_0x17560c[_0x4f98('0x4d')],_0x17560c['query']);_0x4a4a70[_0x4f98('0x4e')]=_['intersection'](_0x17560c[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x35540b[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4a4a70[_0x4f98('0x4e')]=_0x4a4a70[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4a4a70['attributes']:_0x17560c[_0x4f98('0x4d')];_0x4a4a70[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x35540b[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4a4a70[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x35540b[_0x4f98('0x4a')],_0x17560c[_0x4f98('0x4c')]));if(_0x35540b[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4a4a70[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4a4a70[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4a4a70['attributes'],function(_0x486bb9){var _0xe45fef={};_0xe45fef[_0x486bb9]={'$like':'%'+_0x35540b[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0xe45fef;})});}_0x4a4a70=_[_0x4f98('0x57')]({},_0x4a4a70,_0x35540b[_0x4f98('0x5b')]);return _0x5b2ea2[_0x4f98('0xc8')](_0x4a4a70);}})[_0x4f98('0x34')](function(_0xbd3a3e){if(_0xbd3a3e){_0x5871fc=_0xbd3a3e[_0x4f98('0x51')];if(_0x35540b[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x5d'))){_0x4a4a70[_0x4f98('0x5e')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x4f98('0xcb')],'as':_0x4f98('0xcc'),'attributes':['id','name',_0x4f98('0xcd')],'where':_0x35540b[_0x4f98('0x4a')]['tag']?{'id':_0x35540b[_0x4f98('0x4a')][_0x4f98('0xce')]}:undefined,'required':_0x35540b[_0x4f98('0x4a')][_0x4f98('0xce')]?!![]:![]}];}if(!_0x35540b['query']['hasOwnProperty'](_0x4f98('0x52'))){_0x4a4a70[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x35540b[_0x4f98('0x4a')]['limit']);_0x4a4a70[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x35540b['query']['offset']);}return _0x5b2ea2[_0x4f98('0xc8')](_0x4a4a70);}})['then'](function(_0x2437eb){if(_0x2437eb){return _0x2437eb?{'count':_0x5871fc,'rows':_0x2437eb}:null;}})['then'](respondWithResult(_0x32c863,null))['catch'](handleError(_0x32c863,null));};exports[_0x4f98('0xcf')]=function(_0x4fc617,_0x159f7d,_0xa6a7a1){var _0x103867;var _0x21ba23;var _0x4b324f={};var _0x2a8be6;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x4fc617[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36')]})[_0x4f98('0x34')](handleEntityNotFound(_0x159f7d,null))[_0x4f98('0x34')](function(_0x32e147){if(!utils[_0x4f98('0xab')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))]['ValidationError'](_0x4f98('0xac'));}_0x103867=_0x32e147;var _0x552bb4={};_0x552bb4['model']=_['keys'](db[_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')]['channel'])+'Queue'][_0x4f98('0x45')]);_0x552bb4[_0x4f98('0x4a')]=_['keys'](_0x4fc617[_0x4f98('0x4a')]);_0x552bb4[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x552bb4[_0x4f98('0x4d')],_0x552bb4[_0x4f98('0x4a')]);_0x4b324f[_0x4f98('0x4e')]=_['intersection'](_0x552bb4[_0x4f98('0x4d')],qs['fields'](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4b324f[_0x4f98('0x4e')]=_0x4b324f[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4b324f['attributes']:_0x552bb4[_0x4f98('0x4d')];_0x4b324f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x4fc617[_0x4f98('0x4a')]['sort']);_0x4b324f['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x4fc617['query'],_0x552bb4['filters']));if(_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4b324f[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4b324f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4b324f[_0x4f98('0x4e')],function(_0x283432){var _0x1134f5={};_0x1134f5[_0x283432]={'$like':'%'+_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1134f5;})});}_0x4b324f=_[_0x4f98('0x57')]({},_0x4b324f,_0x4fc617[_0x4f98('0x5b')]);switch(_0x103867['role']){case _0x4f98('0x37'):return db[_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])+'Queue'][_0x4f98('0x5f')](_0x4b324f);case'user':case _0x4f98('0x39'):return _0x103867[_0x4f98('0x35')+_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])+_0x4f98('0xb0')](_0x4b324f);default:throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xd0'));}})[_0x4f98('0x34')](function(_0x543d69){_0x2a8be6=_0x543d69[_0x4f98('0x51')];if(!_0x4fc617[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x4b324f[_0x4f98('0x2d')]=qs['limit'](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4b324f['offset']=qs[_0x4f98('0x2c')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x2c')]);}switch(_0x103867[_0x4f98('0x36')]){case'admin':return db[_[_0x4f98('0xae')](_0x4fc617['query'][_0x4f98('0xa7')])+_0x4f98('0xd1')][_0x4f98('0x5f')](_0x4b324f);case _0x4f98('0x38'):case _0x4f98('0x39'):return _0x103867[_0x4f98('0x35')+_['capitalize'](_0x4fc617['query'][_0x4f98('0xa7')])+_0x4f98('0xb0')](_0x4b324f);}})[_0x4f98('0x34')](function(_0x1236aa){return{'count':_0x2a8be6,'rows':_0x1236aa};})[_0x4f98('0x34')](respondWithResult(_0x159f7d,null))[_0x4f98('0x63')](handleError(_0x159f7d,null));};exports['getVoiceQueuesRt']=function(_0x508934,_0xe06674,_0x1f34d2){var _0x526ff0={};var _0xfe05d8={};var _0x5d92dc;var _0x4d36d3;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x508934[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xe06674,null))[_0x4f98('0x34')](function(_0x39fc44){if(_0x39fc44){_0x5d92dc=_0x39fc44;_0xfe05d8[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xb7')]['rawAttributes']);_0xfe05d8['query']=_['keys'](_0x508934['query']);_0xfe05d8[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0xfe05d8[_0x4f98('0x4d')],_0xfe05d8['query']);_0x526ff0[_0x4f98('0x4e')]=_['intersection'](_0xfe05d8['model'],qs[_0x4f98('0x50')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x526ff0[_0x4f98('0x4e')]=_0x526ff0[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x526ff0[_0x4f98('0x4e')]:_0xfe05d8['model'];_0x526ff0[_0x4f98('0x53')]=qs['sort'](_0x508934[_0x4f98('0x4a')]['sort']);_0x526ff0[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x508934[_0x4f98('0x4a')],_0xfe05d8[_0x4f98('0x4c')]));if(_0x508934[_0x4f98('0x4a')]['filter']){_0x526ff0[_0x4f98('0x55')]=_['merge'](_0x526ff0[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x526ff0[_0x4f98('0x4e')],function(_0x215598){var _0x17c5fe={};_0x17c5fe[_0x215598]={'$like':'%'+_0x508934[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x17c5fe;})});}_0x526ff0=_['merge']({},_0x526ff0,_0x508934[_0x4f98('0x5b')]);return _0x5d92dc[_0x4f98('0xd2')](_0x526ff0);}})[_0x4f98('0x34')](function(_0x32dc8f){if(_0x32dc8f){_0x4d36d3=_0x32dc8f[_0x4f98('0x51')];if(!_0x508934[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x526ff0[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x526ff0[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x5d92dc[_0x4f98('0xd2')](_0x526ff0);}})[_0x4f98('0x34')](function(_0x3b66be){if(_0x3b66be){return _0x3b66be?{'count':_0x4d36d3,'rows':_0x3b66be}:null;}})['then'](respondWithResult(_0xe06674,null))[_0x4f98('0x63')](handleError(_0xe06674,null));};exports[_0x4f98('0xd4')]=function(_0x22bf56,_0x52af47,_0x23a861){var _0x5604dc={};var _0xf7c179={};var _0x1ff904;var _0xad2a0f;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x22bf56[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x52af47,null))['then'](function(_0x3f3eae){if(_0x3f3eae){_0x1ff904=_0x3f3eae;_0xf7c179[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xd5')][_0x4f98('0x45')]);_0xf7c179[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x22bf56[_0x4f98('0x4a')]);_0xf7c179['filters']=_[_0x4f98('0x4f')](_0xf7c179['model'],_0xf7c179[_0x4f98('0x4a')]);_0x5604dc['attributes']=_[_0x4f98('0x4f')](_0xf7c179[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x5604dc[_0x4f98('0x4e')]=_0x5604dc[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x5604dc['attributes']:_0xf7c179[_0x4f98('0x4d')];_0x5604dc[_0x4f98('0x53')]=qs['sort'](_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x5604dc[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x22bf56[_0x4f98('0x4a')],_0xf7c179[_0x4f98('0x4c')]));if(_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x5604dc['where']=_[_0x4f98('0x57')](_0x5604dc[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x5604dc[_0x4f98('0x4e')],function(_0x5757c7){var _0x2e61a7={};_0x2e61a7[_0x5757c7]={'$like':'%'+_0x22bf56['query'][_0x4f98('0x3b')]+'%'};return _0x2e61a7;})});}_0x5604dc=_[_0x4f98('0x57')]({},_0x5604dc,_0x22bf56[_0x4f98('0x5b')]);return _0x1ff904['getGroups'](_0x5604dc);}})['then'](function(_0x463602){if(_0x463602){_0xad2a0f=_0x463602[_0x4f98('0x51')];if(!_0x22bf56[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x5604dc[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x22bf56[_0x4f98('0x4a')]['limit']);_0x5604dc[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x22bf56[_0x4f98('0x4a')]['offset']);}return _0x1ff904[_0x4f98('0xd4')](_0x5604dc);}})[_0x4f98('0x34')](function(_0x849716){if(_0x849716){return _0x849716?{'count':_0xad2a0f,'rows':_0x849716}:null;}})['then'](respondWithResult(_0x52af47,null))[_0x4f98('0x63')](handleError(_0x52af47,null));};exports[_0x4f98('0xd6')]=function(_0x18bfd1,_0x543aa0,_0x57232c){var _0x364adc={'raw':!![],'where':{}};var _0x18453b={};var _0x277b20={'count':0x0,'rows':[]};return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x18bfd1[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x543aa0,null))[_0x4f98('0x34')](function(_0x4c4bce){if(_0x4c4bce){_0x18453b['model']=_['keys'](db[_0x4f98('0xd7')]['rawAttributes']);_0x18453b[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x18bfd1[_0x4f98('0x4a')]);_0x18453b[_0x4f98('0x4c')]=_['intersection'](_0x18453b[_0x4f98('0x4d')],_0x18453b[_0x4f98('0x4a')]);_0x364adc[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x18453b['model'],qs['fields'](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x364adc[_0x4f98('0x4e')]=_0x364adc[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x364adc[_0x4f98('0x4e')]:_0x18453b[_0x4f98('0x4d')];if(!_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x364adc[_0x4f98('0x2d')]=qs['limit'](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x364adc[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x2c')]);}_0x364adc[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x18bfd1[_0x4f98('0x4a')]['sort']);_0x364adc[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_['pick'](_0x18bfd1[_0x4f98('0x4a')],_0x18453b[_0x4f98('0x4c')]));_0x364adc[_0x4f98('0x55')][_0x4f98('0xd8')]=_0x4c4bce['id'];if(_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x364adc[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x364adc[_0x4f98('0x55')],{'$or':_['map'](_0x364adc[_0x4f98('0x4e')],function(_0x199ec8){var _0x2959fb={};_0x2959fb[_0x199ec8]={'$like':'%'+_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x2959fb;})});}_0x364adc=_[_0x4f98('0x57')]({},_0x364adc,_0x18bfd1[_0x4f98('0x5b')]);return db['VoiceRecording'][_0x4f98('0x2b')]({'where':_0x364adc[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x1f9621){_0x277b20['count']=_0x1f9621;if(_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0x364adc[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0xd7')][_0x4f98('0x5f')](_0x364adc);})[_0x4f98('0x34')](function(_0x561d73){_0x277b20[_0x4f98('0xd9')]=_0x561d73;return _0x277b20;});}})['then'](respondWithFilteredResult(_0x543aa0,_0x364adc))['catch'](handleError(_0x543aa0,null));};exports[_0x4f98('0xda')]=function(_0x22ebbe,_0x4670d5,_0x49c628){var _0xff2cab={'raw':!![],'where':{}};var _0x20c40c={};var _0x447f11={'count':0x0,'rows':[]};return db['User'][_0x4f98('0xc9')]({'where':{'id':_0x22ebbe[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x4670d5,null))[_0x4f98('0x34')](function(_0x173368){if(_0x173368){_0x20c40c[_0x4f98('0x4d')]=_['keys'](db['ScreenRecording'][_0x4f98('0x45')]);_0x20c40c['query']=_['keys'](_0x22ebbe[_0x4f98('0x4a')]);_0x20c40c[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x20c40c[_0x4f98('0x4d')],_0x20c40c[_0x4f98('0x4a')]);_0xff2cab[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x20c40c['model'],qs[_0x4f98('0x50')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x50')]));_0xff2cab[_0x4f98('0x4e')]=_0xff2cab['attributes']['length']?_0xff2cab['attributes']:_0x20c40c[_0x4f98('0x4d')];if(!_0x22ebbe['query']['hasOwnProperty'](_0x4f98('0x52'))){_0xff2cab[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0xff2cab[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x2c')]);}_0xff2cab[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x54')]);_0xff2cab[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x22ebbe['query'],_0x20c40c[_0x4f98('0x4c')]));_0xff2cab['where']['UserId']=_0x173368['id'];if(_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0xff2cab['where']=_['merge'](_0xff2cab[_0x4f98('0x55')],{'$or':_['map'](_0xff2cab[_0x4f98('0x4e')],function(_0x5b9059){var _0x9b84e2={};_0x9b84e2[_0x5b9059]={'$like':'%'+_0x22ebbe['query'][_0x4f98('0x3b')]+'%'};return _0x9b84e2;})});}_0xff2cab=_[_0x4f98('0x57')]({},_0xff2cab,_0x22ebbe[_0x4f98('0x5b')]);return db['ScreenRecording']['count']({'where':_0xff2cab[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x34a433){_0x447f11[_0x4f98('0x2b')]=_0x34a433;if(_0x22ebbe[_0x4f98('0x4a')]['includeAll']){_0xff2cab[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0xdb')][_0x4f98('0x5f')](_0xff2cab);})[_0x4f98('0x34')](function(_0x38e1cb){_0x447f11['rows']=_0x38e1cb;return _0x447f11;});}})[_0x4f98('0x34')](respondWithFilteredResult(_0x4670d5,_0xff2cab))['catch'](handleError(_0x4670d5,null));};exports[_0x4f98('0xdc')]=function(_0x3fc10f,_0x4a6176,_0xc200d6){var _0x32c68d={};var _0x20f3e5={};var _0x39640f;var _0x4f9e06;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x3fc10f[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4a6176,null))[_0x4f98('0x34')](function(_0xcf63e8){if(_0xcf63e8){_0x39640f=_0xcf63e8;_0x20f3e5[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xdd')]['rawAttributes']);_0x20f3e5['query']=_[_0x4f98('0x4b')](_0x3fc10f[_0x4f98('0x4a')]);_0x20f3e5['filters']=_[_0x4f98('0x4f')](_0x20f3e5['model'],_0x20f3e5['query']);_0x32c68d[_0x4f98('0x4e')]=_['intersection'](_0x20f3e5[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x32c68d['attributes']=_0x32c68d[_0x4f98('0x4e')]['length']?_0x32c68d[_0x4f98('0x4e')]:_0x20f3e5['model'];_0x32c68d[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x3fc10f[_0x4f98('0x4a')]['sort']);_0x32c68d[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x3fc10f[_0x4f98('0x4a')],_0x20f3e5['filters']));if(_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x32c68d['where']=_[_0x4f98('0x57')](_0x32c68d[_0x4f98('0x55')],{'$or':_['map'](_0x32c68d[_0x4f98('0x4e')],function(_0x1b425c){var _0x4a462f={};_0x4a462f[_0x1b425c]={'$like':'%'+_0x3fc10f[_0x4f98('0x4a')]['filter']+'%'};return _0x4a462f;})});}_0x32c68d=_[_0x4f98('0x57')]({},_0x32c68d,_0x3fc10f[_0x4f98('0x5b')]);return _0x39640f[_0x4f98('0xdc')](_0x32c68d);}})[_0x4f98('0x34')](function(_0xe175c6){if(_0xe175c6){_0x4f9e06=_0xe175c6[_0x4f98('0x51')];if(!_0x3fc10f[_0x4f98('0x4a')]['hasOwnProperty']('nolimit')){_0x32c68d['limit']=qs['limit'](_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x32c68d[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x3fc10f['query'][_0x4f98('0x2c')]);}return _0x39640f['getChatInteractions'](_0x32c68d);}})['then'](function(_0x2b0e06){if(_0x2b0e06){return _0x2b0e06?{'count':_0x4f9e06,'rows':_0x2b0e06}:null;}})[_0x4f98('0x34')](respondWithResult(_0x4a6176,null))[_0x4f98('0x63')](handleError(_0x4a6176,null));};exports[_0x4f98('0xde')]=function(_0x51baa2,_0x24751a,_0x5ad09c){var _0x2592f2={};var _0x4bc7e5={};var _0x365cd4;var _0x1fca50;return db['User'][_0x4f98('0xc9')]({'where':{'id':_0x51baa2[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x24751a,null))[_0x4f98('0x34')](function(_0x40063b){if(_0x40063b){_0x365cd4=_0x40063b;_0x4bc7e5['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xdf')][_0x4f98('0x45')]);_0x4bc7e5[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x51baa2[_0x4f98('0x4a')]);_0x4bc7e5[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x4bc7e5[_0x4f98('0x4d')],_0x4bc7e5['query']);_0x2592f2[_0x4f98('0x4e')]=_['intersection'](_0x4bc7e5[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x2592f2[_0x4f98('0x4e')]=_0x2592f2['attributes'][_0x4f98('0x51')]?_0x2592f2[_0x4f98('0x4e')]:_0x4bc7e5[_0x4f98('0x4d')];_0x2592f2[_0x4f98('0x53')]=qs['sort'](_0x51baa2[_0x4f98('0x4a')]['sort']);_0x2592f2[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x51baa2['query'],_0x4bc7e5['filters']));if(_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x2592f2['where']=_[_0x4f98('0x57')](_0x2592f2[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x2592f2['attributes'],function(_0x387710){var _0x1a5393={};_0x1a5393[_0x387710]={'$like':'%'+_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1a5393;})});}_0x2592f2=_[_0x4f98('0x57')]({},_0x2592f2,_0x51baa2[_0x4f98('0x5b')]);return _0x365cd4['getOpenchannelInteractions'](_0x2592f2);}})[_0x4f98('0x34')](function(_0x24b127){if(_0x24b127){_0x1fca50=_0x24b127[_0x4f98('0x51')];if(!_0x51baa2['query']['hasOwnProperty'](_0x4f98('0x52'))){_0x2592f2[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x51baa2['query']['limit']);_0x2592f2[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x51baa2['query']['offset']);}return _0x365cd4[_0x4f98('0xde')](_0x2592f2);}})[_0x4f98('0x34')](function(_0x47272b){if(_0x47272b){return _0x47272b?{'count':_0x1fca50,'rows':_0x47272b}:null;}})['then'](respondWithResult(_0x24751a,null))[_0x4f98('0x63')](handleError(_0x24751a,null));};exports[_0x4f98('0xe0')]=function(_0x2e834c,_0x357d58,_0x4ffb99){var _0xefe243={'raw':!![],'where':{}};var _0x16fffd={};var _0x34fc9c={'count':0x0,'rows':[]};return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x2e834c[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x357d58,null))[_0x4f98('0x34')](function(_0x60b415){if(_0x60b415){_0x16fffd['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe1')][_0x4f98('0x45')]);_0x16fffd[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x2e834c[_0x4f98('0x4a')]);_0x16fffd[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x16fffd[_0x4f98('0x4d')],_0x16fffd['query']);_0xefe243['attributes']=_[_0x4f98('0x4f')](_0x16fffd[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x2e834c['query'][_0x4f98('0x50')]));_0xefe243[_0x4f98('0x4e')]=_0xefe243['attributes'][_0x4f98('0x51')]?_0xefe243[_0x4f98('0x4e')]:_0x16fffd[_0x4f98('0x4d')];if(!_0x2e834c[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0xefe243[_0x4f98('0x2d')]=qs['limit'](_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0xefe243[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x2e834c[_0x4f98('0x4a')]['offset']);}_0xefe243[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x2e834c[_0x4f98('0x4a')]['sort']);_0xefe243['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x2e834c[_0x4f98('0x4a')],_0x16fffd[_0x4f98('0x4c')]));_0xefe243['where'][_0x4f98('0xd8')]=_0x60b415['id'];if(_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0xefe243[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0xefe243[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0xefe243[_0x4f98('0x4e')],function(_0x5f1ae8){var _0x1f9393={};_0x1f9393[_0x5f1ae8]={'$like':'%'+_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1f9393;})});}_0xefe243=_[_0x4f98('0x57')]({},_0xefe243,_0x2e834c[_0x4f98('0x5b')]);return db[_0x4f98('0xe1')]['count']({'where':_0xefe243[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x302d30){_0x34fc9c['count']=_0x302d30;if(_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0xefe243['include']=[{'all':!![]}];}return db['MailInteraction'][_0x4f98('0x5f')](_0xefe243);})[_0x4f98('0x34')](function(_0x54d013){_0x34fc9c[_0x4f98('0xd9')]=_0x54d013;return _0x34fc9c;});}})[_0x4f98('0x34')](respondWithFilteredResult(_0x357d58,_0xefe243))[_0x4f98('0x63')](handleError(_0x357d58,null));};exports[_0x4f98('0xe2')]=function(_0x4348db,_0x2ca881,_0x509de5){var _0x51317f={};var _0x2328af={};var _0x3700ad;var _0x575734;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x4348db['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x2ca881,null))[_0x4f98('0x34')](function(_0xa99d21){if(_0xa99d21){_0x3700ad=_0xa99d21;_0x2328af['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe3')][_0x4f98('0x45')]);_0x2328af[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x4348db[_0x4f98('0x4a')]);_0x2328af[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x2328af[_0x4f98('0x4d')],_0x2328af[_0x4f98('0x4a')]);_0x51317f[_0x4f98('0x4e')]=_['intersection'](_0x2328af['model'],qs[_0x4f98('0x50')](_0x4348db[_0x4f98('0x4a')]['fields']));_0x51317f[_0x4f98('0x4e')]=_0x51317f['attributes'][_0x4f98('0x51')]?_0x51317f[_0x4f98('0x4e')]:_0x2328af[_0x4f98('0x4d')];_0x51317f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x4348db[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x51317f['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x4348db[_0x4f98('0x4a')],_0x2328af[_0x4f98('0x4c')]));if(_0x4348db[_0x4f98('0x4a')]['filter']){_0x51317f[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x51317f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x51317f[_0x4f98('0x4e')],function(_0xaa00b9){var _0x5dfc24={};_0x5dfc24[_0xaa00b9]={'$like':'%'+_0x4348db[_0x4f98('0x4a')]['filter']+'%'};return _0x5dfc24;})});}_0x51317f=_[_0x4f98('0x57')]({},_0x51317f,_0x4348db[_0x4f98('0x5b')]);return _0x3700ad[_0x4f98('0xe2')](_0x51317f);}})[_0x4f98('0x34')](function(_0xa80b1){if(_0xa80b1){_0x575734=_0xa80b1[_0x4f98('0x51')];if(!_0x4348db[_0x4f98('0x4a')][_0x4f98('0xd3')]('nolimit')){_0x51317f[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x4348db[_0x4f98('0x4a')]['limit']);_0x51317f['offset']=qs[_0x4f98('0x2c')](_0x4348db[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x3700ad['getSmsInteractions'](_0x51317f);}})['then'](function(_0x3deb48){if(_0x3deb48){return _0x3deb48?{'count':_0x575734,'rows':_0x3deb48}:null;}})[_0x4f98('0x34')](respondWithResult(_0x2ca881,null))['catch'](handleError(_0x2ca881,null));};exports['getFaxInteractions']=function(_0x1f02a6,_0x5a4b80,_0x2e7a7f){var _0x279faf={};var _0x2e0124={};var _0x36afb4;var _0x2a7661;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x1f02a6['params']['id']}})['then'](handleEntityNotFound(_0x5a4b80,null))[_0x4f98('0x34')](function(_0x396f86){if(_0x396f86){_0x36afb4=_0x396f86;_0x2e0124[_0x4f98('0x4d')]=_['keys'](db[_0x4f98('0xe4')][_0x4f98('0x45')]);_0x2e0124[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x1f02a6[_0x4f98('0x4a')]);_0x2e0124[_0x4f98('0x4c')]=_['intersection'](_0x2e0124[_0x4f98('0x4d')],_0x2e0124[_0x4f98('0x4a')]);_0x279faf[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x2e0124[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x279faf[_0x4f98('0x4e')]=_0x279faf[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x279faf[_0x4f98('0x4e')]:_0x2e0124['model'];_0x279faf[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x1f02a6[_0x4f98('0x4a')]['sort']);_0x279faf[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x1f02a6[_0x4f98('0x4a')],_0x2e0124[_0x4f98('0x4c')]));if(_0x1f02a6[_0x4f98('0x4a')]['filter']){_0x279faf[_0x4f98('0x55')]=_['merge'](_0x279faf['where'],{'$or':_[_0x4f98('0x44')](_0x279faf[_0x4f98('0x4e')],function(_0x289129){var _0x5700a6={};_0x5700a6[_0x289129]={'$like':'%'+_0x1f02a6['query'][_0x4f98('0x3b')]+'%'};return _0x5700a6;})});}_0x279faf=_['merge']({},_0x279faf,_0x1f02a6['options']);return _0x36afb4['getFaxInteractions'](_0x279faf);}})['then'](function(_0xbef742){if(_0xbef742){_0x2a7661=_0xbef742['length'];if(!_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x279faf[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x279faf[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x1f02a6[_0x4f98('0x4a')]['offset']);}return _0x36afb4[_0x4f98('0xe5')](_0x279faf);}})[_0x4f98('0x34')](function(_0x8b02f0){if(_0x8b02f0){return _0x8b02f0?{'count':_0x2a7661,'rows':_0x8b02f0}:null;}})[_0x4f98('0x34')](respondWithResult(_0x5a4b80,null))[_0x4f98('0x63')](handleError(_0x5a4b80,null));};exports[_0x4f98('0xe6')]=function(_0x524b01,_0x623961,_0x41d657){var _0x5241a7={};var _0x209ddb={};var _0x9b4393;var _0x1a0b7f;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x524b01[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x623961,null))[_0x4f98('0x34')](function(_0x13d7df){if(_0x13d7df){_0x9b4393=_0x13d7df;_0x209ddb['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe7')][_0x4f98('0x45')]);_0x209ddb['query']=_['keys'](_0x524b01[_0x4f98('0x4a')]);_0x209ddb[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x209ddb[_0x4f98('0x4d')],_0x209ddb[_0x4f98('0x4a')]);_0x5241a7[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x209ddb['model'],qs[_0x4f98('0x50')](_0x524b01['query'][_0x4f98('0x50')]));_0x5241a7[_0x4f98('0x4e')]=_0x5241a7[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x5241a7[_0x4f98('0x4e')]:_0x209ddb[_0x4f98('0x4d')];_0x5241a7['order']=qs[_0x4f98('0x54')](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x5241a7['where']=qs[_0x4f98('0x4c')](_['pick'](_0x524b01[_0x4f98('0x4a')],_0x209ddb[_0x4f98('0x4c')]));if(_0x524b01[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x5241a7[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x5241a7[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x5241a7[_0x4f98('0x4e')],function(_0x3c13fc){var _0x1051bd={};_0x1051bd[_0x3c13fc]={'$like':'%'+_0x524b01['query'][_0x4f98('0x3b')]+'%'};return _0x1051bd;})});}_0x5241a7=_[_0x4f98('0x57')]({},_0x5241a7,_0x524b01[_0x4f98('0x5b')]);return _0x9b4393[_0x4f98('0xe6')](_0x5241a7);}})['then'](function(_0x32c9ae){if(_0x32c9ae){_0x1a0b7f=_0x32c9ae[_0x4f98('0x51')];if(!_0x524b01[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x5241a7[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x5241a7[_0x4f98('0x2c')]=qs['offset'](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x9b4393[_0x4f98('0xe6')](_0x5241a7);}})[_0x4f98('0x34')](function(_0x9ab438){if(_0x9ab438){return _0x9ab438?{'count':_0x1a0b7f,'rows':_0x9ab438}:null;}})['then'](respondWithResult(_0x623961,null))['catch'](handleError(_0x623961,null));};exports[_0x4f98('0xe8')]=function(_0x286b37,_0x43d887,_0x4afc00){var _0x5441f1;var _0x1cbf5d;var _0x6cc6e3;var _0x176648=!_[_0x4f98('0x6f')](_0x286b37[_0x4f98('0x65')]['id'])?_0x286b37[_0x4f98('0x65')]['id']:!_['isNil'](_0x286b37['user']['id'])?_0x286b37[_0x4f98('0x38')]['id']:null;return db['User']['find']({'where':{'id':_0x176648,'role':{'$or':[_0x4f98('0x37'),_0x4f98('0x38'),_0x4f98('0x39')]}},'attributes':['id',_0x4f98('0x3f'),'phone','mobile',_0x4f98('0x36'),_0x4f98('0x6d'),_0x4f98('0xa9')]})[_0x4f98('0x34')](function(_0x25efd0){if(_0x25efd0){if(_0x25efd0[_0x4f98('0x36')]===_0x4f98('0x39')){_0x5441f1=_0x25efd0;if(_0x286b37[_0x4f98('0x64')][_0x4f98('0xaa')]){_0x6cc6e3=util['format'](_0x4f98('0xe9'),_0x5441f1[_0x286b37[_0x4f98('0x64')][_0x4f98('0xaa')]]);}else if(_0x286b37[_0x4f98('0x64')][_0x4f98('0xea')]){_0x6cc6e3=util['format'](_0x4f98('0xb4'),_0x286b37[_0x4f98('0x64')][_0x4f98('0xea')]);}else{_0x6cc6e3=util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x5441f1[_0x4f98('0x3f')]);}socket['to'](util[_0x4f98('0xb3')](_0x4f98('0xeb'),_0x5441f1[_0x4f98('0x3f')]))[_0x4f98('0xbc')](_0x4f98('0xec'),{'ip':_0x286b37[_0x4f98('0xed')][_0x4f98('0xee')]||_0x286b37[_0x4f98('0xef')][_0x4f98('0xf0')]||_0x286b37['socket']['remoteAddress']||_0x286b37[_0x4f98('0xef')]['socket']['remoteAddress']});return db[_0x4f98('0xb7')]['destroy']({'where':{'membername':_0x5441f1[_0x4f98('0x3f')]},'individualHooks':!![]});}}else{throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x4f98('0x34')](function(){if(_0x5441f1){return _0x5441f1[_0x4f98('0xf1')]({'raw':!![]});}})[_0x4f98('0x34')](function(_0x140d6b){if(_0x5441f1){var _0x4a5ba9=[];if(_0x140d6b){_0x1cbf5d=_0x140d6b;if(_0x1cbf5d[_0x4f98('0x51')]){for(var _0x4beaf7=0x0;_0x4beaf7<_0x1cbf5d[_0x4f98('0x51')];_0x4beaf7++){_0x4a5ba9[_0x4f98('0x92')]({'membername':_0x5441f1[_0x4f98('0x3f')],'UserId':_0x5441f1['id'],'queue_name':_0x1cbf5d[_0x4beaf7][_0x4f98('0x3f')],'VoiceQueueId':_0x1cbf5d[_0x4beaf7]['id'],'interface':_0x6cc6e3,'paused':_0x5441f1[_0x4f98('0xa9')]||![],'penalty':_0x1cbf5d[_0x4beaf7][_0x4f98('0xf2')]||0x0});}return BPromise['each'](_0x4a5ba9,function(_0x589c3d){return db['UserVoiceQueueRt'][_0x4f98('0xb8')](_0x589c3d);});}}}})[_0x4f98('0x34')](function(){if(_0x5441f1){return db[_0x4f98('0xf3')][_0x4f98('0x5f')]({'where':{'membername':_0x5441f1['name'],'exitAt':null}});}})[_0x4f98('0x34')](function(_0x1a54e8){if(_0x5441f1){var _0x1fb787=[];_0x1a54e8[_0x4f98('0xf4')](function(_0x2ee686){_0x1fb787[_0x4f98('0x92')](_0x2ee686['update']({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))}));});return BPromise[_0x4f98('0x93')](_0x1fb787);}})[_0x4f98('0x34')](function(){if(_0x5441f1){var _0x17092a=[];var _0x109018=[];var _0x14f1f7=utils[_0x4f98('0xf6')]();var _0x93b786={'membername':_0x5441f1[_0x4f98('0x3f')],'interface':_0x6cc6e3,'enterAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'role':_0x5441f1[_0x4f98('0x36')],'internal':_0x5441f1[_0x4f98('0x6d')]};_0x14f1f7['forEach'](function(_0x1c831a){_0x17092a[_0x4f98('0x92')](_[_0x4f98('0x57')]({'channel':_0x1c831a,'type':_0x4f98('0xf7'),'data1':_0x286b37['body'][_0x4f98('0xf8')],'data2':_0x6cc6e3},_0x93b786));if(_0x5441f1[_0x4f98('0xa9')]){_0x109018[_0x4f98('0x92')](_[_0x4f98('0x57')]({'channel':_0x1c831a,'type':_0x4f98('0xf9'),'data1':'LOGININPAUSE'},_0x93b786));}});return db['MemberReport'][_0x4f98('0x8f')](_0x17092a[_0x4f98('0xfa')](_0x109018),{'individualHooks':!![]});}})[_0x4f98('0x34')](function(){if(_0x5441f1){return _0x5441f1[_0x4f98('0x33')]({'online':!![],'lastLoginAt':moment()[_0x4f98('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5441f1['loginInPause']||![],'mailPause':_0x5441f1['loginInPause']||![],'chatPause':_0x5441f1[_0x4f98('0xa9')]||![],'faxPause':_0x5441f1[_0x4f98('0xa9')]||![],'smsPause':_0x5441f1[_0x4f98('0xa9')]||![],'openchannelPause':_0x5441f1['loginInPause']||![],'whatsappPause':_0x5441f1[_0x4f98('0xa9')]||![],'pauseType':_0x5441f1['loginInPause']?'LOGININPAUSE':null,'interface':_0x6cc6e3,'lastPauseAt':moment()['format'](_0x4f98('0xf5'))});}})['then'](function(_0x1cb938){if(_0x286b37['isMiddleware']){return _0x4afc00();}else{return BPromise[_0x4f98('0xfb')](_0x1cb938)['then'](respondWithResult(_0x43d887,null));}})[_0x4f98('0x63')](handleError(_0x43d887,null));};exports['logout']=function(_0xbbe6fb,_0x3eb64f,_0x4d946b){var _0x829b93;return db['User']['find']({'where':{'id':_0xbbe6fb['params']['id'],'role':_0x4f98('0x39')},'attributes':['id',_0x4f98('0x3f'),'role']})[_0x4f98('0x34')](handleEntityNotFound(_0x3eb64f,null))[_0x4f98('0x34')](function(_0x5a078){if(_0x5a078){_0x829b93=_0x5a078;return db[_0x4f98('0xb7')][_0x4f98('0x40')]({'where':{'membername':_0x829b93[_0x4f98('0x3f')]},'individualHooks':!![]});}})[_0x4f98('0x34')](function(){return db[_0x4f98('0xf3')][_0x4f98('0x5f')]({'where':{'membername':_0x829b93['name'],'exitAt':null}});})[_0x4f98('0x34')](function(_0x206c4e){var _0x29857b=[];_0x206c4e[_0x4f98('0xf4')](function(_0x4b3ea2){_0x29857b[_0x4f98('0x92')](_0x4b3ea2[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))}));});return BPromise[_0x4f98('0x93')](_0x29857b);})[_0x4f98('0x34')](function(){return _0x829b93[_0x4f98('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4f98('0x34')](respondWithResult(_0x3eb64f,null))['catch'](handleError(_0x3eb64f,null));};exports[_0x4f98('0xfc')]=function(_0x47de2b,_0x28bcda,_0x1fa3a8){var _0x4e334d;return db[_0x4f98('0xb7')][_0x4f98('0x33')]({'paused':0x1},{'where':{'UserId':_0x47de2b['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x47de2b['params']['id'],'role':_0x4f98('0x39')},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36'),_0x4f98('0x6d'),_0x4f98('0xaa')]});})[_0x4f98('0x34')](handleEntityNotFound(_0x28bcda,null))[_0x4f98('0x34')](function(_0xfdf277){if(_0xfdf277){_0x4e334d=_0xfdf277;return respondWithRpcPromise('QueuePause',_0x4f98('0xfc'),{'id':_0x4e334d['id'],'name':_0x4e334d['name'],'pause':!![]});}})[_0x4f98('0x34')](function(){if(_0x4e334d){return db[_0x4f98('0xf3')]['findAll']({'where':{'membername':_0x4e334d[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});}})['then'](function(_0x54367b){if(_0x54367b[_0x4f98('0x51')]){var _0x488ad7=moment()[_0x4f98('0xb3')](_0x4f98('0xf5'));for(var _0x1501f1=0x0,_0x36ba8c=_0x54367b['length'];_0x1501f1<_0x36ba8c;_0x1501f1++){_0x54367b[_0x1501f1][_0x4f98('0xfd')]({'exitAt':_0x488ad7});}}})['then'](function(){var _0x2b1329=[];var _0x35079f=utils[_0x4f98('0xf6')]();_0x35079f[_0x4f98('0xf4')](function(_0x16bbd4){_0x2b1329[_0x4f98('0x92')]({'channel':_0x16bbd4,'membername':_0x4e334d[_0x4f98('0x3f')],'interface':_[_0x4f98('0x6f')](_0x4e334d[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x4e334d['name']):_0x4e334d[_0x4f98('0xaa')],'type':'PAUSE','enterAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data1':_0x47de2b['body'][_0x4f98('0x47')]||_0x4f98('0xfe'),'role':_0x4e334d[_0x4f98('0x36')],'internal':_0x4e334d[_0x4f98('0x6d')]});});return db[_0x4f98('0xf3')][_0x4f98('0x8f')](_0x2b1329,{'individualHooks':!![]});})[_0x4f98('0x34')](function(){return _0x4e334d[_0x4f98('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x47de2b[_0x4f98('0x64')][_0x4f98('0x47')]||_0x4f98('0xfe'),'lastPauseAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))});})['then'](respondWithResult(_0x28bcda,null))['catch'](handleError(_0x28bcda,null));};exports[_0x4f98('0xff')]=function(_0x9a875a,_0x23f4a4,_0xe1b537){var _0x8b5803;return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x9a875a[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36'),'voicePause',_0x4f98('0x100'),'chatPause',_0x4f98('0x101'),'openchannelPause','smsPause','whatsapppause','pauseType',_0x4f98('0x102')]})[_0x4f98('0x34')](handleEntityNotFound(_0x23f4a4,null))[_0x4f98('0x34')](function(_0x114b4d){if(_0x114b4d){_0x8b5803=_0x114b4d;if(_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')]&&!utils[_0x4f98('0xab')](_0x9a875a['body'][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xac'));}switch(_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')]){case _0x4f98('0xbe'):return respondWithRpcPromise(_0x4f98('0x103'),'unpause',{'id':_0x8b5803['id'],'name':_0x8b5803[_0x4f98('0x3f')],'pause':![]})[_0x4f98('0x34')](function(){return db['UserVoiceQueueRt'][_0x4f98('0x33')]({'paused':0x0},{'where':{'UserId':_0x8b5803['id']},'individualHooks':!![]});})['then'](function(){return db[_0x4f98('0xf3')]['find']({'where':{'channel':_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')],'membername':_0x8b5803[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});})[_0x4f98('0x34')](function(_0x179b18){if(_0x179b18){return _0x179b18[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data2':_0x4f98('0x104')},{'individualHooks':!![]});}return null;})[_0x4f98('0x34')](function(){return _0x8b5803[_0x4f98('0x33')]({'voicePause':![]});});case _0x4f98('0x105'):case _0x4f98('0x106'):case _0x4f98('0x107'):case _0x4f98('0x108'):case'whatsapp':case'openchannel':return db['MemberReport'][_0x4f98('0x62')]({'where':{'channel':_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')],'membername':_0x8b5803['name'],'type':_0x4f98('0xf9'),'exitAt':null}})[_0x4f98('0x34')](function(_0x1a8320){if(_0x1a8320){return _0x1a8320[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data2':_0x4f98('0x104')},{'individualHooks':!![]});}return null;})[_0x4f98('0x34')](function(){var _0x1ac9a6={};_[_0x4f98('0x2e')](_0x1ac9a6,util[_0x4f98('0xb3')]('%s%s',_0x9a875a['body'][_0x4f98('0xa7')],_0x4f98('0x109')),![]);return _0x8b5803[_0x4f98('0x33')](_0x1ac9a6);});default:return respondWithRpcPromise(_0x4f98('0x103'),_0x4f98('0xff'),{'id':_0x8b5803['id'],'name':_0x8b5803[_0x4f98('0x3f')],'pause':![]})[_0x4f98('0x34')](function(){return db[_0x4f98('0xb7')][_0x4f98('0x33')]({'paused':0x0},{'where':{'UserId':_0x8b5803['id']}});})[_0x4f98('0x34')](function(){return db['MemberReport'][_0x4f98('0x5f')]({'where':{'membername':_0x8b5803[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});})['then'](function(_0x13dee8){var _0x5bfb97=[];_0x13dee8[_0x4f98('0xf4')](function(_0x3de5e8){_0x5bfb97[_0x4f98('0x92')](_0x3de5e8['update']({'exitAt':moment()[_0x4f98('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x4f98('0x104')}));});return BPromise['all'](_0x5bfb97);})[_0x4f98('0x34')](function(){return _0x8b5803[_0x4f98('0x33')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x23f4a4,null))[_0x4f98('0x63')](handleError(_0x23f4a4,null));};exports['getTeams']=function(_0xb69afb,_0x4c5c8d,_0x55a81d){var _0x4bd0f9={};var _0x59d467={};var _0x484b03;var _0x126530;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0xb69afb[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4c5c8d,null))['then'](function(_0x4e240d){if(_0x4e240d){_0x484b03=_0x4e240d;_0x59d467['model']=_[_0x4f98('0x4b')](db[_0x4f98('0x10a')]['rawAttributes']);_0x59d467['query']=_[_0x4f98('0x4b')](_0xb69afb[_0x4f98('0x4a')]);_0x59d467[_0x4f98('0x4c')]=_['intersection'](_0x59d467['model'],_0x59d467[_0x4f98('0x4a')]);_0x4bd0f9[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x59d467[_0x4f98('0x4d')],qs['fields'](_0xb69afb['query']['fields']));_0x4bd0f9[_0x4f98('0x4e')]=_0x4bd0f9['attributes'][_0x4f98('0x51')]?_0x4bd0f9[_0x4f98('0x4e')]:_0x59d467[_0x4f98('0x4d')];_0x4bd0f9[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4bd0f9[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_['pick'](_0xb69afb[_0x4f98('0x4a')],_0x59d467['filters']));if(_0xb69afb[_0x4f98('0x4a')]['filter']){_0x4bd0f9[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4bd0f9[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4bd0f9[_0x4f98('0x4e')],function(_0x553b14){var _0x20abf7={};_0x20abf7[_0x553b14]={'$like':'%'+_0xb69afb[_0x4f98('0x4a')]['filter']+'%'};return _0x20abf7;})});}_0x4bd0f9=_[_0x4f98('0x57')]({},_0x4bd0f9,_0xb69afb[_0x4f98('0x5b')]);return _0x484b03[_0x4f98('0x10b')](_0x4bd0f9);}})[_0x4f98('0x34')](function(_0xcabfd6){if(_0xcabfd6){_0x126530=_0xcabfd6[_0x4f98('0x51')];if(!_0xb69afb[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x4bd0f9[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4bd0f9[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x484b03[_0x4f98('0x10b')](_0x4bd0f9);}})[_0x4f98('0x34')](function(_0x2895a6){if(_0x2895a6){return _0x2895a6?{'count':_0x126530,'rows':_0x2895a6}:null;}})['then'](respondWithResult(_0x4c5c8d,null))[_0x4f98('0x63')](handleError(_0x4c5c8d,null));};exports[_0x4f98('0x10c')]=function(_0xf84f9e,_0xe44c52){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0xf84f9e['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xe44c52,null))[_0x4f98('0x34')](function(_0x4369f3){if(_0x4369f3){var _0x152562=_0x4369f3[_0x4f98('0x35')]({'plain':!![]});return _0x4369f3[_0x4f98('0x10c')](_0xf84f9e[_0x4f98('0x64')][_0x4f98('0x68')],_['omit'](_0xf84f9e[_0x4f98('0x64')],[_0x4f98('0x68'),'id'])||{})[_0x4f98('0x34')](function(){for(var _0x55496e=0x0;_0x55496e<_0xf84f9e[_0x4f98('0x64')]['ids'][_0x4f98('0x51')];_0x55496e++){var _0x251f8f=[];db[_0x4f98('0x10a')][_0x4f98('0xc9')]({'where':{'id':_0xf84f9e[_0x4f98('0x64')]['ids'][_0x55496e]}})[_0x4f98('0x34')](function(_0x4dec67){_0x251f8f[_0x4f98('0x92')](_0x4dec67['getVoiceQueues']()[_0x4f98('0x34')](function(_0x1d4182){for(var _0xc9d1ae=0x0;_0xc9d1ae<_0x1d4182['length'];_0xc9d1ae++){_0x1d4182[_0xc9d1ae][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x10e'));}return _0x1d4182;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x10f')]()['then'](function(_0x16dd84){for(var _0xd3d1bd=0x0;_0xd3d1bd<_0x16dd84[_0x4f98('0x51')];_0xd3d1bd++){_0x16dd84[_0xd3d1bd][_0x4f98('0x10d')](_0x4f98('0xa7'),'Chat');}return _0x16dd84;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x110')]()[_0x4f98('0x34')](function(_0x8abf1f){for(var _0x2e71fd=0x0;_0x2e71fd<_0x8abf1f['length'];_0x2e71fd++){_0x8abf1f[_0x2e71fd][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x111'));}return _0x8abf1f;}));_0x251f8f[_0x4f98('0x92')](_0x4dec67[_0x4f98('0x112')]()[_0x4f98('0x34')](function(_0x5dce1a){for(var _0x357d98=0x0;_0x357d98<_0x5dce1a[_0x4f98('0x51')];_0x357d98++){_0x5dce1a[_0x357d98][_0x4f98('0x10d')](_0x4f98('0xa7'),'Sms');}return _0x5dce1a;}));_0x251f8f[_0x4f98('0x92')](_0x4dec67[_0x4f98('0x113')]()[_0x4f98('0x34')](function(_0x256cf7){for(var _0x4e63a3=0x0;_0x4e63a3<_0x256cf7[_0x4f98('0x51')];_0x4e63a3++){_0x256cf7[_0x4e63a3][_0x4f98('0x10d')]('channel',_0x4f98('0x114'));}return _0x256cf7;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x115')]()[_0x4f98('0x34')](function(_0x263664){for(var _0x4a358f=0x0;_0x4a358f<_0x263664[_0x4f98('0x51')];_0x4a358f++){_0x263664[_0x4a358f][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x116'));}return _0x263664;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x117')]()[_0x4f98('0x34')](function(_0x36b23f){for(var _0x4ef78c=0x0;_0x4ef78c<_0x36b23f[_0x4f98('0x51')];_0x4ef78c++){_0x36b23f[_0x4ef78c]['setDataValue'](_0x4f98('0xa7'),_0x4f98('0x118'));}return _0x36b23f;}));return BPromise[_0x4f98('0x93')](_0x251f8f);})['then'](function(_0x19ca9a){var _0x54c69e=_['flatten'](_0x19ca9a);_0x251f8f=[];return db['sequelize']['transaction'](function(_0x5d9b44){for(var _0x2a94b1=0x0;_0x2a94b1<_0x54c69e[_0x4f98('0x51')];_0x2a94b1++){_0x251f8f[_0x4f98('0x92')](_0x54c69e[_0x2a94b1][_0x4f98('0x119')](_0x152562['id']),{'transaction':_0x5d9b44});}return BPromise[_0x4f98('0x93')](_0x251f8f)[_0x4f98('0x34')](function(){if(_0x152562['online']){return BPromise[_0x4f98('0xb6')](_[_0x4f98('0x3b')](_0x54c69e,function(_0x416245){return _0x416245['getDataValue'](_0x4f98('0xa7'))==='Voice';}),function(_0x2db987){return db[_0x4f98('0xb7')][_0x4f98('0xb8')]({'membername':_0x152562['name'],'UserId':_0x152562['id'],'queue_name':_0x2db987['name'],'VoiceQueueId':_0x2db987['id'],'interface':_['isNil'](_0x152562[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x152562[_0x4f98('0x3f')]):_0x152562['interface'],'paused':_0x152562[_0x4f98('0x11a')]||![],'penalty':_0x152562[_0x4f98('0xb5')]},{'transaction':_0x5d9b44});});}else{return;}})[_0x4f98('0x34')](function(){for(var _0x1e18fe=0x0;_0x1e18fe<_0x54c69e[_0x4f98('0x51')];_0x1e18fe++){var _0x16dba=_0x54c69e[_0x1e18fe]['getDataValue'](_0x4f98('0xa7'));var _0x585e4a=_0x16dba+_0x4f98('0xbb');socket[_0x4f98('0xbc')](_0x4f98('0x38')+_0x16dba+_0x4f98('0xb2'),{'UserId':_0x152562['id'],['queueField']:_0x54c69e[_0x1e18fe]['id']});}});});});}});}})[_0x4f98('0x34')](respondWithStatusCode(_0xe44c52,null))[_0x4f98('0x63')](handleError(_0xe44c52,null));};exports[_0x4f98('0x11b')]=function(_0x1cb57b,_0x38bb86){return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x1cb57b[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x38bb86,null))[_0x4f98('0x34')](function(_0x26c330){if(_0x26c330){var _0x403aa4=_0x26c330['get']({'plain':!![]});var _0x4400db=_0x1cb57b[_0x4f98('0x4a')][_0x4f98('0x68')];return _0x26c330[_0x4f98('0x11b')](_0x4400db)['then'](function(){for(var _0x9f39e3=0x0;_0x9f39e3<_0x4400db[_0x4f98('0x51')];_0x9f39e3++){var _0x4f310b=[];db[_0x4f98('0x10a')][_0x4f98('0xc9')]({'where':{'id':_0x4400db[_0x9f39e3]}})[_0x4f98('0x34')](function(_0x5b4b7c){_0x4f310b[_0x4f98('0x92')](_0x5b4b7c['getVoiceQueues']()[_0x4f98('0x34')](function(_0x1bc285){for(var _0xe873d4=0x0;_0xe873d4<_0x1bc285[_0x4f98('0x51')];_0xe873d4++){_0x1bc285[_0xe873d4][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x10e'));}return _0x1bc285;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c['getChatQueues']()[_0x4f98('0x34')](function(_0x542853){for(var _0x57874c=0x0;_0x57874c<_0x542853[_0x4f98('0x51')];_0x57874c++){_0x542853[_0x57874c][_0x4f98('0x10d')]('channel',_0x4f98('0x11c'));}return _0x542853;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x110')]()[_0x4f98('0x34')](function(_0xf7f262){for(var _0x183887=0x0;_0x183887<_0xf7f262[_0x4f98('0x51')];_0x183887++){_0xf7f262[_0x183887]['setDataValue'](_0x4f98('0xa7'),'Mail');}return _0xf7f262;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x112')]()['then'](function(_0x22a351){for(var _0x446e46=0x0;_0x446e46<_0x22a351[_0x4f98('0x51')];_0x446e46++){_0x22a351[_0x446e46][_0x4f98('0x10d')]('channel',_0x4f98('0x11d'));}return _0x22a351;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x113')]()['then'](function(_0x59a17e){for(var _0xb23d0=0x0;_0xb23d0<_0x59a17e[_0x4f98('0x51')];_0xb23d0++){_0x59a17e[_0xb23d0][_0x4f98('0x10d')]('channel','Whatsapp');}return _0x59a17e;}));_0x4f310b['push'](_0x5b4b7c['getFaxQueues']()[_0x4f98('0x34')](function(_0x3ff308){for(var _0x48a23c=0x0;_0x48a23c<_0x3ff308[_0x4f98('0x51')];_0x48a23c++){_0x3ff308[_0x48a23c][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x116'));}return _0x3ff308;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x117')]()['then'](function(_0x4d3b04){for(var _0x19c65c=0x0;_0x19c65c<_0x4d3b04['length'];_0x19c65c++){_0x4d3b04[_0x19c65c]['setDataValue'](_0x4f98('0xa7'),_0x4f98('0x118'));}return _0x4d3b04;}));return BPromise[_0x4f98('0x93')](_0x4f310b);})[_0x4f98('0x34')](function(_0x450e20){var _0x28de4b=_[_0x4f98('0x11e')](_0x450e20);_0x4f310b=[];return db[_0x4f98('0x58')]['transaction'](function(_0x49a2ba){for(var _0x5b8c19=0x0;_0x5b8c19<_0x28de4b[_0x4f98('0x51')];_0x5b8c19++){_0x4f310b['push'](_0x28de4b[_0x5b8c19]['removeAgent'](_0x403aa4['id']),{'transaction':_0x49a2ba});}return BPromise[_0x4f98('0x93')](_0x4f310b)[_0x4f98('0x34')](function(){if(_0x403aa4[_0x4f98('0xa8')]){return BPromise['each'](_[_0x4f98('0x3b')](_0x28de4b,function(_0x16eaf9){return _0x16eaf9['getDataValue'](_0x4f98('0xa7'))===_0x4f98('0x10e');}),function(_0x37df06){return db[_0x4f98('0xb7')][_0x4f98('0x40')]({'where':{'VoiceQueueId':_0x37df06['id'],'UserId':_0x403aa4['id']},'transaction':_0x49a2ba});});}else{return;}})['then'](function(){for(var _0x24e874=0x0;_0x24e874<_0x28de4b[_0x4f98('0x51')];_0x24e874++){var _0x44e62d=_0x28de4b[_0x24e874][_0x4f98('0x11f')](_0x4f98('0xa7'));var _0x2984b1=_0x44e62d+'QueueId';socket[_0x4f98('0xbc')](_0x4f98('0x38')+_0x44e62d+_0x4f98('0xbd'),{'UserId':_0x403aa4['id'],['queueField']:_0x28de4b[_0x24e874]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x38bb86,null))['catch'](handleError(_0x38bb86,null));};exports[_0x4f98('0x120')]=function(_0x5b1e13,_0x4ec4a3,_0xeb9569){var _0x4834db={};var _0x2a4029={};var _0xbd5a65;var _0x4a0f6c;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x5b1e13[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4ec4a3,null))['then'](function(_0x41feca){if(_0x41feca){_0xbd5a65=_0x41feca;_0x2a4029[_0x4f98('0x4d')]=_['keys'](db['CmList'][_0x4f98('0x45')]);_0x2a4029['query']=_['keys'](_0x5b1e13[_0x4f98('0x4a')]);_0x2a4029[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x2a4029[_0x4f98('0x4d')],_0x2a4029[_0x4f98('0x4a')]);_0x4834db[_0x4f98('0x4e')]=_['intersection'](_0x2a4029[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4834db['attributes']=_0x4834db[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4834db[_0x4f98('0x4e')]:_0x2a4029['model'];_0x4834db['order']=qs[_0x4f98('0x54')](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4834db['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x5b1e13[_0x4f98('0x4a')],_0x2a4029[_0x4f98('0x4c')]));if(_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4834db[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4834db['where'],{'$or':_['map'](_0x4834db['attributes'],function(_0x2c79be){var _0x3cf635={};_0x3cf635[_0x2c79be]={'$like':'%'+_0x5b1e13[_0x4f98('0x4a')]['filter']+'%'};return _0x3cf635;})});}_0x4834db=_[_0x4f98('0x57')]({},_0x4834db,_0x5b1e13[_0x4f98('0x5b')]);return _0xbd5a65[_0x4f98('0x120')](_0x4834db);}})[_0x4f98('0x34')](function(_0x1d391a){if(_0x1d391a){_0x4a0f6c=_0x1d391a[_0x4f98('0x51')];if(!_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0xd3')]('nolimit')){_0x4834db[_0x4f98('0x2d')]=qs['limit'](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4834db[_0x4f98('0x2c')]=qs['offset'](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0xbd5a65[_0x4f98('0x120')](_0x4834db);}})[_0x4f98('0x34')](function(_0x2c6a66){if(_0x2c6a66){return _0x2c6a66?{'count':_0x4a0f6c,'rows':_0x2c6a66}:null;}})[_0x4f98('0x34')](respondWithResult(_0x4ec4a3,null))[_0x4f98('0x63')](handleError(_0x4ec4a3,null));};exports[_0x4f98('0x121')]=function(_0xcf93fd,_0x5305d1,_0x28a5f1){var _0x482486={};var _0xb99719={};var _0x37ae55;var _0x25e313;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0xcf93fd[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x5305d1,null))[_0x4f98('0x34')](function(_0x54507c){if(_0x54507c){_0x37ae55=_0x54507c;_0xb99719[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0x5c')][_0x4f98('0x45')]);_0xb99719[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0xcf93fd['query']);_0xb99719['filters']=_[_0x4f98('0x4f')](_0xb99719['model'],_0xb99719[_0x4f98('0x4a')]);_0x482486[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0xb99719[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x482486[_0x4f98('0x4e')]=_0x482486['attributes'][_0x4f98('0x51')]?_0x482486['attributes']:_0xb99719[_0x4f98('0x4d')];_0x482486[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x482486[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0xcf93fd[_0x4f98('0x4a')],_0xb99719[_0x4f98('0x4c')]));if(_0xcf93fd['query'][_0x4f98('0x3b')]){_0x482486[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x482486['where'],{'$or':_[_0x4f98('0x44')](_0x482486[_0x4f98('0x4e')],function(_0x12383c){var _0x1f092={};_0x1f092[_0x12383c]={'$like':'%'+_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1f092;})});}_0x482486['model']=db['User'];_0x482486['as']=_0x4f98('0x8b');_0x482486=_[_0x4f98('0x57')]({},_0x482486,_0xcf93fd[_0x4f98('0x5b')]);return _0x37ae55[_0x4f98('0xf1')]({'include':[_0x482486]});}})['then'](function(_0x30eca7){if(_0x30eca7){var _0x300437={},_0x123069=[],_0x477222=0x0;for(var _0x553d31=0x0;_0x553d31<_0x30eca7[_0x4f98('0x51')];_0x553d31+=0x1){for(var _0x287097=0x0,_0x54d229;_0x287097<_0x30eca7[_0x553d31][_0x4f98('0x8b')][_0x4f98('0x51')];_0x287097+=0x1){_0x54d229=_0x30eca7[_0x553d31][_0x4f98('0x8b')][_0x287097]['get']({'plain':!![]});_0x300437[_0x54d229['id']]=_0x54d229;}}_0x300437=_[_0x4f98('0x122')](_0x300437);for(var _0xb6a726=qs['offset'](_0xcf93fd['query'][_0x4f98('0x2c')]);_0xb6a726<_0x300437['length']&&_0x123069[_0x4f98('0x51')]=_0x2b18f7[_0xc1e8('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc1e8('0x13')](function(){if(_0x284749){return db['UserVoiceQueueRt'][_0xc1e8('0x52')]({'where':{'membername':_0x284749[_0xc1e8('0x36')]},'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0x284749){return _0x284749[_0xc1e8('0x53')]({'raw':!![]});}})[_0xc1e8('0x13')](function(_0x448453){if(_0x284749){if(_0x448453){var _0x584aa8=[];_0xbc894a=_0x448453;if(_0xbc894a[_0xc1e8('0x32')]){for(var _0x4492d5=0x0;_0x4492d5<_0xbc894a['length'];_0x4492d5++){_0x584aa8[_0xc1e8('0x35')](db[_0xc1e8('0x2e')][_0xc1e8('0x54')]({'membername':_0x284749[_0xc1e8('0x36')],'UserId':_0x284749['id'],'queue_name':_0xbc894a[_0x4492d5][_0xc1e8('0x36')],'VoiceQueueId':_0xbc894a[_0x4492d5]['id'],'interface':_0x10159b,'paused':_0x284749[_0xc1e8('0x4d')]||![],'penalty':_0xbc894a[_0x4492d5]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x584aa8);}}}})['then'](function(){if(_0x284749){return db[_0xc1e8('0x30')][_0xc1e8('0x1e')]({'where':{'membername':_0x284749['name'],'exitAt':null}});}})[_0xc1e8('0x13')](function(_0x506f36){if(_0x284749){if(_0x506f36&&_0x506f36[_0xc1e8('0x32')]){var _0x4d1adb=[];_0x506f36[_0xc1e8('0x4a')](function(_0x15353e){_0x4d1adb['push'](_0x15353e[_0xc1e8('0x2f')]({'exitAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33'))}));});return BPromise[_0xc1e8('0x55')](_0x4d1adb);}}})['then'](function(_0x1597dc){if(_0x284749){var _0x3e8df7=[];var _0x3c10e8=[];var _0x1054f5=utils[_0xc1e8('0x34')]();var _0xc203c8={'membername':_0x284749[_0xc1e8('0x36')],'interface':_0x10159b,'enterAt':moment()[_0xc1e8('0x37')](_0xc1e8('0x33')),'role':_0x284749[_0xc1e8('0x2b')],'internal':_0x284749[_0xc1e8('0x2c')]};_0x1054f5[_0xc1e8('0x4a')](function(_0x2a6cc1){_0x3e8df7[_0xc1e8('0x35')](_[_0xc1e8('0x56')]({'channel':_0x2a6cc1,'type':_0xc1e8('0x57'),'data1':_0xc1e8('0x58'),'data2':_0x10159b},_0xc203c8));if(_0x284749[_0xc1e8('0x4d')]){_0x3c10e8[_0xc1e8('0x35')](_[_0xc1e8('0x56')]({'channel':_0x2a6cc1,'type':_0xc1e8('0x31'),'data1':_0xc1e8('0x59')},_0xc203c8));}});return db[_0xc1e8('0x30')]['bulkCreate'](_0x3e8df7[_0xc1e8('0x5a')](_0x3c10e8),{'individualHooks':!![]});}})[_0xc1e8('0x13')](function(){if(_0x284749){return _0x284749[_0xc1e8('0x2f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x284749[_0xc1e8('0x4d')]||![],'mailPause':_0x284749[_0xc1e8('0x4d')]||![],'chatPause':_0x284749[_0xc1e8('0x4d')]||![],'faxPause':_0x284749[_0xc1e8('0x4d')]||![],'smsPause':_0x284749[_0xc1e8('0x4d')]||![],'openchannelPause':_0x284749[_0xc1e8('0x4d')]||![],'pauseType':_0x284749[_0xc1e8('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xc1e8('0x33')),'interface':_0x10159b});}})[_0xc1e8('0x13')](function(_0x20265a){_0x45f494(_0x20265a);})[_0xc1e8('0x1c')](function(_0x5e07fe){_0x3d9804(_0x871c1e[_0xc1e8('0x19')](0x1f4,_0x5e07fe[_0xc1e8('0x1b')]));});});}; \ No newline at end of file +var _0x4f3c=['../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','attributes','limit','map','include','model','debug','ShowUser','find','raw','where','name','role','internal','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','interface','body','type','DEFAULT\x20PAUSE','MemberReport','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','voice','UserVoiceQueueRt','system','chat','sms','whatsapp','set','%s%s','Pause','forEach','LogoutUser','all','mobile','phone','loginInPause','SIP/%s','count','../../config/license/util','agents','destroy','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ae3c6,_0x43064f){var _0x2e7a7a=function(_0x1a7cd0){while(--_0x1a7cd0){_0x5ae3c6['push'](_0x5ae3c6['shift']());}};_0x2e7a7a(++_0x43064f);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x53758c,_0x5664af){_0x53758c=_0x53758c-0x0;var _0x425eff=_0x4f3c[_0x53758c];return _0x425eff;};'use strict';var _=require(_0xc4f3('0x0'));var util=require(_0xc4f3('0x1'));var moment=require(_0xc4f3('0x2'));var BPromise=require(_0xc4f3('0x3'));var rs=require(_0xc4f3('0x4'));var fs=require('fs');var Redis=require(_0xc4f3('0x5'));var db=require(_0xc4f3('0x6'))['db'];var utils=require(_0xc4f3('0x7'));var logger=require(_0xc4f3('0x8'))(_0xc4f3('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4f3('0xa')][_0xc4f3('0xb')]({'port':0x232a});config[_0xc4f3('0xc')]=_[_0xc4f3('0xd')](config[_0xc4f3('0xc')],{'host':_0xc4f3('0xe'),'port':0x18eb});var socket=require(_0xc4f3('0xf'))(new Redis(config[_0xc4f3('0xc')]));require(_0xc4f3('0x10'))[_0xc4f3('0x11')](socket);function respondWithRpcPromise(_0x5a774a,_0xb328bd,_0x4a3b69){return new BPromise(function(_0x4f544d,_0x293eb4){return client['request'](_0x5a774a,_0x4a3b69)[_0xc4f3('0x12')](function(_0x303032){logger[_0xc4f3('0x13')]('User,\x20%s,\x20%s',_0xb328bd,_0xc4f3('0x14'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0xb328bd,'request\x20sent',JSON[_0xc4f3('0x15')](_0x303032));if(_0x303032[_0xc4f3('0x16')]){if(_0x303032[_0xc4f3('0x16')][_0xc4f3('0x17')]===0x1f4){logger['error'](_0xc4f3('0x18'),_0xb328bd,_0x303032[_0xc4f3('0x16')][_0xc4f3('0x19')]);return _0x293eb4(_0x303032[_0xc4f3('0x16')]['message']);}logger[_0xc4f3('0x16')](_0xc4f3('0x18'),_0xb328bd,_0x303032['error'][_0xc4f3('0x19')]);return _0x4f544d(_0x303032[_0xc4f3('0x16')][_0xc4f3('0x19')]);}else{logger['info']('User,\x20%s,\x20%s',_0xb328bd,_0xc4f3('0x14'));_0x4f544d(_0x303032[_0xc4f3('0x1a')][_0xc4f3('0x19')]);}})[_0xc4f3('0x1b')](function(_0x5d8e32){logger[_0xc4f3('0x16')](_0xc4f3('0x18'),_0xb328bd,_0x5d8e32);_0x293eb4(_0x5d8e32);});});}exports[_0xc4f3('0x1c')]=function(_0x328bbc){var _0x2f07e3=this;return new Promise(function(_0x2f2100,_0x35111f){return db[_0xc4f3('0x1d')][_0xc4f3('0x1e')]({'raw':_0x328bbc[_0xc4f3('0x1f')]?_0x328bbc[_0xc4f3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x328bbc[_0xc4f3('0x1f')]?_0x328bbc[_0xc4f3('0x1f')]['where']||null:null,'attributes':_0x328bbc['options']?_0x328bbc[_0xc4f3('0x1f')][_0xc4f3('0x20')]||null:null,'limit':_0x328bbc['options']?_0x328bbc['options'][_0xc4f3('0x21')]||null:null,'include':_0x328bbc[_0xc4f3('0x1f')]?_0x328bbc[_0xc4f3('0x1f')]['include']?_[_0xc4f3('0x22')](_0x328bbc[_0xc4f3('0x1f')][_0xc4f3('0x23')],function(_0x11ea96){return{'model':db[_0x11ea96['model']],'as':_0x11ea96['as'],'attributes':_0x11ea96[_0xc4f3('0x20')],'include':_0x11ea96[_0xc4f3('0x23')]?_[_0xc4f3('0x22')](_0x11ea96[_0xc4f3('0x23')],function(_0x67765a){return{'model':db[_0x67765a[_0xc4f3('0x24')]],'as':_0x67765a['as'],'attributes':_0x67765a[_0xc4f3('0x20')],'include':_0x67765a['include']?_[_0xc4f3('0x22')](_0x67765a[_0xc4f3('0x23')],function(_0x7e4227){return{'model':db[_0x7e4227[_0xc4f3('0x24')]],'as':_0x7e4227['as'],'attributes':_0x7e4227['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4f3('0x12')](function(_0x295946){logger['info']('GetUser',_0x328bbc);logger[_0xc4f3('0x25')](_0xc4f3('0x1c'),_0x328bbc,JSON['stringify'](_0x295946));_0x2f2100(_0x295946);})[_0xc4f3('0x1b')](function(_0x1bcb2a){logger[_0xc4f3('0x16')](_0xc4f3('0x1c'),_0x1bcb2a['message'],_0x328bbc);_0x35111f(_0x2f07e3[_0xc4f3('0x16')](0x1f4,_0x1bcb2a[_0xc4f3('0x19')]));});});};exports[_0xc4f3('0x26')]=function(_0xa1666d){var _0x4438e8=this;return new Promise(function(_0x37d2ed,_0x3ac6b6){return db['User'][_0xc4f3('0x27')]({'raw':_0xa1666d[_0xc4f3('0x1f')]?_0xa1666d['options'][_0xc4f3('0x28')]===undefined?!![]:![]:!![],'where':_0xa1666d[_0xc4f3('0x1f')]?_0xa1666d[_0xc4f3('0x1f')]['where']||null:null,'attributes':_0xa1666d['options']?_0xa1666d[_0xc4f3('0x1f')][_0xc4f3('0x20')]||null:null,'include':_0xa1666d[_0xc4f3('0x1f')]?_0xa1666d[_0xc4f3('0x1f')][_0xc4f3('0x23')]?_[_0xc4f3('0x22')](_0xa1666d[_0xc4f3('0x1f')][_0xc4f3('0x23')],function(_0x46f897){return{'model':db[_0x46f897[_0xc4f3('0x24')]],'as':_0x46f897['as'],'attributes':_0x46f897[_0xc4f3('0x20')],'include':_0x46f897[_0xc4f3('0x23')]?_['map'](_0x46f897['include'],function(_0x2a3d8c){return{'model':db[_0x2a3d8c[_0xc4f3('0x24')]],'as':_0x2a3d8c['as'],'attributes':_0x2a3d8c[_0xc4f3('0x20')],'include':_0x2a3d8c[_0xc4f3('0x23')]?_[_0xc4f3('0x22')](_0x2a3d8c[_0xc4f3('0x23')],function(_0x2d35ae){return{'model':db[_0x2d35ae[_0xc4f3('0x24')]],'as':_0x2d35ae['as'],'attributes':_0x2d35ae[_0xc4f3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a4716){logger[_0xc4f3('0x13')]('ShowUser',_0xa1666d);logger['debug'](_0xc4f3('0x26'),_0xa1666d,JSON[_0xc4f3('0x15')](_0x1a4716));_0x37d2ed(_0x1a4716);})['catch'](function(_0x2b7efc){logger[_0xc4f3('0x16')](_0xc4f3('0x26'),_0x2b7efc[_0xc4f3('0x19')],_0xa1666d);_0x3ac6b6(_0x4438e8[_0xc4f3('0x16')](0x1f4,_0x2b7efc[_0xc4f3('0x19')]));});});};exports['PauseUser']=function(_0xa2a900){var _0x17336a=this;return new Promise(function(_0x1e82c0,_0x24db74){var _0x184f23;return db[_0xc4f3('0x1d')]['find']({'where':_0xa2a900[_0xc4f3('0x1f')][_0xc4f3('0x29')]||{},'attributes':['id',_0xc4f3('0x2a'),_0xc4f3('0x2b'),_0xc4f3('0x2c'),'interface']})[_0xc4f3('0x12')](function(_0x4323c8){if(_0x4323c8){_0x184f23=_0x4323c8;return db['UserVoiceQueueRt'][_0xc4f3('0x2d')]({'paused':0x1},{'where':{'UserId':_0x184f23['id']},'individualHooks':!![]});}})['then'](function(){if(_0x184f23){return db['MemberReport'][_0xc4f3('0x1e')]({'where':{'membername':_0x184f23['name'],'type':_0xc4f3('0x2e'),'exitAt':null}});}})['then'](function(_0x234362){if(_0x184f23){if(_0x234362&&_0x234362[_0xc4f3('0x2f')]){var _0x10b7b6=moment()[_0xc4f3('0x30')](_0xc4f3('0x31'));for(var _0x26b04b=0x0,_0x325425=_0x234362[_0xc4f3('0x2f')];_0x26b04b<_0x325425;_0x26b04b++){_0x234362[_0x26b04b][_0xc4f3('0x32')]({'exitAt':_0x10b7b6});}}}})[_0xc4f3('0x12')](function(){if(_0x184f23){var _0x19c6c9=[];var _0x516302=utils[_0xc4f3('0x33')]();_0x516302['forEach'](function(_0x258c3e){_0x19c6c9[_0xc4f3('0x34')]({'channel':_0x258c3e,'membername':_0x184f23[_0xc4f3('0x2a')],'interface':_[_0xc4f3('0x35')](_0x184f23[_0xc4f3('0x36')])?util[_0xc4f3('0x30')]('SIP/%s',_0x184f23[_0xc4f3('0x2a')]):_0x184f23[_0xc4f3('0x36')],'type':_0xc4f3('0x2e'),'enterAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31')),'data1':_0xa2a900[_0xc4f3('0x37')][_0xc4f3('0x38')]||_0xc4f3('0x39'),'role':_0x184f23[_0xc4f3('0x2b')],'internal':_0x184f23[_0xc4f3('0x2c')],'uniqueid':_0xa2a900[_0xc4f3('0x37')]['uniqueid']||null});});return db[_0xc4f3('0x3a')][_0xc4f3('0x3b')](_0x19c6c9,{'individualHooks':!![]});}})[_0xc4f3('0x12')](function(){if(_0x184f23){return _0x184f23[_0xc4f3('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xa2a900['body']['type']||_0xc4f3('0x39'),'lastPauseAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31'))});}})['then'](function(_0xad242c){_0x1e82c0(_0xad242c);})[_0xc4f3('0x1b')](function(_0x53d2f2){_0x24db74(_0x17336a['error'](0x1f4,_0x53d2f2[_0xc4f3('0x19')]));});});};exports[_0xc4f3('0x3c')]=function(_0x1e9fa5){var _0x2c159c=this;return new Promise(function(_0x3a042f,_0x209985){var _0x3462d7;return db['User'][_0xc4f3('0x3d')]({'where':_0x1e9fa5[_0xc4f3('0x1f')][_0xc4f3('0x29')]||{},'attributes':['id','name']})[_0xc4f3('0x12')](function(_0x3168dd){if(_0x3168dd){_0x3462d7=_0x3168dd;if(_0x1e9fa5[_0xc4f3('0x37')][_0xc4f3('0x3e')]&&!utils['isValidChannel'](_0x1e9fa5[_0xc4f3('0x37')]['channel'])){throw new Error(_0xc4f3('0x3f'));}switch(_0x1e9fa5['body'][_0xc4f3('0x3e')]){case _0xc4f3('0x40'):return db[_0xc4f3('0x41')]['update']({'paused':0x0},{'where':{'UserId':_0x3462d7['id']}})[_0xc4f3('0x12')](function(){return db[_0xc4f3('0x3a')]['find']({'where':{'channel':_0x1e9fa5[_0xc4f3('0x37')][_0xc4f3('0x3e')],'membername':_0x3462d7['name'],'type':_0xc4f3('0x2e'),'exitAt':null}});})[_0xc4f3('0x12')](function(_0x2ae6d2){if(_0x2ae6d2){return _0x2ae6d2[_0xc4f3('0x2d')]({'exitAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31')),'data2':_0xc4f3('0x42')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3462d7[_0xc4f3('0x2d')]({'voicePause':![]});});case'mail':case _0xc4f3('0x43'):case'fax':case _0xc4f3('0x44'):case'openchannel':case _0xc4f3('0x45'):return db[_0xc4f3('0x3a')][_0xc4f3('0x27')]({'where':{'channel':_0x1e9fa5[_0xc4f3('0x37')][_0xc4f3('0x3e')],'membername':_0x3462d7[_0xc4f3('0x2a')],'type':_0xc4f3('0x2e'),'exitAt':null}})[_0xc4f3('0x12')](function(_0x581a5b){return _0x581a5b[_0xc4f3('0x2d')]({'exitAt':moment()[_0xc4f3('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc4f3('0x42')},{'individualHooks':!![]});})['then'](function(){var _0x5876d2={};_[_0xc4f3('0x46')](_0x5876d2,util[_0xc4f3('0x30')](_0xc4f3('0x47'),_0x1e9fa5[_0xc4f3('0x37')][_0xc4f3('0x3e')],_0xc4f3('0x48')),![]);return _0x3462d7[_0xc4f3('0x2d')](_0x5876d2);});default:return db['UserVoiceQueueRt'][_0xc4f3('0x2d')]({'paused':0x0},{'where':{'UserId':_0x3462d7['id']}})[_0xc4f3('0x12')](function(){return db[_0xc4f3('0x3a')]['findAll']({'where':{'membername':_0x3462d7[_0xc4f3('0x2a')],'type':_0xc4f3('0x2e'),'exitAt':null}});})['then'](function(_0x342280){var _0x5ce132=[];_0x342280[_0xc4f3('0x49')](function(_0x46a54c){_0x5ce132[_0xc4f3('0x34')](_0x46a54c[_0xc4f3('0x2d')]({'exitAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31')),'data2':_0xc4f3('0x42')}));});return BPromise['all'](_0x5ce132);})['then'](function(){return _0x3462d7[_0xc4f3('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc4f3('0x12')](function(_0x317b24){_0x3a042f(_0x317b24);})[_0xc4f3('0x1b')](function(_0x5866d8){_0x209985(_0x2c159c[_0xc4f3('0x16')](0x1f4,_0x5866d8[_0xc4f3('0x19')]));});});};exports[_0xc4f3('0x4a')]=function(_0x579bab){var _0x2514e7=this;return new Promise(function(_0x3f9801,_0x3c3c4b){var _0x52da19;return db[_0xc4f3('0x1d')][_0xc4f3('0x3d')]({'where':_0x579bab[_0xc4f3('0x1f')][_0xc4f3('0x29')]||{},'attributes':['id','name']})['then'](function(_0x236359){if(_0x236359){_0x52da19=_0x236359;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x52da19[_0xc4f3('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x52da19){return db[_0xc4f3('0x3a')][_0xc4f3('0x1e')]({'where':{'membername':_0x52da19[_0xc4f3('0x2a')],'exitAt':null}});}})[_0xc4f3('0x12')](function(_0x2ca9a6){if(_0x52da19){if(_0x2ca9a6&&_0x2ca9a6[_0xc4f3('0x2f')]){var _0x391df9=[];_0x2ca9a6['forEach'](function(_0x31ad35){_0x391df9['push'](_0x31ad35['update']({'exitAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31'))}));});return BPromise[_0xc4f3('0x4b')](_0x391df9);}}})['then'](function(){if(_0x52da19){return _0x52da19[_0xc4f3('0x2d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x41de89){_0x3f9801(_0x41de89);})[_0xc4f3('0x1b')](function(_0x492842){_0x3c3c4b(_0x2514e7['error'](0x1f4,_0x492842['message']));});});};exports['LoginUser']=function(_0xf60001){var _0x55ce2b=this;return new Promise(function(_0x4d7e8d,_0x4dba2a){var _0x23ac5e;var _0x1e0832;var _0x505a59;var _0x3615b8;return db[_0xc4f3('0x1d')][_0xc4f3('0x3d')]({'where':_0xf60001[_0xc4f3('0x1f')]['where']||{},'attributes':['id',_0xc4f3('0x2a'),_0xc4f3('0x2b'),_0xc4f3('0x4c'),_0xc4f3('0x4d'),_0xc4f3('0x2c'),_0xc4f3('0x4e'),_0xc4f3('0x36')]})[_0xc4f3('0x12')](function(_0x512731){if(_0x512731){_0x23ac5e=_0x512731;_0x3615b8=_0xf60001[_0xc4f3('0x37')][_0xc4f3('0x36')]?_0xf60001[_0xc4f3('0x37')][_0xc4f3('0x36')]:util['format'](_0xc4f3('0x4f'),_0x23ac5e[_0xc4f3('0x2a')]);return db[_0xc4f3('0x1d')][_0xc4f3('0x50')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x23ac5e['id']}}});}})['then'](function(_0x181557){if(_0x181557){_0x505a59=_0x181557;return require(_0xc4f3('0x51'))['getLicense']();}})['then'](function(_0x2ffbb3){if(_0x2ffbb3&&_0x2ffbb3['agents']&&_0x505a59>=_0x2ffbb3[_0xc4f3('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x23ac5e){return db['UserVoiceQueueRt'][_0xc4f3('0x53')]({'where':{'membername':_0x23ac5e[_0xc4f3('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x23ac5e){return _0x23ac5e['getVoiceQueues']({'raw':!![]});}})[_0xc4f3('0x12')](function(_0x8b087e){if(_0x23ac5e){if(_0x8b087e){var _0x4b9fe0=[];_0x1e0832=_0x8b087e;if(_0x1e0832[_0xc4f3('0x2f')]){for(var _0x324f5b=0x0;_0x324f5b<_0x1e0832['length'];_0x324f5b++){_0x4b9fe0['push'](db[_0xc4f3('0x41')][_0xc4f3('0x54')]({'membername':_0x23ac5e[_0xc4f3('0x2a')],'UserId':_0x23ac5e['id'],'queue_name':_0x1e0832[_0x324f5b][_0xc4f3('0x2a')],'VoiceQueueId':_0x1e0832[_0x324f5b]['id'],'interface':_0x3615b8,'paused':_0x23ac5e[_0xc4f3('0x4e')]||![],'penalty':_0x1e0832[_0x324f5b][_0xc4f3('0x55')]||0x0}));}return BPromise[_0xc4f3('0x4b')](_0x4b9fe0);}}}})['then'](function(){if(_0x23ac5e){return db[_0xc4f3('0x3a')]['findAll']({'where':{'membername':_0x23ac5e[_0xc4f3('0x2a')],'exitAt':null}});}})[_0xc4f3('0x12')](function(_0x122bf4){if(_0x23ac5e){if(_0x122bf4&&_0x122bf4['length']){var _0x18db4b=[];_0x122bf4[_0xc4f3('0x49')](function(_0x3f9cb6){_0x18db4b[_0xc4f3('0x34')](_0x3f9cb6[_0xc4f3('0x2d')]({'exitAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31'))}));});return BPromise['all'](_0x18db4b);}}})[_0xc4f3('0x12')](function(_0x234175){if(_0x23ac5e){var _0x34f05a=[];var _0x446e24=[];var _0x4944aa=utils[_0xc4f3('0x33')]();var _0x41be6a={'membername':_0x23ac5e[_0xc4f3('0x2a')],'interface':_0x3615b8,'enterAt':moment()['format'](_0xc4f3('0x31')),'role':_0x23ac5e['role'],'internal':_0x23ac5e['internal']};_0x4944aa['forEach'](function(_0xd59f24){_0x34f05a[_0xc4f3('0x34')](_[_0xc4f3('0x56')]({'channel':_0xd59f24,'type':_0xc4f3('0x57'),'data1':'callysquare','data2':_0x3615b8},_0x41be6a));if(_0x23ac5e[_0xc4f3('0x4e')]){_0x446e24[_0xc4f3('0x34')](_[_0xc4f3('0x56')]({'channel':_0xd59f24,'type':_0xc4f3('0x2e'),'data1':_0xc4f3('0x58')},_0x41be6a));}});return db[_0xc4f3('0x3a')][_0xc4f3('0x3b')](_0x34f05a['concat'](_0x446e24),{'individualHooks':!![]});}})[_0xc4f3('0x12')](function(){if(_0x23ac5e){return _0x23ac5e[_0xc4f3('0x2d')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x23ac5e['loginInPause']||![],'mailPause':_0x23ac5e['loginInPause']||![],'chatPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'faxPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'smsPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'openchannelPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'pauseType':_0x23ac5e[_0xc4f3('0x4e')]?_0xc4f3('0x58'):null,'lastPauseAt':moment()['format'](_0xc4f3('0x31')),'interface':_0x3615b8});}})[_0xc4f3('0x12')](function(_0x4ea226){_0x4d7e8d(_0x4ea226);})[_0xc4f3('0x1b')](function(_0x2e5dca){_0x4dba2a(_0x55ce2b[_0xc4f3('0x16')](0x1f4,_0x2e5dca['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f170bed..1c09a16 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 _0x354e=['emit','removeListener','register','user:','./user.events','save','remove'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x354e,0xba));var _0xe354=function(_0x2a9c86,_0x92e104){_0x2a9c86=_0x2a9c86-0x0;var _0x1ee0da=_0x354e[_0x2a9c86];return _0x1ee0da;};'use strict';var UserEvents=require(_0xe354('0x0'));var events=[_0xe354('0x1'),_0xe354('0x2'),'update'];function createListener(_0x40e1c0,_0x2c1753){return function(_0x7ff0bb){_0x2c1753[_0xe354('0x3')](_0x40e1c0,_0x7ff0bb);};}function removeListener(_0x4ed69f,_0x8ec156){return function(){UserEvents[_0xe354('0x4')](_0x4ed69f,_0x8ec156);};}exports[_0xe354('0x5')]=function(_0xda518c){for(var _0x2a3c22=0x0,_0x3d0747=events['length'];_0x2a3c22<_0x3d0747;_0x2a3c22++){var _0x1181bd=events[_0x2a3c22];var _0x62dd9a=createListener(_0xe354('0x6')+_0x1181bd,_0xda518c);UserEvents['on'](_0x1181bd,_0x62dd9a);}}; \ No newline at end of file +var _0x3355=['user:','./user.events','save','remove','emit','register','length'];(function(_0x23ec26,_0x194900){var _0x4a68c9=function(_0x3acc48){while(--_0x3acc48){_0x23ec26['push'](_0x23ec26['shift']());}};_0x4a68c9(++_0x194900);}(_0x3355,0x135));var _0x5335=function(_0x3fa729,_0x2cc40b){_0x3fa729=_0x3fa729-0x0;var _0x2d7326=_0x3355[_0x3fa729];return _0x2d7326;};'use strict';var UserEvents=require(_0x5335('0x0'));var events=[_0x5335('0x1'),_0x5335('0x2'),'update'];function createListener(_0x3d328b,_0x4b1e9d){return function(_0x2a7d0f){_0x4b1e9d[_0x5335('0x3')](_0x3d328b,_0x2a7d0f);};}function removeListener(_0x377f59,_0x5e1446){return function(){UserEvents['removeListener'](_0x377f59,_0x5e1446);};}exports[_0x5335('0x4')]=function(_0x5679d8){for(var _0x818cfa=0x0,_0x1fbef8=events[_0x5335('0x5')];_0x818cfa<_0x1fbef8;_0x818cfa++){var _0x1bd785=events[_0x818cfa];var _0x3ac468=createListener(_0x5335('0x6')+_0x1bd785,_0x5679d8);UserEvents['on'](_0x1bd785,_0x3ac468);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 521d0e0..607934a 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 _0x065f=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path'];(function(_0x5be342,_0x433d45){var _0x2c0a04=function(_0x115568){while(--_0x115568){_0x5be342['push'](_0x5be342['shift']());}};_0x2c0a04(++_0x433d45);}(_0x065f,0x1df));var _0xf065=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x065f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf065('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf065('0x1'));var interaction=require(_0xf065('0x2'));var config=require(_0xf065('0x3'));module[_0xf065('0x4')]=router; \ No newline at end of file +var _0x0cbe=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0cbe,0x15a));var _0xe0cb=function(_0x4facd2,_0x546072){_0x4facd2=_0x4facd2-0x0;var _0x2f0690=_0x0cbe[_0x4facd2];return _0x2f0690;};'use strict';var multer=require(_0xe0cb('0x0'));var util=require(_0xe0cb('0x1'));var path=require(_0xe0cb('0x2'));var timeout=require(_0xe0cb('0x3'));var express=require(_0xe0cb('0x4'));var router=express['Router']();var auth=require(_0xe0cb('0x5'));var interaction=require(_0xe0cb('0x6'));var config=require(_0xe0cb('0x7'));module[_0xe0cb('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b7e02cc..056a5f3 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(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_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(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 776c119..9d1b33c 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 _0x286a=['../../config/logger','api','path','./userChatQueue.attributes','lodash','util'];(function(_0x536732,_0x5212e5){var _0x35ef50=function(_0x365b2f){while(--_0x365b2f){_0x536732['push'](_0x536732['shift']());}};_0x35ef50(++_0x5212e5);}(_0x286a,0x76));var _0xa286=function(_0x5f9fba,_0x253261){_0x5f9fba=_0x5f9fba-0x0;var _0x2b8664=_0x286a[_0x5f9fba];return _0x2b8664;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var logger=require(_0xa286('0x2'))(_0xa286('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa286('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa286('0x5'));module['exports']=function(_0x5a8a2c,_0x3815be){return _0x5a8a2c['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd3e=['rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','path'];(function(_0x35046e,_0x5aaaba){var _0x576ae4=function(_0x587176){while(--_0x587176){_0x35046e['push'](_0x35046e['shift']());}};_0x576ae4(++_0x5aaaba);}(_0xcd3e,0x132));var _0xecd3=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xcd3e[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0xecd3('0x0'));var util=require(_0xecd3('0x1'));var logger=require(_0xecd3('0x2'))(_0xecd3('0x3'));var moment=require(_0xecd3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xecd3('0x5'));var rimraf=require(_0xecd3('0x6'));var config=require(_0xecd3('0x7'));var attributes=require(_0xecd3('0x8'));module[_0xecd3('0x9')]=function(_0x2b7dcd,_0x31fdd3){return _0x2b7dcd['define'](_0xecd3('0xa'),attributes,{'tableName':_0xecd3('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 72b5115..c96110e 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 _0xe18f=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','message','UserChatQueue,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe18f,0x1b2));var _0xfe18=function(_0x44969c,_0x17151e){_0x44969c=_0x44969c-0x0;var _0x48afb3=_0xe18f[_0x44969c];return _0x48afb3;};'use strict';var _=require('lodash');var util=require(_0xfe18('0x0'));var moment=require('moment');var BPromise=require(_0xfe18('0x1'));var rs=require(_0xfe18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe18('0x4'))(_0xfe18('0x5'));var config=require(_0xfe18('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427a1f,_0xfd3c1e,_0x6a63ee){return new BPromise(function(_0xf9ba5e,_0x4a9846){return client[_0xfe18('0x7')](_0x427a1f,_0x6a63ee)[_0xfe18('0x8')](function(_0x1122f4){logger[_0xfe18('0x9')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0xfe18('0xa'));logger[_0xfe18('0xb')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xfd3c1e,_0xfe18('0xa'),JSON['stringify'](_0x1122f4));if(_0x1122f4[_0xfe18('0xc')]){if(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xd')]===0x1f4){logger[_0xfe18('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);return _0x4a9846(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);}logger[_0xfe18('0xc')](_0xfe18('0xf'),_0xfd3c1e,_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);return _0xf9ba5e(_0x1122f4[_0xfe18('0xc')][_0xfe18('0xe')]);}else{logger[_0xfe18('0x9')](_0xfe18('0xf'),_0xfd3c1e,_0xfe18('0xa'));_0xf9ba5e(_0x1122f4[_0xfe18('0x10')]['message']);}})[_0xfe18('0x11')](function(_0x42d90c){logger[_0xfe18('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xfd3c1e,_0x42d90c);_0x4a9846(_0x42d90c);});});} \ No newline at end of file +var _0xcedb=['jayson/promise','http','request','then','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xc4cfed,_0x1cdd96){var _0xc4c8e0=function(_0x5ca848){while(--_0x5ca848){_0xc4cfed['push'](_0xc4cfed['shift']());}};_0xc4c8e0(++_0x1cdd96);}(_0xcedb,0x1d8));var _0xbced=function(_0x458e6c,_0x145c84){_0x458e6c=_0x458e6c-0x0;var _0x824387=_0xcedb[_0x458e6c];return _0x824387;};'use strict';var _=require(_0xbced('0x0'));var util=require(_0xbced('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbced('0x2'));var fs=require('fs');var Redis=require(_0xbced('0x3'));var db=require(_0xbced('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbced('0x5'))(_0xbced('0x6'));var config=require(_0xbced('0x7'));var jayson=require(_0xbced('0x8'));var client=jayson['client'][_0xbced('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41ca07,_0x4d2043,_0x5ba8ab){return new BPromise(function(_0x2c3114,_0x192840){return client[_0xbced('0xa')](_0x41ca07,_0x5ba8ab)[_0xbced('0xb')](function(_0xaeb608){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4d2043,_0xbced('0xc'));logger['debug'](_0xbced('0xd'),_0x4d2043,_0xbced('0xc'),JSON[_0xbced('0xe')](_0xaeb608));if(_0xaeb608[_0xbced('0xf')]){if(_0xaeb608[_0xbced('0xf')][_0xbced('0x10')]===0x1f4){logger['error'](_0xbced('0x11'),_0x4d2043,_0xaeb608[_0xbced('0xf')]['message']);return _0x192840(_0xaeb608['error'][_0xbced('0x12')]);}logger[_0xbced('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x4d2043,_0xaeb608[_0xbced('0xf')]['message']);return _0x2c3114(_0xaeb608[_0xbced('0xf')][_0xbced('0x12')]);}else{logger[_0xbced('0x13')](_0xbced('0x11'),_0x4d2043,_0xbced('0xc'));_0x2c3114(_0xaeb608['result']['message']);}})['catch'](function(_0x35ab11){logger[_0xbced('0xf')](_0xbced('0x11'),_0x4d2043,_0x35ab11);_0x192840(_0x35ab11);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 517e7cb..17668ee 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 _0x665c=['multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3182bb,_0x4aaf26){var _0xf2be5a=function(_0x580af4){while(--_0x580af4){_0x3182bb['push'](_0x3182bb['shift']());}};_0xf2be5a(++_0x4aaf26);}(_0x665c,0x1e3));var _0xc665=function(_0x594f5f,_0x1ed564){_0x594f5f=_0x594f5f-0x0;var _0x357dea=_0x665c[_0x594f5f];return _0x357dea;};'use strict';var multer=require(_0xc665('0x0'));var util=require(_0xc665('0x1'));var path=require(_0xc665('0x2'));var timeout=require('connect-timeout');var express=require(_0xc665('0x3'));var router=express[_0xc665('0x4')]();var auth=require(_0xc665('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc665('0x6'));module['exports']=router; \ No newline at end of file +var _0x0ce3=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x4ec36b,_0x1735ca){var _0x337d41=function(_0x5c5d4b){while(--_0x5c5d4b){_0x4ec36b['push'](_0x4ec36b['shift']());}};_0x337d41(++_0x1735ca);}(_0x0ce3,0x187));var _0x30ce=function(_0x41904c,_0x4f6b93){_0x41904c=_0x41904c-0x0;var _0xe97d41=_0x0ce3[_0x41904c];return _0xe97d41;};'use strict';var multer=require(_0x30ce('0x0'));var util=require(_0x30ce('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30ce('0x2'));var router=express[_0x30ce('0x3')]();var auth=require(_0x30ce('0x4'));var interaction=require(_0x30ce('0x5'));var config=require(_0x30ce('0x6'));module[_0x30ce('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 3eac270..52db712 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 _0x4cf8=['STRING','sequelize','exports','INTEGER'];(function(_0x41d300,_0x2d0c64){var _0x1e02e7=function(_0x19e308){while(--_0x19e308){_0x41d300['push'](_0x41d300['shift']());}};_0x1e02e7(++_0x2d0c64);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xc8a02c,_0x4809d3){_0xc8a02c=_0xc8a02c-0x0;var _0x3d89da=_0x4cf8[_0xc8a02c];return _0x3d89da;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'penalty':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x84cf('0x3')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize','INTEGER'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7b7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d0a7d93..d59ac2e 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 _0x4b74=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4b74,0x103));var _0x44b7=function(_0x388be2,_0x15d334){_0x388be2=_0x388be2-0x0;var _0x26b754=_0x4b74[_0x388be2];return _0x26b754;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var logger=require(_0x44b7('0x2'))('api');var moment=require(_0x44b7('0x3'));var BPromise=require(_0x44b7('0x4'));var rp=require(_0x44b7('0x5'));var fs=require('fs');var path=require(_0x44b7('0x6'));var rimraf=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var attributes=require(_0x44b7('0x9'));module[_0x44b7('0xa')]=function(_0x5ef96c,_0xdfcf5){return _0x5ef96c[_0x44b7('0xb')](_0x44b7('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabae=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','../../config/logger'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xabae,0x1a1));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeaba('0x0'))(_0xeaba('0x1'));var moment=require(_0xeaba('0x2'));var BPromise=require(_0xeaba('0x3'));var rp=require(_0xeaba('0x4'));var fs=require('fs');var path=require(_0xeaba('0x5'));var rimraf=require(_0xeaba('0x6'));var config=require(_0xeaba('0x7'));var attributes=require(_0xeaba('0x8'));module[_0xeaba('0x9')]=function(_0xe39f39,_0x37903a){return _0xe39f39['define'](_0xeaba('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index cac53a4..3ca881b 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 _0x0216=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa651d4,_0x5df6cb){var _0x1301be=function(_0x5aa409){while(--_0x5aa409){_0xa651d4['push'](_0xa651d4['shift']());}};_0x1301be(++_0x5df6cb);}(_0x0216,0x1c4));var _0x6021=function(_0x2e5f80,_0x5de3ce){_0x2e5f80=_0x2e5f80-0x0;var _0x2804a4=_0x0216[_0x2e5f80];return _0x2804a4;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var moment=require(_0x6021('0x2'));var BPromise=require(_0x6021('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6021('0x4'));var db=require(_0x6021('0x5'))['db'];var utils=require(_0x6021('0x6'));var logger=require(_0x6021('0x7'))(_0x6021('0x8'));var config=require(_0x6021('0x9'));var jayson=require(_0x6021('0xa'));var client=jayson[_0x6021('0xb')][_0x6021('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3391ad,_0x16b07e,_0x587c6e){return new BPromise(function(_0xe58d1,_0x53843c){return client[_0x6021('0xd')](_0x3391ad,_0x587c6e)[_0x6021('0xe')](function(_0x3dc766){logger[_0x6021('0xf')](_0x6021('0x10'),_0x16b07e,_0x6021('0x11'));logger['debug'](_0x6021('0x12'),_0x16b07e,'request\x20sent',JSON['stringify'](_0x3dc766));if(_0x3dc766['error']){if(_0x3dc766[_0x6021('0x13')]['code']===0x1f4){logger[_0x6021('0x13')](_0x6021('0x10'),_0x16b07e,_0x3dc766[_0x6021('0x13')]['message']);return _0x53843c(_0x3dc766['error']['message']);}logger[_0x6021('0x13')](_0x6021('0x10'),_0x16b07e,_0x3dc766['error'][_0x6021('0x14')]);return _0xe58d1(_0x3dc766[_0x6021('0x13')][_0x6021('0x14')]);}else{logger[_0x6021('0xf')](_0x6021('0x10'),_0x16b07e,_0x6021('0x11'));_0xe58d1(_0x3dc766[_0x6021('0x15')][_0x6021('0x14')]);}})[_0x6021('0x16')](function(_0x1f85a2){logger[_0x6021('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x16b07e,_0x1f85a2);_0x53843c(_0x1f85a2);});});} \ No newline at end of file +var _0x38d2=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36fd9f,_0x1cc5d6){var _0x257dbb=function(_0x501651){while(--_0x501651){_0x36fd9f['push'](_0x36fd9f['shift']());}};_0x257dbb(++_0x1cc5d6);}(_0x38d2,0xed));var _0x238d=function(_0x7af6da,_0x4e742b){_0x7af6da=_0x7af6da-0x0;var _0x23ada3=_0x38d2[_0x7af6da];return _0x23ada3;};'use strict';var _=require('lodash');var util=require(_0x238d('0x0'));var moment=require('moment');var BPromise=require(_0x238d('0x1'));var rs=require(_0x238d('0x2'));var fs=require('fs');var Redis=require(_0x238d('0x3'));var db=require(_0x238d('0x4'))['db'];var utils=require(_0x238d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x238d('0x6'));var jayson=require(_0x238d('0x7'));var client=jayson[_0x238d('0x8')][_0x238d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x136e5e,_0x1b68ee,_0x4d5448){return new BPromise(function(_0x45e0f5,_0x6e4ee5){return client[_0x238d('0xa')](_0x136e5e,_0x4d5448)[_0x238d('0xb')](function(_0x4c7808){logger[_0x238d('0xc')](_0x238d('0xd'),_0x1b68ee,_0x238d('0xe'));logger['debug'](_0x238d('0xf'),_0x1b68ee,_0x238d('0xe'),JSON[_0x238d('0x10')](_0x4c7808));if(_0x4c7808[_0x238d('0x11')]){if(_0x4c7808[_0x238d('0x11')][_0x238d('0x12')]===0x1f4){logger[_0x238d('0x11')](_0x238d('0xd'),_0x1b68ee,_0x4c7808[_0x238d('0x11')][_0x238d('0x13')]);return _0x6e4ee5(_0x4c7808[_0x238d('0x11')][_0x238d('0x13')]);}logger['error'](_0x238d('0xd'),_0x1b68ee,_0x4c7808[_0x238d('0x11')]['message']);return _0x45e0f5(_0x4c7808[_0x238d('0x11')]['message']);}else{logger[_0x238d('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x1b68ee,_0x238d('0xe'));_0x45e0f5(_0x4c7808[_0x238d('0x14')][_0x238d('0x13')]);}})[_0x238d('0x15')](function(_0x1151b4){logger['error'](_0x238d('0xd'),_0x1b68ee,_0x1151b4);_0x6e4ee5(_0x1151b4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a8d95de..d208e0c 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 _0xe20c=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5528ea,_0x4d95cf){var _0x1253b8=function(_0x972d5d){while(--_0x972d5d){_0x5528ea['push'](_0x5528ea['shift']());}};_0x1253b8(++_0x4d95cf);}(_0xe20c,0x8d));var _0xce20=function(_0x196beb,_0x8f007){_0x196beb=_0x196beb-0x0;var _0x2f3049=_0xe20c[_0x196beb];return _0x2f3049;};'use strict';var multer=require(_0xce20('0x0'));var util=require(_0xce20('0x1'));var path=require(_0xce20('0x2'));var timeout=require('connect-timeout');var express=require(_0xce20('0x3'));var router=express['Router']();var auth=require(_0xce20('0x4'));var interaction=require(_0xce20('0x5'));var config=require('../../config/environment');module[_0xce20('0x6')]=router; \ No newline at end of file +var _0x030b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x030b,0x184));var _0xb030=function(_0x2f67ac,_0x4fbdd2){_0x2f67ac=_0x2f67ac-0x0;var _0x6c0999=_0x030b[_0x2f67ac];return _0x6c0999;};'use strict';var multer=require(_0xb030('0x0'));var util=require(_0xb030('0x1'));var path=require(_0xb030('0x2'));var timeout=require(_0xb030('0x3'));var express=require(_0xb030('0x4'));var router=express[_0xb030('0x5')]();var auth=require(_0xb030('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb030('0x7'));module[_0xb030('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7eb5fc3..3e1c708 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1efe72,_0x45f360){var _0x4d988a=function(_0x5166d7){while(--_0x5166d7){_0x1efe72['push'](_0x1efe72['shift']());}};_0x4d988a(++_0x45f360);}(_0xe706,0xa3));var _0x6e70=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0xe706[_0x12c076];return _0x2ddd18;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b07465c..0259774 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x212a8e,_0x259099){var _0x1cbbc7=function(_0x1ef08c){while(--_0x1ef08c){_0x212a8e['push'](_0x212a8e['shift']());}};_0x1cbbc7(++_0x259099);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x2e8437,_0xbb7be9){var _0x23442d=function(_0x43eb98){while(--_0x43eb98){_0x2e8437['push'](_0x2e8437['shift']());}};_0x23442d(++_0xbb7be9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 7e78b2a..5150c82 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 _0x7a8d=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x7a8d,0x185));var _0xd7a8=function(_0x23be27,_0x4a5655){_0x23be27=_0x23be27-0x0;var _0x5c270f=_0x7a8d[_0x23be27];return _0x5c270f;};'use strict';var _=require(_0xd7a8('0x0'));var util=require(_0xd7a8('0x1'));var moment=require(_0xd7a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7a8('0x4'))['db'];var utils=require(_0xd7a8('0x5'));var logger=require('../../config/logger')(_0xd7a8('0x6'));var config=require(_0xd7a8('0x7'));var jayson=require(_0xd7a8('0x8'));var client=jayson[_0xd7a8('0x9')][_0xd7a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x579f5d,_0x343e6a,_0x1c5050){return new BPromise(function(_0x3bda3b,_0x3d5f77){return client[_0xd7a8('0xb')](_0x579f5d,_0x1c5050)[_0xd7a8('0xc')](function(_0x2a2d90){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x343e6a,_0xd7a8('0xd'));logger[_0xd7a8('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x343e6a,_0xd7a8('0xd'),JSON[_0xd7a8('0xf')](_0x2a2d90));if(_0x2a2d90['error']){if(_0x2a2d90[_0xd7a8('0x10')][_0xd7a8('0x11')]===0x1f4){logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x2a2d90['error']['message']);return _0x3d5f77(_0x2a2d90['error'][_0xd7a8('0x13')]);}logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x2a2d90[_0xd7a8('0x10')][_0xd7a8('0x13')]);return _0x3bda3b(_0x2a2d90['error'][_0xd7a8('0x13')]);}else{logger['info'](_0xd7a8('0x12'),_0x343e6a,_0xd7a8('0xd'));_0x3bda3b(_0x2a2d90[_0xd7a8('0x14')][_0xd7a8('0x13')]);}})[_0xd7a8('0x15')](function(_0x37918e){logger[_0xd7a8('0x10')](_0xd7a8('0x12'),_0x343e6a,_0x37918e);_0x3d5f77(_0x37918e);});});} \ No newline at end of file +var _0xf715=['jayson/promise','client','http','request','info','request\x20sent','stringify','error','message','UserMailQueue,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x52a329,_0xa14a96){var _0x15c966=function(_0x301737){while(--_0x301737){_0x52a329['push'](_0x52a329['shift']());}};_0x15c966(++_0xa14a96);}(_0xf715,0x90));var _0x5f71=function(_0x5d32f1,_0x41bb11){_0x5d32f1=_0x5d32f1-0x0;var _0x1e0130=_0xf715[_0x5d32f1];return _0x1e0130;};'use strict';var _=require('lodash');var util=require(_0x5f71('0x0'));var moment=require('moment');var BPromise=require(_0x5f71('0x1'));var rs=require(_0x5f71('0x2'));var fs=require('fs');var Redis=require(_0x5f71('0x3'));var db=require(_0x5f71('0x4'))['db'];var utils=require(_0x5f71('0x5'));var logger=require(_0x5f71('0x6'))('rpc');var config=require(_0x5f71('0x7'));var jayson=require(_0x5f71('0x8'));var client=jayson[_0x5f71('0x9')][_0x5f71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4210a7,_0x5e34c0,_0x52cab5){return new BPromise(function(_0x7eec34,_0x2d0515){return client[_0x5f71('0xb')](_0x4210a7,_0x52cab5)['then'](function(_0x5d8110){logger[_0x5f71('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x5e34c0,_0x5f71('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x5e34c0,'request\x20sent',JSON[_0x5f71('0xe')](_0x5d8110));if(_0x5d8110['error']){if(_0x5d8110['error']['code']===0x1f4){logger[_0x5f71('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x2d0515(_0x5d8110['error'][_0x5f71('0x10')]);}logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x7eec34(_0x5d8110['error'][_0x5f71('0x10')]);}else{logger[_0x5f71('0xc')](_0x5f71('0x11'),_0x5e34c0,'request\x20sent');_0x7eec34(_0x5d8110[_0x5f71('0x12')][_0x5f71('0x10')]);}})['catch'](function(_0x532036){logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x532036);_0x2d0515(_0x532036);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c55c06a..9d3c063 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 _0x264f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x4db1d7,_0xe0d557){var _0x53f2d7=function(_0x167c55){while(--_0x167c55){_0x4db1d7['push'](_0x4db1d7['shift']());}};_0x53f2d7(++_0xe0d557);}(_0x264f,0x184));var _0xf264=function(_0x35fbfa,_0x1c219f){_0x35fbfa=_0x35fbfa-0x0;var _0xe51b5e=_0x264f[_0x35fbfa];return _0xe51b5e;};'use strict';var multer=require(_0xf264('0x0'));var util=require(_0xf264('0x1'));var path=require(_0xf264('0x2'));var timeout=require(_0xf264('0x3'));var express=require(_0xf264('0x4'));var router=express[_0xf264('0x5')]();var auth=require(_0xf264('0x6'));var interaction=require(_0xf264('0x7'));var config=require(_0xf264('0x8'));module[_0xf264('0x9')]=router; \ No newline at end of file +var _0x8bae=['../../components/auth/service','exports','util','path','connect-timeout','express','Router'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0x8bae,0x1b4));var _0xe8ba=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8bae[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xe8ba('0x0'));var path=require(_0xe8ba('0x1'));var timeout=require(_0xe8ba('0x2'));var express=require(_0xe8ba('0x3'));var router=express[_0xe8ba('0x4')]();var auth=require(_0xe8ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xe8ba('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8eaa7f9..1726f43 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 _0xbaf0=['exports','INTEGER'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 48b243d..fa32fc4 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 _0xcf82=['moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x146c3d,_0x152dbd){var _0x33423e=function(_0x5a1728){while(--_0x5a1728){_0x146c3d['push'](_0x146c3d['shift']());}};_0x33423e(++_0x152dbd);}(_0xcf82,0xf8));var _0x2cf8=function(_0x2b94b6,_0x32450c){_0x2b94b6=_0x2b94b6-0x0;var _0x3b218c=_0xcf82[_0x2b94b6];return _0x3b218c;};'use strict';var _=require(_0x2cf8('0x0'));var util=require(_0x2cf8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2cf8('0x2'));var BPromise=require(_0x2cf8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2cf8('0x4'));var config=require(_0x2cf8('0x5'));var attributes=require(_0x2cf8('0x6'));module[_0x2cf8('0x7')]=function(_0x255b38,_0x3c09ec){return _0x255b38['define'](_0x2cf8('0x8'),attributes,{'tableName':_0x2cf8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc89a=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x30e952,_0x123520){var _0x2cf13a=function(_0x57347a){while(--_0x57347a){_0x30e952['push'](_0x30e952['shift']());}};_0x2cf13a(++_0x123520);}(_0xc89a,0x1e6));var _0xac89=function(_0x53dc6d,_0x5f52b1){_0x53dc6d=_0x53dc6d-0x0;var _0x3aefa2=_0xc89a[_0x53dc6d];return _0x3aefa2;};'use strict';var _=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var logger=require(_0xac89('0x2'))('api');var moment=require(_0xac89('0x3'));var BPromise=require(_0xac89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac89('0x5'));var rimraf=require('rimraf');var config=require(_0xac89('0x6'));var attributes=require(_0xac89('0x7'));module['exports']=function(_0x30aafc,_0x3c5ce0){return _0x30aafc[_0xac89('0x8')](_0xac89('0x9'),attributes,{'tableName':_0xac89('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 b9ec812..91850b1 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 _0x74f6=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x326d37,_0x1d2511){var _0x27f6f3=function(_0x5d89cd){while(--_0x5d89cd){_0x326d37['push'](_0x326d37['shift']());}};_0x27f6f3(++_0x1d2511);}(_0x74f6,0xfc));var _0x674f=function(_0x297396,_0x4a8c79){_0x297396=_0x297396-0x0;var _0x58521f=_0x74f6[_0x297396];return _0x58521f;};'use strict';var _=require(_0x674f('0x0'));var util=require('util');var moment=require(_0x674f('0x1'));var BPromise=require('bluebird');var rs=require(_0x674f('0x2'));var fs=require('fs');var Redis=require(_0x674f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x674f('0x4'));var logger=require(_0x674f('0x5'))('rpc');var config=require(_0x674f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x674f('0x7')][_0x674f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dd294,_0x44bfbf,_0x3689ea){return new BPromise(function(_0x5644ab,_0x519239){return client[_0x674f('0x9')](_0x2dd294,_0x3689ea)['then'](function(_0x2e7d0f){logger[_0x674f('0xa')](_0x674f('0xb'),_0x44bfbf,_0x674f('0xc'));logger[_0x674f('0xd')](_0x674f('0xe'),_0x44bfbf,_0x674f('0xc'),JSON['stringify'](_0x2e7d0f));if(_0x2e7d0f[_0x674f('0xf')]){if(_0x2e7d0f['error'][_0x674f('0x10')]===0x1f4){logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x2e7d0f['error'][_0x674f('0x11')]);return _0x519239(_0x2e7d0f[_0x674f('0xf')][_0x674f('0x11')]);}logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x2e7d0f[_0x674f('0xf')]['message']);return _0x5644ab(_0x2e7d0f['error']['message']);}else{logger[_0x674f('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x44bfbf,_0x674f('0xc'));_0x5644ab(_0x2e7d0f[_0x674f('0x12')][_0x674f('0x11')]);}})['catch'](function(_0x1a2073){logger[_0x674f('0xf')](_0x674f('0xb'),_0x44bfbf,_0x1a2073);_0x519239(_0x1a2073);});});} \ No newline at end of file +var _0x8b93=['error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x39887a,_0x5835ca){var _0x1f8468=function(_0x43032f){while(--_0x43032f){_0x39887a['push'](_0x39887a['shift']());}};_0x1f8468(++_0x5835ca);}(_0x8b93,0x153));var _0x38b9=function(_0x49cde7,_0x1a5daa){_0x49cde7=_0x49cde7-0x0;var _0x3c7f08=_0x8b93[_0x49cde7];return _0x3c7f08;};'use strict';var _=require(_0x38b9('0x0'));var util=require(_0x38b9('0x1'));var moment=require(_0x38b9('0x2'));var BPromise=require(_0x38b9('0x3'));var rs=require(_0x38b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x38b9('0x5'))(_0x38b9('0x6'));var config=require(_0x38b9('0x7'));var jayson=require(_0x38b9('0x8'));var client=jayson[_0x38b9('0x9')][_0x38b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x182c26,_0x3f3823,_0x1f3413){return new BPromise(function(_0x44fedc,_0x16ba4){return client[_0x38b9('0xb')](_0x182c26,_0x1f3413)['then'](function(_0x553767){logger[_0x38b9('0xc')](_0x38b9('0xd'),_0x3f3823,'request\x20sent');logger[_0x38b9('0xe')](_0x38b9('0xf'),_0x3f3823,_0x38b9('0x10'),JSON[_0x38b9('0x11')](_0x553767));if(_0x553767[_0x38b9('0x12')]){if(_0x553767[_0x38b9('0x12')]['code']===0x1f4){logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);return _0x16ba4(_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);}logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);return _0x44fedc(_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);}else{logger[_0x38b9('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3f3823,_0x38b9('0x10'));_0x44fedc(_0x553767['result'][_0x38b9('0x13')]);}})[_0x38b9('0x14')](function(_0x2a886d){logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x2a886d);_0x16ba4(_0x2a886d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index dc3ef15..d893bc9 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 _0x1d55=['index','/describe','/:id','/:id/sections','getResources','post','addSections','/:id/resources','addResources','delete','destroy','removeSections','removeResources','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x1d55,0x189));var _0x51d5=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x1d55[_0x2b8077];return _0x308091;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x51d5('0x0'));var express=require(_0x51d5('0x1'));var router=express[_0x51d5('0x2')]();var auth=require(_0x51d5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x51d5('0x4')]('/',auth[_0x51d5('0x5')](),controller[_0x51d5('0x6')]);router[_0x51d5('0x4')](_0x51d5('0x7'),auth[_0x51d5('0x5')](),controller['describe']);router[_0x51d5('0x4')](_0x51d5('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x51d5('0x4')](_0x51d5('0x9'),auth[_0x51d5('0x5')](),controller['getSections']);router['get']('/:id/resources',auth[_0x51d5('0x5')](),controller[_0x51d5('0xa')]);router[_0x51d5('0xb')]('/',auth[_0x51d5('0x5')](),controller['create']);router[_0x51d5('0xb')]('/:id/clone',auth[_0x51d5('0x5')](),controller['clone']);router['post'](_0x51d5('0x9'),auth[_0x51d5('0x5')](),controller[_0x51d5('0xc')]);router[_0x51d5('0xb')](_0x51d5('0xd'),auth[_0x51d5('0x5')](),controller[_0x51d5('0xe')]);router['put'](_0x51d5('0x8'),auth[_0x51d5('0x5')](),controller['update']);router[_0x51d5('0xf')]('/:id',auth[_0x51d5('0x5')](),controller[_0x51d5('0x10')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x51d5('0x11')]);router['delete']('/:id/resources',auth[_0x51d5('0x5')](),controller[_0x51d5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2f00=['clone','addSections','addResources','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0x500c6d,_0x5897e4){var _0x41596e=function(_0x395d2b){while(--_0x395d2b){_0x500c6d['push'](_0x500c6d['shift']());}};_0x41596e(++_0x5897e4);}(_0x2f00,0x102));var _0x02f0=function(_0x228a25,_0xc617b7){_0x228a25=_0x228a25-0x0;var _0x4c305c=_0x2f00[_0x228a25];return _0x4c305c;};'use strict';var multer=require(_0x02f0('0x0'));var util=require(_0x02f0('0x1'));var path=require(_0x02f0('0x2'));var timeout=require(_0x02f0('0x3'));var express=require(_0x02f0('0x4'));var router=express[_0x02f0('0x5')]();var auth=require(_0x02f0('0x6'));var interaction=require(_0x02f0('0x7'));var config=require(_0x02f0('0x8'));var controller=require(_0x02f0('0x9'));router[_0x02f0('0xa')]('/',auth['isAuthenticated'](),controller[_0x02f0('0xb')]);router[_0x02f0('0xa')](_0x02f0('0xc'),auth[_0x02f0('0xd')](),controller[_0x02f0('0xe')]);router['get'](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x10')]);router['get'](_0x02f0('0x11'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x12')]);router[_0x02f0('0xa')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x14')]);router[_0x02f0('0x15')]('/',auth[_0x02f0('0xd')](),controller['create']);router[_0x02f0('0x15')]('/:id/clone',auth[_0x02f0('0xd')](),controller[_0x02f0('0x16')]);router[_0x02f0('0x15')]('/:id/sections',auth['isAuthenticated'](),controller[_0x02f0('0x17')]);router[_0x02f0('0x15')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x18')]);router['put'](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller['update']);router[_0x02f0('0x19')](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x1a')]);router[_0x02f0('0x19')](_0x02f0('0x11'),auth[_0x02f0('0xd')](),controller['removeSections']);router[_0x02f0('0x19')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller['removeResources']);module[_0x02f0('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 ffe89cd..c1bf310 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 _0xa0e2=['join','getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xa0e2,0xaa));var _0x2a0e=function(_0x5a46ca,_0x3f30a5){_0x5a46ca=_0x5a46ca-0x0;var _0x1606db=_0xa0e2[_0x5a46ca];return _0x1606db;};'use strict';var Sequelize=require(_0x2a0e('0x0'));module[_0x2a0e('0x1')]={'name':{'type':Sequelize[_0x2a0e('0x2')],'allowNull':![],'unique':_0x2a0e('0x3')},'crudPermissions':{'type':Sequelize[_0x2a0e('0x2')],'set':function(_0x14b3c7){this[_0x2a0e('0x4')](_0x2a0e('0x5'),_0x14b3c7?_0x14b3c7[_0x2a0e('0x6')](''):[]);},'get':function(){return this[_0x2a0e('0x7')](_0x2a0e('0x5'))?this['getDataValue'](_0x2a0e('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xdb28=['STRING','name','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports'];(function(_0x4c29f9,_0x5bddd4){var _0x4e17b8=function(_0x12e055){while(--_0x12e055){_0x4c29f9['push'](_0x4c29f9['shift']());}};_0x4e17b8(++_0x5bddd4);}(_0xdb28,0x1ae));var _0x8db2=function(_0x1172a1,_0x57e7aa){_0x1172a1=_0x1172a1-0x0;var _0x340bda=_0xdb28[_0x1172a1];return _0x340bda;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')],'allowNull':![],'unique':_0x8db2('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x8f381c){this[_0x8db2('0x4')]('crudPermissions',_0x8f381c?_0x8f381c[_0x8db2('0x5')](''):[]);},'get':function(){return this[_0x8db2('0x6')](_0x8db2('0x7'))?this[_0x8db2('0x6')](_0x8db2('0x7'))[_0x8db2('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8db2('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f2c1125..2d3f35b 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 _0xb00d=['autoAssociation','userProfileId','Resources','UserProfileResource','describe','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','key','field','AnalyticExtractedReport','foreignKey','associatedResources','default','DefaultReports','custom','reportId','CustomReports','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','odbc','squarerecordings','SquareRecording','projectName','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','templates','Template','trunks','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','each'];(function(_0x4afb68,_0x39a838){var _0x21e88b=function(_0x1877ea){while(--_0x1877ea){_0x4afb68['push'](_0x4afb68['shift']());}};_0x21e88b(++_0x39a838);}(_0xb00d,0x97));var _0xdb00=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0xb00d[_0x4c8232];return _0x3cc8e5;};'use strict';var pdf=require(_0xdb00('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb00('0x1'));var rp=require(_0xdb00('0x2'));var moment=require(_0xdb00('0x3'));var BPromise=require(_0xdb00('0x4'));var Mustache=require(_0xdb00('0x5'));var util=require(_0xdb00('0x6'));var path=require(_0xdb00('0x7'));var sox=require(_0xdb00('0x8'));var csv=require('to-csv');var ejs=require(_0xdb00('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb00('0xa'));var deskjs=require(_0xdb00('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdb00('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb00('0xd'));var authService=require(_0xdb00('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb00('0xf'))(_0xdb00('0x10'));var utils=require(_0xdb00('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xdb00('0x12'));var db=require(_0xdb00('0x13'))['db'];config[_0xdb00('0x14')]=_[_0xdb00('0x15')](config[_0xdb00('0x14')],{'host':_0xdb00('0x16'),'port':0x18eb});var socket=require(_0xdb00('0x17'))(new Redis(config['redis']));require(_0xdb00('0x18'))[_0xdb00('0x19')](socket);function respondWithStatusCode(_0x5966ec,_0x303ee0){_0x303ee0=_0x303ee0||0xcc;return function(_0x43accb){if(_0x43accb){return _0x5966ec[_0xdb00('0x1a')](_0x303ee0);}return _0x5966ec['status'](_0x303ee0)['end']();};}function respondWithResult(_0x1f9295,_0x25b570){_0x25b570=_0x25b570||0xc8;return function(_0x2e49fc){if(_0x2e49fc){return _0x1f9295[_0xdb00('0x1b')](_0x25b570)[_0xdb00('0x1c')](_0x2e49fc);}};}function respondWithFilteredResult(_0xc16102,_0x5beda0){return function(_0x126e9c){if(_0x126e9c){var _0xbd0108=_0x126e9c[_0xdb00('0x1d')],_0x433a0d=_0x5beda0[_0xdb00('0x1e')],_0x20663e=_0x5beda0['offset']+_0x5beda0[_0xdb00('0x1f')],_0x4ce15c;if(_0x20663e>=_0xbd0108){_0x20663e=_0xbd0108;_0x4ce15c=0xc8;}else{_0x4ce15c=0xce;}_0xc16102['status'](_0x4ce15c);return _0xc16102[_0xdb00('0x20')](_0xdb00('0x21'),_0x433a0d+'-'+_0x20663e+'/'+_0xbd0108)[_0xdb00('0x1c')](_0x126e9c);}return null;};}function patchUpdates(_0x1634ec){return function(_0x1cd544){try{jsonpatch[_0xdb00('0x22')](_0x1cd544,_0x1634ec,!![]);}catch(_0x5b2e37){return BPromise['reject'](_0x5b2e37);}return _0x1cd544[_0xdb00('0x23')]();};}function saveUpdates(_0xfa8b20,_0x5cd6bc){return function(_0x102b62){if(_0x102b62){return _0x102b62[_0xdb00('0x24')](_0xfa8b20)['then'](function(_0x10a173){return _0x10a173;});}return null;};}function removeEntity(_0x1ea9c2,_0x5df808){return function(_0x243455){if(_0x243455){return _0x243455[_0xdb00('0x25')]()[_0xdb00('0x26')](function(){_0x1ea9c2[_0xdb00('0x1b')](0xcc)[_0xdb00('0x27')]();});}};}function handleEntityNotFound(_0xfd862d,_0x30f893){return function(_0x164e18){if(!_0x164e18){_0xfd862d[_0xdb00('0x1a')](0x194);}return _0x164e18;};}function handleError(_0x4593ce,_0x4c13d8){_0x4c13d8=_0x4c13d8||0x1f4;return function(_0x59ce6f){logger[_0xdb00('0x28')](_0x59ce6f[_0xdb00('0x29')]);if(_0x59ce6f[_0xdb00('0x2a')]){delete _0x59ce6f['name'];}_0x4593ce[_0xdb00('0x1b')](_0x4c13d8)['send'](_0x59ce6f);};}exports[_0xdb00('0x2b')]=function(_0x363a0b,_0xae2037){var _0x4ad23b={},_0x4e8d17={},_0x45aa3b={'count':0x0,'rows':[]};var _0x40187d=_[_0xdb00('0x2c')](db[_0xdb00('0x2d')][_0xdb00('0x2e')],function(_0x27518b){return{'name':_0x27518b[_0xdb00('0x2f')],'type':_0x27518b[_0xdb00('0x30')]['key']};});_0x4e8d17[_0xdb00('0x31')]=_[_0xdb00('0x2c')](_0x40187d,_0xdb00('0x2a'));_0x4e8d17[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x363a0b[_0xdb00('0x32')]);_0x4e8d17[_0xdb00('0x34')]=_[_0xdb00('0x35')](_0x4e8d17[_0xdb00('0x31')],_0x4e8d17[_0xdb00('0x32')]);_0x4ad23b[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x4e8d17['model'],qs[_0xdb00('0x37')](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x37')]));_0x4ad23b['attributes']=_0x4ad23b[_0xdb00('0x36')][_0xdb00('0x38')]?_0x4ad23b['attributes']:_0x4e8d17[_0xdb00('0x31')];if(!_0x363a0b['query'][_0xdb00('0x39')](_0xdb00('0x3a'))){_0x4ad23b['limit']=qs['limit'](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x1f')]);_0x4ad23b['offset']=qs[_0xdb00('0x1e')](_0x363a0b[_0xdb00('0x32')][_0xdb00('0x1e')]);}_0x4ad23b['order']=qs[_0xdb00('0x3b')](_0x363a0b[_0xdb00('0x32')]['sort']);_0x4ad23b[_0xdb00('0x3c')]=qs[_0xdb00('0x34')](_['pick'](_0x363a0b[_0xdb00('0x32')],_0x4e8d17[_0xdb00('0x34')]),_0x40187d);if(_0x363a0b['query'][_0xdb00('0x3d')]){_0x4ad23b[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x4ad23b['where'],{'$or':_[_0xdb00('0x2c')](_0x40187d,function(_0x2f721a){if(_0x2f721a['type']!==_0xdb00('0x3f')){var _0x1296fe={};_0x1296fe[_0x2f721a['name']]={'$like':'%'+_0x363a0b['query']['filter']+'%'};return _0x1296fe;}})});}_0x4ad23b=_[_0xdb00('0x3e')]({},_0x4ad23b,_0x363a0b[_0xdb00('0x40')]);var _0x18aca1={'where':_0x4ad23b[_0xdb00('0x3c')]};return db[_0xdb00('0x2d')][_0xdb00('0x1d')](_0x18aca1)[_0xdb00('0x26')](function(_0x2b868a){_0x45aa3b[_0xdb00('0x1d')]=_0x2b868a;if(_0x363a0b[_0xdb00('0x32')][_0xdb00('0x41')]){_0x4ad23b[_0xdb00('0x42')]=[{'all':!![]}];}return db[_0xdb00('0x2d')][_0xdb00('0x43')](_0x4ad23b);})[_0xdb00('0x26')](function(_0x2d8246){_0x45aa3b[_0xdb00('0x44')]=_0x2d8246;return _0x45aa3b;})[_0xdb00('0x26')](respondWithFilteredResult(_0xae2037,_0x4ad23b))[_0xdb00('0x45')](handleError(_0xae2037,null));};exports[_0xdb00('0x46')]=function(_0x51e6d2,_0x507a15){var _0x36c01f={'raw':![],'where':{'id':_0x51e6d2[_0xdb00('0x47')]['id']}},_0x3ad17d={};_0x3ad17d[_0xdb00('0x31')]=_['keys'](db['UserProfile']['rawAttributes']);_0x3ad17d[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x51e6d2['query']);_0x3ad17d[_0xdb00('0x34')]=_[_0xdb00('0x35')](_0x3ad17d[_0xdb00('0x31')],_0x3ad17d[_0xdb00('0x32')]);_0x36c01f[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x3ad17d[_0xdb00('0x31')],qs[_0xdb00('0x37')](_0x51e6d2['query'][_0xdb00('0x37')]));_0x36c01f[_0xdb00('0x36')]=_0x36c01f[_0xdb00('0x36')][_0xdb00('0x38')]?_0x36c01f[_0xdb00('0x36')]:_0x3ad17d[_0xdb00('0x31')];if(_0x51e6d2[_0xdb00('0x32')][_0xdb00('0x41')]){_0x36c01f['include']=[{'all':!![]}];}_0x36c01f=_['merge']({},_0x36c01f,_0x51e6d2['options']);return db['UserProfile'][_0xdb00('0x48')](_0x36c01f)['then'](handleEntityNotFound(_0x507a15,null))[_0xdb00('0x26')](respondWithResult(_0x507a15,null))['catch'](handleError(_0x507a15,null));};exports[_0xdb00('0x49')]=function(_0x250f11,_0x4643b3){return db[_0xdb00('0x2d')][_0xdb00('0x49')](_0x250f11[_0xdb00('0x4a')],{})[_0xdb00('0x26')](respondWithResult(_0x4643b3,0xc9))[_0xdb00('0x45')](handleError(_0x4643b3,null));};exports['clone']=function(_0x1daff8,_0x13e668){var _0x37c9a1={'where':{'id':_0x1daff8[_0xdb00('0x47')]['id']}},_0x5cdb7f={};_0x5cdb7f[_0xdb00('0x31')]=_[_0xdb00('0x33')](db['UserProfile'][_0xdb00('0x2e')]);_0x37c9a1['attributes']=_[_0xdb00('0x35')](_0x5cdb7f[_0xdb00('0x31')],qs[_0xdb00('0x37')](_0x1daff8[_0xdb00('0x32')][_0xdb00('0x37')]));_0x37c9a1[_0xdb00('0x36')]=_0x37c9a1[_0xdb00('0x36')][_0xdb00('0x38')]?_0x37c9a1[_0xdb00('0x36')]:_0x5cdb7f[_0xdb00('0x31')];if(_0x1daff8[_0xdb00('0x32')][_0xdb00('0x41')]){_0x37c9a1['include']=[{'all':!![]}];}_0x37c9a1=_['merge']({},_0x37c9a1,_0x1daff8[_0xdb00('0x40')]);return db['UserProfile'][_0xdb00('0x48')](_0x37c9a1)[_0xdb00('0x26')](handleEntityNotFound(_0x13e668,null))[_0xdb00('0x26')](function(_0x4626fd){if(_0x4626fd){var _0x327fb5=_0x4626fd['get']({'plain':!![]});_0x327fb5=qs[_0xdb00('0x4b')](_0x327fb5,['id','createdAt','updatedAt',_0xdb00('0x4c')]);_0x1daff8[_0xdb00('0x4a')]=_[_0xdb00('0x4b')](_0x1daff8[_0xdb00('0x4a')],['id',_0xdb00('0x4d'),_0xdb00('0x4e')]);return db[_0xdb00('0x4f')][_0xdb00('0x50')](function(_0x3d7f24){return db[_0xdb00('0x2d')][_0xdb00('0x49')](_[_0xdb00('0x3e')](_0x327fb5,_0x1daff8['body']),{'include':_0x1daff8[_0xdb00('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3d7f24})[_0xdb00('0x26')](function(_0x228da1){var _0x591646=_0x228da1[_0xdb00('0x51')]({'plain':!![]});return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x1daff8['params']['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x175f69){if(_0x175f69){return BPromise[_0xdb00('0x53')](_0x175f69,function(_0x563a06){return new BPromise(function(_0x56dd74,_0x1165a3){if(_0x563a06[_0xdb00('0x54')]===null||_0x563a06[_0xdb00('0x54')]===0x1)_0x56dd74(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x563a06['id']},'raw':!![]})['then'](function(_0x34a58e){var _0x42ecf9=_['map'](_0x34a58e,function(_0x4b22d4){return qs[_0xdb00('0x4b')](_0x4b22d4,['id','createdAt',_0xdb00('0x4e'),'sectionId']);});_0x56dd74(_0x42ecf9);})[_0xdb00('0x45')](function(_0x1e2b59){_0x1165a3(_0x1e2b59);});})[_0xdb00('0x26')](function(_0x35c3b4){var _0x53737e=qs[_0xdb00('0x4b')](_0x563a06,['id',_0xdb00('0x4d'),_0xdb00('0x4e')]);_0x53737e[_0xdb00('0x55')]=_0x591646['id'];if(_0x35c3b4)_0x53737e[_0xdb00('0x56')]=_0x35c3b4;return _0x53737e;})[_0xdb00('0x26')](function(_0x49866c){return db[_0xdb00('0x52')][_0xdb00('0x49')](_0x49866c,{'include':[{'model':db[_0xdb00('0x57')],'as':_0xdb00('0x56')}],'raw':!![],'transaction':_0x3d7f24});});})[_0xdb00('0x26')](function(){return _0x591646;});}});});});}})[_0xdb00('0x26')](respondWithResult(_0x13e668,0xc9))[_0xdb00('0x45')](handleError(_0x13e668,null));};exports[_0xdb00('0x24')]=function(_0x57bca5,_0x45954b){if(_0x57bca5[_0xdb00('0x4a')]['id']){delete _0x57bca5['body']['id'];}return db[_0xdb00('0x2d')][_0xdb00('0x48')]({'where':{'id':_0x57bca5[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x45954b,null))['then'](saveUpdates(_0x57bca5[_0xdb00('0x4a')],null))[_0xdb00('0x26')](respondWithResult(_0x45954b,null))[_0xdb00('0x45')](handleError(_0x45954b,null));};exports[_0xdb00('0x25')]=function(_0x279ab3,_0x2b7db4){return db['UserProfile'][_0xdb00('0x48')]({'where':{'id':_0x279ab3[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x2b7db4,null))[_0xdb00('0x26')](removeEntity(_0x2b7db4,null))['catch'](handleError(_0x2b7db4,null));};exports[_0xdb00('0x58')]=function(_0x4cc00a,_0x489875){return db['UserProfile'][_0xdb00('0x58')]()['then'](respondWithResult(_0x489875,null))[_0xdb00('0x45')](handleError(_0x489875,null));};exports['addSections']=function(_0x3add0e,_0x3e69d0){var _0x5c3387=_0x3add0e['body'];return db[_0xdb00('0x2d')]['find']({'where':{'id':_0x3add0e[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x3e69d0,null))['then'](function(_0x172a9b){if(_0x172a9b){return db[_0xdb00('0x4f')][_0xdb00('0x50')](function(_0x298aff){return db[_0xdb00('0x52')]['destroy']({'where':{'userProfileId':_0x3add0e[_0xdb00('0x47')]['id'],'sectionId':_[_0xdb00('0x2c')](_0x5c3387,function(_0x2367c6){return _0x2367c6[_0xdb00('0x59')];})},'transaction':_0x298aff})['then'](function(){var _0x20c1fb=_[_0xdb00('0x2c')](_0x5c3387,function(_0x37e193){_0x37e193[_0xdb00('0x55')]=_0x3add0e[_0xdb00('0x47')]['id'];return _0x37e193;});var _0x450eb8=[];return BPromise[_0xdb00('0x53')](_0x20c1fb,function(_0x5d4fc9){return db[_0xdb00('0x52')][_0xdb00('0x49')](_0x5d4fc9,{'include':[{'model':db[_0xdb00('0x57')],'as':_0xdb00('0x56')}],'raw':!![],'transaction':_0x298aff})[_0xdb00('0x26')](function(_0x84df6){_0x450eb8[_0xdb00('0x5a')](_0x84df6['get']({'plain':!![]}));});})[_0xdb00('0x26')](function(){return _0x450eb8;});});});}})[_0xdb00('0x26')](function(_0x497046){return _0x497046;})['then'](respondWithResult(_0x3e69d0,null))[_0xdb00('0x45')](handleError(_0x3e69d0,null));};exports[_0xdb00('0x5b')]=function(_0x4683b5,_0x5ca634){var _0x177c52;return db[_0xdb00('0x2d')][_0xdb00('0x48')]({'where':{'id':_0x4683b5[_0xdb00('0x47')]['id']},'attributes':['id',_0xdb00('0x2a')]})[_0xdb00('0x26')](handleEntityNotFound(_0x5ca634,null))[_0xdb00('0x26')](function(_0x40bbba){if(_0x40bbba){_0x177c52=_0x40bbba;return db['UserProfileSection'][_0xdb00('0x25')]({'where':{'userProfileId':_0x4683b5[_0xdb00('0x47')]['id'],'sectionId':_0x4683b5[_0xdb00('0x32')]['ids']}});}})[_0xdb00('0x26')](function(){return _0x177c52;})['then'](respondWithStatusCode(_0x5ca634,null))[_0xdb00('0x45')](handleError(_0x5ca634,null));};exports[_0xdb00('0x5c')]=function(_0x4d0604,_0x243a1d){var _0x4b8b88=[];var _0xd1a7eb=[];return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x4d0604[_0xdb00('0x47')]['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x1dd0ae){_0x4b8b88=_[_0xdb00('0x3d')](_0x1dd0ae,function(_0x4cc149){return _0x4cc149[_0xdb00('0x5d')]===0x1||_[_0xdb00('0x5e')]([0x3eb,0x709],_0x4cc149[_0xdb00('0x59')]);});if(!_[_0xdb00('0x5f')](_0x4b8b88)){return _[_0xdb00('0x2c')](_0x4b8b88,function(_0x27c40c){return _0x27c40c['sectionId'];});}else{return;}})[_0xdb00('0x26')](function(_0x3bce41){if(_0x3bce41)_0xd1a7eb=_0x3bce41;if(_[_0xdb00('0x5e')](_0xd1a7eb,0x64)){var _0x521255=_[_0xdb00('0x48')](_0x4b8b88,{'sectionId':0x64});return hasDefaultDashboard(_0x521255)['then'](function(_0x993f04){return _['map'](_0x4b8b88,function(_0x5305e9){if(_0x5305e9[_0xdb00('0x59')]===0x64){_0x5305e9[_0xdb00('0x60')]=_0x993f04;}return _0x5305e9;});});}else{return;}})['then'](function(_0x46e0e5){if(_0x46e0e5)_0x4b8b88=_0x46e0e5;if(_['includes'](_0xd1a7eb,0x3eb)){var _0x97a294=_[_0xdb00('0x48')](_0x4b8b88,{'sectionId':0x3eb});return getCustomDashboards(_0x97a294)['then'](function(_0xbf9c5e){return _[_0xdb00('0x2c')](_0x4b8b88,function(_0x2da3ba){if(_0x97a294[_0xdb00('0x5d')]){if(_0x2da3ba[_0xdb00('0x59')]===0x3eb){_0x2da3ba[_0xdb00('0x60')]=_0xbf9c5e;}}else{if(_0x2da3ba[_0xdb00('0x59')]===0x64){_0x2da3ba[_0xdb00('0x60')]=_0xbf9c5e;}}return _0x2da3ba;});});}else{return;}})[_0xdb00('0x26')](function(_0x5ab2f6){if(_0x5ab2f6)_0x4b8b88=_0x5ab2f6;if(_[_0xdb00('0x5e')](_0xd1a7eb,0x709)){var _0x143c8a=_['find'](_0x4b8b88,{'sectionId':0x709});return getPlugins(_0x143c8a)[_0xdb00('0x26')](function(_0x5a6222){if(_0x143c8a['enabled']){return _['map'](_0x4b8b88,function(_0x5ccd3e){if(_0x5ccd3e[_0xdb00('0x59')]===0x709){_0x5ccd3e[_0xdb00('0x60')]=_0x5a6222;}return _0x5ccd3e;});}else{var _0x58e29a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a6222};var _0x5100cf=_['map'](_0x4b8b88);_0x5100cf[_0xdb00('0x5a')](_0x58e29a);return _0x5100cf;}});}else{return;}})['then'](function(_0x40aeb7){if(_0x40aeb7)_0x4b8b88=_0x40aeb7;return _['filter'](_0x4b8b88,[_0xdb00('0x5d'),0x1]);})[_0xdb00('0x26')](respondWithResult(_0x243a1d,null))['catch'](handleError(_0x243a1d,null));};function hasDefaultDashboard(_0x4a7dc4){var _0x2d80e1=[0x65];return new BPromise(function(_0x115529,_0xf2cde6){try{if(_0x4a7dc4[_0xdb00('0x54')]){_0x115529(_0x2d80e1);}else{return db[_0xdb00('0x57')][_0xdb00('0x61')]({'where':{'sectionId':_0x4a7dc4['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x46b88d){_0x46b88d?_0x115529(_0x2d80e1):_0x115529();});}}catch(_0x5c298f){_0xf2cde6(_0x5c298f);}});}function getCustomDashboards(_0x3f626c){var _0x33ddb4=[];return new BPromise(function(_0x36113f,_0x2c7713){try{if(_0x3f626c[_0xdb00('0x54')]){return db['Dashboard'][_0xdb00('0x43')]({'raw':!![]})[_0xdb00('0x26')](function(_0x4d6141){_0x4d6141[_0xdb00('0x62')](function(_0x4f5e96){_0x33ddb4[_0xdb00('0x5a')](_0x4f5e96['id']+0x1869f);});_0x36113f(_0x33ddb4);});}else{return db[_0xdb00('0x57')][_0xdb00('0x43')]({'where':{'sectionId':_0x3f626c['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x2c99e5){_0x2c99e5['forEach'](function(_0x1754fb){_0x33ddb4[_0xdb00('0x5a')](_0x1754fb[_0xdb00('0x63')]+0x1869f);});_0x36113f(_0x33ddb4);});}}catch(_0x12056e){_0x2c7713(_0x12056e);}});}function getPlugins(_0x2cfe51){var _0x36314a=[];return new BPromise(function(_0x5e297b,_0x272b7f){try{if(_0x2cfe51['autoAssociation']){return db[_0xdb00('0x64')]['findAll']({'raw':!![]})[_0xdb00('0x26')](function(_0x5e5e99){_0x5e5e99[_0xdb00('0x62')](function(_0xbd384b){_0x36314a[_0xdb00('0x5a')](_0xbd384b['id']+0x15b38);});_0x5e297b(_0x36314a);});}else{return db[_0xdb00('0x57')][_0xdb00('0x43')]({'where':{'sectionId':_0x2cfe51['id']},'raw':!![]})['then'](function(_0x5f0948){_0x5f0948['forEach'](function(_0x2c67c3){_0x36314a[_0xdb00('0x5a')](_0x2c67c3[_0xdb00('0x63')]+0x15b38);});_0x5e297b(_0x36314a);});}}catch(_0x583016){_0x272b7f(_0x583016);}});}exports[_0xdb00('0x65')]=function(_0x4ab305,_0x4c3be1){return db[_0xdb00('0x2d')]['find']({'where':{'id':_0x4ab305[_0xdb00('0x47')]['id']}})[_0xdb00('0x26')](handleEntityNotFound(_0x4c3be1,null))[_0xdb00('0x26')](function(_0x360b0d){if(_0x360b0d){return db['sequelize'][_0xdb00('0x50')](function(_0x274270){return db[_0xdb00('0x52')][_0xdb00('0x43')]({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xdb00('0x26')](function(_0x3f8f95){if(_0x3f8f95){return db[_0xdb00('0x52')][_0xdb00('0x25')]({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id'],'id':_[_0xdb00('0x2c')](_0x3f8f95,function(_0x518082){return _0x518082['id'];})},'transaction':_0x274270});}})[_0xdb00('0x26')](function(_0x57391e){var _0x40465d=_[_0xdb00('0x2c')](_0x4ab305[_0xdb00('0x4a')],function(_0x4d7a14){_0x4d7a14[_0xdb00('0x55')]=_0x4ab305[_0xdb00('0x47')]['id'];return _0x4d7a14;});return db['UserProfileSection'][_0xdb00('0x66')](_0x40465d,{'raw':!![],'transaction':_0x274270});})[_0xdb00('0x26')](function(_0x595f7b){var _0x45a10d=_[_0xdb00('0x3d')](_[_0xdb00('0x2c')](_0x595f7b,function(_0x1446b9){return _0x1446b9['get']({'plain':!![]});}),{'includeAll':![]});if(_0x45a10d){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4ab305[_0xdb00('0x47')]['id'],'sectionId':_[_0xdb00('0x2c')](_0x45a10d,function(_0x471681){return _0x471681['sectionId'];})},'attributes':['id',_0xdb00('0x59')],'raw':!![]})[_0xdb00('0x26')](function(_0x235080){var _0x29b920=_[_0xdb00('0x2c')](_0x4ab305[_0xdb00('0x4a')],function(_0x5b11ed){_0x5b11ed[_0xdb00('0x55')]=_0x4ab305['params']['id'];return _0x5b11ed;});return db[_0xdb00('0x57')][_0xdb00('0x66')](_0x29b920,{'raw':!![],'transaction':_0x274270});});}})['catch'](handleError(_0x4c3be1,null));});}})[_0xdb00('0x26')](function(_0x3ca7b1){var _0x2fd8ed=_[_0xdb00('0x2c')](_0x3ca7b1,function(_0xbdddda){return _0xbdddda['get']({'plain':!![]});});})[_0xdb00('0x26')](respondWithResult(_0x4c3be1,null))['catch'](handleError(_0x4c3be1,null));};exports[_0xdb00('0x67')]=function(_0x5a7fcb,_0x1420c5,_0x4a2d71){return db['UserProfile'][_0xdb00('0x48')]({'where':{'id':_0x5a7fcb[_0xdb00('0x47')]['id']}})['then'](handleEntityNotFound(_0x1420c5,null))['then'](function(_0x4b04c5){if(_0x4b04c5){return _0x4b04c5[_0xdb00('0x67')](_0x5a7fcb[_0xdb00('0x32')][_0xdb00('0x68')]);}})['then'](respondWithStatusCode(_0x1420c5,null))[_0xdb00('0x45')](handleError(_0x1420c5,null));};exports[_0xdb00('0x69')]=function(_0x22ddcd,_0x4e99e1){var _0x51f346={'raw':![],'where':{}};var _0x197510={};var _0x5a1b09={'count':0x0,'rows':[]};var _0x3ecc6f=_0x22ddcd['query'][_0xdb00('0x6a')];if(typeof _0x3ecc6f===_0xdb00('0x6b')){throw new db[(_0xdb00('0x6c'))][(_0xdb00('0x6d'))](_0xdb00('0x6e'));}var _0x147b0b=_0x22ddcd['query'][_0xdb00('0x6f')]||![];var _0x5180ca=getQueryModels(_0x3ecc6f,_0x147b0b);if(typeof _0x5180ca[_0xdb00('0x70')]===_0xdb00('0x6b')){throw new db[(_0xdb00('0x6c'))][(_0xdb00('0x6d'))](_0xdb00('0x71')+_0x3ecc6f+'\x27');}var _0x363b2e=[];if(!_[_0xdb00('0x5f')](_0x5180ca[_0xdb00('0x72')])){_0x363b2e=_0x5180ca[_0xdb00('0x72')];}else{_0x363b2e=[{'name':_0x3ecc6f}];}return db['UserProfile'][_0xdb00('0x61')]({'where':{'id':_0x22ddcd[_0xdb00('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e99e1,null))[_0xdb00('0x26')](function(_0x1ddbd2){if(_0x1ddbd2){var _0x25d2a4=[];for(var _0x5317d4=0x0;_0x5317d4<_0x363b2e[_0xdb00('0x38')];_0x5317d4++){_0x25d2a4['push'](db[_0xdb00('0x52')][_0xdb00('0x61')]({'where':{'userProfileId':_0x1ddbd2['id'],'name':_0x363b2e[_0x5317d4][_0xdb00('0x2a')]},'raw':!![]}));}return BPromise[_0xdb00('0x73')](_0x25d2a4);}})[_0xdb00('0x26')](function(_0x38cce4){var _0x414770=_['filter'](_0x38cce4,function(_0x3ac74e){return _0x3ac74e?_0x3ac74e:undefined;});var _0x53775b=_[_0xdb00('0x3d')](_0x363b2e,[_0xdb00('0x74'),!![]]);var _0x483416=_['isEmpty'](_0x414770)&&_['isEmpty'](_0x53775b)?null:_[_0xdb00('0x75')](_0x53775b,_0x414770);if(_0x483416){var _0xbcca22=[];for(var _0x4ce57e=0x0;_0x4ce57e<_0x483416['length'];_0x4ce57e++){var _0x5dcf85=_[_0xdb00('0x48')](_0x363b2e,function(_0x2a1ed8){return _0x483416[_0x4ce57e]?_0x2a1ed8[_0xdb00('0x2a')]===_0x483416[_0x4ce57e][_0xdb00('0x2a')]:null;});if(_0x5dcf85){if(_0x483416[_0x4ce57e][_0xdb00('0x74')]){_0xbcca22[_0xdb00('0x5a')](getAllResources(_0x5180ca[_0xdb00('0x70')],_0x483416[_0x4ce57e]));}else{if(!_0x483416[_0x4ce57e]['autoAssociation']){_0xbcca22[_0xdb00('0x5a')](getAllowedResources(_0x5dcf85,_0x483416[_0x4ce57e],_0x5180ca['childModel']));}else{if(_0x5dcf85[_0xdb00('0x31')]){_0xbcca22[_0xdb00('0x5a')](getAllFilteredResources(_0x5dcf85,_0x483416[_0x4ce57e]));}}}}}return BPromise[_0xdb00('0x73')](_0xbcca22);}else{return null;}})[_0xdb00('0x26')](function(_0x5cbd75){var _0x4644fe=_0x5cbd75;var _0x40558b=null;if(_0x4644fe){_0x40558b=_0x4644fe['length']===0x1?_0x4644fe[0x0]:null;}if(_0x40558b||_0x4644fe){var _0x54d5d4=db[_0x5180ca['childModel']][_0xdb00('0x2e')];_0x197510[_0xdb00('0x31')]=_[_0xdb00('0x33')](_0x54d5d4);_0x197510[_0xdb00('0x32')]=_[_0xdb00('0x33')](_0x22ddcd[_0xdb00('0x32')]);_0x197510['filters']=_[_0xdb00('0x35')](_0x197510[_0xdb00('0x31')],_0x197510['query']);_0x51f346[_0xdb00('0x36')]=_[_0xdb00('0x35')](_0x197510[_0xdb00('0x31')],qs['fields'](_0x22ddcd['query'][_0xdb00('0x37')]));_0x51f346['attributes']=_0x51f346['attributes'][_0xdb00('0x38')]?_0x51f346['attributes']:_0x197510[_0xdb00('0x31')];if(!_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x39')](_0xdb00('0x3a'))){_0x51f346[_0xdb00('0x1f')]=qs[_0xdb00('0x1f')](_0x22ddcd[_0xdb00('0x32')]['limit']);_0x51f346[_0xdb00('0x1e')]=qs['offset'](_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x1e')]);}_0x51f346['order']=qs['sort'](_0x22ddcd['query'][_0xdb00('0x3b')]);_0x51f346[_0xdb00('0x3c')]=qs[_0xdb00('0x34')](_[_0xdb00('0x76')](_0x22ddcd[_0xdb00('0x32')],_0x197510[_0xdb00('0x34')]));if(_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x3d')]){_0x51f346[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x51f346[_0xdb00('0x3c')],{'$or':_[_0xdb00('0x2c')](_0x54d5d4,function(_0x498e56){if(_0x498e56[_0xdb00('0x30')][_0xdb00('0x77')]!==_0xdb00('0x3f')){var _0x1e45db={};_0x1e45db[_0x498e56[_0xdb00('0x78')]]={'$like':'%'+_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x3d')]+'%'};return _0x1e45db;}})});}var _0x2c409b=[];if(_0x40558b){var _0x188301=_[_0xdb00('0x48')](_0x363b2e,['name',_0x40558b[_0xdb00('0x2a')]]);if(_0x188301['field']){var _0x26abe5={};if(_0x5180ca[_0xdb00('0x70')]===_0xdb00('0x79')){_0x26abe5[_0x188301[_0xdb00('0x7a')]]=_[_0xdb00('0x2c')](_0x40558b[_0xdb00('0x7b')],'id');}else{_0x26abe5[_0x188301[_0xdb00('0x7a')]]=_0x40558b[_0xdb00('0x7b')];}_0x2c409b[_0xdb00('0x5a')](_0x26abe5);}else{_0x51f346['where']['id']=_0x40558b[_0xdb00('0x7b')];}}else{for(var _0x47a44e=0x0;_0x47a44e<_0x4644fe[_0xdb00('0x38')];_0x47a44e++){var _0x188301=_[_0xdb00('0x48')](_0x363b2e,[_0xdb00('0x2a'),_0x4644fe[_0x47a44e][_0xdb00('0x2a')]]);if(_0x188301[_0xdb00('0x78')]){var _0x26abe5={};_0x26abe5[_0x188301['foreignKey']]=_0x4644fe[_0x47a44e][_0xdb00('0x7b')];_0x2c409b[_0xdb00('0x5a')](_0x26abe5);}else{if(!_0x51f346[_0xdb00('0x3c')]['id'])_0x51f346['where']['id']=[];_0x4644fe[_0x47a44e][_0xdb00('0x7b')][_0xdb00('0x62')](function(_0x514c7a){_0x51f346[_0xdb00('0x3c')]['id']['push'](_0x514c7a);});}}}if(!_['isEmpty'](_0x2c409b)){_0x51f346[_0xdb00('0x3c')]=_[_0xdb00('0x3e')](_0x51f346['where'],{'$and':{'$or':_0x2c409b}});}_0x51f346=_[_0xdb00('0x3e')]({},_0x51f346,_0x22ddcd[_0xdb00('0x40')]);if(_0x40558b&&!_0x40558b['autoAssociation']&&_0x5180ca[_0xdb00('0x70')]===_0xdb00('0x79')){if(_0x22ddcd['query'][_0xdb00('0x41')]){_0x51f346[_0xdb00('0x42')]=[{'all':!![]}];}return db[_0x5180ca[_0xdb00('0x70')]]['findAll'](_0x51f346)[_0xdb00('0x26')](function(_0xed8204){var _0x3e2cc3=[];_0xed8204[_0xdb00('0x62')](function(_0x76c633){var _0x20cd29;switch(_0x76c633['reportType']){case _0xdb00('0x7c'):_0x20cd29=_['find'](_0x40558b[_0xdb00('0x7b')],function(_0x7be856){return _0x7be856['id']===_0x76c633['reportId']&&_0x7be856[_0xdb00('0x30')]===_0xdb00('0x7d');});break;case _0xdb00('0x7e'):_0x20cd29=_[_0xdb00('0x48')](_0x40558b[_0xdb00('0x7b')],function(_0x49eadf){return _0x49eadf['id']===_0x76c633[_0xdb00('0x7f')]&&_0x49eadf['type']===_0xdb00('0x80');});break;}if(_0x20cd29)_0x3e2cc3[_0xdb00('0x5a')](_0x76c633);});_0x5a1b09[_0xdb00('0x1d')]=_0x3e2cc3['length'];_0x5a1b09[_0xdb00('0x44')]=_0x3e2cc3;return _0x5a1b09;});}else{return db[_0x5180ca['childModel']][_0xdb00('0x1d')]({'where':_0x51f346[_0xdb00('0x3c')]})[_0xdb00('0x26')](function(_0x151b93){_0x5a1b09[_0xdb00('0x1d')]=_0x151b93;if(_0x22ddcd['query']['includeAll']){if(_0x5180ca['childModel']==='CmContact'){_0x51f346[_0xdb00('0x42')]=[{'model':db[_0xdb00('0x81')],'as':_0xdb00('0x82'),'attributes':['id',_0xdb00('0x2a'),_0xdb00('0x83')],'required':_0x22ddcd[_0xdb00('0x32')][_0xdb00('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0xdb00('0x85'),'attributes':['id',_0xdb00('0x2a'),_0xdb00('0x83')],'through':_0x22ddcd[_0xdb00('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x22ddcd['query'][_0xdb00('0x84')]||undefined}}:{},'required':_0x22ddcd[_0xdb00('0x32')]['tag']?!![]:![]}];}else{_0x51f346[_0xdb00('0x42')]=[{'all':!![]}];}}return db[_0x5180ca[_0xdb00('0x70')]][_0xdb00('0x43')](_0x51f346);})[_0xdb00('0x26')](function(_0x3b0426){_0x5a1b09[_0xdb00('0x44')]=_0x3b0426;return _0x5a1b09;});}}else{return _0x5a1b09;}})[_0xdb00('0x26')](respondWithFilteredResult(_0x4e99e1,_0x51f346))[_0xdb00('0x45')](handleError(_0x4e99e1,null));};function getAllResources(_0x186a3a,_0x585662){return new BPromise(function(_0x20efc1,_0x4e99b8){if(_0x585662){var _0x18190c=_0x585662[_0xdb00('0x3d')]?{[_0x585662['filter']['field']]:_0x585662[_0xdb00('0x3d')][_0xdb00('0x86')]}:undefined;return db[_0x186a3a][_0xdb00('0x43')]({'where':_0x18190c,'raw':!![]})[_0xdb00('0x26')](function(_0x39fc86){_0x585662['associatedResources']=_[_0xdb00('0x2c')](_0x39fc86,'id');_0x20efc1(_0x585662);})[_0xdb00('0x45')](function(_0x581a5d){_0x4e99b8(_0x581a5d);});}else{_0x20efc1(null);}});}function getAllFilteredResources(_0x55fa22,_0x4873ba){return new BPromise(function(_0x3aa001,_0x1ac53a){var _0x3504be=_0x55fa22[_0xdb00('0x3d')]?{[_0x55fa22[_0xdb00('0x3d')]['field']]:_0x55fa22[_0xdb00('0x3d')]['value']}:undefined;return db[_0x55fa22[_0xdb00('0x31')]][_0xdb00('0x43')]({'where':_0x3504be,'raw':!![]})[_0xdb00('0x26')](function(_0x48f9c6){_0x4873ba[_0xdb00('0x7b')]=_['map'](_0x48f9c6,function(_0x4b26b2){return _0x4b26b2[_0xdb00('0x2a')];});_0x3aa001(_0x4873ba);})[_0xdb00('0x45')](function(_0x68183f){_0x1ac53a(_0x68183f);});});}function getAllowedResources(_0x376c91,_0x367abd,_0x4793e0){return new BPromise(function(_0x4cf459,_0x58ec9c){if(_0x367abd){return db[_0xdb00('0x57')]['findAll']({'where':{'sectionId':_0x367abd['id']},'raw':!![]})[_0xdb00('0x26')](function(_0x1509b5){if(_0x376c91['field']&&_0x376c91[_0xdb00('0x78')]!=='id'){_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x53dd8c){return _0x53dd8c[_0x376c91['field']];});}else{if(_0x4793e0===_0xdb00('0x79')){_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x3e1579){return{'id':_0x3e1579[_0xdb00('0x63')],'type':_0x3e1579[_0xdb00('0x30')]};});}else{_0x367abd[_0xdb00('0x7b')]=_[_0xdb00('0x2c')](_0x1509b5,function(_0x4f41de){return _0x4f41de[_0xdb00('0x63')];});}}_0x4cf459(_0x367abd);})[_0xdb00('0x45')](function(_0x4805fa){_0x58ec9c(_0x4805fa);});}else{_0x4cf459(null);}});}function getQueryModels(_0x5c68f5,_0x15bc6c){var _0x3dd05c=_0x5c68f5[_0xdb00('0x87')]();var _0x2889ed={'childModel':undefined,'parentSections':[]};switch(_0x3dd05c){case _0xdb00('0x88'):_0x2889ed[_0xdb00('0x70')]='SquareProject';break;case _0xdb00('0x89'):_0x2889ed[_0xdb00('0x70')]='SquareOdbc';break;case _0xdb00('0x8a'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x8b');_0x2889ed[_0xdb00('0x72')]=[{'name':'SquareProjects','field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0x8c')}];break;case'projects':_0x2889ed[_0xdb00('0x70')]='JscriptyProject';break;case _0xdb00('0x8d'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x8e');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0x8f'),'field':'id','foreignKey':_0xdb00('0x90')}];break;case _0xdb00('0x91'):_0x2889ed['childModel']='CmList';break;case _0xdb00('0x92'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x93');break;case _0xdb00('0x94'):_0x2889ed['childModel']=_0xdb00('0x95');break;case'chatqueues':_0x2889ed[_0xdb00('0x70')]='ChatQueue';break;case _0xdb00('0x96'):_0x2889ed[_0xdb00('0x70')]='ChatWebsite';break;case _0xdb00('0x97'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x98');break;case'faxaccounts':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x99');break;case'inboundroutes':case _0xdb00('0x9a'):case'outboundroutes':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9b');break;case _0xdb00('0x9c'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9d');break;case _0xdb00('0x9e'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x9f');break;case _0xdb00('0xa0'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xa1');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xa2'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xa3'),'model':_0xdb00('0xa4'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xa6')]}},{'name':_0xdb00('0xa7'),'field':_0xdb00('0x2a'),'foreignKey':'membername','model':_0xdb00('0xa4'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xa8')]}},{'name':_0xdb00('0xa9'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xaa'),'model':'VoiceQueue','filter':{'field':_0xdb00('0x30'),'value':[_0xdb00('0xab')]}},{'name':_0xdb00('0xac'),'field':_0xdb00('0x2a'),'foreignKey':_0xdb00('0xaa'),'model':_0xdb00('0xad'),'filter':{'field':_0xdb00('0x30'),'value':[_0xdb00('0xae')]}}];break;case'musiconholds':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xaf');break;case _0xdb00('0xb0'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb1');break;case _0xdb00('0xb2'):_0x2889ed[_0xdb00('0x70')]='VoicePrefix';break;case _0xdb00('0xb3'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb4');break;case'mailqueues':_0x2889ed['childModel']=_0xdb00('0xb5');break;case _0xdb00('0xb6'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb7');break;case'mailsubstatuses':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xb8');break;case'openchannelqueues':_0x2889ed['childModel']=_0xdb00('0xb9');break;case _0xdb00('0xba'):_0x2889ed['childModel']='OpenchannelAccount';break;case _0xdb00('0xbb'):_0x2889ed['childModel']=_0xdb00('0xbc');break;case _0xdb00('0xbd'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xbe');break;case _0xdb00('0xbf'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xc0');break;case _0xdb00('0xc1'):_0x2889ed[_0xdb00('0x70')]='WhatsappAccount';break;case _0xdb00('0xc2'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xc3');break;case _0xdb00('0xc4'):case _0xdb00('0xc5'):_0x2889ed['childModel']=_0xdb00('0xad');if(_0x15bc6c){_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xa9')},{'name':_0xdb00('0xac')}];}break;case _0xdb00('0xc6'):case _0xdb00('0xc7'):case _0xdb00('0xc8'):_0x2889ed['childModel']='User';if(_0x15bc6c){_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xc9'),'filter':{'field':_0xdb00('0xa5'),'value':[_0xdb00('0xca'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xdb00('0xcb'):_0x2889ed['childModel']=_0xdb00('0xcc');break;case _0xdb00('0xcd'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xce');break;case _0xdb00('0xcf'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd0');break;case _0xdb00('0xd1'):_0x2889ed['childModel']=_0xdb00('0xd2');break;case'deskaccounts':_0x2889ed['childModel']=_0xdb00('0xd3');break;case'zohoaccounts':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd4');break;case'vtigeraccounts':_0x2889ed['childModel']=_0xdb00('0xa4');break;case'cannedanswers':_0x2889ed['childModel']=_0xdb00('0xd5');break;case _0xdb00('0xd6'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd7');break;case'customdashboards':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xd8');break;case _0xdb00('0xd9'):_0x2889ed['childModel']=_0xdb00('0xda');break;case _0xdb00('0xdb'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdc');break;case'scheduler':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdd');break;case _0xdb00('0xde'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xdf');break;case'tags':_0x2889ed[_0xdb00('0x70')]=_0xdb00('0x81');break;case _0xdb00('0xe0'):_0x2889ed['childModel']=_0xdb00('0xe1');break;case'triggers':_0x2889ed[_0xdb00('0x70')]='Trigger';break;case _0xdb00('0xe2'):_0x2889ed[_0xdb00('0x70')]='Trunk';break;case _0xdb00('0xe3'):_0x2889ed['childModel']=_0xdb00('0xe4');break;case _0xdb00('0xe5'):_0x2889ed['childModel']=_0xdb00('0x64');break;case _0xdb00('0xe6'):_0x2889ed['childModel']=_0xdb00('0x79');_0x2889ed[_0xdb00('0x72')]=[{'name':_0xdb00('0xe7'),'field':'id','foreignKey':_0xdb00('0x7f')}];break;case _0xdb00('0xe8'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xe9');break;case _0xdb00('0xc1'):_0x2889ed[_0xdb00('0x70')]=_0xdb00('0xea');break;default:return _0x2889ed;}return _0x2889ed;} \ No newline at end of file +var _0xf82e=['userProfileId','Resources','describe','addSections','push','removeSections','getSections','enabled','includes','subsections','autoAssociation','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Unknown\x20section','mergeResources','childModel','Sequelize','ValidationError','Invalid\x20section\x20\x27','parentSections','all','isEmpty','union','hasOwnProperty','VIRTUAL','AnalyticExtractedReport','foreignKey','associatedResources','field','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','color','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','projectName','projects','JscriptyProject','Lists','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','customdashboards','pauses','Pause','Schedule','sounds','Sound','templates','Template','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','UserProfileResource','sectionId'];(function(_0x561a05,_0x5de84b){var _0xe12373=function(_0x1ea29c){while(--_0x1ea29c){_0x561a05['push'](_0x561a05['shift']());}};_0xe12373(++_0x5de84b);}(_0xf82e,0x172));var _0xef82=function(_0x10606e,_0x16846d){_0x10606e=_0x10606e-0x0;var _0x4a1108=_0xf82e[_0x10606e];return _0x4a1108;};'use strict';var pdf=require(_0xef82('0x0'));var emlformat=require(_0xef82('0x1'));var rimraf=require(_0xef82('0x2'));var zipdir=require(_0xef82('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef82('0x4'));var BPromise=require(_0xef82('0x5'));var Mustache=require(_0xef82('0x6'));var util=require(_0xef82('0x7'));var path=require(_0xef82('0x8'));var sox=require(_0xef82('0x9'));var csv=require(_0xef82('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xef82('0xb'));var crypto=require(_0xef82('0xc'));var jsforce=require(_0xef82('0xd'));var deskjs=require(_0xef82('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef82('0xf'));var authService=require(_0xef82('0x10'));var qs=require(_0xef82('0x11'));var as=require(_0xef82('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef82('0x13'))(_0xef82('0x14'));var utils=require(_0xef82('0x15'));var config=require(_0xef82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef82('0x17'))['db'];config[_0xef82('0x18')]=_[_0xef82('0x19')](config['redis'],{'host':_0xef82('0x1a'),'port':0x18eb});var socket=require(_0xef82('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0xef82('0x1c')](socket);function respondWithStatusCode(_0x1672d5,_0x3b0cfe){_0x3b0cfe=_0x3b0cfe||0xcc;return function(_0x59caeb){if(_0x59caeb){return _0x1672d5['sendStatus'](_0x3b0cfe);}return _0x1672d5[_0xef82('0x1d')](_0x3b0cfe)[_0xef82('0x1e')]();};}function respondWithResult(_0x69a4d6,_0x5e9523){_0x5e9523=_0x5e9523||0xc8;return function(_0x4b9257){if(_0x4b9257){return _0x69a4d6[_0xef82('0x1d')](_0x5e9523)[_0xef82('0x1f')](_0x4b9257);}};}function respondWithFilteredResult(_0x5e4307,_0x25a035){return function(_0x56d3ab){if(_0x56d3ab){var _0x2af186=_0x56d3ab[_0xef82('0x20')],_0x4345da=_0x25a035[_0xef82('0x21')],_0x1689ba=_0x25a035[_0xef82('0x21')]+_0x25a035['limit'],_0x53b33a;if(_0x1689ba>=_0x2af186){_0x1689ba=_0x2af186;_0x53b33a=0xc8;}else{_0x53b33a=0xce;}_0x5e4307[_0xef82('0x1d')](_0x53b33a);return _0x5e4307['set']('Content-Range',_0x4345da+'-'+_0x1689ba+'/'+_0x2af186)['json'](_0x56d3ab);}return null;};}function patchUpdates(_0x3ab850){return function(_0x2b79fd){try{jsonpatch['apply'](_0x2b79fd,_0x3ab850,!![]);}catch(_0x47b29a){return BPromise[_0xef82('0x22')](_0x47b29a);}return _0x2b79fd[_0xef82('0x23')]();};}function saveUpdates(_0x3682dd,_0x1a775c){return function(_0xb51868){if(_0xb51868){return _0xb51868[_0xef82('0x24')](_0x3682dd)['then'](function(_0x285e1){return _0x285e1;});}return null;};}function removeEntity(_0x330417,_0xc9b02c){return function(_0x1999fc){if(_0x1999fc){return _0x1999fc[_0xef82('0x25')]()[_0xef82('0x26')](function(){_0x330417[_0xef82('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ffe1,_0xd14b06){return function(_0x54674e){if(!_0x54674e){_0x24ffe1[_0xef82('0x27')](0x194);}return _0x54674e;};}function handleError(_0x55d897,_0x21a073){_0x21a073=_0x21a073||0x1f4;return function(_0x4dedad){logger[_0xef82('0x28')](_0x4dedad[_0xef82('0x29')]);if(_0x4dedad['name']){delete _0x4dedad[_0xef82('0x2a')];}_0x55d897['status'](_0x21a073)[_0xef82('0x2b')](_0x4dedad);};}exports[_0xef82('0x2c')]=function(_0x4d5619,_0x23c42a){var _0x3fdad0={},_0x18766f={},_0x584925={'count':0x0,'rows':[]};var _0x38a307=_[_0xef82('0x2d')](db[_0xef82('0x2e')][_0xef82('0x2f')],function(_0xc08abe){return{'name':_0xc08abe[_0xef82('0x30')],'type':_0xc08abe[_0xef82('0x31')][_0xef82('0x32')]};});_0x18766f[_0xef82('0x33')]=_[_0xef82('0x2d')](_0x38a307,_0xef82('0x2a'));_0x18766f[_0xef82('0x34')]=_[_0xef82('0x35')](_0x4d5619['query']);_0x18766f[_0xef82('0x36')]=_['intersection'](_0x18766f[_0xef82('0x33')],_0x18766f[_0xef82('0x34')]);_0x3fdad0[_0xef82('0x37')]=_[_0xef82('0x38')](_0x18766f[_0xef82('0x33')],qs[_0xef82('0x39')](_0x4d5619[_0xef82('0x34')]['fields']));_0x3fdad0[_0xef82('0x37')]=_0x3fdad0[_0xef82('0x37')]['length']?_0x3fdad0[_0xef82('0x37')]:_0x18766f[_0xef82('0x33')];if(!_0x4d5619['query']['hasOwnProperty'](_0xef82('0x3a'))){_0x3fdad0[_0xef82('0x3b')]=qs[_0xef82('0x3b')](_0x4d5619[_0xef82('0x34')]['limit']);_0x3fdad0['offset']=qs[_0xef82('0x21')](_0x4d5619[_0xef82('0x34')][_0xef82('0x21')]);}_0x3fdad0[_0xef82('0x3c')]=qs[_0xef82('0x3d')](_0x4d5619[_0xef82('0x34')][_0xef82('0x3d')]);_0x3fdad0['where']=qs[_0xef82('0x36')](_[_0xef82('0x3e')](_0x4d5619[_0xef82('0x34')],_0x18766f[_0xef82('0x36')]),_0x38a307);if(_0x4d5619[_0xef82('0x34')][_0xef82('0x3f')]){_0x3fdad0[_0xef82('0x40')]=_[_0xef82('0x41')](_0x3fdad0[_0xef82('0x40')],{'$or':_[_0xef82('0x2d')](_0x38a307,function(_0x426fb1){if(_0x426fb1[_0xef82('0x31')]!=='VIRTUAL'){var _0x405bdd={};_0x405bdd[_0x426fb1[_0xef82('0x2a')]]={'$like':'%'+_0x4d5619['query'][_0xef82('0x3f')]+'%'};return _0x405bdd;}})});}_0x3fdad0=_['merge']({},_0x3fdad0,_0x4d5619[_0xef82('0x42')]);var _0x1ef698={'where':_0x3fdad0[_0xef82('0x40')]};return db[_0xef82('0x2e')][_0xef82('0x20')](_0x1ef698)[_0xef82('0x26')](function(_0x1e5e40){_0x584925['count']=_0x1e5e40;if(_0x4d5619['query']['includeAll']){_0x3fdad0[_0xef82('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0xef82('0x44')](_0x3fdad0);})['then'](function(_0x4cb99a){_0x584925[_0xef82('0x45')]=_0x4cb99a;return _0x584925;})[_0xef82('0x26')](respondWithFilteredResult(_0x23c42a,_0x3fdad0))[_0xef82('0x46')](handleError(_0x23c42a,null));};exports[_0xef82('0x47')]=function(_0xb490f6,_0x10a135){var _0x143a67={'raw':![],'where':{'id':_0xb490f6[_0xef82('0x48')]['id']}},_0x69bace={};_0x69bace[_0xef82('0x33')]=_[_0xef82('0x35')](db[_0xef82('0x2e')][_0xef82('0x2f')]);_0x69bace['query']=_[_0xef82('0x35')](_0xb490f6['query']);_0x69bace[_0xef82('0x36')]=_[_0xef82('0x38')](_0x69bace[_0xef82('0x33')],_0x69bace[_0xef82('0x34')]);_0x143a67['attributes']=_[_0xef82('0x38')](_0x69bace[_0xef82('0x33')],qs['fields'](_0xb490f6[_0xef82('0x34')][_0xef82('0x39')]));_0x143a67[_0xef82('0x37')]=_0x143a67[_0xef82('0x37')][_0xef82('0x49')]?_0x143a67[_0xef82('0x37')]:_0x69bace[_0xef82('0x33')];if(_0xb490f6[_0xef82('0x34')][_0xef82('0x4a')]){_0x143a67['include']=[{'all':!![]}];}_0x143a67=_[_0xef82('0x41')]({},_0x143a67,_0xb490f6[_0xef82('0x42')]);return db[_0xef82('0x2e')][_0xef82('0x4b')](_0x143a67)[_0xef82('0x26')](handleEntityNotFound(_0x10a135,null))[_0xef82('0x26')](respondWithResult(_0x10a135,null))[_0xef82('0x46')](handleError(_0x10a135,null));};exports['create']=function(_0x198ea0,_0x292785){return db['UserProfile'][_0xef82('0x4c')](_0x198ea0[_0xef82('0x4d')],{})[_0xef82('0x26')](respondWithResult(_0x292785,0xc9))['catch'](handleError(_0x292785,null));};exports['clone']=function(_0x302380,_0x3607f4){var _0x209e24={'where':{'id':_0x302380[_0xef82('0x48')]['id']}},_0x492811={};_0x492811[_0xef82('0x33')]=_[_0xef82('0x35')](db['UserProfile'][_0xef82('0x2f')]);_0x209e24[_0xef82('0x37')]=_[_0xef82('0x38')](_0x492811[_0xef82('0x33')],qs['fields'](_0x302380['query'][_0xef82('0x39')]));_0x209e24[_0xef82('0x37')]=_0x209e24[_0xef82('0x37')][_0xef82('0x49')]?_0x209e24[_0xef82('0x37')]:_0x492811['model'];if(_0x302380[_0xef82('0x34')][_0xef82('0x4a')]){_0x209e24[_0xef82('0x43')]=[{'all':!![]}];}_0x209e24=_[_0xef82('0x41')]({},_0x209e24,_0x302380['options']);return db[_0xef82('0x2e')][_0xef82('0x4b')](_0x209e24)[_0xef82('0x26')](handleEntityNotFound(_0x3607f4,null))[_0xef82('0x26')](function(_0xd764d9){if(_0xd764d9){var _0x1b99a5=_0xd764d9[_0xef82('0x4e')]({'plain':!![]});_0x1b99a5=qs[_0xef82('0x4f')](_0x1b99a5,['id',_0xef82('0x50'),_0xef82('0x51'),_0xef82('0x52')]);_0x302380[_0xef82('0x4d')]=_[_0xef82('0x4f')](_0x302380[_0xef82('0x4d')],['id',_0xef82('0x50'),_0xef82('0x51')]);return db[_0xef82('0x53')][_0xef82('0x54')](function(_0x313bf2){return db[_0xef82('0x2e')]['create'](_['merge'](_0x1b99a5,_0x302380['body']),{'include':_0x302380[_0xef82('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x313bf2})[_0xef82('0x26')](function(_0x1f0d67){var _0x58b376=_0x1f0d67[_0xef82('0x4e')]({'plain':!![]});return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x302380[_0xef82('0x48')]['id']},'raw':!![]})[_0xef82('0x26')](function(_0x29a5b9){if(_0x29a5b9){return BPromise['each'](_0x29a5b9,function(_0x4c120e){return new BPromise(function(_0x53dd56,_0x280af2){if(_0x4c120e['autoAssociation']===null||_0x4c120e['autoAssociation']===0x1)_0x53dd56(null);return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0x4c120e['id']},'raw':!![]})['then'](function(_0xe11f03){var _0x51edb2=_[_0xef82('0x2d')](_0xe11f03,function(_0x246c55){return qs[_0xef82('0x4f')](_0x246c55,['id',_0xef82('0x50'),_0xef82('0x51'),_0xef82('0x57')]);});_0x53dd56(_0x51edb2);})['catch'](function(_0x25f849){_0x280af2(_0x25f849);});})[_0xef82('0x26')](function(_0x1fda39){var _0x481388=qs[_0xef82('0x4f')](_0x4c120e,['id',_0xef82('0x50'),_0xef82('0x51')]);_0x481388[_0xef82('0x58')]=_0x58b376['id'];if(_0x1fda39)_0x481388[_0xef82('0x59')]=_0x1fda39;return _0x481388;})[_0xef82('0x26')](function(_0x2a4215){return db[_0xef82('0x55')]['create'](_0x2a4215,{'include':[{'model':db['UserProfileResource'],'as':_0xef82('0x59')}],'raw':!![],'transaction':_0x313bf2});});})[_0xef82('0x26')](function(){return _0x58b376;});}});});});}})['then'](respondWithResult(_0x3607f4,0xc9))[_0xef82('0x46')](handleError(_0x3607f4,null));};exports[_0xef82('0x24')]=function(_0xfbe1ee,_0x38b27a){if(_0xfbe1ee[_0xef82('0x4d')]['id']){delete _0xfbe1ee[_0xef82('0x4d')]['id'];}return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0xfbe1ee[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x38b27a,null))[_0xef82('0x26')](saveUpdates(_0xfbe1ee[_0xef82('0x4d')],null))[_0xef82('0x26')](respondWithResult(_0x38b27a,null))[_0xef82('0x46')](handleError(_0x38b27a,null));};exports[_0xef82('0x25')]=function(_0x3465e4,_0x5c1917){return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x3465e4[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x5c1917,null))[_0xef82('0x26')](removeEntity(_0x5c1917,null))[_0xef82('0x46')](handleError(_0x5c1917,null));};exports['describe']=function(_0x287a84,_0x413fe9){return db[_0xef82('0x2e')][_0xef82('0x5a')]()[_0xef82('0x26')](respondWithResult(_0x413fe9,null))['catch'](handleError(_0x413fe9,null));};exports[_0xef82('0x5b')]=function(_0x44c8c4,_0x3fe9cd){var _0x3ec0e8=_0x44c8c4[_0xef82('0x4d')];return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x44c8c4[_0xef82('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fe9cd,null))[_0xef82('0x26')](function(_0x52682f){if(_0x52682f){return db[_0xef82('0x53')][_0xef82('0x54')](function(_0x45e846){return db[_0xef82('0x55')][_0xef82('0x25')]({'where':{'userProfileId':_0x44c8c4[_0xef82('0x48')]['id'],'sectionId':_[_0xef82('0x2d')](_0x3ec0e8,function(_0x38a335){return _0x38a335[_0xef82('0x57')];})},'transaction':_0x45e846})['then'](function(){var _0x5c876c=_[_0xef82('0x2d')](_0x3ec0e8,function(_0x2b87f8){_0x2b87f8[_0xef82('0x58')]=_0x44c8c4[_0xef82('0x48')]['id'];return _0x2b87f8;});var _0x40e600=[];return BPromise['each'](_0x5c876c,function(_0x115d02){return db['UserProfileSection'][_0xef82('0x4c')](_0x115d02,{'include':[{'model':db[_0xef82('0x56')],'as':_0xef82('0x59')}],'raw':!![],'transaction':_0x45e846})[_0xef82('0x26')](function(_0x117177){_0x40e600[_0xef82('0x5c')](_0x117177[_0xef82('0x4e')]({'plain':!![]}));});})[_0xef82('0x26')](function(){return _0x40e600;});});});}})[_0xef82('0x26')](function(_0x203174){return _0x203174;})['then'](respondWithResult(_0x3fe9cd,null))[_0xef82('0x46')](handleError(_0x3fe9cd,null));};exports[_0xef82('0x5d')]=function(_0x4f883e,_0x19cefe){var _0x18ad4e;return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x4f883e[_0xef82('0x48')]['id']},'attributes':['id',_0xef82('0x2a')]})[_0xef82('0x26')](handleEntityNotFound(_0x19cefe,null))['then'](function(_0x36b496){if(_0x36b496){_0x18ad4e=_0x36b496;return db[_0xef82('0x55')][_0xef82('0x25')]({'where':{'userProfileId':_0x4f883e['params']['id'],'sectionId':_0x4f883e[_0xef82('0x34')]['ids']}});}})[_0xef82('0x26')](function(){return _0x18ad4e;})[_0xef82('0x26')](respondWithStatusCode(_0x19cefe,null))[_0xef82('0x46')](handleError(_0x19cefe,null));};exports[_0xef82('0x5e')]=function(_0x50a6c1,_0x2103d0){var _0xc17979=[];var _0x23e0f2=[];return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x50a6c1[_0xef82('0x48')]['id']},'raw':!![]})[_0xef82('0x26')](function(_0x51964c){_0xc17979=_['filter'](_0x51964c,function(_0x48b69a){return _0x48b69a[_0xef82('0x5f')]===0x1||_[_0xef82('0x60')]([0x3eb,0x709],_0x48b69a[_0xef82('0x57')]);});if(!_['isEmpty'](_0xc17979)){return _[_0xef82('0x2d')](_0xc17979,function(_0x3dc13a){return _0x3dc13a[_0xef82('0x57')];});}else{return;}})[_0xef82('0x26')](function(_0x46becd){if(_0x46becd)_0x23e0f2=_0x46becd;if(_[_0xef82('0x60')](_0x23e0f2,0x64)){var _0x3afe11=_[_0xef82('0x4b')](_0xc17979,{'sectionId':0x64});return hasDefaultDashboard(_0x3afe11)[_0xef82('0x26')](function(_0x386457){return _[_0xef82('0x2d')](_0xc17979,function(_0xb88335){if(_0xb88335[_0xef82('0x57')]===0x64){_0xb88335[_0xef82('0x61')]=_0x386457;}return _0xb88335;});});}else{return;}})[_0xef82('0x26')](function(_0x4795e7){if(_0x4795e7)_0xc17979=_0x4795e7;if(_[_0xef82('0x60')](_0x23e0f2,0x3eb)){var _0x4d44be=_['find'](_0xc17979,{'sectionId':0x3eb});return getCustomDashboards(_0x4d44be)[_0xef82('0x26')](function(_0x40a1cf){return _['map'](_0xc17979,function(_0x58a42d){if(_0x4d44be[_0xef82('0x5f')]){if(_0x58a42d[_0xef82('0x57')]===0x3eb){_0x58a42d[_0xef82('0x61')]=_0x40a1cf;}}else{if(_0x58a42d[_0xef82('0x57')]===0x64){_0x58a42d['subsections']=_0x40a1cf;}}return _0x58a42d;});});}else{return;}})[_0xef82('0x26')](function(_0xa6bd96){if(_0xa6bd96)_0xc17979=_0xa6bd96;if(_[_0xef82('0x60')](_0x23e0f2,0x709)){var _0x312da1=_[_0xef82('0x4b')](_0xc17979,{'sectionId':0x709});return getPlugins(_0x312da1)[_0xef82('0x26')](function(_0x4b9e0e){if(_0x312da1[_0xef82('0x5f')]){return _[_0xef82('0x2d')](_0xc17979,function(_0x2fb048){if(_0x2fb048[_0xef82('0x57')]===0x709){_0x2fb048[_0xef82('0x61')]=_0x4b9e0e;}return _0x2fb048;});}else{var _0xb119bb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4b9e0e};var _0x3ed208=_[_0xef82('0x2d')](_0xc17979);_0x3ed208[_0xef82('0x5c')](_0xb119bb);return _0x3ed208;}});}else{return;}})[_0xef82('0x26')](function(_0x591b3d){if(_0x591b3d)_0xc17979=_0x591b3d;return _[_0xef82('0x3f')](_0xc17979,[_0xef82('0x5f'),0x1]);})[_0xef82('0x26')](respondWithResult(_0x2103d0,null))['catch'](handleError(_0x2103d0,null));};function hasDefaultDashboard(_0x32cc5b){var _0xef686a=[0x65];return new BPromise(function(_0x40ff0a,_0x3dd796){try{if(_0x32cc5b[_0xef82('0x62')]){_0x40ff0a(_0xef686a);}else{return db[_0xef82('0x56')][_0xef82('0x63')]({'where':{'sectionId':_0x32cc5b['id']},'raw':!![]})['then'](function(_0x5da8bd){_0x5da8bd?_0x40ff0a(_0xef686a):_0x40ff0a();});}}catch(_0x4cd5f9){_0x3dd796(_0x4cd5f9);}});}function getCustomDashboards(_0x292133){var _0x271266=[];return new BPromise(function(_0x544386,_0x16b48d){try{if(_0x292133[_0xef82('0x62')]){return db[_0xef82('0x64')][_0xef82('0x44')]({'raw':!![]})[_0xef82('0x26')](function(_0x44c5b7){_0x44c5b7[_0xef82('0x65')](function(_0x457dda){_0x271266[_0xef82('0x5c')](_0x457dda['id']+0x1869f);});_0x544386(_0x271266);});}else{return db['UserProfileResource'][_0xef82('0x44')]({'where':{'sectionId':_0x292133['id']},'raw':!![]})[_0xef82('0x26')](function(_0x4966f4){_0x4966f4['forEach'](function(_0x17c390){_0x271266['push'](_0x17c390[_0xef82('0x66')]+0x1869f);});_0x544386(_0x271266);});}}catch(_0x8fed6a){_0x16b48d(_0x8fed6a);}});}function getPlugins(_0x4f8442){var _0x4bb229=[];return new BPromise(function(_0x40bf36,_0x2f5370){try{if(_0x4f8442['autoAssociation']){return db['Plugin'][_0xef82('0x44')]({'raw':!![]})['then'](function(_0x3fc17){_0x3fc17[_0xef82('0x65')](function(_0x31ed10){_0x4bb229[_0xef82('0x5c')](_0x31ed10['id']+0x15b38);});_0x40bf36(_0x4bb229);});}else{return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0x4f8442['id']},'raw':!![]})[_0xef82('0x26')](function(_0xde263f){_0xde263f[_0xef82('0x65')](function(_0x129390){_0x4bb229[_0xef82('0x5c')](_0x129390['resourceId']+0x15b38);});_0x40bf36(_0x4bb229);});}}catch(_0x30168d){_0x2f5370(_0x30168d);}});}exports[_0xef82('0x67')]=function(_0x53596e,_0xc99a5){return db['UserProfile'][_0xef82('0x4b')]({'where':{'id':_0x53596e[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0xc99a5,null))['then'](function(_0x16372a){if(_0x16372a){return db['sequelize'][_0xef82('0x54')](function(_0x46f418){return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xef82('0x26')](function(_0x4f23e1){if(_0x4f23e1){return db[_0xef82('0x55')]['destroy']({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id'],'id':_['map'](_0x4f23e1,function(_0x11968c){return _0x11968c['id'];})},'transaction':_0x46f418});}})[_0xef82('0x26')](function(_0x37992e){var _0x2734d3=_[_0xef82('0x2d')](_0x53596e[_0xef82('0x4d')],function(_0xe4605){_0xe4605['userProfileId']=_0x53596e[_0xef82('0x48')]['id'];return _0xe4605;});return db[_0xef82('0x55')][_0xef82('0x68')](_0x2734d3,{'raw':!![],'transaction':_0x46f418});})[_0xef82('0x26')](function(_0x31781f){var _0x370410=_[_0xef82('0x3f')](_[_0xef82('0x2d')](_0x31781f,function(_0x41f50b){return _0x41f50b['get']({'plain':!![]});}),{'includeAll':![]});if(_0x370410){return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id'],'sectionId':_[_0xef82('0x2d')](_0x370410,function(_0x251cbf){return _0x251cbf[_0xef82('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xef82('0x26')](function(_0x10835d){var _0x230647=_[_0xef82('0x2d')](_0x53596e[_0xef82('0x4d')],function(_0xde2a00){_0xde2a00['userProfileId']=_0x53596e[_0xef82('0x48')]['id'];return _0xde2a00;});return db[_0xef82('0x56')][_0xef82('0x68')](_0x230647,{'raw':!![],'transaction':_0x46f418});});}})[_0xef82('0x46')](handleError(_0xc99a5,null));});}})[_0xef82('0x26')](function(_0x86a754){var _0xc96c72=_[_0xef82('0x2d')](_0x86a754,function(_0x4892e3){return _0x4892e3[_0xef82('0x4e')]({'plain':!![]});});})[_0xef82('0x26')](respondWithResult(_0xc99a5,null))[_0xef82('0x46')](handleError(_0xc99a5,null));};exports[_0xef82('0x69')]=function(_0x4dd4de,_0x4aa8be,_0xaa1171){return db['UserProfile'][_0xef82('0x4b')]({'where':{'id':_0x4dd4de[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x4aa8be,null))[_0xef82('0x26')](function(_0x3b768c){if(_0x3b768c){return _0x3b768c[_0xef82('0x69')](_0x4dd4de['query'][_0xef82('0x6a')]);}})[_0xef82('0x26')](respondWithStatusCode(_0x4aa8be,null))[_0xef82('0x46')](handleError(_0x4aa8be,null));};exports[_0xef82('0x6b')]=function(_0x2d97a3,_0x17172d){var _0x105df4={'raw':![],'where':{}};var _0x18bb52={};var _0x46d315={'count':0x0,'rows':[]};var _0x56a822=_0x2d97a3['query'][_0xef82('0x6c')];if(typeof _0x56a822===_0xef82('0x6d')){throw new db['Sequelize']['ValidationError'](_0xef82('0x6e'));}var _0x50fd6=_0x2d97a3[_0xef82('0x34')][_0xef82('0x6f')]||![];var _0x17c1f1=getQueryModels(_0x56a822,_0x50fd6);if(typeof _0x17c1f1[_0xef82('0x70')]===_0xef82('0x6d')){throw new db[(_0xef82('0x71'))][(_0xef82('0x72'))](_0xef82('0x73')+_0x56a822+'\x27');}var _0x171b7b=[];if(!_['isEmpty'](_0x17c1f1[_0xef82('0x74')])){_0x171b7b=_0x17c1f1[_0xef82('0x74')];}else{_0x171b7b=[{'name':_0x56a822}];}return db['UserProfile'][_0xef82('0x63')]({'where':{'id':_0x2d97a3[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x17172d,null))[_0xef82('0x26')](function(_0x10aa45){if(_0x10aa45){var _0x10687e=[];for(var _0x3d0e31=0x0;_0x3d0e31<_0x171b7b[_0xef82('0x49')];_0x3d0e31++){_0x10687e[_0xef82('0x5c')](db[_0xef82('0x55')][_0xef82('0x63')]({'where':{'userProfileId':_0x10aa45['id'],'name':_0x171b7b[_0x3d0e31][_0xef82('0x2a')]},'raw':!![]}));}return BPromise[_0xef82('0x75')](_0x10687e);}})['then'](function(_0x48243c){var _0x2e4a65=_[_0xef82('0x3f')](_0x48243c,function(_0x26700b){return _0x26700b?_0x26700b:undefined;});var _0xfa4545=_['filter'](_0x171b7b,['ignore',!![]]);var _0x196ff9=_[_0xef82('0x76')](_0x2e4a65)&&_[_0xef82('0x76')](_0xfa4545)?null:_[_0xef82('0x77')](_0xfa4545,_0x2e4a65);if(_0x196ff9){var _0x153db7=[];for(var _0x4935a0=0x0;_0x4935a0<_0x196ff9[_0xef82('0x49')];_0x4935a0++){var _0xc24765=_[_0xef82('0x4b')](_0x171b7b,function(_0x11077b){return _0x196ff9[_0x4935a0]?_0x11077b[_0xef82('0x2a')]===_0x196ff9[_0x4935a0][_0xef82('0x2a')]:null;});if(_0xc24765){if(_0x196ff9[_0x4935a0]['ignore']){_0x153db7['push'](getAllResources(_0x17c1f1[_0xef82('0x70')],_0x196ff9[_0x4935a0]));}else{if(!_0x196ff9[_0x4935a0][_0xef82('0x62')]){_0x153db7[_0xef82('0x5c')](getAllowedResources(_0xc24765,_0x196ff9[_0x4935a0],_0x17c1f1[_0xef82('0x70')]));}else{if(_0xc24765[_0xef82('0x33')]){_0x153db7[_0xef82('0x5c')](getAllFilteredResources(_0xc24765,_0x196ff9[_0x4935a0]));}}}}}return BPromise[_0xef82('0x75')](_0x153db7);}else{return null;}})[_0xef82('0x26')](function(_0x3f0c47){var _0x5bb54b=_0x3f0c47;var _0x476df2=null;if(_0x5bb54b){_0x476df2=_0x5bb54b[_0xef82('0x49')]===0x1?_0x5bb54b[0x0]:null;}if(_0x476df2||_0x5bb54b){var _0x46998c=db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x2f')];_0x18bb52[_0xef82('0x33')]=_['keys'](_0x46998c);_0x18bb52[_0xef82('0x34')]=_['keys'](_0x2d97a3[_0xef82('0x34')]);_0x18bb52[_0xef82('0x36')]=_[_0xef82('0x38')](_0x18bb52['model'],_0x18bb52[_0xef82('0x34')]);_0x105df4['attributes']=_[_0xef82('0x38')](_0x18bb52[_0xef82('0x33')],qs[_0xef82('0x39')](_0x2d97a3['query'][_0xef82('0x39')]));_0x105df4[_0xef82('0x37')]=_0x105df4[_0xef82('0x37')]['length']?_0x105df4[_0xef82('0x37')]:_0x18bb52[_0xef82('0x33')];if(!_0x2d97a3[_0xef82('0x34')][_0xef82('0x78')]('nolimit')){_0x105df4[_0xef82('0x3b')]=qs[_0xef82('0x3b')](_0x2d97a3[_0xef82('0x34')][_0xef82('0x3b')]);_0x105df4['offset']=qs['offset'](_0x2d97a3['query'][_0xef82('0x21')]);}_0x105df4[_0xef82('0x3c')]=qs[_0xef82('0x3d')](_0x2d97a3['query'][_0xef82('0x3d')]);_0x105df4[_0xef82('0x40')]=qs[_0xef82('0x36')](_[_0xef82('0x3e')](_0x2d97a3['query'],_0x18bb52[_0xef82('0x36')]));if(_0x2d97a3[_0xef82('0x34')][_0xef82('0x3f')]){_0x105df4[_0xef82('0x40')]=_[_0xef82('0x41')](_0x105df4[_0xef82('0x40')],{'$or':_[_0xef82('0x2d')](_0x46998c,function(_0x35f265){if(_0x35f265['type'][_0xef82('0x32')]!==_0xef82('0x79')){var _0x541811={};_0x541811[_0x35f265['field']]={'$like':'%'+_0x2d97a3[_0xef82('0x34')]['filter']+'%'};return _0x541811;}})});}var _0x1b9ceb=[];if(_0x476df2){var _0x1f2d5d=_[_0xef82('0x4b')](_0x171b7b,['name',_0x476df2[_0xef82('0x2a')]]);if(_0x1f2d5d['field']){var _0xf13de9={};if(_0x17c1f1['childModel']===_0xef82('0x7a')){_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_[_0xef82('0x2d')](_0x476df2['associatedResources'],'id');}else{_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_0x476df2[_0xef82('0x7c')];}_0x1b9ceb['push'](_0xf13de9);}else{_0x105df4[_0xef82('0x40')]['id']=_0x476df2[_0xef82('0x7c')];}}else{for(var _0x37acd6=0x0;_0x37acd6<_0x5bb54b[_0xef82('0x49')];_0x37acd6++){var _0x1f2d5d=_['find'](_0x171b7b,[_0xef82('0x2a'),_0x5bb54b[_0x37acd6][_0xef82('0x2a')]]);if(_0x1f2d5d[_0xef82('0x7d')]){var _0xf13de9={};_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_0x5bb54b[_0x37acd6][_0xef82('0x7c')];_0x1b9ceb[_0xef82('0x5c')](_0xf13de9);}else{if(!_0x105df4[_0xef82('0x40')]['id'])_0x105df4[_0xef82('0x40')]['id']=[];_0x5bb54b[_0x37acd6]['associatedResources'][_0xef82('0x65')](function(_0x2f0c75){_0x105df4[_0xef82('0x40')]['id'][_0xef82('0x5c')](_0x2f0c75);});}}}if(!_[_0xef82('0x76')](_0x1b9ceb)){_0x105df4[_0xef82('0x40')]=_[_0xef82('0x41')](_0x105df4[_0xef82('0x40')],{'$and':{'$or':_0x1b9ceb}});}_0x105df4=_['merge']({},_0x105df4,_0x2d97a3['options']);if(_0x476df2&&!_0x476df2['autoAssociation']&&_0x17c1f1[_0xef82('0x70')]===_0xef82('0x7a')){if(_0x2d97a3['query'][_0xef82('0x4a')]){_0x105df4['include']=[{'all':!![]}];}return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x44')](_0x105df4)[_0xef82('0x26')](function(_0x2dddcc){var _0xd6e8ef=[];_0x2dddcc['forEach'](function(_0x206823){var _0x289871;switch(_0x206823[_0xef82('0x7e')]){case _0xef82('0x7f'):_0x289871=_[_0xef82('0x4b')](_0x476df2['associatedResources'],function(_0x11ee94){return _0x11ee94['id']===_0x206823[_0xef82('0x80')]&&_0x11ee94[_0xef82('0x31')]===_0xef82('0x81');});break;case _0xef82('0x82'):_0x289871=_[_0xef82('0x4b')](_0x476df2[_0xef82('0x7c')],function(_0x348ffb){return _0x348ffb['id']===_0x206823['reportId']&&_0x348ffb['type']===_0xef82('0x83');});break;}if(_0x289871)_0xd6e8ef[_0xef82('0x5c')](_0x206823);});_0x46d315[_0xef82('0x20')]=_0xd6e8ef['length'];_0x46d315[_0xef82('0x45')]=_0xd6e8ef;return _0x46d315;});}else{return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x20')]({'where':_0x105df4[_0xef82('0x40')]})[_0xef82('0x26')](function(_0x209fc2){_0x46d315[_0xef82('0x20')]=_0x209fc2;if(_0x2d97a3['query']['includeAll']){if(_0x17c1f1['childModel']===_0xef82('0x84')){_0x105df4[_0xef82('0x43')]=[{'model':db[_0xef82('0x85')],'as':_0xef82('0x86'),'attributes':['id',_0xef82('0x2a'),'color'],'required':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?!![]:![]},{'model':db['Tag'],'as':_0xef82('0x88'),'attributes':['id',_0xef82('0x2a'),_0xef82('0x89')],'through':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?{'attributes':[],'where':{'TagId':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]||undefined}}:{},'required':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?!![]:![]}];}else{_0x105df4[_0xef82('0x43')]=[{'all':!![]}];}}return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x44')](_0x105df4);})[_0xef82('0x26')](function(_0x39a121){_0x46d315[_0xef82('0x45')]=_0x39a121;return _0x46d315;});}}else{return _0x46d315;}})[_0xef82('0x26')](respondWithFilteredResult(_0x17172d,_0x105df4))['catch'](handleError(_0x17172d,null));};function getAllResources(_0x3d8ee0,_0x120bd2){return new BPromise(function(_0x1aa570,_0x4308b6){if(_0x120bd2){var _0x396d1b=_0x120bd2[_0xef82('0x3f')]?{[_0x120bd2[_0xef82('0x3f')][_0xef82('0x7d')]]:_0x120bd2['filter']['value']}:undefined;return db[_0x3d8ee0][_0xef82('0x44')]({'where':_0x396d1b,'raw':!![]})[_0xef82('0x26')](function(_0x539af5){_0x120bd2['associatedResources']=_[_0xef82('0x2d')](_0x539af5,'id');_0x1aa570(_0x120bd2);})['catch'](function(_0x4eda77){_0x4308b6(_0x4eda77);});}else{_0x1aa570(null);}});}function getAllFilteredResources(_0x39f560,_0x412b10){return new BPromise(function(_0x21397c,_0x44371a){var _0xa72eb7=_0x39f560[_0xef82('0x3f')]?{[_0x39f560['filter']['field']]:_0x39f560[_0xef82('0x3f')]['value']}:undefined;return db[_0x39f560[_0xef82('0x33')]][_0xef82('0x44')]({'where':_0xa72eb7,'raw':!![]})['then'](function(_0x56c58f){_0x412b10[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56c58f,function(_0x42cf23){return _0x42cf23[_0xef82('0x2a')];});_0x21397c(_0x412b10);})['catch'](function(_0x1fce6a){_0x44371a(_0x1fce6a);});});}function getAllowedResources(_0x688a6a,_0xbec23f,_0x47ec4c){return new BPromise(function(_0x19ade0,_0x155b1d){if(_0xbec23f){return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0xbec23f['id']},'raw':!![]})[_0xef82('0x26')](function(_0x56aaa6){if(_0x688a6a[_0xef82('0x7d')]&&_0x688a6a[_0xef82('0x7d')]!=='id'){_0xbec23f['associatedResources']=_['map'](_0x56aaa6,function(_0x4d5038){return _0x4d5038[_0x688a6a['field']];});}else{if(_0x47ec4c===_0xef82('0x7a')){_0xbec23f[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56aaa6,function(_0x4d836a){return{'id':_0x4d836a['resourceId'],'type':_0x4d836a[_0xef82('0x31')]};});}else{_0xbec23f[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56aaa6,function(_0x3c782b){return _0x3c782b[_0xef82('0x66')];});}}_0x19ade0(_0xbec23f);})[_0xef82('0x46')](function(_0x2dacf5){_0x155b1d(_0x2dacf5);});}else{_0x19ade0(null);}});}function getQueryModels(_0x455d05,_0x19d883){var _0x48eb83=_0x455d05[_0xef82('0x8a')]();var _0x59f7fc={'childModel':undefined,'parentSections':[]};switch(_0x48eb83){case _0xef82('0x8b'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x8c');break;case _0xef82('0x8d'):_0x59f7fc['childModel']=_0xef82('0x8e');break;case'squarerecordings':_0x59f7fc[_0xef82('0x70')]='SquareRecording';_0x59f7fc[_0xef82('0x74')]=[{'name':'SquareProjects','field':_0xef82('0x2a'),'foreignKey':_0xef82('0x8f')}];break;case _0xef82('0x90'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x91');break;case'contacts':_0x59f7fc[_0xef82('0x70')]=_0xef82('0x84');_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0x92'),'field':'id','foreignKey':'ListId'}];break;case _0xef82('0x93'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x94');break;case _0xef82('0x95'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x96');break;case'globalcustomfields':_0x59f7fc[_0xef82('0x70')]='CmCustomField';break;case _0xef82('0x97'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x98');break;case _0xef82('0x99'):_0x59f7fc['childModel']='ChatWebsite';break;case _0xef82('0x9a'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x9b');break;case _0xef82('0x9c'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x9d');break;case _0xef82('0x9e'):case _0xef82('0x9f'):case'outboundroutes':_0x59f7fc['childModel']='VoiceExtension';break;case _0xef82('0xa0'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa1');break;case _0xef82('0xa2'):_0x59f7fc[_0xef82('0x70')]='VoiceMail';break;case'voicerecordings':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa3');_0x59f7fc['parentSections']=[{'name':_0xef82('0xa4'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xa5'),'model':_0xef82('0xa6'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xa8')]}},{'name':_0xef82('0xa9'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xa5'),'model':_0xef82('0xa6'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xaa')]}},{'name':_0xef82('0xab'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xac'),'model':_0xef82('0xad'),'filter':{'field':_0xef82('0x31'),'value':[_0xef82('0xae')]}},{'name':_0xef82('0xaf'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xac'),'model':_0xef82('0xad'),'filter':{'field':_0xef82('0x31'),'value':['outbound']}}];break;case _0xef82('0xb0'):_0x59f7fc['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb1');break;case _0xef82('0xb2'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb3');break;case _0xef82('0xb4'):_0x59f7fc['childModel']=_0xef82('0xb5');break;case _0xef82('0xb6'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb7');break;case _0xef82('0xb8'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb9');break;case'mailsubstatuses':_0x59f7fc[_0xef82('0x70')]='MailSubstatus';break;case _0xef82('0xba'):_0x59f7fc['childModel']='OpenchannelQueue';break;case _0xef82('0xbb'):_0x59f7fc[_0xef82('0x70')]='OpenchannelAccount';break;case _0xef82('0xbc'):_0x59f7fc[_0xef82('0x70')]='SmsQueue';break;case _0xef82('0xbd'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xbe');break;case _0xef82('0xbf'):_0x59f7fc['childModel']=_0xef82('0xc0');break;case _0xef82('0xc1'):_0x59f7fc[_0xef82('0x70')]='WhatsappAccount';break;case _0xef82('0xc2'):_0x59f7fc['childModel']=_0xef82('0xc3');break;case _0xef82('0xc4'):case _0xef82('0xc5'):_0x59f7fc[_0xef82('0x70')]='VoiceQueue';if(_0x19d883){_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0xab')},{'name':'QueueCampaigns'}];}break;case _0xef82('0xc6'):case _0xef82('0xc7'):case'telephones':_0x59f7fc['childModel']='User';if(_0x19d883){_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0xc8'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xc9'),_0xef82('0xca')]},'ignore':!![]},{'name':_0xef82('0xa4')},{'name':_0xef82('0xa9')}];}break;case'zendeskaccounts':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xcb');break;case _0xef82('0xcc'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xcd');break;case'freshdeskaccounts':_0x59f7fc[_0xef82('0x70')]='FreshdeskAccount';break;case _0xef82('0xce'):_0x59f7fc['childModel']=_0xef82('0xcf');break;case _0xef82('0xd0'):_0x59f7fc['childModel']='DeskAccount';break;case _0xef82('0xd1'):_0x59f7fc[_0xef82('0x70')]='ZohoAccount';break;case _0xef82('0xd2'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa6');break;case _0xef82('0xd3'):_0x59f7fc[_0xef82('0x70')]='CannedAnswer';break;case'dispositions':_0x59f7fc['childModel']='Disposition';break;case _0xef82('0xd4'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x64');break;case'intervals':_0x59f7fc[_0xef82('0x70')]='Interval';break;case _0xef82('0xd5'):_0x59f7fc['childModel']=_0xef82('0xd6');break;case'scheduler':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xd7');break;case _0xef82('0xd8'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xd9');break;case'tags':_0x59f7fc[_0xef82('0x70')]=_0xef82('0x85');break;case _0xef82('0xda'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xdb');break;case'triggers':_0x59f7fc[_0xef82('0x70')]='Trigger';break;case _0xef82('0xdc'):_0x59f7fc['childModel']=_0xef82('0xdd');break;case _0xef82('0xde'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xdf');break;case _0xef82('0xe0'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xe1');break;case'extractedreports':_0x59f7fc[_0xef82('0x70')]='AnalyticExtractedReport';_0x59f7fc['parentSections']=[{'name':_0xef82('0xe2'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x59f7fc['childModel']=_0xef82('0xe3');break;case _0xef82('0xc1'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xe4');break;default:return _0x59f7fc;}return _0x59f7fc;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e72cbec..60f51b9 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 _0xa615=['update','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x5dadc1,_0x1c4785){var _0x197fbd=function(_0x4f6480){while(--_0x4f6480){_0x5dadc1['push'](_0x5dadc1['shift']());}};_0x197fbd(++_0x1c4785);}(_0xa615,0x175));var _0x5a61=function(_0x507a3b,_0x2e8aba){_0x507a3b=_0x507a3b-0x0;var _0x31a2e0=_0xa615[_0x507a3b];return _0x31a2e0;};'use strict';var EventEmitter=require(_0x5a61('0x0'));var UserProfile=require(_0x5a61('0x1'))['db'][_0x5a61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5a61('0x3')](0x0);var events={'afterCreate':_0x5a61('0x4'),'afterUpdate':_0x5a61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1e8727){return function(_0xa29cb0,_0x4d53ed,_0x2c975f){UserProfileEvents[_0x5a61('0x6')](_0x1e8727+':'+_0xa29cb0['id'],_0xa29cb0);UserProfileEvents[_0x5a61('0x6')](_0x1e8727,_0xa29cb0);_0x2c975f(null);};}for(var e in events){if(events[_0x5a61('0x7')](e)){var event=events[e];UserProfile[_0x5a61('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x995f=['hasOwnProperty','../../mysqldb','UserProfile','setMaxListeners','emit'];(function(_0xbe7a75,_0x2b4534){var _0x3d83ed=function(_0x188baf){while(--_0x188baf){_0xbe7a75['push'](_0xbe7a75['shift']());}};_0x3d83ed(++_0x2b4534);}(_0x995f,0xb0));var _0xf995=function(_0x2ce4bb,_0x4bc632){_0x2ce4bb=_0x2ce4bb-0x0;var _0x19356b=_0x995f[_0x2ce4bb];return _0x19356b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf995('0x0'))['db'][_0xf995('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf995('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b879){return function(_0x23bb31,_0x129baf,_0x9ef59c){UserProfileEvents[_0xf995('0x3')](_0x22b879+':'+_0x23bb31['id'],_0x23bb31);UserProfileEvents[_0xf995('0x3')](_0x22b879,_0x23bb31);_0x9ef59c(null);};}for(var e in events){if(events[_0xf995('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a846f88..efbb81e 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 _0xe53e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfile.attributes','exports','define','UserProfile','lodash','util'];(function(_0x2caf3d,_0x330368){var _0x5f0bca=function(_0x421d8a){while(--_0x421d8a){_0x2caf3d['push'](_0x2caf3d['shift']());}};_0x5f0bca(++_0x330368);}(_0xe53e,0x6a));var _0xee53=function(_0x3615cd,_0x9dce6e){_0x3615cd=_0x3615cd-0x0;var _0x1350a4=_0xe53e[_0x3615cd];return _0x1350a4;};'use strict';var _=require(_0xee53('0x0'));var util=require(_0xee53('0x1'));var logger=require(_0xee53('0x2'))(_0xee53('0x3'));var moment=require(_0xee53('0x4'));var BPromise=require(_0xee53('0x5'));var rp=require(_0xee53('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee53('0x7'));var config=require('../../config/environment');var attributes=require(_0xee53('0x8'));module[_0xee53('0x9')]=function(_0x5524e5,_0x1fe5fa){return _0x5524e5[_0xee53('0xa')](_0xee53('0xb'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee0=['user_profiles','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','UserProfile'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0x7ee0,0x7a));var _0x07ee=function(_0x438008,_0x3e71f7){_0x438008=_0x438008-0x0;var _0x3da515=_0x7ee0[_0x438008];return _0x3da515;};'use strict';var _=require(_0x07ee('0x0'));var util=require(_0x07ee('0x1'));var logger=require(_0x07ee('0x2'))(_0x07ee('0x3'));var moment=require('moment');var BPromise=require(_0x07ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ee('0x5'));var rimraf=require(_0x07ee('0x6'));var config=require(_0x07ee('0x7'));var attributes=require('./userProfile.attributes');module[_0x07ee('0x8')]=function(_0x14dca2,_0x579793){return _0x14dca2['define'](_0x07ee('0x9'),attributes,{'tableName':_0x07ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f5f08c7..ba7751d 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 _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x48d4dc,_0x2f042e){var _0x1c1c7a=function(_0x1306eb){while(--_0x1306eb){_0x48d4dc['push'](_0x48d4dc['shift']());}};_0x1c1c7a(++_0x2f042e);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0xfdbd[_0x463376];return _0x336ccd;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file +var _0x9957=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('UserProfile,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index bd8caad..f4ef1f3 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 _0x5ec5=['userProfile:','save','update','emit','register'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5ec5,0x187));var _0x55ec=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5ec5[_0x167cc1];return _0x10bc4b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x55ec('0x0'),'remove',_0x55ec('0x1')];function createListener(_0x3ffb4c,_0x407390){return function(_0x2127c4){_0x407390[_0x55ec('0x2')](_0x3ffb4c,_0x2127c4);};}function removeListener(_0x1a8bc1,_0x4953ff){return function(){UserProfileEvents['removeListener'](_0x1a8bc1,_0x4953ff);};}exports[_0x55ec('0x3')]=function(_0x598219){for(var _0x2e1cd6=0x0,_0x3fac4f=events['length'];_0x2e1cd6<_0x3fac4f;_0x2e1cd6++){var _0x1bfd81=events[_0x2e1cd6];var _0x394575=createListener(_0x55ec('0x4')+_0x1bfd81,_0x598219);UserProfileEvents['on'](_0x1bfd81,_0x394575);}}; \ No newline at end of file +var _0xf686=['length','userProfile:','./userProfile.events','save','remove','update','emit','register'];(function(_0x25a04e,_0x435456){var _0x195480=function(_0x1e33b7){while(--_0x1e33b7){_0x25a04e['push'](_0x25a04e['shift']());}};_0x195480(++_0x435456);}(_0xf686,0x1ba));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0x6f68('0x0'));var events=[_0x6f68('0x1'),_0x6f68('0x2'),_0x6f68('0x3')];function createListener(_0x330ed8,_0x220929){return function(_0xf33999){_0x220929[_0x6f68('0x4')](_0x330ed8,_0xf33999);};}function removeListener(_0x2371f6,_0x343264){return function(){UserProfileEvents['removeListener'](_0x2371f6,_0x343264);};}exports[_0x6f68('0x5')]=function(_0x5c8b6b){for(var _0xa993a9=0x0,_0x58a511=events[_0x6f68('0x6')];_0xa993a9<_0x58a511;_0xa993a9++){var _0x171d22=events[_0xa993a9];var _0x4bcbe3=createListener(_0x6f68('0x7')+_0x171d22,_0x5c8b6b);UserProfileEvents['on'](_0x171d22,_0x4bcbe3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5ca5591..190ab39 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 _0x667b=['connect-timeout','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x667b,0x1b7));var _0xb667=function(_0x530245,_0x1541ab){_0x530245=_0x530245-0x0;var _0x22506d=_0x667b[_0x530245];return _0x22506d;};'use strict';var multer=require(_0xb667('0x0'));var util=require(_0xb667('0x1'));var path=require(_0xb667('0x2'));var timeout=require(_0xb667('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb667('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb667('0x5'));var controller=require(_0xb667('0x6'));router['get']('/',auth[_0xb667('0x7')](),controller['index']);router[_0xb667('0x8')]('/describe',auth[_0xb667('0x7')](),controller['describe']);router[_0xb667('0x8')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xa')]);router['post']('/',auth[_0xb667('0x7')](),controller[_0xb667('0xb')]);router[_0xb667('0xc')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xd')]);router[_0xb667('0xe')](_0xb667('0x9'),auth[_0xb667('0x7')](),controller[_0xb667('0xf')]);module[_0xb667('0x10')]=router; \ No newline at end of file +var _0xc15c=['express','../../components/auth/service','./userProfileResource.controller','index','get','describe','/:id','isAuthenticated','show','create','put','update','delete','exports','path','connect-timeout'];(function(_0x422ae7,_0x26f223){var _0x53f008=function(_0x1f76f6){while(--_0x1f76f6){_0x422ae7['push'](_0x422ae7['shift']());}};_0x53f008(++_0x26f223);}(_0xc15c,0xae));var _0xcc15=function(_0x3b3fb0,_0x1d428a){_0x3b3fb0=_0x3b3fb0-0x0;var _0x2c68c4=_0xc15c[_0x3b3fb0];return _0x2c68c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcc15('0x0'));var timeout=require(_0xcc15('0x1'));var express=require(_0xcc15('0x2'));var router=express['Router']();var auth=require(_0xcc15('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc15('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc15('0x5')]);router[_0xcc15('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xcc15('0x7')]);router[_0xcc15('0x6')](_0xcc15('0x8'),auth[_0xcc15('0x9')](),controller[_0xcc15('0xa')]);router['post']('/',auth[_0xcc15('0x9')](),controller[_0xcc15('0xb')]);router[_0xcc15('0xc')](_0xcc15('0x8'),auth['isAuthenticated'](),controller[_0xcc15('0xd')]);router[_0xcc15('0xe')](_0xcc15('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc15('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a1662b3..e171907 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 _0x83c9=['INTEGER','STRING','sequelize'];(function(_0x46345b,_0x38a304){var _0x5b7a99=function(_0x45f010){while(--_0x45f010){_0x46345b['push'](_0x46345b['shift']());}};_0x5b7a99(++_0x38a304);}(_0x83c9,0x161));var _0x983c=function(_0x3b20c2,_0x888661){_0x3b20c2=_0x3b20c2-0x0;var _0x5b4482=_0x83c9[_0x3b20c2];return _0x5b4482;};'use strict';var Sequelize=require(_0x983c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x983c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x983c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x43f6=['STRING','sequelize','exports'];(function(_0x5e77ff,_0x1fe29c){var _0x115c32=function(_0x5a446b){while(--_0x5a446b){_0x5e77ff['push'](_0x5e77ff['shift']());}};_0x115c32(++_0x1fe29c);}(_0x43f6,0x1a8));var _0x643f=function(_0x8153ce,_0xcb6429){_0x8153ce=_0x8153ce-0x0;var _0x3294bc=_0x43f6[_0x8153ce];return _0x3294bc;};'use strict';var Sequelize=require(_0x643f('0x0'));module[_0x643f('0x1')]={'name':{'type':Sequelize[_0x643f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x643f('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 ea8a774..961bfd8 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 _0xdc97=['sendStatus','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','length','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1fa590,_0x1d394b){var _0x57b81e=function(_0x560e90){while(--_0x560e90){_0x1fa590['push'](_0x1fa590['shift']());}};_0x57b81e(++_0x1d394b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3e263f,_0x452b25){_0x3e263f=_0x3e263f-0x0;var _0x31783f=_0xdc97[_0x3e263f];return _0x31783f;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=_0x1b0aa1[_0x7dc9('0x18')],_0x11606f=_0x278191[_0x7dc9('0x19')],_0xbe0437=_0x278191['offset']+_0x278191[_0x7dc9('0x1a')],_0x45698c;if(_0xbe0437>=_0x442819){_0xbe0437=_0x442819;_0x45698c=0xc8;}else{_0x45698c=0xce;}_0x3a54f2['status'](_0x45698c);return _0x3a54f2[_0x7dc9('0x1b')](_0x7dc9('0x1c'),_0x11606f+'-'+_0xbe0437+'/'+_0x442819)['json'](_0x1b0aa1);}return null;};}function patchUpdates(_0x41f66e){return function(_0x3b738a){try{jsonpatch[_0x7dc9('0x1d')](_0x3b738a,_0x41f66e,!![]);}catch(_0x4b2703){return BPromise[_0x7dc9('0x1e')](_0x4b2703);}return _0x3b738a[_0x7dc9('0x1f')]();};}function saveUpdates(_0x2dad65,_0x2895f5){return function(_0x155cc4){if(_0x155cc4){return _0x155cc4[_0x7dc9('0x20')](_0x2dad65)['then'](function(_0x593e60){return _0x593e60;});}return null;};}function removeEntity(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x21')]()[_0x7dc9('0x22')](function(){_0x12954f['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x43d31f,_0x41110a){return function(_0x4906b1){if(!_0x4906b1){_0x43d31f[_0x7dc9('0x23')](0x194);}return _0x4906b1;};}function handleError(_0x1e3a8d,_0xf95336){_0xf95336=_0xf95336||0x1f4;return function(_0x55a482){logger['error'](_0x55a482['stack']);if(_0x55a482[_0x7dc9('0x24')]){delete _0x55a482[_0x7dc9('0x24')];}_0x1e3a8d['status'](_0xf95336)['send'](_0x55a482);};}exports[_0x7dc9('0x25')]=function(_0x5afb7d,_0x2d22eb){var _0x1c690b={},_0x3a74a0={},_0x3e4102={'count':0x0,'rows':[]};var _0xa2aaa9=_[_0x7dc9('0x26')](db[_0x7dc9('0x27')][_0x7dc9('0x28')],function(_0x1fcf0e){return{'name':_0x1fcf0e[_0x7dc9('0x29')],'type':_0x1fcf0e[_0x7dc9('0x2a')][_0x7dc9('0x2b')]};});_0x3a74a0['model']=_['map'](_0xa2aaa9,'name');_0x3a74a0['query']=_['keys'](_0x5afb7d['query']);_0x3a74a0['filters']=_['intersection'](_0x3a74a0[_0x7dc9('0x2c')],_0x3a74a0[_0x7dc9('0x2d')]);_0x1c690b[_0x7dc9('0x2e')]=_[_0x7dc9('0x2f')](_0x3a74a0[_0x7dc9('0x2c')],qs[_0x7dc9('0x30')](_0x5afb7d['query']['fields']));_0x1c690b['attributes']=_0x1c690b[_0x7dc9('0x2e')]['length']?_0x1c690b[_0x7dc9('0x2e')]:_0x3a74a0[_0x7dc9('0x2c')];if(!_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x31')](_0x7dc9('0x32'))){_0x1c690b[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x5afb7d[_0x7dc9('0x2d')]['limit']);_0x1c690b[_0x7dc9('0x19')]=qs['offset'](_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x19')]);}_0x1c690b[_0x7dc9('0x33')]=qs[_0x7dc9('0x34')](_0x5afb7d['query'][_0x7dc9('0x34')]);_0x1c690b['where']=qs[_0x7dc9('0x35')](_['pick'](_0x5afb7d['query'],_0x3a74a0[_0x7dc9('0x35')]),_0xa2aaa9);if(_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x36')]){_0x1c690b[_0x7dc9('0x37')]=_['merge'](_0x1c690b[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x26')](_0xa2aaa9,function(_0x138f33){if(_0x138f33[_0x7dc9('0x2a')]!==_0x7dc9('0x38')){var _0x21faa6={};_0x21faa6[_0x138f33[_0x7dc9('0x24')]]={'$like':'%'+_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x36')]+'%'};return _0x21faa6;}})});}_0x1c690b=_[_0x7dc9('0x39')]({},_0x1c690b,_0x5afb7d[_0x7dc9('0x3a')]);var _0x3a8d80={'where':_0x1c690b['where']};return db[_0x7dc9('0x27')][_0x7dc9('0x18')](_0x3a8d80)[_0x7dc9('0x22')](function(_0xfd2612){_0x3e4102['count']=_0xfd2612;if(_0x5afb7d[_0x7dc9('0x2d')][_0x7dc9('0x3b')]){_0x1c690b[_0x7dc9('0x3c')]=[{'all':!![]}];}return db[_0x7dc9('0x27')][_0x7dc9('0x3d')](_0x1c690b);})[_0x7dc9('0x22')](function(_0x5a1201){_0x3e4102['rows']=_0x5a1201;return _0x3e4102;})[_0x7dc9('0x22')](respondWithFilteredResult(_0x2d22eb,_0x1c690b))[_0x7dc9('0x3e')](handleError(_0x2d22eb,null));};exports['show']=function(_0x3a705c,_0x4a37ec){var _0x315d65={'raw':![],'where':{'id':_0x3a705c[_0x7dc9('0x3f')]['id']}},_0x2a91fe={};_0x2a91fe['model']=_[_0x7dc9('0x40')](db[_0x7dc9('0x27')][_0x7dc9('0x28')]);_0x2a91fe[_0x7dc9('0x2d')]=_[_0x7dc9('0x40')](_0x3a705c[_0x7dc9('0x2d')]);_0x2a91fe[_0x7dc9('0x35')]=_['intersection'](_0x2a91fe[_0x7dc9('0x2c')],_0x2a91fe['query']);_0x315d65['attributes']=_[_0x7dc9('0x2f')](_0x2a91fe[_0x7dc9('0x2c')],qs[_0x7dc9('0x30')](_0x3a705c[_0x7dc9('0x2d')][_0x7dc9('0x30')]));_0x315d65[_0x7dc9('0x2e')]=_0x315d65[_0x7dc9('0x2e')][_0x7dc9('0x41')]?_0x315d65[_0x7dc9('0x2e')]:_0x2a91fe['model'];if(_0x3a705c[_0x7dc9('0x2d')][_0x7dc9('0x3b')]){_0x315d65[_0x7dc9('0x3c')]=[{'all':!![]}];}_0x315d65=_[_0x7dc9('0x39')]({},_0x315d65,_0x3a705c[_0x7dc9('0x3a')]);return db[_0x7dc9('0x27')]['find'](_0x315d65)[_0x7dc9('0x22')](handleEntityNotFound(_0x4a37ec,null))[_0x7dc9('0x22')](respondWithResult(_0x4a37ec,null))['catch'](handleError(_0x4a37ec,null));};exports[_0x7dc9('0x42')]=function(_0x1f7700,_0x3c45b5){return db['UserProfileResource'][_0x7dc9('0x42')](_0x1f7700['body'],{})['then'](respondWithResult(_0x3c45b5,0xc9))[_0x7dc9('0x3e')](handleError(_0x3c45b5,null));};exports[_0x7dc9('0x20')]=function(_0x36d591,_0x5e0dc5){if(_0x36d591['body']['id']){delete _0x36d591[_0x7dc9('0x43')]['id'];}return db['UserProfileResource'][_0x7dc9('0x44')]({'where':{'id':_0x36d591[_0x7dc9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e0dc5,null))[_0x7dc9('0x22')](saveUpdates(_0x36d591[_0x7dc9('0x43')],null))[_0x7dc9('0x22')](respondWithResult(_0x5e0dc5,null))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports[_0x7dc9('0x21')]=function(_0x113087,_0x86739f){return db[_0x7dc9('0x27')][_0x7dc9('0x44')]({'where':{'id':_0x113087[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x22')](handleEntityNotFound(_0x86739f,null))[_0x7dc9('0x22')](removeEntity(_0x86739f,null))[_0x7dc9('0x3e')](handleError(_0x86739f,null));};exports['describe']=function(_0x3132b1,_0x4fcfd5){return db['UserProfileResource'][_0x7dc9('0x45')]()[_0x7dc9('0x22')](respondWithResult(_0x4fcfd5,null))[_0x7dc9('0x3e')](handleError(_0x4fcfd5,null));}; \ No newline at end of file +var _0x7da7=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','UserProfileResource','rows','catch','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2ce685,_0x3d8575){var _0x11dd12=function(_0x28be80){while(--_0x28be80){_0x2ce685['push'](_0x2ce685['shift']());}};_0x11dd12(++_0x3d8575);}(_0x7da7,0x10d));var _0x77da=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x7da7[_0x39d39d];return _0x577ac3;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=_0x29cd7b['count'],_0x1b0e17=_0x4e130c['offset'],_0x4500c4=_0x4e130c['offset']+_0x4e130c[_0x77da('0x19')],_0x4ecd98;if(_0x4500c4>=_0x366443){_0x4500c4=_0x366443;_0x4ecd98=0xc8;}else{_0x4ecd98=0xce;}_0x2172d0[_0x77da('0x18')](_0x4ecd98);return _0x2172d0[_0x77da('0x1a')](_0x77da('0x1b'),_0x1b0e17+'-'+_0x4500c4+'/'+_0x366443)[_0x77da('0x1c')](_0x29cd7b);}return null;};}function patchUpdates(_0x12d2b1){return function(_0x1d325c){try{jsonpatch[_0x77da('0x1d')](_0x1d325c,_0x12d2b1,!![]);}catch(_0x544104){return BPromise['reject'](_0x544104);}return _0x1d325c[_0x77da('0x1e')]();};}function saveUpdates(_0x4d1512,_0x507979){return function(_0x45a122){if(_0x45a122){return _0x45a122[_0x77da('0x1f')](_0x4d1512)[_0x77da('0x20')](function(_0x5ab79a){return _0x5ab79a;});}return null;};}function removeEntity(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x21')]()[_0x77da('0x20')](function(){_0x58270c[_0x77da('0x18')](0xcc)[_0x77da('0x22')]();});}};}function handleEntityNotFound(_0x10399a,_0x270318){return function(_0x95b5db){if(!_0x95b5db){_0x10399a['sendStatus'](0x194);}return _0x95b5db;};}function handleError(_0x4885ec,_0xfd160){_0xfd160=_0xfd160||0x1f4;return function(_0x2d009f){logger[_0x77da('0x23')](_0x2d009f[_0x77da('0x24')]);if(_0x2d009f['name']){delete _0x2d009f[_0x77da('0x25')];}_0x4885ec[_0x77da('0x18')](_0xfd160)[_0x77da('0x26')](_0x2d009f);};}exports[_0x77da('0x27')]=function(_0x446ae7,_0x5997b6){var _0xce24b8={},_0x3e090d={},_0x1f2279={'count':0x0,'rows':[]};var _0x2913f7=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x2258e9){return{'name':_0x2258e9[_0x77da('0x28')],'type':_0x2258e9[_0x77da('0x29')][_0x77da('0x2a')]};});_0x3e090d[_0x77da('0x2b')]=_['map'](_0x2913f7,_0x77da('0x25'));_0x3e090d[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x446ae7[_0x77da('0x2c')]);_0x3e090d[_0x77da('0x2e')]=_[_0x77da('0x2f')](_0x3e090d['model'],_0x3e090d[_0x77da('0x2c')]);_0xce24b8[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x3e090d[_0x77da('0x2b')],qs[_0x77da('0x31')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x31')]));_0xce24b8[_0x77da('0x30')]=_0xce24b8['attributes']['length']?_0xce24b8[_0x77da('0x30')]:_0x3e090d[_0x77da('0x2b')];if(!_0x446ae7['query'][_0x77da('0x32')](_0x77da('0x33'))){_0xce24b8[_0x77da('0x19')]=qs[_0x77da('0x19')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x19')]);_0xce24b8[_0x77da('0x34')]=qs['offset'](_0x446ae7[_0x77da('0x2c')]['offset']);}_0xce24b8['order']=qs['sort'](_0x446ae7[_0x77da('0x2c')]['sort']);_0xce24b8[_0x77da('0x35')]=qs[_0x77da('0x2e')](_[_0x77da('0x36')](_0x446ae7[_0x77da('0x2c')],_0x3e090d[_0x77da('0x2e')]),_0x2913f7);if(_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]){_0xce24b8['where']=_[_0x77da('0x38')](_0xce24b8[_0x77da('0x35')],{'$or':_[_0x77da('0x39')](_0x2913f7,function(_0x32785f){if(_0x32785f[_0x77da('0x29')]!==_0x77da('0x3a')){var _0x48fccc={};_0x48fccc[_0x32785f[_0x77da('0x25')]]={'$like':'%'+_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]+'%'};return _0x48fccc;}})});}_0xce24b8=_['merge']({},_0xce24b8,_0x446ae7[_0x77da('0x3b')]);var _0x505ffb={'where':_0xce24b8['where']};return db['UserProfileResource']['count'](_0x505ffb)[_0x77da('0x20')](function(_0x1adba5){_0x1f2279[_0x77da('0x3c')]=_0x1adba5;if(_0x446ae7['query'][_0x77da('0x3d')]){_0xce24b8['include']=[{'all':!![]}];}return db[_0x77da('0x3e')]['findAll'](_0xce24b8);})[_0x77da('0x20')](function(_0xa19b50){_0x1f2279[_0x77da('0x3f')]=_0xa19b50;return _0x1f2279;})[_0x77da('0x20')](respondWithFilteredResult(_0x5997b6,_0xce24b8))[_0x77da('0x40')](handleError(_0x5997b6,null));};exports['show']=function(_0x759b86,_0x1f48bd){var _0x44717a={'raw':![],'where':{'id':_0x759b86[_0x77da('0x41')]['id']}},_0x2f14f4={};_0x2f14f4[_0x77da('0x2b')]=_['keys'](db[_0x77da('0x3e')][_0x77da('0x42')]);_0x2f14f4[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x759b86[_0x77da('0x2c')]);_0x2f14f4[_0x77da('0x2e')]=_['intersection'](_0x2f14f4[_0x77da('0x2b')],_0x2f14f4['query']);_0x44717a[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x2f14f4[_0x77da('0x2b')],qs['fields'](_0x759b86[_0x77da('0x2c')][_0x77da('0x31')]));_0x44717a[_0x77da('0x30')]=_0x44717a[_0x77da('0x30')][_0x77da('0x43')]?_0x44717a[_0x77da('0x30')]:_0x2f14f4[_0x77da('0x2b')];if(_0x759b86[_0x77da('0x2c')][_0x77da('0x3d')]){_0x44717a['include']=[{'all':!![]}];}_0x44717a=_[_0x77da('0x38')]({},_0x44717a,_0x759b86[_0x77da('0x3b')]);return db[_0x77da('0x3e')][_0x77da('0x44')](_0x44717a)[_0x77da('0x20')](handleEntityNotFound(_0x1f48bd,null))[_0x77da('0x20')](respondWithResult(_0x1f48bd,null))['catch'](handleError(_0x1f48bd,null));};exports['create']=function(_0x240d7b,_0x1597d8){return db[_0x77da('0x3e')][_0x77da('0x45')](_0x240d7b[_0x77da('0x46')],{})[_0x77da('0x20')](respondWithResult(_0x1597d8,0xc9))['catch'](handleError(_0x1597d8,null));};exports[_0x77da('0x1f')]=function(_0x357ee4,_0x332f80){if(_0x357ee4[_0x77da('0x46')]['id']){delete _0x357ee4['body']['id'];}return db[_0x77da('0x3e')]['find']({'where':{'id':_0x357ee4['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x332f80,null))[_0x77da('0x20')](saveUpdates(_0x357ee4[_0x77da('0x46')],null))[_0x77da('0x20')](respondWithResult(_0x332f80,null))['catch'](handleError(_0x332f80,null));};exports[_0x77da('0x21')]=function(_0x1e36ee,_0x56a3d9){return db[_0x77da('0x3e')][_0x77da('0x44')]({'where':{'id':_0x1e36ee['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x56a3d9,null))[_0x77da('0x20')](removeEntity(_0x56a3d9,null))[_0x77da('0x40')](handleError(_0x56a3d9,null));};exports[_0x77da('0x47')]=function(_0xfc13ed,_0x1043c7){return db[_0x77da('0x3e')][_0x77da('0x47')]()[_0x77da('0x20')](respondWithResult(_0x1043c7,null))[_0x77da('0x40')](handleError(_0x1043c7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ebe80c0..81f443c 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 _0x6414=['compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x1f8ac7,_0x4c2312){var _0x33fdc2=function(_0x531a89){while(--_0x531a89){_0x1f8ac7['push'](_0x1f8ac7['shift']());}};_0x33fdc2(++_0x4c2312);}(_0x6414,0xaa));var _0x4641=function(_0x483294,_0x49d0e3){_0x483294=_0x483294-0x0;var _0xf073fc=_0x6414[_0x483294];return _0xf073fc;};'use strict';var _=require(_0x4641('0x0'));var util=require(_0x4641('0x1'));var logger=require(_0x4641('0x2'))(_0x4641('0x3'));var moment=require(_0x4641('0x4'));var BPromise=require(_0x4641('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4641('0x6'));var rimraf=require('rimraf');var config=require(_0x4641('0x7'));var attributes=require(_0x4641('0x8'));module[_0x4641('0x9')]=function(_0x6e99fa,_0x5d94c7){return _0x6e99fa[_0x4641('0xa')]('UserProfileResource',attributes,{'tableName':_0x4641('0xb'),'paranoid':![],'indexes':[{'name':_0x4641('0xc'),'fields':[_0x4641('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f4d=['../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f4d,0xd7));var _0xd9f4=function(_0x1c2e29,_0x3ad48a){_0x1c2e29=_0x1c2e29-0x0;var _0x39174d=_0x9f4d[_0x1c2e29];return _0x39174d;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd9f4('0x3'));var rp=require(_0xd9f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9f4('0x5'));var config=require(_0xd9f4('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xd9f4('0x7')]=function(_0x3c9268,_0x18e190){return _0x3c9268[_0xd9f4('0x8')](_0xd9f4('0x9'),attributes,{'tableName':_0xd9f4('0xa'),'paranoid':![],'indexes':[{'name':_0xd9f4('0xb'),'fields':[_0xd9f4('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7cfa32d..d29fb92 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 _0xbe88=['moment','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x331a2c,_0xc59b3e){var _0x508e83=function(_0x5e8d02){while(--_0x5e8d02){_0x331a2c['push'](_0x331a2c['shift']());}};_0x508e83(++_0xc59b3e);}(_0xbe88,0x12e));var _0x8be8=function(_0x1653b1,_0x35b7d1){_0x1653b1=_0x1653b1-0x0;var _0x3e0b17=_0xbe88[_0x1653b1];return _0x3e0b17;};'use strict';var _=require(_0x8be8('0x0'));var util=require(_0x8be8('0x1'));var moment=require(_0x8be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8be8('0x3'));var fs=require('fs');var Redis=require(_0x8be8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8be8('0x5'))(_0x8be8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8be8('0x7')][_0x8be8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x193368,_0x1a91a1,_0x272a3f){return new BPromise(function(_0x469d5d,_0x267a24){return client['request'](_0x193368,_0x272a3f)[_0x8be8('0x9')](function(_0xd862bc){logger[_0x8be8('0xa')](_0x8be8('0xb'),_0x1a91a1,_0x8be8('0xc'));logger['debug'](_0x8be8('0xd'),_0x1a91a1,_0x8be8('0xc'),JSON[_0x8be8('0xe')](_0xd862bc));if(_0xd862bc['error']){if(_0xd862bc[_0x8be8('0xf')][_0x8be8('0x10')]===0x1f4){logger[_0x8be8('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1a91a1,_0xd862bc[_0x8be8('0xf')][_0x8be8('0x11')]);return _0x267a24(_0xd862bc['error'][_0x8be8('0x11')]);}logger['error'](_0x8be8('0xb'),_0x1a91a1,_0xd862bc[_0x8be8('0xf')]['message']);return _0x469d5d(_0xd862bc[_0x8be8('0xf')][_0x8be8('0x11')]);}else{logger[_0x8be8('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x1a91a1,_0x8be8('0xc'));_0x469d5d(_0xd862bc[_0x8be8('0x12')][_0x8be8('0x11')]);}})['catch'](function(_0x15718b){logger[_0x8be8('0xf')](_0x8be8('0xb'),_0x1a91a1,_0x15718b);_0x267a24(_0x15718b);});});} \ No newline at end of file +var _0x8885=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x8885,0x156));var _0x5888=function(_0x236002,_0x49115f){_0x236002=_0x236002-0x0;var _0x11bb9f=_0x8885[_0x236002];return _0x11bb9f;};'use strict';var _=require(_0x5888('0x0'));var util=require(_0x5888('0x1'));var moment=require(_0x5888('0x2'));var BPromise=require(_0x5888('0x3'));var rs=require(_0x5888('0x4'));var fs=require('fs');var Redis=require(_0x5888('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5888('0x6'));var logger=require(_0x5888('0x7'))(_0x5888('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5888('0x9')][_0x5888('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481389,_0x2967b9,_0xce9393){return new BPromise(function(_0x174701,_0x65bdb6){return client['request'](_0x481389,_0xce9393)[_0x5888('0xb')](function(_0x485e1){logger['info'](_0x5888('0xc'),_0x2967b9,'request\x20sent');logger['debug'](_0x5888('0xd'),_0x2967b9,'request\x20sent',JSON['stringify'](_0x485e1));if(_0x485e1[_0x5888('0xe')]){if(_0x485e1[_0x5888('0xe')][_0x5888('0xf')]===0x1f4){logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x485e1[_0x5888('0xe')]['message']);return _0x65bdb6(_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);}logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);return _0x174701(_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);}else{logger[_0x5888('0x11')](_0x5888('0xc'),_0x2967b9,'request\x20sent');_0x174701(_0x485e1['result'][_0x5888('0x10')]);}})['catch'](function(_0x2033da){logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x2033da);_0x65bdb6(_0x2033da);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6b27baf..6de8d54 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 _0x5144=['connect-timeout','express','Router','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','/:id','destroy','util','path'];(function(_0x288999,_0x3c2aef){var _0xa1e447=function(_0x3ae83c){while(--_0x3ae83c){_0x288999['push'](_0x288999['shift']());}};_0xa1e447(++_0x3c2aef);}(_0x5144,0xe2));var _0x4514=function(_0x45af13,_0x13fb83){_0x45af13=_0x45af13-0x0;var _0x29a59f=_0x5144[_0x45af13];return _0x29a59f;};'use strict';var multer=require('multer');var util=require(_0x4514('0x0'));var path=require(_0x4514('0x1'));var timeout=require(_0x4514('0x2'));var express=require(_0x4514('0x3'));var router=express[_0x4514('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4514('0x5'));var config=require('../../config/environment');var controller=require(_0x4514('0x6'));router[_0x4514('0x7')]('/',auth[_0x4514('0x8')](),controller['index']);router[_0x4514('0x7')](_0x4514('0x9'),auth[_0x4514('0x8')](),controller[_0x4514('0xa')]);router[_0x4514('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4514('0xb')]);router[_0x4514('0xc')]('/',auth[_0x4514('0x8')](),controller[_0x4514('0xd')]);router[_0x4514('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4514('0xf')]);router[_0x4514('0x10')](_0x4514('0x11'),auth[_0x4514('0x8')](),controller[_0x4514('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbab0=['/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x24870e,_0x1977ea){var _0x68bdf7=function(_0x5ceddb){while(--_0x5ceddb){_0x24870e['push'](_0x24870e['shift']());}};_0x68bdf7(++_0x1977ea);}(_0xbab0,0x183));var _0x0bab=function(_0x1e36dc,_0x33fab9){_0x1e36dc=_0x1e36dc-0x0;var _0x3f25d0=_0xbab0[_0x1e36dc];return _0x3f25d0;};'use strict';var multer=require(_0x0bab('0x0'));var util=require(_0x0bab('0x1'));var path=require(_0x0bab('0x2'));var timeout=require(_0x0bab('0x3'));var express=require('express');var router=express[_0x0bab('0x4')]();var auth=require(_0x0bab('0x5'));var interaction=require(_0x0bab('0x6'));var config=require(_0x0bab('0x7'));var controller=require(_0x0bab('0x8'));router[_0x0bab('0x9')]('/',auth[_0x0bab('0xa')](),controller[_0x0bab('0xb')]);router[_0x0bab('0x9')](_0x0bab('0xc'),auth['isAuthenticated'](),controller[_0x0bab('0xd')]);router[_0x0bab('0x9')]('/:id',auth[_0x0bab('0xa')](),controller[_0x0bab('0xe')]);router[_0x0bab('0xf')]('/',auth[_0x0bab('0xa')](),controller[_0x0bab('0x10')]);router['put'](_0x0bab('0x11'),auth[_0x0bab('0xa')](),controller[_0x0bab('0x12')]);router[_0x0bab('0x13')]('/:id',auth[_0x0bab('0xa')](),controller[_0x0bab('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8f8512e..e415c36 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 _0x2123=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5dd957,_0x5c5c19){var _0x1ec165=function(_0x1ce6a4){while(--_0x1ce6a4){_0x5dd957['push'](_0x5dd957['shift']());}};_0x1ec165(++_0x5c5c19);}(_0x2123,0x190));var _0x3212=function(_0x27c5e1,_0x46afc4){_0x27c5e1=_0x27c5e1-0x0;var _0x380050=_0x2123[_0x27c5e1];return _0x380050;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'name':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3212('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3212('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3212('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3212('0x2')],'set':function(_0x304f80){this[_0x3212('0x5')](_0x3212('0x6'),_0x304f80?_0x304f80[_0x3212('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x3212('0x6'))?this[_0x3212('0x8')](_0x3212('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x20a2=['STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','sequelize'];(function(_0x49c341,_0x5b9570){var _0x1c106d=function(_0x535c3f){while(--_0x535c3f){_0x49c341['push'](_0x49c341['shift']());}};_0x1c106d(++_0x5b9570);}(_0x20a2,0x102));var _0x220a=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x20a2[_0x25efdf];return _0x22c495;};'use strict';var Sequelize=require(_0x220a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x220a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x220a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x220a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x220a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x220a('0x1')],'set':function(_0x3d9745){this['setDataValue'](_0x220a('0x4'),_0x3d9745?_0x3d9745[_0x220a('0x5')](''):[]);},'get':function(){return this[_0x220a('0x6')](_0x220a('0x4'))?this[_0x220a('0x6')](_0x220a('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6af2784..067327a 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 _0xd7ae=['error','stack','name','send','index','map','UserProfileSection','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4a4d71,_0x1d4d72){var _0x2f1f18=function(_0x50796d){while(--_0x50796d){_0x4a4d71['push'](_0x4a4d71['shift']());}};_0x2f1f18(++_0x1d4d72);}(_0xd7ae,0x156));var _0xed7a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd7ae[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0xed7a('0x0'));var emlformat=require(_0xed7a('0x1'));var rimraf=require(_0xed7a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed7a('0x3'));var moment=require(_0xed7a('0x4'));var BPromise=require(_0xed7a('0x5'));var Mustache=require(_0xed7a('0x6'));var util=require(_0xed7a('0x7'));var path=require(_0xed7a('0x8'));var sox=require(_0xed7a('0x9'));var csv=require(_0xed7a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xed7a('0xb'));var squel=require(_0xed7a('0xc'));var crypto=require(_0xed7a('0xd'));var jsforce=require(_0xed7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed7a('0xa'));var querystring=require(_0xed7a('0xf'));var Papa=require('papaparse');var Redis=require(_0xed7a('0x10'));var authService=require(_0xed7a('0x11'));var qs=require(_0xed7a('0x12'));var as=require(_0xed7a('0x13'));var hardwareService=require(_0xed7a('0x14'));var logger=require(_0xed7a('0x15'))(_0xed7a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed7a('0x17'))['db'];function respondWithStatusCode(_0x2bc892,_0xcba736){_0xcba736=_0xcba736||0xcc;return function(_0x408287){if(_0x408287){return _0x2bc892[_0xed7a('0x18')](_0xcba736);}return _0x2bc892[_0xed7a('0x19')](_0xcba736)[_0xed7a('0x1a')]();};}function respondWithResult(_0x5b9c5d,_0xb83f3b){_0xb83f3b=_0xb83f3b||0xc8;return function(_0x2c049e){if(_0x2c049e){return _0x5b9c5d[_0xed7a('0x19')](_0xb83f3b)['json'](_0x2c049e);}};}function respondWithFilteredResult(_0x3ae4a0,_0x438223){return function(_0x2c73eb){if(_0x2c73eb){var _0xfb8478=_0x2c73eb[_0xed7a('0x1b')],_0x4e9b75=_0x438223[_0xed7a('0x1c')],_0x561a67=_0x438223['offset']+_0x438223[_0xed7a('0x1d')],_0x18e92f;if(_0x561a67>=_0xfb8478){_0x561a67=_0xfb8478;_0x18e92f=0xc8;}else{_0x18e92f=0xce;}_0x3ae4a0[_0xed7a('0x19')](_0x18e92f);return _0x3ae4a0[_0xed7a('0x1e')](_0xed7a('0x1f'),_0x4e9b75+'-'+_0x561a67+'/'+_0xfb8478)['json'](_0x2c73eb);}return null;};}function patchUpdates(_0x372324){return function(_0x5474b9){try{jsonpatch[_0xed7a('0x20')](_0x5474b9,_0x372324,!![]);}catch(_0x2315e5){return BPromise[_0xed7a('0x21')](_0x2315e5);}return _0x5474b9[_0xed7a('0x22')]();};}function saveUpdates(_0x1c31fa,_0x159424){return function(_0x5aa03b){if(_0x5aa03b){return _0x5aa03b[_0xed7a('0x23')](_0x1c31fa)[_0xed7a('0x24')](function(_0x1688c9){return _0x1688c9;});}return null;};}function removeEntity(_0x1d9287,_0x2644fa){return function(_0x44841a){if(_0x44841a){return _0x44841a[_0xed7a('0x25')]()[_0xed7a('0x24')](function(){_0x1d9287['status'](0xcc)[_0xed7a('0x1a')]();});}};}function handleEntityNotFound(_0x5d24c7,_0xe2acf8){return function(_0x4999c0){if(!_0x4999c0){_0x5d24c7[_0xed7a('0x18')](0x194);}return _0x4999c0;};}function handleError(_0x51b097,_0x313227){_0x313227=_0x313227||0x1f4;return function(_0x3f4845){logger[_0xed7a('0x26')](_0x3f4845[_0xed7a('0x27')]);if(_0x3f4845[_0xed7a('0x28')]){delete _0x3f4845['name'];}_0x51b097[_0xed7a('0x19')](_0x313227)[_0xed7a('0x29')](_0x3f4845);};}exports[_0xed7a('0x2a')]=function(_0x20c84b,_0xb35dd9){var _0x40de3f={},_0x241bfc={},_0x2ecc6d={'count':0x0,'rows':[]};var _0x1542fb=_[_0xed7a('0x2b')](db[_0xed7a('0x2c')]['rawAttributes'],function(_0x2a2097){return{'name':_0x2a2097[_0xed7a('0x2d')],'type':_0x2a2097['type'][_0xed7a('0x2e')]};});_0x241bfc[_0xed7a('0x2f')]=_[_0xed7a('0x2b')](_0x1542fb,'name');_0x241bfc[_0xed7a('0x30')]=_[_0xed7a('0x31')](_0x20c84b[_0xed7a('0x30')]);_0x241bfc[_0xed7a('0x32')]=_[_0xed7a('0x33')](_0x241bfc[_0xed7a('0x2f')],_0x241bfc[_0xed7a('0x30')]);_0x40de3f[_0xed7a('0x34')]=_['intersection'](_0x241bfc[_0xed7a('0x2f')],qs[_0xed7a('0x35')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x35')]));_0x40de3f[_0xed7a('0x34')]=_0x40de3f['attributes'][_0xed7a('0x36')]?_0x40de3f[_0xed7a('0x34')]:_0x241bfc[_0xed7a('0x2f')];if(!_0x20c84b[_0xed7a('0x30')][_0xed7a('0x37')](_0xed7a('0x38'))){_0x40de3f[_0xed7a('0x1d')]=qs[_0xed7a('0x1d')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x1d')]);_0x40de3f['offset']=qs['offset'](_0x20c84b['query'][_0xed7a('0x1c')]);}_0x40de3f['order']=qs[_0xed7a('0x39')](_0x20c84b[_0xed7a('0x30')][_0xed7a('0x39')]);_0x40de3f[_0xed7a('0x3a')]=qs[_0xed7a('0x32')](_[_0xed7a('0x3b')](_0x20c84b[_0xed7a('0x30')],_0x241bfc[_0xed7a('0x32')]),_0x1542fb);if(_0x20c84b[_0xed7a('0x30')][_0xed7a('0x3c')]){_0x40de3f[_0xed7a('0x3a')]=_[_0xed7a('0x3d')](_0x40de3f['where'],{'$or':_[_0xed7a('0x2b')](_0x1542fb,function(_0x316080){if(_0x316080[_0xed7a('0x3e')]!==_0xed7a('0x3f')){var _0x12f86b={};_0x12f86b[_0x316080[_0xed7a('0x28')]]={'$like':'%'+_0x20c84b[_0xed7a('0x30')][_0xed7a('0x3c')]+'%'};return _0x12f86b;}})});}_0x40de3f=_[_0xed7a('0x3d')]({},_0x40de3f,_0x20c84b[_0xed7a('0x40')]);var _0xf3243b={'where':_0x40de3f['where']};return db[_0xed7a('0x2c')]['count'](_0xf3243b)[_0xed7a('0x24')](function(_0x24d6da){_0x2ecc6d[_0xed7a('0x1b')]=_0x24d6da;if(_0x20c84b[_0xed7a('0x30')][_0xed7a('0x41')]){_0x40de3f[_0xed7a('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0xed7a('0x43')](_0x40de3f);})[_0xed7a('0x24')](function(_0x439ad1){_0x2ecc6d['rows']=_0x439ad1;return _0x2ecc6d;})[_0xed7a('0x24')](respondWithFilteredResult(_0xb35dd9,_0x40de3f))[_0xed7a('0x44')](handleError(_0xb35dd9,null));};exports[_0xed7a('0x45')]=function(_0x46550c,_0x272928){var _0x1eef1d={'raw':![],'where':{'id':_0x46550c['params']['id']}},_0x543e96={};_0x543e96[_0xed7a('0x2f')]=_[_0xed7a('0x31')](db[_0xed7a('0x2c')][_0xed7a('0x46')]);_0x543e96[_0xed7a('0x30')]=_[_0xed7a('0x31')](_0x46550c['query']);_0x543e96['filters']=_[_0xed7a('0x33')](_0x543e96[_0xed7a('0x2f')],_0x543e96[_0xed7a('0x30')]);_0x1eef1d[_0xed7a('0x34')]=_[_0xed7a('0x33')](_0x543e96['model'],qs['fields'](_0x46550c[_0xed7a('0x30')][_0xed7a('0x35')]));_0x1eef1d[_0xed7a('0x34')]=_0x1eef1d[_0xed7a('0x34')][_0xed7a('0x36')]?_0x1eef1d[_0xed7a('0x34')]:_0x543e96[_0xed7a('0x2f')];if(_0x46550c[_0xed7a('0x30')]['includeAll']){_0x1eef1d[_0xed7a('0x42')]=[{'all':!![]}];}_0x1eef1d=_[_0xed7a('0x3d')]({},_0x1eef1d,_0x46550c[_0xed7a('0x40')]);return db[_0xed7a('0x2c')]['find'](_0x1eef1d)['then'](handleEntityNotFound(_0x272928,null))[_0xed7a('0x24')](respondWithResult(_0x272928,null))[_0xed7a('0x44')](handleError(_0x272928,null));};exports[_0xed7a('0x47')]=function(_0x4ec623,_0x5a694a){return db[_0xed7a('0x2c')]['create'](_0x4ec623['body'],{})[_0xed7a('0x24')](respondWithResult(_0x5a694a,0xc9))[_0xed7a('0x44')](handleError(_0x5a694a,null));};exports[_0xed7a('0x23')]=function(_0x1445b1,_0x2c8b16){if(_0x1445b1[_0xed7a('0x48')]['id']){delete _0x1445b1[_0xed7a('0x48')]['id'];}return db[_0xed7a('0x2c')][_0xed7a('0x49')]({'where':{'id':_0x1445b1['params']['id']}})[_0xed7a('0x24')](handleEntityNotFound(_0x2c8b16,null))[_0xed7a('0x24')](saveUpdates(_0x1445b1[_0xed7a('0x48')],null))[_0xed7a('0x24')](respondWithResult(_0x2c8b16,null))[_0xed7a('0x44')](handleError(_0x2c8b16,null));};exports['destroy']=function(_0x40a576,_0x37707e){return db['UserProfileSection'][_0xed7a('0x49')]({'where':{'id':_0x40a576[_0xed7a('0x4a')]['id']}})[_0xed7a('0x24')](handleEntityNotFound(_0x37707e,null))['then'](removeEntity(_0x37707e,null))[_0xed7a('0x44')](handleError(_0x37707e,null));};exports['describe']=function(_0x1f534c,_0x1a0100){return db[_0xed7a('0x2c')][_0xed7a('0x4b')]()[_0xed7a('0x24')](respondWithResult(_0x1a0100,null))[_0xed7a('0x44')](handleError(_0x1a0100,null));}; \ No newline at end of file +var _0x57c6=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length'];(function(_0x45d96e,_0x33a73a){var _0x5d2ddd=function(_0x4fa2a2){while(--_0x4fa2a2){_0x45d96e['push'](_0x45d96e['shift']());}};_0x5d2ddd(++_0x33a73a);}(_0x57c6,0x17f));var _0x657c=function(_0x261602,_0x4d3f4c){_0x261602=_0x261602-0x0;var _0x3cd0d7=_0x57c6[_0x261602];return _0x3cd0d7;};'use strict';var pdf=require(_0x657c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x657c('0x1'));var zipdir=require(_0x657c('0x2'));var jsonpatch=require(_0x657c('0x3'));var rp=require('request-promise');var moment=require(_0x657c('0x4'));var BPromise=require(_0x657c('0x5'));var Mustache=require(_0x657c('0x6'));var util=require('util');var path=require(_0x657c('0x7'));var sox=require(_0x657c('0x8'));var csv=require(_0x657c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x657c('0xa'));var squel=require(_0x657c('0xb'));var crypto=require(_0x657c('0xc'));var jsforce=require(_0x657c('0xd'));var deskjs=require(_0x657c('0xe'));var toCsv=require(_0x657c('0x9'));var querystring=require(_0x657c('0xf'));var Papa=require(_0x657c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x657c('0x11'));var as=require(_0x657c('0x12'));var hardwareService=require(_0x657c('0x13'));var logger=require(_0x657c('0x14'))(_0x657c('0x15'));var utils=require(_0x657c('0x16'));var config=require(_0x657c('0x17'));var licenseUtil=require(_0x657c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38ffb2,_0x4b402f){_0x4b402f=_0x4b402f||0xcc;return function(_0x1f8993){if(_0x1f8993){return _0x38ffb2[_0x657c('0x19')](_0x4b402f);}return _0x38ffb2['status'](_0x4b402f)[_0x657c('0x1a')]();};}function respondWithResult(_0x48ab69,_0x53ccc9){_0x53ccc9=_0x53ccc9||0xc8;return function(_0x2f823f){if(_0x2f823f){return _0x48ab69[_0x657c('0x1b')](_0x53ccc9)[_0x657c('0x1c')](_0x2f823f);}};}function respondWithFilteredResult(_0x2ec6cb,_0x1ad348){return function(_0xd6f2fd){if(_0xd6f2fd){var _0x3c86bb=_0xd6f2fd['count'],_0x35a88f=_0x1ad348['offset'],_0x5696fb=_0x1ad348[_0x657c('0x1d')]+_0x1ad348[_0x657c('0x1e')],_0xf2a209;if(_0x5696fb>=_0x3c86bb){_0x5696fb=_0x3c86bb;_0xf2a209=0xc8;}else{_0xf2a209=0xce;}_0x2ec6cb[_0x657c('0x1b')](_0xf2a209);return _0x2ec6cb['set']('Content-Range',_0x35a88f+'-'+_0x5696fb+'/'+_0x3c86bb)[_0x657c('0x1c')](_0xd6f2fd);}return null;};}function patchUpdates(_0x212af7){return function(_0x140d1d){try{jsonpatch[_0x657c('0x1f')](_0x140d1d,_0x212af7,!![]);}catch(_0x3b3585){return BPromise[_0x657c('0x20')](_0x3b3585);}return _0x140d1d[_0x657c('0x21')]();};}function saveUpdates(_0x5461a9,_0x2b0637){return function(_0x5127f4){if(_0x5127f4){return _0x5127f4[_0x657c('0x22')](_0x5461a9)[_0x657c('0x23')](function(_0x578cf3){return _0x578cf3;});}return null;};}function removeEntity(_0x17d138,_0x504209){return function(_0x3aeeba){if(_0x3aeeba){return _0x3aeeba[_0x657c('0x24')]()[_0x657c('0x23')](function(){_0x17d138[_0x657c('0x1b')](0xcc)[_0x657c('0x1a')]();});}};}function handleEntityNotFound(_0x155706,_0x2b421a){return function(_0x3e8f39){if(!_0x3e8f39){_0x155706['sendStatus'](0x194);}return _0x3e8f39;};}function handleError(_0x38d8f5,_0x453e06){_0x453e06=_0x453e06||0x1f4;return function(_0x3042af){logger[_0x657c('0x25')](_0x3042af[_0x657c('0x26')]);if(_0x3042af[_0x657c('0x27')]){delete _0x3042af[_0x657c('0x27')];}_0x38d8f5[_0x657c('0x1b')](_0x453e06)[_0x657c('0x28')](_0x3042af);};}exports[_0x657c('0x29')]=function(_0x3f4de7,_0x8bd943){var _0x1ae0c5={},_0x4bff16={},_0x4aef7e={'count':0x0,'rows':[]};var _0x471b1d=_[_0x657c('0x2a')](db[_0x657c('0x2b')][_0x657c('0x2c')],function(_0x37da5d){return{'name':_0x37da5d[_0x657c('0x2d')],'type':_0x37da5d[_0x657c('0x2e')][_0x657c('0x2f')]};});_0x4bff16[_0x657c('0x30')]=_[_0x657c('0x2a')](_0x471b1d,_0x657c('0x27'));_0x4bff16['query']=_[_0x657c('0x31')](_0x3f4de7['query']);_0x4bff16['filters']=_[_0x657c('0x32')](_0x4bff16[_0x657c('0x30')],_0x4bff16[_0x657c('0x33')]);_0x1ae0c5['attributes']=_[_0x657c('0x32')](_0x4bff16[_0x657c('0x30')],qs[_0x657c('0x34')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x34')]));_0x1ae0c5[_0x657c('0x35')]=_0x1ae0c5[_0x657c('0x35')][_0x657c('0x36')]?_0x1ae0c5[_0x657c('0x35')]:_0x4bff16[_0x657c('0x30')];if(!_0x3f4de7[_0x657c('0x33')]['hasOwnProperty'](_0x657c('0x37'))){_0x1ae0c5[_0x657c('0x1e')]=qs[_0x657c('0x1e')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x1e')]);_0x1ae0c5[_0x657c('0x1d')]=qs[_0x657c('0x1d')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x1d')]);}_0x1ae0c5[_0x657c('0x38')]=qs[_0x657c('0x39')](_0x3f4de7[_0x657c('0x33')]['sort']);_0x1ae0c5[_0x657c('0x3a')]=qs[_0x657c('0x3b')](_[_0x657c('0x3c')](_0x3f4de7[_0x657c('0x33')],_0x4bff16[_0x657c('0x3b')]),_0x471b1d);if(_0x3f4de7[_0x657c('0x33')][_0x657c('0x3d')]){_0x1ae0c5[_0x657c('0x3a')]=_[_0x657c('0x3e')](_0x1ae0c5['where'],{'$or':_[_0x657c('0x2a')](_0x471b1d,function(_0x1c9bc6){if(_0x1c9bc6[_0x657c('0x2e')]!==_0x657c('0x3f')){var _0x93d93f={};_0x93d93f[_0x1c9bc6[_0x657c('0x27')]]={'$like':'%'+_0x3f4de7['query']['filter']+'%'};return _0x93d93f;}})});}_0x1ae0c5=_['merge']({},_0x1ae0c5,_0x3f4de7[_0x657c('0x40')]);var _0x2f1e95={'where':_0x1ae0c5[_0x657c('0x3a')]};return db[_0x657c('0x2b')]['count'](_0x2f1e95)['then'](function(_0x18219b){_0x4aef7e['count']=_0x18219b;if(_0x3f4de7[_0x657c('0x33')][_0x657c('0x41')]){_0x1ae0c5[_0x657c('0x42')]=[{'all':!![]}];}return db[_0x657c('0x2b')]['findAll'](_0x1ae0c5);})[_0x657c('0x23')](function(_0x2a2000){_0x4aef7e[_0x657c('0x43')]=_0x2a2000;return _0x4aef7e;})['then'](respondWithFilteredResult(_0x8bd943,_0x1ae0c5))[_0x657c('0x44')](handleError(_0x8bd943,null));};exports[_0x657c('0x45')]=function(_0x56cc3e,_0x5ca966){var _0x26e19c={'raw':![],'where':{'id':_0x56cc3e[_0x657c('0x46')]['id']}},_0x55fb00={};_0x55fb00[_0x657c('0x30')]=_[_0x657c('0x31')](db[_0x657c('0x2b')][_0x657c('0x2c')]);_0x55fb00[_0x657c('0x33')]=_[_0x657c('0x31')](_0x56cc3e['query']);_0x55fb00[_0x657c('0x3b')]=_[_0x657c('0x32')](_0x55fb00[_0x657c('0x30')],_0x55fb00[_0x657c('0x33')]);_0x26e19c[_0x657c('0x35')]=_[_0x657c('0x32')](_0x55fb00[_0x657c('0x30')],qs['fields'](_0x56cc3e['query'][_0x657c('0x34')]));_0x26e19c[_0x657c('0x35')]=_0x26e19c[_0x657c('0x35')][_0x657c('0x36')]?_0x26e19c[_0x657c('0x35')]:_0x55fb00[_0x657c('0x30')];if(_0x56cc3e[_0x657c('0x33')][_0x657c('0x41')]){_0x26e19c['include']=[{'all':!![]}];}_0x26e19c=_[_0x657c('0x3e')]({},_0x26e19c,_0x56cc3e[_0x657c('0x40')]);return db[_0x657c('0x2b')]['find'](_0x26e19c)['then'](handleEntityNotFound(_0x5ca966,null))['then'](respondWithResult(_0x5ca966,null))['catch'](handleError(_0x5ca966,null));};exports['create']=function(_0xdf2a93,_0x1026b3){return db[_0x657c('0x2b')]['create'](_0xdf2a93['body'],{})[_0x657c('0x23')](respondWithResult(_0x1026b3,0xc9))[_0x657c('0x44')](handleError(_0x1026b3,null));};exports[_0x657c('0x22')]=function(_0xb2ccb5,_0x38ea90){if(_0xb2ccb5['body']['id']){delete _0xb2ccb5[_0x657c('0x47')]['id'];}return db['UserProfileSection'][_0x657c('0x48')]({'where':{'id':_0xb2ccb5[_0x657c('0x46')]['id']}})[_0x657c('0x23')](handleEntityNotFound(_0x38ea90,null))[_0x657c('0x23')](saveUpdates(_0xb2ccb5[_0x657c('0x47')],null))[_0x657c('0x23')](respondWithResult(_0x38ea90,null))[_0x657c('0x44')](handleError(_0x38ea90,null));};exports['destroy']=function(_0x235a7f,_0x299fb1){return db[_0x657c('0x2b')]['find']({'where':{'id':_0x235a7f[_0x657c('0x46')]['id']}})[_0x657c('0x23')](handleEntityNotFound(_0x299fb1,null))[_0x657c('0x23')](removeEntity(_0x299fb1,null))[_0x657c('0x44')](handleError(_0x299fb1,null));};exports['describe']=function(_0x592f8a,_0x3edb16){return db[_0x657c('0x2b')]['describe']()[_0x657c('0x23')](respondWithResult(_0x3edb16,null))['catch'](handleError(_0x3edb16,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6d5a43e..30433ae 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 _0x2cc0=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./userProfileSection.attributes','define'];(function(_0x23e57f,_0x5a2bae){var _0x322481=function(_0x4a2211){while(--_0x4a2211){_0x23e57f['push'](_0x23e57f['shift']());}};_0x322481(++_0x5a2bae);}(_0x2cc0,0xc3));var _0x02cc=function(_0x8b4581,_0x3189d6){_0x8b4581=_0x8b4581-0x0;var _0x3f2da7=_0x2cc0[_0x8b4581];return _0x3f2da7;};'use strict';var _=require(_0x02cc('0x0'));var util=require(_0x02cc('0x1'));var logger=require(_0x02cc('0x2'))(_0x02cc('0x3'));var moment=require(_0x02cc('0x4'));var BPromise=require(_0x02cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x02cc('0x6'));var attributes=require(_0x02cc('0x7'));module['exports']=function(_0x416d49,_0x2d22d3){return _0x416d49[_0x02cc('0x8')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x02cc('0x9'),'fields':[_0x02cc('0xa'),_0x02cc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdab3=['request-promise','rimraf','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','api'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0xdab3,0x97));var _0x3dab=function(_0x1fa896,_0x19dca0){_0x1fa896=_0x1fa896-0x0;var _0x2f856c=_0xdab3[_0x1fa896];return _0x2f856c;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')(_0x3dab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dab('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x3dab('0x5')]=function(_0x1ab4b1,_0x1c00a4){return _0x1ab4b1[_0x3dab('0x6')](_0x3dab('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x3dab('0x8'),'fields':[_0x3dab('0x9'),_0x3dab('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 6e60410..25f8879 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 _0x76fd=['../../config/logger','../../config/environment','jayson/promise','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x76fd,0x9b));var _0xd76f=function(_0xdc5a08,_0x4eab21){_0xdc5a08=_0xdc5a08-0x0;var _0x3f6e2e=_0x76fd[_0xdc5a08];return _0x3f6e2e;};'use strict';var _=require(_0xd76f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd76f('0x1'));var fs=require('fs');var Redis=require(_0xd76f('0x2'));var db=require(_0xd76f('0x3'))['db'];var utils=require(_0xd76f('0x4'));var logger=require(_0xd76f('0x5'))('rpc');var config=require(_0xd76f('0x6'));var jayson=require(_0xd76f('0x7'));var client=jayson[_0xd76f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24222e,_0x4f90f0,_0x4e6ea0){return new BPromise(function(_0x513775,_0x97707a){return client['request'](_0x24222e,_0x4e6ea0)[_0xd76f('0x9')](function(_0x103131){logger[_0xd76f('0xa')](_0xd76f('0xb'),_0x4f90f0,_0xd76f('0xc'));logger[_0xd76f('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4f90f0,_0xd76f('0xc'),JSON[_0xd76f('0xe')](_0x103131));if(_0x103131[_0xd76f('0xf')]){if(_0x103131[_0xd76f('0xf')][_0xd76f('0x10')]===0x1f4){logger[_0xd76f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x4f90f0,_0x103131['error']['message']);return _0x97707a(_0x103131['error'][_0xd76f('0x11')]);}logger['error'](_0xd76f('0xb'),_0x4f90f0,_0x103131[_0xd76f('0xf')][_0xd76f('0x11')]);return _0x513775(_0x103131[_0xd76f('0xf')][_0xd76f('0x11')]);}else{logger[_0xd76f('0xa')](_0xd76f('0xb'),_0x4f90f0,'request\x20sent');_0x513775(_0x103131[_0xd76f('0x12')][_0xd76f('0x11')]);}})[_0xd76f('0x13')](function(_0x41c806){logger[_0xd76f('0xf')](_0xd76f('0xb'),_0x4f90f0,_0x41c806);_0x97707a(_0x41c806);});});} \ No newline at end of file +var _0x28fd=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x92bfee,_0x432620){var _0x49cca2=function(_0x8336a4){while(--_0x8336a4){_0x92bfee['push'](_0x92bfee['shift']());}};_0x49cca2(++_0x432620);}(_0x28fd,0x135));var _0xd28f=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x28fd[_0x24fa1a];return _0xc5621f;};'use strict';var _=require(_0xd28f('0x0'));var util=require(_0xd28f('0x1'));var moment=require(_0xd28f('0x2'));var BPromise=require(_0xd28f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd28f('0x4'));var db=require(_0xd28f('0x5'))['db'];var utils=require(_0xd28f('0x6'));var logger=require(_0xd28f('0x7'))(_0xd28f('0x8'));var config=require(_0xd28f('0x9'));var jayson=require(_0xd28f('0xa'));var client=jayson[_0xd28f('0xb')][_0xd28f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58c5f8,_0x2eda16,_0x28acdf){return new BPromise(function(_0x1ffa2c,_0x307a2e){return client[_0xd28f('0xd')](_0x58c5f8,_0x28acdf)[_0xd28f('0xe')](function(_0x46c5cc){logger[_0xd28f('0xf')](_0xd28f('0x10'),_0x2eda16,_0xd28f('0x11'));logger['debug'](_0xd28f('0x12'),_0x2eda16,_0xd28f('0x11'),JSON[_0xd28f('0x13')](_0x46c5cc));if(_0x46c5cc[_0xd28f('0x14')]){if(_0x46c5cc[_0xd28f('0x14')]['code']===0x1f4){logger['error'](_0xd28f('0x10'),_0x2eda16,_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);return _0x307a2e(_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);}logger[_0xd28f('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x2eda16,_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);return _0x1ffa2c(_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);}else{logger[_0xd28f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2eda16,_0xd28f('0x11'));_0x1ffa2c(_0x46c5cc[_0xd28f('0x16')][_0xd28f('0x15')]);}})[_0xd28f('0x17')](function(_0x594e7a){logger['error'](_0xd28f('0x10'),_0x2eda16,_0x594e7a);_0x307a2e(_0x594e7a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 268ef92..92a6eee 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 _0x53ca=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x53ca,0x1a0));var _0xa53c=function(_0xd26500,_0xfa64ae){_0xd26500=_0xd26500-0x0;var _0x16cdba=_0x53ca[_0xd26500];return _0x16cdba;};'use strict';var multer=require(_0xa53c('0x0'));var util=require('util');var path=require(_0xa53c('0x1'));var timeout=require(_0xa53c('0x2'));var express=require('express');var router=express[_0xa53c('0x3')]();var auth=require(_0xa53c('0x4'));var interaction=require(_0xa53c('0x5'));var config=require(_0xa53c('0x6'));module[_0xa53c('0x7')]=router; \ No newline at end of file +var _0x9a50=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x9a50,0xe4));var _0x09a5=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0x9a50[_0x36e0e9];return _0x4591f5;};'use strict';var multer=require(_0x09a5('0x0'));var util=require(_0x09a5('0x1'));var path=require(_0x09a5('0x2'));var timeout=require(_0x09a5('0x3'));var express=require(_0x09a5('0x4'));var router=express[_0x09a5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x09a5('0x6'));var config=require(_0x09a5('0x7'));module[_0x09a5('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2e23775..6261860 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x436dba,_0x3ed17f){var _0x4a3de6=function(_0x41f56b){while(--_0x41f56b){_0x436dba['push'](_0x436dba['shift']());}};_0x4a3de6(++_0x3ed17f);}(_0xe706,0xa3));var _0x6e70=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xe706[_0x1903aa];return _0x51fe28;};'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 c25fa23..dc4109f 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 _0x85b1=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x505168,_0x3dc03d){var _0x366c93=function(_0x1d063f){while(--_0x1d063f){_0x505168['push'](_0x505168['shift']());}};_0x366c93(++_0x3dc03d);}(_0x85b1,0xa4));var _0x185b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x85b1[_0x119d5a];return _0x15bff4;};'use strict';var _=require('lodash');var util=require(_0x185b('0x0'));var logger=require(_0x185b('0x1'))(_0x185b('0x2'));var moment=require(_0x185b('0x3'));var BPromise=require(_0x185b('0x4'));var rp=require(_0x185b('0x5'));var fs=require('fs');var path=require(_0x185b('0x6'));var rimraf=require(_0x185b('0x7'));var config=require(_0x185b('0x8'));var attributes=require(_0x185b('0x9'));module[_0x185b('0xa')]=function(_0x3d64ba,_0x44f7b8){return _0x3d64ba[_0x185b('0xb')](_0x185b('0xc'),attributes,{'tableName':_0x185b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xada1=['define','UserSmsQueue','user_has_sms_queues','lodash','util','api','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x172e2a,_0x1addf7){var _0xa5c441=function(_0x10c1f1){while(--_0x10c1f1){_0x172e2a['push'](_0x172e2a['shift']());}};_0xa5c441(++_0x1addf7);}(_0xada1,0x12c));var _0x1ada=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xada1[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x1ada('0x0'));var util=require(_0x1ada('0x1'));var logger=require('../../config/logger')(_0x1ada('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ada('0x3'));var fs=require('fs');var path=require(_0x1ada('0x4'));var rimraf=require('rimraf');var config=require(_0x1ada('0x5'));var attributes=require(_0x1ada('0x6'));module[_0x1ada('0x7')]=function(_0x185211,_0x21aecb){return _0x185211[_0x1ada('0x8')](_0x1ada('0x9'),attributes,{'tableName':_0x1ada('0xa'),'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 eb4a918..023ba44 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 _0xfadc=['UserSmsQueue,\x20%s,\x20%s','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2646d9,_0x2cd27b){var _0x380e46=function(_0x570b04){while(--_0x570b04){_0x2646d9['push'](_0x2646d9['shift']());}};_0x380e46(++_0x2cd27b);}(_0xfadc,0x7b));var _0xcfad=function(_0x71ad56,_0x41d017){_0x71ad56=_0x71ad56-0x0;var _0xe791ac=_0xfadc[_0x71ad56];return _0xe791ac;};'use strict';var _=require(_0xcfad('0x0'));var util=require('util');var moment=require(_0xcfad('0x1'));var BPromise=require(_0xcfad('0x2'));var rs=require(_0xcfad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfad('0x4'))['db'];var utils=require(_0xcfad('0x5'));var logger=require(_0xcfad('0x6'))(_0xcfad('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfad('0x8'));var client=jayson[_0xcfad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c018d,_0x50eb3c,_0x2caa2b){return new BPromise(function(_0x1b89b0,_0x44db4e){return client['request'](_0x5c018d,_0x2caa2b)['then'](function(_0x35ccee){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0xcfad('0xa'));logger[_0xcfad('0xb')](_0xcfad('0xc'),_0x50eb3c,_0xcfad('0xa'),JSON[_0xcfad('0xd')](_0x35ccee));if(_0x35ccee['error']){if(_0x35ccee[_0xcfad('0xe')][_0xcfad('0xf')]===0x1f4){logger[_0xcfad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0x35ccee[_0xcfad('0xe')][_0xcfad('0x10')]);return _0x44db4e(_0x35ccee[_0xcfad('0xe')][_0xcfad('0x10')]);}logger['error'](_0xcfad('0x11'),_0x50eb3c,_0x35ccee['error'][_0xcfad('0x10')]);return _0x1b89b0(_0x35ccee['error'][_0xcfad('0x10')]);}else{logger[_0xcfad('0x12')](_0xcfad('0x11'),_0x50eb3c,_0xcfad('0xa'));_0x1b89b0(_0x35ccee[_0xcfad('0x13')]['message']);}})['catch'](function(_0x2e6b5d){logger[_0xcfad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x50eb3c,_0x2e6b5d);_0x44db4e(_0x2e6b5d);});});} \ No newline at end of file +var _0xec69=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4557a9,_0x1e7ecb){var _0x45796a=function(_0xf01e00){while(--_0xf01e00){_0x4557a9['push'](_0x4557a9['shift']());}};_0x45796a(++_0x1e7ecb);}(_0xec69,0xdb));var _0x9ec6=function(_0x23607f,_0x51db51){_0x23607f=_0x23607f-0x0;var _0x5a5be0=_0xec69[_0x23607f];return _0x5a5be0;};'use strict';var _=require(_0x9ec6('0x0'));var util=require(_0x9ec6('0x1'));var moment=require(_0x9ec6('0x2'));var BPromise=require(_0x9ec6('0x3'));var rs=require(_0x9ec6('0x4'));var fs=require('fs');var Redis=require(_0x9ec6('0x5'));var db=require(_0x9ec6('0x6'))['db'];var utils=require(_0x9ec6('0x7'));var logger=require(_0x9ec6('0x8'))('rpc');var config=require(_0x9ec6('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a299b,_0x59a129,_0xbce34f){return new BPromise(function(_0x3beeb4,_0x16d536){return client['request'](_0x4a299b,_0xbce34f)['then'](function(_0x4a6e8b){logger['info'](_0x9ec6('0xa'),_0x59a129,'request\x20sent');logger['debug'](_0x9ec6('0xb'),_0x59a129,_0x9ec6('0xc'),JSON[_0x9ec6('0xd')](_0x4a6e8b));if(_0x4a6e8b[_0x9ec6('0xe')]){if(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0xf')]===0x1f4){logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x4a6e8b['error'][_0x9ec6('0x10')]);return _0x16d536(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0x10')]);}logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x4a6e8b[_0x9ec6('0xe')]['message']);return _0x3beeb4(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0x10')]);}else{logger[_0x9ec6('0x11')](_0x9ec6('0xa'),_0x59a129,'request\x20sent');_0x3beeb4(_0x4a6e8b[_0x9ec6('0x12')]['message']);}})[_0x9ec6('0x13')](function(_0x1b40d0){logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x1b40d0);_0x16d536(_0x1b40d0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5afd84d..df06b4b 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 _0xeaa8=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0xa6218c,_0x125b83){var _0x67c132=function(_0x589044){while(--_0x589044){_0xa6218c['push'](_0xa6218c['shift']());}};_0x67c132(++_0x125b83);}(_0xeaa8,0x6c));var _0x8eaa=function(_0x5f5028,_0x37f8d6){_0x5f5028=_0x5f5028-0x0;var _0x1e2bf4=_0xeaa8[_0x5f5028];return _0x1e2bf4;};'use strict';var multer=require('multer');var util=require(_0x8eaa('0x0'));var path=require('path');var timeout=require(_0x8eaa('0x1'));var express=require(_0x8eaa('0x2'));var router=express[_0x8eaa('0x3')]();var auth=require(_0x8eaa('0x4'));var interaction=require(_0x8eaa('0x5'));var config=require(_0x8eaa('0x6'));module[_0x8eaa('0x7')]=router; \ No newline at end of file +var _0x96ef=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x356989,_0x307520){var _0x198ec0=function(_0x4bd207){while(--_0x4bd207){_0x356989['push'](_0x356989['shift']());}};_0x198ec0(++_0x307520);}(_0x96ef,0x96));var _0xf96e=function(_0x1e8b55,_0x48387f){_0x1e8b55=_0x1e8b55-0x0;var _0x2472d1=_0x96ef[_0x1e8b55];return _0x2472d1;};'use strict';var multer=require(_0xf96e('0x0'));var util=require(_0xf96e('0x1'));var path=require(_0xf96e('0x2'));var timeout=require(_0xf96e('0x3'));var express=require(_0xf96e('0x4'));var router=express[_0xf96e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf96e('0x6'));var config=require(_0xf96e('0x7'));module[_0xf96e('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d3b606a..dce7f56 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1d0c88,_0x30dfbe){var _0x1196ae=function(_0x48b0e8){while(--_0x48b0e8){_0x1d0c88['push'](_0x1d0c88['shift']());}};_0x1196ae(++_0x30dfbe);}(_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(_0x591121,_0x4cdfb5){var _0x2f466a=function(_0x43c759){while(--_0x43c759){_0x591121['push'](_0x591121['shift']());}};_0x2f466a(++_0x4cdfb5);}(_0xe706,0xa3));var _0x6e70=function(_0x302d1a,_0x387081){_0x302d1a=_0x302d1a-0x0;var _0xd82ca=_0xe706[_0x302d1a];return _0xd82ca;};'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 be6efc7..ff68519 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 _0x0faf=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0x0faf,0x132));var _0xf0fa=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x0faf[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','user_has_voice_queues','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x593cef,_0x55348d){_0x593cef=_0x593cef-0x0;var _0x1f7ed4=_0x80d9[_0x593cef];return _0x1f7ed4;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('UserVoiceQueue',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 240d59a..9873aed 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 _0x6ec0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util'];(function(_0x4be47f,_0x42354f){var _0xf9626b=function(_0x593dd1){while(--_0x593dd1){_0x4be47f['push'](_0x4be47f['shift']());}};_0xf9626b(++_0x42354f);}(_0x6ec0,0xfb));var _0x06ec=function(_0x5de7a5,_0x23948a){_0x5de7a5=_0x5de7a5-0x0;var _0x41e57b=_0x6ec0[_0x5de7a5];return _0x41e57b;};'use strict';var _=require(_0x06ec('0x0'));var util=require(_0x06ec('0x1'));var moment=require(_0x06ec('0x2'));var BPromise=require(_0x06ec('0x3'));var rs=require(_0x06ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ec('0x5'))['db'];var utils=require(_0x06ec('0x6'));var logger=require(_0x06ec('0x7'))(_0x06ec('0x8'));var config=require('../../config/environment');var jayson=require(_0x06ec('0x9'));var client=jayson[_0x06ec('0xa')][_0x06ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f0707,_0x4dd0a4,_0x5a3fd0){return new BPromise(function(_0x136fdc,_0x152c2a){return client[_0x06ec('0xc')](_0x5f0707,_0x5a3fd0)[_0x06ec('0xd')](function(_0x585699){logger[_0x06ec('0xe')](_0x06ec('0xf'),_0x4dd0a4,_0x06ec('0x10'));logger[_0x06ec('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4dd0a4,'request\x20sent',JSON[_0x06ec('0x12')](_0x585699));if(_0x585699['error']){if(_0x585699['error'][_0x06ec('0x13')]===0x1f4){logger[_0x06ec('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x4dd0a4,_0x585699[_0x06ec('0x14')]['message']);return _0x152c2a(_0x585699[_0x06ec('0x14')][_0x06ec('0x15')]);}logger['error'](_0x06ec('0xf'),_0x4dd0a4,_0x585699[_0x06ec('0x14')]['message']);return _0x136fdc(_0x585699['error'][_0x06ec('0x15')]);}else{logger[_0x06ec('0xe')](_0x06ec('0xf'),_0x4dd0a4,_0x06ec('0x10'));_0x136fdc(_0x585699['result'][_0x06ec('0x15')]);}})[_0x06ec('0x16')](function(_0x210001){logger['error'](_0x06ec('0xf'),_0x4dd0a4,_0x210001);_0x152c2a(_0x210001);});});} \ No newline at end of file +var _0x8695=['http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8695,0xb5));var _0x5869=function(_0x4808ee,_0x5e1d72){_0x4808ee=_0x4808ee-0x0;var _0x23ed56=_0x8695[_0x4808ee];return _0x23ed56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5869('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5869('0x1'));var db=require(_0x5869('0x2'))['db'];var utils=require(_0x5869('0x3'));var logger=require('../../config/logger')(_0x5869('0x4'));var config=require(_0x5869('0x5'));var jayson=require(_0x5869('0x6'));var client=jayson[_0x5869('0x7')][_0x5869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25668e,_0x21ddc0,_0x341908){return new BPromise(function(_0x3d4771,_0x4da5ab){return client[_0x5869('0x9')](_0x25668e,_0x341908)[_0x5869('0xa')](function(_0x372e18){logger['info'](_0x5869('0xb'),_0x21ddc0,'request\x20sent');logger[_0x5869('0xc')](_0x5869('0xd'),_0x21ddc0,_0x5869('0xe'),JSON['stringify'](_0x372e18));if(_0x372e18[_0x5869('0xf')]){if(_0x372e18[_0x5869('0xf')][_0x5869('0x10')]===0x1f4){logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);return _0x4da5ab(_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);}logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);return _0x3d4771(_0x372e18['error'][_0x5869('0x11')]);}else{logger[_0x5869('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x21ddc0,_0x5869('0xe'));_0x3d4771(_0x372e18[_0x5869('0x13')][_0x5869('0x11')]);}})[_0x5869('0x14')](function(_0x488481){logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x488481);_0x4da5ab(_0x488481);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 79a952c..f6cf0dd 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 _0x5883=['../../components/interaction/service','exports','multer','util','Router','../../components/auth/service'];(function(_0x128fc3,_0x29cf4d){var _0x3150b1=function(_0x3b4d5b){while(--_0x3b4d5b){_0x128fc3['push'](_0x128fc3['shift']());}};_0x3150b1(++_0x29cf4d);}(_0x5883,0x13a));var _0x3588=function(_0x450ac6,_0x4f3807){_0x450ac6=_0x450ac6-0x0;var _0x24c343=_0x5883[_0x450ac6];return _0x24c343;};'use strict';var multer=require(_0x3588('0x0'));var util=require(_0x3588('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3588('0x2')]();var auth=require(_0x3588('0x3'));var interaction=require(_0x3588('0x4'));var config=require('../../config/environment');module[_0x3588('0x5')]=router; \ No newline at end of file +var _0x254b=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xb31f,_0x229502){var _0x134fe7=function(_0x53de89){while(--_0x53de89){_0xb31f['push'](_0xb31f['shift']());}};_0x134fe7(++_0x229502);}(_0x254b,0x110));var _0xb254=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x254b[_0x270adf];return _0x29eda9;};'use strict';var multer=require(_0xb254('0x0'));var util=require(_0xb254('0x1'));var path=require(_0xb254('0x2'));var timeout=require(_0xb254('0x3'));var express=require(_0xb254('0x4'));var router=express['Router']();var auth=require(_0xb254('0x5'));var interaction=require(_0xb254('0x6'));var config=require(_0xb254('0x7'));module[_0xb254('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 02def35..4b24e8a 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 _0x5945=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x5d057f,_0x481121){var _0x26d39b=function(_0x2f2163){while(--_0x2f2163){_0x5d057f['push'](_0x5d057f['shift']());}};_0x26d39b(++_0x481121);}(_0x5945,0x1de));var _0x5594=function(_0x7b8b47,_0x274711){_0x7b8b47=_0x7b8b47-0x0;var _0x5b3c2a=_0x5945[_0x7b8b47];return _0x5b3c2a;};'use strict';var Sequelize=require(_0x5594('0x0'));module[_0x5594('0x1')]={'uniqueid':{'type':Sequelize[_0x5594('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5594('0x3')},'membername':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'unique':_0x5594('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x5594('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5594('0x4')],'allowNull':![],'unique':_0x5594('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x5594('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x5594('0x2')](0xb),'defaultValue':0x0,'comment':_0x5594('0x3')}}; \ No newline at end of file +var _0x76c9=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1475be,_0x4ed47c){var _0x306b4e=function(_0x991d85){while(--_0x991d85){_0x1475be['push'](_0x1475be['shift']());}};_0x306b4e(++_0x4ed47c);}(_0x76c9,0x1bc));var _0x976c=function(_0x5d63af,_0x4e8f02){_0x5d63af=_0x5d63af-0x0;var _0x819714=_0x76c9[_0x5d63af];return _0x819714;};'use strict';var Sequelize=require(_0x976c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x976c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x976c('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x976c('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x976c('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x976c('0x4'),'comment':_0x976c('0x2')},'penalty':{'type':Sequelize[_0x976c('0x1')](0xb),'defaultValue':0x0,'comment':_0x976c('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x976c('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 988ad6a..2ecc1df 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 _0xd386=['hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit'];(function(_0x5d3ad7,_0x150d60){var _0x1ed853=function(_0x5eac0f){while(--_0x5eac0f){_0x5d3ad7['push'](_0x5d3ad7['shift']());}};_0x1ed853(++_0x150d60);}(_0xd386,0x14f));var _0x6d38=function(_0x5e8602,_0x2ce012){_0x5e8602=_0x5e8602-0x0;var _0x4434fb=_0xd386[_0x5e8602];return _0x4434fb;};'use strict';var EventEmitter=require(_0x6d38('0x0'));var UserVoiceQueueRt=require(_0x6d38('0x1'))['db'][_0x6d38('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6d38('0x3')](0x0);var events={'afterCreate':_0x6d38('0x4'),'afterUpdate':_0x6d38('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266e42){return function(_0x3b763f,_0x40addc,_0x2d53c9){UserVoiceQueueRtEvents[_0x6d38('0x6')](_0x266e42+':'+_0x3b763f['id'],_0x3b763f);UserVoiceQueueRtEvents[_0x6d38('0x6')](_0x266e42,_0x3b763f);_0x2d53c9(null);};}for(var e in events){if(events[_0x6d38('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6d38('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1908=['emit','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x1908,0x119));var _0x8190=function(_0x28d1fa,_0x31125b){_0x28d1fa=_0x28d1fa-0x0;var _0x5d5dc9=_0x1908[_0x28d1fa];return _0x5d5dc9;};'use strict';var EventEmitter=require(_0x8190('0x0'));var UserVoiceQueueRt=require(_0x8190('0x1'))['db'][_0x8190('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8190('0x3')](0x0);var events={'afterCreate':_0x8190('0x4'),'afterUpdate':_0x8190('0x5'),'afterDestroy':_0x8190('0x6')};function emitEvent(_0x240069){return function(_0x507a97,_0x43e6df,_0x45a33a){UserVoiceQueueRtEvents[_0x8190('0x7')](_0x240069+':'+_0x507a97['id'],_0x507a97);UserVoiceQueueRtEvents[_0x8190('0x7')](_0x240069,_0x507a97);_0x45a33a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x8190('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 8d75e6a..b4b06a8 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 _0xbd3e=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xbd3e,0x158));var _0xebd3=function(_0x53902d,_0x10a1d7){_0x53902d=_0x53902d-0x0;var _0x3954bc=_0xbd3e[_0x53902d];return _0x3954bc;};'use strict';var _=require(_0xebd3('0x0'));var util=require(_0xebd3('0x1'));var logger=require('../../config/logger')(_0xebd3('0x2'));var moment=require(_0xebd3('0x3'));var BPromise=require(_0xebd3('0x4'));var rp=require(_0xebd3('0x5'));var fs=require('fs');var path=require(_0xebd3('0x6'));var rimraf=require(_0xebd3('0x7'));var config=require(_0xebd3('0x8'));var attributes=require(_0xebd3('0x9'));module[_0xebd3('0xa')]=function(_0x47636c,_0x404a07){return _0x47636c[_0xebd3('0xb')](_0xebd3('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06bc=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06bc,0x1c9));var _0xc06b=function(_0x500489,_0x3e7970){_0x500489=_0x500489-0x0;var _0x5b8ddd=_0x06bc[_0x500489];return _0x5b8ddd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc06b('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc06b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc06b('0x2'));var rimraf=require(_0xc06b('0x3'));var config=require(_0xc06b('0x4'));var attributes=require(_0xc06b('0x5'));module[_0xc06b('0x6')]=function(_0x243376,_0x4f6dce){return _0x243376['define'](_0xc06b('0x7'),attributes,{'tableName':_0xc06b('0x8'),'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 75b8a47..d3200f6 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 _0x93c8=['request\x20sent','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x57241e,_0x33ba78){var _0x33ad39=function(_0x1b40e4){while(--_0x1b40e4){_0x57241e['push'](_0x57241e['shift']());}};_0x33ad39(++_0x33ba78);}(_0x93c8,0x178));var _0x893c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x93c8[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x893c('0x0'));var moment=require(_0x893c('0x1'));var BPromise=require(_0x893c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x893c('0x3'));var db=require(_0x893c('0x4'))['db'];var utils=require(_0x893c('0x5'));var logger=require('../../config/logger')(_0x893c('0x6'));var config=require(_0x893c('0x7'));var jayson=require(_0x893c('0x8'));var client=jayson[_0x893c('0x9')]['http']({'port':0x232a});config['redis']=_[_0x893c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x893c('0xb'))(new Redis(config[_0x893c('0xc')]));require('./userVoiceQueueRt.socket')[_0x893c('0xd')](socket);function respondWithRpcPromise(_0x45599e,_0x5b5a00,_0x35d897){return new BPromise(function(_0x41668c,_0x46d567){return client[_0x893c('0xe')](_0x45599e,_0x35d897)[_0x893c('0xf')](function(_0x200500){logger[_0x893c('0x10')](_0x893c('0x11'),_0x5b5a00,'request\x20sent');logger[_0x893c('0x12')](_0x893c('0x13'),_0x5b5a00,_0x893c('0x14'),JSON['stringify'](_0x200500));if(_0x200500[_0x893c('0x15')]){if(_0x200500['error']['code']===0x1f4){logger['error'](_0x893c('0x11'),_0x5b5a00,_0x200500[_0x893c('0x15')]['message']);return _0x46d567(_0x200500[_0x893c('0x15')]['message']);}logger['error'](_0x893c('0x11'),_0x5b5a00,_0x200500['error'][_0x893c('0x16')]);return _0x41668c(_0x200500[_0x893c('0x15')][_0x893c('0x16')]);}else{logger['info'](_0x893c('0x11'),_0x5b5a00,_0x893c('0x14'));_0x41668c(_0x200500['result'][_0x893c('0x16')]);}})['catch'](function(_0x24228a){logger[_0x893c('0x15')](_0x893c('0x11'),_0x5b5a00,_0x24228a);_0x46d567(_0x24228a);});});}exports[_0x893c('0x17')]=function(_0x3a8fe9){var _0x3db3dd=this;return new Promise(function(_0x56efb7,_0x671e0c){return db[_0x893c('0x18')][_0x893c('0x19')]({'raw':_0x3a8fe9[_0x893c('0x1a')]?_0x3a8fe9['options'][_0x893c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a8fe9[_0x893c('0x1a')]?_0x3a8fe9['options'][_0x893c('0x1c')]||null:null,'attributes':[[db[_0x893c('0x1d')]['fn']('COUNT',db[_0x893c('0x1d')]['fn']('IF',db[_0x893c('0x1d')][_0x893c('0x1e')](_0x893c('0x1f')))),'outboundQueuePauses']]})[_0x893c('0xf')](function(_0x56e271){logger[_0x893c('0x10')](_0x893c('0x17'),_0x3a8fe9);logger['debug'](_0x893c('0x17'),_0x3a8fe9,JSON[_0x893c('0x20')](_0x56e271));_0x56efb7(_0x56e271);})['catch'](function(_0x105ab1){logger[_0x893c('0x15')](_0x893c('0x17'),_0x105ab1['message'],_0x3a8fe9);_0x671e0c(_0x3db3dd[_0x893c('0x15')](0x1f4,_0x105ab1[_0x893c('0x16')]));});});}; \ No newline at end of file +var _0x130b=['COUNT','then','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize'];(function(_0x4c759e,_0x47c638){var _0xd74c92=function(_0x4b5544){while(--_0x4b5544){_0x4c759e['push'](_0x4c759e['shift']());}};_0xd74c92(++_0x47c638);}(_0x130b,0xff));var _0xb130=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x130b[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0xb130('0x0'));var moment=require('moment');var BPromise=require(_0xb130('0x1'));var rs=require(_0xb130('0x2'));var fs=require('fs');var Redis=require(_0xb130('0x3'));var db=require(_0xb130('0x4'))['db'];var utils=require(_0xb130('0x5'));var logger=require(_0xb130('0x6'))(_0xb130('0x7'));var config=require(_0xb130('0x8'));var jayson=require(_0xb130('0x9'));var client=jayson[_0xb130('0xa')][_0xb130('0xb')]({'port':0x232a});config[_0xb130('0xc')]=_[_0xb130('0xd')](config[_0xb130('0xc')],{'host':_0xb130('0xe'),'port':0x18eb});var socket=require(_0xb130('0xf'))(new Redis(config[_0xb130('0xc')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x2b35f9,_0x4b349a,_0x3e5c9c){return new BPromise(function(_0x1e9efd,_0x591ee2){return client[_0xb130('0x10')](_0x2b35f9,_0x3e5c9c)['then'](function(_0x15bed1){logger['info'](_0xb130('0x11'),_0x4b349a,_0xb130('0x12'));logger[_0xb130('0x13')](_0xb130('0x14'),_0x4b349a,_0xb130('0x12'),JSON[_0xb130('0x15')](_0x15bed1));if(_0x15bed1['error']){if(_0x15bed1[_0xb130('0x16')][_0xb130('0x17')]===0x1f4){logger[_0xb130('0x16')](_0xb130('0x11'),_0x4b349a,_0x15bed1[_0xb130('0x16')]['message']);return _0x591ee2(_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);}logger[_0xb130('0x16')](_0xb130('0x11'),_0x4b349a,_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);return _0x1e9efd(_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);}else{logger['info'](_0xb130('0x11'),_0x4b349a,_0xb130('0x12'));_0x1e9efd(_0x15bed1[_0xb130('0x19')][_0xb130('0x18')]);}})[_0xb130('0x1a')](function(_0x3f0ee0){logger['error'](_0xb130('0x11'),_0x4b349a,_0x3f0ee0);_0x591ee2(_0x3f0ee0);});});}exports[_0xb130('0x1b')]=function(_0x29f1b8){var _0x489707=this;return new Promise(function(_0x59a333,_0x322d3e){return db['UserVoiceQueueRt'][_0xb130('0x1c')]({'raw':_0x29f1b8[_0xb130('0x1d')]?_0x29f1b8[_0xb130('0x1d')][_0xb130('0x1e')]===undefined?!![]:![]:!![],'where':_0x29f1b8['options']?_0x29f1b8[_0xb130('0x1d')][_0xb130('0x1f')]||null:null,'attributes':[[db[_0xb130('0x20')]['fn'](_0xb130('0x21'),db['sequelize']['fn']('IF',db[_0xb130('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xb130('0x22')](function(_0x36dd3c){logger[_0xb130('0x23')](_0xb130('0x1b'),_0x29f1b8);logger[_0xb130('0x13')](_0xb130('0x1b'),_0x29f1b8,JSON[_0xb130('0x15')](_0x36dd3c));_0x59a333(_0x36dd3c);})[_0xb130('0x1a')](function(_0x2db011){logger[_0xb130('0x16')](_0xb130('0x1b'),_0x2db011[_0xb130('0x18')],_0x29f1b8);_0x322d3e(_0x489707[_0xb130('0x16')](0x1f4,_0x2db011[_0xb130('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bacc100..09e7b8d 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 _0x9a42=['emit','removeListener','register','length','./userVoiceQueueRt.events','save','remove','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9a42,0x134));var _0x29a4=function(_0x8f9b2f,_0x17d552){_0x8f9b2f=_0x8f9b2f-0x0;var _0x487038=_0x9a42[_0x8f9b2f];return _0x487038;};'use strict';var UserVoiceQueueRtEvents=require(_0x29a4('0x0'));var events=[_0x29a4('0x1'),_0x29a4('0x2'),_0x29a4('0x3')];function createListener(_0x1a2615,_0x4cd9a4){return function(_0x5292d4){_0x4cd9a4[_0x29a4('0x4')](_0x1a2615,_0x5292d4);};}function removeListener(_0x2a3088,_0x4b579a){return function(){UserVoiceQueueRtEvents[_0x29a4('0x5')](_0x2a3088,_0x4b579a);};}exports[_0x29a4('0x6')]=function(_0xbd75a0){for(var _0x4fb454=0x0,_0x1f34bb=events[_0x29a4('0x7')];_0x4fb454<_0x1f34bb;_0x4fb454++){var _0x376f10=events[_0x4fb454];var _0x39bbb9=createListener('userVoiceQueueRt:'+_0x376f10,_0xbd75a0);UserVoiceQueueRtEvents['on'](_0x376f10,_0x39bbb9);}}; \ No newline at end of file +var _0xb1c0=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener','length'];(function(_0x22bc06,_0x234eb3){var _0x7e0288=function(_0x4bdf90){while(--_0x4bdf90){_0x22bc06['push'](_0x22bc06['shift']());}};_0x7e0288(++_0x234eb3);}(_0xb1c0,0x1a5));var _0x0b1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1c0[_0x20a584];return _0x4b41a8;};'use strict';var UserVoiceQueueRtEvents=require(_0x0b1c('0x0'));var events=[_0x0b1c('0x1'),_0x0b1c('0x2'),'update'];function createListener(_0x1cf00c,_0x5efe3a){return function(_0x2a3e94){_0x5efe3a[_0x0b1c('0x3')](_0x1cf00c,_0x2a3e94);};}function removeListener(_0x5532e3,_0x2e8820){return function(){UserVoiceQueueRtEvents[_0x0b1c('0x4')](_0x5532e3,_0x2e8820);};}exports['register']=function(_0x40a4b4){for(var _0x2bdc6c=0x0,_0x27206c=events[_0x0b1c('0x5')];_0x2bdc6c<_0x27206c;_0x2bdc6c++){var _0x5a1b82=events[_0x2bdc6c];var _0x1cdb02=createListener(_0x0b1c('0x6')+_0x5a1b82,_0x40a4b4);UserVoiceQueueRtEvents['on'](_0x5a1b82,_0x1cdb02);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 66878b3..2383677 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 _0x7370=['multer','util','path','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5c10d3,_0x3a3b3a){var _0x2cbab4=function(_0x167680){while(--_0x167680){_0x5c10d3['push'](_0x5c10d3['shift']());}};_0x2cbab4(++_0x3a3b3a);}(_0x7370,0x11a));var _0x0737=function(_0xb26065,_0x36df08){_0xb26065=_0xb26065-0x0;var _0x974dce=_0x7370[_0xb26065];return _0x974dce;};'use strict';var multer=require(_0x0737('0x0'));var util=require(_0x0737('0x1'));var path=require(_0x0737('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0737('0x3'));var interaction=require(_0x0737('0x4'));var config=require('../../config/environment');module[_0x0737('0x5')]=router; \ No newline at end of file +var _0x023d=['../../config/environment','multer','path','Router','../../components/auth/service'];(function(_0x53cfc1,_0x12ab2b){var _0x399090=function(_0x564ddc){while(--_0x564ddc){_0x53cfc1['push'](_0x53cfc1['shift']());}};_0x399090(++_0x12ab2b);}(_0x023d,0xe7));var _0xd023=function(_0x3885fc,_0x43a3b8){_0x3885fc=_0x3885fc-0x0;var _0x1ce95d=_0x023d[_0x3885fc];return _0x1ce95d;};'use strict';var multer=require(_0xd023('0x0'));var util=require('util');var path=require(_0xd023('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd023('0x2')]();var auth=require(_0xd023('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd023('0x4'));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 6d27d4c..ab45552 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 _0xbaf0=['exports','INTEGER'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x110d5f,_0x2fe2ee){var _0x108100=function(_0x3b70c1){while(--_0x3b70c1){_0x110d5f['push'](_0x110d5f['shift']());}};_0x108100(++_0x2fe2ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index db8c964..8db88ff 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 _0x2032=['user_has_whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x4e38cf,_0x2f02cf){var _0x22a027=function(_0x15e70d){while(--_0x15e70d){_0x4e38cf['push'](_0x4e38cf['shift']());}};_0x22a027(++_0x2f02cf);}(_0x2032,0xd9));var _0x2203=function(_0x20b7ac,_0x24d8d9){_0x20b7ac=_0x20b7ac-0x0;var _0x468e89=_0x2032[_0x20b7ac];return _0x468e89;};'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 _0xb688=['exports','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x4f7c83,_0x380cb4){var _0x3e18a3=function(_0x4cbf58){while(--_0x4cbf58){_0x4f7c83['push'](_0x4f7c83['shift']());}};_0x3e18a3(++_0x380cb4);}(_0xb688,0xcf));var _0x8b68=function(_0x3a5783,_0x1eaa11){_0x3a5783=_0x3a5783-0x0;var _0x1dacac=_0xb688[_0x3a5783];return _0x1dacac;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a48d2e6..54aee0e 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(_0x1582eb,_0x50cc43){var _0x382b06=function(_0xe4edfc){while(--_0xe4edfc){_0x1582eb['push'](_0x1582eb['shift']());}};_0x382b06(++_0x50cc43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x4c8529,_0x20391){var _0x128fac=function(_0x168aec){while(--_0x168aec){_0x4c8529['push'](_0x4c8529['shift']());}};_0x128fac(++_0x20391);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 e4d565b..0ca5ba4 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 _0x532b=['index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x532b,0x16f));var _0xb532=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x532b[_0x308dcc];return _0x361717;};'use strict';var multer=require(_0xb532('0x0'));var util=require('util');var path=require(_0xb532('0x1'));var timeout=require('connect-timeout');var express=require(_0xb532('0x2'));var router=express[_0xb532('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb532('0x4'));var config=require(_0xb532('0x5'));var controller=require('./variable.controller');router[_0xb532('0x6')]('/',auth['isAuthenticated'](),controller[_0xb532('0x7')]);router[_0xb532('0x6')](_0xb532('0x8'),auth['isAuthenticated'](),controller[_0xb532('0x9')]);router[_0xb532('0xa')]('/',auth[_0xb532('0xb')](),controller[_0xb532('0xc')]);router['put'](_0xb532('0x8'),auth[_0xb532('0xb')](),controller[_0xb532('0xd')]);router[_0xb532('0xe')](_0xb532('0x8'),auth[_0xb532('0xb')](),controller[_0xb532('0xf')]);module[_0xb532('0x10')]=router; \ No newline at end of file +var _0x2c9e=['isAuthenticated','index','post','create','/:id','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2a118c,_0x593c5b){var _0x2f6aed=function(_0x48c36a){while(--_0x48c36a){_0x2a118c['push'](_0x2a118c['shift']());}};_0x2f6aed(++_0x593c5b);}(_0x2c9e,0x19a));var _0xe2c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c9e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe2c9('0x0'));var path=require('path');var timeout=require(_0xe2c9('0x1'));var express=require('express');var router=express[_0xe2c9('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe2c9('0x3'));var config=require(_0xe2c9('0x4'));var controller=require('./variable.controller');router[_0xe2c9('0x5')]('/',auth[_0xe2c9('0x6')](),controller[_0xe2c9('0x7')]);router[_0xe2c9('0x5')]('/:id',auth[_0xe2c9('0x6')](),controller['show']);router[_0xe2c9('0x8')]('/',auth[_0xe2c9('0x6')](),controller[_0xe2c9('0x9')]);router['put']('/:id',auth[_0xe2c9('0x6')](),controller['update']);router['delete'](_0xe2c9('0xa'),auth[_0xe2c9('0x6')](),controller[_0xe2c9('0xb')]);module[_0xe2c9('0xc')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index afc7eb6..30debfb 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 _0x9d66=['STRING','name','sequelize','exports'];(function(_0x3598da,_0x246ecc){var _0x1bd18f=function(_0x2718cb){while(--_0x2718cb){_0x3598da['push'](_0x3598da['shift']());}};_0x1bd18f(++_0x246ecc);}(_0x9d66,0x10a));var _0x69d6=function(_0x5741de,_0x5e3daa){_0x5741de=_0x5741de-0x0;var _0x239628=_0x9d66[_0x5741de];return _0x239628;};'use strict';var Sequelize=require(_0x69d6('0x0'));module[_0x69d6('0x1')]={'name':{'type':Sequelize[_0x69d6('0x2')],'unique':_0x69d6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x69d6('0x2')]}}; \ No newline at end of file +var _0x923f=['exports','sequelize'];(function(_0x21cb98,_0x44db75){var _0x10cc9e=function(_0x4fef7b){while(--_0x4fef7b){_0x21cb98['push'](_0x21cb98['shift']());}};_0x10cc9e(++_0x44db75);}(_0x923f,0x65));var _0xf923=function(_0x53d435,_0x139b47){_0x53d435=_0x53d435-0x0;var _0x27c2c9=_0x923f[_0x53d435];return _0x27c2c9;};'use strict';var Sequelize=require(_0xf923('0x0'));module[_0xf923('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2a6f6e1..7fe3f2c 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 _0x3c3b=['limit','set','Content-Range','apply','reject','save','update','destroy','then','Variables','UserProfileResource','name','send','map','Variable','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x3c76cf,_0x2db5d8){var _0xf10f91=function(_0x9ee515){while(--_0x9ee515){_0x3c76cf['push'](_0x3c76cf['shift']());}};_0xf10f91(++_0x2db5d8);}(_0x3c3b,0x172));var _0xb3c3=function(_0x25c02d,_0x27f7ae){_0x25c02d=_0x25c02d-0x0;var _0xea1527=_0x3c3b[_0x25c02d];return _0xea1527;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb3c3('0x0'));var rimraf=require(_0xb3c3('0x1'));var zipdir=require(_0xb3c3('0x2'));var jsonpatch=require(_0xb3c3('0x3'));var rp=require(_0xb3c3('0x4'));var moment=require(_0xb3c3('0x5'));var BPromise=require(_0xb3c3('0x6'));var Mustache=require(_0xb3c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb3c3('0x8'));var csv=require(_0xb3c3('0x9'));var ejs=require(_0xb3c3('0xa'));var fs=require('fs');var _=require(_0xb3c3('0xb'));var squel=require('squel');var crypto=require(_0xb3c3('0xc'));var jsforce=require(_0xb3c3('0xd'));var deskjs=require(_0xb3c3('0xe'));var toCsv=require(_0xb3c3('0x9'));var querystring=require(_0xb3c3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3c3('0x10'));var qs=require(_0xb3c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3c3('0x12'))(_0xb3c3('0x13'));var utils=require(_0xb3c3('0x14'));var config=require(_0xb3c3('0x15'));var licenseUtil=require(_0xb3c3('0x16'));var db=require(_0xb3c3('0x17'))['db'];function respondWithStatusCode(_0x319692,_0x493a54){_0x493a54=_0x493a54||0xcc;return function(_0x96b17d){if(_0x96b17d){return _0x319692[_0xb3c3('0x18')](_0x493a54);}return _0x319692['status'](_0x493a54)[_0xb3c3('0x19')]();};}function respondWithResult(_0x2d3bc9,_0x2d586c){_0x2d586c=_0x2d586c||0xc8;return function(_0x337b22){if(_0x337b22){return _0x2d3bc9[_0xb3c3('0x1a')](_0x2d586c)[_0xb3c3('0x1b')](_0x337b22);}};}function respondWithFilteredResult(_0x21b06a,_0x347af5){return function(_0x3393d8){if(_0x3393d8){var _0x2a40f5=_0x3393d8[_0xb3c3('0x1c')],_0x564f7b=_0x347af5[_0xb3c3('0x1d')],_0x3dd10a=_0x347af5[_0xb3c3('0x1d')]+_0x347af5[_0xb3c3('0x1e')],_0x20e2c6;if(_0x3dd10a>=_0x2a40f5){_0x3dd10a=_0x2a40f5;_0x20e2c6=0xc8;}else{_0x20e2c6=0xce;}_0x21b06a[_0xb3c3('0x1a')](_0x20e2c6);return _0x21b06a[_0xb3c3('0x1f')](_0xb3c3('0x20'),_0x564f7b+'-'+_0x3dd10a+'/'+_0x2a40f5)[_0xb3c3('0x1b')](_0x3393d8);}return null;};}function patchUpdates(_0x21569c){return function(_0x358b59){try{jsonpatch[_0xb3c3('0x21')](_0x358b59,_0x21569c,!![]);}catch(_0x22e97){return BPromise[_0xb3c3('0x22')](_0x22e97);}return _0x358b59[_0xb3c3('0x23')]();};}function saveUpdates(_0x52e8ec,_0x35a2b3){return function(_0x4d2e2b){if(_0x4d2e2b){return _0x4d2e2b[_0xb3c3('0x24')](_0x52e8ec)['then'](function(_0x10c314){return _0x10c314;});}return null;};}function removeEntity(_0x3aeb17,_0x12869c){return function(_0x2257f3){if(_0x2257f3){return _0x2257f3[_0xb3c3('0x25')]()[_0xb3c3('0x26')](function(){var _0x244166=_0x2257f3['get']({'plain':!![]});var _0x1990e5=_0xb3c3('0x27');return db[_0xb3c3('0x28')][_0xb3c3('0x25')]({'where':{'type':_0x1990e5,'resourceId':_0x244166['id']}})[_0xb3c3('0x26')](function(){return _0x2257f3;});})[_0xb3c3('0x26')](function(){_0x3aeb17['status'](0xcc)[_0xb3c3('0x19')]();});}};}function handleEntityNotFound(_0x40f6e6,_0x11282d){return function(_0x53e1a5){if(!_0x53e1a5){_0x40f6e6['sendStatus'](0x194);}return _0x53e1a5;};}function handleError(_0x3c8d7e,_0xadf4e7){_0xadf4e7=_0xadf4e7||0x1f4;return function(_0x165347){logger['error'](_0x165347['stack']);if(_0x165347[_0xb3c3('0x29')]){delete _0x165347[_0xb3c3('0x29')];}_0x3c8d7e[_0xb3c3('0x1a')](_0xadf4e7)[_0xb3c3('0x2a')](_0x165347);};}exports['index']=function(_0x554274,_0x244948){var _0xa3a56e={},_0x58fcbe={},_0x341030={'count':0x0,'rows':[]};var _0xce0009=_[_0xb3c3('0x2b')](db[_0xb3c3('0x2c')][_0xb3c3('0x2d')],function(_0x5ea9cf){return{'name':_0x5ea9cf[_0xb3c3('0x2e')],'type':_0x5ea9cf[_0xb3c3('0x2f')]['key']};});_0x58fcbe[_0xb3c3('0x30')]=_[_0xb3c3('0x2b')](_0xce0009,_0xb3c3('0x29'));_0x58fcbe[_0xb3c3('0x31')]=_['keys'](_0x554274[_0xb3c3('0x31')]);_0x58fcbe['filters']=_[_0xb3c3('0x32')](_0x58fcbe[_0xb3c3('0x30')],_0x58fcbe[_0xb3c3('0x31')]);_0xa3a56e[_0xb3c3('0x33')]=_[_0xb3c3('0x32')](_0x58fcbe[_0xb3c3('0x30')],qs['fields'](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x34')]));_0xa3a56e[_0xb3c3('0x33')]=_0xa3a56e[_0xb3c3('0x33')][_0xb3c3('0x35')]?_0xa3a56e[_0xb3c3('0x33')]:_0x58fcbe[_0xb3c3('0x30')];if(!_0x554274['query'][_0xb3c3('0x36')](_0xb3c3('0x37'))){_0xa3a56e['limit']=qs[_0xb3c3('0x1e')](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x1e')]);_0xa3a56e[_0xb3c3('0x1d')]=qs['offset'](_0x554274[_0xb3c3('0x31')]['offset']);}_0xa3a56e['order']=qs[_0xb3c3('0x38')](_0x554274[_0xb3c3('0x31')][_0xb3c3('0x38')]);_0xa3a56e['where']=qs[_0xb3c3('0x39')](_['pick'](_0x554274[_0xb3c3('0x31')],_0x58fcbe['filters']),_0xce0009);if(_0x554274[_0xb3c3('0x31')][_0xb3c3('0x3a')]){_0xa3a56e[_0xb3c3('0x3b')]=_[_0xb3c3('0x3c')](_0xa3a56e[_0xb3c3('0x3b')],{'$or':_[_0xb3c3('0x2b')](_0xce0009,function(_0x699e5a){if(_0x699e5a[_0xb3c3('0x2f')]!==_0xb3c3('0x3d')){var _0x484c4a={};_0x484c4a[_0x699e5a[_0xb3c3('0x29')]]={'$like':'%'+_0x554274[_0xb3c3('0x31')][_0xb3c3('0x3a')]+'%'};return _0x484c4a;}})});}_0xa3a56e=_[_0xb3c3('0x3c')]({},_0xa3a56e,_0x554274[_0xb3c3('0x3e')]);var _0x5405a7={'where':_0xa3a56e[_0xb3c3('0x3b')]};return db[_0xb3c3('0x2c')]['count'](_0x5405a7)[_0xb3c3('0x26')](function(_0x3391f3){_0x341030['count']=_0x3391f3;if(_0x554274['query']['includeAll']){_0xa3a56e[_0xb3c3('0x3f')]=[{'all':!![]}];}return db[_0xb3c3('0x2c')][_0xb3c3('0x40')](_0xa3a56e);})[_0xb3c3('0x26')](function(_0x5ca35d){_0x341030['rows']=_0x5ca35d;return _0x341030;})[_0xb3c3('0x26')](respondWithFilteredResult(_0x244948,_0xa3a56e))[_0xb3c3('0x41')](handleError(_0x244948,null));};exports[_0xb3c3('0x42')]=function(_0x9cc961,_0x3b91e4){var _0x2f2cf3={'raw':!![],'where':{'id':_0x9cc961[_0xb3c3('0x43')]['id']}},_0x1e7e09={};_0x1e7e09[_0xb3c3('0x30')]=_[_0xb3c3('0x44')](db['Variable']['rawAttributes']);_0x1e7e09[_0xb3c3('0x31')]=_[_0xb3c3('0x44')](_0x9cc961[_0xb3c3('0x31')]);_0x1e7e09[_0xb3c3('0x39')]=_['intersection'](_0x1e7e09[_0xb3c3('0x30')],_0x1e7e09['query']);_0x2f2cf3['attributes']=_[_0xb3c3('0x32')](_0x1e7e09[_0xb3c3('0x30')],qs[_0xb3c3('0x34')](_0x9cc961['query'][_0xb3c3('0x34')]));_0x2f2cf3[_0xb3c3('0x33')]=_0x2f2cf3[_0xb3c3('0x33')][_0xb3c3('0x35')]?_0x2f2cf3[_0xb3c3('0x33')]:_0x1e7e09[_0xb3c3('0x30')];if(_0x9cc961[_0xb3c3('0x31')]['includeAll']){_0x2f2cf3[_0xb3c3('0x3f')]=[{'all':!![]}];}_0x2f2cf3=_[_0xb3c3('0x3c')]({},_0x2f2cf3,_0x9cc961[_0xb3c3('0x3e')]);return db[_0xb3c3('0x2c')][_0xb3c3('0x45')](_0x2f2cf3)[_0xb3c3('0x26')](handleEntityNotFound(_0x3b91e4,null))['then'](respondWithResult(_0x3b91e4,null))['catch'](handleError(_0x3b91e4,null));};exports[_0xb3c3('0x46')]=function(_0x1d0e3b,_0x519886){return db[_0xb3c3('0x2c')][_0xb3c3('0x46')](_0x1d0e3b['body'],{})[_0xb3c3('0x26')](function(_0x47ebfb){var _0x17d15d=_0x1d0e3b[_0xb3c3('0x47')]['get']({'plain':!![]});if(!_0x17d15d)throw new Error(_0xb3c3('0x48'));if(_0x17d15d[_0xb3c3('0x49')]===_0xb3c3('0x47')){var _0x40fd13=_0x47ebfb[_0xb3c3('0x4a')]({'plain':!![]});var _0xc17590=_0xb3c3('0x27');return db[_0xb3c3('0x4b')][_0xb3c3('0x45')]({'where':{'name':_0xc17590,'userProfileId':_0x17d15d['userProfileId']},'raw':!![]})['then'](function(_0x512723){if(_0x512723&&_0x512723[_0xb3c3('0x4c')]===0x0){return db[_0xb3c3('0x28')]['create']({'name':_0x40fd13[_0xb3c3('0x29')],'resourceId':_0x40fd13['id'],'type':_0x512723[_0xb3c3('0x29')],'sectionId':_0x512723['id']},{})[_0xb3c3('0x26')](function(){return _0x47ebfb;});}else{return _0x47ebfb;}})[_0xb3c3('0x41')](function(_0x18ccde){logger[_0xb3c3('0x4d')](_0xb3c3('0x4e'),_0x18ccde);throw _0x18ccde;});}return _0x47ebfb;})[_0xb3c3('0x26')](respondWithResult(_0x519886,0xc9))[_0xb3c3('0x41')](handleError(_0x519886,null));};exports[_0xb3c3('0x24')]=function(_0x36b584,_0x44609a){if(_0x36b584[_0xb3c3('0x4f')]['id']){delete _0x36b584[_0xb3c3('0x4f')]['id'];}return db['Variable'][_0xb3c3('0x45')]({'where':{'id':_0x36b584[_0xb3c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x44609a,null))[_0xb3c3('0x26')](saveUpdates(_0x36b584[_0xb3c3('0x4f')],null))[_0xb3c3('0x26')](respondWithResult(_0x44609a,null))[_0xb3c3('0x41')](handleError(_0x44609a,null));};exports[_0xb3c3('0x25')]=function(_0x21d9e8,_0x178988){return db['Variable'][_0xb3c3('0x45')]({'where':{'id':_0x21d9e8['params']['id']}})[_0xb3c3('0x26')](handleEntityNotFound(_0x178988,null))[_0xb3c3('0x26')](removeEntity(_0x178988,null))[_0xb3c3('0x41')](handleError(_0x178988,null));}; \ No newline at end of file +var _0x3ccb=['apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','role','Variables','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x967492,_0xc41af){var _0x3f7088=function(_0x2d6738){while(--_0x2d6738){_0x967492['push'](_0x967492['shift']());}};_0x3f7088(++_0xc41af);}(_0x3ccb,0xdb));var _0xb3cc=function(_0x18f790,_0x2685ac){_0x18f790=_0x18f790-0x0;var _0x10488c=_0x3ccb[_0x18f790];return _0x10488c;};'use strict';var pdf=require(_0xb3cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3cc('0x1'));var zipdir=require(_0xb3cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3cc('0x3'));var util=require(_0xb3cc('0x4'));var path=require(_0xb3cc('0x5'));var sox=require(_0xb3cc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3cc('0x7'));var squel=require('squel');var crypto=require(_0xb3cc('0x8'));var jsforce=require(_0xb3cc('0x9'));var deskjs=require(_0xb3cc('0xa'));var toCsv=require(_0xb3cc('0xb'));var querystring=require(_0xb3cc('0xc'));var Papa=require(_0xb3cc('0xd'));var Redis=require(_0xb3cc('0xe'));var authService=require(_0xb3cc('0xf'));var qs=require(_0xb3cc('0x10'));var as=require(_0xb3cc('0x11'));var hardwareService=require(_0xb3cc('0x12'));var logger=require(_0xb3cc('0x13'))(_0xb3cc('0x14'));var utils=require(_0xb3cc('0x15'));var config=require(_0xb3cc('0x16'));var licenseUtil=require(_0xb3cc('0x17'));var db=require(_0xb3cc('0x18'))['db'];function respondWithStatusCode(_0x302699,_0x4579fb){_0x4579fb=_0x4579fb||0xcc;return function(_0x36935c){if(_0x36935c){return _0x302699[_0xb3cc('0x19')](_0x4579fb);}return _0x302699[_0xb3cc('0x1a')](_0x4579fb)['end']();};}function respondWithResult(_0xcb1402,_0x402685){_0x402685=_0x402685||0xc8;return function(_0x20658e){if(_0x20658e){return _0xcb1402[_0xb3cc('0x1a')](_0x402685)[_0xb3cc('0x1b')](_0x20658e);}};}function respondWithFilteredResult(_0x19d73e,_0x509d76){return function(_0x43a649){if(_0x43a649){var _0x3e234c=_0x43a649[_0xb3cc('0x1c')],_0x852398=_0x509d76[_0xb3cc('0x1d')],_0x16ce0c=_0x509d76[_0xb3cc('0x1d')]+_0x509d76[_0xb3cc('0x1e')],_0x3c240f;if(_0x16ce0c>=_0x3e234c){_0x16ce0c=_0x3e234c;_0x3c240f=0xc8;}else{_0x3c240f=0xce;}_0x19d73e[_0xb3cc('0x1a')](_0x3c240f);return _0x19d73e[_0xb3cc('0x1f')](_0xb3cc('0x20'),_0x852398+'-'+_0x16ce0c+'/'+_0x3e234c)['json'](_0x43a649);}return null;};}function patchUpdates(_0xea8309){return function(_0x40230f){try{jsonpatch[_0xb3cc('0x21')](_0x40230f,_0xea8309,!![]);}catch(_0x3d3733){return BPromise[_0xb3cc('0x22')](_0x3d3733);}return _0x40230f[_0xb3cc('0x23')]();};}function saveUpdates(_0x29eb85,_0x2c10ee){return function(_0x2a42ab){if(_0x2a42ab){return _0x2a42ab[_0xb3cc('0x24')](_0x29eb85)[_0xb3cc('0x25')](function(_0xc11f90){return _0xc11f90;});}return null;};}function removeEntity(_0x5244e1,_0xb74ad0){return function(_0x4bb5d1){if(_0x4bb5d1){return _0x4bb5d1[_0xb3cc('0x26')]()[_0xb3cc('0x25')](function(){var _0x54d158=_0x4bb5d1[_0xb3cc('0x27')]({'plain':!![]});var _0x4e59fe='Variables';return db[_0xb3cc('0x28')][_0xb3cc('0x26')]({'where':{'type':_0x4e59fe,'resourceId':_0x54d158['id']}})[_0xb3cc('0x25')](function(){return _0x4bb5d1;});})[_0xb3cc('0x25')](function(){_0x5244e1[_0xb3cc('0x1a')](0xcc)[_0xb3cc('0x29')]();});}};}function handleEntityNotFound(_0x2d2059,_0x1604a7){return function(_0x490e06){if(!_0x490e06){_0x2d2059['sendStatus'](0x194);}return _0x490e06;};}function handleError(_0x32d6fe,_0x5e44c9){_0x5e44c9=_0x5e44c9||0x1f4;return function(_0x31fc14){logger[_0xb3cc('0x2a')](_0x31fc14[_0xb3cc('0x2b')]);if(_0x31fc14[_0xb3cc('0x2c')]){delete _0x31fc14[_0xb3cc('0x2c')];}_0x32d6fe[_0xb3cc('0x1a')](_0x5e44c9)[_0xb3cc('0x2d')](_0x31fc14);};}exports[_0xb3cc('0x2e')]=function(_0x4d1353,_0x3cd8a2){var _0x45707f={},_0x1d79d5={},_0x422187={'count':0x0,'rows':[]};var _0x57acfb=_[_0xb3cc('0x2f')](db['Variable'][_0xb3cc('0x30')],function(_0x563702){return{'name':_0x563702[_0xb3cc('0x31')],'type':_0x563702[_0xb3cc('0x32')][_0xb3cc('0x33')]};});_0x1d79d5[_0xb3cc('0x34')]=_[_0xb3cc('0x2f')](_0x57acfb,'name');_0x1d79d5['query']=_['keys'](_0x4d1353['query']);_0x1d79d5[_0xb3cc('0x35')]=_[_0xb3cc('0x36')](_0x1d79d5['model'],_0x1d79d5[_0xb3cc('0x37')]);_0x45707f[_0xb3cc('0x38')]=_[_0xb3cc('0x36')](_0x1d79d5['model'],qs['fields'](_0x4d1353[_0xb3cc('0x37')]['fields']));_0x45707f[_0xb3cc('0x38')]=_0x45707f[_0xb3cc('0x38')][_0xb3cc('0x39')]?_0x45707f['attributes']:_0x1d79d5[_0xb3cc('0x34')];if(!_0x4d1353[_0xb3cc('0x37')]['hasOwnProperty'](_0xb3cc('0x3a'))){_0x45707f['limit']=qs['limit'](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x1e')]);_0x45707f[_0xb3cc('0x1d')]=qs['offset'](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x1d')]);}_0x45707f[_0xb3cc('0x3b')]=qs[_0xb3cc('0x3c')](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x3c')]);_0x45707f[_0xb3cc('0x3d')]=qs['filters'](_[_0xb3cc('0x3e')](_0x4d1353[_0xb3cc('0x37')],_0x1d79d5['filters']),_0x57acfb);if(_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x3f')]){_0x45707f[_0xb3cc('0x3d')]=_[_0xb3cc('0x40')](_0x45707f[_0xb3cc('0x3d')],{'$or':_[_0xb3cc('0x2f')](_0x57acfb,function(_0x5ebc64){if(_0x5ebc64[_0xb3cc('0x32')]!==_0xb3cc('0x41')){var _0x5ee616={};_0x5ee616[_0x5ebc64[_0xb3cc('0x2c')]]={'$like':'%'+_0x4d1353[_0xb3cc('0x37')]['filter']+'%'};return _0x5ee616;}})});}_0x45707f=_[_0xb3cc('0x40')]({},_0x45707f,_0x4d1353[_0xb3cc('0x42')]);var _0x4a4040={'where':_0x45707f[_0xb3cc('0x3d')]};return db[_0xb3cc('0x43')][_0xb3cc('0x1c')](_0x4a4040)[_0xb3cc('0x25')](function(_0x193171){_0x422187['count']=_0x193171;if(_0x4d1353['query'][_0xb3cc('0x44')]){_0x45707f[_0xb3cc('0x45')]=[{'all':!![]}];}return db[_0xb3cc('0x43')][_0xb3cc('0x46')](_0x45707f);})[_0xb3cc('0x25')](function(_0x38f817){_0x422187[_0xb3cc('0x47')]=_0x38f817;return _0x422187;})[_0xb3cc('0x25')](respondWithFilteredResult(_0x3cd8a2,_0x45707f))[_0xb3cc('0x48')](handleError(_0x3cd8a2,null));};exports[_0xb3cc('0x49')]=function(_0x1a4266,_0x5237ee){var _0x30f67d={'raw':!![],'where':{'id':_0x1a4266[_0xb3cc('0x4a')]['id']}},_0x407e66={};_0x407e66[_0xb3cc('0x34')]=_['keys'](db[_0xb3cc('0x43')][_0xb3cc('0x30')]);_0x407e66[_0xb3cc('0x37')]=_['keys'](_0x1a4266[_0xb3cc('0x37')]);_0x407e66[_0xb3cc('0x35')]=_[_0xb3cc('0x36')](_0x407e66[_0xb3cc('0x34')],_0x407e66['query']);_0x30f67d[_0xb3cc('0x38')]=_[_0xb3cc('0x36')](_0x407e66[_0xb3cc('0x34')],qs[_0xb3cc('0x4b')](_0x1a4266[_0xb3cc('0x37')][_0xb3cc('0x4b')]));_0x30f67d[_0xb3cc('0x38')]=_0x30f67d['attributes'][_0xb3cc('0x39')]?_0x30f67d[_0xb3cc('0x38')]:_0x407e66['model'];if(_0x1a4266['query'][_0xb3cc('0x44')]){_0x30f67d[_0xb3cc('0x45')]=[{'all':!![]}];}_0x30f67d=_[_0xb3cc('0x40')]({},_0x30f67d,_0x1a4266[_0xb3cc('0x42')]);return db[_0xb3cc('0x43')][_0xb3cc('0x4c')](_0x30f67d)['then'](handleEntityNotFound(_0x5237ee,null))[_0xb3cc('0x25')](respondWithResult(_0x5237ee,null))['catch'](handleError(_0x5237ee,null));};exports['create']=function(_0x4ffdfe,_0x6f8349){return db['Variable'][_0xb3cc('0x4d')](_0x4ffdfe[_0xb3cc('0x4e')],{})[_0xb3cc('0x25')](function(_0x3e7176){var _0x467c8c=_0x4ffdfe['user'][_0xb3cc('0x27')]({'plain':!![]});if(!_0x467c8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467c8c[_0xb3cc('0x4f')]==='user'){var _0x2a13bf=_0x3e7176[_0xb3cc('0x27')]({'plain':!![]});var _0xf8466a=_0xb3cc('0x50');return db[_0xb3cc('0x51')][_0xb3cc('0x4c')]({'where':{'name':_0xf8466a,'userProfileId':_0x467c8c[_0xb3cc('0x52')]},'raw':!![]})[_0xb3cc('0x25')](function(_0x381693){if(_0x381693&&_0x381693[_0xb3cc('0x53')]===0x0){return db[_0xb3cc('0x28')][_0xb3cc('0x4d')]({'name':_0x2a13bf[_0xb3cc('0x2c')],'resourceId':_0x2a13bf['id'],'type':_0x381693[_0xb3cc('0x2c')],'sectionId':_0x381693['id']},{})[_0xb3cc('0x25')](function(){return _0x3e7176;});}else{return _0x3e7176;}})[_0xb3cc('0x48')](function(_0x2a147d){logger[_0xb3cc('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a147d);throw _0x2a147d;});}return _0x3e7176;})[_0xb3cc('0x25')](respondWithResult(_0x6f8349,0xc9))[_0xb3cc('0x48')](handleError(_0x6f8349,null));};exports[_0xb3cc('0x24')]=function(_0x586017,_0x52275f){if(_0x586017[_0xb3cc('0x4e')]['id']){delete _0x586017[_0xb3cc('0x4e')]['id'];}return db['Variable'][_0xb3cc('0x4c')]({'where':{'id':_0x586017['params']['id']}})[_0xb3cc('0x25')](handleEntityNotFound(_0x52275f,null))[_0xb3cc('0x25')](saveUpdates(_0x586017['body'],null))[_0xb3cc('0x25')](respondWithResult(_0x52275f,null))[_0xb3cc('0x48')](handleError(_0x52275f,null));};exports[_0xb3cc('0x26')]=function(_0x4dfd3d,_0x1c95e4){return db['Variable']['find']({'where':{'id':_0x4dfd3d[_0xb3cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c95e4,null))[_0xb3cc('0x25')](removeEntity(_0x1c95e4,null))[_0xb3cc('0x48')](handleError(_0x1c95e4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7a9c42d..049d6f2 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 _0xc30d=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc30d,0x6e));var _0xdc30=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0xc30d[_0x1da10a];return _0x5aea64;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var logger=require(_0xdc30('0x1'))(_0xdc30('0x2'));var moment=require(_0xdc30('0x3'));var BPromise=require(_0xdc30('0x4'));var rp=require(_0xdc30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc30('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc30('0x7'));module[_0xdc30('0x8')]=function(_0x1d2db4,_0x3e480e){return _0x1d2db4[_0xdc30('0x9')](_0xdc30('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbed7=['rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xd7d9c0,_0x3b375b){var _0x31a50a=function(_0x2e3bf0){while(--_0x2e3bf0){_0xd7d9c0['push'](_0xd7d9c0['shift']());}};_0x31a50a(++_0x3b375b);}(_0xbed7,0x14b));var _0x7bed=function(_0x39f6b8,_0xca7eb2){_0x39f6b8=_0x39f6b8-0x0;var _0x403b8f=_0xbed7[_0x39f6b8];return _0x403b8f;};'use strict';var _=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var logger=require(_0x7bed('0x2'))(_0x7bed('0x3'));var moment=require(_0x7bed('0x4'));var BPromise=require('bluebird');var rp=require(_0x7bed('0x5'));var fs=require('fs');var path=require(_0x7bed('0x6'));var rimraf=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var attributes=require(_0x7bed('0x9'));module[_0x7bed('0xa')]=function(_0x41c148,_0x3aa0e9){return _0x41c148[_0x7bed('0xb')]('Variable',attributes,{'tableName':_0x7bed('0xc'),'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 3420151..251c91e 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 _0xd19d=['message','result','catch','ShowVariable','find','options','raw','where','include','map','attributes','model','debug','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xd19d,0x11b));var _0xdd19=function(_0x3b37bd,_0x36c79b){_0x3b37bd=_0x3b37bd-0x0;var _0x7fd5f9=_0xd19d[_0x3b37bd];return _0x7fd5f9;};'use strict';var _=require('lodash');var util=require(_0xdd19('0x0'));var moment=require('moment');var BPromise=require(_0xdd19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd19('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd19('0x3'))(_0xdd19('0x4'));var config=require('../../config/environment');var jayson=require(_0xdd19('0x5'));var client=jayson[_0xdd19('0x6')][_0xdd19('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x340bd9,_0x434270,_0x2071f6){return new BPromise(function(_0x49e3c5,_0x1d99bd){return client[_0xdd19('0x8')](_0x340bd9,_0x2071f6)[_0xdd19('0x9')](function(_0x3a34a6){logger[_0xdd19('0xa')]('Variable,\x20%s,\x20%s',_0x434270,_0xdd19('0xb'));logger['debug'](_0xdd19('0xc'),_0x434270,_0xdd19('0xb'),JSON[_0xdd19('0xd')](_0x3a34a6));if(_0x3a34a6[_0xdd19('0xe')]){if(_0x3a34a6['error'][_0xdd19('0xf')]===0x1f4){logger[_0xdd19('0xe')](_0xdd19('0x10'),_0x434270,_0x3a34a6[_0xdd19('0xe')][_0xdd19('0x11')]);return _0x1d99bd(_0x3a34a6[_0xdd19('0xe')][_0xdd19('0x11')]);}logger['error']('Variable,\x20%s,\x20%s',_0x434270,_0x3a34a6[_0xdd19('0xe')]['message']);return _0x49e3c5(_0x3a34a6['error'][_0xdd19('0x11')]);}else{logger['info'](_0xdd19('0x10'),_0x434270,_0xdd19('0xb'));_0x49e3c5(_0x3a34a6[_0xdd19('0x12')][_0xdd19('0x11')]);}})[_0xdd19('0x13')](function(_0x7d9151){logger[_0xdd19('0xe')](_0xdd19('0x10'),_0x434270,_0x7d9151);_0x1d99bd(_0x7d9151);});});}exports[_0xdd19('0x14')]=function(_0xec0b87){var _0x55c324=this;return new Promise(function(_0x5405b3,_0x2c503f){return db['Variable'][_0xdd19('0x15')]({'raw':_0xec0b87[_0xdd19('0x16')]?_0xec0b87[_0xdd19('0x16')][_0xdd19('0x17')]===undefined?!![]:![]:!![],'where':_0xec0b87[_0xdd19('0x16')]?_0xec0b87[_0xdd19('0x16')][_0xdd19('0x18')]||null:null,'attributes':_0xec0b87['options']?_0xec0b87['options']['attributes']||null:null,'include':_0xec0b87[_0xdd19('0x16')]?_0xec0b87['options'][_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0xec0b87['options'][_0xdd19('0x19')],function(_0x15c608){return{'model':db[_0x15c608['model']],'as':_0x15c608['as'],'attributes':_0x15c608[_0xdd19('0x1b')],'include':_0x15c608[_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0x15c608[_0xdd19('0x19')],function(_0x19af50){return{'model':db[_0x19af50[_0xdd19('0x1c')]],'as':_0x19af50['as'],'attributes':_0x19af50[_0xdd19('0x1b')],'include':_0x19af50[_0xdd19('0x19')]?_[_0xdd19('0x1a')](_0x19af50[_0xdd19('0x19')],function(_0x48bd21){return{'model':db[_0x48bd21[_0xdd19('0x1c')]],'as':_0x48bd21['as'],'attributes':_0x48bd21[_0xdd19('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdd19('0x9')](function(_0xa12dd){logger[_0xdd19('0xa')](_0xdd19('0x14'),_0xec0b87);logger[_0xdd19('0x1d')](_0xdd19('0x14'),_0xec0b87,JSON[_0xdd19('0xd')](_0xa12dd));_0x5405b3(_0xa12dd);})[_0xdd19('0x13')](function(_0x10a50a){logger[_0xdd19('0xe')]('ShowVariable',_0x10a50a[_0xdd19('0x11')],_0xec0b87);_0x2c503f(_0x55c324[_0xdd19('0xe')](0x1f4,_0x10a50a[_0xdd19('0x11')]));});});}; \ No newline at end of file +var _0xfb48=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowVariable','Variable','options','raw','where','attributes','include','map','then','lodash','bluebird'];(function(_0x2fe299,_0x2e1408){var _0x3e7659=function(_0x399706){while(--_0x399706){_0x2fe299['push'](_0x2fe299['shift']());}};_0x3e7659(++_0x2e1408);}(_0xfb48,0x1eb));var _0x8fb4=function(_0x37cd82,_0x2266ab){_0x37cd82=_0x37cd82-0x0;var _0x53de39=_0xfb48[_0x37cd82];return _0x53de39;};'use strict';var _=require(_0x8fb4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8fb4('0x1'));var rs=require(_0x8fb4('0x2'));var fs=require('fs');var Redis=require(_0x8fb4('0x3'));var db=require(_0x8fb4('0x4'))['db'];var utils=require(_0x8fb4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fb4('0x6'));var jayson=require(_0x8fb4('0x7'));var client=jayson['client'][_0x8fb4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x209286,_0x4f9d2b,_0xcd5bd6){return new BPromise(function(_0x1ee7f7,_0x3ab733){return client[_0x8fb4('0x9')](_0x209286,_0xcd5bd6)['then'](function(_0x2ea61b){logger['info'](_0x8fb4('0xa'),_0x4f9d2b,'request\x20sent');logger[_0x8fb4('0xb')]('Variable,\x20%s,\x20%s,\x20%s',_0x4f9d2b,_0x8fb4('0xc'),JSON[_0x8fb4('0xd')](_0x2ea61b));if(_0x2ea61b[_0x8fb4('0xe')]){if(_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0xf')]===0x1f4){logger[_0x8fb4('0xe')](_0x8fb4('0xa'),_0x4f9d2b,_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);return _0x3ab733(_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);}logger[_0x8fb4('0xe')](_0x8fb4('0xa'),_0x4f9d2b,_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);return _0x1ee7f7(_0x2ea61b['error']['message']);}else{logger[_0x8fb4('0x11')](_0x8fb4('0xa'),_0x4f9d2b,_0x8fb4('0xc'));_0x1ee7f7(_0x2ea61b[_0x8fb4('0x12')]['message']);}})[_0x8fb4('0x13')](function(_0x2a1028){logger['error'](_0x8fb4('0xa'),_0x4f9d2b,_0x2a1028);_0x3ab733(_0x2a1028);});});}exports[_0x8fb4('0x14')]=function(_0x585faa){var _0x23ec59=this;return new Promise(function(_0x146eaa,_0x58be94){return db[_0x8fb4('0x15')]['find']({'raw':_0x585faa['options']?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x17')]===undefined?!![]:![]:!![],'where':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x18')]||null:null,'attributes':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x19')]||null:null,'include':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x1a')]?_[_0x8fb4('0x1b')](_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x1a')],function(_0x14bd6d){return{'model':db[_0x14bd6d['model']],'as':_0x14bd6d['as'],'attributes':_0x14bd6d['attributes'],'include':_0x14bd6d['include']?_['map'](_0x14bd6d[_0x8fb4('0x1a')],function(_0x1e9c06){return{'model':db[_0x1e9c06['model']],'as':_0x1e9c06['as'],'attributes':_0x1e9c06[_0x8fb4('0x19')],'include':_0x1e9c06[_0x8fb4('0x1a')]?_[_0x8fb4('0x1b')](_0x1e9c06[_0x8fb4('0x1a')],function(_0x344a97){return{'model':db[_0x344a97['model']],'as':_0x344a97['as'],'attributes':_0x344a97[_0x8fb4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8fb4('0x1c')](function(_0x46f9fe){logger[_0x8fb4('0x11')](_0x8fb4('0x14'),_0x585faa);logger[_0x8fb4('0xb')](_0x8fb4('0x14'),_0x585faa,JSON[_0x8fb4('0xd')](_0x46f9fe));_0x146eaa(_0x46f9fe);})['catch'](function(_0x1d7375){logger[_0x8fb4('0xe')]('ShowVariable',_0x1d7375[_0x8fb4('0x10')],_0x585faa);_0x58be94(_0x23ec59[_0x8fb4('0xe')](0x1f4,_0x1d7375[_0x8fb4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1fb51e6..26c1442 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 _0x8558=['pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate'];(function(_0x211a8f,_0x1dc64b){var _0x2a3a6b=function(_0x19b901){while(--_0x19b901){_0x211a8f['push'](_0x211a8f['shift']());}};_0x2a3a6b(++_0x1dc64b);}(_0x8558,0x1c5));var _0x8855=function(_0x1ac27b,_0x50f711){_0x1ac27b=_0x1ac27b-0x0;var _0x1a4920=_0x8558[_0x1ac27b];return _0x1a4920;};'use strict';var express=require(_0x8855('0x0'));var router=express[_0x8855('0x1')]();var auth=require(_0x8855('0x2'));var controller=require(_0x8855('0x3'));router[_0x8855('0x4')]('/',controller[_0x8855('0x5')]);router[_0x8855('0x4')](_0x8855('0x6'),auth[_0x8855('0x7')](),auth['canUpdate'](),controller[_0x8855('0x8')]);router[_0x8855('0x4')](_0x8855('0x9'),auth[_0x8855('0x7')](),auth[_0x8855('0xa')](),controller['reset']);router[_0x8855('0x4')]('/pull',auth[_0x8855('0x7')](),auth[_0x8855('0xa')](),controller[_0x8855('0xb')]);router[_0x8855('0x4')]('/restart',auth[_0x8855('0x7')](),controller[_0x8855('0xc')]);router[_0x8855('0x4')](_0x8855('0xd'),controller[_0x8855('0xe')]);module[_0x8855('0xf')]=router; \ No newline at end of file +var _0x75b4=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','canUpdate','/pull','pull','/restart','migrations','exports','Router'];(function(_0x51da3e,_0x586ae1){var _0x49ca6e=function(_0x4f1055){while(--_0x4f1055){_0x51da3e['push'](_0x51da3e['shift']());}};_0x49ca6e(++_0x586ae1);}(_0x75b4,0xc2));var _0x475b=function(_0xb90eac,_0xb8941d){_0xb90eac=_0xb90eac-0x0;var _0x24c911=_0x75b4[_0xb90eac];return _0x24c911;};'use strict';var express=require('express');var router=express[_0x475b('0x0')]();var auth=require(_0x475b('0x1'));var controller=require(_0x475b('0x2'));router['get']('/',controller['index']);router[_0x475b('0x3')](_0x475b('0x4'),auth[_0x475b('0x5')](),auth['canUpdate'](),controller[_0x475b('0x6')]);router[_0x475b('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x475b('0x7')](),controller['reset']);router[_0x475b('0x3')](_0x475b('0x8'),auth[_0x475b('0x5')](),auth['canUpdate'](),controller[_0x475b('0x9')]);router[_0x475b('0x3')](_0x475b('0xa'),auth[_0x475b('0x5')](),controller['restart']);router[_0x475b('0x3')]('/migrations',controller[_0x475b('0xb')]);module[_0x475b('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0672971..4c7b123 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 _0xb4b6=['2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','npm\x20install\x20--production','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','migrations','.js','push','length','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','last','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x5e3147,_0x4bcdad){var _0x2a8609=function(_0x536fd2){while(--_0x536fd2){_0x5e3147['push'](_0x5e3147['shift']());}};_0x2a8609(++_0x4bcdad);}(_0xb4b6,0x7e));var _0x6b4b=function(_0xd9a3dd,_0x391f20){_0xd9a3dd=_0xd9a3dd-0x0;var _0x203c67=_0xb4b6[_0xd9a3dd];return _0x203c67;};'use strict';var Umzug=require('umzug');var path=require(_0x6b4b('0x0'));var fs=require('fs');var _=require(_0x6b4b('0x1'));var pkginfo=require(_0x6b4b('0x2'))(module,_0x6b4b('0x3'));var compareVersions=require(_0x6b4b('0x4'));var exec=require(_0x6b4b('0x5'))[_0x6b4b('0x6')];var db=require(_0x6b4b('0x7'))['db'];var config=require(_0x6b4b('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x6b4b('0x9'))('update');var git=require(_0x6b4b('0xa'))(config[_0x6b4b('0xb')]);exports[_0x6b4b('0xc')]=function(_0x127577,_0x2e6b81){var _0x572b2d={'current':module[_0x6b4b('0xd')][_0x6b4b('0x3')],'phonebar':0x2};if(_0x127577[_0x6b4b('0xe')]&&_0x127577[_0x6b4b('0xe')][_0x6b4b('0xf')]){return git[_0x6b4b('0x10')]()[_0x6b4b('0x11')](function(_0x214ebb,_0x54b8b6){_0x572b2d[_0x6b4b('0xf')]=(_0x214ebb?module['exports'][_0x6b4b('0x3')]:_0x54b8b6[_0x6b4b('0xf')])||_0x6b4b('0x12');return _0x2e6b81[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')](_0x572b2d);});}else{return _0x2e6b81[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')](_0x572b2d);}};exports['fetch']=function(_0x38c40f,_0x2acc64){return git[_0x6b4b('0x10')](['origin','master'],function(_0x39390c){if(_0x39390c){logger[_0x6b4b('0x15')](_0x39390c);return _0x2acc64['status'](0x1f4)[_0x6b4b('0x14')](_0x39390c);}logger[_0x6b4b('0x16')](_0x6b4b('0x17'));return _0x2acc64[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x18')});});};exports[_0x6b4b('0x19')]=function(_0xc3e02c,_0x15333b){return git['reset'](['--hard',_0x6b4b('0x1a')],function(_0x5b37ce){if(_0x5b37ce){logger[_0x6b4b('0x15')](_0x5b37ce);return _0x15333b[_0x6b4b('0x13')](0x1f4)[_0x6b4b('0x14')](_0x5b37ce);}logger[_0x6b4b('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x15333b[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x5ec8a9,_0x4735eb){exec(_0x6b4b('0x1b'),function(_0x203f2a,_0x222e23,_0x1a9fba){logger['info'](_0x222e23);logger[_0x6b4b('0x16')](_0x1a9fba);if(_0x203f2a){logger[_0x6b4b('0x15')](_0x203f2a);return _0x4735eb[_0x6b4b('0x13')](0x1f4)[_0x6b4b('0x14')](_0x203f2a);}return _0x4735eb['status'](0xc8)['json']({'output':_0x222e23});});};exports['restart']=function(_0x4c4ecc,_0x17f017){return pm2['restart']('motion2')[_0x6b4b('0x1c')](function(_0x2cbe79){logger[_0x6b4b('0x16')](_0x6b4b('0x1d'),_0x2cbe79);return _0x17f017['status'](0xc8)['json']({'output':_0x6b4b('0x1e')});})[_0x6b4b('0x1f')](function(_0x2973f){logger[_0x6b4b('0x15')](_0x2973f);return _0x17f017['status'](0x1f4)[_0x6b4b('0x14')](_0x2973f);});};exports['migrations']=function(_0x1c2f42,_0x1ab47c){var _0x334cf8=fs['readdirSync'](path[_0x6b4b('0x20')](config[_0x6b4b('0xb')],_0x6b4b('0x21'),_0x6b4b('0x22')));var _0x102305=[];for(var _0x1ab7de=0x0;_0x1ab7de<_0x334cf8['length'];_0x1ab7de++){var _0x509a54=_0x334cf8[_0x1ab7de]['replace'](_0x6b4b('0x23'),'');if(compareVersions(module[_0x6b4b('0xd')][_0x6b4b('0x3')],_0x509a54)===-0x1){_0x102305[_0x6b4b('0x24')](_0x509a54);}}if(_0x102305[_0x6b4b('0x25')]){var _0x44788f=_0x102305['sort'](compareVersions);var _0x5798b3=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6b4b('0x26')],'modelName':'Migration','columnName':_0x6b4b('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x6b4b('0x27')],function(){throw new Error(_0x6b4b('0x28'));}],'path':path[_0x6b4b('0x20')](config[_0x6b4b('0xb')],_0x6b4b('0x21'),'migrations'),'pattern':/\.js$/}});_0x5798b3['up']({'migrations':_[_0x6b4b('0x29')](_0x44788f,function(_0x5c5efb){return _0x5c5efb+_0x6b4b('0x23');})})['then'](function(){return _0x1ab47c[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2a')+module['exports'][_0x6b4b('0x3')]+_0x6b4b('0x2b')+_[_0x6b4b('0x2c')](_0x44788f),'migrations':_['join'](_0x44788f)});})['catch'](function(_0x1d27a3){if(_0x1d27a3 instanceof db[_0x6b4b('0x2d')][_0x6b4b('0x2e')]){return _0x1ab47c[_0x6b4b('0x13')](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2f')});}else{return _0x1ab47c['status'](0x1f4)[_0x6b4b('0x14')](_0x1d27a3);}});}else{return _0x1ab47c['status'](0xc8)[_0x6b4b('0x14')]({'output':_0x6b4b('0x2f')});}}; \ No newline at end of file +var _0x29b7=['migrations','readdirSync','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x383b0f,_0x137a87){var _0x419636=function(_0x3fca2c){while(--_0x3fca2c){_0x383b0f['push'](_0x383b0f['shift']());}};_0x419636(++_0x137a87);}(_0x29b7,0x17d));var _0x729b=function(_0x125f28,_0x102cde){_0x125f28=_0x125f28-0x0;var _0x212813=_0x29b7[_0x125f28];return _0x212813;};'use strict';var Umzug=require('umzug');var path=require(_0x729b('0x0'));var fs=require('fs');var _=require(_0x729b('0x1'));var pkginfo=require(_0x729b('0x2'))(module,_0x729b('0x3'));var compareVersions=require(_0x729b('0x4'));var exec=require(_0x729b('0x5'))[_0x729b('0x6')];var db=require(_0x729b('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x729b('0x8'));var logger=require(_0x729b('0x9'))('update');var git=require(_0x729b('0xa'))(config[_0x729b('0xb')]);exports[_0x729b('0xc')]=function(_0x2c4252,_0x4d75fd){var _0x3df326={'current':module[_0x729b('0xd')][_0x729b('0x3')],'phonebar':0x2};if(_0x2c4252[_0x729b('0xe')]&&_0x2c4252[_0x729b('0xe')][_0x729b('0xf')]){return git['fetch']()[_0x729b('0x10')](function(_0x4bfdae,_0x3da764){_0x3df326[_0x729b('0xf')]=(_0x4bfdae?module[_0x729b('0xd')]['version']:_0x3da764[_0x729b('0xf')])||_0x729b('0x11');return _0x4d75fd[_0x729b('0x12')](0xc8)[_0x729b('0x13')](_0x3df326);});}else{return _0x4d75fd[_0x729b('0x12')](0xc8)['json'](_0x3df326);}};exports[_0x729b('0x14')]=function(_0x40fb58,_0x56883a){return git[_0x729b('0x14')]([_0x729b('0x15'),_0x729b('0x16')],function(_0xc89ca7){if(_0xc89ca7){logger[_0x729b('0x17')](_0xc89ca7);return _0x56883a['status'](0x1f4)['json'](_0xc89ca7);}logger[_0x729b('0x18')](_0x729b('0x19'));return _0x56883a[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x729b('0x1a')]=function(_0x18a434,_0x58fce1){return git[_0x729b('0x1a')]([_0x729b('0x1b'),_0x729b('0x1c')],function(_0x2b3a82){if(_0x2b3a82){logger[_0x729b('0x17')](_0x2b3a82);return _0x58fce1['status'](0x1f4)[_0x729b('0x13')](_0x2b3a82);}logger[_0x729b('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x58fce1[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0xf511cb,_0x91ad76){exec(_0x729b('0x1d'),function(_0x80814f,_0x31d58f,_0x257290){logger[_0x729b('0x18')](_0x31d58f);logger[_0x729b('0x18')](_0x257290);if(_0x80814f){logger['error'](_0x80814f);return _0x91ad76[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x80814f);}return _0x91ad76[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':_0x31d58f});});};exports[_0x729b('0x1e')]=function(_0x51608f,_0x28aa22){return pm2[_0x729b('0x1e')]('motion2')[_0x729b('0x1f')](function(_0x5d2baf){logger['info'](_0x729b('0x20'),_0x5d2baf);return _0x28aa22[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':_0x729b('0x21')});})[_0x729b('0x22')](function(_0x4ab773){logger[_0x729b('0x17')](_0x4ab773);return _0x28aa22[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x4ab773);});};exports[_0x729b('0x23')]=function(_0x11053e,_0x147797){var _0x41fe6a=fs[_0x729b('0x24')](path['join'](config[_0x729b('0xb')],_0x729b('0x25'),_0x729b('0x23')));var _0x4fe559=[];for(var _0x18d4fa=0x0;_0x18d4fa<_0x41fe6a[_0x729b('0x26')];_0x18d4fa++){var _0x3babe2=_0x41fe6a[_0x18d4fa]['replace'](_0x729b('0x27'),'');if(compareVersions(module[_0x729b('0xd')]['version'],_0x3babe2)===-0x1){_0x4fe559[_0x729b('0x28')](_0x3babe2);}}if(_0x4fe559['length']){var _0x26d51d=_0x4fe559[_0x729b('0x29')](compareVersions);var _0x4859a3=new Umzug({'storage':_0x729b('0x2a'),'storageOptions':{'model':db[_0x729b('0x2b')],'modelName':_0x729b('0x2b'),'columnName':_0x729b('0x3')},'migrations':{'params':[db[_0x729b('0x2a')][_0x729b('0x2c')](),db['sequelize'][_0x729b('0x2d')],function(){throw new Error(_0x729b('0x2e'));}],'path':path[_0x729b('0x2f')](config[_0x729b('0xb')],_0x729b('0x25'),_0x729b('0x23')),'pattern':/\.js$/}});_0x4859a3['up']({'migrations':_['map'](_0x26d51d,function(_0x1a9366){return _0x1a9366+_0x729b('0x27');})})['then'](function(){return _0x147797[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x729b('0xd')][_0x729b('0x3')]+_0x729b('0x30')+_[_0x729b('0x31')](_0x26d51d),'migrations':_[_0x729b('0x2f')](_0x26d51d)});})[_0x729b('0x22')](function(_0x319c17){if(_0x319c17 instanceof db[_0x729b('0x2a')][_0x729b('0x32')]){return _0x147797[_0x729b('0x12')](0xc8)['json']({'output':_0x729b('0x33')});}else{return _0x147797[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x319c17);}});}else{return _0x147797[_0x729b('0x12')](0xc8)['json']({'output':_0x729b('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 8375c3f..0e5423a 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 _0x4d22=['get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x499193,_0x5a6272){var _0x5e3dcc=function(_0x27afbc){while(--_0x27afbc){_0x499193['push'](_0x499193['shift']());}};_0x5e3dcc(++_0x5a6272);}(_0x4d22,0x7a));var _0x24d2=function(_0x24d70e,_0x78c804){_0x24d70e=_0x24d70e-0x0;var _0xc9176d=_0x4d22[_0x24d70e];return _0xc9176d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x24d2('0x0'));var timeout=require(_0x24d2('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x24d2('0x2'));var interaction=require(_0x24d2('0x3'));var config=require(_0x24d2('0x4'));var controller=require(_0x24d2('0x5'));router[_0x24d2('0x6')]('/',auth[_0x24d2('0x7')](),controller[_0x24d2('0x8')]);router[_0x24d2('0x6')]('/describe',auth[_0x24d2('0x7')](),controller[_0x24d2('0x9')]);router['get'](_0x24d2('0xa'),auth[_0x24d2('0x7')](),controller[_0x24d2('0xb')]);router[_0x24d2('0xc')]('/',auth[_0x24d2('0x7')](),controller['create']);router[_0x24d2('0xd')]('/:id',auth[_0x24d2('0x7')](),controller['update']);router['delete'](_0x24d2('0xa'),auth['isAuthenticated'](),controller[_0x24d2('0xe')]);module[_0x24d2('0xf')]=router; \ No newline at end of file +var _0x7995=['put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','create'];(function(_0x3df08b,_0x5bfd53){var _0x5a61f4=function(_0x8668db){while(--_0x8668db){_0x3df08b['push'](_0x3df08b['shift']());}};_0x5a61f4(++_0x5bfd53);}(_0x7995,0x1f4));var _0x5799=function(_0x49d750,_0x24815e){_0x49d750=_0x49d750-0x0;var _0x15184f=_0x7995[_0x49d750];return _0x15184f;};'use strict';var multer=require(_0x5799('0x0'));var util=require(_0x5799('0x1'));var path=require(_0x5799('0x2'));var timeout=require(_0x5799('0x3'));var express=require(_0x5799('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5799('0x5'));var config=require(_0x5799('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x5799('0x7')]('/',auth[_0x5799('0x8')](),controller['index']);router[_0x5799('0x7')]('/describe',auth[_0x5799('0x8')](),controller[_0x5799('0x9')]);router['get'](_0x5799('0xa'),auth[_0x5799('0x8')](),controller['show']);router['post']('/',auth[_0x5799('0x8')](),controller[_0x5799('0xb')]);router[_0x5799('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5799('0xd')]);router['delete'](_0x5799('0xa'),auth[_0x5799('0x8')](),controller[_0x5799('0xe')]);module[_0x5799('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 06154ae..2083de5 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 _0x038b=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x182b14,_0x856d25){var _0x41db1f=function(_0x2f346b){while(--_0x2f346b){_0x182b14['push'](_0x182b14['shift']());}};_0x41db1f(++_0x856d25);}(_0x038b,0x114));var _0xb038=function(_0x580816,_0x48f227){_0x580816=_0x580816-0x0;var _0x344250=_0x038b[_0x580816];return _0x344250;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'type':{'type':Sequelize[_0xb038('0x1')]},'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb038('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb038('0x1')]},'membername':{'type':Sequelize[_0xb038('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb038('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb038('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb038('0x3')]},'agentcomplete':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb038('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb038('0x1')]},'channelstate':{'type':Sequelize[_0xb038('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'connectedlinename':{'type':Sequelize[_0xb038('0x1')]},'language':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'context':{'type':Sequelize[_0xb038('0x1')]},'exten':{'type':Sequelize[_0xb038('0x1')]},'priority':{'type':Sequelize[_0xb038('0x1')]},'destchannel':{'type':Sequelize[_0xb038('0x1')]},'destchannelstate':{'type':Sequelize[_0xb038('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb038('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb038('0x1')]},'destcalleridname':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb038('0x1')]},'destlanguage':{'type':Sequelize[_0xb038('0x1')]},'destaccountcode':{'type':Sequelize[_0xb038('0x1')]},'destcontext':{'type':Sequelize[_0xb038('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb038('0x1')]},'destuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb038('0x1')]},'transfer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb038('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb038('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb038('0x1')]},'agententerreason':{'type':Sequelize[_0xb038('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d58=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x37a580,_0x3135a6){var _0x77d8d1=function(_0x4c719a){while(--_0x4c719a){_0x37a580['push'](_0x37a580['shift']());}};_0x77d8d1(++_0x3135a6);}(_0x5d58,0x187));var _0x85d5=function(_0x5f184e,_0x4fa6ac){_0x5f184e=_0x5f184e-0x0;var _0x50a519=_0x5d58[_0x5f184e];return _0x50a519;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x85d5('0x0')]},'queue':{'type':Sequelize[_0x85d5('0x0')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x85d5('0x0')]},'agentcalledAt':{'type':Sequelize[_0x85d5('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x85d5('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x85d5('0x1')]},'agentdumpAt':{'type':Sequelize[_0x85d5('0x1')]},'holdtime':{'type':Sequelize[_0x85d5('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x85d5('0x0')]},'lastevent':{'type':Sequelize[_0x85d5('0x0')]},'channel':{'type':Sequelize[_0x85d5('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x85d5('0x0')]},'language':{'type':Sequelize[_0x85d5('0x0')]},'accountcode':{'type':Sequelize[_0x85d5('0x0')]},'context':{'type':Sequelize[_0x85d5('0x0')]},'exten':{'type':Sequelize[_0x85d5('0x0')]},'priority':{'type':Sequelize[_0x85d5('0x0')]},'destchannel':{'type':Sequelize[_0x85d5('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x85d5('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x85d5('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x85d5('0x0')]},'destlanguage':{'type':Sequelize[_0x85d5('0x0')]},'destaccountcode':{'type':Sequelize[_0x85d5('0x0')]},'destcontext':{'type':Sequelize[_0x85d5('0x0')]},'destexten':{'type':Sequelize[_0x85d5('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x85d5('0x0')]},'transfer':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x85d5('0x0')],'comment':_0x85d5('0x4')},'transferexten':{'type':Sequelize[_0x85d5('0x0')]},'transferuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'agententerreason':{'type':Sequelize[_0x85d5('0x2')],'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 4045036..1a76e85 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 _0xd5c3=['offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','VoiceAgentReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','rawAttributes','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x265971,_0x41453e){var _0x4a6d7a=function(_0x2a2925){while(--_0x2a2925){_0x265971['push'](_0x265971['shift']());}};_0x4a6d7a(++_0x41453e);}(_0xd5c3,0x1a7));var _0x3d5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3d5c('0x0'));var emlformat=require(_0x3d5c('0x1'));var rimraf=require(_0x3d5c('0x2'));var zipdir=require(_0x3d5c('0x3'));var jsonpatch=require(_0x3d5c('0x4'));var rp=require(_0x3d5c('0x5'));var moment=require(_0x3d5c('0x6'));var BPromise=require(_0x3d5c('0x7'));var Mustache=require('mustache');var util=require(_0x3d5c('0x8'));var path=require(_0x3d5c('0x9'));var sox=require(_0x3d5c('0xa'));var csv=require(_0x3d5c('0xb'));var ejs=require(_0x3d5c('0xc'));var fs=require('fs');var _=require(_0x3d5c('0xd'));var squel=require(_0x3d5c('0xe'));var crypto=require(_0x3d5c('0xf'));var jsforce=require(_0x3d5c('0x10'));var deskjs=require(_0x3d5c('0x11'));var toCsv=require(_0x3d5c('0xb'));var querystring=require(_0x3d5c('0x12'));var Papa=require('papaparse');var Redis=require(_0x3d5c('0x13'));var authService=require(_0x3d5c('0x14'));var qs=require(_0x3d5c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d5c('0x16'));var logger=require(_0x3d5c('0x17'))(_0x3d5c('0x18'));var utils=require('../../config/utils');var config=require(_0x3d5c('0x19'));var licenseUtil=require(_0x3d5c('0x1a'));var db=require(_0x3d5c('0x1b'))['db'];function respondWithStatusCode(_0x62fb81,_0x5f036f){_0x5f036f=_0x5f036f||0xcc;return function(_0x5d5489){if(_0x5d5489){return _0x62fb81[_0x3d5c('0x1c')](_0x5f036f);}return _0x62fb81[_0x3d5c('0x1d')](_0x5f036f)[_0x3d5c('0x1e')]();};}function respondWithResult(_0x21b618,_0x4f249c){_0x4f249c=_0x4f249c||0xc8;return function(_0x21a8c6){if(_0x21a8c6){return _0x21b618[_0x3d5c('0x1d')](_0x4f249c)[_0x3d5c('0x1f')](_0x21a8c6);}};}function respondWithFilteredResult(_0x51ffd7,_0x57e517){return function(_0x545f15){if(_0x545f15){var _0x2fa8bc=_0x545f15[_0x3d5c('0x20')],_0x151e91=_0x57e517[_0x3d5c('0x21')],_0x53fbaf=_0x57e517['offset']+_0x57e517[_0x3d5c('0x22')],_0x1ae9bd;if(_0x53fbaf>=_0x2fa8bc){_0x53fbaf=_0x2fa8bc;_0x1ae9bd=0xc8;}else{_0x1ae9bd=0xce;}_0x51ffd7['status'](_0x1ae9bd);return _0x51ffd7[_0x3d5c('0x23')](_0x3d5c('0x24'),_0x151e91+'-'+_0x53fbaf+'/'+_0x2fa8bc)[_0x3d5c('0x1f')](_0x545f15);}return null;};}function patchUpdates(_0x58153b){return function(_0xe54507){try{jsonpatch[_0x3d5c('0x25')](_0xe54507,_0x58153b,!![]);}catch(_0x52544d){return BPromise['reject'](_0x52544d);}return _0xe54507[_0x3d5c('0x26')]();};}function saveUpdates(_0x12ff88,_0x5a9d58){return function(_0x19a8ac){if(_0x19a8ac){return _0x19a8ac['update'](_0x12ff88)[_0x3d5c('0x27')](function(_0x1e6a08){return _0x1e6a08;});}return null;};}function removeEntity(_0x7f9893,_0x16947b){return function(_0xe15403){if(_0xe15403){return _0xe15403[_0x3d5c('0x28')]()[_0x3d5c('0x27')](function(){_0x7f9893['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb9cf,_0x27e988){return function(_0x3cb582){if(!_0x3cb582){_0x2eb9cf[_0x3d5c('0x1c')](0x194);}return _0x3cb582;};}function handleError(_0x484ae3,_0x23b33e){_0x23b33e=_0x23b33e||0x1f4;return function(_0x9d5752){logger['error'](_0x9d5752['stack']);if(_0x9d5752[_0x3d5c('0x29')]){delete _0x9d5752['name'];}_0x484ae3['status'](_0x23b33e)[_0x3d5c('0x2a')](_0x9d5752);};}exports[_0x3d5c('0x2b')]=function(_0x37e83e,_0x5956c3){var _0x2d6e7a={},_0x426fd1={},_0x5d3991={'count':0x0,'rows':[]};var _0x45f664=_[_0x3d5c('0x2c')](db[_0x3d5c('0x2d')]['rawAttributes'],function(_0x1c63b7){return{'name':_0x1c63b7['fieldName'],'type':_0x1c63b7[_0x3d5c('0x2e')][_0x3d5c('0x2f')]};});_0x426fd1[_0x3d5c('0x30')]=_[_0x3d5c('0x2c')](_0x45f664,'name');_0x426fd1[_0x3d5c('0x31')]=_[_0x3d5c('0x32')](_0x37e83e['query']);_0x426fd1[_0x3d5c('0x33')]=_[_0x3d5c('0x34')](_0x426fd1[_0x3d5c('0x30')],_0x426fd1[_0x3d5c('0x31')]);_0x2d6e7a[_0x3d5c('0x35')]=_[_0x3d5c('0x34')](_0x426fd1['model'],qs[_0x3d5c('0x36')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x36')]));_0x2d6e7a[_0x3d5c('0x35')]=_0x2d6e7a[_0x3d5c('0x35')][_0x3d5c('0x37')]?_0x2d6e7a['attributes']:_0x426fd1[_0x3d5c('0x30')];if(!_0x37e83e['query'][_0x3d5c('0x38')](_0x3d5c('0x39'))){_0x2d6e7a['limit']=qs[_0x3d5c('0x22')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x22')]);_0x2d6e7a[_0x3d5c('0x21')]=qs[_0x3d5c('0x21')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x21')]);}_0x2d6e7a[_0x3d5c('0x3a')]=qs[_0x3d5c('0x3b')](_0x37e83e[_0x3d5c('0x31')][_0x3d5c('0x3b')]);_0x2d6e7a[_0x3d5c('0x3c')]=qs[_0x3d5c('0x33')](_[_0x3d5c('0x3d')](_0x37e83e[_0x3d5c('0x31')],_0x426fd1[_0x3d5c('0x33')]),_0x45f664);if(_0x37e83e['query']['filter']){_0x2d6e7a[_0x3d5c('0x3c')]=_[_0x3d5c('0x3e')](_0x2d6e7a[_0x3d5c('0x3c')],{'$or':_[_0x3d5c('0x2c')](_0x45f664,function(_0x248b30){if(_0x248b30[_0x3d5c('0x2e')]!==_0x3d5c('0x3f')){var _0x599531={};_0x599531[_0x248b30[_0x3d5c('0x29')]]={'$like':'%'+_0x37e83e['query'][_0x3d5c('0x40')]+'%'};return _0x599531;}})});}_0x2d6e7a=_[_0x3d5c('0x3e')]({},_0x2d6e7a,_0x37e83e[_0x3d5c('0x41')]);var _0x3cee66={'where':_0x2d6e7a['where']};return db[_0x3d5c('0x2d')]['count'](_0x3cee66)[_0x3d5c('0x27')](function(_0x560fc4){_0x5d3991[_0x3d5c('0x20')]=_0x560fc4;if(_0x37e83e['query'][_0x3d5c('0x42')]){_0x2d6e7a['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x2d6e7a);})[_0x3d5c('0x27')](function(_0x224a0c){_0x5d3991['rows']=_0x224a0c;return _0x5d3991;})[_0x3d5c('0x27')](respondWithFilteredResult(_0x5956c3,_0x2d6e7a))[_0x3d5c('0x43')](handleError(_0x5956c3,null));};exports[_0x3d5c('0x44')]=function(_0x4beb19,_0x5ae524){var _0x3fe5a8={'raw':![],'where':{'id':_0x4beb19[_0x3d5c('0x45')]['id']}},_0x2baddf={};_0x2baddf['model']=_[_0x3d5c('0x32')](db[_0x3d5c('0x2d')][_0x3d5c('0x46')]);_0x2baddf[_0x3d5c('0x31')]=_[_0x3d5c('0x32')](_0x4beb19[_0x3d5c('0x31')]);_0x2baddf[_0x3d5c('0x33')]=_[_0x3d5c('0x34')](_0x2baddf[_0x3d5c('0x30')],_0x2baddf[_0x3d5c('0x31')]);_0x3fe5a8['attributes']=_[_0x3d5c('0x34')](_0x2baddf[_0x3d5c('0x30')],qs[_0x3d5c('0x36')](_0x4beb19['query'][_0x3d5c('0x36')]));_0x3fe5a8[_0x3d5c('0x35')]=_0x3fe5a8['attributes'][_0x3d5c('0x37')]?_0x3fe5a8['attributes']:_0x2baddf['model'];if(_0x4beb19['query'][_0x3d5c('0x42')]){_0x3fe5a8[_0x3d5c('0x47')]=[{'all':!![]}];}_0x3fe5a8=_[_0x3d5c('0x3e')]({},_0x3fe5a8,_0x4beb19[_0x3d5c('0x41')]);return db['VoiceAgentReport']['find'](_0x3fe5a8)['then'](handleEntityNotFound(_0x5ae524,null))[_0x3d5c('0x27')](respondWithResult(_0x5ae524,null))[_0x3d5c('0x43')](handleError(_0x5ae524,null));};exports[_0x3d5c('0x48')]=function(_0x4171e0,_0x3139d4){return db['VoiceAgentReport']['create'](_0x4171e0['body'],{})['then'](respondWithResult(_0x3139d4,0xc9))[_0x3d5c('0x43')](handleError(_0x3139d4,null));};exports['update']=function(_0xa84d8e,_0x4dfae6){if(_0xa84d8e[_0x3d5c('0x49')]['id']){delete _0xa84d8e[_0x3d5c('0x49')]['id'];}return db[_0x3d5c('0x2d')]['find']({'where':{'id':_0xa84d8e[_0x3d5c('0x45')]['id']}})[_0x3d5c('0x27')](handleEntityNotFound(_0x4dfae6,null))[_0x3d5c('0x27')](saveUpdates(_0xa84d8e[_0x3d5c('0x49')],null))[_0x3d5c('0x27')](respondWithResult(_0x4dfae6,null))['catch'](handleError(_0x4dfae6,null));};exports[_0x3d5c('0x28')]=function(_0x11f77e,_0x5264d1){return db[_0x3d5c('0x2d')][_0x3d5c('0x4a')]({'where':{'id':_0x11f77e[_0x3d5c('0x45')]['id']}})[_0x3d5c('0x27')](handleEntityNotFound(_0x5264d1,null))['then'](removeEntity(_0x5264d1,null))['catch'](handleError(_0x5264d1,null));};exports[_0x3d5c('0x4b')]=function(_0x140477,_0x156fe4){return db[_0x3d5c('0x2d')]['describe']()[_0x3d5c('0x27')](respondWithResult(_0x156fe4,null))[_0x3d5c('0x43')](handleError(_0x156fe4,null));}; \ No newline at end of file +var _0x40aa=['model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceAgentReport','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','end','map','rawAttributes','fieldName','key'];(function(_0x2a5203,_0x42834d){var _0x580809=function(_0x319619){while(--_0x319619){_0x2a5203['push'](_0x2a5203['shift']());}};_0x580809(++_0x42834d);}(_0x40aa,0xfd));var _0xa40a=function(_0x4d45fd,_0x16b74c){_0x4d45fd=_0x4d45fd-0x0;var _0x2b5aa5=_0x40aa[_0x4d45fd];return _0x2b5aa5;};'use strict';var pdf=require(_0xa40a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa40a('0x1'));var zipdir=require(_0xa40a('0x2'));var jsonpatch=require(_0xa40a('0x3'));var rp=require(_0xa40a('0x4'));var moment=require(_0xa40a('0x5'));var BPromise=require(_0xa40a('0x6'));var Mustache=require(_0xa40a('0x7'));var util=require(_0xa40a('0x8'));var path=require(_0xa40a('0x9'));var sox=require(_0xa40a('0xa'));var csv=require(_0xa40a('0xb'));var ejs=require(_0xa40a('0xc'));var fs=require('fs');var _=require(_0xa40a('0xd'));var squel=require(_0xa40a('0xe'));var crypto=require(_0xa40a('0xf'));var jsforce=require(_0xa40a('0x10'));var deskjs=require(_0xa40a('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa40a('0x12'));var Redis=require('ioredis');var authService=require(_0xa40a('0x13'));var qs=require(_0xa40a('0x14'));var as=require(_0xa40a('0x15'));var hardwareService=require(_0xa40a('0x16'));var logger=require('../../config/logger')(_0xa40a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa40a('0x18'));var db=require(_0xa40a('0x19'))['db'];function respondWithStatusCode(_0x57e87a,_0x1c0838){_0x1c0838=_0x1c0838||0xcc;return function(_0x32f430){if(_0x32f430){return _0x57e87a[_0xa40a('0x1a')](_0x1c0838);}return _0x57e87a[_0xa40a('0x1b')](_0x1c0838)['end']();};}function respondWithResult(_0x5f23b2,_0x38794f){_0x38794f=_0x38794f||0xc8;return function(_0x48a420){if(_0x48a420){return _0x5f23b2[_0xa40a('0x1b')](_0x38794f)[_0xa40a('0x1c')](_0x48a420);}};}function respondWithFilteredResult(_0x2305c4,_0x75627e){return function(_0xf1ea5f){if(_0xf1ea5f){var _0x58c02d=_0xf1ea5f[_0xa40a('0x1d')],_0x40533b=_0x75627e[_0xa40a('0x1e')],_0x20137a=_0x75627e[_0xa40a('0x1e')]+_0x75627e[_0xa40a('0x1f')],_0x548e77;if(_0x20137a>=_0x58c02d){_0x20137a=_0x58c02d;_0x548e77=0xc8;}else{_0x548e77=0xce;}_0x2305c4[_0xa40a('0x1b')](_0x548e77);return _0x2305c4[_0xa40a('0x20')](_0xa40a('0x21'),_0x40533b+'-'+_0x20137a+'/'+_0x58c02d)[_0xa40a('0x1c')](_0xf1ea5f);}return null;};}function patchUpdates(_0xf8c027){return function(_0x39ea61){try{jsonpatch['apply'](_0x39ea61,_0xf8c027,!![]);}catch(_0x152adc){return BPromise[_0xa40a('0x22')](_0x152adc);}return _0x39ea61[_0xa40a('0x23')]();};}function saveUpdates(_0x59c6c3,_0x48705e){return function(_0x3abfa2){if(_0x3abfa2){return _0x3abfa2['update'](_0x59c6c3)['then'](function(_0x32182f){return _0x32182f;});}return null;};}function removeEntity(_0x4e7f29,_0xace5d6){return function(_0x3b231c){if(_0x3b231c){return _0x3b231c[_0xa40a('0x24')]()[_0xa40a('0x25')](function(){_0x4e7f29[_0xa40a('0x1b')](0xcc)[_0xa40a('0x26')]();});}};}function handleEntityNotFound(_0x20bbab,_0x31f6e3){return function(_0x34a22c){if(!_0x34a22c){_0x20bbab[_0xa40a('0x1a')](0x194);}return _0x34a22c;};}function handleError(_0x2da7e4,_0x1fae12){_0x1fae12=_0x1fae12||0x1f4;return function(_0x416d74){logger['error'](_0x416d74['stack']);if(_0x416d74['name']){delete _0x416d74['name'];}_0x2da7e4[_0xa40a('0x1b')](_0x1fae12)['send'](_0x416d74);};}exports['index']=function(_0x3cc463,_0x14035b){var _0x4d39c3={},_0xca188={},_0x20356a={'count':0x0,'rows':[]};var _0x52e770=_[_0xa40a('0x27')](db['VoiceAgentReport'][_0xa40a('0x28')],function(_0x4acc39){return{'name':_0x4acc39[_0xa40a('0x29')],'type':_0x4acc39['type'][_0xa40a('0x2a')]};});_0xca188[_0xa40a('0x2b')]=_[_0xa40a('0x27')](_0x52e770,_0xa40a('0x2c'));_0xca188[_0xa40a('0x2d')]=_['keys'](_0x3cc463[_0xa40a('0x2d')]);_0xca188[_0xa40a('0x2e')]=_['intersection'](_0xca188[_0xa40a('0x2b')],_0xca188['query']);_0x4d39c3[_0xa40a('0x2f')]=_[_0xa40a('0x30')](_0xca188['model'],qs[_0xa40a('0x31')](_0x3cc463['query'][_0xa40a('0x31')]));_0x4d39c3[_0xa40a('0x2f')]=_0x4d39c3[_0xa40a('0x2f')][_0xa40a('0x32')]?_0x4d39c3['attributes']:_0xca188[_0xa40a('0x2b')];if(!_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x33')](_0xa40a('0x34'))){_0x4d39c3[_0xa40a('0x1f')]=qs[_0xa40a('0x1f')](_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x1f')]);_0x4d39c3[_0xa40a('0x1e')]=qs[_0xa40a('0x1e')](_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x1e')]);}_0x4d39c3[_0xa40a('0x35')]=qs[_0xa40a('0x36')](_0x3cc463[_0xa40a('0x2d')]['sort']);_0x4d39c3[_0xa40a('0x37')]=qs[_0xa40a('0x2e')](_[_0xa40a('0x38')](_0x3cc463[_0xa40a('0x2d')],_0xca188[_0xa40a('0x2e')]),_0x52e770);if(_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x39')]){_0x4d39c3[_0xa40a('0x37')]=_['merge'](_0x4d39c3[_0xa40a('0x37')],{'$or':_[_0xa40a('0x27')](_0x52e770,function(_0x528d66){if(_0x528d66['type']!==_0xa40a('0x3a')){var _0x38e65d={};_0x38e65d[_0x528d66[_0xa40a('0x2c')]]={'$like':'%'+_0x3cc463[_0xa40a('0x2d')]['filter']+'%'};return _0x38e65d;}})});}_0x4d39c3=_[_0xa40a('0x3b')]({},_0x4d39c3,_0x3cc463[_0xa40a('0x3c')]);var _0xfb2b59={'where':_0x4d39c3['where']};return db[_0xa40a('0x3d')][_0xa40a('0x1d')](_0xfb2b59)[_0xa40a('0x25')](function(_0x2a18ac){_0x20356a[_0xa40a('0x1d')]=_0x2a18ac;if(_0x3cc463[_0xa40a('0x2d')]['includeAll']){_0x4d39c3[_0xa40a('0x3e')]=[{'all':!![]}];}return db[_0xa40a('0x3d')][_0xa40a('0x3f')](_0x4d39c3);})[_0xa40a('0x25')](function(_0x4b60f6){_0x20356a[_0xa40a('0x40')]=_0x4b60f6;return _0x20356a;})['then'](respondWithFilteredResult(_0x14035b,_0x4d39c3))[_0xa40a('0x41')](handleError(_0x14035b,null));};exports[_0xa40a('0x42')]=function(_0x102761,_0x1d2f9e){var _0x15c240={'raw':![],'where':{'id':_0x102761['params']['id']}},_0x4a9265={};_0x4a9265['model']=_[_0xa40a('0x43')](db[_0xa40a('0x3d')][_0xa40a('0x28')]);_0x4a9265[_0xa40a('0x2d')]=_[_0xa40a('0x43')](_0x102761[_0xa40a('0x2d')]);_0x4a9265[_0xa40a('0x2e')]=_['intersection'](_0x4a9265[_0xa40a('0x2b')],_0x4a9265[_0xa40a('0x2d')]);_0x15c240[_0xa40a('0x2f')]=_[_0xa40a('0x30')](_0x4a9265[_0xa40a('0x2b')],qs[_0xa40a('0x31')](_0x102761[_0xa40a('0x2d')][_0xa40a('0x31')]));_0x15c240[_0xa40a('0x2f')]=_0x15c240[_0xa40a('0x2f')][_0xa40a('0x32')]?_0x15c240[_0xa40a('0x2f')]:_0x4a9265[_0xa40a('0x2b')];if(_0x102761[_0xa40a('0x2d')][_0xa40a('0x44')]){_0x15c240['include']=[{'all':!![]}];}_0x15c240=_['merge']({},_0x15c240,_0x102761[_0xa40a('0x3c')]);return db['VoiceAgentReport'][_0xa40a('0x45')](_0x15c240)['then'](handleEntityNotFound(_0x1d2f9e,null))[_0xa40a('0x25')](respondWithResult(_0x1d2f9e,null))[_0xa40a('0x41')](handleError(_0x1d2f9e,null));};exports[_0xa40a('0x46')]=function(_0x4b4b6a,_0x2de1b0){return db[_0xa40a('0x3d')][_0xa40a('0x46')](_0x4b4b6a['body'],{})[_0xa40a('0x25')](respondWithResult(_0x2de1b0,0xc9))['catch'](handleError(_0x2de1b0,null));};exports['update']=function(_0x4453a3,_0x364d6a){if(_0x4453a3[_0xa40a('0x47')]['id']){delete _0x4453a3[_0xa40a('0x47')]['id'];}return db[_0xa40a('0x3d')][_0xa40a('0x45')]({'where':{'id':_0x4453a3[_0xa40a('0x48')]['id']}})['then'](handleEntityNotFound(_0x364d6a,null))[_0xa40a('0x25')](saveUpdates(_0x4453a3['body'],null))[_0xa40a('0x25')](respondWithResult(_0x364d6a,null))[_0xa40a('0x41')](handleError(_0x364d6a,null));};exports['destroy']=function(_0x10f639,_0x4d8fe5){return db[_0xa40a('0x3d')][_0xa40a('0x45')]({'where':{'id':_0x10f639[_0xa40a('0x48')]['id']}})[_0xa40a('0x25')](handleEntityNotFound(_0x4d8fe5,null))[_0xa40a('0x25')](removeEntity(_0x4d8fe5,null))[_0xa40a('0x41')](handleError(_0x4d8fe5,null));};exports['describe']=function(_0x3e9f5b,_0x59b217){return db[_0xa40a('0x3d')][_0xa40a('0x49')]()[_0xa40a('0x25')](respondWithResult(_0x59b217,null))[_0xa40a('0x41')](handleError(_0x59b217,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index c20055e..26edd4e 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 _0x3ea2=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x40ae09,_0x5a2214){var _0x4e573f=function(_0x511b56){while(--_0x511b56){_0x40ae09['push'](_0x40ae09['shift']());}};_0x4e573f(++_0x5a2214);}(_0x3ea2,0x1d4));var _0x23ea=function(_0x3e2d49,_0x29b1ea){_0x3e2d49=_0x3e2d49-0x0;var _0x47f51b=_0x3ea2[_0x3e2d49];return _0x47f51b;};'use strict';var _=require(_0x23ea('0x0'));var util=require(_0x23ea('0x1'));var logger=require(_0x23ea('0x2'))(_0x23ea('0x3'));var moment=require('moment');var BPromise=require(_0x23ea('0x4'));var rp=require(_0x23ea('0x5'));var fs=require('fs');var path=require(_0x23ea('0x6'));var rimraf=require(_0x23ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x23ea('0x8'));module[_0x23ea('0x9')]=function(_0x26936e,_0x3f291c){return _0x26936e[_0x23ea('0xa')](_0x23ea('0xb'),attributes,{'tableName':_0x23ea('0xc'),'paranoid':![],'indexes':[{'fields':[_0x23ea('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x36fe=['exports','define','VoiceAgentReport','report_agent','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x13fb74,_0x42e5eb){var _0x140f20=function(_0x224782){while(--_0x224782){_0x13fb74['push'](_0x13fb74['shift']());}};_0x140f20(++_0x42e5eb);}(_0x36fe,0x17b));var _0xe36f=function(_0x48b6c6,_0xba4073){_0x48b6c6=_0x48b6c6-0x0;var _0x1bcc9a=_0x36fe[_0x48b6c6];return _0x1bcc9a;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))(_0xe36f('0x3'));var moment=require(_0xe36f('0x4'));var BPromise=require(_0xe36f('0x5'));var rp=require(_0xe36f('0x6'));var fs=require('fs');var path=require(_0xe36f('0x7'));var rimraf=require(_0xe36f('0x8'));var config=require(_0xe36f('0x9'));var attributes=require(_0xe36f('0xa'));module[_0xe36f('0xb')]=function(_0x24e508,_0x2a4d54){return _0x24e508[_0xe36f('0xc')](_0xe36f('0xd'),attributes,{'tableName':_0xe36f('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 82eb9e2..b6d3686 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 _0x40d1=['catch','VoiceAgentReport','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport','create','options'];(function(_0x5c14b0,_0x7cee8c){var _0x3c1a44=function(_0x41a7f1){while(--_0x41a7f1){_0x5c14b0['push'](_0x5c14b0['shift']());}};_0x3c1a44(++_0x7cee8c);}(_0x40d1,0x1c5));var _0x140d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x40d1[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x140d('0x0'));var util=require(_0x140d('0x1'));var moment=require('moment');var BPromise=require(_0x140d('0x2'));var rs=require(_0x140d('0x3'));var fs=require('fs');var Redis=require(_0x140d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x140d('0x5'));var config=require(_0x140d('0x6'));var jayson=require(_0x140d('0x7'));var client=jayson['client'][_0x140d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11cd54,_0x3423d6,_0x1d0c72){return new BPromise(function(_0x1fa766,_0x352ddc){return client[_0x140d('0x9')](_0x11cd54,_0x1d0c72)[_0x140d('0xa')](function(_0x282fc8){logger[_0x140d('0xb')](_0x140d('0xc'),_0x3423d6,_0x140d('0xd'));logger[_0x140d('0xe')](_0x140d('0xf'),_0x3423d6,'request\x20sent',JSON[_0x140d('0x10')](_0x282fc8));if(_0x282fc8[_0x140d('0x11')]){if(_0x282fc8[_0x140d('0x11')][_0x140d('0x12')]===0x1f4){logger['error'](_0x140d('0xc'),_0x3423d6,_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);return _0x352ddc(_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);}logger[_0x140d('0x11')](_0x140d('0xc'),_0x3423d6,_0x282fc8[_0x140d('0x11')][_0x140d('0x13')]);return _0x1fa766(_0x282fc8[_0x140d('0x11')]['message']);}else{logger[_0x140d('0xb')](_0x140d('0xc'),_0x3423d6,_0x140d('0xd'));_0x1fa766(_0x282fc8['result']['message']);}})['catch'](function(_0x313d8f){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3423d6,_0x313d8f);_0x352ddc(_0x313d8f);});});}exports[_0x140d('0x14')]=function(_0x5063b5){var _0x4b00f6=this;return new Promise(function(_0x576545,_0x969650){return db['VoiceAgentReport'][_0x140d('0x15')](_0x5063b5['body'],{'raw':_0x5063b5[_0x140d('0x16')]?_0x5063b5['options']['raw']===undefined?!![]:![]:!![]})[_0x140d('0xa')](function(_0x4796a6){logger[_0x140d('0xb')](_0x140d('0x14'),_0x5063b5);logger['debug']('CreateVoiceAgentReport',_0x5063b5,JSON['stringify'](_0x4796a6));_0x576545(_0x4796a6);})[_0x140d('0x17')](function(_0x522428){logger[_0x140d('0x11')](_0x140d('0x14'),_0x522428[_0x140d('0x13')],_0x5063b5);_0x969650(_0x4b00f6[_0x140d('0x11')](0x1f4,_0x522428[_0x140d('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2111fa){var _0x386c5b=this;return new Promise(function(_0x184456,_0x2139f3){return db[_0x140d('0x18')]['update'](_0x2111fa['body'],{'raw':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')]['where']||null:null,'attributes':_0x2111fa[_0x140d('0x16')]?_0x2111fa[_0x140d('0x16')][_0x140d('0x19')]||null:null,'limit':_0x2111fa['options']?_0x2111fa[_0x140d('0x16')][_0x140d('0x1a')]||null:null})['then'](function(_0x58cfe3){logger[_0x140d('0xb')](_0x140d('0x1b'),_0x2111fa);logger[_0x140d('0xe')](_0x140d('0x1b'),_0x2111fa,JSON[_0x140d('0x10')](_0x58cfe3));_0x184456(_0x58cfe3);})[_0x140d('0x17')](function(_0x3954cb){logger[_0x140d('0x11')](_0x140d('0x1b'),_0x3954cb[_0x140d('0x13')],_0x2111fa);_0x2139f3(_0x386c5b[_0x140d('0x11')](0x1f4,_0x3954cb['message']));});});}; \ No newline at end of file +var _0x440a=['request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x3160c5,_0x26e2b4){var _0x24139e=function(_0x51aa9b){while(--_0x51aa9b){_0x3160c5['push'](_0x3160c5['shift']());}};_0x24139e(++_0x26e2b4);}(_0x440a,0x19a));var _0xa440=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x440a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa440('0x0'));var util=require(_0xa440('0x1'));var moment=require(_0xa440('0x2'));var BPromise=require(_0xa440('0x3'));var rs=require(_0xa440('0x4'));var fs=require('fs');var Redis=require(_0xa440('0x5'));var db=require(_0xa440('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa440('0x7'))(_0xa440('0x8'));var config=require('../../config/environment');var jayson=require(_0xa440('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58dca2,_0x4099d3,_0x24eb4c){return new BPromise(function(_0x1f5ae4,_0x5c236d){return client['request'](_0x58dca2,_0x24eb4c)[_0xa440('0xa')](function(_0x2ad3bb){logger[_0xa440('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x4099d3,'request\x20sent');logger[_0xa440('0xc')](_0xa440('0xd'),_0x4099d3,'request\x20sent',JSON[_0xa440('0xe')](_0x2ad3bb));if(_0x2ad3bb[_0xa440('0xf')]){if(_0x2ad3bb[_0xa440('0xf')][_0xa440('0x10')]===0x1f4){logger['error'](_0xa440('0x11'),_0x4099d3,_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);return _0x5c236d(_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);}logger[_0xa440('0xf')](_0xa440('0x11'),_0x4099d3,_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);return _0x1f5ae4(_0x2ad3bb['error'][_0xa440('0x12')]);}else{logger['info'](_0xa440('0x11'),_0x4099d3,_0xa440('0x13'));_0x1f5ae4(_0x2ad3bb[_0xa440('0x14')][_0xa440('0x12')]);}})[_0xa440('0x15')](function(_0x2c2914){logger[_0xa440('0xf')](_0xa440('0x11'),_0x4099d3,_0x2c2914);_0x5c236d(_0x2c2914);});});}exports[_0xa440('0x16')]=function(_0x194c27){var _0x4523f7=this;return new Promise(function(_0x3b6edb,_0x55c5bc){return db[_0xa440('0x17')][_0xa440('0x18')](_0x194c27['body'],{'raw':_0x194c27['options']?_0x194c27[_0xa440('0x19')][_0xa440('0x1a')]===undefined?!![]:![]:!![]})[_0xa440('0xa')](function(_0xc0f27e){logger[_0xa440('0xb')](_0xa440('0x16'),_0x194c27);logger['debug'](_0xa440('0x16'),_0x194c27,JSON[_0xa440('0xe')](_0xc0f27e));_0x3b6edb(_0xc0f27e);})['catch'](function(_0x40e5d7){logger[_0xa440('0xf')](_0xa440('0x16'),_0x40e5d7['message'],_0x194c27);_0x55c5bc(_0x4523f7[_0xa440('0xf')](0x1f4,_0x40e5d7[_0xa440('0x12')]));});});};exports[_0xa440('0x1b')]=function(_0x4294d0){var _0x228831=this;return new Promise(function(_0x375b1e,_0x3dbaae){return db['VoiceAgentReport'][_0xa440('0x1c')](_0x4294d0[_0xa440('0x1d')],{'raw':_0x4294d0['options']?_0x4294d0[_0xa440('0x19')][_0xa440('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4294d0['options']?_0x4294d0[_0xa440('0x19')][_0xa440('0x1e')]||null:null,'attributes':_0x4294d0[_0xa440('0x19')]?_0x4294d0[_0xa440('0x19')][_0xa440('0x1f')]||null:null,'limit':_0x4294d0[_0xa440('0x19')]?_0x4294d0[_0xa440('0x19')][_0xa440('0x20')]||null:null})[_0xa440('0xa')](function(_0x377774){logger[_0xa440('0xb')]('UpdateVoiceAgentReport',_0x4294d0);logger[_0xa440('0xc')]('UpdateVoiceAgentReport',_0x4294d0,JSON['stringify'](_0x377774));_0x375b1e(_0x377774);})[_0xa440('0x15')](function(_0x459642){logger[_0xa440('0xf')]('UpdateVoiceAgentReport',_0x459642[_0xa440('0x12')],_0x4294d0);_0x3dbaae(_0x228831[_0xa440('0xf')](0x1f4,_0x459642[_0xa440('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d75f33e..7d169ef 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 _0x225b=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','post','put','update','delete'];(function(_0x5c6b3d,_0x20fa0f){var _0x5572f8=function(_0x2cdfda){while(--_0x2cdfda){_0x5c6b3d['push'](_0x5c6b3d['shift']());}};_0x5572f8(++_0x20fa0f);}(_0x225b,0x161));var _0xb225=function(_0x54e6fc,_0x51ec5d){_0x54e6fc=_0x54e6fc-0x0;var _0x2b513d=_0x225b[_0x54e6fc];return _0x2b513d;};'use strict';var multer=require(_0xb225('0x0'));var util=require('util');var path=require(_0xb225('0x1'));var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var auth=require(_0xb225('0x4'));var interaction=require(_0xb225('0x5'));var config=require(_0xb225('0x6'));var controller=require('./voiceCallReport.controller');router[_0xb225('0x7')]('/',auth['isAuthenticated'](),controller[_0xb225('0x8')]);router[_0xb225('0x7')](_0xb225('0x9'),auth[_0xb225('0xa')](),controller['describe']);router[_0xb225('0x7')]('/:id',auth[_0xb225('0xa')](),controller['show']);router[_0xb225('0xb')]('/',auth[_0xb225('0xa')](),controller['create']);router[_0xb225('0xc')]('/:id',auth[_0xb225('0xa')](),controller[_0xb225('0xd')]);router[_0xb225('0xe')]('/:id',auth[_0xb225('0xa')](),controller[_0xb225('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9597=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x31e51c,_0x3eb8d7){var _0x1d25d5=function(_0x18033b){while(--_0x18033b){_0x31e51c['push'](_0x31e51c['shift']());}};_0x1d25d5(++_0x3eb8d7);}(_0x9597,0x1bb));var _0x7959=function(_0x3144f9,_0x4e0dd3){_0x3144f9=_0x3144f9-0x0;var _0x390992=_0x9597[_0x3144f9];return _0x390992;};'use strict';var multer=require(_0x7959('0x0'));var util=require(_0x7959('0x1'));var path=require(_0x7959('0x2'));var timeout=require('connect-timeout');var express=require(_0x7959('0x3'));var router=express[_0x7959('0x4')]();var auth=require(_0x7959('0x5'));var interaction=require(_0x7959('0x6'));var config=require(_0x7959('0x7'));var controller=require(_0x7959('0x8'));router[_0x7959('0x9')]('/',auth[_0x7959('0xa')](),controller[_0x7959('0xb')]);router[_0x7959('0x9')](_0x7959('0xc'),auth[_0x7959('0xa')](),controller[_0x7959('0xd')]);router[_0x7959('0x9')](_0x7959('0xe'),auth[_0x7959('0xa')](),controller[_0x7959('0xf')]);router[_0x7959('0x10')]('/',auth['isAuthenticated'](),controller[_0x7959('0x11')]);router[_0x7959('0x12')]('/:id',auth[_0x7959('0xa')](),controller[_0x7959('0x13')]);router[_0x7959('0x14')](_0x7959('0xe'),auth[_0x7959('0xa')](),controller[_0x7959('0x15')]);module[_0x7959('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 32e204e..f94af9e 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 _0x3c6c=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x8a565b,_0x49df9f){var _0x231c1d=function(_0x1e51c8){while(--_0x1e51c8){_0x8a565b['push'](_0x8a565b['shift']());}};_0x231c1d(++_0x49df9f);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x230d86,_0x343420){_0x230d86=_0x230d86-0x0;var _0x41aab9=_0x3c6c[_0x230d86];return _0x41aab9;};'use strict';var Sequelize=require(_0xc3c6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc3c6('0x1')]},'type':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0x3'),_0xc3c6('0x4'),_0xc3c6('0x5'),_0xc3c6('0x6'),_0xc3c6('0x7'),_0xc3c6('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3c6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc3c6('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc3c6('0x9')]},'starttime':{'type':Sequelize[_0xc3c6('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc3c6('0xa')]},'endtime':{'type':Sequelize[_0xc3c6('0xa')]},'duration':{'type':Sequelize[_0xc3c6('0xb')]},'billableseconds':{'type':Sequelize[_0xc3c6('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3c6('0x1')]},'amaflags':{'type':Sequelize[_0xc3c6('0x1')]},'userfield':{'type':Sequelize[_0xc3c6('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc3c6('0x1')]},'note':{'type':Sequelize[_0xc3c6('0x1')]},'prefix':{'type':Sequelize[_0xc3c6('0x1')]},'routeid':{'type':Sequelize[_0xc3c6('0xb')]},'sipcallid':{'type':Sequelize[_0xc3c6('0x1')]}}; \ No newline at end of file +var _0x9c5a=['sequelize','exports','ENUM','inbound','internal','outbound','outbound-fax','dialer','STRING','DATE','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4c4eee,_0x212a47){_0x4c4eee=_0x4c4eee-0x0;var _0x5e8d4b=_0x9c5a[_0x4c4eee];return _0x5e8d4b;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa9c5('0x2')](_0xa9c5('0x3'),_0xa9c5('0x4'),_0xa9c5('0x5'),'inbound-fax',_0xa9c5('0x6'),_0xa9c5('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x8')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa9c5('0x8')]},'destinationcontext':{'type':Sequelize[_0xa9c5('0x8')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xa9c5('0x8')]},'lastapplication':{'type':Sequelize[_0xa9c5('0x8')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa9c5('0x9')]},'systemanswertime':{'type':Sequelize[_0xa9c5('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa9c5('0x9')]},'duration':{'type':Sequelize[_0xa9c5('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9c5('0x8')]},'amaflags':{'type':Sequelize[_0xa9c5('0x8')]},'userfield':{'type':Sequelize[_0xa9c5('0x8')]},'userDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'note':{'type':Sequelize[_0xa9c5('0x8')]},'prefix':{'type':Sequelize[_0xa9c5('0x8')]},'routeid':{'type':Sequelize[_0xa9c5('0xa')]},'sipcallid':{'type':Sequelize[_0xa9c5('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a323818..358b533 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_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(){_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 f856d28..9585e4e 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 _0x540f=['exports','define','VoiceCallReport','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0xec84e,_0x3a4944){var _0x21b7f9=function(_0x36abc8){while(--_0x36abc8){_0xec84e['push'](_0xec84e['shift']());}};_0x21b7f9(++_0x3a4944);}(_0x540f,0x190));var _0xf540=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x540f[_0x49052b];return _0x48c045;};'use strict';var _=require('lodash');var util=require(_0xf540('0x0'));var logger=require(_0xf540('0x1'))(_0xf540('0x2'));var moment=require(_0xf540('0x3'));var BPromise=require(_0xf540('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf540('0x5'));var config=require(_0xf540('0x6'));var attributes=require(_0xf540('0x7'));module[_0xf540('0x8')]=function(_0x222066,_0x17d583){return _0x222066[_0xf540('0x9')](_0xf540('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xf540('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x41c76f,_0x339363){var _0x22fefb=function(_0x7e37da){while(--_0x7e37da){_0x41c76f['push'](_0x41c76f['shift']());}};_0x22fefb(++_0x339363);}(_0xa74f,0xa2));var _0xfa74=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xa74f[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0xfa74('0x0'));var util=require(_0xfa74('0x1'));var logger=require(_0xfa74('0x2'))(_0xfa74('0x3'));var moment=require(_0xfa74('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa74('0x5'));var fs=require('fs');var path=require(_0xfa74('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa74('0x7'));module[_0xfa74('0x8')]=function(_0x927018,_0x1f6c66){return _0x927018[_0xfa74('0x9')](_0xfa74('0xa'),attributes,{'tableName':_0xfa74('0xb'),'paranoid':![],'indexes':[{'fields':[_0xfa74('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 81dde56..effe89f 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 _0xdc6b=['http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','attributes','map','model','info','stringify','CreateVoiceCallReport','raw','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x18d19c,_0xb389f8){var _0xbc6fb4=function(_0x3a9427){while(--_0x3a9427){_0x18d19c['push'](_0x18d19c['shift']());}};_0xbc6fb4(++_0xb389f8);}(_0xdc6b,0x132));var _0xbdc6=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xdc6b[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0xbdc6('0x0'));var util=require(_0xbdc6('0x1'));var moment=require(_0xbdc6('0x2'));var BPromise=require(_0xbdc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdc6('0x4'));var db=require(_0xbdc6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdc6('0x6'))('rpc');var config=require(_0xbdc6('0x7'));var jayson=require(_0xbdc6('0x8'));var client=jayson['client'][_0xbdc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a0f51,_0x34dd1,_0x438232){return new BPromise(function(_0x47150d,_0x475c35){return client[_0xbdc6('0xa')](_0x2a0f51,_0x438232)[_0xbdc6('0xb')](function(_0x3ed2ef){logger['info'](_0xbdc6('0xc'),_0x34dd1,'request\x20sent');logger[_0xbdc6('0xd')](_0xbdc6('0xe'),_0x34dd1,'request\x20sent',JSON['stringify'](_0x3ed2ef));if(_0x3ed2ef['error']){if(_0x3ed2ef[_0xbdc6('0xf')]['code']===0x1f4){logger['error'](_0xbdc6('0xc'),_0x34dd1,_0x3ed2ef[_0xbdc6('0xf')][_0xbdc6('0x10')]);return _0x475c35(_0x3ed2ef[_0xbdc6('0xf')]['message']);}logger[_0xbdc6('0xf')](_0xbdc6('0xc'),_0x34dd1,_0x3ed2ef[_0xbdc6('0xf')][_0xbdc6('0x10')]);return _0x47150d(_0x3ed2ef['error'][_0xbdc6('0x10')]);}else{logger['info'](_0xbdc6('0xc'),_0x34dd1,'request\x20sent');_0x47150d(_0x3ed2ef[_0xbdc6('0x11')][_0xbdc6('0x10')]);}})[_0xbdc6('0x12')](function(_0x53dce4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x34dd1,_0x53dce4);_0x475c35(_0x53dce4);});});}exports[_0xbdc6('0x13')]=function(_0x38d180){var _0x5eebc3=this;return new Promise(function(_0x1389b9,_0x3553a7){return db[_0xbdc6('0x14')][_0xbdc6('0x15')]({'raw':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x38d180['options']?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x17')]||null:null,'attributes':_0x38d180['options']?_0x38d180[_0xbdc6('0x16')]['attributes']||null:null,'limit':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x18')]||null:null,'include':_0x38d180[_0xbdc6('0x16')]?_0x38d180[_0xbdc6('0x16')][_0xbdc6('0x19')]?_['map'](_0x38d180[_0xbdc6('0x16')]['include'],function(_0x29a8d0){return{'model':db[_0x29a8d0['model']],'as':_0x29a8d0['as'],'attributes':_0x29a8d0[_0xbdc6('0x1a')],'include':_0x29a8d0[_0xbdc6('0x19')]?_[_0xbdc6('0x1b')](_0x29a8d0[_0xbdc6('0x19')],function(_0x5f38d6){return{'model':db[_0x5f38d6[_0xbdc6('0x1c')]],'as':_0x5f38d6['as'],'attributes':_0x5f38d6['attributes'],'include':_0x5f38d6['include']?_[_0xbdc6('0x1b')](_0x5f38d6[_0xbdc6('0x19')],function(_0x70ffbe){return{'model':db[_0x70ffbe[_0xbdc6('0x1c')]],'as':_0x70ffbe['as'],'attributes':_0x70ffbe['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdc6('0xb')](function(_0x5ab06d){logger[_0xbdc6('0x1d')](_0xbdc6('0x13'),_0x38d180);logger['debug'](_0xbdc6('0x13'),_0x38d180,JSON[_0xbdc6('0x1e')](_0x5ab06d));_0x1389b9(_0x5ab06d);})[_0xbdc6('0x12')](function(_0x3e46c3){logger[_0xbdc6('0xf')](_0xbdc6('0x13'),_0x3e46c3[_0xbdc6('0x10')],_0x38d180);_0x3553a7(_0x5eebc3[_0xbdc6('0xf')](0x1f4,_0x3e46c3[_0xbdc6('0x10')]));});});};exports[_0xbdc6('0x1f')]=function(_0x3f379e){var _0x513ae4=this;return new Promise(function(_0x5c4cac,_0x4af5b2){return db[_0xbdc6('0x14')]['create'](_0x3f379e['body'],{'raw':_0x3f379e['options']?_0x3f379e[_0xbdc6('0x16')][_0xbdc6('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1e36e3){logger[_0xbdc6('0x1d')](_0xbdc6('0x1f'),_0x3f379e);logger['debug']('CreateVoiceCallReport',_0x3f379e,JSON['stringify'](_0x1e36e3));_0x5c4cac(_0x1e36e3);})['catch'](function(_0x4ef1a6){logger['error']('CreateVoiceCallReport',_0x4ef1a6[_0xbdc6('0x10')],_0x3f379e);_0x4af5b2(_0x513ae4[_0xbdc6('0xf')](0x1f4,_0x4ef1a6['message']));});});};exports['UpdateVoiceCallReport']=function(_0x881013){var _0x464e8f=this;return new Promise(function(_0x1bd6e0,_0x20dae6){return db[_0xbdc6('0x14')][_0xbdc6('0x21')](_0x881013['body'],{'raw':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x17')]||null:null,'attributes':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x1a')]||null:null,'limit':_0x881013[_0xbdc6('0x16')]?_0x881013[_0xbdc6('0x16')][_0xbdc6('0x18')]||null:null})['then'](function(_0x19c588){logger[_0xbdc6('0x1d')](_0xbdc6('0x22'),_0x881013);logger['debug']('UpdateVoiceCallReport',_0x881013,JSON[_0xbdc6('0x1e')](_0x19c588));_0x1bd6e0(_0x19c588);})[_0xbdc6('0x12')](function(_0x135287){logger['error']('UpdateVoiceCallReport',_0x135287[_0xbdc6('0x10')],_0x881013);_0x20dae6(_0x464e8f[_0xbdc6('0xf')](0x1f4,_0x135287['message']));});});}; \ No newline at end of file +var _0x8f4d=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','raw','map','include','attributes','model','GetVoiceCallReport','stringify','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','where','limit','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x8f4d,0xff));var _0xd8f4=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8f4d[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd8f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8f4('0x1'));var fs=require('fs');var Redis=require(_0xd8f4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8f4('0x3'));var logger=require(_0xd8f4('0x4'))(_0xd8f4('0x5'));var config=require(_0xd8f4('0x6'));var jayson=require(_0xd8f4('0x7'));var client=jayson[_0xd8f4('0x8')][_0xd8f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7e79,_0xc22757,_0x2480c2){return new BPromise(function(_0x8ae768,_0x2ae4e5){return client['request'](_0x3e7e79,_0x2480c2)[_0xd8f4('0xa')](function(_0x2e12c8){logger[_0xd8f4('0xb')](_0xd8f4('0xc'),_0xc22757,_0xd8f4('0xd'));logger[_0xd8f4('0xe')](_0xd8f4('0xf'),_0xc22757,_0xd8f4('0xd'),JSON['stringify'](_0x2e12c8));if(_0x2e12c8[_0xd8f4('0x10')]){if(_0x2e12c8[_0xd8f4('0x10')][_0xd8f4('0x11')]===0x1f4){logger[_0xd8f4('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xc22757,_0x2e12c8[_0xd8f4('0x10')]['message']);return _0x2ae4e5(_0x2e12c8['error'][_0xd8f4('0x12')]);}logger['error'](_0xd8f4('0xc'),_0xc22757,_0x2e12c8['error'][_0xd8f4('0x12')]);return _0x8ae768(_0x2e12c8['error']['message']);}else{logger[_0xd8f4('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0xc22757,_0xd8f4('0xd'));_0x8ae768(_0x2e12c8[_0xd8f4('0x13')][_0xd8f4('0x12')]);}})['catch'](function(_0x469651){logger[_0xd8f4('0x10')](_0xd8f4('0xc'),_0xc22757,_0x469651);_0x2ae4e5(_0x469651);});});}exports['GetVoiceCallReport']=function(_0x500837){var _0x499df3=this;return new Promise(function(_0xbf5908,_0x190a57){return db['VoiceCallReport'][_0xd8f4('0x14')]({'raw':_0x500837['options']?_0x500837[_0xd8f4('0x15')][_0xd8f4('0x16')]===undefined?!![]:![]:!![],'where':_0x500837['options']?_0x500837[_0xd8f4('0x15')]['where']||null:null,'attributes':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['attributes']||null:null,'limit':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['limit']||null:null,'include':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['include']?_[_0xd8f4('0x17')](_0x500837[_0xd8f4('0x15')][_0xd8f4('0x18')],function(_0x5471c5){return{'model':db[_0x5471c5['model']],'as':_0x5471c5['as'],'attributes':_0x5471c5[_0xd8f4('0x19')],'include':_0x5471c5['include']?_[_0xd8f4('0x17')](_0x5471c5[_0xd8f4('0x18')],function(_0x31b84d){return{'model':db[_0x31b84d[_0xd8f4('0x1a')]],'as':_0x31b84d['as'],'attributes':_0x31b84d[_0xd8f4('0x19')],'include':_0x31b84d[_0xd8f4('0x18')]?_[_0xd8f4('0x17')](_0x31b84d[_0xd8f4('0x18')],function(_0xc65fd6){return{'model':db[_0xc65fd6[_0xd8f4('0x1a')]],'as':_0xc65fd6['as'],'attributes':_0xc65fd6[_0xd8f4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd8f4('0xa')](function(_0x54c55c){logger[_0xd8f4('0xb')](_0xd8f4('0x1b'),_0x500837);logger['debug']('GetVoiceCallReport',_0x500837,JSON[_0xd8f4('0x1c')](_0x54c55c));_0xbf5908(_0x54c55c);})[_0xd8f4('0x1d')](function(_0x435142){logger['error'](_0xd8f4('0x1b'),_0x435142['message'],_0x500837);_0x190a57(_0x499df3[_0xd8f4('0x10')](0x1f4,_0x435142[_0xd8f4('0x12')]));});});};exports[_0xd8f4('0x1e')]=function(_0x39f25){var _0x61b50d=this;return new Promise(function(_0x39a153,_0x10429f){return db[_0xd8f4('0x1f')][_0xd8f4('0x20')](_0x39f25[_0xd8f4('0x21')],{'raw':_0x39f25[_0xd8f4('0x15')]?_0x39f25[_0xd8f4('0x15')][_0xd8f4('0x16')]===undefined?!![]:![]:!![]})[_0xd8f4('0xa')](function(_0x227ec4){logger[_0xd8f4('0xb')](_0xd8f4('0x1e'),_0x39f25);logger[_0xd8f4('0xe')]('CreateVoiceCallReport',_0x39f25,JSON[_0xd8f4('0x1c')](_0x227ec4));_0x39a153(_0x227ec4);})[_0xd8f4('0x1d')](function(_0x4dae4a){logger[_0xd8f4('0x10')](_0xd8f4('0x1e'),_0x4dae4a[_0xd8f4('0x12')],_0x39f25);_0x10429f(_0x61b50d['error'](0x1f4,_0x4dae4a[_0xd8f4('0x12')]));});});};exports[_0xd8f4('0x22')]=function(_0x8a5d84){var _0xf7be50=this;return new Promise(function(_0x3d3b47,_0x7318fe){return db['VoiceCallReport'][_0xd8f4('0x23')](_0x8a5d84[_0xd8f4('0x21')],{'raw':_0x8a5d84['options']?_0x8a5d84['options'][_0xd8f4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a5d84[_0xd8f4('0x15')]?_0x8a5d84[_0xd8f4('0x15')][_0xd8f4('0x24')]||null:null,'attributes':_0x8a5d84['options']?_0x8a5d84[_0xd8f4('0x15')]['attributes']||null:null,'limit':_0x8a5d84[_0xd8f4('0x15')]?_0x8a5d84[_0xd8f4('0x15')][_0xd8f4('0x25')]||null:null})['then'](function(_0x39e3a6){logger['info'](_0xd8f4('0x22'),_0x8a5d84);logger['debug'](_0xd8f4('0x22'),_0x8a5d84,JSON[_0xd8f4('0x1c')](_0x39e3a6));_0x3d3b47(_0x39e3a6);})[_0xd8f4('0x1d')](function(_0x1e770c){logger[_0xd8f4('0x10')]('UpdateVoiceCallReport',_0x1e770c[_0xd8f4('0x12')],_0x8a5d84);_0x7318fe(_0xf7be50[_0xd8f4('0x10')](0x1f4,_0x1e770c[_0xd8f4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 2c37088..f7defc8 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 _0xcbd3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4f7da6,_0x97330f){var _0x474753=function(_0x55120a){while(--_0x55120a){_0x4f7da6['push'](_0x4f7da6['shift']());}};_0x474753(++_0x97330f);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x3e94f6,_0x35e860){_0x3e94f6=_0x3e94f6-0x0;var _0x36bd06=_0xcbd3[_0x3e94f6];return _0x36bd06;};'use strict';var multer=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var path=require(_0x3cbd('0x2'));var timeout=require(_0x3cbd('0x3'));var express=require(_0x3cbd('0x4'));var router=express[_0x3cbd('0x5')]();var auth=require(_0x3cbd('0x6'));var interaction=require(_0x3cbd('0x7'));var config=require(_0x3cbd('0x8'));var controller=require(_0x3cbd('0x9'));router['get']('/',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0xb')]);router['get'](_0x3cbd('0xc'),auth['isAuthenticated'](),controller[_0x3cbd('0xd')]);router['post']('/',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0xe')]);router[_0x3cbd('0xf')](_0x3cbd('0xc'),auth[_0x3cbd('0xa')](),controller['update']);router[_0x3cbd('0x10')]('/:id',auth[_0x3cbd('0xa')](),controller[_0x3cbd('0x11')]);module[_0x3cbd('0x12')]=router; \ No newline at end of file +var _0xb7a7=['delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x255b7e,_0x193175){var _0x4e6aa6=function(_0x5434e5){while(--_0x5434e5){_0x255b7e['push'](_0x255b7e['shift']());}};_0x4e6aa6(++_0x193175);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x1ab00a,_0xd5cd5e){_0x1ab00a=_0x1ab00a-0x0;var _0x5bb48b=_0xb7a7[_0x1ab00a];return _0x5bb48b;};'use strict';var multer=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var path=require(_0x7b7a('0x2'));var timeout=require(_0x7b7a('0x3'));var express=require(_0x7b7a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b7a('0x5'));var config=require(_0x7b7a('0x6'));var controller=require(_0x7b7a('0x7'));router['get']('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x9')]);router[_0x7b7a('0xa')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xd')]('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xe')]);router['put'](_0x7b7a('0xb'),auth['isAuthenticated'](),controller[_0x7b7a('0xf')]);router[_0x7b7a('0x10')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x11')]);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 f094867..1427449 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 _0xaf15=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xaf15,0x87));var _0x5af1=function(_0x549d4e,_0x48cfe7){_0x549d4e=_0x549d4e-0x0;var _0x4a8362=_0xaf15[_0x549d4e];return _0x4a8362;};'use strict';var Sequelize=require(_0x5af1('0x0'));module[_0x5af1('0x1')]={'name':{'type':Sequelize[_0x5af1('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x5af1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5af1('0x2')],'set':function(_0x3da583){this[_0x5af1('0x4')](_0x5af1('0x5'),_0x3da583?_0x3da583[_0x5af1('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x5af1('0x5'))?this[_0x5af1('0x7')](_0x5af1('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x5af1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x5af1('0x2')]},'record':{'type':Sequelize[_0x5af1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5af1('0x2')]}}; \ No newline at end of file +var _0xddcd=['name','setDataValue','getDataValue','options','split','BOOLEAN','exports','STRING'];(function(_0x17b5a1,_0x461863){var _0x19813d=function(_0x110509){while(--_0x110509){_0x17b5a1['push'](_0x17b5a1['shift']());}};_0x19813d(++_0x461863);}(_0xddcd,0x1be));var _0xdddc=function(_0x231291,_0x391a3d){_0x231291=_0x231291-0x0;var _0x32dbdd=_0xddcd[_0x231291];return _0x32dbdd;};'use strict';var Sequelize=require('sequelize');module[_0xdddc('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xdddc('0x1')],'unique':_0xdddc('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xdddc('0x1')],'set':function(_0x5e3a80){this[_0xdddc('0x3')]('options',_0x5e3a80?_0x5e3a80['join'](''):[]);},'get':function(){return this[_0xdddc('0x4')](_0xdddc('0x5'))?this[_0xdddc('0x4')](_0xdddc('0x5'))[_0xdddc('0x6')](''):[];}},'auth':{'type':Sequelize[_0xdddc('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdddc('0x1')]},'record':{'type':Sequelize[_0xdddc('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdddc('0x1')]},'description':{'type':Sequelize[_0xdddc('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fe5b46a..d9037f5 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 _0x9a35=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','body','html-pdf','rimraf','zip-dir','request-promise','moment','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/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','index','VoiceChanSpy','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0xa79f2,_0x5e4491){var _0x1a015e=function(_0x65bf69){while(--_0x65bf69){_0xa79f2['push'](_0xa79f2['shift']());}};_0x1a015e(++_0x5e4491);}(_0x9a35,0x10e));var _0x59a3=function(_0x65d748,_0x35e146){_0x65d748=_0x65d748-0x0;var _0x52e055=_0x9a35[_0x65d748];return _0x52e055;};'use strict';var pdf=require(_0x59a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x59a3('0x1'));var zipdir=require(_0x59a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59a3('0x3'));var moment=require(_0x59a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59a3('0x5'));var util=require(_0x59a3('0x6'));var path=require(_0x59a3('0x7'));var sox=require(_0x59a3('0x8'));var csv=require(_0x59a3('0x9'));var ejs=require(_0x59a3('0xa'));var fs=require('fs');var _=require(_0x59a3('0xb'));var squel=require(_0x59a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x59a3('0xd'));var deskjs=require(_0x59a3('0xe'));var toCsv=require(_0x59a3('0x9'));var querystring=require(_0x59a3('0xf'));var Papa=require(_0x59a3('0x10'));var Redis=require(_0x59a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x59a3('0x12'));var as=require(_0x59a3('0x13'));var hardwareService=require(_0x59a3('0x14'));var logger=require(_0x59a3('0x15'))(_0x59a3('0x16'));var utils=require(_0x59a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x59a3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe935,_0x17d88a){_0x17d88a=_0x17d88a||0xcc;return function(_0x220b5c){if(_0x220b5c){return _0x3fe935[_0x59a3('0x19')](_0x17d88a);}return _0x3fe935[_0x59a3('0x1a')](_0x17d88a)[_0x59a3('0x1b')]();};}function respondWithResult(_0x21ed2b,_0x428e59){_0x428e59=_0x428e59||0xc8;return function(_0x5b41da){if(_0x5b41da){return _0x21ed2b[_0x59a3('0x1a')](_0x428e59)['json'](_0x5b41da);}};}function respondWithFilteredResult(_0x4380b4,_0x541207){return function(_0x47c237){if(_0x47c237){var _0x3484f4=_0x47c237[_0x59a3('0x1c')],_0x105681=_0x541207[_0x59a3('0x1d')],_0x279ef1=_0x541207[_0x59a3('0x1d')]+_0x541207[_0x59a3('0x1e')],_0x2cb78a;if(_0x279ef1>=_0x3484f4){_0x279ef1=_0x3484f4;_0x2cb78a=0xc8;}else{_0x2cb78a=0xce;}_0x4380b4[_0x59a3('0x1a')](_0x2cb78a);return _0x4380b4[_0x59a3('0x1f')](_0x59a3('0x20'),_0x105681+'-'+_0x279ef1+'/'+_0x3484f4)[_0x59a3('0x21')](_0x47c237);}return null;};}function patchUpdates(_0x3b107c){return function(_0x154255){try{jsonpatch[_0x59a3('0x22')](_0x154255,_0x3b107c,!![]);}catch(_0x13e032){return BPromise[_0x59a3('0x23')](_0x13e032);}return _0x154255[_0x59a3('0x24')]();};}function saveUpdates(_0x5e8fb4,_0x32abba){return function(_0x4eb6b6){if(_0x4eb6b6){return _0x4eb6b6[_0x59a3('0x25')](_0x5e8fb4)[_0x59a3('0x26')](function(_0x2f9cba){return _0x2f9cba;});}return null;};}function removeEntity(_0x451d8e,_0x5f2fd4){return function(_0x21e631){if(_0x21e631){return _0x21e631[_0x59a3('0x27')]()['then'](function(){var _0x347739=_0x21e631[_0x59a3('0x28')]({'plain':!![]});var _0x536c1f=_0x59a3('0x29');return db[_0x59a3('0x2a')]['destroy']({'where':{'type':_0x536c1f,'resourceId':_0x347739['id']}})['then'](function(){return _0x21e631;});})[_0x59a3('0x26')](function(){_0x451d8e[_0x59a3('0x1a')](0xcc)[_0x59a3('0x1b')]();});}};}function handleEntityNotFound(_0x256640,_0x5e52f4){return function(_0x53c864){if(!_0x53c864){_0x256640[_0x59a3('0x19')](0x194);}return _0x53c864;};}function handleError(_0x252ee3,_0x582a6d){_0x582a6d=_0x582a6d||0x1f4;return function(_0x153e4d){logger['error'](_0x153e4d[_0x59a3('0x2b')]);if(_0x153e4d[_0x59a3('0x2c')]){delete _0x153e4d[_0x59a3('0x2c')];}_0x252ee3[_0x59a3('0x1a')](_0x582a6d)[_0x59a3('0x2d')](_0x153e4d);};}exports[_0x59a3('0x2e')]=function(_0x2632f0,_0x3fcae0){var _0x39c3ac={},_0x43a77e={},_0x476d9c={'count':0x0,'rows':[]};var _0x9f2d9d=_['map'](db[_0x59a3('0x2f')][_0x59a3('0x30')],function(_0x58c391){return{'name':_0x58c391['fieldName'],'type':_0x58c391[_0x59a3('0x31')]['key']};});_0x43a77e[_0x59a3('0x32')]=_[_0x59a3('0x33')](_0x9f2d9d,_0x59a3('0x2c'));_0x43a77e[_0x59a3('0x34')]=_[_0x59a3('0x35')](_0x2632f0[_0x59a3('0x34')]);_0x43a77e[_0x59a3('0x36')]=_[_0x59a3('0x37')](_0x43a77e[_0x59a3('0x32')],_0x43a77e[_0x59a3('0x34')]);_0x39c3ac['attributes']=_[_0x59a3('0x37')](_0x43a77e[_0x59a3('0x32')],qs[_0x59a3('0x38')](_0x2632f0[_0x59a3('0x34')][_0x59a3('0x38')]));_0x39c3ac[_0x59a3('0x39')]=_0x39c3ac[_0x59a3('0x39')]['length']?_0x39c3ac[_0x59a3('0x39')]:_0x43a77e[_0x59a3('0x32')];if(!_0x2632f0['query'][_0x59a3('0x3a')]('nolimit')){_0x39c3ac[_0x59a3('0x1e')]=qs['limit'](_0x2632f0[_0x59a3('0x34')][_0x59a3('0x1e')]);_0x39c3ac[_0x59a3('0x1d')]=qs['offset'](_0x2632f0[_0x59a3('0x34')]['offset']);}_0x39c3ac[_0x59a3('0x3b')]=qs[_0x59a3('0x3c')](_0x2632f0[_0x59a3('0x34')]['sort']);_0x39c3ac[_0x59a3('0x3d')]=qs[_0x59a3('0x36')](_[_0x59a3('0x3e')](_0x2632f0[_0x59a3('0x34')],_0x43a77e[_0x59a3('0x36')]),_0x9f2d9d);if(_0x2632f0[_0x59a3('0x34')][_0x59a3('0x3f')]){_0x39c3ac[_0x59a3('0x3d')]=_[_0x59a3('0x40')](_0x39c3ac[_0x59a3('0x3d')],{'$or':_['map'](_0x9f2d9d,function(_0x45a467){if(_0x45a467[_0x59a3('0x31')]!==_0x59a3('0x41')){var _0x271cc4={};_0x271cc4[_0x45a467[_0x59a3('0x2c')]]={'$like':'%'+_0x2632f0[_0x59a3('0x34')][_0x59a3('0x3f')]+'%'};return _0x271cc4;}})});}_0x39c3ac=_['merge']({},_0x39c3ac,_0x2632f0[_0x59a3('0x42')]);var _0x2800e6={'where':_0x39c3ac[_0x59a3('0x3d')]};return db[_0x59a3('0x2f')][_0x59a3('0x1c')](_0x2800e6)['then'](function(_0x2e0ef0){_0x476d9c['count']=_0x2e0ef0;if(_0x2632f0[_0x59a3('0x34')][_0x59a3('0x43')]){_0x39c3ac[_0x59a3('0x44')]=[{'all':!![]}];}return db[_0x59a3('0x2f')][_0x59a3('0x45')](_0x39c3ac);})[_0x59a3('0x26')](function(_0x5462d3){_0x476d9c[_0x59a3('0x46')]=_0x5462d3;return _0x476d9c;})[_0x59a3('0x26')](respondWithFilteredResult(_0x3fcae0,_0x39c3ac))[_0x59a3('0x47')](handleError(_0x3fcae0,null));};exports['show']=function(_0x35e803,_0xa72a58){var _0x30c128={'raw':![],'where':{'id':_0x35e803[_0x59a3('0x48')]['id']}},_0x8a73dc={};_0x8a73dc['model']=_['keys'](db['VoiceChanSpy'][_0x59a3('0x30')]);_0x8a73dc[_0x59a3('0x34')]=_[_0x59a3('0x35')](_0x35e803[_0x59a3('0x34')]);_0x8a73dc[_0x59a3('0x36')]=_['intersection'](_0x8a73dc[_0x59a3('0x32')],_0x8a73dc[_0x59a3('0x34')]);_0x30c128[_0x59a3('0x39')]=_[_0x59a3('0x37')](_0x8a73dc[_0x59a3('0x32')],qs[_0x59a3('0x38')](_0x35e803[_0x59a3('0x34')][_0x59a3('0x38')]));_0x30c128[_0x59a3('0x39')]=_0x30c128[_0x59a3('0x39')][_0x59a3('0x49')]?_0x30c128['attributes']:_0x8a73dc[_0x59a3('0x32')];if(_0x35e803[_0x59a3('0x34')]['includeAll']){_0x30c128[_0x59a3('0x44')]=[{'all':!![]}];}_0x30c128=_['merge']({},_0x30c128,_0x35e803[_0x59a3('0x42')]);return db[_0x59a3('0x2f')][_0x59a3('0x4a')](_0x30c128)[_0x59a3('0x26')](handleEntityNotFound(_0xa72a58,null))[_0x59a3('0x26')](respondWithResult(_0xa72a58,null))[_0x59a3('0x47')](handleError(_0xa72a58,null));};exports[_0x59a3('0x4b')]=function(_0x208859,_0x34a1b8){return db['VoiceChanSpy']['create'](_0x208859['body'],{})[_0x59a3('0x26')](function(_0x49a009){var _0x5cd1e0=_0x208859['user']['get']({'plain':!![]});if(!_0x5cd1e0)throw new Error(_0x59a3('0x4c'));if(_0x5cd1e0['role']===_0x59a3('0x4d')){var _0x5e56b4=_0x49a009[_0x59a3('0x28')]({'plain':!![]});var _0x2f4881='ChanSpies';return db[_0x59a3('0x4e')]['find']({'where':{'name':_0x2f4881,'userProfileId':_0x5cd1e0[_0x59a3('0x4f')]},'raw':!![]})[_0x59a3('0x26')](function(_0x4dc7df){if(_0x4dc7df&&_0x4dc7df[_0x59a3('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e56b4[_0x59a3('0x2c')],'resourceId':_0x5e56b4['id'],'type':_0x4dc7df[_0x59a3('0x2c')],'sectionId':_0x4dc7df['id']},{})[_0x59a3('0x26')](function(){return _0x49a009;});}else{return _0x49a009;}})[_0x59a3('0x47')](function(_0x172c6d){logger[_0x59a3('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x172c6d);throw _0x172c6d;});}return _0x49a009;})[_0x59a3('0x26')](respondWithResult(_0x34a1b8,0xc9))['catch'](handleError(_0x34a1b8,null));};exports[_0x59a3('0x25')]=function(_0x485b9f,_0x47464c){if(_0x485b9f[_0x59a3('0x52')]['id']){delete _0x485b9f[_0x59a3('0x52')]['id'];}return db['VoiceChanSpy'][_0x59a3('0x4a')]({'where':{'id':_0x485b9f[_0x59a3('0x48')]['id']}})[_0x59a3('0x26')](handleEntityNotFound(_0x47464c,null))['then'](saveUpdates(_0x485b9f[_0x59a3('0x52')],null))[_0x59a3('0x26')](respondWithResult(_0x47464c,null))[_0x59a3('0x47')](handleError(_0x47464c,null));};exports[_0x59a3('0x27')]=function(_0x653731,_0x429ab1){return db[_0x59a3('0x2f')][_0x59a3('0x4a')]({'where':{'id':_0x653731[_0x59a3('0x48')]['id']}})[_0x59a3('0x26')](handleEntityNotFound(_0x429ab1,null))[_0x59a3('0x26')](removeEntity(_0x429ab1,null))[_0x59a3('0x47')](handleError(_0x429ab1,null));}; \ No newline at end of file +var _0x0667=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','filter','where','merge','map','type','VIRTUAL','options','include','VoiceChanSpy','rows','catch','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1f8ff5,_0x523c89){var _0x3c7cec=function(_0x18d1ec){while(--_0x18d1ec){_0x1f8ff5['push'](_0x1f8ff5['shift']());}};_0x3c7cec(++_0x523c89);}(_0x0667,0x183));var _0x7066=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0667[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0x7066('0x0'));var emlformat=require(_0x7066('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7066('0x2'));var jsonpatch=require(_0x7066('0x3'));var rp=require(_0x7066('0x4'));var moment=require(_0x7066('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7066('0x6'));var util=require('util');var path=require(_0x7066('0x7'));var sox=require(_0x7066('0x8'));var csv=require(_0x7066('0x9'));var ejs=require(_0x7066('0xa'));var fs=require('fs');var _=require(_0x7066('0xb'));var squel=require(_0x7066('0xc'));var crypto=require(_0x7066('0xd'));var jsforce=require(_0x7066('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7066('0x9'));var querystring=require(_0x7066('0xf'));var Papa=require(_0x7066('0x10'));var Redis=require(_0x7066('0x11'));var authService=require(_0x7066('0x12'));var qs=require(_0x7066('0x13'));var as=require(_0x7066('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7066('0x15'))(_0x7066('0x16'));var utils=require(_0x7066('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7066('0x18'));var db=require(_0x7066('0x19'))['db'];function respondWithStatusCode(_0x51761d,_0x1af224){_0x1af224=_0x1af224||0xcc;return function(_0x85ae1f){if(_0x85ae1f){return _0x51761d[_0x7066('0x1a')](_0x1af224);}return _0x51761d[_0x7066('0x1b')](_0x1af224)[_0x7066('0x1c')]();};}function respondWithResult(_0x1cfc9e,_0x467bad){_0x467bad=_0x467bad||0xc8;return function(_0xb05d3a){if(_0xb05d3a){return _0x1cfc9e[_0x7066('0x1b')](_0x467bad)[_0x7066('0x1d')](_0xb05d3a);}};}function respondWithFilteredResult(_0x1d2f59,_0x49e75a){return function(_0x74ab25){if(_0x74ab25){var _0x516e2e=_0x74ab25[_0x7066('0x1e')],_0x11ed32=_0x49e75a[_0x7066('0x1f')],_0x251fab=_0x49e75a[_0x7066('0x1f')]+_0x49e75a['limit'],_0x1b87ce;if(_0x251fab>=_0x516e2e){_0x251fab=_0x516e2e;_0x1b87ce=0xc8;}else{_0x1b87ce=0xce;}_0x1d2f59[_0x7066('0x1b')](_0x1b87ce);return _0x1d2f59[_0x7066('0x20')](_0x7066('0x21'),_0x11ed32+'-'+_0x251fab+'/'+_0x516e2e)[_0x7066('0x1d')](_0x74ab25);}return null;};}function patchUpdates(_0x211ca8){return function(_0xe2b889){try{jsonpatch[_0x7066('0x22')](_0xe2b889,_0x211ca8,!![]);}catch(_0x5ede0d){return BPromise[_0x7066('0x23')](_0x5ede0d);}return _0xe2b889[_0x7066('0x24')]();};}function saveUpdates(_0x18a90b,_0x30150a){return function(_0x3d7718){if(_0x3d7718){return _0x3d7718[_0x7066('0x25')](_0x18a90b)['then'](function(_0xfdaca3){return _0xfdaca3;});}return null;};}function removeEntity(_0x25324a,_0x5ef6be){return function(_0x58572f){if(_0x58572f){return _0x58572f['destroy']()[_0x7066('0x26')](function(){var _0x155f83=_0x58572f[_0x7066('0x27')]({'plain':!![]});var _0x22ae3f=_0x7066('0x28');return db[_0x7066('0x29')]['destroy']({'where':{'type':_0x22ae3f,'resourceId':_0x155f83['id']}})[_0x7066('0x26')](function(){return _0x58572f;});})[_0x7066('0x26')](function(){_0x25324a['status'](0xcc)[_0x7066('0x1c')]();});}};}function handleEntityNotFound(_0x180410,_0x5151cd){return function(_0x174c60){if(!_0x174c60){_0x180410[_0x7066('0x1a')](0x194);}return _0x174c60;};}function handleError(_0x22e4e0,_0x24fe02){_0x24fe02=_0x24fe02||0x1f4;return function(_0x161ff7){logger[_0x7066('0x2a')](_0x161ff7[_0x7066('0x2b')]);if(_0x161ff7[_0x7066('0x2c')]){delete _0x161ff7[_0x7066('0x2c')];}_0x22e4e0['status'](_0x24fe02)['send'](_0x161ff7);};}exports[_0x7066('0x2d')]=function(_0xe55b5e,_0x2edfeb){var _0x3b1497={},_0x530e50={},_0x4fc32b={'count':0x0,'rows':[]};var _0x3f4441=_['map'](db['VoiceChanSpy'][_0x7066('0x2e')],function(_0x35b1e9){return{'name':_0x35b1e9['fieldName'],'type':_0x35b1e9['type'][_0x7066('0x2f')]};});_0x530e50[_0x7066('0x30')]=_['map'](_0x3f4441,_0x7066('0x2c'));_0x530e50[_0x7066('0x31')]=_[_0x7066('0x32')](_0xe55b5e[_0x7066('0x31')]);_0x530e50[_0x7066('0x33')]=_[_0x7066('0x34')](_0x530e50[_0x7066('0x30')],_0x530e50['query']);_0x3b1497['attributes']=_[_0x7066('0x34')](_0x530e50['model'],qs[_0x7066('0x35')](_0xe55b5e[_0x7066('0x31')][_0x7066('0x35')]));_0x3b1497['attributes']=_0x3b1497[_0x7066('0x36')]['length']?_0x3b1497[_0x7066('0x36')]:_0x530e50['model'];if(!_0xe55b5e['query']['hasOwnProperty'](_0x7066('0x37'))){_0x3b1497[_0x7066('0x38')]=qs[_0x7066('0x38')](_0xe55b5e['query']['limit']);_0x3b1497[_0x7066('0x1f')]=qs[_0x7066('0x1f')](_0xe55b5e[_0x7066('0x31')]['offset']);}_0x3b1497[_0x7066('0x39')]=qs[_0x7066('0x3a')](_0xe55b5e[_0x7066('0x31')][_0x7066('0x3a')]);_0x3b1497['where']=qs[_0x7066('0x33')](_['pick'](_0xe55b5e[_0x7066('0x31')],_0x530e50[_0x7066('0x33')]),_0x3f4441);if(_0xe55b5e['query'][_0x7066('0x3b')]){_0x3b1497[_0x7066('0x3c')]=_[_0x7066('0x3d')](_0x3b1497['where'],{'$or':_[_0x7066('0x3e')](_0x3f4441,function(_0x199238){if(_0x199238[_0x7066('0x3f')]!==_0x7066('0x40')){var _0x339bb5={};_0x339bb5[_0x199238[_0x7066('0x2c')]]={'$like':'%'+_0xe55b5e['query'][_0x7066('0x3b')]+'%'};return _0x339bb5;}})});}_0x3b1497=_[_0x7066('0x3d')]({},_0x3b1497,_0xe55b5e[_0x7066('0x41')]);var _0x4f70fa={'where':_0x3b1497[_0x7066('0x3c')]};return db['VoiceChanSpy'][_0x7066('0x1e')](_0x4f70fa)[_0x7066('0x26')](function(_0x5bb072){_0x4fc32b['count']=_0x5bb072;if(_0xe55b5e[_0x7066('0x31')]['includeAll']){_0x3b1497[_0x7066('0x42')]=[{'all':!![]}];}return db[_0x7066('0x43')]['findAll'](_0x3b1497);})[_0x7066('0x26')](function(_0x449a16){_0x4fc32b[_0x7066('0x44')]=_0x449a16;return _0x4fc32b;})[_0x7066('0x26')](respondWithFilteredResult(_0x2edfeb,_0x3b1497))[_0x7066('0x45')](handleError(_0x2edfeb,null));};exports['show']=function(_0x386738,_0x3a9481){var _0x52a03c={'raw':![],'where':{'id':_0x386738['params']['id']}},_0x72304={};_0x72304[_0x7066('0x30')]=_['keys'](db[_0x7066('0x43')][_0x7066('0x2e')]);_0x72304['query']=_[_0x7066('0x32')](_0x386738['query']);_0x72304[_0x7066('0x33')]=_[_0x7066('0x34')](_0x72304['model'],_0x72304[_0x7066('0x31')]);_0x52a03c['attributes']=_['intersection'](_0x72304['model'],qs[_0x7066('0x35')](_0x386738['query'][_0x7066('0x35')]));_0x52a03c['attributes']=_0x52a03c['attributes'][_0x7066('0x46')]?_0x52a03c[_0x7066('0x36')]:_0x72304['model'];if(_0x386738[_0x7066('0x31')][_0x7066('0x47')]){_0x52a03c[_0x7066('0x42')]=[{'all':!![]}];}_0x52a03c=_['merge']({},_0x52a03c,_0x386738[_0x7066('0x41')]);return db['VoiceChanSpy'][_0x7066('0x48')](_0x52a03c)[_0x7066('0x26')](handleEntityNotFound(_0x3a9481,null))['then'](respondWithResult(_0x3a9481,null))[_0x7066('0x45')](handleError(_0x3a9481,null));};exports[_0x7066('0x49')]=function(_0x45347b,_0x534aca){return db[_0x7066('0x43')][_0x7066('0x49')](_0x45347b[_0x7066('0x4a')],{})[_0x7066('0x26')](function(_0xb877ae){var _0x24eba4=_0x45347b['user'][_0x7066('0x27')]({'plain':!![]});if(!_0x24eba4)throw new Error(_0x7066('0x4b'));if(_0x24eba4['role']===_0x7066('0x4c')){var _0x50fc06=_0xb877ae['get']({'plain':!![]});var _0x26ead2=_0x7066('0x28');return db[_0x7066('0x4d')][_0x7066('0x48')]({'where':{'name':_0x26ead2,'userProfileId':_0x24eba4[_0x7066('0x4e')]},'raw':!![]})['then'](function(_0x464e16){if(_0x464e16&&_0x464e16[_0x7066('0x4f')]===0x0){return db[_0x7066('0x29')][_0x7066('0x49')]({'name':_0x50fc06[_0x7066('0x2c')],'resourceId':_0x50fc06['id'],'type':_0x464e16[_0x7066('0x2c')],'sectionId':_0x464e16['id']},{})[_0x7066('0x26')](function(){return _0xb877ae;});}else{return _0xb877ae;}})[_0x7066('0x45')](function(_0x4c9eac){logger[_0x7066('0x2a')](_0x7066('0x50'),_0x4c9eac);throw _0x4c9eac;});}return _0xb877ae;})['then'](respondWithResult(_0x534aca,0xc9))[_0x7066('0x45')](handleError(_0x534aca,null));};exports['update']=function(_0x6a255b,_0x36c616){if(_0x6a255b[_0x7066('0x4a')]['id']){delete _0x6a255b[_0x7066('0x4a')]['id'];}return db[_0x7066('0x43')][_0x7066('0x48')]({'where':{'id':_0x6a255b[_0x7066('0x51')]['id']}})['then'](handleEntityNotFound(_0x36c616,null))[_0x7066('0x26')](saveUpdates(_0x6a255b['body'],null))['then'](respondWithResult(_0x36c616,null))['catch'](handleError(_0x36c616,null));};exports['destroy']=function(_0x245414,_0x5d99a2){return db[_0x7066('0x43')][_0x7066('0x48')]({'where':{'id':_0x245414['params']['id']}})[_0x7066('0x26')](handleEntityNotFound(_0x5d99a2,null))['then'](removeEntity(_0x5d99a2,null))[_0x7066('0x45')](handleError(_0x5d99a2,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 401136c..a816f2a 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 _0xe860=['User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','chanspy','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','record','StopMixMonitor','length','concat','internal'];(function(_0x5d5597,_0x4ade20){var _0x362dbd=function(_0x58f5b8){while(--_0x58f5b8){_0x5d5597['push'](_0x5d5597['shift']());}};_0x362dbd(++_0x4ade20);}(_0xe860,0x188));var _0x0e86=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xe860[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var BPromise=require(_0x0e86('0x2'));var attributes=require(_0x0e86('0x3'));var getUserApplications=function(_0x4b3b17,_0x75754f,_0x23c2d4){var _0x49b8bb=0x1;var _0x21d021=[];var _0x19711d={'context':_0x75754f[_0x0e86('0x4')]||_0x0e86('0x5'),'exten':util[_0x0e86('0x6')](_0x0e86('0x7'),_0x4b3b17[_0x0e86('0x8')],_0x23c2d4),'type':_0x0e86('0x9'),'isApp':![],'ChanSpyId':_0x4b3b17['id'],'UserId':_0x75754f['id']};_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':'Set','appdata':util[_0x0e86('0x6')]('CDR(type)=%s',_0x0e86('0xc')),'priority':_0x49b8bb++},_0x19711d));if(_0x4b3b17['record']){_0x21d021['push'](_['merge']({'app':'MixMonitor','appdata':util[_0x0e86('0x6')]('${UNIQUEID}.%s,a',_0x4b3b17[_0x0e86('0xd')]),'priority':_0x49b8bb++},_0x19711d));}if(_0x4b3b17[_0x0e86('0xe')]){_0x21d021['push'](_[_0x0e86('0xb')]({'app':_0x0e86('0xf'),'appdata':_0x4b3b17[_0x0e86('0x10')],'priority':_0x49b8bb++},_0x19711d));}_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':_0x0e86('0x11'),'appdata':util[_0x0e86('0x6')]('SIP/%s,%s',_0x75754f[_0x0e86('0x12')],_0x4b3b17[_0x0e86('0x13')]?_0x4b3b17[_0x0e86('0x13')][_0x0e86('0x14')](''):''),'priority':_0x49b8bb++},_0x19711d));if(_0x4b3b17[_0x0e86('0x15')]){_0x21d021[_0x0e86('0xa')](_[_0x0e86('0xb')]({'app':_0x0e86('0x16'),'priority':_0x49b8bb++},_0x19711d));}return _0x21d021;};var getChanSpyApplications=function(_0x32cd00,_0x120d6b){var _0x3087ed=[];for(var _0x27c16a=0x0,_0xe48b49=0x1;_0x27c16a<_0x120d6b[_0x0e86('0x17')];_0x27c16a++,_0xe48b49=0x1){_0x3087ed=_0x3087ed[_0x0e86('0x18')](getUserApplications(_0x32cd00,_0x120d6b[_0x27c16a],_0x120d6b[_0x27c16a][_0x0e86('0x19')]));if(_0x120d6b[_0x27c16a][_0x0e86('0x19')]!=_0x120d6b[_0x27c16a][_0x0e86('0x12')]){_0x3087ed=_0x3087ed[_0x0e86('0x18')](getUserApplications(_0x32cd00,_0x120d6b[_0x27c16a],_0x120d6b[_0x27c16a]['name']));}}return _0x3087ed;};var getChanSpyPromise=function(_0x5bc4e3,_0x54579d){return new BPromise(function(_0x1fd8be,_0x1dcc3e){return _0x5bc4e3[_0x0e86('0x1a')]['findAll']({'attributes':['id',_0x0e86('0x12'),'internal'],'where':{'role':_0x0e86('0x1b'),'chanspy':!![]},'raw':!![]})[_0x0e86('0x1c')](function(_0x32e777){if(_0x32e777){return _0x1fd8be(getChanSpyApplications(_0x54579d,_0x32e777));}return _0x1fd8be([]);})[_0x0e86('0x1d')](function(_0x17edb4){_0x1dcc3e(_0x17edb4);});});};module[_0x0e86('0x1e')]=function(_0x538ef3,_0x215f51){var _0x122cd2=_0x538ef3[_0x0e86('0x1f')];return _0x538ef3[_0x0e86('0x20')](_0x0e86('0x21'),attributes,{'tableName':_0x0e86('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x285f14,_0x52b4a1,_0x7ad308){return getChanSpyPromise(_0x122cd2,_0x285f14)[_0x0e86('0x1c')](function(_0x1ae6fe){if(_0x1ae6fe&&_0x1ae6fe[_0x0e86('0x17')]){return _0x122cd2[_0x0e86('0x23')][_0x0e86('0x24')](_0x1ae6fe);}})['then'](function(){_0x7ad308();})[_0x0e86('0x1d')](function(_0x487afa){_0x7ad308(_0x487afa);});},'afterUpdate':function(_0x3a2e4a,_0x13a187,_0x5b483f){return _0x122cd2['VoiceExtension'][_0x0e86('0x25')]({'where':{'ChanSpyId':_0x3a2e4a['id']}})[_0x0e86('0x1c')](function(){return getChanSpyPromise(_0x122cd2,_0x3a2e4a);})[_0x0e86('0x1c')](function(_0x1a7f77){if(_0x1a7f77&&_0x1a7f77['length']){return _0x122cd2['VoiceExtension'][_0x0e86('0x24')](_0x1a7f77);}})[_0x0e86('0x1c')](function(){_0x5b483f();})[_0x0e86('0x1d')](function(_0xfd3577){_0x5b483f(_0xfd3577);});},'afterDestroy':function(_0x40519b,_0x53139c,_0x2194fd){return _0x122cd2[_0x0e86('0x23')][_0x0e86('0x25')]({'where':{'ChanSpyId':_0x40519b['id']}})[_0x0e86('0x1c')](function(){_0x2194fd();})['catch'](function(_0x12e8ab){_0x2194fd(_0x12e8ab);});}}});}; \ No newline at end of file +var _0x41bb=['util','./voiceChanSpy.attributes','context','from-sip','format','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','length','concat','internal','User','agent','then','catch','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x534121,_0x18e34e){var _0x634d95=function(_0x482084){while(--_0x482084){_0x534121['push'](_0x534121['shift']());}};_0x634d95(++_0x18e34e);}(_0x41bb,0xc5));var _0xb41b=function(_0x3aab4f,_0x2fc299){_0x3aab4f=_0x3aab4f-0x0;var _0x3e360d=_0x41bb[_0x3aab4f];return _0x3e360d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var BPromise=require('bluebird');var attributes=require(_0xb41b('0x2'));var getUserApplications=function(_0x4d5578,_0x30ea75,_0x1c9d36){var _0x148333=0x1;var _0x448c8e=[];var _0x4ee21b={'context':_0x30ea75[_0xb41b('0x3')]||_0xb41b('0x4'),'exten':util[_0xb41b('0x5')]('%s%s',_0x4d5578['prefix'],_0x1c9d36),'type':'system','isApp':![],'ChanSpyId':_0x4d5578['id'],'UserId':_0x30ea75['id']};_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':'Set','appdata':util[_0xb41b('0x5')](_0xb41b('0x8'),_0xb41b('0x9')),'priority':_0x148333++},_0x4ee21b));if(_0x4d5578[_0xb41b('0xa')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0xb'),'appdata':util['format'](_0xb41b('0xc'),_0x4d5578['recordingFormat']),'priority':_0x148333++},_0x4ee21b));}if(_0x4d5578[_0xb41b('0xd')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0xe'),'appdata':_0x4d5578[_0xb41b('0xf')],'priority':_0x148333++},_0x4ee21b));}_0x448c8e['push'](_[_0xb41b('0x7')]({'app':_0xb41b('0x10'),'appdata':util[_0xb41b('0x5')](_0xb41b('0x11'),_0x30ea75[_0xb41b('0x12')],_0x4d5578['options']?_0x4d5578['options']['join'](''):''),'priority':_0x148333++},_0x4ee21b));if(_0x4d5578[_0xb41b('0xa')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0x13'),'priority':_0x148333++},_0x4ee21b));}return _0x448c8e;};var getChanSpyApplications=function(_0x29ea51,_0x54591e){var _0x2f3673=[];for(var _0xd0b6b5=0x0,_0x401dd9=0x1;_0xd0b6b5<_0x54591e[_0xb41b('0x14')];_0xd0b6b5++,_0x401dd9=0x1){_0x2f3673=_0x2f3673[_0xb41b('0x15')](getUserApplications(_0x29ea51,_0x54591e[_0xd0b6b5],_0x54591e[_0xd0b6b5][_0xb41b('0x16')]));if(_0x54591e[_0xd0b6b5][_0xb41b('0x16')]!=_0x54591e[_0xd0b6b5]['name']){_0x2f3673=_0x2f3673['concat'](getUserApplications(_0x29ea51,_0x54591e[_0xd0b6b5],_0x54591e[_0xd0b6b5]['name']));}}return _0x2f3673;};var getChanSpyPromise=function(_0xf109f8,_0x503e86){return new BPromise(function(_0x307633,_0x1de9ea){return _0xf109f8[_0xb41b('0x17')]['findAll']({'attributes':['id','name',_0xb41b('0x16')],'where':{'role':_0xb41b('0x18'),'chanspy':!![]},'raw':!![]})[_0xb41b('0x19')](function(_0x2373f4){if(_0x2373f4){return _0x307633(getChanSpyApplications(_0x503e86,_0x2373f4));}return _0x307633([]);})[_0xb41b('0x1a')](function(_0x42dccb){_0x1de9ea(_0x42dccb);});});};module['exports']=function(_0x58f149,_0x2b436f){var _0x21045f=_0x58f149[_0xb41b('0x1b')];return _0x58f149['define'](_0xb41b('0x1c'),attributes,{'tableName':_0xb41b('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x546101,_0x2a5306,_0x34f908){return getChanSpyPromise(_0x21045f,_0x546101)['then'](function(_0xed3c7e){if(_0xed3c7e&&_0xed3c7e['length']){return _0x21045f[_0xb41b('0x1e')][_0xb41b('0x1f')](_0xed3c7e);}})['then'](function(){_0x34f908();})[_0xb41b('0x1a')](function(_0x4265b8){_0x34f908(_0x4265b8);});},'afterUpdate':function(_0x583099,_0x4c2e41,_0x2a5286){return _0x21045f[_0xb41b('0x1e')][_0xb41b('0x20')]({'where':{'ChanSpyId':_0x583099['id']}})[_0xb41b('0x19')](function(){return getChanSpyPromise(_0x21045f,_0x583099);})[_0xb41b('0x19')](function(_0x181cbd){if(_0x181cbd&&_0x181cbd[_0xb41b('0x14')]){return _0x21045f['VoiceExtension'][_0xb41b('0x1f')](_0x181cbd);}})[_0xb41b('0x19')](function(){_0x2a5286();})['catch'](function(_0xe64568){_0x2a5286(_0xe64568);});},'afterDestroy':function(_0x482764,_0x38277f,_0x31d4cd){return _0x21045f['VoiceExtension'][_0xb41b('0x20')]({'where':{'ChanSpyId':_0x482764['id']}})['then'](function(){_0x31d4cd();})[_0xb41b('0x1a')](function(_0x37c142){_0x31d4cd(_0x37c142);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a17cf09..9903e90 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 _0xa20b=['util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xa20b,0x18f));var _0xba20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa20b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xba20('0x0'));var util=require(_0xba20('0x1'));var moment=require('moment');var BPromise=require(_0xba20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba20('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba20('0x4'))('rpc');var config=require(_0xba20('0x5'));var jayson=require(_0xba20('0x6'));var client=jayson[_0xba20('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4de8,_0x325abe,_0x49b483){return new BPromise(function(_0x2373ec,_0x7efb30){return client[_0xba20('0x8')](_0x5d4de8,_0x49b483)[_0xba20('0x9')](function(_0x388191){logger['info'](_0xba20('0xa'),_0x325abe,_0xba20('0xb'));logger[_0xba20('0xc')](_0xba20('0xd'),_0x325abe,_0xba20('0xb'),JSON[_0xba20('0xe')](_0x388191));if(_0x388191[_0xba20('0xf')]){if(_0x388191[_0xba20('0xf')][_0xba20('0x10')]===0x1f4){logger['error'](_0xba20('0xa'),_0x325abe,_0x388191[_0xba20('0xf')][_0xba20('0x11')]);return _0x7efb30(_0x388191[_0xba20('0xf')][_0xba20('0x11')]);}logger[_0xba20('0xf')](_0xba20('0xa'),_0x325abe,_0x388191[_0xba20('0xf')][_0xba20('0x11')]);return _0x2373ec(_0x388191[_0xba20('0xf')][_0xba20('0x11')]);}else{logger['info'](_0xba20('0xa'),_0x325abe,_0xba20('0xb'));_0x2373ec(_0x388191[_0xba20('0x12')][_0xba20('0x11')]);}})[_0xba20('0x13')](function(_0x5bee0a){logger[_0xba20('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x325abe,_0x5bee0a);_0x7efb30(_0x5bee0a);});});} \ No newline at end of file +var _0x7668=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x7390ac,_0x5653ce){var _0x32d4ed=function(_0x25e62d){while(--_0x25e62d){_0x7390ac['push'](_0x7390ac['shift']());}};_0x32d4ed(++_0x5653ce);}(_0x7668,0x1be));var _0x8766=function(_0x2a53e9,_0x5289ce){_0x2a53e9=_0x2a53e9-0x0;var _0x463d5a=_0x7668[_0x2a53e9];return _0x463d5a;};'use strict';var _=require(_0x8766('0x0'));var util=require(_0x8766('0x1'));var moment=require(_0x8766('0x2'));var BPromise=require('bluebird');var rs=require(_0x8766('0x3'));var fs=require('fs');var Redis=require(_0x8766('0x4'));var db=require(_0x8766('0x5'))['db'];var utils=require(_0x8766('0x6'));var logger=require(_0x8766('0x7'))(_0x8766('0x8'));var config=require('../../config/environment');var jayson=require(_0x8766('0x9'));var client=jayson[_0x8766('0xa')][_0x8766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad889,_0x1093e8,_0x3f7e0a){return new BPromise(function(_0xf16586,_0x3e95ad){return client[_0x8766('0xc')](_0x5ad889,_0x3f7e0a)[_0x8766('0xd')](function(_0x4a96e9){logger[_0x8766('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1093e8,_0x8766('0xf'));logger[_0x8766('0x10')](_0x8766('0x11'),_0x1093e8,_0x8766('0xf'),JSON['stringify'](_0x4a96e9));if(_0x4a96e9[_0x8766('0x12')]){if(_0x4a96e9[_0x8766('0x12')][_0x8766('0x13')]===0x1f4){logger['error'](_0x8766('0x14'),_0x1093e8,_0x4a96e9[_0x8766('0x12')]['message']);return _0x3e95ad(_0x4a96e9['error'][_0x8766('0x15')]);}logger[_0x8766('0x12')](_0x8766('0x14'),_0x1093e8,_0x4a96e9[_0x8766('0x12')][_0x8766('0x15')]);return _0xf16586(_0x4a96e9[_0x8766('0x12')][_0x8766('0x15')]);}else{logger[_0x8766('0xe')](_0x8766('0x14'),_0x1093e8,'request\x20sent');_0xf16586(_0x4a96e9['result'][_0x8766('0x15')]);}})[_0x8766('0x16')](function(_0x21f30d){logger[_0x8766('0x12')](_0x8766('0x14'),_0x1093e8,_0x21f30d);_0x3e95ad(_0x21f30d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 933f3da..6ee03eb 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 _0xd238=['multer','connect-timeout','express','../../components/auth/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd238,0x1ea));var _0x8d23=function(_0x2f9c2b,_0x3151de){_0x2f9c2b=_0x2f9c2b-0x0;var _0x2b0fc6=_0xd238[_0x2f9c2b];return _0x2b0fc6;};'use strict';var multer=require(_0x8d23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d23('0x1'));var express=require(_0x8d23('0x2'));var router=express['Router']();var auth=require(_0x8d23('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d23('0x4'));router[_0x8d23('0x5')]('/',auth[_0x8d23('0x6')](),controller[_0x8d23('0x7')]);router[_0x8d23('0x5')](_0x8d23('0x8'),auth[_0x8d23('0x6')](),controller[_0x8d23('0x9')]);router[_0x8d23('0xa')]('/',auth[_0x8d23('0x6')](),controller[_0x8d23('0xb')]);router['put'](_0x8d23('0x8'),auth[_0x8d23('0x6')](),controller[_0x8d23('0xc')]);router['delete']('/:id',auth[_0x8d23('0x6')](),controller['destroy']);module[_0x8d23('0xd')]=router; \ No newline at end of file +var _0x74b4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','put','update','delete','destroy','multer','util','path'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x74b4,0x96));var _0x474b=function(_0x1bb6ff,_0x4a424c){_0x1bb6ff=_0x1bb6ff-0x0;var _0x427af5=_0x74b4[_0x1bb6ff];return _0x427af5;};'use strict';var multer=require(_0x474b('0x0'));var util=require(_0x474b('0x1'));var path=require(_0x474b('0x2'));var timeout=require(_0x474b('0x3'));var express=require(_0x474b('0x4'));var router=express['Router']();var auth=require(_0x474b('0x5'));var interaction=require(_0x474b('0x6'));var config=require(_0x474b('0x7'));var controller=require(_0x474b('0x8'));router[_0x474b('0x9')]('/',auth[_0x474b('0xa')](),controller[_0x474b('0xb')]);router['get']('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0xc')]);router['post']('/',auth[_0x474b('0xa')](),controller['create']);router[_0x474b('0xd')]('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0xe')]);router[_0x474b('0xf')]('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 5066056..00501a9 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x3e74,0x175));var _0x43e7=function(_0x3b20c1,_0x228c02){_0x3b20c1=_0x3b20c1-0x0;var _0x405901=_0x3e74[_0x3b20c1];return _0x405901;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x3a4d57,_0x270c2d){var _0x1175dd=function(_0x1f689a){while(--_0x1f689a){_0x3a4d57['push'](_0x3a4d57['shift']());}};_0x1175dd(++_0x270c2d);}(_0x3e74,0x175));var _0x43e7=function(_0x2b8d94,_0x2a606f){_0x2b8d94=_0x2b8d94-0x0;var _0xb7c898=_0x3e74[_0x2b8d94];return _0xb7c898;};'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 5bf4530..54e9ef3 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 _0x7b05=['then','get','Contexts','UserProfileResource','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','where','options','includeAll','include','findAll','show','params','find','create','body','readFileSync','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','join','server/files/templates/context.ejs','render','Reload','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy'];(function(_0x2b053d,_0x5ccc5c){var _0x3b9030=function(_0x22016e){while(--_0x22016e){_0x2b053d['push'](_0x2b053d['shift']());}};_0x3b9030(++_0x5ccc5c);}(_0x7b05,0x91));var _0x57b0=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x7b05[_0x1a89ca];return _0x29cbb2;};'use strict';var pdf=require(_0x57b0('0x0'));var emlformat=require(_0x57b0('0x1'));var rimraf=require(_0x57b0('0x2'));var zipdir=require(_0x57b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57b0('0x4'));var moment=require('moment');var BPromise=require(_0x57b0('0x5'));var Mustache=require(_0x57b0('0x6'));var util=require(_0x57b0('0x7'));var path=require(_0x57b0('0x8'));var sox=require(_0x57b0('0x9'));var csv=require('to-csv');var ejs=require(_0x57b0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x57b0('0x15'));var client=jayson[_0x57b0('0x16')][_0x57b0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x520f45,_0x575901,_0x6d060a,_0x3f95e3){return new BPromise(function(_0xc9044f,_0x3b48a3){var _0x564b15=_0x3f95e3||client;return _0x564b15[_0x57b0('0x18')](_0x520f45,_0x6d060a)['then'](function(_0x235d4a){logger[_0x57b0('0x19')]('VoiceContext,\x20%s,\x20%s',_0x575901,_0x57b0('0x1a'));logger[_0x57b0('0x1b')](_0x57b0('0x1c'),_0x575901,_0x57b0('0x1a'),JSON[_0x57b0('0x1d')](_0x235d4a));if(_0x235d4a['error']){if(_0x235d4a[_0x57b0('0x1e')]['code']===0x1f4){logger['error'](_0x57b0('0x1f'),_0x575901,_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);return _0x3b48a3(_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);}logger[_0x57b0('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x575901,_0x235d4a[_0x57b0('0x1e')][_0x57b0('0x20')]);return _0xc9044f(_0x235d4a[_0x57b0('0x1e')]['message']);}else{logger[_0x57b0('0x19')](_0x57b0('0x1f'),_0x575901,_0x57b0('0x1a'));_0xc9044f(_0x235d4a[_0x57b0('0x21')][_0x57b0('0x20')]);}})[_0x57b0('0x22')](function(_0x29cf6f){logger[_0x57b0('0x1e')](_0x57b0('0x1f'),_0x575901,_0x29cf6f);_0x3b48a3(_0x29cf6f);});});}function respondWithStatusCode(_0x5c60b9,_0x55b870){_0x55b870=_0x55b870||0xcc;return function(_0x40c279){if(_0x40c279){return _0x5c60b9['sendStatus'](_0x55b870);}return _0x5c60b9[_0x57b0('0x23')](_0x55b870)[_0x57b0('0x24')]();};}function respondWithResult(_0x11514c,_0x38e3a0){_0x38e3a0=_0x38e3a0||0xc8;return function(_0x3e75e8){if(_0x3e75e8){return _0x11514c[_0x57b0('0x23')](_0x38e3a0)[_0x57b0('0x25')](_0x3e75e8);}};}function respondWithFilteredResult(_0x1eb523,_0xacd07c){return function(_0x109678){if(_0x109678){var _0x3e4e5f=_0x109678[_0x57b0('0x26')],_0x43b90f=_0xacd07c[_0x57b0('0x27')],_0x196c85=_0xacd07c[_0x57b0('0x27')]+_0xacd07c[_0x57b0('0x28')],_0x508288;if(_0x196c85>=_0x3e4e5f){_0x196c85=_0x3e4e5f;_0x508288=0xc8;}else{_0x508288=0xce;}_0x1eb523['status'](_0x508288);return _0x1eb523['set'](_0x57b0('0x29'),_0x43b90f+'-'+_0x196c85+'/'+_0x3e4e5f)[_0x57b0('0x25')](_0x109678);}return null;};}function patchUpdates(_0x1ccf42){return function(_0x5958a8){try{jsonpatch['apply'](_0x5958a8,_0x1ccf42,!![]);}catch(_0x9d9195){return BPromise['reject'](_0x9d9195);}return _0x5958a8[_0x57b0('0x2a')]();};}function saveUpdates(_0x5b6c1d,_0x5d19a6){return function(_0x2fb4b7){if(_0x2fb4b7){return _0x2fb4b7[_0x57b0('0x2b')](_0x5b6c1d)['then'](function(_0x17ac64){return _0x17ac64;});}return null;};}function removeEntity(_0x32e03e,_0x55ca86){return function(_0x16d6e1){if(_0x16d6e1){return _0x16d6e1[_0x57b0('0x2c')]()[_0x57b0('0x2d')](function(){var _0x547ea6=_0x16d6e1[_0x57b0('0x2e')]({'plain':!![]});var _0x1df6cd=_0x57b0('0x2f');return db[_0x57b0('0x30')][_0x57b0('0x2c')]({'where':{'type':_0x1df6cd,'resourceId':_0x547ea6['id']}})['then'](function(){return _0x16d6e1;});})['then'](function(){_0x32e03e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2df3b,_0xb44fff){return function(_0x1592ac){if(!_0x1592ac){_0xe2df3b[_0x57b0('0x31')](0x194);}return _0x1592ac;};}function handleError(_0x46513d,_0x4ba453){_0x4ba453=_0x4ba453||0x1f4;return function(_0x85fdfe){logger[_0x57b0('0x1e')](_0x85fdfe[_0x57b0('0x32')]);if(_0x85fdfe[_0x57b0('0x33')]){delete _0x85fdfe['name'];}_0x46513d[_0x57b0('0x23')](_0x4ba453)[_0x57b0('0x34')](_0x85fdfe);};}exports['index']=function(_0xbf8d86,_0x530d66){var _0x4bd714={},_0x5ba34c={},_0x223484={'count':0x0,'rows':[]};var _0x1b1d95=_[_0x57b0('0x35')](db[_0x57b0('0x36')][_0x57b0('0x37')],function(_0x43ca03){return{'name':_0x43ca03[_0x57b0('0x38')],'type':_0x43ca03[_0x57b0('0x39')][_0x57b0('0x3a')]};});_0x5ba34c[_0x57b0('0x3b')]=_[_0x57b0('0x35')](_0x1b1d95,_0x57b0('0x33'));_0x5ba34c['query']=_[_0x57b0('0x3c')](_0xbf8d86[_0x57b0('0x3d')]);_0x5ba34c[_0x57b0('0x3e')]=_['intersection'](_0x5ba34c['model'],_0x5ba34c['query']);_0x4bd714[_0x57b0('0x3f')]=_[_0x57b0('0x40')](_0x5ba34c[_0x57b0('0x3b')],qs[_0x57b0('0x41')](_0xbf8d86['query'][_0x57b0('0x41')]));_0x4bd714[_0x57b0('0x3f')]=_0x4bd714['attributes'][_0x57b0('0x42')]?_0x4bd714[_0x57b0('0x3f')]:_0x5ba34c[_0x57b0('0x3b')];if(!_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x43')]('nolimit')){_0x4bd714[_0x57b0('0x28')]=qs[_0x57b0('0x28')](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x28')]);_0x4bd714['offset']=qs['offset'](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x27')]);}_0x4bd714['order']=qs[_0x57b0('0x44')](_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x44')]);_0x4bd714['where']=qs['filters'](_[_0x57b0('0x45')](_0xbf8d86[_0x57b0('0x3d')],_0x5ba34c[_0x57b0('0x3e')]),_0x1b1d95);if(_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x46')]){_0x4bd714['where']=_[_0x57b0('0x47')](_0x4bd714[_0x57b0('0x48')],{'$or':_[_0x57b0('0x35')](_0x1b1d95,function(_0x308c08){if(_0x308c08[_0x57b0('0x39')]!=='VIRTUAL'){var _0x531ac1={};_0x531ac1[_0x308c08['name']]={'$like':'%'+_0xbf8d86['query'][_0x57b0('0x46')]+'%'};return _0x531ac1;}})});}_0x4bd714=_[_0x57b0('0x47')]({},_0x4bd714,_0xbf8d86[_0x57b0('0x49')]);var _0x2af039={'where':_0x4bd714[_0x57b0('0x48')]};return db[_0x57b0('0x36')][_0x57b0('0x26')](_0x2af039)['then'](function(_0x39a393){_0x223484[_0x57b0('0x26')]=_0x39a393;if(_0xbf8d86[_0x57b0('0x3d')][_0x57b0('0x4a')]){_0x4bd714[_0x57b0('0x4b')]=[{'all':!![]}];}return db[_0x57b0('0x36')][_0x57b0('0x4c')](_0x4bd714);})['then'](function(_0x25e952){_0x223484['rows']=_0x25e952;return _0x223484;})[_0x57b0('0x2d')](respondWithFilteredResult(_0x530d66,_0x4bd714))['catch'](handleError(_0x530d66,null));};exports[_0x57b0('0x4d')]=function(_0x5cae47,_0x40dae2){var _0x464a50={'raw':![],'where':{'id':_0x5cae47[_0x57b0('0x4e')]['id']}},_0x554a36={};_0x554a36[_0x57b0('0x3b')]=_[_0x57b0('0x3c')](db['VoiceContext'][_0x57b0('0x37')]);_0x554a36[_0x57b0('0x3d')]=_['keys'](_0x5cae47[_0x57b0('0x3d')]);_0x554a36[_0x57b0('0x3e')]=_['intersection'](_0x554a36[_0x57b0('0x3b')],_0x554a36[_0x57b0('0x3d')]);_0x464a50[_0x57b0('0x3f')]=_[_0x57b0('0x40')](_0x554a36[_0x57b0('0x3b')],qs['fields'](_0x5cae47['query'][_0x57b0('0x41')]));_0x464a50[_0x57b0('0x3f')]=_0x464a50[_0x57b0('0x3f')]['length']?_0x464a50[_0x57b0('0x3f')]:_0x554a36[_0x57b0('0x3b')];if(_0x5cae47[_0x57b0('0x3d')][_0x57b0('0x4a')]){_0x464a50[_0x57b0('0x4b')]=[{'all':!![]}];}_0x464a50=_[_0x57b0('0x47')]({},_0x464a50,_0x5cae47[_0x57b0('0x49')]);return db[_0x57b0('0x36')][_0x57b0('0x4f')](_0x464a50)[_0x57b0('0x2d')](handleEntityNotFound(_0x40dae2,null))[_0x57b0('0x2d')](respondWithResult(_0x40dae2,null))[_0x57b0('0x22')](handleError(_0x40dae2,null));};exports[_0x57b0('0x50')]=function(_0x3f5b87,_0x89e2e1,_0xfabe8){var _0x31265e;return db[_0x57b0('0x36')]['create'](_0x3f5b87[_0x57b0('0x51')],{'raw':!![]})[_0x57b0('0x2d')](function(_0x439101){_0x31265e=_0x439101;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x57b0('0x2d')](function(_0x5a33a1){var _0x5acb94=fs[_0x57b0('0x52')](path['join'](config[_0x57b0('0x53')],'server/files/templates/context.ejs'),_0x57b0('0x54'));var _0xa97db6=ejs['render'](_0x5acb94,{'contexts':_0x5a33a1||[]});fs['writeFileSync'](_0x57b0('0x55'),_0xa97db6);})[_0x57b0('0x2d')](function(){return respondWithRpcPromise('Reload',_0x57b0('0x50'),{'module':_0x57b0('0x56')});})[_0x57b0('0x2d')](function(){var _0x3f490f=_0x3f5b87['user'][_0x57b0('0x2e')]({'plain':!![]});if(!_0x3f490f)throw new Error(_0x57b0('0x57'));if(_0x3f490f['role']===_0x57b0('0x58')){var _0x1d87b1=_0x31265e[_0x57b0('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x57b0('0x4f')]({'where':{'name':_0x57b0('0x2f'),'userProfileId':_0x3f490f[_0x57b0('0x59')]},'raw':!![]})['then'](function(_0x4b6d6f){if(_0x4b6d6f&&_0x4b6d6f[_0x57b0('0x5a')]===0x0){return db['UserProfileResource'][_0x57b0('0x50')]({'name':_0x1d87b1['name'],'resourceId':_0x1d87b1['id'],'type':_0x4b6d6f[_0x57b0('0x33')],'sectionId':_0x4b6d6f['id']},{})['then'](function(){return _0x31265e;});}else{return _0x31265e;}})['catch'](function(_0x323f57){logger[_0x57b0('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x323f57);throw _0x323f57;});}return _0x31265e;})['then'](respondWithResult(_0x89e2e1,0xc9))['catch'](handleError(_0x89e2e1,null));};exports[_0x57b0('0x2b')]=function(_0x3a01f3,_0x3f3031,_0x2ea329){var _0x5ca216;return db['VoiceContext'][_0x57b0('0x4f')]({'where':{'id':_0x3a01f3[_0x57b0('0x4e')]['id']}})[_0x57b0('0x2d')](handleEntityNotFound(_0x3f3031,null))[_0x57b0('0x2d')](saveUpdates(_0x3a01f3[_0x57b0('0x51')],null))[_0x57b0('0x2d')](function(_0x531bf2){if(_0x531bf2){_0x5ca216=_0x531bf2;return db[_0x57b0('0x36')][_0x57b0('0x4c')]({'raw':!![]});}})[_0x57b0('0x2d')](function(_0x3b2093){var _0x429219=fs['readFileSync'](path[_0x57b0('0x5b')](config[_0x57b0('0x53')],_0x57b0('0x5c')),_0x57b0('0x54'));var _0x2f7835=ejs[_0x57b0('0x5d')](_0x429219,{'contexts':_0x3b2093||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2f7835);})['then'](function(){return respondWithRpcPromise(_0x57b0('0x5e'),_0x57b0('0x2b'),{'module':'chan_sip.so'});})[_0x57b0('0x2d')](function(){return _0x5ca216;})[_0x57b0('0x2d')](respondWithResult(_0x3f3031,null))[_0x57b0('0x22')](handleError(_0x3f3031,null));};exports[_0x57b0('0x2c')]=function(_0x49f132,_0x4e04dd,_0x4ea35d){var _0x46d600;return db[_0x57b0('0x36')][_0x57b0('0x4f')]({'where':{'id':_0x49f132['params']['id']}})[_0x57b0('0x2d')](handleEntityNotFound(_0x4e04dd,null))['then'](removeEntity(_0x4e04dd,null))['then'](function(){return db['VoiceContext'][_0x57b0('0x4c')]({'raw':!![]});})['then'](function(_0x3363ed){var _0x9b131f=fs[_0x57b0('0x52')](path[_0x57b0('0x5b')](config[_0x57b0('0x53')],_0x57b0('0x5c')),_0x57b0('0x54'));var _0x417f42=ejs[_0x57b0('0x5d')](_0x9b131f,{'contexts':_0x3363ed});fs['writeFileSync'](_0x57b0('0x55'),_0x417f42);return respondWithRpcPromise(_0x57b0('0x5e'),_0x57b0('0x2c'),{'module':'chan_sip.so'});})[_0x57b0('0x22')](handleError(_0x4e04dd,null));}; \ No newline at end of file +var _0x3fec=['root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','params','html-pdf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','length','find','create','body','readFileSync'];(function(_0x1bd41f,_0x1044e2){var _0x456a47=function(_0x68f5ff){while(--_0x68f5ff){_0x1bd41f['push'](_0x1bd41f['shift']());}};_0x456a47(++_0x1044e2);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fe('0x1'));var jsonpatch=require(_0xc3fe('0x2'));var rp=require('request-promise');var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3fe('0x4'));var path=require('path');var sox=require(_0xc3fe('0x5'));var csv=require(_0xc3fe('0x6'));var ejs=require(_0xc3fe('0x7'));var fs=require('fs');var _=require(_0xc3fe('0x8'));var squel=require(_0xc3fe('0x9'));var crypto=require(_0xc3fe('0xa'));var jsforce=require(_0xc3fe('0xb'));var deskjs=require(_0xc3fe('0xc'));var toCsv=require(_0xc3fe('0x6'));var querystring=require(_0xc3fe('0xd'));var Papa=require(_0xc3fe('0xe'));var Redis=require(_0xc3fe('0xf'));var authService=require(_0xc3fe('0x10'));var qs=require(_0xc3fe('0x11'));var as=require(_0xc3fe('0x12'));var hardwareService=require(_0xc3fe('0x13'));var logger=require('../../config/logger')(_0xc3fe('0x14'));var utils=require(_0xc3fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3fe('0x16'));var db=require(_0xc3fe('0x17'))['db'];var jayson=require(_0xc3fe('0x18'));var client=jayson[_0xc3fe('0x19')][_0xc3fe('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b560f,_0x1ac4d7,_0x7d5e67,_0xb6a471){return new BPromise(function(_0x432539,_0x4b8088){var _0x400476=_0xb6a471||client;return _0x400476['request'](_0x1b560f,_0x7d5e67)[_0xc3fe('0x1b')](function(_0x18e5ed){logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));logger[_0xc3fe('0x1f')](_0xc3fe('0x20'),_0x1ac4d7,_0xc3fe('0x1e'),JSON[_0xc3fe('0x21')](_0x18e5ed));if(_0x18e5ed[_0xc3fe('0x22')]){if(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x23')]===0x1f4){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')]['message']);return _0x4b8088(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);}logger[_0xc3fe('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);return _0x432539(_0x18e5ed['error']['message']);}else{logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));_0x432539(_0x18e5ed['result'][_0xc3fe('0x24')]);}})[_0xc3fe('0x25')](function(_0x3f9418){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x3f9418);_0x4b8088(_0x3f9418);});});}function respondWithStatusCode(_0x474195,_0x1dcfec){_0x1dcfec=_0x1dcfec||0xcc;return function(_0x6b57a6){if(_0x6b57a6){return _0x474195[_0xc3fe('0x26')](_0x1dcfec);}return _0x474195[_0xc3fe('0x27')](_0x1dcfec)[_0xc3fe('0x28')]();};}function respondWithResult(_0x2999e7,_0x4da635){_0x4da635=_0x4da635||0xc8;return function(_0x3220e7){if(_0x3220e7){return _0x2999e7[_0xc3fe('0x27')](_0x4da635)[_0xc3fe('0x29')](_0x3220e7);}};}function respondWithFilteredResult(_0x3e8075,_0x416149){return function(_0x5672b9){if(_0x5672b9){var _0xcadfae=_0x5672b9[_0xc3fe('0x2a')],_0x431594=_0x416149[_0xc3fe('0x2b')],_0x2bfaa0=_0x416149[_0xc3fe('0x2b')]+_0x416149[_0xc3fe('0x2c')],_0x1593b0;if(_0x2bfaa0>=_0xcadfae){_0x2bfaa0=_0xcadfae;_0x1593b0=0xc8;}else{_0x1593b0=0xce;}_0x3e8075[_0xc3fe('0x27')](_0x1593b0);return _0x3e8075[_0xc3fe('0x2d')](_0xc3fe('0x2e'),_0x431594+'-'+_0x2bfaa0+'/'+_0xcadfae)[_0xc3fe('0x29')](_0x5672b9);}return null;};}function patchUpdates(_0x18dbc0){return function(_0x499b99){try{jsonpatch[_0xc3fe('0x2f')](_0x499b99,_0x18dbc0,!![]);}catch(_0x1339e7){return BPromise[_0xc3fe('0x30')](_0x1339e7);}return _0x499b99[_0xc3fe('0x31')]();};}function saveUpdates(_0x5ac845,_0x1e8a38){return function(_0x19d353){if(_0x19d353){return _0x19d353[_0xc3fe('0x32')](_0x5ac845)[_0xc3fe('0x1b')](function(_0x11a44e){return _0x11a44e;});}return null;};}function removeEntity(_0x293999,_0x3f4573){return function(_0x28fc3b){if(_0x28fc3b){return _0x28fc3b[_0xc3fe('0x33')]()[_0xc3fe('0x1b')](function(){var _0x7b42b9=_0x28fc3b['get']({'plain':!![]});var _0x5b6151='Contexts';return db[_0xc3fe('0x34')][_0xc3fe('0x33')]({'where':{'type':_0x5b6151,'resourceId':_0x7b42b9['id']}})['then'](function(){return _0x28fc3b;});})[_0xc3fe('0x1b')](function(){_0x293999[_0xc3fe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b76ae,_0x38c948){return function(_0x237680){if(!_0x237680){_0x5b76ae[_0xc3fe('0x26')](0x194);}return _0x237680;};}function handleError(_0x2aa7b8,_0x5716b0){_0x5716b0=_0x5716b0||0x1f4;return function(_0x53dca7){logger[_0xc3fe('0x22')](_0x53dca7[_0xc3fe('0x35')]);if(_0x53dca7[_0xc3fe('0x36')]){delete _0x53dca7[_0xc3fe('0x36')];}_0x2aa7b8['status'](_0x5716b0)[_0xc3fe('0x37')](_0x53dca7);};}exports['index']=function(_0x1b0090,_0x4e694d){var _0x7fc7fb={},_0x201d72={},_0x51776c={'count':0x0,'rows':[]};var _0x40fdfc=_[_0xc3fe('0x38')](db['VoiceContext'][_0xc3fe('0x39')],function(_0x5bdc6d){return{'name':_0x5bdc6d[_0xc3fe('0x3a')],'type':_0x5bdc6d[_0xc3fe('0x3b')][_0xc3fe('0x3c')]};});_0x201d72[_0xc3fe('0x3d')]=_[_0xc3fe('0x38')](_0x40fdfc,'name');_0x201d72[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x1b0090[_0xc3fe('0x3e')]);_0x201d72[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],_0x201d72[_0xc3fe('0x3e')]);_0x7fc7fb['attributes']=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],qs[_0xc3fe('0x42')](_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x42')]));_0x7fc7fb[_0xc3fe('0x43')]=_0x7fc7fb[_0xc3fe('0x43')]['length']?_0x7fc7fb['attributes']:_0x201d72[_0xc3fe('0x3d')];if(!_0x1b0090['query']['hasOwnProperty'](_0xc3fe('0x44'))){_0x7fc7fb[_0xc3fe('0x2c')]=qs[_0xc3fe('0x2c')](_0x1b0090[_0xc3fe('0x3e')]['limit']);_0x7fc7fb[_0xc3fe('0x2b')]=qs[_0xc3fe('0x2b')](_0x1b0090[_0xc3fe('0x3e')]['offset']);}_0x7fc7fb[_0xc3fe('0x45')]=qs[_0xc3fe('0x46')](_0x1b0090[_0xc3fe('0x3e')]['sort']);_0x7fc7fb['where']=qs['filters'](_[_0xc3fe('0x47')](_0x1b0090[_0xc3fe('0x3e')],_0x201d72[_0xc3fe('0x40')]),_0x40fdfc);if(_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x48')]){_0x7fc7fb[_0xc3fe('0x49')]=_[_0xc3fe('0x4a')](_0x7fc7fb['where'],{'$or':_[_0xc3fe('0x38')](_0x40fdfc,function(_0x3b9569){if(_0x3b9569[_0xc3fe('0x3b')]!==_0xc3fe('0x4b')){var _0x367140={};_0x367140[_0x3b9569[_0xc3fe('0x36')]]={'$like':'%'+_0x1b0090['query'][_0xc3fe('0x48')]+'%'};return _0x367140;}})});}_0x7fc7fb=_[_0xc3fe('0x4a')]({},_0x7fc7fb,_0x1b0090[_0xc3fe('0x4c')]);var _0x3ab38c={'where':_0x7fc7fb[_0xc3fe('0x49')]};return db[_0xc3fe('0x4d')][_0xc3fe('0x2a')](_0x3ab38c)[_0xc3fe('0x1b')](function(_0x4328b0){_0x51776c[_0xc3fe('0x2a')]=_0x4328b0;if(_0x1b0090['query'][_0xc3fe('0x4e')]){_0x7fc7fb[_0xc3fe('0x4f')]=[{'all':!![]}];}return db[_0xc3fe('0x4d')][_0xc3fe('0x50')](_0x7fc7fb);})[_0xc3fe('0x1b')](function(_0xb8edd7){_0x51776c[_0xc3fe('0x51')]=_0xb8edd7;return _0x51776c;})[_0xc3fe('0x1b')](respondWithFilteredResult(_0x4e694d,_0x7fc7fb))[_0xc3fe('0x25')](handleError(_0x4e694d,null));};exports[_0xc3fe('0x52')]=function(_0x24c37c,_0x378c16){var _0xccbee9={'raw':![],'where':{'id':_0x24c37c['params']['id']}},_0x91221e={};_0x91221e[_0xc3fe('0x3d')]=_[_0xc3fe('0x3f')](db[_0xc3fe('0x4d')]['rawAttributes']);_0x91221e[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x24c37c[_0xc3fe('0x3e')]);_0x91221e[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x91221e['model'],_0x91221e['query']);_0xccbee9[_0xc3fe('0x43')]=_[_0xc3fe('0x41')](_0x91221e['model'],qs[_0xc3fe('0x42')](_0x24c37c[_0xc3fe('0x3e')]['fields']));_0xccbee9[_0xc3fe('0x43')]=_0xccbee9[_0xc3fe('0x43')][_0xc3fe('0x53')]?_0xccbee9[_0xc3fe('0x43')]:_0x91221e['model'];if(_0x24c37c['query'][_0xc3fe('0x4e')]){_0xccbee9[_0xc3fe('0x4f')]=[{'all':!![]}];}_0xccbee9=_[_0xc3fe('0x4a')]({},_0xccbee9,_0x24c37c['options']);return db[_0xc3fe('0x4d')][_0xc3fe('0x54')](_0xccbee9)[_0xc3fe('0x1b')](handleEntityNotFound(_0x378c16,null))['then'](respondWithResult(_0x378c16,null))[_0xc3fe('0x25')](handleError(_0x378c16,null));};exports[_0xc3fe('0x55')]=function(_0x5caf49,_0x228482,_0x39beab){var _0x89a042;return db[_0xc3fe('0x4d')][_0xc3fe('0x55')](_0x5caf49[_0xc3fe('0x56')],{'raw':!![]})[_0xc3fe('0x1b')](function(_0x2f3568){_0x89a042=_0x2f3568;return db[_0xc3fe('0x4d')]['findAll']({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x5d1b6d){var _0x3d6045=fs[_0xc3fe('0x57')](path['join'](config[_0xc3fe('0x58')],_0xc3fe('0x59')),_0xc3fe('0x5a'));var _0x527027=ejs[_0xc3fe('0x5b')](_0x3d6045,{'contexts':_0x5d1b6d||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x527027);})['then'](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x55'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){var _0x17fc18=_0x5caf49[_0xc3fe('0x60')][_0xc3fe('0x61')]({'plain':!![]});if(!_0x17fc18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17fc18[_0xc3fe('0x62')]===_0xc3fe('0x60')){var _0x1ab9c8=_0x89a042[_0xc3fe('0x61')]({'plain':!![]});return db[_0xc3fe('0x63')][_0xc3fe('0x54')]({'where':{'name':_0xc3fe('0x64'),'userProfileId':_0x17fc18[_0xc3fe('0x65')]},'raw':!![]})[_0xc3fe('0x1b')](function(_0x3a64c6){if(_0x3a64c6&&_0x3a64c6[_0xc3fe('0x66')]===0x0){return db['UserProfileResource'][_0xc3fe('0x55')]({'name':_0x1ab9c8[_0xc3fe('0x36')],'resourceId':_0x1ab9c8['id'],'type':_0x3a64c6['name'],'sectionId':_0x3a64c6['id']},{})[_0xc3fe('0x1b')](function(){return _0x89a042;});}else{return _0x89a042;}})['catch'](function(_0xf42f67){logger[_0xc3fe('0x22')](_0xc3fe('0x67'),_0xf42f67);throw _0xf42f67;});}return _0x89a042;})[_0xc3fe('0x1b')](respondWithResult(_0x228482,0xc9))[_0xc3fe('0x25')](handleError(_0x228482,null));};exports['update']=function(_0x304dcc,_0x519596,_0x12a9ce){var _0x5e6d75;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x304dcc['params']['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x519596,null))[_0xc3fe('0x1b')](saveUpdates(_0x304dcc[_0xc3fe('0x56')],null))[_0xc3fe('0x1b')](function(_0x3b2d01){if(_0x3b2d01){_0x5e6d75=_0x3b2d01;return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});}})[_0xc3fe('0x1b')](function(_0x5beeec){var _0x77b85b=fs[_0xc3fe('0x57')](path[_0xc3fe('0x68')](config[_0xc3fe('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x85224c=ejs[_0xc3fe('0x5b')](_0x77b85b,{'contexts':_0x5beeec||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x85224c);})[_0xc3fe('0x1b')](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x32'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){return _0x5e6d75;})['then'](respondWithResult(_0x519596,null))[_0xc3fe('0x25')](handleError(_0x519596,null));};exports[_0xc3fe('0x33')]=function(_0x1d943d,_0x4fcd43,_0xae8545){var _0x1935f3;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x1d943d[_0xc3fe('0x69')]['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x4fcd43,null))[_0xc3fe('0x1b')](removeEntity(_0x4fcd43,null))[_0xc3fe('0x1b')](function(){return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x432e09){var _0x3844e4=fs[_0xc3fe('0x57')](path['join'](config['root'],_0xc3fe('0x59')),'utf8');var _0x402b0b=ejs[_0xc3fe('0x5b')](_0x3844e4,{'contexts':_0x432e09});fs['writeFileSync'](_0xc3fe('0x5d'),_0x402b0b);return respondWithRpcPromise('Reload',_0xc3fe('0x33'),{'module':'chan_sip.so'});})[_0xc3fe('0x25')](handleError(_0x4fcd43,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2cb075a..26a4127 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 _0x6047=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x29cb61,_0x494484){var _0x21d3e0=function(_0x3e0ac4){while(--_0x3e0ac4){_0x29cb61['push'](_0x29cb61['shift']());}};_0x21d3e0(++_0x494484);}(_0x6047,0xd5));var _0x7604=function(_0x10fd3d,_0x1b2e1f){_0x10fd3d=_0x10fd3d-0x0;var _0x37b66f=_0x6047[_0x10fd3d];return _0x37b66f;};'use strict';var _=require('lodash');var util=require(_0x7604('0x0'));var logger=require(_0x7604('0x1'))(_0x7604('0x2'));var moment=require(_0x7604('0x3'));var BPromise=require(_0x7604('0x4'));var rp=require(_0x7604('0x5'));var fs=require('fs');var path=require(_0x7604('0x6'));var rimraf=require('rimraf');var config=require(_0x7604('0x7'));var attributes=require(_0x7604('0x8'));module[_0x7604('0x9')]=function(_0xcf6f3a,_0x512aef){return _0xcf6f3a[_0x7604('0xa')](_0x7604('0xb'),attributes,{'tableName':_0x7604('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfef6=['exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x4227e5,_0x751f2c){var _0x2e52e7=function(_0x87a699){while(--_0x87a699){_0x4227e5['push'](_0x4227e5['shift']());}};_0x2e52e7(++_0x751f2c);}(_0xfef6,0x197));var _0x6fef=function(_0x505735,_0x7417cc){_0x505735=_0x505735-0x0;var _0x20dd8b=_0xfef6[_0x505735];return _0x20dd8b;};'use strict';var _=require(_0x6fef('0x0'));var util=require('util');var logger=require(_0x6fef('0x1'))(_0x6fef('0x2'));var moment=require(_0x6fef('0x3'));var BPromise=require(_0x6fef('0x4'));var rp=require(_0x6fef('0x5'));var fs=require('fs');var path=require(_0x6fef('0x6'));var rimraf=require('rimraf');var config=require(_0x6fef('0x7'));var attributes=require(_0x6fef('0x8'));module[_0x6fef('0x9')]=function(_0x3102b6,_0x28790a){return _0x3102b6[_0x6fef('0xa')](_0x6fef('0xb'),attributes,{'tableName':_0x6fef('0xc'),'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 af0447c..680999d 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 _0xbbb7=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbbb7,0x17d));var _0x7bbb=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0xbbb7[_0x4b0830];return _0x1f53a7;};'use strict';var _=require(_0x7bbb('0x0'));var util=require(_0x7bbb('0x1'));var moment=require(_0x7bbb('0x2'));var BPromise=require(_0x7bbb('0x3'));var rs=require(_0x7bbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bbb('0x5'))['db'];var utils=require(_0x7bbb('0x6'));var logger=require('../../config/logger')(_0x7bbb('0x7'));var config=require('../../config/environment');var jayson=require(_0x7bbb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x435c4f,_0x3ffe91,_0x39103e){return new BPromise(function(_0x3e25aa,_0x910152){return client[_0x7bbb('0x9')](_0x435c4f,_0x39103e)[_0x7bbb('0xa')](function(_0x12a446){logger['info'](_0x7bbb('0xb'),_0x3ffe91,_0x7bbb('0xc'));logger[_0x7bbb('0xd')](_0x7bbb('0xe'),_0x3ffe91,_0x7bbb('0xc'),JSON['stringify'](_0x12a446));if(_0x12a446['error']){if(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x10')]===0x1f4){logger[_0x7bbb('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3ffe91,_0x12a446['error'][_0x7bbb('0x11')]);return _0x910152(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);}logger[_0x7bbb('0xf')](_0x7bbb('0xb'),_0x3ffe91,_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);return _0x3e25aa(_0x12a446[_0x7bbb('0xf')][_0x7bbb('0x11')]);}else{logger[_0x7bbb('0x12')](_0x7bbb('0xb'),_0x3ffe91,_0x7bbb('0xc'));_0x3e25aa(_0x12a446[_0x7bbb('0x13')][_0x7bbb('0x11')]);}})[_0x7bbb('0x14')](function(_0x411cdd){logger[_0x7bbb('0xf')](_0x7bbb('0xb'),_0x3ffe91,_0x411cdd);_0x910152(_0x411cdd);});});} \ No newline at end of file +var _0xd9a2=['jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x40e419,_0xab5803){var _0x56801b=function(_0x5e2223){while(--_0x5e2223){_0x40e419['push'](_0x40e419['shift']());}};_0x56801b(++_0xab5803);}(_0xd9a2,0x16e));var _0x2d9a=function(_0x2c739c,_0x14b7a8){_0x2c739c=_0x2c739c-0x0;var _0x2b36f4=_0xd9a2[_0x2c739c];return _0x2b36f4;};'use strict';var _=require('lodash');var util=require(_0x2d9a('0x0'));var moment=require(_0x2d9a('0x1'));var BPromise=require(_0x2d9a('0x2'));var rs=require(_0x2d9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d9a('0x4'))['db'];var utils=require(_0x2d9a('0x5'));var logger=require('../../config/logger')(_0x2d9a('0x6'));var config=require(_0x2d9a('0x7'));var jayson=require(_0x2d9a('0x8'));var client=jayson[_0x2d9a('0x9')][_0x2d9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52b024,_0x368bbe,_0x390d2c){return new BPromise(function(_0x1aedea,_0x29ad79){return client['request'](_0x52b024,_0x390d2c)[_0x2d9a('0xb')](function(_0x4dd456){logger[_0x2d9a('0xc')](_0x2d9a('0xd'),_0x368bbe,'request\x20sent');logger[_0x2d9a('0xe')](_0x2d9a('0xf'),_0x368bbe,'request\x20sent',JSON['stringify'](_0x4dd456));if(_0x4dd456['error']){if(_0x4dd456['error'][_0x2d9a('0x10')]===0x1f4){logger[_0x2d9a('0x11')](_0x2d9a('0xd'),_0x368bbe,_0x4dd456['error'][_0x2d9a('0x12')]);return _0x29ad79(_0x4dd456[_0x2d9a('0x11')][_0x2d9a('0x12')]);}logger[_0x2d9a('0x11')](_0x2d9a('0xd'),_0x368bbe,_0x4dd456['error'][_0x2d9a('0x12')]);return _0x1aedea(_0x4dd456[_0x2d9a('0x11')][_0x2d9a('0x12')]);}else{logger['info'](_0x2d9a('0xd'),_0x368bbe,_0x2d9a('0x13'));_0x1aedea(_0x4dd456[_0x2d9a('0x14')][_0x2d9a('0x12')]);}})[_0x2d9a('0x15')](function(_0x5099d3){logger[_0x2d9a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x368bbe,_0x5099d3);_0x29ad79(_0x5099d3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8b8f141..097c47c 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 _0xe9bd=['isAuthenticated','index','describe','show','post','create','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get'];(function(_0x3df7c6,_0x5ade8c){var _0x21e2f7=function(_0x2f8808){while(--_0x2f8808){_0x3df7c6['push'](_0x3df7c6['shift']());}};_0x21e2f7(++_0x5ade8c);}(_0xe9bd,0x6a));var _0xde9b=function(_0xcc51d,_0x10c495){_0xcc51d=_0xcc51d-0x0;var _0x17d867=_0xe9bd[_0xcc51d];return _0x17d867;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde9b('0x0'));var timeout=require(_0xde9b('0x1'));var express=require(_0xde9b('0x2'));var router=express[_0xde9b('0x3')]();var auth=require(_0xde9b('0x4'));var interaction=require(_0xde9b('0x5'));var config=require('../../config/environment');var controller=require(_0xde9b('0x6'));router[_0xde9b('0x7')]('/',auth[_0xde9b('0x8')](),controller[_0xde9b('0x9')]);router[_0xde9b('0x7')]('/describe',auth[_0xde9b('0x8')](),controller[_0xde9b('0xa')]);router[_0xde9b('0x7')]('/:id',auth[_0xde9b('0x8')](),controller[_0xde9b('0xb')]);router[_0xde9b('0xc')]('/',auth['isAuthenticated'](),controller[_0xde9b('0xd')]);router['put']('/:id',auth[_0xde9b('0x8')](),controller[_0xde9b('0xe')]);router[_0xde9b('0xf')](_0xde9b('0x10'),auth[_0xde9b('0x8')](),controller[_0xde9b('0x11')]);module[_0xde9b('0x12')]=router; \ No newline at end of file +var _0xac20=['index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','get','isAuthenticated'];(function(_0x251489,_0x24d3cf){var _0x1b2364=function(_0x3443d6){while(--_0x3443d6){_0x251489['push'](_0x251489['shift']());}};_0x1b2364(++_0x24d3cf);}(_0xac20,0x12b));var _0x0ac2=function(_0x21d020,_0x38c02e){_0x21d020=_0x21d020-0x0;var _0x400e04=_0xac20[_0x21d020];return _0x400e04;};'use strict';var multer=require(_0x0ac2('0x0'));var util=require(_0x0ac2('0x1'));var path=require('path');var timeout=require(_0x0ac2('0x2'));var express=require(_0x0ac2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0ac2('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x0ac2('0x5')]('/',auth[_0x0ac2('0x6')](),controller[_0x0ac2('0x7')]);router[_0x0ac2('0x5')](_0x0ac2('0x8'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0x9')]);router[_0x0ac2('0x5')](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xb')]);router[_0x0ac2('0xc')]('/',auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xd')]);router['put'](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xe')]);router['delete'](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xf')]);module[_0x0ac2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index aef1579..50e15e0 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 _0xce13=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x584d0,_0x43c8fa){var _0xecb06d=function(_0x56a521){while(--_0x56a521){_0x584d0['push'](_0x584d0['shift']());}};_0xecb06d(++_0x43c8fa);}(_0xce13,0x74));var _0x3ce1=function(_0x1fda85,_0x52593f){_0x1fda85=_0x1fda85-0x0;var _0x5f41ae=_0xce13[_0x1fda85];return _0x5f41ae;};'use strict';var Sequelize=require(_0x3ce1('0x0'));module[_0x3ce1('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3ce1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3ce1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3ce1('0x2')]},'connectedlinename':{'type':Sequelize[_0x3ce1('0x2')]},'language':{'type':Sequelize[_0x3ce1('0x2')]},'accountcode':{'type':Sequelize[_0x3ce1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3ce1('0x2')]},'priority':{'type':Sequelize[_0x3ce1('0x3')]},'uniqueid':{'type':Sequelize[_0x3ce1('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3ce1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3ce1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3ce1('0x2')]},'destcalleridname':{'type':Sequelize[_0x3ce1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3ce1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3ce1('0x2')]},'destlanguage':{'type':Sequelize[_0x3ce1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3ce1('0x2')]},'destexten':{'type':Sequelize[_0x3ce1('0x2')]},'destpriority':{'type':Sequelize[_0x3ce1('0x3')]},'destuniqueid':{'type':Sequelize[_0x3ce1('0x2')]},'destlinkedid':{'type':Sequelize[_0x3ce1('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x3ce1('0x2')]},'starttime':{'type':Sequelize[_0x3ce1('0x4')]},'answertime':{'type':Sequelize[_0x3ce1('0x4')]},'endtime':{'type':Sequelize[_0x3ce1('0x4')]},'lastevent':{'type':Sequelize[_0x3ce1('0x2')],'comment':_0x3ce1('0x5')},'routeId':{'type':Sequelize[_0x3ce1('0x3')]},'duration':{'type':Sequelize[_0x3ce1('0x3')]},'holdtime':{'type':Sequelize[_0x3ce1('0x3')]},'billableseconds':{'type':Sequelize[_0x3ce1('0x3')]}}; \ No newline at end of file +var _0x62f0=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x62f0,0x193));var _0x062f=function(_0x24cf7f,_0xcda231){_0x24cf7f=_0x24cf7f-0x0;var _0x4c6742=_0x62f0[_0x24cf7f];return _0x4c6742;};'use strict';var Sequelize=require(_0x062f('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x062f('0x1')]},'channel':{'type':Sequelize[_0x062f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x062f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x062f('0x1')]},'connectedlinename':{'type':Sequelize[_0x062f('0x1')]},'language':{'type':Sequelize[_0x062f('0x1')]},'accountcode':{'type':Sequelize[_0x062f('0x1')]},'context':{'type':Sequelize[_0x062f('0x1')]},'exten':{'type':Sequelize[_0x062f('0x1')]},'priority':{'type':Sequelize[_0x062f('0x2')]},'uniqueid':{'type':Sequelize[_0x062f('0x1')]},'linkedid':{'type':Sequelize[_0x062f('0x1')]},'destchannel':{'type':Sequelize[_0x062f('0x1')]},'destchannelstate':{'type':Sequelize[_0x062f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x062f('0x1')]},'destaccountcode':{'type':Sequelize[_0x062f('0x1')]},'destcontext':{'type':Sequelize[_0x062f('0x1')]},'destexten':{'type':Sequelize[_0x062f('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x062f('0x1')]},'dialstatus':{'type':Sequelize[_0x062f('0x1')]},'starttime':{'type':Sequelize[_0x062f('0x3')]},'answertime':{'type':Sequelize[_0x062f('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x062f('0x1')],'comment':_0x062f('0x4')},'routeId':{'type':Sequelize[_0x062f('0x2')]},'duration':{'type':Sequelize[_0x062f('0x2')]},'holdtime':{'type':Sequelize[_0x062f('0x2')]},'billableseconds':{'type':Sequelize[_0x062f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 391fa7e..51412b3 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 _0xf7f8=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','stack','name','send','index','map','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','VIRTUAL','merge','options','VoiceDialReport','then','includeAll','findAll','catch','show','rawAttributes','keys','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xf7f8,0x1e2));var _0x8f7f=function(_0x593306,_0x42977d){_0x593306=_0x593306-0x0;var _0x98423=_0xf7f8[_0x593306];return _0x98423;};'use strict';var pdf=require(_0x8f7f('0x0'));var emlformat=require(_0x8f7f('0x1'));var rimraf=require(_0x8f7f('0x2'));var zipdir=require(_0x8f7f('0x3'));var jsonpatch=require(_0x8f7f('0x4'));var rp=require('request-promise');var moment=require(_0x8f7f('0x5'));var BPromise=require(_0x8f7f('0x6'));var Mustache=require(_0x8f7f('0x7'));var util=require('util');var path=require(_0x8f7f('0x8'));var sox=require(_0x8f7f('0x9'));var csv=require('to-csv');var ejs=require(_0x8f7f('0xa'));var fs=require('fs');var _=require(_0x8f7f('0xb'));var squel=require(_0x8f7f('0xc'));var crypto=require(_0x8f7f('0xd'));var jsforce=require(_0x8f7f('0xe'));var deskjs=require(_0x8f7f('0xf'));var toCsv=require(_0x8f7f('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f7f('0x11'));var authService=require(_0x8f7f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8f7f('0x13'));var hardwareService=require(_0x8f7f('0x14'));var logger=require(_0x8f7f('0x15'))(_0x8f7f('0x16'));var utils=require(_0x8f7f('0x17'));var config=require(_0x8f7f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f7f('0x19'))['db'];function respondWithStatusCode(_0x43e5b7,_0x1e2dfb){_0x1e2dfb=_0x1e2dfb||0xcc;return function(_0x51b7a9){if(_0x51b7a9){return _0x43e5b7[_0x8f7f('0x1a')](_0x1e2dfb);}return _0x43e5b7['status'](_0x1e2dfb)['end']();};}function respondWithResult(_0x1fb4dc,_0x1c832c){_0x1c832c=_0x1c832c||0xc8;return function(_0x223afb){if(_0x223afb){return _0x1fb4dc[_0x8f7f('0x1b')](_0x1c832c)[_0x8f7f('0x1c')](_0x223afb);}};}function respondWithFilteredResult(_0x48b136,_0x7b77b3){return function(_0x255607){if(_0x255607){var _0x214703=_0x255607[_0x8f7f('0x1d')],_0x2b48fd=_0x7b77b3[_0x8f7f('0x1e')],_0x426d9c=_0x7b77b3[_0x8f7f('0x1e')]+_0x7b77b3[_0x8f7f('0x1f')],_0x396269;if(_0x426d9c>=_0x214703){_0x426d9c=_0x214703;_0x396269=0xc8;}else{_0x396269=0xce;}_0x48b136['status'](_0x396269);return _0x48b136[_0x8f7f('0x20')](_0x8f7f('0x21'),_0x2b48fd+'-'+_0x426d9c+'/'+_0x214703)['json'](_0x255607);}return null;};}function patchUpdates(_0x5cbdd8){return function(_0x45b8d4){try{jsonpatch['apply'](_0x45b8d4,_0x5cbdd8,!![]);}catch(_0x21c7a4){return BPromise[_0x8f7f('0x22')](_0x21c7a4);}return _0x45b8d4['save']();};}function saveUpdates(_0x4895b1,_0x4d34ec){return function(_0x484864){if(_0x484864){return _0x484864[_0x8f7f('0x23')](_0x4895b1)['then'](function(_0x47ef02){return _0x47ef02;});}return null;};}function removeEntity(_0x1392c3,_0x34f1cf){return function(_0xd96716){if(_0xd96716){return _0xd96716['destroy']()['then'](function(){_0x1392c3[_0x8f7f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cbc4b,_0x2f4434){return function(_0x14e701){if(!_0x14e701){_0x1cbc4b[_0x8f7f('0x1a')](0x194);}return _0x14e701;};}function handleError(_0x1df42d,_0x598a57){_0x598a57=_0x598a57||0x1f4;return function(_0x3311ad){logger['error'](_0x3311ad[_0x8f7f('0x24')]);if(_0x3311ad[_0x8f7f('0x25')]){delete _0x3311ad[_0x8f7f('0x25')];}_0x1df42d[_0x8f7f('0x1b')](_0x598a57)[_0x8f7f('0x26')](_0x3311ad);};}exports[_0x8f7f('0x27')]=function(_0x41b1d9,_0x245a84){var _0xd836ab={},_0x57e95e={},_0x384d52={'count':0x0,'rows':[]};var _0x9d5b67=_[_0x8f7f('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0xea352b){return{'name':_0xea352b['fieldName'],'type':_0xea352b[_0x8f7f('0x29')][_0x8f7f('0x2a')]};});_0x57e95e['model']=_[_0x8f7f('0x28')](_0x9d5b67,_0x8f7f('0x25'));_0x57e95e[_0x8f7f('0x2b')]=_['keys'](_0x41b1d9[_0x8f7f('0x2b')]);_0x57e95e[_0x8f7f('0x2c')]=_[_0x8f7f('0x2d')](_0x57e95e[_0x8f7f('0x2e')],_0x57e95e[_0x8f7f('0x2b')]);_0xd836ab['attributes']=_[_0x8f7f('0x2d')](_0x57e95e['model'],qs[_0x8f7f('0x2f')](_0x41b1d9[_0x8f7f('0x2b')]['fields']));_0xd836ab[_0x8f7f('0x30')]=_0xd836ab[_0x8f7f('0x30')][_0x8f7f('0x31')]?_0xd836ab['attributes']:_0x57e95e[_0x8f7f('0x2e')];if(!_0x41b1d9['query']['hasOwnProperty']('nolimit')){_0xd836ab['limit']=qs[_0x8f7f('0x1f')](_0x41b1d9['query'][_0x8f7f('0x1f')]);_0xd836ab['offset']=qs[_0x8f7f('0x1e')](_0x41b1d9['query'][_0x8f7f('0x1e')]);}_0xd836ab[_0x8f7f('0x32')]=qs[_0x8f7f('0x33')](_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x33')]);_0xd836ab[_0x8f7f('0x34')]=qs[_0x8f7f('0x2c')](_['pick'](_0x41b1d9[_0x8f7f('0x2b')],_0x57e95e[_0x8f7f('0x2c')]),_0x9d5b67);if(_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x35')]){_0xd836ab['where']=_['merge'](_0xd836ab[_0x8f7f('0x34')],{'$or':_['map'](_0x9d5b67,function(_0x489032){if(_0x489032[_0x8f7f('0x29')]!==_0x8f7f('0x36')){var _0x178927={};_0x178927[_0x489032[_0x8f7f('0x25')]]={'$like':'%'+_0x41b1d9[_0x8f7f('0x2b')]['filter']+'%'};return _0x178927;}})});}_0xd836ab=_[_0x8f7f('0x37')]({},_0xd836ab,_0x41b1d9[_0x8f7f('0x38')]);var _0x588fd6={'where':_0xd836ab['where']};return db[_0x8f7f('0x39')][_0x8f7f('0x1d')](_0x588fd6)[_0x8f7f('0x3a')](function(_0x4d29f2){_0x384d52[_0x8f7f('0x1d')]=_0x4d29f2;if(_0x41b1d9[_0x8f7f('0x2b')][_0x8f7f('0x3b')]){_0xd836ab['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x8f7f('0x3c')](_0xd836ab);})['then'](function(_0x39c537){_0x384d52['rows']=_0x39c537;return _0x384d52;})[_0x8f7f('0x3a')](respondWithFilteredResult(_0x245a84,_0xd836ab))[_0x8f7f('0x3d')](handleError(_0x245a84,null));};exports[_0x8f7f('0x3e')]=function(_0x509b10,_0x5babe7){var _0x5ac38f={'raw':!![],'where':{'id':_0x509b10['params']['id']}},_0x114375={};_0x114375[_0x8f7f('0x2e')]=_['keys'](db[_0x8f7f('0x39')][_0x8f7f('0x3f')]);_0x114375['query']=_[_0x8f7f('0x40')](_0x509b10['query']);_0x114375[_0x8f7f('0x2c')]=_['intersection'](_0x114375[_0x8f7f('0x2e')],_0x114375[_0x8f7f('0x2b')]);_0x5ac38f[_0x8f7f('0x30')]=_[_0x8f7f('0x2d')](_0x114375[_0x8f7f('0x2e')],qs[_0x8f7f('0x2f')](_0x509b10[_0x8f7f('0x2b')][_0x8f7f('0x2f')]));_0x5ac38f[_0x8f7f('0x30')]=_0x5ac38f[_0x8f7f('0x30')][_0x8f7f('0x31')]?_0x5ac38f[_0x8f7f('0x30')]:_0x114375['model'];if(_0x509b10['query'][_0x8f7f('0x3b')]){_0x5ac38f[_0x8f7f('0x41')]=[{'all':!![]}];}_0x5ac38f=_[_0x8f7f('0x37')]({},_0x5ac38f,_0x509b10['options']);return db[_0x8f7f('0x39')][_0x8f7f('0x42')](_0x5ac38f)[_0x8f7f('0x3a')](handleEntityNotFound(_0x5babe7,null))['then'](respondWithResult(_0x5babe7,null))[_0x8f7f('0x3d')](handleError(_0x5babe7,null));};exports[_0x8f7f('0x43')]=function(_0x4716e9,_0x2faf82){return db[_0x8f7f('0x39')]['create'](_0x4716e9[_0x8f7f('0x44')],{})[_0x8f7f('0x3a')](respondWithResult(_0x2faf82,0xc9))[_0x8f7f('0x3d')](handleError(_0x2faf82,null));};exports[_0x8f7f('0x23')]=function(_0x14817d,_0x3a68ea){if(_0x14817d['body']['id']){delete _0x14817d[_0x8f7f('0x44')]['id'];}return db['VoiceDialReport'][_0x8f7f('0x42')]({'where':{'id':_0x14817d[_0x8f7f('0x45')]['id']}})[_0x8f7f('0x3a')](handleEntityNotFound(_0x3a68ea,null))[_0x8f7f('0x3a')](saveUpdates(_0x14817d[_0x8f7f('0x44')],null))[_0x8f7f('0x3a')](respondWithResult(_0x3a68ea,null))[_0x8f7f('0x3d')](handleError(_0x3a68ea,null));};exports[_0x8f7f('0x46')]=function(_0x3d3e53,_0x3f394b){return db[_0x8f7f('0x39')][_0x8f7f('0x42')]({'where':{'id':_0x3d3e53['params']['id']}})[_0x8f7f('0x3a')](handleEntityNotFound(_0x3f394b,null))[_0x8f7f('0x3a')](removeEntity(_0x3f394b,null))[_0x8f7f('0x3d')](handleError(_0x3f394b,null));};exports[_0x8f7f('0x47')]=function(_0x18e95f,_0x3c8a9b){return db[_0x8f7f('0x39')][_0x8f7f('0x47')]()[_0x8f7f('0x3a')](respondWithResult(_0x3c8a9b,null))[_0x8f7f('0x3d')](handleError(_0x3c8a9b,null));}; \ No newline at end of file +var _0x4aa4=['status','json','count','offset','limit','apply','save','update','destroy','then','end','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1779fe,_0x5d05c9){var _0x25756f=function(_0x5d3e71){while(--_0x5d3e71){_0x1779fe['push'](_0x1779fe['shift']());}};_0x25756f(++_0x5d05c9);}(_0x4aa4,0x70));var _0x44aa=function(_0x39faae,_0x574c35){_0x39faae=_0x39faae-0x0;var _0x357f4c=_0x4aa4[_0x39faae];return _0x357f4c;};'use strict';var pdf=require(_0x44aa('0x0'));var emlformat=require(_0x44aa('0x1'));var rimraf=require(_0x44aa('0x2'));var zipdir=require(_0x44aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44aa('0x4'));var moment=require(_0x44aa('0x5'));var BPromise=require(_0x44aa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x44aa('0x7'));var sox=require('sox');var csv=require(_0x44aa('0x8'));var ejs=require(_0x44aa('0x9'));var fs=require('fs');var _=require(_0x44aa('0xa'));var squel=require(_0x44aa('0xb'));var crypto=require(_0x44aa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44aa('0xd'));var toCsv=require(_0x44aa('0x8'));var querystring=require(_0x44aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x44aa('0xf'));var authService=require(_0x44aa('0x10'));var qs=require(_0x44aa('0x11'));var as=require(_0x44aa('0x12'));var hardwareService=require(_0x44aa('0x13'));var logger=require(_0x44aa('0x14'))(_0x44aa('0x15'));var utils=require('../../config/utils');var config=require(_0x44aa('0x16'));var licenseUtil=require(_0x44aa('0x17'));var db=require(_0x44aa('0x18'))['db'];function respondWithStatusCode(_0x19709a,_0x516199){_0x516199=_0x516199||0xcc;return function(_0x6a371b){if(_0x6a371b){return _0x19709a[_0x44aa('0x19')](_0x516199);}return _0x19709a[_0x44aa('0x1a')](_0x516199)['end']();};}function respondWithResult(_0x4b098e,_0x3b095e){_0x3b095e=_0x3b095e||0xc8;return function(_0x1b536f){if(_0x1b536f){return _0x4b098e[_0x44aa('0x1a')](_0x3b095e)[_0x44aa('0x1b')](_0x1b536f);}};}function respondWithFilteredResult(_0x17ca82,_0x5665e5){return function(_0x5e918b){if(_0x5e918b){var _0xd2b68=_0x5e918b[_0x44aa('0x1c')],_0x577471=_0x5665e5[_0x44aa('0x1d')],_0x2aafe0=_0x5665e5[_0x44aa('0x1d')]+_0x5665e5[_0x44aa('0x1e')],_0x23c8bd;if(_0x2aafe0>=_0xd2b68){_0x2aafe0=_0xd2b68;_0x23c8bd=0xc8;}else{_0x23c8bd=0xce;}_0x17ca82[_0x44aa('0x1a')](_0x23c8bd);return _0x17ca82['set']('Content-Range',_0x577471+'-'+_0x2aafe0+'/'+_0xd2b68)[_0x44aa('0x1b')](_0x5e918b);}return null;};}function patchUpdates(_0x284925){return function(_0x218199){try{jsonpatch[_0x44aa('0x1f')](_0x218199,_0x284925,!![]);}catch(_0x2fb86f){return BPromise['reject'](_0x2fb86f);}return _0x218199[_0x44aa('0x20')]();};}function saveUpdates(_0x386a01,_0x686f66){return function(_0x44736c){if(_0x44736c){return _0x44736c[_0x44aa('0x21')](_0x386a01)['then'](function(_0x14a0af){return _0x14a0af;});}return null;};}function removeEntity(_0x15b454,_0x41b769){return function(_0x4ab030){if(_0x4ab030){return _0x4ab030[_0x44aa('0x22')]()[_0x44aa('0x23')](function(){_0x15b454['status'](0xcc)[_0x44aa('0x24')]();});}};}function handleEntityNotFound(_0x5de47b,_0x5a25ad){return function(_0x2a1c11){if(!_0x2a1c11){_0x5de47b[_0x44aa('0x19')](0x194);}return _0x2a1c11;};}function handleError(_0x4987b4,_0x116fcc){_0x116fcc=_0x116fcc||0x1f4;return function(_0x5c24f6){logger[_0x44aa('0x25')](_0x5c24f6[_0x44aa('0x26')]);if(_0x5c24f6[_0x44aa('0x27')]){delete _0x5c24f6['name'];}_0x4987b4[_0x44aa('0x1a')](_0x116fcc)['send'](_0x5c24f6);};}exports[_0x44aa('0x28')]=function(_0x33ef7a,_0x176e34){var _0x521fa9={},_0x25db24={},_0x3ad26c={'count':0x0,'rows':[]};var _0x489ba4=_[_0x44aa('0x29')](db[_0x44aa('0x2a')][_0x44aa('0x2b')],function(_0x3ae672){return{'name':_0x3ae672[_0x44aa('0x2c')],'type':_0x3ae672[_0x44aa('0x2d')][_0x44aa('0x2e')]};});_0x25db24[_0x44aa('0x2f')]=_[_0x44aa('0x29')](_0x489ba4,'name');_0x25db24[_0x44aa('0x30')]=_[_0x44aa('0x31')](_0x33ef7a[_0x44aa('0x30')]);_0x25db24['filters']=_[_0x44aa('0x32')](_0x25db24[_0x44aa('0x2f')],_0x25db24[_0x44aa('0x30')]);_0x521fa9[_0x44aa('0x33')]=_['intersection'](_0x25db24[_0x44aa('0x2f')],qs[_0x44aa('0x34')](_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x34')]));_0x521fa9['attributes']=_0x521fa9[_0x44aa('0x33')]['length']?_0x521fa9[_0x44aa('0x33')]:_0x25db24[_0x44aa('0x2f')];if(!_0x33ef7a['query']['hasOwnProperty'](_0x44aa('0x35'))){_0x521fa9['limit']=qs['limit'](_0x33ef7a['query'][_0x44aa('0x1e')]);_0x521fa9[_0x44aa('0x1d')]=qs['offset'](_0x33ef7a[_0x44aa('0x30')]['offset']);}_0x521fa9['order']=qs[_0x44aa('0x36')](_0x33ef7a[_0x44aa('0x30')]['sort']);_0x521fa9[_0x44aa('0x37')]=qs[_0x44aa('0x38')](_[_0x44aa('0x39')](_0x33ef7a[_0x44aa('0x30')],_0x25db24[_0x44aa('0x38')]),_0x489ba4);if(_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3a')]){_0x521fa9[_0x44aa('0x37')]=_[_0x44aa('0x3b')](_0x521fa9[_0x44aa('0x37')],{'$or':_[_0x44aa('0x29')](_0x489ba4,function(_0x21dc01){if(_0x21dc01[_0x44aa('0x2d')]!==_0x44aa('0x3c')){var _0x972aa8={};_0x972aa8[_0x21dc01[_0x44aa('0x27')]]={'$like':'%'+_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3a')]+'%'};return _0x972aa8;}})});}_0x521fa9=_[_0x44aa('0x3b')]({},_0x521fa9,_0x33ef7a['options']);var _0x2d4dc5={'where':_0x521fa9[_0x44aa('0x37')]};return db[_0x44aa('0x2a')][_0x44aa('0x1c')](_0x2d4dc5)[_0x44aa('0x23')](function(_0x5044c8){_0x3ad26c[_0x44aa('0x1c')]=_0x5044c8;if(_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3d')]){_0x521fa9[_0x44aa('0x3e')]=[{'all':!![]}];}return db[_0x44aa('0x2a')]['findAll'](_0x521fa9);})[_0x44aa('0x23')](function(_0x3ec1d2){_0x3ad26c['rows']=_0x3ec1d2;return _0x3ad26c;})['then'](respondWithFilteredResult(_0x176e34,_0x521fa9))[_0x44aa('0x3f')](handleError(_0x176e34,null));};exports[_0x44aa('0x40')]=function(_0x2ed8d0,_0x4ef955){var _0x523658={'raw':!![],'where':{'id':_0x2ed8d0['params']['id']}},_0xe5e0a9={};_0xe5e0a9[_0x44aa('0x2f')]=_[_0x44aa('0x31')](db['VoiceDialReport'][_0x44aa('0x2b')]);_0xe5e0a9[_0x44aa('0x30')]=_[_0x44aa('0x31')](_0x2ed8d0[_0x44aa('0x30')]);_0xe5e0a9[_0x44aa('0x38')]=_['intersection'](_0xe5e0a9[_0x44aa('0x2f')],_0xe5e0a9['query']);_0x523658['attributes']=_['intersection'](_0xe5e0a9[_0x44aa('0x2f')],qs[_0x44aa('0x34')](_0x2ed8d0['query'][_0x44aa('0x34')]));_0x523658[_0x44aa('0x33')]=_0x523658['attributes']['length']?_0x523658[_0x44aa('0x33')]:_0xe5e0a9[_0x44aa('0x2f')];if(_0x2ed8d0['query']['includeAll']){_0x523658[_0x44aa('0x3e')]=[{'all':!![]}];}_0x523658=_['merge']({},_0x523658,_0x2ed8d0['options']);return db[_0x44aa('0x2a')][_0x44aa('0x41')](_0x523658)['then'](handleEntityNotFound(_0x4ef955,null))[_0x44aa('0x23')](respondWithResult(_0x4ef955,null))[_0x44aa('0x3f')](handleError(_0x4ef955,null));};exports[_0x44aa('0x42')]=function(_0x3756fa,_0x23307d){return db[_0x44aa('0x2a')][_0x44aa('0x42')](_0x3756fa['body'],{})[_0x44aa('0x23')](respondWithResult(_0x23307d,0xc9))['catch'](handleError(_0x23307d,null));};exports[_0x44aa('0x21')]=function(_0x56edc6,_0x1c41c0){if(_0x56edc6[_0x44aa('0x43')]['id']){delete _0x56edc6['body']['id'];}return db['VoiceDialReport'][_0x44aa('0x41')]({'where':{'id':_0x56edc6['params']['id']}})[_0x44aa('0x23')](handleEntityNotFound(_0x1c41c0,null))[_0x44aa('0x23')](saveUpdates(_0x56edc6['body'],null))[_0x44aa('0x23')](respondWithResult(_0x1c41c0,null))[_0x44aa('0x3f')](handleError(_0x1c41c0,null));};exports[_0x44aa('0x22')]=function(_0x4ee813,_0x2e42a1){return db['VoiceDialReport']['find']({'where':{'id':_0x4ee813['params']['id']}})[_0x44aa('0x23')](handleEntityNotFound(_0x2e42a1,null))[_0x44aa('0x23')](removeEntity(_0x2e42a1,null))['catch'](handleError(_0x2e42a1,null));};exports[_0x44aa('0x44')]=function(_0x5ee2f9,_0x12292d){return db[_0x44aa('0x2a')][_0x44aa('0x44')]()[_0x44aa('0x23')](respondWithResult(_0x12292d,null))['catch'](handleError(_0x12292d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1507fa9..619c4c4 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 _0xff24=['../../config/logger','api','moment','bluebird','request-promise','define','util'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xff24,0x92));var _0x4ff2=function(_0x119e3f,_0x2281f3){_0x119e3f=_0x119e3f-0x0;var _0x3d67d1=_0xff24[_0x119e3f];return _0x3d67d1;};'use strict';var _=require('lodash');var util=require(_0x4ff2('0x0'));var logger=require(_0x4ff2('0x1'))(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xe28f5f,_0x46aea8){return _0xe28f5f[_0x4ff2('0x6')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf46c=['rimraf','../../config/environment','exports','VoiceDialReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x4a25b9,_0x3195ed){var _0x21f5fc=function(_0x38aff3){while(--_0x38aff3){_0x4a25b9['push'](_0x4a25b9['shift']());}};_0x21f5fc(++_0x3195ed);}(_0xf46c,0x11d));var _0xcf46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf46c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf46('0x0'))(_0xcf46('0x1'));var moment=require(_0xcf46('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf46('0x3'));var fs=require('fs');var path=require(_0xcf46('0x4'));var rimraf=require(_0xcf46('0x5'));var config=require(_0xcf46('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xcf46('0x7')]=function(_0x592625,_0x27ca7e){return _0x592625['define'](_0xcf46('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xcf46('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 775b657..55f4548 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 _0xf45f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','lodash','util'];(function(_0x8fe409,_0x3c212c){var _0xb24771=function(_0x41125a){while(--_0x41125a){_0x8fe409['push'](_0x8fe409['shift']());}};_0xb24771(++_0x3c212c);}(_0xf45f,0xd0));var _0xff45=function(_0x307287,_0x4454db){_0x307287=_0x307287-0x0;var _0x438e41=_0xf45f[_0x307287];return _0x438e41;};'use strict';var _=require(_0xff45('0x0'));var util=require(_0xff45('0x1'));var moment=require(_0xff45('0x2'));var BPromise=require(_0xff45('0x3'));var rs=require(_0xff45('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff45('0x5'))['db'];var utils=require(_0xff45('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xff45('0x7'));var jayson=require(_0xff45('0x8'));var client=jayson[_0xff45('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1debee,_0x32f16c,_0x2dcc49){return new BPromise(function(_0x15f771,_0x5eee67){return client[_0xff45('0xa')](_0x1debee,_0x2dcc49)[_0xff45('0xb')](function(_0x5603ac){logger[_0xff45('0xc')](_0xff45('0xd'),_0x32f16c,_0xff45('0xe'));logger[_0xff45('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x32f16c,_0xff45('0xe'),JSON[_0xff45('0x10')](_0x5603ac));if(_0x5603ac[_0xff45('0x11')]){if(_0x5603ac[_0xff45('0x11')]['code']===0x1f4){logger[_0xff45('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x32f16c,_0x5603ac['error']['message']);return _0x5eee67(_0x5603ac['error'][_0xff45('0x12')]);}logger[_0xff45('0x11')](_0xff45('0xd'),_0x32f16c,_0x5603ac[_0xff45('0x11')][_0xff45('0x12')]);return _0x15f771(_0x5603ac['error'][_0xff45('0x12')]);}else{logger[_0xff45('0xc')](_0xff45('0xd'),_0x32f16c,'request\x20sent');_0x15f771(_0x5603ac[_0xff45('0x13')][_0xff45('0x12')]);}})[_0xff45('0x14')](function(_0xb7dd69){logger[_0xff45('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x32f16c,_0xb7dd69);_0x5eee67(_0xb7dd69);});});}exports[_0xff45('0x15')]=function(_0x240cea){var _0x3cdda8=this;return new Promise(function(_0x126759,_0x15d1a2){return db[_0xff45('0x16')][_0xff45('0x17')](_0x240cea[_0xff45('0x18')],{'raw':_0x240cea[_0xff45('0x19')]?_0x240cea['options'][_0xff45('0x1a')]===undefined?!![]:![]:!![]})[_0xff45('0xb')](function(_0x5778d1){logger['info'](_0xff45('0x15'),_0x240cea);logger['debug'](_0xff45('0x15'),_0x240cea,JSON[_0xff45('0x10')](_0x5778d1));_0x126759(_0x5778d1);})[_0xff45('0x14')](function(_0x20d0e7){logger[_0xff45('0x11')](_0xff45('0x15'),_0x20d0e7[_0xff45('0x12')],_0x240cea);_0x15d1a2(_0x3cdda8[_0xff45('0x11')](0x1f4,_0x20d0e7[_0xff45('0x12')]));});});};exports[_0xff45('0x1b')]=function(_0x51068f){var _0xb5b102=this;return new Promise(function(_0x586247,_0xf217d3){return db[_0xff45('0x16')][_0xff45('0x1c')](_0x51068f[_0xff45('0x18')],{'raw':_0x51068f[_0xff45('0x19')]?_0x51068f[_0xff45('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51068f['options']?_0x51068f[_0xff45('0x19')][_0xff45('0x1d')]||null:null,'attributes':_0x51068f[_0xff45('0x19')]?_0x51068f[_0xff45('0x19')]['attributes']||null:null,'limit':_0x51068f['options']?_0x51068f['options']['limit']||null:null})[_0xff45('0xb')](function(_0x130228){logger[_0xff45('0xc')](_0xff45('0x1b'),_0x51068f);logger[_0xff45('0xf')]('UpdateVoiceDialReport',_0x51068f,JSON[_0xff45('0x10')](_0x130228));_0x586247(_0x130228);})[_0xff45('0x14')](function(_0x59db11){logger['error'](_0xff45('0x1b'),_0x59db11[_0xff45('0x12')],_0x51068f);_0xf217d3(_0xb5b102[_0xff45('0x11')](0x1f4,_0x59db11[_0xff45('0x12')]));});});}; \ No newline at end of file +var _0xbccb=['error','VoiceDialReport,\x20%s,\x20%s','message','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','stringify','code'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xbccb,0x1a4));var _0xbbcc=function(_0x525d35,_0xe67489){_0x525d35=_0x525d35-0x0;var _0x4813d2=_0xbccb[_0x525d35];return _0x4813d2;};'use strict';var _=require('lodash');var util=require(_0xbbcc('0x0'));var moment=require(_0xbbcc('0x1'));var BPromise=require(_0xbbcc('0x2'));var rs=require(_0xbbcc('0x3'));var fs=require('fs');var Redis=require(_0xbbcc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbcc('0x5'));var logger=require(_0xbbcc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbcc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x276621,_0x3fb981,_0x12987b){return new BPromise(function(_0x155b4e,_0x3afc8c){return client[_0xbbcc('0x8')](_0x276621,_0x12987b)[_0xbbcc('0x9')](function(_0x1f5f47){logger[_0xbbcc('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x3fb981,_0xbbcc('0xb'));logger[_0xbbcc('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3fb981,_0xbbcc('0xb'),JSON[_0xbbcc('0xd')](_0x1f5f47));if(_0x1f5f47['error']){if(_0x1f5f47['error'][_0xbbcc('0xe')]===0x1f4){logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1f5f47['error'][_0xbbcc('0x11')]);return _0x3afc8c(_0x1f5f47['error'][_0xbbcc('0x11')]);}logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1f5f47[_0xbbcc('0xf')][_0xbbcc('0x11')]);return _0x155b4e(_0x1f5f47[_0xbbcc('0xf')][_0xbbcc('0x11')]);}else{logger[_0xbbcc('0xa')](_0xbbcc('0x10'),_0x3fb981,_0xbbcc('0xb'));_0x155b4e(_0x1f5f47['result'][_0xbbcc('0x11')]);}})['catch'](function(_0x1bd7ce){logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1bd7ce);_0x3afc8c(_0x1bd7ce);});});}exports[_0xbbcc('0x12')]=function(_0x52bd69){var _0xa2fed7=this;return new Promise(function(_0xb9253c,_0x5dc434){return db[_0xbbcc('0x13')][_0xbbcc('0x14')](_0x52bd69[_0xbbcc('0x15')],{'raw':_0x52bd69[_0xbbcc('0x16')]?_0x52bd69['options']['raw']===undefined?!![]:![]:!![]})[_0xbbcc('0x9')](function(_0x4c207){logger[_0xbbcc('0xa')](_0xbbcc('0x12'),_0x52bd69);logger[_0xbbcc('0xc')](_0xbbcc('0x12'),_0x52bd69,JSON[_0xbbcc('0xd')](_0x4c207));_0xb9253c(_0x4c207);})['catch'](function(_0x35cc4b){logger[_0xbbcc('0xf')]('CreateVoiceDialReport',_0x35cc4b[_0xbbcc('0x11')],_0x52bd69);_0x5dc434(_0xa2fed7[_0xbbcc('0xf')](0x1f4,_0x35cc4b[_0xbbcc('0x11')]));});});};exports[_0xbbcc('0x17')]=function(_0x14386b){var _0x5f54e6=this;return new Promise(function(_0x21e826,_0xd63626){return db['VoiceDialReport'][_0xbbcc('0x18')](_0x14386b['body'],{'raw':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')][_0xbbcc('0x19')]||null:null,'attributes':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')][_0xbbcc('0x1a')]||null:null,'limit':_0x14386b[_0xbbcc('0x16')]?_0x14386b['options'][_0xbbcc('0x1b')]||null:null})[_0xbbcc('0x9')](function(_0x1fdbde){logger[_0xbbcc('0xa')](_0xbbcc('0x17'),_0x14386b);logger[_0xbbcc('0xc')](_0xbbcc('0x17'),_0x14386b,JSON[_0xbbcc('0xd')](_0x1fdbde));_0x21e826(_0x1fdbde);})[_0xbbcc('0x1c')](function(_0x2dfa85){logger[_0xbbcc('0xf')](_0xbbcc('0x17'),_0x2dfa85[_0xbbcc('0x11')],_0x14386b);_0xd63626(_0x5f54e6[_0xbbcc('0xf')](0x1f4,_0x2dfa85['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 999e1b6..6230059 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 _0xdc3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x54c92c,_0x25b4f5){var _0x402089=function(_0x127e54){while(--_0x127e54){_0x54c92c['push'](_0x54c92c['shift']());}};_0x402089(++_0x25b4f5);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x4f7ed9,_0x27d4d3){_0x4f7ed9=_0x4f7ed9-0x0;var _0x4d60a5=_0xdc3c[_0x4f7ed9];return _0x4d60a5;};'use strict';var multer=require(_0xcdc3('0x0'));var util=require('util');var path=require(_0xcdc3('0x1'));var timeout=require(_0xcdc3('0x2'));var express=require(_0xcdc3('0x3'));var router=express[_0xcdc3('0x4')]();var auth=require(_0xcdc3('0x5'));var interaction=require(_0xcdc3('0x6'));var config=require(_0xcdc3('0x7'));var controller=require(_0xcdc3('0x8'));router[_0xcdc3('0x9')]('/',auth[_0xcdc3('0xa')](),controller[_0xcdc3('0xb')]);router[_0xcdc3('0x9')](_0xcdc3('0xc'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0xd')]);router[_0xcdc3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xcdc3('0xf'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0x10')]);router[_0xcdc3('0x11')](_0xcdc3('0xc'),auth[_0xcdc3('0xa')](),controller[_0xcdc3('0x12')]);router[_0xcdc3('0x13')](_0xcdc3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcdc3('0x14')]=router; \ No newline at end of file +var _0x27cb=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27cb,0x73));var _0xb27c=function(_0x270c48,_0x15064d){_0x270c48=_0x270c48-0x0;var _0x24aa62=_0x27cb[_0x270c48];return _0x24aa62;};'use strict';var multer=require(_0xb27c('0x0'));var util=require('util');var path=require(_0xb27c('0x1'));var timeout=require(_0xb27c('0x2'));var express=require(_0xb27c('0x3'));var router=express[_0xb27c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb27c('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xb27c('0x6')](),controller[_0xb27c('0x7')]);router[_0xb27c('0x8')](_0xb27c('0x9'),auth['isAuthenticated'](),controller[_0xb27c('0xa')]);router[_0xb27c('0xb')]('/',auth[_0xb27c('0x6')](),controller[_0xb27c('0xc')]);router[_0xb27c('0xb')](_0xb27c('0xd'),auth[_0xb27c('0x6')](),controller[_0xb27c('0xe')]);router[_0xb27c('0xf')]('/:id',auth[_0xb27c('0x6')](),controller[_0xb27c('0x10')]);router[_0xb27c('0x11')](_0xb27c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb27c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 31ac722..e1cfcc4 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(_0x438660,_0x5d6757){var _0xe33ab7=function(_0x17a3ef){while(--_0x17a3ef){_0x438660['push'](_0x438660['shift']());}};_0xe33ab7(++_0x5d6757);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x23490f,_0x456320){var _0x2ec6c6=function(_0x587094){while(--_0x587094){_0x23490f['push'](_0x23490f['shift']());}};_0x2ec6c6(++_0x456320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 893659c..fa9c79c 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 _0x39ec=['update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','destroy','VoiceExtensionId','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','json','apply','reject','save','get','InternalRoutes','filter','map','value','find','type','name','then','error','send','index','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','VoiceExtension','count','includeAll','include','rows','catch','params','keys','length','create','body','outbound','startsWith','exten','role','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x23e6ab,_0x5410ab){var _0x171bab=function(_0x3f6fc0){while(--_0x3f6fc0){_0x23e6ab['push'](_0x23e6ab['shift']());}};_0x171bab(++_0x5410ab);}(_0x39ec,0x195));var _0xc39e=function(_0x18da22,_0x42a30f){_0x18da22=_0x18da22-0x0;var _0x4fbcec=_0x39ec[_0x18da22];return _0x4fbcec;};'use strict';var pdf=require(_0xc39e('0x0'));var emlformat=require(_0xc39e('0x1'));var rimraf=require(_0xc39e('0x2'));var zipdir=require(_0xc39e('0x3'));var jsonpatch=require(_0xc39e('0x4'));var rp=require(_0xc39e('0x5'));var moment=require('moment');var BPromise=require(_0xc39e('0x6'));var Mustache=require(_0xc39e('0x7'));var util=require(_0xc39e('0x8'));var path=require('path');var sox=require(_0xc39e('0x9'));var csv=require('to-csv');var ejs=require(_0xc39e('0xa'));var fs=require('fs');var _=require(_0xc39e('0xb'));var squel=require(_0xc39e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc39e('0xd'));var deskjs=require(_0xc39e('0xe'));var toCsv=require(_0xc39e('0xf'));var querystring=require(_0xc39e('0x10'));var Papa=require(_0xc39e('0x11'));var Redis=require(_0xc39e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc39e('0x13'));var hardwareService=require(_0xc39e('0x14'));var logger=require(_0xc39e('0x15'))(_0xc39e('0x16'));var utils=require(_0xc39e('0x17'));var config=require(_0xc39e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc39e('0x19'))['db'];config[_0xc39e('0x1a')]=_['defaults'](config[_0xc39e('0x1a')],{'host':_0xc39e('0x1b'),'port':0x18eb});var socket=require(_0xc39e('0x1c'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x1019d3,_0x1a8f2b){_0x1a8f2b=_0x1a8f2b||0xcc;return function(_0x2da91b){if(_0x2da91b){return _0x1019d3[_0xc39e('0x1d')](_0x1a8f2b);}return _0x1019d3[_0xc39e('0x1e')](_0x1a8f2b)[_0xc39e('0x1f')]();};}function respondWithResult(_0x30509a,_0x59254b){_0x59254b=_0x59254b||0xc8;return function(_0x1cb51b){if(_0x1cb51b){return _0x30509a[_0xc39e('0x1e')](_0x59254b)['json'](_0x1cb51b);}};}function respondWithFilteredResult(_0xaa221e,_0x4f9b9a){return function(_0xd9417b){if(_0xd9417b){var _0x3c4491=_0xd9417b['count'],_0x2a27c2=_0x4f9b9a[_0xc39e('0x20')],_0x1620b3=_0x4f9b9a[_0xc39e('0x20')]+_0x4f9b9a['limit'],_0x356edb;if(_0x1620b3>=_0x3c4491){_0x1620b3=_0x3c4491;_0x356edb=0xc8;}else{_0x356edb=0xce;}_0xaa221e[_0xc39e('0x1e')](_0x356edb);return _0xaa221e['set']('Content-Range',_0x2a27c2+'-'+_0x1620b3+'/'+_0x3c4491)[_0xc39e('0x21')](_0xd9417b);}return null;};}function patchUpdates(_0x109140){return function(_0x14e336){try{jsonpatch[_0xc39e('0x22')](_0x14e336,_0x109140,!![]);}catch(_0x42f1f3){return BPromise[_0xc39e('0x23')](_0x42f1f3);}return _0x14e336[_0xc39e('0x24')]();};}function saveUpdates(_0x169363,_0x8a549e){return function(_0x242249){if(_0x242249){return _0x242249['update'](_0x169363)['then'](function(_0x5479b2){return _0x5479b2;});}return null;};}function removeEntity(_0x24dc3f,_0x5218cb){return function(_0x2b5599){if(_0x2b5599){return _0x2b5599['destroy']()['then'](function(){var _0x406df4=_0x2b5599[_0xc39e('0x25')]({'plain':!![]});var _0x114286=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xc39e('0x26'),'value':'internal','ignore':![]}];var _0x5e89a8=_(_0x114286)[_0xc39e('0x27')]('ignore')[_0xc39e('0x28')]('value')[_0xc39e('0x29')]();if(_['includes'](_0x5e89a8,_0x406df4['type'])){return;}var _0x1cffb5=_[_0xc39e('0x2a')](_0x114286,[_0xc39e('0x29'),_0x406df4[_0xc39e('0x2b')]])[_0xc39e('0x2c')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1cffb5,'resourceId':_0x406df4['id']}})['then'](function(){return _0x2b5599;});})[_0xc39e('0x2d')](function(){_0x24dc3f[_0xc39e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8bd285,_0x6dacb1){return function(_0x2adf64){if(!_0x2adf64){_0x8bd285[_0xc39e('0x1d')](0x194);}return _0x2adf64;};}function handleError(_0x4fc42d,_0x379a34){_0x379a34=_0x379a34||0x1f4;return function(_0x19b795){logger[_0xc39e('0x2e')](_0x19b795['stack']);if(_0x19b795[_0xc39e('0x2c')]){delete _0x19b795['name'];}_0x4fc42d['status'](_0x379a34)[_0xc39e('0x2f')](_0x19b795);};}exports[_0xc39e('0x30')]=function(_0x47bc70,_0x39f57b){var _0x481673={},_0x1ec651={},_0x323fda={'count':0x0,'rows':[]};var _0x116b20=_[_0xc39e('0x28')](db['VoiceExtension'][_0xc39e('0x31')],function(_0x238476){return{'name':_0x238476[_0xc39e('0x32')],'type':_0x238476[_0xc39e('0x2b')]['key']};});_0x1ec651[_0xc39e('0x33')]=_[_0xc39e('0x28')](_0x116b20,_0xc39e('0x2c'));_0x1ec651['query']=_['keys'](_0x47bc70['query']);_0x1ec651[_0xc39e('0x34')]=_[_0xc39e('0x35')](_0x1ec651[_0xc39e('0x33')],_0x1ec651[_0xc39e('0x36')]);_0x481673[_0xc39e('0x37')]=_['intersection'](_0x1ec651[_0xc39e('0x33')],qs['fields'](_0x47bc70['query'][_0xc39e('0x38')]));_0x481673[_0xc39e('0x37')]=_0x481673[_0xc39e('0x37')]['length']?_0x481673[_0xc39e('0x37')]:_0x1ec651[_0xc39e('0x33')];if(!_0x47bc70[_0xc39e('0x36')][_0xc39e('0x39')](_0xc39e('0x3a'))){_0x481673[_0xc39e('0x3b')]=qs[_0xc39e('0x3b')](_0x47bc70['query'][_0xc39e('0x3b')]);_0x481673['offset']=qs[_0xc39e('0x20')](_0x47bc70[_0xc39e('0x36')]['offset']);}_0x481673[_0xc39e('0x3c')]=qs[_0xc39e('0x3d')](_0x47bc70[_0xc39e('0x36')][_0xc39e('0x3d')]);_0x481673[_0xc39e('0x3e')]=qs[_0xc39e('0x34')](_[_0xc39e('0x3f')](_0x47bc70[_0xc39e('0x36')],_0x1ec651[_0xc39e('0x34')]),_0x116b20);if(_0x47bc70[_0xc39e('0x36')][_0xc39e('0x27')]){_0x481673['where']=_[_0xc39e('0x40')](_0x481673[_0xc39e('0x3e')],{'$or':_[_0xc39e('0x28')](_0x116b20,function(_0x26cbb3){if(_0x26cbb3[_0xc39e('0x2b')]!=='VIRTUAL'){var _0x16fb26={};_0x16fb26[_0x26cbb3['name']]={'$like':'%'+_0x47bc70[_0xc39e('0x36')][_0xc39e('0x27')]+'%'};return _0x16fb26;}})});}_0x481673=_['merge']({},_0x481673,_0x47bc70[_0xc39e('0x41')]);var _0x542a7={'where':_0x481673['where']};return db[_0xc39e('0x42')][_0xc39e('0x43')](_0x542a7)['then'](function(_0x1443e5){_0x323fda['count']=_0x1443e5;if(_0x47bc70[_0xc39e('0x36')][_0xc39e('0x44')]){_0x481673[_0xc39e('0x45')]=[{'all':!![]}];}return db[_0xc39e('0x42')]['findAll'](_0x481673);})[_0xc39e('0x2d')](function(_0x122fa3){_0x323fda[_0xc39e('0x46')]=_0x122fa3;return _0x323fda;})[_0xc39e('0x2d')](respondWithFilteredResult(_0x39f57b,_0x481673))[_0xc39e('0x47')](handleError(_0x39f57b,null));};exports['show']=function(_0xe4ba3e,_0x2999e1){var _0x4453eb={'raw':![],'where':{'id':_0xe4ba3e[_0xc39e('0x48')]['id']}},_0x42f1e4={};_0x42f1e4[_0xc39e('0x33')]=_[_0xc39e('0x49')](db[_0xc39e('0x42')][_0xc39e('0x31')]);_0x42f1e4['query']=_[_0xc39e('0x49')](_0xe4ba3e['query']);_0x42f1e4[_0xc39e('0x34')]=_[_0xc39e('0x35')](_0x42f1e4[_0xc39e('0x33')],_0x42f1e4[_0xc39e('0x36')]);_0x4453eb[_0xc39e('0x37')]=_['intersection'](_0x42f1e4['model'],qs[_0xc39e('0x38')](_0xe4ba3e[_0xc39e('0x36')][_0xc39e('0x38')]));_0x4453eb[_0xc39e('0x37')]=_0x4453eb[_0xc39e('0x37')][_0xc39e('0x4a')]?_0x4453eb['attributes']:_0x42f1e4[_0xc39e('0x33')];if(_0xe4ba3e[_0xc39e('0x36')][_0xc39e('0x44')]){_0x4453eb['include']=[{'all':!![]}];}_0x4453eb=_['merge']({},_0x4453eb,_0xe4ba3e[_0xc39e('0x41')]);return db['VoiceExtension'][_0xc39e('0x2a')](_0x4453eb)[_0xc39e('0x2d')](handleEntityNotFound(_0x2999e1,null))['then'](respondWithResult(_0x2999e1,null))[_0xc39e('0x47')](handleError(_0x2999e1,null));};exports['destroy']=function(_0x29e8cf,_0x4c8864){return db[_0xc39e('0x42')][_0xc39e('0x2a')]({'where':{'id':_0x29e8cf[_0xc39e('0x48')]['id']}})[_0xc39e('0x2d')](handleEntityNotFound(_0x4c8864,null))[_0xc39e('0x2d')](removeEntity(_0x4c8864,null))['catch'](handleError(_0x4c8864,null));};exports[_0xc39e('0x4b')]=function(_0x4fa0e,_0x2ba1cc){if(_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x2b')]===_0xc39e('0x4d')&&!_[_0xc39e('0x4e')](_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x4f')],'_')){_0x4fa0e[_0xc39e('0x4c')][_0xc39e('0x4f')]='_'['concat'](_0x4fa0e['body'][_0xc39e('0x4f')]);}return db[_0xc39e('0x42')][_0xc39e('0x4b')](_0x4fa0e['body'],{'raw':![]})[_0xc39e('0x2d')](function(_0x58ff41){var _0x300504=_0x4fa0e['user'][_0xc39e('0x25')]({'plain':!![]});if(!_0x300504)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x300504[_0xc39e('0x50')]==='user'){var _0x5df610=_0x58ff41[_0xc39e('0x25')]({'plain':!![]});var _0x1527fa=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':_0xc39e('0x4d')},{'name':_0xc39e('0x26'),'value':_0xc39e('0x51')}];var _0xb2e955=_['find'](_0x1527fa,['value',_0x5df610[_0xc39e('0x2b')]])[_0xc39e('0x2c')];return db[_0xc39e('0x52')][_0xc39e('0x2a')]({'where':{'name':_0xb2e955,'userProfileId':_0x300504[_0xc39e('0x53')]},'raw':!![]})[_0xc39e('0x2d')](function(_0x103246){if(_0x103246&&_0x103246['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5df610[_0xc39e('0x2c')],'resourceId':_0x5df610['id'],'type':_0x103246[_0xc39e('0x2c')],'sectionId':_0x103246['id']},{})[_0xc39e('0x2d')](function(){return _0x58ff41;});}else{return _0x58ff41;}})['catch'](function(_0x490212){logger[_0xc39e('0x2e')](_0xc39e('0x54'),_0x490212);throw _0x490212;});}return _0x58ff41;})[_0xc39e('0x2d')](respondWithResult(_0x2ba1cc,0xc9))['catch'](handleError(_0x2ba1cc,null));};exports[_0xc39e('0x55')]=function(_0x114977,_0x3f7528){if(_0x114977['body']['id']){delete _0x114977[_0xc39e('0x4c')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x114977[_0xc39e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f7528,null))[_0xc39e('0x2d')](function(_0xd11ff7){if(_0xd11ff7){return db[_0xc39e('0x42')][_0xc39e('0x55')](_[_0xc39e('0x3f')](_0x114977[_0xc39e('0x4c')],[_0xc39e('0x4f'),_0xc39e('0x56'),_0xc39e('0x57'),_0xc39e('0x58'),_0xc39e('0x59'),_0xc39e('0x5a')]),{'where':{'context':_0xd11ff7[_0xc39e('0x56')],'exten':_0xd11ff7['exten']},'individualHooks':!![]})[_0xc39e('0x2d')](function(_0x122604){return _0x122604;});}return null;})[_0xc39e('0x2d')](respondWithStatusCode(_0x3f7528,null))[_0xc39e('0x47')](handleError(_0x3f7528,null));};exports[_0xc39e('0x5b')]=function(_0xd90b5e,_0x25c558,_0xded321){return db[_0xc39e('0x42')][_0xc39e('0x5c')]({'where':{'id':_0xd90b5e[_0xc39e('0x48')]['id']}})[_0xc39e('0x2d')](handleEntityNotFound(_0x25c558,null))[_0xc39e('0x2d')](function(_0x5ba944){if(_0x5ba944){return db[_0xc39e('0x5d')][_0xc39e('0x5e')](function(_0x5ac07e){return db[_0xc39e('0x42')][_0xc39e('0x5f')]({'where':{'VoiceExtensionId':_0xd90b5e['params']['id']},'transaction':_0x5ac07e})[_0xc39e('0x2d')](function(_0x591527){var _0x5a422e=_['map'](_0xd90b5e['body'],function(_0x52bafe){_0x52bafe[_0xc39e('0x60')]=_0xd90b5e['params']['id'];return _0x52bafe;});return db[_0xc39e('0x42')]['bulkCreate'](_0x5a422e,{'transaction':_0x5ac07e});});})[_0xc39e('0x2d')](function(){return db[_0xc39e('0x42')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xd90b5e[_0xc39e('0x48')]['id']},'order':_0xc39e('0x61')});});}})[_0xc39e('0x2d')](respondWithResult(_0x25c558,null))[_0xc39e('0x47')](handleError(_0x25c558,null));}; \ No newline at end of file +var _0x7e4e=['type','find','name','UserProfileResource','destroy','end','error','stack','VoiceExtension','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes'];(function(_0x541b8d,_0x384e14){var _0x186c69=function(_0x4a4a16){while(--_0x4a4a16){_0x541b8d['push'](_0x541b8d['shift']());}};_0x186c69(++_0x384e14);}(_0x7e4e,0x184));var _0xe7e4=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0x7e4e[_0x4e7c1c];return _0x47adb2;};'use strict';var pdf=require(_0xe7e4('0x0'));var emlformat=require(_0xe7e4('0x1'));var rimraf=require(_0xe7e4('0x2'));var zipdir=require(_0xe7e4('0x3'));var jsonpatch=require(_0xe7e4('0x4'));var rp=require(_0xe7e4('0x5'));var moment=require(_0xe7e4('0x6'));var BPromise=require(_0xe7e4('0x7'));var Mustache=require(_0xe7e4('0x8'));var util=require(_0xe7e4('0x9'));var path=require(_0xe7e4('0xa'));var sox=require(_0xe7e4('0xb'));var csv=require('to-csv');var ejs=require(_0xe7e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7e4('0xd'));var crypto=require(_0xe7e4('0xe'));var jsforce=require(_0xe7e4('0xf'));var deskjs=require(_0xe7e4('0x10'));var toCsv=require(_0xe7e4('0x11'));var querystring=require(_0xe7e4('0x12'));var Papa=require(_0xe7e4('0x13'));var Redis=require(_0xe7e4('0x14'));var authService=require(_0xe7e4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe7e4('0x16'));var hardwareService=require(_0xe7e4('0x17'));var logger=require(_0xe7e4('0x18'))(_0xe7e4('0x19'));var utils=require(_0xe7e4('0x1a'));var config=require(_0xe7e4('0x1b'));var licenseUtil=require(_0xe7e4('0x1c'));var db=require(_0xe7e4('0x1d'))['db'];config['redis']=_[_0xe7e4('0x1e')](config[_0xe7e4('0x1f')],{'host':_0xe7e4('0x20'),'port':0x18eb});var socket=require(_0xe7e4('0x21'))(new Redis(config['redis']));require(_0xe7e4('0x22'))[_0xe7e4('0x23')](socket);function respondWithStatusCode(_0x224a4e,_0x360adc){_0x360adc=_0x360adc||0xcc;return function(_0x9beda6){if(_0x9beda6){return _0x224a4e[_0xe7e4('0x24')](_0x360adc);}return _0x224a4e[_0xe7e4('0x25')](_0x360adc)['end']();};}function respondWithResult(_0x2048f1,_0x3caebd){_0x3caebd=_0x3caebd||0xc8;return function(_0x5aa39b){if(_0x5aa39b){return _0x2048f1[_0xe7e4('0x25')](_0x3caebd)['json'](_0x5aa39b);}};}function respondWithFilteredResult(_0x4bc357,_0x2d9739){return function(_0x3cd15c){if(_0x3cd15c){var _0x10039f=_0x3cd15c[_0xe7e4('0x26')],_0x9d5a50=_0x2d9739[_0xe7e4('0x27')],_0x17aa00=_0x2d9739[_0xe7e4('0x27')]+_0x2d9739[_0xe7e4('0x28')],_0x215be9;if(_0x17aa00>=_0x10039f){_0x17aa00=_0x10039f;_0x215be9=0xc8;}else{_0x215be9=0xce;}_0x4bc357[_0xe7e4('0x25')](_0x215be9);return _0x4bc357[_0xe7e4('0x29')](_0xe7e4('0x2a'),_0x9d5a50+'-'+_0x17aa00+'/'+_0x10039f)[_0xe7e4('0x2b')](_0x3cd15c);}return null;};}function patchUpdates(_0x1a39ef){return function(_0x4a2a7b){try{jsonpatch[_0xe7e4('0x2c')](_0x4a2a7b,_0x1a39ef,!![]);}catch(_0x46bdf9){return BPromise[_0xe7e4('0x2d')](_0x46bdf9);}return _0x4a2a7b[_0xe7e4('0x2e')]();};}function saveUpdates(_0xd0c84f,_0x22baba){return function(_0x212623){if(_0x212623){return _0x212623[_0xe7e4('0x2f')](_0xd0c84f)[_0xe7e4('0x30')](function(_0x425bb4){return _0x425bb4;});}return null;};}function removeEntity(_0x3afddf,_0x13ebe7){return function(_0x31115f){if(_0x31115f){return _0x31115f['destroy']()[_0xe7e4('0x30')](function(){var _0x1c2e3c=_0x31115f[_0xe7e4('0x31')]({'plain':!![]});var _0x58a9a6=[{'name':_0xe7e4('0x32'),'value':'inbound','ignore':![]},{'name':_0xe7e4('0x33'),'value':_0xe7e4('0x34'),'ignore':![]},{'name':_0xe7e4('0x35'),'value':_0xe7e4('0x36'),'ignore':![]}];var _0x4fec70=_(_0x58a9a6)[_0xe7e4('0x37')](_0xe7e4('0x38'))[_0xe7e4('0x39')](_0xe7e4('0x3a'))[_0xe7e4('0x3a')]();if(_[_0xe7e4('0x3b')](_0x4fec70,_0x1c2e3c[_0xe7e4('0x3c')])){return;}var _0x557e08=_[_0xe7e4('0x3d')](_0x58a9a6,[_0xe7e4('0x3a'),_0x1c2e3c['type']])[_0xe7e4('0x3e')];return db[_0xe7e4('0x3f')][_0xe7e4('0x40')]({'where':{'type':_0x557e08,'resourceId':_0x1c2e3c['id']}})['then'](function(){return _0x31115f;});})[_0xe7e4('0x30')](function(){_0x3afddf['status'](0xcc)[_0xe7e4('0x41')]();});}};}function handleEntityNotFound(_0x2c6ba0,_0x243058){return function(_0x1ed4e5){if(!_0x1ed4e5){_0x2c6ba0[_0xe7e4('0x24')](0x194);}return _0x1ed4e5;};}function handleError(_0x17209b,_0x2846f6){_0x2846f6=_0x2846f6||0x1f4;return function(_0x493367){logger[_0xe7e4('0x42')](_0x493367[_0xe7e4('0x43')]);if(_0x493367['name']){delete _0x493367['name'];}_0x17209b[_0xe7e4('0x25')](_0x2846f6)['send'](_0x493367);};}exports['index']=function(_0x4dfc40,_0x1ad5b5){var _0x45fb8a={},_0xdc1ee4={},_0x64b383={'count':0x0,'rows':[]};var _0x2b57e5=_[_0xe7e4('0x39')](db[_0xe7e4('0x44')][_0xe7e4('0x45')],function(_0x25ac40){return{'name':_0x25ac40['fieldName'],'type':_0x25ac40[_0xe7e4('0x3c')][_0xe7e4('0x46')]};});_0xdc1ee4[_0xe7e4('0x47')]=_[_0xe7e4('0x39')](_0x2b57e5,'name');_0xdc1ee4['query']=_[_0xe7e4('0x48')](_0x4dfc40[_0xe7e4('0x49')]);_0xdc1ee4[_0xe7e4('0x4a')]=_['intersection'](_0xdc1ee4[_0xe7e4('0x47')],_0xdc1ee4[_0xe7e4('0x49')]);_0x45fb8a[_0xe7e4('0x4b')]=_[_0xe7e4('0x4c')](_0xdc1ee4[_0xe7e4('0x47')],qs[_0xe7e4('0x4d')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x4d')]));_0x45fb8a[_0xe7e4('0x4b')]=_0x45fb8a[_0xe7e4('0x4b')][_0xe7e4('0x4e')]?_0x45fb8a[_0xe7e4('0x4b')]:_0xdc1ee4[_0xe7e4('0x47')];if(!_0x4dfc40[_0xe7e4('0x49')]['hasOwnProperty']('nolimit')){_0x45fb8a[_0xe7e4('0x28')]=qs['limit'](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x28')]);_0x45fb8a[_0xe7e4('0x27')]=qs[_0xe7e4('0x27')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x27')]);}_0x45fb8a[_0xe7e4('0x4f')]=qs[_0xe7e4('0x50')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x50')]);_0x45fb8a['where']=qs[_0xe7e4('0x4a')](_[_0xe7e4('0x51')](_0x4dfc40[_0xe7e4('0x49')],_0xdc1ee4[_0xe7e4('0x4a')]),_0x2b57e5);if(_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x37')]){_0x45fb8a[_0xe7e4('0x52')]=_[_0xe7e4('0x53')](_0x45fb8a[_0xe7e4('0x52')],{'$or':_[_0xe7e4('0x39')](_0x2b57e5,function(_0x2a18a9){if(_0x2a18a9[_0xe7e4('0x3c')]!==_0xe7e4('0x54')){var _0x4fc751={};_0x4fc751[_0x2a18a9['name']]={'$like':'%'+_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x37')]+'%'};return _0x4fc751;}})});}_0x45fb8a=_[_0xe7e4('0x53')]({},_0x45fb8a,_0x4dfc40[_0xe7e4('0x55')]);var _0x12a978={'where':_0x45fb8a['where']};return db[_0xe7e4('0x44')]['count'](_0x12a978)[_0xe7e4('0x30')](function(_0x259436){_0x64b383[_0xe7e4('0x26')]=_0x259436;if(_0x4dfc40[_0xe7e4('0x49')]['includeAll']){_0x45fb8a['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xe7e4('0x56')](_0x45fb8a);})[_0xe7e4('0x30')](function(_0xd2ffee){_0x64b383[_0xe7e4('0x57')]=_0xd2ffee;return _0x64b383;})['then'](respondWithFilteredResult(_0x1ad5b5,_0x45fb8a))[_0xe7e4('0x58')](handleError(_0x1ad5b5,null));};exports[_0xe7e4('0x59')]=function(_0x3db079,_0x26146f){var _0x17181f={'raw':![],'where':{'id':_0x3db079[_0xe7e4('0x5a')]['id']}},_0x4ed501={};_0x4ed501[_0xe7e4('0x47')]=_[_0xe7e4('0x48')](db[_0xe7e4('0x44')][_0xe7e4('0x45')]);_0x4ed501[_0xe7e4('0x49')]=_[_0xe7e4('0x48')](_0x3db079[_0xe7e4('0x49')]);_0x4ed501['filters']=_[_0xe7e4('0x4c')](_0x4ed501[_0xe7e4('0x47')],_0x4ed501[_0xe7e4('0x49')]);_0x17181f[_0xe7e4('0x4b')]=_['intersection'](_0x4ed501['model'],qs[_0xe7e4('0x4d')](_0x3db079['query'][_0xe7e4('0x4d')]));_0x17181f['attributes']=_0x17181f[_0xe7e4('0x4b')][_0xe7e4('0x4e')]?_0x17181f[_0xe7e4('0x4b')]:_0x4ed501[_0xe7e4('0x47')];if(_0x3db079[_0xe7e4('0x49')][_0xe7e4('0x5b')]){_0x17181f[_0xe7e4('0x5c')]=[{'all':!![]}];}_0x17181f=_[_0xe7e4('0x53')]({},_0x17181f,_0x3db079['options']);return db[_0xe7e4('0x44')][_0xe7e4('0x3d')](_0x17181f)[_0xe7e4('0x30')](handleEntityNotFound(_0x26146f,null))['then'](respondWithResult(_0x26146f,null))[_0xe7e4('0x58')](handleError(_0x26146f,null));};exports[_0xe7e4('0x40')]=function(_0x4cb3f5,_0x4667e7){return db['VoiceExtension']['find']({'where':{'id':_0x4cb3f5[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x4667e7,null))[_0xe7e4('0x30')](removeEntity(_0x4667e7,null))[_0xe7e4('0x58')](handleError(_0x4667e7,null));};exports[_0xe7e4('0x5d')]=function(_0x523c57,_0x440818){if(_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x3c')]===_0xe7e4('0x34')&&!_[_0xe7e4('0x5f')](_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x60')],'_')){_0x523c57['body'][_0xe7e4('0x60')]='_'[_0xe7e4('0x61')](_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x60')]);}return db[_0xe7e4('0x44')][_0xe7e4('0x5d')](_0x523c57[_0xe7e4('0x5e')],{'raw':![]})['then'](function(_0x3736f2){var _0x31f3a9=_0x523c57[_0xe7e4('0x62')][_0xe7e4('0x31')]({'plain':!![]});if(!_0x31f3a9)throw new Error(_0xe7e4('0x63'));if(_0x31f3a9[_0xe7e4('0x64')]==='user'){var _0x117ceb=_0x3736f2[_0xe7e4('0x31')]({'plain':!![]});var _0x520362=[{'name':_0xe7e4('0x32'),'value':'inbound'},{'name':_0xe7e4('0x33'),'value':_0xe7e4('0x34')},{'name':_0xe7e4('0x35'),'value':_0xe7e4('0x36')}];var _0x36e9b7=_[_0xe7e4('0x3d')](_0x520362,[_0xe7e4('0x3a'),_0x117ceb['type']])[_0xe7e4('0x3e')];return db[_0xe7e4('0x65')]['find']({'where':{'name':_0x36e9b7,'userProfileId':_0x31f3a9['userProfileId']},'raw':!![]})['then'](function(_0x4b8c9b){if(_0x4b8c9b&&_0x4b8c9b['autoAssociation']===0x0){return db[_0xe7e4('0x3f')]['create']({'name':_0x117ceb[_0xe7e4('0x3e')],'resourceId':_0x117ceb['id'],'type':_0x4b8c9b['name'],'sectionId':_0x4b8c9b['id']},{})['then'](function(){return _0x3736f2;});}else{return _0x3736f2;}})[_0xe7e4('0x58')](function(_0x24a450){logger[_0xe7e4('0x42')](_0xe7e4('0x66'),_0x24a450);throw _0x24a450;});}return _0x3736f2;})[_0xe7e4('0x30')](respondWithResult(_0x440818,0xc9))[_0xe7e4('0x58')](handleError(_0x440818,null));};exports['update']=function(_0x6331a1,_0x552246){if(_0x6331a1[_0xe7e4('0x5e')]['id']){delete _0x6331a1[_0xe7e4('0x5e')]['id'];}return db['VoiceExtension'][_0xe7e4('0x3d')]({'where':{'id':_0x6331a1[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x552246,null))[_0xe7e4('0x30')](function(_0x240236){if(_0x240236){return db[_0xe7e4('0x44')]['update'](_[_0xe7e4('0x51')](_0x6331a1[_0xe7e4('0x5e')],['exten',_0xe7e4('0x67'),_0xe7e4('0x68'),'recordingFormat','cutdigits',_0xe7e4('0x69')]),{'where':{'context':_0x240236[_0xe7e4('0x67')],'exten':_0x240236[_0xe7e4('0x60')]},'individualHooks':!![]})['then'](function(_0x35f3ff){return _0x35f3ff;});}return null;})[_0xe7e4('0x30')](respondWithStatusCode(_0x552246,null))[_0xe7e4('0x58')](handleError(_0x552246,null));};exports[_0xe7e4('0x6a')]=function(_0x40b50e,_0x45f6dd,_0xf1b0ad){return db[_0xe7e4('0x44')][_0xe7e4('0x6b')]({'where':{'id':_0x40b50e[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x45f6dd,null))['then'](function(_0x280b9e){if(_0x280b9e){return db[_0xe7e4('0x6c')][_0xe7e4('0x6d')](function(_0x90a087){return db[_0xe7e4('0x44')][_0xe7e4('0x40')]({'where':{'VoiceExtensionId':_0x40b50e[_0xe7e4('0x5a')]['id']},'transaction':_0x90a087})['then'](function(_0x2878e3){var _0xf78d75=_[_0xe7e4('0x39')](_0x40b50e[_0xe7e4('0x5e')],function(_0x23ccc7){_0x23ccc7[_0xe7e4('0x6e')]=_0x40b50e['params']['id'];return _0x23ccc7;});return db[_0xe7e4('0x44')]['bulkCreate'](_0xf78d75,{'transaction':_0x90a087});});})[_0xe7e4('0x30')](function(){return db[_0xe7e4('0x44')][_0xe7e4('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x40b50e['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xe7e4('0x30')](respondWithResult(_0x45f6dd,null))[_0xe7e4('0x58')](handleError(_0x45f6dd,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index d92e5ce..b857fd2 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 _0x6a7d=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x26f804,_0x2adcb){var _0x589dff=function(_0x524193){while(--_0x524193){_0x26f804['push'](_0x26f804['shift']());}};_0x589dff(++_0x2adcb);}(_0x6a7d,0x12f));var _0xd6a7=function(_0x105b20,_0x388d13){_0x105b20=_0x105b20-0x0;var _0x357455=_0x6a7d[_0x105b20];return _0x357455;};'use strict';var EventEmitter=require(_0xd6a7('0x0'));var VoiceExtension=require(_0xd6a7('0x1'))['db'][_0xd6a7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6a7('0x3'),'afterUpdate':'update','afterDestroy':_0xd6a7('0x4')};function emitEvent(_0x463738){return function(_0x2c9f12,_0x3ef3e1,_0x31ef02){VoiceExtensionEvents[_0xd6a7('0x5')](_0x463738+':'+_0x2c9f12['id'],_0x2c9f12);VoiceExtensionEvents[_0xd6a7('0x5')](_0x463738,_0x2c9f12);_0x31ef02(null);};}for(var e in events){if(events[_0xd6a7('0x6')](e)){var event=events[e];VoiceExtension[_0xd6a7('0x7')](e,emitEvent(event));}}module[_0xd6a7('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8997=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f34e3,_0x462e36){var _0xe9f307=function(_0x2d3f61){while(--_0x2d3f61){_0x3f34e3['push'](_0x3f34e3['shift']());}};_0xe9f307(++_0x462e36);}(_0x8997,0x18e));var _0x7899=function(_0x1573da,_0x10b4f4){_0x1573da=_0x1573da-0x0;var _0x3bf905=_0x8997[_0x1573da];return _0x3bf905;};'use strict';var EventEmitter=require(_0x7899('0x0'));var VoiceExtension=require(_0x7899('0x1'))['db'][_0x7899('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7899('0x3')](0x0);var events={'afterCreate':_0x7899('0x4'),'afterUpdate':_0x7899('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b5d92){return function(_0x4a897e,_0x156d70,_0x4a3496){VoiceExtensionEvents[_0x7899('0x6')](_0x3b5d92+':'+_0x4a897e['id'],_0x4a897e);VoiceExtensionEvents[_0x7899('0x6')](_0x3b5d92,_0x4a897e);_0x4a3496(null);};}for(var e in events){if(events[_0x7899('0x7')](e)){var event=events[e];VoiceExtension[_0x7899('0x8')](e,emitEvent(event));}}module[_0x7899('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 68bfc2a..6435888 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 _0x71fb=['request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4af1c0,_0x5d38a2){var _0x175d43=function(_0x45a4a1){while(--_0x45a4a1){_0x4af1c0['push'](_0x4af1c0['shift']());}};_0x175d43(++_0x5d38a2);}(_0x71fb,0x6f));var _0xb71f=function(_0xd39472,_0x3e2493){_0xd39472=_0xd39472-0x0;var _0x295cb6=_0x71fb[_0xd39472];return _0x295cb6;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require(_0xb71f('0x2'))(_0xb71f('0x3'));var moment=require(_0xb71f('0x4'));var BPromise=require(_0xb71f('0x5'));var rp=require(_0xb71f('0x6'));var fs=require('fs');var path=require(_0xb71f('0x7'));var rimraf=require(_0xb71f('0x8'));var config=require(_0xb71f('0x9'));var attributes=require(_0xb71f('0xa'));module[_0xb71f('0xb')]=function(_0x25dd68,_0x4a3571){return _0x25dd68['define'](_0xb71f('0xc'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d43=['lodash','util','moment','bluebird','request-promise','path','rimraf','define','VoiceExtension','voice_extensions'];(function(_0x3f1d77,_0x14cf84){var _0x8dc1e5=function(_0x374925){while(--_0x374925){_0x3f1d77['push'](_0x3f1d77['shift']());}};_0x8dc1e5(++_0x14cf84);}(_0x1d43,0x1c2));var _0x31d4=function(_0x5e4360,_0x2b3d33){_0x5e4360=_0x5e4360-0x0;var _0x9cdbf0=_0x1d43[_0x5e4360];return _0x9cdbf0;};'use strict';var _=require(_0x31d4('0x0'));var util=require(_0x31d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31d4('0x2'));var BPromise=require(_0x31d4('0x3'));var rp=require(_0x31d4('0x4'));var fs=require('fs');var path=require(_0x31d4('0x5'));var rimraf=require(_0x31d4('0x6'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x234ead,_0x5be021){return _0x234ead[_0x31d4('0x7')](_0x31d4('0x8'),attributes,{'tableName':_0x31d4('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 209b6bc..e43579e 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 _0x0b9b=['../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','model','include','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3a190a,_0x2ef054){var _0x1a35b5=function(_0x22ce69){while(--_0x22ce69){_0x3a190a['push'](_0x3a190a['shift']());}};_0x1a35b5(++_0x2ef054);}(_0x0b9b,0x186));var _0xb0b9=function(_0x404d68,_0x11bc24){_0x404d68=_0x404d68-0x0;var _0xe1496d=_0x0b9b[_0x404d68];return _0xe1496d;};'use strict';var _=require(_0xb0b9('0x0'));var util=require(_0xb0b9('0x1'));var moment=require(_0xb0b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0b9('0x3'));var fs=require('fs');var Redis=require(_0xb0b9('0x4'));var db=require(_0xb0b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb0b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb0b9('0x7')][_0xb0b9('0x8')]({'port':0x232a});config[_0xb0b9('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb0b9('0xa'))(new Redis(config[_0xb0b9('0x9')]));require(_0xb0b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x2f1198,_0x5c66c3,_0xbe56db){return new BPromise(function(_0x24f37b,_0x360b9a){return client[_0xb0b9('0xc')](_0x2f1198,_0xbe56db)[_0xb0b9('0xd')](function(_0x284ae5){logger[_0xb0b9('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5c66c3,_0xb0b9('0xf'));logger['debug'](_0xb0b9('0x10'),_0x5c66c3,_0xb0b9('0xf'),JSON[_0xb0b9('0x11')](_0x284ae5));if(_0x284ae5[_0xb0b9('0x12')]){if(_0x284ae5['error'][_0xb0b9('0x13')]===0x1f4){logger['error'](_0xb0b9('0x14'),_0x5c66c3,_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);return _0x360b9a(_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);}logger[_0xb0b9('0x12')](_0xb0b9('0x14'),_0x5c66c3,_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);return _0x24f37b(_0x284ae5[_0xb0b9('0x12')][_0xb0b9('0x15')]);}else{logger[_0xb0b9('0xe')](_0xb0b9('0x14'),_0x5c66c3,_0xb0b9('0xf'));_0x24f37b(_0x284ae5[_0xb0b9('0x16')][_0xb0b9('0x15')]);}})[_0xb0b9('0x17')](function(_0x394088){logger[_0xb0b9('0x12')](_0xb0b9('0x14'),_0x5c66c3,_0x394088);_0x360b9a(_0x394088);});});}exports[_0xb0b9('0x18')]=function(_0x4826c9){var _0x3502b4=this;return new Promise(function(_0x4c220e,_0x61a6b){return db[_0xb0b9('0x19')][_0xb0b9('0x1a')]({'raw':_0x4826c9['options']?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1d')]||null:null,'attributes':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9['options'][_0xb0b9('0x1e')]||null:null,'limit':_0x4826c9['options']?_0x4826c9[_0xb0b9('0x1b')][_0xb0b9('0x1f')]||null:null,'include':_0x4826c9[_0xb0b9('0x1b')]?_0x4826c9[_0xb0b9('0x1b')]['include']?_[_0xb0b9('0x20')](_0x4826c9[_0xb0b9('0x1b')]['include'],function(_0x307ba1){return{'model':db[_0x307ba1[_0xb0b9('0x21')]],'as':_0x307ba1['as'],'attributes':_0x307ba1['attributes'],'include':_0x307ba1[_0xb0b9('0x22')]?_[_0xb0b9('0x20')](_0x307ba1[_0xb0b9('0x22')],function(_0xdd5472){return{'model':db[_0xdd5472['model']],'as':_0xdd5472['as'],'attributes':_0xdd5472['attributes'],'include':_0xdd5472[_0xb0b9('0x22')]?_['map'](_0xdd5472[_0xb0b9('0x22')],function(_0x17b461){return{'model':db[_0x17b461[_0xb0b9('0x21')]],'as':_0x17b461['as'],'attributes':_0x17b461['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0b9('0xd')](function(_0x6466cc){logger[_0xb0b9('0xe')](_0xb0b9('0x18'),_0x4826c9);logger[_0xb0b9('0x23')](_0xb0b9('0x18'),_0x4826c9,JSON[_0xb0b9('0x11')](_0x6466cc));_0x4c220e(_0x6466cc);})['catch'](function(_0x1a703e){logger[_0xb0b9('0x12')]('GetVoiceExtension',_0x1a703e['message'],_0x4826c9);_0x61a6b(_0x3502b4[_0xb0b9('0x12')](0x1f4,_0x1a703e[_0xb0b9('0x15')]));});});}; \ No newline at end of file +var _0x9f60=['error','code','message','result','catch','VoiceExtension','options','raw','limit','include','map','model','attributes','then','GetVoiceExtension','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9f60,0x7b));var _0x09f6=function(_0x3f139a,_0x4d3b2f){_0x3f139a=_0x3f139a-0x0;var _0x13afc6=_0x9f60[_0x3f139a];return _0x13afc6;};'use strict';var _=require(_0x09f6('0x0'));var util=require(_0x09f6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09f6('0x2'));var fs=require('fs');var Redis=require(_0x09f6('0x3'));var db=require(_0x09f6('0x4'))['db'];var utils=require(_0x09f6('0x5'));var logger=require(_0x09f6('0x6'))('rpc');var config=require(_0x09f6('0x7'));var jayson=require(_0x09f6('0x8'));var client=jayson[_0x09f6('0x9')][_0x09f6('0xa')]({'port':0x232a});config['redis']=_[_0x09f6('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x09f6('0xc'))(new Redis(config[_0x09f6('0xd')]));require('./voiceExtension.socket')[_0x09f6('0xe')](socket);function respondWithRpcPromise(_0x28658b,_0x22428f,_0x5bfa3f){return new BPromise(function(_0x4ddc3a,_0x5e9ba2){return client['request'](_0x28658b,_0x5bfa3f)['then'](function(_0x275123){logger[_0x09f6('0xf')](_0x09f6('0x10'),_0x22428f,_0x09f6('0x11'));logger[_0x09f6('0x12')](_0x09f6('0x13'),_0x22428f,_0x09f6('0x11'),JSON[_0x09f6('0x14')](_0x275123));if(_0x275123[_0x09f6('0x15')]){if(_0x275123[_0x09f6('0x15')][_0x09f6('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x22428f,_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);return _0x5e9ba2(_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);}logger[_0x09f6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x22428f,_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);return _0x4ddc3a(_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);}else{logger[_0x09f6('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x22428f,'request\x20sent');_0x4ddc3a(_0x275123[_0x09f6('0x18')][_0x09f6('0x17')]);}})[_0x09f6('0x19')](function(_0x339614){logger[_0x09f6('0x15')](_0x09f6('0x10'),_0x22428f,_0x339614);_0x5e9ba2(_0x339614);});});}exports['GetVoiceExtension']=function(_0x53fc2c){var _0x506872=this;return new Promise(function(_0x3589a1,_0x4e63b4){return db[_0x09f6('0x1a')]['findAll']({'raw':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')]['where']||null:null,'attributes':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')]['attributes']||null:null,'limit':_0x53fc2c['options']?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1d')]||null:null,'include':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1e')]?_[_0x09f6('0x1f')](_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1e')],function(_0x20c70c){return{'model':db[_0x20c70c[_0x09f6('0x20')]],'as':_0x20c70c['as'],'attributes':_0x20c70c[_0x09f6('0x21')],'include':_0x20c70c['include']?_['map'](_0x20c70c['include'],function(_0x5e32ed){return{'model':db[_0x5e32ed[_0x09f6('0x20')]],'as':_0x5e32ed['as'],'attributes':_0x5e32ed['attributes'],'include':_0x5e32ed['include']?_[_0x09f6('0x1f')](_0x5e32ed[_0x09f6('0x1e')],function(_0x4f2f2b){return{'model':db[_0x4f2f2b['model']],'as':_0x4f2f2b['as'],'attributes':_0x4f2f2b[_0x09f6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x09f6('0x22')](function(_0x41ea30){logger[_0x09f6('0xf')](_0x09f6('0x23'),_0x53fc2c);logger[_0x09f6('0x12')](_0x09f6('0x23'),_0x53fc2c,JSON[_0x09f6('0x14')](_0x41ea30));_0x3589a1(_0x41ea30);})['catch'](function(_0x3b45ca){logger[_0x09f6('0x15')](_0x09f6('0x23'),_0x3b45ca[_0x09f6('0x17')],_0x53fc2c);_0x4e63b4(_0x506872['error'](0x1f4,_0x3b45ca[_0x09f6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 48db48e..812ff07 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 _0x6974=['removeListener','register','length','./voiceExtension.events','save','update','emit'];(function(_0x97c71f,_0x4896d7){var _0x7eb4bf=function(_0x1531f7){while(--_0x1531f7){_0x97c71f['push'](_0x97c71f['shift']());}};_0x7eb4bf(++_0x4896d7);}(_0x6974,0x145));var _0x4697=function(_0x318c36,_0x5647e9){_0x318c36=_0x318c36-0x0;var _0x4182bd=_0x6974[_0x318c36];return _0x4182bd;};'use strict';var VoiceExtensionEvents=require(_0x4697('0x0'));var events=[_0x4697('0x1'),'remove',_0x4697('0x2')];function createListener(_0x556376,_0x2a7547){return function(_0x236ac2){_0x2a7547[_0x4697('0x3')](_0x556376,_0x236ac2);};}function removeListener(_0x13359d,_0x165885){return function(){VoiceExtensionEvents[_0x4697('0x4')](_0x13359d,_0x165885);};}exports[_0x4697('0x5')]=function(_0x2ff716){for(var _0x42484c=0x0,_0x43d060=events[_0x4697('0x6')];_0x42484c<_0x43d060;_0x42484c++){var _0x460fdb=events[_0x42484c];var _0x3a3f48=createListener('voiceExtension:'+_0x460fdb,_0x2ff716);VoiceExtensionEvents['on'](_0x460fdb,_0x3a3f48);}}; \ No newline at end of file +var _0xd623=['remove','emit','removeListener','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4b6373,_0x11004a){var _0x42a1b0=function(_0x593df9){while(--_0x593df9){_0x4b6373['push'](_0x4b6373['shift']());}};_0x42a1b0(++_0x11004a);}(_0xd623,0x1ef));var _0x3d62=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xd623[_0x36ed48];return _0x51c63a;};'use strict';var VoiceExtensionEvents=require(_0x3d62('0x0'));var events=[_0x3d62('0x1'),_0x3d62('0x2'),'update'];function createListener(_0x2cf6e5,_0x1e3d25){return function(_0x7e6777){_0x1e3d25[_0x3d62('0x3')](_0x2cf6e5,_0x7e6777);};}function removeListener(_0x3a8cbe,_0x414378){return function(){VoiceExtensionEvents[_0x3d62('0x4')](_0x3a8cbe,_0x414378);};}exports['register']=function(_0x3b0cc2){for(var _0x248984=0x0,_0x3ae1ff=events[_0x3d62('0x5')];_0x248984<_0x3ae1ff;_0x248984++){var _0x260ed8=events[_0x248984];var _0x5ecf33=createListener(_0x3d62('0x6')+_0x260ed8,_0x3b0cc2);VoiceExtensionEvents['on'](_0x260ed8,_0x5ecf33);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 989c60b..9cc47e8 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 _0x47d4=['multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','put','update'];(function(_0x3cda08,_0x149a60){var _0x45cd62=function(_0x4d890d){while(--_0x4d890d){_0x3cda08['push'](_0x3cda08['shift']());}};_0x45cd62(++_0x149a60);}(_0x47d4,0x150));var _0x447d=function(_0x11376f,_0x3630aa){_0x11376f=_0x11376f-0x0;var _0x4ec55b=_0x47d4[_0x11376f];return _0x4ec55b;};'use strict';var multer=require(_0x447d('0x0'));var util=require('util');var path=require(_0x447d('0x1'));var timeout=require(_0x447d('0x2'));var express=require('express');var router=express[_0x447d('0x3')]();var auth=require(_0x447d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x447d('0x5'));var controller=require(_0x447d('0x6'));router['get']('/',auth[_0x447d('0x7')](),controller['index']);router[_0x447d('0x8')](_0x447d('0x9'),auth['isAuthenticated'](),controller[_0x447d('0xa')]);router['get'](_0x447d('0xb'),auth[_0x447d('0x7')](),controller[_0x447d('0xc')]);router[_0x447d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x447d('0xe')]('/:id',auth[_0x447d('0x7')](),controller[_0x447d('0xf')]);router['delete']('/:id',auth[_0x447d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1295=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1295,0x123));var _0x5129=function(_0x250783,_0x2e7ff9){_0x250783=_0x250783-0x0;var _0x2d7e03=_0x1295[_0x250783];return _0x2d7e03;};'use strict';var multer=require(_0x5129('0x0'));var util=require('util');var path=require(_0x5129('0x1'));var timeout=require(_0x5129('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5129('0x3'));var config=require(_0x5129('0x4'));var controller=require('./voiceMail.controller');router[_0x5129('0x5')]('/',auth[_0x5129('0x6')](),controller[_0x5129('0x7')]);router[_0x5129('0x5')](_0x5129('0x8'),auth[_0x5129('0x6')](),controller[_0x5129('0x9')]);router['get'](_0x5129('0xa'),auth[_0x5129('0x6')](),controller[_0x5129('0xb')]);router[_0x5129('0xc')]('/',auth[_0x5129('0x6')](),controller[_0x5129('0xd')]);router[_0x5129('0xe')]('/:id',auth[_0x5129('0x6')](),controller[_0x5129('0xf')]);router[_0x5129('0x10')](_0x5129('0x8'),auth[_0x5129('0x6')](),controller[_0x5129('0x11')]);module[_0x5129('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1cc8264..c46654d 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ed=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x3f6598,_0x1a677d){var _0x589cdb=function(_0x55e4e8){while(--_0x55e4e8){_0x3f6598['push'](_0x3f6598['shift']());}};_0x589cdb(++_0x1a677d);}(_0x80ed,0x11c));var _0xd80e=function(_0xe2303a,_0x142c20){_0xe2303a=_0xe2303a-0x0;var _0x3ab386=_0x80ed[_0xe2303a];return _0x3ab386;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd80e('0x3')},'password':{'type':Sequelize[_0xd80e('0x1')]},'fullname':{'type':Sequelize[_0xd80e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x26e6ff){this[_0xd80e('0x4')](_0xd80e('0x5'),typeof _0x26e6ff==='string'&&_0x26e6ff[_0xd80e('0x6')]()?_0x26e6ff[_0xd80e('0x6')]():null);}},'pager':{'type':Sequelize[_0xd80e('0x1')]},'tz':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x7')},'attach':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xd80e('0x1')]},'callback':{'type':Sequelize[_0xd80e('0x1')]},'review':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd80e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'stamp':{'type':_0xd80e('0xa')},'emailsubject':{'type':Sequelize[_0xd80e('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd80e('0xc')],'get':function(){return this[_0xd80e('0xd')]('fullname')+_0xd80e('0xe')+this[_0xd80e('0xd')](_0xd80e('0xf'));}}}; \ No newline at end of file +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x4c97d4,_0x19c6d2){var _0x3be2e1=function(_0x39e521){while(--_0x39e521){_0x4c97d4['push'](_0x4c97d4['shift']());}};_0x3be2e1(++_0x19c6d2);}(_0x13f6,0x124));var _0x613f=function(_0x267280,_0x447862){_0x267280=_0x267280-0x0;var _0x1015ef=_0x13f6[_0x267280];return _0x1015ef;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d241a19..ef071e4 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 _0x8921=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','status','Content-Range','reject','save','then','destroy','get','Voicemails','UserProfileResource','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMessages','findOne','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x8921,0x9a));var _0x1892=function(_0x598da3,_0xd9411f){_0x598da3=_0x598da3-0x0;var _0x5611a1=_0x8921[_0x598da3];return _0x5611a1;};'use strict';var pdf=require(_0x1892('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1892('0x1'));var zipdir=require(_0x1892('0x2'));var jsonpatch=require(_0x1892('0x3'));var rp=require(_0x1892('0x4'));var moment=require(_0x1892('0x5'));var BPromise=require(_0x1892('0x6'));var Mustache=require(_0x1892('0x7'));var util=require(_0x1892('0x8'));var path=require(_0x1892('0x9'));var sox=require(_0x1892('0xa'));var csv=require(_0x1892('0xb'));var ejs=require(_0x1892('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1892('0xd'));var crypto=require(_0x1892('0xe'));var jsforce=require(_0x1892('0xf'));var deskjs=require(_0x1892('0x10'));var toCsv=require(_0x1892('0xb'));var querystring=require(_0x1892('0x11'));var Papa=require('papaparse');var Redis=require(_0x1892('0x12'));var authService=require(_0x1892('0x13'));var qs=require(_0x1892('0x14'));var as=require(_0x1892('0x15'));var hardwareService=require(_0x1892('0x16'));var logger=require(_0x1892('0x17'))(_0x1892('0x18'));var utils=require(_0x1892('0x19'));var config=require(_0x1892('0x1a'));var licenseUtil=require(_0x1892('0x1b'));var db=require(_0x1892('0x1c'))['db'];function respondWithStatusCode(_0x5b8534,_0x9437fc){_0x9437fc=_0x9437fc||0xcc;return function(_0x3eec77){if(_0x3eec77){return _0x5b8534[_0x1892('0x1d')](_0x9437fc);}return _0x5b8534['status'](_0x9437fc)[_0x1892('0x1e')]();};}function respondWithResult(_0xeb57f7,_0xdfdecf){_0xdfdecf=_0xdfdecf||0xc8;return function(_0xf11b26){if(_0xf11b26){return _0xeb57f7['status'](_0xdfdecf)['json'](_0xf11b26);}};}function respondWithFilteredResult(_0x934968,_0x4b15ec){return function(_0x1fafe1){if(_0x1fafe1){var _0x4b3757=_0x1fafe1[_0x1892('0x1f')],_0x10b5f7=_0x4b15ec[_0x1892('0x20')],_0x425251=_0x4b15ec['offset']+_0x4b15ec['limit'],_0x237451;if(_0x425251>=_0x4b3757){_0x425251=_0x4b3757;_0x237451=0xc8;}else{_0x237451=0xce;}_0x934968[_0x1892('0x21')](_0x237451);return _0x934968['set'](_0x1892('0x22'),_0x10b5f7+'-'+_0x425251+'/'+_0x4b3757)['json'](_0x1fafe1);}return null;};}function patchUpdates(_0x11c2e6){return function(_0x148da7){try{jsonpatch['apply'](_0x148da7,_0x11c2e6,!![]);}catch(_0x3191f8){return BPromise[_0x1892('0x23')](_0x3191f8);}return _0x148da7[_0x1892('0x24')]();};}function saveUpdates(_0xf4d237,_0x55b410){return function(_0x53f24c){if(_0x53f24c){return _0x53f24c['update'](_0xf4d237)[_0x1892('0x25')](function(_0x1fd123){return _0x1fd123;});}return null;};}function removeEntity(_0x48ca15,_0xa9a3e0){return function(_0x8fd69a){if(_0x8fd69a){return _0x8fd69a[_0x1892('0x26')]()[_0x1892('0x25')](function(){var _0x53e3bf=_0x8fd69a[_0x1892('0x27')]({'plain':!![]});var _0x3d7da3=_0x1892('0x28');return db[_0x1892('0x29')]['destroy']({'where':{'type':_0x3d7da3,'resourceId':_0x53e3bf['id']}})[_0x1892('0x25')](function(){return _0x8fd69a;});})[_0x1892('0x25')](function(){_0x48ca15[_0x1892('0x21')](0xcc)[_0x1892('0x1e')]();});}};}function handleEntityNotFound(_0x296c45,_0x11275b){return function(_0x8b09dc){if(!_0x8b09dc){_0x296c45[_0x1892('0x1d')](0x194);}return _0x8b09dc;};}function handleError(_0x3b6628,_0x2c3465){_0x2c3465=_0x2c3465||0x1f4;return function(_0x2a40ba){logger['error'](_0x2a40ba[_0x1892('0x2a')]);if(_0x2a40ba[_0x1892('0x2b')]){delete _0x2a40ba['name'];}_0x3b6628[_0x1892('0x21')](_0x2c3465)['send'](_0x2a40ba);};}exports[_0x1892('0x2c')]=function(_0x1ca4db,_0x1ed528){var _0x416794={},_0x823674={},_0x4dd29b={'count':0x0,'rows':[]};var _0x31b022=_[_0x1892('0x2d')](db[_0x1892('0x2e')][_0x1892('0x2f')],function(_0x43e72b){return{'name':_0x43e72b[_0x1892('0x30')],'type':_0x43e72b[_0x1892('0x31')][_0x1892('0x32')]};});_0x823674[_0x1892('0x33')]=_['map'](_0x31b022,'name');_0x823674['query']=_[_0x1892('0x34')](_0x1ca4db[_0x1892('0x35')]);_0x823674['filters']=_['intersection'](_0x823674[_0x1892('0x33')],_0x823674[_0x1892('0x35')]);_0x416794['attributes']=_[_0x1892('0x36')](_0x823674[_0x1892('0x33')],qs[_0x1892('0x37')](_0x1ca4db[_0x1892('0x35')]['fields']));_0x416794[_0x1892('0x38')]=_0x416794[_0x1892('0x38')]['length']?_0x416794[_0x1892('0x38')]:_0x823674['model'];if(!_0x1ca4db['query'][_0x1892('0x39')](_0x1892('0x3a'))){_0x416794['limit']=qs[_0x1892('0x3b')](_0x1ca4db[_0x1892('0x35')][_0x1892('0x3b')]);_0x416794[_0x1892('0x20')]=qs[_0x1892('0x20')](_0x1ca4db[_0x1892('0x35')][_0x1892('0x20')]);}_0x416794[_0x1892('0x3c')]=qs[_0x1892('0x3d')](_0x1ca4db[_0x1892('0x35')]['sort']);_0x416794[_0x1892('0x3e')]=qs[_0x1892('0x3f')](_[_0x1892('0x40')](_0x1ca4db['query'],_0x823674[_0x1892('0x3f')]),_0x31b022);if(_0x1ca4db[_0x1892('0x35')][_0x1892('0x41')]){_0x416794[_0x1892('0x3e')]=_['merge'](_0x416794[_0x1892('0x3e')],{'$or':_[_0x1892('0x2d')](_0x31b022,function(_0x128faf){if(_0x128faf[_0x1892('0x31')]!==_0x1892('0x42')){var _0x83853c={};_0x83853c[_0x128faf[_0x1892('0x2b')]]={'$like':'%'+_0x1ca4db[_0x1892('0x35')][_0x1892('0x41')]+'%'};return _0x83853c;}})});}_0x416794=_[_0x1892('0x43')]({},_0x416794,_0x1ca4db[_0x1892('0x44')]);var _0x5b7dc4={'where':_0x416794[_0x1892('0x3e')]};return db[_0x1892('0x2e')][_0x1892('0x1f')](_0x5b7dc4)[_0x1892('0x25')](function(_0x178b6c){_0x4dd29b[_0x1892('0x1f')]=_0x178b6c;if(_0x1ca4db[_0x1892('0x35')][_0x1892('0x45')]){_0x416794[_0x1892('0x46')]=[{'all':!![]}];}return db[_0x1892('0x2e')][_0x1892('0x47')](_0x416794);})[_0x1892('0x25')](function(_0x4f2646){_0x4dd29b['rows']=_0x4f2646;return _0x4dd29b;})['then'](respondWithFilteredResult(_0x1ed528,_0x416794))['catch'](handleError(_0x1ed528,null));};exports['show']=function(_0x17b833,_0x4c0261){var _0x261040={'raw':!![],'where':{'id':_0x17b833[_0x1892('0x48')]['id']}},_0x554618={};_0x554618[_0x1892('0x33')]=_[_0x1892('0x34')](db[_0x1892('0x2e')][_0x1892('0x2f')]);_0x554618[_0x1892('0x35')]=_[_0x1892('0x34')](_0x17b833[_0x1892('0x35')]);_0x554618[_0x1892('0x3f')]=_[_0x1892('0x36')](_0x554618[_0x1892('0x33')],_0x554618[_0x1892('0x35')]);_0x261040[_0x1892('0x38')]=_['intersection'](_0x554618[_0x1892('0x33')],qs['fields'](_0x17b833['query'][_0x1892('0x37')]));_0x261040['attributes']=_0x261040[_0x1892('0x38')][_0x1892('0x49')]?_0x261040[_0x1892('0x38')]:_0x554618[_0x1892('0x33')];if(_0x17b833['query']['includeAll']){_0x261040[_0x1892('0x46')]=[{'all':!![]}];}_0x261040=_[_0x1892('0x43')]({},_0x261040,_0x17b833['options']);return db[_0x1892('0x2e')]['find'](_0x261040)[_0x1892('0x25')](handleEntityNotFound(_0x4c0261,null))[_0x1892('0x25')](respondWithResult(_0x4c0261,null))[_0x1892('0x4a')](handleError(_0x4c0261,null));};exports[_0x1892('0x4b')]=function(_0x3f9135,_0x5441f1){return db[_0x1892('0x2e')]['create'](_0x3f9135['body'],{})[_0x1892('0x25')](function(_0x137533){var _0x12555f=_0x3f9135[_0x1892('0x4c')][_0x1892('0x27')]({'plain':!![]});if(!_0x12555f)throw new Error(_0x1892('0x4d'));if(_0x12555f[_0x1892('0x4e')]==='user'){var _0x16b5bc=_0x137533[_0x1892('0x27')]({'plain':!![]});var _0x352ce6=_0x1892('0x28');return db[_0x1892('0x4f')][_0x1892('0x50')]({'where':{'name':_0x352ce6,'userProfileId':_0x12555f['userProfileId']},'raw':!![]})[_0x1892('0x25')](function(_0x52fefe){if(_0x52fefe&&_0x52fefe[_0x1892('0x51')]===0x0){return db[_0x1892('0x29')]['create']({'name':_0x16b5bc[_0x1892('0x2b')],'resourceId':_0x16b5bc['id'],'type':_0x52fefe[_0x1892('0x2b')],'sectionId':_0x52fefe['id']},{})['then'](function(){return _0x137533;});}else{return _0x137533;}})[_0x1892('0x4a')](function(_0x87c6c4){logger['error'](_0x1892('0x52'),_0x87c6c4);throw _0x87c6c4;});}return _0x137533;})[_0x1892('0x25')](respondWithResult(_0x5441f1,0xc9))[_0x1892('0x4a')](handleError(_0x5441f1,null));};exports[_0x1892('0x53')]=function(_0x371ab2,_0x20319d){if(_0x371ab2[_0x1892('0x54')]['id']){delete _0x371ab2[_0x1892('0x54')]['id'];}return db['VoiceMail'][_0x1892('0x50')]({'where':{'id':_0x371ab2[_0x1892('0x48')]['id']}})[_0x1892('0x25')](handleEntityNotFound(_0x20319d,null))['then'](saveUpdates(_0x371ab2[_0x1892('0x54')],null))[_0x1892('0x25')](respondWithResult(_0x20319d,null))['catch'](handleError(_0x20319d,null));};exports[_0x1892('0x26')]=function(_0x350df0,_0x4517bb){return db['VoiceMail'][_0x1892('0x50')]({'where':{'id':_0x350df0[_0x1892('0x48')]['id']}})['then'](handleEntityNotFound(_0x4517bb,null))[_0x1892('0x25')](removeEntity(_0x4517bb,null))['catch'](handleError(_0x4517bb,null));};exports[_0x1892('0x55')]=function(_0x2f8112,_0x4a279a,_0x1e56bb){return db['VoiceMail'][_0x1892('0x56')]({'where':{'id':_0x2f8112[_0x1892('0x48')]['id']}})[_0x1892('0x25')](handleEntityNotFound(_0x4a279a,null))[_0x1892('0x25')](function(_0x4af99e){var _0x15ccd8;var _0x3b0c23={},_0x347476={};_0x347476[_0x1892('0x33')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x347476[_0x1892('0x35')]=_[_0x1892('0x34')](_0x2f8112[_0x1892('0x35')]);_0x347476[_0x1892('0x3f')]=_[_0x1892('0x36')](_0x347476[_0x1892('0x33')],_0x347476[_0x1892('0x35')]);_0x3b0c23['attributes']=_[_0x1892('0x36')](_0x347476[_0x1892('0x33')],qs['fields'](_0x2f8112[_0x1892('0x35')][_0x1892('0x37')]));_0x3b0c23[_0x1892('0x38')]=_0x3b0c23[_0x1892('0x38')][_0x1892('0x49')]?_0x3b0c23['attributes']:_0x347476[_0x1892('0x33')];if(!_0x2f8112['query'][_0x1892('0x39')](_0x1892('0x3a'))){_0x3b0c23[_0x1892('0x3b')]=qs[_0x1892('0x3b')](_0x2f8112['query'][_0x1892('0x3b')]);_0x3b0c23[_0x1892('0x20')]=qs[_0x1892('0x20')](_0x2f8112[_0x1892('0x35')][_0x1892('0x20')]);}_0x3b0c23['order']=qs['sort'](_0x2f8112[_0x1892('0x35')][_0x1892('0x3d')]);_0x3b0c23[_0x1892('0x3e')]=qs[_0x1892('0x3f')](_[_0x1892('0x40')](_0x2f8112[_0x1892('0x35')],_0x347476[_0x1892('0x3f')]));if(_0x2f8112['query'][_0x1892('0x41')]){_0x3b0c23['where']=_['merge'](_0x3b0c23['where'],{'$or':_[_0x1892('0x2d')](_0x3b0c23['attributes'],function(_0x47897d){var _0x1c9418={};_0x1c9418[_0x47897d]={'$like':'%'+_0x2f8112[_0x1892('0x35')][_0x1892('0x41')]+'%'};return _0x1c9418;})});}_0x3b0c23[_0x1892('0x3e')]=_[_0x1892('0x43')](_0x3b0c23['where'],{'mailboxuser':_0x4af99e['mailbox']});_0x3b0c23=_[_0x1892('0x43')]({},_0x3b0c23,_0x2f8112[_0x1892('0x44')]);return db['VoiceMailMessage'][_0x1892('0x57')](_0x3b0c23)[_0x1892('0x25')](respondWithFilteredResult(_0x4a279a,_0x3b0c23));})[_0x1892('0x4a')](handleError(_0x4a279a,null));}; \ No newline at end of file +var _0x1f75=['fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','Voicemails','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1f75,0x13c));var _0x51f7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1f75[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x51f7('0x0'));var rimraf=require(_0x51f7('0x1'));var zipdir=require(_0x51f7('0x2'));var jsonpatch=require(_0x51f7('0x3'));var rp=require(_0x51f7('0x4'));var moment=require('moment');var BPromise=require(_0x51f7('0x5'));var Mustache=require(_0x51f7('0x6'));var util=require(_0x51f7('0x7'));var path=require(_0x51f7('0x8'));var sox=require(_0x51f7('0x9'));var csv=require(_0x51f7('0xa'));var ejs=require(_0x51f7('0xb'));var fs=require('fs');var _=require(_0x51f7('0xc'));var squel=require(_0x51f7('0xd'));var crypto=require(_0x51f7('0xe'));var jsforce=require(_0x51f7('0xf'));var deskjs=require(_0x51f7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x51f7('0x11'));var Papa=require(_0x51f7('0x12'));var Redis=require('ioredis');var authService=require(_0x51f7('0x13'));var qs=require(_0x51f7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51f7('0x15'))(_0x51f7('0x16'));var utils=require('../../config/utils');var config=require(_0x51f7('0x17'));var licenseUtil=require(_0x51f7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452c6b,_0x180e9d){_0x180e9d=_0x180e9d||0xcc;return function(_0x11cc37){if(_0x11cc37){return _0x452c6b['sendStatus'](_0x180e9d);}return _0x452c6b['status'](_0x180e9d)[_0x51f7('0x19')]();};}function respondWithResult(_0x29884b,_0x3c4b5a){_0x3c4b5a=_0x3c4b5a||0xc8;return function(_0x3fc869){if(_0x3fc869){return _0x29884b[_0x51f7('0x1a')](_0x3c4b5a)[_0x51f7('0x1b')](_0x3fc869);}};}function respondWithFilteredResult(_0x56f9e3,_0x10aa7f){return function(_0x6e0f2e){if(_0x6e0f2e){var _0x12e09d=_0x6e0f2e[_0x51f7('0x1c')],_0x23998b=_0x10aa7f['offset'],_0x350b32=_0x10aa7f[_0x51f7('0x1d')]+_0x10aa7f[_0x51f7('0x1e')],_0x1b3532;if(_0x350b32>=_0x12e09d){_0x350b32=_0x12e09d;_0x1b3532=0xc8;}else{_0x1b3532=0xce;}_0x56f9e3['status'](_0x1b3532);return _0x56f9e3[_0x51f7('0x1f')](_0x51f7('0x20'),_0x23998b+'-'+_0x350b32+'/'+_0x12e09d)['json'](_0x6e0f2e);}return null;};}function patchUpdates(_0x57b918){return function(_0x564686){try{jsonpatch[_0x51f7('0x21')](_0x564686,_0x57b918,!![]);}catch(_0x5a4e63){return BPromise['reject'](_0x5a4e63);}return _0x564686[_0x51f7('0x22')]();};}function saveUpdates(_0x1decc1,_0x475566){return function(_0x311e00){if(_0x311e00){return _0x311e00[_0x51f7('0x23')](_0x1decc1)[_0x51f7('0x24')](function(_0xb501de){return _0xb501de;});}return null;};}function removeEntity(_0x22f585,_0x4e277e){return function(_0x28566c){if(_0x28566c){return _0x28566c['destroy']()[_0x51f7('0x24')](function(){var _0x38801b=_0x28566c[_0x51f7('0x25')]({'plain':!![]});var _0x1bde25=_0x51f7('0x26');return db[_0x51f7('0x27')][_0x51f7('0x28')]({'where':{'type':_0x1bde25,'resourceId':_0x38801b['id']}})[_0x51f7('0x24')](function(){return _0x28566c;});})[_0x51f7('0x24')](function(){_0x22f585[_0x51f7('0x1a')](0xcc)[_0x51f7('0x19')]();});}};}function handleEntityNotFound(_0x47ed7c,_0xb6aec9){return function(_0x384ca0){if(!_0x384ca0){_0x47ed7c[_0x51f7('0x29')](0x194);}return _0x384ca0;};}function handleError(_0x54bf48,_0x1bcb72){_0x1bcb72=_0x1bcb72||0x1f4;return function(_0x11e723){logger[_0x51f7('0x2a')](_0x11e723[_0x51f7('0x2b')]);if(_0x11e723['name']){delete _0x11e723[_0x51f7('0x2c')];}_0x54bf48[_0x51f7('0x1a')](_0x1bcb72)[_0x51f7('0x2d')](_0x11e723);};}exports[_0x51f7('0x2e')]=function(_0xf70aa2,_0x4bced1){var _0x31cf1f={},_0x32056c={},_0x31b26e={'count':0x0,'rows':[]};var _0x56b181=_[_0x51f7('0x2f')](db['VoiceMail']['rawAttributes'],function(_0x12a9ce){return{'name':_0x12a9ce[_0x51f7('0x30')],'type':_0x12a9ce[_0x51f7('0x31')][_0x51f7('0x32')]};});_0x32056c[_0x51f7('0x33')]=_[_0x51f7('0x2f')](_0x56b181,_0x51f7('0x2c'));_0x32056c['query']=_['keys'](_0xf70aa2[_0x51f7('0x34')]);_0x32056c[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x32056c[_0x51f7('0x33')],_0x32056c[_0x51f7('0x34')]);_0x31cf1f[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x32056c[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0xf70aa2['query'][_0x51f7('0x38')]));_0x31cf1f['attributes']=_0x31cf1f[_0x51f7('0x37')]['length']?_0x31cf1f[_0x51f7('0x37')]:_0x32056c['model'];if(!_0xf70aa2[_0x51f7('0x34')]['hasOwnProperty'](_0x51f7('0x39'))){_0x31cf1f[_0x51f7('0x1e')]=qs[_0x51f7('0x1e')](_0xf70aa2['query'][_0x51f7('0x1e')]);_0x31cf1f[_0x51f7('0x1d')]=qs['offset'](_0xf70aa2['query']['offset']);}_0x31cf1f[_0x51f7('0x3a')]=qs[_0x51f7('0x3b')](_0xf70aa2[_0x51f7('0x34')]['sort']);_0x31cf1f[_0x51f7('0x3c')]=qs[_0x51f7('0x35')](_[_0x51f7('0x3d')](_0xf70aa2['query'],_0x32056c[_0x51f7('0x35')]),_0x56b181);if(_0xf70aa2[_0x51f7('0x34')][_0x51f7('0x3e')]){_0x31cf1f['where']=_[_0x51f7('0x3f')](_0x31cf1f[_0x51f7('0x3c')],{'$or':_[_0x51f7('0x2f')](_0x56b181,function(_0x48ba5b){if(_0x48ba5b[_0x51f7('0x31')]!==_0x51f7('0x40')){var _0x9ba482={};_0x9ba482[_0x48ba5b[_0x51f7('0x2c')]]={'$like':'%'+_0xf70aa2[_0x51f7('0x34')]['filter']+'%'};return _0x9ba482;}})});}_0x31cf1f=_[_0x51f7('0x3f')]({},_0x31cf1f,_0xf70aa2[_0x51f7('0x41')]);var _0xd30b96={'where':_0x31cf1f[_0x51f7('0x3c')]};return db['VoiceMail'][_0x51f7('0x1c')](_0xd30b96)['then'](function(_0x11f94c){_0x31b26e[_0x51f7('0x1c')]=_0x11f94c;if(_0xf70aa2[_0x51f7('0x34')][_0x51f7('0x42')]){_0x31cf1f[_0x51f7('0x43')]=[{'all':!![]}];}return db[_0x51f7('0x44')][_0x51f7('0x45')](_0x31cf1f);})[_0x51f7('0x24')](function(_0x4099f0){_0x31b26e[_0x51f7('0x46')]=_0x4099f0;return _0x31b26e;})[_0x51f7('0x24')](respondWithFilteredResult(_0x4bced1,_0x31cf1f))[_0x51f7('0x47')](handleError(_0x4bced1,null));};exports[_0x51f7('0x48')]=function(_0x52d6fb,_0x53ba21){var _0xe474f7={'raw':!![],'where':{'id':_0x52d6fb['params']['id']}},_0x3b8215={};_0x3b8215['model']=_[_0x51f7('0x49')](db[_0x51f7('0x44')][_0x51f7('0x4a')]);_0x3b8215['query']=_[_0x51f7('0x49')](_0x52d6fb[_0x51f7('0x34')]);_0x3b8215[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x3b8215['model'],_0x3b8215[_0x51f7('0x34')]);_0xe474f7[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x3b8215[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0x52d6fb[_0x51f7('0x34')][_0x51f7('0x38')]));_0xe474f7[_0x51f7('0x37')]=_0xe474f7['attributes'][_0x51f7('0x4b')]?_0xe474f7['attributes']:_0x3b8215[_0x51f7('0x33')];if(_0x52d6fb[_0x51f7('0x34')][_0x51f7('0x42')]){_0xe474f7[_0x51f7('0x43')]=[{'all':!![]}];}_0xe474f7=_[_0x51f7('0x3f')]({},_0xe474f7,_0x52d6fb[_0x51f7('0x41')]);return db[_0x51f7('0x44')][_0x51f7('0x4c')](_0xe474f7)['then'](handleEntityNotFound(_0x53ba21,null))[_0x51f7('0x24')](respondWithResult(_0x53ba21,null))['catch'](handleError(_0x53ba21,null));};exports[_0x51f7('0x4d')]=function(_0x5655c0,_0x20a2ae){return db['VoiceMail'][_0x51f7('0x4d')](_0x5655c0[_0x51f7('0x4e')],{})[_0x51f7('0x24')](function(_0x501cb8){var _0x5c0207=_0x5655c0[_0x51f7('0x4f')][_0x51f7('0x25')]({'plain':!![]});if(!_0x5c0207)throw new Error(_0x51f7('0x50'));if(_0x5c0207[_0x51f7('0x51')]===_0x51f7('0x4f')){var _0x3c6f9f=_0x501cb8[_0x51f7('0x25')]({'plain':!![]});var _0x416ac=_0x51f7('0x26');return db[_0x51f7('0x52')][_0x51f7('0x4c')]({'where':{'name':_0x416ac,'userProfileId':_0x5c0207[_0x51f7('0x53')]},'raw':!![]})['then'](function(_0x2a66ba){if(_0x2a66ba&&_0x2a66ba[_0x51f7('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c6f9f[_0x51f7('0x2c')],'resourceId':_0x3c6f9f['id'],'type':_0x2a66ba['name'],'sectionId':_0x2a66ba['id']},{})[_0x51f7('0x24')](function(){return _0x501cb8;});}else{return _0x501cb8;}})[_0x51f7('0x47')](function(_0x3d2984){logger['error'](_0x51f7('0x55'),_0x3d2984);throw _0x3d2984;});}return _0x501cb8;})['then'](respondWithResult(_0x20a2ae,0xc9))[_0x51f7('0x47')](handleError(_0x20a2ae,null));};exports[_0x51f7('0x23')]=function(_0x1eadbc,_0x80beab){if(_0x1eadbc[_0x51f7('0x4e')]['id']){delete _0x1eadbc['body']['id'];}return db[_0x51f7('0x44')][_0x51f7('0x4c')]({'where':{'id':_0x1eadbc[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0x80beab,null))[_0x51f7('0x24')](saveUpdates(_0x1eadbc[_0x51f7('0x4e')],null))['then'](respondWithResult(_0x80beab,null))[_0x51f7('0x47')](handleError(_0x80beab,null));};exports['destroy']=function(_0x1ed831,_0x2e2816){return db['VoiceMail'][_0x51f7('0x4c')]({'where':{'id':_0x1ed831[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0x2e2816,null))['then'](removeEntity(_0x2e2816,null))[_0x51f7('0x47')](handleError(_0x2e2816,null));};exports['getMessages']=function(_0x127364,_0xf5f54f,_0x14d71c){return db[_0x51f7('0x44')][_0x51f7('0x57')]({'where':{'id':_0x127364[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0xf5f54f,null))[_0x51f7('0x24')](function(_0x5113d3){var _0x124415;var _0x23f751={},_0x3cceea={};_0x3cceea[_0x51f7('0x33')]=_[_0x51f7('0x49')](db[_0x51f7('0x58')][_0x51f7('0x4a')]);_0x3cceea['query']=_[_0x51f7('0x49')](_0x127364[_0x51f7('0x34')]);_0x3cceea[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x3cceea[_0x51f7('0x33')],_0x3cceea[_0x51f7('0x34')]);_0x23f751[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x3cceea[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0x127364[_0x51f7('0x34')][_0x51f7('0x38')]));_0x23f751[_0x51f7('0x37')]=_0x23f751[_0x51f7('0x37')]['length']?_0x23f751['attributes']:_0x3cceea[_0x51f7('0x33')];if(!_0x127364['query'][_0x51f7('0x59')](_0x51f7('0x39'))){_0x23f751[_0x51f7('0x1e')]=qs['limit'](_0x127364[_0x51f7('0x34')]['limit']);_0x23f751[_0x51f7('0x1d')]=qs[_0x51f7('0x1d')](_0x127364[_0x51f7('0x34')][_0x51f7('0x1d')]);}_0x23f751[_0x51f7('0x3a')]=qs[_0x51f7('0x3b')](_0x127364[_0x51f7('0x34')][_0x51f7('0x3b')]);_0x23f751['where']=qs[_0x51f7('0x35')](_[_0x51f7('0x3d')](_0x127364[_0x51f7('0x34')],_0x3cceea[_0x51f7('0x35')]));if(_0x127364[_0x51f7('0x34')]['filter']){_0x23f751['where']=_['merge'](_0x23f751[_0x51f7('0x3c')],{'$or':_[_0x51f7('0x2f')](_0x23f751['attributes'],function(_0xe5988d){var _0xcfabd6={};_0xcfabd6[_0xe5988d]={'$like':'%'+_0x127364[_0x51f7('0x34')][_0x51f7('0x3e')]+'%'};return _0xcfabd6;})});}_0x23f751[_0x51f7('0x3c')]=_[_0x51f7('0x3f')](_0x23f751[_0x51f7('0x3c')],{'mailboxuser':_0x5113d3['mailbox']});_0x23f751=_[_0x51f7('0x3f')]({},_0x23f751,_0x127364[_0x51f7('0x41')]);return db[_0x51f7('0x58')][_0x51f7('0x5a')](_0x23f751)['then'](respondWithFilteredResult(_0xf5f54f,_0x23f751));})[_0x51f7('0x47')](handleError(_0xf5f54f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3714bf3..5afacb9 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 _0xb366=['../../config/logger','api','bluebird','request-promise','path','exports','define','mailbox_context','mailbox','context','lodash'];(function(_0x2df0a4,_0x2613ba){var _0x4b3409=function(_0x1c067d){while(--_0x1c067d){_0x2df0a4['push'](_0x2df0a4['shift']());}};_0x4b3409(++_0x2613ba);}(_0xb366,0xa4));var _0x6b36=function(_0x4c8b00,_0x16c38a){_0x4c8b00=_0x4c8b00-0x0;var _0x406a86=_0xb366[_0x4c8b00];return _0x406a86;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var logger=require(_0x6b36('0x1'))(_0x6b36('0x2'));var moment=require('moment');var BPromise=require(_0x6b36('0x3'));var rp=require(_0x6b36('0x4'));var fs=require('fs');var path=require(_0x6b36('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x6b36('0x6')]=function(_0x2c7a78,_0x485e85){return _0x2c7a78[_0x6b36('0x7')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6b36('0x8'),'fields':[_0x6b36('0x9'),_0x6b36('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55c3=['mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x2b5423,_0x24db35){var _0x334056=function(_0x4647e9){while(--_0x4647e9){_0x2b5423['push'](_0x2b5423['shift']());}};_0x334056(++_0x24db35);}(_0x55c3,0x189));var _0x355c=function(_0x24109b,_0x338f16){_0x24109b=_0x24109b-0x0;var _0x23aca4=_0x55c3[_0x24109b];return _0x23aca4;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var logger=require(_0x355c('0x1'))(_0x355c('0x2'));var moment=require(_0x355c('0x3'));var BPromise=require(_0x355c('0x4'));var rp=require(_0x355c('0x5'));var fs=require('fs');var path=require(_0x355c('0x6'));var rimraf=require(_0x355c('0x7'));var config=require(_0x355c('0x8'));var attributes=require(_0x355c('0x9'));module[_0x355c('0xa')]=function(_0x19c4e4,_0x8570ef){return _0x19c4e4[_0x355c('0xb')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x355c('0xc'),'fields':[_0x355c('0xd'),_0x355c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 89a9685..b5bd29b 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 _0xb34c=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb34c,0xf2));var _0xcb34=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb34c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xcb34('0x0'));var moment=require(_0xcb34('0x1'));var BPromise=require(_0xcb34('0x2'));var rs=require(_0xcb34('0x3'));var fs=require('fs');var Redis=require(_0xcb34('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb34('0x5'))(_0xcb34('0x6'));var config=require(_0xcb34('0x7'));var jayson=require(_0xcb34('0x8'));var client=jayson[_0xcb34('0x9')][_0xcb34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x882202,_0x2e07ff,_0x13b7cf){return new BPromise(function(_0x4cc4b3,_0x33ff3c){return client['request'](_0x882202,_0x13b7cf)[_0xcb34('0xb')](function(_0x4f923f){logger['info'](_0xcb34('0xc'),_0x2e07ff,_0xcb34('0xd'));logger[_0xcb34('0xe')](_0xcb34('0xf'),_0x2e07ff,_0xcb34('0xd'),JSON['stringify'](_0x4f923f));if(_0x4f923f['error']){if(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x11')]===0x1f4){logger[_0xcb34('0x10')](_0xcb34('0xc'),_0x2e07ff,_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);return _0x33ff3c(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x2e07ff,_0x4f923f['error'][_0xcb34('0x12')]);return _0x4cc4b3(_0x4f923f[_0xcb34('0x10')][_0xcb34('0x12')]);}else{logger[_0xcb34('0x13')](_0xcb34('0xc'),_0x2e07ff,'request\x20sent');_0x4cc4b3(_0x4f923f[_0xcb34('0x14')][_0xcb34('0x12')]);}})[_0xcb34('0x15')](function(_0x52237a){logger[_0xcb34('0x10')](_0xcb34('0xc'),_0x2e07ff,_0x52237a);_0x33ff3c(_0x52237a);});});} \ No newline at end of file +var _0x6403=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceMail,\x20%s,\x20%s','message','info'];(function(_0x1cdfe3,_0x2fabf2){var _0x3de796=function(_0x32283d){while(--_0x32283d){_0x1cdfe3['push'](_0x1cdfe3['shift']());}};_0x3de796(++_0x2fabf2);}(_0x6403,0x112));var _0x3640=function(_0x24fc3d,_0x1b10d0){_0x24fc3d=_0x24fc3d-0x0;var _0x144024=_0x6403[_0x24fc3d];return _0x144024;};'use strict';var _=require(_0x3640('0x0'));var util=require(_0x3640('0x1'));var moment=require(_0x3640('0x2'));var BPromise=require(_0x3640('0x3'));var rs=require(_0x3640('0x4'));var fs=require('fs');var Redis=require(_0x3640('0x5'));var db=require(_0x3640('0x6'))['db'];var utils=require(_0x3640('0x7'));var logger=require(_0x3640('0x8'))('rpc');var config=require(_0x3640('0x9'));var jayson=require(_0x3640('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x544e41,_0x28f20b,_0x3baf90){return new BPromise(function(_0x4057af,_0x20ab0e){return client[_0x3640('0xb')](_0x544e41,_0x3baf90)['then'](function(_0x2a4039){logger['info']('VoiceMail,\x20%s,\x20%s',_0x28f20b,'request\x20sent');logger[_0x3640('0xc')](_0x3640('0xd'),_0x28f20b,_0x3640('0xe'),JSON[_0x3640('0xf')](_0x2a4039));if(_0x2a4039['error']){if(_0x2a4039[_0x3640('0x10')]['code']===0x1f4){logger[_0x3640('0x10')](_0x3640('0x11'),_0x28f20b,_0x2a4039[_0x3640('0x10')]['message']);return _0x20ab0e(_0x2a4039[_0x3640('0x10')][_0x3640('0x12')]);}logger[_0x3640('0x10')]('VoiceMail,\x20%s,\x20%s',_0x28f20b,_0x2a4039['error']['message']);return _0x4057af(_0x2a4039[_0x3640('0x10')][_0x3640('0x12')]);}else{logger[_0x3640('0x13')]('VoiceMail,\x20%s,\x20%s',_0x28f20b,_0x3640('0xe'));_0x4057af(_0x2a4039[_0x3640('0x14')]['message']);}})['catch'](function(_0x202d5d){logger[_0x3640('0x10')](_0x3640('0x11'),_0x28f20b,_0x202d5d);_0x20ab0e(_0x202d5d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a654dd9..a4b0af9 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 _0x7217=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b041c,_0x57e834){var _0x1f2519=function(_0x12ac7e){while(--_0x12ac7e){_0x1b041c['push'](_0x1b041c['shift']());}};_0x1f2519(++_0x57e834);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'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('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file +var _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x45a4e0,_0x345f4d){var _0x43f49d=function(_0x564c57){while(--_0x564c57){_0x45a4e0['push'](_0x45a4e0['shift']());}};_0x43f49d(++_0x345f4d);}(_0x4819,0xcd));var _0x9481=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x4819[_0xa8883];return _0x479426;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('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 c0d5686..ec54d7b 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 _0x8366=['getDataValue','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0xd47bfa,_0x547ff3){var _0x539439=function(_0x4e04b2){while(--_0x4e04b2){_0xd47bfa['push'](_0xd47bfa['shift']());}};_0x539439(++_0x547ff3);}(_0x8366,0x18c));var _0x6836=function(_0x2a9fb6,_0x2af06c){_0x2a9fb6=_0x2a9fb6-0x0;var _0x209a2b=_0x8366[_0x2a9fb6];return _0x209a2b;};'use strict';var Sequelize=require(_0x6836('0x0'));module[_0x6836('0x1')]={'name':{'type':Sequelize[_0x6836('0x2')],'get':function(_0x24c24d){return this[_0x6836('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x6836('0x5')](_0x6836('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6836('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x90b9=['sequelize','exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP'];(function(_0x401e4a,_0x1bfada){var _0x7dfdc1=function(_0x488705){while(--_0x488705){_0x401e4a['push'](_0x401e4a['shift']());}};_0x7dfdc1(++_0x1bfada);}(_0x90b9,0xd9));var _0x990b=function(_0x3356c6,_0x27cb3b){_0x3356c6=_0x3356c6-0x0;var _0x2a2976=_0x90b9[_0x3356c6];return _0x2a2976;};'use strict';var Sequelize=require(_0x990b('0x0'));module[_0x990b('0x1')]={'name':{'type':Sequelize[_0x990b('0x2')],'get':function(_0x441232){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x990b('0x4')](_0x990b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x990b('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 5b142d2..38ed996 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 _0x34d4=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','intersection','find','create','catch','body','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4cf8ff,_0x37e13d){var _0x4a19cf=function(_0x49b2fc){while(--_0x49b2fc){_0x4cf8ff['push'](_0x4cf8ff['shift']());}};_0x4a19cf(++_0x37e13d);}(_0x34d4,0x1e7));var _0x434d=function(_0x248685,_0x380e40){_0x248685=_0x248685-0x0;var _0xa5d9cf=_0x34d4[_0x248685];return _0xa5d9cf;};'use strict';var pdf=require(_0x434d('0x0'));var emlformat=require(_0x434d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x434d('0x2'));var jsonpatch=require(_0x434d('0x3'));var rp=require(_0x434d('0x4'));var moment=require(_0x434d('0x5'));var BPromise=require(_0x434d('0x6'));var Mustache=require(_0x434d('0x7'));var util=require(_0x434d('0x8'));var path=require(_0x434d('0x9'));var sox=require(_0x434d('0xa'));var csv=require(_0x434d('0xb'));var ejs=require(_0x434d('0xc'));var fs=require('fs');var _=require(_0x434d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x434d('0xe'));var deskjs=require(_0x434d('0xf'));var toCsv=require(_0x434d('0xb'));var querystring=require('querystring');var Papa=require(_0x434d('0x10'));var Redis=require(_0x434d('0x11'));var authService=require(_0x434d('0x12'));var qs=require(_0x434d('0x13'));var as=require(_0x434d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x434d('0x15'))('api');var utils=require(_0x434d('0x16'));var config=require(_0x434d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x434d('0x18'))['db'];function respondWithStatusCode(_0x650e96,_0x565316){_0x565316=_0x565316||0xcc;return function(_0x256f45){if(_0x256f45){return _0x650e96[_0x434d('0x19')](_0x565316);}return _0x650e96['status'](_0x565316)['end']();};}function respondWithResult(_0x363042,_0x175b8e){_0x175b8e=_0x175b8e||0xc8;return function(_0x1ae8ff){if(_0x1ae8ff){return _0x363042[_0x434d('0x1a')](_0x175b8e)[_0x434d('0x1b')](_0x1ae8ff);}};}function respondWithFilteredResult(_0x189f6a,_0x1b3ad1){return function(_0x3da83b){if(_0x3da83b){var _0x1096f3=_0x3da83b[_0x434d('0x1c')],_0x36344b=_0x1b3ad1['offset'],_0x3d4a6a=_0x1b3ad1[_0x434d('0x1d')]+_0x1b3ad1[_0x434d('0x1e')],_0x59e96c;if(_0x3d4a6a>=_0x1096f3){_0x3d4a6a=_0x1096f3;_0x59e96c=0xc8;}else{_0x59e96c=0xce;}_0x189f6a[_0x434d('0x1a')](_0x59e96c);return _0x189f6a['set'](_0x434d('0x1f'),_0x36344b+'-'+_0x3d4a6a+'/'+_0x1096f3)[_0x434d('0x1b')](_0x3da83b);}return null;};}function patchUpdates(_0x3a2ae1){return function(_0x1bcfb0){try{jsonpatch[_0x434d('0x20')](_0x1bcfb0,_0x3a2ae1,!![]);}catch(_0x4b7f4b){return BPromise['reject'](_0x4b7f4b);}return _0x1bcfb0[_0x434d('0x21')]();};}function saveUpdates(_0x10e736,_0x18cfb4){return function(_0x3e3000){if(_0x3e3000){return _0x3e3000[_0x434d('0x22')](_0x10e736)[_0x434d('0x23')](function(_0x3b84a7){return _0x3b84a7;});}return null;};}function removeEntity(_0x4a3d35,_0x80e422){return function(_0x260e93){if(_0x260e93){return _0x260e93[_0x434d('0x24')]()[_0x434d('0x23')](function(){_0x4a3d35[_0x434d('0x1a')](0xcc)[_0x434d('0x25')]();});}};}function handleEntityNotFound(_0x5da22e,_0x23b000){return function(_0x32bf3c){if(!_0x32bf3c){_0x5da22e[_0x434d('0x19')](0x194);}return _0x32bf3c;};}function handleError(_0x4299dd,_0x458686){_0x458686=_0x458686||0x1f4;return function(_0x3f173b){logger[_0x434d('0x26')](_0x3f173b[_0x434d('0x27')]);if(_0x3f173b[_0x434d('0x28')]){delete _0x3f173b['name'];}_0x4299dd[_0x434d('0x1a')](_0x458686)[_0x434d('0x29')](_0x3f173b);};}exports['index']=function(_0x351813,_0x383dee){var _0x451d40={},_0x2b2f86={},_0x5b096e={'count':0x0,'rows':[]};var _0x5e9f9b=_[_0x434d('0x2a')](db[_0x434d('0x2b')][_0x434d('0x2c')],function(_0x31c950){return{'name':_0x31c950[_0x434d('0x2d')],'type':_0x31c950['type'][_0x434d('0x2e')]};});_0x2b2f86[_0x434d('0x2f')]=_['differenceBy'](_[_0x434d('0x2a')](_0x5e9f9b,_0x434d('0x28')),[_0x434d('0x28')]);_0x2b2f86[_0x434d('0x30')]=_['keys'](_0x351813[_0x434d('0x30')]);_0x2b2f86[_0x434d('0x31')]=_['intersection'](_0x2b2f86[_0x434d('0x2f')],_0x2b2f86[_0x434d('0x30')]);_0x451d40[_0x434d('0x32')]=_['intersection'](_0x2b2f86[_0x434d('0x2f')],qs[_0x434d('0x33')](_0x351813[_0x434d('0x30')]['fields']));_0x451d40[_0x434d('0x32')]=_0x451d40[_0x434d('0x32')][_0x434d('0x34')]?_0x451d40[_0x434d('0x32')]:_0x2b2f86[_0x434d('0x2f')];if(!_0x351813[_0x434d('0x30')]['hasOwnProperty']('nolimit')){_0x451d40[_0x434d('0x1e')]=qs[_0x434d('0x1e')](_0x351813[_0x434d('0x30')][_0x434d('0x1e')]);_0x451d40['offset']=qs[_0x434d('0x1d')](_0x351813['query']['offset']);}_0x451d40[_0x434d('0x35')]=qs[_0x434d('0x36')](_0x351813[_0x434d('0x30')][_0x434d('0x36')]);_0x451d40['where']=qs['filters'](_[_0x434d('0x37')](_0x351813[_0x434d('0x30')],_0x2b2f86[_0x434d('0x31')]),_0x5e9f9b);if(_0x351813['query']['filter']){_0x451d40[_0x434d('0x38')]=_[_0x434d('0x39')](_0x451d40[_0x434d('0x38')],{'$or':_[_0x434d('0x2a')](_0x5e9f9b,function(_0x188e8f){if(_0x188e8f[_0x434d('0x3a')]!==_0x434d('0x3b')){var _0x16b4bf={};_0x16b4bf[_0x188e8f[_0x434d('0x28')]]={'$like':'%'+_0x351813[_0x434d('0x30')]['filter']+'%'};return _0x16b4bf;}})});}_0x451d40=_[_0x434d('0x39')]({},_0x451d40,_0x351813[_0x434d('0x3c')]);var _0x2786a2={'where':_0x451d40['where']};return db[_0x434d('0x2b')][_0x434d('0x1c')](_0x2786a2)[_0x434d('0x23')](function(_0x459689){_0x5b096e[_0x434d('0x1c')]=_0x459689;if(_0x351813['query'][_0x434d('0x3d')]){_0x451d40[_0x434d('0x3e')]=[{'all':!![]}];}return db[_0x434d('0x2b')][_0x434d('0x3f')](_0x451d40);})[_0x434d('0x23')](function(_0x429eea){_0x5b096e['rows']=_0x429eea;return _0x5b096e;})[_0x434d('0x23')](respondWithFilteredResult(_0x383dee,_0x451d40))['catch'](handleError(_0x383dee,null));};exports[_0x434d('0x40')]=function(_0x4140a9,_0x5dee14){var _0x40ec13={'raw':!![],'where':{'id':_0x4140a9[_0x434d('0x41')]['id']}},_0x1e623c={};_0x1e623c[_0x434d('0x2f')]=_[_0x434d('0x42')](db[_0x434d('0x2b')]['rawAttributes']);_0x1e623c[_0x434d('0x30')]=_[_0x434d('0x42')](_0x4140a9[_0x434d('0x30')]);_0x1e623c['filters']=_[_0x434d('0x43')](_0x1e623c[_0x434d('0x2f')],_0x1e623c[_0x434d('0x30')]);_0x40ec13['attributes']=_[_0x434d('0x43')](_0x1e623c[_0x434d('0x2f')],qs[_0x434d('0x33')](_0x4140a9['query'][_0x434d('0x33')]));_0x40ec13['attributes']=_0x40ec13[_0x434d('0x32')][_0x434d('0x34')]?_0x40ec13[_0x434d('0x32')]:_0x1e623c[_0x434d('0x2f')];if(_0x4140a9[_0x434d('0x30')][_0x434d('0x3d')]){_0x40ec13['include']=[{'all':!![]}];}_0x40ec13=_['merge']({},_0x40ec13,_0x4140a9[_0x434d('0x3c')]);return db['VoiceMailMessage'][_0x434d('0x44')](_0x40ec13)[_0x434d('0x23')](handleEntityNotFound(_0x5dee14,null))['then'](respondWithResult(_0x5dee14,null))['catch'](handleError(_0x5dee14,null));};exports[_0x434d('0x45')]=function(_0x5863b7,_0x11999d){return db[_0x434d('0x2b')][_0x434d('0x45')](_0x5863b7['body'],{})['then'](respondWithResult(_0x11999d,0xc9))[_0x434d('0x46')](handleError(_0x11999d,null));};exports[_0x434d('0x22')]=function(_0x3c097d,_0x271841){if(_0x3c097d[_0x434d('0x47')]['id']){delete _0x3c097d[_0x434d('0x47')]['id'];}return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0x3c097d['params']['id']}})[_0x434d('0x23')](handleEntityNotFound(_0x271841,null))[_0x434d('0x23')](saveUpdates(_0x3c097d[_0x434d('0x47')],null))[_0x434d('0x23')](respondWithResult(_0x271841,null))[_0x434d('0x46')](handleError(_0x271841,null));};exports['destroy']=function(_0x19babe,_0x5c80e0){return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0x19babe[_0x434d('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c80e0,null))[_0x434d('0x23')](removeEntity(_0x5c80e0,null))[_0x434d('0x46')](handleError(_0x5c80e0,null));};exports['download']=function(_0xbc50ea,_0x54ad12,_0x50943d){return db[_0x434d('0x2b')][_0x434d('0x44')]({'where':{'id':_0xbc50ea['params']['id']},'attributes':['id',_0x434d('0x48'),_0x434d('0x49')]})['then'](handleEntityNotFound(_0x54ad12,null))['then'](function(_0x15c689){if(_0x15c689){if(!_0x15c689[_0x434d('0x48')]){throw new db[(_0x434d('0x4a'))]['ValidationError'](_0x434d('0x4b'));}var _0x417176={'Content-Type':_0x434d('0x4c'),'Content-Disposition':_0x434d('0x4d')};if(_0x15c689[_0x434d('0x49')]){_0x417176[_0x434d('0x4e')]=_0x434d('0x4f')+_0x15c689[_0x434d('0x49')]+_0x434d('0x50');}_0x54ad12[_0x434d('0x51')](_0x417176);return _0x54ad12[_0x434d('0x29')](new Buffer(_0x15c689[_0x434d('0x48')]));}})[_0x434d('0x46')](handleError(_0x54ad12,null));}; \ No newline at end of file +var _0x0afd=['status','count','offset','set','Content-Range','apply','save','update','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','then','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','html-pdf','eml-format','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0afd,0x1df));var _0xd0af=function(_0x28bd5e,_0xe90421){_0x28bd5e=_0x28bd5e-0x0;var _0x479fb9=_0x0afd[_0x28bd5e];return _0x479fb9;};'use strict';var pdf=require(_0xd0af('0x0'));var emlformat=require(_0xd0af('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd0af('0x2'));var BPromise=require(_0xd0af('0x3'));var Mustache=require(_0xd0af('0x4'));var util=require(_0xd0af('0x5'));var path=require(_0xd0af('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0af('0x7'));var fs=require('fs');var _=require(_0xd0af('0x8'));var squel=require(_0xd0af('0x9'));var crypto=require('crypto');var jsforce=require(_0xd0af('0xa'));var deskjs=require(_0xd0af('0xb'));var toCsv=require(_0xd0af('0xc'));var querystring=require(_0xd0af('0xd'));var Papa=require(_0xd0af('0xe'));var Redis=require('ioredis');var authService=require(_0xd0af('0xf'));var qs=require(_0xd0af('0x10'));var as=require(_0xd0af('0x11'));var hardwareService=require(_0xd0af('0x12'));var logger=require(_0xd0af('0x13'))(_0xd0af('0x14'));var utils=require('../../config/utils');var config=require(_0xd0af('0x15'));var licenseUtil=require(_0xd0af('0x16'));var db=require(_0xd0af('0x17'))['db'];function respondWithStatusCode(_0x38f9a4,_0x472e63){_0x472e63=_0x472e63||0xcc;return function(_0x53044b){if(_0x53044b){return _0x38f9a4[_0xd0af('0x18')](_0x472e63);}return _0x38f9a4[_0xd0af('0x19')](_0x472e63)['end']();};}function respondWithResult(_0x2ccf85,_0x9d5098){_0x9d5098=_0x9d5098||0xc8;return function(_0x20f7e2){if(_0x20f7e2){return _0x2ccf85[_0xd0af('0x19')](_0x9d5098)['json'](_0x20f7e2);}};}function respondWithFilteredResult(_0x541833,_0xeba85d){return function(_0x10ecef){if(_0x10ecef){var _0x51934d=_0x10ecef[_0xd0af('0x1a')],_0x5616e8=_0xeba85d[_0xd0af('0x1b')],_0x40ffe5=_0xeba85d[_0xd0af('0x1b')]+_0xeba85d['limit'],_0x139fbc;if(_0x40ffe5>=_0x51934d){_0x40ffe5=_0x51934d;_0x139fbc=0xc8;}else{_0x139fbc=0xce;}_0x541833[_0xd0af('0x19')](_0x139fbc);return _0x541833[_0xd0af('0x1c')](_0xd0af('0x1d'),_0x5616e8+'-'+_0x40ffe5+'/'+_0x51934d)['json'](_0x10ecef);}return null;};}function patchUpdates(_0x292e97){return function(_0x5d74f8){try{jsonpatch[_0xd0af('0x1e')](_0x5d74f8,_0x292e97,!![]);}catch(_0x52f845){return BPromise['reject'](_0x52f845);}return _0x5d74f8[_0xd0af('0x1f')]();};}function saveUpdates(_0x52ac08,_0x4eff14){return function(_0x2876da){if(_0x2876da){return _0x2876da[_0xd0af('0x20')](_0x52ac08)['then'](function(_0x1a79bb){return _0x1a79bb;});}return null;};}function removeEntity(_0x4d26ea,_0xb6e822){return function(_0x50dcc4){if(_0x50dcc4){return _0x50dcc4['destroy']()['then'](function(){_0x4d26ea['status'](0xcc)[_0xd0af('0x21')]();});}};}function handleEntityNotFound(_0x4bc8f5,_0x15c572){return function(_0x72d0b9){if(!_0x72d0b9){_0x4bc8f5['sendStatus'](0x194);}return _0x72d0b9;};}function handleError(_0x57601c,_0x127f89){_0x127f89=_0x127f89||0x1f4;return function(_0x1cb4dc){logger[_0xd0af('0x22')](_0x1cb4dc[_0xd0af('0x23')]);if(_0x1cb4dc[_0xd0af('0x24')]){delete _0x1cb4dc['name'];}_0x57601c[_0xd0af('0x19')](_0x127f89)[_0xd0af('0x25')](_0x1cb4dc);};}exports[_0xd0af('0x26')]=function(_0x12d0cd,_0x51d114){var _0x342365={},_0x3ea036={},_0x453472={'count':0x0,'rows':[]};var _0x322209=_[_0xd0af('0x27')](db['VoiceMailMessage'][_0xd0af('0x28')],function(_0x65f347){return{'name':_0x65f347[_0xd0af('0x29')],'type':_0x65f347[_0xd0af('0x2a')][_0xd0af('0x2b')]};});_0x3ea036[_0xd0af('0x2c')]=_[_0xd0af('0x2d')](_[_0xd0af('0x27')](_0x322209,'name'),[_0xd0af('0x24')]);_0x3ea036[_0xd0af('0x2e')]=_['keys'](_0x12d0cd[_0xd0af('0x2e')]);_0x3ea036[_0xd0af('0x2f')]=_[_0xd0af('0x30')](_0x3ea036[_0xd0af('0x2c')],_0x3ea036['query']);_0x342365[_0xd0af('0x31')]=_[_0xd0af('0x30')](_0x3ea036[_0xd0af('0x2c')],qs[_0xd0af('0x32')](_0x12d0cd[_0xd0af('0x2e')]['fields']));_0x342365['attributes']=_0x342365[_0xd0af('0x31')][_0xd0af('0x33')]?_0x342365[_0xd0af('0x31')]:_0x3ea036[_0xd0af('0x2c')];if(!_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x34')](_0xd0af('0x35'))){_0x342365[_0xd0af('0x36')]=qs[_0xd0af('0x36')](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x36')]);_0x342365['offset']=qs['offset'](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x1b')]);}_0x342365[_0xd0af('0x37')]=qs[_0xd0af('0x38')](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x38')]);_0x342365[_0xd0af('0x39')]=qs[_0xd0af('0x2f')](_[_0xd0af('0x3a')](_0x12d0cd[_0xd0af('0x2e')],_0x3ea036[_0xd0af('0x2f')]),_0x322209);if(_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x3b')]){_0x342365['where']=_[_0xd0af('0x3c')](_0x342365[_0xd0af('0x39')],{'$or':_[_0xd0af('0x27')](_0x322209,function(_0x7eefc2){if(_0x7eefc2[_0xd0af('0x2a')]!==_0xd0af('0x3d')){var _0x2dbaf2={};_0x2dbaf2[_0x7eefc2['name']]={'$like':'%'+_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x3b')]+'%'};return _0x2dbaf2;}})});}_0x342365=_['merge']({},_0x342365,_0x12d0cd['options']);var _0x382fbe={'where':_0x342365[_0xd0af('0x39')]};return db[_0xd0af('0x3e')][_0xd0af('0x1a')](_0x382fbe)[_0xd0af('0x3f')](function(_0x33f7a3){_0x453472[_0xd0af('0x1a')]=_0x33f7a3;if(_0x12d0cd['query'][_0xd0af('0x40')]){_0x342365[_0xd0af('0x41')]=[{'all':!![]}];}return db[_0xd0af('0x3e')][_0xd0af('0x42')](_0x342365);})['then'](function(_0x29af08){_0x453472[_0xd0af('0x43')]=_0x29af08;return _0x453472;})['then'](respondWithFilteredResult(_0x51d114,_0x342365))[_0xd0af('0x44')](handleError(_0x51d114,null));};exports[_0xd0af('0x45')]=function(_0x380347,_0x10b722){var _0x20c7ff={'raw':!![],'where':{'id':_0x380347[_0xd0af('0x46')]['id']}},_0x124c65={};_0x124c65[_0xd0af('0x2c')]=_[_0xd0af('0x47')](db[_0xd0af('0x3e')][_0xd0af('0x28')]);_0x124c65[_0xd0af('0x2e')]=_[_0xd0af('0x47')](_0x380347['query']);_0x124c65['filters']=_['intersection'](_0x124c65[_0xd0af('0x2c')],_0x124c65[_0xd0af('0x2e')]);_0x20c7ff['attributes']=_[_0xd0af('0x30')](_0x124c65[_0xd0af('0x2c')],qs['fields'](_0x380347[_0xd0af('0x2e')][_0xd0af('0x32')]));_0x20c7ff['attributes']=_0x20c7ff[_0xd0af('0x31')][_0xd0af('0x33')]?_0x20c7ff['attributes']:_0x124c65['model'];if(_0x380347[_0xd0af('0x2e')][_0xd0af('0x40')]){_0x20c7ff[_0xd0af('0x41')]=[{'all':!![]}];}_0x20c7ff=_[_0xd0af('0x3c')]({},_0x20c7ff,_0x380347[_0xd0af('0x48')]);return db[_0xd0af('0x3e')]['find'](_0x20c7ff)[_0xd0af('0x3f')](handleEntityNotFound(_0x10b722,null))[_0xd0af('0x3f')](respondWithResult(_0x10b722,null))[_0xd0af('0x44')](handleError(_0x10b722,null));};exports[_0xd0af('0x49')]=function(_0x5f11eb,_0x4d72a9){return db[_0xd0af('0x3e')][_0xd0af('0x49')](_0x5f11eb[_0xd0af('0x4a')],{})[_0xd0af('0x3f')](respondWithResult(_0x4d72a9,0xc9))[_0xd0af('0x44')](handleError(_0x4d72a9,null));};exports[_0xd0af('0x20')]=function(_0x46d9a6,_0x343e60){if(_0x46d9a6[_0xd0af('0x4a')]['id']){delete _0x46d9a6['body']['id'];}return db[_0xd0af('0x3e')][_0xd0af('0x4b')]({'where':{'id':_0x46d9a6[_0xd0af('0x46')]['id']}})[_0xd0af('0x3f')](handleEntityNotFound(_0x343e60,null))[_0xd0af('0x3f')](saveUpdates(_0x46d9a6[_0xd0af('0x4a')],null))[_0xd0af('0x3f')](respondWithResult(_0x343e60,null))['catch'](handleError(_0x343e60,null));};exports[_0xd0af('0x4c')]=function(_0x5c5469,_0x10d302){return db[_0xd0af('0x3e')][_0xd0af('0x4b')]({'where':{'id':_0x5c5469[_0xd0af('0x46')]['id']}})[_0xd0af('0x3f')](handleEntityNotFound(_0x10d302,null))[_0xd0af('0x3f')](removeEntity(_0x10d302,null))[_0xd0af('0x44')](handleError(_0x10d302,null));};exports[_0xd0af('0x4d')]=function(_0x2edac1,_0x9ed6f8,_0x4d2f3e){return db['VoiceMailMessage'][_0xd0af('0x4b')]({'where':{'id':_0x2edac1[_0xd0af('0x46')]['id']},'attributes':['id',_0xd0af('0x4e'),_0xd0af('0x4f')]})[_0xd0af('0x3f')](handleEntityNotFound(_0x9ed6f8,null))[_0xd0af('0x3f')](function(_0x96d96f){if(_0x96d96f){if(!_0x96d96f[_0xd0af('0x4e')]){throw new db[(_0xd0af('0x50'))][(_0xd0af('0x51'))](_0xd0af('0x52'));}var _0x458339={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x96d96f['msg_id']){_0x458339[_0xd0af('0x53')]='attachment;\x20filename=\x22'+_0x96d96f[_0xd0af('0x4f')]+'.wav\x22';}_0x9ed6f8['set'](_0x458339);return _0x9ed6f8[_0xd0af('0x25')](new Buffer(_0x96d96f['recording']));}})[_0xd0af('0x44')](handleError(_0x9ed6f8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index dbe9940..c5caa43 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 _0x3d91=['path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x3d91,0xf7));var _0x13d9=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x3d91[_0x52cbe2];return _0x277141;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13d9('0x0'))(_0x13d9('0x1'));var moment=require(_0x13d9('0x2'));var BPromise=require(_0x13d9('0x3'));var rp=require(_0x13d9('0x4'));var fs=require('fs');var path=require(_0x13d9('0x5'));var rimraf=require(_0x13d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x13d9('0x7'));module[_0x13d9('0x8')]=function(_0x22c3b7,_0x399bf5){return _0x22c3b7[_0x13d9('0x9')](_0x13d9('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x13d9('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x05d5=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x05d5,0x1d9));var _0x505d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x05d5[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x505d('0x0'));var util=require(_0x505d('0x1'));var logger=require(_0x505d('0x2'))(_0x505d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x505d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x505d('0x5'));var config=require(_0x505d('0x6'));var attributes=require(_0x505d('0x7'));module[_0x505d('0x8')]=function(_0x4fcdd8,_0x33eab5){return _0x4fcdd8[_0x505d('0x9')](_0x505d('0xa'),attributes,{'tableName':_0x505d('0xb'),'paranoid':![],'indexes':[{'name':_0x505d('0xc'),'fields':[_0x505d('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 d6af331..bd35893 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 _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(_0x454c4d,_0x210aa7){var _0x3abbf2=function(_0x2b1309){while(--_0x2b1309){_0x454c4d['push'](_0x454c4d['shift']());}};_0x3abbf2(++_0x210aa7);}(_0x57ca,0x108));var _0xa57c=function(_0x1ccbaf,_0x37204c){_0x1ccbaf=_0x1ccbaf-0x0;var _0x40b67b=_0x57ca[_0x1ccbaf];return _0x40b67b;};'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 +var _0x7a54=['info','VoiceMailMessage,\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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5d370e,_0x35fd82){_0x5d370e=_0x5d370e-0x0;var _0x3e7dbc=_0x7a54[_0x5d370e];return _0x3e7dbc;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0f719e4..0c715cb 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 _0xe0f2=['create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','express','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post'];(function(_0x2c6096,_0x35137a){var _0x157b92=function(_0xa5bd8d){while(--_0xa5bd8d){_0x2c6096['push'](_0x2c6096['shift']());}};_0x157b92(++_0x35137a);}(_0xe0f2,0x67));var _0x2e0f=function(_0x5f6485,_0x3325a5){_0x5f6485=_0x5f6485-0x0;var _0x5ac362=_0xe0f2[_0x5f6485];return _0x5ac362;};'use strict';var multer=require(_0x2e0f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2e0f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2e0f('0x2'));var config=require(_0x2e0f('0x3'));var controller=require(_0x2e0f('0x4'));router[_0x2e0f('0x5')]('/',auth[_0x2e0f('0x6')](),controller[_0x2e0f('0x7')]);router[_0x2e0f('0x5')](_0x2e0f('0x8'),auth[_0x2e0f('0x6')](),controller['show']);router['get'](_0x2e0f('0x9'),auth['isAuthenticated'](),controller['getSounds']);router[_0x2e0f('0xa')]('/',auth[_0x2e0f('0x6')](),controller[_0x2e0f('0xb')]);router['post'](_0x2e0f('0x9'),auth['isAuthenticated'](),controller[_0x2e0f('0xc')]);router[_0x2e0f('0xd')](_0x2e0f('0x8'),auth[_0x2e0f('0x6')](),controller[_0x2e0f('0xe')]);router[_0x2e0f('0xf')](_0x2e0f('0x8'),auth['isAuthenticated'](),controller[_0x2e0f('0x10')]);router[_0x2e0f('0xf')](_0x2e0f('0x11'),auth[_0x2e0f('0x6')](),controller[_0x2e0f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xda8c=['getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds'];(function(_0x11a3bb,_0x5c5466){var _0x3c3e36=function(_0x59f16f){while(--_0x59f16f){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x3c3e36(++_0x5c5466);}(_0xda8c,0xb2));var _0xcda8=function(_0xc359da,_0x18423b){_0xc359da=_0xc359da-0x0;var _0x83d2fd=_0xda8c[_0xc359da];return _0x83d2fd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcda8('0x0'));var express=require(_0xcda8('0x1'));var router=express[_0xcda8('0x2')]();var auth=require(_0xcda8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcda8('0x4'));var controller=require(_0xcda8('0x5'));router[_0xcda8('0x6')]('/',auth[_0xcda8('0x7')](),controller[_0xcda8('0x8')]);router['get'](_0xcda8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcda8('0x6')](_0xcda8('0xa'),auth['isAuthenticated'](),controller[_0xcda8('0xb')]);router[_0xcda8('0xc')]('/',auth[_0xcda8('0x7')](),controller['create']);router['post']('/:id/sounds',auth[_0xcda8('0x7')](),controller[_0xcda8('0xd')]);router[_0xcda8('0xe')](_0xcda8('0x9'),auth[_0xcda8('0x7')](),controller[_0xcda8('0xf')]);router[_0xcda8('0x10')](_0xcda8('0x9'),auth['isAuthenticated'](),controller[_0xcda8('0x11')]);router[_0xcda8('0x10')](_0xcda8('0x12'),auth[_0xcda8('0x7')](),controller[_0xcda8('0x13')]);module[_0xcda8('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c4a4b5c..f68bef1 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 _0x7e51=['sequelize','exports','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN'];(function(_0x11004c,_0x5bb659){var _0x5016d4=function(_0x37015e){while(--_0x37015e){_0x11004c['push'](_0x11004c['shift']());}};_0x5016d4(++_0x5bb659);}(_0x7e51,0xf2));var _0x17e5=function(_0x2e8265,_0x7e9f21){_0x2e8265=_0x2e8265-0x0;var _0x1527f5=_0x7e51[_0x2e8265];return _0x1527f5;};'use strict';var Sequelize=require(_0x17e5('0x0'));module[_0x17e5('0x1')]={'name':{'type':Sequelize[_0x17e5('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x17e5('0x3'),_0x17e5('0x4'),_0x17e5('0x5'),_0x17e5('0x6'),_0x17e5('0x7'),_0x17e5('0x8')),'allowNull':!![],'defaultValue':_0x17e5('0x4')},'directory':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![],'defaultValue':_0x17e5('0x9')},'format':{'type':Sequelize[_0x17e5('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x17e5('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1798=['exports','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0xdb0814,_0x1bc20e){var _0x28c819=function(_0x33a390){while(--_0x33a390){_0xdb0814['push'](_0xdb0814['shift']());}};_0x28c819(++_0x1bc20e);}(_0x1798,0xa7));var _0x8179=function(_0x50fad3,_0x1e01d4){_0x50fad3=_0x50fad3-0x0;var _0x2fee19=_0x1798[_0x50fad3];return _0x2fee19;};'use strict';var Sequelize=require(_0x8179('0x0'));module[_0x8179('0x1')]={'name':{'type':Sequelize[_0x8179('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x8179('0x3'),_0x8179('0x4'),_0x8179('0x5'),_0x8179('0x6'),_0x8179('0x7'),_0x8179('0x8')),'allowNull':!![],'defaultValue':_0x8179('0x4')},'directory':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![],'defaultValue':_0x8179('0x9')},'format':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'stamp':{'type':_0x8179('0xa')},'defaultEntry':{'type':Sequelize[_0x8179('0xb')],'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 24182ff..21c50eb 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 _0x10dd=['root','format','%s.%s','basename','extname','symlinkSync','removeSound','params','id2','Sound','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','MusicOnHolds','then','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','keys','rawAttributes','include','body','find','create','sequelize','transaction','mode','files','directory','join','server/files/moh','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt'];(function(_0x124703,_0x17b603){var _0xa47749=function(_0x339c47){while(--_0x339c47){_0x124703['push'](_0x124703['shift']());}};_0xa47749(++_0x17b603);}(_0x10dd,0x7c));var _0xd10d=function(_0x5004ab,_0x2dbfaa){_0x5004ab=_0x5004ab-0x0;var _0x34ec4b=_0x10dd[_0x5004ab];return _0x34ec4b;};'use strict';var pdf=require(_0xd10d('0x0'));var emlformat=require(_0xd10d('0x1'));var rimraf=require(_0xd10d('0x2'));var zipdir=require(_0xd10d('0x3'));var jsonpatch=require(_0xd10d('0x4'));var rp=require('request-promise');var moment=require(_0xd10d('0x5'));var BPromise=require(_0xd10d('0x6'));var Mustache=require('mustache');var util=require(_0xd10d('0x7'));var path=require('path');var sox=require(_0xd10d('0x8'));var csv=require(_0xd10d('0x9'));var ejs=require(_0xd10d('0xa'));var fs=require('fs');var _=require(_0xd10d('0xb'));var squel=require(_0xd10d('0xc'));var crypto=require(_0xd10d('0xd'));var jsforce=require(_0xd10d('0xe'));var deskjs=require(_0xd10d('0xf'));var toCsv=require(_0xd10d('0x9'));var querystring=require(_0xd10d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd10d('0x11'));var qs=require(_0xd10d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd10d('0x13'));var logger=require(_0xd10d('0x14'))(_0xd10d('0x15'));var utils=require(_0xd10d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3132b7,_0x1fd4c3){_0x1fd4c3=_0x1fd4c3||0xcc;return function(_0x45b877){if(_0x45b877){return _0x3132b7[_0xd10d('0x17')](_0x1fd4c3);}return _0x3132b7[_0xd10d('0x18')](_0x1fd4c3)[_0xd10d('0x19')]();};}function respondWithResult(_0x4c71aa,_0x5bf64e){_0x5bf64e=_0x5bf64e||0xc8;return function(_0x56eca4){if(_0x56eca4){return _0x4c71aa['status'](_0x5bf64e)[_0xd10d('0x1a')](_0x56eca4);}};}function respondWithFilteredResult(_0xb2c9d9,_0x357db6){return function(_0x39efc7){if(_0x39efc7){var _0xb091e2=_0x39efc7[_0xd10d('0x1b')],_0x3a1cfe=_0x357db6[_0xd10d('0x1c')],_0x55246a=_0x357db6['offset']+_0x357db6[_0xd10d('0x1d')],_0x3f5d4b;if(_0x55246a>=_0xb091e2){_0x55246a=_0xb091e2;_0x3f5d4b=0xc8;}else{_0x3f5d4b=0xce;}_0xb2c9d9['status'](_0x3f5d4b);return _0xb2c9d9[_0xd10d('0x1e')]('Content-Range',_0x3a1cfe+'-'+_0x55246a+'/'+_0xb091e2)[_0xd10d('0x1a')](_0x39efc7);}return null;};}function patchUpdates(_0x249609){return function(_0x39ac03){try{jsonpatch[_0xd10d('0x1f')](_0x39ac03,_0x249609,!![]);}catch(_0x401f6f){return BPromise[_0xd10d('0x20')](_0x401f6f);}return _0x39ac03[_0xd10d('0x21')]();};}function saveUpdates(_0x37b786,_0x449558){return function(_0x543755){if(_0x543755){return _0x543755[_0xd10d('0x22')](_0x37b786)['then'](function(_0x23d378){return _0x23d378;});}return null;};}function removeEntity(_0x4a4899,_0x3fa4d0){return function(_0x3f1dc6){if(_0x3f1dc6){return _0x3f1dc6[_0xd10d('0x23')]()['then'](function(){var _0x52b662=_0x3f1dc6['get']({'plain':!![]});var _0x2ca1c0=_0xd10d('0x24');return db['UserProfileResource'][_0xd10d('0x23')]({'where':{'type':_0x2ca1c0,'resourceId':_0x52b662['id']}})[_0xd10d('0x25')](function(){return _0x3f1dc6;});})[_0xd10d('0x25')](function(){_0x4a4899['status'](0xcc)[_0xd10d('0x19')]();});}};}function handleEntityNotFound(_0x5d7d1d,_0x25e127){return function(_0x23e3c3){if(!_0x23e3c3){_0x5d7d1d['sendStatus'](0x194);}return _0x23e3c3;};}function handleError(_0x3237f5,_0x164880){_0x164880=_0x164880||0x1f4;return function(_0x29bf0b){logger[_0xd10d('0x26')](_0x29bf0b[_0xd10d('0x27')]);if(_0x29bf0b[_0xd10d('0x28')]){delete _0x29bf0b[_0xd10d('0x28')];}_0x3237f5['status'](_0x164880)[_0xd10d('0x29')](_0x29bf0b);};}exports[_0xd10d('0x2a')]=function(_0x428e6e,_0xf46bea){var _0x27e77e={},_0x5a24f1={},_0x1171d9={'count':0x0,'rows':[]};var _0x1abe9b=_[_0xd10d('0x2b')](db[_0xd10d('0x2c')]['rawAttributes'],function(_0x20b04f){return{'name':_0x20b04f[_0xd10d('0x2d')],'type':_0x20b04f['type'][_0xd10d('0x2e')]};});_0x5a24f1[_0xd10d('0x2f')]=_[_0xd10d('0x2b')](_0x1abe9b,_0xd10d('0x28'));_0x5a24f1[_0xd10d('0x30')]=_['keys'](_0x428e6e['query']);_0x5a24f1[_0xd10d('0x31')]=_[_0xd10d('0x32')](_0x5a24f1[_0xd10d('0x2f')],_0x5a24f1[_0xd10d('0x30')]);_0x27e77e[_0xd10d('0x33')]=_[_0xd10d('0x32')](_0x5a24f1[_0xd10d('0x2f')],qs[_0xd10d('0x34')](_0x428e6e[_0xd10d('0x30')]['fields']));_0x27e77e[_0xd10d('0x33')]=_0x27e77e[_0xd10d('0x33')][_0xd10d('0x35')]?_0x27e77e[_0xd10d('0x33')]:_0x5a24f1[_0xd10d('0x2f')];if(!_0x428e6e[_0xd10d('0x30')][_0xd10d('0x36')](_0xd10d('0x37'))){_0x27e77e['limit']=qs['limit'](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x1d')]);_0x27e77e[_0xd10d('0x1c')]=qs[_0xd10d('0x1c')](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x1c')]);}_0x27e77e[_0xd10d('0x38')]=qs[_0xd10d('0x39')](_0x428e6e[_0xd10d('0x30')][_0xd10d('0x39')]);_0x27e77e[_0xd10d('0x3a')]=qs[_0xd10d('0x31')](_[_0xd10d('0x3b')](_0x428e6e[_0xd10d('0x30')],_0x5a24f1[_0xd10d('0x31')]),_0x1abe9b);if(_0x428e6e[_0xd10d('0x30')][_0xd10d('0x3c')]){_0x27e77e[_0xd10d('0x3a')]=_[_0xd10d('0x3d')](_0x27e77e['where'],{'$or':_[_0xd10d('0x2b')](_0x1abe9b,function(_0x22436d){if(_0x22436d[_0xd10d('0x3e')]!==_0xd10d('0x3f')){var _0x8ae945={};_0x8ae945[_0x22436d[_0xd10d('0x28')]]={'$like':'%'+_0x428e6e['query'][_0xd10d('0x3c')]+'%'};return _0x8ae945;}})});}_0x27e77e=_[_0xd10d('0x3d')]({},_0x27e77e,_0x428e6e[_0xd10d('0x40')]);var _0x2b6704={'where':_0x27e77e['where']};return db[_0xd10d('0x2c')][_0xd10d('0x1b')](_0x2b6704)[_0xd10d('0x25')](function(_0x4310fe){_0x1171d9[_0xd10d('0x1b')]=_0x4310fe;if(_0x428e6e['query'][_0xd10d('0x41')]){_0x27e77e['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x27e77e);})[_0xd10d('0x25')](function(_0x6959a4){_0x1171d9['rows']=_0x6959a4;return _0x1171d9;})[_0xd10d('0x25')](respondWithFilteredResult(_0xf46bea,_0x27e77e))[_0xd10d('0x42')](handleError(_0xf46bea,null));};exports[_0xd10d('0x43')]=function(_0x579484,_0x31f1e2){var _0x5a653c={'raw':![],'where':{'id':_0x579484['params']['id']}},_0x213f78={};_0x213f78['model']=_[_0xd10d('0x44')](db['VoiceMusicOnHold'][_0xd10d('0x45')]);_0x213f78['query']=_['keys'](_0x579484[_0xd10d('0x30')]);_0x213f78['filters']=_[_0xd10d('0x32')](_0x213f78['model'],_0x213f78[_0xd10d('0x30')]);_0x5a653c['attributes']=_[_0xd10d('0x32')](_0x213f78['model'],qs[_0xd10d('0x34')](_0x579484['query'][_0xd10d('0x34')]));_0x5a653c[_0xd10d('0x33')]=_0x5a653c[_0xd10d('0x33')][_0xd10d('0x35')]?_0x5a653c[_0xd10d('0x33')]:_0x213f78['model'];if(_0x579484[_0xd10d('0x30')][_0xd10d('0x41')]){_0x5a653c[_0xd10d('0x46')]=[{'all':!![]}];}_0x5a653c=_['merge']({},_0x5a653c,_0x579484[_0xd10d('0x40')]);return db[_0xd10d('0x2c')]['find'](_0x5a653c)[_0xd10d('0x25')](handleEntityNotFound(_0x31f1e2,null))[_0xd10d('0x25')](respondWithResult(_0x31f1e2,null))[_0xd10d('0x42')](handleError(_0x31f1e2,null));};exports['update']=function(_0x1b1b00,_0x4edf58){if(_0x1b1b00[_0xd10d('0x47')]['id']){delete _0x1b1b00[_0xd10d('0x47')]['id'];}return db['VoiceMusicOnHold'][_0xd10d('0x48')]({'where':{'id':_0x1b1b00['params']['id']}})[_0xd10d('0x25')](handleEntityNotFound(_0x4edf58,null))['then'](saveUpdates(_0x1b1b00['body'],null))[_0xd10d('0x25')](respondWithResult(_0x4edf58,null))[_0xd10d('0x42')](handleError(_0x4edf58,null));};exports[_0xd10d('0x49')]=function(_0x32a1c0,_0x3d71b9,_0x4e9032){return db[_0xd10d('0x4a')][_0xd10d('0x4b')](function(_0x27bc89){if(_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x4c')]===_0xd10d('0x4d')){_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x4e')]=path[_0xd10d('0x4f')](config['root'],_0xd10d('0x50'),_0x32a1c0[_0xd10d('0x47')][_0xd10d('0x28')]);}return db[_0xd10d('0x2c')][_0xd10d('0x49')](_0x32a1c0[_0xd10d('0x47')],{'transaction':_0x27bc89})['then'](function(_0x3b3a81){if(_0x32a1c0[_0xd10d('0x47')]['mode']===_0xd10d('0x4d')){fs['mkdirSync'](_0x3b3a81[_0xd10d('0x4e')],parseInt(_0xd10d('0x51'),0x8));}var _0x32d091=_0x32a1c0['user'][_0xd10d('0x52')]({'plain':!![]});if(!_0x32d091)throw new Error(_0xd10d('0x53'));if(_0x32d091[_0xd10d('0x54')]===_0xd10d('0x55')){var _0x5f34b5=_0x3b3a81[_0xd10d('0x52')]({'plain':!![]});return db[_0xd10d('0x56')][_0xd10d('0x48')]({'where':{'name':_0xd10d('0x24'),'userProfileId':_0x32d091[_0xd10d('0x57')]},'raw':!![]})[_0xd10d('0x25')](function(_0xd53752){if(_0xd53752&&_0xd53752[_0xd10d('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f34b5['name'],'resourceId':_0x5f34b5['id'],'type':_0xd53752[_0xd10d('0x28')],'sectionId':_0xd53752['id']},{})[_0xd10d('0x25')](function(){return _0x3b3a81;});}else{return _0x3b3a81;}})[_0xd10d('0x42')](function(_0x2a997b){logger[_0xd10d('0x26')](_0xd10d('0x59'),_0x2a997b);});}return _0x3b3a81;});})[_0xd10d('0x25')](respondWithResult(_0x3d71b9,0xc9))[_0xd10d('0x42')](handleError(_0x3d71b9,null));};exports[_0xd10d('0x23')]=function(_0x29d1f5,_0x2bd43f,_0x4f0ce6){var _0x483421;return db['VoiceMusicOnHold'][_0xd10d('0x48')]({'where':{'id':_0x29d1f5['params']['id']}})[_0xd10d('0x25')](function(_0x44cd40){if(_0x44cd40){return db[_0xd10d('0x4a')]['transaction'](function(_0x1585a9){return _0x44cd40[_0xd10d('0x23')]({'transaction':_0x1585a9,'raw':!![]})[_0xd10d('0x25')](function(_0x3786cf){if(_0x3786cf[_0xd10d('0x4e')]){fs[_0xd10d('0x5a')](_0x3786cf['directory'])[_0xd10d('0x5b')](function(_0x31f01a){fs[_0xd10d('0x5c')](path[_0xd10d('0x4f')](_0x3786cf[_0xd10d('0x4e')],_0x31f01a));});fs[_0xd10d('0x5d')](_0x3786cf[_0xd10d('0x4e')]);}return _0x3786cf;});})[_0xd10d('0x42')](function(_0xe22ec4){throw new db[(_0xd10d('0x5e'))][(_0xd10d('0x5f'))](_0xe22ec4[_0xd10d('0x60')]);});}})['then'](handleEntityNotFound(_0x2bd43f,null))[_0xd10d('0x25')](removeEntity(_0x2bd43f,null))[_0xd10d('0x42')](handleError(_0x2bd43f,null));};exports[_0xd10d('0x61')]=function(_0x19437d,_0x30a769,_0x3d1a9e){return db[_0xd10d('0x4a')][_0xd10d('0x4b')](function(_0x396619){var _0x5620ea;return db[_0xd10d('0x2c')][_0xd10d('0x48')]({'where':{'id':_0x19437d['params']['id']}})[_0xd10d('0x25')](function(_0x80360){if(_0x80360){_0x5620ea=_0x80360;return _0x80360[_0xd10d('0x61')](_0x19437d[_0xd10d('0x47')]['id'],{'transaction':_0x396619});}})[_0xd10d('0x25')](function(_0x20c64c){if(_0x20c64c){return db['Sound'][_0xd10d('0x62')]({'where':{'id':_0x19437d[_0xd10d('0x47')]['id']},'attributes':['id','name',_0xd10d('0x63'),_0xd10d('0x64'),_0xd10d('0x65')],'raw':!![]});}})[_0xd10d('0x25')](function(_0x22add3){if(_0x22add3){var _0x15b1ff=path[_0xd10d('0x4f')](config[_0xd10d('0x66')],'server/files/sounds/converted',util[_0xd10d('0x67')](_0xd10d('0x68'),path[_0xd10d('0x69')](_0x22add3[_0xd10d('0x63')],path[_0xd10d('0x6a')](_0x22add3[_0xd10d('0x63')])),_0x22add3[_0xd10d('0x64')]));var _0x310f8d=path[_0xd10d('0x4f')](config[_0xd10d('0x66')],_0xd10d('0x50'),_0x5620ea[_0xd10d('0x28')],util[_0xd10d('0x67')](_0xd10d('0x68'),_0x22add3[_0xd10d('0x28')],_0x22add3['converted_format']));fs[_0xd10d('0x6b')](_0x15b1ff,_0x310f8d);return _0x22add3;}})[_0xd10d('0x42')](function(_0x54a6c4){throw new db['Sequelize'][(_0xd10d('0x5f'))](_0x54a6c4[_0xd10d('0x60')]);});})[_0xd10d('0x25')](handleEntityNotFound(_0x30a769,null))[_0xd10d('0x25')](respondWithResult(_0x30a769,0xc9))['catch'](handleError(_0x30a769,null));};exports[_0xd10d('0x6c')]=function(_0x2746d9,_0x5124df,_0x1af4f1){return db['sequelize'][_0xd10d('0x4b')](function(_0x48c0e5){var _0x53553e;return db[_0xd10d('0x2c')][_0xd10d('0x62')]({'where':{'id':_0x2746d9[_0xd10d('0x6d')]['id']}})[_0xd10d('0x25')](handleEntityNotFound(_0x5124df,null))['then'](function(_0x3017c9){if(_0x3017c9){_0x53553e=_0x3017c9;return _0x3017c9[_0xd10d('0x6c')](_0x2746d9[_0xd10d('0x6d')][_0xd10d('0x6e')]);}})['then'](function(_0x269baf){if(_0x269baf){return db[_0xd10d('0x6f')][_0xd10d('0x62')]({'where':{'id':_0x2746d9['params'][_0xd10d('0x6e')]},'attributes':['id',_0xd10d('0x28'),_0xd10d('0x63'),_0xd10d('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x6cd561){if(_0x6cd561){fs[_0xd10d('0x5c')](path[_0xd10d('0x4f')](_0x53553e[_0xd10d('0x4e')],util[_0xd10d('0x67')](_0xd10d('0x68'),_0x6cd561['name'],_0x6cd561[_0xd10d('0x64')])));return _0x6cd561;}})[_0xd10d('0x42')](function(_0x4eb4fb){throw new db[(_0xd10d('0x5e'))][(_0xd10d('0x5f'))](_0x4eb4fb[_0xd10d('0x60')]);});})[_0xd10d('0x25')](handleEntityNotFound(_0x5124df,null))[_0xd10d('0x25')](respondWithStatusCode(_0x5124df,0xcc))[_0xd10d('0x42')](handleError(_0x5124df,null));};exports['getSounds']=function(_0x5244d2,_0x5807bb,_0x1d6ae3){var _0x100fbd={};var _0x328d68={};var _0x49b833;var _0x2ef436;return db['VoiceMusicOnHold'][_0xd10d('0x62')]({'where':{'id':_0x5244d2[_0xd10d('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5807bb,null))['then'](function(_0x3f7bde){if(_0x3f7bde){_0x49b833=_0x3f7bde;_0x328d68[_0xd10d('0x2f')]=_['keys'](db['Sound']['rawAttributes']);_0x328d68['query']=_[_0xd10d('0x44')](_0x5244d2[_0xd10d('0x30')]);_0x328d68[_0xd10d('0x31')]=_[_0xd10d('0x32')](_0x328d68[_0xd10d('0x2f')],_0x328d68['query']);_0x100fbd[_0xd10d('0x33')]=_[_0xd10d('0x32')](_0x328d68[_0xd10d('0x2f')],qs[_0xd10d('0x34')](_0x5244d2[_0xd10d('0x30')][_0xd10d('0x34')]));_0x100fbd[_0xd10d('0x33')]=_0x100fbd['attributes'][_0xd10d('0x35')]?_0x100fbd[_0xd10d('0x33')]:_0x328d68[_0xd10d('0x2f')];_0x100fbd[_0xd10d('0x38')]=qs[_0xd10d('0x39')](_0x5244d2['query'][_0xd10d('0x39')]);_0x100fbd[_0xd10d('0x3a')]=qs['filters'](_[_0xd10d('0x3b')](_0x5244d2[_0xd10d('0x30')],_0x328d68[_0xd10d('0x31')]));if(_0x5244d2[_0xd10d('0x30')][_0xd10d('0x3c')]){_0x100fbd[_0xd10d('0x3a')]=_[_0xd10d('0x3d')](_0x100fbd[_0xd10d('0x3a')],{'$or':_['map'](_0x100fbd['attributes'],function(_0x511cac){var _0x46f245={};_0x46f245[_0x511cac]={'$like':'%'+_0x5244d2['query']['filter']+'%'};return _0x46f245;})});}_0x100fbd=_[_0xd10d('0x3d')]({},_0x100fbd,_0x5244d2[_0xd10d('0x40')]);return _0x49b833[_0xd10d('0x70')](_0x100fbd);}})[_0xd10d('0x25')](function(_0x573f20){if(_0x573f20){_0x2ef436=_0x573f20[_0xd10d('0x35')];if(!_0x5244d2[_0xd10d('0x30')][_0xd10d('0x36')](_0xd10d('0x37'))){_0x100fbd[_0xd10d('0x1d')]=qs[_0xd10d('0x1d')](_0x5244d2[_0xd10d('0x30')][_0xd10d('0x1d')]);_0x100fbd[_0xd10d('0x1c')]=qs['offset'](_0x5244d2['query'][_0xd10d('0x1c')]);}return _0x49b833[_0xd10d('0x70')](_0x100fbd);}})['then'](function(_0x5a27cd){if(_0x5a27cd){return _0x5a27cd?{'count':_0x2ef436,'rows':_0x5a27cd}:null;}})[_0xd10d('0x25')](respondWithResult(_0x5807bb,null))[_0xd10d('0x42')](handleError(_0x5807bb,null));}; \ No newline at end of file +var _0xb686=['pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','files','server/files/moh','directory','0777','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','format','basename','root','%s.%s','removeSound','id2','getSounds','nolimit','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xb686,0xa1));var _0x6b68=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb686[_0x36eaaa];return _0x461349;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b68('0x0'));var rimraf=require(_0x6b68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b68('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b68('0x3'));var Mustache=require(_0x6b68('0x4'));var util=require(_0x6b68('0x5'));var path=require(_0x6b68('0x6'));var sox=require('sox');var csv=require(_0x6b68('0x7'));var ejs=require(_0x6b68('0x8'));var fs=require('fs');var _=require(_0x6b68('0x9'));var squel=require(_0x6b68('0xa'));var crypto=require(_0x6b68('0xb'));var jsforce=require(_0x6b68('0xc'));var deskjs=require(_0x6b68('0xd'));var toCsv=require(_0x6b68('0x7'));var querystring=require(_0x6b68('0xe'));var Papa=require(_0x6b68('0xf'));var Redis=require(_0x6b68('0x10'));var authService=require(_0x6b68('0x11'));var qs=require(_0x6b68('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b68('0x13'))(_0x6b68('0x14'));var utils=require(_0x6b68('0x15'));var config=require(_0x6b68('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b68('0x17'))['db'];function respondWithStatusCode(_0x432fbe,_0x15af87){_0x15af87=_0x15af87||0xcc;return function(_0x293bcd){if(_0x293bcd){return _0x432fbe[_0x6b68('0x18')](_0x15af87);}return _0x432fbe[_0x6b68('0x19')](_0x15af87)[_0x6b68('0x1a')]();};}function respondWithResult(_0x367713,_0x306cc8){_0x306cc8=_0x306cc8||0xc8;return function(_0x4f1bd3){if(_0x4f1bd3){return _0x367713[_0x6b68('0x19')](_0x306cc8)[_0x6b68('0x1b')](_0x4f1bd3);}};}function respondWithFilteredResult(_0x25a247,_0x46aa0c){return function(_0x551416){if(_0x551416){var _0x9bb29f=_0x551416[_0x6b68('0x1c')],_0x3267ae=_0x46aa0c[_0x6b68('0x1d')],_0x25a7c2=_0x46aa0c['offset']+_0x46aa0c[_0x6b68('0x1e')],_0x186c5a;if(_0x25a7c2>=_0x9bb29f){_0x25a7c2=_0x9bb29f;_0x186c5a=0xc8;}else{_0x186c5a=0xce;}_0x25a247['status'](_0x186c5a);return _0x25a247[_0x6b68('0x1f')](_0x6b68('0x20'),_0x3267ae+'-'+_0x25a7c2+'/'+_0x9bb29f)['json'](_0x551416);}return null;};}function patchUpdates(_0x31f240){return function(_0x3fc8bd){try{jsonpatch[_0x6b68('0x21')](_0x3fc8bd,_0x31f240,!![]);}catch(_0x505e6b){return BPromise[_0x6b68('0x22')](_0x505e6b);}return _0x3fc8bd['save']();};}function saveUpdates(_0x2934cb,_0x213830){return function(_0x116b24){if(_0x116b24){return _0x116b24['update'](_0x2934cb)[_0x6b68('0x23')](function(_0x35cfb6){return _0x35cfb6;});}return null;};}function removeEntity(_0x30e33a,_0x2b3879){return function(_0x5e2e66){if(_0x5e2e66){return _0x5e2e66[_0x6b68('0x24')]()[_0x6b68('0x23')](function(){var _0x797407=_0x5e2e66[_0x6b68('0x25')]({'plain':!![]});var _0x5eeff7=_0x6b68('0x26');return db[_0x6b68('0x27')]['destroy']({'where':{'type':_0x5eeff7,'resourceId':_0x797407['id']}})['then'](function(){return _0x5e2e66;});})[_0x6b68('0x23')](function(){_0x30e33a[_0x6b68('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a88da,_0x1c271a){return function(_0x299807){if(!_0x299807){_0x3a88da['sendStatus'](0x194);}return _0x299807;};}function handleError(_0x3a4316,_0x12e837){_0x12e837=_0x12e837||0x1f4;return function(_0x29ba69){logger[_0x6b68('0x28')](_0x29ba69[_0x6b68('0x29')]);if(_0x29ba69[_0x6b68('0x2a')]){delete _0x29ba69['name'];}_0x3a4316['status'](_0x12e837)[_0x6b68('0x2b')](_0x29ba69);};}exports['index']=function(_0x413eed,_0x16e734){var _0x25b431={},_0x596c72={},_0x28644d={'count':0x0,'rows':[]};var _0x555d37=_[_0x6b68('0x2c')](db['VoiceMusicOnHold'][_0x6b68('0x2d')],function(_0x22913c){return{'name':_0x22913c[_0x6b68('0x2e')],'type':_0x22913c[_0x6b68('0x2f')][_0x6b68('0x30')]};});_0x596c72[_0x6b68('0x31')]=_['map'](_0x555d37,_0x6b68('0x2a'));_0x596c72['query']=_[_0x6b68('0x32')](_0x413eed[_0x6b68('0x33')]);_0x596c72[_0x6b68('0x34')]=_['intersection'](_0x596c72[_0x6b68('0x31')],_0x596c72[_0x6b68('0x33')]);_0x25b431[_0x6b68('0x35')]=_[_0x6b68('0x36')](_0x596c72[_0x6b68('0x31')],qs[_0x6b68('0x37')](_0x413eed[_0x6b68('0x33')][_0x6b68('0x37')]));_0x25b431[_0x6b68('0x35')]=_0x25b431[_0x6b68('0x35')][_0x6b68('0x38')]?_0x25b431[_0x6b68('0x35')]:_0x596c72[_0x6b68('0x31')];if(!_0x413eed['query'][_0x6b68('0x39')]('nolimit')){_0x25b431[_0x6b68('0x1e')]=qs['limit'](_0x413eed[_0x6b68('0x33')]['limit']);_0x25b431[_0x6b68('0x1d')]=qs['offset'](_0x413eed[_0x6b68('0x33')][_0x6b68('0x1d')]);}_0x25b431[_0x6b68('0x3a')]=qs[_0x6b68('0x3b')](_0x413eed['query'][_0x6b68('0x3b')]);_0x25b431[_0x6b68('0x3c')]=qs[_0x6b68('0x34')](_[_0x6b68('0x3d')](_0x413eed['query'],_0x596c72['filters']),_0x555d37);if(_0x413eed[_0x6b68('0x33')][_0x6b68('0x3e')]){_0x25b431['where']=_[_0x6b68('0x3f')](_0x25b431['where'],{'$or':_[_0x6b68('0x2c')](_0x555d37,function(_0x3e4283){if(_0x3e4283[_0x6b68('0x2f')]!==_0x6b68('0x40')){var _0x2f572f={};_0x2f572f[_0x3e4283[_0x6b68('0x2a')]]={'$like':'%'+_0x413eed[_0x6b68('0x33')][_0x6b68('0x3e')]+'%'};return _0x2f572f;}})});}_0x25b431=_[_0x6b68('0x3f')]({},_0x25b431,_0x413eed[_0x6b68('0x41')]);var _0x3dbe91={'where':_0x25b431[_0x6b68('0x3c')]};return db[_0x6b68('0x42')]['count'](_0x3dbe91)[_0x6b68('0x23')](function(_0x51b35e){_0x28644d[_0x6b68('0x1c')]=_0x51b35e;if(_0x413eed['query'][_0x6b68('0x43')]){_0x25b431[_0x6b68('0x44')]=[{'all':!![]}];}return db[_0x6b68('0x42')][_0x6b68('0x45')](_0x25b431);})[_0x6b68('0x23')](function(_0x200b1f){_0x28644d[_0x6b68('0x46')]=_0x200b1f;return _0x28644d;})[_0x6b68('0x23')](respondWithFilteredResult(_0x16e734,_0x25b431))[_0x6b68('0x47')](handleError(_0x16e734,null));};exports[_0x6b68('0x48')]=function(_0x42eaaf,_0x260b1f){var _0x59ce24={'raw':![],'where':{'id':_0x42eaaf[_0x6b68('0x49')]['id']}},_0x25fbe0={};_0x25fbe0[_0x6b68('0x31')]=_[_0x6b68('0x32')](db[_0x6b68('0x42')][_0x6b68('0x2d')]);_0x25fbe0[_0x6b68('0x33')]=_['keys'](_0x42eaaf['query']);_0x25fbe0[_0x6b68('0x34')]=_[_0x6b68('0x36')](_0x25fbe0['model'],_0x25fbe0['query']);_0x59ce24[_0x6b68('0x35')]=_[_0x6b68('0x36')](_0x25fbe0[_0x6b68('0x31')],qs['fields'](_0x42eaaf[_0x6b68('0x33')][_0x6b68('0x37')]));_0x59ce24[_0x6b68('0x35')]=_0x59ce24[_0x6b68('0x35')][_0x6b68('0x38')]?_0x59ce24['attributes']:_0x25fbe0[_0x6b68('0x31')];if(_0x42eaaf['query'][_0x6b68('0x43')]){_0x59ce24['include']=[{'all':!![]}];}_0x59ce24=_[_0x6b68('0x3f')]({},_0x59ce24,_0x42eaaf[_0x6b68('0x41')]);return db[_0x6b68('0x42')][_0x6b68('0x4a')](_0x59ce24)[_0x6b68('0x23')](handleEntityNotFound(_0x260b1f,null))[_0x6b68('0x23')](respondWithResult(_0x260b1f,null))[_0x6b68('0x47')](handleError(_0x260b1f,null));};exports['update']=function(_0xdac5d1,_0x3a7226){if(_0xdac5d1[_0x6b68('0x4b')]['id']){delete _0xdac5d1[_0x6b68('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x6b68('0x4a')]({'where':{'id':_0xdac5d1[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x3a7226,null))[_0x6b68('0x23')](saveUpdates(_0xdac5d1[_0x6b68('0x4b')],null))[_0x6b68('0x23')](respondWithResult(_0x3a7226,null))[_0x6b68('0x47')](handleError(_0x3a7226,null));};exports[_0x6b68('0x4c')]=function(_0x2b4d31,_0x3d348b,_0x5b7dc5){return db[_0x6b68('0x4d')][_0x6b68('0x4e')](function(_0x576289){if(_0x2b4d31[_0x6b68('0x4b')][_0x6b68('0x4f')]===_0x6b68('0x50')){_0x2b4d31[_0x6b68('0x4b')]['directory']=path['join'](config['root'],_0x6b68('0x51'),_0x2b4d31[_0x6b68('0x4b')]['name']);}return db[_0x6b68('0x42')][_0x6b68('0x4c')](_0x2b4d31[_0x6b68('0x4b')],{'transaction':_0x576289})[_0x6b68('0x23')](function(_0x5638fe){if(_0x2b4d31['body'][_0x6b68('0x4f')]===_0x6b68('0x50')){fs['mkdirSync'](_0x5638fe[_0x6b68('0x52')],parseInt(_0x6b68('0x53'),0x8));}var _0x16d35b=_0x2b4d31['user'][_0x6b68('0x25')]({'plain':!![]});if(!_0x16d35b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16d35b['role']===_0x6b68('0x54')){var _0x2d9828=_0x5638fe[_0x6b68('0x25')]({'plain':!![]});return db[_0x6b68('0x55')][_0x6b68('0x4a')]({'where':{'name':_0x6b68('0x26'),'userProfileId':_0x16d35b[_0x6b68('0x56')]},'raw':!![]})[_0x6b68('0x23')](function(_0x5a2971){if(_0x5a2971&&_0x5a2971[_0x6b68('0x57')]===0x0){return db[_0x6b68('0x27')]['create']({'name':_0x2d9828[_0x6b68('0x2a')],'resourceId':_0x2d9828['id'],'type':_0x5a2971[_0x6b68('0x2a')],'sectionId':_0x5a2971['id']},{})[_0x6b68('0x23')](function(){return _0x5638fe;});}else{return _0x5638fe;}})[_0x6b68('0x47')](function(_0x333a42){logger['error'](_0x6b68('0x58'),_0x333a42);});}return _0x5638fe;});})['then'](respondWithResult(_0x3d348b,0xc9))['catch'](handleError(_0x3d348b,null));};exports[_0x6b68('0x24')]=function(_0x90105e,_0x3dd078,_0x48d3fb){var _0x54e1a2;return db[_0x6b68('0x42')][_0x6b68('0x4a')]({'where':{'id':_0x90105e[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](function(_0x32a134){if(_0x32a134){return db['sequelize'][_0x6b68('0x4e')](function(_0x4c8f2a){return _0x32a134[_0x6b68('0x24')]({'transaction':_0x4c8f2a,'raw':!![]})[_0x6b68('0x23')](function(_0x313856){if(_0x313856[_0x6b68('0x52')]){fs[_0x6b68('0x59')](_0x313856[_0x6b68('0x52')])[_0x6b68('0x5a')](function(_0x332228){fs[_0x6b68('0x5b')](path['join'](_0x313856['directory'],_0x332228));});fs[_0x6b68('0x5c')](_0x313856[_0x6b68('0x52')]);}return _0x313856;});})[_0x6b68('0x47')](function(_0x4d9e3e){throw new db[(_0x6b68('0x5d'))][(_0x6b68('0x5e'))](_0x4d9e3e[_0x6b68('0x5f')]);});}})[_0x6b68('0x23')](handleEntityNotFound(_0x3dd078,null))['then'](removeEntity(_0x3dd078,null))[_0x6b68('0x47')](handleError(_0x3dd078,null));};exports['addSound']=function(_0x15bb19,_0x4a7db1,_0x564897){return db[_0x6b68('0x4d')]['transaction'](function(_0xbcbe86){var _0x50ce3d;return db[_0x6b68('0x42')]['find']({'where':{'id':_0x15bb19[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](function(_0x424c17){if(_0x424c17){_0x50ce3d=_0x424c17;return _0x424c17[_0x6b68('0x60')](_0x15bb19[_0x6b68('0x4b')]['id'],{'transaction':_0xbcbe86});}})[_0x6b68('0x23')](function(_0xc0861a){if(_0xc0861a){return db[_0x6b68('0x61')][_0x6b68('0x62')]({'where':{'id':_0x15bb19[_0x6b68('0x4b')]['id']},'attributes':['id','name',_0x6b68('0x63'),_0x6b68('0x64'),_0x6b68('0x65')],'raw':!![]});}})[_0x6b68('0x23')](function(_0x4d8b3e){if(_0x4d8b3e){var _0x549eaa=path[_0x6b68('0x66')](config['root'],'server/files/sounds/converted',util[_0x6b68('0x67')]('%s.%s',path[_0x6b68('0x68')](_0x4d8b3e[_0x6b68('0x63')],path['extname'](_0x4d8b3e[_0x6b68('0x63')])),_0x4d8b3e[_0x6b68('0x64')]));var _0x2c4e88=path[_0x6b68('0x66')](config[_0x6b68('0x69')],_0x6b68('0x51'),_0x50ce3d[_0x6b68('0x2a')],util['format'](_0x6b68('0x6a'),_0x4d8b3e['name'],_0x4d8b3e[_0x6b68('0x64')]));fs['symlinkSync'](_0x549eaa,_0x2c4e88);return _0x4d8b3e;}})[_0x6b68('0x47')](function(_0x29a9b9){throw new db[(_0x6b68('0x5d'))][(_0x6b68('0x5e'))](_0x29a9b9[_0x6b68('0x5f')]);});})['then'](handleEntityNotFound(_0x4a7db1,null))[_0x6b68('0x23')](respondWithResult(_0x4a7db1,0xc9))[_0x6b68('0x47')](handleError(_0x4a7db1,null));};exports['removeSound']=function(_0x2d5e01,_0x5e6bd8,_0x169134){return db[_0x6b68('0x4d')][_0x6b68('0x4e')](function(_0x19173b){var _0x23c327;return db[_0x6b68('0x42')][_0x6b68('0x62')]({'where':{'id':_0x2d5e01[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x5e6bd8,null))[_0x6b68('0x23')](function(_0x125a3a){if(_0x125a3a){_0x23c327=_0x125a3a;return _0x125a3a[_0x6b68('0x6b')](_0x2d5e01[_0x6b68('0x49')]['id2']);}})[_0x6b68('0x23')](function(_0x4918e5){if(_0x4918e5){return db[_0x6b68('0x61')][_0x6b68('0x62')]({'where':{'id':_0x2d5e01[_0x6b68('0x49')][_0x6b68('0x6c')]},'attributes':['id',_0x6b68('0x2a'),_0x6b68('0x63'),_0x6b68('0x64'),_0x6b68('0x65')],'raw':!![]});}})['then'](function(_0x4059f7){if(_0x4059f7){fs['unlinkSync'](path['join'](_0x23c327[_0x6b68('0x52')],util['format']('%s.%s',_0x4059f7[_0x6b68('0x2a')],_0x4059f7[_0x6b68('0x64')])));return _0x4059f7;}})[_0x6b68('0x47')](function(_0x5124aa){throw new db['Sequelize'][(_0x6b68('0x5e'))](_0x5124aa['message']);});})['then'](handleEntityNotFound(_0x5e6bd8,null))[_0x6b68('0x23')](respondWithStatusCode(_0x5e6bd8,0xcc))[_0x6b68('0x47')](handleError(_0x5e6bd8,null));};exports[_0x6b68('0x6d')]=function(_0x3a2e69,_0x1ab5be,_0x3a9c8f){var _0x26eb8b={};var _0x27e5e8={};var _0x2341bf;var _0x45357c;return db[_0x6b68('0x42')]['findOne']({'where':{'id':_0x3a2e69[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x1ab5be,null))['then'](function(_0x5cdd33){if(_0x5cdd33){_0x2341bf=_0x5cdd33;_0x27e5e8[_0x6b68('0x31')]=_[_0x6b68('0x32')](db[_0x6b68('0x61')][_0x6b68('0x2d')]);_0x27e5e8[_0x6b68('0x33')]=_['keys'](_0x3a2e69[_0x6b68('0x33')]);_0x27e5e8[_0x6b68('0x34')]=_[_0x6b68('0x36')](_0x27e5e8['model'],_0x27e5e8[_0x6b68('0x33')]);_0x26eb8b['attributes']=_['intersection'](_0x27e5e8[_0x6b68('0x31')],qs[_0x6b68('0x37')](_0x3a2e69[_0x6b68('0x33')]['fields']));_0x26eb8b['attributes']=_0x26eb8b[_0x6b68('0x35')]['length']?_0x26eb8b[_0x6b68('0x35')]:_0x27e5e8[_0x6b68('0x31')];_0x26eb8b[_0x6b68('0x3a')]=qs[_0x6b68('0x3b')](_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3b')]);_0x26eb8b['where']=qs[_0x6b68('0x34')](_[_0x6b68('0x3d')](_0x3a2e69[_0x6b68('0x33')],_0x27e5e8[_0x6b68('0x34')]));if(_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3e')]){_0x26eb8b[_0x6b68('0x3c')]=_[_0x6b68('0x3f')](_0x26eb8b[_0x6b68('0x3c')],{'$or':_[_0x6b68('0x2c')](_0x26eb8b['attributes'],function(_0xc4bd50){var _0x4097a8={};_0x4097a8[_0xc4bd50]={'$like':'%'+_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3e')]+'%'};return _0x4097a8;})});}_0x26eb8b=_[_0x6b68('0x3f')]({},_0x26eb8b,_0x3a2e69[_0x6b68('0x41')]);return _0x2341bf[_0x6b68('0x6d')](_0x26eb8b);}})['then'](function(_0x30aacc){if(_0x30aacc){_0x45357c=_0x30aacc[_0x6b68('0x38')];if(!_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x39')](_0x6b68('0x6e'))){_0x26eb8b['limit']=qs[_0x6b68('0x1e')](_0x3a2e69['query'][_0x6b68('0x1e')]);_0x26eb8b[_0x6b68('0x1d')]=qs[_0x6b68('0x1d')](_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x1d')]);}return _0x2341bf[_0x6b68('0x6d')](_0x26eb8b);}})[_0x6b68('0x23')](function(_0x42dc4c){if(_0x42dc4c){return _0x42dc4c?{'count':_0x45357c,'rows':_0x42dc4c}:null;}})[_0x6b68('0x23')](respondWithResult(_0x1ab5be,null))[_0x6b68('0x47')](handleError(_0x1ab5be,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4705934..84ccd4c 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 _0x68e4=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','api','moment','bluebird'];(function(_0x7810d4,_0x26d275){var _0x526aa1=function(_0x3ff962){while(--_0x3ff962){_0x7810d4['push'](_0x7810d4['shift']());}};_0x526aa1(++_0x26d275);}(_0x68e4,0x1b7));var _0x468e=function(_0xa94ece,_0x7974e6){_0xa94ece=_0xa94ece-0x0;var _0x47a2a4=_0x68e4[_0xa94ece];return _0x47a2a4;};'use strict';var _=require(_0x468e('0x0'));var util=require(_0x468e('0x1'));var logger=require('../../config/logger')(_0x468e('0x2'));var moment=require(_0x468e('0x3'));var BPromise=require(_0x468e('0x4'));var rp=require(_0x468e('0x5'));var fs=require('fs');var path=require(_0x468e('0x6'));var rimraf=require('rimraf');var config=require(_0x468e('0x7'));var attributes=require(_0x468e('0x8'));module[_0x468e('0x9')]=function(_0x4d2c2a,_0x4f7177){return _0x4d2c2a[_0x468e('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x468e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb262=['VoiceMusicOnHold','voice_musiconhold','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x4e8971,_0x2055b1){var _0x269ff4=function(_0x269d47){while(--_0x269d47){_0x4e8971['push'](_0x4e8971['shift']());}};_0x269ff4(++_0x2055b1);}(_0xb262,0x70));var _0x2b26=function(_0x1054fb,_0x2ea752){_0x1054fb=_0x1054fb-0x0;var _0x36507b=_0xb262[_0x1054fb];return _0x36507b;};'use strict';var _=require(_0x2b26('0x0'));var util=require(_0x2b26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b26('0x2'));var BPromise=require(_0x2b26('0x3'));var rp=require(_0x2b26('0x4'));var fs=require('fs');var path=require(_0x2b26('0x5'));var rimraf=require(_0x2b26('0x6'));var config=require(_0x2b26('0x7'));var attributes=require(_0x2b26('0x8'));module['exports']=function(_0x258307,_0x291195){return _0x258307['define'](_0x2b26('0x9'),attributes,{'tableName':_0x2b26('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 31c70ec..b8627dc 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 _0x210b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x33974c,_0x406989){var _0xa0c564=function(_0x4a5aa3){while(--_0x4a5aa3){_0x33974c['push'](_0x33974c['shift']());}};_0xa0c564(++_0x406989);}(_0x210b,0x1df));var _0xb210=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x210b[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0xb210('0x0'));var util=require(_0xb210('0x1'));var moment=require(_0xb210('0x2'));var BPromise=require(_0xb210('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb210('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb210('0x5'));var logger=require(_0xb210('0x6'))('rpc');var config=require(_0xb210('0x7'));var jayson=require(_0xb210('0x8'));var client=jayson[_0xb210('0x9')][_0xb210('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x294080,_0x54681c,_0x3876a9){return new BPromise(function(_0x5d1eef,_0x5ec19e){return client[_0xb210('0xb')](_0x294080,_0x3876a9)[_0xb210('0xc')](function(_0x49db56){logger[_0xb210('0xd')](_0xb210('0xe'),_0x54681c,'request\x20sent');logger[_0xb210('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x54681c,_0xb210('0x10'),JSON[_0xb210('0x11')](_0x49db56));if(_0x49db56[_0xb210('0x12')]){if(_0x49db56[_0xb210('0x12')][_0xb210('0x13')]===0x1f4){logger['error'](_0xb210('0xe'),_0x54681c,_0x49db56[_0xb210('0x12')][_0xb210('0x14')]);return _0x5ec19e(_0x49db56[_0xb210('0x12')][_0xb210('0x14')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x54681c,_0x49db56[_0xb210('0x12')]['message']);return _0x5d1eef(_0x49db56['error'][_0xb210('0x14')]);}else{logger[_0xb210('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x54681c,_0xb210('0x10'));_0x5d1eef(_0x49db56['result']['message']);}})[_0xb210('0x15')](function(_0x31eb8d){logger[_0xb210('0x12')](_0xb210('0xe'),_0x54681c,_0x31eb8d);_0x5ec19e(_0x31eb8d);});});} \ No newline at end of file +var _0x92da=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4b5260,_0xcab6a2){var _0x16a58b=function(_0x168aba){while(--_0x168aba){_0x4b5260['push'](_0x4b5260['shift']());}};_0x16a58b(++_0xcab6a2);}(_0x92da,0x11c));var _0xa92d=function(_0x570e36,_0x33917c){_0x570e36=_0x570e36-0x0;var _0x56581a=_0x92da[_0x570e36];return _0x56581a;};'use strict';var _=require(_0xa92d('0x0'));var util=require(_0xa92d('0x1'));var moment=require(_0xa92d('0x2'));var BPromise=require(_0xa92d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92d('0x4'))['db'];var utils=require(_0xa92d('0x5'));var logger=require(_0xa92d('0x6'))(_0xa92d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa92d('0x8'));var client=jayson[_0xa92d('0x9')][_0xa92d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2ff2,_0x284580,_0x3ff8d7){return new BPromise(function(_0x4db8d7,_0x5eacb3){return client[_0xa92d('0xb')](_0x1a2ff2,_0x3ff8d7)[_0xa92d('0xc')](function(_0x121724){logger[_0xa92d('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x284580,_0xa92d('0xe'));logger[_0xa92d('0xf')](_0xa92d('0x10'),_0x284580,_0xa92d('0xe'),JSON[_0xa92d('0x11')](_0x121724));if(_0x121724['error']){if(_0x121724[_0xa92d('0x12')][_0xa92d('0x13')]===0x1f4){logger[_0xa92d('0x12')](_0xa92d('0x14'),_0x284580,_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);return _0x5eacb3(_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);}logger['error'](_0xa92d('0x14'),_0x284580,_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);return _0x4db8d7(_0x121724[_0xa92d('0x12')]['message']);}else{logger[_0xa92d('0xd')](_0xa92d('0x14'),_0x284580,_0xa92d('0xe'));_0x4db8d7(_0x121724[_0xa92d('0x16')]['message']);}})[_0xa92d('0x17')](function(_0x1c354e){logger[_0xa92d('0x12')](_0xa92d('0x14'),_0x284580,_0x1c354e);_0x5eacb3(_0x1c354e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 94d32cc..bda4b1a 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 _0xce78=['express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeAgents','exports','multer','connect-timeout'];(function(_0x535589,_0x4e5568){var _0x14b9c2=function(_0xc783ef){while(--_0xc783ef){_0x535589['push'](_0x535589['shift']());}};_0x14b9c2(++_0x4e5568);}(_0xce78,0xfa));var _0x8ce7=function(_0x20116d,_0x39b844){_0x20116d=_0x20116d-0x0;var _0x39ecfb=_0xce78[_0x20116d];return _0x39ecfb;};'use strict';var multer=require(_0x8ce7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ce7('0x1'));var express=require(_0x8ce7('0x2'));var router=express[_0x8ce7('0x3')]();var auth=require(_0x8ce7('0x4'));var interaction=require(_0x8ce7('0x5'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x8ce7('0x6')](),controller['index']);router[_0x8ce7('0x7')]('/describe',auth[_0x8ce7('0x6')](),controller[_0x8ce7('0x8')]);router[_0x8ce7('0x7')](_0x8ce7('0x9'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xa')]);router[_0x8ce7('0x7')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xc')]);router[_0x8ce7('0xd')]('/',auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xe')]);router[_0x8ce7('0xd')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0xf')]);router[_0x8ce7('0x10')](_0x8ce7('0x9'),auth['isAuthenticated'](),controller[_0x8ce7('0x11')]);router[_0x8ce7('0x12')](_0x8ce7('0x9'),auth[_0x8ce7('0x6')](),controller['destroy']);router[_0x8ce7('0x12')](_0x8ce7('0xb'),auth[_0x8ce7('0x6')](),controller[_0x8ce7('0x13')]);module[_0x8ce7('0x14')]=router; \ No newline at end of file +var _0xc9c5=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','put','update','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc9c5,0xdf));var _0x5c9c=function(_0x42fc3e,_0xdc5885){_0x42fc3e=_0x42fc3e-0x0;var _0x52e1fa=_0xc9c5[_0x42fc3e];return _0x52e1fa;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require(_0x5c9c('0x1'));var path=require(_0x5c9c('0x2'));var timeout=require(_0x5c9c('0x3'));var express=require(_0x5c9c('0x4'));var router=express[_0x5c9c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c9c('0x6'));var config=require(_0x5c9c('0x7'));var controller=require(_0x5c9c('0x8'));router[_0x5c9c('0x9')]('/',auth[_0x5c9c('0xa')](),controller['index']);router[_0x5c9c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5c9c('0xb')]);router['get'](_0x5c9c('0xc'),auth[_0x5c9c('0xa')](),controller[_0x5c9c('0xd')]);router['get'](_0x5c9c('0xe'),auth[_0x5c9c('0xa')](),controller[_0x5c9c('0xf')]);router[_0x5c9c('0x10')]('/',auth[_0x5c9c('0xa')](),controller[_0x5c9c('0x11')]);router[_0x5c9c('0x10')](_0x5c9c('0xe'),auth[_0x5c9c('0xa')](),controller['addAgents']);router[_0x5c9c('0x12')]('/:id',auth[_0x5c9c('0xa')](),controller[_0x5c9c('0x13')]);router['delete'](_0x5c9c('0xc'),auth['isAuthenticated'](),controller[_0x5c9c('0x14')]);router[_0x5c9c('0x15')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5c9c('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c6cdd1e..fdaf9df 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 _0xd98c=['sequelize','exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x3ed5e8,_0x2ceeef){var _0x19f6c5=function(_0x25d348){while(--_0x25d348){_0x3ed5e8['push'](_0x3ed5e8['shift']());}};_0x19f6c5(++_0x2ceeef);}(_0xd98c,0x168));var _0xcd98=function(_0x5d6654,_0x2a2ac6){_0x5d6654=_0x5d6654-0x0;var _0x4bb038=_0xd98c[_0x5d6654];return _0x4bb038;};'use strict';var Sequelize=require(_0xcd98('0x0'));module[_0xcd98('0x1')]={'name':{'type':Sequelize[_0xcd98('0x2')],'allowNull':![],'unique':_0xcd98('0x3')},'prefix':{'type':Sequelize[_0xcd98('0x4')],'get':function(_0x26fdf3){return'system-'+this['getDataValue'](_0xcd98('0x3'))+'-';}},'description':{'type':Sequelize[_0xcd98('0x2')]},'callerIdAll':{'type':Sequelize[_0xcd98('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xcd98('0x5')]}}; \ No newline at end of file +var _0xd450=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0xd450,0x157));var _0x0d45=function(_0x41fc60,_0x5e5ec6){_0x41fc60=_0x41fc60-0x0;var _0x164ee9=_0xd450[_0x41fc60];return _0x164ee9;};'use strict';var Sequelize=require(_0x0d45('0x0'));module[_0x0d45('0x1')]={'name':{'type':Sequelize[_0x0d45('0x2')],'allowNull':![],'unique':_0x0d45('0x3')},'prefix':{'type':Sequelize[_0x0d45('0x4')],'get':function(_0x3c3e73){return _0x0d45('0x5')+this[_0x0d45('0x6')](_0x0d45('0x3'))+'-';}},'description':{'type':Sequelize[_0x0d45('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0d45('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ecea01d..1b8699f 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 _0x2484=['rows','catch','show','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','context','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','push','CDR(prefix)=','Set','callerIdAll','goto','${EXTEN:','charAt','body','sequelize','transaction','findById','ids','omit','emit','removeAgents','userVoicePrefix:remove','findOne','rawAttributes','pick','nolimit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','filter','merge','type','options','VoicePrefix','includeAll'];(function(_0x52bdbf,_0x4d6527){var _0x5d51c8=function(_0x2975e3){while(--_0x2975e3){_0x52bdbf['push'](_0x52bdbf['shift']());}};_0x5d51c8(++_0x4d6527);}(_0x2484,0x178));var _0x4248=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x2484[_0x1f44e4];return _0x591989;};'use strict';var pdf=require(_0x4248('0x0'));var emlformat=require(_0x4248('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4248('0x2'));var jsonpatch=require(_0x4248('0x3'));var rp=require(_0x4248('0x4'));var moment=require(_0x4248('0x5'));var BPromise=require(_0x4248('0x6'));var Mustache=require(_0x4248('0x7'));var util=require(_0x4248('0x8'));var path=require('path');var sox=require(_0x4248('0x9'));var csv=require(_0x4248('0xa'));var ejs=require(_0x4248('0xb'));var fs=require('fs');var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4248('0xf'));var toCsv=require(_0x4248('0xa'));var querystring=require(_0x4248('0x10'));var Papa=require(_0x4248('0x11'));var Redis=require(_0x4248('0x12'));var authService=require(_0x4248('0x13'));var qs=require(_0x4248('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x15'));var logger=require('../../config/logger')(_0x4248('0x16'));var utils=require(_0x4248('0x17'));var config=require(_0x4248('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4248('0x19')]=_['defaults'](config[_0x4248('0x19')],{'host':_0x4248('0x1a'),'port':0x18eb});var socket=require(_0x4248('0x1b'))(new Redis(config[_0x4248('0x19')]));require(_0x4248('0x1c'))['register'](socket);function respondWithStatusCode(_0x8b30bb,_0xada934){_0xada934=_0xada934||0xcc;return function(_0x1ae491){if(_0x1ae491){return _0x8b30bb[_0x4248('0x1d')](_0xada934);}return _0x8b30bb[_0x4248('0x1e')](_0xada934)['end']();};}function respondWithResult(_0x46cfbb,_0xe1ab31){_0xe1ab31=_0xe1ab31||0xc8;return function(_0x3283f2){if(_0x3283f2){return _0x46cfbb[_0x4248('0x1e')](_0xe1ab31)[_0x4248('0x1f')](_0x3283f2);}};}function respondWithFilteredResult(_0x321e92,_0x46fbc9){return function(_0x45edc6){if(_0x45edc6){var _0x29f080=_0x45edc6[_0x4248('0x20')],_0xd03b87=_0x46fbc9[_0x4248('0x21')],_0x2c2a0d=_0x46fbc9[_0x4248('0x21')]+_0x46fbc9[_0x4248('0x22')],_0x2f7547;if(_0x2c2a0d>=_0x29f080){_0x2c2a0d=_0x29f080;_0x2f7547=0xc8;}else{_0x2f7547=0xce;}_0x321e92[_0x4248('0x1e')](_0x2f7547);return _0x321e92[_0x4248('0x23')]('Content-Range',_0xd03b87+'-'+_0x2c2a0d+'/'+_0x29f080)[_0x4248('0x1f')](_0x45edc6);}return null;};}function patchUpdates(_0x2e7d6e){return function(_0x2d674b){try{jsonpatch[_0x4248('0x24')](_0x2d674b,_0x2e7d6e,!![]);}catch(_0x4b6c12){return BPromise[_0x4248('0x25')](_0x4b6c12);}return _0x2d674b[_0x4248('0x26')]();};}function saveUpdates(_0x30b232,_0x57ce09){return function(_0x45b777){if(_0x45b777){return _0x45b777[_0x4248('0x27')](_0x30b232)['then'](function(_0x3bfcf2){return _0x3bfcf2;});}return null;};}function removeEntity(_0x598681,_0x18070b){return function(_0x138ac1){if(_0x138ac1){return _0x138ac1[_0x4248('0x28')]()[_0x4248('0x29')](function(){var _0x5a3938=_0x138ac1[_0x4248('0x2a')]({'plain':!![]});var _0x205382=_0x4248('0x2b');return db[_0x4248('0x2c')][_0x4248('0x28')]({'where':{'type':_0x205382,'resourceId':_0x5a3938['id']}})[_0x4248('0x29')](function(){return _0x138ac1;});})[_0x4248('0x29')](function(){_0x598681[_0x4248('0x1e')](0xcc)[_0x4248('0x2d')]();});}};}function handleEntityNotFound(_0x1f26be,_0x3b29fe){return function(_0x45e678){if(!_0x45e678){_0x1f26be[_0x4248('0x1d')](0x194);}return _0x45e678;};}function handleError(_0xf72ecc,_0xf06a1a){_0xf06a1a=_0xf06a1a||0x1f4;return function(_0x439859){logger['error'](_0x439859[_0x4248('0x2e')]);if(_0x439859[_0x4248('0x2f')]){delete _0x439859[_0x4248('0x2f')];}_0xf72ecc['status'](_0xf06a1a)[_0x4248('0x30')](_0x439859);};}exports[_0x4248('0x31')]=function(_0x5654f5,_0x45dd44){var _0x53294f={},_0x3d6bef={},_0xf8e412={'count':0x0,'rows':[]};var _0x51a1bc=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x5c2d98){return{'name':_0x5c2d98['fieldName'],'type':_0x5c2d98['type']['key']};});_0x3d6bef['model']=_[_0x4248('0x32')](_0x51a1bc,_0x4248('0x2f'));_0x3d6bef[_0x4248('0x33')]=_[_0x4248('0x34')](_0x5654f5['query']);_0x3d6bef[_0x4248('0x35')]=_['intersection'](_0x3d6bef[_0x4248('0x36')],_0x3d6bef[_0x4248('0x33')]);_0x53294f[_0x4248('0x37')]=_[_0x4248('0x38')](_0x3d6bef['model'],qs['fields'](_0x5654f5[_0x4248('0x33')][_0x4248('0x39')]));_0x53294f[_0x4248('0x37')]=_0x53294f[_0x4248('0x37')][_0x4248('0x3a')]?_0x53294f[_0x4248('0x37')]:_0x3d6bef[_0x4248('0x36')];if(!_0x5654f5[_0x4248('0x33')]['hasOwnProperty']('nolimit')){_0x53294f['limit']=qs[_0x4248('0x22')](_0x5654f5['query'][_0x4248('0x22')]);_0x53294f[_0x4248('0x21')]=qs[_0x4248('0x21')](_0x5654f5[_0x4248('0x33')][_0x4248('0x21')]);}_0x53294f[_0x4248('0x3b')]=qs[_0x4248('0x3c')](_0x5654f5[_0x4248('0x33')]['sort']);_0x53294f[_0x4248('0x3d')]=qs[_0x4248('0x35')](_['pick'](_0x5654f5[_0x4248('0x33')],_0x3d6bef[_0x4248('0x35')]),_0x51a1bc);if(_0x5654f5['query'][_0x4248('0x3e')]){_0x53294f[_0x4248('0x3d')]=_[_0x4248('0x3f')](_0x53294f[_0x4248('0x3d')],{'$or':_[_0x4248('0x32')](_0x51a1bc,function(_0x5e2f54){if(_0x5e2f54[_0x4248('0x40')]!=='VIRTUAL'){var _0x5ef913={};_0x5ef913[_0x5e2f54[_0x4248('0x2f')]]={'$like':'%'+_0x5654f5[_0x4248('0x33')][_0x4248('0x3e')]+'%'};return _0x5ef913;}})});}_0x53294f=_[_0x4248('0x3f')]({},_0x53294f,_0x5654f5[_0x4248('0x41')]);var _0x242ee6={'where':_0x53294f[_0x4248('0x3d')]};return db[_0x4248('0x42')][_0x4248('0x20')](_0x242ee6)[_0x4248('0x29')](function(_0x53ee5e){_0xf8e412[_0x4248('0x20')]=_0x53ee5e;if(_0x5654f5[_0x4248('0x33')][_0x4248('0x43')]){_0x53294f['include']=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x53294f);})[_0x4248('0x29')](function(_0x6988fb){_0xf8e412[_0x4248('0x44')]=_0x6988fb;return _0xf8e412;})[_0x4248('0x29')](respondWithFilteredResult(_0x45dd44,_0x53294f))[_0x4248('0x45')](handleError(_0x45dd44,null));};exports[_0x4248('0x46')]=function(_0x5bbe59,_0x3073f1){var _0x35a360={'raw':![],'where':{'id':_0x5bbe59['params']['id']}},_0x32bc46={};_0x32bc46[_0x4248('0x36')]=_[_0x4248('0x34')](db[_0x4248('0x42')]['rawAttributes']);_0x32bc46['query']=_[_0x4248('0x34')](_0x5bbe59[_0x4248('0x33')]);_0x32bc46[_0x4248('0x35')]=_[_0x4248('0x38')](_0x32bc46['model'],_0x32bc46[_0x4248('0x33')]);_0x35a360[_0x4248('0x37')]=_['intersection'](_0x32bc46[_0x4248('0x36')],qs['fields'](_0x5bbe59[_0x4248('0x33')][_0x4248('0x39')]));_0x35a360['attributes']=_0x35a360[_0x4248('0x37')]['length']?_0x35a360[_0x4248('0x37')]:_0x32bc46[_0x4248('0x36')];if(_0x5bbe59[_0x4248('0x33')][_0x4248('0x43')]){_0x35a360['include']=[{'all':!![]}];}_0x35a360=_['merge']({},_0x35a360,_0x5bbe59['options']);return db[_0x4248('0x42')][_0x4248('0x47')](_0x35a360)[_0x4248('0x29')](handleEntityNotFound(_0x3073f1,null))[_0x4248('0x29')](respondWithResult(_0x3073f1,null))['catch'](handleError(_0x3073f1,null));};exports[_0x4248('0x28')]=function(_0x2e9a5c,_0x79919){return db[_0x4248('0x42')]['find']({'where':{'id':_0x2e9a5c[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x79919,null))[_0x4248('0x29')](removeEntity(_0x79919,null))[_0x4248('0x45')](handleError(_0x79919,null));};exports[_0x4248('0x49')]=function(_0x91f37e,_0x2680ad){return db[_0x4248('0x42')][_0x4248('0x49')]()['then'](respondWithResult(_0x2680ad,null))[_0x4248('0x45')](handleError(_0x2680ad,null));};exports[_0x4248('0x4a')]=function(_0x449760,_0x2283c6){var _0x468e11;return db['sequelize']['transaction'](function(_0x27e3a5){return db[_0x4248('0x42')][_0x4248('0x4a')](_0x449760['body'],{'transaction':_0x27e3a5})['then'](function(_0x1759bb){_0x468e11=_0x1759bb[_0x4248('0x2a')]({'plain':!![]});return db[_0x4248('0x4b')][_0x4248('0x47')]({'where':{'id':_0x468e11[_0x4248('0x4c')]},'raw':!![]})[_0x4248('0x29')](function(_0x273367){return createVoicePrefixExtensions(_0x468e11,_0x273367,_0x27e3a5);});});})['then'](function(){var _0x577657=_0x449760[_0x4248('0x4d')][_0x4248('0x2a')]({'plain':!![]});if(!_0x577657)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577657[_0x4248('0x4e')]===_0x4248('0x4d')){var _0x5711b3=_0x468e11;return db[_0x4248('0x4f')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x577657[_0x4248('0x50')]},'raw':!![]})[_0x4248('0x29')](function(_0x2b25d1){if(_0x2b25d1&&_0x2b25d1[_0x4248('0x51')]===0x0){return db[_0x4248('0x2c')]['create']({'name':_0x5711b3['name'],'resourceId':_0x5711b3['id'],'type':_0x2b25d1[_0x4248('0x2f')],'sectionId':_0x2b25d1['id']},{})['then'](function(){return _0x468e11;});}else{return _0x468e11;}})[_0x4248('0x45')](function(_0x406d51){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406d51);throw _0x406d51;});}return _0x468e11;})['then'](respondWithResult(_0x2283c6,null))[_0x4248('0x45')](handleError(_0x2283c6,null));};function Extension(_0x8b5f45,_0x3762a3,_0x26ba5a,_0x7fd6){this[_0x4248('0x52')]='from-sip';this[_0x4248('0x53')]=_0x8b5f45;this['app']=_0x26ba5a;this[_0x4248('0x40')]='system';this[_0x4248('0x54')]=_0x4248('0x55');this[_0x4248('0x56')]=_0x3762a3;this['appdata']=_0x7fd6;}function createVoicePrefixExtensions(_0x5f3f67,_0x57bded,_0x4bd6e3){return new BPromise(function(_0x2b4e90,_0x5d7366){var _0x47e5af=new Extension(formatPrefixName(_0x5f3f67[_0x4248('0x57')]),0x1,_0x4248('0x58'),'Voice\x20Prefix');_0x47e5af[_0x4248('0x59')]=_0x5f3f67['id'];return db['VoiceExtension'][_0x4248('0x4a')](_0x47e5af,{'transaction':_0x4bd6e3})[_0x4248('0x29')](function(_0x502de8){var _0x3c3f95=_0x502de8['get']({'plain':!![]});var _0xdc0fdc=_[_0x4248('0x32')](addVoicePrefixExtensions(_0x5f3f67,_0x57bded),function(_0xa30ddf){_0xa30ddf[_0x4248('0x4c')]=_0x3c3f95['id'];_0xa30ddf['VoicePrefixId']=_0x5f3f67['id'];return _0xa30ddf;});return db[_0x4248('0x4b')]['bulkCreate'](_0xdc0fdc,{'transaction':_0x4bd6e3})['then'](function(_0x1e7e51){if(!_0x1e7e51){return _0x5d7366('Extensions\x20creation\x20failed');}else{return _0x2b4e90(_0x1e7e51);}})[_0x4248('0x45')](function(_0x211b3f){return _0x5d7366(_0x211b3f);});});;});};function addVoicePrefixExtensions(_0x1dba00,_0x49d730){var _0x423ae8=[];var _0x2df96c=formatPrefixName(_0x1dba00[_0x4248('0x57')]);_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x2,'Set',_0x4248('0x5b')+_0x1dba00[_0x4248('0x2f')]));if(_0x1dba00['callerIdAll']){_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x3,_0x4248('0x5c'),'PREFIX-CALLERIDALL='+_0x1dba00[_0x4248('0x5d')]));}else{_0x423ae8[_0x4248('0x5a')](new Extension(_0x2df96c,0x3,_0x4248('0x58'),'No\x20callerid\x20available'));}_0x423ae8['push'](new Extension(_0x2df96c,0x4,_0x4248('0x5e'),_0x49d730[_0x4248('0x52')]+','+_0x4248('0x5f')+(0x8+_0x1dba00[_0x4248('0x2f')][_0x4248('0x3a')])+'}'+','+0x1));return _0x423ae8;}function formatPrefixName(_0xc1594e){var _0x18e1de='_';for(var _0x14b714=0x0;_0x14b714<_0xc1594e[_0x4248('0x3a')];_0x14b714++){if(_0xc1594e[_0x4248('0x60')](_0x14b714)=='-'){_0x18e1de+=_0xc1594e[_0x4248('0x60')](_0x14b714);}else{_0x18e1de+='['+_0xc1594e[_0x4248('0x60')](_0x14b714)+']';}}_0x18e1de+='.';return _0x18e1de;}exports[_0x4248('0x27')]=function(_0x16ab26,_0xe743a6,_0x432383){var _0x2e53b4=_0x16ab26[_0x4248('0x61')];_0x2e53b4['prefix']='system-'+_0x2e53b4[_0x4248('0x2f')]+'-';return db[_0x4248('0x62')][_0x4248('0x63')](function(_0x4d93b0){return db['VoicePrefix']['update'](_0x2e53b4,{'where':{'id':_0x2e53b4['id']},'transaction':_0x4d93b0})[_0x4248('0x29')](function(){return db['VoiceExtension'][_0x4248('0x28')]({'where':{'VoicePrefixId':_0x2e53b4['id']},'transaction':_0x4d93b0})[_0x4248('0x29')](function(){return db[_0x4248('0x4b')]['find']({'where':{'id':_0x2e53b4[_0x4248('0x4c')]},'raw':!![]})[_0x4248('0x29')](function(_0x259666){return createVoicePrefixExtensions(_0x2e53b4,_0x259666,_0x4d93b0);});});});})[_0x4248('0x29')](function(){return db[_0x4248('0x42')][_0x4248('0x64')](_0x2e53b4['id']);})[_0x4248('0x29')](respondWithResult(_0xe743a6,null))[_0x4248('0x45')](handleError(_0xe743a6,null));};exports['addAgents']=function(_0xd4325e,_0x3c5b3d,_0x37dc61){return db['VoicePrefix'][_0x4248('0x47')]({'where':{'id':_0xd4325e[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x3c5b3d,null))[_0x4248('0x29')](function(_0x6ce29){if(_0x6ce29){return _0x6ce29['addAgents'](_0xd4325e[_0x4248('0x61')][_0x4248('0x65')],_[_0x4248('0x66')](_0xd4325e[_0x4248('0x61')],[_0x4248('0x65'),'id'])||{})['spread'](function(_0x5a5508){for(var _0xcfc0a8=0x0;_0xcfc0a8<_0xd4325e[_0x4248('0x61')][_0x4248('0x65')]['length'];_0xcfc0a8+=0x1){socket[_0x4248('0x67')]('userVoicePrefix:save',{'UserId':_0xd4325e[_0x4248('0x61')]['ids'][_0xcfc0a8],'VoicePrefixId':_0xd4325e['params']['id']});}return _0x5a5508;});}})[_0x4248('0x29')](respondWithResult(_0x3c5b3d,null))[_0x4248('0x45')](handleError(_0x3c5b3d,null));};exports[_0x4248('0x68')]=function(_0x4638de,_0x4e4d43,_0x3bd1ad){return db[_0x4248('0x42')][_0x4248('0x47')]({'where':{'id':_0x4638de[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x4e4d43,null))[_0x4248('0x29')](function(_0x361636){if(_0x361636){return _0x361636[_0x4248('0x68')](_0x4638de[_0x4248('0x33')][_0x4248('0x65')])[_0x4248('0x29')](function(){if(_['isArray'](_0x4638de[_0x4248('0x33')][_0x4248('0x65')])){for(var _0x2b8126=0x0;_0x2b8126<_0x4638de['query']['ids'][_0x4248('0x3a')];_0x2b8126+=0x1){socket[_0x4248('0x67')](_0x4248('0x69'),{'UserId':Number(_0x4638de[_0x4248('0x33')][_0x4248('0x65')][_0x2b8126]),'VoicePrefixId':Number(_0x4638de[_0x4248('0x48')]['id'])});}}else{socket['emit'](_0x4248('0x69'),{'UserId':Number(_0x4638de[_0x4248('0x33')][_0x4248('0x65')]),'VoicePrefixId':Number(_0x4638de['params']['id'])});}});}})[_0x4248('0x29')](respondWithStatusCode(_0x4e4d43,null))[_0x4248('0x45')](handleError(_0x4e4d43,null));};exports['getAgents']=function(_0x449cda,_0x5b3686,_0x2b2f29){var _0x4a1d37={};var _0xdcc91f={};var _0x5e9036;var _0x62683;return db[_0x4248('0x42')][_0x4248('0x6a')]({'where':{'id':_0x449cda[_0x4248('0x48')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x5b3686,null))[_0x4248('0x29')](function(_0x124054){if(_0x124054){_0x5e9036=_0x124054;_0xdcc91f[_0x4248('0x36')]=_['keys'](db['User'][_0x4248('0x6b')]);_0xdcc91f[_0x4248('0x33')]=_[_0x4248('0x34')](_0x449cda[_0x4248('0x33')]);_0xdcc91f[_0x4248('0x35')]=_[_0x4248('0x38')](_0xdcc91f[_0x4248('0x36')],_0xdcc91f['query']);_0x4a1d37[_0x4248('0x37')]=_[_0x4248('0x38')](_0xdcc91f[_0x4248('0x36')],qs[_0x4248('0x39')](_0x449cda[_0x4248('0x33')][_0x4248('0x39')]));_0x4a1d37[_0x4248('0x37')]=_0x4a1d37[_0x4248('0x37')]['length']?_0x4a1d37[_0x4248('0x37')]:_0xdcc91f[_0x4248('0x36')];_0x4a1d37[_0x4248('0x3b')]=qs[_0x4248('0x3c')](_0x449cda[_0x4248('0x33')][_0x4248('0x3c')]);_0x4a1d37[_0x4248('0x3d')]=qs['filters'](_[_0x4248('0x6c')](_0x449cda[_0x4248('0x33')],_0xdcc91f[_0x4248('0x35')]));if(_0x449cda[_0x4248('0x33')][_0x4248('0x3e')]){_0x4a1d37[_0x4248('0x3d')]=_[_0x4248('0x3f')](_0x4a1d37[_0x4248('0x3d')],{'$or':_[_0x4248('0x32')](_0x4a1d37['attributes'],function(_0x187ebd){var _0x474923={};_0x474923[_0x187ebd]={'$like':'%'+_0x449cda[_0x4248('0x33')][_0x4248('0x3e')]+'%'};return _0x474923;})});}_0x4a1d37=_['merge']({},_0x4a1d37,_0x449cda['options']);return _0x5e9036['getAgents'](_0x4a1d37);}})[_0x4248('0x29')](function(_0x36f9ea){if(_0x36f9ea){_0x62683=_0x36f9ea[_0x4248('0x3a')];if(!_0x449cda[_0x4248('0x33')]['hasOwnProperty'](_0x4248('0x6d'))){_0x4a1d37[_0x4248('0x22')]=qs[_0x4248('0x22')](_0x449cda['query'][_0x4248('0x22')]);_0x4a1d37[_0x4248('0x21')]=qs['offset'](_0x449cda['query']['offset']);}return _0x5e9036[_0x4248('0x6e')](_0x4a1d37);}})[_0x4248('0x29')](function(_0x5cb424){if(_0x5cb424){return _0x5cb424?{'count':_0x62683,'rows':_0x5cb424}:null;}})[_0x4248('0x29')](respondWithResult(_0x5b3686,null))[_0x4248('0x45')](handleError(_0x5b3686,null));}; \ No newline at end of file +var _0x6363=['filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','body','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x1fe100,_0x3874e3){var _0x581d5d=function(_0x4c0950){while(--_0x4c0950){_0x1fe100['push'](_0x1fe100['shift']());}};_0x581d5d(++_0x3874e3);}(_0x6363,0x13a));var _0x3636=function(_0x3e1f2d,_0xa30add){_0x3e1f2d=_0x3e1f2d-0x0;var _0x113330=_0x6363[_0x3e1f2d];return _0x113330;};'use strict';var pdf=require(_0x3636('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3636('0x1'));var zipdir=require(_0x3636('0x2'));var jsonpatch=require(_0x3636('0x3'));var rp=require(_0x3636('0x4'));var moment=require(_0x3636('0x5'));var BPromise=require(_0x3636('0x6'));var Mustache=require(_0x3636('0x7'));var util=require(_0x3636('0x8'));var path=require(_0x3636('0x9'));var sox=require(_0x3636('0xa'));var csv=require(_0x3636('0xb'));var ejs=require(_0x3636('0xc'));var fs=require('fs');var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xb'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];config[_0x3636('0x1a')]=_[_0x3636('0x1b')](config[_0x3636('0x1a')],{'host':_0x3636('0x1c'),'port':0x18eb});var socket=require(_0x3636('0x1d'))(new Redis(config[_0x3636('0x1a')]));require(_0x3636('0x1e'))[_0x3636('0x1f')](socket);function respondWithStatusCode(_0x7b4b16,_0x102f90){_0x102f90=_0x102f90||0xcc;return function(_0xaacadb){if(_0xaacadb){return _0x7b4b16[_0x3636('0x20')](_0x102f90);}return _0x7b4b16[_0x3636('0x21')](_0x102f90)[_0x3636('0x22')]();};}function respondWithResult(_0x3cbd0d,_0x2dbd4d){_0x2dbd4d=_0x2dbd4d||0xc8;return function(_0x50474f){if(_0x50474f){return _0x3cbd0d[_0x3636('0x21')](_0x2dbd4d)[_0x3636('0x23')](_0x50474f);}};}function respondWithFilteredResult(_0x4aa7fc,_0xe3be56){return function(_0x5aa0ff){if(_0x5aa0ff){var _0x5e85f2=_0x5aa0ff[_0x3636('0x24')],_0xae6469=_0xe3be56[_0x3636('0x25')],_0x337e3d=_0xe3be56[_0x3636('0x25')]+_0xe3be56[_0x3636('0x26')],_0xdba761;if(_0x337e3d>=_0x5e85f2){_0x337e3d=_0x5e85f2;_0xdba761=0xc8;}else{_0xdba761=0xce;}_0x4aa7fc[_0x3636('0x21')](_0xdba761);return _0x4aa7fc['set']('Content-Range',_0xae6469+'-'+_0x337e3d+'/'+_0x5e85f2)[_0x3636('0x23')](_0x5aa0ff);}return null;};}function patchUpdates(_0x34a975){return function(_0x42b271){try{jsonpatch['apply'](_0x42b271,_0x34a975,!![]);}catch(_0x1734cd){return BPromise[_0x3636('0x27')](_0x1734cd);}return _0x42b271[_0x3636('0x28')]();};}function saveUpdates(_0xe34cd9,_0x325dce){return function(_0x49f43b){if(_0x49f43b){return _0x49f43b['update'](_0xe34cd9)['then'](function(_0x368356){return _0x368356;});}return null;};}function removeEntity(_0x4ee098,_0x50ba2f){return function(_0x8b3182){if(_0x8b3182){return _0x8b3182['destroy']()[_0x3636('0x29')](function(){var _0x4c24cf=_0x8b3182[_0x3636('0x2a')]({'plain':!![]});var _0x477c34=_0x3636('0x2b');return db[_0x3636('0x2c')][_0x3636('0x2d')]({'where':{'type':_0x477c34,'resourceId':_0x4c24cf['id']}})[_0x3636('0x29')](function(){return _0x8b3182;});})[_0x3636('0x29')](function(){_0x4ee098[_0x3636('0x21')](0xcc)[_0x3636('0x22')]();});}};}function handleEntityNotFound(_0x701651,_0x22574e){return function(_0x550443){if(!_0x550443){_0x701651[_0x3636('0x20')](0x194);}return _0x550443;};}function handleError(_0x236f54,_0x2d644c){_0x2d644c=_0x2d644c||0x1f4;return function(_0x22b12f){logger[_0x3636('0x2e')](_0x22b12f[_0x3636('0x2f')]);if(_0x22b12f['name']){delete _0x22b12f[_0x3636('0x30')];}_0x236f54[_0x3636('0x21')](_0x2d644c)['send'](_0x22b12f);};}exports[_0x3636('0x31')]=function(_0x26b6de,_0x306774){var _0x474ad3={},_0x3febfd={},_0x57613e={'count':0x0,'rows':[]};var _0x37983b=_[_0x3636('0x32')](db[_0x3636('0x33')][_0x3636('0x34')],function(_0x184fa8){return{'name':_0x184fa8[_0x3636('0x35')],'type':_0x184fa8[_0x3636('0x36')][_0x3636('0x37')]};});_0x3febfd[_0x3636('0x38')]=_['map'](_0x37983b,'name');_0x3febfd[_0x3636('0x39')]=_['keys'](_0x26b6de['query']);_0x3febfd[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x3febfd[_0x3636('0x38')],_0x3febfd['query']);_0x474ad3[_0x3636('0x3c')]=_[_0x3636('0x3b')](_0x3febfd[_0x3636('0x38')],qs[_0x3636('0x3d')](_0x26b6de[_0x3636('0x39')][_0x3636('0x3d')]));_0x474ad3[_0x3636('0x3c')]=_0x474ad3[_0x3636('0x3c')][_0x3636('0x3e')]?_0x474ad3[_0x3636('0x3c')]:_0x3febfd[_0x3636('0x38')];if(!_0x26b6de[_0x3636('0x39')][_0x3636('0x3f')]('nolimit')){_0x474ad3[_0x3636('0x26')]=qs[_0x3636('0x26')](_0x26b6de[_0x3636('0x39')][_0x3636('0x26')]);_0x474ad3['offset']=qs['offset'](_0x26b6de[_0x3636('0x39')][_0x3636('0x25')]);}_0x474ad3[_0x3636('0x40')]=qs['sort'](_0x26b6de[_0x3636('0x39')][_0x3636('0x41')]);_0x474ad3['where']=qs['filters'](_[_0x3636('0x42')](_0x26b6de['query'],_0x3febfd[_0x3636('0x3a')]),_0x37983b);if(_0x26b6de[_0x3636('0x39')][_0x3636('0x43')]){_0x474ad3[_0x3636('0x44')]=_[_0x3636('0x45')](_0x474ad3[_0x3636('0x44')],{'$or':_[_0x3636('0x32')](_0x37983b,function(_0x37f89a){if(_0x37f89a[_0x3636('0x36')]!=='VIRTUAL'){var _0x30cf4e={};_0x30cf4e[_0x37f89a[_0x3636('0x30')]]={'$like':'%'+_0x26b6de[_0x3636('0x39')][_0x3636('0x43')]+'%'};return _0x30cf4e;}})});}_0x474ad3=_[_0x3636('0x45')]({},_0x474ad3,_0x26b6de[_0x3636('0x46')]);var _0x28d6fb={'where':_0x474ad3[_0x3636('0x44')]};return db[_0x3636('0x33')]['count'](_0x28d6fb)[_0x3636('0x29')](function(_0x2d2d88){_0x57613e[_0x3636('0x24')]=_0x2d2d88;if(_0x26b6de[_0x3636('0x39')][_0x3636('0x47')]){_0x474ad3[_0x3636('0x48')]=[{'all':!![]}];}return db[_0x3636('0x33')][_0x3636('0x49')](_0x474ad3);})[_0x3636('0x29')](function(_0x24f5bc){_0x57613e[_0x3636('0x4a')]=_0x24f5bc;return _0x57613e;})[_0x3636('0x29')](respondWithFilteredResult(_0x306774,_0x474ad3))[_0x3636('0x4b')](handleError(_0x306774,null));};exports[_0x3636('0x4c')]=function(_0x1786b9,_0x534a73){var _0x329499={'raw':![],'where':{'id':_0x1786b9[_0x3636('0x4d')]['id']}},_0x17c784={};_0x17c784[_0x3636('0x38')]=_[_0x3636('0x4e')](db[_0x3636('0x33')][_0x3636('0x34')]);_0x17c784[_0x3636('0x39')]=_[_0x3636('0x4e')](_0x1786b9[_0x3636('0x39')]);_0x17c784[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x17c784[_0x3636('0x38')],_0x17c784['query']);_0x329499['attributes']=_['intersection'](_0x17c784[_0x3636('0x38')],qs['fields'](_0x1786b9['query'][_0x3636('0x3d')]));_0x329499[_0x3636('0x3c')]=_0x329499[_0x3636('0x3c')]['length']?_0x329499[_0x3636('0x3c')]:_0x17c784[_0x3636('0x38')];if(_0x1786b9[_0x3636('0x39')][_0x3636('0x47')]){_0x329499[_0x3636('0x48')]=[{'all':!![]}];}_0x329499=_[_0x3636('0x45')]({},_0x329499,_0x1786b9[_0x3636('0x46')]);return db[_0x3636('0x33')][_0x3636('0x4f')](_0x329499)['then'](handleEntityNotFound(_0x534a73,null))[_0x3636('0x29')](respondWithResult(_0x534a73,null))[_0x3636('0x4b')](handleError(_0x534a73,null));};exports[_0x3636('0x2d')]=function(_0x372ee8,_0x12be53){return db[_0x3636('0x33')]['find']({'where':{'id':_0x372ee8[_0x3636('0x4d')]['id']}})[_0x3636('0x29')](handleEntityNotFound(_0x12be53,null))[_0x3636('0x29')](removeEntity(_0x12be53,null))[_0x3636('0x4b')](handleError(_0x12be53,null));};exports[_0x3636('0x50')]=function(_0x4b7431,_0x2146c5){return db[_0x3636('0x33')][_0x3636('0x50')]()[_0x3636('0x29')](respondWithResult(_0x2146c5,null))[_0x3636('0x4b')](handleError(_0x2146c5,null));};exports['create']=function(_0x3b7bf7,_0x4db5ba){var _0x54deca;return db[_0x3636('0x51')][_0x3636('0x52')](function(_0x2575ba){return db[_0x3636('0x33')]['create'](_0x3b7bf7['body'],{'transaction':_0x2575ba})[_0x3636('0x29')](function(_0x1e1ad5){_0x54deca=_0x1e1ad5[_0x3636('0x2a')]({'plain':!![]});return db[_0x3636('0x53')][_0x3636('0x4f')]({'where':{'id':_0x54deca[_0x3636('0x54')]},'raw':!![]})['then'](function(_0x3dd6e8){return createVoicePrefixExtensions(_0x54deca,_0x3dd6e8,_0x2575ba);});});})[_0x3636('0x29')](function(){var _0x25637c=_0x3b7bf7[_0x3636('0x55')][_0x3636('0x2a')]({'plain':!![]});if(!_0x25637c)throw new Error(_0x3636('0x56'));if(_0x25637c[_0x3636('0x57')]===_0x3636('0x55')){var _0x4ffa31=_0x54deca;return db[_0x3636('0x58')]['find']({'where':{'name':_0x3636('0x2b'),'userProfileId':_0x25637c['userProfileId']},'raw':!![]})[_0x3636('0x29')](function(_0x3db86a){if(_0x3db86a&&_0x3db86a[_0x3636('0x59')]===0x0){return db[_0x3636('0x2c')][_0x3636('0x5a')]({'name':_0x4ffa31[_0x3636('0x30')],'resourceId':_0x4ffa31['id'],'type':_0x3db86a['name'],'sectionId':_0x3db86a['id']},{})[_0x3636('0x29')](function(){return _0x54deca;});}else{return _0x54deca;}})['catch'](function(_0x10db7e){logger[_0x3636('0x2e')](_0x3636('0x5b'),_0x10db7e);throw _0x10db7e;});}return _0x54deca;})[_0x3636('0x29')](respondWithResult(_0x4db5ba,null))['catch'](handleError(_0x4db5ba,null));};function Extension(_0x215fe5,_0x11028c,_0x3975eb,_0x225f63){this[_0x3636('0x5c')]=_0x3636('0x5d');this[_0x3636('0x5e')]=_0x215fe5;this[_0x3636('0x5f')]=_0x3975eb;this[_0x3636('0x36')]='system';this[_0x3636('0x60')]=_0x3636('0x61');this[_0x3636('0x62')]=_0x11028c;this[_0x3636('0x63')]=_0x225f63;}function createVoicePrefixExtensions(_0x453e38,_0xbeddf8,_0x491af3){return new BPromise(function(_0x3496ff,_0x163830){var _0x329117=new Extension(formatPrefixName(_0x453e38[_0x3636('0x64')]),0x1,_0x3636('0x65'),_0x3636('0x66'));_0x329117[_0x3636('0x67')]=_0x453e38['id'];return db[_0x3636('0x53')][_0x3636('0x5a')](_0x329117,{'transaction':_0x491af3})[_0x3636('0x29')](function(_0x111818){var _0x2c10a4=_0x111818[_0x3636('0x2a')]({'plain':!![]});var _0x57550f=_['map'](addVoicePrefixExtensions(_0x453e38,_0xbeddf8),function(_0xbc16a0){_0xbc16a0[_0x3636('0x54')]=_0x2c10a4['id'];_0xbc16a0[_0x3636('0x67')]=_0x453e38['id'];return _0xbc16a0;});return db[_0x3636('0x53')][_0x3636('0x68')](_0x57550f,{'transaction':_0x491af3})[_0x3636('0x29')](function(_0x2d43c9){if(!_0x2d43c9){return _0x163830(_0x3636('0x69'));}else{return _0x3496ff(_0x2d43c9);}})['catch'](function(_0x1df426){return _0x163830(_0x1df426);});});;});};function addVoicePrefixExtensions(_0x48f4ee,_0x2a461b){var _0x2115e4=[];var _0x228716=formatPrefixName(_0x48f4ee['prefix']);_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x2,'Set',_0x3636('0x6b')+_0x48f4ee[_0x3636('0x30')]));if(_0x48f4ee[_0x3636('0x6c')]){_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x3,_0x3636('0x6d'),_0x3636('0x6e')+_0x48f4ee[_0x3636('0x6c')]));}else{_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x3,_0x3636('0x65'),_0x3636('0x6f')));}_0x2115e4['push'](new Extension(_0x228716,0x4,'goto',_0x2a461b['context']+','+_0x3636('0x70')+(0x8+_0x48f4ee['name'][_0x3636('0x3e')])+'}'+','+0x1));return _0x2115e4;}function formatPrefixName(_0x2f07b1){var _0x4216c9='_';for(var _0x50b5a7=0x0;_0x50b5a7<_0x2f07b1[_0x3636('0x3e')];_0x50b5a7++){if(_0x2f07b1[_0x3636('0x71')](_0x50b5a7)=='-'){_0x4216c9+=_0x2f07b1[_0x3636('0x71')](_0x50b5a7);}else{_0x4216c9+='['+_0x2f07b1[_0x3636('0x71')](_0x50b5a7)+']';}}_0x4216c9+='.';return _0x4216c9;}exports['update']=function(_0x43b7b2,_0x54f66e,_0x17e31b){var _0x4fb8d2=_0x43b7b2['body'];_0x4fb8d2[_0x3636('0x64')]=_0x3636('0x72')+_0x4fb8d2[_0x3636('0x30')]+'-';return db[_0x3636('0x51')][_0x3636('0x52')](function(_0x44c747){return db['VoicePrefix']['update'](_0x4fb8d2,{'where':{'id':_0x4fb8d2['id']},'transaction':_0x44c747})[_0x3636('0x29')](function(){return db['VoiceExtension'][_0x3636('0x2d')]({'where':{'VoicePrefixId':_0x4fb8d2['id']},'transaction':_0x44c747})[_0x3636('0x29')](function(){return db[_0x3636('0x53')][_0x3636('0x4f')]({'where':{'id':_0x4fb8d2[_0x3636('0x54')]},'raw':!![]})[_0x3636('0x29')](function(_0x26c1cf){return createVoicePrefixExtensions(_0x4fb8d2,_0x26c1cf,_0x44c747);});});});})[_0x3636('0x29')](function(){return db['VoicePrefix'][_0x3636('0x73')](_0x4fb8d2['id']);})['then'](respondWithResult(_0x54f66e,null))['catch'](handleError(_0x54f66e,null));};exports[_0x3636('0x74')]=function(_0x3bd459,_0x3b6087,_0x1884b4){return db['VoicePrefix'][_0x3636('0x4f')]({'where':{'id':_0x3bd459['params']['id']}})['then'](handleEntityNotFound(_0x3b6087,null))[_0x3636('0x29')](function(_0x2a2040){if(_0x2a2040){return _0x2a2040[_0x3636('0x74')](_0x3bd459[_0x3636('0x75')][_0x3636('0x76')],_['omit'](_0x3bd459[_0x3636('0x75')],[_0x3636('0x76'),'id'])||{})[_0x3636('0x77')](function(_0x147f34){for(var _0x261f00=0x0;_0x261f00<_0x3bd459[_0x3636('0x75')][_0x3636('0x76')][_0x3636('0x3e')];_0x261f00+=0x1){socket[_0x3636('0x78')](_0x3636('0x79'),{'UserId':_0x3bd459[_0x3636('0x75')][_0x3636('0x76')][_0x261f00],'VoicePrefixId':_0x3bd459['params']['id']});}return _0x147f34;});}})['then'](respondWithResult(_0x3b6087,null))['catch'](handleError(_0x3b6087,null));};exports[_0x3636('0x7a')]=function(_0x3501a8,_0x45c0cc,_0x55b616){return db[_0x3636('0x33')]['find']({'where':{'id':_0x3501a8[_0x3636('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45c0cc,null))[_0x3636('0x29')](function(_0x5a00fd){if(_0x5a00fd){return _0x5a00fd[_0x3636('0x7a')](_0x3501a8[_0x3636('0x39')]['ids'])[_0x3636('0x29')](function(){if(_['isArray'](_0x3501a8['query'][_0x3636('0x76')])){for(var _0x38f6ac=0x0;_0x38f6ac<_0x3501a8[_0x3636('0x39')][_0x3636('0x76')][_0x3636('0x3e')];_0x38f6ac+=0x1){socket[_0x3636('0x78')](_0x3636('0x7b'),{'UserId':Number(_0x3501a8[_0x3636('0x39')][_0x3636('0x76')][_0x38f6ac]),'VoicePrefixId':Number(_0x3501a8[_0x3636('0x4d')]['id'])});}}else{socket['emit'](_0x3636('0x7b'),{'UserId':Number(_0x3501a8[_0x3636('0x39')][_0x3636('0x76')]),'VoicePrefixId':Number(_0x3501a8['params']['id'])});}});}})[_0x3636('0x29')](respondWithStatusCode(_0x45c0cc,null))[_0x3636('0x4b')](handleError(_0x45c0cc,null));};exports[_0x3636('0x7c')]=function(_0x515bf1,_0x154ab2,_0x2d778f){var _0x573dba={};var _0x5a0ec5={};var _0x467644;var _0x2cf46c;return db['VoicePrefix'][_0x3636('0x7d')]({'where':{'id':_0x515bf1[_0x3636('0x4d')]['id']}})['then'](handleEntityNotFound(_0x154ab2,null))['then'](function(_0xedaab6){if(_0xedaab6){_0x467644=_0xedaab6;_0x5a0ec5[_0x3636('0x38')]=_['keys'](db[_0x3636('0x7e')][_0x3636('0x34')]);_0x5a0ec5['query']=_[_0x3636('0x4e')](_0x515bf1[_0x3636('0x39')]);_0x5a0ec5[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x5a0ec5[_0x3636('0x38')],_0x5a0ec5[_0x3636('0x39')]);_0x573dba[_0x3636('0x3c')]=_[_0x3636('0x3b')](_0x5a0ec5[_0x3636('0x38')],qs[_0x3636('0x3d')](_0x515bf1[_0x3636('0x39')][_0x3636('0x3d')]));_0x573dba[_0x3636('0x3c')]=_0x573dba[_0x3636('0x3c')]['length']?_0x573dba[_0x3636('0x3c')]:_0x5a0ec5[_0x3636('0x38')];_0x573dba[_0x3636('0x40')]=qs[_0x3636('0x41')](_0x515bf1['query'][_0x3636('0x41')]);_0x573dba[_0x3636('0x44')]=qs[_0x3636('0x3a')](_['pick'](_0x515bf1[_0x3636('0x39')],_0x5a0ec5[_0x3636('0x3a')]));if(_0x515bf1['query'][_0x3636('0x43')]){_0x573dba[_0x3636('0x44')]=_[_0x3636('0x45')](_0x573dba['where'],{'$or':_[_0x3636('0x32')](_0x573dba[_0x3636('0x3c')],function(_0x2dcbf0){var _0x1a47d1={};_0x1a47d1[_0x2dcbf0]={'$like':'%'+_0x515bf1[_0x3636('0x39')][_0x3636('0x43')]+'%'};return _0x1a47d1;})});}_0x573dba=_[_0x3636('0x45')]({},_0x573dba,_0x515bf1[_0x3636('0x46')]);return _0x467644[_0x3636('0x7c')](_0x573dba);}})[_0x3636('0x29')](function(_0x55ba76){if(_0x55ba76){_0x2cf46c=_0x55ba76['length'];if(!_0x515bf1[_0x3636('0x39')][_0x3636('0x3f')]('nolimit')){_0x573dba[_0x3636('0x26')]=qs[_0x3636('0x26')](_0x515bf1[_0x3636('0x39')][_0x3636('0x26')]);_0x573dba['offset']=qs[_0x3636('0x25')](_0x515bf1[_0x3636('0x39')][_0x3636('0x25')]);}return _0x467644[_0x3636('0x7c')](_0x573dba);}})['then'](function(_0x450d6b){if(_0x450d6b){return _0x450d6b?{'count':_0x2cf46c,'rows':_0x450d6b}:null;}})['then'](respondWithResult(_0x154ab2,null))['catch'](handleError(_0x154ab2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0b7282e..0314f37 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 _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x447924,_0x1a6ce7){_0x447924=_0x447924-0x0;var _0x10550d=_0x3e74[_0x447924];return _0x10550d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x17bafa,_0x44a873){var _0x152b32=function(_0x40ad39){while(--_0x40ad39){_0x17bafa['push'](_0x17bafa['shift']());}};_0x152b32(++_0x44a873);}(_0x70e0,0x17b));var _0x070e=function(_0x1930c0,_0x3fe8b9){_0x1930c0=_0x1930c0-0x0;var _0x58bd75=_0x70e0[_0x1930c0];return _0x58bd75;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4274cf2..7febd9a 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 _0x2f93=['voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','VoicePrefix'];(function(_0x3bf8a2,_0x4d8a4a){var _0x136e4e=function(_0xc2c82f){while(--_0xc2c82f){_0x3bf8a2['push'](_0x3bf8a2['shift']());}};_0x136e4e(++_0x4d8a4a);}(_0x2f93,0x85));var _0x32f9=function(_0x411a23,_0x2c019f){_0x411a23=_0x411a23-0x0;var _0x177b05=_0x2f93[_0x411a23];return _0x177b05;};'use strict';var _=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var logger=require(_0x32f9('0x2'))(_0x32f9('0x3'));var moment=require(_0x32f9('0x4'));var BPromise=require(_0x32f9('0x5'));var rp=require(_0x32f9('0x6'));var fs=require('fs');var path=require(_0x32f9('0x7'));var rimraf=require('rimraf');var config=require(_0x32f9('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x24b3dc,_0x2ac287){return _0x24b3dc[_0x32f9('0x9')](_0x32f9('0xa'),attributes,{'tableName':_0x32f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe336=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x25931e,_0x47905b){var _0x30e7f5=function(_0xbd6d7e){while(--_0xbd6d7e){_0x25931e['push'](_0x25931e['shift']());}};_0x30e7f5(++_0x47905b);}(_0xe336,0x16c));var _0x6e33=function(_0x381098,_0xc74c53){_0x381098=_0x381098-0x0;var _0x34348a=_0xe336[_0x381098];return _0x34348a;};'use strict';var _=require('lodash');var util=require(_0x6e33('0x0'));var logger=require(_0x6e33('0x1'))('api');var moment=require(_0x6e33('0x2'));var BPromise=require(_0x6e33('0x3'));var rp=require(_0x6e33('0x4'));var fs=require('fs');var path=require(_0x6e33('0x5'));var rimraf=require(_0x6e33('0x6'));var config=require(_0x6e33('0x7'));var attributes=require(_0x6e33('0x8'));module[_0x6e33('0x9')]=function(_0x349611,_0x125b4d){return _0x349611[_0x6e33('0xa')](_0x6e33('0xb'),attributes,{'tableName':_0x6e33('0xc'),'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 00d57c2..5c9942b 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 _0x1ca2=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1ca2,0x182));var _0x21ca=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x1ca2[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x21ca('0x0'));var util=require('util');var moment=require(_0x21ca('0x1'));var BPromise=require(_0x21ca('0x2'));var rs=require(_0x21ca('0x3'));var fs=require('fs');var Redis=require(_0x21ca('0x4'));var db=require(_0x21ca('0x5'))['db'];var utils=require(_0x21ca('0x6'));var logger=require('../../config/logger')(_0x21ca('0x7'));var config=require(_0x21ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21ca('0x9')][_0x21ca('0xa')]({'port':0x232a});config['redis']=_[_0x21ca('0xb')](config[_0x21ca('0xc')],{'host':_0x21ca('0xd'),'port':0x18eb});var socket=require(_0x21ca('0xe'))(new Redis(config['redis']));require(_0x21ca('0xf'))[_0x21ca('0x10')](socket);function respondWithRpcPromise(_0x586c4d,_0x48c1b6,_0x137d3f){return new BPromise(function(_0x1bede1,_0x1450f3){return client[_0x21ca('0x11')](_0x586c4d,_0x137d3f)[_0x21ca('0x12')](function(_0x39175c){logger['info'](_0x21ca('0x13'),_0x48c1b6,'request\x20sent');logger[_0x21ca('0x14')](_0x21ca('0x15'),_0x48c1b6,_0x21ca('0x16'),JSON[_0x21ca('0x17')](_0x39175c));if(_0x39175c[_0x21ca('0x18')]){if(_0x39175c['error'][_0x21ca('0x19')]===0x1f4){logger[_0x21ca('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x48c1b6,_0x39175c[_0x21ca('0x18')]['message']);return _0x1450f3(_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);}logger[_0x21ca('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x48c1b6,_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);return _0x1bede1(_0x39175c[_0x21ca('0x18')][_0x21ca('0x1a')]);}else{logger['info'](_0x21ca('0x13'),_0x48c1b6,_0x21ca('0x16'));_0x1bede1(_0x39175c[_0x21ca('0x1b')][_0x21ca('0x1a')]);}})[_0x21ca('0x1c')](function(_0x1eb230){logger[_0x21ca('0x18')](_0x21ca('0x13'),_0x48c1b6,_0x1eb230);_0x1450f3(_0x1eb230);});});} \ No newline at end of file +var _0x7fe0=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28b266,_0x37b41c){var _0x22c6ac=function(_0x1ad1a6){while(--_0x1ad1a6){_0x28b266['push'](_0x28b266['shift']());}};_0x22c6ac(++_0x37b41c);}(_0x7fe0,0x198));var _0x07fe=function(_0x54c895,_0x1e62e8){_0x54c895=_0x54c895-0x0;var _0x47e855=_0x7fe0[_0x54c895];return _0x47e855;};'use strict';var _=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var moment=require(_0x07fe('0x2'));var BPromise=require(_0x07fe('0x3'));var rs=require(_0x07fe('0x4'));var fs=require('fs');var Redis=require(_0x07fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07fe('0x6'))('rpc');var config=require(_0x07fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07fe('0x8')]['http']({'port':0x232a});config[_0x07fe('0x9')]=_[_0x07fe('0xa')](config[_0x07fe('0x9')],{'host':_0x07fe('0xb'),'port':0x18eb});var socket=require(_0x07fe('0xc'))(new Redis(config[_0x07fe('0x9')]));require(_0x07fe('0xd'))[_0x07fe('0xe')](socket);function respondWithRpcPromise(_0x33b600,_0x5e9554,_0x459441){return new BPromise(function(_0x3af89c,_0x3f9579){return client[_0x07fe('0xf')](_0x33b600,_0x459441)[_0x07fe('0x10')](function(_0x5d95a6){logger[_0x07fe('0x11')](_0x07fe('0x12'),_0x5e9554,_0x07fe('0x13'));logger['debug'](_0x07fe('0x14'),_0x5e9554,_0x07fe('0x13'),JSON[_0x07fe('0x15')](_0x5d95a6));if(_0x5d95a6[_0x07fe('0x16')]){if(_0x5d95a6[_0x07fe('0x16')][_0x07fe('0x17')]===0x1f4){logger['error'](_0x07fe('0x12'),_0x5e9554,_0x5d95a6[_0x07fe('0x16')][_0x07fe('0x18')]);return _0x3f9579(_0x5d95a6['error'][_0x07fe('0x18')]);}logger[_0x07fe('0x16')](_0x07fe('0x12'),_0x5e9554,_0x5d95a6[_0x07fe('0x16')]['message']);return _0x3af89c(_0x5d95a6[_0x07fe('0x16')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5e9554,_0x07fe('0x13'));_0x3af89c(_0x5d95a6[_0x07fe('0x19')]['message']);}})[_0x07fe('0x1a')](function(_0x3835f1){logger[_0x07fe('0x16')](_0x07fe('0x12'),_0x5e9554,_0x3835f1);_0x3f9579(_0x3835f1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 85f19ea..547d7b7 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 _0xf749=['update','emit','removeListener','register','./voicePrefix.events','save','remove'];(function(_0x448255,_0x2e681d){var _0x55d7ec=function(_0x52434e){while(--_0x52434e){_0x448255['push'](_0x448255['shift']());}};_0x55d7ec(++_0x2e681d);}(_0xf749,0xe4));var _0x9f74=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf749[_0x2c91e9];return _0x13f0ff;};'use strict';var VoicePrefixEvents=require(_0x9f74('0x0'));var events=[_0x9f74('0x1'),_0x9f74('0x2'),_0x9f74('0x3')];function createListener(_0x371c67,_0x53d271){return function(_0x1ace9b){_0x53d271[_0x9f74('0x4')](_0x371c67,_0x1ace9b);};}function removeListener(_0xa35def,_0x44b3e4){return function(){VoicePrefixEvents[_0x9f74('0x5')](_0xa35def,_0x44b3e4);};}exports[_0x9f74('0x6')]=function(_0x4667f2){for(var _0x1965f7=0x0,_0x55f059=events['length'];_0x1965f7<_0x55f059;_0x1965f7++){var _0x31906e=events[_0x1965f7];var _0x441d71=createListener('voicePrefix:'+_0x31906e,_0x4667f2);VoicePrefixEvents['on'](_0x31906e,_0x441d71);}}; \ No newline at end of file +var _0xb47a=['removeListener','register','voicePrefix:','./voicePrefix.events','save'];(function(_0x1a3597,_0x317a21){var _0x313c4a=function(_0x5e11d5){while(--_0x5e11d5){_0x1a3597['push'](_0x1a3597['shift']());}};_0x313c4a(++_0x317a21);}(_0xb47a,0x1ca));var _0xab47=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xb47a[_0xd0b415];return _0x2bdf2c;};'use strict';var VoicePrefixEvents=require(_0xab47('0x0'));var events=[_0xab47('0x1'),'remove','update'];function createListener(_0x5295ae,_0x4ed4e3){return function(_0x1aae4c){_0x4ed4e3['emit'](_0x5295ae,_0x1aae4c);};}function removeListener(_0x501838,_0x2b5f4f){return function(){VoicePrefixEvents[_0xab47('0x2')](_0x501838,_0x2b5f4f);};}exports[_0xab47('0x3')]=function(_0x20f268){for(var _0x360269=0x0,_0x85eb16=events['length'];_0x360269<_0x85eb16;_0x360269++){var _0x27470b=events[_0x360269];var _0x596fb1=createListener(_0xab47('0x4')+_0x27470b,_0x20f268);VoicePrefixEvents['on'](_0x27470b,_0x596fb1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f1d67b9..6af5181 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 _0xbff3=['getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','/:id/clone','post','/:id/teams','addTeams','addAgents','addBlackLists','put','/:id','update','destroy','removeTeams','delete','removeAgents','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers'];(function(_0x26dd67,_0x3aa68c){var _0x1621eb=function(_0x15e23c){while(--_0x15e23c){_0x26dd67['push'](_0x26dd67['shift']());}};_0x1621eb(++_0x3aa68c);}(_0xbff3,0x18e));var _0x3bff=function(_0x1f2089,_0x584aad){_0x1f2089=_0x1f2089-0x0;var _0x2d74cd=_0xbff3[_0x1f2089];return _0x2d74cd;};'use strict';var multer=require('multer');var util=require(_0x3bff('0x0'));var path=require('path');var timeout=require(_0x3bff('0x1'));var express=require(_0x3bff('0x2'));var router=express[_0x3bff('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bff('0x4'));var config=require(_0x3bff('0x5'));var controller=require(_0x3bff('0x6'));router[_0x3bff('0x7')]('/',auth[_0x3bff('0x8')](),controller[_0x3bff('0x9')]);router[_0x3bff('0x7')]('/:id',auth[_0x3bff('0x8')](),controller[_0x3bff('0xa')]);router['get'](_0x3bff('0xb'),auth['isAuthenticated'](),controller[_0x3bff('0xc')]);router[_0x3bff('0x7')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x3bff('0xd')]);router[_0x3bff('0x7')](_0x3bff('0xe'),auth[_0x3bff('0x8')](),controller[_0x3bff('0xf')]);router['get'](_0x3bff('0x10'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x11')]);router[_0x3bff('0x7')]('/:id/teams',auth[_0x3bff('0x8')](),controller[_0x3bff('0x12')]);router[_0x3bff('0x7')](_0x3bff('0x13'),auth['isAuthenticated'](),controller[_0x3bff('0x14')]);router[_0x3bff('0x7')](_0x3bff('0x15'),auth[_0x3bff('0x8')](),controller['getMembers']);router[_0x3bff('0x7')](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x17')]);router['get'](_0x3bff('0x18'),auth['isAuthenticated'](),controller[_0x3bff('0x19')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3bff('0x1a'),auth['isAuthenticated'](),controller['clone']);router[_0x3bff('0x1b')](_0x3bff('0x1c'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x1d')]);router[_0x3bff('0x1b')](_0x3bff('0x13'),auth['isAuthenticated'](),controller[_0x3bff('0x1e')]);router[_0x3bff('0x1b')](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller['addLists']);router['post'](_0x3bff('0x18'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x1f')]);router[_0x3bff('0x20')](_0x3bff('0x21'),auth['isAuthenticated'](),controller[_0x3bff('0x22')]);router['delete'](_0x3bff('0x21'),auth['isAuthenticated'](),controller[_0x3bff('0x23')]);router['delete'](_0x3bff('0x1c'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x24')]);router[_0x3bff('0x25')](_0x3bff('0x13'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x26')]);router['delete'](_0x3bff('0x16'),auth[_0x3bff('0x8')](),controller['removeLists']);router[_0x3bff('0x25')](_0x3bff('0x18'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x27')]);module[_0x3bff('0x28')]=router; \ No newline at end of file +var _0x242e=['destroy','removeTeams','removeAgents','removeLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','/:id/users','/:id/members','getMembers','getLists','post','create','/:id/clone','addTeams','addAgents','/:id/lists','/:id/blacklists','addBlackLists','put','delete'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x242e,0x1cd));var _0xe242=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x242e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xe242('0x0'));var util=require(_0xe242('0x1'));var path=require(_0xe242('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe242('0x3')]();var auth=require(_0xe242('0x4'));var interaction=require(_0xe242('0x5'));var config=require(_0xe242('0x6'));var controller=require('./voiceQueue.controller');router[_0xe242('0x7')]('/',auth[_0xe242('0x8')](),controller[_0xe242('0x9')]);router['get'](_0xe242('0xa'),auth[_0xe242('0x8')](),controller[_0xe242('0xb')]);router['get'](_0xe242('0xc'),auth['isAuthenticated'](),controller[_0xe242('0xd')]);router[_0xe242('0x7')](_0xe242('0xe'),auth[_0xe242('0x8')](),controller[_0xe242('0xf')]);router[_0xe242('0x7')]('/:id/hopper_finals',auth[_0xe242('0x8')](),controller[_0xe242('0x10')]);router[_0xe242('0x7')](_0xe242('0x11'),auth[_0xe242('0x8')](),controller['getHopperBlacks']);router[_0xe242('0x7')](_0xe242('0x12'),auth[_0xe242('0x8')](),controller['getTeams']);router[_0xe242('0x7')](_0xe242('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe242('0x7')](_0xe242('0x14'),auth['isAuthenticated'](),controller[_0xe242('0x15')]);router[_0xe242('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe242('0x16')]);router[_0xe242('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xe242('0x17')]('/',auth[_0xe242('0x8')](),controller[_0xe242('0x18')]);router[_0xe242('0x17')](_0xe242('0x19'),auth[_0xe242('0x8')](),controller['clone']);router[_0xe242('0x17')](_0xe242('0x12'),auth[_0xe242('0x8')](),controller[_0xe242('0x1a')]);router[_0xe242('0x17')](_0xe242('0x13'),auth[_0xe242('0x8')](),controller[_0xe242('0x1b')]);router['post'](_0xe242('0x1c'),auth[_0xe242('0x8')](),controller['addLists']);router['post'](_0xe242('0x1d'),auth['isAuthenticated'](),controller[_0xe242('0x1e')]);router[_0xe242('0x1f')](_0xe242('0xa'),auth[_0xe242('0x8')](),controller['update']);router[_0xe242('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xe242('0x21')]);router['delete'](_0xe242('0x12'),auth[_0xe242('0x8')](),controller[_0xe242('0x22')]);router['delete'](_0xe242('0x13'),auth[_0xe242('0x8')](),controller[_0xe242('0x23')]);router['delete'](_0xe242('0x1c'),auth[_0xe242('0x8')](),controller[_0xe242('0x24')]);router[_0xe242('0x20')](_0xe242('0x1d'),auth[_0xe242('0x8')](),controller['removeBlackLists']);module[_0xe242('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 96f0552..c3da83b 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(_0x583745,_0x2d1897){var _0x4ba020=function(_0x288616){while(--_0x288616){_0x583745['push'](_0x583745['shift']());}};_0x4ba020(++_0x2d1897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x53c739,_0x34dd56){var _0x1cf22e=function(_0x176909){while(--_0x176909){_0x53c739['push'](_0x53c739['shift']());}};_0x1cf22e(++_0x34dd56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'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 6871cf7..01904c0 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 _0xe982=['QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','create','user','get','UserProfileSection','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','body','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmHopper','nolimit','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','flatMap','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','push','SELECT','TeamId','all','union','compact','userVoiceQueue:remove','addAgents','online','isEmpty','upsert','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','cm_hopper','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound'];(function(_0x71a218,_0x4d23eb){var _0x2cfe7d=function(_0x4bdebf){while(--_0x4bdebf){_0x71a218['push'](_0x71a218['shift']());}};_0x2cfe7d(++_0x4d23eb);}(_0xe982,0x141));var _0x2e98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe982[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x2e98('0x0'));var emlformat=require(_0x2e98('0x1'));var rimraf=require(_0x2e98('0x2'));var zipdir=require(_0x2e98('0x3'));var jsonpatch=require(_0x2e98('0x4'));var rp=require(_0x2e98('0x5'));var moment=require(_0x2e98('0x6'));var BPromise=require(_0x2e98('0x7'));var Mustache=require(_0x2e98('0x8'));var util=require(_0x2e98('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x2e98('0xa'));var ejs=require(_0x2e98('0xb'));var fs=require('fs');var _=require(_0x2e98('0xc'));var squel=require(_0x2e98('0xd'));var crypto=require(_0x2e98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2e98('0xf'));var toCsv=require(_0x2e98('0xa'));var querystring=require(_0x2e98('0x10'));var Papa=require(_0x2e98('0x11'));var Redis=require('ioredis');var authService=require(_0x2e98('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2e98('0x13'));var hardwareService=require(_0x2e98('0x14'));var logger=require(_0x2e98('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2e98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e98('0x17'))['db'];config[_0x2e98('0x18')]=_[_0x2e98('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2e98('0x1a'))(new Redis(config[_0x2e98('0x18')]));require(_0x2e98('0x1b'))['register'](socket);function respondWithStatusCode(_0x30e777,_0x3f2fcf){_0x3f2fcf=_0x3f2fcf||0xcc;return function(_0x163c41){if(_0x163c41){return _0x30e777[_0x2e98('0x1c')](_0x3f2fcf);}return _0x30e777[_0x2e98('0x1d')](_0x3f2fcf)[_0x2e98('0x1e')]();};}function respondWithResult(_0x39e9a1,_0x53476f){_0x53476f=_0x53476f||0xc8;return function(_0x554882){if(_0x554882){return _0x39e9a1['status'](_0x53476f)[_0x2e98('0x1f')](_0x554882);}};}function respondWithFilteredResult(_0x3584a5,_0xb024db){return function(_0x23a706){if(_0x23a706){var _0x643011=_0x23a706[_0x2e98('0x20')],_0x311ce1=_0xb024db[_0x2e98('0x21')],_0xc6cc5=_0xb024db['offset']+_0xb024db[_0x2e98('0x22')],_0xa7070e;if(_0xc6cc5>=_0x643011){_0xc6cc5=_0x643011;_0xa7070e=0xc8;}else{_0xa7070e=0xce;}_0x3584a5[_0x2e98('0x1d')](_0xa7070e);return _0x3584a5[_0x2e98('0x23')](_0x2e98('0x24'),_0x311ce1+'-'+_0xc6cc5+'/'+_0x643011)[_0x2e98('0x1f')](_0x23a706);}return null;};}function patchUpdates(_0x6dac1){return function(_0x1d892c){try{jsonpatch[_0x2e98('0x25')](_0x1d892c,_0x6dac1,!![]);}catch(_0x47cdd9){return BPromise[_0x2e98('0x26')](_0x47cdd9);}return _0x1d892c[_0x2e98('0x27')]();};}function saveUpdates(_0x180c00,_0x4477ad){return function(_0x20f12b){if(_0x20f12b){return _0x20f12b[_0x2e98('0x28')](_0x180c00)[_0x2e98('0x29')](function(_0x213a65){return _0x213a65;});}return null;};}function removeEntity(_0x482b43,_0x383feb){return function(_0x2601d3){if(_0x2601d3){return _0x2601d3[_0x2e98('0x2a')]()[_0x2e98('0x29')](function(){var _0x19efad=_0x2601d3['get']({'plain':!![]});var _0x16eb0d=[{'name':_0x2e98('0x2b'),'value':_0x2e98('0x2c'),'ignore':![]},{'name':_0x2e98('0x2d'),'value':_0x2e98('0x2e'),'ignore':![]}];var _0x1f97c5=_(_0x16eb0d)[_0x2e98('0x2f')](_0x2e98('0x30'))[_0x2e98('0x31')](_0x2e98('0x32'))[_0x2e98('0x32')]();if(_[_0x2e98('0x33')](_0x1f97c5,_0x19efad['type'])){return;}var _0x4e9a99=_[_0x2e98('0x34')](_0x16eb0d,[_0x2e98('0x32'),_0x19efad[_0x2e98('0x35')]])['name'];return db[_0x2e98('0x36')][_0x2e98('0x2a')]({'where':{'type':_0x4e9a99,'resourceId':_0x19efad['id']}})[_0x2e98('0x29')](function(){return _0x2601d3;});})[_0x2e98('0x29')](function(){_0x482b43[_0x2e98('0x1d')](0xcc)[_0x2e98('0x1e')]();});}};}function handleEntityNotFound(_0x1233fc,_0x29576b){return function(_0x871f89){if(!_0x871f89){_0x1233fc['sendStatus'](0x194);}return _0x871f89;};}function handleError(_0x265c32,_0x382c97){_0x382c97=_0x382c97||0x1f4;return function(_0x4734d0){logger[_0x2e98('0x37')](_0x4734d0[_0x2e98('0x38')]);if(_0x4734d0['name']){delete _0x4734d0[_0x2e98('0x39')];}_0x265c32['status'](_0x382c97)[_0x2e98('0x3a')](_0x4734d0);};}exports[_0x2e98('0x3b')]=function(_0x7700a1,_0x519fe5){var _0x3434b0={},_0x2ec47d={},_0x4a0616={'count':0x0,'rows':[]};var _0x330f5c=_[_0x2e98('0x31')](db[_0x2e98('0x3c')][_0x2e98('0x3d')],function(_0x25b109){return{'name':_0x25b109['fieldName'],'type':_0x25b109['type'][_0x2e98('0x3e')]};});_0x2ec47d['model']=_[_0x2e98('0x31')](_0x330f5c,_0x2e98('0x39'));_0x2ec47d['query']=_[_0x2e98('0x3f')](_0x7700a1['query']);_0x2ec47d[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x2ec47d[_0x2e98('0x42')],_0x2ec47d[_0x2e98('0x43')]);_0x3434b0[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x2ec47d[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x7700a1[_0x2e98('0x43')][_0x2e98('0x45')]));_0x3434b0['attributes']=_0x3434b0[_0x2e98('0x44')]['length']?_0x3434b0[_0x2e98('0x44')]:_0x2ec47d['model'];if(!_0x7700a1[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x3434b0[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x7700a1[_0x2e98('0x43')][_0x2e98('0x22')]);_0x3434b0[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x7700a1[_0x2e98('0x43')]['offset']);}_0x3434b0[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x7700a1[_0x2e98('0x43')]['sort']);_0x3434b0[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0x7700a1[_0x2e98('0x43')],_0x2ec47d['filters']),_0x330f5c);if(_0x7700a1[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x3434b0[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x3434b0[_0x2e98('0x49')],{'$or':_['map'](_0x330f5c,function(_0x3cbd24){if(_0x3cbd24[_0x2e98('0x35')]!==_0x2e98('0x4b')){var _0x2700a2={};_0x2700a2[_0x3cbd24[_0x2e98('0x39')]]={'$like':'%'+_0x7700a1['query']['filter']+'%'};return _0x2700a2;}})});}_0x3434b0=_[_0x2e98('0x4a')]({},_0x3434b0,_0x7700a1['options']);var _0x392704={'where':_0x3434b0[_0x2e98('0x49')]};return db[_0x2e98('0x3c')][_0x2e98('0x20')](_0x392704)[_0x2e98('0x29')](function(_0x2ae188){_0x4a0616['count']=_0x2ae188;if(_0x7700a1[_0x2e98('0x43')]['includeAll']){_0x3434b0[_0x2e98('0x4c')]=[{'all':!![]}];}return db['VoiceQueue'][_0x2e98('0x4d')](_0x3434b0);})[_0x2e98('0x29')](function(_0x90d602){_0x4a0616[_0x2e98('0x4e')]=_0x90d602;return _0x4a0616;})[_0x2e98('0x29')](respondWithFilteredResult(_0x519fe5,_0x3434b0))[_0x2e98('0x4f')](handleError(_0x519fe5,null));};exports[_0x2e98('0x50')]=function(_0x510326,_0x1554e3){var _0x106f12={'raw':![],'where':{'id':_0x510326[_0x2e98('0x51')]['id']}},_0x3d88b0={};_0x3d88b0['model']=_['keys'](db['VoiceQueue'][_0x2e98('0x3d')]);_0x3d88b0[_0x2e98('0x43')]=_['keys'](_0x510326[_0x2e98('0x43')]);_0x3d88b0[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x3d88b0[_0x2e98('0x42')],_0x3d88b0[_0x2e98('0x43')]);_0x106f12[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x3d88b0['model'],qs[_0x2e98('0x45')](_0x510326[_0x2e98('0x43')]['fields']));_0x106f12[_0x2e98('0x44')]=_0x106f12['attributes'][_0x2e98('0x52')]?_0x106f12['attributes']:_0x3d88b0['model'];if(_0x510326[_0x2e98('0x43')]['includeAll']){_0x106f12[_0x2e98('0x4c')]=[{'all':!![]}];}_0x106f12=_[_0x2e98('0x4a')]({},_0x106f12,_0x510326['options']);return db[_0x2e98('0x3c')][_0x2e98('0x34')](_0x106f12)['then'](handleEntityNotFound(_0x1554e3,null))[_0x2e98('0x29')](respondWithResult(_0x1554e3,null))[_0x2e98('0x4f')](handleError(_0x1554e3,null));};exports[_0x2e98('0x53')]=function(_0x40cfdd,_0x3125ba){return db[_0x2e98('0x3c')]['create'](_0x40cfdd['body'],{})[_0x2e98('0x29')](function(_0x2ec360){var _0x3dea45=_0x40cfdd[_0x2e98('0x54')][_0x2e98('0x55')]({'plain':!![]});if(!_0x3dea45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dea45['role']===_0x2e98('0x54')){var _0x470085=_0x2ec360[_0x2e98('0x55')]({'plain':!![]});var _0x3da7fa=[{'name':_0x2e98('0x2b'),'value':_0x2e98('0x2c')},{'name':_0x2e98('0x2d'),'value':'outbound'}];var _0x28bb29=_[_0x2e98('0x34')](_0x3da7fa,['value',_0x470085[_0x2e98('0x35')]])[_0x2e98('0x39')];return db[_0x2e98('0x56')]['find']({'where':{'name':_0x28bb29,'userProfileId':_0x3dea45[_0x2e98('0x57')]},'raw':!![]})[_0x2e98('0x29')](function(_0x471d38){if(_0x471d38&&_0x471d38[_0x2e98('0x58')]===0x0){return db[_0x2e98('0x36')][_0x2e98('0x53')]({'name':_0x470085[_0x2e98('0x39')],'resourceId':_0x470085['id'],'type':_0x471d38[_0x2e98('0x39')],'sectionId':_0x471d38['id']},{})[_0x2e98('0x29')](function(){return _0x2ec360;});}else{return _0x2ec360;}})[_0x2e98('0x4f')](function(_0x232e87){logger[_0x2e98('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x232e87);throw _0x232e87;});}return _0x2ec360;})[_0x2e98('0x29')](respondWithResult(_0x3125ba,0xc9))[_0x2e98('0x4f')](handleError(_0x3125ba,null));};exports[_0x2e98('0x59')]=function(_0x1f3879,_0x4c5d62){var _0x157099={'where':{'id':_0x1f3879['params']['id']}},_0x585aac={};_0x585aac[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['VoiceQueue'][_0x2e98('0x3d')]);_0x157099[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x585aac[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x1f3879[_0x2e98('0x43')][_0x2e98('0x45')]));_0x157099[_0x2e98('0x44')]=_0x157099[_0x2e98('0x44')]['length']?_0x157099[_0x2e98('0x44')]:_0x585aac['model'];if(_0x1f3879['query']['includeAll']){_0x157099[_0x2e98('0x4c')]=[{'all':!![]}];}_0x157099=_['merge']({},_0x157099,_0x1f3879[_0x2e98('0x5a')]);return db[_0x2e98('0x3c')][_0x2e98('0x34')](_0x157099)[_0x2e98('0x29')](handleEntityNotFound(_0x4c5d62,null))[_0x2e98('0x29')](function(_0x52e6a2){if(_0x52e6a2){var _0x2e100a=_0x52e6a2[_0x2e98('0x55')]({'plain':!![]});_0x2e100a=qs[_0x2e98('0x5b')](_0x2e100a,['id',_0x2e98('0x5c'),_0x2e98('0x5d')]);_0x1f3879[_0x2e98('0x5e')]=_[_0x2e98('0x5b')](_0x1f3879[_0x2e98('0x5e')],['id',_0x2e98('0x5c'),_0x2e98('0x5d')]);return db[_0x2e98('0x3c')][_0x2e98('0x53')](_['merge'](_0x2e100a,_0x1f3879['body']),{'include':_0x1f3879['query'][_0x2e98('0x5f')]?[{'all':!![]}]:undefined})[_0x2e98('0x29')](function(_0x49bfbf){var _0xf02768=_0x1f3879[_0x2e98('0x54')][_0x2e98('0x55')]({'plain':!![]});if(!_0xf02768)throw new Error(_0x2e98('0x60'));if(_0xf02768[_0x2e98('0x61')]===_0x2e98('0x54')){var _0x4ee0ab=_0x49bfbf[_0x2e98('0x55')]({'plain':!![]});var _0x3e404f=[{'name':_0x2e98('0x2b'),'value':'inbound'},{'name':_0x2e98('0x2d'),'value':'outbound'}];var _0x340cf6=_[_0x2e98('0x34')](_0x3e404f,[_0x2e98('0x32'),_0x4ee0ab[_0x2e98('0x35')]])[_0x2e98('0x39')];return db['UserProfileSection']['find']({'where':{'name':_0x340cf6,'userProfileId':_0xf02768[_0x2e98('0x57')]},'raw':!![]})['then'](function(_0x5bcec6){if(_0x5bcec6&&_0x5bcec6[_0x2e98('0x58')]===0x0){return db[_0x2e98('0x36')]['create']({'name':_0x4ee0ab[_0x2e98('0x39')],'resourceId':_0x4ee0ab['id'],'type':_0x5bcec6['name'],'sectionId':_0x5bcec6['id']},{})['then'](function(){return _0x49bfbf;});}else{return _0x49bfbf;}})[_0x2e98('0x4f')](function(_0xfcfe05){logger[_0x2e98('0x37')](_0x2e98('0x62'),_0xfcfe05);throw _0xfcfe05;});}return _0x49bfbf;});}})['then'](respondWithResult(_0x4c5d62,0xc9))[_0x2e98('0x4f')](handleError(_0x4c5d62,null));};exports[_0x2e98('0x28')]=function(_0x1d0353,_0x36693b){if(_0x1d0353[_0x2e98('0x5e')]['id']){delete _0x1d0353[_0x2e98('0x5e')]['id'];}return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x1d0353['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x36693b,null))[_0x2e98('0x29')](saveUpdates(_0x1d0353[_0x2e98('0x5e')],null))[_0x2e98('0x29')](respondWithResult(_0x36693b,null))['catch'](handleError(_0x36693b,null));};exports[_0x2e98('0x2a')]=function(_0x27e686,_0x5e1576){return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x27e686['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x5e1576,null))[_0x2e98('0x29')](removeEntity(_0x5e1576,null))['catch'](handleError(_0x5e1576,null));};exports['getHoppers']=function(_0x22e675,_0x110467,_0x285b61){var _0x1c947e={'raw':![],'where':{}};var _0x37df63={};var _0xefabfe={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x22e675['params']['id']}})['then'](handleEntityNotFound(_0x110467,null))[_0x2e98('0x29')](function(_0x53b352){if(_0x53b352){_0x37df63[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x63')][_0x2e98('0x3d')]);_0x37df63[_0x2e98('0x43')]=_['keys'](_0x22e675[_0x2e98('0x43')]);_0x37df63[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x37df63[_0x2e98('0x42')],_0x37df63['query']);_0x1c947e[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x37df63['model'],qs[_0x2e98('0x45')](_0x22e675[_0x2e98('0x43')][_0x2e98('0x45')]));_0x1c947e[_0x2e98('0x44')]=_0x1c947e[_0x2e98('0x44')][_0x2e98('0x52')]?_0x1c947e[_0x2e98('0x44')]:_0x37df63[_0x2e98('0x42')];if(!_0x22e675[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x1c947e[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x22e675[_0x2e98('0x43')][_0x2e98('0x22')]);_0x1c947e[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x22e675[_0x2e98('0x43')]['offset']);}_0x1c947e['order']=qs[_0x2e98('0x48')](_0x22e675['query']['sort']);_0x1c947e['where']=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x22e675['query'],_0x37df63[_0x2e98('0x40')]));_0x1c947e[_0x2e98('0x49')][_0x2e98('0x66')]=_0x53b352['id'];if(_0x22e675[_0x2e98('0x43')]['filter']){_0x1c947e[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x1c947e[_0x2e98('0x49')],{'$or':_['map'](_0x1c947e['attributes'],function(_0x1b460e){var _0xec1982={};_0xec1982[_0x1b460e]={'$like':'%'+_0x22e675[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0xec1982;})});}_0x1c947e=_['merge']({},_0x1c947e,_0x22e675[_0x2e98('0x5a')]);return db[_0x2e98('0x63')]['count']({'where':_0x1c947e['where']})[_0x2e98('0x29')](function(_0x4e21e5){_0xefabfe[_0x2e98('0x20')]=_0x4e21e5;if(_0x22e675[_0x2e98('0x43')][_0x2e98('0x5f')]){_0x1c947e[_0x2e98('0x4c')]=[{'all':!![]}];}return db[_0x2e98('0x63')][_0x2e98('0x4d')](_0x1c947e);})[_0x2e98('0x29')](function(_0x15459c){_0xefabfe['rows']=_0x15459c;return _0xefabfe;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x110467,_0x1c947e))[_0x2e98('0x4f')](handleError(_0x110467,null));};exports[_0x2e98('0x67')]=function(_0x2c5dcb,_0x4f393a,_0x29cd2b){var _0x151f9c={'raw':!![],'where':{}};var _0x297d1c={};var _0x32a9d6={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x2c5dcb[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4f393a,null))['then'](function(_0x3c34f2){if(_0x3c34f2){_0x297d1c['model']=_[_0x2e98('0x3f')](db[_0x2e98('0x69')]['rawAttributes']);_0x297d1c[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x2c5dcb[_0x2e98('0x43')]);_0x297d1c[_0x2e98('0x40')]=_['intersection'](_0x297d1c[_0x2e98('0x42')],_0x297d1c[_0x2e98('0x43')]);_0x151f9c['attributes']=_[_0x2e98('0x41')](_0x297d1c[_0x2e98('0x42')],qs['fields'](_0x2c5dcb[_0x2e98('0x43')]['fields']));_0x151f9c['attributes']=_0x151f9c[_0x2e98('0x44')][_0x2e98('0x52')]?_0x151f9c[_0x2e98('0x44')]:_0x297d1c[_0x2e98('0x42')];if(!_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x151f9c['limit']=qs[_0x2e98('0x22')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x22')]);_0x151f9c[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x21')]);}_0x151f9c[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x2c5dcb[_0x2e98('0x43')][_0x2e98('0x48')]);_0x151f9c[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x2c5dcb[_0x2e98('0x43')],_0x297d1c[_0x2e98('0x40')]));_0x151f9c[_0x2e98('0x49')]['VoiceQueueId']=_0x3c34f2['id'];if(_0x2c5dcb[_0x2e98('0x43')]['filter']){_0x151f9c[_0x2e98('0x49')]=_['merge'](_0x151f9c[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x151f9c[_0x2e98('0x44')],function(_0x57fbf0){var _0x53d984={};_0x53d984[_0x57fbf0]={'$like':'%'+_0x2c5dcb[_0x2e98('0x43')]['filter']+'%'};return _0x53d984;})});}_0x151f9c=_[_0x2e98('0x4a')]({},_0x151f9c,_0x2c5dcb[_0x2e98('0x5a')]);return db[_0x2e98('0x69')][_0x2e98('0x20')]({'where':_0x151f9c[_0x2e98('0x49')]})[_0x2e98('0x29')](function(_0x11ed77){_0x32a9d6[_0x2e98('0x20')]=_0x11ed77;if(_0x2c5dcb[_0x2e98('0x43')]['includeAll']){_0x151f9c['include']=[{'all':!![]}];}return db[_0x2e98('0x69')][_0x2e98('0x4d')](_0x151f9c);})[_0x2e98('0x29')](function(_0x3a9056){_0x32a9d6[_0x2e98('0x4e')]=_0x3a9056;return _0x32a9d6;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x4f393a,_0x151f9c))[_0x2e98('0x4f')](handleError(_0x4f393a,null));};exports[_0x2e98('0x6a')]=function(_0xf0ee1c,_0x177ccb,_0x4450ac){var _0xe22d88={'raw':!![],'where':{}};var _0x17d11e={};var _0x4d9918={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0xf0ee1c[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0x177ccb,null))[_0x2e98('0x29')](function(_0x549f0d){if(_0x549f0d){_0x17d11e[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x6b')][_0x2e98('0x3d')]);_0x17d11e[_0x2e98('0x43')]=_['keys'](_0xf0ee1c[_0x2e98('0x43')]);_0x17d11e[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x17d11e[_0x2e98('0x42')],_0x17d11e[_0x2e98('0x43')]);_0xe22d88[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x17d11e[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x45')]));_0xe22d88['attributes']=_0xe22d88[_0x2e98('0x44')][_0x2e98('0x52')]?_0xe22d88[_0x2e98('0x44')]:_0x17d11e['model'];if(!_0xf0ee1c[_0x2e98('0x43')]['hasOwnProperty'](_0x2e98('0x64'))){_0xe22d88[_0x2e98('0x22')]=qs['limit'](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x22')]);_0xe22d88[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x21')]);}_0xe22d88['order']=qs['sort'](_0xf0ee1c['query'][_0x2e98('0x48')]);_0xe22d88[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0xf0ee1c[_0x2e98('0x43')],_0x17d11e[_0x2e98('0x40')]));_0xe22d88[_0x2e98('0x49')][_0x2e98('0x66')]=_0x549f0d['id'];if(_0xf0ee1c['query'][_0x2e98('0x2f')]){_0xe22d88['where']=_[_0x2e98('0x4a')](_0xe22d88[_0x2e98('0x49')],{'$or':_['map'](_0xe22d88['attributes'],function(_0x142e78){var _0x4e8543={};_0x4e8543[_0x142e78]={'$like':'%'+_0xf0ee1c['query'][_0x2e98('0x2f')]+'%'};return _0x4e8543;})});}_0xe22d88=_[_0x2e98('0x4a')]({},_0xe22d88,_0xf0ee1c[_0x2e98('0x5a')]);return db[_0x2e98('0x6b')]['count']({'where':_0xe22d88['where']})[_0x2e98('0x29')](function(_0x2ef4d6){_0x4d9918['count']=_0x2ef4d6;if(_0xf0ee1c[_0x2e98('0x43')][_0x2e98('0x5f')]){_0xe22d88[_0x2e98('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xe22d88);})['then'](function(_0x252359){_0x4d9918[_0x2e98('0x4e')]=_0x252359;return _0x4d9918;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x177ccb,_0xe22d88))[_0x2e98('0x4f')](handleError(_0x177ccb,null));};exports['getHopperBlacks']=function(_0x45b1b4,_0x55d02c,_0x4ddfb5){var _0x486d7d={'raw':!![],'where':{}};var _0x1b2caf={};var _0x57656e={'count':0x0,'rows':[]};return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x45b1b4[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x55d02c,null))[_0x2e98('0x29')](function(_0xd6630c){if(_0xd6630c){_0x1b2caf[_0x2e98('0x42')]=_['keys'](db[_0x2e98('0x6c')][_0x2e98('0x3d')]);_0x1b2caf[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x45b1b4[_0x2e98('0x43')]);_0x1b2caf[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x1b2caf[_0x2e98('0x42')],_0x1b2caf['query']);_0x486d7d['attributes']=_[_0x2e98('0x41')](_0x1b2caf[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x45b1b4['query'][_0x2e98('0x45')]));_0x486d7d[_0x2e98('0x44')]=_0x486d7d[_0x2e98('0x44')][_0x2e98('0x52')]?_0x486d7d[_0x2e98('0x44')]:_0x1b2caf[_0x2e98('0x42')];if(!_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x486d7d[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x45b1b4['query'][_0x2e98('0x22')]);_0x486d7d[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x45b1b4[_0x2e98('0x43')]['offset']);}_0x486d7d['order']=qs[_0x2e98('0x48')](_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x48')]);_0x486d7d['where']=qs[_0x2e98('0x40')](_['pick'](_0x45b1b4['query'],_0x1b2caf[_0x2e98('0x40')]));_0x486d7d[_0x2e98('0x49')][_0x2e98('0x66')]=_0xd6630c['id'];if(_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x486d7d[_0x2e98('0x49')]=_['merge'](_0x486d7d[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x486d7d[_0x2e98('0x44')],function(_0x4c5f87){var _0x1459a0={};_0x1459a0[_0x4c5f87]={'$like':'%'+_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x1459a0;})});}_0x486d7d=_[_0x2e98('0x4a')]({},_0x486d7d,_0x45b1b4[_0x2e98('0x5a')]);return db[_0x2e98('0x6c')]['count']({'where':_0x486d7d[_0x2e98('0x49')]})[_0x2e98('0x29')](function(_0x414fe2){_0x57656e[_0x2e98('0x20')]=_0x414fe2;if(_0x45b1b4[_0x2e98('0x43')][_0x2e98('0x5f')]){_0x486d7d['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x2e98('0x4d')](_0x486d7d);})['then'](function(_0x3a4d0f){_0x57656e[_0x2e98('0x4e')]=_0x3a4d0f;return _0x57656e;});}})[_0x2e98('0x29')](respondWithFilteredResult(_0x55d02c,_0x486d7d))[_0x2e98('0x4f')](handleError(_0x55d02c,null));};exports['getTeams']=function(_0xa3c075,_0x4a24bd,_0x59a727){var _0x5c1a75={};var _0x4294ec={};var _0x498010;var _0x1e87e2;return db['VoiceQueue'][_0x2e98('0x68')]({'where':{'id':_0xa3c075['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4a24bd,null))['then'](function(_0x3bf480){if(_0x3bf480){_0x498010=_0x3bf480;_0x4294ec['model']=_['keys'](db['Team'][_0x2e98('0x3d')]);_0x4294ec[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0xa3c075[_0x2e98('0x43')]);_0x4294ec[_0x2e98('0x40')]=_['intersection'](_0x4294ec['model'],_0x4294ec['query']);_0x5c1a75[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x4294ec[_0x2e98('0x42')],qs['fields'](_0xa3c075[_0x2e98('0x43')]['fields']));_0x5c1a75['attributes']=_0x5c1a75[_0x2e98('0x44')][_0x2e98('0x52')]?_0x5c1a75[_0x2e98('0x44')]:_0x4294ec[_0x2e98('0x42')];_0x5c1a75[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0xa3c075[_0x2e98('0x43')][_0x2e98('0x48')]);_0x5c1a75[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0xa3c075['query'],_0x4294ec['filters']));if(_0xa3c075['query'][_0x2e98('0x2f')]){_0x5c1a75[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x5c1a75['where'],{'$or':_[_0x2e98('0x31')](_0x5c1a75[_0x2e98('0x44')],function(_0x2614c0){var _0x3f091f={};_0x3f091f[_0x2614c0]={'$like':'%'+_0xa3c075[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x3f091f;})});}_0x5c1a75=_[_0x2e98('0x4a')]({},_0x5c1a75,_0xa3c075[_0x2e98('0x5a')]);return _0x498010[_0x2e98('0x6d')](_0x5c1a75);}})[_0x2e98('0x29')](function(_0x13448b){if(_0x13448b){_0x1e87e2=_0x13448b['length'];if(!_0xa3c075[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x5c1a75[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0xa3c075[_0x2e98('0x43')]['limit']);_0x5c1a75[_0x2e98('0x21')]=qs['offset'](_0xa3c075[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x498010['getTeams'](_0x5c1a75);}})[_0x2e98('0x29')](function(_0x384c78){if(_0x384c78){return _0x384c78?{'count':_0x1e87e2,'rows':_0x384c78}:null;}})['then'](respondWithResult(_0x4a24bd,null))[_0x2e98('0x4f')](handleError(_0x4a24bd,null));};exports[_0x2e98('0x6e')]=function(_0x2c30ea,_0x27c0ce,_0x4d7980){var _0x48b479=_0x2c30ea[_0x2e98('0x5e')][_0x2e98('0x6f')];var _0x169d61=_['map'](_0x48b479,'id');return db[_0x2e98('0x70')][_0x2e98('0x4d')]({'where':{'id':_0x169d61},'attributes':['id'],'include':[{'model':db[_0x2e98('0x71')],'as':_0x2e98('0x72'),'attributes':['id',_0x2e98('0x39'),'online',_0x2e98('0x73'),'interface'],'raw':!![]}]})[_0x2e98('0x29')](function(_0x445d06){if(_0x445d06){var _0xb37ecf=_[_0x2e98('0x74')](_0x445d06,function(_0x121707){var _0x5503c2=_0x121707['get']({'plain':!![]});_0x5503c2[_0x2e98('0x72')]['forEach'](function(_0x5dfad7){_0x5dfad7[_0x2e98('0x75')]=_[_0x2e98('0x34')](_0x48b479,{'id':_0x5503c2['id']})[_0x2e98('0x75')];});return _0x5503c2['Agents'];});return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x2c30ea['params']['id']}})['then'](function(_0x5a4d7c){return db[_0x2e98('0x76')][_0x2e98('0x77')](function(_0x12d071){return _0x5a4d7c[_0x2e98('0x6e')](_0x169d61,{'transaction':_0x12d071})['then'](function(){return BPromise[_0x2e98('0x78')](_0xb37ecf,function(_0x1555d9){return db[_0x2e98('0x79')][_0x2e98('0x7a')]({'where':{'UserId':_0x1555d9['id'],'VoiceQueueId':_0x2c30ea[_0x2e98('0x51')]['id']},'defaults':{'penalty':_0x1555d9[_0x2e98('0x75')]},'transaction':_0x12d071});});})[_0x2e98('0x29')](function(){return BPromise[_0x2e98('0x78')](_['filter'](_0xb37ecf,{'online':!![]}),function(_0x23d623){return db[_0x2e98('0x7b')]['upsert']({'membername':_0x23d623[_0x2e98('0x39')],'UserId':_0x23d623['id'],'queue_name':_0x5a4d7c[_0x2e98('0x39')],'VoiceQueueId':_0x5a4d7c['id'],'interface':_[_0x2e98('0x7c')](_0x23d623[_0x2e98('0x7d')])?util[_0x2e98('0x7e')](_0x2e98('0x7f'),_0x23d623[_0x2e98('0x39')]):_0x23d623[_0x2e98('0x7d')],'paused':_0x23d623[_0x2e98('0x73')]||![],'penalty':_0x23d623[_0x2e98('0x75')]},{'transaction':_0x12d071});});})[_0x2e98('0x29')](function(){_0xb37ecf[_0x2e98('0x80')](function(_0x4b50a5){socket[_0x2e98('0x81')](_0x2e98('0x82'),{'UserId':_0x4b50a5['id'],'VoiceQueueId':_0x5a4d7c['id']});});});});});}})[_0x2e98('0x29')](respondWithStatusCode(_0x27c0ce,null))[_0x2e98('0x4f')](handleError(_0x27c0ce,null));};exports[_0x2e98('0x83')]=function(_0x2b033e,_0x17d0b2,_0x48f1cc){return db[_0x2e98('0x70')][_0x2e98('0x4d')]({'where':{'id':_0x2b033e[_0x2e98('0x43')][_0x2e98('0x84')]},'attributes':['id'],'include':[{'model':db[_0x2e98('0x71')],'as':_0x2e98('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2e98('0x29')](handleEntityNotFound(_0x17d0b2,null))['then'](function(_0x18c95f){var _0x5b5db8=_[_0x2e98('0x31')](_0x18c95f,'id');var _0x1be75e=[];var _0x3dd8ed=[];var _0x5992ec=squel[_0x2e98('0x85')]();_0x5992ec[_0x2e98('0x86')](_0x2e98('0x87'))[_0x2e98('0x88')](_0x2e98('0x89'),'tq')['join'](_0x2e98('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x2b033e[_0x2e98('0x51')]['id']);for(var _0x103eee=0x0;_0x103eee<_0x18c95f['length'];_0x103eee+=0x1){let _0x364ec8=_0x18c95f[_0x103eee];for(var _0x1009b8=0x0;_0x1009b8<_0x364ec8[_0x2e98('0x72')][_0x2e98('0x52')];_0x1009b8+=0x1){let _0x2ce951=_0x364ec8[_0x2e98('0x72')][_0x1009b8];var _0x478a64=_0x5992ec[_0x2e98('0x59')]();_0x478a64[_0x2e98('0x49')]('ut.UserId\x20=\x20?',_0x2ce951['id']);_0x3dd8ed[_0x2e98('0x8c')](db[_0x2e98('0x76')]['query'](_0x478a64['toString'](),{'type':db[_0x2e98('0x76')]['QueryTypes'][_0x2e98('0x8d')]})[_0x2e98('0x29')](function(_0x50c307){if(_0x50c307[_0x2e98('0x52')]===0x1){return _0x2ce951['id'];}else{var _0x3c7407=_['every'](_[_0x2e98('0x31')](_0x50c307,_0x2e98('0x8e')),function(_0x4be8f5){return _['includes'](_0x5b5db8,_0x4be8f5);});if(_0x3c7407){return _0x2ce951['id'];}}}));}}return BPromise[_0x2e98('0x8f')](_0x3dd8ed)[_0x2e98('0x29')](function(_0x4c96c1){_0x1be75e=_(_0x1be75e)[_0x2e98('0x90')](_0x4c96c1)[_0x2e98('0x91')]()[_0x2e98('0x32')]();return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x2b033e[_0x2e98('0x51')]['id']}})['then'](function(_0x27316f){return db[_0x2e98('0x76')][_0x2e98('0x77')](function(_0x439a61){return _0x27316f[_0x2e98('0x83')](_0x2b033e[_0x2e98('0x43')][_0x2e98('0x84')],{'transaction':_0x439a61})[_0x2e98('0x29')](function(){if(!_['isEmpty'](_0x1be75e)){return _0x27316f['removeAgents'](_0x1be75e,{'transaction':_0x439a61})[_0x2e98('0x29')](function(){return db[_0x2e98('0x7b')][_0x2e98('0x2a')]({'where':{'VoiceQueueId':_0x2b033e['params']['id'],'UserId':_0x1be75e},'transaction':_0x439a61});});}})['then'](function(){_0x1be75e['forEach'](function(_0x15078c){socket[_0x2e98('0x81')](_0x2e98('0x92'),{'UserId':_0x15078c,'VoiceQueueId':_0x27316f['id']});});});});});});})['then'](respondWithStatusCode(_0x17d0b2,null))[_0x2e98('0x4f')](handleError(_0x17d0b2,null));};exports[_0x2e98('0x93')]=function(_0x342404,_0x44f80a,_0x31c537){var _0x583376,_0x5d5349;return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x342404['params']['id']}})['then'](handleEntityNotFound(_0x44f80a,null))[_0x2e98('0x29')](function(_0x51a4ba){if(_0x51a4ba){_0x5d5349=_0x51a4ba;return _0x51a4ba[_0x2e98('0x93')](_0x342404[_0x2e98('0x5e')]['ids'],_['omit'](_0x342404[_0x2e98('0x5e')],['ids','id'])||{})['spread'](function(_0x865c5){for(var _0x5a9835=0x0;_0x5a9835<_0x342404[_0x2e98('0x5e')]['ids']['length'];_0x5a9835+=0x1){socket[_0x2e98('0x81')](_0x2e98('0x82'),{'UserId':_0x342404['body'][_0x2e98('0x84')][_0x5a9835],'VoiceQueueId':_0x342404['params']['id']});}return _0x865c5;});}})[_0x2e98('0x29')](function(_0x22d240){_0x583376=_0x22d240||[];if(_0x5d5349){return db[_0x2e98('0x71')][_0x2e98('0x4d')]({'where':{'id':_0x342404['body']['ids']},'attributes':['id',_0x2e98('0x39'),_0x2e98('0x94'),_0x2e98('0x73'),_0x2e98('0x7d')],'raw':!![]});}})['then'](function(_0x5aefbf){if(!_[_0x2e98('0x95')](_0x5aefbf)){var _0x31f2cb=[];for(var _0x2445e1=0x0;_0x2445e1<_0x5aefbf[_0x2e98('0x52')];_0x2445e1++){if(_0x5aefbf[_0x2445e1][_0x2e98('0x94')]){_0x31f2cb[_0x2e98('0x8c')](db[_0x2e98('0x7b')][_0x2e98('0x96')]({'membername':_0x5aefbf[_0x2445e1][_0x2e98('0x39')],'UserId':_0x5aefbf[_0x2445e1]['id'],'queue_name':_0x5d5349[_0x2e98('0x39')],'VoiceQueueId':_0x5d5349['id'],'interface':_[_0x2e98('0x7c')](_0x5aefbf[_0x2445e1]['interface'])?util[_0x2e98('0x7e')](_0x2e98('0x7f'),_0x5aefbf[_0x2445e1][_0x2e98('0x39')]):_0x5aefbf[_0x2445e1]['interface'],'paused':_0x5aefbf[_0x2445e1][_0x2e98('0x73')]||![],'penalty':_0x342404[_0x2e98('0x5e')]['penalty']||0x0}));}}return BPromise[_0x2e98('0x8f')](_0x31f2cb);}})[_0x2e98('0x29')](function(){return _0x583376;})['then'](respondWithResult(_0x44f80a,null))[_0x2e98('0x4f')](handleError(_0x44f80a,null));};exports[_0x2e98('0x97')]=function(_0x5ceadc,_0x3a4686,_0xda43f7){return db['VoiceQueue'][_0x2e98('0x34')]({'where':{'id':_0x5ceadc[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x3a4686,null))[_0x2e98('0x29')](function(_0x365dcd){if(_0x365dcd){return _0x365dcd[_0x2e98('0x97')](_0x5ceadc['query'][_0x2e98('0x84')])[_0x2e98('0x29')](function(){if(_['isArray'](_0x5ceadc[_0x2e98('0x43')]['ids'])){for(var _0x12c6a5=0x0;_0x12c6a5<_0x5ceadc[_0x2e98('0x43')]['ids'][_0x2e98('0x52')];_0x12c6a5+=0x1){socket[_0x2e98('0x81')](_0x2e98('0x92'),{'UserId':Number(_0x5ceadc[_0x2e98('0x43')][_0x2e98('0x84')][_0x12c6a5]),'VoiceQueueId':Number(_0x5ceadc['params']['id'])});}}else{socket[_0x2e98('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x5ceadc[_0x2e98('0x43')][_0x2e98('0x84')]),'VoiceQueueId':Number(_0x5ceadc[_0x2e98('0x51')]['id'])});}});}})[_0x2e98('0x29')](function(_0x40c9d5){return db['UserVoiceQueueRt'][_0x2e98('0x2a')]({'where':{'VoiceQueueId':_0x5ceadc['params']['id'],'UserId':_0x5ceadc['query'][_0x2e98('0x84')]}})[_0x2e98('0x29')](function(){return _0x40c9d5;});})['then'](respondWithStatusCode(_0x3a4686,null))[_0x2e98('0x4f')](handleError(_0x3a4686,null));};exports[_0x2e98('0x98')]=function(_0x4da8ce,_0x8c4789,_0x51ad30){var _0x50ec89={};var _0x3096cb={};var _0x4d28b9;var _0x182ba2;return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x4da8ce['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x8c4789,null))[_0x2e98('0x29')](function(_0x364003){if(_0x364003){_0x4d28b9=_0x364003;_0x3096cb[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x71')]['rawAttributes']);_0x3096cb[_0x2e98('0x43')]=_['keys'](_0x4da8ce[_0x2e98('0x43')]);_0x3096cb[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x3096cb[_0x2e98('0x42')],_0x3096cb['query']);_0x50ec89[_0x2e98('0x44')]=_['intersection'](_0x3096cb['model'],qs[_0x2e98('0x45')](_0x4da8ce['query'][_0x2e98('0x45')]));_0x50ec89[_0x2e98('0x44')]=_0x50ec89[_0x2e98('0x44')][_0x2e98('0x52')]?_0x50ec89[_0x2e98('0x44')]:_0x3096cb[_0x2e98('0x42')];_0x50ec89[_0x2e98('0x47')]=qs['sort'](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x48')]);_0x50ec89['where']=qs[_0x2e98('0x40')](_[_0x2e98('0x65')](_0x4da8ce[_0x2e98('0x43')],_0x3096cb['filters']));if(_0x4da8ce[_0x2e98('0x43')]['filter']){_0x50ec89[_0x2e98('0x49')]=_[_0x2e98('0x4a')](_0x50ec89[_0x2e98('0x49')],{'$or':_['map'](_0x50ec89[_0x2e98('0x44')],function(_0x5cb74e){var _0x529c80={};_0x529c80[_0x5cb74e]={'$like':'%'+_0x4da8ce['query'][_0x2e98('0x2f')]+'%'};return _0x529c80;})});}_0x50ec89=_['merge']({},_0x50ec89,_0x4da8ce[_0x2e98('0x5a')]);return _0x4d28b9[_0x2e98('0x98')](_0x50ec89);}})['then'](function(_0x179978){if(_0x179978){_0x182ba2=_0x179978[_0x2e98('0x52')];if(!_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x50ec89[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x22')]);_0x50ec89[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x4da8ce[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x4d28b9[_0x2e98('0x98')](_0x50ec89);}})[_0x2e98('0x29')](function(_0x497eba){if(_0x497eba){return _0x497eba?{'count':_0x182ba2,'rows':_0x497eba}:null;}})['then'](respondWithResult(_0x8c4789,null))['catch'](handleError(_0x8c4789,null));};exports[_0x2e98('0x99')]=function(_0x446fcb,_0x37f02d,_0x372d54){var _0x20d809={};var _0x36678d={};var _0x1e2b17;var _0x4a2f44;return db[_0x2e98('0x3c')]['findOne']({'where':{'id':_0x446fcb[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x37f02d,null))[_0x2e98('0x29')](function(_0x24aa48){if(_0x24aa48){_0x1e2b17=_0x24aa48;_0x36678d[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['UserVoiceQueueRt'][_0x2e98('0x3d')]);_0x36678d[_0x2e98('0x43')]=_['keys'](_0x446fcb[_0x2e98('0x43')]);_0x36678d['filters']=_[_0x2e98('0x41')](_0x36678d[_0x2e98('0x42')],_0x36678d[_0x2e98('0x43')]);_0x20d809[_0x2e98('0x44')]=_[_0x2e98('0x41')](_0x36678d[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x45')]));_0x20d809['attributes']=_0x20d809['attributes'][_0x2e98('0x52')]?_0x20d809[_0x2e98('0x44')]:_0x36678d[_0x2e98('0x42')];_0x20d809[_0x2e98('0x47')]=qs[_0x2e98('0x48')](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x48')]);_0x20d809[_0x2e98('0x49')]=qs[_0x2e98('0x40')](_['pick'](_0x446fcb[_0x2e98('0x43')],_0x36678d['filters']));if(_0x446fcb['query'][_0x2e98('0x2f')]){_0x20d809['where']=_['merge'](_0x20d809[_0x2e98('0x49')],{'$or':_[_0x2e98('0x31')](_0x20d809[_0x2e98('0x44')],function(_0x206cbe){var _0x2d5d35={};_0x2d5d35[_0x206cbe]={'$like':'%'+_0x446fcb[_0x2e98('0x43')]['filter']+'%'};return _0x2d5d35;})});}_0x20d809=_[_0x2e98('0x4a')]({},_0x20d809,_0x446fcb[_0x2e98('0x5a')]);return _0x1e2b17[_0x2e98('0x99')](_0x20d809);}})[_0x2e98('0x29')](function(_0x2b905c){if(_0x2b905c){_0x4a2f44=_0x2b905c['length'];if(!_0x446fcb[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x20d809[_0x2e98('0x22')]=qs[_0x2e98('0x22')](_0x446fcb['query'][_0x2e98('0x22')]);_0x20d809[_0x2e98('0x21')]=qs['offset'](_0x446fcb[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x1e2b17['getMembers'](_0x20d809);}})[_0x2e98('0x29')](function(_0x4d29c5){return _0x4d29c5?{'count':_0x4a2f44,'rows':_0x4d29c5}:null;})[_0x2e98('0x29')](respondWithResult(_0x37f02d,null))[_0x2e98('0x4f')](handleError(_0x37f02d,null));};exports[_0x2e98('0x9a')]=function(_0x1b379b,_0xeab1e0,_0x40143d){var _0x36cb29={};var _0x26c214={};var _0x50d38e;var _0x138119;return db['VoiceQueue'][_0x2e98('0x68')]({'where':{'id':_0x1b379b[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0xeab1e0,null))['then'](function(_0x59753f){if(_0x59753f){_0x50d38e=_0x59753f;_0x26c214[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db[_0x2e98('0x9b')][_0x2e98('0x3d')]);_0x26c214[_0x2e98('0x43')]=_['keys'](_0x1b379b[_0x2e98('0x43')]);_0x26c214[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x26c214['model'],_0x26c214[_0x2e98('0x43')]);_0x36cb29['attributes']=_[_0x2e98('0x41')](_0x26c214[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x45')]));_0x36cb29['attributes']=_0x36cb29['attributes'][_0x2e98('0x52')]?_0x36cb29[_0x2e98('0x44')]:_0x26c214[_0x2e98('0x42')];_0x36cb29['order']=qs[_0x2e98('0x48')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x48')]);_0x36cb29[_0x2e98('0x49')]=qs['filters'](_[_0x2e98('0x65')](_0x1b379b['query'],_0x26c214[_0x2e98('0x40')]));if(_0x1b379b[_0x2e98('0x43')]['filter']){_0x36cb29['where']=_['merge'](_0x36cb29['where'],{'$or':_[_0x2e98('0x31')](_0x36cb29[_0x2e98('0x44')],function(_0x1d54ba){var _0x24a311={};_0x24a311[_0x1d54ba]={'$like':'%'+_0x1b379b[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x24a311;})});}_0x36cb29=_[_0x2e98('0x4a')]({},_0x36cb29,_0x1b379b[_0x2e98('0x5a')]);return _0x50d38e[_0x2e98('0x9a')](_0x36cb29);}})[_0x2e98('0x29')](function(_0x79df28){if(_0x79df28){_0x138119=_0x79df28[_0x2e98('0x52')];if(!_0x1b379b[_0x2e98('0x43')][_0x2e98('0x46')]('nolimit')){_0x36cb29['limit']=qs[_0x2e98('0x22')](_0x1b379b['query'][_0x2e98('0x22')]);_0x36cb29[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x1b379b[_0x2e98('0x43')][_0x2e98('0x21')]);}return _0x50d38e[_0x2e98('0x9a')](_0x36cb29);}})[_0x2e98('0x29')](function(_0x19f4fb){if(_0x19f4fb){return _0x19f4fb?{'count':_0x138119,'rows':_0x19f4fb}:null;}})['then'](respondWithResult(_0xeab1e0,null))[_0x2e98('0x4f')](handleError(_0xeab1e0,null));};exports[_0x2e98('0x9c')]=function(_0x358f0e,_0x4ce6b0,_0x4ee49d){var _0x401037,_0x134ac3;return db[_0x2e98('0x3c')]['find']({'where':{'id':_0x358f0e['params']['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x4ce6b0,null))[_0x2e98('0x29')](function(_0x381e4b){if(_0x381e4b){_0x134ac3=_0x381e4b;return _0x381e4b[_0x2e98('0x9c')](_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x84')],_[_0x2e98('0x5b')](_0x358f0e[_0x2e98('0x5e')],[_0x2e98('0x84'),'id'])||{});}return null;})[_0x2e98('0x9d')](function(_0x21ebeb){var _0x47cf43;_0x401037=_0x21ebeb||[];var _0x18a157=[];if(_0x21ebeb){for(var _0x1e9ba4=0x0;_0x1e9ba4<_0x21ebeb[_0x2e98('0x52')];_0x1e9ba4+=0x1){var _0x538d9e=_0x21ebeb[_0x1e9ba4][_0x2e98('0x55')]({'plain':!![]});_0x134ac3['dialCheckDuplicateType']=_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x9e')]?_0x358f0e[_0x2e98('0x5e')][_0x2e98('0x9e')]:_0x134ac3['dialCheckDuplicateType'];switch(_0x134ac3[_0x2e98('0x9e')]){case _0x2e98('0x9f'):_0x47cf43=squel['insert']()[_0x2e98('0xa0')]('cm_hopper')[_0x2e98('0xa1')]([_0x2e98('0xa2'),_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),'VoiceQueueId','createdAt',_0x2e98('0x5d')],squel['select']()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))[_0x2e98('0x86')]('id',_0x2e98('0xa4'))['field'](_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')](),_0x2e98('0xa5'))[_0x2e98('0x86')](_0x358f0e['params']['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5c'))['field'](_0x2e98('0xa6'),_0x2e98('0x5d'))['from'](_0x2e98('0xa9'))['where'](_0x2e98('0xaa'))[_0x2e98('0x49')]('ListId\x20=\x20?',_0x538d9e['CmListId']['toString']())[_0x2e98('0x49')](_0x2e98('0xab'))[_0x2e98('0x49')](_0x2e98('0xac'),squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xad'))[_0x2e98('0x88')](_0x2e98('0xae'))['where'](_0x2e98('0x8b'),_0x358f0e['params']['id'][_0x2e98('0xa8')]()))['where'](_0x2e98('0xac'),squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xaf'))[_0x2e98('0x88')]('cm_hopper')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x358f0e['params']['id']['toString']())))[_0x2e98('0xa8')]();break;case'onlyIfOpen':_0x47cf43=squel[_0x2e98('0xb0')]()[_0x2e98('0xa0')](_0x2e98('0xb1'))[_0x2e98('0xa1')]([_0x2e98('0xa2'),_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),'updatedAt'],squel['select']()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))[_0x2e98('0x86')]('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')](),_0x2e98('0xa5'))[_0x2e98('0x86')](_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))[_0x2e98('0x86')]('NOW()',_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5d'))[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x538d9e[_0x2e98('0xa7')][_0x2e98('0xa8')]())[_0x2e98('0x49')](_0x2e98('0xab'))[_0x2e98('0x49')](_0x2e98('0xac'),squel['select']()[_0x2e98('0x86')](_0x2e98('0xaf'))[_0x2e98('0x88')]('cm_hopper')[_0x2e98('0x49')](_0x2e98('0x8b'),_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')]())))[_0x2e98('0xa8')]();break;default:_0x47cf43=squel['insert']()['into'](_0x2e98('0xb1'))[_0x2e98('0xa1')](['phone',_0x2e98('0xa3'),_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),_0x2e98('0x5d')],squel[_0x2e98('0x85')]()[_0x2e98('0x86')](_0x2e98('0xa2'),_0x2e98('0xa2'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0xa3'))['field']('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x538d9e['CmListId'][_0x2e98('0xa8')](),_0x2e98('0xa5'))['field'](_0x358f0e[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))['field'](_0x2e98('0xa6'),_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),'updatedAt')[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x538d9e[_0x2e98('0xa7')]['toString']())[_0x2e98('0x49')](_0x2e98('0xab')))['toString']();}_0x18a157[_0x2e98('0x8c')](db['sequelize'][_0x2e98('0x43')](_0x47cf43));}return BPromise[_0x2e98('0x8f')](_0x18a157);}})[_0x2e98('0x29')](function(){return _0x401037;})[_0x2e98('0x29')](respondWithResult(_0x4ce6b0,null))[_0x2e98('0x4f')](handleError(_0x4ce6b0,null));};exports['removeLists']=function(_0x39c047,_0xa82d0d,_0x3a8b67){return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x39c047[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0xa82d0d,null))['then'](function(_0x119531){if(_0x119531){return _0x119531[_0x2e98('0xb3')](_0x39c047[_0x2e98('0x43')]['ids']);}})[_0x2e98('0x29')](function(_0xd6780a){if(_0xd6780a){return db[_0x2e98('0x63')][_0x2e98('0x2a')]({'where':{'ListId':_0x39c047['query']['ids'],'VoiceQueueId':_0x39c047[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](function(){return _0xd6780a;});}})[_0x2e98('0x29')](respondWithStatusCode(_0xa82d0d,null))[_0x2e98('0x4f')](handleError(_0xa82d0d,null));};exports[_0x2e98('0xb4')]=function(_0x57442e,_0x88884c,_0x8ea91b){var _0x146545={};var _0x374a2e={};var _0x1de678;var _0x5c3f64;return db[_0x2e98('0x3c')][_0x2e98('0x68')]({'where':{'id':_0x57442e[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0x88884c,null))[_0x2e98('0x29')](function(_0x313026){if(_0x313026){_0x1de678=_0x313026;_0x374a2e[_0x2e98('0x42')]=_[_0x2e98('0x3f')](db['CmList'][_0x2e98('0x3d')]);_0x374a2e[_0x2e98('0x43')]=_[_0x2e98('0x3f')](_0x57442e[_0x2e98('0x43')]);_0x374a2e[_0x2e98('0x40')]=_[_0x2e98('0x41')](_0x374a2e[_0x2e98('0x42')],_0x374a2e[_0x2e98('0x43')]);_0x146545['attributes']=_[_0x2e98('0x41')](_0x374a2e[_0x2e98('0x42')],qs[_0x2e98('0x45')](_0x57442e[_0x2e98('0x43')][_0x2e98('0x45')]));_0x146545['attributes']=_0x146545['attributes']['length']?_0x146545[_0x2e98('0x44')]:_0x374a2e[_0x2e98('0x42')];_0x146545[_0x2e98('0x47')]=qs['sort'](_0x57442e[_0x2e98('0x43')][_0x2e98('0x48')]);_0x146545[_0x2e98('0x49')]=qs['filters'](_[_0x2e98('0x65')](_0x57442e[_0x2e98('0x43')],_0x374a2e[_0x2e98('0x40')]));if(_0x57442e[_0x2e98('0x43')][_0x2e98('0x2f')]){_0x146545[_0x2e98('0x49')]=_['merge'](_0x146545[_0x2e98('0x49')],{'$or':_['map'](_0x146545[_0x2e98('0x44')],function(_0x2b699e){var _0x5b1bfb={};_0x5b1bfb[_0x2b699e]={'$like':'%'+_0x57442e[_0x2e98('0x43')][_0x2e98('0x2f')]+'%'};return _0x5b1bfb;})});}_0x146545=_[_0x2e98('0x4a')]({},_0x146545,_0x57442e[_0x2e98('0x5a')]);return _0x1de678['getBlackLists'](_0x146545);}})[_0x2e98('0x29')](function(_0x4b8243){if(_0x4b8243){_0x5c3f64=_0x4b8243['length'];if(!_0x57442e[_0x2e98('0x43')][_0x2e98('0x46')](_0x2e98('0x64'))){_0x146545[_0x2e98('0x22')]=qs['limit'](_0x57442e[_0x2e98('0x43')]['limit']);_0x146545[_0x2e98('0x21')]=qs[_0x2e98('0x21')](_0x57442e[_0x2e98('0x43')]['offset']);}return _0x1de678['getBlackLists'](_0x146545);}})[_0x2e98('0x29')](function(_0x1457b6){if(_0x1457b6){return _0x1457b6?{'count':_0x5c3f64,'rows':_0x1457b6}:null;}})[_0x2e98('0x29')](respondWithResult(_0x88884c,null))[_0x2e98('0x4f')](handleError(_0x88884c,null));};exports['addBlackLists']=function(_0x4a8633,_0xd85ea4,_0x996d65){var _0x38f670,_0x327173;return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x4a8633[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](handleEntityNotFound(_0xd85ea4,null))[_0x2e98('0x29')](function(_0x2be656){if(_0x2be656){_0x327173=_0x2be656;return _0x2be656[_0x2e98('0xb5')](_0x4a8633[_0x2e98('0x5e')]['ids'],_[_0x2e98('0x5b')](_0x4a8633[_0x2e98('0x5e')],[_0x2e98('0x84'),'id'])||{});}return null;})[_0x2e98('0x9d')](function(_0x168ade){var _0x5f4715;_0x38f670=_0x168ade||[];var _0x3ec265=[];if(_0x168ade){for(var _0x744f5b=0x0;_0x744f5b<_0x168ade[_0x2e98('0x52')];_0x744f5b+=0x1){var _0x31c54d=_0x168ade[_0x744f5b]['get']({'plain':!![]});_0x5f4715=squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone',_0x2e98('0xa4'),_0x2e98('0xa5'),_0x2e98('0x66'),_0x2e98('0x5c'),_0x2e98('0x5d')],squel[_0x2e98('0x85')]()['field'](_0x2e98('0xa2'),'phone')[_0x2e98('0x86')]('id',_0x2e98('0xa4'))[_0x2e98('0x86')](_0x31c54d['CmListId'][_0x2e98('0xa8')](),_0x2e98('0xa5'))['field'](_0x4a8633[_0x2e98('0x51')]['id'][_0x2e98('0xa8')](),_0x2e98('0x66'))['field'](_0x2e98('0xa6'),_0x2e98('0x5c'))[_0x2e98('0x86')](_0x2e98('0xa6'),_0x2e98('0x5d'))[_0x2e98('0x88')](_0x2e98('0xa9'))[_0x2e98('0x49')](_0x2e98('0xaa'))[_0x2e98('0x49')](_0x2e98('0xb2'),_0x31c54d[_0x2e98('0xa7')]['toString']())[_0x2e98('0x49')](_0x2e98('0xab')))['toString']();_0x3ec265[_0x2e98('0x8c')](db[_0x2e98('0x76')][_0x2e98('0x43')](_0x5f4715));}return BPromise[_0x2e98('0x8f')](_0x3ec265);}})[_0x2e98('0x29')](function(){return _0x38f670;})[_0x2e98('0x29')](respondWithResult(_0xd85ea4,null))[_0x2e98('0x4f')](handleError(_0xd85ea4,null));};exports[_0x2e98('0xb6')]=function(_0x38a26e,_0x2bf78c,_0x12c16e){return db[_0x2e98('0x3c')][_0x2e98('0x34')]({'where':{'id':_0x38a26e[_0x2e98('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf78c,null))[_0x2e98('0x29')](function(_0x2feba4){if(_0x2feba4){return _0x2feba4[_0x2e98('0xb6')](_0x38a26e[_0x2e98('0x43')][_0x2e98('0x84')]);}})['then'](function(_0x233d6b){if(_0x233d6b){return db[_0x2e98('0x6c')][_0x2e98('0x2a')]({'where':{'ListId':_0x38a26e[_0x2e98('0x43')][_0x2e98('0x84')],'VoiceQueueId':_0x38a26e[_0x2e98('0x51')]['id']}})[_0x2e98('0x29')](function(){return _0x233d6b;});}})['then'](respondWithStatusCode(_0x2bf78c,null))[_0x2e98('0x4f')](handleError(_0x2bf78c,null));}; \ No newline at end of file +var _0xedc2=['sendStatus','status','offset','limit','set','apply','reject','save','update','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','count','includeAll','findAll','rows','catch','show','params','length','include','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','addTeams','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','push','isArray','destroy','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x5c753d,_0x47ccd9){var _0x5859ca=function(_0xc791a5){while(--_0xc791a5){_0x5c753d['push'](_0x5c753d['shift']());}};_0x5859ca(++_0x47ccd9);}(_0xedc2,0x98));var _0x2edc=function(_0x542b1c,_0x581e16){_0x542b1c=_0x542b1c-0x0;var _0xc08a22=_0xedc2[_0x542b1c];return _0xc08a22;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2edc('0x0'));var rimraf=require(_0x2edc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2edc('0x2'));var moment=require(_0x2edc('0x3'));var BPromise=require(_0x2edc('0x4'));var Mustache=require('mustache');var util=require(_0x2edc('0x5'));var path=require(_0x2edc('0x6'));var sox=require('sox');var csv=require(_0x2edc('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2edc('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2edc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2edc('0x7'));var querystring=require('querystring');var Papa=require(_0x2edc('0xa'));var Redis=require('ioredis');var authService=require(_0x2edc('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x2edc('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2edc('0xd'));var utils=require(_0x2edc('0xe'));var config=require(_0x2edc('0xf'));var licenseUtil=require(_0x2edc('0x10'));var db=require(_0x2edc('0x11'))['db'];config[_0x2edc('0x12')]=_[_0x2edc('0x13')](config[_0x2edc('0x12')],{'host':_0x2edc('0x14'),'port':0x18eb});var socket=require(_0x2edc('0x15'))(new Redis(config[_0x2edc('0x12')]));require(_0x2edc('0x16'))[_0x2edc('0x17')](socket);function respondWithStatusCode(_0x542e87,_0x43466f){_0x43466f=_0x43466f||0xcc;return function(_0x1fcca9){if(_0x1fcca9){return _0x542e87[_0x2edc('0x18')](_0x43466f);}return _0x542e87[_0x2edc('0x19')](_0x43466f)['end']();};}function respondWithResult(_0x1da16a,_0x27aeb3){_0x27aeb3=_0x27aeb3||0xc8;return function(_0x3a98bd){if(_0x3a98bd){return _0x1da16a[_0x2edc('0x19')](_0x27aeb3)['json'](_0x3a98bd);}};}function respondWithFilteredResult(_0xdd3287,_0x50ea15){return function(_0x46fbad){if(_0x46fbad){var _0x1ba39d=_0x46fbad['count'],_0x5a89ea=_0x50ea15[_0x2edc('0x1a')],_0x4528f7=_0x50ea15[_0x2edc('0x1a')]+_0x50ea15[_0x2edc('0x1b')],_0x209e66;if(_0x4528f7>=_0x1ba39d){_0x4528f7=_0x1ba39d;_0x209e66=0xc8;}else{_0x209e66=0xce;}_0xdd3287[_0x2edc('0x19')](_0x209e66);return _0xdd3287[_0x2edc('0x1c')]('Content-Range',_0x5a89ea+'-'+_0x4528f7+'/'+_0x1ba39d)['json'](_0x46fbad);}return null;};}function patchUpdates(_0x574964){return function(_0x788071){try{jsonpatch[_0x2edc('0x1d')](_0x788071,_0x574964,!![]);}catch(_0x3df4b6){return BPromise[_0x2edc('0x1e')](_0x3df4b6);}return _0x788071[_0x2edc('0x1f')]();};}function saveUpdates(_0x5ef234,_0x34663a){return function(_0x141f20){if(_0x141f20){return _0x141f20[_0x2edc('0x20')](_0x5ef234)[_0x2edc('0x21')](function(_0x3aab75){return _0x3aab75;});}return null;};}function removeEntity(_0x1205fc,_0x76e922){return function(_0x44fcb6){if(_0x44fcb6){return _0x44fcb6['destroy']()['then'](function(){var _0xae5946=_0x44fcb6[_0x2edc('0x22')]({'plain':!![]});var _0x4214d9=[{'name':'VoiceQueues','value':_0x2edc('0x23'),'ignore':![]},{'name':_0x2edc('0x24'),'value':_0x2edc('0x25'),'ignore':![]}];var _0x39cc49=_(_0x4214d9)[_0x2edc('0x26')](_0x2edc('0x27'))[_0x2edc('0x28')](_0x2edc('0x29'))[_0x2edc('0x29')]();if(_[_0x2edc('0x2a')](_0x39cc49,_0xae5946[_0x2edc('0x2b')])){return;}var _0x13ac4e=_[_0x2edc('0x2c')](_0x4214d9,[_0x2edc('0x29'),_0xae5946[_0x2edc('0x2b')]])[_0x2edc('0x2d')];return db[_0x2edc('0x2e')]['destroy']({'where':{'type':_0x13ac4e,'resourceId':_0xae5946['id']}})[_0x2edc('0x21')](function(){return _0x44fcb6;});})[_0x2edc('0x21')](function(){_0x1205fc[_0x2edc('0x19')](0xcc)[_0x2edc('0x2f')]();});}};}function handleEntityNotFound(_0x5f564a,_0x10b49e){return function(_0x1288c2){if(!_0x1288c2){_0x5f564a[_0x2edc('0x18')](0x194);}return _0x1288c2;};}function handleError(_0x2dcc41,_0xd132ba){_0xd132ba=_0xd132ba||0x1f4;return function(_0x9177c0){logger[_0x2edc('0x30')](_0x9177c0[_0x2edc('0x31')]);if(_0x9177c0[_0x2edc('0x2d')]){delete _0x9177c0[_0x2edc('0x2d')];}_0x2dcc41[_0x2edc('0x19')](_0xd132ba)[_0x2edc('0x32')](_0x9177c0);};}exports[_0x2edc('0x33')]=function(_0x8a726e,_0x3a2af4){var _0x2e9774={},_0x194f20={},_0x32290e={'count':0x0,'rows':[]};var _0x5b4925=_[_0x2edc('0x28')](db[_0x2edc('0x34')][_0x2edc('0x35')],function(_0xa246b4){return{'name':_0xa246b4['fieldName'],'type':_0xa246b4[_0x2edc('0x2b')]['key']};});_0x194f20[_0x2edc('0x36')]=_[_0x2edc('0x28')](_0x5b4925,_0x2edc('0x2d'));_0x194f20[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x8a726e[_0x2edc('0x37')]);_0x194f20[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x194f20['model'],_0x194f20[_0x2edc('0x37')]);_0x2e9774[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x194f20['model'],qs[_0x2edc('0x3c')](_0x8a726e[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2e9774[_0x2edc('0x3b')]=_0x2e9774[_0x2edc('0x3b')]['length']?_0x2e9774[_0x2edc('0x3b')]:_0x194f20[_0x2edc('0x36')];if(!_0x8a726e[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x2e9774['limit']=qs[_0x2edc('0x1b')](_0x8a726e['query'][_0x2edc('0x1b')]);_0x2e9774[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x8a726e[_0x2edc('0x37')]['offset']);}_0x2e9774[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x8a726e[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2e9774[_0x2edc('0x41')]=qs['filters'](_[_0x2edc('0x42')](_0x8a726e['query'],_0x194f20['filters']),_0x5b4925);if(_0x8a726e['query'][_0x2edc('0x26')]){_0x2e9774[_0x2edc('0x41')]=_['merge'](_0x2e9774[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x5b4925,function(_0x35064a){if(_0x35064a[_0x2edc('0x2b')]!=='VIRTUAL'){var _0x4a9fa5={};_0x4a9fa5[_0x35064a['name']]={'$like':'%'+_0x8a726e['query'][_0x2edc('0x26')]+'%'};return _0x4a9fa5;}})});}_0x2e9774=_['merge']({},_0x2e9774,_0x8a726e['options']);var _0x394eb4={'where':_0x2e9774[_0x2edc('0x41')]};return db['VoiceQueue']['count'](_0x394eb4)['then'](function(_0x3b8003){_0x32290e[_0x2edc('0x43')]=_0x3b8003;if(_0x8a726e[_0x2edc('0x37')][_0x2edc('0x44')]){_0x2e9774['include']=[{'all':!![]}];}return db[_0x2edc('0x34')][_0x2edc('0x45')](_0x2e9774);})['then'](function(_0x532704){_0x32290e[_0x2edc('0x46')]=_0x532704;return _0x32290e;})[_0x2edc('0x21')](respondWithFilteredResult(_0x3a2af4,_0x2e9774))[_0x2edc('0x47')](handleError(_0x3a2af4,null));};exports[_0x2edc('0x48')]=function(_0x56391,_0x2fa358){var _0x5ba42d={'raw':![],'where':{'id':_0x56391[_0x2edc('0x49')]['id']}},_0xd73320={};_0xd73320['model']=_[_0x2edc('0x38')](db[_0x2edc('0x34')]['rawAttributes']);_0xd73320[_0x2edc('0x37')]=_['keys'](_0x56391[_0x2edc('0x37')]);_0xd73320['filters']=_[_0x2edc('0x3a')](_0xd73320[_0x2edc('0x36')],_0xd73320['query']);_0x5ba42d[_0x2edc('0x3b')]=_['intersection'](_0xd73320[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x56391[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x5ba42d['attributes']=_0x5ba42d[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x5ba42d[_0x2edc('0x3b')]:_0xd73320[_0x2edc('0x36')];if(_0x56391[_0x2edc('0x37')][_0x2edc('0x44')]){_0x5ba42d[_0x2edc('0x4b')]=[{'all':!![]}];}_0x5ba42d=_[_0x2edc('0x4c')]({},_0x5ba42d,_0x56391['options']);return db[_0x2edc('0x34')][_0x2edc('0x2c')](_0x5ba42d)[_0x2edc('0x21')](handleEntityNotFound(_0x2fa358,null))[_0x2edc('0x21')](respondWithResult(_0x2fa358,null))[_0x2edc('0x47')](handleError(_0x2fa358,null));};exports['create']=function(_0x4d4ab5,_0x1c014f){return db[_0x2edc('0x34')][_0x2edc('0x4d')](_0x4d4ab5['body'],{})[_0x2edc('0x21')](function(_0x58680a){var _0x144ea9=_0x4d4ab5[_0x2edc('0x4e')][_0x2edc('0x22')]({'plain':!![]});if(!_0x144ea9)throw new Error(_0x2edc('0x4f'));if(_0x144ea9[_0x2edc('0x50')]==='user'){var _0x5acc63=_0x58680a['get']({'plain':!![]});var _0x47a9fc=[{'name':_0x2edc('0x51'),'value':_0x2edc('0x23')},{'name':_0x2edc('0x24'),'value':'outbound'}];var _0x254154=_['find'](_0x47a9fc,[_0x2edc('0x29'),_0x5acc63[_0x2edc('0x2b')]])[_0x2edc('0x2d')];return db[_0x2edc('0x52')]['find']({'where':{'name':_0x254154,'userProfileId':_0x144ea9[_0x2edc('0x53')]},'raw':!![]})[_0x2edc('0x21')](function(_0x45dee1){if(_0x45dee1&&_0x45dee1[_0x2edc('0x54')]===0x0){return db[_0x2edc('0x2e')][_0x2edc('0x4d')]({'name':_0x5acc63[_0x2edc('0x2d')],'resourceId':_0x5acc63['id'],'type':_0x45dee1['name'],'sectionId':_0x45dee1['id']},{})[_0x2edc('0x21')](function(){return _0x58680a;});}else{return _0x58680a;}})[_0x2edc('0x47')](function(_0x29f1fd){logger[_0x2edc('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29f1fd);throw _0x29f1fd;});}return _0x58680a;})[_0x2edc('0x21')](respondWithResult(_0x1c014f,0xc9))['catch'](handleError(_0x1c014f,null));};exports[_0x2edc('0x55')]=function(_0x5ee2f0,_0x31c52a){var _0x43e0d1={'where':{'id':_0x5ee2f0['params']['id']}},_0xf3e9fd={};_0xf3e9fd['model']=_[_0x2edc('0x38')](db['VoiceQueue'][_0x2edc('0x35')]);_0x43e0d1[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0xf3e9fd['model'],qs['fields'](_0x5ee2f0[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x43e0d1[_0x2edc('0x3b')]=_0x43e0d1[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x43e0d1[_0x2edc('0x3b')]:_0xf3e9fd[_0x2edc('0x36')];if(_0x5ee2f0['query'][_0x2edc('0x44')]){_0x43e0d1['include']=[{'all':!![]}];}_0x43e0d1=_[_0x2edc('0x4c')]({},_0x43e0d1,_0x5ee2f0[_0x2edc('0x56')]);return db[_0x2edc('0x34')]['find'](_0x43e0d1)[_0x2edc('0x21')](handleEntityNotFound(_0x31c52a,null))['then'](function(_0x55923b){if(_0x55923b){var _0x4e8d95=_0x55923b['get']({'plain':!![]});_0x4e8d95=qs[_0x2edc('0x57')](_0x4e8d95,['id',_0x2edc('0x58'),_0x2edc('0x59')]);_0x5ee2f0[_0x2edc('0x5a')]=_[_0x2edc('0x57')](_0x5ee2f0[_0x2edc('0x5a')],['id',_0x2edc('0x58'),_0x2edc('0x59')]);return db[_0x2edc('0x34')]['create'](_[_0x2edc('0x4c')](_0x4e8d95,_0x5ee2f0[_0x2edc('0x5a')]),{'include':_0x5ee2f0[_0x2edc('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x2edc('0x21')](function(_0xbe18c0){var _0x215e21=_0x5ee2f0[_0x2edc('0x4e')][_0x2edc('0x22')]({'plain':!![]});if(!_0x215e21)throw new Error(_0x2edc('0x4f'));if(_0x215e21['role']===_0x2edc('0x4e')){var _0x428d20=_0xbe18c0[_0x2edc('0x22')]({'plain':!![]});var _0xaa5f2f=[{'name':_0x2edc('0x51'),'value':_0x2edc('0x23')},{'name':_0x2edc('0x24'),'value':'outbound'}];var _0x20361d=_[_0x2edc('0x2c')](_0xaa5f2f,[_0x2edc('0x29'),_0x428d20['type']])[_0x2edc('0x2d')];return db[_0x2edc('0x52')][_0x2edc('0x2c')]({'where':{'name':_0x20361d,'userProfileId':_0x215e21[_0x2edc('0x53')]},'raw':!![]})[_0x2edc('0x21')](function(_0x44e44b){if(_0x44e44b&&_0x44e44b[_0x2edc('0x54')]===0x0){return db[_0x2edc('0x2e')][_0x2edc('0x4d')]({'name':_0x428d20[_0x2edc('0x2d')],'resourceId':_0x428d20['id'],'type':_0x44e44b[_0x2edc('0x2d')],'sectionId':_0x44e44b['id']},{})[_0x2edc('0x21')](function(){return _0xbe18c0;});}else{return _0xbe18c0;}})[_0x2edc('0x47')](function(_0x3fc374){logger[_0x2edc('0x30')](_0x2edc('0x5b'),_0x3fc374);throw _0x3fc374;});}return _0xbe18c0;});}})[_0x2edc('0x21')](respondWithResult(_0x31c52a,0xc9))[_0x2edc('0x47')](handleError(_0x31c52a,null));};exports['update']=function(_0x4be25c,_0x557ed0){if(_0x4be25c[_0x2edc('0x5a')]['id']){delete _0x4be25c[_0x2edc('0x5a')]['id'];}return db[_0x2edc('0x34')]['find']({'where':{'id':_0x4be25c[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x557ed0,null))[_0x2edc('0x21')](saveUpdates(_0x4be25c[_0x2edc('0x5a')],null))[_0x2edc('0x21')](respondWithResult(_0x557ed0,null))[_0x2edc('0x47')](handleError(_0x557ed0,null));};exports['destroy']=function(_0x2a7020,_0x3dfb88){return db[_0x2edc('0x34')]['find']({'where':{'id':_0x2a7020[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x3dfb88,null))[_0x2edc('0x21')](removeEntity(_0x3dfb88,null))[_0x2edc('0x47')](handleError(_0x3dfb88,null));};exports[_0x2edc('0x5c')]=function(_0x57779a,_0x894faa,_0x599fbf){var _0x2b6962={'raw':![],'where':{}};var _0x304229={};var _0x401d36={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x57779a['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x894faa,null))[_0x2edc('0x21')](function(_0x87f7){if(_0x87f7){_0x304229[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x5e')][_0x2edc('0x35')]);_0x304229[_0x2edc('0x37')]=_['keys'](_0x57779a[_0x2edc('0x37')]);_0x304229[_0x2edc('0x39')]=_['intersection'](_0x304229[_0x2edc('0x36')],_0x304229[_0x2edc('0x37')]);_0x2b6962['attributes']=_[_0x2edc('0x3a')](_0x304229[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x57779a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2b6962['attributes']=_0x2b6962[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x2b6962[_0x2edc('0x3b')]:_0x304229[_0x2edc('0x36')];if(!_0x57779a[_0x2edc('0x37')][_0x2edc('0x3d')]('nolimit')){_0x2b6962[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x57779a[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x2b6962[_0x2edc('0x1a')]=qs['offset'](_0x57779a[_0x2edc('0x37')]['offset']);}_0x2b6962['order']=qs['sort'](_0x57779a[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2b6962[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x57779a[_0x2edc('0x37')],_0x304229[_0x2edc('0x39')]));_0x2b6962['where']['VoiceQueueId']=_0x87f7['id'];if(_0x57779a[_0x2edc('0x37')][_0x2edc('0x26')]){_0x2b6962[_0x2edc('0x41')]=_['merge'](_0x2b6962[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x2b6962['attributes'],function(_0x305c43){var _0xe60b9b={};_0xe60b9b[_0x305c43]={'$like':'%'+_0x57779a[_0x2edc('0x37')]['filter']+'%'};return _0xe60b9b;})});}_0x2b6962=_[_0x2edc('0x4c')]({},_0x2b6962,_0x57779a[_0x2edc('0x56')]);return db[_0x2edc('0x5e')][_0x2edc('0x43')]({'where':_0x2b6962['where']})['then'](function(_0x480601){_0x401d36['count']=_0x480601;if(_0x57779a[_0x2edc('0x37')][_0x2edc('0x44')]){_0x2b6962[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x5e')][_0x2edc('0x45')](_0x2b6962);})[_0x2edc('0x21')](function(_0x4f50b9){_0x401d36[_0x2edc('0x46')]=_0x4f50b9;return _0x401d36;});}})[_0x2edc('0x21')](respondWithFilteredResult(_0x894faa,_0x2b6962))[_0x2edc('0x47')](handleError(_0x894faa,null));};exports[_0x2edc('0x5f')]=function(_0x5956dc,_0x4da5f6,_0x18c2aa){var _0x4a303f={'raw':!![],'where':{}};var _0x19ad09={};var _0xf07a85={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2edc('0x5d')]({'where':{'id':_0x5956dc[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x4da5f6,null))['then'](function(_0x3afded){if(_0x3afded){_0x19ad09[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x60')][_0x2edc('0x35')]);_0x19ad09[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x5956dc[_0x2edc('0x37')]);_0x19ad09[_0x2edc('0x39')]=_['intersection'](_0x19ad09[_0x2edc('0x36')],_0x19ad09[_0x2edc('0x37')]);_0x4a303f['attributes']=_['intersection'](_0x19ad09[_0x2edc('0x36')],qs['fields'](_0x5956dc[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x4a303f[_0x2edc('0x3b')]=_0x4a303f[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x4a303f[_0x2edc('0x3b')]:_0x19ad09[_0x2edc('0x36')];if(!_0x5956dc[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x4a303f[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x5956dc['query'][_0x2edc('0x1b')]);_0x4a303f[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x5956dc[_0x2edc('0x37')][_0x2edc('0x1a')]);}_0x4a303f['order']=qs[_0x2edc('0x40')](_0x5956dc['query']['sort']);_0x4a303f[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x5956dc[_0x2edc('0x37')],_0x19ad09[_0x2edc('0x39')]));_0x4a303f[_0x2edc('0x41')][_0x2edc('0x61')]=_0x3afded['id'];if(_0x5956dc['query'][_0x2edc('0x26')]){_0x4a303f[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x4a303f['where'],{'$or':_[_0x2edc('0x28')](_0x4a303f[_0x2edc('0x3b')],function(_0x46d95e){var _0x4d589c={};_0x4d589c[_0x46d95e]={'$like':'%'+_0x5956dc[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x4d589c;})});}_0x4a303f=_[_0x2edc('0x4c')]({},_0x4a303f,_0x5956dc[_0x2edc('0x56')]);return db[_0x2edc('0x60')][_0x2edc('0x43')]({'where':_0x4a303f[_0x2edc('0x41')]})[_0x2edc('0x21')](function(_0x439b1a){_0xf07a85[_0x2edc('0x43')]=_0x439b1a;if(_0x5956dc[_0x2edc('0x37')][_0x2edc('0x44')]){_0x4a303f[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x60')][_0x2edc('0x45')](_0x4a303f);})[_0x2edc('0x21')](function(_0x111392){_0xf07a85['rows']=_0x111392;return _0xf07a85;});}})['then'](respondWithFilteredResult(_0x4da5f6,_0x4a303f))['catch'](handleError(_0x4da5f6,null));};exports['getHopperFinals']=function(_0x110d72,_0x6c1065,_0x3f348c){var _0x44faaa={'raw':!![],'where':{}};var _0x496db4={};var _0x24b79f={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x110d72[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x6c1065,null))[_0x2edc('0x21')](function(_0xbb7f3b){if(_0xbb7f3b){_0x496db4['model']=_[_0x2edc('0x38')](db[_0x2edc('0x62')][_0x2edc('0x35')]);_0x496db4[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x110d72[_0x2edc('0x37')]);_0x496db4[_0x2edc('0x39')]=_['intersection'](_0x496db4[_0x2edc('0x36')],_0x496db4[_0x2edc('0x37')]);_0x44faaa['attributes']=_[_0x2edc('0x3a')](_0x496db4['model'],qs[_0x2edc('0x3c')](_0x110d72[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x44faaa[_0x2edc('0x3b')]=_0x44faaa['attributes'][_0x2edc('0x4a')]?_0x44faaa[_0x2edc('0x3b')]:_0x496db4['model'];if(!_0x110d72['query'][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x44faaa[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x110d72[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x44faaa[_0x2edc('0x1a')]=qs['offset'](_0x110d72[_0x2edc('0x37')]['offset']);}_0x44faaa[_0x2edc('0x3f')]=qs['sort'](_0x110d72[_0x2edc('0x37')]['sort']);_0x44faaa[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_['pick'](_0x110d72[_0x2edc('0x37')],_0x496db4[_0x2edc('0x39')]));_0x44faaa[_0x2edc('0x41')][_0x2edc('0x61')]=_0xbb7f3b['id'];if(_0x110d72[_0x2edc('0x37')][_0x2edc('0x26')]){_0x44faaa[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x44faaa[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x44faaa['attributes'],function(_0x54eeb5){var _0x4eaea8={};_0x4eaea8[_0x54eeb5]={'$like':'%'+_0x110d72[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x4eaea8;})});}_0x44faaa=_[_0x2edc('0x4c')]({},_0x44faaa,_0x110d72['options']);return db[_0x2edc('0x62')]['count']({'where':_0x44faaa['where']})[_0x2edc('0x21')](function(_0x1082e3){_0x24b79f[_0x2edc('0x43')]=_0x1082e3;if(_0x110d72['query']['includeAll']){_0x44faaa[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x62')]['findAll'](_0x44faaa);})[_0x2edc('0x21')](function(_0x17457c){_0x24b79f[_0x2edc('0x46')]=_0x17457c;return _0x24b79f;});}})[_0x2edc('0x21')](respondWithFilteredResult(_0x6c1065,_0x44faaa))[_0x2edc('0x47')](handleError(_0x6c1065,null));};exports[_0x2edc('0x63')]=function(_0x492e3f,_0x17214c,_0x41eab0){var _0x33d46c={'raw':!![],'where':{}};var _0x64eaab={};var _0x234fcb={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x492e3f[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x17214c,null))[_0x2edc('0x21')](function(_0x5993dd){if(_0x5993dd){_0x64eaab[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x64')]['rawAttributes']);_0x64eaab['query']=_[_0x2edc('0x38')](_0x492e3f[_0x2edc('0x37')]);_0x64eaab[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x64eaab[_0x2edc('0x36')],_0x64eaab[_0x2edc('0x37')]);_0x33d46c[_0x2edc('0x3b')]=_['intersection'](_0x64eaab[_0x2edc('0x36')],qs['fields'](_0x492e3f['query']['fields']));_0x33d46c[_0x2edc('0x3b')]=_0x33d46c[_0x2edc('0x3b')]['length']?_0x33d46c[_0x2edc('0x3b')]:_0x64eaab['model'];if(!_0x492e3f[_0x2edc('0x37')][_0x2edc('0x3d')]('nolimit')){_0x33d46c['limit']=qs[_0x2edc('0x1b')](_0x492e3f[_0x2edc('0x37')]['limit']);_0x33d46c[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x492e3f['query'][_0x2edc('0x1a')]);}_0x33d46c[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x492e3f[_0x2edc('0x37')]['sort']);_0x33d46c[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x492e3f['query'],_0x64eaab[_0x2edc('0x39')]));_0x33d46c[_0x2edc('0x41')]['VoiceQueueId']=_0x5993dd['id'];if(_0x492e3f[_0x2edc('0x37')]['filter']){_0x33d46c[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x33d46c[_0x2edc('0x41')],{'$or':_['map'](_0x33d46c[_0x2edc('0x3b')],function(_0x38c8f9){var _0x385b2d={};_0x385b2d[_0x38c8f9]={'$like':'%'+_0x492e3f['query']['filter']+'%'};return _0x385b2d;})});}_0x33d46c=_['merge']({},_0x33d46c,_0x492e3f['options']);return db[_0x2edc('0x64')][_0x2edc('0x43')]({'where':_0x33d46c[_0x2edc('0x41')]})['then'](function(_0x3b0fef){_0x234fcb[_0x2edc('0x43')]=_0x3b0fef;if(_0x492e3f[_0x2edc('0x37')][_0x2edc('0x44')]){_0x33d46c[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x64')][_0x2edc('0x45')](_0x33d46c);})[_0x2edc('0x21')](function(_0x4ba67c){_0x234fcb['rows']=_0x4ba67c;return _0x234fcb;});}})['then'](respondWithFilteredResult(_0x17214c,_0x33d46c))[_0x2edc('0x47')](handleError(_0x17214c,null));};exports['getTeams']=function(_0x761185,_0x176558,_0x3e8c23){var _0x3fa701={};var _0x11bfc4={};var _0x580004;var _0x1fa8d3;return db['VoiceQueue'][_0x2edc('0x5d')]({'where':{'id':_0x761185['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x176558,null))[_0x2edc('0x21')](function(_0x14d464){if(_0x14d464){_0x580004=_0x14d464;_0x11bfc4[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x65')][_0x2edc('0x35')]);_0x11bfc4[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x761185[_0x2edc('0x37')]);_0x11bfc4[_0x2edc('0x39')]=_['intersection'](_0x11bfc4[_0x2edc('0x36')],_0x11bfc4['query']);_0x3fa701['attributes']=_['intersection'](_0x11bfc4[_0x2edc('0x36')],qs['fields'](_0x761185[_0x2edc('0x37')]['fields']));_0x3fa701[_0x2edc('0x3b')]=_0x3fa701[_0x2edc('0x3b')]['length']?_0x3fa701[_0x2edc('0x3b')]:_0x11bfc4[_0x2edc('0x36')];_0x3fa701[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x761185[_0x2edc('0x37')]['sort']);_0x3fa701[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_['pick'](_0x761185[_0x2edc('0x37')],_0x11bfc4[_0x2edc('0x39')]));if(_0x761185[_0x2edc('0x37')][_0x2edc('0x26')]){_0x3fa701[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x3fa701[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x3fa701[_0x2edc('0x3b')],function(_0x44d43a){var _0x1d7771={};_0x1d7771[_0x44d43a]={'$like':'%'+_0x761185[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x1d7771;})});}_0x3fa701=_[_0x2edc('0x4c')]({},_0x3fa701,_0x761185[_0x2edc('0x56')]);return _0x580004['getTeams'](_0x3fa701);}})[_0x2edc('0x21')](function(_0x263684){if(_0x263684){_0x1fa8d3=_0x263684[_0x2edc('0x4a')];if(!_0x761185[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x3fa701[_0x2edc('0x1b')]=qs['limit'](_0x761185[_0x2edc('0x37')]['limit']);_0x3fa701[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x761185[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x580004['getTeams'](_0x3fa701);}})[_0x2edc('0x21')](function(_0x2c0987){if(_0x2c0987){return _0x2c0987?{'count':_0x1fa8d3,'rows':_0x2c0987}:null;}})[_0x2edc('0x21')](respondWithResult(_0x176558,null))[_0x2edc('0x47')](handleError(_0x176558,null));};exports[_0x2edc('0x66')]=function(_0x535b64,_0x42b8ce,_0x48515b){var _0x3ccd5a=_0x535b64[_0x2edc('0x5a')]['teams'];var _0x19f879=_['map'](_0x3ccd5a,'id');return db['Team']['findAll']({'where':{'id':_0x19f879},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2edc('0x67'),'attributes':['id','name',_0x2edc('0x68'),_0x2edc('0x69'),_0x2edc('0x6a')],'raw':!![]}]})['then'](function(_0x515440){if(_0x515440){var _0x21c580=_['flatMap'](_0x515440,function(_0x254eff){var _0x188446=_0x254eff[_0x2edc('0x22')]({'plain':!![]});_0x188446[_0x2edc('0x67')][_0x2edc('0x6b')](function(_0x3361c9){_0x3361c9[_0x2edc('0x6c')]=_[_0x2edc('0x2c')](_0x3ccd5a,{'id':_0x188446['id']})[_0x2edc('0x6c')];});return _0x188446[_0x2edc('0x67')];});return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x535b64[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](function(_0x29679c){return db[_0x2edc('0x6d')][_0x2edc('0x6e')](function(_0x2f170d){return _0x29679c[_0x2edc('0x66')](_0x19f879,{'transaction':_0x2f170d})['then'](function(){return BPromise[_0x2edc('0x6f')](_0x21c580,function(_0x36791f){return db[_0x2edc('0x70')][_0x2edc('0x71')]({'where':{'UserId':_0x36791f['id'],'VoiceQueueId':_0x535b64['params']['id']},'defaults':{'penalty':_0x36791f[_0x2edc('0x6c')]},'transaction':_0x2f170d});});})[_0x2edc('0x21')](function(){return BPromise['each'](_[_0x2edc('0x26')](_0x21c580,{'online':!![]}),function(_0x218755){return db[_0x2edc('0x72')][_0x2edc('0x73')]({'membername':_0x218755[_0x2edc('0x2d')],'UserId':_0x218755['id'],'queue_name':_0x29679c[_0x2edc('0x2d')],'VoiceQueueId':_0x29679c['id'],'interface':_[_0x2edc('0x74')](_0x218755[_0x2edc('0x6a')])?util[_0x2edc('0x75')](_0x2edc('0x76'),_0x218755[_0x2edc('0x2d')]):_0x218755[_0x2edc('0x6a')],'paused':_0x218755[_0x2edc('0x69')]||![],'penalty':_0x218755[_0x2edc('0x6c')]},{'transaction':_0x2f170d});});})[_0x2edc('0x21')](function(){_0x21c580[_0x2edc('0x6b')](function(_0xccbc22){socket[_0x2edc('0x77')](_0x2edc('0x78'),{'UserId':_0xccbc22['id'],'VoiceQueueId':_0x29679c['id']});});});});});}})[_0x2edc('0x21')](respondWithStatusCode(_0x42b8ce,null))[_0x2edc('0x47')](handleError(_0x42b8ce,null));};exports[_0x2edc('0x79')]=function(_0x146eb6,_0x38ee65,_0x5bb2ab){return db[_0x2edc('0x65')][_0x2edc('0x45')]({'where':{'id':_0x146eb6[_0x2edc('0x37')][_0x2edc('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x2edc('0x7b')],'as':_0x2edc('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2edc('0x21')](handleEntityNotFound(_0x38ee65,null))[_0x2edc('0x21')](function(_0x1da53a){var _0x4b95d2=_['map'](_0x1da53a,'id');var _0x1a4659=[];var _0x3e4e52=[];var _0x1d2697=squel[_0x2edc('0x7c')]();_0x1d2697[_0x2edc('0x7d')]('tq.TeamId')[_0x2edc('0x7e')](_0x2edc('0x7f'),'tq')[_0x2edc('0x80')](_0x2edc('0x81'),'ut',_0x2edc('0x82'))[_0x2edc('0x41')](_0x2edc('0x83'),_0x146eb6[_0x2edc('0x49')]['id']);for(var _0x143753=0x0;_0x143753<_0x1da53a[_0x2edc('0x4a')];_0x143753+=0x1){let _0x3a2499=_0x1da53a[_0x143753];for(var _0x28fe86=0x0;_0x28fe86<_0x3a2499[_0x2edc('0x67')][_0x2edc('0x4a')];_0x28fe86+=0x1){let _0x1eb9a0=_0x3a2499['Agents'][_0x28fe86];var _0xd29737=_0x1d2697['clone']();_0xd29737[_0x2edc('0x41')](_0x2edc('0x84'),_0x1eb9a0['id']);_0x3e4e52['push'](db[_0x2edc('0x6d')][_0x2edc('0x37')](_0xd29737[_0x2edc('0x85')](),{'type':db[_0x2edc('0x6d')]['QueryTypes'][_0x2edc('0x86')]})[_0x2edc('0x21')](function(_0x1b2490){if(_0x1b2490[_0x2edc('0x4a')]===0x1){return _0x1eb9a0['id'];}else{var _0x190172=_[_0x2edc('0x87')](_[_0x2edc('0x28')](_0x1b2490,_0x2edc('0x88')),function(_0x2ee928){return _[_0x2edc('0x2a')](_0x4b95d2,_0x2ee928);});if(_0x190172){return _0x1eb9a0['id'];}}}));}}return BPromise[_0x2edc('0x89')](_0x3e4e52)[_0x2edc('0x21')](function(_0x293162){_0x1a4659=_(_0x1a4659)[_0x2edc('0x8a')](_0x293162)['compact']()['value']();return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x146eb6['params']['id']}})[_0x2edc('0x21')](function(_0x5d7a06){return db[_0x2edc('0x6d')][_0x2edc('0x6e')](function(_0x24e82a){return _0x5d7a06['removeTeams'](_0x146eb6[_0x2edc('0x37')][_0x2edc('0x7a')],{'transaction':_0x24e82a})['then'](function(){if(!_['isEmpty'](_0x1a4659)){return _0x5d7a06[_0x2edc('0x8b')](_0x1a4659,{'transaction':_0x24e82a})[_0x2edc('0x21')](function(){return db[_0x2edc('0x72')]['destroy']({'where':{'VoiceQueueId':_0x146eb6[_0x2edc('0x49')]['id'],'UserId':_0x1a4659},'transaction':_0x24e82a});});}})[_0x2edc('0x21')](function(){_0x1a4659[_0x2edc('0x6b')](function(_0x3e0a28){socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':_0x3e0a28,'VoiceQueueId':_0x5d7a06['id']});});});});});});})[_0x2edc('0x21')](respondWithStatusCode(_0x38ee65,null))[_0x2edc('0x47')](handleError(_0x38ee65,null));};exports['addAgents']=function(_0x49f49b,_0x132b0e,_0x141409){var _0x10b441,_0x3ce075;return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x49f49b['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x132b0e,null))[_0x2edc('0x21')](function(_0x5595ed){if(_0x5595ed){_0x3ce075=_0x5595ed;return _0x5595ed[_0x2edc('0x8d')](_0x49f49b[_0x2edc('0x5a')]['ids'],_[_0x2edc('0x57')](_0x49f49b['body'],[_0x2edc('0x7a'),'id'])||{})[_0x2edc('0x8e')](function(_0x3ea4c5){for(var _0x2bcc9e=0x0;_0x2bcc9e<_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')][_0x2edc('0x4a')];_0x2bcc9e+=0x1){socket[_0x2edc('0x77')](_0x2edc('0x78'),{'UserId':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')][_0x2bcc9e],'VoiceQueueId':_0x49f49b[_0x2edc('0x49')]['id']});}return _0x3ea4c5;});}})['then'](function(_0x24dbd6){_0x10b441=_0x24dbd6||[];if(_0x3ce075){return db[_0x2edc('0x7b')]['findAll']({'where':{'id':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')]},'attributes':['id',_0x2edc('0x2d'),_0x2edc('0x68'),'voicePause',_0x2edc('0x6a')],'raw':!![]});}})[_0x2edc('0x21')](function(_0x4d169d){if(!_[_0x2edc('0x8f')](_0x4d169d)){var _0x70e2e=[];for(var _0x2e9f87=0x0;_0x2e9f87<_0x4d169d[_0x2edc('0x4a')];_0x2e9f87++){if(_0x4d169d[_0x2e9f87][_0x2edc('0x68')]){_0x70e2e[_0x2edc('0x90')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4d169d[_0x2e9f87]['name'],'UserId':_0x4d169d[_0x2e9f87]['id'],'queue_name':_0x3ce075[_0x2edc('0x2d')],'VoiceQueueId':_0x3ce075['id'],'interface':_[_0x2edc('0x74')](_0x4d169d[_0x2e9f87][_0x2edc('0x6a')])?util[_0x2edc('0x75')](_0x2edc('0x76'),_0x4d169d[_0x2e9f87][_0x2edc('0x2d')]):_0x4d169d[_0x2e9f87][_0x2edc('0x6a')],'paused':_0x4d169d[_0x2e9f87][_0x2edc('0x69')]||![],'penalty':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x6c')]||0x0}));}}return BPromise[_0x2edc('0x89')](_0x70e2e);}})[_0x2edc('0x21')](function(){return _0x10b441;})[_0x2edc('0x21')](respondWithResult(_0x132b0e,null))[_0x2edc('0x47')](handleError(_0x132b0e,null));};exports[_0x2edc('0x8b')]=function(_0x1666c2,_0x2f5eb2,_0xb10c0f){return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x1666c2['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2f5eb2,null))[_0x2edc('0x21')](function(_0x9bcca1){if(_0x9bcca1){return _0x9bcca1[_0x2edc('0x8b')](_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')])['then'](function(){if(_[_0x2edc('0x91')](_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')])){for(var _0x4dbf1d=0x0;_0x4dbf1d<_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')]['length'];_0x4dbf1d+=0x1){socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':Number(_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')][_0x4dbf1d]),'VoiceQueueId':Number(_0x1666c2[_0x2edc('0x49')]['id'])});}}else{socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':Number(_0x1666c2[_0x2edc('0x37')]['ids']),'VoiceQueueId':Number(_0x1666c2[_0x2edc('0x49')]['id'])});}});}})[_0x2edc('0x21')](function(_0x2a3988){return db[_0x2edc('0x72')][_0x2edc('0x92')]({'where':{'VoiceQueueId':_0x1666c2[_0x2edc('0x49')]['id'],'UserId':_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')]}})[_0x2edc('0x21')](function(){return _0x2a3988;});})[_0x2edc('0x21')](respondWithStatusCode(_0x2f5eb2,null))[_0x2edc('0x47')](handleError(_0x2f5eb2,null));};exports[_0x2edc('0x93')]=function(_0x3449de,_0x2cc649,_0x26f857){var _0x2523c9={};var _0x493eb1={};var _0xd28d33;var _0x59612a;return db['VoiceQueue']['findOne']({'where':{'id':_0x3449de[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cc649,null))[_0x2edc('0x21')](function(_0x1309ad){if(_0x1309ad){_0xd28d33=_0x1309ad;_0x493eb1[_0x2edc('0x36')]=_[_0x2edc('0x38')](db['User'][_0x2edc('0x35')]);_0x493eb1[_0x2edc('0x37')]=_['keys'](_0x3449de['query']);_0x493eb1[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x493eb1[_0x2edc('0x36')],_0x493eb1[_0x2edc('0x37')]);_0x2523c9[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x493eb1[_0x2edc('0x36')],qs['fields'](_0x3449de[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2523c9['attributes']=_0x2523c9[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x2523c9[_0x2edc('0x3b')]:_0x493eb1['model'];_0x2523c9[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x3449de[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2523c9[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x3449de[_0x2edc('0x37')],_0x493eb1[_0x2edc('0x39')]));if(_0x3449de['query'][_0x2edc('0x26')]){_0x2523c9[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x2523c9[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x2523c9[_0x2edc('0x3b')],function(_0x59aab3){var _0x3325ac={};_0x3325ac[_0x59aab3]={'$like':'%'+_0x3449de[_0x2edc('0x37')]['filter']+'%'};return _0x3325ac;})});}_0x2523c9=_[_0x2edc('0x4c')]({},_0x2523c9,_0x3449de['options']);return _0xd28d33[_0x2edc('0x93')](_0x2523c9);}})[_0x2edc('0x21')](function(_0x34d8dc){if(_0x34d8dc){_0x59612a=_0x34d8dc[_0x2edc('0x4a')];if(!_0x3449de[_0x2edc('0x37')]['hasOwnProperty'](_0x2edc('0x3e'))){_0x2523c9[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x3449de['query'][_0x2edc('0x1b')]);_0x2523c9[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x3449de[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0xd28d33[_0x2edc('0x93')](_0x2523c9);}})[_0x2edc('0x21')](function(_0x4fa2e0){if(_0x4fa2e0){return _0x4fa2e0?{'count':_0x59612a,'rows':_0x4fa2e0}:null;}})[_0x2edc('0x21')](respondWithResult(_0x2cc649,null))['catch'](handleError(_0x2cc649,null));};exports[_0x2edc('0x94')]=function(_0x1e6b06,_0x119c33,_0x4f6d07){var _0x45b7c0={};var _0x12f597={};var _0x38f6b;var _0x18260a;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x1e6b06['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x119c33,null))[_0x2edc('0x21')](function(_0x9b146e){if(_0x9b146e){_0x38f6b=_0x9b146e;_0x12f597[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x72')][_0x2edc('0x35')]);_0x12f597[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x1e6b06[_0x2edc('0x37')]);_0x12f597[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x12f597[_0x2edc('0x36')],_0x12f597[_0x2edc('0x37')]);_0x45b7c0[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x12f597[_0x2edc('0x36')],qs['fields'](_0x1e6b06[_0x2edc('0x37')]['fields']));_0x45b7c0[_0x2edc('0x3b')]=_0x45b7c0[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x45b7c0[_0x2edc('0x3b')]:_0x12f597[_0x2edc('0x36')];_0x45b7c0[_0x2edc('0x3f')]=qs['sort'](_0x1e6b06['query'][_0x2edc('0x40')]);_0x45b7c0[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x1e6b06[_0x2edc('0x37')],_0x12f597[_0x2edc('0x39')]));if(_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x26')]){_0x45b7c0[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x45b7c0['where'],{'$or':_[_0x2edc('0x28')](_0x45b7c0['attributes'],function(_0x28a2f6){var _0x41b684={};_0x41b684[_0x28a2f6]={'$like':'%'+_0x1e6b06[_0x2edc('0x37')]['filter']+'%'};return _0x41b684;})});}_0x45b7c0=_[_0x2edc('0x4c')]({},_0x45b7c0,_0x1e6b06[_0x2edc('0x56')]);return _0x38f6b[_0x2edc('0x94')](_0x45b7c0);}})['then'](function(_0x4e62f6){if(_0x4e62f6){_0x18260a=_0x4e62f6['length'];if(!_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x45b7c0[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x45b7c0[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x38f6b[_0x2edc('0x94')](_0x45b7c0);}})[_0x2edc('0x21')](function(_0x176541){return _0x176541?{'count':_0x18260a,'rows':_0x176541}:null;})['then'](respondWithResult(_0x119c33,null))[_0x2edc('0x47')](handleError(_0x119c33,null));};exports[_0x2edc('0x95')]=function(_0xfd234a,_0x522290,_0x5d23f1){var _0x16ba5b={};var _0x535cee={};var _0x559ca0;var _0x1d6bb2;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0xfd234a[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x522290,null))['then'](function(_0xbf628f){if(_0xbf628f){_0x559ca0=_0xbf628f;_0x535cee['model']=_[_0x2edc('0x38')](db[_0x2edc('0x96')][_0x2edc('0x35')]);_0x535cee[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0xfd234a[_0x2edc('0x37')]);_0x535cee[_0x2edc('0x39')]=_['intersection'](_0x535cee[_0x2edc('0x36')],_0x535cee[_0x2edc('0x37')]);_0x16ba5b[_0x2edc('0x3b')]=_['intersection'](_0x535cee[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0xfd234a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x16ba5b['attributes']=_0x16ba5b['attributes']['length']?_0x16ba5b[_0x2edc('0x3b')]:_0x535cee[_0x2edc('0x36')];_0x16ba5b[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0xfd234a[_0x2edc('0x37')][_0x2edc('0x40')]);_0x16ba5b[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0xfd234a[_0x2edc('0x37')],_0x535cee[_0x2edc('0x39')]));if(_0xfd234a[_0x2edc('0x37')][_0x2edc('0x26')]){_0x16ba5b['where']=_[_0x2edc('0x4c')](_0x16ba5b[_0x2edc('0x41')],{'$or':_['map'](_0x16ba5b[_0x2edc('0x3b')],function(_0x19c753){var _0x3f785c={};_0x3f785c[_0x19c753]={'$like':'%'+_0xfd234a[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x3f785c;})});}_0x16ba5b=_[_0x2edc('0x4c')]({},_0x16ba5b,_0xfd234a[_0x2edc('0x56')]);return _0x559ca0[_0x2edc('0x95')](_0x16ba5b);}})[_0x2edc('0x21')](function(_0x256bbe){if(_0x256bbe){_0x1d6bb2=_0x256bbe[_0x2edc('0x4a')];if(!_0xfd234a[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x16ba5b[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0xfd234a['query'][_0x2edc('0x1b')]);_0x16ba5b['offset']=qs['offset'](_0xfd234a['query'][_0x2edc('0x1a')]);}return _0x559ca0[_0x2edc('0x95')](_0x16ba5b);}})[_0x2edc('0x21')](function(_0x3cf092){if(_0x3cf092){return _0x3cf092?{'count':_0x1d6bb2,'rows':_0x3cf092}:null;}})['then'](respondWithResult(_0x522290,null))[_0x2edc('0x47')](handleError(_0x522290,null));};exports[_0x2edc('0x97')]=function(_0x2919fd,_0x319968,_0x3319ef){var _0x1a5b62,_0x44b148;return db[_0x2edc('0x34')]['find']({'where':{'id':_0x2919fd[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x319968,null))['then'](function(_0xc62cb0){if(_0xc62cb0){_0x44b148=_0xc62cb0;return _0xc62cb0[_0x2edc('0x97')](_0x2919fd[_0x2edc('0x5a')][_0x2edc('0x7a')],_[_0x2edc('0x57')](_0x2919fd[_0x2edc('0x5a')],[_0x2edc('0x7a'),'id'])||{});}return null;})[_0x2edc('0x8e')](function(_0x504bbb){var _0x2763c4;_0x1a5b62=_0x504bbb||[];var _0x356681=[];if(_0x504bbb){for(var _0x599ed7=0x0;_0x599ed7<_0x504bbb[_0x2edc('0x4a')];_0x599ed7+=0x1){var _0x37e9d2=_0x504bbb[_0x599ed7]['get']({'plain':!![]});_0x44b148[_0x2edc('0x98')]=_0x2919fd['body'][_0x2edc('0x98')]?_0x2919fd[_0x2edc('0x5a')][_0x2edc('0x98')]:_0x44b148[_0x2edc('0x98')];switch(_0x44b148[_0x2edc('0x98')]){case'always':_0x2763c4=squel['insert']()[_0x2edc('0x99')](_0x2edc('0x9a'))['fromQuery']([_0x2edc('0x9b'),_0x2edc('0x9c'),'ContactId',_0x2edc('0x9d'),_0x2edc('0x61'),_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')]('phone',_0x2edc('0x9b'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x9c'))['field']('id',_0x2edc('0x9f'))[_0x2edc('0x7d')](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),'ListId')['field'](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x58'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x59'))[_0x2edc('0x7e')](_0x2edc('0xa1'))[_0x2edc('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')]())[_0x2edc('0x41')](_0x2edc('0xa3'))[_0x2edc('0x41')](_0x2edc('0xa4'),squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0xa5'))[_0x2edc('0x7e')](_0x2edc('0xa6'))[_0x2edc('0x41')](_0x2edc('0x83'),_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')]()))[_0x2edc('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2edc('0x7c')]()['field'](_0x2edc('0xa7'))[_0x2edc('0x7e')](_0x2edc('0x9a'))['where'](_0x2edc('0x83'),_0x2919fd['params']['id'][_0x2edc('0x85')]())))[_0x2edc('0x85')]();break;case _0x2edc('0xa8'):_0x2763c4=squel[_0x2edc('0xa9')]()[_0x2edc('0x99')](_0x2edc('0x9a'))[_0x2edc('0xaa')](['phone','scheduledAt',_0x2edc('0x9f'),_0x2edc('0x9d'),'VoiceQueueId',_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0x9b'),_0x2edc('0x9b'))['field']('NOW()',_0x2edc('0x9c'))['field']('id',_0x2edc('0x9f'))[_0x2edc('0x7d')](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')]('NOW()','createdAt')[_0x2edc('0x7d')](_0x2edc('0x9e'),'updatedAt')[_0x2edc('0x7e')]('cm_contacts')[_0x2edc('0x41')](_0x2edc('0xab'))[_0x2edc('0x41')](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')]())['where'](_0x2edc('0xa3'))['where'](_0x2edc('0xa4'),squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0xa7'))['from']('cm_hopper')[_0x2edc('0x41')]('VoiceQueueId\x20=\x20?',_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')]())))['toString']();break;default:_0x2763c4=squel['insert']()[_0x2edc('0x99')](_0x2edc('0x9a'))[_0x2edc('0xaa')]([_0x2edc('0x9b'),_0x2edc('0x9c'),'ContactId',_0x2edc('0x9d'),_0x2edc('0x61'),_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0x9b'),_0x2edc('0x9b'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x9c'))[_0x2edc('0x7d')]('id','ContactId')['field'](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x58'))['field'](_0x2edc('0x9e'),_0x2edc('0x59'))[_0x2edc('0x7e')](_0x2edc('0xa1'))['where']('deletedAt\x20IS\x20NULL')[_0x2edc('0x41')](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')]['toString']())[_0x2edc('0x41')](_0x2edc('0xa3')))['toString']();}_0x356681['push'](db['sequelize'][_0x2edc('0x37')](_0x2763c4));}return BPromise[_0x2edc('0x89')](_0x356681);}})[_0x2edc('0x21')](function(){return _0x1a5b62;})[_0x2edc('0x21')](respondWithResult(_0x319968,null))[_0x2edc('0x47')](handleError(_0x319968,null));};exports[_0x2edc('0xac')]=function(_0x23bfae,_0x2bfb74,_0x12ad23){return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x23bfae[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2bfb74,null))[_0x2edc('0x21')](function(_0x5cac54){if(_0x5cac54){return _0x5cac54[_0x2edc('0xac')](_0x23bfae[_0x2edc('0x37')][_0x2edc('0x7a')]);}})[_0x2edc('0x21')](function(_0x2dc814){if(_0x2dc814){return db[_0x2edc('0x5e')][_0x2edc('0x92')]({'where':{'ListId':_0x23bfae[_0x2edc('0x37')][_0x2edc('0x7a')],'VoiceQueueId':_0x23bfae[_0x2edc('0x49')]['id']}})['then'](function(){return _0x2dc814;});}})[_0x2edc('0x21')](respondWithStatusCode(_0x2bfb74,null))[_0x2edc('0x47')](handleError(_0x2bfb74,null));};exports[_0x2edc('0xad')]=function(_0x8d886a,_0x2e7f78,_0x24be80){var _0x37322b={};var _0x4b2fe5={};var _0x143900;var _0x17fdc9;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x8d886a['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2e7f78,null))[_0x2edc('0x21')](function(_0x587a60){if(_0x587a60){_0x143900=_0x587a60;_0x4b2fe5[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x96')][_0x2edc('0x35')]);_0x4b2fe5[_0x2edc('0x37')]=_['keys'](_0x8d886a[_0x2edc('0x37')]);_0x4b2fe5[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x4b2fe5[_0x2edc('0x36')],_0x4b2fe5[_0x2edc('0x37')]);_0x37322b[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x4b2fe5[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x8d886a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x37322b[_0x2edc('0x3b')]=_0x37322b['attributes'][_0x2edc('0x4a')]?_0x37322b[_0x2edc('0x3b')]:_0x4b2fe5[_0x2edc('0x36')];_0x37322b[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x8d886a['query'][_0x2edc('0x40')]);_0x37322b['where']=qs[_0x2edc('0x39')](_['pick'](_0x8d886a[_0x2edc('0x37')],_0x4b2fe5[_0x2edc('0x39')]));if(_0x8d886a['query']['filter']){_0x37322b[_0x2edc('0x41')]=_['merge'](_0x37322b[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x37322b[_0x2edc('0x3b')],function(_0x1d2fdd){var _0x23c370={};_0x23c370[_0x1d2fdd]={'$like':'%'+_0x8d886a[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x23c370;})});}_0x37322b=_[_0x2edc('0x4c')]({},_0x37322b,_0x8d886a[_0x2edc('0x56')]);return _0x143900[_0x2edc('0xad')](_0x37322b);}})[_0x2edc('0x21')](function(_0x542e16){if(_0x542e16){_0x17fdc9=_0x542e16['length'];if(!_0x8d886a[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x37322b[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x8d886a['query'][_0x2edc('0x1b')]);_0x37322b[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x8d886a[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x143900[_0x2edc('0xad')](_0x37322b);}})[_0x2edc('0x21')](function(_0x323b26){if(_0x323b26){return _0x323b26?{'count':_0x17fdc9,'rows':_0x323b26}:null;}})[_0x2edc('0x21')](respondWithResult(_0x2e7f78,null))[_0x2edc('0x47')](handleError(_0x2e7f78,null));};exports[_0x2edc('0xae')]=function(_0x42efef,_0x535bc2,_0x4e470d){var _0x32d50c,_0x36ecfb;return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x42efef[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x535bc2,null))[_0x2edc('0x21')](function(_0x4105ae){if(_0x4105ae){_0x36ecfb=_0x4105ae;return _0x4105ae[_0x2edc('0xae')](_0x42efef[_0x2edc('0x5a')][_0x2edc('0x7a')],_['omit'](_0x42efef[_0x2edc('0x5a')],[_0x2edc('0x7a'),'id'])||{});}return null;})[_0x2edc('0x8e')](function(_0x114ec8){var _0x3c52da;_0x32d50c=_0x114ec8||[];var _0x27f48f=[];if(_0x114ec8){for(var _0xe56038=0x0;_0xe56038<_0x114ec8[_0x2edc('0x4a')];_0xe56038+=0x1){var _0x5c2eb9=_0x114ec8[_0xe56038][_0x2edc('0x22')]({'plain':!![]});_0x3c52da=squel[_0x2edc('0xa9')]()[_0x2edc('0x99')]('cm_hopper_black')[_0x2edc('0xaa')]([_0x2edc('0x9b'),_0x2edc('0x9f'),_0x2edc('0x9d'),_0x2edc('0x61'),'createdAt','updatedAt'],squel[_0x2edc('0x7c')]()['field']('phone',_0x2edc('0x9b'))[_0x2edc('0x7d')]('id','ContactId')[_0x2edc('0x7d')](_0x5c2eb9[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x42efef[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),'VoiceQueueId')['field'](_0x2edc('0x9e'),_0x2edc('0x58'))[_0x2edc('0x7d')]('NOW()',_0x2edc('0x59'))[_0x2edc('0x7e')]('cm_contacts')[_0x2edc('0x41')]('deletedAt\x20IS\x20NULL')[_0x2edc('0x41')](_0x2edc('0xa2'),_0x5c2eb9[_0x2edc('0xa0')][_0x2edc('0x85')]())['where'](_0x2edc('0xa3')))[_0x2edc('0x85')]();_0x27f48f[_0x2edc('0x90')](db[_0x2edc('0x6d')][_0x2edc('0x37')](_0x3c52da));}return BPromise[_0x2edc('0x89')](_0x27f48f);}})['then'](function(){return _0x32d50c;})[_0x2edc('0x21')](respondWithResult(_0x535bc2,null))[_0x2edc('0x47')](handleError(_0x535bc2,null));};exports[_0x2edc('0xaf')]=function(_0x2f2c54,_0x599742,_0x56d652){return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x2f2c54[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x599742,null))[_0x2edc('0x21')](function(_0x541cc1){if(_0x541cc1){return _0x541cc1[_0x2edc('0xaf')](_0x2f2c54[_0x2edc('0x37')][_0x2edc('0x7a')]);}})['then'](function(_0xa5ccd6){if(_0xa5ccd6){return db[_0x2edc('0x64')]['destroy']({'where':{'ListId':_0x2f2c54[_0x2edc('0x37')][_0x2edc('0x7a')],'VoiceQueueId':_0x2f2c54['params']['id']}})[_0x2edc('0x21')](function(){return _0xa5ccd6;});}})['then'](respondWithStatusCode(_0x599742,null))[_0x2edc('0x47')](handleError(_0x599742,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f561a04..9db4c58 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 _0x8119=['emit','hook','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x10422d,_0x515afe){var _0x190867=function(_0x330ede){while(--_0x330ede){_0x10422d['push'](_0x10422d['shift']());}};_0x190867(++_0x515afe);}(_0x8119,0xda));var _0x9811=function(_0x373a54,_0x55f0cd){_0x373a54=_0x373a54-0x0;var _0x2f8134=_0x8119[_0x373a54];return _0x2f8134;};'use strict';var EventEmitter=require(_0x9811('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9811('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9811('0x2')](0x0);var events={'afterCreate':_0x9811('0x3'),'afterUpdate':_0x9811('0x4'),'afterDestroy':_0x9811('0x5')};function emitEvent(_0x17a086){return function(_0x2fbc49,_0x1224ac,_0x440ad2){VoiceQueueEvents[_0x9811('0x6')](_0x17a086+':'+_0x2fbc49['id'],_0x2fbc49);VoiceQueueEvents[_0x9811('0x6')](_0x17a086,_0x2fbc49);_0x440ad2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9811('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xa053=['hook','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x35440c,_0x534866){var _0xfe556d=function(_0x136465){while(--_0x136465){_0x35440c['push'](_0x35440c['shift']());}};_0xfe556d(++_0x534866);}(_0xa053,0x179));var _0x3a05=function(_0x49c540,_0x256f4b){_0x49c540=_0x49c540-0x0;var _0x4c29cf=_0xa053[_0x49c540];return _0x4c29cf;};'use strict';var EventEmitter=require(_0x3a05('0x0'));var VoiceQueue=require(_0x3a05('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a05('0x2'),'afterUpdate':_0x3a05('0x3'),'afterDestroy':_0x3a05('0x4')};function emitEvent(_0x31be0c){return function(_0x20ad4b,_0x221d1e,_0x3c9a5a){VoiceQueueEvents['emit'](_0x31be0c+':'+_0x20ad4b['id'],_0x20ad4b);VoiceQueueEvents[_0x3a05('0x5')](_0x31be0c,_0x20ad4b);_0x3c9a5a(null);};}for(var e in events){if(events[_0x3a05('0x6')](e)){var event=events[e];VoiceQueue[_0x3a05('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 79ee913..8cbee91 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 _0x0fc4=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0fc4,0x120));var _0x40fc=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x0fc4[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x40fc('0x0'));var util=require(_0x40fc('0x1'));var logger=require(_0x40fc('0x2'))(_0x40fc('0x3'));var moment=require(_0x40fc('0x4'));var BPromise=require(_0x40fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40fc('0x6'));var rimraf=require('rimraf');var config=require(_0x40fc('0x7'));var attributes=require(_0x40fc('0x8'));module[_0x40fc('0x9')]=function(_0xcf1b9e,_0x2d645f){return _0xcf1b9e[_0x40fc('0xa')](_0x40fc('0xb'),attributes,{'tableName':_0x40fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c2=['rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','bluebird','path'];(function(_0x447038,_0x3358e9){var _0xddd649=function(_0x10d9ab){while(--_0x10d9ab){_0x447038['push'](_0x447038['shift']());}};_0xddd649(++_0x3358e9);}(_0x94c2,0x17c));var _0x294c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x94c2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x294c('0x0'));var util=require(_0x294c('0x1'));var logger=require(_0x294c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x294c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x294c('0x4'));var rimraf=require(_0x294c('0x5'));var config=require(_0x294c('0x6'));var attributes=require(_0x294c('0x7'));module['exports']=function(_0x51c986,_0x55221a){return _0x51c986[_0x294c('0x8')](_0x294c('0x9'),attributes,{'tableName':_0x294c('0xa'),'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 1c253cc..6a5e05d 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 _0xcbd3=['limit','include','map','model','then','GetVoiceQueue','catch','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','findAll','options','raw','attributes'];(function(_0x51f900,_0x5d309f){var _0x24d395=function(_0x44b664){while(--_0x44b664){_0x51f900['push'](_0x51f900['shift']());}};_0x24d395(++_0x5d309f);}(_0xcbd3,0x1ab));var _0x3cbd=function(_0x12fb3e,_0x3e3645){_0x12fb3e=_0x12fb3e-0x0;var _0x425ec5=_0xcbd3[_0x12fb3e];return _0x425ec5;};'use strict';var _=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var moment=require(_0x3cbd('0x2'));var BPromise=require(_0x3cbd('0x3'));var rs=require(_0x3cbd('0x4'));var fs=require('fs');var Redis=require(_0x3cbd('0x5'));var db=require(_0x3cbd('0x6'))['db'];var utils=require(_0x3cbd('0x7'));var logger=require(_0x3cbd('0x8'))('rpc');var config=require(_0x3cbd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3cbd('0xa')][_0x3cbd('0xb')]({'port':0x232a});config[_0x3cbd('0xc')]=_[_0x3cbd('0xd')](config[_0x3cbd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3cbd('0xe'))[_0x3cbd('0xf')](socket);function respondWithRpcPromise(_0x12174f,_0x19b7d8,_0x43e536){return new BPromise(function(_0x45676f,_0x3b104b){return client[_0x3cbd('0x10')](_0x12174f,_0x43e536)['then'](function(_0x155558){logger[_0x3cbd('0x11')](_0x3cbd('0x12'),_0x19b7d8,_0x3cbd('0x13'));logger[_0x3cbd('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19b7d8,_0x3cbd('0x13'),JSON[_0x3cbd('0x15')](_0x155558));if(_0x155558['error']){if(_0x155558[_0x3cbd('0x16')]['code']===0x1f4){logger[_0x3cbd('0x16')](_0x3cbd('0x12'),_0x19b7d8,_0x155558['error'][_0x3cbd('0x17')]);return _0x3b104b(_0x155558[_0x3cbd('0x16')][_0x3cbd('0x17')]);}logger['error'](_0x3cbd('0x12'),_0x19b7d8,_0x155558['error']['message']);return _0x45676f(_0x155558[_0x3cbd('0x16')]['message']);}else{logger[_0x3cbd('0x11')](_0x3cbd('0x12'),_0x19b7d8,_0x3cbd('0x13'));_0x45676f(_0x155558[_0x3cbd('0x18')][_0x3cbd('0x17')]);}})['catch'](function(_0x2427a3){logger[_0x3cbd('0x16')](_0x3cbd('0x12'),_0x19b7d8,_0x2427a3);_0x3b104b(_0x2427a3);});});}exports['GetVoiceQueue']=function(_0x3bb353){var _0x111913=this;return new Promise(function(_0x2ce346,_0x3440dd){return db['VoiceQueue'][_0x3cbd('0x19')]({'raw':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353['options']['where']||null:null,'attributes':_0x3bb353['options']?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1c')]||null:null,'limit':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353[_0x3cbd('0x1a')][_0x3cbd('0x1d')]||null:null,'include':_0x3bb353[_0x3cbd('0x1a')]?_0x3bb353['options'][_0x3cbd('0x1e')]?_['map'](_0x3bb353[_0x3cbd('0x1a')]['include'],function(_0x338b98){return{'model':db[_0x338b98['model']],'as':_0x338b98['as'],'attributes':_0x338b98[_0x3cbd('0x1c')],'include':_0x338b98['include']?_[_0x3cbd('0x1f')](_0x338b98[_0x3cbd('0x1e')],function(_0x56a876){return{'model':db[_0x56a876['model']],'as':_0x56a876['as'],'attributes':_0x56a876[_0x3cbd('0x1c')],'include':_0x56a876[_0x3cbd('0x1e')]?_[_0x3cbd('0x1f')](_0x56a876[_0x3cbd('0x1e')],function(_0x2e44e5){return{'model':db[_0x2e44e5[_0x3cbd('0x20')]],'as':_0x2e44e5['as'],'attributes':_0x2e44e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x21')](function(_0x47ab23){logger[_0x3cbd('0x11')](_0x3cbd('0x22'),_0x3bb353);logger[_0x3cbd('0x14')](_0x3cbd('0x22'),_0x3bb353,JSON[_0x3cbd('0x15')](_0x47ab23));_0x2ce346(_0x47ab23);})[_0x3cbd('0x23')](function(_0x484379){logger[_0x3cbd('0x16')](_0x3cbd('0x22'),_0x484379[_0x3cbd('0x17')],_0x3bb353);_0x3440dd(_0x111913[_0x3cbd('0x16')](0x1f4,_0x484379[_0x3cbd('0x17')]));});});};exports[_0x3cbd('0x24')]=function(_0x3fbc76){var _0x340eeb=this;return new Promise(function(_0x25dc3b,_0x178079){return db['VoiceQueue'][_0x3cbd('0x25')]({'raw':_0x3fbc76['options']?_0x3fbc76[_0x3cbd('0x1a')][_0x3cbd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76[_0x3cbd('0x1a')]['where']||null:null,'attributes':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76[_0x3cbd('0x1a')]['attributes']||null:null,'include':_0x3fbc76[_0x3cbd('0x1a')]?_0x3fbc76['options'][_0x3cbd('0x1e')]?_['map'](_0x3fbc76['options'][_0x3cbd('0x1e')],function(_0x44a25b){return{'model':db[_0x44a25b[_0x3cbd('0x20')]],'as':_0x44a25b['as'],'attributes':_0x44a25b[_0x3cbd('0x1c')],'include':_0x44a25b[_0x3cbd('0x1e')]?_[_0x3cbd('0x1f')](_0x44a25b[_0x3cbd('0x1e')],function(_0x39334d){return{'model':db[_0x39334d[_0x3cbd('0x20')]],'as':_0x39334d['as'],'attributes':_0x39334d[_0x3cbd('0x1c')],'include':_0x39334d['include']?_[_0x3cbd('0x1f')](_0x39334d[_0x3cbd('0x1e')],function(_0x1c2c8d){return{'model':db[_0x1c2c8d['model']],'as':_0x1c2c8d['as'],'attributes':_0x1c2c8d[_0x3cbd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x21')](function(_0x5039e3){logger[_0x3cbd('0x11')]('ShowVoiceQueue',_0x3fbc76);logger[_0x3cbd('0x14')]('ShowVoiceQueue',_0x3fbc76,JSON[_0x3cbd('0x15')](_0x5039e3));_0x25dc3b(_0x5039e3);})[_0x3cbd('0x23')](function(_0x5273bf){logger[_0x3cbd('0x16')]('ShowVoiceQueue',_0x5273bf[_0x3cbd('0x17')],_0x3fbc76);_0x178079(_0x340eeb[_0x3cbd('0x16')](0x1f4,_0x5273bf['message']));});});}; \ No newline at end of file +var _0x1323=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','map','find','ShowVoiceQueue','debug','stringify','lodash','util','moment'];(function(_0x290680,_0x146aaf){var _0x3e796a=function(_0xd5cecd){while(--_0xd5cecd){_0x290680['push'](_0x290680['shift']());}};_0x3e796a(++_0x146aaf);}(_0x1323,0x189));var _0x3132=function(_0x264ba4,_0x3dce73){_0x264ba4=_0x264ba4-0x0;var _0x351bf0=_0x1323[_0x264ba4];return _0x351bf0;};'use strict';var _=require(_0x3132('0x0'));var util=require(_0x3132('0x1'));var moment=require(_0x3132('0x2'));var BPromise=require(_0x3132('0x3'));var rs=require(_0x3132('0x4'));var fs=require('fs');var Redis=require(_0x3132('0x5'));var db=require(_0x3132('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3132('0x7'))(_0x3132('0x8'));var config=require(_0x3132('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3132('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3132('0xb'))(new Redis(config[_0x3132('0xa')]));require(_0x3132('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a7575,_0x1c8853,_0x742840){return new BPromise(function(_0x1f6a98,_0x358d91){return client[_0x3132('0xd')](_0x3a7575,_0x742840)[_0x3132('0xe')](function(_0x3dd3f7){logger[_0x3132('0xf')](_0x3132('0x10'),_0x1c8853,_0x3132('0x11'));logger['debug'](_0x3132('0x12'),_0x1c8853,_0x3132('0x11'),JSON['stringify'](_0x3dd3f7));if(_0x3dd3f7['error']){if(_0x3dd3f7[_0x3132('0x13')][_0x3132('0x14')]===0x1f4){logger[_0x3132('0x13')](_0x3132('0x10'),_0x1c8853,_0x3dd3f7['error']['message']);return _0x358d91(_0x3dd3f7['error'][_0x3132('0x15')]);}logger[_0x3132('0x13')](_0x3132('0x10'),_0x1c8853,_0x3dd3f7[_0x3132('0x13')]['message']);return _0x1f6a98(_0x3dd3f7[_0x3132('0x13')][_0x3132('0x15')]);}else{logger[_0x3132('0xf')](_0x3132('0x10'),_0x1c8853,_0x3132('0x11'));_0x1f6a98(_0x3dd3f7['result']['message']);}})[_0x3132('0x16')](function(_0xc2bf76){logger[_0x3132('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x1c8853,_0xc2bf76);_0x358d91(_0xc2bf76);});});}exports[_0x3132('0x17')]=function(_0x366023){var _0x514c77=this;return new Promise(function(_0x1a22bf,_0x807aad){return db[_0x3132('0x18')]['findAll']({'raw':_0x366023[_0x3132('0x19')]?_0x366023['options']['raw']===undefined?!![]:![]:!![],'where':_0x366023[_0x3132('0x19')]?_0x366023[_0x3132('0x19')][_0x3132('0x1a')]||null:null,'attributes':_0x366023[_0x3132('0x19')]?_0x366023['options'][_0x3132('0x1b')]||null:null,'limit':_0x366023[_0x3132('0x19')]?_0x366023[_0x3132('0x19')][_0x3132('0x1c')]||null:null,'include':_0x366023[_0x3132('0x19')]?_0x366023['options'][_0x3132('0x1d')]?_['map'](_0x366023[_0x3132('0x19')][_0x3132('0x1d')],function(_0x33a1b8){return{'model':db[_0x33a1b8[_0x3132('0x1e')]],'as':_0x33a1b8['as'],'attributes':_0x33a1b8[_0x3132('0x1b')],'include':_0x33a1b8[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x33a1b8[_0x3132('0x1d')],function(_0x184628){return{'model':db[_0x184628[_0x3132('0x1e')]],'as':_0x184628['as'],'attributes':_0x184628[_0x3132('0x1b')],'include':_0x184628[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x184628[_0x3132('0x1d')],function(_0x282f22){return{'model':db[_0x282f22[_0x3132('0x1e')]],'as':_0x282f22['as'],'attributes':_0x282f22[_0x3132('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3132('0xe')](function(_0x30b8d7){logger[_0x3132('0xf')]('GetVoiceQueue',_0x366023);logger['debug'](_0x3132('0x17'),_0x366023,JSON['stringify'](_0x30b8d7));_0x1a22bf(_0x30b8d7);})[_0x3132('0x16')](function(_0x3853f1){logger[_0x3132('0x13')](_0x3132('0x17'),_0x3853f1[_0x3132('0x15')],_0x366023);_0x807aad(_0x514c77[_0x3132('0x13')](0x1f4,_0x3853f1['message']));});});};exports['ShowVoiceQueue']=function(_0x4a5dae){var _0x510461=this;return new Promise(function(_0x47bf79,_0x8e5e02){return db[_0x3132('0x18')][_0x3132('0x20')]({'raw':_0x4a5dae[_0x3132('0x19')]?_0x4a5dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a5dae['options']?_0x4a5dae[_0x3132('0x19')][_0x3132('0x1a')]||null:null,'attributes':_0x4a5dae[_0x3132('0x19')]?_0x4a5dae[_0x3132('0x19')][_0x3132('0x1b')]||null:null,'include':_0x4a5dae['options']?_0x4a5dae['options'][_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x4a5dae['options']['include'],function(_0x1c15cd){return{'model':db[_0x1c15cd[_0x3132('0x1e')]],'as':_0x1c15cd['as'],'attributes':_0x1c15cd[_0x3132('0x1b')],'include':_0x1c15cd[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x1c15cd['include'],function(_0x1e1892){return{'model':db[_0x1e1892['model']],'as':_0x1e1892['as'],'attributes':_0x1e1892[_0x3132('0x1b')],'include':_0x1e1892[_0x3132('0x1d')]?_['map'](_0x1e1892[_0x3132('0x1d')],function(_0x45b459){return{'model':db[_0x45b459[_0x3132('0x1e')]],'as':_0x45b459['as'],'attributes':_0x45b459[_0x3132('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3132('0xe')](function(_0xfd19df){logger[_0x3132('0xf')](_0x3132('0x21'),_0x4a5dae);logger[_0x3132('0x22')]('ShowVoiceQueue',_0x4a5dae,JSON[_0x3132('0x23')](_0xfd19df));_0x47bf79(_0xfd19df);})[_0x3132('0x16')](function(_0x362386){logger['error'](_0x3132('0x21'),_0x362386[_0x3132('0x15')],_0x4a5dae);_0x8e5e02(_0x510461['error'](0x1f4,_0x362386[_0x3132('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d806203..be34e0f 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 _0xa0e5=['register','length','./voiceQueue.events','save','update','emit','removeListener'];(function(_0x2f59f1,_0xdfe0c6){var _0x2ee114=function(_0x42a856){while(--_0x42a856){_0x2f59f1['push'](_0x2f59f1['shift']());}};_0x2ee114(++_0xdfe0c6);}(_0xa0e5,0x175));var _0x5a0e=function(_0x429e67,_0x30a281){_0x429e67=_0x429e67-0x0;var _0x1f5dab=_0xa0e5[_0x429e67];return _0x1f5dab;};'use strict';var VoiceQueueEvents=require(_0x5a0e('0x0'));var events=[_0x5a0e('0x1'),'remove',_0x5a0e('0x2')];function createListener(_0x4c7619,_0x50b02e){return function(_0x421308){_0x50b02e[_0x5a0e('0x3')](_0x4c7619,_0x421308);};}function removeListener(_0x337494,_0x15300e){return function(){VoiceQueueEvents[_0x5a0e('0x4')](_0x337494,_0x15300e);};}exports[_0x5a0e('0x5')]=function(_0x31bcb6){for(var _0x3054a4=0x0,_0x5751b6=events[_0x5a0e('0x6')];_0x3054a4<_0x5751b6;_0x3054a4++){var _0x40e228=events[_0x3054a4];var _0xae04cf=createListener('voiceQueue:'+_0x40e228,_0x31bcb6);VoiceQueueEvents['on'](_0x40e228,_0xae04cf);}}; \ No newline at end of file +var _0xc13c=['remove','update','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x849e7c,_0x34014e){var _0x11722f=function(_0x1a3fa3){while(--_0x1a3fa3){_0x849e7c['push'](_0x849e7c['shift']());}};_0x11722f(++_0x34014e);}(_0xc13c,0x155));var _0xcc13=function(_0x377868,_0x1ee796){_0x377868=_0x377868-0x0;var _0x4e6adb=_0xc13c[_0x377868];return _0x4e6adb;};'use strict';var VoiceQueueEvents=require(_0xcc13('0x0'));var events=[_0xcc13('0x1'),_0xcc13('0x2'),_0xcc13('0x3')];function createListener(_0x1fd08d,_0x48afbc){return function(_0x445cc8){_0x48afbc['emit'](_0x1fd08d,_0x445cc8);};}function removeListener(_0x46c3d2,_0x37fa92){return function(){VoiceQueueEvents[_0xcc13('0x4')](_0x46c3d2,_0x37fa92);};}exports['register']=function(_0x5439d9){for(var _0x240d6e=0x0,_0x4fd488=events[_0xcc13('0x5')];_0x240d6e<_0x4fd488;_0x240d6e++){var _0x1adeb7=events[_0x240d6e];var _0x33c1fa=createListener(_0xcc13('0x6')+_0x1adeb7,_0x5439d9);VoiceQueueEvents['on'](_0x1adeb7,_0x33c1fa);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a22a722..78adcb8 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 _0x3e24=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','show','update','delete','/:id','destroy','exports','multer'];(function(_0x217d51,_0x34ad3f){var _0x26dbcd=function(_0x4ecc26){while(--_0x4ecc26){_0x217d51['push'](_0x217d51['shift']());}};_0x26dbcd(++_0x34ad3f);}(_0x3e24,0x167));var _0x43e2=function(_0x39f097,_0x17116b){_0x39f097=_0x39f097-0x0;var _0x544f6a=_0x3e24[_0x39f097];return _0x544f6a;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var auth=require(_0x43e2('0x5'));var interaction=require(_0x43e2('0x6'));var config=require('../../config/environment');var controller=require(_0x43e2('0x7'));router[_0x43e2('0x8')]('/',auth[_0x43e2('0x9')](),controller[_0x43e2('0xa')]);router[_0x43e2('0x8')](_0x43e2('0xb'),auth[_0x43e2('0x9')](),controller['describe']);router[_0x43e2('0x8')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x8')]('/:id',auth[_0x43e2('0x9')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0x9')](),controller['create']);router['put']('/:id',auth[_0x43e2('0x9')](),controller[_0x43e2('0xf')]);router[_0x43e2('0x10')](_0x43e2('0x11'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x12')]);module[_0x43e2('0x13')]=router; \ No newline at end of file +var _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x5b9348,_0x5cbf46){var _0x5b1418=function(_0x41d11e){while(--_0x41d11e){_0x5b9348['push'](_0x5b9348['shift']());}};_0x5b1418(++_0x5cbf46);}(_0x0424,0x159));var _0x4042=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x0424[_0x58381c];return _0x1a7440;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4042('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x4042('0x5')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0x7')]);router[_0x4042('0x5')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x9')]);router['get']('/index',auth[_0x4042('0x6')](),controller[_0x4042('0xa')]);router[_0x4042('0x5')]('/:id',auth[_0x4042('0x6')](),controller[_0x4042('0xb')]);router[_0x4042('0xc')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0xd')]);router[_0x4042('0xe')](_0x4042('0xf'),auth[_0x4042('0x6')](),controller['update']);router[_0x4042('0x10')](_0x4042('0xf'),auth['isAuthenticated'](),controller[_0x4042('0x11')]);module[_0x4042('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 e844191..954be67 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(_0x4c8f89,_0x318d19){var _0x5c5685=function(_0x28ea15){while(--_0x28ea15){_0x4c8f89['push'](_0x4c8f89['shift']());}};_0x5c5685(++_0x318d19);}(_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 _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x368563,_0x1720cb){var _0x50a723=function(_0x28b311){while(--_0x28b311){_0x368563['push'](_0x368563['shift']());}};_0x50a723(++_0x1720cb);}(_0xe706,0xa3));var _0x6e70=function(_0x5c107d,_0x155dbe){_0x5c107d=_0x5c107d-0x0;var _0x3eaf06=_0xe706[_0x5c107d];return _0x3eaf06;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 773108f..fc066fa 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(_0x42dd21,_0x277ec4){var _0x3746a1=function(_0x28aa81){while(--_0x28aa81){_0x42dd21['push'](_0x42dd21['shift']());}};_0x3746a1(++_0x277ec4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +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(_0x431162,_0x52de19){var _0x52b2e5=function(_0x17e8c2){while(--_0x17e8c2){_0x431162['push'](_0x431162['shift']());}};_0x52b2e5(++_0x52de19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 51173e4..1b4b1dc 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 _0x0917=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x0917,0x105));var _0x7091=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x0917[_0x330414];return _0x99dbff;};'use strict';var EventEmitter=require(_0x7091('0x0'));var VoiceQueueReport=require(_0x7091('0x1'))['db'][_0x7091('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7091('0x3')](0x0);var events={'afterCreate':_0x7091('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46556d){return function(_0x50048f,_0x5d34f2,_0x547d70){VoiceQueueReportEvents['emit'](_0x46556d+':'+_0x50048f['id'],_0x50048f);VoiceQueueReportEvents[_0x7091('0x5')](_0x46556d,_0x50048f);_0x547d70(null);};}for(var e in events){if(events[_0x7091('0x6')](e)){var event=events[e];VoiceQueueReport[_0x7091('0x7')](e,emitEvent(event));}}module[_0x7091('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1c14=['remove','emit','exports','events','save','update'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x1c14,0x1d1));var _0x41c1=function(_0x3baa55,_0xa4eea9){_0x3baa55=_0x3baa55-0x0;var _0x5b532f=_0x1c14[_0x3baa55];return _0x5b532f;};'use strict';var EventEmitter=require(_0x41c1('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41c1('0x1'),'afterUpdate':_0x41c1('0x2'),'afterDestroy':_0x41c1('0x3')};function emitEvent(_0x55676d){return function(_0x492938,_0x234c4b,_0x3aa46d){VoiceQueueReportEvents[_0x41c1('0x4')](_0x55676d+':'+_0x492938['id'],_0x492938);VoiceQueueReportEvents[_0x41c1('0x4')](_0x55676d,_0x492938);_0x3aa46d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x41c1('0x5')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ce16285..9202972 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(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2032,0xd9));var _0x2203=function(_0x3ad045,_0x3877d2){_0x3ad045=_0x3ad045-0x0;var _0x2e194b=_0x2032[_0x3ad045];return _0x2e194b;};'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 _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0xb10b,0x12a));var _0xbb10=function(_0xeefaee,_0x4c8038){_0xeefaee=_0xeefaee-0x0;var _0x225a0e=_0xb10b[_0xeefaee];return _0x225a0e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5fcb113..abe7286 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 _0x9c2f=['request\x20sent','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x525e11,_0x22ba00){var _0x3179a9=function(_0xb6ab32){while(--_0xb6ab32){_0x525e11['push'](_0x525e11['shift']());}};_0x3179a9(++_0x22ba00);}(_0x9c2f,0x1e3));var _0xf9c2=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x9c2f[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0xf9c2('0x0'));var util=require(_0xf9c2('0x1'));var moment=require(_0xf9c2('0x2'));var BPromise=require(_0xf9c2('0x3'));var rs=require(_0xf9c2('0x4'));var fs=require('fs');var Redis=require(_0xf9c2('0x5'));var db=require(_0xf9c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9c2('0x7'))('rpc');var config=require(_0xf9c2('0x8'));var jayson=require(_0xf9c2('0x9'));var client=jayson[_0xf9c2('0xa')]['http']({'port':0x232a});config[_0xf9c2('0xb')]=_[_0xf9c2('0xc')](config['redis'],{'host':_0xf9c2('0xd'),'port':0x18eb});var socket=require(_0xf9c2('0xe'))(new Redis(config[_0xf9c2('0xb')]));require(_0xf9c2('0xf'))[_0xf9c2('0x10')](socket);function respondWithRpcPromise(_0x288d73,_0xdde7be,_0x237a0f){return new BPromise(function(_0x2f4a11,_0x44d23b){return client[_0xf9c2('0x11')](_0x288d73,_0x237a0f)[_0xf9c2('0x12')](function(_0x4b8db3){logger[_0xf9c2('0x13')](_0xf9c2('0x14'),_0xdde7be,'request\x20sent');logger[_0xf9c2('0x15')](_0xf9c2('0x16'),_0xdde7be,_0xf9c2('0x17'),JSON['stringify'](_0x4b8db3));if(_0x4b8db3['error']){if(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x19')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0xdde7be,_0x4b8db3['error']['message']);return _0x44d23b(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);}logger['error'](_0xf9c2('0x14'),_0xdde7be,_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);return _0x2f4a11(_0x4b8db3[_0xf9c2('0x18')][_0xf9c2('0x1a')]);}else{logger[_0xf9c2('0x13')](_0xf9c2('0x14'),_0xdde7be,_0xf9c2('0x17'));_0x2f4a11(_0x4b8db3[_0xf9c2('0x1b')][_0xf9c2('0x1a')]);}})['catch'](function(_0x481a10){logger[_0xf9c2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0xdde7be,_0x481a10);_0x44d23b(_0x481a10);});});}exports[_0xf9c2('0x1c')]=function(_0x11b5ec){var _0x176834=this;return new Promise(function(_0x574093,_0x5653f7){return db['VoiceQueueReport'][_0xf9c2('0x1d')]({'raw':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec['options'][_0xf9c2('0x20')]||null:null,'attributes':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x21')]||null:null,'limit':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x22')]||null:null,'include':_0x11b5ec[_0xf9c2('0x1e')]?_0x11b5ec['options'][_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x11b5ec[_0xf9c2('0x1e')][_0xf9c2('0x23')],function(_0x20c9ed){return{'model':db[_0x20c9ed['model']],'as':_0x20c9ed['as'],'attributes':_0x20c9ed[_0xf9c2('0x21')],'include':_0x20c9ed[_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x20c9ed[_0xf9c2('0x23')],function(_0x2c696c){return{'model':db[_0x2c696c[_0xf9c2('0x25')]],'as':_0x2c696c['as'],'attributes':_0x2c696c[_0xf9c2('0x21')],'include':_0x2c696c[_0xf9c2('0x23')]?_[_0xf9c2('0x24')](_0x2c696c[_0xf9c2('0x23')],function(_0x227fd6){return{'model':db[_0x227fd6[_0xf9c2('0x25')]],'as':_0x227fd6['as'],'attributes':_0x227fd6[_0xf9c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf9c2('0x12')](function(_0x353eae){logger[_0xf9c2('0x13')](_0xf9c2('0x1c'),_0x11b5ec);logger[_0xf9c2('0x15')](_0xf9c2('0x1c'),_0x11b5ec,JSON[_0xf9c2('0x26')](_0x353eae));_0x574093(_0x353eae);})['catch'](function(_0xf5a143){logger[_0xf9c2('0x18')](_0xf9c2('0x1c'),_0xf5a143[_0xf9c2('0x1a')],_0x11b5ec);_0x5653f7(_0x176834['error'](0x1f4,_0xf5a143[_0xf9c2('0x1a')]));});});};exports[_0xf9c2('0x27')]=function(_0x131f48){var _0x2824dc=this;return new Promise(function(_0x5833a7,_0x1720ad){return db[_0xf9c2('0x28')][_0xf9c2('0x29')](_0x131f48['body'],{'raw':_0x131f48[_0xf9c2('0x1e')]?_0x131f48[_0xf9c2('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x134e05){logger['info'](_0xf9c2('0x27'),_0x131f48);logger[_0xf9c2('0x15')](_0xf9c2('0x27'),_0x131f48,JSON[_0xf9c2('0x26')](_0x134e05));_0x5833a7(_0x134e05);})['catch'](function(_0x3f3583){logger[_0xf9c2('0x18')](_0xf9c2('0x27'),_0x3f3583[_0xf9c2('0x1a')],_0x131f48);_0x1720ad(_0x2824dc[_0xf9c2('0x18')](0x1f4,_0x3f3583[_0xf9c2('0x1a')]));});});};exports[_0xf9c2('0x2a')]=function(_0x206ea6){var _0x24ddf4=this;return new Promise(function(_0x305ff1,_0x1e4219){return db['VoiceQueueReport'][_0xf9c2('0x2b')](_0x206ea6[_0xf9c2('0x2c')],{'raw':_0x206ea6['options']?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x20')]||null:null,'attributes':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6['options'][_0xf9c2('0x21')]||null:null,'limit':_0x206ea6[_0xf9c2('0x1e')]?_0x206ea6[_0xf9c2('0x1e')][_0xf9c2('0x22')]||null:null})[_0xf9c2('0x12')](function(_0x4d5f4b){logger[_0xf9c2('0x13')](_0xf9c2('0x2a'),_0x206ea6);logger['debug'](_0xf9c2('0x2a'),_0x206ea6,JSON[_0xf9c2('0x26')](_0x4d5f4b));_0x305ff1(_0x4d5f4b);})[_0xf9c2('0x2d')](function(_0x46053e){logger['error'](_0xf9c2('0x2a'),_0x46053e[_0xf9c2('0x1a')],_0x206ea6);_0x1e4219(_0x24ddf4[_0xf9c2('0x18')](0x1f4,_0x46053e[_0xf9c2('0x1a')]));});});}; \ No newline at end of file +var _0x887b=['client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','limit','include','model','attributes','then','create','body','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x887b,0xf9));var _0xb887=function(_0x225a24,_0x1189cf){_0x225a24=_0x225a24-0x0;var _0x4753bf=_0x887b[_0x225a24];return _0x4753bf;};'use strict';var _=require('lodash');var util=require(_0xb887('0x0'));var moment=require(_0xb887('0x1'));var BPromise=require(_0xb887('0x2'));var rs=require(_0xb887('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb887('0x4'));var logger=require(_0xb887('0x5'))(_0xb887('0x6'));var config=require(_0xb887('0x7'));var jayson=require(_0xb887('0x8'));var client=jayson[_0xb887('0x9')]['http']({'port':0x232a});config[_0xb887('0xa')]=_[_0xb887('0xb')](config['redis'],{'host':_0xb887('0xc'),'port':0x18eb});var socket=require(_0xb887('0xd'))(new Redis(config[_0xb887('0xa')]));require(_0xb887('0xe'))['register'](socket);function respondWithRpcPromise(_0x384e18,_0x1d1bd2,_0x4019b5){return new BPromise(function(_0x39f264,_0x40971d){return client[_0xb887('0xf')](_0x384e18,_0x4019b5)['then'](function(_0x21a2c9){logger[_0xb887('0x10')](_0xb887('0x11'),_0x1d1bd2,_0xb887('0x12'));logger[_0xb887('0x13')](_0xb887('0x14'),_0x1d1bd2,_0xb887('0x12'),JSON[_0xb887('0x15')](_0x21a2c9));if(_0x21a2c9[_0xb887('0x16')]){if(_0x21a2c9[_0xb887('0x16')][_0xb887('0x17')]===0x1f4){logger[_0xb887('0x16')](_0xb887('0x11'),_0x1d1bd2,_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);return _0x40971d(_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);}logger[_0xb887('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);return _0x39f264(_0x21a2c9['error'][_0xb887('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0xb887('0x12'));_0x39f264(_0x21a2c9[_0xb887('0x19')][_0xb887('0x18')]);}})[_0xb887('0x1a')](function(_0x251e49){logger[_0xb887('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0x251e49);_0x40971d(_0x251e49);});});}exports[_0xb887('0x1b')]=function(_0x52f805){var _0x16ec36=this;return new Promise(function(_0x549a45,_0x4821b8){return db[_0xb887('0x1c')][_0xb887('0x1d')]({'raw':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')]['where']||null:null,'attributes':_0x52f805[_0xb887('0x1e')]?_0x52f805['options']['attributes']||null:null,'limit':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')][_0xb887('0x1f')]||null:null,'include':_0x52f805['options']?_0x52f805[_0xb887('0x1e')][_0xb887('0x20')]?_['map'](_0x52f805[_0xb887('0x1e')][_0xb887('0x20')],function(_0x1240c1){return{'model':db[_0x1240c1[_0xb887('0x21')]],'as':_0x1240c1['as'],'attributes':_0x1240c1[_0xb887('0x22')],'include':_0x1240c1[_0xb887('0x20')]?_['map'](_0x1240c1['include'],function(_0x16ef3b){return{'model':db[_0x16ef3b[_0xb887('0x21')]],'as':_0x16ef3b['as'],'attributes':_0x16ef3b[_0xb887('0x22')],'include':_0x16ef3b[_0xb887('0x20')]?_['map'](_0x16ef3b[_0xb887('0x20')],function(_0x97d1){return{'model':db[_0x97d1[_0xb887('0x21')]],'as':_0x97d1['as'],'attributes':_0x97d1[_0xb887('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb887('0x23')](function(_0x24d93e){logger[_0xb887('0x10')](_0xb887('0x1b'),_0x52f805);logger[_0xb887('0x13')](_0xb887('0x1b'),_0x52f805,JSON[_0xb887('0x15')](_0x24d93e));_0x549a45(_0x24d93e);})[_0xb887('0x1a')](function(_0x56becf){logger[_0xb887('0x16')](_0xb887('0x1b'),_0x56becf['message'],_0x52f805);_0x4821b8(_0x16ec36[_0xb887('0x16')](0x1f4,_0x56becf[_0xb887('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x4cb88){var _0x3460f4=this;return new Promise(function(_0x35ca16,_0x49fefa){return db[_0xb887('0x1c')][_0xb887('0x24')](_0x4cb88[_0xb887('0x25')],{'raw':_0x4cb88[_0xb887('0x1e')]?_0x4cb88['options'][_0xb887('0x26')]===undefined?!![]:![]:!![]})[_0xb887('0x23')](function(_0x1de7ee){logger[_0xb887('0x10')]('CreateVoiceQueueReport',_0x4cb88);logger[_0xb887('0x13')](_0xb887('0x27'),_0x4cb88,JSON[_0xb887('0x15')](_0x1de7ee));_0x35ca16(_0x1de7ee);})[_0xb887('0x1a')](function(_0x417257){logger['error'](_0xb887('0x27'),_0x417257['message'],_0x4cb88);_0x49fefa(_0x3460f4[_0xb887('0x16')](0x1f4,_0x417257['message']));});});};exports[_0xb887('0x28')]=function(_0x5db834){var _0x20159f=this;return new Promise(function(_0x2176ae,_0xe4bad2){return db[_0xb887('0x1c')][_0xb887('0x29')](_0x5db834[_0xb887('0x25')],{'raw':_0x5db834['options']?_0x5db834['options'][_0xb887('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db834[_0xb887('0x1e')]?_0x5db834[_0xb887('0x1e')][_0xb887('0x2a')]||null:null,'attributes':_0x5db834['options']?_0x5db834['options'][_0xb887('0x22')]||null:null,'limit':_0x5db834['options']?_0x5db834[_0xb887('0x1e')][_0xb887('0x1f')]||null:null})[_0xb887('0x23')](function(_0x3bad19){logger['info'](_0xb887('0x28'),_0x5db834);logger['debug']('UpdateVoiceQueueReport',_0x5db834,JSON[_0xb887('0x15')](_0x3bad19));_0x2176ae(_0x3bad19);})[_0xb887('0x1a')](function(_0x2a11bd){logger[_0xb887('0x16')](_0xb887('0x28'),_0x2a11bd[_0xb887('0x18')],_0x5db834);_0xe4bad2(_0x20159f[_0xb887('0x16')](0x1f4,_0x2a11bd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 590b1e6..86601e9 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 _0x9f5a=['update','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x9f5a,0x170));var _0xa9f5=function(_0x193293,_0x567c96){_0x193293=_0x193293-0x0;var _0x458c17=_0x9f5a[_0x193293];return _0x458c17;};'use strict';var VoiceQueueReportEvents=require(_0xa9f5('0x0'));var events=[_0xa9f5('0x1'),_0xa9f5('0x2'),_0xa9f5('0x3')];function createListener(_0xa8221a,_0x488bd0){return function(_0x5034b4){_0x488bd0[_0xa9f5('0x4')](_0xa8221a,_0x5034b4);};}function removeListener(_0x4e43ce,_0x300d66){return function(){VoiceQueueReportEvents[_0xa9f5('0x5')](_0x4e43ce,_0x300d66);};}exports['register']=function(_0x31486f){for(var _0x1d77f8=0x0,_0x45cf3b=events['length'];_0x1d77f8<_0x45cf3b;_0x1d77f8++){var _0x43ea4e=events[_0x1d77f8];var _0x577478=createListener(_0xa9f5('0x6')+_0x43ea4e,_0x31486f);VoiceQueueReportEvents['on'](_0x43ea4e,_0x577478);}}; \ No newline at end of file +var _0x44c5=['emit','length','save','remove'];(function(_0xce2a29,_0x1018b9){var _0x3a1751=function(_0x48956b){while(--_0x48956b){_0xce2a29['push'](_0xce2a29['shift']());}};_0x3a1751(++_0x1018b9);}(_0x44c5,0xee));var _0x544c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x44c5[_0xac151d];return _0x111dba;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x544c('0x0'),_0x544c('0x1'),'update'];function createListener(_0x947602,_0x3b9f08){return function(_0xf37e1){_0x3b9f08[_0x544c('0x2')](_0x947602,_0xf37e1);};}function removeListener(_0x18405a,_0xcff546){return function(){VoiceQueueReportEvents['removeListener'](_0x18405a,_0xcff546);};}exports['register']=function(_0x4d4614){for(var _0x5a22b4=0x0,_0x392a01=events[_0x544c('0x3')];_0x5a22b4<_0x392a01;_0x5a22b4++){var _0x770f69=events[_0x5a22b4];var _0x19046f=createListener('voiceQueueReport:'+_0x770f69,_0x4d4614);VoiceQueueReportEvents['on'](_0x770f69,_0x19046f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7af5df3..c9bd63c 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 _0xdf97=['express','Router','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x5eab4b,_0x465f55){var _0x28b471=function(_0x31e7fc){while(--_0x31e7fc){_0x5eab4b['push'](_0x5eab4b['shift']());}};_0x28b471(++_0x465f55);}(_0xdf97,0x11d));var _0x7df9=function(_0x446dda,_0x2ab1c0){_0x446dda=_0x446dda-0x0;var _0x4751ff=_0xdf97[_0x446dda];return _0x4751ff;};'use strict';var multer=require('multer');var util=require(_0x7df9('0x0'));var path=require(_0x7df9('0x1'));var timeout=require(_0x7df9('0x2'));var express=require(_0x7df9('0x3'));var router=express[_0x7df9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7df9('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x7df9('0x6')]('/',auth['isAuthenticated'](),controller[_0x7df9('0x7')]);router[_0x7df9('0x6')]('/:id',auth[_0x7df9('0x8')](),controller[_0x7df9('0x9')]);router[_0x7df9('0xa')]('/',auth[_0x7df9('0x8')](),controller[_0x7df9('0xb')]);router[_0x7df9('0xc')](_0x7df9('0xd'),auth[_0x7df9('0x8')](),controller['update']);router['delete'](_0x7df9('0xd'),auth[_0x7df9('0x8')](),controller[_0x7df9('0xe')]);module[_0x7df9('0xf')]=router; \ No newline at end of file +var _0x5b2e=['create','put','update','destroy','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post'];(function(_0x58a239,_0x4b5d29){var _0x3ba432=function(_0xda4381){while(--_0xda4381){_0x58a239['push'](_0x58a239['shift']());}};_0x3ba432(++_0x4b5d29);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x112dc0,_0x593c7d){_0x112dc0=_0x112dc0-0x0;var _0x23afc0=_0x5b2e[_0x112dc0];return _0x23afc0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe5b2('0x0'));var express=require(_0xe5b2('0x1'));var router=express[_0xe5b2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe5b2('0x3'));var config=require(_0xe5b2('0x4'));var controller=require(_0xe5b2('0x5'));router[_0xe5b2('0x6')]('/',auth[_0xe5b2('0x7')](),controller['index']);router[_0xe5b2('0x6')](_0xe5b2('0x8'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0x9')]);router[_0xe5b2('0xa')]('/',auth['isAuthenticated'](),controller[_0xe5b2('0xb')]);router[_0xe5b2('0xc')](_0xe5b2('0x8'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0xd')]);router['delete'](_0xe5b2('0x8'),auth['isAuthenticated'](),controller[_0xe5b2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 0ecf40e..ef31d4b 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 _0xc4bb=['format','sequelize','moment','STRING','DATE'];(function(_0x59ef5e,_0x34be25){var _0xe7004d=function(_0x26f549){while(--_0x26f549){_0x59ef5e['push'](_0x59ef5e['shift']());}};_0xe7004d(++_0x34be25);}(_0xc4bb,0x15a));var _0xbc4b=function(_0x528b9b,_0x58520a){_0x528b9b=_0x528b9b-0x0;var _0x5f7129=_0xc4bb[_0x528b9b];return _0x5f7129;};'use strict';var Sequelize=require(_0xbc4b('0x0'));var moment=require(_0xbc4b('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xbc4b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbc4b('0x3')],'allowNull':![],'defaultValue':moment()[_0xbc4b('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x67bd=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING','DATE','format'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x67bd,0x11b));var _0xd67b=function(_0x28bb7d,_0xbcd07f){_0x28bb7d=_0x28bb7d-0x0;var _0x40f4da=_0x67bd[_0x28bb7d];return _0x40f4da;};'use strict';var Sequelize=require(_0xd67b('0x0'));var moment=require(_0xd67b('0x1'));module['exports']={'time':{'type':Sequelize[_0xd67b('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd67b('0x3')],'allowNull':![],'defaultValue':moment()[_0xd67b('0x4')](_0xd67b('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b9a35c7..21c5595 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 _0x0e6a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filters','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x55d09d,_0x49994a){var _0x8f45c5=function(_0x4c5e6c){while(--_0x4c5e6c){_0x55d09d['push'](_0x55d09d['shift']());}};_0x8f45c5(++_0x49994a);}(_0x0e6a,0x1a7));var _0xa0e6=function(_0x5f1431,_0x49bea0){_0x5f1431=_0x5f1431-0x0;var _0x165500=_0x0e6a[_0x5f1431];return _0x165500;};'use strict';var pdf=require(_0xa0e6('0x0'));var emlformat=require(_0xa0e6('0x1'));var rimraf=require(_0xa0e6('0x2'));var zipdir=require(_0xa0e6('0x3'));var jsonpatch=require(_0xa0e6('0x4'));var rp=require(_0xa0e6('0x5'));var moment=require(_0xa0e6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa0e6('0x7'));var util=require(_0xa0e6('0x8'));var path=require(_0xa0e6('0x9'));var sox=require(_0xa0e6('0xa'));var csv=require(_0xa0e6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0e6('0xc'));var squel=require(_0xa0e6('0xd'));var crypto=require(_0xa0e6('0xe'));var jsforce=require(_0xa0e6('0xf'));var deskjs=require(_0xa0e6('0x10'));var toCsv=require(_0xa0e6('0xb'));var querystring=require(_0xa0e6('0x11'));var Papa=require(_0xa0e6('0x12'));var Redis=require('ioredis');var authService=require(_0xa0e6('0x13'));var qs=require(_0xa0e6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0e6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa0e6('0x16'));var config=require(_0xa0e6('0x17'));var licenseUtil=require(_0xa0e6('0x18'));var db=require(_0xa0e6('0x19'))['db'];function respondWithStatusCode(_0x3f2e3b,_0x35194e){_0x35194e=_0x35194e||0xcc;return function(_0x513db8){if(_0x513db8){return _0x3f2e3b[_0xa0e6('0x1a')](_0x35194e);}return _0x3f2e3b[_0xa0e6('0x1b')](_0x35194e)[_0xa0e6('0x1c')]();};}function respondWithResult(_0x22be7b,_0x1b1f5a){_0x1b1f5a=_0x1b1f5a||0xc8;return function(_0x59615f){if(_0x59615f){return _0x22be7b[_0xa0e6('0x1b')](_0x1b1f5a)['json'](_0x59615f);}};}function respondWithFilteredResult(_0x22047c,_0xd7e58d){return function(_0xd38df5){if(_0xd38df5){var _0x4f05f9=_0xd38df5['count'],_0x4588c2=_0xd7e58d['offset'],_0xc4d22c=_0xd7e58d['offset']+_0xd7e58d[_0xa0e6('0x1d')],_0x22b924;if(_0xc4d22c>=_0x4f05f9){_0xc4d22c=_0x4f05f9;_0x22b924=0xc8;}else{_0x22b924=0xce;}_0x22047c['status'](_0x22b924);return _0x22047c[_0xa0e6('0x1e')](_0xa0e6('0x1f'),_0x4588c2+'-'+_0xc4d22c+'/'+_0x4f05f9)['json'](_0xd38df5);}return null;};}function patchUpdates(_0x1c91b8){return function(_0x476644){try{jsonpatch[_0xa0e6('0x20')](_0x476644,_0x1c91b8,!![]);}catch(_0x511f69){return BPromise[_0xa0e6('0x21')](_0x511f69);}return _0x476644[_0xa0e6('0x22')]();};}function saveUpdates(_0x2ed02c,_0x530772){return function(_0x5dedbc){if(_0x5dedbc){return _0x5dedbc[_0xa0e6('0x23')](_0x2ed02c)['then'](function(_0x1a6d11){return _0x1a6d11;});}return null;};}function removeEntity(_0x45e089,_0x189de9){return function(_0x990a0b){if(_0x990a0b){return _0x990a0b['destroy']()[_0xa0e6('0x24')](function(){_0x45e089[_0xa0e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b01db,_0x1b780b){return function(_0x18639b){if(!_0x18639b){_0x3b01db['sendStatus'](0x194);}return _0x18639b;};}function handleError(_0x2feced,_0x4e3b84){_0x4e3b84=_0x4e3b84||0x1f4;return function(_0xfc7841){logger[_0xa0e6('0x25')](_0xfc7841[_0xa0e6('0x26')]);if(_0xfc7841[_0xa0e6('0x27')]){delete _0xfc7841[_0xa0e6('0x27')];}_0x2feced[_0xa0e6('0x1b')](_0x4e3b84)['send'](_0xfc7841);};}exports[_0xa0e6('0x28')]=function(_0x57c0e4,_0x4ecee1){var _0x2deb17={},_0x28056c={},_0x200f8e={'count':0x0,'rows':[]};var _0x2f8a71=_[_0xa0e6('0x29')](db[_0xa0e6('0x2a')]['rawAttributes'],function(_0x3ce43f){return{'name':_0x3ce43f[_0xa0e6('0x2b')],'type':_0x3ce43f['type'][_0xa0e6('0x2c')]};});_0x28056c[_0xa0e6('0x2d')]=_['map'](_0x2f8a71,_0xa0e6('0x27'));_0x28056c[_0xa0e6('0x2e')]=_[_0xa0e6('0x2f')](_0x57c0e4[_0xa0e6('0x2e')]);_0x28056c['filters']=_['intersection'](_0x28056c['model'],_0x28056c['query']);_0x2deb17['attributes']=_[_0xa0e6('0x30')](_0x28056c[_0xa0e6('0x2d')],qs[_0xa0e6('0x31')](_0x57c0e4['query']['fields']));_0x2deb17[_0xa0e6('0x32')]=_0x2deb17[_0xa0e6('0x32')]['length']?_0x2deb17[_0xa0e6('0x32')]:_0x28056c[_0xa0e6('0x2d')];if(!_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x33')](_0xa0e6('0x34'))){_0x2deb17[_0xa0e6('0x1d')]=qs['limit'](_0x57c0e4[_0xa0e6('0x2e')]['limit']);_0x2deb17[_0xa0e6('0x35')]=qs['offset'](_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x35')]);}_0x2deb17['order']=qs[_0xa0e6('0x36')](_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x36')]);_0x2deb17['where']=qs[_0xa0e6('0x37')](_['pick'](_0x57c0e4[_0xa0e6('0x2e')],_0x28056c['filters']),_0x2f8a71);if(_0x57c0e4['query'][_0xa0e6('0x38')]){_0x2deb17[_0xa0e6('0x39')]=_['merge'](_0x2deb17[_0xa0e6('0x39')],{'$or':_[_0xa0e6('0x29')](_0x2f8a71,function(_0x443911){if(_0x443911['type']!==_0xa0e6('0x3a')){var _0x34f390={};_0x34f390[_0x443911['name']]={'$like':'%'+_0x57c0e4['query'][_0xa0e6('0x38')]+'%'};return _0x34f390;}})});}_0x2deb17=_[_0xa0e6('0x3b')]({},_0x2deb17,_0x57c0e4[_0xa0e6('0x3c')]);var _0x4849ed={'where':_0x2deb17[_0xa0e6('0x39')]};return db[_0xa0e6('0x2a')][_0xa0e6('0x3d')](_0x4849ed)[_0xa0e6('0x24')](function(_0x17fd9b){_0x200f8e['count']=_0x17fd9b;if(_0x57c0e4[_0xa0e6('0x2e')][_0xa0e6('0x3e')]){_0x2deb17['include']=[{'all':!![]}];}return db[_0xa0e6('0x2a')][_0xa0e6('0x3f')](_0x2deb17);})[_0xa0e6('0x24')](function(_0x14e730){_0x200f8e[_0xa0e6('0x40')]=_0x14e730;return _0x200f8e;})['then'](respondWithFilteredResult(_0x4ecee1,_0x2deb17))[_0xa0e6('0x41')](handleError(_0x4ecee1,null));};exports[_0xa0e6('0x42')]=function(_0x1d69d7,_0x259ffc){var _0x128ccf={'raw':!![],'where':{'id':_0x1d69d7[_0xa0e6('0x43')]['id']}},_0x151014={};_0x151014['model']=_['keys'](db[_0xa0e6('0x2a')]['rawAttributes']);_0x151014[_0xa0e6('0x2e')]=_[_0xa0e6('0x2f')](_0x1d69d7['query']);_0x151014[_0xa0e6('0x37')]=_['intersection'](_0x151014[_0xa0e6('0x2d')],_0x151014[_0xa0e6('0x2e')]);_0x128ccf[_0xa0e6('0x32')]=_[_0xa0e6('0x30')](_0x151014[_0xa0e6('0x2d')],qs[_0xa0e6('0x31')](_0x1d69d7['query'][_0xa0e6('0x31')]));_0x128ccf[_0xa0e6('0x32')]=_0x128ccf['attributes']['length']?_0x128ccf[_0xa0e6('0x32')]:_0x151014[_0xa0e6('0x2d')];if(_0x1d69d7[_0xa0e6('0x2e')][_0xa0e6('0x3e')]){_0x128ccf[_0xa0e6('0x44')]=[{'all':!![]}];}_0x128ccf=_[_0xa0e6('0x3b')]({},_0x128ccf,_0x1d69d7[_0xa0e6('0x3c')]);return db[_0xa0e6('0x2a')][_0xa0e6('0x45')](_0x128ccf)[_0xa0e6('0x24')](handleEntityNotFound(_0x259ffc,null))[_0xa0e6('0x24')](respondWithResult(_0x259ffc,null))[_0xa0e6('0x41')](handleError(_0x259ffc,null));};exports[_0xa0e6('0x46')]=function(_0x31d186,_0x3a9436){return db[_0xa0e6('0x2a')][_0xa0e6('0x46')](_0x31d186[_0xa0e6('0x47')],{})[_0xa0e6('0x24')](respondWithResult(_0x3a9436,0xc9))[_0xa0e6('0x41')](handleError(_0x3a9436,null));};exports[_0xa0e6('0x23')]=function(_0x22bfac,_0x54c437){if(_0x22bfac['body']['id']){delete _0x22bfac[_0xa0e6('0x47')]['id'];}return db['VoiceQueuesLog'][_0xa0e6('0x45')]({'where':{'id':_0x22bfac[_0xa0e6('0x43')]['id']}})[_0xa0e6('0x24')](handleEntityNotFound(_0x54c437,null))[_0xa0e6('0x24')](saveUpdates(_0x22bfac[_0xa0e6('0x47')],null))[_0xa0e6('0x24')](respondWithResult(_0x54c437,null))[_0xa0e6('0x41')](handleError(_0x54c437,null));};exports[_0xa0e6('0x48')]=function(_0x23294d,_0x4522b4){return db[_0xa0e6('0x2a')]['find']({'where':{'id':_0x23294d[_0xa0e6('0x43')]['id']}})[_0xa0e6('0x24')](handleEntityNotFound(_0x4522b4,null))[_0xa0e6('0x24')](removeEntity(_0x4522b4,null))[_0xa0e6('0x41')](handleError(_0x4522b4,null));}; \ No newline at end of file +var _0xdf02=['filters','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xdf02,0xde));var _0x2df0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdf02[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x2df0('0x0'));var emlformat=require(_0x2df0('0x1'));var rimraf=require(_0x2df0('0x2'));var zipdir=require(_0x2df0('0x3'));var jsonpatch=require(_0x2df0('0x4'));var rp=require(_0x2df0('0x5'));var moment=require(_0x2df0('0x6'));var BPromise=require(_0x2df0('0x7'));var Mustache=require('mustache');var util=require(_0x2df0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2df0('0x9'));var ejs=require(_0x2df0('0xa'));var fs=require('fs');var _=require(_0x2df0('0xb'));var squel=require(_0x2df0('0xc'));var crypto=require(_0x2df0('0xd'));var jsforce=require(_0x2df0('0xe'));var deskjs=require(_0x2df0('0xf'));var toCsv=require(_0x2df0('0x9'));var querystring=require('querystring');var Papa=require(_0x2df0('0x10'));var Redis=require(_0x2df0('0x11'));var authService=require(_0x2df0('0x12'));var qs=require(_0x2df0('0x13'));var as=require(_0x2df0('0x14'));var hardwareService=require(_0x2df0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2df0('0x16'));var config=require(_0x2df0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2df0('0x18'))['db'];function respondWithStatusCode(_0x29be7b,_0x21b32c){_0x21b32c=_0x21b32c||0xcc;return function(_0x55f8c1){if(_0x55f8c1){return _0x29be7b[_0x2df0('0x19')](_0x21b32c);}return _0x29be7b['status'](_0x21b32c)[_0x2df0('0x1a')]();};}function respondWithResult(_0xafb1cd,_0x2c3da0){_0x2c3da0=_0x2c3da0||0xc8;return function(_0x15d649){if(_0x15d649){return _0xafb1cd[_0x2df0('0x1b')](_0x2c3da0)[_0x2df0('0x1c')](_0x15d649);}};}function respondWithFilteredResult(_0x24ba73,_0xed70c1){return function(_0x2e3d14){if(_0x2e3d14){var _0x2e1202=_0x2e3d14[_0x2df0('0x1d')],_0x57b0b4=_0xed70c1[_0x2df0('0x1e')],_0x5a481b=_0xed70c1[_0x2df0('0x1e')]+_0xed70c1['limit'],_0x5a0978;if(_0x5a481b>=_0x2e1202){_0x5a481b=_0x2e1202;_0x5a0978=0xc8;}else{_0x5a0978=0xce;}_0x24ba73['status'](_0x5a0978);return _0x24ba73[_0x2df0('0x1f')](_0x2df0('0x20'),_0x57b0b4+'-'+_0x5a481b+'/'+_0x2e1202)[_0x2df0('0x1c')](_0x2e3d14);}return null;};}function patchUpdates(_0x396ff3){return function(_0x5a5ef3){try{jsonpatch['apply'](_0x5a5ef3,_0x396ff3,!![]);}catch(_0x41944e){return BPromise['reject'](_0x41944e);}return _0x5a5ef3['save']();};}function saveUpdates(_0x1adad8,_0x193d42){return function(_0x89b69c){if(_0x89b69c){return _0x89b69c['update'](_0x1adad8)[_0x2df0('0x21')](function(_0x49e50c){return _0x49e50c;});}return null;};}function removeEntity(_0x150d8a,_0x2d4f10){return function(_0x1b7802){if(_0x1b7802){return _0x1b7802[_0x2df0('0x22')]()['then'](function(){_0x150d8a[_0x2df0('0x1b')](0xcc)[_0x2df0('0x1a')]();});}};}function handleEntityNotFound(_0x3849bb,_0xaf4f02){return function(_0x5e6c2d){if(!_0x5e6c2d){_0x3849bb[_0x2df0('0x19')](0x194);}return _0x5e6c2d;};}function handleError(_0x21e2a0,_0x473477){_0x473477=_0x473477||0x1f4;return function(_0x5ddd06){logger[_0x2df0('0x23')](_0x5ddd06[_0x2df0('0x24')]);if(_0x5ddd06[_0x2df0('0x25')]){delete _0x5ddd06['name'];}_0x21e2a0[_0x2df0('0x1b')](_0x473477)[_0x2df0('0x26')](_0x5ddd06);};}exports[_0x2df0('0x27')]=function(_0x1c4694,_0x46f437){var _0x3e070d={},_0x498912={},_0x32f32b={'count':0x0,'rows':[]};var _0x3eb1b0=_[_0x2df0('0x28')](db[_0x2df0('0x29')][_0x2df0('0x2a')],function(_0x6065e4){return{'name':_0x6065e4[_0x2df0('0x2b')],'type':_0x6065e4[_0x2df0('0x2c')][_0x2df0('0x2d')]};});_0x498912[_0x2df0('0x2e')]=_[_0x2df0('0x28')](_0x3eb1b0,'name');_0x498912[_0x2df0('0x2f')]=_[_0x2df0('0x30')](_0x1c4694['query']);_0x498912['filters']=_[_0x2df0('0x31')](_0x498912[_0x2df0('0x2e')],_0x498912['query']);_0x3e070d[_0x2df0('0x32')]=_[_0x2df0('0x31')](_0x498912[_0x2df0('0x2e')],qs[_0x2df0('0x33')](_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x33')]));_0x3e070d[_0x2df0('0x32')]=_0x3e070d['attributes'][_0x2df0('0x34')]?_0x3e070d[_0x2df0('0x32')]:_0x498912['model'];if(!_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x35')]('nolimit')){_0x3e070d[_0x2df0('0x36')]=qs[_0x2df0('0x36')](_0x1c4694[_0x2df0('0x2f')]['limit']);_0x3e070d['offset']=qs[_0x2df0('0x1e')](_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x1e')]);}_0x3e070d[_0x2df0('0x37')]=qs[_0x2df0('0x38')](_0x1c4694['query'][_0x2df0('0x38')]);_0x3e070d[_0x2df0('0x39')]=qs['filters'](_[_0x2df0('0x3a')](_0x1c4694[_0x2df0('0x2f')],_0x498912['filters']),_0x3eb1b0);if(_0x1c4694['query'][_0x2df0('0x3b')]){_0x3e070d[_0x2df0('0x39')]=_[_0x2df0('0x3c')](_0x3e070d[_0x2df0('0x39')],{'$or':_[_0x2df0('0x28')](_0x3eb1b0,function(_0x3cb7d7){if(_0x3cb7d7[_0x2df0('0x2c')]!==_0x2df0('0x3d')){var _0x35ff5e={};_0x35ff5e[_0x3cb7d7['name']]={'$like':'%'+_0x1c4694['query']['filter']+'%'};return _0x35ff5e;}})});}_0x3e070d=_['merge']({},_0x3e070d,_0x1c4694['options']);var _0x51fd47={'where':_0x3e070d['where']};return db[_0x2df0('0x29')][_0x2df0('0x1d')](_0x51fd47)[_0x2df0('0x21')](function(_0x1a194e){_0x32f32b['count']=_0x1a194e;if(_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x3e')]){_0x3e070d[_0x2df0('0x3f')]=[{'all':!![]}];}return db[_0x2df0('0x29')][_0x2df0('0x40')](_0x3e070d);})[_0x2df0('0x21')](function(_0xcfadf){_0x32f32b['rows']=_0xcfadf;return _0x32f32b;})[_0x2df0('0x21')](respondWithFilteredResult(_0x46f437,_0x3e070d))['catch'](handleError(_0x46f437,null));};exports[_0x2df0('0x41')]=function(_0x617172,_0xcb2202){var _0x3ecf38={'raw':!![],'where':{'id':_0x617172['params']['id']}},_0x20c478={};_0x20c478[_0x2df0('0x2e')]=_[_0x2df0('0x30')](db[_0x2df0('0x29')][_0x2df0('0x2a')]);_0x20c478[_0x2df0('0x2f')]=_[_0x2df0('0x30')](_0x617172['query']);_0x20c478[_0x2df0('0x42')]=_[_0x2df0('0x31')](_0x20c478[_0x2df0('0x2e')],_0x20c478[_0x2df0('0x2f')]);_0x3ecf38['attributes']=_[_0x2df0('0x31')](_0x20c478[_0x2df0('0x2e')],qs[_0x2df0('0x33')](_0x617172['query'][_0x2df0('0x33')]));_0x3ecf38[_0x2df0('0x32')]=_0x3ecf38['attributes'][_0x2df0('0x34')]?_0x3ecf38[_0x2df0('0x32')]:_0x20c478[_0x2df0('0x2e')];if(_0x617172[_0x2df0('0x2f')][_0x2df0('0x3e')]){_0x3ecf38[_0x2df0('0x3f')]=[{'all':!![]}];}_0x3ecf38=_[_0x2df0('0x3c')]({},_0x3ecf38,_0x617172['options']);return db[_0x2df0('0x29')][_0x2df0('0x43')](_0x3ecf38)['then'](handleEntityNotFound(_0xcb2202,null))[_0x2df0('0x21')](respondWithResult(_0xcb2202,null))[_0x2df0('0x44')](handleError(_0xcb2202,null));};exports['create']=function(_0x1b25b7,_0x4f93b5){return db[_0x2df0('0x29')][_0x2df0('0x45')](_0x1b25b7[_0x2df0('0x46')],{})[_0x2df0('0x21')](respondWithResult(_0x4f93b5,0xc9))[_0x2df0('0x44')](handleError(_0x4f93b5,null));};exports['update']=function(_0x19a3d2,_0x4c5543){if(_0x19a3d2[_0x2df0('0x46')]['id']){delete _0x19a3d2[_0x2df0('0x46')]['id'];}return db['VoiceQueuesLog'][_0x2df0('0x43')]({'where':{'id':_0x19a3d2['params']['id']}})['then'](handleEntityNotFound(_0x4c5543,null))['then'](saveUpdates(_0x19a3d2[_0x2df0('0x46')],null))[_0x2df0('0x21')](respondWithResult(_0x4c5543,null))[_0x2df0('0x44')](handleError(_0x4c5543,null));};exports[_0x2df0('0x22')]=function(_0x51795f,_0xbacf5){return db[_0x2df0('0x29')]['find']({'where':{'id':_0x51795f[_0x2df0('0x47')]['id']}})['then'](handleEntityNotFound(_0xbacf5,null))[_0x2df0('0x21')](removeEntity(_0xbacf5,null))[_0x2df0('0x44')](handleError(_0xbacf5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f4d87d7..9db014a 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 _0xbf04=['define','voice_queues_log','event_dtm','event','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x4c7080,_0x30ec5d){var _0x33ceb7=function(_0x4ce10d){while(--_0x4ce10d){_0x4c7080['push'](_0x4c7080['shift']());}};_0x33ceb7(++_0x30ec5d);}(_0xbf04,0x108));var _0x4bf0=function(_0x4d73d8,_0x3ee19d){_0x4d73d8=_0x4d73d8-0x0;var _0x9f83bd=_0xbf04[_0x4d73d8];return _0x9f83bd;};'use strict';var _=require(_0x4bf0('0x0'));var util=require(_0x4bf0('0x1'));var logger=require('../../config/logger')(_0x4bf0('0x2'));var moment=require(_0x4bf0('0x3'));var BPromise=require(_0x4bf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bf0('0x5'));var rimraf=require('rimraf');var config=require(_0x4bf0('0x6'));var attributes=require(_0x4bf0('0x7'));module[_0x4bf0('0x8')]=function(_0x38ca87,_0x384f5c){return _0x38ca87[_0x4bf0('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x4bf0('0xa'),'paranoid':![],'indexes':[{'name':_0x4bf0('0xb'),'fields':[_0x4bf0('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x1c66=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xfd4429,_0x1007cf){var _0x33be1f=function(_0x4af17b){while(--_0x4af17b){_0xfd4429['push'](_0xfd4429['shift']());}};_0x33be1f(++_0x1007cf);}(_0x1c66,0x111));var _0x61c6=function(_0xf8bd35,_0x33d303){_0xf8bd35=_0xf8bd35-0x0;var _0x5ce044=_0x1c66[_0xf8bd35];return _0x5ce044;};'use strict';var _=require(_0x61c6('0x0'));var util=require('util');var logger=require(_0x61c6('0x1'))(_0x61c6('0x2'));var moment=require(_0x61c6('0x3'));var BPromise=require('bluebird');var rp=require(_0x61c6('0x4'));var fs=require('fs');var path=require(_0x61c6('0x5'));var rimraf=require(_0x61c6('0x6'));var config=require(_0x61c6('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x61c6('0x8')]=function(_0x36bf54,_0x4e6391){return _0x36bf54[_0x61c6('0x9')](_0x61c6('0xa'),attributes,{'tableName':_0x61c6('0xb'),'paranoid':![],'indexes':[{'name':_0x61c6('0xc'),'fields':['event',_0x61c6('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 b213f2b..fea64b5 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 _0xe493=['../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x667c6a,_0x2155cd){var _0x36396a=function(_0x29d602){while(--_0x29d602){_0x667c6a['push'](_0x667c6a['shift']());}};_0x36396a(++_0x2155cd);}(_0xe493,0x7e));var _0x3e49=function(_0x146e85,_0x4309a3){_0x146e85=_0x146e85-0x0;var _0x2de913=_0xe493[_0x146e85];return _0x2de913;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});} \ No newline at end of file +var _0xbee3=['error','code','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x3937f7,_0xdc51f){var _0x5327a8=function(_0x1cecdb){while(--_0x1cecdb){_0x3937f7['push'](_0x3937f7['shift']());}};_0x5327a8(++_0xdc51f);}(_0xbee3,0xd5));var _0x3bee=function(_0x32c37e,_0x36bbe2){_0x32c37e=_0x32c37e-0x0;var _0x5dffd5=_0xbee3[_0x32c37e];return _0x5dffd5;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 14aead8..1dab609 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 _0xcfac=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download'];(function(_0x1c1da2,_0x536524){var _0x23d8fd=function(_0x53ff29){while(--_0x53ff29){_0x1c1da2['push'](_0x1c1da2['shift']());}};_0x23d8fd(++_0x536524);}(_0xcfac,0x177));var _0xccfa=function(_0xa1e21d,_0xf93601){_0xa1e21d=_0xa1e21d-0x0;var _0x5455ea=_0xcfac[_0xa1e21d];return _0x5455ea;};'use strict';var multer=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var path=require(_0xccfa('0x2'));var timeout=require(_0xccfa('0x3'));var express=require(_0xccfa('0x4'));var router=express[_0xccfa('0x5')]();var auth=require(_0xccfa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccfa('0x7'));var controller=require(_0xccfa('0x8'));router[_0xccfa('0x9')]('/',auth['isAuthenticated'](),controller[_0xccfa('0xa')]);router[_0xccfa('0x9')](_0xccfa('0xb'),auth[_0xccfa('0xc')](),controller[_0xccfa('0xd')]);router[_0xccfa('0x9')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller['show']);router['get'](_0xccfa('0xf'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x10')]);router['get'](_0xccfa('0x11'),controller[_0xccfa('0x12')]);router[_0xccfa('0x9')](_0xccfa('0x13'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x14')]);router['post']('/',auth[_0xccfa('0xc')](),controller['create']);router[_0xccfa('0x15')]('/:id/transcribe',auth[_0xccfa('0xc')](),controller[_0xccfa('0x16')]);router[_0xccfa('0x17')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x18')]);router[_0xccfa('0x19')](_0xccfa('0xe'),auth[_0xccfa('0xc')](),controller[_0xccfa('0x1a')]);module[_0xccfa('0x1b')]=router; \ No newline at end of file +var _0x754e=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','download','/:id/downloads','downloadTranscribe','post','/:id/transcribe','runTranscribe','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57c77d,_0x46f365){var _0x3bf677=function(_0x410ad2){while(--_0x410ad2){_0x57c77d['push'](_0x57c77d['shift']());}};_0x3bf677(++_0x46f365);}(_0x754e,0x170));var _0xe754=function(_0x5cf9af,_0x304bca){_0x5cf9af=_0x5cf9af-0x0;var _0x229e21=_0x754e[_0x5cf9af];return _0x229e21;};'use strict';var multer=require('multer');var util=require(_0xe754('0x0'));var path=require(_0xe754('0x1'));var timeout=require(_0xe754('0x2'));var express=require(_0xe754('0x3'));var router=express[_0xe754('0x4')]();var auth=require(_0xe754('0x5'));var interaction=require(_0xe754('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xe754('0x7')]('/',auth[_0xe754('0x8')](),controller[_0xe754('0x9')]);router[_0xe754('0x7')](_0xe754('0xa'),auth[_0xe754('0x8')](),controller['describe']);router[_0xe754('0x7')](_0xe754('0xb'),auth[_0xe754('0x8')](),controller[_0xe754('0xc')]);router['get']('/:id/download',auth[_0xe754('0x8')](),controller[_0xe754('0xd')]);router[_0xe754('0x7')](_0xe754('0xe'),controller['downloads']);router[_0xe754('0x7')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xe754('0xf')]);router[_0xe754('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe754('0x10')](_0xe754('0x11'),auth[_0xe754('0x8')](),controller[_0xe754('0x12')]);router[_0xe754('0x13')](_0xe754('0xb'),auth[_0xe754('0x8')](),controller[_0xe754('0x14')]);router['delete'](_0xe754('0xb'),auth[_0xe754('0x8')](),controller['destroy']);module[_0xe754('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d85288e..51319b6 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 _0xe518=['toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','value','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','getDataValue','createdAt','format'];(function(_0x4ff72c,_0x2de6af){var _0x266738=function(_0x2e4157){while(--_0x2e4157){_0x4ff72c['push'](_0x4ff72c['shift']());}};_0x266738(++_0x2de6af);}(_0xe518,0xe7));var _0x8e51=function(_0x92bc78,_0x1cb7bd){_0x92bc78=_0x92bc78-0x0;var _0x11cca1=_0xe518[_0x92bc78];return _0x11cca1;};'use strict';var Sequelize=require(_0x8e51('0x0'));var moment=require(_0x8e51('0x1'));var path=require('path');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x8e51('0x2'))?path['extname'](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x8e51('0x3')]},'channel':{'type':Sequelize[_0x8e51('0x3')],'set':function(_0x3f94bc){if(_0x3f94bc){this[_0x8e51('0x4')](_0x8e51('0x5'),_0x3f94bc);this[_0x8e51('0x4')](_0x8e51('0x6'),_0x3f94bc['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x8e51('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8e51('0x3')]},'connectedlinenum':{'type':Sequelize[_0x8e51('0x3')]},'connectedlinename':{'type':Sequelize[_0x8e51('0x3')]},'accountcode':{'type':Sequelize[_0x8e51('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x8e51('0x3')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x8e51('0x7')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x8e51('0x3')]},'location':{'type':Sequelize[_0x8e51('0x8')]},'transcribeName':{'type':Sequelize[_0x8e51('0x3')]},'transcribeStatus':{'type':Sequelize[_0x8e51('0x3')],'defaultValue':_0x8e51('0x9')},'fileUri':{'type':Sequelize[_0x8e51('0x8')]},'fileText':{'type':Sequelize[_0x8e51('0x8')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0x8e51('0xa')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x8e51('0xa')]},'sMixed':{'type':Sequelize[_0x8e51('0xa')]},'tempSentiment':{'type':Sequelize[_0x8e51('0xb')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x8e51('0xc')],'get':function(){return moment(this[_0x8e51('0xd')](_0x8e51('0xe')))[_0x8e51('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x8e51('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8e51('0xd')](_0x8e51('0x11')))[_0x8e51('0xf')](_0x8e51('0x12'))['toString']();}}}; \ No newline at end of file +var _0xa794=['BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize','exports','value','extname','getDataValue','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xa794,0x1d3));var _0x4a79=function(_0x15db23,_0x38bc06){_0x15db23=_0x15db23-0x0;var _0x4ce327=_0xa794[_0x15db23];return _0x4ce327;};'use strict';var Sequelize=require(_0x4a79('0x0'));var moment=require('moment');var path=require('path');module[_0x4a79('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x4a79('0x2'))?path[_0x4a79('0x3')](this[_0x4a79('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4a79('0x5')],'set':function(_0x2b28ec){if(_0x2b28ec){this[_0x4a79('0x6')](_0x4a79('0x7'),_0x2b28ec);this[_0x4a79('0x6')](_0x4a79('0x8'),_0x2b28ec[_0x4a79('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x4a79('0x5')]},'calleridnum':{'type':Sequelize[_0x4a79('0x5')]},'calleridname':{'type':Sequelize[_0x4a79('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4a79('0x5')]},'accountcode':{'type':Sequelize[_0x4a79('0x5')]},'context':{'type':Sequelize[_0x4a79('0x5')]},'exten':{'type':Sequelize[_0x4a79('0x5')]},'value':{'type':Sequelize[_0x4a79('0x5')]},'type':{'type':Sequelize[_0x4a79('0x5')]},'rating':{'type':Sequelize[_0x4a79('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x4a79('0x5')]},'userDisposition':{'type':Sequelize[_0x4a79('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x4a79('0x5')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x4a79('0xb')]},'transcribeName':{'type':Sequelize[_0x4a79('0x5')]},'transcribeStatus':{'type':Sequelize[_0x4a79('0x5')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x4a79('0xb')]},'fileText':{'type':Sequelize[_0x4a79('0xb')]},'failureReason':{'type':Sequelize[_0x4a79('0xb')]},'sentiment':{'type':Sequelize[_0x4a79('0x5')]},'sPositive':{'type':Sequelize[_0x4a79('0xc')]},'sNegative':{'type':Sequelize[_0x4a79('0xc')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x4a79('0xc')]},'tempSentiment':{'type':Sequelize[_0x4a79('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x4a79('0xe')],'get':function(){return moment(this[_0x4a79('0x4')](_0x4a79('0xf')))['format'](_0x4a79('0x10'))[_0x4a79('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4a79('0xe')],'get':function(){return moment(this[_0x4a79('0x4')](_0x4a79('0x12')))[_0x4a79('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x4a79('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 189ae37..eac86e5 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 _0xc7ca=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','save','update','destroy','then','error','name','send','index','map','VoiceRecording','type','key','model','differenceBy','query','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','secrets','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ca,0x146));var _0xac7c=function(_0x10f8a7,_0x43bd3b){_0x10f8a7=_0x10f8a7-0x0;var _0xfc89a3=_0xc7ca[_0x10f8a7];return _0xfc89a3;};'use strict';var pdf=require(_0xac7c('0x0'));var emlformat=require(_0xac7c('0x1'));var rimraf=require(_0xac7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7c('0x3'));var rp=require(_0xac7c('0x4'));var moment=require(_0xac7c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xac7c('0x6'));var util=require(_0xac7c('0x7'));var path=require(_0xac7c('0x8'));var sox=require(_0xac7c('0x9'));var csv=require(_0xac7c('0xa'));var ejs=require(_0xac7c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac7c('0xc'));var crypto=require(_0xac7c('0xd'));var jsforce=require(_0xac7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac7c('0xa'));var querystring=require(_0xac7c('0xf'));var Papa=require('papaparse');var AWS=require(_0xac7c('0x10'));var uuidv4=require(_0xac7c('0x11'));var Redis=require(_0xac7c('0x12'));var authService=require(_0xac7c('0x13'));var qs=require(_0xac7c('0x14'));var as=require(_0xac7c('0x15'));var hardwareService=require(_0xac7c('0x16'));var logger=require(_0xac7c('0x17'))(_0xac7c('0x18'));var utils=require(_0xac7c('0x19'));var config=require(_0xac7c('0x1a'));var licenseUtil=require(_0xac7c('0x1b'));var db=require(_0xac7c('0x1c'))['db'];function respondWithStatusCode(_0xd0606b,_0x29d932){_0x29d932=_0x29d932||0xcc;return function(_0x41aece){if(_0x41aece){return _0xd0606b[_0xac7c('0x1d')](_0x29d932);}return _0xd0606b[_0xac7c('0x1e')](_0x29d932)[_0xac7c('0x1f')]();};}function respondWithResult(_0x29b7a8,_0x2ce879){_0x2ce879=_0x2ce879||0xc8;return function(_0x4b26c5){if(_0x4b26c5){return _0x29b7a8[_0xac7c('0x1e')](_0x2ce879)['json'](_0x4b26c5);}};}function respondWithFilteredResult(_0x5f3ee5,_0xd887b6){return function(_0x31a421){if(_0x31a421){var _0x180d2c=_0x31a421[_0xac7c('0x20')],_0x266bc8=_0xd887b6[_0xac7c('0x21')],_0x2dfa1e=_0xd887b6['offset']+_0xd887b6['limit'],_0x1f8b87;if(_0x2dfa1e>=_0x180d2c){_0x2dfa1e=_0x180d2c;_0x1f8b87=0xc8;}else{_0x1f8b87=0xce;}_0x5f3ee5[_0xac7c('0x1e')](_0x1f8b87);return _0x5f3ee5[_0xac7c('0x22')]('Content-Range',_0x266bc8+'-'+_0x2dfa1e+'/'+_0x180d2c)[_0xac7c('0x23')](_0x31a421);}return null;};}function patchUpdates(_0x222033){return function(_0xdfcf74){try{jsonpatch[_0xac7c('0x24')](_0xdfcf74,_0x222033,!![]);}catch(_0x3b902a){return BPromise['reject'](_0x3b902a);}return _0xdfcf74[_0xac7c('0x25')]();};}function saveUpdates(_0x4f0fbc,_0x10b5f7){return function(_0x40e07d){if(_0x40e07d){return _0x40e07d[_0xac7c('0x26')](_0x4f0fbc)['then'](function(_0x27f967){return _0x27f967;});}return null;};}function removeEntity(_0x19b2cb,_0x26d57c){return function(_0x3e340e){if(_0x3e340e){return _0x3e340e[_0xac7c('0x27')]()[_0xac7c('0x28')](function(){_0x19b2cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a5a9,_0x1ecede){return function(_0x5d9390){if(!_0x5d9390){_0x48a5a9['sendStatus'](0x194);}return _0x5d9390;};}function handleError(_0xc4db79,_0x439384){_0x439384=_0x439384||0x1f4;return function(_0x270345){logger[_0xac7c('0x29')](_0x270345['stack']);if(_0x270345[_0xac7c('0x2a')]){delete _0x270345['name'];}_0xc4db79[_0xac7c('0x1e')](_0x439384)[_0xac7c('0x2b')](_0x270345);};}exports[_0xac7c('0x2c')]=function(_0x18a93d,_0xb5f883){var _0x47a947={},_0x38f973={},_0x527cce={'count':0x0,'rows':[]};var _0x5f531c=_[_0xac7c('0x2d')](db[_0xac7c('0x2e')]['rawAttributes'],function(_0x45dbaf){return{'name':_0x45dbaf['fieldName'],'type':_0x45dbaf[_0xac7c('0x2f')][_0xac7c('0x30')]};});_0x38f973[_0xac7c('0x31')]=_[_0xac7c('0x32')](_[_0xac7c('0x2d')](_0x5f531c,_0xac7c('0x2a')),['format']);_0x38f973[_0xac7c('0x33')]=_['keys'](_0x18a93d[_0xac7c('0x33')]);_0x38f973[_0xac7c('0x34')]=_['intersection'](_0x38f973['model'],_0x38f973['query']);_0x47a947[_0xac7c('0x35')]=_['intersection'](_0x38f973['model'],qs[_0xac7c('0x36')](_0x18a93d[_0xac7c('0x33')]['fields']));_0x47a947[_0xac7c('0x35')]=_0x47a947[_0xac7c('0x35')]['length']?_0x47a947[_0xac7c('0x35')]:_0x38f973[_0xac7c('0x31')];if(!_0x18a93d[_0xac7c('0x33')][_0xac7c('0x37')]('nolimit')){_0x47a947[_0xac7c('0x38')]=qs[_0xac7c('0x38')](_0x18a93d['query'][_0xac7c('0x38')]);_0x47a947[_0xac7c('0x21')]=qs[_0xac7c('0x21')](_0x18a93d['query'][_0xac7c('0x21')]);}_0x47a947[_0xac7c('0x39')]=qs[_0xac7c('0x3a')](_0x18a93d[_0xac7c('0x33')][_0xac7c('0x3a')]);_0x47a947[_0xac7c('0x3b')]=qs[_0xac7c('0x34')](_[_0xac7c('0x3c')](_0x18a93d['query'],_0x38f973[_0xac7c('0x34')]),_0x5f531c);if(_0x18a93d[_0xac7c('0x33')][_0xac7c('0x3d')]){_0x47a947[_0xac7c('0x3b')]=_['merge'](_0x47a947[_0xac7c('0x3b')],{'$or':_[_0xac7c('0x2d')](_0x5f531c,function(_0x5dcf15){if(_0x5dcf15[_0xac7c('0x2f')]!==_0xac7c('0x3e')){var _0x5af943={};_0x5af943[_0x5dcf15['name']]={'$like':'%'+_0x18a93d['query']['filter']+'%'};return _0x5af943;}})});}_0x47a947=_[_0xac7c('0x3f')]({},_0x47a947,_0x18a93d[_0xac7c('0x40')]);var _0x5d06c3={'where':_0x47a947[_0xac7c('0x3b')]};return db[_0xac7c('0x2e')][_0xac7c('0x20')](_0x5d06c3)[_0xac7c('0x28')](function(_0x4eca1d){_0x527cce[_0xac7c('0x20')]=_0x4eca1d;if(_0x18a93d[_0xac7c('0x33')][_0xac7c('0x41')]){_0x47a947[_0xac7c('0x42')]=[{'all':!![]}];}return db[_0xac7c('0x2e')][_0xac7c('0x43')](_0x47a947);})[_0xac7c('0x28')](function(_0xad3669){_0x527cce[_0xac7c('0x44')]=_0xad3669;return _0x527cce;})[_0xac7c('0x28')](respondWithFilteredResult(_0xb5f883,_0x47a947))[_0xac7c('0x45')](handleError(_0xb5f883,null));};exports[_0xac7c('0x46')]=function(_0x3352a6,_0x366533){var _0x991a28={'raw':![],'where':{'id':_0x3352a6[_0xac7c('0x47')]['id']}},_0xb35644={};_0xb35644[_0xac7c('0x31')]=_[_0xac7c('0x48')](db[_0xac7c('0x2e')][_0xac7c('0x49')]);_0xb35644[_0xac7c('0x33')]=_[_0xac7c('0x48')](_0x3352a6[_0xac7c('0x33')]);_0xb35644['filters']=_[_0xac7c('0x4a')](_0xb35644[_0xac7c('0x31')],_0xb35644[_0xac7c('0x33')]);_0x991a28[_0xac7c('0x35')]=_[_0xac7c('0x4a')](_0xb35644[_0xac7c('0x31')],qs[_0xac7c('0x36')](_0x3352a6[_0xac7c('0x33')][_0xac7c('0x36')]));_0x991a28['attributes']=_0x991a28[_0xac7c('0x35')][_0xac7c('0x4b')]?_0x991a28[_0xac7c('0x35')]:_0xb35644['model'];if(_0x3352a6[_0xac7c('0x33')][_0xac7c('0x41')]){_0x991a28[_0xac7c('0x42')]=[{'all':!![]}];}_0x991a28=_[_0xac7c('0x3f')]({},_0x991a28,_0x3352a6[_0xac7c('0x40')]);return db[_0xac7c('0x2e')][_0xac7c('0x4c')](_0x991a28)[_0xac7c('0x28')](handleEntityNotFound(_0x366533,null))['then'](respondWithResult(_0x366533,null))[_0xac7c('0x45')](handleError(_0x366533,null));};exports[_0xac7c('0x4d')]=function(_0xf1af7d,_0x5e7686){return db[_0xac7c('0x2e')][_0xac7c('0x4d')](_0xf1af7d[_0xac7c('0x4e')],{})[_0xac7c('0x28')](respondWithResult(_0x5e7686,0xc9))[_0xac7c('0x45')](handleError(_0x5e7686,null));};exports[_0xac7c('0x26')]=function(_0x3f77a1,_0x57b2e5){if(_0x3f77a1[_0xac7c('0x4e')]['id']){delete _0x3f77a1['body']['id'];}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':{'id':_0x3f77a1[_0xac7c('0x47')]['id']}})[_0xac7c('0x28')](handleEntityNotFound(_0x57b2e5,null))['then'](saveUpdates(_0x3f77a1[_0xac7c('0x4e')],null))['then'](respondWithResult(_0x57b2e5,null))[_0xac7c('0x45')](handleError(_0x57b2e5,null));};exports['describe']=function(_0x29cc29,_0x584e4d){return db['VoiceRecording'][_0xac7c('0x4f')]()[_0xac7c('0x28')](respondWithResult(_0x584e4d,null))['catch'](handleError(_0x584e4d,null));};exports[_0xac7c('0x50')]=function(_0x2b3cba,_0x54473c,_0x13102b){var _0x1d06fe=require(_0xac7c('0x51'));var _0x3f7a39=![];var _0x5afe4b={};if(_0x2b3cba['query'][_0xac7c('0x2f')]&&_0x2b3cba[_0xac7c('0x33')][_0xac7c('0x2f')]===_0xac7c('0x52')){_0x5afe4b[_0xac7c('0x52')]=_0x2b3cba[_0xac7c('0x47')]['id'];}else{_0x5afe4b['id']=_0x2b3cba[_0xac7c('0x47')]['id'];}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':_0x5afe4b,'attributes':['id',_0xac7c('0x53')],'raw':!![]})[_0xac7c('0x28')](handleEntityNotFound(_0x54473c,null))[_0xac7c('0x28')](function(_0x5cc751){if(_0x5cc751){var _0x5154c4=_0x5cc751[_0xac7c('0x53')];var _0x38747e=util[_0xac7c('0x54')]('%s.cypher',_0x5154c4);if(fs[_0xac7c('0x55')](_0x38747e)){_0x3f7a39=!![];return _0x1d06fe['decryptFile'](_0x38747e,_0x5154c4,config['secrets'][_0xac7c('0x56')])[_0xac7c('0x28')](function(){return _0x5cc751;});}return _0x5cc751;}})[_0xac7c('0x28')](function(_0xcd7820){if(_0xcd7820){var _0xa7dfe0=_0xcd7820[_0xac7c('0x53')];if(!fs[_0xac7c('0x55')](_0xa7dfe0)){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x59'));}if(_0xcd7820[_0xac7c('0x5a')]){return _0x54473c[_0xac7c('0x50')](_0xa7dfe0,_0xcd7820[_0xac7c('0x5a')]+path[_0xac7c('0x5b')](_0xa7dfe0),function(){if(_0x3f7a39){fs[_0xac7c('0x5c')](_0xa7dfe0);}});}else{return _0x54473c[_0xac7c('0x50')](_0xa7dfe0,function(_0x2d862a){if(_0x3f7a39){fs[_0xac7c('0x5c')](_0xa7dfe0);}});}}})[_0xac7c('0x45')](function(_0x39aecd){if(_0x39aecd[_0xac7c('0x5d')]===_0xac7c('0x59')){_0x54473c['status'](0x194)[_0xac7c('0x2b')](_0xac7c('0x5e'));}else{return handleError(_0x54473c,null);}});};exports[_0xac7c('0x5f')]=function(_0x49ffbe,_0xbf6cc6,_0x341f9d){var _0x8ee7ba=require(_0xac7c('0x51'));var _0x2996f3=![];var _0x41a421={'$and':[db[_0xac7c('0x60')][_0xac7c('0x3b')](db[_0xac7c('0x60')]['fn'](_0xac7c('0x61'),db[_0xac7c('0x60')][_0xac7c('0x62')](_0xac7c('0x52'))),_0x49ffbe[_0xac7c('0x33')][_0xac7c('0x63')])]};if(_0x49ffbe[_0xac7c('0x33')][_0xac7c('0x2f')]&&_0x49ffbe['query'][_0xac7c('0x2f')]===_0xac7c('0x52')){_0x41a421[_0xac7c('0x64')][_0xac7c('0x65')]({'uniqueid':_0x49ffbe[_0xac7c('0x47')]['id']});}else{_0x41a421[_0xac7c('0x64')][_0xac7c('0x65')]({'id':_0x49ffbe[_0xac7c('0x47')]['id']});}return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':_0x41a421,'attributes':['id','value'],'raw':!![]})[_0xac7c('0x28')](handleEntityNotFound(_0xbf6cc6,null))[_0xac7c('0x28')](function(_0x4f6282){if(_0x4f6282){var _0x2abc6a=util[_0xac7c('0x54')](_0xac7c('0x66'),_0x4f6282[_0xac7c('0x53')]);if(fs['existsSync'](_0x2abc6a)){_0x2996f3=!![];return _0x8ee7ba[_0xac7c('0x67')](_0x2abc6a,_0x4f6282['value'],config[_0xac7c('0x68')][_0xac7c('0x56')])[_0xac7c('0x28')](function(){return _0x4f6282;});}return _0x4f6282;}})['then'](function(_0x39046e){if(_0x39046e){if(!fs[_0xac7c('0x55')](_0x39046e[_0xac7c('0x53')])){throw new db['Sequelize'][(_0xac7c('0x58'))](_0xac7c('0x59'));}if(_0x39046e[_0xac7c('0x5a')]){return _0xbf6cc6[_0xac7c('0x50')](_0x39046e[_0xac7c('0x53')],_0x39046e[_0xac7c('0x5a')]+path['extname'](_0x39046e[_0xac7c('0x53')]),function(){if(_0x2996f3){fs['unlink'](_0x39046e['value']);}});}else{return _0xbf6cc6[_0xac7c('0x50')](_0x39046e['value'],function(_0x2c3c62){if(_0x2996f3){fs['unlink'](_0x39046e[_0xac7c('0x53')]);}});}}})['catch'](handleError(_0xbf6cc6,null));};exports['destroy']=function(_0x50c260,_0x14e09d){return db[_0xac7c('0x2e')][_0xac7c('0x4c')]({'where':{'id':_0x50c260['params']['id']}})[_0xac7c('0x28')](function(_0x256faf){if(!_0x256faf)throw new ReferenceError(_0xac7c('0x69'));return _0x256faf;})['then'](function(_0x25159c){var _0x1f4f2e=_0x25159c[_0xac7c('0x53')];logger[_0xac7c('0x6a')](_0xac7c('0x6b'),_0x1f4f2e);if(!_[_0xac7c('0x6c')](_0x25159c[_0xac7c('0x53')])&&fs[_0xac7c('0x55')](_0x1f4f2e)){logger[_0xac7c('0x6a')](_0xac7c('0x6d')+_0x1f4f2e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xac7c('0x6e')](_0x1f4f2e);}_0x1f4f2e=_0x1f4f2e+'.cypher';if(!_[_0xac7c('0x6c')](_0x25159c[_0xac7c('0x53')])&&fs[_0xac7c('0x55')](_0x1f4f2e)){logger[_0xac7c('0x6a')](_0xac7c('0x6d')+_0x1f4f2e+_0xac7c('0x6f'));fs[_0xac7c('0x6e')](_0x1f4f2e);}return _0x25159c;})[_0xac7c('0x28')](function(_0x270efc){if(!_0x270efc)throw new InternalError();return _0x270efc[_0xac7c('0x27')]();})[_0xac7c('0x28')](function(){_0x14e09d[_0xac7c('0x1e')](0xcc)[_0xac7c('0x1f')]();})[_0xac7c('0x45')](handleError(_0x14e09d,null));};function getBucketslist(_0x5e2963,_0x525b36,_0x37ec62){return new Promise(function(_0x20cf71,_0x422d83){var _0x3fa8be=new AWS['S3']({'accessKeyId':_0x525b36,'secretAccessKey':_0x5e2963,'region':_0x37ec62});_0x3fa8be[_0xac7c('0x70')]({},function(_0x45575c,_0x2b1dc5){if(_0x45575c){return _0x422d83(_0x45575c);}else{return _0x20cf71(_0x2b1dc5);}});});}function createBucket(_0x20fb8d,_0x56b23c,_0x2244ff,_0x2f10c8){return new Promise(function(_0x19cbfc,_0x20e7d7){var _0x12b106=new AWS['S3']({'accessKeyId':_0x56b23c,'secretAccessKey':_0x20fb8d,'region':_0x2244ff});_0x12b106[_0xac7c('0x71')]({'Bucket':_0x2f10c8},function(_0x57150e,_0x246697){if(_0x57150e){return _0x20e7d7(_0x57150e);}else{return _0x19cbfc(_0x246697);}});});}function uploadFile(_0x48cdce,_0x1d096a,_0x3a7397,_0x2937de,_0x1c7302,_0x4bba34){return new Promise(function(_0x42bed3,_0x596a9b){var _0x2641ef=new AWS['S3']({'accessKeyId':_0x1d096a,'secretAccessKey':_0x48cdce,'region':_0x3a7397});_0x2641ef['upload']({'Bucket':_0x2937de,'Key':_0x1c7302,'Body':_0x4bba34},function(_0x17646d,_0x2b05fa){if(_0x17646d){return _0x596a9b(_0x17646d);}else{return _0x42bed3(_0x2b05fa);}});});}function startTranscribe(_0x4273d4,_0x562105,_0x1e389d,_0x4832e2,_0x3dfc60,_0x23ec97){return new Promise(function(_0x3e9170,_0x3156dd){var _0x3be965=new AWS[(_0xac7c('0x72'))]({'accessKeyId':_0x562105,'secretAccessKey':_0x4273d4,'region':_0x1e389d});_0x3be965[_0xac7c('0x73')]({'TranscriptionJobName':_0x4832e2,'LanguageCode':_0x3dfc60,'Media':{'MediaFileUri':_0x23ec97}},function(_0x13c8ea,_0x49131d){if(_0x13c8ea){return _0x3156dd(_0x13c8ea);}else{return _0x3e9170(_0x49131d);}});});}function transcribe(_0xd92670,_0x352487,_0xeadd23,_0x5a7af5,_0x2e6484,_0x5c238d,_0x4bade4){return new Promise(function(_0x53bc05,_0x4155a6){var _0x14daf0={};logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x74'),_0xd92670,_0x2e6484));return uploadFile(_0x352487,_0xeadd23,_0x5a7af5,_0x2e6484,path[_0xac7c('0x75')](_0x5c238d),fs[_0xac7c('0x76')](_0x5c238d))[_0xac7c('0x28')](function(_0x2f6ab7){logger[_0xac7c('0x6a')](util[_0xac7c('0x54')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xd92670,_0x2e6484,_0x2f6ab7[_0xac7c('0x77')]));_0x14daf0[_0xac7c('0x78')]=_0x2f6ab7[_0xac7c('0x79')];_0x14daf0['location']=_0x2f6ab7[_0xac7c('0x77')];logger['info'](util[_0xac7c('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xd92670));return startTranscribe(_0x352487,_0xeadd23,_0x5a7af5,uuidv4(),_0x4bade4,_0x2f6ab7['Location']);})[_0xac7c('0x28')](function(_0x5329a4){logger[_0xac7c('0x6a')](util['format'](_0xac7c('0x7a'),_0xd92670,_0x5329a4['TranscriptionJob'][_0xac7c('0x7b')]));_0x14daf0[_0xac7c('0x7c')]=_0x5329a4['TranscriptionJob'][_0xac7c('0x7b')];_0x14daf0[_0xac7c('0x7d')]=_0x5329a4[_0xac7c('0x7e')][_0xac7c('0x7f')];return _0x53bc05(_0x14daf0);})[_0xac7c('0x45')](function(_0xde831e){return _0x4155a6(_0xde831e);});});}exports[_0xac7c('0x80')]=function(_0x89a63,_0x549926,_0x4c29f1){var _0x1dc6ae;var _0x1aa6cc;var _0x10ab20;var _0x3a7dbc=require('../../components/encryptor');return db['VoiceRecording'][_0xac7c('0x81')]({'where':{'id':_0x89a63[_0xac7c('0x47')]['id']}})['then'](function(_0xa47051){if(_0xa47051){var _0x4fb718=util['format'](_0xac7c('0x66'),_0xa47051[_0xac7c('0x53')]);if(fs[_0xac7c('0x55')](_0x4fb718)){cypher=!![];return _0x3a7dbc[_0xac7c('0x67')](_0x4fb718,_0xa47051[_0xac7c('0x53')],config[_0xac7c('0x68')]['recording'])[_0xac7c('0x28')](function(){return _0xa47051;});}return _0xa47051;}})[_0xac7c('0x28')](function(_0x3698fd){if(!_0x3698fd){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x1aa6cc=_0x3698fd;return db[_0xac7c('0x82')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x549926,null))[_0xac7c('0x28')](function(_0x580c08){if(_0x580c08){_0x1dc6ae=_0x580c08;if(!_0x1dc6ae[_0xac7c('0x83')]||!_0x1dc6ae[_0xac7c('0x84')]||!_0x1dc6ae[_0xac7c('0x85')]||!_0x1dc6ae[_0xac7c('0x86')]||!_0x1dc6ae['bucket']){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x87'));}if(_0x89a63[_0xac7c('0x4e')][_0xac7c('0x88')]&&(!_0x1dc6ae['sentiment']||!_0x1dc6ae['sentimentAccountId']||!_0x1dc6ae[_0xac7c('0x89')]||!_0x1dc6ae[_0xac7c('0x86')]||!_0x1dc6ae[_0xac7c('0x78')])){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xac7c('0x81')]({'where':{'id':_0x1dc6ae[_0xac7c('0x84')]}});}})['then'](function(_0x34fd22){if(!_0x34fd22){throw new db['Sequelize'][(_0xac7c('0x58'))](_0xac7c('0x8a'));}if(!_0x34fd22[_0xac7c('0x8b')]||!_0x34fd22[_0xac7c('0x8c')]){throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x8d'));}_0x10ab20=_0x34fd22;return getBucketslist(_0x10ab20[_0xac7c('0x8b')],_0x10ab20[_0xac7c('0x8c')],_0x1dc6ae['transcribeRegion']);})[_0xac7c('0x28')](function(_0x4aebb0){if(_0x4aebb0&&_0x4aebb0[_0xac7c('0x8e')]){var _0x3011b8=_[_0xac7c('0x4c')](_0x4aebb0[_0xac7c('0x8e')],function(_0x73563f){return _0x73563f[_0xac7c('0x8f')]===_0x1dc6ae[_0xac7c('0x78')];});if(!_0x3011b8){logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x90'),_0x89a63[_0xac7c('0x47')]['id'],_0x1dc6ae[_0xac7c('0x78')]));return createBucket(_0x10ab20[_0xac7c('0x8b')],_0x10ab20[_0xac7c('0x8c')],_0x1dc6ae['transcribeRegion'],_0x1dc6ae['bucket']);}logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x91'),_0x89a63[_0xac7c('0x47')]['id'],_0x1dc6ae[_0xac7c('0x78')]));return;}})[_0xac7c('0x28')](function(_0x2525ce){if(_0x1aa6cc['transcribeStatus']===_0xac7c('0x92')){return transcribe(_0x89a63[_0xac7c('0x47')]['id'],_0x10ab20[_0xac7c('0x8b')],_0x10ab20['data2'],_0x1dc6ae['transcribeRegion'],_0x1dc6ae['bucket'],_0x1aa6cc[_0xac7c('0x53')],_0x1dc6ae[_0xac7c('0x86')]);}else{logger[_0xac7c('0x6a')](util[_0xac7c('0x54')](_0xac7c('0x93'),_0x89a63[_0xac7c('0x47')]['id']));return{'transcribeStatus':_0xac7c('0x94')};}})[_0xac7c('0x28')](function(_0x55aa6c){if(_0x55aa6c){_0x55aa6c[_0xac7c('0x95')]=_0x89a63['body'][_0xac7c('0x88')];return _0x1aa6cc[_0xac7c('0x96')](_0x55aa6c);}})[_0xac7c('0x28')](respondWithResult(_0x549926,null))[_0xac7c('0x45')](handleError(_0x549926,null));};function writeFile(_0x1e1e4e,_0x438b17){return new Promise(function(_0x2b9546,_0x24c97b){fs[_0xac7c('0x97')](_0x438b17,_0x1e1e4e,function(_0x18305b,_0x8369f3){if(_0x18305b){return _0x24c97b(_0x18305b);}else{return _0x2b9546(_0x8369f3);}});});}exports[_0xac7c('0x98')]=function(_0xb376fe,_0x2e3f89,_0xefad09){return db[_0xac7c('0x2e')][_0xac7c('0x81')]({'where':{'id':_0xb376fe[_0xac7c('0x47')]['id']}})[_0xac7c('0x28')](handleEntityNotFound(_0x2e3f89))[_0xac7c('0x28')](function(_0x2529a7){if(_0x2529a7&&_0x2529a7[_0xac7c('0x99')]){var _0x52837b=_0x2529a7['fileText'];var _0xc24088=config[_0xac7c('0x9a')]+_0xac7c('0x9b')+_0x2529a7['id']+'.txt';if(fs[_0xac7c('0x55')](_0xc24088)){return _0xc24088;}return writeFile(_0x52837b,_0xc24088)['then'](function(){return _0xc24088;});}else{throw new db[(_0xac7c('0x57'))][(_0xac7c('0x58'))](_0xac7c('0x9c'));}})[_0xac7c('0x28')](function(_0x34549b){return _0x2e3f89[_0xac7c('0x50')](_0x34549b);})[_0xac7c('0x45')](handleError(_0x2e3f89));}; \ No newline at end of file +var _0xddd6=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','differenceBy','map','format','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','VoiceRecording','rows','catch','params','length','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','token','$and','push','Sequelize','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x28df03,_0x4428a3){var _0x66ea03=function(_0x32d567){while(--_0x32d567){_0x28df03['push'](_0x28df03['shift']());}};_0x66ea03(++_0x4428a3);}(_0xddd6,0x84));var _0x6ddd=function(_0xd6acc4,_0x29a17c){_0xd6acc4=_0xd6acc4-0x0;var _0x52ed4a=_0xddd6[_0xd6acc4];return _0x52ed4a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ddd('0x0'));var rp=require('request-promise');var moment=require(_0x6ddd('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ddd('0x2'));var path=require(_0x6ddd('0x3'));var sox=require('sox');var csv=require(_0x6ddd('0x4'));var ejs=require(_0x6ddd('0x5'));var fs=require('fs');var _=require(_0x6ddd('0x6'));var squel=require(_0x6ddd('0x7'));var crypto=require(_0x6ddd('0x8'));var jsforce=require(_0x6ddd('0x9'));var deskjs=require(_0x6ddd('0xa'));var toCsv=require(_0x6ddd('0x4'));var querystring=require(_0x6ddd('0xb'));var Papa=require(_0x6ddd('0xc'));var AWS=require(_0x6ddd('0xd'));var uuidv4=require(_0x6ddd('0xe'));var Redis=require(_0x6ddd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6ddd('0x10'));var as=require(_0x6ddd('0x11'));var hardwareService=require(_0x6ddd('0x12'));var logger=require(_0x6ddd('0x13'))(_0x6ddd('0x14'));var utils=require(_0x6ddd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab7528,_0x51a1f8){_0x51a1f8=_0x51a1f8||0xcc;return function(_0x2ddd04){if(_0x2ddd04){return _0xab7528[_0x6ddd('0x16')](_0x51a1f8);}return _0xab7528[_0x6ddd('0x17')](_0x51a1f8)['end']();};}function respondWithResult(_0x5a7f0c,_0x5d5124){_0x5d5124=_0x5d5124||0xc8;return function(_0x425a01){if(_0x425a01){return _0x5a7f0c[_0x6ddd('0x17')](_0x5d5124)[_0x6ddd('0x18')](_0x425a01);}};}function respondWithFilteredResult(_0x4663fe,_0x2b5a15){return function(_0x34caf9){if(_0x34caf9){var _0xf85329=_0x34caf9[_0x6ddd('0x19')],_0x419127=_0x2b5a15['offset'],_0x2b90cc=_0x2b5a15['offset']+_0x2b5a15[_0x6ddd('0x1a')],_0x17479a;if(_0x2b90cc>=_0xf85329){_0x2b90cc=_0xf85329;_0x17479a=0xc8;}else{_0x17479a=0xce;}_0x4663fe[_0x6ddd('0x17')](_0x17479a);return _0x4663fe['set'](_0x6ddd('0x1b'),_0x419127+'-'+_0x2b90cc+'/'+_0xf85329)['json'](_0x34caf9);}return null;};}function patchUpdates(_0x463e52){return function(_0x55dfc5){try{jsonpatch[_0x6ddd('0x1c')](_0x55dfc5,_0x463e52,!![]);}catch(_0x1d09d9){return BPromise[_0x6ddd('0x1d')](_0x1d09d9);}return _0x55dfc5[_0x6ddd('0x1e')]();};}function saveUpdates(_0x111783,_0x82f4bf){return function(_0x53ae8f){if(_0x53ae8f){return _0x53ae8f[_0x6ddd('0x1f')](_0x111783)[_0x6ddd('0x20')](function(_0x39a0c0){return _0x39a0c0;});}return null;};}function removeEntity(_0x476a8c,_0x27144e){return function(_0x593c21){if(_0x593c21){return _0x593c21[_0x6ddd('0x21')]()[_0x6ddd('0x20')](function(){_0x476a8c[_0x6ddd('0x17')](0xcc)[_0x6ddd('0x22')]();});}};}function handleEntityNotFound(_0xb647af,_0x5c7c71){return function(_0x3d86a0){if(!_0x3d86a0){_0xb647af[_0x6ddd('0x16')](0x194);}return _0x3d86a0;};}function handleError(_0x14ddd1,_0x14dbe1){_0x14dbe1=_0x14dbe1||0x1f4;return function(_0x18e959){logger[_0x6ddd('0x23')](_0x18e959[_0x6ddd('0x24')]);if(_0x18e959['name']){delete _0x18e959[_0x6ddd('0x25')];}_0x14ddd1[_0x6ddd('0x17')](_0x14dbe1)[_0x6ddd('0x26')](_0x18e959);};}exports[_0x6ddd('0x27')]=function(_0x1300a7,_0x7045a0){var _0x2f6c38={},_0x5c6ea9={},_0x474149={'count':0x0,'rows':[]};var _0x3d6926=_['map'](db['VoiceRecording'][_0x6ddd('0x28')],function(_0x123e17){return{'name':_0x123e17[_0x6ddd('0x29')],'type':_0x123e17[_0x6ddd('0x2a')][_0x6ddd('0x2b')]};});_0x5c6ea9['model']=_[_0x6ddd('0x2c')](_[_0x6ddd('0x2d')](_0x3d6926,_0x6ddd('0x25')),[_0x6ddd('0x2e')]);_0x5c6ea9[_0x6ddd('0x2f')]=_[_0x6ddd('0x30')](_0x1300a7[_0x6ddd('0x2f')]);_0x5c6ea9['filters']=_[_0x6ddd('0x31')](_0x5c6ea9[_0x6ddd('0x32')],_0x5c6ea9[_0x6ddd('0x2f')]);_0x2f6c38['attributes']=_[_0x6ddd('0x31')](_0x5c6ea9[_0x6ddd('0x32')],qs[_0x6ddd('0x33')](_0x1300a7['query'][_0x6ddd('0x33')]));_0x2f6c38[_0x6ddd('0x34')]=_0x2f6c38[_0x6ddd('0x34')]['length']?_0x2f6c38['attributes']:_0x5c6ea9[_0x6ddd('0x32')];if(!_0x1300a7['query'][_0x6ddd('0x35')](_0x6ddd('0x36'))){_0x2f6c38[_0x6ddd('0x1a')]=qs[_0x6ddd('0x1a')](_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x1a')]);_0x2f6c38[_0x6ddd('0x37')]=qs[_0x6ddd('0x37')](_0x1300a7['query'][_0x6ddd('0x37')]);}_0x2f6c38[_0x6ddd('0x38')]=qs[_0x6ddd('0x39')](_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x39')]);_0x2f6c38['where']=qs[_0x6ddd('0x3a')](_[_0x6ddd('0x3b')](_0x1300a7[_0x6ddd('0x2f')],_0x5c6ea9[_0x6ddd('0x3a')]),_0x3d6926);if(_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x3c')]){_0x2f6c38[_0x6ddd('0x3d')]=_['merge'](_0x2f6c38[_0x6ddd('0x3d')],{'$or':_['map'](_0x3d6926,function(_0x3c72dc){if(_0x3c72dc['type']!==_0x6ddd('0x3e')){var _0x1c8beb={};_0x1c8beb[_0x3c72dc[_0x6ddd('0x25')]]={'$like':'%'+_0x1300a7[_0x6ddd('0x2f')]['filter']+'%'};return _0x1c8beb;}})});}_0x2f6c38=_[_0x6ddd('0x3f')]({},_0x2f6c38,_0x1300a7[_0x6ddd('0x40')]);var _0x44ebf5={'where':_0x2f6c38[_0x6ddd('0x3d')]};return db[_0x6ddd('0x41')]['count'](_0x44ebf5)[_0x6ddd('0x20')](function(_0xe4416f){_0x474149[_0x6ddd('0x19')]=_0xe4416f;if(_0x1300a7[_0x6ddd('0x2f')]['includeAll']){_0x2f6c38['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x2f6c38);})['then'](function(_0x5bd260){_0x474149[_0x6ddd('0x42')]=_0x5bd260;return _0x474149;})[_0x6ddd('0x20')](respondWithFilteredResult(_0x7045a0,_0x2f6c38))[_0x6ddd('0x43')](handleError(_0x7045a0,null));};exports['show']=function(_0x317676,_0xd8bb9b){var _0x3e08b8={'raw':![],'where':{'id':_0x317676[_0x6ddd('0x44')]['id']}},_0x3a1723={};_0x3a1723[_0x6ddd('0x32')]=_['keys'](db[_0x6ddd('0x41')]['rawAttributes']);_0x3a1723[_0x6ddd('0x2f')]=_[_0x6ddd('0x30')](_0x317676['query']);_0x3a1723[_0x6ddd('0x3a')]=_[_0x6ddd('0x31')](_0x3a1723[_0x6ddd('0x32')],_0x3a1723['query']);_0x3e08b8[_0x6ddd('0x34')]=_[_0x6ddd('0x31')](_0x3a1723[_0x6ddd('0x32')],qs[_0x6ddd('0x33')](_0x317676[_0x6ddd('0x2f')][_0x6ddd('0x33')]));_0x3e08b8['attributes']=_0x3e08b8['attributes'][_0x6ddd('0x45')]?_0x3e08b8[_0x6ddd('0x34')]:_0x3a1723['model'];if(_0x317676[_0x6ddd('0x2f')][_0x6ddd('0x46')]){_0x3e08b8[_0x6ddd('0x47')]=[{'all':!![]}];}_0x3e08b8=_[_0x6ddd('0x3f')]({},_0x3e08b8,_0x317676[_0x6ddd('0x40')]);return db[_0x6ddd('0x41')][_0x6ddd('0x48')](_0x3e08b8)[_0x6ddd('0x20')](handleEntityNotFound(_0xd8bb9b,null))[_0x6ddd('0x20')](respondWithResult(_0xd8bb9b,null))['catch'](handleError(_0xd8bb9b,null));};exports[_0x6ddd('0x49')]=function(_0x12152a,_0x34bba7){return db['VoiceRecording'][_0x6ddd('0x49')](_0x12152a[_0x6ddd('0x4a')],{})[_0x6ddd('0x20')](respondWithResult(_0x34bba7,0xc9))[_0x6ddd('0x43')](handleError(_0x34bba7,null));};exports[_0x6ddd('0x1f')]=function(_0xc2e3c4,_0xda59fb){if(_0xc2e3c4[_0x6ddd('0x4a')]['id']){delete _0xc2e3c4[_0x6ddd('0x4a')]['id'];}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':{'id':_0xc2e3c4[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](handleEntityNotFound(_0xda59fb,null))['then'](saveUpdates(_0xc2e3c4[_0x6ddd('0x4a')],null))[_0x6ddd('0x20')](respondWithResult(_0xda59fb,null))[_0x6ddd('0x43')](handleError(_0xda59fb,null));};exports[_0x6ddd('0x4b')]=function(_0x47c508,_0x27d5b9){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0x27d5b9,null))[_0x6ddd('0x43')](handleError(_0x27d5b9,null));};exports[_0x6ddd('0x4c')]=function(_0x4342a3,_0x24bc12,_0x2756cf){var _0x2c7b4d=require(_0x6ddd('0x4d'));var _0x54db99=![];var _0x2a83aa={};if(_0x4342a3[_0x6ddd('0x2f')][_0x6ddd('0x2a')]&&_0x4342a3[_0x6ddd('0x2f')]['type']===_0x6ddd('0x4e')){_0x2a83aa['uniqueid']=_0x4342a3[_0x6ddd('0x44')]['id'];}else{_0x2a83aa['id']=_0x4342a3[_0x6ddd('0x44')]['id'];}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':_0x2a83aa,'attributes':['id',_0x6ddd('0x4f')],'raw':!![]})[_0x6ddd('0x20')](handleEntityNotFound(_0x24bc12,null))['then'](function(_0x50f01d){if(_0x50f01d){var _0x3910da=_0x50f01d[_0x6ddd('0x4f')];var _0x2f732c=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x3910da);if(fs[_0x6ddd('0x51')](_0x2f732c)){_0x54db99=!![];return _0x2c7b4d[_0x6ddd('0x52')](_0x2f732c,_0x3910da,config[_0x6ddd('0x53')][_0x6ddd('0x54')])[_0x6ddd('0x20')](function(){return _0x50f01d;});}return _0x50f01d;}})[_0x6ddd('0x20')](function(_0x228438){if(_0x228438){var _0x471fa3=_0x228438[_0x6ddd('0x4f')];if(!fs['existsSync'](_0x471fa3)){throw new db['Sequelize']['ValidationError'](_0x6ddd('0x55'));}if(_0x228438[_0x6ddd('0x56')]){return _0x24bc12[_0x6ddd('0x4c')](_0x471fa3,_0x228438[_0x6ddd('0x56')]+path[_0x6ddd('0x57')](_0x471fa3),function(){if(_0x54db99){fs[_0x6ddd('0x58')](_0x471fa3);}});}else{return _0x24bc12[_0x6ddd('0x4c')](_0x471fa3,function(_0x3222a7){if(_0x54db99){fs[_0x6ddd('0x58')](_0x471fa3);}});}}})[_0x6ddd('0x43')](function(_0x46ec07){if(_0x46ec07[_0x6ddd('0x59')]==='VoiceRecording\x20not\x20found'){_0x24bc12[_0x6ddd('0x17')](0x194)[_0x6ddd('0x26')](_0x6ddd('0x5a'));}else{return handleError(_0x24bc12,null);}});};exports[_0x6ddd('0x5b')]=function(_0x144d82,_0x4a6911,_0x25df0e){var _0x3d9d5a=require(_0x6ddd('0x4d'));var _0x1f4836=![];var _0x410590={'$and':[db[_0x6ddd('0x5c')][_0x6ddd('0x3d')](db[_0x6ddd('0x5c')]['fn']('MD5',db[_0x6ddd('0x5c')]['col'](_0x6ddd('0x4e'))),_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x5d')])]};if(_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x2a')]&&_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x2a')]===_0x6ddd('0x4e')){_0x410590[_0x6ddd('0x5e')]['push']({'uniqueid':_0x144d82['params']['id']});}else{_0x410590[_0x6ddd('0x5e')][_0x6ddd('0x5f')]({'id':_0x144d82['params']['id']});}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':_0x410590,'attributes':['id',_0x6ddd('0x4f')],'raw':!![]})[_0x6ddd('0x20')](handleEntityNotFound(_0x4a6911,null))['then'](function(_0x3a8c6e){if(_0x3a8c6e){var _0x40b9d0=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x3a8c6e['value']);if(fs[_0x6ddd('0x51')](_0x40b9d0)){_0x1f4836=!![];return _0x3d9d5a[_0x6ddd('0x52')](_0x40b9d0,_0x3a8c6e[_0x6ddd('0x4f')],config['secrets']['recording'])['then'](function(){return _0x3a8c6e;});}return _0x3a8c6e;}})['then'](function(_0xe3a27b){if(_0xe3a27b){if(!fs[_0x6ddd('0x51')](_0xe3a27b['value'])){throw new db[(_0x6ddd('0x60'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xe3a27b['filename']){return _0x4a6911[_0x6ddd('0x4c')](_0xe3a27b[_0x6ddd('0x4f')],_0xe3a27b[_0x6ddd('0x56')]+path['extname'](_0xe3a27b[_0x6ddd('0x4f')]),function(){if(_0x1f4836){fs[_0x6ddd('0x58')](_0xe3a27b[_0x6ddd('0x4f')]);}});}else{return _0x4a6911[_0x6ddd('0x4c')](_0xe3a27b[_0x6ddd('0x4f')],function(_0xbe32fb){if(_0x1f4836){fs[_0x6ddd('0x58')](_0xe3a27b[_0x6ddd('0x4f')]);}});}}})[_0x6ddd('0x43')](handleError(_0x4a6911,null));};exports[_0x6ddd('0x21')]=function(_0x26dbc6,_0x5ddd31){return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':{'id':_0x26dbc6[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](function(_0x11cea1){if(!_0x11cea1)throw new ReferenceError(_0x6ddd('0x61'));return _0x11cea1;})[_0x6ddd('0x20')](function(_0x90348d){var _0x5c8af2=_0x90348d[_0x6ddd('0x4f')];logger[_0x6ddd('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x5c8af2);if(!_['isNil'](_0x90348d[_0x6ddd('0x4f')])&&fs['existsSync'](_0x5c8af2)){logger['info'](_0x6ddd('0x63')+_0x5c8af2+_0x6ddd('0x64'));fs[_0x6ddd('0x65')](_0x5c8af2);}_0x5c8af2=_0x5c8af2+'.cypher';if(!_['isNil'](_0x90348d['value'])&&fs['existsSync'](_0x5c8af2)){logger['info']('File:\x20\x22'+_0x5c8af2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6ddd('0x65')](_0x5c8af2);}return _0x90348d;})[_0x6ddd('0x20')](function(_0x509f18){if(!_0x509f18)throw new InternalError();return _0x509f18[_0x6ddd('0x21')]();})[_0x6ddd('0x20')](function(){_0x5ddd31[_0x6ddd('0x17')](0xcc)[_0x6ddd('0x22')]();})[_0x6ddd('0x43')](handleError(_0x5ddd31,null));};function getBucketslist(_0xe7ea2e,_0x1ee4d4,_0x589cda){return new Promise(function(_0x2c61db,_0x464343){var _0x3df9b7=new AWS['S3']({'accessKeyId':_0x1ee4d4,'secretAccessKey':_0xe7ea2e,'region':_0x589cda});_0x3df9b7[_0x6ddd('0x66')]({},function(_0x37d7f7,_0x32eb4b){if(_0x37d7f7){return _0x464343(_0x37d7f7);}else{return _0x2c61db(_0x32eb4b);}});});}function createBucket(_0xf9b3be,_0x4a8f1a,_0xc1ba60,_0x21cb1c){return new Promise(function(_0x1a174e,_0x3fbfd5){var _0x5b4bb3=new AWS['S3']({'accessKeyId':_0x4a8f1a,'secretAccessKey':_0xf9b3be,'region':_0xc1ba60});_0x5b4bb3[_0x6ddd('0x67')]({'Bucket':_0x21cb1c},function(_0x1d8b65,_0x4e973d){if(_0x1d8b65){return _0x3fbfd5(_0x1d8b65);}else{return _0x1a174e(_0x4e973d);}});});}function uploadFile(_0x142029,_0x260597,_0x4c89f8,_0x569baa,_0x100161,_0x5d1b13){return new Promise(function(_0xa03169,_0x4eb0f9){var _0x20b747=new AWS['S3']({'accessKeyId':_0x260597,'secretAccessKey':_0x142029,'region':_0x4c89f8});_0x20b747[_0x6ddd('0x68')]({'Bucket':_0x569baa,'Key':_0x100161,'Body':_0x5d1b13},function(_0x4349ad,_0x76e72b){if(_0x4349ad){return _0x4eb0f9(_0x4349ad);}else{return _0xa03169(_0x76e72b);}});});}function startTranscribe(_0x398d75,_0x54c1a3,_0x495393,_0x37a30f,_0x512c8b,_0x119685){return new Promise(function(_0xf55b67,_0x246604){var _0x20403d=new AWS['TranscribeService']({'accessKeyId':_0x54c1a3,'secretAccessKey':_0x398d75,'region':_0x495393});_0x20403d[_0x6ddd('0x69')]({'TranscriptionJobName':_0x37a30f,'LanguageCode':_0x512c8b,'Media':{'MediaFileUri':_0x119685}},function(_0x26cd54,_0x4ac5fa){if(_0x26cd54){return _0x246604(_0x26cd54);}else{return _0xf55b67(_0x4ac5fa);}});});}function transcribe(_0x5817e6,_0x265564,_0x52d00a,_0x3aca3e,_0x1db177,_0x14e154,_0x33a5bb){return new Promise(function(_0x40b41c,_0x1ebc03){var _0x3f79e5={};logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x6a'),_0x5817e6,_0x1db177));return uploadFile(_0x265564,_0x52d00a,_0x3aca3e,_0x1db177,path['basename'](_0x14e154),fs['readFileSync'](_0x14e154))[_0x6ddd('0x20')](function(_0x5afc95){logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x6b'),_0x5817e6,_0x1db177,_0x5afc95[_0x6ddd('0x6c')]));_0x3f79e5[_0x6ddd('0x6d')]=_0x5afc95['Bucket'];_0x3f79e5[_0x6ddd('0x6e')]=_0x5afc95[_0x6ddd('0x6c')];logger['info'](util[_0x6ddd('0x2e')](_0x6ddd('0x6f'),_0x5817e6));return startTranscribe(_0x265564,_0x52d00a,_0x3aca3e,uuidv4(),_0x33a5bb,_0x5afc95[_0x6ddd('0x6c')]);})[_0x6ddd('0x20')](function(_0x2893da){logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x70'),_0x5817e6,_0x2893da[_0x6ddd('0x71')][_0x6ddd('0x72')]));_0x3f79e5[_0x6ddd('0x73')]=_0x2893da['TranscriptionJob'][_0x6ddd('0x72')];_0x3f79e5[_0x6ddd('0x74')]=_0x2893da['TranscriptionJob'][_0x6ddd('0x75')];return _0x40b41c(_0x3f79e5);})['catch'](function(_0x4e65f5){return _0x1ebc03(_0x4e65f5);});});}exports[_0x6ddd('0x76')]=function(_0x663f40,_0x374ac7,_0x26b5df){var _0xfb27f8;var _0xe000e;var _0x4af501;var _0x5ffff6=require('../../components/encryptor');return db[_0x6ddd('0x41')]['findOne']({'where':{'id':_0x663f40[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](function(_0x37a52e){if(_0x37a52e){var _0x2dceeb=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x37a52e[_0x6ddd('0x4f')]);if(fs[_0x6ddd('0x51')](_0x2dceeb)){cypher=!![];return _0x5ffff6[_0x6ddd('0x52')](_0x2dceeb,_0x37a52e[_0x6ddd('0x4f')],config[_0x6ddd('0x53')]['recording'])[_0x6ddd('0x20')](function(){return _0x37a52e;});}return _0x37a52e;}})['then'](function(_0x28c860){if(!_0x28c860){throw new db[(_0x6ddd('0x60'))][(_0x6ddd('0x77'))](_0x6ddd('0x78'));}_0xe000e=_0x28c860;return db[_0x6ddd('0x79')][_0x6ddd('0x7a')]({'where':{'id':0x1}});})[_0x6ddd('0x20')](handleEntityNotFound(_0x374ac7,null))['then'](function(_0x3e8152){if(_0x3e8152){_0xfb27f8=_0x3e8152;if(!_0xfb27f8[_0x6ddd('0x7b')]||!_0xfb27f8[_0x6ddd('0x7c')]||!_0xfb27f8['transcribeRegion']||!_0xfb27f8[_0x6ddd('0x7d')]||!_0xfb27f8[_0x6ddd('0x6d')]){throw new db['Sequelize']['ValidationError'](_0x6ddd('0x7e'));}if(_0x663f40[_0x6ddd('0x4a')][_0x6ddd('0x7f')]&&(!_0xfb27f8['sentiment']||!_0xfb27f8['sentimentAccountId']||!_0xfb27f8['sentimentRegion']||!_0xfb27f8[_0x6ddd('0x7d')]||!_0xfb27f8[_0x6ddd('0x6d')])){throw new db[(_0x6ddd('0x60'))][(_0x6ddd('0x77'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6ddd('0x80')]['findOne']({'where':{'id':_0xfb27f8[_0x6ddd('0x7c')]}});}})[_0x6ddd('0x20')](function(_0x46d5c7){if(!_0x46d5c7){throw new db['Sequelize'][(_0x6ddd('0x77'))](_0x6ddd('0x81'));}if(!_0x46d5c7[_0x6ddd('0x82')]||!_0x46d5c7[_0x6ddd('0x83')]){throw new db['Sequelize'][(_0x6ddd('0x77'))](_0x6ddd('0x84'));}_0x4af501=_0x46d5c7;return getBucketslist(_0x4af501['data1'],_0x4af501['data2'],_0xfb27f8[_0x6ddd('0x85')]);})[_0x6ddd('0x20')](function(_0x2e5a4c){if(_0x2e5a4c&&_0x2e5a4c[_0x6ddd('0x86')]){var _0x24cfc0=_['find'](_0x2e5a4c[_0x6ddd('0x86')],function(_0x39e6b2){return _0x39e6b2['Name']===_0xfb27f8[_0x6ddd('0x6d')];});if(!_0x24cfc0){logger[_0x6ddd('0x62')](util['format'](_0x6ddd('0x87'),_0x663f40[_0x6ddd('0x44')]['id'],_0xfb27f8[_0x6ddd('0x6d')]));return createBucket(_0x4af501['data1'],_0x4af501['data2'],_0xfb27f8['transcribeRegion'],_0xfb27f8[_0x6ddd('0x6d')]);}logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x663f40[_0x6ddd('0x44')]['id'],_0xfb27f8[_0x6ddd('0x6d')]));return;}})[_0x6ddd('0x20')](function(_0x4535cd){if(_0xe000e[_0x6ddd('0x74')]===_0x6ddd('0x88')){return transcribe(_0x663f40[_0x6ddd('0x44')]['id'],_0x4af501['data1'],_0x4af501[_0x6ddd('0x83')],_0xfb27f8[_0x6ddd('0x85')],_0xfb27f8[_0x6ddd('0x6d')],_0xe000e[_0x6ddd('0x4f')],_0xfb27f8[_0x6ddd('0x7d')]);}else{logger[_0x6ddd('0x62')](util['format'](_0x6ddd('0x89'),_0x663f40['params']['id']));return{'transcribeStatus':_0x6ddd('0x8a')};}})[_0x6ddd('0x20')](function(_0x31731e){if(_0x31731e){_0x31731e[_0x6ddd('0x8b')]=_0x663f40[_0x6ddd('0x4a')][_0x6ddd('0x7f')];return _0xe000e[_0x6ddd('0x8c')](_0x31731e);}})[_0x6ddd('0x20')](respondWithResult(_0x374ac7,null))[_0x6ddd('0x43')](handleError(_0x374ac7,null));};function writeFile(_0x35ab10,_0x205639){return new Promise(function(_0x20bfab,_0x123a90){fs[_0x6ddd('0x8d')](_0x205639,_0x35ab10,function(_0x25d160,_0x4620ac){if(_0x25d160){return _0x123a90(_0x25d160);}else{return _0x20bfab(_0x4620ac);}});});}exports[_0x6ddd('0x8e')]=function(_0x292d61,_0x1a78b7,_0x45877d){return db['VoiceRecording'][_0x6ddd('0x7a')]({'where':{'id':_0x292d61[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](handleEntityNotFound(_0x1a78b7))['then'](function(_0xbc2c52){if(_0xbc2c52&&_0xbc2c52[_0x6ddd('0x8f')]){var _0x579c4d=_0xbc2c52[_0x6ddd('0x8f')];var _0x26d7c3=config[_0x6ddd('0x90')]+_0x6ddd('0x91')+_0xbc2c52['id']+'.txt';if(fs[_0x6ddd('0x51')](_0x26d7c3)){return _0x26d7c3;}return writeFile(_0x579c4d,_0x26d7c3)[_0x6ddd('0x20')](function(){return _0x26d7c3;});}else{throw new db['Sequelize']['ValidationError'](_0x6ddd('0x92'));}})[_0x6ddd('0x20')](function(_0x3120c9){return _0x1a78b7['download'](_0x3120c9);})[_0x6ddd('0x43')](handleError(_0x1a78b7));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index df195fd..f21538e 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 _0x5888=['uniqueid','util','api','moment','bluebird','request-promise','../../config/environment','./voiceRecording.attributes','exports','voice_recordings'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0x5888,0xe7));var _0x8588=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5888[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0x8588('0x0'));var logger=require('../../config/logger')(_0x8588('0x1'));var moment=require(_0x8588('0x2'));var BPromise=require(_0x8588('0x3'));var rp=require(_0x8588('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8588('0x5'));var attributes=require(_0x8588('0x6'));module[_0x8588('0x7')]=function(_0x5c9a08,_0x3253c5){return _0x5c9a08['define']('VoiceRecording',attributes,{'tableName':_0x8588('0x8'),'paranoid':![],'indexes':[{'name':_0x8588('0x9'),'fields':[_0x8588('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c01=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x23808f,_0x17fa1c){var _0x3656c6=function(_0x552abf){while(--_0x552abf){_0x23808f['push'](_0x23808f['shift']());}};_0x3656c6(++_0x17fa1c);}(_0x3c01,0x19a));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x13c0('0x0'));var util=require(_0x13c0('0x1'));var logger=require(_0x13c0('0x2'))(_0x13c0('0x3'));var moment=require(_0x13c0('0x4'));var BPromise=require('bluebird');var rp=require(_0x13c0('0x5'));var fs=require('fs');var path=require(_0x13c0('0x6'));var rimraf=require('rimraf');var config=require(_0x13c0('0x7'));var attributes=require(_0x13c0('0x8'));module[_0x13c0('0x9')]=function(_0xefe4cd,_0x5737b2){return _0xefe4cd[_0x13c0('0xa')](_0x13c0('0xb'),attributes,{'tableName':_0x13c0('0xc'),'paranoid':![],'indexes':[{'name':_0x13c0('0xd'),'fields':[_0x13c0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index fa67901..82f38d0 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(_0x450a0d,_0x21839f){var _0x41e651=function(_0x174efa){while(--_0x174efa){_0x450a0d['push'](_0x450a0d['shift']());}};_0x41e651(++_0x21839f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 9775876..9735b50 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x24f57f,_0x42ac25){var _0xa86432=function(_0x379453){while(--_0x379453){_0x24f57f['push'](_0x24f57f['shift']());}};_0xa86432(++_0x42ac25);}(_0x9536,0x179));var _0x6953=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x9536[_0x259d17];return _0x407535;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0xc')]('/',auth['isAuthenticated'](),controller[_0x6953('0xd')]);router[_0x6953('0xe')](_0x6953('0xa'),auth['isAuthenticated'](),controller[_0x6953('0xf')]);router[_0x6953('0x10')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);module[_0x6953('0x12')]=router; \ No newline at end of file +var _0x4819=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2608ba,_0x495fae){var _0x5dbf3f=function(_0x1b71c3){while(--_0x1b71c3){_0x2608ba['push'](_0x2608ba['shift']());}};_0x5dbf3f(++_0x495fae);}(_0x4819,0xcd));var _0x9481=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0x4819[_0x23b57c];return _0x4c3b1d;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xe')]);router['put'](_0x9481('0xf'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router['delete'](_0x9481('0xf'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);module[_0x9481('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 54b8ff1..e504f0c 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 _0x3eca=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x47e8f8,_0x122910){var _0x296331=function(_0x430613){while(--_0x430613){_0x47e8f8['push'](_0x47e8f8['shift']());}};_0x296331(++_0x122910);}(_0x3eca,0xe6));var _0xa3ec=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x3eca[_0x5db313];return _0x36d503;};'use strict';var Sequelize=require(_0xa3ec('0x0'));var moment=require(_0xa3ec('0x1'));module[_0xa3ec('0x2')]={'type':{'type':Sequelize[_0xa3ec('0x3')]('blind',_0xa3ec('0x4'))},'result':{'type':Sequelize[_0xa3ec('0x5')]},'transfererchannel':{'type':Sequelize[_0xa3ec('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa3ec('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa3ec('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xa3ec('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xa3ec('0x5')]},'transferercontext':{'type':Sequelize[_0xa3ec('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa3ec('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa3ec('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xa3ec('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xa3ec('0x3')](_0xa3ec('0x6'),'No')},'context':{'type':Sequelize[_0xa3ec('0x5')]},'extension':{'type':Sequelize[_0xa3ec('0x5')]}}; \ No newline at end of file +var _0x6457=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x24efe1,_0x21f604){var _0x42129=function(_0x3c529f){while(--_0x3c529f){_0x24efe1['push'](_0x24efe1['shift']());}};_0x42129(++_0x21f604);}(_0x6457,0x173));var _0x7645=function(_0x58a22c,_0x3a2ed4){_0x58a22c=_0x58a22c-0x0;var _0x1206d0=_0x6457[_0x58a22c];return _0x1206d0;};'use strict';var Sequelize=require(_0x7645('0x0'));var moment=require(_0x7645('0x1'));module[_0x7645('0x2')]={'type':{'type':Sequelize[_0x7645('0x3')](_0x7645('0x4'),_0x7645('0x5'))},'result':{'type':Sequelize[_0x7645('0x6')]},'transfererchannel':{'type':Sequelize[_0x7645('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7645('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7645('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7645('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x7645('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7645('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x7645('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x7645('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x7645('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x7645('0x6')]},'transfereecontext':{'type':Sequelize[_0x7645('0x6')]},'transfereeexten':{'type':Sequelize[_0x7645('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7645('0x3')](_0x7645('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 103194b..990ff21 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 _0x5a4d=['map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','include','findAll','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','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','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x38d852,_0x5ce645){var _0x105103=function(_0x5d2805){while(--_0x5d2805){_0x38d852['push'](_0x38d852['shift']());}};_0x105103(++_0x5ce645);}(_0x5a4d,0xa5));var _0xd5a4=function(_0x50e8be,_0x51a7c4){_0x50e8be=_0x50e8be-0x0;var _0x2b7ffb=_0x5a4d[_0x50e8be];return _0x2b7ffb;};'use strict';var pdf=require(_0xd5a4('0x0'));var emlformat=require(_0xd5a4('0x1'));var rimraf=require(_0xd5a4('0x2'));var zipdir=require(_0xd5a4('0x3'));var jsonpatch=require(_0xd5a4('0x4'));var rp=require(_0xd5a4('0x5'));var moment=require('moment');var BPromise=require(_0xd5a4('0x6'));var Mustache=require(_0xd5a4('0x7'));var util=require('util');var path=require(_0xd5a4('0x8'));var sox=require('sox');var csv=require(_0xd5a4('0x9'));var ejs=require(_0xd5a4('0xa'));var fs=require('fs');var _=require(_0xd5a4('0xb'));var squel=require('squel');var crypto=require(_0xd5a4('0xc'));var jsforce=require(_0xd5a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd5a4('0x9'));var querystring=require('querystring');var Papa=require(_0xd5a4('0xe'));var Redis=require(_0xd5a4('0xf'));var authService=require(_0xd5a4('0x10'));var qs=require(_0xd5a4('0x11'));var as=require(_0xd5a4('0x12'));var hardwareService=require(_0xd5a4('0x13'));var logger=require(_0xd5a4('0x14'))(_0xd5a4('0x15'));var utils=require(_0xd5a4('0x16'));var config=require(_0xd5a4('0x17'));var licenseUtil=require(_0xd5a4('0x18'));var db=require(_0xd5a4('0x19'))['db'];function respondWithStatusCode(_0x56c1a,_0x4291aa){_0x4291aa=_0x4291aa||0xcc;return function(_0xaeb6c2){if(_0xaeb6c2){return _0x56c1a['sendStatus'](_0x4291aa);}return _0x56c1a['status'](_0x4291aa)[_0xd5a4('0x1a')]();};}function respondWithResult(_0x32870c,_0x23205e){_0x23205e=_0x23205e||0xc8;return function(_0x1238ba){if(_0x1238ba){return _0x32870c['status'](_0x23205e)[_0xd5a4('0x1b')](_0x1238ba);}};}function respondWithFilteredResult(_0x52d713,_0x3f3c2f){return function(_0x5d658f){if(_0x5d658f){var _0x341cf5=_0x5d658f[_0xd5a4('0x1c')],_0x4ebcb8=_0x3f3c2f['offset'],_0x7779f3=_0x3f3c2f[_0xd5a4('0x1d')]+_0x3f3c2f[_0xd5a4('0x1e')],_0x56d276;if(_0x7779f3>=_0x341cf5){_0x7779f3=_0x341cf5;_0x56d276=0xc8;}else{_0x56d276=0xce;}_0x52d713[_0xd5a4('0x1f')](_0x56d276);return _0x52d713[_0xd5a4('0x20')](_0xd5a4('0x21'),_0x4ebcb8+'-'+_0x7779f3+'/'+_0x341cf5)[_0xd5a4('0x1b')](_0x5d658f);}return null;};}function patchUpdates(_0x444125){return function(_0x5c81b5){try{jsonpatch[_0xd5a4('0x22')](_0x5c81b5,_0x444125,!![]);}catch(_0x15942a){return BPromise[_0xd5a4('0x23')](_0x15942a);}return _0x5c81b5[_0xd5a4('0x24')]();};}function saveUpdates(_0x293150,_0x5b1aca){return function(_0x56d34d){if(_0x56d34d){return _0x56d34d[_0xd5a4('0x25')](_0x293150)[_0xd5a4('0x26')](function(_0x219e2a){return _0x219e2a;});}return null;};}function removeEntity(_0x493260,_0x52cc67){return function(_0x7a6c70){if(_0x7a6c70){return _0x7a6c70['destroy']()['then'](function(){_0x493260[_0xd5a4('0x1f')](0xcc)[_0xd5a4('0x1a')]();});}};}function handleEntityNotFound(_0x45ce1e,_0x18807d){return function(_0x3e1e76){if(!_0x3e1e76){_0x45ce1e['sendStatus'](0x194);}return _0x3e1e76;};}function handleError(_0x5b9aed,_0x32cae9){_0x32cae9=_0x32cae9||0x1f4;return function(_0x3a91d6){logger['error'](_0x3a91d6[_0xd5a4('0x27')]);if(_0x3a91d6[_0xd5a4('0x28')]){delete _0x3a91d6[_0xd5a4('0x28')];}_0x5b9aed[_0xd5a4('0x1f')](_0x32cae9)[_0xd5a4('0x29')](_0x3a91d6);};}exports['index']=function(_0x1bae28,_0x177a6c){var _0x26d692={},_0x4fa8ae={},_0x255bf4={'count':0x0,'rows':[]};var _0x1a8f1d=_['map'](db[_0xd5a4('0x2a')][_0xd5a4('0x2b')],function(_0x1ef416){return{'name':_0x1ef416[_0xd5a4('0x2c')],'type':_0x1ef416[_0xd5a4('0x2d')][_0xd5a4('0x2e')]};});_0x4fa8ae[_0xd5a4('0x2f')]=_[_0xd5a4('0x30')](_0x1a8f1d,'name');_0x4fa8ae['query']=_[_0xd5a4('0x31')](_0x1bae28[_0xd5a4('0x32')]);_0x4fa8ae[_0xd5a4('0x33')]=_[_0xd5a4('0x34')](_0x4fa8ae[_0xd5a4('0x2f')],_0x4fa8ae[_0xd5a4('0x32')]);_0x26d692[_0xd5a4('0x35')]=_[_0xd5a4('0x34')](_0x4fa8ae[_0xd5a4('0x2f')],qs['fields'](_0x1bae28['query'][_0xd5a4('0x36')]));_0x26d692[_0xd5a4('0x35')]=_0x26d692['attributes'][_0xd5a4('0x37')]?_0x26d692[_0xd5a4('0x35')]:_0x4fa8ae[_0xd5a4('0x2f')];if(!_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x38')](_0xd5a4('0x39'))){_0x26d692[_0xd5a4('0x1e')]=qs[_0xd5a4('0x1e')](_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x1e')]);_0x26d692['offset']=qs[_0xd5a4('0x1d')](_0x1bae28[_0xd5a4('0x32')]['offset']);}_0x26d692['order']=qs['sort'](_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x3a')]);_0x26d692['where']=qs[_0xd5a4('0x33')](_[_0xd5a4('0x3b')](_0x1bae28[_0xd5a4('0x32')],_0x4fa8ae[_0xd5a4('0x33')]),_0x1a8f1d);if(_0x1bae28[_0xd5a4('0x32')][_0xd5a4('0x3c')]){_0x26d692[_0xd5a4('0x3d')]=_['merge'](_0x26d692[_0xd5a4('0x3d')],{'$or':_[_0xd5a4('0x30')](_0x1a8f1d,function(_0x163bd2){if(_0x163bd2['type']!==_0xd5a4('0x3e')){var _0x1209f8={};_0x1209f8[_0x163bd2[_0xd5a4('0x28')]]={'$like':'%'+_0x1bae28['query'][_0xd5a4('0x3c')]+'%'};return _0x1209f8;}})});}_0x26d692=_['merge']({},_0x26d692,_0x1bae28['options']);var _0x19eddc={'where':_0x26d692[_0xd5a4('0x3d')]};return db[_0xd5a4('0x2a')][_0xd5a4('0x1c')](_0x19eddc)[_0xd5a4('0x26')](function(_0x4a4cad){_0x255bf4[_0xd5a4('0x1c')]=_0x4a4cad;if(_0x1bae28[_0xd5a4('0x32')]['includeAll']){_0x26d692[_0xd5a4('0x3f')]=[{'all':!![]}];}return db[_0xd5a4('0x2a')][_0xd5a4('0x40')](_0x26d692);})[_0xd5a4('0x26')](function(_0x43ff45){_0x255bf4['rows']=_0x43ff45;return _0x255bf4;})[_0xd5a4('0x26')](respondWithFilteredResult(_0x177a6c,_0x26d692))['catch'](handleError(_0x177a6c,null));};exports['show']=function(_0x34b09b,_0x5f3093){var _0x126358={'raw':!![],'where':{'id':_0x34b09b[_0xd5a4('0x41')]['id']}},_0x331f38={};_0x331f38['model']=_[_0xd5a4('0x31')](db[_0xd5a4('0x2a')][_0xd5a4('0x2b')]);_0x331f38[_0xd5a4('0x32')]=_['keys'](_0x34b09b[_0xd5a4('0x32')]);_0x331f38[_0xd5a4('0x33')]=_[_0xd5a4('0x34')](_0x331f38[_0xd5a4('0x2f')],_0x331f38['query']);_0x126358[_0xd5a4('0x35')]=_['intersection'](_0x331f38[_0xd5a4('0x2f')],qs[_0xd5a4('0x36')](_0x34b09b['query']['fields']));_0x126358[_0xd5a4('0x35')]=_0x126358[_0xd5a4('0x35')][_0xd5a4('0x37')]?_0x126358['attributes']:_0x331f38[_0xd5a4('0x2f')];if(_0x34b09b['query']['includeAll']){_0x126358[_0xd5a4('0x3f')]=[{'all':!![]}];}_0x126358=_['merge']({},_0x126358,_0x34b09b[_0xd5a4('0x42')]);return db[_0xd5a4('0x2a')][_0xd5a4('0x43')](_0x126358)['then'](handleEntityNotFound(_0x5f3093,null))[_0xd5a4('0x26')](respondWithResult(_0x5f3093,null))[_0xd5a4('0x44')](handleError(_0x5f3093,null));};exports[_0xd5a4('0x45')]=function(_0x97df72,_0x1d2415){return db[_0xd5a4('0x2a')]['create'](_0x97df72[_0xd5a4('0x46')],{})[_0xd5a4('0x26')](respondWithResult(_0x1d2415,0xc9))['catch'](handleError(_0x1d2415,null));};exports[_0xd5a4('0x25')]=function(_0x365099,_0x2ad35a){if(_0x365099[_0xd5a4('0x46')]['id']){delete _0x365099[_0xd5a4('0x46')]['id'];}return db['VoiceTransferReport'][_0xd5a4('0x43')]({'where':{'id':_0x365099['params']['id']}})[_0xd5a4('0x26')](handleEntityNotFound(_0x2ad35a,null))[_0xd5a4('0x26')](saveUpdates(_0x365099[_0xd5a4('0x46')],null))['then'](respondWithResult(_0x2ad35a,null))[_0xd5a4('0x44')](handleError(_0x2ad35a,null));};exports['destroy']=function(_0x1a73b6,_0x5198da){return db[_0xd5a4('0x2a')]['find']({'where':{'id':_0x1a73b6['params']['id']}})[_0xd5a4('0x26')](handleEntityNotFound(_0x5198da,null))['then'](removeEntity(_0x5198da,null))['catch'](handleError(_0x5198da,null));}; \ No newline at end of file +var _0x6512=['intersection','include','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','rawAttributes'];(function(_0x2bb298,_0x4bdefb){var _0x1ef1af=function(_0x590665){while(--_0x590665){_0x2bb298['push'](_0x2bb298['shift']());}};_0x1ef1af(++_0x4bdefb);}(_0x6512,0x1ea));var _0x2651=function(_0x51f807,_0x25b6f9){_0x51f807=_0x51f807-0x0;var _0x19a3f0=_0x6512[_0x51f807];return _0x19a3f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2651('0x1'));var jsonpatch=require(_0x2651('0x2'));var rp=require(_0x2651('0x3'));var moment=require(_0x2651('0x4'));var BPromise=require(_0x2651('0x5'));var Mustache=require('mustache');var util=require(_0x2651('0x6'));var path=require('path');var sox=require(_0x2651('0x7'));var csv=require(_0x2651('0x8'));var ejs=require(_0x2651('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2651('0xa'));var crypto=require(_0x2651('0xb'));var jsforce=require(_0x2651('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2651('0x8'));var querystring=require(_0x2651('0xd'));var Papa=require(_0x2651('0xe'));var Redis=require(_0x2651('0xf'));var authService=require(_0x2651('0x10'));var qs=require(_0x2651('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2651('0x12'));var logger=require(_0x2651('0x13'))(_0x2651('0x14'));var utils=require('../../config/utils');var config=require(_0x2651('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52935e,_0x1e8abd){_0x1e8abd=_0x1e8abd||0xcc;return function(_0x4ad3c6){if(_0x4ad3c6){return _0x52935e['sendStatus'](_0x1e8abd);}return _0x52935e[_0x2651('0x16')](_0x1e8abd)[_0x2651('0x17')]();};}function respondWithResult(_0x162d84,_0x3a6f5f){_0x3a6f5f=_0x3a6f5f||0xc8;return function(_0xcfb016){if(_0xcfb016){return _0x162d84[_0x2651('0x16')](_0x3a6f5f)[_0x2651('0x18')](_0xcfb016);}};}function respondWithFilteredResult(_0x367d9f,_0x569f4f){return function(_0xa07808){if(_0xa07808){var _0x307bcf=_0xa07808[_0x2651('0x19')],_0x167d77=_0x569f4f['offset'],_0x2f3595=_0x569f4f[_0x2651('0x1a')]+_0x569f4f[_0x2651('0x1b')],_0x2e3ae3;if(_0x2f3595>=_0x307bcf){_0x2f3595=_0x307bcf;_0x2e3ae3=0xc8;}else{_0x2e3ae3=0xce;}_0x367d9f[_0x2651('0x16')](_0x2e3ae3);return _0x367d9f['set']('Content-Range',_0x167d77+'-'+_0x2f3595+'/'+_0x307bcf)[_0x2651('0x18')](_0xa07808);}return null;};}function patchUpdates(_0x3e9a37){return function(_0x21e28b){try{jsonpatch['apply'](_0x21e28b,_0x3e9a37,!![]);}catch(_0x11ab30){return BPromise[_0x2651('0x1c')](_0x11ab30);}return _0x21e28b[_0x2651('0x1d')]();};}function saveUpdates(_0x296f28,_0x56a2b0){return function(_0x9d1e5b){if(_0x9d1e5b){return _0x9d1e5b[_0x2651('0x1e')](_0x296f28)['then'](function(_0x41945e){return _0x41945e;});}return null;};}function removeEntity(_0x147659,_0x4d3507){return function(_0x346ea4){if(_0x346ea4){return _0x346ea4[_0x2651('0x1f')]()[_0x2651('0x20')](function(){_0x147659[_0x2651('0x16')](0xcc)[_0x2651('0x17')]();});}};}function handleEntityNotFound(_0x13b561,_0x1869bf){return function(_0x2faaed){if(!_0x2faaed){_0x13b561[_0x2651('0x21')](0x194);}return _0x2faaed;};}function handleError(_0x3c9960,_0x20971a){_0x20971a=_0x20971a||0x1f4;return function(_0x16cbea){logger[_0x2651('0x22')](_0x16cbea[_0x2651('0x23')]);if(_0x16cbea[_0x2651('0x24')]){delete _0x16cbea['name'];}_0x3c9960[_0x2651('0x16')](_0x20971a)['send'](_0x16cbea);};}exports[_0x2651('0x25')]=function(_0x134839,_0x59eb21){var _0x34208c={},_0x49c805={},_0x2b9d9b={'count':0x0,'rows':[]};var _0x4bb90f=_[_0x2651('0x26')](db[_0x2651('0x27')]['rawAttributes'],function(_0x34ae41){return{'name':_0x34ae41[_0x2651('0x28')],'type':_0x34ae41[_0x2651('0x29')][_0x2651('0x2a')]};});_0x49c805[_0x2651('0x2b')]=_[_0x2651('0x26')](_0x4bb90f,_0x2651('0x24'));_0x49c805['query']=_[_0x2651('0x2c')](_0x134839['query']);_0x49c805[_0x2651('0x2d')]=_['intersection'](_0x49c805[_0x2651('0x2b')],_0x49c805[_0x2651('0x2e')]);_0x34208c['attributes']=_['intersection'](_0x49c805[_0x2651('0x2b')],qs[_0x2651('0x2f')](_0x134839['query'][_0x2651('0x2f')]));_0x34208c[_0x2651('0x30')]=_0x34208c['attributes'][_0x2651('0x31')]?_0x34208c[_0x2651('0x30')]:_0x49c805[_0x2651('0x2b')];if(!_0x134839[_0x2651('0x2e')][_0x2651('0x32')](_0x2651('0x33'))){_0x34208c[_0x2651('0x1b')]=qs['limit'](_0x134839[_0x2651('0x2e')]['limit']);_0x34208c[_0x2651('0x1a')]=qs[_0x2651('0x1a')](_0x134839[_0x2651('0x2e')][_0x2651('0x1a')]);}_0x34208c['order']=qs[_0x2651('0x34')](_0x134839[_0x2651('0x2e')][_0x2651('0x34')]);_0x34208c[_0x2651('0x35')]=qs['filters'](_[_0x2651('0x36')](_0x134839[_0x2651('0x2e')],_0x49c805[_0x2651('0x2d')]),_0x4bb90f);if(_0x134839['query'][_0x2651('0x37')]){_0x34208c[_0x2651('0x35')]=_[_0x2651('0x38')](_0x34208c[_0x2651('0x35')],{'$or':_[_0x2651('0x26')](_0x4bb90f,function(_0x35a400){if(_0x35a400[_0x2651('0x29')]!==_0x2651('0x39')){var _0x3c7b43={};_0x3c7b43[_0x35a400['name']]={'$like':'%'+_0x134839[_0x2651('0x2e')][_0x2651('0x37')]+'%'};return _0x3c7b43;}})});}_0x34208c=_[_0x2651('0x38')]({},_0x34208c,_0x134839[_0x2651('0x3a')]);var _0x6403ad={'where':_0x34208c[_0x2651('0x35')]};return db[_0x2651('0x27')][_0x2651('0x19')](_0x6403ad)[_0x2651('0x20')](function(_0x2fdf78){_0x2b9d9b[_0x2651('0x19')]=_0x2fdf78;if(_0x134839[_0x2651('0x2e')][_0x2651('0x3b')]){_0x34208c['include']=[{'all':!![]}];}return db[_0x2651('0x27')]['findAll'](_0x34208c);})[_0x2651('0x20')](function(_0x2840a2){_0x2b9d9b['rows']=_0x2840a2;return _0x2b9d9b;})[_0x2651('0x20')](respondWithFilteredResult(_0x59eb21,_0x34208c))['catch'](handleError(_0x59eb21,null));};exports[_0x2651('0x3c')]=function(_0xcf7ba0,_0x5020da){var _0xc25b4e={'raw':!![],'where':{'id':_0xcf7ba0['params']['id']}},_0x3e7001={};_0x3e7001[_0x2651('0x2b')]=_[_0x2651('0x2c')](db[_0x2651('0x27')][_0x2651('0x3d')]);_0x3e7001[_0x2651('0x2e')]=_[_0x2651('0x2c')](_0xcf7ba0[_0x2651('0x2e')]);_0x3e7001['filters']=_[_0x2651('0x3e')](_0x3e7001[_0x2651('0x2b')],_0x3e7001[_0x2651('0x2e')]);_0xc25b4e[_0x2651('0x30')]=_['intersection'](_0x3e7001['model'],qs[_0x2651('0x2f')](_0xcf7ba0[_0x2651('0x2e')][_0x2651('0x2f')]));_0xc25b4e['attributes']=_0xc25b4e[_0x2651('0x30')][_0x2651('0x31')]?_0xc25b4e[_0x2651('0x30')]:_0x3e7001[_0x2651('0x2b')];if(_0xcf7ba0[_0x2651('0x2e')][_0x2651('0x3b')]){_0xc25b4e[_0x2651('0x3f')]=[{'all':!![]}];}_0xc25b4e=_['merge']({},_0xc25b4e,_0xcf7ba0['options']);return db[_0x2651('0x27')][_0x2651('0x40')](_0xc25b4e)[_0x2651('0x20')](handleEntityNotFound(_0x5020da,null))[_0x2651('0x20')](respondWithResult(_0x5020da,null))['catch'](handleError(_0x5020da,null));};exports[_0x2651('0x41')]=function(_0x3296c1,_0x40fb9a){return db['VoiceTransferReport'][_0x2651('0x41')](_0x3296c1[_0x2651('0x42')],{})[_0x2651('0x20')](respondWithResult(_0x40fb9a,0xc9))[_0x2651('0x43')](handleError(_0x40fb9a,null));};exports[_0x2651('0x1e')]=function(_0x1fb928,_0x17d60f){if(_0x1fb928[_0x2651('0x42')]['id']){delete _0x1fb928['body']['id'];}return db['VoiceTransferReport'][_0x2651('0x40')]({'where':{'id':_0x1fb928[_0x2651('0x44')]['id']}})[_0x2651('0x20')](handleEntityNotFound(_0x17d60f,null))[_0x2651('0x20')](saveUpdates(_0x1fb928[_0x2651('0x42')],null))['then'](respondWithResult(_0x17d60f,null))['catch'](handleError(_0x17d60f,null));};exports[_0x2651('0x1f')]=function(_0x374574,_0x5b7d57){return db[_0x2651('0x27')]['find']({'where':{'id':_0x374574[_0x2651('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b7d57,null))[_0x2651('0x20')](removeEntity(_0x5b7d57,null))['catch'](handleError(_0x5b7d57,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index da3d9b0..2ca2d91 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 _0xa96d=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa96d,0x116));var _0xda96=function(_0x34b48c,_0xe97afa){_0x34b48c=_0x34b48c-0x0;var _0x3b9957=_0xa96d[_0x34b48c];return _0x3b9957;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xda96('0x0'));var BPromise=require(_0xda96('0x1'));var rp=require(_0xda96('0x2'));var fs=require('fs');var path=require(_0xda96('0x3'));var rimraf=require(_0xda96('0x4'));var config=require(_0xda96('0x5'));var attributes=require(_0xda96('0x6'));module['exports']=function(_0x1681ed,_0x4b890e){return _0x1681ed['define'](_0xda96('0x7'),attributes,{'tableName':_0xda96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb5=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','path','./voiceTransferReport.attributes','define'];(function(_0xd5c1e9,_0x333aae){var _0x233872=function(_0xf6f996){while(--_0xf6f996){_0xd5c1e9['push'](_0xd5c1e9['shift']());}};_0x233872(++_0x333aae);}(_0x1bb5,0x82));var _0x51bb=function(_0x39c760,_0x4daa3d){_0x39c760=_0x39c760-0x0;var _0x472eb3=_0x1bb5[_0x39c760];return _0x472eb3;};'use strict';var _=require('lodash');var util=require(_0x51bb('0x0'));var logger=require(_0x51bb('0x1'))(_0x51bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51bb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51bb('0x4'));module['exports']=function(_0x118704,_0x12b8c6){return _0x118704[_0x51bb('0x5')](_0x51bb('0x6'),attributes,{'tableName':_0x51bb('0x7'),'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 fe8cecf..94ce801 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 _0xffa2=['stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e44c4,_0x5cb564){var _0x4d464f=function(_0xa0f897){while(--_0xa0f897){_0x3e44c4['push'](_0x3e44c4['shift']());}};_0x4d464f(++_0x5cb564);}(_0xffa2,0x150));var _0x2ffa=function(_0x1f4928,_0x5a0cd9){_0x1f4928=_0x1f4928-0x0;var _0xd726ec=_0xffa2[_0x1f4928];return _0xd726ec;};'use strict';var _=require(_0x2ffa('0x0'));var util=require(_0x2ffa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ffa('0x2'));var fs=require('fs');var Redis=require(_0x2ffa('0x3'));var db=require(_0x2ffa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ffa('0x5'))(_0x2ffa('0x6'));var config=require(_0x2ffa('0x7'));var jayson=require(_0x2ffa('0x8'));var client=jayson[_0x2ffa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16340b,_0x7051c6,_0x4ec485){return new BPromise(function(_0x5e70e1,_0x2f592b){return client[_0x2ffa('0xa')](_0x16340b,_0x4ec485)['then'](function(_0x11dbe4){logger[_0x2ffa('0xb')](_0x2ffa('0xc'),_0x7051c6,_0x2ffa('0xd'));logger['debug'](_0x2ffa('0xe'),_0x7051c6,_0x2ffa('0xd'),JSON[_0x2ffa('0xf')](_0x11dbe4));if(_0x11dbe4[_0x2ffa('0x10')]){if(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x11')]===0x1f4){logger['error'](_0x2ffa('0xc'),_0x7051c6,_0x11dbe4['error']['message']);return _0x2f592b(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);}logger[_0x2ffa('0x10')](_0x2ffa('0xc'),_0x7051c6,_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);return _0x5e70e1(_0x11dbe4[_0x2ffa('0x10')][_0x2ffa('0x12')]);}else{logger['info'](_0x2ffa('0xc'),_0x7051c6,'request\x20sent');_0x5e70e1(_0x11dbe4['result']['message']);}})[_0x2ffa('0x13')](function(_0x17095a){logger[_0x2ffa('0x10')](_0x2ffa('0xc'),_0x7051c6,_0x17095a);_0x2f592b(_0x17095a);});});}exports[_0x2ffa('0x14')]=function(_0xa2259a){var _0xa01024=this;return new Promise(function(_0x4c27de,_0x494b0c){return db[_0x2ffa('0x15')]['create'](_0xa2259a[_0x2ffa('0x16')],{'raw':_0xa2259a[_0x2ffa('0x17')]?_0xa2259a[_0x2ffa('0x17')][_0x2ffa('0x18')]===undefined?!![]:![]:!![]})[_0x2ffa('0x19')](function(_0x47d390){logger['info'](_0x2ffa('0x14'),_0xa2259a);logger[_0x2ffa('0x1a')](_0x2ffa('0x14'),_0xa2259a,JSON[_0x2ffa('0xf')](_0x47d390));_0x4c27de(_0x47d390);})[_0x2ffa('0x13')](function(_0x139f85){logger[_0x2ffa('0x10')]('CreateVoiceTransferReport',_0x139f85[_0x2ffa('0x12')],_0xa2259a);_0x494b0c(_0xa01024['error'](0x1f4,_0x139f85[_0x2ffa('0x12')]));});});}; \ No newline at end of file +var _0x3b36=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x3b36,0x181));var _0x63b3=function(_0x525a5f,_0x4f9fa1){_0x525a5f=_0x525a5f-0x0;var _0x51d86e=_0x3b36[_0x525a5f];return _0x51d86e;};'use strict';var _=require('lodash');var util=require(_0x63b3('0x0'));var moment=require('moment');var BPromise=require(_0x63b3('0x1'));var rs=require(_0x63b3('0x2'));var fs=require('fs');var Redis=require(_0x63b3('0x3'));var db=require(_0x63b3('0x4'))['db'];var utils=require(_0x63b3('0x5'));var logger=require(_0x63b3('0x6'))(_0x63b3('0x7'));var config=require(_0x63b3('0x8'));var jayson=require(_0x63b3('0x9'));var client=jayson[_0x63b3('0xa')][_0x63b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25d851,_0x298f48,_0x2bd991){return new BPromise(function(_0x408454,_0x284f41){return client[_0x63b3('0xc')](_0x25d851,_0x2bd991)[_0x63b3('0xd')](function(_0xb1016){logger['info'](_0x63b3('0xe'),_0x298f48,'request\x20sent');logger[_0x63b3('0xf')](_0x63b3('0x10'),_0x298f48,_0x63b3('0x11'),JSON[_0x63b3('0x12')](_0xb1016));if(_0xb1016['error']){if(_0xb1016['error'][_0x63b3('0x13')]===0x1f4){logger[_0x63b3('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x298f48,_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);return _0x284f41(_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);}logger['error'](_0x63b3('0xe'),_0x298f48,_0xb1016['error'][_0x63b3('0x15')]);return _0x408454(_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);}else{logger[_0x63b3('0x16')](_0x63b3('0xe'),_0x298f48,_0x63b3('0x11'));_0x408454(_0xb1016['result']['message']);}})[_0x63b3('0x17')](function(_0x55ebce){logger[_0x63b3('0x14')](_0x63b3('0xe'),_0x298f48,_0x55ebce);_0x284f41(_0x55ebce);});});}exports['CreateVoiceTransferReport']=function(_0x3090c0){var _0x346c7c=this;return new Promise(function(_0x1597bf,_0x17001d){return db[_0x63b3('0x18')][_0x63b3('0x19')](_0x3090c0[_0x63b3('0x1a')],{'raw':_0x3090c0['options']?_0x3090c0[_0x63b3('0x1b')][_0x63b3('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x33c02f){logger[_0x63b3('0x16')](_0x63b3('0x1d'),_0x3090c0);logger[_0x63b3('0xf')](_0x63b3('0x1d'),_0x3090c0,JSON[_0x63b3('0x12')](_0x33c02f));_0x1597bf(_0x33c02f);})[_0x63b3('0x17')](function(_0x45ac24){logger['error'](_0x63b3('0x1d'),_0x45ac24[_0x63b3('0x15')],_0x3090c0);_0x17001d(_0x346c7c[_0x63b3('0x14')](0x1f4,_0x45ac24[_0x63b3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b86cab4..fcb623b 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 _0xd64b=['exports','express','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','answer','hold','unhold','calls','/transfer','transfer'];(function(_0x26d325,_0x16949f){var _0x300c21=function(_0x334000){while(--_0x334000){_0x26d325['push'](_0x26d325['shift']());}};_0x300c21(++_0x16949f);}(_0xd64b,0xc1));var _0xbd64=function(_0x5760f7,_0x47f093){_0x5760f7=_0x5760f7-0x0;var _0x4a8aa0=_0xd64b[_0x5760f7];return _0x4a8aa0;};'use strict';var express=require(_0xbd64('0x0'));var router=express['Router']();var auth=require(_0xbd64('0x1'));var controller=require('./webbar.controller');router[_0xbd64('0x2')](_0xbd64('0x3'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0x6')]);router['post']('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x2')](_0xbd64('0x8'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0x9')]);router[_0xbd64('0x2')]('/hold',auth['isAuthenticated'](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xa')]);router[_0xbd64('0x2')]('/unhold',auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x2')]('/calls',auth[_0xbd64('0x4')](),auth['canUpdate'](),controller[_0xbd64('0xc')]);router[_0xbd64('0x2')](_0xbd64('0xd'),auth[_0xbd64('0x4')](),auth[_0xbd64('0x5')](),controller[_0xbd64('0xe')]);module[_0xbd64('0xf')]=router; \ No newline at end of file +var _0x142c=['../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','/hangup','/answer','/hold','hold','unhold','/calls','calls','/transfer','transfer','express'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x142c,0x86));var _0xc142=function(_0x3142e7,_0x2bd524){_0x3142e7=_0x3142e7-0x0;var _0x111e5c=_0x142c[_0x3142e7];return _0x111e5c;};'use strict';var express=require(_0xc142('0x0'));var router=express['Router']();var auth=require(_0xc142('0x1'));var controller=require(_0xc142('0x2'));router[_0xc142('0x3')]('/originate',auth[_0xc142('0x4')](),auth[_0xc142('0x5')](),controller['originate']);router['post'](_0xc142('0x6'),auth['isAuthenticated'](),auth[_0xc142('0x5')](),controller['hangup']);router[_0xc142('0x3')](_0xc142('0x7'),auth[_0xc142('0x4')](),auth['canUpdate'](),controller['answer']);router[_0xc142('0x3')](_0xc142('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc142('0x9')]);router[_0xc142('0x3')]('/unhold',auth[_0xc142('0x4')](),auth['canUpdate'](),controller[_0xc142('0xa')]);router['post'](_0xc142('0xb'),auth[_0xc142('0x4')](),auth[_0xc142('0x5')](),controller[_0xc142('0xc')]);router['post'](_0xc142('0xd'),auth[_0xc142('0x4')](),auth['canUpdate'](),controller[_0xc142('0xe')]);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 b7e9840..c350b94 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 _0x8ca7=['conference\x20fired:','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','result','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','status','json','userId','callbackUrl','entityFound:','user:%s','catch','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','all','conference'];(function(_0x396014,_0x53e39f){var _0x4cd085=function(_0x2f5532){while(--_0x2f5532){_0x396014['push'](_0x396014['shift']());}};_0x4cd085(++_0x53e39f);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x78ca('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x78ca('0x1'));var BPromise=require(_0x78ca('0x2'));var jayson=require(_0x78ca('0x3'));var amiClient=jayson[_0x78ca('0x4')][_0x78ca('0x5')]({'port':0x232a});var logger=require(_0x78ca('0x6'))('webbarapi');var Redis=require(_0x78ca('0x7'));config[_0x78ca('0x8')]=_[_0x78ca('0x9')](config[_0x78ca('0x8')],{'host':_0x78ca('0xa'),'port':0x18eb});var io=require(_0x78ca('0xb'))(new Redis(config[_0x78ca('0x8')]));var Schema=require(_0x78ca('0xc'));var originateValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'callNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x10')]},'callerId':{'type':_0x78ca('0xf')},'callbackUrl':{'type':_0x78ca('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x11')]},'transferNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x78ca('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]}});function emit(_0x3ead02,_0x14f2dd,_0x424ccb){logger['info'](_0x3ead02,_0x14f2dd,JSON[_0x78ca('0x13')](_0x424ccb));io['to'](_0x3ead02)[_0x78ca('0x14')](_0x14f2dd,_0x424ccb);}function handleError(_0x3a47c1){return function(_0x3eef71){console[_0x78ca('0x15')](_0x78ca('0x16'),_0x3eef71,_0x3eef71 instanceof RangeError);logger[_0x78ca('0x17')](_0x3eef71[_0x78ca('0x18')]);if(_0x3eef71 instanceof RangeError){if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x194)[_0x78ca('0x1a')](_0x3eef71);}else{if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x1f4)[_0x78ca('0x1a')](_0x3eef71);}};}function checkError(){return function(_0x16c93c){if(!_0x16c93c){throw new RangeError(_0x78ca('0x1b'));}return _0x16c93c;};}function respondWithRpcPromise(_0x13e236,_0xaa22b6){return new BPromise(function(_0x330006,_0x22ec7c){var _0x8665ef=amiClient;return _0x8665ef[_0x78ca('0x1c')](_0x13e236,_0xaa22b6)[_0x78ca('0x1d')](function(_0x8c4395){if(_0x8c4395[_0x78ca('0x17')]){if(_0x8c4395['error'][_0x78ca('0x1e')]===0x1f4){return _0x22ec7c(_0x8c4395[_0x78ca('0x17')]['message']);}return _0x330006(_0x8c4395[_0x78ca('0x17')]['message']);}else{_0x330006(_0x8c4395[_0x78ca('0x1f')]);}})['catch'](function(_0x4f5a97){_0x22ec7c(_0x4f5a97);});});}function getAgent(_0x4b3a16){return db['User'][_0x78ca('0x20')]({'where':{'id':_0x4b3a16,'role':_0x78ca('0x21')}})[_0x78ca('0x1d')](checkError());}function getAgentCheckSession(_0x8781e3,_0x24c450){return new BPromise(function(_0x163062,_0x1d5a61){var _0x3a95b4=respondWithRpcPromise(_0x78ca('0x22'));var _0x2a9f56=getAgent(_0x8781e3);Promise['all']([_0x3a95b4,_0x2a9f56])[_0x78ca('0x1d')](function(_0x120f86){var _0x42a0e3=_0x120f86[0x0];var _0x5aeaff=_0x120f86[0x1];var _0x3a51bc=_[_0x78ca('0x23')](_0x42a0e3[_0x78ca('0x24')],function(_0x2cf94e){return _0x2cf94e[_0x78ca('0x25')]==_0x5aeaff['id']&&_0x2cf94e[_0x78ca('0x26')]==_0x24c450;});if(_0x3a51bc[_0x78ca('0x27')]==0x1){_0x163062(_0x5aeaff);}else{_0x1d5a61(new RangeError(_0x78ca('0x28')+_0x24c450+_0x78ca('0x29')));}});});}exports['originate']=function(_0xc55094,_0xdf32e7){logger[_0x78ca('0x2a')](_0x78ca('0x2b'),_0xc55094['body']);var _0x2b42d4=originateValidation['validate'](_0xc55094[_0x78ca('0x2c')]);if(_0x2b42d4[_0x78ca('0x27')]>0x0){return _0xdf32e7[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2b42d4);}var _0x35684d=_0xc55094[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x43ecc5=_0xc55094['body']['callNumber'];var _0x3f9f38=_0xc55094[_0x78ca('0x2c')]['callerId'];var _0x3a45de=_0xc55094['body'][_0x78ca('0x30')];return getAgent(_0x35684d)['then'](function(_0x39f76b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x39f76b[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x39f76b[_0x78ca('0x19')]),'webbar:originate',{'callNumber':_0x43ecc5,'callerId':_0x3f9f38,'callbackUrl':_0x3a45de});return _0xdf32e7[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x78ca('0x33')](handleError(_0xdf32e7));};exports[_0x78ca('0x34')]=function(_0xabc9a9,_0x4cb93a){logger[_0x78ca('0x2a')](_0x78ca('0x35'),_0xabc9a9[_0x78ca('0x2c')]);var _0x2e6d06=hangupValidation[_0x78ca('0xc')](_0xabc9a9[_0x78ca('0x2c')]);if(_0x2e6d06[_0x78ca('0x27')]>0x0){return _0x4cb93a[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2e6d06);}var _0x4e74fe=_0xabc9a9['body']['userId'];var _0x19f04d=_0xabc9a9['body'][_0x78ca('0x26')];return getAgent(_0x4e74fe)['then'](function(_0x5f58e7){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x5f58e7[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x5f58e7['name']),_0x78ca('0x37'),{'sessionId':_0x19f04d});return _0x4cb93a[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x38')});})['catch'](handleError(_0x4cb93a));};exports[_0x78ca('0x39')]=function(_0x310698,_0x4cbba8){logger['info'](_0x78ca('0x3a'),_0x310698[_0x78ca('0x2c')]);var _0x27017e=answerValidation[_0x78ca('0xc')](_0x310698[_0x78ca('0x2c')]);if(_0x27017e[_0x78ca('0x27')]>0x0){return _0x4cbba8[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x27017e);}var _0x59971a=_0x310698[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x12f1f2=_0x310698['body'][_0x78ca('0x26')];return getAgent(_0x59971a)['then'](function(_0xc34eef){logger['info'](_0x78ca('0x31'),_0xc34eef[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0xc34eef[_0x78ca('0x19')]),_0x78ca('0x3b'),{'sessionId':_0x12f1f2});return _0x4cbba8[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3c')});})[_0x78ca('0x33')](handleError(_0x4cbba8));};exports[_0x78ca('0x3d')]=function(_0x3b909e,_0x10df82){logger[_0x78ca('0x2a')]('hold\x20fired:',_0x3b909e['body']);var _0x173126=holdValidation['validate'](_0x3b909e[_0x78ca('0x2c')]);if(_0x173126['length']>0x0){return _0x10df82[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x173126);}var _0x19608f=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x4100b1=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x26')];return getAgent(_0x19608f)[_0x78ca('0x1d')](function(_0x557c2f){logger[_0x78ca('0x2a')]('entityFound:',_0x557c2f[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0x557c2f['name']),'webbar:hold',{'sessionId':_0x4100b1});return _0x10df82[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3e')});})['catch'](handleError(_0x10df82));};exports[_0x78ca('0x3f')]=function(_0x387529,_0x438154){logger[_0x78ca('0x2a')](_0x78ca('0x40'),_0x387529['body']);var _0x3c45ef=unholdValidation[_0x78ca('0xc')](_0x387529[_0x78ca('0x2c')]);if(_0x3c45ef[_0x78ca('0x27')]>0x0){return _0x438154[_0x78ca('0x2d')](0x190)['json'](_0x3c45ef);}var _0x487e39=_0x387529[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x3656d0=_0x387529['body'][_0x78ca('0x26')];return getAgent(_0x487e39)[_0x78ca('0x1d')](function(_0x179098){logger['info']('entityFound:',_0x179098[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x179098[_0x78ca('0x19')]),'webbar:unhold',{'sessionId':_0x3656d0});return _0x438154[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x41')});})[_0x78ca('0x33')](handleError(_0x438154));};exports[_0x78ca('0x42')]=function(_0x39a714,_0x2deab0){logger['info'](_0x78ca('0x43'),_0x2deab0['body']);var _0x390ed8=callsValidation[_0x78ca('0xc')](_0x39a714['body']);if(_0x390ed8[_0x78ca('0x27')]>0x0){return _0x2deab0['status'](0x190)[_0x78ca('0x2e')](_0x390ed8);}var _0x532872=_0x39a714[_0x78ca('0x2c')]['userId'];var _0x419cba=respondWithRpcPromise('VoiceChannels');var _0x58688e=getAgent(_0x532872);return Promise[_0x78ca('0x44')]([_0x419cba,_0x58688e])[_0x78ca('0x1d')](function(_0xd72ef3){var _0x2db637=_0xd72ef3[0x0];var _0x3afbf6=_0xd72ef3[0x1];var _0x106622=_[_0x78ca('0x23')](_0x2db637[_0x78ca('0x24')],function(_0x4b2e38){return _0x4b2e38[_0x78ca('0x25')]==_0x3afbf6['id'];});return _0x2deab0[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'count':_0x106622[_0x78ca('0x27')],'rows':_0x106622});})['catch'](handleError(_0x2deab0));};exports[_0x78ca('0x45')]=function(_0x2748ec,_0xd7099e){logger['info'](_0x78ca('0x46'),_0x2748ec[_0x78ca('0x2c')]);var _0x425e4b=conferenceValidation[_0x78ca('0xc')](_0x2748ec[_0x78ca('0x2c')]);if(_0x425e4b['length']>0x0){return _0xd7099e[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x425e4b);}var _0x406202=_0x2748ec[_0x78ca('0x2c')][_0x78ca('0x2f')];return getAgent(_0x406202)[_0x78ca('0x1d')](function(_0x20a11b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x20a11b[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x20a11b[_0x78ca('0x19')]),'webbar:conference');return _0xd7099e[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x47')});})['catch'](handleError(_0xd7099e));};exports[_0x78ca('0x48')]=function(_0x1f9121,_0x221ca9){logger['info']('transfer\x20fired:',_0x1f9121[_0x78ca('0x2c')]);var _0x21bd8e=transferValidation[_0x78ca('0xc')](_0x1f9121[_0x78ca('0x2c')]);if(_0x21bd8e[_0x78ca('0x27')]>0x0){return _0x221ca9[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x21bd8e);}var _0x3b715b=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x56c84c=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x26')];var _0x1ab40c=_0x1f9121[_0x78ca('0x2c')]['transferNumber'];return getAgent(_0x3b715b)[_0x78ca('0x1d')](function(_0x1da8dd){logger['info']('entityFound:',_0x1da8dd[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x1da8dd[_0x78ca('0x19')]),_0x78ca('0x49'),{'sessionId':_0x56c84c,'transferNumber':_0x1ab40c});return _0x221ca9[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x4a')});})[_0x78ca('0x33')](handleError(_0x221ca9));}; \ No newline at end of file +var _0x2b52=['defaults','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','originate\x20executed!','hangup','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis'];(function(_0x364610,_0x282939){var _0x568a3a=function(_0x3eacb9){while(--_0x3eacb9){_0x364610['push'](_0x364610['shift']());}};_0x568a3a(++_0x282939);}(_0x2b52,0x12a));var _0x22b5=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x2b52[_0x4d613c];return _0x301fe3;};'use strict';var path=require(_0x22b5('0x0'));var fs=require('fs');var _=require(_0x22b5('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x22b5('0x2'));var util=require(_0x22b5('0x3'));var BPromise=require(_0x22b5('0x4'));var jayson=require(_0x22b5('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x22b5('0x6'))(_0x22b5('0x7'));var Redis=require(_0x22b5('0x8'));config[_0x22b5('0x9')]=_[_0x22b5('0xa')](config[_0x22b5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x22b5('0xb'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'callNumber':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0xe')]},'callerId':{'type':_0x22b5('0xd')},'callbackUrl':{'type':_0x22b5('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0x10')]},'transferNumber':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]}});function emit(_0x235fba,_0x29ceb1,_0x3f5cf8){logger[_0x22b5('0x12')](_0x235fba,_0x29ceb1,JSON[_0x22b5('0x13')](_0x3f5cf8));io['to'](_0x235fba)[_0x22b5('0x14')](_0x29ceb1,_0x3f5cf8);}function handleError(_0x3decc2){return function(_0x1f41b9){console[_0x22b5('0x15')]('handleError:',_0x1f41b9,_0x1f41b9 instanceof RangeError);logger[_0x22b5('0x16')](_0x1f41b9[_0x22b5('0x17')]);if(_0x1f41b9 instanceof RangeError){if(_0x1f41b9[_0x22b5('0x18')]){delete _0x1f41b9[_0x22b5('0x18')];}_0x3decc2[_0x22b5('0x19')](0x194)['send'](_0x1f41b9);}else{if(_0x1f41b9[_0x22b5('0x18')]){delete _0x1f41b9[_0x22b5('0x18')];}_0x3decc2[_0x22b5('0x19')](0x1f4)['send'](_0x1f41b9);}};}function checkError(){return function(_0x4f6f48){if(!_0x4f6f48){throw new RangeError(_0x22b5('0x1a'));}return _0x4f6f48;};}function respondWithRpcPromise(_0x2ef0df,_0x3ca329){return new BPromise(function(_0x4becc2,_0x3b0c31){var _0x132c88=amiClient;return _0x132c88[_0x22b5('0x1b')](_0x2ef0df,_0x3ca329)[_0x22b5('0x1c')](function(_0x156b50){if(_0x156b50[_0x22b5('0x16')]){if(_0x156b50[_0x22b5('0x16')][_0x22b5('0x1d')]===0x1f4){return _0x3b0c31(_0x156b50[_0x22b5('0x16')]['message']);}return _0x4becc2(_0x156b50['error'][_0x22b5('0x1e')]);}else{_0x4becc2(_0x156b50[_0x22b5('0x1f')]);}})[_0x22b5('0x20')](function(_0x3070b2){_0x3b0c31(_0x3070b2);});});}function getAgent(_0x331012){return db[_0x22b5('0x21')][_0x22b5('0x22')]({'where':{'id':_0x331012,'role':_0x22b5('0x23')}})[_0x22b5('0x1c')](checkError());}function getAgentCheckSession(_0x26b956,_0x3d495f){return new BPromise(function(_0x196953,_0x22f2e8){var _0xc03b6f=respondWithRpcPromise(_0x22b5('0x24'));var _0x516f79=getAgent(_0x26b956);Promise['all']([_0xc03b6f,_0x516f79])[_0x22b5('0x1c')](function(_0x11dfa0){var _0x3ac2f8=_0x11dfa0[0x0];var _0x1e6bec=_0x11dfa0[0x1];var _0x513a5b=_[_0x22b5('0x25')](_0x3ac2f8[_0x22b5('0x26')],function(_0x1f6d09){return _0x1f6d09[_0x22b5('0x27')]==_0x1e6bec['id']&&_0x1f6d09['sessionId']==_0x3d495f;});if(_0x513a5b[_0x22b5('0x28')]==0x1){_0x196953(_0x1e6bec);}else{_0x22f2e8(new RangeError('sessionId\x20'+_0x3d495f+_0x22b5('0x29')));}});});}exports[_0x22b5('0x2a')]=function(_0x2cc80a,_0x96ffee){logger['info'](_0x22b5('0x2b'),_0x2cc80a[_0x22b5('0x2c')]);var _0x1899c1=originateValidation['validate'](_0x2cc80a[_0x22b5('0x2c')]);if(_0x1899c1[_0x22b5('0x28')]>0x0){return _0x96ffee[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x1899c1);}var _0x5df7f9=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x21ab64=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x2f')];var _0x1fe1ab=_0x2cc80a['body'][_0x22b5('0x30')];var _0x2008e4=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x31')];return getAgent(_0x5df7f9)[_0x22b5('0x1c')](function(_0x50fc9d){logger[_0x22b5('0x12')]('entityFound:',_0x50fc9d[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x50fc9d[_0x22b5('0x18')]),'webbar:originate',{'callNumber':_0x21ab64,'callerId':_0x1fe1ab,'callbackUrl':_0x2008e4});return _0x96ffee['status'](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x34')});})[_0x22b5('0x20')](handleError(_0x96ffee));};exports[_0x22b5('0x35')]=function(_0x7cced9,_0x1997fc){logger[_0x22b5('0x12')]('hangup\x20fired:',_0x7cced9[_0x22b5('0x2c')]);var _0x532a12=hangupValidation['validate'](_0x7cced9['body']);if(_0x532a12['length']>0x0){return _0x1997fc[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x532a12);}var _0x34db2c=_0x7cced9[_0x22b5('0x2c')]['userId'];var _0x3ec27e=_0x7cced9['body'][_0x22b5('0x36')];return getAgent(_0x34db2c)[_0x22b5('0x1c')](function(_0x84d0bc){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x84d0bc[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x84d0bc[_0x22b5('0x18')]),_0x22b5('0x38'),{'sessionId':_0x3ec27e});return _0x1997fc[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x39')});})[_0x22b5('0x20')](handleError(_0x1997fc));};exports[_0x22b5('0x3a')]=function(_0x257d4a,_0x18c231){logger['info'](_0x22b5('0x3b'),_0x257d4a['body']);var _0x2b9da0=answerValidation[_0x22b5('0x3c')](_0x257d4a[_0x22b5('0x2c')]);if(_0x2b9da0['length']>0x0){return _0x18c231[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x2b9da0);}var _0x1aaf43=_0x257d4a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x2bd24b=_0x257d4a[_0x22b5('0x2c')][_0x22b5('0x36')];return getAgent(_0x1aaf43)[_0x22b5('0x1c')](function(_0x28080e){logger[_0x22b5('0x12')]('entityFound:',_0x28080e[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x28080e[_0x22b5('0x18')]),_0x22b5('0x3d'),{'sessionId':_0x2bd24b});return _0x18c231['status'](0xc8)[_0x22b5('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x22b5('0x20')](handleError(_0x18c231));};exports['hold']=function(_0x20f607,_0x3d64d9){logger['info'](_0x22b5('0x3e'),_0x20f607[_0x22b5('0x2c')]);var _0x3a8df5=holdValidation[_0x22b5('0x3c')](_0x20f607[_0x22b5('0x2c')]);if(_0x3a8df5[_0x22b5('0x28')]>0x0){return _0x3d64d9[_0x22b5('0x19')](0x190)['json'](_0x3a8df5);}var _0xc439e2=_0x20f607[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x3759af=_0x20f607[_0x22b5('0x2c')]['sessionId'];return getAgent(_0xc439e2)[_0x22b5('0x1c')](function(_0x398c8d){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x398c8d[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x398c8d[_0x22b5('0x18')]),_0x22b5('0x3f'),{'sessionId':_0x3759af});return _0x3d64d9[_0x22b5('0x19')](0xc8)['json']({'error':![],'message':_0x22b5('0x40')});})[_0x22b5('0x20')](handleError(_0x3d64d9));};exports[_0x22b5('0x41')]=function(_0x14a8c2,_0x30ab23){logger[_0x22b5('0x12')](_0x22b5('0x42'),_0x14a8c2[_0x22b5('0x2c')]);var _0x2e32b8=unholdValidation[_0x22b5('0x3c')](_0x14a8c2[_0x22b5('0x2c')]);if(_0x2e32b8['length']>0x0){return _0x30ab23[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x2e32b8);}var _0x31faa2=_0x14a8c2['body']['userId'];var _0x46be6e=_0x14a8c2[_0x22b5('0x2c')][_0x22b5('0x36')];return getAgent(_0x31faa2)[_0x22b5('0x1c')](function(_0x4bbc1d){logger[_0x22b5('0x12')]('entityFound:',_0x4bbc1d['name']);emit(util[_0x22b5('0x32')]('user:%s',_0x4bbc1d[_0x22b5('0x18')]),_0x22b5('0x43'),{'sessionId':_0x46be6e});return _0x30ab23[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x44')});})['catch'](handleError(_0x30ab23));};exports[_0x22b5('0x45')]=function(_0x4aa074,_0xd191ae){logger[_0x22b5('0x12')]('calls\x20fired:',_0xd191ae[_0x22b5('0x2c')]);var _0x5006e6=callsValidation[_0x22b5('0x3c')](_0x4aa074[_0x22b5('0x2c')]);if(_0x5006e6['length']>0x0){return _0xd191ae[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x5006e6);}var _0x2fa911=_0x4aa074[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x5657b6=respondWithRpcPromise('VoiceChannels');var _0x54a332=getAgent(_0x2fa911);return Promise['all']([_0x5657b6,_0x54a332])['then'](function(_0x900913){var _0x4707b6=_0x900913[0x0];var _0xbae105=_0x900913[0x1];var _0x27c198=_[_0x22b5('0x25')](_0x4707b6[_0x22b5('0x26')],function(_0x5c6794){return _0x5c6794[_0x22b5('0x27')]==_0xbae105['id'];});return _0xd191ae[_0x22b5('0x19')](0xc8)['json']({'count':_0x27c198['length'],'rows':_0x27c198});})[_0x22b5('0x20')](handleError(_0xd191ae));};exports[_0x22b5('0x46')]=function(_0x594b51,_0x18e345){logger[_0x22b5('0x12')]('conference\x20fired:',_0x594b51[_0x22b5('0x2c')]);var _0x464ec4=conferenceValidation[_0x22b5('0x3c')](_0x594b51['body']);if(_0x464ec4[_0x22b5('0x28')]>0x0){return _0x18e345[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x464ec4);}var _0x3fba9e=_0x594b51[_0x22b5('0x2c')]['userId'];return getAgent(_0x3fba9e)[_0x22b5('0x1c')](function(_0x8a9aef){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x8a9aef[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x8a9aef[_0x22b5('0x18')]),_0x22b5('0x47'));return _0x18e345[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x48')});})[_0x22b5('0x20')](handleError(_0x18e345));};exports[_0x22b5('0x49')]=function(_0x30a68a,_0x5b877b){logger[_0x22b5('0x12')](_0x22b5('0x4a'),_0x30a68a[_0x22b5('0x2c')]);var _0x1fdb23=transferValidation['validate'](_0x30a68a[_0x22b5('0x2c')]);if(_0x1fdb23['length']>0x0){return _0x5b877b[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x1fdb23);}var _0x3e063a=_0x30a68a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x5d4895=_0x30a68a[_0x22b5('0x2c')][_0x22b5('0x36')];var _0xc40c33=_0x30a68a['body']['transferNumber'];return getAgent(_0x3e063a)[_0x22b5('0x1c')](function(_0x118e3c){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x118e3c[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x118e3c[_0x22b5('0x18')]),_0x22b5('0x4b'),{'sessionId':_0x5d4895,'transferNumber':_0xc40c33});return _0x5b877b[_0x22b5('0x19')](0xc8)['json']({'error':![],'message':_0x22b5('0x4c')});})[_0x22b5('0x20')](handleError(_0x5b877b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8dc5eeb..09e548f 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9a=['post','create','addDisposition','addAnswer','/:id/applications','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x1c9a,0x98));var _0xa1c9=function(_0x5f53f6,_0x91157e){_0x5f53f6=_0x5f53f6-0x0;var _0xb8628=_0x1c9a[_0x5f53f6];return _0xb8628;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/describe',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0x7')](_0xa1c9('0xb'),auth['isAuthenticated'](),controller[_0xa1c9('0xc')]);router[_0xa1c9('0x7')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xe')]);router[_0xa1c9('0x7')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x7')]('/:id/applications',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')]('/',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x13')]);router['post'](_0xa1c9('0xb'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x14')]);router[_0xa1c9('0x12')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x15')]);router[_0xa1c9('0x12')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller['addAgents']);router[_0xa1c9('0x12')](_0xa1c9('0x16'),auth[_0xa1c9('0x8')](),controller['addApplications']);router[_0xa1c9('0x12')]('/:id/notify',controller[_0xa1c9('0x17')]);router[_0xa1c9('0x12')](_0xa1c9('0x18'),auth['isAuthenticated'](),controller[_0xa1c9('0x19')]);router[_0xa1c9('0x1a')](_0xa1c9('0x1b'),auth['isAuthenticated'](),controller[_0xa1c9('0x1c')]);router[_0xa1c9('0x1d')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1e')]);router[_0xa1c9('0x1d')]('/:id/dispositions',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1f')]);router[_0xa1c9('0x1d')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller['removeAnswers']);router['delete'](_0xa1c9('0xf'),auth['isAuthenticated'](),controller[_0xa1c9('0x20')]);module[_0xa1c9('0x21')]=router; \ No newline at end of file +var _0xe820=['delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','/:id/dispositions','post','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','destroy'];(function(_0x2b010d,_0x357f85){var _0x2e7627=function(_0x50fdff){while(--_0x50fdff){_0x2b010d['push'](_0x2b010d['shift']());}};_0x2e7627(++_0x357f85);}(_0xe820,0xd2));var _0x0e82=function(_0x405a2a,_0x15b978){_0x405a2a=_0x405a2a-0x0;var _0x3b2603=_0xe820[_0x405a2a];return _0x3b2603;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var auth=require(_0x0e82('0x3'));var interaction=require(_0x0e82('0x4'));var config=require('../../config/environment');var controller=require(_0x0e82('0x5'));router['get']('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0x7')]);router[_0x0e82('0x8')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller['describe']);router[_0x0e82('0x8')](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xb')]);router[_0x0e82('0x8')]('/:id/dispositions',auth[_0x0e82('0x6')](),controller[_0x0e82('0xc')]);router[_0x0e82('0x8')](_0x0e82('0xd'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xe')]);router[_0x0e82('0x8')]('/:id/users',auth[_0x0e82('0x6')](),controller[_0x0e82('0xf')]);router[_0x0e82('0x8')](_0x0e82('0x10'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x11')]);router['post']('/',auth[_0x0e82('0x6')](),controller['create']);router['post'](_0x0e82('0x12'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x0e82('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x0e82('0x13')]('/:id/users',auth[_0x0e82('0x6')](),controller[_0x0e82('0x14')]);router[_0x0e82('0x13')](_0x0e82('0x10'),auth['isAuthenticated'](),controller[_0x0e82('0x15')]);router[_0x0e82('0x13')](_0x0e82('0x16'),controller[_0x0e82('0x17')]);router[_0x0e82('0x13')](_0x0e82('0x18'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x19')]);router[_0x0e82('0x1a')](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller['update']);router['delete'](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x1b')]);router[_0x0e82('0x1c')](_0x0e82('0x12'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x1d')]);router[_0x0e82('0x1c')]('/:id/canned_answers',auth[_0x0e82('0x6')](),controller[_0x0e82('0x1e')]);router[_0x0e82('0x1c')](_0x0e82('0x1f'),auth['isAuthenticated'](),controller[_0x0e82('0x20')]);module[_0x0e82('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ae72864..90e747f 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 _0x4fc7=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','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'];(function(_0xd3bcf8,_0x994fdb){var _0x296170=function(_0x2f5519){while(--_0x2f5519){_0xd3bcf8['push'](_0xd3bcf8['shift']());}};_0x296170(++_0x994fdb);}(_0x4fc7,0x12d));var _0x74fc=function(_0x21ec68,_0x175b7e){_0x21ec68=_0x21ec68-0x0;var _0x5f3249=_0x4fc7[_0x21ec68];return _0x5f3249;};'use strict';var Sequelize=require(_0x74fc('0x0'));var rs=require(_0x74fc('0x1'));module[_0x74fc('0x2')]={'name':{'type':Sequelize[_0x74fc('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x74fc('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x74fc('0x3')]},'type':{'type':Sequelize[_0x74fc('0x4')](_0x74fc('0x5'))},'accountSid':{'type':Sequelize[_0x74fc('0x3')]},'authToken':{'type':Sequelize[_0x74fc('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x74fc('0x6');}},'notificationSound':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x74fc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x74fc('0x8')],'comment':_0x74fc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x74fc('0x7')],'defaultValue':![],'comment':_0x74fc('0xa'),'set':function(_0x1b3b1b){if(!_0x1b3b1b){this['setDataValue'](_0x74fc('0xb'),null);}this['setDataValue'](_0x74fc('0xc'),_0x1b3b1b);}},'description':{'type':Sequelize[_0x74fc('0x3')]}}; \ No newline at end of file +var _0x5f62=['mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','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'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x5f62,0x178));var _0x25f6=function(_0x19a2eb,_0x2df439){_0x19a2eb=_0x19a2eb-0x0;var _0x3c8514=_0x5f62[_0x19a2eb];return _0x3c8514;};'use strict';var Sequelize=require(_0x25f6('0x0'));var rs=require(_0x25f6('0x1'));module[_0x25f6('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x25f6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x25f6('0x3')],'defaultValue':function(){return rs[_0x25f6('0x4')]();}},'phone':{'type':Sequelize[_0x25f6('0x3')]},'type':{'type':Sequelize[_0x25f6('0x5')](_0x25f6('0x6'))},'accountSid':{'type':Sequelize[_0x25f6('0x3')]},'authToken':{'type':Sequelize[_0x25f6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x25f6('0x7')],'defaultValue':function(){return _0x25f6('0x8');}},'notificationSound':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x25f6('0xa')],'comment':_0x25f6('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12abf7){if(!_0x12abf7){this[_0x25f6('0xc')](_0x25f6('0xd'),null);}this['setDataValue'](_0x25f6('0xe'),_0x12abf7);}},'description':{'type':Sequelize[_0x25f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8e6f8ab..9d4497c 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 _0xcb80=['keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','applications','orderBy','Applications','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','*,*,*,*','Start','startRouting','entity\x20found','stringify','\x0a','List','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','reject','destroy','get','stack','send','index','Pause','map','WhatsappAccount','fieldName','type','key'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0xcb80,0x1eb));var _0x0cb8=function(_0x50b48d,_0xe766bd){_0x50b48d=_0x50b48d-0x0;var _0x40ebf0=_0xcb80[_0x50b48d];return _0x40ebf0;};'use strict';var pdf=require(_0x0cb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cb8('0x2'));var rp=require(_0x0cb8('0x3'));var moment=require(_0x0cb8('0x4'));var BPromise=require(_0x0cb8('0x5'));var Mustache=require(_0x0cb8('0x6'));var util=require(_0x0cb8('0x7'));var path=require(_0x0cb8('0x8'));var sox=require(_0x0cb8('0x9'));var csv=require(_0x0cb8('0xa'));var ejs=require(_0x0cb8('0xb'));var fs=require('fs');var _=require(_0x0cb8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cb8('0xd'));var deskjs=require(_0x0cb8('0xe'));var toCsv=require(_0x0cb8('0xa'));var querystring=require('querystring');var Papa=require(_0x0cb8('0xf'));var Redis=require(_0x0cb8('0x10'));var authService=require(_0x0cb8('0x11'));var qs=require(_0x0cb8('0x12'));var as=require(_0x0cb8('0x13'));var hardwareService=require(_0x0cb8('0x14'));var logger=require(_0x0cb8('0x15'))(_0x0cb8('0x16'));var utils=require('../../config/utils');var config=require(_0x0cb8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cb8('0x18'))['db'];config[_0x0cb8('0x19')]=_[_0x0cb8('0x1a')](config[_0x0cb8('0x19')],{'host':_0x0cb8('0x1b'),'port':0x18eb});var socket=require(_0x0cb8('0x1c'))(new Redis(config[_0x0cb8('0x19')]));require('./whatsappAccount.socket')[_0x0cb8('0x1d')](socket);var jayson=require(_0x0cb8('0x1e'));var client=jayson[_0x0cb8('0x1f')][_0x0cb8('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x17ea11,_0x2c3d08,_0x32b4d2,_0x5689d4){return new BPromise(function(_0x358911,_0x42ec5c){var _0x5bbb49=_0x5689d4||client;return _0x5bbb49[_0x0cb8('0x21')](_0x17ea11,_0x32b4d2)[_0x0cb8('0x22')](function(_0x200fec){logger[_0x0cb8('0x23')](_0x0cb8('0x24'),_0x2c3d08,_0x0cb8('0x25'));logger[_0x0cb8('0x26')](_0x0cb8('0x27'),_0x2c3d08,_0x0cb8('0x25'),JSON['stringify'](_0x200fec));if(_0x200fec[_0x0cb8('0x28')]){if(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x29')]===0x1f4){logger[_0x0cb8('0x28')](_0x0cb8('0x24'),_0x2c3d08,_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);return _0x42ec5c(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);}logger[_0x0cb8('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x2c3d08,_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);return _0x358911(_0x200fec[_0x0cb8('0x28')][_0x0cb8('0x2a')]);}else{logger[_0x0cb8('0x23')](_0x0cb8('0x24'),_0x2c3d08,_0x0cb8('0x25'));_0x358911(_0x200fec[_0x0cb8('0x2b')][_0x0cb8('0x2a')]);}})['catch'](function(_0x52b74e){logger[_0x0cb8('0x28')](_0x0cb8('0x24'),_0x2c3d08,_0x52b74e);_0x42ec5c(_0x52b74e);});});}function respondWithStatusCode(_0x300fe6,_0x1faf38){_0x1faf38=_0x1faf38||0xcc;return function(_0x2092a5){if(_0x2092a5){return _0x300fe6[_0x0cb8('0x2c')](_0x1faf38);}return _0x300fe6['status'](_0x1faf38)[_0x0cb8('0x2d')]();};}function respondWithResult(_0x8d105a,_0x37ff0b){_0x37ff0b=_0x37ff0b||0xc8;return function(_0x384827){if(_0x384827){return _0x8d105a[_0x0cb8('0x2e')](_0x37ff0b)[_0x0cb8('0x2f')](_0x384827);}};}function respondWithFilteredResult(_0x3924c8,_0x469ae2){return function(_0x39c592){if(_0x39c592){var _0x2e10d7=_0x39c592[_0x0cb8('0x30')],_0x3fb69c=_0x469ae2['offset'],_0x193160=_0x469ae2[_0x0cb8('0x31')]+_0x469ae2[_0x0cb8('0x32')],_0x25b293;if(_0x193160>=_0x2e10d7){_0x193160=_0x2e10d7;_0x25b293=0xc8;}else{_0x25b293=0xce;}_0x3924c8[_0x0cb8('0x2e')](_0x25b293);return _0x3924c8[_0x0cb8('0x33')]('Content-Range',_0x3fb69c+'-'+_0x193160+'/'+_0x2e10d7)[_0x0cb8('0x2f')](_0x39c592);}return null;};}function patchUpdates(_0x13591a){return function(_0x1d2701){try{jsonpatch['apply'](_0x1d2701,_0x13591a,!![]);}catch(_0x5638b8){return BPromise[_0x0cb8('0x34')](_0x5638b8);}return _0x1d2701['save']();};}function saveUpdates(_0x4bc33b,_0x567e71){return function(_0x59210a){if(_0x59210a){return _0x59210a['update'](_0x4bc33b)[_0x0cb8('0x22')](function(_0x5e5231){return _0x5e5231;});}return null;};}function removeEntity(_0x593f55,_0x56f779){return function(_0x537e7d){if(_0x537e7d){return _0x537e7d[_0x0cb8('0x35')]()[_0x0cb8('0x22')](function(){var _0x41e1d5=_0x537e7d[_0x0cb8('0x36')]({'plain':!![]});var _0x3d6d70='WhatsappAccounts';return db['UserProfileResource'][_0x0cb8('0x35')]({'where':{'type':_0x3d6d70,'resourceId':_0x41e1d5['id']}})[_0x0cb8('0x22')](function(){return _0x537e7d;});})[_0x0cb8('0x22')](function(){_0x593f55[_0x0cb8('0x2e')](0xcc)[_0x0cb8('0x2d')]();});}};}function handleEntityNotFound(_0x42d6ba,_0x3783ac){return function(_0x3ae157){if(!_0x3ae157){_0x42d6ba[_0x0cb8('0x2c')](0x194);}return _0x3ae157;};}function handleError(_0x42a1b5,_0x15d473){_0x15d473=_0x15d473||0x1f4;return function(_0x277e0e){logger[_0x0cb8('0x28')](_0x277e0e[_0x0cb8('0x37')]);if(_0x277e0e['name']){delete _0x277e0e['name'];}_0x42a1b5['status'](_0x15d473)[_0x0cb8('0x38')](_0x277e0e);};}exports[_0x0cb8('0x39')]=function(_0x510e23,_0x10a635){var _0x5f561e={'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]},_0x35c059={},_0x1ca3c1={'count':0x0,'rows':[]};var _0x1ef6d8=_[_0x0cb8('0x3b')](db[_0x0cb8('0x3c')]['rawAttributes'],function(_0x3c435d){return{'name':_0x3c435d[_0x0cb8('0x3d')],'type':_0x3c435d[_0x0cb8('0x3e')][_0x0cb8('0x3f')]};});_0x35c059['model']=_['map'](_0x1ef6d8,'name');_0x35c059['query']=_[_0x0cb8('0x40')](_0x510e23[_0x0cb8('0x41')]);_0x35c059[_0x0cb8('0x42')]=_['intersection'](_0x35c059[_0x0cb8('0x43')],_0x35c059[_0x0cb8('0x41')]);_0x5f561e[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0x35c059[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0x5f561e[_0x0cb8('0x44')]=_0x5f561e[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x5f561e[_0x0cb8('0x44')]:_0x35c059[_0x0cb8('0x43')];if(!_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x5f561e['limit']=qs[_0x0cb8('0x32')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0x5f561e['offset']=qs[_0x0cb8('0x31')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0x5f561e[_0x0cb8('0x4a')]=qs[_0x0cb8('0x4b')](_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0x5f561e[_0x0cb8('0x4c')]=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x510e23[_0x0cb8('0x41')],_0x35c059[_0x0cb8('0x42')]),_0x1ef6d8);if(_0x510e23[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x5f561e[_0x0cb8('0x4c')]=_['merge'](_0x5f561e[_0x0cb8('0x4c')],{'$or':_['map'](_0x1ef6d8,function(_0x240b16){if(_0x240b16['type']!==_0x0cb8('0x4f')){var _0x581217={};_0x581217[_0x240b16[_0x0cb8('0x50')]]={'$like':'%'+_0x510e23[_0x0cb8('0x41')]['filter']+'%'};return _0x581217;}})});}_0x5f561e=_[_0x0cb8('0x51')]({},_0x5f561e,_0x510e23[_0x0cb8('0x52')]);var _0x12f2ad={'where':_0x5f561e[_0x0cb8('0x4c')]};return db[_0x0cb8('0x3c')][_0x0cb8('0x30')](_0x12f2ad)[_0x0cb8('0x22')](function(_0x3c8709){_0x1ca3c1[_0x0cb8('0x30')]=_0x3c8709;if(_0x510e23['query']['includeAll']){_0x5f561e[_0x0cb8('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x0cb8('0x54')](_0x5f561e);})[_0x0cb8('0x22')](function(_0x1d0800){_0x1ca3c1[_0x0cb8('0x55')]=_0x1d0800;return _0x1ca3c1;})[_0x0cb8('0x22')](respondWithFilteredResult(_0x10a635,_0x5f561e))[_0x0cb8('0x56')](handleError(_0x10a635,null));};exports[_0x0cb8('0x57')]=function(_0x40295,_0x13e587){var _0x814f66={'raw':![],'where':{'id':_0x40295[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4d71f5={};_0x4d71f5[_0x0cb8('0x43')]=_[_0x0cb8('0x40')](db[_0x0cb8('0x3c')][_0x0cb8('0x59')]);_0x4d71f5[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x40295[_0x0cb8('0x41')]);_0x4d71f5[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x4d71f5[_0x0cb8('0x43')],_0x4d71f5['query']);_0x814f66[_0x0cb8('0x44')]=_['intersection'](_0x4d71f5[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x40295['query'][_0x0cb8('0x46')]));_0x814f66[_0x0cb8('0x44')]=_0x814f66[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x814f66['attributes']:_0x4d71f5[_0x0cb8('0x43')];if(_0x40295[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0x814f66[_0x0cb8('0x53')]=[{'all':!![]}];}_0x814f66=_[_0x0cb8('0x51')]({},_0x814f66,_0x40295[_0x0cb8('0x52')]);return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')](_0x814f66)[_0x0cb8('0x22')](handleEntityNotFound(_0x13e587,null))[_0x0cb8('0x22')](respondWithResult(_0x13e587,null))[_0x0cb8('0x56')](handleError(_0x13e587,null));};exports[_0x0cb8('0x5c')]=function(_0x3206dc,_0x3f00bf){return db[_0x0cb8('0x3c')][_0x0cb8('0x5c')](_0x3206dc[_0x0cb8('0x5d')],{})[_0x0cb8('0x22')](function(_0x339b1a){var _0xd56683=_0x3206dc['user'][_0x0cb8('0x36')]({'plain':!![]});if(!_0xd56683)throw new Error(_0x0cb8('0x5e'));if(_0xd56683[_0x0cb8('0x5f')]===_0x0cb8('0x60')){var _0x1b6734=_0x339b1a[_0x0cb8('0x36')]({'plain':!![]});var _0x279af6=_0x0cb8('0x61');return db[_0x0cb8('0x62')]['find']({'where':{'name':_0x279af6,'userProfileId':_0xd56683['userProfileId']},'raw':!![]})[_0x0cb8('0x22')](function(_0x428256){if(_0x428256&&_0x428256[_0x0cb8('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b6734[_0x0cb8('0x50')],'resourceId':_0x1b6734['id'],'type':_0x428256[_0x0cb8('0x50')],'sectionId':_0x428256['id']},{})[_0x0cb8('0x22')](function(){return _0x339b1a;});}else{return _0x339b1a;}})[_0x0cb8('0x56')](function(_0x46ce41){logger['error'](_0x0cb8('0x64'),_0x46ce41);throw _0x46ce41;});}return _0x339b1a;})[_0x0cb8('0x22')](respondWithResult(_0x3f00bf,0xc9))[_0x0cb8('0x56')](handleError(_0x3f00bf,null));};exports[_0x0cb8('0x65')]=function(_0x382a53,_0x4ba948){if(_0x382a53['body']['id']){delete _0x382a53['body']['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x382a53[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4ba948,null))['then'](saveUpdates(_0x382a53[_0x0cb8('0x5d')],null))[_0x0cb8('0x22')](respondWithResult(_0x4ba948,null))[_0x0cb8('0x56')](handleError(_0x4ba948,null));};exports[_0x0cb8('0x35')]=function(_0x1c98c5,_0x295108){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x1c98c5[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x295108,null))[_0x0cb8('0x22')](removeEntity(_0x295108,null))['catch'](handleError(_0x295108,null));};exports[_0x0cb8('0x66')]=function(_0x3c422e,_0x5ae3c2){return db[_0x0cb8('0x3c')][_0x0cb8('0x66')]()[_0x0cb8('0x22')](respondWithResult(_0x5ae3c2,null))[_0x0cb8('0x56')](handleError(_0x5ae3c2,null));};exports[_0x0cb8('0x67')]=function(_0x4b45f5,_0x5411bb,_0x5d0013){if(_0x4b45f5[_0x0cb8('0x5d')]['id']){delete _0x4b45f5['body']['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x4b45f5[_0x0cb8('0x58')]['id']}})['then'](handleEntityNotFound(_0x5411bb,null))[_0x0cb8('0x22')](function(_0x3e4805){if(_0x3e4805){_0x4b45f5['body'][_0x0cb8('0x68')]=_0x3e4805['id'];return db['Disposition'][_0x0cb8('0x5c')](_0x4b45f5[_0x0cb8('0x5d')]);}})[_0x0cb8('0x22')](respondWithResult(_0x5411bb,null))[_0x0cb8('0x56')](handleError(_0x5411bb,null));};exports[_0x0cb8('0x69')]=function(_0x543288,_0xec30de,_0x2346f7){var _0xfd0019={'raw':![],'where':{}};var _0x396986={};var _0x5d5513={'count':0x0,'rows':[]};return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x543288[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0xec30de,null))[_0x0cb8('0x22')](function(_0xb24658){if(_0xb24658){_0x396986['model']=_[_0x0cb8('0x40')](db[_0x0cb8('0x6b')][_0x0cb8('0x59')]);_0x396986['query']=_[_0x0cb8('0x40')](_0x543288['query']);_0x396986[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x396986[_0x0cb8('0x43')],_0x396986['query']);_0xfd0019[_0x0cb8('0x44')]=_['intersection'](_0x396986[_0x0cb8('0x43')],qs[_0x0cb8('0x46')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0xfd0019[_0x0cb8('0x44')]=_0xfd0019['attributes'][_0x0cb8('0x47')]?_0xfd0019['attributes']:_0x396986[_0x0cb8('0x43')];if(!_0x543288[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0xfd0019[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0xfd0019[_0x0cb8('0x31')]=qs['offset'](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0xfd0019['order']=qs[_0x0cb8('0x4b')](_0x543288[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0xfd0019['where']=qs['filters'](_[_0x0cb8('0x4d')](_0x543288[_0x0cb8('0x41')],_0x396986[_0x0cb8('0x42')]));_0xfd0019[_0x0cb8('0x4c')][_0x0cb8('0x68')]=_0xb24658['id'];if(_0x543288[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0xfd0019[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0xfd0019[_0x0cb8('0x4c')],{'$or':_[_0x0cb8('0x3b')](_0xfd0019['attributes'],function(_0x5b96c9){var _0x39cbce={};_0x39cbce[_0x5b96c9]={'$like':'%'+_0x543288['query'][_0x0cb8('0x4e')]+'%'};return _0x39cbce;})});}_0xfd0019=_[_0x0cb8('0x51')]({},_0xfd0019,_0x543288[_0x0cb8('0x52')]);return db[_0x0cb8('0x6b')][_0x0cb8('0x30')]({'where':_0xfd0019[_0x0cb8('0x4c')]})[_0x0cb8('0x22')](function(_0x12e8f6){_0x5d5513['count']=_0x12e8f6;if(_0x543288[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0xfd0019['include']=[{'all':!![]}];}return db[_0x0cb8('0x6b')][_0x0cb8('0x54')](_0xfd0019);})[_0x0cb8('0x22')](function(_0x88faf4){_0x5d5513[_0x0cb8('0x55')]=_0x88faf4;return _0x5d5513;});}})[_0x0cb8('0x22')](respondWithFilteredResult(_0xec30de,_0xfd0019))[_0x0cb8('0x56')](handleError(_0xec30de,null));};exports[_0x0cb8('0x6c')]=function(_0x136d61,_0x1277fc,_0x190aca){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x136d61[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1277fc,null))[_0x0cb8('0x22')](function(_0x278f7e){if(_0x278f7e){return _0x278f7e[_0x0cb8('0x6c')](_0x136d61['query'][_0x0cb8('0x6d')]);}})[_0x0cb8('0x22')](respondWithStatusCode(_0x1277fc,null))[_0x0cb8('0x56')](handleError(_0x1277fc,null));};exports[_0x0cb8('0x6e')]=function(_0x1961fc,_0x300566,_0x5fa69d){if(_0x1961fc[_0x0cb8('0x5d')]['id']){delete _0x1961fc[_0x0cb8('0x5d')]['id'];}return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x1961fc[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x300566,null))[_0x0cb8('0x22')](function(_0x140d8a){if(_0x140d8a){_0x1961fc[_0x0cb8('0x5d')]['WhatsappAccountId']=_0x140d8a['id'];return db[_0x0cb8('0x6f')][_0x0cb8('0x5c')](_0x1961fc[_0x0cb8('0x5d')]);}})[_0x0cb8('0x22')](respondWithResult(_0x300566,null))[_0x0cb8('0x56')](handleError(_0x300566,null));};exports[_0x0cb8('0x70')]=function(_0x369f5a,_0xfd73e,_0x44dfbd){var _0x17a617={'raw':![],'where':{}};var _0x2edae2={};var _0x2353d6={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x369f5a[_0x0cb8('0x58')]['id']}})['then'](handleEntityNotFound(_0xfd73e,null))[_0x0cb8('0x22')](function(_0x4aa745){if(_0x4aa745){_0x2edae2['model']=_['keys'](db[_0x0cb8('0x6f')]['rawAttributes']);_0x2edae2[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x369f5a[_0x0cb8('0x41')]);_0x2edae2[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x2edae2[_0x0cb8('0x43')],_0x2edae2[_0x0cb8('0x41')]);_0x17a617['attributes']=_[_0x0cb8('0x45')](_0x2edae2['model'],qs[_0x0cb8('0x46')](_0x369f5a[_0x0cb8('0x41')]['fields']));_0x17a617['attributes']=_0x17a617[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x17a617[_0x0cb8('0x44')]:_0x2edae2[_0x0cb8('0x43')];if(!_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x17a617[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x32')]);_0x17a617[_0x0cb8('0x31')]=qs['offset'](_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x31')]);}_0x17a617[_0x0cb8('0x4a')]=qs[_0x0cb8('0x4b')](_0x369f5a['query'][_0x0cb8('0x4b')]);_0x17a617[_0x0cb8('0x4c')]=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x369f5a[_0x0cb8('0x41')],_0x2edae2[_0x0cb8('0x42')]));_0x17a617['where'][_0x0cb8('0x68')]=_0x4aa745['id'];if(_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x17a617['where']=_[_0x0cb8('0x51')](_0x17a617[_0x0cb8('0x4c')],{'$or':_['map'](_0x17a617[_0x0cb8('0x44')],function(_0x1afbfe){var _0x411099={};_0x411099[_0x1afbfe]={'$like':'%'+_0x369f5a['query'][_0x0cb8('0x4e')]+'%'};return _0x411099;})});}_0x17a617=_[_0x0cb8('0x51')]({},_0x17a617,_0x369f5a[_0x0cb8('0x52')]);return db[_0x0cb8('0x6f')]['count']({'where':_0x17a617[_0x0cb8('0x4c')]})[_0x0cb8('0x22')](function(_0x26d2f4){_0x2353d6['count']=_0x26d2f4;if(_0x369f5a[_0x0cb8('0x41')][_0x0cb8('0x5a')]){_0x17a617[_0x0cb8('0x53')]=[{'all':!![]}];}return db[_0x0cb8('0x6f')][_0x0cb8('0x54')](_0x17a617);})['then'](function(_0x4d4122){_0x2353d6[_0x0cb8('0x55')]=_0x4d4122;return _0x2353d6;});}})[_0x0cb8('0x22')](respondWithFilteredResult(_0xfd73e,_0x17a617))['catch'](handleError(_0xfd73e,null));};exports['removeAnswers']=function(_0x480092,_0x1012aa,_0xa4b0b4){return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x480092['params']['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1012aa,null))[_0x0cb8('0x22')](function(_0x4ce4bc){if(_0x4ce4bc){return _0x4ce4bc[_0x0cb8('0x71')](_0x480092[_0x0cb8('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x1012aa,null))[_0x0cb8('0x56')](handleError(_0x1012aa,null));};exports[_0x0cb8('0x72')]=function(_0x1c7c44,_0x312333,_0x495d27){return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x1c7c44[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x312333,null))[_0x0cb8('0x22')](function(_0x16b318){if(_0x16b318){return _0x16b318[_0x0cb8('0x72')](_0x1c7c44[_0x0cb8('0x5d')]['ids'],_[_0x0cb8('0x73')](_0x1c7c44[_0x0cb8('0x5d')],[_0x0cb8('0x6d'),'id'])||{})[_0x0cb8('0x74')](function(_0x1829a1){for(var _0x57fafc=0x0;_0x57fafc<_0x1c7c44[_0x0cb8('0x5d')]['ids'][_0x0cb8('0x47')];_0x57fafc+=0x1){socket[_0x0cb8('0x75')](_0x0cb8('0x76'),{'UserId':_0x1c7c44[_0x0cb8('0x5d')][_0x0cb8('0x6d')][_0x57fafc],'WhatsappAccountId':_0x1c7c44[_0x0cb8('0x58')]['id']});}return _0x1829a1;});}})[_0x0cb8('0x22')](respondWithResult(_0x312333,null))[_0x0cb8('0x56')](handleError(_0x312333,null));};exports[_0x0cb8('0x77')]=function(_0x33841b,_0x289c33,_0x2668bc){return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x33841b[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x289c33,null))[_0x0cb8('0x22')](function(_0x31439f){if(_0x31439f){return _0x31439f[_0x0cb8('0x77')](_0x33841b[_0x0cb8('0x41')]['ids'])['then'](function(){if(_[_0x0cb8('0x78')](_0x33841b[_0x0cb8('0x41')]['ids'])){for(var _0xcdc070=0x0;_0xcdc070<_0x33841b[_0x0cb8('0x41')]['ids'][_0x0cb8('0x47')];_0xcdc070+=0x1){socket[_0x0cb8('0x75')](_0x0cb8('0x79'),{'UserId':Number(_0x33841b['query'][_0x0cb8('0x6d')][_0xcdc070]),'WhatsappAccountId':Number(_0x33841b[_0x0cb8('0x58')]['id'])});}}else{socket[_0x0cb8('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x33841b[_0x0cb8('0x41')][_0x0cb8('0x6d')]),'WhatsappAccountId':Number(_0x33841b[_0x0cb8('0x58')]['id'])});}});}})[_0x0cb8('0x22')](respondWithStatusCode(_0x289c33,null))['catch'](handleError(_0x289c33,null));};exports['getAgents']=function(_0x42db81,_0x1a8c59,_0x240219){var _0x1a26a0={};var _0x57f19d={};var _0x29a8b7;var _0xdfc370;return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x42db81[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x1a8c59,null))[_0x0cb8('0x22')](function(_0x393d1a){if(_0x393d1a){_0x29a8b7=_0x393d1a;_0x57f19d[_0x0cb8('0x43')]=_[_0x0cb8('0x40')](db[_0x0cb8('0x7a')][_0x0cb8('0x59')]);_0x57f19d[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x42db81['query']);_0x57f19d[_0x0cb8('0x42')]=_[_0x0cb8('0x45')](_0x57f19d[_0x0cb8('0x43')],_0x57f19d[_0x0cb8('0x41')]);_0x1a26a0[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0x57f19d['model'],qs[_0x0cb8('0x46')](_0x42db81[_0x0cb8('0x41')]['fields']));_0x1a26a0[_0x0cb8('0x44')]=_0x1a26a0[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x1a26a0[_0x0cb8('0x44')]:_0x57f19d[_0x0cb8('0x43')];_0x1a26a0['order']=qs[_0x0cb8('0x4b')](_0x42db81[_0x0cb8('0x41')]['sort']);_0x1a26a0[_0x0cb8('0x4c')]=qs['filters'](_[_0x0cb8('0x4d')](_0x42db81[_0x0cb8('0x41')],_0x57f19d[_0x0cb8('0x42')]));if(_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x4e')]){_0x1a26a0[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0x1a26a0[_0x0cb8('0x4c')],{'$or':_[_0x0cb8('0x3b')](_0x1a26a0[_0x0cb8('0x44')],function(_0x2dfc12){var _0x17f454={};_0x17f454[_0x2dfc12]={'$like':'%'+_0x42db81['query'][_0x0cb8('0x4e')]+'%'};return _0x17f454;})});}_0x1a26a0=_[_0x0cb8('0x51')]({},_0x1a26a0,_0x42db81[_0x0cb8('0x52')]);return _0x29a8b7[_0x0cb8('0x7b')](_0x1a26a0);}})['then'](function(_0x4eb947){if(_0x4eb947){_0xdfc370=_0x4eb947[_0x0cb8('0x47')];if(!_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x48')]('nolimit')){_0x1a26a0['limit']=qs[_0x0cb8('0x32')](_0x42db81['query'][_0x0cb8('0x32')]);_0x1a26a0[_0x0cb8('0x31')]=qs[_0x0cb8('0x31')](_0x42db81[_0x0cb8('0x41')][_0x0cb8('0x31')]);}return _0x29a8b7[_0x0cb8('0x7b')](_0x1a26a0);}})[_0x0cb8('0x22')](function(_0x38d666){if(_0x38d666){return _0x38d666?{'count':_0xdfc370,'rows':_0x38d666}:null;}})[_0x0cb8('0x22')](respondWithResult(_0x1a8c59,null))[_0x0cb8('0x56')](handleError(_0x1a8c59,null));};exports['addApplications']=function(_0x16db3e,_0x218708,_0x322efc){return db[_0x0cb8('0x3c')]['findOne']({'where':{'id':_0x16db3e[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x218708,null))[_0x0cb8('0x22')](function(_0x4b51d7){if(_0x4b51d7){return db[_0x0cb8('0x7c')][_0x0cb8('0x7d')](function(_0x2845a0){return db[_0x0cb8('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x16db3e[_0x0cb8('0x58')]['id']},'transaction':_0x2845a0})[_0x0cb8('0x22')](function(_0x536ba4){var _0x196daa=_[_0x0cb8('0x3b')](_0x16db3e['body'],function(_0x13b9be){_0x13b9be[_0x0cb8('0x68')]=_0x16db3e[_0x0cb8('0x58')]['id'];return _0x13b9be;});return db['WhatsappApplication'][_0x0cb8('0x7f')](_0x196daa,{'transaction':_0x2845a0});});})[_0x0cb8('0x22')](function(){return db[_0x0cb8('0x7e')][_0x0cb8('0x80')]({'where':{'WhatsappAccountId':_0x16db3e[_0x0cb8('0x58')]['id']},'order':_0x0cb8('0x81')});});}})[_0x0cb8('0x22')](respondWithResult(_0x218708,null))[_0x0cb8('0x56')](handleError(_0x218708,null));};exports[_0x0cb8('0x82')]=function(_0x3de452,_0x447eee,_0x30e566){var _0x2bbc8c={};var _0xe289a7={};var _0x9b508d;var _0x6d33c9;return db[_0x0cb8('0x3c')][_0x0cb8('0x6a')]({'where':{'id':_0x3de452[_0x0cb8('0x58')]['id']}})[_0x0cb8('0x22')](handleEntityNotFound(_0x447eee,null))['then'](function(_0x60d90d){if(_0x60d90d){_0x9b508d=_0x60d90d;_0xe289a7['model']=_[_0x0cb8('0x40')](db[_0x0cb8('0x7e')][_0x0cb8('0x59')]);_0xe289a7[_0x0cb8('0x41')]=_[_0x0cb8('0x40')](_0x3de452[_0x0cb8('0x41')]);_0xe289a7['filters']=_[_0x0cb8('0x45')](_0xe289a7['model'],_0xe289a7[_0x0cb8('0x41')]);_0x2bbc8c[_0x0cb8('0x44')]=_[_0x0cb8('0x45')](_0xe289a7['model'],qs[_0x0cb8('0x46')](_0x3de452[_0x0cb8('0x41')][_0x0cb8('0x46')]));_0x2bbc8c[_0x0cb8('0x44')]=_0x2bbc8c[_0x0cb8('0x44')][_0x0cb8('0x47')]?_0x2bbc8c['attributes']:_0xe289a7['model'];_0x2bbc8c[_0x0cb8('0x4a')]=qs['sort'](_0x3de452[_0x0cb8('0x41')][_0x0cb8('0x4b')]);_0x2bbc8c['where']=qs[_0x0cb8('0x42')](_[_0x0cb8('0x4d')](_0x3de452[_0x0cb8('0x41')],_0xe289a7['filters']));if(_0x3de452['query'][_0x0cb8('0x4e')]){_0x2bbc8c[_0x0cb8('0x4c')]=_[_0x0cb8('0x51')](_0x2bbc8c['where'],{'$or':_[_0x0cb8('0x3b')](_0x2bbc8c[_0x0cb8('0x44')],function(_0x8d7333){var _0x320bd8={};_0x320bd8[_0x8d7333]={'$like':'%'+_0x3de452[_0x0cb8('0x41')]['filter']+'%'};return _0x320bd8;})});}_0x2bbc8c=_[_0x0cb8('0x51')]({},_0x2bbc8c,_0x3de452[_0x0cb8('0x52')]);return _0x9b508d[_0x0cb8('0x82')](_0x2bbc8c);}})[_0x0cb8('0x22')](function(_0x2a2a98){if(_0x2a2a98){_0x6d33c9=_0x2a2a98[_0x0cb8('0x47')];if(!_0x3de452[_0x0cb8('0x41')]['hasOwnProperty'](_0x0cb8('0x49'))){_0x2bbc8c[_0x0cb8('0x32')]=qs[_0x0cb8('0x32')](_0x3de452['query'][_0x0cb8('0x32')]);_0x2bbc8c[_0x0cb8('0x31')]=qs[_0x0cb8('0x31')](_0x3de452['query'][_0x0cb8('0x31')]);}return _0x9b508d[_0x0cb8('0x82')](_0x2bbc8c);}})[_0x0cb8('0x22')](function(_0x5a8b39){if(_0x5a8b39){return _0x5a8b39?{'count':_0x6d33c9,'rows':_0x5a8b39}:null;}})[_0x0cb8('0x22')](respondWithResult(_0x447eee,null))[_0x0cb8('0x56')](handleError(_0x447eee,null));};exports['notify']=function(_0x247c9a,_0x258a31,_0x27562e){var _0x118bde={'channel':'whatsapp'};var _0x1df262=[];var _0x59ac6f=[];var _0x386fef={};return db[_0x0cb8('0x3c')]['find']({'where':{'id':_0x247c9a[_0x0cb8('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x176fdd){_0x118bde['account']=_0x176fdd;_0x118bde[_0x0cb8('0x83')]=_[_0x0cb8('0x84')](_0x176fdd[_0x0cb8('0x85')],['priority'],['asc']);if(_0x118bde['account'][_0x0cb8('0x85')]){delete _0x118bde[_0x0cb8('0x86')][_0x0cb8('0x85')];}return db[_0x0cb8('0x87')]['describe']();})[_0x0cb8('0x22')](function(_0x3766ff){if(!_0x3766ff){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x8a'));}_0x1df262=_['difference'](_[_0x0cb8('0x40')](_0x3766ff),[_0x0cb8('0x8b'),_0x0cb8('0x8c')]);_0x59ac6f=_[_0x0cb8('0x8d')](_[_0x0cb8('0x40')](_0x3766ff),[_0x0cb8('0x8b'),_0x0cb8('0x8c'),_0x0cb8('0x8e'),'ListId']);_0x118bde[_0x0cb8('0x5d')]={'mapKey':_0x0cb8('0x8f')};if(_0x118bde[_0x0cb8('0x86')][_0x0cb8('0x3e')]&&_0x118bde[_0x0cb8('0x86')]['type']===_0x0cb8('0x90')){_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')]=_0x247c9a[_0x0cb8('0x5d')][_0x0cb8('0x92')][_0x0cb8('0x93')](_0x0cb8('0x94'),'');_0x118bde['body'][_0x0cb8('0x5d')]=_0x247c9a[_0x0cb8('0x5d')][_0x0cb8('0x95')];_0x118bde['body'][_0x0cb8('0x96')]=_0x247c9a['body'][_0x0cb8('0x97')];}if(_0x118bde[_0x0cb8('0x5d')]['id']){delete _0x118bde['body']['id'];}if(_[_0x0cb8('0x98')](_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')])){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x99'));}if(_[_0x0cb8('0x98')](_0x118bde['body'][_0x0cb8('0x5d')])||_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x5d')]===''){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))](_0x0cb8('0x9a'));}if(_['isNil'](_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')])){throw new db[(_0x0cb8('0x88'))]['ValidationError'](_0x0cb8('0x9c')+_0x59ac6f);}if(!_['includes'](_0x59ac6f,_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')])){throw new db[(_0x0cb8('0x88'))]['ValidationError'](_0x0cb8('0x9d')+_0x59ac6f);}_0x386fef[_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x9b')]]=_0x118bde['body'][_0x0cb8('0x91')];return db[_0x0cb8('0x9e')][_0x0cb8('0x5b')]({'where':{'id':_0x118bde['account'][_0x0cb8('0x9f')]},'include':[{'model':db['CmContact'],'as':_0x0cb8('0xa0'),'where':_0x386fef,'limit':0x1,'order':[[_0x0cb8('0x8c'),_0x0cb8('0xa1')]]}]});})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x3a2ef6){if(_0x3a2ef6){_0x118bde[_0x0cb8('0xa2')]=_[_0x0cb8('0x73')](_0x3a2ef6,[_0x0cb8('0xa0')]);if(_0x3a2ef6[_0x0cb8('0xa0')][_0x0cb8('0x47')]){return _0x3a2ef6[_0x0cb8('0xa0')][0x0];}var _0x140a4e=_[_0x0cb8('0x1a')](_0x118bde['body'],{'firstName':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')],'ListId':_0x3a2ef6['id']});_0x140a4e[_0x118bde['body'][_0x0cb8('0x9b')]]=_0x118bde['body']['from'];return db['CmContact']['create'](_0x140a4e,{'fields':_0x1df262,'raw':!![]});}})[_0x0cb8('0x22')](handleEntityNotFound(_0x258a31,null))[_0x0cb8('0x22')](function(_0x394d85){if(_0x394d85){_0x118bde[_0x0cb8('0xa3')]=_0x394d85;var _0x2664cf={'ContactId':_0x394d85['id'],'phone':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x91')],'WhatsappAccountId':_0x247c9a['params']['id']};var _0x864300={'ContactId':_0x394d85['id'],'WhatsappAccountId':_0x247c9a[_0x0cb8('0x58')]['id'],'closed':![]};return db[_0x0cb8('0xa4')][_0x0cb8('0x5b')]({'where':_0x864300})['then'](function(_0x3a7ead){if(_0x3a7ead){return[_0x3a7ead,![]];}return db['WhatsappInteraction'][_0x0cb8('0x5c')](_0x2664cf)[_0x0cb8('0x22')](function(_0x6d919f){return[_0x6d919f,!![]];});});}})[_0x0cb8('0x74')](function(_0x111243,_0x5234f4){_0x118bde[_0x0cb8('0xa5')]=_0x111243[_0x0cb8('0x36')]({'plain':!![]});_0x118bde[_0x0cb8('0xa5')][_0x0cb8('0xa6')]=![];if(_0x5234f4){if(_0x118bde['account'][_0x0cb8('0xa7')]){_0x118bde[_0x0cb8('0x83')][_0x0cb8('0xa8')]({'id':0x0,'priority':_0x118bde[_0x0cb8('0x83')][_0x0cb8('0x47')]+0x1,'app':'close','appdata':_0x0cb8('0xa9'),'interval':'*,*,*,*'});}_0x118bde[_0x0cb8('0xa5')][_0x0cb8('0xa6')]=!![];}return db[_0x0cb8('0xaa')][_0x0cb8('0x5c')]({'phone':_0x118bde['body'][_0x0cb8('0x91')],'messageId':_0x118bde[_0x0cb8('0x5d')]['messageId'],'body':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0x5d')],'WhatsappAccountId':_0x247c9a[_0x0cb8('0x58')]['id'],'WhatsappInteractionId':_0x111243['id'],'direction':'in','ContactId':_0x111243[_0x0cb8('0xab')],'AttachmentId':_0x118bde[_0x0cb8('0x5d')][_0x0cb8('0xac')]});})['then'](function(_0x5a80ea){_0x118bde[_0x0cb8('0x2a')]=_0x5a80ea;if(_0x118bde[_0x0cb8('0xa5')]['UserId']){return db[_0x0cb8('0x7a')][_0x0cb8('0x5b')]({'attributes':['id',_0x0cb8('0x50')],'where':{'id':_0x118bde['interaction'][_0x0cb8('0xad')]}})['then'](function(_0x3fee16){if(_0x3fee16){_0x118bde[_0x0cb8('0x83')][_0x0cb8('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3fee16[_0x0cb8('0x50')]+','+(_0x118bde[_0x0cb8('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x0cb8('0xaf')});}return respondWithRpcPromise(_0x0cb8('0xb0'),_0x0cb8('0xb1'),_0x118bde);});}return respondWithRpcPromise(_0x0cb8('0xb0'),_0x0cb8('0xb1'),_0x118bde);})[_0x0cb8('0x22')](function(_0x5d2679){if(_0x5d2679){var _0x291dc3=0xc8;var _0x1a0845='receiveMessage';logger[_0x0cb8('0x23')](_0x0cb8('0x27'),_0x1a0845,_0x291dc3,_0x0cb8('0xb2'));logger[_0x0cb8('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a0845,_0x291dc3,_0x0cb8('0xb2'),JSON[_0x0cb8('0xb3')](_0x5d2679));if(_0x118bde[_0x0cb8('0x86')][_0x0cb8('0x3e')]===_0x0cb8('0x90')){return _0x258a31[_0x0cb8('0x2e')](_0x291dc3)[_0x0cb8('0x33')]('Content-Type','text/xml')[_0x0cb8('0x38')](_0x0cb8('0xb4'));}else{return _0x258a31[_0x0cb8('0x2e')](_0x291dc3)[_0x0cb8('0x2f')](_0x5d2679);}}})[_0x0cb8('0x56')](handleError(_0x258a31,null));};exports['send']=function(_0x59348f,_0x11490d,_0x54ef04){var _0x508695,_0x576e30,_0x242525;if(_[_0x0cb8('0x98')](_0x59348f[_0x0cb8('0x5d')]['body'])||_0x59348f[_0x0cb8('0x5d')][_0x0cb8('0x5d')]===''){throw new db[(_0x0cb8('0x88'))][(_0x0cb8('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0cb8('0x98')](_0x59348f[_0x0cb8('0x5d')]['to'])){throw new db['Sequelize'][(_0x0cb8('0x89'))]('to\x20is\x20mandatory');}_0x508695=_0x59348f[_0x0cb8('0x5d')]['to'];return db[_0x0cb8('0x3c')][_0x0cb8('0x5b')]({'where':{'id':_0x59348f[_0x0cb8('0x58')]['id']},'include':[{'model':db[_0x0cb8('0x9e')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0cb8('0xa0'),'where':{'mobile':_0x508695},'limit':0x1,'order':[[_0x0cb8('0x8c'),_0x0cb8('0xa1')]]}]}]})[_0x0cb8('0x22')](handleEntityNotFound(_0x11490d,null))['then'](function(_0x154756){if(_0x154756&&_0x154756[_0x0cb8('0xb5')]){_0x576e30=_0x154756[_0x0cb8('0x36')]({'plain':!![]});if(_0x576e30[_0x0cb8('0xb5')]&&_0x576e30[_0x0cb8('0xb5')][_0x0cb8('0xa0')]['length']){return _0x576e30[_0x0cb8('0xb5')][_0x0cb8('0xa0')][0x0];}return db[_0x0cb8('0x87')]['create'](_['defaults'](_0x59348f[_0x0cb8('0x5d')],{'firstName':_0x508695,'mobile':_0x508695,'phone':_0x508695,'ListId':_0x576e30[_0x0cb8('0x9f')]}));}})[_0x0cb8('0x22')](handleEntityNotFound(_0x11490d,null))[_0x0cb8('0x22')](function(_0xd6b2f1){if(_0xd6b2f1){_0x242525=_0xd6b2f1;return db['WhatsappInteraction'][_0x0cb8('0x5b')]({'where':{'ContactId':_0x242525['id'],'closed':![],'WhatsappAccountId':_0x576e30['id']}})['then'](function(_0x297d37){if(_0x297d37){return[_0x297d37,![]];}return db['WhatsappInteraction'][_0x0cb8('0x5c')]({'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id'],'WhatsappAccountId':_0x576e30['id'],'phone':_0x508695,'firstMsgDirection':_0x0cb8('0xb6'),'Messages':[_[_0x0cb8('0x51')](_0x59348f[_0x0cb8('0x5d')],{'read':![],'body':_0x59348f[_0x0cb8('0x5d')][_0x0cb8('0x5d')],'phone':_0x508695,'WhatsappAccountId':_0x576e30['id'],'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id']})]},{'include':[{'model':db[_0x0cb8('0xaa')],'as':_0x0cb8('0xb7')}]})['then'](function(_0xabb151){return[_0xabb151,!![]];});});}})[_0x0cb8('0x74')](function(_0x5848b7,_0xa386b){if(_0xa386b){return _0x5848b7;}return db[_0x0cb8('0xaa')][_0x0cb8('0x5c')](_['merge'](_0x59348f[_0x0cb8('0x5d')],{'read':![],'body':_0x59348f['body'][_0x0cb8('0x5d')],'phone':_0x508695,'WhatsappAccountId':_0x576e30['id'],'WhatsappInteractionId':_0x5848b7['id'],'UserId':_0x59348f[_0x0cb8('0x60')]['id'],'ContactId':_0x242525['id']}))[_0x0cb8('0x22')](function(_0x302475){_0x5848b7[_0x0cb8('0xb8')][_0x0cb8('0xb7')]=[];_0x5848b7[_0x0cb8('0xb8')][_0x0cb8('0xb7')]['push'](_0x302475['dataValues']);return _0x5848b7;});})[_0x0cb8('0x22')](respondWithResult(_0x11490d,null))['catch'](handleError(_0x11490d,null));}; \ No newline at end of file +var _0xf88e=['priority','asc','CmContact','ValidationError','updatedAt','difference','createdAt','CompanyId','mobile','From','replace','whatsapp:','messageId','MessageSid','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','DESC','List','user','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','sort','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','getApplications','whatsapp','Applications','account','applications'];(function(_0x5cbf61,_0x572128){var _0x30680a=function(_0x19faba){while(--_0x19faba){_0x5cbf61['push'](_0x5cbf61['shift']());}};_0x30680a(++_0x572128);}(_0xf88e,0x1b4));var _0xef88=function(_0x48507f,_0xfdb1ca){_0x48507f=_0x48507f-0x0;var _0x36eadb=_0xf88e[_0x48507f];return _0x36eadb;};'use strict';var pdf=require(_0xef88('0x0'));var emlformat=require(_0xef88('0x1'));var rimraf=require(_0xef88('0x2'));var zipdir=require(_0xef88('0x3'));var jsonpatch=require(_0xef88('0x4'));var rp=require(_0xef88('0x5'));var moment=require(_0xef88('0x6'));var BPromise=require(_0xef88('0x7'));var Mustache=require(_0xef88('0x8'));var util=require(_0xef88('0x9'));var path=require(_0xef88('0xa'));var sox=require('sox');var csv=require(_0xef88('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef88('0xc'));var jsforce=require(_0xef88('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef88('0xb'));var querystring=require(_0xef88('0xe'));var Papa=require(_0xef88('0xf'));var Redis=require(_0xef88('0x10'));var authService=require(_0xef88('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef88('0x12'));var hardwareService=require(_0xef88('0x13'));var logger=require(_0xef88('0x14'))(_0xef88('0x15'));var utils=require(_0xef88('0x16'));var config=require(_0xef88('0x17'));var licenseUtil=require(_0xef88('0x18'));var db=require(_0xef88('0x19'))['db'];config[_0xef88('0x1a')]=_[_0xef88('0x1b')](config[_0xef88('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xef88('0x1c'))(new Redis(config[_0xef88('0x1a')]));require(_0xef88('0x1d'))[_0xef88('0x1e')](socket);var jayson=require(_0xef88('0x1f'));var client=jayson['client'][_0xef88('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1f06b9,_0x5e7236,_0x1da4e4,_0x35d251){return new BPromise(function(_0x4928fe,_0x4601b6){var _0x46eb6e=_0x35d251||client;return _0x46eb6e[_0xef88('0x21')](_0x1f06b9,_0x1da4e4)[_0xef88('0x22')](function(_0x139f9e){logger['info'](_0xef88('0x23'),_0x5e7236,_0xef88('0x24'));logger[_0xef88('0x25')](_0xef88('0x26'),_0x5e7236,_0xef88('0x24'),JSON['stringify'](_0x139f9e));if(_0x139f9e['error']){if(_0x139f9e[_0xef88('0x27')][_0xef88('0x28')]===0x1f4){logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x139f9e['error'][_0xef88('0x29')]);return _0x4601b6(_0x139f9e[_0xef88('0x27')][_0xef88('0x29')]);}logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x139f9e['error'][_0xef88('0x29')]);return _0x4928fe(_0x139f9e['error'][_0xef88('0x29')]);}else{logger[_0xef88('0x2a')](_0xef88('0x23'),_0x5e7236,_0xef88('0x24'));_0x4928fe(_0x139f9e[_0xef88('0x2b')][_0xef88('0x29')]);}})['catch'](function(_0x11eea4){logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x11eea4);_0x4601b6(_0x11eea4);});});}function respondWithStatusCode(_0x43017,_0x355557){_0x355557=_0x355557||0xcc;return function(_0x649e57){if(_0x649e57){return _0x43017[_0xef88('0x2c')](_0x355557);}return _0x43017['status'](_0x355557)[_0xef88('0x2d')]();};}function respondWithResult(_0x2872fd,_0x3920fa){_0x3920fa=_0x3920fa||0xc8;return function(_0x394628){if(_0x394628){return _0x2872fd[_0xef88('0x2e')](_0x3920fa)['json'](_0x394628);}};}function respondWithFilteredResult(_0x125821,_0x5ce0ce){return function(_0x36f4de){if(_0x36f4de){var _0x144407=_0x36f4de[_0xef88('0x2f')],_0x4d408b=_0x5ce0ce[_0xef88('0x30')],_0x769776=_0x5ce0ce[_0xef88('0x30')]+_0x5ce0ce[_0xef88('0x31')],_0x2d245a;if(_0x769776>=_0x144407){_0x769776=_0x144407;_0x2d245a=0xc8;}else{_0x2d245a=0xce;}_0x125821['status'](_0x2d245a);return _0x125821[_0xef88('0x32')](_0xef88('0x33'),_0x4d408b+'-'+_0x769776+'/'+_0x144407)[_0xef88('0x34')](_0x36f4de);}return null;};}function patchUpdates(_0x5092b9){return function(_0x42060f){try{jsonpatch['apply'](_0x42060f,_0x5092b9,!![]);}catch(_0x20a9a2){return BPromise['reject'](_0x20a9a2);}return _0x42060f['save']();};}function saveUpdates(_0x380e1d,_0x2e3515){return function(_0x330a84){if(_0x330a84){return _0x330a84[_0xef88('0x35')](_0x380e1d)['then'](function(_0x1ce746){return _0x1ce746;});}return null;};}function removeEntity(_0x47dbe6,_0x28a634){return function(_0x38ae67){if(_0x38ae67){return _0x38ae67[_0xef88('0x36')]()[_0xef88('0x22')](function(){var _0x15d4d4=_0x38ae67[_0xef88('0x37')]({'plain':!![]});var _0x47722c=_0xef88('0x38');return db[_0xef88('0x39')][_0xef88('0x36')]({'where':{'type':_0x47722c,'resourceId':_0x15d4d4['id']}})[_0xef88('0x22')](function(){return _0x38ae67;});})[_0xef88('0x22')](function(){_0x47dbe6[_0xef88('0x2e')](0xcc)[_0xef88('0x2d')]();});}};}function handleEntityNotFound(_0x1f4c14,_0x180c37){return function(_0x2774b1){if(!_0x2774b1){_0x1f4c14[_0xef88('0x2c')](0x194);}return _0x2774b1;};}function handleError(_0x135a89,_0x34c53a){_0x34c53a=_0x34c53a||0x1f4;return function(_0x31dfac){logger[_0xef88('0x27')](_0x31dfac[_0xef88('0x3a')]);if(_0x31dfac[_0xef88('0x3b')]){delete _0x31dfac[_0xef88('0x3b')];}_0x135a89[_0xef88('0x2e')](_0x34c53a)['send'](_0x31dfac);};}exports[_0xef88('0x3c')]=function(_0x9a619,_0x2b1aad){var _0xb6b7e0={'include':[{'model':db[_0xef88('0x3d')],'as':'mandatoryDispositionPause'}]},_0x50f0db={},_0x10f25b={'count':0x0,'rows':[]};var _0xe00583=_['map'](db[_0xef88('0x3e')][_0xef88('0x3f')],function(_0x1c9a18){return{'name':_0x1c9a18[_0xef88('0x40')],'type':_0x1c9a18[_0xef88('0x41')]['key']};});_0x50f0db[_0xef88('0x42')]=_[_0xef88('0x43')](_0xe00583,_0xef88('0x3b'));_0x50f0db[_0xef88('0x44')]=_[_0xef88('0x45')](_0x9a619[_0xef88('0x44')]);_0x50f0db[_0xef88('0x46')]=_[_0xef88('0x47')](_0x50f0db[_0xef88('0x42')],_0x50f0db[_0xef88('0x44')]);_0xb6b7e0[_0xef88('0x48')]=_['intersection'](_0x50f0db['model'],qs[_0xef88('0x49')](_0x9a619[_0xef88('0x44')]['fields']));_0xb6b7e0[_0xef88('0x48')]=_0xb6b7e0[_0xef88('0x48')]['length']?_0xb6b7e0[_0xef88('0x48')]:_0x50f0db[_0xef88('0x42')];if(!_0x9a619[_0xef88('0x44')][_0xef88('0x4a')](_0xef88('0x4b'))){_0xb6b7e0[_0xef88('0x31')]=qs[_0xef88('0x31')](_0x9a619[_0xef88('0x44')][_0xef88('0x31')]);_0xb6b7e0[_0xef88('0x30')]=qs[_0xef88('0x30')](_0x9a619['query'][_0xef88('0x30')]);}_0xb6b7e0[_0xef88('0x4c')]=qs['sort'](_0x9a619[_0xef88('0x44')]['sort']);_0xb6b7e0[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x9a619[_0xef88('0x44')],_0x50f0db[_0xef88('0x46')]),_0xe00583);if(_0x9a619[_0xef88('0x44')][_0xef88('0x4f')]){_0xb6b7e0[_0xef88('0x4d')]=_[_0xef88('0x50')](_0xb6b7e0['where'],{'$or':_[_0xef88('0x43')](_0xe00583,function(_0xfbf4d9){if(_0xfbf4d9[_0xef88('0x41')]!=='VIRTUAL'){var _0x4ef1ca={};_0x4ef1ca[_0xfbf4d9['name']]={'$like':'%'+_0x9a619[_0xef88('0x44')][_0xef88('0x4f')]+'%'};return _0x4ef1ca;}})});}_0xb6b7e0=_[_0xef88('0x50')]({},_0xb6b7e0,_0x9a619[_0xef88('0x51')]);var _0x23b21d={'where':_0xb6b7e0[_0xef88('0x4d')]};return db[_0xef88('0x3e')]['count'](_0x23b21d)[_0xef88('0x22')](function(_0x2a6073){_0x10f25b[_0xef88('0x2f')]=_0x2a6073;if(_0x9a619[_0xef88('0x44')][_0xef88('0x52')]){_0xb6b7e0[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x3e')][_0xef88('0x54')](_0xb6b7e0);})[_0xef88('0x22')](function(_0x41b3c8){_0x10f25b['rows']=_0x41b3c8;return _0x10f25b;})[_0xef88('0x22')](respondWithFilteredResult(_0x2b1aad,_0xb6b7e0))[_0xef88('0x55')](handleError(_0x2b1aad,null));};exports[_0xef88('0x56')]=function(_0xf3d511,_0x376968){var _0x538199={'raw':![],'where':{'id':_0xf3d511[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x3d')],'as':_0xef88('0x58')}]},_0x36b630={};_0x36b630['model']=_[_0xef88('0x45')](db[_0xef88('0x3e')]['rawAttributes']);_0x36b630[_0xef88('0x44')]=_[_0xef88('0x45')](_0xf3d511[_0xef88('0x44')]);_0x36b630[_0xef88('0x46')]=_[_0xef88('0x47')](_0x36b630[_0xef88('0x42')],_0x36b630['query']);_0x538199[_0xef88('0x48')]=_[_0xef88('0x47')](_0x36b630[_0xef88('0x42')],qs[_0xef88('0x49')](_0xf3d511[_0xef88('0x44')][_0xef88('0x49')]));_0x538199[_0xef88('0x48')]=_0x538199['attributes'][_0xef88('0x59')]?_0x538199[_0xef88('0x48')]:_0x36b630['model'];if(_0xf3d511['query'][_0xef88('0x52')]){_0x538199[_0xef88('0x53')]=[{'all':!![]}];}_0x538199=_[_0xef88('0x50')]({},_0x538199,_0xf3d511[_0xef88('0x51')]);return db[_0xef88('0x3e')]['find'](_0x538199)['then'](handleEntityNotFound(_0x376968,null))['then'](respondWithResult(_0x376968,null))['catch'](handleError(_0x376968,null));};exports[_0xef88('0x5a')]=function(_0x2b20c0,_0x2c17aa){return db[_0xef88('0x3e')]['create'](_0x2b20c0['body'],{})[_0xef88('0x22')](function(_0x3db8eb){var _0x19abe3=_0x2b20c0['user']['get']({'plain':!![]});if(!_0x19abe3)throw new Error(_0xef88('0x5b'));if(_0x19abe3[_0xef88('0x5c')]==='user'){var _0x36e268=_0x3db8eb['get']({'plain':!![]});var _0x200311=_0xef88('0x38');return db[_0xef88('0x5d')][_0xef88('0x5e')]({'where':{'name':_0x200311,'userProfileId':_0x19abe3[_0xef88('0x5f')]},'raw':!![]})[_0xef88('0x22')](function(_0x7623a8){if(_0x7623a8&&_0x7623a8['autoAssociation']===0x0){return db[_0xef88('0x39')][_0xef88('0x5a')]({'name':_0x36e268['name'],'resourceId':_0x36e268['id'],'type':_0x7623a8[_0xef88('0x3b')],'sectionId':_0x7623a8['id']},{})['then'](function(){return _0x3db8eb;});}else{return _0x3db8eb;}})['catch'](function(_0x3ab4ad){logger[_0xef88('0x27')](_0xef88('0x60'),_0x3ab4ad);throw _0x3ab4ad;});}return _0x3db8eb;})['then'](respondWithResult(_0x2c17aa,0xc9))[_0xef88('0x55')](handleError(_0x2c17aa,null));};exports[_0xef88('0x35')]=function(_0x257bf1,_0x5db458){if(_0x257bf1[_0xef88('0x61')]['id']){delete _0x257bf1[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x257bf1[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5db458,null))[_0xef88('0x22')](saveUpdates(_0x257bf1[_0xef88('0x61')],null))[_0xef88('0x22')](respondWithResult(_0x5db458,null))[_0xef88('0x55')](handleError(_0x5db458,null));};exports[_0xef88('0x36')]=function(_0x2ae37f,_0x278c70){return db['WhatsappAccount'][_0xef88('0x5e')]({'where':{'id':_0x2ae37f[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x278c70,null))[_0xef88('0x22')](removeEntity(_0x278c70,null))['catch'](handleError(_0x278c70,null));};exports[_0xef88('0x62')]=function(_0x852dea,_0x1d30fc){return db['WhatsappAccount'][_0xef88('0x62')]()[_0xef88('0x22')](respondWithResult(_0x1d30fc,null))[_0xef88('0x55')](handleError(_0x1d30fc,null));};exports['addDisposition']=function(_0x3cc366,_0x3a54bc,_0x58b750){if(_0x3cc366[_0xef88('0x61')]['id']){delete _0x3cc366[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x3cc366['params']['id']}})['then'](handleEntityNotFound(_0x3a54bc,null))[_0xef88('0x22')](function(_0x2a4d89){if(_0x2a4d89){_0x3cc366[_0xef88('0x61')][_0xef88('0x63')]=_0x2a4d89['id'];return db[_0xef88('0x64')]['create'](_0x3cc366['body']);}})[_0xef88('0x22')](respondWithResult(_0x3a54bc,null))[_0xef88('0x55')](handleError(_0x3a54bc,null));};exports[_0xef88('0x65')]=function(_0x8833a4,_0x10f2b7,_0x91bcb4){var _0x38df8b={'raw':![],'where':{}};var _0xf7797d={};var _0x2fedae={'count':0x0,'rows':[]};return db[_0xef88('0x3e')]['findOne']({'where':{'id':_0x8833a4[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x10f2b7,null))[_0xef88('0x22')](function(_0x3a350e){if(_0x3a350e){_0xf7797d[_0xef88('0x42')]=_[_0xef88('0x45')](db['Disposition'][_0xef88('0x3f')]);_0xf7797d[_0xef88('0x44')]=_[_0xef88('0x45')](_0x8833a4[_0xef88('0x44')]);_0xf7797d['filters']=_['intersection'](_0xf7797d[_0xef88('0x42')],_0xf7797d[_0xef88('0x44')]);_0x38df8b[_0xef88('0x48')]=_['intersection'](_0xf7797d[_0xef88('0x42')],qs['fields'](_0x8833a4[_0xef88('0x44')][_0xef88('0x49')]));_0x38df8b[_0xef88('0x48')]=_0x38df8b['attributes'][_0xef88('0x59')]?_0x38df8b[_0xef88('0x48')]:_0xf7797d[_0xef88('0x42')];if(!_0x8833a4[_0xef88('0x44')]['hasOwnProperty'](_0xef88('0x4b'))){_0x38df8b['limit']=qs[_0xef88('0x31')](_0x8833a4[_0xef88('0x44')][_0xef88('0x31')]);_0x38df8b[_0xef88('0x30')]=qs['offset'](_0x8833a4[_0xef88('0x44')][_0xef88('0x30')]);}_0x38df8b[_0xef88('0x4c')]=qs['sort'](_0x8833a4[_0xef88('0x44')][_0xef88('0x66')]);_0x38df8b['where']=qs[_0xef88('0x46')](_['pick'](_0x8833a4[_0xef88('0x44')],_0xf7797d['filters']));_0x38df8b[_0xef88('0x4d')][_0xef88('0x63')]=_0x3a350e['id'];if(_0x8833a4['query']['filter']){_0x38df8b[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x38df8b[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x38df8b[_0xef88('0x48')],function(_0x107384){var _0x56e89b={};_0x56e89b[_0x107384]={'$like':'%'+_0x8833a4[_0xef88('0x44')]['filter']+'%'};return _0x56e89b;})});}_0x38df8b=_[_0xef88('0x50')]({},_0x38df8b,_0x8833a4['options']);return db[_0xef88('0x64')][_0xef88('0x2f')]({'where':_0x38df8b[_0xef88('0x4d')]})[_0xef88('0x22')](function(_0x5c7935){_0x2fedae[_0xef88('0x2f')]=_0x5c7935;if(_0x8833a4[_0xef88('0x44')][_0xef88('0x52')]){_0x38df8b[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x64')][_0xef88('0x54')](_0x38df8b);})[_0xef88('0x22')](function(_0x49da92){_0x2fedae[_0xef88('0x67')]=_0x49da92;return _0x2fedae;});}})[_0xef88('0x22')](respondWithFilteredResult(_0x10f2b7,_0x38df8b))[_0xef88('0x55')](handleError(_0x10f2b7,null));};exports['removeDispositions']=function(_0x4873ef,_0x27b14d,_0x18beb4){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x4873ef[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x27b14d,null))[_0xef88('0x22')](function(_0x122162){if(_0x122162){return _0x122162[_0xef88('0x68')](_0x4873ef[_0xef88('0x44')][_0xef88('0x69')]);}})[_0xef88('0x22')](respondWithStatusCode(_0x27b14d,null))[_0xef88('0x55')](handleError(_0x27b14d,null));};exports[_0xef88('0x6a')]=function(_0x2f7c0c,_0x93652a,_0x294f88){if(_0x2f7c0c[_0xef88('0x61')]['id']){delete _0x2f7c0c[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')]['find']({'where':{'id':_0x2f7c0c[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x93652a,null))['then'](function(_0x7707d5){if(_0x7707d5){_0x2f7c0c[_0xef88('0x61')][_0xef88('0x63')]=_0x7707d5['id'];return db['CannedAnswer'][_0xef88('0x5a')](_0x2f7c0c[_0xef88('0x61')]);}})['then'](respondWithResult(_0x93652a,null))[_0xef88('0x55')](handleError(_0x93652a,null));};exports[_0xef88('0x6b')]=function(_0x13be27,_0x3fcf44,_0x53adb4){var _0x580e74={'raw':![],'where':{}};var _0xd3a0b9={};var _0x144b87={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xef88('0x6c')]({'where':{'id':_0x13be27[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x3fcf44,null))[_0xef88('0x22')](function(_0x5ef249){if(_0x5ef249){_0xd3a0b9['model']=_[_0xef88('0x45')](db['CannedAnswer'][_0xef88('0x3f')]);_0xd3a0b9[_0xef88('0x44')]=_[_0xef88('0x45')](_0x13be27[_0xef88('0x44')]);_0xd3a0b9[_0xef88('0x46')]=_[_0xef88('0x47')](_0xd3a0b9[_0xef88('0x42')],_0xd3a0b9[_0xef88('0x44')]);_0x580e74[_0xef88('0x48')]=_[_0xef88('0x47')](_0xd3a0b9['model'],qs['fields'](_0x13be27[_0xef88('0x44')][_0xef88('0x49')]));_0x580e74['attributes']=_0x580e74[_0xef88('0x48')][_0xef88('0x59')]?_0x580e74[_0xef88('0x48')]:_0xd3a0b9[_0xef88('0x42')];if(!_0x13be27[_0xef88('0x44')][_0xef88('0x4a')](_0xef88('0x4b'))){_0x580e74[_0xef88('0x31')]=qs[_0xef88('0x31')](_0x13be27[_0xef88('0x44')]['limit']);_0x580e74[_0xef88('0x30')]=qs[_0xef88('0x30')](_0x13be27[_0xef88('0x44')][_0xef88('0x30')]);}_0x580e74[_0xef88('0x4c')]=qs[_0xef88('0x66')](_0x13be27[_0xef88('0x44')][_0xef88('0x66')]);_0x580e74[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x13be27[_0xef88('0x44')],_0xd3a0b9['filters']));_0x580e74['where'][_0xef88('0x63')]=_0x5ef249['id'];if(_0x13be27[_0xef88('0x44')][_0xef88('0x4f')]){_0x580e74[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x580e74[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x580e74[_0xef88('0x48')],function(_0x4b9035){var _0x4cece5={};_0x4cece5[_0x4b9035]={'$like':'%'+_0x13be27[_0xef88('0x44')]['filter']+'%'};return _0x4cece5;})});}_0x580e74=_[_0xef88('0x50')]({},_0x580e74,_0x13be27[_0xef88('0x51')]);return db[_0xef88('0x6d')]['count']({'where':_0x580e74[_0xef88('0x4d')]})[_0xef88('0x22')](function(_0xf9f612){_0x144b87[_0xef88('0x2f')]=_0xf9f612;if(_0x13be27[_0xef88('0x44')]['includeAll']){_0x580e74[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x6d')][_0xef88('0x54')](_0x580e74);})[_0xef88('0x22')](function(_0x98f217){_0x144b87[_0xef88('0x67')]=_0x98f217;return _0x144b87;});}})[_0xef88('0x22')](respondWithFilteredResult(_0x3fcf44,_0x580e74))[_0xef88('0x55')](handleError(_0x3fcf44,null));};exports[_0xef88('0x6e')]=function(_0x205089,_0x1dc718,_0x213a59){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x205089['params']['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x1dc718,null))[_0xef88('0x22')](function(_0x46d197){if(_0x46d197){return _0x46d197[_0xef88('0x6e')](_0x205089['query'][_0xef88('0x69')]);}})[_0xef88('0x22')](respondWithStatusCode(_0x1dc718,null))['catch'](handleError(_0x1dc718,null));};exports[_0xef88('0x6f')]=function(_0x33e832,_0x4b9864,_0x4c6921){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x33e832['params']['id']}})['then'](handleEntityNotFound(_0x4b9864,null))[_0xef88('0x22')](function(_0x4507f0){if(_0x4507f0){return _0x4507f0[_0xef88('0x6f')](_0x33e832[_0xef88('0x61')][_0xef88('0x69')],_['omit'](_0x33e832[_0xef88('0x61')],[_0xef88('0x69'),'id'])||{})[_0xef88('0x70')](function(_0x30e699){for(var _0x21bf24=0x0;_0x21bf24<_0x33e832[_0xef88('0x61')][_0xef88('0x69')][_0xef88('0x59')];_0x21bf24+=0x1){socket[_0xef88('0x71')]('userWhatsappAccount:save',{'UserId':_0x33e832[_0xef88('0x61')][_0xef88('0x69')][_0x21bf24],'WhatsappAccountId':_0x33e832[_0xef88('0x57')]['id']});}return _0x30e699;});}})[_0xef88('0x22')](respondWithResult(_0x4b9864,null))['catch'](handleError(_0x4b9864,null));};exports['removeAgents']=function(_0x58c803,_0x46b142,_0x4f5bdb){return db['WhatsappAccount'][_0xef88('0x5e')]({'where':{'id':_0x58c803[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x46b142,null))[_0xef88('0x22')](function(_0x241335){if(_0x241335){return _0x241335[_0xef88('0x72')](_0x58c803[_0xef88('0x44')]['ids'])[_0xef88('0x22')](function(){if(_[_0xef88('0x73')](_0x58c803[_0xef88('0x44')]['ids'])){for(var _0x4725f1=0x0;_0x4725f1<_0x58c803[_0xef88('0x44')][_0xef88('0x69')][_0xef88('0x59')];_0x4725f1+=0x1){socket[_0xef88('0x71')](_0xef88('0x74'),{'UserId':Number(_0x58c803[_0xef88('0x44')][_0xef88('0x69')][_0x4725f1]),'WhatsappAccountId':Number(_0x58c803['params']['id'])});}}else{socket[_0xef88('0x71')](_0xef88('0x74'),{'UserId':Number(_0x58c803['query'][_0xef88('0x69')]),'WhatsappAccountId':Number(_0x58c803[_0xef88('0x57')]['id'])});}});}})[_0xef88('0x22')](respondWithStatusCode(_0x46b142,null))[_0xef88('0x55')](handleError(_0x46b142,null));};exports['getAgents']=function(_0x4e5d3d,_0x226e33,_0x23a1bd){var _0x1f96e3={};var _0x5620df={};var _0x3ccba5;var _0x91c51c;return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0x4e5d3d[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x226e33,null))[_0xef88('0x22')](function(_0x1d8ba0){if(_0x1d8ba0){_0x3ccba5=_0x1d8ba0;_0x5620df[_0xef88('0x42')]=_[_0xef88('0x45')](db[_0xef88('0x75')][_0xef88('0x3f')]);_0x5620df[_0xef88('0x44')]=_[_0xef88('0x45')](_0x4e5d3d['query']);_0x5620df['filters']=_[_0xef88('0x47')](_0x5620df[_0xef88('0x42')],_0x5620df[_0xef88('0x44')]);_0x1f96e3['attributes']=_[_0xef88('0x47')](_0x5620df[_0xef88('0x42')],qs[_0xef88('0x49')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x49')]));_0x1f96e3[_0xef88('0x48')]=_0x1f96e3['attributes'][_0xef88('0x59')]?_0x1f96e3[_0xef88('0x48')]:_0x5620df[_0xef88('0x42')];_0x1f96e3['order']=qs[_0xef88('0x66')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x66')]);_0x1f96e3[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x4e5d3d[_0xef88('0x44')],_0x5620df[_0xef88('0x46')]));if(_0x4e5d3d['query']['filter']){_0x1f96e3['where']=_['merge'](_0x1f96e3[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x1f96e3[_0xef88('0x48')],function(_0x54b7db){var _0x1a2091={};_0x1a2091[_0x54b7db]={'$like':'%'+_0x4e5d3d['query'][_0xef88('0x4f')]+'%'};return _0x1a2091;})});}_0x1f96e3=_[_0xef88('0x50')]({},_0x1f96e3,_0x4e5d3d['options']);return _0x3ccba5['getAgents'](_0x1f96e3);}})[_0xef88('0x22')](function(_0x253f60){if(_0x253f60){_0x91c51c=_0x253f60['length'];if(!_0x4e5d3d[_0xef88('0x44')][_0xef88('0x4a')]('nolimit')){_0x1f96e3['limit']=qs[_0xef88('0x31')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x31')]);_0x1f96e3['offset']=qs[_0xef88('0x30')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x30')]);}return _0x3ccba5[_0xef88('0x76')](_0x1f96e3);}})[_0xef88('0x22')](function(_0x3e8924){if(_0x3e8924){return _0x3e8924?{'count':_0x91c51c,'rows':_0x3e8924}:null;}})[_0xef88('0x22')](respondWithResult(_0x226e33,null))[_0xef88('0x55')](handleError(_0x226e33,null));};exports[_0xef88('0x77')]=function(_0x3d689e,_0x1dd47d,_0x5371d8){return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0x3d689e[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x1dd47d,null))[_0xef88('0x22')](function(_0x36f394){if(_0x36f394){return db[_0xef88('0x78')]['transaction'](function(_0x518194){return db[_0xef88('0x79')][_0xef88('0x36')]({'where':{'WhatsappAccountId':_0x3d689e[_0xef88('0x57')]['id']},'transaction':_0x518194})['then'](function(_0x209999){var _0x2f7fb6=_[_0xef88('0x43')](_0x3d689e[_0xef88('0x61')],function(_0x4a79c3){_0x4a79c3[_0xef88('0x63')]=_0x3d689e[_0xef88('0x57')]['id'];return _0x4a79c3;});return db[_0xef88('0x79')][_0xef88('0x7a')](_0x2f7fb6,{'transaction':_0x518194});});})[_0xef88('0x22')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x3d689e[_0xef88('0x57')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1dd47d,null))[_0xef88('0x55')](handleError(_0x1dd47d,null));};exports[_0xef88('0x7b')]=function(_0xc677be,_0x31d31a,_0x3d2f42){var _0x5ee844={};var _0x3a84f8={};var _0x55e2fc;var _0x4d2ba2;return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0xc677be[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x31d31a,null))[_0xef88('0x22')](function(_0x3ecb6e){if(_0x3ecb6e){_0x55e2fc=_0x3ecb6e;_0x3a84f8['model']=_['keys'](db[_0xef88('0x79')][_0xef88('0x3f')]);_0x3a84f8[_0xef88('0x44')]=_[_0xef88('0x45')](_0xc677be[_0xef88('0x44')]);_0x3a84f8['filters']=_[_0xef88('0x47')](_0x3a84f8[_0xef88('0x42')],_0x3a84f8[_0xef88('0x44')]);_0x5ee844[_0xef88('0x48')]=_[_0xef88('0x47')](_0x3a84f8[_0xef88('0x42')],qs[_0xef88('0x49')](_0xc677be[_0xef88('0x44')][_0xef88('0x49')]));_0x5ee844[_0xef88('0x48')]=_0x5ee844['attributes'][_0xef88('0x59')]?_0x5ee844['attributes']:_0x3a84f8[_0xef88('0x42')];_0x5ee844[_0xef88('0x4c')]=qs[_0xef88('0x66')](_0xc677be['query'][_0xef88('0x66')]);_0x5ee844['where']=qs[_0xef88('0x46')](_['pick'](_0xc677be['query'],_0x3a84f8[_0xef88('0x46')]));if(_0xc677be[_0xef88('0x44')][_0xef88('0x4f')]){_0x5ee844[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x5ee844[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x5ee844['attributes'],function(_0x25987a){var _0x5ce390={};_0x5ce390[_0x25987a]={'$like':'%'+_0xc677be['query'][_0xef88('0x4f')]+'%'};return _0x5ce390;})});}_0x5ee844=_['merge']({},_0x5ee844,_0xc677be[_0xef88('0x51')]);return _0x55e2fc['getApplications'](_0x5ee844);}})[_0xef88('0x22')](function(_0x5a67d4){if(_0x5a67d4){_0x4d2ba2=_0x5a67d4[_0xef88('0x59')];if(!_0xc677be[_0xef88('0x44')][_0xef88('0x4a')]('nolimit')){_0x5ee844[_0xef88('0x31')]=qs[_0xef88('0x31')](_0xc677be['query'][_0xef88('0x31')]);_0x5ee844[_0xef88('0x30')]=qs[_0xef88('0x30')](_0xc677be['query'][_0xef88('0x30')]);}return _0x55e2fc[_0xef88('0x7b')](_0x5ee844);}})['then'](function(_0x5f3469){if(_0x5f3469){return _0x5f3469?{'count':_0x4d2ba2,'rows':_0x5f3469}:null;}})[_0xef88('0x22')](respondWithResult(_0x31d31a,null))['catch'](handleError(_0x31d31a,null));};exports['notify']=function(_0x2acac0,_0x5a962d,_0x43c05f){var _0x18ea58={'channel':_0xef88('0x7c')};var _0x30c607=[];var _0xf3f8dc=[];var _0x1690d8={};return db[_0xef88('0x3e')]['find']({'where':{'id':_0x2acac0['params']['id']},'include':[{'model':db[_0xef88('0x79')],'as':_0xef88('0x7d')}]})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))['then'](function(_0x3037df){_0x18ea58[_0xef88('0x7e')]=_0x3037df;_0x18ea58[_0xef88('0x7f')]=_['orderBy'](_0x3037df[_0xef88('0x7d')],[_0xef88('0x80')],[_0xef88('0x81')]);if(_0x18ea58['account']['Applications']){delete _0x18ea58[_0xef88('0x7e')]['Applications'];}return db[_0xef88('0x82')][_0xef88('0x62')]();})[_0xef88('0x22')](function(_0x182efc){if(!_0x182efc){throw new db['Sequelize'][(_0xef88('0x83'))]('no\x20available\x20attributes');}_0x30c607=_['difference'](_[_0xef88('0x45')](_0x182efc),['createdAt',_0xef88('0x84')]);_0xf3f8dc=_[_0xef88('0x85')](_['keys'](_0x182efc),[_0xef88('0x86'),'updatedAt',_0xef88('0x87'),'ListId']);_0x18ea58['body']={'mapKey':_0xef88('0x88')};if(_0x18ea58['account'][_0xef88('0x41')]&&_0x18ea58[_0xef88('0x7e')][_0xef88('0x41')]==='twilio'){_0x18ea58[_0xef88('0x61')]['from']=_0x2acac0[_0xef88('0x61')][_0xef88('0x89')][_0xef88('0x8a')](_0xef88('0x8b'),'');_0x18ea58['body'][_0xef88('0x61')]=_0x2acac0[_0xef88('0x61')]['Body'];_0x18ea58[_0xef88('0x61')][_0xef88('0x8c')]=_0x2acac0[_0xef88('0x61')][_0xef88('0x8d')];}if(_0x18ea58['body']['id']){delete _0x18ea58[_0xef88('0x61')]['id'];}if(_[_0xef88('0x8e')](_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')])){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x91'));}if(_[_0xef88('0x8e')](_0x18ea58[_0xef88('0x61')][_0xef88('0x61')])||_0x18ea58[_0xef88('0x61')][_0xef88('0x61')]===''){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x92'));}if(_[_0xef88('0x8e')](_0x18ea58['body'][_0xef88('0x93')])){throw new db['Sequelize'][(_0xef88('0x83'))](_0xef88('0x94')+_0xf3f8dc);}if(!_[_0xef88('0x95')](_0xf3f8dc,_0x18ea58[_0xef88('0x61')][_0xef88('0x93')])){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x96')+_0xf3f8dc);}_0x1690d8[_0x18ea58[_0xef88('0x61')][_0xef88('0x93')]]=_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')];return db[_0xef88('0x97')][_0xef88('0x5e')]({'where':{'id':_0x18ea58['account'][_0xef88('0x98')]},'include':[{'model':db['CmContact'],'as':_0xef88('0x99'),'where':_0x1690d8,'limit':0x1,'order':[[_0xef88('0x84'),'DESC']]}]});})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))[_0xef88('0x22')](function(_0x131734){if(_0x131734){_0x18ea58[_0xef88('0x9a')]=_[_0xef88('0x9b')](_0x131734,[_0xef88('0x99')]);if(_0x131734['Contacts'][_0xef88('0x59')]){return _0x131734['Contacts'][0x0];}var _0x5379c8=_['defaults'](_0x18ea58[_0xef88('0x61')],{'firstName':_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')],'ListId':_0x131734['id']});_0x5379c8[_0x18ea58['body']['mapKey']]=_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')];return db[_0xef88('0x82')][_0xef88('0x5a')](_0x5379c8,{'fields':_0x30c607,'raw':!![]});}})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))[_0xef88('0x22')](function(_0x3e603c){if(_0x3e603c){_0x18ea58[_0xef88('0x9c')]=_0x3e603c;var _0x46a68c={'ContactId':_0x3e603c['id'],'phone':_0x18ea58['body'][_0xef88('0x8f')],'WhatsappAccountId':_0x2acac0[_0xef88('0x57')]['id']};var _0x35ef2d={'ContactId':_0x3e603c['id'],'WhatsappAccountId':_0x2acac0[_0xef88('0x57')]['id'],'closed':![]};return db[_0xef88('0x9d')][_0xef88('0x5e')]({'where':_0x35ef2d})[_0xef88('0x22')](function(_0x4b544b){if(_0x4b544b){return[_0x4b544b,![]];}return db[_0xef88('0x9d')][_0xef88('0x5a')](_0x46a68c)[_0xef88('0x22')](function(_0x203ee6){return[_0x203ee6,!![]];});});}})['spread'](function(_0x4cf92c,_0x455dd9){_0x18ea58[_0xef88('0x9e')]=_0x4cf92c['get']({'plain':!![]});_0x18ea58[_0xef88('0x9e')][_0xef88('0x9f')]=![];if(_0x455dd9){if(_0x18ea58[_0xef88('0x7e')][_0xef88('0xa0')]){_0x18ea58[_0xef88('0x7f')][_0xef88('0xa1')]({'id':0x0,'priority':_0x18ea58[_0xef88('0x7f')][_0xef88('0x59')]+0x1,'app':_0xef88('0xa2'),'appdata':_0xef88('0xa3'),'interval':_0xef88('0xa4')});}_0x18ea58[_0xef88('0x9e')]['created']=!![];}return db['WhatsappMessage'][_0xef88('0x5a')]({'phone':_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')],'messageId':_0x18ea58[_0xef88('0x61')][_0xef88('0x8c')],'body':_0x18ea58[_0xef88('0x61')][_0xef88('0x61')],'WhatsappAccountId':_0x2acac0['params']['id'],'WhatsappInteractionId':_0x4cf92c['id'],'direction':'in','ContactId':_0x4cf92c[_0xef88('0xa5')],'AttachmentId':_0x18ea58[_0xef88('0x61')][_0xef88('0xa6')]});})[_0xef88('0x22')](function(_0x1ed1f5){_0x18ea58['message']=_0x1ed1f5;if(_0x18ea58[_0xef88('0x9e')][_0xef88('0xa7')]){return db['User'][_0xef88('0x5e')]({'attributes':['id',_0xef88('0x3b')],'where':{'id':_0x18ea58[_0xef88('0x9e')][_0xef88('0xa7')]}})['then'](function(_0x156bb7){if(_0x156bb7){_0x18ea58['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xef88('0xa8'),'appdata':_0x156bb7['name']+','+(_0x18ea58[_0xef88('0x7e')][_0xef88('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xef88('0xaa'),_0xef88('0xab'),_0x18ea58);});}return respondWithRpcPromise(_0xef88('0xaa'),_0xef88('0xab'),_0x18ea58);})[_0xef88('0x22')](function(_0x26e923){if(_0x26e923){var _0x342409=0xc8;var _0x6e2ef8=_0xef88('0xac');logger[_0xef88('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6e2ef8,_0x342409,_0xef88('0xad'));logger[_0xef88('0x25')](_0xef88('0xae'),_0x6e2ef8,_0x342409,_0xef88('0xad'),JSON[_0xef88('0xaf')](_0x26e923));if(_0x18ea58[_0xef88('0x7e')][_0xef88('0x41')]===_0xef88('0xb0')){return _0x5a962d['status'](_0x342409)[_0xef88('0x32')](_0xef88('0xb1'),_0xef88('0xb2'))[_0xef88('0xb3')](_0xef88('0xb4'));}else{return _0x5a962d['status'](_0x342409)['json'](_0x26e923);}}})[_0xef88('0x55')](handleError(_0x5a962d,null));};exports[_0xef88('0xb3')]=function(_0x3a8cd3,_0x1ddfa3,_0x34b058){var _0x2287db,_0x306c59,_0x1fc1d8;if(_[_0xef88('0x8e')](_0x3a8cd3[_0xef88('0x61')][_0xef88('0x61')])||_0x3a8cd3[_0xef88('0x61')][_0xef88('0x61')]===''){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xef88('0x8e')](_0x3a8cd3[_0xef88('0x61')]['to'])){throw new db['Sequelize'][(_0xef88('0x83'))](_0xef88('0xb5'));}_0x2287db=_0x3a8cd3[_0xef88('0x61')]['to'];return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x3a8cd3[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x97')],'as':'List','include':[{'model':db['CmContact'],'as':_0xef88('0x99'),'where':{'mobile':_0x2287db},'limit':0x1,'order':[[_0xef88('0x84'),_0xef88('0xb6')]]}]}]})[_0xef88('0x22')](handleEntityNotFound(_0x1ddfa3,null))[_0xef88('0x22')](function(_0x198def){if(_0x198def&&_0x198def[_0xef88('0xb7')]){_0x306c59=_0x198def[_0xef88('0x37')]({'plain':!![]});if(_0x306c59[_0xef88('0xb7')]&&_0x306c59['List'][_0xef88('0x99')][_0xef88('0x59')]){return _0x306c59['List']['Contacts'][0x0];}return db[_0xef88('0x82')][_0xef88('0x5a')](_[_0xef88('0x1b')](_0x3a8cd3[_0xef88('0x61')],{'firstName':_0x2287db,'mobile':_0x2287db,'phone':_0x2287db,'ListId':_0x306c59['ListId']}));}})[_0xef88('0x22')](handleEntityNotFound(_0x1ddfa3,null))[_0xef88('0x22')](function(_0x3b2fe5){if(_0x3b2fe5){_0x1fc1d8=_0x3b2fe5;return db[_0xef88('0x9d')][_0xef88('0x5e')]({'where':{'ContactId':_0x1fc1d8['id'],'closed':![],'WhatsappAccountId':_0x306c59['id']}})[_0xef88('0x22')](function(_0x35f678){if(_0x35f678){return[_0x35f678,![]];}return db[_0xef88('0x9d')]['create']({'UserId':_0x3a8cd3[_0xef88('0xb8')]['id'],'ContactId':_0x1fc1d8['id'],'WhatsappAccountId':_0x306c59['id'],'phone':_0x2287db,'firstMsgDirection':'out','Messages':[_[_0xef88('0x50')](_0x3a8cd3['body'],{'read':![],'body':_0x3a8cd3[_0xef88('0x61')]['body'],'phone':_0x2287db,'WhatsappAccountId':_0x306c59['id'],'UserId':_0x3a8cd3['user']['id'],'ContactId':_0x1fc1d8['id']})]},{'include':[{'model':db[_0xef88('0xb9')],'as':_0xef88('0xba')}]})[_0xef88('0x22')](function(_0x21e0af){return[_0x21e0af,!![]];});});}})[_0xef88('0x70')](function(_0x58fb0c,_0x369dbb){if(_0x369dbb){return _0x58fb0c;}return db[_0xef88('0xb9')][_0xef88('0x5a')](_['merge'](_0x3a8cd3['body'],{'read':![],'body':_0x3a8cd3[_0xef88('0x61')]['body'],'phone':_0x2287db,'WhatsappAccountId':_0x306c59['id'],'WhatsappInteractionId':_0x58fb0c['id'],'UserId':_0x3a8cd3[_0xef88('0xb8')]['id'],'ContactId':_0x1fc1d8['id']}))[_0xef88('0x22')](function(_0x551875){_0x58fb0c[_0xef88('0xbb')][_0xef88('0xba')]=[];_0x58fb0c[_0xef88('0xbb')][_0xef88('0xba')]['push'](_0x551875[_0xef88('0xbb')]);return _0x58fb0c;});})[_0xef88('0x22')](respondWithResult(_0x1ddfa3,null))['catch'](handleError(_0x1ddfa3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index dfac756..4642c7a 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x35a0e2,_0x302ad1){var _0x31ea9a=function(_0x356d7d){while(--_0x356d7d){_0x35a0e2['push'](_0x35a0e2['shift']());}};_0x31ea9a(++_0x302ad1);}(_0x2ef3,0xba));var _0x32ef=function(_0xc1d0bc,_0xdb6df6){_0xc1d0bc=_0xc1d0bc-0x0;var _0x1a1a97=_0x2ef3[_0xc1d0bc];return _0x1a1a97;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var WhatsappAccount=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){WhatsappAccountEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);WhatsappAccountEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5430=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2dc89d,_0x1cef93){var _0x294caa=function(_0x3ff818){while(--_0x3ff818){_0x2dc89d['push'](_0x2dc89d['shift']());}};_0x294caa(++_0x1cef93);}(_0x5430,0x10c));var _0x0543=function(_0x1d61c3,_0xbdb02d){_0x1d61c3=_0x1d61c3-0x0;var _0x2ea27f=_0x5430[_0x1d61c3];return _0x2ea27f;};'use strict';var EventEmitter=require(_0x0543('0x0'));var WhatsappAccount=require(_0x0543('0x1'))['db'][_0x0543('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0543('0x3')](0x0);var events={'afterCreate':_0x0543('0x4'),'afterUpdate':_0x0543('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b122c){return function(_0x1c5ab7,_0x4ee416,_0x523f3d){WhatsappAccountEvents[_0x0543('0x6')](_0x5b122c+':'+_0x1c5ab7['id'],_0x1c5ab7);WhatsappAccountEvents[_0x0543('0x6')](_0x5b122c,_0x1c5ab7);_0x523f3d(null);};}for(var e in events){if(events[_0x0543('0x7')](e)){var event=events[e];WhatsappAccount[_0x0543('0x8')](e,emitEvent(event));}}module[_0x0543('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0f5b55a..bd15cb3 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 _0x338e=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util','../../config/logger','moment','request-promise'];(function(_0x51be3e,_0x4d2123){var _0x148d23=function(_0x7277d8){while(--_0x7277d8){_0x51be3e['push'](_0x51be3e['shift']());}};_0x148d23(++_0x4d2123);}(_0x338e,0xc1));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe338('0x0'));var util=require(_0xe338('0x1'));var logger=require(_0xe338('0x2'))('api');var moment=require(_0xe338('0x3'));var BPromise=require('bluebird');var rp=require(_0xe338('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe338('0x5'));var config=require(_0xe338('0x6'));var attributes=require(_0xe338('0x7'));module[_0xe338('0x8')]=function(_0x5e5451,_0x5c9b33){return _0x5e5451[_0xe338('0x9')](_0xe338('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0f4=['WhatsappAccount','lodash','util','api','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x19d9a3,_0x37b0c7){var _0x171ae9=function(_0x470d98){while(--_0x470d98){_0x19d9a3['push'](_0x19d9a3['shift']());}};_0x171ae9(++_0x37b0c7);}(_0xe0f4,0x1eb));var _0x4e0f=function(_0x1bbcee,_0x29695e){_0x1bbcee=_0x1bbcee-0x0;var _0x13b7d7=_0xe0f4[_0x1bbcee];return _0x13b7d7;};'use strict';var _=require(_0x4e0f('0x0'));var util=require(_0x4e0f('0x1'));var logger=require('../../config/logger')(_0x4e0f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e0f('0x3'));var fs=require('fs');var path=require(_0x4e0f('0x4'));var rimraf=require(_0x4e0f('0x5'));var config=require(_0x4e0f('0x6'));var attributes=require(_0x4e0f('0x7'));module[_0x4e0f('0x8')]=function(_0x2eea6b,_0x35f829){return _0x2eea6b['define'](_0x4e0f('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index accad93..4828493 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 _0x628a=['localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x3886dc,_0x44c49b){var _0x244909=function(_0x362b29){while(--_0x362b29){_0x3886dc['push'](_0x3886dc['shift']());}};_0x244909(++_0x44c49b);}(_0x628a,0x1bb));var _0xa628=function(_0x31d930,_0x32ea96){_0x31d930=_0x31d930-0x0;var _0x26e2ef=_0x628a[_0x31d930];return _0x26e2ef;};'use strict';var _=require(_0xa628('0x0'));var util=require(_0xa628('0x1'));var moment=require('moment');var BPromise=require(_0xa628('0x2'));var rs=require(_0xa628('0x3'));var fs=require('fs');var Redis=require(_0xa628('0x4'));var db=require(_0xa628('0x5'))['db'];var utils=require(_0xa628('0x6'));var logger=require(_0xa628('0x7'))('rpc');var config=require(_0xa628('0x8'));var jayson=require(_0xa628('0x9'));var client=jayson[_0xa628('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa628('0xb')](config[_0xa628('0xc')],{'host':_0xa628('0xd'),'port':0x18eb});var socket=require(_0xa628('0xe'))(new Redis(config[_0xa628('0xc')]));require(_0xa628('0xf'))[_0xa628('0x10')](socket);function respondWithRpcPromise(_0x598bdc,_0x401b5d,_0x30284c){return new BPromise(function(_0x1577d6,_0x58f628){return client[_0xa628('0x11')](_0x598bdc,_0x30284c)[_0xa628('0x12')](function(_0x1c5fbb){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x401b5d,_0xa628('0x13'));logger[_0xa628('0x14')](_0xa628('0x15'),_0x401b5d,'request\x20sent',JSON[_0xa628('0x16')](_0x1c5fbb));if(_0x1c5fbb['error']){if(_0x1c5fbb[_0xa628('0x17')]['code']===0x1f4){logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x1c5fbb['error'][_0xa628('0x19')]);return _0x58f628(_0x1c5fbb[_0xa628('0x17')][_0xa628('0x19')]);}logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x1c5fbb[_0xa628('0x17')][_0xa628('0x19')]);return _0x1577d6(_0x1c5fbb['error'][_0xa628('0x19')]);}else{logger[_0xa628('0x1a')](_0xa628('0x18'),_0x401b5d,_0xa628('0x13'));_0x1577d6(_0x1c5fbb[_0xa628('0x1b')][_0xa628('0x19')]);}})[_0xa628('0x1c')](function(_0x15caf9){logger[_0xa628('0x17')](_0xa628('0x18'),_0x401b5d,_0x15caf9);_0x58f628(_0x15caf9);});});}exports[_0xa628('0x1d')]=function(_0x51ba03){var _0x147aae=this;return new Promise(function(_0x18e215,_0x540a22){return db['WhatsappAccount'][_0xa628('0x1e')]({'raw':_0x51ba03[_0xa628('0x1f')]?_0x51ba03[_0xa628('0x1f')][_0xa628('0x20')]===undefined?!![]:![]:!![],'where':_0x51ba03[_0xa628('0x1f')]?_0x51ba03['options'][_0xa628('0x21')]||null:null,'attributes':_0x51ba03[_0xa628('0x1f')]?_0x51ba03[_0xa628('0x1f')][_0xa628('0x22')]||null:null,'include':_0x51ba03[_0xa628('0x1f')]?_0x51ba03['options'][_0xa628('0x23')]?_[_0xa628('0x24')](_0x51ba03[_0xa628('0x1f')][_0xa628('0x23')],function(_0x110201){return{'model':db[_0x110201['model']],'as':_0x110201['as'],'attributes':_0x110201[_0xa628('0x22')],'include':_0x110201[_0xa628('0x23')]?_[_0xa628('0x24')](_0x110201[_0xa628('0x23')],function(_0x41b4c3){return{'model':db[_0x41b4c3['model']],'as':_0x41b4c3['as'],'attributes':_0x41b4c3[_0xa628('0x22')],'include':_0x41b4c3[_0xa628('0x23')]?_[_0xa628('0x24')](_0x41b4c3['include'],function(_0x5d4107){return{'model':db[_0x5d4107[_0xa628('0x25')]],'as':_0x5d4107['as'],'attributes':_0x5d4107[_0xa628('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa628('0x12')](function(_0x4e3272){logger[_0xa628('0x1a')](_0xa628('0x1d'),_0x51ba03);logger[_0xa628('0x14')](_0xa628('0x1d'),_0x51ba03,JSON[_0xa628('0x16')](_0x4e3272));_0x18e215(_0x4e3272);})[_0xa628('0x1c')](function(_0x13c53e){logger[_0xa628('0x17')](_0xa628('0x1d'),_0x13c53e[_0xa628('0x19')],_0x51ba03);_0x540a22(_0x147aae[_0xa628('0x17')](0x1f4,_0x13c53e[_0xa628('0x19')]));});});}; \ No newline at end of file +var _0x2697=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount','find','options','include','map','model','attributes','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info'];(function(_0x1df35d,_0x5c49c0){var _0xef1546=function(_0x2e091e){while(--_0x2e091e){_0x1df35d['push'](_0x1df35d['shift']());}};_0xef1546(++_0x5c49c0);}(_0x2697,0x120));var _0x7269=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x2697[_0x594ece];return _0x471bc4;};'use strict';var _=require('lodash');var util=require(_0x7269('0x0'));var moment=require(_0x7269('0x1'));var BPromise=require(_0x7269('0x2'));var rs=require(_0x7269('0x3'));var fs=require('fs');var Redis=require(_0x7269('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7269('0x5'));var logger=require('../../config/logger')(_0x7269('0x6'));var config=require(_0x7269('0x7'));var jayson=require(_0x7269('0x8'));var client=jayson[_0x7269('0x9')][_0x7269('0xa')]({'port':0x232a});config[_0x7269('0xb')]=_[_0x7269('0xc')](config[_0x7269('0xb')],{'host':_0x7269('0xd'),'port':0x18eb});var socket=require(_0x7269('0xe'))(new Redis(config[_0x7269('0xb')]));require('./whatsappAccount.socket')[_0x7269('0xf')](socket);function respondWithRpcPromise(_0x1395a1,_0x5c236a,_0x3c21f9){return new BPromise(function(_0x5e1cbf,_0x300f31){return client['request'](_0x1395a1,_0x3c21f9)[_0x7269('0x10')](function(_0x4c18f7){logger[_0x7269('0x11')](_0x7269('0x12'),_0x5c236a,_0x7269('0x13'));logger['debug'](_0x7269('0x14'),_0x5c236a,_0x7269('0x13'),JSON['stringify'](_0x4c18f7));if(_0x4c18f7[_0x7269('0x15')]){if(_0x4c18f7[_0x7269('0x15')][_0x7269('0x16')]===0x1f4){logger['error'](_0x7269('0x12'),_0x5c236a,_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);return _0x300f31(_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);}logger[_0x7269('0x15')](_0x7269('0x12'),_0x5c236a,_0x4c18f7[_0x7269('0x15')]['message']);return _0x5e1cbf(_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);}else{logger[_0x7269('0x11')](_0x7269('0x12'),_0x5c236a,'request\x20sent');_0x5e1cbf(_0x4c18f7['result']['message']);}})[_0x7269('0x18')](function(_0x1c9163){logger[_0x7269('0x15')](_0x7269('0x12'),_0x5c236a,_0x1c9163);_0x300f31(_0x1c9163);});});}exports[_0x7269('0x19')]=function(_0x20bda7){var _0x97598e=this;return new Promise(function(_0x57ecc9,_0x4f0d05){return db['WhatsappAccount'][_0x7269('0x1a')]({'raw':_0x20bda7['options']?_0x20bda7[_0x7269('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')]['where']||null:null,'attributes':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')]['attributes']||null:null,'include':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')][_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x20bda7['options'][_0x7269('0x1c')],function(_0x2b8e9e){return{'model':db[_0x2b8e9e[_0x7269('0x1e')]],'as':_0x2b8e9e['as'],'attributes':_0x2b8e9e[_0x7269('0x1f')],'include':_0x2b8e9e[_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x2b8e9e['include'],function(_0x198b59){return{'model':db[_0x198b59[_0x7269('0x1e')]],'as':_0x198b59['as'],'attributes':_0x198b59[_0x7269('0x1f')],'include':_0x198b59[_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x198b59['include'],function(_0x33c43a){return{'model':db[_0x33c43a[_0x7269('0x1e')]],'as':_0x33c43a['as'],'attributes':_0x33c43a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7269('0x10')](function(_0x492e73){logger[_0x7269('0x11')](_0x7269('0x19'),_0x20bda7);logger[_0x7269('0x20')](_0x7269('0x19'),_0x20bda7,JSON[_0x7269('0x21')](_0x492e73));_0x57ecc9(_0x492e73);})['catch'](function(_0x43e363){logger[_0x7269('0x15')](_0x7269('0x19'),_0x43e363[_0x7269('0x17')],_0x20bda7);_0x4f0d05(_0x97598e['error'](0x1f4,_0x43e363[_0x7269('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 66062db..aa47445 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 _0x5dd2=['register','./whatsappAccount.events','save','emit','removeListener'];(function(_0x1ac1b1,_0x5f5b9e){var _0x17f81e=function(_0x2fd4bb){while(--_0x2fd4bb){_0x1ac1b1['push'](_0x1ac1b1['shift']());}};_0x17f81e(++_0x5f5b9e);}(_0x5dd2,0x65));var _0x25dd=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x5dd2[_0x82129b];return _0x2ae5dc;};'use strict';var WhatsappAccountEvents=require(_0x25dd('0x0'));var events=[_0x25dd('0x1'),'remove','update'];function createListener(_0x114f9,_0x2cd27d){return function(_0x8d4b87){_0x2cd27d[_0x25dd('0x2')](_0x114f9,_0x8d4b87);};}function removeListener(_0x26b830,_0x4bfb2e){return function(){WhatsappAccountEvents[_0x25dd('0x3')](_0x26b830,_0x4bfb2e);};}exports[_0x25dd('0x4')]=function(_0xd74cdb){for(var _0x46abcf=0x0,_0x11334d=events['length'];_0x46abcf<_0x11334d;_0x46abcf++){var _0x157853=events[_0x46abcf];var _0x18fc2d=createListener('whatsappAccount:'+_0x157853,_0xd74cdb);WhatsappAccountEvents['on'](_0x157853,_0x18fc2d);}}; \ No newline at end of file +var _0xd084=['removeListener','length','whatsappAccount:','./whatsappAccount.events','save','emit'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xd084,0x1dd));var _0x4d08=function(_0x58f8f6,_0x207b30){_0x58f8f6=_0x58f8f6-0x0;var _0x1569dc=_0xd084[_0x58f8f6];return _0x1569dc;};'use strict';var WhatsappAccountEvents=require(_0x4d08('0x0'));var events=[_0x4d08('0x1'),'remove','update'];function createListener(_0x42fe3c,_0x52a548){return function(_0x413b54){_0x52a548[_0x4d08('0x2')](_0x42fe3c,_0x413b54);};}function removeListener(_0x3e531d,_0x2bd065){return function(){WhatsappAccountEvents[_0x4d08('0x3')](_0x3e531d,_0x2bd065);};}exports['register']=function(_0x20c559){for(var _0x253af8=0x0,_0x144cb5=events[_0x4d08('0x4')];_0x253af8<_0x144cb5;_0x253af8++){var _0x35f397=events[_0x253af8];var _0x564a4f=createListener(_0x4d08('0x5')+_0x35f397,_0x20c559);WhatsappAccountEvents['on'](_0x35f397,_0x564a4f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d6ac698..f3efa7b 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 _0x3e6d=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3e6d,0x1bc));var _0xd3e6=function(_0x5d1caf,_0x3117e1){_0x5d1caf=_0x5d1caf-0x0;var _0xef37c6=_0x3e6d[_0x5d1caf];return _0xef37c6;};'use strict';var multer=require(_0xd3e6('0x0'));var util=require(_0xd3e6('0x1'));var path=require(_0xd3e6('0x2'));var timeout=require(_0xd3e6('0x3'));var express=require(_0xd3e6('0x4'));var router=express['Router']();var auth=require(_0xd3e6('0x5'));var interaction=require(_0xd3e6('0x6'));var config=require(_0xd3e6('0x7'));var controller=require(_0xd3e6('0x8'));router['get']('/',auth[_0xd3e6('0x9')](),controller['index']);router[_0xd3e6('0xa')](_0xd3e6('0xb'),auth['isAuthenticated'](),controller[_0xd3e6('0xc')]);router[_0xd3e6('0xd')]('/',auth[_0xd3e6('0x9')](),controller[_0xd3e6('0xe')]);router[_0xd3e6('0xf')](_0xd3e6('0xb'),auth[_0xd3e6('0x9')](),controller[_0xd3e6('0x10')]);router['delete'](_0xd3e6('0xb'),auth['isAuthenticated'](),controller[_0xd3e6('0x11')]);module[_0xd3e6('0x12')]=router; \ No newline at end of file +var _0xc41b=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xc41b,0xff));var _0xbc41=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc41b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xbc41('0x0'));var util=require(_0xbc41('0x1'));var path=require(_0xbc41('0x2'));var timeout=require(_0xbc41('0x3'));var express=require('express');var router=express[_0xbc41('0x4')]();var auth=require(_0xbc41('0x5'));var interaction=require(_0xbc41('0x6'));var config=require('../../config/environment');var controller=require(_0xbc41('0x7'));router[_0xbc41('0x8')]('/',auth[_0xbc41('0x9')](),controller[_0xbc41('0xa')]);router[_0xbc41('0x8')](_0xbc41('0xb'),auth[_0xbc41('0x9')](),controller[_0xbc41('0xc')]);router[_0xbc41('0xd')]('/',auth[_0xbc41('0x9')](),controller['create']);router[_0xbc41('0xe')](_0xbc41('0xb'),auth[_0xbc41('0x9')](),controller['update']);router[_0xbc41('0xf')]('/:id',auth[_0xbc41('0x9')](),controller[_0xbc41('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 287c155..f0ddd55 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 _0x3529=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x5de390,_0x3b9908){var _0x12bf75=function(_0x2d382f){while(--_0x2d382f){_0x5de390['push'](_0x5de390['shift']());}};_0x12bf75(++_0x3b9908);}(_0x3529,0xd4));var _0x9352=function(_0x40001a,_0x57f2ae){_0x40001a=_0x40001a-0x0;var _0x4cec45=_0x3529[_0x40001a];return _0x4cec45;};'use strict';var Sequelize=require('sequelize');module[_0x9352('0x0')]={'priority':{'type':Sequelize[_0x9352('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9352('0x2')],'allowNull':![],'defaultValue':_0x9352('0x3')},'appdata':{'type':Sequelize[_0x9352('0x4')]()},'description':{'type':Sequelize[_0x9352('0x2')]},'interval':{'type':Sequelize[_0x9352('0x2')],'defaultValue':_0x9352('0x5')}}; \ No newline at end of file +var _0xcde1=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xcde1,0x130));var _0x1cde=function(_0x1f48b3,_0x48856f){_0x1f48b3=_0x1f48b3-0x0;var _0x18771f=_0xcde1[_0x1f48b3];return _0x18771f;};'use strict';var Sequelize=require(_0x1cde('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1cde('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1cde('0x2')],'allowNull':![],'defaultValue':_0x1cde('0x3')},'appdata':{'type':Sequelize[_0x1cde('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1cde('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 33338cb..c10f632 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 _0x186b=['limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','merge','find','create','update','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x4f1b68,_0x210ac3){var _0x3f7dfd=function(_0x149bb8){while(--_0x149bb8){_0x4f1b68['push'](_0x4f1b68['shift']());}};_0x3f7dfd(++_0x210ac3);}(_0x186b,0x72));var _0xb186=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x186b[_0x5f0501];return _0x3c2c45;};'use strict';var pdf=require(_0xb186('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb186('0x1'));var rp=require(_0xb186('0x2'));var moment=require(_0xb186('0x3'));var BPromise=require(_0xb186('0x4'));var Mustache=require(_0xb186('0x5'));var util=require(_0xb186('0x6'));var path=require(_0xb186('0x7'));var sox=require(_0xb186('0x8'));var csv=require(_0xb186('0x9'));var ejs=require(_0xb186('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb186('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb186('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb186('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xb186('0xd'));var as=require(_0xb186('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb186('0xf'));var utils=require(_0xb186('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb186('0x11'));var db=require(_0xb186('0x12'))['db'];function respondWithStatusCode(_0x278ffd,_0x2b41af){_0x2b41af=_0x2b41af||0xcc;return function(_0x545a40){if(_0x545a40){return _0x278ffd['sendStatus'](_0x2b41af);}return _0x278ffd[_0xb186('0x13')](_0x2b41af)['end']();};}function respondWithResult(_0x28a955,_0x2df35f){_0x2df35f=_0x2df35f||0xc8;return function(_0x3a1305){if(_0x3a1305){return _0x28a955[_0xb186('0x13')](_0x2df35f)[_0xb186('0x14')](_0x3a1305);}};}function respondWithFilteredResult(_0x3d9ff1,_0x2b1491){return function(_0x2da20f){if(_0x2da20f){var _0x9719e3=_0x2da20f['count'],_0x1ac527=_0x2b1491[_0xb186('0x15')],_0x5e2d53=_0x2b1491['offset']+_0x2b1491[_0xb186('0x16')],_0x26ea32;if(_0x5e2d53>=_0x9719e3){_0x5e2d53=_0x9719e3;_0x26ea32=0xc8;}else{_0x26ea32=0xce;}_0x3d9ff1[_0xb186('0x13')](_0x26ea32);return _0x3d9ff1[_0xb186('0x17')](_0xb186('0x18'),_0x1ac527+'-'+_0x5e2d53+'/'+_0x9719e3)[_0xb186('0x14')](_0x2da20f);}return null;};}function patchUpdates(_0x5429b5){return function(_0x1b27cf){try{jsonpatch[_0xb186('0x19')](_0x1b27cf,_0x5429b5,!![]);}catch(_0x11bcc5){return BPromise[_0xb186('0x1a')](_0x11bcc5);}return _0x1b27cf[_0xb186('0x1b')]();};}function saveUpdates(_0x79b4ad,_0x33492d){return function(_0x1a11af){if(_0x1a11af){return _0x1a11af['update'](_0x79b4ad)[_0xb186('0x1c')](function(_0x17c9e4){return _0x17c9e4;});}return null;};}function removeEntity(_0x1b3630,_0x336942){return function(_0x5ef5c2){if(_0x5ef5c2){return _0x5ef5c2[_0xb186('0x1d')]()[_0xb186('0x1c')](function(){_0x1b3630[_0xb186('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9fbc,_0x2bd23f){return function(_0x5c2dae){if(!_0x5c2dae){_0x2f9fbc[_0xb186('0x1e')](0x194);}return _0x5c2dae;};}function handleError(_0xea03ec,_0x2f9b8b){_0x2f9b8b=_0x2f9b8b||0x1f4;return function(_0x23daba){logger[_0xb186('0x1f')](_0x23daba[_0xb186('0x20')]);if(_0x23daba[_0xb186('0x21')]){delete _0x23daba[_0xb186('0x21')];}_0xea03ec[_0xb186('0x13')](_0x2f9b8b)[_0xb186('0x22')](_0x23daba);};}exports[_0xb186('0x23')]=function(_0x4e6bd1,_0x21a429){var _0x289003={},_0x245ecc={},_0x3790f0={'count':0x0,'rows':[]};var _0x247601=_[_0xb186('0x24')](db[_0xb186('0x25')][_0xb186('0x26')],function(_0x2e86ae){return{'name':_0x2e86ae[_0xb186('0x27')],'type':_0x2e86ae['type'][_0xb186('0x28')]};});_0x245ecc[_0xb186('0x29')]=_[_0xb186('0x24')](_0x247601,_0xb186('0x21'));_0x245ecc['query']=_[_0xb186('0x2a')](_0x4e6bd1[_0xb186('0x2b')]);_0x245ecc[_0xb186('0x2c')]=_[_0xb186('0x2d')](_0x245ecc['model'],_0x245ecc[_0xb186('0x2b')]);_0x289003[_0xb186('0x2e')]=_[_0xb186('0x2d')](_0x245ecc[_0xb186('0x29')],qs[_0xb186('0x2f')](_0x4e6bd1[_0xb186('0x2b')]['fields']));_0x289003['attributes']=_0x289003[_0xb186('0x2e')][_0xb186('0x30')]?_0x289003['attributes']:_0x245ecc[_0xb186('0x29')];if(!_0x4e6bd1[_0xb186('0x2b')]['hasOwnProperty'](_0xb186('0x31'))){_0x289003['limit']=qs['limit'](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x16')]);_0x289003[_0xb186('0x15')]=qs[_0xb186('0x15')](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x15')]);}_0x289003[_0xb186('0x32')]=qs[_0xb186('0x33')](_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x33')]);_0x289003[_0xb186('0x34')]=qs['filters'](_[_0xb186('0x35')](_0x4e6bd1[_0xb186('0x2b')],_0x245ecc[_0xb186('0x2c')]),_0x247601);if(_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x36')]){_0x289003['where']=_['merge'](_0x289003[_0xb186('0x34')],{'$or':_[_0xb186('0x24')](_0x247601,function(_0x159854){if(_0x159854[_0xb186('0x37')]!=='VIRTUAL'){var _0x4f5699={};_0x4f5699[_0x159854[_0xb186('0x21')]]={'$like':'%'+_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x36')]+'%'};return _0x4f5699;}})});}_0x289003=_['merge']({},_0x289003,_0x4e6bd1[_0xb186('0x38')]);var _0x277907={'where':_0x289003[_0xb186('0x34')]};return db[_0xb186('0x25')]['count'](_0x277907)[_0xb186('0x1c')](function(_0x201b9e){_0x3790f0['count']=_0x201b9e;if(_0x4e6bd1[_0xb186('0x2b')][_0xb186('0x39')]){_0x289003[_0xb186('0x3a')]=[{'all':!![]}];}return db[_0xb186('0x25')][_0xb186('0x3b')](_0x289003);})['then'](function(_0x95e786){_0x3790f0[_0xb186('0x3c')]=_0x95e786;return _0x3790f0;})[_0xb186('0x1c')](respondWithFilteredResult(_0x21a429,_0x289003))[_0xb186('0x3d')](handleError(_0x21a429,null));};exports['show']=function(_0xae6f3b,_0x349b61){var _0x587130={'raw':!![],'where':{'id':_0xae6f3b[_0xb186('0x3e')]['id']}},_0x3d8c4f={};_0x3d8c4f[_0xb186('0x29')]=_[_0xb186('0x2a')](db[_0xb186('0x25')][_0xb186('0x26')]);_0x3d8c4f['query']=_[_0xb186('0x2a')](_0xae6f3b[_0xb186('0x2b')]);_0x3d8c4f[_0xb186('0x2c')]=_[_0xb186('0x2d')](_0x3d8c4f[_0xb186('0x29')],_0x3d8c4f[_0xb186('0x2b')]);_0x587130[_0xb186('0x2e')]=_['intersection'](_0x3d8c4f['model'],qs[_0xb186('0x2f')](_0xae6f3b[_0xb186('0x2b')]['fields']));_0x587130[_0xb186('0x2e')]=_0x587130['attributes'][_0xb186('0x30')]?_0x587130['attributes']:_0x3d8c4f[_0xb186('0x29')];if(_0xae6f3b[_0xb186('0x2b')][_0xb186('0x39')]){_0x587130[_0xb186('0x3a')]=[{'all':!![]}];}_0x587130=_[_0xb186('0x3f')]({},_0x587130,_0xae6f3b['options']);return db['WhatsappApplication'][_0xb186('0x40')](_0x587130)[_0xb186('0x1c')](handleEntityNotFound(_0x349b61,null))[_0xb186('0x1c')](respondWithResult(_0x349b61,null))[_0xb186('0x3d')](handleError(_0x349b61,null));};exports[_0xb186('0x41')]=function(_0x5af8c4,_0x41c3c2){return db['WhatsappApplication']['create'](_0x5af8c4['body'],{})[_0xb186('0x1c')](respondWithResult(_0x41c3c2,0xc9))[_0xb186('0x3d')](handleError(_0x41c3c2,null));};exports[_0xb186('0x42')]=function(_0x489812,_0x3a11f9){if(_0x489812['body']['id']){delete _0x489812[_0xb186('0x43')]['id'];}return db[_0xb186('0x25')][_0xb186('0x40')]({'where':{'id':_0x489812[_0xb186('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a11f9,null))[_0xb186('0x1c')](saveUpdates(_0x489812[_0xb186('0x43')],null))['then'](respondWithResult(_0x3a11f9,null))[_0xb186('0x3d')](handleError(_0x3a11f9,null));};exports['destroy']=function(_0x1c68f5,_0x4cdc74){return db[_0xb186('0x25')][_0xb186('0x40')]({'where':{'id':_0x1c68f5[_0xb186('0x3e')]['id']}})[_0xb186('0x1c')](handleEntityNotFound(_0x4cdc74,null))[_0xb186('0x1c')](removeEntity(_0x4cdc74,null))[_0xb186('0x3d')](handleError(_0x4cdc74,null));}; \ No newline at end of file +var _0x559d=['include','find','catch','create','body','params','html-pdf','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','then','destroy','sendStatus','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show'];(function(_0x43b92f,_0x41371f){var _0x23cb82=function(_0x241f22){while(--_0x241f22){_0x43b92f['push'](_0x43b92f['shift']());}};_0x23cb82(++_0x41371f);}(_0x559d,0xc0));var _0xd559=function(_0x3c57c7,_0x18e494){_0x3c57c7=_0x3c57c7-0x0;var _0x9c2cbb=_0x559d[_0x3c57c7];return _0x9c2cbb;};'use strict';var pdf=require(_0xd559('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd559('0x2'));var rp=require('request-promise');var moment=require(_0xd559('0x3'));var BPromise=require(_0xd559('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd559('0x5'));var csv=require(_0xd559('0x6'));var ejs=require(_0xd559('0x7'));var fs=require('fs');var _=require(_0xd559('0x8'));var squel=require(_0xd559('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd559('0xa'));var toCsv=require(_0xd559('0x6'));var querystring=require(_0xd559('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd559('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd559('0xd'));var licenseUtil=require(_0xd559('0xe'));var db=require(_0xd559('0xf'))['db'];function respondWithStatusCode(_0x4214cd,_0x262fb7){_0x262fb7=_0x262fb7||0xcc;return function(_0x5c5002){if(_0x5c5002){return _0x4214cd['sendStatus'](_0x262fb7);}return _0x4214cd[_0xd559('0x10')](_0x262fb7)[_0xd559('0x11')]();};}function respondWithResult(_0x48abf1,_0x4e4cb3){_0x4e4cb3=_0x4e4cb3||0xc8;return function(_0x527925){if(_0x527925){return _0x48abf1['status'](_0x4e4cb3)[_0xd559('0x12')](_0x527925);}};}function respondWithFilteredResult(_0x2cc5bc,_0x150b48){return function(_0x168c46){if(_0x168c46){var _0x338ce4=_0x168c46[_0xd559('0x13')],_0x21a145=_0x150b48['offset'],_0xa61036=_0x150b48[_0xd559('0x14')]+_0x150b48[_0xd559('0x15')],_0x13c678;if(_0xa61036>=_0x338ce4){_0xa61036=_0x338ce4;_0x13c678=0xc8;}else{_0x13c678=0xce;}_0x2cc5bc[_0xd559('0x10')](_0x13c678);return _0x2cc5bc['set']('Content-Range',_0x21a145+'-'+_0xa61036+'/'+_0x338ce4)[_0xd559('0x12')](_0x168c46);}return null;};}function patchUpdates(_0x4b4dc8){return function(_0x529497){try{jsonpatch[_0xd559('0x16')](_0x529497,_0x4b4dc8,!![]);}catch(_0x3fb32b){return BPromise[_0xd559('0x17')](_0x3fb32b);}return _0x529497['save']();};}function saveUpdates(_0x38e80c,_0x32abab){return function(_0x3ebba1){if(_0x3ebba1){return _0x3ebba1['update'](_0x38e80c)[_0xd559('0x18')](function(_0x3f1e76){return _0x3f1e76;});}return null;};}function removeEntity(_0x1d3ce3,_0x8c5a19){return function(_0xf69680){if(_0xf69680){return _0xf69680[_0xd559('0x19')]()[_0xd559('0x18')](function(){_0x1d3ce3[_0xd559('0x10')](0xcc)[_0xd559('0x11')]();});}};}function handleEntityNotFound(_0x557c24,_0x175999){return function(_0x55c26c){if(!_0x55c26c){_0x557c24[_0xd559('0x1a')](0x194);}return _0x55c26c;};}function handleError(_0x2fdd45,_0x358371){_0x358371=_0x358371||0x1f4;return function(_0x4c1225){logger[_0xd559('0x1b')](_0x4c1225['stack']);if(_0x4c1225[_0xd559('0x1c')]){delete _0x4c1225[_0xd559('0x1c')];}_0x2fdd45[_0xd559('0x10')](_0x358371)['send'](_0x4c1225);};}exports[_0xd559('0x1d')]=function(_0x2678c5,_0x4755bd){var _0x5a7dfb={},_0x27fb47={},_0x587528={'count':0x0,'rows':[]};var _0x73ef5b=_[_0xd559('0x1e')](db[_0xd559('0x1f')][_0xd559('0x20')],function(_0x3823f4){return{'name':_0x3823f4[_0xd559('0x21')],'type':_0x3823f4[_0xd559('0x22')]['key']};});_0x27fb47[_0xd559('0x23')]=_[_0xd559('0x1e')](_0x73ef5b,'name');_0x27fb47[_0xd559('0x24')]=_[_0xd559('0x25')](_0x2678c5[_0xd559('0x24')]);_0x27fb47[_0xd559('0x26')]=_[_0xd559('0x27')](_0x27fb47[_0xd559('0x23')],_0x27fb47['query']);_0x5a7dfb[_0xd559('0x28')]=_[_0xd559('0x27')](_0x27fb47[_0xd559('0x23')],qs[_0xd559('0x29')](_0x2678c5[_0xd559('0x24')][_0xd559('0x29')]));_0x5a7dfb[_0xd559('0x28')]=_0x5a7dfb[_0xd559('0x28')][_0xd559('0x2a')]?_0x5a7dfb[_0xd559('0x28')]:_0x27fb47[_0xd559('0x23')];if(!_0x2678c5[_0xd559('0x24')][_0xd559('0x2b')](_0xd559('0x2c'))){_0x5a7dfb[_0xd559('0x15')]=qs['limit'](_0x2678c5['query'][_0xd559('0x15')]);_0x5a7dfb[_0xd559('0x14')]=qs[_0xd559('0x14')](_0x2678c5[_0xd559('0x24')][_0xd559('0x14')]);}_0x5a7dfb[_0xd559('0x2d')]=qs['sort'](_0x2678c5[_0xd559('0x24')]['sort']);_0x5a7dfb['where']=qs[_0xd559('0x26')](_[_0xd559('0x2e')](_0x2678c5['query'],_0x27fb47[_0xd559('0x26')]),_0x73ef5b);if(_0x2678c5['query'][_0xd559('0x2f')]){_0x5a7dfb[_0xd559('0x30')]=_[_0xd559('0x31')](_0x5a7dfb['where'],{'$or':_[_0xd559('0x1e')](_0x73ef5b,function(_0x5a77f1){if(_0x5a77f1[_0xd559('0x22')]!==_0xd559('0x32')){var _0x43a050={};_0x43a050[_0x5a77f1[_0xd559('0x1c')]]={'$like':'%'+_0x2678c5[_0xd559('0x24')][_0xd559('0x2f')]+'%'};return _0x43a050;}})});}_0x5a7dfb=_[_0xd559('0x31')]({},_0x5a7dfb,_0x2678c5[_0xd559('0x33')]);var _0x447ef4={'where':_0x5a7dfb[_0xd559('0x30')]};return db[_0xd559('0x1f')][_0xd559('0x13')](_0x447ef4)[_0xd559('0x18')](function(_0x132648){_0x587528[_0xd559('0x13')]=_0x132648;if(_0x2678c5[_0xd559('0x24')][_0xd559('0x34')]){_0x5a7dfb['include']=[{'all':!![]}];}return db[_0xd559('0x1f')][_0xd559('0x35')](_0x5a7dfb);})[_0xd559('0x18')](function(_0x53d1b2){_0x587528[_0xd559('0x36')]=_0x53d1b2;return _0x587528;})[_0xd559('0x18')](respondWithFilteredResult(_0x4755bd,_0x5a7dfb))['catch'](handleError(_0x4755bd,null));};exports[_0xd559('0x37')]=function(_0x3568d6,_0x546a16){var _0x2475bc={'raw':!![],'where':{'id':_0x3568d6['params']['id']}},_0x48fd43={};_0x48fd43['model']=_['keys'](db[_0xd559('0x1f')][_0xd559('0x20')]);_0x48fd43[_0xd559('0x24')]=_[_0xd559('0x25')](_0x3568d6['query']);_0x48fd43['filters']=_[_0xd559('0x27')](_0x48fd43[_0xd559('0x23')],_0x48fd43[_0xd559('0x24')]);_0x2475bc[_0xd559('0x28')]=_[_0xd559('0x27')](_0x48fd43[_0xd559('0x23')],qs[_0xd559('0x29')](_0x3568d6['query'][_0xd559('0x29')]));_0x2475bc['attributes']=_0x2475bc[_0xd559('0x28')][_0xd559('0x2a')]?_0x2475bc[_0xd559('0x28')]:_0x48fd43['model'];if(_0x3568d6[_0xd559('0x24')]['includeAll']){_0x2475bc[_0xd559('0x38')]=[{'all':!![]}];}_0x2475bc=_[_0xd559('0x31')]({},_0x2475bc,_0x3568d6[_0xd559('0x33')]);return db[_0xd559('0x1f')][_0xd559('0x39')](_0x2475bc)['then'](handleEntityNotFound(_0x546a16,null))[_0xd559('0x18')](respondWithResult(_0x546a16,null))[_0xd559('0x3a')](handleError(_0x546a16,null));};exports[_0xd559('0x3b')]=function(_0x1cca09,_0x57fbc6){return db['WhatsappApplication']['create'](_0x1cca09[_0xd559('0x3c')],{})[_0xd559('0x18')](respondWithResult(_0x57fbc6,0xc9))['catch'](handleError(_0x57fbc6,null));};exports['update']=function(_0x308c5c,_0x34242d){if(_0x308c5c[_0xd559('0x3c')]['id']){delete _0x308c5c[_0xd559('0x3c')]['id'];}return db[_0xd559('0x1f')][_0xd559('0x39')]({'where':{'id':_0x308c5c['params']['id']}})['then'](handleEntityNotFound(_0x34242d,null))[_0xd559('0x18')](saveUpdates(_0x308c5c[_0xd559('0x3c')],null))['then'](respondWithResult(_0x34242d,null))[_0xd559('0x3a')](handleError(_0x34242d,null));};exports['destroy']=function(_0x7723c7,_0x1505d3){return db[_0xd559('0x1f')][_0xd559('0x39')]({'where':{'id':_0x7723c7[_0xd559('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1505d3,null))[_0xd559('0x18')](removeEntity(_0x1505d3,null))[_0xd559('0x3a')](handleError(_0x1505d3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e737fd2..c760eef 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 _0xe1e6=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','whatsapp_applications','utf8mb4_unicode_ci'];(function(_0x409ab6,_0x48ccd4){var _0x3752d8=function(_0x517de6){while(--_0x517de6){_0x409ab6['push'](_0x409ab6['shift']());}};_0x3752d8(++_0x48ccd4);}(_0xe1e6,0x18c));var _0x6e1e=function(_0xe5c194,_0x3597c3){_0xe5c194=_0xe5c194-0x0;var _0x3a29ed=_0xe1e6[_0xe5c194];return _0x3a29ed;};'use strict';var _=require(_0x6e1e('0x0'));var util=require(_0x6e1e('0x1'));var logger=require('../../config/logger')(_0x6e1e('0x2'));var moment=require(_0x6e1e('0x3'));var BPromise=require(_0x6e1e('0x4'));var rp=require(_0x6e1e('0x5'));var fs=require('fs');var path=require(_0x6e1e('0x6'));var rimraf=require('rimraf');var config=require(_0x6e1e('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x448d59,_0x167fee){return _0x448d59[_0x6e1e('0x8')]('WhatsappApplication',attributes,{'tableName':_0x6e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e1e('0xa')});}; \ No newline at end of file +var _0x104d=['define','WhatsappApplication','whatsapp_applications','utf8mb4','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x33eb67,_0x4cb881){var _0x26c9ac=function(_0x33036d){while(--_0x33036d){_0x33eb67['push'](_0x33eb67['shift']());}};_0x26c9ac(++_0x4cb881);}(_0x104d,0x16c));var _0xd104=function(_0x27f39d,_0x5efee5){_0x27f39d=_0x27f39d-0x0;var _0x355e1e=_0x104d[_0x27f39d];return _0x355e1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd104('0x0'));var BPromise=require(_0xd104('0x1'));var rp=require(_0xd104('0x2'));var fs=require('fs');var path=require(_0xd104('0x3'));var rimraf=require(_0xd104('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xd104('0x5')]=function(_0x1338df,_0x4c5b1e){return _0x1338df[_0xd104('0x6')](_0xd104('0x7'),attributes,{'tableName':_0xd104('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd104('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 82dda91..edc0c82 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 _0xe626=['info','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x3296b7,_0x241990){var _0x214a2b=function(_0x11dd45){while(--_0x11dd45){_0x3296b7['push'](_0x3296b7['shift']());}};_0x214a2b(++_0x241990);}(_0xe626,0x9d));var _0x6e62=function(_0x5ccad0,_0x2f2a01){_0x5ccad0=_0x5ccad0-0x0;var _0x4d48bd=_0xe626[_0x5ccad0];return _0x4d48bd;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var moment=require(_0x6e62('0x2'));var BPromise=require(_0x6e62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e62('0x4'));var db=require(_0x6e62('0x5'))['db'];var utils=require(_0x6e62('0x6'));var logger=require(_0x6e62('0x7'))(_0x6e62('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157047,_0x55165e,_0x32fd89){return new BPromise(function(_0x1dfbaf,_0x16fa52){return client[_0x6e62('0xa')](_0x157047,_0x32fd89)['then'](function(_0xa6e8be){logger[_0x6e62('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x55165e,_0x6e62('0xc'));logger['debug'](_0x6e62('0xd'),_0x55165e,'request\x20sent',JSON[_0x6e62('0xe')](_0xa6e8be));if(_0xa6e8be['error']){if(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x10')]===0x1f4){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);return _0x16fa52(_0xa6e8be[_0x6e62('0xf')]['message']);}logger['error'](_0x6e62('0x11'),_0x55165e,_0xa6e8be[_0x6e62('0xf')]['message']);return _0x1dfbaf(_0xa6e8be[_0x6e62('0xf')][_0x6e62('0x12')]);}else{logger[_0x6e62('0xb')](_0x6e62('0x11'),_0x55165e,'request\x20sent');_0x1dfbaf(_0xa6e8be[_0x6e62('0x13')][_0x6e62('0x12')]);}})[_0x6e62('0x14')](function(_0x35748b){logger[_0x6e62('0xf')](_0x6e62('0x11'),_0x55165e,_0x35748b);_0x16fa52(_0x35748b);});});} \ No newline at end of file +var _0x90ec=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x28a4b5,_0x5468a0){var _0x141f28=function(_0x192d38){while(--_0x192d38){_0x28a4b5['push'](_0x28a4b5['shift']());}};_0x141f28(++_0x5468a0);}(_0x90ec,0x1d4));var _0xc90e=function(_0x5b560a,_0x50f60d){_0x5b560a=_0x5b560a-0x0;var _0x3b9858=_0x90ec[_0x5b560a];return _0x3b9858;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var moment=require('moment');var BPromise=require(_0xc90e('0x2'));var rs=require(_0xc90e('0x3'));var fs=require('fs');var Redis=require(_0xc90e('0x4'));var db=require(_0xc90e('0x5'))['db'];var utils=require(_0xc90e('0x6'));var logger=require('../../config/logger')(_0xc90e('0x7'));var config=require(_0xc90e('0x8'));var jayson=require(_0xc90e('0x9'));var client=jayson['client'][_0xc90e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48bea9,_0x42051a,_0x14311a){return new BPromise(function(_0x48253c,_0x3bc98f){return client[_0xc90e('0xb')](_0x48bea9,_0x14311a)[_0xc90e('0xc')](function(_0x1a02ad){logger[_0xc90e('0xd')](_0xc90e('0xe'),_0x42051a,_0xc90e('0xf'));logger[_0xc90e('0x10')](_0xc90e('0x11'),_0x42051a,'request\x20sent',JSON[_0xc90e('0x12')](_0x1a02ad));if(_0x1a02ad['error']){if(_0x1a02ad['error']['code']===0x1f4){logger['error'](_0xc90e('0xe'),_0x42051a,_0x1a02ad[_0xc90e('0x13')]['message']);return _0x3bc98f(_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);}logger['error'](_0xc90e('0xe'),_0x42051a,_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);return _0x48253c(_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);}else{logger[_0xc90e('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x42051a,_0xc90e('0xf'));_0x48253c(_0x1a02ad[_0xc90e('0x15')]['message']);}})[_0xc90e('0x16')](function(_0x48eac8){logger[_0xc90e('0x13')](_0xc90e('0xe'),_0x42051a,_0x48eac8);_0x3bc98f(_0x48eac8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dcd1888..c54c129 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 _0xd6ec=['path','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','tracked','update','delete','/:id','whatsapp','whatsappinteraction:destroy','destroy','exports','multer','util'];(function(_0x3d5acc,_0x6c2701){var _0x490393=function(_0x86e7ca){while(--_0x86e7ca){_0x3d5acc['push'](_0x3d5acc['shift']());}};_0x490393(++_0x6c2701);}(_0xd6ec,0xde));var _0xcd6e=function(_0x10d67f,_0x458eb3){_0x10d67f=_0x10d67f-0x0;var _0x4b663e=_0xd6ec[_0x10d67f];return _0x4b663e;};'use strict';var multer=require(_0xcd6e('0x0'));var util=require(_0xcd6e('0x1'));var path=require(_0xcd6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd6e('0x3'));var router=express[_0xcd6e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd6e('0x5'));var config=require(_0xcd6e('0x6'));var controller=require(_0xcd6e('0x7'));router[_0xcd6e('0x8')]('/',auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xa')]);router['get'](_0xcd6e('0xb'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xc')]);router[_0xcd6e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcd6e('0xd')]);router[_0xcd6e('0x8')](_0xcd6e('0xe'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0xf')]);router[_0xcd6e('0x8')](_0xcd6e('0x10'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x11')]);router[_0xcd6e('0x12')]('/',auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x13')]);router[_0xcd6e('0x12')](_0xcd6e('0xe'),auth[_0xcd6e('0x9')](),controller[_0xcd6e('0x14')]);router[_0xcd6e('0x12')](_0xcd6e('0x15'),auth[_0xcd6e('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller[_0xcd6e('0x16')]);router[_0xcd6e('0x17')]('/:id',auth[_0xcd6e('0x9')](),interaction[_0xcd6e('0x18')]('whatsapp','whatsappinteraction:update'),controller[_0xcd6e('0x19')]);router[_0xcd6e('0x1a')](_0xcd6e('0x1b'),auth[_0xcd6e('0x9')](),interaction[_0xcd6e('0x18')](_0xcd6e('0x1c'),_0xcd6e('0x1d')),controller[_0xcd6e('0x1e')]);router[_0xcd6e('0x1a')](_0xcd6e('0x15'),auth[_0xcd6e('0x9')](),controller['removeTags']);module[_0xcd6e('0x1f')]=router; \ No newline at end of file +var _0x1eac=['../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','index','/describe','describe','isAuthenticated','show','getMessages','download','post','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','util','express','Router'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x1eac,0x1b0));var _0xc1ea=function(_0xfdd58,_0x5e560f){_0xfdd58=_0xfdd58-0x0;var _0x390209=_0x1eac[_0xfdd58];return _0x390209;};'use strict';var multer=require('multer');var util=require(_0xc1ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1ea('0x1'));var router=express[_0xc1ea('0x2')]();var auth=require(_0xc1ea('0x3'));var interaction=require(_0xc1ea('0x4'));var config=require('../../config/environment');var controller=require(_0xc1ea('0x5'));router[_0xc1ea('0x6')]('/',auth['isAuthenticated'](),controller[_0xc1ea('0x7')]);router[_0xc1ea('0x6')](_0xc1ea('0x8'),auth['isAuthenticated'](),controller[_0xc1ea('0x9')]);router[_0xc1ea('0x6')]('/:id',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xb')]);router['get']('/:id/messages',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xc')]);router[_0xc1ea('0x6')]('/:id/download',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xd')]);router[_0xc1ea('0xe')]('/',auth[_0xc1ea('0xa')](),controller['create']);router[_0xc1ea('0xe')](_0xc1ea('0xf'),auth['isAuthenticated'](),controller[_0xc1ea('0x10')]);router[_0xc1ea('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xc1ea('0x11')](_0xc1ea('0x12'),_0xc1ea('0x13')),controller[_0xc1ea('0x14')]);router['put'](_0xc1ea('0x15'),auth[_0xc1ea('0xa')](),interaction['tracked'](_0xc1ea('0x12'),_0xc1ea('0x16')),controller[_0xc1ea('0x17')]);router[_0xc1ea('0x18')]('/:id',auth[_0xc1ea('0xa')](),interaction[_0xc1ea('0x11')](_0xc1ea('0x12'),'whatsappinteraction:destroy'),controller[_0xc1ea('0x19')]);router[_0xc1ea('0x18')](_0xc1ea('0x1a'),auth['isAuthenticated'](),controller[_0xc1ea('0x1b')]);module[_0xc1ea('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 08198c2..ee8cf1f 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 _0xb98b=['STRING','DATE','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb98b,0x144));var _0xbb98=function(_0x5864ad,_0x3ea382){_0x5864ad=_0x5864ad-0x0;var _0x29129f=_0xb98b[_0x5864ad];return _0x29129f;};'use strict';var Sequelize=require(_0xbb98('0x0'));var moment=require(_0xbb98('0x1'));module[_0xbb98('0x2')]={'closed':{'type':Sequelize[_0xbb98('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbb98('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbb98('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbb98('0x4')]},'read1stAt':{'type':Sequelize[_0xbb98('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb98('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb98('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xbb98('0x7')]('in',_0xbb98('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd914=['BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xd914,0x17f));var _0x4d91=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xd914[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0x4d91('0x0'));var moment=require(_0x4d91('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d91('0x3')]},'disposition':{'type':Sequelize[_0x4d91('0x4')]},'secondDisposition':{'type':Sequelize[_0x4d91('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4d91('0x4')]},'note':{'type':Sequelize[_0x4d91('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4d91('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4d91('0x6')]('in',_0x4d91('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 dd1d206..b6f6a5e 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 _0xcbd8=['then','end','sendStatus','error','stack','name','Users','fullname','Tags','TagIds','split','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','field','color','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','create','addMessage','WhatsappMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','emit','removeTags','download','unix','root','server','tmp','join','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','Whatsapp','YYYY-MM-DD','N.A.','closed','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x41e3e5,_0x441240){var _0x4b5b5c=function(_0x5b988a){while(--_0x5b988a){_0x41e3e5['push'](_0x41e3e5['shift']());}};_0x4b5b5c(++_0x441240);}(_0xcbd8,0xcb));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cbd('0x0'));var zipdir=require(_0x8cbd('0x1'));var jsonpatch=require(_0x8cbd('0x2'));var rp=require(_0x8cbd('0x3'));var moment=require(_0x8cbd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cbd('0x5'));var util=require(_0x8cbd('0x6'));var path=require(_0x8cbd('0x7'));var sox=require(_0x8cbd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8cbd('0x9'));var squel=require(_0x8cbd('0xa'));var crypto=require('crypto');var jsforce=require(_0x8cbd('0xb'));var deskjs=require(_0x8cbd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8cbd('0xd'));var authService=require(_0x8cbd('0xe'));var qs=require(_0x8cbd('0xf'));var as=require(_0x8cbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cbd('0x11'));var utils=require(_0x8cbd('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8cbd('0x13')]=_['defaults'](config[_0x8cbd('0x13')],{'host':_0x8cbd('0x14'),'port':0x18eb});var socket=require(_0x8cbd('0x15'))(new Redis(config['redis']));require(_0x8cbd('0x16'))['register'](socket);function respondWithStatusCode(_0x17cc2f,_0x502533){_0x502533=_0x502533||0xcc;return function(_0x2dff4d){if(_0x2dff4d){return _0x17cc2f['sendStatus'](_0x502533);}return _0x17cc2f[_0x8cbd('0x17')](_0x502533)['end']();};}function respondWithResult(_0x486f44,_0x4ca2bd){_0x4ca2bd=_0x4ca2bd||0xc8;return function(_0x19d3f3){if(_0x19d3f3){return _0x486f44[_0x8cbd('0x17')](_0x4ca2bd)[_0x8cbd('0x18')](_0x19d3f3);}};}function respondWithFilteredResult(_0x1f8544,_0x5d464f){return function(_0x320fcf){if(_0x320fcf){var _0x598586=_0x320fcf[_0x8cbd('0x19')],_0x21ac0a=_0x5d464f[_0x8cbd('0x1a')],_0x25306d=_0x5d464f[_0x8cbd('0x1a')]+_0x5d464f[_0x8cbd('0x1b')],_0x1cb2aa;if(_0x25306d>=_0x598586){_0x25306d=_0x598586;_0x1cb2aa=0xc8;}else{_0x1cb2aa=0xce;}_0x1f8544[_0x8cbd('0x17')](_0x1cb2aa);return _0x1f8544[_0x8cbd('0x1c')](_0x8cbd('0x1d'),_0x21ac0a+'-'+_0x25306d+'/'+_0x598586)[_0x8cbd('0x18')](_0x320fcf);}return null;};}function patchUpdates(_0x48f1de){return function(_0x3f0ef9){try{jsonpatch[_0x8cbd('0x1e')](_0x3f0ef9,_0x48f1de,!![]);}catch(_0x5425a9){return BPromise[_0x8cbd('0x1f')](_0x5425a9);}return _0x3f0ef9[_0x8cbd('0x20')]();};}function saveUpdates(_0x2ec3e0,_0x345306){return function(_0x2689bc){if(_0x2689bc){return _0x2689bc[_0x8cbd('0x21')](_0x2ec3e0)['then'](function(_0x11702e){return _0x11702e;});}return null;};}function removeEntity(_0x29afdb,_0x4efc82){return function(_0x7da18f){if(_0x7da18f){return _0x7da18f[_0x8cbd('0x22')]()[_0x8cbd('0x23')](function(){_0x29afdb['status'](0xcc)[_0x8cbd('0x24')]();});}};}function handleEntityNotFound(_0x4161ea,_0x42f2b5){return function(_0x3e5ed4){if(!_0x3e5ed4){_0x4161ea[_0x8cbd('0x25')](0x194);}return _0x3e5ed4;};}function handleError(_0x505d00,_0x5e74df){_0x5e74df=_0x5e74df||0x1f4;return function(_0x41e0da){logger[_0x8cbd('0x26')](_0x41e0da[_0x8cbd('0x27')]);if(_0x41e0da[_0x8cbd('0x28')]){delete _0x41e0da[_0x8cbd('0x28')];}_0x505d00['status'](_0x5e74df)['send'](_0x41e0da);};}function getInteractionUsers(_0xcce475,_0x5a03d2){return new BPromise(function(_0x268db3,_0x3ac113){try{if(_0x5a03d2[_0xcce475['id']]){_0xcce475[_0x8cbd('0x29')]=_['map'](_0x5a03d2[_0xcce475['id']],function(_0x33b95c){return{'id':_0x33b95c['id'],'fullname':_0x33b95c[_0x8cbd('0x2a')]};});}}catch(_0x188005){_0x3ac113(_0x188005);}_0x268db3(_0xcce475);});}function getInteractionTags(_0x2c45ac,_0x19b94b){return new BPromise(function(_0xc8849a,_0x55a666){try{if(_0x2c45ac['TagIds']){_0x2c45ac[_0x8cbd('0x2b')]=[];_0x2c45ac[_0x8cbd('0x2c')][_0x8cbd('0x2d')](',')[_0x8cbd('0x2e')](function(_0x3243a4){_0x2c45ac['Tags'][_0x8cbd('0x2f')](_0x19b94b[_0x3243a4]);});}delete _0x2c45ac[_0x8cbd('0x2c')];}catch(_0x4e59fb){_0x55a666(_0x4e59fb);}_0xc8849a(_0x2c45ac);});}function updateWhatsappInteraction(_0xa3126c,_0x2c30ca,_0x18bcf6){return new BPromise(function(_0x591b21,_0x266b40){return getInteractionUsers(_0xa3126c,_0x18bcf6)['then'](function(_0x289d86){return getInteractionTags(_0x289d86,_0x2c30ca);})['then'](function(_0x377b63){_0x591b21(_0x377b63);})[_0x8cbd('0x30')](function(_0x31efa4){_0x266b40(_0x31efa4);});});}exports[_0x8cbd('0x31')]=function(_0x1f1451,_0x4de3b6){var _0x412342={},_0x34b95e={},_0x3da33b={'count':0x0,'rows':[]};var _0x2862fe=_[_0x8cbd('0x32')](db[_0x8cbd('0x33')][_0x8cbd('0x34')],function(_0x2180bd){return{'name':_0x2180bd['fieldName'],'type':_0x2180bd[_0x8cbd('0x35')][_0x8cbd('0x36')]};});_0x34b95e[_0x8cbd('0x37')]=_['map'](_0x2862fe,_0x8cbd('0x28'));_0x34b95e[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x1f1451[_0x8cbd('0x38')]);_0x34b95e['filters']=_[_0x8cbd('0x3a')](_0x34b95e[_0x8cbd('0x37')],_0x34b95e[_0x8cbd('0x38')]);_0x412342['attributes']=_[_0x8cbd('0x3a')](_0x34b95e[_0x8cbd('0x37')],qs[_0x8cbd('0x3b')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x412342[_0x8cbd('0x3c')]=_0x412342[_0x8cbd('0x3c')]['length']?_0x412342['attributes']:_0x34b95e['model'];if(!_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x3d')](_0x8cbd('0x3e'))){_0x412342[_0x8cbd('0x1b')]=qs[_0x8cbd('0x1b')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x1b')]);_0x412342[_0x8cbd('0x1a')]=qs[_0x8cbd('0x1a')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x1a')]);}_0x412342[_0x8cbd('0x3f')]=qs[_0x8cbd('0x40')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x40')]);_0x412342['where']=qs[_0x8cbd('0x41')](_[_0x8cbd('0x42')](_0x1f1451[_0x8cbd('0x38')],_0x34b95e[_0x8cbd('0x41')]),_0x2862fe);var _0x5d405a=[];var _0x469d39=squel['select']()['field']('id')[_0x8cbd('0x43')](_0x8cbd('0x28'))[_0x8cbd('0x43')](_0x8cbd('0x44'))['from']('tools_tags');var _0x29417a=squel[_0x8cbd('0x45')]()[_0x8cbd('0x43')](_0x8cbd('0x46'))['field'](_0x8cbd('0x47'))[_0x8cbd('0x43')](_0x8cbd('0x48'))['from'](_0x8cbd('0x49'),'ui')[_0x8cbd('0x4a')](_0x8cbd('0x4b'),'u',_0x8cbd('0x4c'));var _0x2b2a1a=squel[_0x8cbd('0x45')]()[_0x8cbd('0x4d')]('whatsapp_interactions','i')['left_join'](_0x8cbd('0x4e'),'c',_0x8cbd('0x4f'))[_0x8cbd('0x4a')](_0x8cbd('0x4b'),'o',_0x8cbd('0x50'))['left_join'](_0x8cbd('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x8cbd('0x4a')](_0x8cbd('0x52'),'me',_0x8cbd('0x53'))['left_join'](_0x8cbd('0x54'),'it',_0x8cbd('0x55'))[_0x8cbd('0x4a')](_0x8cbd('0x56'),'t',_0x8cbd('0x57'));var _0xf77edc=squel['expr']();var _0x555267=[];var _0x351a4d=squel[_0x8cbd('0x58')]();var _0x15faf2;if(_0x1f1451['query'][_0x8cbd('0x59')]){_0x15faf2=as['parseSearch'](_0x1f1451['query'][_0x8cbd('0x59')]);var _0x451de7=_0x15faf2[_0x8cbd('0x5a')];for(var _0x30ca5a=0x0;_0x30ca5a<_0x15faf2[_0x8cbd('0x5b')][_0x8cbd('0x5c')];_0x30ca5a++){var _0x38f483=_0x15faf2['conditions'][_0x30ca5a];var _0xa0c09e='i';var _0x502e88=_[_0x8cbd('0x5d')](_0x2862fe,[_0x8cbd('0x28'),_0x38f483[_0x8cbd('0x43')]]);if(!_0x502e88){switch(_0x38f483[_0x8cbd('0x43')]){case _0x8cbd('0x5e'):if(_0x38f483[_0x8cbd('0x5f')]==0x1){_0x2b2a1a[_0x8cbd('0x60')]('`'+_0x38f483[_0x8cbd('0x43')]+'`\x20=\x200');}else{_0x2b2a1a[_0x8cbd('0x60')]('`'+_0x38f483[_0x8cbd('0x43')]+_0x8cbd('0x61'));}break;case _0x8cbd('0x62'):if(_0x38f483[_0x8cbd('0x63')]===_0x8cbd('0x64')){if(_0x38f483[_0x8cbd('0x5f')]['split']('\x20')['length']>0x1){_0xf77edc[_0x451de7](_0x8cbd('0x65'),qs['getFullTextValue'](_0x38f483[_0x8cbd('0x5f')]),null);}else{var _0x428ff6='%'+_0x38f483[_0x8cbd('0x5f')]+'%';_0xf77edc[_0x451de7](_0x8cbd('0x66'),_0x428ff6,_0x428ff6,_0x428ff6);}}else{_0x502e88=_['find'](_0x2862fe,[_0x8cbd('0x28'),_0x8cbd('0x67')]);_0x38f483[_0x8cbd('0x43')]=_0x8cbd('0x67');_0x27290d=as[_0x8cbd('0x68')](_0xa0c09e,_0x502e88['type'],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x6a')],_0x27290d['value']['end']);}break;case _0x8cbd('0x6b'):var _0x1f3a9a=_0x38f483[_0x8cbd('0x5f')]['split'](',')[_0x8cbd('0x32')](function(_0x148c45){return Number(_0x148c45);});_0x1f3a9a[_0x8cbd('0x2e')](function(_0x3c43e4){_0x351a4d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c43e4+',%');});_0x555267=_[_0x8cbd('0x6c')](_0x555267,_0x1f3a9a);break;case _0x8cbd('0x6d'):if(_0x38f483['operator']===_0x8cbd('0x64')){_0xf77edc[_0x451de7](_0x8cbd('0x6e'),'%'+_0x38f483[_0x8cbd('0x5f')]+'%',null);}else{_0x502e88=_['find'](_0x2862fe,[_0x8cbd('0x28'),'UserId']);_0x38f483[_0x8cbd('0x43')]=_0x8cbd('0x6f');_0x27290d=as[_0x8cbd('0x68')](_0xa0c09e,_0x502e88['type'],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d['value'][_0x8cbd('0x6a')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x24')]);}break;case _0x8cbd('0x70'):_0x27290d=as[_0x8cbd('0x68')]('me',null,_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d['value'][_0x8cbd('0x6a')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x24')]);break;}}else{var _0x27290d=as['buildExpression'](_0xa0c09e,_0x502e88[_0x8cbd('0x35')],_0x38f483);_0xf77edc[_0x451de7](_0x27290d[_0x8cbd('0x69')],_0x27290d[_0x8cbd('0x5f')][_0x8cbd('0x6a')],_0x27290d['value'][_0x8cbd('0x24')]);}}}else{var _0x912976=_(_0x1f1451['query'])[_0x8cbd('0x39')]()[_0x8cbd('0x32')](function(_0x5dd672){return _[_0x8cbd('0x71')](_0x2862fe,[_0x8cbd('0x28'),_0x5dd672])?_0x5dd672:undefined;})[_0x8cbd('0x72')]()[_0x8cbd('0x5f')]();if(!_[_0x8cbd('0x73')](_0x912976)){_0x912976[_0x8cbd('0x2e')](function(_0x358c6c){if(_0x358c6c===_0x8cbd('0x74')){_0x2b2a1a['where'](_0x8cbd('0x75'),[][_0x8cbd('0x76')](_0x1f1451['query'][_0x358c6c]));}else if(_0x358c6c===_0x8cbd('0x77')){var _0x325ae8=JSON[_0x8cbd('0x78')](_0x1f1451[_0x8cbd('0x38')][_0x358c6c])[_0x8cbd('0x79')];var _0x24eb8c=JSON[_0x8cbd('0x78')](_0x1f1451[_0x8cbd('0x38')][_0x358c6c])[_0x8cbd('0x7a')];_0x2b2a1a[_0x8cbd('0x7b')](_0x8cbd('0x7c'),_0x325ae8,_0x24eb8c);}else{if(_0x1f1451[_0x8cbd('0x38')][_0x358c6c]===_0x8cbd('0x7d')){_0x2b2a1a[_0x8cbd('0x7b')]('i.'+_0x358c6c+_0x8cbd('0x7e'));}else{_0x2b2a1a[_0x8cbd('0x7b')]('i.'+_0x358c6c+'\x20=\x20?',_0x1f1451[_0x8cbd('0x38')][_0x358c6c]);}}});}if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x7f')]){if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x7f')]==0x1){_0x2b2a1a[_0x8cbd('0x60')](_0x8cbd('0x80'));}else{_0x2b2a1a['having'](_0x8cbd('0x81'));}}if(_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x82')]){_0x555267=_[_0x8cbd('0x83')](_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x82')])?_0x1f1451['query'][_0x8cbd('0x82')]:new Array(_0x1f1451['query']['tag']);_0x555267[_0x8cbd('0x2e')](function(_0x10168a){_0x351a4d['or'](_0x8cbd('0x84'),'%,'+_0x10168a+',%');});}if(_0x1f1451[_0x8cbd('0x38')]['filter']){var _0x313dd9=_0x1f1451['query'][_0x8cbd('0x85')][_0x8cbd('0x86')]('\x5c','\x5c\x5c')[_0x8cbd('0x86')](/'/g,'\x27\x27');if(qs[_0x8cbd('0x87')](_0x313dd9)){_0xf77edc['or'](_0x8cbd('0x88'),_0x313dd9+'%')['or'](_0x8cbd('0x89'),_0x313dd9+'%');}else{_0xf77edc['or'](_0x8cbd('0x8a'),qs['getFullTextValue'](_0x313dd9))['or'](_0x8cbd('0x8b'),_0x313dd9+'%');}}}_0x2b2a1a[_0x8cbd('0x7b')](_0xf77edc);_0x2b2a1a[_0x8cbd('0x8c')](_0x8cbd('0x8d'));var _0x4f4187={'type':db[_0x8cbd('0x8e')][_0x8cbd('0x8f')][_0x8cbd('0x90')],'raw':!![]};var _0x559cc8=_0x2b2a1a[_0x8cbd('0x91')]();_0x559cc8[_0x8cbd('0x43')](_0x8cbd('0x8d'));_0x559cc8[_0x8cbd('0x43')](_0x8cbd('0x92'),'unreadMessages');if(_0x412342[_0x8cbd('0x3f')]){_0x412342[_0x8cbd('0x3f')]['forEach'](function(_0x4bfb66){var _0x591dae=_0x4bfb66[0x0]===_0x8cbd('0x93')?_0x4bfb66[0x0]:'i.'+_0x4bfb66[0x0];_0x2b2a1a[_0x8cbd('0x3f')](_0x591dae,_0x4bfb66[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8cbd('0x73')](_0x555267)){_0x2b2a1a[_0x8cbd('0x60')](_0x351a4d);_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x94'),_0x555267);}BPromise[_0x8cbd('0x95')]()[_0x8cbd('0x23')](function(){if(!_0x15faf2){if(_0x1f1451[_0x8cbd('0x38')]['WhatsappAccountId']||_0x1f1451[_0x8cbd('0x38')][_0x8cbd('0x96')])return;_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x97'));_0x2b2a1a[_0x8cbd('0x7b')](_0x8cbd('0x97'));return;}if(_0x1f1451[_0x8cbd('0x98')][_0x8cbd('0x99')]!=='agent')return;return _0x1f1451['user'][_0x8cbd('0x9a')]({'attributes':['id'],'raw':!![]})[_0x8cbd('0x23')](function(_0x43c4d5){if(_[_0x8cbd('0x73')](_0x43c4d5)){_0x559cc8[_0x8cbd('0x7b')](_0x8cbd('0x9b'));_0x2b2a1a[_0x8cbd('0x7b')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x559cc8['where'](_0x8cbd('0x75'),_[_0x8cbd('0x32')](_0x43c4d5,'id'));_0x2b2a1a[_0x8cbd('0x7b')]('i.WhatsappAccountId\x20IN\x20?',_[_0x8cbd('0x32')](_0x43c4d5,'id'));}});})[_0x8cbd('0x23')](function(){if(_0x1f1451['user'][_0x8cbd('0x99')]===_0x8cbd('0x9c')&&!_0x15faf2&&!_0x1f1451[_0x8cbd('0x38')]['WhatsappAccountId'])return[];return db[_0x8cbd('0x9d')][_0x8cbd('0x38')](_0x559cc8[_0x8cbd('0x9e')](),_0x4f4187);})['then'](function(_0x5b56c0){_0x3da33b[_0x8cbd('0x19')]=_0x5b56c0[_0x8cbd('0x5c')];if(_0x3da33b['count']===0x0)return[];return db[_0x8cbd('0x9d')][_0x8cbd('0x38')](_0x469d39['toString'](),_0x4f4187)[_0x8cbd('0x23')](function(_0x3a7d0c){_0x5d405a=_[_0x8cbd('0x9f')](_0x3a7d0c,'id');_0x4f4187=_[_0x8cbd('0xa0')](_0x4f4187,{'model':db[_0x8cbd('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f1451[_0x8cbd('0x38')]['fields']){_0x412342[_0x8cbd('0x3c')]['forEach'](function(_0x17f802){_0x2b2a1a[_0x8cbd('0x43')]('i.'+_0x17f802);});}else{_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0x92'),'unreadMessages');_0x2b2a1a['field'](_0x8cbd('0xa1'),'Account.key');_0x2b2a1a['field'](_0x8cbd('0xa2'),_0x8cbd('0xa3'));_0x2b2a1a['field'](_0x8cbd('0xa4'),_0x8cbd('0x93'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xa5'));_0x2b2a1a['field'](_0x8cbd('0xa6'),_0x8cbd('0xa7'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xa8'),_0x8cbd('0xa9'));_0x2b2a1a[_0x8cbd('0x43')]('c.email',_0x8cbd('0xaa'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xab'),_0x8cbd('0xac'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xad'),_0x8cbd('0xae'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xaf'),'Contact.fax');_0x2b2a1a['field']('o.fullname','Owner.fullname');_0x2b2a1a[_0x8cbd('0x43')]('o.internal',_0x8cbd('0xb0'));_0x2b2a1a[_0x8cbd('0x43')](_0x8cbd('0xb1'),'TagIds');}if(_0x412342[_0x8cbd('0x1b')])_0x2b2a1a[_0x8cbd('0x1b')](_0x412342['limit']);if(_0x412342[_0x8cbd('0x1a')])_0x2b2a1a['offset'](_0x412342[_0x8cbd('0x1a')]);return db[_0x8cbd('0x9d')]['query'](_0x2b2a1a[_0x8cbd('0x9e')](),_0x4f4187);})[_0x8cbd('0x23')](function(_0x71dac){_0x29417a['where'](_0x8cbd('0xb2'),_[_0x8cbd('0x32')](_0x71dac,'id'));return db[_0x8cbd('0x9d')]['query'](_0x29417a[_0x8cbd('0x9e')](),_0x4f4187)[_0x8cbd('0x23')](function(_0x214163){var _0x50f59e=_[_0x8cbd('0xb3')](_0x214163,_0x8cbd('0xb4'));var _0x4ddc2a=[];_0x71dac[_0x8cbd('0x2e')](function(_0x77cdd4){_0x4ddc2a[_0x8cbd('0x2f')](updateWhatsappInteraction(_0x77cdd4,_0x5d405a,_0x50f59e));});return BPromise[_0x8cbd('0xb5')](_0x4ddc2a);});});})[_0x8cbd('0x23')](function(_0x3ab206){_0x3da33b[_0x8cbd('0xb6')]=_0x3ab206;return _0x3da33b;})[_0x8cbd('0x23')](respondWithFilteredResult(_0x4de3b6,_0x412342))[_0x8cbd('0x30')](handleError(_0x4de3b6,null));};exports[_0x8cbd('0xb7')]=function(_0x1897ae,_0x585107){var _0x5f491f={'raw':![],'where':{'id':_0x1897ae[_0x8cbd('0xb8')]['id']}},_0x27d553={};_0x27d553[_0x8cbd('0x37')]=_[_0x8cbd('0x39')](db[_0x8cbd('0x33')][_0x8cbd('0x34')]);_0x27d553[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x1897ae[_0x8cbd('0x38')]);_0x27d553[_0x8cbd('0x41')]=_[_0x8cbd('0x3a')](_0x27d553[_0x8cbd('0x37')],_0x27d553['query']);_0x5f491f[_0x8cbd('0x3c')]=_[_0x8cbd('0x3a')](_0x27d553[_0x8cbd('0x37')],qs['fields'](_0x1897ae[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x5f491f[_0x8cbd('0x3c')]=_0x5f491f[_0x8cbd('0x3c')][_0x8cbd('0x5c')]?_0x5f491f['attributes']:_0x27d553[_0x8cbd('0x37')];if(_0x1897ae[_0x8cbd('0x38')][_0x8cbd('0xb9')]){_0x5f491f[_0x8cbd('0xba')]=[{'all':!![]}];}_0x5f491f=_[_0x8cbd('0xa0')]({},_0x5f491f,_0x1897ae[_0x8cbd('0xbb')]);return db[_0x8cbd('0x33')][_0x8cbd('0x5d')](_0x5f491f)[_0x8cbd('0x23')](handleEntityNotFound(_0x585107,null))[_0x8cbd('0x23')](respondWithResult(_0x585107,null))[_0x8cbd('0x30')](handleError(_0x585107,null));};exports[_0x8cbd('0xbc')]=function(_0x2fa7dd,_0x217fda){return db[_0x8cbd('0x33')][_0x8cbd('0xbc')](_0x2fa7dd['body'],{})[_0x8cbd('0x23')](respondWithResult(_0x217fda,0xc9))['catch'](handleError(_0x217fda,null));};exports[_0x8cbd('0x21')]=function(_0x26a5ce,_0x44d18c){if(_0x26a5ce[_0x8cbd('0x70')]['id']){delete _0x26a5ce['body']['id'];}return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x26a5ce[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x44d18c,null))[_0x8cbd('0x23')](saveUpdates(_0x26a5ce[_0x8cbd('0x70')],null))[_0x8cbd('0x23')](respondWithResult(_0x44d18c,null))[_0x8cbd('0x30')](handleError(_0x44d18c,null));};exports[_0x8cbd('0x22')]=function(_0x5af5f7,_0x33d302){return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x5af5f7[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x33d302,null))[_0x8cbd('0x23')](removeEntity(_0x33d302,null))[_0x8cbd('0x30')](handleError(_0x33d302,null));};exports['describe']=function(_0x3ca120,_0x430a5c){return db[_0x8cbd('0x33')]['describe']()[_0x8cbd('0x23')](respondWithResult(_0x430a5c,null))[_0x8cbd('0x30')](handleError(_0x430a5c,null));};exports[_0x8cbd('0xbd')]=function(_0x1f71ed,_0x1e9475,_0x6d109f){return db[_0x8cbd('0xbe')][_0x8cbd('0x5d')]({'where':{'id':_0x1f71ed[_0x8cbd('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1e9475,null))[_0x8cbd('0x23')](function(_0x4d1ee8){if(_0x4d1ee8){return _0x4d1ee8[_0x8cbd('0xbd')](_0x1f71ed['body'][_0x8cbd('0xbf')],_[_0x8cbd('0xc0')](_0x1f71ed[_0x8cbd('0x70')],[_0x8cbd('0xbf'),'id'])||{});}})[_0x8cbd('0x23')](respondWithResult(_0x1e9475,null))['catch'](handleError(_0x1e9475,null));};exports[_0x8cbd('0xc1')]=function(_0x5c7f51,_0x59fcc9,_0x220760){var _0x5efc53={'raw':![],'where':{}};var _0x4bccd5={};var _0xecbf06={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x5c7f51[_0x8cbd('0xb8')]['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x59fcc9,null))[_0x8cbd('0x23')](function(_0x41c2cf){if(_0x41c2cf){_0x4bccd5['model']=_[_0x8cbd('0x39')](db[_0x8cbd('0xbe')][_0x8cbd('0x34')]);_0x4bccd5[_0x8cbd('0x38')]=_[_0x8cbd('0x39')](_0x5c7f51[_0x8cbd('0x38')]);_0x4bccd5[_0x8cbd('0x41')]=_['intersection'](_0x4bccd5[_0x8cbd('0x37')],_0x4bccd5[_0x8cbd('0x38')]);_0x5efc53['attributes']=_['intersection'](_0x4bccd5[_0x8cbd('0x37')],qs['fields'](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x3b')]));_0x5efc53[_0x8cbd('0x3c')]=_0x5efc53[_0x8cbd('0x3c')][_0x8cbd('0x5c')]?_0x5efc53[_0x8cbd('0x3c')]:_0x4bccd5[_0x8cbd('0x37')];if(!_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x3d')](_0x8cbd('0x3e'))){_0x5efc53[_0x8cbd('0x1b')]=qs[_0x8cbd('0x1b')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x1b')]);_0x5efc53['offset']=qs[_0x8cbd('0x1a')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x1a')]);}_0x5efc53[_0x8cbd('0x3f')]=qs[_0x8cbd('0x40')](_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x40')]);_0x5efc53['where']=qs[_0x8cbd('0x41')](_[_0x8cbd('0x42')](_0x5c7f51['query'],_0x4bccd5['filters']));_0x5efc53[_0x8cbd('0x7b')]['WhatsappInteractionId']=_0x41c2cf['id'];if(_0x5c7f51['query'][_0x8cbd('0x85')]){_0x5efc53[_0x8cbd('0x7b')]=_[_0x8cbd('0xa0')](_0x5efc53[_0x8cbd('0x7b')],{'$or':_[_0x8cbd('0x32')](_0x5efc53[_0x8cbd('0x3c')],function(_0x466048){var _0x41fb86={};_0x41fb86[_0x466048]={'$like':'%'+_0x5c7f51[_0x8cbd('0x38')]['filter']+'%'};return _0x41fb86;})});}if(_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x79')]){var _0x99e7bf=_0x5c7f51[_0x8cbd('0x38')][_0x8cbd('0x79')][_0x8cbd('0x2d')](',');var _0x454371={};_0x454371[_0x99e7bf[0x0]]={'$gte':moment(_0x99e7bf[0x1])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))};_0x5efc53[_0x8cbd('0x7b')]=_[_0x8cbd('0xa0')](_0x5efc53['where'],_0x454371);}_0x5efc53=_[_0x8cbd('0xa0')]({},_0x5efc53,_0x5c7f51['options']);return db[_0x8cbd('0xbe')][_0x8cbd('0x19')]({'where':_0x5efc53[_0x8cbd('0x7b')]})[_0x8cbd('0x23')](function(_0x27171e){_0xecbf06[_0x8cbd('0x19')]=_0x27171e;if(_0x5c7f51[_0x8cbd('0x38')]['includeAll']){_0x5efc53[_0x8cbd('0xba')]=[{'all':!![]}];}return db[_0x8cbd('0xbe')][_0x8cbd('0xc4')](_0x5efc53);})[_0x8cbd('0x23')](function(_0xe182fb){_0xecbf06[_0x8cbd('0xb6')]=_0xe182fb;return _0xecbf06;});}})[_0x8cbd('0x23')](respondWithFilteredResult(_0x59fcc9,_0x5efc53))[_0x8cbd('0x30')](handleError(_0x59fcc9,null));};exports['addTags']=function(_0x28ae5a,_0x3f455a,_0x3d4c03){return db['WhatsappInteraction'][_0x8cbd('0x5d')]({'where':{'id':_0x28ae5a['params']['id']}})[_0x8cbd('0x23')](handleEntityNotFound(_0x3f455a,null))['then'](function(_0x5e5958){if(_0x5e5958){return _0x5e5958[_0x8cbd('0xc5')](_0x28ae5a[_0x8cbd('0x70')][_0x8cbd('0xbf')],_['omit'](_0x28ae5a[_0x8cbd('0x70')],[_0x8cbd('0xbf'),'id'])||{})['spread'](function(){return db[_0x8cbd('0x6b')][_0x8cbd('0xc4')]({'attributes':['id','name',_0x8cbd('0x44')],'where':{'id':_0x28ae5a[_0x8cbd('0x70')][_0x8cbd('0xbf')]}});})[_0x8cbd('0x23')](function(_0x5d1600){socket[_0x8cbd('0xc6')]('whatsappInteractionTags:save',{'id':Number(_0x28ae5a[_0x8cbd('0xb8')]['id']),'tags':_0x5d1600||[]});return{'id':Number(_0x28ae5a[_0x8cbd('0xb8')]['id']),'tags':_0x5d1600||[]};});}})['then'](respondWithResult(_0x3f455a,null))[_0x8cbd('0x30')](handleError(_0x3f455a,null));};exports[_0x8cbd('0xc7')]=function(_0x322739,_0x526e19,_0x30c3bb){return db[_0x8cbd('0x33')]['find']({'where':{'id':_0x322739[_0x8cbd('0xb8')]['id']}})['then'](handleEntityNotFound(_0x526e19,null))[_0x8cbd('0x23')](function(_0x5cd794){if(_0x5cd794){return _0x5cd794[_0x8cbd('0xc7')](_0x322739[_0x8cbd('0x38')][_0x8cbd('0xbf')]);}})['then'](respondWithStatusCode(_0x526e19,null))[_0x8cbd('0x30')](handleError(_0x526e19,null));};exports[_0x8cbd('0xc8')]=function(_0x5eda8f,_0x4f7d2e){var _0x3fb531=moment()[_0x8cbd('0xc9')]()[_0x8cbd('0x9e')]();var _0x3842cf=path['join'](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),'files',_0x8cbd('0xcc'));var _0x4a538b=path[_0x8cbd('0xcd')](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),'files','attachments');var _0xfad80e=path['join'](_0x3842cf,_0x3fb531);var _0xdbe0a7=util['format'](_0x8cbd('0xce'),_0x5eda8f['params']['id'],_0x3fb531);var _0x5b9785=path[_0x8cbd('0xcd')](_0x3842cf,_0xdbe0a7);var _0xf7d54e=[];_0xf7d54e[_0x8cbd('0x2f')]({'model':db[_0x8cbd('0x6d')],'as':_0x8cbd('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0xf7d54e[_0x8cbd('0x2f')]({'model':db['CmContact'],'as':_0x8cbd('0x62'),'attributes':['id',_0x8cbd('0xcf'),_0x8cbd('0xd0')],'raw':!![]});if(_0x5eda8f[_0x8cbd('0x38')][_0x8cbd('0xd1')]){_0xf7d54e[_0x8cbd('0x2f')]({'model':db[_0x8cbd('0xd2')],'as':_0x8cbd('0xd2'),'raw':!![]});}var _0x476bae=[{'model':db[_0x8cbd('0xbe')],'as':_0x8cbd('0xd3'),'attributes':['id',_0x8cbd('0x70'),_0x8cbd('0x77'),_0x8cbd('0xd4'),_0x8cbd('0xd5'),'read'],'include':_0xf7d54e}];_0x476bae[_0x8cbd('0x2f')]({'model':db['WhatsappAccount'],'as':_0x8cbd('0xd6'),'attributes':['id',_0x8cbd('0x28')]});_0x476bae[_0x8cbd('0x2f')]({'model':db['User'],'as':_0x8cbd('0xd7'),'attributes':['id',_0x8cbd('0x2a')]});return db[_0x8cbd('0x33')][_0x8cbd('0x5d')]({'where':{'id':_0x5eda8f[_0x8cbd('0xb8')]['id']},'include':_0x476bae})[_0x8cbd('0x23')](handleEntityNotFound(_0x4f7d2e,null))['then'](function(_0x3f85da){if(_0x3f85da){var _0x41b2e3=_0x3f85da[_0x8cbd('0xd8')]({'plain':!![]});fs[_0x8cbd('0xd9')](_0xfad80e);var _0x16cd16={'format':'A4','border':_0x8cbd('0xda'),'header':{'height':_0x8cbd('0xdb'),'contents':{'first':_0x8cbd('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0x8cbd('0xc2')](_0x8cbd('0xdd'),util['format'](_0x8cbd('0xde'),_0x8cbd('0xdf'),_0x41b2e3['id']),moment()[_0x8cbd('0xc2')](_0x8cbd('0xe0'))[_0x8cbd('0x9e')]())}}};var _0x23cc14={'channel':_0x8cbd('0xdf'),'account':_0x41b2e3[_0x8cbd('0xd6')][_0x8cbd('0x28')],'agent':_0x41b2e3[_0x8cbd('0xd7')]?_0x41b2e3[_0x8cbd('0xd7')]['fullname']:_0x8cbd('0xe1'),'createdAt':moment(_0x41b2e3[_0x8cbd('0x77')])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))[_0x8cbd('0x9e')](),'closedAt':_0x41b2e3[_0x8cbd('0xe2')]?moment(_0x41b2e3['closedAt'])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))['toString']():'','disposition':_0x41b2e3['disposition'],'messages':_(_0x41b2e3['Messages'])[_0x8cbd('0x85')]({'secret':![]})[_0x8cbd('0x32')](function(_0x57b21c){if(_0x57b21c[_0x8cbd('0xd2')]){var _0x1b3d34=path['join'](_0x4a538b,_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')]);if(fs[_0x8cbd('0xe4')](_0x1b3d34)){fs[_0x8cbd('0xe5')](_0x1b3d34)[_0x8cbd('0xe6')](fs[_0x8cbd('0xe7')](path[_0x8cbd('0xcd')](_0xfad80e,_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')])));}}return{'date':moment(_0x57b21c['createdAt'])[_0x8cbd('0xc2')](_0x8cbd('0xc3'))[_0x8cbd('0x9e')](),'sender':_0x57b21c['direction']==='out'?_0x57b21c[_0x8cbd('0x6d')]?_0x57b21c[_0x8cbd('0x6d')][_0x8cbd('0x2a')]:'System':_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xcf')]+(_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xd0')]?'\x20'+_0x57b21c[_0x8cbd('0x62')][_0x8cbd('0xd0')]:''),'body':_0x57b21c[_0x8cbd('0xd2')]?_0x57b21c[_0x8cbd('0xd2')][_0x8cbd('0xe3')]:_0x57b21c[_0x8cbd('0x70')],'direction':_0x57b21c['direction']===_0x8cbd('0xe8')?'A':'C','secret':_0x57b21c['secret'],'read':_0x57b21c[_0x8cbd('0x7f')],'attachment':_0x57b21c[_0x8cbd('0xd2')]};})[_0x8cbd('0x5f')]()};return ejs[_0x8cbd('0xe9')](path['join'](config[_0x8cbd('0xca')],_0x8cbd('0xcb'),_0x8cbd('0xea'),_0x8cbd('0xeb')),{'interaction':_0x23cc14})[_0x8cbd('0x23')](function(_0x759d1b){return new BPromise(function(_0x2febfc,_0x19608a){pdf['create'](_0x759d1b,_0x16cd16)['toFile'](path[_0x8cbd('0xcd')](_0xfad80e,'transcript-'+_0x41b2e3['id']+'-'+_0x3fb531+_0x8cbd('0xec')),function(_0x172e89,_0x1ec83c){if(_0x172e89)return _0x19608a(_0x172e89);_0x2febfc(_0x1ec83c);});});})[_0x8cbd('0x23')](function(){return new BPromise(function(_0x4a8af1,_0x44cbc8){zipdir(_0xfad80e,{'saveTo':_0x5b9785},function(_0x42fda1,_0x52a374){if(_0x42fda1)return _0x44cbc8(_0x42fda1);return _0x4a8af1(_0x52a374);});})['then'](function(){return new BPromise(function(_0x285401,_0x5d2497){rimraf(_0xfad80e,function(_0x3079e5){if(_0x3079e5)_0x5d2497(_0x3079e5);return _0x285401();});});})['then'](function(){return _0x4f7d2e['download'](_0x5b9785,_0xdbe0a7,function(_0x4397ff){if(_0x4397ff){console['log']('err',_0x4397ff);}else{fs[_0x8cbd('0xed')](_0x5b9785);}});});});}else{return _0x4f7d2e[_0x8cbd('0x25')](0xc8);}})[_0x8cbd('0x30')](handleError(_0x4f7d2e,null));}; \ No newline at end of file +var _0x9039=['json','reject','save','then','destroy','sendStatus','error','name','Users','map','Tags','split','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','WhatsappAccountId','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','includeAll','include','options','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','merge','addTags','setTags','spread','Tag','findAll','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','firstName','lastName','Attachment','direction','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','N.A.','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappInteraction.socket','register','status','end','count','offset','limit','Content-Range'];(function(_0x3f7372,_0x30ad27){var _0x43b414=function(_0x320f23){while(--_0x320f23){_0x3f7372['push'](_0x3f7372['shift']());}};_0x43b414(++_0x30ad27);}(_0x9039,0xd9));var _0x9903=function(_0x51f1a5,_0x4fecc4){_0x51f1a5=_0x51f1a5-0x0;var _0xdcf7f2=_0x9039[_0x51f1a5];return _0xdcf7f2;};'use strict';var pdf=require(_0x9903('0x0'));var emlformat=require(_0x9903('0x1'));var rimraf=require(_0x9903('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9903('0x3'));var rp=require(_0x9903('0x4'));var moment=require(_0x9903('0x5'));var BPromise=require(_0x9903('0x6'));var Mustache=require(_0x9903('0x7'));var util=require(_0x9903('0x8'));var path=require('path');var sox=require(_0x9903('0x9'));var csv=require('to-csv');var ejs=require(_0x9903('0xa'));var fs=require('fs');var _=require(_0x9903('0xb'));var squel=require(_0x9903('0xc'));var crypto=require('crypto');var jsforce=require(_0x9903('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9903('0xe'));var querystring=require(_0x9903('0xf'));var Papa=require('papaparse');var Redis=require(_0x9903('0x10'));var authService=require(_0x9903('0x11'));var qs=require(_0x9903('0x12'));var as=require(_0x9903('0x13'));var hardwareService=require(_0x9903('0x14'));var logger=require(_0x9903('0x15'))(_0x9903('0x16'));var utils=require(_0x9903('0x17'));var config=require(_0x9903('0x18'));var licenseUtil=require(_0x9903('0x19'));var db=require('../../mysqldb')['db'];config[_0x9903('0x1a')]=_[_0x9903('0x1b')](config[_0x9903('0x1a')],{'host':_0x9903('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9903('0x1d'))[_0x9903('0x1e')](socket);function respondWithStatusCode(_0x5ac59a,_0x1d55a4){_0x1d55a4=_0x1d55a4||0xcc;return function(_0x3fa23b){if(_0x3fa23b){return _0x5ac59a['sendStatus'](_0x1d55a4);}return _0x5ac59a[_0x9903('0x1f')](_0x1d55a4)[_0x9903('0x20')]();};}function respondWithResult(_0x1d5d88,_0x339549){_0x339549=_0x339549||0xc8;return function(_0x16770e){if(_0x16770e){return _0x1d5d88[_0x9903('0x1f')](_0x339549)['json'](_0x16770e);}};}function respondWithFilteredResult(_0x1b3e7a,_0x54a4e9){return function(_0x439d6f){if(_0x439d6f){var _0x59b059=_0x439d6f[_0x9903('0x21')],_0x1941f1=_0x54a4e9['offset'],_0x4ee1e2=_0x54a4e9[_0x9903('0x22')]+_0x54a4e9[_0x9903('0x23')],_0x165d5a;if(_0x4ee1e2>=_0x59b059){_0x4ee1e2=_0x59b059;_0x165d5a=0xc8;}else{_0x165d5a=0xce;}_0x1b3e7a[_0x9903('0x1f')](_0x165d5a);return _0x1b3e7a['set'](_0x9903('0x24'),_0x1941f1+'-'+_0x4ee1e2+'/'+_0x59b059)[_0x9903('0x25')](_0x439d6f);}return null;};}function patchUpdates(_0x4251c8){return function(_0x5a5afe){try{jsonpatch['apply'](_0x5a5afe,_0x4251c8,!![]);}catch(_0x327ac0){return BPromise[_0x9903('0x26')](_0x327ac0);}return _0x5a5afe[_0x9903('0x27')]();};}function saveUpdates(_0x51ea52,_0x271540){return function(_0x394cd5){if(_0x394cd5){return _0x394cd5['update'](_0x51ea52)[_0x9903('0x28')](function(_0x3ba497){return _0x3ba497;});}return null;};}function removeEntity(_0x2a5b42,_0x9f9ac8){return function(_0x5202bd){if(_0x5202bd){return _0x5202bd[_0x9903('0x29')]()[_0x9903('0x28')](function(){_0x2a5b42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7e3bc,_0x5cc4b7){return function(_0x17bbeb){if(!_0x17bbeb){_0xb7e3bc[_0x9903('0x2a')](0x194);}return _0x17bbeb;};}function handleError(_0x3f8fc4,_0x1ce14c){_0x1ce14c=_0x1ce14c||0x1f4;return function(_0x2bad1f){logger[_0x9903('0x2b')](_0x2bad1f['stack']);if(_0x2bad1f[_0x9903('0x2c')]){delete _0x2bad1f[_0x9903('0x2c')];}_0x3f8fc4[_0x9903('0x1f')](_0x1ce14c)['send'](_0x2bad1f);};}function getInteractionUsers(_0xbff479,_0x402944){return new BPromise(function(_0x7ce575,_0x5c7786){try{if(_0x402944[_0xbff479['id']]){_0xbff479[_0x9903('0x2d')]=_[_0x9903('0x2e')](_0x402944[_0xbff479['id']],function(_0x280112){return{'id':_0x280112['id'],'fullname':_0x280112['fullname']};});}}catch(_0x1c2e42){_0x5c7786(_0x1c2e42);}_0x7ce575(_0xbff479);});}function getInteractionTags(_0x1a5446,_0x597bbf){return new BPromise(function(_0x18d871,_0x3599b8){try{if(_0x1a5446['TagIds']){_0x1a5446[_0x9903('0x2f')]=[];_0x1a5446['TagIds'][_0x9903('0x30')](',')['forEach'](function(_0x2f46f4){_0x1a5446[_0x9903('0x2f')][_0x9903('0x31')](_0x597bbf[_0x2f46f4]);});}delete _0x1a5446['TagIds'];}catch(_0x4fcfe6){_0x3599b8(_0x4fcfe6);}_0x18d871(_0x1a5446);});}function updateWhatsappInteraction(_0x4ed0bd,_0x3187ad,_0x4fa2bc){return new BPromise(function(_0x4bc3a9,_0x2e9a4){return getInteractionUsers(_0x4ed0bd,_0x4fa2bc)[_0x9903('0x28')](function(_0x247e93){return getInteractionTags(_0x247e93,_0x3187ad);})[_0x9903('0x28')](function(_0x1b1800){_0x4bc3a9(_0x1b1800);})['catch'](function(_0x43045e){_0x2e9a4(_0x43045e);});});}exports[_0x9903('0x32')]=function(_0x576ec4,_0x117e82){var _0x2d89c0={},_0x3fd2a5={},_0xc93dae={'count':0x0,'rows':[]};var _0x5c60d0=_[_0x9903('0x2e')](db[_0x9903('0x33')][_0x9903('0x34')],function(_0x44d81b){return{'name':_0x44d81b[_0x9903('0x35')],'type':_0x44d81b[_0x9903('0x36')][_0x9903('0x37')]};});_0x3fd2a5[_0x9903('0x38')]=_[_0x9903('0x2e')](_0x5c60d0,_0x9903('0x2c'));_0x3fd2a5[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x576ec4[_0x9903('0x39')]);_0x3fd2a5['filters']=_[_0x9903('0x3b')](_0x3fd2a5[_0x9903('0x38')],_0x3fd2a5[_0x9903('0x39')]);_0x2d89c0[_0x9903('0x3c')]=_[_0x9903('0x3b')](_0x3fd2a5[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x576ec4['query']['fields']));_0x2d89c0['attributes']=_0x2d89c0['attributes'][_0x9903('0x3e')]?_0x2d89c0[_0x9903('0x3c')]:_0x3fd2a5[_0x9903('0x38')];if(!_0x576ec4[_0x9903('0x39')]['hasOwnProperty']('nolimit')){_0x2d89c0[_0x9903('0x23')]=qs[_0x9903('0x23')](_0x576ec4['query'][_0x9903('0x23')]);_0x2d89c0[_0x9903('0x22')]=qs[_0x9903('0x22')](_0x576ec4[_0x9903('0x39')][_0x9903('0x22')]);}_0x2d89c0['order']=qs[_0x9903('0x3f')](_0x576ec4[_0x9903('0x39')][_0x9903('0x3f')]);_0x2d89c0[_0x9903('0x40')]=qs[_0x9903('0x41')](_[_0x9903('0x42')](_0x576ec4['query'],_0x3fd2a5[_0x9903('0x41')]),_0x5c60d0);var _0x201c14=[];var _0x365586=squel[_0x9903('0x43')]()[_0x9903('0x44')]('id')[_0x9903('0x44')](_0x9903('0x2c'))[_0x9903('0x44')](_0x9903('0x45'))[_0x9903('0x46')](_0x9903('0x47'));var _0x3e27a5=squel['select']()[_0x9903('0x44')](_0x9903('0x48'))['field'](_0x9903('0x49'))[_0x9903('0x44')](_0x9903('0x4a'))[_0x9903('0x46')](_0x9903('0x4b'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0xa1edbc=squel['select']()[_0x9903('0x46')]('whatsapp_interactions','i')[_0x9903('0x4c')]('cm_contacts','c',_0x9903('0x4d'))[_0x9903('0x4c')](_0x9903('0x4e'),'o',_0x9903('0x4f'))[_0x9903('0x4c')](_0x9903('0x50'),'a',_0x9903('0x51'))['left_join'](_0x9903('0x52'),'me',_0x9903('0x53'))[_0x9903('0x4c')](_0x9903('0x54'),'it',_0x9903('0x55'))[_0x9903('0x4c')](_0x9903('0x47'),'t',_0x9903('0x56'));var _0x1e193b=squel['expr']();var _0x27fb93=[];var _0x4c856b=squel[_0x9903('0x57')]();var _0x439b8a;if(_0x576ec4[_0x9903('0x39')][_0x9903('0x58')]){_0x439b8a=as[_0x9903('0x59')](_0x576ec4[_0x9903('0x39')][_0x9903('0x58')]);var _0x279ffa=_0x439b8a[_0x9903('0x5a')];for(var _0x5d590e=0x0;_0x5d590e<_0x439b8a['conditions'][_0x9903('0x3e')];_0x5d590e++){var _0x1356bd=_0x439b8a[_0x9903('0x5b')][_0x5d590e];var _0x4cc79c='i';var _0x1c2f9d=_['find'](_0x5c60d0,[_0x9903('0x2c'),_0x1356bd[_0x9903('0x44')]]);if(!_0x1c2f9d){switch(_0x1356bd[_0x9903('0x44')]){case _0x9903('0x5c'):if(_0x1356bd[_0x9903('0x5d')]==0x1){_0xa1edbc['having']('`'+_0x1356bd[_0x9903('0x44')]+_0x9903('0x5e'));}else{_0xa1edbc[_0x9903('0x5f')]('`'+_0x1356bd[_0x9903('0x44')]+_0x9903('0x60'));}break;case _0x9903('0x61'):if(_0x1356bd[_0x9903('0x62')]===_0x9903('0x63')){if(_0x1356bd[_0x9903('0x5d')][_0x9903('0x30')]('\x20')[_0x9903('0x3e')]>0x1){_0x1e193b[_0x279ffa](_0x9903('0x64'),qs[_0x9903('0x65')](_0x1356bd['value']),null);}else{var _0x1a4821='%'+_0x1356bd[_0x9903('0x5d')]+'%';_0x1e193b[_0x279ffa](_0x9903('0x66'),_0x1a4821,_0x1a4821,_0x1a4821);}}else{_0x1c2f9d=_[_0x9903('0x67')](_0x5c60d0,['name',_0x9903('0x68')]);_0x1356bd['field']=_0x9903('0x68');_0x2ae443=as[_0x9903('0x69')](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443['value'][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}break;case'Tag':var _0x219f3b=_0x1356bd['value'][_0x9903('0x30')](',')[_0x9903('0x2e')](function(_0x2677ef){return Number(_0x2677ef);});_0x219f3b[_0x9903('0x6c')](function(_0x5b510d){_0x4c856b['or'](_0x9903('0x6d'),'%,'+_0x5b510d+',%');});_0x27fb93=_[_0x9903('0x6e')](_0x27fb93,_0x219f3b);break;case'User':if(_0x1356bd[_0x9903('0x62')]===_0x9903('0x63')){_0x1e193b[_0x279ffa](_0x9903('0x6f'),'%'+_0x1356bd[_0x9903('0x5d')]+'%',null);}else{_0x1c2f9d=_['find'](_0x5c60d0,['name',_0x9903('0x70')]);_0x1356bd[_0x9903('0x44')]='UserId';_0x2ae443=as['buildExpression'](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443['text'],_0x2ae443[_0x9903('0x5d')][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}break;case _0x9903('0x71'):_0x2ae443=as[_0x9903('0x69')]('me',null,_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);break;}}else{var _0x2ae443=as[_0x9903('0x69')](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443[_0x9903('0x5d')]['start'],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}}}else{var _0x5b288a=_(_0x576ec4['query'])[_0x9903('0x3a')]()[_0x9903('0x2e')](function(_0x3c938b){return _[_0x9903('0x72')](_0x5c60d0,[_0x9903('0x2c'),_0x3c938b])?_0x3c938b:undefined;})[_0x9903('0x73')]()[_0x9903('0x5d')]();if(!_[_0x9903('0x74')](_0x5b288a)){_0x5b288a[_0x9903('0x6c')](function(_0x1ad22b){if(_0x1ad22b==='WhatsappAccountId'){_0xa1edbc[_0x9903('0x40')](_0x9903('0x75'),[][_0x9903('0x76')](_0x576ec4[_0x9903('0x39')][_0x1ad22b]));}else if(_0x1ad22b===_0x9903('0x77')){var _0x4c450d=JSON[_0x9903('0x78')](_0x576ec4[_0x9903('0x39')][_0x1ad22b])[_0x9903('0x79')];var _0x543135=JSON['parse'](_0x576ec4[_0x9903('0x39')][_0x1ad22b])[_0x9903('0x7a')];_0xa1edbc[_0x9903('0x40')](_0x9903('0x7b'),_0x4c450d,_0x543135);}else{if(_0x576ec4['query'][_0x1ad22b]===_0x9903('0x7c')){_0xa1edbc[_0x9903('0x40')]('i.'+_0x1ad22b+_0x9903('0x7d'));}else{_0xa1edbc[_0x9903('0x40')]('i.'+_0x1ad22b+_0x9903('0x7e'),_0x576ec4[_0x9903('0x39')][_0x1ad22b]);}}});}if(_0x576ec4['query'][_0x9903('0x7f')]){if(_0x576ec4[_0x9903('0x39')]['read']==0x1){_0xa1edbc['having'](_0x9903('0x80'));}else{_0xa1edbc[_0x9903('0x5f')](_0x9903('0x81'));}}if(_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]){_0x27fb93=_[_0x9903('0x83')](_0x576ec4[_0x9903('0x39')]['tag'])?_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]:new Array(_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]);_0x27fb93['forEach'](function(_0x301456){_0x4c856b['or'](_0x9903('0x6d'),'%,'+_0x301456+',%');});}if(_0x576ec4[_0x9903('0x39')]['filter']){var _0x368400=_0x576ec4['query'][_0x9903('0x84')][_0x9903('0x85')]('\x5c','\x5c\x5c')[_0x9903('0x85')](/'/g,'\x27\x27');if(qs[_0x9903('0x86')](_0x368400)){_0x1e193b['or'](_0x9903('0x87'),_0x368400+'%')['or'](_0x9903('0x88'),_0x368400+'%');}else{_0x1e193b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x368400))['or'](_0x9903('0x89'),_0x368400+'%');}}}_0xa1edbc['where'](_0x1e193b);_0xa1edbc[_0x9903('0x8a')](_0x9903('0x8b'));var _0x10169a={'type':db['Sequelize'][_0x9903('0x8c')][_0x9903('0x8d')],'raw':!![]};var _0x5e5397=_0xa1edbc['clone']();_0x5e5397[_0x9903('0x44')](_0x9903('0x8b'));_0x5e5397[_0x9903('0x44')](_0x9903('0x8e'),_0x9903('0x5c'));if(_0x2d89c0[_0x9903('0x8f')]){_0x2d89c0['order'][_0x9903('0x6c')](function(_0x28aeb8){var _0x17eab6=_0x28aeb8[0x0]===_0x9903('0x90')?_0x28aeb8[0x0]:'i.'+_0x28aeb8[0x0];_0xa1edbc[_0x9903('0x8f')](_0x17eab6,_0x28aeb8[0x1]===_0x9903('0x91')?![]:!![]);});}if(!_[_0x9903('0x74')](_0x27fb93)){_0xa1edbc['having'](_0x4c856b);_0x5e5397[_0x9903('0x40')]('t.id\x20IN\x20?',_0x27fb93);}BPromise['resolve']()['then'](function(){if(!_0x439b8a){if(_0x576ec4['query'][_0x9903('0x92')]||_0x576ec4[_0x9903('0x39')][_0x9903('0x93')])return;_0x5e5397[_0x9903('0x40')](_0x9903('0x94'));_0xa1edbc[_0x9903('0x40')](_0x9903('0x94'));return;}if(_0x576ec4[_0x9903('0x95')]['role']!==_0x9903('0x96'))return;return _0x576ec4['user'][_0x9903('0x97')]({'attributes':['id'],'raw':!![]})[_0x9903('0x28')](function(_0x440d0e){if(_[_0x9903('0x74')](_0x440d0e)){_0x5e5397[_0x9903('0x40')](_0x9903('0x98'));_0xa1edbc[_0x9903('0x40')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x5e5397[_0x9903('0x40')](_0x9903('0x75'),_[_0x9903('0x2e')](_0x440d0e,'id'));_0xa1edbc[_0x9903('0x40')]('i.WhatsappAccountId\x20IN\x20?',_[_0x9903('0x2e')](_0x440d0e,'id'));}});})[_0x9903('0x28')](function(){if(_0x576ec4[_0x9903('0x95')]['role']===_0x9903('0x96')&&!_0x439b8a&&!_0x576ec4['query'][_0x9903('0x92')])return[];return db[_0x9903('0x99')][_0x9903('0x39')](_0x5e5397[_0x9903('0x9a')](),_0x10169a);})[_0x9903('0x28')](function(_0xd61314){_0xc93dae[_0x9903('0x21')]=_0xd61314['length'];if(_0xc93dae['count']===0x0)return[];return db['sequelize'][_0x9903('0x39')](_0x365586[_0x9903('0x9a')](),_0x10169a)[_0x9903('0x28')](function(_0x14e21a){_0x201c14=_[_0x9903('0x9b')](_0x14e21a,'id');_0x10169a=_['merge'](_0x10169a,{'model':db[_0x9903('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x576ec4[_0x9903('0x39')][_0x9903('0x3d')]){_0x2d89c0['attributes'][_0x9903('0x6c')](function(_0x3d453a){_0xa1edbc['field']('i.'+_0x3d453a);});}else{_0xa1edbc[_0x9903('0x44')](_0x9903('0x8e'),'unreadMessages');_0xa1edbc[_0x9903('0x44')](_0x9903('0x9c'),'Account.key');_0xa1edbc[_0x9903('0x44')](_0x9903('0x9d'),_0x9903('0x9e'));_0xa1edbc[_0x9903('0x44')](_0x9903('0x9f'),'contactName');_0xa1edbc[_0x9903('0x44')](_0x9903('0xa0'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa1'),_0x9903('0xa2'));_0xa1edbc[_0x9903('0x44')]('c.lastName',_0x9903('0xa3'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa4'),_0x9903('0xa5'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa6'),_0x9903('0xa7'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa8'),_0x9903('0xa9'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xaa'),'Contact.fax');_0xa1edbc[_0x9903('0x44')](_0x9903('0xab'),_0x9903('0xac'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xad'),_0x9903('0xae'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xaf'),_0x9903('0xb0'));}if(_0x2d89c0['limit'])_0xa1edbc[_0x9903('0x23')](_0x2d89c0[_0x9903('0x23')]);if(_0x2d89c0['offset'])_0xa1edbc[_0x9903('0x22')](_0x2d89c0[_0x9903('0x22')]);return db[_0x9903('0x99')][_0x9903('0x39')](_0xa1edbc[_0x9903('0x9a')](),_0x10169a);})[_0x9903('0x28')](function(_0x417239){_0x3e27a5[_0x9903('0x40')](_0x9903('0xb1'),_[_0x9903('0x2e')](_0x417239,'id'));return db[_0x9903('0x99')][_0x9903('0x39')](_0x3e27a5[_0x9903('0x9a')](),_0x10169a)[_0x9903('0x28')](function(_0x383849){var _0x50dee6=_[_0x9903('0xb2')](_0x383849,_0x9903('0xb3'));var _0x34792d=[];_0x417239['forEach'](function(_0x128d50){_0x34792d[_0x9903('0x31')](updateWhatsappInteraction(_0x128d50,_0x201c14,_0x50dee6));});return BPromise[_0x9903('0xb4')](_0x34792d);});});})[_0x9903('0x28')](function(_0x54a39c){_0xc93dae[_0x9903('0xb5')]=_0x54a39c;return _0xc93dae;})['then'](respondWithFilteredResult(_0x117e82,_0x2d89c0))[_0x9903('0xb6')](handleError(_0x117e82,null));};exports[_0x9903('0xb7')]=function(_0x508305,_0x2cbc89){var _0x5c3e88={'raw':![],'where':{'id':_0x508305['params']['id']}},_0x516ba1={};_0x516ba1[_0x9903('0x38')]=_[_0x9903('0x3a')](db[_0x9903('0x33')][_0x9903('0x34')]);_0x516ba1[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x508305[_0x9903('0x39')]);_0x516ba1[_0x9903('0x41')]=_['intersection'](_0x516ba1['model'],_0x516ba1[_0x9903('0x39')]);_0x5c3e88[_0x9903('0x3c')]=_['intersection'](_0x516ba1[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x508305[_0x9903('0x39')]['fields']));_0x5c3e88['attributes']=_0x5c3e88['attributes'][_0x9903('0x3e')]?_0x5c3e88[_0x9903('0x3c')]:_0x516ba1[_0x9903('0x38')];if(_0x508305[_0x9903('0x39')][_0x9903('0xb8')]){_0x5c3e88[_0x9903('0xb9')]=[{'all':!![]}];}_0x5c3e88=_['merge']({},_0x5c3e88,_0x508305[_0x9903('0xba')]);return db['WhatsappInteraction'][_0x9903('0x67')](_0x5c3e88)[_0x9903('0x28')](handleEntityNotFound(_0x2cbc89,null))[_0x9903('0x28')](respondWithResult(_0x2cbc89,null))['catch'](handleError(_0x2cbc89,null));};exports[_0x9903('0xbb')]=function(_0x3e7093,_0x3160b0){return db[_0x9903('0x33')][_0x9903('0xbb')](_0x3e7093['body'],{})[_0x9903('0x28')](respondWithResult(_0x3160b0,0xc9))[_0x9903('0xb6')](handleError(_0x3160b0,null));};exports[_0x9903('0xbc')]=function(_0x46e1f8,_0x3707ec){if(_0x46e1f8['body']['id']){delete _0x46e1f8[_0x9903('0x71')]['id'];}return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x46e1f8[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x3707ec,null))[_0x9903('0x28')](saveUpdates(_0x46e1f8['body'],null))[_0x9903('0x28')](respondWithResult(_0x3707ec,null))['catch'](handleError(_0x3707ec,null));};exports[_0x9903('0x29')]=function(_0x530a3c,_0xb5f60){return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x530a3c[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0xb5f60,null))[_0x9903('0x28')](removeEntity(_0xb5f60,null))[_0x9903('0xb6')](handleError(_0xb5f60,null));};exports['describe']=function(_0x2e25b2,_0x1c4f34){return db['WhatsappInteraction'][_0x9903('0xbe')]()[_0x9903('0x28')](respondWithResult(_0x1c4f34,null))[_0x9903('0xb6')](handleError(_0x1c4f34,null));};exports[_0x9903('0xbf')]=function(_0x244128,_0x267d68,_0x2cdb74){return db[_0x9903('0xc0')]['find']({'where':{'id':_0x244128['params']['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x267d68,null))[_0x9903('0x28')](function(_0x21c8db){if(_0x21c8db){return _0x21c8db[_0x9903('0xbf')](_0x244128['body'][_0x9903('0xc1')],_[_0x9903('0xc2')](_0x244128['body'],[_0x9903('0xc1'),'id'])||{});}})[_0x9903('0x28')](respondWithResult(_0x267d68,null))[_0x9903('0xb6')](handleError(_0x267d68,null));};exports[_0x9903('0xc3')]=function(_0x1a1c1b,_0x1bbc10,_0x30d708){var _0x96193f={'raw':![],'where':{}};var _0x15cb47={};var _0x45f540={'count':0x0,'rows':[]};return db[_0x9903('0x33')]['findOne']({'where':{'id':_0x1a1c1b[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x1bbc10,null))[_0x9903('0x28')](function(_0x588321){if(_0x588321){_0x15cb47[_0x9903('0x38')]=_[_0x9903('0x3a')](db['WhatsappMessage'][_0x9903('0x34')]);_0x15cb47[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x1a1c1b[_0x9903('0x39')]);_0x15cb47[_0x9903('0x41')]=_['intersection'](_0x15cb47['model'],_0x15cb47[_0x9903('0x39')]);_0x96193f['attributes']=_[_0x9903('0x3b')](_0x15cb47[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x1a1c1b[_0x9903('0x39')]['fields']));_0x96193f[_0x9903('0x3c')]=_0x96193f[_0x9903('0x3c')][_0x9903('0x3e')]?_0x96193f['attributes']:_0x15cb47['model'];if(!_0x1a1c1b['query'][_0x9903('0xc4')](_0x9903('0xc5'))){_0x96193f[_0x9903('0x23')]=qs['limit'](_0x1a1c1b[_0x9903('0x39')][_0x9903('0x23')]);_0x96193f[_0x9903('0x22')]=qs[_0x9903('0x22')](_0x1a1c1b[_0x9903('0x39')][_0x9903('0x22')]);}_0x96193f['order']=qs[_0x9903('0x3f')](_0x1a1c1b['query'][_0x9903('0x3f')]);_0x96193f[_0x9903('0x40')]=qs[_0x9903('0x41')](_[_0x9903('0x42')](_0x1a1c1b[_0x9903('0x39')],_0x15cb47['filters']));_0x96193f[_0x9903('0x40')][_0x9903('0xb3')]=_0x588321['id'];if(_0x1a1c1b[_0x9903('0x39')][_0x9903('0x84')]){_0x96193f['where']=_['merge'](_0x96193f['where'],{'$or':_[_0x9903('0x2e')](_0x96193f['attributes'],function(_0x340bcc){var _0x36a6ab={};_0x36a6ab[_0x340bcc]={'$like':'%'+_0x1a1c1b[_0x9903('0x39')]['filter']+'%'};return _0x36a6ab;})});}if(_0x1a1c1b[_0x9903('0x39')]['$gte']){var _0x3b6d37=_0x1a1c1b[_0x9903('0x39')]['$gte'][_0x9903('0x30')](',');var _0xe51f32={};_0xe51f32[_0x3b6d37[0x0]]={'$gte':moment(_0x3b6d37[0x1])['format'](_0x9903('0xc6'))};_0x96193f[_0x9903('0x40')]=_[_0x9903('0xc7')](_0x96193f[_0x9903('0x40')],_0xe51f32);}_0x96193f=_['merge']({},_0x96193f,_0x1a1c1b['options']);return db['WhatsappMessage'][_0x9903('0x21')]({'where':_0x96193f[_0x9903('0x40')]})[_0x9903('0x28')](function(_0x3454f7){_0x45f540[_0x9903('0x21')]=_0x3454f7;if(_0x1a1c1b['query'][_0x9903('0xb8')]){_0x96193f[_0x9903('0xb9')]=[{'all':!![]}];}return db[_0x9903('0xc0')]['findAll'](_0x96193f);})[_0x9903('0x28')](function(_0x35969e){_0x45f540['rows']=_0x35969e;return _0x45f540;});}})['then'](respondWithFilteredResult(_0x1bbc10,_0x96193f))[_0x9903('0xb6')](handleError(_0x1bbc10,null));};exports[_0x9903('0xc8')]=function(_0x3e5fdb,_0x47b7aa,_0x5ea5a1){return db[_0x9903('0x33')]['find']({'where':{'id':_0x3e5fdb[_0x9903('0xbd')]['id']}})['then'](handleEntityNotFound(_0x47b7aa,null))[_0x9903('0x28')](function(_0x20126f){if(_0x20126f){return _0x20126f[_0x9903('0xc9')](_0x3e5fdb[_0x9903('0x71')][_0x9903('0xc1')],_['omit'](_0x3e5fdb[_0x9903('0x71')],[_0x9903('0xc1'),'id'])||{})[_0x9903('0xca')](function(){return db[_0x9903('0xcb')][_0x9903('0xcc')]({'attributes':['id',_0x9903('0x2c'),'color'],'where':{'id':_0x3e5fdb[_0x9903('0x71')]['ids']}});})['then'](function(_0x42adcf){socket[_0x9903('0xcd')](_0x9903('0xce'),{'id':Number(_0x3e5fdb['params']['id']),'tags':_0x42adcf||[]});return{'id':Number(_0x3e5fdb[_0x9903('0xbd')]['id']),'tags':_0x42adcf||[]};});}})[_0x9903('0x28')](respondWithResult(_0x47b7aa,null))[_0x9903('0xb6')](handleError(_0x47b7aa,null));};exports[_0x9903('0xcf')]=function(_0x3a732f,_0x5e045e,_0x1dd895){return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x3a732f[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x5e045e,null))[_0x9903('0x28')](function(_0x2792a6){if(_0x2792a6){return _0x2792a6[_0x9903('0xcf')](_0x3a732f[_0x9903('0x39')]['ids']);}})[_0x9903('0x28')](respondWithStatusCode(_0x5e045e,null))[_0x9903('0xb6')](handleError(_0x5e045e,null));};exports['download']=function(_0x4d09e1,_0x29130b){var _0x322ce6=moment()[_0x9903('0xd0')]()['toString']();var _0x32130b=path['join'](config[_0x9903('0xd1')],_0x9903('0xd2'),_0x9903('0xd3'),_0x9903('0xd4'));var _0x2b65f1=path[_0x9903('0xd5')](config[_0x9903('0xd1')],_0x9903('0xd2'),_0x9903('0xd3'),_0x9903('0xd6'));var _0x37566a=path[_0x9903('0xd5')](_0x32130b,_0x322ce6);var _0x544baa=util['format'](_0x9903('0xd7'),_0x4d09e1[_0x9903('0xbd')]['id'],_0x322ce6);var _0x40a723=path['join'](_0x32130b,_0x544baa);var _0x1352a7=[];_0x1352a7[_0x9903('0x31')]({'model':db[_0x9903('0xd8')],'as':_0x9903('0xd8'),'attributes':['id',_0x9903('0xd9')],'raw':!![]});_0x1352a7['push']({'model':db['CmContact'],'as':_0x9903('0x61'),'attributes':['id',_0x9903('0xda'),_0x9903('0xdb')],'raw':!![]});if(_0x4d09e1[_0x9903('0x39')][_0x9903('0xd6')]){_0x1352a7[_0x9903('0x31')]({'model':db[_0x9903('0xdc')],'as':_0x9903('0xdc'),'raw':!![]});}var _0x4c9682=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x9903('0x71'),_0x9903('0x77'),_0x9903('0xdd'),_0x9903('0xde'),_0x9903('0x7f')],'include':_0x1352a7}];_0x4c9682[_0x9903('0x31')]({'model':db['WhatsappAccount'],'as':_0x9903('0xdf'),'attributes':['id',_0x9903('0x2c')]});_0x4c9682[_0x9903('0x31')]({'model':db[_0x9903('0xd8')],'as':_0x9903('0xe0'),'attributes':['id','fullname']});return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x4d09e1['params']['id']},'include':_0x4c9682})[_0x9903('0x28')](handleEntityNotFound(_0x29130b,null))['then'](function(_0x504d46){if(_0x504d46){var _0x20919a=_0x504d46[_0x9903('0xe1')]({'plain':!![]});fs[_0x9903('0xe2')](_0x37566a);var _0x19518c={'format':'A4','border':_0x9903('0xe3'),'header':{'height':_0x9903('0xe4'),'contents':{'first':_0x9903('0xe5')}},'footer':{'height':'30px','contents':{'default':util[_0x9903('0xe6')](_0x9903('0xe7'),util['format']('%s\x20#%d',_0x9903('0xe8'),_0x20919a['id']),moment()[_0x9903('0xe6')](_0x9903('0xe9'))[_0x9903('0x9a')]())}}};var _0xdc79a={'channel':_0x9903('0xe8'),'account':_0x20919a[_0x9903('0xdf')]['name'],'agent':_0x20919a[_0x9903('0xe0')]?_0x20919a[_0x9903('0xe0')]['fullname']:_0x9903('0xea'),'createdAt':moment(_0x20919a[_0x9903('0x77')])[_0x9903('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x20919a['closed']?moment(_0x20919a[_0x9903('0xeb')])['format'](_0x9903('0xc6'))[_0x9903('0x9a')]():'','disposition':_0x20919a[_0x9903('0xec')],'messages':_(_0x20919a[_0x9903('0xed')])[_0x9903('0x84')]({'secret':![]})[_0x9903('0x2e')](function(_0x53bb2f){if(_0x53bb2f[_0x9903('0xdc')]){var _0x4f2a97=path[_0x9903('0xd5')](_0x2b65f1,_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')]);if(fs[_0x9903('0xef')](_0x4f2a97)){fs[_0x9903('0xf0')](_0x4f2a97)[_0x9903('0xf1')](fs[_0x9903('0xf2')](path[_0x9903('0xd5')](_0x37566a,_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')])));}}return{'date':moment(_0x53bb2f['createdAt'])[_0x9903('0xe6')](_0x9903('0xc6'))[_0x9903('0x9a')](),'sender':_0x53bb2f[_0x9903('0xdd')]===_0x9903('0xf3')?_0x53bb2f[_0x9903('0xd8')]?_0x53bb2f['User'][_0x9903('0xd9')]:_0x9903('0xf4'):_0x53bb2f[_0x9903('0x61')][_0x9903('0xda')]+(_0x53bb2f['Contact'][_0x9903('0xdb')]?'\x20'+_0x53bb2f[_0x9903('0x61')][_0x9903('0xdb')]:''),'body':_0x53bb2f['Attachment']?_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')]:_0x53bb2f[_0x9903('0x71')],'direction':_0x53bb2f[_0x9903('0xdd')]===_0x9903('0xf3')?'A':'C','secret':_0x53bb2f[_0x9903('0xde')],'read':_0x53bb2f[_0x9903('0x7f')],'attachment':_0x53bb2f[_0x9903('0xdc')]};})[_0x9903('0x5d')]()};return ejs[_0x9903('0xf5')](path['join'](config[_0x9903('0xd1')],'server',_0x9903('0xf6'),_0x9903('0xf7')),{'interaction':_0xdc79a})[_0x9903('0x28')](function(_0x165bd5){return new BPromise(function(_0x7994ac,_0x222f40){pdf['create'](_0x165bd5,_0x19518c)['toFile'](path[_0x9903('0xd5')](_0x37566a,_0x9903('0xf8')+_0x20919a['id']+'-'+_0x322ce6+_0x9903('0xf9')),function(_0x26b7d0,_0x4ce4dd){if(_0x26b7d0)return _0x222f40(_0x26b7d0);_0x7994ac(_0x4ce4dd);});});})[_0x9903('0x28')](function(){return new BPromise(function(_0x36c7c6,_0xb60318){zipdir(_0x37566a,{'saveTo':_0x40a723},function(_0x41e174,_0x315008){if(_0x41e174)return _0xb60318(_0x41e174);return _0x36c7c6(_0x315008);});})[_0x9903('0x28')](function(){return new BPromise(function(_0x126730,_0x6675f3){rimraf(_0x37566a,function(_0x19afd2){if(_0x19afd2)_0x6675f3(_0x19afd2);return _0x126730();});});})[_0x9903('0x28')](function(){return _0x29130b[_0x9903('0xfa')](_0x40a723,_0x544baa,function(_0x2ffca2){if(_0x2ffca2){console[_0x9903('0xfb')](_0x9903('0xfc'),_0x2ffca2);}else{fs[_0x9903('0xfd')](_0x40a723);}});});});}else{return _0x29130b['sendStatus'](0xc8);}})[_0x9903('0xb6')](handleError(_0x29130b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 462169d..eb97766 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 _0xbb45=['update','getUsers','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x57fae3,_0x5b0a60){var _0x439a3d=function(_0x2e8acb){while(--_0x2e8acb){_0x57fae3['push'](_0x57fae3['shift']());}};_0x439a3d(++_0x5b0a60);}(_0xbb45,0x16a));var _0x5bb4=function(_0x1385de,_0x4111c0){_0x1385de=_0x1385de-0x0;var _0x1c2e28=_0xbb45[_0x1385de];return _0x1c2e28;};'use strict';var EventEmitter=require(_0x5bb4('0x0'));var WhatsappInteraction=require(_0x5bb4('0x1'))['db'][_0x5bb4('0x2')];var WhatsappMessage=require(_0x5bb4('0x1'))['db'][_0x5bb4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5bb4('0x4')](0x0);var events={'afterCreate':_0x5bb4('0x5'),'afterUpdate':_0x5bb4('0x6'),'afterDestroy':'remove'};function emitEvent(_0xf01da0){return function(_0x69faf5,_0x3dafec,_0x32b766){_0x69faf5[_0x5bb4('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7fd39c){_0x69faf5['setDataValue'](_0x5bb4('0x8'),_0x7fd39c['map'](function(_0x5aceed){return{'id':_0x5aceed['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x69faf5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x180cc9){_0x69faf5[_0x5bb4('0x9')](_0x5bb4('0xa'),_0x180cc9[_0x5bb4('0xb')]);WhatsappInteractionEvents[_0x5bb4('0xc')](_0xf01da0+':'+_0x69faf5['id'],_0x69faf5);WhatsappInteractionEvents[_0x5bb4('0xc')](_0xf01da0,_0x69faf5);_0x32b766(null);})[_0x5bb4('0xd')](_0x32b766(null));};}for(var e in events){if(events[_0x5bb4('0xe')](e)){var event=events[e];WhatsappInteraction[_0x5bb4('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x17f5=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','map'];(function(_0x331ade,_0x149e32){var _0x495b12=function(_0xc28d12){while(--_0xc28d12){_0x331ade['push'](_0x331ade['shift']());}};_0x495b12(++_0x149e32);}(_0x17f5,0x156));var _0x517f=function(_0x5305d8,_0x2f6547){_0x5305d8=_0x5305d8-0x0;var _0xa80dfb=_0x17f5[_0x5305d8];return _0xa80dfb;};'use strict';var EventEmitter=require(_0x517f('0x0'));var WhatsappInteraction=require(_0x517f('0x1'))['db'][_0x517f('0x2')];var WhatsappMessage=require(_0x517f('0x1'))['db'][_0x517f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x517f('0x4')](0x0);var events={'afterCreate':_0x517f('0x5'),'afterUpdate':_0x517f('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4ca398){return function(_0x575563,_0x1a258e,_0x4cc27f){_0x575563['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5e576a){_0x575563['setDataValue']('Users',_0x5e576a[_0x517f('0x7')](function(_0x5a8be2){return{'id':_0x5a8be2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x575563['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd2122c){_0x575563[_0x517f('0x8')](_0x517f('0x9'),_0xd2122c[_0x517f('0xa')]);WhatsappInteractionEvents['emit'](_0x4ca398+':'+_0x575563['id'],_0x575563);WhatsappInteractionEvents[_0x517f('0xb')](_0x4ca398,_0x575563);_0x4cc27f(null);})[_0x517f('0xc')](_0x4cc27f(null));};}for(var e in events){if(events[_0x517f('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 05d894b..5086642 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 _0x9d4a=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x1fe011,_0x1ab550){var _0xd1bb67=function(_0x29c202){while(--_0x29c202){_0x1fe011['push'](_0x1fe011['shift']());}};_0xd1bb67(++_0x1ab550);}(_0x9d4a,0x16f));var _0xa9d4=function(_0x24d6ea,_0x1f57e9){_0x24d6ea=_0x24d6ea-0x0;var _0x2ee3a3=_0x9d4a[_0x24d6ea];return _0x2ee3a3;};'use strict';var _=require(_0xa9d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa9d4('0x1'));var moment=require(_0xa9d4('0x2'));var BPromise=require(_0xa9d4('0x3'));var rp=require(_0xa9d4('0x4'));var fs=require('fs');var path=require(_0xa9d4('0x5'));var rimraf=require(_0xa9d4('0x6'));var config=require(_0xa9d4('0x7'));var attributes=require(_0xa9d4('0x8'));module[_0xa9d4('0x9')]=function(_0xb1cde,_0x386c6d){return _0xb1cde[_0xa9d4('0xa')](_0xa9d4('0xb'),attributes,{'tableName':_0xa9d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x66de22,_0x4239b5,_0x441548){if(_0x66de22[_0xa9d4('0xd')](_0xa9d4('0xe'))){_0x66de22[_0xa9d4('0xf')]=moment()[_0xa9d4('0x10')](_0xa9d4('0x11'));}_0x441548(null,_0x66de22);}}});}; \ No newline at end of file +var _0xb3e8=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','closedAt','format'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xb3e8,0x1a5));var _0x8b3e=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0xb3e8[_0x46ec32];return _0x338f60;};'use strict';var _=require('lodash');var util=require(_0x8b3e('0x0'));var logger=require(_0x8b3e('0x1'))(_0x8b3e('0x2'));var moment=require(_0x8b3e('0x3'));var BPromise=require(_0x8b3e('0x4'));var rp=require(_0x8b3e('0x5'));var fs=require('fs');var path=require(_0x8b3e('0x6'));var rimraf=require('rimraf');var config=require(_0x8b3e('0x7'));var attributes=require(_0x8b3e('0x8'));module[_0x8b3e('0x9')]=function(_0x5a5459,_0x49673f){return _0x5a5459[_0x8b3e('0xa')](_0x8b3e('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x255f45,_0x394655,_0x55dea6){if(_0x255f45['changed']('closed')){_0x255f45[_0x8b3e('0xc')]=moment()[_0x8b3e('0xd')](_0x8b3e('0xe'));}_0x55dea6(null,_0x255f45);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7dc8607..1d62903 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 _0x4cac=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','update','body','options','raw','where','attributes','UpdateWhatsappInteraction','omit','ids','AddTags','lodash','util'];(function(_0x5ce498,_0x5a6678){var _0x5c3537=function(_0x3617db){while(--_0x3617db){_0x5ce498['push'](_0x5ce498['shift']());}};_0x5c3537(++_0x5a6678);}(_0x4cac,0x15d));var _0xc4ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4cac[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc4ca('0x0'));var util=require(_0xc4ca('0x1'));var moment=require(_0xc4ca('0x2'));var BPromise=require(_0xc4ca('0x3'));var rs=require(_0xc4ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4ca('0x6'))(_0xc4ca('0x7'));var config=require(_0xc4ca('0x8'));var jayson=require(_0xc4ca('0x9'));var client=jayson['client'][_0xc4ca('0xa')]({'port':0x232a});config[_0xc4ca('0xb')]=_[_0xc4ca('0xc')](config[_0xc4ca('0xb')],{'host':_0xc4ca('0xd'),'port':0x18eb});var socket=require(_0xc4ca('0xe'))(new Redis(config[_0xc4ca('0xb')]));require('./whatsappInteraction.socket')[_0xc4ca('0xf')](socket);function respondWithRpcPromise(_0x1c75aa,_0x410269,_0x336a45){return new BPromise(function(_0x4cd46d,_0x451eb2){return client[_0xc4ca('0x10')](_0x1c75aa,_0x336a45)[_0xc4ca('0x11')](function(_0xca659b){logger[_0xc4ca('0x12')](_0xc4ca('0x13'),_0x410269,'request\x20sent');logger[_0xc4ca('0x14')](_0xc4ca('0x15'),_0x410269,'request\x20sent',JSON[_0xc4ca('0x16')](_0xca659b));if(_0xca659b[_0xc4ca('0x17')]){if(_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x18')]===0x1f4){logger['error'](_0xc4ca('0x13'),_0x410269,_0xca659b['error'][_0xc4ca('0x19')]);return _0x451eb2(_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x19')]);}logger[_0xc4ca('0x17')](_0xc4ca('0x13'),_0x410269,_0xca659b[_0xc4ca('0x17')][_0xc4ca('0x19')]);return _0x4cd46d(_0xca659b['error'][_0xc4ca('0x19')]);}else{logger[_0xc4ca('0x12')](_0xc4ca('0x13'),_0x410269,_0xc4ca('0x1a'));_0x4cd46d(_0xca659b[_0xc4ca('0x1b')][_0xc4ca('0x19')]);}})[_0xc4ca('0x1c')](function(_0x2dc826){logger['error'](_0xc4ca('0x13'),_0x410269,_0x2dc826);_0x451eb2(_0x2dc826);});});}exports['UpdateWhatsappInteraction']=function(_0x240fe5){var _0x3ff0aa=this;return new Promise(function(_0x178419,_0x57ed7e){return db['WhatsappInteraction'][_0xc4ca('0x1d')](_0x240fe5[_0xc4ca('0x1e')],{'raw':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5['options'][_0xc4ca('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5['options'][_0xc4ca('0x21')]||null:null,'attributes':_0x240fe5['options']?_0x240fe5[_0xc4ca('0x1f')][_0xc4ca('0x22')]||null:null,'limit':_0x240fe5[_0xc4ca('0x1f')]?_0x240fe5[_0xc4ca('0x1f')]['limit']||null:null})[_0xc4ca('0x11')](function(_0x552d0e){logger['info'](_0xc4ca('0x23'),_0x240fe5);logger[_0xc4ca('0x14')](_0xc4ca('0x23'),_0x240fe5,JSON['stringify'](_0x552d0e));_0x178419(_0x552d0e);})['catch'](function(_0x4f1b72){logger[_0xc4ca('0x17')](_0xc4ca('0x23'),_0x4f1b72[_0xc4ca('0x19')],_0x240fe5);_0x57ed7e(_0x3ff0aa[_0xc4ca('0x17')](0x1f4,_0x4f1b72[_0xc4ca('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4d7026){return new Promise(function(_0x1b46bf,_0x212e23){return db['WhatsappInteraction']['find']({'where':_0x4d7026[_0xc4ca('0x1f')]?_0x4d7026['options'][_0xc4ca('0x21')]||null:null})[_0xc4ca('0x11')](function(_0x1f0906){if(_0x1f0906){return _0x1f0906['addTags'](_0x4d7026[_0xc4ca('0x1e')]['ids'],_[_0xc4ca('0x24')](_0x4d7026['body'],[_0xc4ca('0x25'),'id'])||{});}})['spread'](function(_0x4087a2){logger[_0xc4ca('0x12')](_0xc4ca('0x26'),_0x4d7026);logger[_0xc4ca('0x14')](_0xc4ca('0x26'),_0x4d7026,JSON['stringify'](_0x4087a2));_0x1b46bf(_0x4087a2);})[_0xc4ca('0x1c')](function(_0x3c22b3){logger[_0xc4ca('0x17')](_0xc4ca('0x26'),_0x3c22b3[_0xc4ca('0x19')],_0x4d7026);_0x212e23(_this[_0xc4ca('0x17')](0x1f4,_0x3c22b3[_0xc4ca('0x19')]));});});}; \ No newline at end of file +var _0x1fd0=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','catch','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5c5e13,_0x4d8d53){var _0x5144d2=function(_0x3345a6){while(--_0x3345a6){_0x5c5e13['push'](_0x5c5e13['shift']());}};_0x5144d2(++_0x4d8d53);}(_0x1fd0,0x139));var _0x01fd=function(_0x18dadd,_0x31a4b6){_0x18dadd=_0x18dadd-0x0;var _0x4c2846=_0x1fd0[_0x18dadd];return _0x4c2846;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var moment=require('moment');var BPromise=require(_0x01fd('0x2'));var rs=require(_0x01fd('0x3'));var fs=require('fs');var Redis=require(_0x01fd('0x4'));var db=require(_0x01fd('0x5'))['db'];var utils=require(_0x01fd('0x6'));var logger=require(_0x01fd('0x7'))(_0x01fd('0x8'));var config=require(_0x01fd('0x9'));var jayson=require(_0x01fd('0xa'));var client=jayson[_0x01fd('0xb')]['http']({'port':0x232a});config[_0x01fd('0xc')]=_['defaults'](config[_0x01fd('0xc')],{'host':_0x01fd('0xd'),'port':0x18eb});var socket=require(_0x01fd('0xe'))(new Redis(config[_0x01fd('0xc')]));require(_0x01fd('0xf'))[_0x01fd('0x10')](socket);function respondWithRpcPromise(_0x378107,_0x41d0b9,_0x1b9407){return new BPromise(function(_0x5167fa,_0x53110a){return client[_0x01fd('0x11')](_0x378107,_0x1b9407)['then'](function(_0x3f83ef){logger[_0x01fd('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x41d0b9,'request\x20sent');logger[_0x01fd('0x13')](_0x01fd('0x14'),_0x41d0b9,_0x01fd('0x15'),JSON[_0x01fd('0x16')](_0x3f83ef));if(_0x3f83ef[_0x01fd('0x17')]){if(_0x3f83ef['error'][_0x01fd('0x18')]===0x1f4){logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);return _0x53110a(_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);}logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);return _0x5167fa(_0x3f83ef[_0x01fd('0x17')]['message']);}else{logger[_0x01fd('0x12')](_0x01fd('0x19'),_0x41d0b9,'request\x20sent');_0x5167fa(_0x3f83ef[_0x01fd('0x1b')][_0x01fd('0x1a')]);}})['catch'](function(_0x56ef1c){logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x56ef1c);_0x53110a(_0x56ef1c);});});}exports[_0x01fd('0x1c')]=function(_0x39657e){var _0x350b0b=this;return new Promise(function(_0x922e67,_0x1ea539){return db[_0x01fd('0x1d')][_0x01fd('0x1e')](_0x39657e[_0x01fd('0x1f')],{'raw':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x22')]||null:null,'attributes':_0x39657e['options']?_0x39657e[_0x01fd('0x20')][_0x01fd('0x23')]||null:null,'limit':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x24')]||null:null})[_0x01fd('0x25')](function(_0x1a063a){logger[_0x01fd('0x12')]('UpdateWhatsappInteraction',_0x39657e);logger['debug'](_0x01fd('0x1c'),_0x39657e,JSON[_0x01fd('0x16')](_0x1a063a));_0x922e67(_0x1a063a);})[_0x01fd('0x26')](function(_0x5b9c43){logger[_0x01fd('0x17')](_0x01fd('0x1c'),_0x5b9c43[_0x01fd('0x1a')],_0x39657e);_0x1ea539(_0x350b0b[_0x01fd('0x17')](0x1f4,_0x5b9c43['message']));});});};exports[_0x01fd('0x27')]=function(_0x520ef8){return new Promise(function(_0x2701e9,_0x41e48c){return db[_0x01fd('0x1d')][_0x01fd('0x28')]({'where':_0x520ef8['options']?_0x520ef8['options']['where']||null:null})[_0x01fd('0x25')](function(_0x245d0c){if(_0x245d0c){return _0x245d0c[_0x01fd('0x29')](_0x520ef8['body'][_0x01fd('0x2a')],_[_0x01fd('0x2b')](_0x520ef8[_0x01fd('0x1f')],['ids','id'])||{});}})[_0x01fd('0x2c')](function(_0x3a21ae){logger[_0x01fd('0x12')](_0x01fd('0x2d'),_0x520ef8);logger[_0x01fd('0x13')](_0x01fd('0x2d'),_0x520ef8,JSON[_0x01fd('0x16')](_0x3a21ae));_0x2701e9(_0x3a21ae);})[_0x01fd('0x26')](function(_0x6812f1){logger[_0x01fd('0x17')](_0x01fd('0x2d'),_0x6812f1[_0x01fd('0x1a')],_0x520ef8);_0x41e48c(_this[_0x01fd('0x17')](0x1f4,_0x6812f1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 75c7b33..554056b 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 _0xec80=['./whatsappInteraction.events','remove','emit','removeListener','length','whatsappInteraction:'];(function(_0x5ba72b,_0x2857bf){var _0x5d9386=function(_0x193bdf){while(--_0x193bdf){_0x5ba72b['push'](_0x5ba72b['shift']());}};_0x5d9386(++_0x2857bf);}(_0xec80,0x1bc));var _0x0ec8=function(_0xd6bb26,_0x63ff2){_0xd6bb26=_0xd6bb26-0x0;var _0x122866=_0xec80[_0xd6bb26];return _0x122866;};'use strict';var WhatsappInteractionEvents=require(_0x0ec8('0x0'));var events=['save',_0x0ec8('0x1'),'update'];function createListener(_0x4d84d0,_0x971710){return function(_0x84c34c){_0x971710[_0x0ec8('0x2')](_0x4d84d0,_0x84c34c);};}function removeListener(_0x5ed93d,_0x285529){return function(){WhatsappInteractionEvents[_0x0ec8('0x3')](_0x5ed93d,_0x285529);};}exports['register']=function(_0x401cc4){for(var _0x551740=0x0,_0x763fe6=events[_0x0ec8('0x4')];_0x551740<_0x763fe6;_0x551740++){var _0x284634=events[_0x551740];var _0x2814c6=createListener(_0x0ec8('0x5')+_0x284634,_0x401cc4);WhatsappInteractionEvents['on'](_0x284634,_0x2814c6);}}; \ No newline at end of file +var _0xd78a=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','removeListener'];(function(_0x2fa06e,_0x228d80){var _0x2df3f2=function(_0xee7f60){while(--_0xee7f60){_0x2fa06e['push'](_0x2fa06e['shift']());}};_0x2df3f2(++_0x228d80);}(_0xd78a,0x158));var _0xad78=function(_0x2118bf,_0x21eea6){_0x2118bf=_0x2118bf-0x0;var _0x2beaca=_0xd78a[_0x2118bf];return _0x2beaca;};'use strict';var WhatsappInteractionEvents=require(_0xad78('0x0'));var events=['save',_0xad78('0x1'),_0xad78('0x2')];function createListener(_0x33d10d,_0x56bb88){return function(_0x34e4a6){_0x56bb88['emit'](_0x33d10d,_0x34e4a6);};}function removeListener(_0x4ad7e9,_0x1b737c){return function(){WhatsappInteractionEvents[_0xad78('0x3')](_0x4ad7e9,_0x1b737c);};}exports['register']=function(_0x44d1f9){for(var _0x5f28e7=0x0,_0x289cc6=events[_0xad78('0x4')];_0x5f28e7<_0x289cc6;_0x5f28e7++){var _0x4a5a74=events[_0x5f28e7];var _0x45c88c=createListener(_0xad78('0x5')+_0x4a5a74,_0x44d1f9);WhatsappInteractionEvents['on'](_0x4a5a74,_0x45c88c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ec3c220..3cbf9a6 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 _0x163c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','whatsapp','whatsappmessage:create','create','status','put','accept','/:id/reject','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2b9448,_0x33e0f2){var _0xfaf5ab=function(_0x4de537){while(--_0x4de537){_0x2b9448['push'](_0x2b9448['shift']());}};_0xfaf5ab(++_0x33e0f2);}(_0x163c,0x121));var _0xc163=function(_0xf2d87,_0x2808a2){_0xf2d87=_0xf2d87-0x0;var _0x5a08f9=_0x163c[_0xf2d87];return _0x5a08f9;};'use strict';var multer=require('multer');var util=require(_0xc163('0x0'));var path=require(_0xc163('0x1'));var timeout=require(_0xc163('0x2'));var express=require(_0xc163('0x3'));var router=express['Router']();var auth=require(_0xc163('0x4'));var interaction=require(_0xc163('0x5'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xc163('0x6')]('/',auth[_0xc163('0x7')](),controller[_0xc163('0x8')]);router[_0xc163('0x6')](_0xc163('0x9'),auth['isAuthenticated'](),controller[_0xc163('0xa')]);router[_0xc163('0x6')](_0xc163('0xb'),auth[_0xc163('0x7')](),controller['show']);router[_0xc163('0xc')]('/',auth[_0xc163('0x7')](),interaction['tracked'](_0xc163('0xd'),_0xc163('0xe')),controller[_0xc163('0xf')]);router[_0xc163('0xc')]('/:id/status',controller[_0xc163('0x10')]);router['put']('/:id',auth[_0xc163('0x7')](),controller['update']);router[_0xc163('0x11')]('/:id/accept',auth[_0xc163('0x7')](),controller[_0xc163('0x12')]);router[_0xc163('0x11')](_0xc163('0x13'),auth[_0xc163('0x7')](),controller['reject']);router['delete'](_0xc163('0xb'),auth[_0xc163('0x7')](),controller['destroy']);module[_0xc163('0x14')]=router; \ No newline at end of file +var _0x7075=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','show','tracked','whatsapp','whatsappmessage:create','/:id/status','status','/:id','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7075,0x178));var _0x5707=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7075[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x5707('0x0'));var util=require(_0x5707('0x1'));var path=require(_0x5707('0x2'));var timeout=require(_0x5707('0x3'));var express=require(_0x5707('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5707('0x5'));var config=require(_0x5707('0x6'));var controller=require(_0x5707('0x7'));router['get']('/',auth[_0x5707('0x8')](),controller['index']);router[_0x5707('0x9')](_0x5707('0xa'),auth[_0x5707('0x8')](),controller['describe']);router[_0x5707('0x9')]('/:id',auth[_0x5707('0x8')](),controller[_0x5707('0xb')]);router['post']('/',auth[_0x5707('0x8')](),interaction[_0x5707('0xc')](_0x5707('0xd'),_0x5707('0xe')),controller['create']);router['post'](_0x5707('0xf'),controller[_0x5707('0x10')]);router['put'](_0x5707('0x11'),auth['isAuthenticated'](),controller[_0x5707('0x12')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x5707('0x13')]);router['put'](_0x5707('0x14'),auth[_0x5707('0x8')](),controller[_0x5707('0x15')]);router[_0x5707('0x16')](_0x5707('0x11'),auth[_0x5707('0x8')](),controller[_0x5707('0x17')]);module[_0x5707('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 31f527b..78c2ccc 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 _0xb148=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3366da,_0x4d2c3d){var _0x2407f6=function(_0x380629){while(--_0x380629){_0x3366da['push'](_0x3366da['shift']());}};_0x2407f6(++_0x4d2c3d);}(_0xb148,0x93));var _0x8b14=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xb148[_0x3de7e0];return _0x11d0b3;};'use strict';var Sequelize=require(_0x8b14('0x0'));module[_0x8b14('0x1')]={'body':{'type':Sequelize[_0x8b14('0x2')](_0x8b14('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8b14('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b14('0x5')]('in',_0x8b14('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x8b14('0x7')]},'readAt':{'type':Sequelize[_0x8b14('0x8')]},'secret':{'type':Sequelize[_0x8b14('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb67f=['ENUM','out','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb67f,0xb2));var _0xfb67=function(_0x28b1ff,_0x5ae328){_0x28b1ff=_0x28b1ff-0x0;var _0x4b5834=_0xb67f[_0x28b1ff];return _0x4b5834;};'use strict';var Sequelize=require('sequelize');module[_0xfb67('0x0')]={'body':{'type':Sequelize[_0xfb67('0x1')](_0xfb67('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfb67('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfb67('0x4')]('in',_0xfb67('0x5')),'defaultValue':_0xfb67('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfb67('0x6')](0xbe)},'phone':{'type':Sequelize[_0xfb67('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xfb67('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfb67('0x6')]},'providerResponse':{'type':Sequelize[_0xfb67('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ab94317..b04209c 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 _0x14a0=['RejectMessage','rejectMessage','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','WhatsappInteractionId','UserId','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x14a0,0x8e));var _0x014a=function(_0x2aa587,_0x4b26e0){_0x2aa587=_0x2aa587-0x0;var _0x56a953=_0x14a0[_0x2aa587];return _0x56a953;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);var jayson=require(_0x014a('0x1a'));var client=jayson['client'][_0x014a('0x1b')]({'port':0x232c});var client9002=jayson[_0x014a('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a836f,_0x128c46,_0x59a4ea,_0x16e6fc){return new BPromise(function(_0x17e4be,_0x20f148){var _0x12da95=_0x16e6fc||client;return _0x12da95[_0x014a('0x1d')](_0x3a836f,_0x59a4ea)[_0x014a('0x1e')](function(_0x61ec9f){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x128c46,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x61ec9f));if(_0x61ec9f['error']){if(_0x61ec9f[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')](_0x014a('0x20'),_0x128c46,_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);return _0x20f148(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x128c46,_0x61ec9f[_0x014a('0x25')]['message']);return _0x17e4be(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));_0x17e4be(_0x61ec9f[_0x014a('0x28')][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x165a42){logger['error'](_0x014a('0x20'),_0x128c46,_0x165a42);_0x20f148(_0x165a42);});});}function respondWithStatusCode(_0x5358e9,_0x39a432){_0x39a432=_0x39a432||0xcc;return function(_0x28701e){if(_0x28701e){return _0x5358e9['sendStatus'](_0x39a432);}return _0x5358e9['status'](_0x39a432)[_0x014a('0x2a')]();};}function respondWithResult(_0x3f9719,_0x143346){_0x143346=_0x143346||0xc8;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2b')](_0x143346)[_0x014a('0x2c')](_0x5ed71b);}};}function respondWithFilteredResult(_0x598179,_0x31dc95){return function(_0x2560a6){if(_0x2560a6){var _0x496040=_0x2560a6[_0x014a('0x2d')],_0x4f9c1c=_0x31dc95[_0x014a('0x2e')],_0x397850=_0x31dc95['offset']+_0x31dc95[_0x014a('0x2f')],_0x3e5a0a;if(_0x397850>=_0x496040){_0x397850=_0x496040;_0x3e5a0a=0xc8;}else{_0x3e5a0a=0xce;}_0x598179[_0x014a('0x2b')](_0x3e5a0a);return _0x598179[_0x014a('0x30')](_0x014a('0x31'),_0x4f9c1c+'-'+_0x397850+'/'+_0x496040)[_0x014a('0x2c')](_0x2560a6);}return null;};}function patchUpdates(_0x1eb007){return function(_0x354f4c){try{jsonpatch[_0x014a('0x32')](_0x354f4c,_0x1eb007,!![]);}catch(_0xc802d5){return BPromise[_0x014a('0x33')](_0xc802d5);}return _0x354f4c[_0x014a('0x34')]();};}function saveUpdates(_0x4ed54e,_0x105d4a){return function(_0x41ead8){if(_0x41ead8){return _0x41ead8[_0x014a('0x35')](_0x4ed54e)[_0x014a('0x1e')](function(_0x5f1022){return _0x5f1022;});}return null;};}function removeEntity(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x36')]()[_0x014a('0x1e')](function(){_0x39b3b8['status'](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x12de94,_0x40738f){return function(_0x467032){if(!_0x467032){_0x12de94[_0x014a('0x37')](0x194);}return _0x467032;};}function handleError(_0xa8fcfb,_0x26a5e8){_0x26a5e8=_0x26a5e8||0x1f4;return function(_0x1cff0f){logger['error'](_0x1cff0f[_0x014a('0x38')]);if(_0x1cff0f[_0x014a('0x39')]){delete _0x1cff0f[_0x014a('0x39')];}_0xa8fcfb[_0x014a('0x2b')](_0x26a5e8)['send'](_0x1cff0f);};}exports[_0x014a('0x3a')]=function(_0x978870,_0x27ee0c){var _0x157bd0={},_0x35e527={},_0x309925={'count':0x0,'rows':[]};var _0x128fb9=_[_0x014a('0x3b')](db[_0x014a('0x3c')]['rawAttributes'],function(_0x1b34f8){return{'name':_0x1b34f8['fieldName'],'type':_0x1b34f8[_0x014a('0x3d')][_0x014a('0x3e')]};});_0x35e527[_0x014a('0x3f')]=_[_0x014a('0x3b')](_0x128fb9,_0x014a('0x39'));_0x35e527['query']=_[_0x014a('0x40')](_0x978870[_0x014a('0x41')]);_0x35e527['filters']=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],_0x35e527[_0x014a('0x41')]);_0x157bd0[_0x014a('0x43')]=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x978870[_0x014a('0x41')][_0x014a('0x44')]));_0x157bd0['attributes']=_0x157bd0[_0x014a('0x43')][_0x014a('0x45')]?_0x157bd0[_0x014a('0x43')]:_0x35e527[_0x014a('0x3f')];if(!_0x978870['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x157bd0[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x978870[_0x014a('0x41')][_0x014a('0x2f')]);_0x157bd0['offset']=qs[_0x014a('0x2e')](_0x978870[_0x014a('0x41')]['offset']);}_0x157bd0[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x978870[_0x014a('0x41')]['sort']);_0x157bd0[_0x014a('0x4a')]=qs['filters'](_['pick'](_0x978870[_0x014a('0x41')],_0x35e527[_0x014a('0x4b')]),_0x128fb9);if(_0x978870['query'][_0x014a('0x4c')]){_0x157bd0[_0x014a('0x4a')]=_[_0x014a('0x4d')](_0x157bd0[_0x014a('0x4a')],{'$or':_[_0x014a('0x3b')](_0x128fb9,function(_0xbaf8c6){if(_0xbaf8c6['type']!==_0x014a('0x4e')){var _0xb0d8e0={};_0xb0d8e0[_0xbaf8c6[_0x014a('0x39')]]={'$like':'%'+_0x978870['query']['filter']+'%'};return _0xb0d8e0;}})});}_0x157bd0=_[_0x014a('0x4d')]({},_0x157bd0,_0x978870['options']);var _0x489590={'where':_0x157bd0[_0x014a('0x4a')]};return db['WhatsappMessage'][_0x014a('0x2d')](_0x489590)[_0x014a('0x1e')](function(_0x36372d){_0x309925['count']=_0x36372d;if(_0x978870[_0x014a('0x41')][_0x014a('0x4f')]){_0x157bd0[_0x014a('0x50')]=[{'all':!![]}];}return db[_0x014a('0x3c')][_0x014a('0x51')](_0x157bd0);})[_0x014a('0x1e')](function(_0x559954){_0x309925[_0x014a('0x52')]=_0x559954;return _0x309925;})[_0x014a('0x1e')](respondWithFilteredResult(_0x27ee0c,_0x157bd0))['catch'](handleError(_0x27ee0c,null));};exports[_0x014a('0x53')]=function(_0x29345b,_0x20bb0c){var _0x324df7={'raw':!![],'where':{'id':_0x29345b[_0x014a('0x54')]['id']}},_0x40a9c1={};_0x40a9c1[_0x014a('0x3f')]=_[_0x014a('0x40')](db['WhatsappMessage'][_0x014a('0x55')]);_0x40a9c1[_0x014a('0x41')]=_[_0x014a('0x40')](_0x29345b[_0x014a('0x41')]);_0x40a9c1[_0x014a('0x4b')]=_['intersection'](_0x40a9c1[_0x014a('0x3f')],_0x40a9c1['query']);_0x324df7[_0x014a('0x43')]=_[_0x014a('0x42')](_0x40a9c1[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x29345b[_0x014a('0x41')]['fields']));_0x324df7['attributes']=_0x324df7['attributes']['length']?_0x324df7[_0x014a('0x43')]:_0x40a9c1['model'];if(_0x29345b[_0x014a('0x41')]['includeAll']){_0x324df7['include']=[{'all':!![]}];}_0x324df7=_[_0x014a('0x4d')]({},_0x324df7,_0x29345b['options']);return db[_0x014a('0x3c')][_0x014a('0x56')](_0x324df7)[_0x014a('0x1e')](handleEntityNotFound(_0x20bb0c,null))[_0x014a('0x1e')](respondWithResult(_0x20bb0c,null))[_0x014a('0x29')](handleError(_0x20bb0c,null));};exports[_0x014a('0x57')]=function(_0x35a421,_0x46fa9d){return db[_0x014a('0x3c')][_0x014a('0x57')](_0x35a421['body'],{})['then'](respondWithResult(_0x46fa9d,0xc9))[_0x014a('0x29')](handleError(_0x46fa9d,null));};exports[_0x014a('0x35')]=function(_0x237345,_0x4cc246){if(_0x237345['body']['id']){delete _0x237345[_0x014a('0x58')]['id'];}return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x237345[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x1e')](saveUpdates(_0x237345['body'],null))[_0x014a('0x1e')](respondWithResult(_0x4cc246,null))[_0x014a('0x29')](handleError(_0x4cc246,null));};exports[_0x014a('0x36')]=function(_0x56c09b,_0xbaeb5f){return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x56c09b[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0xbaeb5f,null))[_0x014a('0x1e')](removeEntity(_0xbaeb5f,null))[_0x014a('0x29')](handleError(_0xbaeb5f,null));};exports[_0x014a('0x59')]=function(_0x4e9260,_0x889080){return db[_0x014a('0x3c')][_0x014a('0x59')]()['then'](respondWithResult(_0x889080,null))[_0x014a('0x29')](handleError(_0x889080,null));};var interaction_log=require(_0x014a('0xf'))(_0x014a('0x5a'));exports[_0x014a('0x5b')]=function(_0x11bf5c,_0x5da1f7,_0x8ac9cd){var _0x46168d={'channel':_0x014a('0x5c')};if(_0x11bf5c[_0x014a('0x58')]['id']){delete _0x11bf5c[_0x014a('0x58')]['id'];}_0x11bf5c[_0x014a('0x58')][_0x014a('0x5d')]=!![];_0x11bf5c[_0x014a('0x58')][_0x014a('0x5e')]=moment()[_0x014a('0x5f')](_0x014a('0x60'));_0x11bf5c[_0x014a('0x58')]['UserId']=_0x11bf5c[_0x014a('0x58')]['UserId']||_0x11bf5c['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x11bf5c['params']['id'],'UserId':null},'include':[{'model':db[_0x014a('0x61')],'as':_0x014a('0x62')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))['then'](saveUpdates(_0x11bf5c[_0x014a('0x58')],null))[_0x014a('0x1e')](function(_0x3071c8){if(_0x3071c8){_0x46168d[_0x014a('0x27')]=_0x3071c8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x014a('0x56')]({'where':{'id':_0x3071c8[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))[_0x014a('0x1e')](function(_0x34c0b2){if(_0x34c0b2){return _0x34c0b2[_0x014a('0x35')]({'UserId':_0x11bf5c[_0x014a('0x58')][_0x014a('0x64')],'read1stAt':_[_0x014a('0x65')](_0x34c0b2[_0x014a('0x66')])?moment()[_0x014a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x014a('0x1e')](function(_0x25a53b){if(_0x25a53b){_0x46168d['interaction']=_0x25a53b[_0x014a('0x67')]({'plain':!![]});interaction_log[_0x014a('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bf5c[_0x014a('0x68')]['id'],_0x11bf5c['user'][_0x014a('0x39')],_0x11bf5c[_0x014a('0x68')][_0x014a('0x69')],_0x46168d[_0x014a('0x6a')]['id'],_0x11bf5c[_0x014a('0x58')]?JSON['stringify'](_0x11bf5c[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x6c'),_0x014a('0x6d'),_0x46168d);}return null;})[_0x014a('0x1e')](function(_0x52e79e){if(_0x52e79e){if(_0x11bf5c[_0x014a('0x58')][_0x014a('0x6e')]){_0x46168d[_0x014a('0x27')]['interface']=util[_0x014a('0x5f')]('SIP/%s',_0x11bf5c[_0x014a('0x68')][_0x014a('0x39')]);_0x46168d[_0x014a('0x27')][_0x014a('0x6f')]=_0x46168d[_0x014a('0x6f')];_0x46168d[_0x014a('0x27')][_0x014a('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x014a('0x71'),{'event':'acceptmessage','message':_0x46168d[_0x014a('0x27')]},client9002)['then'](function(){return _0x46168d;});}return _0x46168d;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5da1f7,null))[_0x014a('0x29')](handleError(_0x5da1f7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x014a('0x33')]=function(_0x8234ee,_0x5f391d,_0x882fc9){var _0x42e4e9={'agent':{},'channel':'whatsapp'};if(_0x8234ee['body']['id']){delete _0x8234ee[_0x014a('0x58')]['id'];}_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]=_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]||_0x8234ee[_0x014a('0x68')]['id'];_0x42e4e9['agent']['id']=_0x8234ee[_0x014a('0x58')]['UserId'];return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x8234ee[_0x014a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x43165e){if(_0x43165e){_0x42e4e9[_0x014a('0x27')]=_0x43165e[_0x014a('0x67')]({'plain':!![]});return db[_0x014a('0x72')]['find']({'where':{'id':_0x43165e[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x163fa2){if(_0x163fa2){_0x42e4e9['interaction']=_0x163fa2[_0x014a('0x67')]({'plain':!![]});interaction_log['info'](_0x014a('0x73'),_0x8234ee[_0x014a('0x68')]['id'],_0x8234ee[_0x014a('0x68')][_0x014a('0x39')],_0x8234ee[_0x014a('0x68')][_0x014a('0x69')],_0x42e4e9['interaction']['id'],_0x8234ee[_0x014a('0x58')]?JSON[_0x014a('0x24')](_0x8234ee[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x74'),_0x014a('0x75'),_0x42e4e9);}return null;})[_0x014a('0x1e')](function(_0x28a8a9){if(_0x28a8a9){_0x28a8a9['message'][_0x014a('0x76')]=util[_0x014a('0x5f')](_0x014a('0x77'),_0x8234ee['user'][_0x014a('0x39')]);_0x28a8a9[_0x014a('0x27')][_0x014a('0x6f')]=_0x42e4e9[_0x014a('0x6f')];_0x28a8a9[_0x014a('0x27')][_0x014a('0x70')]=_0x014a('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28a8a9['message']},client9002);return _0x42e4e9;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5f391d,null))[_0x014a('0x29')](handleError(_0x5f391d,null));};exports[_0x014a('0x2b')]=function(_0x3804e1,_0xe1b5ed,_0x7cd599){if(_0x3804e1[_0x014a('0x58')]['id']){delete _0x3804e1['body']['id'];}var _0x24ffb0;return db[_0x014a('0x3c')][_0x014a('0x56')]({'where':{'id':_0x3804e1[_0x014a('0x54')]['id']}})['then'](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x13e2fc){if(_0x13e2fc){_0x24ffb0=_0x13e2fc;return db[_0x014a('0x78')]['find']({'where':{'id':_0x13e2fc['WhatsappAccountId']}});}})[_0x014a('0x1e')](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x5d4099){if(_0x5d4099){logger[_0x014a('0x22')](_0x014a('0x79'),'status',_0x014a('0x7a'),_0x5d4099[_0x014a('0x3d')],util[_0x014a('0x7b')](_0x3804e1[_0x014a('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d4099[_0x014a('0x3d')]){case _0x014a('0x7c'):if(_0x3804e1[_0x014a('0x58')][_0x014a('0x7d')]&&_0x3804e1['body']['MessageSid']===_0x24ffb0[_0x014a('0x7e')]&&_0x3804e1['body']['MessageStatus']&&_0x3804e1['body'][_0x014a('0x7f')]===_0x014a('0x5d')){return _0x24ffb0[_0x014a('0x35')]({'read':!![]});}else{logger['error'](_0x014a('0x80'),_0x014a('0x2b'),_0x014a('0x7c'),util[_0x014a('0x7b')](_0x3804e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x24ffb0;}})[_0x014a('0x1e')](respondWithResult(_0xe1b5ed,null))[_0x014a('0x29')](handleError(_0xe1b5ed,null));}; \ No newline at end of file +var _0x14a0=['RejectMessage','rejectMessage','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','WhatsappInteractionId','UserId','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0xaf52f9,_0x3608bc){var _0xd9e03e=function(_0xaf82d3){while(--_0xaf82d3){_0xaf52f9['push'](_0xaf52f9['shift']());}};_0xd9e03e(++_0x3608bc);}(_0x14a0,0x8e));var _0x014a=function(_0x308eb3,_0x4bc21b){_0x308eb3=_0x308eb3-0x0;var _0x2fbf0a=_0x14a0[_0x308eb3];return _0x2fbf0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);var jayson=require(_0x014a('0x1a'));var client=jayson['client'][_0x014a('0x1b')]({'port':0x232c});var client9002=jayson[_0x014a('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a836f,_0x128c46,_0x59a4ea,_0x16e6fc){return new BPromise(function(_0x17e4be,_0x20f148){var _0x12da95=_0x16e6fc||client;return _0x12da95[_0x014a('0x1d')](_0x3a836f,_0x59a4ea)[_0x014a('0x1e')](function(_0x61ec9f){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x128c46,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x61ec9f));if(_0x61ec9f['error']){if(_0x61ec9f[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')](_0x014a('0x20'),_0x128c46,_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);return _0x20f148(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x128c46,_0x61ec9f[_0x014a('0x25')]['message']);return _0x17e4be(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));_0x17e4be(_0x61ec9f[_0x014a('0x28')][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x165a42){logger['error'](_0x014a('0x20'),_0x128c46,_0x165a42);_0x20f148(_0x165a42);});});}function respondWithStatusCode(_0x5358e9,_0x39a432){_0x39a432=_0x39a432||0xcc;return function(_0x28701e){if(_0x28701e){return _0x5358e9['sendStatus'](_0x39a432);}return _0x5358e9['status'](_0x39a432)[_0x014a('0x2a')]();};}function respondWithResult(_0x3f9719,_0x143346){_0x143346=_0x143346||0xc8;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2b')](_0x143346)[_0x014a('0x2c')](_0x5ed71b);}};}function respondWithFilteredResult(_0x598179,_0x31dc95){return function(_0x2560a6){if(_0x2560a6){var _0x496040=_0x2560a6[_0x014a('0x2d')],_0x4f9c1c=_0x31dc95[_0x014a('0x2e')],_0x397850=_0x31dc95['offset']+_0x31dc95[_0x014a('0x2f')],_0x3e5a0a;if(_0x397850>=_0x496040){_0x397850=_0x496040;_0x3e5a0a=0xc8;}else{_0x3e5a0a=0xce;}_0x598179[_0x014a('0x2b')](_0x3e5a0a);return _0x598179[_0x014a('0x30')](_0x014a('0x31'),_0x4f9c1c+'-'+_0x397850+'/'+_0x496040)[_0x014a('0x2c')](_0x2560a6);}return null;};}function patchUpdates(_0x1eb007){return function(_0x354f4c){try{jsonpatch[_0x014a('0x32')](_0x354f4c,_0x1eb007,!![]);}catch(_0xc802d5){return BPromise[_0x014a('0x33')](_0xc802d5);}return _0x354f4c[_0x014a('0x34')]();};}function saveUpdates(_0x4ed54e,_0x105d4a){return function(_0x41ead8){if(_0x41ead8){return _0x41ead8[_0x014a('0x35')](_0x4ed54e)[_0x014a('0x1e')](function(_0x5f1022){return _0x5f1022;});}return null;};}function removeEntity(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x36')]()[_0x014a('0x1e')](function(){_0x39b3b8['status'](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x12de94,_0x40738f){return function(_0x467032){if(!_0x467032){_0x12de94[_0x014a('0x37')](0x194);}return _0x467032;};}function handleError(_0xa8fcfb,_0x26a5e8){_0x26a5e8=_0x26a5e8||0x1f4;return function(_0x1cff0f){logger['error'](_0x1cff0f[_0x014a('0x38')]);if(_0x1cff0f[_0x014a('0x39')]){delete _0x1cff0f[_0x014a('0x39')];}_0xa8fcfb[_0x014a('0x2b')](_0x26a5e8)['send'](_0x1cff0f);};}exports[_0x014a('0x3a')]=function(_0x978870,_0x27ee0c){var _0x157bd0={},_0x35e527={},_0x309925={'count':0x0,'rows':[]};var _0x128fb9=_[_0x014a('0x3b')](db[_0x014a('0x3c')]['rawAttributes'],function(_0x1b34f8){return{'name':_0x1b34f8['fieldName'],'type':_0x1b34f8[_0x014a('0x3d')][_0x014a('0x3e')]};});_0x35e527[_0x014a('0x3f')]=_[_0x014a('0x3b')](_0x128fb9,_0x014a('0x39'));_0x35e527['query']=_[_0x014a('0x40')](_0x978870[_0x014a('0x41')]);_0x35e527['filters']=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],_0x35e527[_0x014a('0x41')]);_0x157bd0[_0x014a('0x43')]=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x978870[_0x014a('0x41')][_0x014a('0x44')]));_0x157bd0['attributes']=_0x157bd0[_0x014a('0x43')][_0x014a('0x45')]?_0x157bd0[_0x014a('0x43')]:_0x35e527[_0x014a('0x3f')];if(!_0x978870['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x157bd0[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x978870[_0x014a('0x41')][_0x014a('0x2f')]);_0x157bd0['offset']=qs[_0x014a('0x2e')](_0x978870[_0x014a('0x41')]['offset']);}_0x157bd0[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x978870[_0x014a('0x41')]['sort']);_0x157bd0[_0x014a('0x4a')]=qs['filters'](_['pick'](_0x978870[_0x014a('0x41')],_0x35e527[_0x014a('0x4b')]),_0x128fb9);if(_0x978870['query'][_0x014a('0x4c')]){_0x157bd0[_0x014a('0x4a')]=_[_0x014a('0x4d')](_0x157bd0[_0x014a('0x4a')],{'$or':_[_0x014a('0x3b')](_0x128fb9,function(_0xbaf8c6){if(_0xbaf8c6['type']!==_0x014a('0x4e')){var _0xb0d8e0={};_0xb0d8e0[_0xbaf8c6[_0x014a('0x39')]]={'$like':'%'+_0x978870['query']['filter']+'%'};return _0xb0d8e0;}})});}_0x157bd0=_[_0x014a('0x4d')]({},_0x157bd0,_0x978870['options']);var _0x489590={'where':_0x157bd0[_0x014a('0x4a')]};return db['WhatsappMessage'][_0x014a('0x2d')](_0x489590)[_0x014a('0x1e')](function(_0x36372d){_0x309925['count']=_0x36372d;if(_0x978870[_0x014a('0x41')][_0x014a('0x4f')]){_0x157bd0[_0x014a('0x50')]=[{'all':!![]}];}return db[_0x014a('0x3c')][_0x014a('0x51')](_0x157bd0);})[_0x014a('0x1e')](function(_0x559954){_0x309925[_0x014a('0x52')]=_0x559954;return _0x309925;})[_0x014a('0x1e')](respondWithFilteredResult(_0x27ee0c,_0x157bd0))['catch'](handleError(_0x27ee0c,null));};exports[_0x014a('0x53')]=function(_0x29345b,_0x20bb0c){var _0x324df7={'raw':!![],'where':{'id':_0x29345b[_0x014a('0x54')]['id']}},_0x40a9c1={};_0x40a9c1[_0x014a('0x3f')]=_[_0x014a('0x40')](db['WhatsappMessage'][_0x014a('0x55')]);_0x40a9c1[_0x014a('0x41')]=_[_0x014a('0x40')](_0x29345b[_0x014a('0x41')]);_0x40a9c1[_0x014a('0x4b')]=_['intersection'](_0x40a9c1[_0x014a('0x3f')],_0x40a9c1['query']);_0x324df7[_0x014a('0x43')]=_[_0x014a('0x42')](_0x40a9c1[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x29345b[_0x014a('0x41')]['fields']));_0x324df7['attributes']=_0x324df7['attributes']['length']?_0x324df7[_0x014a('0x43')]:_0x40a9c1['model'];if(_0x29345b[_0x014a('0x41')]['includeAll']){_0x324df7['include']=[{'all':!![]}];}_0x324df7=_[_0x014a('0x4d')]({},_0x324df7,_0x29345b['options']);return db[_0x014a('0x3c')][_0x014a('0x56')](_0x324df7)[_0x014a('0x1e')](handleEntityNotFound(_0x20bb0c,null))[_0x014a('0x1e')](respondWithResult(_0x20bb0c,null))[_0x014a('0x29')](handleError(_0x20bb0c,null));};exports[_0x014a('0x57')]=function(_0x35a421,_0x46fa9d){return db[_0x014a('0x3c')][_0x014a('0x57')](_0x35a421['body'],{})['then'](respondWithResult(_0x46fa9d,0xc9))[_0x014a('0x29')](handleError(_0x46fa9d,null));};exports[_0x014a('0x35')]=function(_0x237345,_0x4cc246){if(_0x237345['body']['id']){delete _0x237345[_0x014a('0x58')]['id'];}return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x237345[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x1e')](saveUpdates(_0x237345['body'],null))[_0x014a('0x1e')](respondWithResult(_0x4cc246,null))[_0x014a('0x29')](handleError(_0x4cc246,null));};exports[_0x014a('0x36')]=function(_0x56c09b,_0xbaeb5f){return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x56c09b[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0xbaeb5f,null))[_0x014a('0x1e')](removeEntity(_0xbaeb5f,null))[_0x014a('0x29')](handleError(_0xbaeb5f,null));};exports[_0x014a('0x59')]=function(_0x4e9260,_0x889080){return db[_0x014a('0x3c')][_0x014a('0x59')]()['then'](respondWithResult(_0x889080,null))[_0x014a('0x29')](handleError(_0x889080,null));};var interaction_log=require(_0x014a('0xf'))(_0x014a('0x5a'));exports[_0x014a('0x5b')]=function(_0x11bf5c,_0x5da1f7,_0x8ac9cd){var _0x46168d={'channel':_0x014a('0x5c')};if(_0x11bf5c[_0x014a('0x58')]['id']){delete _0x11bf5c[_0x014a('0x58')]['id'];}_0x11bf5c[_0x014a('0x58')][_0x014a('0x5d')]=!![];_0x11bf5c[_0x014a('0x58')][_0x014a('0x5e')]=moment()[_0x014a('0x5f')](_0x014a('0x60'));_0x11bf5c[_0x014a('0x58')]['UserId']=_0x11bf5c[_0x014a('0x58')]['UserId']||_0x11bf5c['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x11bf5c['params']['id'],'UserId':null},'include':[{'model':db[_0x014a('0x61')],'as':_0x014a('0x62')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))['then'](saveUpdates(_0x11bf5c[_0x014a('0x58')],null))[_0x014a('0x1e')](function(_0x3071c8){if(_0x3071c8){_0x46168d[_0x014a('0x27')]=_0x3071c8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x014a('0x56')]({'where':{'id':_0x3071c8[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))[_0x014a('0x1e')](function(_0x34c0b2){if(_0x34c0b2){return _0x34c0b2[_0x014a('0x35')]({'UserId':_0x11bf5c[_0x014a('0x58')][_0x014a('0x64')],'read1stAt':_[_0x014a('0x65')](_0x34c0b2[_0x014a('0x66')])?moment()[_0x014a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x014a('0x1e')](function(_0x25a53b){if(_0x25a53b){_0x46168d['interaction']=_0x25a53b[_0x014a('0x67')]({'plain':!![]});interaction_log[_0x014a('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bf5c[_0x014a('0x68')]['id'],_0x11bf5c['user'][_0x014a('0x39')],_0x11bf5c[_0x014a('0x68')][_0x014a('0x69')],_0x46168d[_0x014a('0x6a')]['id'],_0x11bf5c[_0x014a('0x58')]?JSON['stringify'](_0x11bf5c[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x6c'),_0x014a('0x6d'),_0x46168d);}return null;})[_0x014a('0x1e')](function(_0x52e79e){if(_0x52e79e){if(_0x11bf5c[_0x014a('0x58')][_0x014a('0x6e')]){_0x46168d[_0x014a('0x27')]['interface']=util[_0x014a('0x5f')]('SIP/%s',_0x11bf5c[_0x014a('0x68')][_0x014a('0x39')]);_0x46168d[_0x014a('0x27')][_0x014a('0x6f')]=_0x46168d[_0x014a('0x6f')];_0x46168d[_0x014a('0x27')][_0x014a('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x014a('0x71'),{'event':'acceptmessage','message':_0x46168d[_0x014a('0x27')]},client9002)['then'](function(){return _0x46168d;});}return _0x46168d;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5da1f7,null))[_0x014a('0x29')](handleError(_0x5da1f7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x014a('0x33')]=function(_0x8234ee,_0x5f391d,_0x882fc9){var _0x42e4e9={'agent':{},'channel':'whatsapp'};if(_0x8234ee['body']['id']){delete _0x8234ee[_0x014a('0x58')]['id'];}_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]=_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]||_0x8234ee[_0x014a('0x68')]['id'];_0x42e4e9['agent']['id']=_0x8234ee[_0x014a('0x58')]['UserId'];return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x8234ee[_0x014a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x43165e){if(_0x43165e){_0x42e4e9[_0x014a('0x27')]=_0x43165e[_0x014a('0x67')]({'plain':!![]});return db[_0x014a('0x72')]['find']({'where':{'id':_0x43165e[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x163fa2){if(_0x163fa2){_0x42e4e9['interaction']=_0x163fa2[_0x014a('0x67')]({'plain':!![]});interaction_log['info'](_0x014a('0x73'),_0x8234ee[_0x014a('0x68')]['id'],_0x8234ee[_0x014a('0x68')][_0x014a('0x39')],_0x8234ee[_0x014a('0x68')][_0x014a('0x69')],_0x42e4e9['interaction']['id'],_0x8234ee[_0x014a('0x58')]?JSON[_0x014a('0x24')](_0x8234ee[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x74'),_0x014a('0x75'),_0x42e4e9);}return null;})[_0x014a('0x1e')](function(_0x28a8a9){if(_0x28a8a9){_0x28a8a9['message'][_0x014a('0x76')]=util[_0x014a('0x5f')](_0x014a('0x77'),_0x8234ee['user'][_0x014a('0x39')]);_0x28a8a9[_0x014a('0x27')][_0x014a('0x6f')]=_0x42e4e9[_0x014a('0x6f')];_0x28a8a9[_0x014a('0x27')][_0x014a('0x70')]=_0x014a('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28a8a9['message']},client9002);return _0x42e4e9;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5f391d,null))[_0x014a('0x29')](handleError(_0x5f391d,null));};exports[_0x014a('0x2b')]=function(_0x3804e1,_0xe1b5ed,_0x7cd599){if(_0x3804e1[_0x014a('0x58')]['id']){delete _0x3804e1['body']['id'];}var _0x24ffb0;return db[_0x014a('0x3c')][_0x014a('0x56')]({'where':{'id':_0x3804e1[_0x014a('0x54')]['id']}})['then'](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x13e2fc){if(_0x13e2fc){_0x24ffb0=_0x13e2fc;return db[_0x014a('0x78')]['find']({'where':{'id':_0x13e2fc['WhatsappAccountId']}});}})[_0x014a('0x1e')](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x5d4099){if(_0x5d4099){logger[_0x014a('0x22')](_0x014a('0x79'),'status',_0x014a('0x7a'),_0x5d4099[_0x014a('0x3d')],util[_0x014a('0x7b')](_0x3804e1[_0x014a('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d4099[_0x014a('0x3d')]){case _0x014a('0x7c'):if(_0x3804e1[_0x014a('0x58')][_0x014a('0x7d')]&&_0x3804e1['body']['MessageSid']===_0x24ffb0[_0x014a('0x7e')]&&_0x3804e1['body']['MessageStatus']&&_0x3804e1['body'][_0x014a('0x7f')]===_0x014a('0x5d')){return _0x24ffb0[_0x014a('0x35')]({'read':!![]});}else{logger['error'](_0x014a('0x80'),_0x014a('0x2b'),_0x014a('0x7c'),util[_0x014a('0x7b')](_0x3804e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x24ffb0;}})[_0x014a('0x1e')](respondWithResult(_0xe1b5ed,null))[_0x014a('0x29')](handleError(_0xe1b5ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 387deb0..ba2720d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x318849,_0x5d7a96){var _0x46c9f9=function(_0x37fdba){while(--_0x37fdba){_0x318849['push'](_0x318849['shift']());}};_0x46c9f9(++_0x5d7a96);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12e914,_0x247211){_0x12e914=_0x12e914-0x0;var _0x4de2a3=_0x5f2f[_0x12e914];return _0x4de2a3;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x1c0f7d,_0x3e659a){var _0x322cd5=function(_0x3007f7){while(--_0x3007f7){_0x1c0f7d['push'](_0x1c0f7d['shift']());}};_0x322cd5(++_0x3e659a);}(_0xb10b,0x12a));var _0xbb10=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xb10b[_0x350aeb];return _0x3c5273;};'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 de75218..95b1b5b 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 _0x4ab1=['secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','out'];(function(_0x2d18b4,_0x3eaf9a){var _0x596083=function(_0x23592b){while(--_0x23592b){_0x2d18b4['push'](_0x2d18b4['shift']());}};_0x596083(++_0x3eaf9a);}(_0x4ab1,0x120));var _0x14ab=function(_0x413b19,_0x299538){_0x413b19=_0x413b19-0x0;var _0xb73bb6=_0x4ab1[_0x413b19];return _0xb73bb6;};'use strict';var _=require(_0x14ab('0x0'));var util=require(_0x14ab('0x1'));var logger=require(_0x14ab('0x2'))(_0x14ab('0x3'));var moment=require(_0x14ab('0x4'));var BPromise=require(_0x14ab('0x5'));var rp=require(_0x14ab('0x6'));var fs=require('fs');var path=require(_0x14ab('0x7'));var rimraf=require(_0x14ab('0x8'));var config=require(_0x14ab('0x9'));var attributes=require(_0x14ab('0xa'));module[_0x14ab('0xb')]=function(_0x40b660,_0x400e2c){return _0x40b660['define'](_0x14ab('0xc'),attributes,{'tableName':_0x14ab('0xd'),'paranoid':![],'indexes':[{'name':_0x14ab('0xe'),'fields':[_0x14ab('0xe')]},{'name':_0x14ab('0xf'),'fields':[_0x14ab('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c11d7,_0x46683b,_0x147db5){var _0x4329c2=_0x40b660[_0x14ab('0x11')];var _0x37ed23=_0x2c11d7[_0x14ab('0x12')]({'plain':!![]});if(_0x37ed23[_0x14ab('0x13')][_0x14ab('0x14')]()==='in'||_0x37ed23[_0x14ab('0x13')]['toLowerCase']()==='out'&&!_0x37ed23['secret']&&!_[_0x14ab('0x15')](_0x37ed23[_0x14ab('0x16')])){_0x4329c2[_0x14ab('0x17')]['findOne']({'where':{'id':_0x37ed23['WhatsappInteractionId']}})[_0x14ab('0x18')](function(_0x39127c){if(_0x39127c){_0x39127c[_0x14ab('0x19')]({'lastMsgAt':_0x37ed23[_0x14ab('0x1a')],'lastMsgDirection':_0x37ed23[_0x14ab('0x13')][_0x14ab('0x14')]()});}})[_0x14ab('0x1b')](function(_0x27b539){console[_0x14ab('0x1c')](_0x27b539);});}if(_0x37ed23[_0x14ab('0x13')]===_0x14ab('0x1d')&&!_0x37ed23[_0x14ab('0x1e')]){var _0x19b70f;_0x4329c2[_0x14ab('0x1f')][_0x14ab('0x20')]({'where':{'id':_0x37ed23[_0x14ab('0x21')]},'raw':!![]})['then'](function(_0x509167){_0x19b70f=_0x509167;if(_0x19b70f&&_0x19b70f[_0x14ab('0x22')]){switch(_0x19b70f[_0x14ab('0x22')]){case _0x14ab('0x23'):var _0x36ee02=require(_0x14ab('0x23'));if(_0x19b70f[_0x14ab('0x24')]&&_0x19b70f[_0x14ab('0x25')]&&_0x19b70f[_0x14ab('0x26')]){var _0x2d9e31=new _0x36ee02(_0x19b70f['accountSid'],_0x19b70f[_0x14ab('0x25')]);_0x2d9e31[_0x14ab('0x27')][_0x14ab('0x28')]({'body':_0x37ed23[_0x14ab('0x10')],'to':_0x14ab('0x29')+_0x37ed23['phone'],'from':_0x14ab('0x29')+_0x19b70f[_0x14ab('0x26')],'statusCallback':_0x19b70f[_0x14ab('0x2a')]+_0x14ab('0x2b')+_0x37ed23['id']+_0x14ab('0x2c')+_0x19b70f[_0x14ab('0x2d')]})[_0x14ab('0x18')](function(_0x276ef1){if(_0x276ef1[_0x14ab('0x2e')]){return _0x2c11d7[_0x14ab('0x19')]({'messageId':_0x276ef1['sid']});}})[_0x14ab('0x1b')](function(_0x33d9e0){logger[_0x14ab('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14ab('0x2f'),_0x14ab('0x23'),util['inspect'](_0x33d9e0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x14ab('0x30'),_0x14ab('0x2f'),_0x14ab('0x23'),_0x14ab('0x31'));}break;}}})[_0x14ab('0x32')](function(){_0x147db5();});}else{_0x147db5();}}},'charset':_0x14ab('0x33'),'collate':_0x14ab('0x34')});}; \ No newline at end of file +var _0x18dc=['api','moment','bluebird','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','createdAt','catch','error','find','then','type','twilio','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','util'];(function(_0x16ee48,_0x4e660d){var _0x23f7bf=function(_0x31464e){while(--_0x31464e){_0x16ee48['push'](_0x16ee48['shift']());}};_0x23f7bf(++_0x4e660d);}(_0x18dc,0xcb));var _0xc18d=function(_0x4009c4,_0x3f7222){_0x4009c4=_0x4009c4-0x0;var _0x4e8ef7=_0x18dc[_0x4009c4];return _0x4e8ef7;};'use strict';var _=require(_0xc18d('0x0'));var util=require(_0xc18d('0x1'));var logger=require('../../config/logger')(_0xc18d('0x2'));var moment=require(_0xc18d('0x3'));var BPromise=require(_0xc18d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc18d('0x5'));var attributes=require(_0xc18d('0x6'));module[_0xc18d('0x7')]=function(_0x2e4d8d,_0x162590){return _0x2e4d8d[_0xc18d('0x8')](_0xc18d('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xc18d('0xa'),'fields':[_0xc18d('0xb')],'type':_0xc18d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd89820,_0x7e26a6,_0x137d1d){var _0x4caa2b=_0x2e4d8d['models'];var _0x4c0a63=_0xd89820[_0xc18d('0xd')]({'plain':!![]});if(_0x4c0a63[_0xc18d('0xe')]['toLowerCase']()==='in'||_0x4c0a63['direction'][_0xc18d('0xf')]()===_0xc18d('0x10')&&!_0x4c0a63[_0xc18d('0x11')]&&!_['isNil'](_0x4c0a63[_0xc18d('0x12')])){_0x4caa2b['WhatsappInteraction'][_0xc18d('0x13')]({'where':{'id':_0x4c0a63['WhatsappInteractionId']}})['then'](function(_0xcd7b19){if(_0xcd7b19){_0xcd7b19['update']({'lastMsgAt':_0x4c0a63[_0xc18d('0x14')],'lastMsgDirection':_0x4c0a63[_0xc18d('0xe')][_0xc18d('0xf')]()});}})[_0xc18d('0x15')](function(_0x22d61d){console[_0xc18d('0x16')](_0x22d61d);});}if(_0x4c0a63['direction']===_0xc18d('0x10')&&!_0x4c0a63[_0xc18d('0x11')]){var _0x438dd3;_0x4caa2b['WhatsappAccount'][_0xc18d('0x17')]({'where':{'id':_0x4c0a63['WhatsappAccountId']},'raw':!![]})[_0xc18d('0x18')](function(_0x281cd4){_0x438dd3=_0x281cd4;if(_0x438dd3&&_0x438dd3['type']){switch(_0x438dd3[_0xc18d('0x19')]){case _0xc18d('0x1a'):var _0x17b16b=require('twilio');if(_0x438dd3['accountSid']&&_0x438dd3[_0xc18d('0x1b')]&&_0x438dd3[_0xc18d('0x1c')]){var _0x50eaae=new _0x17b16b(_0x438dd3['accountSid'],_0x438dd3[_0xc18d('0x1b')]);_0x50eaae[_0xc18d('0x1d')][_0xc18d('0x1e')]({'body':_0x4c0a63[_0xc18d('0xb')],'to':_0xc18d('0x1f')+_0x4c0a63[_0xc18d('0x1c')],'from':_0xc18d('0x1f')+_0x438dd3[_0xc18d('0x1c')],'statusCallback':_0x438dd3[_0xc18d('0x20')]+_0xc18d('0x21')+_0x4c0a63['id']+'/status?token='+_0x438dd3[_0xc18d('0x22')]})[_0xc18d('0x18')](function(_0x1e9544){if(_0x1e9544[_0xc18d('0x23')]){return _0xd89820['update']({'messageId':_0x1e9544[_0xc18d('0x23')]});}})[_0xc18d('0x15')](function(_0x5a79e8){logger[_0xc18d('0x16')](_0xc18d('0x24'),_0xc18d('0x25'),_0xc18d('0x1a'),util[_0xc18d('0x26')](_0x5a79e8,{'showHidden':![],'depth':null}));});}else{logger[_0xc18d('0x16')](_0xc18d('0x24'),'afterCreate',_0xc18d('0x1a'),_0xc18d('0x27'));}break;}}})['finally'](function(){_0x137d1d();});}else{_0x137d1d();}}},'charset':_0xc18d('0x28'),'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 6b1d5bf..13049e5 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 _0xf986=['create','body','options','debug','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage'];(function(_0x1f2b1b,_0x32bdd3){var _0xb62f47=function(_0x264001){while(--_0x264001){_0x1f2b1b['push'](_0x1f2b1b['shift']());}};_0xb62f47(++_0x32bdd3);}(_0xf986,0x11c));var _0x6f98=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf986[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x6f98('0x0'));var moment=require(_0x6f98('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f98('0x2'));var fs=require('fs');var Redis=require(_0x6f98('0x3'));var db=require(_0x6f98('0x4'))['db'];var utils=require(_0x6f98('0x5'));var logger=require(_0x6f98('0x6'))('rpc');var config=require(_0x6f98('0x7'));var jayson=require(_0x6f98('0x8'));var client=jayson[_0x6f98('0x9')]['http']({'port':0x232a});config[_0x6f98('0xa')]=_['defaults'](config[_0x6f98('0xa')],{'host':_0x6f98('0xb'),'port':0x18eb});var socket=require(_0x6f98('0xc'))(new Redis(config[_0x6f98('0xa')]));require(_0x6f98('0xd'))[_0x6f98('0xe')](socket);function respondWithRpcPromise(_0x2c8e12,_0x5e0f3a,_0x4fc4ee){return new BPromise(function(_0x348ac7,_0x586cdf){return client[_0x6f98('0xf')](_0x2c8e12,_0x4fc4ee)[_0x6f98('0x10')](function(_0x32d279){logger[_0x6f98('0x11')](_0x6f98('0x12'),_0x5e0f3a,_0x6f98('0x13'));logger['debug'](_0x6f98('0x14'),_0x5e0f3a,_0x6f98('0x13'),JSON[_0x6f98('0x15')](_0x32d279));if(_0x32d279[_0x6f98('0x16')]){if(_0x32d279[_0x6f98('0x16')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5e0f3a,_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);return _0x586cdf(_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);}logger[_0x6f98('0x16')](_0x6f98('0x12'),_0x5e0f3a,_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);return _0x348ac7(_0x32d279[_0x6f98('0x16')][_0x6f98('0x17')]);}else{logger[_0x6f98('0x11')](_0x6f98('0x12'),_0x5e0f3a,_0x6f98('0x13'));_0x348ac7(_0x32d279[_0x6f98('0x18')][_0x6f98('0x17')]);}})['catch'](function(_0x493862){logger[_0x6f98('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0f3a,_0x493862);_0x586cdf(_0x493862);});});}exports[_0x6f98('0x19')]=function(_0x54fb46){var _0x18ae16=this;return new Promise(function(_0x1d4da5,_0x2cfd21){return db['WhatsappMessage'][_0x6f98('0x1a')](_0x54fb46[_0x6f98('0x1b')],{'raw':_0x54fb46[_0x6f98('0x1c')]?_0x54fb46[_0x6f98('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1c1dac){logger[_0x6f98('0x11')](_0x6f98('0x19'),_0x54fb46);logger[_0x6f98('0x1d')](_0x6f98('0x19'),_0x54fb46,JSON[_0x6f98('0x15')](_0x1c1dac));_0x1d4da5(_0x1c1dac);})[_0x6f98('0x1e')](function(_0x325707){logger[_0x6f98('0x16')](_0x6f98('0x19'),_0x325707['message'],_0x54fb46);_0x2cfd21(_0x18ae16[_0x6f98('0x16')](0x1f4,_0x325707[_0x6f98('0x17')]));});});}; \ No newline at end of file +var _0x3162=['then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','request'];(function(_0x54e4fd,_0x4059d4){var _0x50cbb2=function(_0x47549d){while(--_0x47549d){_0x54e4fd['push'](_0x54e4fd['shift']());}};_0x50cbb2(++_0x4059d4);}(_0x3162,0xa0));var _0x2316=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x3162[_0x1ceb7b];return _0x57c016;};'use strict';var _=require(_0x2316('0x0'));var util=require(_0x2316('0x1'));var moment=require(_0x2316('0x2'));var BPromise=require(_0x2316('0x3'));var rs=require(_0x2316('0x4'));var fs=require('fs');var Redis=require(_0x2316('0x5'));var db=require(_0x2316('0x6'))['db'];var utils=require(_0x2316('0x7'));var logger=require(_0x2316('0x8'))(_0x2316('0x9'));var config=require(_0x2316('0xa'));var jayson=require(_0x2316('0xb'));var client=jayson[_0x2316('0xc')][_0x2316('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2316('0xe'),'port':0x18eb});var socket=require(_0x2316('0xf'))(new Redis(config[_0x2316('0x10')]));require(_0x2316('0x11'))[_0x2316('0x12')](socket);function respondWithRpcPromise(_0x389565,_0x5dec72,_0x58ac80){return new BPromise(function(_0x1c6b30,_0x162bcc){return client[_0x2316('0x13')](_0x389565,_0x58ac80)[_0x2316('0x14')](function(_0x6840e9){logger[_0x2316('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5dec72,_0x2316('0x16'));logger[_0x2316('0x17')](_0x2316('0x18'),_0x5dec72,'request\x20sent',JSON[_0x2316('0x19')](_0x6840e9));if(_0x6840e9['error']){if(_0x6840e9['error'][_0x2316('0x1a')]===0x1f4){logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x6840e9['error']['message']);return _0x162bcc(_0x6840e9[_0x2316('0x1b')][_0x2316('0x1d')]);}logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x6840e9['error'][_0x2316('0x1d')]);return _0x1c6b30(_0x6840e9[_0x2316('0x1b')][_0x2316('0x1d')]);}else{logger[_0x2316('0x15')](_0x2316('0x1c'),_0x5dec72,_0x2316('0x16'));_0x1c6b30(_0x6840e9[_0x2316('0x1e')][_0x2316('0x1d')]);}})[_0x2316('0x1f')](function(_0x5d17f9){logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x5d17f9);_0x162bcc(_0x5d17f9);});});}exports[_0x2316('0x20')]=function(_0xa5673a){var _0xabd1de=this;return new Promise(function(_0x463f22,_0x4175ed){return db[_0x2316('0x21')][_0x2316('0x22')](_0xa5673a['body'],{'raw':_0xa5673a[_0x2316('0x23')]?_0xa5673a['options']['raw']===undefined?!![]:![]:!![]})[_0x2316('0x14')](function(_0x194ebe){logger[_0x2316('0x15')](_0x2316('0x20'),_0xa5673a);logger['debug'](_0x2316('0x20'),_0xa5673a,JSON[_0x2316('0x19')](_0x194ebe));_0x463f22(_0x194ebe);})[_0x2316('0x1f')](function(_0x5ae2af){logger['error'](_0x2316('0x20'),_0x5ae2af[_0x2316('0x1d')],_0xa5673a);_0x4175ed(_0xabd1de['error'](0x1f4,_0x5ae2af[_0x2316('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f19a7c7..c08ff88 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 _0x28e4=['update','removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0x25cdcf,_0x490484){var _0x4ed305=function(_0x4302af){while(--_0x4302af){_0x25cdcf['push'](_0x25cdcf['shift']());}};_0x4ed305(++_0x490484);}(_0x28e4,0x11c));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x428e('0x0'));var events=[_0x428e('0x1'),_0x428e('0x2'),_0x428e('0x3')];function createListener(_0x39da09,_0x253594){return function(_0x46e41e){_0x253594['emit'](_0x39da09,_0x46e41e);};}function removeListener(_0x4b2d9b,_0x18d91d){return function(){WhatsappMessageEvents[_0x428e('0x4')](_0x4b2d9b,_0x18d91d);};}exports[_0x428e('0x5')]=function(_0x5052f7){for(var _0x3ab35a=0x0,_0x4cdc6f=events[_0x428e('0x6')];_0x3ab35a<_0x4cdc6f;_0x3ab35a++){var _0x5b0d72=events[_0x3ab35a];var _0x516f8c=createListener('whatsappMessage:'+_0x5b0d72,_0x5052f7);WhatsappMessageEvents['on'](_0x5b0d72,_0x516f8c);}}; \ No newline at end of file +var _0x9664=['./whatsappMessage.events','update','emit','removeListener','length','whatsappMessage:'];(function(_0x5bf992,_0x533b26){var _0x288176=function(_0x55cb59){while(--_0x55cb59){_0x5bf992['push'](_0x5bf992['shift']());}};_0x288176(++_0x533b26);}(_0x9664,0x126));var _0x4966=function(_0x5b0fc7,_0x4e34ed){_0x5b0fc7=_0x5b0fc7-0x0;var _0xb806a=_0x9664[_0x5b0fc7];return _0xb806a;};'use strict';var WhatsappMessageEvents=require(_0x4966('0x0'));var events=['save','remove',_0x4966('0x1')];function createListener(_0x996756,_0x454343){return function(_0x26921c){_0x454343[_0x4966('0x2')](_0x996756,_0x26921c);};}function removeListener(_0x41cc95,_0x4a7a22){return function(){WhatsappMessageEvents[_0x4966('0x3')](_0x41cc95,_0x4a7a22);};}exports['register']=function(_0x39b3c0){for(var _0x3d2338=0x0,_0x45613e=events[_0x4966('0x4')];_0x3d2338<_0x45613e;_0x3d2338++){var _0x35be0e=events[_0x3d2338];var _0x468dd4=createListener(_0x4966('0x5')+_0x35be0e,_0x39b3c0);WhatsappMessageEvents['on'](_0x35be0e,_0x468dd4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4ec3454..5d626b5 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 _0x19be=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','/:id','get'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0x19be,0x1ab));var _0xe19b=function(_0x29f4e8,_0x321a81){_0x29f4e8=_0x29f4e8-0x0;var _0x58c50f=_0x19be[_0x29f4e8];return _0x58c50f;};'use strict';var multer=require(_0xe19b('0x0'));var util=require('util');var path=require(_0xe19b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe19b('0x2'));var router=express['Router']();var auth=require(_0xe19b('0x3'));var interaction=require(_0xe19b('0x4'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xe19b('0x5')](),controller['index']);router['get'](_0xe19b('0x6'),auth['isAuthenticated'](),controller[_0xe19b('0x7')]);router['get'](_0xe19b('0x8'),auth[_0xe19b('0x5')](),controller['show']);router[_0xe19b('0x9')](_0xe19b('0xa'),auth['isAuthenticated'](),controller['getMembers']);router[_0xe19b('0x9')](_0xe19b('0xb'),auth[_0xe19b('0x5')](),controller[_0xe19b('0xc')]);router[_0xe19b('0x9')](_0xe19b('0xd'),auth[_0xe19b('0x5')](),controller[_0xe19b('0xe')]);router[_0xe19b('0xf')]('/',auth[_0xe19b('0x5')](),controller[_0xe19b('0x10')]);router[_0xe19b('0xf')]('/:id/teams',auth[_0xe19b('0x5')](),controller['addTeams']);router[_0xe19b('0xf')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xe19b('0x11')](_0xe19b('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xe19b('0x12')](_0xe19b('0x8'),auth['isAuthenticated'](),controller[_0xe19b('0x13')]);router[_0xe19b('0x12')](_0xe19b('0xb'),auth[_0xe19b('0x5')](),controller[_0xe19b('0x14')]);router['delete'](_0xe19b('0xd'),auth[_0xe19b('0x5')](),controller[_0xe19b('0x15')]);module[_0xe19b('0x16')]=router; \ No newline at end of file +var _0xfef6=['create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/users','getAgents','post'];(function(_0x5164db,_0x330fc1){var _0x67ec02=function(_0x5c2df9){while(--_0x5c2df9){_0x5164db['push'](_0x5164db['shift']());}};_0x67ec02(++_0x330fc1);}(_0xfef6,0x149));var _0x6fef=function(_0x312cd8,_0x426245){_0x312cd8=_0x312cd8-0x0;var _0x137254=_0xfef6[_0x312cd8];return _0x137254;};'use strict';var multer=require(_0x6fef('0x0'));var util=require(_0x6fef('0x1'));var path=require(_0x6fef('0x2'));var timeout=require(_0x6fef('0x3'));var express=require('express');var router=express[_0x6fef('0x4')]();var auth=require(_0x6fef('0x5'));var interaction=require(_0x6fef('0x6'));var config=require(_0x6fef('0x7'));var controller=require(_0x6fef('0x8'));router[_0x6fef('0x9')]('/',auth['isAuthenticated'](),controller[_0x6fef('0xa')]);router[_0x6fef('0x9')](_0x6fef('0xb'),auth[_0x6fef('0xc')](),controller[_0x6fef('0xd')]);router[_0x6fef('0x9')](_0x6fef('0xe'),auth[_0x6fef('0xc')](),controller['show']);router[_0x6fef('0x9')](_0x6fef('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0x6fef('0xc')](),controller['getTeams']);router['get'](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x11')]);router[_0x6fef('0x12')]('/',auth['isAuthenticated'](),controller[_0x6fef('0x13')]);router[_0x6fef('0x12')](_0x6fef('0x14'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x15')]);router[_0x6fef('0x12')](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x16')]);router[_0x6fef('0x17')]('/:id',auth[_0x6fef('0xc')](),controller[_0x6fef('0x18')]);router['delete'](_0x6fef('0xe'),auth['isAuthenticated'](),controller[_0x6fef('0x19')]);router[_0x6fef('0x1a')](_0x6fef('0x14'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x1b')]);router[_0x6fef('0x1a')](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller['removeAgents']);module[_0x6fef('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a4b2bbc..b94cd8f 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 _0xd66f=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0xa72fc9,_0x42a752){var _0x3e7c45=function(_0x20a129){while(--_0x20a129){_0xa72fc9['push'](_0xa72fc9['shift']());}};_0x3e7c45(++_0x42a752);}(_0xd66f,0xa1));var _0xfd66=function(_0x4ece40,_0x28a245){_0x4ece40=_0x4ece40-0x0;var _0x41d4de=_0xd66f[_0x4ece40];return _0x41d4de;};'use strict';var Sequelize=require(_0xfd66('0x0'));module[_0xfd66('0x1')]={'name':{'type':Sequelize[_0xfd66('0x2')],'unique':_0xfd66('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfd66('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfd66('0x5'),'beepall',_0xfd66('0x6'))},'description':{'type':Sequelize[_0xfd66('0x2')]}}; \ No newline at end of file +var _0xeca3=['exports','STRING','name','rrmemory','beepall','roundrobin','sequelize'];(function(_0x519413,_0x45d76a){var _0x2bd613=function(_0x41c349){while(--_0x41c349){_0x519413['push'](_0x519413['shift']());}};_0x2bd613(++_0x45d76a);}(_0xeca3,0x99));var _0x3eca=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xeca3[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x3eca('0x0'));module[_0x3eca('0x1')]={'name':{'type':Sequelize[_0x3eca('0x2')],'unique':_0x3eca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3eca('0x4'),_0x3eca('0x5'),_0x3eca('0x6'))},'description':{'type':Sequelize[_0x3eca('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 905ebd3..321a624 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 _0xe8a6=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','UserProfileResource','name','index','map','WhatsappQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','filter','User','findAndCountAll','UserId','whatsappPause','format','createdAt','getTeams','Team','ids','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','userWhatsappQueue:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring'];(function(_0x27f7b3,_0x46aaef){var _0x2e8598=function(_0x3396e0){while(--_0x3396e0){_0x27f7b3['push'](_0x27f7b3['shift']());}};_0x2e8598(++_0x46aaef);}(_0xe8a6,0xf4));var _0x6e8a=function(_0x134839,_0x2ed2fa){_0x134839=_0x134839-0x0;var _0x4fa9a9=_0xe8a6[_0x134839];return _0x4fa9a9;};'use strict';var pdf=require(_0x6e8a('0x0'));var emlformat=require(_0x6e8a('0x1'));var rimraf=require(_0x6e8a('0x2'));var zipdir=require(_0x6e8a('0x3'));var jsonpatch=require(_0x6e8a('0x4'));var rp=require(_0x6e8a('0x5'));var moment=require(_0x6e8a('0x6'));var BPromise=require(_0x6e8a('0x7'));var Mustache=require(_0x6e8a('0x8'));var util=require(_0x6e8a('0x9'));var path=require(_0x6e8a('0xa'));var sox=require(_0x6e8a('0xb'));var csv=require(_0x6e8a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e8a('0xd'));var crypto=require(_0x6e8a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e8a('0xc'));var querystring=require(_0x6e8a('0xf'));var Papa=require(_0x6e8a('0x10'));var Redis=require(_0x6e8a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6e8a('0x12'));var as=require(_0x6e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6e8a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6e8a('0x15'));var db=require('../../mysqldb')['db'];config[_0x6e8a('0x16')]=_['defaults'](config['redis'],{'host':_0x6e8a('0x17'),'port':0x18eb});var socket=require(_0x6e8a('0x18'))(new Redis(config[_0x6e8a('0x16')]));require('./whatsappQueue.socket')[_0x6e8a('0x19')](socket);function respondWithStatusCode(_0x5d1fd4,_0x13feeb){_0x13feeb=_0x13feeb||0xcc;return function(_0x4bdd8a){if(_0x4bdd8a){return _0x5d1fd4[_0x6e8a('0x1a')](_0x13feeb);}return _0x5d1fd4[_0x6e8a('0x1b')](_0x13feeb)[_0x6e8a('0x1c')]();};}function respondWithResult(_0xff2cf0,_0x437363){_0x437363=_0x437363||0xc8;return function(_0x5f4918){if(_0x5f4918){return _0xff2cf0[_0x6e8a('0x1b')](_0x437363)[_0x6e8a('0x1d')](_0x5f4918);}};}function respondWithFilteredResult(_0x32cbdc,_0x2210cd){return function(_0x419b87){if(_0x419b87){var _0x3a2d45=_0x419b87['count'],_0x23bdda=_0x2210cd[_0x6e8a('0x1e')],_0x2fd71c=_0x2210cd[_0x6e8a('0x1e')]+_0x2210cd[_0x6e8a('0x1f')],_0x2b96b0;if(_0x2fd71c>=_0x3a2d45){_0x2fd71c=_0x3a2d45;_0x2b96b0=0xc8;}else{_0x2b96b0=0xce;}_0x32cbdc['status'](_0x2b96b0);return _0x32cbdc[_0x6e8a('0x20')](_0x6e8a('0x21'),_0x23bdda+'-'+_0x2fd71c+'/'+_0x3a2d45)[_0x6e8a('0x1d')](_0x419b87);}return null;};}function patchUpdates(_0x3f6249){return function(_0x58728a){try{jsonpatch['apply'](_0x58728a,_0x3f6249,!![]);}catch(_0x3f8f5d){return BPromise[_0x6e8a('0x22')](_0x3f8f5d);}return _0x58728a[_0x6e8a('0x23')]();};}function saveUpdates(_0x31489e,_0x1fafb4){return function(_0x42b36f){if(_0x42b36f){return _0x42b36f['update'](_0x31489e)[_0x6e8a('0x24')](function(_0x510c3f){return _0x510c3f;});}return null;};}function removeEntity(_0xffa1db,_0x5d87ba){return function(_0x1d21ef){if(_0x1d21ef){return _0x1d21ef[_0x6e8a('0x25')]()[_0x6e8a('0x24')](function(){var _0x534404=_0x1d21ef['get']({'plain':!![]});var _0x3c6a53='WhatsappQueues';return db[_0x6e8a('0x26')]['destroy']({'where':{'type':_0x3c6a53,'resourceId':_0x534404['id']}})['then'](function(){return _0x1d21ef;});})[_0x6e8a('0x24')](function(){_0xffa1db[_0x6e8a('0x1b')](0xcc)[_0x6e8a('0x1c')]();});}};}function handleEntityNotFound(_0xa295aa,_0x36c4f0){return function(_0x4b18ed){if(!_0x4b18ed){_0xa295aa[_0x6e8a('0x1a')](0x194);}return _0x4b18ed;};}function handleError(_0x4f7f88,_0x16dbdf){_0x16dbdf=_0x16dbdf||0x1f4;return function(_0xe09d0b){logger['error'](_0xe09d0b['stack']);if(_0xe09d0b[_0x6e8a('0x27')]){delete _0xe09d0b[_0x6e8a('0x27')];}_0x4f7f88[_0x6e8a('0x1b')](_0x16dbdf)['send'](_0xe09d0b);};}exports[_0x6e8a('0x28')]=function(_0x1c12b3,_0x3c2e73){var _0x432bf1={},_0x32d40f={},_0x56f7b2={'count':0x0,'rows':[]};var _0x2046f3=_[_0x6e8a('0x29')](db[_0x6e8a('0x2a')][_0x6e8a('0x2b')],function(_0xd88a95){return{'name':_0xd88a95['fieldName'],'type':_0xd88a95['type'][_0x6e8a('0x2c')]};});_0x32d40f[_0x6e8a('0x2d')]=_['map'](_0x2046f3,_0x6e8a('0x27'));_0x32d40f[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x1c12b3[_0x6e8a('0x2e')]);_0x32d40f[_0x6e8a('0x30')]=_['intersection'](_0x32d40f['model'],_0x32d40f[_0x6e8a('0x2e')]);_0x432bf1[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x32d40f['model'],qs[_0x6e8a('0x33')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x33')]));_0x432bf1[_0x6e8a('0x31')]=_0x432bf1[_0x6e8a('0x31')][_0x6e8a('0x34')]?_0x432bf1[_0x6e8a('0x31')]:_0x32d40f[_0x6e8a('0x2d')];if(!_0x1c12b3['query'][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x432bf1['limit']=qs['limit'](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x1f')]);_0x432bf1[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}_0x432bf1[_0x6e8a('0x37')]=qs[_0x6e8a('0x38')](_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x38')]);_0x432bf1[_0x6e8a('0x39')]=qs['filters'](_[_0x6e8a('0x3a')](_0x1c12b3[_0x6e8a('0x2e')],_0x32d40f[_0x6e8a('0x30')]),_0x2046f3);if(_0x1c12b3[_0x6e8a('0x2e')]['filter']){_0x432bf1[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x432bf1[_0x6e8a('0x39')],{'$or':_[_0x6e8a('0x29')](_0x2046f3,function(_0x4abc4f){if(_0x4abc4f['type']!=='VIRTUAL'){var _0x99709a={};_0x99709a[_0x4abc4f[_0x6e8a('0x27')]]={'$like':'%'+_0x1c12b3[_0x6e8a('0x2e')]['filter']+'%'};return _0x99709a;}})});}_0x432bf1=_['merge']({},_0x432bf1,_0x1c12b3['options']);var _0x1acb12={'where':_0x432bf1['where']};return db[_0x6e8a('0x2a')]['count'](_0x1acb12)[_0x6e8a('0x24')](function(_0x375a1a){_0x56f7b2['count']=_0x375a1a;if(_0x1c12b3[_0x6e8a('0x2e')][_0x6e8a('0x3c')]){_0x432bf1[_0x6e8a('0x3d')]=[{'all':!![]}];}return db[_0x6e8a('0x2a')][_0x6e8a('0x3e')](_0x432bf1);})[_0x6e8a('0x24')](function(_0x2a324a){_0x56f7b2[_0x6e8a('0x3f')]=_0x2a324a;return _0x56f7b2;})[_0x6e8a('0x24')](respondWithFilteredResult(_0x3c2e73,_0x432bf1))[_0x6e8a('0x40')](handleError(_0x3c2e73,null));};exports['show']=function(_0x3bdc5f,_0x7218ec){var _0x1df28d={'raw':!![],'where':{'id':_0x3bdc5f[_0x6e8a('0x41')]['id']}},_0x247a44={};_0x247a44[_0x6e8a('0x2d')]=_['keys'](db[_0x6e8a('0x2a')][_0x6e8a('0x2b')]);_0x247a44[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x3bdc5f[_0x6e8a('0x2e')]);_0x247a44[_0x6e8a('0x30')]=_['intersection'](_0x247a44['model'],_0x247a44[_0x6e8a('0x2e')]);_0x1df28d[_0x6e8a('0x31')]=_['intersection'](_0x247a44[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x3bdc5f['query'][_0x6e8a('0x33')]));_0x1df28d[_0x6e8a('0x31')]=_0x1df28d['attributes']['length']?_0x1df28d['attributes']:_0x247a44['model'];if(_0x3bdc5f[_0x6e8a('0x2e')][_0x6e8a('0x3c')]){_0x1df28d[_0x6e8a('0x3d')]=[{'all':!![]}];}_0x1df28d=_[_0x6e8a('0x3b')]({},_0x1df28d,_0x3bdc5f[_0x6e8a('0x42')]);return db['WhatsappQueue'][_0x6e8a('0x43')](_0x1df28d)[_0x6e8a('0x24')](handleEntityNotFound(_0x7218ec,null))[_0x6e8a('0x24')](respondWithResult(_0x7218ec,null))[_0x6e8a('0x40')](handleError(_0x7218ec,null));};exports[_0x6e8a('0x44')]=function(_0x38eb60,_0x36413c){return db[_0x6e8a('0x2a')][_0x6e8a('0x44')](_0x38eb60['body'],{})[_0x6e8a('0x24')](function(_0x40a34c){var _0x43bc8f=_0x38eb60['user'][_0x6e8a('0x45')]({'plain':!![]});if(!_0x43bc8f)throw new Error(_0x6e8a('0x46'));if(_0x43bc8f[_0x6e8a('0x47')]==='user'){var _0x4046ee=_0x40a34c[_0x6e8a('0x45')]({'plain':!![]});var _0x4f31d8=_0x6e8a('0x48');return db[_0x6e8a('0x49')][_0x6e8a('0x43')]({'where':{'name':_0x4f31d8,'userProfileId':_0x43bc8f[_0x6e8a('0x4a')]},'raw':!![]})[_0x6e8a('0x24')](function(_0x4a2466){if(_0x4a2466&&_0x4a2466[_0x6e8a('0x4b')]===0x0){return db[_0x6e8a('0x26')][_0x6e8a('0x44')]({'name':_0x4046ee[_0x6e8a('0x27')],'resourceId':_0x4046ee['id'],'type':_0x4a2466[_0x6e8a('0x27')],'sectionId':_0x4a2466['id']},{})[_0x6e8a('0x24')](function(){return _0x40a34c;});}else{return _0x40a34c;}})[_0x6e8a('0x40')](function(_0x444ed3){logger[_0x6e8a('0x4c')](_0x6e8a('0x4d'),_0x444ed3);throw _0x444ed3;});}return _0x40a34c;})[_0x6e8a('0x24')](respondWithResult(_0x36413c,0xc9))[_0x6e8a('0x40')](handleError(_0x36413c,null));};exports[_0x6e8a('0x4e')]=function(_0x10433d,_0x287521){if(_0x10433d['body']['id']){delete _0x10433d[_0x6e8a('0x4f')]['id'];}return db[_0x6e8a('0x2a')][_0x6e8a('0x43')]({'where':{'id':_0x10433d[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x287521,null))['then'](saveUpdates(_0x10433d[_0x6e8a('0x4f')],null))['then'](respondWithResult(_0x287521,null))['catch'](handleError(_0x287521,null));};exports['destroy']=function(_0x4a0530,_0x27edf8){return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x4a0530[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x27edf8,null))['then'](removeEntity(_0x27edf8,null))[_0x6e8a('0x40')](handleError(_0x27edf8,null));};exports[_0x6e8a('0x50')]=function(_0x24ee0b,_0x2f8e4b){return db[_0x6e8a('0x2a')]['describe']()[_0x6e8a('0x24')](respondWithResult(_0x2f8e4b,null))[_0x6e8a('0x40')](handleError(_0x2f8e4b,null));};exports[_0x6e8a('0x51')]=function(_0x512cfa,_0x250c08,_0x5d6834){var _0x3a0683={'raw':!![],'where':{}},_0x472853={},_0x47c199;return db[_0x6e8a('0x2a')]['findOne']({'where':{'id':_0x512cfa[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x250c08,null))[_0x6e8a('0x24')](function(_0x17d3a3){if(_0x17d3a3){_0x47c199=_0x17d3a3[_0x6e8a('0x45')]({'plain':!![]});_0x472853['model']=_[_0x6e8a('0x2f')](db[_0x6e8a('0x52')]['rawAttributes']);_0x472853['query']=_[_0x6e8a('0x2f')](_0x512cfa['query']);_0x472853[_0x6e8a('0x30')]=_[_0x6e8a('0x32')](_0x472853[_0x6e8a('0x2d')],_0x472853[_0x6e8a('0x2e')]);_0x3a0683[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x472853[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x512cfa['query'][_0x6e8a('0x33')]));_0x3a0683[_0x6e8a('0x31')]=_0x3a0683[_0x6e8a('0x31')]['length']?_0x3a0683[_0x6e8a('0x31')]:_0x472853[_0x6e8a('0x2d')];if(!_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x3a0683[_0x6e8a('0x1f')]=qs[_0x6e8a('0x1f')](_0x512cfa['query'][_0x6e8a('0x1f')]);_0x3a0683[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}_0x3a0683['order']=qs[_0x6e8a('0x38')](_0x512cfa['query'][_0x6e8a('0x38')]);_0x3a0683[_0x6e8a('0x39')]=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x512cfa[_0x6e8a('0x2e')],_0x472853[_0x6e8a('0x30')]));_0x3a0683[_0x6e8a('0x39')][_0x6e8a('0x53')]=_0x17d3a3['id'];if(_0x512cfa[_0x6e8a('0x2e')][_0x6e8a('0x54')]){_0x3a0683['where']=_[_0x6e8a('0x3b')](_0x3a0683[_0x6e8a('0x39')],{'$or':_['map'](_0x3a0683[_0x6e8a('0x31')],function(_0x21f035){var _0x5726de={};_0x5726de[_0x21f035]={'$like':'%'+_0x512cfa[_0x6e8a('0x2e')]['filter']+'%'};return _0x5726de;})});}_0x3a0683=_[_0x6e8a('0x3b')]({},_0x3a0683,_0x512cfa['options']);return db[_0x6e8a('0x52')][_0x6e8a('0x3e')](_0x3a0683);}})['then'](function(_0x42182c){if(_0x42182c){return db[_0x6e8a('0x55')][_0x6e8a('0x56')]({'where':{'id':_['map'](_0x42182c,_0x6e8a('0x57')),'role':'agent'},'attributes':['id',_0x6e8a('0x27'),_0x6e8a('0x58'),'updatedAt','createdAt']});}})[_0x6e8a('0x24')](function(_0x5147aa){if(_0x5147aa){return{'count':_0x5147aa['count'],'rows':_[_0x6e8a('0x29')](_0x5147aa['rows'],function(_0x4c91c9){return{'membername':_0x4c91c9['name'],'UserId':_0x4c91c9['id'],'queue_name':_0x47c199[_0x6e8a('0x27')],'WhatsappQueueId':_0x47c199['id'],'interface':util[_0x6e8a('0x59')]('%s/%s','SIP',_0x4c91c9[_0x6e8a('0x27')]),'penalty':0x0,'paused':_0x4c91c9['whatsappPause'],'createdAt':_0x4c91c9[_0x6e8a('0x5a')],'updatedAt':_0x4c91c9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6e8a('0x24')](respondWithFilteredResult(_0x250c08,_0x3a0683))['catch'](handleError(_0x250c08,null));};exports[_0x6e8a('0x5b')]=function(_0x529b4e,_0x9eb014,_0x3c3c26){var _0x3c2580={};var _0x28e5af={};var _0xa5c9b3;var _0x58f61d;return db[_0x6e8a('0x2a')]['findOne']({'where':{'id':_0x529b4e[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x9eb014,null))['then'](function(_0x455fff){if(_0x455fff){_0xa5c9b3=_0x455fff;_0x28e5af[_0x6e8a('0x2d')]=_[_0x6e8a('0x2f')](db[_0x6e8a('0x5c')]['rawAttributes']);_0x28e5af['query']=_[_0x6e8a('0x2f')](_0x529b4e[_0x6e8a('0x2e')]);_0x28e5af[_0x6e8a('0x30')]=_['intersection'](_0x28e5af[_0x6e8a('0x2d')],_0x28e5af[_0x6e8a('0x2e')]);_0x3c2580[_0x6e8a('0x31')]=_[_0x6e8a('0x32')](_0x28e5af[_0x6e8a('0x2d')],qs['fields'](_0x529b4e['query'][_0x6e8a('0x33')]));_0x3c2580[_0x6e8a('0x31')]=_0x3c2580['attributes'][_0x6e8a('0x34')]?_0x3c2580[_0x6e8a('0x31')]:_0x28e5af[_0x6e8a('0x2d')];_0x3c2580[_0x6e8a('0x37')]=qs[_0x6e8a('0x38')](_0x529b4e['query']['sort']);_0x3c2580[_0x6e8a('0x39')]=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x529b4e[_0x6e8a('0x2e')],_0x28e5af['filters']));if(_0x529b4e['query']['filter']){_0x3c2580[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x3c2580[_0x6e8a('0x39')],{'$or':_[_0x6e8a('0x29')](_0x3c2580[_0x6e8a('0x31')],function(_0x4cb49b){var _0xf5460f={};_0xf5460f[_0x4cb49b]={'$like':'%'+_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x54')]+'%'};return _0xf5460f;})});}_0x3c2580=_[_0x6e8a('0x3b')]({},_0x3c2580,_0x529b4e[_0x6e8a('0x42')]);return _0xa5c9b3[_0x6e8a('0x5b')](_0x3c2580);}})['then'](function(_0x2b9529){if(_0x2b9529){_0x58f61d=_0x2b9529['length'];if(!_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x3c2580[_0x6e8a('0x1f')]=qs['limit'](_0x529b4e[_0x6e8a('0x2e')]['limit']);_0x3c2580[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x529b4e[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}return _0xa5c9b3['getTeams'](_0x3c2580);}})[_0x6e8a('0x24')](function(_0x14fec6){if(_0x14fec6){return _0x14fec6?{'count':_0x58f61d,'rows':_0x14fec6}:null;}})[_0x6e8a('0x24')](respondWithResult(_0x9eb014,null))[_0x6e8a('0x40')](handleError(_0x9eb014,null));};exports['addTeams']=function(_0x1916db,_0x325e21,_0x5d22d6){var _0x510bd5=_0x1916db['body'][_0x6e8a('0x5d')];return db['Team'][_0x6e8a('0x3e')]({'where':{'id':_0x510bd5},'attributes':['id'],'include':[{'model':db[_0x6e8a('0x55')],'as':_0x6e8a('0x5e'),'attributes':['id',_0x6e8a('0x27'),_0x6e8a('0x5f'),'voicePause',_0x6e8a('0x60')],'raw':!![]}]})[_0x6e8a('0x24')](function(_0x524bc3){if(_0x524bc3){var _0x4e24db=_['flatMap'](_0x524bc3,function(_0x2a6271){var _0x340528=_0x2a6271['get']({'plain':!![]});return _0x340528[_0x6e8a('0x5e')];});return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x1916db[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](function(_0x24c1e0){return db[_0x6e8a('0x61')][_0x6e8a('0x62')](function(_0x294c0a){return _0x24c1e0[_0x6e8a('0x63')](_0x510bd5,{'transaction':_0x294c0a})['then'](function(){return BPromise[_0x6e8a('0x64')](_0x4e24db,function(_0x3cbbf5){return db[_0x6e8a('0x52')][_0x6e8a('0x65')]({'where':{'UserId':_0x3cbbf5['id'],'WhatsappQueueId':_0x1916db[_0x6e8a('0x41')]['id']},'transaction':_0x294c0a});});})[_0x6e8a('0x24')](function(){_0x4e24db['forEach'](function(_0x2bdb5b){socket[_0x6e8a('0x66')](_0x6e8a('0x67'),{'UserId':_0x2bdb5b['id'],'WhatsappQueueId':_0x24c1e0['id']});});});});});}})[_0x6e8a('0x24')](respondWithStatusCode(_0x325e21,null))[_0x6e8a('0x40')](handleError(_0x325e21,null));};exports[_0x6e8a('0x68')]=function(_0x125b00,_0x5d316a,_0x313aa4){return db[_0x6e8a('0x5c')]['findAll']({'where':{'id':_0x125b00[_0x6e8a('0x2e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6e8a('0x55')],'as':_0x6e8a('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x6e8a('0x24')](handleEntityNotFound(_0x5d316a,null))[_0x6e8a('0x24')](function(_0x2dcf22){var _0x179ae9=_['map'](_0x2dcf22,'id');var _0x4f7717=[];var _0x1e91d8=[];var _0x157686=squel[_0x6e8a('0x69')]();_0x157686[_0x6e8a('0x6a')]('tq.TeamId')[_0x6e8a('0x6b')](_0x6e8a('0x6c'),'tq')[_0x6e8a('0x6d')](_0x6e8a('0x6e'),'ut',_0x6e8a('0x6f'))['where'](_0x6e8a('0x70'),_0x125b00[_0x6e8a('0x41')]['id']);for(var _0x14525c=0x0;_0x14525c<_0x2dcf22[_0x6e8a('0x34')];_0x14525c+=0x1){let _0x3a96ec=_0x2dcf22[_0x14525c];for(var _0x2aec6e=0x0;_0x2aec6e<_0x3a96ec[_0x6e8a('0x5e')][_0x6e8a('0x34')];_0x2aec6e+=0x1){let _0x202cf1=_0x3a96ec[_0x6e8a('0x5e')][_0x2aec6e];var _0x9e0a78=_0x157686[_0x6e8a('0x71')]();_0x9e0a78[_0x6e8a('0x39')]('ut.UserId\x20=\x20?',_0x202cf1['id']);_0x1e91d8[_0x6e8a('0x72')](db['sequelize'][_0x6e8a('0x2e')](_0x9e0a78[_0x6e8a('0x73')](),{'type':db[_0x6e8a('0x61')][_0x6e8a('0x74')]['SELECT']})['then'](function(_0x44ce50){if(_0x44ce50['length']===0x1){return _0x202cf1['id'];}else{var _0x2f82c7=_[_0x6e8a('0x75')](_['map'](_0x44ce50,_0x6e8a('0x76')),function(_0x3b6d98){return _['includes'](_0x179ae9,_0x3b6d98);});if(_0x2f82c7){return _0x202cf1['id'];}}}));}}return BPromise[_0x6e8a('0x77')](_0x1e91d8)[_0x6e8a('0x24')](function(_0x291b94){_0x4f7717=_(_0x4f7717)['union'](_0x291b94)[_0x6e8a('0x78')]()[_0x6e8a('0x79')]();return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x125b00[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](function(_0x197930){return db[_0x6e8a('0x61')]['transaction'](function(_0x7df211){return _0x197930[_0x6e8a('0x68')](_0x125b00['query'][_0x6e8a('0x5d')],{'transaction':_0x7df211})['then'](function(){if(!_[_0x6e8a('0x7a')](_0x4f7717)){return _0x197930[_0x6e8a('0x7b')](_0x4f7717,{'transaction':_0x7df211});}})[_0x6e8a('0x24')](function(){_0x4f7717[_0x6e8a('0x7c')](function(_0x48ed12){socket[_0x6e8a('0x66')]('userWhatsappQueue:remove',{'UserId':_0x48ed12,'WhatsappQueueId':_0x197930['id']});});});});});});})[_0x6e8a('0x24')](respondWithStatusCode(_0x5d316a,null))[_0x6e8a('0x40')](handleError(_0x5d316a,null));};exports[_0x6e8a('0x7d')]=function(_0x49f99f,_0x57d3da,_0x354148){return db[_0x6e8a('0x2a')][_0x6e8a('0x43')]({'where':{'id':_0x49f99f[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x57d3da,null))['then'](function(_0x436244){if(_0x436244){return _0x436244[_0x6e8a('0x7d')](_0x49f99f['body'][_0x6e8a('0x5d')],_[_0x6e8a('0x7e')](_0x49f99f[_0x6e8a('0x4f')],[_0x6e8a('0x5d'),'id'])||{})['spread'](function(_0xa88338){for(var _0x40b116=0x0;_0x40b116<_0x49f99f[_0x6e8a('0x4f')][_0x6e8a('0x5d')]['length'];_0x40b116+=0x1){socket[_0x6e8a('0x66')](_0x6e8a('0x67'),{'UserId':_0x49f99f['body'][_0x6e8a('0x5d')][_0x40b116],'WhatsappQueueId':_0x49f99f[_0x6e8a('0x41')]['id']});}return _0xa88338;});}})[_0x6e8a('0x24')](respondWithResult(_0x57d3da,null))[_0x6e8a('0x40')](handleError(_0x57d3da,null));};exports[_0x6e8a('0x7b')]=function(_0x5d6912,_0x51c34f,_0x44ab30){return db[_0x6e8a('0x2a')]['find']({'where':{'id':_0x5d6912['params']['id']}})['then'](handleEntityNotFound(_0x51c34f,null))[_0x6e8a('0x24')](function(_0xa0c7e1){if(_0xa0c7e1){return _0xa0c7e1['removeAgents'](_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')])[_0x6e8a('0x24')](function(){if(_['isArray'](_0x5d6912[_0x6e8a('0x2e')]['ids'])){for(var _0x2fd0b8=0x0;_0x2fd0b8<_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')][_0x6e8a('0x34')];_0x2fd0b8+=0x1){socket[_0x6e8a('0x66')]('userWhatsappQueue:remove',{'UserId':Number(_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')][_0x2fd0b8]),'WhatsappQueueId':Number(_0x5d6912[_0x6e8a('0x41')]['id'])});}}else{socket[_0x6e8a('0x66')](_0x6e8a('0x7f'),{'UserId':Number(_0x5d6912[_0x6e8a('0x2e')][_0x6e8a('0x5d')]),'WhatsappQueueId':Number(_0x5d6912[_0x6e8a('0x41')]['id'])});}});}})[_0x6e8a('0x24')](respondWithStatusCode(_0x51c34f,null))['catch'](handleError(_0x51c34f,null));};exports[_0x6e8a('0x80')]=function(_0x3e77ab,_0x108e63,_0x56c7c9){var _0x2f89dd={};var _0x51c0b5={};var _0x4ac2a9;var _0x2e583a;return db[_0x6e8a('0x2a')][_0x6e8a('0x81')]({'where':{'id':_0x3e77ab[_0x6e8a('0x41')]['id']}})[_0x6e8a('0x24')](handleEntityNotFound(_0x108e63,null))['then'](function(_0x3a7150){if(_0x3a7150){_0x4ac2a9=_0x3a7150;_0x51c0b5['model']=_['keys'](db[_0x6e8a('0x55')][_0x6e8a('0x2b')]);_0x51c0b5[_0x6e8a('0x2e')]=_[_0x6e8a('0x2f')](_0x3e77ab[_0x6e8a('0x2e')]);_0x51c0b5['filters']=_[_0x6e8a('0x32')](_0x51c0b5[_0x6e8a('0x2d')],_0x51c0b5[_0x6e8a('0x2e')]);_0x2f89dd['attributes']=_['intersection'](_0x51c0b5[_0x6e8a('0x2d')],qs[_0x6e8a('0x33')](_0x3e77ab['query'][_0x6e8a('0x33')]));_0x2f89dd[_0x6e8a('0x31')]=_0x2f89dd[_0x6e8a('0x31')][_0x6e8a('0x34')]?_0x2f89dd[_0x6e8a('0x31')]:_0x51c0b5[_0x6e8a('0x2d')];_0x2f89dd['order']=qs['sort'](_0x3e77ab['query'][_0x6e8a('0x38')]);_0x2f89dd['where']=qs[_0x6e8a('0x30')](_[_0x6e8a('0x3a')](_0x3e77ab['query'],_0x51c0b5['filters']));if(_0x3e77ab['query'][_0x6e8a('0x54')]){_0x2f89dd[_0x6e8a('0x39')]=_[_0x6e8a('0x3b')](_0x2f89dd[_0x6e8a('0x39')],{'$or':_['map'](_0x2f89dd[_0x6e8a('0x31')],function(_0x2f3f70){var _0x5bbdff={};_0x5bbdff[_0x2f3f70]={'$like':'%'+_0x3e77ab['query'][_0x6e8a('0x54')]+'%'};return _0x5bbdff;})});}_0x2f89dd=_['merge']({},_0x2f89dd,_0x3e77ab[_0x6e8a('0x42')]);return _0x4ac2a9[_0x6e8a('0x80')](_0x2f89dd);}})[_0x6e8a('0x24')](function(_0x3a2d0a){if(_0x3a2d0a){_0x2e583a=_0x3a2d0a[_0x6e8a('0x34')];if(!_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x35')](_0x6e8a('0x36'))){_0x2f89dd[_0x6e8a('0x1f')]=qs[_0x6e8a('0x1f')](_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x1f')]);_0x2f89dd[_0x6e8a('0x1e')]=qs[_0x6e8a('0x1e')](_0x3e77ab[_0x6e8a('0x2e')][_0x6e8a('0x1e')]);}return _0x4ac2a9[_0x6e8a('0x80')](_0x2f89dd);}})[_0x6e8a('0x24')](function(_0x5cdb2b){if(_0x5cdb2b){return _0x5cdb2b?{'count':_0x2e583a,'rows':_0x5cdb2b}:null;}})[_0x6e8a('0x24')](respondWithResult(_0x108e63,null))[_0x6e8a('0x40')](handleError(_0x108e63,null));}; \ No newline at end of file +var _0xa0ef=['save','update','destroy','then','WhatsappQueues','UserProfileResource','sendStatus','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','show','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','findAll','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','emit','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','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','defaults','redis','socket.io-emitter','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xa0ef,0x183));var _0xfa0e=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0xa0ef[_0x2cef86];return _0x46dfd6;};'use strict';var pdf=require(_0xfa0e('0x0'));var emlformat=require(_0xfa0e('0x1'));var rimraf=require(_0xfa0e('0x2'));var zipdir=require(_0xfa0e('0x3'));var jsonpatch=require(_0xfa0e('0x4'));var rp=require(_0xfa0e('0x5'));var moment=require(_0xfa0e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfa0e('0x7'));var util=require(_0xfa0e('0x8'));var path=require('path');var sox=require(_0xfa0e('0x9'));var csv=require(_0xfa0e('0xa'));var ejs=require(_0xfa0e('0xb'));var fs=require('fs');var _=require(_0xfa0e('0xc'));var squel=require(_0xfa0e('0xd'));var crypto=require('crypto');var jsforce=require(_0xfa0e('0xe'));var deskjs=require(_0xfa0e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa0e('0x10'));var Redis=require('ioredis');var authService=require(_0xfa0e('0x11'));var qs=require(_0xfa0e('0x12'));var as=require(_0xfa0e('0x13'));var hardwareService=require(_0xfa0e('0x14'));var logger=require(_0xfa0e('0x15'))(_0xfa0e('0x16'));var utils=require('../../config/utils');var config=require(_0xfa0e('0x17'));var licenseUtil=require(_0xfa0e('0x18'));var db=require(_0xfa0e('0x19'))['db'];config['redis']=_[_0xfa0e('0x1a')](config[_0xfa0e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa0e('0x1c'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x28eb8f,_0x54a673){_0x54a673=_0x54a673||0xcc;return function(_0x264b07){if(_0x264b07){return _0x28eb8f['sendStatus'](_0x54a673);}return _0x28eb8f[_0xfa0e('0x1d')](_0x54a673)[_0xfa0e('0x1e')]();};}function respondWithResult(_0x2094d8,_0x7141d9){_0x7141d9=_0x7141d9||0xc8;return function(_0x1a1603){if(_0x1a1603){return _0x2094d8[_0xfa0e('0x1d')](_0x7141d9)[_0xfa0e('0x1f')](_0x1a1603);}};}function respondWithFilteredResult(_0x442f97,_0x104c9b){return function(_0x21caa1){if(_0x21caa1){var _0x2827b3=_0x21caa1[_0xfa0e('0x20')],_0x4a7093=_0x104c9b['offset'],_0x5f15ab=_0x104c9b[_0xfa0e('0x21')]+_0x104c9b[_0xfa0e('0x22')],_0x6cb151;if(_0x5f15ab>=_0x2827b3){_0x5f15ab=_0x2827b3;_0x6cb151=0xc8;}else{_0x6cb151=0xce;}_0x442f97[_0xfa0e('0x1d')](_0x6cb151);return _0x442f97[_0xfa0e('0x23')](_0xfa0e('0x24'),_0x4a7093+'-'+_0x5f15ab+'/'+_0x2827b3)[_0xfa0e('0x1f')](_0x21caa1);}return null;};}function patchUpdates(_0x51082c){return function(_0xb46d3e){try{jsonpatch[_0xfa0e('0x25')](_0xb46d3e,_0x51082c,!![]);}catch(_0x3a1224){return BPromise[_0xfa0e('0x26')](_0x3a1224);}return _0xb46d3e[_0xfa0e('0x27')]();};}function saveUpdates(_0x5154af,_0x1ff80a){return function(_0x37bb9f){if(_0x37bb9f){return _0x37bb9f[_0xfa0e('0x28')](_0x5154af)['then'](function(_0x9a5c98){return _0x9a5c98;});}return null;};}function removeEntity(_0x49752c,_0x26cd8e){return function(_0xd525db){if(_0xd525db){return _0xd525db[_0xfa0e('0x29')]()[_0xfa0e('0x2a')](function(){var _0x3e577f=_0xd525db['get']({'plain':!![]});var _0x5b914a=_0xfa0e('0x2b');return db[_0xfa0e('0x2c')][_0xfa0e('0x29')]({'where':{'type':_0x5b914a,'resourceId':_0x3e577f['id']}})[_0xfa0e('0x2a')](function(){return _0xd525db;});})[_0xfa0e('0x2a')](function(){_0x49752c['status'](0xcc)[_0xfa0e('0x1e')]();});}};}function handleEntityNotFound(_0x3a9862,_0x4c4ef1){return function(_0x465bad){if(!_0x465bad){_0x3a9862[_0xfa0e('0x2d')](0x194);}return _0x465bad;};}function handleError(_0x8d77ca,_0x3d570e){_0x3d570e=_0x3d570e||0x1f4;return function(_0x2d5266){logger['error'](_0x2d5266['stack']);if(_0x2d5266['name']){delete _0x2d5266[_0xfa0e('0x2e')];}_0x8d77ca['status'](_0x3d570e)[_0xfa0e('0x2f')](_0x2d5266);};}exports[_0xfa0e('0x30')]=function(_0x354c4b,_0xce8dbe){var _0x158a08={},_0x4386e4={},_0x2c6f44={'count':0x0,'rows':[]};var _0x41afb7=_[_0xfa0e('0x31')](db[_0xfa0e('0x32')][_0xfa0e('0x33')],function(_0x26215b){return{'name':_0x26215b[_0xfa0e('0x34')],'type':_0x26215b['type']['key']};});_0x4386e4[_0xfa0e('0x35')]=_[_0xfa0e('0x31')](_0x41afb7,_0xfa0e('0x2e'));_0x4386e4[_0xfa0e('0x36')]=_['keys'](_0x354c4b[_0xfa0e('0x36')]);_0x4386e4[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x4386e4[_0xfa0e('0x35')],_0x4386e4['query']);_0x158a08[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x4386e4[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x3a')]));_0x158a08[_0xfa0e('0x39')]=_0x158a08[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x158a08[_0xfa0e('0x39')]:_0x4386e4[_0xfa0e('0x35')];if(!_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x3c')](_0xfa0e('0x3d'))){_0x158a08[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0x158a08[_0xfa0e('0x21')]=qs[_0xfa0e('0x21')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x21')]);}_0x158a08[_0xfa0e('0x3e')]=qs[_0xfa0e('0x3f')](_0x354c4b['query']['sort']);_0x158a08[_0xfa0e('0x40')]=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0x354c4b[_0xfa0e('0x36')],_0x4386e4[_0xfa0e('0x37')]),_0x41afb7);if(_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x42')]){_0x158a08[_0xfa0e('0x40')]=_[_0xfa0e('0x43')](_0x158a08[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0x41afb7,function(_0x5153c3){if(_0x5153c3[_0xfa0e('0x44')]!==_0xfa0e('0x45')){var _0x1ab503={};_0x1ab503[_0x5153c3[_0xfa0e('0x2e')]]={'$like':'%'+_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x1ab503;}})});}_0x158a08=_[_0xfa0e('0x43')]({},_0x158a08,_0x354c4b['options']);var _0x4d3c74={'where':_0x158a08['where']};return db[_0xfa0e('0x32')][_0xfa0e('0x20')](_0x4d3c74)[_0xfa0e('0x2a')](function(_0x2259a3){_0x2c6f44[_0xfa0e('0x20')]=_0x2259a3;if(_0x354c4b['query'][_0xfa0e('0x46')]){_0x158a08[_0xfa0e('0x47')]=[{'all':!![]}];}return db[_0xfa0e('0x32')]['findAll'](_0x158a08);})[_0xfa0e('0x2a')](function(_0x33308a){_0x2c6f44['rows']=_0x33308a;return _0x2c6f44;})[_0xfa0e('0x2a')](respondWithFilteredResult(_0xce8dbe,_0x158a08))['catch'](handleError(_0xce8dbe,null));};exports[_0xfa0e('0x48')]=function(_0x1e7c01,_0x1f3977){var _0x34e834={'raw':!![],'where':{'id':_0x1e7c01[_0xfa0e('0x49')]['id']}},_0x5e6944={};_0x5e6944[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db['WhatsappQueue'][_0xfa0e('0x33')]);_0x5e6944['query']=_[_0xfa0e('0x4a')](_0x1e7c01['query']);_0x5e6944[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x5e6944[_0xfa0e('0x35')],_0x5e6944['query']);_0x34e834[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x5e6944[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x1e7c01['query'][_0xfa0e('0x3a')]));_0x34e834[_0xfa0e('0x39')]=_0x34e834[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x34e834[_0xfa0e('0x39')]:_0x5e6944[_0xfa0e('0x35')];if(_0x1e7c01[_0xfa0e('0x36')]['includeAll']){_0x34e834[_0xfa0e('0x47')]=[{'all':!![]}];}_0x34e834=_[_0xfa0e('0x43')]({},_0x34e834,_0x1e7c01['options']);return db[_0xfa0e('0x32')]['find'](_0x34e834)[_0xfa0e('0x2a')](handleEntityNotFound(_0x1f3977,null))[_0xfa0e('0x2a')](respondWithResult(_0x1f3977,null))[_0xfa0e('0x4b')](handleError(_0x1f3977,null));};exports[_0xfa0e('0x4c')]=function(_0x4722e7,_0x4cd496){return db[_0xfa0e('0x32')][_0xfa0e('0x4c')](_0x4722e7[_0xfa0e('0x4d')],{})[_0xfa0e('0x2a')](function(_0x1a318c){var _0x4732cf=_0x4722e7['user']['get']({'plain':!![]});if(!_0x4732cf)throw new Error(_0xfa0e('0x4e'));if(_0x4732cf[_0xfa0e('0x4f')]===_0xfa0e('0x50')){var _0x39bc70=_0x1a318c[_0xfa0e('0x51')]({'plain':!![]});var _0x33bc59=_0xfa0e('0x2b');return db['UserProfileSection'][_0xfa0e('0x52')]({'where':{'name':_0x33bc59,'userProfileId':_0x4732cf[_0xfa0e('0x53')]},'raw':!![]})['then'](function(_0xf0780b){if(_0xf0780b&&_0xf0780b['autoAssociation']===0x0){return db[_0xfa0e('0x2c')][_0xfa0e('0x4c')]({'name':_0x39bc70['name'],'resourceId':_0x39bc70['id'],'type':_0xf0780b['name'],'sectionId':_0xf0780b['id']},{})[_0xfa0e('0x2a')](function(){return _0x1a318c;});}else{return _0x1a318c;}})[_0xfa0e('0x4b')](function(_0x439314){logger[_0xfa0e('0x54')](_0xfa0e('0x55'),_0x439314);throw _0x439314;});}return _0x1a318c;})[_0xfa0e('0x2a')](respondWithResult(_0x4cd496,0xc9))[_0xfa0e('0x4b')](handleError(_0x4cd496,null));};exports[_0xfa0e('0x28')]=function(_0x5d365d,_0x5513f6){if(_0x5d365d[_0xfa0e('0x4d')]['id']){delete _0x5d365d[_0xfa0e('0x4d')]['id'];}return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x5d365d[_0xfa0e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5513f6,null))[_0xfa0e('0x2a')](saveUpdates(_0x5d365d[_0xfa0e('0x4d')],null))[_0xfa0e('0x2a')](respondWithResult(_0x5513f6,null))[_0xfa0e('0x4b')](handleError(_0x5513f6,null));};exports[_0xfa0e('0x29')]=function(_0xac9895,_0x109b9e){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0xac9895['params']['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x109b9e,null))[_0xfa0e('0x2a')](removeEntity(_0x109b9e,null))['catch'](handleError(_0x109b9e,null));};exports['describe']=function(_0x1993a8,_0x2eaa21){return db[_0xfa0e('0x32')][_0xfa0e('0x56')]()['then'](respondWithResult(_0x2eaa21,null))[_0xfa0e('0x4b')](handleError(_0x2eaa21,null));};exports[_0xfa0e('0x57')]=function(_0x297973,_0x211579,_0x48e2b4){var _0x3d0a36={'raw':!![],'where':{}},_0x4799a9={},_0x34fe55;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0x297973[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x211579,null))[_0xfa0e('0x2a')](function(_0xea01e2){if(_0xea01e2){_0x34fe55=_0xea01e2['get']({'plain':!![]});_0x4799a9[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x59')][_0xfa0e('0x33')]);_0x4799a9['query']=_[_0xfa0e('0x4a')](_0x297973[_0xfa0e('0x36')]);_0x4799a9[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x4799a9[_0xfa0e('0x35')],_0x4799a9[_0xfa0e('0x36')]);_0x3d0a36['attributes']=_[_0xfa0e('0x38')](_0x4799a9[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x297973[_0xfa0e('0x36')]['fields']));_0x3d0a36['attributes']=_0x3d0a36[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x3d0a36[_0xfa0e('0x39')]:_0x4799a9[_0xfa0e('0x35')];if(!_0x297973[_0xfa0e('0x36')]['hasOwnProperty'](_0xfa0e('0x3d'))){_0x3d0a36[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x297973[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0x3d0a36[_0xfa0e('0x21')]=qs['offset'](_0x297973['query']['offset']);}_0x3d0a36['order']=qs[_0xfa0e('0x3f')](_0x297973[_0xfa0e('0x36')][_0xfa0e('0x3f')]);_0x3d0a36[_0xfa0e('0x40')]=qs['filters'](_[_0xfa0e('0x41')](_0x297973['query'],_0x4799a9[_0xfa0e('0x37')]));_0x3d0a36[_0xfa0e('0x40')]['WhatsappQueueId']=_0xea01e2['id'];if(_0x297973[_0xfa0e('0x36')][_0xfa0e('0x42')]){_0x3d0a36['where']=_[_0xfa0e('0x43')](_0x3d0a36[_0xfa0e('0x40')],{'$or':_['map'](_0x3d0a36[_0xfa0e('0x39')],function(_0x1bc0a0){var _0x2e7b84={};_0x2e7b84[_0x1bc0a0]={'$like':'%'+_0x297973[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x2e7b84;})});}_0x3d0a36=_[_0xfa0e('0x43')]({},_0x3d0a36,_0x297973['options']);return db[_0xfa0e('0x59')][_0xfa0e('0x5a')](_0x3d0a36);}})[_0xfa0e('0x2a')](function(_0x4051a9){if(_0x4051a9){return db['User']['findAndCountAll']({'where':{'id':_[_0xfa0e('0x31')](_0x4051a9,'UserId'),'role':'agent'},'attributes':['id',_0xfa0e('0x2e'),_0xfa0e('0x5b'),_0xfa0e('0x5c'),_0xfa0e('0x5d')]});}})['then'](function(_0x200116){if(_0x200116){return{'count':_0x200116['count'],'rows':_['map'](_0x200116['rows'],function(_0x374205){return{'membername':_0x374205[_0xfa0e('0x2e')],'UserId':_0x374205['id'],'queue_name':_0x34fe55[_0xfa0e('0x2e')],'WhatsappQueueId':_0x34fe55['id'],'interface':util[_0xfa0e('0x5e')](_0xfa0e('0x5f'),_0xfa0e('0x60'),_0x374205[_0xfa0e('0x2e')]),'penalty':0x0,'paused':_0x374205[_0xfa0e('0x5b')],'createdAt':_0x374205[_0xfa0e('0x5d')],'updatedAt':_0x374205[_0xfa0e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa0e('0x2a')](respondWithFilteredResult(_0x211579,_0x3d0a36))[_0xfa0e('0x4b')](handleError(_0x211579,null));};exports[_0xfa0e('0x61')]=function(_0x233b31,_0xe37b82,_0x1889f6){var _0xb30f8c={};var _0x84227d={};var _0x1dc264;var _0x5f059a;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0x233b31[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0xe37b82,null))[_0xfa0e('0x2a')](function(_0x8a9946){if(_0x8a9946){_0x1dc264=_0x8a9946;_0x84227d[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x62')][_0xfa0e('0x33')]);_0x84227d['query']=_[_0xfa0e('0x4a')](_0x233b31[_0xfa0e('0x36')]);_0x84227d[_0xfa0e('0x37')]=_['intersection'](_0x84227d[_0xfa0e('0x35')],_0x84227d[_0xfa0e('0x36')]);_0xb30f8c[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x84227d['model'],qs[_0xfa0e('0x3a')](_0x233b31[_0xfa0e('0x36')]['fields']));_0xb30f8c['attributes']=_0xb30f8c[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0xb30f8c['attributes']:_0x84227d['model'];_0xb30f8c[_0xfa0e('0x3e')]=qs['sort'](_0x233b31['query'][_0xfa0e('0x3f')]);_0xb30f8c[_0xfa0e('0x40')]=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0x233b31[_0xfa0e('0x36')],_0x84227d[_0xfa0e('0x37')]));if(_0x233b31[_0xfa0e('0x36')]['filter']){_0xb30f8c[_0xfa0e('0x40')]=_[_0xfa0e('0x43')](_0xb30f8c[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0xb30f8c['attributes'],function(_0x5ac544){var _0x3f347c={};_0x3f347c[_0x5ac544]={'$like':'%'+_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x3f347c;})});}_0xb30f8c=_[_0xfa0e('0x43')]({},_0xb30f8c,_0x233b31[_0xfa0e('0x63')]);return _0x1dc264[_0xfa0e('0x61')](_0xb30f8c);}})[_0xfa0e('0x2a')](function(_0x1f7646){if(_0x1f7646){_0x5f059a=_0x1f7646[_0xfa0e('0x3b')];if(!_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x3c')]('nolimit')){_0xb30f8c[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0xb30f8c[_0xfa0e('0x21')]=qs['offset'](_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x21')]);}return _0x1dc264[_0xfa0e('0x61')](_0xb30f8c);}})[_0xfa0e('0x2a')](function(_0x3942f8){if(_0x3942f8){return _0x3942f8?{'count':_0x5f059a,'rows':_0x3942f8}:null;}})[_0xfa0e('0x2a')](respondWithResult(_0xe37b82,null))['catch'](handleError(_0xe37b82,null));};exports[_0xfa0e('0x64')]=function(_0x33be72,_0x2d5e1e,_0xddd412){var _0x97e12c=_0x33be72['body'][_0xfa0e('0x65')];return db[_0xfa0e('0x62')][_0xfa0e('0x5a')]({'where':{'id':_0x97e12c},'attributes':['id'],'include':[{'model':db[_0xfa0e('0x66')],'as':_0xfa0e('0x67'),'attributes':['id',_0xfa0e('0x2e'),_0xfa0e('0x68'),_0xfa0e('0x69'),_0xfa0e('0x6a')],'raw':!![]}]})['then'](function(_0x4a15d6){if(_0x4a15d6){var _0xa71690=_['flatMap'](_0x4a15d6,function(_0xe746c3){var _0x3a740d=_0xe746c3[_0xfa0e('0x51')]({'plain':!![]});return _0x3a740d[_0xfa0e('0x67')];});return db[_0xfa0e('0x32')]['find']({'where':{'id':_0x33be72['params']['id']}})[_0xfa0e('0x2a')](function(_0x324a90){return db[_0xfa0e('0x6b')][_0xfa0e('0x6c')](function(_0x35dcea){return _0x324a90[_0xfa0e('0x64')](_0x97e12c,{'transaction':_0x35dcea})[_0xfa0e('0x2a')](function(){return BPromise[_0xfa0e('0x6d')](_0xa71690,function(_0xf3aca){return db[_0xfa0e('0x59')][_0xfa0e('0x6e')]({'where':{'UserId':_0xf3aca['id'],'WhatsappQueueId':_0x33be72[_0xfa0e('0x49')]['id']},'transaction':_0x35dcea});});})['then'](function(){_0xa71690['forEach'](function(_0x216b6f){socket['emit'](_0xfa0e('0x6f'),{'UserId':_0x216b6f['id'],'WhatsappQueueId':_0x324a90['id']});});});});});}})['then'](respondWithStatusCode(_0x2d5e1e,null))['catch'](handleError(_0x2d5e1e,null));};exports['removeTeams']=function(_0xbf7203,_0x44aaaa,_0x425cbc){return db[_0xfa0e('0x62')][_0xfa0e('0x5a')]({'where':{'id':_0xbf7203[_0xfa0e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfa0e('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa0e('0x2a')](handleEntityNotFound(_0x44aaaa,null))[_0xfa0e('0x2a')](function(_0x247881){var _0x3e6141=_[_0xfa0e('0x31')](_0x247881,'id');var _0x1c5608=[];var _0x2dfd9d=[];var _0x1a3638=squel[_0xfa0e('0x70')]();_0x1a3638[_0xfa0e('0x71')](_0xfa0e('0x72'))[_0xfa0e('0x73')](_0xfa0e('0x74'),'tq')[_0xfa0e('0x75')](_0xfa0e('0x76'),'ut',_0xfa0e('0x77'))['where'](_0xfa0e('0x78'),_0xbf7203[_0xfa0e('0x49')]['id']);for(var _0x37c166=0x0;_0x37c166<_0x247881[_0xfa0e('0x3b')];_0x37c166+=0x1){let _0x5ea829=_0x247881[_0x37c166];for(var _0x220a05=0x0;_0x220a05<_0x5ea829[_0xfa0e('0x67')][_0xfa0e('0x3b')];_0x220a05+=0x1){let _0x13cb89=_0x5ea829[_0xfa0e('0x67')][_0x220a05];var _0x4513d4=_0x1a3638[_0xfa0e('0x79')]();_0x4513d4['where'](_0xfa0e('0x7a'),_0x13cb89['id']);_0x2dfd9d[_0xfa0e('0x7b')](db[_0xfa0e('0x6b')]['query'](_0x4513d4[_0xfa0e('0x7c')](),{'type':db[_0xfa0e('0x6b')][_0xfa0e('0x7d')][_0xfa0e('0x7e')]})['then'](function(_0x4798b3){if(_0x4798b3['length']===0x1){return _0x13cb89['id'];}else{var _0x344f08=_[_0xfa0e('0x7f')](_[_0xfa0e('0x31')](_0x4798b3,'TeamId'),function(_0x1b630c){return _[_0xfa0e('0x80')](_0x3e6141,_0x1b630c);});if(_0x344f08){return _0x13cb89['id'];}}}));}}return BPromise['all'](_0x2dfd9d)[_0xfa0e('0x2a')](function(_0x28a258){_0x1c5608=_(_0x1c5608)['union'](_0x28a258)[_0xfa0e('0x81')]()[_0xfa0e('0x82')]();return db[_0xfa0e('0x32')]['find']({'where':{'id':_0xbf7203[_0xfa0e('0x49')]['id']}})['then'](function(_0x43a14a){return db[_0xfa0e('0x6b')][_0xfa0e('0x6c')](function(_0x2af07e){return _0x43a14a[_0xfa0e('0x83')](_0xbf7203[_0xfa0e('0x36')]['ids'],{'transaction':_0x2af07e})[_0xfa0e('0x2a')](function(){if(!_[_0xfa0e('0x84')](_0x1c5608)){return _0x43a14a[_0xfa0e('0x85')](_0x1c5608,{'transaction':_0x2af07e});}})['then'](function(){_0x1c5608[_0xfa0e('0x86')](function(_0x51aeef){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x51aeef,'WhatsappQueueId':_0x43a14a['id']});});});});});});})[_0xfa0e('0x2a')](respondWithStatusCode(_0x44aaaa,null))[_0xfa0e('0x4b')](handleError(_0x44aaaa,null));};exports[_0xfa0e('0x87')]=function(_0x58a439,_0x1a1b36,_0x191c8d){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x58a439[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x1a1b36,null))[_0xfa0e('0x2a')](function(_0x38efc1){if(_0x38efc1){return _0x38efc1[_0xfa0e('0x87')](_0x58a439['body'][_0xfa0e('0x65')],_[_0xfa0e('0x88')](_0x58a439[_0xfa0e('0x4d')],[_0xfa0e('0x65'),'id'])||{})[_0xfa0e('0x89')](function(_0x1009e3){for(var _0x4a5160=0x0;_0x4a5160<_0x58a439['body'][_0xfa0e('0x65')][_0xfa0e('0x3b')];_0x4a5160+=0x1){socket[_0xfa0e('0x8a')]('userWhatsappQueue:save',{'UserId':_0x58a439['body'][_0xfa0e('0x65')][_0x4a5160],'WhatsappQueueId':_0x58a439[_0xfa0e('0x49')]['id']});}return _0x1009e3;});}})[_0xfa0e('0x2a')](respondWithResult(_0x1a1b36,null))[_0xfa0e('0x4b')](handleError(_0x1a1b36,null));};exports[_0xfa0e('0x85')]=function(_0x567e92,_0x317ec7,_0x4fc4ab){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x567e92[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x317ec7,null))[_0xfa0e('0x2a')](function(_0x33cfc0){if(_0x33cfc0){return _0x33cfc0[_0xfa0e('0x85')](_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')])[_0xfa0e('0x2a')](function(){if(_[_0xfa0e('0x8b')](_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')])){for(var _0x5ac684=0x0;_0x5ac684<_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')]['length'];_0x5ac684+=0x1){socket['emit'](_0xfa0e('0x8c'),{'UserId':Number(_0x567e92[_0xfa0e('0x36')]['ids'][_0x5ac684]),'WhatsappQueueId':Number(_0x567e92[_0xfa0e('0x49')]['id'])});}}else{socket[_0xfa0e('0x8a')](_0xfa0e('0x8c'),{'UserId':Number(_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')]),'WhatsappQueueId':Number(_0x567e92[_0xfa0e('0x49')]['id'])});}});}})[_0xfa0e('0x2a')](respondWithStatusCode(_0x317ec7,null))[_0xfa0e('0x4b')](handleError(_0x317ec7,null));};exports[_0xfa0e('0x8d')]=function(_0xe9d391,_0x16e17f,_0x3cdb10){var _0x440533={};var _0x1faa8a={};var _0x2c4166;var _0x17f5fc;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0xe9d391['params']['id']}})['then'](handleEntityNotFound(_0x16e17f,null))['then'](function(_0x522732){if(_0x522732){_0x2c4166=_0x522732;_0x1faa8a[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x66')][_0xfa0e('0x33')]);_0x1faa8a['query']=_[_0xfa0e('0x4a')](_0xe9d391[_0xfa0e('0x36')]);_0x1faa8a[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x1faa8a['model'],_0x1faa8a[_0xfa0e('0x36')]);_0x440533[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x1faa8a[_0xfa0e('0x35')],qs['fields'](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x3a')]));_0x440533[_0xfa0e('0x39')]=_0x440533[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x440533[_0xfa0e('0x39')]:_0x1faa8a['model'];_0x440533['order']=qs[_0xfa0e('0x3f')](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x3f')]);_0x440533['where']=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0xe9d391['query'],_0x1faa8a[_0xfa0e('0x37')]));if(_0xe9d391[_0xfa0e('0x36')]['filter']){_0x440533['where']=_[_0xfa0e('0x43')](_0x440533[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0x440533[_0xfa0e('0x39')],function(_0x290553){var _0x3f31a9={};_0x3f31a9[_0x290553]={'$like':'%'+_0xe9d391['query'][_0xfa0e('0x42')]+'%'};return _0x3f31a9;})});}_0x440533=_[_0xfa0e('0x43')]({},_0x440533,_0xe9d391[_0xfa0e('0x63')]);return _0x2c4166[_0xfa0e('0x8d')](_0x440533);}})[_0xfa0e('0x2a')](function(_0x9141c7){if(_0x9141c7){_0x17f5fc=_0x9141c7[_0xfa0e('0x3b')];if(!_0xe9d391['query'][_0xfa0e('0x3c')](_0xfa0e('0x3d'))){_0x440533[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0xe9d391['query'][_0xfa0e('0x22')]);_0x440533[_0xfa0e('0x21')]=qs[_0xfa0e('0x21')](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x21')]);}return _0x2c4166[_0xfa0e('0x8d')](_0x440533);}})[_0xfa0e('0x2a')](function(_0x1c4b03){if(_0x1c4b03){return _0x1c4b03?{'count':_0x17f5fc,'rows':_0x1c4b03}:null;}})[_0xfa0e('0x2a')](respondWithResult(_0x16e17f,null))[_0xfa0e('0x4b')](handleError(_0x16e17f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e51c415..57f07af 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 _0x2928=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x2928,0x115));var _0x8292=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x2928[_0x2d89ce];return _0x3fad10;};'use strict';var EventEmitter=require(_0x8292('0x0'));var WhatsappQueue=require(_0x8292('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8292('0x2')](0x0);var events={'afterCreate':_0x8292('0x3'),'afterUpdate':_0x8292('0x4'),'afterDestroy':_0x8292('0x5')};function emitEvent(_0x3c3abc){return function(_0xb651d8,_0x449436,_0x1e776b){WhatsappQueueEvents['emit'](_0x3c3abc+':'+_0xb651d8['id'],_0xb651d8);WhatsappQueueEvents[_0x8292('0x6')](_0x3c3abc,_0xb651d8);_0x1e776b(null);};}for(var e in events){if(events[_0x8292('0x7')](e)){var event=events[e];WhatsappQueue[_0x8292('0x8')](e,emitEvent(event));}}module[_0x8292('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xab51=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0x1578c0,_0x12d552){var _0xa1c914=function(_0x2dfe41){while(--_0x2dfe41){_0x1578c0['push'](_0x1578c0['shift']());}};_0xa1c914(++_0x12d552);}(_0xab51,0xb2));var _0x1ab5=function(_0x152fc1,_0x19c30c){_0x152fc1=_0x152fc1-0x0;var _0x35cc62=_0xab51[_0x152fc1];return _0x35cc62;};'use strict';var EventEmitter=require(_0x1ab5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1ab5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ab5('0x2'),'afterUpdate':_0x1ab5('0x3'),'afterDestroy':_0x1ab5('0x4')};function emitEvent(_0x64fe61){return function(_0x14a12f,_0x5b8d8b,_0x4b49b8){WhatsappQueueEvents[_0x1ab5('0x5')](_0x64fe61+':'+_0x14a12f['id'],_0x14a12f);WhatsappQueueEvents['emit'](_0x64fe61,_0x14a12f);_0x4b49b8(null);};}for(var e in events){if(events[_0x1ab5('0x6')](e)){var event=events[e];WhatsappQueue[_0x1ab5('0x7')](e,emitEvent(event));}}module[_0x1ab5('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 923bba6..31c556e 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 _0x6796=['whatsapp_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x6796,0x1d5));var _0x6679=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x6796[_0x53b53e];return _0xbb6179;};'use strict';var _=require(_0x6679('0x0'));var util=require('util');var logger=require(_0x6679('0x1'))(_0x6679('0x2'));var moment=require('moment');var BPromise=require(_0x6679('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6679('0x4'));var rimraf=require(_0x6679('0x5'));var config=require(_0x6679('0x6'));var attributes=require(_0x6679('0x7'));module[_0x6679('0x8')]=function(_0x4868a7,_0x4767ef){return _0x4868a7[_0x6679('0x9')](_0x6679('0xa'),attributes,{'tableName':_0x6679('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd2=['rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x1aae23,_0x5d956f){var _0xd3b01d=function(_0x4be337){while(--_0x4be337){_0x1aae23['push'](_0x1aae23['shift']());}};_0xd3b01d(++_0x5d956f);}(_0x4cd2,0x89));var _0x24cd=function(_0x4cdae9,_0x14d25e){_0x4cdae9=_0x4cdae9-0x0;var _0x252c23=_0x4cd2[_0x4cdae9];return _0x252c23;};'use strict';var _=require(_0x24cd('0x0'));var util=require(_0x24cd('0x1'));var logger=require('../../config/logger')(_0x24cd('0x2'));var moment=require('moment');var BPromise=require(_0x24cd('0x3'));var rp=require(_0x24cd('0x4'));var fs=require('fs');var path=require(_0x24cd('0x5'));var rimraf=require(_0x24cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x24cd('0x7'));module[_0x24cd('0x8')]=function(_0x34d600,_0x19c75d){return _0x34d600['define'](_0x24cd('0x9'),attributes,{'tableName':_0x24cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index bf48dd3..b9c9040 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 _0x4c0a=['WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','then','info','GetWhatsappQueue','debug','ShowWhatsappQueue','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x1daf25,_0x456459){var _0x4cbf26=function(_0x27991e){while(--_0x27991e){_0x1daf25['push'](_0x1daf25['shift']());}};_0x4cbf26(++_0x456459);}(_0x4c0a,0x163));var _0xa4c0=function(_0x4210fa,_0x52b098){_0x4210fa=_0x4210fa-0x0;var _0x395294=_0x4c0a[_0x4210fa];return _0x395294;};'use strict';var _=require(_0xa4c0('0x0'));var util=require(_0xa4c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4c0('0x2'))['db'];var utils=require(_0xa4c0('0x3'));var logger=require('../../config/logger')(_0xa4c0('0x4'));var config=require(_0xa4c0('0x5'));var jayson=require(_0xa4c0('0x6'));var client=jayson[_0xa4c0('0x7')][_0xa4c0('0x8')]({'port':0x232a});config[_0xa4c0('0x9')]=_[_0xa4c0('0xa')](config[_0xa4c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4c0('0xb'))(new Redis(config['redis']));require(_0xa4c0('0xc'))[_0xa4c0('0xd')](socket);function respondWithRpcPromise(_0x802543,_0x16afc3,_0x484743){return new BPromise(function(_0x3e0fa5,_0x4b222a){return client[_0xa4c0('0xe')](_0x802543,_0x484743)['then'](function(_0x4ed530){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16afc3,'request\x20sent');logger['debug'](_0xa4c0('0xf'),_0x16afc3,_0xa4c0('0x10'),JSON[_0xa4c0('0x11')](_0x4ed530));if(_0x4ed530[_0xa4c0('0x12')]){if(_0x4ed530[_0xa4c0('0x12')]['code']===0x1f4){logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);return _0x4b222a(_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);}logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x4ed530[_0xa4c0('0x12')][_0xa4c0('0x14')]);return _0x3e0fa5(_0x4ed530['error'][_0xa4c0('0x14')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16afc3,'request\x20sent');_0x3e0fa5(_0x4ed530[_0xa4c0('0x15')][_0xa4c0('0x14')]);}})[_0xa4c0('0x16')](function(_0x82cf24){logger[_0xa4c0('0x12')](_0xa4c0('0x13'),_0x16afc3,_0x82cf24);_0x4b222a(_0x82cf24);});});}exports['GetWhatsappQueue']=function(_0x1e475f){var _0x240311=this;return new Promise(function(_0x3f9760,_0x196c8a){return db[_0xa4c0('0x17')]['findAll']({'raw':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x19')]===undefined?!![]:![]:!![],'where':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1a')]||null:null,'attributes':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')]['attributes']||null:null,'limit':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1b')]||null:null,'include':_0x1e475f[_0xa4c0('0x18')]?_0x1e475f[_0xa4c0('0x18')][_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x1e475f[_0xa4c0('0x18')]['include'],function(_0x44b7d2){return{'model':db[_0x44b7d2[_0xa4c0('0x1e')]],'as':_0x44b7d2['as'],'attributes':_0x44b7d2[_0xa4c0('0x1f')],'include':_0x44b7d2[_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x44b7d2[_0xa4c0('0x1c')],function(_0x3e4eb9){return{'model':db[_0x3e4eb9[_0xa4c0('0x1e')]],'as':_0x3e4eb9['as'],'attributes':_0x3e4eb9[_0xa4c0('0x1f')],'include':_0x3e4eb9[_0xa4c0('0x1c')]?_['map'](_0x3e4eb9[_0xa4c0('0x1c')],function(_0x36f7de){return{'model':db[_0x36f7de[_0xa4c0('0x1e')]],'as':_0x36f7de['as'],'attributes':_0x36f7de[_0xa4c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4c0('0x20')](function(_0x4c2666){logger[_0xa4c0('0x21')](_0xa4c0('0x22'),_0x1e475f);logger[_0xa4c0('0x23')](_0xa4c0('0x22'),_0x1e475f,JSON[_0xa4c0('0x11')](_0x4c2666));_0x3f9760(_0x4c2666);})[_0xa4c0('0x16')](function(_0x4e5f84){logger[_0xa4c0('0x12')](_0xa4c0('0x22'),_0x4e5f84[_0xa4c0('0x14')],_0x1e475f);_0x196c8a(_0x240311[_0xa4c0('0x12')](0x1f4,_0x4e5f84[_0xa4c0('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x6cbc9){var _0x2226fe=this;return new Promise(function(_0xc8adf8,_0x112ca1){return db[_0xa4c0('0x17')]['find']({'raw':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options'][_0xa4c0('0x19')]===undefined?!![]:![]:!![],'where':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9[_0xa4c0('0x18')][_0xa4c0('0x1a')]||null:null,'attributes':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options']['attributes']||null:null,'include':_0x6cbc9[_0xa4c0('0x18')]?_0x6cbc9['options'][_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x6cbc9[_0xa4c0('0x18')][_0xa4c0('0x1c')],function(_0x214832){return{'model':db[_0x214832[_0xa4c0('0x1e')]],'as':_0x214832['as'],'attributes':_0x214832[_0xa4c0('0x1f')],'include':_0x214832[_0xa4c0('0x1c')]?_[_0xa4c0('0x1d')](_0x214832[_0xa4c0('0x1c')],function(_0x3a4309){return{'model':db[_0x3a4309['model']],'as':_0x3a4309['as'],'attributes':_0x3a4309[_0xa4c0('0x1f')],'include':_0x3a4309['include']?_['map'](_0x3a4309[_0xa4c0('0x1c')],function(_0x162281){return{'model':db[_0x162281[_0xa4c0('0x1e')]],'as':_0x162281['as'],'attributes':_0x162281[_0xa4c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4c0('0x20')](function(_0xc07aee){logger[_0xa4c0('0x21')](_0xa4c0('0x24'),_0x6cbc9);logger[_0xa4c0('0x23')](_0xa4c0('0x24'),_0x6cbc9,JSON[_0xa4c0('0x11')](_0xc07aee));_0xc8adf8(_0xc07aee);})[_0xa4c0('0x16')](function(_0x445bce){logger[_0xa4c0('0x12')]('ShowWhatsappQueue',_0x445bce[_0xa4c0('0x14')],_0x6cbc9);_0x112ca1(_0x2226fe[_0xa4c0('0x12')](0x1f4,_0x445bce[_0xa4c0('0x14')]));});});}; \ No newline at end of file +var _0x0ddc=['code','message','result','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','then','GetWhatsappQueue','stringify','catch','find','ShowWhatsappQueue','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x41293b,_0x4e73cd){var _0x8a8ec9=function(_0x5cc114){while(--_0x5cc114){_0x41293b['push'](_0x41293b['shift']());}};_0x8a8ec9(++_0x4e73cd);}(_0x0ddc,0x1f3));var _0xc0dd=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x0ddc[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0xc0dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0dd('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0dd('0x2'));var logger=require(_0xc0dd('0x3'))('rpc');var config=require(_0xc0dd('0x4'));var jayson=require(_0xc0dd('0x5'));var client=jayson[_0xc0dd('0x6')][_0xc0dd('0x7')]({'port':0x232a});config[_0xc0dd('0x8')]=_[_0xc0dd('0x9')](config['redis'],{'host':_0xc0dd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc0dd('0xb'))[_0xc0dd('0xc')](socket);function respondWithRpcPromise(_0x1023b7,_0x4175f9,_0x58978f){return new BPromise(function(_0x415527,_0x59dd59){return client['request'](_0x1023b7,_0x58978f)['then'](function(_0x1811db){logger[_0xc0dd('0xd')](_0xc0dd('0xe'),_0x4175f9,_0xc0dd('0xf'));logger[_0xc0dd('0x10')](_0xc0dd('0x11'),_0x4175f9,_0xc0dd('0xf'),JSON['stringify'](_0x1811db));if(_0x1811db[_0xc0dd('0x12')]){if(_0x1811db[_0xc0dd('0x12')][_0xc0dd('0x13')]===0x1f4){logger[_0xc0dd('0x12')](_0xc0dd('0xe'),_0x4175f9,_0x1811db['error'][_0xc0dd('0x14')]);return _0x59dd59(_0x1811db[_0xc0dd('0x12')]['message']);}logger['error'](_0xc0dd('0xe'),_0x4175f9,_0x1811db[_0xc0dd('0x12')]['message']);return _0x415527(_0x1811db[_0xc0dd('0x12')][_0xc0dd('0x14')]);}else{logger[_0xc0dd('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x4175f9,_0xc0dd('0xf'));_0x415527(_0x1811db[_0xc0dd('0x15')]['message']);}})['catch'](function(_0x3d835c){logger[_0xc0dd('0x12')](_0xc0dd('0xe'),_0x4175f9,_0x3d835c);_0x59dd59(_0x3d835c);});});}exports['GetWhatsappQueue']=function(_0x288786){var _0x386bee=this;return new Promise(function(_0x17dbb7,_0x202731){return db[_0xc0dd('0x16')][_0xc0dd('0x17')]({'raw':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x19')]===undefined?!![]:![]:!![],'where':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1a')]||null:null,'attributes':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1b')]||null:null,'limit':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')]['limit']||null:null,'include':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1c')],function(_0x253880){return{'model':db[_0x253880[_0xc0dd('0x1e')]],'as':_0x253880['as'],'attributes':_0x253880['attributes'],'include':_0x253880[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x253880[_0xc0dd('0x1c')],function(_0x2feda7){return{'model':db[_0x2feda7[_0xc0dd('0x1e')]],'as':_0x2feda7['as'],'attributes':_0x2feda7[_0xc0dd('0x1b')],'include':_0x2feda7[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x2feda7[_0xc0dd('0x1c')],function(_0x386d26){return{'model':db[_0x386d26['model']],'as':_0x386d26['as'],'attributes':_0x386d26['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0dd('0x1f')](function(_0x4cf86a){logger[_0xc0dd('0xd')]('GetWhatsappQueue',_0x288786);logger[_0xc0dd('0x10')](_0xc0dd('0x20'),_0x288786,JSON[_0xc0dd('0x21')](_0x4cf86a));_0x17dbb7(_0x4cf86a);})[_0xc0dd('0x22')](function(_0x3807fe){logger['error'](_0xc0dd('0x20'),_0x3807fe['message'],_0x288786);_0x202731(_0x386bee[_0xc0dd('0x12')](0x1f4,_0x3807fe[_0xc0dd('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x1b4789){var _0x2051b2=this;return new Promise(function(_0x113c03,_0x548473){return db[_0xc0dd('0x16')][_0xc0dd('0x23')]({'raw':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789['options'][_0xc0dd('0x19')]===undefined?!![]:![]:!![],'where':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789[_0xc0dd('0x18')][_0xc0dd('0x1a')]||null:null,'attributes':_0x1b4789['options']?_0x1b4789[_0xc0dd('0x18')][_0xc0dd('0x1b')]||null:null,'include':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789['options']['include']?_[_0xc0dd('0x1d')](_0x1b4789[_0xc0dd('0x18')]['include'],function(_0x1ee688){return{'model':db[_0x1ee688[_0xc0dd('0x1e')]],'as':_0x1ee688['as'],'attributes':_0x1ee688[_0xc0dd('0x1b')],'include':_0x1ee688[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x1ee688[_0xc0dd('0x1c')],function(_0x5157f2){return{'model':db[_0x5157f2[_0xc0dd('0x1e')]],'as':_0x5157f2['as'],'attributes':_0x5157f2[_0xc0dd('0x1b')],'include':_0x5157f2[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x5157f2[_0xc0dd('0x1c')],function(_0x5b5fb7){return{'model':db[_0x5b5fb7[_0xc0dd('0x1e')]],'as':_0x5b5fb7['as'],'attributes':_0x5b5fb7[_0xc0dd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0dd('0x1f')](function(_0x3964b3){logger[_0xc0dd('0xd')](_0xc0dd('0x24'),_0x1b4789);logger[_0xc0dd('0x10')](_0xc0dd('0x24'),_0x1b4789,JSON[_0xc0dd('0x21')](_0x3964b3));_0x113c03(_0x3964b3);})['catch'](function(_0x28d0b7){logger[_0xc0dd('0x12')](_0xc0dd('0x24'),_0x28d0b7[_0xc0dd('0x14')],_0x1b4789);_0x548473(_0x2051b2[_0xc0dd('0x12')](0x1f4,_0x28d0b7[_0xc0dd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d256028..25623ff 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 _0xa42e=['remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x3fbd51,_0x40b693){var _0x60db65=function(_0x2a39e9){while(--_0x2a39e9){_0x3fbd51['push'](_0x3fbd51['shift']());}};_0x60db65(++_0x40b693);}(_0xa42e,0x1ae));var _0xea42=function(_0x3a2c05,_0x35384b){_0x3a2c05=_0x3a2c05-0x0;var _0x40d510=_0xa42e[_0x3a2c05];return _0x40d510;};'use strict';var WhatsappQueueEvents=require(_0xea42('0x0'));var events=[_0xea42('0x1'),_0xea42('0x2'),_0xea42('0x3')];function createListener(_0x1347bf,_0x19b2fa){return function(_0x33816e){_0x19b2fa['emit'](_0x1347bf,_0x33816e);};}function removeListener(_0x33e4db,_0x3e9736){return function(){WhatsappQueueEvents[_0xea42('0x4')](_0x33e4db,_0x3e9736);};}exports[_0xea42('0x5')]=function(_0xae2237){for(var _0x377516=0x0,_0xd98602=events[_0xea42('0x6')];_0x377516<_0xd98602;_0x377516++){var _0x39a61b=events[_0x377516];var _0x18dcb4=createListener(_0xea42('0x7')+_0x39a61b,_0xae2237);WhatsappQueueEvents['on'](_0x39a61b,_0x18dcb4);}}; \ No newline at end of file +var _0x21db=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x364328,_0x19870b){var _0x2ef999=function(_0x460a82){while(--_0x460a82){_0x364328['push'](_0x364328['shift']());}};_0x2ef999(++_0x19870b);}(_0x21db,0x11d));var _0xb21d=function(_0x147266,_0x5d557d){_0x147266=_0x147266-0x0;var _0x4731f5=_0x21db[_0x147266];return _0x4731f5;};'use strict';var WhatsappQueueEvents=require(_0xb21d('0x0'));var events=[_0xb21d('0x1'),_0xb21d('0x2'),_0xb21d('0x3')];function createListener(_0x3fd680,_0x581549){return function(_0x423871){_0x581549[_0xb21d('0x4')](_0x3fd680,_0x423871);};}function removeListener(_0x96df0a,_0x5c2e64){return function(){WhatsappQueueEvents[_0xb21d('0x5')](_0x96df0a,_0x5c2e64);};}exports[_0xb21d('0x6')]=function(_0x4fd7c9){for(var _0x5c2d1f=0x0,_0x12658a=events[_0xb21d('0x7')];_0x5c2d1f<_0x12658a;_0x5c2d1f++){var _0x21b896=events[_0x5c2d1f];var _0x21b6c8=createListener(_0xb21d('0x8')+_0x21b896,_0x4fd7c9);WhatsappQueueEvents['on'](_0x21b896,_0x21b6c8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 28ef314..bae6b8d 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 _0x6d41=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x2a007a,_0x2da459){var _0x27cb78=function(_0x31c1ff){while(--_0x31c1ff){_0x2a007a['push'](_0x2a007a['shift']());}};_0x27cb78(++_0x2da459);}(_0x6d41,0x123));var _0x16d4=function(_0x478c12,_0x2f587f){_0x478c12=_0x478c12-0x0;var _0xb4e359=_0x6d41[_0x478c12];return _0xb4e359;};'use strict';var multer=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var path=require(_0x16d4('0x2'));var timeout=require(_0x16d4('0x3'));var express=require('express');var router=express[_0x16d4('0x4')]();var auth=require(_0x16d4('0x5'));var interaction=require(_0x16d4('0x6'));var config=require(_0x16d4('0x7'));var controller=require(_0x16d4('0x8'));router[_0x16d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x16d4('0xa')]);router[_0x16d4('0x9')](_0x16d4('0xb'),auth[_0x16d4('0xc')](),controller[_0x16d4('0xd')]);router[_0x16d4('0x9')]('/:id',auth[_0x16d4('0xc')](),controller[_0x16d4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16d4('0xf')]);router[_0x16d4('0x10')](_0x16d4('0x11'),auth[_0x16d4('0xc')](),controller['update']);router[_0x16d4('0x12')](_0x16d4('0x11'),auth[_0x16d4('0xc')](),controller[_0x16d4('0x13')]);module[_0x16d4('0x14')]=router; \ No newline at end of file +var _0x51fe=['/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1b5639,_0x31ecf5){var _0x402e79=function(_0x24ba6f){while(--_0x24ba6f){_0x1b5639['push'](_0x1b5639['shift']());}};_0x402e79(++_0x31ecf5);}(_0x51fe,0x1d0));var _0xe51f=function(_0x5e413d,_0x51688b){_0x5e413d=_0x5e413d-0x0;var _0x3f11eb=_0x51fe[_0x5e413d];return _0x3f11eb;};'use strict';var multer=require('multer');var util=require(_0xe51f('0x0'));var path=require(_0xe51f('0x1'));var timeout=require(_0xe51f('0x2'));var express=require('express');var router=express[_0xe51f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe51f('0x4'));var config=require(_0xe51f('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0xe51f('0x6')]('/',auth[_0xe51f('0x7')](),controller[_0xe51f('0x8')]);router[_0xe51f('0x6')](_0xe51f('0x9'),auth[_0xe51f('0x7')](),controller[_0xe51f('0xa')]);router[_0xe51f('0x6')](_0xe51f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe51f('0xc')]('/',auth['isAuthenticated'](),controller[_0xe51f('0xd')]);router[_0xe51f('0xe')](_0xe51f('0xb'),auth[_0xe51f('0x7')](),controller[_0xe51f('0xf')]);router[_0xe51f('0x10')]('/:id',auth[_0xe51f('0x7')](),controller[_0xe51f('0x11')]);module[_0xe51f('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 ea42899..3510e4b 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x4730af,_0xe149fb){var _0x396bfa=function(_0x21659f){while(--_0x21659f){_0x4730af['push'](_0x4730af['shift']());}};_0x396bfa(++_0xe149fb);}(_0x4b84,0x1cc));var _0x44b8=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x4b84[_0x146a97];return _0x259d5c;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x5e4940,_0x3208ae){var _0x297cd4=function(_0x469be2){while(--_0x469be2){_0x5e4940['push'](_0x5e4940['shift']());}};_0x297cd4(++_0x3208ae);}(_0x6aa7,0x178));var _0x76aa=function(_0x356205,_0x4ec598){_0x356205=_0x356205-0x0;var _0x11f3bd=_0x6aa7[_0x356205];return _0x11f3bd;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f49f94d..f645ec9 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 _0x0f48=['findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include'];(function(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0x0f48,0xe4));var _0x80f4=function(_0x13ca25,_0x4c40dc){_0x13ca25=_0x13ca25-0x0;var _0x50730c=_0x0f48[_0x13ca25];return _0x50730c;};'use strict';var pdf=require(_0x80f4('0x0'));var emlformat=require(_0x80f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80f4('0x2'));var jsonpatch=require(_0x80f4('0x3'));var rp=require(_0x80f4('0x4'));var moment=require(_0x80f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x80f4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80f4('0x7'));var fs=require('fs');var _=require(_0x80f4('0x8'));var squel=require(_0x80f4('0x9'));var crypto=require('crypto');var jsforce=require(_0x80f4('0xa'));var deskjs=require(_0x80f4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x80f4('0xc'));var Papa=require(_0x80f4('0xd'));var Redis=require(_0x80f4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x80f4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80f4('0x10'));var utils=require(_0x80f4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80f4('0x12'))['db'];function respondWithStatusCode(_0x144e37,_0x1eae35){_0x1eae35=_0x1eae35||0xcc;return function(_0x39d4ed){if(_0x39d4ed){return _0x144e37[_0x80f4('0x13')](_0x1eae35);}return _0x144e37[_0x80f4('0x14')](_0x1eae35)[_0x80f4('0x15')]();};}function respondWithResult(_0x46dafa,_0x417153){_0x417153=_0x417153||0xc8;return function(_0x52cbdc){if(_0x52cbdc){return _0x46dafa[_0x80f4('0x14')](_0x417153)[_0x80f4('0x16')](_0x52cbdc);}};}function respondWithFilteredResult(_0x2b1650,_0x43527b){return function(_0x532df9){if(_0x532df9){var _0x5504dd=_0x532df9[_0x80f4('0x17')],_0x17535a=_0x43527b[_0x80f4('0x18')],_0x17f844=_0x43527b[_0x80f4('0x18')]+_0x43527b[_0x80f4('0x19')],_0x3fa909;if(_0x17f844>=_0x5504dd){_0x17f844=_0x5504dd;_0x3fa909=0xc8;}else{_0x3fa909=0xce;}_0x2b1650[_0x80f4('0x14')](_0x3fa909);return _0x2b1650[_0x80f4('0x1a')](_0x80f4('0x1b'),_0x17535a+'-'+_0x17f844+'/'+_0x5504dd)['json'](_0x532df9);}return null;};}function patchUpdates(_0x9d047e){return function(_0x2a633e){try{jsonpatch[_0x80f4('0x1c')](_0x2a633e,_0x9d047e,!![]);}catch(_0x351233){return BPromise[_0x80f4('0x1d')](_0x351233);}return _0x2a633e[_0x80f4('0x1e')]();};}function saveUpdates(_0x51b501,_0x31af03){return function(_0x15689f){if(_0x15689f){return _0x15689f[_0x80f4('0x1f')](_0x51b501)[_0x80f4('0x20')](function(_0x495739){return _0x495739;});}return null;};}function removeEntity(_0x375f37,_0x57e907){return function(_0x3416d1){if(_0x3416d1){return _0x3416d1['destroy']()['then'](function(){_0x375f37['status'](0xcc)[_0x80f4('0x15')]();});}};}function handleEntityNotFound(_0x36b84b,_0x21b261){return function(_0x47abab){if(!_0x47abab){_0x36b84b[_0x80f4('0x13')](0x194);}return _0x47abab;};}function handleError(_0x51c4e6,_0x306f7d){_0x306f7d=_0x306f7d||0x1f4;return function(_0x202f69){logger[_0x80f4('0x21')](_0x202f69[_0x80f4('0x22')]);if(_0x202f69['name']){delete _0x202f69[_0x80f4('0x23')];}_0x51c4e6[_0x80f4('0x14')](_0x306f7d)[_0x80f4('0x24')](_0x202f69);};}exports[_0x80f4('0x25')]=function(_0x51104f,_0x2211b9){var _0x1e9721={},_0x1ac2bb={},_0x501452={'count':0x0,'rows':[]};var _0x2d7594=_[_0x80f4('0x26')](db[_0x80f4('0x27')][_0x80f4('0x28')],function(_0x20d3ed){return{'name':_0x20d3ed['fieldName'],'type':_0x20d3ed[_0x80f4('0x29')][_0x80f4('0x2a')]};});_0x1ac2bb[_0x80f4('0x2b')]=_['map'](_0x2d7594,_0x80f4('0x23'));_0x1ac2bb[_0x80f4('0x2c')]=_[_0x80f4('0x2d')](_0x51104f['query']);_0x1ac2bb['filters']=_[_0x80f4('0x2e')](_0x1ac2bb[_0x80f4('0x2b')],_0x1ac2bb[_0x80f4('0x2c')]);_0x1e9721[_0x80f4('0x2f')]=_[_0x80f4('0x2e')](_0x1ac2bb[_0x80f4('0x2b')],qs['fields'](_0x51104f['query'][_0x80f4('0x30')]));_0x1e9721[_0x80f4('0x2f')]=_0x1e9721[_0x80f4('0x2f')]['length']?_0x1e9721[_0x80f4('0x2f')]:_0x1ac2bb[_0x80f4('0x2b')];if(!_0x51104f[_0x80f4('0x2c')][_0x80f4('0x31')](_0x80f4('0x32'))){_0x1e9721[_0x80f4('0x19')]=qs[_0x80f4('0x19')](_0x51104f[_0x80f4('0x2c')]['limit']);_0x1e9721[_0x80f4('0x18')]=qs[_0x80f4('0x18')](_0x51104f[_0x80f4('0x2c')][_0x80f4('0x18')]);}_0x1e9721[_0x80f4('0x33')]=qs['sort'](_0x51104f[_0x80f4('0x2c')][_0x80f4('0x34')]);_0x1e9721['where']=qs[_0x80f4('0x35')](_['pick'](_0x51104f[_0x80f4('0x2c')],_0x1ac2bb[_0x80f4('0x35')]),_0x2d7594);if(_0x51104f['query'][_0x80f4('0x36')]){_0x1e9721['where']=_[_0x80f4('0x37')](_0x1e9721[_0x80f4('0x38')],{'$or':_[_0x80f4('0x26')](_0x2d7594,function(_0x3d2f4f){if(_0x3d2f4f[_0x80f4('0x29')]!==_0x80f4('0x39')){var _0x189674={};_0x189674[_0x3d2f4f['name']]={'$like':'%'+_0x51104f[_0x80f4('0x2c')][_0x80f4('0x36')]+'%'};return _0x189674;}})});}_0x1e9721=_['merge']({},_0x1e9721,_0x51104f[_0x80f4('0x3a')]);var _0x2410ae={'where':_0x1e9721[_0x80f4('0x38')]};return db[_0x80f4('0x27')][_0x80f4('0x17')](_0x2410ae)[_0x80f4('0x20')](function(_0x578677){_0x501452['count']=_0x578677;if(_0x51104f[_0x80f4('0x2c')]['includeAll']){_0x1e9721[_0x80f4('0x3b')]=[{'all':!![]}];}return db[_0x80f4('0x27')][_0x80f4('0x3c')](_0x1e9721);})[_0x80f4('0x20')](function(_0x53e753){_0x501452[_0x80f4('0x3d')]=_0x53e753;return _0x501452;})[_0x80f4('0x20')](respondWithFilteredResult(_0x2211b9,_0x1e9721))[_0x80f4('0x3e')](handleError(_0x2211b9,null));};exports[_0x80f4('0x3f')]=function(_0x2bbf56,_0x570b7f){var _0x4ff68a={'raw':!![],'where':{'id':_0x2bbf56[_0x80f4('0x40')]['id']}},_0x38d3a6={};_0x38d3a6[_0x80f4('0x2b')]=_['keys'](db[_0x80f4('0x27')][_0x80f4('0x28')]);_0x38d3a6['query']=_['keys'](_0x2bbf56[_0x80f4('0x2c')]);_0x38d3a6[_0x80f4('0x35')]=_['intersection'](_0x38d3a6[_0x80f4('0x2b')],_0x38d3a6[_0x80f4('0x2c')]);_0x4ff68a['attributes']=_[_0x80f4('0x2e')](_0x38d3a6[_0x80f4('0x2b')],qs[_0x80f4('0x30')](_0x2bbf56[_0x80f4('0x2c')]['fields']));_0x4ff68a['attributes']=_0x4ff68a[_0x80f4('0x2f')][_0x80f4('0x41')]?_0x4ff68a[_0x80f4('0x2f')]:_0x38d3a6[_0x80f4('0x2b')];if(_0x2bbf56[_0x80f4('0x2c')][_0x80f4('0x42')]){_0x4ff68a[_0x80f4('0x3b')]=[{'all':!![]}];}_0x4ff68a=_['merge']({},_0x4ff68a,_0x2bbf56[_0x80f4('0x3a')]);return db[_0x80f4('0x27')][_0x80f4('0x43')](_0x4ff68a)['then'](handleEntityNotFound(_0x570b7f,null))[_0x80f4('0x20')](respondWithResult(_0x570b7f,null))[_0x80f4('0x3e')](handleError(_0x570b7f,null));};exports[_0x80f4('0x44')]=function(_0x93e150,_0x2e3927){return db[_0x80f4('0x27')][_0x80f4('0x44')](_0x93e150['body'],{})['then'](respondWithResult(_0x2e3927,0xc9))['catch'](handleError(_0x2e3927,null));};exports[_0x80f4('0x1f')]=function(_0x465b4a,_0x2ea3ba){if(_0x465b4a['body']['id']){delete _0x465b4a[_0x80f4('0x45')]['id'];}return db['WhatsappQueueReport'][_0x80f4('0x43')]({'where':{'id':_0x465b4a[_0x80f4('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ea3ba,null))[_0x80f4('0x20')](saveUpdates(_0x465b4a[_0x80f4('0x45')],null))[_0x80f4('0x20')](respondWithResult(_0x2ea3ba,null))['catch'](handleError(_0x2ea3ba,null));};exports[_0x80f4('0x46')]=function(_0x5a56ec,_0x2f7e7d){return db['WhatsappQueueReport'][_0x80f4('0x43')]({'where':{'id':_0x5a56ec['params']['id']}})[_0x80f4('0x20')](handleEntityNotFound(_0x2f7e7d,null))[_0x80f4('0x20')](removeEntity(_0x2f7e7d,null))[_0x80f4('0x3e')](handleError(_0x2f7e7d,null));};exports['describe']=function(_0x579456,_0x20f2eb){return db[_0x80f4('0x27')][_0x80f4('0x47')]()[_0x80f4('0x20')](respondWithResult(_0x20f2eb,null))[_0x80f4('0x3e')](handleError(_0x20f2eb,null));}; \ No newline at end of file +var _0xa448=['options','include','WhatsappQueueReport','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x2480b5,_0x1899e9){var _0x108649=function(_0x205847){while(--_0x205847){_0x2480b5['push'](_0x2480b5['shift']());}};_0x108649(++_0x1899e9);}(_0xa448,0xe4));var _0x8a44=function(_0x128c9b,_0x47ca67){_0x128c9b=_0x128c9b-0x0;var _0x3f7a52=_0xa448[_0x128c9b];return _0x3f7a52;};'use strict';var pdf=require(_0x8a44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a44('0x1'));var jsonpatch=require(_0x8a44('0x2'));var rp=require('request-promise');var moment=require(_0x8a44('0x3'));var BPromise=require(_0x8a44('0x4'));var Mustache=require(_0x8a44('0x5'));var util=require(_0x8a44('0x6'));var path=require(_0x8a44('0x7'));var sox=require('sox');var csv=require(_0x8a44('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a44('0x9'));var squel=require(_0x8a44('0xa'));var crypto=require(_0x8a44('0xb'));var jsforce=require(_0x8a44('0xc'));var deskjs=require(_0x8a44('0xd'));var toCsv=require(_0x8a44('0x8'));var querystring=require(_0x8a44('0xe'));var Papa=require(_0x8a44('0xf'));var Redis=require(_0x8a44('0x10'));var authService=require(_0x8a44('0x11'));var qs=require(_0x8a44('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a44('0x13'))('api');var utils=require(_0x8a44('0x14'));var config=require(_0x8a44('0x15'));var licenseUtil=require(_0x8a44('0x16'));var db=require(_0x8a44('0x17'))['db'];function respondWithStatusCode(_0x4287a1,_0x270f52){_0x270f52=_0x270f52||0xcc;return function(_0x5f1cf3){if(_0x5f1cf3){return _0x4287a1['sendStatus'](_0x270f52);}return _0x4287a1[_0x8a44('0x18')](_0x270f52)[_0x8a44('0x19')]();};}function respondWithResult(_0x23b18b,_0x1bdc62){_0x1bdc62=_0x1bdc62||0xc8;return function(_0x4cc6fd){if(_0x4cc6fd){return _0x23b18b[_0x8a44('0x18')](_0x1bdc62)[_0x8a44('0x1a')](_0x4cc6fd);}};}function respondWithFilteredResult(_0x283ed8,_0x38b2b6){return function(_0x42b564){if(_0x42b564){var _0x4bb2fb=_0x42b564[_0x8a44('0x1b')],_0x1d1e1a=_0x38b2b6['offset'],_0x4b0084=_0x38b2b6[_0x8a44('0x1c')]+_0x38b2b6[_0x8a44('0x1d')],_0x215d67;if(_0x4b0084>=_0x4bb2fb){_0x4b0084=_0x4bb2fb;_0x215d67=0xc8;}else{_0x215d67=0xce;}_0x283ed8[_0x8a44('0x18')](_0x215d67);return _0x283ed8[_0x8a44('0x1e')](_0x8a44('0x1f'),_0x1d1e1a+'-'+_0x4b0084+'/'+_0x4bb2fb)[_0x8a44('0x1a')](_0x42b564);}return null;};}function patchUpdates(_0xed716){return function(_0x95c8c3){try{jsonpatch[_0x8a44('0x20')](_0x95c8c3,_0xed716,!![]);}catch(_0x50e533){return BPromise[_0x8a44('0x21')](_0x50e533);}return _0x95c8c3[_0x8a44('0x22')]();};}function saveUpdates(_0x57400e,_0x2eb87b){return function(_0x5af4c8){if(_0x5af4c8){return _0x5af4c8[_0x8a44('0x23')](_0x57400e)[_0x8a44('0x24')](function(_0x211b8a){return _0x211b8a;});}return null;};}function removeEntity(_0x43b1a8,_0x2f851b){return function(_0x1ff301){if(_0x1ff301){return _0x1ff301[_0x8a44('0x25')]()['then'](function(){_0x43b1a8['status'](0xcc)[_0x8a44('0x19')]();});}};}function handleEntityNotFound(_0x5cab28,_0x2f8fe7){return function(_0x32758f){if(!_0x32758f){_0x5cab28['sendStatus'](0x194);}return _0x32758f;};}function handleError(_0x58296,_0x18cf90){_0x18cf90=_0x18cf90||0x1f4;return function(_0x4addcb){logger[_0x8a44('0x26')](_0x4addcb[_0x8a44('0x27')]);if(_0x4addcb['name']){delete _0x4addcb[_0x8a44('0x28')];}_0x58296[_0x8a44('0x18')](_0x18cf90)['send'](_0x4addcb);};}exports['index']=function(_0x2a5202,_0x125424){var _0x159356={},_0x358ec9={},_0x297adc={'count':0x0,'rows':[]};var _0x27c60f=_[_0x8a44('0x29')](db['WhatsappQueueReport']['rawAttributes'],function(_0x53c8f4){return{'name':_0x53c8f4[_0x8a44('0x2a')],'type':_0x53c8f4[_0x8a44('0x2b')][_0x8a44('0x2c')]};});_0x358ec9['model']=_[_0x8a44('0x29')](_0x27c60f,_0x8a44('0x28'));_0x358ec9[_0x8a44('0x2d')]=_[_0x8a44('0x2e')](_0x2a5202[_0x8a44('0x2d')]);_0x358ec9[_0x8a44('0x2f')]=_[_0x8a44('0x30')](_0x358ec9[_0x8a44('0x31')],_0x358ec9[_0x8a44('0x2d')]);_0x159356[_0x8a44('0x32')]=_[_0x8a44('0x30')](_0x358ec9[_0x8a44('0x31')],qs[_0x8a44('0x33')](_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x33')]));_0x159356[_0x8a44('0x32')]=_0x159356['attributes'][_0x8a44('0x34')]?_0x159356['attributes']:_0x358ec9['model'];if(!_0x2a5202['query'][_0x8a44('0x35')](_0x8a44('0x36'))){_0x159356[_0x8a44('0x1d')]=qs[_0x8a44('0x1d')](_0x2a5202[_0x8a44('0x2d')]['limit']);_0x159356[_0x8a44('0x1c')]=qs[_0x8a44('0x1c')](_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x1c')]);}_0x159356[_0x8a44('0x37')]=qs[_0x8a44('0x38')](_0x2a5202[_0x8a44('0x2d')]['sort']);_0x159356[_0x8a44('0x39')]=qs['filters'](_['pick'](_0x2a5202[_0x8a44('0x2d')],_0x358ec9[_0x8a44('0x2f')]),_0x27c60f);if(_0x2a5202['query'][_0x8a44('0x3a')]){_0x159356[_0x8a44('0x39')]=_[_0x8a44('0x3b')](_0x159356[_0x8a44('0x39')],{'$or':_[_0x8a44('0x29')](_0x27c60f,function(_0x3a0f98){if(_0x3a0f98[_0x8a44('0x2b')]!=='VIRTUAL'){var _0x4ecfa3={};_0x4ecfa3[_0x3a0f98['name']]={'$like':'%'+_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x3a')]+'%'};return _0x4ecfa3;}})});}_0x159356=_[_0x8a44('0x3b')]({},_0x159356,_0x2a5202[_0x8a44('0x3c')]);var _0x39c223={'where':_0x159356[_0x8a44('0x39')]};return db['WhatsappQueueReport']['count'](_0x39c223)[_0x8a44('0x24')](function(_0x26c5c4){_0x297adc[_0x8a44('0x1b')]=_0x26c5c4;if(_0x2a5202[_0x8a44('0x2d')]['includeAll']){_0x159356[_0x8a44('0x3d')]=[{'all':!![]}];}return db[_0x8a44('0x3e')][_0x8a44('0x3f')](_0x159356);})['then'](function(_0x2299ed){_0x297adc[_0x8a44('0x40')]=_0x2299ed;return _0x297adc;})['then'](respondWithFilteredResult(_0x125424,_0x159356))[_0x8a44('0x41')](handleError(_0x125424,null));};exports['show']=function(_0x4b36b4,_0x3b4032){var _0x4acea8={'raw':!![],'where':{'id':_0x4b36b4[_0x8a44('0x42')]['id']}},_0x8d0ba6={};_0x8d0ba6[_0x8a44('0x31')]=_[_0x8a44('0x2e')](db['WhatsappQueueReport'][_0x8a44('0x43')]);_0x8d0ba6['query']=_['keys'](_0x4b36b4['query']);_0x8d0ba6[_0x8a44('0x2f')]=_[_0x8a44('0x30')](_0x8d0ba6['model'],_0x8d0ba6['query']);_0x4acea8[_0x8a44('0x32')]=_['intersection'](_0x8d0ba6[_0x8a44('0x31')],qs['fields'](_0x4b36b4[_0x8a44('0x2d')]['fields']));_0x4acea8['attributes']=_0x4acea8[_0x8a44('0x32')][_0x8a44('0x34')]?_0x4acea8[_0x8a44('0x32')]:_0x8d0ba6[_0x8a44('0x31')];if(_0x4b36b4[_0x8a44('0x2d')]['includeAll']){_0x4acea8['include']=[{'all':!![]}];}_0x4acea8=_[_0x8a44('0x3b')]({},_0x4acea8,_0x4b36b4[_0x8a44('0x3c')]);return db[_0x8a44('0x3e')][_0x8a44('0x44')](_0x4acea8)[_0x8a44('0x24')](handleEntityNotFound(_0x3b4032,null))['then'](respondWithResult(_0x3b4032,null))[_0x8a44('0x41')](handleError(_0x3b4032,null));};exports[_0x8a44('0x45')]=function(_0x3e500d,_0x3e9487){return db['WhatsappQueueReport']['create'](_0x3e500d[_0x8a44('0x46')],{})['then'](respondWithResult(_0x3e9487,0xc9))[_0x8a44('0x41')](handleError(_0x3e9487,null));};exports[_0x8a44('0x23')]=function(_0x457c19,_0x2d591e){if(_0x457c19[_0x8a44('0x46')]['id']){delete _0x457c19[_0x8a44('0x46')]['id'];}return db[_0x8a44('0x3e')][_0x8a44('0x44')]({'where':{'id':_0x457c19[_0x8a44('0x42')]['id']}})[_0x8a44('0x24')](handleEntityNotFound(_0x2d591e,null))['then'](saveUpdates(_0x457c19['body'],null))[_0x8a44('0x24')](respondWithResult(_0x2d591e,null))['catch'](handleError(_0x2d591e,null));};exports[_0x8a44('0x25')]=function(_0x26026,_0x9d6721){return db['WhatsappQueueReport'][_0x8a44('0x44')]({'where':{'id':_0x26026[_0x8a44('0x42')]['id']}})[_0x8a44('0x24')](handleEntityNotFound(_0x9d6721,null))[_0x8a44('0x24')](removeEntity(_0x9d6721,null))[_0x8a44('0x41')](handleError(_0x9d6721,null));};exports[_0x8a44('0x47')]=function(_0x4ffafd,_0x265fa6){return db[_0x8a44('0x3e')][_0x8a44('0x47')]()[_0x8a44('0x24')](respondWithResult(_0x265fa6,null))[_0x8a44('0x41')](handleError(_0x265fa6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c622612..010214f 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 _0x9f63=['report_whatsapp_queue','lodash','util','bluebird','rimraf','../../config/environment','exports','define','WhatsappQueueReport'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9f63,0x1b1));var _0x39f6=function(_0xcd4f14,_0xe85fb7){_0xcd4f14=_0xcd4f14-0x0;var _0x34648a=_0x9f63[_0xcd4f14];return _0x34648a;};'use strict';var _=require(_0x39f6('0x0'));var util=require(_0x39f6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x39f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x39f6('0x3'));var config=require(_0x39f6('0x4'));var attributes=require('./whatsappQueueReport.attributes');module[_0x39f6('0x5')]=function(_0x1f113c,_0x5d4aa5){return _0x1f113c[_0x39f6('0x6')](_0x39f6('0x7'),attributes,{'tableName':_0x39f6('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb066=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb066,0x1c9));var _0x6b06=function(_0x5c15f8,_0xa1d891){_0x5c15f8=_0x5c15f8-0x0;var _0x2847bb=_0xb066[_0x5c15f8];return _0x2847bb;};'use strict';var _=require('lodash');var util=require(_0x6b06('0x0'));var logger=require(_0x6b06('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b06('0x2'));var rp=require(_0x6b06('0x3'));var fs=require('fs');var path=require(_0x6b06('0x4'));var rimraf=require(_0x6b06('0x5'));var config=require(_0x6b06('0x6'));var attributes=require(_0x6b06('0x7'));module[_0x6b06('0x8')]=function(_0xa85096,_0x1e303d){return _0xa85096[_0x6b06('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x6b06('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 360e06e..6b516e3 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 _0xf0ea=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','update','where','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf0ea,0x17f));var _0xaf0e=function(_0x533b43,_0x22a265){_0x533b43=_0x533b43-0x0;var _0x5deef4=_0xf0ea[_0x533b43];return _0x5deef4;};'use strict';var _=require(_0xaf0e('0x0'));var util=require(_0xaf0e('0x1'));var moment=require('moment');var BPromise=require(_0xaf0e('0x2'));var rs=require(_0xaf0e('0x3'));var fs=require('fs');var Redis=require(_0xaf0e('0x4'));var db=require(_0xaf0e('0x5'))['db'];var utils=require(_0xaf0e('0x6'));var logger=require(_0xaf0e('0x7'))('rpc');var config=require(_0xaf0e('0x8'));var jayson=require(_0xaf0e('0x9'));var client=jayson[_0xaf0e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364f40,_0x5f1644,_0x37fbd3){return new BPromise(function(_0x243c9d,_0x4055d7){return client[_0xaf0e('0xb')](_0x364f40,_0x37fbd3)[_0xaf0e('0xc')](function(_0x4f3434){logger[_0xaf0e('0xd')](_0xaf0e('0xe'),_0x5f1644,_0xaf0e('0xf'));logger['debug'](_0xaf0e('0x10'),_0x5f1644,_0xaf0e('0xf'),JSON[_0xaf0e('0x11')](_0x4f3434));if(_0x4f3434[_0xaf0e('0x12')]){if(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x13')]===0x1f4){logger[_0xaf0e('0x12')](_0xaf0e('0xe'),_0x5f1644,_0x4f3434[_0xaf0e('0x12')]['message']);return _0x4055d7(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);}logger[_0xaf0e('0x12')](_0xaf0e('0xe'),_0x5f1644,_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);return _0x243c9d(_0x4f3434[_0xaf0e('0x12')][_0xaf0e('0x14')]);}else{logger[_0xaf0e('0xd')](_0xaf0e('0xe'),_0x5f1644,_0xaf0e('0xf'));_0x243c9d(_0x4f3434[_0xaf0e('0x15')][_0xaf0e('0x14')]);}})[_0xaf0e('0x16')](function(_0x48947f){logger['error'](_0xaf0e('0xe'),_0x5f1644,_0x48947f);_0x4055d7(_0x48947f);});});}exports['CreateWhatsappQueueReport']=function(_0x4b55cd){var _0x53adb3=this;return new Promise(function(_0x141cda,_0x39ac94){return db[_0xaf0e('0x17')]['create'](_0x4b55cd[_0xaf0e('0x18')],{'raw':_0x4b55cd[_0xaf0e('0x19')]?_0x4b55cd[_0xaf0e('0x19')][_0xaf0e('0x1a')]===undefined?!![]:![]:!![]})[_0xaf0e('0xc')](function(_0x2caf8d){logger[_0xaf0e('0xd')](_0xaf0e('0x1b'),_0x4b55cd);logger[_0xaf0e('0x1c')]('CreateWhatsappQueueReport',_0x4b55cd,JSON['stringify'](_0x2caf8d));_0x141cda(_0x2caf8d);})[_0xaf0e('0x16')](function(_0x5c7388){logger[_0xaf0e('0x12')](_0xaf0e('0x1b'),_0x5c7388[_0xaf0e('0x14')],_0x4b55cd);_0x39ac94(_0x53adb3[_0xaf0e('0x12')](0x1f4,_0x5c7388['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0xd14fce){var _0x5535c5=this;return new Promise(function(_0x4966de,_0x1323d2){return db[_0xaf0e('0x17')][_0xaf0e('0x1d')](_0xd14fce[_0xaf0e('0x18')],{'raw':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1e')]||null:null,'attributes':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')]['attributes']||null:null,'limit':_0xd14fce[_0xaf0e('0x19')]?_0xd14fce[_0xaf0e('0x19')][_0xaf0e('0x1f')]||null:null})[_0xaf0e('0xc')](function(_0x1ae0d6){logger[_0xaf0e('0xd')](_0xaf0e('0x20'),_0xd14fce);logger[_0xaf0e('0x1c')](_0xaf0e('0x20'),_0xd14fce,JSON['stringify'](_0x1ae0d6));_0x4966de(_0x1ae0d6);})[_0xaf0e('0x16')](function(_0x2a7fbb){logger[_0xaf0e('0x12')](_0xaf0e('0x20'),_0x2a7fbb[_0xaf0e('0x14')],_0xd14fce);_0x1323d2(_0x5535c5[_0xaf0e('0x12')](0x1f4,_0x2a7fbb[_0xaf0e('0x14')]));});});}; \ No newline at end of file +var _0x497f=['WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappQueueReport'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x497f,0x16a));var _0xf497=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x497f[_0x4b2cc6];return _0x3e0b08;};'use strict';var _=require(_0xf497('0x0'));var util=require(_0xf497('0x1'));var moment=require(_0xf497('0x2'));var BPromise=require(_0xf497('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf497('0x4'));var logger=require(_0xf497('0x5'))(_0xf497('0x6'));var config=require('../../config/environment');var jayson=require(_0xf497('0x7'));var client=jayson['client'][_0xf497('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3a13,_0x548407,_0x1c2d90){return new BPromise(function(_0x12af97,_0x499734){return client[_0xf497('0x9')](_0x2f3a13,_0x1c2d90)[_0xf497('0xa')](function(_0x17e1a4){logger['info'](_0xf497('0xb'),_0x548407,_0xf497('0xc'));logger[_0xf497('0xd')](_0xf497('0xe'),_0x548407,_0xf497('0xc'),JSON['stringify'](_0x17e1a4));if(_0x17e1a4[_0xf497('0xf')]){if(_0x17e1a4[_0xf497('0xf')][_0xf497('0x10')]===0x1f4){logger[_0xf497('0xf')](_0xf497('0xb'),_0x548407,_0x17e1a4[_0xf497('0xf')][_0xf497('0x11')]);return _0x499734(_0x17e1a4[_0xf497('0xf')]['message']);}logger[_0xf497('0xf')](_0xf497('0xb'),_0x548407,_0x17e1a4['error'][_0xf497('0x11')]);return _0x12af97(_0x17e1a4[_0xf497('0xf')]['message']);}else{logger[_0xf497('0x12')](_0xf497('0xb'),_0x548407,_0xf497('0xc'));_0x12af97(_0x17e1a4[_0xf497('0x13')][_0xf497('0x11')]);}})[_0xf497('0x14')](function(_0x497e1b){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x548407,_0x497e1b);_0x499734(_0x497e1b);});});}exports[_0xf497('0x15')]=function(_0x2f598b){var _0x10559f=this;return new Promise(function(_0x237c52,_0x9383c4){return db[_0xf497('0x16')]['create'](_0x2f598b[_0xf497('0x17')],{'raw':_0x2f598b[_0xf497('0x18')]?_0x2f598b['options'][_0xf497('0x19')]===undefined?!![]:![]:!![]})[_0xf497('0xa')](function(_0x54024a){logger[_0xf497('0x12')](_0xf497('0x15'),_0x2f598b);logger[_0xf497('0xd')](_0xf497('0x15'),_0x2f598b,JSON[_0xf497('0x1a')](_0x54024a));_0x237c52(_0x54024a);})[_0xf497('0x14')](function(_0x22467b){logger[_0xf497('0xf')](_0xf497('0x15'),_0x22467b[_0xf497('0x11')],_0x2f598b);_0x9383c4(_0x10559f['error'](0x1f4,_0x22467b[_0xf497('0x11')]));});});};exports[_0xf497('0x1b')]=function(_0x47ab47){var _0x5dd949=this;return new Promise(function(_0x1d42ac,_0x1e1da0){return db[_0xf497('0x16')][_0xf497('0x1c')](_0x47ab47['body'],{'raw':_0x47ab47[_0xf497('0x18')]?_0x47ab47['options'][_0xf497('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ab47['options']?_0x47ab47[_0xf497('0x18')][_0xf497('0x1d')]||null:null,'attributes':_0x47ab47[_0xf497('0x18')]?_0x47ab47['options'][_0xf497('0x1e')]||null:null,'limit':_0x47ab47[_0xf497('0x18')]?_0x47ab47[_0xf497('0x18')][_0xf497('0x1f')]||null:null})[_0xf497('0xa')](function(_0x54c4cc){logger[_0xf497('0x12')](_0xf497('0x1b'),_0x47ab47);logger[_0xf497('0xd')]('UpdateWhatsappQueueReport',_0x47ab47,JSON[_0xf497('0x1a')](_0x54c4cc));_0x1d42ac(_0x54c4cc);})[_0xf497('0x14')](function(_0x55509e){logger['error'](_0xf497('0x1b'),_0x55509e[_0xf497('0x11')],_0x47ab47);_0x1e1da0(_0x5dd949['error'](0x1f4,_0x55509e[_0xf497('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f8706ce..130de46 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 _0x27d7=['update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x27d7,0xa4));var _0x727d=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x27d7[_0x300c89];return _0x41762e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x727d('0x0'));var timeout=require(_0x727d('0x1'));var express=require('express');var router=express[_0x727d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x727d('0x3'));var config=require(_0x727d('0x4'));var controller=require(_0x727d('0x5'));router[_0x727d('0x6')]('/',auth['isAuthenticated'](),controller[_0x727d('0x7')]);router['get'](_0x727d('0x8'),auth[_0x727d('0x9')](),controller[_0x727d('0xa')]);router[_0x727d('0x6')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0xc')]);router[_0x727d('0xd')]('/',auth[_0x727d('0x9')](),controller[_0x727d('0xe')]);router[_0x727d('0xf')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0x10')]);router[_0x727d('0x11')](_0x727d('0xb'),auth[_0x727d('0x9')](),controller[_0x727d('0x12')]);module[_0x727d('0x13')]=router; \ No newline at end of file +var _0xa5ab=['../../components/auth/service','./whatsappTransferReport.controller','get','index','describe','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x131487,_0x563af6){var _0xe22b46=function(_0x110ea0){while(--_0x110ea0){_0x131487['push'](_0x131487['shift']());}};_0xe22b46(++_0x563af6);}(_0xa5ab,0xf2));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var path=require('path');var timeout=require(_0xba5a('0x2'));var express=require(_0xba5a('0x3'));var router=express[_0xba5a('0x4')]();var auth=require(_0xba5a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xba5a('0x6'));router[_0xba5a('0x7')]('/',auth['isAuthenticated'](),controller[_0xba5a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xba5a('0x9')]);router[_0xba5a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xba5a('0xa')]);router[_0xba5a('0xb')]('/',auth[_0xba5a('0xc')](),controller['create']);router[_0xba5a('0xd')](_0xba5a('0xe'),auth[_0xba5a('0xc')](),controller[_0xba5a('0xf')]);router[_0xba5a('0x10')]('/:id',auth[_0xba5a('0xc')](),controller[_0xba5a('0x11')]);module[_0xba5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4830509..3b99db6 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x398205,_0x4f2b46){var _0x3fe63b=function(_0x3d73cb){while(--_0x3d73cb){_0x398205['push'](_0x398205['shift']());}};_0x3fe63b(++_0x4f2b46);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x0b0e[_0x5fe69a];return _0x3f1aee;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index be13298..82f9dcf 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 _0xcef6=['findAll','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','count','offset','set','json','reject','save','update','then','error','name','send','map','WhatsappTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x344148,_0x4fb237){var _0x13b553=function(_0x371f4c){while(--_0x371f4c){_0x344148['push'](_0x344148['shift']());}};_0x13b553(++_0x4fb237);}(_0xcef6,0x16e));var _0x6cef=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xcef6[_0x2053ea];return _0x2232c4;};'use strict';var pdf=require(_0x6cef('0x0'));var emlformat=require(_0x6cef('0x1'));var rimraf=require(_0x6cef('0x2'));var zipdir=require(_0x6cef('0x3'));var jsonpatch=require(_0x6cef('0x4'));var rp=require(_0x6cef('0x5'));var moment=require(_0x6cef('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cef('0x7'));var path=require(_0x6cef('0x8'));var sox=require(_0x6cef('0x9'));var csv=require(_0x6cef('0xa'));var ejs=require(_0x6cef('0xb'));var fs=require('fs');var _=require(_0x6cef('0xc'));var squel=require(_0x6cef('0xd'));var crypto=require(_0x6cef('0xe'));var jsforce=require(_0x6cef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cef('0xa'));var querystring=require(_0x6cef('0x10'));var Papa=require('papaparse');var Redis=require(_0x6cef('0x11'));var authService=require(_0x6cef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6cef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6cef('0x14'));var utils=require('../../config/utils');var config=require(_0x6cef('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587586,_0x4a9666){_0x4a9666=_0x4a9666||0xcc;return function(_0x2b6268){if(_0x2b6268){return _0x587586[_0x6cef('0x16')](_0x4a9666);}return _0x587586[_0x6cef('0x17')](_0x4a9666)[_0x6cef('0x18')]();};}function respondWithResult(_0x669ffa,_0x4b7623){_0x4b7623=_0x4b7623||0xc8;return function(_0x2c7195){if(_0x2c7195){return _0x669ffa['status'](_0x4b7623)['json'](_0x2c7195);}};}function respondWithFilteredResult(_0x3a93fe,_0x592641){return function(_0x4dbd80){if(_0x4dbd80){var _0x1483bd=_0x4dbd80[_0x6cef('0x19')],_0x5a2d4c=_0x592641[_0x6cef('0x1a')],_0x41056f=_0x592641['offset']+_0x592641['limit'],_0x8c7ce6;if(_0x41056f>=_0x1483bd){_0x41056f=_0x1483bd;_0x8c7ce6=0xc8;}else{_0x8c7ce6=0xce;}_0x3a93fe['status'](_0x8c7ce6);return _0x3a93fe[_0x6cef('0x1b')]('Content-Range',_0x5a2d4c+'-'+_0x41056f+'/'+_0x1483bd)[_0x6cef('0x1c')](_0x4dbd80);}return null;};}function patchUpdates(_0x2793b6){return function(_0x506ff2){try{jsonpatch['apply'](_0x506ff2,_0x2793b6,!![]);}catch(_0x12fe9d){return BPromise[_0x6cef('0x1d')](_0x12fe9d);}return _0x506ff2[_0x6cef('0x1e')]();};}function saveUpdates(_0x936773,_0x31932d){return function(_0x385431){if(_0x385431){return _0x385431[_0x6cef('0x1f')](_0x936773)[_0x6cef('0x20')](function(_0x1abe66){return _0x1abe66;});}return null;};}function removeEntity(_0x104f76,_0x155412){return function(_0x13fed5){if(_0x13fed5){return _0x13fed5['destroy']()[_0x6cef('0x20')](function(){_0x104f76['status'](0xcc)[_0x6cef('0x18')]();});}};}function handleEntityNotFound(_0x201607,_0x32db43){return function(_0x2220bc){if(!_0x2220bc){_0x201607[_0x6cef('0x16')](0x194);}return _0x2220bc;};}function handleError(_0x1cc8fa,_0x456acc){_0x456acc=_0x456acc||0x1f4;return function(_0x3f0406){logger[_0x6cef('0x21')](_0x3f0406['stack']);if(_0x3f0406[_0x6cef('0x22')]){delete _0x3f0406[_0x6cef('0x22')];}_0x1cc8fa['status'](_0x456acc)[_0x6cef('0x23')](_0x3f0406);};}exports['index']=function(_0x3f15d6,_0x3c81f3){var _0x42967f={},_0x466e9c={},_0x527267={'count':0x0,'rows':[]};var _0x407869=_[_0x6cef('0x24')](db[_0x6cef('0x25')]['rawAttributes'],function(_0x50027c){return{'name':_0x50027c[_0x6cef('0x26')],'type':_0x50027c[_0x6cef('0x27')][_0x6cef('0x28')]};});_0x466e9c[_0x6cef('0x29')]=_[_0x6cef('0x24')](_0x407869,'name');_0x466e9c[_0x6cef('0x2a')]=_['keys'](_0x3f15d6[_0x6cef('0x2a')]);_0x466e9c[_0x6cef('0x2b')]=_[_0x6cef('0x2c')](_0x466e9c[_0x6cef('0x29')],_0x466e9c['query']);_0x42967f[_0x6cef('0x2d')]=_[_0x6cef('0x2c')](_0x466e9c[_0x6cef('0x29')],qs['fields'](_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x2e')]));_0x42967f[_0x6cef('0x2d')]=_0x42967f[_0x6cef('0x2d')][_0x6cef('0x2f')]?_0x42967f[_0x6cef('0x2d')]:_0x466e9c['model'];if(!_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x30')](_0x6cef('0x31'))){_0x42967f[_0x6cef('0x32')]=qs[_0x6cef('0x32')](_0x3f15d6['query'][_0x6cef('0x32')]);_0x42967f['offset']=qs['offset'](_0x3f15d6[_0x6cef('0x2a')]['offset']);}_0x42967f[_0x6cef('0x33')]=qs[_0x6cef('0x34')](_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x34')]);_0x42967f[_0x6cef('0x35')]=qs[_0x6cef('0x2b')](_[_0x6cef('0x36')](_0x3f15d6[_0x6cef('0x2a')],_0x466e9c['filters']),_0x407869);if(_0x3f15d6[_0x6cef('0x2a')][_0x6cef('0x37')]){_0x42967f['where']=_[_0x6cef('0x38')](_0x42967f[_0x6cef('0x35')],{'$or':_[_0x6cef('0x24')](_0x407869,function(_0x51f450){if(_0x51f450[_0x6cef('0x27')]!==_0x6cef('0x39')){var _0x5769d3={};_0x5769d3[_0x51f450[_0x6cef('0x22')]]={'$like':'%'+_0x3f15d6[_0x6cef('0x2a')]['filter']+'%'};return _0x5769d3;}})});}_0x42967f=_['merge']({},_0x42967f,_0x3f15d6[_0x6cef('0x3a')]);var _0x576627={'where':_0x42967f['where']};return db[_0x6cef('0x25')]['count'](_0x576627)[_0x6cef('0x20')](function(_0x1cdb1f){_0x527267[_0x6cef('0x19')]=_0x1cdb1f;if(_0x3f15d6[_0x6cef('0x2a')]['includeAll']){_0x42967f[_0x6cef('0x3b')]=[{'all':!![]}];}return db[_0x6cef('0x25')][_0x6cef('0x3c')](_0x42967f);})[_0x6cef('0x20')](function(_0x1c4a3a){_0x527267['rows']=_0x1c4a3a;return _0x527267;})['then'](respondWithFilteredResult(_0x3c81f3,_0x42967f))['catch'](handleError(_0x3c81f3,null));};exports[_0x6cef('0x3d')]=function(_0x265d2e,_0x5a820a){var _0x37577a={'raw':!![],'where':{'id':_0x265d2e[_0x6cef('0x3e')]['id']}},_0x38890c={};_0x38890c[_0x6cef('0x29')]=_[_0x6cef('0x3f')](db[_0x6cef('0x25')][_0x6cef('0x40')]);_0x38890c['query']=_[_0x6cef('0x3f')](_0x265d2e[_0x6cef('0x2a')]);_0x38890c[_0x6cef('0x2b')]=_[_0x6cef('0x2c')](_0x38890c[_0x6cef('0x29')],_0x38890c[_0x6cef('0x2a')]);_0x37577a[_0x6cef('0x2d')]=_[_0x6cef('0x2c')](_0x38890c[_0x6cef('0x29')],qs['fields'](_0x265d2e[_0x6cef('0x2a')]['fields']));_0x37577a['attributes']=_0x37577a['attributes'][_0x6cef('0x2f')]?_0x37577a['attributes']:_0x38890c[_0x6cef('0x29')];if(_0x265d2e[_0x6cef('0x2a')][_0x6cef('0x41')]){_0x37577a['include']=[{'all':!![]}];}_0x37577a=_[_0x6cef('0x38')]({},_0x37577a,_0x265d2e[_0x6cef('0x3a')]);return db[_0x6cef('0x25')][_0x6cef('0x42')](_0x37577a)['then'](handleEntityNotFound(_0x5a820a,null))['then'](respondWithResult(_0x5a820a,null))[_0x6cef('0x43')](handleError(_0x5a820a,null));};exports[_0x6cef('0x44')]=function(_0x4e5553,_0x14f74a){return db['WhatsappTransferReport'][_0x6cef('0x44')](_0x4e5553[_0x6cef('0x45')],{})[_0x6cef('0x20')](respondWithResult(_0x14f74a,0xc9))[_0x6cef('0x43')](handleError(_0x14f74a,null));};exports[_0x6cef('0x1f')]=function(_0xb9d31c,_0x369d57){if(_0xb9d31c[_0x6cef('0x45')]['id']){delete _0xb9d31c[_0x6cef('0x45')]['id'];}return db['WhatsappTransferReport'][_0x6cef('0x42')]({'where':{'id':_0xb9d31c['params']['id']}})['then'](handleEntityNotFound(_0x369d57,null))[_0x6cef('0x20')](saveUpdates(_0xb9d31c['body'],null))['then'](respondWithResult(_0x369d57,null))[_0x6cef('0x43')](handleError(_0x369d57,null));};exports['destroy']=function(_0x24c224,_0x5dece6){return db[_0x6cef('0x25')]['find']({'where':{'id':_0x24c224[_0x6cef('0x3e')]['id']}})[_0x6cef('0x20')](handleEntityNotFound(_0x5dece6,null))[_0x6cef('0x20')](removeEntity(_0x5dece6,null))[_0x6cef('0x43')](handleError(_0x5dece6,null));};exports['describe']=function(_0x52d89a,_0x2a7144){return db[_0x6cef('0x25')][_0x6cef('0x46')]()[_0x6cef('0x20')](respondWithResult(_0x2a7144,null))[_0x6cef('0x43')](handleError(_0x2a7144,null));}; \ No newline at end of file +var _0x85da=['nolimit','order','sort','filter','where','options','includeAll','include','rows','params','merge','find','catch','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x557fe7,_0xcf8dd4){var _0x57b9b7=function(_0x1d213b){while(--_0x1d213b){_0x557fe7['push'](_0x557fe7['shift']());}};_0x57b9b7(++_0xcf8dd4);}(_0x85da,0x1bc));var _0xa85d=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x85da[_0x1762b4];return _0x29beda;};'use strict';var pdf=require(_0xa85d('0x0'));var emlformat=require(_0xa85d('0x1'));var rimraf=require(_0xa85d('0x2'));var zipdir=require(_0xa85d('0x3'));var jsonpatch=require(_0xa85d('0x4'));var rp=require(_0xa85d('0x5'));var moment=require(_0xa85d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa85d('0x7'));var util=require('util');var path=require(_0xa85d('0x8'));var sox=require(_0xa85d('0x9'));var csv=require(_0xa85d('0xa'));var ejs=require(_0xa85d('0xb'));var fs=require('fs');var _=require(_0xa85d('0xc'));var squel=require(_0xa85d('0xd'));var crypto=require(_0xa85d('0xe'));var jsforce=require(_0xa85d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa85d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa85d('0x10'));var authService=require(_0xa85d('0x11'));var qs=require(_0xa85d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa85d('0x13'));var logger=require('../../config/logger')(_0xa85d('0x14'));var utils=require(_0xa85d('0x15'));var config=require(_0xa85d('0x16'));var licenseUtil=require(_0xa85d('0x17'));var db=require(_0xa85d('0x18'))['db'];function respondWithStatusCode(_0x1a2a02,_0x5dae8d){_0x5dae8d=_0x5dae8d||0xcc;return function(_0x27b552){if(_0x27b552){return _0x1a2a02[_0xa85d('0x19')](_0x5dae8d);}return _0x1a2a02[_0xa85d('0x1a')](_0x5dae8d)[_0xa85d('0x1b')]();};}function respondWithResult(_0x46b359,_0x5b3bd5){_0x5b3bd5=_0x5b3bd5||0xc8;return function(_0x5ec700){if(_0x5ec700){return _0x46b359[_0xa85d('0x1a')](_0x5b3bd5)['json'](_0x5ec700);}};}function respondWithFilteredResult(_0x34bfb8,_0x5f20ad){return function(_0x2e8154){if(_0x2e8154){var _0x576a91=_0x2e8154[_0xa85d('0x1c')],_0x434c40=_0x5f20ad[_0xa85d('0x1d')],_0x5109f8=_0x5f20ad[_0xa85d('0x1d')]+_0x5f20ad[_0xa85d('0x1e')],_0x26202b;if(_0x5109f8>=_0x576a91){_0x5109f8=_0x576a91;_0x26202b=0xc8;}else{_0x26202b=0xce;}_0x34bfb8['status'](_0x26202b);return _0x34bfb8[_0xa85d('0x1f')](_0xa85d('0x20'),_0x434c40+'-'+_0x5109f8+'/'+_0x576a91)['json'](_0x2e8154);}return null;};}function patchUpdates(_0x68562d){return function(_0x465b4a){try{jsonpatch['apply'](_0x465b4a,_0x68562d,!![]);}catch(_0x2c38f1){return BPromise[_0xa85d('0x21')](_0x2c38f1);}return _0x465b4a['save']();};}function saveUpdates(_0x3a2563,_0x2b2f73){return function(_0x491daf){if(_0x491daf){return _0x491daf['update'](_0x3a2563)['then'](function(_0x4e3e79){return _0x4e3e79;});}return null;};}function removeEntity(_0x2aa3ad,_0x1589e7){return function(_0x3761b5){if(_0x3761b5){return _0x3761b5['destroy']()[_0xa85d('0x22')](function(){_0x2aa3ad[_0xa85d('0x1a')](0xcc)[_0xa85d('0x1b')]();});}};}function handleEntityNotFound(_0x433ad5,_0x3233ec){return function(_0x3c4ff4){if(!_0x3c4ff4){_0x433ad5[_0xa85d('0x19')](0x194);}return _0x3c4ff4;};}function handleError(_0x3c2bff,_0x3bd898){_0x3bd898=_0x3bd898||0x1f4;return function(_0x1e5022){logger['error'](_0x1e5022[_0xa85d('0x23')]);if(_0x1e5022[_0xa85d('0x24')]){delete _0x1e5022['name'];}_0x3c2bff['status'](_0x3bd898)[_0xa85d('0x25')](_0x1e5022);};}exports[_0xa85d('0x26')]=function(_0x55c692,_0x257354){var _0x48affe={},_0x5e86e7={},_0x4a4566={'count':0x0,'rows':[]};var _0x488f2a=_[_0xa85d('0x27')](db[_0xa85d('0x28')][_0xa85d('0x29')],function(_0x26a2b5){return{'name':_0x26a2b5[_0xa85d('0x2a')],'type':_0x26a2b5['type'][_0xa85d('0x2b')]};});_0x5e86e7[_0xa85d('0x2c')]=_[_0xa85d('0x27')](_0x488f2a,_0xa85d('0x24'));_0x5e86e7[_0xa85d('0x2d')]=_[_0xa85d('0x2e')](_0x55c692['query']);_0x5e86e7[_0xa85d('0x2f')]=_[_0xa85d('0x30')](_0x5e86e7['model'],_0x5e86e7[_0xa85d('0x2d')]);_0x48affe['attributes']=_['intersection'](_0x5e86e7[_0xa85d('0x2c')],qs[_0xa85d('0x31')](_0x55c692['query']['fields']));_0x48affe[_0xa85d('0x32')]=_0x48affe['attributes'][_0xa85d('0x33')]?_0x48affe[_0xa85d('0x32')]:_0x5e86e7[_0xa85d('0x2c')];if(!_0x55c692[_0xa85d('0x2d')][_0xa85d('0x34')](_0xa85d('0x35'))){_0x48affe[_0xa85d('0x1e')]=qs[_0xa85d('0x1e')](_0x55c692['query'][_0xa85d('0x1e')]);_0x48affe[_0xa85d('0x1d')]=qs[_0xa85d('0x1d')](_0x55c692[_0xa85d('0x2d')][_0xa85d('0x1d')]);}_0x48affe[_0xa85d('0x36')]=qs['sort'](_0x55c692[_0xa85d('0x2d')][_0xa85d('0x37')]);_0x48affe['where']=qs[_0xa85d('0x2f')](_['pick'](_0x55c692[_0xa85d('0x2d')],_0x5e86e7[_0xa85d('0x2f')]),_0x488f2a);if(_0x55c692[_0xa85d('0x2d')][_0xa85d('0x38')]){_0x48affe[_0xa85d('0x39')]=_['merge'](_0x48affe[_0xa85d('0x39')],{'$or':_[_0xa85d('0x27')](_0x488f2a,function(_0x2d1ff1){if(_0x2d1ff1['type']!=='VIRTUAL'){var _0x552961={};_0x552961[_0x2d1ff1[_0xa85d('0x24')]]={'$like':'%'+_0x55c692[_0xa85d('0x2d')][_0xa85d('0x38')]+'%'};return _0x552961;}})});}_0x48affe=_['merge']({},_0x48affe,_0x55c692[_0xa85d('0x3a')]);var _0x4d745e={'where':_0x48affe[_0xa85d('0x39')]};return db[_0xa85d('0x28')][_0xa85d('0x1c')](_0x4d745e)['then'](function(_0x1ece15){_0x4a4566[_0xa85d('0x1c')]=_0x1ece15;if(_0x55c692[_0xa85d('0x2d')][_0xa85d('0x3b')]){_0x48affe[_0xa85d('0x3c')]=[{'all':!![]}];}return db[_0xa85d('0x28')]['findAll'](_0x48affe);})[_0xa85d('0x22')](function(_0x4f5cbf){_0x4a4566[_0xa85d('0x3d')]=_0x4f5cbf;return _0x4a4566;})[_0xa85d('0x22')](respondWithFilteredResult(_0x257354,_0x48affe))['catch'](handleError(_0x257354,null));};exports['show']=function(_0x533526,_0x26dfc4){var _0x112f2b={'raw':!![],'where':{'id':_0x533526[_0xa85d('0x3e')]['id']}},_0x4afa56={};_0x4afa56[_0xa85d('0x2c')]=_[_0xa85d('0x2e')](db[_0xa85d('0x28')][_0xa85d('0x29')]);_0x4afa56[_0xa85d('0x2d')]=_[_0xa85d('0x2e')](_0x533526[_0xa85d('0x2d')]);_0x4afa56['filters']=_['intersection'](_0x4afa56[_0xa85d('0x2c')],_0x4afa56[_0xa85d('0x2d')]);_0x112f2b[_0xa85d('0x32')]=_['intersection'](_0x4afa56['model'],qs[_0xa85d('0x31')](_0x533526[_0xa85d('0x2d')][_0xa85d('0x31')]));_0x112f2b[_0xa85d('0x32')]=_0x112f2b[_0xa85d('0x32')]['length']?_0x112f2b[_0xa85d('0x32')]:_0x4afa56[_0xa85d('0x2c')];if(_0x533526[_0xa85d('0x2d')]['includeAll']){_0x112f2b[_0xa85d('0x3c')]=[{'all':!![]}];}_0x112f2b=_[_0xa85d('0x3f')]({},_0x112f2b,_0x533526[_0xa85d('0x3a')]);return db[_0xa85d('0x28')][_0xa85d('0x40')](_0x112f2b)[_0xa85d('0x22')](handleEntityNotFound(_0x26dfc4,null))[_0xa85d('0x22')](respondWithResult(_0x26dfc4,null))[_0xa85d('0x41')](handleError(_0x26dfc4,null));};exports[_0xa85d('0x42')]=function(_0x4fccf5,_0x19df6d){return db[_0xa85d('0x28')][_0xa85d('0x42')](_0x4fccf5[_0xa85d('0x43')],{})[_0xa85d('0x22')](respondWithResult(_0x19df6d,0xc9))[_0xa85d('0x41')](handleError(_0x19df6d,null));};exports[_0xa85d('0x44')]=function(_0x1eab7a,_0x3e2eae){if(_0x1eab7a['body']['id']){delete _0x1eab7a['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x1eab7a[_0xa85d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e2eae,null))[_0xa85d('0x22')](saveUpdates(_0x1eab7a[_0xa85d('0x43')],null))[_0xa85d('0x22')](respondWithResult(_0x3e2eae,null))[_0xa85d('0x41')](handleError(_0x3e2eae,null));};exports[_0xa85d('0x45')]=function(_0x15b2fa,_0x16a117){return db[_0xa85d('0x28')][_0xa85d('0x40')]({'where':{'id':_0x15b2fa[_0xa85d('0x3e')]['id']}})[_0xa85d('0x22')](handleEntityNotFound(_0x16a117,null))[_0xa85d('0x22')](removeEntity(_0x16a117,null))[_0xa85d('0x41')](handleError(_0x16a117,null));};exports['describe']=function(_0x5d5e01,_0x3d99cb){return db[_0xa85d('0x28')][_0xa85d('0x46')]()[_0xa85d('0x22')](respondWithResult(_0x3d99cb,null))[_0xa85d('0x41')](handleError(_0x3d99cb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 25ab27a..ac7df20 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 _0x5db7=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1ccafc,_0x131971){var _0x35e4dc=function(_0x594e60){while(--_0x594e60){_0x1ccafc['push'](_0x1ccafc['shift']());}};_0x35e4dc(++_0x131971);}(_0x5db7,0xc8));var _0x75db=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x5db7[_0x558e45];return _0x3e9075;};'use strict';var _=require(_0x75db('0x0'));var util=require('util');var logger=require(_0x75db('0x1'))(_0x75db('0x2'));var moment=require(_0x75db('0x3'));var BPromise=require('bluebird');var rp=require(_0x75db('0x4'));var fs=require('fs');var path=require(_0x75db('0x5'));var rimraf=require(_0x75db('0x6'));var config=require(_0x75db('0x7'));var attributes=require(_0x75db('0x8'));module[_0x75db('0x9')]=function(_0x4d608b,_0x9fc980){return _0x4d608b['define'](_0x75db('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x75db('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb65=['report_whatsapp_transfer','uniqueid','lodash','api','moment','path','../../config/environment','exports'];(function(_0x30e1a1,_0x4c585f){var _0x2555b8=function(_0x3f9fe5){while(--_0x3f9fe5){_0x30e1a1['push'](_0x30e1a1['shift']());}};_0x2555b8(++_0x4c585f);}(_0xeb65,0x1aa));var _0x5eb6=function(_0x44e17d,_0xfadab4){_0x44e17d=_0x44e17d-0x0;var _0x28a5bb=_0xeb65[_0x44e17d];return _0x28a5bb;};'use strict';var _=require(_0x5eb6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5eb6('0x1'));var moment=require(_0x5eb6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eb6('0x3'));var rimraf=require('rimraf');var config=require(_0x5eb6('0x4'));var attributes=require('./whatsappTransferReport.attributes');module[_0x5eb6('0x5')]=function(_0x5a5b68,_0x1e02d9){return _0x5a5b68['define']('WhatsappTransferReport',attributes,{'tableName':_0x5eb6('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5eb6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 00a63df..53de22e 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(_0x145747,_0x501280){var _0x512565=function(_0x1e4d66){while(--_0x1e4d66){_0x145747['push'](_0x145747['shift']());}};_0x512565(++_0x501280);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x2e42b5,_0x3f947d){var _0x5029dd=function(_0x3978b2){while(--_0x3978b2){_0x2e42b5['push'](_0x2e42b5['shift']());}};_0x5029dd(++_0x3f947d);}(_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 diff --git a/server/app.js b/server/app.js index 6589892..b48a576 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb89c=['info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','then','listen'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb89c,0x198));var _0xcb89=function(_0xe76753,_0x4f4192){_0xe76753=_0xe76753-0x0;var _0x596382=_0xb89c[_0xe76753];return _0x596382;};'use strict';var _=require(_0xcb89('0x0'));var mysqldb=require(_0xcb89('0x1'));var rpc=require(_0xcb89('0x2'));var config=require(_0xcb89('0x3'));var logger=require('./config/logger')(_0xcb89('0x4'));var pm2=require(_0xcb89('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xcb89('0x6'));var chat=require(_0xcb89('0x7'));var whatsapp=require(_0xcb89('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xcb89('0x9')]()[_0xcb89('0xa')](function(){return rpc[_0xcb89('0xb')]();})['then'](function(_0xc7804d){logger[_0xcb89('0xc')](_0xc7804d);return chat['start']();})['then'](function(){return whatsapp[_0xcb89('0xd')]();})['then'](function(){return schedule[_0xcb89('0xd')]();})[_0xcb89('0xa')](function(){return transcribe[_0xcb89('0xd')]();})[_0xcb89('0xa')](function(_0x385353){logger[_0xcb89('0xc')](_0x385353);return pm2['start'](pm2Config);})[_0xcb89('0xa')](function(_0x5b1cdd){logger[_0xcb89('0xc')](_0xcb89('0xe'),_[_0xcb89('0xf')](_[_0xcb89('0x10')](_0x5b1cdd,{'status':_0xcb89('0x11')}),_0xcb89('0x12'))[_0xcb89('0x13')]());logger['info'](_0xcb89('0x14'),_[_0xcb89('0xf')](_['filter'](_0x5b1cdd,function(_0x335236){return _0x335236[_0xcb89('0x15')]!==_0xcb89('0x11');}),'name')[_0xcb89('0x13')]()||'None');config['seedDB']&&require(_0xcb89('0x16'))[_0xcb89('0x17')]();require(_0xcb89('0x18'))[_0xcb89('0x17')]();})[_0xcb89('0x19')](function(_0x37aece){logger[_0xcb89('0x1a')](_0xcb89('0x1b'),_0x37aece);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x42f4=['map','status','None','seedDB','./config/seedDB','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:'];(function(_0x55c49d,_0x454bdb){var _0x15fa49=function(_0x43adb5){while(--_0x43adb5){_0x55c49d['push'](_0x55c49d['shift']());}};_0x15fa49(++_0x454bdb);}(_0x42f4,0x19d));var _0x442f=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x42f4[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x442f('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x442f('0x1'));var config=require(_0x442f('0x2'));var logger=require(_0x442f('0x3'))(_0x442f('0x4'));var pm2=require(_0x442f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0x442f('0x6'));var transcribe=require(_0x442f('0x7'));function main(){return mysqldb['db']['sequelize'][_0x442f('0x8')]()[_0x442f('0x9')](function(){return rpc[_0x442f('0xa')]();})[_0x442f('0x9')](function(_0x6c0b4b){logger[_0x442f('0xb')](_0x6c0b4b);return chat['start']();})[_0x442f('0x9')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x442f('0x9')](function(){return transcribe[_0x442f('0xc')]();})[_0x442f('0x9')](function(_0x86f590){logger[_0x442f('0xb')](_0x86f590);return pm2[_0x442f('0xc')](pm2Config);})[_0x442f('0x9')](function(_0x4780cb){logger[_0x442f('0xb')](_0x442f('0xd'),_['map'](_[_0x442f('0xe')](_0x4780cb,{'status':_0x442f('0xf')}),_0x442f('0x10'))[_0x442f('0x11')]());logger[_0x442f('0xb')](_0x442f('0x12'),_[_0x442f('0x13')](_[_0x442f('0xe')](_0x4780cb,function(_0x21d907){return _0x21d907[_0x442f('0x14')]!==_0x442f('0xf');}),_0x442f('0x10'))[_0x442f('0x11')]()||_0x442f('0x15'));config[_0x442f('0x16')]&&require(_0x442f('0x17'))['default']();require(_0x442f('0x18'))['default']();})['catch'](function(_0x5668e0){logger['error'](_0x442f('0x19'),_0x5668e0);process[_0x442f('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c7c3910..a324e19 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 _0x8ea9=['verify','randomBytes','toString','floor','HS512','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','email','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','length','join','promisify','sign','secret','payload','options'];(function(_0x310202,_0x4c2c3b){var _0x27497e=function(_0x428416){while(--_0x428416){_0x310202['push'](_0x310202['shift']());}};_0x27497e(++_0x4c2c3b);}(_0x8ea9,0x7d));var _0x98ea=function(_0xa86135,_0x19e49a){_0xa86135=_0xa86135-0x0;var _0x41a892=_0x8ea9[_0xa86135];return _0x41a892;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x98ea('0x0'));var hardwareConf=require(_0x98ea('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x98ea('0x2'));var _=require(_0x98ea('0x3'));var jwt=require(_0x98ea('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x98ea('0x5'));var basicAuth=require(_0x98ea('0x6'));var crypto=require(_0x98ea('0x7'));var BPromise=require(_0x98ea('0x8'));var util=require('util');var moment=require(_0x98ea('0x9'));var validateJwt=expressJwt({'secret':config[_0x98ea('0xa')][_0x98ea('0xb')]});var userAttributes=['id','role','fullname',_0x98ea('0xc'),'internal',_0x98ea('0xd'),'userpic',_0x98ea('0xe'),_0x98ea('0xf'),_0x98ea('0x10'),'chatPause',_0x98ea('0x11'),_0x98ea('0x12'),_0x98ea('0x13'),_0x98ea('0x14'),'pauseType',_0x98ea('0x15'),'lastLoginAt',_0x98ea('0x16'),_0x98ea('0x17'),_0x98ea('0x18'),_0x98ea('0x19'),_0x98ea('0x1a'),_0x98ea('0x1b'),_0x98ea('0x1c'),_0x98ea('0x1d'),_0x98ea('0x1e'),'phoneBarEnableDtmfTone',_0x98ea('0x1f'),'phoneBarExpires',_0x98ea('0x20'),_0x98ea('0x21'),_0x98ea('0x22'),_0x98ea('0x23'),_0x98ea('0x24'),_0x98ea('0x25'),_0x98ea('0x26')];exports[_0x98ea('0x27')]=function(){return this['isAuthenticated'](!![])[_0x98ea('0x28')](function(_0x58d27c,_0x567fbb,_0x315f88){if(_0x58d27c[_0x98ea('0x29')]){_0x315f88();}else{return db[_0x98ea('0x2a')][_0x98ea('0x2b')]({'where':{'id':_0x58d27c['params']['id']},'attributes':['id',_0x98ea('0x2c'),_0x98ea('0x2d')],'raw':!![]})[_0x98ea('0x2e')](function(_0x5ba18c){if(_0x5ba18c&&_0x5ba18c['closed']){return _0x567fbb['status'](_0x5ba18c[_0x98ea('0x2d')]==='unmanaged'?0x195:0x193)['json']({'message':_0x5ba18c['disposition']===_0x98ea('0x2f')?_0x98ea('0x30'):_0x98ea('0x31')});}else{_0x315f88();}})[_0x98ea('0x32')](function(_0x2b22c1){_0x315f88(_0x2b22c1);});}});};exports[_0x98ea('0x33')]=function isAuthenticated(_0x17aea4){return compose()['use'](function(_0xd15c3f,_0x273846,_0x224f10){var _0x478e3b;if(_0xd15c3f[_0x98ea('0x34')]['authorization']){if(_[_0x98ea('0x35')](_0xd15c3f[_0x98ea('0x34')][_0x98ea('0x36')],_0x98ea('0x37'))){var _0x16afaf=basicAuth(_0xd15c3f);db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'name':_0x16afaf[_0x98ea('0xc')]}})[_0x98ea('0x2e')](function(_0x30b11b){if(!_0x30b11b||!_0x30b11b[_0x98ea('0x3a')](_0x16afaf['pass'])){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x3d')});}_0xd15c3f[_0x98ea('0x29')]={'id':_0x30b11b['id']};_0x224f10();})['catch'](function(_0x33eea2){_0x224f10(_0x33eea2);});}else if(_[_0x98ea('0x35')](_0xd15c3f[_0x98ea('0x34')][_0x98ea('0x36')],_0x98ea('0x3e'))){validateJwt(_0xd15c3f,_0x273846,_0x224f10);}else{if(_0x17aea4){_0x224f10();}else{return _0x273846[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x3f')});}}}else if(_0xd15c3f['query'][_0x98ea('0x40')]){try{var _0x335006={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x98ea('0x41')]()};verifyJwt(_0xd15c3f[_0x98ea('0x42')][_0x98ea('0x40')],_0x335006)[_0x98ea('0x2e')](function(_0x47e5b8){return db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'id':_0x47e5b8[_0x98ea('0x43')]}})[_0x98ea('0x2e')](function(_0x13d294){_0x478e3b=_0x13d294;return db['Setting'][_0x98ea('0x2b')]({'where':{'id':0x1},'attributes':[_0x98ea('0x44'),_0x98ea('0x45')],'raw':!![]});})[_0x98ea('0x2e')](function(_0x5ba4e7){if(!_0x478e3b||!_[_0x98ea('0x46')](_0x478e3b[_0x98ea('0x47')],_0x47e5b8['nonce'])){return _0x273846['status'](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x48')});}if(_0x478e3b['disabled']){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}if(_0x478e3b['blocked']){if(_0x5ba4e7[_0x98ea('0x45')]>0x0){if(moment(_0x478e3b[_0x98ea('0x4a')])['add'](_0x5ba4e7[_0x98ea('0x45')],_0x98ea('0x4b'))>moment()){return _0x273846['status'](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}}else{return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});}}_0xd15c3f[_0x98ea('0x29')]={'id':_0x478e3b['id']};_0x224f10();});})[_0x98ea('0x32')](function(){return _0x273846[_0x98ea('0x3b')](0x191)[_0x98ea('0x3c')]({'message':_0x98ea('0x49')});});}catch(_0x174b6d){_0x224f10(_0x174b6d);}}else if(_0x17aea4){_0x224f10();}else{return _0x273846[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x3f')});}})[_0x98ea('0x28')](function(_0x1cc558,_0x27ffc0,_0x400da9){if(_0x1cc558[_0x98ea('0x29')]){db[_0x98ea('0x38')][_0x98ea('0x39')]({'where':{'id':_0x1cc558[_0x98ea('0x29')]['id']},'attributes':userAttributes})['then'](function(_0xc3ef54){if(!_0xc3ef54){return _0x27ffc0[_0x98ea('0x3b')](0x194)[_0x98ea('0x3c')]({'message':_0x98ea('0x4c')});}_0x1cc558[_0x98ea('0x29')]=_0xc3ef54;_0x400da9();})[_0x98ea('0x32')](function(_0x41aa5e){_0x400da9(_0x41aa5e);});}else if(_0x17aea4){_0x400da9();}else{return _0x27ffc0[_0x98ea('0x3b')](0x194)['json']({'message':_0x98ea('0x4d')});}});};exports[_0x98ea('0x4e')]=function canUpdate(){return compose()[_0x98ea('0x28')](function(_0x12838b,_0x3e8f0a,_0x3ae819){return licenseUtil[_0x98ea('0x4f')]()[_0x98ea('0x2e')](function(_0x3b1741){if(_0x3b1741['update']){_0x3ae819();}else{return _0x3e8f0a[_0x98ea('0x3b')](0x193)[_0x98ea('0x3c')]({'message':_0x98ea('0x50')});}})[_0x98ea('0x32')](function(_0x328366){_0x3ae819(_0x328366);});});};exports[_0x98ea('0x51')]=function(_0x49c62a,_0x33c23d,_0x1b3f30){_0x49c62a[_0x98ea('0x51')]=!![];return _0x1b3f30();};exports[_0x98ea('0x52')]=function signToken(_0x202765){return signJwt(_0x202765);};exports[_0x98ea('0x53')]=function(_0x2f2880,_0x2cc88b){if(!_0x2f2880['user']){return _0x2cc88b[_0x98ea('0x3b')](0x194)[_0x98ea('0x3c')]({'message':_0x98ea('0x54')});}var _0x603d06={'payload':{'id':_0x2f2880[_0x98ea('0x29')]['id'],'role':_0x2f2880[_0x98ea('0x29')][_0x98ea('0x55')]},'options':{'expiresIn':0x15180}};return signJwt(_0x603d06)[_0x98ea('0x2e')](function(_0x27932c){_0x2cc88b[_0x98ea('0x56')](_0x98ea('0x57'),_0x27932c);_0x2cc88b[_0x98ea('0x58')]('/dashboards/general');})[_0x98ea('0x32')](function(_0x18db99){return _0x2cc88b[_0x98ea('0x3b')](0x1f4)[_0x98ea('0x59')](_0x18db99);});};exports[_0x98ea('0x5a')]=function(_0x422eaa){if(_['isNil'](_0x422eaa[_0x98ea('0x47')])||_['isNil'](_0x422eaa[_0x98ea('0x5b')])){return null;}else{return createJwt(_0x422eaa);}};exports[_0x98ea('0x5c')]=function(_0x176f4d){_0x176f4d['apiKeyNonce']=generateNonce();_0x176f4d['apiKeyIat']=generateIssuedAt();return createJwt(_0x176f4d);};exports[_0x98ea('0x5d')]=function(_0x53bb87,_0x31485){var _0x5d5a89=_0x53bb87[_0x98ea('0x42')]['apikey'];if(_0x5d5a89){var _0x5b3d23={'nonce':_0x31485[_0x98ea('0x47')],'iat':_0x31485[_0x98ea('0x5b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x98ea('0x41')]()};return verifyJwt(_0x5d5a89,_0x5b3d23)[_0x98ea('0x2e')](function(){return generateApiKey(_0x31485);});}else{throw{'message':_0x98ea('0x5e')};}};exports[_0x98ea('0x5f')]=function(_0x52c90e){var _0x1748d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1748d2[_0x98ea('0x60')](_0x52c90e))throw new db[(_0x98ea('0x61'))]['ValidationError'](_0x98ea('0x62'));return;};exports[_0x98ea('0x63')]=function(_0x3afd7d,_0xbc652,_0x2034bb){var _0x127699=encryptor[_0x98ea('0x64')](_0xbc652)['split'](',');for(var _0x4e3642=0x0;_0x4e3642<_0x2034bb;_0x4e3642++){if(!_0x127699[_0x4e3642])break;if(_0x3afd7d[_0x98ea('0x65')]()===_0x127699[_0x4e3642][_0x98ea('0x65')]()){var _0x586c29=util[_0x98ea('0x66')](_0x98ea('0x67'),_0x2034bb);if(_0x2034bb===0x1){_0x586c29=_0x98ea('0x68');}throw new db[(_0x98ea('0x61'))][(_0x98ea('0x69'))](_0x586c29);}}return;};exports[_0x98ea('0x6a')]=function(_0x349356,_0x6db48d){var _0x16bf53=_0x6db48d?encryptor[_0x98ea('0x64')](_0x6db48d)[_0x98ea('0x6b')](','):[];if(_0x16bf53[_0x98ea('0x6c')]===0x5){_0x16bf53['splice'](-0x1,0x1);}_0x16bf53['unshift'](_0x349356);return encryptor['encryptString'](_0x16bf53[_0x98ea('0x6d')](','));};function signJwt(_0x3f5b42){var _0x4dab6f=BPromise[_0x98ea('0x6e')](jwt[_0x98ea('0x6f')],{'context':jwt});var _0x525d17=_0x3f5b42[_0x98ea('0x70')]||config['secrets'][_0x98ea('0xb')];return new BPromise(function(_0x59873f,_0x86532a){_0x4dab6f(_0x3f5b42[_0x98ea('0x71')],_0x525d17,_0x3f5b42[_0x98ea('0x72')])[_0x98ea('0x2e')](function(_0x5fc82e){_0x59873f(_0x5fc82e);})[_0x98ea('0x32')](function(_0x2c06c7){_0x86532a(_0x2c06c7);});});}function verifyJwt(_0x4a91bc,_0x3363ad,_0x51d691){var _0x258320=BPromise[_0x98ea('0x6e')](jwt[_0x98ea('0x73')],{'context':jwt});var _0x562704=_0x51d691||config['secrets'][_0x98ea('0xb')];return new BPromise(function(_0x47db47,_0x1e0f30){_0x258320(_0x4a91bc,_0x562704,_0x3363ad)[_0x98ea('0x2e')](function(_0x3d65bb){_0x47db47(_0x3d65bb);})[_0x98ea('0x32')](function(_0x218db7){_0x1e0f30(_0x218db7);});});}function generateNonce(){return crypto[_0x98ea('0x74')](0x10)[_0x98ea('0x75')]('hex');}function generateIssuedAt(){return Math[_0x98ea('0x76')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x48f10f){var _0x24cbf9={'payload':{'iat':_0x48f10f[_0x98ea('0x5b')],'nonce':_0x48f10f['apiKeyNonce']},'options':{'algorithm':_0x98ea('0x77'),'subject':_0x48f10f['id'][_0x98ea('0x75')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x24cbf9)[_0x98ea('0x2e')](function(_0x218d8b){return{'iat':_0x48f10f[_0x98ea('0x5b')],'nonce':_0x48f10f['apiKeyNonce'],'token':_0x218d8b};});} \ No newline at end of file +var _0x55d7=['permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isAuthenticated','use','findOne','params','then','closed','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','name','json','Wrong\x20credentials.','user','startsWith','Bearer','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','verify','randomBytes','toString','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','composable-middleware','basic-auth','util','moment','secrets','session','role','fullname','email','userpic'];(function(_0x24e87f,_0x255dc9){var _0x5e6dba=function(_0x1039ef){while(--_0x1039ef){_0x24e87f['push'](_0x24e87f['shift']());}};_0x5e6dba(++_0x255dc9);}(_0x55d7,0x1b9));var _0x755d=function(_0x21f3ca,_0x493fa1){_0x21f3ca=_0x21f3ca-0x0;var _0x51e18e=_0x55d7[_0x21f3ca];return _0x51e18e;};'use strict';var db=require(_0x755d('0x0'))['db'];var config=require(_0x755d('0x1'));var hardwareConf=require(_0x755d('0x2'));var licenseUtil=require(_0x755d('0x3'));var encryptor=require(_0x755d('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x755d('0x5'));var basicAuth=require(_0x755d('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x755d('0x7'));var moment=require(_0x755d('0x8'));var validateJwt=expressJwt({'secret':config[_0x755d('0x9')][_0x755d('0xa')]});var userAttributes=['id',_0x755d('0xb'),_0x755d('0xc'),'name','internal',_0x755d('0xd'),_0x755d('0xe'),_0x755d('0xf'),_0x755d('0x10'),_0x755d('0x11'),'chatPause','mailPause',_0x755d('0x12'),_0x755d('0x13'),_0x755d('0x14'),'pauseType','showWebBar',_0x755d('0x15'),'lastPauseAt',_0x755d('0x16'),_0x755d('0x17'),_0x755d('0x18'),_0x755d('0x19'),_0x755d('0x1a'),_0x755d('0x1b'),'phoneBarDnd','phoneBarEnableRecording',_0x755d('0x1c'),_0x755d('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x755d('0x1e'),_0x755d('0x1f'),_0x755d('0x20'),_0x755d('0x21'),_0x755d('0x22'),_0x755d('0x23')];exports['isChatInteractionAuthorized']=function(){return this[_0x755d('0x24')](!![])[_0x755d('0x25')](function(_0x3ae0e8,_0x4cf40c,_0x4bd9a0){if(_0x3ae0e8['user']){_0x4bd9a0();}else{return db['ChatInteraction'][_0x755d('0x26')]({'where':{'id':_0x3ae0e8[_0x755d('0x27')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x755d('0x28')](function(_0x2233e9){if(_0x2233e9&&_0x2233e9[_0x755d('0x29')]){return _0x4cf40c[_0x755d('0x2a')](_0x2233e9[_0x755d('0x2b')]===_0x755d('0x2c')?0x195:0x193)['json']({'message':_0x2233e9['disposition']==='unmanaged'?_0x755d('0x2d'):_0x755d('0x2e')});}else{_0x4bd9a0();}})[_0x755d('0x2f')](function(_0x354e44){_0x4bd9a0(_0x354e44);});}});};exports[_0x755d('0x24')]=function isAuthenticated(_0x43109d){return compose()[_0x755d('0x25')](function(_0x3c39cf,_0x12995c,_0x2b3d4a){var _0x26e746;if(_0x3c39cf[_0x755d('0x30')]['authorization']){if(_['startsWith'](_0x3c39cf[_0x755d('0x30')][_0x755d('0x31')],'Basic')){var _0x4edf56=basicAuth(_0x3c39cf);db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'name':_0x4edf56[_0x755d('0x34')]}})[_0x755d('0x28')](function(_0x1a5f84){if(!_0x1a5f84||!_0x1a5f84['authenticate'](_0x4edf56['pass'])){return _0x12995c['status'](0x191)[_0x755d('0x35')]({'message':_0x755d('0x36')});}_0x3c39cf[_0x755d('0x37')]={'id':_0x1a5f84['id']};_0x2b3d4a();})[_0x755d('0x2f')](function(_0x3b160d){_0x2b3d4a(_0x3b160d);});}else if(_[_0x755d('0x38')](_0x3c39cf[_0x755d('0x30')][_0x755d('0x31')],_0x755d('0x39'))){validateJwt(_0x3c39cf,_0x12995c,_0x2b3d4a);}else{if(_0x43109d){_0x2b3d4a();}else{return _0x12995c[_0x755d('0x2a')](0x193)[_0x755d('0x35')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3c39cf['query'][_0x755d('0x3a')]){try{var _0x4a7161={'audience':hardwareConf[_0x755d('0x3b')](),'issuer':hardwareConf[_0x755d('0x3b')]()};verifyJwt(_0x3c39cf[_0x755d('0x3c')]['apikey'],_0x4a7161)['then'](function(_0x19c092){return db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'id':_0x19c092[_0x755d('0x3d')]}})[_0x755d('0x28')](function(_0x2d078d){_0x26e746=_0x2d078d;return db[_0x755d('0x3e')][_0x755d('0x26')]({'where':{'id':0x1},'attributes':[_0x755d('0x3f'),_0x755d('0x40')],'raw':!![]});})['then'](function(_0x499ab2){if(!_0x26e746||!_['isEqual'](_0x26e746[_0x755d('0x41')],_0x19c092[_0x755d('0x42')])){return _0x12995c[_0x755d('0x2a')](0x191)[_0x755d('0x35')]({'message':_0x755d('0x43')});}if(_0x26e746[_0x755d('0x44')]){return _0x12995c['status'](0x191)[_0x755d('0x35')]({'message':_0x755d('0x45')});}if(_0x26e746[_0x755d('0x46')]){if(_0x499ab2[_0x755d('0x40')]>0x0){if(moment(_0x26e746[_0x755d('0x47')])['add'](_0x499ab2['blockDuration'],_0x755d('0x48'))>moment()){return _0x12995c[_0x755d('0x2a')](0x191)['json']({'message':_0x755d('0x45')});}}else{return _0x12995c['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x3c39cf[_0x755d('0x37')]={'id':_0x26e746['id']};_0x2b3d4a();});})['catch'](function(){return _0x12995c[_0x755d('0x2a')](0x191)[_0x755d('0x35')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x202443){_0x2b3d4a(_0x202443);}}else if(_0x43109d){_0x2b3d4a();}else{return _0x12995c['status'](0x193)['json']({'message':_0x755d('0x49')});}})[_0x755d('0x25')](function(_0x5604af,_0x1ef322,_0x2879d4){if(_0x5604af[_0x755d('0x37')]){db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'id':_0x5604af[_0x755d('0x37')]['id']},'attributes':userAttributes})[_0x755d('0x28')](function(_0x2972b8){if(!_0x2972b8){return _0x1ef322[_0x755d('0x2a')](0x194)[_0x755d('0x35')]({'message':'User\x20not\x20found.'});}_0x5604af[_0x755d('0x37')]=_0x2972b8;_0x2879d4();})[_0x755d('0x2f')](function(_0x4bf1fa){_0x2879d4(_0x4bf1fa);});}else if(_0x43109d){_0x2879d4();}else{return _0x1ef322[_0x755d('0x2a')](0x194)['json']({'message':_0x755d('0x4a')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x755d('0x25')](function(_0x718b48,_0x1751c1,_0x1e2ebd){return licenseUtil[_0x755d('0x4b')]()[_0x755d('0x28')](function(_0x31438f){if(_0x31438f[_0x755d('0x4c')]){_0x1e2ebd();}else{return _0x1751c1[_0x755d('0x2a')](0x193)[_0x755d('0x35')]({'message':_0x755d('0x4d')});}})[_0x755d('0x2f')](function(_0x568934){_0x1e2ebd(_0x568934);});});};exports[_0x755d('0x4e')]=function(_0x1cb478,_0x1151f9,_0x343fd1){_0x1cb478['isMiddleware']=!![];return _0x343fd1();};exports['signToken']=function signToken(_0x28eaec){return signJwt(_0x28eaec);};exports[_0x755d('0x4f')]=function(_0xb41a23,_0x1f21a3){if(!_0xb41a23['user']){return _0x1f21a3['status'](0x194)[_0x755d('0x35')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xc1a3fa={'payload':{'id':_0xb41a23[_0x755d('0x37')]['id'],'role':_0xb41a23[_0x755d('0x37')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xc1a3fa)[_0x755d('0x28')](function(_0x1ec5ec){_0x1f21a3[_0x755d('0x50')](_0x755d('0x51'),_0x1ec5ec);_0x1f21a3[_0x755d('0x52')](_0x755d('0x53'));})['catch'](function(_0xdf96c4){return _0x1f21a3['status'](0x1f4)[_0x755d('0x54')](_0xdf96c4);});};exports[_0x755d('0x55')]=function(_0x449b81){if(_[_0x755d('0x56')](_0x449b81['apiKeyNonce'])||_[_0x755d('0x56')](_0x449b81[_0x755d('0x57')])){return null;}else{return createJwt(_0x449b81);}};exports[_0x755d('0x58')]=function(_0x5b1dd2){_0x5b1dd2['apiKeyNonce']=generateNonce();_0x5b1dd2[_0x755d('0x57')]=generateIssuedAt();return createJwt(_0x5b1dd2);};exports[_0x755d('0x59')]=function(_0x376e7a,_0x5c260c){var _0x33222e=_0x376e7a['query']['apikey'];if(_0x33222e){var _0x53e6e7={'nonce':_0x5c260c[_0x755d('0x41')],'iat':_0x5c260c[_0x755d('0x57')],'audience':hardwareConf[_0x755d('0x3b')](),'issuer':hardwareConf[_0x755d('0x3b')]()};return verifyJwt(_0x33222e,_0x53e6e7)[_0x755d('0x28')](function(){return generateApiKey(_0x5c260c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x755d('0x5a')]=function(_0x5bf5fe){var _0x1518b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1518b1[_0x755d('0x5b')](_0x5bf5fe))throw new db[(_0x755d('0x5c'))][(_0x755d('0x5d'))](_0x755d('0x5e'));return;};exports[_0x755d('0x5f')]=function(_0x32444c,_0x3381f5,_0x57a452){var _0x44fd40=encryptor[_0x755d('0x60')](_0x3381f5)[_0x755d('0x61')](',');for(var _0x4dc7e9=0x0;_0x4dc7e9<_0x57a452;_0x4dc7e9++){if(!_0x44fd40[_0x4dc7e9])break;if(_0x32444c[_0x755d('0x62')]()===_0x44fd40[_0x4dc7e9][_0x755d('0x62')]()){var _0x4842f3=util[_0x755d('0x63')](_0x755d('0x64'),_0x57a452);if(_0x57a452===0x1){_0x4842f3=_0x755d('0x65');}throw new db[(_0x755d('0x5c'))][(_0x755d('0x5d'))](_0x4842f3);}}return;};exports[_0x755d('0x66')]=function(_0x5a33cf,_0x29aa6d){var _0xed3bee=_0x29aa6d?encryptor[_0x755d('0x60')](_0x29aa6d)[_0x755d('0x61')](','):[];if(_0xed3bee['length']===0x5){_0xed3bee[_0x755d('0x67')](-0x1,0x1);}_0xed3bee[_0x755d('0x68')](_0x5a33cf);return encryptor[_0x755d('0x69')](_0xed3bee[_0x755d('0x6a')](','));};function signJwt(_0x419834){var _0x5d1704=BPromise[_0x755d('0x6b')](jwt[_0x755d('0x6c')],{'context':jwt});var _0x4e434e=_0x419834[_0x755d('0x6d')]||config['secrets'][_0x755d('0xa')];return new BPromise(function(_0x36a1e9,_0x2c19be){_0x5d1704(_0x419834['payload'],_0x4e434e,_0x419834['options'])['then'](function(_0x42d824){_0x36a1e9(_0x42d824);})[_0x755d('0x2f')](function(_0x558d20){_0x2c19be(_0x558d20);});});}function verifyJwt(_0x3b3555,_0x413476,_0x34f522){var _0x19f652=BPromise[_0x755d('0x6b')](jwt[_0x755d('0x6e')],{'context':jwt});var _0x23d363=_0x34f522||config[_0x755d('0x9')]['session'];return new BPromise(function(_0x31d5a6,_0x47ff78){_0x19f652(_0x3b3555,_0x23d363,_0x413476)[_0x755d('0x28')](function(_0x1759ce){_0x31d5a6(_0x1759ce);})[_0x755d('0x2f')](function(_0x5d895a){_0x47ff78(_0x5d895a);});});}function generateNonce(){return crypto[_0x755d('0x6f')](0x10)[_0x755d('0x70')]('hex');}function generateIssuedAt(){return Math[_0x755d('0x71')](Date['now']()/0x3e8)[_0x755d('0x70')]();}function createJwt(_0x36c780){var _0x4b3572={'payload':{'iat':_0x36c780[_0x755d('0x57')],'nonce':_0x36c780[_0x755d('0x41')]},'options':{'algorithm':'HS512','subject':_0x36c780['id']['toString'](),'issuer':hardwareConf[_0x755d('0x3b')](),'audience':hardwareConf[_0x755d('0x3b')]()}};return signJwt(_0x4b3572)['then'](function(_0x5a78b4){return{'iat':_0x36c780[_0x755d('0x57')],'nonce':_0x36c780[_0x755d('0x41')],'token':_0x5a78b4};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e173274..742b536 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 _0x3e24=['aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','algorithm','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x3e24,0x167));var _0x43e2=function(_0x40fc07,_0x2627f4){_0x40fc07=_0x40fc07-0x0;var _0x30bded=_0x3e24[_0x40fc07];return _0x30bded;};'use strict';var crypto=require(_0x43e2('0x0'));var fs=require('fs');var BPromise=require(_0x43e2('0x1'));var config=require(_0x43e2('0x2'));const stringOptions={'secret':config[_0x43e2('0x3')][_0x43e2('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x43e2('0x5')};function combineOptions(_0x1ff04b){var _0x5d2806={};for(var _0x1dd127 in fileOptions){if(fileOptions[_0x43e2('0x6')](_0x1dd127)){_0x5d2806[_0x1dd127]=fileOptions[_0x1dd127];}}if(_0x1ff04b){for(var _0x1a89fc in _0x1ff04b){if(_0x1ff04b[_0x43e2('0x6')](_0x1a89fc)){_0x5d2806[_0x1a89fc]=_0x1ff04b[_0x1a89fc];}}}return _0x5d2806;}exports[_0x43e2('0x7')]=function(_0x121e2e,_0x23b2d8,_0x59956d,_0xb75b){return new BPromise(function(_0x2357bc,_0x4bd2ce){_0xb75b=combineOptions(_0xb75b);var _0x1c96f9=new Buffer(_0x59956d);var _0x2fdf85=fs['createReadStream'](_0x121e2e);var _0x2ed387=fs[_0x43e2('0x8')](_0x23b2d8);var _0x52146c=crypto[_0x43e2('0x9')](_0xb75b['algorithm'],_0x1c96f9);_0x2fdf85['on']('data',function(_0x5847f0){var _0x103220=new Buffer(_0x52146c[_0x43e2('0xa')](_0x5847f0),_0x43e2('0xb'));_0x2ed387[_0x43e2('0xc')](_0x103220);});_0x2fdf85['on'](_0x43e2('0xd'),function(){try{var _0x68e82d=new Buffer(_0x52146c[_0x43e2('0xe')](_0x43e2('0xb')),_0x43e2('0xb'));_0x2ed387[_0x43e2('0xc')](_0x68e82d);_0x2ed387[_0x43e2('0xd')]();_0x2ed387['on'](_0x43e2('0xf'),function(){return _0x2357bc(_0x23b2d8);});}catch(_0x5ee7fc){fs[_0x43e2('0x10')](_0x23b2d8);return _0x4bd2ce(_0x5ee7fc);}});});};exports[_0x43e2('0x11')]=function(_0xb929b5,_0x2a0fb0,_0x5cea01,_0x4a6443){return new BPromise(function(_0x241da2,_0x417ce5){_0x4a6443=combineOptions(_0x4a6443);var _0x27aa89=new Buffer(_0x5cea01);var _0x3a27eb=fs[_0x43e2('0x12')](_0xb929b5);var _0x1b7cde=fs[_0x43e2('0x8')](_0x2a0fb0);var _0x15ecb5=crypto[_0x43e2('0x13')](_0x4a6443[_0x43e2('0x14')],_0x27aa89);_0x3a27eb['on']('data',function(_0x3ee34c){var _0xb99e5d=new Buffer(_0x15ecb5['update'](_0x3ee34c),_0x43e2('0xb'));_0x1b7cde['write'](_0xb99e5d);});_0x3a27eb['on'](_0x43e2('0xd'),function(){try{var _0x13610f=new Buffer(_0x15ecb5[_0x43e2('0xe')](_0x43e2('0xb')),_0x43e2('0xb'));_0x1b7cde['write'](_0x13610f);_0x1b7cde[_0x43e2('0xd')]();_0x1b7cde['on'](_0x43e2('0xf'),function(){return _0x241da2(_0x2a0fb0);});}catch(_0x272934){fs['unlink'](_0x2a0fb0);return _0x417ce5(_0x272934);}});});};exports[_0x43e2('0x15')]=function(_0x32f048,_0x43078f,_0x11b285){var _0x4f20e6=_0x11b285||stringOptions[_0x43e2('0x14')];var _0xc717d8=_0x43078f||stringOptions[_0x43e2('0x16')];var _0x3b7b22=crypto[_0x43e2('0x9')](_0x4f20e6,_0xc717d8);var _0x2a593e=_0x3b7b22[_0x43e2('0xa')](_0x32f048,_0x43e2('0x17'),_0x43e2('0x18'));_0x2a593e+=_0x3b7b22[_0x43e2('0xe')](_0x43e2('0x18'));return _0x2a593e;};exports[_0x43e2('0x19')]=function(_0x52ed49,_0x430a0e,_0x2f2bd8){var _0x545246=_0x2f2bd8||stringOptions[_0x43e2('0x14')];var _0x1883c6=_0x430a0e||stringOptions[_0x43e2('0x16')];var _0x404483=crypto[_0x43e2('0x13')](_0x545246,_0x1883c6);var _0x5a896b=_0x404483[_0x43e2('0xa')](_0x52ed49,_0x43e2('0x18'),_0x43e2('0x17'));_0x5a896b+=_0x404483[_0x43e2('0xe')](_0x43e2('0x17'));return _0x5a896b;}; \ No newline at end of file +var _0x0a6b=['close','unlink','base64','decryptString','secret','createDecipher','utf8','crypto','session','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','decryptFile','data'];(function(_0x1c0d79,_0x4b49be){var _0x20c136=function(_0x281a77){while(--_0x281a77){_0x1c0d79['push'](_0x1c0d79['shift']());}};_0x20c136(++_0x4b49be);}(_0x0a6b,0x18e));var _0xb0a6=function(_0xc62435,_0x3584e0){_0xc62435=_0xc62435-0x0;var _0x56b63c=_0x0a6b[_0xc62435];return _0x56b63c;};'use strict';var crypto=require(_0xb0a6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config['secrets'][_0xb0a6('0x1')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xb0a6('0x2')};function combineOptions(_0x13dc41){var _0x1d3b78={};for(var _0x544a64 in fileOptions){if(fileOptions[_0xb0a6('0x3')](_0x544a64)){_0x1d3b78[_0x544a64]=fileOptions[_0x544a64];}}if(_0x13dc41){for(var _0x4cc3ae in _0x13dc41){if(_0x13dc41[_0xb0a6('0x3')](_0x4cc3ae)){_0x1d3b78[_0x4cc3ae]=_0x13dc41[_0x4cc3ae];}}}return _0x1d3b78;}exports[_0xb0a6('0x4')]=function(_0x5e2d2d,_0x11cd5b,_0x24515c,_0x2a8516){return new BPromise(function(_0x530c05,_0x47c553){_0x2a8516=combineOptions(_0x2a8516);var _0x5161af=new Buffer(_0x24515c);var _0x2ded05=fs[_0xb0a6('0x5')](_0x5e2d2d);var _0x34b835=fs[_0xb0a6('0x6')](_0x11cd5b);var _0x5252ed=crypto[_0xb0a6('0x7')](_0x2a8516[_0xb0a6('0x8')],_0x5161af);_0x2ded05['on']('data',function(_0x23eade){var _0x24e4fd=new Buffer(_0x5252ed[_0xb0a6('0x9')](_0x23eade),_0xb0a6('0xa'));_0x34b835[_0xb0a6('0xb')](_0x24e4fd);});_0x2ded05['on'](_0xb0a6('0xc'),function(){try{var _0x3d607f=new Buffer(_0x5252ed[_0xb0a6('0xd')](_0xb0a6('0xa')),_0xb0a6('0xa'));_0x34b835['write'](_0x3d607f);_0x34b835[_0xb0a6('0xc')]();_0x34b835['on']('close',function(){return _0x530c05(_0x11cd5b);});}catch(_0x397c36){fs['unlink'](_0x11cd5b);return _0x47c553(_0x397c36);}});});};exports[_0xb0a6('0xe')]=function(_0x59730e,_0x1d837f,_0x382c2f,_0x93243e){return new BPromise(function(_0x5673ad,_0x56b594){_0x93243e=combineOptions(_0x93243e);var _0x51105b=new Buffer(_0x382c2f);var _0x295b53=fs[_0xb0a6('0x5')](_0x59730e);var _0x18f994=fs[_0xb0a6('0x6')](_0x1d837f);var _0x13a1c8=crypto['createDecipher'](_0x93243e[_0xb0a6('0x8')],_0x51105b);_0x295b53['on'](_0xb0a6('0xf'),function(_0x372457){var _0xdc5de1=new Buffer(_0x13a1c8[_0xb0a6('0x9')](_0x372457),_0xb0a6('0xa'));_0x18f994['write'](_0xdc5de1);});_0x295b53['on'](_0xb0a6('0xc'),function(){try{var _0x6d2003=new Buffer(_0x13a1c8[_0xb0a6('0xd')](_0xb0a6('0xa')),_0xb0a6('0xa'));_0x18f994[_0xb0a6('0xb')](_0x6d2003);_0x18f994[_0xb0a6('0xc')]();_0x18f994['on'](_0xb0a6('0x10'),function(){return _0x5673ad(_0x1d837f);});}catch(_0x4b9a6c){fs[_0xb0a6('0x11')](_0x1d837f);return _0x56b594(_0x4b9a6c);}});});};exports['encryptString']=function(_0x1322ec,_0x2f1e97,_0x4997df){var _0x4aa68d=_0x4997df||stringOptions[_0xb0a6('0x8')];var _0x14993f=_0x2f1e97||stringOptions['secret'];var _0x3ea787=crypto[_0xb0a6('0x7')](_0x4aa68d,_0x14993f);var _0x259f47=_0x3ea787[_0xb0a6('0x9')](_0x1322ec,'utf8','base64');_0x259f47+=_0x3ea787[_0xb0a6('0xd')](_0xb0a6('0x12'));return _0x259f47;};exports[_0xb0a6('0x13')]=function(_0x58d923,_0x23bec3,_0x3347ac){var _0x3edd9a=_0x3347ac||stringOptions[_0xb0a6('0x8')];var _0x10cf86=_0x23bec3||stringOptions[_0xb0a6('0x14')];var _0x94d47f=crypto[_0xb0a6('0x15')](_0x3edd9a,_0x10cf86);var _0x4255b9=_0x94d47f['update'](_0x58d923,_0xb0a6('0x12'),_0xb0a6('0x16'));_0x4255b9+=_0x94d47f[_0xb0a6('0xd')]('utf8');return _0x4255b9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5a38d9f..141ca67 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 _0x6f0d=['rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','lodash','to-csv','bluebird'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4df3db,_0x5f66a4){_0x4df3db=_0x4df3db-0x0;var _0x322281=_0x6f0d[_0x4df3db];return _0x322281;};'use strict';var util=require('util');var path=require(_0xd6f0('0x0'));var _=require(_0xd6f0('0x1'));var csv=require(_0xd6f0('0x2'));var fs=require('fs');var BPromise=require(_0xd6f0('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var dbH=require(_0xd6f0('0x5'))[_0xd6f0('0x6')];var logger=require(_0xd6f0('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd6f0('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd6f0('0x8')][0x4];function analyticExtractedReport(_0x1af29c,_0x8b89a9){var _0x1a48a0={'status':_0x1af29c};var _0x4c4916={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8b89a9){_0x1a48a0['savename']=_0x8b89a9;}return db[_0xd6f0('0x9')][_0xd6f0('0xa')](_0x1a48a0,_0x4c4916);}function main(){var _0x2854cd=0x1388;var _0x382a2e;logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0xc'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return db[_0xd6f0('0xe')][_0xd6f0('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6f0('0x10')]})[_0xd6f0('0x11')](function(_0x306aad){if(_0x306aad){_0x382a2e=_0x306aad;_0x2854cd=_0x382a2e[_0xd6f0('0x10')]||0x1388;}})[_0xd6f0('0x11')](function(){return dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x15'),QUERY),{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]});})['then'](function(_0x419b7e){if(!_0x419b7e[0x0]['num']){return analyticExtractedReport(_0xd6f0('0x18'));}var _0x154e3e=[];var _0x41bd99=0x0;var _0x472156=!![];if(_0x419b7e&&_0x419b7e[_0xd6f0('0x19')]){var _0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd);if(_0x382a2e[_0xd6f0('0x1b')]){for(;_0x472156;_0x41bd99+=_0x2854cd,_0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd)){if(_0x61defb==0x0||_0x61defb==_0x419b7e[0x0][_0xd6f0('0x1a')]){_0x472156=![];}_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x1d'),QUERY,_0x2854cd,_0x41bd99),{'type':dbH[_0xd6f0('0x12')]['QueryTypes']['SELECT']}));}}else{_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](QUERY,{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]}));}}var _0x557c9b=path[_0xd6f0('0x1e')](PATH);var _0x515687=path[_0xd6f0('0x1f')](PATH,_0xd6f0('0x20'));var _0x5dbe1c=_0x382a2e[_0xd6f0('0x1b')]&&_0x154e3e[_0xd6f0('0x19')]>0x1;var _0x5ea2dd=[];if(!fs[_0xd6f0('0x21')](path[_0xd6f0('0x22')](_0x557c9b,_0x515687))&&_0x5dbe1c){fs[_0xd6f0('0x23')](path['join'](_0x557c9b,_0x515687));}return BPromise[_0xd6f0('0x24')](_0x154e3e,function(_0x3dc166){_0x5ea2dd['push'](_0x3dc166);})[_0xd6f0('0x11')](function(){for(var _0x551be8=0x0;_0x551be8<_0x5ea2dd[_0xd6f0('0x19')];_0x551be8+=0x1){var _0x3fb5c3;var _0x1630dc=_0x5ea2dd[_0x551be8];if(_0x5dbe1c){_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,_0x515687,util[_0xd6f0('0x14')](_0xd6f0('0x25'),_0x515687,_0x551be8,_0xd6f0('0x26')));}else{_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,util['format'](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x26')));}fs['writeFileSync'](_0x3fb5c3,csv(_0x1630dc));}})[_0xd6f0('0x11')](function(){if(_0x5dbe1c){zipdir(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),{'saveTo':path[_0xd6f0('0x22')](_0x557c9b,util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x28')))},function(_0x351fda,_0x3151f8){});rimraf(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),function(){});}})[_0xd6f0('0x11')](function(){logger[_0xd6f0('0xb')](util[_0xd6f0('0x14')](_0xd6f0('0x29'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return analyticExtractedReport(_0xd6f0('0x2a'),_0x5dbe1c?util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0x5dbe1c?_0xd6f0('0x28'):_0xd6f0('0x26')):null);});})[_0xd6f0('0x2b')](function(_0x3906ca){logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3906ca,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd6f0('0x2d'));});}main(); \ No newline at end of file +var _0x55e0=['util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x55e0,0xdc));var _0x055e=function(_0x3e9591,_0x48dd62){_0x3e9591=_0x3e9591-0x0;var _0x294721=_0x55e0[_0x3e9591];return _0x294721;};'use strict';var util=require(_0x055e('0x0'));var path=require(_0x055e('0x1'));var _=require(_0x055e('0x2'));var csv=require(_0x055e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];var dbH=require(_0x055e('0x5'))[_0x055e('0x6')];var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x055e('0x9')][0x4];function analyticExtractedReport(_0x4a442e,_0x8e7824){var _0x3c4cf={'status':_0x4a442e};var _0x376618={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7824){_0x3c4cf[_0x055e('0xa')]=_0x8e7824;}return db[_0x055e('0xb')]['update'](_0x3c4cf,_0x376618);}function main(){var _0x40779c=0x1388;var _0xd67814;logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x055e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x055e('0x10')]})[_0x055e('0x11')](function(_0x72d424){if(_0x72d424){_0xd67814=_0x72d424;_0x40779c=_0xd67814[_0x055e('0x10')]||0x1388;}})[_0x055e('0x11')](function(){return dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x14'),QUERY),{'type':dbH[_0x055e('0x12')][_0x055e('0x15')][_0x055e('0x16')]});})[_0x055e('0x11')](function(_0x56af18){if(!_0x56af18[0x0][_0x055e('0x17')]){return analyticExtractedReport(_0x055e('0x18'));}var _0x111cdb=[];var _0x599533=0x0;var _0x3f2d0e=!![];if(_0x56af18&&_0x56af18[_0x055e('0x19')]){var _0xb4e6ca=_0x56af18[0x0][_0x055e('0x17')]%(_0x599533+_0x40779c);if(_0xd67814[_0x055e('0x1a')]){for(;_0x3f2d0e;_0x599533+=_0x40779c,_0xb4e6ca=_0x56af18[0x0]['num']%(_0x599533+_0x40779c)){if(_0xb4e6ca==0x0||_0xb4e6ca==_0x56af18[0x0][_0x055e('0x17')]){_0x3f2d0e=![];}_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x1c'),QUERY,_0x40779c,_0x599533),{'type':dbH[_0x055e('0x12')]['QueryTypes'][_0x055e('0x16')]}));}}else{_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](QUERY,{'type':dbH[_0x055e('0x12')][_0x055e('0x15')]['SELECT']}));}}var _0x31c355=path[_0x055e('0x1d')](PATH);var _0x211594=path['basename'](PATH,_0x055e('0x1e'));var _0x2da6b=_0xd67814[_0x055e('0x1a')]&&_0x111cdb[_0x055e('0x19')]>0x1;var _0x51df23=[];if(!fs[_0x055e('0x1f')](path['join'](_0x31c355,_0x211594))&&_0x2da6b){fs[_0x055e('0x20')](path[_0x055e('0x21')](_0x31c355,_0x211594));}return BPromise[_0x055e('0x22')](_0x111cdb,function(_0x1a76c6){_0x51df23[_0x055e('0x1b')](_0x1a76c6);})[_0x055e('0x11')](function(){for(var _0x58caf9=0x0;_0x58caf9<_0x51df23[_0x055e('0x19')];_0x58caf9+=0x1){var _0x1f90a9;var _0x2a82f8=_0x51df23[_0x58caf9];if(_0x2da6b){_0x1f90a9=path['join'](_0x31c355,_0x211594,util[_0x055e('0xd')](_0x055e('0x23'),_0x211594,_0x58caf9,_0x055e('0x24')));}else{_0x1f90a9=path[_0x055e('0x21')](_0x31c355,util['format'](_0x055e('0x25'),_0x211594,'csv'));}fs[_0x055e('0x26')](_0x1f90a9,csv(_0x2a82f8));}})[_0x055e('0x11')](function(){if(_0x2da6b){zipdir(path[_0x055e('0x21')](_0x31c355,_0x211594),{'saveTo':path[_0x055e('0x21')](_0x31c355,util[_0x055e('0xd')]('%s.%s',_0x211594,_0x055e('0x27')))},function(_0x453e5e,_0x293062){});rimraf(path[_0x055e('0x21')](_0x31c355,_0x211594),function(){});}})[_0x055e('0x11')](function(){logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x055e('0x29'),_0x2da6b?util[_0x055e('0xd')]('%s.%s',_0x211594,_0x2da6b?_0x055e('0x27'):_0x055e('0x24')):null);});})[_0x055e('0x2a')](function(_0x20717b){logger[_0x055e('0xc')](util[_0x055e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x055e('0x2b')](_0x20717b,{'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 88a8848..cc9bafb 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x1f1902,_0x52bcaf){var _0x21b04b=function(_0x2c1a17){while(--_0x2c1a17){_0x1f1902['push'](_0x1f1902['shift']());}};_0x21b04b(++_0x52bcaf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x1abbef,_0x2aa65c){var _0x3bf92f=function(_0xf0a122){while(--_0xf0a122){_0x1abbef['push'](_0x1abbef['shift']());}};_0x3bf92f(++_0x2aa65c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 590cc20..3121675 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 _0xf34f=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','QueryTypes','length','num','query','SELECT','dirname','basename','.xlsx','existsSync','mkdirSync','join','push','xlsx','writeFileSync','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','update'];(function(_0x5d5f1c,_0x6ea981){var _0x1bbd93=function(_0xe662e0){while(--_0xe662e0){_0x5d5f1c['push'](_0x5d5f1c['shift']());}};_0x1bbd93(++_0x6ea981);}(_0xf34f,0x14d));var _0xff34=function(_0x1a87ab,_0x8fcb1a){_0x1a87ab=_0x1a87ab-0x0;var _0x1ca436=_0xf34f[_0x1a87ab];return _0x1ca436;};'use strict';var util=require('util');var path=require(_0xff34('0x0'));var _=require(_0xff34('0x1'));var fs=require('fs');var json2xls=require(_0xff34('0x2'));var BPromise=require(_0xff34('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xff34('0x4'));var db=require(_0xff34('0x5'))['db'];var dbH=require('../../mysqldb')[_0xff34('0x6')];var logger=require('../../config/logger')(_0xff34('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xff34('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xff34('0x8')][0x4];function analyticExtractedReport(_0x33f6fe,_0x7be1de){var _0xdd8a98={'status':_0x33f6fe};var _0x26dcf2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7be1de){_0xdd8a98[_0xff34('0x9')]=_0x7be1de;}return db['AnalyticExtractedReport'][_0xff34('0xa')](_0xdd8a98,_0x26dcf2);}function main(){var _0x32e715=0x1388;var _0x2e6c6b;logger['info'](util['format'](_0xff34('0xb'),EXTRACTED_REPORT_ID,_0xff34('0xc')));return db[_0xff34('0xd')][_0xff34('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xff34('0xf'),_0xff34('0x10')]})[_0xff34('0x11')](function(_0x112b9e){if(_0x112b9e){_0x2e6c6b=_0x112b9e;_0x32e715=_0x2e6c6b['splitSizeXlsx']||0x1388;}})[_0xff34('0x11')](function(){return dbH[_0xff34('0x12')]['query'](util[_0xff34('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xff34('0x12')][_0xff34('0x14')]['SELECT']});})[_0xff34('0x11')](function(_0x5805f7){if(!_0x5805f7[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1d1e03=[];var _0x4361cd=0x0;var _0xa4b9be=!![];if(_0x2e6c6b['split']){if(_0x5805f7&&_0x5805f7[_0xff34('0x15')]){var _0x11b94c=_0x5805f7[0x0][_0xff34('0x16')]%(_0x4361cd+_0x32e715);for(;_0xa4b9be;_0x4361cd+=_0x32e715,_0x11b94c=_0x5805f7[0x0][_0xff34('0x16')]%(_0x4361cd+_0x32e715)){if(_0x11b94c==0x0||_0x11b94c==_0x5805f7[0x0][_0xff34('0x16')]){_0xa4b9be=![];}_0x1d1e03['push'](dbH['sequelize'][_0xff34('0x17')](util[_0xff34('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x32e715,_0x4361cd),{'type':dbH['sequelize'][_0xff34('0x14')][_0xff34('0x18')]}));}}}else{_0x1d1e03['push'](dbH[_0xff34('0x12')][_0xff34('0x17')](QUERY,{'type':dbH[_0xff34('0x12')]['QueryTypes']['SELECT']}));}var _0x3368f7=path[_0xff34('0x19')](PATH);var _0x1ba762=path[_0xff34('0x1a')](PATH,_0xff34('0x1b'));var _0x6d4226=_0x2e6c6b[_0xff34('0xf')]&&_0x1d1e03[_0xff34('0x15')]>0x1;var _0x29a02f=[];if(!fs[_0xff34('0x1c')](path['join'](_0x3368f7,_0x1ba762))&&_0x6d4226){fs[_0xff34('0x1d')](path[_0xff34('0x1e')](_0x3368f7,_0x1ba762));}return BPromise['each'](_0x1d1e03,function(_0x15375a){_0x29a02f[_0xff34('0x1f')](_0x15375a);})[_0xff34('0x11')](function(){for(var _0x303731=0x0;_0x303731<_0x29a02f[_0xff34('0x15')];_0x303731+=0x1){var _0xa6b701;var _0x515b4b=_0x29a02f[_0x303731];if(_0x6d4226){_0xa6b701=path['join'](_0x3368f7,_0x1ba762,util[_0xff34('0x13')]('%s%d.%s',_0x1ba762,_0x303731,_0xff34('0x20')));}else{_0xa6b701=path[_0xff34('0x1e')](_0x3368f7,util[_0xff34('0x13')]('%s.%s',_0x1ba762,_0xff34('0x20')));}fs[_0xff34('0x21')](_0xa6b701,json2xls(_0x515b4b),_0xff34('0x22'));}})[_0xff34('0x11')](function(){if(_0x6d4226){zipdir(path[_0xff34('0x1e')](_0x3368f7,_0x1ba762),{'saveTo':path[_0xff34('0x1e')](_0x3368f7,util[_0xff34('0x13')](_0xff34('0x23'),_0x1ba762,_0xff34('0x24')))},function(_0x46ae73,_0x36bf25){});rimraf(path[_0xff34('0x1e')](_0x3368f7,_0x1ba762),function(){});}})[_0xff34('0x11')](function(){logger[_0xff34('0x25')](util[_0xff34('0x13')](_0xff34('0x26'),EXTRACTED_REPORT_ID,_0xff34('0xc')));return analyticExtractedReport(_0xff34('0x27'),_0x6d4226?util['format']('%s.%s',_0x1ba762,_0x6d4226?_0xff34('0x24'):_0xff34('0x20')):null);});})['catch'](function(_0x4a67e1){logger[_0xff34('0x25')](util[_0xff34('0x13')](_0xff34('0x28'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xff34('0x29')](_0x4a67e1,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xff34('0x2a'));});}main(); \ No newline at end of file +var _0x86c4=['xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Setting','find','split','then','sequelize','query','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s'];(function(_0x3bd2db,_0xbe4136){var _0x4b9d23=function(_0x2fbb7b){while(--_0x2fbb7b){_0x3bd2db['push'](_0x3bd2db['shift']());}};_0x4b9d23(++_0xbe4136);}(_0x86c4,0x17b));var _0x486c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86c4[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x486c('0x0'));var path=require(_0x486c('0x1'));var _=require(_0x486c('0x2'));var fs=require('fs');var json2xls=require(_0x486c('0x3'));var BPromise=require(_0x486c('0x4'));var zipdir=require(_0x486c('0x5'));var rimraf=require(_0x486c('0x6'));var db=require(_0x486c('0x7'))['db'];var dbH=require(_0x486c('0x7'))[_0x486c('0x8')];var logger=require(_0x486c('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x486c('0xa')][0x4];function analyticExtractedReport(_0x1eece9,_0x3eae5d){var _0x4c6536={'status':_0x1eece9};var _0x438c3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3eae5d){_0x4c6536[_0x486c('0xb')]=_0x3eae5d;}return db['AnalyticExtractedReport'][_0x486c('0xc')](_0x4c6536,_0x438c3f);}function main(){var _0x27e657=0x1388;var _0x2894f0;logger[_0x486c('0xd')](util[_0x486c('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x486c('0xf')][_0x486c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x486c('0x11'),'splitSizeXlsx']})[_0x486c('0x12')](function(_0x5a3877){if(_0x5a3877){_0x2894f0=_0x5a3877;_0x27e657=_0x2894f0['splitSizeXlsx']||0x1388;}})[_0x486c('0x12')](function(){return dbH[_0x486c('0x13')][_0x486c('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x486c('0x13')]['QueryTypes']['SELECT']});})[_0x486c('0x12')](function(_0x17eede){if(!_0x17eede[0x0]['num']){return analyticExtractedReport(_0x486c('0x15'));}var _0x38bb55=[];var _0x12f175=0x0;var _0x473394=!![];if(_0x2894f0[_0x486c('0x11')]){if(_0x17eede&&_0x17eede[_0x486c('0x16')]){var _0x1ac23e=_0x17eede[0x0][_0x486c('0x17')]%(_0x12f175+_0x27e657);for(;_0x473394;_0x12f175+=_0x27e657,_0x1ac23e=_0x17eede[0x0][_0x486c('0x17')]%(_0x12f175+_0x27e657)){if(_0x1ac23e==0x0||_0x1ac23e==_0x17eede[0x0][_0x486c('0x17')]){_0x473394=![];}_0x38bb55['push'](dbH[_0x486c('0x13')][_0x486c('0x14')](util[_0x486c('0xe')](_0x486c('0x18'),QUERY,_0x27e657,_0x12f175),{'type':dbH[_0x486c('0x13')][_0x486c('0x19')][_0x486c('0x1a')]}));}}}else{_0x38bb55[_0x486c('0x1b')](dbH[_0x486c('0x13')][_0x486c('0x14')](QUERY,{'type':dbH[_0x486c('0x13')][_0x486c('0x19')][_0x486c('0x1a')]}));}var _0x1f020c=path[_0x486c('0x1c')](PATH);var _0x2bcf65=path[_0x486c('0x1d')](PATH,_0x486c('0x1e'));var _0x36c9af=_0x2894f0['split']&&_0x38bb55['length']>0x1;var _0x418e7b=[];if(!fs[_0x486c('0x1f')](path[_0x486c('0x20')](_0x1f020c,_0x2bcf65))&&_0x36c9af){fs[_0x486c('0x21')](path[_0x486c('0x20')](_0x1f020c,_0x2bcf65));}return BPromise['each'](_0x38bb55,function(_0x2e0cca){_0x418e7b[_0x486c('0x1b')](_0x2e0cca);})[_0x486c('0x12')](function(){for(var _0xc43e36=0x0;_0xc43e36<_0x418e7b[_0x486c('0x16')];_0xc43e36+=0x1){var _0x2460f5;var _0x197a53=_0x418e7b[_0xc43e36];if(_0x36c9af){_0x2460f5=path[_0x486c('0x20')](_0x1f020c,_0x2bcf65,util[_0x486c('0xe')](_0x486c('0x22'),_0x2bcf65,_0xc43e36,_0x486c('0x23')));}else{_0x2460f5=path[_0x486c('0x20')](_0x1f020c,util[_0x486c('0xe')]('%s.%s',_0x2bcf65,_0x486c('0x23')));}fs[_0x486c('0x24')](_0x2460f5,json2xls(_0x197a53),_0x486c('0x25'));}})['then'](function(){if(_0x36c9af){zipdir(path[_0x486c('0x20')](_0x1f020c,_0x2bcf65),{'saveTo':path[_0x486c('0x20')](_0x1f020c,util[_0x486c('0xe')](_0x486c('0x26'),_0x2bcf65,_0x486c('0x27')))},function(_0x57ac0a,_0x39d616){});rimraf(path[_0x486c('0x20')](_0x1f020c,_0x2bcf65),function(){});}})[_0x486c('0x12')](function(){logger[_0x486c('0xd')](util['format'](_0x486c('0x28'),EXTRACTED_REPORT_ID,_0x486c('0x29')));return analyticExtractedReport(_0x486c('0x2a'),_0x36c9af?util['format'](_0x486c('0x26'),_0x2bcf65,_0x36c9af?_0x486c('0x27'):_0x486c('0x23')):null);});})[_0x486c('0x2b')](function(_0x529b79){logger[_0x486c('0xd')](util[_0x486c('0xe')](_0x486c('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x529b79,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x486c('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 81d1539..9d893e0 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 _0xae2b=['${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','length','toLowerCase','updatedAt','*,*,*,*','interval','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','type','context','VoiceExtensionId','CDR(destination)='];(function(_0x35ba0a,_0x57eaeb){var _0x4bddb0=function(_0x4a5600){while(--_0x4a5600){_0x35ba0a['push'](_0x35ba0a['shift']());}};_0x4bddb0(++_0x57eaeb);}(_0xae2b,0xb3));var _0xbae2=function(_0x4e0091,_0xc1ffc9){_0x4e0091=_0x4e0091-0x0;var _0x4c16a9=_0xae2b[_0x4e0091];return _0x4c16a9;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));function rewrite(_0x55ac17,_0x22b0f0){var _0x247e63=this;return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x3')][_0xbae2('0x4')]({'raw':!![]})[_0xbae2('0x5')](function(_0x564f86){_0x247e63[_0xbae2('0x6')]=_0x564f86;return _0x55ac17['models'][_0xbae2('0x7')][_0xbae2('0x4')]({'where':{'IntervalId':_0x22b0f0[_0xbae2('0x8')]},'raw':!![]});})['then'](function(_0x4788c4){return _0x55ac17['models']['VoiceExtension'][_0xbae2('0x4')]({'where':{'exten':{'$in':_[_0xbae2('0x9')](_[_0xbae2('0xa')](_0x4788c4,_0xbae2('0xb')))}},'order':[{'raw':_0xbae2('0xc')}],'raw':!![]});})[_0xbae2('0x5')](function(_0x843207){var _0x5a6d1f=_['filter'](_0x843207,{'priority':'1'});var _0x5207c7=_[_0xbae2('0xd')](_0x843207,{'isApp':0x1});var _0x5d6940=_[_0xbae2('0xe')](_0x5207c7,_0xbae2('0xb'));var _0x1b28ce=['queue',_0xbae2('0xf')];var _0x7de704=[];var _0x5b5222=[];for(var _0x156edd in _0x5d6940){if(_0x5d6940[_0xbae2('0x10')](_0x156edd)){_0x247e63[_0xbae2('0x11')]=0x2;_0x247e63[_0xbae2('0x12')]=[];_0x247e63[_0xbae2('0x13')]=_[_0xbae2('0x14')](_0x5a6d1f,{'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')]});_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':util[_0xbae2('0x17')]('CDR(type)=%s',_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')]),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0]['exten'],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')]==='outbound'){if(_0x247e63[_0xbae2('0x13')]){_0x247e63['extensions']['push']({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x1b')+(_0x247e63[_0xbae2('0x13')]['cutdigits']?_0xbae2('0x1c')+_0x247e63[_0xbae2('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}_0x247e63[_0xbae2('0x12')]['push']({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x1d')+_0x5d6940[_0x156edd][0x0]['VoiceExtensionId'],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});var _0x5b084f=_0x247e63[_0xbae2('0x11')]++;_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x1f')+(_0x5b084f+0x2)+_0xbae2('0x20')+(_0x5b084f+0x1)+')','context':_0x5d6940[_0x156edd][0x0]['context'],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x5b084f,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x247e63['extension']){_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0x247e63[_0xbae2('0x13')]['cutdigits']?_0xbae2('0x21')+_0x247e63['extension'][_0xbae2('0x22')]+'}':_0xbae2('0x23'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x24')+_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});if(_0x247e63['extension']&&_0x247e63[_0xbae2('0x13')][_0xbae2('0x10')]('recordingFormat')&&_0x247e63['extension'][_0xbae2('0x25')]!==_0xbae2('0x26')){_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x27'),'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0][_0xbae2('0x18')],'app':'Set','appdata':_0xbae2('0x28')+_0x247e63[_0xbae2('0x13')][_0xbae2('0x25')]||_0xbae2('0x29'),'context':_0x5d6940[_0x156edd][0x0]['context'],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});}}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63['extensions'][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x247e63[_0xbae2('0x12')]['push']({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'exten':_0x5d6940[_0x156edd][0x0][_0xbae2('0xb')],'priority':_0x247e63[_0xbae2('0x11')]++,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});for(var _0x35be12=0x0,_0x192bd3=0x0;_0x35be12<_0x5d6940[_0x156edd][_0xbae2('0x2a')];_0x35be12+=0x1,_0x192bd3=0x0){var _0x307457=_0x5d6940[_0x156edd][_0x35be12];if(_0x307457[_0xbae2('0x18')]){_0x307457[_0xbae2('0x18')]=_0x307457[_0xbae2('0x18')][_0xbae2('0x2b')]();}var _0x566db5=[];var _0x4df97a=[];delete _0x307457['id'];delete _0x307457['createdAt'];delete _0x307457[_0xbae2('0x2c')];var _0x20e1e1=_0x307457['interval']!==_0xbae2('0x2d')?[_0x307457[_0xbae2('0x2e')]]:_0x307457[_0xbae2('0x8')]?_[_0xbae2('0xa')](_[_0xbae2('0xd')](_0x247e63['intervals'],{'IntervalId':_0x307457['IntervalId']}),_0xbae2('0x2e')):[];if(_0x307457['hasOwnProperty'](_0xbae2('0x2f'))){if(_0x307457[_0xbae2('0x2f')]&&_0x307457[_0xbae2('0x2f')]!=='--'){_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':'Set','appdata':'CDR(tag)='+_0x307457['tag'],'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457['exten'],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}}if(_0x307457['type']==='outbound'&&_0x307457['hasOwnProperty']('callerID')){if(_0x307457[_0xbae2('0x30')]){_0x566db5[_0xbae2('0x15')]({'type':_0x307457['type'],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x31')+_0x307457[_0xbae2('0x30')]+')','context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}else{_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x32'),'context':_0x307457['context'],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457['VoiceExtensionId']});}}if(_0x307457[_0xbae2('0x10')](_0xbae2('0x33'))){if(_0x1b28ce['indexOf'](_0x307457['app'][_0xbae2('0x2b')]())>=0x0&&_0x307457[_0xbae2('0x34')]!==_0xbae2('0x35')){if(_0x307457[_0xbae2('0x33')]){_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x1e'),'appdata':_0xbae2('0x36'),'context':_0x307457['context'],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63['priority']+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x37'),'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1['length']+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}else{_0x566db5[_0xbae2('0x15')]({'type':_0x307457['type'],'app':_0xbae2('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x307457[_0xbae2('0x19')],'exten':_0x307457[_0xbae2('0xb')],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});_0x566db5[_0xbae2('0x15')]({'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x16'),'appdata':_0xbae2('0x38'),'context':_0x307457[_0xbae2('0x19')],'exten':_0x307457['exten'],'priority':_0x20e1e1[_0xbae2('0x2a')]+_0x247e63[_0xbae2('0x11')]+_0x192bd3++,'VoiceExtensionId':_0x307457[_0xbae2('0x1a')]});}}}for(var _0x30baa6=0x0;_0x30baa6<_0x20e1e1[_0xbae2('0x2a')];_0x30baa6+=0x1){var _0x2472d8=_0x247e63[_0xbae2('0x11')]+_0x20e1e1[_0xbae2('0x2a')];var _0x4fce75=_0x30baa6===_0x20e1e1['length']-0x1?_0x247e63[_0xbae2('0x11')]+_0x566db5[_0xbae2('0x2a')]+_0x4df97a[_0xbae2('0x2a')]+0x2:_0x247e63['priority']+_0x30baa6+0x1;_0x566db5[_0xbae2('0x39')](_0x30baa6,0x0,{'type':_0x307457[_0xbae2('0x18')],'app':_0xbae2('0x3a'),'appdata':_0x20e1e1[_0x30baa6]+'?'+_0x307457[_0xbae2('0x19')]+_0xbae2('0x3b')+_0x2472d8+':'+_0x307457[_0xbae2('0x19')]+_0xbae2('0x3b')+_0x4fce75,'exten':_0x307457[_0xbae2('0xb')],'context':_0x307457['context'],'priority':_0x247e63[_0xbae2('0x11')]+_0x30baa6,'VoiceExtensionId':_0x5d6940[_0x156edd][0x0]['VoiceExtensionId']});}_0x307457[_0xbae2('0x11')]=_0x566db5['length']?_[_0xbae2('0x3c')](_0x566db5)['priority']+0x1:_0x247e63[_0xbae2('0x11')];_0x247e63['priority']=(_0x4df97a['length']?_[_0xbae2('0x3c')](_0x4df97a)[_0xbae2('0x11')]:_0x307457['priority'])+0x1;_0x247e63[_0xbae2('0x12')]=_[_0xbae2('0x3d')](_0x247e63[_0xbae2('0x12')],_0x566db5,[_0x307457],_0x4df97a);}_0x247e63[_0xbae2('0x12')][_0xbae2('0x15')]({'type':_0x5d6940[_0x156edd][0x0]['type'],'app':_0xbae2('0x3e'),'exten':_0x5d6940[_0x156edd][0x0]['exten'],'context':_0x5d6940[_0x156edd][0x0][_0xbae2('0x19')],'priority':_0x247e63['priority'],'VoiceExtensionId':_0x5d6940[_0x156edd][0x0][_0xbae2('0x1a')]});_0x7de704[_0xbae2('0x15')](_0x5d6940[_0x156edd][0x0]['VoiceExtensionId']);_0x5b5222=_['concat'](_0x5b5222,_0x247e63[_0xbae2('0x12')]);}}return _0x55ac17[_0xbae2('0x3f')](function(_0x33888e){return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x7')][_0xbae2('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x7de704}},'transaction':_0x33888e})['then'](function(_0x1e09de){return _0x55ac17[_0xbae2('0x2')][_0xbae2('0x7')][_0xbae2('0x41')](_[_0xbae2('0x42')](_0x5b5222,_0xbae2('0x11')),{'transaction':_0x33888e});});});})[_0xbae2('0x43')](function(_0x5d8aa1){console['error'](_0x5d8aa1);});}exports[_0xbae2('0x44')]=rewrite; \ No newline at end of file +var _0x8529=['context','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','IntervalId','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','findAll','then','intervals','models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','find','push','type','Set','format','CDR(type)=%s'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x8529,0x73));var _0x9852=function(_0x4dcd99,_0xb153b3){_0x4dcd99=_0x4dcd99-0x0;var _0x517e00=_0x8529[_0x4dcd99];return _0x517e00;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2eb534,_0x22ebdc){var _0x1b8058=this;return _0x2eb534['models']['Interval'][_0x9852('0x0')]({'raw':!![]})[_0x9852('0x1')](function(_0x30a990){_0x1b8058[_0x9852('0x2')]=_0x30a990;return _0x2eb534[_0x9852('0x3')][_0x9852('0x4')]['findAll']({'where':{'IntervalId':_0x22ebdc['IntervalId']},'raw':!![]});})[_0x9852('0x1')](function(_0x46db54){return _0x2eb534['models']['VoiceExtension'][_0x9852('0x0')]({'where':{'exten':{'$in':_[_0x9852('0x5')](_['map'](_0x46db54,_0x9852('0x6')))}},'order':[{'raw':_0x9852('0x7')}],'raw':!![]});})['then'](function(_0x2636a1){var _0x565e1c=_[_0x9852('0x8')](_0x2636a1,{'priority':'1'});var _0x3d9929=_[_0x9852('0x8')](_0x2636a1,{'isApp':0x1});var _0x2c7d26=_['groupBy'](_0x3d9929,_0x9852('0x6'));var _0x3d0649=['queue',_0x9852('0x9')];var _0x1b76d1=[];var _0x154721=[];for(var _0x30d551 in _0x2c7d26){if(_0x2c7d26[_0x9852('0xa')](_0x30d551)){_0x1b8058[_0x9852('0xb')]=0x2;_0x1b8058['extensions']=[];_0x1b8058[_0x9852('0xc')]=_[_0x9852('0xd')](_0x565e1c,{'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')]});_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':util[_0x9852('0x11')](_0x9852('0x12'),_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')]),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});if(_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')]===_0x9852('0x14')){if(_0x1b8058[_0x9852('0xc')]){_0x1b8058[_0x9852('0x15')]['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x16')+(_0x1b8058[_0x9852('0xc')][_0x9852('0x17')]?_0x9852('0x18')+_0x1b8058['extension'][_0x9852('0x17')]+'}':_0x9852('0x19')),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058['priority']++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x1a')+_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')],'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});var _0x19f8a5=_0x1b8058['priority']++;_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x1c')+(_0x19f8a5+0x2)+'):Goto('+(_0x19f8a5+0x1)+')','context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x19f8a5,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});if(_0x1b8058[_0x9852('0xc')]){_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x1b8058['extension'][_0x9852('0x17')]?'CDR(prefix)=${EXTEN:0:'+_0x1b8058[_0x9852('0xc')][_0x9852('0x17')]+'}':_0x9852('0x1d'),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':'Set','appdata':_0x9852('0x1e')+_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')],'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});if(_0x1b8058['extension']&&_0x1b8058[_0x9852('0xc')]['hasOwnProperty'](_0x9852('0x1f'))&&_0x1b8058[_0x9852('0xc')][_0x9852('0x1f')]!==_0x9852('0x20')){_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x21'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x22')+_0x1b8058[_0x9852('0xc')]['recordingFormat']||_0x9852('0x23'),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});}}_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0]['type'],'app':_0x9852('0x10'),'appdata':_0x9852('0x24'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b8058[_0x9852('0x15')]['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x25'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x26'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});for(var _0x1ce175=0x0,_0x426108=0x0;_0x1ce175<_0x2c7d26[_0x30d551][_0x9852('0x27')];_0x1ce175+=0x1,_0x426108=0x0){var _0x26a898=_0x2c7d26[_0x30d551][_0x1ce175];if(_0x26a898['type']){_0x26a898[_0x9852('0xf')]=_0x26a898[_0x9852('0xf')]['toLowerCase']();}var _0x1d49f5=[];var _0x33a103=[];delete _0x26a898['id'];delete _0x26a898[_0x9852('0x28')];delete _0x26a898['updatedAt'];var _0x38cf4b=_0x26a898['interval']!==_0x9852('0x29')?[_0x26a898[_0x9852('0x2a')]]:_0x26a898[_0x9852('0x2b')]?_['map'](_[_0x9852('0x8')](_0x1b8058['intervals'],{'IntervalId':_0x26a898[_0x9852('0x2b')]}),_0x9852('0x2a')):[];if(_0x26a898['hasOwnProperty'](_0x9852('0x2c'))){if(_0x26a898[_0x9852('0x2c')]&&_0x26a898[_0x9852('0x2c')]!=='--'){_0x1d49f5['push']({'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':'CDR(tag)='+_0x26a898[_0x9852('0x2c')],'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}}if(_0x26a898['type']==='outbound'&&_0x26a898[_0x9852('0xa')]('callerID')){if(_0x26a898['callerID']){_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x2d'),'appdata':_0x9852('0x2e')+_0x26a898[_0x9852('0x2f')]+')','context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898['exten'],'priority':_0x38cf4b['length']+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}else{_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x30'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058['priority']+_0x426108++,'VoiceExtensionId':_0x26a898['VoiceExtensionId']});}}if(_0x26a898[_0x9852('0xa')]('answer')){if(_0x3d0649[_0x9852('0x31')](_0x26a898['app'][_0x9852('0x32')]())>=0x0&&_0x26a898[_0x9852('0x33')]!==_0x9852('0x34')){if(_0x26a898[_0x9852('0x35')]){_0x1d49f5['push']({'type':_0x26a898['type'],'app':'ExecIf','appdata':_0x9852('0x36'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});_0x1d49f5['push']({'type':_0x26a898['type'],'app':_0x9852('0x10'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}else{_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x37'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b['length']+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x26a898['context'],'exten':_0x26a898['exten'],'priority':_0x38cf4b['length']+_0x1b8058['priority']+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}}}for(var _0x582c12=0x0;_0x582c12<_0x38cf4b['length'];_0x582c12+=0x1){var _0x1d00bd=_0x1b8058[_0x9852('0xb')]+_0x38cf4b[_0x9852('0x27')];var _0x487009=_0x582c12===_0x38cf4b[_0x9852('0x27')]-0x1?_0x1b8058[_0x9852('0xb')]+_0x1d49f5[_0x9852('0x27')]+_0x33a103[_0x9852('0x27')]+0x2:_0x1b8058['priority']+_0x582c12+0x1;_0x1d49f5[_0x9852('0x38')](_0x582c12,0x0,{'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x39'),'appdata':_0x38cf4b[_0x582c12]+'?'+_0x26a898[_0x9852('0x13')]+_0x9852('0x3a')+_0x1d00bd+':'+_0x26a898[_0x9852('0x13')]+_0x9852('0x3a')+_0x487009,'exten':_0x26a898[_0x9852('0x6')],'context':_0x26a898[_0x9852('0x13')],'priority':_0x1b8058[_0x9852('0xb')]+_0x582c12,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x26a898[_0x9852('0xb')]=_0x1d49f5['length']?_[_0x9852('0x3b')](_0x1d49f5)[_0x9852('0xb')]+0x1:_0x1b8058[_0x9852('0xb')];_0x1b8058['priority']=(_0x33a103[_0x9852('0x27')]?_['last'](_0x33a103)[_0x9852('0xb')]:_0x26a898[_0x9852('0xb')])+0x1;_0x1b8058[_0x9852('0x15')]=_[_0x9852('0x3c')](_0x1b8058[_0x9852('0x15')],_0x1d49f5,[_0x26a898],_0x33a103);}_0x1b8058['extensions']['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x3d'),'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'context':_0x2c7d26[_0x30d551][0x0]['context'],'priority':_0x1b8058[_0x9852('0xb')],'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b76d1[_0x9852('0xe')](_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]);_0x154721=_[_0x9852('0x3c')](_0x154721,_0x1b8058['extensions']);}}return _0x2eb534['transaction'](function(_0x48893b){return _0x2eb534[_0x9852('0x3')][_0x9852('0x4')][_0x9852('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1b76d1}},'transaction':_0x48893b})[_0x9852('0x1')](function(_0x19107b){return _0x2eb534[_0x9852('0x3')]['VoiceExtension'][_0x9852('0x3f')](_[_0x9852('0x40')](_0x154721,_0x9852('0xb')),{'transaction':_0x48893b});});});})['catch'](function(_0x3ad245){console[_0x9852('0x41')](_0x3ad245);});}exports[_0x9852('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9aaa930..1339725 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x37ad22,_0x9ee922){var _0x30af42=function(_0x39aacc){while(--_0x39aacc){_0x37ad22['push'](_0x37ad22['shift']());}};_0x30af42(++_0x9ee922);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xcb91[_0xa30766];return _0x24e780;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2910c80..36d980a 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 _0x4ba9=['arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','phone','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','spread','stringify','start','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','argv'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x4ba9,0x93));var _0x94ba=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x4ba9[_0x4a7843];return _0x2c57fe;};'use strict';var fs=require('fs');var path=require(_0x94ba('0x0'));var _=require(_0x94ba('0x1'));var Papa=require('papaparse');var util=require(_0x94ba('0x2'));var BPromise=require(_0x94ba('0x3'));var moment=require(_0x94ba('0x4'));var squel=require(_0x94ba('0x5'));var Redis=require(_0x94ba('0x6'));var db=require(_0x94ba('0x7'))['db'];var config=require(_0x94ba('0x8'));var logger=require('../../../config/logger')(_0x94ba('0x9'));config[_0x94ba('0xa')]=_[_0x94ba('0xb')](config[_0x94ba('0xa')],{'host':_0x94ba('0xc'),'port':0x18eb});var socket=require(_0x94ba('0xd'))(new Redis(config[_0x94ba('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x94ba('0xe')](_0x94ba('0xf'));function isEmail(_0xaf9567){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))*$/[_0x94ba('0x10')](_0xaf9567);}function selectNotIn(_0x4118ae,_0x329a8a,_0x5c0b97,_0x3c7266,_0x386987){return squel[_0x94ba('0x11')]()[_0x94ba('0x12')]('phone')['from'](_0x3c7266)[_0x94ba('0x13')](_0x329a8a,null,_0x329a8a+_0x94ba('0x14')+_0x3c7266+'.'+_0x5c0b97)[_0x94ba('0x15')](_0x3c7266+'.'+_0x5c0b97+_0x94ba('0x16')+_0x4118ae+'.'+_0x5c0b97)[_0x94ba('0x15')](_0x329a8a+_0x94ba('0x17')+_0x386987[_0x94ba('0x13')]()+')');}function insertCmHopper(_0x1fd0dd,_0x145113,_0x264981,_0x103dde,_0xf1f8d2){var _0x4539ad=[_0x94ba('0x18'),_0x94ba('0x19'),_0x94ba('0x1a'),_0x94ba('0x1b'),_0x145113+'.'+_0x103dde,_0x94ba('0x1c'),'cm_contacts.updatedAt',_0x94ba('0x1d'),_0x94ba('0x1e'),'\x22'+_0xf1f8d2+'\x22'];return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')]('cm_hopper')[_0x94ba('0x21')](['phone',_0x94ba('0x22'),_0x94ba('0x23'),_0x94ba('0x24'),_0x103dde,_0x94ba('0x25'),_0x94ba('0x26'),_0x94ba('0x27'),_0x94ba('0x28'),_0x94ba('0x29')],squel[_0x94ba('0x11')]()[_0x94ba('0x2a')](_0x4539ad)[_0x94ba('0x2b')](_0x145113)['join'](_0x94ba('0x2c'),null,_0x94ba('0x2d')+_0x145113+'.CmListId')[_0x94ba('0x13')](_0x264981,null,_0x264981+'.id\x20=\x20'+_0x145113+'.'+_0x103dde)['where'](_0x145113+_0x94ba('0x2e'),_0x1fd0dd)[_0x94ba('0x15')](_0x94ba('0x2f'),NOW)[_0x94ba('0x15')](_0x94ba('0x30'),selectNotIn(_0x145113,_0x264981,_0x103dde,_0x94ba('0x31'),[_0x94ba('0x32'),_0x94ba('0x33')]))[_0x94ba('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x145113,_0x264981,_0x103dde,_0x94ba('0x31'),[_0x94ba('0x32')])))[_0x94ba('0x34')]();}function insertCmHopperBlack(_0x5d730f,_0x52d20c,_0x3e0236,_0x3d3fca){var _0x41d32b=['cm_contacts.phone',_0x94ba('0x1a'),_0x94ba('0x1b'),_0x52d20c+'.'+_0x3d3fca,'cm_contacts.createdAt',_0x94ba('0x35')];return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')]('cm_hopper_black')[_0x94ba('0x21')]([_0x94ba('0x36'),'ContactId',_0x94ba('0x24'),_0x3d3fca,_0x94ba('0x25'),_0x94ba('0x26')],squel[_0x94ba('0x11')]()['fields'](_0x41d32b)[_0x94ba('0x2b')](_0x52d20c)[_0x94ba('0x13')](_0x94ba('0x2c'),null,_0x94ba('0x2d')+_0x52d20c+'.CmListId')[_0x94ba('0x13')](_0x3e0236,null,_0x3e0236+_0x94ba('0x14')+_0x52d20c+'.'+_0x3d3fca)[_0x94ba('0x15')](_0x52d20c+_0x94ba('0x2e'),_0x5d730f)[_0x94ba('0x15')](_0x94ba('0x2f'),NOW)[_0x94ba('0x15')](_0x94ba('0x30'),squel[_0x94ba('0x11')]()[_0x94ba('0x12')](_0x94ba('0x36'))[_0x94ba('0x2b')](_0x94ba('0x37'))[_0x94ba('0x15')](_0x94ba('0x38'),_0x5d730f)[_0x94ba('0x15')](_0x3d3fca+_0x94ba('0x39'),_0x52d20c+'.'+_0x3d3fca)))['toString']();}function insertCmContact(_0x34df43,_0x4a5167,_0x49f632,_0x565e6d){var _0x4a836a=_['concat'](_[_0x94ba('0x3a')](_0x565e6d),[_0x94ba('0x24'),'CompanyId',_0x94ba('0x25'),_0x94ba('0x26')]);return squel[_0x94ba('0x1f')]()[_0x94ba('0x20')](_0x94ba('0x2c'))[_0x94ba('0x21')](_0x4a836a,squel['select']()[_0x94ba('0x2a')](_0x4a836a)[_0x94ba('0x2b')](_0x4a5167)[_0x94ba('0x15')]('('+_0x49f632['join'](',')+_0x94ba('0x3b'),squel[_0x94ba('0x11')]()['fields'](_0x49f632)[_0x94ba('0x2b')](_0x94ba('0x2c'))['where'](_0x94ba('0x38'),_0x34df43)[_0x94ba('0x15')](_0x94ba('0x3c')))[_0x94ba('0x15')](_0x94ba('0x3d'),squel['select']()[_0x94ba('0x12')]('MIN(id)',_0x94ba('0x3e'))[_0x94ba('0x2b')](_0x4a5167)[_0x94ba('0x3f')](_0x49f632[_0x94ba('0x13')](','))))[_0x94ba('0x34')]();}function handleStop(){logger[_0x94ba('0x40')](_0x94ba('0x41'));stopped=!![];}function handleUncaughtException(_0x4efbaf){logger[_0x94ba('0x42')](_0x4efbaf[_0x94ba('0x43')]);process[_0x94ba('0x44')](0x1);}function handleError(_0x3a4d90,_0xb8d2e){stats[_0x94ba('0x45')][_0x94ba('0x46')]({'name':_0xb8d2e[_0x94ba('0x47')],'message':_0xb8d2e['message'],'row':_0x3a4d90});}function handleQuery(_0x330ec9){logger[_0x94ba('0x40')](_0x330ec9);return db[_0x94ba('0x48')]['query'](_0x330ec9)[_0x94ba('0x49')](function(_0x383da5){results[_0x94ba('0x46')](_0x383da5);})['catch'](function(_0x2dad2f){logger[_0x94ba('0x42')](_0x2dad2f[_0x94ba('0x43')]);});}function main(_0x4689c7,_0x7f18a,_0x4b6a2a,_0x186182){logger['info']('main',_0x4689c7,JSON[_0x94ba('0x4a')](_0x7f18a));process['send'](_0x94ba('0x4b'));var _0x40281e=_0x7f18a['binding'];var _0x4c8285=_0x7f18a[_0x94ba('0x4c')];var _0x27b676=path[_0x94ba('0x13')](config[_0x94ba('0x4d')],_0x94ba('0x4e'),_0x4c8285+'.csv');var _0x83a988=_[_0x94ba('0x3a')](_0x40281e)[_0x94ba('0x13')]();logger[_0x94ba('0x40')](_0x94ba('0x4f'),_0x83a988);fs[_0x94ba('0x50')](_0x27b676,_0x83a988+'\x0a');Papa[_0x94ba('0x51')](fs[_0x94ba('0x52')](_0x4689c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x122dac,_0x3f67b5){try{for(var _0x938446=0x0,_0xace57a=[];_0x938446<_0x122dac[_0x94ba('0x53')][_0x94ba('0x54')];_0x938446++){stats['rows']+=0x1;if(_0x122dac['errors'][_0x938446]){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],_0x122dac[_0x94ba('0x45')][_0x938446]);}else{var _0x293652=[];for(var _0x22bb5e in _0x40281e){if(_0x40281e[_0x94ba('0x55')](_0x22bb5e)){if(_0x122dac[_0x94ba('0x53')][_0x938446][_0x40281e[_0x22bb5e]]){var _0x3fdc05=_['trim'](_0x122dac['data'][_0x938446][_0x40281e[_0x22bb5e]][_0x94ba('0x56')](/"/g,'\x27'));switch(_0x22bb5e){case _0x94ba('0x22'):var _0x40cab8=moment(_0x3fdc05,_0x94ba('0xf'),!![]);if(_0x40cab8[_0x94ba('0x57')]()){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x58'));}break;case _0x94ba('0x27'):var _0x16c81a=parseInt(_0x3fdc05);_0x3fdc05=_[_0x94ba('0x59')](_0x16c81a)||_0x16c81a<0x0||_0x16c81a>0x4?_0x186182?0x3:0x2:_0x16c81a;_0xace57a['push']('\x22'+_0x3fdc05+'\x22');break;case'UserId':var _0x1b7435=parseInt(_0x3fdc05);if(_['isNumber'](_0x1b7435)&&_[_0x94ba('0x5a')](_0x4b6a2a,_0x1b7435)){_0xace57a[_0x94ba('0x46')]('\x22'+_0x1b7435+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x5b'));}break;case'email':if(isEmail(_0x3fdc05)){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652['push'](_0x94ba('0x5c'));}break;case _0x94ba('0x5d'):var _0x352896=moment(_0x3fdc05,_0x94ba('0x5e'),!![]);if(_0x352896[_0x94ba('0x57')]()){_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}else{_0x293652[_0x94ba('0x46')](_0x94ba('0x5f'));}break;default:_0xace57a[_0x94ba('0x46')]('\x22'+_0x3fdc05+'\x22');}}else{switch(_0x22bb5e){case _0x94ba('0x60'):case _0x94ba('0x36'):_0x293652[_0x94ba('0x46')](_0x22bb5e+_0x94ba('0x61'));break;default:_0xace57a['push']('\x22\x22');}}}}if(_0x293652[_0x94ba('0x54')]){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],{'code':_0x94ba('0x62'),'message':_0x293652[_0x94ba('0x13')]()});}else{fs[_0x94ba('0x63')](_0x27b676,_0xace57a[_0x94ba('0x13')]()+'\x0a');}_0xace57a=[];}if(!(stats[_0x94ba('0x64')]%0xc8)){socket[_0x94ba('0x65')](_0x94ba('0x66')+_0x4c8285,stats);stats[_0x94ba('0x45')]=[];}}if(stopped){logger['info'](_0x94ba('0x67'));_0x3f67b5[_0x94ba('0x68')]();}}catch(_0x346cc4){handleError(_0x122dac[_0x94ba('0x53')][_0x938446],{'code':_0x94ba('0x69'),'message':_0x346cc4[_0x94ba('0x43')]});logger[_0x94ba('0x42')](_0x94ba('0x6a'),_0x346cc4[_0x94ba('0x43')]);}},'complete':function(){try{var _0x393d19=[];var _0x59b91b=_0x94ba('0x2c');if(_0x7f18a['duplicates']&&_0x7f18a[_0x94ba('0x6b')][_0x94ba('0x54')]){_0x59b91b=_0x94ba('0x6c')+_0x4c8285;_0x393d19[_0x94ba('0x46')]('CREATE\x20TABLE\x20'+_0x59b91b+_0x94ba('0x6d'));}var _0x13e79e=util[_0x94ba('0xe')](_0x94ba('0x6e'),_0x27b676,_0x59b91b,_0x83a988,_0x7f18a[_0x94ba('0x24')],_0x7f18a['CompanyId']||null,NOW,NOW);if(_[_0x94ba('0x6f')](_0x40281e[_0x94ba('0x22')])){_0x13e79e+=_0x94ba('0x70');}_0x393d19[_0x94ba('0x46')](_0x13e79e);if(_0x7f18a[_0x94ba('0x6b')]&&_0x7f18a['duplicates']['length']){_0x393d19['push'](insertCmContact(_0x7f18a[_0x94ba('0x24')],_0x59b91b,_0x7f18a[_0x94ba('0x6b')],_0x40281e));_0x393d19[_0x94ba('0x46')](_0x94ba('0x71')+_0x59b91b+';');}_0x393d19[_0x94ba('0x46')](insertCmHopper(_0x7f18a[_0x94ba('0x24')],_0x94ba('0x72'),_0x94ba('0x73'),_0x94ba('0x74'),_0x186182));_0x393d19['push'](insertCmHopperBlack(_0x7f18a[_0x94ba('0x24')],'voice_queues_has_cm_blacklists',_0x94ba('0x73'),'VoiceQueueId'));_0x393d19['push'](insertCmHopper(_0x7f18a[_0x94ba('0x24')],'campaigns_has_cm_lists',_0x94ba('0x75'),_0x94ba('0x76'),_0x186182));_0x393d19['push'](insertCmHopperBlack(_0x7f18a[_0x94ba('0x24')],_0x94ba('0x77'),'campaigns',_0x94ba('0x76')));BPromise[_0x94ba('0x78')](_0x393d19,handleQuery)[_0x94ba('0x79')](function(_0xde8be2){stats[_0x94ba('0x7a')]=!![];stats[_0x94ba('0x7b')]=_0x7f18a[_0x94ba('0x6b')]&&_0x7f18a['duplicates'][_0x94ba('0x54')]?results[0x2][_0x94ba('0x7b')]:results[0x0][_0x94ba('0x7b')];socket[_0x94ba('0x65')](_0x94ba('0x66')+_0x4c8285,stats);fs['unlink'](_0x4689c7);fs[_0x94ba('0x7c')](_0x27b676);process[_0x94ba('0x44')](0x0);})[_0x94ba('0x7d')](function(_0x545742){logger[_0x94ba('0x42')](_0x545742[_0x94ba('0x43')]);process[_0x94ba('0x44')](0x1);});}catch(_0x35ebc2){logger[_0x94ba('0x42')]('complete',_0x35ebc2[_0x94ba('0x43')]);process['exit'](0x1);}},'error':function(_0x4abe2e,_0xfe25,_0x3b9d00,_0x1da047){throw new Error(_0x1da047);}});}function validate(){if(process['argv']&&process[_0x94ba('0x7e')][_0x94ba('0x54')]<0x4){throw new Error(_0x94ba('0x7f'));}var _0xda99ee=path[_0x94ba('0x13')](config[_0x94ba('0x4d')],'server/files/tmp',process[_0x94ba('0x7e')][0x2]);if(!fs[_0x94ba('0x80')](_0xda99ee)){throw new Error(_0x94ba('0x81'));}var _0x42d9aa={};try{_0x42d9aa=JSON[_0x94ba('0x51')](process[_0x94ba('0x7e')][0x3]);if(!_0x42d9aa[_0x94ba('0x82')]){throw new Error(_0x94ba('0x83'));}if(!_0x42d9aa[_0x94ba('0x82')][_0x94ba('0x36')]){throw new Error(_0x94ba('0x84'));}if(!_0x42d9aa['binding'][_0x94ba('0x60')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1e834f=0x0;if(_0x42d9aa[_0x94ba('0x82')][_0x94ba('0x28')]){_0x1e834f=0x1;}if(!_0x42d9aa[_0x94ba('0x24')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x35a8ed){throw new Error(_0x94ba('0x85'));}var _0xd154e3=[];try{_0xd154e3=_[_0x94ba('0x86')](JSON[_0x94ba('0x51')](process[_0x94ba('0x7e')][0x4]),'id');}catch(_0x22f3b){logger[_0x94ba('0x40')](_0x94ba('0x87'));}main(_0xda99ee,_0x42d9aa,_0xd154e3,_0x1e834f);}validate();process['on'](_0x94ba('0x88'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x1562=['cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','cm_contacts.ListId','insert','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','select',')\x20NOT\x20IN\x20?','MIN(id)','group','info','error','message','exit','errors','push','spread','main','stringify','send','binding','root','.csv','header','createReadStream','data','length','rows','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone'];(function(_0x1af495,_0x3f7cbe){var _0x437e6d=function(_0x140264){while(--_0x140264){_0x1af495['push'](_0x1af495['shift']());}};_0x437e6d(++_0x3f7cbe);}(_0x1562,0xe5));var _0x2156=function(_0x2f00dd,_0xd659bd){_0x2f00dd=_0x2f00dd-0x0;var _0x1bfa6c=_0x1562[_0x2f00dd];return _0x1bfa6c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2156('0x0'));var Papa=require(_0x2156('0x1'));var util=require(_0x2156('0x2'));var BPromise=require(_0x2156('0x3'));var moment=require(_0x2156('0x4'));var squel=require(_0x2156('0x5'));var Redis=require(_0x2156('0x6'));var db=require(_0x2156('0x7'))['db'];var config=require(_0x2156('0x8'));var logger=require(_0x2156('0x9'))(_0x2156('0xa'));config[_0x2156('0xb')]=_[_0x2156('0xc')](config[_0x2156('0xb')],{'host':_0x2156('0xd'),'port':0x18eb});var socket=require(_0x2156('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2156('0xf')](_0x2156('0x10'));function isEmail(_0x4c5778){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'](_0x4c5778);}function selectNotIn(_0x107848,_0x118fef,_0x25f6d4,_0x4bc28b,_0x349071){return squel['select']()[_0x2156('0x11')]('phone')[_0x2156('0x12')](_0x4bc28b)[_0x2156('0x13')](_0x118fef,null,_0x118fef+'.id\x20=\x20'+_0x4bc28b+'.'+_0x25f6d4)[_0x2156('0x14')](_0x4bc28b+'.'+_0x25f6d4+'\x20=\x20'+_0x107848+'.'+_0x25f6d4)['where'](_0x118fef+_0x2156('0x15')+_0x349071['join']()+')');}function insertCmHopper(_0x1ccbb1,_0x5b84b8,_0x35d7b4,_0xd984ef,_0x45d059){var _0xbe13a7=[_0x2156('0x16'),_0x2156('0x17'),_0x2156('0x18'),'cm_contacts.ListId',_0x5b84b8+'.'+_0xd984ef,_0x2156('0x19'),_0x2156('0x1a'),_0x2156('0x1b'),_0x2156('0x1c'),'\x22'+_0x45d059+'\x22'];return squel['insert']()[_0x2156('0x1d')]('cm_hopper')[_0x2156('0x1e')]([_0x2156('0x1f'),_0x2156('0x20'),_0x2156('0x21'),_0x2156('0x22'),_0xd984ef,'createdAt',_0x2156('0x23'),'priority',_0x2156('0x24'),_0x2156('0x25')],squel['select']()[_0x2156('0x26')](_0xbe13a7)['from'](_0x5b84b8)[_0x2156('0x13')](_0x2156('0x27'),null,_0x2156('0x28')+_0x5b84b8+_0x2156('0x29'))['join'](_0x35d7b4,null,_0x35d7b4+_0x2156('0x2a')+_0x5b84b8+'.'+_0xd984ef)[_0x2156('0x14')](_0x5b84b8+_0x2156('0x2b'),_0x1ccbb1)[_0x2156('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2156('0x14')](_0x2156('0x2c'),selectNotIn(_0x5b84b8,_0x35d7b4,_0xd984ef,'cm_hopper',[_0x2156('0x2d'),_0x2156('0x2e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5b84b8,_0x35d7b4,_0xd984ef,_0x2156('0x2f'),[_0x2156('0x2d')])))['toString']();}function insertCmHopperBlack(_0x30a8ac,_0x130687,_0x269dd9,_0xd12a76){var _0x5004e=['cm_contacts.phone',_0x2156('0x18'),_0x2156('0x30'),_0x130687+'.'+_0xd12a76,_0x2156('0x19'),_0x2156('0x1a')];return squel[_0x2156('0x31')]()[_0x2156('0x1d')](_0x2156('0x32'))['fromQuery']([_0x2156('0x1f'),_0x2156('0x21'),_0x2156('0x22'),_0xd12a76,_0x2156('0x33'),'updatedAt'],squel['select']()[_0x2156('0x26')](_0x5004e)[_0x2156('0x12')](_0x130687)[_0x2156('0x13')](_0x2156('0x27'),null,_0x2156('0x28')+_0x130687+_0x2156('0x29'))[_0x2156('0x13')](_0x269dd9,null,_0x269dd9+_0x2156('0x2a')+_0x130687+'.'+_0xd12a76)[_0x2156('0x14')](_0x130687+'.CmListId\x20=\x20?',_0x30a8ac)['where'](_0x2156('0x34'),NOW)[_0x2156('0x14')](_0x2156('0x2c'),squel['select']()[_0x2156('0x11')](_0x2156('0x1f'))['from'](_0x2156('0x32'))[_0x2156('0x14')](_0x2156('0x35'),_0x30a8ac)[_0x2156('0x14')](_0xd12a76+_0x2156('0x36'),_0x130687+'.'+_0xd12a76)))[_0x2156('0x37')]();}function insertCmContact(_0x50b048,_0x174263,_0x7516a9,_0x409b4e){var _0x2c92de=_[_0x2156('0x38')](_[_0x2156('0x39')](_0x409b4e),[_0x2156('0x22'),'CompanyId',_0x2156('0x33'),'updatedAt']);return squel[_0x2156('0x31')]()['into'](_0x2156('0x27'))[_0x2156('0x1e')](_0x2c92de,squel[_0x2156('0x3a')]()[_0x2156('0x26')](_0x2c92de)[_0x2156('0x12')](_0x174263)['where']('('+_0x7516a9[_0x2156('0x13')](',')+_0x2156('0x3b'),squel[_0x2156('0x3a')]()['fields'](_0x7516a9)['from'](_0x2156('0x27'))[_0x2156('0x14')]('ListId\x20=\x20?',_0x50b048)[_0x2156('0x14')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x2156('0x3a')]()['field'](_0x2156('0x3c'),'min_id')['from'](_0x174263)[_0x2156('0x3d')](_0x7516a9[_0x2156('0x13')](','))))[_0x2156('0x37')]();}function handleStop(){logger[_0x2156('0x3e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x233494){logger[_0x2156('0x3f')](_0x233494[_0x2156('0x40')]);process[_0x2156('0x41')](0x1);}function handleError(_0x223294,_0x8c4318){stats[_0x2156('0x42')][_0x2156('0x43')]({'name':_0x8c4318['code'],'message':_0x8c4318[_0x2156('0x40')],'row':_0x223294});}function handleQuery(_0x4764d0){logger[_0x2156('0x3e')](_0x4764d0);return db['sequelize']['query'](_0x4764d0)[_0x2156('0x44')](function(_0x3650ae){results[_0x2156('0x43')](_0x3650ae);})['catch'](function(_0x5827f9){logger[_0x2156('0x3f')](_0x5827f9['message']);});}function main(_0x406daf,_0x41111b,_0x231344,_0x52d3cd){logger[_0x2156('0x3e')](_0x2156('0x45'),_0x406daf,JSON[_0x2156('0x46')](_0x41111b));process[_0x2156('0x47')]('start');var _0x2912cb=_0x41111b[_0x2156('0x48')];var _0x5af672=_0x41111b['socket_timestamp'];var _0x1c9b38=path['join'](config[_0x2156('0x49')],'server/files/tmp',_0x5af672+_0x2156('0x4a'));var _0x112a27=_[_0x2156('0x39')](_0x2912cb)[_0x2156('0x13')]();logger[_0x2156('0x3e')](_0x2156('0x4b'),_0x112a27);fs['writeFileSync'](_0x1c9b38,_0x112a27+'\x0a');Papa['parse'](fs[_0x2156('0x4c')](_0x406daf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e1885,_0x4e0333){try{for(var _0x3d44a2=0x0,_0x44cc40=[];_0x3d44a2<_0x4e1885[_0x2156('0x4d')][_0x2156('0x4e')];_0x3d44a2++){stats[_0x2156('0x4f')]+=0x1;if(_0x4e1885[_0x2156('0x42')][_0x3d44a2]){handleError(_0x4e1885[_0x2156('0x4d')][_0x3d44a2],_0x4e1885[_0x2156('0x42')][_0x3d44a2]);}else{var _0x32680c=[];for(var _0x4a217c in _0x2912cb){if(_0x2912cb[_0x2156('0x50')](_0x4a217c)){if(_0x4e1885[_0x2156('0x4d')][_0x3d44a2][_0x2912cb[_0x4a217c]]){var _0x31e2e5=_['trim'](_0x4e1885[_0x2156('0x4d')][_0x3d44a2][_0x2912cb[_0x4a217c]][_0x2156('0x51')](/"/g,'\x27'));switch(_0x4a217c){case _0x2156('0x20'):var _0x1c53e1=moment(_0x31e2e5,_0x2156('0x10'),!![]);if(_0x1c53e1[_0x2156('0x52')]()){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c[_0x2156('0x43')](_0x2156('0x53'));}break;case _0x2156('0x54'):var _0x1364ee=parseInt(_0x31e2e5);_0x31e2e5=_[_0x2156('0x55')](_0x1364ee)||_0x1364ee<0x0||_0x1364ee>0x4?_0x52d3cd?0x3:0x2:_0x1364ee;_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');break;case _0x2156('0x24'):var _0x5592d8=parseInt(_0x31e2e5);if(_[_0x2156('0x56')](_0x5592d8)&&_[_0x2156('0x57')](_0x231344,_0x5592d8)){_0x44cc40['push']('\x22'+_0x5592d8+'\x22');}else{_0x32680c['push'](_0x2156('0x58'));}break;case _0x2156('0x59'):if(isEmail(_0x31e2e5)){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2ae889=moment(_0x31e2e5,'YYYY-MM-DD',!![]);if(_0x2ae889[_0x2156('0x52')]()){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c[_0x2156('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}}else{switch(_0x4a217c){case _0x2156('0x5a'):case _0x2156('0x1f'):_0x32680c[_0x2156('0x43')](_0x4a217c+_0x2156('0x5b'));break;default:_0x44cc40[_0x2156('0x43')]('\x22\x22');}}}}if(_0x32680c['length']){handleError(_0x4e1885[_0x2156('0x4d')][_0x3d44a2],{'code':_0x2156('0x5c'),'message':_0x32680c[_0x2156('0x13')]()});}else{fs[_0x2156('0x5d')](_0x1c9b38,_0x44cc40[_0x2156('0x13')]()+'\x0a');}_0x44cc40=[];}if(!(stats[_0x2156('0x4f')]%0xc8)){socket['emit'](_0x2156('0x5e')+_0x5af672,stats);stats[_0x2156('0x42')]=[];}}if(stopped){logger[_0x2156('0x3e')](_0x2156('0x5f'));_0x4e0333[_0x2156('0x60')]();}}catch(_0x42fce3){handleError(_0x4e1885['data'][_0x3d44a2],{'code':_0x2156('0x61'),'message':_0x42fce3[_0x2156('0x40')]});logger[_0x2156('0x3f')]('step',_0x42fce3['message']);}},'complete':function(){try{var _0x213053=[];var _0x1ed053=_0x2156('0x27');if(_0x41111b['duplicates']&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]){_0x1ed053='cm_contacts_'+_0x5af672;_0x213053['push'](_0x2156('0x63')+_0x1ed053+'\x20LIKE\x20cm_contacts;');}var _0x320f7f=util[_0x2156('0xf')](_0x2156('0x64'),_0x1c9b38,_0x1ed053,_0x112a27,_0x41111b[_0x2156('0x22')],_0x41111b[_0x2156('0x65')]||null,NOW,NOW);if(_[_0x2156('0x66')](_0x2912cb[_0x2156('0x20')])){_0x320f7f+=',\x20scheduledAt\x20=\x20NOW()';}_0x213053[_0x2156('0x43')](_0x320f7f);if(_0x41111b['duplicates']&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]){_0x213053[_0x2156('0x43')](insertCmContact(_0x41111b[_0x2156('0x22')],_0x1ed053,_0x41111b[_0x2156('0x62')],_0x2912cb));_0x213053[_0x2156('0x43')](_0x2156('0x67')+_0x1ed053+';');}_0x213053[_0x2156('0x43')](insertCmHopper(_0x41111b[_0x2156('0x22')],_0x2156('0x68'),_0x2156('0x69'),_0x2156('0x6a'),_0x52d3cd));_0x213053[_0x2156('0x43')](insertCmHopperBlack(_0x41111b[_0x2156('0x22')],'voice_queues_has_cm_blacklists',_0x2156('0x69'),_0x2156('0x6a')));_0x213053[_0x2156('0x43')](insertCmHopper(_0x41111b['ListId'],'campaigns_has_cm_lists',_0x2156('0x6b'),_0x2156('0x6c'),_0x52d3cd));_0x213053['push'](insertCmHopperBlack(_0x41111b[_0x2156('0x22')],_0x2156('0x6d'),_0x2156('0x6b'),'CampaignId'));BPromise[_0x2156('0x6e')](_0x213053,handleQuery)['then'](function(_0x474f41){stats['finish']=!![];stats[_0x2156('0x6f')]=_0x41111b[_0x2156('0x62')]&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x5af672,stats);fs[_0x2156('0x70')](_0x406daf);fs[_0x2156('0x70')](_0x1c9b38);process[_0x2156('0x41')](0x0);})[_0x2156('0x71')](function(_0x3992b8){logger[_0x2156('0x3f')](_0x3992b8[_0x2156('0x40')]);process[_0x2156('0x41')](0x1);});}catch(_0x127b44){logger['error']('complete',_0x127b44['message']);process[_0x2156('0x41')](0x1);}},'error':function(_0x5aa0b1,_0x2d96cf,_0x153a53,_0x207ac5){throw new Error(_0x207ac5);}});}function validate(){if(process[_0x2156('0x72')]&&process['argv'][_0x2156('0x4e')]<0x4){throw new Error(_0x2156('0x73'));}var _0x45fb9e=path[_0x2156('0x13')](config[_0x2156('0x49')],_0x2156('0x74'),process[_0x2156('0x72')][0x2]);if(!fs[_0x2156('0x75')](_0x45fb9e)){throw new Error(_0x2156('0x76'));}var _0x3d9096={};try{_0x3d9096=JSON[_0x2156('0x77')](process[_0x2156('0x72')][0x3]);if(!_0x3d9096[_0x2156('0x48')]){throw new Error(_0x2156('0x78'));}if(!_0x3d9096['binding'][_0x2156('0x1f')]){throw new Error(_0x2156('0x79'));}if(!_0x3d9096['binding'][_0x2156('0x5a')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3fbd4e=0x0;if(_0x3d9096['binding'][_0x2156('0x24')]){_0x3fbd4e=0x1;}if(!_0x3d9096[_0x2156('0x22')]){throw new Error(_0x2156('0x7a'));}}catch(_0x4e8e1d){throw new Error(_0x2156('0x7b'));}var _0x5e8503=[];try{_0x5e8503=_['map'](JSON[_0x2156('0x77')](process[_0x2156('0x72')][0x4]),'id');}catch(_0x3b9fbb){logger[_0x2156('0x3e')]('No\x20agent\x20available');}main(_0x45fb9e,_0x3d9096,_0x5e8503,_0x3fbd4e);}validate();process['on'](_0x2156('0x7c'),handleStop);process['on'](_0x2156('0x7d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index d2018f4..bda685d 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 _0x6990=['group','info','Received\x20SIGINT','exit','errors','catch','main','stringify','send','start','binding','clone','server/files/tmp','.csv','findAll','name','header','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','spread','length','isNil','AdditionalPhones','push','all','then','error','message','split','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','join','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x6990,0x176));var _0x0699=function(_0xc7d5f9,_0x5e7684){_0xc7d5f9=_0xc7d5f9-0x0;var _0x475fd8=_0x6990[_0xc7d5f9];return _0x475fd8;};'use strict';var fs=require('fs');var path=require(_0x0699('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x0699('0x1'));var BPromise=require(_0x0699('0x2'));var moment=require(_0x0699('0x3'));var squel=require('squel');var Redis=require(_0x0699('0x4'));var db=require(_0x0699('0x5'))['db'];var config=require(_0x0699('0x6'));var logger=require(_0x0699('0x7'))('import');config[_0x0699('0x8')]=_[_0x0699('0x9')](config[_0x0699('0x8')],{'host':_0x0699('0xa'),'port':0x18eb});var socket=require(_0x0699('0xb'))(new Redis(config[_0x0699('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0699('0xc')](_0x0699('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x0699('0xc')](_0x0699('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x352a89){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))*$/[_0x0699('0xf')](_0x352a89);}function selectNotIn(_0x59d620,_0x3bbabe,_0x38dfc3,_0x1d856d,_0xe3d303){return squel[_0x0699('0x10')]()[_0x0699('0x11')](_0x0699('0x12'))[_0x0699('0x13')](_0x1d856d)['join'](_0x3bbabe,null,_0x3bbabe+'.id\x20=\x20'+_0x1d856d+'.'+_0x38dfc3)['where'](_0x1d856d+'.'+_0x38dfc3+_0x0699('0x14')+_0x59d620+'.'+_0x38dfc3)[_0x0699('0x15')](_0x3bbabe+_0x0699('0x16')+_0xe3d303['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24d234,_0x4b5017){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query']('select\x20*\x20from\x20'+tempTableName)[_0x0699('0x17')](function(_0x5ddd0a){if(_0x5ddd0a!==null){var _0x4b6538=[];for(var _0x3d92c5=0x0;_0x3d92c5<_0x5ddd0a[_0x0699('0x18')];_0x3d92c5++){var _0x20e80e=_0x5ddd0a[_0x3d92c5];if(!_[_0x0699('0x19')](_0x20e80e[_0x0699('0x12')])){if(!_[_0x0699('0x19')](_0x20e80e[_0x0699('0x1a')]))_0x4b6538[_0x0699('0x1b')](insertAdditionalPhones(_0x20e80e));promisesContact['push']({'contact':_0x20e80e});}}}Promise[_0x0699('0x1c')](_0x4b6538)[_0x0699('0x1d')](function(){_0x24d234({'val':0x1});});})['catch'](function(_0x431d17){logger[_0x0699('0x1e')](_0x431d17[_0x0699('0x1f')]);});});}function insertAdditionalPhones(_0x4e4fd6){return new Promise(function(_0xe6b405,_0x35f027){var _0x268b6d=_0x4e4fd6['AdditionalPhones'];if(_[_0x0699('0x19')](_0x268b6d))_0x35f027({'val':0x0});else{var _0x288683=_0x268b6d[_0x0699('0x20')](';');var _0x22bf3c=[];orderBy=0x0;for(var _0x5ebb71=0x0;_0x5ebb71<_0x288683[_0x0699('0x18')];_0x5ebb71++){_0x22bf3c['push'](splitAdditionalPhone(_0x4e4fd6['id'],_0x288683[_0x5ebb71]));}Promise[_0x0699('0x1c')](_0x22bf3c)[_0x0699('0x1d')](function(){_0xe6b405({'val':_0x288683[_0x0699('0x18')]});});}});}function splitAdditionalPhone(_0xe79d93,_0x9c8833){return new Promise(function(_0x6bfba5,_0x2d5157){var _0x158619=_0x9c8833[_0x0699('0x20')](':');var _0x16ba76=_0x158619[0x0];var _0x530d5d=_0x158619[0x1];if(_0x530d5d!==''){var _0x514c11=_0x530d5d[_0x0699('0x20')]('|');var _0x24516b=[];for(var _0x1dee69=0x0;_0x1dee69<_0x514c11['length'];_0x1dee69++){if(_0x514c11[_0x1dee69]!==''){var _0x139152=_['filter'](promisesAdditionalPhones,{'contactId':_0xe79d93,'phone':_0x514c11[_0x1dee69]});if(_0x139152[_0x0699('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x0699('0x1b')]({'contactId':_0xe79d93,'contactTypeId':_0x16ba76,'phone':_0x514c11[_0x1dee69],'orderBy':orderBy});}}}_0x6bfba5({'ok':0x1});}else _0x6bfba5({'res':0x0});});}function createAdditionalPhone(_0x2b09b5,_0x230c77,_0x22de6c,_0x1dbb4a){return new Promise(function(_0x1bf9d0,_0x3dd81d){return db[_0x0699('0x21')][_0x0699('0x22')]({'where':{'CmContactId':_0x2b09b5,'item':_0x22de6c}})[_0x0699('0x1d')](function(_0x353b75){if(_0x353b75){return db[_0x0699('0x21')]['update']({'ItemTypeId':_0x230c77,'OrderBy':_0x1dbb4a},{'where':{'CmContactId':_0x2b09b5,'item':_0x22de6c}})[_0x0699('0x1d')](function(_0x189c04){_0x1bf9d0({'res':_0x0699('0x23')});});}else{return db[_0x0699('0x21')][_0x0699('0x24')]({'CmContactId':_0x2b09b5,'item':_0x22de6c,'ItemTypeId':_0x230c77,'OrderBy':_0x1dbb4a,'ItemClass':_0x0699('0x25')})['then'](function(_0x933e88){_0x1bf9d0({'res':_0x0699('0x26')});});}});});}function updateContact(_0x510ed0){return new Promise(function(_0x11f30c,_0x45adfa){var _0x16fbe9=_0x510ed0['id'];delete _0x510ed0['id'];return db[_0x0699('0x27')][_0x0699('0x28')](_0x510ed0,{'where':{'id':_0x16fbe9}})[_0x0699('0x1d')](function(_0x5ef7f9){updatedRows+=0x1;return db[_0x0699('0x29')][_0x0699('0x28')]({'phone':_0x510ed0[_0x0699('0x12')]},{'where':{'ContactId':_0x16fbe9}})[_0x0699('0x1d')](function(_0x33fdc9){_0x11f30c({'ret':'OK'});});});});}function insertCmHopper(_0xc512b0,_0x1b8dea,_0x3e9f03,_0x2ae2b8,_0x116f6d){var _0x388714=[_0x0699('0x2a'),'cm_contacts.scheduledat',_0x0699('0x2b'),'cm_contacts.ListId',_0x1b8dea+'.'+_0x2ae2b8,'cm_contacts.createdAt',_0x0699('0x2c'),_0x0699('0x2d'),_0x0699('0x2e'),'\x22'+_0x116f6d+'\x22'];return squel[_0x0699('0x2f')]()[_0x0699('0x30')](_0x0699('0x31'))[_0x0699('0x32')]([_0x0699('0x12'),_0x0699('0x33'),_0x0699('0x34'),_0x0699('0x35'),_0x2ae2b8,_0x0699('0x36'),_0x0699('0x37'),_0x0699('0x38'),_0x0699('0x39'),_0x0699('0x3a')],squel['select']()[_0x0699('0x3b')](_0x388714)[_0x0699('0x13')](_0x1b8dea)['join'](_0x0699('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x1b8dea+_0x0699('0x3d'))[_0x0699('0x3e')](_0x3e9f03,null,_0x3e9f03+_0x0699('0x3f')+_0x1b8dea+'.'+_0x2ae2b8)[_0x0699('0x15')](_0x1b8dea+_0x0699('0x40'),_0xc512b0)[_0x0699('0x15')](_0x0699('0x41'),NOW)[_0x0699('0x15')](_0x0699('0x42'),selectNotIn(_0x1b8dea,_0x3e9f03,_0x2ae2b8,_0x0699('0x31'),[_0x0699('0x43'),_0x0699('0x44')]))[_0x0699('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1b8dea,_0x3e9f03,_0x2ae2b8,_0x0699('0x31'),['\x22always\x22'])))[_0x0699('0x45')]();}function insertCmHopperBlack(_0x4b0ef6,_0x4fea12,_0x4af74c,_0x1c03b7){var _0xff22ca=[_0x0699('0x2a'),_0x0699('0x2b'),'cm_contacts.ListId',_0x4fea12+'.'+_0x1c03b7,_0x0699('0x46'),_0x0699('0x2c')];return squel[_0x0699('0x2f')]()['into'](_0x0699('0x47'))[_0x0699('0x32')]([_0x0699('0x12'),_0x0699('0x34'),_0x0699('0x35'),_0x1c03b7,'createdAt','updatedAt'],squel['select']()['fields'](_0xff22ca)['from'](_0x4fea12)[_0x0699('0x3e')](_0x0699('0x3c'),null,_0x0699('0x48')+_0x4fea12+'.CmListId')[_0x0699('0x3e')](_0x4af74c,null,_0x4af74c+_0x0699('0x3f')+_0x4fea12+'.'+_0x1c03b7)[_0x0699('0x15')](_0x4fea12+_0x0699('0x40'),_0x4b0ef6)[_0x0699('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x0699('0x42'),squel['select']()[_0x0699('0x11')](_0x0699('0x12'))[_0x0699('0x13')](_0x0699('0x47'))[_0x0699('0x15')](_0x0699('0x49'),_0x4b0ef6)[_0x0699('0x15')](_0x1c03b7+_0x0699('0x4a'),_0x4fea12+'.'+_0x1c03b7)))['toString']();}function insertCmHopperAdditionalPhones(_0x59e67a){var _0x5bc9c2=[_0x0699('0x4b'),_0x0699('0x4c'),_0x0699('0x4d'),'cm_contact_has_items.createdAt',_0x0699('0x4e')];return squel[_0x0699('0x2f')]()[_0x0699('0x30')]('cm_hopper_additional_phones')[_0x0699('0x32')]([_0x0699('0x4f'),_0x0699('0x12'),_0x0699('0x50'),_0x0699('0x36'),_0x0699('0x37')],squel[_0x0699('0x10')]()[_0x0699('0x3b')](_0x5bc9c2)[_0x0699('0x13')]('cm_hopper')[_0x0699('0x3e')](_0x0699('0x3c'),null,_0x0699('0x51'))[_0x0699('0x3e')](_0x0699('0x52'),null,_0x0699('0x53'))[_0x0699('0x15')](_0x0699('0x54'),_0x59e67a)[_0x0699('0x15')](_0x0699('0x41'),NOW))[_0x0699('0x45')]();}function insertCmContact(_0x56fc0d,_0x449b74,_0x30aec5,_0x74bea4){var _0x464dca=_[_0x0699('0x55')](_[_0x0699('0x56')](_0x74bea4),['ListId',_0x0699('0x57'),_0x0699('0x36'),_0x0699('0x37')]);return squel[_0x0699('0x2f')]()[_0x0699('0x30')](_0x0699('0x3c'))[_0x0699('0x32')](_0x464dca,squel['select']()[_0x0699('0x3b')](_0x464dca)[_0x0699('0x13')](_0x449b74)['where']('('+_0x30aec5[_0x0699('0x3e')](',')+')\x20NOT\x20IN\x20?',squel[_0x0699('0x10')]()['fields'](_0x30aec5)[_0x0699('0x13')](_0x0699('0x3c'))[_0x0699('0x15')](_0x0699('0x49'),_0x56fc0d))[_0x0699('0x15')](_0x0699('0x58'),squel[_0x0699('0x10')]()[_0x0699('0x11')](_0x0699('0x59'),_0x0699('0x5a'))[_0x0699('0x13')](_0x449b74)[_0x0699('0x5b')](_0x30aec5['join'](','))))[_0x0699('0x45')]();}function handleStop(){logger[_0x0699('0x5c')](_0x0699('0x5d'));stopped=!![];}function handleUncaughtException(_0x559452){logger[_0x0699('0x1e')](_0x559452[_0x0699('0x1f')]);process[_0x0699('0x5e')](0x1);}function handleError(_0x426cda,_0x4d122c){stats[_0x0699('0x5f')]['push']({'name':_0x4d122c['code'],'message':_0x4d122c[_0x0699('0x1f')],'row':_0x426cda});}function handleQuery(_0x1e3206){logger[_0x0699('0x5c')](_0x1e3206);return db['sequelize']['query'](_0x1e3206)['spread'](function(_0x4dc3a9){results[_0x0699('0x1b')](_0x4dc3a9);})[_0x0699('0x60')](function(_0x15aae7){logger[_0x0699('0x1e')](_0x15aae7[_0x0699('0x1f')]);});}function main(_0x46a43b,_0x4567c6,_0xc5d2c0,_0x1695ea){logger[_0x0699('0x5c')](_0x0699('0x61'),_0x46a43b,JSON[_0x0699('0x62')](_0x4567c6));process[_0x0699('0x63')](_0x0699('0x64'));var _0x473129=_0x4567c6[_0x0699('0x65')];var _0x5d21ce=_[_0x0699('0x66')](_0x473129);var _0x2ca793=_0x4567c6['socket_timestamp'];var _0x2bb439=path[_0x0699('0x3e')](config['root'],_0x0699('0x67'),_0x2ca793+_0x0699('0x68'));logger[_0x0699('0x5c')]('body',_0x4567c6);db['ContactItemType'][_0x0699('0x69')]({'raw':!![],'attributes':['id','name']})[_0x0699('0x1d')](function(_0x254e27){for(var _0x4068f9=0x0;_0x4068f9<_0x254e27[_0x0699('0x18')];_0x4068f9++){if(_0x254e27[_0x4068f9]['name']in _0x473129){contactItemTypes[_0x0699('0x1b')](_0x254e27[_0x4068f9]);delete _0x5d21ce[_0x254e27[_0x4068f9][_0x0699('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x5d21ce[_0x0699('0x1a')]='';var _0xb5e903=_[_0x0699('0x56')](_0x5d21ce)[_0x0699('0x3e')]();logger[_0x0699('0x5c')](_0x0699('0x6b'),_0xb5e903);fs[_0x0699('0x6c')](_0x2bb439,_0xb5e903+'\x0a');Papa[_0x0699('0x6d')](fs[_0x0699('0x6e')](_0x46a43b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x39db1c,_0x3eab03){try{for(var _0x54a44e=0x0,_0x1db26f=[];_0x54a44e<_0x39db1c[_0x0699('0x6f')][_0x0699('0x18')];_0x54a44e++){stats['rows']+=0x1;if(_0x39db1c[_0x0699('0x5f')][_0x54a44e]){handleError(_0x39db1c['data'][_0x54a44e],_0x39db1c[_0x0699('0x5f')][_0x54a44e]);}else{var _0x34d091=[];var _0x57573f=[];for(var _0x529e3f in _0x473129){let _0x1d0a47=contactItemTypes['find'](_0x20600b=>_0x20600b[_0x0699('0x6a')]===_0x529e3f);if(_[_0x0699('0x19')](_0x1d0a47)){if(_0x473129[_0x0699('0x70')](_0x529e3f)){if(_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f]]){var _0x50afb6=_[_0x0699('0x71')](_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f]][_0x0699('0x72')](/"/g,'\x27'));switch(_0x529e3f){case'scheduledat':var _0x125116=moment(_0x50afb6,_0x0699('0xd'),!![]);if(_0x125116[_0x0699('0x73')]()){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091['push'](_0x0699('0x74'));}break;case _0x0699('0x38'):var _0x4b7166=parseInt(_0x50afb6);_0x50afb6=_['isNaN'](_0x4b7166)||_0x4b7166<0x0||_0x4b7166>0x4?_0x1695ea?0x3:0x2:_0x4b7166;_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');break;case _0x0699('0x39'):var _0xe5ccad=parseInt(_0x50afb6);if(_[_0x0699('0x75')](_0xe5ccad)&&_['includes'](_0xc5d2c0,_0xe5ccad)){_0x1db26f[_0x0699('0x1b')]('\x22'+_0xe5ccad+'\x22');}else{_0x34d091[_0x0699('0x1b')](_0x0699('0x76'));}break;case _0x0699('0x77'):if(isEmail(_0x50afb6)){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091[_0x0699('0x1b')]('email\x20wrong\x20format');}break;case _0x0699('0x78'):var _0x1e3987=moment(_0x50afb6,'YYYY-MM-DD',!![]);if(_0x1e3987[_0x0699('0x73')]()){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}else{_0x34d091['push'](_0x0699('0x79'));}break;default:_0x1db26f[_0x0699('0x1b')]('\x22'+_0x50afb6+'\x22');}}else{switch(_0x529e3f){case _0x0699('0x7a'):case'phone':_0x34d091[_0x0699('0x1b')](_0x529e3f+'\x20not\x20specified');break;default:_0x1db26f[_0x0699('0x1b')]('\x22\x22');}}}}else{var _0x48a75e='';for(var _0x34951d=0x0;_0x34951d<_0x473129[_0x529e3f]['length'];_0x34951d++){var _0x50afb6=_[_0x0699('0x71')](_0x39db1c[_0x0699('0x6f')][_0x54a44e][_0x473129[_0x529e3f][_0x34951d]]['replace'](/"/g,'\x27'));if(_0x48a75e=='')_0x48a75e=_0x50afb6;else _0x48a75e+='|'+_0x50afb6;}_0x57573f[_0x0699('0x1b')](_0x1d0a47['id']+':'+_0x48a75e);}}if(hasAdditionalPhones){_0x1db26f[_0x0699('0x1b')]('\x22'+_0x57573f[_0x0699('0x3e')](';')+'\x22');}if(_0x34d091['length']){handleError(_0x39db1c[_0x0699('0x6f')][_0x54a44e],{'code':_0x0699('0x7b'),'message':_0x34d091[_0x0699('0x3e')]()});}else{fs['appendFileSync'](_0x2bb439,_0x1db26f['join']()+'\x0a');}_0x1db26f=[];}if(!(stats[_0x0699('0x7c')]%0xc8)){socket[_0x0699('0x7d')](_0x0699('0x7e')+_0x2ca793,stats);stats['errors']=[];}}if(stopped){logger[_0x0699('0x5c')](_0x0699('0x7f'));_0x3eab03[_0x0699('0x80')]();}}catch(_0x44e0fa){handleError(_0x39db1c[_0x0699('0x6f')][_0x54a44e],{'code':_0x0699('0x81'),'message':_0x44e0fa[_0x0699('0x1f')]});logger['error'](_0x0699('0x82'),_0x44e0fa[_0x0699('0x1f')]);}},'complete':function(){try{var _0x499719=[];var _0x281f58=tempTableName;_0x499719[_0x0699('0x1b')](_0x0699('0x83')+_0x281f58+_0x0699('0x84'));logger[_0x0699('0x5c')]('CIS\x20len',contactItemTypes[_0x0699('0x18')]);var _0x15c36b=util[_0x0699('0xc')](_0x0699('0x85'),_0x2bb439,_0x281f58,_0xb5e903,_0x4567c6[_0x0699('0x35')],_0x4567c6[_0x0699('0x57')]||null,NOW,NOW);if(_['isNil'](_0x473129[_0x0699('0x33')])){_0x15c36b+=_0x0699('0x86');}_0x499719[_0x0699('0x1b')](_0x15c36b);BPromise['each'](_0x499719,handleQuery)[_0x0699('0x1d')](function(_0x414fbd){BPromise[_0x0699('0x1c')]([handleAdditionalPhones()])[_0x0699('0x1d')](function(){_0x499719=[];for(var _0x3147e3=0x0;_0x3147e3\x20\x20');}var _0xf0c338=path[_0x0699('0x3e')](config[_0x0699('0x91')],_0x0699('0x67'),process[_0x0699('0x90')][0x2]);if(!fs[_0x0699('0x92')](_0xf0c338)){throw new Error(_0x0699('0x93'));}var _0x2c3763={};try{_0x2c3763=JSON['parse'](process[_0x0699('0x90')][0x3]);if(!_0x2c3763[_0x0699('0x65')]){throw new Error(_0x0699('0x94'));}var _0x598d3f=0x0;if(_0x2c3763[_0x0699('0x65')][_0x0699('0x39')]){_0x598d3f=0x1;}if(!_0x2c3763['ListId']){throw new Error(_0x0699('0x95'));}}catch(_0x31e088){throw new Error(_0x0699('0x96'));}var _0x326215=[];try{_0x326215=_[_0x0699('0x97')](JSON['parse'](process[_0x0699('0x90')][0x4]),'id');}catch(_0x32f85f){logger[_0x0699('0x5c')](_0x0699('0x98'));}main(_0xf0c338,_0x2c3763,_0x326215,_0x598d3f);}validate();process['on'](_0x0699('0x99'),handleStop);process['on'](_0x0699('0x9a'),handleUncaughtException); \ No newline at end of file +var _0xe526=['file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','cm_contacts_temp_','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','catch','error','message','split','all','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','then','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_contacts.createdAt','into','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','toString','concat','keys','CompanyId','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','code','send','start','binding','clone','socket_timestamp','root','.csv','body','findAll','name','header','writeFileSync','rows','errors','data','find','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','replace','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync'];(function(_0x431ac5,_0x5e319f){var _0x235779=function(_0x44cbed){while(--_0x44cbed){_0x431ac5['push'](_0x431ac5['shift']());}};_0x235779(++_0x5e319f);}(_0xe526,0x13f));var _0x6e52=function(_0x6fa1a8,_0x5c1f5b){_0x6fa1a8=_0x6fa1a8-0x0;var _0x2d21db=_0xe526[_0x6fa1a8];return _0x2d21db;};'use strict';var fs=require('fs');var path=require(_0x6e52('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x6e52('0x1'));var BPromise=require('bluebird');var moment=require(_0x6e52('0x2'));var squel=require(_0x6e52('0x3'));var Redis=require(_0x6e52('0x4'));var db=require(_0x6e52('0x5'))['db'];var config=require(_0x6e52('0x6'));var logger=require(_0x6e52('0x7'))(_0x6e52('0x8'));config[_0x6e52('0x9')]=_[_0x6e52('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6e52('0xb'))(new Redis(config[_0x6e52('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x6e52('0xc')+moment()[_0x6e52('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x19e1f3){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))*$/[_0x6e52('0xe')](_0x19e1f3);}function selectNotIn(_0x464ccf,_0x53e25e,_0x448c42,_0x569a66,_0x52c6c7){return squel[_0x6e52('0xf')]()[_0x6e52('0x10')](_0x6e52('0x11'))['from'](_0x569a66)[_0x6e52('0x12')](_0x53e25e,null,_0x53e25e+_0x6e52('0x13')+_0x569a66+'.'+_0x448c42)[_0x6e52('0x14')](_0x569a66+'.'+_0x448c42+_0x6e52('0x15')+_0x464ccf+'.'+_0x448c42)[_0x6e52('0x14')](_0x53e25e+_0x6e52('0x16')+_0x52c6c7[_0x6e52('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3652f8,_0x8ebc1a){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6e52('0x17')][_0x6e52('0x18')](_0x6e52('0x19')+tempTableName)[_0x6e52('0x1a')](function(_0x58819){if(_0x58819!==null){var _0x7420d4=[];for(var _0x512251=0x0;_0x512251<_0x58819[_0x6e52('0x1b')];_0x512251++){var _0x2adc8a=_0x58819[_0x512251];if(!_[_0x6e52('0x1c')](_0x2adc8a[_0x6e52('0x11')])){if(!_['isNil'](_0x2adc8a[_0x6e52('0x1d')]))_0x7420d4['push'](insertAdditionalPhones(_0x2adc8a));promisesContact[_0x6e52('0x1e')]({'contact':_0x2adc8a});}}}Promise['all'](_0x7420d4)['then'](function(){_0x3652f8({'val':0x1});});})[_0x6e52('0x1f')](function(_0x4dc8dc){logger[_0x6e52('0x20')](_0x4dc8dc[_0x6e52('0x21')]);});});}function insertAdditionalPhones(_0x3800fe){return new Promise(function(_0x16b31d,_0x9b6809){var _0x4f1822=_0x3800fe['AdditionalPhones'];if(_[_0x6e52('0x1c')](_0x4f1822))_0x9b6809({'val':0x0});else{var _0x5276b6=_0x4f1822[_0x6e52('0x22')](';');var _0x56b083=[];orderBy=0x0;for(var _0x13b4a9=0x0;_0x13b4a9<_0x5276b6[_0x6e52('0x1b')];_0x13b4a9++){_0x56b083[_0x6e52('0x1e')](splitAdditionalPhone(_0x3800fe['id'],_0x5276b6[_0x13b4a9]));}Promise[_0x6e52('0x23')](_0x56b083)['then'](function(){_0x16b31d({'val':_0x5276b6[_0x6e52('0x1b')]});});}});}function splitAdditionalPhone(_0x423619,_0x16c85b){return new Promise(function(_0x5ebaa1,_0x2c6859){var _0x270ddb=_0x16c85b['split'](':');var _0x5bf822=_0x270ddb[0x0];var _0x335cc3=_0x270ddb[0x1];if(_0x335cc3!==''){var _0x55e012=_0x335cc3[_0x6e52('0x22')]('|');var _0x36b4a2=[];for(var _0x2d49a1=0x0;_0x2d49a1<_0x55e012[_0x6e52('0x1b')];_0x2d49a1++){if(_0x55e012[_0x2d49a1]!==''){var _0x5202af=_[_0x6e52('0x24')](promisesAdditionalPhones,{'contactId':_0x423619,'phone':_0x55e012[_0x2d49a1]});if(_0x5202af[_0x6e52('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x423619,'contactTypeId':_0x5bf822,'phone':_0x55e012[_0x2d49a1],'orderBy':orderBy});}}}_0x5ebaa1({'ok':0x1});}else _0x5ebaa1({'res':0x0});});}function createAdditionalPhone(_0x3433d7,_0x4f8cbc,_0x5b0cc2,_0x297a40){return new Promise(function(_0x35ef37,_0x41c3f4){return db[_0x6e52('0x25')][_0x6e52('0x26')]({'where':{'CmContactId':_0x3433d7,'item':_0x5b0cc2}})['then'](function(_0x515003){if(_0x515003){return db[_0x6e52('0x25')][_0x6e52('0x27')]({'ItemTypeId':_0x4f8cbc,'OrderBy':_0x297a40},{'where':{'CmContactId':_0x3433d7,'item':_0x5b0cc2}})['then'](function(_0x9d8878){_0x35ef37({'res':_0x6e52('0x28')});});}else{return db[_0x6e52('0x25')]['create']({'CmContactId':_0x3433d7,'item':_0x5b0cc2,'ItemTypeId':_0x4f8cbc,'OrderBy':_0x297a40,'ItemClass':_0x6e52('0x29')})['then'](function(_0x402ebc){_0x35ef37({'res':_0x6e52('0x2a')});});}});});}function updateContact(_0x1ab565){return new Promise(function(_0x5d4cb5,_0x24abb5){var _0x1836f5=_0x1ab565['id'];delete _0x1ab565['id'];return db[_0x6e52('0x2b')][_0x6e52('0x27')](_0x1ab565,{'where':{'id':_0x1836f5}})[_0x6e52('0x2c')](function(_0xdfcc1){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x1ab565['phone']},{'where':{'ContactId':_0x1836f5}})[_0x6e52('0x2c')](function(_0x248cc9){_0x5d4cb5({'ret':'OK'});});});});}function insertCmHopper(_0x52813,_0x4f5349,_0x246df6,_0x493f74,_0x5596ee){var _0x5a3c42=['cm_contacts.phone','cm_contacts.scheduledat',_0x6e52('0x2d'),_0x6e52('0x2e'),_0x4f5349+'.'+_0x493f74,'cm_contacts.createdAt',_0x6e52('0x2f'),_0x6e52('0x30'),_0x6e52('0x31'),'\x22'+_0x5596ee+'\x22'];return squel[_0x6e52('0x32')]()['into'](_0x6e52('0x33'))[_0x6e52('0x34')]([_0x6e52('0x11'),_0x6e52('0x35'),_0x6e52('0x36'),_0x6e52('0x37'),_0x493f74,_0x6e52('0x38'),_0x6e52('0x39'),_0x6e52('0x3a'),'UserId',_0x6e52('0x3b')],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x5a3c42)[_0x6e52('0x3d')](_0x4f5349)[_0x6e52('0x12')](_0x6e52('0x3e'),null,_0x6e52('0x3f')+_0x4f5349+_0x6e52('0x40'))[_0x6e52('0x12')](_0x246df6,null,_0x246df6+_0x6e52('0x13')+_0x4f5349+'.'+_0x493f74)['where'](_0x4f5349+_0x6e52('0x41'),_0x52813)[_0x6e52('0x14')](_0x6e52('0x42'),NOW)[_0x6e52('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f5349,_0x246df6,_0x493f74,_0x6e52('0x33'),[_0x6e52('0x43'),_0x6e52('0x44')]))[_0x6e52('0x14')](_0x6e52('0x45'),selectNotIn(_0x4f5349,_0x246df6,_0x493f74,_0x6e52('0x33'),[_0x6e52('0x43')])))['toString']();}function insertCmHopperBlack(_0x4945f7,_0x531027,_0x109da5,_0x1cf810){var _0x438943=[_0x6e52('0x46'),_0x6e52('0x2d'),'cm_contacts.ListId',_0x531027+'.'+_0x1cf810,_0x6e52('0x47'),'cm_contacts.updatedAt'];return squel[_0x6e52('0x32')]()[_0x6e52('0x48')]('cm_hopper_black')[_0x6e52('0x34')](['phone',_0x6e52('0x36'),_0x6e52('0x37'),_0x1cf810,'createdAt','updatedAt'],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x438943)[_0x6e52('0x3d')](_0x531027)[_0x6e52('0x12')](_0x6e52('0x3e'),null,_0x6e52('0x3f')+_0x531027+_0x6e52('0x40'))[_0x6e52('0x12')](_0x109da5,null,_0x109da5+_0x6e52('0x13')+_0x531027+'.'+_0x1cf810)[_0x6e52('0x14')](_0x531027+_0x6e52('0x41'),_0x4945f7)['where'](_0x6e52('0x42'),NOW)[_0x6e52('0x14')](_0x6e52('0x45'),squel[_0x6e52('0xf')]()[_0x6e52('0x10')]('phone')[_0x6e52('0x3d')](_0x6e52('0x49'))[_0x6e52('0x14')](_0x6e52('0x4a'),_0x4945f7)[_0x6e52('0x14')](_0x1cf810+_0x6e52('0x4b'),_0x531027+'.'+_0x1cf810)))['toString']();}function insertCmHopperAdditionalPhones(_0x1d5125){var _0x13a338=[_0x6e52('0x4c'),_0x6e52('0x4d'),'cm_contact_has_items.OrderBy',_0x6e52('0x4e'),_0x6e52('0x4f')];return squel[_0x6e52('0x32')]()[_0x6e52('0x48')](_0x6e52('0x50'))[_0x6e52('0x34')]([_0x6e52('0x51'),_0x6e52('0x11'),_0x6e52('0x52'),'createdAt',_0x6e52('0x39')],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x13a338)[_0x6e52('0x3d')]('cm_hopper')['join'](_0x6e52('0x3e'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x6e52('0x53'),null,_0x6e52('0x54'))[_0x6e52('0x14')](_0x6e52('0x55'),_0x1d5125)[_0x6e52('0x14')](_0x6e52('0x42'),NOW))[_0x6e52('0x56')]();}function insertCmContact(_0x19e2cd,_0x153106,_0x176119,_0x1bf210){var _0xe46cf2=_[_0x6e52('0x57')](_[_0x6e52('0x58')](_0x1bf210),[_0x6e52('0x37'),_0x6e52('0x59'),_0x6e52('0x38'),_0x6e52('0x39')]);return squel['insert']()[_0x6e52('0x48')]('cm_contacts')[_0x6e52('0x34')](_0xe46cf2,squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0xe46cf2)['from'](_0x153106)[_0x6e52('0x14')]('('+_0x176119['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x6e52('0x3c')](_0x176119)[_0x6e52('0x3d')](_0x6e52('0x3e'))[_0x6e52('0x14')](_0x6e52('0x4a'),_0x19e2cd))[_0x6e52('0x14')]('id\x20IN\x20?',squel['select']()[_0x6e52('0x10')](_0x6e52('0x5a'),_0x6e52('0x5b'))[_0x6e52('0x3d')](_0x153106)[_0x6e52('0x5c')](_0x176119[_0x6e52('0x12')](','))))['toString']();}function handleStop(){logger[_0x6e52('0x5d')](_0x6e52('0x5e'));stopped=!![];}function handleUncaughtException(_0x5a8690){logger['error'](_0x5a8690[_0x6e52('0x21')]);process[_0x6e52('0x5f')](0x1);}function handleError(_0x328337,_0x2c5083){stats['errors']['push']({'name':_0x2c5083[_0x6e52('0x60')],'message':_0x2c5083[_0x6e52('0x21')],'row':_0x328337});}function handleQuery(_0x4b3588){logger[_0x6e52('0x5d')](_0x4b3588);return db['sequelize'][_0x6e52('0x18')](_0x4b3588)['spread'](function(_0x406609){results['push'](_0x406609);})[_0x6e52('0x1f')](function(_0x19092b){logger['error'](_0x19092b[_0x6e52('0x21')]);});}function main(_0x187eb2,_0x4f7ff6,_0x5aa9c4,_0x3b0a22){logger[_0x6e52('0x5d')]('main',_0x187eb2,JSON['stringify'](_0x4f7ff6));process[_0x6e52('0x61')](_0x6e52('0x62'));var _0x5addc1=_0x4f7ff6[_0x6e52('0x63')];var _0x171533=_[_0x6e52('0x64')](_0x5addc1);var _0x5af20d=_0x4f7ff6[_0x6e52('0x65')];var _0x1d8390=path['join'](config[_0x6e52('0x66')],'server/files/tmp',_0x5af20d+_0x6e52('0x67'));logger[_0x6e52('0x5d')](_0x6e52('0x68'),_0x4f7ff6);db['ContactItemType'][_0x6e52('0x69')]({'raw':!![],'attributes':['id','name']})[_0x6e52('0x2c')](function(_0x4114c6){for(var _0x2b0a29=0x0;_0x2b0a29<_0x4114c6[_0x6e52('0x1b')];_0x2b0a29++){if(_0x4114c6[_0x2b0a29][_0x6e52('0x6a')]in _0x5addc1){contactItemTypes[_0x6e52('0x1e')](_0x4114c6[_0x2b0a29]);delete _0x171533[_0x4114c6[_0x2b0a29]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x171533['AdditionalPhones']='';var _0x377b88=_[_0x6e52('0x58')](_0x171533)[_0x6e52('0x12')]();logger[_0x6e52('0x5d')](_0x6e52('0x6b'),_0x377b88);fs[_0x6e52('0x6c')](_0x1d8390,_0x377b88+'\x0a');Papa['parse'](fs['createReadStream'](_0x187eb2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a9125,_0x3a3af2){try{for(var _0x155631=0x0,_0x260f41=[];_0x155631<_0x5a9125['data'][_0x6e52('0x1b')];_0x155631++){stats[_0x6e52('0x6d')]+=0x1;if(_0x5a9125[_0x6e52('0x6e')][_0x155631]){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],_0x5a9125[_0x6e52('0x6e')][_0x155631]);}else{var _0x85570c=[];var _0x215369=[];for(var _0x34921d in _0x5addc1){let _0x4fd423=contactItemTypes[_0x6e52('0x70')](_0x26988c=>_0x26988c[_0x6e52('0x6a')]===_0x34921d);if(_[_0x6e52('0x1c')](_0x4fd423)){if(_0x5addc1[_0x6e52('0x71')](_0x34921d)){if(_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d]]){var _0x2618dd=_['trim'](_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d]]['replace'](/"/g,'\x27'));switch(_0x34921d){case _0x6e52('0x35'):var _0x421bce=moment(_0x2618dd,_0x6e52('0x72'),!![]);if(_0x421bce[_0x6e52('0x73')]()){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c['push'](_0x6e52('0x74'));}break;case _0x6e52('0x3a'):var _0x15010d=parseInt(_0x2618dd);_0x2618dd=_['isNaN'](_0x15010d)||_0x15010d<0x0||_0x15010d>0x4?_0x3b0a22?0x3:0x2:_0x15010d;_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');break;case _0x6e52('0x75'):var _0x3a92bc=parseInt(_0x2618dd);if(_[_0x6e52('0x76')](_0x3a92bc)&&_[_0x6e52('0x77')](_0x5aa9c4,_0x3a92bc)){_0x260f41['push']('\x22'+_0x3a92bc+'\x22');}else{_0x85570c[_0x6e52('0x1e')](_0x6e52('0x78'));}break;case'email':if(isEmail(_0x2618dd)){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c[_0x6e52('0x1e')](_0x6e52('0x79'));}break;case _0x6e52('0x7a'):var _0x4edbb5=moment(_0x2618dd,_0x6e52('0x7b'),!![]);if(_0x4edbb5[_0x6e52('0x73')]()){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c[_0x6e52('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}}else{switch(_0x34921d){case'firstName':case'phone':_0x85570c[_0x6e52('0x1e')](_0x34921d+'\x20not\x20specified');break;default:_0x260f41[_0x6e52('0x1e')]('\x22\x22');}}}}else{var _0x16dac4='';for(var _0x5dc556=0x0;_0x5dc556<_0x5addc1[_0x34921d][_0x6e52('0x1b')];_0x5dc556++){var _0x2618dd=_['trim'](_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d][_0x5dc556]][_0x6e52('0x7c')](/"/g,'\x27'));if(_0x16dac4=='')_0x16dac4=_0x2618dd;else _0x16dac4+='|'+_0x2618dd;}_0x215369[_0x6e52('0x1e')](_0x4fd423['id']+':'+_0x16dac4);}}if(hasAdditionalPhones){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x215369[_0x6e52('0x12')](';')+'\x22');}if(_0x85570c[_0x6e52('0x1b')]){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],{'code':_0x6e52('0x7d'),'message':_0x85570c[_0x6e52('0x12')]()});}else{fs[_0x6e52('0x7e')](_0x1d8390,_0x260f41[_0x6e52('0x12')]()+'\x0a');}_0x260f41=[];}if(!(stats[_0x6e52('0x6d')]%0xc8)){socket[_0x6e52('0x7f')](_0x6e52('0x80')+_0x5af20d,stats);stats[_0x6e52('0x6e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3a3af2[_0x6e52('0x81')]();}}catch(_0x13d953){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],{'code':_0x6e52('0x82'),'message':_0x13d953[_0x6e52('0x21')]});logger['error'](_0x6e52('0x83'),_0x13d953[_0x6e52('0x21')]);}},'complete':function(){try{var _0x2c95cc=[];var _0x348466=tempTableName;_0x2c95cc[_0x6e52('0x1e')](_0x6e52('0x84')+_0x348466+_0x6e52('0x85'));logger[_0x6e52('0x5d')](_0x6e52('0x86'),contactItemTypes[_0x6e52('0x1b')]);var _0x48e70a=util[_0x6e52('0xd')](_0x6e52('0x87'),_0x1d8390,_0x348466,_0x377b88,_0x4f7ff6[_0x6e52('0x37')],_0x4f7ff6[_0x6e52('0x59')]||null,NOW,NOW);if(_[_0x6e52('0x1c')](_0x5addc1[_0x6e52('0x35')])){_0x48e70a+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c95cc['push'](_0x48e70a);BPromise[_0x6e52('0x88')](_0x2c95cc,handleQuery)[_0x6e52('0x2c')](function(_0x2e593){BPromise['all']([handleAdditionalPhones()])[_0x6e52('0x2c')](function(){_0x2c95cc=[];for(var _0x1650c3=0x0;_0x1650c3=_0x1d7738){return _0x149bad[_0x3ed4('0x11')](0x193)['json']({'message':util[_0x3ed4('0x12')](_0x3ed4('0x13'),_0x1605f3)});}_0x3886db();})['catch'](function(_0x123b97){_0x3886db(_0x123b97);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3ed4('0x14')],{'where':{'$or':[{'role':_0x3ed4('0x15')},{'role':'user'}]}});}exports[_0x3ed4('0x16')]=isUserLimit; \ No newline at end of file +var _0xb993=['crypto','util','../../mysqldb','../../config/environment','license','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit'];(function(_0x77ec,_0x1aa9ab){var _0x4f2ab0=function(_0x4c9bb8){while(--_0x4c9bb8){_0x77ec['push'](_0x77ec['shift']());}};_0x4f2ab0(++_0x1aa9ab);}(_0xb993,0xe0));var _0x3b99=function(_0x5e7558,_0x2dba64){_0x5e7558=_0x5e7558-0x0;var _0xf1a5a5=_0xb993[_0x5e7558];return _0xf1a5a5;};'use strict';var crypto=require(_0x3b99('0x0'));var util=require(_0x3b99('0x1'));var compose=require('composable-middleware');var db=require(_0x3b99('0x2'))['db'];var config=require(_0x3b99('0x3'));function getValueFromLicense(_0x23cfda,_0x186a33){if(_0x23cfda&&_0x186a33){if(_0x186a33['data1']&&_0x186a33[_0x3b99('0x4')]){var _0x1a0146=_0x186a33[_0x3b99('0x5')];var _0x5423e4=_0x186a33[_0x3b99('0x4')];var _0x4eb9d9=_0x1a0146[_0x3b99('0x6')]('-')[0x4];var _0x5e94e9=_0x1a0146[_0x3b99('0x6')]('-')[0x0];var _0x27195f=crypto['createDecipher'](_0x3b99('0x7'),util[_0x3b99('0x8')](_0x3b99('0x9'),_0x4eb9d9,_0x1a0146,_0x5e94e9));var _0x49d8c2=_0x27195f[_0x3b99('0xa')](_0x5423e4,_0x3b99('0xb'),_0x3b99('0xc'));_0x49d8c2+=_0x27195f[_0x3b99('0xd')](_0x3b99('0xc'));var _0x2bec10=JSON[_0x3b99('0xe')](_0x49d8c2);return _0x2bec10[_0x3b99('0xf')](_0x23cfda)?_0x2bec10[_0x23cfda]:null;}}return null;}function isLimit(_0x52661f,_0x232d3a,_0x1b457e,_0x43d099){var _0x5742e5=_0x232d3a;return compose()[_0x3b99('0x10')](function(_0x3485d2,_0x49765b,_0x3ccbd5){return db[_0x3b99('0x11')][_0x3b99('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x3b99('0x13')](function(_0x528ae4){var _0x172a4a=getValueFromLicense(_0x52661f,_0x528ae4);return _0x172a4a?_0x172a4a:_0x5742e5;})[_0x3b99('0x13')](function(_0x1092d1){_0x5742e5=_0x1092d1;return _0x1b457e[_0x3b99('0x14')](_0x43d099);})[_0x3b99('0x13')](function(_0x201321){if(_0x201321>=_0x5742e5){return _0x49765b[_0x3b99('0x15')](0x193)[_0x3b99('0x16')]({'message':util[_0x3b99('0x8')](_0x3b99('0x17'),_0x52661f)});}_0x3ccbd5();})[_0x3b99('0x18')](function(_0x52086a){_0x3ccbd5(_0x52086a);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x3b99('0x19')},{'role':_0x3b99('0x1a')}]}});}exports[_0x3b99('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 26e3382..badd98e 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 _0x64f3=['hours','minutes','seconds','lodash','sqlOperator','startsWith','replace','[$and]','[$or]','split','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','shift','pop','utcOffset','add'];(function(_0xd67f28,_0x2396b3){var _0x3b7ed4=function(_0x2c0d7d){while(--_0x2c0d7d){_0xd67f28['push'](_0xd67f28['shift']());}};_0x3b7ed4(++_0x2396b3);}(_0x64f3,0x17d));var _0x364f=function(_0x59cb71,_0x218c2c){_0x59cb71=_0x59cb71-0x0;var _0x1e98f1=_0x64f3[_0x59cb71];return _0x1e98f1;};'use strict';var _=require(_0x364f('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x5a8ca1){var _0x494621={'conditions':[]};_0x494621[_0x364f('0x1')]=_[_0x364f('0x2')](_0x5a8ca1,'[$or]')?'or':'and';var _0x119f83=_0x5a8ca1[_0x364f('0x3')](_0x364f('0x4'),'')[_0x364f('0x3')](_0x364f('0x5'),'')[_0x364f('0x6')]('||');for(var _0x7f5197=0x0;_0x7f5197<_0x119f83['length'];_0x7f5197++){var _0x5799f4=_0x119f83[_0x7f5197][_0x364f('0x6')](':=');var _0x103e3a=_0x5799f4[0x0];var _0xf8aca9=_0x5799f4[_0x364f('0x7')](0x1);_0xf8aca9[_0x364f('0x8')](function(_0x2f0108){var _0xbe7777=_0x2f0108['split']('[')['shift']();var _0x551c34=_0x2f0108[_0x364f('0x9')](/\[(.*?)\]/g);_0x551c34[_0x364f('0x8')](function(_0x31e750){var _0x3a388b=_0x31e750['split']('[')[_0x364f('0xa')](function(_0x2c1bf6){return _0x2c1bf6[_0x364f('0xb')](']')>-0x1;})['map'](function(_0x25e7a1){return _0x25e7a1[_0x364f('0x6')](']')[0x0];})[0x0];_0x494621[_0x364f('0xc')][_0x364f('0xd')]({'field':_0x103e3a,'operator':_0xbe7777,'value':_0x3a388b});});});}return _0x494621;};exports[_0x364f('0xe')]=function(_0x2ec1b1,_0x4dbb64,_0x5b5f58){var _0x20c055={};if(_0x4dbb64===_0x364f('0xf')){if(_0x5b5f58[_0x364f('0x10')]===_0x364f('0x11')){_0x5b5f58[_0x364f('0x10')]=_0x364f('0x12');_0x5b5f58[_0x364f('0x13')]+=','+_0x5b5f58[_0x364f('0x13')];}else if(_[_0x364f('0x14')]([_0x364f('0x15'),_0x364f('0x16')],_0x5b5f58[_0x364f('0x10')])){_0x5b5f58[_0x364f('0x13')]=moment(_0x5b5f58['value'])['add'](0x1,_0x364f('0x17'))[_0x364f('0x18')](_0x364f('0x19'));}}if(_0x5b5f58[_0x364f('0x1a')]){_0x4dbb64=_0x5b5f58[_0x364f('0x1a')];_0x20c055[_0x364f('0x1b')]=_0x364f('0x1c')+_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+_0x364f('0x1e')+_0x5b5f58[_0x364f('0x1a')]+')\x20'+parseOperator(_0x5b5f58[_0x364f('0x10')]);}else{_0x20c055[_0x364f('0x1b')]=_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+'\x20'+parseOperator(_0x5b5f58[_0x364f('0x10')]);}if(_[_0x364f('0x14')](['$ne',_0x364f('0x1f')],_0x5b5f58[_0x364f('0x10')]))_0x20c055[_0x364f('0x1b')]='('+_0x20c055['text']+_0x364f('0x20')+_0x2ec1b1+'.'+_0x5b5f58[_0x364f('0x1d')]+_0x364f('0x21');_0x20c055[_0x364f('0x13')]=parseValue(_0x4dbb64,_0x5b5f58['operator'],_0x5b5f58[_0x364f('0x13')]);return _0x20c055;};function parseOperator(_0x1b115c){var _0x4626a3;switch(_0x1b115c){case'$in':_0x4626a3=_0x364f('0x22');break;case _0x364f('0x1f'):_0x4626a3=_0x364f('0x23');break;case _0x364f('0x11'):_0x4626a3='=\x20?';break;case _0x364f('0x24'):_0x4626a3=_0x364f('0x25');break;case'$substring':case'$startsWith':case _0x364f('0x26'):_0x4626a3='LIKE\x20?';break;case _0x364f('0x27'):_0x4626a3=_0x364f('0x28');break;case _0x364f('0x15'):_0x4626a3=_0x364f('0x29');break;case'$lte':_0x4626a3=_0x364f('0x2a');break;case'$gte':_0x4626a3=_0x364f('0x2b');break;case'$between':_0x4626a3=_0x364f('0x2c');break;}return _0x4626a3;}function parseValue(_0x1e9112,_0x11ec2c,_0x39ef3e){var _0x5145b5={'start':undefined,'end':undefined};switch(_0x11ec2c){case _0x364f('0x2d'):case _0x364f('0x1f'):_0x5145b5['start']=_0x39ef3e[_0x364f('0x6')](',');break;case'$substring':_0x5145b5[_0x364f('0x2e')]='%'+_0x39ef3e+'%';break;case'$startsWith':_0x5145b5[_0x364f('0x2e')]=_0x39ef3e+'%';break;case _0x364f('0x26'):_0x5145b5['start']='%'+_0x39ef3e;break;case _0x364f('0x12'):var _0x5f2b3d=_0x39ef3e[_0x364f('0x6')](',');var _0x39ef3e=_0x5f2b3d[_0x364f('0x2f')]();var _0x4bb6d3=_0x5f2b3d[_0x364f('0x30')]();if(_0x1e9112==='DATE'){_0x39ef3e=moment(_0x39ef3e)[_0x364f('0x31')](0x0,!![])[_0x364f('0x18')]();_0x4bb6d3=moment(_0x4bb6d3)[_0x364f('0x31')](0x0,!![])[_0x364f('0x32')](0x17,_0x364f('0x33'))[_0x364f('0x32')](0x3b,_0x364f('0x34'))['add'](0x3b,_0x364f('0x35'))[_0x364f('0x18')]();}_0x5145b5={'start':_0x39ef3e,'end':_0x4bb6d3};break;default:_0x5145b5[_0x364f('0x2e')]=_0x39ef3e;break;}return _0x5145b5;} \ No newline at end of file +var _0xf363=['$gt','$lte','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','$in','start','$substring','utcOffset','hours','minutes','[$or]','and','replace','[$and]','slice','forEach','split','shift','filter','indexOf','DATE','operator','$eq','value','includes'];(function(_0x3411a4,_0x60d585){var _0x4eb325=function(_0x2356d4){while(--_0x2356d4){_0x3411a4['push'](_0x3411a4['shift']());}};_0x4eb325(++_0x60d585);}(_0xf363,0x169));var _0x3f36=function(_0x1082eb,_0x1a86c5){_0x1082eb=_0x1082eb-0x0;var _0x5b7a36=_0xf363[_0x1082eb];return _0x5b7a36;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0xc9b0f2){var _0x9027f0={'conditions':[]};_0x9027f0['sqlOperator']=_['startsWith'](_0xc9b0f2,_0x3f36('0x0'))?'or':_0x3f36('0x1');var _0x1c6dc5=_0xc9b0f2[_0x3f36('0x2')](_0x3f36('0x3'),'')[_0x3f36('0x2')]('[$or]','')['split']('||');for(var _0x1ab278=0x0;_0x1ab278<_0x1c6dc5['length'];_0x1ab278++){var _0x17f020=_0x1c6dc5[_0x1ab278]['split'](':=');var _0xab7139=_0x17f020[0x0];var _0x410e35=_0x17f020[_0x3f36('0x4')](0x1);_0x410e35[_0x3f36('0x5')](function(_0x34ebbd){var _0x37b22c=_0x34ebbd[_0x3f36('0x6')]('[')[_0x3f36('0x7')]();var _0x47d4e7=_0x34ebbd['match'](/\[(.*?)\]/g);_0x47d4e7[_0x3f36('0x5')](function(_0x137a5a){var _0x39639f=_0x137a5a['split']('[')[_0x3f36('0x8')](function(_0x3a5819){return _0x3a5819[_0x3f36('0x9')](']')>-0x1;})['map'](function(_0x50e667){return _0x50e667['split'](']')[0x0];})[0x0];_0x9027f0['conditions']['push']({'field':_0xab7139,'operator':_0x37b22c,'value':_0x39639f});});});}return _0x9027f0;};exports['buildExpression']=function(_0x435e70,_0x562bdb,_0x2bdc83){var _0x24fa6c={};if(_0x562bdb===_0x3f36('0xa')){if(_0x2bdc83[_0x3f36('0xb')]===_0x3f36('0xc')){_0x2bdc83[_0x3f36('0xb')]='$between';_0x2bdc83[_0x3f36('0xd')]+=','+_0x2bdc83[_0x3f36('0xd')];}else if(_[_0x3f36('0xe')]([_0x3f36('0xf'),_0x3f36('0x10')],_0x2bdc83[_0x3f36('0xb')])){_0x2bdc83[_0x3f36('0xd')]=moment(_0x2bdc83[_0x3f36('0xd')])[_0x3f36('0x11')](0x1,'days')[_0x3f36('0x12')](_0x3f36('0x13'));}}if(_0x2bdc83[_0x3f36('0x14')]){_0x562bdb=_0x2bdc83['castTo'];_0x24fa6c['text']=_0x3f36('0x15')+_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+_0x3f36('0x17')+_0x2bdc83[_0x3f36('0x14')]+')\x20'+parseOperator(_0x2bdc83[_0x3f36('0xb')]);}else{_0x24fa6c[_0x3f36('0x18')]=_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+'\x20'+parseOperator(_0x2bdc83[_0x3f36('0xb')]);}if(_[_0x3f36('0xe')]([_0x3f36('0x19'),_0x3f36('0x1a')],_0x2bdc83[_0x3f36('0xb')]))_0x24fa6c['text']='('+_0x24fa6c[_0x3f36('0x18')]+_0x3f36('0x1b')+_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+'\x20IS\x20NULL)';_0x24fa6c[_0x3f36('0xd')]=parseValue(_0x562bdb,_0x2bdc83[_0x3f36('0xb')],_0x2bdc83[_0x3f36('0xd')]);return _0x24fa6c;};function parseOperator(_0x1a925e){var _0x4fb77d;switch(_0x1a925e){case'$in':_0x4fb77d=_0x3f36('0x1c');break;case _0x3f36('0x1a'):_0x4fb77d=_0x3f36('0x1d');break;case _0x3f36('0xc'):_0x4fb77d=_0x3f36('0x1e');break;case _0x3f36('0x19'):_0x4fb77d=_0x3f36('0x1f');break;case'$substring':case _0x3f36('0x20'):case _0x3f36('0x21'):_0x4fb77d=_0x3f36('0x22');break;case _0x3f36('0x23'):_0x4fb77d=_0x3f36('0x24');break;case _0x3f36('0xf'):_0x4fb77d=_0x3f36('0x25');break;case _0x3f36('0x10'):_0x4fb77d=_0x3f36('0x26');break;case'$gte':_0x4fb77d=_0x3f36('0x27');break;case _0x3f36('0x28'):_0x4fb77d='BETWEEN\x20?\x20AND\x20?';break;}return _0x4fb77d;}function parseValue(_0x11fb20,_0x5f5d93,_0x398018){var _0x263590={'start':undefined,'end':undefined};switch(_0x5f5d93){case _0x3f36('0x29'):case _0x3f36('0x1a'):_0x263590[_0x3f36('0x2a')]=_0x398018[_0x3f36('0x6')](',');break;case _0x3f36('0x2b'):_0x263590[_0x3f36('0x2a')]='%'+_0x398018+'%';break;case _0x3f36('0x20'):_0x263590[_0x3f36('0x2a')]=_0x398018+'%';break;case _0x3f36('0x21'):_0x263590[_0x3f36('0x2a')]='%'+_0x398018;break;case _0x3f36('0x28'):var _0x232d9c=_0x398018['split'](',');var _0x398018=_0x232d9c['shift']();var _0x5d8f09=_0x232d9c['pop']();if(_0x11fb20==='DATE'){_0x398018=moment(_0x398018)['utcOffset'](0x0,!![])[_0x3f36('0x12')]();_0x5d8f09=moment(_0x5d8f09)[_0x3f36('0x2c')](0x0,!![])[_0x3f36('0x11')](0x17,_0x3f36('0x2d'))[_0x3f36('0x11')](0x3b,_0x3f36('0x2e'))[_0x3f36('0x11')](0x3b,'seconds')[_0x3f36('0x12')]();}_0x263590={'start':_0x398018,'end':_0x5d8f09};break;default:_0x263590[_0x3f36('0x2a')]=_0x398018;break;}return _0x263590;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8ba38a8..cb06099 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 _0x2990=['join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','limit','offset','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','isArray','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','includes','push'];(function(_0x3226b5,_0x25aeeb){var _0x4a7920=function(_0x25b98d){while(--_0x25b98d){_0x3226b5['push'](_0x3226b5['shift']());}};_0x4a7920(++_0x25aeeb);}(_0x2990,0x135));var _0x0299=function(_0x2f0fff,_0x2a412c){_0x2f0fff=_0x2f0fff-0x0;var _0x3bf658=_0x2990[_0x2f0fff];return _0x3bf658;};'use strict';var _=require(_0x0299('0x0'));var sequelize=require(_0x0299('0x1'));var moment=require(_0x0299('0x2'));var LIMIT_VALUE=0xfa;exports[_0x0299('0x3')]=function(_0x127ed2){var _0x559bd7=null;if(_0x127ed2){_0x559bd7=_0x127ed2[_0x0299('0x4')](',');}return _0x559bd7;};exports[_0x0299('0x5')]=function(_0x1e45c6,_0x5c0d13){var _0x47602e={};if(!_[_0x0299('0x6')](_0x1e45c6)){_[_0x0299('0x7')](_0x1e45c6,function(_0x3e60c3,_0x322b6c){try{if(_0x5c0d13){var _0x1f8a91=_['find'](_0x5c0d13,{'name':_0x322b6c})||{};if(_0x1f8a91[_0x0299('0x8')]===_0x0299('0x9')&&_[_0x0299('0xa')](_0x3e60c3)){var _0x4a0132=JSON[_0x0299('0xb')](_0x3e60c3);var _0xabb2b3={'$gte':moment(moment(_0x4a0132[_0x0299('0xc')])[_0x0299('0xd')](_0x0299('0xe')))[_0x0299('0xf')]()[_0x0299('0xd')](),'$lte':moment(moment(_0x4a0132[_0x0299('0x10')])[_0x0299('0xd')](_0x0299('0xe')))[_0x0299('0xf')]()[_0x0299('0x11')](0x1,'s')[_0x0299('0xd')]()};_0x47602e[_0x322b6c]=_0xabb2b3;}else{_0x47602e[_0x322b6c]=_['isArray'](_0x3e60c3)?_0x3e60c3:JSON[_0x0299('0xb')](_0x3e60c3);}}else{_0x47602e[_0x322b6c]=_['isArray'](_0x3e60c3)?_0x3e60c3:JSON[_0x0299('0xb')](_0x3e60c3);}}catch(_0xd81bba){_0x47602e[_0x322b6c]=_0x3e60c3[_0x0299('0x4')](',');}});}return _0x47602e;};exports[_0x0299('0x12')]=function(_0x136d0e){_0x136d0e=parseInt(_0x136d0e,0xa);if(!_0x136d0e||_0x136d0e<0x0){_0x136d0e=LIMIT_VALUE;}return _0x136d0e;};exports[_0x0299('0x13')]=function(_0x1cea7b){_0x1cea7b=parseInt(_0x1cea7b,0xa);if(!_0x1cea7b||_0x1cea7b<0x0){_0x1cea7b=0x0;}return _0x1cea7b;};exports[_0x0299('0x14')]=function(_0x34b6f8){var _0x23908c,_0x54a2af=null;if(_0x34b6f8){_0x23908c=_0x34b6f8[_0x0299('0x4')](',');_0x54a2af=_[_0x0299('0x15')](_0x23908c,function(_0x257523){if(_0x257523[_0x0299('0x16')]('-')===0x0){return[_0x257523===_0x0299('0x17')?sequelize['cast'](sequelize['col'](_0x0299('0x17')),_0x0299('0x18')):_0x257523[_0x0299('0x19')](0x1),_0x0299('0x1a')];}else{return[_0x257523===_0x0299('0x17')?sequelize[_0x0299('0x1b')](sequelize[_0x0299('0x1c')]('priority'),_0x0299('0x18')):_0x257523,_0x0299('0x1d')];}});}return _0x54a2af;};exports[_0x0299('0x1e')]=function(_0x106ee3,_0x3a673e){if(_[_0x0299('0x6')](_0x106ee3)){return _0x106ee3;}if(_[_0x0299('0x1f')](_0x106ee3)){for(var _0x420f68=0x0;_0x420f68<_0x106ee3[_0x0299('0x20')];_0x420f68+=0x1){_0x106ee3[_0x420f68]=this[_0x0299('0x1e')](_0x106ee3[_0x420f68],_0x3a673e);}return _0x106ee3;}if(!_['isObject'](_0x106ee3)){return _0x106ee3;}if(_['isString'](_0x3a673e)){_0x3a673e=[_0x3a673e];}if(!_[_0x0299('0x1f')](_0x3a673e)){return _0x106ee3;}for(var _0x2216a5=0x0;_0x2216a5<_0x3a673e['length'];_0x2216a5+=0x1){_[_0x0299('0x21')](_0x106ee3,_0x3a673e[_0x2216a5]);}for(var _0x373cc5 in _0x106ee3){if(_0x106ee3[_0x0299('0x22')](_0x373cc5)){_0x106ee3[_0x373cc5]=this[_0x0299('0x1e')](_0x106ee3[_0x373cc5],_0x3a673e);}}return _0x106ee3;};exports[_0x0299('0x23')]=function(_0x37e3c7){return _0x37e3c7['match'](RegExp(_0x0299('0x24')))?!![]:![];};exports[_0x0299('0x25')]=function(_0x30430c){return _0x30430c[_0x0299('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x0299('0x27')]=function(_0x59b906){var _0x290177=[];_0x59b906[_0x0299('0x4')](/[ ,]+/)[_0x0299('0x28')](function(_0x500064){_0x500064=_0x500064['replace'](/([^:]")"+/g,'$1');_0x500064='+'+_0x500064+'*';if(_0x500064[_0x0299('0x29')]('@'))_0x500064='\x22'+_0x500064+'\x22';_0x290177[_0x0299('0x2a')](_0x500064);});return _0x290177[_0x0299('0x2b')]('\x20');}; \ No newline at end of file +var _0x6d1c=['omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','includes','push','lodash','sequelize','split','filters','isEmpty','forOwn','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','sort','indexOf','priority','cast','col','unsigned','substr','ASC'];(function(_0x42ac2e,_0x262d31){var _0x53d56c=function(_0x5e1c13){while(--_0x5e1c13){_0x42ac2e['push'](_0x42ac2e['shift']());}};_0x53d56c(++_0x262d31);}(_0x6d1c,0x15a));var _0xc6d1=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x6d1c[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0xc6d1('0x0'));var sequelize=require(_0xc6d1('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x497a14){var _0x3721f8=null;if(_0x497a14){_0x3721f8=_0x497a14[_0xc6d1('0x2')](',');}return _0x3721f8;};exports[_0xc6d1('0x3')]=function(_0x540e3a,_0x850b9d){var _0x5760a1={};if(!_[_0xc6d1('0x4')](_0x540e3a)){_[_0xc6d1('0x5')](_0x540e3a,function(_0x4da9b9,_0x3e564c){try{if(_0x850b9d){var _0x361d0e=_['find'](_0x850b9d,{'name':_0x3e564c})||{};if(_0x361d0e[_0xc6d1('0x6')]===_0xc6d1('0x7')&&_['isPlainObject'](_0x4da9b9)){var _0x16da56=JSON[_0xc6d1('0x8')](_0x4da9b9);var _0x403df2={'$gte':moment(moment(_0x16da56[_0xc6d1('0x9')])[_0xc6d1('0xa')](_0xc6d1('0xb')))[_0xc6d1('0xc')]()[_0xc6d1('0xa')](),'$lte':moment(moment(_0x16da56[_0xc6d1('0xd')])[_0xc6d1('0xa')](_0xc6d1('0xb')))[_0xc6d1('0xc')]()[_0xc6d1('0xe')](0x1,'s')[_0xc6d1('0xa')]()};_0x5760a1[_0x3e564c]=_0x403df2;}else{_0x5760a1[_0x3e564c]=_['isArray'](_0x4da9b9)?_0x4da9b9:JSON[_0xc6d1('0x8')](_0x4da9b9);}}else{_0x5760a1[_0x3e564c]=_[_0xc6d1('0xf')](_0x4da9b9)?_0x4da9b9:JSON[_0xc6d1('0x8')](_0x4da9b9);}}catch(_0x54f769){_0x5760a1[_0x3e564c]=_0x4da9b9['split'](',');}});}return _0x5760a1;};exports['limit']=function(_0x515ba4){_0x515ba4=parseInt(_0x515ba4,0xa);if(!_0x515ba4||_0x515ba4<0x0){_0x515ba4=LIMIT_VALUE;}return _0x515ba4;};exports['offset']=function(_0x89edd4){_0x89edd4=parseInt(_0x89edd4,0xa);if(!_0x89edd4||_0x89edd4<0x0){_0x89edd4=0x0;}return _0x89edd4;};exports[_0xc6d1('0x10')]=function(_0xb0888c){var _0x3a2544,_0x3dc0e5=null;if(_0xb0888c){_0x3a2544=_0xb0888c['split'](',');_0x3dc0e5=_['map'](_0x3a2544,function(_0xbedee3){if(_0xbedee3[_0xc6d1('0x11')]('-')===0x0){return[_0xbedee3===_0xc6d1('0x12')?sequelize[_0xc6d1('0x13')](sequelize[_0xc6d1('0x14')](_0xc6d1('0x12')),_0xc6d1('0x15')):_0xbedee3[_0xc6d1('0x16')](0x1),'DESC'];}else{return[_0xbedee3===_0xc6d1('0x12')?sequelize[_0xc6d1('0x13')](sequelize[_0xc6d1('0x14')](_0xc6d1('0x12')),_0xc6d1('0x15')):_0xbedee3,_0xc6d1('0x17')];}});}return _0x3dc0e5;};exports[_0xc6d1('0x18')]=function(_0x304fbd,_0xf346b5){if(_[_0xc6d1('0x4')](_0x304fbd)){return _0x304fbd;}if(_['isArray'](_0x304fbd)){for(var _0x369bd8=0x0;_0x369bd8<_0x304fbd[_0xc6d1('0x19')];_0x369bd8+=0x1){_0x304fbd[_0x369bd8]=this[_0xc6d1('0x18')](_0x304fbd[_0x369bd8],_0xf346b5);}return _0x304fbd;}if(!_[_0xc6d1('0x1a')](_0x304fbd)){return _0x304fbd;}if(_[_0xc6d1('0x1b')](_0xf346b5)){_0xf346b5=[_0xf346b5];}if(!_[_0xc6d1('0xf')](_0xf346b5)){return _0x304fbd;}for(var _0x1f8dcb=0x0;_0x1f8dcb<_0xf346b5['length'];_0x1f8dcb+=0x1){_[_0xc6d1('0x1c')](_0x304fbd,_0xf346b5[_0x1f8dcb]);}for(var _0x1d885e in _0x304fbd){if(_0x304fbd[_0xc6d1('0x1d')](_0x1d885e)){_0x304fbd[_0x1d885e]=this[_0xc6d1('0x18')](_0x304fbd[_0x1d885e],_0xf346b5);}}return _0x304fbd;};exports[_0xc6d1('0x1e')]=function(_0x3d4ed9){return _0x3d4ed9[_0xc6d1('0x1f')](RegExp(_0xc6d1('0x20')))?!![]:![];};exports[_0xc6d1('0x21')]=function(_0x4680a4){return _0x4680a4[_0xc6d1('0x1f')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1d93da){var _0x227395=[];_0x1d93da[_0xc6d1('0x2')](/[ ,]+/)['forEach'](function(_0x26d28b){_0x26d28b=_0x26d28b[_0xc6d1('0x22')](/([^:]")"+/g,'$1');_0x26d28b='+'+_0x26d28b+'*';if(_0x26d28b[_0xc6d1('0x23')]('@'))_0x26d28b='\x22'+_0x26d28b+'\x22';_0x227395[_0xc6d1('0x24')](_0x26d28b);});return _0x227395['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b03e66e..11bf8fd 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c39=['appPath','join','root','development','test','set','client','use','json\x20replacer','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','default','get','env','production'];(function(_0x43a638,_0x1acad1){var _0x321f13=function(_0x2784ff){while(--_0x2784ff){_0x43a638['push'](_0x43a638['shift']());}};_0x321f13(++_0x1acad1);}(_0x7c39,0x17c));var _0x97c3=function(_0xf05c0d,_0x3f8729){_0xf05c0d=_0xf05c0d-0x0;var _0x4a1a1b=_0x7c39[_0xf05c0d];return _0x4a1a1b;};'use strict';var express=require(_0x97c3('0x0'));var favicon=require(_0x97c3('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x97c3('0x2'));var cookieParser=require(_0x97c3('0x3'));var errorHandler=require(_0x97c3('0x4'));var path=require(_0x97c3('0x5'));var passport=require('passport');var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x97c3('0x6')]=function(_0xca3cd5){var _0x573550=_0xca3cd5[_0x97c3('0x7')](_0x97c3('0x8'));if(_0x573550===_0x97c3('0x9')){_0xca3cd5['set'](_0x97c3('0xa'),path[_0x97c3('0xb')](config[_0x97c3('0xc')],'public'));}if(_0x573550===_0x97c3('0xd')||_0x573550===_0x97c3('0xe')){_0xca3cd5[_0x97c3('0xf')]('appPath',path[_0x97c3('0xb')](config[_0x97c3('0xc')],_0x97c3('0x10')));_0xca3cd5[_0x97c3('0x11')](errorHandler());}_0xca3cd5[_0x97c3('0xf')](_0x97c3('0x12'),function(_0x53212e,_0x580f8e){if(this[_0x53212e]instanceof Date){_0x580f8e=this[_0x53212e]['toISOString']()[_0x97c3('0x13')]('.')[0x0]+'Z';}return _0x580f8e;});_0xca3cd5[_0x97c3('0x11')](express[_0x97c3('0x14')](_0xca3cd5['get'](_0x97c3('0xa'))));_0xca3cd5[_0x97c3('0xf')]('views',config[_0x97c3('0xc')]+_0x97c3('0x15'));_0xca3cd5[_0x97c3('0x16')](_0x97c3('0x17'),require(_0x97c3('0x18'))[_0x97c3('0x19')]);_0xca3cd5[_0x97c3('0xf')](_0x97c3('0x1a'),'html');_0xca3cd5[_0x97c3('0x11')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0xca3cd5[_0x97c3('0x11')](bodyParser[_0x97c3('0x1b')]({'limit':_0x97c3('0x1c')}));_0xca3cd5[_0x97c3('0x11')](cors());_0xca3cd5[_0x97c3('0x11')](methodOverride());_0xca3cd5[_0x97c3('0x11')](cookieParser());_0xca3cd5[_0x97c3('0x11')](passport[_0x97c3('0x1d')]());}; \ No newline at end of file +var _0xe605=['html','ejs','renderFile','view\x20engine','urlencoded','50mb','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','passport','cors','moment','../mysqldb','get','env','production','set','join','root','development','test','appPath','use','json\x20replacer','toISOString','split','static','views','/server/views','engine'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe605,0x126));var _0x5e60=function(_0x2a68bc,_0x369895){_0x2a68bc=_0x2a68bc-0x0;var _0x1ce5ee=_0xe605[_0x2a68bc];return _0x1ce5ee;};'use strict';var express=require('express');var favicon=require(_0x5e60('0x0'));var bodyParser=require(_0x5e60('0x1'));var methodOverride=require(_0x5e60('0x2'));var cookieParser=require(_0x5e60('0x3'));var errorHandler=require(_0x5e60('0x4'));var path=require('path');var passport=require(_0x5e60('0x5'));var cors=require(_0x5e60('0x6'));var moment=require(_0x5e60('0x7'));var config=require('./environment');var db=require(_0x5e60('0x8'))['db'];exports['default']=function(_0x2d0905){var _0x3b11a0=_0x2d0905[_0x5e60('0x9')](_0x5e60('0xa'));if(_0x3b11a0===_0x5e60('0xb')){_0x2d0905[_0x5e60('0xc')]('appPath',path[_0x5e60('0xd')](config[_0x5e60('0xe')],'public'));}if(_0x3b11a0===_0x5e60('0xf')||_0x3b11a0===_0x5e60('0x10')){_0x2d0905[_0x5e60('0xc')](_0x5e60('0x11'),path[_0x5e60('0xd')](config[_0x5e60('0xe')],'client'));_0x2d0905[_0x5e60('0x12')](errorHandler());}_0x2d0905[_0x5e60('0xc')](_0x5e60('0x13'),function(_0x38f56e,_0x2b9578){if(this[_0x38f56e]instanceof Date){_0x2b9578=this[_0x38f56e][_0x5e60('0x14')]()[_0x5e60('0x15')]('.')[0x0]+'Z';}return _0x2b9578;});_0x2d0905[_0x5e60('0x12')](express[_0x5e60('0x16')](_0x2d0905[_0x5e60('0x9')](_0x5e60('0x11'))));_0x2d0905['set'](_0x5e60('0x17'),config[_0x5e60('0xe')]+_0x5e60('0x18'));_0x2d0905[_0x5e60('0x19')](_0x5e60('0x1a'),require(_0x5e60('0x1b'))[_0x5e60('0x1c')]);_0x2d0905[_0x5e60('0xc')](_0x5e60('0x1d'),_0x5e60('0x1a'));_0x2d0905['use'](bodyParser[_0x5e60('0x1e')]({'limit':_0x5e60('0x1f'),'extended':!![]}));_0x2d0905[_0x5e60('0x12')](bodyParser['json']({'limit':_0x5e60('0x1f')}));_0x2d0905[_0x5e60('0x12')](cors());_0x2d0905[_0x5e60('0x12')](methodOverride());_0x2d0905[_0x5e60('0x12')](cookieParser());_0x2d0905[_0x5e60('0x12')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index eaf57fc..f31a29f 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 _0xc23a=['map','model','join','createHash','md5','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','crypto','bimedia-machine-uuid','child_process','keys','length','family','IPv4','concat','head','mac','address','127.0.0.1','orderBy','cpus'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xc23a,0xd2));var _0xac23=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xc23a[_0x5cc8b9];return _0x58892e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xac23('0x0'));var machine=require(_0xac23('0x1'));var exec=require(_0xac23('0x2'))['execSync'];function getInterfaces(){var _0x99f7dc=[];var _0x4e806e=os['networkInterfaces']();var _0x35c541=_['orderBy'](_[_0xac23('0x3')](_0x4e806e));for(var _0x22a991=0x0;_0x22a991<_0x35c541[_0xac23('0x4')];_0x22a991++){var _0x4c1482=_0x4e806e[_0x35c541[_0x22a991]]['filter'](function(_0x44b7d2){return _0x44b7d2[_0xac23('0x5')]===_0xac23('0x6')&&_0x44b7d2['internal']===![];});_0x99f7dc=_0x99f7dc[_0xac23('0x7')](_0x4c1482);}return _0x99f7dc;}function getFirstInterface(){var _0x450229=_[_0xac23('0x8')](getInterfaces());return{'macAddress':_0x450229&&_0x450229[_0xac23('0x9')]?_0x450229['mac']:'00:00:00:00:00:00','ipAddress':_0x450229&&_0x450229['address']?_0x450229[_0xac23('0xa')]:_0xac23('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3fe7c6=_[_0xac23('0xc')](os[_0xac23('0xd')]()[_0xac23('0xe')](function(_0x261ee1){return _0x261ee1[_0xac23('0xf')];}))[_0xac23('0x10')](':');return crypto[_0xac23('0x11')](_0xac23('0x12'))[_0xac23('0x13')](_0x3fe7c6)['digest'](_0xac23('0x14'));}exports[_0xac23('0x15')]=function(){switch(os['platform']()){case'win32':return exec(_0xac23('0x16'),{'encoding':_0xac23('0x17')})[_0xac23('0x18')]('\x0d\x0a','');default:var _0x49fa85=getFirstInterface();var _0x138548=getCPUhash();var _0x1c117f=_0x138548+'|'+os[_0xac23('0x19')]()+'|'+_0x49fa85[_0xac23('0x1a')]+'|'+_0x49fa85['ipAddress'];var _0xca15dd=crypto[_0xac23('0x11')](_0xac23('0x12'))['update'](_0x1c117f)['digest'](_0xac23('0x14'));return _0xca15dd[_0xac23('0x1b')](0x0,0x8)+'-'+_0xca15dd[_0xac23('0x1b')](0x8,0xc)+'-'+_0xca15dd[_0xac23('0x1b')](0xc,0x10)+'-'+_0xca15dd['substring'](0x10,0x14)+'-'+_0xca15dd[_0xac23('0x1b')](0x14);}}; \ No newline at end of file +var _0x37a7=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','update','digest','getUuid','platform','utf8','replace','hostname','ipAddress','substring','lodash','crypto','keys','length','filter','family','IPv4','internal','concat'];(function(_0x481ffc,_0x4acb82){var _0x51d09a=function(_0x2d73e0){while(--_0x2d73e0){_0x481ffc['push'](_0x481ffc['shift']());}};_0x51d09a(++_0x4acb82);}(_0x37a7,0x6f));var _0x737a=function(_0xed1f9b,_0x156335){_0xed1f9b=_0xed1f9b-0x0;var _0x2f16d0=_0x37a7[_0xed1f9b];return _0x2f16d0;};'use strict';var _=require(_0x737a('0x0'));var os=require('os');var crypto=require(_0x737a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];function getInterfaces(){var _0x2d4b54=[];var _0xc5eaef=os['networkInterfaces']();var _0x524516=_['orderBy'](_[_0x737a('0x2')](_0xc5eaef));for(var _0x477f2f=0x0;_0x477f2f<_0x524516[_0x737a('0x3')];_0x477f2f++){var _0x11109c=_0xc5eaef[_0x524516[_0x477f2f]][_0x737a('0x4')](function(_0x5cc52c){return _0x5cc52c[_0x737a('0x5')]===_0x737a('0x6')&&_0x5cc52c[_0x737a('0x7')]===![];});_0x2d4b54=_0x2d4b54[_0x737a('0x8')](_0x11109c);}return _0x2d4b54;}function getFirstInterface(){var _0x4fb3e0=_[_0x737a('0x9')](getInterfaces());return{'macAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xa')]?_0x4fb3e0['mac']:_0x737a('0xb'),'ipAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xc')]?_0x4fb3e0[_0x737a('0xc')]:_0x737a('0xd')};}exports[_0x737a('0xe')]=getFirstInterface;function getCPUhash(){var _0x27ccd9=_[_0x737a('0xf')](os['cpus']()[_0x737a('0x10')](function(_0x22cc58){return _0x22cc58[_0x737a('0x11')];}))[_0x737a('0x12')](':');return crypto[_0x737a('0x13')](_0x737a('0x14'))[_0x737a('0x15')](_0x27ccd9)[_0x737a('0x16')]('hex');}exports[_0x737a('0x17')]=function(){switch(os[_0x737a('0x18')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x737a('0x19')})[_0x737a('0x1a')]('\x0d\x0a','');default:var _0x64901f=getFirstInterface();var _0xd5dd7c=getCPUhash();var _0x1064c3=_0xd5dd7c+'|'+os[_0x737a('0x1b')]()+'|'+_0x64901f['macAddress']+'|'+_0x64901f[_0x737a('0x1c')];var _0x4a8323=crypto[_0x737a('0x13')](_0x737a('0x14'))['update'](_0x1064c3)[_0x737a('0x16')]('hex');return _0x4a8323['substring'](0x0,0x8)+'-'+_0x4a8323[_0x737a('0x1d')](0x8,0xc)+'-'+_0x4a8323[_0x737a('0x1d')](0xc,0x10)+'-'+_0x4a8323['substring'](0x10,0x14)+'-'+_0x4a8323[_0x737a('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2c99328..b700bfa 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 _0x8054=['email','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','Disabled','Changed','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','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','../../api/jira/jira.controller','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','findOne','fullname','|reason|','|uuid|','|machineUuid|','|email|'];(function(_0x2a5124,_0x3d1d8f){var _0x19cadc=function(_0x4d8b38){while(--_0x4d8b38){_0x2a5124['push'](_0x2a5124['shift']());}};_0x19cadc(++_0x3d1d8f);}(_0x8054,0x85));var _0x4805=function(_0x5ef430,_0x166a45){_0x5ef430=_0x5ef430-0x0;var _0x3bb68b=_0x8054[_0x5ef430];return _0x3bb68b;};'use strict';var util=require(_0x4805('0x0'));var moment=require(_0x4805('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x4805('0x2'))(module,_0x4805('0x3'));var db=require(_0x4805('0x4'))['db'];var encryptor=require(_0x4805('0x5'));var hardware=require('./hardware');var logger=require(_0x4805('0x6'))(_0x4805('0x7'));var jira=require(_0x4805('0x8'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x23c120){return new BPromise(function(_0x5dcedd,_0x58505c){var _0x1bd70c=util[_0x4805('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x23c120,module[_0x4805('0xa')][_0x4805('0x3')]);if(oldToken){_0x1bd70c=util[_0x4805('0x9')](_0x4805('0xb'),HOST,_0x23c120,module['exports'][_0x4805('0x3')],oldToken);}var _0x319176={'uri':_0x1bd70c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x319176)[_0x4805('0xc')](function(_0x4d6af3){_0x5dcedd(_0x4d6af3);})[_0x4805('0xd')](function(_0x2bccda){_0x58505c(_0x2bccda);});});}function sendJiraAlert(_0x2f499c,_0x926e12,_0x3cc943){var _0x1ba1ea='||FIELD||VALUE||\x0a';return db['User'][_0x4805('0xe')]({'where':{'role':'admin'},'attributes':[_0x4805('0xf'),'email'],'raw':!![]})[_0x4805('0xc')](function(_0x255ba6){ADMIN=_0x255ba6;_0x1ba1ea+=_0x4805('0x10')+_0x3cc943+'|\x0a';_0x1ba1ea+=_0x4805('0x11')+_0x2f499c+'|\x0a';_0x1ba1ea+=_0x4805('0x12')+_0x926e12+'|\x0a';_0x1ba1ea+='|name|'+ADMIN[_0x4805('0xf')]+'|\x0a';_0x1ba1ea+=_0x4805('0x13')+ADMIN[_0x4805('0x14')]+'|\x0a';return _0x1ba1ea;})['then'](function(_0x272136){var _0x4c2fc9=hardware['getFirstInterface']()[_0x4805('0x15')];return jira[_0x4805('0x16')]({'key':_0x4805('0x17'),'summary':_0x4805('0x18'),'description':_0x272136,'issuetype':'Alert','oldToken':_0x2f499c,'newToken':_0x926e12,'email':ADMIN[_0x4805('0x14')],'name':ADMIN[_0x4805('0xf')],'reason':GRAY_PERIOD_REASON,'ip':_0x4c2fc9});});}function manageLicense(_0x3e00c1,_0x5a9771){var _0x2dae93=_0x5a9771[_0x4805('0x19')]({'plain':!![]});httpRequest(_0x3e00c1)[_0x4805('0xc')](function(_0x31a89c){if(oldToken){oldToken=undefined;}if(_0x31a89c[_0x4805('0x1a')]){if(!_0x2dae93['license']&&_0x2dae93[_0x4805('0x7')]!=_0x31a89c[_0x4805('0x7')]||_0x2dae93[_0x4805('0x7')]&&_0x2dae93[_0x4805('0x1b')]){logger[_0x4805('0x1c')](_0x4805('0x1d'));}if(_0x2dae93['license']&&!_0x2dae93[_0x4805('0x1b')]&&_0x2dae93[_0x4805('0x7')]!=_0x31a89c[_0x4805('0x7')]){logger[_0x4805('0x1c')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2dae93[_0x4805('0x7')]&&!_0x2dae93['data2']&&_0x2dae93[_0x4805('0x7')]==_0x31a89c[_0x4805('0x7')]){return _0x5a9771;}return _0x5a9771[_0x4805('0x1e')]({'data1':_0x3e00c1,'data2':null,'license':_0x31a89c[_0x4805('0x7')]});}else{if(_0x31a89c[_0x4805('0x7')]||_0x2dae93[_0x4805('0x7')]){if(!_0x2dae93['data2']){if(_0x2dae93[_0x4805('0x1f')]==_0x3e00c1){GRAY_PERIOD_REASON=_0x4805('0x20');logger[_0x4805('0x1c')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4805('0x21');oldToken=_0x2dae93[_0x4805('0x1f')];logger['info'](_0x4805('0x22'),_0x2dae93['data1'],_0x3e00c1);}sendJiraAlert(_0x2dae93[_0x4805('0x1f')],_0x31a89c[_0x4805('0x23')],GRAY_PERIOD_REASON);logger[_0x4805('0x1c')](_0x4805('0x24'),GRAY_PERIOD_REASON[_0x4805('0x25')](),moment()[_0x4805('0x9')](_0x4805('0x26')));return _0x5a9771['update']({'data2':encryptor[_0x4805('0x27')](moment()[_0x4805('0x9')](_0x4805('0x26')))});}else{if(moment()[_0x4805('0x28')](encryptor['decryptString'](_0x2dae93[_0x4805('0x1b')]),_0x4805('0x29'))>DAYS){logger[_0x4805('0x1c')](_0x4805('0x2a'),moment()['format'](_0x4805('0x26')));return _0x5a9771[_0x4805('0x1e')]({'data1':_0x3e00c1,'data2':null,'license':null});}}}else{if(_0x2dae93[_0x4805('0x1f')]!=_0x3e00c1){logger[_0x4805('0x1c')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2dae93['data1'],_0x3e00c1);return _0x5a9771['update']({'data1':_0x3e00c1,'data2':null,'license':null});}}}return _0x5a9771;})['then'](function(_0x258798){_0x5a9771=_0x258798;})[_0x4805('0xd')](function(_0x4d2dd2){logger[_0x4805('0x2b')](_0x4d2dd2[_0x4805('0x2c')]);})[_0x4805('0x2d')](function(){setTimeout(function(){manageLicense(hardware[_0x4805('0x2e')](),_0x5a9771);},TIME);});}function defaultLicense(){var _0x43c7cf=hardware['getUuid']();if(_0x43c7cf){return db[_0x4805('0x2f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x43c7cf}})[_0x4805('0x30')](function(_0x37993e,_0x316f1f){logger[_0x4805('0x1c')](_0x4805('0x31'),_0x43c7cf);manageLicense(_0x43c7cf,_0x37993e);})['catch'](function(_0x3ff7ec){logger[_0x4805('0x2b')](_0x3ff7ec['message']);});}}exports[_0x4805('0x32')]=defaultLicense; \ No newline at end of file +var _0x8560=['catch','User','findOne','fullname','email','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','license','data2','info','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','update','error','message','finally','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then'];(function(_0xfc31a5,_0x190830){var _0x55949d=function(_0x2263c5){while(--_0x2263c5){_0xfc31a5['push'](_0xfc31a5['shift']());}};_0x55949d(++_0x190830);}(_0x8560,0x92));var _0x0856=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8560[_0x376b45];return _0x2341b3;};'use strict';var util=require('util');var moment=require(_0x0856('0x0'));var rp=require(_0x0856('0x1'));var BPromise=require(_0x0856('0x2'));var pkginfo=require(_0x0856('0x3'))(module,_0x0856('0x4'));var db=require(_0x0856('0x5'))['db'];var encryptor=require(_0x0856('0x6'));var hardware=require('./hardware');var logger=require(_0x0856('0x7'))('license');var jira=require(_0x0856('0x8'));const {config}=require(_0x0856('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2f537d){return new BPromise(function(_0x408c63,_0x4b4a8d){var _0x481da6=util[_0x0856('0xa')](_0x0856('0xb'),HOST,_0x2f537d,module[_0x0856('0xc')][_0x0856('0x4')]);if(oldToken){_0x481da6=util[_0x0856('0xa')](_0x0856('0xd'),HOST,_0x2f537d,module[_0x0856('0xc')][_0x0856('0x4')],oldToken);}var _0x589307={'uri':_0x481da6,'method':_0x0856('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x589307)[_0x0856('0xf')](function(_0x12fd4f){_0x408c63(_0x12fd4f);})[_0x0856('0x10')](function(_0x208693){_0x4b4a8d(_0x208693);});});}function sendJiraAlert(_0x218cc9,_0x1ac502,_0x7881da){var _0x23f1aa='||FIELD||VALUE||\x0a';return db[_0x0856('0x11')][_0x0856('0x12')]({'where':{'role':'admin'},'attributes':[_0x0856('0x13'),_0x0856('0x14')],'raw':!![]})[_0x0856('0xf')](function(_0x2cd6cb){ADMIN=_0x2cd6cb;_0x23f1aa+='|reason|'+_0x7881da+'|\x0a';_0x23f1aa+=_0x0856('0x15')+_0x218cc9+'|\x0a';_0x23f1aa+=_0x0856('0x16')+_0x1ac502+'|\x0a';_0x23f1aa+=_0x0856('0x17')+ADMIN[_0x0856('0x13')]+'|\x0a';_0x23f1aa+=_0x0856('0x18')+ADMIN[_0x0856('0x14')]+'|\x0a';return _0x23f1aa;})[_0x0856('0xf')](function(_0x323f68){var _0x502375=hardware[_0x0856('0x19')]()[_0x0856('0x1a')];return jira[_0x0856('0x1b')]({'key':'MOTLICENSE','summary':_0x0856('0x1c'),'description':_0x323f68,'issuetype':_0x0856('0x1d'),'oldToken':_0x218cc9,'newToken':_0x1ac502,'email':ADMIN[_0x0856('0x14')],'name':ADMIN[_0x0856('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x502375});});}function manageLicense(_0x5920a8,_0x4745f5){var _0xbe0cbd=_0x4745f5[_0x0856('0x1e')]({'plain':!![]});httpRequest(_0x5920a8)[_0x0856('0xf')](function(_0x1bfd3b){if(oldToken){oldToken=undefined;}if(_0x1bfd3b['active']){if(!_0xbe0cbd['license']&&_0xbe0cbd[_0x0856('0x1f')]!=_0x1bfd3b['license']||_0xbe0cbd['license']&&_0xbe0cbd[_0x0856('0x20')]){logger[_0x0856('0x21')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xbe0cbd[_0x0856('0x1f')]&&!_0xbe0cbd[_0x0856('0x20')]&&_0xbe0cbd['license']!=_0x1bfd3b[_0x0856('0x1f')]){logger[_0x0856('0x21')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xbe0cbd[_0x0856('0x1f')]&&!_0xbe0cbd[_0x0856('0x20')]&&_0xbe0cbd['license']==_0x1bfd3b['license']){return _0x4745f5;}return _0x4745f5['update']({'data1':_0x5920a8,'data2':null,'license':_0x1bfd3b[_0x0856('0x1f')]});}else{if(_0x1bfd3b[_0x0856('0x1f')]||_0xbe0cbd['license']){if(!_0xbe0cbd[_0x0856('0x20')]){if(_0xbe0cbd[_0x0856('0x22')]==_0x5920a8){GRAY_PERIOD_REASON=_0x0856('0x23');logger['info'](_0x0856('0x24'));}else{GRAY_PERIOD_REASON=_0x0856('0x25');oldToken=_0xbe0cbd[_0x0856('0x22')];logger[_0x0856('0x21')](_0x0856('0x26'),_0xbe0cbd['data1'],_0x5920a8);}sendJiraAlert(_0xbe0cbd[_0x0856('0x22')],_0x1bfd3b['uuid'],GRAY_PERIOD_REASON);logger[_0x0856('0x21')](_0x0856('0x27'),GRAY_PERIOD_REASON[_0x0856('0x28')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x4745f5['update']({'data2':encryptor[_0x0856('0x29')](moment()[_0x0856('0xa')](_0x0856('0x2a')))});}else{if(moment()[_0x0856('0x2b')](encryptor[_0x0856('0x2c')](_0xbe0cbd['data2']),_0x0856('0x2d'))>DAYS){logger[_0x0856('0x21')]('DEMO\x20START\x20AT\x20%s',moment()[_0x0856('0xa')](_0x0856('0x2a')));return _0x4745f5[_0x0856('0x2e')]({'data1':_0x5920a8,'data2':null,'license':null});}}}else{if(_0xbe0cbd['data1']!=_0x5920a8){logger[_0x0856('0x21')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xbe0cbd['data1'],_0x5920a8);return _0x4745f5[_0x0856('0x2e')]({'data1':_0x5920a8,'data2':null,'license':null});}}}return _0x4745f5;})['then'](function(_0x21bfda){_0x4745f5=_0x21bfda;})[_0x0856('0x10')](function(_0x50ba66){logger[_0x0856('0x2f')](_0x50ba66[_0x0856('0x30')]);})[_0x0856('0x31')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4745f5);},TIME);});}function defaultLicense(){var _0x3ad70c=hardware['getUuid']();if(_0x3ad70c){return db['License'][_0x0856('0x32')]({'where':{'id':0x1},'defaults':{'data1':_0x3ad70c}})[_0x0856('0x33')](function(_0x8444a3,_0x3586d2){logger[_0x0856('0x21')](_0x0856('0x34'),_0x3ad70c);manageLicense(_0x3ad70c,_0x8444a3);})['catch'](function(_0x52f8ba){logger['error'](_0x52f8ba[_0x0856('0x30')]);});}}exports[_0x0856('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c8443e8..6cf1803 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 _0x612b=['bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','format','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','then','users','telephones','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x612b,0x8d));var _0xb612=function(_0x168c37,_0x38f37d){_0x168c37=_0x168c37-0x0;var _0x3acaeb=_0x612b[_0x168c37];return _0x3acaeb;};'use strict';var util=require(_0xb612('0x0'));var _=require(_0xb612('0x1'));var moment=require(_0xb612('0x2'));var BPromise=require(_0xb612('0x3'));var hardware=require(_0xb612('0x4'));var encryptor=require(_0xb612('0x5'));var db=require(_0xb612('0x6'))['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':_0xb612('0x7'),'machineUuid':hardware[_0xb612('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb612('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb612('0xa'),'machineUuid':hardware[_0xb612('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3d7f75){return new BPromise(function(_0x2bb9f0,_0x3008db){return db[_0xb612('0xb')]['find'](_[_0xb612('0xc')](_0x3d7f75,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x20a760){return checkLicense(_0x20a760,null);})['then'](function(_0x2316d1){_0x2bb9f0(_0x2316d1);return;})[_0xb612('0xd')](function(_0x112d64){_0x3008db(_0x112d64);});});}function checkLicense(_0x444099,_0xf6bb99){if(!_0x444099){demoLicense['uuid']=_0x444099[_0xb612('0xe')];return demoLicense;}try{var _0x1ec0f8=_0xf6bb99||_0x444099[_0xb612('0xf')];if(_['isEmpty'](_0x1ec0f8)){throw new Error(_0xb612('0x10'));}var _0x579657=_0x444099[_0xb612('0xe')];var _0x130a6c=_0x444099[_0xb612('0x11')];var _0x520550=_0x579657[_0xb612('0x12')]('-')[0x4];var _0x5d09cc=_0x579657['split']('-')[0x0];var _0x3a8d41=encryptor[_0xb612('0x13')](_0x1ec0f8,util['format'](_0xb612('0x14'),_0x520550,_0x579657,_0x5d09cc));var _0x9a517c=JSON[_0xb612('0x15')](_0x3a8d41);_0x9a517c[_0xb612('0x16')]=![];_0x9a517c[_0xb612('0x17')]=_0x579657;_0x9a517c[_0xb612('0x18')]=hardware[_0xb612('0x8')]();if(_0x130a6c){var _0x359d13=encryptor[_0xb612('0x13')](_0x130a6c);_0x9a517c[_0xb612('0x19')]=_0x359d13;_0x9a517c[_0xb612('0x1a')]=moment(_0x359d13)['add'](0x7,'days')[_0xb612('0x1b')]();_0x9a517c[_0xb612('0x1c')]=_0x9a517c['uuid']!=_0x9a517c['machineUuid']?_0xb612('0x1d'):_0xb612('0x1e');}return _0x9a517c;}catch(_0x396600){breakingLicense[_0xb612('0x17')]=_0x444099['data1'];breakingLicense[_0xb612('0x1f')]=_0x396600[_0xb612('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x59ea70,_0x413329){getLicense()['then'](function(_0xf0d4bc){return db[_0xb612('0x20')][_0xb612('0x21')]({'attributes':[_0xb612('0x22'),[db[_0xb612('0x23')]['fn'](_0xb612('0x24'),db[_0xb612('0x23')]['col'](_0xb612('0x22'))),'count']],'group':_0xb612('0x22'),'where':{'role':{'$or':[_0xb612('0x25'),_0xb612('0x26'),'telephone']}},'raw':!![]})[_0xb612('0x27')](function(_0x4c42fb){var _0x84bd8f={'user':_0xf0d4bc[_0xb612('0x28')]||0x0,'telephone':_0xf0d4bc[_0xb612('0x29')]||0x0};_0x4c42fb['forEach'](function(_0x19c96c){var _0x36a2fa=_0x19c96c['role']===_0xb612('0x25')?_0xb612('0x26'):_0x19c96c[_0xb612('0x22')];_0x84bd8f[_0x36a2fa]-=_0x19c96c['count'];if(_0x84bd8f[_0x36a2fa]<0x0)_0x84bd8f[_0x36a2fa]=0x0;});_0x59ea70(_0x84bd8f);return;});})[_0xb612('0xd')](function(_0x13b20b){_0x413329(_0x13b20b);});});}function checkUserLimits(_0x3a2f3c){return new BPromise(function(_0x2c136b,_0x3bb90a){getLimits()[_0xb612('0x27')](function(_0x140942){var _0x1b4e6f=_[_0xb612('0x2a')](_[_0xb612('0x2b')](_0x3a2f3c,_0xb612('0x22')),[_0xb612('0x25'),'user',_0xb612('0x2c')]);var _0xfe4db0=(_0x1b4e6f['admin']||0x0)+(_0x1b4e6f[_0xb612('0x26')]||0x0);var _0x49f056=_0x1b4e6f[_0xb612('0x2c')]||0x0;if(_0xfe4db0>_0x140942[_0xb612('0x26')])return _0x3bb90a(_0xb612('0x2d'));if(_0x49f056>_0x140942[_0xb612('0x2c')])return _0x3bb90a(_0xb612('0x2e'));return _0x2c136b();})[_0xb612('0xd')](function(_0x1da35f){_0x3bb90a(_0x1da35f);});});}module[_0xb612('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6305=['find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','changed','disabled','message','User','findAll','role','sequelize','admin','telephone','users','telephones','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x6305,0x179));var _0x5630=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6305[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0x5630('0x0'));var _=require(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var hardware=require('./hardware');var encryptor=require(_0x5630('0x4'));var db=require(_0x5630('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5630('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x5630('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5630('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5630('0x8'),'machineUuid':hardware[_0x5630('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x48dd2b){return new BPromise(function(_0x51447f,_0x406409){return db[_0x5630('0x9')][_0x5630('0xa')](_['defaults'](_0x48dd2b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x41a4a0){return checkLicense(_0x41a4a0,null);})[_0x5630('0xb')](function(_0xc06703){_0x51447f(_0xc06703);return;})[_0x5630('0xc')](function(_0x1e9b64){_0x406409(_0x1e9b64);});});}function checkLicense(_0x533e07,_0x328d8d){if(!_0x533e07){demoLicense[_0x5630('0xd')]=_0x533e07[_0x5630('0xe')];return demoLicense;}try{var _0x55e3c7=_0x328d8d||_0x533e07[_0x5630('0xf')];if(_[_0x5630('0x10')](_0x55e3c7)){throw new Error(_0x5630('0x11'));}var _0x2ec972=_0x533e07[_0x5630('0xe')];var _0x140301=_0x533e07['data2'];var _0x231b2c=_0x2ec972['split']('-')[0x4];var _0x119661=_0x2ec972[_0x5630('0x12')]('-')[0x0];var _0x368ae1=encryptor[_0x5630('0x13')](_0x55e3c7,util[_0x5630('0x14')](_0x5630('0x15'),_0x231b2c,_0x2ec972,_0x119661));var _0x91c189=JSON['parse'](_0x368ae1);_0x91c189[_0x5630('0x16')]=![];_0x91c189[_0x5630('0xd')]=_0x2ec972;_0x91c189[_0x5630('0x17')]=hardware[_0x5630('0x7')]();if(_0x140301){var _0x236c9a=encryptor[_0x5630('0x13')](_0x140301);_0x91c189[_0x5630('0x18')]=_0x236c9a;_0x91c189[_0x5630('0x19')]=moment(_0x236c9a)[_0x5630('0x1a')](0x7,'days')[_0x5630('0x14')]();_0x91c189['grayReason']=_0x91c189[_0x5630('0xd')]!=_0x91c189[_0x5630('0x17')]?_0x5630('0x1b'):_0x5630('0x1c');}return _0x91c189;}catch(_0x2f5dc9){breakingLicense[_0x5630('0xd')]=_0x533e07[_0x5630('0xe')];breakingLicense[_0x5630('0x1d')]=_0x2f5dc9[_0x5630('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x539680,_0x416f65){getLicense()[_0x5630('0xb')](function(_0x2fb00d){return db[_0x5630('0x1e')][_0x5630('0x1f')]({'attributes':[_0x5630('0x20'),[db[_0x5630('0x21')]['fn']('COUNT',db[_0x5630('0x21')]['col']('role')),'count']],'group':_0x5630('0x20'),'where':{'role':{'$or':[_0x5630('0x22'),'user',_0x5630('0x23')]}},'raw':!![]})[_0x5630('0xb')](function(_0x2a86e2){var _0x5b1c34={'user':_0x2fb00d[_0x5630('0x24')]||0x0,'telephone':_0x2fb00d[_0x5630('0x25')]||0x0};_0x2a86e2['forEach'](function(_0x1dd6df){var _0x25c0ce=_0x1dd6df['role']==='admin'?_0x5630('0x26'):_0x1dd6df[_0x5630('0x20')];_0x5b1c34[_0x25c0ce]-=_0x1dd6df['count'];if(_0x5b1c34[_0x25c0ce]<0x0)_0x5b1c34[_0x25c0ce]=0x0;});_0x539680(_0x5b1c34);return;});})['catch'](function(_0x2abd4e){_0x416f65(_0x2abd4e);});});}function checkUserLimits(_0x530641){return new BPromise(function(_0x2bc47d,_0x4dc0c7){getLimits()[_0x5630('0xb')](function(_0x41ad0b){var _0x48fae6=_[_0x5630('0x27')](_['countBy'](_0x530641,_0x5630('0x20')),['admin',_0x5630('0x26'),_0x5630('0x23')]);var _0x4d8a8d=(_0x48fae6[_0x5630('0x22')]||0x0)+(_0x48fae6[_0x5630('0x26')]||0x0);var _0x288d44=_0x48fae6[_0x5630('0x23')]||0x0;if(_0x4d8a8d>_0x41ad0b[_0x5630('0x26')])return _0x4dc0c7(_0x5630('0x28'));if(_0x288d44>_0x41ad0b['telephone'])return _0x4dc0c7(_0x5630('0x29'));return _0x2bc47d();})[_0x5630('0xc')](function(_0x163e86){_0x4dc0c7(_0x163e86);});});}module[_0x5630('0x2a')]={'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 e341eaf..d9c1176 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 _0xebea=['app-id','secret'];(function(_0x5dcadd,_0x444134){var _0x5e37dc=function(_0x43a732){while(--_0x43a732){_0x5dcadd['push'](_0x5dcadd['shift']());}};_0x5e37dc(++_0x444134);}(_0xebea,0xec));var _0xaebe=function(_0x2051bd,_0x4b1e3e){_0x2051bd=_0x2051bd-0x0;var _0x512fcf=_0xebea[_0x2051bd];return _0x512fcf;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaebe('0x0'),'GOOGLE_SECRET':_0xaebe('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xfe1b=['app-id','secret','myappanuglar-secret'];(function(_0x43cbc9,_0x789f50){var _0x1c0ec5=function(_0x2fb0f4){while(--_0x2fb0f4){_0x43cbc9['push'](_0x43cbc9['shift']());}};_0x1c0ec5(++_0x789f50);}(_0xfe1b,0x15e));var _0xbfe1=function(_0x1de104,_0x5d7701){_0x1de104=_0x1de104-0x0;var _0x351a5f=_0xfe1b[_0x1de104];return _0x351a5f;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbfe1('0x0'),'GOOGLE_ID':_0xbfe1('0x1'),'GOOGLE_SECRET':_0xbfe1('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 59b7886..f2b01ab 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2edb=['toUpperCase','Logger','transports','File','%s-%s','error','Console','env','debugLevel','moment','winston','join','format','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x60ae23,_0x1e438d){var _0x1cd69f=function(_0x98ae6d){while(--_0x98ae6d){_0x60ae23['push'](_0x60ae23['shift']());}};_0x1cd69f(++_0x1e438d);}(_0x2edb,0x1cb));var _0xb2ed=function(_0x14ac9e,_0x443c98){_0x14ac9e=_0x14ac9e-0x0;var _0x455527=_0x2edb[_0x14ac9e];return _0x455527;};'use strict';var moment=require(_0xb2ed('0x0'));var winston=require(_0xb2ed('0x1'));var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x1bb64f,_0x40639e){return path[_0xb2ed('0x2')]('/var','log','xcally',util[_0xb2ed('0x3')]('%s-%s.log',_0x1bb64f,_0x40639e));}function formatter(_0x200d47,_0x4f1bfb){_0x4f1bfb[_0xb2ed('0x4')]=_0x4f1bfb[_0xb2ed('0x4')]['replace'](/@@{/g,_0xb2ed('0x5'))[_0xb2ed('0x6')](/}@@/g,_0xb2ed('0x7'))[_0xb2ed('0x6')](/@{/g,'{{')[_0xb2ed('0x6')](/}@/g,'}}');return util[_0xb2ed('0x3')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xb2ed('0x8')),_0x4f1bfb['level'][_0xb2ed('0x9')](),_0x200d47,_0x4f1bfb[_0xb2ed('0x4')]);}module['exports']=function(_0x393b9f){return new winston[(_0xb2ed('0xa'))]({'transports':[new winston[(_0xb2ed('0xb'))][(_0xb2ed('0xc'))]({'name':util['format'](_0xb2ed('0xd'),_0x393b9f,_0xb2ed('0xe')),'filename':filename(_0x393b9f,'error'),'level':_0xb2ed('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7f3fa4){return formatter(_0x393b9f,_0x7f3fa4);}}),new winston[(_0xb2ed('0xb'))]['File']({'name':util[_0xb2ed('0x3')](_0xb2ed('0xd'),_0x393b9f,'info'),'filename':filename(_0x393b9f,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x286b2c){return formatter(_0x393b9f,_0x286b2c);}}),new winston[(_0xb2ed('0xb'))][(_0xb2ed('0xf'))]({'level':process[_0xb2ed('0x10')][_0xb2ed('0x11')]||debugLevel,'json':![],'formatter':function(_0x57928f){return formatter(_0x393b9f,_0x57928f);}})]});}; \ No newline at end of file +var _0x94f3=['{{{','replace','}}}','level','toUpperCase','exports','transports','File','error','%s-%s','info','debugLevel','moment','join','xcally','format','%s-%s.log','message'];(function(_0x444c70,_0x58d3d9){var _0x93886f=function(_0x103bd2){while(--_0x103bd2){_0x444c70['push'](_0x444c70['shift']());}};_0x93886f(++_0x58d3d9);}(_0x94f3,0x198));var _0x394f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x94f3[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x394f('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x4b2f15,_0x42ddc4){return path[_0x394f('0x1')]('/var','log',_0x394f('0x2'),util[_0x394f('0x3')](_0x394f('0x4'),_0x4b2f15,_0x42ddc4));}function formatter(_0x4b161e,_0x1482c4){_0x1482c4[_0x394f('0x5')]=_0x1482c4['message']['replace'](/@@{/g,_0x394f('0x6'))[_0x394f('0x7')](/}@@/g,_0x394f('0x8'))['replace'](/@{/g,'{{')[_0x394f('0x7')](/}@/g,'}}');return util[_0x394f('0x3')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x394f('0x3')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1482c4[_0x394f('0x9')][_0x394f('0xa')](),_0x4b161e,_0x1482c4[_0x394f('0x5')]);}module[_0x394f('0xb')]=function(_0x140093){return new winston['Logger']({'transports':[new winston[(_0x394f('0xc'))][(_0x394f('0xd'))]({'name':util[_0x394f('0x3')]('%s-%s',_0x140093,_0x394f('0xe')),'filename':filename(_0x140093,'error'),'level':_0x394f('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58ed1f){return formatter(_0x140093,_0x58ed1f);}}),new winston[(_0x394f('0xc'))][(_0x394f('0xd'))]({'name':util[_0x394f('0x3')](_0x394f('0xf'),_0x140093,_0x394f('0x10')),'filename':filename(_0x140093,_0x394f('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1af953){return formatter(_0x140093,_0x1af953);}}),new winston['transports']['Console']({'level':process['env'][_0x394f('0x11')]||debugLevel,'json':![],'formatter':function(_0xb5732){return formatter(_0x140093,_0xb5732);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2bf17fe..2fa2506 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 _0x897b=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','xdr','exports'];(function(_0x2cc86e,_0x5e9be8){var _0x3c43e1=function(_0x522ecc){while(--_0x522ecc){_0x2cc86e['push'](_0x2cc86e['shift']());}};_0x3c43e1(++_0x5e9be8);}(_0x897b,0x90));var _0xb897=function(_0xa1f86c,_0x58da08){_0xa1f86c=_0xa1f86c-0x0;var _0x17e886=_0x897b[_0xa1f86c];return _0x17e886;};'use strict';var path=require(_0xb897('0x0'));var os=require('os');var config={'apps':[{'name':_0xb897('0x1'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x3'))},{'name':_0xb897('0x4'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x5'))},{'name':_0xb897('0x6'),'script':path[_0xb897('0x2')](__dirname,_0xb897('0x7'))},{'name':'email','script':path[_0xb897('0x2')](__dirname,_0xb897('0x8'))},{'name':_0xb897('0x9'),'script':path[_0xb897('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xb897('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xb897('0xb')]=config; \ No newline at end of file +var _0x2908=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x146a62,_0x27b609){var _0x2c725d=function(_0xe61563){while(--_0xe61563){_0x146a62['push'](_0x146a62['shift']());}};_0x2c725d(++_0x27b609);}(_0x2908,0x1ef));var _0x8290=function(_0x21c324,_0x3d3f82){_0x21c324=_0x21c324-0x0;var _0x52612d=_0x2908[_0x21c324];return _0x52612d;};'use strict';var path=require(_0x8290('0x0'));var os=require('os');var config={'apps':[{'name':_0x8290('0x1'),'script':path[_0x8290('0x2')](__dirname,_0x8290('0x3'))},{'name':_0x8290('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x8290('0x5'),'script':path['join'](__dirname,_0x8290('0x6'))},{'name':_0x8290('0x7'),'script':path['join'](__dirname,_0x8290('0x8'))},{'name':'routing','script':path[_0x8290('0x2')](__dirname,_0x8290('0x9'))},{'name':'xdr','script':path[_0x8290('0x2')](__dirname,_0x8290('0xa'))}]};module[_0x8290('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3f3e8c7..9a5bed8 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 _0x432b=['dump','saved','pm2','./config','connect','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0xb432('0x0'));var BPromise=require('bluebird');var config=require(_0xb432('0x1'));function connect(){return new BPromise(function(_0x37fb3d,_0x7170b6){return pm2[_0xb432('0x2')](function(_0x5173f6){if(_0x5173f6){return _0x7170b6(_0x5173f6);}return _0x37fb3d('connected');});});};exports[_0xb432('0x3')]=function(_0x4cefc4){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x5cb510,_0x143093){return pm2[_0xb432('0x3')](_0x4cefc4,function(_0x274447,_0x45f857){if(_0x274447){return _0x143093(_0x274447);}pm2[_0xb432('0x5')]();return _0x5cb510(_0x45f857);});});});};exports[_0xb432('0x6')]=function(_0x198b71){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x4e4302,_0x12adbe){return pm2[_0xb432('0x6')](_0x198b71,function(_0x2bc6e5,_0x4288c3){if(_0x2bc6e5){return _0x12adbe(_0x2bc6e5);}pm2[_0xb432('0x5')]();return _0x4e4302(_0x4288c3);});});});};exports[_0xb432('0x7')]=function(_0x5d0d3b){return connect()['then'](function(){return new BPromise(function(_0x3c1a43,_0x255773){return pm2['restart'](_0x5d0d3b,function(_0x659b46,_0x323ae9){if(_0x659b46){return _0x255773(_0x659b46);}pm2[_0xb432('0x5')]();return _0x3c1a43(_0x323ae9);});});});};exports['list']=function(){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x2ce33d,_0x4f9155){return pm2[_0xb432('0x8')](function(_0xdac1e3,_0x427ad4){if(_0xdac1e3){return _0x4f9155(_0xdac1e3);}pm2[_0xb432('0x5')]();return _0x2ce33d(_0x427ad4);});});});};exports[_0xb432('0x9')]=function(_0x526330){return connect()['then'](function(){return new BPromise(function(_0x42f81d,_0x15bff1){return pm2[_0xb432('0x9')](_0x526330,function(_0x26068a,_0x27365c){if(_0x26068a){return _0x15bff1(_0x26068a);}pm2[_0xb432('0x5')]();return _0x42f81d(_0x27365c);});});});};exports[_0xb432('0xa')]=function(_0x1686a1){return connect()[_0xb432('0x4')](function(){return new BPromise(function(_0x425631,_0x4b780d){return pm2['delete'](_0x1686a1,function(_0x26c96e,_0x2b33a7){if(_0x26c96e){return _0x4b780d(_0x26c96e);}pm2[_0xb432('0x5')]();return _0x425631(_0x2b33a7);});});});};exports[_0xb432('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x34febc,_0x2bcded){return pm2[_0xb432('0xb')](function(_0x2fcbb1){if(_0x2fcbb1){return _0x2bcded(_0x2fcbb1);}return _0x34febc(_0xb432('0xc'));});});});}; \ No newline at end of file +var _0xdbb3=['dump','saved','pm2','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete'];(function(_0x58793b,_0x289a30){var _0x1977a9=function(_0xe2221){while(--_0xe2221){_0x58793b['push'](_0x58793b['shift']());}};_0x1977a9(++_0x289a30);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xdbb3[_0x6cf19c];return _0xce14f3;};'use strict';var pm2=require(_0x3dbb('0x0'));var BPromise=require(_0x3dbb('0x1'));var config=require(_0x3dbb('0x2'));function connect(){return new BPromise(function(_0x3fb380,_0x129124){return pm2['connect'](function(_0x4141ff){if(_0x4141ff){return _0x129124(_0x4141ff);}return _0x3fb380(_0x3dbb('0x3'));});});};exports[_0x3dbb('0x4')]=function(_0x5d4fce){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x3d0be3,_0x433118){return pm2['start'](_0x5d4fce,function(_0x1b72b0,_0x380291){if(_0x1b72b0){return _0x433118(_0x1b72b0);}pm2['disconnect']();return _0x3d0be3(_0x380291);});});});};exports[_0x3dbb('0x6')]=function(_0x4dd7bf){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x1d9a12,_0xa185b4){return pm2[_0x3dbb('0x6')](_0x4dd7bf,function(_0x491c74,_0x312bca){if(_0x491c74){return _0xa185b4(_0x491c74);}pm2[_0x3dbb('0x7')]();return _0x1d9a12(_0x312bca);});});});};exports[_0x3dbb('0x8')]=function(_0xe06a85){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x4bcb19,_0x398886){return pm2[_0x3dbb('0x8')](_0xe06a85,function(_0x5b3107,_0x1743aa){if(_0x5b3107){return _0x398886(_0x5b3107);}pm2['disconnect']();return _0x4bcb19(_0x1743aa);});});});};exports[_0x3dbb('0x9')]=function(){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x466b8c,_0x3bd5ea){return pm2[_0x3dbb('0x9')](function(_0xb0bb4c,_0x1df26b){if(_0xb0bb4c){return _0x3bd5ea(_0xb0bb4c);}pm2[_0x3dbb('0x7')]();return _0x466b8c(_0x1df26b);});});});};exports[_0x3dbb('0xa')]=function(_0x758918){return connect()['then'](function(){return new BPromise(function(_0x3b7b93,_0x171823){return pm2[_0x3dbb('0xa')](_0x758918,function(_0x4b938d,_0x108028){if(_0x4b938d){return _0x171823(_0x4b938d);}pm2[_0x3dbb('0x7')]();return _0x3b7b93(_0x108028);});});});};exports[_0x3dbb('0xb')]=function(_0x290afc){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x21c12a,_0x3050c1){return pm2[_0x3dbb('0xb')](_0x290afc,function(_0x1141c9,_0x4c9d11){if(_0x1141c9){return _0x3050c1(_0x1141c9);}pm2[_0x3dbb('0x7')]();return _0x21c12a(_0x4c9d11);});});});};exports[_0x3dbb('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x23ded5,_0x19da63){return pm2[_0x3dbb('0xc')](function(_0x5eb635){if(_0x5eb635){return _0x19da63(_0x5eb635);}return _0x23ded5(_0x3dbb('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ef4180c..4c8fb9d 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 _0x2533=['format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x2533,0x167));var _0x3253=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x2533[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0x3253('0x0'));var moment=require(_0x3253('0x1'));var Redis=require(_0x3253('0x2'));var util=require(_0x3253('0x3'));var config=require(_0x3253('0x4'));var db=require(_0x3253('0x5'))['db'];var logger=require('../logger')(_0x3253('0x6'));config[_0x3253('0x7')]=_[_0x3253('0x8')](config[_0x3253('0x7')],{'host':_0x3253('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x47adbc=0x0;var _0x5b22d6=[];return db['Setting'][_0x3253('0xa')]({'raw':!![],'attributes':['id',_0x3253('0xb')],'where':{'id':0x1}})[_0x3253('0xc')](function(_0x1a13a0){_0x47adbc=_0x1a13a0[_0x3253('0xb')];if(_0x47adbc){return db[_0x3253('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x3253('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3253('0xf')](_0x1a13a0[_0x3253('0xb')],_0x3253('0x10'))}}});}else{return[];}})['then'](function(_0x114b0f){if(_0x114b0f&&_0x114b0f[_0x3253('0x11')]){_0x5b22d6=_[_0x3253('0x12')](_0x114b0f||[],'id');logger[_0x3253('0x13')](_0x3253('0x14'),_0x5b22d6[_0x3253('0x15')]());return db[_0x3253('0xd')][_0x3253('0x16')]({'closeReason':_0x3253('0x17'),'disposition':_0x3253('0x18'),'closed':!![],'closedAt':moment()[_0x3253('0x19')](_0x3253('0x1a'))},{'where':{'id':_0x5b22d6}});}})[_0x3253('0xc')](function(){if(_0x5b22d6&&_0x5b22d6[_0x3253('0x11')]){logger[_0x3253('0x13')](_0x3253('0x1b'),_0x5b22d6[_0x3253('0x15')]());for(var _0x1b4a60=0x0;_0x1b4a60<_0x5b22d6['length'];_0x1b4a60++){io[_0x3253('0x1c')](_0x3253('0x1d'),{'id':_0x5b22d6[_0x1b4a60],'closed':!![]});}}})[_0x3253('0x1e')](function(_0x1d5a5f){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x1d5a5f?util['inspect'](_0x1d5a5f,{'showHidden':![],'depth':null}):'');});}exports[_0x3253('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x865d=['../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','minutes','info','join','update','system','timeout','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment'];(function(_0x119442,_0x1452f0){var _0x3503c8=function(_0x1b36f9){while(--_0x1b36f9){_0x119442['push'](_0x119442['shift']());}};_0x3503c8(++_0x1452f0);}(_0x865d,0x175));var _0xd865=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x865d[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xd865('0x0'));var moment=require('moment');var Redis=require(_0xd865('0x1'));var util=require(_0xd865('0x2'));var config=require(_0xd865('0x3'));var db=require(_0xd865('0x4'))['db'];var logger=require(_0xd865('0x5'))(_0xd865('0x6'));config[_0xd865('0x7')]=_[_0xd865('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd865('0x9'))(new Redis(config[_0xd865('0x7')]));function closeInteractions(){var _0x32bea5=0x0;var _0x4e2c7d=[];return db[_0xd865('0xa')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd865('0xb')](function(_0xa0d7b1){_0x32bea5=_0xa0d7b1['chatTimeout'];if(_0x32bea5){return db[_0xd865('0xc')][_0xd865('0xd')]({'raw':!![],'attributes':['id',_0xd865('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd865('0xf')](_0xa0d7b1[_0xd865('0x10')],_0xd865('0x11'))}}});}else{return[];}})[_0xd865('0xb')](function(_0x5dec93){if(_0x5dec93&&_0x5dec93['length']){_0x4e2c7d=_['map'](_0x5dec93||[],'id');logger[_0xd865('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4e2c7d[_0xd865('0x13')]());return db[_0xd865('0xc')][_0xd865('0x14')]({'closeReason':_0xd865('0x15'),'disposition':_0xd865('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4e2c7d}});}})[_0xd865('0xb')](function(){if(_0x4e2c7d&&_0x4e2c7d[_0xd865('0x17')]){logger[_0xd865('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x4e2c7d[_0xd865('0x13')]());for(var _0x5ee619=0x0;_0x5ee619<_0x4e2c7d[_0xd865('0x17')];_0x5ee619++){io['emit'](_0xd865('0x18'),{'id':_0x4e2c7d[_0x5ee619],'closed':!![]});}}})[_0xd865('0x19')](function(_0x313723){logger[_0xd865('0x1a')](_0xd865('0x1b'),_0x313723?util['inspect'](_0x313723,{'showHidden':![],'depth':null}):'');});}exports[_0xd865('0x1c')]=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 d3d5dc8..b9b66ae 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 _0x0480=['YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','name','MailServerOut','keys','jobs','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','resolve','run\x20job','startAt','endAt','add','start','add\x20cron','stop\x20cron','cron','active','update','update\x20cron','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','MailAccount','Smtp','service','host','secure','authentication','auth','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','data','isNil','email','subtractUnit\x20null\x20or\x20undefined','subtract'];(function(_0x1d56f2,_0x5776b0){var _0x15edbe=function(_0x42db8b){while(--_0x42db8b){_0x1d56f2['push'](_0x1d56f2['shift']());}};_0x15edbe(++_0x5776b0);}(_0x0480,0x175));var _0x0048=function(_0x1a4194,_0x1c1b15){_0x1a4194=_0x1a4194-0x0;var _0x112a86=_0x0480[_0x1a4194];return _0x112a86;};'use strict';var fs=require('fs');var util=require(_0x0048('0x0'));var path=require('path');var _=require(_0x0048('0x1'));var moment=require(_0x0048('0x2'));var CronJobManager=require(_0x0048('0x3'));var jayson=require(_0x0048('0x4'));var BPromise=require(_0x0048('0x5'));var logger=require(_0x0048('0x6'))(_0x0048('0x7'));var db=require(_0x0048('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0048('0x9'));var client=jayson['client'][_0x0048('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x36a935,_0x1a9502){return function(){logger[_0x0048('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x36a935['email']);var _0x3040e6=!![];var _0x389016={'tls':{'rejectUnauthorized':![]}};if(_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['service']){_0x389016['service']=_0x36a935['MailAccount'][_0x0048('0xd')][_0x0048('0xe')];}else{_0x389016['host']=_0x36a935[_0x0048('0xc')]['Smtp'][_0x0048('0xf')];_0x389016['port']=_0x36a935['MailAccount'][_0x0048('0xd')]['port'];_0x389016[_0x0048('0x10')]=_0x36a935[_0x0048('0xc')][_0x0048('0xd')][_0x0048('0x10')];}if(_0x36a935[_0x0048('0xc')]['Smtp'][_0x0048('0x11')]){_0x389016[_0x0048('0x12')]={'user':_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['user'],'pass':_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['pass']};}var _0x5f3bcc={'account':_0x389016,'message':{'from':util[_0x0048('0x13')](_0x0048('0x14'),_0x36a935[_0x0048('0xc')]['name'],_0x36a935[_0x0048('0xc')]['email']||_0x36a935[_0x0048('0xc')][_0x0048('0xd')]['user']),'to':_0x36a935['email'],'cc':_0x36a935['cc'],'bcc':_0x36a935[_0x0048('0x15')],'subject':util[_0x0048('0x13')](_0x0048('0x16'),_0x1a9502['name'],_0x36a935[_0x0048('0x17')],_0x36a935[_0x0048('0x18')])}};var _0x333529=path[_0x0048('0x19')](__dirname,'../../files/reports');var _0x39bc04=_0x1a9502[_0x0048('0x1a')];var _0xeb1c9e=util['format'](_0x0048('0x1b'),path[_0x0048('0x1c')](_0x1a9502[_0x0048('0x1a')],path[_0x0048('0x1d')](_0x1a9502['savename'])),_0x0048('0x1e'));var _0x4cc62e=path[_0x0048('0x19')](_0x333529,_0x39bc04);var _0x124ea7=path['join'](_0x333529,_0xeb1c9e);if(fs[_0x0048('0x1f')](_0x4cc62e)){_0x1a9502[_0x0048('0x20')]=_0x0048('0x21');_0x5f3bcc[_0x0048('0x22')][_0x0048('0x23')]=[{'filename':_0x39bc04,'path':_0x4cc62e}];_0x5f3bcc['message'][_0x0048('0x24')]=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['stringify'](_0x1a9502,null,0x2));}else if(fs[_0x0048('0x1f')](_0x124ea7)){_0x1a9502['status']='Sent';_0x5f3bcc[_0x0048('0x22')][_0x0048('0x23')]=[{'filename':_0xeb1c9e,'path':_0x124ea7}];}else{_0x5f3bcc['message'][_0x0048('0x24')]=_0x0048('0x25');if(!_0x36a935['sendIfEmpty']){_0x3040e6=![];logger[_0x0048('0xb')](_0x0048('0x26'));}}if(_0x3040e6){return client[_0x0048('0x27')](_0x0048('0x28'),_0x5f3bcc)[_0x0048('0x29')](function(_0x368914){if(_0x368914['error']){return logger[_0x0048('0x2a')](_0x0048('0x2b'),JSON['stringify'](_0x368914));}return logger['info'](_0x0048('0x2c'));})[_0x0048('0x2d')](function(_0x2f2d0c){return logger[_0x0048('0x2a')](_0x0048('0x2b'),JSON[_0x0048('0x2e')](_0x2f2d0c));});}};}function handleError(){return function(_0x1c1ffe){return logger[_0x0048('0x2a')](JSON['stringify'](_0x1c1ffe));};}function handleResult(_0x1ccf4d){return function(_0x2327c1){logger[_0x0048('0xb')](_0x0048('0x2f'),JSON[_0x0048('0x2e')](_0x2327c1));if(_0x1ccf4d[_0x0048('0xc')]&&_0x1ccf4d['MailAccount'][_0x0048('0xd')]&&!_[_0x0048('0x30')](_0x1ccf4d[_0x0048('0x31')])){setTimeout(handleSendEmail(_0x1ccf4d,_0x2327c1),0x3c*0x3e8);}};}function handleJob(_0x291298){return function(){try{if(_[_0x0048('0x30')](_0x291298[_0x0048('0x17')])){return logger[_0x0048('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0048('0x30')](_0x291298['subtractUnit'])){return logger[_0x0048('0xb')](_0x0048('0x32'));}var _0xd48842={'startDate':moment()[_0x0048('0x33')](_0x291298[_0x0048('0x17')],_0x291298[_0x0048('0x18')])['format'](_0x0048('0x34')),'endDate':moment()[_0x0048('0x13')](_0x0048('0x34')),'type':_0x0048('0x35'),'output':_0x291298['output'],'name':_0x291298['name']};if(!_[_0x0048('0x30')](_0x291298[_0x0048('0x36')])){logger[_0x0048('0xb')](_0x0048('0x37'),_0x291298[_0x0048('0x36')]);return analyticDefaultReportController[_0x0048('0x38')]({'id':_0x291298[_0x0048('0x36')]},_0xd48842)[_0x0048('0x29')](handleResult(_0x291298))[_0x0048('0x2d')](handleError());}if(!_[_0x0048('0x30')](_0x291298[_0x0048('0x39')])){logger[_0x0048('0xb')]('exec\x20custom\x20report\x20id:%s',_0x291298['CustomReportId']);return analyticCustomReportController[_0x0048('0x38')]({'id':_0x291298['CustomReportId']},_0xd48842)[_0x0048('0x29')](handleResult(_0x291298))[_0x0048('0x2d')](handleError());}}catch(_0x3b45e1){logger['error'](JSON[_0x0048('0x2e')](_0x3b45e1));}return logger[_0x0048('0xb')](_0x0048('0x3a'));};}function getJobs(_0x570b45){var _0x4f16cc={};if(_0x570b45){_0x4f16cc['id']=_0x570b45;}return db[_0x0048('0x3b')]['findAll']({'where':_0x4f16cc,'include':[{'model':db[_0x0048('0xc')],'attributes':['id',_0x0048('0x3c'),_0x0048('0x31')],'include':[{'model':db[_0x0048('0x3d')],'as':_0x0048('0xd')}]}]})[_0x0048('0x29')](function(_0x3944b6){var _0x318260=_[_0x0048('0x3e')](manager[_0x0048('0x3f')]);var _0xe98f42=_['map'](_0x3944b6,function(_0xe84835){return _0xe84835['id'][_0x0048('0x40')]();});var _0x161016=_[_0x0048('0x41')](_0x3944b6,function(_0x54fe9f){return _0x54fe9f['id'][_0x0048('0x40')]();});var _0x143c6d=_0x570b45?_0xe98f42:_['difference'](_0xe98f42,_0x318260);var _0x12bb15=_['intersection'](_0xe98f42,_0x318260);var _0x22753d=_[_0x0048('0x42')](_0x318260,_0xe98f42);var _0x8e8229;var _0x2f0872;for(_0x8e8229=0x0;_0x8e8229<_0x22753d['length']&&!_0x570b45;_0x8e8229+=0x1){_0x2f0872=_0x22753d[_0x8e8229][_0x0048('0x40')]();if(manager[_0x0048('0x43')](_0x2f0872)){manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x46'),_0x2f0872);}}logger['info'](_0x0048('0x47'),JSON[_0x0048('0x2e')](_0x143c6d));for(_0x8e8229=0x0;_0x8e8229<_0x143c6d[_0x0048('0x48')];_0x8e8229+=0x1){_0x2f0872=_0x143c6d[_0x8e8229][_0x0048('0x40')]();logger[_0x0048('0xb')]('index',_0x2f0872);if(_0x570b45){logger[_0x0048('0xb')]('my\x20id',_0x570b45);logger[_0x0048('0xb')](JSON[_0x0048('0x2e')](_0x161016[_0x2f0872]));BPromise[_0x0048('0x49')]()[_0x0048('0x29')](handleJob(_0x161016[_0x2f0872]));logger[_0x0048('0xb')](_0x0048('0x4a'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872]['cron']);}else if(_0x161016[_0x2f0872]['cron']&&_0x161016[_0x2f0872]['active']&&moment()['isBetween'](_0x161016[_0x2f0872][_0x0048('0x4b')],_0x161016[_0x2f0872][_0x0048('0x4c')])){manager[_0x0048('0x4d')](_0x2f0872,_0x161016[_0x2f0872]['cron'],handleJob(_0x161016[_0x2f0872]));manager[_0x0048('0x4e')](_0x2f0872);logger['info'](_0x0048('0x4f'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872]['cron']);}else if(manager[_0x0048('0x43')](_0x2f0872)){manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x50'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872][_0x0048('0x51')]);}}for(_0x8e8229=0x0,_0x2f0872;_0x8e8229<_0x12bb15[_0x0048('0x48')]&&!_0x570b45;_0x8e8229+=0x1){_0x2f0872=_0x12bb15[_0x8e8229][_0x0048('0x40')]();if(manager[_0x0048('0x43')](_0x2f0872)){if(_0x161016[_0x2f0872][_0x0048('0x51')]&&_0x161016[_0x2f0872][_0x0048('0x52')]&&moment()['isBetween'](_0x161016[_0x2f0872][_0x0048('0x4b')],_0x161016[_0x2f0872][_0x0048('0x4c')])){manager[_0x0048('0x53')](_0x2f0872,_0x161016[_0x2f0872]['cron'],handleJob(_0x161016[_0x2f0872]));logger[_0x0048('0xb')](_0x0048('0x54'),_0x161016[_0x2f0872][_0x0048('0x3c')],_0x161016[_0x2f0872][_0x0048('0x51')]);}else{manager[_0x0048('0x44')](_0x2f0872);manager[_0x0048('0x45')](_0x2f0872);logger[_0x0048('0xb')](_0x0048('0x50'),_0x161016[_0x2f0872]['name'],_0x161016[_0x2f0872][_0x0048('0x51')]);}}}})[_0x0048('0x2d')](function(_0x1fb36d){logger[_0x0048('0x2a')](JSON[_0x0048('0x2e')](_0x1fb36d));});}exports['run']=function(_0xfdaa8f){return getJobs(_0xfdaa8f);};exports[_0x0048('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7759=['request','SendMail','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','endAt','start','deleteJob','stop\x20cron','startAt','update','update\x20cron','run','util','path','moment','cron-job-manager','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent'];(function(_0x1d8d1a,_0x41fe02){var _0x309480=function(_0x1ff7c3){while(--_0x1ff7c3){_0x1d8d1a['push'](_0x1d8d1a['shift']());}};_0x309480(++_0x41fe02);}(_0x7759,0xda));var _0x9775=function(_0x57a825,_0x4de9d7){_0x57a825=_0x57a825-0x0;var _0x56c597=_0x7759[_0x57a825];return _0x56c597;};'use strict';var fs=require('fs');var util=require(_0x9775('0x0'));var path=require(_0x9775('0x1'));var _=require('lodash');var moment=require(_0x9775('0x2'));var CronJobManager=require(_0x9775('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x9775('0x4'))('schedule');var db=require(_0x9775('0x5'))['db'];var analyticCustomReportController=require(_0x9775('0x6'));var analyticDefaultReportController=require(_0x9775('0x7'));var client=jayson[_0x9775('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x283893,_0x47656c){return function(){logger[_0x9775('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x283893[_0x9775('0xa')]);var _0xcadc31=!![];var _0xb13ca2={'tls':{'rejectUnauthorized':![]}};if(_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0xc')]){_0xb13ca2[_0x9775('0xc')]=_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0xc')];}else{_0xb13ca2['host']=_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0xe')];_0xb13ca2['port']=_0x283893['MailAccount'][_0x9775('0xd')][_0x9775('0xf')];_0xb13ca2[_0x9775('0x10')]=_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x10')];}if(_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x11')]){_0xb13ca2[_0x9775('0x12')]={'user':_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0x13')],'pass':_0x283893['MailAccount'][_0x9775('0xd')][_0x9775('0x14')]};}var _0x343371={'account':_0xb13ca2,'message':{'from':util['format'](_0x9775('0x15'),_0x283893[_0x9775('0xb')][_0x9775('0x16')],_0x283893[_0x9775('0xb')]['email']||_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x13')]),'to':_0x283893[_0x9775('0xa')],'cc':_0x283893['cc'],'bcc':_0x283893['bcc'],'subject':util[_0x9775('0x17')](_0x9775('0x18'),_0x47656c[_0x9775('0x16')],_0x283893[_0x9775('0x19')],_0x283893[_0x9775('0x1a')])}};var _0x4ad1e0=path[_0x9775('0x1b')](__dirname,_0x9775('0x1c'));var _0x439e4a=_0x47656c[_0x9775('0x1d')];var _0x21f39d=util[_0x9775('0x17')](_0x9775('0x1e'),path[_0x9775('0x1f')](_0x47656c[_0x9775('0x1d')],path[_0x9775('0x20')](_0x47656c[_0x9775('0x1d')])),'zip');var _0x25dbcc=path[_0x9775('0x1b')](_0x4ad1e0,_0x439e4a);var _0x20a12f=path['join'](_0x4ad1e0,_0x21f39d);if(fs[_0x9775('0x21')](_0x25dbcc)){_0x47656c[_0x9775('0x22')]=_0x9775('0x23');_0x343371[_0x9775('0x24')]['attachments']=[{'filename':_0x439e4a,'path':_0x25dbcc}];_0x343371['message'][_0x9775('0x25')]=util[_0x9775('0x17')](_0x9775('0x26'),JSON[_0x9775('0x27')](_0x47656c,null,0x2));}else if(fs['existsSync'](_0x20a12f)){_0x47656c[_0x9775('0x22')]=_0x9775('0x23');_0x343371['message']['attachments']=[{'filename':_0x21f39d,'path':_0x20a12f}];}else{_0x343371[_0x9775('0x24')][_0x9775('0x25')]=_0x9775('0x28');if(!_0x283893[_0x9775('0x29')]){_0xcadc31=![];logger['info'](_0x9775('0x2a'));}}if(_0xcadc31){return client[_0x9775('0x2b')](_0x9775('0x2c'),_0x343371)['then'](function(_0x4fc50d){if(_0x4fc50d[_0x9775('0x2d')]){return logger[_0x9775('0x2d')](_0x9775('0x2e'),JSON[_0x9775('0x27')](_0x4fc50d));}return logger[_0x9775('0x9')]('email\x20sent');})[_0x9775('0x2f')](function(_0x27311b){return logger[_0x9775('0x2d')](_0x9775('0x2e'),JSON['stringify'](_0x27311b));});}};}function handleError(){return function(_0x1b4b2d){return logger[_0x9775('0x2d')](JSON[_0x9775('0x27')](_0x1b4b2d));};}function handleResult(_0x3c2155){return function(_0x51c83d){logger['info']('data',JSON[_0x9775('0x27')](_0x51c83d));if(_0x3c2155[_0x9775('0xb')]&&_0x3c2155[_0x9775('0xb')][_0x9775('0xd')]&&!_['isNil'](_0x3c2155[_0x9775('0xa')])){setTimeout(handleSendEmail(_0x3c2155,_0x51c83d),0x3c*0x3e8);}};}function handleJob(_0x569759){return function(){try{if(_[_0x9775('0x30')](_0x569759[_0x9775('0x19')])){return logger[_0x9775('0x9')](_0x9775('0x31'));}if(_[_0x9775('0x30')](_0x569759[_0x9775('0x1a')])){return logger[_0x9775('0x9')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5c978d={'startDate':moment()[_0x9775('0x32')](_0x569759['subtractNumber'],_0x569759['subtractUnit'])[_0x9775('0x17')](_0x9775('0x33')),'endDate':moment()['format'](_0x9775('0x33')),'type':_0x9775('0x34'),'output':_0x569759['output'],'name':_0x569759[_0x9775('0x16')]};if(!_[_0x9775('0x30')](_0x569759['DefaultReportId'])){logger['info'](_0x9775('0x35'),_0x569759[_0x9775('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x569759[_0x9775('0x36')]},_0x5c978d)[_0x9775('0x37')](handleResult(_0x569759))[_0x9775('0x2f')](handleError());}if(!_['isNil'](_0x569759[_0x9775('0x38')])){logger['info'](_0x9775('0x39'),_0x569759[_0x9775('0x38')]);return analyticCustomReportController[_0x9775('0x3a')]({'id':_0x569759[_0x9775('0x38')]},_0x5c978d)[_0x9775('0x37')](handleResult(_0x569759))['catch'](handleError());}}catch(_0x3186c1){logger[_0x9775('0x2d')](JSON['stringify'](_0x3186c1));}return logger[_0x9775('0x9')](_0x9775('0x3b'));};}function getJobs(_0x31d497){var _0x175727={};if(_0x31d497){_0x175727['id']=_0x31d497;}return db['Schedule'][_0x9775('0x3c')]({'where':_0x175727,'include':[{'model':db['MailAccount'],'attributes':['id',_0x9775('0x16'),'email'],'include':[{'model':db[_0x9775('0x3d')],'as':'Smtp'}]}]})[_0x9775('0x37')](function(_0x410ffe){var _0x4d9e7a=_['keys'](manager[_0x9775('0x3e')]);var _0x1cbfa3=_[_0x9775('0x3f')](_0x410ffe,function(_0x37f17b){return _0x37f17b['id'][_0x9775('0x40')]();});var _0x1209cd=_[_0x9775('0x41')](_0x410ffe,function(_0x479e8d){return _0x479e8d['id'][_0x9775('0x40')]();});var _0x8eab=_0x31d497?_0x1cbfa3:_[_0x9775('0x42')](_0x1cbfa3,_0x4d9e7a);var _0x4fafe8=_[_0x9775('0x43')](_0x1cbfa3,_0x4d9e7a);var _0x4cec2e=_['difference'](_0x4d9e7a,_0x1cbfa3);var _0x17edad;var _0x227f20;for(_0x17edad=0x0;_0x17edad<_0x4cec2e[_0x9775('0x44')]&&!_0x31d497;_0x17edad+=0x1){_0x227f20=_0x4cec2e[_0x17edad][_0x9775('0x40')]();if(manager[_0x9775('0x45')](_0x227f20)){manager[_0x9775('0x46')](_0x227f20);manager['deleteJob'](_0x227f20);logger[_0x9775('0x9')](_0x9775('0x47'),_0x227f20);}}logger['info'](_0x9775('0x48'),JSON[_0x9775('0x27')](_0x8eab));for(_0x17edad=0x0;_0x17edad<_0x8eab['length'];_0x17edad+=0x1){_0x227f20=_0x8eab[_0x17edad][_0x9775('0x40')]();logger[_0x9775('0x9')](_0x9775('0x49'),_0x227f20);if(_0x31d497){logger[_0x9775('0x9')](_0x9775('0x4a'),_0x31d497);logger['info'](JSON[_0x9775('0x27')](_0x1209cd[_0x227f20]));BPromise[_0x9775('0x4b')]()['then'](handleJob(_0x1209cd[_0x227f20]));logger[_0x9775('0x9')]('run\x20job',_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else if(_0x1209cd[_0x227f20][_0x9775('0x4c')]&&_0x1209cd[_0x227f20][_0x9775('0x4d')]&&moment()[_0x9775('0x4e')](_0x1209cd[_0x227f20]['startAt'],_0x1209cd[_0x227f20][_0x9775('0x4f')])){manager['add'](_0x227f20,_0x1209cd[_0x227f20][_0x9775('0x4c')],handleJob(_0x1209cd[_0x227f20]));manager[_0x9775('0x50')](_0x227f20);logger[_0x9775('0x9')]('add\x20cron',_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else if(manager[_0x9775('0x45')](_0x227f20)){manager[_0x9775('0x46')](_0x227f20);manager[_0x9775('0x51')](_0x227f20);logger['info'](_0x9775('0x52'),_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}}for(_0x17edad=0x0,_0x227f20;_0x17edad<_0x4fafe8['length']&&!_0x31d497;_0x17edad+=0x1){_0x227f20=_0x4fafe8[_0x17edad][_0x9775('0x40')]();if(manager['exists'](_0x227f20)){if(_0x1209cd[_0x227f20][_0x9775('0x4c')]&&_0x1209cd[_0x227f20][_0x9775('0x4d')]&&moment()[_0x9775('0x4e')](_0x1209cd[_0x227f20][_0x9775('0x53')],_0x1209cd[_0x227f20][_0x9775('0x4f')])){manager[_0x9775('0x54')](_0x227f20,_0x1209cd[_0x227f20][_0x9775('0x4c')],handleJob(_0x1209cd[_0x227f20]));logger['info'](_0x9775('0x55'),_0x1209cd[_0x227f20]['name'],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else{manager['stop'](_0x227f20);manager[_0x9775('0x51')](_0x227f20);logger[_0x9775('0x9')](_0x9775('0x52'),_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20]['cron']);}}}})['catch'](function(_0x4af39e){logger[_0x9775('0x2d')](JSON['stringify'](_0x4af39e));});}exports[_0x9775('0x56')]=function(_0x3cad51){return getJobs(_0x3cad51);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6d318a7..664ac3d 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 _0x5aad=['bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sequelize','Sentiment\x20Analysis\x20not\x20configured','update','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','lodash','aws-sdk','request-promise','util'];(function(_0x42ddf8,_0x264fc9){var _0x558152=function(_0x174ea2){while(--_0x174ea2){_0x42ddf8['push'](_0x42ddf8['shift']());}};_0x558152(++_0x264fc9);}(_0x5aad,0x1f4));var _0xd5aa=function(_0x181fac,_0x3b86b5){_0x181fac=_0x181fac-0x0;var _0x1edaa6=_0x5aad[_0x181fac];return _0x1edaa6;};var _=require(_0xd5aa('0x0'));var AWS=require(_0xd5aa('0x1'));var rp=require(_0xd5aa('0x2'));var util=require(_0xd5aa('0x3'));var BPromise=require(_0xd5aa('0x4'));var db=require(_0xd5aa('0x5'))['db'];var logger=require('../../config/logger')(_0xd5aa('0x6'));function getTranscriptionJob(_0x30cc8d,_0x3a9ec0,_0x3d98dc,_0x27c182){return new Promise(function(_0xbdd92f,_0x1d3274){var _0x4965a4=new AWS[(_0xd5aa('0x7'))]({'accessKeyId':_0x3a9ec0,'secretAccessKey':_0x30cc8d,'region':_0x3d98dc});_0x4965a4['getTranscriptionJob']({'TranscriptionJobName':_0x27c182},function(_0x377867,_0x31a401){if(_0x377867){return _0x1d3274(_0x377867);}else{return _0xbdd92f(_0x31a401);}});});}function sentiment(_0x41044b,_0x1c9505,_0x5bbddf,_0x2586e9,_0x3b9103){return new Promise(function(_0x59d599,_0xd99672){var _0x342c0c=new AWS[(_0xd5aa('0x8'))]({'accessKeyId':_0x1c9505,'secretAccessKey':_0x41044b,'region':_0x5bbddf});_0x342c0c[_0xd5aa('0x9')]({'Text':_0x2586e9,'LanguageCode':_0x3b9103['substring'](0x0,0x2)},function(_0x351906,_0x1e1b9a){if(_0x351906){return _0xd99672(_0x351906);}else{return _0x59d599(_0x1e1b9a);}});});}function checkTranscribeJob(_0x3d21ae,_0x7c4041,_0x38da3e){var _0x4f9a9f;return new BPromise(function(_0x500cf6,_0x2a4530){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0xc'),_0x3d21ae['id'],_0x3d21ae[_0xd5aa('0xd')]));return getTranscriptionJob(_0x38da3e['data1'],_0x38da3e['data2'],_0x7c4041[_0xd5aa('0xe')],_0x3d21ae[_0xd5aa('0xd')])[_0xd5aa('0xf')](function(_0x4817d5){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x10'),_0x3d21ae['id'],_0x3d21ae[_0xd5aa('0xd')],_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x12')]));if(!_0x3d21ae[_0xd5aa('0x13')]){switch(_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x12')]){case _0xd5aa('0x14'):var _0x403cd0={'transcribeStatus':_0x4817d5[_0xd5aa('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4817d5['TranscriptionJob']['Transcript'][_0xd5aa('0x15')]};logger['info'](util[_0xd5aa('0xb')](_0xd5aa('0x16'),_0x3d21ae['id']));return rp({'uri':_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x17')][_0xd5aa('0x15')],'json':!![]})[_0xd5aa('0xf')](function(_0xf693a2){logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x18'),_0x3d21ae['id']));if(_0xf693a2&&_0xf693a2[_0xd5aa('0x19')]&&_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')]&&_0xf693a2[_0xd5aa('0x19')]['transcripts']['length']){_0x403cd0['fileText']='';for(var _0x13783f=0x0;_0x13783f<_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')][_0xd5aa('0x1b')];_0x13783f++){_0x403cd0[_0xd5aa('0x13')]+=_0xf693a2[_0xd5aa('0x19')][_0xd5aa('0x1a')][_0x13783f][_0xd5aa('0x1c')]+'';}}return _0x3d21ae['update'](_0x403cd0);})['then'](function(){logger['info'](util[_0xd5aa('0xb')](_0xd5aa('0x1d'),_0x3d21ae['id']));if(!_0x3d21ae[_0xd5aa('0x1e')]){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x1f'));}if(!_0x7c4041[_0xd5aa('0x20')]||!_0x7c4041[_0xd5aa('0x21')]||!_0x7c4041[_0xd5aa('0x22')]||!_0x7c4041[_0xd5aa('0x23')]||!_0x7c4041[_0xd5aa('0x24')]){throw new db['Sequelize'][(_0xd5aa('0x25'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x403cd0[_0xd5aa('0x13')]){throw new Error(_0xd5aa('0x26'));}if(_0x7c4041[_0xd5aa('0x21')]===_0x38da3e['id']){return _0x38da3e;}else{return db[_0xd5aa('0x27')][_0xd5aa('0x28')]({'where':{'id':_settings[_0xd5aa('0x21')]}});}})[_0xd5aa('0xf')](function(_0x5b58ac){if(!_0x5b58ac){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x29'));}if(!_0x5b58ac[_0xd5aa('0x2a')]||!_0x5b58ac[_0xd5aa('0x2b')]){throw new db['Sequelize']['ValidationError'](_0xd5aa('0x2c'));}_0x4f9a9f=_0x5b58ac;logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2d'),_0x3d21ae['id']));return sentiment(_0x4f9a9f[_0xd5aa('0x2a')],_0x4f9a9f[_0xd5aa('0x2b')],_0x7c4041[_0xd5aa('0x22')],_0x403cd0[_0xd5aa('0x13')],_0x7c4041['language']);})[_0xd5aa('0xf')](function(_0xe857a3){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2e'),_0x3d21ae['id']));return _0x3d21ae['update']({'sentiment':_0xe857a3[_0xd5aa('0x2f')],'sPositive':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x31')],'sNegative':_0xe857a3['SentimentScore'][_0xd5aa('0x32')],'sMixed':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x33')],'sNeutral':_0xe857a3[_0xd5aa('0x30')][_0xd5aa('0x34')]});})[_0xd5aa('0xf')](function(){logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});case _0xd5aa('0x35'):return _0x3d21ae['update']({'transcribeStatus':'FAILED','failureReason':_0x4817d5[_0xd5aa('0x11')][_0xd5aa('0x36')]})[_0xd5aa('0xf')](function(){logger['info'](util['format'](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});default:logger[_0xd5aa('0xa')](util['format'](_0xd5aa('0x37'),_0x3d21ae['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x3d21ae['tempSentiment']){throw new db[(_0xd5aa('0x38'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x7c4041[_0xd5aa('0x20')]||!_0x7c4041[_0xd5aa('0x21')]||!_0x7c4041[_0xd5aa('0x22')]||!_0x7c4041[_0xd5aa('0x23')]||!_0x7c4041['bucket']){throw new db['Sequelize'][(_0xd5aa('0x25'))](_0xd5aa('0x39'));}if(!_0x3d21ae[_0xd5aa('0x13')]){throw new Error(_0xd5aa('0x26'));}if(_0x7c4041[_0xd5aa('0x21')]===_0x38da3e['id']){return _0x38da3e;}else{return db[_0xd5aa('0x27')]['findOne']({'where':{'id':_settings[_0xd5aa('0x21')]}});}})[_0xd5aa('0xf')](function(_0x5d0849){if(!_0x5d0849){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x29'));}if(!_0x5d0849[_0xd5aa('0x2a')]||!_0x5d0849[_0xd5aa('0x2b')]){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x2c'));}_0x4f9a9f=_0x5d0849;logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3d21ae['id']));return sentiment(_0x4f9a9f[_0xd5aa('0x2a')],_0x4f9a9f['data2'],_0x7c4041[_0xd5aa('0x22')],_0x3d21ae[_0xd5aa('0x13')],_0x7c4041[_0xd5aa('0x23')]);})['then'](function(_0x37eceb){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x2e'),_0x3d21ae['id']));return _0x3d21ae[_0xd5aa('0x3a')]({'sentiment':_0x37eceb['Sentiment'],'sPositive':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x31')],'sNegative':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x32')],'sMixed':_0x37eceb['SentimentScore'][_0xd5aa('0x33')],'sNeutral':_0x37eceb[_0xd5aa('0x30')][_0xd5aa('0x34')],'transcribeStatus':_0xd5aa('0x14')});})['then'](function(){logger[_0xd5aa('0xa')](util[_0xd5aa('0xb')](_0xd5aa('0x1d'),_0x3d21ae['id']));_0x500cf6();});}})[_0xd5aa('0x3b')](function(_0x1e4f30){if(_0x1e4f30){if(!_0x1e4f30[_0xd5aa('0x3c')]||_0x1e4f30[_0xd5aa('0x3c')]!==_0xd5aa('0x3d')){logger[_0xd5aa('0x3e')](util['format'](_0xd5aa('0x3f'),_0x3d21ae['id']),util[_0xd5aa('0x40')](_0x1e4f30,{'showHidden':![],'depth':null}));}}_0x500cf6();});});}function checkTranscribe(){var _0x82d8ec;var _0x76ee1;var _0x3be055;return db[_0xd5aa('0x41')][_0xd5aa('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xd5aa('0xf')](function(_0xbf3120){if(!_0xbf3120||!_0xbf3120['length']){throw new db['Sequelize'][(_0xd5aa('0x25'))]('No\x20transcribe\x20job\x20to\x20check');}_0x82d8ec=_0xbf3120;return db['Setting'][_0xd5aa('0x28')]({'where':{'id':0x1}});})[_0xd5aa('0xf')](function(_0x956e5a){if(!_0x956e5a){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x43'));}_0x76ee1=_0x956e5a;if(!_0x76ee1[_0xd5aa('0x6')]||!_0x76ee1[_0xd5aa('0x44')]||!_0x76ee1[_0xd5aa('0xe')]||!_0x76ee1[_0xd5aa('0x23')]||!_0x76ee1['bucket']){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x45'));}return db[_0xd5aa('0x27')]['findOne']({'where':{'id':_0x76ee1['transcribeAccountId']}});})[_0xd5aa('0xf')](function(_0x3caabf){if(!_0x3caabf){throw new db['Sequelize'][(_0xd5aa('0x25'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3caabf[_0xd5aa('0x2a')]||!_0x3caabf[_0xd5aa('0x2b')]){throw new db[(_0xd5aa('0x38'))][(_0xd5aa('0x25'))](_0xd5aa('0x2c'));}_0x3be055=_0x3caabf;var _0x564471=[];_0x82d8ec['forEach'](function(_0x330f5b){_0x564471[_0xd5aa('0x46')](checkTranscribeJob(_0x330f5b,_0x76ee1,_0x3be055));});return BPromise[_0xd5aa('0x47')](_0x564471);})[_0xd5aa('0x3b')](function(_0x4ef9fb){if(_0x4ef9fb){if(!_0x4ef9fb[_0xd5aa('0x3c')]||_0x4ef9fb[_0xd5aa('0x3c')]!=='SequelizeValidationError'){logger[_0xd5aa('0x3e')](util['inspect'](_0x4ef9fb,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2d8c=['FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','bucket','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','Negative','Mixed','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','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','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','Sequelize','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Neutral','FAILED'];(function(_0x93fb44,_0x1ff4e6){var _0x575c12=function(_0x2f01fe){while(--_0x2f01fe){_0x93fb44['push'](_0x93fb44['shift']());}};_0x575c12(++_0x1ff4e6);}(_0x2d8c,0xf6));var _0xc2d8=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x2d8c[_0x1f36bb];return _0xaf97fa;};var _=require(_0xc2d8('0x0'));var AWS=require('aws-sdk');var rp=require(_0xc2d8('0x1'));var util=require(_0xc2d8('0x2'));var BPromise=require(_0xc2d8('0x3'));var db=require(_0xc2d8('0x4'))['db'];var logger=require('../../config/logger')(_0xc2d8('0x5'));function getTranscriptionJob(_0x3636d7,_0x5be562,_0x33b113,_0x44b794){return new Promise(function(_0x13c26b,_0x3eb85e){var _0x2ecf71=new AWS[(_0xc2d8('0x6'))]({'accessKeyId':_0x5be562,'secretAccessKey':_0x3636d7,'region':_0x33b113});_0x2ecf71['getTranscriptionJob']({'TranscriptionJobName':_0x44b794},function(_0x55aa27,_0x4a3ba6){if(_0x55aa27){return _0x3eb85e(_0x55aa27);}else{return _0x13c26b(_0x4a3ba6);}});});}function sentiment(_0x1082f6,_0x650315,_0x37e3dc,_0x1a02ba,_0x277940){return new Promise(function(_0xe39a09,_0x2d3dc2){var _0x65b7e7=new AWS['Comprehend']({'accessKeyId':_0x650315,'secretAccessKey':_0x1082f6,'region':_0x37e3dc});_0x65b7e7[_0xc2d8('0x7')]({'Text':_0x1a02ba,'LanguageCode':_0x277940[_0xc2d8('0x8')](0x0,0x2)},function(_0x34fa85,_0x5a0278){if(_0x34fa85){return _0x2d3dc2(_0x34fa85);}else{return _0xe39a09(_0x5a0278);}});});}function checkTranscribeJob(_0x4815ff,_0x36c365,_0x2d9cc5){var _0x31ccc6;return new BPromise(function(_0x25eb61,_0x31f842){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0xb'),_0x4815ff['id'],_0x4815ff[_0xc2d8('0xc')]));return getTranscriptionJob(_0x2d9cc5[_0xc2d8('0xd')],_0x2d9cc5['data2'],_0x36c365[_0xc2d8('0xe')],_0x4815ff[_0xc2d8('0xc')])[_0xc2d8('0xf')](function(_0x2f7b68){logger['info'](util[_0xc2d8('0xa')](_0xc2d8('0x10'),_0x4815ff['id'],_0x4815ff[_0xc2d8('0xc')],_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')]));if(!_0x4815ff[_0xc2d8('0x13')]){switch(_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')]){case'COMPLETED':var _0xb18d34={'transcribeStatus':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')],'fileUri':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x14')][_0xc2d8('0x15')]};logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x16'),_0x4815ff['id']));return rp({'uri':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x14')][_0xc2d8('0x15')],'json':!![]})['then'](function(_0x253ce1){logger['info'](util[_0xc2d8('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4815ff['id']));if(_0x253ce1&&_0x253ce1[_0xc2d8('0x17')]&&_0x253ce1[_0xc2d8('0x17')]['transcripts']&&_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')]['length']){_0xb18d34[_0xc2d8('0x13')]='';for(var _0x204ce0=0x0;_0x204ce0<_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')][_0xc2d8('0x19')];_0x204ce0++){_0xb18d34[_0xc2d8('0x13')]+=_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')][_0x204ce0][_0xc2d8('0x1a')]+'';}}return _0x4815ff[_0xc2d8('0x1b')](_0xb18d34);})[_0xc2d8('0xf')](function(){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));if(!_0x4815ff[_0xc2d8('0x1d')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x1f'));}if(!_0x36c365['sentiment']||!_0x36c365['sentimentAccountId']||!_0x36c365[_0xc2d8('0x20')]||!_0x36c365['language']||!_0x36c365['bucket']){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xb18d34['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x36c365[_0xc2d8('0x22')]===_0x2d9cc5['id']){return _0x2d9cc5;}else{return db[_0xc2d8('0x23')][_0xc2d8('0x24')]({'where':{'id':_settings[_0xc2d8('0x22')]}});}})[_0xc2d8('0xf')](function(_0x297653){if(!_0x297653){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x25'));}if(!_0x297653[_0xc2d8('0xd')]||!_0x297653[_0xc2d8('0x26')]){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x31ccc6=_0x297653;logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x27'),_0x4815ff['id']));return sentiment(_0x31ccc6[_0xc2d8('0xd')],_0x31ccc6['data2'],_0x36c365['sentimentRegion'],_0xb18d34[_0xc2d8('0x13')],_0x36c365[_0xc2d8('0x28')]);})[_0xc2d8('0xf')](function(_0x118e1c){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x29'),_0x4815ff['id']));return _0x4815ff[_0xc2d8('0x1b')]({'sentiment':_0x118e1c[_0xc2d8('0x2a')],'sPositive':_0x118e1c[_0xc2d8('0x2b')]['Positive'],'sNegative':_0x118e1c[_0xc2d8('0x2b')]['Negative'],'sMixed':_0x118e1c[_0xc2d8('0x2b')]['Mixed'],'sNeutral':_0x118e1c['SentimentScore'][_0xc2d8('0x2c')]});})['then'](function(){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});case _0xc2d8('0x2d'):return _0x4815ff['update']({'transcribeStatus':'FAILED','failureReason':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x2e')]})[_0xc2d8('0xf')](function(){logger['info'](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});default:logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x2f'),_0x4815ff['id']));break;}}else{return BPromise['resolve']()[_0xc2d8('0xf')](function(){if(!_0x4815ff[_0xc2d8('0x1d')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x1f'));}if(!_0x36c365[_0xc2d8('0x30')]||!_0x36c365[_0xc2d8('0x22')]||!_0x36c365[_0xc2d8('0x20')]||!_0x36c365[_0xc2d8('0x28')]||!_0x36c365[_0xc2d8('0x31')]){throw new db[(_0xc2d8('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4815ff['fileText']){throw new Error(_0xc2d8('0x32'));}if(_0x36c365[_0xc2d8('0x22')]===_0x2d9cc5['id']){return _0x2d9cc5;}else{return db[_0xc2d8('0x23')]['findOne']({'where':{'id':_settings[_0xc2d8('0x22')]}});}})[_0xc2d8('0xf')](function(_0x34a0e9){if(!_0x34a0e9){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x34a0e9['data1']||!_0x34a0e9[_0xc2d8('0x26')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x33'));}_0x31ccc6=_0x34a0e9;logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4815ff['id']));return sentiment(_0x31ccc6[_0xc2d8('0xd')],_0x31ccc6[_0xc2d8('0x26')],_0x36c365[_0xc2d8('0x20')],_0x4815ff['fileText'],_0x36c365[_0xc2d8('0x28')]);})[_0xc2d8('0xf')](function(_0x42c2c7){logger[_0xc2d8('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4815ff['id']));return _0x4815ff['update']({'sentiment':_0x42c2c7['Sentiment'],'sPositive':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x34')],'sNegative':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x35')],'sMixed':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x36')],'sNeutral':_0x42c2c7['SentimentScore']['Neutral'],'transcribeStatus':_0xc2d8('0x37')});})[_0xc2d8('0xf')](function(){logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});}})['catch'](function(_0x2136ab){if(_0x2136ab){if(!_0x2136ab[_0xc2d8('0x38')]||_0x2136ab[_0xc2d8('0x38')]!==_0xc2d8('0x39')){logger[_0xc2d8('0x3a')](util['format'](_0xc2d8('0x3b'),_0x4815ff['id']),util[_0xc2d8('0x3c')](_0x2136ab,{'showHidden':![],'depth':null}));}}_0x25eb61();});});}function checkTranscribe(){var _0xfa7b73;var _0x9291c8;var _0x3fe1be;return db[_0xc2d8('0x3d')][_0xc2d8('0x3e')]({'where':{'transcribeStatus':_0xc2d8('0x3f')}})['then'](function(_0x1e7e71){if(!_0x1e7e71||!_0x1e7e71[_0xc2d8('0x19')]){throw new db[(_0xc2d8('0x21'))]['ValidationError'](_0xc2d8('0x40'));}_0xfa7b73=_0x1e7e71;return db[_0xc2d8('0x41')]['findOne']({'where':{'id':0x1}});})[_0xc2d8('0xf')](function(_0x42f4c0){if(!_0x42f4c0){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x42'));}_0x9291c8=_0x42f4c0;if(!_0x9291c8[_0xc2d8('0x5')]||!_0x9291c8[_0xc2d8('0x43')]||!_0x9291c8[_0xc2d8('0xe')]||!_0x9291c8['language']||!_0x9291c8['bucket']){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x44'));}return db[_0xc2d8('0x23')]['findOne']({'where':{'id':_0x9291c8[_0xc2d8('0x43')]}});})[_0xc2d8('0xf')](function(_0x2f86d2){if(!_0x2f86d2){throw new db[(_0xc2d8('0x21'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2f86d2[_0xc2d8('0xd')]||!_0x2f86d2[_0xc2d8('0x26')]){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x33'));}_0x3fe1be=_0x2f86d2;var _0x1230c9=[];_0xfa7b73[_0xc2d8('0x45')](function(_0x4dded9){_0x1230c9[_0xc2d8('0x46')](checkTranscribeJob(_0x4dded9,_0x9291c8,_0x3fe1be));});return BPromise[_0xc2d8('0x47')](_0x1230c9);})['catch'](function(_0x2878de){if(_0x2878de){if(!_0x2878de[_0xc2d8('0x38')]||_0x2878de['name']!=='SequelizeValidationError'){logger['error'](util[_0xc2d8('0x3c')](_0x2878de,{'showHidden':![],'depth':null}));}}});}exports[_0xc2d8('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 16e9381..c3ad52e 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 _0x4729=['lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','lodash','moment','ioredis','util','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x535a42,_0x2d3281){var _0x33d37b=function(_0x5d0cf9){while(--_0x5d0cf9){_0x535a42['push'](_0x535a42['shift']());}};_0x33d37b(++_0x2d3281);}(_0x4729,0x18f));var _0x9472=function(_0x6168fb,_0x15013f){_0x6168fb=_0x6168fb-0x0;var _0xeb7326=_0x4729[_0x6168fb];return _0xeb7326;};'use strict';var _=require(_0x9472('0x0'));var moment=require(_0x9472('0x1'));var Redis=require(_0x9472('0x2'));var util=require(_0x9472('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9472('0x4'));config[_0x9472('0x5')]=_['defaults'](config[_0x9472('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9472('0x6'))(new Redis(config[_0x9472('0x5')]));function closeInteractions(){var _0x15c68c=[];return db[_0x9472('0x7')][_0x9472('0x8')]({'raw':!![],'attributes':['id',_0x9472('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9472('0xa')](0x18,_0x9472('0xb'))}}})[_0x9472('0xc')](function(_0x3f5273){if(_0x3f5273&&_0x3f5273[_0x9472('0xd')]){_0x15c68c=_['map'](_0x3f5273||[],'id');logger[_0x9472('0xe')](_0x9472('0xf'),_0x15c68c[_0x9472('0x10')]());return db['WhatsappInteraction'][_0x9472('0x11')]({'closeReason':_0x9472('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x9472('0x13'))},{'where':{'id':_0x15c68c}});}})['then'](function(){if(_0x15c68c&&_0x15c68c[_0x9472('0xd')]){logger['info'](_0x9472('0x14'),_0x15c68c[_0x9472('0x10')]());for(var _0x2eda6a=0x0;_0x2eda6a<_0x15c68c['length'];_0x2eda6a++){io['emit'](_0x9472('0x15'),{'id':_0x15c68c[_0x2eda6a],'closed':!![]});}}})[_0x9472('0x16')](function(_0x26aa91){logger[_0x9472('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x26aa91?util['inspect'](_0x26aa91,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x560d=['catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update'];(function(_0x94cd8,_0x80691a){var _0x5572f4=function(_0x2cae9b){while(--_0x2cae9b){_0x94cd8['push'](_0x94cd8['shift']());}};_0x5572f4(++_0x80691a);}(_0x560d,0x170));var _0xd560=function(_0x198ed6,_0x383c04){_0x198ed6=_0x198ed6-0x0;var _0x47ddc5=_0x560d[_0x198ed6];return _0x47ddc5;};'use strict';var _=require(_0xd560('0x0'));var moment=require(_0xd560('0x1'));var Redis=require(_0xd560('0x2'));var util=require('util');var config=require(_0xd560('0x3'));var db=require(_0xd560('0x4'))['db'];var logger=require(_0xd560('0x5'))(_0xd560('0x6'));config[_0xd560('0x7')]=_[_0xd560('0x8')](config[_0xd560('0x7')],{'host':_0xd560('0x9'),'port':0x18eb});var io=require(_0xd560('0xa'))(new Redis(config[_0xd560('0x7')]));function closeInteractions(){var _0x2e5356=[];return db['WhatsappInteraction'][_0xd560('0xb')]({'raw':!![],'attributes':['id',_0xd560('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd560('0xd')](0x18,_0xd560('0xe'))}}})[_0xd560('0xf')](function(_0x1f83bb){if(_0x1f83bb&&_0x1f83bb[_0xd560('0x10')]){_0x2e5356=_[_0xd560('0x11')](_0x1f83bb||[],'id');logger[_0xd560('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2e5356[_0xd560('0x13')]());return db[_0xd560('0x14')]['update']({'closeReason':_0xd560('0x15'),'disposition':_0xd560('0x16'),'closed':!![],'closedAt':moment()[_0xd560('0x17')](_0xd560('0x18'))},{'where':{'id':_0x2e5356}});}})[_0xd560('0xf')](function(){if(_0x2e5356&&_0x2e5356[_0xd560('0x10')]){logger[_0xd560('0x12')](_0xd560('0x19'),_0x2e5356[_0xd560('0x13')]());for(var _0x4654bd=0x0;_0x4654bd<_0x2e5356[_0xd560('0x10')];_0x4654bd++){io[_0xd560('0x1a')](_0xd560('0x1b'),{'id':_0x2e5356[_0x4654bd],'closed':!![]});}}})[_0xd560('0x1c')](function(_0x2235e7){logger[_0xd560('0x1d')](_0xd560('0x1e'),_0x2235e7?util[_0xd560('0x1f')](_0x2235e7,{'showHidden':![],'depth':null}):'');});}exports[_0xd560('0x20')]=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 6b703ca..eb9966c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f2e=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','hopper1','finished\x20populating','contacts2','catch','util'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x1f2e,0x1da));var _0xe1f2=function(_0x4f45e6,_0x97948b){_0x4f45e6=_0x4f45e6-0x0;var _0x3d8c03=_0x1f2e[_0x4f45e6];return _0x3d8c03;};'use strict';var util=require(_0xe1f2('0x0'));var db=require(_0xe1f2('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe1f2('0x2')]({'id':i,'firstName':_0xe1f2('0x3')+i,'lastName':_0xe1f2('0x4')+i,'phone':0xf879fb460+i,'email':_0xe1f2('0x5')+i+_0xe1f2('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe1f2('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1f2('0x7')](),'updatedAt':Date[_0xe1f2('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe1f2('0x3')+i,'lastName':_0xe1f2('0x4')+i,'phone':0xf879fb460+i,'email':_0xe1f2('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe1f2('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe1f2('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1f2('0x7')](),'updatedAt':Date[_0xe1f2('0x7')]()});}db[_0xe1f2('0x8')][_0xe1f2('0x9')]({'where':{}})[_0xe1f2('0xa')](function(){return db['CmContact'][_0xe1f2('0xb')](contacts);})['then'](function(){console[_0xe1f2('0xc')]('finished\x20populating',_0xe1f2('0xd'));return db[_0xe1f2('0xe')][_0xe1f2('0x9')]({'where':{}});})[_0xe1f2('0xa')](function(){return db[_0xe1f2('0xe')][_0xe1f2('0xb')](hopper);})[_0xe1f2('0xa')](function(){console['log']('finished\x20populating',_0xe1f2('0xf'));return db['CmContact'][_0xe1f2('0xb')](contacts2);})[_0xe1f2('0xa')](function(){console['log'](_0xe1f2('0x10'),_0xe1f2('0x11'));return db[_0xe1f2('0xe')][_0xe1f2('0xb')](hopper2);})[_0xe1f2('0xa')](function(){console[_0xe1f2('0xc')]('finished\x20populating','hopper2');})[_0xe1f2('0x12')](function(_0x31a76c){console['log'](_0x31a76c);}); \ No newline at end of file +var _0x55ea=['@xcally.com','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','bulkCreate','hopper1','contacts2','hopper2','catch','util','push','Biondo'];(function(_0xc1c93f,_0x1fba71){var _0x3f81cb=function(_0x20b66f){while(--_0x20b66f){_0xc1c93f['push'](_0xc1c93f['shift']());}};_0x3f81cb(++_0x1fba71);}(_0x55ea,0xd5));var _0xa55e=function(_0x3730f0,_0x2b3b85){_0x3730f0=_0x3730f0-0x0;var _0x219741=_0x55ea[_0x3730f0];return _0x219741;};'use strict';var util=require(_0xa55e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa55e('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xa55e('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa55e('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa55e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa55e('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa55e('0x4')](),'updatedAt':Date[_0xa55e('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa55e('0x1')]({'id':i,'firstName':_0xa55e('0x5')+i,'lastName':_0xa55e('0x2')+i,'phone':0xf879fb460+i,'email':_0xa55e('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa55e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa55e('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa55e('0x4')](),'updatedAt':Date['now']()});}db[_0xa55e('0x7')][_0xa55e('0x8')]({'where':{}})[_0xa55e('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xa55e('0xa')](_0xa55e('0xb'),_0xa55e('0xc'));return db['CmHopper'][_0xa55e('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0xa55e('0xd')](hopper);})[_0xa55e('0x9')](function(){console[_0xa55e('0xa')]('finished\x20populating',_0xa55e('0xe'));return db[_0xa55e('0x7')][_0xa55e('0xd')](contacts2);})['then'](function(){console[_0xa55e('0xa')]('finished\x20populating',_0xa55e('0xf'));return db['CmHopper'][_0xa55e('0xd')](hopper2);})['then'](function(){console[_0xa55e('0xa')](_0xa55e('0xb'),_0xa55e('0x10'));})[_0xa55e('0x11')](function(_0x5b0806){console[_0xa55e('0xa')](_0x5b0806);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 918df39..5540afb 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2be3=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x15d5d8,_0x622ec5){var _0x185d37=function(_0x55a6eb){while(--_0x55a6eb){_0x15d5d8['push'](_0x15d5d8['shift']());}};_0x185d37(++_0x622ec5);}(_0x2be3,0x96));var _0x32be=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x2be3[_0x433a86];return _0x23000c;};'use strict';var util=require(_0x32be('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x32be('0x1')]({'name':util[_0x32be('0x2')](_0x32be('0x3'),'agent',i),'fullname':util[_0x32be('0x2')]('%s%s',_0x32be('0x4'),i),'email':util[_0x32be('0x2')](_0x32be('0x5'),_0x32be('0x4'),i),'role':_0x32be('0x4'),'password':'password','internal':0xfa0+i,'type':_0x32be('0x6'),'transport':[_0x32be('0x7'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x32be('0x2')](_0x32be('0x3'),_0x32be('0x4'),i),'encryption':_0x32be('0x8'),'avpf':'yes','force_avp':_0x32be('0x8'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x32be('0x9'),'dtlsprivatekey':_0x32be('0xa'),'dtlssetup':_0x32be('0xb'),'callerid':util[_0x32be('0x2')](_0x32be('0xc'),util[_0x32be('0x2')](_0x32be('0x3'),_0x32be('0x4'),i),0xfa0+i)});}db[_0x32be('0xd')][_0x32be('0xe')](users)[_0x32be('0xf')](function(){console[_0x32be('0x10')](_0x32be('0x11'));})['catch'](function(_0x3c7094){console[_0x32be('0x10')](_0x3c7094);}); \ No newline at end of file +var _0x3c31=['udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','%s%s@xcally.com','agent','password'];(function(_0x3a1898,_0x35eda2){var _0x2ea51e=function(_0x9e78fa){while(--_0x9e78fa){_0x3a1898['push'](_0x3a1898['shift']());}};_0x2ea51e(++_0x35eda2);}(_0x3c31,0x1e7));var _0x13c3=function(_0x266aa6,_0xeabf3a){_0x266aa6=_0x266aa6-0x0;var _0xc81f99=_0x3c31[_0x266aa6];return _0xc81f99;};'use strict';var util=require(_0x13c3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x13c3('0x1')]({'name':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'fullname':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'email':util['format'](_0x13c3('0x4'),_0x13c3('0x5'),i),'role':_0x13c3('0x5'),'password':_0x13c3('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x13c3('0x7'),'ws','wss'],'disallow':[_0x13c3('0x8')],'allow':[_0x13c3('0x9')],'defaultuser':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'encryption':_0x13c3('0xa'),'avpf':_0x13c3('0xa'),'force_avp':'yes','icesupport':_0x13c3('0xa'),'dtlsenable':_0x13c3('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x13c3('0xb'),'callerid':util[_0x13c3('0x2')](_0x13c3('0xc'),util[_0x13c3('0x2')](_0x13c3('0x3'),_0x13c3('0x5'),i),0xfa0+i)});}db[_0x13c3('0xd')][_0x13c3('0xe')](users)[_0x13c3('0xf')](function(){console[_0x13c3('0x10')](_0x13c3('0x11'));})[_0x13c3('0x12')](function(_0x397bed){console['log'](_0x397bed);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3e1adae..d08b755 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0047=['request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','name','Agents','User','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','role','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:outbound','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','map','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','log','join','default','connection','setMaxListeners','address','remoteAddress'];(function(_0x4a81f4,_0x3e7b7f){var _0x3119d7=function(_0x277f35){while(--_0x277f35){_0x4a81f4['push'](_0x4a81f4['shift']());}};_0x3119d7(++_0x3e7b7f);}(_0x0047,0x69));var _0x7004=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x0047[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0x7004('0x0'));var util=require(_0x7004('0x1'));var BPromise=require('bluebird');var db=require(_0x7004('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7004('0x3')],'include':[{'as':_0x7004('0x4'),'model':db[_0x7004('0x5')],'attributes':['id',_0x7004('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7004('0x3')],'where':{'role':_0x7004('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7004('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7004('0x3')],'where':{'role':_0x7004('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7004('0x3'),_0x7004('0x8')],'where':{'type':_0x7004('0x9')}};function getAssociatedResources(_0x3c09e5,_0x17f526,_0x746319){return db[_0x7004('0xa')][_0x7004('0xb')]({'where':{'name':_0x3c09e5,'userProfileId':_0x17f526},'raw':!![]})[_0x7004('0xc')](function(_0xb6e356){if(_0xb6e356){if(_0xb6e356[_0x7004('0xd')]){switch(_0x3c09e5){case _0x7004('0xe'):case _0x7004('0xf'):case _0x7004('0x10'):case _0x7004('0x11'):case _0x7004('0x12'):case'OpenchannelQueues':case _0x7004('0x13'):return db[_0x746319][_0x7004('0x14')](queryQueues);case _0x7004('0x15'):return db[_0x746319][_0x7004('0x14')](queryTelephones);case _0x7004('0x16'):return db[_0x746319]['findAll'](queryTrunks);case _0x7004('0x17'):return db[_0x746319][_0x7004('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x7004('0x14')]({'attributes':[_0x7004('0x18')],'where':{'sectionId':_0xb6e356['id']},'raw':!![]})[_0x7004('0xc')](function(_0x58ed62){if(_0x58ed62){var _0x3288ae={'where':{'id':_['map'](_0x58ed62,_0x7004('0x18'))},'raw':!![]};switch(_0x746319){case _0x7004('0x5'):_0x3288ae[_0x7004('0x19')][_0x7004('0x1a')]=_0x7004('0x6');break;case'Campaign':_0x3288ae[_0x7004('0x19')][_0x7004('0x8')]=_0x7004('0x9');break;}return db[_0x746319][_0x7004('0x14')](_0x3288ae);}else{return[];}});}}else{return[];}})[_0x7004('0xc')](function(_0x2747e9){return _0x2747e9;});}function joinOrLeaveQueues(_0x5f29c0,_0x2f4ec2,_0x236953,_0x2058ec){_0x5f29c0[_0x2f4ec2](util[_0x7004('0x1b')](_0x7004('0x1c'),_0x236953,_0x2058ec[_0x7004('0x3')]));if(_0x2058ec[_0x7004('0x4')]){for(var _0x2ade13=0x0;_0x2ade13<_0x2058ec[_0x7004('0x4')][_0x7004('0x1d')];_0x2ade13+=0x1){_0x5f29c0[_0x2f4ec2](util[_0x7004('0x1b')](_0x7004('0x1e'),_0x2058ec[_0x7004('0x4')][_0x2ade13]['name']));}}}function joinOrLeave(_0x4bd6d1,_0x4cca7f,_0x57dc42){var _0x2e98d8;if(_0x4bd6d1[_0x7004('0x1f')]['query']['id']){db[_0x7004('0x5')][_0x7004('0x20')]({'attributes':['id',_0x7004('0x3'),_0x7004('0x1a'),_0x7004('0x21')],'where':{'id':_0x4bd6d1[_0x7004('0x1f')]['query']['id']},'include':[{'model':db[_0x7004('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x23')],'as':_0x7004('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x25')],'as':_0x7004('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x27')],'as':_0x7004('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7004('0x2a')],'as':_0x7004('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7004('0xc')](function(_0x136817){if(_0x136817){_0x2e98d8=_0x136817;_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x1e'),_0x136817[_0x7004('0x3')]));var _0x3e033a=[];switch(_0x136817[_0x7004('0x1a')]){case _0x7004('0x2c'):_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x7004('0x2e'))){delete queryQueues[_0x7004('0x2e')];}_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x30')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x31')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x32')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x33')][_0x7004('0x14')](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x34')]['findAll'](queryQueues));_0x3e033a['push'](db[_0x7004('0x35')]['findAll'](queryQueues));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x36')]['findAll'](queryQueues));_0x3e033a['push'](db['User'][_0x7004('0x14')](queryTelephones));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x37')][_0x7004('0x14')](queryTrunks));_0x3e033a[_0x7004('0x2f')](db[_0x7004('0x38')][_0x7004('0x14')](queryCampaigns));_0x3e033a['push'](db[_0x7004('0x5')]['findAll'](queryAgents));break;case'user':_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f](_0x7004('0x39'));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0xe'),_0x136817[_0x7004('0x21')],_0x7004('0x30')));_0x3e033a['push'](getAssociatedResources(_0x7004('0xf'),_0x136817['userProfileId'],_0x7004('0x31')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources('FaxQueues',_0x136817['userProfileId'],_0x7004('0x32')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x11'),_0x136817[_0x7004('0x21')],_0x7004('0x33')));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x12'),_0x136817[_0x7004('0x21')],_0x7004('0x34')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x3a'),_0x136817[_0x7004('0x21')],_0x7004('0x35')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x13'),_0x136817['userProfileId'],'WhatsappQueue'));_0x3e033a[_0x7004('0x2f')](getAssociatedResources(_0x7004('0x15'),_0x136817[_0x7004('0x21')],'User'));_0x3e033a['push'](getAssociatedResources('Trunks',_0x136817[_0x7004('0x21')],_0x7004('0x37')));_0x3e033a['push'](getAssociatedResources(_0x7004('0x17'),_0x136817[_0x7004('0x21')],_0x7004('0x38')));_0x3e033a['push'](db[_0x7004('0x5')][_0x7004('0x14')](queryAgents));break;case _0x7004('0x7'):_0x4bd6d1[_0x4cca7f](_0x7004('0x2d'));_0x4bd6d1[_0x4cca7f](_0x7004('0x39'));_0x3e033a['push'](_0x136817[_0x7004('0x3b')]({'attributes':['id','name']}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3c')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3d')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3e')]({'attributes':['id','name']}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x3f')]({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817['getOpenchannelQueues']({'attributes':['id',_0x7004('0x3')]}));_0x3e033a[_0x7004('0x2f')](_0x136817[_0x7004('0x40')]({'attributes':['id',_0x7004('0x3')]}));break;}return BPromise['all'](_0x3e033a);}})[_0x7004('0xc')](function(_0x5bab21){if(_0x5bab21&&_0x5bab21[_0x7004('0x1d')]){for(var _0x10189a=0x0;_0x10189a<_0x5bab21[_0x7004('0x1d')];_0x10189a+=0x1){for(var _0x5ceb08=0x0;_0x5ceb08<_0x5bab21[_0x10189a][_0x7004('0x1d')];_0x5ceb08+=0x1){switch(_0x10189a){case 0x0:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x41'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x1:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x42'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x2:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x43'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x3:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x44'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x4:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x45'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x5:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,'openchannel',_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x6:joinOrLeaveQueues(_0x4bd6d1,_0x4cca7f,_0x7004('0x46'),_0x5bab21[_0x10189a][_0x5ceb08]);break;case 0x7:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x47'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0x8:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x48'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0x9:_0x4bd6d1[_0x4cca7f](util[_0x7004('0x1b')](_0x7004('0x49'),_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x8')],_0x5bab21[_0x10189a][_0x5ceb08][_0x7004('0x3')]));break;case 0xa:_0x4bd6d1[_0x4cca7f](util['format'](_0x7004('0x1e'),_0x5bab21[_0x10189a][_0x5ceb08]['name']));break;}}}}})['then'](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x3e8e4c=_['map'](_0x2e98d8['ChatInteractions'],'id');return _0x2e98d8[_0x7004('0x4b')](_0x3e8e4c)[_0x7004('0xc')](function(){for(var _0x53af94=0x0;_0x53af94<_0x3e8e4c[_0x7004('0x1d')];_0x53af94+=0x1){_0x57dc42['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3e8e4c[_0x53af94]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x37a141=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x24')],'id');return _0x2e98d8['removeMailInteractions'](_0x37a141)['then'](function(){for(var _0x31f1a4=0x0;_0x31f1a4<_0x37a141[_0x7004('0x1d')];_0x31f1a4+=0x1){_0x57dc42[_0x7004('0x4d')](_0x7004('0x4e'),{'MailInteractionId':Number(_0x37a141[_0x31f1a4]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f==='leave'){var _0xe24989=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x26')],'id');return _0x2e98d8[_0x7004('0x4f')](_0xe24989)[_0x7004('0xc')](function(){for(var _0x143d4f=0x0;_0x143d4f<_0xe24989['length'];_0x143d4f+=0x1){_0x57dc42['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xe24989[_0x143d4f]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x6f8f8b=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x28')],'id');return _0x2e98d8[_0x7004('0x50')](_0x6f8f8b)['then'](function(){for(var _0x19c371=0x0;_0x19c371<_0x6f8f8b[_0x7004('0x1d')];_0x19c371+=0x1){_0x57dc42[_0x7004('0x4d')](_0x7004('0x51'),{'SmsInteractionId':Number(_0x6f8f8b[_0x19c371]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f===_0x7004('0x4a')){var _0x50619e=_['map'](_0x2e98d8[_0x7004('0x52')],'id');return _0x2e98d8[_0x7004('0x53')](_0x50619e)[_0x7004('0xc')](function(){for(var _0x4a0589=0x0;_0x4a0589<_0x50619e['length'];_0x4a0589+=0x1){_0x57dc42[_0x7004('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x50619e[_0x4a0589]),'UserId':Number(_0x2e98d8['id'])});}});}})[_0x7004('0xc')](function(){if(_0x4cca7f==='leave'){var _0x2207c3=_[_0x7004('0x4c')](_0x2e98d8[_0x7004('0x2b')],'id');return _0x2e98d8['removeWhatsappInteractions'](_0x2207c3)['then'](function(){for(var _0xd8764c=0x0;_0xd8764c<_0x2207c3[_0x7004('0x1d')];_0xd8764c+=0x1){_0x57dc42['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2207c3[_0xd8764c]),'UserId':Number(_0x2e98d8['id'])});}});}})['catch'](function(_0x14fb58){_0x4bd6d1[_0x7004('0x54')](_0x14fb58);});}}function onDisconnect(_0x40da75,_0x321566){joinOrLeave(_0x40da75,_0x7004('0x4a'),_0x321566);}function onConnect(_0x53b932){joinOrLeave(_0x53b932,_0x7004('0x55'));}exports[_0x7004('0x56')]=function(_0x5aa52a){_0x5aa52a['on'](_0x7004('0x57'),function(_0x24e658){_0x24e658[_0x7004('0x58')](0x0);_0x24e658[_0x7004('0x59')]=_0x24e658['request']['connection'][_0x7004('0x5a')]+':'+_0x24e658[_0x7004('0x5b')][_0x7004('0x57')][_0x7004('0x5c')];_0x24e658[_0x7004('0x5d')]=new Date();_0x24e658[_0x7004('0x54')]=function(_0x3da45d){console['log'](_0x7004('0x5e')+_0x24e658[_0x7004('0x5f')][_0x7004('0x3')]+'['+_0x24e658[_0x7004('0x59')]+']',_0x3da45d);};_0x24e658['on'](_0x7004('0x60'),function(){onDisconnect(_0x24e658,_0x5aa52a);_0x24e658[_0x7004('0x54')](_0x7004('0x61'));});onConnect(_0x24e658);_0x24e658[_0x7004('0x54')]('CONNECTED');});}; \ No newline at end of file +var _0x57cd=['UserProfileResource','resourceId','map','Campaign','where','ivr','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','Trunk','VoiceQueues','ChatQueues','SmsQueue','OpenchannelQueue','WhatsappQueue','IvrCampaigns','agent','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','type','findOne','then','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks'];(function(_0x2c3a11,_0x35034d){var _0x2da91c=function(_0x5bdd12){while(--_0x5bdd12){_0x2c3a11['push'](_0x2c3a11['shift']());}};_0x2da91c(++_0x35034d);}(_0x57cd,0x121));var _0xd57c=function(_0xe67fe3,_0x14ac43){_0xe67fe3=_0xe67fe3-0x0;var _0x2769af=_0x57cd[_0xe67fe3];return _0x2769af;};'use strict';var _=require(_0xd57c('0x0'));var util=require(_0xd57c('0x1'));var BPromise=require('bluebird');var db=require(_0xd57c('0x2'))['db'];var config=require(_0xd57c('0x3'));var queryQueues={'attributes':['id',_0xd57c('0x4')],'include':[{'as':_0xd57c('0x5'),'model':db[_0xd57c('0x6')],'attributes':['id',_0xd57c('0x4'),_0xd57c('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd57c('0x4')],'where':{'role':_0xd57c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd57c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xd57c('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd57c('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5a9f37,_0x1033df,_0x2fbb8b){return db['UserProfileSection'][_0xd57c('0xa')]({'where':{'name':_0x5a9f37,'userProfileId':_0x1033df},'raw':!![]})[_0xd57c('0xb')](function(_0x204232){if(_0x204232){if(_0x204232['autoAssociation']){switch(_0x5a9f37){case'VoiceQueues':case'ChatQueues':case _0xd57c('0xc'):case _0xd57c('0xd'):case _0xd57c('0xe'):case _0xd57c('0xf'):case _0xd57c('0x10'):return db[_0x2fbb8b]['findAll'](queryQueues);case _0xd57c('0x11'):return db[_0x2fbb8b][_0xd57c('0x12')](queryTelephones);case _0xd57c('0x13'):return db[_0x2fbb8b][_0xd57c('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x2fbb8b][_0xd57c('0x12')](queryCampaigns);}}else{return db[_0xd57c('0x14')][_0xd57c('0x12')]({'attributes':[_0xd57c('0x15')],'where':{'sectionId':_0x204232['id']},'raw':!![]})[_0xd57c('0xb')](function(_0x163540){if(_0x163540){var _0xff0347={'where':{'id':_[_0xd57c('0x16')](_0x163540,_0xd57c('0x15'))},'raw':!![]};switch(_0x2fbb8b){case _0xd57c('0x6'):_0xff0347['where'][_0xd57c('0x7')]='telephone';break;case _0xd57c('0x17'):_0xff0347[_0xd57c('0x18')][_0xd57c('0x9')]=_0xd57c('0x19');break;}return db[_0x2fbb8b][_0xd57c('0x12')](_0xff0347);}else{return[];}});}}else{return[];}})['then'](function(_0x56b42e){return _0x56b42e;});}function joinOrLeaveQueues(_0x558552,_0xc772da,_0x355cc2,_0x5eca4a){_0x558552[_0xc772da](util[_0xd57c('0x1a')](_0xd57c('0x1b'),_0x355cc2,_0x5eca4a[_0xd57c('0x4')]));if(_0x5eca4a[_0xd57c('0x5')]){for(var _0x27dbc3=0x0;_0x27dbc3<_0x5eca4a[_0xd57c('0x5')]['length'];_0x27dbc3+=0x1){_0x558552[_0xc772da](util[_0xd57c('0x1a')](_0xd57c('0x1c'),_0x5eca4a[_0xd57c('0x5')][_0x27dbc3][_0xd57c('0x4')]));}}}function joinOrLeave(_0x39678f,_0x35a7c6,_0xc90181){var _0x38e751;if(_0x39678f[_0xd57c('0x1d')][_0xd57c('0x1e')]['id']){db[_0xd57c('0x6')]['find']({'attributes':['id','name',_0xd57c('0x7'),_0xd57c('0x1f')],'where':{'id':_0x39678f[_0xd57c('0x1d')][_0xd57c('0x1e')]['id']},'include':[{'model':db[_0xd57c('0x20')],'as':_0xd57c('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x22')],'as':_0xd57c('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x24')],'as':_0xd57c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x27')],'as':_0xd57c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x29')],'as':_0xd57c('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xd57c('0xb')](function(_0xe09df1){if(_0xe09df1){_0x38e751=_0xe09df1;_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x1c'),_0xe09df1['name']));var _0x4e07ba=[];switch(_0xe09df1[_0xd57c('0x7')]){case _0xd57c('0x2b'):_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));if(queryQueues[_0xd57c('0x2e')](_0xd57c('0x2f'))){delete queryQueues[_0xd57c('0x2f')];}_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x31')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x32')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x33')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db['SmsQueue']['findAll'](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x34')][_0xd57c('0x12')](queryQueues));_0x4e07ba['push'](db['OpenchannelQueue']['findAll'](queryQueues));_0x4e07ba[_0xd57c('0x30')](db['WhatsappQueue'][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryTelephones));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x35')]['findAll'](queryTrunks));_0x4e07ba[_0xd57c('0x30')](db['Campaign'][_0xd57c('0x12')](queryCampaigns));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryAgents));break;case'user':_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));_0x4e07ba['push'](getAssociatedResources(_0xd57c('0x36'),_0xe09df1['userProfileId'],_0xd57c('0x31')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x37'),_0xe09df1[_0xd57c('0x1f')],'ChatQueue'));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xc'),_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x33')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xd'),_0xe09df1['userProfileId'],_0xd57c('0x38')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xe'),_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x34')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xf'),_0xe09df1['userProfileId'],_0xd57c('0x39')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x10'),_0xe09df1['userProfileId'],_0xd57c('0x3a')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources('Telephones',_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x6')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources('Trunks',_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x35')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x3b'),_0xe09df1['userProfileId'],_0xd57c('0x17')));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryAgents));break;case _0xd57c('0x3c'):_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x3d')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x3e')]({'attributes':['id','name']}));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x3f')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x40')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x41')]({'attributes':['id','name']}));_0x4e07ba['push'](_0xe09df1['getOpenchannelQueues']({'attributes':['id','name']}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x42')]({'attributes':['id',_0xd57c('0x4')]}));break;}return BPromise[_0xd57c('0x43')](_0x4e07ba);}})['then'](function(_0x273641){if(_0x273641&&_0x273641[_0xd57c('0x44')]){for(var _0x11a14c=0x0;_0x11a14c<_0x273641[_0xd57c('0x44')];_0x11a14c+=0x1){for(var _0xc1f994=0x0;_0xc1f994<_0x273641[_0x11a14c]['length'];_0xc1f994+=0x1){switch(_0x11a14c){case 0x0:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x45'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x1:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x46'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x2:joinOrLeaveQueues(_0x39678f,_0x35a7c6,'fax',_0x273641[_0x11a14c][_0xc1f994]);break;case 0x3:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x47'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x4:joinOrLeaveQueues(_0x39678f,_0x35a7c6,'mail',_0x273641[_0x11a14c][_0xc1f994]);break;case 0x5:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x48'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x6:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x49'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x7:_0x39678f[_0x35a7c6](util['format'](_0xd57c('0x4a'),_0x273641[_0x11a14c][_0xc1f994]['name']));break;case 0x8:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x4b'),_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;case 0x9:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x4c'),_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x9')],_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;case 0xa:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')]('user:%s',_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;}}}}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1a6bfd=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x21')],'id');return _0x38e751[_0xd57c('0x4e')](_0x1a6bfd)[_0xd57c('0xb')](function(){for(var _0x34d37a=0x0;_0x34d37a<_0x1a6bfd[_0xd57c('0x44')];_0x34d37a+=0x1){_0xc90181['emit'](_0xd57c('0x4f'),{'ChatInteractionId':Number(_0x1a6bfd[_0x34d37a]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x2e6541=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x23')],'id');return _0x38e751['removeMailInteractions'](_0x2e6541)[_0xd57c('0xb')](function(){for(var _0xb4aec4=0x0;_0xb4aec4<_0x2e6541[_0xd57c('0x44')];_0xb4aec4+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x51'),{'MailInteractionId':Number(_0x2e6541[_0xb4aec4]),'UserId':Number(_0x38e751['id'])});}});}})['then'](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1a5c43=_['map'](_0x38e751[_0xd57c('0x25')],'id');return _0x38e751[_0xd57c('0x52')](_0x1a5c43)['then'](function(){for(var _0x49dfed=0x0;_0x49dfed<_0x1a5c43[_0xd57c('0x44')];_0x49dfed+=0x1){_0xc90181['emit'](_0xd57c('0x53'),{'FaxInteractionId':Number(_0x1a5c43[_0x49dfed]),'UserId':Number(_0x38e751['id'])});}});}})['then'](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0xd84217=_['map'](_0x38e751[_0xd57c('0x54')],'id');return _0x38e751[_0xd57c('0x55')](_0xd84217)[_0xd57c('0xb')](function(){for(var _0x2ec55c=0x0;_0x2ec55c<_0xd84217[_0xd57c('0x44')];_0x2ec55c+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x56'),{'SmsInteractionId':Number(_0xd84217[_0x2ec55c]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1b245c=_['map'](_0x38e751[_0xd57c('0x28')],'id');return _0x38e751['removeOpenchannelInteractions'](_0x1b245c)[_0xd57c('0xb')](function(){for(var _0x5a4712=0x0;_0x5a4712<_0x1b245c[_0xd57c('0x44')];_0x5a4712+=0x1){_0xc90181[_0xd57c('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1b245c[_0x5a4712]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x298b9b=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x2a')],'id');return _0x38e751[_0xd57c('0x57')](_0x298b9b)[_0xd57c('0xb')](function(){for(var _0x9e67cf=0x0;_0x9e67cf<_0x298b9b['length'];_0x9e67cf+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x58'),{'WhatsappInteractionId':Number(_0x298b9b[_0x9e67cf]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0x59')](function(_0x424d50){_0x39678f['log'](_0x424d50);});}}function onDisconnect(_0x4d584c,_0x2b9f1c){joinOrLeave(_0x4d584c,_0xd57c('0x4d'),_0x2b9f1c);}function onConnect(_0x40564a){joinOrLeave(_0x40564a,_0xd57c('0x5a'));}exports[_0xd57c('0x5b')]=function(_0x285340){_0x285340['on'](_0xd57c('0x5c'),function(_0xdc439){_0xdc439[_0xd57c('0x5d')](0x0);_0xdc439[_0xd57c('0x5e')]=_0xdc439[_0xd57c('0x5f')][_0xd57c('0x5c')][_0xd57c('0x60')]+':'+_0xdc439[_0xd57c('0x5f')][_0xd57c('0x5c')][_0xd57c('0x61')];_0xdc439[_0xd57c('0x62')]=new Date();_0xdc439['log']=function(_0x567cc6){console[_0xd57c('0x63')](_0xd57c('0x64')+_0xdc439['nsp'][_0xd57c('0x4')]+'['+_0xdc439[_0xd57c('0x5e')]+']',_0x567cc6);};_0xdc439['on'](_0xd57c('0x65'),function(){onDisconnect(_0xdc439,_0x285340);_0xdc439['log'](_0xd57c('0x66'));});onConnect(_0xdc439);_0xdc439['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 917e0bd..f33eba9 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 _0x9cda=['EventManager','then','info','Trigger,\x20%s','error','code','channel','event','direction','UserId','User','find','format','SIP/%s','name','incomingmessage','catch','outgoingmessage','get','opened','closed','default','length','hasOwnProperty','hook','callback','condition','../../mysqldb','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','SmsInteraction','Sms','closedinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request'];(function(_0x2f1c3f,_0x59210a){var _0x3d4b49=function(_0x1084e9){while(--_0x1084e9){_0x2f1c3f['push'](_0x2f1c3f['shift']());}};_0x3d4b49(++_0x59210a);}(_0x9cda,0x15f));var _0xa9cd=function(_0x968cd0,_0x8ff61){_0x968cd0=_0x968cd0-0x0;var _0x2d8cb5=_0x9cda[_0x968cd0];return _0x2d8cb5;};'use strict';var util=require('util');var db=require(_0xa9cd('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0xa9cd('0x1'));var client=jayson[_0xa9cd('0x2')][_0xa9cd('0x3')]({'port':0x232a});var triggers=[{'channel':_0xa9cd('0x4'),'model':_0xa9cd('0x5'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0x7'),'callback':afterCreate},{'channel':_0xa9cd('0x4'),'model':_0xa9cd('0x5'),'event':_0xa9cd('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0xa9cd('0x9'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xa9cd('0xb'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xa9cd('0xc'),'model':_0xa9cd('0xb'),'event':_0xa9cd('0x8'),'condition':_0xa9cd('0xd'),'callback':afterUpdate},{'channel':_0xa9cd('0xc'),'model':'SmsMessage','event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage},{'channel':_0xa9cd('0xe'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0xa9cd('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xa9cd('0xf'),'event':_0xa9cd('0x8'),'condition':_0xa9cd('0xd'),'callback':afterUpdate},{'channel':_0xa9cd('0xe'),'model':_0xa9cd('0x10'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage},{'channel':_0xa9cd('0x11'),'model':_0xa9cd('0x12'),'event':'afterCreate','condition':_0xa9cd('0x7'),'callback':afterCreate},{'channel':_0xa9cd('0x11'),'model':_0xa9cd('0x12'),'event':_0xa9cd('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa9cd('0x11'),'model':_0xa9cd('0x13'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage},{'channel':_0xa9cd('0x14'),'model':'MailInteraction','event':_0xa9cd('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa9cd('0x14'),'model':_0xa9cd('0x15'),'event':_0xa9cd('0x8'),'condition':_0xa9cd('0xd'),'callback':afterUpdate},{'channel':_0xa9cd('0x14'),'model':_0xa9cd('0x16'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xa9cd('0x17'),'event':_0xa9cd('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa9cd('0x18'),'model':_0xa9cd('0x17'),'event':_0xa9cd('0x8'),'condition':_0xa9cd('0xd'),'callback':afterUpdate},{'channel':_0xa9cd('0x18'),'model':_0xa9cd('0x19'),'event':_0xa9cd('0x6'),'condition':_0xa9cd('0xa'),'callback':afterCreateMessage}];function request(_0x5458cc){return client[_0xa9cd('0x1a')](_0xa9cd('0x1b'),_0x5458cc)[_0xa9cd('0x1c')](function(_0x34b51a){logger[_0xa9cd('0x1d')](_0xa9cd('0x1e'),_0xa9cd('0x1b'),_0x34b51a);if(_0x34b51a[_0xa9cd('0x1f')]){if(_0x34b51a['error'][_0xa9cd('0x20')]===0x1f4){logger['error']('Trigger,\x20%s',_0xa9cd('0x1b'),_0x34b51a[_0xa9cd('0x1f')]);}}})['catch'](function(_0x52de91){logger[_0xa9cd('0x1f')](_0xa9cd('0x1e'),_0xa9cd('0x1b'),_0x52de91);});}function afterCreateMessage(_0x1a1eca,_0x4ff0a4){return function(_0x27af97,_0x32fa96){_0x27af97=_0x27af97['get']({'plain':!![]});_0x27af97[_0xa9cd('0x21')]=_0x1a1eca;_0x27af97[_0xa9cd('0x22')]=_0x27af97[_0xa9cd('0x23')];if(_0x27af97[_0xa9cd('0x24')]){return db[_0xa9cd('0x25')][_0xa9cd('0x26')]({'where':{'id':_0x27af97[_0xa9cd('0x24')]},'attributes':['id','name'],'raw':!![]})[_0xa9cd('0x1c')](function(_0x1a161f){_0x27af97['interface']=util[_0xa9cd('0x27')](_0xa9cd('0x28'),_0x1a161f[_0xa9cd('0x29')]);_0x27af97['channel']=_0x1a1eca;return request({'event':_0xa9cd('0x2a'),'message':_0x27af97});})[_0xa9cd('0x2b')](function(_0x30f491){console[_0xa9cd('0x1f')](_0x30f491);});}else{return request({'event':_0xa9cd('0x2c'),'message':_0x27af97});}};}function afterCreate(_0x5aa049,_0xf91ca4){return function(_0x1e0df0,_0x1f797b){_0x1e0df0=_0x1e0df0[_0xa9cd('0x2d')]({'plain':!![]});_0x1e0df0[_0xa9cd('0x21')]=_0x5aa049;_0x1e0df0[_0xa9cd('0x22')]=_0xa9cd('0x2e');return request({'event':_0xf91ca4,'message':_0x1e0df0});};}function afterUpdate(_0x5b4c4a,_0x4c22c8){return function(_0x197870,_0x3b8e1b){if(_0x197870['changed'](_0xa9cd('0x2f'))&&_0x197870[_0xa9cd('0x2f')]){_0x197870=_0x197870[_0xa9cd('0x2d')]({'plain':!![]});_0x197870[_0xa9cd('0x21')]=_0x5b4c4a;_0x197870[_0xa9cd('0x22')]=_0xa9cd('0x2f');if(_0x197870[_0xa9cd('0x24')]){return db[_0xa9cd('0x25')]['find']({'where':{'id':_0x197870[_0xa9cd('0x24')]},'attributes':['id','name'],'raw':!![]})[_0xa9cd('0x1c')](function(_0x538e67){_0x197870['interface']=util[_0xa9cd('0x27')](_0xa9cd('0x28'),_0x538e67[_0xa9cd('0x29')]);return request({'event':_0x4c22c8,'message':_0x197870});})['catch'](function(_0x3634a6){console[_0xa9cd('0x1f')](_0x3634a6);});}else{return request({'event':_0x4c22c8,'message':_0x197870});}}};}exports[_0xa9cd('0x30')]=function(){for(var _0x482159=0x0;_0x482159=_0x1522c0[_0x4f31('0x12')]){throw Error(_0x4f31('0x13'));}_0x5c77c3(_0x46b969);})[_0x4f31('0x14')](function(_0x3d0551){_0x101793(_0x3d0551);});});}; \ No newline at end of file +var _0x2b11=['getLicense','agent','User','count','then','agents','catch','lodash','bluebird','./license/util','voice','chat','fax','sms','openchannel','getChannels','clearBlockUser','isUndefined','blockedAt','updateAttributes'];(function(_0x22e319,_0x5e6169){var _0x5d04b0=function(_0xfa1c09){while(--_0xfa1c09){_0x22e319['push'](_0x22e319['shift']());}};_0x5d04b0(++_0x5e6169);}(_0x2b11,0x1bf));var _0x12b1=function(_0xd553ab,_0x788918){_0xd553ab=_0xd553ab-0x0;var _0x215442=_0x2b11[_0xd553ab];return _0x215442;};'use strict';var _=require(_0x12b1('0x0'));var BPromise=require(_0x12b1('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x12b1('0x2'));var channels=[_0x12b1('0x3'),'mail',_0x12b1('0x4'),_0x12b1('0x5'),_0x12b1('0x6'),'whatsapp',_0x12b1('0x7')];exports[_0x12b1('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x5ed2c7){_0x5ed2c7=_0x5ed2c7['toLowerCase']();return _['includes'](channels,_0x5ed2c7);};exports[_0x12b1('0x9')]=function(_0x4396b2,_0x39001d,_0x45b496,_0xe82255){var _0x1a6de6={'loginAttempts':_0x39001d,'blocked':_0x45b496};if(!_[_0x12b1('0xa')](_0xe82255)){_0x1a6de6[_0x12b1('0xb')]=_0xe82255;}return _0x4396b2[_0x12b1('0xc')](_0x1a6de6);};exports[_0x12b1('0xd')]=function(_0x24f9a8){return new BPromise(function(_0x38f4d6,_0x3b91ac){var _0x1311ae=0x0;if(_0x24f9a8['role']!==_0x12b1('0xe')){_0x38f4d6(_0x24f9a8);}db[_0x12b1('0xf')][_0x12b1('0x10')]({'where':{'role':_0x12b1('0xe'),'online':!![],'id':{'$ne':_0x24f9a8['id']}}})[_0x12b1('0x11')](function(_0x22d6e4){_0x1311ae=_0x22d6e4;return util['getLicense']();})[_0x12b1('0x11')](function(_0xd37534){if(_0xd37534&&_0xd37534['agents']&&_0x1311ae>=_0xd37534[_0x12b1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x38f4d6(_0x24f9a8);})[_0x12b1('0x13')](function(_0xc7fdf5){_0x3b91ac(_0xc7fdf5);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 40e1ad0..f87b4f3 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa74=['404','status','render','json','send'];(function(_0x106f5d,_0x15dcbd){var _0x1e42c7=function(_0x138a06){while(--_0x138a06){_0x106f5d['push'](_0x106f5d['shift']());}};_0x1e42c7(++_0x15dcbd);}(_0xaa74,0x1ea));var _0x4aa7=function(_0x5e046e,_0x28fb28){_0x5e046e=_0x5e046e-0x0;var _0x334cb3=_0xaa74[_0x5e046e];return _0x334cb3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x6f3ffd,_0x44e265){var _0x3902ee=_0x4aa7('0x0');var _0x532dfc=0x194;var _0x4289af={'status':_0x532dfc};_0x44e265[_0x4aa7('0x1')](_0x4289af[_0x4aa7('0x1')]);_0x44e265[_0x4aa7('0x2')](_0x3902ee,{},function(_0x477867,_0x4be4d2){if(_0x477867){return _0x44e265['status'](_0x4289af[_0x4aa7('0x1')])[_0x4aa7('0x3')](_0x4289af);}_0x44e265[_0x4aa7('0x4')](_0x4be4d2);});}; \ No newline at end of file +var _0x2853=['404','status','render','json','send'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x2853,0xbe));var _0x3285=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x2853[_0xefd519];return _0x4bb882;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1959a4,_0x1089de){var _0x365630=_0x3285('0x0');var _0x3d8f7a=0x194;var _0x1d8745={'status':_0x3d8f7a};_0x1089de[_0x3285('0x1')](_0x1d8745[_0x3285('0x1')]);_0x1089de[_0x3285('0x2')](_0x365630,{},function(_0x1abad0,_0x397543){if(_0x1abad0){return _0x1089de[_0x3285('0x1')](_0x1d8745[_0x3285('0x1')])[_0x3285('0x3')](_0x1d8745);}_0x1089de[_0x3285('0x4')](_0x397543);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6120b1a..acd52e0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb594=['import','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','FaxQueues','OpenchannelQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','VoiceMusicOnHold','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Disposition','Dispositions','Interactions','Applications','List','ListId','TemplateId','user_has_mail_accounts','Agents','MailQueue','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','restrict','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','Answers','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','cm_contact_has_tags','OneAll','AutomationAllId','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmConfiguration','Field','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','MailQueues','ChatQueues','SmsQueues','CampaignId','HopperBlacks','SquareProjectId','Lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','username','password','options','User'];(function(_0x327c12,_0x2874c9){var _0x4cd602=function(_0x3b82f4){while(--_0x3b82f4){_0x327c12['push'](_0x327c12['shift']());}};_0x4cd602(++_0x2874c9);}(_0xb594,0x1d0));var _0x4b59=function(_0x27671f,_0x449b6a){_0x27671f=_0x27671f-0x0;var _0x523bbf=_0xb594[_0x27671f];return _0x523bbf;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require(_0x4b59('0x0'));var _=require(_0x4b59('0x1'));var jstz=require(_0x4b59('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x4b59('0x3')](config[_0x4b59('0x0')],{'database':_0x4b59('0x4'),'username':_0x4b59('0x5'),'password':_0x4b59('0x6'),'options':{'host':_0x4b59('0x7'),'port':0xcea,'dialect':_0x4b59('0x8'),'dialectOptions':{'charset':_0x4b59('0x9')},'logging':![],'timezone':timezone[_0x4b59('0xa')](),'define':{'charset':_0x4b59('0xb'),'collate':'utf8_general_ci'}}});config[_0x4b59('0xc')]=_['defaultsDeep'](config[_0x4b59('0xc')],{'database':_0x4b59('0x4'),'username':_0x4b59('0x5'),'password':_0x4b59('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4b59('0x8'),'dialectOptions':{'charset':_0x4b59('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4b59('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b59('0x0')][_0x4b59('0xe')],config['sequelize'][_0x4b59('0xf')],config[_0x4b59('0x0')][_0x4b59('0x10')],config[_0x4b59('0x0')][_0x4b59('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b59('0xc')]['database'],config['sequelizeHistory'][_0x4b59('0xf')],config['sequelizeHistory']['password'],config[_0x4b59('0xc')]['options'])};db[_0x4b59('0x12')]=db['sequelize'][_0x4b59('0x13')]('../api/user/user.model');db[_0x4b59('0x14')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x15'));db[_0x4b59('0x16')]=db['sequelize'][_0x4b59('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x4b59('0x0')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x4b59('0x17')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x18'));db['VoiceRecording']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x4b59('0x19')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1a'));db['VoiceMail']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/voiceMail/voiceMail.model');db[_0x4b59('0x1b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1c'));db[_0x4b59('0x1d')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x1e'));db[_0x4b59('0x1f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x20'));db[_0x4b59('0x21')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x22'));db[_0x4b59('0x23')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x24'));db['MemberReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x25'));db[_0x4b59('0x26')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x27'));db[_0x4b59('0x28')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x29'));db['UserVoiceQueueRt']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x2a'));db[_0x4b59('0x2b')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x2c'));db[_0x4b59('0x2d')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x2e'));db[_0x4b59('0x2f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x30'));db[_0x4b59('0x31')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x32'));db[_0x4b59('0x33')]=db['sequelize']['import'](_0x4b59('0x34'));db[_0x4b59('0x35')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x36'));db[_0x4b59('0x37')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x4b59('0x38')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x39'));db['MailServerOut']=db['sequelize'][_0x4b59('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x4b59('0x3a')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x3b'));db['MailQueue']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/mailQueue/mailQueue.model');db[_0x4b59('0x3c')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x3d'));db[_0x4b59('0x3e')]=db['sequelize']['import'](_0x4b59('0x3f'));db[_0x4b59('0x40')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x41'));db[_0x4b59('0x42')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x43'));db['MailQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x4b59('0x44')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x45'));db['DashboardItem']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x46'));db[_0x4b59('0x47')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x48'));db[_0x4b59('0x49')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4a'));db[_0x4b59('0x4b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4c'));db[_0x4b59('0x4d')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x4e'));db[_0x4b59('0x4f')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x50'));db[_0x4b59('0x51')]=db[_0x4b59('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x4b59('0x52')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/smsAccount/smsAccount.model');db[_0x4b59('0x53')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x54'));db['SmsInteraction']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x55'));db['SmsMessage']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x56'));db[_0x4b59('0x57')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x58'));db[_0x4b59('0x59')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x5a'));db[_0x4b59('0x5b')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x5c'));db['OpenchannelInteraction']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x5d'));db[_0x4b59('0x5e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x4b59('0x5f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x60'));db[_0x4b59('0x61')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x4b59('0x62')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x63'));db[_0x4b59('0x64')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/chatApplication/chatApplication.model');db[_0x4b59('0x65')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x66'));db[_0x4b59('0x67')]=db['sequelize'][_0x4b59('0x13')]('../api/chatMessage/chatMessage.model');db[_0x4b59('0x68')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x69'));db[_0x4b59('0x6a')]=db['sequelize'][_0x4b59('0x13')]('../api/chatQueue/chatQueue.model');db[_0x4b59('0x6b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x6c'));db[_0x4b59('0x6d')]=db['sequelize'][_0x4b59('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x4b59('0x6e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cmCompany/cmCompany.model');db[_0x4b59('0x6f')]=db['sequelize'][_0x4b59('0x13')]('../api/cmContact/cmContact.model');db[_0x4b59('0x70')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x71'));db['CmHopperBlack']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x4b59('0x72')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x73'));db[_0x4b59('0x74')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x75'));db[_0x4b59('0x76')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x77'));db[_0x4b59('0x78')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x79'));db[_0x4b59('0x7a')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x7b'));db[_0x4b59('0x7c')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x7d'));db[_0x4b59('0x7e')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize']['import'](_0x4b59('0x7f'));db[_0x4b59('0x80')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x81'));db['Interval']=db['sequelize'][_0x4b59('0x13')]('../api/interval/interval.model');db[_0x4b59('0x82')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/pause/pause.model');db['Cdr']=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/cdr/cdr.model');db[_0x4b59('0x83')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x84'));db[_0x4b59('0x85')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x86'));db[_0x4b59('0x87')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/sound/sound.model');db[_0x4b59('0x88')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x89'));db[_0x4b59('0x8a')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/template/template.model');db[_0x4b59('0x8b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x8c'));db[_0x4b59('0x8d')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x8e'));db[_0x4b59('0x8f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x90'));db[_0x4b59('0x91')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/integrationReport/integrationReport.model');db[_0x4b59('0x92')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x4b59('0x93')]=db[_0x4b59('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4b59('0x94')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x95'));db[_0x4b59('0x96')]=db['sequelize'][_0x4b59('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x4b59('0x97')]=db[_0x4b59('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x4b59('0x98')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x4b59('0x99')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x9a'));db[_0x4b59('0x9b')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x9c'));db[_0x4b59('0x9d')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0x9e'));db[_0x4b59('0x9f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa0'));db['SugarcrmConfiguration']=db[_0x4b59('0x0')]['import'](_0x4b59('0xa1'));db[_0x4b59('0xa2')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa3'));db[_0x4b59('0xa4')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xa5'));db[_0x4b59('0xa6')]=db['sequelize'][_0x4b59('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4b59('0xa7')]=db[_0x4b59('0x0')]['import']('../api/intDeskField/intDeskField.model');db[_0x4b59('0xa8')]=db['sequelize'][_0x4b59('0x13')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xa9'));db[_0x4b59('0xaa')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xab'));db[_0x4b59('0xac')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xad'));db[_0x4b59('0xae')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x4b59('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x4b59('0xaf')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xb0'));db[_0x4b59('0xb1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xb2'));db[_0x4b59('0xb3')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xb4'));db['VtigerAccount']=db[_0x4b59('0x0')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x4b59('0xb5')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xb6'));db[_0x4b59('0xb7')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xb8'));db[_0x4b59('0xb9')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xba'));db[_0x4b59('0xbb')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xbc'));db[_0x4b59('0xbd')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xbe'));db[_0x4b59('0xbf')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x4b59('0xc0')]=db['sequelize']['import'](_0x4b59('0xc1'));db[_0x4b59('0xc2')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xc3'));db['FreshsalesAccount']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xc4'));db[_0x4b59('0xc5')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xc6'));db[_0x4b59('0xc7')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4b59('0x8f')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x90'));db[_0x4b59('0xc8')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xc9'));db[_0x4b59('0xca')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xcb'));db[_0x4b59('0xcc')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xcd'));db[_0x4b59('0xce')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xcf'));db[_0x4b59('0xd0')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xd1'));db[_0x4b59('0xd2')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd3'));db['SmsQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd4'));db['SquareReport']=db[_0x4b59('0x0')]['import'](_0x4b59('0xd5'));db[_0x4b59('0xd6')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd7'));db[_0x4b59('0xd8')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xd9'));db[_0x4b59('0xda')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xdb'));db[_0x4b59('0xdc')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xdd'));db[_0x4b59('0xde')]=db['sequelize'][_0x4b59('0x13')]('../api/squareProject/squareProject.model');db[_0x4b59('0xdf')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xe0'));db[_0x4b59('0xe1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe2'));db['Team']=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xe3'));db[_0x4b59('0xe4')]=db['sequelize']['import'](_0x4b59('0xe5'));db[_0x4b59('0xe6')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe7'));db['Migration']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xe8'));db[_0x4b59('0xe9')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x4b59('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x4b59('0xea')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xeb'));db[_0x4b59('0xec')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xed'));db[_0x4b59('0xee')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xef'));db[_0x4b59('0xf0')]=db[_0x4b59('0x0')][_0x4b59('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x4b59('0xf1')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf2'));db[_0x4b59('0xf3')]=db['sequelize'][_0x4b59('0x13')](_0x4b59('0xf4'));db[_0x4b59('0xf5')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf6'));db[_0x4b59('0xf7')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xf8'));db[_0x4b59('0xf9')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xfa'));db[_0x4b59('0xfb')]=db['sequelize']['import']('../api/notification/notification.model');db[_0x4b59('0xfc')]=db[_0x4b59('0x0')]['import'](_0x4b59('0xfd'));db['WhatsappApplication']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0xfe'));db[_0x4b59('0xff')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x100'));db[_0x4b59('0x101')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x102'));db['WhatsappQueueReport']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x103'));db[_0x4b59('0x104')]=db[_0x4b59('0x0')]['import'](_0x4b59('0x105'));db[_0x4b59('0x106')]=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x107'));db['CloudProvider']=db[_0x4b59('0x0')][_0x4b59('0x13')](_0x4b59('0x108'));db[_0x4b59('0x12')][_0x4b59('0x109')](db['VoiceMail'],{'as':_0x4b59('0x10a'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x10c')});db['User'][_0x4b59('0x10d')](db[_0x4b59('0x10e')],{'as':'Recordings','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x10f')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'as':_0x4b59('0x110'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x12')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x10c')});db['User'][_0x4b59('0x10d')](db['CmHopperHistory'],{'as':_0x4b59('0x112'),'foreignKey':'UserId'});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x76')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x4b59('0x10d')](db['OpenchannelInteraction'],{'as':_0x4b59('0x113'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db['ChatInteraction'],{'as':_0x4b59('0x114'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'SmsInteractions','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0x4b59('0x116'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'foreignKey':'UserId'});db[_0x4b59('0x12')]['hasMany'](db[_0x4b59('0xff')],{'as':_0x4b59('0x118'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x12')][_0x4b59('0x10d')](db[_0x4b59('0xfb')],{'as':_0x4b59('0x119'),'foreignKey':'SenderId'});db['User'][_0x4b59('0x11a')](db[_0x4b59('0xf5')],{'as':_0x4b59('0xf5'),'foreignKey':_0x4b59('0x11b')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0x6b')],{'as':_0x4b59('0x11d'),'through':_0x4b59('0x11e')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'through':_0x4b59('0x120')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x122')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'through':_0x4b59('0x123')});db['User']['belongsToMany'](db[_0x4b59('0x65')],{'as':_0x4b59('0x114'),'through':_0x4b59('0x124')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x4b')],{'as':_0x4b59('0x116'),'through':'user_has_fax_interactions'});db['User'][_0x4b59('0x11c')](db['SmsInteraction'],{'as':_0x4b59('0x125'),'through':_0x4b59('0x126')});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x127')],{'as':_0x4b59('0x113'),'through':_0x4b59('0x128')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xff')],{'as':'WhatsappInteractions','through':_0x4b59('0x129')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['VoiceQueue'],{'as':_0x4b59('0x12a'),'through':_0x4b59('0x2b'),'required':![]});db[_0x4b59('0x12')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':_0x4b59('0x2f'),'required':![]});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x6a')],{'as':'ChatQueues','through':_0x4b59('0x2d'),'required':![],'hooks':!![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x4f')],{'as':_0x4b59('0x12b'),'through':'UserFaxQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x57')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x5f')],{'as':_0x4b59('0x12c'),'through':_0x4b59('0x35'),'required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x106')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'through':_0x4b59('0x12d')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['VoicePrefix'],{'as':_0x4b59('0x12e'),'through':_0x4b59('0x12f'),'required':![]});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x61')],{'as':_0x4b59('0x130'),'through':'user_has_chat_websites'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['FaxAccount'],{'as':_0x4b59('0x131'),'through':_0x4b59('0x132')});db[_0x4b59('0x12')][_0x4b59('0x11c')](db['MailAccount'],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0x59')],{'as':_0x4b59('0x133'),'through':_0x4b59('0x134')});db[_0x4b59('0x12')]['belongsToMany'](db[_0x4b59('0x52')],{'as':_0x4b59('0x135'),'through':'user_has_sms_accounts'});db[_0x4b59('0x12')][_0x4b59('0x11c')](db[_0x4b59('0xfc')],{'as':_0x4b59('0x136'),'through':_0x4b59('0x137')});db['User'][_0x4b59('0x11c')](db[_0x4b59('0xde')],{'as':'SquareProjects','through':_0x4b59('0x138')});db['VoiceChanSpy'][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'as':_0x4b59('0x139'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x13a')});db[_0x4b59('0x13b')][_0x4b59('0x10d')](db[_0x4b59('0x16')],{'onDelete':'cascade'});db[_0x4b59('0x16')]['hasMany'](db[_0x4b59('0x16')],{'as':'Applications','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x13c')]['belongsToMany'](db[_0x4b59('0x87')],{'as':'Sounds','through':_0x4b59('0x13d')});db['VoiceQueue'][_0x4b59('0x10d')](db[_0x4b59('0x10f')],{'as':_0x4b59('0x13e'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db['CmHopperHistory'],{'as':_0x4b59('0x141'),'foreignKey':'VoiceQueueId'});db[_0x4b59('0x17')][_0x4b59('0x10d')](db[_0x4b59('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')]['hasMany'](db[_0x4b59('0x142')],{'as':'HopperBlacks','foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x10d')](db['JscriptySessionReport'],{'as':_0x4b59('0x143'),'foreignKey':_0x4b59('0x13f')});db[_0x4b59('0x17')][_0x4b59('0x11a')](db['Trunk'],{'as':'Trunk','foreignKey':_0x4b59('0x144')});db[_0x4b59('0x17')][_0x4b59('0x11a')](db['Trunk'],{'as':_0x4b59('0x145'),'foreignKey':_0x4b59('0x146')});db['VoiceQueue'][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'as':'Interval','foreignKey':_0x4b59('0x148')});db[_0x4b59('0x17')]['belongsTo'](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db['VoiceQueue']['belongsToMany'](db[_0x4b59('0xf1')],{'as':'Lists','through':_0x4b59('0x14b')});db[_0x4b59('0x17')][_0x4b59('0x11c')](db['User'],{'as':'Agents','through':_0x4b59('0x2b')});db['VoiceQueue'][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'as':_0x4b59('0x14c'),'through':_0x4b59('0x14d')});db[_0x4b59('0x17')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x14e'),'through':_0x4b59('0x14f')});db['VoiceRecording'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x19')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x10a')][_0x4b59('0x10d')](db[_0x4b59('0x1b')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x151'),'sourceKey':_0x4b59('0x152')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x4b59('0x151'),'targetKey':_0x4b59('0x152')});db[_0x4b59('0x1d')]['hasMany'](db[_0x4b59('0x23')],{'as':'QueueCalls','foreignKey':_0x4b59('0x153'),'constraints':![]});db[_0x4b59('0x1d')][_0x4b59('0x10d')](db[_0x4b59('0x21')],{'as':'AgentReports','foreignKey':_0x4b59('0x153'),'constraints':![]});db['VoiceCallReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x12'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x1d')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x38')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':'MailAccount','foreignKey':_0x4b59('0x156')});db[_0x4b59('0x157')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':_0x4b59('0x3a'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x109')](db['MailServerIn'],{'as':_0x4b59('0x158'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x3a')][_0x4b59('0x109')](db['MailServerOut'],{'as':_0x4b59('0x159'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')]['hasMany'](db[_0x4b59('0x40')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x156')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x15c')});db[_0x4b59('0x3a')][_0x4b59('0x10d')](db[_0x4b59('0x42')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x3a')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['MailAccount'][_0x4b59('0x11a')](db[_0x4b59('0x8a')],{'as':'Template','foreignKey':_0x4b59('0x160')});db[_0x4b59('0x3a')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4b59('0x3a')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x161')});db['MailQueue'][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':_0x4b59('0x2f')});db[_0x4b59('0x163')][_0x4b59('0x11c')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x4b59('0x3e')][_0x4b59('0x10d')](db['MailMessage'],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x164')});db[_0x4b59('0x3e')]['belongsTo'](db[_0x4b59('0x3a')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x156')});db['MailInteraction'][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x3e')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db['MailInteraction']['belongsToMany'](db[_0x4b59('0x88')],{'through':_0x4b59('0x167'),'as':_0x4b59('0x168')});db['MailInteraction'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x167'),'as':_0x4b59('0x169')});db['MailInteraction'][_0x4b59('0x11c')](db['User'],{'as':'Users','through':_0x4b59('0x123'),'foreignKey':_0x4b59('0x164')});db[_0x4b59('0x40')][_0x4b59('0x10d')](db['Attachment'],{'as':'Attachments','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'User'});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db[_0x4b59('0x40')]['belongsTo'](db['MailInteraction'],{'as':_0x4b59('0x16a'),'foreignKey':'MailInteractionId'});db[_0x4b59('0x40')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'as':_0x4b59('0x165'),'foreignKey':'MailAccountId'});db[_0x4b59('0x42')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x42')]['belongsTo'](db['MailQueue'],{'onDelete':_0x4b59('0x16b')});db['MailApplication'][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x42')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x148')});db['MailApplication'][_0x4b59('0x11a')](db['Tag'],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x16d')]['belongsTo'](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x3e')],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0x4b59('0x16d')][_0x4b59('0x11a')](db[_0x4b59('0x163')],{});db[_0x4b59('0x44')][_0x4b59('0x10d')](db[_0x4b59('0x16e')],{'as':_0x4b59('0x16f'),'onDelete':'cascade'});db['FaxAccount'][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x170')});db[_0x4b59('0x47')][_0x4b59('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4b59('0x170')});db[_0x4b59('0x47')]['hasMany'](db[_0x4b59('0x4b')],{'as':_0x4b59('0x15c')});db[_0x4b59('0x47')][_0x4b59('0x10d')](db[_0x4b59('0x49')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x47')]['hasMany'](db[_0x4b59('0x16')],{'as':_0x4b59('0x171'),'onDelete':_0x4b59('0x10b')});db['FaxAccount'][_0x4b59('0x10d')](db['FaxMessage'],{'as':'Messages'});db[_0x4b59('0x47')][_0x4b59('0x11a')](db[_0x4b59('0x26')],{'as':_0x4b59('0x26')});db[_0x4b59('0x47')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':'ListId'});db[_0x4b59('0x47')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x4b59('0x14a')});db[_0x4b59('0x47')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x132')});db[_0x4b59('0x49')]['belongsTo'](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db[_0x4b59('0x4f')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x49')][_0x4b59('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x4b')][_0x4b59('0x10d')](db[_0x4b59('0x4d')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':'FaxInteractionId'});db[_0x4b59('0x4b')][_0x4b59('0x11a')](db['FaxAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x170')});db['FaxInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':_0x4b59('0x155')});db[_0x4b59('0x4b')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x172'),'as':'Tags'});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x172'),'as':_0x4b59('0x169')});db[_0x4b59('0x4b')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_fax_interactions','foreignKey':_0x4b59('0x174')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x12')});db['FaxMessage']['belongsTo'](db[_0x4b59('0x4b')],{'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x174')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x4b59('0xe9'),'foreignKey':_0x4b59('0x175')});db[_0x4b59('0x4d')][_0x4b59('0x11a')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x4b59('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0x4b59('0x4f')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x176'),'as':'Teams'});db['FaxQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0x51')][_0x4b59('0x11a')](db[_0x4b59('0x4b')],{});db[_0x4b59('0x51')][_0x4b59('0x11a')](db['FaxMessage'],{});db['FaxQueueReport'][_0x4b59('0x11a')](db['User'],{});db[_0x4b59('0x51')]['belongsTo'](db[_0x4b59('0x4f')],{});db['SmsAccount'][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':'Dispositions','foreignKey':_0x4b59('0x177')});db[_0x4b59('0x52')][_0x4b59('0x10d')](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x177')});db[_0x4b59('0x52')]['hasMany'](db[_0x4b59('0x179')],{'as':_0x4b59('0x150'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'Interactions'});db[_0x4b59('0x52')]['hasMany'](db[_0x4b59('0x53')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x52')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x52')][_0x4b59('0x11a')](db[_0x4b59('0x82')],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db['SmsAccount'][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':'user_has_sms_accounts'});db[_0x4b59('0x53')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db['SmsApplication'][_0x4b59('0x11a')](db[_0x4b59('0x57')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x53')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x53')][_0x4b59('0x11a')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x4b59('0x148')});db['SmsApplication']['belongsTo'](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x115')]['hasMany'](db[_0x4b59('0x179')],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x17a')});db['SmsInteraction']['belongsTo'](db[_0x4b59('0x52')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x177')});db[_0x4b59('0x115')][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['SmsInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x17b'),'as':_0x4b59('0x168')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x17b'),'as':_0x4b59('0x169')});db[_0x4b59('0x115')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_sms_interactions','foreignKey':_0x4b59('0x17a')});db[_0x4b59('0x179')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x12')});db[_0x4b59('0x179')][_0x4b59('0x11a')](db['CmContact'],{'onDelete':'cascade','as':_0x4b59('0x154')});db[_0x4b59('0x179')][_0x4b59('0x11a')](db[_0x4b59('0x115')],{'onDelete':_0x4b59('0x10b'),'as':'Interaction','foreignKey':_0x4b59('0x17a')});db['SmsMessage'][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'as':'Account','foreignKey':_0x4b59('0x177')});db[_0x4b59('0x57')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':_0x4b59('0x33'),'foreignKey':_0x4b59('0x17c')});db[_0x4b59('0x57')]['belongsToMany'](db[_0x4b59('0x121')],{'through':_0x4b59('0x17d'),'as':'Teams'});db['OpenchannelAccount'][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x17e')});db['OpenchannelAccount'][_0x4b59('0x10d')](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x127')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x5e')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')][_0x4b59('0x10d')](db[_0x4b59('0x5b')],{'as':_0x4b59('0x15d'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x59')]['belongsTo'](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db['OpenchannelAccount']['belongsTo'](db[_0x4b59('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x5f')],{'onDelete':_0x4b59('0x16b'),'foreignKey':'OpenchannelQueueId'});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x5b')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':'restrict','foreignKey':_0x4b59('0x148')});db['OpenchannelApplication'][_0x4b59('0x11a')](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x4b59('0x10d')](db[_0x4b59('0x5e')],{'as':_0x4b59('0x150'),'onDelete':'cascade','foreignKey':_0x4b59('0x17f')});db['OpenchannelInteraction'][_0x4b59('0x11a')](db['OpenchannelAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x127')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0x127')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x4b59('0x127')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x180'),'as':_0x4b59('0x168')});db[_0x4b59('0x127')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x4b59('0x127')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x173'),'through':'user_has_openchannel_interactions','foreignKey':_0x4b59('0x17f')});db['OpenchannelMessage'][_0x4b59('0x11a')](db['User'],{'onDelete':'cascade','as':_0x4b59('0x12')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x127')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x17f')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db['Attachment'],{'as':_0x4b59('0xe9'),'foreignKey':_0x4b59('0x175')});db[_0x4b59('0x5e')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x17e')});db[_0x4b59('0x5f')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x4b59('0x181')});db[_0x4b59('0x5f')]['belongsToMany'](db[_0x4b59('0x121')],{'through':_0x4b59('0x182'),'as':_0x4b59('0x14c')});db['ChatWebsite'][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x183')});db[_0x4b59('0x61')]['hasMany'](db[_0x4b59('0x7e')],{'as':'Answers','foreignKey':_0x4b59('0x183')});db['ChatWebsite'][_0x4b59('0x10d')](db[_0x4b59('0x6d')],{'as':_0x4b59('0x184')});db['ChatWebsite'][_0x4b59('0x10d')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4b59('0x61')][_0x4b59('0x10d')](db[_0x4b59('0x64')],{'as':_0x4b59('0x15d')});db[_0x4b59('0x61')][_0x4b59('0x10d')](db[_0x4b59('0x67')],{'as':_0x4b59('0x150')});db[_0x4b59('0x61')]['belongsTo'](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x61')]['belongsTo'](db[_0x4b59('0x147')],{'as':_0x4b59('0x147'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x61')][_0x4b59('0x11a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4b59('0x14a')});db[_0x4b59('0x61')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':_0x4b59('0x185')});db['OpenchannelQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x59')],{});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['OpenchannelQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x127')],{});db[_0x4b59('0x62')][_0x4b59('0x11a')](db[_0x4b59('0x5e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x4b59('0x12')],{});db[_0x4b59('0x62')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x4b59('0x64')]['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x186'),'foreignKey':_0x4b59('0x10c'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x64')]['belongsTo'](db['ChatQueue'],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x188'),'onDelete':'restrict'});db[_0x4b59('0x64')][_0x4b59('0x11a')](db['ChatWebsite'],{'as':_0x4b59('0x189'),'foreignKey':_0x4b59('0x183'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x64')][_0x4b59('0x11a')](db[_0x4b59('0x88')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x16c')});db[_0x4b59('0x65')]['hasMany'](db[_0x4b59('0x67')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x18a')});db['ChatInteraction'][_0x4b59('0x11a')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x4b59('0x183')});db[_0x4b59('0x65')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x65')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':_0x4b59('0x166'),'foreignKey':_0x4b59('0x10c')});db[_0x4b59('0x65')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x18b'),'as':_0x4b59('0x168')});db[_0x4b59('0x65')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'chat_interaction_has_tags','as':_0x4b59('0x169')});db[_0x4b59('0x65')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_chat_interactions','foreignKey':_0x4b59('0x18a')});db[_0x4b59('0x67')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x12')});db[_0x4b59('0x67')]['belongsTo'](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['ChatMessage'][_0x4b59('0x11a')](db[_0x4b59('0x65')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x18a')});db[_0x4b59('0x67')][_0x4b59('0x11a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x4b59('0x175')});db['ChatMessage'][_0x4b59('0x11a')](db['ChatWebsite'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x183')});db[_0x4b59('0x68')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x154'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x4b59('0x11a')](db[_0x4b59('0x61')],{'as':_0x4b59('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x4b59('0x6a')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Agents','through':_0x4b59('0x2d'),'hooks':!![]});db[_0x4b59('0x6a')][_0x4b59('0x11c')](db[_0x4b59('0x121')],{'through':_0x4b59('0x18c'),'as':_0x4b59('0x14c')});db[_0x4b59('0x6b')][_0x4b59('0x10d')](db[_0x4b59('0xcc')],{'as':_0x4b59('0x150'),'foreignKey':_0x4b59('0x18d'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x6b')][_0x4b59('0x11c')](db['User'],{'as':_0x4b59('0x13e'),'through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0x4b59('0x61')],{'as':_0x4b59('0x189'),'foreignKey':_0x4b59('0x183')});db['CmCompany'][_0x4b59('0x10d')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'foreignKey':_0x4b59('0x18e')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':'ContactId'});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db['CmHopperFinal'],{'as':_0x4b59('0x111'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x74')],{'as':_0x4b59('0x141'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')]['hasMany'](db[_0x4b59('0x76')],{'as':_0x4b59('0x76'),'foreignKey':_0x4b59('0x155')});db['CmContact'][_0x4b59('0x10d')](db[_0x4b59('0xd2')],{'as':_0x4b59('0x143'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x127')],{'as':_0x4b59('0x113'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db['CmContact']['hasMany'](db[_0x4b59('0x65')],{'as':_0x4b59('0x114'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x115')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x4b')],{'as':_0x4b59('0x116'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x6f')][_0x4b59('0x10d')](db[_0x4b59('0x3e')],{'as':_0x4b59('0x117'),'foreignKey':'ContactId','onDelete':_0x4b59('0x16b')});db['CmContact'][_0x4b59('0x11a')](db[_0x4b59('0x6e')],{'as':'Company','foreignKey':_0x4b59('0x18e')});db[_0x4b59('0x6f')]['belongsTo'](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f'),'onDelete':'cascade'});db[_0x4b59('0x6f')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x4b59('0x6f')][_0x4b59('0x11c')](db['Tag'],{'as':_0x4b59('0x168'),'through':_0x4b59('0x18f')});db['CmContact'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x18f'),'as':_0x4b59('0x169')});db[_0x4b59('0x70')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x10b')});db['CmHopper'][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x70')][_0x4b59('0x11a')](db['User'],{'as':'Agent','foreignKey':_0x4b59('0x10c')});db['CmHopper'][_0x4b59('0x11a')](db[_0x4b59('0x17')],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x13f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x70')]['belongsTo'](db[_0x4b59('0xe6')],{'as':_0x4b59('0xe6'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x4b59('0x70')][_0x4b59('0x11a')](db['User'],{'as':_0x4b59('0x166'),'foreignKey':'OwnerId'});db[_0x4b59('0x142')]['belongsTo'](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0x17')],{'as':_0x4b59('0x187'),'foreignKey':_0x4b59('0x13f'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0x142')][_0x4b59('0x11a')](db[_0x4b59('0xe6')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0x7c')]['hasMany'](db[_0x4b59('0x80')],{'as':{'plural':'All','singular':_0x4b59('0x190')},'foreignKey':_0x4b59('0x191'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x7c')][_0x4b59('0x10d')](db[_0x4b59('0x80')],{'as':{'plural':'Any','singular':_0x4b59('0x192')},'foreignKey':'AutomationAnyId','onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x7c')]['hasMany'](db[_0x4b59('0x7a')],{'as':_0x4b59('0x193'),'foreignKey':_0x4b59('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x4b59('0x15a')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x195'),'onDelete':_0x4b59('0x10b')});db['Interval']['hasMany'](db[_0x4b59('0x147')],{'as':_0x4b59('0x196'),'foreignKey':_0x4b59('0x148'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x4b59('0x147')][_0x4b59('0x10d')](db['VoiceExtension'],{'as':_0x4b59('0x110'),'foreignKey':_0x4b59('0x148'),'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x42')],{'as':_0x4b59('0x197'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')]['hasMany'](db['ChatApplication'],{'as':_0x4b59('0x198'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x49')],{'as':'FaxApplications','foreignKey':_0x4b59('0x148')});db[_0x4b59('0x147')][_0x4b59('0x10d')](db[_0x4b59('0x53')],{'as':_0x4b59('0x199'),'foreignKey':'IntervalId'});db[_0x4b59('0x85')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{});db[_0x4b59('0x85')]['belongsTo'](db[_0x4b59('0x93')],{'foreignKey':'DefaultReportId'});db[_0x4b59('0x85')][_0x4b59('0x11a')](db[_0x4b59('0x92')],{'foreignKey':_0x4b59('0x19a')});db[_0x4b59('0x87')][_0x4b59('0x11c')](db[_0x4b59('0x13c')],{'as':_0x4b59('0x19b'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x6f')],{'through':'cm_contact_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x65')],{'through':'chat_interaction_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db['MailInteraction'],{'through':_0x4b59('0x167')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0x115')],{'through':_0x4b59('0x17b')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0x4b')],{'through':'fax_interaction_has_tags'});db[_0x4b59('0x88')][_0x4b59('0x11c')](db[_0x4b59('0x127')],{'through':_0x4b59('0x180')});db['Tag'][_0x4b59('0x11c')](db[_0x4b59('0xff')],{'through':_0x4b59('0x19c')});db[_0x4b59('0x8b')]['hasMany'](db[_0x4b59('0x80')],{'as':{'plural':_0x4b59('0x19d'),'singular':_0x4b59('0x19e')},'foreignKey':'TriggerAllId','onDelete':_0x4b59('0x10b'),'hooks':!![]});db[_0x4b59('0x8b')][_0x4b59('0x10d')](db['Condition'],{'as':{'plural':_0x4b59('0x19f'),'singular':_0x4b59('0x1a0')},'foreignKey':_0x4b59('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x4b59('0x8b')][_0x4b59('0x10d')](db[_0x4b59('0x7a')],{'as':_0x4b59('0x193'),'foreignKey':_0x4b59('0x1a2'),'onDelete':_0x4b59('0x10b'),'hooks':!![]});db['AnalyticCustomReport'][_0x4b59('0x10d')](db[_0x4b59('0x97')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x19a'),'hooks':!![]});db['AnalyticDefaultReport'][_0x4b59('0x10d')](db[_0x4b59('0x97')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a4')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a5')});db['AnalyticFieldReport'][_0x4b59('0x11a')](db[_0x4b59('0x96')],{'foreignKey':'MetricId'});db[_0x4b59('0x99')]['hasMany'](db[_0x4b59('0x9b')],{'as':_0x4b59('0x1a6'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db['SalesforceConfiguration']['hasMany'](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1a8'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x9b')][_0x4b59('0x10d')](db['SalesforceField'],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db[_0x4b59('0x9b')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1a3'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x9b')]['belongsTo'](db[_0x4b59('0x99')],{'as':_0x4b59('0x165'),'foreignKey':'AccountId'});db[_0x4b59('0x9d')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x9d')][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['SalesforceField'][_0x4b59('0x10d')](db[_0x4b59('0x9d')],{'as':'Field','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x9d')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0x9f')][_0x4b59('0x10d')](db[_0x4b59('0x1b0')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0x1b0')][_0x4b59('0x10d')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b0')]['hasMany'](db[_0x4b59('0xa2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0x1b0')][_0x4b59('0x10d')](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x1b0')][_0x4b59('0x11a')](db[_0x4b59('0x9f')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db['SugarcrmField']['hasMany'](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xa2')]['hasMany'](db[_0x4b59('0xa2')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xa2')]['hasMany'](db['SugarcrmField'],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['SugarcrmField'][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xa4')][_0x4b59('0x10d')](db[_0x4b59('0xa6')],{'as':_0x4b59('0x1a6'),'onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xa6')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1a8'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xa6')][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xa6')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db['DeskConfiguration']['belongsTo'](db[_0x4b59('0xa4')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xa6')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x1b2')});db[_0x4b59('0xa7')]['hasMany'](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db['DeskField'][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0x4b59('0x10d')](db[_0x4b59('0xa7')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xa7')][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xa8')][_0x4b59('0x10d')](db[_0x4b59('0x1b3')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['ZohoConfiguration'][_0x4b59('0x10d')](db['ZohoField'],{'as':_0x4b59('0x1a8'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b3')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db[_0x4b59('0xaa')],{'as':_0x4b59('0x1a3'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0x1b3')][_0x4b59('0x11a')](db[_0x4b59('0xa8')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xaa')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4b59('0xaa')][_0x4b59('0x10d')](db[_0x4b59('0xaa')],{'as':'Description','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xaa')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':'FieldId'});db[_0x4b59('0xaa')]['belongsTo'](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0x4b59('0x10d')](db[_0x4b59('0xae')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xae')][_0x4b59('0x10d')](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xae')]['hasMany'](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xae')][_0x4b59('0x10d')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x4b59('0xae')]['belongsTo'](db[_0x4b59('0xac')],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db['ZendeskConfiguration'][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x1b5')});db[_0x4b59('0x1b4')][_0x4b59('0x10d')](db['ZendeskField'],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0x1b4')]['hasMany'](db['ZendeskField'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0x1b4')]['hasMany'](db[_0x4b59('0x1b4')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['ZendeskField'][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db[_0x4b59('0xaf')][_0x4b59('0x10d')](db[_0x4b59('0xb1')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['FreshdeskConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1aa'),'onDelete':'cascade','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb1')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1a3'),'onDelete':_0x4b59('0x10b'),'foreignKey':'FieldId'});db[_0x4b59('0xb1')][_0x4b59('0x11a')](db[_0x4b59('0xaf')],{'as':_0x4b59('0x165'),'foreignKey':'AccountId'});db[_0x4b59('0xb1')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb3')][_0x4b59('0x10d')](db[_0x4b59('0xb3')],{'as':_0x4b59('0x1b1'),'foreignKey':'FieldId'});db[_0x4b59('0xb3')][_0x4b59('0x11a')](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x4b59('0x10d')](db[_0x4b59('0xb5')],{'as':'Configurations','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xb5')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xb5')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':'Descriptions','foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xb5')]['hasMany'](db[_0x4b59('0xb7')],{'as':'Fields','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xb5')]['belongsTo'](db['VtigerAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xb7')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1ac'),'foreignKey':'SubjectId'});db[_0x4b59('0xb7')][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['VtigerField'][_0x4b59('0x10d')](db[_0x4b59('0xb7')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db['VtigerField'][_0x4b59('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xb9')][_0x4b59('0x10d')](db[_0x4b59('0xbb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xbb')]['hasMany'](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1a8'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xbb')][_0x4b59('0x10d')](db['ServicenowField'],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xbb')]['hasMany'](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1a3'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x4b59('0x11a')](db['ServicenowAccount'],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xbd')]['hasMany'](db['ServicenowField'],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xbd')][_0x4b59('0x10d')](db['ServicenowField'],{'as':_0x4b59('0x1ad'),'foreignKey':'DescriptionId'});db[_0x4b59('0xbd')][_0x4b59('0x10d')](db[_0x4b59('0xbd')],{'as':_0x4b59('0x1b1'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xbd')][_0x4b59('0x11a')](db['Variable'],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xbf')]['hasMany'](db[_0x4b59('0xc0')],{'as':'Configurations','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc0')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':'Subjects','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a9')});db['Dynamics365Configuration'][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':_0x4b59('0x1aa'),'onDelete':_0x4b59('0x10b'),'foreignKey':'DescriptionId'});db[_0x4b59('0xc0')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':'Fields','onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc0')][_0x4b59('0x11a')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc2')][_0x4b59('0x10d')](db[_0x4b59('0xc2')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db[_0x4b59('0xc2')]['hasMany'](db['Dynamics365Field'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db['Dynamics365Field'][_0x4b59('0x10d')](db['Dynamics365Field'],{'as':_0x4b59('0x1b1'),'foreignKey':'FieldId'});db[_0x4b59('0xc2')][_0x4b59('0x11a')](db['Variable'],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db['FreshsalesAccount'][_0x4b59('0x10d')](db[_0x4b59('0xc5')],{'as':_0x4b59('0x1a6'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1a7')});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db['FreshsalesField'],{'as':_0x4b59('0x1a8'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1aa'),'foreignKey':_0x4b59('0x1ae')});db['FreshsalesConfiguration'][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1a3'),'foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc5')][_0x4b59('0x11a')](db[_0x4b59('0x1b6')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1a7')});db[_0x4b59('0xc7')]['hasMany'](db[_0x4b59('0xc7')],{'as':_0x4b59('0x1ac'),'foreignKey':_0x4b59('0x1a9')});db['FreshsalesField'][_0x4b59('0x10d')](db['FreshsalesField'],{'as':_0x4b59('0x1ad'),'foreignKey':_0x4b59('0x1ae')});db[_0x4b59('0xc7')][_0x4b59('0x10d')](db[_0x4b59('0xc7')],{'as':'Field','foreignKey':_0x4b59('0x1ab')});db[_0x4b59('0xc7')]['belongsTo'](db[_0x4b59('0x8d')],{'as':_0x4b59('0x8d'),'foreignKey':_0x4b59('0x1af')});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x61')],{});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0xf1')],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xca')][_0x4b59('0x11a')](db['CmContact'],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0x65')],{});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x67')],{});db[_0x4b59('0xca')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db[_0x4b59('0xca')]['belongsTo'](db[_0x4b59('0x6a')],{});db[_0x4b59('0xcc')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1b7')});db['ChatInternalMessage']['belongsTo'](db[_0x4b59('0x12')],{'onDelete':'cascade','foreignKey':_0x4b59('0x1b8')});db[_0x4b59('0xd2')][_0x4b59('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0x4b59('0x1b9'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0xd2')]['hasMany'](db[_0x4b59('0xce')],{'foreignKey':_0x4b59('0x1b9'),'onDelete':_0x4b59('0x10b')});db['SmsQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x52')],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0xf1')],{'as':'List','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db['SmsInteraction'],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db['SmsMessage'],{});db[_0x4b59('0x1ba')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db['SmsQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x57')],{});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db['JscriptySessionReport'],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db[_0x4b59('0xd0')],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xd8')][_0x4b59('0x10d')](db[_0x4b59('0xce')],{'foreignKey':_0x4b59('0x1bb')});db[_0x4b59('0xde')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_square_projects'});db[_0x4b59('0x121')]['belongsToMany'](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_teams'});db['Team'][_0x4b59('0x11c')](db[_0x4b59('0x17')],{'through':_0x4b59('0x14d'),'as':_0x4b59('0x12a')});db['Team'][_0x4b59('0x11c')](db[_0x4b59('0x163')],{'through':_0x4b59('0x1bc'),'as':_0x4b59('0x1bd')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x4b59('0x1be')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db['FaxQueue'],{'through':_0x4b59('0x176'),'as':_0x4b59('0x12b')});db[_0x4b59('0x121')][_0x4b59('0x11c')](db[_0x4b59('0x57')],{'through':_0x4b59('0x17d'),'as':_0x4b59('0x1bf')});db['Team']['belongsToMany'](db[_0x4b59('0x5f')],{'through':_0x4b59('0x182'),'as':_0x4b59('0x12c')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x4b59('0xe6')]['hasMany'](db[_0x4b59('0x70')],{'as':_0x4b59('0x140'),'foreignKey':_0x4b59('0x1c0')});db[_0x4b59('0xe6')][_0x4b59('0x10d')](db[_0x4b59('0x72')],{'as':'HopperFinals','foreignKey':_0x4b59('0x1c0')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0x4b59('0x141'),'foreignKey':_0x4b59('0x1c0')});db[_0x4b59('0xe6')][_0x4b59('0x10d')](db[_0x4b59('0x142')],{'as':_0x4b59('0x1c1'),'foreignKey':'CampaignId'});db[_0x4b59('0xe6')][_0x4b59('0x11a')](db['Trunk'],{'as':'Trunk','foreignKey':_0x4b59('0x144')});db['Campaign'][_0x4b59('0x11a')](db[_0x4b59('0x26')],{'as':_0x4b59('0x145'),'foreignKey':'TrunkBackupId'});db[_0x4b59('0xe6')][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign'][_0x4b59('0x11a')](db[_0x4b59('0xde')],{'as':_0x4b59('0xde'),'foreignKey':_0x4b59('0x1c2')});db[_0x4b59('0xe6')][_0x4b59('0x11c')](db[_0x4b59('0xf1')],{'as':_0x4b59('0x1c3'),'through':'campaigns_has_cm_lists'});db[_0x4b59('0xe6')]['belongsToMany'](db[_0x4b59('0xf1')],{'as':_0x4b59('0x14e'),'through':_0x4b59('0x1c4')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x40')],{});db[_0x4b59('0x1c5')]['belongsTo'](db['MailInteraction'],{});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x3a')],{'foreignKey':_0x4b59('0x1c6'),'as':_0x4b59('0x1c7')});db['MailTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0x1c5')][_0x4b59('0x11a')](db[_0x4b59('0x163')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x4b59('0x11a')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x4b59('0x1cc')});db[_0x4b59('0xea')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x65')],{});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['ChatWebsite'],{'foreignKey':_0x4b59('0x1cd'),'as':_0x4b59('0x1c7')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['User'],{'foreignKey':'ToUserId','as':_0x4b59('0x1cb')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db['ChatQueue'],{'foreignKey':_0x4b59('0x1ce'),'as':_0x4b59('0x1cf')});db[_0x4b59('0xea')][_0x4b59('0x11a')](db[_0x4b59('0x61')],{'foreignKey':_0x4b59('0x1d0'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db['FaxMessage'],{});db[_0x4b59('0xec')][_0x4b59('0x11a')](db[_0x4b59('0x4b')],{});db['FaxTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'foreignKey':_0x4b59('0x1d1'),'as':_0x4b59('0x1c7')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db['FaxTransferReport'][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0xec')][_0x4b59('0x11a')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x4b59('0x1cf')});db['FaxTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x47')],{'foreignKey':_0x4b59('0x1d2'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xee')][_0x4b59('0x11a')](db['OpenchannelMessage'],{});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x127')],{});db['OpenchannelTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x4b59('0x1c7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':'FromAgent'});db[_0x4b59('0xee')][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':'ToAgent'});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x4b59('0x1cf')});db[_0x4b59('0xee')][_0x4b59('0x11a')](db[_0x4b59('0x59')],{'foreignKey':_0x4b59('0x1d3'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x115')],{});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'foreignKey':_0x4b59('0x1d4'),'as':_0x4b59('0x1c7')});db['SmsTransferReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':_0x4b59('0x1c9')});db['SmsTransferReport'][_0x4b59('0x11a')](db['User'],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0xf0')]['belongsTo'](db[_0x4b59('0x57')],{'foreignKey':_0x4b59('0x1d5'),'as':_0x4b59('0x1cf')});db[_0x4b59('0xf0')][_0x4b59('0x11a')](db[_0x4b59('0x52')],{'foreignKey':_0x4b59('0x1d6'),'as':_0x4b59('0x1cc')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db['Disposition'],{'as':_0x4b59('0x15b'),'foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x78')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x11f'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x15f')});db['CmList'][_0x4b59('0x10d')](db[_0x4b59('0x72')],{'as':'HopperFinals','foreignKey':_0x4b59('0x15f')});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db[_0x4b59('0x74')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x4b59('0xf1')][_0x4b59('0x10d')](db['ReportAgentPreview'],{'as':_0x4b59('0x76'),'foreignKey':_0x4b59('0x15f')});db['CmList']['belongsToMany'](db[_0x4b59('0x17')],{'as':_0x4b59('0x1d7'),'through':_0x4b59('0x14b')});db[_0x4b59('0xf1')]['belongsToMany'](db['User'],{'as':_0x4b59('0x162'),'through':'cm_user_has_lists'});db[_0x4b59('0xf3')]['hasMany'](db[_0x4b59('0x16')],{'as':_0x4b59('0x110'),'onDelete':_0x4b59('0x10b')});db[_0x4b59('0xf3')]['belongsToMany'](db['User'],{'as':_0x4b59('0x162'),'through':'user_has_voice_prefixes'});db[_0x4b59('0xf5')]['hasMany'](db['User'],{'as':_0x4b59('0x173'),'foreignKey':_0x4b59('0x11b')});db[_0x4b59('0xf5')][_0x4b59('0x10d')](db[_0x4b59('0xf7')],{'as':_0x4b59('0x1d8'),'foreignKey':'userProfileId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0xf7')][_0x4b59('0x10d')](db[_0x4b59('0xf9')],{'as':_0x4b59('0x1d9'),'foreignKey':'sectionId','onDelete':_0x4b59('0x10b')});db[_0x4b59('0xfc')][_0x4b59('0x10d')](db[_0x4b59('0x15a')],{'as':'Dispositions','foreignKey':_0x4b59('0x1da')});db[_0x4b59('0xfc')]['hasMany'](db[_0x4b59('0x7e')],{'as':_0x4b59('0x178'),'foreignKey':_0x4b59('0x1da')});db[_0x4b59('0xfc')][_0x4b59('0x10d')](db[_0x4b59('0x101')],{'as':_0x4b59('0x150'),'foreignKey':'WhatsappAccountId'});db[_0x4b59('0xfc')]['hasMany'](db[_0x4b59('0xff')],{'as':_0x4b59('0x15c')});db['WhatsappAccount'][_0x4b59('0x10d')](db['WhatsappApplication'],{'as':_0x4b59('0x15d')});db[_0x4b59('0xfc')][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['WhatsappAccount']['belongsTo'](db['Pause'],{'as':_0x4b59('0x149'),'foreignKey':_0x4b59('0x14a')});db[_0x4b59('0xfc')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':'user_has_whatsapp_accounts'});db[_0x4b59('0x1db')]['belongsTo'](db[_0x4b59('0x12')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x1db')]['belongsTo'](db[_0x4b59('0x106')],{'onDelete':_0x4b59('0x16b')});db[_0x4b59('0x1db')][_0x4b59('0x11a')](db['WhatsappAccount'],{'onDelete':_0x4b59('0x16b')});db['WhatsappApplication'][_0x4b59('0x11a')](db[_0x4b59('0x147')],{'onDelete':_0x4b59('0x16b'),'foreignKey':_0x4b59('0x148')});db[_0x4b59('0x1db')][_0x4b59('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4b59('0x16c')});db[_0x4b59('0xff')][_0x4b59('0x10d')](db[_0x4b59('0x101')],{'as':_0x4b59('0x150'),'onDelete':_0x4b59('0x10b'),'foreignKey':_0x4b59('0x1dc')});db['WhatsappInteraction'][_0x4b59('0x11a')](db[_0x4b59('0xfc')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1da')});db['WhatsappInteraction'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b59('0xff')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'as':'Owner','foreignKey':_0x4b59('0x10c')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x19c'),'as':_0x4b59('0x168')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x88')],{'through':_0x4b59('0x19c'),'as':_0x4b59('0x169')});db[_0x4b59('0xff')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0x4b59('0x1dc')});db['WhatsappMessage']['belongsTo'](db[_0x4b59('0x12')],{'as':_0x4b59('0x12')});db['WhatsappMessage'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'onDelete':_0x4b59('0x10b'),'as':'Contact'});db[_0x4b59('0x101')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x4b59('0x10b'),'as':_0x4b59('0x16a'),'foreignKey':_0x4b59('0x1dc')});db[_0x4b59('0x101')]['belongsTo'](db[_0x4b59('0xfc')],{'as':_0x4b59('0x165'),'foreignKey':_0x4b59('0x1da')});db[_0x4b59('0x1dd')][_0x4b59('0x11a')](db[_0x4b59('0xfc')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db['CmList'],{'as':_0x4b59('0x15e'),'foreignKey':_0x4b59('0x15f')});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x6f')],{'as':_0x4b59('0x154'),'foreignKey':_0x4b59('0x155')});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0xff')],{});db[_0x4b59('0x1dd')][_0x4b59('0x11a')](db[_0x4b59('0x106')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x101')],{});db['WhatsappQueueReport'][_0x4b59('0x11a')](db[_0x4b59('0x12')],{});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0x101')],{});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0xff')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x4b59('0x1de'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x4b59('0xfc')],{'foreignKey':'ToWhatsappAccountId','as':_0x4b59('0x1cc')});db[_0x4b59('0x104')][_0x4b59('0x11a')](db['WhatsappQueue'],{'foreignKey':_0x4b59('0x1df'),'as':_0x4b59('0x1cf')});db[_0x4b59('0x104')][_0x4b59('0x11a')](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1c8'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x4b59('0x12')],{'foreignKey':_0x4b59('0x1ca'),'as':_0x4b59('0x1cb')});db[_0x4b59('0x106')][_0x4b59('0x11c')](db[_0x4b59('0x12')],{'as':_0x4b59('0x162'),'through':_0x4b59('0x37'),'foreignKey':_0x4b59('0x1e0')});db['WhatsappQueue'][_0x4b59('0x11c')](db['Team'],{'through':_0x4b59('0x1e1'),'as':_0x4b59('0x14c')});module[_0x4b59('0x1e2')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb078=['../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','cascade','UserId','hasMany','Recordings','Extensions','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','team_has_voice_queues','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Dispositions','MailMessage','Messages','Interactions','List','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','restrict','TagId','MailQueueReport','Items','FaxAccountId','Answers','Exntensions','FaxMessage','ListId','fax_interaction_has_tags','FaxInteractionId','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','mandatoryDispositionPause','SmsQueue','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','ChatMessage','OpenchannelQueueReport','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CompanyId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','Subjects','Descriptions','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','Dynamics365Configuration','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','user_has_voice_prefixes','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','mysql','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile'];(function(_0x4d4ee4,_0x5b03f9){var _0x2eae51=function(_0x27c9df){while(--_0x27c9df){_0x4d4ee4['push'](_0x4d4ee4['shift']());}};_0x2eae51(++_0x5b03f9);}(_0xb078,0xfa));var _0x8b07=function(_0x252daf,_0x3335f7){_0x252daf=_0x252daf-0x0;var _0x235cc2=_0xb078[_0x252daf];return _0x235cc2;};'use strict';var path=require(_0x8b07('0x0'));var config=require(_0x8b07('0x1'));var Sequelize=require(_0x8b07('0x2'));var _=require(_0x8b07('0x3'));var jstz=require(_0x8b07('0x4'));var timezone=jstz[_0x8b07('0x5')]();config[_0x8b07('0x2')]=_[_0x8b07('0x6')](config['sequelize'],{'database':'motion2','username':_0x8b07('0x7'),'password':_0x8b07('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8b07('0x9')},'logging':![],'timezone':timezone[_0x8b07('0xa')](),'define':{'charset':_0x8b07('0xb'),'collate':'utf8_general_ci'}}});config[_0x8b07('0xc')]=_['defaultsDeep'](config[_0x8b07('0xc')],{'database':'motion2','username':'xcall','password':_0x8b07('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8b07('0xd'),'dialectOptions':{'charset':_0x8b07('0x9')},'logging':![],'timezone':timezone[_0x8b07('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b07('0x2')][_0x8b07('0xe')],config[_0x8b07('0x2')][_0x8b07('0xf')],config[_0x8b07('0x2')][_0x8b07('0x10')],config[_0x8b07('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b07('0xc')][_0x8b07('0xe')],config[_0x8b07('0xc')]['username'],config[_0x8b07('0xc')][_0x8b07('0x10')],config[_0x8b07('0xc')]['options'])};db['User']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x12'));db[_0x8b07('0x13')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x14'));db[_0x8b07('0x15')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceContext/voiceContext.model');db[_0x8b07('0x16')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x17'));db['VoiceMusicOnHold']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x18'));db[_0x8b07('0x19')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x1a'));db[_0x8b07('0x1b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x1c'));db[_0x8b07('0x1d')]=db['sequelize'][_0x8b07('0x11')]('../api/screenRecording/screenRecording.model');db[_0x8b07('0x1e')]=db['sequelize']['import'](_0x8b07('0x1f'));db[_0x8b07('0x20')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8b07('0x21')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x22'));db['VoiceAgentReport']=db['sequelize']['import'](_0x8b07('0x23'));db[_0x8b07('0x24')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x25'));db[_0x8b07('0x26')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x27'));db[_0x8b07('0x28')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x29'));db[_0x8b07('0x2a')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x2b'));db[_0x8b07('0x2c')]=db['sequelize'][_0x8b07('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8b07('0x2d')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x2e'));db[_0x8b07('0x2f')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x30'));db['UserMailQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x31'));db[_0x8b07('0x32')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x33'));db[_0x8b07('0x34')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x35'));db['UserWhatsappQueue']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x36'));db[_0x8b07('0x37')]=db['sequelize'][_0x8b07('0x11')]('../api/mailServerIn/mailServerIn.model');db[_0x8b07('0x38')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x39'));db[_0x8b07('0x3a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x3b'));db[_0x8b07('0x3c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x3d'));db[_0x8b07('0x3e')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x3f'));db[_0x8b07('0x40')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x41'));db['MailMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x42'));db[_0x8b07('0x43')]=db['sequelize']['import'](_0x8b07('0x44'));db['MailQueueReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x45'));db[_0x8b07('0x46')]=db['sequelize'][_0x8b07('0x11')]('../api/dashboard/dashboard.model');db[_0x8b07('0x47')]=db['sequelize']['import'](_0x8b07('0x48'));db[_0x8b07('0x49')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x4a'));db[_0x8b07('0x4b')]=db['sequelize'][_0x8b07('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x4c'));db[_0x8b07('0x4d')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x4e'));db[_0x8b07('0x4f')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x50'));db[_0x8b07('0x51')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x52'));db[_0x8b07('0x53')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x54'));db[_0x8b07('0x55')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x56'));db['SmsQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x57'));db[_0x8b07('0x58')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x59'));db[_0x8b07('0x5a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x5b'));db[_0x8b07('0x5c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x5d'));db[_0x8b07('0x5e')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x5f'));db['OpenchannelQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x60'));db['ChatWebsite']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x61'));db['OpenchannelQueueReport']=db[_0x8b07('0x2')]['import'](_0x8b07('0x62'));db[_0x8b07('0x63')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x64'));db['ChatInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x65'));db['ChatMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x66'));db[_0x8b07('0x67')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x68'));db[_0x8b07('0x69')]=db['sequelize']['import'](_0x8b07('0x6a'));db[_0x8b07('0x6b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x6c'));db[_0x8b07('0x6d')]=db[_0x8b07('0x2')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x8b07('0x2')]['import'](_0x8b07('0x6e'));db[_0x8b07('0x6f')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x70'));db[_0x8b07('0x71')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/cmHopper/cmHopper.model');db[_0x8b07('0x72')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x73'));db[_0x8b07('0x74')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x75'));db[_0x8b07('0x76')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x77'));db[_0x8b07('0x78')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x79'));db[_0x8b07('0x7a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7b'));db[_0x8b07('0x7c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7d'));db[_0x8b07('0x7e')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7f'));db[_0x8b07('0x80')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x81'));db[_0x8b07('0x82')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x83'));db[_0x8b07('0x84')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x85'));db[_0x8b07('0x86')]=db[_0x8b07('0x2')]['import']('../api/interval/interval.model');db[_0x8b07('0x87')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/pause/pause.model');db[_0x8b07('0x88')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x89'));db[_0x8b07('0x8a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8b'));db[_0x8b07('0x8c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8d'));db[_0x8b07('0x8e')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8f'));db[_0x8b07('0x90')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x91'));db[_0x8b07('0x92')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/template/template.model');db[_0x8b07('0x93')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x94'));db['Variable']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/variable/variable.model');db[_0x8b07('0x95')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x96'));db['IntegrationReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x97'));db['AnalyticCustomReport']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8b07('0x98')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x99'));db[_0x8b07('0x9a')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x8b07('0x9b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9c'));db[_0x8b07('0x9d')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9e'));db['AnalyticTreeReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9f'));db[_0x8b07('0xa0')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xa1'));db[_0x8b07('0xa2')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x8b07('0xa3')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xa4'));db[_0x8b07('0xa5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xa6'));db[_0x8b07('0xa7')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8b07('0xa8')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xa9'));db[_0x8b07('0xaa')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xab'));db[_0x8b07('0xac')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xad'));db[_0x8b07('0xae')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xaf'));db['ZohoAccount']=db[_0x8b07('0x2')]['import'](_0x8b07('0xb0'));db['ZohoConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb1'));db[_0x8b07('0xb2')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb3'));db[_0x8b07('0xb4')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb5'));db[_0x8b07('0xb6')]=db['sequelize'][_0x8b07('0x11')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb7'));db['FreshdeskConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb8'));db[_0x8b07('0xb9')]=db[_0x8b07('0x2')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8b07('0xba')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xbb'));db['VtigerConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xbc'));db[_0x8b07('0xbd')]=db[_0x8b07('0x2')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x8b07('0x2')]['import'](_0x8b07('0xbe'));db[_0x8b07('0xbf')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc0'));db[_0x8b07('0xc1')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xc2'));db['Dynamics365Account']=db['sequelize']['import'](_0x8b07('0xc3'));db['Dynamics365Configuration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc4'));db[_0x8b07('0xc5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc6'));db[_0x8b07('0xc7')]=db[_0x8b07('0x2')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x8b07('0xc8')]=db[_0x8b07('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xc9'));db[_0x8b07('0x95')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x96'));db['Network']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xca'));db[_0x8b07('0xcb')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xcc'));db[_0x8b07('0xcd')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xce'));db[_0x8b07('0xcf')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xd0'));db[_0x8b07('0xd1')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xd2'));db[_0x8b07('0xd3')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd4'));db['SmsQueueReport']=db['sequelize'][_0x8b07('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0x8b07('0xd5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd6'));db[_0x8b07('0xd7')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd8'));db[_0x8b07('0xd9')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xda'));db[_0x8b07('0xdb')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/squareOdbc/squareOdbc.model');db[_0x8b07('0xdc')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xdd'));db['SquareRecording']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/squareRecording/squareRecording.model');db[_0x8b07('0xde')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xdf'));db[_0x8b07('0xe0')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe1'));db[_0x8b07('0xe2')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xe3'));db[_0x8b07('0xe4')]=db[_0x8b07('0x2')]['import']('../api/campaign/campaign.model');db['Migration']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/migration/migration.model');db['Attachment']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe5'));db[_0x8b07('0xe6')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe7'));db[_0x8b07('0xe8')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe9'));db[_0x8b07('0xea')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xeb'));db['FaxTransferReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xec'));db[_0x8b07('0xed')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x8b07('0xee')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/cmList/cmList.model');db[_0x8b07('0xef')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xf0'));db[_0x8b07('0xf1')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf2'));db[_0x8b07('0xf3')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0x8b07('0xf4')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf5'));db[_0x8b07('0xf6')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf7'));db[_0x8b07('0xf8')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf9'));db[_0x8b07('0xfa')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xfb'));db['WhatsappInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x8b07('0xfc')]=db['sequelize']['import'](_0x8b07('0xfd'));db[_0x8b07('0xfe')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x8b07('0xff')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x100'));db[_0x8b07('0x101')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x102'));db[_0x8b07('0x103')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x104'));db[_0x8b07('0x105')][_0x8b07('0x106')](db[_0x8b07('0x1e')],{'as':_0x8b07('0x1e'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x1b')],{'as':_0x8b07('0x10a'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0x8b07('0x109')](db['VoiceExtension'],{'as':_0x8b07('0x10b'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x105')]['hasMany'](db[_0x8b07('0x74')],{'as':'HopperFinals','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x10c'),'foreignKey':'UserId'});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x78')],{'as':_0x8b07('0x78'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'foreignKey':_0x8b07('0x108')});db['User'][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':_0x8b07('0x10f'),'foreignKey':'UserId'});db[_0x8b07('0x105')][_0x8b07('0x109')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':_0x8b07('0x111'),'foreignKey':'UserId'});db[_0x8b07('0x105')]['hasMany'](db[_0x8b07('0x40')],{'as':'MailInteractions','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db['WhatsappInteraction'],{'as':_0x8b07('0x112'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0xf6')],{'as':_0x8b07('0x113'),'foreignKey':_0x8b07('0x114')});db[_0x8b07('0x105')][_0x8b07('0x115')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x8b07('0x116')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x6b')],{'as':'Groups','through':_0x8b07('0x118')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x6f')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x119')],{'as':_0x8b07('0x11a'),'through':_0x8b07('0x11b')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x11c')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x40')],{'as':_0x8b07('0x11d'),'through':_0x8b07('0x11e')});db[_0x8b07('0x105')][_0x8b07('0x117')](db['ChatInteraction'],{'as':_0x8b07('0x10f'),'through':_0x8b07('0x11f')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x110')],{'as':'FaxInteractions','through':_0x8b07('0x120')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x55')],{'as':_0x8b07('0x121'),'through':_0x8b07('0x122')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'through':_0x8b07('0x123')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x124')],{'as':_0x8b07('0x112'),'through':_0x8b07('0x125')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x19')],{'as':'VoiceQueues','through':_0x8b07('0x2d'),'required':![]});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x3c')],{'as':_0x8b07('0x126'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0x8b07('0x127'),'through':_0x8b07('0x2f'),'required':![],'hooks':!![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x4d')],{'as':_0x8b07('0x128'),'through':_0x8b07('0x129'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db['SmsQueue'],{'as':_0x8b07('0x12a'),'through':_0x8b07('0x32'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x12b')],{'as':_0x8b07('0x12c'),'through':_0x8b07('0x34'),'required':![]});db['User'][_0x8b07('0x117')](db['WhatsappQueue'],{'as':_0x8b07('0x12d'),'through':_0x8b07('0x12e'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x119')],{'through':_0x8b07('0x11b')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xef')],{'as':_0x8b07('0x12f'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x8b07('0x117')](db[_0x8b07('0x130')],{'as':_0x8b07('0x131'),'through':_0x8b07('0x132')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x49')],{'as':_0x8b07('0x133'),'through':_0x8b07('0x134')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x3a')],{'as':'MailAccounts','through':_0x8b07('0x135')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x58')],{'as':_0x8b07('0x136'),'through':_0x8b07('0x137')});db[_0x8b07('0x105')][_0x8b07('0x117')](db['SmsAccount'],{'as':_0x8b07('0x138'),'through':_0x8b07('0x139')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xf8')],{'as':_0x8b07('0x13a'),'through':_0x8b07('0x13b')});db['User'][_0x8b07('0x117')](db['SquareProject'],{'as':'SquareProjects','through':_0x8b07('0x13c')});db[_0x8b07('0x13')][_0x8b07('0x109')](db['VoiceExtension'],{'as':_0x8b07('0x13d'),'onDelete':_0x8b07('0x107'),'foreignKey':'ChanSpyId'});db[_0x8b07('0x15')][_0x8b07('0x109')](db['VoiceExtension'],{'onDelete':_0x8b07('0x107')});db[_0x8b07('0x16')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x13e'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x13f')][_0x8b07('0x117')](db[_0x8b07('0x8e')],{'as':_0x8b07('0x140'),'through':_0x8b07('0x141')});db[_0x8b07('0x19')][_0x8b07('0x109')](db[_0x8b07('0x2c')],{'as':_0x8b07('0x142'),'foreignKey':_0x8b07('0x143')});db[_0x8b07('0x19')][_0x8b07('0x109')](db[_0x8b07('0x71')],{'as':'Hoppers','foreignKey':_0x8b07('0x143')});db['VoiceQueue']['hasMany'](db[_0x8b07('0x74')],{'as':_0x8b07('0x144'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x145'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db['ReportAgentPreview'],{'as':_0x8b07('0x78'),'foreignKey':'VoiceQueueId'});db[_0x8b07('0x19')]['hasMany'](db['CmHopperBlack'],{'as':_0x8b07('0x146'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x8b07('0x143')});db[_0x8b07('0x19')][_0x8b07('0x115')](db[_0x8b07('0x28')],{'as':_0x8b07('0x28'),'foreignKey':_0x8b07('0x147')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x8b07('0x148'),'foreignKey':_0x8b07('0x149')});db[_0x8b07('0x19')][_0x8b07('0x115')](db['Interval'],{'as':'Interval','foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x19')]['belongsTo'](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db['VoiceQueue'][_0x8b07('0x117')](db['CmList'],{'as':_0x8b07('0x11a'),'through':'voice_queues_has_cm_lists'});db[_0x8b07('0x19')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x8b07('0x19')]['belongsToMany'](db[_0x8b07('0xe0')],{'as':_0x8b07('0x14c'),'through':_0x8b07('0x14d')});db[_0x8b07('0x19')][_0x8b07('0x117')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x8b07('0x1b')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105'),'foreignKey':'UserId'});db[_0x8b07('0x1d')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x105'),'foreignKey':_0x8b07('0x108')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x14e'),'sourceKey':_0x8b07('0x14f')});db[_0x8b07('0x20')]['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x8b07('0x14f')});db['VoiceCallReport'][_0x8b07('0x109')](db[_0x8b07('0x24')],{'as':_0x8b07('0x150'),'foreignKey':_0x8b07('0x151'),'constraints':![]});db[_0x8b07('0x152')][_0x8b07('0x109')](db[_0x8b07('0x153')],{'as':_0x8b07('0x154'),'foreignKey':_0x8b07('0x151'),'constraints':![]});db[_0x8b07('0x152')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':'User','foreignKey':'UserId'});db[_0x8b07('0x152')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x37')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'as':_0x8b07('0x3a'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x38')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'as':_0x8b07('0x3a'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x3a')][_0x8b07('0x106')](db[_0x8b07('0x37')],{'as':'Imap','onDelete':_0x8b07('0x107')});db[_0x8b07('0x3a')][_0x8b07('0x106')](db[_0x8b07('0x38')],{'as':'Smtp','onDelete':_0x8b07('0x107')});db['MailAccount']['hasMany'](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x3a')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x8b07('0x3a')]['hasMany'](db[_0x8b07('0x159')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x157')});db['MailAccount']['hasMany'](db[_0x8b07('0x40')],{'as':_0x8b07('0x15b')});db[_0x8b07('0x3a')][_0x8b07('0x109')](db[_0x8b07('0x43')],{'as':_0x8b07('0x13e')});db[_0x8b07('0x3a')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db[_0x8b07('0x3a')]['belongsTo'](db[_0x8b07('0x92')],{'as':_0x8b07('0x92'),'foreignKey':'TemplateId'});db[_0x8b07('0x3a')][_0x8b07('0x115')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x8b07('0x105')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x15e'),'as':_0x8b07('0x14c')});db[_0x8b07('0x40')][_0x8b07('0x109')](db['MailMessage'],{'as':_0x8b07('0x15a'),'onDelete':'cascade','foreignKey':_0x8b07('0x15f')});db[_0x8b07('0x40')]['belongsTo'](db[_0x8b07('0x3a')],{'as':_0x8b07('0x160'),'foreignKey':'MailAccountId'});db[_0x8b07('0x40')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x40')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x40')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x162'),'as':_0x8b07('0x163')});db[_0x8b07('0x40')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x162'),'as':_0x8b07('0x164')});db['MailInteraction'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':'user_has_mail_interactions','foreignKey':_0x8b07('0x15f')});db[_0x8b07('0x159')][_0x8b07('0x109')](db['Attachment'],{'as':'Attachments','onDelete':_0x8b07('0x107')});db['MailMessage'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db['MailMessage'][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db[_0x8b07('0x159')]['belongsTo'](db[_0x8b07('0x40')],{'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x15f')});db['MailMessage'][_0x8b07('0x115')](db['MailAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x43')][_0x8b07('0x115')](db['User'],{'onDelete':'restrict'});db[_0x8b07('0x43')][_0x8b07('0x115')](db[_0x8b07('0x3c')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x43')][_0x8b07('0x115')](db['MailAccount'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x43')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db['MailApplication'][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db[_0x8b07('0x169')]['belongsTo'](db[_0x8b07('0x3a')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['MailQueueReport'][_0x8b07('0x115')](db['CmContact'],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x169')]['belongsTo'](db[_0x8b07('0x40')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db[_0x8b07('0x159')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db['User'],{});db['MailQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x3c')],{});db[_0x8b07('0x46')]['hasMany'](db[_0x8b07('0x47')],{'as':_0x8b07('0x16a'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x49')][_0x8b07('0x109')](db['CannedAnswer'],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':_0x8b07('0x15b')});db[_0x8b07('0x49')]['hasMany'](db['FaxApplication'],{'as':_0x8b07('0x13e')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x16d'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x49')]['hasMany'](db[_0x8b07('0x16e')],{'as':_0x8b07('0x15a')});db[_0x8b07('0x49')][_0x8b07('0x115')](db[_0x8b07('0x28')],{'as':_0x8b07('0x28')});db['FaxAccount']['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x49')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x49')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':'user_has_fax_accounts'});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db['FaxApplication'][_0x8b07('0x115')](db[_0x8b07('0x4d')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':'restrict','foreignKey':_0x8b07('0x168')});db[_0x8b07('0x110')]['hasMany'](db['FaxMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':'FaxInteractionId'});db[_0x8b07('0x110')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x110')]['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x110')][_0x8b07('0x115')](db['User'],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db['FaxInteraction'][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'fax_interaction_has_tags','as':_0x8b07('0x163')});db[_0x8b07('0x110')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x170'),'as':_0x8b07('0x164')});db[_0x8b07('0x110')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x120'),'foreignKey':_0x8b07('0x171')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x8b07('0x107'),'as':'User'});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x110')],{'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x171')});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':_0x8b07('0x172'),'foreignKey':_0x8b07('0x173')});db[_0x8b07('0x16e')]['belongsTo'](db[_0x8b07('0x49')],{'as':_0x8b07('0x160'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x129')});db[_0x8b07('0x4d')]['belongsToMany'](db[_0x8b07('0xe0')],{'through':_0x8b07('0x174'),'as':'Teams'});db[_0x8b07('0x4f')][_0x8b07('0x115')](db['FaxAccount'],{});db['FaxQueueReport'][_0x8b07('0x115')](db['CmList'],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x4f')]['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x110')],{});db[_0x8b07('0x4f')]['belongsTo'](db['FaxMessage'],{});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x4d')],{});db['SmsAccount'][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':'Dispositions','foreignKey':_0x8b07('0x175')});db[_0x8b07('0x51')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x175')});db[_0x8b07('0x51')][_0x8b07('0x109')](db[_0x8b07('0x176')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x175')});db['SmsAccount'][_0x8b07('0x109')](db['SmsInteraction'],{'as':'Interactions'});db[_0x8b07('0x51')]['hasMany'](db['SmsApplication'],{'as':'Applications'});db['SmsAccount'][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x8b07('0x177'),'foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x51')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x139')});db['SmsApplication'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')][_0x8b07('0x115')](db[_0x8b07('0x178')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')][_0x8b07('0x115')](db['SmsAccount'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')]['belongsTo'](db[_0x8b07('0x86')],{'onDelete':'restrict','foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x53')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db['SmsInteraction']['hasMany'](db['SmsMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x55')]['belongsTo'](db['SmsAccount'],{'as':_0x8b07('0x160'),'foreignKey':'SmsAccountId'});db[_0x8b07('0x55')]['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b07('0x55')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x55')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction'][_0x8b07('0x117')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8b07('0x164')});db['SmsInteraction'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x122'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x176')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db[_0x8b07('0x176')]['belongsTo'](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155')});db['SmsMessage'][_0x8b07('0x115')](db[_0x8b07('0x55')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x176')]['belongsTo'](db[_0x8b07('0x51')],{'as':'Account','foreignKey':_0x8b07('0x175')});db['SmsQueue'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x32'),'foreignKey':_0x8b07('0x17a')});db['SmsQueue'][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x17b'),'as':_0x8b07('0x14c')});db[_0x8b07('0x58')]['hasMany'](db[_0x8b07('0x82')],{'as':'Dispositions','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x58')]['hasMany'](db[_0x8b07('0x5c')],{'as':_0x8b07('0x15b'),'foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x5e')],{'as':_0x8b07('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x5a')],{'as':'Applications','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x58')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':_0x8b07('0x177'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x137')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':'restrict'});db[_0x8b07('0x5a')]['belongsTo'](db[_0x8b07('0x12b')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x17d')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x58')],{'onDelete':'restrict','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db['OpenchannelApplication'][_0x8b07('0x115')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x8b07('0x168')});db[_0x8b07('0x5c')]['hasMany'](db[_0x8b07('0x5e')],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':'OpenchannelInteractionId'});db[_0x8b07('0x5c')][_0x8b07('0x115')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x5c')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x5c')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x17e'),'as':_0x8b07('0x163')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x17e'),'as':_0x8b07('0x164')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Users','through':_0x8b07('0x123'),'foreignKey':_0x8b07('0x17f')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db['User'],{'onDelete':'cascade','as':_0x8b07('0x105')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x8b07('0x17f')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':'Attachment','foreignKey':_0x8b07('0x173')});db[_0x8b07('0x5e')]['belongsTo'](db[_0x8b07('0x58')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x12b')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x8b07('0x12b')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':'team_has_openchannel_queues','as':_0x8b07('0x14c')});db['ChatWebsite'][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':'ChatWebsiteId'});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x180')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x6d')],{'as':_0x8b07('0x181')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':_0x8b07('0x15b')});db['ChatWebsite'][_0x8b07('0x109')](db[_0x8b07('0x63')],{'as':_0x8b07('0x13e')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x182')],{'as':'Messages'});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'as':_0x8b07('0x86'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':_0x8b07('0x177'),'foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x130')]['belongsToMany'](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x132')});db[_0x8b07('0x183')][_0x8b07('0x115')](db['OpenchannelAccount'],{});db[_0x8b07('0x183')]['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db['OpenchannelQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b07('0x183')]['belongsTo'](db[_0x8b07('0x5c')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x5e')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x12b')],{});db[_0x8b07('0x63')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':'Agent','foreignKey':_0x8b07('0x108'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')]['belongsTo'](db[_0x8b07('0x69')],{'as':_0x8b07('0x184'),'foreignKey':'ChatQueueId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')]['belongsTo'](db[_0x8b07('0x130')],{'as':_0x8b07('0x185'),'foreignKey':'ChatWebsiteId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':'TagId'});db[_0x8b07('0x10e')]['hasMany'](db['ChatMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x186')});db['ChatInteraction'][_0x8b07('0x115')](db[_0x8b07('0x130')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x180')});db['ChatInteraction'][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db['ChatInteraction']['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x10e')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x187'),'as':_0x8b07('0x163')});db[_0x8b07('0x10e')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x187'),'as':_0x8b07('0x164')});db[_0x8b07('0x10e')]['belongsToMany'](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x11f'),'foreignKey':_0x8b07('0x186')});db[_0x8b07('0x182')][_0x8b07('0x115')](db['User'],{'onDelete':'cascade','as':_0x8b07('0x105')});db[_0x8b07('0x182')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x8b07('0x10e')],{'onDelete':'cascade','as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x186')});db['ChatMessage'][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':_0x8b07('0x172'),'foreignKey':_0x8b07('0x173')});db['ChatMessage'][_0x8b07('0x115')](db['ChatWebsite'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x180')});db[_0x8b07('0x67')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db['ChatOfflineMessage'][_0x8b07('0x115')](db[_0x8b07('0x130')],{'as':_0x8b07('0x160'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x8b07('0x117')](db['User'],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x2f'),'hooks':!![]});db[_0x8b07('0x69')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x188'),'as':_0x8b07('0x14c')});db[_0x8b07('0x6b')][_0x8b07('0x109')](db['ChatInternalMessage'],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x189'),'onDelete':'cascade'});db[_0x8b07('0x6b')][_0x8b07('0x117')](db['User'],{'as':'Members','through':'chat_group_has_users'});db[_0x8b07('0x6d')][_0x8b07('0x115')](db['ChatWebsite'],{'as':_0x8b07('0x185'),'foreignKey':'ChatWebsiteId'});db[_0x8b07('0x18a')][_0x8b07('0x109')](db['CmContact'],{'as':_0x8b07('0x18b'),'foreignKey':_0x8b07('0x18c')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x71')],{'as':_0x8b07('0x18d'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x145'),'foreignKey':_0x8b07('0x156')});db['CmContact'][_0x8b07('0x109')](db[_0x8b07('0x78')],{'as':_0x8b07('0x78'),'foreignKey':_0x8b07('0x156')});db['CmContact'][_0x8b07('0x109')](db[_0x8b07('0xd3')],{'as':'JscriptySessions','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'foreignKey':_0x8b07('0x156'),'onDelete':'restrict'});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':'ChatInteractions','foreignKey':_0x8b07('0x156'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x55')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x40')],{'as':_0x8b07('0x11d'),'foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db['CmContact'][_0x8b07('0x115')](db[_0x8b07('0x18a')],{'as':_0x8b07('0x18e'),'foreignKey':_0x8b07('0x18c')});db['CmContact'][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f'),'onDelete':'cascade'});db[_0x8b07('0x6f')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x18f')});db['CmContact'][_0x8b07('0x117')](db[_0x8b07('0x90')],{'as':'Tags','through':_0x8b07('0x190')});db[_0x8b07('0x6f')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x190'),'as':_0x8b07('0x164')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':'ContactId','onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x8b07('0x107')});db['CmHopper'][_0x8b07('0x115')](db['User'],{'as':_0x8b07('0x191'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x19')],{'as':_0x8b07('0x184'),'foreignKey':_0x8b07('0x143'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0xe4')],{'as':_0x8b07('0xe4'),'foreignKey':_0x8b07('0x192'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x193')});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':'List','foreignKey':_0x8b07('0x16f'),'onDelete':'cascade'});db[_0x8b07('0x72')][_0x8b07('0x115')](db['VoiceQueue'],{'as':_0x8b07('0x184'),'foreignKey':_0x8b07('0x143'),'onDelete':'cascade'});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0xe4')],{'as':_0x8b07('0xe4'),'foreignKey':_0x8b07('0x192'),'onDelete':'cascade'});db[_0x8b07('0x7e')][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x194'),'singular':_0x8b07('0x195')},'foreignKey':_0x8b07('0x196'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db['Automation'][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x197'),'singular':_0x8b07('0x198')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x8b07('0x7e')][_0x8b07('0x109')](db[_0x8b07('0x7c')],{'as':'Actions','foreignKey':_0x8b07('0x199'),'onDelete':'cascade','hooks':!![]});db[_0x8b07('0x82')]['hasMany'](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':'ParentId','onDelete':_0x8b07('0x107')});db['Interval'][_0x8b07('0x109')](db[_0x8b07('0x86')],{'as':_0x8b07('0x19a'),'foreignKey':'IntervalId','onDelete':_0x8b07('0x107'),'hooks':!![],'required':![]});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':'Extensions','foreignKey':_0x8b07('0x14a'),'onDelete':_0x8b07('0x167')});db['Interval'][_0x8b07('0x109')](db[_0x8b07('0x43')],{'as':_0x8b07('0x19b'),'foreignKey':'IntervalId'});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x63')],{'as':_0x8b07('0x19c'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x4b')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0x8b07('0x109')](db['SmsApplication'],{'as':_0x8b07('0x19d'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x8c')][_0x8b07('0x115')](db['MailAccount'],{});db[_0x8b07('0x8c')]['belongsTo'](db[_0x8b07('0x98')],{'foreignKey':_0x8b07('0x19e')});db[_0x8b07('0x8c')]['belongsTo'](db[_0x8b07('0x19f')],{'foreignKey':_0x8b07('0x1a0')});db[_0x8b07('0x8e')]['belongsToMany'](db[_0x8b07('0x13f')],{'as':_0x8b07('0x1a1'),'through':_0x8b07('0x141'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x6f')],{'through':'cm_contact_has_tags'});db[_0x8b07('0x90')][_0x8b07('0x117')](db['ChatInteraction'],{'through':_0x8b07('0x187')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x8b07('0x117')](db[_0x8b07('0x55')],{'through':_0x8b07('0x1a2')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x110')],{'through':_0x8b07('0x170')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x124')],{'through':_0x8b07('0x1a3')});db[_0x8b07('0x93')][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x1a4'),'singular':_0x8b07('0x1a5')},'foreignKey':'TriggerAllId','onDelete':_0x8b07('0x107'),'hooks':!![]});db['Trigger'][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x1a6'),'singular':_0x8b07('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x93')]['hasMany'](db[_0x8b07('0x7c')],{'as':_0x8b07('0x1a8'),'foreignKey':_0x8b07('0x1a9'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x19f')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1a0'),'hooks':!![]});db[_0x8b07('0x98')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x19e')});db[_0x8b07('0x9b')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ab')});db['AnalyticFieldReport'][_0x8b07('0x115')](db[_0x8b07('0x9b')],{'foreignKey':'MetricId'});db[_0x8b07('0xa0')][_0x8b07('0x109')](db[_0x8b07('0xa2')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa2')][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':'Subjects','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa2')]['hasMany'](db[_0x8b07('0xa3')],{'as':'Descriptions','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['SalesforceConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8b07('0x1b0')});db['SalesforceConfiguration'][_0x8b07('0x115')](db[_0x8b07('0xa0')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa3')]['hasMany'](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa3')][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xa3')]['hasMany'](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db['SalesforceField']['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xa5')][_0x8b07('0x109')](db[_0x8b07('0xa7')],{'as':'Configurations','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa7')]['hasMany'](db[_0x8b07('0xa8')],{'as':_0x8b07('0x1b6'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa7')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['SugarcrmConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xa7')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa8')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8b07('0xa8')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xa8')]['hasMany'](db[_0x8b07('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0x8b07('0xa8')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xaa')]['hasMany'](db[_0x8b07('0xac')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['DeskConfiguration']['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xac')][_0x8b07('0x109')](db[_0x8b07('0xae')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x8b07('0x115')](db[_0x8b07('0xaa')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xac')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x1b8')});db['DeskField'][_0x8b07('0x109')](db['DeskField'],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xae')]['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b2'),'foreignKey':'DescriptionId'});db[_0x8b07('0xae')]['hasMany'](db['DeskField'],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xae')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':'VariableId'});db[_0x8b07('0x1b9')][_0x8b07('0x109')](db[_0x8b07('0x1ba')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1ba')]['hasMany'](db[_0x8b07('0xb2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['ZohoConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1aa'),'onDelete':'cascade','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0x1ba')][_0x8b07('0x115')](db[_0x8b07('0x1b9')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb2')][_0x8b07('0x109')](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b1'),'foreignKey':'SubjectId'});db[_0x8b07('0xb2')]['hasMany'](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb2')][_0x8b07('0x109')](db['ZohoField'],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb2')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db['ZendeskAccount'][_0x8b07('0x109')](db[_0x8b07('0xb4')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb4')][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xb4')]['hasMany'](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b7'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb4')][_0x8b07('0x109')](db['ZendeskField'],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb4')][_0x8b07('0x115')](db[_0x8b07('0x1bb')],{'as':'Account','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb4')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b1'),'foreignKey':'SubjectId'});db[_0x8b07('0xb6')][_0x8b07('0x109')](db['ZendeskField'],{'as':_0x8b07('0x1b2'),'foreignKey':'DescriptionId'});db[_0x8b07('0xb6')][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb6')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':'VariableId'});db[_0x8b07('0x1bc')][_0x8b07('0x109')](db[_0x8b07('0x1bd')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bd')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':_0x8b07('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['FreshdeskConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Descriptions','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['FreshdeskConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0x1bd')][_0x8b07('0x115')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bd')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x1be')});db[_0x8b07('0xb9')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xb9')]['hasMany'](db['FreshdeskField'],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb9')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb9')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xba')][_0x8b07('0x109')](db[_0x8b07('0x1bf')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bf')][_0x8b07('0x109')](db['VtigerField'],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['VtigerConfiguration']['hasMany'](db[_0x8b07('0xbd')],{'as':_0x8b07('0x1b7'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x8b07('0x109')](db['VtigerField'],{'as':'Fields','foreignKey':_0x8b07('0x1b0')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db['VtigerField'][_0x8b07('0x109')](db[_0x8b07('0xbd')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xbd')][_0x8b07('0x109')](db['VtigerField'],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xbd')][_0x8b07('0x109')](db[_0x8b07('0xbd')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField'][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8b07('0x1c0')][_0x8b07('0x109')](db[_0x8b07('0xbf')],{'as':_0x8b07('0x1ac'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xbf')][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['ServicenowConfiguration'][_0x8b07('0x109')](db['ServicenowField'],{'as':_0x8b07('0x1b7'),'foreignKey':_0x8b07('0x1af')});db['ServicenowConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db['ServicenowConfiguration'][_0x8b07('0x115')](db[_0x8b07('0x1c0')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xc1')][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db['ServicenowField'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b3'),'foreignKey':'FieldId'});db[_0x8b07('0xc1')][_0x8b07('0x115')](db['Variable'],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0x1c1')][_0x8b07('0x109')](db['Dynamics365Configuration'],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1c2')]['hasMany'](db[_0x8b07('0xc5')],{'as':_0x8b07('0x1b6'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0x1c2')]['hasMany'](db[_0x8b07('0xc5')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0x1c2')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x8b07('0x1c2')][_0x8b07('0x115')](db[_0x8b07('0x1c1')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xc5')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Subject','foreignKey':_0x8b07('0x1ae')});db['Dynamics365Field'][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xc5')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xc5')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':'Variable','foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xc7')][_0x8b07('0x109')](db['FreshsalesConfiguration'],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['FreshsalesConfiguration'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xc8')][_0x8b07('0x115')](db[_0x8b07('0xc7')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db['FreshsalesField'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0x1c3')]['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db['FreshsalesField']['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db['FreshsalesField'][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xcb')][_0x8b07('0x115')](db[_0x8b07('0x130')],{});db[_0x8b07('0xcb')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db['ChatQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0xcb')][_0x8b07('0x115')](db['ChatInteraction'],{});db[_0x8b07('0xcb')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0xcb')][_0x8b07('0x115')](db['ChatQueue'],{});db[_0x8b07('0xcd')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1c4')});db[_0x8b07('0xcd')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':'cascade','foreignKey':_0x8b07('0x1c5')});db[_0x8b07('0xd3')]['hasMany'](db[_0x8b07('0xd1')],{'foreignKey':'SessionId','onDelete':_0x8b07('0x107')});db[_0x8b07('0xd3')][_0x8b07('0x109')](db[_0x8b07('0xcf')],{'foreignKey':_0x8b07('0x1c6'),'onDelete':_0x8b07('0x107')});db['SmsQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x51')],{});db[_0x8b07('0x1c7')]['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['SmsQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x55')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x176')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x178')],{});db[_0x8b07('0xd9')][_0x8b07('0x109')](db['JscriptySessionReport'],{'foreignKey':_0x8b07('0x1c8')});db['JscriptyProject'][_0x8b07('0x109')](db[_0x8b07('0xd1')],{'foreignKey':_0x8b07('0x1c8')});db[_0x8b07('0xd9')][_0x8b07('0x109')](db[_0x8b07('0xcf')],{'foreignKey':_0x8b07('0x1c8')});db[_0x8b07('0xdc')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Users','through':_0x8b07('0x13c')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x11c')});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x19')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x3c')],{'through':_0x8b07('0x15e'),'as':_0x8b07('0x126')});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x69')],{'through':_0x8b07('0x188'),'as':_0x8b07('0x127')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x178')],{'through':_0x8b07('0x17b'),'as':'SmsQueues'});db[_0x8b07('0xe0')][_0x8b07('0x117')](db[_0x8b07('0x12b')],{'through':_0x8b07('0x1c9'),'as':_0x8b07('0x12c')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db['WhatsappQueue'],{'through':_0x8b07('0x1ca'),'as':'WhatsappQueues'});db[_0x8b07('0xe4')]['hasMany'](db[_0x8b07('0x71')],{'as':_0x8b07('0x18d'),'foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db[_0x8b07('0x74')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db['CmHopperHistory'],{'as':_0x8b07('0x145'),'foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db[_0x8b07('0x72')],{'as':_0x8b07('0x146'),'foreignKey':_0x8b07('0x192')});db[_0x8b07('0xe4')][_0x8b07('0x115')](db['Trunk'],{'as':_0x8b07('0x28'),'foreignKey':_0x8b07('0x147')});db['Campaign'][_0x8b07('0x115')](db['Trunk'],{'as':_0x8b07('0x148'),'foreignKey':_0x8b07('0x149')});db[_0x8b07('0xe4')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'as':_0x8b07('0x86'),'foreignKey':'IntervalId'});db['Campaign'][_0x8b07('0x115')](db[_0x8b07('0xdc')],{'as':_0x8b07('0xdc'),'foreignKey':_0x8b07('0x1cb')});db['Campaign'][_0x8b07('0x117')](db[_0x8b07('0x119')],{'as':_0x8b07('0x11a'),'through':_0x8b07('0x1cc')});db[_0x8b07('0xe4')][_0x8b07('0x117')](db['CmList'],{'as':_0x8b07('0x1cd'),'through':'campaigns_has_cm_blacklists'});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x159')],{});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x40')],{});db[_0x8b07('0xe8')][_0x8b07('0x115')](db['MailAccount'],{'foreignKey':_0x8b07('0x1ce'),'as':_0x8b07('0x1cf')});db[_0x8b07('0xe8')][_0x8b07('0x115')](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8b07('0xe8')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x8b07('0x1d1'),'as':_0x8b07('0x1d2')});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'foreignKey':_0x8b07('0x1d3'),'as':_0x8b07('0x1d4')});db[_0x8b07('0xea')][_0x8b07('0x115')](db['ChatMessage'],{});db['ChatTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x10e')],{});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x130')],{'foreignKey':'FromChatWebsiteId','as':_0x8b07('0x1cf')});db[_0x8b07('0xea')]['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db[_0x8b07('0xea')][_0x8b07('0x115')](db['User'],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x69')],{'foreignKey':_0x8b07('0x1d8'),'as':'ToQueue'});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x130')],{'foreignKey':_0x8b07('0x1d9'),'as':_0x8b07('0x1d4')});db['FaxTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x16e')],{});db['FaxTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x110')],{});db[_0x8b07('0x1da')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8b07('0x1db'),'as':_0x8b07('0x1cf')});db[_0x8b07('0x1da')]['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db[_0x8b07('0x1da')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0x8b07('0x4d')],{'foreignKey':_0x8b07('0x1dc'),'as':_0x8b07('0x1d2')});db[_0x8b07('0x1da')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'foreignKey':_0x8b07('0x1dd'),'as':'ToAccount'});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x8b07('0x5c')],{});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x58')],{'foreignKey':_0x8b07('0x1de'),'as':_0x8b07('0x1cf')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':'FromAgent'});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':_0x8b07('0x1d7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8b07('0x12b')],{'foreignKey':_0x8b07('0x1df'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x58')],{'foreignKey':'ToOpenchannelAccountId','as':_0x8b07('0x1d4')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x176')],{});db[_0x8b07('0xee')]['belongsTo'](db[_0x8b07('0x55')],{});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x51')],{'foreignKey':_0x8b07('0x1e0'),'as':_0x8b07('0x1cf')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'FromUserId','as':_0x8b07('0x1d5')});db['SmsTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db['SmsTransferReport'][_0x8b07('0x115')](db['SmsQueue'],{'foreignKey':_0x8b07('0x1e1'),'as':_0x8b07('0x1d2')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x51')],{'foreignKey':'ToSmsAccountId','as':_0x8b07('0x1d4')});db['CmList'][_0x8b07('0x109')](db['Disposition'],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db[_0x8b07('0x7a')],{'as':_0x8b07('0x1e2'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')]['hasMany'](db['CmContact'],{'as':_0x8b07('0x18b'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db[_0x8b07('0x74')],{'as':_0x8b07('0x144'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db['CmHopperHistory'],{'as':_0x8b07('0x10c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db['ReportAgentPreview'],{'as':_0x8b07('0x78'),'foreignKey':'ListId'});db[_0x8b07('0x119')][_0x8b07('0x117')](db[_0x8b07('0x19')],{'as':_0x8b07('0x1e3'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x11b')});db[_0x8b07('0xef')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x10b'),'onDelete':'cascade'});db['VoicePrefix'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x1e4')});db[_0x8b07('0xf1')][_0x8b07('0x109')](db[_0x8b07('0x105')],{'as':'Users','foreignKey':_0x8b07('0x116')});db[_0x8b07('0xf1')]['hasMany'](db[_0x8b07('0xf3')],{'as':'UserProfileSections','foreignKey':_0x8b07('0x116'),'onDelete':_0x8b07('0x107')});db['UserProfileSection'][_0x8b07('0x109')](db[_0x8b07('0xf4')],{'as':'Resources','foreignKey':_0x8b07('0x1e5'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0xf8')]['hasMany'](db['Disposition'],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x1e6')});db['WhatsappAccount']['hasMany'](db[_0x8b07('0xfc')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0x124')],{'as':_0x8b07('0x15b')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0xfa')],{'as':'Applications'});db[_0x8b07('0xf8')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':'List','foreignKey':_0x8b07('0x16f')});db['WhatsappAccount']['belongsTo'](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db[_0x8b07('0xf8')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x13b')});db['WhatsappApplication'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')][_0x8b07('0x115')](db['WhatsappQueue'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')]['belongsTo'](db[_0x8b07('0xf8')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0xfa')]['belongsTo'](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db[_0x8b07('0x124')]['hasMany'](db['WhatsappMessage'],{'as':_0x8b07('0x15a'),'onDelete':'cascade','foreignKey':_0x8b07('0x1e7')});db[_0x8b07('0x124')]['belongsTo'](db[_0x8b07('0xf8')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0x124')][_0x8b07('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x124')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x124')]['belongsToMany'](db[_0x8b07('0x90')],{'through':_0x8b07('0x1a3'),'as':_0x8b07('0x163')});db[_0x8b07('0x124')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x8b07('0x164')});db[_0x8b07('0x124')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x125'),'foreignKey':_0x8b07('0x1e7')});db[_0x8b07('0xfc')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db[_0x8b07('0xfc')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155')});db['WhatsappMessage'][_0x8b07('0x115')](db['WhatsappInteraction'],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x1e7')});db['WhatsappMessage']['belongsTo'](db[_0x8b07('0xf8')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xfe')][_0x8b07('0x115')](db[_0x8b07('0xf8')],{});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x119')],{'as':'List','foreignKey':'ListId'});db[_0x8b07('0xfe')][_0x8b07('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x124')],{});db['WhatsappQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x101')],{});db[_0x8b07('0xfe')][_0x8b07('0x115')](db[_0x8b07('0xfc')],{});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x105')],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db['WhatsappMessage'],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0x124')],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db['WhatsappAccount'],{'foreignKey':_0x8b07('0x1e8'),'as':'FromAccount'});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0xf8')],{'foreignKey':_0x8b07('0x1e9'),'as':_0x8b07('0x1d4')});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0x101')],{'foreignKey':'ToQueueId','as':_0x8b07('0x1d2')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db['WhatsappTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db[_0x8b07('0x101')][_0x8b07('0x117')](db['User'],{'as':_0x8b07('0x15d'),'through':'UserWhatsappQueue','foreignKey':_0x8b07('0x1ea')});db[_0x8b07('0x101')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x1ca'),'as':_0x8b07('0x14c')});module[_0x8b07('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 824d2b2..33d5d19 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x2e0e91,_0x393e3d){var _0x173430=function(_0xd7803e){while(--_0xd7803e){_0x2e0e91['push'](_0x2e0e91['shift']());}};_0x173430(++_0x393e3d);}(_0x757a,0xde));var _0xa757=function(_0x521f88,_0x3c6750){_0x521f88=_0x521f88-0x0;var _0x45a8a8=_0x757a[_0x521f88];return _0x45a8a8;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file +var _0x0713=['/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','password','newPassword','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','secret','registry','isArray','isPlainObject','isString','replace','@@{','}@@','includes','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0x3071('0x0'));var ewinston=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));var errors=require(_0x3071('0x3'));var config=require(_0x3071('0x4'));var logger=require('./config/logger')(_0x3071('0x5'));var authLogger=require(_0x3071('0x6'))(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6){_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2f1e87,_0xbd737f){var _0x22274c=_0x3071('0xb');if(!_[_0x3071('0xc')](_0x2f1e87[_0x3071('0xd')])){_0x22274c+='\x20body=%s';var _0x3457cd=_0x2f1e87[_0x3071('0xd')];maskSensitiveData(_0x3457cd);}return util[_0x3071('0xe')](_0x22274c,_0x2f1e87[_0x3071('0xf')],_0x2f1e87[_0x3071('0x10')]['x-forwarded-for']?_0x2f1e87[_0x3071('0x10')][_0x3071('0x11')]:_0x2f1e87[_0x3071('0x12')][_0x3071('0x13')]||_0x2f1e87['ip'],_0x2f1e87[_0x3071('0x14')],_0xbd737f['statusCode'],_0xbd737f['responseTime'],_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user']['id']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87[_0x3071('0x15')]['name']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user'][_0x3071('0x16')]:null,_0x3457cd?util[_0x3071('0x17')](_0x3457cd,![],null):'');}}));_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1caa5d,_0x2a6a4b){var _0x157a47=_0x3071('0x18');if(_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')]['device']&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]){_0x157a47=_0x3071('0x1a');}return util[_0x3071('0xe')](_0x157a47,_0x1caa5d[_0x3071('0xf')],_0x1caa5d[_0x3071('0x10')][_0x3071('0x11')]?_0x1caa5d[_0x3071('0x10')]['x-forwarded-for']:_0x1caa5d[_0x3071('0x12')][_0x3071('0x13')]||_0x1caa5d['ip'],_0x1caa5d[_0x3071('0x14')],_0x2a6a4b['statusCode'],_0x2a6a4b[_0x3071('0x1b')],_0x1caa5d['user']?_0x1caa5d[_0x3071('0x15')]['id']:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x1c')]:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x16')]:null,_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body']['device']?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1d')]:_0x3071('0x1e'),_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]:'',_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body'][_0x3071('0x1f')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1f')]:'');},'ignoreRoute':function(_0x4d5c4b){var _0x4fb1ca=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4fb1ca[_0x3071('0x20')](_0x4d5c4b[_0x3071('0x14')]);}}));_0xabd7b6[_0x3071('0x9')](_0x3071('0x21'),require(_0x3071('0x22')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x23'),require(_0x3071('0x24')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x25'),require('./api/voiceContext'));_0xabd7b6['use'](_0x3071('0x26'),require(_0x3071('0x27')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x28'),require(_0x3071('0x29')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2a'),require(_0x3071('0x2b')));_0xabd7b6['use']('/api/voice/recordings',require('./api/voiceRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2c'),require('./api/screenRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2d'),require(_0x3071('0x2e')));_0xabd7b6[_0x3071('0x9')]('/api/voice/mails/messages',require(_0x3071('0x2f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x30'),require(_0x3071('0x31')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x32'),require(_0x3071('0x33')));_0xabd7b6[_0x3071('0x9')]('/api/voice/agents/reports',require(_0x3071('0x34')));_0xabd7b6['use']('/api/voice/queues/reports',require(_0x3071('0x35')));_0xabd7b6[_0x3071('0x9')]('/api/members/reports',require(_0x3071('0x36')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x37'),require(_0x3071('0x38')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x39'),require('./api/voiceTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3a'),require('./api/mailServerOut'));_0xabd7b6[_0x3071('0x9')]('/api/mail/accounts',require(_0x3071('0x3b')));_0xabd7b6[_0x3071('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3c'),require(_0x3071('0x3d')));_0xabd7b6['use'](_0x3071('0x3e'),require('./api/mailInteraction'));_0xabd7b6[_0x3071('0x9')]('/api/mail/messages',require(_0x3071('0x3f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x40'),require(_0x3071('0x41')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x42'),require(_0x3071('0x43')));_0xabd7b6[_0x3071('0x9')]('/api/dashboards/items',require(_0x3071('0x44')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x45'),require(_0x3071('0x46')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x47'),require('./api/faxApplication'));_0xabd7b6[_0x3071('0x9')]('/api/fax/interactions',require('./api/faxInteraction'));_0xabd7b6['use']('/api/fax/messages',require(_0x3071('0x48')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x49'),require(_0x3071('0x4a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4b'),require(_0x3071('0x4c')));_0xabd7b6[_0x3071('0x9')]('/api/sms/accounts',require(_0x3071('0x4d')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4e'),require(_0x3071('0x4f')));_0xabd7b6[_0x3071('0x9')]('/api/sms/interactions',require('./api/smsInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x50'),require(_0x3071('0x51')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x52'),require('./api/smsQueue'));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/accounts',require(_0x3071('0x53')));_0xabd7b6['use']('/api/openchannel/applications',require(_0x3071('0x54')));_0xabd7b6['use'](_0x3071('0x55'),require('./api/openchannelInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x56'),require(_0x3071('0x57')));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/queues',require(_0x3071('0x58')));_0xabd7b6['use'](_0x3071('0x59'),require('./api/chatWebsite'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5a'),require('./api/openchannelQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5b'),require(_0x3071('0x5c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5d'),require(_0x3071('0x5e')));_0xabd7b6[_0x3071('0x9')]('/api/chat/messages',require(_0x3071('0x5f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x60'),require(_0x3071('0x61')));_0xabd7b6['use'](_0x3071('0x62'),require(_0x3071('0x63')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x64'),require(_0x3071('0x65')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x66'),require(_0x3071('0x67')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x68'),require(_0x3071('0x69')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6a'),require(_0x3071('0x6b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6c'),require('./api/cmHopper'));_0xabd7b6['use'](_0x3071('0x6d'),require('./api/cmHopperBlack'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6e'),require(_0x3071('0x6f')));_0xabd7b6['use'](_0x3071('0x70'),require(_0x3071('0x71')));_0xabd7b6['use']('/api/cm/custom_fields',require(_0x3071('0x72')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x73'),require(_0x3071('0x74')));_0xabd7b6['use'](_0x3071('0x75'),require(_0x3071('0x76')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x77'),require(_0x3071('0x78')));_0xabd7b6['use'](_0x3071('0x79'),require(_0x3071('0x7a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7b'),require(_0x3071('0x7c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7d'),require('./api/interval'));_0xabd7b6['use'](_0x3071('0x7e'),require('./api/pause'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7f'),require('./api/cdr'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x80'),require('./api/voiceQueuesLog'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x81'),require(_0x3071('0x82')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x83'),require('./api/sound'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x84'),require(_0x3071('0x85')));_0xabd7b6['use'](_0x3071('0x86'),require(_0x3071('0x87')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x88'),require(_0x3071('0x89')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8a'),require(_0x3071('0x8b')));_0xabd7b6[_0x3071('0x9')]('/api/integrations',require(_0x3071('0x8c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8d'),require(_0x3071('0x8e')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8f'),require(_0x3071('0x90')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x91'),require(_0x3071('0x92')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/extracted_reports',require(_0x3071('0x93')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x94'),require(_0x3071('0x95')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x96'),require(_0x3071('0x97')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/tree_reports',require(_0x3071('0x98')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x99'),require(_0x3071('0x9a')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xabd7b6['use']('/api/integrations/sugarcrm/configurations',require(_0x3071('0x9b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9c'),require('./api/intSugarcrmField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9d'),require(_0x3071('0x9e')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/configurations',require(_0x3071('0x9f')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/fields',require(_0x3071('0xa0')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa1'),require(_0x3071('0xa2')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa3'),require(_0x3071('0xa4')));_0xabd7b6['use']('/api/integrations/zoho/fields',require(_0x3071('0xa5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa6'),require('./api/intZendeskAccount'));_0xabd7b6['use'](_0x3071('0xa7'),require(_0x3071('0xa8')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa9'),require(_0x3071('0xaa')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xab'),require(_0x3071('0xac')));_0xabd7b6['use'](_0x3071('0xad'),require('./api/intFreshdeskConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xae'),require(_0x3071('0xaf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb0'),require(_0x3071('0xb1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb2'),require('./api/intVtigerConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb3'),require(_0x3071('0xb4')));_0xabd7b6['use'](_0x3071('0xb5'),require(_0x3071('0xb6')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/fields',require(_0x3071('0xb7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb8'),require(_0x3071('0xb9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xba'),require(_0x3071('0xbb')));_0xabd7b6['use'](_0x3071('0xbc'),require(_0x3071('0xbd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xbe'),require(_0x3071('0xbf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc0'),require(_0x3071('0xc1')));_0xabd7b6['use'](_0x3071('0xc2'),require('./api/intFreshsalesField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc3'),require(_0x3071('0xc4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc5'),require(_0x3071('0xc6')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc7'),require(_0x3071('0xc8')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/answers/reports',require(_0x3071('0xc9')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/questions/reports',require(_0x3071('0xca')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xcb'),require(_0x3071('0xcc')));_0xabd7b6[_0x3071('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0xabd7b6[_0x3071('0x9')]('/api/square/reports',require(_0x3071('0xcd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xce'),require(_0x3071('0xcf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd0'),require('./api/jscriptyProject'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd1'),require(_0x3071('0xd2')));_0xabd7b6[_0x3071('0x9')]('/api/square/odbc',require(_0x3071('0xd3')));_0xabd7b6[_0x3071('0x9')]('/api/square/projects',require(_0x3071('0xd4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd5'),require(_0x3071('0xd6')));_0xabd7b6[_0x3071('0x9')]('/api/square/messages',require(_0x3071('0xd7')));_0xabd7b6['use'](_0x3071('0xd8'),require(_0x3071('0xd9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xda'),require(_0x3071('0xdb')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xdc'),require(_0x3071('0xdd')));_0xabd7b6['use'](_0x3071('0xde'),require(_0x3071('0xdf')));_0xabd7b6[_0x3071('0x9')]('/api/attachments',require(_0x3071('0xe0')));_0xabd7b6['use'](_0x3071('0xe1'),require(_0x3071('0xe2')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/transfer',require(_0x3071('0xe3')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe4'),require(_0x3071('0xe5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe6'),require(_0x3071('0xe7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe8'),require('./api/openchannelTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe9'),require(_0x3071('0xea')));_0xabd7b6['use']('/api/cm/lists',require('./api/cmList'));_0xabd7b6['use']('/api/voice/prefixes',require(_0x3071('0xeb')));_0xabd7b6[_0x3071('0x9')]('/api/userProfiles',require(_0x3071('0xec')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xed'),require('./api/userProfileSection'));_0xabd7b6['use'](_0x3071('0xee'),require(_0x3071('0xef')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf0'),require(_0x3071('0xf1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf2'),require('./api/whatsappAccount'));_0xabd7b6['use'](_0x3071('0xf3'),require(_0x3071('0xf4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf5'),require('./api/whatsappInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf6'),require(_0x3071('0xf7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf8'),require(_0x3071('0xf9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfa'),require('./api/whatsappTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfb'),require(_0x3071('0xfc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfd'),require('./api/cloudProvider'));_0xabd7b6[_0x3071('0x9')]('/api/auth/local',require('./api/authLocal'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfe'),require(_0x3071('0xff')));_0xabd7b6['use'](_0x3071('0x100'),require(_0x3071('0x101')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x102'),require(_0x3071('0x103')));_0xabd7b6['use']('/api/version',require(_0x3071('0x104')));_0xabd7b6[_0x3071('0x9')]('/api/system',require(_0x3071('0x105')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x106'),require(_0x3071('0x107')));_0xabd7b6[_0x3071('0x9')]('/api/webbar',require(_0x3071('0x108')));_0xabd7b6['use'](_0x3071('0x109'),express[_0x3071('0x10a')](path['join'](config[_0x3071('0x10b')],'/apidoc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10c'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config['root'],_0x3071('0x10c'))));_0xabd7b6['use'](_0x3071('0x10e'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],'/demo')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10f'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x110'),_0x3071('0x111'))));_0xabd7b6[_0x3071('0x9')](_0x3071('0x112'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x113'))));_0xabd7b6[_0x3071('0x114')](_0x3071('0x115'))[_0x3071('0x116')](errors[0x194]);_0xabd7b6[_0x3071('0x114')]('/*')[_0x3071('0x116')](function(_0x5128a5,_0x1aff4e){_0x1aff4e[_0x3071('0x117')](path[_0x3071('0x118')](_0xabd7b6[_0x3071('0x116')](_0x3071('0x119'))+'/index.html'));});};var sensitiveFields=['username',_0x3071('0x11a'),_0x3071('0x11b'),'apiKey',_0x3071('0x11c'),_0x3071('0x11d'),'street',_0x3071('0x11e'),_0x3071('0x11f'),_0x3071('0x120'),_0x3071('0x121'),_0x3071('0x122'),_0x3071('0x123'),_0x3071('0x124'),_0x3071('0x125'),_0x3071('0x126'),_0x3071('0x127'),'token',_0x3071('0x128'),'accessToken',_0x3071('0x129'),_0x3071('0x12a'),_0x3071('0x12b'),_0x3071('0x12c'),'membername','calleridname','calleridnum',_0x3071('0x12d'),_0x3071('0x12e'),_0x3071('0x12f'),_0x3071('0x130'),'accesskeyid',_0x3071('0x131'),_0x3071('0x132'),_0x3071('0x15'),'pass','accountSid','localstationid','dsn',_0x3071('0x133'),_0x3071('0x134'),'oldPassword'];function maskSensitiveData(_0x2750c5){var _0x2a2b9d=/(?!^)[\s\S](?!$)/g;for(var _0x22c625 in _0x2750c5){if(_[_0x3071('0x135')](_0x2750c5[_0x22c625])){for(var _0x17186c=0x0;_0x17186c<_0x2750c5[_0x22c625]['length'];_0x17186c++){maskSensitiveData(_0x2750c5[_0x22c625][_0x17186c]);}}else if(_[_0x3071('0x136')](_0x2750c5[_0x22c625])){maskSensitiveData(_0x2750c5[_0x22c625]);}else if(_[_0x3071('0x137')](_0x2750c5[_0x22c625])){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](/{{{/g,_0x3071('0x139'))['replace'](/}}}/g,_0x3071('0x13a'))['replace'](/{{/g,'@{')[_0x3071('0x138')](/}}/g,'}@');if(_[_0x3071('0x13b')](sensitiveFields,_0x22c625)){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](_0x2a2b9d,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 045f375..f9c12c5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x605e=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/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/sound/sound.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x605e,0x139));var _0xe605=function(_0x92351,_0x3ffbd9){_0x92351=_0x92351-0x0;var _0x4c93b1=_0x605e[_0x92351];return _0x4c93b1;};'use strict';var jayson=require(_0xe605('0x0'));var BPromise=require(_0xe605('0x1'));var _=require('lodash');var config=require(_0xe605('0x2'));exports['listen']=function(){return new BPromise(function(_0x485aa1,_0x19fd84){var _0x4aa12c={};_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x4')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x5')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x6')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x7')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x8')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x9')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xa')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/trunk/trunk.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xb')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xc')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xd')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xe')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/mailQueue/mailQueue.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0xf')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/mailMessage/mailMessage.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x10')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x11')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxAccount/faxAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxApplication/faxApplication.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x12')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x13')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/faxQueue/faxQueue.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x14')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x15')));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/smsInteraction/smsInteraction.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x16')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x17')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x18')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x19')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x1a')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1b')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1c')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x1d')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/chatMessage/chatMessage.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1e')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x1f')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x20')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x21')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x22')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x23')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x24')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/interval/interval.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/pause/pause.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x25')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/template/template.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/trigger/trigger.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x26')));_0x4aa12c=_['merge'](_0x4aa12c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x27')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x28')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x29')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2a')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2b')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2c')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x2d')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareReport/squareReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x2e')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/squareProject/squareProject.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x2f')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x30')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x31')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x32')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/plugin/plugin.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x33')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x34')));_0x4aa12c=_['merge'](_0x4aa12c,require(_0xe605('0x35')));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4aa12c=_[_0xe605('0x3')](_0x4aa12c,require(_0xe605('0x36')));var _0x4e9742=jayson[_0xe605('0x37')](_0x4aa12c)[_0xe605('0x38')]();var _0x8d3da9=config[_0xe605('0x39')][_0xe605('0x3a')]||config['port']+0x1;var _0x23b5d3=config['rpc']['ip']||_0xe605('0x3b');_0x4e9742['on'](_0xe605('0x3c'),function(_0x5200a2){return _0x19fd84(_0x5200a2);});_0x4e9742[_0xe605('0x3d')](_0x8d3da9,_0x23b5d3,function(){console['log'](_0xe605('0x3e'),_0x23b5d3,_0x8d3da9);require(_0xe605('0x3f'))[_0xe605('0x40')]();return _0x485aa1(_0xe605('0x41')+_0x23b5d3+':'+_0x8d3da9);});});}; \ No newline at end of file +var _0xbf81=['../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/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/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x595ce4,_0x15c2a3){var _0x2319d0=function(_0x3b39d2){while(--_0x3b39d2){_0x595ce4['push'](_0x595ce4['shift']());}};_0x2319d0(++_0x15c2a3);}(_0xbf81,0x1bd));var _0x1bf8=function(_0x58e19c,_0x17b34e){_0x58e19c=_0x58e19c-0x0;var _0x536652=_0xbf81[_0x58e19c];return _0x536652;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0x1bf8('0x0'));var config=require(_0x1bf8('0x1'));exports[_0x1bf8('0x2')]=function(){return new BPromise(function(_0x3398b3,_0x39f19e){var _0x3f02f2={};_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x3')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x4')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x6')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x7')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x8')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x9')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0xa')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/trunk/trunk.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xb')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailServerIn/mailServerIn.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xc')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xd')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0xe')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailMessage/mailMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailApplication/mailApplication.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/faxAccount/faxAccount.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xf')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/faxInteraction/faxInteraction.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/faxMessage/faxMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x10')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x11')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x12')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x13')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/smsMessage/smsMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x14')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x15')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x16')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x17')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x18')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x19')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1a')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1b')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1c')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/cmHopper/cmHopper.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1d')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1e')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1f')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x20')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x21')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x22')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/trigger/trigger.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x23')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x24')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x25')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x26')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x27')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x28')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x29')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2a')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2b')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2c')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2d')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2e')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2f')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x30')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x31')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x32')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/attachment/attachment.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x33')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x34')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x35')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x36')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x37')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x38')));var _0x56c73f=jayson['server'](_0x3f02f2)[_0x1bf8('0x39')]();var _0x2516c9=config['rpc']['port']||config['port']+0x1;var _0x7a95a8=config[_0x1bf8('0x3a')]['ip']||_0x1bf8('0x3b');_0x56c73f['on'](_0x1bf8('0x3c'),function(_0x202067){return _0x39f19e(_0x202067);});_0x56c73f['listen'](_0x2516c9,_0x7a95a8,function(){console[_0x1bf8('0x3d')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x7a95a8,_0x2516c9);require(_0x1bf8('0x3e'))[_0x1bf8('0x3f')]();return _0x3398b3(_0x1bf8('0x40')+_0x7a95a8+':'+_0x2516c9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d6f8434..bf1b0e3 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(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x2407f7,_0x196839){var _0xc02d7c=function(_0x209d8c){while(--_0x209d8c){_0x2407f7['push'](_0x2407f7['shift']());}};_0xc02d7c(++_0x196839);}(_0xe706,0xa3));var _0x6e70=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0xe706[_0x5d1df9];return _0x5d4feb;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a304565..79b7a4b 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 _0x1fdc=['apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x1fdc[_0x20d54d];return _0x516e8b;};'use strict';var util=require(_0xc1fd('0x0'));var error={'E_AGI_UNDEFINED':_0xc1fd('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc1fd('0x2'),'E_AGI_SERVER_CLOSE':_0xc1fd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc1fd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc1fd('0x5'),'E_AGI_SOCKET_ERROR':_0xc1fd('0x6'),'E_AGI_SOCKET_CLOSE':_0xc1fd('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xc1fd('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc1fd('0x9'),'E_AGI_IVR_ENTRY':_0xc1fd('0xa')};function AGIError(_0x43cd02){var _0x43cd02=_0x43cd02||null,_0x1865d0=_0x1865d0||[],_0x3eebe6=0x1,_0x43b858='';if(!error[_0x43cd02]){_0x43cd02=_0xc1fd('0xb');}_0x1865d0[_0xc1fd('0xc')](error[_0x43cd02]);while(arguments[_0x3eebe6]){_0x1865d0[_0xc1fd('0xc')](arguments[_0x3eebe6]);_0x3eebe6++;}_0x43b858=util[_0xc1fd('0xd')][_0xc1fd('0xe')](util,_0x1865d0);this[_0xc1fd('0xf')]=_0x43b858;this['name']=_0x43cd02;}module[_0xc1fd('0x10')]=AGIError; \ No newline at end of file +var _0x3512=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x537cf0,_0x35a2c8){var _0x326259=function(_0x614ea7){while(--_0x614ea7){_0x537cf0['push'](_0x537cf0['shift']());}};_0x326259(++_0x35a2c8);}(_0x3512,0x13b));var _0x2351=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3512[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x2351('0x0'),'E_AGI_ARGUMENT_PORT':_0x2351('0x1'),'E_AGI_SERVER_ERROR':_0x2351('0x2'),'E_AGI_SERVER_CLOSE':_0x2351('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x2351('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2351('0x5'),'E_AGI_SOCKET_ERROR':_0x2351('0x6'),'E_AGI_SOCKET_CLOSE':_0x2351('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x2351('0x8'),'E_AGI_COMMAND_EMPTY':_0x2351('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2351('0xa')};function AGIError(_0x24ef90){var _0x24ef90=_0x24ef90||null,_0x34929f=_0x34929f||[],_0x1a809f=0x1,_0x5142f1='';if(!error[_0x24ef90]){_0x24ef90=_0x2351('0xb');}_0x34929f['push'](error[_0x24ef90]);while(arguments[_0x1a809f]){_0x34929f['push'](arguments[_0x1a809f]);_0x1a809f++;}_0x5142f1=util[_0x2351('0xc')][_0x2351('0xd')](util,_0x34929f);this[_0x2351('0xe')]=_0x5142f1;this[_0x2351('0xf')]=_0x24ef90;}module[_0x2351('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 1f62fd3..fd05c65 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 _0x7894=['vertices','prototype','addEdge','size','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','addVertex'];(function(_0x45bf93,_0x2f297e){var _0xfa4411=function(_0x3819be){while(--_0x3819be){_0x45bf93['push'](_0x45bf93['shift']());}};_0xfa4411(++_0x2f297e);}(_0x7894,0x170));var _0x4789=function(_0x19b7d8,_0x3bce4e){_0x19b7d8=_0x19b7d8-0x0;var _0x10c562=_0x7894[_0x19b7d8];return _0x10c562;};'use strict';var _=require(_0x4789('0x0'));var logger=require(_0x4789('0x1'))(_0x4789('0x2'));var verticesWithRetry=[_0x4789('0x3'),_0x4789('0x4'),_0x4789('0x5')];var Graph=function(){this['vertices']={};this[_0x4789('0x6')]={};this[_0x4789('0x7')]=0x0;};Graph['prototype'][_0x4789('0x8')]=function(_0x4bfe85){this[_0x4789('0x9')][_0x4bfe85['id']]=_0x4bfe85;this[_0x4789('0x6')][_0x4bfe85['id']]=[];};Graph[_0x4789('0xa')][_0x4789('0xb')]=function(_0x13b7f6,_0x5a45ae,_0x49d256){this[_0x4789('0x6')][_0x13b7f6]['push']({'target':_0x5a45ae,'condition':_0x49d256});this[_0x4789('0x7')]+=0x1;};Graph[_0x4789('0xa')][_0x4789('0xc')]=function(){return _['size'](this[_0x4789('0x9')]);};Graph['prototype'][_0x4789('0xd')]=function(){return this[_0x4789('0x7')];};Graph[_0x4789('0xa')]['getVertex']=function(_0x4db727){return this[_0x4789('0x9')][_0x4db727];};Graph['prototype'][_0x4789('0xe')]=function(_0x58743a,_0x25a4a9){if(!this[_0x4789('0x9')][_0x58743a]){return logger['info'](_0x4789('0xf'));}var _0x4e0fde=_0x25a4a9(this[_0x4789('0x9')][_0x58743a]);if(!_0x4e0fde){return logger[_0x4789('0x10')](_0x4789('0x11'));}if(this['edges'][_0x58743a][_0x4789('0x12')]===0x0){return logger[_0x4789('0x10')]('no\x20edge/s\x20available');}for(var _0x30dee9=0x0,_0x527656=[],_0x118f97=![];_0x30dee9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','hasOwnProperty','inspect','debug','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','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc','context','extension','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found','finally','traverseBFS','vertex','[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]','listening','connection','xml2json','util','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults'];(function(_0x589777,_0x110424){var _0x3b067c=function(_0x59cf29){while(--_0x59cf29){_0x589777['push'](_0x589777['shift']());}};_0x3b067c(++_0x110424);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x32a7f2,_0x43ca7d){_0x32a7f2=_0x32a7f2-0x0;var _0x4c7655=_0x4d9e[_0x32a7f2];return _0x4c7655;};'use strict';var parser=require(_0xe4d9('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe4d9('0x1'));var moment=require('moment');var config=require(_0xe4d9('0x2'));var logger=require('../../config/logger')(_0xe4d9('0x3'));var utilLicense=require(_0xe4d9('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xe4d9('0x5'));var Graph=require(_0xe4d9('0x6'));var Vertices=require(_0xe4d9('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe4d9('0x3')]=_[_0xe4d9('0x8')](config[_0xe4d9('0x3')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x36316f){process[_0xe4d9('0x9')](function(){syncho(function(){try{setChannelVariables(_0x36316f);agiHandler(_0x36316f);}catch(_0x2a7eee){logger[_0xe4d9('0xa')](_0x2a7eee[_0xe4d9('0xb')]);}});});}function listeningHandler(){console[_0xe4d9('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe4d9('0x3')][_0xe4d9('0xd')]);logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x10'),config[_0xe4d9('0x3')]['ip'],config[_0xe4d9('0x3')]['port']));}function errorHandler(_0x5ee099){if(_0x5ee099&&_0x5ee099['name']&&_0x5ee099['message']){logger['error'](util['format']('[%s]\x20%s',_0x5ee099['name'],_0x5ee099[_0xe4d9('0x11')]));}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')]('[ERROR]\x20%s',_0x5ee099[_0xe4d9('0xb')]));}}function closeHandler(){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x12'),this['arg_1'],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4d2afd){logger[_0xe4d9('0xa')](_0x4d2afd[_0xe4d9('0xb')]);}}function timeoutHandler(){logger['info'](util[_0xe4d9('0xf')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe4d9('0x16')],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this['uniqueid']));}function hangupHandler(){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')](_0xe4d9('0x17'),this[_0xe4d9('0x16')],this[_0xe4d9('0x13')],this[_0xe4d9('0x14')],this[_0xe4d9('0x15')],this[_0xe4d9('0x18')]));this[_0xe4d9('0x19')]=!![];}function getRoot(_0x4fed7f){return parser[_0xe4d9('0x1a')](_0x4fed7f,{'object':!![]})[_0xe4d9('0x1b')]['root'];}function addVertex(_0x189dad,_0x50d377,_0x14f3d7){_0x50d377[_0xe4d9('0x1c')]=_0x14f3d7;if(_0x50d377['hasOwnProperty'](_0xe4d9('0x1d'))){_0x50d377[_0xe4d9('0x1e')]=parseInt(_0x50d377['retry'],0xa);}_0x189dad[_0xe4d9('0x1f')](_[_0xe4d9('0x20')](_0x50d377,_0xe4d9('0x21')));}function initGraph(_0x5bb43b,_0x4ee33d){var _0x42e6a0=new Graph();for(var _0x2846e2 in _0x5bb43b){if(_0x5bb43b['hasOwnProperty'](_0x2846e2)){if(_['isArray'](_0x5bb43b[_0x2846e2])){for(var _0x4954b5=0x0;_0x4954b5<_0x5bb43b[_0x2846e2]['length'];_0x4954b5+=0x1){addVertex(_0x42e6a0,_0x5bb43b[_0x2846e2][_0x4954b5],_0x2846e2);}}else{addVertex(_0x42e6a0,_0x5bb43b[_0x2846e2],_0x2846e2);}}}for(var _0x221a61=0x0;_0x221a61<_0x4ee33d['length'];_0x221a61+=0x1){if(_0x4ee33d[_0x221a61][_0xe4d9('0x22')]&&_0x4ee33d[_0x221a61][_0xe4d9('0x23')]){_0x42e6a0[_0xe4d9('0x24')](_0x4ee33d[_0x221a61]['source'],_0x4ee33d[_0x221a61][_0xe4d9('0x23')],_0x4ee33d[_0x221a61][_0xe4d9('0x25')]);}}return _0x42e6a0;}function getSquareProject(_0x250de5,_0x45e8a3){rpc[_0xe4d9('0x26')](_0x250de5)[_0xe4d9('0x27')](function(_0x21b7a9){_0x45e8a3(null,_0x21b7a9);})[_0xe4d9('0x28')](function(_0x1fb637){_0x45e8a3(null,_0x1fb637);});}function createSquareReport(_0x3e6ea7,_0x519c18){rpc[_0xe4d9('0x29')](_0x3e6ea7)['then'](function(_0x22efd2){if(_0x519c18){_0x519c18(null,_0x22efd2);}})[_0xe4d9('0x28')](function(_0x2b716b){if(_0x519c18){_0x519c18(null,_0x2b716b);}});}function setChannelVariables(_0x3721a0){for(var _0xa444d0 in _0x3721a0){if(_0x3721a0[_0xe4d9('0x2a')](_0xa444d0)){if(_0xa444d0['indexOf']('agi_')===0x0){_0x3721a0[_0xa444d0['substring'](0x4)]=_0x3721a0[_0xa444d0];delete _0x3721a0[_0xa444d0];}}}}function getLogFromObject(_0x270cad){return util[_0xe4d9('0x2b')](_0x270cad,{'showHidden':![],'depth':null});}function agiHandler(_0x9f1acf){var _0x4f8abf,_0x5a7422,_0x5ad794,_0x5f230f,_0x2740e0;logger[_0xe4d9('0x2c')]('variables',JSON[_0xe4d9('0x2d')](_0x9f1acf,null,0x2));logger[_0xe4d9('0xe')](util['format'](_0xe4d9('0x2e'),_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x9f1acf['on'](_0xe4d9('0xa'),errorHandler);_0x9f1acf['on'](_0xe4d9('0x2f'),closeHandler);_0x9f1acf['on'](_0xe4d9('0x30'),timeoutHandler);_0x9f1acf[_0xe4d9('0x19')]=![];_0x9f1acf['on'](_0xe4d9('0x31'),hangupHandler);var _0x517f24=getSquareProject[_0xe4d9('0x32')](null,_0x9f1acf[_0xe4d9('0x16')]);if(_0x517f24){if(_0x517f24['production']){_0x4f8abf=getRoot(_0x517f24[_0xe4d9('0x33')]);if(_0x4f8abf&&_0x4f8abf[_0xe4d9('0x34')]){logger[_0xe4d9('0x2c')](_0xe4d9('0x35'),JSON[_0xe4d9('0x2d')](_0x4f8abf,null,0x2));_0x9f1acf[_0xe4d9('0x36')]=moment()[_0xe4d9('0xf')](_0xe4d9('0x37'));_0x5a7422=initGraph(_[_0xe4d9('0x20')](_0x4f8abf,'mxCell'),_0x4f8abf['mxCell']);_0x5ad794=new Vertices(_0x9f1acf,rpc,mailRpc);logger['info'](util[_0xe4d9('0xf')](_0xe4d9('0x38'),_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x5a7422['traverseBFS'](_0x4f8abf['start']['id'],function(_0x51824f){try{_0x51824f=_0x5ad794[_0xe4d9('0x39')](_0x51824f);logger[_0xe4d9('0x2c')]('vertex',JSON[_0xe4d9('0x2d')](_0x51824f,null,0x2));if(_0x51824f[_0xe4d9('0x1c')]===_0xe4d9('0x3a')){logger[_0xe4d9('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x9f1acf[_0xe4d9('0x3b')]=_0x51824f[_0xe4d9('0x3b')]||_0x9f1acf[_0xe4d9('0x3b')];_0x9f1acf[_0xe4d9('0x3c')]=_0x51824f[_0xe4d9('0x3c')];_0x9f1acf[_0xe4d9('0x3d')]=_0x51824f[_0xe4d9('0x3d')]?_0x51824f[_0xe4d9('0x3d')]-0x1:0x1;return null;}else if(_0x51824f&&_0x5ad794[_0x51824f[_0xe4d9('0x1c')]]){_0x2740e0=_0x5ad794[_0x51824f[_0xe4d9('0x1c')]](_0x51824f);logger[_0xe4d9('0xe')]('response',JSON[_0xe4d9('0x2d')](_0x2740e0,null,0x2));if(_0x2740e0&&_0x2740e0[_0xe4d9('0x3e')]===AGI_CODE_SUCCESS&&_0x2740e0[_0xe4d9('0x3f')]!==AGI_RESULT_ERROR&&!_0x9f1acf[_0xe4d9('0x19')]){logger[_0xe4d9('0x2c')]('response',getLogFromObject(_0x2740e0));return _[_0xe4d9('0x40')](_0x2740e0[_0xe4d9('0x3f')])?null:_0x2740e0[_0xe4d9('0x3f')][_0xe4d9('0x41')]();}else{logger[_0xe4d9('0xa')](_0xe4d9('0x42'),getLogFromObject(_0x2740e0));return null;}}else{logger[_0xe4d9('0xa')](_0xe4d9('0x43'));return null;}}catch(_0x42744d){logger[_0xe4d9('0xa')](_0x42744d['stack']);return null;}});if(_0x4f8abf[_0xe4d9('0x44')]){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf[_0xe4d9('0x13')],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));_0x5a7422[_0xe4d9('0x45')](_0x4f8abf[_0xe4d9('0x44')]['id'],function(_0x5254b3){try{_0x5254b3=_0x5ad794[_0xe4d9('0x39')](_0x5254b3);logger[_0xe4d9('0x2c')](_0xe4d9('0x46'),JSON[_0xe4d9('0x2d')](_0x5254b3,null,0x2));if(_0x5254b3&&_0x5ad794[_0x5254b3[_0xe4d9('0x1c')]]){_0x2740e0=_0x5ad794[_0x5254b3[_0xe4d9('0x1c')]](_0x5254b3);if(_0x2740e0){logger['debug'](_0xe4d9('0x42'),getLogFromObject(_0x2740e0));return _[_0xe4d9('0x40')](_0x2740e0[_0xe4d9('0x3f')])?null:_0x2740e0[_0xe4d9('0x3f')][_0xe4d9('0x41')]();}else{logger[_0xe4d9('0xa')]('response',getLogFromObject(_0x2740e0));return null;}}else{logger[_0xe4d9('0xa')](_0xe4d9('0x43'));return null;}}catch(_0x53e7c4){logger[_0xe4d9('0xa')](_0x53e7c4['stack']);return null;}});}logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x9f1acf[_0xe4d9('0x16')],_0x9f1acf['calleridname'],_0x9f1acf[_0xe4d9('0x14')],_0x9f1acf[_0xe4d9('0x15')],_0x9f1acf[_0xe4d9('0x18')]));logger['info'](util[_0xe4d9('0xf')](_0xe4d9('0x47'),_0x9f1acf['context'],_0x9f1acf[_0xe4d9('0x3c')],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1));_0x9f1acf[_0xe4d9('0x48')](_0x9f1acf[_0xe4d9('0x3b')],_0x9f1acf['extension'],parseInt(_0x9f1acf['priority'],0xa)+0x1);_0x9f1acf[_0xe4d9('0x2f')]();}}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')](_0xe4d9('0x49'),_0x9f1acf[_0xe4d9('0x16')]));_0x9f1acf[_0xe4d9('0x48')](_0x9f1acf['context'],_0x9f1acf['extension'],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1);_0x9f1acf[_0xe4d9('0x2f')]();}}else{logger[_0xe4d9('0xa')](util[_0xe4d9('0xf')](_0xe4d9('0x4a'),_0x9f1acf[_0xe4d9('0x16')]));_0x9f1acf['continueAt'](_0x9f1acf[_0xe4d9('0x3b')],_0x9f1acf[_0xe4d9('0x3c')],parseInt(_0x9f1acf[_0xe4d9('0x3d')],0xa)+0x1);_0x9f1acf['close']();}}function main(){var _0x457bfb;return utilLicense[_0xe4d9('0x4b')]()[_0xe4d9('0x27')](function(_0x5ec4bc){if(_0x5ec4bc){if(_0x5ec4bc[_0xe4d9('0x4c')]){if(_0x5ec4bc['callysquare']&&_0x5ec4bc[_0xe4d9('0x4d')]>0x0){logger[_0xe4d9('0xe')](util[_0xe4d9('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5ec4bc['callysquare']));_0x457bfb=_0x5ec4bc['callysquare'];}else{logger[_0xe4d9('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe4d9('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x457bfb=-0x1;}}})['catch'](function(_0x3c2196){logger[_0xe4d9('0xa')](_0xe4d9('0x4e'),_0x3c2196[_0xe4d9('0xb')]);})[_0xe4d9('0x44')](function(){var _0x580bb4=require('./server')(config['agi']['port'],config[_0xe4d9('0x3')]['ip'],_0x457bfb);_0x580bb4['on'](_0xe4d9('0xa'),errorHandler);_0x580bb4['on'](_0xe4d9('0x4f'),listeningHandler);_0x580bb4['on'](_0xe4d9('0x50'),connectionHandler);_0x580bb4['on'](_0xe4d9('0x2f'),closeHandler);});}main(); \ No newline at end of file +var _0x56a4=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','agi','../../config/license/util','./rpc','./mailRpc','./graph','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','omit','isArray','length','source','target','addEdge','then','catch','createSquareReport','indexOf','agi_','substring','[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','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','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'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x56a4,0x11b));var _0x456a=function(_0xee40b0,_0x1270b8){_0xee40b0=_0xee40b0-0x0;var _0x55e4c1=_0x56a4[_0xee40b0];return _0x55e4c1;};'use strict';var parser=require(_0x456a('0x0'));var _=require(_0x456a('0x1'));var syncho=require('syncho');var util=require(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x456a('0x4'));var utilLicense=require(_0x456a('0x5'));var rpc=require(_0x456a('0x6'));var mailRpc=require(_0x456a('0x7'));var Graph=require(_0x456a('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x456a('0x4')]=_['defaults'](config['agi'],{'ip':_0x456a('0x9'),'port':0x11dd});function connectionHandler(_0x20c8e0){process[_0x456a('0xa')](function(){syncho(function(){try{setChannelVariables(_0x20c8e0);agiHandler(_0x20c8e0);}catch(_0x4c4e05){logger[_0x456a('0xb')](_0x4c4e05['stack']);}});});}function listeningHandler(){console[_0x456a('0xc')](_0x456a('0xd'),config[_0x456a('0x4')][_0x456a('0xe')]);logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x11'),config[_0x456a('0x4')]['ip'],config[_0x456a('0x4')][_0x456a('0xe')]));}function errorHandler(_0x274ee0){if(_0x274ee0&&_0x274ee0['name']&&_0x274ee0[_0x456a('0x12')]){logger['error'](util['format'](_0x456a('0x13'),_0x274ee0[_0x456a('0x14')],_0x274ee0[_0x456a('0x12')]));}else{logger[_0x456a('0xb')](util['format'](_0x456a('0x15'),_0x274ee0[_0x456a('0x16')]));}}function closeHandler(){logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x17'),this[_0x456a('0x18')],this['calleridname'],this[_0x456a('0x19')],this[_0x456a('0x1a')],this[_0x456a('0x1b')]));try{createSquareReport(this);}catch(_0x1d4e7e){logger['error'](_0x1d4e7e[_0x456a('0x16')]);}}function timeoutHandler(){logger[_0x456a('0xf')](util[_0x456a('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x456a('0x18')],this['calleridname'],this['callerid'],this[_0x456a('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0x456a('0xf')](util['format'](_0x456a('0x1c'),this[_0x456a('0x18')],this['calleridname'],this['callerid'],this['dnid'],this[_0x456a('0x1b')]));this[_0x456a('0x1d')]=!![];}function getRoot(_0xb8d35c){return parser['toJson'](_0xb8d35c,{'object':!![]})[_0x456a('0x1e')]['root'];}function addVertex(_0x5aa5da,_0x59b47e,_0x47747a){_0x59b47e[_0x456a('0x1f')]=_0x47747a;if(_0x59b47e[_0x456a('0x20')]('retry')){_0x59b47e[_0x456a('0x21')]=parseInt(_0x59b47e[_0x456a('0x22')],0xa);}_0x5aa5da['addVertex'](_[_0x456a('0x23')](_0x59b47e,'mxCell'));}function initGraph(_0x493d29,_0xb15319){var _0x5441d1=new Graph();for(var _0x3ec309 in _0x493d29){if(_0x493d29['hasOwnProperty'](_0x3ec309)){if(_[_0x456a('0x24')](_0x493d29[_0x3ec309])){for(var _0x3f312f=0x0;_0x3f312f<_0x493d29[_0x3ec309][_0x456a('0x25')];_0x3f312f+=0x1){addVertex(_0x5441d1,_0x493d29[_0x3ec309][_0x3f312f],_0x3ec309);}}else{addVertex(_0x5441d1,_0x493d29[_0x3ec309],_0x3ec309);}}}for(var _0x2e8005=0x0;_0x2e8005<_0xb15319[_0x456a('0x25')];_0x2e8005+=0x1){if(_0xb15319[_0x2e8005][_0x456a('0x26')]&&_0xb15319[_0x2e8005][_0x456a('0x27')]){_0x5441d1[_0x456a('0x28')](_0xb15319[_0x2e8005]['source'],_0xb15319[_0x2e8005]['target'],_0xb15319[_0x2e8005]['value']);}}return _0x5441d1;}function getSquareProject(_0x38912b,_0x1d7794){rpc['getSquareProject'](_0x38912b)[_0x456a('0x29')](function(_0x374149){_0x1d7794(null,_0x374149);})[_0x456a('0x2a')](function(_0x336993){_0x1d7794(null,_0x336993);});}function createSquareReport(_0x257d18,_0x5db45b){rpc[_0x456a('0x2b')](_0x257d18)[_0x456a('0x29')](function(_0x546513){if(_0x5db45b){_0x5db45b(null,_0x546513);}})['catch'](function(_0x2f5088){if(_0x5db45b){_0x5db45b(null,_0x2f5088);}});}function setChannelVariables(_0x342c76){for(var _0x4f4693 in _0x342c76){if(_0x342c76[_0x456a('0x20')](_0x4f4693)){if(_0x4f4693[_0x456a('0x2c')](_0x456a('0x2d'))===0x0){_0x342c76[_0x4f4693[_0x456a('0x2e')](0x4)]=_0x342c76[_0x4f4693];delete _0x342c76[_0x4f4693];}}}}function getLogFromObject(_0x3e5e59){return util['inspect'](_0x3e5e59,{'showHidden':![],'depth':null});}function agiHandler(_0x37fe88){var _0x2ef52e,_0xd78121,_0x4820f7,_0x5a88ba,_0x44359f;logger['debug']('variables',JSON['stringify'](_0x37fe88,null,0x2));logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x2f'),_0x37fe88[_0x456a('0x18')],_0x37fe88['calleridname'],_0x37fe88[_0x456a('0x19')],_0x37fe88[_0x456a('0x1a')],_0x37fe88['uniqueid']));_0x37fe88['on'](_0x456a('0xb'),errorHandler);_0x37fe88['on'](_0x456a('0x30'),closeHandler);_0x37fe88['on'](_0x456a('0x31'),timeoutHandler);_0x37fe88[_0x456a('0x1d')]=![];_0x37fe88['on'](_0x456a('0x32'),hangupHandler);var _0x5113da=getSquareProject[_0x456a('0x33')](null,_0x37fe88[_0x456a('0x18')]);if(_0x5113da){if(_0x5113da['production']){_0x2ef52e=getRoot(_0x5113da[_0x456a('0x34')]);if(_0x2ef52e&&_0x2ef52e[_0x456a('0x35')]){logger[_0x456a('0x36')](_0x456a('0x37'),JSON[_0x456a('0x38')](_0x2ef52e,null,0x2));_0x37fe88[_0x456a('0x39')]=moment()[_0x456a('0x10')](_0x456a('0x3a'));_0xd78121=initGraph(_['omit'](_0x2ef52e,_0x456a('0x3b')),_0x2ef52e[_0x456a('0x3b')]);_0x4820f7=new Vertices(_0x37fe88,rpc,mailRpc);logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x3c'),_0x37fe88['arg_1'],_0x37fe88[_0x456a('0x3d')],_0x37fe88['callerid'],_0x37fe88[_0x456a('0x1a')],_0x37fe88[_0x456a('0x1b')]));_0xd78121['traverseBFS'](_0x2ef52e[_0x456a('0x35')]['id'],function(_0x3515f5){try{_0x3515f5=_0x4820f7[_0x456a('0x3e')](_0x3515f5);logger['debug'](_0x456a('0x3f'),JSON['stringify'](_0x3515f5,null,0x2));if(_0x3515f5['agicommand']===_0x456a('0x40')){logger['info'](_0x456a('0x41'));_0x37fe88[_0x456a('0x42')]=_0x3515f5['context']||_0x37fe88[_0x456a('0x42')];_0x37fe88[_0x456a('0x43')]=_0x3515f5[_0x456a('0x43')];_0x37fe88[_0x456a('0x44')]=_0x3515f5[_0x456a('0x44')]?_0x3515f5[_0x456a('0x44')]-0x1:0x1;return null;}else if(_0x3515f5&&_0x4820f7[_0x3515f5['agicommand']]){_0x44359f=_0x4820f7[_0x3515f5[_0x456a('0x1f')]](_0x3515f5);logger['info'](_0x456a('0x45'),JSON[_0x456a('0x38')](_0x44359f,null,0x2));if(_0x44359f&&_0x44359f[_0x456a('0x46')]===AGI_CODE_SUCCESS&&_0x44359f[_0x456a('0x47')]!==AGI_RESULT_ERROR&&!_0x37fe88[_0x456a('0x1d')]){logger['debug'](_0x456a('0x45'),getLogFromObject(_0x44359f));return _[_0x456a('0x48')](_0x44359f[_0x456a('0x47')])?null:_0x44359f[_0x456a('0x47')][_0x456a('0x49')]();}else{logger[_0x456a('0xb')](_0x456a('0x45'),getLogFromObject(_0x44359f));return null;}}else{logger['error'](_0x456a('0x4a'));return null;}}catch(_0x28eff9){logger[_0x456a('0xb')](_0x28eff9[_0x456a('0x16')]);return null;}});if(_0x2ef52e[_0x456a('0x4b')]){logger['info'](util[_0x456a('0x10')](_0x456a('0x4c'),_0x37fe88['arg_1'],_0x37fe88['calleridname'],_0x37fe88[_0x456a('0x19')],_0x37fe88['dnid'],_0x37fe88[_0x456a('0x1b')]));_0xd78121['traverseBFS'](_0x2ef52e[_0x456a('0x4b')]['id'],function(_0x17228a){try{_0x17228a=_0x4820f7['clear'](_0x17228a);logger['debug']('vertex',JSON[_0x456a('0x38')](_0x17228a,null,0x2));if(_0x17228a&&_0x4820f7[_0x17228a[_0x456a('0x1f')]]){_0x44359f=_0x4820f7[_0x17228a['agicommand']](_0x17228a);if(_0x44359f){logger['debug'](_0x456a('0x45'),getLogFromObject(_0x44359f));return _['isUndefined'](_0x44359f[_0x456a('0x47')])?null:_0x44359f[_0x456a('0x47')][_0x456a('0x49')]();}else{logger['error']('response',getLogFromObject(_0x44359f));return null;}}else{logger['error'](_0x456a('0x4a'));return null;}}catch(_0x211e91){logger[_0x456a('0xb')](_0x211e91['stack']);return null;}});}logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x4d'),_0x37fe88[_0x456a('0x18')],_0x37fe88[_0x456a('0x3d')],_0x37fe88[_0x456a('0x19')],_0x37fe88[_0x456a('0x1a')],_0x37fe88[_0x456a('0x1b')]));logger['info'](util[_0x456a('0x10')](_0x456a('0x4e'),_0x37fe88['context'],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88['priority'],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}else{logger[_0x456a('0xb')](util[_0x456a('0x10')](_0x456a('0x4f'),_0x37fe88['arg_1']));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88['extension'],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}else{logger['error'](util['format'](_0x456a('0x50'),_0x37fe88[_0x456a('0x18')]));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}function main(){var _0x101bc6;return utilLicense[_0x456a('0x51')]()[_0x456a('0x29')](function(_0x5d4f6a){if(_0x5d4f6a){if(_0x5d4f6a[_0x456a('0x52')]){if(_0x5d4f6a[_0x456a('0x53')]&&_0x5d4f6a['callysquare']>0x0){logger['info'](util['format'](_0x456a('0x54'),_0x5d4f6a[_0x456a('0x53')]));_0x101bc6=_0x5d4f6a[_0x456a('0x53')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x456a('0xf')](_0x456a('0x55'));_0x101bc6=-0x1;}}})['catch'](function(_0x560d02){logger[_0x456a('0xb')](_0x456a('0x56'),_0x560d02['stack']);})[_0x456a('0x4b')](function(){var _0xa819a4=require(_0x456a('0x57'))(config['agi'][_0x456a('0xe')],config[_0x456a('0x4')]['ip'],_0x101bc6);_0xa819a4['on'](_0x456a('0xb'),errorHandler);_0xa819a4['on'](_0x456a('0x58'),listeningHandler);_0xa819a4['on'](_0x456a('0x59'),connectionHandler);_0xa819a4['on'](_0x456a('0x30'),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 6b8b410..d9f0b11 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x21d5f0,_0x3f62e8){var _0x8e4d7e=function(_0x388084){while(--_0x388084){_0x21d5f0['push'](_0x21d5f0['shift']());}};_0x8e4d7e(++_0x3f62e8);}(_0x34e8,0x12c));var _0x834e=function(_0x4b06bc,_0x1579c9){_0x4b06bc=_0x4b06bc-0x0;var _0x5a4ced=_0x34e8[_0x4b06bc];return _0x5a4ced;};'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(_0x3c9867,_0x161a43){var _0x241d3c=function(_0x17f67f){while(--_0x17f67f){_0x3c9867['push'](_0x3c9867['shift']());}};_0x241d3c(++_0x161a43);}(_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 4590e09..5e51df6 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(_0x2c6256,_0x404ccf){var _0x4db857=function(_0x40bb9f){while(--_0x40bb9f){_0x2c6256['push'](_0x2c6256['shift']());}};_0x4db857(++_0x404ccf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x154a9f,_0x2e799d){_0x154a9f=_0x154a9f-0x0;var _0x33ac4c=_0x5f2f[_0x154a9f];return _0x33ac4c;};'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(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x5f2f,0x73));var _0xf5f2=function(_0xad7427,_0x317c2f){_0xad7427=_0xad7427-0x0;var _0xae9b8c=_0x5f2f[_0xad7427];return _0xae9b8c;};'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 b56f416..8d644f3 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 _0x6916=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','http','request','then','error','message','result','catch','getSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x4b4208,_0x187660){var _0x422d7c=function(_0x45f2b2){while(--_0x45f2b2){_0x4b4208['push'](_0x4b4208['shift']());}};_0x422d7c(++_0x187660);}(_0x6916,0x86));var _0x6691=function(_0x236b40,_0x5e958e){_0x236b40=_0x236b40-0x0;var _0x212b49=_0x6916[_0x236b40];return _0x212b49;};'use strict';var BPromise=require(_0x6691('0x0'));var moment=require(_0x6691('0x1'));var _=require(_0x6691('0x2'));var util=require(_0x6691('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6691('0x4')]({'port':0x2329});function request(_0xa1ae7f,_0x55efce){return new BPromise(function(_0x20298c,_0xb35687){return client[_0x6691('0x5')](_0xa1ae7f,_0x55efce)[_0x6691('0x6')](function(_0x3e86e5){if(_0x3e86e5['error']){return _0xb35687(_0x3e86e5[_0x6691('0x7')][_0x6691('0x8')]);}else{return _0x20298c(_0x3e86e5[_0x6691('0x9')]);}})[_0x6691('0xa')](function(_0xa472f6){return _0xb35687(_0xa472f6);});});}exports[_0x6691('0xb')]=function(_0x531b6e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x531b6e},'attributes':[_0x6691('0xc')]}});};exports['getMailAccountById']=function(_0x2fcf98){return request(_0x6691('0xd'),{'options':{'raw':![],'where':{'id':_0x2fcf98},'include':[{'model':_0x6691('0xe'),'as':_0x6691('0xf')}],'attributes':['id',_0x6691('0x10'),_0x6691('0x11')]}});};exports['getSquareProjectById']=function(_0x6963d){return request(_0x6691('0x12'),{'options':{'where':{'id':_0x6963d},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x13')]=function(_0x4c3230){return request(_0x6691('0x14'),{'options':{'where':{'id':_0x4c3230},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x15')]=function(_0x1153a5){return request('ShowVariable',{'options':{'where':{'id':_0x1153a5},'attributes':['name']}});};exports[_0x6691('0x16')]=function(_0x2df066){return request(_0x6691('0x17'),{'options':{'where':{'id':_0x2df066},'attributes':['dsn']}});};exports[_0x6691('0x18')]=function(_0x346c4f){return request(_0x6691('0x19'),{'options':{'where':{'id':_0x346c4f},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x1a')]=function(_0x279b30){return request(_0x6691('0x1b'),{'options':{'where':{'id':_0x279b30},'attributes':[_0x6691('0x10')]}});};exports[_0x6691('0x1c')]=function(_0x1a0b3e){return request('ShowSound',{'options':{'where':{'id':_0x1a0b3e},'attributes':[_0x6691('0x1d')]}});};exports[_0x6691('0x1e')]=function(_0xf017f3){return request(_0x6691('0x1f'),{'options':{'raw':![],'where':{'id':_0xf017f3},'include':[{'model':_0x6691('0x20'),'as':_0x6691('0x21')}]}});};exports[_0x6691('0x22')]=function(_0x21a3e0){return request(_0x6691('0x23'),{'options':{'where':{'id':_0x21a3e0},'attributes':['id',_0x6691('0x10')]}});};exports[_0x6691('0x24')]=function(_0x26dcca){return request(_0x6691('0x25'),{'body':_0x26dcca});};exports[_0x6691('0x26')]=function(_0x1fabea){return request(_0x6691('0x27'),{'body':_0x1fabea});};exports[_0x6691('0x28')]=function(_0x3d8469){return request(_0x6691('0x29'),{'body':_[_0x6691('0x2a')](_0x3d8469,{'project_name':_0x3d8469[_0x6691('0x2b')],'prev_project_name':_0x3d8469[_0x6691('0x2c')]||'','is_subproject':_0x3d8469['arg_2']?!![]:![],'leaveAt':moment()[_0x6691('0x2d')](_0x6691('0x2e'))})});};exports[_0x6691('0x2f')]=function(_0x539779){return request(_0x6691('0x30'),{'body':_0x539779});};exports[_0x6691('0x31')]=function(_0x304379){return request(_0x6691('0x32'),{'body':_0x304379});};exports['createCmContact']=function(_0xf6f0a2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xf6f0a2['phone'],'ListId':_0xf6f0a2[_0x6691('0x33')]}}})[_0x6691('0x6')](function(_0x218355){if(_0x218355){return _0x218355;}return request('CreateCmContact',{'body':_0xf6f0a2});});};exports['getPauseById']=function(_0x4e7632){return request(_0x6691('0x34'),{'options':{'where':{'id':_0x4e7632},'attributes':['name']}});};exports['agentLogin']=function(_0x2f8441,_0x54ac6e){return request(_0x6691('0x35'),{'body':{'interface':_0x54ac6e},'options':{'where':_0x2f8441}});};exports[_0x6691('0x36')]=function(_0xd96a0e,_0x3fda20,_0x1d2ffc){return request(_0x6691('0x37'),{'body':{'type':_0x3fda20,'uniqueid':_0x1d2ffc},'options':{'where':_0xd96a0e}});};exports[_0x6691('0x38')]=function(_0x4b6396){return request('UnpauseUser',{'body':{},'options':{'where':_0x4b6396}});};exports[_0x6691('0x39')]=function(_0x3fc61f){return request(_0x6691('0x3a'),{'body':{},'options':{'where':_0x3fc61f}});}; \ No newline at end of file +var _0x0965=['Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','message','result','catch','getSquareProject','production','getMailAccountById','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x23f126,_0x4f9eb8){var _0x3cecdb=function(_0xdbf936){while(--_0xdbf936){_0x23f126['push'](_0x23f126['shift']());}};_0x3cecdb(++_0x4f9eb8);}(_0x0965,0x138));var _0x5096=function(_0x2b9f71,_0x6b9330){_0x2b9f71=_0x2b9f71-0x0;var _0x15fdda=_0x0965[_0x2b9f71];return _0x15fdda;};'use strict';var BPromise=require(_0x5096('0x0'));var moment=require(_0x5096('0x1'));var _=require('lodash');var util=require(_0x5096('0x2'));var jayson=require(_0x5096('0x3'));var client=jayson[_0x5096('0x4')][_0x5096('0x5')]({'port':0x2329});function request(_0x1e9e34,_0x2ed206){return new BPromise(function(_0x17a996,_0x2c39cf){return client['request'](_0x1e9e34,_0x2ed206)[_0x5096('0x6')](function(_0x4a1f97){if(_0x4a1f97['error']){return _0x2c39cf(_0x4a1f97['error'][_0x5096('0x7')]);}else{return _0x17a996(_0x4a1f97[_0x5096('0x8')]);}})[_0x5096('0x9')](function(_0x19cbcd){return _0x2c39cf(_0x19cbcd);});});}exports[_0x5096('0xa')]=function(_0x5cad92){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5cad92},'attributes':[_0x5096('0xb')]}});};exports[_0x5096('0xc')]=function(_0x4fbc1c){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4fbc1c},'include':[{'model':'MailServerOut','as':_0x5096('0xd')}],'attributes':['id',_0x5096('0xe'),_0x5096('0xf')]}});};exports['getSquareProjectById']=function(_0x38576d){return request(_0x5096('0x10'),{'options':{'where':{'id':_0x38576d},'attributes':['name']}});};exports[_0x5096('0x11')]=function(_0x18978c){return request(_0x5096('0x12'),{'options':{'where':{'id':_0x18978c},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x13')]=function(_0x178b4e){return request(_0x5096('0x14'),{'options':{'where':{'id':_0x178b4e},'attributes':['name']}});};exports[_0x5096('0x15')]=function(_0x3b31f1){return request(_0x5096('0x16'),{'options':{'where':{'id':_0x3b31f1},'attributes':[_0x5096('0x17')]}});};exports[_0x5096('0x18')]=function(_0x1dc217){return request('ShowUser',{'options':{'where':{'id':_0x1dc217},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x19')]=function(_0x3cb333){return request('ShowTrunk',{'options':{'where':{'id':_0x3cb333},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x1a')]=function(_0x427729){return request(_0x5096('0x1b'),{'options':{'where':{'id':_0x427729},'attributes':[_0x5096('0x1c')]}});};exports[_0x5096('0x1d')]=function(_0x158ab7){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x158ab7},'include':[{'model':'Interval','as':_0x5096('0x1e')}]}});};exports['getSmsAccountById']=function(_0x4561f0){return request(_0x5096('0x1f'),{'options':{'where':{'id':_0x4561f0},'attributes':['id','name']}});};exports[_0x5096('0x20')]=function(_0xb919e1){return request(_0x5096('0x21'),{'body':_0xb919e1});};exports[_0x5096('0x22')]=function(_0x20b617){return request(_0x5096('0x23'),{'body':_0x20b617});};exports[_0x5096('0x24')]=function(_0x57c177){return request(_0x5096('0x25'),{'body':_[_0x5096('0x26')](_0x57c177,{'project_name':_0x57c177[_0x5096('0x27')],'prev_project_name':_0x57c177[_0x5096('0x28')]||'','is_subproject':_0x57c177[_0x5096('0x28')]?!![]:![],'leaveAt':moment()[_0x5096('0x29')](_0x5096('0x2a'))})});};exports[_0x5096('0x2b')]=function(_0x5c4f7c){return request(_0x5096('0x2c'),{'body':_0x5c4f7c});};exports[_0x5096('0x2d')]=function(_0x1462eb){return request(_0x5096('0x2e'),{'body':_0x1462eb});};exports['createCmContact']=function(_0x4ceea1){return request(_0x5096('0x2f'),{'options':{'raw':![],'where':{'phone':_0x4ceea1[_0x5096('0x30')],'ListId':_0x4ceea1[_0x5096('0x31')]}}})['then'](function(_0xfc76f1){if(_0xfc76f1){return _0xfc76f1;}return request(_0x5096('0x32'),{'body':_0x4ceea1});});};exports[_0x5096('0x33')]=function(_0x2f9552){return request(_0x5096('0x34'),{'options':{'where':{'id':_0x2f9552},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x35')]=function(_0x282e8d,_0x35455b){return request('LoginUser',{'body':{'interface':_0x35455b},'options':{'where':_0x282e8d}});};exports[_0x5096('0x36')]=function(_0x4679c2,_0xd4f3f7,_0xb54e7f){return request('PauseUser',{'body':{'type':_0xd4f3f7,'uniqueid':_0xb54e7f},'options':{'where':_0x4679c2}});};exports['agentUnpause']=function(_0x441c6d){return request('UnpauseUser',{'body':{},'options':{'where':_0x441c6d}});};exports[_0x5096('0x37')]=function(_0x21a270){return request(_0x5096('0x38'),{'body':{},'options':{'where':_0x21a270}});}; \ 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 8d6b36f..3a80342 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 _0xb903=['./lex','exports','./polly'];(function(_0x46891a,_0x3e3051){var _0x4c578d=function(_0x3cf400){while(--_0x3cf400){_0x46891a['push'](_0x46891a['shift']());}};_0x4c578d(++_0x3e3051);}(_0xb903,0x185));var _0x3b90=function(_0x15bb89,_0x31f315){_0x15bb89=_0x15bb89-0x0;var _0x5c5cad=_0xb903[_0x15bb89];return _0x5c5cad;};var polly=require(_0x3b90('0x0'));var lex=require(_0x3b90('0x1'));module[_0x3b90('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xca66=['./polly'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xca66,0x8b));var _0x6ca6=function(_0x1712bf,_0x108510){_0x1712bf=_0x1712bf-0x0;var _0x36d4c4=_0xca66[_0x1712bf];return _0x36d4c4;};var polly=require(_0x6ca6('0x0'));var lex=require('./lex');module['exports']={'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 55460e0..f74ede6 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 _0x089f=['exports'];(function(_0xa4c4b4,_0x45fa4f){var _0x3da88c=function(_0x2cf71d){while(--_0x2cf71d){_0xa4c4b4['push'](_0xa4c4b4['shift']());}};_0x3da88c(++_0x45fa4f);}(_0x089f,0x1c7));var _0xf089=function(_0x3f4ec8,_0x3b9f52){_0x3f4ec8=_0x3f4ec8-0x0;var _0x4366b2=_0x089f[_0x3f4ec8];return _0x4366b2;};'use strict';var lex=require('./lib/api');module[_0xf089('0x0')]=function(_0x3722ad,_0x250c0e,_0x3c38bf,_0x196df6,_0x4a5f5f,_0x2b7602){return lex(_0x3722ad,_0x250c0e,_0x3c38bf,_0x196df6,_0x4a5f5f,_0x2b7602);}; \ No newline at end of file +var _0x4b1f=['exports','./lib/api'];(function(_0x308557,_0x5a7a36){var _0xd8d5a8=function(_0x3a4761){while(--_0x3a4761){_0x308557['push'](_0x308557['shift']());}};_0xd8d5a8(++_0x5a7a36);}(_0x4b1f,0x195));var _0xf4b1=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4b1f[_0x500419];return _0x241c1a;};'use strict';var lex=require(_0xf4b1('0x0'));module[_0xf4b1('0x1')]=function(_0x4c24e7,_0x3012de,_0x10f8e6,_0x33af4b,_0x59d334,_0x19fb44){return lex(_0x4c24e7,_0x3012de,_0x10f8e6,_0x33af4b,_0x59d334,_0x19fb44);}; \ 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 fc17e61..3c02830 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 _0x4c8d=['postText','slots','slot_','exports','LexRuntime','bluebird','aws-sdk'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0x4c8d,0xa6));var _0xd4c8=function(_0x229928,_0x49778d){_0x229928=_0x229928-0x0;var _0x215743=_0x4c8d[_0x229928];return _0x215743;};'use strict';var BPromise=require(_0xd4c8('0x0'));var AWS=require(_0xd4c8('0x1'));function lexResult(_0x5959d7,_0x577e03){return new BPromise(function(_0x4170a5,_0x5e6392){_0x5959d7[_0xd4c8('0x2')](_0x577e03,function(_0x8d6383,_0x1e30d3){if(_0x8d6383){_0x5e6392(_0x8d6383);}if(_0x1e30d3['slots']){for(const _0x2312ac in _0x1e30d3[_0xd4c8('0x3')]){if(_0x1e30d3[_0xd4c8('0x3')]['hasOwnProperty'](_0x2312ac)){var _0x52be4a=_0x1e30d3['slots'][_0x2312ac];_0x1e30d3[_0xd4c8('0x4')+_0x2312ac]=_0x52be4a;}}}_0x4170a5(_0x1e30d3);});});}module[_0xd4c8('0x5')]=function(_0x341e96,_0x2de719,_0x210442,_0x5df68c,_0x5a5387,_0xedebf8){var _0x5545df=new AWS[(_0xd4c8('0x6'))]({'accessKeyId':_0x2de719,'secretAccessKey':_0x210442,'region':_0x5df68c});var _0x3e6095={'botAlias':'$LATEST','botName':_0xedebf8,'inputText':_0x5a5387,'userId':_0x341e96};return lexResult(_0x5545df,_0x3e6095);}; \ No newline at end of file +var _0xcb48=['slots','hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0xcb48,0x1b5));var _0x8cb4=function(_0xcd086b,_0x51cc16){_0xcd086b=_0xcd086b-0x0;var _0x400b95=_0xcb48[_0xcd086b];return _0x400b95;};'use strict';var BPromise=require(_0x8cb4('0x0'));var AWS=require(_0x8cb4('0x1'));function lexResult(_0x5be12c,_0x248352){return new BPromise(function(_0x5517f9,_0x44afe3){_0x5be12c[_0x8cb4('0x2')](_0x248352,function(_0x48a967,_0x40a1e4){if(_0x48a967){_0x44afe3(_0x48a967);}if(_0x40a1e4['slots']){for(const _0x4868cc in _0x40a1e4[_0x8cb4('0x3')]){if(_0x40a1e4[_0x8cb4('0x3')][_0x8cb4('0x4')](_0x4868cc)){var _0x207dce=_0x40a1e4[_0x8cb4('0x3')][_0x4868cc];_0x40a1e4['slot_'+_0x4868cc]=_0x207dce;}}}_0x5517f9(_0x40a1e4);});});}module[_0x8cb4('0x5')]=function(_0x48a631,_0x156958,_0x1adf77,_0x599247,_0x146fd9,_0x271b4e){var _0x12650b=new AWS[(_0x8cb4('0x6'))]({'accessKeyId':_0x156958,'secretAccessKey':_0x1adf77,'region':_0x599247});var _0x4511ec={'botAlias':_0x8cb4('0x7'),'botName':_0x271b4e,'inputText':_0x146fd9,'userId':_0x48a631};return lexResult(_0x12650b,_0x4511ec);}; \ 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 4493d4a..fb7c53e 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 _0xf206=['exports'];(function(_0x45468d,_0x17ec6b){var _0x53cc19=function(_0x303857){while(--_0x303857){_0x45468d['push'](_0x45468d['shift']());}};_0x53cc19(++_0x17ec6b);}(_0xf206,0x1e5));var _0x6f20=function(_0x40faf2,_0x4e0e3e){_0x40faf2=_0x40faf2-0x0;var _0x17b052=_0xf206[_0x40faf2];return _0x17b052;};'use strict';var polly=require('./lib/api');module[_0x6f20('0x0')]=function(_0x521dab,_0x350078,_0x5e35d1,_0x88b743,_0x2cec99,_0x1e52ab,_0x5f0a33){return polly(_0x521dab,_0x350078,_0x5e35d1,_0x88b743,_0x2cec99,_0x1e52ab,_0x5f0a33);}; \ No newline at end of file +var _0x8c32=['exports','./lib/api'];(function(_0x4bf74a,_0x3d268b){var _0x9f6c0a=function(_0x2ce75e){while(--_0x2ce75e){_0x4bf74a['push'](_0x4bf74a['shift']());}};_0x9f6c0a(++_0x3d268b);}(_0x8c32,0x89));var _0x28c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8c32[_0x40a045];return _0x1a687c;};'use strict';var polly=require(_0x28c3('0x0'));module[_0x28c3('0x1')]=function(_0x41f3cc,_0x6f7dc9,_0x4f168a,_0x3eb33d,_0x18b898,_0x2dd640,_0x50e6be){return polly(_0x41f3cc,_0x6f7dc9,_0x4f168a,_0x3eb33d,_0x18b898,_0x2dd640,_0x50e6be);}; \ 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 bc09e32..bcac959 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 _0xf427=['randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x4184dd,_0x55c769){var _0x1f903e=function(_0x2e34c6){while(--_0x2e34c6){_0x4184dd['push'](_0x4184dd['shift']());}};_0x1f903e(++_0x55c769);}(_0xf427,0x196));var _0x7f42=function(_0x20886d,_0x32d581){_0x20886d=_0x20886d-0x0;var _0xdce575=_0xf427[_0x20886d];return _0xdce575;};'use strict';var fs=require('fs');var path=require(_0x7f42('0x0'));var BPromise=require(_0x7f42('0x1'));var rs=require(_0x7f42('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x1dab8e,_0x288c9f,_0x9f0ce3){return new BPromise(function(_0x488a34,_0x24e72e){_0x1dab8e[_0x7f42('0x3')](_0x288c9f,function(_0x2425af,_0x6a547e){if(_0x2425af){_0x24e72e(_0x2425af);}else if(_0x6a547e){if(_0x6a547e[_0x7f42('0x4')]instanceof Buffer){fs[_0x7f42('0x5')](_0x9f0ce3,_0x6a547e['AudioStream'],function(_0x16ef23){if(_0x16ef23){_0x24e72e(_0x16ef23);}else{_0x488a34();}});}else{_0x24e72e(new Error(_0x7f42('0x6')));}}else{_0x24e72e(new Error(_0x7f42('0x7')));}});});}module[_0x7f42('0x8')]=function(_0x304fb4,_0x3c9ae4,_0x38d700,_0x548e39,_0x1dd3f8,_0x50e227,_0x2592fe){var _0x46e828=new AWS[(_0x7f42('0x9'))]({'accessKeyId':_0x304fb4,'secretAccessKey':_0x3c9ae4,'region':_0x38d700});var _0x3c905c={'Text':_0x1dd3f8,'TextType':_0x50e227||_0x7f42('0xa'),'OutputFormat':_0x7f42('0xb'),'VoiceId':_0x548e39};return pollyResult(_0x46e828,_0x3c905c,_0x2592fe);}; \ No newline at end of file +var _0x288e=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1f625b,_0x276b0e){var _0x748222=function(_0x324a51){while(--_0x324a51){_0x1f625b['push'](_0x1f625b['shift']());}};_0x748222(++_0x276b0e);}(_0x288e,0x12e));var _0xe288=function(_0x453a0f,_0x5a1486){_0x453a0f=_0x453a0f-0x0;var _0x2dbf32=_0x288e[_0x453a0f];return _0x2dbf32;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xe288('0x0'));var rs=require(_0xe288('0x1'));var AWS=require(_0xe288('0x2'));function pollyResult(_0x22536a,_0x3b59aa,_0x2714e8){return new BPromise(function(_0x3a61ef,_0x421907){_0x22536a[_0xe288('0x3')](_0x3b59aa,function(_0x533d36,_0xc9f8dc){if(_0x533d36){_0x421907(_0x533d36);}else if(_0xc9f8dc){if(_0xc9f8dc[_0xe288('0x4')]instanceof Buffer){fs[_0xe288('0x5')](_0x2714e8,_0xc9f8dc[_0xe288('0x4')],function(_0x2e95e9){if(_0x2e95e9){_0x421907(_0x2e95e9);}else{_0x3a61ef();}});}else{_0x421907(new Error(_0xe288('0x6')));}}else{_0x421907(new Error(_0xe288('0x7')));}});});}module[_0xe288('0x8')]=function(_0x195d7b,_0x339c4c,_0x226984,_0x33403f,_0x413afe,_0x4d2c59,_0x5739c0){var _0x32a62f=new AWS['Polly']({'accessKeyId':_0x195d7b,'secretAccessKey':_0x339c4c,'region':_0x226984});var _0xfc7a44={'Text':_0x413afe,'TextType':_0x4d2c59||_0xe288('0x9'),'OutputFormat':_0xe288('0xa'),'VoiceId':_0x33403f};return pollyResult(_0x32a62f,_0xfc7a44,_0x5739c0);}; \ 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 c399e1c..adb2ef7 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 _0xe4af=['exports'];(function(_0x1e7e68,_0x2f0217){var _0x414c55=function(_0x41c5a5){while(--_0x41c5a5){_0x1e7e68['push'](_0x1e7e68['shift']());}};_0x414c55(++_0x2f0217);}(_0xe4af,0x13c));var _0xfe4a=function(_0xcdcf2,_0x1e6048){_0xcdcf2=_0xcdcf2-0x0;var _0x35773b=_0xe4af[_0xcdcf2];return _0x35773b;};'use strict';var asr=require('./lib/api');module[_0xfe4a('0x0')]=function(_0x21e460,_0x505e47,_0x57c28a,_0x12874e){return asr(_0x21e460,_0x505e47,_0x57c28a);}; \ No newline at end of file +var _0xc9e0=['./lib/api'];(function(_0x4a1fa5,_0x251f61){var _0x27fd7c=function(_0x2f9993){while(--_0x2f9993){_0x4a1fa5['push'](_0x4a1fa5['shift']());}};_0x27fd7c(++_0x251f61);}(_0xc9e0,0x16b));var _0x0c9e=function(_0x2bf235,_0x5b2e9b){_0x2bf235=_0x2bf235-0x0;var _0x473e39=_0xc9e0[_0x2bf235];return _0x473e39;};'use strict';var asr=require(_0x0c9e('0x0'));module['exports']=function(_0x4b46ca,_0x3f88ff,_0x8213f2,_0xe94f9f){return asr(_0x4b46ca,_0x3f88ff,_0x8213f2);}; \ 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 e42415a..87e7c58 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 _0xfc8a=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','length','undefined','readFileSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc8a,0xae));var _0xafc8=function(_0x471be9,_0x359087){_0x471be9=_0x471be9-0x0;var _0x336558=_0xfc8a[_0x471be9];return _0x336558;};'use strict';var url=require(_0xafc8('0x0'));var BPromise=require(_0xafc8('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xafc8('0x2')]=function(_0x84eae7,_0x480597,_0x577c6d){return new BPromise(function(_0x45a670,_0x4f88ab){var _0xc0ecba;if(typeof _0x84eae7!==_0xafc8('0x3')||_0x84eae7['length']===0x0){return _0x4f88ab(_0xafc8('0x4'));}if(typeof _0x480597!==_0xafc8('0x3')||_0x480597[_0xafc8('0x5')]===0x0){return _0x4f88ab('key\x20should\x20be\x20a\x20string');}if(typeof _0x577c6d!==_0xafc8('0x6')&&(typeof _0x577c6d!==_0xafc8('0x3')||_0x577c6d[_0xafc8('0x5')]===0x0)){return _0x4f88ab('lang\x20should\x20be\x20a\x20string');}try{_0xc0ecba=fs[_0xafc8('0x7')](_0x84eae7)[_0xafc8('0x8')](_0xafc8('0x9'));}catch(_0x27fcca){return _0x4f88ab(_0x27fcca);}return _0x45a670({'method':_0xafc8('0xa'),'uri':host+_0xafc8('0xb')+_0x480597,'body':{'config':{'encoding':_0xafc8('0xc'),'sampleRateHertz':_0xafc8('0xd'),'languageCode':_0x577c6d},'audio':{'content':_0xc0ecba}},'json':!![]});});}; \ No newline at end of file +var _0x7baa=['undefined','length','readFileSync','base64','POST','/v1/speech:recognize?key=','url','bluebird','string'];(function(_0x949e2e,_0x267e46){var _0x40edbb=function(_0x4d7f84){while(--_0x4d7f84){_0x949e2e['push'](_0x949e2e['shift']());}};_0x40edbb(++_0x267e46);}(_0x7baa,0x165));var _0xa7ba=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7baa[_0x138f59];return _0x3d114d;};'use strict';var url=require(_0xa7ba('0x0'));var BPromise=require(_0xa7ba('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x195c36,_0x194930,_0x39955d){return new BPromise(function(_0x2c19fe,_0x161b64){var _0x299a7a;if(typeof _0x195c36!==_0xa7ba('0x2')||_0x195c36['length']===0x0){return _0x161b64('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x194930!=='string'||_0x194930['length']===0x0){return _0x161b64('key\x20should\x20be\x20a\x20string');}if(typeof _0x39955d!==_0xa7ba('0x3')&&(typeof _0x39955d!==_0xa7ba('0x2')||_0x39955d[_0xa7ba('0x4')]===0x0)){return _0x161b64('lang\x20should\x20be\x20a\x20string');}try{_0x299a7a=fs[_0xa7ba('0x5')](_0x195c36)['toString'](_0xa7ba('0x6'));}catch(_0x546fc1){return _0x161b64(_0x546fc1);}return _0x2c19fe({'method':_0xa7ba('0x7'),'uri':host+_0xa7ba('0x8')+_0x194930,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x39955d},'audio':{'content':_0x299a7a}},'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 acbb1fe..b1b3168 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 _0x1324=['./asr'];(function(_0x184486,_0x36669d){var _0x55c949=function(_0x99217a){while(--_0x99217a){_0x184486['push'](_0x184486['shift']());}};_0x55c949(++_0x36669d);}(_0x1324,0x1c3));var _0x4132=function(_0x3c0444,_0x5dad2d){_0x3c0444=_0x3c0444-0x0;var _0x456e6f=_0x1324[_0x3c0444];return _0x456e6f;};var asr=require(_0x4132('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0c45=['./asr'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0c45,0x1ec));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};var asr=require(_0x50c4('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 85e6662..cc44b29 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 _0x710e=['Dialogflow\x20V2\x20response:','stringify','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','info','error','download\x20error','pipe','end','data','transcode','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','text:synthesize','POST','.mp3','from','audioContent','base64','writeFile','utf8','application/x-www-form-urlencoded','jQ1olc','en-US','null','log','RET:','RET\x20slic:','eval\x20RET\x20slic:','slice','ERR','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','REPONSE2','buffer2','filepath','desdt','destination\x20ended\x202\x20da\x20gen','googleASR','asr','uri','unlink','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','status','code','metadata','SessionsClient','detectIntent','length'];(function(_0xbabc93,_0x377f32){var _0x2a29c9=function(_0x34a13a){while(--_0x34a13a){_0xbabc93['push'](_0xbabc93['shift']());}};_0x2a29c9(++_0x377f32);}(_0x710e,0x1b9));var _0xe710=function(_0x1150d3,_0x1052d3){_0x1150d3=_0x1150d3-0x0;var _0x29188d=_0x710e[_0x1150d3];return _0x29188d;};'use strict';var apiai=require(_0xe710('0x0'));var BPromise=require(_0xe710('0x1'));var dialogflow=require(_0xe710('0x2'));var fs=require('fs');var http=require(_0xe710('0x3'));var https=require(_0xe710('0x4'));var md5=require(_0xe710('0x5'));var path=require(_0xe710('0x6'));var querystring=require(_0xe710('0x7'));var rp=require('request-promise');var rs=require(_0xe710('0x8'));var sox=require(_0xe710('0x9'));var tts=require(_0xe710('0xa'));var urlParse=require(_0xe710('0xb'))[_0xe710('0xc')];var util=require(_0xe710('0xd'));var aws=require('./aws');var google=require(_0xe710('0xe'));var sestek=require('./sestek');var tilde=require(_0xe710('0xf'));var logger=require(_0xe710('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x124edd,_0x579e4d){return new BPromise(function(_0x4a3cc1,_0x393170){var _0x37fe7f=urlParse(_0x124edd);var _0x2f72f9=_0x37fe7f[_0xe710('0x11')]===_0xe710('0x12')?https:http;var _0x322084={'host':_0x37fe7f[_0xe710('0x13')],'path':_0x37fe7f[_0xe710('0x6')],'headers':{'user-agent':_0xe710('0x14')}};_0x2f72f9[_0xe710('0x15')](_0x322084,function(_0x5149da){if(_0x5149da[_0xe710('0x16')]!==0xc8){logger['error']('request\x20to\x20'+_0x124edd+_0xe710('0x17')+_0x5149da[_0xe710('0x16')]+'\x20('+_0x5149da[_0xe710('0x18')]+')');_0x393170(new Error(_0xe710('0x19')+_0x124edd+'\x20failed,\x20status\x20code\x20=\x20'+_0x5149da['statusCode']+'\x20('+_0x5149da[_0xe710('0x18')]+')'));return;}var _0x1843e4=fs[_0xe710('0x1a')](_0x579e4d);_0x1843e4['on']('finish',function(){logger[_0xe710('0x1b')]('finish\x20download\x20file');_0x1843e4['close'](_0x4a3cc1);});_0x1843e4['on'](_0xe710('0x1c'),function(_0x3ff53c){fs['unlink'](_0x579e4d);logger['error'](_0xe710('0x1d'),_0x3ff53c);_0x393170(_0x3ff53c);});_0x5149da[_0xe710('0x1e')](_0x1843e4);})['on'](_0xe710('0x1c'),function(_0xf00a2c){logger['error'](_0xf00a2c);_0x393170(_0xf00a2c);})[_0xe710('0x1f')]();});}function uploadFile(_0x110488){return new BPromise(function(_0x105dc3,_0x17c7fd){var _0x408279=urlParse(_0x110488);var _0x3d3fc7=_0x408279[_0xe710('0x11')]===_0xe710('0x12')?https:http;var _0x470b8d={'host':_0x408279[_0xe710('0x13')],'path':_0x408279[_0xe710('0x6')],'headers':{'user-agent':_0xe710('0x14')}};_0x3d3fc7[_0xe710('0x15')](_0x470b8d,function(_0x2cca13){if(_0x2cca13[_0xe710('0x16')]!==0xc8){_0x17c7fd(new Error(_0xe710('0x19')+_0x110488+_0xe710('0x17')+_0x2cca13['statusCode']+'\x20('+_0x2cca13[_0xe710('0x18')]+')'));return;}var _0x5affb3='';_0x2cca13['on'](_0xe710('0x20'),function(_0x481d88){_0x5affb3+=_0x481d88;});_0x2cca13['on']('end',function(){_0x105dc3(_0x5affb3);});})['on']('error',function(_0x1b326a){_0x17c7fd(_0x1b326a);})['end']();});}function convertFile(_0x828f88,_0x2370fe){return new BPromise(function(_0x44d588,_0x5afaf8){var _0x52dac5=sox[_0xe710('0x21')](_0x828f88,_0x2370fe,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52dac5['on'](_0xe710('0x1c'),function(_0x278611){logger[_0xe710('0x1c')]('error\x20convert',_0x278611);_0x5afaf8(_0x278611);});_0x52dac5['on'](_0xe710('0x1f'),function(){logger[_0xe710('0x1b')]('finish\x20to\x20convert');_0x44d588();});_0x52dac5[_0xe710('0x22')]();});}function base64Decode(_0x2668de,_0x345830){var _0x2ab188=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));fs[_0xe710('0x27')](_0x2ab188,_0x2668de,'base64');return convertFile(_0x2ab188,_0x345830)[_0xe710('0x28')](function(){try{fs['unlink'](_0x2ab188);fs[_0xe710('0x29')](_0x345830,_0xe710('0x2a'));}catch(_0x42b245){logger[_0xe710('0x1c')](_0x42b245);}return _0x345830[_0xe710('0x2b')]('.')[0x0];});}function base64Encode(_0x5e9872){var _0x382bf4=fs[_0xe710('0x2c')](_0x5e9872);return new Buffer(_0x382bf4)[_0xe710('0x2d')]('base64');}exports['googleCloudTTS']=function(_0x21c6aa,_0x1efcdd,_0x4304ac,_0x4ee039,_0x2d26a0,_0x514687){var _0x100dfa,_0x4b356c;var _0x1c0a8a='https://texttospeech.googleapis.com/v1/';var _0xcd2bc8=_0xe710('0x2e')+_0x21c6aa;var _0x389124={};if(_0x1efcdd===_0xe710('0x2f')){_0x389124['input']={'ssml':_0x4304ac};}else{_0x389124[_0xe710('0x30')]={'text':_0x4304ac};};_0x389124[_0xe710('0x31')]={'languageCode':_0x4ee039,'ssmlGender':_0x2d26a0};_0x389124['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1d611e={'url':_0x1c0a8a+_0xe710('0x32')+_0xcd2bc8,'method':_0xe710('0x33'),'json':!![],'body':_0x389124};return rp(_0x1d611e)[_0xe710('0x28')](function(_0x708bee){return new BPromise(function(_0x38a863,_0xec2e36){_0x100dfa=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));var _0x3baf33=Buffer[_0xe710('0x35')](_0x708bee[_0xe710('0x36')],_0xe710('0x37'));return fs[_0xe710('0x38')](_0x100dfa,_0x3baf33,function(_0x145388){_0xec2e36(_0x145388);},function(_0x2990c3){fs[_0xe710('0x29')](_0x100dfa,'777');_0x38a863(_0x2990c3);});});})[_0xe710('0x28')](function(_0x1a7b58){_0x4b356c=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));return convertFile(_0x100dfa,_0x4b356c);})[_0xe710('0x28')](function(){try{fs['unlink'](_0x100dfa);fs['chmodSync'](_0x4b356c,_0xe710('0x2a'));}catch(_0x3d6a78){logger[_0xe710('0x1c')](_0x3d6a78);}logger[_0xe710('0x1b')]('googleCloudTTS\x20path',_0x4b356c[_0xe710('0x2b')]('.')[0x0]);return _0x4b356c['split']('.')[0x0];});};exports['googleTTS']=function(_0x228268,_0x1a9c70){var _0xd562fd,_0x15a3c5;var _0x53a555;var _0x398c16={'encoding':_0xe710('0x39'),'method':_0xe710('0x33'),'timeout':0x2710,'url':'https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','headers':{'Content-Type':_0xe710('0x3a')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xe710('0x3b'),JSON['stringify']([_0x228268,_0x1a9c70||_0xe710('0x3c'),![],_0xe710('0x3d')]),null,'generic']]]))};console['log']('TRY\x20TO\x20GET2',_0x398c16);return rp(_0x398c16)['then'](function(_0x5af2d4){console[_0xe710('0x3e')](_0xe710('0x3f'),_0x5af2d4);try{console[_0xe710('0x3e')](_0xe710('0x40'),_0x5af2d4['slice'](0x5));console[_0xe710('0x3e')](_0xe710('0x41'),eval(_0x5af2d4['slice'](0x5))[0x0][0x2]);_0x53a555=eval(_0x5af2d4[_0xe710('0x42')](0x5))[0x0][0x2];console['log']('AFTER\x20SLICE',_0x53a555);}catch(_0x289fdc){console['log'](_0xe710('0x43'),_0x289fdc);throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe710('0x20')]);}if(!_0x53a555){throw new Error(_0xe710('0x44')+lang+_0xe710('0x45'));}try{_0x53a555=eval(_0x53a555)[0x0];}catch(_0x1c3313){throw new Error(_0xe710('0x46')+res[_0xe710('0x20')]);}console[_0xe710('0x3e')](_0xe710('0x47'),_0x53a555);const _0x4f9d4c=_0x53a555;console[_0xe710('0x3e')](_0xe710('0x48'),_0x4f9d4c);_0xd562fd=path['resolve'](__dirname,'tmp',rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));console['log'](_0xe710('0x49'),_0xd562fd);fs[_0xe710('0x27')](_0xd562fd,_0x53a555,{'encoding':_0xe710('0x37')});_0x15a3c5=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x26'));console[_0xe710('0x3e')](_0xe710('0x4a'),_0x15a3c5);return convertFile(_0xd562fd,_0x15a3c5);})[_0xe710('0x28')](function(){try{console[_0xe710('0x3e')](_0xe710('0x4a'),_0x15a3c5);fs[_0xe710('0x29')](_0x15a3c5,_0xe710('0x2a'));}catch(_0x20b8e4){logger[_0xe710('0x1c')](_0x20b8e4);}logger[_0xe710('0x1b')]('goggleTTS\x20path',_0x15a3c5[_0xe710('0x2b')]('.')[0x0]);console[_0xe710('0x3e')](_0xe710('0x4b'),_0x15a3c5[_0xe710('0x2b')]('.')[0x0]);return _0x15a3c5['split']('.')[0x0];});};exports[_0xe710('0x4c')]=function(_0x43b65f,_0x2ca584,_0x3acb0a){return google[_0xe710('0x4d')](_0x43b65f,_0x2ca584,_0x3acb0a)[_0xe710('0x28')](function(_0x8052bb){logger[_0xe710('0x1b')](_0x8052bb[_0xe710('0x4e')]);return rp(_0x8052bb);})[_0xe710('0x28')](function(_0x1ff72b){var _0x576c8a='';var _0x27f0bc=0x0;try{fs[_0xe710('0x4f')](_0x43b65f);}catch(_0x14dde6){logger[_0xe710('0x1c')](_0x14dde6);}if(_0x1ff72b&&_0x1ff72b[_0xe710('0x50')]){_0x576c8a=_0x1ff72b[_0xe710('0x50')][_0xe710('0x51')](function(_0xa1a771){return _0xa1a771&&_0xa1a771[_0xe710('0x52')][0x0]&&_0xa1a771[_0xe710('0x52')][0x0][_0xe710('0x53')]?_0xa1a771[_0xe710('0x52')][0x0][_0xe710('0x53')]:'';})[_0xe710('0x54')]('\x0a');_0x27f0bc=_0x1ff72b[_0xe710('0x50')][_0xe710('0x51')](function(_0x1de2bf){return _0x1de2bf&&_0x1de2bf['alternatives'][0x0]&&_0x1de2bf['alternatives'][0x0][_0xe710('0x55')]?_0x1de2bf['alternatives'][0x0][_0xe710('0x55')]:0x0;})[_0xe710('0x54')]('\x0a');}logger[_0xe710('0x1b')]('googleASR\x20transcription',_0x576c8a);logger[_0xe710('0x1b')](_0xe710('0x56'),_0x27f0bc);return{'transcript':_0x576c8a,'confidence':_0x27f0bc};})['catch'](function(_0xebded7){logger[_0xe710('0x1c')](_0xe710('0x57'),_0xebded7[_0xe710('0x16')],_0xebded7[_0xe710('0x58')],_0xebded7[_0xe710('0x59')]);});};exports[_0xe710('0x5a')]=function(_0x4a32cc,_0x4663fd,_0x40e475,_0x503907){var _0x5d7bdb=apiai(_0x4663fd,{'language':_0x503907||'en'});return _0x5d7bdb[_0xe710('0x5b')](_0x40e475,{'sessionId':md5(_0x4a32cc)})[_0xe710('0x28')](function(_0x58acf1){logger[_0xe710('0x1b')](JSON['stringify'](_0x58acf1));return{'source':_0x58acf1['result'][_0xe710('0x5c')],'resolvedQuery':_0x58acf1[_0xe710('0x5d')][_0xe710('0x5e')],'action':_0x58acf1[_0xe710('0x5d')][_0xe710('0x5f')],'actionIncomplete':_0x58acf1[_0xe710('0x5d')][_0xe710('0x60')],'speech':_0x58acf1[_0xe710('0x5d')]['fulfillment']['speech'],'score':_0x58acf1[_0xe710('0x5d')]['score'],'statusCode':_0x58acf1[_0xe710('0x61')][_0xe710('0x62')],'endConversation':_0x58acf1[_0xe710('0x5d')][_0xe710('0x63')]['endConversation']||![],'isFallbackIntent':_0x58acf1['result'][_0xe710('0x63')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x316618,_0x216dd7,_0x4fa1f9,_0x346253,_0x16e147,_0x384553){var _0x108caf=_0x346253['replace'](/\\n/g,'\x0a');var _0x262f78={'credentials':{'private_key':_0x108caf,'client_email':_0x4fa1f9}};var _0x33af8f=new dialogflow[(_0xe710('0x64'))](_0x262f78);var _0x5c9c6c=_0x33af8f['sessionPath'](_0x216dd7,md5(_0x316618));var _0x3a80c9={'session':_0x5c9c6c,'queryInput':{'text':{'text':_0x16e147,'languageCode':_0x384553}}};return _0x33af8f[_0xe710('0x65')](_0x3a80c9)[_0xe710('0x28')](function(_0x47ba2a){if(_0x47ba2a&&_0x47ba2a[_0xe710('0x66')]){logger[_0xe710('0x1b')](_0xe710('0x67'),JSON[_0xe710('0x68')](_0x47ba2a));var _0x58a64f=_0x47ba2a[0x0];if(_0x58a64f){var _0x57613a={'action':_0x58a64f[_0xe710('0x69')][_0xe710('0x5f')],'allRequiredParamsPresent':_0x58a64f[_0xe710('0x69')][_0xe710('0x6a')],'endConversation':_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')]&&_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')][_0xe710('0x6c')]?_0x58a64f[_0xe710('0x69')][_0xe710('0x6b')][_0xe710('0x6c')]['end_conversation'][_0xe710('0x6d')]:![],'fulfillmentText':_0x58a64f['queryResult'][_0xe710('0x6e')],'intentName':_0x58a64f[_0xe710('0x69')][_0xe710('0x6f')][_0xe710('0x58')],'intentDisplayName':_0x58a64f[_0xe710('0x69')]['intent'][_0xe710('0x70')],'isFallbackIntent':_0x58a64f[_0xe710('0x69')]['intent'][_0xe710('0x71')],'languageCode':_0x58a64f[_0xe710('0x69')][_0xe710('0x72')],'queryText':_0x58a64f[_0xe710('0x69')][_0xe710('0x73')],'responseId':_0x58a64f[_0xe710('0x74')],'score':_0x58a64f[_0xe710('0x69')][_0xe710('0x75')],'speech':_0x58a64f['queryResult'][_0xe710('0x6e')],'providerResponse':JSON[_0xe710('0x68')](_0x47ba2a)};return _0x57613a;}}});};exports['tildeASR']=function(_0xc919bc,_0x50e9c1,_0x367525,_0x45803e){return tilde['asr'](_0xc919bc,_0x50e9c1,_0x367525,_0x45803e)[_0xe710('0x28')](function(_0xbfcb8f){try{fs['unlink'](_0xc919bc);}catch(_0x37740f){logger[_0xe710('0x1c')](_0x37740f);}logger['info'](_0xe710('0x76'),_0xbfcb8f['transcript']);logger[_0xe710('0x1b')]('Tilde\x20ASR\x20confidence',_0xbfcb8f['confidence']);return _0xbfcb8f;});};exports['awsPolly']=function(_0x2ab691,_0x26d1a5,_0x255a7b,_0x3a6c20,_0x1d25b1,_0x20b3a9){var _0x35c99d=path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+_0xe710('0x34'));var _0x573881;return aws[_0xe710('0x77')](_0x2ab691,_0x26d1a5,_0x255a7b,_0x3a6c20,_0x1d25b1,_0x20b3a9,_0x35c99d)[_0xe710('0x28')](function(){_0x573881=path['resolve'](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+'.wav');return convertFile(_0x35c99d,_0x573881);})[_0xe710('0x28')](function(){try{fs[_0xe710('0x4f')](_0x35c99d);fs[_0xe710('0x29')](_0x573881,_0xe710('0x2a'));}catch(_0x4f2bad){logger[_0xe710('0x1c')](_0x4f2bad);}return _0x573881[_0xe710('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x23f3b0,_0x463149,_0x22ccf7,_0x5e1797,_0x21fb68,_0x185d60){return aws[_0xe710('0x78')](_0x23f3b0,_0x463149,_0x22ccf7,_0x5e1797,_0x21fb68,_0x185d60)[_0xe710('0x28')](function(_0x5dcde1){logger[_0xe710('0x1b')](JSON[_0xe710('0x68')](_0x5dcde1));return _0x5dcde1;});};exports[_0xe710('0x79')]=function(_0x17d713,_0x5c14f5,_0x124675,_0x40a8bb){var _0x431e94=util[_0xe710('0x7a')](_0xe710('0x7b'),ISPEECH_API,_0x17d713,encodeURIComponent(_0x5c14f5),_0x124675,_0x40a8bb);var _0x57d6d0=path[_0xe710('0x23')](__dirname,'tmp',rs[_0xe710('0x25')](0x4)+'.mp3');var _0x2e944b;return downloadFile(_0x431e94,_0x57d6d0)[_0xe710('0x28')](function(){_0x2e944b=path['resolve'](__dirname,_0xe710('0x24'),rs[_0xe710('0x25')](0x4)+'.wav');return convertFile(_0x57d6d0,_0x2e944b);})[_0xe710('0x28')](function(){try{fs['unlink'](_0x57d6d0);fs[_0xe710('0x29')](_0x2e944b,_0xe710('0x2a'));}catch(_0x3909c2){logger[_0xe710('0x1c')](_0x3909c2);}return _0x2e944b[_0xe710('0x2b')]('.')[0x0];});};exports[_0xe710('0x7c')]=function(_0x4a36b5,_0x3b9a97,_0x26302e,_0x2b7cef){var _0x539f90=util[_0xe710('0x7a')](_0xe710('0x7d'),ISPEECH_API,_0x3b9a97,_0x26302e,base64Encode(_0x4a36b5),_0x2b7cef?util[_0xe710('0x7a')]('model=%s',encodeURIComponent(_0x2b7cef)):_0xe710('0x7e'));return uploadFile(_0x539f90)[_0xe710('0x28')](function(_0x318cf6){return querystring['parse'](_0x318cf6);});};exports[_0xe710('0x7f')]=function(_0x5cd3aa,_0x1c81ee){return sestek[_0xe710('0x80')](_0x5cd3aa,_0x1c81ee)[_0xe710('0x28')](function(_0x136e37){logger[_0xe710('0x1b')](JSON[_0xe710('0x68')](_0x136e37));var _0x24a3a2={'speech':_0x136e37[_0xe710('0x81')],'action':_0x136e37[_0xe710('0x82')]?_0x136e37[_0xe710('0x82')][_0xe710('0x83')]:undefined,'actiondata':_0x136e37[_0xe710('0x82')]?_0x136e37['channelData']['CustomActionData']:undefined};if(_0x136e37[_0xe710('0x82')]&&_0x136e37[_0xe710('0x82')][_0xe710('0x84')]){return base64Decode(_0x136e37[_0xe710('0x82')]['AudioFromTts'][_0xe710('0x85')],path[_0xe710('0x23')](__dirname,_0xe710('0x24'),rs['generate'](0x4)+_0xe710('0x26')))[_0xe710('0x28')](function(_0x38945d){_0x24a3a2[_0xe710('0x86')]=_0x38945d;return _0x24a3a2;});}return _0x24a3a2;});};exports[_0xe710('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x3e3a=['?key=','input','voice','MP3','text:synthesize','POST','.mp3','from','writeFile','tmp','googleCloudTTS\x20path','googleTTS','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','en-US','null','generic','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','ERR','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','REPONSE2','buffer2','filepath','desdt','goggleTTS\x20path','destination\x20ended\x202\x20da\x20gen','asr','uri','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','fulfillmentText','intent','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','path','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','request\x20to\x20','data','transcode','error\x20convert','start','resolve','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x3dadd4,_0x7d686e){var _0x170539=function(_0x4e70fd){while(--_0x4e70fd){_0x3dadd4['push'](_0x3dadd4['shift']());}};_0x170539(++_0x7d686e);}(_0x3e3a,0x17a));var _0xa3e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3e3a[_0x3bf83f];return _0x22c4a9;};'use strict';var apiai=require(_0xa3e3('0x0'));var BPromise=require(_0xa3e3('0x1'));var dialogflow=require(_0xa3e3('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xa3e3('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0xa3e3('0x4'));var rp=require(_0xa3e3('0x5'));var rs=require(_0xa3e3('0x6'));var sox=require(_0xa3e3('0x7'));var tts=require('google-tts-api');var urlParse=require(_0xa3e3('0x8'))[_0xa3e3('0x9')];var util=require(_0xa3e3('0xa'));var aws=require(_0xa3e3('0xb'));var google=require(_0xa3e3('0xc'));var sestek=require('./sestek');var tilde=require(_0xa3e3('0xd'));var logger=require(_0xa3e3('0xe'))(_0xa3e3('0xf'));var ISPEECH_API=_0xa3e3('0x10');function downloadFile(_0x321686,_0x3f9d36){return new BPromise(function(_0x1e3da8,_0x377093){var _0x59c433=urlParse(_0x321686);var _0x6c9003=_0x59c433['protocol']==='https:'?https:http;var _0x43dfb9={'host':_0x59c433[_0xa3e3('0x11')],'path':_0x59c433[_0xa3e3('0x12')],'headers':{'user-agent':_0xa3e3('0x13')}};_0x6c9003[_0xa3e3('0x14')](_0x43dfb9,function(_0x1c541d){if(_0x1c541d[_0xa3e3('0x15')]!==0xc8){logger[_0xa3e3('0x16')]('request\x20to\x20'+_0x321686+_0xa3e3('0x17')+_0x1c541d[_0xa3e3('0x15')]+'\x20('+_0x1c541d[_0xa3e3('0x18')]+')');_0x377093(new Error('request\x20to\x20'+_0x321686+_0xa3e3('0x17')+_0x1c541d[_0xa3e3('0x15')]+'\x20('+_0x1c541d[_0xa3e3('0x18')]+')'));return;}var _0x565edb=fs['createWriteStream'](_0x3f9d36);_0x565edb['on'](_0xa3e3('0x19'),function(){logger[_0xa3e3('0x1a')](_0xa3e3('0x1b'));_0x565edb[_0xa3e3('0x1c')](_0x1e3da8);});_0x565edb['on']('error',function(_0x2d1a1c){fs[_0xa3e3('0x1d')](_0x3f9d36);logger[_0xa3e3('0x16')](_0xa3e3('0x1e'),_0x2d1a1c);_0x377093(_0x2d1a1c);});_0x1c541d[_0xa3e3('0x1f')](_0x565edb);})['on'](_0xa3e3('0x16'),function(_0x347e2b){logger['error'](_0x347e2b);_0x377093(_0x347e2b);})[_0xa3e3('0x20')]();});}function uploadFile(_0x12a454){return new BPromise(function(_0x2d30cc,_0x11da93){var _0x34bf57=urlParse(_0x12a454);var _0x56e9a1=_0x34bf57['protocol']===_0xa3e3('0x21')?https:http;var _0x3c4597={'host':_0x34bf57[_0xa3e3('0x11')],'path':_0x34bf57[_0xa3e3('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x56e9a1[_0xa3e3('0x14')](_0x3c4597,function(_0x24099d){if(_0x24099d[_0xa3e3('0x15')]!==0xc8){_0x11da93(new Error(_0xa3e3('0x22')+_0x12a454+'\x20failed,\x20status\x20code\x20=\x20'+_0x24099d[_0xa3e3('0x15')]+'\x20('+_0x24099d[_0xa3e3('0x18')]+')'));return;}var _0x2ade24='';_0x24099d['on'](_0xa3e3('0x23'),function(_0x3b9d4c){_0x2ade24+=_0x3b9d4c;});_0x24099d['on'](_0xa3e3('0x20'),function(){_0x2d30cc(_0x2ade24);});})['on'](_0xa3e3('0x16'),function(_0x5b298d){_0x11da93(_0x5b298d);})[_0xa3e3('0x20')]();});}function convertFile(_0x4d5f6c,_0x2c141d){return new BPromise(function(_0x5c9ec9,_0x16ca3b){var _0x1d6559=sox[_0xa3e3('0x24')](_0x4d5f6c,_0x2c141d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d6559['on'](_0xa3e3('0x16'),function(_0x54872b){logger[_0xa3e3('0x16')](_0xa3e3('0x25'),_0x54872b);_0x16ca3b(_0x54872b);});_0x1d6559['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x5c9ec9();});_0x1d6559[_0xa3e3('0x26')]();});}function base64Decode(_0x58836e,_0x47b602){var _0x1d274a=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));fs[_0xa3e3('0x2a')](_0x1d274a,_0x58836e,'base64');return convertFile(_0x1d274a,_0x47b602)[_0xa3e3('0x2b')](function(){try{fs['unlink'](_0x1d274a);fs[_0xa3e3('0x2c')](_0x47b602,_0xa3e3('0x2d'));}catch(_0x4d58b7){logger[_0xa3e3('0x16')](_0x4d58b7);}return _0x47b602[_0xa3e3('0x2e')]('.')[0x0];});}function base64Encode(_0x4b00e4){var _0x58169c=fs[_0xa3e3('0x2f')](_0x4b00e4);return new Buffer(_0x58169c)['toString'](_0xa3e3('0x30'));}exports[_0xa3e3('0x31')]=function(_0x27e41b,_0x3d286a,_0x17dc3d,_0x419134,_0x3077af,_0x1a2ef5){var _0xcd7501,_0x234503;var _0x50c859=_0xa3e3('0x32');var _0x3902aa=_0xa3e3('0x33')+_0x27e41b;var _0x29f7ec={};if(_0x3d286a==='ssml'){_0x29f7ec['input']={'ssml':_0x17dc3d};}else{_0x29f7ec[_0xa3e3('0x34')]={'text':_0x17dc3d};};_0x29f7ec[_0xa3e3('0x35')]={'languageCode':_0x419134,'ssmlGender':_0x3077af};_0x29f7ec['audioConfig']={'audioEncoding':_0xa3e3('0x36'),'sampleRateHertz':0x1f40};var _0x457c8d={'url':_0x50c859+_0xa3e3('0x37')+_0x3902aa,'method':_0xa3e3('0x38'),'json':!![],'body':_0x29f7ec};return rp(_0x457c8d)[_0xa3e3('0x2b')](function(_0x1cae9b){return new BPromise(function(_0x15f84d,_0x4a9d8f){_0xcd7501=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));var _0x2ef97b=Buffer[_0xa3e3('0x3a')](_0x1cae9b['audioContent'],_0xa3e3('0x30'));return fs[_0xa3e3('0x3b')](_0xcd7501,_0x2ef97b,function(_0x23e1f4){_0x4a9d8f(_0x23e1f4);},function(_0x7591dd){fs[_0xa3e3('0x2c')](_0xcd7501,'777');_0x15f84d(_0x7591dd);});});})[_0xa3e3('0x2b')](function(_0x1a4461){_0x234503=path['resolve'](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));return convertFile(_0xcd7501,_0x234503);})['then'](function(){try{fs[_0xa3e3('0x1d')](_0xcd7501);fs['chmodSync'](_0x234503,_0xa3e3('0x2d'));}catch(_0x1024e3){logger[_0xa3e3('0x16')](_0x1024e3);}logger[_0xa3e3('0x1a')](_0xa3e3('0x3d'),_0x234503['split']('.')[0x0]);return _0x234503[_0xa3e3('0x2e')]('.')[0x0];});};exports[_0xa3e3('0x3e')]=function(_0x5d3944,_0x3d2cd7){var _0x374578,_0x4eb5e3;var _0x3ea7cd;var _0x3c39c9={'encoding':_0xa3e3('0x3f'),'method':_0xa3e3('0x38'),'timeout':0x2710,'url':_0xa3e3('0x40'),'headers':{'Content-Type':_0xa3e3('0x41')},'body':_0xa3e3('0x42')+encodeURIComponent(JSON['stringify']([[[_0xa3e3('0x43'),JSON[_0xa3e3('0x44')]([_0x5d3944,_0x3d2cd7||_0xa3e3('0x45'),![],_0xa3e3('0x46')]),null,_0xa3e3('0x47')]]]))};console[_0xa3e3('0x48')](_0xa3e3('0x49'),_0x3c39c9);return rp(_0x3c39c9)[_0xa3e3('0x2b')](function(_0x2e64ec){console[_0xa3e3('0x48')](_0xa3e3('0x4a'),_0x2e64ec);try{console[_0xa3e3('0x48')](_0xa3e3('0x4b'),_0x2e64ec[_0xa3e3('0x4c')](0x5));console[_0xa3e3('0x48')](_0xa3e3('0x4d'),eval(_0x2e64ec[_0xa3e3('0x4c')](0x5))[0x0][0x2]);_0x3ea7cd=eval(_0x2e64ec[_0xa3e3('0x4c')](0x5))[0x0][0x2];console[_0xa3e3('0x48')]('AFTER\x20SLICE',_0x3ea7cd);}catch(_0x380dd5){console[_0xa3e3('0x48')](_0xa3e3('0x4e'),_0x380dd5);throw new Error(_0xa3e3('0x4f')+res[_0xa3e3('0x23')]);}if(!_0x3ea7cd){throw new Error(_0xa3e3('0x50')+lang+_0xa3e3('0x51'));}try{_0x3ea7cd=eval(_0x3ea7cd)[0x0];}catch(_0x45600a){throw new Error(_0xa3e3('0x4f')+res['data']);}console[_0xa3e3('0x48')](_0xa3e3('0x52'),_0x3ea7cd);const _0x1446b4=_0x3ea7cd;console[_0xa3e3('0x48')](_0xa3e3('0x53'),_0x1446b4);_0x374578=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));console['log'](_0xa3e3('0x54'),_0x374578);fs[_0xa3e3('0x2a')](_0x374578,_0x3ea7cd,{'encoding':_0xa3e3('0x30')});_0x4eb5e3=path[_0xa3e3('0x27')](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));console[_0xa3e3('0x48')]('desdt',_0x4eb5e3);return convertFile(_0x374578,_0x4eb5e3);})[_0xa3e3('0x2b')](function(){try{console[_0xa3e3('0x48')](_0xa3e3('0x55'),_0x4eb5e3);fs[_0xa3e3('0x2c')](_0x4eb5e3,_0xa3e3('0x2d'));}catch(_0x30b3b8){logger['error'](_0x30b3b8);}logger[_0xa3e3('0x1a')](_0xa3e3('0x56'),_0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0]);console[_0xa3e3('0x48')](_0xa3e3('0x57'),_0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0]);return _0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x410507,_0x5f22a5,_0x4f6341){return google[_0xa3e3('0x58')](_0x410507,_0x5f22a5,_0x4f6341)[_0xa3e3('0x2b')](function(_0x268ee2){logger[_0xa3e3('0x1a')](_0x268ee2[_0xa3e3('0x59')]);return rp(_0x268ee2);})['then'](function(_0x350da1){var _0x5db843='';var _0x4d0f8f=0x0;try{fs[_0xa3e3('0x1d')](_0x410507);}catch(_0x471452){logger['error'](_0x471452);}if(_0x350da1&&_0x350da1['results']){_0x5db843=_0x350da1['results'][_0xa3e3('0x5a')](function(_0x32984f){return _0x32984f&&_0x32984f[_0xa3e3('0x5b')][0x0]&&_0x32984f[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5c')]?_0x32984f[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5c')]:'';})[_0xa3e3('0x5d')]('\x0a');_0x4d0f8f=_0x350da1[_0xa3e3('0x5e')][_0xa3e3('0x5a')](function(_0x44ad54){return _0x44ad54&&_0x44ad54[_0xa3e3('0x5b')][0x0]&&_0x44ad54[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5f')]?_0x44ad54[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5f')]:0x0;})[_0xa3e3('0x5d')]('\x0a');}logger[_0xa3e3('0x1a')](_0xa3e3('0x60'),_0x5db843);logger[_0xa3e3('0x1a')](_0xa3e3('0x61'),_0x4d0f8f);return{'transcript':_0x5db843,'confidence':_0x4d0f8f};})[_0xa3e3('0x62')](function(_0x2cf007){logger[_0xa3e3('0x16')]('[%s]\x20%s:%s',_0x2cf007[_0xa3e3('0x15')],_0x2cf007[_0xa3e3('0x63')],_0x2cf007[_0xa3e3('0x64')]);});};exports[_0xa3e3('0x65')]=function(_0x444288,_0x46ff69,_0x39a5b7,_0x1701c7){var _0xb92a08=apiai(_0x46ff69,{'language':_0x1701c7||'en'});return _0xb92a08[_0xa3e3('0x66')](_0x39a5b7,{'sessionId':md5(_0x444288)})['then'](function(_0xce3a18){logger[_0xa3e3('0x1a')](JSON['stringify'](_0xce3a18));return{'source':_0xce3a18['result'][_0xa3e3('0x67')],'resolvedQuery':_0xce3a18[_0xa3e3('0x68')]['resolvedQuery'],'action':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x69')],'actionIncomplete':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6a')],'speech':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6b')]['speech'],'score':_0xce3a18[_0xa3e3('0x68')]['score'],'statusCode':_0xce3a18['status'][_0xa3e3('0x6c')],'endConversation':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6d')][_0xa3e3('0x6e')]||![],'isFallbackIntent':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6d')][_0xa3e3('0x6f')]};});};exports['googleDialogflowV2']=function(_0x44187c,_0x5cbd80,_0x1c8ba3,_0x79f2b1,_0x13973a,_0x398f2e){var _0xa0eb66=_0x79f2b1[_0xa3e3('0x70')](/\\n/g,'\x0a');var _0x40bc34={'credentials':{'private_key':_0xa0eb66,'client_email':_0x1c8ba3}};var _0x5f2aff=new dialogflow[(_0xa3e3('0x71'))](_0x40bc34);var _0x5d74b5=_0x5f2aff[_0xa3e3('0x72')](_0x5cbd80,md5(_0x44187c));var _0x547855={'session':_0x5d74b5,'queryInput':{'text':{'text':_0x13973a,'languageCode':_0x398f2e}}};return _0x5f2aff[_0xa3e3('0x73')](_0x547855)[_0xa3e3('0x2b')](function(_0x5a5818){if(_0x5a5818&&_0x5a5818['length']){logger[_0xa3e3('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0xa3e3('0x44')](_0x5a5818));var _0x1b91bb=_0x5a5818[0x0];if(_0x1b91bb){var _0x55e296={'action':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x69')],'allRequiredParamsPresent':_0x1b91bb[_0xa3e3('0x74')]['allRequiredParamsPresent'],'endConversation':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')]&&_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')][_0xa3e3('0x76')]?_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')][_0xa3e3('0x76')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x1b91bb['queryResult'][_0xa3e3('0x77')],'intentName':_0x1b91bb['queryResult'][_0xa3e3('0x78')][_0xa3e3('0x63')],'intentDisplayName':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x78')]['displayName'],'isFallbackIntent':_0x1b91bb[_0xa3e3('0x74')]['intent'][_0xa3e3('0x79')],'languageCode':_0x1b91bb['queryResult']['languageCode'],'queryText':_0x1b91bb['queryResult'][_0xa3e3('0x7a')],'responseId':_0x1b91bb['responseId'],'score':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x7b')],'speech':_0x1b91bb[_0xa3e3('0x74')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x5a5818)};return _0x55e296;}}});};exports[_0xa3e3('0x7c')]=function(_0x542476,_0x1d97e2,_0x50d3d9,_0x3a127c){return tilde[_0xa3e3('0x58')](_0x542476,_0x1d97e2,_0x50d3d9,_0x3a127c)[_0xa3e3('0x2b')](function(_0x3648ac){try{fs['unlink'](_0x542476);}catch(_0x54a4d9){logger[_0xa3e3('0x16')](_0x54a4d9);}logger[_0xa3e3('0x1a')](_0xa3e3('0x7d'),_0x3648ac[_0xa3e3('0x5c')]);logger['info'](_0xa3e3('0x7e'),_0x3648ac['confidence']);return _0x3648ac;});};exports[_0xa3e3('0x7f')]=function(_0x3dc222,_0x219709,_0x2c4e8a,_0x1405c6,_0x1d3b3b,_0x20e250){var _0x5ad219=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));var _0x24e5db;return aws[_0xa3e3('0x80')](_0x3dc222,_0x219709,_0x2c4e8a,_0x1405c6,_0x1d3b3b,_0x20e250,_0x5ad219)[_0xa3e3('0x2b')](function(){_0x24e5db=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+'.wav');return convertFile(_0x5ad219,_0x24e5db);})[_0xa3e3('0x2b')](function(){try{fs[_0xa3e3('0x1d')](_0x5ad219);fs[_0xa3e3('0x2c')](_0x24e5db,_0xa3e3('0x2d'));}catch(_0x122a5f){logger[_0xa3e3('0x16')](_0x122a5f);}return _0x24e5db[_0xa3e3('0x2e')]('.')[0x0];});};exports[_0xa3e3('0x81')]=function(_0x25af6d,_0x332ea1,_0x50a47c,_0x29bef5,_0xb58890,_0x18da96){return aws[_0xa3e3('0x82')](_0x25af6d,_0x332ea1,_0x50a47c,_0x29bef5,_0xb58890,_0x18da96)['then'](function(_0x79ba9d){logger['info'](JSON[_0xa3e3('0x44')](_0x79ba9d));return _0x79ba9d;});};exports[_0xa3e3('0x83')]=function(_0x16bac2,_0x218cfa,_0x107921,_0x378592){var _0x1bd5a9=util[_0xa3e3('0x84')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x16bac2,encodeURIComponent(_0x218cfa),_0x107921,_0x378592);var _0x26d7b8=path['resolve'](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+'.mp3');var _0x16281b;return downloadFile(_0x1bd5a9,_0x26d7b8)['then'](function(){_0x16281b=path[_0xa3e3('0x27')](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));return convertFile(_0x26d7b8,_0x16281b);})[_0xa3e3('0x2b')](function(){try{fs[_0xa3e3('0x1d')](_0x26d7b8);fs['chmodSync'](_0x16281b,'777');}catch(_0x52b791){logger['error'](_0x52b791);}return _0x16281b['split']('.')[0x0];});};exports['ispeechASR']=function(_0x381609,_0x2dce98,_0x31a0c3,_0x102dbc){var _0x3014f2=util[_0xa3e3('0x84')](_0xa3e3('0x85'),ISPEECH_API,_0x2dce98,_0x31a0c3,base64Encode(_0x381609),_0x102dbc?util[_0xa3e3('0x84')]('model=%s',encodeURIComponent(_0x102dbc)):'freeform=3');return uploadFile(_0x3014f2)[_0xa3e3('0x2b')](function(_0x486664){return querystring['parse'](_0x486664);});};exports[_0xa3e3('0x86')]=function(_0x351aa3,_0x3c62f4){return sestek[_0xa3e3('0x87')](_0x351aa3,_0x3c62f4)['then'](function(_0xb04b3d){logger[_0xa3e3('0x1a')](JSON['stringify'](_0xb04b3d));var _0x505cc0={'speech':_0xb04b3d[_0xa3e3('0x88')],'action':_0xb04b3d[_0xa3e3('0x89')]?_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8a')]:undefined,'actiondata':_0xb04b3d[_0xa3e3('0x89')]?_0xb04b3d['channelData'][_0xa3e3('0x8b')]:undefined};if(_0xb04b3d[_0xa3e3('0x89')]&&_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8c')]){return base64Decode(_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8c')][_0xa3e3('0x8d')],path['resolve'](__dirname,_0xa3e3('0x3c'),rs['generate'](0x4)+_0xa3e3('0x29')))[_0xa3e3('0x2b')](function(_0x2b8db3){_0x505cc0[_0xa3e3('0x8e')]=_0x2b8db3;return _0x505cc0;});}return _0x505cc0;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index b6de878..9267d3b 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 _0x1df0=['./nda','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x1df0,0x1c0));var _0x01df=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1df0[_0x3ab9ee];return _0x82ee88;};var nda=require(_0x01df('0x0'));module[_0x01df('0x1')]={'nda':nda}; \ No newline at end of file +var _0xbcf1=['exports'];(function(_0x4e01d3,_0x256d92){var _0x266b28=function(_0x100fbd){while(--_0x100fbd){_0x4e01d3['push'](_0x4e01d3['shift']());}};_0x266b28(++_0x256d92);}(_0xbcf1,0x110));var _0x1bcf=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xbcf1[_0x1ab180];return _0xfb2c2d;};var nda=require('./nda');module[_0x1bcf('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index c3124d4..67123da 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 _0x3495=['custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','CustomAction'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x3495,0xa4));var _0x5349=function(_0x1edaf6,_0x259828){_0x1edaf6=_0x1edaf6-0x0;var _0x545921=_0x3495[_0x1edaf6];return _0x545921;};'use strict';var rp=require(_0x5349('0x0'));var url=require('url');var logger=require(_0x5349('0x1'))(_0x5349('0x2'));module[_0x5349('0x3')]=function(_0x4858b0,_0x2ad46f){var _0x130145={'method':_0x5349('0x4'),'uri':url[_0x5349('0x5')](_0x2ad46f[_0x5349('0x6')],_0x5349('0x7')),'form':{'grant_type':_0x5349('0x8'),'username':_0x2ad46f['username'],'password':_0x2ad46f[_0x5349('0x8')]},'json':!![]};return rp(_0x130145)[_0x5349('0x9')](function(_0x4837c5){var _0x56471c={'method':_0x5349('0x4'),'uri':url[_0x5349('0x5')](_0x2ad46f[_0x5349('0xa')],_0x5349('0xb')),'body':{'type':_0x2ad46f[_0x5349('0xc')]||_0x5349('0xd'),'channelId':_0x5349('0xe'),'conversation':{'id':_0x4858b0[_0x5349('0xf')]},'from':{'id':_0x4858b0[_0x5349('0x10')],'name':_0x4858b0[_0x5349('0x11')]},'recipient':{'id':_0x4858b0[_0x5349('0x12')],'name':_0x4858b0[_0x5349('0x13')]},'text':_0x2ad46f['text'],'channelData':{}},'headers':{'Authorization':_0x5349('0x14')+_0x4837c5['access_token']},'json':!![]};if(_0x2ad46f[_0x5349('0x15')]){_0x56471c[_0x5349('0x16')][_0x5349('0x17')][_0x5349('0x18')]=_0x2ad46f[_0x5349('0x15')];}if(_0x2ad46f[_0x5349('0x19')]=='1'){_0x56471c['body'][_0x5349('0x17')][_0x5349('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2ad46f['custom_action']){_0x56471c['body']['channelData'][_0x5349('0x1b')]=_0x2ad46f['custom_action'];if(_0x2ad46f[_0x5349('0x1c')]){_0x56471c[_0x5349('0x16')][_0x5349('0x17')][_0x5349('0x1d')]=_0x2ad46f[_0x5349('0x1c')];}}logger[_0x5349('0x1e')](JSON[_0x5349('0x1f')](_0x56471c));return rp(_0x56471c);});}; \ No newline at end of file +var _0x5b6a=['ndassistant_url','ndaactivity_type','message','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','audio/wav','custom_action','custom_action_data','CustomActionData','info','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x5b6a,0x66));var _0xa5b6=function(_0x1c2bcc,_0x364549){_0x1c2bcc=_0x1c2bcc-0x0;var _0x5b97dc=_0x5b6a[_0x1c2bcc];return _0x5b97dc;};'use strict';var rp=require('request-promise');var url=require(_0xa5b6('0x0'));var logger=require(_0xa5b6('0x1'))(_0xa5b6('0x2'));module[_0xa5b6('0x3')]=function(_0x230bfd,_0x49f0c5){var _0x493df4={'method':_0xa5b6('0x4'),'uri':url[_0xa5b6('0x5')](_0x49f0c5[_0xa5b6('0x6')],'/token'),'form':{'grant_type':_0xa5b6('0x7'),'username':_0x49f0c5[_0xa5b6('0x8')],'password':_0x49f0c5[_0xa5b6('0x7')]},'json':!![]};return rp(_0x493df4)[_0xa5b6('0x9')](function(_0x4f9df2){var _0x4d4ca0={'method':_0xa5b6('0x4'),'uri':url[_0xa5b6('0x5')](_0x49f0c5[_0xa5b6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x49f0c5[_0xa5b6('0xb')]||_0xa5b6('0xc'),'channelId':'Nda','conversation':{'id':_0x230bfd['uniqueid']},'from':{'id':_0x230bfd[_0xa5b6('0xd')],'name':_0x230bfd['calleridname']},'recipient':{'id':_0x230bfd[_0xa5b6('0xe')],'name':_0x230bfd[_0xa5b6('0xf')]},'text':_0x49f0c5[_0xa5b6('0x10')],'channelData':{}},'headers':{'Authorization':_0xa5b6('0x11')+_0x4f9df2[_0xa5b6('0x12')]},'json':!![]};if(_0x49f0c5['project']){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')][_0xa5b6('0x15')]=_0x49f0c5[_0xa5b6('0x16')];}if(_0x49f0c5['ndagenerate_audio']=='1'){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa5b6('0x17')};}if(_0x49f0c5['custom_action']){_0x4d4ca0[_0xa5b6('0x13')]['channelData']['CustomAction']=_0x49f0c5[_0xa5b6('0x18')];if(_0x49f0c5[_0xa5b6('0x19')]){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')][_0xa5b6('0x1a')]=_0x49f0c5['custom_action_data'];}}logger[_0xa5b6('0x1b')](JSON['stringify'](_0x4d4ca0));return rp(_0x4d4ca0);});}; \ 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 63df261..8a4398d 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 _0xa3b3=['exports','./lib/api'];(function(_0x40c761,_0x168092){var _0x3adb32=function(_0x46e3ae){while(--_0x46e3ae){_0x40c761['push'](_0x40c761['shift']());}};_0x3adb32(++_0x168092);}(_0xa3b3,0x81));var _0x3a3b=function(_0x5051a4,_0x5d561c){_0x5051a4=_0x5051a4-0x0;var _0xd07a19=_0xa3b3[_0x5051a4];return _0xd07a19;};'use strict';var asr=require(_0x3a3b('0x0'));module[_0x3a3b('0x1')]=function(_0x4f57a5,_0xa34a6e,_0x45218f,_0x2a496f){return asr(_0x4f57a5,_0xa34a6e,_0x45218f,_0x2a496f);}; \ No newline at end of file +var _0x522a=['./lib/api','exports'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x522a,0x146));var _0xa522=function(_0x188c3d,_0x35d1b7){_0x188c3d=_0x188c3d-0x0;var _0x8bfd13=_0x522a[_0x188c3d];return _0x8bfd13;};'use strict';var asr=require(_0xa522('0x0'));module[_0xa522('0x1')]=function(_0x5261ff,_0xba51be,_0x4f83e8,_0x324d51){return asr(_0x5261ff,_0xba51be,_0x4f83e8,_0x324d51);}; \ 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 3fd0e47..696ef6e 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 _0x23b6=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','parse','result','hypotheses','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0xbccd1e,_0x28f231){var _0x44ddec=function(_0x7a18c5){while(--_0x7a18c5){_0xbccd1e['push'](_0xbccd1e['shift']());}};_0x44ddec(++_0x28f231);}(_0x23b6,0x8f));var _0x623b=function(_0x59dd83,_0x573f1b){_0x59dd83=_0x59dd83-0x0;var _0x5dd0de=_0x23b6[_0x59dd83];return _0x5dd0de;};'use strict';var BPromise=require('bluebird');var _=require(_0x623b('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x623b('0x1'));var crypto=require(_0x623b('0x2'));var logger=require(_0x623b('0x3'))(_0x623b('0x4'));module[_0x623b('0x5')]=function(_0x5409b7,_0x44f9aa,_0x395dfc,_0x490ed9){return new BPromise(function(_0xe42d63,_0xdf5e1d){logger[_0x623b('0x6')](_0x623b('0x7'),_0x490ed9||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2063b3=new WebSocket(_0x490ed9||_0x623b('0x8'),{'perMessageDeflate':![]});var _0x41b552='';var _0x15bdd0='0';var _0x42b064='1';var _0x4500d2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2760ed(_0x112053){var _0x2ca7c6=crypto[_0x623b('0x9')]('sha1');_0x2ca7c6[_0x623b('0xa')](_0x112053);return _0x2ca7c6['digest']('hex');}function _0x2e3337(){try{logger[_0x623b('0x6')](_0x623b('0xb'));var _0x164eae=moment()['unix']();var _0x49316f=_0x2760ed(_0x164eae+_0x44f9aa+_0x395dfc);_0x2063b3[_0x623b('0xc')](JSON[_0x623b('0xd')]({'appID':_0x44f9aa,'timestamp':_0x164eae,'appKey':_0x49316f}));var _0x53d158=fs[_0x623b('0xe')](_0x5409b7);_0x53d158['on'](_0x623b('0xf'),function(_0x45a890){_0x2063b3[_0x623b('0xc')](_0x45a890);});_0x53d158['on'](_0x623b('0x10'),function(){_0x2063b3['send']('EOS');});}catch(_0x1db0c1){logger['error'](_0x623b('0x11'),JSON[_0x623b('0xd')](_0x1db0c1));_0x2063b3['terminate']();}}function _0x4c8ffe(_0x1d86ad){try{if(_0x1d86ad){var _0x36e82a=JSON[_0x623b('0x12')](_0x1d86ad);switch(_0x36e82a['status']){case 0x0:if(_0x36e82a['result']){if(_0x36e82a[_0x623b('0x13')]['final']){logger[_0x623b('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x623b('0xd')](_0x36e82a[_0x623b('0x13')][_0x623b('0x14')]));_0x41b552=_0x36e82a[_0x623b('0x13')][_0x623b('0x14')][0x0]['transcript'];_0x15bdd0=_0x36e82a[_0x623b('0x13')]['hypotheses'][0x0][_0x623b('0x15')];_0x42b064='0';_0x4500d2=_0x623b('0x16');_0x2063b3[_0x623b('0x17')]();}}break;case 0x1:logger[_0x623b('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x42b064='1';_0x4500d2=_0x623b('0x18');break;case 0x2:logger[_0x623b('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x42b064='2';_0x4500d2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x42b064='9';_0x4500d2=_0x623b('0x19');break;case 0xa:logger['info']('Authentication\x20failed.');_0x42b064='10';_0x4500d2=_0x623b('0x1a');break;case 0xb:logger[_0x623b('0x6')](_0x623b('0x1b'));_0x42b064='11';_0x4500d2=_0x623b('0x1b');}}}catch(_0x2e1189){logger[_0x623b('0x1c')](_0x623b('0x1d'),JSON[_0x623b('0xd')](_0x2e1189));_0x2063b3[_0x623b('0x17')]();}}function _0x17b914(){logger[_0x623b('0x6')](_0x623b('0x1e'));_0xe42d63({'transcript':_0x41b552,'confidence':_0x15bdd0,'status':_0x42b064,'status_message':_0x4500d2});}function _0x41f223(_0x2bed14){logger[_0x623b('0x1c')](_0x623b('0x1f'));if(!_['isNil'](_0x2bed14)){logger[_0x623b('0x1c')](_[_0x623b('0x20')](_0x2bed14)?JSON['stringify'](_0x2bed14):_0x2bed14);}}_0x2063b3['on']('open',_0x2e3337);_0x2063b3['on'](_0x623b('0x21'),_0x4c8ffe);_0x2063b3['on'](_0x623b('0x10'),_0x17b914);_0x2063b3['on'](_0x623b('0x1c'),_0x41f223);});}; \ No newline at end of file +var _0x8dfd=['open','message','bluebird','lodash','moment','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','close','send','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject'];(function(_0x482cc1,_0x96a8bd){var _0x29721c=function(_0x541067){while(--_0x541067){_0x482cc1['push'](_0x482cc1['shift']());}};_0x29721c(++_0x96a8bd);}(_0x8dfd,0x1be));var _0xd8df=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x8dfd[_0x79cd47];return _0x3b9484;};'use strict';var BPromise=require(_0xd8df('0x0'));var _=require(_0xd8df('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd8df('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x5dc356,_0x255bb2,_0xcfbf76,_0x51f10e){return new BPromise(function(_0x3decc6,_0x25d66b){logger[_0xd8df('0x3')](_0xd8df('0x4'),_0x51f10e||_0xd8df('0x5'));var _0x1bc80f=new WebSocket(_0x51f10e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x38e024='';var _0x46c5c3='0';var _0x8eff2a='1';var _0x4138db=_0xd8df('0x6');function _0x4fa3f3(_0x335446){var _0x16f0a1=crypto['createHash'](_0xd8df('0x7'));_0x16f0a1[_0xd8df('0x8')](_0x335446);return _0x16f0a1['digest'](_0xd8df('0x9'));}function _0x1b616c(){try{logger[_0xd8df('0x3')](_0xd8df('0xa'));var _0x494435=moment()[_0xd8df('0xb')]();var _0x29c216=_0x4fa3f3(_0x494435+_0x255bb2+_0xcfbf76);_0x1bc80f['send'](JSON[_0xd8df('0xc')]({'appID':_0x255bb2,'timestamp':_0x494435,'appKey':_0x29c216}));var _0x4b85f5=fs['createReadStream'](_0x5dc356);_0x4b85f5['on'](_0xd8df('0xd'),function(_0xe46086){_0x1bc80f['send'](_0xe46086);});_0x4b85f5['on'](_0xd8df('0xe'),function(){_0x1bc80f[_0xd8df('0xf')](_0xd8df('0x10'));});}catch(_0x4fae8a){logger[_0xd8df('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xd8df('0xc')](_0x4fae8a));_0x1bc80f[_0xd8df('0x12')]();}}function _0x34a297(_0x2331c4){try{if(_0x2331c4){var _0x20e6de=JSON[_0xd8df('0x13')](_0x2331c4);switch(_0x20e6de[_0xd8df('0x14')]){case 0x0:if(_0x20e6de[_0xd8df('0x15')]){if(_0x20e6de[_0xd8df('0x15')][_0xd8df('0x16')]){logger[_0xd8df('0x3')](_0xd8df('0x17'),JSON[_0xd8df('0xc')](_0x20e6de['result'][_0xd8df('0x18')]));_0x38e024=_0x20e6de[_0xd8df('0x15')]['hypotheses'][0x0][_0xd8df('0x19')];_0x46c5c3=_0x20e6de[_0xd8df('0x15')][_0xd8df('0x18')][0x0]['likelihood'];_0x8eff2a='0';_0x4138db=_0xd8df('0x1a');_0x1bc80f[_0xd8df('0x12')]();}}break;case 0x1:logger['info'](_0xd8df('0x6'));_0x8eff2a='1';_0x4138db=_0xd8df('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x8eff2a='2';_0x4138db=_0xd8df('0x1b');break;case 0x9:logger[_0xd8df('0x3')](_0xd8df('0x1c'));_0x8eff2a='9';_0x4138db=_0xd8df('0x1c');break;case 0xa:logger[_0xd8df('0x3')](_0xd8df('0x1d'));_0x8eff2a='10';_0x4138db=_0xd8df('0x1d');break;case 0xb:logger['info'](_0xd8df('0x1e'));_0x8eff2a='11';_0x4138db=_0xd8df('0x1e');}}}catch(_0x17189c){logger[_0xd8df('0x11')](_0xd8df('0x1f'),JSON['stringify'](_0x17189c));_0x1bc80f[_0xd8df('0x12')]();}}function _0x44cef(){logger[_0xd8df('0x3')](_0xd8df('0x20'));_0x3decc6({'transcript':_0x38e024,'confidence':_0x46c5c3,'status':_0x8eff2a,'status_message':_0x4138db});}function _0x37a8d0(_0x2fe557){logger['error'](_0xd8df('0x21'));if(!_['isNil'](_0x2fe557)){logger[_0xd8df('0x11')](_[_0xd8df('0x22')](_0x2fe557)?JSON[_0xd8df('0xc')](_0x2fe557):_0x2fe557);}}_0x1bc80f['on'](_0xd8df('0x23'),_0x1b616c);_0x1bc80f['on'](_0xd8df('0x24'),_0x34a297);_0x1bc80f['on'](_0xd8df('0xe'),_0x44cef);_0x1bc80f['on'](_0xd8df('0x11'),_0x37a8d0);});}; \ 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 519083c..f48937a 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 _0x0ebd=['exports','./asr'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0x0ebd,0xa9));var _0xd0eb=function(_0x2edda3,_0x144ee7){_0x2edda3=_0x2edda3-0x0;var _0x393e1a=_0x0ebd[_0x2edda3];return _0x393e1a;};var asr=require(_0xd0eb('0x0'));module[_0xd0eb('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5453=['exports','./asr'];(function(_0x4ed83a,_0x2a102c){var _0x5e5cb2=function(_0x31c890){while(--_0x31c890){_0x4ed83a['push'](_0x4ed83a['shift']());}};_0x5e5cb2(++_0x2a102c);}(_0x5453,0x18b));var _0x3545=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5453[_0x59ee6f];return _0x4c0979;};var asr=require(_0x3545('0x0'));module[_0x3545('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b2a3ea7..b8b1aaf 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 _0x6ddd=['connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','events','EventEmitter','./error','./channel','call','emit','error','createServer','listen','listening'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6ddd,0xae));var _0xd6dd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6ddd[_0x126558];return _0x1f6d14;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xd6dd('0x0'))[_0xd6dd('0x1')];var AGIError=require(_0xd6dd('0x2'));var AGIChannel=require(_0xd6dd('0x3'));var AGIServer=function(_0x5283c5,_0x3651aa,_0x5aebd8){var _0x1ab3df=this,_0x5283c5=_0x5283c5||0x11dd,_0x3651aa=_0x3651aa||'127.0.0.1',_0x27439a=null,_0x47005f=0x0;EventEmitter[_0xd6dd('0x4')](_0x1ab3df);function _0x1f0c46(){if(!_0x5283c5){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x27439a=net[_0xd6dd('0x7')]();_0x27439a[_0xd6dd('0x8')](_0x5283c5,_0x3651aa);_0x27439a['on'](_0xd6dd('0x9'),function(){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x9'));});_0x27439a['on'](_0xd6dd('0xa'),function(_0x1c5afd){_0x27439a[_0xd6dd('0xb')](function(_0x1c52dc,_0x1aaa1b){if(_0x1c52dc){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1c52dc));}else if(_0x5aebd8&&_0x5aebd8<0x0){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0xc')));_0x1c5afd[_0xd6dd('0xd')]();}else if(_0x5aebd8&&_0x5aebd8>0x0&&_0x5aebd8<_0x1aaa1b){_0x47005f+=0x1;_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0xe'),_0x47005f));_0x1c5afd['destroy']();}else{var _0x305928=new AGIChannel(_0x1c5afd);_0x305928['on'](_0xd6dd('0xf'),function(){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0xa'),_0x305928);});}});});_0x27439a['on'](_0xd6dd('0x6'),function(_0x2c935e){_0x1ab3df[_0xd6dd('0x5')](_0xd6dd('0x6'),new AGIError(_0xd6dd('0x10'),_0x2c935e[_0xd6dd('0x11')]));});_0x27439a['on'](_0xd6dd('0x12'),function(){_0x1ab3df[_0xd6dd('0x5')]('close',new AGIError(_0xd6dd('0x13')));});}process[_0xd6dd('0x14')](function(){_0x1f0c46();});};util[_0xd6dd('0x15')](AGIServer,EventEmitter);module[_0xd6dd('0x16')]=function(_0x56c051,_0x4cd37d,_0x84a5d4){return new AGIServer(_0x56c051,_0x4cd37d,_0x84a5d4);}; \ No newline at end of file +var _0x6c76=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','nextTick','inherits','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listen','listening'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6c76,0x184));var _0x66c7=function(_0x48cb44,_0x406b00){_0x48cb44=_0x48cb44-0x0;var _0x3cb35b=_0x6c76[_0x48cb44];return _0x3cb35b;};'use strict';var util=require(_0x66c7('0x0'));var net=require(_0x66c7('0x1'));var EventEmitter=require(_0x66c7('0x2'))['EventEmitter'];var AGIError=require(_0x66c7('0x3'));var AGIChannel=require(_0x66c7('0x4'));var AGIServer=function(_0x519756,_0x572a2b,_0x2f6db7){var _0x2b7cf3=this,_0x519756=_0x519756||0x11dd,_0x572a2b=_0x572a2b||_0x66c7('0x5'),_0x45b0a5=null,_0x52f71b=0x0;EventEmitter['call'](_0x2b7cf3);function _0x4fa6ce(){if(!_0x519756){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0x8')));return![];}_0x45b0a5=net['createServer']();_0x45b0a5[_0x66c7('0x9')](_0x519756,_0x572a2b);_0x45b0a5['on'](_0x66c7('0xa'),function(){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0xa'));});_0x45b0a5['on']('connection',function(_0x464085){_0x45b0a5[_0x66c7('0xb')](function(_0x26c9b2,_0x187e00){if(_0x26c9b2){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x26c9b2));}else if(_0x2f6db7&&_0x2f6db7<0x0){_0x2b7cf3['emit'](_0x66c7('0x7'),new AGIError(_0x66c7('0xd')));_0x464085[_0x66c7('0xe')]();}else if(_0x2f6db7&&_0x2f6db7>0x0&&_0x2f6db7<_0x187e00){_0x52f71b+=0x1;_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xf'),_0x52f71b));_0x464085[_0x66c7('0xe')]();}else{var _0xf3b04=new AGIChannel(_0x464085);_0xf3b04['on'](_0x66c7('0x10'),function(){_0x2b7cf3['emit'](_0x66c7('0x11'),_0xf3b04);});}});});_0x45b0a5['on']('error',function(_0x208010){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x208010[_0x66c7('0x12')]));});_0x45b0a5['on']('close',function(){_0x2b7cf3['emit']('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x66c7('0x13')](function(){_0x4fa6ce();});};util[_0x66c7('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x524e87,_0x256b0a,_0x9b65cf){return new AGIServer(_0x524e87,_0x256b0a,_0x9b65cf);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b3d0b13..a47d437 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 _0x50ad=['Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','intKey','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','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','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','path','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','catch','getVoiceQueue','name','getSquareProject','then','prototype','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','callback_','isEmpty','isNil','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','rawBody','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','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','toUpperCase','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','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','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally'];(function(_0x291b8c,_0x6b7ed8){var _0x22ba34=function(_0x250020){while(--_0x250020){_0x291b8c['push'](_0x291b8c['shift']());}};_0x22ba34(++_0x6b7ed8);}(_0x50ad,0xc0));var _0xd50a=function(_0x102402,_0x4eaaf8){_0x102402=_0x102402-0x0;var _0x321b44=_0x50ad[_0x102402];return _0x321b44;};'use strict';var fs=require('fs');var path=require(_0xd50a('0x0'));var util=require(_0xd50a('0x1'));var _=require(_0xd50a('0x2'));var sh=require(_0xd50a('0x3'));var odbc=require(_0xd50a('0x4'))();var rs=require('randomstring');var moment=require(_0xd50a('0x5'));var Mustache=require(_0xd50a('0x6'));var rp=require('request-promise');var logger=require(_0xd50a('0x7'))('agi');var config=require(_0xd50a('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xd50a('0x9');var recursiveMapAttributes=[_0xd50a('0xa'),'rawBody'];var verticesWithRetry=[_0xd50a('0xb'),_0xd50a('0xc'),_0xd50a('0xd')];var AGIVertices=function(_0x1992c2,_0x40e310,_0x51f76f){this[_0xd50a('0xe')]=_0x1992c2;this[_0xd50a('0xf')]=_0x40e310;this[_0xd50a('0x10')]=_0x51f76f;};AGIVertices['prototype'][_0xd50a('0x11')]=function(_0x4f7df3,_0x5dcce9){this['rpc'][_0xd50a('0x12')](_0x4f7df3)['then'](function(_0x1b2f77){_0x5dcce9(null,_0x1b2f77?_0x1b2f77['name']:![]);})[_0xd50a('0x13')](function(_0x42ec68){_0x5dcce9(_0x42ec68);});};AGIVertices['prototype'][_0xd50a('0x14')]=function(_0x1fc4f0,_0x278147){this[_0xd50a('0xf')]['getVoiceQueueById'](_0x1fc4f0)['then'](function(_0x183062){_0x278147(null,_0x183062?_0x183062[_0xd50a('0x15')]:![]);})['catch'](function(_0x40286a){_0x278147(_0x40286a);});};AGIVertices['prototype'][_0xd50a('0x16')]=function(_0x15d12e,_0x5d3a89){this[_0xd50a('0xf')]['getSquareProjectById'](_0x15d12e)[_0xd50a('0x17')](function(_0x3d17e6){_0x5d3a89(null,_0x3d17e6?_0x3d17e6[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0xe548da){_0x5d3a89(_0xe548da);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x19')]=function(_0x3165fc,_0x2b0f44){this[_0xd50a('0xf')][_0xd50a('0x1a')](_0x3165fc)[_0xd50a('0x17')](function(_0x13d5ab){_0x2b0f44(null,_0x13d5ab?_0x13d5ab['dsn']:![]);})[_0xd50a('0x13')](function(_0x23e963){_0x2b0f44(_0x23e963);});};AGIVertices['prototype'][_0xd50a('0x1b')]=function(_0x1490cf,_0x395a6c){this[_0xd50a('0xf')][_0xd50a('0x1c')](_0x1490cf)[_0xd50a('0x17')](function(_0x56cb7a){_0x395a6c(null,_0x56cb7a?_0x56cb7a[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0x1a9f55){_0x395a6c(_0x1a9f55);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1d')]=function(_0x4a3124,_0x4b6108){this['rpc'][_0xd50a('0x1e')](_0x4a3124)['then'](function(_0x3149e0){_0x4b6108(null,_0x3149e0?_0x3149e0[_0xd50a('0x15')]:![]);})[_0xd50a('0x13')](function(_0x2d3004){_0x4b6108(_0x2d3004);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1f')]=function(_0x33554e,_0xbfec65){var _0xa3b9b3=this;this[_0xd50a('0xf')][_0xd50a('0x20')](_0x33554e)[_0xd50a('0x17')](function(_0x5b87ac){_0xbfec65(null,_0x5b87ac?_0xa3b9b3[_0xd50a('0x21')](_0x5b87ac[_0xd50a('0x22')]):![]);})[_0xd50a('0x13')](function(_0x5d6c52){_0xbfec65(_0x5d6c52);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x23')]=function(_0x532026,_0x53d30c){this[_0xd50a('0xf')][_0xd50a('0x24')](_0x532026)[_0xd50a('0x17')](function(_0x31b591){_0x53d30c(null,_0x31b591?_0x31b591:![]);})[_0xd50a('0x13')](function(_0xe5da51){_0x53d30c(_0xe5da51);});};AGIVertices[_0xd50a('0x18')]['sendMailMessage']=function(_0x495567,_0x24f014,_0x5a00f0){this['mailRpc'][_0xd50a('0x25')](_0x495567,_0x24f014)['then'](function(){_0x5a00f0(null);})[_0xd50a('0x13')](function(_0x38c826){_0x5a00f0(_0x38c826);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x26')]=function(_0x327d74,_0x1a69b9){this[_0xd50a('0xf')][_0xd50a('0x27')](_0x327d74)['then'](function(_0x4c9e3b){if(_0x4c9e3b){if(_0x4c9e3b['IntervalId']){_0x1a69b9(null,[_0x4c9e3b[_0xd50a('0x28')]]);}else{_0x1a69b9(null,_['map'](_0x4c9e3b['Intervals'],_0xd50a('0x28')));}}else{_0x1a69b9(null,![]);}})[_0xd50a('0x13')](function(_0x135e11){_0x1a69b9(_0x135e11);});};AGIVertices[_0xd50a('0x18')]['getSoundPath']=function(_0x2ad57f){return util[_0xd50a('0x29')](_0xd50a('0x2a'),FILES_PATH,_0x2ad57f);};AGIVertices['prototype']['getQueryOdbc']=function(_0x1d4f89,_0x43fed8,_0x1bfdb7){odbc[_0xd50a('0x2b')](_0x1d4f89,function(_0x2c36d2){if(_0x2c36d2){logger[_0xd50a('0x2c')](_0xd50a('0x2d'),_0x2c36d2);_0x1bfdb7(_0x2c36d2);}else{logger[_0xd50a('0x2e')](_0xd50a('0x2f'));odbc[_0xd50a('0x30')](_0x43fed8,function(_0x433180,_0xf5b687){if(_0x433180){logger['info']('Error\x20executing\x20query\x20%s',_0x43fed8);_0x1bfdb7(_0x433180);}else{logger[_0xd50a('0x2e')](_0xd50a('0x31'),_0x43fed8);odbc[_0xd50a('0x32')](function(_0x3f0765){if(_0x3f0765){logger[_0xd50a('0x2c')](_0xd50a('0x33'),_0x3f0765);}_0x1bfdb7(null,_0xf5b687);});}});}});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x34')]=function(_0xd6f624,_0x18cdb1){this[_0xd50a('0xf')][_0xd50a('0x35')](_0xd6f624)[_0xd50a('0x17')](function(_0x44ec93){_0x18cdb1(null,_0x44ec93?_0x44ec93:![]);})[_0xd50a('0x13')](function(_0x4a2489){_0x18cdb1(_0x4a2489);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x36')]=function(_0x51b866,_0x5d3bba){this['rpc']['createSmsMessage'](_0x51b866)['then'](function(_0x29bfc6){_0x5d3bba(null,_0x29bfc6);})[_0xd50a('0x13')](function(_0x929964){_0x5d3bba(_0x929964);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x37')]=function(_0x149b94,_0x7affde,_0x3b692a){this['rpc'][_0xd50a('0x37')]({'uniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'node':_0x149b94[_0xd50a('0x39')],'application':_0x149b94[_0xd50a('0x3a')],'data':_0x7affde||null,'project_name':this[_0xd50a('0xe')][_0xd50a('0x3b')],'callerid':this[_0xd50a('0xe')]['callerid']})[_0xd50a('0x17')](function(_0x3a0e1c){if(_0x3b692a){_0x3b692a(null,_0x3a0e1c);}})[_0xd50a('0x13')](function(_0x5d2312){if(_0x3b692a){_0x3b692a(_0x5d2312);}});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x3c')]=function(_0x3f00ff,_0x5cafdd,_0x481ad6,_0x12834d){this[_0xd50a('0xf')][_0xd50a('0x3c')]({'uniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'callerid':this[_0xd50a('0xe')][_0xd50a('0x3d')],'calleridname':this[_0xd50a('0xe')][_0xd50a('0x3e')],'context':this['channel'][_0xd50a('0x3f')],'extension':this['channel'][_0xd50a('0x40')],'priority':this[_0xd50a('0xe')][_0xd50a('0x41')],'accountcode':this[_0xd50a('0xe')]['accountcode'],'dnid':this[_0xd50a('0xe')][_0xd50a('0x42')],'projectName':this['channel'][_0xd50a('0x3b')],'saveName':_0x5cafdd,'filename':_0x3f00ff['file']||_0x5cafdd,'savePath':_0x481ad6})['then'](function(_0x318678){_0x12834d(null,_0x318678);})[_0xd50a('0x13')](function(_0x33915f){_0x12834d(_0x33915f);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x43')]=function(_0x3fbb62,_0x266e21,_0x537c66,_0x39021a,_0x3a8e1f){this[_0xd50a('0xf')][_0xd50a('0x43')]({'uniqueid':this[_0xd50a('0xe')]['uniqueid'],'body':_0x3fbb62,'direction':_0x266e21,'providerName':_0x537c66,'providerResponse':_0x39021a})[_0xd50a('0x17')](function(_0x4151bd){if(_0x3a8e1f){_0x3a8e1f(null,_0x4151bd);}})[_0xd50a('0x13')](function(_0x436630){if(_0x3a8e1f){_0x3a8e1f(_0x436630);}});};AGIVertices['prototype'][_0xd50a('0x44')]=function(_0x17dafe,_0xac6c3c){this[_0xd50a('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x17dafe[_0xd50a('0x15')])||_['isNil'](_0x17dafe[_0xd50a('0x15')])?_0xd50a('0x45')+Math['random']():_0x17dafe['name'],'lastName':_[_0xd50a('0x46')](_0x17dafe['lastName'])||_[_0xd50a('0x47')](_0x17dafe[_0xd50a('0x48')])?null:_0x17dafe[_0xd50a('0x48')],'phone':_0x17dafe[_0xd50a('0x49')],'ListId':_0x17dafe[_0xd50a('0x4a')],'scheduledat':_0x17dafe[_0xd50a('0x4b')],'callbackUniqueid':this[_0xd50a('0xe')][_0xd50a('0x38')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x17dafe['scheduledAt'][_0xd50a('0x4c')](),'priority':_0x17dafe[_0xd50a('0x4d')]})[_0xd50a('0x17')](function(_0x497140){_0xac6c3c(null,_0x497140);})[_0xd50a('0x13')](function(_0x1a3b76){_0xac6c3c(_0x1a3b76);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x4e')]=function(_0x246f00,_0x50055d){this['rpc'][_0xd50a('0x4f')](_0x246f00)['then'](function(_0x412d36){_0x50055d(null,_0x412d36?_0x412d36['name']:![]);})[_0xd50a('0x13')](function(_0x4e67c2){_0x50055d(_0x4e67c2);});};AGIVertices[_0xd50a('0x18')]['agentPause']=function(_0x3fd0e1,_0x44fa0c,_0x32afdb){var _0x1e4f2a={'role':_0xd50a('0x50')};_0x1e4f2a[_0x3fd0e1]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x51')](_0x1e4f2a,_0x44fa0c,this['channel'][_0xd50a('0x38')])[_0xd50a('0x17')](function(_0x55260f){_0x32afdb(null,_[_0xd50a('0x47')](_0x55260f)?![]:!![]);})[_0xd50a('0x13')](function(_0x42e3a8){logger['error'](_0x42e3a8);_0x32afdb(null,![]);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x52')]=function(_0x325c10,_0x1b990b){var _0x263a83={'role':_0xd50a('0x50')};_0x263a83[_0x325c10]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x52')](_0x263a83)[_0xd50a('0x17')](function(_0x440244){_0x1b990b(null,_['isNil'](_0x440244)?![]:!![]);})[_0xd50a('0x13')](function(_0x3743f6){logger[_0xd50a('0x2c')](_0x3743f6);_0x1b990b(null,![]);});};AGIVertices[_0xd50a('0x18')]['agentLogout']=function(_0x34bb1b,_0x230b94){var _0x260b53={'role':_0xd50a('0x50')};_0x260b53[_0x34bb1b]=this[_0xd50a('0xe')][_0xd50a('0x3d')];this[_0xd50a('0xf')][_0xd50a('0x53')](_0x260b53)[_0xd50a('0x17')](function(_0x3eb2db){_0x230b94(null,_[_0xd50a('0x47')](_0x3eb2db)?![]:!![]);})[_0xd50a('0x13')](function(_0xc3e316){logger[_0xd50a('0x2c')](_0xc3e316);_0x230b94(null,![]);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x54')]=function(_0x5a6e28,_0x2c5ea3){var _0x5d1717={'role':_0xd50a('0x50')};_0x5d1717[_0x5a6e28]=this[_0xd50a('0xe')][_0xd50a('0x3d')];var _0x435947=_0x5a6e28!='internal'?util[_0xd50a('0x29')]('%s/%s@from-sip/n',_0xd50a('0x55'),this['channel']['callerid']):undefined;this[_0xd50a('0xf')][_0xd50a('0x54')](_0x5d1717,_0x435947)[_0xd50a('0x17')](function(_0x44791a){_0x2c5ea3(null,_['isNil'](_0x44791a)?![]:!![]);})[_0xd50a('0x13')](function(_0x12858a){logger[_0xd50a('0x2c')](_0x12858a);_0x2c5ea3(null,![]);});};AGIVertices['prototype'][_0xd50a('0x56')]=function(_0x8a2c0c,_0x3849c5){sh[_0xd50a('0x57')](_[_0xd50a('0x58')](_0x8a2c0c),function(_0x5dbe0c,_0x3bd9cd){var _0x25f654=_0x3bd9cd[_0xd50a('0x59')](/(\r\n|\n|\r)/gm,'');_0x3849c5(null,_0x25f654);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x5a')]=function(_0x475b5a,_0x1f975b){scripts[_0xd50a('0x5a')](_0x475b5a[_0xd50a('0x5b')],_0x475b5a[_0xd50a('0x5c')]||_0xd50a('0x5d'),_0x475b5a[_0xd50a('0x5d')],_0x475b5a['languageCode']||_0xd50a('0x5e'),_0x475b5a['ssmlGender']||'MALE',_0x475b5a['audioEncoding']||_0xd50a('0x5f'))['then'](function(_0x509aae){_0x1f975b(null,_0x509aae);})[_0xd50a('0x13')](function(_0x2bfe25){_0x1f975b(_0x2bfe25);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x60')]=function(_0x11fe51,_0x52dd5d){scripts[_0xd50a('0x60')](_0x11fe51[_0xd50a('0x5d')],_0x11fe51[_0xd50a('0x61')]||'en',0x1)[_0xd50a('0x17')](function(_0x597fa9){_0x52dd5d(null,_0x597fa9);})['catch'](function(_0x1be76f){_0x52dd5d(_0x1be76f);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x62')]=function(_0x5e37c4,_0xd0a835){var _0x470cdf={'uri':_0x5e37c4[_0xd50a('0x63')],'method':_0x5e37c4[_0xd50a('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5e37c4[_0xd50a('0x65')])===_0xd50a('0x66')&&parseInt(_0x5e37c4['timeout'])>=0x1?parseInt(_0x5e37c4[_0xd50a('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xd50a('0x67')]([_0xd50a('0x68'),_0xd50a('0x69')],_0x470cdf[_0xd50a('0x64')]['toUpperCase']())){try{_0x470cdf[_0xd50a('0x6a')]=_0x5e37c4['rawBody']?JSON[_0xd50a('0x6b')](_0x5e37c4[_0xd50a('0x6c')]):{};}catch(_0x30c77a){logger[_0xd50a('0x2c')](_0xd50a('0x6d'),_0x30c77a);}}try{_0x470cdf['headers']=_0x5e37c4[_0xd50a('0xa')]?JSON[_0xd50a('0x6b')](_0x5e37c4[_0xd50a('0xa')]):{};}catch(_0x563740){logger[_0xd50a('0x2c')](_0xd50a('0x6e'),_0x563740);}if(_0x5e37c4[_0xd50a('0x6f')]){try{var _0x983732=require(_0x5e37c4['computedVariables'])['sync'](this,_0x470cdf);_0x470cdf[_0xd50a('0x70')]=Mustache[_0xd50a('0x71')](_0x5e37c4[_0xd50a('0x63')],_0x983732,{},['$$','$$']);if(_0x470cdf[_0xd50a('0x72')]){_0x470cdf[_0xd50a('0x72')]=JSON[_0xd50a('0x6b')](Mustache['render'](JSON[_0xd50a('0x73')](_0x470cdf[_0xd50a('0x72')]),_0x983732,{},['$$','$$']));}if(_0x470cdf[_0xd50a('0x6a')]){_0x470cdf[_0xd50a('0x6a')]=JSON[_0xd50a('0x6b')](Mustache['render'](JSON[_0xd50a('0x73')](_0x470cdf[_0xd50a('0x6a')]),_0x983732,{},['$$','$$']));}}catch(_0x58403f){logger[_0xd50a('0x2c')](_0xd50a('0x74'),_0x58403f);}}rp(_0x470cdf)[_0xd50a('0x17')](function(_0x44762f){var _0x5a1e5a={'statusCode':_0x44762f[_0xd50a('0x75')]||0xc8,'statusMessage':_0x44762f[_0xd50a('0x76')]||'OK','headers':_0x44762f['headers']||{},'body':_0x44762f[_0xd50a('0x6a')]||{}};_0xd0a835(null,_0x5a1e5a);})[_0xd50a('0x13')](function(_0x3f04bb){var _0x2cd6e6={'statusCode':_0x3f04bb[_0xd50a('0x75')]||0x1f4,'statusMessage':_0x3f04bb[_0xd50a('0x77')]||_0xd50a('0x78'),'headers':_0x3f04bb['options'][_0xd50a('0x72')]||{},'body':_0x3f04bb['options'][_0xd50a('0x6a')]||{}};_0xd0a835(null,_0x2cd6e6);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x79')]=function(_0x50a181,_0x5f071b){scripts[_0xd50a('0x79')](this[_0xd50a('0xe')][_0xd50a('0x38')],_0x50a181[_0xd50a('0x7a')],_0x50a181[_0xd50a('0x5d')],_0x50a181[_0xd50a('0x7b')]||'en')[_0xd50a('0x17')](function(_0x545e58){_0x5f071b(null,_0x545e58);})[_0xd50a('0x13')](function(_0x1865b2){_0x5f071b(_0x1865b2);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x7c')]=function(_0x1529b7,_0xbab9f8){scripts[_0xd50a('0x7c')](this[_0xd50a('0xe')]['uniqueid'],_0x1529b7[_0xd50a('0x7d')],_0x1529b7[_0xd50a('0x7e')],_0x1529b7['private_key'],_0x1529b7[_0xd50a('0x5d')],_0x1529b7[_0xd50a('0x7f')]||'en')[_0xd50a('0x17')](function(_0x430595){_0xbab9f8(null,_0x430595);})['catch'](function(_0x34d45b){_0xbab9f8(_0x34d45b);});};AGIVertices[_0xd50a('0x18')]['sestekNDA']=function(_0xd8dbed,_0x60a4dc){scripts[_0xd50a('0x80')](this[_0xd50a('0xe')],_0xd8dbed)[_0xd50a('0x17')](function(_0x42a5a2){_0x60a4dc(null,_0x42a5a2);})[_0xd50a('0x13')](function(_0x3faa81){_0x60a4dc(_0x3faa81);});};AGIVertices[_0xd50a('0x18')]['ispeechTTS']=function(_0x423bfc,_0x1a335d){scripts['ispeechTTS'](_0x423bfc[_0xd50a('0x7a')],_0x423bfc[_0xd50a('0x5d')],_0x423bfc[_0xd50a('0x81')]||_0xd50a('0x5e'),_0x423bfc[_0xd50a('0x82')])[_0xd50a('0x17')](function(_0x5b1356){_0x1a335d(null,_0x5b1356);})[_0xd50a('0x13')](function(_0x2d62f1){_0x1a335d(_0x2d62f1);});};AGIVertices['prototype'][_0xd50a('0x83')]=function(_0x50d821,_0x2ea038,_0xf791b3){scripts['ispeechASR'](_0x2ea038,_0x50d821[_0xd50a('0x7a')],_0x50d821[_0xd50a('0x84')]||_0xd50a('0x5e'),this[_0xd50a('0x85')](_0x50d821['model'])?_0x50d821[_0xd50a('0x86')]:undefined)[_0xd50a('0x17')](function(_0x2ff165){_0xf791b3(null,_0x2ff165);})[_0xd50a('0x13')](function(_0x1597db){_0xf791b3(_0x1597db);});};AGIVertices[_0xd50a('0x18')]['awsPolly']=function(_0x4e2c63,_0x15d00a){scripts[_0xd50a('0x87')](_0x4e2c63[_0xd50a('0x88')],_0x4e2c63['aws_secret_access_key'],_0x4e2c63['aws_polly_region'],_0x4e2c63['aws_polly_voice']||_0xd50a('0x89'),_0x4e2c63[_0xd50a('0x5d')],_0x4e2c63[_0xd50a('0x8a')]||_0xd50a('0x5d'))['then'](function(_0x16ed56){_0x15d00a(null,_0x16ed56);})[_0xd50a('0x13')](function(_0x52a292){_0x15d00a(_0x52a292);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x8b')]=function(_0x2203f4,_0x13cb78){scripts['awsLex'](this[_0xd50a('0xe')][_0xd50a('0x38')],_0x2203f4[_0xd50a('0x88')],_0x2203f4['aws_secret_access_key'],_0x2203f4['aws_lex_region'],_0x2203f4[_0xd50a('0x5d')],_0x2203f4[_0xd50a('0x8c')])['then'](function(_0x1d75fe){_0x13cb78(null,_0x1d75fe);})[_0xd50a('0x13')](function(_0x3a8b1c){_0x13cb78(_0x3a8b1c);});};AGIVertices[_0xd50a('0x18')]['googleASR']=function(_0x4123c9,_0x47755f,_0x589637){scripts[_0xd50a('0x8d')](_0x47755f,_0x4123c9[_0xd50a('0x7a')],_0x4123c9[_0xd50a('0x8e')]||_0xd50a('0x5e'))['then'](function(_0x2e288d){_0x589637(null,_0x2e288d);})[_0xd50a('0x13')](function(_0x52cb0c){_0x589637(_0x52cb0c);});};AGIVertices[_0xd50a('0x18')][_0xd50a('0x8f')]=function(_0x315bd8,_0x3af59a,_0x559597){scripts[_0xd50a('0x8f')](_0x3af59a,_0x315bd8[_0xd50a('0x90')],_0x315bd8['appsecret'],_0x315bd8[_0xd50a('0x70')])['then'](function(_0x46a5ae){_0x559597(null,_0x46a5ae);})[_0xd50a('0x13')](function(_0xc3405c){_0x559597(_0xc3405c);});};AGIVertices['prototype'][_0xd50a('0x91')]=function(_0x4ac808){var _0x5d6209=_[_0xd50a('0x67')](verticesWithRetry,_0x4ac808['agicommand'])?_0x4ac808:_[_0xd50a('0x92')](_0x4ac808);for(var _0x34cab5 in _0x5d6209){if(_0x5d6209[_0xd50a('0x93')](_0x34cab5)){if(_0x5d6209[_0x34cab5]&&_[_0xd50a('0x94')](_0x5d6209[_0x34cab5])){if(_[_0xd50a('0x67')](recursiveMapAttributes,_0x34cab5)){_0x5d6209[_0x34cab5]=this[_0xd50a('0x95')](_0x5d6209[_0x34cab5]);}else{_0x5d6209[_0x34cab5]=this[_0xd50a('0x96')](_0x5d6209[_0x34cab5]);}}}}return _0x5d6209;};AGIVertices['prototype'][_0xd50a('0x97')]=function(_0x105c92){for(var _0x34011e in _0x105c92){if(_0x105c92[_0xd50a('0x93')](_0x34011e)){if(_[_0xd50a('0x98')](_0x105c92[_0x34011e])){this[_0xd50a('0x97')](_0x105c92[_0x34011e]);}else if(_[_0xd50a('0x99')](_0x105c92[_0x34011e])){for(var _0x5e6b3b=0x0;_0x5e6b3b<_0x105c92[_0x34011e]['length'];_0x5e6b3b++){this[_0xd50a('0x97')](_0x105c92[_0x34011e][_0x5e6b3b]);}}else if(_[_0xd50a('0x94')](_0x105c92[_0x34011e])){_0x105c92[_0x34011e]=this[_0xd50a('0x96')](_0x105c92[_0x34011e]);}}}};AGIVertices['prototype'][_0xd50a('0x9a')]=function(_0x5edf7d,_0x42c597){for(var _0x41dc53 in _0x5edf7d){if(_0x5edf7d[_0xd50a('0x93')](_0x41dc53)){if(_[_0xd50a('0x98')](_0x5edf7d[_0x41dc53])){if(!_['isEmpty'](_0x5edf7d[_0x41dc53])){this[_0xd50a('0x9a')](_0x5edf7d[_0x41dc53],util[_0xd50a('0x29')]('%s.%s',_0x42c597,_0x41dc53));}}else if(_[_0xd50a('0x99')](_0x5edf7d[_0x41dc53])){for(var _0x55829b=0x0;_0x55829b<_0x5edf7d[_0x41dc53][_0xd50a('0x9b')];_0x55829b++){this[_0xd50a('0x9a')](_0x5edf7d[_0x41dc53][_0x55829b],util[_0xd50a('0x29')](_0xd50a('0x9c'),_0x42c597,_0x41dc53+'['+_0x55829b+']'));}}else{if(!_['isNil'](_0x5edf7d[_0x41dc53])){this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format']('%s.%s',_0x42c597,_0x41dc53),_0x5edf7d[_0x41dc53]);}}}}};AGIVertices[_0xd50a('0x18')][_0xd50a('0x95')]=function(_0x149645){try{var _0xa0c99c=JSON[_0xd50a('0x6b')](_0x149645);this['recursiveNodeIndex'](_0xa0c99c);return JSON[_0xd50a('0x73')](_0xa0c99c);}catch(_0x4b89f3){return this['replaceAllVariables'](_0x149645);}};AGIVertices['prototype'][_0xd50a('0x96')]=function(_0x363320){var _0x14e8dc=_0x363320[_0xd50a('0x9e')]('{');for(var _0x14f237=0x1;_0x14f237<_0x14e8dc['length'];_0x14f237+=0x1){var _0x3ac69c=_0x14e8dc[_0x14f237][_0xd50a('0x9e')]('}');if(_0x3ac69c['length']>0x1){_0x363320=_0x363320[_0xd50a('0x9f')]('{'+_0x3ac69c[0x0]+'}',this['channel'][_0xd50a('0x11')](_0x3ac69c[0x0])[_0xd50a('0xa0')]||_0x3ac69c[0x0]);}}if(_0x14e8dc[_0xd50a('0x9b')]===0x1){return _0x363320[_0xd50a('0x4c')]();}return this[_0xd50a('0x96')](_0x363320);};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa1')]=function(_0x48a904,_0x137719){var _0x3d84a7=this['channel'][_0xd50a('0x11')](_0x48a904);if(_0x3d84a7['result']===-0x1){return _0x3d84a7;}logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xa2'),_0x137719,_0x3d84a7[_0xd50a('0xa0')]));return this['channel'][_0xd50a('0x9d')](_0x137719,_0x3d84a7[_0xd50a('0xa0')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x85')]=function(_0x52041b){return _0x52041b&&_0x52041b!=='0'&&_0x52041b!=='-1'&&_0x52041b!=='';};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa3')]=function(_0x2a84ac){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x2a84ac,'-');_0x2a84ac[_0xd50a('0xa5')]=_0x2a84ac[_0xd50a('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd50a('0x18')][_0xd50a('0xa6')]=function(_0x5d8d95){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xa7'),_0x5d8d95[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5d8d95[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}var _0x44c211='\x22'+_0x5d8d95['text']+'\x22';if(this['isConfigured'](_0x5d8d95['options'])){_0x44c211+=','+_0x5d8d95[_0xd50a('0xaa')];}var _0x270706=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xab'),_0x44c211);if(_0x270706[_0xd50a('0xac')]===-0x1){return _0x270706;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x44c211));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xad')]=function(_0x1016e1){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xae'),_0x1016e1[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x1016e1['grammar'])){return this['channel']['noop'](_0xd50a('0xaf'));}var _0x25db2d=_0x1016e1['grammar'];if(this['isConfigured'](_0x1016e1[_0xd50a('0xaa')])){_0x25db2d+=','+_0x1016e1[_0xd50a('0xaa')];}var _0x38497b=this['channel'][_0xd50a('0x57')](_0xd50a('0xb0'),_0x25db2d);if(_0x38497b[_0xd50a('0xac')]===-0x1){return _0x38497b;}var _0x4039bf=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xd50a('0xb1'));if(_0x4039bf[_0xd50a('0xac')]===-0x1){return _0x4039bf;}var _0x1d46af=this[_0xd50a('0xa1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x1d46af[_0xd50a('0xac')]===-0x1){return _0x1d46af;}var _0x2864c6=this[_0xd50a('0xa1')]('RECOG_INSTANCE()',_0xd50a('0xb2'));if(_0x2864c6[_0xd50a('0xac')]===-0x1){return _0x2864c6;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xb3'),_0x25db2d));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xb4')]=function(_0x4651f1){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4651f1[_0xd50a('0x39')]));return this['channel']['agi']([_0x4651f1[_0xd50a('0xb5')],_0x4651f1[_0xd50a('0xb6')]]);};AGIVertices[_0xd50a('0x18')]['answer']=function(_0x112104){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x112104[_0xd50a('0x39')]));if(this[_0xd50a('0x85')](_0x112104[_0xd50a('0x65')])){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xb7'),_0x112104[_0xd50a('0x65')]));var _0x31a0a4=this[_0xd50a('0xe')][_0xd50a('0xb8')](_0x112104[_0xd50a('0x65')]);if(_0x31a0a4[_0xd50a('0xac')]===-0x1){return _0x31a0a4;}}return this['channel'][_0xd50a('0xb9')]();};AGIVertices[_0xd50a('0x18')][_0xd50a('0xba')]=function(_0x5e98a8){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xbb'),_0x5e98a8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5e98a8['list_id'])){return this['channel']['error'](_0x5e98a8,_0xd50a('0xbc'));}_0x5e98a8[_0xd50a('0x4b')]=moment();if(this[_0xd50a('0x85')](_0x5e98a8[_0xd50a('0xbd')])){_0x5e98a8['scheduledAt']=moment()['add'](_0x5e98a8[_0xd50a('0xbd')],'minutes');}if(!this['isConfigured'](_0x5e98a8['callback_priority'])){_0x5e98a8['callback_priority']=0x2;}this[_0xd50a('0x44')]['sync'](this,_0x5e98a8);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xbe'),_0x5e98a8[_0xd50a('0x49')],_0x5e98a8[_0xd50a('0x4a')],_0x5e98a8[_0xd50a('0x4b')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xbf')]=function(_0x6cc147){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xc0'),_0x6cc147[_0xd50a('0x39')]));var _0x3156da=this[_0xd50a('0xe')]['exec'](_0x6cc147[_0xd50a('0xc1')],_0x6cc147[_0xd50a('0xaa')]);if(_0x3156da[_0xd50a('0xac')]===-0x1){return _0x3156da;}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xc2'),_0x6cc147[_0xd50a('0xc1')],_0x6cc147[_0xd50a('0xaa')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc3')]=function(_0x177143){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0xc4'),_0x177143[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x177143[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}var _0x4bf0b9='\x22'+_0x177143[_0xd50a('0x5d')]+'\x22';if(this['isConfigured'](_0x177143[_0xd50a('0xaa')])){_0x4bf0b9+=','+_0x177143[_0xd50a('0xaa')];}var _0x50b92a=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xab'),_0x4bf0b9);if(_0x50b92a[_0xd50a('0xac')]===-0x1){return _0x50b92a;}return this['channel']['noop'](util[_0xd50a('0x29')](_0xd50a('0xc5'),_0x4bf0b9));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc6')]=function(_0x2a32a0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xc7'),_0x2a32a0[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2a32a0[_0xd50a('0x5d')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xa9'));}var _0x5bad0d='\x22'+_0x2a32a0[_0xd50a('0x5d')]+'\x22';if(this[_0xd50a('0x85')](_0x2a32a0[_0xd50a('0xaa')])){_0x5bad0d+=','+_0x2a32a0[_0xd50a('0xaa')];}var _0x68f4dc=this[_0xd50a('0xe')][_0xd50a('0x57')]('MRCPSynth',_0x5bad0d);if(_0x68f4dc[_0xd50a('0xac')]===-0x1){return _0x68f4dc;}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xc5'),_0x5bad0d));};AGIVertices[_0xd50a('0x18')]['lumenvoxasr']=function(_0x55ff40){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xc8'),_0x55ff40[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x55ff40[_0xd50a('0xc9')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0xaf'));}var _0x556b92=_0x55ff40[_0xd50a('0xc9')];if(this[_0xd50a('0x85')](_0x55ff40[_0xd50a('0xaa')])){_0x556b92+=','+_0x55ff40[_0xd50a('0xaa')];}var _0x13694d=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0xb0'),_0x556b92);if(_0x13694d[_0xd50a('0xac')]===-0x1){return _0x13694d;}var _0x48c4cc=this[_0xd50a('0xa1')]('RECOG_CONFIDENCE()',_0xd50a('0xca'));if(_0x48c4cc[_0xd50a('0xac')]===-0x1){return _0x48c4cc;}var _0x5b0bf2=this[_0xd50a('0xa1')]('RECOG_INPUT()',_0xd50a('0xcb'));if(_0x5b0bf2['result']===-0x1){return _0x5b0bf2;}var _0x472855=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd50a('0xcc'));if(_0x472855[_0xd50a('0xac')]===-0x1){return _0x472855;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x556b92));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xcd')]=function(_0x4c4177){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4c4177[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x4c4177[_0xd50a('0xc9')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xaf'));}var _0xb75c85=_0x4c4177[_0xd50a('0xc9')];if(this['isConfigured'](_0x4c4177[_0xd50a('0xaa')])){_0xb75c85+=','+_0x4c4177[_0xd50a('0xaa')];}var _0x38fc8a=this[_0xd50a('0xe')][_0xd50a('0x57')]('MRCPRecog',_0xb75c85);if(_0x38fc8a[_0xd50a('0xac')]===-0x1){return _0x38fc8a;}var _0x2f4ef1=this['getAndSetVariable'](_0xd50a('0xce'),_0xd50a('0xcf'));if(_0x2f4ef1[_0xd50a('0xac')]===-0x1){return _0x2f4ef1;}var _0x5a2a31=this[_0xd50a('0xa1')](_0xd50a('0xd0'),_0xd50a('0xd1'));if(_0x5a2a31[_0xd50a('0xac')]===-0x1){return _0x5a2a31;}var _0x2f6a42=this[_0xd50a('0xa1')](_0xd50a('0xd2'),'SESTEK_ASR_INSTANCE');if(_0x2f6a42['result']===-0x1){return _0x2f6a42;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xb3'),_0xb75c85));};AGIVertices[_0xd50a('0x18')]['database']=function(_0x515ad3){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0xd3'),_0x515ad3[_0xd50a('0x39')]));if(!this['isConfigured'](_0x515ad3[_0xd50a('0xd4')])){return this['channel'][_0xd50a('0x2c')](_0x515ad3,_0xd50a('0xd5'));}var _0x172fd1=this[_0xd50a('0x19')][_0xd50a('0xa4')](this,_0x515ad3[_0xd50a('0xd4')]);if(!_0x172fd1){return this['channel']['error'](_0x515ad3,_0xd50a('0xd6'));}if(!this['isConfigured'](_0x515ad3['query'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x515ad3,_0xd50a('0xd7'));}var _0x4978e7=_0x515ad3[_0xd50a('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xd8'),_0x4978e7));var _0x3c0575=this['getQueryOdbc'][_0xd50a('0xa4')](this,_0x172fd1,_0x4978e7);this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x515ad3,_0x4978e7);if(!this[_0xd50a('0x85')](_0x515ad3['variable_id'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xd9'));}var _0x39ce6b=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x515ad3[_0xd50a('0xda')]);if(!_0x39ce6b){return this[_0xd50a('0xe')]['error'](_0x515ad3,_0xd50a('0xdb'));}var _0x3bc271=this;_0x3c0575[_0xd50a('0xdc')](function(_0x125965,_0x5c6d71){Object[_0xd50a('0xdd')](_0x125965)[_0xd50a('0xdc')](function(_0x2f64a8){_0x3bc271[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')]('%s[%s][%s]',_0x39ce6b,_0x5c6d71,_0x2f64a8),_0x125965[_0x2f64a8]);});});this['channel'][_0xd50a('0x9d')](util[_0xd50a('0x29')]('%s_ROWS_COUNT',_0x39ce6b),_0x3c0575[_0xd50a('0x9b')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xde'),_0x39ce6b));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xdf')]=function(_0x369b9a){logger[_0xd50a('0xe0')](util[_0xd50a('0x29')](_0xd50a('0xe1'),_0x369b9a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x369b9a[_0xd50a('0xe2')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x369b9a,_0xd50a('0xe3'));}var _0x334719=this[_0xd50a('0x1b')][_0xd50a('0xa4')](this,_0x369b9a[_0xd50a('0xe2')]);if(!_0x334719){return this['channel'][_0xd50a('0x2c')](_0x369b9a,_0xd50a('0xe4'));}var _0x33e8f0=this[_0xd50a('0xe')]['exec'](_0xd50a('0xe5'),[util[_0xd50a('0x29')](_0xd50a('0xe6'),_0x334719),_0x369b9a[_0xd50a('0x65')],_0x369b9a[_0xd50a('0xe7')],_0x369b9a['url']]);if(_0x33e8f0[_0xd50a('0xac')]===-0x1){return _0x33e8f0;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xe8'),_0xd50a('0xe5')));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xe9')]=function(_0x1f6b9a){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xea'),_0x1f6b9a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x1f6b9a[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}if(!this[_0xd50a('0x85')](_0x1f6b9a[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')]['bot']=!![];this[_0xd50a('0x37')](_0x1f6b9a);this['createSquareMessage'](_0x1f6b9a[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')]('Trying\x20Dialogflow:\x20%s',_0x1f6b9a[_0xd50a('0x5d')]));var _0x39eaf0=this[_0xd50a('0x79')][_0xd50a('0xa4')](this,_0x1f6b9a);if(_0x39eaf0){for(var _0x1b156f in _0x39eaf0){if(_0x39eaf0[_0xd50a('0x93')](_0x1b156f)){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')]('DIALOGFLOW_%s',_0x1b156f[_0xd50a('0xec')]()),_0x39eaf0[_0x1b156f]);}}this[_0xd50a('0x43')](_0x39eaf0[_0xd50a('0xed')],'out',_0xd50a('0xe9'),'');return this['channel'][_0xd50a('0xa8')](util['format']('Dialogflow\x20Result\x20%s',_0x39eaf0[_0xd50a('0xed')]));}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x1f6b9a,_0xd50a('0xee'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xef')]=function(_0x175d53){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x175d53[_0xd50a('0x39')]));if(!this['isConfigured'](_0x175d53[_0xd50a('0x7d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20project_id\x20configured');}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0x7e')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0xf0'));}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0xf1')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xf2'));}if(!this[_0xd50a('0x85')](_0x175d53[_0xd50a('0x7f')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xf3'));}if(!this[_0xd50a('0x85')](_0x175d53['text'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20text\x20configured');}this['channel'][_0xd50a('0xf4')]=!![];this['createSquareDetailsReport'](_0x175d53);this[_0xd50a('0x43')](_0x175d53[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x175d53['text']));var _0x2bf3a0=this[_0xd50a('0x7c')][_0xd50a('0xa4')](this,_0x175d53);if(_0x2bf3a0){for(var _0x1888a7 in _0x2bf3a0){if(_0x2bf3a0['hasOwnProperty'](_0x1888a7)){if(_0x1888a7!==_0xd50a('0xf5')){this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format'](_0xd50a('0xf6'),_0x1888a7['toUpperCase']()),_0x2bf3a0[_0x1888a7]);}}}this[_0xd50a('0x43')](_0x2bf3a0[_0xd50a('0xed')],_0xd50a('0xf7'),_0xd50a('0xef'),_0x2bf3a0[_0xd50a('0xf5')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xf8'),_0x2bf3a0[_0xd50a('0xed')]));}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x175d53,_0xd50a('0xf9'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0xfa')]=function(_0x5133a5){logger['info'](util[_0xd50a('0x29')](_0xd50a('0xfb'),_0x5133a5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x5133a5['ndauth_url'])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xfc'));}if(!this['isConfigured'](_0x5133a5[_0xd50a('0xfd')])){return this[_0xd50a('0xe')]['noop'](_0xd50a('0xfe'));}if(!this[_0xd50a('0x85')](_0x5133a5[_0xd50a('0xff')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20password\x20configured');}if(!this[_0xd50a('0x85')](_0x5133a5['ndassistant_url'])){return this['channel']['noop'](_0xd50a('0xa9'));}this[_0xd50a('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x5133a5);this[_0xd50a('0x43')](_0x5133a5[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x100'),_0x5133a5[_0xd50a('0x5d')]));var _0x1c8226=this[_0xd50a('0x80')]['sync'](this,_0x5133a5);if(_0x1c8226){for(var _0x5d48f9 in _0x1c8226){if(_0x1c8226[_0xd50a('0x93')](_0x5d48f9)){this['channel'][_0xd50a('0x9d')](util['format'](_0xd50a('0x101'),_0x5d48f9['toUpperCase']()),_0x1c8226[_0x5d48f9]);}}this[_0xd50a('0x43')](_0x1c8226[_0xd50a('0xed')],'out',_0xd50a('0xfa'),'');if(_0x1c8226['audiofile']){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x102'),_0x1c8226[_0xd50a('0x103')]));var _0x3d1320=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x1c8226[_0xd50a('0x103')]);try{fs[_0xd50a('0x105')](_0x1c8226['audiofile']+_0xd50a('0x106'));}catch(_0x2ec6d6){logger[_0xd50a('0x2c')](_0x2ec6d6);}return _0x3d1320;}else{return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x107'),_0x1c8226[_0xd50a('0xed')]));}}return this['channel'][_0xd50a('0x2c')](_0x5133a5,_0xd50a('0x108'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x109')]=function(_0xb8a997){logger['info'](util[_0xd50a('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0xb8a997['label']));return this['channel']['noop'](_0xd50a('0x109'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x10a')]=function(_0x155826){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x10b'),_0x155826[_0xd50a('0x39')]));var _0x202bef='';if(_0x155826[_0xd50a('0x10c')]){if(!this[_0xd50a('0x85')](_0x155826[_0xd50a('0x10c')])){return this[_0xd50a('0xe')]['error'](_0x155826,_0xd50a('0x10d'));}else{var _0x29e784=parseInt(_0x155826[_0xd50a('0x10c')],0xa);if(isNaN(_0x29e784)){_0x202bef=_0x155826['trunk_id'];}else{_0x202bef=this[_0xd50a('0x1d')][_0xd50a('0xa4')](this,_0x155826[_0xd50a('0x10c')]);if(!_0x202bef){return this[_0xd50a('0xe')]['error'](_0x155826,'no\x20trunk\x20found');}}}}else if(_0x155826[_0xd50a('0x10e')]){_0x202bef=_0x155826[_0xd50a('0x10e')];}else{return this['channel'][_0xd50a('0x2c')](_0x155826,_0xd50a('0x10d'));}var _0x5ea329=this[_0xd50a('0xe')]['exec'](_0xd50a('0xe5'),[util[_0xd50a('0x29')]('SIP/%s/%s',_0x202bef,_0x155826['phone']),_0x155826[_0xd50a('0x65')],_0x155826[_0xd50a('0xe7')],_0x155826[_0xd50a('0x63')]]);if(_0x5ea329[_0xd50a('0xac')]===-0x1){return _0x5ea329;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0xe8'),_0xd50a('0xe5')));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x10f')]=function(_0x27bcd4){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x110'),_0x27bcd4[_0xd50a('0x39')]));return this[_0xd50a('0xe')]['noop']('finally');};AGIVertices[_0xd50a('0x18')][_0xd50a('0xc')]=function(_0x3037d8){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3037d8[_0xd50a('0x39')]));if(_0x3037d8[_0xd50a('0xa5')]===0x0){return this['maxRetry'](_0x3037d8);}_0x3037d8[_0xd50a('0xa5')]-=0x1;if(!this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0x111')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3037d8,_0xd50a('0x112'));}var _0x13932e=this[_0xd50a('0x1f')]['sync'](this,_0x3037d8[_0xd50a('0x111')]);if(!_0x13932e){return this['channel'][_0xd50a('0x2c')](_0x3037d8,_0xd50a('0x113'));}if(!this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0xda')])){return this['channel'][_0xd50a('0x2c')](_0xd50a('0xd9'));}var _0x155eb5=this[_0xd50a('0xe')][_0xd50a('0x114')](_0x13932e,_0x3037d8[_0xd50a('0x115')],_0x3037d8['maxdigit']);var _0x31b547=_0x155eb5[_0xd50a('0xac')]?_0x155eb5[_0xd50a('0xac')]['toString']():'';logger['info'](_0xd50a('0x116'),JSON['stringify'](_0x155eb5));if(_0x155eb5[_0xd50a('0xac')]===-0x1){this[_0xd50a('0x37')]['sync'](this,_0x3037d8,_0x31b547);return _0x155eb5;}else if(_0x155eb5[_0xd50a('0xa0')]===_0xd50a('0x65')){_0x155eb5[_0xd50a('0xac')]=_0x31b547['length']>=parseInt(_0x3037d8[_0xd50a('0x117')])?'x':'i';}else{_0x155eb5[_0xd50a('0xac')]=_0x31b547[_0xd50a('0x9b')]>=parseInt(_0x3037d8['mindigit'])&&_0x31b547[_0xd50a('0x9b')]<=parseInt(_0x3037d8[_0xd50a('0x118')])?'x':'i';}var _0x5a8525=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x3037d8[_0xd50a('0xda')]);if(!_0x5a8525){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3037d8,'no\x20variable\x20found');}this[_0xd50a('0xe')]['setVariable'](_0x5a8525,_0x31b547);if(this[_0xd50a('0x85')](_0x3037d8[_0xd50a('0x119')])){var _0x22d077=parseInt(_0x3037d8[_0xd50a('0x119')],0xa);var _0x4292d8=rs[_0xd50a('0x11a')]({'charset':'*','length':_0x22d077});var _0x2364a=_0x31b547[_0xd50a('0x9b')];if(_0x2364a>0x0){if(_0x2364a>_0x22d077){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,_0x3037d8[_0xd50a('0x11b')]===_0xd50a('0x11c')?_0x4292d8+_0x31b547[_0xd50a('0x11d')](_0x22d077):_0x31b547[_0xd50a('0x11d')](0x0,_0x2364a-_0x22d077)+_0x4292d8);}else{this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,rs[_0xd50a('0x11a')]({'charset':'*','length':_0x2364a}));}}else{this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3037d8,'');}}else{this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3037d8,_0x31b547);}return _0x155eb5;};AGIVertices['prototype'][_0xd50a('0xd')]=function(_0x5bb8c4){logger['info'](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5bb8c4['label']));return this[_0xd50a('0xc')](_0x5bb8c4);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x11e')]=function(_0x31f9c6){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x11f'),_0x31f9c6[_0xd50a('0x39')]));this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x31f9c6,_0x31f9c6[_0xd50a('0x120')]);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x121'),_0x31f9c6[_0xd50a('0x120')]));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x122')]=function(_0x5b3bf8){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x123'),_0x5b3bf8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5b3bf8[_0xd50a('0x88')])||!this[_0xd50a('0x85')](_0x5b3bf8[_0xd50a('0x124')])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0x125'));}if(!this[_0xd50a('0x85')](_0x5b3bf8['text'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20text\x20configured');}this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x126'),_0x5b3bf8['text']));var _0x26bf61=this[_0xd50a('0x87')][_0xd50a('0xa4')](this,_0x5b3bf8);if(_0x26bf61){this['channel'][_0xd50a('0xa8')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x26bf61));var _0x28c5d9=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x26bf61);try{fs[_0xd50a('0x105')](_0x26bf61+_0xd50a('0x106'));}catch(_0x236956){logger['error'](_0x236956);}return _0x28c5d9;}return this[_0xd50a('0xe')]['error'](_0x5b3bf8,_0xd50a('0x127'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x128')]=function(_0x5bedd2){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x129'),_0x5bedd2['label']));if(!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x88')])||!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x124')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x125'));}if(!this[_0xd50a('0x85')](_0x5bedd2[_0xd50a('0x8c')])){return this['channel']['noop'](_0xd50a('0x12a'));}if(!this['isConfigured'](_0x5bedd2[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')][_0xd50a('0xf4')]=!![];this[_0xd50a('0x37')](_0x5bedd2);this[_0xd50a('0x43')](_0x5bedd2[_0xd50a('0x5d')],'in','','');this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x12b'),_0x5bedd2[_0xd50a('0x5d')]));var _0x4aec3e=this['awsLex'][_0xd50a('0xa4')](this,_0x5bedd2);if(_0x4aec3e){for(var _0x475214 in _0x4aec3e){if(_0x4aec3e[_0xd50a('0x93')](_0x475214)&&_[_0xd50a('0x94')](_0x4aec3e[_0x475214])){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x12c'),_0x475214[_0xd50a('0xec')]()),_0x4aec3e[_0x475214]);}}if(_[_0xd50a('0x47')](_0x4aec3e[_0xd50a('0x77')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x12d'));}else{this['createSquareMessage'](_0x4aec3e[_0xd50a('0x77')],'out',_0xd50a('0x12e'),'');return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x4aec3e[_0xd50a('0x77')]));}}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x5bedd2,_0xd50a('0x12f'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x130')]=function(_0x26a041){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x131'),_0x26a041['label'],_0x26a041['timeout']));if(!this[_0xd50a('0x85')](_0x26a041[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}var _0x6fca59=_0xd50a('0x132');var _0x45e018=util['format'](_0xd50a('0x133'),FILES_PATH,rs[_0xd50a('0x11a')](0x4));var _0x5f549b=util[_0xd50a('0x29')](_0xd50a('0x9c'),_0x45e018,_0x6fca59);var _0x4194d7=!![];if(_0x26a041[_0xd50a('0x134')]===_0xd50a('0x135')){_0x4194d7=![];}var _0x277702=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x45e018,_0x6fca59,_0x26a041['intKey'],_0x26a041['timeout'],undefined,_0x4194d7);if(_0x277702[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x137'),_0x5f549b));var _0x33ffe6=this[_0xd50a('0x8d')][_0xd50a('0xa4')](this,_0x26a041,_0x5f549b);if(_0x33ffe6){for(var _0x5c558b in _0x33ffe6){if(_0x33ffe6[_0xd50a('0x93')](_0x5c558b)){this['channel'][_0xd50a('0x9d')](util[_0xd50a('0x29')]('GOOGLE_ASR_%s',_0x5c558b[_0xd50a('0xec')]()),_0x33ffe6[_0x5c558b]);}}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x138'),JSON[_0xd50a('0x73')](_0x33ffe6)));}}return _0x277702;};AGIVertices['prototype'][_0xd50a('0x139')]=function(_0xdcaad0){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x13a'),_0xdcaad0[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0xdcaad0[_0xd50a('0x90')])){return this['channel'][_0xd50a('0xa8')]('no\x20appid\x20configured');}if(!this[_0xd50a('0x85')](_0xdcaad0[_0xd50a('0x13b')])){return this['channel'][_0xd50a('0xa8')]('no\x20appsecret\x20configured');}var _0x46c5f3=_0xd50a('0x132');var _0x1827bc=util[_0xd50a('0x29')](_0xd50a('0x133'),FILES_PATH,rs['generate'](0x4));var _0x8806e8=util['format'](_0xd50a('0x9c'),_0x1827bc,_0x46c5f3);var _0x57be8c=!![];if(_0xdcaad0[_0xd50a('0x134')]===_0xd50a('0x135')){_0x57be8c=![];}var _0xc7f232=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x1827bc,_0x46c5f3,_0xdcaad0['intKey'],_0xdcaad0[_0xd50a('0x65')],undefined,_0x57be8c);if(_0xc7f232[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x13c'),_0x8806e8));var _0x47a2e5=this[_0xd50a('0x8f')]['sync'](this,_0xdcaad0,_0x8806e8);if(_0x47a2e5){for(var _0x19866a in _0x47a2e5){if(_0x47a2e5[_0xd50a('0x93')](_0x19866a)){this[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x13d'),_0x19866a[_0xd50a('0xec')]()),_0x47a2e5[_0x19866a]);}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x47a2e5)));}}return _0xc7f232;};AGIVertices[_0xd50a('0x18')][_0xd50a('0x13e')]=function(_0x4c2394){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x13f'),_0x4c2394[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x140')](_0x4c2394[_0xd50a('0x3f')],_0x4c2394[_0xd50a('0x40')],_0x4c2394[_0xd50a('0x41')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x141')]=function(_0x10af47){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x10af47['label']));if(!this[_0xd50a('0x85')](_0x10af47['condition'])){return this['channel'][_0xd50a('0x2c')](_0x10af47,_0xd50a('0x142'));}try{var _0x211e20=eval(_0x10af47[_0xd50a('0x143')])?'true':_0xd50a('0x144');this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x145'),_0x10af47[_0xd50a('0x143')],_0x211e20));return{'code':0xc8,'result':_0x211e20};}catch(_0xb57330){return{'code':0xc8,'result':_0xd50a('0x144')};}};AGIVertices['prototype'][_0xd50a('0x146')]=function(_0x590c51){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x590c51['label']));if(!this['isConfigured'](_0x590c51[_0xd50a('0x147')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x590c51,'no\x20interval\x20configured');}var _0x16b136=this[_0xd50a('0x26')][_0xd50a('0xa4')](this,_0x590c51[_0xd50a('0x147')]);if(!_0x16b136){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x590c51,_0xd50a('0x148'));}for(var _0x4e7428=0x0;_0x4e7428<_0x16b136['length'];_0x4e7428+=0x1){var _0xf5fdbe=this[_0xd50a('0xe')][_0xd50a('0x11')](util[_0xd50a('0x29')](_0xd50a('0x149'),_0x16b136[_0x4e7428]));if(_0xf5fdbe[_0xd50a('0xac')]===-0x1){return _0xf5fdbe;}logger['info'](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xf5fdbe[_0xd50a('0xa0')]));if(_0xf5fdbe['extra']==='true'){logger[_0xd50a('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x16b136[_0x4e7428],'true'));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xd50a('0x144')));this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x14a'),_0x16b136[_0x4e7428],_0xd50a('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd50a('0x18')][_0xd50a('0x14b')]=function(_0x85cb5f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x14c'),_0x85cb5f['label']));return this[_0xd50a('0xe')]['hangup']();};AGIVertices['prototype'][_0xd50a('0x14d')]=function(_0x2309b5){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2309b5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2309b5['key'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}var _0x54b6f0=_0xd50a('0x132');var _0x8cd501=util['format'](_0xd50a('0x133'),FILES_PATH,rs[_0xd50a('0x11a')](0x4));var _0x4bef1d=util['format'](_0xd50a('0x9c'),_0x8cd501,_0x54b6f0);var _0x50b506=!![];if(_0x2309b5[_0xd50a('0x134')]===_0xd50a('0x135')){_0x50b506=![];}var _0x4e69ee=this[_0xd50a('0xe')][_0xd50a('0x136')](_0x8cd501,_0x54b6f0,_0x2309b5['intKey'],_0x2309b5['timeout'],undefined,_0x50b506);if(_0x4e69ee[_0xd50a('0xac')]!==-0x1){this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x14e'),_0x4bef1d));var _0x3fdef5=this['ispeechASR'][_0xd50a('0xa4')](this,_0x2309b5,_0x4bef1d);if(_0x3fdef5){for(var _0x4a22d3 in _0x3fdef5){if(_0x3fdef5['hasOwnProperty'](_0x4a22d3)){this[_0xd50a('0xe')]['setVariable'](util[_0xd50a('0x29')](_0xd50a('0x14f'),_0x4a22d3[_0xd50a('0xec')]()),_0x3fdef5[_0x4a22d3]);}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x150'),JSON[_0xd50a('0x73')](_0x3fdef5)));}}return _0x4e69ee;};AGIVertices[_0xd50a('0x18')]['ispeechtts']=function(_0x5e6382){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x151'),_0x5e6382['label']));if(!this['isConfigured'](_0x5e6382[_0xd50a('0x7a')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xeb'));}if(!this['isConfigured'](_0x5e6382[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x152'),_0x5e6382[_0xd50a('0x5d')]));var _0x1d3a74=this['ispeechTTS']['sync'](this,_0x5e6382);if(_0x1d3a74){this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x14e'),_0x1d3a74));var _0x7a6dc8=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x1d3a74,_0x5e6382[_0xd50a('0x153')]);try{fs[_0xd50a('0x105')](_0x1d3a74+_0xd50a('0x106'));}catch(_0x1936b0){logger[_0xd50a('0x2c')](_0x1936b0);}return _0x7a6dc8;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x5e6382,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd50a('0x18')][_0xd50a('0x154')]=function(_0x526a94){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x155'),_0x526a94[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x526a94[_0xd50a('0x156')])){return this[_0xd50a('0xe')]['error'](_0x526a94,_0xd50a('0x157'));}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x526a94['findBy']));var _0x1c6747=this[_0xd50a('0x54')][_0xd50a('0xa4')](this,_0x526a94[_0xd50a('0x156')]);if(_0x1c6747){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd50a('0xe')]['callerid'],_0x526a94[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this['channel'][_0xd50a('0x3d')],_0x526a94[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x526a94[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format'](_0xd50a('0x15a'),this['channel']['callerid'],_0x526a94[_0xd50a('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd50a('0x18')]['logout']=function(_0x4d0912){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15b'),_0x4d0912[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x4d0912['findBy'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x4d0912,'no\x20find\x20by\x20configured');}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this['channel']['callerid'],_0x4d0912[_0xd50a('0x156')]));var _0x46f31f=this['agentLogout'][_0xd50a('0xa4')](this,_0x4d0912[_0xd50a('0x156')]);if(_0x46f31f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd50a('0x3d')],_0x4d0912[_0xd50a('0x156')]));this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0x15a'),this[_0xd50a('0xe')]['callerid'],_0x4d0912[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices[_0xd50a('0x18')]['math']=function(_0x57d4a8){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15d'),_0x57d4a8[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x57d4a8[_0xd50a('0x15e')])){return this[_0xd50a('0xe')]['error'](_0x57d4a8,_0xd50a('0x15f'));}this['channel']['noop'](util['format']('math\x20%s',_0x57d4a8[_0xd50a('0x15e')]));var _0x3ba381=eval(_0x57d4a8['operation']);if(!this[_0xd50a('0x85')](_0x57d4a8[_0xd50a('0xda')])){return this['channel']['noop'](_0xd50a('0xd9'));}var _0x226150=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x57d4a8[_0xd50a('0xda')]);if(!_0x226150){return this['channel'][_0xd50a('0x2c')](_0x57d4a8,_0xd50a('0xdb'));}if(_[_0xd50a('0x99')](_0x3ba381)){var _0x9935b=this;_0x3ba381[_0xd50a('0xdc')](function(_0x529cd9,_0x392373){_0x9935b[_0xd50a('0xe')][_0xd50a('0x9d')](util[_0xd50a('0x29')](_0xd50a('0x160'),_0x226150,_0x392373),_0x529cd9);});return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x161'),_0x226150));}else{return this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x226150,_0x3ba381);}};AGIVertices[_0xd50a('0x18')]['menu']=function(_0x3b81fb){logger['info'](util['format'](_0xd50a('0x162'),_0x3b81fb[_0xd50a('0x39')]));if(_0x3b81fb[_0xd50a('0xa5')]===0x0){return this[_0xd50a('0xa3')](_0x3b81fb);}_0x3b81fb[_0xd50a('0xa5')]-=0x1;if(!this[_0xd50a('0x85')](_0x3b81fb[_0xd50a('0x111')])){return this['channel']['error'](_0x3b81fb,_0xd50a('0x112'));}var _0x4aa54e=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x3b81fb[_0xd50a('0x111')]);if(!_0x4aa54e){return this[_0xd50a('0xe')]['error'](_0x3b81fb,'no\x20file\x20audio\x20found');}var _0x12b5ed=this[_0xd50a('0xe')][_0xd50a('0x114')](_0x4aa54e,_0x3b81fb[_0xd50a('0x115')],_0x3b81fb[_0xd50a('0x163')]);var _0x5e7fd5=_0x12b5ed[_0xd50a('0xac')];if(_0x12b5ed['result']===-0x1){this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x3b81fb,'-1');return _0x12b5ed;}else if(_0x12b5ed['extra']===_0xd50a('0x65')){_0x12b5ed[_0xd50a('0xac')]=_0x12b5ed[_0xd50a('0xac')][_0xd50a('0x9b')]>0x0?_0x12b5ed[_0xd50a('0xac')]:'t';}else if(_[_0xd50a('0x46')](_0x12b5ed[_0xd50a('0xac')])){_0x12b5ed[_0xd50a('0xac')]='#';_0x5e7fd5='#';}if(!this[_0xd50a('0x85')](_0x3b81fb[_0xd50a('0xda')])){this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x25a630=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x3b81fb[_0xd50a('0xda')]);if(!_0x25a630){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x3b81fb,_0xd50a('0xdb'));}this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x25a630,_0x5e7fd5);}this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3b81fb,_0x5e7fd5);return _0x12b5ed;};AGIVertices[_0xd50a('0x18')]['noop']=function(_0x12d731){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x164'),_0x12d731[_0xd50a('0x39')]));return this[_0xd50a('0xe')]['noop'](_0x12d731[_0xd50a('0x165')]||_0x12d731[_0xd50a('0x39')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x166')]=function(_0x24640b){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x167'),_0x24640b[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x24640b[_0xd50a('0x156')])){return this['channel'][_0xd50a('0x2c')](_0x24640b,_0xd50a('0x157'));}logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x158'),this['channel']['callerid'],_0x24640b[_0xd50a('0x156')]));var _0x839a32=this[_0xd50a('0x4e')][_0xd50a('0xa4')](this,_0x24640b[_0xd50a('0x168')]);var _0x8a96de=this['agentPause'][_0xd50a('0xa4')](this,_0x24640b[_0xd50a('0x156')],_0x839a32);if(_0x8a96de){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b['findBy']));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x169')};}else{logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x24640b[_0xd50a('0x156')]));this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x24640b[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices['prototype'][_0xd50a('0x16a')]=function(_0x4549ad){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x16b'),_0x4549ad['label']));if(!this[_0xd50a('0x85')](_0x4549ad['file_id'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x4549ad,_0xd50a('0x112'));}var _0x928cef=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x4549ad[_0xd50a('0x111')]);if(!_0x928cef){return this['channel'][_0xd50a('0x2c')](_0x4549ad,_0xd50a('0x113'));}var _0x4fbc9b=this['channel']['exec'](_0xd50a('0x16c'),[_0x928cef,_0x4549ad[_0xd50a('0xe7')]]);if(_0x4fbc9b[_0xd50a('0xac')]===-0x1){return _0x4fbc9b;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20%s\x20%s',_0xd50a('0x16c'),_0x928cef));};AGIVertices[_0xd50a('0x18')]['queue']=function(_0x2f99c5){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x16d'),_0x2f99c5[_0xd50a('0x39')]));if(!this['isConfigured'](_0x2f99c5['queue_id'])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x2f99c5,_0xd50a('0x16e'));}var _0x53b77c='';var _0x15ec99=parseInt(_0x2f99c5[_0xd50a('0x16f')],0xa);if(isNaN(_0x15ec99)){_0x53b77c=_0x2f99c5[_0xd50a('0x16f')];}else{_0x53b77c=this[_0xd50a('0x14')][_0xd50a('0xa4')](this,_0x2f99c5[_0xd50a('0x16f')]);if(!_0x53b77c){return this[_0xd50a('0xe')]['error'](_0x2f99c5,_0xd50a('0x170'));}}var _0x426a25='';if(this['isConfigured'](_0x2f99c5[_0xd50a('0x111')])){var _0x329288=this[_0xd50a('0x1f')][_0xd50a('0xa4')](this,_0x2f99c5['file_id']);if(_0x329288){_0x426a25=_0x329288;}}this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x2f99c5,_0x53b77c);if(_0x2f99c5[_0xd50a('0xe7')]['indexOf']('x')<0x0){_0x2f99c5[_0xd50a('0xe7')]+='x';}if(_0x2f99c5['opts']['indexOf']('X')<0x0){_0x2f99c5['opts']+='X';}this['channel'][_0xd50a('0x9d')](_0xd50a('0x171'),_0x53b77c?_0x53b77c[_0xd50a('0x172')]():'');var _0x4d9107=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0x173'),[_0x53b77c,_0x2f99c5[_0xd50a('0xe7')],_0x2f99c5['url'],_0x426a25,_0x2f99c5[_0xd50a('0x65')],_0x2f99c5[_0xd50a('0xb4')],_0x2f99c5[_0xd50a('0x174')],_0x2f99c5[_0xd50a('0x175')],'',_0x2f99c5[_0xd50a('0x176')]]);if(_0x4d9107['result']===-0x1){return _0x4d9107;}return this[_0xd50a('0xe')]['noop'](util[_0xd50a('0x29')](_0xd50a('0xc2'),_0xd50a('0x173'),_0x53b77c));};AGIVertices[_0xd50a('0x18')]['record']=function(_0x12d7a0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x177'),_0x12d7a0[_0xd50a('0x39')]));var _0x5616a2=_0x12d7a0[_0xd50a('0x178')]||_0xd50a('0x132');var _0x52f7f5=util[_0xd50a('0x29')]('%s_%s',this[_0xd50a('0xe')][_0xd50a('0x38')],rs[_0xd50a('0x11a')](0x5));var _0x2d541b=util[_0xd50a('0x29')](_0xd50a('0x179'),FILES_PATH,_0x52f7f5,_0x5616a2);var _0x4481f5=util[_0xd50a('0x29')]('%s/recordings/%s',FILES_PATH,_0x52f7f5);this[_0xd50a('0x3c')]['sync'](this,_0x12d7a0,_0x52f7f5,_0x2d541b);this['channel'][_0xd50a('0x9d')](_0xd50a('0x17a'),_0x52f7f5);logger[_0xd50a('0x2e')](_0xd50a('0x17b'),_0x4481f5,_0x5616a2,_0x12d7a0[_0xd50a('0x17c')],_0x12d7a0[_0xd50a('0x65')]);return this[_0xd50a('0xe')][_0xd50a('0x136')](_0x4481f5,_0x5616a2,_0x12d7a0[_0xd50a('0x17c')],_0x12d7a0[_0xd50a('0x65')],undefined,!![]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x17d')]=function(_0x2fd116){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x17e'),_0x2fd116[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x2fd116['url'])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x17f'));}var _0x4187fb=this['restAPI']['sync'](this,_0x2fd116);logger['info'](util[_0xd50a('0x29')](_0xd50a('0x180'),util[_0xd50a('0x181')](_0x4187fb,{'showHidden':![],'depth':null})));if(!this[_0xd50a('0x85')](_0x2fd116[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x182'));}var _0x257c32=this['getVariable']['sync'](this,_0x2fd116['variable_id']);if(!_0x257c32){return this[_0xd50a('0xe')]['error'](_0x2fd116,_0xd50a('0xdb'));}this[_0xd50a('0xe')]['setVariable'](util[_0xd50a('0x29')](_0xd50a('0x183'),_0x257c32),_0x4187fb['statusCode']?_0x4187fb[_0xd50a('0x75')]:_0xd50a('0x184'));this[_0xd50a('0xe')][_0xd50a('0x9d')](util['format'](_0xd50a('0x185'),_0x257c32),_0x4187fb[_0xd50a('0x76')]?_0x4187fb[_0xd50a('0x76')]:'OK');if(_0x4187fb[_0xd50a('0x6a')]){try{this[_0xd50a('0x9a')](_0x4187fb[_0xd50a('0x6a')],_0x257c32);}catch(_0x168174){logger[_0xd50a('0x2c')](util[_0xd50a('0x29')](_0xd50a('0x186'),_0x257c32));}}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0xde'),_0x257c32));};AGIVertices[_0xd50a('0x18')]['saydigits']=function(_0x5535d0){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x187'),_0x5535d0[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x188')](_0x5535d0[_0xd50a('0x189')][_0xd50a('0x59')](/\s+/g,''),_0x5535d0[_0xd50a('0x17c')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x18a')]=function(_0x498110){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x498110[_0xd50a('0x39')]));return this['channel'][_0xd50a('0x18b')](_0x498110[_0xd50a('0x66')][_0xd50a('0x59')](/\s+/g,''),_0x498110[_0xd50a('0x17c')]);};AGIVertices['prototype'][_0xd50a('0x18c')]=function(_0x2d1d6b){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x18d'),_0x2d1d6b[_0xd50a('0x39')]));return this[_0xd50a('0xe')][_0xd50a('0x18e')](_0x2d1d6b[_0xd50a('0x5d')],_0x2d1d6b[_0xd50a('0x17c')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x18f')]=function(_0x2a3b48){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x190'),_0x2a3b48['label']));if(!this[_0xd50a('0x85')](_0x2a3b48[_0xd50a('0x191')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x192'));}var _0x520827=this[_0xd50a('0x23')]['sync'](this,_0x2a3b48['account_id']);if(!_0x520827||!_0x520827[_0xd50a('0x193')]){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x2a3b48,_0xd50a('0x194'));}var _0x35fb94={'from':util[_0xd50a('0x29')](_0xd50a('0x195'),_0x520827['name'],_0x520827[_0xd50a('0x196')]||_0x520827[_0xd50a('0x193')][_0xd50a('0x197')]),'to':_0x2a3b48['to']||'','cc':_0x2a3b48['cc']||'','bcc':_0x2a3b48[_0xd50a('0x198')]||'','subject':_0x2a3b48[_0xd50a('0x199')],'html':_0x2a3b48[_0xd50a('0x5d')],'text':_0x2a3b48[_0xd50a('0x5d')]};var _0x7d1ab7={'tls':{'rejectUnauthorized':![]}};if(_0x520827['Smtp']['service']){_0x7d1ab7[_0xd50a('0x19a')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19a')];}else{_0x7d1ab7[_0xd50a('0x19b')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19b')];_0x7d1ab7[_0xd50a('0x19c')]=_0x520827[_0xd50a('0x193')]['port'];_0x7d1ab7[_0xd50a('0x19d')]=_0x520827[_0xd50a('0x193')][_0xd50a('0x19d')];}if(_0x520827[_0xd50a('0x193')][_0xd50a('0x19e')]){_0x7d1ab7[_0xd50a('0x19f')]={'user':_0x520827[_0xd50a('0x193')]['user'],'pass':_0x520827[_0xd50a('0x193')][_0xd50a('0x1a0')]};}if(this[_0xd50a('0x85')](_0x2a3b48[_0xd50a('0x1a1')])){}logger[_0xd50a('0xe0')](_0xd50a('0x1a2'),JSON[_0xd50a('0x73')](_0x35fb94));this[_0xd50a('0x37')]['sync'](this,_0x2a3b48,_0x2a3b48['account_id']);this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1a3'),_0x520827[_0xd50a('0x15')]));this['sendMailMessage']['sync'](this,_0x7d1ab7,_0x35fb94);return this[_0xd50a('0xe')]['noop'](_0xd50a('0x1a4'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1a5')]=function(_0x441866){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1a6'),_0x441866['label']));return this[_0xd50a('0xe')]['noop'](_0xd50a('0x1a7'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1a8')]=function(_0x3af29d){logger[_0xd50a('0x2e')](util['format'](_0xd50a('0x1a9'),_0x3af29d[_0xd50a('0x39')]));if(!this['isConfigured'](_0x3af29d['sms_account_id'])){return this['channel'][_0xd50a('0xa8')](_0xd50a('0x1aa'));}var _0x3a8cd3=this[_0xd50a('0x34')][_0xd50a('0xa4')](this,_0x3af29d[_0xd50a('0x1ab')]);if(!_0x3a8cd3){return this['channel'][_0xd50a('0x2c')](_0x3af29d,_0xd50a('0x1ac'));}var _0xcf35d={'body':_0x3af29d['sms_text'],'phone':_0x3af29d['to']||'','SmsAccountId':_0x3a8cd3['id']};logger[_0xd50a('0xe0')](_0xd50a('0x1ad'),JSON[_0xd50a('0x73')](_0xcf35d));this['createSquareDetailsReport'][_0xd50a('0xa4')](this,_0x3af29d,_0x3af29d[_0xd50a('0x1ab')]);this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1ae'),_0x3a8cd3['name']));this['createSmsMessage'][_0xd50a('0xa4')](this,_0xcf35d);return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x1af'));};AGIVertices[_0xd50a('0x18')]['set']=function(_0x142913){logger['info'](util['format'](_0xd50a('0x1b0'),_0x142913[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x142913[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x142913,'no\x20variable\x20selected');}var _0x3dd784=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x142913['variable_id']);if(!_0x3dd784){return this[_0xd50a('0xe')]['error'](_0x142913,_0xd50a('0xdb'));}return this[_0xd50a('0xe')][_0xd50a('0x9d')](_0x3dd784,_0x142913[_0xd50a('0x1b1')]);};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1b2')]=function(_0x2d5bf7){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1b3'),_0x2d5bf7[_0xd50a('0x39')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0x1b4'));if(_0x2d5bf7['answer']===_0xd50a('0x1b5')){this['channel']['noop']('Answer');return this[_0xd50a('0xe')][_0xd50a('0xb9')]();}return this[_0xd50a('0xe')][_0xd50a('0xa8')]('Skipped\x20Answer');};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1b6')]=function(_0x191917){logger['info'](util['format'](_0xd50a('0x1b7'),_0x191917['label']));if(!this['isConfigured'](_0x191917[_0xd50a('0x1b8')])){return this['channel']['error'](_0x191917,_0xd50a('0x1b9'));}var _0x55d0d8=this['getSquareProject'][_0xd50a('0xa4')](this,_0x191917[_0xd50a('0x1b8')]);if(!this[_0xd50a('0x85')](_0x55d0d8)){return this['channel'][_0xd50a('0x2c')](_0x191917,util[_0xd50a('0x29')](_0xd50a('0x1ba'),_0x191917['project_id']));}if(_0x55d0d8===this[_0xd50a('0xe')][_0xd50a('0x3b')]){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x191917,_0xd50a('0x1bb'));}this[_0xd50a('0x37')][_0xd50a('0xa4')](this,_0x191917,_0x55d0d8);var _0x4785e3=this['channel'][_0xd50a('0x57')](_0xd50a('0x1bc'),util['format'](_0xd50a('0x1bd'),config['agi'][_0xd50a('0x19b')]||'127.0.0.1',_0x55d0d8,this[_0xd50a('0xe')]['arg_1']));if(_0x4785e3[_0xd50a('0xac')]===-0x1){return _0x4785e3;}return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Executed\x20command\x20%s\x20%s',_0xd50a('0x1bc'),_0x55d0d8));};AGIVertices['prototype']['system']=function(_0x2bb7fb){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1be'),_0x2bb7fb[_0xd50a('0x39')]));var _0x52ecf1=this[_0xd50a('0x56')][_0xd50a('0xa4')](this,_0x2bb7fb[_0xd50a('0xb5')]);this[_0xd50a('0x37')]['sync'](this,_0x2bb7fb,_0x2bb7fb[_0xd50a('0xb5')]);if(this[_0xd50a('0x85')](_0x2bb7fb[_0xd50a('0xda')])){var _0x5075c4=this[_0xd50a('0x11')][_0xd50a('0xa4')](this,_0x2bb7fb[_0xd50a('0xda')]);if(_0x5075c4){this[_0xd50a('0xe')]['setVariable'](_0x5075c4,_0x52ecf1);return this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2bb7fb[_0xd50a('0xb5')],_0x5075c4));}}return this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1bf'),_0x2bb7fb['command']));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c0')]=function(_0x107d1f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1c1'),_0x107d1f[_0xd50a('0x39')]));_0x107d1f['text']=_0x107d1f[_0xd50a('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x107d1f[_0xd50a('0x5b')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')]('no\x20apiKey\x20configured');}if(!this[_0xd50a('0x85')](_0x107d1f[_0xd50a('0x5d')])){return this[_0xd50a('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0x1c2'),_0x107d1f['text']));var _0x23c341=this['googleCloudTTS'][_0xd50a('0xa4')](this,_0x107d1f);if(_0x23c341){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x23c341));var _0x42a6a8=this[_0xd50a('0xe')][_0xd50a('0x104')](_0x23c341);try{fs[_0xd50a('0x105')](_0x23c341+_0xd50a('0x106'));}catch(_0x2e72f4){logger[_0xd50a('0x2c')](_0x2e72f4);}return _0x42a6a8;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x107d1f,_0xd50a('0x1c3'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c4')]=function(_0x46d807){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x1c5'),_0x46d807['label']));_0x46d807[_0xd50a('0x5d')]=_0x46d807[_0xd50a('0x5d')][_0xd50a('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd50a('0x85')](_0x46d807[_0xd50a('0x5d')])){return this[_0xd50a('0xe')][_0xd50a('0xa8')](_0xd50a('0xa9'));}this['channel'][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x1c6'),_0x46d807[_0xd50a('0x5d')]));var _0x13fb81=this['googleTTS']['sync'](this,_0x46d807);if(_0x13fb81){this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x13fb81));var _0xcc45f6=this[_0xd50a('0xe')]['streamFile'](_0x13fb81);try{}catch(_0x227ed8){logger['error'](_0x227ed8);}return _0xcc45f6;}return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x46d807,_0xd50a('0x1c7'));};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1c8')]=function(_0x5d4929){logger['info'](util[_0xd50a('0x29')](_0xd50a('0x1c9'),_0x5d4929[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x5d4929[_0xd50a('0x156')])){return this[_0xd50a('0xe')]['error'](_0x5d4929,'no\x20find\x20by\x20configured');}logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x158'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));var _0x383d7e=this[_0xd50a('0x52')]['sync'](this,_0x5d4929[_0xd50a('0x156')]);if(_0x383d7e){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x5d4929['findBy']));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')](_0xd50a('0x159'),this[_0xd50a('0xe')]['callerid'],_0x5d4929[_0xd50a('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x15a'),this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));this[_0xd50a('0xe')][_0xd50a('0xa8')](util[_0xd50a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd50a('0xe')][_0xd50a('0x3d')],_0x5d4929[_0xd50a('0x156')]));return{'code':0xc8,'result':_0xd50a('0x15c')};}};AGIVertices[_0xd50a('0x18')][_0xd50a('0x1ca')]=function(_0x25584f){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x25584f['label']));var _0x157d01=this[_0xd50a('0xe')][_0xd50a('0x57')](_0xd50a('0x1cb'),[_0x25584f[_0xd50a('0x1cc')],_0x25584f[_0xd50a('0xaa')]]);if(_0x157d01[_0xd50a('0xac')]===-0x1){return _0x157d01;}return this['channel'][_0xd50a('0xa8')](util['format'](_0xd50a('0xc2'),_0xd50a('0x1cb'),_0x25584f[_0xd50a('0x1cc')]));};AGIVertices[_0xd50a('0x18')]['vswitch']=function(_0x43002a){logger[_0xd50a('0x2e')](util[_0xd50a('0x29')](_0xd50a('0x1cd'),_0x43002a[_0xd50a('0x39')]));if(!this[_0xd50a('0x85')](_0x43002a[_0xd50a('0xda')])){return this[_0xd50a('0xe')][_0xd50a('0x2c')](_0x43002a,_0xd50a('0x1ce'));}var _0x37ad58=this[_0xd50a('0x11')]['sync'](this,_0x43002a[_0xd50a('0xda')]);if(!_0x37ad58){return this['channel'][_0xd50a('0x2c')](_0x43002a,_0xd50a('0xdb'));}var _0x2fc51a=this[_0xd50a('0xe')]['getVariable'](_0x37ad58);return{'code':0xc8,'result':_0x2fc51a[_0xd50a('0xa0')]?_0x2fc51a[_0xd50a('0xa0')]:'-'};};String[_0xd50a('0x18')][_0xd50a('0x9f')]=function(_0x5bb11a,_0x17ab4d){return this[_0xd50a('0x9e')](_0x5bb11a)['join'](_0x17ab4d);};module[_0xd50a('0x1cf')]=AGIVertices; \ No newline at end of file +var _0xf94f=['getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','getQueryOdbc','error','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','timeout','includes','POST','PUT','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','recursiveNodeIndex','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','isEmpty','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','pass','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','getVariableById','then','name','catch','rpc','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath'];(function(_0x183800,_0x2f969c){var _0x4b603a=function(_0xa885e4){while(--_0xa885e4){_0x183800['push'](_0x183800['shift']());}};_0x4b603a(++_0x2f969c);}(_0xf94f,0x1b1));var _0xff94=function(_0x5ed5de,_0x1ca24f){_0x5ed5de=_0x5ed5de-0x0;var _0x4eef7a=_0xf94f[_0x5ed5de];return _0x4eef7a;};'use strict';var fs=require('fs');var path=require(_0xff94('0x0'));var util=require(_0xff94('0x1'));var _=require(_0xff94('0x2'));var sh=require('shelljs');var odbc=require(_0xff94('0x3'))();var rs=require(_0xff94('0x4'));var moment=require(_0xff94('0x5'));var Mustache=require(_0xff94('0x6'));var rp=require(_0xff94('0x7'));var logger=require(_0xff94('0x8'))(_0xff94('0x9'));var config=require(_0xff94('0xa'));var scripts=require(_0xff94('0xb'));var FILES_PATH=_0xff94('0xc');var recursiveMapAttributes=[_0xff94('0xd'),'rawBody'];var verticesWithRetry=[_0xff94('0xe'),_0xff94('0xf'),_0xff94('0x10')];var AGIVertices=function(_0x1e75ed,_0x4b3ab0,_0x361f38){this[_0xff94('0x11')]=_0x1e75ed;this['rpc']=_0x4b3ab0;this[_0xff94('0x12')]=_0x361f38;};AGIVertices[_0xff94('0x13')][_0xff94('0x14')]=function(_0x196fcd,_0x1387f0){this['rpc'][_0xff94('0x15')](_0x196fcd)[_0xff94('0x16')](function(_0x1a5fef){_0x1387f0(null,_0x1a5fef?_0x1a5fef[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x18be57){_0x1387f0(_0x18be57);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x2e75b8,_0x20a4f2){this[_0xff94('0x19')][_0xff94('0x1a')](_0x2e75b8)[_0xff94('0x16')](function(_0x5dc2e5){_0x20a4f2(null,_0x5dc2e5?_0x5dc2e5[_0xff94('0x17')]:![]);})['catch'](function(_0x344e5f){_0x20a4f2(_0x344e5f);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1b')]=function(_0x40f484,_0x177304){this['rpc']['getSquareProjectById'](_0x40f484)[_0xff94('0x16')](function(_0x4c9778){_0x177304(null,_0x4c9778?_0x4c9778[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x572929){_0x177304(_0x572929);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1c')]=function(_0x4d13ca,_0xb2ae59){this['rpc'][_0xff94('0x1d')](_0x4d13ca)[_0xff94('0x16')](function(_0xa7f9ff){_0xb2ae59(null,_0xa7f9ff?_0xa7f9ff[_0xff94('0x1e')]:![]);})['catch'](function(_0x2961a5){_0xb2ae59(_0x2961a5);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1f')]=function(_0x4c61e1,_0x564863){this[_0xff94('0x19')][_0xff94('0x20')](_0x4c61e1)[_0xff94('0x16')](function(_0x5b4f79){_0x564863(null,_0x5b4f79?_0x5b4f79[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x10f338){_0x564863(_0x10f338);});};AGIVertices[_0xff94('0x13')]['getTrunk']=function(_0x36fa11,_0x5e3513){this[_0xff94('0x19')][_0xff94('0x21')](_0x36fa11)['then'](function(_0x15f87f){_0x5e3513(null,_0x15f87f?_0x15f87f[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x14f399){_0x5e3513(_0x14f399);});};AGIVertices[_0xff94('0x13')][_0xff94('0x22')]=function(_0x32d90f,_0x20b119){var _0x1c81b4=this;this[_0xff94('0x19')][_0xff94('0x23')](_0x32d90f)[_0xff94('0x16')](function(_0x34450c){_0x20b119(null,_0x34450c?_0x1c81b4[_0xff94('0x24')](_0x34450c['save_name']):![]);})[_0xff94('0x18')](function(_0x20ef28){_0x20b119(_0x20ef28);});};AGIVertices[_0xff94('0x13')][_0xff94('0x25')]=function(_0x2c264f,_0x18e34f){this['rpc'][_0xff94('0x26')](_0x2c264f)[_0xff94('0x16')](function(_0x155add){_0x18e34f(null,_0x155add?_0x155add:![]);})['catch'](function(_0x4ed45b){_0x18e34f(_0x4ed45b);});};AGIVertices[_0xff94('0x13')][_0xff94('0x27')]=function(_0x567f76,_0x5bde29,_0x154722){this['mailRpc']['sendMailMessage'](_0x567f76,_0x5bde29)[_0xff94('0x16')](function(){_0x154722(null);})[_0xff94('0x18')](function(_0x182594){_0x154722(_0x182594);});};AGIVertices['prototype'][_0xff94('0x28')]=function(_0xbd15fd,_0x535f88){this['rpc'][_0xff94('0x29')](_0xbd15fd)['then'](function(_0x66291e){if(_0x66291e){if(_0x66291e[_0xff94('0x2a')]){_0x535f88(null,[_0x66291e[_0xff94('0x2b')]]);}else{_0x535f88(null,_['map'](_0x66291e[_0xff94('0x2c')],_0xff94('0x2b')));}}else{_0x535f88(null,![]);}})[_0xff94('0x18')](function(_0xf34ad5){_0x535f88(_0xf34ad5);});};AGIVertices[_0xff94('0x13')][_0xff94('0x24')]=function(_0x5ca93a){return util[_0xff94('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x5ca93a);};AGIVertices[_0xff94('0x13')][_0xff94('0x2e')]=function(_0x5330de,_0x4afb8c,_0x432d60){odbc['open'](_0x5330de,function(_0x526655){if(_0x526655){logger[_0xff94('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x526655);_0x432d60(_0x526655);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xff94('0x30')](_0x4afb8c,function(_0x1b6328,_0x16e1b2){if(_0x1b6328){logger[_0xff94('0x31')](_0xff94('0x32'),_0x4afb8c);_0x432d60(_0x1b6328);}else{logger['info'](_0xff94('0x33'),_0x4afb8c);odbc[_0xff94('0x34')](function(_0x9aa893){if(_0x9aa893){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x9aa893);}_0x432d60(null,_0x16e1b2);});}});}});};AGIVertices[_0xff94('0x13')]['getSmsAccount']=function(_0x13365c,_0x6bcca8){this[_0xff94('0x19')][_0xff94('0x35')](_0x13365c)[_0xff94('0x16')](function(_0x182708){_0x6bcca8(null,_0x182708?_0x182708:![]);})[_0xff94('0x18')](function(_0x51fc31){_0x6bcca8(_0x51fc31);});};AGIVertices[_0xff94('0x13')]['createSmsMessage']=function(_0xcbab23,_0x5cce3f){this[_0xff94('0x19')]['createSmsMessage'](_0xcbab23)[_0xff94('0x16')](function(_0x29e63d){_0x5cce3f(null,_0x29e63d);})['catch'](function(_0x547b92){_0x5cce3f(_0x547b92);});};AGIVertices[_0xff94('0x13')][_0xff94('0x36')]=function(_0x11c39e,_0x2a5eae,_0x19340f){this['rpc'][_0xff94('0x36')]({'uniqueid':this[_0xff94('0x11')][_0xff94('0x37')],'node':_0x11c39e[_0xff94('0x38')],'application':_0x11c39e[_0xff94('0x39')],'data':_0x2a5eae||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xff94('0x11')][_0xff94('0x3a')]})[_0xff94('0x16')](function(_0x4a628e){if(_0x19340f){_0x19340f(null,_0x4a628e);}})['catch'](function(_0x4320b6){if(_0x19340f){_0x19340f(_0x4320b6);}});};AGIVertices[_0xff94('0x13')][_0xff94('0x3b')]=function(_0x142d4c,_0x2d0a0a,_0x4859d0,_0x4d57a2){this[_0xff94('0x19')][_0xff94('0x3b')]({'uniqueid':this[_0xff94('0x11')]['uniqueid'],'callerid':this['channel'][_0xff94('0x3a')],'calleridname':this['channel']['calleridname'],'context':this[_0xff94('0x11')]['context'],'extension':this['channel'][_0xff94('0x3c')],'priority':this[_0xff94('0x11')][_0xff94('0x3d')],'accountcode':this[_0xff94('0x11')][_0xff94('0x3e')],'dnid':this[_0xff94('0x11')][_0xff94('0x3f')],'projectName':this[_0xff94('0x11')]['arg_1'],'saveName':_0x2d0a0a,'filename':_0x142d4c[_0xff94('0x40')]||_0x2d0a0a,'savePath':_0x4859d0})[_0xff94('0x16')](function(_0x270893){_0x4d57a2(null,_0x270893);})[_0xff94('0x18')](function(_0x2fb5a2){_0x4d57a2(_0x2fb5a2);});};AGIVertices[_0xff94('0x13')]['createSquareMessage']=function(_0x48c26a,_0x1ca9a0,_0x438a89,_0x183810,_0x5a3f36){this[_0xff94('0x19')][_0xff94('0x41')]({'uniqueid':this[_0xff94('0x11')][_0xff94('0x37')],'body':_0x48c26a,'direction':_0x1ca9a0,'providerName':_0x438a89,'providerResponse':_0x183810})['then'](function(_0x2bf92a){if(_0x5a3f36){_0x5a3f36(null,_0x2bf92a);}})[_0xff94('0x18')](function(_0x1fcc2b){if(_0x5a3f36){_0x5a3f36(_0x1fcc2b);}});};AGIVertices[_0xff94('0x13')]['createCmContact']=function(_0x44f1ad,_0x9e6360){this[_0xff94('0x19')][_0xff94('0x42')]({'firstName':_['isEmpty'](_0x44f1ad[_0xff94('0x17')])||_[_0xff94('0x43')](_0x44f1ad['name'])?_0xff94('0x44')+Math[_0xff94('0x45')]():_0x44f1ad[_0xff94('0x17')],'lastName':_['isEmpty'](_0x44f1ad[_0xff94('0x46')])||_[_0xff94('0x43')](_0x44f1ad['lastName'])?null:_0x44f1ad[_0xff94('0x46')],'phone':_0x44f1ad[_0xff94('0x47')],'ListId':_0x44f1ad[_0xff94('0x48')],'scheduledat':_0x44f1ad[_0xff94('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xff94('0x4a'),'description':_0xff94('0x4b')+_0x44f1ad[_0xff94('0x49')]['toString'](),'priority':_0x44f1ad[_0xff94('0x4c')]})[_0xff94('0x16')](function(_0x49c8a9){_0x9e6360(null,_0x49c8a9);})[_0xff94('0x18')](function(_0x36175c){_0x9e6360(_0x36175c);});};AGIVertices[_0xff94('0x13')][_0xff94('0x4d')]=function(_0x110f78,_0x21e727){this[_0xff94('0x19')]['getPauseById'](_0x110f78)[_0xff94('0x16')](function(_0x2e2578){_0x21e727(null,_0x2e2578?_0x2e2578[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0xf20613){_0x21e727(_0xf20613);});};AGIVertices[_0xff94('0x13')][_0xff94('0x4e')]=function(_0x1b6d21,_0x20a7ca,_0x27edcc){var _0x1d4962={'role':_0xff94('0x4f')};_0x1d4962[_0x1b6d21]=this[_0xff94('0x11')]['callerid'];this[_0xff94('0x19')]['agentPause'](_0x1d4962,_0x20a7ca,this['channel'][_0xff94('0x37')])[_0xff94('0x16')](function(_0x5f39ab){_0x27edcc(null,_[_0xff94('0x43')](_0x5f39ab)?![]:!![]);})[_0xff94('0x18')](function(_0x5ae1be){logger[_0xff94('0x2f')](_0x5ae1be);_0x27edcc(null,![]);});};AGIVertices['prototype'][_0xff94('0x50')]=function(_0xeef19,_0x1c517d){var _0x56f37b={'role':_0xff94('0x4f')};_0x56f37b[_0xeef19]=this[_0xff94('0x11')][_0xff94('0x3a')];this[_0xff94('0x19')][_0xff94('0x50')](_0x56f37b)[_0xff94('0x16')](function(_0x2b6810){_0x1c517d(null,_[_0xff94('0x43')](_0x2b6810)?![]:!![]);})['catch'](function(_0x4e37af){logger[_0xff94('0x2f')](_0x4e37af);_0x1c517d(null,![]);});};AGIVertices[_0xff94('0x13')][_0xff94('0x51')]=function(_0x2ea98c,_0x4f54aa){var _0x43a498={'role':'agent'};_0x43a498[_0x2ea98c]=this[_0xff94('0x11')]['callerid'];this['rpc'][_0xff94('0x51')](_0x43a498)[_0xff94('0x16')](function(_0x4f75f4){_0x4f54aa(null,_['isNil'](_0x4f75f4)?![]:!![]);})[_0xff94('0x18')](function(_0x331688){logger[_0xff94('0x2f')](_0x331688);_0x4f54aa(null,![]);});};AGIVertices[_0xff94('0x13')]['agentLogin']=function(_0x189a50,_0x2e85c8){var _0x37572e={'role':_0xff94('0x4f')};_0x37572e[_0x189a50]=this['channel'][_0xff94('0x3a')];var _0x29fc55=_0x189a50!=_0xff94('0x52')?util[_0xff94('0x2d')](_0xff94('0x53'),_0xff94('0x54'),this[_0xff94('0x11')]['callerid']):undefined;this[_0xff94('0x19')][_0xff94('0x55')](_0x37572e,_0x29fc55)[_0xff94('0x16')](function(_0x3b3f9a){_0x2e85c8(null,_[_0xff94('0x43')](_0x3b3f9a)?![]:!![]);})[_0xff94('0x18')](function(_0x57070f){logger[_0xff94('0x2f')](_0x57070f);_0x2e85c8(null,![]);});};AGIVertices[_0xff94('0x13')][_0xff94('0x56')]=function(_0x3e1863,_0x4589ac){sh[_0xff94('0x57')](_[_0xff94('0x58')](_0x3e1863),function(_0x3f2129,_0x278710){var _0x21befb=_0x278710[_0xff94('0x59')](/(\r\n|\n|\r)/gm,'');_0x4589ac(null,_0x21befb);});};AGIVertices['prototype'][_0xff94('0x5a')]=function(_0x41b71d,_0x396404){scripts[_0xff94('0x5a')](_0x41b71d[_0xff94('0x5b')],_0x41b71d[_0xff94('0x5c')]||'text',_0x41b71d[_0xff94('0x5d')],_0x41b71d[_0xff94('0x5e')]||_0xff94('0x5f'),_0x41b71d['ssmlGender']||_0xff94('0x60'),_0x41b71d[_0xff94('0x61')]||_0xff94('0x62'))[_0xff94('0x16')](function(_0x23b514){_0x396404(null,_0x23b514);})[_0xff94('0x18')](function(_0x239ffd){_0x396404(_0x239ffd);});};AGIVertices['prototype'][_0xff94('0x63')]=function(_0x453632,_0x10606b){scripts[_0xff94('0x63')](_0x453632['text'],_0x453632[_0xff94('0x64')]||'en',0x1)[_0xff94('0x16')](function(_0x2f4752){_0x10606b(null,_0x2f4752);})[_0xff94('0x18')](function(_0x28fb2b){_0x10606b(_0x28fb2b);});};AGIVertices[_0xff94('0x13')]['restAPI']=function(_0x4b5b71,_0x2ccf38){var _0x491eb4={'uri':_0x4b5b71['url'],'method':_0x4b5b71['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4b5b71['timeout'])==='number'&&parseInt(_0x4b5b71[_0xff94('0x65')])>=0x1?parseInt(_0x4b5b71[_0xff94('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xff94('0x66')]([_0xff94('0x67'),_0xff94('0x68')],_0x491eb4[_0xff94('0x69')][_0xff94('0x6a')]())){try{_0x491eb4[_0xff94('0x6b')]=_0x4b5b71[_0xff94('0x6c')]?JSON['parse'](_0x4b5b71['rawBody']):{};}catch(_0x18e26c){logger[_0xff94('0x2f')](_0xff94('0x6d'),_0x18e26c);}}try{_0x491eb4[_0xff94('0x6e')]=_0x4b5b71['rawHeaders']?JSON[_0xff94('0x6f')](_0x4b5b71['rawHeaders']):{};}catch(_0x2eeca4){logger[_0xff94('0x2f')](_0xff94('0x70'),_0x2eeca4);}if(_0x4b5b71[_0xff94('0x71')]){try{var _0x3e03c1=require(_0x4b5b71['computedVariables'])[_0xff94('0x72')](this,_0x491eb4);_0x491eb4[_0xff94('0x73')]=Mustache[_0xff94('0x74')](_0x4b5b71['url'],_0x3e03c1,{},['$$','$$']);if(_0x491eb4[_0xff94('0x6e')]){_0x491eb4[_0xff94('0x6e')]=JSON[_0xff94('0x6f')](Mustache[_0xff94('0x74')](JSON['stringify'](_0x491eb4[_0xff94('0x6e')]),_0x3e03c1,{},['$$','$$']));}if(_0x491eb4[_0xff94('0x6b')]){_0x491eb4[_0xff94('0x6b')]=JSON['parse'](Mustache['render'](JSON[_0xff94('0x75')](_0x491eb4[_0xff94('0x6b')]),_0x3e03c1,{},['$$','$$']));}}catch(_0xac09c){logger[_0xff94('0x2f')](_0xff94('0x76'),_0xac09c);}}rp(_0x491eb4)['then'](function(_0x20dfe8){var _0x28e9a0={'statusCode':_0x20dfe8['statusCode']||0xc8,'statusMessage':_0x20dfe8[_0xff94('0x77')]||'OK','headers':_0x20dfe8[_0xff94('0x6e')]||{},'body':_0x20dfe8[_0xff94('0x6b')]||{}};_0x2ccf38(null,_0x28e9a0);})[_0xff94('0x18')](function(_0x181518){var _0x4871f0={'statusCode':_0x181518[_0xff94('0x78')]||0x1f4,'statusMessage':_0x181518[_0xff94('0x79')]||_0xff94('0x7a'),'headers':_0x181518[_0xff94('0x7b')][_0xff94('0x6e')]||{},'body':_0x181518[_0xff94('0x7b')][_0xff94('0x6b')]||{}};_0x2ccf38(null,_0x4871f0);});};AGIVertices['prototype'][_0xff94('0x7c')]=function(_0x536971,_0xf5dd86){scripts[_0xff94('0x7c')](this[_0xff94('0x11')]['uniqueid'],_0x536971['key'],_0x536971[_0xff94('0x5d')],_0x536971[_0xff94('0x7d')]||'en')[_0xff94('0x16')](function(_0x558315){_0xf5dd86(null,_0x558315);})[_0xff94('0x18')](function(_0x43bfb6){_0xf5dd86(_0x43bfb6);});};AGIVertices[_0xff94('0x13')][_0xff94('0x7e')]=function(_0x204ecf,_0x2bc264){scripts[_0xff94('0x7e')](this[_0xff94('0x11')]['uniqueid'],_0x204ecf['dialogflowV2_project_id'],_0x204ecf[_0xff94('0x7f')],_0x204ecf[_0xff94('0x80')],_0x204ecf['text'],_0x204ecf[_0xff94('0x81')]||'en')[_0xff94('0x16')](function(_0x2b9a6f){_0x2bc264(null,_0x2b9a6f);})['catch'](function(_0x2367e4){_0x2bc264(_0x2367e4);});};AGIVertices['prototype'][_0xff94('0x82')]=function(_0x1c3330,_0x122886){scripts[_0xff94('0x82')](this[_0xff94('0x11')],_0x1c3330)[_0xff94('0x16')](function(_0x3f5a8e){_0x122886(null,_0x3f5a8e);})[_0xff94('0x18')](function(_0xf3d077){_0x122886(_0xf3d077);});};AGIVertices[_0xff94('0x13')][_0xff94('0x83')]=function(_0x2f3793,_0x44779d){scripts['ispeechTTS'](_0x2f3793[_0xff94('0x84')],_0x2f3793['text'],_0x2f3793[_0xff94('0x85')]||_0xff94('0x5f'),_0x2f3793[_0xff94('0x86')])[_0xff94('0x16')](function(_0xd0fe90){_0x44779d(null,_0xd0fe90);})['catch'](function(_0x2992d8){_0x44779d(_0x2992d8);});};AGIVertices[_0xff94('0x13')][_0xff94('0x87')]=function(_0x2ad0e6,_0x569c2d,_0x6bbecd){scripts[_0xff94('0x87')](_0x569c2d,_0x2ad0e6[_0xff94('0x84')],_0x2ad0e6[_0xff94('0x88')]||'en-US',this[_0xff94('0x89')](_0x2ad0e6[_0xff94('0x8a')])?_0x2ad0e6['model']:undefined)[_0xff94('0x16')](function(_0x1b0184){_0x6bbecd(null,_0x1b0184);})[_0xff94('0x18')](function(_0x3ff78e){_0x6bbecd(_0x3ff78e);});};AGIVertices[_0xff94('0x13')][_0xff94('0x8b')]=function(_0x235b39,_0x240829){scripts[_0xff94('0x8b')](_0x235b39['aws_access_key_id'],_0x235b39[_0xff94('0x8c')],_0x235b39[_0xff94('0x8d')],_0x235b39['aws_polly_voice']||_0xff94('0x8e'),_0x235b39[_0xff94('0x5d')],_0x235b39[_0xff94('0x8f')]||_0xff94('0x5d'))[_0xff94('0x16')](function(_0x60957c){_0x240829(null,_0x60957c);})[_0xff94('0x18')](function(_0x51f36f){_0x240829(_0x51f36f);});};AGIVertices[_0xff94('0x13')][_0xff94('0x90')]=function(_0x5b9fca,_0x83184b){scripts['awsLex'](this[_0xff94('0x11')][_0xff94('0x37')],_0x5b9fca[_0xff94('0x91')],_0x5b9fca[_0xff94('0x8c')],_0x5b9fca['aws_lex_region'],_0x5b9fca[_0xff94('0x5d')],_0x5b9fca[_0xff94('0x92')])[_0xff94('0x16')](function(_0x179eb2){_0x83184b(null,_0x179eb2);})['catch'](function(_0x43f921){_0x83184b(_0x43f921);});};AGIVertices[_0xff94('0x13')][_0xff94('0x93')]=function(_0x4dbd9e,_0x4d4cfe,_0x302f6c){scripts[_0xff94('0x93')](_0x4d4cfe,_0x4dbd9e[_0xff94('0x84')],_0x4dbd9e[_0xff94('0x94')]||_0xff94('0x5f'))[_0xff94('0x16')](function(_0x21143d){_0x302f6c(null,_0x21143d);})[_0xff94('0x18')](function(_0x2df85b){_0x302f6c(_0x2df85b);});};AGIVertices['prototype'][_0xff94('0x95')]=function(_0x3815a4,_0x45a58f,_0x2e7a55){scripts[_0xff94('0x95')](_0x45a58f,_0x3815a4[_0xff94('0x96')],_0x3815a4[_0xff94('0x97')],_0x3815a4[_0xff94('0x73')])[_0xff94('0x16')](function(_0x493eb3){_0x2e7a55(null,_0x493eb3);})[_0xff94('0x18')](function(_0x424c29){_0x2e7a55(_0x424c29);});};AGIVertices['prototype'][_0xff94('0x98')]=function(_0x35a2c5){var _0x2fe967=_[_0xff94('0x66')](verticesWithRetry,_0x35a2c5['agicommand'])?_0x35a2c5:_['clone'](_0x35a2c5);for(var _0x28086e in _0x2fe967){if(_0x2fe967[_0xff94('0x99')](_0x28086e)){if(_0x2fe967[_0x28086e]&&_[_0xff94('0x9a')](_0x2fe967[_0x28086e])){if(_[_0xff94('0x66')](recursiveMapAttributes,_0x28086e)){_0x2fe967[_0x28086e]=this[_0xff94('0x9b')](_0x2fe967[_0x28086e]);}else{_0x2fe967[_0x28086e]=this[_0xff94('0x9c')](_0x2fe967[_0x28086e]);}}}}return _0x2fe967;};AGIVertices[_0xff94('0x13')]['recursiveNodeIndex']=function(_0x55a6c8){for(var _0x3f3491 in _0x55a6c8){if(_0x55a6c8[_0xff94('0x99')](_0x3f3491)){if(_[_0xff94('0x9d')](_0x55a6c8[_0x3f3491])){this['recursiveNodeIndex'](_0x55a6c8[_0x3f3491]);}else if(_[_0xff94('0x9e')](_0x55a6c8[_0x3f3491])){for(var _0x1d42dc=0x0;_0x1d42dc<_0x55a6c8[_0x3f3491]['length'];_0x1d42dc++){this[_0xff94('0x9f')](_0x55a6c8[_0x3f3491][_0x1d42dc]);}}else if(_[_0xff94('0x9a')](_0x55a6c8[_0x3f3491])){_0x55a6c8[_0x3f3491]=this[_0xff94('0x9c')](_0x55a6c8[_0x3f3491]);}}}};AGIVertices[_0xff94('0x13')][_0xff94('0xa0')]=function(_0x3775b5,_0x554567){for(var _0x273cd0 in _0x3775b5){if(_0x3775b5['hasOwnProperty'](_0x273cd0)){if(_[_0xff94('0x9d')](_0x3775b5[_0x273cd0])){if(!_['isEmpty'](_0x3775b5[_0x273cd0])){this[_0xff94('0xa0')](_0x3775b5[_0x273cd0],util['format']('%s.%s',_0x554567,_0x273cd0));}}else if(_[_0xff94('0x9e')](_0x3775b5[_0x273cd0])){for(var _0x297202=0x0;_0x297202<_0x3775b5[_0x273cd0][_0xff94('0xa1')];_0x297202++){this[_0xff94('0xa0')](_0x3775b5[_0x273cd0][_0x297202],util['format'](_0xff94('0xa2'),_0x554567,_0x273cd0+'['+_0x297202+']'));}}else{if(!_[_0xff94('0x43')](_0x3775b5[_0x273cd0])){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0xa2'),_0x554567,_0x273cd0),_0x3775b5[_0x273cd0]);}}}}};AGIVertices['prototype'][_0xff94('0x9b')]=function(_0x5f077a){try{var _0x3defc0=JSON[_0xff94('0x6f')](_0x5f077a);this[_0xff94('0x9f')](_0x3defc0);return JSON['stringify'](_0x3defc0);}catch(_0x52a4bb){return this[_0xff94('0x9c')](_0x5f077a);}};AGIVertices[_0xff94('0x13')][_0xff94('0x9c')]=function(_0xdf1399){var _0x3edebb=_0xdf1399[_0xff94('0xa4')]('{');for(var _0x247a59=0x1;_0x247a59<_0x3edebb[_0xff94('0xa1')];_0x247a59+=0x1){var _0xf3d75b=_0x3edebb[_0x247a59][_0xff94('0xa4')]('}');if(_0xf3d75b[_0xff94('0xa1')]>0x1){_0xdf1399=_0xdf1399[_0xff94('0xa5')]('{'+_0xf3d75b[0x0]+'}',this[_0xff94('0x11')]['getVariable'](_0xf3d75b[0x0])[_0xff94('0xa6')]||_0xf3d75b[0x0]);}}if(_0x3edebb[_0xff94('0xa1')]===0x1){return _0xdf1399[_0xff94('0xa7')]();}return this['replaceAllVariables'](_0xdf1399);};AGIVertices[_0xff94('0x13')][_0xff94('0xa8')]=function(_0x6086ae,_0x1d60a3){var _0x477fae=this[_0xff94('0x11')][_0xff94('0x14')](_0x6086ae);if(_0x477fae[_0xff94('0xa9')]===-0x1){return _0x477fae;}logger['info'](util[_0xff94('0x2d')](_0xff94('0xaa'),_0x1d60a3,_0x477fae[_0xff94('0xa6')]));return this[_0xff94('0x11')][_0xff94('0xa3')](_0x1d60a3,_0x477fae[_0xff94('0xa6')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x89')]=function(_0x415043){return _0x415043&&_0x415043!=='0'&&_0x415043!=='-1'&&_0x415043!=='';};AGIVertices[_0xff94('0x13')][_0xff94('0xab')]=function(_0xe43f40){this[_0xff94('0x36')][_0xff94('0x72')](this,_0xe43f40,'-');_0xe43f40[_0xff94('0xac')]=_0xe43f40[_0xff94('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x487fae){logger[_0xff94('0x31')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x487fae[_0xff94('0x38')]));if(!this['isConfigured'](_0x487fae['text'])){return this[_0xff94('0x11')]['noop'](_0xff94('0xad'));}var _0x4f2727='\x22'+_0x487fae[_0xff94('0x5d')]+'\x22';if(this[_0xff94('0x89')](_0x487fae[_0xff94('0x7b')])){_0x4f2727+=','+_0x487fae[_0xff94('0x7b')];}var _0x53e9c6=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xae'),_0x4f2727);if(_0x53e9c6[_0xff94('0xa9')]===-0x1){return _0x53e9c6;}return this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0xb0'),_0x4f2727));};AGIVertices[_0xff94('0x13')][_0xff94('0xb1')]=function(_0x1ba534){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xb2'),_0x1ba534[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x1ba534['grammar'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20grammar\x20configured');}var _0x1a654a=_0x1ba534[_0xff94('0xb3')];if(this[_0xff94('0x89')](_0x1ba534['options'])){_0x1a654a+=','+_0x1ba534['options'];}var _0x7a8846=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xb4'),_0x1a654a);if(_0x7a8846[_0xff94('0xa9')]===-0x1){return _0x7a8846;}var _0x34061b=this[_0xff94('0xa8')]('RECOG_CONFIDENCE()',_0xff94('0xb5'));if(_0x34061b[_0xff94('0xa9')]===-0x1){return _0x34061b;}var _0x442685=this[_0xff94('0xa8')](_0xff94('0xb6'),_0xff94('0xb7'));if(_0x442685[_0xff94('0xa9')]===-0x1){return _0x442685;}var _0x10e1f0=this[_0xff94('0xa8')]('RECOG_INSTANCE()',_0xff94('0xb8'));if(_0x10e1f0['result']===-0x1){return _0x10e1f0;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1a654a));};AGIVertices[_0xff94('0x13')]['agi']=function(_0x2a1981){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2a1981[_0xff94('0x38')]));return this[_0xff94('0x11')]['agi']([_0x2a1981[_0xff94('0xb9')],_0x2a1981[_0xff94('0xba')]]);};AGIVertices[_0xff94('0x13')][_0xff94('0xbb')]=function(_0xa4bf16){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xbc'),_0xa4bf16[_0xff94('0x38')]));if(this[_0xff94('0x89')](_0xa4bf16[_0xff94('0x65')])){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xbd'),_0xa4bf16[_0xff94('0x65')]));var _0x44e891=this['channel'][_0xff94('0xbe')](_0xa4bf16['timeout']);if(_0x44e891[_0xff94('0xa9')]===-0x1){return _0x44e891;}}return this['channel'][_0xff94('0xbb')]();};AGIVertices[_0xff94('0x13')]['callback']=function(_0x371b03){logger[_0xff94('0x31')](util['format'](_0xff94('0xbf'),_0x371b03[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x371b03[_0xff94('0x48')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x371b03,_0xff94('0xc0'));}_0x371b03[_0xff94('0x49')]=moment();if(this['isConfigured'](_0x371b03['delay'])){_0x371b03[_0xff94('0x49')]=moment()[_0xff94('0xc1')](_0x371b03[_0xff94('0xc2')],'minutes');}if(!this[_0xff94('0x89')](_0x371b03[_0xff94('0x4c')])){_0x371b03['callback_priority']=0x2;}this[_0xff94('0x42')]['sync'](this,_0x371b03);return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0xc3'),_0x371b03[_0xff94('0x47')],_0x371b03['list_id'],_0x371b03[_0xff94('0x49')]));};AGIVertices['prototype'][_0xff94('0xc4')]=function(_0x48154e){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xc5'),_0x48154e['label']));var _0x46ba28=this[_0xff94('0x11')]['exec'](_0x48154e[_0xff94('0xc6')],_0x48154e[_0xff94('0x7b')]);if(_0x46ba28[_0xff94('0xa9')]===-0x1){return _0x46ba28;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),_0x48154e[_0xff94('0xc6')],_0x48154e[_0xff94('0x7b')]));};AGIVertices[_0xff94('0x13')][_0xff94('0xc8')]=function(_0x34bf07){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xc9'),_0x34bf07[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x34bf07[_0xff94('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x5a9a0e='\x22'+_0x34bf07['text']+'\x22';if(this[_0xff94('0x89')](_0x34bf07['options'])){_0x5a9a0e+=','+_0x34bf07[_0xff94('0x7b')];}var _0x461017=this[_0xff94('0x11')]['exec'](_0xff94('0xae'),_0x5a9a0e);if(_0x461017[_0xff94('0xa9')]===-0x1){return _0x461017;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xb0'),_0x5a9a0e));};AGIVertices[_0xff94('0x13')]['sestektts']=function(_0x5a07f3){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xca'),_0x5a07f3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x5a07f3[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}var _0x53317f='\x22'+_0x5a07f3[_0xff94('0x5d')]+'\x22';if(this[_0xff94('0x89')](_0x5a07f3[_0xff94('0x7b')])){_0x53317f+=','+_0x5a07f3[_0xff94('0x7b')];}var _0x3167a7=this['channel'][_0xff94('0x57')](_0xff94('0xae'),_0x53317f);if(_0x3167a7[_0xff94('0xa9')]===-0x1){return _0x3167a7;}return this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0xb0'),_0x53317f));};AGIVertices[_0xff94('0x13')][_0xff94('0xcb')]=function(_0x359d2b){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xcc'),_0x359d2b['label']));if(!this[_0xff94('0x89')](_0x359d2b[_0xff94('0xb3')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xcd'));}var _0x239736=_0x359d2b[_0xff94('0xb3')];if(this['isConfigured'](_0x359d2b[_0xff94('0x7b')])){_0x239736+=','+_0x359d2b[_0xff94('0x7b')];}var _0x476e37=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xb4'),_0x239736);if(_0x476e37[_0xff94('0xa9')]===-0x1){return _0x476e37;}var _0x106835=this['getAndSetVariable'](_0xff94('0xce'),_0xff94('0xcf'));if(_0x106835[_0xff94('0xa9')]===-0x1){return _0x106835;}var _0x5ef947=this[_0xff94('0xa8')](_0xff94('0xb6'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5ef947[_0xff94('0xa9')]===-0x1){return _0x5ef947;}var _0x2070c8=this[_0xff94('0xa8')](_0xff94('0xd0'),'LUMENVOX_ASR_INSTANCE');if(_0x2070c8[_0xff94('0xa9')]===-0x1){return _0x2070c8;}return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0xd1'),_0x239736));};AGIVertices[_0xff94('0x13')][_0xff94('0xd2')]=function(_0x27af0e){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x27af0e['label']));if(!this[_0xff94('0x89')](_0x27af0e[_0xff94('0xb3')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xcd'));}var _0x46e82b=_0x27af0e[_0xff94('0xb3')];if(this[_0xff94('0x89')](_0x27af0e[_0xff94('0x7b')])){_0x46e82b+=','+_0x27af0e[_0xff94('0x7b')];}var _0x44d69b=this[_0xff94('0x11')][_0xff94('0x57')]('MRCPRecog',_0x46e82b);if(_0x44d69b['result']===-0x1){return _0x44d69b;}var _0x5584d9=this[_0xff94('0xa8')]('RECOG_CONFIDENCE()',_0xff94('0xd3'));if(_0x5584d9[_0xff94('0xa9')]===-0x1){return _0x5584d9;}var _0x2b995a=this[_0xff94('0xa8')](_0xff94('0xb6'),_0xff94('0xd4'));if(_0x2b995a[_0xff94('0xa9')]===-0x1){return _0x2b995a;}var _0x222da3=this[_0xff94('0xa8')](_0xff94('0xd0'),_0xff94('0xd5'));if(_0x222da3[_0xff94('0xa9')]===-0x1){return _0x222da3;}return this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0xd1'),_0x46e82b));};AGIVertices['prototype'][_0xff94('0xd6')]=function(_0x159923){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xd7'),_0x159923[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x159923[_0xff94('0xd8')])){return this['channel'][_0xff94('0x2f')](_0x159923,_0xff94('0xd9'));}var _0xb93a62=this['getSquareOdbc']['sync'](this,_0x159923[_0xff94('0xd8')]);if(!_0xb93a62){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x159923,_0xff94('0xda'));}if(!this[_0xff94('0x89')](_0x159923['query'])){return this['channel']['error'](_0x159923,_0xff94('0xdb'));}var _0x143106=_0x159923[_0xff94('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xdc'),_0x143106));var _0x5d44f7=this[_0xff94('0x2e')]['sync'](this,_0xb93a62,_0x143106);this['createSquareDetailsReport'][_0xff94('0x72')](this,_0x159923,_0x143106);if(!this['isConfigured'](_0x159923[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4688ec=this[_0xff94('0x14')]['sync'](this,_0x159923[_0xff94('0xdd')]);if(!_0x4688ec){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x159923,_0xff94('0xde'));}var _0xa57609=this;_0x5d44f7[_0xff94('0xdf')](function(_0x4d227f,_0xb64503){Object['keys'](_0x4d227f)[_0xff94('0xdf')](function(_0x32b238){_0xa57609[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xe0'),_0x4688ec,_0xb64503,_0x32b238),_0x4d227f[_0x32b238]);});});this[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xe1'),_0x4688ec),_0x5d44f7[_0xff94('0xa1')]);return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xe2'),_0x4688ec));};AGIVertices['prototype'][_0xff94('0xe3')]=function(_0x54c0d4){logger['debug'](util[_0xff94('0x2d')](_0xff94('0xe4'),_0x54c0d4[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x54c0d4[_0xff94('0xe5')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x54c0d4,'no\x20user\x20selected');}var _0x2a5571=this[_0xff94('0x1f')][_0xff94('0x72')](this,_0x54c0d4[_0xff94('0xe5')]);if(!_0x2a5571){return this['channel'][_0xff94('0x2f')](_0x54c0d4,_0xff94('0xe6'));}var _0x3c4617=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xe7'),[util[_0xff94('0x2d')](_0xff94('0xe8'),_0x2a5571),_0x54c0d4[_0xff94('0x65')],_0x54c0d4[_0xff94('0xe9')],_0x54c0d4[_0xff94('0xea')]]);if(_0x3c4617['result']===-0x1){return _0x3c4617;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xeb'),'DIAL'));};AGIVertices[_0xff94('0x13')][_0xff94('0xec')]=function(_0x4cd128){logger['info'](util[_0xff94('0x2d')](_0xff94('0xed'),_0x4cd128[_0xff94('0x38')]));if(!this['isConfigured'](_0x4cd128[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}if(!this[_0xff94('0x89')](_0x4cd128[_0xff94('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xff94('0xef')]=!![];this['createSquareDetailsReport'](_0x4cd128);this[_0xff94('0x41')](_0x4cd128[_0xff94('0x5d')],'in','','');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xf0'),_0x4cd128[_0xff94('0x5d')]));var _0x5a91e9=this[_0xff94('0x7c')][_0xff94('0x72')](this,_0x4cd128);if(_0x5a91e9){for(var _0x395442 in _0x5a91e9){if(_0x5a91e9[_0xff94('0x99')](_0x395442)){this[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xf1'),_0x395442[_0xff94('0x6a')]()),_0x5a91e9[_0x395442]);}}this['createSquareMessage'](_0x5a91e9[_0xff94('0xf2')],_0xff94('0xf3'),_0xff94('0xec'),'');return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xf4'),_0x5a91e9['speech']));}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x4cd128,_0xff94('0xf5'));};AGIVertices[_0xff94('0x13')][_0xff94('0xf6')]=function(_0x60ff08){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x60ff08[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0xf7')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xf8'));}if(!this[_0xff94('0x89')](_0x60ff08['client_email'])){return this[_0xff94('0x11')]['noop'](_0xff94('0xf9'));}if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0x80')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xfa'));}if(!this[_0xff94('0x89')](_0x60ff08['dialogflowV2_language'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xfb'));}if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0x5d')])){return this[_0xff94('0x11')]['noop']('no\x20text\x20configured');}this[_0xff94('0x11')]['bot']=!![];this['createSquareDetailsReport'](_0x60ff08);this['createSquareMessage'](_0x60ff08[_0xff94('0x5d')],'in','','');this['channel']['noop'](util[_0xff94('0x2d')](_0xff94('0xfc'),_0x60ff08[_0xff94('0x5d')]));var _0x306b00=this['googleDialogflowV2']['sync'](this,_0x60ff08);if(_0x306b00){for(var _0x5f57b1 in _0x306b00){if(_0x306b00[_0xff94('0x99')](_0x5f57b1)){if(_0x5f57b1!==_0xff94('0xfd')){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')]('DIALOGFLOW_%s',_0x5f57b1[_0xff94('0x6a')]()),_0x306b00[_0x5f57b1]);}}}this[_0xff94('0x41')](_0x306b00['speech'],_0xff94('0xf3'),_0xff94('0xf6'),_0x306b00[_0xff94('0xfd')]);return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('DialogflowV2\x20Result\x20%s',_0x306b00['speech']));}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x60ff08,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')]['sesteknda']=function(_0x456f6a){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xfe'),_0x456f6a['label']));if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0xff')])){return this[_0xff94('0x11')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0x100')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x101'));}if(!this['isConfigured'](_0x456f6a[_0xff94('0x102')])){return this['channel'][_0xff94('0xaf')](_0xff94('0x103'));}if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0x104')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xef')]=!![];this[_0xff94('0x36')](_0x456f6a);this[_0xff94('0x41')](_0x456f6a[_0xff94('0x5d')],'in','','');this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0x105'),_0x456f6a[_0xff94('0x5d')]));var _0x2d926b=this[_0xff94('0x82')]['sync'](this,_0x456f6a);if(_0x2d926b){for(var _0x1a49f6 in _0x2d926b){if(_0x2d926b['hasOwnProperty'](_0x1a49f6)){this[_0xff94('0x11')][_0xff94('0xa3')](util['format']('SESTEK_NDA_%s',_0x1a49f6[_0xff94('0x6a')]()),_0x2d926b[_0x1a49f6]);}}this[_0xff94('0x41')](_0x2d926b[_0xff94('0xf2')],'out',_0xff94('0x106'),'');if(_0x2d926b[_0xff94('0x107')]){this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2d926b[_0xff94('0x107')]));var _0x2f3db3=this[_0xff94('0x11')][_0xff94('0x108')](_0x2d926b[_0xff94('0x107')]);try{fs[_0xff94('0x109')](_0x2d926b[_0xff94('0x107')]+_0xff94('0x10a'));}catch(_0x1349c1){logger['error'](_0x1349c1);}return _0x2f3db3;}else{return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x10b'),_0x2d926b[_0xff94('0xf2')]));}}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x456f6a,_0xff94('0x10c'));};AGIVertices['prototype'][_0xff94('0x10d')]=function(_0x227346){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x10e'),_0x227346['label']));return this[_0xff94('0x11')]['noop'](_0xff94('0x10d'));};AGIVertices[_0xff94('0x13')][_0xff94('0x10f')]=function(_0x399dee){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x110'),_0x399dee['label']));var _0x3a9a86='';if(_0x399dee[_0xff94('0x111')]){if(!this['isConfigured'](_0x399dee[_0xff94('0x111')])){return this['channel'][_0xff94('0x2f')](_0x399dee,_0xff94('0x112'));}else{var _0x51fcd3=parseInt(_0x399dee[_0xff94('0x111')],0xa);if(isNaN(_0x51fcd3)){_0x3a9a86=_0x399dee[_0xff94('0x111')];}else{_0x3a9a86=this[_0xff94('0x113')][_0xff94('0x72')](this,_0x399dee['trunk_id']);if(!_0x3a9a86){return this[_0xff94('0x11')]['error'](_0x399dee,_0xff94('0x114'));}}}}else if(_0x399dee['trunk_name']){_0x3a9a86=_0x399dee[_0xff94('0x115')];}else{return this['channel'][_0xff94('0x2f')](_0x399dee,_0xff94('0x112'));}var _0x23127c=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xe7'),[util[_0xff94('0x2d')](_0xff94('0x116'),_0x3a9a86,_0x399dee['phone']),_0x399dee[_0xff94('0x65')],_0x399dee['opts'],_0x399dee['url']]);if(_0x23127c['result']===-0x1){return _0x23127c;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xeb'),_0xff94('0xe7')));};AGIVertices[_0xff94('0x13')][_0xff94('0x117')]=function(_0x786674){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x118'),_0x786674['label']));return this['channel'][_0xff94('0xaf')]('finally');};AGIVertices[_0xff94('0x13')]['getdigits']=function(_0x2a48b8){logger[_0xff94('0x31')](util['format'](_0xff94('0x119'),_0x2a48b8['label']));if(_0x2a48b8[_0xff94('0xac')]===0x0){return this[_0xff94('0xab')](_0x2a48b8);}_0x2a48b8[_0xff94('0xac')]-=0x1;if(!this[_0xff94('0x89')](_0x2a48b8[_0xff94('0x11a')])){return this[_0xff94('0x11')]['error'](_0x2a48b8,_0xff94('0x11b'));}var _0x5cdc1f=this['getSound'][_0xff94('0x72')](this,_0x2a48b8['file_id']);if(!_0x5cdc1f){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x2a48b8,_0xff94('0x11c'));}if(!this['isConfigured'](_0x2a48b8[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x32d347=this[_0xff94('0x11')][_0xff94('0x11d')](_0x5cdc1f,_0x2a48b8['response'],_0x2a48b8[_0xff94('0x11e')]);var _0x404f65=_0x32d347[_0xff94('0xa9')]?_0x32d347[_0xff94('0xa9')][_0xff94('0xa7')]():'';logger['info']('test',JSON[_0xff94('0x75')](_0x32d347));if(_0x32d347[_0xff94('0xa9')]===-0x1){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,_0x404f65);return _0x32d347;}else if(_0x32d347['extra']==='timeout'){_0x32d347[_0xff94('0xa9')]=_0x404f65[_0xff94('0xa1')]>=parseInt(_0x2a48b8['mindigit'])?'x':'i';}else{_0x32d347[_0xff94('0xa9')]=_0x404f65[_0xff94('0xa1')]>=parseInt(_0x2a48b8[_0xff94('0x11f')])&&_0x404f65[_0xff94('0xa1')]<=parseInt(_0x2a48b8['maxdigit'])?'x':'i';}var _0x24c8be=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x2a48b8[_0xff94('0xdd')]);if(!_0x24c8be){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x2a48b8,'no\x20variable\x20found');}this[_0xff94('0x11')]['setVariable'](_0x24c8be,_0x404f65);if(this[_0xff94('0x89')](_0x2a48b8[_0xff94('0x120')])){var _0x97e18=parseInt(_0x2a48b8[_0xff94('0x120')],0xa);var _0x3a3419=rs[_0xff94('0x121')]({'charset':'*','length':_0x97e18});var _0x3f0606=_0x404f65[_0xff94('0xa1')];if(_0x3f0606>0x0){if(_0x3f0606>_0x97e18){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,_0x2a48b8['hiddendigitspos']===_0xff94('0x122')?_0x3a3419+_0x404f65[_0xff94('0x123')](_0x97e18):_0x404f65[_0xff94('0x123')](0x0,_0x3f0606-_0x97e18)+_0x3a3419);}else{this[_0xff94('0x36')]['sync'](this,_0x2a48b8,rs[_0xff94('0x121')]({'charset':'*','length':_0x3f0606}));}}else{this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,'');}}else{this['createSquareDetailsReport'][_0xff94('0x72')](this,_0x2a48b8,_0x404f65);}return _0x32d347;};AGIVertices[_0xff94('0x13')][_0xff94('0x10')]=function(_0x18a1f0){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x124'),_0x18a1f0[_0xff94('0x38')]));return this['getdigits'](_0x18a1f0);};AGIVertices[_0xff94('0x13')][_0xff94('0x125')]=function(_0x5cf0ff){logger['info'](util['format'](_0xff94('0x126'),_0x5cf0ff[_0xff94('0x38')]));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x5cf0ff,_0x5cf0ff[_0xff94('0x127')]);return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x128'),_0x5cf0ff[_0xff94('0x127')]));};AGIVertices[_0xff94('0x13')][_0xff94('0x129')]=function(_0x4172a5){logger['info'](util[_0xff94('0x2d')](_0xff94('0x12a'),_0x4172a5['label']));if(!this[_0xff94('0x89')](_0x4172a5[_0xff94('0x91')])||!this[_0xff94('0x89')](_0x4172a5['aws_secret_access_key'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x12b'));}if(!this[_0xff94('0x89')](_0x4172a5[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x12c'),_0x4172a5['text']));var _0x14002e=this[_0xff94('0x8b')][_0xff94('0x72')](this,_0x4172a5);if(_0x14002e){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x14002e));var _0x4e2ee1=this[_0xff94('0x11')][_0xff94('0x108')](_0x14002e);try{fs[_0xff94('0x109')](_0x14002e+'.wav');}catch(_0x2fdd7f){logger[_0xff94('0x2f')](_0x2fdd7f);}return _0x4e2ee1;}return this['channel'][_0xff94('0x2f')](_0x4172a5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')][_0xff94('0x12d')]=function(_0x5cb64d){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5cb64d[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x5cb64d['aws_access_key_id'])||!this[_0xff94('0x89')](_0x5cb64d[_0xff94('0x8c')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xff94('0x89')](_0x5cb64d['aws_bot_name'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0xff94('0x89')](_0x5cb64d[_0xff94('0x5d')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')]['bot']=!![];this[_0xff94('0x36')](_0x5cb64d);this[_0xff94('0x41')](_0x5cb64d['text'],'in','','');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x12e'),_0x5cb64d[_0xff94('0x5d')]));var _0x2e2553=this[_0xff94('0x90')][_0xff94('0x72')](this,_0x5cb64d);if(_0x2e2553){for(var _0x3c5286 in _0x2e2553){if(_0x2e2553[_0xff94('0x99')](_0x3c5286)&&_[_0xff94('0x9a')](_0x2e2553[_0x3c5286])){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0x12f'),_0x3c5286[_0xff94('0x6a')]()),_0x2e2553[_0x3c5286]);}}if(_[_0xff94('0x43')](_0x2e2553[_0xff94('0x79')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xff94('0x41')](_0x2e2553[_0xff94('0x79')],_0xff94('0xf3'),_0xff94('0x130'),'');return this[_0xff94('0x11')][_0xff94('0xaf')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x2e2553[_0xff94('0x79')]));}}return this[_0xff94('0x11')]['error'](_0x5cb64d,_0xff94('0x131'));};AGIVertices['prototype'][_0xff94('0x132')]=function(_0x1a58a6){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x133'),_0x1a58a6[_0xff94('0x38')],_0x1a58a6[_0xff94('0x65')]));if(!this['isConfigured'](_0x1a58a6[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}var _0x386935=_0xff94('0x134');var _0x26d4db=util[_0xff94('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x378f26=util['format'](_0xff94('0xa2'),_0x26d4db,_0x386935);var _0x50ef7b=!![];if(_0x1a58a6[_0xff94('0x135')]===_0xff94('0x136')){_0x50ef7b=![];}var _0x5ae675=this[_0xff94('0x11')][_0xff94('0x137')](_0x26d4db,_0x386935,_0x1a58a6[_0xff94('0x138')],_0x1a58a6[_0xff94('0x65')],undefined,_0x50ef7b);if(_0x5ae675[_0xff94('0xa9')]!==-0x1){this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x139'),_0x378f26));var _0x45e0b3=this[_0xff94('0x93')]['sync'](this,_0x1a58a6,_0x378f26);if(_0x45e0b3){for(var _0x1bd4a9 in _0x45e0b3){if(_0x45e0b3[_0xff94('0x99')](_0x1bd4a9)){this['channel']['setVariable'](util[_0xff94('0x2d')](_0xff94('0x13a'),_0x1bd4a9[_0xff94('0x6a')]()),_0x45e0b3[_0x1bd4a9]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x13b'),JSON[_0xff94('0x75')](_0x45e0b3)));}}return _0x5ae675;};AGIVertices['prototype'][_0xff94('0x13c')]=function(_0x566c55){logger['info'](util[_0xff94('0x2d')](_0xff94('0x13d'),_0x566c55[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x566c55[_0xff94('0x96')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x566c55[_0xff94('0x97')])){return this['channel'][_0xff94('0xaf')](_0xff94('0x13e'));}var _0x1f4edf=_0xff94('0x134');var _0x3a3a0d=util['format'](_0xff94('0x13f'),FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x554458=util['format']('%s.%s',_0x3a3a0d,_0x1f4edf);var _0x25da69=!![];if(_0x566c55[_0xff94('0x135')]===_0xff94('0x136')){_0x25da69=![];}var _0x21bed5=this['channel']['recordFile'](_0x3a3a0d,_0x1f4edf,_0x566c55[_0xff94('0x138')],_0x566c55['timeout'],undefined,_0x25da69);if(_0x21bed5['result']!==-0x1){this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x140'),_0x554458));var _0x4814f3=this[_0xff94('0x95')][_0xff94('0x72')](this,_0x566c55,_0x554458);if(_0x4814f3){for(var _0x213dca in _0x4814f3){if(_0x4814f3[_0xff94('0x99')](_0x213dca)){this[_0xff94('0x11')][_0xff94('0xa3')](util['format'](_0xff94('0x141'),_0x213dca[_0xff94('0x6a')]()),_0x4814f3[_0x213dca]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x142'),JSON['stringify'](_0x4814f3)));}}return _0x21bed5;};AGIVertices[_0xff94('0x13')][_0xff94('0x143')]=function(_0x1205e5){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x144'),_0x1205e5[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0x145')](_0x1205e5[_0xff94('0x146')],_0x1205e5[_0xff94('0x3c')],_0x1205e5[_0xff94('0x3d')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x147')]=function(_0x551ea3){logger[_0xff94('0x31')](util['format'](_0xff94('0x148'),_0x551ea3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x551ea3[_0xff94('0x149')])){return this[_0xff94('0x11')]['error'](_0x551ea3,'no\x20condition\x20configured');}try{var _0x2ddb78=eval(_0x551ea3[_0xff94('0x149')])?_0xff94('0x14a'):_0xff94('0x14b');this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x551ea3['condition'],_0x2ddb78));return{'code':0xc8,'result':_0x2ddb78};}catch(_0x1eee31){return{'code':0xc8,'result':_0xff94('0x14b')};}};AGIVertices[_0xff94('0x13')][_0xff94('0x14c')]=function(_0x9a161d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x14d'),_0x9a161d[_0xff94('0x38')]));if(!this['isConfigured'](_0x9a161d[_0xff94('0x14e')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x9a161d,_0xff94('0x14f'));}var _0x53b77e=this[_0xff94('0x28')][_0xff94('0x72')](this,_0x9a161d[_0xff94('0x14e')]);if(!_0x53b77e){return this['channel'][_0xff94('0x2f')](_0x9a161d,'no\x20intervals\x20found');}for(var _0x2c5db8=0x0;_0x2c5db8<_0x53b77e[_0xff94('0xa1')];_0x2c5db8+=0x1){var _0xc10e62=this[_0xff94('0x11')][_0xff94('0x14')](util[_0xff94('0x2d')](_0xff94('0x150'),_0x53b77e[_0x2c5db8]));if(_0xc10e62[_0xff94('0xa9')]===-0x1){return _0xc10e62;}logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xc10e62[_0xff94('0xa6')]));if(_0xc10e62['extra']===_0xff94('0x14a')){logger[_0xff94('0x31')](util['format'](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xff94('0x14a')));this['channel'][_0xff94('0xaf')](util['format']('IFTIME\x20%s\x20%s',_0x53b77e[_0x2c5db8],_0xff94('0x14a')));return{'code':0xc8,'result':'true'};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xff94('0x14b')));this['channel']['noop'](util['format'](_0xff94('0x151'),_0x53b77e[_0x2c5db8],'false'));}}return{'code':0xc8,'result':_0xff94('0x14b')};};AGIVertices[_0xff94('0x13')][_0xff94('0x152')]=function(_0x5c7803){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x153'),_0x5c7803[_0xff94('0x38')]));return this[_0xff94('0x11')]['hangup']();};AGIVertices[_0xff94('0x13')][_0xff94('0x154')]=function(_0x34b777){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x34b777['label']));if(!this[_0xff94('0x89')](_0x34b777[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20key\x20configured');}var _0x250942=_0xff94('0x134');var _0x5bb18=util[_0xff94('0x2d')](_0xff94('0x13f'),FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x3cab1f=util[_0xff94('0x2d')](_0xff94('0xa2'),_0x5bb18,_0x250942);var _0x47ecf7=!![];if(_0x34b777[_0xff94('0x135')]===_0xff94('0x136')){_0x47ecf7=![];}var _0x5bc5ea=this['channel']['recordFile'](_0x5bb18,_0x250942,_0x34b777['intKey'],_0x34b777['timeout'],undefined,_0x47ecf7);if(_0x5bc5ea[_0xff94('0xa9')]!==-0x1){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x155'),_0x3cab1f));var _0xb3403d=this[_0xff94('0x87')][_0xff94('0x72')](this,_0x34b777,_0x3cab1f);if(_0xb3403d){for(var _0x115a80 in _0xb3403d){if(_0xb3403d[_0xff94('0x99')](_0x115a80)){this[_0xff94('0x11')]['setVariable'](util['format'](_0xff94('0x156'),_0x115a80[_0xff94('0x6a')]()),_0xb3403d[_0x115a80]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0xff94('0x75')](_0xb3403d)));}}return _0x5bc5ea;};AGIVertices['prototype'][_0xff94('0x157')]=function(_0xaa34ec){logger['info'](util[_0xff94('0x2d')](_0xff94('0x158'),_0xaa34ec[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0xaa34ec[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}if(!this[_0xff94('0x89')](_0xaa34ec[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0xaa34ec['text']));var _0x44165a=this[_0xff94('0x83')][_0xff94('0x72')](this,_0xaa34ec);if(_0x44165a){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('ispeech\x20%s\x20file\x20created',_0x44165a));var _0x14ab4b=this[_0xff94('0x11')]['streamFile'](_0x44165a,_0xaa34ec[_0xff94('0x138')]);try{fs['unlink'](_0x44165a+_0xff94('0x10a'));}catch(_0x506971){logger['error'](_0x506971);}return _0x14ab4b;}return this['channel'][_0xff94('0x2f')](_0xaa34ec,_0xff94('0x159'));};AGIVertices[_0xff94('0x13')][_0xff94('0x15a')]=function(_0x2e46b8){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x15b'),_0x2e46b8[_0xff94('0x38')]));if(!this['isConfigured'](_0x2e46b8[_0xff94('0x15c')])){return this['channel'][_0xff94('0x2f')](_0x2e46b8,_0xff94('0x15d'));}logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x15e'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));var _0x1eba1c=this[_0xff94('0x55')][_0xff94('0x72')](this,_0x2e46b8[_0xff94('0x15c')]);if(_0x1eba1c){logger[_0xff94('0x31')](util['format'](_0xff94('0x15f'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util['format'](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel'][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')]['logout']=function(_0x41ce4d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x163'),_0x41ce4d[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x41ce4d['findBy'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x41ce4d,_0xff94('0x15d'));}logger[_0xff94('0x31')](util['format'](_0xff94('0x15e'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));var _0x3b9599=this[_0xff94('0x51')][_0xff94('0x72')](this,_0x41ce4d['findBy']);if(_0x3b9599){logger[_0xff94('0x31')](util['format'](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')]['callerid'],_0x41ce4d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')][_0xff94('0x164')]=function(_0x36e105){logger[_0xff94('0x31')](util['format'](_0xff94('0x165'),_0x36e105[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x36e105['operation'])){return this[_0xff94('0x11')]['error'](_0x36e105,_0xff94('0x166'));}this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0x167'),_0x36e105[_0xff94('0x168')]));var _0x2a6e93=eval(_0x36e105[_0xff94('0x168')]);if(!this[_0xff94('0x89')](_0x36e105['variable_id'])){return this[_0xff94('0x11')]['noop'](_0xff94('0x169'));}var _0x103e32=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x36e105['variable_id']);if(!_0x103e32){return this['channel']['error'](_0x36e105,'no\x20variable\x20found');}if(_[_0xff94('0x9e')](_0x2a6e93)){var _0xb500de=this;_0x2a6e93['forEach'](function(_0x3e47cb,_0x13bc23){_0xb500de['channel'][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0x16a'),_0x103e32,_0x13bc23),_0x3e47cb);});return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x16b'),_0x103e32));}else{return this['channel'][_0xff94('0xa3')](_0x103e32,_0x2a6e93);}};AGIVertices['prototype']['menu']=function(_0x370f53){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x16c'),_0x370f53[_0xff94('0x38')]));if(_0x370f53[_0xff94('0xac')]===0x0){return this[_0xff94('0xab')](_0x370f53);}_0x370f53[_0xff94('0xac')]-=0x1;if(!this[_0xff94('0x89')](_0x370f53['file_id'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x370f53,'no\x20file\x20audio\x20selected');}var _0x39665f=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x370f53[_0xff94('0x11a')]);if(!_0x39665f){return this[_0xff94('0x11')]['error'](_0x370f53,_0xff94('0x11c'));}var _0x29a431=this[_0xff94('0x11')][_0xff94('0x11d')](_0x39665f,_0x370f53[_0xff94('0x16d')],_0x370f53['digit']);var _0x2db926=_0x29a431[_0xff94('0xa9')];if(_0x29a431[_0xff94('0xa9')]===-0x1){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x370f53,'-1');return _0x29a431;}else if(_0x29a431[_0xff94('0xa6')]===_0xff94('0x65')){_0x29a431[_0xff94('0xa9')]=_0x29a431[_0xff94('0xa9')][_0xff94('0xa1')]>0x0?_0x29a431[_0xff94('0xa9')]:'t';}else if(_[_0xff94('0x16e')](_0x29a431[_0xff94('0xa9')])){_0x29a431[_0xff94('0xa9')]='#';_0x2db926='#';}if(!this[_0xff94('0x89')](_0x370f53[_0xff94('0xdd')])){this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x169'));}else{var _0x4fa3f5=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x370f53['variable_id']);if(!_0x4fa3f5){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x370f53,_0xff94('0xde'));}this[_0xff94('0x11')][_0xff94('0xa3')](_0x4fa3f5,_0x2db926);}this['createSquareDetailsReport']['sync'](this,_0x370f53,_0x2db926);return _0x29a431;};AGIVertices[_0xff94('0x13')][_0xff94('0xaf')]=function(_0x318d8b){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x318d8b['label']));return this[_0xff94('0x11')][_0xff94('0xaf')](_0x318d8b[_0xff94('0x16f')]||_0x318d8b[_0xff94('0x38')]);};AGIVertices['prototype'][_0xff94('0x170')]=function(_0x4da33d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x171'),_0x4da33d['label']));if(!this[_0xff94('0x89')](_0x4da33d[_0xff94('0x15c')])){return this['channel']['error'](_0x4da33d,_0xff94('0x15d'));}logger[_0xff94('0x31')](util[_0xff94('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xff94('0x11')]['callerid'],_0x4da33d[_0xff94('0x15c')]));var _0xb9202e=this[_0xff94('0x4d')][_0xff94('0x72')](this,_0x4da33d[_0xff94('0x172')]);var _0x348a6f=this['agentPause']['sync'](this,_0x4da33d[_0xff94('0x15c')],_0xb9202e);if(_0x348a6f){logger['info'](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xff94('0x11')]['callerid'],_0x4da33d[_0xff94('0x15c')]));this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0x15f'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x4da33d['findBy']));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel']['callerid'],_0x4da33d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xff94('0x3a')],_0x4da33d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')]['playback']=function(_0x916146){logger['info'](util[_0xff94('0x2d')](_0xff94('0x173'),_0x916146[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x916146['file_id'])){return this['channel'][_0xff94('0x2f')](_0x916146,_0xff94('0x11b'));}var _0x1ae487=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x916146[_0xff94('0x11a')]);if(!_0x1ae487){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x916146,_0xff94('0x11c'));}var _0x1ed6d2=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x174'),[_0x1ae487,_0x916146[_0xff94('0xe9')]]);if(_0x1ed6d2[_0xff94('0xa9')]===-0x1){return _0x1ed6d2;}return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),_0xff94('0x174'),_0x1ae487));};AGIVertices['prototype']['queue']=function(_0x3072b3){logger['info'](util[_0xff94('0x2d')](_0xff94('0x175'),_0x3072b3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x3072b3['queue_id'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x3072b3,_0xff94('0x176'));}var _0x2bba53='';var _0x21b8a7=parseInt(_0x3072b3[_0xff94('0x177')],0xa);if(isNaN(_0x21b8a7)){_0x2bba53=_0x3072b3[_0xff94('0x177')];}else{_0x2bba53=this[_0xff94('0x178')][_0xff94('0x72')](this,_0x3072b3[_0xff94('0x177')]);if(!_0x2bba53){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x3072b3,_0xff94('0x179'));}}var _0x409f55='';if(this[_0xff94('0x89')](_0x3072b3[_0xff94('0x11a')])){var _0x2ee660=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x3072b3[_0xff94('0x11a')]);if(_0x2ee660){_0x409f55=_0x2ee660;}}this[_0xff94('0x36')][_0xff94('0x72')](this,_0x3072b3,_0x2bba53);if(_0x3072b3[_0xff94('0xe9')]['indexOf']('x')<0x0){_0x3072b3[_0xff94('0xe9')]+='x';}if(_0x3072b3['opts'][_0xff94('0x17a')]('X')<0x0){_0x3072b3[_0xff94('0xe9')]+='X';}this[_0xff94('0x11')][_0xff94('0xa3')](_0xff94('0x17b'),_0x2bba53?_0x2bba53[_0xff94('0x17c')]():'');var _0x5f06be=this['channel'][_0xff94('0x57')](_0xff94('0x17d'),[_0x2bba53,_0x3072b3[_0xff94('0xe9')],_0x3072b3[_0xff94('0xea')],_0x409f55,_0x3072b3['timeout'],_0x3072b3['agi'],_0x3072b3[_0xff94('0x17e')],_0x3072b3[_0xff94('0x17f')],'',_0x3072b3[_0xff94('0x180')]]);if(_0x5f06be['result']===-0x1){return _0x5f06be;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),'QUEUE',_0x2bba53));};AGIVertices[_0xff94('0x13')]['record']=function(_0x3d8f9a){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3d8f9a[_0xff94('0x38')]));var _0xe29e76=_0x3d8f9a['recordingFormat']||'wav';var _0x5b8497=util['format'](_0xff94('0x181'),this[_0xff94('0x11')]['uniqueid'],rs[_0xff94('0x121')](0x5));var _0x491d9f=util[_0xff94('0x2d')](_0xff94('0x182'),FILES_PATH,_0x5b8497,_0xe29e76);var _0x4d7fba=util[_0xff94('0x2d')]('%s/recordings/%s',FILES_PATH,_0x5b8497);this[_0xff94('0x3b')][_0xff94('0x72')](this,_0x3d8f9a,_0x5b8497,_0x491d9f);this[_0xff94('0x11')][_0xff94('0xa3')](_0xff94('0x183'),_0x5b8497);logger[_0xff94('0x31')](_0xff94('0x184'),_0x4d7fba,_0xe29e76,_0x3d8f9a[_0xff94('0x185')],_0x3d8f9a[_0xff94('0x65')]);return this['channel'][_0xff94('0x137')](_0x4d7fba,_0xe29e76,_0x3d8f9a[_0xff94('0x185')],_0x3d8f9a[_0xff94('0x65')],undefined,!![]);};AGIVertices[_0xff94('0x13')]['restapi']=function(_0x581b7c){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x581b7c[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x581b7c['url'])){return this[_0xff94('0x11')]['noop']('no\x20url\x20configured');}var _0x4477a1=this['restAPI'][_0xff94('0x72')](this,_0x581b7c);logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Response:',util[_0xff94('0x186')](_0x4477a1,{'showHidden':![],'depth':null})));if(!this[_0xff94('0x89')](_0x581b7c[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1846b3=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x581b7c[_0xff94('0xdd')]);if(!_0x1846b3){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x581b7c,_0xff94('0xde'));}this[_0xff94('0x11')]['setVariable'](util['format'](_0xff94('0x187'),_0x1846b3),_0x4477a1['statusCode']?_0x4477a1[_0xff94('0x78')]:'200');this[_0xff94('0x11')][_0xff94('0xa3')](util['format'](_0xff94('0x188'),_0x1846b3),_0x4477a1['statusMessage']?_0x4477a1[_0xff94('0x77')]:'OK');if(_0x4477a1[_0xff94('0x6b')]){try{this[_0xff94('0xa0')](_0x4477a1[_0xff94('0x6b')],_0x1846b3);}catch(_0x5c176f){logger[_0xff94('0x2f')](util[_0xff94('0x2d')](_0xff94('0x189'),_0x1846b3));}}return this['channel']['noop'](util[_0xff94('0x2d')](_0xff94('0xe2'),_0x1846b3));};AGIVertices[_0xff94('0x13')][_0xff94('0x18a')]=function(_0x15a836){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x15a836[_0xff94('0x38')]));return this['channel'][_0xff94('0x18b')](_0x15a836['digits'][_0xff94('0x59')](/\s+/g,''),_0x15a836[_0xff94('0x185')]);};AGIVertices['prototype'][_0xff94('0x18c')]=function(_0x570fe3){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x18d'),_0x570fe3[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0x18e')](_0x570fe3[_0xff94('0x18f')][_0xff94('0x59')](/\s+/g,''),_0x570fe3[_0xff94('0x185')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x190')]=function(_0x393c82){logger[_0xff94('0x31')](util['format'](_0xff94('0x191'),_0x393c82[_0xff94('0x38')]));return this['channel'][_0xff94('0x192')](_0x393c82[_0xff94('0x5d')],_0x393c82[_0xff94('0x185')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x193')]=function(_0x1f089f){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x194'),_0x1f089f[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x1f089f['account_id'])){return this['channel']['noop'](_0xff94('0x195'));}var _0x1b352e=this[_0xff94('0x25')]['sync'](this,_0x1f089f[_0xff94('0x196')]);if(!_0x1b352e||!_0x1b352e[_0xff94('0x197')]){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x1f089f,'no\x20mail\x20account\x20found');}var _0x36e6c2={'from':util[_0xff94('0x2d')](_0xff94('0x198'),_0x1b352e[_0xff94('0x17')],_0x1b352e[_0xff94('0x199')]||_0x1b352e[_0xff94('0x197')]['user']),'to':_0x1f089f['to']||'','cc':_0x1f089f['cc']||'','bcc':_0x1f089f[_0xff94('0x19a')]||'','subject':_0x1f089f[_0xff94('0x19b')],'html':_0x1f089f['text'],'text':_0x1f089f[_0xff94('0x5d')]};var _0x4b13bd={'tls':{'rejectUnauthorized':![]}};if(_0x1b352e[_0xff94('0x197')][_0xff94('0x19c')]){_0x4b13bd[_0xff94('0x19c')]=_0x1b352e[_0xff94('0x197')][_0xff94('0x19c')];}else{_0x4b13bd[_0xff94('0x19d')]=_0x1b352e[_0xff94('0x197')]['host'];_0x4b13bd['port']=_0x1b352e['Smtp'][_0xff94('0x19e')];_0x4b13bd[_0xff94('0x19f')]=_0x1b352e['Smtp'][_0xff94('0x19f')];}if(_0x1b352e['Smtp'][_0xff94('0x1a0')]){_0x4b13bd[_0xff94('0x1a1')]={'user':_0x1b352e['Smtp']['user'],'pass':_0x1b352e[_0xff94('0x197')][_0xff94('0x1a2')]};}if(this[_0xff94('0x89')](_0x1f089f['template_id'])){}logger[_0xff94('0x1a3')](_0xff94('0x1a4'),JSON[_0xff94('0x75')](_0x36e6c2));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x1f089f,_0x1f089f[_0xff94('0x196')]);this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1a5'),_0x1b352e[_0xff94('0x17')]));this[_0xff94('0x27')][_0xff94('0x72')](this,_0x4b13bd,_0x36e6c2);return this['channel'][_0xff94('0xaf')](_0xff94('0x1a6'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1a7')]=function(_0x527334){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x527334[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x1a8'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1a9')]=function(_0x285497){logger[_0xff94('0x31')](util['format'](_0xff94('0x1aa'),_0x285497[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x285497[_0xff94('0x1ab')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20sms\x20account\x20configured');}var _0xca53d=this['getSmsAccount'][_0xff94('0x72')](this,_0x285497[_0xff94('0x1ab')]);if(!_0xca53d){return this[_0xff94('0x11')]['error'](_0x285497,_0xff94('0x1ac'));}var _0x1e1782={'body':_0x285497[_0xff94('0x1ad')],'phone':_0x285497['to']||'','SmsAccountId':_0xca53d['id']};logger[_0xff94('0x1a3')](_0xff94('0x1ae'),JSON['stringify'](_0x1e1782));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x285497,_0x285497[_0xff94('0x1ab')]);this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1af'),_0xca53d[_0xff94('0x17')]));this['createSmsMessage']['sync'](this,_0x1e1782);return this[_0xff94('0x11')]['noop'](_0xff94('0x1b0'));};AGIVertices['prototype'][_0xff94('0x1b1')]=function(_0x110ee2){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1b2'),_0x110ee2[_0xff94('0x38')]));if(!this['isConfigured'](_0x110ee2[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x110ee2,_0xff94('0x1b3'));}var _0x443d93=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x110ee2[_0xff94('0xdd')]);if(!_0x443d93){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x110ee2,_0xff94('0xde'));}return this[_0xff94('0x11')][_0xff94('0xa3')](_0x443d93,_0x110ee2['variable_value']);};AGIVertices['prototype'][_0xff94('0x1b4')]=function(_0x379034){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1b5'),_0x379034[_0xff94('0x38')]));this['channel']['noop'](_0xff94('0x1b6'));if(_0x379034[_0xff94('0xbb')]===_0xff94('0x1b7')){this['channel'][_0xff94('0xaf')](_0xff94('0x1b8'));return this[_0xff94('0x11')]['answer']();}return this[_0xff94('0x11')][_0xff94('0xaf')]('Skipped\x20Answer');};AGIVertices[_0xff94('0x13')][_0xff94('0x1b9')]=function(_0x5c308e){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1ba'),_0x5c308e[_0xff94('0x38')]));if(!this['isConfigured'](_0x5c308e[_0xff94('0x1bb')])){return this[_0xff94('0x11')]['error'](_0x5c308e,_0xff94('0x1bc'));}var _0x845576=this[_0xff94('0x1b')]['sync'](this,_0x5c308e[_0xff94('0x1bb')]);if(!this[_0xff94('0x89')](_0x845576)){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x5c308e,util['format'](_0xff94('0x1bd'),_0x5c308e['project_id']));}if(_0x845576===this['channel'][_0xff94('0x1be')]){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x5c308e,_0xff94('0x1bf'));}this[_0xff94('0x36')][_0xff94('0x72')](this,_0x5c308e,_0x845576);var _0xfe9ff6=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x1c0'),util[_0xff94('0x2d')](_0xff94('0x1c1'),config['agi'][_0xff94('0x19d')]||_0xff94('0x1c2'),_0x845576,this['channel'][_0xff94('0x1be')]));if(_0xfe9ff6[_0xff94('0xa9')]===-0x1){return _0xfe9ff6;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Executed\x20command\x20%s\x20%s',_0xff94('0x1c0'),_0x845576));};AGIVertices['prototype']['system']=function(_0x1cda3e){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1c3'),_0x1cda3e[_0xff94('0x38')]));var _0x475113=this['shellCommand']['sync'](this,_0x1cda3e[_0xff94('0xb9')]);this[_0xff94('0x36')][_0xff94('0x72')](this,_0x1cda3e,_0x1cda3e['command']);if(this[_0xff94('0x89')](_0x1cda3e[_0xff94('0xdd')])){var _0x294066=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x1cda3e['variable_id']);if(_0x294066){this[_0xff94('0x11')]['setVariable'](_0x294066,_0x475113);return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1c4'),_0x1cda3e[_0xff94('0xb9')],_0x294066));}}return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1c5'),_0x1cda3e['command']));};AGIVertices[_0xff94('0x13')][_0xff94('0x1c6')]=function(_0x44132){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x44132[_0xff94('0x38')]));_0x44132['text']=_0x44132[_0xff94('0x5d')][_0xff94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xff94('0x89')](_0x44132['apiKey'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20apiKey\x20configured');}if(!this[_0xff94('0x89')](_0x44132['text'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0x1c7'),_0x44132[_0xff94('0x5d')]));var _0x5dcbfa=this[_0xff94('0x5a')][_0xff94('0x72')](this,_0x44132);if(_0x5dcbfa){this[_0xff94('0x11')]['noop'](util['format'](_0xff94('0x1c8'),_0x5dcbfa));var _0x4bb19a=this[_0xff94('0x11')]['streamFile'](_0x5dcbfa);try{fs[_0xff94('0x109')](_0x5dcbfa+'.wav');}catch(_0x46dd1c){logger['error'](_0x46dd1c);}return _0x4bb19a;}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x44132,_0xff94('0x1c9'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1ca')]=function(_0xe875cd){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1cb'),_0xe875cd['label']));_0xe875cd[_0xff94('0x5d')]=_0xe875cd['text'][_0xff94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xff94('0x89')](_0xe875cd[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1cc'),_0xe875cd['text']));var _0x2da0ad=this[_0xff94('0x63')][_0xff94('0x72')](this,_0xe875cd);if(_0x2da0ad){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Google\x20TTS\x20%s\x20file\x20created',_0x2da0ad));var _0x410c7b=this['channel'][_0xff94('0x108')](_0x2da0ad);try{}catch(_0x4d6570){logger[_0xff94('0x2f')](_0x4d6570);}return _0x410c7b;}return this[_0xff94('0x11')][_0xff94('0x2f')](_0xe875cd,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')][_0xff94('0x1cd')]=function(_0x323335){logger[_0xff94('0x31')](util['format'](_0xff94('0x1ce'),_0x323335[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x323335[_0xff94('0x15c')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x323335,'no\x20find\x20by\x20configured');}logger['info'](util[_0xff94('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xff94('0x11')][_0xff94('0x3a')],_0x323335[_0xff94('0x15c')]));var _0x37615b=this[_0xff94('0x50')][_0xff94('0x72')](this,_0x323335[_0xff94('0x15c')]);if(_0x37615b){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xff94('0x11')]['callerid'],_0x323335[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel']['callerid'],_0x323335[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x323335['findBy']));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel'][_0xff94('0x3a')],_0x323335[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices['prototype']['voicemail']=function(_0x3029c6){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1cf'),_0x3029c6['label']));var _0x138122=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x1d0'),[_0x3029c6[_0xff94('0x1d1')],_0x3029c6[_0xff94('0x7b')]]);if(_0x138122[_0xff94('0xa9')]===-0x1){return _0x138122;}return this[_0xff94('0x11')]['noop'](util['format'](_0xff94('0xc7'),_0xff94('0x1d0'),_0x3029c6[_0xff94('0x1d1')]));};AGIVertices[_0xff94('0x13')][_0xff94('0x1d2')]=function(_0x32ee2f){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1d3'),_0x32ee2f[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x32ee2f[_0xff94('0xdd')])){return this['channel'][_0xff94('0x2f')](_0x32ee2f,_0xff94('0x1b3'));}var _0x30887d=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x32ee2f['variable_id']);if(!_0x30887d){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x32ee2f,_0xff94('0xde'));}var _0x148ff4=this[_0xff94('0x11')][_0xff94('0x14')](_0x30887d);return{'code':0xc8,'result':_0x148ff4[_0xff94('0xa6')]?_0x148ff4['extra']:'-'};};String['prototype'][_0xff94('0xa5')]=function(_0x576c0b,_0x164ff4){return this[_0xff94('0xa4')](_0x576c0b)[_0xff94('0x1d4')](_0x164ff4);};module[_0xff94('0x1d5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5ccd6f0..51f5850 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 _0x207c=['syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','agents','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels'];(function(_0x3b2377,_0x1be5c4){var _0x4defd8=function(_0x1d21f0){while(--_0x1d21f0){_0x3b2377['push'](_0x3b2377['shift']());}};_0x4defd8(++_0x1be5c4);}(_0x207c,0x1e8));var _0xc207=function(_0x4b3ec4,_0x3c573c){_0x4b3ec4=_0x4b3ec4-0x0;var _0x192836=_0x207c[_0x4b3ec4];return _0x192836;};'use strict';var util=require('util');var _=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var ami=require(_0xc207('0x2'));var logger=require(_0xc207('0x3'))(_0xc207('0x4'));var RpcUser=require(_0xc207('0x5'));var RpcVoiceAgentReport=require(_0xc207('0x6'));function Acw(_0x4b9daa){this[_0xc207('0x7')]=_0x4b9daa['voiceQueues'];this['agents']=_0x4b9daa['agents'];this[_0xc207('0x8')]=_0x4b9daa[_0xc207('0x8')];this[_0xc207('0x9')]={};ami['on']('agentconnect',this[_0xc207('0xa')][_0xc207('0xb')](this));ami['on'](_0xc207('0xc'),this['syncHangupRequest'][_0xc207('0xb')](this));ami['on'](_0xc207('0xd'),this[_0xc207('0xe')][_0xc207('0xb')](this));ami['on'](_0xc207('0xf'),this[_0xc207('0x10')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xc207('0xb')](this));ami['on']('blindtransfer',this[_0xc207('0x11')][_0xc207('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xc207('0x12')][_0xc207('0xb')](this));}function getDiff(_0x3062f5){var _0x32acbf=moment()[_0xc207('0x13')](0x0);var _0x51e967=moment(_0x3062f5)[_0xc207('0x13')](0x0);return _0x32acbf[_0xc207('0x14')](_0x51e967,_0xc207('0x15'));}Acw[_0xc207('0x16')]['startAcw']=function(_0x564cef){try{var _0x554e5c=this;var _0x1cebfa=this[_0xc207('0x9')][_0x564cef][_0xc207('0x17')];var _0x65f539=this['channels'][_0x564cef][_0xc207('0x18')];var _0x282595=this[_0xc207('0x7')][_0x65f539];var _0x5f288e=![];var _0x4129b8='ACW';if(_0x282595[_0xc207('0x19')]){if(_0x282595[_0xc207('0x1a')][_0xc207('0x1b')]){_0x5f288e=!![];_0x4129b8=_0x282595[_0xc207('0x1a')][_0xc207('0x1b')];}}ami[_0xc207('0x1c')]({'action':_0xc207('0x1d'),'interface':_0x1cebfa,'paused':!![],'reason':_0x4129b8})[_0xc207('0x1e')](function(_0x212005){if(_0x554e5c[_0xc207('0x1f')][_0x1cebfa]){return RpcUser[_0xc207('0x20')](_0x554e5c[_0xc207('0x1f')][_0x1cebfa]['id'])[_0xc207('0x1e')](function(_0x4b52a7){if(_0x4b52a7&&!_0x4b52a7[_0xc207('0x21')]){logger['info'](_0xc207('0x22'),_0x564cef,_0x1cebfa,_0x65f539);var _0x3ac142=_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x23')]&&_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x24')]?_0x554e5c[_0xc207('0x9')][_0x564cef][_0xc207('0x24')]:_0x564cef;return RpcUser[_0xc207('0x25')](_0x554e5c[_0xc207('0x1f')][_0x1cebfa],_0x4129b8,_0x3ac142)[_0xc207('0x1e')](function(_0x27df03){if(!_0x5f288e){_0x554e5c[_0xc207('0x8')][_0x1cebfa]={};logger[_0xc207('0x26')](_0xc207('0x27'),_0x564cef,_0x554e5c['voiceQueues'][_0x65f539][_0xc207('0x28')],_0x1cebfa,_0x65f539);_0x554e5c['timers'][_0x1cebfa]['timer']=setTimeout(_0x554e5c[_0xc207('0x29')][_0xc207('0xb')](_0x554e5c,_0x1cebfa),_0x554e5c[_0xc207('0x7')][_0x65f539][_0xc207('0x28')]*0x3e8);_0x554e5c[_0xc207('0x8')][_0x1cebfa]['lastPauseAt']=moment()[_0xc207('0x2a')](_0xc207('0x2b'));_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2c')]=_0x564cef;_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x18')]=_0x65f539;_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2d')]=function(){var _0xc6a7ce=getDiff(_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2e')]);clearTimeout(_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2f')]);_0x554e5c['timers'][_0x1cebfa][_0xc207('0x2f')]=![];RpcVoiceAgentReport[_0xc207('0x30')]({'acwtime':_0xc6a7ce},_0x554e5c[_0xc207('0x8')][_0x1cebfa][_0xc207('0x2c')],_0x1cebfa)[_0xc207('0x1e')](function(_0x2ce133){logger['info'](_0xc207('0x31'),_0x564cef,_0xc6a7ce,_0x2ce133);})[_0xc207('0x32')](function(_0x3899dd){logger[_0xc207('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x564cef,_0x3899dd);});delete _0x554e5c[_0xc207('0x8')][_0x1cebfa];};}});}else{logger[_0xc207('0x26')](_0xc207('0x34'),_0x564cef,_0x1cebfa,_0x65f539);}});}})[_0xc207('0x32')](function(_0x1a8359){logger[_0xc207('0x33')](_0xc207('0x27'),_0x564cef,_0x554e5c[_0xc207('0x7')][_0x65f539][_0xc207('0x28')],_0x1cebfa,_0x65f539);})['finally'](function(){delete _0x554e5c['channels'][_0x564cef];});}catch(_0x188c39){logger[_0xc207('0x33')](_0xc207('0x35'),_0x188c39[_0xc207('0x36')]);}};Acw['prototype'][_0xc207('0x29')]=function(_0x433c0f){try{var _0x20a5eb=this;if(_0x20a5eb[_0xc207('0x8')][_0x433c0f]){_0x20a5eb[_0xc207('0x8')][_0x433c0f]['timer']=![];var _0x219b0b=_0x20a5eb[_0xc207('0x8')][_0x433c0f]['uniqueid'];var _0x21dd42=_0x20a5eb['timers'][_0x433c0f][_0xc207('0x18')];var _0x1f69f9=_0x20a5eb['voiceQueues'][_0x21dd42][_0xc207('0x28')];logger[_0xc207('0x26')](_0xc207('0x37'),_0x433c0f);RpcUser['saveUnpause'](this['agents'][_0x433c0f]);RpcVoiceAgentReport[_0xc207('0x30')]({'acwtime':_0x1f69f9,'agentacw':!![]},_0x219b0b,_0x433c0f)[_0xc207('0x1e')](function(_0x41d66c){logger[_0xc207('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x219b0b,_0x1f69f9,_0x41d66c);})[_0xc207('0x32')](function(_0x47cdc4){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x219b0b,_0x47cdc4);});}else{logger['error'](_0xc207('0x38'),_0x433c0f);if(_0x20a5eb[_0xc207('0x8')]){logger[_0xc207('0x26')]('[ACW][TIMERS]',JSON[_0xc207('0x39')](_0x20a5eb[_0xc207('0x8')]));}}}catch(_0x3e7cd9){logger[_0xc207('0x33')]('[ACW][STOP]\x20%s',_0x3e7cd9[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0xa')]=function(_0x46aa9f){try{if(this[_0xc207('0x7')][_0x46aa9f['queue']]&&(this[_0xc207('0x7')][_0x46aa9f[_0xc207('0x18')]][_0xc207('0x4')]||this[_0xc207('0x7')][_0x46aa9f[_0xc207('0x18')]][_0xc207('0x19')])){if(this[_0xc207('0x1f')][_0x46aa9f[_0xc207('0x17')]]){this[_0xc207('0x9')][_0x46aa9f['uniqueid']]={'queue':_0x46aa9f[_0xc207('0x18')],'interface':_0x46aa9f[_0xc207('0x17')],'destlinkedid':_0x46aa9f['destlinkedid']};}}}catch(_0x141e34){logger[_0xc207('0x33')](_0xc207('0x3a'),_0x141e34[_0xc207('0x36')]);}};Acw[_0xc207('0x16')]['syncAgentConnectPreview']=function(_0x11989b){try{if(this[_0xc207('0x7')][_0x11989b[_0xc207('0x18')]]&&(this['voiceQueues'][_0x11989b[_0xc207('0x18')]][_0xc207('0x4')]||this[_0xc207('0x7')][_0x11989b[_0xc207('0x18')]]['mandatoryDisposition'])){if(this['agents'][_0x11989b[_0xc207('0x17')]]){this[_0xc207('0x9')][_0x11989b[_0xc207('0x2c')]]={'queue':_0x11989b[_0xc207('0x18')],'interface':_0x11989b[_0xc207('0x17')]};}}}catch(_0x31baa0){logger[_0xc207('0x33')](_0xc207('0x3b'),_0x31baa0[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x3c')]=function(_0x2fda4f){try{if(this['channels'][_0x2fda4f['uniqueid']]&&_[_0xc207('0x3d')](this[_0xc207('0x9')][_0x2fda4f[_0xc207('0x2c')]]['attended'])){logger[_0xc207('0x26')](_0xc207('0x3e'),_0x2fda4f[_0xc207('0x2c')]);this[_0xc207('0x3f')](_0x2fda4f['uniqueid']);}else if(this[_0xc207('0x9')][_0x2fda4f['linkedid']]&&_[_0xc207('0x3d')](this['channels'][_0x2fda4f['linkedid']][_0xc207('0x23')])){logger[_0xc207('0x26')]('[%s][HANGUP:LINKEDID]',_0x2fda4f['linkedid']);this['startAcw'](_0x2fda4f[_0xc207('0x40')]);}}catch(_0x462958){logger[_0xc207('0x33')](_0xc207('0x41'),_0x462958[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0xe')]=function(_0x1dfdee){try{if(this['channels'][_0x1dfdee[_0xc207('0x2c')]]&&this[_0xc207('0x9')][_0x1dfdee['uniqueid']]['attended']){logger[_0xc207('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1dfdee['uniqueid']);this[_0xc207('0x3f')](_0x1dfdee[_0xc207('0x2c')]);}else if(this[_0xc207('0x9')][_0x1dfdee[_0xc207('0x40')]]&&this[_0xc207('0x9')][_0x1dfdee[_0xc207('0x40')]][_0xc207('0x23')]){logger[_0xc207('0x26')](_0xc207('0x42'),_0x1dfdee[_0xc207('0x40')]);this[_0xc207('0x3f')](_0x1dfdee['linkedid']);}}catch(_0x529a21){logger[_0xc207('0x33')](_0xc207('0x43'),_0x529a21[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x44')]=function(_0x21c12b){try{if(!_[_0xc207('0x45')](this[_0xc207('0x9')][_0x21c12b[_0xc207('0x46')]])){this['startAcw'](_0x21c12b[_0xc207('0x46')]);if(this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]]){this[_0xc207('0x9')][_0x21c12b['secondtransfereruniqueid']][_0xc207('0x23')]=!![];this[_0xc207('0x9')][_0x21c12b[_0xc207('0x48')]]=this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]];delete this[_0xc207('0x9')][_0x21c12b[_0xc207('0x47')]];}}else if(!_['isNil'](this[_0xc207('0x9')][_0x21c12b[_0xc207('0x48')]])){this[_0xc207('0x3f')](_0x21c12b[_0xc207('0x48')]);if(this['channels'][_0x21c12b[_0xc207('0x49')]]){this['channels'][_0x21c12b['origtransfereruniqueid']][_0xc207('0x23')]=!![];this[_0xc207('0x9')][_0x21c12b[_0xc207('0x46')]]=this[_0xc207('0x9')][_0x21c12b[_0xc207('0x49')]];delete this[_0xc207('0x9')][_0x21c12b[_0xc207('0x49')]];}}}catch(_0x33c372){logger[_0xc207('0x33')](_0xc207('0x4a'),_0x33c372[_0xc207('0x36')]);}};Acw[_0xc207('0x16')][_0xc207('0x11')]=function(_0x3ed4b2){try{if(this[_0xc207('0x9')][_0x3ed4b2['transfereruniqueid']]){logger[_0xc207('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xc207('0x39')](_0x3ed4b2[_0xc207('0x4b')]));this[_0xc207('0x3f')](_0x3ed4b2['transfereruniqueid']);}else if(this['channels'][_0x3ed4b2[_0xc207('0x4c')]]){logger[_0xc207('0x26')](_0xc207('0x4d'),JSON['stringify'](_0x3ed4b2[_0xc207('0x4c')]));this[_0xc207('0x3f')](_0x3ed4b2[_0xc207('0x4c')]);}}catch(_0x4967b4){logger['error'](_0xc207('0x4e'),_0x4967b4['message']);}};Acw[_0xc207('0x16')][_0xc207('0x10')]=function(_0x3cca53){try{if(this[_0xc207('0x7')][_0x3cca53[_0xc207('0x18')]]&&this[_0xc207('0x7')][_0x3cca53[_0xc207('0x18')]][_0xc207('0x4f')]==='all'){if(this[_0xc207('0x1f')][_0x3cca53[_0xc207('0x17')]]){logger[_0xc207('0x26')](_0xc207('0x50'),_0x3cca53[_0xc207('0x2c')],_0x3cca53[_0xc207('0x17')],_0x3cca53[_0xc207('0x18')]);return RpcUser[_0xc207('0x25')](this[_0xc207('0x1f')][_0x3cca53[_0xc207('0x17')]],_0xc207('0x51'),_0x3cca53['uniqueid']);}}}catch(_0x20e130){logger[_0xc207('0x33')](_0xc207('0x52'),_0x20e130[_0xc207('0x36')]);}};module['exports']=Acw; \ No newline at end of file +var _0xf3cd=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xf3cd[_0x42c118];return _0x112ebd;};'use strict';var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var ami=require(_0xdf3c('0x3'));var logger=require(_0xdf3c('0x4'))(_0xdf3c('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdf3c('0x6'));function Acw(_0x71b446){this[_0xdf3c('0x7')]=_0x71b446['voiceQueues'];this[_0xdf3c('0x8')]=_0x71b446[_0xdf3c('0x8')];this[_0xdf3c('0x9')]=_0x71b446[_0xdf3c('0x9')];this[_0xdf3c('0xa')]={};ami['on'](_0xdf3c('0xb'),this['syncAgentConnect'][_0xdf3c('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xd'),this['syncHangup'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xe'),this[_0xdf3c('0xf')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x10'),this[_0xdf3c('0x11')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x12'),this['syncBlindTransfer'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x13'),this[_0xdf3c('0x14')][_0xdf3c('0xc')](this));}function getDiff(_0x59e431){var _0x2ae4ad=moment()[_0xdf3c('0x15')](0x0);var _0x13ea5f=moment(_0x59e431)['milliseconds'](0x0);return _0x2ae4ad[_0xdf3c('0x16')](_0x13ea5f,_0xdf3c('0x17'));}Acw[_0xdf3c('0x18')][_0xdf3c('0x19')]=function(_0x21e587){try{var _0x1a7a5a=this;var _0x305ea5=this[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x1a')];var _0x5d3991=this['channels'][_0x21e587][_0xdf3c('0x1b')];var _0x465e7d=this[_0xdf3c('0x7')][_0x5d3991];var _0x18d4ec=![];var _0x1e2690=_0xdf3c('0x1c');if(_0x465e7d[_0xdf3c('0x1d')]){if(_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')]){_0x18d4ec=!![];_0x1e2690=_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')];}}ami[_0xdf3c('0x20')]({'action':_0xdf3c('0x21'),'interface':_0x305ea5,'paused':!![],'reason':_0x1e2690})['then'](function(_0x4d620f){if(_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]){return RpcUser['getAgent'](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]['id'])[_0xdf3c('0x22')](function(_0x36552e){if(_0x36552e&&!_0x36552e[_0xdf3c('0x23')]){logger[_0xdf3c('0x24')](_0xdf3c('0x25'),_0x21e587,_0x305ea5,_0x5d3991);var _0x50d8ca=_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x26')]&&_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]?_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]:_0x21e587;return RpcUser[_0xdf3c('0x28')](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5],_0x1e2690,_0x50d8ca)[_0xdf3c('0x22')](function(_0x1adee4){if(!_0x18d4ec){_0x1a7a5a['timers'][_0x305ea5]={};logger[_0xdf3c('0x24')](_0xdf3c('0x29'),_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);_0x1a7a5a['timers'][_0x305ea5]['timer']=setTimeout(_0x1a7a5a['stopAcw'][_0xdf3c('0xc')](_0x1a7a5a,_0x305ea5),_0x1a7a5a[_0xdf3c('0x7')][_0x5d3991]['acwTimeout']*0x3e8);_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2b')]=moment()[_0xdf3c('0x2c')](_0xdf3c('0x2d'));_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5]['uniqueid']=_0x21e587;_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x1b')]=_0x5d3991;_0x1a7a5a['timers'][_0x305ea5]['updateAcw']=function(){var _0x1f1d8a=getDiff(_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2b')]);clearTimeout(_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2e')]);_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2e')]=![];RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1f1d8a},_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x30')],_0x305ea5)[_0xdf3c('0x22')](function(_0x522e5f){logger[_0xdf3c('0x24')](_0xdf3c('0x31'),_0x21e587,_0x1f1d8a,_0x522e5f);})[_0xdf3c('0x32')](function(_0x2287f){logger['error'](_0xdf3c('0x33'),_0x21e587,_0x2287f);});delete _0x1a7a5a[_0xdf3c('0x9')][_0x305ea5];};}});}else{logger[_0xdf3c('0x24')](_0xdf3c('0x34'),_0x21e587,_0x305ea5,_0x5d3991);}});}})['catch'](function(_0x474564){logger[_0xdf3c('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);})['finally'](function(){delete _0x1a7a5a[_0xdf3c('0xa')][_0x21e587];});}catch(_0x5e8130){logger['error']('[ACW][START]\x20%s',_0x5e8130[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x37')]=function(_0x29b5b7){try{var _0x54c25f=this;if(_0x54c25f['timers'][_0x29b5b7]){_0x54c25f[_0xdf3c('0x9')][_0x29b5b7]['timer']=![];var _0x46e40f=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x30')];var _0xcdd731=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x1b')];var _0x1c7335=_0x54c25f[_0xdf3c('0x7')][_0xcdd731][_0xdf3c('0x2a')];logger['info'](_0xdf3c('0x38'),_0x29b5b7);RpcUser['saveUnpause'](this['agents'][_0x29b5b7]);RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1c7335,'agentacw':!![]},_0x46e40f,_0x29b5b7)['then'](function(_0xccce51){logger['info'](_0xdf3c('0x31'),_0x46e40f,_0x1c7335,_0xccce51);})[_0xdf3c('0x32')](function(_0x1c6dee){logger[_0xdf3c('0x35')](_0xdf3c('0x33'),_0x46e40f,_0x1c6dee);});}else{logger[_0xdf3c('0x35')](_0xdf3c('0x39'),_0x29b5b7);if(_0x54c25f[_0xdf3c('0x9')]){logger[_0xdf3c('0x24')](_0xdf3c('0x3a'),JSON[_0xdf3c('0x3b')](_0x54c25f[_0xdf3c('0x9')]));}}}catch(_0x57e0ab){logger['error'](_0xdf3c('0x3c'),_0x57e0ab['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3d')]=function(_0x46194d){try{if(this[_0xdf3c('0x7')][_0x46194d['queue']]&&(this['voiceQueues'][_0x46194d[_0xdf3c('0x1b')]][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x46194d['queue']][_0xdf3c('0x1d')])){if(this[_0xdf3c('0x8')][_0x46194d[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x46194d['uniqueid']]={'queue':_0x46194d[_0xdf3c('0x1b')],'interface':_0x46194d[_0xdf3c('0x1a')],'destlinkedid':_0x46194d[_0xdf3c('0x27')]};}}}catch(_0x3f4d7f){logger[_0xdf3c('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x3f4d7f[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x14')]=function(_0x2456cf){try{if(this[_0xdf3c('0x7')][_0x2456cf[_0xdf3c('0x1b')]]&&(this['voiceQueues'][_0x2456cf['queue']][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x2456cf['queue']]['mandatoryDisposition'])){if(this[_0xdf3c('0x8')][_0x2456cf[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x2456cf[_0xdf3c('0x30')]]={'queue':_0x2456cf[_0xdf3c('0x1b')],'interface':_0x2456cf[_0xdf3c('0x1a')]};}}}catch(_0x466ea1){logger[_0xdf3c('0x35')](_0xdf3c('0x3e'),_0x466ea1['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3f')]=function(_0x1c293d){try{if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x30')]]&&_[_0xdf3c('0x40')](this[_0xdf3c('0xa')][_0x1c293d['uniqueid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x41'),_0x1c293d['uniqueid']);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x42')]]&&_['isUndefined'](this['channels'][_0x1c293d['linkedid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x43'),_0x1c293d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x42')]);}}catch(_0x3b17d9){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3b17d9[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')]['syncHangup']=function(_0x3b215d){try{if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b215d['uniqueid']);this[_0xdf3c('0x19')](_0x3b215d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')](_0xdf3c('0x44'),_0x3b215d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x3b215d['linkedid']);}}catch(_0x1eebcf){logger['error']('[ACW][syncHangup]\x20%s',_0x1eebcf['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1afc6c){try{if(!_[_0xdf3c('0x45')](this['channels'][_0x1afc6c[_0xdf3c('0x46')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfereeuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]]){this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]]=this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];}}else if(!_['isNil'](this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfertargetuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]]){this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c['transfereeuniqueid']]=this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]];}}}catch(_0x163adc){logger[_0xdf3c('0x35')](_0xdf3c('0x4a'),_0x163adc[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x4b')]=function(_0x2922d8){try{if(this[_0xdf3c('0xa')][_0x2922d8[_0xdf3c('0x4c')]]){logger[_0xdf3c('0x24')](_0xdf3c('0x4d'),JSON[_0xdf3c('0x3b')](_0x2922d8[_0xdf3c('0x4c')]));this[_0xdf3c('0x19')](_0x2922d8[_0xdf3c('0x4c')]);}else if(this['channels'][_0x2922d8['transfererlinkedid']]){logger[_0xdf3c('0x24')](_0xdf3c('0x4e'),JSON[_0xdf3c('0x3b')](_0x2922d8['transfererlinkedid']));this[_0xdf3c('0x19')](_0x2922d8['transfererlinkedid']);}}catch(_0x574852){logger[_0xdf3c('0x35')](_0xdf3c('0x4f'),_0x574852[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0xf')]=function(_0x9b7034){try{if(this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]]&&this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]][_0xdf3c('0x50')]===_0xdf3c('0x51')){if(this[_0xdf3c('0x8')][_0x9b7034['interface']]){logger[_0xdf3c('0x24')](_0xdf3c('0x52'),_0x9b7034[_0xdf3c('0x30')],_0x9b7034[_0xdf3c('0x1a')],_0x9b7034[_0xdf3c('0x1b')]);return RpcUser['savePause'](this[_0xdf3c('0x8')][_0x9b7034[_0xdf3c('0x1a')]],_0xdf3c('0x53'),_0x9b7034[_0xdf3c('0x30')]);}}}catch(_0x1efa9c){logger[_0xdf3c('0x35')](_0xdf3c('0x54'),_0x1efa9c[_0xdf3c('0x36')]);}};module[_0xdf3c('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d628f69..a705e31 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 _0x150b=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','log','close','exports','bluebird','moment','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x5f06f7,_0x2e62f2){var _0x5b4bf7=function(_0x99d36b){while(--_0x99d36b){_0x5f06f7['push'](_0x5f06f7['shift']());}};_0x5b4bf7(++_0x2e62f2);}(_0x150b,0x1ef));var _0xb150=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x150b[_0x369a98];return _0x29565c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb150('0x0'));var moment=require(_0xb150('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')('ami');var config=require(_0xb150('0x2'));var ami=new Manager(config['asterisk'][_0xb150('0x3')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')][_0xb150('0x6')],!![]);ami[_0xb150('0x7')]();ami[_0xb150('0x8')]=BPromise[_0xb150('0x9')](ami[_0xb150('0xa')]);function error(_0x4d3d76){logger[_0xb150('0xb')](util[_0xb150('0xc')](_0xb150('0xd'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')],util[_0xb150('0xe')](_0x4d3d76,![],null)));}function close(){logger[_0xb150('0xb')](util['format'](_0xb150('0xf'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xb150('0x12')});};};ami[_0xb150('0x13')]=function(){return function(){return ami['Action']({'action':_0xb150('0x14')});};};ami[_0xb150('0x15')]=function(){return function(){return ami[_0xb150('0x8')]({'action':_0xb150('0x16')});};};function connect(_0x4bb38e){logger[_0xb150('0x17')](util['format'](_0xb150('0x18'),config['asterisk'][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x3')]));ami[_0xb150('0x19')](_0xb150('0xb'),error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0xb150('0x1a'),function(_0x180577){logger[_0xb150('0x17')](util[_0xb150('0xc')](_0xb150('0x1b'),config[_0xb150('0x4')][_0xb150('0x5')],config[_0xb150('0x4')]['ip'],config[_0xb150('0x4')][_0xb150('0x3')],util[_0xb150('0xe')](_0x180577,![],null)));});ami['on'](_0xb150('0x1c'),function(_0x2db9f8){logger[_0xb150('0x17')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0xb150('0x4')]['ip'],config['asterisk'][_0xb150('0x3')]));return BPromise[_0xb150('0x1d')]()[_0xb150('0x1e')](ami[_0xb150('0x1f')]())[_0xb150('0x1e')](ami['actionDeviceStateList']())[_0xb150('0x1e')](ami[_0xb150('0x20')]())[_0xb150('0x1e')](ami['actionQueueSummary']())[_0xb150('0x1e')](ami[_0xb150('0x15')]())[_0xb150('0x21')](function(_0x3db66a){console[_0xb150('0x22')](_0x3db66a);});});ami[_0xb150('0x19')](_0xb150('0xb'),error);ami[_0xb150('0x19')](_0xb150('0x23'),close);module[_0xb150('0x24')]=ami; \ No newline at end of file +var _0x2935=['info','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','port','asterisk','username','password','Action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x90c363,_0x19a192){var _0x33cbfd=function(_0x47c574){while(--_0x47c574){_0x90c363['push'](_0x90c363['shift']());}};_0x33cbfd(++_0x19a192);}(_0x2935,0x1ed));var _0x5293=function(_0x21324f,_0xb85655){_0x21324f=_0x21324f-0x0;var _0x579ca8=_0x2935[_0x21324f];return _0x579ca8;};'use strict';var Manager=require(_0x5293('0x0'));var BPromise=require(_0x5293('0x1'));var moment=require(_0x5293('0x2'));var util=require(_0x5293('0x3'));var _=require(_0x5293('0x4'));var logger=require('../../config/logger')(_0x5293('0x5'));var config=require(_0x5293('0x6'));var ami=new Manager(config['asterisk'][_0x5293('0x7')],config[_0x5293('0x8')]['ip'],config[_0x5293('0x8')][_0x5293('0x9')],config[_0x5293('0x8')][_0x5293('0xa')],!![]);ami['keepConnected']();ami[_0x5293('0xb')]=BPromise['promisify'](ami['action']);function error(_0x18c4a3){logger[_0x5293('0xc')](util[_0x5293('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5293('0x8')][_0x5293('0x9')],config['asterisk']['ip'],config[_0x5293('0x8')]['port'],util[_0x5293('0xe')](_0x18c4a3,![],null)));}function close(){logger[_0x5293('0xc')](util['format'](_0x5293('0xf'),config[_0x5293('0x8')][_0x5293('0x9')],config['asterisk']['ip'],config['asterisk'][_0x5293('0x7')]));}ami[_0x5293('0x10')]=function(){return function(){return ami[_0x5293('0xb')]({'action':'sipshowregistry'});};};ami[_0x5293('0x11')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x12')});};};ami[_0x5293('0x13')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x14')});};};ami[_0x5293('0x15')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x16')});};};ami[_0x5293('0x17')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x18')});};};function connect(_0x5c5555){logger[_0x5293('0x19')](util[_0x5293('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x5293('0x8')][_0x5293('0x9')],config[_0x5293('0x8')]['ip'],config[_0x5293('0x8')][_0x5293('0x7')]));ami['once'](_0x5293('0xc'),error);ami[_0x5293('0x1a')](_0x5293('0x1b'),close);}ami['on'](_0x5293('0x1c'),connect);ami['on'](_0x5293('0x1d'),function(_0x27f037){logger[_0x5293('0x19')](util[_0x5293('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5293('0x8')]['username'],config[_0x5293('0x8')]['ip'],config['asterisk'][_0x5293('0x7')],util[_0x5293('0xe')](_0x27f037,![],null)));});ami['on'](_0x5293('0x1e'),function(_0x303f83){logger[_0x5293('0x19')](util[_0x5293('0xd')](_0x5293('0x1f'),config['asterisk'][_0x5293('0x9')],config['asterisk']['ip'],config[_0x5293('0x8')]['port']));return BPromise[_0x5293('0x20')]()['then'](ami[_0x5293('0x10')]())['then'](ami['actionDeviceStateList']())[_0x5293('0x21')](ami['actionSipPeerStatus']())['then'](ami[_0x5293('0x15')]())[_0x5293('0x21')](ami[_0x5293('0x17')]())[_0x5293('0x22')](function(_0x42cdb1){console[_0x5293('0x23')](_0x42cdb1);});});ami['once']('error',error);ami[_0x5293('0x1a')](_0x5293('0x1b'),close);module[_0x5293('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2592421..065302d 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 _0xbfb8=['memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then','rpc'];(function(_0xcefa34,_0x1cc682){var _0x37cfd2=function(_0xa9ce41){while(--_0xa9ce41){_0xcefa34['push'](_0xcefa34['shift']());}};_0x37cfd2(++_0x1cc682);}(_0xbfb8,0xd8));var _0x8bfb=function(_0x4d974c,_0x7cb366){_0x4d974c=_0x4d974c-0x0;var _0x402502=_0xbfb8[_0x4d974c];return _0x402502;};'use strict';var jayson=require(_0x8bfb('0x0'));var BPromise=require(_0x8bfb('0x1'));var logger=require(_0x8bfb('0x2'))('ami');var client=jayson[_0x8bfb('0x3')][_0x8bfb('0x4')]({'port':0x2329});client['Request']=function(_0x336320,_0x98d785){return new BPromise(function(_0x34cf8d,_0x403ecd){return client[_0x8bfb('0x5')](_0x336320,_0x98d785)[_0x8bfb('0x6')](function(_0x826c3c){logger['debug'](_0x8bfb('0x7'),_0x8bfb('0x8'),_0x336320,_0x98d785,_0x826c3c);if(_0x826c3c[_0x8bfb('0x9')]){logger[_0x8bfb('0x9')]('rpc',_0x8bfb('0x8'),_0x336320,_0x826c3c[_0x8bfb('0x9')][_0x8bfb('0xa')],_0x98d785);return _0x403ecd(_0x826c3c[_0x8bfb('0x9')]['message']);}else{return _0x34cf8d(_0x826c3c[_0x8bfb('0xb')]);}})[_0x8bfb('0xc')](function(_0x30cda0){logger[_0x8bfb('0x9')](_0x8bfb('0x7'),_0x8bfb('0x8'),_0x336320,_0x30cda0,_0x98d785);return _0x403ecd(_0x30cda0);});});};module[_0x8bfb('0xd')]=client; \ No newline at end of file +var _0x8fb8=['../../config/logger','ami','Request','request','then','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x2455c9,_0x4924de){var _0x2af39a=function(_0x597bdd){while(--_0x597bdd){_0x2455c9['push'](_0x2455c9['shift']());}};_0x2af39a(++_0x4924de);}(_0x8fb8,0x108));var _0x88fb=function(_0x53f1de,_0x37d8d3){_0x53f1de=_0x53f1de-0x0;var _0x2fa505=_0x8fb8[_0x53f1de];return _0x2fa505;};'use strict';var jayson=require(_0x88fb('0x0'));var BPromise=require(_0x88fb('0x1'));var logger=require(_0x88fb('0x2'))(_0x88fb('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x88fb('0x4')]=function(_0x5d694c,_0x302790){return new BPromise(function(_0x2a1ab5,_0x135be5){return client[_0x88fb('0x5')](_0x5d694c,_0x302790)[_0x88fb('0x6')](function(_0x767bac){logger['debug'](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x302790,_0x767bac);if(_0x767bac[_0x88fb('0x9')]){logger[_0x88fb('0x9')](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x767bac[_0x88fb('0x9')][_0x88fb('0xa')],_0x302790);return _0x135be5(_0x767bac[_0x88fb('0x9')]['message']);}else{return _0x2a1ab5(_0x767bac[_0x88fb('0xb')]);}})[_0x88fb('0xc')](function(_0x376699){logger[_0x88fb('0x9')](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x376699,_0x302790);return _0x135be5(_0x376699);});});};module[_0x88fb('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 4f73edf..9481121 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 _0x138d=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','queue','active','type'];(function(_0x36625f,_0x727bd6){var _0x135981=function(_0x1d8f24){while(--_0x1d8f24){_0x36625f['push'](_0x36625f['shift']());}};_0x135981(++_0x727bd6);}(_0x138d,0x1ab));var _0xd138=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0x138d[_0x3a4203];return _0x1a5661;};'use strict';var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var moment=require('moment');function checkNameSurname(_0xefc890,_0x34325b,_0x427b74){var _0x1882b8='';if(!_[_0xd138('0x2')](_0x34325b)&&_0xd138('0x3')===typeof _0x34325b){_0x1882b8+=_0x34325b;}if(!_['isNil'](_0x427b74)&&_0xd138('0x3')===typeof _0x427b74){_0x1882b8+='\x20'+_0x427b74;}if(_0x1882b8!==''){return _0x1882b8;}return _0xefc890;}function Action(_0x31c62b,_0x343962,_0x54f02e){this[_0xd138('0x4')]=_0x31c62b;this[_0xd138('0x5')]=_0x54f02e||undefined;this[_0xd138('0x6')]=checkNameSurname(_0x343962['Contact']['phone'],_0x343962[_0xd138('0x7')][_0xd138('0x8')],_0x343962[_0xd138('0x7')]['lastName']);this[_0xd138('0x9')]=_0x343962['Contact']['phone'];this[_0xd138('0xa')]=_0x31c62b[_0xd138('0x6')];this[_0xd138('0xb')]=_0x343962[_0xd138('0xb')]||![];this['type']=_0x31c62b[_0xd138('0xc')];this['dialQueueTimeout']=_0x31c62b[_0xd138('0xd')]||0x3;this[_0xd138('0xe')]=_0x343962[_0xd138('0xe')];this[_0xd138('0xf')]=_0x343962[_0xd138('0xf')];this[_0xd138('0x10')]=_0x343962[_0xd138('0x10')];this[_0xd138('0x11')]=_0x343962[_0xd138('0x11')];this[_0xd138('0x12')]=_0x343962[_0xd138('0x12')];this[_0xd138('0x13')]=_0x343962['countdropretry'];this[_0xd138('0x14')]=_0x343962[_0xd138('0x14')];this['countmachineretry']=_0x343962['countmachineretry'];this['countagentrejectretry']=_0x343962[_0xd138('0x15')];this[_0xd138('0x16')]=_0x343962['ContactId'];this[_0xd138('0x17')]=_0x343962[_0xd138('0x17')];this[_0xd138('0x18')]=_0x343962[_0xd138('0x18')];this['VoiceQueueId']=_0x343962[_0xd138('0x19')];this[_0xd138('0x1a')]=_0x343962[_0xd138('0x1a')];this[_0xd138('0x1b')]=_0x343962['id'];this[_0xd138('0x1c')]=_0x343962[_0xd138('0x7')][_0xd138('0x8')]||'';this['starttime']=moment()[_0xd138('0x1d')](_0xd138('0x1e'));this['callback']=_0x343962['callback'];this[_0xd138('0x1f')]=_0x343962['callbackuniqueid'];this['callbackat']=_0x343962['callbackat'];this[_0xd138('0x20')]=_0x343962[_0xd138('0x20')];this[_0xd138('0x21')]='';this[_0xd138('0x22')]='';}Action['prototype'][_0xd138('0x23')]=function(){return util[_0xd138('0x1d')](_0xd138('0x24'),this[_0xd138('0x6')],this[_0xd138('0x4')][_0xd138('0x25')]>0x0?this[_0xd138('0x9')][_0xd138('0x26')](this[_0xd138('0x4')][_0xd138('0x25')]):this[_0xd138('0x9')]);};Action[_0xd138('0x27')]['getQueue']=function(){return this[_0xd138('0xa')];};module['exports']=Action; \ No newline at end of file +var _0xf9b6=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','recallme','originatecalleridname','name','voiceQueue','dialCutDigit','substring','prototype','getQueue','lodash','moment','isNil','string','uniqueid','Contact','phone','firstName','number','queue','active'];(function(_0x37d9eb,_0x1b6708){var _0x2c9240=function(_0x31e821){while(--_0x31e821){_0x37d9eb['push'](_0x37d9eb['shift']());}};_0x2c9240(++_0x1b6708);}(_0xf9b6,0x114));var _0x6f9b=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0xf9b6[_0x4dcecc];return _0x2aa658;};'use strict';var util=require('util');var _=require(_0x6f9b('0x0'));var moment=require(_0x6f9b('0x1'));function checkNameSurname(_0x54ef92,_0x1f168d,_0x52779e){var _0x37fbf1='';if(!_[_0x6f9b('0x2')](_0x1f168d)&&_0x6f9b('0x3')===typeof _0x1f168d){_0x37fbf1+=_0x1f168d;}if(!_[_0x6f9b('0x2')](_0x52779e)&&'string'===typeof _0x52779e){_0x37fbf1+='\x20'+_0x52779e;}if(_0x37fbf1!==''){return _0x37fbf1;}return _0x54ef92;}function Action(_0x4bb325,_0x58e76a,_0x52a849){this['voiceQueue']=_0x4bb325;this[_0x6f9b('0x4')]=_0x52a849||undefined;this['name']=checkNameSurname(_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x6')],_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x7')],_0x58e76a['Contact']['lastName']);this[_0x6f9b('0x8')]=_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x6')];this[_0x6f9b('0x9')]=_0x4bb325['name'];this[_0x6f9b('0xa')]=_0x58e76a[_0x6f9b('0xa')]||![];this[_0x6f9b('0xb')]=_0x4bb325['type'];this[_0x6f9b('0xc')]=_0x4bb325[_0x6f9b('0xc')]||0x3;this[_0x6f9b('0xd')]=_0x58e76a[_0x6f9b('0xd')];this[_0x6f9b('0xe')]=_0x58e76a['countbusyretry'];this[_0x6f9b('0xf')]=_0x58e76a[_0x6f9b('0xf')];this[_0x6f9b('0x10')]=_0x58e76a[_0x6f9b('0x10')];this['countnosuchnumberretry']=_0x58e76a[_0x6f9b('0x11')];this[_0x6f9b('0x12')]=_0x58e76a[_0x6f9b('0x12')];this[_0x6f9b('0x13')]=_0x58e76a[_0x6f9b('0x13')];this[_0x6f9b('0x14')]=_0x58e76a[_0x6f9b('0x14')];this[_0x6f9b('0x15')]=_0x58e76a['countagentrejectretry'];this[_0x6f9b('0x16')]=_0x58e76a['ContactId'];this[_0x6f9b('0x17')]=_0x58e76a[_0x6f9b('0x17')];this[_0x6f9b('0x18')]=_0x58e76a[_0x6f9b('0x18')];this[_0x6f9b('0x19')]=_0x58e76a['VoiceQueueId'];this['CampaignId']=_0x58e76a[_0x6f9b('0x1a')];this[_0x6f9b('0x1b')]=_0x58e76a['id'];this[_0x6f9b('0x1c')]=_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x7')]||'';this[_0x6f9b('0x1d')]=moment()[_0x6f9b('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6f9b('0x1f')]=_0x58e76a[_0x6f9b('0x1f')];this['callbackuniqueid']=_0x58e76a[_0x6f9b('0x20')];this['callbackat']=_0x58e76a['callbackat'];this[_0x6f9b('0x21')]=_0x58e76a[_0x6f9b('0x21')];this['originatecalleridnum']='';this[_0x6f9b('0x22')]='';}Action['prototype']['getCaller']=function(){return util[_0x6f9b('0x1e')]('\x22%s\x22\x20<%s>',this[_0x6f9b('0x23')],this[_0x6f9b('0x24')][_0x6f9b('0x25')]>0x0?this[_0x6f9b('0x8')][_0x6f9b('0x26')](this[_0x6f9b('0x24')][_0x6f9b('0x25')]):this[_0x6f9b('0x8')]);};Action[_0x6f9b('0x27')][_0x6f9b('0x28')]=function(){return this[_0x6f9b('0x9')];};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 e055b81..031fd5a 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 _0xc8d2=['campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type'];(function(_0x1c2cae,_0x4266b1){var _0x7fd710=function(_0x5136e0){while(--_0x5136e0){_0x1c2cae['push'](_0x1c2cae['shift']());}};_0x7fd710(++_0x4266b1);}(_0xc8d2,0xc5));var _0x2c8d=function(_0xb9627d,_0x5a6caf){_0xb9627d=_0xb9627d-0x0;var _0x3d1239=_0xc8d2[_0xb9627d];return _0x3d1239;};'use strict';var util=require(_0x2c8d('0x0'));var _=require(_0x2c8d('0x1'));var moment=require('moment');function getSeconds(_0x33d6e1,_0xbd9dd2){var _0x22f80c=moment(_0x33d6e1)[_0x2c8d('0x2')](0x0);var _0xecc571=moment(_0xbd9dd2)[_0x2c8d('0x2')](0x0);return _0x22f80c[_0x2c8d('0x3')](_0xecc571,'seconds');}function AdditionalPhone(_0x38d16f){this[_0x2c8d('0x4')]=_0x38d16f[_0x2c8d('0x4')];this['scheduledat']=_0x38d16f[_0x2c8d('0x5')]||undefined;this[_0x2c8d('0x6')]=_0x38d16f[_0x2c8d('0x6')];this[_0x2c8d('0x7')]=_0x38d16f[_0x2c8d('0x6')]==='outbound'?_0x2c8d('0x8'):_0x38d16f[_0x2c8d('0x6')];this['countbusyretry']=_0x38d16f['countbusyretry'];this[_0x2c8d('0x9')]=_0x38d16f[_0x2c8d('0x9')];this['countnoanswerretry']=_0x38d16f[_0x2c8d('0xa')];this[_0x2c8d('0xb')]=_0x38d16f[_0x2c8d('0xc')]+_0x38d16f['countcongestionretry']+_0x38d16f[_0x2c8d('0xa')]+_0x38d16f[_0x2c8d('0xd')]+_0x38d16f[_0x2c8d('0xe')]+_0x38d16f[_0x2c8d('0xf')]+_0x38d16f[_0x2c8d('0x10')]+_0x38d16f[_0x2c8d('0x11')];this[_0x2c8d('0xd')]=_0x38d16f[_0x2c8d('0xd')];this['countdropretry']=_0x38d16f[_0x2c8d('0xe')];this['countabandonedretry']=_0x38d16f[_0x2c8d('0xf')];this[_0x2c8d('0x10')]=_0x38d16f[_0x2c8d('0x10')];this[_0x2c8d('0x11')]=_0x38d16f['countagentrejectretry'];this[_0x2c8d('0x8')]=_0x38d16f[_0x2c8d('0x8')];this['calleridname']=_0x38d16f[_0x2c8d('0x12')];this[_0x2c8d('0x13')]=_0x38d16f['number'];this[_0x2c8d('0x14')]=_0x38d16f[_0x2c8d('0x14')];this[_0x2c8d('0x15')]=_0x38d16f['responsetime'];this[_0x2c8d('0x16')]=_0x38d16f[_0x2c8d('0x15')];this['ringtime']=getSeconds(_0x38d16f[_0x2c8d('0x15')],_0x38d16f[_0x2c8d('0x14')]);this[_0x2c8d('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x38d16f[_0x2c8d('0x18')];this['callbackuniqueid']=_0x38d16f[_0x2c8d('0x19')];this[_0x2c8d('0x1a')]=_0x38d16f[_0x2c8d('0x1a')];this[_0x2c8d('0x1b')]=_0x38d16f[_0x2c8d('0x1b')];this[_0x2c8d('0x1c')]=_0x38d16f[_0x2c8d('0x1c')];this[_0x2c8d('0x1d')]=_0x38d16f['ListId'];this[_0x2c8d('0x1e')]=_0x38d16f[_0x2c8d('0x1e')];this['VoiceQueueId']=_0x38d16f[_0x2c8d('0x1f')];this['CampaignId']=_0x38d16f['CampaignId'];this['originatecalleridnum']=_0x38d16f[_0x2c8d('0x20')]||'';this[_0x2c8d('0x21')]=_0x38d16f['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0xc0cd=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x5c5e5b,_0x340ddb){var _0x4bbd26=function(_0x675742){while(--_0x675742){_0x5c5e5b['push'](_0x5c5e5b['shift']());}};_0x4bbd26(++_0x340ddb);}(_0xc0cd,0x7b));var _0xdc0c=function(_0x143fd0,_0x3afb81){_0x143fd0=_0x143fd0-0x0;var _0x3e4565=_0xc0cd[_0x143fd0];return _0x3e4565;};'use strict';var util=require(_0xdc0c('0x0'));var _=require(_0xdc0c('0x1'));var moment=require(_0xdc0c('0x2'));function getSeconds(_0x19f4d1,_0x454ab8){var _0x45a3e3=moment(_0x19f4d1)[_0xdc0c('0x3')](0x0);var _0x5be5ac=moment(_0x454ab8)[_0xdc0c('0x3')](0x0);return _0x45a3e3[_0xdc0c('0x4')](_0x5be5ac,_0xdc0c('0x5'));}function AdditionalPhone(_0x597006){this[_0xdc0c('0x6')]=_0x597006[_0xdc0c('0x6')];this[_0xdc0c('0x7')]=_0x597006['scheduledat']||undefined;this[_0xdc0c('0x8')]=_0x597006[_0xdc0c('0x8')];this[_0xdc0c('0x9')]=_0x597006['type']===_0xdc0c('0xa')?_0xdc0c('0xb'):_0x597006[_0xdc0c('0x8')];this[_0xdc0c('0xc')]=_0x597006[_0xdc0c('0xc')];this[_0xdc0c('0xd')]=_0x597006['countcongestionretry'];this[_0xdc0c('0xe')]=_0x597006['countnoanswerretry'];this[_0xdc0c('0xf')]=_0x597006['countbusyretry']+_0x597006[_0xdc0c('0xd')]+_0x597006['countnoanswerretry']+_0x597006[_0xdc0c('0x10')]+_0x597006[_0xdc0c('0x11')]+_0x597006['countabandonedretry']+_0x597006[_0xdc0c('0x12')]+_0x597006[_0xdc0c('0x13')];this[_0xdc0c('0x10')]=_0x597006[_0xdc0c('0x10')];this['countdropretry']=_0x597006['countdropretry'];this[_0xdc0c('0x14')]=_0x597006[_0xdc0c('0x14')];this[_0xdc0c('0x12')]=_0x597006[_0xdc0c('0x12')];this[_0xdc0c('0x13')]=_0x597006['countagentrejectretry'];this[_0xdc0c('0xb')]=_0x597006[_0xdc0c('0xb')];this['calleridname']=_0x597006['name'];this[_0xdc0c('0x15')]=_0x597006['number'];this[_0xdc0c('0x16')]=_0x597006[_0xdc0c('0x16')];this['responsetime']=_0x597006[_0xdc0c('0x17')];this['endtime']=_0x597006[_0xdc0c('0x17')];this[_0xdc0c('0x18')]=getSeconds(_0x597006['responsetime'],_0x597006[_0xdc0c('0x16')]);this[_0xdc0c('0x19')]=0x0;this[_0xdc0c('0x1a')]=0x0;this[_0xdc0c('0x1b')]=_0x597006['callback'];this[_0xdc0c('0x1c')]=_0x597006[_0xdc0c('0x1c')];this[_0xdc0c('0x1d')]=_0x597006[_0xdc0c('0x1d')];this[_0xdc0c('0x1e')]=_0x597006[_0xdc0c('0x1e')];this[_0xdc0c('0x1f')]=_0x597006[_0xdc0c('0x1f')];this[_0xdc0c('0x20')]=_0x597006[_0xdc0c('0x20')];this[_0xdc0c('0x21')]=_0x597006[_0xdc0c('0x21')];this[_0xdc0c('0x22')]=_0x597006['VoiceQueueId'];this[_0xdc0c('0x23')]=_0x597006[_0xdc0c('0x23')];this[_0xdc0c('0x24')]=_0x597006[_0xdc0c('0x24')]||'';this[_0xdc0c('0x25')]=_0x597006[_0xdc0c('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 681a57c..40e50e8 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 _0x0f37=['queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0f37,0x193));var _0x70f3=function(_0x546496,_0x51544c){_0x546496=_0x546496-0x0;var _0x3afe5a=_0x0f37[_0x546496];return _0x3afe5a;};'use strict';var util=require(_0x70f3('0x0'));var _=require(_0x70f3('0x1'));var moment=require(_0x70f3('0x2'));function getSeconds(_0x3f1c98,_0x31c2ff){var _0x122c15=moment(_0x3f1c98)[_0x70f3('0x3')](0x0);var _0x15a471=moment(_0x31c2ff)[_0x70f3('0x3')](0x0);return _0x122c15[_0x70f3('0x4')](_0x15a471,_0x70f3('0x5'));}function AgentComplete(_0x2ef697,_0x2c250c){this[_0x70f3('0x6')]=0x4;this[_0x70f3('0x7')]='Answer';this[_0x70f3('0x8')]=_0x2ef697['scheduledat'];this['type']=_0x2ef697[_0x70f3('0x9')];this[_0x70f3('0xa')]=_0x2ef697['type']==='outbound'?_0x70f3('0xb'):_0x2ef697[_0x70f3('0x9')];this[_0x70f3('0xc')]=_0x2ef697[_0x70f3('0xc')];this['countcongestionretry']=_0x2ef697['countcongestionretry'];this[_0x70f3('0xd')]=_0x2ef697['countnoanswerretry'];this[_0x70f3('0xe')]=_0x2ef697[_0x70f3('0xc')]+_0x2ef697[_0x70f3('0xf')]+_0x2ef697['countnoanswerretry']+_0x2ef697[_0x70f3('0x10')]+_0x2ef697['countdropretry']+_0x2ef697[_0x70f3('0x11')]+_0x2ef697[_0x70f3('0x12')]+_0x2ef697[_0x70f3('0x13')];this['countnosuchnumberretry']=_0x2ef697['countnosuchnumberretry'];this[_0x70f3('0x14')]=_0x2ef697['countdropretry'];this[_0x70f3('0x11')]=_0x2ef697[_0x70f3('0x11')];this['countmachineretry']=_0x2ef697[_0x70f3('0x12')];this[_0x70f3('0x13')]=_0x2ef697[_0x70f3('0x13')];this[_0x70f3('0x15')]=_0x2c250c[_0x70f3('0x15')];this[_0x70f3('0x16')]=_0x2ef697[_0x70f3('0x17')];this['calleridnum']=_0x2ef697['number'];this[_0x70f3('0x18')]=_0x2ef697[_0x70f3('0x18')];this[_0x70f3('0x19')]=_0x2ef697[_0x70f3('0x19')];this[_0x70f3('0x1a')]=_0x2ef697[_0x70f3('0x1a')];this['endtime']=moment()[_0x70f3('0x1b')](_0x70f3('0x1c'));this['ringtime']=getSeconds(_0x2ef697[_0x70f3('0x19')],_0x2ef697['starttime']);this[_0x70f3('0x1d')]=getSeconds(_0x2ef697[_0x70f3('0x1a')],_0x2ef697[_0x70f3('0x19')]);this[_0x70f3('0x1e')]=getSeconds(this[_0x70f3('0x1f')],_0x2ef697[_0x70f3('0x1a')]);this['queue']=_0x2c250c['queue'];this[_0x70f3('0x20')]=_0x2c250c[_0x70f3('0x20')];this[_0x70f3('0x21')]=_0x2c250c[_0x70f3('0x21')];this[_0x70f3('0x22')]=_0x2ef697[_0x70f3('0x22')];this[_0x70f3('0x23')]=_0x2ef697['callbackuniqueid'];this[_0x70f3('0x24')]=_0x2ef697[_0x70f3('0x24')];this[_0x70f3('0x25')]=_0x2ef697['recallme'];this[_0x70f3('0x26')]=_0x2ef697[_0x70f3('0x26')];this[_0x70f3('0x27')]=_0x2ef697[_0x70f3('0x27')];this[_0x70f3('0x28')]=_0x2ef697[_0x70f3('0x28')];this[_0x70f3('0x29')]=_0x2ef697[_0x70f3('0x29')];this[_0x70f3('0x2a')]=_0x2ef697[_0x70f3('0x2a')];this[_0x70f3('0x2b')]=_0x2ef697[_0x70f3('0x2b')]||'';this[_0x70f3('0x2c')]=_0x2ef697[_0x70f3('0x2c')]||'';}module[_0x70f3('0x2d')]=AgentComplete; \ No newline at end of file +var _0x5e18=['exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x279e6a,_0x138d82){var _0x1a423f=function(_0x5a7606){while(--_0x5a7606){_0x279e6a['push'](_0x279e6a['shift']());}};_0x1a423f(++_0x138d82);}(_0x5e18,0x10f));var _0x85e1=function(_0x3aec14,_0x3b6fde){_0x3aec14=_0x3aec14-0x0;var _0x2af7f6=_0x5e18[_0x3aec14];return _0x2af7f6;};'use strict';var util=require(_0x85e1('0x0'));var _=require(_0x85e1('0x1'));var moment=require(_0x85e1('0x2'));function getSeconds(_0x3e1594,_0x4b3f02){var _0x3d70f0=moment(_0x3e1594)[_0x85e1('0x3')](0x0);var _0x26d4e6=moment(_0x4b3f02)[_0x85e1('0x3')](0x0);return _0x3d70f0[_0x85e1('0x4')](_0x26d4e6,_0x85e1('0x5'));}function AgentComplete(_0x542db8,_0x4bf26d){this['state']=0x4;this[_0x85e1('0x6')]='Answer';this[_0x85e1('0x7')]=_0x542db8[_0x85e1('0x7')];this['type']=_0x542db8[_0x85e1('0x8')];this['campaigntype']=_0x542db8[_0x85e1('0x8')]===_0x85e1('0x9')?_0x85e1('0xa'):_0x542db8[_0x85e1('0x8')];this[_0x85e1('0xb')]=_0x542db8[_0x85e1('0xb')];this[_0x85e1('0xc')]=_0x542db8[_0x85e1('0xc')];this[_0x85e1('0xd')]=_0x542db8[_0x85e1('0xd')];this[_0x85e1('0xe')]=_0x542db8[_0x85e1('0xb')]+_0x542db8[_0x85e1('0xc')]+_0x542db8[_0x85e1('0xd')]+_0x542db8[_0x85e1('0xf')]+_0x542db8['countdropretry']+_0x542db8['countabandonedretry']+_0x542db8[_0x85e1('0x10')]+_0x542db8[_0x85e1('0x11')];this[_0x85e1('0xf')]=_0x542db8[_0x85e1('0xf')];this[_0x85e1('0x12')]=_0x542db8[_0x85e1('0x12')];this[_0x85e1('0x13')]=_0x542db8[_0x85e1('0x13')];this[_0x85e1('0x10')]=_0x542db8[_0x85e1('0x10')];this['countagentrejectretry']=_0x542db8['countagentrejectretry'];this['uniqueid']=_0x4bf26d[_0x85e1('0x14')];this[_0x85e1('0x15')]=_0x542db8[_0x85e1('0x16')];this['calleridnum']=_0x542db8[_0x85e1('0x17')];this['starttime']=_0x542db8[_0x85e1('0x18')];this[_0x85e1('0x19')]=_0x542db8[_0x85e1('0x19')];this[_0x85e1('0x1a')]=_0x542db8[_0x85e1('0x1a')];this[_0x85e1('0x1b')]=moment()[_0x85e1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x85e1('0x1d')]=getSeconds(_0x542db8['responsetime'],_0x542db8[_0x85e1('0x18')]);this[_0x85e1('0x1e')]=getSeconds(_0x542db8[_0x85e1('0x1a')],_0x542db8[_0x85e1('0x19')]);this[_0x85e1('0x1f')]=getSeconds(this[_0x85e1('0x1b')],_0x542db8[_0x85e1('0x1a')]);this[_0x85e1('0xa')]=_0x4bf26d[_0x85e1('0xa')];this[_0x85e1('0x20')]=_0x4bf26d[_0x85e1('0x20')];this['reason']=_0x4bf26d[_0x85e1('0x21')];this['callback']=_0x542db8[_0x85e1('0x22')];this[_0x85e1('0x23')]=_0x542db8['callbackuniqueid'];this[_0x85e1('0x24')]=_0x542db8[_0x85e1('0x24')];this['recallme']=_0x542db8['recallme'];this[_0x85e1('0x25')]=_0x542db8[_0x85e1('0x25')];this[_0x85e1('0x26')]=_0x542db8['ListId'];this[_0x85e1('0x27')]=_0x542db8['UserId'];this[_0x85e1('0x28')]=_0x542db8[_0x85e1('0x28')];this[_0x85e1('0x29')]=_0x542db8[_0x85e1('0x29')];this[_0x85e1('0x2a')]=_0x542db8[_0x85e1('0x2a')]||'';this[_0x85e1('0x2b')]=_0x542db8[_0x85e1('0x2b')]||'';}module[_0x85e1('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f69a7be..bdd9eaf 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 _0x67c5=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x4f5f08,_0x154cf1){var _0x5eb32d=function(_0x3744f4){while(--_0x3744f4){_0x4f5f08['push'](_0x4f5f08['shift']());}};_0x5eb32d(++_0x154cf1);}(_0x67c5,0x159));var _0x567c=function(_0x3b226d,_0x4f313d){_0x3b226d=_0x3b226d-0x0;var _0x30ff44=_0x67c5[_0x3b226d];return _0x30ff44;};'use strict';var util=require(_0x567c('0x0'));var _=require(_0x567c('0x1'));var moment=require(_0x567c('0x2'));function getSeconds(_0x529443,_0xa992e7){var _0x8d15da=moment(_0x529443)[_0x567c('0x3')](0x0);var _0x493da9=moment(_0xa992e7)['milliseconds'](0x0);return _0x8d15da[_0x567c('0x4')](_0x493da9,_0x567c('0x5'));}function Final(_0x50855d){this['uniqueid']=_0x50855d['uniqueid'];this[_0x567c('0x6')]=_0x50855d['scheduledat'];this[_0x567c('0x7')]=_0x50855d[_0x567c('0x7')];this['campaigntype']=_0x50855d[_0x567c('0x7')]==='outbound'?_0x567c('0x8'):_0x50855d['type'];this['countbusyretry']=_0x50855d['countbusyretry'];this[_0x567c('0x9')]=_0x50855d[_0x567c('0x9')];this[_0x567c('0xa')]=_0x50855d[_0x567c('0xa')];this[_0x567c('0xb')]=_0x50855d['countbusyretry']+_0x50855d[_0x567c('0x9')]+_0x50855d[_0x567c('0xa')]+_0x50855d[_0x567c('0xc')]+_0x50855d['countdropretry']+_0x50855d['countabandonedretry']+_0x50855d[_0x567c('0xd')]+_0x50855d[_0x567c('0xe')];this[_0x567c('0xc')]=_0x50855d[_0x567c('0xc')];this[_0x567c('0xf')]=_0x50855d[_0x567c('0xf')];this[_0x567c('0x10')]=_0x50855d['countabandonedretry'];this[_0x567c('0xd')]=_0x50855d[_0x567c('0xd')];this[_0x567c('0xe')]=_0x50855d[_0x567c('0xe')];this[_0x567c('0x8')]=_0x50855d[_0x567c('0x8')];this['calleridname']=_0x50855d[_0x567c('0x11')];this[_0x567c('0x12')]=_0x50855d[_0x567c('0x12')];this[_0x567c('0x13')]=_0x50855d[_0x567c('0x13')];this[_0x567c('0x14')]=_0x50855d[_0x567c('0x14')];this[_0x567c('0x15')]=_0x50855d[_0x567c('0x14')];this[_0x567c('0x16')]=_0x50855d[_0x567c('0x16')]||0x0;this[_0x567c('0x17')]=_0x50855d[_0x567c('0x17')]||0x0;this[_0x567c('0x18')]=_0x50855d[_0x567c('0x18')]||0x0;this['callback']=_0x50855d[_0x567c('0x19')];this[_0x567c('0x1a')]=_0x50855d['callbackuniqueid'];this[_0x567c('0x1b')]=_0x50855d[_0x567c('0x1b')];this[_0x567c('0x1c')]=_0x50855d[_0x567c('0x1c')];this[_0x567c('0x1d')]=_0x50855d[_0x567c('0x1d')];this['ListId']=_0x50855d[_0x567c('0x1e')];this[_0x567c('0x1f')]=_0x50855d[_0x567c('0x1f')];this[_0x567c('0x20')]=_0x50855d[_0x567c('0x20')];this[_0x567c('0x21')]=_0x50855d[_0x567c('0x21')];this['originatecalleridnum']=_0x50855d[_0x567c('0x22')]||'';this['originatecalleridname']=_0x50855d[_0x567c('0x23')]||'';}module[_0x567c('0x24')]=Final; \ No newline at end of file +var _0x064d=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x1050ba,_0x5ad911){var _0x5a99a5=function(_0x30e240){while(--_0x30e240){_0x1050ba['push'](_0x1050ba['shift']());}};_0x5a99a5(++_0x5ad911);}(_0x064d,0x178));var _0xd064=function(_0x1854ba,_0x109e2){_0x1854ba=_0x1854ba-0x0;var _0xafcdba=_0x064d[_0x1854ba];return _0xafcdba;};'use strict';var util=require(_0xd064('0x0'));var _=require(_0xd064('0x1'));var moment=require(_0xd064('0x2'));function getSeconds(_0x1e912b,_0xd98497){var _0x1a859a=moment(_0x1e912b)[_0xd064('0x3')](0x0);var _0x21a183=moment(_0xd98497)[_0xd064('0x3')](0x0);return _0x1a859a[_0xd064('0x4')](_0x21a183,_0xd064('0x5'));}function Final(_0x57c12a){this[_0xd064('0x6')]=_0x57c12a[_0xd064('0x6')];this[_0xd064('0x7')]=_0x57c12a[_0xd064('0x7')];this[_0xd064('0x8')]=_0x57c12a[_0xd064('0x8')];this[_0xd064('0x9')]=_0x57c12a[_0xd064('0x8')]===_0xd064('0xa')?_0xd064('0xb'):_0x57c12a[_0xd064('0x8')];this[_0xd064('0xc')]=_0x57c12a[_0xd064('0xc')];this[_0xd064('0xd')]=_0x57c12a[_0xd064('0xd')];this['countnoanswerretry']=_0x57c12a[_0xd064('0xe')];this['countglobal']=_0x57c12a[_0xd064('0xc')]+_0x57c12a['countcongestionretry']+_0x57c12a[_0xd064('0xe')]+_0x57c12a[_0xd064('0xf')]+_0x57c12a['countdropretry']+_0x57c12a[_0xd064('0x10')]+_0x57c12a[_0xd064('0x11')]+_0x57c12a[_0xd064('0x12')];this[_0xd064('0xf')]=_0x57c12a[_0xd064('0xf')];this['countdropretry']=_0x57c12a[_0xd064('0x13')];this[_0xd064('0x10')]=_0x57c12a[_0xd064('0x10')];this[_0xd064('0x11')]=_0x57c12a['countmachineretry'];this[_0xd064('0x12')]=_0x57c12a[_0xd064('0x12')];this[_0xd064('0xb')]=_0x57c12a['queue'];this['calleridname']=_0x57c12a[_0xd064('0x14')];this[_0xd064('0x15')]=_0x57c12a[_0xd064('0x15')];this[_0xd064('0x16')]=_0x57c12a['starttime'];this['responsetime']=_0x57c12a[_0xd064('0x17')];this[_0xd064('0x18')]=_0x57c12a[_0xd064('0x17')];this[_0xd064('0x19')]=_0x57c12a[_0xd064('0x19')]||0x0;this[_0xd064('0x1a')]=_0x57c12a[_0xd064('0x1a')]||0x0;this['talktime']=_0x57c12a[_0xd064('0x1b')]||0x0;this[_0xd064('0x1c')]=_0x57c12a[_0xd064('0x1c')];this[_0xd064('0x1d')]=_0x57c12a[_0xd064('0x1d')];this[_0xd064('0x1e')]=_0x57c12a[_0xd064('0x1e')];this['recallme']=_0x57c12a[_0xd064('0x1f')];this[_0xd064('0x20')]=_0x57c12a[_0xd064('0x20')];this[_0xd064('0x21')]=_0x57c12a[_0xd064('0x21')];this[_0xd064('0x22')]=_0x57c12a[_0xd064('0x22')];this[_0xd064('0x23')]=_0x57c12a['VoiceQueueId'];this[_0xd064('0x24')]=_0x57c12a[_0xd064('0x24')];this[_0xd064('0x25')]=_0x57c12a[_0xd064('0x25')]||'';this[_0xd064('0x26')]=_0x57c12a[_0xd064('0x26')]||'';}module[_0xd064('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index e0e1f2d..92ac6d8 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 _0xce83=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x240625,_0x24fb0a){var _0x4fba33=function(_0x4b1ddc){while(--_0x4b1ddc){_0x240625['push'](_0x240625['shift']());}};_0x4fba33(++_0x24fb0a);}(_0xce83,0xa1));var _0x3ce8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce83[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0x3ce8('0x0'));var _=require(_0x3ce8('0x1'));var moment=require(_0x3ce8('0x2'));function getSeconds(_0x1ff39b,_0x24cf4f){var _0x159339=moment(_0x1ff39b)[_0x3ce8('0x3')](0x0);var _0x2b6de7=moment(_0x24cf4f)[_0x3ce8('0x3')](0x0);return _0x159339['diff'](_0x2b6de7,'seconds');}function Hangup(_0x3413d4,_0x2b61bc){this[_0x3ce8('0x4')]=0x4;this[_0x3ce8('0x5')]=_0x3ce8('0x6');this[_0x3ce8('0x7')]=_0x3413d4[_0x3ce8('0x7')];this['type']=_0x3413d4[_0x3ce8('0x8')];this['campaigntype']=_0x3413d4[_0x3ce8('0x8')]===_0x3ce8('0x9')?_0x3ce8('0xa'):_0x3413d4[_0x3ce8('0x8')];this[_0x3ce8('0xb')]=_0x3413d4[_0x3ce8('0xb')];this[_0x3ce8('0xc')]=_0x3413d4['countcongestionretry'];this[_0x3ce8('0xd')]=_0x3413d4[_0x3ce8('0xd')];this[_0x3ce8('0xe')]=_0x3413d4[_0x3ce8('0xb')]+_0x3413d4['countcongestionretry']+_0x3413d4[_0x3ce8('0xd')]+_0x3413d4[_0x3ce8('0xf')]+_0x3413d4[_0x3ce8('0x10')]+_0x3413d4[_0x3ce8('0x11')]+_0x3413d4[_0x3ce8('0x12')]+_0x3413d4[_0x3ce8('0x13')];this[_0x3ce8('0xf')]=_0x3413d4[_0x3ce8('0xf')];this[_0x3ce8('0x10')]=_0x3413d4[_0x3ce8('0x10')];this['countabandonedretry']=_0x3413d4[_0x3ce8('0x11')];this[_0x3ce8('0x12')]=_0x3413d4['countmachineretry'];this[_0x3ce8('0x13')]=_0x3413d4[_0x3ce8('0x13')];this[_0x3ce8('0x14')]=_0x2b61bc[_0x3ce8('0x14')];this[_0x3ce8('0x15')]=_0x3413d4[_0x3ce8('0x16')];this[_0x3ce8('0x17')]=_0x3413d4[_0x3ce8('0x18')];this['starttime']=_0x3413d4[_0x3ce8('0x19')];this[_0x3ce8('0x1a')]=_0x3413d4[_0x3ce8('0x1a')];this[_0x3ce8('0x1b')]=moment()['format'](_0x3ce8('0x1c'));this[_0x3ce8('0x1d')]=getSeconds(_0x3413d4[_0x3ce8('0x1a')],_0x3413d4['starttime']);this[_0x3ce8('0x1e')]=0x0;this[_0x3ce8('0x1f')]=getSeconds(this[_0x3ce8('0x1b')],_0x3413d4['responsetime']);this['queue']=_0x3413d4[_0x3ce8('0xa')];this[_0x3ce8('0x20')]=_0x3ce8('0x21');this[_0x3ce8('0x22')]=_0x2b61bc[_0x3ce8('0x23')];this[_0x3ce8('0x24')]=_0x3413d4[_0x3ce8('0x24')];this['callbackuniqueid']=_0x3413d4['callbackuniqueid'];this[_0x3ce8('0x25')]=_0x3413d4[_0x3ce8('0x25')];this[_0x3ce8('0x26')]=_0x3413d4['recallme'];this[_0x3ce8('0x27')]=_0x3413d4['ContactId'];this[_0x3ce8('0x28')]=_0x3413d4['ListId'];this[_0x3ce8('0x29')]=_0x3413d4[_0x3ce8('0x29')];this[_0x3ce8('0x2a')]=_0x3413d4['VoiceQueueId'];this[_0x3ce8('0x2b')]=_0x3413d4[_0x3ce8('0x2b')];}module[_0x3ce8('0x2c')]=Hangup; \ No newline at end of file +var _0x7420=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0x1daeaa,_0x297e73){var _0x2a6032=function(_0x11897b){while(--_0x11897b){_0x1daeaa['push'](_0x1daeaa['shift']());}};_0x2a6032(++_0x297e73);}(_0x7420,0x13e));var _0x0742=function(_0x3e62a8,_0x1e03a3){_0x3e62a8=_0x3e62a8-0x0;var _0x2a7846=_0x7420[_0x3e62a8];return _0x2a7846;};'use strict';var util=require(_0x0742('0x0'));var _=require(_0x0742('0x1'));var moment=require('moment');function getSeconds(_0x17e8ad,_0x5b45ce){var _0x4c7058=moment(_0x17e8ad)[_0x0742('0x2')](0x0);var _0x338299=moment(_0x5b45ce)[_0x0742('0x2')](0x0);return _0x4c7058[_0x0742('0x3')](_0x338299,_0x0742('0x4'));}function Hangup(_0x39435e,_0x309b24){this[_0x0742('0x5')]=0x4;this[_0x0742('0x6')]=_0x0742('0x7');this[_0x0742('0x8')]=_0x39435e[_0x0742('0x8')];this[_0x0742('0x9')]=_0x39435e[_0x0742('0x9')];this['campaigntype']=_0x39435e[_0x0742('0x9')]==='outbound'?_0x0742('0xa'):_0x39435e[_0x0742('0x9')];this[_0x0742('0xb')]=_0x39435e['countbusyretry'];this[_0x0742('0xc')]=_0x39435e['countcongestionretry'];this[_0x0742('0xd')]=_0x39435e['countnoanswerretry'];this[_0x0742('0xe')]=_0x39435e[_0x0742('0xb')]+_0x39435e['countcongestionretry']+_0x39435e['countnoanswerretry']+_0x39435e[_0x0742('0xf')]+_0x39435e[_0x0742('0x10')]+_0x39435e[_0x0742('0x11')]+_0x39435e['countmachineretry']+_0x39435e[_0x0742('0x12')];this[_0x0742('0xf')]=_0x39435e[_0x0742('0xf')];this['countdropretry']=_0x39435e[_0x0742('0x10')];this[_0x0742('0x11')]=_0x39435e[_0x0742('0x11')];this[_0x0742('0x13')]=_0x39435e[_0x0742('0x13')];this[_0x0742('0x12')]=_0x39435e[_0x0742('0x12')];this['uniqueid']=_0x309b24['uniqueid'];this['calleridname']=_0x39435e[_0x0742('0x14')];this[_0x0742('0x15')]=_0x39435e[_0x0742('0x16')];this[_0x0742('0x17')]=_0x39435e[_0x0742('0x17')];this['responsetime']=_0x39435e['responsetime'];this[_0x0742('0x18')]=moment()[_0x0742('0x19')](_0x0742('0x1a'));this['ringtime']=getSeconds(_0x39435e[_0x0742('0x1b')],_0x39435e['starttime']);this[_0x0742('0x1c')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x39435e['responsetime']);this['queue']=_0x39435e['queue'];this[_0x0742('0x1d')]=_0x0742('0x1e');this[_0x0742('0x1f')]=_0x309b24[_0x0742('0x20')];this[_0x0742('0x21')]=_0x39435e[_0x0742('0x21')];this['callbackuniqueid']=_0x39435e['callbackuniqueid'];this['callbackat']=_0x39435e[_0x0742('0x22')];this[_0x0742('0x23')]=_0x39435e['recallme'];this[_0x0742('0x24')]=_0x39435e['ContactId'];this[_0x0742('0x25')]=_0x39435e['ListId'];this[_0x0742('0x26')]=_0x39435e[_0x0742('0x26')];this['VoiceQueueId']=_0x39435e['VoiceQueueId'];this[_0x0742('0x27')]=_0x39435e[_0x0742('0x27')];}module[_0x0742('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1ab25b3..ee8958e 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 _0xa75b=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','scheduledat','type'];(function(_0x391745,_0x372111){var _0x306a99=function(_0x21156b){while(--_0x21156b){_0x391745['push'](_0x391745['shift']());}};_0x306a99(++_0x372111);}(_0xa75b,0x1c1));var _0xba75=function(_0x2620ff,_0x582549){_0x2620ff=_0x2620ff-0x0;var _0x286fae=_0xa75b[_0x2620ff];return _0x286fae;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xba75('0x0'));function getSeconds(_0x22cb7c,_0x4c841c){var _0x35d607=moment(_0x22cb7c)[_0xba75('0x1')](0x0);var _0x3e364e=moment(_0x4c841c)[_0xba75('0x1')](0x0);return _0x35d607['diff'](_0x3e364e,_0xba75('0x2'));}function History(_0x2c388d){this[_0xba75('0x3')]=_0x2c388d['uniqueid'];this['scheduledat']=_0x2c388d[_0xba75('0x4')]||undefined;this[_0xba75('0x5')]=_0x2c388d[_0xba75('0x5')];this[_0xba75('0x6')]=_0x2c388d[_0xba75('0x5')]===_0xba75('0x7')?_0xba75('0x8'):_0x2c388d[_0xba75('0x5')];this[_0xba75('0x9')]=_0x2c388d['countbusyretry'];this[_0xba75('0xa')]=_0x2c388d[_0xba75('0xa')];this['countnoanswerretry']=_0x2c388d[_0xba75('0xb')];this['countglobal']=_0x2c388d[_0xba75('0x9')]+_0x2c388d['countcongestionretry']+_0x2c388d['countnoanswerretry']+_0x2c388d[_0xba75('0xc')]+_0x2c388d['countdropretry']+_0x2c388d['countabandonedretry']+_0x2c388d[_0xba75('0xd')]+_0x2c388d[_0xba75('0xe')];this[_0xba75('0xc')]=_0x2c388d[_0xba75('0xc')];this['countdropretry']=_0x2c388d[_0xba75('0xf')];this[_0xba75('0x10')]=_0x2c388d[_0xba75('0x10')];this[_0xba75('0xd')]=_0x2c388d[_0xba75('0xd')];this[_0xba75('0xe')]=_0x2c388d[_0xba75('0xe')];this[_0xba75('0x8')]=_0x2c388d['queue'];this[_0xba75('0x11')]=_0x2c388d[_0xba75('0x12')];this[_0xba75('0x13')]=_0x2c388d[_0xba75('0x14')];this['starttime']=_0x2c388d['starttime'];this[_0xba75('0x15')]=_0x2c388d[_0xba75('0x15')];this['endtime']=_0x2c388d[_0xba75('0x15')];this[_0xba75('0x16')]=getSeconds(_0x2c388d['responsetime'],_0x2c388d[_0xba75('0x17')]);this[_0xba75('0x18')]=0x0;this[_0xba75('0x19')]=0x0;this[_0xba75('0x1a')]=_0x2c388d[_0xba75('0x1a')];this['callbackuniqueid']=_0x2c388d['callbackuniqueid'];this[_0xba75('0x1b')]=_0x2c388d[_0xba75('0x1b')];this['recallme']=_0x2c388d['recallme'];this[_0xba75('0x1c')]=_0x2c388d['ContactId'];this[_0xba75('0x1d')]=_0x2c388d['ListId'];this[_0xba75('0x1e')]=_0x2c388d['UserId'];this[_0xba75('0x1f')]=_0x2c388d['VoiceQueueId'];this[_0xba75('0x20')]=_0x2c388d[_0xba75('0x20')];this['originatecalleridnum']=_0x2c388d['originatecalleridnum']||'';this['originatecalleridname']=_0x2c388d[_0xba75('0x21')]||'';}module[_0xba75('0x22')]=History; \ No newline at end of file +var _0xe200=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','name','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','uniqueid','scheduledat','type'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe200,0x8d));var _0x0e20=function(_0xd7c069,_0x1cc043){_0xd7c069=_0xd7c069-0x0;var _0x4fb3b1=_0xe200[_0xd7c069];return _0x4fb3b1;};'use strict';var util=require(_0x0e20('0x0'));var _=require(_0x0e20('0x1'));var moment=require(_0x0e20('0x2'));function getSeconds(_0x2c1c43,_0x2f2c75){var _0x266e5d=moment(_0x2c1c43)[_0x0e20('0x3')](0x0);var _0x48c9bb=moment(_0x2f2c75)['milliseconds'](0x0);return _0x266e5d['diff'](_0x48c9bb,'seconds');}function History(_0x26079d){this['uniqueid']=_0x26079d[_0x0e20('0x4')];this['scheduledat']=_0x26079d[_0x0e20('0x5')]||undefined;this[_0x0e20('0x6')]=_0x26079d[_0x0e20('0x6')];this[_0x0e20('0x7')]=_0x26079d[_0x0e20('0x6')]===_0x0e20('0x8')?'queue':_0x26079d[_0x0e20('0x6')];this[_0x0e20('0x9')]=_0x26079d[_0x0e20('0x9')];this[_0x0e20('0xa')]=_0x26079d[_0x0e20('0xa')];this[_0x0e20('0xb')]=_0x26079d[_0x0e20('0xb')];this[_0x0e20('0xc')]=_0x26079d[_0x0e20('0x9')]+_0x26079d['countcongestionretry']+_0x26079d[_0x0e20('0xb')]+_0x26079d[_0x0e20('0xd')]+_0x26079d['countdropretry']+_0x26079d['countabandonedretry']+_0x26079d[_0x0e20('0xe')]+_0x26079d[_0x0e20('0xf')];this[_0x0e20('0xd')]=_0x26079d[_0x0e20('0xd')];this[_0x0e20('0x10')]=_0x26079d[_0x0e20('0x10')];this['countabandonedretry']=_0x26079d[_0x0e20('0x11')];this[_0x0e20('0xe')]=_0x26079d['countmachineretry'];this[_0x0e20('0xf')]=_0x26079d[_0x0e20('0xf')];this['queue']=_0x26079d[_0x0e20('0x12')];this[_0x0e20('0x13')]=_0x26079d[_0x0e20('0x14')];this['calleridnum']=_0x26079d[_0x0e20('0x15')];this[_0x0e20('0x16')]=_0x26079d['starttime'];this[_0x0e20('0x17')]=_0x26079d[_0x0e20('0x17')];this['endtime']=_0x26079d['responsetime'];this[_0x0e20('0x18')]=getSeconds(_0x26079d[_0x0e20('0x17')],_0x26079d[_0x0e20('0x16')]);this['holdtime']=0x0;this[_0x0e20('0x19')]=0x0;this[_0x0e20('0x1a')]=_0x26079d[_0x0e20('0x1a')];this[_0x0e20('0x1b')]=_0x26079d[_0x0e20('0x1b')];this[_0x0e20('0x1c')]=_0x26079d[_0x0e20('0x1c')];this['recallme']=_0x26079d[_0x0e20('0x1d')];this[_0x0e20('0x1e')]=_0x26079d[_0x0e20('0x1e')];this[_0x0e20('0x1f')]=_0x26079d[_0x0e20('0x1f')];this[_0x0e20('0x20')]=_0x26079d[_0x0e20('0x20')];this[_0x0e20('0x21')]=_0x26079d['VoiceQueueId'];this[_0x0e20('0x22')]=_0x26079d[_0x0e20('0x22')];this['originatecalleridnum']=_0x26079d[_0x0e20('0x23')]||'';this[_0x0e20('0x24')]=_0x26079d['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 2d86014..3f1ddd8 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 _0xb872=['is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','uniqueId','[uniqueid]','clearZombieChannels','[actions]','undefined','enqueue','isNil','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[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','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','SIP/%s','unmonitored','uniqueid','variable','amdstatus','value','HANGUP','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','dialAMDActive','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','amd','countabandonedretry','stateGlobal','createStateFinal','add','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','Abandoned','calleridnum','syncNewExten','actionid','roundrobin','locked','stateinterface','push','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','NONE','outbound','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','startProgressive','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','busyFactor','floor','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\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]','Umin\x20=\x20','exports','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','ivrOriginated','queueBooked','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','milliseconds','diff','seconds','type','strategy','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','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','erlangCalls','erlangCallToSecond','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','stack','inspect','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb872,0x16d));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x2b87('0x0'));var BPromise=require(_0x2b87('0x1'));var uuid=require('uuid');var moment=require(_0x2b87('0x2'));var rr=require('rr');var md5=require(_0x2b87('0x3'));var Redis=require(_0x2b87('0x4'));var ut=require(_0x2b87('0x5'));var config=require(_0x2b87('0x6'));var logger=require(_0x2b87('0x7'))(_0x2b87('0x8'));var loggerBooked=require(_0x2b87('0x7'))('booked');var loggerPredictive=require(_0x2b87('0x7'))('predictive');var loggerPredictiveCalls=require(_0x2b87('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x2b87('0x7'))(_0x2b87('0x9'));var ami=require(_0x2b87('0xa'));config['redis']=_[_0x2b87('0xb')](config['redis'],{'host':_0x2b87('0xc'),'port':0x18eb});var io=require(_0x2b87('0xd'))(new Redis(config[_0x2b87('0xe')]));var cmHopper=require(_0x2b87('0xf'));var cmHopperHistory=require(_0x2b87('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2b87('0x11'));var Action=require('./action');var History=require(_0x2b87('0x12'));var Final=require('./final');var AgentComplete=require(_0x2b87('0x13'));var QueueCallerAbandon=require(_0x2b87('0x14'));var Hangup=require(_0x2b87('0x15'));var ipAgi=process[_0x2b87('0x16')]['XCALLY_IP_AGI']||_0x2b87('0x17');var strategy={'rrmemory':_0x2b87('0x18'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2b87('0x19')]['enqueue']=function(_0x423a86){this[_0x2b87('0x1a')]=this[_0x2b87('0x1a')]?this[_0x2b87('0x1a')][_0x2b87('0x1b')](_0x423a86):_0x423a86();};function Dialer(_0x223b4d,_0x233ea7){this[_0x2b87('0x1c')]=new Sequence();this[_0x2b87('0x1d')]=_0x233ea7;this[_0x2b87('0x1e')]=_0x223b4d[_0x2b87('0x1e')];this['campaigns']=_0x223b4d[_0x2b87('0x1f')];this[_0x2b87('0x20')]=_0x223b4d[_0x2b87('0x20')];this[_0x2b87('0x21')]=_0x223b4d['trunks'];this['maxNumberOriginate']=config[_0x2b87('0x22')]||0x2;this['channels']={};this[_0x2b87('0x23')]={};this[_0x2b87('0x24')]={};this['uniqueId']={};this[_0x2b87('0x25')]={};this['startPredictive']={};this['startProgressive']={};this[_0x2b87('0x26')]={};this[_0x2b87('0x27')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x2b87('0x28')][_0x2b87('0x29')](this));ami['on']('queuecallerabandon',this[_0x2b87('0x2a')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x2b'),this[_0x2b87('0x2c')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x2d'),this[_0x2b87('0x2e')]['bind'](this));ami['on'](_0x2b87('0x2f'),this[_0x2b87('0x9')]['bind'](this));ami['on'](_0x2b87('0x30'),this['syncHangup'][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x31'),this['syncNewExten']['bind'](this));ami['on'](_0x2b87('0x32'),this[_0x2b87('0x33')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x34'),this[_0x2b87('0x35')][_0x2b87('0x29')](this));ami['on'](_0x2b87('0x36'),this[_0x2b87('0x37')][_0x2b87('0x29')](this));this[_0x2b87('0x38')]();this['loopClearZombieChannels']();}function isNotNull(_0xb0bbf4){return _0xb0bbf4!==null&&!_[_0x2b87('0x39')](_0xb0bbf4);}function checkIsLoggedIn(_0x234882,_0x36d948){return function(){if(_0x36d948<=0x0){_0x234882['message']=_0x2b87('0x3a');throw _0x234882[_0x2b87('0x3b')]+_0x2b87('0x3c');}};}function isActive(_0x596a96){return _0x596a96;}function checkIsActive(_0x204ee0,_0x4807b9){return function(){if(!isActive(_0x4807b9)){_0x204ee0[_0x2b87('0x3d')]=_0x2b87('0x3e');throw _0x204ee0[_0x2b87('0x3b')]+_0x2b87('0x3f');}};}function checkInterval(_0x52b34d){return function(){if(!isNotNull(_0x52b34d[_0x2b87('0x40')])){_0x52b34d['message']=_0x2b87('0x41');throw _0x52b34d[_0x2b87('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x52b34d[_0x2b87('0x40')][_0x2b87('0x42')])){_0x52b34d[_0x2b87('0x3d')]=_0x2b87('0x41');throw _0x52b34d[_0x2b87('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2b87('0x43')](_0x52b34d[_0x2b87('0x40')][_0x2b87('0x42')]))){_0x52b34d[_0x2b87('0x3d')]='INTERVAL_IS_NULL';throw _0x52b34d[_0x2b87('0x3b')]+_0x2b87('0x44');}};}function msgResponse(_0x20f85e,_0x45f4b2,_0x104bfc){return{'action':_0x20f85e,'response':_0x45f4b2,'message':_0x104bfc,'stack':_0x104bfc};}function myreject(_0x1d6501){return function(_0x4a46a7){return _0x1d6501(msgResponse(_0x2b87('0x45'),_0x2b87('0x46'),JSON['stringify'](_0x4a46a7)));};}function getSeconds(_0xcceba5,_0x3d0a77){var _0x17dadd=moment(_0xcceba5)[_0x2b87('0x47')](0x0);var _0x2a8e68=moment(_0x3d0a77)[_0x2b87('0x47')](0x0);return _0x17dadd[_0x2b87('0x48')](_0x2a8e68,_0x2b87('0x49'));}function emit(_0x4995f1,_0x5b4ee2,_0x5f34a9){io['to'](_0x4995f1)['emit'](_0x5b4ee2,_0x5f34a9);}function emitVoiceQueueSummary(_0x16cb13){if(_0x16cb13[_0x2b87('0x4a')]==='outbound'){var _0x48ced6={'id':_0x16cb13['id'],'name':_0x16cb13['name'],'strategy':_0x16cb13[_0x2b87('0x4b')],'answered':_0x16cb13['answered'],'available':_0x16cb13['available'],'loggedIn':_0x16cb13['loggedIn'],'pTalking':_0x16cb13['pTalking'],'sumBillable':_0x16cb13['sumBillable'],'sumDuration':_0x16cb13[_0x2b87('0x4c')],'sumHoldTime':_0x16cb13[_0x2b87('0x4d')]||0x0,'talking':_0x16cb13[_0x2b87('0x4e')],'total':_0x16cb13[_0x2b87('0x4f')],'type':_0x16cb13[_0x2b87('0x4a')],'unmanaged':_0x16cb13[_0x2b87('0x50')],'abandoned':_0x16cb13['abandoned'],'waiting':_0x16cb13[_0x2b87('0x51')],'loggedInDb':_0x16cb13[_0x2b87('0x52')],'dialActive':_0x16cb13[_0x2b87('0x53')],'dialMethod':_0x16cb13[_0x2b87('0x54')],'dialOriginateCallerIdName':_0x16cb13[_0x2b87('0x55')],'dialOriginateCallerIdNumber':_0x16cb13['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x16cb13[_0x2b87('0x56')],'dialPrefix':_0x16cb13[_0x2b87('0x57')],'outboundAnswerAgiCallsDay':_0x16cb13[_0x2b87('0x58')],'outboundAnswerCallsDay':_0x16cb13[_0x2b87('0x59')],'outboundBlacklistCallsDay':_0x16cb13[_0x2b87('0x5a')],'outboundBusyCallsDay':_0x16cb13[_0x2b87('0x5b')],'outboundCongestionCallsDay':_0x16cb13[_0x2b87('0x5c')],'outboundDropCallsDayACS':_0x16cb13[_0x2b87('0x5d')],'outboundDropCallsDayCallersExit':_0x16cb13[_0x2b87('0x5e')],'outboundDropCallsDayTimeout':_0x16cb13[_0x2b87('0x5f')],'outboundNoAnswerCallsDay':_0x16cb13[_0x2b87('0x60')],'outboundNoSuchCallsDay':_0x16cb13[_0x2b87('0x61')],'outboundOriginateFailureCallsDay':_0x16cb13[_0x2b87('0x62')],'outboundReCallsDay':_0x16cb13[_0x2b87('0x63')],'outboundRejectCallsDay':_0x16cb13[_0x2b87('0x64')],'outboundUnknownCallsDay':_0x16cb13[_0x2b87('0x65')],'predictiveIntervalAnsweredCalls':_0x16cb13[_0x2b87('0x66')],'predictiveIntervalAvgHoldtime':_0x16cb13[_0x2b87('0x67')],'predictiveIntervalAvgTalktime':_0x16cb13[_0x2b87('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x16cb13[_0x2b87('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x16cb13[_0x2b87('0x6a')],'predictiveIntervalErlangCalls':_0x16cb13[_0x2b87('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x16cb13[_0x2b87('0x6c')],'predictiveIntervalHitRate':_0x16cb13[_0x2b87('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x16cb13[_0x2b87('0x6e')],'predictiveIntervalPauses':_0x16cb13[_0x2b87('0x6f')],'predictiveIntervalAvailable':_0x16cb13[_0x2b87('0x70')],'predictiveIntervalTotalCalls':_0x16cb13[_0x2b87('0x71')],'message':_0x16cb13[_0x2b87('0x3d')],'originated':_0x16cb13['originated'],'erlangCalls':_0x16cb13[_0x2b87('0x72')],'erlangCallToSecond':_0x16cb13[_0x2b87('0x73')],'erlangAbandonmentRate':_0x16cb13['erlangAbandonmentRate'],'erlangBusyFactor':_0x16cb13['erlangBusyFactor'],'startPredictive':_0x16cb13[_0x2b87('0x74')],'startProgressive':_0x16cb13['startProgressive']};if(_0x16cb13['Trunk']){_0x48ced6[_0x2b87('0x75')]={'id':_0x16cb13['Trunk']['id'],'name':_0x16cb13['Trunk'][_0x2b87('0x3b')],'active':_0x16cb13['Trunk'][_0x2b87('0x76')],'callerid':_0x16cb13[_0x2b87('0x75')][_0x2b87('0x77')]};}if(_0x16cb13[_0x2b87('0x40')]){_0x48ced6['Interval']={'id':_0x16cb13[_0x2b87('0x40')]['id'],'name':_0x16cb13[_0x2b87('0x40')]['name']};}var _0xff5da9=md5(JSON[_0x2b87('0x78')](_0x48ced6));if(_0x16cb13[_0x2b87('0x3')]!==_0xff5da9){_0x16cb13[_0x2b87('0x3')]=_0xff5da9;emit(util[_0x2b87('0x79')](_0x2b87('0x7a'),_0x48ced6[_0x2b87('0x3b')]),_0x2b87('0x7b'),_0x48ced6);}}}function emitCampaignSummary(_0x387312){if(_0x387312['type']==='ivr'){emit(util['format'](_0x2b87('0x7c'),_0x387312['name']),_0x2b87('0x7d'),_0x387312);}}function checkGetDataPredictive(_0x124a65){if(isNotNull(_0x124a65)&&!_[_0x2b87('0x43')](_0x124a65)){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x7f'));loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x80'),_0x124a65[_0x2b87('0x71')]);loggerPredictive['info'](_0x2b87('0x81'),_0x124a65[_0x2b87('0x66')]);loggerPredictive['info'](_0x2b87('0x82'),_0x124a65[_0x2b87('0x6a')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x83'),_0x124a65[_0x2b87('0x69')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x84'),_0x124a65['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x85'),_0x124a65[_0x2b87('0x68')]);loggerPredictive[_0x2b87('0x7e')]('---------------------------');if(_0x124a65[_0x2b87('0x71')]>0x0){if(!_['isUndefined'](_0x124a65['predictiveIntervalAvgTalktime'])&&_0x124a65[_0x2b87('0x68')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x2b87('0x39')](_0x124a65[_0x2b87('0x67')])&&_0x124a65[_0x2b87('0x67')]>0x0){return!![];}loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x86'));}else{loggerPredictive['info'](_0x2b87('0x87'));}}else{loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x88'));}return![];}function mergeDataErlangB(_0x16ca0f){return function(_0x28c9f3){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x89'));loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x8a'),_0x28c9f3[_0x2b87('0x72')]);loggerPredictive['info'](_0x2b87('0x8b'),_0x28c9f3[_0x2b87('0x73')]);loggerPredictive['info'](_0x2b87('0x8c'),_0x28c9f3[_0x2b87('0x8d')]);loggerPredictive['info'](_0x2b87('0x8e'),_0x28c9f3[_0x2b87('0x8f')]);loggerPredictive['info'](_0x2b87('0x8c'),_0x28c9f3[_0x2b87('0x8d')]);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x90'));_['merge'](_0x16ca0f,_0x28c9f3);};}function getDiff(_0x5a472b){var _0x12cd74=moment()[_0x2b87('0x47')](0x0);var _0xc725d6=moment(_0x5a472b)[_0x2b87('0x47')](0x0);return _0x12cd74[_0x2b87('0x48')](_0xc725d6,'seconds');}function ifInterval(_0x1954a9,_0x2fe08b){if(_['isUndefined'](_0x2fe08b)){return![];}return getDiff(_0x2fe08b)<_0x1954a9*0x3c;}function freeVariablesPredictive(_0x382b74){if(isNotNull(_0x382b74)){if(!_['isUndefined'](_0x382b74['startProgressive'])){_0x382b74['startProgressive']=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74[_0x2b87('0x3b')],_0x2b87('0x91'));}if(!_[_0x2b87('0x39')](_0x382b74[_0x2b87('0x74')])){_0x382b74[_0x2b87('0x74')]=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74['name'],_0x2b87('0x92'));}if(!_[_0x2b87('0x39')](_0x382b74['handlePredictive'])){clearInterval(_0x382b74[_0x2b87('0x93')]);_0x382b74[_0x2b87('0x93')]=undefined;loggerPredictive[_0x2b87('0x7e')](_0x382b74[_0x2b87('0x3b')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x19507e,_0x81adce){if(_0x81adce===0x0){return 0x0;}var _0x2b9c77=0x1;for(var _0x4062ae=0x1;_0x4062ae<=_0x81adce;_0x4062ae+=0x1){_0x2b9c77=0x1+_0x2b9c77*_0x4062ae/_0x19507e;}return 0x1/_0x2b9c77;}function isVoiceQueueOutbound(_0x7b8196){return _0x7b8196==='outbound';}function isNotPreview(_0xfc2fa2){return _0xfc2fa2!==_0x2b87('0x1d');}function isCampaignIvr(_0x314448){return _0x314448===_0x2b87('0x94');}function getCallerId(_0x274086,_0x141ab1,_0xd0cc53){if(!_[_0x2b87('0x39')](_0xd0cc53)&&typeof _0xd0cc53==='string'&&!_[_0x2b87('0x43')](_0xd0cc53)){if(!_[_0x2b87('0x39')](_0x141ab1)&&typeof _0x141ab1===_0x2b87('0x95')&&!_[_0x2b87('0x43')](_0x141ab1)){return util[_0x2b87('0x79')]('\x22%s\x22\x20<%s>',_0x141ab1,_0xd0cc53);}return util[_0x2b87('0x79')](_0x2b87('0x96'),_0xd0cc53,_0xd0cc53);}if(!_[_0x2b87('0x39')](_0x274086)&&typeof _0x274086==='string'&&!_[_0x2b87('0x43')](_0x274086)){return _0x274086;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x45f225,_0x2f6994){return function(_0x3d09ff){freeVariablesPredictive(_0x2f6994);emitVoiceQueueSummary(_0x2f6994);emitCampaignSummary(_0x2f6994);loggerSyncQueueSummary[_0x2b87('0x97')](_0x45f225,util['inspect'](_0x3d09ff,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xc5e0f8,_0x1b2bda){return function(_0xe7f5b7){loggerPredictive['error'](_0x1b2bda['name'],_0xc5e0f8);loggerPredictive['error'](_0xe7f5b7[_0x2b87('0x98')]);freeVariablesPredictive(_0x1b2bda);};}function loggerCatch(_0x259c99){return function(_0x3624e2){logger[_0x2b87('0x97')](_0x259c99,util[_0x2b87('0x99')](_0x3624e2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a610f){return _0x1a610f&&!_[_0x2b87('0x39')](_0x1a610f)&&_0x1a610f['length']>0x0;}function decremetOriginate(_0x3fb056){if(!_[_0x2b87('0x39')](_0x3fb056)&&_0x3fb056!==null){if(typeof _0x3fb056[_0x2b87('0x9a')]!=='undefined'){if(_0x3fb056[_0x2b87('0x9a')]>0x0){_0x3fb056[_0x2b87('0x9a')]-=0x1;}else{logger[_0x2b87('0x97')](_0x2b87('0x9b'));}}}else{logger[_0x2b87('0x97')](_0x2b87('0x9c'));}}function checkContactLowerLimitOriginate(_0x5da036,_0x3b9858,_0x561e06){if(_0x3b9858>_0x561e06){for(var _0x31b33b=0x0;_0x31b33b<_0x3b9858-_0x561e06;_0x31b33b+=0x1){decremetOriginate(_0x5da036);}}}function loggerGetContactDialer(_0x30a3b4,_0x8cac5d,_0x580f27){return function(_0x3af832){checkContactLowerLimitOriginate(_0x8cac5d,_0x580f27,0x0);logger['error'](_0x30a3b4,util[_0x2b87('0x99')](_0x3af832,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5805bb){return function(_0x2d5173){if(isNotNull(_0x2d5173)&&isNotNull(_0x2d5173[0x0])){if(_0x2d5173[0x0][_0x2b87('0x9d')]>0x0){_0x5805bb[_0x2b87('0x3d')]='RESCHEDULED_CONTACTS';logger[_0x2b87('0x7e')](_0x2b87('0x9e')+_0x5805bb[_0x2b87('0x3b')],_0x2d5173[0x0][_0x2b87('0x9d')],_0x2b87('0x9f'));}else{_0x5805bb[_0x2b87('0x3d')]=_0x2b87('0xa0');logger[_0x2b87('0x7e')](_0x2b87('0xa1')+_0x5805bb[_0x2b87('0x3b')]);}}};}function notSendMessagesQueue(_0x5d9e8d){if(_0x5d9e8d[_0x2b87('0xa2')]){freeVariablesPredictive(_0x5d9e8d);if(_0x5d9e8d[_0x2b87('0x9a')]===0x0&&_0x5d9e8d[_0x2b87('0x4e')]===0x0&&_0x5d9e8d[_0x2b87('0x51')]===0x0&&(_0x5d9e8d[_0x2b87('0xa3')]||0x0)===0x0){_0x5d9e8d[_0x2b87('0xa2')]=![];_0x5d9e8d[_0x2b87('0xa4')]=0x0;_0x5d9e8d[_0x2b87('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x2b87('0xa5'),_0x5d9e8d[_0x2b87('0x3b')],_0x2b87('0xa6'));}else{_0x5d9e8d[_0x2b87('0x3d')]=_0x2b87('0xa7');loggerSyncQueueSummary['error'](_0x2b87('0xa5'),_0x5d9e8d[_0x2b87('0x3b')],_0x2b87('0xa8'));}emitVoiceQueueSummary(_0x5d9e8d);}}function notSendMessagesCampaign(_0xe12568){if(_0xe12568['sendMessageOneNotActive']){if(_0xe12568['originated']===0x0){_0xe12568[_0x2b87('0xa2')]=![];_0xe12568[_0x2b87('0x3d')]=_0x2b87('0x3e');loggerSyncQueueSummary['error'](_0x2b87('0xa9'),_0xe12568[_0x2b87('0x3b')],_0x2b87('0xa6'));}else{_0xe12568[_0x2b87('0x3d')]=_0x2b87('0xa7');loggerSyncQueueSummary['error'](_0x2b87('0xa9'),_0xe12568[_0x2b87('0x3b')],_0x2b87('0xa8'));}emitCampaignSummary(_0xe12568);}}function createObjHistory(_0x27073e,_0x1b6d6f,_0x4313fb,_0x57e7c1,_0x22f2e6){_0x27073e[_0x2b87('0x3d')]=_0x4313fb;var _0x2b24dc=new Action(_0x27073e,_0x1b6d6f);var _0x23050d=new History(_0x2b24dc);_0x23050d[_0x2b87('0xaa')]=_0x57e7c1;_0x23050d[_0x2b87('0xab')]=_0x22f2e6;_0x23050d[_0x2b87('0xac')]=_0x2b24dc[_0x2b87('0xad')];return _0x23050d;}Dialer[_0x2b87('0x19')][_0x2b87('0xae')]=function(){var _0x379264=this;setInterval(function(){_0x379264['clearZombieChannels'](_0x379264[_0x2b87('0xaf')],_0x2b87('0xb0'));_0x379264[_0x2b87('0xb1')](_0x379264[_0x2b87('0x23')],_0x2b87('0xb2'));},0x32c8);};Dialer[_0x2b87('0x19')][_0x2b87('0xb1')]=function(_0x4e2ba1,_0x2e5f0f){var _0x24aff4=this;for(var _0x5a1be3 in _0x4e2ba1){if(typeof _0x4e2ba1[_0x5a1be3]!==_0x2b87('0xb3')){this[_0x2b87('0x1c')][_0x2b87('0xb4')](function(){if(!_[_0x2b87('0xb5')](_0x4e2ba1[_0x5a1be3])){return ami['Action']({'action':'status','channel':_0x4e2ba1[_0x5a1be3][_0x2b87('0xb6')]})[_0x2b87('0xb7')](function(_0x2f22b5){if(_0x2f22b5[_0x2b87('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4e2ba1[_0x5a1be3]&&_0x4e2ba1[_0x5a1be3][_0x2b87('0x4a')]!=='ivr'){_0x24aff4[_0x2b87('0xb8')](_0x24aff4[_0x2b87('0x1e')][_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]]);logger[_0x2b87('0x97')]('[Dialer][checkChannel]',_0x2e5f0f,_0x5a1be3,_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]);delete _0x4e2ba1[_0x5a1be3];}if(_0x4e2ba1[_0x5a1be3]&&_0x4e2ba1[_0x5a1be3][_0x2b87('0x4a')]===_0x2b87('0x94')){_0x24aff4[_0x2b87('0xb8')](_0x24aff4['campaigns'][_0x4e2ba1[_0x5a1be3]['queue']]);logger['error'](_0x2b87('0xba'),_0x2e5f0f,_0x5a1be3,_0x4e2ba1[_0x5a1be3][_0x2b87('0xb9')]);delete _0x4e2ba1[_0x5a1be3];}},0x2328);}});}});}}};Dialer[_0x2b87('0x19')][_0x2b87('0xbb')]=function(_0x12d877){return BPromise['resolve']()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xbb')](_0x12d877))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xbd')));};Dialer[_0x2b87('0x19')][_0x2b87('0xbe')]=function(_0x13f448){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperBlack[_0x2b87('0xbe')](_0x13f448))[_0x2b87('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x2b87('0xc0')]=function(_0x590315){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperBlack['checkIsBlackListIvr'](_0x590315))['catch'](loggerCatch(_0x2b87('0xc1')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc2')]=function(_0x34a9c0){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopperHistory[_0x2b87('0xc3')](_0x34a9c0))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc4')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc5')]=function(_0x58bdc0){return BPromise['resolve']()['then'](cmHopper[_0x2b87('0xc5')](_0x58bdc0))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc6')));};Dialer[_0x2b87('0x19')]['unlockContact']=function(_0x4c65df,_0x72e2ee,_0x1d61c2){return BPromise[_0x2b87('0xbf')]()['then'](cmHopper[_0x2b87('0xc7')](_0x4c65df,_0x72e2ee,_0x1d61c2))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xc8')));};Dialer[_0x2b87('0x19')][_0x2b87('0xc9')]=function(_0x14aea4,_0x6145aa,_0x3b3d2f,_0x31b690){return BPromise['resolve']()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xc9')](_0x14aea4,_0x6145aa,_0x3b3d2f,_0x31b690))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xca')));};Dialer['prototype'][_0x2b87('0xcb')]=function(_0x1c1668,_0x453457,_0x2b367d){return BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](cmHopper[_0x2b87('0xcb')](_0x1c1668,_0x453457,_0x2b367d))['catch'](loggerCatch(_0x2b87('0xca')));};Dialer['prototype'][_0x2b87('0xcc')]=function(_0x38ebbd){return BPromise['resolve']()[_0x2b87('0xbc')](voiceQueueRt['getVoiceQueueRtPauses'](_0x38ebbd))['catch'](loggerCatch(_0x2b87('0xcd')));};Dialer[_0x2b87('0x19')][_0x2b87('0xce')]=function(_0x410b6a){return BPromise[_0x2b87('0xbf')]()['then'](cmHopper[_0x2b87('0xce')](_0x410b6a))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xcf')));};Dialer[_0x2b87('0x19')]['createHistory']=function(_0x1c66cc){return BPromise['resolve']()['then'](cmHopperHistory[_0x2b87('0xd0')](_0x1c66cc))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xd1')));};Dialer[_0x2b87('0x19')][_0x2b87('0xb8')]=function(_0x42798c){if(!_[_0x2b87('0x39')](_0x42798c)&&_0x42798c!==null){if(typeof _0x42798c[_0x2b87('0x9a')]!==_0x2b87('0xb3')){if(_0x42798c[_0x2b87('0x9a')]>0x0){_0x42798c[_0x2b87('0x9a')]-=0x1;}else{logger['error'](_0x2b87('0xd2'));}}}else{logger[_0x2b87('0x97')](_0x2b87('0xd3'));}};Dialer[_0x2b87('0x19')][_0x2b87('0xd4')]=function(_0x1b4640,_0x1496c6){var _0x2526ea=this;return function(_0x3fe2a9){_0x2526ea[_0x2b87('0xb8')](_0x1496c6);logger[_0x2b87('0x97')](_0x1b4640,util[_0x2b87('0x99')](_0x3fe2a9,{'showHidden':![],'depth':null}));};};Dialer[_0x2b87('0x19')][_0x2b87('0xd5')]=function(_0x3ebed6,_0x2164e9,_0x457009){var _0x3613ec={'state':0x19,'statedesc':_0x2b87('0xd6')};this['updateOriginated'](_0x2164e9);this[_0x2b87('0xd7')](_[_0x2b87('0xd8')](_0x3613ec,_[_0x2b87('0xd9')](_0x457009,[_0x2b87('0xda'),_0x2b87('0xdb'),'UserId','VoiceQueueId','CampaignId'])),_0x2b87('0xdc'),_0x2b87('0xdd'));logger[_0x2b87('0x97')](_0x3ebed6);};Dialer[_0x2b87('0x19')][_0x2b87('0xde')]=function(_0x8d592c){return _0x8d592c==='Success';};Dialer[_0x2b87('0x19')][_0x2b87('0xdf')]=function(_0x2fa1dd){return!_[_0x2b87('0x39')](_0x2fa1dd)&&_0x2fa1dd&&!_[_0x2b87('0x39')](_0x2fa1dd[_0x2b87('0x3b')])&&!_[_0x2b87('0x39')](_0x2fa1dd['active'])&&_0x2fa1dd[_0x2b87('0x76')]&&(this[_0x2b87('0x21')][util[_0x2b87('0x79')]('SIP/%s',_0x2fa1dd[_0x2b87('0x3b')])][_0x2b87('0xe0')]==='reachable'||this['trunks'][util['format'](_0x2b87('0xe1'),_0x2fa1dd[_0x2b87('0x3b')])][_0x2b87('0xe0')]===_0x2b87('0xe2'));};Dialer[_0x2b87('0x19')][_0x2b87('0xd7')]=function(_0x20e22e,_0x49e2c8,_0x5b625a){this['createHistory'](_0x20e22e)['catch'](loggerCatch(_0x49e2c8));this[_0x2b87('0xce')](_0x20e22e)[_0x2b87('0xb7')](loggerCatch(_0x5b625a));};Dialer[_0x2b87('0x19')][_0x2b87('0x33')]=function(_0x4a1b1c){var _0x375a22=this['uniqueId'][_0x4a1b1c[_0x2b87('0xe3')]];var _0x42b076;if(!_['isNil'](_0x4a1b1c)&&!_[_0x2b87('0xb5')](_0x4a1b1c[_0x2b87('0xe4')])&&!_[_0x2b87('0xb5')](_0x4a1b1c['variable'][_0x2b87('0xe5')])&&_0x4a1b1c['exten']==='xcally-motion-dialer'&&_0x375a22){if(_0x375a22[_0x2b87('0x4a')]!==_0x2b87('0x94')&&this['voiceQueues'][_0x375a22['queue']]['dialAMDActive']&&_0x4a1b1c[_0x2b87('0xe6')]===_0x2b87('0xe7')){delete this[_0x2b87('0xaf')][_0x4a1b1c['uniqueid']];this[_0x2b87('0xb8')](this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]]);this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;_0x42b076=new Hangup(_0x375a22,_0x4a1b1c);_0x42b076[_0x2b87('0xaa')]=0x12;_0x42b076['statedesc']='HangupInAMD';_0x42b076[_0x2b87('0xe8')]='AMD';this['saveInDb'](_0x42b076,_0x2b87('0xe9'),_0x2b87('0xea'));}if(_0x375a22[_0x2b87('0x4a')]!==_0x2b87('0x94')&&this['voiceQueues'][_0x375a22[_0x2b87('0xb9')]]['dialAMDActive']&&_0x4a1b1c['value']===_0x2b87('0xeb')){var _0x321d84=this;return new BPromise(function(_0x5edd51,_0x38c215){delete _0x321d84[_0x2b87('0xaf')][_0x4a1b1c[_0x2b87('0xe3')]];_0x321d84[_0x2b87('0xb8')](_0x321d84[_0x2b87('0x1e')][_0x375a22[_0x2b87('0xb9')]]);_0x321d84[_0x2b87('0x1e')][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;_0x321d84[_0x2b87('0x1e')][_0x375a22['queue']][_0x2b87('0x58')]+=0x1;var _0x3b8c4f=_0x321d84[_0x2b87('0x1e')][_0x375a22['queue']];var _0x2dc72e=new Hangup(_0x375a22,_0x4a1b1c);_0x2dc72e['state']=0x13;_0x2dc72e[_0x2b87('0xab')]=_0x2b87('0xec');_0x2dc72e[_0x2b87('0xe8')]=_0x2b87('0xed');_0x2dc72e[_0x2b87('0xee')]+=0x1;_0x2dc72e[_0x2b87('0xef')]+=0x1;_0x2dc72e['amd']=!![];_0x321d84[_0x2b87('0xd0')](_0x2dc72e)[_0x2b87('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2dc72e[_0x2b87('0xf0')]+_0x2dc72e[_0x2b87('0xf1')]+_0x2dc72e[_0x2b87('0xf2')]+_0x2dc72e[_0x2b87('0xf3')]+_0x2dc72e[_0x2b87('0xf4')]+_0x2dc72e['countabandonedretry']+_0x2dc72e[_0x2b87('0xee')]+_0x2dc72e[_0x2b87('0xf5')]>=_0x3b8c4f[_0x2b87('0xf6')]){_0x321d84['stateGlobal'](_0x2dc72e,_0x5edd51,_0x38c215,_0x2b87('0xf7'));}else{if(_0x2dc72e[_0x2b87('0xee')]>=_0x3b8c4f['dialMachineMaxRetry']){_0x321d84['createStateFinal'](_0x2dc72e,_0x5edd51,_0x38c215,'reason\x2019\x20machine....');}else{_0x321d84[_0x2b87('0xc5')]({'active':![],'countmachineretry':_0x2dc72e[_0x2b87('0xee')],'scheduledat':moment()['add'](_0x3b8c4f[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x2dc72e[_0x2b87('0xda')],'ListId':_0x2dc72e[_0x2b87('0xdb')],'VoiceQueueId':_0x2dc72e[_0x2b87('0xfb')]||undefined,'CampaignId':_0x2dc72e[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0xfd')));_0x5edd51({'reschedule':0x1});}}});}if(_0x375a22[_0x2b87('0x4a')]===_0x2b87('0x94')&&this['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0xfe')]&&_0x4a1b1c[_0x2b87('0xe6')]===_0x2b87('0xe7')){delete this[_0x2b87('0xaf')][_0x4a1b1c[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1f')][_0x375a22[_0x2b87('0xb9')]]);_0x42b076=new Hangup(_0x375a22,_0x4a1b1c);_0x42b076['state']=0x12;_0x42b076[_0x2b87('0xab')]=_0x2b87('0xff');_0x42b076[_0x2b87('0xe8')]='AMD';this[_0x2b87('0xd7')](_0x42b076,_0x2b87('0x100'),_0x2b87('0x101'));}if(_0x375a22[_0x2b87('0x4a')]===_0x2b87('0x94')&&this['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0xfe')]&&_0x4a1b1c[_0x2b87('0xe6')]==='MACHINE'){var _0x321d84=this;return new BPromise(function(_0x32354a,_0x17d61a){delete _0x321d84[_0x2b87('0xaf')][_0x4a1b1c['uniqueid']];_0x321d84[_0x2b87('0xb8')](_0x321d84[_0x2b87('0x1f')][_0x375a22['queue']]);_0x321d84[_0x2b87('0x1f')][_0x375a22['queue']][_0x2b87('0x59')]+=0x1;_0x321d84['campaigns'][_0x375a22[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;var _0x18aac9=_0x321d84['campaigns'][_0x375a22[_0x2b87('0xb9')]];var _0x5d2782=new Hangup(_0x375a22,_0x4a1b1c);_0x5d2782[_0x2b87('0xaa')]=0x13;_0x5d2782[_0x2b87('0xab')]=_0x2b87('0xec');_0x5d2782[_0x2b87('0xe8')]=_0x2b87('0xed');_0x5d2782[_0x2b87('0xee')]+=0x1;_0x5d2782[_0x2b87('0xef')]+=0x1;_0x5d2782[_0x2b87('0x102')]=!![];_0x321d84[_0x2b87('0xd0')](_0x5d2782)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5d2782[_0x2b87('0xf0')]+_0x5d2782[_0x2b87('0xf1')]+_0x5d2782[_0x2b87('0xf2')]+_0x5d2782[_0x2b87('0xf3')]+_0x5d2782['countdropretry']+_0x5d2782[_0x2b87('0x103')]+_0x5d2782[_0x2b87('0xee')]+_0x5d2782[_0x2b87('0xf5')]>=_0x18aac9[_0x2b87('0xf6')]){_0x321d84[_0x2b87('0x104')](_0x5d2782,_0x32354a,_0x17d61a,'reason19\x20machine....');}else{if(_0x5d2782[_0x2b87('0xee')]>=_0x18aac9['dialMachineMaxRetry']){_0x321d84[_0x2b87('0x105')](_0x5d2782,_0x32354a,_0x17d61a,'reason\x2019\x20machine....');}else{_0x321d84['rescheduleContact']({'active':![],'countmachineretry':_0x5d2782[_0x2b87('0xee')],'scheduledat':moment()[_0x2b87('0x106')](_0x18aac9[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x5d2782['ContactId'],'ListId':_0x5d2782['ListId'],'VoiceQueueId':_0x5d2782['VoiceQueueId']||undefined,'CampaignId':_0x5d2782[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xfd')));_0x32354a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2b87('0x107')]=function(_0x4a46d0){var _0x5717b5=this[_0x2b87('0xaf')][_0x4a46d0[_0x2b87('0xe3')]];var _0x468ce0=this;var _0x901b93;if(_0x5717b5&&_0x5717b5[_0x2b87('0x4a')]===_0x2b87('0x94')){delete this['uniqueId'][_0x4a46d0[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1f')][_0x5717b5['queue']]);this[_0x2b87('0x1f')][_0x5717b5[_0x2b87('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);this[_0x2b87('0xd0')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x109')));}if(_0x5717b5&&_0x5717b5['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x5717b5['queue']]['dialQueueProject'])){delete this[_0x2b87('0xaf')][_0x4a46d0['uniqueid']];this[_0x2b87('0xb8')](this['voiceQueues'][_0x5717b5['queue']]);this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x58')]+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);_0x901b93[_0x2b87('0xaa')]=0x10;_0x901b93[_0x2b87('0xab')]='AnswerAGI';_0x901b93['membername']='AGI';this[_0x2b87('0xd0')](_0x901b93)['catch'](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x5717b5&&_0x5717b5[_0x2b87('0x4a')]!==_0x2b87('0x94')&&!isNotNull(this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x10a')])){delete this[_0x2b87('0xaf')][_0x4a46d0[_0x2b87('0xe3')]];this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][_0x5717b5[_0x2b87('0xb9')]]);this['voiceQueues'][_0x5717b5[_0x2b87('0xb9')]][_0x2b87('0x65')]+=0x1;_0x901b93=new Hangup(_0x5717b5,_0x4a46d0);_0x901b93[_0x2b87('0xaa')]=0xc;_0x901b93[_0x2b87('0xab')]=_0x4a46d0[_0x2b87('0x10b')];_0x901b93[_0x2b87('0xe8')]=_0x2b87('0x10c');this[_0x2b87('0xd0')](_0x901b93)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x108')));this[_0x2b87('0xce')](_0x901b93)[_0x2b87('0xb7')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x2b87('0x2e')]=function(_0x21efbd){var _0x41c3c1=this[_0x2b87('0xaf')][_0x21efbd[_0x2b87('0xe3')]];var _0x4931a5=this;if(this[_0x2b87('0x1e')][_0x21efbd['queue']]){if(_0x41c3c1&&_0x41c3c1[_0x2b87('0x4a')]!==_0x2b87('0x94')){delete this[_0x2b87('0xaf')][_0x21efbd[_0x2b87('0xe3')]];this[_0x2b87('0x1e')][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x59')]+=0x1;var _0x4f502f=new AgentComplete(_0x41c3c1,_0x21efbd);if(_0x21efbd[_0x2b87('0x10d')]===_0x2b87('0x10e')){_0x4f502f[_0x2b87('0x10f')]=this[_0x2b87('0x1e')][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x110')]&&this['voiceQueues'][_0x21efbd[_0x2b87('0xb9')]][_0x2b87('0x111')]?moment()['format'](_0x2b87('0xfa')):undefined;}this['createHistory'](_0x4f502f)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x112')));this['moveContactManagedDialer'](_0x4f502f)['catch'](loggerCatch(_0x2b87('0x113')));}}};Dialer['prototype']['syncAgentConnect']=function(_0xb75a94){if(this[_0x2b87('0x1e')][_0xb75a94[_0x2b87('0xb9')]]){if(this['uniqueId'][_0xb75a94[_0x2b87('0xe3')]]&&this[_0x2b87('0xaf')][_0xb75a94[_0x2b87('0xe3')]][_0x2b87('0x4a')]!==_0x2b87('0x94')){this['updateOriginated'](this['voiceQueues'][_0xb75a94['queue']]);this['uniqueId'][_0xb75a94['uniqueid']][_0x2b87('0x114')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));}}};Dialer[_0x2b87('0x19')]['queueCallerAbandonCreateState']=function(_0x1a10f7){this['createHistory'](_0x1a10f7)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x112')));this[_0x2b87('0xce')](_0x1a10f7)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x115')));};Dialer[_0x2b87('0x19')][_0x2b87('0x2a')]=function(_0x30eb81){var _0x5c2d1b=this[_0x2b87('0xaf')][_0x30eb81[_0x2b87('0xe3')]];var _0x37f164=this;if(this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]){if(_0x5c2d1b&&_0x5c2d1b['type']!==_0x2b87('0x94')){delete this[_0x2b87('0xaf')][_0x30eb81['uniqueid']];this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]);_0x5c2d1b['droptime']=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));var _0x2b2db0=new QueueCallerAbandon(_0x5c2d1b,_0x30eb81);if(getSeconds(_0x5c2d1b['droptime'],_0x5c2d1b[_0x2b87('0x116')])>=_0x5c2d1b[_0x2b87('0x117')]){this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2b87('0x1e')][_0x30eb81['queue']][_0x2b87('0x5f')]+=0x1;this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x6c')]+=0x1;_0x2b2db0['state']=0xa;_0x2b2db0[_0x2b87('0xab')]=_0x2b87('0x118');_0x2b2db0['dropreason']='TIMEOUT';_0x2b2db0[_0x2b87('0x10f')]=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['dialQueueProject2']?moment()['format'](_0x2b87('0xfa')):undefined;_0x2b2db0['countdropretry']+=0x1;_0x2b2db0[_0x2b87('0xef')]+=0x1;if(_0x2b2db0[_0x2b87('0xf4')]>=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x119')]){this['queueCallerAbandonCreateState'](_0x2b2db0);}else{this[_0x2b87('0xc5')]({'active':![],'countdropretry':_0x2b2db0['countdropretry'],'scheduledat':moment()[_0x2b87('0x106')](this['voiceQueues'][_0x30eb81[_0x2b87('0xb9')]]['dialDropRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x5c2d1b['ContactId'],'ListId':_0x5c2d1b['ListId'],'VoiceQueueId':_0x5c2d1b[_0x2b87('0xfb')]||undefined,'CampaignId':_0x5c2d1b[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x11a')));var _0x4394c8=new History(_0x2b2db0);_0x4394c8['state']=0xa;_0x4394c8[_0x2b87('0xab')]=_0x2b87('0x118');_0x4394c8[_0x2b87('0xad')]=moment()['format'](_0x2b87('0xfa'));_0x4394c8[_0x2b87('0xac')]=_0x4394c8['starttime'];_0x4394c8[_0x2b87('0x11b')]=_0x2b2db0[_0x2b87('0x11b')];_0x4394c8['calleridnum']=_0x2b2db0['calleridnum'];this[_0x2b87('0xd0')](_0x4394c8)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x11c')));}}else{this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x69')]+=0x1;this['voiceQueues'][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x5e')]+=0x1;_0x2b2db0[_0x2b87('0xaa')]=0xb;_0x2b2db0[_0x2b87('0xab')]='Abandoned';_0x2b2db0[_0x2b87('0x11d')]=_0x2b87('0x11e');_0x2b2db0[_0x2b87('0x103')]+=0x1;_0x2b2db0[_0x2b87('0xef')]+=0x1;if(_0x2b2db0['countabandonedretry']>=this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]][_0x2b87('0x11f')]){this[_0x2b87('0x120')](_0x2b2db0);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2b2db0[_0x2b87('0x103')],'scheduledat':moment()['add'](this[_0x2b87('0x1e')][_0x30eb81[_0x2b87('0xb9')]]['dialAbandonedRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c2d1b['ContactId'],'ListId':_0x5c2d1b[_0x2b87('0xdb')],'VoiceQueueId':_0x5c2d1b[_0x2b87('0xfb')]||undefined,'CampaignId':_0x5c2d1b['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x121')));var _0x4394c8=new History(_0x2b2db0);_0x4394c8['state']=0xb;_0x4394c8['statedesc']=_0x2b87('0x122');_0x4394c8[_0x2b87('0xad')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));_0x4394c8[_0x2b87('0xac')]=_0x4394c8[_0x2b87('0xad')];_0x4394c8[_0x2b87('0x11b')]=_0x2b2db0[_0x2b87('0x11b')];_0x4394c8[_0x2b87('0x123')]=_0x2b2db0['calleridnum'];this['createHistory'](_0x4394c8)[_0x2b87('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x2b87('0x124')]=function(_0x514786){if(this[_0x2b87('0x23')][_0x514786[_0x2b87('0xe3')]]){this[_0x2b87('0x23')][_0x514786[_0x2b87('0xe3')]]['channel']=_0x514786[_0x2b87('0xb6')];}if(this[_0x2b87('0xaf')][_0x514786['uniqueid']]){this['uniqueId'][_0x514786[_0x2b87('0xe3')]][_0x2b87('0xb6')]=_0x514786[_0x2b87('0xb6')];}};Dialer[_0x2b87('0x19')]['syncQueueMember']=function(_0x1a329a){if(strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x4b')]]===_0x2b87('0x126')){if(this[_0x2b87('0x23')][_0x1a329a['actionid']]&&_['isNil'](this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0x127')])&&_0x1a329a['status']==='1'&&_0x1a329a['paused']==='0'){if(this[_0x2b87('0x20')][_0x1a329a[_0x2b87('0x128')]]){if(!this['agents'][_0x1a329a['stateinterface']][_0x2b87('0x127')]){this['agents'][_0x1a329a['stateinterface']]['locked']=!![];this['actions'][_0x1a329a[_0x2b87('0x125')]]['locked']=!![];this[_0x2b87('0x23')][_0x1a329a['actionid']][_0x2b87('0x128')]=_0x1a329a['stateinterface'];}}}}else if((strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]]['strategy']]||_0x2b87('0x18'))===_0x2b87('0x18')){if(this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]]){if(this[_0x2b87('0x20')][_0x1a329a[_0x2b87('0x128')]]){this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0x128')]=_0x1a329a['stateinterface'];if(_['isNil'](this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x1a329a['actionid']][_0x2b87('0xb9')]])){this['queueBooked'][this[_0x2b87('0x23')][_0x1a329a['actionid']]['queue']]=[];}this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x129')](_[_0x2b87('0xd8')](_[_0x2b87('0xd9')](this[_0x2b87('0x23')][_0x1a329a[_0x2b87('0x125')]],['idHopper',_0x2b87('0x128')]),{'status':_0x1a329a[_0x2b87('0xe0')],'paused':_0x1a329a[_0x2b87('0x12a')]}));}}}};function unlockQueueStatus(_0x1e50af,_0x3b488f){setTimeout(function(){if(_[_0x2b87('0x39')](_0x1e50af[_0x2b87('0x12b')])){loggerBooked[_0x2b87('0x97')](_0x2b87('0x12c'),_0x3b488f);}_0x1e50af[_0x2b87('0x12b')]=!![];loggerBooked[_0x2b87('0x7e')](_0x2b87('0x12d'),_0x3b488f,JSON['stringify'](_[_0x2b87('0xd9')](_0x1e50af,['name',_0x2b87('0x12b')])));},0x1f3);}Dialer[_0x2b87('0x19')]['syncQueueStatusComplete']=function(_0x49f266){var _0x5af457=this;var _0x44e611=_0x5af457[_0x2b87('0x1e')][_0x5af457['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]];if(strategy[this['voiceQueues'][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]]['queue']][_0x2b87('0x4b')]]===_0x2b87('0x126')){if(this[_0x2b87('0x23')][_0x49f266['actionid']]&&this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')]){this[_0x2b87('0x1d')][_0x2b87('0x12e')](this[_0x2b87('0x23')][_0x49f266['actionid']][_0x2b87('0x12f')],this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')])[_0x2b87('0xb7')](function(_0x524eb6){logger[_0x2b87('0x97')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x2b87('0x99')](_0x524eb6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5af457[_0x2b87('0xb8')](_0x5af457[_0x2b87('0x1e')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]);_0x5af457[_0x2b87('0x20')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0x128')]][_0x2b87('0x127')]=![];delete _0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]];unlockQueueStatus(_0x44e611);});}else{this[_0x2b87('0xb8')](this[_0x2b87('0x1e')][this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xda')],'ListId':this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xdb')],'VoiceQueueId':this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xfb')]||undefined,'CampaignId':this[_0x2b87('0x23')][_0x49f266['actionid']]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x130')));delete this[_0x2b87('0x23')][_0x49f266['actionid']];unlockQueueStatus(_0x44e611);}}else if((strategy[this[_0x2b87('0x1e')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]][_0x2b87('0x4b')]]||_0x2b87('0x18'))===_0x2b87('0x18')){var _0x49b37b;if(this['actions'][_0x49f266[_0x2b87('0x125')]]&&!_[_0x2b87('0x43')](this['queueBooked'][this['actions'][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]])){if(this[_0x2b87('0x131')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]){this[_0x2b87('0x131')][_0x5af457[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]=this[_0x2b87('0x131')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]?this[_0x2b87('0x131')][this[_0x2b87('0x23')][_0x49f266['actionid']][_0x2b87('0xb9')]]:this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]?this[_0x2b87('0x27')][this['actions'][_0x49f266['actionid']][_0x2b87('0xb9')]]['_rr']||0x0:0x0;}this[_0x2b87('0x27')][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x2b87('0x23')][_0x49f266[_0x2b87('0x125')]][_0x2b87('0xb9')]];for(var _0x2ffe67=0x0;_0x2ffe67=0x0;})['catch'](myreject(_0x50a0cf)));}}else{_0xe5d72a[_0x2b87('0x129')](ami[_0x2b87('0x14b')]({'action':_0x2b87('0x151'),'command':util['format'](_0x2b87('0x14c'),_0x34b495,!_['isUndefined'](config['timezones'][_0x3b3db4])?_0x3b3db4:'')})[_0x2b87('0xbc')](function(_0x35b418){return _0x35b418[_0x2b87('0x14e')][_0x2b87('0x14f')](_0x2b87('0x150'))>=0x0;})[_0x2b87('0xb7')](myreject(_0x50a0cf)));}BPromise[_0x2b87('0x152')](_0xe5d72a)[_0x2b87('0xbc')](function(_0x564e8f){var _0x56201f=_[_0x2b87('0x153')](_0x564e8f);if(_0x56201f){return _0x90d5a9(_0x56201f);}else{_0x39977e[_0x2b87('0x3d')]=_0x33dc70?_0x2b87('0x154'):_0x2b87('0x155');return _0x50a0cf(msgResponse('[ifTime][promiseAll]',_0x2b87('0x145'),'Global:\x20'+_0x33dc70+'\x20'+_0xc17d80+_0x2b87('0x156')+util[_0x2b87('0x99')](_0x34b495,{'showHidden':![],'depth':null})+_0x2b87('0x157')+_0x3b3db4));}})['catch'](function(_0x4d84f6){return _0x50a0cf(msgResponse(_0x2b87('0x142'),_0x2b87('0x145'),JSON[_0x2b87('0x78')](_0x4d84f6)));});});};Dialer[_0x2b87('0x19')][_0x2b87('0x158')]=function(_0x572523){var _0x36da65=this;return function(){switch(_0x572523[_0x2b87('0x54')]){case'progressive':freeVariablesPredictive(_0x572523);_0x36da65[_0x2b87('0x159')](_0x572523,0x1);break;case _0x2b87('0x15a'):freeVariablesPredictive(_0x572523);_0x36da65[_0x2b87('0x159')](_0x572523,_0x572523['dialPowerLevel']);break;case _0x2b87('0x15b'):_0x36da65['predictive'](_0x572523);break;case _0x2b87('0x15c'):freeVariablesPredictive(_0x572523);_0x36da65['handlePower'](_0x572523,0x1);break;default:freeVariablesPredictive(_0x572523);logger[_0x2b87('0x97')](_0x2b87('0x15d'),_0x572523[_0x2b87('0x3b')],_0x2b87('0x15e'));}};};Dialer[_0x2b87('0x19')][_0x2b87('0x15f')]=function(_0x4f1148){var _0x1ba29f=this;return function(){_0x1ba29f['handleIvr'](_0x4f1148);};};Dialer[_0x2b87('0x19')][_0x2b87('0x9')]=function(_0x3c9ea1){var _0x242874=this;if(isNotPreview(_0x3c9ea1[_0x2b87('0x54')])){if(isVoiceQueueOutbound(_0x3c9ea1['type'])&&isActive(_0x3c9ea1[_0x2b87('0x53')])){_0x3c9ea1['sendMessageOneNotActive']=!![];BPromise[_0x2b87('0xbf')]()[_0x2b87('0xbc')](checkIsLoggedIn(_0x3c9ea1,_0x3c9ea1['loggedIn']))[_0x2b87('0xbc')](checkIsActive(_0x3c9ea1,_0x3c9ea1[_0x2b87('0x53')]))[_0x2b87('0xbc')](checkInterval(_0x3c9ea1))[_0x2b87('0xbc')](_0x242874[_0x2b87('0x13d')](_0x3c9ea1))['then'](_0x242874['checkIfTime'](_0x3c9ea1[_0x2b87('0x160')],_0x3c9ea1[_0x2b87('0x161')],_0x3c9ea1[_0x2b87('0x3b')],_0x3c9ea1))['then'](_0x242874['checkIfTimeIntervals'](_0x3c9ea1[_0x2b87('0x40')],_0x3c9ea1[_0x2b87('0x161')],_0x3c9ea1['name'],_0x3c9ea1))['then'](_0x242874['checkDialMethod'](_0x3c9ea1))[_0x2b87('0xb7')](loggerCatchQueueSummary(_0x2b87('0x162'),_0x3c9ea1));}else{notSendMessagesQueue(_0x3c9ea1);}}else{freeVariablesPredictive(_0x3c9ea1);}};Dialer[_0x2b87('0x19')][_0x2b87('0x13c')]=function(){var _0xd1295e=this;var _0x23a0f4;for(var _0x464165 in this[_0x2b87('0x1f')]){if(typeof this['campaigns'][_0x464165]!=='undefined'){_0x23a0f4=this[_0x2b87('0x1f')][_0x464165];if(isCampaignIvr(_0x23a0f4[_0x2b87('0x4a')])&&isActive(_0x23a0f4[_0x2b87('0x76')])){_0x23a0f4[_0x2b87('0xa2')]=!![];BPromise[_0x2b87('0xbf')]()['then'](checkIsActive(_0x23a0f4,_0x23a0f4[_0x2b87('0x76')]))['then'](checkInterval(_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x13d')](_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x141')](_0x23a0f4[_0x2b87('0x160')],_0x23a0f4[_0x2b87('0x161')],_0x23a0f4['name'],_0x23a0f4))['then'](_0xd1295e[_0x2b87('0x143')](_0x23a0f4[_0x2b87('0x40')],_0x23a0f4[_0x2b87('0x161')],_0x23a0f4[_0x2b87('0x3b')],_0x23a0f4))[_0x2b87('0xbc')](_0xd1295e[_0x2b87('0x15f')](_0x23a0f4))[_0x2b87('0xb7')](loggerCatchQueueSummary(_0x2b87('0x163'),_0x23a0f4));}else{notSendMessagesCampaign(_0x23a0f4);}}}};function getCallerIdRandom(_0x5808b6,_0x20f25f){var _0x113818;var _0x3ad6c4;var _0x1093fe;if(_0x20f25f<=0x0){_0x20f25f=0x1;}_0x113818=new RegExp(_0x2b87('0x164')+_0x20f25f+'}$');_0x3ad6c4=Math['pow'](0xa,_0x20f25f-0x1);_0x1093fe=Math['pow'](0xa,_0x20f25f)-0x1;return util[_0x2b87('0x79')]('%s',_[_0x2b87('0x165')](_0x5808b6,_0x113818,_[_0x2b87('0x166')](_0x3ad6c4,_0x1093fe)));}function extractCalleridName(_0x5b01e6){var _0x3ea9e4=_0x5b01e6['match'](/"(.*?)"/);return _0x3ea9e4?_0x3ea9e4[0x1]:_0x5b01e6;}function extractCalleridNumber(_0x4b8950){var _0xa7d1=_0x4b8950[_0x2b87('0x167')](/<(.*?)>/);return _0xa7d1?_0xa7d1[0x1]:_0x4b8950;}Dialer['prototype']['actionOriginate']=function(_0x3c78ac,_0x18f407){var _0x392496=this;var _0x55f3d7=uuid['v4']();this[_0x2b87('0x23')][_0x55f3d7]=new Action(_0x3c78ac,_0x18f407,_0x55f3d7);return new BPromise(function(_0x5abcb3,_0x52cba8){if(_[_0x2b87('0x39')](_0x3c78ac)&&typeof _0x3c78ac!==_0x2b87('0x168')){return _0x52cba8(msgResponse(_0x2b87('0x169'),_0x2b87('0x145'),_0x2b87('0x16a')));}if(_[_0x2b87('0x39')](_0x18f407['Contact'][_0x2b87('0x16b')])||_0x18f407[_0x2b87('0x16c')]['phone']===null){return _0x52cba8(msgResponse('originate',_0x2b87('0x145'),'contact\x20is\x20undefine'));}var _0x546817={'XMD-CALLERID':_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x16d')](),'XMD-AGI':_0x3c78ac[_0x2b87('0x10a')]?util[_0x2b87('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c78ac[_0x2b87('0x10a')]):_0x2b87('0x16e'),'XMD-AGIAFTER':_0x3c78ac[_0x2b87('0x110')]?util[_0x2b87('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c78ac[_0x2b87('0x110')]):'NONE','XMD-QUEUE':_0x3c78ac['type']===_0x2b87('0x16f')?util[_0x2b87('0x79')]('\x22%s,%s%s,,,%s\x22',_0x3c78ac[_0x2b87('0x3b')],_0x3c78ac['dialQueueOptions']||'',_0x3c78ac['dialAgiAfterHangupAgent']?'c':'',_0x3c78ac[_0x2b87('0x117')]||0x3):'NONE','XMD-CONTACTID':_0x18f407[_0x2b87('0xda')],'XMD-CDRTYPE':_0x2b87('0x8'),'CALLERID(all)':_0x392496['actions'][_0x55f3d7][_0x2b87('0x16d')](),'XMD-AMD':_0x3c78ac[_0x2b87('0xfe')]?_0x2b87('0x170'):_0x2b87('0x16e'),'XMD-DESTINATION':_0x2b87('0x171')};if(_0x3c78ac[_0x2b87('0xfe')]){_0x546817[_0x2b87('0x172')]=_0x3c78ac['dialAMDInitialSilence']||0x9c4;_0x546817[_0x2b87('0x173')]=_0x3c78ac[_0x2b87('0x174')]||0x5dc;_0x546817['XMD-AMDAFTERGREETINGSILENCE']=_0x3c78ac['dialAMDAfterGreetingSilence']||0x320;_0x546817[_0x2b87('0x175')]=_0x3c78ac[_0x2b87('0x176')]||0x1388;_0x546817[_0x2b87('0x177')]=_0x3c78ac[_0x2b87('0x178')]||0x64;_0x546817['XMD-AMDBETWEENWORDSSILENCE']=_0x3c78ac[_0x2b87('0x179')]||0x32;_0x546817['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3c78ac[_0x2b87('0x17a')]||0x3;_0x546817[_0x2b87('0x17b')]=_0x3c78ac['dialAMDSilenceThreshold']||0x100;_0x546817[_0x2b87('0x17c')]=_0x3c78ac[_0x2b87('0x17d')]||0x1388;}if(_0x3c78ac[_0x2b87('0x4a')]==='outbound'){_0x546817[_0x2b87('0x17e')]=_0x18f407['VoiceQueueId'];}else{_0x546817[_0x2b87('0x17f')]=_0x18f407[_0x2b87('0xfc')];}for(var _0x4a263e in _0x18f407[_0x2b87('0x16c')]){if(typeof _0x18f407[_0x2b87('0x16c')][_0x4a263e]!==_0x2b87('0xb3')){if(isNotNull(_0x18f407[_0x2b87('0x16c')][_0x4a263e])&&_0x4a263e!=='id'&&_0x4a263e!==_0x2b87('0x180')&&_0x4a263e!==_0x2b87('0x181')&&_0x4a263e!==_0x2b87('0x182')){_0x546817[util[_0x2b87('0x79')]('%s%s',_0x2b87('0x183'),_['toUpper'](_0x4a263e))]=_0x18f407[_0x2b87('0x16c')][_0x4a263e];}}}var _0x500029=_0x392496[_0x2b87('0xdf')](_0x3c78ac[_0x2b87('0x75')])?getCallerId(_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x77')],_0x3c78ac[_0x2b87('0x55')],_0x3c78ac[_0x2b87('0x184')]>0x0?getCallerIdRandom(_0x3c78ac[_0x2b87('0x185')],_0x3c78ac[_0x2b87('0x184')]):_0x3c78ac[_0x2b87('0x185')]):getCallerId(_[_0x2b87('0xb5')](_0x3c78ac['TrunkBackup'])?_0x3c78ac['Trunk'][_0x2b87('0x77')]:_0x3c78ac['TrunkBackup'][_0x2b87('0x77')],_0x3c78ac[_0x2b87('0x55')],_0x3c78ac['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3c78ac[_0x2b87('0x185')],_0x3c78ac[_0x2b87('0x184')]):_0x3c78ac[_0x2b87('0x185')]);if(_0x500029){_0x546817['XMD-ORIGINATECALLERIDNAME']=_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x186')]=extractCalleridName(_0x500029);_0x546817[_0x2b87('0x187')]=_0x392496[_0x2b87('0x23')][_0x55f3d7][_0x2b87('0x188')]=extractCalleridNumber(_0x500029);}return ami[_0x2b87('0x14b')]({'actionid':_0x55f3d7,'action':_0x2b87('0x169'),'channel':_0x392496[_0x2b87('0xdf')](_0x3c78ac['Trunk'])?util[_0x2b87('0x79')]('SIP/%s/%s%s',_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x3b')],isNotNull(_0x3c78ac['dialPrefix'])?_0x3c78ac[_0x2b87('0x57')][_0x2b87('0x189')]()||'':'',_0x3c78ac[_0x2b87('0x18a')]>0x0?_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')][_0x2b87('0x18b')](_0x3c78ac['dialCutDigit']):_0x18f407['Contact'][_0x2b87('0x16b')]):util[_0x2b87('0x79')](_0x2b87('0x18c'),_[_0x2b87('0xb5')](_0x3c78ac['TrunkBackup'])?_0x3c78ac[_0x2b87('0x75')][_0x2b87('0x3b')]:_0x3c78ac[_0x2b87('0x13e')]['name'],isNotNull(_0x3c78ac[_0x2b87('0x57')])?_0x3c78ac[_0x2b87('0x57')]['trim']()||'':'',_0x3c78ac[_0x2b87('0x18a')]>0x0?_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')][_0x2b87('0x18b')](_0x3c78ac[_0x2b87('0x18a')]):_0x18f407[_0x2b87('0x16c')][_0x2b87('0x16b')]),'callerid':_0x500029,'Exten':'xcally-motion-dialer','Context':_0x2b87('0x18d'),'Priority':'1','variable':_0x546817,'timeout':(_0x3c78ac['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x55f3d7})['then'](function(_0x1f17d4){return _0x5abcb3(_0x1f17d4);})[_0x2b87('0xb7')](function(_0x1ebf5b){_0x3c78ac['outboundOriginateFailureCallsDay']+=0x1;var _0x1698c5=new History(_0x392496[_0x2b87('0x23')][_0x55f3d7]);logger[_0x2b87('0x97')](util[_0x2b87('0x79')](_0x2b87('0x18e'),JSON[_0x2b87('0x78')](_0x1ebf5b)));_0x1698c5['state']=0xe;_0x1698c5[_0x2b87('0xab')]=_0x2b87('0x18f');_0x1698c5[_0x2b87('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1698c5['endtime']=_0x1698c5[_0x2b87('0xad')];_0x392496['createHistory'](_0x1698c5)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x190')));_0x392496['moveContactManagedDialer'](_0x1698c5)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x190')))['finally'](function(){delete _0x392496['actions'][_0x55f3d7];return _0x52cba8(msgResponse(_0x2b87('0x169'),'Error',_0x2b87('0x191')));});});});};Dialer[_0x2b87('0x19')][_0x2b87('0x2c')]=function(_0x2c925a){var _0x53ce35=this['actions'][_0x2c925a[_0x2b87('0x125')]];if(_0x53ce35){delete this[_0x2b87('0x23')][_0x2c925a[_0x2b87('0x125')]];_0x53ce35[_0x2b87('0x116')]=moment()['format'](_0x2b87('0xfa'));var _0x1c6dfb=_0x53ce35[_0x2b87('0x4a')]===_0x2b87('0x94')?this[_0x2b87('0x1f')][_0x53ce35['queue']]:this['voiceQueues'][_0x53ce35[_0x2b87('0x192')]()];if(!this[_0x2b87('0xde')](_0x2c925a['response'])){this['updateOriginated'](_0x1c6dfb);return this[_0x2b87('0x193')](_0x53ce35,_0x1c6dfb,_0x2c925a)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x194')));}this[_0x2b87('0xaf')][_0x2c925a['uniqueid']]=_0x53ce35;}};Dialer[_0x2b87('0x19')][_0x2b87('0x195')]=function(_0x27c6cf,_0x58a29a,_0x27c562){var _0x20defb=new History(_0x58a29a);if(_0x20defb[_0x2b87('0xf0')]+_0x20defb['countcongestionretry']+_0x20defb[_0x2b87('0xf2')]+_0x20defb[_0x2b87('0xf3')]+_0x20defb['countdropretry']+_0x20defb[_0x2b87('0x103')]+_0x20defb[_0x2b87('0xee')]+_0x20defb[_0x2b87('0xf5')]>=_0x27c562[_0x2b87('0xf6')]-0x1){return!![];}switch(_0x27c6cf){case 0x3:if(_0x20defb[_0x2b87('0xf2')]>=_0x27c562[_0x2b87('0x196')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countnoanswerretry':_0x20defb[_0x2b87('0xf2')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialNoAnswerRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb['ListId'],'VoiceQueueId':_0x20defb['VoiceQueueId']||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x20defb['countbusyretry']>=_0x27c562[_0x2b87('0x197')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countbusyretry':_0x20defb['countbusyretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x198')],'minutes')[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x199')));break;case 0x8:if(_0x20defb[_0x2b87('0xf1')]>=_0x27c562['dialCongestionMaxRetry']-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countcongestionretry':_0x20defb[_0x2b87('0xf1')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x19a')],'minutes')[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0x19b')));break;case 0x0:if(_0x20defb[_0x2b87('0xf3')]>=_0x27c562[_0x2b87('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x20defb['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialNoSuchNumberRetryFrequency'],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0x19d')));}break;case 0xa:if(_0x20defb[_0x2b87('0xf4')]>=_0x27c562[_0x2b87('0x119')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x20defb[_0x2b87('0xf4')]+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562['dialDropRetryFrequency'],'minutes')[_0x2b87('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb['ListId'],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x20defb[_0x2b87('0x103')]>=_0x27c562['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x20defb[_0x2b87('0x103')]+=0x1,'scheduledat':moment()['add'](_0x27c562[_0x2b87('0x19e')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb['ContactId'],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x121')));break;case 0x13:if(_0x20defb[_0x2b87('0xee')]>=_0x27c562['dialMachineMaxRetry']-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countmachineretry':_0x20defb[_0x2b87('0xee')]+=0x1,'scheduledat':moment()['add'](_0x27c562[_0x2b87('0xf8')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})['catch'](loggerCatch(_0x2b87('0xfd')));break;case 0x14:if(_0x20defb[_0x2b87('0xf5')]>=_0x27c562[_0x2b87('0x19f')]-0x1){return!![];}this[_0x2b87('0xc5')]({'active':![],'countagentrejectretry':_0x20defb['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x2b87('0x106')](_0x27c562[_0x2b87('0x1a0')],_0x2b87('0xf9'))[_0x2b87('0x79')](_0x2b87('0xfa')),'ContactId':_0x20defb[_0x2b87('0xda')],'ListId':_0x20defb[_0x2b87('0xdb')],'VoiceQueueId':_0x20defb[_0x2b87('0xfb')]||undefined,'CampaignId':_0x20defb[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1a1')));break;default:return!![];}};Dialer[_0x2b87('0x19')][_0x2b87('0x193')]=function(_0x1a777d,_0x5cb604,_0x459014){var _0x9acdaa=this;var _0x57b758=new History(_0x1a777d);return new BPromise(function(_0x18f732,_0x36922c){if(_[_0x2b87('0x39')](_0x5cb604)&&typeof _0x5cb604!=='object'){return _0x36922c(msgResponse(_0x2b87('0x1a2'),'Failure',_0x2b87('0x1a3')));}if(_['isUndefined'](_0x459014)&&typeof _0x459014!==_0x2b87('0x168')){return _0x36922c(msgResponse(_0x2b87('0x1a2'),_0x2b87('0x145'),'evt\x20is\x20undefine'));}switch(_0x459014[_0x2b87('0x10d')]){case'0':_0x5cb604[_0x2b87('0x61')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0x0;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1a4');_0x57b758[_0x2b87('0xf3')]+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1a6'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1a8')));_0x9acdaa['createHistory'](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1a9')));if(_0x9acdaa['checkRetriveMax'](0x0,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf3')]>=_0x5cb604[_0x2b87('0x19c')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,'reason\x200\x20no\x20such\x20number....');}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1aa'));}}break;case'3':_0x5cb604[_0x2b87('0x60')]+=0x1;_0x57b758['state']=0x3;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1ab');_0x57b758['countnoanswerretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1ac'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1ad')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1ae')));if(_0x9acdaa[_0x2b87('0x195')](0x3,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf2')]>=_0x5cb604['dialNoAnswerMaxRetry']){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1af'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1af'));}}break;case'5':_0x5cb604['outboundBusyCallsDay']+=0x1;_0x57b758['state']=0x5;_0x57b758['statedesc']=_0x2b87('0x1b0');_0x57b758['countbusyretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')]('custom:agentbusy',ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1b1')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)['catch'](loggerCatch(_0x2b87('0x1b2')));if(_0x9acdaa[_0x2b87('0x195')](0x5,_0x1a777d,_0x5cb604)){if(_0x57b758['countbusyretry']>=_0x5cb604[_0x2b87('0x197')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b3'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b3'));}}break;case'8':_0x5cb604['outboundCongestionCallsDay']+=0x1;_0x57b758[_0x2b87('0xaa')]=0x8;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x1b4');_0x57b758['countcongestionretry']+=0x1;_0x57b758[_0x2b87('0xef')]+=0x1;ami[_0x2b87('0x1a5')](_0x2b87('0x1b5'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1b6')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1b7')));if(_0x9acdaa['checkRetriveMax'](0x8,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf1')]>=_0x5cb604['dialCongestionMaxRetry']){_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b8'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1b8'));}}break;case'11':_0x5cb604[_0x2b87('0x1b9')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0xb;_0x57b758[_0x2b87('0xab')]=_0x2b87('0x122');_0x57b758[_0x2b87('0x103')]+=0x1;_0x57b758['countglobal']+=0x1;_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1ba')));if(_0x9acdaa['checkRetriveMax'](0xb,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0x103')]>=_0x5cb604[_0x2b87('0x11f')]){_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1bb'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,'reason\x2011\x20abandoned');}}break;case'20':_0x5cb604[_0x2b87('0x64')]+=0x1;_0x57b758[_0x2b87('0xaa')]=0x14;_0x57b758['statedesc']=_0x2b87('0x1bc');_0x57b758[_0x2b87('0xf5')]+=0x1;_0x57b758['countglobal']+=0x1;ami['emit'](_0x2b87('0x1bd'),ut[_0x2b87('0x1a7')](_0x1a777d,_0x2b87('0x1be')));_0x9acdaa[_0x2b87('0xd0')](_0x57b758)[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1bf')));if(_0x9acdaa['checkRetriveMax'](0x14,_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf5')]>=_0x5cb604[_0x2b87('0x19f')]){_0x9acdaa[_0x2b87('0x105')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1c0'));}else{_0x9acdaa[_0x2b87('0x104')](_0x57b758,_0x18f732,_0x36922c,_0x2b87('0x1c0'));}}break;default:_0x5cb604[_0x2b87('0x65')]+=0x1;_0x57b758['state']=0xc;_0x57b758[_0x2b87('0xab')]=_0x459014[_0x2b87('0x10d')];_0x9acdaa['createHistory'](_0x57b758)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x9acdaa[_0x2b87('0x195')](_0x459014[_0x2b87('0x10d')],_0x1a777d,_0x5cb604)){if(_0x57b758[_0x2b87('0xf0')]+_0x57b758[_0x2b87('0xf1')]+_0x57b758[_0x2b87('0xf2')]+_0x57b758['countnosuchnumberretry']+_0x57b758['countdropretry']+_0x57b758['countabandonedretry']+_0x57b758[_0x2b87('0xee')]+_0x57b758['countagentrejectretry']>=_0x5cb604[_0x2b87('0xf6')]){_0x9acdaa['stateGlobal'](_0x57b758,_0x18f732,_0x36922c,_0x459014[_0x2b87('0x10d')]);}else{_0x9acdaa['createStateFinal'](_0x57b758,_0x18f732,_0x36922c,_0x459014[_0x2b87('0x10d')]);}}}});};Dialer['prototype'][_0x2b87('0x104')]=function(_0x115e21,_0x4835ba,_0x15c072,_0x124db3){var _0x4b02da=new Final(_0x115e21);_0x4b02da[_0x2b87('0xaa')]=0xf;_0x4b02da[_0x2b87('0xab')]='Global';this['createStateFinal'](_0x4b02da,_0x4835ba,_0x15c072,_0x124db3);};Dialer[_0x2b87('0x19')]['createStateFinal']=function(_0x20704d,_0x3053c5,_0x1c4572,_0x43d31e){this[_0x2b87('0xce')](_0x20704d)['then'](function(){return _0x3053c5(msgResponse(_0x2b87('0x1a2'),_0x2b87('0x1c1'),_0x43d31e));})[_0x2b87('0xb7')](function(){return _0x1c4572(msgResponse(_0x2b87('0x1c2'),_0x2b87('0x145'),_0x2b87('0x1c3')));});};Dialer[_0x2b87('0x19')][_0x2b87('0x15b')]=function(_0x196e03){var _0x2d07b0=_0x196e03[_0x2b87('0x1c4')]/0x64;var _0x5c7eb0=_0x196e03[_0x2b87('0x5f')]/(_0x196e03[_0x2b87('0x5f')]+_0x196e03[_0x2b87('0x59')]);var _0x254930=Math[_0x2b87('0x1c5')](_0x196e03[_0x2b87('0x70')]*(_0x196e03[_0x2b87('0x1c6')]/0x64));var _0x53a68f=Math[_0x2b87('0x1c5')](_0x196e03[_0x2b87('0x70')]*(_0x196e03['predictiveIntervalMinThreshold']/0x64));var _0x192b1d=_0x196e03[_0x2b87('0xa4')]+_0x196e03[_0x2b87('0x4e')];var _0x427abe=Math['floor'](_0x196e03[_0x2b87('0x72')]*_0x196e03[_0x2b87('0x8d')]*_0x196e03['predictiveIntervalHitRate']*_0x196e03[_0x2b87('0x6e')]);if(_[_0x2b87('0x39')](_0x196e03['startProgressive'])){if(!_['isUndefined'](_0x196e03[_0x2b87('0x74')])){_0x196e03['startPredictive']=undefined;loggerPredictive[_0x2b87('0x97')](_0x2b87('0x1c7'),_0x2b87('0x1c8'));}if(!_[_0x2b87('0x39')](_0x196e03[_0x2b87('0x93')])){loggerPredictive[_0x2b87('0x97')](_0x2b87('0x1c7'),_0x2b87('0x1c9'));clearInterval(_0x196e03[_0x2b87('0x93')]);_0x196e03['handlePredictive']=undefined;}_0x196e03[_0x2b87('0x1ca')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive[_0x2b87('0x7e')](_0x196e03[_0x2b87('0x3b')],'collection\x20data\x20in\x20progressive\x20at',_0x196e03[_0x2b87('0x1ca')]);this[_0x2b87('0x159')](_0x196e03,0x1);}else if(ifInterval(_0x196e03[_0x2b87('0x1cb')],_0x196e03[_0x2b87('0x1ca')])){this[_0x2b87('0x159')](_0x196e03,0x1);loggerPredictiveCalls['info'](_0x2b87('0x1cc'),_0x196e03['startProgressive'],_0x196e03[_0x2b87('0x3b')]);_0x196e03['erlangCalls']=0x0;_0x196e03[_0x2b87('0x6c')]=0x0;}else if(_0x2d07b0<_0x5c7eb0&&_0x196e03[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){freeVariablesPredictive(_0x196e03);loggerPredictive[_0x2b87('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x5c7eb0,_0x2b87('0x1ca'),_0x196e03['name']);}else if(_0x427abe<_0x196e03[_0x2b87('0x6c')]&&_0x196e03[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){freeVariablesPredictive(_0x196e03);loggerPredictive[_0x2b87('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2b87('0x1cf'),_0x427abe,_0x2b87('0x1d0'),_0x196e03['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x196e03[_0x2b87('0x3b')]);}else if(!ifInterval(_0x196e03[_0x2b87('0x1cb')],_0x196e03['startProgressive'])&&_[_0x2b87('0x39')](_0x196e03[_0x2b87('0x74')])&&!_['isUndefined'](_0x196e03[_0x2b87('0x1ca')])){_0x196e03[_0x2b87('0x74')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive['info'](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d1'),_0x196e03[_0x2b87('0x74')]);this[_0x2b87('0xc2')](_0x196e03[_0x2b87('0x1cb')])['then'](this[_0x2b87('0x1d2')](_0x196e03))[_0x2b87('0xbc')](mergeDataErlangB(_0x196e03))[_0x2b87('0xbc')](this[_0x2b87('0x1d3')](_0x196e03))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x196e03));}else if(!ifInterval(_0x196e03['dialPredictiveInterval'],_0x196e03['startPredictive'])){_0x196e03[_0x2b87('0x6c')]=0x0;_0x196e03[_0x2b87('0x74')]=moment()[_0x2b87('0x79')](_0x2b87('0xfa'));loggerPredictive[_0x2b87('0x7e')](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d4'),_0x196e03['startPredictive']);clearInterval(_0x196e03[_0x2b87('0x93')]);_0x196e03[_0x2b87('0x93')]=undefined;this[_0x2b87('0xc2')](_0x196e03[_0x2b87('0x1cb')])['then'](this['getDataPredictive'](_0x196e03))[_0x2b87('0xbc')](mergeDataErlangB(_0x196e03))['then'](this[_0x2b87('0x1d3')](_0x196e03))[_0x2b87('0xb7')](loggerCatchPredictive(_0x2b87('0x1d5'),_0x196e03));}else if(_0x196e03['predictiveIntervalAvailable']&&_0x192b1d<_0x196e03[_0x2b87('0x70')]-_0x53a68f){freeVariablesPredictive(_0x196e03);loggerPredictive['info'](_0x196e03['name'],_0x2b87('0x1d6'),_0x192b1d,')\x20are\x20less\x20than\x20threshold\x20(',_0x196e03[_0x2b87('0x70')],'-',_0x53a68f,'=',_0x196e03[_0x2b87('0x70')]-_0x53a68f,')');}else if(_0x196e03['predictiveIntervalAvailable']&&_0x192b1d>_0x196e03[_0x2b87('0x70')]+_0x254930){freeVariablesPredictive(_0x196e03);loggerPredictive['info'](_0x196e03[_0x2b87('0x3b')],_0x2b87('0x1d6'),_0x192b1d,_0x2b87('0x1d7'),_0x196e03['predictiveIntervalAvailable'],'+',_0x254930,'=',_0x196e03[_0x2b87('0x70')]+_0x254930,')');}};Dialer['prototype'][_0x2b87('0x1d2')]=function(_0x1dcb17){var _0x1b17fb=this;return function(_0x56c616){return new BPromise(function(_0x206c6d,_0x1ec5d5){_[_0x2b87('0xd8')](_0x1dcb17,_0x56c616[0x0]);if(checkGetDataPredictive(_0x56c616[0x0])){var _0x1d6760=_0x1dcb17[_0x2b87('0x70')]=_0x1dcb17[_0x2b87('0x4e')]+_0x1dcb17['available'];var _0x11daf5=_0x1dcb17[_0x2b87('0x1cb')]*0x3c;var _0x4627a7=_0x56c616[0x0][_0x2b87('0x68')]+_0x56c616[0x0][_0x2b87('0x67')];var _0x385c00=(_0x56c616[0x0][_0x2b87('0x66')]+_0x56c616[0x0][_0x2b87('0x6a')]+_0x56c616[0x0][_0x2b87('0x69')])/_0x56c616[0x0][_0x2b87('0x71')];_0x1dcb17[_0x2b87('0x6d')]=_0x385c00>0x0?_0x385c00:0x1;switch(_0x1dcb17[_0x2b87('0x1cd')]){case _0x2b87('0x1ce'):var _0x27c85c=_0x1dcb17[_0x2b87('0x1c4')]/0x64;return _0x1b17fb[_0x2b87('0x1d8')](_0x1d6760,_0x11daf5,_0x4627a7,_0x385c00,_0x27c85c)[_0x2b87('0xbc')](function(_0x297d39){return _0x206c6d(_0x297d39);});case'agentBusyFactor':var _0x18db8d=_0x1dcb17[_0x2b87('0x1c4')]/0x64;return _0x1b17fb['busyFactor'](_0x1d6760,_0x11daf5,_0x4627a7,_0x385c00,_0x18db8d)[_0x2b87('0xbc')](function(_0x44318d){return _0x206c6d(_0x44318d);});default:return _0x1ec5d5(msgResponse('[getDataPredictive]',_0x2b87('0x145'),_0x2b87('0x1d9')));}}else{return _0x1ec5d5(msgResponse(_0x2b87('0x1da'),_0x2b87('0x145'),_0x2b87('0x1db')));}});};};Dialer[_0x2b87('0x19')][_0x2b87('0x1dc')]=function(_0x1e4e7a){var _0x384b33=this;return function(_0x3c75f8){return new BPromise(function(_0x2317d2,_0x51a944){_[_0x2b87('0xd8')](_0x1e4e7a,_0x3c75f8[0x0]);if(checkGetDataPredictive(_0x3c75f8[0x0])){loggerPredictive[_0x2b87('0x7e')](JSON[_0x2b87('0x78')](_0x3c75f8[0x0]));if(_0x1e4e7a[_0x2b87('0x1cd')]===_0x2b87('0x1ce')){return _0x384b33[_0x2b87('0xcc')](_0x1e4e7a['id'])[_0x2b87('0xbc')](function(_0x9e247){var _0x366225=_0x1e4e7a[_0x2b87('0x1dd')]-_0x9e247[0x0]['outboundQueuePauses'];var _0x290d35=_0x1e4e7a[_0x2b87('0x1cb')]*0x3c;var _0x304600=_0x3c75f8[0x0][_0x2b87('0x68')]+_0x3c75f8[0x0][_0x2b87('0x67')];var _0x153cb8=(_0x3c75f8[0x0][_0x2b87('0x66')]+_0x3c75f8[0x0][_0x2b87('0x6a')]+_0x3c75f8[0x0][_0x2b87('0x69')])/_0x3c75f8[0x0]['predictiveIntervalTotalCalls'];var _0x546c3e=_0x1e4e7a['dialPredictiveOptimizationPercentage']/0x64;_0x1e4e7a[_0x2b87('0x6f')]=_0x9e247[0x0][_0x2b87('0x1de')]||0x0;_0x1e4e7a[_0x2b87('0x6d')]=_0x153cb8>0x0?_0x153cb8:0x1;return _0x384b33[_0x2b87('0x1d8')](_0x366225,_0x290d35,_0x304600,_0x153cb8,_0x546c3e);})['then'](function(_0x77e35d){return _0x2317d2(_0x77e35d);})[_0x2b87('0xb7')](function(_0x3fe90e){return _0x51a944(msgResponse(_0x2b87('0x1df'),'Failure',JSON[_0x2b87('0x78')](_0x3fe90e)));});}if(_0x1e4e7a[_0x2b87('0x1cd')]===_0x2b87('0x1e0')){return _0x384b33[_0x2b87('0xcc')](_0x1e4e7a['id'])['then'](function(_0x102b79){var _0x3c6ada=_0x1e4e7a[_0x2b87('0x1dd')]-_0x102b79[0x0][_0x2b87('0x1de')];var _0x2a3a0f=_0x1e4e7a[_0x2b87('0x1cb')]*0x3c;var _0x4c2ee=_0x3c75f8[0x0][_0x2b87('0x68')]+_0x3c75f8[0x0][_0x2b87('0x67')];var _0x37950f=(_0x3c75f8[0x0][_0x2b87('0x66')]+_0x3c75f8[0x0][_0x2b87('0x6a')]+_0x3c75f8[0x0][_0x2b87('0x69')])/_0x3c75f8[0x0][_0x2b87('0x71')];var _0x50a9ce=_0x1e4e7a['dialPredictiveOptimizationPercentage']/0x64;_0x1e4e7a['predictiveIntervalPauses']=_0x102b79[0x0][_0x2b87('0x1de')]||0x0;_0x1e4e7a[_0x2b87('0x6d')]=_0x37950f>0x0?_0x37950f:0x1;return _0x384b33[_0x2b87('0x1e1')](_0x3c6ada,_0x2a3a0f,_0x4c2ee,_0x37950f,_0x50a9ce);})[_0x2b87('0xbc')](function(_0x48122d){return _0x2317d2(_0x48122d);})[_0x2b87('0xb7')](function(_0x5a54ff){return _0x51a944(msgResponse(_0x2b87('0x1df'),_0x2b87('0x145'),JSON[_0x2b87('0x78')](_0x5a54ff)));});}}else{return _0x51a944(msgResponse(_0x2b87('0x1da'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x2b87('0x1d3')]=function(_0x3ecdf8){var _0x292a42=this;return function(){var _0x47a350=0x0;var _0x5d08f8=Math[_0x2b87('0x1e2')](_0x3ecdf8[_0x2b87('0x73')]*0x3e8);if(_0x5d08f8>0x0){_0x5d08f8=_0x5d08f8<0x64?0x64:_0x5d08f8;loggerPredictive[_0x2b87('0x7e')](_0x3ecdf8['name'],'one\x20call\x20every:',_0x5d08f8,_0x2b87('0x47'));_0x3ecdf8[_0x2b87('0x93')]=setInterval(function(){_0x292a42[_0x2b87('0x93')](_0x3ecdf8);loggerPredictiveCalls[_0x2b87('0x7e')](_0x2b87('0x1e3'),_0x47a350+=0x1);},_0x5d08f8);}else{loggerPredictive[_0x2b87('0x7e')](_0x3ecdf8[_0x2b87('0x3b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2b87('0x19')][_0x2b87('0x1e4')]=function(_0x2443ce,_0x1f1692){var _0x404fc6=this;return function(_0x3597ea){if(_[_0x2b87('0x43')](_0x3597ea)){if(_[_0x2b87('0xb5')](_0x1f1692['UserId'])||!_0x1f1692['recallme']){if(_0x2443ce[_0x2b87('0x54')]===_0x2b87('0x15c')){_0x2443ce['queueStatusComplete']=_['isUndefined'](_0x2443ce['queueStatusComplete'])?!![]:_0x2443ce['queueStatusComplete'];var _0x198c30=uuid['v4']();_0x404fc6[_0x2b87('0x23')][_0x198c30]=new Action(_0x2443ce,_0x1f1692,_0x198c30);loggerBooked[_0x2b87('0x7e')](_0x2b87('0x1e5'),_0x198c30,'queueStatusComplete:\x20',JSON[_0x2b87('0x78')](_0x2443ce['queueStatusComplete']),_0x2b87('0x1e6'),_0x2443ce['name']);if(_0x2443ce[_0x2b87('0x12b')]){_0x2443ce[_0x2b87('0x12b')]=![];_0x404fc6[_0x2b87('0x27')][_0x404fc6[_0x2b87('0x23')][_0x198c30]['queue']]=[];ami['Action']({'actionid':_0x198c30,'action':_0x2b87('0x1e7'),'queue':_0x2443ce[_0x2b87('0x3b')]})[_0x2b87('0xb7')](function(){_0x404fc6['updateOriginated'](_0x2443ce);_0x404fc6[_0x2b87('0xc5')]({'active':![],'ContactId':_0x404fc6[_0x2b87('0x23')][_0x198c30]['ContactId'],'ListId':_0x404fc6[_0x2b87('0x23')][_0x198c30]['ListId'],'VoiceQueueId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xfb')]||undefined,'CampaignId':_0x404fc6['actions'][_0x198c30]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1e8')));delete _0x404fc6[_0x2b87('0x23')][_0x198c30];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x2b87('0x78')](_0x2443ce['queueStatusComplete']),_0x2b87('0x1e6'),_0x2443ce[_0x2b87('0x3b')]);_0x404fc6[_0x2b87('0xb8')](_0x2443ce);_0x404fc6[_0x2b87('0xc5')]({'active':![],'ContactId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xda')],'ListId':_0x404fc6['actions'][_0x198c30]['ListId'],'VoiceQueueId':_0x404fc6[_0x2b87('0x23')][_0x198c30][_0x2b87('0xfb')]||undefined,'CampaignId':_0x404fc6['actions'][_0x198c30]['CampaignId']||undefined})[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1e8')));delete _0x404fc6[_0x2b87('0x23')][_0x198c30];}}else{return _0x404fc6[_0x2b87('0x1e9')](_0x2443ce,_0x1f1692);}}else{if(getDiff(_0x1f1692[_0x2b87('0x1ea')])<_0x2443ce[_0x2b87('0x1eb')]*0x3c){if(_0x1f1692[_0x2b87('0x1ec')]&&!_0x1f1692['Agent'][_0x2b87('0x1ed')]){_0x404fc6[_0x2b87('0x1d')][_0x2b87('0x12e')](_0x1f1692['id'])[_0x2b87('0x1b')](function(){_0x404fc6['updateOriginated'](_0x2443ce);});}else{_0x404fc6[_0x2b87('0xc7')]({'active':![]},_0x1f1692['id'],0x1)[_0x2b87('0x1b')](function(){_0x404fc6[_0x2b87('0xb8')](_0x2443ce);});}}else{_0x2443ce['outboundReCallsDay']+=0x1;_0x404fc6['updateOriginated'](_0x2443ce);if(_0x2443ce[_0x2b87('0x1ee')]){_0x404fc6[_0x2b87('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f1692['ContactId'],'ListId':_0x1f1692[_0x2b87('0xdb')],'VoiceQueueId':_0x1f1692[_0x2b87('0xfb')]||undefined,'CampaignId':_0x1f1692[_0x2b87('0xfc')]||undefined})[_0x2b87('0xb7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x404fc6['createHistory'](createObjHistory(_0x2443ce,_0x1f1692,_0x2b87('0x1ef'),0x17,_0x2b87('0x1f0')))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0x1f1')));}else{_0x404fc6[_0x2b87('0xd7')](createObjHistory(_0x2443ce,_0x1f1692,_0x2b87('0x1f2'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x2b87('0x1f3'));}}}}else{_0x2443ce['outboundBlacklistCallsDay']+=0x1;_0x404fc6[_0x2b87('0xd7')](createObjHistory(_0x2443ce,_0x1f1692,'BLACKLIST',0xd,_0x2b87('0x1f4')),_0x2b87('0x1f5'),_0x2b87('0x1f6'));throw _0x2b87('0x1f7');}};};Dialer[_0x2b87('0x19')]['handleIvr']=function(_0xa1b0aa){var _0x24d844=this;var _0x3d3b3d=_0xa1b0aa['limitCalls']-_0xa1b0aa['originated']-_0xa1b0aa[_0x2b87('0x1f8')];emitCampaignSummary(_0xa1b0aa);if(_0x3d3b3d>0x0){if(_0x3d3b3d>this['maxNumberOriginate']){_0x3d3b3d=this[_0x2b87('0x22')];}_0xa1b0aa[_0x2b87('0x1f8')]+=_0x3d3b3d;this[_0x2b87('0xcb')](_0xa1b0aa['id'],_0x3d3b3d,_0xa1b0aa[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x345284){_0xa1b0aa[_0x2b87('0x1f8')]-=_0x3d3b3d;_0xa1b0aa['temp']=_0xa1b0aa['temp']>0x0?_0xa1b0aa[_0x2b87('0x1f8')]:0x0;if(!checkContactEmpty(_0x345284)){_0xa1b0aa[_0x2b87('0x3d')]=_0x2b87('0xa0');logger[_0x2b87('0x7e')]('[getContactCampaign2][Empty]'+_0xa1b0aa[_0x2b87('0x3b')]);}else{_0xa1b0aa[_0x2b87('0x9a')]+=_0x345284['length'];_0xa1b0aa[_0x2b87('0x3d')]=_0x2b87('0x1fa');for(var _0x4a2333=0x0;_0x4a2333<_0x345284[_0x2b87('0x14a')];_0x4a2333+=0x1){_0xa1b0aa['ivrTotalCallsDays']+=0x1;if(_[_0x2b87('0xb5')](_0x345284[_0x4a2333])||_[_0x2b87('0xb5')](_0x345284[_0x4a2333][_0x2b87('0x16c')])||_['isNil'](_0x345284[_0x4a2333][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x24d844[_0x2b87('0xd5')](_0x2b87('0x1fb'),_0xa1b0aa,_0x345284[_0x4a2333]);}else{_0x24d844[_0x2b87('0xc0')](_[_0x2b87('0xd9')](_0x345284[_0x4a2333],[_0x2b87('0xfc'),_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x24d844['checkContactBlack'](_0xa1b0aa,_0x345284[_0x4a2333]))['catch'](_0x24d844['loggerHandler']('[actionOriginateIvr]\x20',_0xa1b0aa));}}}})[_0x2b87('0xb7')](loggerGetContactDialer(_0x2b87('0x1fd'),_0xa1b0aa,_0x3d3b3d));}};Dialer['prototype'][_0x2b87('0x159')]=function(_0x523a21,_0x791f97){var _0x5c4d7d=this;var _0x48129a=[];var _0x182ae2=_0x791f97>=0x1?_0x791f97:0x1;if(_0x523a21[_0x2b87('0x54')]==='booked'){_0x182ae2=0x1;}var _0x263e5d=Math[_0x2b87('0x1e2')](_0x523a21['available']*_0x182ae2)-_0x523a21[_0x2b87('0x9a')]-_0x523a21['temp'];emitVoiceQueueSummary(_0x523a21);if(_0x523a21[_0x2b87('0x1fe')]>0x0){var _0x188031=_0x523a21[_0x2b87('0x1fe')]-_0x523a21[_0x2b87('0x9a')]-_0x523a21[_0x2b87('0x4e')]-_0x523a21[_0x2b87('0x1f8')]-_0x523a21['pTalking'];if(_0x263e5d>_0x188031){_0x263e5d=_0x188031;}}if(_0x263e5d>0x0){if(_0x523a21[_0x2b87('0x54')]===_0x2b87('0x15c')){_0x263e5d=0x1;}if(_0x263e5d>this['maxNumberOriginate']){_0x263e5d=this[_0x2b87('0x22')];}_0x523a21[_0x2b87('0x1f8')]+=_0x263e5d;for(var _0x5ddd63 in this[_0x2b87('0x20')]){if(typeof this[_0x2b87('0x20')][_0x5ddd63]!==_0x2b87('0xb3')){if(this[_0x2b87('0x20')][_0x5ddd63][_0x2b87('0xaa')]===_0x2b87('0x1ff')&&this[_0x2b87('0x20')][_0x5ddd63][_0x2b87('0xe0')]==='reachable'){_0x48129a[_0x2b87('0x129')](this[_0x2b87('0x20')][_0x5ddd63]['id']);}}}this[_0x2b87('0xc9')](_0x523a21['id'],_0x48129a,_0x263e5d,_0x523a21[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x304954){_0x523a21[_0x2b87('0x1f8')]-=_0x263e5d;_0x523a21[_0x2b87('0x1f8')]=_0x523a21[_0x2b87('0x1f8')]>0x0?_0x523a21[_0x2b87('0x1f8')]:0x0;if(!checkContactEmpty(_0x304954)){_0x5c4d7d[_0x2b87('0xbb')](_0x523a21)[_0x2b87('0xbc')](sendMessageReschedule(_0x523a21))['catch'](loggerCatch(_0x2b87('0xbd')));}else{_0x523a21[_0x2b87('0x9a')]+=_0x304954['length'];_0x523a21[_0x2b87('0x3d')]=_0x523a21['dialMethod']==='booked'?_0x2b87('0x170'):_0x2b87('0x1fa');for(var _0x572369=0x0;_0x572369<_0x304954[_0x2b87('0x14a')];_0x572369+=0x1){if(_[_0x2b87('0xb5')](_0x304954[_0x572369])||_[_0x2b87('0xb5')](_0x304954[_0x572369][_0x2b87('0x16c')])||_['isNil'](_0x304954[_0x572369][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x5c4d7d['emptyContact'](_0x2b87('0x1fb'),_0x523a21,_0x304954[_0x572369]);}else{_0x5c4d7d[_0x2b87('0xbe')](_[_0x2b87('0xd9')](_0x304954[_0x572369],['VoiceQueueId',_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x5c4d7d[_0x2b87('0x1e4')](_0x523a21,_0x304954[_0x572369]))[_0x2b87('0xb7')](_0x5c4d7d['loggerHandler'](_0x2b87('0x1fb'),_0x523a21));}}}})['catch'](loggerGetContactDialer(_0x2b87('0x200'),_0x523a21,_0x263e5d));}};Dialer[_0x2b87('0x19')][_0x2b87('0x93')]=function(_0x1120d9){if(_0x1120d9[_0x2b87('0x1fe')]>0x0){var _0x507b08=_0x1120d9['dialLimitQueue']-_0x1120d9[_0x2b87('0x9a')]-_0x1120d9[_0x2b87('0x4e')];if(_0x507b08>0x0){this[_0x2b87('0x201')](_0x1120d9);}else{loggerPredictiveCalls[_0x2b87('0x7e')](_0x2b87('0x202'));}}else{this['tryOriginatePredictive'](_0x1120d9);}};Dialer[_0x2b87('0x19')][_0x2b87('0x201')]=function(_0x1597e9){var _0x566316=this;var _0x4a6271=[];_0x1597e9['originated']+=0x1;for(var _0x31db7b in this['agents']){if(typeof this['agents'][_0x31db7b]!==_0x2b87('0xb3')){if(this[_0x2b87('0x20')][_0x31db7b][_0x2b87('0xaa')]===_0x2b87('0x1ff')&&this[_0x2b87('0x20')][_0x31db7b][_0x2b87('0xe0')]===_0x2b87('0x203')){_0x4a6271[_0x2b87('0x129')](this['agents'][_0x31db7b]['id']);}}}this[_0x2b87('0xc9')](_0x1597e9['id'],_0x4a6271,0x1,_0x1597e9[_0x2b87('0x1f9')])[_0x2b87('0xbc')](function(_0x1115ac){if(!checkContactEmpty(_0x1115ac)){checkContactLowerLimitOriginate(_0x1597e9,0x1,0x0);_0x566316[_0x2b87('0xbb')](_0x1597e9)[_0x2b87('0xbc')](sendMessageReschedule(_0x1597e9))[_0x2b87('0xb7')](loggerCatch(_0x2b87('0xbd')));}else{_0x1597e9['message']=_0x2b87('0x1fa');if(_[_0x2b87('0xb5')](_0x1115ac[0x0])||_[_0x2b87('0xb5')](_0x1115ac[0x0][_0x2b87('0x16c')])||_[_0x2b87('0xb5')](_0x1115ac[0x0][_0x2b87('0x16c')][_0x2b87('0x16b')])){_0x566316['emptyContact'](_0x2b87('0x1fb'),_0x1597e9,_0x1115ac[0x0]);}else{_0x566316[_0x2b87('0xbe')](_[_0x2b87('0xd9')](_0x1115ac[0x0],[_0x2b87('0xfb'),_0x2b87('0x1fc')]))[_0x2b87('0xbc')](_0x566316[_0x2b87('0x1e4')](_0x1597e9,_0x1115ac[0x0]))[_0x2b87('0xb7')](_0x566316[_0x2b87('0xd4')](_0x2b87('0x204'),_0x1597e9));}}})[_0x2b87('0xb7')](loggerGetContactDialer(_0x2b87('0x205'),_0x1597e9,0x1));emitVoiceQueueSummary(_0x1597e9);};Dialer[_0x2b87('0x19')][_0x2b87('0x1d8')]=function(_0xef1713,_0xffcb1a,_0x345cf9,_0x168bae,_0x5939ec,_0x2db5f6){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x206'));loggerPredictive[_0x2b87('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',_0xef1713);loggerPredictive['info'](_0x2b87('0x207'),_0xffcb1a);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x208'),_0x345cf9);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x209'),_0x168bae);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x20a'),_0x5939ec);loggerPredictive[_0x2b87('0x7e')]('---------------------------');return new BPromise(function(_0x3555f1,_0x22086b){if(_0xef1713<=0x0||isNaN(_0xef1713)){return _0x22086b(msgResponse(_0x2b87('0x20b'),'Error',_0x2b87('0x20c')+_0xef1713));}if(_0x345cf9<=0x0||isNaN(_0x345cf9)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),_0x2b87('0x20d')+_0x345cf9));}if(_0x168bae<=0x0||isNaN(_0x168bae)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),_0x2b87('0x20e')+_0x168bae));}if(_0xffcb1a<=0x0||isNaN(_0xffcb1a)){return _0x22086b(msgResponse('[abandonmentRate]',_0x2b87('0x46'),_0x2b87('0x20f')+_0xffcb1a));}if(_0x5939ec<=0x0||isNaN(_0x5939ec)){return _0x22086b(msgResponse(_0x2b87('0x20b'),_0x2b87('0x46'),'Amax\x20=\x20'+_0x5939ec));}_0x2db5f6=_0x2db5f6||0x0;var _0x4743d2=0x1/_0x345cf9;var _0x2afef8=0x0;var _0x15c4bf=0x0;var _0x1badcb=0x0;var _0x3c74b9=0x0;for(var _0x2bd312=0x0;_0x1badcb<_0x5939ec;_0x2bd312+=0x1){_0x15c4bf=_0x2bd312/_0xffcb1a;_0x2afef8=(_0x168bae*_0x15c4bf+_0x2db5f6)/_0x4743d2;_0x1badcb=erlangb(_0x2afef8,_0xef1713);_0x3c74b9=_0x2afef8/_0xef1713*(0x1-erlangb(_0x2afef8,_0xef1713));}return _0x3555f1({'erlangCalls':_0x2bd312,'erlangCallToSecond':_0xffcb1a/_0x2bd312,'erlangAbandonmentRate':_0x1badcb,'erlangBusyFactor':_0x3c74b9});});};Dialer['prototype'][_0x2b87('0x1e1')]=function(_0x5d9fea,_0x2ef5da,_0x1d095e,_0xe656e9,_0x42ebce,_0x557e30){loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x210'));loggerPredictive[_0x2b87('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',_0x5d9fea);loggerPredictive[_0x2b87('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ef5da);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x208'),_0x1d095e);loggerPredictive['info'](_0x2b87('0x209'),_0xe656e9);loggerPredictive[_0x2b87('0x7e')](_0x2b87('0x211'),_0x42ebce);loggerPredictive[_0x2b87('0x7e')]('---------------------------');return new BPromise(function(_0x1491f3,_0x4b8f12){if(_0x5d9fea<=0x0||isNaN(_0x5d9fea)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),_0x2b87('0x46'),_0x2b87('0x20c')+_0x5d9fea));}if(_0x1d095e<=0x0||isNaN(_0x1d095e)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),_0x2b87('0x46'),_0x2b87('0x20d')+_0x1d095e));}if(_0xe656e9<=0x0||isNaN(_0xe656e9)){return _0x4b8f12(msgResponse('[busyFactor]',_0x2b87('0x46'),_0x2b87('0x20e')+_0xe656e9));}if(_0x2ef5da<=0x0||isNaN(_0x2ef5da)){return _0x4b8f12(msgResponse('[busyFactor]',_0x2b87('0x46'),_0x2b87('0x20f')+_0x2ef5da));}if(_0x42ebce<=0x0||isNaN(_0x42ebce)){return _0x4b8f12(msgResponse(_0x2b87('0x212'),'Error',_0x2b87('0x213')+_0x42ebce));}_0x557e30=_0x557e30||0x0;var _0x5c82a5=0x1/_0x1d095e;var _0x32a8e0=0x0;var _0x456b6e=0x0;var _0x366ecf=0x0;var _0x410579=0x0;for(var _0x37acb7=0x0;_0x410579<_0x42ebce;_0x37acb7+=0x1){_0x456b6e=_0x37acb7/_0x2ef5da;_0x32a8e0=(_0xe656e9*_0x456b6e+_0x557e30)/_0x5c82a5;_0x366ecf=erlangb(_0x32a8e0,_0x5d9fea);_0x410579=_0x32a8e0/_0x5d9fea*(0x1-erlangb(_0x32a8e0,_0x5d9fea));}return _0x1491f3({'erlangCalls':_0x37acb7,'erlangCallToSecond':_0x2ef5da/_0x37acb7,'erlangAbandonmentRate':_0x366ecf,'erlangBusyFactor':_0x410579});});};module[_0x2b87('0x214')]=Dialer; \ No newline at end of file +var _0x0b3d=['queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','type','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','diff','startProgressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','sequence','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','amd','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','countglobal','[syncAgentComplete][createHistory][0]','countnoanswerretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','[syncHangupIvr]','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','booked','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[actionOriginate]\x20','[getContactDialer2]','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperBlack','./action','./history','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0b3d,0x1e3));var _0xd0b3=function(_0x17925d,_0x46543f){_0x17925d=_0x17925d-0x0;var _0x5492b7=_0x0b3d[_0x17925d];return _0x5492b7;};'use strict';var util=require(_0xd0b3('0x0'));var _=require(_0xd0b3('0x1'));var BPromise=require(_0xd0b3('0x2'));var uuid=require(_0xd0b3('0x3'));var moment=require(_0xd0b3('0x4'));var rr=require('rr');var md5=require(_0xd0b3('0x5'));var Redis=require(_0xd0b3('0x6'));var ut=require('../preview/util/util');var config=require(_0xd0b3('0x7'));var logger=require(_0xd0b3('0x8'))(_0xd0b3('0x9'));var loggerBooked=require(_0xd0b3('0x8'))('booked');var loggerPredictive=require(_0xd0b3('0x8'))(_0xd0b3('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xd0b3('0xb'));var loggerSyncQueueSummary=require(_0xd0b3('0x8'))(_0xd0b3('0xc'));var ami=require(_0xd0b3('0xd'));config[_0xd0b3('0xe')]=_['defaults'](config['redis'],{'host':_0xd0b3('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0b3('0xe')]));var cmHopper=require(_0xd0b3('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd0b3('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xd0b3('0x12'));var History=require(_0xd0b3('0x13'));var Final=require(_0xd0b3('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xd0b3('0x15'));var Hangup=require(_0xd0b3('0x16'));var ipAgi=process[_0xd0b3('0x17')]['XCALLY_IP_AGI']||_0xd0b3('0x18');var strategy={'rrmemory':_0xd0b3('0x19'),'roundrobin':_0xd0b3('0x1a')};var Sequence=function(){};Sequence[_0xd0b3('0x1b')][_0xd0b3('0x1c')]=function(_0x472956){this[_0xd0b3('0x1d')]=this[_0xd0b3('0x1d')]?this[_0xd0b3('0x1d')][_0xd0b3('0x1e')](_0x472956):_0x472956();};function Dialer(_0x5ed8e7,_0x94a097){this['sequence']=new Sequence();this[_0xd0b3('0x1f')]=_0x94a097;this[_0xd0b3('0x20')]=_0x5ed8e7[_0xd0b3('0x20')];this[_0xd0b3('0x21')]=_0x5ed8e7[_0xd0b3('0x21')];this[_0xd0b3('0x22')]=_0x5ed8e7['agents'];this[_0xd0b3('0x23')]=_0x5ed8e7['trunks'];this[_0xd0b3('0x24')]=config[_0xd0b3('0x24')]||0x2;this[_0xd0b3('0x25')]={};this['actions']={};this[_0xd0b3('0x26')]={};this[_0xd0b3('0x27')]={};this[_0xd0b3('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0xd0b3('0x29')]={};this[_0xd0b3('0x2a')]={};this[_0xd0b3('0x2b')]={};ami['on'](_0xd0b3('0x2c'),this[_0xd0b3('0x2d')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x2f'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xd0b3('0x30'),this[_0xd0b3('0x31')]['bind'](this));ami['on']('agentcomplete',this[_0xd0b3('0x32')]['bind'](this));ami['on'](_0xd0b3('0x33'),this[_0xd0b3('0xc')]['bind'](this));ami['on'](_0xd0b3('0x34'),this['syncHangup'][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x35'),this[_0xd0b3('0x36')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x37'),this[_0xd0b3('0x38')][_0xd0b3('0x2e')](this));ami['on']('queuemember',this[_0xd0b3('0x39')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x3a'),this['syncQueueStatusComplete']['bind'](this));this[_0xd0b3('0x3b')]();this[_0xd0b3('0x3c')]();}function isNotNull(_0x20ee10){return _0x20ee10!==null&&!_[_0xd0b3('0x3d')](_0x20ee10);}function checkIsLoggedIn(_0x2af471,_0x3ce94a){return function(){if(_0x3ce94a<=0x0){_0x2af471[_0xd0b3('0x3e')]='AGENTS_NOT_LOGGED';throw _0x2af471['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x51684d){return _0x51684d;}function checkIsActive(_0x45ff49,_0x257e94){return function(){if(!isActive(_0x257e94)){_0x45ff49[_0xd0b3('0x3e')]=_0xd0b3('0x3f');throw _0x45ff49[_0xd0b3('0x40')]+_0xd0b3('0x41');}};}function checkInterval(_0x4171a2){return function(){if(!isNotNull(_0x4171a2[_0xd0b3('0x42')])){_0x4171a2['message']=_0xd0b3('0x43');throw _0x4171a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4171a2[_0xd0b3('0x42')][_0xd0b3('0x44')])){_0x4171a2['message']='INTERVAL_IS_NULL';throw _0x4171a2[_0xd0b3('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xd0b3('0x45')](_0x4171a2[_0xd0b3('0x42')][_0xd0b3('0x44')]))){_0x4171a2[_0xd0b3('0x3e')]=_0xd0b3('0x43');throw _0x4171a2[_0xd0b3('0x40')]+_0xd0b3('0x46');}};}function msgResponse(_0x6cf36e,_0x3de40d,_0x5b9991){return{'action':_0x6cf36e,'response':_0x3de40d,'message':_0x5b9991,'stack':_0x5b9991};}function myreject(_0x2649d1){return function(_0x3d69d5){return _0x2649d1(msgResponse(_0xd0b3('0x47'),_0xd0b3('0x48'),JSON[_0xd0b3('0x49')](_0x3d69d5)));};}function getSeconds(_0x9ab278,_0x4430e9){var _0x3352f5=moment(_0x9ab278)[_0xd0b3('0x4a')](0x0);var _0x37adc4=moment(_0x4430e9)[_0xd0b3('0x4a')](0x0);return _0x3352f5['diff'](_0x37adc4,'seconds');}function emit(_0x32ed4c,_0x44f011,_0x105353){io['to'](_0x32ed4c)['emit'](_0x44f011,_0x105353);}function emitVoiceQueueSummary(_0x340962){if(_0x340962[_0xd0b3('0x4b')]==='outbound'){var _0x3e2e08={'id':_0x340962['id'],'name':_0x340962['name'],'strategy':_0x340962[_0xd0b3('0x4c')],'answered':_0x340962['answered'],'available':_0x340962[_0xd0b3('0x4d')],'loggedIn':_0x340962[_0xd0b3('0x4e')],'pTalking':_0x340962[_0xd0b3('0x4f')],'sumBillable':_0x340962[_0xd0b3('0x50')],'sumDuration':_0x340962[_0xd0b3('0x51')],'sumHoldTime':_0x340962['sumHoldTime']||0x0,'talking':_0x340962[_0xd0b3('0x52')],'total':_0x340962['total'],'type':_0x340962[_0xd0b3('0x4b')],'unmanaged':_0x340962[_0xd0b3('0x53')],'abandoned':_0x340962[_0xd0b3('0x54')],'waiting':_0x340962[_0xd0b3('0x55')],'loggedInDb':_0x340962[_0xd0b3('0x56')],'dialActive':_0x340962[_0xd0b3('0x57')],'dialMethod':_0x340962['dialMethod'],'dialOriginateCallerIdName':_0x340962[_0xd0b3('0x58')],'dialOriginateCallerIdNumber':_0x340962[_0xd0b3('0x59')],'dialOriginateTimeout':_0x340962['dialOriginateTimeout'],'dialPrefix':_0x340962['dialPrefix'],'outboundAnswerAgiCallsDay':_0x340962[_0xd0b3('0x5a')],'outboundAnswerCallsDay':_0x340962['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x340962[_0xd0b3('0x5b')],'outboundBusyCallsDay':_0x340962['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x340962[_0xd0b3('0x5c')],'outboundDropCallsDayACS':_0x340962[_0xd0b3('0x5d')],'outboundDropCallsDayCallersExit':_0x340962[_0xd0b3('0x5e')],'outboundDropCallsDayTimeout':_0x340962[_0xd0b3('0x5f')],'outboundNoAnswerCallsDay':_0x340962['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x340962[_0xd0b3('0x60')],'outboundOriginateFailureCallsDay':_0x340962[_0xd0b3('0x61')],'outboundReCallsDay':_0x340962['outboundReCallsDay'],'outboundRejectCallsDay':_0x340962[_0xd0b3('0x62')],'outboundUnknownCallsDay':_0x340962['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x340962[_0xd0b3('0x63')],'predictiveIntervalAvgHoldtime':_0x340962[_0xd0b3('0x64')],'predictiveIntervalAvgTalktime':_0x340962[_0xd0b3('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x340962[_0xd0b3('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x340962[_0xd0b3('0x67')],'predictiveIntervalErlangCalls':_0x340962['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x340962[_0xd0b3('0x68')],'predictiveIntervalHitRate':_0x340962[_0xd0b3('0x69')],'predictiveIntervalMultiplicativeFactor':_0x340962[_0xd0b3('0x6a')],'predictiveIntervalPauses':_0x340962['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x340962[_0xd0b3('0x6b')],'predictiveIntervalTotalCalls':_0x340962[_0xd0b3('0x6c')],'message':_0x340962[_0xd0b3('0x3e')],'originated':_0x340962['originated'],'erlangCalls':_0x340962[_0xd0b3('0x6d')],'erlangCallToSecond':_0x340962['erlangCallToSecond'],'erlangAbandonmentRate':_0x340962[_0xd0b3('0x6e')],'erlangBusyFactor':_0x340962[_0xd0b3('0x6f')],'startPredictive':_0x340962['startPredictive'],'startProgressive':_0x340962['startProgressive']};if(_0x340962['Trunk']){_0x3e2e08['Trunk']={'id':_0x340962['Trunk']['id'],'name':_0x340962[_0xd0b3('0x70')][_0xd0b3('0x40')],'active':_0x340962['Trunk'][_0xd0b3('0x71')],'callerid':_0x340962[_0xd0b3('0x70')][_0xd0b3('0x72')]};}if(_0x340962['Interval']){_0x3e2e08[_0xd0b3('0x42')]={'id':_0x340962[_0xd0b3('0x42')]['id'],'name':_0x340962['Interval'][_0xd0b3('0x40')]};}var _0x1d5e6f=md5(JSON[_0xd0b3('0x49')](_0x3e2e08));if(_0x340962[_0xd0b3('0x5')]!==_0x1d5e6f){_0x340962['md5']=_0x1d5e6f;emit(util[_0xd0b3('0x73')](_0xd0b3('0x74'),_0x3e2e08[_0xd0b3('0x40')]),_0xd0b3('0x75'),_0x3e2e08);}}}function emitCampaignSummary(_0x287bee){if(_0x287bee[_0xd0b3('0x4b')]===_0xd0b3('0x76')){emit(util[_0xd0b3('0x73')]('campaign:ivr:%s',_0x287bee[_0xd0b3('0x40')]),'campaign:save',_0x287bee);}}function checkGetDataPredictive(_0x1b90c8){if(isNotNull(_0x1b90c8)&&!_[_0xd0b3('0x45')](_0x1b90c8)){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x78'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x79'),_0x1b90c8['predictiveIntervalTotalCalls']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7a'),_0x1b90c8[_0xd0b3('0x63')]);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7b'),_0x1b90c8[_0xd0b3('0x67')]);loggerPredictive[_0xd0b3('0x77')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b90c8[_0xd0b3('0x66')]);loggerPredictive['info'](_0xd0b3('0x7c'),_0x1b90c8[_0xd0b3('0x64')]);loggerPredictive[_0xd0b3('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b90c8[_0xd0b3('0x65')]);loggerPredictive[_0xd0b3('0x77')]('---------------------------');if(_0x1b90c8[_0xd0b3('0x6c')]>0x0){if(!_[_0xd0b3('0x3d')](_0x1b90c8[_0xd0b3('0x65')])&&_0x1b90c8[_0xd0b3('0x65')]>0x0){return!![];}loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7d'));if(!_[_0xd0b3('0x3d')](_0x1b90c8['predictiveIntervalAvgHoldtime'])&&_0x1b90c8[_0xd0b3('0x64')]>0x0){return!![];}loggerPredictive[_0xd0b3('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7e'));}return![];}function mergeDataErlangB(_0x1bae19){return function(_0xa17be8){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7f'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x80'),_0xa17be8[_0xd0b3('0x6d')]);loggerPredictive['info'](_0xd0b3('0x81'),_0xa17be8['erlangCallToSecond']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x82'),_0xa17be8['erlangAbandonmentRate']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x83'),_0xa17be8[_0xd0b3('0x6f')]);loggerPredictive[_0xd0b3('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa17be8[_0xd0b3('0x6e')]);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x84'));_['merge'](_0x1bae19,_0xa17be8);};}function getDiff(_0x5daddd){var _0x5c5443=moment()[_0xd0b3('0x4a')](0x0);var _0x55e148=moment(_0x5daddd)[_0xd0b3('0x4a')](0x0);return _0x5c5443[_0xd0b3('0x85')](_0x55e148,'seconds');}function ifInterval(_0x382931,_0xe5bf31){if(_['isUndefined'](_0xe5bf31)){return![];}return getDiff(_0xe5bf31)<_0x382931*0x3c;}function freeVariablesPredictive(_0x3bc44b){if(isNotNull(_0x3bc44b)){if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x86')])){_0x3bc44b['startProgressive']=undefined;loggerPredictive['info'](_0x3bc44b[_0xd0b3('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x87')])){_0x3bc44b[_0xd0b3('0x87')]=undefined;loggerPredictive['info'](_0x3bc44b['name'],_0xd0b3('0x88'));}if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x89')])){clearInterval(_0x3bc44b['handlePredictive']);_0x3bc44b[_0xd0b3('0x89')]=undefined;loggerPredictive['info'](_0x3bc44b[_0xd0b3('0x40')],_0xd0b3('0x8a'));}}}function erlangb(_0x28e0d5,_0x23a79e){if(_0x23a79e===0x0){return 0x0;}var _0x29ebdf=0x1;for(var _0x52de45=0x1;_0x52de45<=_0x23a79e;_0x52de45+=0x1){_0x29ebdf=0x1+_0x29ebdf*_0x52de45/_0x28e0d5;}return 0x1/_0x29ebdf;}function isVoiceQueueOutbound(_0x3b8e9c){return _0x3b8e9c==='outbound';}function isNotPreview(_0x2946f1){return _0x2946f1!==_0xd0b3('0x1f');}function isCampaignIvr(_0x3cf32f){return _0x3cf32f==='ivr';}function getCallerId(_0x10de98,_0x311df6,_0x3bfc78){if(!_[_0xd0b3('0x3d')](_0x3bfc78)&&typeof _0x3bfc78===_0xd0b3('0x8b')&&!_[_0xd0b3('0x45')](_0x3bfc78)){if(!_[_0xd0b3('0x3d')](_0x311df6)&&typeof _0x311df6===_0xd0b3('0x8b')&&!_['isEmpty'](_0x311df6)){return util[_0xd0b3('0x73')](_0xd0b3('0x8c'),_0x311df6,_0x3bfc78);}return util[_0xd0b3('0x73')]('\x22%s\x22\x20<%s>',_0x3bfc78,_0x3bfc78);}if(!_[_0xd0b3('0x3d')](_0x10de98)&&typeof _0x10de98===_0xd0b3('0x8b')&&!_[_0xd0b3('0x45')](_0x10de98)){return _0x10de98;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x5ab12a,_0x4bf62d){return function(_0x107ba8){freeVariablesPredictive(_0x4bf62d);emitVoiceQueueSummary(_0x4bf62d);emitCampaignSummary(_0x4bf62d);loggerSyncQueueSummary[_0xd0b3('0x8d')](_0x5ab12a,util['inspect'](_0x107ba8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x500160,_0x7a4138){return function(_0x4b3acf){loggerPredictive[_0xd0b3('0x8d')](_0x7a4138[_0xd0b3('0x40')],_0x500160);loggerPredictive[_0xd0b3('0x8d')](_0x4b3acf[_0xd0b3('0x8e')]);freeVariablesPredictive(_0x7a4138);};}function loggerCatch(_0x3ae4e5){return function(_0x335dbb){logger[_0xd0b3('0x8d')](_0x3ae4e5,util[_0xd0b3('0x8f')](_0x335dbb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x12136e){return _0x12136e&&!_[_0xd0b3('0x3d')](_0x12136e)&&_0x12136e[_0xd0b3('0x90')]>0x0;}function decremetOriginate(_0x549f2a){if(!_[_0xd0b3('0x3d')](_0x549f2a)&&_0x549f2a!==null){if(typeof _0x549f2a[_0xd0b3('0x91')]!==_0xd0b3('0x92')){if(_0x549f2a[_0xd0b3('0x91')]>0x0){_0x549f2a['originated']-=0x1;}else{logger['error'](_0xd0b3('0x93'));}}}else{logger[_0xd0b3('0x8d')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x27c634,_0x31a5a,_0xb55f31){if(_0x31a5a>_0xb55f31){for(var _0x33f614=0x0;_0x33f614<_0x31a5a-_0xb55f31;_0x33f614+=0x1){decremetOriginate(_0x27c634);}}}function loggerGetContactDialer(_0x831f06,_0x1984bd,_0xb622ef){return function(_0x273994){checkContactLowerLimitOriginate(_0x1984bd,_0xb622ef,0x0);logger[_0xd0b3('0x8d')](_0x831f06,util['inspect'](_0x273994,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x339076){return function(_0xcfecb3){if(isNotNull(_0xcfecb3)&&isNotNull(_0xcfecb3[0x0])){if(_0xcfecb3[0x0][_0xd0b3('0x94')]>0x0){_0x339076[_0xd0b3('0x3e')]=_0xd0b3('0x95');logger['info'](_0xd0b3('0x96')+_0x339076[_0xd0b3('0x40')],_0xcfecb3[0x0][_0xd0b3('0x94')],_0xd0b3('0x97'));}else{_0x339076[_0xd0b3('0x3e')]=_0xd0b3('0x98');logger['info'](_0xd0b3('0x99')+_0x339076[_0xd0b3('0x40')]);}}};}function notSendMessagesQueue(_0x4e24e6){if(_0x4e24e6[_0xd0b3('0x9a')]){freeVariablesPredictive(_0x4e24e6);if(_0x4e24e6[_0xd0b3('0x91')]===0x0&&_0x4e24e6[_0xd0b3('0x52')]===0x0&&_0x4e24e6['waiting']===0x0&&(_0x4e24e6[_0xd0b3('0x4f')]||0x0)===0x0){_0x4e24e6[_0xd0b3('0x9a')]=![];_0x4e24e6['available']=0x0;_0x4e24e6['message']=_0xd0b3('0x3f');loggerSyncQueueSummary['error'](_0xd0b3('0x9b'),_0x4e24e6[_0xd0b3('0x40')],_0xd0b3('0x9c'));}else{_0x4e24e6[_0xd0b3('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9b'),_0x4e24e6[_0xd0b3('0x40')],_0xd0b3('0x9d'));}emitVoiceQueueSummary(_0x4e24e6);}}function notSendMessagesCampaign(_0x4050e3){if(_0x4050e3[_0xd0b3('0x9a')]){if(_0x4050e3['originated']===0x0){_0x4050e3[_0xd0b3('0x9a')]=![];_0x4050e3['message']=_0xd0b3('0x3f');loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9e'),_0x4050e3[_0xd0b3('0x40')],'is\x20not\x20active');}else{_0x4050e3[_0xd0b3('0x3e')]=_0xd0b3('0x9f');loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9e'),_0x4050e3[_0xd0b3('0x40')],'is\x20disactive');}emitCampaignSummary(_0x4050e3);}}function createObjHistory(_0x30b8a0,_0x1f3c10,_0x39f9bb,_0x20058a,_0x396de3){_0x30b8a0[_0xd0b3('0x3e')]=_0x39f9bb;var _0x545d8b=new Action(_0x30b8a0,_0x1f3c10);var _0x1be74a=new History(_0x545d8b);_0x1be74a[_0xd0b3('0xa0')]=_0x20058a;_0x1be74a[_0xd0b3('0xa1')]=_0x396de3;_0x1be74a[_0xd0b3('0xa2')]=_0x545d8b[_0xd0b3('0xa3')];return _0x1be74a;}Dialer[_0xd0b3('0x1b')][_0xd0b3('0x3c')]=function(){var _0x57f2f6=this;setInterval(function(){_0x57f2f6[_0xd0b3('0xa4')](_0x57f2f6[_0xd0b3('0x27')],_0xd0b3('0xa5'));_0x57f2f6[_0xd0b3('0xa4')](_0x57f2f6[_0xd0b3('0xa6')],'[actions]');},0x32c8);};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xa4')]=function(_0x58b523,_0x3b219f){var _0x2145fd=this;for(var _0x5eca4d in _0x58b523){if(typeof _0x58b523[_0x5eca4d]!=='undefined'){this[_0xd0b3('0xa7')][_0xd0b3('0x1c')](function(){if(!_[_0xd0b3('0xa8')](_0x58b523[_0x5eca4d])){return ami[_0xd0b3('0xa9')]({'action':'status','channel':_0x58b523[_0x5eca4d][_0xd0b3('0xaa')]})[_0xd0b3('0xab')](function(_0x3ea315){if(_0x3ea315['message']===_0xd0b3('0xac')){setTimeout(function(){if(_0x58b523[_0x5eca4d]&&_0x58b523[_0x5eca4d][_0xd0b3('0x4b')]!=='ivr'){_0x2145fd[_0xd0b3('0xad')](_0x2145fd['voiceQueues'][_0x58b523[_0x5eca4d][_0xd0b3('0xae')]]);logger['error'](_0xd0b3('0xaf'),_0x3b219f,_0x5eca4d,_0x58b523[_0x5eca4d]['queue']);delete _0x58b523[_0x5eca4d];}if(_0x58b523[_0x5eca4d]&&_0x58b523[_0x5eca4d][_0xd0b3('0x4b')]==='ivr'){_0x2145fd[_0xd0b3('0xad')](_0x2145fd[_0xd0b3('0x21')][_0x58b523[_0x5eca4d]['queue']]);logger[_0xd0b3('0x8d')](_0xd0b3('0xb0'),_0x3b219f,_0x5eca4d,_0x58b523[_0x5eca4d][_0xd0b3('0xae')]);delete _0x58b523[_0x5eca4d];}},0x2328);}});}});}}};Dialer['prototype'][_0xd0b3('0xb1')]=function(_0x1563d0){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xb1')](_0x1563d0))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb4')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xb5')]=function(_0x395b80){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperBlack[_0xd0b3('0xb5')](_0x395b80))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb6')));};Dialer['prototype'][_0xd0b3('0xb7')]=function(_0x47da2b){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperBlack[_0xd0b3('0xb7')](_0x47da2b))['catch'](loggerCatch(_0xd0b3('0xb8')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xb9')]=function(_0x424d2b){return BPromise['resolve']()[_0xd0b3('0xb3')](cmHopperHistory[_0xd0b3('0xba')](_0x424d2b))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbb')]=function(_0x55edf0){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xbb')](_0x55edf0))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xbc')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbd')]=function(_0x124350,_0x28c7a9,_0x2c0301){return BPromise['resolve']()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xbd')](_0x124350,_0x28c7a9,_0x2c0301))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xbe')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbf')]=function(_0x4edf17,_0x46e63b,_0x2705d0,_0x132326){return BPromise[_0xd0b3('0xb2')]()['then'](cmHopper[_0xd0b3('0xbf')](_0x4edf17,_0x46e63b,_0x2705d0,_0x132326))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc0')));};Dialer['prototype'][_0xd0b3('0xc1')]=function(_0x22bdd6,_0x22add0,_0x34312c){return BPromise[_0xd0b3('0xb2')]()['then'](cmHopper[_0xd0b3('0xc1')](_0x22bdd6,_0x22add0,_0x34312c))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc0')));};Dialer['prototype'][_0xd0b3('0xc2')]=function(_0x1aee8f){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](voiceQueueRt[_0xd0b3('0xc2')](_0x1aee8f))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc3')));};Dialer[_0xd0b3('0x1b')]['moveContactManagedDialer']=function(_0x49c21f){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xc4')](_0x49c21f))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc5')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xc6')]=function(_0x3209cc){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperHistory[_0xd0b3('0xc6')](_0x3209cc))['catch'](loggerCatch(_0xd0b3('0xc7')));};Dialer[_0xd0b3('0x1b')]['updateOriginated']=function(_0x2e2fc9){if(!_[_0xd0b3('0x3d')](_0x2e2fc9)&&_0x2e2fc9!==null){if(typeof _0x2e2fc9['originated']!==_0xd0b3('0x92')){if(_0x2e2fc9[_0xd0b3('0x91')]>0x0){_0x2e2fc9[_0xd0b3('0x91')]-=0x1;}else{logger[_0xd0b3('0x8d')](_0xd0b3('0xc8'));}}}else{logger[_0xd0b3('0x8d')](_0xd0b3('0xc9'));}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xca')]=function(_0x4c6422,_0x4f68fb){var _0x58ad74=this;return function(_0x490be1){_0x58ad74[_0xd0b3('0xad')](_0x4f68fb);logger[_0xd0b3('0x8d')](_0x4c6422,util['inspect'](_0x490be1,{'showHidden':![],'depth':null}));};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xcb')]=function(_0x378d41,_0x190152,_0x4acaa0){var _0x58c80d={'state':0x19,'statedesc':_0xd0b3('0xcc')};this[_0xd0b3('0xad')](_0x190152);this[_0xd0b3('0xcd')](_[_0xd0b3('0xce')](_0x58c80d,_[_0xd0b3('0xcf')](_0x4acaa0,[_0xd0b3('0xd0'),_0xd0b3('0xd1'),'UserId','VoiceQueueId',_0xd0b3('0xd2')])),_0xd0b3('0xd3'),'[emptyContact]');logger[_0xd0b3('0x8d')](_0x378d41);};Dialer['prototype'][_0xd0b3('0xd4')]=function(_0xe07c13){return _0xe07c13===_0xd0b3('0xd5');};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xd6')]=function(_0x518273){return!_['isUndefined'](_0x518273)&&_0x518273&&!_[_0xd0b3('0x3d')](_0x518273[_0xd0b3('0x40')])&&!_[_0xd0b3('0x3d')](_0x518273['active'])&&_0x518273['active']&&(this[_0xd0b3('0x23')][util['format'](_0xd0b3('0xd7'),_0x518273['name'])][_0xd0b3('0xd8')]===_0xd0b3('0xd9')||this['trunks'][util[_0xd0b3('0x73')](_0xd0b3('0xd7'),_0x518273[_0xd0b3('0x40')])][_0xd0b3('0xd8')]==='unmonitored');};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xcd')]=function(_0xc70c80,_0x403b77,_0x5b4720){this['createHistory'](_0xc70c80)['catch'](loggerCatch(_0x403b77));this[_0xd0b3('0xc4')](_0xc70c80)[_0xd0b3('0xab')](loggerCatch(_0x5b4720));};Dialer[_0xd0b3('0x1b')]['syncVarSet']=function(_0x4ff325){var _0x314870=this[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];var _0x24273b;if(!_[_0xd0b3('0xa8')](_0x4ff325)&&!_[_0xd0b3('0xa8')](_0x4ff325[_0xd0b3('0xdb')])&&!_[_0xd0b3('0xa8')](_0x4ff325['variable'][_0xd0b3('0xdc')])&&_0x4ff325[_0xd0b3('0xdd')]===_0xd0b3('0xde')&&_0x314870){if(_0x314870['type']!==_0xd0b3('0x76')&&this[_0xd0b3('0x20')][_0x314870['queue']][_0xd0b3('0xdf')]&&_0x4ff325[_0xd0b3('0xe0')]===_0xd0b3('0xe1')){delete this['uniqueId'][_0x4ff325[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]]);this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;this[_0xd0b3('0x20')][_0x314870['queue']][_0xd0b3('0x5a')]+=0x1;_0x24273b=new Hangup(_0x314870,_0x4ff325);_0x24273b[_0xd0b3('0xa0')]=0x12;_0x24273b[_0xd0b3('0xa1')]=_0xd0b3('0xe3');_0x24273b[_0xd0b3('0xe4')]=_0xd0b3('0xe5');this['saveInDb'](_0x24273b,_0xd0b3('0xe6'),_0xd0b3('0xe7'));}if(_0x314870[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']===_0xd0b3('0xe8')){var _0x4a47d8=this;return new BPromise(function(_0x15825a,_0x34a98c){delete _0x4a47d8[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];_0x4a47d8[_0xd0b3('0xad')](_0x4a47d8[_0xd0b3('0x20')][_0x314870['queue']]);_0x4a47d8[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;_0x4a47d8[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0x5a')]+=0x1;var _0x311234=_0x4a47d8['voiceQueues'][_0x314870[_0xd0b3('0xae')]];var _0x5ce8f5=new Hangup(_0x314870,_0x4ff325);_0x5ce8f5[_0xd0b3('0xa0')]=0x13;_0x5ce8f5[_0xd0b3('0xa1')]=_0xd0b3('0xe9');_0x5ce8f5[_0xd0b3('0xe4')]='AMD';_0x5ce8f5[_0xd0b3('0xea')]+=0x1;_0x5ce8f5['countglobal']+=0x1;_0x5ce8f5[_0xd0b3('0xeb')]=!![];_0x4a47d8[_0xd0b3('0xc6')](_0x5ce8f5)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5ce8f5[_0xd0b3('0xec')]+_0x5ce8f5['countcongestionretry']+_0x5ce8f5['countnoanswerretry']+_0x5ce8f5[_0xd0b3('0xed')]+_0x5ce8f5[_0xd0b3('0xee')]+_0x5ce8f5[_0xd0b3('0xef')]+_0x5ce8f5[_0xd0b3('0xea')]+_0x5ce8f5[_0xd0b3('0xf0')]>=_0x311234[_0xd0b3('0xf1')]){_0x4a47d8['stateGlobal'](_0x5ce8f5,_0x15825a,_0x34a98c,_0xd0b3('0xf2'));}else{if(_0x5ce8f5[_0xd0b3('0xea')]>=_0x311234[_0xd0b3('0xf3')]){_0x4a47d8[_0xd0b3('0xf4')](_0x5ce8f5,_0x15825a,_0x34a98c,_0xd0b3('0xf5'));}else{_0x4a47d8[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x5ce8f5['countmachineretry'],'scheduledat':moment()[_0xd0b3('0xf6')](_0x311234[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x5ce8f5[_0xd0b3('0xd0')],'ListId':_0x5ce8f5[_0xd0b3('0xd1')],'VoiceQueueId':_0x5ce8f5[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x5ce8f5['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfb')));_0x15825a({'reschedule':0x1});}}});}if(_0x314870['type']===_0xd0b3('0x76')&&this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']===_0xd0b3('0xe1')){delete this['uniqueId'][_0x4ff325[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]]);_0x24273b=new Hangup(_0x314870,_0x4ff325);_0x24273b[_0xd0b3('0xa0')]=0x12;_0x24273b['statedesc']=_0xd0b3('0xe3');_0x24273b['membername']='AMD';this['saveInDb'](_0x24273b,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x314870[_0xd0b3('0x4b')]===_0xd0b3('0x76')&&this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']==='MACHINE'){var _0x4a47d8=this;return new BPromise(function(_0x30b287,_0x35ba91){delete _0x4a47d8[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];_0x4a47d8[_0xd0b3('0xad')](_0x4a47d8[_0xd0b3('0x21')][_0x314870['queue']]);_0x4a47d8[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;_0x4a47d8['campaigns'][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0x5a')]+=0x1;var _0x51e7ee=_0x4a47d8[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]];var _0x17dd76=new Hangup(_0x314870,_0x4ff325);_0x17dd76[_0xd0b3('0xa0')]=0x13;_0x17dd76[_0xd0b3('0xa1')]=_0xd0b3('0xe9');_0x17dd76[_0xd0b3('0xe4')]='AMD';_0x17dd76[_0xd0b3('0xea')]+=0x1;_0x17dd76[_0xd0b3('0xfc')]+=0x1;_0x17dd76[_0xd0b3('0xeb')]=!![];_0x4a47d8[_0xd0b3('0xc6')](_0x17dd76)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfd')));if(_0x17dd76[_0xd0b3('0xec')]+_0x17dd76['countcongestionretry']+_0x17dd76[_0xd0b3('0xfe')]+_0x17dd76[_0xd0b3('0xed')]+_0x17dd76[_0xd0b3('0xee')]+_0x17dd76['countabandonedretry']+_0x17dd76[_0xd0b3('0xea')]+_0x17dd76[_0xd0b3('0xf0')]>=_0x51e7ee[_0xd0b3('0xf1')]){_0x4a47d8[_0xd0b3('0xff')](_0x17dd76,_0x30b287,_0x35ba91,_0xd0b3('0xf2'));}else{if(_0x17dd76[_0xd0b3('0xea')]>=_0x51e7ee[_0xd0b3('0xf3')]){_0x4a47d8[_0xd0b3('0xf4')](_0x17dd76,_0x30b287,_0x35ba91,_0xd0b3('0xf5'));}else{_0x4a47d8[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x17dd76[_0xd0b3('0xea')],'scheduledat':moment()[_0xd0b3('0xf6')](_0x51e7ee[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17dd76[_0xd0b3('0xd0')],'ListId':_0x17dd76[_0xd0b3('0xd1')],'VoiceQueueId':_0x17dd76[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x17dd76['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x30b287({'reschedule':0x1});}}});}}};Dialer[_0xd0b3('0x1b')]['syncHangup']=function(_0x15e46a){var _0xcc005a=this['uniqueId'][_0x15e46a[_0xd0b3('0xda')]];var _0x46cd9f=this;var _0x15ecf6;if(_0xcc005a&&_0xcc005a['type']==='ivr'){delete this[_0xd0b3('0x27')][_0x15e46a['uniqueid']];this[_0xd0b3('0xad')](this[_0xd0b3('0x21')][_0xcc005a[_0xd0b3('0xae')]]);this['campaigns'][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x100')]+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);this[_0xd0b3('0xc6')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x101')));this[_0xd0b3('0xc4')](_0x15ecf6)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xcc005a&&_0xcc005a[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&isNotNull(this[_0xd0b3('0x20')][_0xcc005a['queue']][_0xd0b3('0x102')])){delete this[_0xd0b3('0x27')][_0x15e46a[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]]);this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;this['voiceQueues'][_0xcc005a[_0xd0b3('0xae')]]['outboundAnswerAgiCallsDay']+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);_0x15ecf6['state']=0x10;_0x15ecf6[_0xd0b3('0xa1')]=_0xd0b3('0x103');_0x15ecf6[_0xd0b3('0xe4')]='AGI';this[_0xd0b3('0xc6')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x101')));this[_0xd0b3('0xc4')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0xcc005a&&_0xcc005a[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&!isNotNull(this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x102')])){delete this[_0xd0b3('0x27')][_0x15e46a[_0xd0b3('0xda')]];this['updateOriginated'](this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]]);this['voiceQueues'][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x104')]+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);_0x15ecf6[_0xd0b3('0xa0')]=0xc;_0x15ecf6[_0xd0b3('0xa1')]=_0x15e46a[_0xd0b3('0x105')];_0x15ecf6[_0xd0b3('0xe4')]='Unknow';this['createHistory'](_0x15ecf6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd0b3('0xc4')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x106')));}};Dialer[_0xd0b3('0x1b')]['syncAgentComplete']=function(_0x32f8eb){var _0x55de32=this[_0xd0b3('0x27')][_0x32f8eb[_0xd0b3('0xda')]];var _0x3bfb59=this;if(this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]]){if(_0x55de32&&_0x55de32[_0xd0b3('0x4b')]!=='ivr'){delete this[_0xd0b3('0x27')][_0x32f8eb[_0xd0b3('0xda')]];this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]]['outboundAnswerCallsDay']+=0x1;var _0x1bd7ab=new AgentComplete(_0x55de32,_0x32f8eb);if(_0x32f8eb[_0xd0b3('0x107')]==='agent'){_0x1bd7ab['agiafterat']=this['voiceQueues'][_0x32f8eb['queue']][_0xd0b3('0x108')]&&this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]][_0xd0b3('0x109')]?moment()[_0xd0b3('0x73')](_0xd0b3('0xf9')):undefined;}this[_0xd0b3('0xc6')](_0x1bd7ab)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd0b3('0xc4')](_0x1bd7ab)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x10a')));}}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x2d')]=function(_0xcae93a){if(this['voiceQueues'][_0xcae93a[_0xd0b3('0xae')]]){if(this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]]&&this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]][_0xd0b3('0x4b')]!=='ivr'){this['updateOriginated'](this[_0xd0b3('0x20')][_0xcae93a[_0xd0b3('0xae')]]);this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]][_0xd0b3('0x10b')]=moment()[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xd0b3('0x10c')]=function(_0x11cb39){this[_0xd0b3('0xc6')](_0x11cb39)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x10d')));this[_0xd0b3('0xc4')](_0x11cb39)[_0xd0b3('0xab')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0xd0b3('0x10e')]=function(_0x372839){var _0x7d3726=this[_0xd0b3('0x27')][_0x372839[_0xd0b3('0xda')]];var _0x4dcf32=this;if(this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]]){if(_0x7d3726&&_0x7d3726[_0xd0b3('0x4b')]!==_0xd0b3('0x76')){delete this[_0xd0b3('0x27')][_0x372839[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this['voiceQueues'][_0x372839['queue']]);_0x7d3726[_0xd0b3('0x10f')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));var _0x369b99=new QueueCallerAbandon(_0x7d3726,_0x372839);if(getSeconds(_0x7d3726[_0xd0b3('0x10f')],_0x7d3726[_0xd0b3('0x110')])>=_0x7d3726[_0xd0b3('0x111')]){this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x67')]+=0x1;this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x5f')]+=0x1;this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x68')]+=0x1;_0x369b99[_0xd0b3('0xa0')]=0xa;_0x369b99[_0xd0b3('0xa1')]='Drop';_0x369b99['dropreason']=_0xd0b3('0x112');_0x369b99['agiafterat']=this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x108')]?moment()['format'](_0xd0b3('0xf9')):undefined;_0x369b99[_0xd0b3('0xee')]+=0x1;_0x369b99[_0xd0b3('0xfc')]+=0x1;if(_0x369b99[_0xd0b3('0xee')]>=this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x113')]){this[_0xd0b3('0x10c')](_0x369b99);}else{this[_0xd0b3('0xbb')]({'active':![],'countdropretry':_0x369b99[_0xd0b3('0xee')],'scheduledat':moment()[_0xd0b3('0xf6')](this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x114')],'minutes')[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x7d3726[_0xd0b3('0xd0')],'ListId':_0x7d3726[_0xd0b3('0xd1')],'VoiceQueueId':_0x7d3726[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x7d3726['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x115')));var _0x3987a9=new History(_0x369b99);_0x3987a9[_0xd0b3('0xa0')]=0xa;_0x3987a9[_0xd0b3('0xa1')]=_0xd0b3('0x116');_0x3987a9[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0x3987a9[_0xd0b3('0xa2')]=_0x3987a9[_0xd0b3('0xa3')];_0x3987a9[_0xd0b3('0x117')]=_0x369b99[_0xd0b3('0x117')];_0x3987a9[_0xd0b3('0x118')]=_0x369b99['calleridnum'];this[_0xd0b3('0xc6')](_0x3987a9)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x66')]+=0x1;this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x5e')]+=0x1;_0x369b99[_0xd0b3('0xa0')]=0xb;_0x369b99[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x369b99['dropreason']='CALLEREXIT';_0x369b99[_0xd0b3('0xef')]+=0x1;_0x369b99[_0xd0b3('0xfc')]+=0x1;if(_0x369b99[_0xd0b3('0xef')]>=this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x11a')]){this[_0xd0b3('0x10c')](_0x369b99);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x369b99[_0xd0b3('0xef')],'scheduledat':moment()['add'](this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]]['dialAbandonedRetryFrequency'],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x7d3726['ContactId'],'ListId':_0x7d3726['ListId'],'VoiceQueueId':_0x7d3726['VoiceQueueId']||undefined,'CampaignId':_0x7d3726[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11b')));var _0x3987a9=new History(_0x369b99);_0x3987a9[_0xd0b3('0xa0')]=0xb;_0x3987a9[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x3987a9[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0x3987a9[_0xd0b3('0xa2')]=_0x3987a9[_0xd0b3('0xa3')];_0x3987a9[_0xd0b3('0x117')]=_0x369b99[_0xd0b3('0x117')];_0x3987a9['calleridnum']=_0x369b99[_0xd0b3('0x118')];this[_0xd0b3('0xc6')](_0x3987a9)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11c')));}}}}};Dialer['prototype'][_0xd0b3('0x36')]=function(_0xd9e4dd){if(this[_0xd0b3('0xa6')][_0xd9e4dd[_0xd0b3('0xda')]]){this[_0xd0b3('0xa6')][_0xd9e4dd[_0xd0b3('0xda')]][_0xd0b3('0xaa')]=_0xd9e4dd[_0xd0b3('0xaa')];}if(this[_0xd0b3('0x27')][_0xd9e4dd['uniqueid']]){this[_0xd0b3('0x27')][_0xd9e4dd['uniqueid']][_0xd0b3('0xaa')]=_0xd9e4dd[_0xd0b3('0xaa')];}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x39')]=function(_0x3ad957){if(strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0xae')]][_0xd0b3('0x4c')]]===_0xd0b3('0x1a')){if(this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]&&_[_0xd0b3('0xa8')](this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x11e')])&&_0x3ad957[_0xd0b3('0xd8')]==='1'&&_0x3ad957[_0xd0b3('0x11f')]==='0'){if(this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]]){if(!this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]][_0xd0b3('0x11e')]){this[_0xd0b3('0x22')][_0x3ad957['stateinterface']][_0xd0b3('0x11e')]=!![];this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x11e')]=!![];this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]['stateinterface']=_0x3ad957['stateinterface'];}}}}else if((strategy[this[_0xd0b3('0x20')][this['actions'][_0x3ad957['actionid']][_0xd0b3('0xae')]]['strategy']]||_0xd0b3('0x19'))===_0xd0b3('0x19')){if(this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]){if(this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]]){this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x120')]=_0x3ad957[_0xd0b3('0x120')];if(_[_0xd0b3('0xa8')](this[_0xd0b3('0x2a')][this['actions'][_0x3ad957['actionid']][_0xd0b3('0xae')]])){this['queueBooked'][this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]['queue']]=[];}this[_0xd0b3('0x2a')][this[_0xd0b3('0xa6')][_0x3ad957['actionid']]['queue']][_0xd0b3('0x121')](_['merge'](_[_0xd0b3('0xcf')](this['actions'][_0x3ad957['actionid']],[_0xd0b3('0x122'),_0xd0b3('0x120')]),{'status':_0x3ad957[_0xd0b3('0xd8')],'paused':_0x3ad957[_0xd0b3('0x11f')]}));}}}};function unlockQueueStatus(_0x356bf8,_0x3a3a93){setTimeout(function(){if(_[_0xd0b3('0x3d')](_0x356bf8[_0xd0b3('0x123')])){loggerBooked[_0xd0b3('0x8d')](_0xd0b3('0x124'),_0x3a3a93);}_0x356bf8[_0xd0b3('0x123')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x3a3a93,JSON['stringify'](_[_0xd0b3('0xcf')](_0x356bf8,['name',_0xd0b3('0x123')])));},0x1f3);}Dialer['prototype'][_0xd0b3('0x125')]=function(_0xea1460){var _0x516c2f=this;var _0x2d58d3=_0x516c2f[_0xd0b3('0x20')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]];if(strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460['actionid']]['queue']][_0xd0b3('0x4c')]]===_0xd0b3('0x1a')){if(this[_0xd0b3('0xa6')][_0xea1460['actionid']]&&this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0x120')]){this[_0xd0b3('0x1f')][_0xd0b3('0x126')](this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0x122')],this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0x120')])[_0xd0b3('0xab')](function(_0x16c268){logger[_0xd0b3('0x8d')](_0xd0b3('0x127'),util['inspect'](_0x16c268,{'showHidden':![],'depth':null}));})[_0xd0b3('0x1e')](function(){_0x516c2f['updateOriginated'](_0x516c2f[_0xd0b3('0x20')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]);_0x516c2f[_0xd0b3('0x22')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0x120')]][_0xd0b3('0x11e')]=![];delete _0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]];unlockQueueStatus(_0x2d58d3);});}else{this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]]['queue']]);this[_0xd0b3('0xbb')]({'active':![],'ContactId':this[_0xd0b3('0xa6')][_0xea1460['actionid']]['ContactId'],'ListId':this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xd1')],'VoiceQueueId':this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xfa')]||undefined,'CampaignId':this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x128')));delete this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]];unlockQueueStatus(_0x2d58d3);}}else if((strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xae')]][_0xd0b3('0x4c')]]||'rrmemory')===_0xd0b3('0x19')){var _0x320d09;if(this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]]&&!_[_0xd0b3('0x45')](this[_0xd0b3('0x2a')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]])){if(this[_0xd0b3('0x2b')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']]['queue']]){this[_0xd0b3('0x2b')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xae')]]=this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]?this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]:this[_0xd0b3('0x2a')][this['actions'][_0xea1460[_0xd0b3('0x11d')]]['queue']]?this[_0xd0b3('0x2a')][this['actions'][_0xea1460['actionid']][_0xd0b3('0xae')]][_0xd0b3('0x129')]||0x0:0x0;}this['queueBooked'][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]][_0xd0b3('0x129')]=this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]];for(var _0x412afd=0x0;_0x412afd=0x0;})[_0xd0b3('0xab')](myreject(_0x3e57cd)));}}else{_0x1bd8a8[_0xd0b3('0x121')](ami[_0xd0b3('0xa9')]({'action':'command','command':util[_0xd0b3('0x73')]('iftime\x20%s,%s',_0x56ea7a,!_[_0xd0b3('0x3d')](config[_0xd0b3('0x139')][_0x20e6e1])?_0x20e6e1:'')})[_0xd0b3('0xb3')](function(_0x1a60c7){return _0x1a60c7['content'][_0xd0b3('0x13f')](_0xd0b3('0x140'))>=0x0;})[_0xd0b3('0xab')](myreject(_0x3e57cd)));}BPromise[_0xd0b3('0x141')](_0x1bd8a8)[_0xd0b3('0xb3')](function(_0x57e64c){var _0x1fcbcb=_[_0xd0b3('0x142')](_0x57e64c);if(_0x1fcbcb){return _0x10b9ca(_0x1fcbcb);}else{_0x90bd43[_0xd0b3('0x3e')]=_0x142acd?_0xd0b3('0x143'):_0xd0b3('0x144');return _0x3e57cd(msgResponse(_0xd0b3('0x145'),'Failure','Global:\x20'+_0x142acd+'\x20'+_0x155c9b+_0xd0b3('0x146')+util[_0xd0b3('0x8f')](_0x56ea7a,{'showHidden':![],'depth':null})+_0xd0b3('0x147')+_0x20e6e1));}})[_0xd0b3('0xab')](function(_0x24cd06){return _0x3e57cd(msgResponse('ifTime',_0xd0b3('0x136'),JSON[_0xd0b3('0x49')](_0x24cd06)));});});};Dialer[_0xd0b3('0x1b')]['checkDialMethod']=function(_0x8e5da6){var _0x466d25=this;return function(){switch(_0x8e5da6[_0xd0b3('0x148')]){case'progressive':freeVariablesPredictive(_0x8e5da6);_0x466d25['handlePower'](_0x8e5da6,0x1);break;case _0xd0b3('0x149'):freeVariablesPredictive(_0x8e5da6);_0x466d25['handlePower'](_0x8e5da6,_0x8e5da6[_0xd0b3('0x14a')]);break;case _0xd0b3('0xa'):_0x466d25[_0xd0b3('0xa')](_0x8e5da6);break;case'booked':freeVariablesPredictive(_0x8e5da6);_0x466d25[_0xd0b3('0x14b')](_0x8e5da6,0x1);break;default:freeVariablesPredictive(_0x8e5da6);logger[_0xd0b3('0x8d')](_0xd0b3('0x14c'),_0x8e5da6[_0xd0b3('0x40')],_0xd0b3('0x14d'));}};};Dialer[_0xd0b3('0x1b')]['launchHandleIvr']=function(_0x51617a){var _0x1f1ef6=this;return function(){_0x1f1ef6['handleIvr'](_0x51617a);};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xc')]=function(_0x36b5e2){var _0x580e26=this;if(isNotPreview(_0x36b5e2['dialMethod'])){if(isVoiceQueueOutbound(_0x36b5e2['type'])&&isActive(_0x36b5e2[_0xd0b3('0x57')])){_0x36b5e2['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xd0b3('0xb3')](checkIsLoggedIn(_0x36b5e2,_0x36b5e2[_0xd0b3('0x4e')]))[_0xd0b3('0xb3')](checkIsActive(_0x36b5e2,_0x36b5e2[_0xd0b3('0x57')]))['then'](checkInterval(_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x14e')](_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x133')](_0x36b5e2[_0xd0b3('0x14f')],_0x36b5e2[_0xd0b3('0x150')],_0x36b5e2[_0xd0b3('0x40')],_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x135')](_0x36b5e2[_0xd0b3('0x42')],_0x36b5e2['dialTimezone'],_0x36b5e2[_0xd0b3('0x40')],_0x36b5e2))['then'](_0x580e26[_0xd0b3('0x151')](_0x36b5e2))[_0xd0b3('0xab')](loggerCatchQueueSummary(_0xd0b3('0x152'),_0x36b5e2));}else{notSendMessagesQueue(_0x36b5e2);}}else{freeVariablesPredictive(_0x36b5e2);}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x153')]=function(){var _0x1028af=this;var _0x5c7a6d;for(var _0xf7b404 in this['campaigns']){if(typeof this[_0xd0b3('0x21')][_0xf7b404]!==_0xd0b3('0x92')){_0x5c7a6d=this[_0xd0b3('0x21')][_0xf7b404];if(isCampaignIvr(_0x5c7a6d[_0xd0b3('0x4b')])&&isActive(_0x5c7a6d[_0xd0b3('0x71')])){_0x5c7a6d['sendMessageOneNotActive']=!![];BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](checkIsActive(_0x5c7a6d,_0x5c7a6d[_0xd0b3('0x71')]))[_0xd0b3('0xb3')](checkInterval(_0x5c7a6d))['then'](_0x1028af[_0xd0b3('0x14e')](_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x133')](_0x5c7a6d[_0xd0b3('0x14f')],_0x5c7a6d[_0xd0b3('0x150')],_0x5c7a6d[_0xd0b3('0x40')],_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x135')](_0x5c7a6d[_0xd0b3('0x42')],_0x5c7a6d[_0xd0b3('0x150')],_0x5c7a6d['name'],_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x154')](_0x5c7a6d))[_0xd0b3('0xab')](loggerCatchQueueSummary(_0xd0b3('0x155'),_0x5c7a6d));}else{notSendMessagesCampaign(_0x5c7a6d);}}}};function getCallerIdRandom(_0x15f841,_0x49d01b){var _0x564fdb;var _0xd87f64;var _0x46fba1;if(_0x49d01b<=0x0){_0x49d01b=0x1;}_0x564fdb=new RegExp('\x5cw{0,'+_0x49d01b+'}$');_0xd87f64=Math[_0xd0b3('0x156')](0xa,_0x49d01b-0x1);_0x46fba1=Math[_0xd0b3('0x156')](0xa,_0x49d01b)-0x1;return util[_0xd0b3('0x73')]('%s',_[_0xd0b3('0x157')](_0x15f841,_0x564fdb,_[_0xd0b3('0x158')](_0xd87f64,_0x46fba1)));}function extractCalleridName(_0x403bad){var _0xc4c4e0=_0x403bad[_0xd0b3('0x159')](/"(.*?)"/);return _0xc4c4e0?_0xc4c4e0[0x1]:_0x403bad;}function extractCalleridNumber(_0x538915){var _0x344295=_0x538915[_0xd0b3('0x159')](/<(.*?)>/);return _0x344295?_0x344295[0x1]:_0x538915;}Dialer[_0xd0b3('0x1b')][_0xd0b3('0x15a')]=function(_0x16fcfa,_0x231d34){var _0x2d4106=this;var _0x3a1d6e=uuid['v4']();this[_0xd0b3('0xa6')][_0x3a1d6e]=new Action(_0x16fcfa,_0x231d34,_0x3a1d6e);return new BPromise(function(_0x42d1aa,_0xcdfdb8){if(_['isUndefined'](_0x16fcfa)&&typeof _0x16fcfa!==_0xd0b3('0x15b')){return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x136'),_0xd0b3('0x15d')));}if(_['isUndefined'](_0x231d34[_0xd0b3('0x15e')][_0xd0b3('0x15f')])||_0x231d34['Contact'][_0xd0b3('0x15f')]===null){return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x136'),_0xd0b3('0x160')));}var _0x2fefc3={'XMD-CALLERID':_0x2d4106['actions'][_0x3a1d6e][_0xd0b3('0x161')](),'XMD-AGI':_0x16fcfa['dialQueueProject']?util[_0xd0b3('0x73')](_0xd0b3('0x162'),ipAgi,_0x16fcfa[_0xd0b3('0x102')]):'NONE','XMD-AGIAFTER':_0x16fcfa[_0xd0b3('0x108')]?util[_0xd0b3('0x73')](_0xd0b3('0x162'),ipAgi,_0x16fcfa['dialQueueProject2']):_0xd0b3('0x163'),'XMD-QUEUE':_0x16fcfa[_0xd0b3('0x4b')]===_0xd0b3('0x164')?util[_0xd0b3('0x73')](_0xd0b3('0x165'),_0x16fcfa[_0xd0b3('0x40')],_0x16fcfa['dialQueueOptions']||'',_0x16fcfa[_0xd0b3('0x109')]?'c':'',_0x16fcfa[_0xd0b3('0x111')]||0x3):_0xd0b3('0x163'),'XMD-CONTACTID':_0x231d34['ContactId'],'XMD-CDRTYPE':_0xd0b3('0x9'),'CALLERID(all)':_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e][_0xd0b3('0x161')](),'XMD-AMD':_0x16fcfa[_0xd0b3('0xdf')]?_0xd0b3('0x166'):_0xd0b3('0x163'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x16fcfa[_0xd0b3('0xdf')]){_0x2fefc3[_0xd0b3('0x167')]=_0x16fcfa[_0xd0b3('0x168')]||0x9c4;_0x2fefc3[_0xd0b3('0x169')]=_0x16fcfa['dialAMDGreeting']||0x5dc;_0x2fefc3[_0xd0b3('0x16a')]=_0x16fcfa[_0xd0b3('0x16b')]||0x320;_0x2fefc3[_0xd0b3('0x16c')]=_0x16fcfa[_0xd0b3('0x16d')]||0x1388;_0x2fefc3[_0xd0b3('0x16e')]=_0x16fcfa[_0xd0b3('0x16f')]||0x64;_0x2fefc3['XMD-AMDBETWEENWORDSSILENCE']=_0x16fcfa['dialAMDBetweenWordsSilence']||0x32;_0x2fefc3[_0xd0b3('0x170')]=_0x16fcfa[_0xd0b3('0x171')]||0x3;_0x2fefc3[_0xd0b3('0x172')]=_0x16fcfa[_0xd0b3('0x173')]||0x100;_0x2fefc3['XMD-AMDMAXIMUMWORDLENGTH']=_0x16fcfa[_0xd0b3('0x174')]||0x1388;}if(_0x16fcfa[_0xd0b3('0x4b')]===_0xd0b3('0x164')){_0x2fefc3['XMD-VOICEQUEUEID']=_0x231d34[_0xd0b3('0xfa')];}else{_0x2fefc3[_0xd0b3('0x175')]=_0x231d34[_0xd0b3('0xd2')];}for(var _0x3ea281 in _0x231d34[_0xd0b3('0x15e')]){if(typeof _0x231d34[_0xd0b3('0x15e')][_0x3ea281]!=='undefined'){if(isNotNull(_0x231d34[_0xd0b3('0x15e')][_0x3ea281])&&_0x3ea281!=='id'&&_0x3ea281!==_0xd0b3('0x176')&&_0x3ea281!==_0xd0b3('0x177')&&_0x3ea281!=='updatedAt'){_0x2fefc3[util[_0xd0b3('0x73')](_0xd0b3('0x178'),'XMD-',_[_0xd0b3('0x179')](_0x3ea281))]=_0x231d34[_0xd0b3('0x15e')][_0x3ea281];}}}var _0x4b1f2f=_0x2d4106['isTrunkReachable'](_0x16fcfa[_0xd0b3('0x70')])?getCallerId(_0x16fcfa['Trunk'][_0xd0b3('0x72')],_0x16fcfa[_0xd0b3('0x58')],_0x16fcfa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x16fcfa[_0xd0b3('0x59')],_0x16fcfa[_0xd0b3('0x17a')]):_0x16fcfa[_0xd0b3('0x59')]):getCallerId(_[_0xd0b3('0xa8')](_0x16fcfa[_0xd0b3('0x17b')])?_0x16fcfa['Trunk']['callerid']:_0x16fcfa['TrunkBackup']['callerid'],_0x16fcfa[_0xd0b3('0x58')],_0x16fcfa[_0xd0b3('0x17a')]>0x0?getCallerIdRandom(_0x16fcfa[_0xd0b3('0x59')],_0x16fcfa[_0xd0b3('0x17a')]):_0x16fcfa[_0xd0b3('0x59')]);if(_0x4b1f2f){_0x2fefc3[_0xd0b3('0x17c')]=_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e]['originatecalleridname']=extractCalleridName(_0x4b1f2f);_0x2fefc3[_0xd0b3('0x17d')]=_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e][_0xd0b3('0x17e')]=extractCalleridNumber(_0x4b1f2f);}return ami[_0xd0b3('0xa9')]({'actionid':_0x3a1d6e,'action':_0xd0b3('0x15c'),'channel':_0x2d4106[_0xd0b3('0xd6')](_0x16fcfa[_0xd0b3('0x70')])?util[_0xd0b3('0x73')](_0xd0b3('0x17f'),_0x16fcfa[_0xd0b3('0x70')]['name'],isNotNull(_0x16fcfa[_0xd0b3('0x180')])?_0x16fcfa['dialPrefix'][_0xd0b3('0x181')]()||'':'',_0x16fcfa[_0xd0b3('0x182')]>0x0?_0x231d34[_0xd0b3('0x15e')][_0xd0b3('0x15f')][_0xd0b3('0x183')](_0x16fcfa[_0xd0b3('0x182')]):_0x231d34['Contact'][_0xd0b3('0x15f')]):util['format'](_0xd0b3('0x17f'),_['isNil'](_0x16fcfa[_0xd0b3('0x17b')])?_0x16fcfa[_0xd0b3('0x70')][_0xd0b3('0x40')]:_0x16fcfa['TrunkBackup'][_0xd0b3('0x40')],isNotNull(_0x16fcfa['dialPrefix'])?_0x16fcfa['dialPrefix'][_0xd0b3('0x181')]()||'':'',_0x16fcfa[_0xd0b3('0x182')]>0x0?_0x231d34[_0xd0b3('0x15e')]['phone']['substring'](_0x16fcfa[_0xd0b3('0x182')]):_0x231d34['Contact']['phone']),'callerid':_0x4b1f2f,'Exten':_0xd0b3('0xde'),'Context':'from-sip','Priority':'1','variable':_0x2fefc3,'timeout':(_0x16fcfa[_0xd0b3('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3a1d6e})['then'](function(_0x5805e5){return _0x42d1aa(_0x5805e5);})[_0xd0b3('0xab')](function(_0x49749c){_0x16fcfa[_0xd0b3('0x61')]+=0x1;var _0xce6c0f=new History(_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e]);logger[_0xd0b3('0x8d')](util[_0xd0b3('0x73')](_0xd0b3('0x185'),JSON['stringify'](_0x49749c)));_0xce6c0f[_0xd0b3('0xa0')]=0xe;_0xce6c0f['statedesc']=_0xd0b3('0x186');_0xce6c0f[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0xce6c0f[_0xd0b3('0xa2')]=_0xce6c0f[_0xd0b3('0xa3')];_0x2d4106['createHistory'](_0xce6c0f)[_0xd0b3('0xab')](loggerCatch('[originate][error]'));_0x2d4106[_0xd0b3('0xc4')](_0xce6c0f)['catch'](loggerCatch('[originate][error]'))[_0xd0b3('0x1e')](function(){delete _0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e];return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x48'),'originate\x20action\x20Error'));});});});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x31')]=function(_0x1c90e7){var _0x4b4ad9=this['actions'][_0x1c90e7[_0xd0b3('0x11d')]];if(_0x4b4ad9){delete this['actions'][_0x1c90e7[_0xd0b3('0x11d')]];_0x4b4ad9[_0xd0b3('0x110')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));var _0x552193=_0x4b4ad9['type']==='ivr'?this[_0xd0b3('0x21')][_0x4b4ad9['queue']]:this[_0xd0b3('0x20')][_0x4b4ad9[_0xd0b3('0x187')]()];if(!this['isSuccess'](_0x1c90e7[_0xd0b3('0x188')])){this[_0xd0b3('0xad')](_0x552193);return this[_0xd0b3('0x189')](_0x4b4ad9,_0x552193,_0x1c90e7)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x18a')));}this[_0xd0b3('0x27')][_0x1c90e7[_0xd0b3('0xda')]]=_0x4b4ad9;}};Dialer[_0xd0b3('0x1b')]['checkRetriveMax']=function(_0xab368b,_0x3657fa,_0x58a677){var _0x490691=new History(_0x3657fa);if(_0x490691[_0xd0b3('0xec')]+_0x490691['countcongestionretry']+_0x490691['countnoanswerretry']+_0x490691[_0xd0b3('0xed')]+_0x490691[_0xd0b3('0xee')]+_0x490691['countabandonedretry']+_0x490691[_0xd0b3('0xea')]+_0x490691[_0xd0b3('0xf0')]>=_0x58a677[_0xd0b3('0xf1')]-0x1){return!![];}switch(_0xab368b){case 0x3:if(_0x490691[_0xd0b3('0xfe')]>=_0x58a677[_0xd0b3('0x18b')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countnoanswerretry':_0x490691[_0xd0b3('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x58a677['dialNoAnswerRetryFrequency'],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x490691[_0xd0b3('0xec')]>=_0x58a677[_0xd0b3('0x18c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x490691[_0xd0b3('0xec')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x18d')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691['ListId'],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x490691[_0xd0b3('0x18e')]>=_0x58a677['dialCongestionMaxRetry']-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countcongestionretry':_0x490691[_0xd0b3('0x18e')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x18f')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691['VoiceQueueId']||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x190')));break;case 0x0:if(_0x490691[_0xd0b3('0xed')]>=_0x58a677[_0xd0b3('0x191')]-0x1){return!![];}else{this[_0xd0b3('0xbb')]({'active':![],'countnosuchnumberretry':_0x490691['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x192')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x193')));}break;case 0xa:if(_0x490691['countdropretry']>=_0x58a677[_0xd0b3('0x113')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countdropretry':_0x490691['countdropretry']+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x114')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})['catch'](loggerCatch(_0xd0b3('0x115')));break;case 0xb:if(_0x490691[_0xd0b3('0xef')]>=_0x58a677[_0xd0b3('0x11a')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countabandonedretry':_0x490691[_0xd0b3('0xef')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x194')],_0xd0b3('0xf8'))['format'](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691['ListId'],'VoiceQueueId':_0x490691['VoiceQueueId']||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11b')));break;case 0x13:if(_0x490691[_0xd0b3('0xea')]>=_0x58a677[_0xd0b3('0xf3')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x490691[_0xd0b3('0xea')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfb')));break;case 0x14:if(_0x490691[_0xd0b3('0xf0')]>=_0x58a677['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x490691[_0xd0b3('0xf0')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x195')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x196')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x25af49,_0x3b47da,_0x2a610f){var _0x144c29=this;var _0x31ae01=new History(_0x25af49);return new BPromise(function(_0x5e64cb,_0x386113){if(_['isUndefined'](_0x3b47da)&&typeof _0x3b47da!=='object'){return _0x386113(msgResponse(_0xd0b3('0x197'),_0xd0b3('0x136'),_0xd0b3('0x198')));}if(_[_0xd0b3('0x3d')](_0x2a610f)&&typeof _0x2a610f!==_0xd0b3('0x15b')){return _0x386113(msgResponse('[callProgressDetecting]',_0xd0b3('0x136'),_0xd0b3('0x199')));}switch(_0x2a610f[_0xd0b3('0x107')]){case'0':_0x3b47da[_0xd0b3('0x60')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x0;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x19a');_0x31ae01[_0xd0b3('0xed')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x19c'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x19e')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfd')));if(_0x144c29['checkRetriveMax'](0x0,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xed')]>=_0x3b47da[_0xd0b3('0x191')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x19f'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x19f'));}}break;case'3':_0x3b47da[_0xd0b3('0x1a0')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x3;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x1a1');_0x31ae01['countnoanswerretry']+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1a2'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x1a3')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)['catch'](loggerCatch(_0xd0b3('0x1a4')));if(_0x144c29[_0xd0b3('0x1a5')](0x3,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xfe')]>=_0x3b47da[_0xd0b3('0x18b')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1a6'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1a6'));}}break;case'5':_0x3b47da[_0xd0b3('0x1a7')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x5;_0x31ae01['statedesc']=_0xd0b3('0x1a8');_0x31ae01[_0xd0b3('0xec')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1a9'),ut['buildObj'](_0x25af49,_0xd0b3('0x1aa')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1ab')));if(_0x144c29['checkRetriveMax'](0x5,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xec')]>=_0x3b47da[_0xd0b3('0x18c')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,'reason\x205\x20busy');}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,'reason\x205\x20busy');}}break;case'8':_0x3b47da[_0xd0b3('0x5c')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x8;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x1ac');_0x31ae01[_0xd0b3('0x18e')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1ad'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x1ae')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x144c29[_0xd0b3('0x1a5')](0x8,_0x25af49,_0x3b47da)){if(_0x31ae01['countcongestionretry']>=_0x3b47da[_0xd0b3('0x1af')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b0'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b0'));}}break;case'11':_0x3b47da[_0xd0b3('0x1b1')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0xb;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x31ae01[_0xd0b3('0xef')]+=0x1;_0x31ae01['countglobal']+=0x1;_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11c')));if(_0x144c29[_0xd0b3('0x1a5')](0xb,_0x25af49,_0x3b47da)){if(_0x31ae01['countabandonedretry']>=_0x3b47da['dialAbandonedMaxRetry']){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b2'));}else{_0x144c29['stateGlobal'](_0x31ae01,_0x5e64cb,_0x386113,'reason\x2011\x20abandoned');}}break;case'20':_0x3b47da[_0xd0b3('0x62')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x14;_0x31ae01['statedesc']=_0xd0b3('0x1b3');_0x31ae01['countagentrejectretry']+=0x1;_0x31ae01['countglobal']+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1b4'),ut['buildObj'](_0x25af49,_0xd0b3('0x1b5')));_0x144c29['createHistory'](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1b6')));if(_0x144c29[_0xd0b3('0x1a5')](0x14,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xf0')]>=_0x3b47da['dialAgentRejectMaxRetry']){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b7'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b7'));}}break;default:_0x3b47da[_0xd0b3('0x104')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0xc;_0x31ae01[_0xd0b3('0xa1')]=_0x2a610f[_0xd0b3('0x107')];_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1b8')));if(_0x144c29['checkRetriveMax'](_0x2a610f[_0xd0b3('0x107')],_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xec')]+_0x31ae01['countcongestionretry']+_0x31ae01[_0xd0b3('0xfe')]+_0x31ae01[_0xd0b3('0xed')]+_0x31ae01[_0xd0b3('0xee')]+_0x31ae01[_0xd0b3('0xef')]+_0x31ae01[_0xd0b3('0xea')]+_0x31ae01['countagentrejectretry']>=_0x3b47da[_0xd0b3('0xf1')]){_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0x2a610f[_0xd0b3('0x107')]);}else{_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0x2a610f[_0xd0b3('0x107')]);}}}});};Dialer['prototype'][_0xd0b3('0xff')]=function(_0x18c23d,_0x1ce1b1,_0x12038e,_0x34d02b){var _0x5b69c2=new Final(_0x18c23d);_0x5b69c2[_0xd0b3('0xa0')]=0xf;_0x5b69c2[_0xd0b3('0xa1')]=_0xd0b3('0x1b9');this[_0xd0b3('0xf4')](_0x5b69c2,_0x1ce1b1,_0x12038e,_0x34d02b);};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xf4')]=function(_0x150522,_0x3b1675,_0x32a36a,_0x5cc412){this[_0xd0b3('0xc4')](_0x150522)[_0xd0b3('0xb3')](function(){return _0x3b1675(msgResponse(_0xd0b3('0x197'),_0xd0b3('0xd5'),_0x5cc412));})[_0xd0b3('0xab')](function(){return _0x32a36a(msgResponse(_0xd0b3('0x1ba'),'Failure',_0xd0b3('0x1bb')));});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xa')]=function(_0x4ffa4c){var _0xc17791=_0x4ffa4c['dialPredictiveOptimizationPercentage']/0x64;var _0x212968=_0x4ffa4c[_0xd0b3('0x5f')]/(_0x4ffa4c['outboundDropCallsDayTimeout']+_0x4ffa4c[_0xd0b3('0xe2')]);var _0x3360a4=Math[_0xd0b3('0x1bc')](_0x4ffa4c[_0xd0b3('0x6b')]*(_0x4ffa4c['predictiveIntervalMaxThreshold']/0x64));var _0xaf562a=Math[_0xd0b3('0x1bc')](_0x4ffa4c[_0xd0b3('0x6b')]*(_0x4ffa4c[_0xd0b3('0x1bd')]/0x64));var _0x32020a=_0x4ffa4c[_0xd0b3('0x4d')]+_0x4ffa4c[_0xd0b3('0x52')];var _0x406cf8=Math[_0xd0b3('0x1be')](_0x4ffa4c[_0xd0b3('0x6d')]*_0x4ffa4c[_0xd0b3('0x6e')]*_0x4ffa4c['predictiveIntervalHitRate']*_0x4ffa4c[_0xd0b3('0x6a')]);if(_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x86')])){if(!_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x87')])){_0x4ffa4c['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd0b3('0x1bf'));}if(!_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x89')])){loggerPredictive[_0xd0b3('0x8d')]('[startMethodPredictive][StartProgressive]',_0xd0b3('0x1c0'));clearInterval(_0x4ffa4c['handlePredictive']);_0x4ffa4c[_0xd0b3('0x89')]=undefined;}_0x4ffa4c[_0xd0b3('0x86')]=moment()[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4ffa4c['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4ffa4c[_0xd0b3('0x86')]);this[_0xd0b3('0x14b')](_0x4ffa4c,0x1);}else if(ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x86')])){this[_0xd0b3('0x14b')](_0x4ffa4c,0x1);loggerPredictiveCalls[_0xd0b3('0x77')](_0xd0b3('0x1c2'),_0x4ffa4c[_0xd0b3('0x86')],_0x4ffa4c[_0xd0b3('0x40')]);_0x4ffa4c['erlangCalls']=0x0;_0x4ffa4c[_0xd0b3('0x68')]=0x0;}else if(_0xc17791<_0x212968&&_0x4ffa4c['dialPredictiveOptimization']===_0xd0b3('0x1c3')){freeVariablesPredictive(_0x4ffa4c);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x1c4'),_0xd0b3('0x1c5'),_0x212968,_0xd0b3('0x86'),_0x4ffa4c[_0xd0b3('0x40')]);}else if(_0x406cf8<_0x4ffa4c[_0xd0b3('0x68')]&&_0x4ffa4c[_0xd0b3('0x1c6')]===_0xd0b3('0x1c3')){freeVariablesPredictive(_0x4ffa4c);loggerPredictive['info'](_0xd0b3('0x1c7'),'Max\x20Drop\x20',_0x406cf8,_0xd0b3('0x1c8'),_0x4ffa4c[_0xd0b3('0x68')],'startProgressive',_0x4ffa4c['name']);}else if(!ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x86')])&&_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x87')])&&!_['isUndefined'](_0x4ffa4c['startProgressive'])){_0x4ffa4c['startPredictive']=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1c9'),_0x4ffa4c[_0xd0b3('0x87')]);this[_0xd0b3('0xb9')](_0x4ffa4c[_0xd0b3('0x1c1')])[_0xd0b3('0xb3')](this[_0xd0b3('0x1ca')](_0x4ffa4c))[_0xd0b3('0xb3')](mergeDataErlangB(_0x4ffa4c))[_0xd0b3('0xb3')](this['startMethodPredictive'](_0x4ffa4c))[_0xd0b3('0xab')](loggerCatchPredictive(_0xd0b3('0x1cb'),_0x4ffa4c));}else if(!ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x87')])){_0x4ffa4c[_0xd0b3('0x68')]=0x0;_0x4ffa4c[_0xd0b3('0x87')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1cc'),_0x4ffa4c[_0xd0b3('0x87')]);clearInterval(_0x4ffa4c[_0xd0b3('0x89')]);_0x4ffa4c[_0xd0b3('0x89')]=undefined;this[_0xd0b3('0xb9')](_0x4ffa4c[_0xd0b3('0x1c1')])[_0xd0b3('0xb3')](this[_0xd0b3('0x1ca')](_0x4ffa4c))[_0xd0b3('0xb3')](mergeDataErlangB(_0x4ffa4c))[_0xd0b3('0xb3')](this[_0xd0b3('0x1cd')](_0x4ffa4c))[_0xd0b3('0xab')](loggerCatchPredictive(_0xd0b3('0x1ce'),_0x4ffa4c));}else if(_0x4ffa4c[_0xd0b3('0x6b')]&&_0x32020a<_0x4ffa4c['predictiveIntervalAvailable']-_0xaf562a){freeVariablesPredictive(_0x4ffa4c);loggerPredictive['info'](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1cf'),_0x32020a,_0xd0b3('0x1d0'),_0x4ffa4c[_0xd0b3('0x6b')],'-',_0xaf562a,'=',_0x4ffa4c[_0xd0b3('0x6b')]-_0xaf562a,')');}else if(_0x4ffa4c[_0xd0b3('0x6b')]&&_0x32020a>_0x4ffa4c[_0xd0b3('0x6b')]+_0x3360a4){freeVariablesPredictive(_0x4ffa4c);loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c['name'],_0xd0b3('0x1cf'),_0x32020a,_0xd0b3('0x1d1'),_0x4ffa4c[_0xd0b3('0x6b')],'+',_0x3360a4,'=',_0x4ffa4c[_0xd0b3('0x6b')]+_0x3360a4,')');}};Dialer['prototype'][_0xd0b3('0x1ca')]=function(_0x6e135a){var _0x118af4=this;return function(_0x47cf21){return new BPromise(function(_0x2a6caa,_0x59f187){_[_0xd0b3('0xce')](_0x6e135a,_0x47cf21[0x0]);if(checkGetDataPredictive(_0x47cf21[0x0])){var _0x369e39=_0x6e135a['predictiveIntervalAvailable']=_0x6e135a[_0xd0b3('0x52')]+_0x6e135a[_0xd0b3('0x4d')];var _0x2dc936=_0x6e135a[_0xd0b3('0x1c1')]*0x3c;var _0x1270fb=_0x47cf21[0x0][_0xd0b3('0x65')]+_0x47cf21[0x0][_0xd0b3('0x64')];var _0x210362=(_0x47cf21[0x0][_0xd0b3('0x63')]+_0x47cf21[0x0][_0xd0b3('0x67')]+_0x47cf21[0x0][_0xd0b3('0x66')])/_0x47cf21[0x0][_0xd0b3('0x6c')];_0x6e135a['predictiveIntervalHitRate']=_0x210362>0x0?_0x210362:0x1;switch(_0x6e135a[_0xd0b3('0x1c6')]){case _0xd0b3('0x1c3'):var _0x386a04=_0x6e135a[_0xd0b3('0x1d2')]/0x64;return _0x118af4[_0xd0b3('0x1d3')](_0x369e39,_0x2dc936,_0x1270fb,_0x210362,_0x386a04)[_0xd0b3('0xb3')](function(_0x2f2761){return _0x2a6caa(_0x2f2761);});case _0xd0b3('0x1d4'):var _0x3a54df=_0x6e135a[_0xd0b3('0x1d2')]/0x64;return _0x118af4[_0xd0b3('0x1d5')](_0x369e39,_0x2dc936,_0x1270fb,_0x210362,_0x3a54df)[_0xd0b3('0xb3')](function(_0xe36851){return _0x2a6caa(_0xe36851);});default:return _0x59f187(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d7')));}}else{return _0x59f187(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d8')));}});};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x1d9')]=function(_0x326a9a){var _0xe99928=this;return function(_0x3ec639){return new BPromise(function(_0x1a0455,_0x5a8645){_['merge'](_0x326a9a,_0x3ec639[0x0]);if(checkGetDataPredictive(_0x3ec639[0x0])){loggerPredictive[_0xd0b3('0x77')](JSON[_0xd0b3('0x49')](_0x3ec639[0x0]));if(_0x326a9a[_0xd0b3('0x1c6')]===_0xd0b3('0x1c3')){return _0xe99928[_0xd0b3('0xc2')](_0x326a9a['id'])[_0xd0b3('0xb3')](function(_0x200190){var _0x4a5b48=_0x326a9a[_0xd0b3('0x4e')]-_0x200190[0x0][_0xd0b3('0x1da')];var _0x16fbe7=_0x326a9a[_0xd0b3('0x1c1')]*0x3c;var _0x4f4d1a=_0x3ec639[0x0][_0xd0b3('0x65')]+_0x3ec639[0x0]['predictiveIntervalAvgHoldtime'];var _0x16d017=(_0x3ec639[0x0][_0xd0b3('0x63')]+_0x3ec639[0x0][_0xd0b3('0x67')]+_0x3ec639[0x0][_0xd0b3('0x66')])/_0x3ec639[0x0][_0xd0b3('0x6c')];var _0x1ebcb9=_0x326a9a[_0xd0b3('0x1d2')]/0x64;_0x326a9a[_0xd0b3('0x1db')]=_0x200190[0x0][_0xd0b3('0x1da')]||0x0;_0x326a9a[_0xd0b3('0x69')]=_0x16d017>0x0?_0x16d017:0x1;return _0xe99928[_0xd0b3('0x1d3')](_0x4a5b48,_0x16fbe7,_0x4f4d1a,_0x16d017,_0x1ebcb9);})[_0xd0b3('0xb3')](function(_0x5792d2){return _0x1a0455(_0x5792d2);})['catch'](function(_0x5356e6){return _0x5a8645(msgResponse(_0xd0b3('0x1dc'),_0xd0b3('0x136'),JSON['stringify'](_0x5356e6)));});}if(_0x326a9a[_0xd0b3('0x1c6')]==='agentBusyFactor'){return _0xe99928['getVoiceQueueRtPauses'](_0x326a9a['id'])[_0xd0b3('0xb3')](function(_0x35d6b0){var _0x11242d=_0x326a9a[_0xd0b3('0x4e')]-_0x35d6b0[0x0][_0xd0b3('0x1da')];var _0xc05b3=_0x326a9a[_0xd0b3('0x1c1')]*0x3c;var _0x1ad165=_0x3ec639[0x0][_0xd0b3('0x65')]+_0x3ec639[0x0]['predictiveIntervalAvgHoldtime'];var _0x438025=(_0x3ec639[0x0][_0xd0b3('0x63')]+_0x3ec639[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3ec639[0x0][_0xd0b3('0x66')])/_0x3ec639[0x0][_0xd0b3('0x6c')];var _0x4d9e02=_0x326a9a[_0xd0b3('0x1d2')]/0x64;_0x326a9a[_0xd0b3('0x1db')]=_0x35d6b0[0x0]['outboundQueuePauses']||0x0;_0x326a9a['predictiveIntervalHitRate']=_0x438025>0x0?_0x438025:0x1;return _0xe99928[_0xd0b3('0x1d5')](_0x11242d,_0xc05b3,_0x1ad165,_0x438025,_0x4d9e02);})['then'](function(_0x4ee3bb){return _0x1a0455(_0x4ee3bb);})['catch'](function(_0x29158a){return _0x5a8645(msgResponse(_0xd0b3('0x1dc'),_0xd0b3('0x136'),JSON[_0xd0b3('0x49')](_0x29158a)));});}}else{return _0x5a8645(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d8')));}});};};Dialer[_0xd0b3('0x1b')]['startMethodPredictive']=function(_0x646ea6){var _0x2bdfd9=this;return function(){var _0x2a5462=0x0;var _0x14877d=Math[_0xd0b3('0x1be')](_0x646ea6[_0xd0b3('0x1dd')]*0x3e8);if(_0x14877d>0x0){_0x14877d=_0x14877d<0x64?0x64:_0x14877d;loggerPredictive[_0xd0b3('0x77')](_0x646ea6[_0xd0b3('0x40')],_0xd0b3('0x1de'),_0x14877d,_0xd0b3('0x4a'));_0x646ea6[_0xd0b3('0x89')]=setInterval(function(){_0x2bdfd9['handlePredictive'](_0x646ea6);loggerPredictiveCalls['info']('[handlePredictive]',_0x2a5462+=0x1);},_0x14877d);}else{loggerPredictive['info'](_0x646ea6['name'],_0xd0b3('0x1df'));}};};Dialer['prototype'][_0xd0b3('0x1e0')]=function(_0x53b1c2,_0xd469f2){var _0x425c09=this;return function(_0x57050f){if(_[_0xd0b3('0x45')](_0x57050f)){if(_[_0xd0b3('0xa8')](_0xd469f2[_0xd0b3('0x1e1')])||!_0xd469f2[_0xd0b3('0x1e2')]){if(_0x53b1c2['dialMethod']===_0xd0b3('0x1e3')){_0x53b1c2[_0xd0b3('0x123')]=_[_0xd0b3('0x3d')](_0x53b1c2[_0xd0b3('0x123')])?!![]:_0x53b1c2[_0xd0b3('0x123')];var _0x858390=uuid['v4']();_0x425c09[_0xd0b3('0xa6')][_0x858390]=new Action(_0x53b1c2,_0xd469f2,_0x858390);loggerBooked[_0xd0b3('0x77')](_0xd0b3('0x1e4'),_0x858390,'queueStatusComplete:\x20',JSON[_0xd0b3('0x49')](_0x53b1c2[_0xd0b3('0x123')]),_0xd0b3('0x1e5'),_0x53b1c2[_0xd0b3('0x40')]);if(_0x53b1c2[_0xd0b3('0x123')]){_0x53b1c2[_0xd0b3('0x123')]=![];_0x425c09['queueBooked'][_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xae')]]=[];ami[_0xd0b3('0xa9')]({'actionid':_0x858390,'action':_0xd0b3('0x1e6'),'queue':_0x53b1c2['name']})[_0xd0b3('0xab')](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);_0x425c09['rescheduleContact']({'active':![],'ContactId':_0x425c09['actions'][_0x858390][_0xd0b3('0xd0')],'ListId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xd1')],'VoiceQueueId':_0x425c09['actions'][_0x858390][_0xd0b3('0xfa')]||undefined,'CampaignId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1e7')));delete _0x425c09[_0xd0b3('0xa6')][_0x858390];});}else{loggerBooked[_0xd0b3('0x77')](_0xd0b3('0x1e8'),JSON['stringify'](_0x53b1c2[_0xd0b3('0x123')]),'Queue:\x20',_0x53b1c2[_0xd0b3('0x40')]);_0x425c09[_0xd0b3('0xad')](_0x53b1c2);_0x425c09[_0xd0b3('0xbb')]({'active':![],'ContactId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['ContactId'],'ListId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['ListId'],'VoiceQueueId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xfa')]||undefined,'CampaignId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x425c09[_0xd0b3('0xa6')][_0x858390];}}else{return _0x425c09[_0xd0b3('0x15a')](_0x53b1c2,_0xd469f2);}}else{if(getDiff(_0xd469f2[_0xd0b3('0x1e9')])<_0x53b1c2['dialRecallMeTimeout']*0x3c){if(_0xd469f2['Agent']&&!_0xd469f2[_0xd0b3('0x1ea')][_0xd0b3('0x1eb')]){_0x425c09[_0xd0b3('0x1f')][_0xd0b3('0x126')](_0xd469f2['id'])['finally'](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);});}else{_0x425c09[_0xd0b3('0xbd')]({'active':![]},_0xd469f2['id'],0x1)['finally'](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);});}}else{_0x53b1c2['outboundReCallsDay']+=0x1;_0x425c09[_0xd0b3('0xad')](_0x53b1c2);if(_0x53b1c2['dialRecallInQueue']){_0x425c09['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xd469f2[_0xd0b3('0xd0')],'ListId':_0xd469f2[_0xd0b3('0xd1')],'VoiceQueueId':_0xd469f2[_0xd0b3('0xfa')]||undefined,'CampaignId':_0xd469f2[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1ec')));_0x425c09[_0xd0b3('0xc6')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1ed'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xd0b3('0x1ee')));}else{_0x425c09[_0xd0b3('0xcd')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1ef'),0x16,_0xd0b3('0x1f0')),_0xd0b3('0x1f1'),_0xd0b3('0x1f2'));}}}}else{_0x53b1c2['outboundBlacklistCallsDay']+=0x1;_0x425c09[_0xd0b3('0xcd')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1f3'),0xd,_0xd0b3('0x1f4')),_0xd0b3('0x1f5'),'[Originate][MoveBlacklist]');throw _0xd0b3('0x1f6');}};};Dialer['prototype'][_0xd0b3('0x1f7')]=function(_0x2d0893){var _0x2bde02=this;var _0x750ffa=_0x2d0893['limitCalls']-_0x2d0893[_0xd0b3('0x91')]-_0x2d0893['temp'];emitCampaignSummary(_0x2d0893);if(_0x750ffa>0x0){if(_0x750ffa>this[_0xd0b3('0x24')]){_0x750ffa=this[_0xd0b3('0x24')];}_0x2d0893[_0xd0b3('0x1f8')]+=_0x750ffa;this['getContactDialerIvr'](_0x2d0893['id'],_0x750ffa,_0x2d0893['dialOrderByScheduledAt'])[_0xd0b3('0xb3')](function(_0x4740f0){_0x2d0893[_0xd0b3('0x1f8')]-=_0x750ffa;_0x2d0893[_0xd0b3('0x1f8')]=_0x2d0893['temp']>0x0?_0x2d0893[_0xd0b3('0x1f8')]:0x0;if(!checkContactEmpty(_0x4740f0)){_0x2d0893[_0xd0b3('0x3e')]=_0xd0b3('0x98');logger[_0xd0b3('0x77')](_0xd0b3('0x1f9')+_0x2d0893[_0xd0b3('0x40')]);}else{_0x2d0893['originated']+=_0x4740f0['length'];_0x2d0893['message']=_0xd0b3('0x1fa');for(var _0x29a53a=0x0;_0x29a53a<_0x4740f0[_0xd0b3('0x90')];_0x29a53a+=0x1){_0x2d0893[_0xd0b3('0x1fb')]+=0x1;if(_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a])||_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a][_0xd0b3('0x15e')][_0xd0b3('0x15f')])){_0x2bde02[_0xd0b3('0xcb')]('[actionOriginate]\x20',_0x2d0893,_0x4740f0[_0x29a53a]);}else{_0x2bde02[_0xd0b3('0xb7')](_[_0xd0b3('0xcf')](_0x4740f0[_0x29a53a],['CampaignId',_0xd0b3('0x1fc')]))[_0xd0b3('0xb3')](_0x2bde02[_0xd0b3('0x1e0')](_0x2d0893,_0x4740f0[_0x29a53a]))[_0xd0b3('0xab')](_0x2bde02[_0xd0b3('0xca')](_0xd0b3('0x1fd'),_0x2d0893));}}}})[_0xd0b3('0xab')](loggerGetContactDialer('[getContactCampaign2]',_0x2d0893,_0x750ffa));}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x14b')]=function(_0x333b61,_0x41a3c4){var _0x4ed88a=this;var _0x17a4d6=[];var _0x30d124=_0x41a3c4>=0x1?_0x41a3c4:0x1;if(_0x333b61['dialMethod']===_0xd0b3('0x1e3')){_0x30d124=0x1;}var _0x24428e=Math[_0xd0b3('0x1be')](_0x333b61[_0xd0b3('0x4d')]*_0x30d124)-_0x333b61[_0xd0b3('0x91')]-_0x333b61['temp'];emitVoiceQueueSummary(_0x333b61);if(_0x333b61[_0xd0b3('0x1fe')]>0x0){var _0x21753d=_0x333b61[_0xd0b3('0x1fe')]-_0x333b61[_0xd0b3('0x91')]-_0x333b61['talking']-_0x333b61['temp']-_0x333b61[_0xd0b3('0x4f')];if(_0x24428e>_0x21753d){_0x24428e=_0x21753d;}}if(_0x24428e>0x0){if(_0x333b61[_0xd0b3('0x148')]==='booked'){_0x24428e=0x1;}if(_0x24428e>this[_0xd0b3('0x24')]){_0x24428e=this['maxNumberOriginate'];}_0x333b61[_0xd0b3('0x1f8')]+=_0x24428e;for(var _0x1ae1d4 in this['agents']){if(typeof this[_0xd0b3('0x22')][_0x1ae1d4]!==_0xd0b3('0x92')){if(this[_0xd0b3('0x22')][_0x1ae1d4][_0xd0b3('0xa0')]===_0xd0b3('0x1ff')&&this[_0xd0b3('0x22')][_0x1ae1d4][_0xd0b3('0xd8')]==='reachable'){_0x17a4d6[_0xd0b3('0x121')](this[_0xd0b3('0x22')][_0x1ae1d4]['id']);}}}this['getContactDialer'](_0x333b61['id'],_0x17a4d6,_0x24428e,_0x333b61[_0xd0b3('0x200')])['then'](function(_0xb890d0){_0x333b61['temp']-=_0x24428e;_0x333b61['temp']=_0x333b61['temp']>0x0?_0x333b61[_0xd0b3('0x1f8')]:0x0;if(!checkContactEmpty(_0xb890d0)){_0x4ed88a['countReScheduled'](_0x333b61)[_0xd0b3('0xb3')](sendMessageReschedule(_0x333b61))['catch'](loggerCatch(_0xd0b3('0xb4')));}else{_0x333b61[_0xd0b3('0x91')]+=_0xb890d0[_0xd0b3('0x90')];_0x333b61[_0xd0b3('0x3e')]=_0x333b61[_0xd0b3('0x148')]===_0xd0b3('0x1e3')?_0xd0b3('0x166'):_0xd0b3('0x1fa');for(var _0xea49ba=0x0;_0xea49ba<_0xb890d0[_0xd0b3('0x90')];_0xea49ba+=0x1){if(_['isNil'](_0xb890d0[_0xea49ba])||_[_0xd0b3('0xa8')](_0xb890d0[_0xea49ba][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0xb890d0[_0xea49ba][_0xd0b3('0x15e')][_0xd0b3('0x15f')])){_0x4ed88a['emptyContact']('[actionOriginate]\x20',_0x333b61,_0xb890d0[_0xea49ba]);}else{_0x4ed88a['checkIsBlackList'](_['pick'](_0xb890d0[_0xea49ba],[_0xd0b3('0xfa'),'Contact.phone']))['then'](_0x4ed88a[_0xd0b3('0x1e0')](_0x333b61,_0xb890d0[_0xea49ba]))[_0xd0b3('0xab')](_0x4ed88a['loggerHandler'](_0xd0b3('0x201'),_0x333b61));}}}})[_0xd0b3('0xab')](loggerGetContactDialer(_0xd0b3('0x202'),_0x333b61,_0x24428e));}};Dialer['prototype'][_0xd0b3('0x89')]=function(_0x291efe){if(_0x291efe['dialLimitQueue']>0x0){var _0x3e0c7c=_0x291efe[_0xd0b3('0x1fe')]-_0x291efe[_0xd0b3('0x91')]-_0x291efe['talking'];if(_0x3e0c7c>0x0){this['tryOriginatePredictive'](_0x291efe);}else{loggerPredictiveCalls[_0xd0b3('0x77')](_0xd0b3('0x203'));}}else{this['tryOriginatePredictive'](_0x291efe);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x9bc673){var _0x5cf726=this;var _0x52c069=[];_0x9bc673[_0xd0b3('0x91')]+=0x1;for(var _0xb2e59b in this[_0xd0b3('0x22')]){if(typeof this['agents'][_0xb2e59b]!==_0xd0b3('0x92')){if(this['agents'][_0xb2e59b][_0xd0b3('0xa0')]===_0xd0b3('0x1ff')&&this[_0xd0b3('0x22')][_0xb2e59b]['status']==='reachable'){_0x52c069['push'](this[_0xd0b3('0x22')][_0xb2e59b]['id']);}}}this['getContactDialer'](_0x9bc673['id'],_0x52c069,0x1,_0x9bc673[_0xd0b3('0x200')])[_0xd0b3('0xb3')](function(_0x1a7a35){if(!checkContactEmpty(_0x1a7a35)){checkContactLowerLimitOriginate(_0x9bc673,0x1,0x0);_0x5cf726[_0xd0b3('0xb1')](_0x9bc673)['then'](sendMessageReschedule(_0x9bc673))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb4')));}else{_0x9bc673[_0xd0b3('0x3e')]='RUNNING';if(_['isNil'](_0x1a7a35[0x0])||_[_0xd0b3('0xa8')](_0x1a7a35[0x0][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0x1a7a35[0x0]['Contact'][_0xd0b3('0x15f')])){_0x5cf726[_0xd0b3('0xcb')](_0xd0b3('0x201'),_0x9bc673,_0x1a7a35[0x0]);}else{_0x5cf726['checkIsBlackList'](_[_0xd0b3('0xcf')](_0x1a7a35[0x0],[_0xd0b3('0xfa'),'Contact.phone']))['then'](_0x5cf726[_0xd0b3('0x1e0')](_0x9bc673,_0x1a7a35[0x0]))['catch'](_0x5cf726[_0xd0b3('0xca')]('[actionOriginatePredictive]\x20',_0x9bc673));}}})[_0xd0b3('0xab')](loggerGetContactDialer(_0xd0b3('0x204'),_0x9bc673,0x1));emitVoiceQueueSummary(_0x9bc673);};Dialer['prototype'][_0xd0b3('0x1d3')]=function(_0x53e141,_0x2499c9,_0x6c25ae,_0x23b850,_0x11704c,_0x1fbeb4){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x205'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x206'),_0x53e141);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x207'),_0x2499c9);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x208'),_0x6c25ae);loggerPredictive['info'](_0xd0b3('0x209'),_0x23b850);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x20a'),_0x11704c);loggerPredictive['info']('---------------------------');return new BPromise(function(_0xe05fef,_0x39a3e9){if(_0x53e141<=0x0||isNaN(_0x53e141)){return _0x39a3e9(msgResponse('[abandonmentRate]','Error',_0xd0b3('0x20b')+_0x53e141));}if(_0x6c25ae<=0x0||isNaN(_0x6c25ae)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),_0xd0b3('0x48'),'Ts\x20=\x20'+_0x6c25ae));}if(_0x23b850<=0x0||isNaN(_0x23b850)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),_0xd0b3('0x48'),_0xd0b3('0x20d')+_0x23b850));}if(_0x2499c9<=0x0||isNaN(_0x2499c9)){return _0x39a3e9(msgResponse('[abandonmentRate]','Error',_0xd0b3('0x20e')+_0x2499c9));}if(_0x11704c<=0x0||isNaN(_0x11704c)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),'Error',_0xd0b3('0x20f')+_0x11704c));}_0x1fbeb4=_0x1fbeb4||0x0;var _0x135a54=0x1/_0x6c25ae;var _0x230bf5=0x0;var _0x11791f=0x0;var _0x301190=0x0;var _0x443082=0x0;for(var _0x2552a1=0x0;_0x301190<_0x11704c;_0x2552a1+=0x1){_0x11791f=_0x2552a1/_0x2499c9;_0x230bf5=(_0x23b850*_0x11791f+_0x1fbeb4)/_0x135a54;_0x301190=erlangb(_0x230bf5,_0x53e141);_0x443082=_0x230bf5/_0x53e141*(0x1-erlangb(_0x230bf5,_0x53e141));}return _0xe05fef({'erlangCalls':_0x2552a1,'erlangCallToSecond':_0x2499c9/_0x2552a1,'erlangAbandonmentRate':_0x301190,'erlangBusyFactor':_0x443082});});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x1d5')]=function(_0x4cf1f6,_0x53b899,_0x18660f,_0x5202c7,_0x3a09ff,_0x36f038){loggerPredictive[_0xd0b3('0x77')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x206'),_0x4cf1f6);loggerPredictive[_0xd0b3('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53b899);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x208'),_0x18660f);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x209'),_0x5202c7);loggerPredictive['info'](_0xd0b3('0x210'),_0x3a09ff);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x84'));return new BPromise(function(_0x536238,_0x3b8cb5){if(_0x4cf1f6<=0x0||isNaN(_0x4cf1f6)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),_0xd0b3('0x48'),'m\x20=\x20'+_0x4cf1f6));}if(_0x18660f<=0x0||isNaN(_0x18660f)){return _0x3b8cb5(msgResponse('[busyFactor]',_0xd0b3('0x48'),'Ts\x20=\x20'+_0x18660f));}if(_0x5202c7<=0x0||isNaN(_0x5202c7)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),_0xd0b3('0x48'),_0xd0b3('0x20d')+_0x5202c7));}if(_0x53b899<=0x0||isNaN(_0x53b899)){return _0x3b8cb5(msgResponse('[busyFactor]','Error',_0xd0b3('0x20e')+_0x53b899));}if(_0x3a09ff<=0x0||isNaN(_0x3a09ff)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),'Error','Umin\x20=\x20'+_0x3a09ff));}_0x36f038=_0x36f038||0x0;var _0x122dde=0x1/_0x18660f;var _0x11ad33=0x0;var _0x2eead5=0x0;var _0x8a8693=0x0;var _0x13b125=0x0;for(var _0x4d94a3=0x0;_0x13b125<_0x3a09ff;_0x4d94a3+=0x1){_0x2eead5=_0x4d94a3/_0x53b899;_0x11ad33=(_0x5202c7*_0x2eead5+_0x36f038)/_0x122dde;_0x8a8693=erlangb(_0x11ad33,_0x4cf1f6);_0x13b125=_0x11ad33/_0x4cf1f6*(0x1-erlangb(_0x11ad33,_0x4cf1f6));}return _0x536238({'erlangCalls':_0x4d94a3,'erlangCallToSecond':_0x53b899/_0x4d94a3,'erlangAbandonmentRate':_0x8a8693,'erlangBusyFactor':_0x13b125});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a33e7b2..81bb9e7 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 _0x0393=['diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0393,0x1ca));var _0x3039=function(_0x35b637,_0x43c488){_0x35b637=_0x35b637-0x0;var _0x115a86=_0x0393[_0x35b637];return _0x115a86;};'use strict';var util=require(_0x3039('0x0'));var _=require(_0x3039('0x1'));var moment=require(_0x3039('0x2'));function getSeconds(_0x1c4aab,_0x5f5342){var _0x27425a=moment(_0x1c4aab)[_0x3039('0x3')](0x0);var _0xbdd7b5=moment(_0x5f5342)[_0x3039('0x3')](0x0);return _0x27425a[_0x3039('0x4')](_0xbdd7b5,_0x3039('0x5'));}function QueueCallerAbandon(_0x2cff92,_0x1b230f){this['scheduledat']=_0x2cff92[_0x3039('0x6')];this['type']=_0x2cff92['type'];this[_0x3039('0x7')]=_0x2cff92[_0x3039('0x8')]===_0x3039('0x9')?_0x3039('0xa'):_0x2cff92[_0x3039('0x8')];this['countbusyretry']=_0x2cff92[_0x3039('0xb')];this[_0x3039('0xc')]=_0x2cff92['countcongestionretry'];this['countnoanswerretry']=_0x2cff92['countnoanswerretry'];this[_0x3039('0xd')]=_0x2cff92[_0x3039('0xb')]+_0x2cff92['countcongestionretry']+_0x2cff92[_0x3039('0xe')]+_0x2cff92[_0x3039('0xf')]+_0x2cff92[_0x3039('0x10')]+_0x2cff92[_0x3039('0x11')]+_0x2cff92[_0x3039('0x12')]+_0x2cff92[_0x3039('0x13')];this[_0x3039('0xf')]=_0x2cff92[_0x3039('0xf')];this['countdropretry']=_0x2cff92[_0x3039('0x10')];this['countabandonedretry']=_0x2cff92[_0x3039('0x11')];this[_0x3039('0x12')]=_0x2cff92[_0x3039('0x12')];this[_0x3039('0x13')]=_0x2cff92[_0x3039('0x13')];this[_0x3039('0x14')]=_0x1b230f['uniqueid'];this['calleridname']=_0x2cff92[_0x3039('0x15')];this[_0x3039('0x16')]=_0x2cff92[_0x3039('0x17')];this[_0x3039('0x18')]=_0x2cff92['starttime'];this['responsetime']=_0x2cff92[_0x3039('0x19')];this[_0x3039('0x1a')]=_0x2cff92[_0x3039('0x1a')];this[_0x3039('0x1b')]=this[_0x3039('0x1a')];this['ringtime']=getSeconds(_0x2cff92[_0x3039('0x19')],_0x2cff92['starttime']);this[_0x3039('0x1c')]=getSeconds(this[_0x3039('0x1a')],_0x2cff92[_0x3039('0x19')]);this[_0x3039('0x1d')]=0x0;this[_0x3039('0xa')]=_0x1b230f[_0x3039('0xa')];this[_0x3039('0x1e')]=_0x1b230f[_0x3039('0x1f')];this[_0x3039('0x20')]=_0x1b230f[_0x3039('0x20')];this[_0x3039('0x21')]=_0x2cff92['callback'];this[_0x3039('0x22')]=_0x2cff92[_0x3039('0x22')];this[_0x3039('0x23')]=_0x2cff92[_0x3039('0x23')];this[_0x3039('0x24')]=_0x2cff92[_0x3039('0x24')];this['ContactId']=_0x2cff92[_0x3039('0x25')];this['ListId']=_0x2cff92['ListId'];this[_0x3039('0x26')]=_0x2cff92[_0x3039('0x26')];this['VoiceQueueId']=_0x2cff92['VoiceQueueId'];this['CampaignId']=_0x2cff92['CampaignId'];this['originatecalleridnum']=_0x2cff92[_0x3039('0x27')]||'';this[_0x3039('0x28')]=_0x2cff92[_0x3039('0x28')]||'';}module[_0x3039('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x5699=['reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename'];(function(_0x430d2c,_0x5e62a6){var _0x3dfdb1=function(_0x18abc9){while(--_0x18abc9){_0x430d2c['push'](_0x430d2c['shift']());}};_0x3dfdb1(++_0x5e62a6);}(_0x5699,0x154));var _0x9569=function(_0x379f0c,_0x36f65f){_0x379f0c=_0x379f0c-0x0;var _0xe07df6=_0x5699[_0x379f0c];return _0xe07df6;};'use strict';var util=require('util');var _=require(_0x9569('0x0'));var moment=require(_0x9569('0x1'));function getSeconds(_0x10dae0,_0x478848){var _0x421932=moment(_0x10dae0)[_0x9569('0x2')](0x0);var _0x39c99c=moment(_0x478848)[_0x9569('0x2')](0x0);return _0x421932[_0x9569('0x3')](_0x39c99c,_0x9569('0x4'));}function QueueCallerAbandon(_0x226033,_0x5d3d5e){this[_0x9569('0x5')]=_0x226033[_0x9569('0x5')];this[_0x9569('0x6')]=_0x226033[_0x9569('0x6')];this[_0x9569('0x7')]=_0x226033['type']==='outbound'?_0x9569('0x8'):_0x226033[_0x9569('0x6')];this[_0x9569('0x9')]=_0x226033[_0x9569('0x9')];this['countcongestionretry']=_0x226033['countcongestionretry'];this[_0x9569('0xa')]=_0x226033[_0x9569('0xa')];this[_0x9569('0xb')]=_0x226033[_0x9569('0x9')]+_0x226033[_0x9569('0xc')]+_0x226033[_0x9569('0xa')]+_0x226033[_0x9569('0xd')]+_0x226033[_0x9569('0xe')]+_0x226033[_0x9569('0xf')]+_0x226033[_0x9569('0x10')]+_0x226033[_0x9569('0x11')];this['countnosuchnumberretry']=_0x226033[_0x9569('0xd')];this['countdropretry']=_0x226033['countdropretry'];this[_0x9569('0xf')]=_0x226033['countabandonedretry'];this['countmachineretry']=_0x226033['countmachineretry'];this[_0x9569('0x11')]=_0x226033[_0x9569('0x11')];this['uniqueid']=_0x5d3d5e[_0x9569('0x12')];this['calleridname']=_0x226033[_0x9569('0x13')];this[_0x9569('0x14')]=_0x226033['number'];this[_0x9569('0x15')]=_0x226033[_0x9569('0x15')];this[_0x9569('0x16')]=_0x226033[_0x9569('0x16')];this[_0x9569('0x17')]=_0x226033[_0x9569('0x17')];this['endtime']=this['droptime'];this[_0x9569('0x18')]=getSeconds(_0x226033[_0x9569('0x16')],_0x226033[_0x9569('0x15')]);this[_0x9569('0x19')]=getSeconds(this[_0x9569('0x17')],_0x226033[_0x9569('0x16')]);this[_0x9569('0x1a')]=0x0;this[_0x9569('0x8')]=_0x5d3d5e[_0x9569('0x8')];this[_0x9569('0x1b')]=_0x5d3d5e[_0x9569('0x1c')];this[_0x9569('0x1d')]=_0x5d3d5e[_0x9569('0x1d')];this[_0x9569('0x1e')]=_0x226033[_0x9569('0x1e')];this['callbackuniqueid']=_0x226033['callbackuniqueid'];this['callbackat']=_0x226033[_0x9569('0x1f')];this[_0x9569('0x20')]=_0x226033[_0x9569('0x20')];this['ContactId']=_0x226033[_0x9569('0x21')];this[_0x9569('0x22')]=_0x226033['ListId'];this[_0x9569('0x23')]=_0x226033[_0x9569('0x23')];this[_0x9569('0x24')]=_0x226033[_0x9569('0x24')];this[_0x9569('0x25')]=_0x226033[_0x9569('0x25')];this['originatecalleridnum']=_0x226033[_0x9569('0x26')]||'';this['originatecalleridname']=_0x226033[_0x9569('0x27')]||'';}module[_0x9569('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8bc5540..7b3cba5 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 _0xc7e8=['util','uniqueid','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','AttachmentId'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xc7e8,0x1e0));var _0x8c7e=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xc7e8[_0x1f3aec];return _0x409f0d;};'use strict';var util=require(_0x8c7e('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x48bdbf,_0xe8e0e,_0x1447af){this[_0x8c7e('0x1')]=_0x48bdbf||undefined;this['channel']=util[_0x8c7e('0x2')](_0x8c7e('0x3'),_0xe8e0e[_0x8c7e('0x4')],_0xe8e0e[_0x8c7e('0x5')][_0x8c7e('0x6')],_0x1447af['fax']);this['localstationid']=_0xe8e0e[_0x8c7e('0x7')];this[_0x8c7e('0x8')]=_0xe8e0e[_0x8c7e('0x8')];this['path']=_0x1447af['path'];this[_0x8c7e('0x9')]=_0x1447af[_0x8c7e('0x9')];}module['exports']=Action; \ No newline at end of file +var _0x04ab=['localstationid','headerinfo','path','AttachmentId','util','lodash','channel','format','%s/%s/%s','tech','Trunk','fax'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x04ab,0x118));var _0xb04a=function(_0x3bae71,_0xff59b7){_0x3bae71=_0x3bae71-0x0;var _0x18c770=_0x04ab[_0x3bae71];return _0x18c770;};'use strict';var util=require(_0xb04a('0x0'));var _=require(_0xb04a('0x1'));var moment=require('moment');function Action(_0x562bc4,_0x4eafff,_0x4a3762){this['uniqueid']=_0x562bc4||undefined;this[_0xb04a('0x2')]=util[_0xb04a('0x3')](_0xb04a('0x4'),_0x4eafff[_0xb04a('0x5')],_0x4eafff[_0xb04a('0x6')]['name'],_0x4a3762[_0xb04a('0x7')]);this[_0xb04a('0x8')]=_0x4eafff['localstationid'];this[_0xb04a('0x9')]=_0x4eafff['headerinfo'];this['path']=_0x4a3762[_0xb04a('0xa')];this[_0xb04a('0xb')]=_0x4a3762[_0xb04a('0xb')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 24fe145..aaf7c3a 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 _0xa99e=['[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Trunk','isValid','Trunk\x20Reachable','format','execute','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId'];(function(_0x18c9ed,_0x31132a){var _0xc245fa=function(_0x2c846f){while(--_0x2c846f){_0x18c9ed['push'](_0x18c9ed['shift']());}};_0xc245fa(++_0x31132a);}(_0xa99e,0x182));var _0xea99=function(_0x4db38c,_0x351db3){_0x4db38c=_0x4db38c-0x0;var _0xe83a7f=_0xa99e[_0x4db38c];return _0xe83a7f;};'use strict';var util=require(_0xea99('0x0'));var _=require(_0xea99('0x1'));var BPromise=require(_0xea99('0x2'));var uuid=require(_0xea99('0x3'));var moment=require(_0xea99('0x4'));var path=require(_0xea99('0x5'));var tiff2pdf=require(_0xea99('0x6'));var gs=require(_0xea99('0x7'));var logger=require(_0xea99('0x8'))('fax');var ami=require(_0xea99('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xea99('0xa'));var ut=require(_0xea99('0xb'));var Action=require(_0xea99('0xc'));var faxAccount=require(_0xea99('0xd'));var attachment=require(_0xea99('0xe'));var faxMessage=require(_0xea99('0xf'));function Fax(_0x2e78bc){this[_0xea99('0x10')]={};this[_0xea99('0x11')]=_0x2e78bc[_0xea99('0x11')];this[_0xea99('0x12')]=_0x2e78bc[_0xea99('0x12')];this[_0xea99('0x13')]={};ami['on'](_0xea99('0x14'),this['syncNewchannel'][_0xea99('0x15')](this));ami['on'](_0xea99('0x16'),this['syncVarSet'][_0xea99('0x15')](this));ami['on'](_0xea99('0x17'),this[_0xea99('0x18')][_0xea99('0x15')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xea99('0x19'),this[_0xea99('0x1a')][_0xea99('0x15')](this));ami['on'](_0xea99('0x1b'),this[_0xea99('0x1c')]['bind'](this));ami['on'](_0xea99('0x1d'),this[_0xea99('0x1e')][_0xea99('0x15')](this));ami['on'](_0xea99('0x1f'),this[_0xea99('0x20')][_0xea99('0x15')](this));}Fax['prototype'][_0xea99('0x21')]=function(_0xc145c5){if(_0xc145c5[_0xea99('0x22')]===_0xea99('0x23')){for(var _0x585481 in this[_0xea99('0x11')]){if(this[_0xea99('0x11')][_0xea99('0x24')](_0x585481)){if(_0xc145c5[_0xea99('0x25')]===this[_0xea99('0x11')][_0x585481][_0xea99('0x26')]){this['channels'][_0xc145c5[_0xea99('0x27')]]={};this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]['channel']=_0xc145c5[_0xea99('0x28')];this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]['id']=this[_0xea99('0x11')][_0x585481]['id'];this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]][_0xea99('0x29')]=this[_0xea99('0x11')][_0x585481]['name'];logger['info'](_0xc145c5[_0xea99('0x27')],_0xea99('0x2a'));}}}}if(this['actions'][_0xc145c5['uniqueid']]){this[_0xea99('0x10')][_0xc145c5[_0xea99('0x27')]]={};this['channels'][_0xc145c5[_0xea99('0x27')]]['channel']=_0xc145c5[_0xea99('0x28')];logger['info'](_0xc145c5[_0xea99('0x27')],_0xea99('0x2a'));}};Fax[_0xea99('0x2b')][_0xea99('0x2c')]=function(_0x97dba1){if(this['channels'][_0x97dba1[_0xea99('0x27')]]){for(var _0x502a23 in _0x97dba1['variable']){if(_0x97dba1[_0xea99('0x2d')][_0xea99('0x24')](_0x502a23)){this[_0xea99('0x10')][_0x97dba1[_0xea99('0x27')]][_0x502a23]=_0x97dba1[_0xea99('0x2e')];}}}};Fax[_0xea99('0x2b')][_0xea99('0x18')]=function(_0x5d996d){if(this[_0xea99('0x10')][_0x5d996d[_0xea99('0x27')]]){this[_0xea99('0x10')][_0x5d996d[_0xea99('0x27')]][_0xea99('0x2f')]=_0x5d996d[_0xea99('0x2f')];this['channels'][_0x5d996d[_0xea99('0x27')]][_0xea99('0x30')]=_0x5d996d[_0xea99('0x30')];}};Fax[_0xea99('0x2b')][_0xea99('0x31')]=function(_0x1332bc){if(this['channels'][_0x1332bc[_0xea99('0x27')]]){for(var _0x373bb5 in _0x1332bc[_0xea99('0x2d')]){if(_0x1332bc['variable']['hasOwnProperty'](_0x373bb5)){this[_0xea99('0x10')][_0x1332bc[_0xea99('0x27')]][_0x373bb5]=_0x1332bc[_0xea99('0x2e')];}}}};Fax['prototype'][_0xea99('0x1a')]=function(_0x3d4e6d){if(this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]){this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]['operation']=_0x3d4e6d[_0xea99('0x32')];this[_0xea99('0x10')][_0x3d4e6d['uniqueid']][_0xea99('0x33')]=_0x3d4e6d[_0xea99('0x33')];this[_0xea99('0x10')][_0x3d4e6d[_0xea99('0x27')]]['localstationid']=_0x3d4e6d[_0xea99('0x26')];this['channels'][_0x3d4e6d[_0xea99('0x27')]][_0xea99('0x34')]=_0x3d4e6d[_0xea99('0x34')];logger['info'](_0x3d4e6d[_0xea99('0x27')],_0xea99('0x35'));}};Fax[_0xea99('0x2b')][_0xea99('0x1c')]=function(_0x1ec540){var _0x1dc34a=this;if(this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]){var _0x267720=this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['id'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['remotestationid']=_0x1ec540['remotestationid'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x36')]=_0x1ec540[_0xea99('0x36')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x26')]=_0x1ec540[_0xea99('0x26')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x37')]=_0x1ec540[_0xea99('0x37')];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]][_0xea99('0x38')]=_0x1ec540['transferrate'];this[_0xea99('0x10')][_0x1ec540[_0xea99('0x27')]]['filename']=_0x1ec540[_0xea99('0x34')];this['channels'][_0x1ec540['uniqueid']][_0xea99('0x39')]=_0x1ec540['calleridnum'];if(this[_0xea99('0x10')][_0x1ec540['uniqueid']][_0xea99('0x36')]>0x0){tiff2pdf(_0x1ec540[_0xea99('0x34')],_0xea99('0x3a'),function(_0x3f97de){logger[_0xea99('0x3b')](_0x1ec540[_0xea99('0x27')],'\x20result\x20conversion\x20file\x20',_0x3f97de['message']);attachment[_0xea99('0x3c')]({'name':path[_0xea99('0x3d')](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')],'basename':path[_0xea99('0x3d')](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')]+_0xea99('0x3e'),'type':_0xea99('0x3f')})['then'](function(_0x2afc5b){faxAccount[_0xea99('0x40')](_0x267720,{'from':_0x1ec540[_0xea99('0x39')],'mapKey':_0xea99('0x41'),'body':path['parse'](_0x1ec540[_0xea99('0x34')])[_0xea99('0x29')]+'.pdf','AttachmentId':_0x2afc5b['id']})[_0xea99('0x42')](function(_0x23e3d4){logger[_0xea99('0x43')](_0x1ec540['uniqueid'],_0xea99('0x44'),JSON[_0xea99('0x45')](_0x23e3d4));});})[_0xea99('0x42')](function(_0x1a195b){logger[_0xea99('0x43')](_0x1ec540[_0xea99('0x27')],_0xea99('0x46'),JSON[_0xea99('0x45')](_0x1a195b));});});}logger[_0xea99('0x3b')](_0x1ec540['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0xea99('0x20')]=function(_0x47e30f){if(this[_0xea99('0x13')][_0x47e30f[_0xea99('0x27')]]){_['merge'](this[_0xea99('0x10')][_0x47e30f[_0xea99('0x27')]],_[_0xea99('0x47')](_0x47e30f,[_0xea99('0x48'),_0xea99('0x49')]));}};function updateStatus(_0x128c46){if(_0x128c46[_0xea99('0x4a')]){faxMessage[_0xea99('0x4b')](_0x128c46[_0xea99('0x4a')],{'failMessage':_0xea99('0x4c')})[_0xea99('0x4d')](function(_0x1a61ce){ut['logger'](_0xea99('0x4e'),_0x1a61ce);})['catch'](function(_0x1e2d78){ut[_0xea99('0x4f')](_0xea99('0x50'),_0x1e2d78);});}else{ut['logger'](_0xea99('0x51'));}}Fax[_0xea99('0x2b')][_0xea99('0x52')]=function(_0x4bf6bf,_0x3ccf40,_0x51f249){var _0x3f3317=this;var _0x32da68={};if(_0x3ccf40){_0x32da68={'read':_0x3ccf40};}else{_0x32da68={'failMessage':_0x51f249};}if(this[_0xea99('0x13')][_0x4bf6bf][_0xea99('0x4a')]){faxMessage[_0xea99('0x4b')](this[_0xea99('0x13')][_0x4bf6bf][_0xea99('0x4a')],_0x32da68)[_0xea99('0x4d')](function(_0x4b0c0c){ut[_0xea99('0x4f')](_0xea99('0x53'),_0x4b0c0c);})[_0xea99('0x42')](function(_0x14bb4d){ut[_0xea99('0x4f')]('[Fax][Message][NoUpdate1]',_0x14bb4d);})[_0xea99('0x54')](function(){delete _0x3f3317['channels'][_0x4bf6bf];delete _0x3f3317[_0xea99('0x13')][_0x4bf6bf];});}else{ut[_0xea99('0x4f')]('[Fax][Message][NoUpdate2]');delete this[_0xea99('0x10')][_0x4bf6bf];delete this['actions'][_0x4bf6bf];}};Fax['prototype'][_0xea99('0x1e')]=function(_0x45fa46){var _0x2a2bb6=this;if(this[_0xea99('0x10')][_0x45fa46['uniqueid']]){if(this[_0xea99('0x13')][_0x45fa46[_0xea99('0x27')]]){this['channels'][_0x45fa46[_0xea99('0x27')]]['id']=this['actions'][_0x45fa46[_0xea99('0x27')]]['id'];this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['name']=this[_0xea99('0x13')][_0x45fa46['uniqueid']][_0xea99('0x29')];}logger[_0xea99('0x3b')](_0x45fa46[_0xea99('0x27')],this['actions'][_0x45fa46[_0xea99('0x27')]]?_0xea99('0x55'):_0xea99('0x56'),JSON[_0xea99('0x45')](this['channels'][_0x45fa46[_0xea99('0x27')]]));if(this[_0xea99('0x13')][_0x45fa46['uniqueid']]){if(this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['faxpages']>0x0&&this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]]['faxstatus']===_0xea99('0x57')){this['updateStatus'](_0x45fa46['uniqueid'],!![]);}else{this[_0xea99('0x52')](_0x45fa46[_0xea99('0x27')],![],this['channels'][_0x45fa46[_0xea99('0x27')]][_0xea99('0x58')]?_0xea99('0x59')+this[_0xea99('0x10')][_0x45fa46[_0xea99('0x27')]][_0xea99('0x58')]:_0xea99('0x5a'));}}}};Fax[_0xea99('0x2b')][_0xea99('0x5b')]=function(_0x3229e2){var _0xdd67fc=this;return new BPromise(function(_0x42a508,_0x40c4a8){_0xdd67fc[_0xea99('0x5c')](_0x3229e2,_0xdd67fc[_0xea99('0x11')][_0x3229e2[_0xea99('0x5d')]])[_0xea99('0x4d')](function(_0x1679e5){ut[_0xea99('0x4f')](_0xea99('0x5e'),_0x1679e5);_0x42a508(ut['message'](_0xea99('0x5f')));})['catch'](function(_0x38a23b){ut[_0xea99('0x4f')](_0xea99('0x60'),_0x38a23b);updateStatus(_0x3229e2);_0x40c4a8(ut[_0xea99('0x61')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x548e74){var _0xe180ba=this;return new BPromise(function(_0x218303,_0x631a80){var _0x28873e=_0xe180ba['checkTrunk'](_0xe180ba[_0xea99('0x11')][_0x548e74[_0xea99('0x5d')]][_0xea99('0x62')],_0x548e74);if(_0x28873e[_0xea99('0x63')]){_0x218303(ut[_0xea99('0x61')](_0xea99('0x64')));}else{_0x631a80(ut[_0xea99('0x61')](_0x28873e[_0xea99('0x61')]));}});};function originate(_0x5b623c,_0x5b7fe1,_0x3552e9){return new BPromise(function(_0x3e257c,_0x542727){if(_0x3552e9){var _0x2a913d=util[_0xea99('0x65')]('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[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x29')],_0x5b623c[_0xea99('0x5')]);gs[_0xea99('0x66')](_0x2a913d)[_0xea99('0x4d')](function(){_0x5b623c[_0xea99('0x5')]=util[_0xea99('0x65')]('%s/%s.tif',path[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x67')],path[_0xea99('0x3d')](_0x5b623c[_0xea99('0x5')])[_0xea99('0x29')]);_0x5b7fe1[_0xea99('0x68')]=_0x5b623c['path'];ut[_0xea99('0x4f')]('Convert\x20pdf\x20to\x20tif','');ami[_0xea99('0x69')](ut[_0xea99('0x6a')](_0x5b623c,_0x5b7fe1))[_0xea99('0x4d')](function(_0x12b6d6){_0x3e257c(_0x12b6d6);})['catch'](function(_0x4ded73){_0x542727(_0x4ded73);});})[_0xea99('0x42')](function(_0xdfe208){_0x542727(_0xdfe208);});}else{ami[_0xea99('0x69')](ut[_0xea99('0x6a')](_0x5b623c,_0x5b7fe1))[_0xea99('0x4d')](function(_0x575b6f){_0x3e257c(_0x575b6f);})[_0xea99('0x42')](function(_0x1a9b63){_0x542727(_0x1a9b63);});}});}Fax['prototype'][_0xea99('0x5c')]=function(_0x4b0ef7,_0x2f6848){var _0x5df70e=this;return new BPromise(function(_0x20f090,_0x563c5f){var _0x5521e2=uuid['v4']();var _0x1d81c8=ut[_0xea99('0x6b')](_0x4b0ef7,_0x2f6848);_0x5df70e[_0xea99('0x13')][_0x5521e2]=new Action(_0x5521e2,_0x2f6848,_0x4b0ef7);var _0x3a7e04=_0x5df70e['actions'][_0x5521e2];if(path[_0xea99('0x3d')](_0x4b0ef7[_0xea99('0x5')])[_0xea99('0x6c')]===_0xea99('0x3e')){originate(_0x3a7e04,_0x1d81c8,!![])[_0xea99('0x4d')](function(_0x20a804){_0x20f090(_0x20a804);})['catch'](function(_0x535470){_0x563c5f(_0x535470);});}else{originate(_0x3a7e04,_0x1d81c8,![])[_0xea99('0x4d')](function(_0x1993f1){_0x20f090(_0x1993f1);})[_0xea99('0x42')](function(_0x258129){_0x563c5f(_0x258129);});}});};Fax[_0xea99('0x2b')]['isTrunkReachable']=function(_0x21895a){return!_[_0xea99('0x6d')](_0x21895a)&&!_['isNil'](_0x21895a[_0xea99('0x29')])&&!_['isNil'](_0x21895a[_0xea99('0x6e')])&&_0x21895a[_0xea99('0x6e')]&&!_[_0xea99('0x6d')](this['trunks'][util[_0xea99('0x65')](_0xea99('0x6f'),_0x21895a[_0xea99('0x29')])])&&!_[_0xea99('0x6d')](this[_0xea99('0x12')][util['format'](_0xea99('0x6f'),_0x21895a[_0xea99('0x29')])][_0xea99('0x33')])&&(this['trunks'][util[_0xea99('0x65')](_0xea99('0x6f'),_0x21895a['name'])][_0xea99('0x33')]===_0xea99('0x70')||this[_0xea99('0x12')][util['format'](_0xea99('0x6f'),_0x21895a['name'])][_0xea99('0x33')]==='unmonitored');};Fax[_0xea99('0x2b')]['checkTrunk']=function(_0x52ed80,_0x2f418c){if(!this['isTrunkReachable'](_0x52ed80)){ut[_0xea99('0x4f')](_0xea99('0x71'),_[_0xea99('0x6d')](_0x52ed80)?'':_0x52ed80[_0xea99('0x29')]+_0xea99('0x72'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x2f418c['fax'])){ut['logger'](_0xea99('0x73'),JSON[_0xea99('0x45')](_0x2f418c));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2f418c[_0xea99('0x5')])){ut[_0xea99('0x4f')](_0xea99('0x74'),JSON[_0xea99('0x45')](_0x2f418c));return{'isValid':![],'message':_0xea99('0x75')};}return{'isValid':!![],'message':_0xea99('0x76')};};module[_0xea99('0x77')]=Fax; \ No newline at end of file +var _0xe813=['operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','parse','.pdf','application/pdf','fax','catch','error','\x20notify\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','syncNewState','newexten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus'];(function(_0x20d7cd,_0xad7628){var _0x38adaf=function(_0x10a5de){while(--_0x10a5de){_0x20d7cd['push'](_0x20d7cd['shift']());}};_0x38adaf(++_0xad7628);}(_0xe813,0x196));var _0x3e81=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0xe813[_0x4fa2da];return _0xd6958a;};'use strict';var util=require('util');var _=require(_0x3e81('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require(_0x3e81('0x1'));var tiff2pdf=require(_0x3e81('0x2'));var gs=require('./util/gs');var logger=require(_0x3e81('0x3'))('fax');var ami=require(_0x3e81('0x4'));var rpcDb=require(_0x3e81('0x5'));var Channel=require('./channel');var ut=require(_0x3e81('0x6'));var Action=require(_0x3e81('0x7'));var faxAccount=require(_0x3e81('0x8'));var attachment=require(_0x3e81('0x9'));var faxMessage=require(_0x3e81('0xa'));function Fax(_0x4e2450){this[_0x3e81('0xb')]={};this[_0x3e81('0xc')]=_0x4e2450['faxAccounts'];this[_0x3e81('0xd')]=_0x4e2450[_0x3e81('0xd')];this['actions']={};ami['on'](_0x3e81('0xe'),this['syncNewchannel']['bind'](this));ami['on'](_0x3e81('0xf'),this[_0x3e81('0x10')][_0x3e81('0x11')](this));ami['on']('newstate',this[_0x3e81('0x12')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x13'),this['syncNewExten'][_0x3e81('0x11')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x3e81('0x14'),this[_0x3e81('0x15')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x16'),this[_0x3e81('0x17')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x18'),this[_0x3e81('0x19')][_0x3e81('0x11')](this));}Fax['prototype']['syncNewchannel']=function(_0x271250){if(_0x271250['context']==='from-voip-provider'){for(var _0x195cd8 in this['faxAccounts']){if(this[_0x3e81('0xc')][_0x3e81('0x1a')](_0x195cd8)){if(_0x271250[_0x3e81('0x1b')]===this[_0x3e81('0xc')][_0x195cd8][_0x3e81('0x1c')]){this[_0x3e81('0xb')][_0x271250['uniqueid']]={};this[_0x3e81('0xb')][_0x271250['uniqueid']][_0x3e81('0x1d')]=_0x271250[_0x3e81('0x1d')];this[_0x3e81('0xb')][_0x271250[_0x3e81('0x1e')]]['id']=this[_0x3e81('0xc')][_0x195cd8]['id'];this[_0x3e81('0xb')][_0x271250['uniqueid']][_0x3e81('0x1f')]=this[_0x3e81('0xc')][_0x195cd8]['name'];logger[_0x3e81('0x20')](_0x271250[_0x3e81('0x1e')],_0x3e81('0x21'));}}}}if(this[_0x3e81('0x22')][_0x271250[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x271250['uniqueid']]={};this[_0x3e81('0xb')][_0x271250[_0x3e81('0x1e')]]['channel']=_0x271250['channel'];logger[_0x3e81('0x20')](_0x271250[_0x3e81('0x1e')],_0x3e81('0x21'));}};Fax[_0x3e81('0x23')][_0x3e81('0x10')]=function(_0xe3c060){if(this['channels'][_0xe3c060[_0x3e81('0x1e')]]){for(var _0x52be13 in _0xe3c060[_0x3e81('0x24')]){if(_0xe3c060[_0x3e81('0x24')][_0x3e81('0x1a')](_0x52be13)){this[_0x3e81('0xb')][_0xe3c060['uniqueid']][_0x52be13]=_0xe3c060[_0x3e81('0x25')];}}}};Fax[_0x3e81('0x23')]['syncNewState']=function(_0x1875a3){if(this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]][_0x3e81('0x26')]=_0x1875a3[_0x3e81('0x26')];this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]][_0x3e81('0x27')]=_0x1875a3[_0x3e81('0x27')];}};Fax['prototype'][_0x3e81('0x28')]=function(_0x58977f){if(this[_0x3e81('0xb')][_0x58977f[_0x3e81('0x1e')]]){for(var _0x16836a in _0x58977f[_0x3e81('0x24')]){if(_0x58977f[_0x3e81('0x24')]['hasOwnProperty'](_0x16836a)){this[_0x3e81('0xb')][_0x58977f['uniqueid']][_0x16836a]=_0x58977f[_0x3e81('0x25')];}}}};Fax['prototype'][_0x3e81('0x29')]=function(_0x4fb9a4){if(this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2a')]=_0x4fb9a4['operation'];this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2b')]=_0x4fb9a4['status'];this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x1c')]=_0x4fb9a4[_0x3e81('0x1c')];this['channels'][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2c')]=_0x4fb9a4[_0x3e81('0x2c')];logger[_0x3e81('0x20')](_0x4fb9a4[_0x3e81('0x1e')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x3e81('0x15')]=function(_0x44bce1){var _0x15f658=this;if(this['channels'][_0x44bce1[_0x3e81('0x1e')]]){var _0x3829ca=this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]]['id'];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2d')]=_0x44bce1[_0x3e81('0x2d')];this[_0x3e81('0xb')][_0x44bce1['uniqueid']]['pagestransferred']=_0x44bce1[_0x3e81('0x2e')];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x1c')]=_0x44bce1[_0x3e81('0x1c')];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2f')]=_0x44bce1['resolution'];this['channels'][_0x44bce1['uniqueid']][_0x3e81('0x30')]=_0x44bce1['transferrate'];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2c')]=_0x44bce1[_0x3e81('0x2c')];this[_0x3e81('0xb')][_0x44bce1['uniqueid']][_0x3e81('0x31')]=_0x44bce1[_0x3e81('0x31')];if(this[_0x3e81('0xb')][_0x44bce1['uniqueid']][_0x3e81('0x2e')]>0x0){tiff2pdf(_0x44bce1[_0x3e81('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x2801bb){logger[_0x3e81('0x20')](_0x44bce1[_0x3e81('0x1e')],'\x20result\x20conversion\x20file\x20',_0x2801bb[_0x3e81('0x32')]);attachment['create']({'name':path[_0x3e81('0x33')](_0x44bce1['filename'])[_0x3e81('0x1f')],'basename':path[_0x3e81('0x33')](_0x44bce1[_0x3e81('0x2c')])[_0x3e81('0x1f')]+_0x3e81('0x34'),'type':_0x3e81('0x35')})['then'](function(_0x4b379b){faxAccount['notify'](_0x3829ca,{'from':_0x44bce1[_0x3e81('0x31')],'mapKey':_0x3e81('0x36'),'body':path[_0x3e81('0x33')](_0x44bce1[_0x3e81('0x2c')])[_0x3e81('0x1f')]+_0x3e81('0x34'),'AttachmentId':_0x4b379b['id']})[_0x3e81('0x37')](function(_0xb92510){logger[_0x3e81('0x38')](_0x44bce1['uniqueid'],_0x3e81('0x39'),JSON[_0x3e81('0x3a')](_0xb92510));});})[_0x3e81('0x37')](function(_0x8edc4d){logger[_0x3e81('0x38')](_0x44bce1[_0x3e81('0x1e')],'\x20receiveFax\x20',JSON[_0x3e81('0x3a')](_0x8edc4d));});});}logger['info'](_0x44bce1[_0x3e81('0x1e')],'\x20receiveFax\x20');}};Fax[_0x3e81('0x23')][_0x3e81('0x19')]=function(_0x3b9b85){if(this[_0x3e81('0x22')][_0x3b9b85[_0x3e81('0x1e')]]){_[_0x3e81('0x3b')](this[_0x3e81('0xb')][_0x3b9b85['uniqueid']],_[_0x3e81('0x3c')](_0x3b9b85,['response',_0x3e81('0x3d')]));}};function updateStatus(_0x2b4c69){if(_0x2b4c69[_0x3e81('0x3e')]){faxMessage[_0x3e81('0x3f')](_0x2b4c69[_0x3e81('0x3e')],{'failMessage':_0x3e81('0x40')})[_0x3e81('0x41')](function(_0x40cd11){ut['logger'](_0x3e81('0x42'),_0x40cd11);})[_0x3e81('0x37')](function(_0x49843b){ut[_0x3e81('0x43')]('[Fax][Message][Error][NoUpdate1]',_0x49843b);});}else{ut['logger'](_0x3e81('0x44'));}}Fax[_0x3e81('0x23')][_0x3e81('0x45')]=function(_0x1f52bc,_0x7f99bc,_0x5db4a2){var _0x464bfe=this;var _0x367287={};if(_0x7f99bc){_0x367287={'read':_0x7f99bc};}else{_0x367287={'failMessage':_0x5db4a2};}if(this[_0x3e81('0x22')][_0x1f52bc][_0x3e81('0x3e')]){faxMessage['update'](this[_0x3e81('0x22')][_0x1f52bc][_0x3e81('0x3e')],_0x367287)[_0x3e81('0x41')](function(_0x81fea0){ut['logger'](_0x3e81('0x46'),_0x81fea0);})[_0x3e81('0x37')](function(_0x1d6d1d){ut['logger'](_0x3e81('0x47'),_0x1d6d1d);})[_0x3e81('0x48')](function(){delete _0x464bfe[_0x3e81('0xb')][_0x1f52bc];delete _0x464bfe[_0x3e81('0x22')][_0x1f52bc];});}else{ut[_0x3e81('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0x3e81('0xb')][_0x1f52bc];delete this[_0x3e81('0x22')][_0x1f52bc];}};Fax[_0x3e81('0x23')][_0x3e81('0x17')]=function(_0x558cc9){var _0x499609=this;if(this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]){if(this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x558cc9['uniqueid']]['id']=this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]['id'];this['channels'][_0x558cc9['uniqueid']][_0x3e81('0x1f')]=this['actions'][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x1f')];}logger['info'](_0x558cc9[_0x3e81('0x1e')],this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]?_0x3e81('0x49'):_0x3e81('0x4a'),JSON[_0x3e81('0x3a')](this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]));if(this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]){if(this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]['faxpages']>0x0&&this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x4b')]===_0x3e81('0x4c')){this['updateStatus'](_0x558cc9[_0x3e81('0x1e')],!![]);}else{this[_0x3e81('0x45')](_0x558cc9['uniqueid'],![],this[_0x3e81('0xb')][_0x558cc9['uniqueid']][_0x3e81('0x4d')]?_0x3e81('0x4e')+this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x4d')]:_0x3e81('0x4f'));}}}};Fax[_0x3e81('0x23')]['send']=function(_0x18104c){var _0x56d034=this;return new BPromise(function(_0x3cadf5,_0x2bcec0){_0x56d034[_0x3e81('0x50')](_0x18104c,_0x56d034[_0x3e81('0xc')][_0x18104c['FaxAccountId']])[_0x3e81('0x41')](function(_0x2dad76){ut[_0x3e81('0x43')]('[Fax][execOriginate][success]',_0x2dad76);_0x3cadf5(ut[_0x3e81('0x32')](_0x3e81('0x51')));})[_0x3e81('0x37')](function(_0xd9ba){ut[_0x3e81('0x43')](_0x3e81('0x52'),_0xd9ba);updateStatus(_0x18104c);_0x2bcec0(ut['message'](_0x3e81('0x53')));});});};Fax[_0x3e81('0x23')][_0x3e81('0x54')]=function(_0x3b94d1){var _0x44f4d5=this;return new BPromise(function(_0x1d992c,_0x5834fd){var _0x5cb669=_0x44f4d5[_0x3e81('0x55')](_0x44f4d5[_0x3e81('0xc')][_0x3b94d1[_0x3e81('0x56')]][_0x3e81('0x57')],_0x3b94d1);if(_0x5cb669[_0x3e81('0x58')]){_0x1d992c(ut[_0x3e81('0x32')](_0x3e81('0x59')));}else{_0x5834fd(ut[_0x3e81('0x32')](_0x5cb669[_0x3e81('0x32')]));}});};function originate(_0x2b1e30,_0x33d54a,_0x3a09d8){return new BPromise(function(_0x39b2ec,_0x2c0c7a){if(_0x3a09d8){var _0x25ea5f=util['format'](_0x3e81('0x5a'),path[_0x3e81('0x33')](_0x2b1e30['path'])[_0x3e81('0x1f')],_0x2b1e30[_0x3e81('0x1')]);gs['execute'](_0x25ea5f)[_0x3e81('0x41')](function(){_0x2b1e30[_0x3e81('0x1')]=util[_0x3e81('0x5b')](_0x3e81('0x5c'),path[_0x3e81('0x33')](_0x2b1e30[_0x3e81('0x1')])[_0x3e81('0x5d')],path[_0x3e81('0x33')](_0x2b1e30['path'])[_0x3e81('0x1f')]);_0x33d54a[_0x3e81('0x5e')]=_0x2b1e30[_0x3e81('0x1')];ut[_0x3e81('0x43')](_0x3e81('0x5f'),'');ami[_0x3e81('0x60')](ut[_0x3e81('0x61')](_0x2b1e30,_0x33d54a))[_0x3e81('0x41')](function(_0x5e390b){_0x39b2ec(_0x5e390b);})[_0x3e81('0x37')](function(_0x3c43d2){_0x2c0c7a(_0x3c43d2);});})[_0x3e81('0x37')](function(_0x5dff69){_0x2c0c7a(_0x5dff69);});}else{ami[_0x3e81('0x60')](ut[_0x3e81('0x61')](_0x2b1e30,_0x33d54a))[_0x3e81('0x41')](function(_0x7b9c13){_0x39b2ec(_0x7b9c13);})['catch'](function(_0x53b8ac){_0x2c0c7a(_0x53b8ac);});}});}Fax[_0x3e81('0x23')][_0x3e81('0x50')]=function(_0x19ef08,_0xd1b4b2){var _0x352c58=this;return new BPromise(function(_0x50a12a,_0x285b75){var _0x775a10=uuid['v4']();var _0x410d4a=ut[_0x3e81('0x62')](_0x19ef08,_0xd1b4b2);_0x352c58[_0x3e81('0x22')][_0x775a10]=new Action(_0x775a10,_0xd1b4b2,_0x19ef08);var _0x3bf251=_0x352c58[_0x3e81('0x22')][_0x775a10];if(path[_0x3e81('0x33')](_0x19ef08[_0x3e81('0x1')])[_0x3e81('0x63')]===_0x3e81('0x34')){originate(_0x3bf251,_0x410d4a,!![])[_0x3e81('0x41')](function(_0x2d32bb){_0x50a12a(_0x2d32bb);})[_0x3e81('0x37')](function(_0x1e71e6){_0x285b75(_0x1e71e6);});}else{originate(_0x3bf251,_0x410d4a,![])[_0x3e81('0x41')](function(_0x4142bc){_0x50a12a(_0x4142bc);})[_0x3e81('0x37')](function(_0x4bbf5d){_0x285b75(_0x4bbf5d);});}});};Fax[_0x3e81('0x23')]['isTrunkReachable']=function(_0x1b7816){return!_[_0x3e81('0x64')](_0x1b7816)&&!_[_0x3e81('0x64')](_0x1b7816[_0x3e81('0x1f')])&&!_[_0x3e81('0x64')](_0x1b7816[_0x3e81('0x65')])&&_0x1b7816[_0x3e81('0x65')]&&!_[_0x3e81('0x64')](this[_0x3e81('0xd')][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])])&&!_[_0x3e81('0x64')](this['trunks'][util[_0x3e81('0x5b')]('SIP/%s',_0x1b7816[_0x3e81('0x1f')])]['status'])&&(this[_0x3e81('0xd')][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])][_0x3e81('0x2b')]===_0x3e81('0x67')||this['trunks'][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])][_0x3e81('0x2b')]==='unmonitored');};Fax[_0x3e81('0x23')][_0x3e81('0x55')]=function(_0x2bbdc1,_0x3d0a16){if(!this[_0x3e81('0x68')](_0x2bbdc1)){ut[_0x3e81('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x2bbdc1)?'':_0x2bbdc1[_0x3e81('0x1f')]+_0x3e81('0x69'));return{'isValid':![],'message':_0x3e81('0x6a')};}if(_[_0x3e81('0x64')](_0x3d0a16[_0x3e81('0x36')])){ut['logger'](_0x3e81('0x6b'),JSON[_0x3e81('0x3a')](_0x3d0a16));return{'isValid':![],'message':_0x3e81('0x6c')};}if(_[_0x3e81('0x64')](_0x3d0a16[_0x3e81('0x1')])){ut[_0x3e81('0x43')](_0x3e81('0x6d'),JSON[_0x3e81('0x3a')](_0x3d0a16));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3e81('0x6e')};};module[_0x3e81('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3062917..25bc7ed 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 _0xed2a=['util','bluebird','../../../config/logger','preview','error','inspect','notify','resolve','then','[Notify]\x20'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0xed2a,0x1e0));var _0xaed2=function(_0x3d6911,_0x45449d){_0x3d6911=_0x3d6911-0x0;var _0x46aed8=_0xed2a[_0x3d6911];return _0x46aed8;};'use strict';var util=require(_0xaed2('0x0'));var BPromise=require(_0xaed2('0x1'));var logger=require(_0xaed2('0x2'))(_0xaed2('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1d9ec3){return function(_0x4f33ae){logger[_0xaed2('0x4')](_0x1d9ec3,util[_0xaed2('0x5')](_0x4f33ae,{'showHidden':![],'depth':null}));};}exports[_0xaed2('0x6')]=function(_0x3546da,_0x5d3d61){return BPromise[_0xaed2('0x7')]()[_0xaed2('0x8')](faxAccount['notify'](_0x3546da,_0x5d3d61))['catch'](loggerCatch(_0xaed2('0x9')));}; \ No newline at end of file +var _0x4885=['catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify'];(function(_0x5e570d,_0x1e64c4){var _0x1fa58c=function(_0x1c07fc){while(--_0x1c07fc){_0x5e570d['push'](_0x5e570d['shift']());}};_0x1fa58c(++_0x1e64c4);}(_0x4885,0x1a0));var _0x5488=function(_0x55100,_0x57cc94){_0x55100=_0x55100-0x0;var _0x5b0579=_0x4885[_0x55100];return _0x5b0579;};'use strict';var util=require(_0x5488('0x0'));var BPromise=require(_0x5488('0x1'));var logger=require(_0x5488('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x5488('0x3'));function loggerCatch(_0x388307){return function(_0x1b5704){logger[_0x5488('0x4')](_0x388307,util[_0x5488('0x5')](_0x1b5704,{'showHidden':![],'depth':null}));};}exports[_0x5488('0x6')]=function(_0x6be4b7,_0x507ae8){return BPromise['resolve']()['then'](faxAccount[_0x5488('0x6')](_0x6be4b7,_0x507ae8))[_0x5488('0x7')](loggerCatch(_0x5488('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index b37ad2d..053b0ba 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 _0xab7a=['inspect','util','bluebird','child_process','execute','Exec\x20gs'];(function(_0x262c58,_0x1e78b8){var _0x22f896=function(_0x4e2176){while(--_0x4e2176){_0x262c58['push'](_0x262c58['shift']());}};_0x22f896(++_0x1e78b8);}(_0xab7a,0x67));var _0xaab7=function(_0x484209,_0x202d7d){_0x484209=_0x484209-0x0;var _0x5cc99f=_0xab7a[_0x484209];return _0x5cc99f;};'use strict';var util=require(_0xaab7('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xaab7('0x1'));var exec=require(_0xaab7('0x2'))['exec'];exports[_0xaab7('0x3')]=function(_0x114653){return new BPromise(function(_0x131c26,_0x3657e0){exec(_0x114653,function(_0xb8931d,_0x48147b,_0x21e4e6){logger['info'](_0xaab7('0x4'),_0x48147b);if(_0xb8931d){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0xaab7('0x5')](_0xb8931d,{'showHidden':![],'depth':null}),_0x48147b,_0x21e4e6);_0x3657e0(_0xb8931d);}_0x131c26(_0x48147b);});});}; \ No newline at end of file +var _0x42ec=['bluebird','exec','info','\x20Error\x20:','../../../../config/logger'];(function(_0x315cf0,_0x39fea6){var _0x2133cd=function(_0x3592fe){while(--_0x3592fe){_0x315cf0['push'](_0x315cf0['shift']());}};_0x2133cd(++_0x39fea6);}(_0x42ec,0x185));var _0xc42e=function(_0x560878,_0x74152f){_0x560878=_0x560878-0x0;var _0x43572f=_0x42ec[_0x560878];return _0x43572f;};'use strict';var util=require('util');var logger=require(_0xc42e('0x0'))('fax');var BPromise=require(_0xc42e('0x1'));var exec=require('child_process')[_0xc42e('0x2')];exports['execute']=function(_0x588121){return new BPromise(function(_0x255ef1,_0x16db1f){exec(_0x588121,function(_0xdc6d0,_0x50a790,_0x386c64){logger[_0xc42e('0x3')]('Exec\x20gs',_0x50a790);if(_0xdc6d0){logger[_0xc42e('0x3')]('Exec\x20gs',_0xc42e('0x4'),util['inspect'](_0xdc6d0,{'showHidden':![],'depth':null}),_0x50a790,_0x386c64);_0x16db1f(_0xdc6d0);}_0x255ef1(_0x50a790);});});}; \ 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 c79fb36..8b8eead 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 _0xb903=['minrate','maxrate','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo'];(function(_0x39d1d3,_0x55a11f){var _0x54ce17=function(_0x595b32){while(--_0x595b32){_0x39d1d3['push'](_0x39d1d3['shift']());}};_0x54ce17(++_0x55a11f);}(_0xb903,0x185));var _0x3b90=function(_0x1232e3,_0x57f194){_0x1232e3=_0x1232e3-0x0;var _0x1b9a1d=_0xb903[_0x1232e3];return _0x1b9a1d;};'use strict';var util=require(_0x3b90('0x0'));var _=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('fax');exports[_0x3b90('0x4')]=function(_0xf414f4){return{'message':_0xf414f4};};exports[_0x3b90('0x5')]=function(_0x1cd5d8,_0x30d8db){logger[_0x3b90('0x6')](_0x1cd5d8,util[_0x3b90('0x7')](_0x30d8db,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x15b68f,_0x5e845a){var _0x55792c={'XMF-ECM':_0x5e845a[_0x3b90('0x8')],'XMF-HEADERINFO':_0x5e845a[_0x3b90('0x9')],'XMF-MINRATE':_0x5e845a[_0x3b90('0xa')],'XMF-MAXRATE':_0x5e845a[_0x3b90('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x5e845a['modem']),'XMF-GATEWAY':_0x5e845a['gateway'],'XMF-FAXDETECT':_0x5e845a['faxdetect'],'XMF-T38TIMEOUT':_0x5e845a['t38timeout'],'XMF-LOCALSTATIONID':_0x5e845a[_0x3b90('0xc')],'XMF-PATH':_0x15b68f[_0x3b90('0xd')]};return _0x55792c;};exports['variablesAction']=function(_0x30c49c,_0x233509){return{'actionid':_0x30c49c['uniqueid'],'action':_0x3b90('0xe'),'channel':_0x30c49c[_0x3b90('0xf')],'Exten':_0x3b90('0x10'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x3b90('0x11'),_0x30c49c['headerinfo']?_0x30c49c['headerinfo']:'',_0x30c49c[_0x3b90('0xc')]),'variable':_0x233509,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x30c49c[_0x3b90('0x12')]};}; \ No newline at end of file +var _0xda55=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xda55,0x6d));var _0x5da5=function(_0x28896a,_0x4dc100){_0x28896a=_0x28896a-0x0;var _0x5a4f2b=_0xda55[_0x28896a];return _0x5a4f2b;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x5da5('0x2'));exports[_0x5da5('0x3')]=function(_0x26a443){return{'message':_0x26a443};};exports[_0x5da5('0x4')]=function(_0x1c3afd,_0x5da254){logger[_0x5da5('0x5')](_0x1c3afd,util['inspect'](_0x5da254,{'showHidden':![],'depth':null}));};exports[_0x5da5('0x6')]=function(_0x58e7b3,_0x2fd877){var _0x267469={'XMF-ECM':_0x2fd877[_0x5da5('0x7')],'XMF-HEADERINFO':_0x2fd877[_0x5da5('0x8')],'XMF-MINRATE':_0x2fd877[_0x5da5('0x9')],'XMF-MAXRATE':_0x2fd877[_0x5da5('0xa')],'XMF-MODEM':util[_0x5da5('0xb')](_0x5da5('0xc'),_0x2fd877['modem']),'XMF-GATEWAY':_0x2fd877[_0x5da5('0xd')],'XMF-FAXDETECT':_0x2fd877[_0x5da5('0xe')],'XMF-T38TIMEOUT':_0x2fd877[_0x5da5('0xf')],'XMF-LOCALSTATIONID':_0x2fd877[_0x5da5('0x10')],'XMF-PATH':_0x58e7b3[_0x5da5('0x11')]};return _0x267469;};exports[_0x5da5('0x12')]=function(_0x33313e,_0x589c14){return{'actionid':_0x33313e[_0x5da5('0x13')],'action':_0x5da5('0x14'),'channel':_0x33313e['channel'],'Exten':_0x5da5('0x15'),'Context':_0x5da5('0x16'),'Priority':'1','callerid':util[_0x5da5('0xb')](_0x5da5('0x17'),_0x33313e[_0x5da5('0x8')]?_0x33313e[_0x5da5('0x8')]:'',_0x33313e['localstationid']),'variable':_0x589c14,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x33313e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 448bc0a..3b45ba1 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 _0x27fe=['initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','moment','./server','./realtime','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts'];(function(_0x14f0de,_0x49a73f){var _0x5686e6=function(_0xcb50c5){while(--_0xcb50c5){_0x14f0de['push'](_0x14f0de['shift']());}};_0x5686e6(++_0x49a73f);}(_0x27fe,0x1f3));var _0xe27f=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x27fe[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0xe27f('0x0'));var server=require(_0xe27f('0x1'));var Realtime=require(_0xe27f('0x2'));var Report=require('./report');var Acw=require(_0xe27f('0x3'));var Trigger=require(_0xe27f('0x4'));var Dialer=require(_0xe27f('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xe27f('0x6'));var voiceQueue=require(_0xe27f('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe27f('0x8'));var trunk=require(_0xe27f('0x9'));var trigger=require(_0xe27f('0xa'));var template=require(_0xe27f('0xb'));var cmHopperHistory=require(_0xe27f('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe27f('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe27f('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe27f('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xe27f('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe27f('0x11'));var servicenow=require(_0xe27f('0x12'));var dynamics365=require(_0xe27f('0x13'));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()[_0xe27f('0x14')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe27f('0x14')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe27f('0x15')]()[_0xe27f('0x16')](user['getAgents']())[_0xe27f('0x16')](realtime['initAgents']())['then'](user['getTelephones']())[_0xe27f('0x16')](realtime[_0xe27f('0x17')]())[_0xe27f('0x16')](trunk[_0xe27f('0x18')]())[_0xe27f('0x16')](realtime[_0xe27f('0x19')]())[_0xe27f('0x16')](voiceQueue['getVoiceQueues']())[_0xe27f('0x16')](realtime[_0xe27f('0x1a')]())[_0xe27f('0x16')](trigger[_0xe27f('0x1b')]())[_0xe27f('0x16')](realtime['initTriggers']())[_0xe27f('0x16')](template[_0xe27f('0x1c')]())[_0xe27f('0x16')](realtime[_0xe27f('0x1d')]())[_0xe27f('0x16')](zendesk[_0xe27f('0x1e')]())[_0xe27f('0x16')](realtime[_0xe27f('0x1f')]())['then'](salesforce['getSalesforceAccounts']())[_0xe27f('0x16')](realtime[_0xe27f('0x20')]())[_0xe27f('0x16')](sugarcrm[_0xe27f('0x21')]())['then'](realtime['initSugarcrmAccounts']())[_0xe27f('0x16')](freshdesk[_0xe27f('0x22')]())[_0xe27f('0x16')](realtime[_0xe27f('0x23')]())[_0xe27f('0x16')](desk[_0xe27f('0x24')]())[_0xe27f('0x16')](realtime[_0xe27f('0x25')]())[_0xe27f('0x16')](zoho[_0xe27f('0x26')]())[_0xe27f('0x16')](realtime[_0xe27f('0x27')]())[_0xe27f('0x16')](vtiger[_0xe27f('0x28')]())[_0xe27f('0x16')](realtime[_0xe27f('0x29')]())[_0xe27f('0x16')](freshsales[_0xe27f('0x2a')]())[_0xe27f('0x16')](realtime[_0xe27f('0x2b')]())['then'](servicenow[_0xe27f('0x2c')]())[_0xe27f('0x16')](realtime[_0xe27f('0x2d')]())[_0xe27f('0x16')](dynamics365['getDynamics365Accounts']())[_0xe27f('0x16')](realtime[_0xe27f('0x2e')]())[_0xe27f('0x16')](campaign['getCampaigns']())[_0xe27f('0x16')](realtime[_0xe27f('0x2f')]())[_0xe27f('0x16')](voiceExtension['getVoiceExtensions']())[_0xe27f('0x16')](realtime['initVoiceExtensions']())[_0xe27f('0x16')](faxAccount[_0xe27f('0x30')]())[_0xe27f('0x16')](realtime['initFaxAccounts']())[_0xe27f('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xe27f('0x15')]()[_0xe27f('0x16')](voiceQueueReport[_0xe27f('0x31')]())[_0xe27f('0x16')](realtime[_0xe27f('0x32')]())['then'](cmHopperHistory[_0xe27f('0x33')]())[_0xe27f('0x16')](realtime[_0xe27f('0x34')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xe27f('0x16')](realtime[_0xe27f('0x35')]())[_0xe27f('0x16')](voiceCallReport[_0xe27f('0x36')]())[_0xe27f('0x16')](realtime[_0xe27f('0x37')]())['then'](function(_0x5d3e4f){})[_0xe27f('0x38')](function(_0xf63b82){console[_0xe27f('0x39')](_0xf63b82);});}function main(){return server[_0xe27f('0x3a')](realtime,preview,fax)[_0xe27f('0x16')](function(_0x508563){return initRealtime();})[_0xe27f('0x16')](function(){return initParams();})['then'](function(){report[_0xe27f('0x3b')]();setInterval(initRealtime,0x1388);})[_0xe27f('0x38')](function(_0x5746d5){console[_0xe27f('0x39')](_0x5746d5);});}main(); \ No newline at end of file +var _0xa1ed=['initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers'];(function(_0x581bc7,_0x2ce3c5){var _0x2d951d=function(_0x263479){while(--_0x263479){_0x581bc7['push'](_0x581bc7['shift']());}};_0x2d951d(++_0x2ce3c5);}(_0xa1ed,0x1b6));var _0xda1e=function(_0x1a8caa,_0x195483){_0x1a8caa=_0x1a8caa-0x0;var _0x9021fe=_0xa1ed[_0x1a8caa];return _0x9021fe;};'use strict';var BPromise=require(_0xda1e('0x0'));var util=require(_0xda1e('0x1'));var moment=require('moment');var server=require(_0xda1e('0x2'));var Realtime=require(_0xda1e('0x3'));var Report=require(_0xda1e('0x4'));var Acw=require(_0xda1e('0x5'));var Trigger=require(_0xda1e('0x6'));var Dialer=require('./dialer');var Preview=require(_0xda1e('0x7'));var Fax=require(_0xda1e('0x8'));var user=require(_0xda1e('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xda1e('0xa'));var trunk=require(_0xda1e('0xb'));var trigger=require('./rpc/trigger');var template=require(_0xda1e('0xc'));var cmHopperHistory=require(_0xda1e('0xd'));var campaign=require(_0xda1e('0xe'));var voiceExtension=require(_0xda1e('0xf'));var faxAccount=require(_0xda1e('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xda1e('0x11'));var sugarcrm=require(_0xda1e('0x12'));var freshdesk=require(_0xda1e('0x13'));var desk=require(_0xda1e('0x14'));var zoho=require(_0xda1e('0x15'));var vtiger=require(_0xda1e('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xda1e('0x17'));var dynamics365=require(_0xda1e('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xda1e('0x19')](_0xda1e('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xda1e('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xda1e('0x1b')]()[_0xda1e('0x1c')](user[_0xda1e('0x1d')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x1e')]())[_0xda1e('0x1c')](user['getTelephones']())[_0xda1e('0x1c')](realtime[_0xda1e('0x1f')]())['then'](trunk[_0xda1e('0x20')]())['then'](realtime[_0xda1e('0x21')]())[_0xda1e('0x1c')](voiceQueue[_0xda1e('0x22')]())['then'](realtime[_0xda1e('0x23')]())[_0xda1e('0x1c')](trigger[_0xda1e('0x24')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x25')]())['then'](template['getTemplates']())[_0xda1e('0x1c')](realtime[_0xda1e('0x26')]())['then'](zendesk[_0xda1e('0x27')]())[_0xda1e('0x1c')](realtime['initZendeskAccounts']())['then'](salesforce[_0xda1e('0x28')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x29')]())[_0xda1e('0x1c')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xda1e('0x2a')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xda1e('0x2b')]())[_0xda1e('0x1c')](desk[_0xda1e('0x2c')]())[_0xda1e('0x1c')](realtime['initDeskAccounts']())['then'](zoho[_0xda1e('0x2d')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x2e')]())[_0xda1e('0x1c')](vtiger[_0xda1e('0x2f')]())[_0xda1e('0x1c')](realtime['initVtigerAccounts']())[_0xda1e('0x1c')](freshsales[_0xda1e('0x30')]())[_0xda1e('0x1c')](realtime['initFreshsalesAccounts']())[_0xda1e('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0xda1e('0x31')]())[_0xda1e('0x1c')](dynamics365[_0xda1e('0x32')]())['then'](realtime[_0xda1e('0x33')]())[_0xda1e('0x1c')](campaign[_0xda1e('0x34')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x35')]())[_0xda1e('0x1c')](voiceExtension[_0xda1e('0x36')]())['then'](realtime[_0xda1e('0x37')]())[_0xda1e('0x1c')](faxAccount[_0xda1e('0x38')]())['then'](realtime['initFaxAccounts']())[_0xda1e('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xda1e('0x1b')]()[_0xda1e('0x1c')](voiceQueueReport[_0xda1e('0x39')]())[_0xda1e('0x1c')](realtime['initVoiceQueueReports']())[_0xda1e('0x1c')](cmHopperHistory[_0xda1e('0x3a')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x3b')]())[_0xda1e('0x1c')](cmHopperHistory[_0xda1e('0x3c')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x3d')]())[_0xda1e('0x1c')](voiceCallReport[_0xda1e('0x3e')]())['then'](realtime[_0xda1e('0x3f')]())[_0xda1e('0x1c')](function(_0x3fc120){})[_0xda1e('0x40')](function(_0x17f927){console[_0xda1e('0x41')](_0x17f927);});}function main(){return server[_0xda1e('0x42')](realtime,preview,fax)['then'](function(_0x445550){return initRealtime();})[_0xda1e('0x1c')](function(){return initParams();})['then'](function(){report[_0xda1e('0x43')]();setInterval(initRealtime,0x1388);})[_0xda1e('0x40')](function(_0x1e2b1a){console[_0xda1e('0x41')](_0x1e2b1a);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index cec117c..f2f94e9 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 _0xebf4=['voiceStatusQueue','local','prototype','not_inuse','inuse','talking','voiceStatus','voiceStatusTime','toNumber','format','stateTime','status','onhold','stringify','user:%s','emit','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','phone','mobile','interface','online','voiceStatusCallerIdNumber'];(function(_0x58df23,_0x3e9eb9){var _0x2fcd18=function(_0x5f4e06){while(--_0x5f4e06){_0x58df23['push'](_0x58df23['shift']());}};_0x2fcd18(++_0x3e9eb9);}(_0xebf4,0x179));var _0x4ebf=function(_0x372259,_0x2f67a1){_0x372259=_0x372259-0x0;var _0x5442b0=_0xebf4[_0x372259];return _0x5442b0;};'use strict';var _=require('lodash');var util=require(_0x4ebf('0x0'));var moment=require(_0x4ebf('0x1'));var md5=require(_0x4ebf('0x2'));var Redis=require(_0x4ebf('0x3'));var config=require('../../../config/environment');config[_0x4ebf('0x4')]=_[_0x4ebf('0x5')](config[_0x4ebf('0x4')],{'host':_0x4ebf('0x6'),'port':0x18eb});var io=require(_0x4ebf('0x7'))(new Redis(config[_0x4ebf('0x4')]));function Agent(_0xc6b7e1){this['id']=_0xc6b7e1['id']||0x0;this['name']=_0xc6b7e1[_0x4ebf('0x8')]||'';this[_0x4ebf('0x9')]=_0xc6b7e1[_0x4ebf('0x9')]||'';this[_0x4ebf('0xa')]=_0xc6b7e1[_0x4ebf('0xa')]||'';this['fullname']=_0xc6b7e1[_0x4ebf('0xb')]||'';this[_0x4ebf('0xc')]=_0x4ebf('0xd');this['stateTime']=0x0;this['status']=_0x4ebf('0xd');this['address']='';this[_0x4ebf('0xe')]='';this[_0x4ebf('0xf')]='';this[_0x4ebf('0x10')]='';this[_0x4ebf('0x11')]=_0xc6b7e1[_0x4ebf('0x11')]||![];this['voiceStatus']=_0x4ebf('0xd');this['voiceStatusTime']=0x0;this[_0x4ebf('0x12')]='';this[_0x4ebf('0x13')]='';this['onhold']=![];this[_0x4ebf('0x14')]=![];this[_0x4ebf('0x2')]='';}Agent[_0x4ebf('0x15')]['updateStatusRealtime']=function(_0xf2e3d8){var _0x50a402;if(_0xf2e3d8&&_0xf2e3d8[_0x4ebf('0xc')]){_0x50a402=_0xf2e3d8[_0x4ebf('0xc')]['toLowerCase']();switch(_0x50a402){case _0x4ebf('0x16'):_0x50a402='idle';break;case _0x4ebf('0x17'):_0x50a402=_0x4ebf('0x18');break;}}if(_0x50a402&&this[_0x4ebf('0x19')]!==_0x50a402||_0xf2e3d8['statePause']){this[_0x4ebf('0x1a')]=_[_0x4ebf('0x1b')](moment()[_0x4ebf('0x1c')]('x'));}if(_0x50a402){this[_0x4ebf('0x19')]=_0x50a402;}var _0x3b496b={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x4ebf('0xa')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x4ebf('0x1d')],'status':this[_0x4ebf('0x1e')],'address':this['address'],'online':this[_0x4ebf('0x11')],'voiceStatus':this[_0x4ebf('0x19')],'voiceStatusTime':this[_0x4ebf('0x1a')],'voiceStatusCallerIdNumber':this[_0x4ebf('0x12')],'voiceStatusQueue':this[_0x4ebf('0x13')],'interface':this[_0x4ebf('0x10')],'onhold':this[_0x4ebf('0x1f')]};var _0x167f92=md5(JSON[_0x4ebf('0x20')](_0x3b496b));if(this['md5']!==_0x167f92){this[_0x4ebf('0x2')]=_0x167f92;io['to'](util[_0x4ebf('0x1c')](_0x4ebf('0x21'),_0x3b496b[_0x4ebf('0x8')]))[_0x4ebf('0x22')]('user:save',_0x3b496b);}};module[_0x4ebf('0x23')]=Agent; \ No newline at end of file +var _0x7063=['onhold','prototype','toLowerCase','not_inuse','inuse','talking','voiceStatusTime','toNumber','format','address','stringify','user:%s','emit','user:save','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x582cc9,_0x411563){var _0x1a0321=function(_0xc7770c){while(--_0xc7770c){_0x582cc9['push'](_0x582cc9['shift']());}};_0x1a0321(++_0x411563);}(_0x7063,0x1cb));var _0x3706=function(_0x35e794,_0xe4473){_0x35e794=_0x35e794-0x0;var _0x5a7900=_0x7063[_0x35e794];return _0x5a7900;};'use strict';var _=require('lodash');var util=require(_0x3706('0x0'));var moment=require(_0x3706('0x1'));var md5=require(_0x3706('0x2'));var Redis=require(_0x3706('0x3'));var config=require('../../../config/environment');config[_0x3706('0x4')]=_[_0x3706('0x5')](config[_0x3706('0x4')],{'host':_0x3706('0x6'),'port':0x18eb});var io=require(_0x3706('0x7'))(new Redis(config[_0x3706('0x4')]));function Agent(_0xceeb8a){this['id']=_0xceeb8a['id']||0x0;this[_0x3706('0x8')]=_0xceeb8a[_0x3706('0x8')]||'';this[_0x3706('0x9')]=_0xceeb8a[_0x3706('0x9')]||'';this[_0x3706('0xa')]=_0xceeb8a[_0x3706('0xa')]||'';this['fullname']=_0xceeb8a[_0x3706('0xb')]||'';this[_0x3706('0xc')]=_0x3706('0xd');this[_0x3706('0xe')]=0x0;this[_0x3706('0xf')]='unknown';this['address']='';this['phone']='';this[_0x3706('0x10')]='';this[_0x3706('0x11')]='';this[_0x3706('0x12')]=_0xceeb8a['online']||![];this[_0x3706('0x13')]='unknown';this['voiceStatusTime']=0x0;this[_0x3706('0x14')]='';this[_0x3706('0x15')]='';this[_0x3706('0x16')]=![];this['local']=![];this[_0x3706('0x2')]='';}Agent[_0x3706('0x17')]['updateStatusRealtime']=function(_0x5989bd){var _0x55718d;if(_0x5989bd&&_0x5989bd['state']){_0x55718d=_0x5989bd[_0x3706('0xc')][_0x3706('0x18')]();switch(_0x55718d){case _0x3706('0x19'):_0x55718d='idle';break;case _0x3706('0x1a'):_0x55718d=_0x3706('0x1b');break;}}if(_0x55718d&&this[_0x3706('0x13')]!==_0x55718d||_0x5989bd['statePause']){this[_0x3706('0x1c')]=_[_0x3706('0x1d')](moment()[_0x3706('0x1e')]('x'));}if(_0x55718d){this[_0x3706('0x13')]=_0x55718d;}var _0x568fbf={'id':this['id'],'name':this[_0x3706('0x8')],'email':this[_0x3706('0x9')],'accountcode':this[_0x3706('0xa')],'fullname':this['fullname'],'state':this[_0x3706('0xc')],'stateTime':this['stateTime'],'status':this[_0x3706('0xf')],'address':this[_0x3706('0x1f')],'online':this[_0x3706('0x12')],'voiceStatus':this[_0x3706('0x13')],'voiceStatusTime':this[_0x3706('0x1c')],'voiceStatusCallerIdNumber':this[_0x3706('0x14')],'voiceStatusQueue':this[_0x3706('0x15')],'interface':this[_0x3706('0x11')],'onhold':this['onhold']};var _0x29f4ff=md5(JSON[_0x3706('0x20')](_0x568fbf));if(this[_0x3706('0x2')]!==_0x29f4ff){this['md5']=_0x29f4ff;io['to'](util[_0x3706('0x1e')](_0x3706('0x21'),_0x568fbf[_0x3706('0x8')]))[_0x3706('0x22')](_0x3706('0x23'),_0x568fbf);}};module[_0x3706('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ff5b736..d3789df 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 _0x1c30=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x1c30,0x107));var _0x01c3=function(_0x2c9e61,_0x2d13f5){_0x2c9e61=_0x2c9e61-0x0;var _0x4d55d6=_0x1c30[_0x2c9e61];return _0x4d55d6;};'use strict';function Campaign(_0x184eb5){this['id']=_0x184eb5['id']||0x0;this[_0x01c3('0x0')]=_0x184eb5[_0x01c3('0x0')]||'';this[_0x01c3('0x1')]=_0x184eb5['type']||_0x01c3('0x2');this[_0x01c3('0x3')]=0x0;this[_0x01c3('0x4')]=0x0;this[_0x01c3('0x5')]=0x0;this[_0x01c3('0x6')]=0x0;this[_0x01c3('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x184eb5[_0x01c3('0x8')];this[_0x01c3('0x9')]=_0x184eb5[_0x01c3('0x9')];this[_0x01c3('0xa')]=_0x184eb5['dialTimezone']||null;this['dialGlobalInterval']=_0x184eb5[_0x01c3('0xb')]?_0x184eb5[_0x01c3('0xb')]:null;this[_0x01c3('0xc')]=_0x184eb5[_0x01c3('0xc')];this[_0x01c3('0xd')]=_0x184eb5['dialOriginateCallerIdNumber'];this[_0x01c3('0xe')]=_0x184eb5[_0x01c3('0xe')]||0x1e;this[_0x01c3('0xf')]=_0x184eb5['dialCongestionMaxRetry'];this[_0x01c3('0x10')]=_0x184eb5[_0x01c3('0x10')];this[_0x01c3('0x11')]=_0x184eb5['dialBusyMaxRetry'];this[_0x01c3('0x12')]=_0x184eb5[_0x01c3('0x12')];this['dialNoAnswerMaxRetry']=_0x184eb5[_0x01c3('0x13')];this[_0x01c3('0x14')]=_0x184eb5[_0x01c3('0x14')];this[_0x01c3('0x15')]=_0x184eb5['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x184eb5[_0x01c3('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x184eb5[_0x01c3('0x17')]||0x96;this[_0x01c3('0x18')]=_0x184eb5['dialDropMaxRetry']||0x3;this[_0x01c3('0x19')]=_0x184eb5[_0x01c3('0x19')]||0x96;this[_0x01c3('0x1a')]=_0x184eb5[_0x01c3('0x1a')]||0x3;this[_0x01c3('0x1b')]=_0x184eb5['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x184eb5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x184eb5[_0x01c3('0x1c')]||0x96;this[_0x01c3('0x1d')]=_0x184eb5[_0x01c3('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x184eb5[_0x01c3('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x184eb5[_0x01c3('0x1f')]||'DESC';this[_0x01c3('0x20')]=_0x184eb5[_0x01c3('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x184eb5[_0x01c3('0x21')]||undefined;this[_0x01c3('0x22')]=_0x184eb5[_0x01c3('0x22')]||undefined;this[_0x01c3('0x23')]=_0x184eb5[_0x01c3('0x23')]?_0x184eb5[_0x01c3('0x23')]:undefined;this[_0x01c3('0x24')]=_0x184eb5[_0x01c3('0x24')]?_0x184eb5[_0x01c3('0x24')]:undefined;this[_0x01c3('0x25')]=_0x184eb5[_0x01c3('0x25')]?_0x184eb5['Interval']:undefined;this['SquareProject']=_0x184eb5[_0x01c3('0x26')]?_0x184eb5[_0x01c3('0x26')]:undefined;this[_0x01c3('0x27')]=_0x184eb5[_0x01c3('0x26')]?_0x184eb5[_0x01c3('0x26')][_0x01c3('0x0')]:undefined;this[_0x01c3('0x28')]=_0x184eb5[_0x01c3('0x28')]||![];this['dialAMDInitialSilence']=_0x184eb5[_0x01c3('0x29')];this[_0x01c3('0x2a')]=_0x184eb5[_0x01c3('0x2a')];this['dialAMDAfterGreetingSilence']=_0x184eb5['dialAMDAfterGreetingSilence'];this[_0x01c3('0x2b')]=_0x184eb5[_0x01c3('0x2b')];this['dialAMDMinWordLength']=_0x184eb5[_0x01c3('0x2c')];this[_0x01c3('0x2d')]=_0x184eb5[_0x01c3('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x184eb5[_0x01c3('0x2e')];this[_0x01c3('0x2f')]=_0x184eb5[_0x01c3('0x2f')];this[_0x01c3('0x30')]=_0x184eb5['dialAMDMaximumWordLength'];}module[_0x01c3('0x31')]=Campaign; \ No newline at end of file +var _0x570d=['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','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays'];(function(_0x5f4e8d,_0x50740d){var _0x220421=function(_0x45cfa8){while(--_0x45cfa8){_0x5f4e8d['push'](_0x5f4e8d['shift']());}};_0x220421(++_0x50740d);}(_0x570d,0x1bc));var _0xd570=function(_0x125425,_0x4b6bab){_0x125425=_0x125425-0x0;var _0xd04dc4=_0x570d[_0x125425];return _0xd04dc4;};'use strict';function Campaign(_0x589744){this['id']=_0x589744['id']||0x0;this[_0xd570('0x0')]=_0x589744[_0xd570('0x0')]||'';this[_0xd570('0x1')]=_0x589744[_0xd570('0x1')]||_0xd570('0x2');this[_0xd570('0x3')]=0x0;this[_0xd570('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xd570('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x589744['active'];this[_0xd570('0x6')]=_0x589744[_0xd570('0x6')];this[_0xd570('0x7')]=_0x589744[_0xd570('0x7')]||null;this[_0xd570('0x8')]=_0x589744[_0xd570('0x8')]?_0x589744['dialGlobalInterval']:null;this[_0xd570('0x9')]=_0x589744['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x589744[_0xd570('0xa')];this[_0xd570('0xb')]=_0x589744['dialOriginateTimeout']||0x1e;this[_0xd570('0xc')]=_0x589744[_0xd570('0xc')];this['dialCongestionRetryFrequency']=_0x589744[_0xd570('0xd')];this[_0xd570('0xe')]=_0x589744['dialBusyMaxRetry'];this[_0xd570('0xf')]=_0x589744[_0xd570('0xf')];this[_0xd570('0x10')]=_0x589744[_0xd570('0x10')];this[_0xd570('0x11')]=_0x589744['dialNoAnswerRetryFrequency'];this[_0xd570('0x12')]=_0x589744['dialGlobalMaxRetry'];this[_0xd570('0x13')]=_0x589744[_0xd570('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x589744[_0xd570('0x14')]||0x96;this[_0xd570('0x15')]=_0x589744[_0xd570('0x15')]||0x3;this[_0xd570('0x16')]=_0x589744[_0xd570('0x16')]||0x96;this[_0xd570('0x17')]=_0x589744[_0xd570('0x17')]||0x3;this[_0xd570('0x18')]=_0x589744['dialAbandonedRetryFrequency']||0x96;this[_0xd570('0x19')]=_0x589744[_0xd570('0x19')]||0x3;this[_0xd570('0x1a')]=_0x589744[_0xd570('0x1a')]||0x96;this[_0xd570('0x1b')]=_0x589744[_0xd570('0x1b')]||0x3;this[_0xd570('0x1c')]=_0x589744[_0xd570('0x1c')]||0x96;this[_0xd570('0x1d')]=_0x589744['dialOrderByScheduledAt']||_0xd570('0x1e');this[_0xd570('0x1f')]=_0x589744[_0xd570('0x1f')]||undefined;this[_0xd570('0x20')]=_0x589744['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd570('0x21')]=_0x589744[_0xd570('0x21')]||undefined;this[_0xd570('0x22')]=_0x589744[_0xd570('0x22')]?_0x589744[_0xd570('0x22')]:undefined;this['Trunk']=_0x589744[_0xd570('0x23')]?_0x589744[_0xd570('0x23')]:undefined;this[_0xd570('0x24')]=_0x589744[_0xd570('0x24')]?_0x589744[_0xd570('0x24')]:undefined;this[_0xd570('0x25')]=_0x589744[_0xd570('0x25')]?_0x589744[_0xd570('0x25')]:undefined;this[_0xd570('0x26')]=_0x589744[_0xd570('0x25')]?_0x589744[_0xd570('0x25')][_0xd570('0x0')]:undefined;this[_0xd570('0x27')]=_0x589744[_0xd570('0x27')]||![];this['dialAMDInitialSilence']=_0x589744[_0xd570('0x28')];this[_0xd570('0x29')]=_0x589744['dialAMDGreeting'];this[_0xd570('0x2a')]=_0x589744[_0xd570('0x2a')];this['dialAMDTotalAnalysisTime']=_0x589744[_0xd570('0x2b')];this['dialAMDMinWordLength']=_0x589744[_0xd570('0x2c')];this[_0xd570('0x2d')]=_0x589744[_0xd570('0x2d')];this[_0xd570('0x2e')]=_0x589744['dialAMDMaximumNumberOfWords'];this[_0xd570('0x2f')]=_0x589744['dialAMDSilenceThreshold'];this[_0xd570('0x30')]=_0x589744[_0xd570('0x30')];}module[_0xd570('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e1dd377..a575ae8 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 _0x7275=['tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','uniqueid','linkedid','endtime','abandoned','lastdata','billableseconds','holdtime'];(function(_0x184cfe,_0x1b1785){var _0x24b8e4=function(_0x5f2c3c){while(--_0x5f2c3c){_0x184cfe['push'](_0x184cfe['shift']());}};_0x24b8e4(++_0x1b1785);}(_0x7275,0x143));var _0x5727=function(_0x1568e3,_0x5f1e35){_0x1568e3=_0x1568e3-0x0;var _0x6ab428=_0x7275[_0x1568e3];return _0x6ab428;};'use strict';function Channel(){this[_0x5727('0x0')]=null;this[_0x5727('0x1')]='';this[_0x5727('0x2')]='';this['calleridnum']=0x0;this[_0x5727('0x3')]='';this['connectedlinenum']=undefined;this[_0x5727('0x4')]=undefined;this[_0x5727('0x5')]=0x0;this['context']='';this[_0x5727('0x6')]=0x0;this[_0x5727('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x5727('0x8')]=null;this['unmanaged']=![];this[_0x5727('0x9')]=![];this['lastapplication']='';this[_0x5727('0xa')]='';this['duration']=0x0;this[_0x5727('0xb')]=0x0;this[_0x5727('0xc')]=0x0;this['type']=null;this[_0x5727('0xd')]=null;this[_0x5727('0xe')]=null;this['monitor']=![];this[_0x5727('0xf')]=null;this[_0x5727('0x10')]=null;this['monitors']=[];this[_0x5727('0x11')]=undefined;this[_0x5727('0x12')]=undefined;this[_0x5727('0x13')]=0x0;}module[_0x5727('0x14')]=Channel; \ No newline at end of file +var _0x76d0=['type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x76d0,0x132));var _0x076d=function(_0x518dd9,_0x3c417c){_0x518dd9=_0x518dd9-0x0;var _0x41089f=_0x76d0[_0x518dd9];return _0x41089f;};'use strict';function Channel(){this[_0x076d('0x0')]=null;this[_0x076d('0x1')]='';this[_0x076d('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x076d('0x3')]=undefined;this[_0x076d('0x4')]=undefined;this[_0x076d('0x5')]=0x0;this[_0x076d('0x6')]='';this[_0x076d('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x076d('0x8')]=![];this[_0x076d('0x9')]=null;this[_0x076d('0xa')]=null;this[_0x076d('0xb')]=![];this[_0x076d('0xc')]=![];this[_0x076d('0xd')]='';this[_0x076d('0xe')]='';this[_0x076d('0xf')]=0x0;this[_0x076d('0x10')]=0x0;this[_0x076d('0x11')]=0x0;this[_0x076d('0x12')]=null;this[_0x076d('0x13')]=null;this[_0x076d('0x14')]=null;this['monitor']=![];this[_0x076d('0x15')]=null;this[_0x076d('0x16')]=null;this[_0x076d('0x17')]=[];this[_0x076d('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x076d('0x19')]=0x0;}module[_0x076d('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 bce1878..3e08de4 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 _0xfd6e=['serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';function DeskAccount(_0x501204){this['id']=_0x501204['id']||0x0;this['name']=_0x501204[_0xefd6('0x0')]||'';this['username']=_0x501204[_0xefd6('0x1')]||'';this[_0xefd6('0x2')]=_0x501204['remoteUri']||'';this['authType']=_0x501204['authType']||'';this[_0xefd6('0x3')]=_0x501204['password']||'';this['consumerKey']=_0x501204[_0xefd6('0x4')]||'';this[_0xefd6('0x5')]=_0x501204[_0xefd6('0x5')]||'';this[_0xefd6('0x6')]=_0x501204[_0xefd6('0x6')]||'';this['tokenSecret']=_0x501204['tokenSecret']||'';this[_0xefd6('0x7')]=_0x501204[_0xefd6('0x7')]||'';this[_0xefd6('0x8')]=_0x501204['serverUrl']||'';this[_0xefd6('0x9')]=_0x501204[_0xefd6('0x9')]||{};}module[_0xefd6('0xa')]=DeskAccount; \ No newline at end of file +var _0x3351=['type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x1f9cbf,_0x17138c){var _0x556003=function(_0x5cffe8){while(--_0x5cffe8){_0x1f9cbf['push'](_0x1f9cbf['shift']());}};_0x556003(++_0x17138c);}(_0x3351,0x1b4));var _0x1335=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x3351[_0x2cf2e9];return _0xd3670d;};'use strict';function DeskAccount(_0x4db616){this['id']=_0x4db616['id']||0x0;this['name']=_0x4db616['name']||'';this[_0x1335('0x0')]=_0x4db616[_0x1335('0x0')]||'';this[_0x1335('0x1')]=_0x4db616[_0x1335('0x1')]||'';this[_0x1335('0x2')]=_0x4db616[_0x1335('0x2')]||'';this[_0x1335('0x3')]=_0x4db616['password']||'';this[_0x1335('0x4')]=_0x4db616[_0x1335('0x4')]||'';this[_0x1335('0x5')]=_0x4db616[_0x1335('0x5')]||'';this[_0x1335('0x6')]=_0x4db616[_0x1335('0x6')]||'';this[_0x1335('0x7')]=_0x4db616[_0x1335('0x7')]||'';this[_0x1335('0x8')]=_0x4db616[_0x1335('0x8')]||'';this[_0x1335('0x9')]=_0x4db616['serverUrl']||'';this[_0x1335('0xa')]=_0x4db616['Configurations']||{};}module[_0x1335('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 90af6a4..2ce1d90 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 _0xa7ae=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x21552f,_0x4e7281){var _0x4f5c43=function(_0x11cd07){while(--_0x11cd07){_0x21552f['push'](_0x21552f['shift']());}};_0x4f5c43(++_0x4e7281);}(_0xa7ae,0x19d));var _0xea7a=function(_0xff5a26,_0xbc3d7f){_0xff5a26=_0xff5a26-0x0;var _0x22fb80=_0xa7ae[_0xff5a26];return _0x22fb80;};'use strict';function Dynamics365Account(_0x11cb50){this['id']=_0x11cb50['id']||0x0;this[_0xea7a('0x0')]=_0x11cb50['name']||'';this[_0xea7a('0x1')]=_0x11cb50['username']||'';this[_0xea7a('0x2')]=_0x11cb50[_0xea7a('0x2')]||'';this[_0xea7a('0x3')]=_0x11cb50[_0xea7a('0x3')]||'';this[_0xea7a('0x4')]=_0x11cb50[_0xea7a('0x4')]||'';this['clientId']=_0x11cb50[_0xea7a('0x5')]||'';this[_0xea7a('0x6')]=_0x11cb50['clientSecret']||{};this[_0xea7a('0x7')]=_0x11cb50[_0xea7a('0x7')]||'';this[_0xea7a('0x8')]=_0x11cb50['Configurations']||{};}module[_0xea7a('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xb032=['remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name','username','password'];(function(_0x184baf,_0x197780){var _0x5c463c=function(_0x4edc24){while(--_0x4edc24){_0x184baf['push'](_0x184baf['shift']());}};_0x5c463c(++_0x197780);}(_0xb032,0x8d));var _0x2b03=function(_0x133f69,_0x2d4632){_0x133f69=_0x133f69-0x0;var _0x3b67bb=_0xb032[_0x133f69];return _0x3b67bb;};'use strict';function Dynamics365Account(_0xac36c2){this['id']=_0xac36c2['id']||0x0;this[_0x2b03('0x0')]=_0xac36c2[_0x2b03('0x0')]||'';this[_0x2b03('0x1')]=_0xac36c2[_0x2b03('0x1')]||'';this['password']=_0xac36c2[_0x2b03('0x2')]||'';this[_0x2b03('0x3')]=_0xac36c2[_0x2b03('0x3')]||'';this[_0x2b03('0x4')]=_0xac36c2[_0x2b03('0x4')]||'';this[_0x2b03('0x5')]=_0xac36c2[_0x2b03('0x5')]||'';this['clientSecret']=_0xac36c2['clientSecret']||{};this[_0x2b03('0x6')]=_0xac36c2[_0x2b03('0x6')]||'';this['Configurations']=_0xac36c2[_0x2b03('0x7')]||{};}module[_0x2b03('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9b343ed..b6b05f5 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 _0x57db=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm'];(function(_0x27c74e,_0x44edc0){var _0x2957f0=function(_0x3c3ef5){while(--_0x3c3ef5){_0x27c74e['push'](_0x27c74e['shift']());}};_0x2957f0(++_0x44edc0);}(_0x57db,0xda));var _0xb57d=function(_0x67501f,_0x48a297){_0x67501f=_0x67501f-0x0;var _0x28d524=_0x57db[_0x67501f];return _0x28d524;};'use strict';function FaxAccount(_0x2eaa8f){this['id']=_0x2eaa8f['id']||0x0;this[_0xb57d('0x0')]=_0x2eaa8f['name']||'';this[_0xb57d('0x1')]=_0x2eaa8f['description'];this[_0xb57d('0x2')]=_0x2eaa8f[_0xb57d('0x2')];this[_0xb57d('0x3')]=_0x2eaa8f[_0xb57d('0x3')];this[_0xb57d('0x4')]=_0x2eaa8f['localstationid'];this[_0xb57d('0x5')]=_0x2eaa8f[_0xb57d('0x5')]||0x960;this['maxrate']=_0x2eaa8f[_0xb57d('0x6')]||0x3840;this[_0xb57d('0x7')]=_0x2eaa8f[_0xb57d('0x7')]||_0xb57d('0x8');this[_0xb57d('0x9')]=_0x2eaa8f[_0xb57d('0x9')]||'no';this['faxdetect']=_0x2eaa8f[_0xb57d('0xa')]||'no';this[_0xb57d('0xb')]=_0x2eaa8f[_0xb57d('0xb')]||0x1388;this[_0xb57d('0xc')]=_0x2eaa8f[_0xb57d('0xc')]||_0xb57d('0xd');this[_0xb57d('0xe')]=_0x2eaa8f[_0xb57d('0xe')]?_0x2eaa8f[_0xb57d('0xe')]:undefined;this[_0xb57d('0xf')]=_0x2eaa8f[_0xb57d('0xf')];this[_0xb57d('0x10')]=_0x2eaa8f[_0xb57d('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xebaa=['description','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x4f8f27,_0x34cb4b){var _0x2789ff=function(_0x51b461){while(--_0x51b461){_0x4f8f27['push'](_0x4f8f27['shift']());}};_0x2789ff(++_0x34cb4b);}(_0xebaa,0x14f));var _0xaeba=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xebaa[_0x27af45];return _0x18df21;};'use strict';function FaxAccount(_0x41f38f){this['id']=_0x41f38f['id']||0x0;this[_0xaeba('0x0')]=_0x41f38f[_0xaeba('0x0')]||'';this[_0xaeba('0x1')]=_0x41f38f['description'];this['ecm']=_0x41f38f['ecm'];this['headerinfo']=_0x41f38f['headerinfo'];this[_0xaeba('0x2')]=_0x41f38f[_0xaeba('0x2')];this[_0xaeba('0x3')]=_0x41f38f[_0xaeba('0x3')]||0x960;this[_0xaeba('0x4')]=_0x41f38f[_0xaeba('0x4')]||0x3840;this[_0xaeba('0x5')]=_0x41f38f['modem']||_0xaeba('0x6');this[_0xaeba('0x7')]=_0x41f38f['gateway']||'no';this[_0xaeba('0x8')]=_0x41f38f[_0xaeba('0x8')]||'no';this[_0xaeba('0x9')]=_0x41f38f[_0xaeba('0x9')]||0x1388;this[_0xaeba('0xa')]=_0x41f38f[_0xaeba('0xa')]||_0xaeba('0xb');this[_0xaeba('0xc')]=_0x41f38f['Trunk']?_0x41f38f['Trunk']:undefined;this[_0xaeba('0xd')]=_0x41f38f[_0xaeba('0xd')];this[_0xaeba('0xe')]=_0x41f38f[_0xaeba('0xe')];}module[_0xaeba('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 163f786..2797c5a 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 _0xa296=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x51398e,_0x4affb5){var _0x154376=function(_0x7dcc64){while(--_0x7dcc64){_0x51398e['push'](_0x51398e['shift']());}};_0x154376(++_0x4affb5);}(_0xa296,0x1e8));var _0x6a29=function(_0x1d13c8,_0x1554e6){_0x1d13c8=_0x1d13c8-0x0;var _0x3a3b03=_0xa296[_0x1d13c8];return _0x3a3b03;};'use strict';function FreshdeskAccount(_0x497b53){this['id']=_0x497b53['id']||0x0;this[_0x6a29('0x0')]=_0x497b53[_0x6a29('0x0')]||'';this['username']=_0x497b53[_0x6a29('0x1')]||'';this[_0x6a29('0x2')]=_0x497b53[_0x6a29('0x3')]||'';this[_0x6a29('0x4')]=_0x497b53['remoteUri']||'';this[_0x6a29('0x5')]=_0x497b53[_0x6a29('0x5')]||'';this['Configurations']=_0x497b53[_0x6a29('0x6')]||{};}module[_0x6a29('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x77b8=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x77b8,0xc0));var _0x877b=function(_0x41ef2e,_0x2de12c){_0x41ef2e=_0x41ef2e-0x0;var _0x2f0935=_0x77b8[_0x41ef2e];return _0x2f0935;};'use strict';function FreshdeskAccount(_0x53152d){this['id']=_0x53152d['id']||0x0;this['name']=_0x53152d[_0x877b('0x0')]||'';this[_0x877b('0x1')]=_0x53152d['username']||'';this[_0x877b('0x2')]=_0x53152d['token']||'';this[_0x877b('0x3')]=_0x53152d[_0x877b('0x3')]||'';this[_0x877b('0x4')]=_0x53152d[_0x877b('0x4')]||'';this[_0x877b('0x5')]=_0x53152d['Configurations']||{};}module[_0x877b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2362122..27d52b3 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 _0x88b3=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x14460d,_0x690de0){var _0x497f91=function(_0x143a56){while(--_0x143a56){_0x14460d['push'](_0x14460d['shift']());}};_0x497f91(++_0x690de0);}(_0x88b3,0x101));var _0x388b=function(_0xb6bd60,_0x48e4a3){_0xb6bd60=_0xb6bd60-0x0;var _0x36d0dd=_0x88b3[_0xb6bd60];return _0x36d0dd;};'use strict';function FreshsalesAccount(_0x114863){this['id']=_0x114863['id']||0x0;this[_0x388b('0x0')]=_0x114863[_0x388b('0x0')]||'';this[_0x388b('0x1')]=_0x114863[_0x388b('0x1')]||'';this[_0x388b('0x2')]=_0x114863[_0x388b('0x3')]||'';this[_0x388b('0x4')]=_0x114863['remoteUri']||'';this[_0x388b('0x5')]=_0x114863[_0x388b('0x5')]||'';this[_0x388b('0x6')]=_0x114863[_0x388b('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x4c8f=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4ac271,_0x386c78){var _0x5c92f5=function(_0x101028){while(--_0x101028){_0x4ac271['push'](_0x4ac271['shift']());}};_0x5c92f5(++_0x386c78);}(_0x4c8f,0x133));var _0xf4c8=function(_0x3a9636,_0x20b297){_0x3a9636=_0x3a9636-0x0;var _0x14cec7=_0x4c8f[_0x3a9636];return _0x14cec7;};'use strict';function FreshsalesAccount(_0x35b64b){this['id']=_0x35b64b['id']||0x0;this[_0xf4c8('0x0')]=_0x35b64b['name']||'';this[_0xf4c8('0x1')]=_0x35b64b[_0xf4c8('0x1')]||'';this['apiKey']=_0x35b64b[_0xf4c8('0x2')]||'';this[_0xf4c8('0x3')]=_0x35b64b[_0xf4c8('0x3')]||'';this[_0xf4c8('0x4')]=_0x35b64b[_0xf4c8('0x4')]||'';this[_0xf4c8('0x5')]=_0x35b64b['Configurations']||{};}module[_0xf4c8('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f2aff9e..9784bb4 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 _0x9321=['queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','holdtime','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x3bf02c,_0x48cd24){var _0x1af28d=function(_0x1732b7){while(--_0x1732b7){_0x3bf02c['push'](_0x3bf02c['shift']());}};_0x1af28d(++_0x48cd24);}(_0x9321,0xec));var _0x1932=function(_0x549d64,_0x506360){_0x549d64=_0x549d64-0x0;var _0x572bb1=_0x9321[_0x549d64];return _0x572bb1;};'use strict';function QueueReport(){this[_0x1932('0x0')]='inbound';this[_0x1932('0x1')]='';this[_0x1932('0x2')]='';this[_0x1932('0x3')]='';this[_0x1932('0x4')]='';this[_0x1932('0x5')]=null;this[_0x1932('0x6')]=null;this[_0x1932('0x7')]=0x1;this[_0x1932('0x8')]=0x1;this[_0x1932('0x9')]=![];this[_0x1932('0xa')]=null;this[_0x1932('0xb')]=![];this[_0x1932('0xc')]=null;this[_0x1932('0xd')]=![];this[_0x1932('0xe')]=null;this['originalposition']=0x1;this[_0x1932('0xf')]='';this[_0x1932('0x10')]='';this[_0x1932('0x11')]='';this['accountcode']='';this[_0x1932('0x12')]='';this[_0x1932('0x13')]='';this['priority']='';this[_0x1932('0x14')]=0x0;this['assigned']=![];this[_0x1932('0x15')]='';this[_0x1932('0x16')]=0x0;this[_0x1932('0x17')]={};}module[_0x1932('0x18')]=QueueReport; \ No newline at end of file +var _0x3662=['calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','priority','holdtime','assigned','variables','exports','uniqueid','calleridnum'];(function(_0x21e095,_0x5bdf11){var _0x3bdc15=function(_0x52ebb1){while(--_0x52ebb1){_0x21e095['push'](_0x21e095['shift']());}};_0x3bdc15(++_0x5bdf11);}(_0x3662,0x91));var _0x2366=function(_0x27403a,_0x40e4e4){_0x27403a=_0x27403a-0x0;var _0x43be9a=_0x3662[_0x27403a];return _0x43be9a;};'use strict';function QueueReport(){this['type']='inbound';this[_0x2366('0x0')]='';this[_0x2366('0x1')]='';this[_0x2366('0x2')]='';this['queue']='';this[_0x2366('0x3')]=null;this[_0x2366('0x4')]=null;this[_0x2366('0x5')]=0x1;this[_0x2366('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x2366('0x7')]=null;this['queuecallercomplete']=![];this[_0x2366('0x8')]=null;this[_0x2366('0x9')]=![];this[_0x2366('0xa')]=null;this[_0x2366('0xb')]=0x1;this[_0x2366('0xc')]='';this[_0x2366('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0x2366('0xe')]='';this[_0x2366('0xf')]='';this[_0x2366('0x10')]='';this[_0x2366('0x11')]=0x0;this[_0x2366('0x12')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x2366('0x13')]={};}module[_0x2366('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 98322c1..543b81a 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 _0x8f4f=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x4da93f,_0x51a0f9){var _0x2e6326=function(_0x37e0f5){while(--_0x37e0f5){_0x4da93f['push'](_0x4da93f['shift']());}};_0x2e6326(++_0x51a0f9);}(_0x8f4f,0x1f3));var _0xf8f4=function(_0x2718b3,_0x1c7521){_0x2718b3=_0x2718b3-0x0;var _0x50378d=_0x8f4f[_0x2718b3];return _0x50378d;};'use strict';function SalesforceAccount(_0x343752){this['id']=_0x343752['id']||0x0;this[_0xf8f4('0x0')]=_0x343752[_0xf8f4('0x0')]||'';this[_0xf8f4('0x1')]=_0x343752['username']||'';this[_0xf8f4('0x2')]=_0x343752[_0xf8f4('0x2')]||'';this['password']=_0x343752[_0xf8f4('0x3')]||'';this[_0xf8f4('0x4')]=_0x343752['clientId']||'';this[_0xf8f4('0x5')]=_0x343752[_0xf8f4('0x5')]||'';this['securityToken']=_0x343752[_0xf8f4('0x6')]||'';this[_0xf8f4('0x7')]=_0x343752['type']||_0xf8f4('0x8');this[_0xf8f4('0x9')]=_0x343752['serverUrl']||'';this[_0xf8f4('0xa')]=_0x343752[_0xf8f4('0xa')]||{};}module[_0xf8f4('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc63c=['clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xc63c,0x80));var _0xcc63=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xc63c[_0x421cf8];return _0x145c48;};'use strict';function SalesforceAccount(_0x5e570c){this['id']=_0x5e570c['id']||0x0;this[_0xcc63('0x0')]=_0x5e570c[_0xcc63('0x0')]||'';this[_0xcc63('0x1')]=_0x5e570c['username']||'';this[_0xcc63('0x2')]=_0x5e570c[_0xcc63('0x2')]||'';this[_0xcc63('0x3')]=_0x5e570c[_0xcc63('0x3')]||'';this[_0xcc63('0x4')]=_0x5e570c[_0xcc63('0x4')]||'';this[_0xcc63('0x5')]=_0x5e570c[_0xcc63('0x5')]||'';this['securityToken']=_0x5e570c['securityToken']||'';this[_0xcc63('0x6')]=_0x5e570c['type']||_0xcc63('0x7');this[_0xcc63('0x8')]=_0x5e570c['serverUrl']||'';this[_0xcc63('0x9')]=_0x5e570c[_0xcc63('0x9')]||{};}module[_0xcc63('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index f4af72d..1bcab24 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 _0x86bd=['name','password','serverUrl','Configurations'];(function(_0x1b5a53,_0x10a94){var _0x3d1475=function(_0x3033db){while(--_0x3033db){_0x1b5a53['push'](_0x1b5a53['shift']());}};_0x3d1475(++_0x10a94);}(_0x86bd,0x198));var _0xd86b=function(_0x41161b,_0x55d659){_0x41161b=_0x41161b-0x0;var _0xf5f3b4=_0x86bd[_0x41161b];return _0xf5f3b4;};'use strict';function ServicenowAccount(_0x7dc19f){this['id']=_0x7dc19f['id']||0x0;this[_0xd86b('0x0')]=_0x7dc19f[_0xd86b('0x0')]||'';this['username']=_0x7dc19f['username']||'';this[_0xd86b('0x1')]=_0x7dc19f[_0xd86b('0x1')]||'';this['remoteUri']=_0x7dc19f['remoteUri']||'';this[_0xd86b('0x2')]=_0x7dc19f[_0xd86b('0x2')]||'';this[_0xd86b('0x3')]=_0x7dc19f[_0xd86b('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xa8c6=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xa8c6,0x96));var _0x6a8c=function(_0x1556c7,_0x204ce5){_0x1556c7=_0x1556c7-0x0;var _0x825624=_0xa8c6[_0x1556c7];return _0x825624;};'use strict';function ServicenowAccount(_0x1669d3){this['id']=_0x1669d3['id']||0x0;this[_0x6a8c('0x0')]=_0x1669d3[_0x6a8c('0x0')]||'';this[_0x6a8c('0x1')]=_0x1669d3[_0x6a8c('0x1')]||'';this[_0x6a8c('0x2')]=_0x1669d3[_0x6a8c('0x2')]||'';this[_0x6a8c('0x3')]=_0x1669d3[_0x6a8c('0x3')]||'';this['serverUrl']=_0x1669d3[_0x6a8c('0x4')]||'';this[_0x6a8c('0x5')]=_0x1669d3[_0x6a8c('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fa6389c..c8d275a 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 _0x9564=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9564,0x1ad));var _0x4956=function(_0x8d9399,_0x490955){_0x8d9399=_0x8d9399-0x0;var _0x5a0645=_0x9564[_0x8d9399];return _0x5a0645;};'use strict';function SugarcrmAccount(_0x541ec4){this['id']=_0x541ec4['id']||0x0;this[_0x4956('0x0')]=_0x541ec4[_0x4956('0x0')]||'';this[_0x4956('0x1')]=_0x541ec4[_0x4956('0x1')]||'';this[_0x4956('0x2')]=_0x541ec4['password']||'';this[_0x4956('0x3')]=_0x541ec4[_0x4956('0x3')]||'';this[_0x4956('0x4')]=_0x541ec4['serverUrl']||'';this[_0x4956('0x5')]=_0x541ec4[_0x4956('0x5')]||{};}module[_0x4956('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x4a6e=['password','remoteUri','serverUrl','Configurations','username'];(function(_0x179aea,_0x53813d){var _0x19513a=function(_0x3f3d01){while(--_0x3f3d01){_0x179aea['push'](_0x179aea['shift']());}};_0x19513a(++_0x53813d);}(_0x4a6e,0x17b));var _0xe4a6=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x4a6e[_0x1e1965];return _0x1a2e96;};'use strict';function SugarcrmAccount(_0x4afecd){this['id']=_0x4afecd['id']||0x0;this['name']=_0x4afecd['name']||'';this['username']=_0x4afecd[_0xe4a6('0x0')]||'';this[_0xe4a6('0x1')]=_0x4afecd[_0xe4a6('0x1')]||'';this[_0xe4a6('0x2')]=_0x4afecd['remoteUri']||'';this[_0xe4a6('0x3')]=_0x4afecd[_0xe4a6('0x3')]||'';this[_0xe4a6('0x4')]=_0x4afecd[_0xe4a6('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 644c391..07494b7 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 _0xa10e=['name','state','unknown','stateTime','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa10e,0xa0));var _0xea10=function(_0x46e9d5,_0xd919f6){_0x46e9d5=_0x46e9d5-0x0;var _0x39181f=_0xa10e[_0x46e9d5];return _0x39181f;};'use strict';function Telephone(_0x4a2535){this['id']=_0x4a2535['id']||0x0;this[_0xea10('0x0')]=_0x4a2535[_0xea10('0x0')]||'';this['accountcode']=_0x4a2535['accountcode']||'';this[_0xea10('0x1')]=_0xea10('0x2');this[_0xea10('0x3')]=0x0;this['status']=_0xea10('0x2');this['address']='';}module[_0xea10('0x4')]=Telephone; \ No newline at end of file +var _0x41f8=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x2d9bb1,_0x43c5ea){var _0xa725f1=function(_0x4b212f){while(--_0x4b212f){_0x2d9bb1['push'](_0x2d9bb1['shift']());}};_0xa725f1(++_0x43c5ea);}(_0x41f8,0x14b));var _0x841f=function(_0x5478cd,_0x1c5e89){_0x5478cd=_0x5478cd-0x0;var _0x1f2099=_0x41f8[_0x5478cd];return _0x1f2099;};'use strict';function Telephone(_0x4fac87){this['id']=_0x4fac87['id']||0x0;this[_0x841f('0x0')]=_0x4fac87[_0x841f('0x0')]||'';this[_0x841f('0x1')]=_0x4fac87[_0x841f('0x1')]||'';this[_0x841f('0x2')]=_0x841f('0x3');this[_0x841f('0x4')]=0x0;this[_0x841f('0x5')]=_0x841f('0x3');this[_0x841f('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3c25281..90a13bc 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 _0xf7c4=['html','exports','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf7c4,0xc2));var _0x4f7c=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xf7c4[_0x1caf6a];return _0x1bf493;};'use strict';function template(_0x359199){this['id']=_0x359199['id']||0x0;this[_0x4f7c('0x0')]=_0x359199[_0x4f7c('0x0')]||'';this['html']=_0x359199[_0x4f7c('0x1')]||'';}module[_0x4f7c('0x2')]=template; \ No newline at end of file +var _0xc0c4=['html','exports','name'];(function(_0x1ce1f7,_0x2930a2){var _0x15ba94=function(_0x2997bd){while(--_0x2997bd){_0x1ce1f7['push'](_0x1ce1f7['shift']());}};_0x15ba94(++_0x2930a2);}(_0xc0c4,0x1a3));var _0x4c0c=function(_0x4fcde8,_0x19b8b3){_0x4fcde8=_0x4fcde8-0x0;var _0x4355ba=_0xc0c4[_0x4fcde8];return _0x4355ba;};'use strict';function template(_0x33c762){this['id']=_0x33c762['id']||0x0;this[_0x4c0c('0x0')]=_0x33c762[_0x4c0c('0x0')]||'';this[_0x4c0c('0x1')]=_0x33c762[_0x4c0c('0x1')]||'';}module[_0x4c0c('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7bfad7d..18cb57b 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(_0x3df34f,_0xa135f4){var _0x5144eb=function(_0x3f0b46){while(--_0x3f0b46){_0x3df34f['push'](_0x3df34f['shift']());}};_0x5144eb(++_0xa135f4);}(_0xa41a,0x6b));var _0xaa41=function(_0x5a7e1d,_0x4595db){_0x5a7e1d=_0x5a7e1d-0x0;var _0x2ddba6=_0xa41a[_0x5a7e1d];return _0x2ddba6;};'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 _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x53042a,_0x36cc4d){var _0x321b5f=function(_0x2e8cc9){while(--_0x2e8cc9){_0x53042a['push'](_0x53042a['shift']());}};_0x321b5f(++_0x36cc4d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x4b84[_0x14a0a0];return _0x56b651;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bb8800a..993ea5d 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 _0xfacc=['registrationtime','exports','active','name','state','unknown','stateTime','registry','indexOf','split','port','domain'];(function(_0x217631,_0x12dbbd){var _0x242bba=function(_0x50aeec){while(--_0x50aeec){_0x217631['push'](_0x217631['shift']());}};_0x242bba(++_0x12dbbd);}(_0xfacc,0x1be));var _0xcfac=function(_0x31d217,_0xa38636){_0x31d217=_0x31d217-0x0;var _0x3eaacb=_0xfacc[_0x31d217];return _0x3eaacb;};'use strict';function Trunk(_0x14f0ab){this['id']=_0x14f0ab['id']||0x0;this[_0xcfac('0x0')]=_0x14f0ab[_0xcfac('0x0')]||![];this[_0xcfac('0x1')]=_0x14f0ab[_0xcfac('0x1')]||'';this[_0xcfac('0x2')]=_0xcfac('0x3');this[_0xcfac('0x4')]=0x0;this['status']=_0xcfac('0x3');this[_0xcfac('0x5')]=_0x14f0ab['registry']&&_0x14f0ab[_0xcfac('0x5')][_0xcfac('0x6')](':')?_0x14f0ab['registry'][_0xcfac('0x7')](':')[0x0]:'';this['host']='';this[_0xcfac('0x8')]='';this[_0xcfac('0x9')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0xcfac('0x3');this[_0xcfac('0xa')]='';this['address']='';}module[_0xcfac('0xb')]=Trunk; \ No newline at end of file +var _0x2064=['address','active','name','unknown','status','registry','indexOf','split','port','domainport','stateRegistry','registrationtime'];(function(_0x5f05e0,_0x4e3608){var _0x398b07=function(_0x3be311){while(--_0x3be311){_0x5f05e0['push'](_0x5f05e0['shift']());}};_0x398b07(++_0x4e3608);}(_0x2064,0x79));var _0x4206=function(_0x45c1cc,_0x4ff8e7){_0x45c1cc=_0x45c1cc-0x0;var _0x5505c9=_0x2064[_0x45c1cc];return _0x5505c9;};'use strict';function Trunk(_0x463504){this['id']=_0x463504['id']||0x0;this[_0x4206('0x0')]=_0x463504[_0x4206('0x0')]||![];this[_0x4206('0x1')]=_0x463504[_0x4206('0x1')]||'';this['state']=_0x4206('0x2');this['stateTime']=0x0;this[_0x4206('0x3')]=_0x4206('0x2');this[_0x4206('0x4')]=_0x463504[_0x4206('0x4')]&&_0x463504['registry'][_0x4206('0x5')](':')?_0x463504[_0x4206('0x4')][_0x4206('0x6')](':')[0x0]:'';this['host']='';this[_0x4206('0x7')]='';this['domain']='';this[_0x4206('0x8')]='';this['refresh']='';this[_0x4206('0x9')]=_0x4206('0x2');this[_0x4206('0xa')]='';this[_0x4206('0xb')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b4ffdcb..ba570b7 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 _0xb4c0=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x56a591,_0x3982c0){var _0x3f029c=function(_0x1a49cc){while(--_0x1a49cc){_0x56a591['push'](_0x56a591['shift']());}};_0x3f029c(++_0x3982c0);}(_0xb4c0,0xa8));var _0x0b4c=function(_0x32c648,_0x12b359){_0x32c648=_0x32c648-0x0;var _0x55f4e6=_0xb4c0[_0x32c648];return _0x55f4e6;};'use strict';function voiceExtension(_0x46912f){this['id']=_0x46912f['id']||0x0;this[_0x0b4c('0x0')]=_0x46912f[_0x0b4c('0x0')]||'';this[_0x0b4c('0x1')]=_0x46912f[_0x0b4c('0x1')]||_0x0b4c('0x2');this['mandatoryDisposition']=_0x46912f[_0x0b4c('0x3')]||![];}module[_0x0b4c('0x4')]=voiceExtension; \ No newline at end of file +var _0x272d=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x272d,0x10d));var _0xd272=function(_0x204dc6,_0xf19d46){_0x204dc6=_0x204dc6-0x0;var _0x24a5eb=_0x272d[_0x204dc6];return _0x24a5eb;};'use strict';function voiceExtension(_0x2cce49){this['id']=_0x2cce49['id']||0x0;this[_0xd272('0x0')]=_0x2cce49[_0xd272('0x0')]||'';this[_0xd272('0x1')]=_0x2cce49['recordingFormat']||_0xd272('0x2');this[_0xd272('0x3')]=_0x2cce49[_0xd272('0x3')]||![];}module[_0xd272('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 cca8aef..be1a712 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 _0x4c48=['dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient'];(function(_0x5d128a,_0x364c5d){var _0x15d9e5=function(_0x276df8){while(--_0x276df8){_0x5d128a['push'](_0x5d128a['shift']());}};_0x15d9e5(++_0x364c5d);}(_0x4c48,0x15d));var _0x84c4=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x4c48[_0x25662e];return _0x59b7bc;};'use strict';var statusDesc=[_0x84c4('0x0'),_0x84c4('0x1'),'inuse','busy',_0x84c4('0x2'),_0x84c4('0x3'),_0x84c4('0x4'),_0x84c4('0x5'),'onhold'];var monitorFormat={'wav':_0x84c4('0x6'),'wav49':_0x84c4('0x7'),'gsm':_0x84c4('0x8')};var strategy={'rrmemory':_0x84c4('0x9'),'roundrobin':_0x84c4('0xa')};function VoiceQueue(_0x3a153d){this['id']=_0x3a153d['id']||0x0;this[_0x84c4('0xb')]=_0x3a153d['name']||'';this[_0x84c4('0xc')]=_0x3a153d[_0x84c4('0xc')]||'';this[_0x84c4('0xd')]=_0x3a153d[_0x84c4('0xd')]||'inbound';this[_0x84c4('0xe')]=0x0;this['talking']=0x0;this[_0x84c4('0xf')]=0x0;this[_0x84c4('0x10')]=0x0;this['sumDuration']=0x0;this[_0x84c4('0x11')]=0x0;this[_0x84c4('0x12')]=0x0;this[_0x84c4('0x13')]=0x0;this[_0x84c4('0x14')]=0x0;this[_0x84c4('0x15')]=0x0;this['available']=0x0;this['acw']=_0x3a153d[_0x84c4('0x16')]||![];this[_0x84c4('0x17')]=_0x3a153d['acwTimeout']||0xa;this['autopause']=_0x3a153d['autopause']||'no';this[_0x84c4('0x18')]=!![];this[_0x84c4('0x19')]='';this[_0x84c4('0x1a')]=0x0;this[_0x84c4('0x1b')]=0x0;this[_0x84c4('0x1c')]=_0x3a153d[_0x84c4('0x1c')]||null;this[_0x84c4('0x1d')]=_0x3a153d[_0x84c4('0x1d')]?_0x3a153d[_0x84c4('0x1d')]:null;this[_0x84c4('0x1e')]=_0x3a153d['dialActive'];this[_0x84c4('0x1f')]=_0x3a153d['dialMethod']||_0x84c4('0x20');this[_0x84c4('0x21')]=_0x3a153d[_0x84c4('0x21')]||0x0;this[_0x84c4('0x22')]=_0x3a153d[_0x84c4('0x22')]||0x0;this[_0x84c4('0x23')]=_0x3a153d[_0x84c4('0x23')]||0x1;this[_0x84c4('0x24')]=_0x3a153d['dialPredictiveOptimization']||_0x84c4('0x25');this[_0x84c4('0x26')]=_0x3a153d[_0x84c4('0x26')]||0.03;this[_0x84c4('0x27')]=_0x3a153d[_0x84c4('0x27')]||0x258;this[_0x84c4('0x28')]=_0x3a153d['dialOriginateCallerIdName']||_0x84c4('0x29');this['dialOriginateCallerIdNumber']=_0x3a153d[_0x84c4('0x2a')]||'anonymous';this['dialOriginateTimeout']=_0x3a153d[_0x84c4('0x2b')]||0x1e;this['dialQueueOptions']=_0x3a153d['dialQueueOptions']||'tTxX';this[_0x84c4('0x2c')]=_0x3a153d['dialQueueTimeout']||0x3;this[_0x84c4('0x2d')]=_0x3a153d[_0x84c4('0x2d')]||undefined;this[_0x84c4('0x2e')]=_0x3a153d[_0x84c4('0x2e')]||0x3;this[_0x84c4('0x2f')]=_0x3a153d[_0x84c4('0x2f')]||0x96;this[_0x84c4('0x30')]=_0x3a153d['dialBusyMaxRetry']||0x3;this[_0x84c4('0x31')]=_0x3a153d[_0x84c4('0x31')]||0x96;this[_0x84c4('0x32')]=_0x3a153d['dialNoAnswerMaxRetry']||0x3;this[_0x84c4('0x33')]=_0x3a153d['dialNoAnswerRetryFrequency']||0x96;this[_0x84c4('0x34')]=_0x3a153d[_0x84c4('0x34')]||0x3;this[_0x84c4('0x35')]=_0x3a153d[_0x84c4('0x35')]||0x96;this[_0x84c4('0x36')]=_0x3a153d[_0x84c4('0x36')]||0x3;this['dialDropRetryFrequency']=_0x3a153d['dialDropRetryFrequency']||0x96;this[_0x84c4('0x37')]=_0x3a153d[_0x84c4('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x3a153d[_0x84c4('0x38')]||0x96;this[_0x84c4('0x39')]=_0x3a153d[_0x84c4('0x39')]||0x3;this[_0x84c4('0x3a')]=_0x3a153d[_0x84c4('0x3a')]||0x96;this[_0x84c4('0x3b')]=_0x3a153d[_0x84c4('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3a153d[_0x84c4('0x3c')]||0x96;this[_0x84c4('0x3d')]=_0x3a153d[_0x84c4('0x3d')]||0x4;this[_0x84c4('0x3e')]=_0x3a153d[_0x84c4('0x3e')]?_0x3a153d[_0x84c4('0x3e')]:undefined;this[_0x84c4('0x3f')]=_0x3a153d['TrunkBackup']?_0x3a153d[_0x84c4('0x3f')]:undefined;this[_0x84c4('0x40')]=_0x3a153d['dialPrefix']||undefined;this[_0x84c4('0x41')]=_0x3a153d['Interval']?_0x3a153d[_0x84c4('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x3a153d[_0x84c4('0x42')]||_0x84c4('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x3a153d[_0x84c4('0x44')]||undefined;this['dialCutDigit']=_0x3a153d[_0x84c4('0x45')]||undefined;this['strategy']=strategy[_0x3a153d['strategy']]||'rrmemory';this[_0x84c4('0x46')]=!![];this[_0x84c4('0x47')]=_0x3a153d[_0x84c4('0x47')]||![];this[_0x84c4('0x48')]=_0x3a153d[_0x84c4('0x48')];this[_0x84c4('0x49')]=_0x3a153d[_0x84c4('0x49')];this[_0x84c4('0x4a')]=_0x3a153d[_0x84c4('0x4a')];this[_0x84c4('0x4b')]=_0x3a153d[_0x84c4('0x4b')];this[_0x84c4('0x4c')]=_0x3a153d[_0x84c4('0x4c')];this[_0x84c4('0x4d')]=_0x3a153d[_0x84c4('0x4d')];this[_0x84c4('0x4e')]=_0x3a153d[_0x84c4('0x4e')];this[_0x84c4('0x4f')]=_0x3a153d['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3a153d[_0x84c4('0x50')];this[_0x84c4('0x51')]=0x0;this['pTalking']=0x0;this[_0x84c4('0x52')]=_0x3a153d[_0x84c4('0x52')];this[_0x84c4('0x53')]=0x0;this[_0x84c4('0x54')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x84c4('0x55')]=0x0;this[_0x84c4('0x56')]=0x0;this[_0x84c4('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x84c4('0x58')]=0x0;this[_0x84c4('0x59')]=0x0;this[_0x84c4('0x5a')]=0x0;this[_0x84c4('0x5b')]=undefined;this['startPredictive']=undefined;this[_0x84c4('0x5c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x84c4('0x5d')]=0x0;this[_0x84c4('0x5e')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x84c4('0x5f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x84c4('0x60')]=0x0;this[_0x84c4('0x61')]=0x0;this[_0x84c4('0x62')]=0x0;this[_0x84c4('0x63')]=_0x3a153d[_0x84c4('0x64')]||0x14;this[_0x84c4('0x65')]=_0x3a153d[_0x84c4('0x64')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x84c4('0x66')]=0x0;this[_0x84c4('0x67')]=0x1;this[_0x84c4('0x68')]=0x0;this[_0x84c4('0x69')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x84c4('0x6a')]=0x0;this['dialRecallMeTimeout']=_0x3a153d[_0x84c4('0x6b')]||0x1e;this['dialRecallInQueue']=_0x3a153d[_0x84c4('0x6c')]||![];this[_0x84c4('0x6d')]=_0x3a153d[_0x84c4('0x6d')]||undefined;this[_0x84c4('0x6e')]=_0x3a153d[_0x84c4('0x6e')]||![];this[_0x84c4('0x6f')]=_0x3a153d[_0x84c4('0x6f')]||![];this[_0x84c4('0xc')]=monitorFormat[_0x3a153d['monitor_format']]?monitorFormat[_0x3a153d[_0x84c4('0xc')]]:undefined;this[_0x84c4('0x70')]=_0x3a153d[_0x84c4('0x70')]||![];this[_0x84c4('0x71')]=_0x3a153d['mandatoryDispositionPause']?_0x3a153d[_0x84c4('0x71')]:undefined;}module[_0x84c4('0x72')]=VoiceQueue; \ No newline at end of file +var _0x15fe=['dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber'];(function(_0x485bad,_0x21c418){var _0x523c91=function(_0x7393a4){while(--_0x7393a4){_0x485bad['push'](_0x485bad['shift']());}};_0x523c91(++_0x21c418);}(_0x15fe,0x142));var _0xe15f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15fe[_0x14add3];return _0x4a174f;};'use strict';var statusDesc=[_0xe15f('0x0'),_0xe15f('0x1'),_0xe15f('0x2'),'busy',_0xe15f('0x3'),_0xe15f('0x4'),'ringing',_0xe15f('0x5'),_0xe15f('0x6')];var monitorFormat={'wav':'wav','wav49':_0xe15f('0x7'),'gsm':_0xe15f('0x8')};var strategy={'rrmemory':_0xe15f('0x9'),'roundrobin':_0xe15f('0xa')};function VoiceQueue(_0x351c93){this['id']=_0x351c93['id']||0x0;this[_0xe15f('0xb')]=_0x351c93[_0xe15f('0xb')]||'';this[_0xe15f('0xc')]=_0x351c93['monitor_format']||'';this[_0xe15f('0xd')]=_0x351c93[_0xe15f('0xd')]||_0xe15f('0xe');this[_0xe15f('0xf')]=0x0;this[_0xe15f('0x10')]=0x0;this[_0xe15f('0x11')]=0x0;this[_0xe15f('0x12')]=0x0;this[_0xe15f('0x13')]=0x0;this[_0xe15f('0x14')]=0x0;this[_0xe15f('0x15')]=0x0;this[_0xe15f('0x16')]=0x0;this[_0xe15f('0x17')]=0x0;this[_0xe15f('0x18')]=0x0;this['available']=0x0;this[_0xe15f('0x19')]=_0x351c93['acw']||![];this['acwTimeout']=_0x351c93['acwTimeout']||0xa;this['autopause']=_0x351c93[_0xe15f('0x1a')]||'no';this[_0xe15f('0x1b')]=!![];this[_0xe15f('0x1c')]='';this[_0xe15f('0x1d')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x351c93[_0xe15f('0x1e')]||null;this[_0xe15f('0x1f')]=_0x351c93[_0xe15f('0x1f')]?_0x351c93['dialGlobalInterval']:null;this[_0xe15f('0x20')]=_0x351c93['dialActive'];this[_0xe15f('0x21')]=_0x351c93['dialMethod']||_0xe15f('0x22');this[_0xe15f('0x23')]=_0x351c93['dialLimitChannel']||0x0;this[_0xe15f('0x24')]=_0x351c93[_0xe15f('0x24')]||0x0;this[_0xe15f('0x25')]=_0x351c93[_0xe15f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x351c93[_0xe15f('0x26')]||_0xe15f('0x27');this['dialPredictiveOptimizationPercentage']=_0x351c93['dialPredictiveOptimizationPercentage']||0.03;this[_0xe15f('0x28')]=_0x351c93[_0xe15f('0x28')]||0x258;this[_0xe15f('0x29')]=_0x351c93[_0xe15f('0x29')]||_0xe15f('0x2a');this[_0xe15f('0x2b')]=_0x351c93[_0xe15f('0x2b')]||_0xe15f('0x2a');this[_0xe15f('0x2c')]=_0x351c93['dialOriginateTimeout']||0x1e;this[_0xe15f('0x2d')]=_0x351c93[_0xe15f('0x2d')]||_0xe15f('0x2e');this[_0xe15f('0x2f')]=_0x351c93[_0xe15f('0x2f')]||0x3;this['dialQueueProject']=_0x351c93['dialQueueProject']||undefined;this[_0xe15f('0x30')]=_0x351c93[_0xe15f('0x30')]||0x3;this[_0xe15f('0x31')]=_0x351c93[_0xe15f('0x31')]||0x96;this[_0xe15f('0x32')]=_0x351c93[_0xe15f('0x32')]||0x3;this[_0xe15f('0x33')]=_0x351c93['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x351c93[_0xe15f('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x351c93[_0xe15f('0x35')]||0x96;this[_0xe15f('0x36')]=_0x351c93['dialNoSuchNumberMaxRetry']||0x3;this[_0xe15f('0x37')]=_0x351c93['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe15f('0x38')]=_0x351c93['dialDropMaxRetry']||0x3;this[_0xe15f('0x39')]=_0x351c93[_0xe15f('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x351c93[_0xe15f('0x3a')]||0x3;this[_0xe15f('0x3b')]=_0x351c93[_0xe15f('0x3b')]||0x96;this[_0xe15f('0x3c')]=_0x351c93[_0xe15f('0x3c')]||0x3;this[_0xe15f('0x3d')]=_0x351c93[_0xe15f('0x3d')]||0x96;this[_0xe15f('0x3e')]=_0x351c93[_0xe15f('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x351c93[_0xe15f('0x3f')]||0x96;this[_0xe15f('0x40')]=_0x351c93[_0xe15f('0x40')]||0x4;this['Trunk']=_0x351c93[_0xe15f('0x41')]?_0x351c93[_0xe15f('0x41')]:undefined;this[_0xe15f('0x42')]=_0x351c93['TrunkBackup']?_0x351c93[_0xe15f('0x42')]:undefined;this[_0xe15f('0x43')]=_0x351c93['dialPrefix']||undefined;this[_0xe15f('0x44')]=_0x351c93[_0xe15f('0x44')]?_0x351c93[_0xe15f('0x44')]:undefined;this[_0xe15f('0x45')]=_0x351c93[_0xe15f('0x45')]||_0xe15f('0x46');this[_0xe15f('0x47')]=_0x351c93[_0xe15f('0x47')]||undefined;this[_0xe15f('0x48')]=_0x351c93[_0xe15f('0x48')]||undefined;this[_0xe15f('0x49')]=strategy[_0x351c93['strategy']]||'rrmemory';this[_0xe15f('0x4a')]=!![];this[_0xe15f('0x4b')]=_0x351c93[_0xe15f('0x4b')]||![];this[_0xe15f('0x4c')]=_0x351c93['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x351c93[_0xe15f('0x4d')];this['dialAMDAfterGreetingSilence']=_0x351c93[_0xe15f('0x4e')];this[_0xe15f('0x4f')]=_0x351c93['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x351c93[_0xe15f('0x50')];this['dialAMDBetweenWordsSilence']=_0x351c93[_0xe15f('0x51')];this[_0xe15f('0x52')]=_0x351c93[_0xe15f('0x52')];this['dialAMDSilenceThreshold']=_0x351c93[_0xe15f('0x53')];this[_0xe15f('0x54')]=_0x351c93[_0xe15f('0x54')];this['outboundRejectCallsDay']=0x0;this[_0xe15f('0x55')]=0x0;this[_0xe15f('0x56')]=_0x351c93[_0xe15f('0x56')];this[_0xe15f('0x57')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xe15f('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xe15f('0x59')]=0x0;this[_0xe15f('0x5a')]=0x0;this[_0xe15f('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xe15f('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe15f('0x5d')]=0x0;this[_0xe15f('0x5e')]=0x0;this[_0xe15f('0x5f')]=0x0;this[_0xe15f('0x60')]=undefined;this[_0xe15f('0x61')]=undefined;this[_0xe15f('0x62')]=undefined;this[_0xe15f('0x63')]=1.05;this[_0xe15f('0x64')]=0x0;this[_0xe15f('0x65')]=0x0;this[_0xe15f('0x66')]=0x0;this[_0xe15f('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xe15f('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xe15f('0x69')]=_0x351c93[_0xe15f('0x6a')]||0x14;this[_0xe15f('0x6b')]=_0x351c93[_0xe15f('0x6a')]||0xa;this[_0xe15f('0x6c')]=0x0;this[_0xe15f('0x6d')]=0x0;this[_0xe15f('0x6e')]=0x1;this[_0xe15f('0x6f')]=0x0;this[_0xe15f('0x70')]=0x0;this[_0xe15f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xe15f('0x72')]=_0x351c93[_0xe15f('0x72')]||0x1e;this[_0xe15f('0x73')]=_0x351c93[_0xe15f('0x73')]||![];this[_0xe15f('0x74')]=_0x351c93[_0xe15f('0x74')]||undefined;this[_0xe15f('0x75')]=_0x351c93[_0xe15f('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x351c93[_0xe15f('0x76')]||![];this[_0xe15f('0xc')]=monitorFormat[_0x351c93[_0xe15f('0xc')]]?monitorFormat[_0x351c93[_0xe15f('0xc')]]:undefined;this[_0xe15f('0x77')]=_0x351c93[_0xe15f('0x77')]||![];this['mandatoryDispositionPause']=_0x351c93[_0xe15f('0x78')]?_0x351c93[_0xe15f('0x78')]:undefined;}module[_0xe15f('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dda4e28..656aaf4 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 _0x25f8=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x471730,_0x39555d){var _0x3a4834=function(_0xad6c6d){while(--_0xad6c6d){_0x471730['push'](_0x471730['shift']());}};_0x3a4834(++_0x39555d);}(_0x25f8,0xdd));var _0x825f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x25f8[_0x27af45];return _0x18df21;};'use strict';function VtigerAccount(_0x4a5c5c){this['id']=_0x4a5c5c['id']||0x0;this[_0x825f('0x0')]=_0x4a5c5c[_0x825f('0x0')]||'';this[_0x825f('0x1')]=_0x4a5c5c[_0x825f('0x1')]||'';this[_0x825f('0x2')]=_0x4a5c5c['accessKey']||'';this[_0x825f('0x3')]=_0x4a5c5c['remoteUri']||'';this[_0x825f('0x4')]=_0x4a5c5c[_0x825f('0x4')]||'';this[_0x825f('0x5')]=_0x4a5c5c[_0x825f('0x5')]||{};}module[_0x825f('0x6')]=VtigerAccount; \ No newline at end of file +var _0x1443=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x23fa4d,_0xea08f2){var _0x1d762a=function(_0x5d50d5){while(--_0x5d50d5){_0x23fa4d['push'](_0x23fa4d['shift']());}};_0x1d762a(++_0xea08f2);}(_0x1443,0x129));var _0x3144=function(_0x5b9bc0,_0x7b32e0){_0x5b9bc0=_0x5b9bc0-0x0;var _0x9cf24f=_0x1443[_0x5b9bc0];return _0x9cf24f;};'use strict';function VtigerAccount(_0x160ed0){this['id']=_0x160ed0['id']||0x0;this[_0x3144('0x0')]=_0x160ed0['name']||'';this['username']=_0x160ed0[_0x3144('0x1')]||'';this['accessKey']=_0x160ed0[_0x3144('0x2')]||'';this['remoteUri']=_0x160ed0[_0x3144('0x3')]||'';this[_0x3144('0x4')]=_0x160ed0[_0x3144('0x4')]||'';this[_0x3144('0x5')]=_0x160ed0['Configurations']||{};}module[_0x3144('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 79fcb34..eb95c2a 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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x4e700e,_0x4ae3ac){_0x4e700e=_0x4e700e-0x0;var _0xb9a1c2=_0xadb5[_0x4e700e];return _0xb9a1c2;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x7e2238,_0x7d77d7){var _0x1639a6=function(_0xc7ed9f){while(--_0xc7ed9f){_0x7e2238['push'](_0x7e2238['shift']());}};_0x1639a6(++_0x7d77d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a5afd,_0x4a783e){_0x5a5afd=_0x5a5afd-0x0;var _0x443e10=_0x5f2f[_0x5a5afd];return _0x443e10;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 1952f16..5d5b6ab 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 _0xcf2f=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3c24a6,_0x33313a){var _0x2e90ae=function(_0x23322e){while(--_0x23322e){_0x3c24a6['push'](_0x3c24a6['shift']());}};_0x2e90ae(++_0x33313a);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x1397f8,_0x4b6acc){_0x1397f8=_0x1397f8-0x0;var _0x112f22=_0xcf2f[_0x1397f8];return _0x112f22;};'use strict';function ZohoAccount(_0xc60f9d){this['id']=_0xc60f9d['id']||0x0;this[_0xfcf2('0x0')]=_0xc60f9d[_0xfcf2('0x0')]||'';this[_0xfcf2('0x1')]=_0xc60f9d[_0xfcf2('0x1')]||'';this['host']=_0xc60f9d[_0xfcf2('0x2')]||'';this[_0xfcf2('0x3')]=_0xc60f9d[_0xfcf2('0x3')]||'';this[_0xfcf2('0x4')]=_0xc60f9d[_0xfcf2('0x4')]||'';this[_0xfcf2('0x5')]=_0xc60f9d[_0xfcf2('0x5')]||'';this[_0xfcf2('0x6')]=_0xc60f9d[_0xfcf2('0x6')]||'';this[_0xfcf2('0x7')]=_0xc60f9d[_0xfcf2('0x7')]||'';this[_0xfcf2('0x8')]=_0xc60f9d[_0xfcf2('0x8')]||'';this[_0xfcf2('0x9')]=_0xc60f9d['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xeb3f=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x59b1f3,_0x38a596){var _0x52f133=function(_0x92c385){while(--_0x92c385){_0x59b1f3['push'](_0x59b1f3['shift']());}};_0x52f133(++_0x38a596);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';function ZohoAccount(_0x3a4a22){this['id']=_0x3a4a22['id']||0x0;this[_0xfeb3('0x0')]=_0x3a4a22[_0xfeb3('0x0')]||'';this[_0xfeb3('0x1')]=_0x3a4a22[_0xfeb3('0x1')]||'';this[_0xfeb3('0x2')]=_0x3a4a22[_0xfeb3('0x2')]||'';this[_0xfeb3('0x3')]=_0x3a4a22[_0xfeb3('0x3')]||'';this[_0xfeb3('0x4')]=_0x3a4a22[_0xfeb3('0x4')]||'';this[_0xfeb3('0x5')]=_0x3a4a22[_0xfeb3('0x5')]||'';this[_0xfeb3('0x6')]=_0x3a4a22[_0xfeb3('0x6')]||'';this['code']=_0x3a4a22[_0xfeb3('0x7')]||'';this[_0xfeb3('0x8')]=_0x3a4a22[_0xfeb3('0x8')]||'';this[_0xfeb3('0x9')]=_0x3a4a22[_0xfeb3('0x9')]||{};}module[_0xfeb3('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ed0bc61..45450ea 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 _0x1300=['number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>'];(function(_0x2b1237,_0xc671da){var _0x4c61d8=function(_0x36bfa5){while(--_0x36bfa5){_0x2b1237['push'](_0x2b1237['shift']());}};_0x4c61d8(++_0xc671da);}(_0x1300,0x86));var _0x0130=function(_0x3e743d,_0x28947f){_0x3e743d=_0x3e743d-0x0;var _0x4a327c=_0x1300[_0x3e743d];return _0x4a327c;};'use strict';var util=require(_0x0130('0x0'));var _=require(_0x0130('0x1'));var moment=require(_0x0130('0x2'));function checkNameSurname(_0x42c4d9,_0x54170a,_0x2456dd){var _0x119f42='';if(!_['isNil'](_0x54170a)&&'string'===typeof _0x54170a){_0x119f42+=_0x54170a;}if(!_[_0x0130('0x3')](_0x2456dd)&&_0x0130('0x4')===typeof _0x2456dd){_0x119f42+='\x20'+_0x2456dd;}if(_0x119f42!==''){return _0x119f42;}return _0x42c4d9;}function Action(_0x33ea92,_0x3afb31,_0x53076a,_0x203add,_0x109a36){this[_0x0130('0x5')]=_0x53076a||undefined;this[_0x0130('0x6')]=_0x33ea92['id'];this['queue']=_0x3afb31[_0x0130('0x7')];this[_0x0130('0x8')]=_0x3afb31[_0x0130('0x8')];this[_0x0130('0x9')]=_0x0130('0xa');this[_0x0130('0xb')]=![];this[_0x0130('0xc')]=_[_0x0130('0x3')](_0x33ea92[_0x0130('0xd')])?undefined:_0x33ea92[_0x0130('0xd')][_0x0130('0x7')];this[_0x0130('0xe')]=this[_0x0130('0xc')]?util[_0x0130('0xf')]('SIP/%s',this[_0x0130('0xc')]):_0x203add||undefined;this['calleridname']=checkNameSurname(_0x33ea92[_0x0130('0x10')][_0x0130('0x11')],_0x33ea92[_0x0130('0x10')][_0x0130('0x12')],_0x33ea92[_0x0130('0x10')][_0x0130('0x13')]);this[_0x0130('0x14')]=_0x33ea92[_0x0130('0x14')]||![];this['calleridnum']=_0x33ea92[_0x0130('0x10')][_0x0130('0x11')];this['scheduledat']=_0x33ea92[_0x0130('0x15')];this['countbusyretry']=_0x33ea92[_0x0130('0x16')]||0x0;this[_0x0130('0x17')]=_0x33ea92[_0x0130('0x17')]||0x0;this['countnoanswerretry']=_0x33ea92[_0x0130('0x18')]||0x0;this[_0x0130('0x19')]=(_0x33ea92[_0x0130('0x16')]||0x0)+(_0x33ea92[_0x0130('0x17')]||0x0)+(_0x33ea92[_0x0130('0x18')]||0x0)+(_0x33ea92['countnosuchnumberretry']||0x0)+(_0x33ea92['countdropretry']||0x0)+(_0x33ea92[_0x0130('0x1a')]||0x0)+(_0x33ea92['countmachineretry']||0x0)+(_0x33ea92[_0x0130('0x1b')]||0x0);this[_0x0130('0x1c')]=_0x33ea92[_0x0130('0x1c')]||0x0;this['countdropretry']=_0x33ea92[_0x0130('0x1d')]||0x0;this[_0x0130('0x1a')]=_0x33ea92[_0x0130('0x1a')]||0x0;this['countmachineretry']=_0x33ea92[_0x0130('0x1e')]||0x0;this[_0x0130('0x1b')]=_0x33ea92[_0x0130('0x1b')]||0x0;this[_0x0130('0x1f')]=_0x33ea92[_0x0130('0x1f')];this[_0x0130('0x20')]=_0x33ea92['callbackuniqueid'];this['callbackat']=_0x33ea92['callbackat'];this[_0x0130('0x21')]=_0x33ea92[_0x0130('0x21')];this['ContactId']=_0x33ea92['ContactId'];this[_0x0130('0x22')]=_0x33ea92[_0x0130('0x22')];this[_0x0130('0x23')]=_[_0x0130('0x3')](_0x33ea92[_0x0130('0xd')])?_0x33ea92[_0x0130('0x23')]:_0x33ea92[_0x0130('0xd')]['id'];this[_0x0130('0x24')]=_0x33ea92[_0x0130('0x24')];this[_0x0130('0x25')]='';this[_0x0130('0x26')]='';}Action[_0x0130('0x27')][_0x0130('0x28')]=function(){return util[_0x0130('0xf')](_0x0130('0x29'),this['calleridname'],this[_0x0130('0x2a')]);};module[_0x0130('0x2b')]=Action; \ No newline at end of file +var _0xebf7=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry'];(function(_0x5bfea1,_0x494abb){var _0x42d2fa=function(_0x33261d){while(--_0x33261d){_0x5bfea1['push'](_0x5bfea1['shift']());}};_0x42d2fa(++_0x494abb);}(_0xebf7,0x1cd));var _0x7ebf=function(_0x541ea9,_0x582004){_0x541ea9=_0x541ea9-0x0;var _0x1685e3=_0xebf7[_0x541ea9];return _0x1685e3;};'use strict';var util=require(_0x7ebf('0x0'));var _=require(_0x7ebf('0x1'));var moment=require(_0x7ebf('0x2'));function checkNameSurname(_0x5c7c28,_0xdc1abe,_0x1daeab){var _0x4bd729='';if(!_[_0x7ebf('0x3')](_0xdc1abe)&&_0x7ebf('0x4')===typeof _0xdc1abe){_0x4bd729+=_0xdc1abe;}if(!_[_0x7ebf('0x3')](_0x1daeab)&&_0x7ebf('0x4')===typeof _0x1daeab){_0x4bd729+='\x20'+_0x1daeab;}if(_0x4bd729!==''){return _0x4bd729;}return _0x5c7c28;}function Action(_0x2ebd26,_0x4fe421,_0x147eae,_0x154d08,_0x134a61){this['uniqueid']=_0x147eae||undefined;this[_0x7ebf('0x5')]=_0x2ebd26['id'];this[_0x7ebf('0x6')]=_0x4fe421[_0x7ebf('0x7')];this[_0x7ebf('0x8')]=_0x4fe421['type'];this[_0x7ebf('0x9')]=_0x7ebf('0x6');this[_0x7ebf('0xa')]=![];this[_0x7ebf('0xb')]=_[_0x7ebf('0x3')](_0x2ebd26[_0x7ebf('0xc')])?undefined:_0x2ebd26[_0x7ebf('0xc')][_0x7ebf('0x7')];this['channelAgent']=this[_0x7ebf('0xb')]?util[_0x7ebf('0xd')](_0x7ebf('0xe'),this['membername']):_0x154d08||undefined;this[_0x7ebf('0xf')]=checkNameSurname(_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x11')],_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x12')],_0x2ebd26[_0x7ebf('0x10')]['lastName']);this['active']=_0x2ebd26[_0x7ebf('0x13')]||![];this['calleridnum']=_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x11')];this['scheduledat']=_0x2ebd26[_0x7ebf('0x14')];this[_0x7ebf('0x15')]=_0x2ebd26[_0x7ebf('0x15')]||0x0;this[_0x7ebf('0x16')]=_0x2ebd26['countcongestionretry']||0x0;this[_0x7ebf('0x17')]=_0x2ebd26['countnoanswerretry']||0x0;this['countglobal']=(_0x2ebd26[_0x7ebf('0x15')]||0x0)+(_0x2ebd26[_0x7ebf('0x16')]||0x0)+(_0x2ebd26[_0x7ebf('0x17')]||0x0)+(_0x2ebd26[_0x7ebf('0x18')]||0x0)+(_0x2ebd26[_0x7ebf('0x19')]||0x0)+(_0x2ebd26[_0x7ebf('0x1a')]||0x0)+(_0x2ebd26[_0x7ebf('0x1b')]||0x0)+(_0x2ebd26[_0x7ebf('0x1c')]||0x0);this[_0x7ebf('0x18')]=_0x2ebd26[_0x7ebf('0x18')]||0x0;this[_0x7ebf('0x19')]=_0x2ebd26[_0x7ebf('0x19')]||0x0;this['countabandonedretry']=_0x2ebd26[_0x7ebf('0x1a')]||0x0;this[_0x7ebf('0x1b')]=_0x2ebd26['countmachineretry']||0x0;this['countagentrejectretry']=_0x2ebd26[_0x7ebf('0x1c')]||0x0;this[_0x7ebf('0x1d')]=_0x2ebd26[_0x7ebf('0x1d')];this[_0x7ebf('0x1e')]=_0x2ebd26[_0x7ebf('0x1e')];this[_0x7ebf('0x1f')]=_0x2ebd26['callbackat'];this[_0x7ebf('0x20')]=_0x2ebd26[_0x7ebf('0x20')];this[_0x7ebf('0x21')]=_0x2ebd26['ContactId'];this['ListId']=_0x2ebd26[_0x7ebf('0x22')];this[_0x7ebf('0x23')]=_['isNil'](_0x2ebd26[_0x7ebf('0xc')])?_0x2ebd26['UserId']:_0x2ebd26[_0x7ebf('0xc')]['id'];this[_0x7ebf('0x24')]=_0x2ebd26[_0x7ebf('0x24')];this[_0x7ebf('0x25')]='';this[_0x7ebf('0x26')]='';}Action[_0x7ebf('0x27')][_0x7ebf('0x28')]=function(){return util['format'](_0x7ebf('0x29'),this['calleridname'],this[_0x7ebf('0x2a')]);};module[_0x7ebf('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f3da1a6..4c43eaf 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 _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x506ae6,_0x1a3a48){var _0x2bbc5c=function(_0x63ba84){while(--_0x63ba84){_0x506ae6['push'](_0x506ae6['shift']());}};_0x2bbc5c(++_0x1a3a48);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file +var _0xd8b0=['[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','decrementTalkink','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','ANSWER','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','execRun','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','channel','actionid','logLookAgent','clone','isFailure','unlockContact','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','outbound','hasOwnProperty','setMessage','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','size','recallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0d8b('0x2'));var Redis=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x0d8b('0x7'));var rpcDb=require(_0x0d8b('0x8'));var Action=require(_0x0d8b('0x9'));var ut=require('./util/util');config[_0x0d8b('0xa')]=_[_0x0d8b('0xb')](config['redis'],{'host':_0x0d8b('0xc'),'port':0x18eb});var io=require(_0x0d8b('0xd'))(new Redis(config[_0x0d8b('0xa')]));var Sequence=function(){};Sequence[_0x0d8b('0xe')][_0x0d8b('0xf')]=function(_0x1cac62){this[_0x0d8b('0x10')]=this[_0x0d8b('0x10')]?this['tail'][_0x0d8b('0x11')](_0x1cac62):_0x1cac62();};function Preview(_0x4e0269){this[_0x0d8b('0x12')]=new Sequence();this[_0x0d8b('0x13')]=_0x4e0269[_0x0d8b('0x14')];this[_0x0d8b('0x15')]=_0x4e0269[_0x0d8b('0x15')];this[_0x0d8b('0x16')]={};this[_0x0d8b('0x17')]=_0x4e0269[_0x0d8b('0x17')];this[_0x0d8b('0x18')]=0x0;ami['on'](_0x0d8b('0x19'),this[_0x0d8b('0x1a')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x1c'),this[_0x0d8b('0x1d')]['bind'](this));ami['on'](_0x0d8b('0x1e'),this[_0x0d8b('0x1f')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x20'),this[_0x0d8b('0x21')]['bind'](this));ami['on'](_0x0d8b('0x22'),this[_0x0d8b('0x23')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x24'),this[_0x0d8b('0x25')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x26'),this[_0x0d8b('0x27')]['bind'](this));ami['on'](_0x0d8b('0x28'),this[_0x0d8b('0x29')][_0x0d8b('0x1b')](this));this[_0x0d8b('0x2a')](this[_0x0d8b('0x13')]);}function emit(_0x5b709c,_0x393beb,_0x352c17){io['to'](_0x5b709c)['emit'](_0x393beb,_0x352c17);}function emitCampaignPreview(_0x4f0a1a){if(_0x4f0a1a[_0x0d8b('0x2b')]==='outbound'){var _0x56c729={'id':_0x4f0a1a['id'],'name':_0x4f0a1a['name'],'strategy':_0x4f0a1a[_0x0d8b('0x2c')],'answered':_0x4f0a1a[_0x0d8b('0x2d')],'available':_0x4f0a1a[_0x0d8b('0x2e')],'loggedIn':_0x4f0a1a[_0x0d8b('0x2f')],'pTalking':_0x4f0a1a[_0x0d8b('0x30')],'sumBillable':_0x4f0a1a[_0x0d8b('0x31')],'sumDuration':_0x4f0a1a[_0x0d8b('0x32')],'sumHoldTime':_0x4f0a1a[_0x0d8b('0x33')]||0x0,'talking':_0x4f0a1a[_0x0d8b('0x34')],'total':_0x4f0a1a['total'],'type':_0x4f0a1a[_0x0d8b('0x2b')],'unmanaged':_0x4f0a1a[_0x0d8b('0x35')],'abandoned':_0x4f0a1a['abandoned'],'waiting':_0x4f0a1a[_0x0d8b('0x36')],'loggedInDb':_0x4f0a1a['loggedInDb'],'dialActive':_0x4f0a1a[_0x0d8b('0x37')],'dialMethod':_0x4f0a1a[_0x0d8b('0x38')],'dialOriginateCallerIdName':_0x4f0a1a[_0x0d8b('0x39')],'dialOriginateCallerIdNumber':_0x4f0a1a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4f0a1a['dialOriginateTimeout'],'dialPrefix':_0x4f0a1a[_0x0d8b('0x3a')],'outboundAnswerAgiCallsDay':_0x4f0a1a[_0x0d8b('0x3b')],'outboundAnswerCallsDay':_0x4f0a1a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4f0a1a[_0x0d8b('0x3c')],'outboundBusyCallsDay':_0x4f0a1a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4f0a1a[_0x0d8b('0x3d')],'outboundDropCallsDayACS':_0x4f0a1a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4f0a1a[_0x0d8b('0x3e')],'outboundDropCallsDayTimeout':_0x4f0a1a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4f0a1a[_0x0d8b('0x3f')],'outboundNoSuchCallsDay':_0x4f0a1a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4f0a1a[_0x0d8b('0x40')],'outboundReCallsDay':_0x4f0a1a['outboundReCallsDay'],'outboundRejectCallsDay':_0x4f0a1a[_0x0d8b('0x41')],'outboundUnknownCallsDay':_0x4f0a1a[_0x0d8b('0x42')],'outboundAbandonedCallsDay':_0x4f0a1a[_0x0d8b('0x43')],'predictiveIntervalAnsweredCalls':_0x4f0a1a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4f0a1a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4f0a1a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4f0a1a[_0x0d8b('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4f0a1a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4f0a1a[_0x0d8b('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f0a1a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4f0a1a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4f0a1a[_0x0d8b('0x46')],'predictiveIntervalPauses':_0x4f0a1a[_0x0d8b('0x47')],'predictiveIntervalAvailable':_0x4f0a1a[_0x0d8b('0x48')],'predictiveIntervalTotalCalls':_0x4f0a1a[_0x0d8b('0x49')],'message':_0x4f0a1a[_0x0d8b('0x4a')],'originated':_0x4f0a1a[_0x0d8b('0x4b')],'erlangCalls':_0x4f0a1a[_0x0d8b('0x4c')],'erlangCallToSecond':_0x4f0a1a[_0x0d8b('0x4d')],'erlangAbandonmentRate':_0x4f0a1a['erlangAbandonmentRate'],'erlangBusyFactor':_0x4f0a1a[_0x0d8b('0x4e')],'startPredictive':_0x4f0a1a[_0x0d8b('0x4f')],'startProgressive':_0x4f0a1a['startProgressive']};if(_0x4f0a1a[_0x0d8b('0x50')]){_0x56c729[_0x0d8b('0x50')]={'id':_0x4f0a1a[_0x0d8b('0x50')]['id'],'name':_0x4f0a1a['Trunk'][_0x0d8b('0x51')],'active':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x52')],'callerid':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x53')]};}if(_0x4f0a1a['Interval']){_0x56c729[_0x0d8b('0x54')]={'id':_0x4f0a1a[_0x0d8b('0x54')]['id'],'name':_0x4f0a1a['Interval'][_0x0d8b('0x51')]};}var _0x3cc3ee=md5(JSON[_0x0d8b('0x55')](_0x56c729));if(_0x4f0a1a[_0x0d8b('0x2')]!==_0x3cc3ee){_0x4f0a1a[_0x0d8b('0x2')]=_0x3cc3ee;emit(util['format']('voice:queue:%s',_0x56c729[_0x0d8b('0x51')]),'voice_queue:save',_0x56c729);}}}function emitVoiceQueueChannelRemove(_0x531c55){logger[_0x0d8b('0x56')](_0x0d8b('0x57'),JSON[_0x0d8b('0x55')](_0x531c55));emit(util[_0x0d8b('0x58')](_0x0d8b('0x59'),_0x531c55[_0x0d8b('0x51')]),'voice_queue_channel:remove',_0x531c55);}function notSendMessagesQueue(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x5a')]){if(_0x6e5bab[_0x0d8b('0x4b')]===0x0&&_0x6e5bab[_0x0d8b('0x30')]===0x0){_0x6e5bab[_0x0d8b('0x5a')]=![];_0x6e5bab[_0x0d8b('0x2e')]=0x0;_0x6e5bab[_0x0d8b('0x5b')]=0x0;_0x6e5bab['message']=_0x0d8b('0x5c');ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+'\x20is\x20not\x20active');}else{_0x6e5bab[_0x0d8b('0x4a')]='IS_DISACTIVED';ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+_0x0d8b('0x5f'));}emitCampaignPreview(_0x6e5bab);}}Preview[_0x0d8b('0xe')][_0x0d8b('0x2a')]=function(){var _0x1ff17d=this;setInterval(function(){_0x1ff17d[_0x0d8b('0x60')]();},0x7cf);};Preview[_0x0d8b('0xe')][_0x0d8b('0x60')]=function(){var _0x482069=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x4d0811 in _0x482069){if(_0x482069['hasOwnProperty'](_0x4d0811)&&(_0x482069[_0x4d0811][_0x0d8b('0x38')]===_0x0d8b('0x6')||_0x482069[_0x4d0811][_0x0d8b('0x38')]==='booked')&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(this[_0x0d8b('0x18')]>0x7){this[_0x0d8b('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x482069[_0x0d8b('0x62')](_0x4d0811)&&_0x482069[_0x4d0811][_0x0d8b('0x38')]==='preview'&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(_0x482069[_0x4d0811]['dialActive']){this[_0x0d8b('0x63')](_0x482069[_0x4d0811]);this['recallMe'](_0x482069[_0x4d0811]);}else{notSendMessagesQueue(_0x482069[_0x4d0811]);}}}};Preview['prototype'][_0x0d8b('0x64')]=function(_0x194f17){var _0x5a75c7=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5a75c7[_0x0d8b('0x16')][_0x194f17])){loggerAction[_0x0d8b('0x56')](_0x0d8b('0x65'),_0x194f17,'Queue',_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')],_0x0d8b('0x67'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x4b')]),_0x0d8b('0x68'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x30')]),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x69')]),JSON[_0x0d8b('0x55')](_[_0x0d8b('0x6a')](_0x5a75c7['actions'][_0x194f17],[_0x0d8b('0x6b'),'UserId','VoiceQueueId',_0x0d8b('0x6c')])));return ami[_0x0d8b('0x6d')]({'action':_0x0d8b('0x6e'),'channel':_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['channel']})[_0x0d8b('0x6f')](function(_0x1106d6){if(_0x1106d6[_0x0d8b('0x4a')]===_0x0d8b('0x70')){setTimeout(function(){if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]){ut['updateOriginated'](_0x5a75c7['campaignsPreview'][_0x5a75c7['actions'][_0x194f17]['queue']],_0x0d8b('0x71'));if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['dialAnswer']===!![]){ut['decrementTalkink'](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['queue']],'[clearZombieChannel]');ut[_0x0d8b('0x72')](_0x0d8b('0x73')+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);}ut[_0x0d8b('0x72')]('[Dialer][checkChannel][Preview]'+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);delete _0x5a75c7['actions'][_0x194f17];}},0x2328);}});}});};Preview['prototype'][_0x0d8b('0x74')]=function(){var _0x3f2d95=this;loggerAction['info']('[action]',_[_0x0d8b('0x75')](this[_0x0d8b('0x16')]));for(var _0x377027 in this[_0x0d8b('0x16')]){if(_0x3f2d95['actions'][_0x0d8b('0x62')](_0x377027)){_0x3f2d95['clearZombieChannel'](_0x377027);}}};Preview['prototype'][_0x0d8b('0x76')]=function(_0x44043b){var _0x54aa03=this;rpcDb['getContactRecallMe'](_0x44043b['id'],ut[_0x0d8b('0x77')](this[_0x0d8b('0x17')]))[_0x0d8b('0x78')](function(_0x2c1eb0){if(!_[_0x0d8b('0x79')](_0x2c1eb0)){for(var _0xb66e76=0x0;_0xb66e76<_0x2c1eb0[_0x0d8b('0x7a')];_0xb66e76+=0x1){if(ut[_0x0d8b('0x7b')](_0x2c1eb0[_0xb66e76]['scheduledat'])<_0x44043b[_0x0d8b('0x7c')]*0x3c){if(_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')]&&!_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')][_0x0d8b('0x7e')]){_0x54aa03[_0x0d8b('0x7f')](_0x2c1eb0[_0xb66e76]['id'])[_0x0d8b('0x78')](ut[_0x0d8b('0x80')](_0x0d8b('0x81')))[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x81')));}else{rpcDb[_0x0d8b('0x82')](_0x2c1eb0[_0xb66e76]['id']);}}else{var _0x180b7b=new Action(_0x2c1eb0[_0xb66e76],_0x44043b);_0x180b7b[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x44043b[_0x0d8b('0x84')]+=0x1;ut[_0x0d8b('0x85')](_0x180b7b,0x17,_0x0d8b('0x86'));if(_0x44043b[_0x0d8b('0x87')]){rpcDb[_0x0d8b('0x88')](ut['createBody'](_0x2c1eb0[_0xb66e76]));rpcDb['createCustomerHistory'](_0x180b7b,_0x0d8b('0x89'));}else{ut[_0x0d8b('0x85')](_0x180b7b,0x16,_0x0d8b('0x8a'));rpcDb[_0x0d8b('0x8b')](_0x180b7b,'[HistoryRecallClose]');rpcDb[_0x0d8b('0x8c')](_0x180b7b,_0x0d8b('0x8d'));}}}}})[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x8e')));};Preview['prototype'][_0x0d8b('0x63')]=function(_0x3ed63e){_0x3ed63e[_0x0d8b('0x5a')]=!![];if(ut[_0x0d8b('0x8f')](_0x3ed63e[_0x0d8b('0x2f')])){_0x3ed63e[_0x0d8b('0x4a')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0d8b('0x90')](_0x3ed63e['dialActive'])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x5c');}else if(!this[_0x0d8b('0x91')](_0x3ed63e[_0x0d8b('0x50')])){if(!this['isTrunkReachable'](_0x3ed63e[_0x0d8b('0x92')])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x93');}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}emitCampaignPreview(_0x3ed63e);};Preview[_0x0d8b('0xe')][_0x0d8b('0x95')]=function(_0x34affb,_0x57e39a,_0x4ee1e8){var _0x6388ae=this;var _0x3eb647=this['actions'][_0x57e39a];var _0xb1aa96=this['campaignsPreview'][_0x3eb647['queue']];var _0x22ee20;if(_0xb1aa96){switch(_0x4ee1e8){case'1':_0xb1aa96[_0x0d8b('0x96')]+=0x1;_0x3eb647['countnosuchnumberretry']+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x0,_0x0d8b('0x98'));ami[_0x0d8b('0x99')](_0x0d8b('0x9a'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0x9c')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0x9d'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3eb647[_0x0d8b('0xa1')]>=_0xb1aa96['dialNoSuchNumberMaxRetry']){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xa2'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xa1'),_0xb1aa96[_0x0d8b('0xa5')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];break;case'ANSWER':var _0x1436b3=moment()['format'](_0x0d8b('0xa9'));_0x3eb647[_0x0d8b('0xaa')]=_0x1436b3;_0x3eb647['answertime']=_0x1436b3;_0x3eb647[_0x0d8b('0x69')]=!![];_0xb1aa96['pTalking']+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0xab'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],_0x0d8b('0x68'),_0xb1aa96[_0x0d8b('0x30')]);ami[_0x0d8b('0x99')]('custom:agentconnect',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xae'),this['campaignsPreview'][_0x3eb647[_0x0d8b('0x66')]]));if(_0xb1aa96[_0x0d8b('0xaf')]){ami[_0x0d8b('0x99')](_0x0d8b('0xb0'),ut[_0x0d8b('0xb1')](_0x3eb647));}break;case'16':ami[_0x0d8b('0x99')](_0x0d8b('0xb2'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xb3'),this[_0x0d8b('0x13')][_0x3eb647[_0x0d8b('0x66')]]));emitVoiceQueueChannelRemove(ut[_0x0d8b('0x9b')](_0x3eb647,'complete'));_0xb1aa96[_0x0d8b('0xb4')]+=0x1;_0xb1aa96[_0x0d8b('0xb5')]+=0x1;_0xb1aa96[_0x0d8b('0x2d')]+=0x1;ut['decrementTalkink'](_0xb1aa96,'[16]');_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x4,'Answer');rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xb7'));rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xb8'));rpcDb[_0x0d8b('0xb9')](_0x3eb647);_0xb1aa96[_0x0d8b('0x32')]+=_0x3eb647[_0x0d8b('0xba')];_0xb1aa96[_0x0d8b('0x31')]+=_0x3eb647[_0x0d8b('0xba')];logger[_0x0d8b('0x56')](_0x0d8b('0xbb'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],'pTalking:\x20',_0xb1aa96[_0x0d8b('0x30')]);delete this[_0x0d8b('0x16')][_0x34affb['linkedid']];break;case'BUSY':_0xb1aa96[_0x0d8b('0xbc')]+=0x1;_0x3eb647[_0x0d8b('0xbd')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x5,_0x0d8b('0xbe'));ami['emit']('custom:agentbusy',ut['buildObj'](_0x3eb647,_0x0d8b('0xbf')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc0'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xc1'));}else{if(_0x3eb647['countbusyretry']>=_0xb1aa96[_0x0d8b('0xc2')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xc0'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xbd'),_0xb1aa96[_0x0d8b('0xc3')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xc4'):_0xb1aa96[_0x0d8b('0x3f')]+=0x1;_0x3eb647[_0x0d8b('0xc5')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut['logCustomer'](_0x3eb647,0x3,'NoAnswer');ami[_0x0d8b('0x99')](_0x0d8b('0xc6'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xc7')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc8'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3eb647['countnoanswerretry']>=_0xb1aa96[_0x0d8b('0xc9')]){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xc8'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xc5'),_0xb1aa96[_0x0d8b('0xca')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xcb'):_0xb1aa96[_0x0d8b('0x3d')]+=0x1;_0x3eb647[_0x0d8b('0xcc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x8,_0x0d8b('0xcd'));ami['emit']('custom:agentcongestion',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xce')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xcf'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut['cloneAction'](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd0'));}else{if(_0x3eb647[_0x0d8b('0xcc')]>=_0xb1aa96[_0x0d8b('0xd1')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xcc'),_0xb1aa96['dialBusyRetryFrequency']),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xd2'):_0xb1aa96['outboundRejectCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xd3')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x14,_0x0d8b('0xd4'));ami[_0x0d8b('0x99')](_0x0d8b('0xd5'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xd6')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xd7'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0x14,_0x0d8b('0xd4'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd8'));}else{if(_0x3eb647[_0x0d8b('0xd3')]>=_0xb1aa96[_0x0d8b('0xd9')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xd3'),_0xb1aa96[_0x0d8b('0xda')]),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xdb'):_0xb1aa96['outboundAbandonedCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xdc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xb,_0x0d8b('0xdd'));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xde'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3eb647['countabandonedetry']>=_0xb1aa96[_0x0d8b('0xdf')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xde'));}else{rpcDb[_0x0d8b('0xa3')](ut['scheduledAt'](_0x3eb647,_0x0d8b('0xdc'),_0xb1aa96['dialAbandonedRetryFrequency']),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;default:if(_0x3eb647[_0x0d8b('0x69')]){ut[_0x0d8b('0xe0')](_0xb1aa96,_0x0d8b('0xe1'));ut[_0x0d8b('0x72')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xb1aa96['name'],_0x34affb);}_0xb1aa96[_0x0d8b('0x42')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xc,_0x34affb[_0x0d8b('0xe2')]||_0x34affb[_0x0d8b('0xe3')]);rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xe4'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb['createCustomerFinal'](_0x22ee20,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xe5'));}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];}if(!(_0x3eb647['dialAnswer']&&_0x4ee1e8==='16')){ut[_0x0d8b('0xe6')](_0xb1aa96,_0x0d8b('0xe7'));logger[_0x0d8b('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x3eb647[_0x0d8b('0xac')],'\x20Queue',_0xb1aa96[_0x0d8b('0x51')],'originated:\x20',_0xb1aa96[_0x0d8b('0x4b')]);}if(_0x4ee1e8!==_0x0d8b('0xe8')){delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];delete this[_0x0d8b('0x16')][_0x34affb['destlinkedid']];}}};Preview[_0x0d8b('0xe')]['callProgressDetectingAgent']=function(_0x2d010e,_0x4bd01c,_0x165baa){if(_['isUndefined'](_0x4bd01c)&&'object'!==typeof _0x4bd01c){return;}if(_[_0x0d8b('0xe9')](_0x165baa)&&_0x0d8b('0xea')!==typeof _0x165baa){return;}switch(_0x165baa['reason']){case'0':ut[_0x0d8b('0xeb')](_0x2d010e,0x0,_0x0d8b('0x98'));rpcDb[_0x0d8b('0xec')](_0x2d010e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x2d010e,0x3,'NoAnswer');rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xed'));break;case'5':ut[_0x0d8b('0xeb')](_0x2d010e,0x5,_0x0d8b('0xbe'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xee'));break;case'8':ut[_0x0d8b('0xeb')](_0x2d010e,0x8,_0x0d8b('0xcd'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));break;case'22':ut['logAgent'](_0x2d010e,0x16,_0x0d8b('0xf0'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xf1'));break;default:ut['logAgent'](_0x2d010e,0xc,_0x165baa[_0x0d8b('0xf2')]);rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));}ut[_0x0d8b('0xe6')](_0x4bd01c,_0x0d8b('0xf3'));logger[_0x0d8b('0x56')](_0x0d8b('0xf4'),_0x2d010e[_0x0d8b('0xac')],_0x0d8b('0xad'),_0x4bd01c[_0x0d8b('0x51')],_0x0d8b('0x67'),_0x4bd01c[_0x0d8b('0x4b')]);delete this['actions'][_0x2d010e[_0x0d8b('0xac')]];};Preview[_0x0d8b('0xe')][_0x0d8b('0xf5')]=function(_0x31baaf,_0x590889,_0x55215b,_0x11e5c2,_0x853bee){var _0x222deb=this;return new BPromise(function(_0x59698d,_0x4e2323){if(_['isNil'](_0x590889)||_[_0x0d8b('0x79')](_0x590889['Contact'])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf6')][_0x0d8b('0xf7')])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf8')])){_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0xf9'),_0x11e5c2,_0x853bee));return;}var _0x16994f=uuid['v4']();var _0x5dbe4c=_0x222deb[_0x0d8b('0x13')][_0x590889[_0x0d8b('0xfa')][_0x0d8b('0x51')]];var _0x6b4a65=_0x55215b?_0x222deb['agents'][_0x55215b]['id']:undefined;_0x222deb[_0x0d8b('0x16')][_0x16994f]=new Action(_0x590889,_0x5dbe4c,_0x16994f,_0x55215b,_0x6b4a65);var _0x62fedf=_0x222deb[_0x0d8b('0x16')][_0x16994f];_0x62fedf[_0x0d8b('0xa6')]=_0x11e5c2;_0x62fedf['activeContact']=_0x853bee;_0x62fedf[_0x0d8b('0xfb')]=_0x55215b;if(_[_0x0d8b('0xfc')](_0x31baaf)){_0x222deb[_0x0d8b('0xfd')](_0x62fedf,_0x5dbe4c,_0x590889,_0x55215b)[_0x0d8b('0x78')](function(_0x572329){logger[_0x0d8b('0x56')]('[Preview][execCall][success]',_0x0d8b('0xfe')+_0x62fedf['queue']+_0x0d8b('0xff')+_0x62fedf['idContact'],JSON[_0x0d8b('0x55')](_0x572329));ami['emit'](_0x0d8b('0x100'),ut['buildObj'](_0x62fedf,_0x0d8b('0x101'),_0x222deb['campaignsPreview'][_0x62fedf[_0x0d8b('0x66')]]));_0x59698d(ut['message'](_0x0d8b('0x102')));})[_0x0d8b('0x6f')](function(_0x507587){ut['logger']('[Preview][execCall][failure]',_0x507587);_0x4e2323(ut[_0x0d8b('0x4a')]('Call\x20failed',_0x11e5c2,_0x853bee));});}else{_0x5dbe4c[_0x0d8b('0x3c')]+=0x1;ut['logBlacklist'](_0x62fedf);rpcDb[_0x0d8b('0x103')](_0x62fedf,_0x0d8b('0x104'));delete _0x222deb[_0x0d8b('0x16')][_0x16994f];_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0x105'),_0x11e5c2,_0x853bee));}});};Preview[_0x0d8b('0xe')]['isTrunkReachable']=function(_0x58d013){return!_[_0x0d8b('0x79')](_0x58d013)&&!_['isNil'](_0x58d013[_0x0d8b('0x51')])&&!_[_0x0d8b('0x79')](_0x58d013[_0x0d8b('0x52')])&&_0x58d013['active']&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])])&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])]['status'])&&(this[_0x0d8b('0x15')][util['format'](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x107')||this[_0x0d8b('0x15')][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x108'));};Preview[_0x0d8b('0xe')][_0x0d8b('0x7f')]=function(_0x50b987,_0x3c2fb9){var _0xb816d7=this;return new BPromise(function(_0x4f5d39,_0x2cc63a){_0xb816d7['execRun'](_0x50b987,_0x3c2fb9)[_0x0d8b('0x78')](function(_0x4a04c6){_0x4f5d39(_[_0x0d8b('0x6a')](_0x4a04c6,['message']));})['catch'](function(_0x124219){if(_0x124219[_0x0d8b('0x109')]){rpcDb['unlockContact'](_0x50b987);}if(_0x124219['active']){rpcDb['disableContact'](_0x50b987);}_0x2cc63a(_['pick'](_0x124219,[_0x0d8b('0x4a')]));});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x10a')]=function(_0x29e8e6,_0x233ff0){var _0x21329f=this;return new BPromise(function(_0x3d8a14,_0x44ac53){var _0x53de32,_0x19e8d4;rpcDb['getContactPreview'](_0x29e8e6)[_0x0d8b('0x78')](function(_0x4e1f1a){if(!_[_0x0d8b('0x79')](_0x4e1f1a[0x0])){_0x19e8d4=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?![]:!![];_0x53de32=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?!![]:![];_0x53de32=_0x233ff0?!![]:_0x53de32;}var _0x2d90af=_0x21329f[_0x0d8b('0x10c')](_0x4e1f1a);if(_0x2d90af[_0x0d8b('0x10d')]){rpcDb[_0x0d8b('0x10e')](_[_0x0d8b('0x6a')](_0x4e1f1a[0x0],[_0x0d8b('0xf8'),_0x0d8b('0x10f')]))[_0x0d8b('0x78')](function(_0x36527c){_0x21329f[_0x0d8b('0xf5')](_0x36527c,_0x4e1f1a[0x0],_0x233ff0,_0x19e8d4,_0x53de32)['then'](function(_0x479d59){_0x3d8a14(_0x479d59);})['catch'](function(_0x4111e6){_0x44ac53(_0x4111e6);});})[_0x0d8b('0x6f')](function(_0x4c69a3){ut[_0x0d8b('0x5d')]('[Preview][checkIsBlackList]',_0x4c69a3);_0x44ac53(ut[_0x0d8b('0x4a')]('Call\x20unsuccessful',_0x19e8d4,_0x53de32));});}else{_0x44ac53(ut[_0x0d8b('0x4a')](_0x2d90af[_0x0d8b('0x4a')],_0x19e8d4,_0x53de32));}})[_0x0d8b('0x6f')](function(_0x3e7cc7){ut[_0x0d8b('0x5d')](_0x0d8b('0x110'),_0x3e7cc7);_0x44ac53(ut['message'](_0x0d8b('0x111'),![],!![]));});});};Preview['prototype'][_0x0d8b('0x10c')]=function(_0x66040){if(_[_0x0d8b('0x79')](_0x66040)||_[_0x0d8b('0xfc')](_0x66040)||!_[_0x0d8b('0x79')](_0x66040[0x0]['Agent'])&&_[_0x0d8b('0x79')](_0x66040[0x0][_0x0d8b('0x7d')]['name'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x112'),_0x66040);return{'isValid':![],'message':_0x0d8b('0x113')};}var _0x2f90e0=this['campaignsPreview'][_0x66040[0x0][_0x0d8b('0xfa')]['name']];_0x2f90e0[_0x0d8b('0x4a')]='ACTIVE';if(_[_0x0d8b('0x79')](_0x2f90e0)){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f90e0);return{'isValid':![],'message':_0x0d8b('0x114')};}if(!this[_0x0d8b('0x91')](_0x2f90e0[_0x0d8b('0x50')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0d8b('0x115')+_0x2f90e0['name']+_0x0d8b('0x116'));if(!this[_0x0d8b('0x91')](_0x2f90e0['TrunkBackup'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x117'),_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x118'));return{'isValid':![],'message':_0x0d8b('0x119')};}}if(!ut[_0x0d8b('0x90')](_0x2f90e0[_0x0d8b('0x37')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x2f90e0[_0x0d8b('0x51')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x0d8b('0x115')+_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x11a')};}return{'isValid':!![],'message':_0x0d8b('0x11b')};};Preview[_0x0d8b('0xe')][_0x0d8b('0xfd')]=function(_0x331bc5,_0x1660d5,_0x1a987a,_0x53bfe5){var _0x2f8682=this;return new BPromise(function(_0x3106e9,_0x4cd83e){var _0x2703f1=_0x331bc5[_0x0d8b('0xac')];var _0x4aa208=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x51')],_[_0x0d8b('0x79')](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]):util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5['Trunk']['name']:_0x1660d5['TrunkBackup']['name'],_['isNil'](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]);var _0x352485=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?ut[_0x0d8b('0x120')](_0x1660d5['Trunk'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5[_0x0d8b('0x121')]>0x0?ut['getCallerIdRandom'](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]):ut[_0x0d8b('0x120')](_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x53')]:_0x1660d5['TrunkBackup'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0d8b('0x123')](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]);if(_0x352485){_0x331bc5[_0x0d8b('0x124')]=ut['extractCalleridName'](_0x352485);_0x331bc5['originatecalleridnum']=ut['extractCalleridNumber'](_0x352485);}var _0x18e6be=ut[_0x0d8b('0x125')](_0x1660d5,_0x1a987a,_0x4aa208,_0x352485,_0x2703f1,_0x331bc5);_[_0x0d8b('0x126')](_0x331bc5,ut[_0x0d8b('0x127')](_0x18e6be));_0x331bc5[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0d8b('0x6d')](ut[_0x0d8b('0x128')](_0x331bc5,_0x1660d5,_0x18e6be,_0x331bc5['activeContact'],_0x53bfe5))[_0x0d8b('0x78')](function(_0x28fa83){_0x1660d5[_0x0d8b('0x4b')]+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0x129'),_0x2703f1,'\x20Queue',_0x1660d5['name'],_0x0d8b('0x67'),_0x1660d5[_0x0d8b('0x4b')]);_0x3106e9(_0x28fa83);})['catch'](function(_0x3c5a61){ut[_0x0d8b('0xeb')](_0x331bc5,0xe,_0x0d8b('0x12a'));rpcDb['createAgentHistory'](_0x331bc5,'[originateFailure][logOriginateFailure]');_0x4cd83e(_0x3c5a61);});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x23')]=function(_0x598e67){if(this['actions'][_0x598e67[_0x0d8b('0xa8')]]){this['actions'][_0x598e67[_0x0d8b('0xa8')]]['channel']=_0x598e67[_0x0d8b('0x12b')];}};Preview[_0x0d8b('0xe')]['syncOriginateResponse']=function(_0x3411d9){var _0x5d9ab5=this;var _0x31d9fb=this[_0x0d8b('0x16')][_0x3411d9[_0x0d8b('0x12c')]];if(_0x31d9fb){if(_0x31d9fb[_0x0d8b('0xfb')]&&this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]){ut[_0x0d8b('0x12d')](_0x31d9fb,this[_0x0d8b('0x17')][_0x31d9fb[_0x0d8b('0xfb')]]['name'],this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]['id']);}var _0x270338=_[_0x0d8b('0x12e')](_0x31d9fb);_0x270338['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x24705e=_0x5d9ab5[_0x0d8b('0x13')][_0x31d9fb['queue']];if(ut[_0x0d8b('0x12f')](_0x3411d9['response'])){if(_0x31d9fb[_0x0d8b('0xa6')]){rpcDb[_0x0d8b('0x130')](_0x31d9fb[_0x0d8b('0x131')]);}if(_0x31d9fb[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x31d9fb[_0x0d8b('0x131')]);}ami[_0x0d8b('0x99')](_0x0d8b('0x132'),ut['buildObj'](_0x31d9fb,_0x0d8b('0x133'),this['campaignsPreview'][_0x31d9fb['queue']]));this[_0x0d8b('0x134')](_0x270338,_0x24705e,_0x3411d9);}else{_0x31d9fb[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')](_0x0d8b('0xa9'));ut[_0x0d8b('0xeb')](_0x270338,0x4,_0x0d8b('0x135'));rpcDb[_0x0d8b('0xec')](_0x270338,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x0d8b('0xe')]['syncHangup']=function(_0x5d3cd5){var _0x3bdb03=this;var _0x5f4e06=this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']];var _0x4a9bc0;if(_0x5f4e06){_0x4a9bc0=this[_0x0d8b('0x13')][_0x5f4e06[_0x0d8b('0x66')]];logger[_0x0d8b('0x56')](_0x0d8b('0x136'),_0x5d3cd5[_0x0d8b('0xa8')],_0x0d8b('0xad'),_0x4a9bc0['name'],'pTalking:\x20',_0x4a9bc0[_0x0d8b('0x30')]);}if(this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]&&_0x5d3cd5[_0x0d8b('0xa8')]!==_0x5d3cd5[_0x0d8b('0xac')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']]['dialAnswer']){logger['info'](_0x0d8b('0x138'),_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}else if(_0x5f4e06&&_[_0x0d8b('0x79')](_0x5f4e06[_0x0d8b('0x139')])&&_0x4a9bc0[_0x0d8b('0x13a')]&&_0x5d3cd5[_0x0d8b('0xa8')]===_0x5d3cd5[_0x0d8b('0xac')]&&_[_0x0d8b('0x79')](_0x5d3cd5[_0x0d8b('0xf2')])&&_0x5d3cd5['cause']==='16'&&_0x5d3cd5['channelstate']==='6'&&_[_0x0d8b('0xe9')](_0x5f4e06['transfer'])){if(_0x5f4e06['unlockAgent']){rpcDb['unlockContact'](_0x5f4e06[_0x0d8b('0x131')]);}if(_0x5f4e06[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x5f4e06[_0x0d8b('0x131')]);}_0x5d3cd5[_0x0d8b('0xf2')]='22';this['callProgressDetectingAgent'](_0x5f4e06,_0x4a9bc0,_0x5d3cd5);}else if(_0x5f4e06&&_0x5f4e06[_0x0d8b('0x13b')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]['dialAnswer']){logger['info'](_0x0d8b('0x13c'),_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this['actions'][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){logger[_0x0d8b('0x56')](_0x0d8b('0x138'),_0x5d3cd5['linkedid'],_0x5d3cd5['cause'],'\x20Queue',_0x4a9bc0['name'],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')]['syncDialEnd']=function(_0x495456){if(this['actions'][_0x495456['destlinkedid']]&&_0x495456[_0x0d8b('0x13d')]!==_0x495456[_0x0d8b('0x13e')]){this['callProgressDetectingCustomer'](_0x495456,_0x495456[_0x0d8b('0x13d')],_0x495456[_0x0d8b('0xe3')]);}};Preview[_0x0d8b('0xe')][_0x0d8b('0x1f')]=function(_0x289b7e){if(this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]&&_0x289b7e['linkedid']!==_0x289b7e[_0x0d8b('0xac')]&&!this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]['dialAnswer']){if(_0x289b7e[_0x0d8b('0x137')]==='1'){this[_0x0d8b('0x95')](_0x289b7e,_0x289b7e[_0x0d8b('0xa8')],_0x289b7e[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')][_0x0d8b('0x13f')]=function(_0x2e3310,_0x1742bd,_0x843725){if(this['actions'][_0x2e3310]){if(_['isNil'](this['actions'][_0x2e3310][_0x0d8b('0x140')])){this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')]={};}this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')][_0x1742bd]=_0x843725;}};Preview[_0x0d8b('0xe')][_0x0d8b('0x25')]=function(_0x1c88ce){try{if(!_[_0x0d8b('0x79')](_0x1c88ce)){if(ut[_0x0d8b('0x141')](_['keys'](_0x1c88ce['variable'])[0x0])){this[_0x0d8b('0x13f')](_0x1c88ce[_0x0d8b('0xac')],_[_0x0d8b('0x142')](_0x1c88ce[_0x0d8b('0x143')])[0x0],_0x1c88ce['value']);}}}catch(_0x5f467e){logger[_0x0d8b('0x144')](_0x0d8b('0x145'),util[_0x0d8b('0x146')](_0x5f467e,{'showHidden':![],'depth':null}));}};Preview[_0x0d8b('0xe')][_0x0d8b('0x27')]=function(_0x51240b){if(_0x51240b){if(this['actions'][_0x51240b[_0x0d8b('0x147')]]){this[_0x0d8b('0x16')][_0x51240b[_0x0d8b('0x147')]][_0x0d8b('0x13b')]=!![];}}};Preview['prototype'][_0x0d8b('0x29')]=function(_0x22e3aa){if(_0x22e3aa){if(this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]){this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]['transfer']=!![];}}};module[_0x0d8b('0x149')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1642db1..7c2369e 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 _0xdbf5=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','lodash','../rpc/cmHopper'];(function(_0x4d598f,_0x4a5cb9){var _0x44a541=function(_0x3ed9e9){while(--_0x3ed9e9){_0x4d598f['push'](_0x4d598f['shift']());}};_0x44a541(++_0x4a5cb9);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x353630,_0x4f4402){_0x353630=_0x353630-0x0;var _0x3fb134=_0xdbf5[_0x353630];return _0x3fb134;};'use strict';var util=require('util');var BPromise=require(_0x5dbf('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x5dbf('0x1'));var cmHopper=require(_0x5dbf('0x2'));var cmHopperFinal=require(_0x5dbf('0x3'));var cmHopperHistory=require(_0x5dbf('0x4'));var cmHopperBlack=require(_0x5dbf('0x5'));var voiceQueueRt=require(_0x5dbf('0x6'));var agentReportPreview=require(_0x5dbf('0x7'));var voiceQueueReport=require(_0x5dbf('0x8'));function loggerCatch(_0x3f8628){return function(_0x3f8222){logger[_0x5dbf('0x9')](_0x3f8628,util[_0x5dbf('0xa')](_0x3f8222,{'showHidden':![],'depth':null}));};}function create(_0x93e657){return BPromise['resolve']()[_0x5dbf('0xb')](cmHopperHistory['createHistory'](_0x93e657))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0xd')));}function createAgent(_0x264007){return BPromise[_0x5dbf('0xe')]()['then'](agentReportPreview[_0x5dbf('0xf')](_0x264007))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1c7389){return BPromise['resolve']()['then'](cmHopper[_0x5dbf('0x10')](_0x1c7389,!![]))['catch'](loggerCatch(_0x5dbf('0x11')));}exports[_0x5dbf('0x12')]=function(_0x1453a9){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopperBlack['checkIsBlackList'](_0x1453a9))['catch'](loggerCatch(_0x5dbf('0x13')));};exports[_0x5dbf('0x14')]=function(_0x48e7fd){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x14')](_0x48e7fd))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x15')));};exports[_0x5dbf('0xf')]=function(_0x2d32cc,_0x50ef1d){create(_0x2d32cc)['catch'](loggerCatch(_0x50ef1d));moveContact(_0x2d32cc)[_0x5dbf('0xc')](loggerCatch(_0x50ef1d));};exports[_0x5dbf('0x16')]=function(_0x39c7aa,_0x14abf7){createAgent(_0x39c7aa)[_0x5dbf('0xc')](loggerCatch(_0x14abf7));};exports['createCustomerHistory']=function(_0x11cd00,_0x4dd03c){create(_0x11cd00)['catch'](loggerCatch(_0x4dd03c));};exports['createCustomerFinal']=function(_0x23d1e7,_0x3cedac){moveContact(_0x23d1e7)[_0x5dbf('0xc')](loggerCatch(_0x3cedac));};exports[_0x5dbf('0x17')]=function(_0x1e3cce,_0x5b2518,_0x2764ea){if(_0x5b2518){_0x1e3cce['UserId']=null;}if(_0x2764ea){_0x1e3cce[_0x5dbf('0x18')]=![];}return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x17')](_0x1e3cce))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x19')));};exports['countReScheduled']=function(_0x4027c3){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1a')](_0x4027c3))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1b')));};exports[_0x5dbf('0x1c')]=function(_0x20ab1b){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1c')]({'UserId':null},_0x20ab1b,0x1))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1d')));};exports[_0x5dbf('0x1e')]=function(_0x729d8f){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x1c')]({'active':![]},_0x729d8f,0x1))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x1f')));};exports[_0x5dbf('0x20')]=function(_0x471027){var _0x21cd00={};_0x21cd00['type']=_0x471027[_0x5dbf('0x21')];_0x21cd00[_0x5dbf('0x22')]=_0x471027[_0x5dbf('0x22')];_0x21cd00[_0x5dbf('0x23')]=_0x471027[_0x5dbf('0x23')];_0x21cd00[_0x5dbf('0x24')]=_0x471027[_0x5dbf('0x24')];_0x21cd00[_0x5dbf('0x25')]=_0x471027[_0x5dbf('0x25')];_0x21cd00[_0x5dbf('0x26')]=_0x471027[_0x5dbf('0x27')];_0x21cd00['queuecallerleaveAt']=_0x471027['answertime'];_0x21cd00[_0x5dbf('0x28')]=0x1;_0x21cd00[_0x5dbf('0x29')]=_0x471027[_0x5dbf('0x2a')];_0x21cd00[_0x5dbf('0x2b')]=_0x471027[_0x5dbf('0x2c')];_0x21cd00['context']='from-sip';_0x21cd00[_0x5dbf('0x2d')]=_0x5dbf('0x2e');_0x21cd00['holdtime']=0x0;_0x21cd00[_0x5dbf('0x2f')]=0x1;_0x21cd00[_0x5dbf('0x30')]=_0x471027[_0x5dbf('0x2c')];_0x21cd00[_0x5dbf('0x31')]=_0x5dbf('0x32');return BPromise['resolve']()[_0x5dbf('0xb')](voiceQueueReport[_0x5dbf('0x33')](_0x21cd00))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x34')));};exports[_0x5dbf('0x35')]=function(_0x4e4518,_0x252d54){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x35')](_0x4e4518,_0x252d54))['catch'](loggerCatch(_0x5dbf('0x36')));};exports[_0x5dbf('0x37')]=function(_0x302dda){return BPromise[_0x5dbf('0xe')]()[_0x5dbf('0xb')](cmHopper[_0x5dbf('0x17')](_0x302dda,!![],!![]))[_0x5dbf('0xc')](loggerCatch(_0x5dbf('0x38')));}; \ No newline at end of file +var _0xf69d=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xf69d,0xd3));var _0xdf69=function(_0x5a5756,_0x520698){_0x5a5756=_0x5a5756-0x0;var _0x3c161a=_0xf69d[_0x5a5756];return _0x3c161a;};'use strict';var util=require(_0xdf69('0x0'));var BPromise=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var _=require(_0xdf69('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xdf69('0x5'));var cmHopperHistory=require(_0xdf69('0x6'));var cmHopperBlack=require(_0xdf69('0x7'));var voiceQueueRt=require(_0xdf69('0x8'));var agentReportPreview=require(_0xdf69('0x9'));var voiceQueueReport=require(_0xdf69('0xa'));function loggerCatch(_0x2d456f){return function(_0x465b1b){logger[_0xdf69('0xb')](_0x2d456f,util[_0xdf69('0xc')](_0x465b1b,{'showHidden':![],'depth':null}));};}function create(_0x18a08e){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperHistory[_0xdf69('0xf')](_0x18a08e))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function createAgent(_0x1e0e8d){return BPromise['resolve']()[_0xdf69('0xe')](agentReportPreview[_0xdf69('0xf')](_0x1e0e8d))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function moveContact(_0x43ce3d){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['moveContactManagedDialer'](_0x43ce3d,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xdf69('0x12')]=function(_0xbacdc6){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperBlack[_0xdf69('0x12')](_0xbacdc6))[_0xdf69('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xdf69('0x13')]=function(_0x42d448){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper['getContactPreview'](_0x42d448))[_0xdf69('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xdf69('0xf')]=function(_0x1899a2,_0x5263a4){create(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));moveContact(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));};exports[_0xdf69('0x14')]=function(_0x85d1d,_0x59bfd2){createAgent(_0x85d1d)['catch'](loggerCatch(_0x59bfd2));};exports[_0xdf69('0x15')]=function(_0x15e73a,_0x54df73){create(_0x15e73a)[_0xdf69('0x10')](loggerCatch(_0x54df73));};exports[_0xdf69('0x16')]=function(_0x68fa80,_0x526cbc){moveContact(_0x68fa80)[_0xdf69('0x10')](loggerCatch(_0x526cbc));};exports[_0xdf69('0x17')]=function(_0x4d09d5,_0x56647c,_0x32505a){if(_0x56647c){_0x4d09d5[_0xdf69('0x18')]=null;}if(_0x32505a){_0x4d09d5[_0xdf69('0x19')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x4d09d5))[_0xdf69('0x10')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xdf69('0x1a')]=function(_0x311534){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['countReScheduled'](_0x311534))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1b')));};exports[_0xdf69('0x1c')]=function(_0x3fd933){return BPromise['resolve']()[_0xdf69('0xe')](cmHopper[_0xdf69('0x1c')]({'UserId':null},_0x3fd933,0x1))[_0xdf69('0x10')](loggerCatch('[unlockContact]\x20'));};exports[_0xdf69('0x1d')]=function(_0x5cfba9){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x5cfba9,0x1))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1e')));};exports['crateCustomerReportQueue']=function(_0x301bd2){var _0xd81d0a={};_0xd81d0a[_0xdf69('0x1f')]=_0x301bd2[_0xdf69('0x1f')];_0xd81d0a[_0xdf69('0x20')]=_0x301bd2[_0xdf69('0x20')];_0xd81d0a[_0xdf69('0x21')]=_0x301bd2[_0xdf69('0x21')];_0xd81d0a[_0xdf69('0x22')]=_0x301bd2[_0xdf69('0x22')];_0xd81d0a[_0xdf69('0x23')]=_0x301bd2[_0xdf69('0x23')];_0xd81d0a[_0xdf69('0x24')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x26')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x27')]=0x1;_0xd81d0a['queuecallercompleteAt']=_0x301bd2[_0xdf69('0x28')];_0xd81d0a[_0xdf69('0x29')]=_0x301bd2[_0xdf69('0x2a')];_0xd81d0a[_0xdf69('0x2b')]=_0xdf69('0x2c');_0xd81d0a['exten']=_0xdf69('0x2d');_0xd81d0a['holdtime']=0x0;_0xd81d0a[_0xdf69('0x2e')]=0x1;_0xd81d0a[_0xdf69('0x2f')]=_0x301bd2['membername'];_0xd81d0a[_0xdf69('0x30')]='COMPLETED';return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](voiceQueueReport[_0xdf69('0x31')](_0xd81d0a))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x32')));};exports['getContactRecallMe']=function(_0x175d5a,_0x50250a){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper[_0xdf69('0x33')](_0x175d5a,_0x50250a))[_0xdf69('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xdf69('0x34')]=function(_0x51f996){return BPromise[_0xdf69('0xd')]()['then'](cmHopper[_0xdf69('0x17')](_0x51f996,!![],!![]))['catch'](loggerCatch(_0xdf69('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 6da7e29..057af5d 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 _0xc325=['answertime','isFailure','Failure','RECALL','calleridname','BOOKED','uniqueid','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','not_inuse','reachable','push','createBody','CampaignId','idContact','dialAnswer','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','ringtime','logLookAgent','UserId','logCustomer','starttime'];(function(_0x11a500,_0xaa37fd){var _0x2196a8=function(_0x3f31c0){while(--_0x3f31c0){_0x11a500['push'](_0x11a500['shift']());}};_0x2196a8(++_0xaa37fd);}(_0xc325,0x1d0));var _0x5c32=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc325[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x5c32('0x0'));var _=require(_0x5c32('0x1'));var moment=require(_0x5c32('0x2'));var logger=require(_0x5c32('0x3'))(_0x5c32('0x4'));var ipAgi=process[_0x5c32('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x5f3371,_0x4b0385){var _0x468205=moment(_0x5f3371)[_0x5c32('0x6')](0x0);var _0x2db8ca=moment(_0x4b0385)[_0x5c32('0x6')](0x0);return _0x468205[_0x5c32('0x7')](_0x2db8ca,_0x5c32('0x8'));}exports[_0x5c32('0x9')]=function(_0xe1202c){return function(_0x559865){logger[_0x5c32('0xa')](_0xe1202c,util[_0x5c32('0xb')](_0x559865,{'showHidden':![],'depth':null}));};};exports[_0x5c32('0xc')]=function(_0x5cd3f9,_0x1e3f46){logger[_0x5c32('0xd')](_0x5cd3f9,util[_0x5c32('0xb')](_0x1e3f46,{'showHidden':![],'depth':null}));};exports[_0x5c32('0xe')]=function(_0x3fc366,_0x1268da){logger[_0x5c32('0xa')](_0x3fc366,util[_0x5c32('0xb')](_0x1268da,{'showHidden':![],'depth':null}));};exports[_0x5c32('0xf')]=function(_0x649a2d){return function(_0x34d53d){logger[_0x5c32('0xd')](_0x649a2d,util[_0x5c32('0xb')](_0x34d53d,{'showHidden':![],'depth':null}));};};exports[_0x5c32('0x10')]=function(_0x2d78b3,_0x23fc6c,_0x4e9f60){return{'message':_0x2d78b3,'unlock':_0x23fc6c,'active':_0x4e9f60};};exports[_0x5c32('0x11')]=function(_0x3c873e,_0xdb9f55,_0x308d49){if(!_[_0x5c32('0x12')](_0x308d49)&&'string'===typeof _0x308d49&&!_[_0x5c32('0x13')](_0x308d49)){if(!_[_0x5c32('0x12')](_0xdb9f55)&&_0x5c32('0x14')===typeof _0xdb9f55&&!_[_0x5c32('0x13')](_0xdb9f55)){return util['format']('\x22%s\x22\x20<%s>',_0xdb9f55,_0x308d49);}return util[_0x5c32('0x15')]('\x22%s\x22\x20<%s>',_0x308d49,_0x308d49);}if(!_[_0x5c32('0x12')](_0x3c873e)&&_0x5c32('0x14')===typeof _0x3c873e&&!_[_0x5c32('0x13')](_0x3c873e)){return _0x3c873e;}return'\x22\x22\x20<>';};exports[_0x5c32('0x16')]=function(_0x298d72){if(_[_0x5c32('0x17')](_0x298d72)){return![];}return _0x298d72;};exports[_0x5c32('0x18')]=function(_0x3943c6,_0x1dcc0b,_0x3c9099,_0xd34202,_0x26d8f5,_0x151503){var _0x39cc1f={'XMD-QUEUE':_0x1dcc0b[_0x5c32('0x19')]?_0x1dcc0b[_0x5c32('0x19')][_0x5c32('0x1a')]:'','XMD-CALLERID':_0xd34202,'XMD-CALLERID-PREVIEW':_0x151503?util[_0x5c32('0x15')](_0x5c32('0x1b'),_0x151503['calleridname'],_0x151503['calleridnum']):_0xd34202,'XMD-DIALID':_0x26d8f5,'XMD-CONTACTID':_0x1dcc0b['ContactId'],'XMD-CDRTYPE':_0x5c32('0x1c'),'CALLERID(all)':_0xd34202,'XMD-VOICEQUEUEID':_0x1dcc0b[_0x5c32('0x1d')],'XMD-DIALCHANNEL':_0x3c9099,'XMD-DIALTIMEOUT':_0x3943c6[_0x5c32('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5c32('0x15')](_0x5c32('0x1f'),_0x3943c6[_0x5c32('0x20')]?'g':'',_['isEmpty'](_0x3943c6[_0x5c32('0x21')])?'':_0x5c32('0x22')),'XMD-DIALURL':_0x3943c6[_0x5c32('0x23')]||'','XMD-AGI':_0x3943c6[_0x5c32('0x24')]?util[_0x5c32('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3943c6[_0x5c32('0x24')]):'NONE','XMD-AGIAFTER':_0x3943c6[_0x5c32('0x20')]?util[_0x5c32('0x15')](_0x5c32('0x25'),ipAgi,_0x3943c6[_0x5c32('0x20')]):_0x5c32('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x151503?_0x151503['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x151503?_0x151503[_0x5c32('0x27')]:'','XMD-DESTINATION':_0x5c32('0x28')};if(!_[_0x5c32('0x13')](_0x3943c6[_0x5c32('0x21')])){_0x39cc1f[util['format']('%s',_0x5c32('0x29'))]=_0x3943c6[_0x5c32('0x21')];_0x39cc1f[util[_0x5c32('0x15')]('%s',_0x5c32('0x2a'))]=_0x26d8f5;}if(_0x1dcc0b&&_0x1dcc0b['Contact']){for(var _0x143d1c in _0x1dcc0b[_0x5c32('0x2b')]){if(_0x1dcc0b[_0x5c32('0x2b')][_0x5c32('0x2c')](_0x143d1c)){if(!_['isNil'](_0x1dcc0b[_0x5c32('0x2b')][_0x143d1c])&&_0x143d1c!=='id'&&_0x143d1c!=='tags'&&_0x143d1c!==_0x5c32('0x2d')&&_0x143d1c!==_0x5c32('0x2e')){_0x39cc1f[util['format'](_0x5c32('0x2f'),_0x5c32('0x30'),_['toUpper'](_0x143d1c))]=_0x1dcc0b[_0x5c32('0x2b')][_0x143d1c];}}}}return _0x39cc1f;};exports[_0x5c32('0x31')]=function(_0x18309f){var _0x41a0b6={};for(var _0x134228 in _0x18309f){if(_0x18309f['hasOwnProperty'](_0x134228)){_0x41a0b6[util[_0x5c32('0x15')]('%s',_[_0x5c32('0x32')](_0x134228))]=_0x18309f[_0x134228];}}return{'variables':_0x41a0b6};};exports[_0x5c32('0x33')]=function(_0x5f9b8f,_0x41f708){if(!_[_0x5c32('0x17')](_0x5f9b8f)){if(_0x5f9b8f['hasOwnProperty'](_0x5c32('0x34'))){if(_0x5f9b8f[_0x5c32('0x34')]>0x0){_0x5f9b8f[_0x5c32('0x34')]-=0x1;}else{logger[_0x5c32('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x41f708);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x41f708);}};exports['logBlacklist']=function(_0x945f0a){var _0x56de4f=moment()[_0x5c32('0x15')](_0x5c32('0x35'));_0x945f0a[_0x5c32('0x36')]=0xd;_0x945f0a[_0x5c32('0x37')]=_0x5c32('0x38');_0x945f0a['starttime']=_0x56de4f;_0x945f0a[_0x5c32('0x39')]=_0x56de4f;_0x945f0a[_0x5c32('0x3a')]=_0x56de4f;};exports['logAgent']=function(_0x1c6a26,_0x1f9f0a,_0x2d460d){var _0x48acf6=moment()[_0x5c32('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c6a26[_0x5c32('0x36')]=_0x1f9f0a;_0x1c6a26[_0x5c32('0x37')]=_0x2d460d;_0x1c6a26['responsetime']=_0x48acf6;_0x1c6a26[_0x5c32('0x3b')]=getSeconds(_0x1c6a26[_0x5c32('0x39')],_0x1c6a26['starttime']);};exports[_0x5c32('0x3c')]=function(_0x579138,_0x93354b,_0xe330b1){_0x579138['membername']=_0x93354b;_0x579138[_0x5c32('0x3d')]=_0xe330b1;};exports[_0x5c32('0x3e')]=function(_0x2185aa,_0x13ccbb,_0x12ab7b){var _0x5d02a1=moment()[_0x5c32('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2185aa[_0x5c32('0x36')]=_0x13ccbb;_0x2185aa['statedesc']=_0x12ab7b;_0x2185aa[_0x5c32('0x39')]=_0x2185aa[_0x5c32('0x39')]?_0x2185aa[_0x5c32('0x39')]:_0x5d02a1;_0x2185aa[_0x5c32('0x3a')]=_0x2185aa['endtime']?_0x2185aa['endtime']:_0x5d02a1;_0x2185aa['ringtime']=getSeconds(_0x2185aa[_0x5c32('0x39')]||0x0,_0x2185aa[_0x5c32('0x3f')]||0x0);_0x2185aa['talktime']=_0x2185aa[_0x5c32('0x40')]?getSeconds(_0x2185aa[_0x5c32('0x3a')],_0x2185aa[_0x5c32('0x40')]):0x0;};exports[_0x5c32('0x41')]=function(_0x15a8f6){return _0x15a8f6===_0x5c32('0x42');};exports['variablesAction']=function(_0x20527f,_0x39f3a8,_0x1871a1,_0x297d9b,_0x366da9){var _0x1cfc6f=_0x297d9b?_0x5c32('0x43'):_0x20527f[_0x5c32('0x44')];_0x1cfc6f=_0x366da9?_0x5c32('0x45'):_0x1cfc6f;return{'actionid':_0x20527f[_0x5c32('0x46')],'action':'originate','channel':_0x20527f['channelAgent'],'callerid':util[_0x5c32('0x15')]('\x22%s\x22\x20<%s>',_0x1cfc6f,_0x20527f[_0x5c32('0x47')]),'Exten':'xcally-motion-preview','Context':_0x5c32('0x48'),'Priority':'1','variable':_0x1871a1,'timeout':(_0x39f3a8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x20527f[_0x5c32('0x46')]};};exports[_0x5c32('0x49')]=function(_0x38e5f7){return _0x38e5f7[_0x5c32('0x4a')]+_0x38e5f7[_0x5c32('0x4b')]+_0x38e5f7[_0x5c32('0x4c')]+_0x38e5f7[_0x5c32('0x4d')]+_0x38e5f7[_0x5c32('0x4e')];};exports[_0x5c32('0x4f')]=function(_0x4e6dca){var _0x7d5ee3=_['clone'](_0x4e6dca);_0x7d5ee3[_0x5c32('0x36')]=0xf;_0x7d5ee3[_0x5c32('0x37')]=_0x5c32('0x50');return _0x7d5ee3;};exports[_0x5c32('0x51')]=function(_0x3759d1,_0x28969f,_0xa0fdc0){var _0x323005={};_0x323005[_0x28969f]=_0x3759d1[_0x28969f];_0x323005[_0x5c32('0x52')]=![];_0x323005[_0x5c32('0x53')]=moment()[_0x5c32('0x54')](_0xa0fdc0,'minutes')['format'](_0x5c32('0x35'));_0x323005[_0x5c32('0x55')]=_0x3759d1[_0x5c32('0x55')];_0x323005[_0x5c32('0x56')]=_0x3759d1[_0x5c32('0x56')];_0x323005[_0x5c32('0x1d')]=_0x3759d1[_0x5c32('0x1d')]||undefined;return _0x323005;};exports['decrementTalkink']=function(_0x5ce82a,_0x6c90df){if(!_[_0x5c32('0x17')](_0x5ce82a)){if(_0x5ce82a['pTalking']>0x0){_0x5ce82a[_0x5c32('0x57')]-=0x1;}else{logger[_0x5c32('0xa')](_0x6c90df,_0x5c32('0x58'));}}else{logger[_0x5c32('0xa')](_0x6c90df,_0x5c32('0x59'));}};exports[_0x5c32('0x5a')]=function(_0x412fce){if(_0x412fce<=0x0){return!![];}return![];};exports[_0x5c32('0x5b')]=function(_0xabf321,_0x538fe0,_0x89b6c0){_0xabf321[_0x5c32('0x5c')]=_0x538fe0;_0xabf321[_0x5c32('0x1a')]=_0xabf321[_0x5c32('0x5d')];_0xabf321[_0x5c32('0x5e')]=_0xabf321[_0x5c32('0x5f')];if(_0x89b6c0){_0xabf321[_0x5c32('0x60')]=_0x89b6c0[_0x5c32('0x60')];}return _0xabf321;};exports['buildAcw']=function(_0x4fe396){var _0x306f28={};_0x306f28['queue']=_0x4fe396[_0x5c32('0x5d')];_0x306f28[_0x5c32('0x5e')]=_0x4fe396[_0x5c32('0x5f')];_0x306f28[_0x5c32('0x46')]=_0x4fe396['uniqueid'];return _0x306f28;};exports['agentReadyId']=function(_0x1df51c){var _0x2361b0=[];for(var _0x154760 in _0x1df51c){if(_0x1df51c[_0x5c32('0x2c')](_0x154760)){if(!_[_0x5c32('0x17')](_0x1df51c[_0x154760])&&_0x1df51c[_0x154760][_0x5c32('0x36')]===_0x5c32('0x61')&&_0x1df51c[_0x154760]['status']===_0x5c32('0x62')){_0x2361b0[_0x5c32('0x63')](_0x1df51c[_0x154760]['id']);}}}return _0x2361b0;};exports['getDiff']=function(_0xb7b51){var _0x5aa980=moment()['milliseconds'](0x0);var _0x34395e=moment(_0xb7b51)[_0x5c32('0x6')](0x0);return _0x5aa980['diff'](_0x34395e,_0x5c32('0x8'));};exports[_0x5c32('0x64')]=function(_0x4e37a3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e37a3['ContactId'],'ListId':_0x4e37a3[_0x5c32('0x56')],'VoiceQueueId':_0x4e37a3[_0x5c32('0x1d')]||undefined,'CampaignId':_0x4e37a3[_0x5c32('0x65')]||undefined};};exports['filterKey']=function(_0x47779f){if(_0x47779f===_0x5c32('0x46')||_0x47779f===_0x5c32('0x66')||_0x47779f==='queue'||_0x47779f==='type'||_0x47779f==='campaigntype'||_0x47779f===_0x5c32('0x67')||_0x47779f==='membername'||_0x47779f==='channelAgent'||_0x47779f==='calleridname'||_0x47779f===_0x5c32('0x52')||_0x47779f===_0x5c32('0x47')||_0x47779f===_0x5c32('0x53')||_0x47779f==='countbusyretry'||_0x47779f===_0x5c32('0x4b')||_0x47779f==='countnoanswerretry'||_0x47779f===_0x5c32('0x68')||_0x47779f==='callback'||_0x47779f===_0x5c32('0x69')||_0x47779f===_0x5c32('0x6a')||_0x47779f==='recallme'||_0x47779f==='ContactId'||_0x47779f===_0x5c32('0x56')||_0x47779f==='UserId'||_0x47779f==='VoiceQueueId'||_0x47779f===_0x5c32('0x6b')||_0x47779f==='xmd-voicequeueid'||_0x47779f==='xmd-queue'||_0x47779f===_0x5c32('0x6c')||_0x47779f==='xmd-listid'||_0x47779f===_0x5c32('0x6d')||_0x47779f==='xmd-dialtimeout'||_0x47779f===_0x5c32('0x6e')||_0x47779f===_0x5c32('0x6f')||_0x47779f===_0x5c32('0x70')||_0x47779f===_0x5c32('0x71')||_0x47779f===_0x5c32('0x72')||_0x47779f===_0x5c32('0x73')||_0x47779f===_0x5c32('0x74')||_0x47779f===_0x5c32('0x75')||_0x47779f==='rtpaudioqos'||_0x47779f==='rtpaudioqosbridged'||_0x47779f===_0x5c32('0x76')||_0x47779f===_0x5c32('0x77')||_0x47779f===_0x5c32('0x78')||_0x47779f==='rtpaudioqoslossbridged'||_0x47779f===_0x5c32('0x79')||_0x47779f===_0x5c32('0x7a')||_0x47779f==='rtpaudioqos'||_0x47779f===_0x5c32('0x7b')||_0x47779f==='rtpaudioqosjitter'||_0x47779f===_0x5c32('0x77')||_0x47779f==='rtpaudioqosloss'||_0x47779f===_0x5c32('0x7c')||_0x47779f===_0x5c32('0x79')||_0x47779f===_0x5c32('0x7a')||_0x47779f===_0x5c32('0x7d')||_0x47779f===_0x5c32('0x7e')||_0x47779f===_0x5c32('0x36')||_0x47779f===_0x5c32('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x11be29,_0x186602){var _0x494d06,_0x3181b8,_0x92e365;if(_0x186602<=0x0){_0x186602=0x1;}_0x494d06=new RegExp('\x5cw{0,'+_0x186602+'}$');_0x3181b8=Math[_0x5c32('0x7f')](0xa,_0x186602-0x1);_0x92e365=Math[_0x5c32('0x7f')](0xa,_0x186602)-0x1;return util[_0x5c32('0x15')]('%s',_[_0x5c32('0x80')](_0x11be29,_0x494d06,_[_0x5c32('0x81')](_0x3181b8,_0x92e365)));};exports['extractCalleridName']=function(_0x1eb134){var _0x46d75c=_0x1eb134[_0x5c32('0x82')](/"(.*?)"/);return _0x46d75c?_0x46d75c[0x1]:_0x1eb134;};exports[_0x5c32('0x83')]=function(_0x2d3cd3){var _0x10914c=_0x2d3cd3[_0x5c32('0x82')](/<(.*?)>/);return _0x10914c?_0x10914c[0x1]:_0x2d3cd3;}; \ No newline at end of file +var _0x43b4=['XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','milliseconds','createBody','CampaignId','idContact','type','dialAnswer','membername','countcongestionretry','countglobal','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','updatedAt','%s%s'];(function(_0x86d985,_0x1e738d){var _0xdbac2f=function(_0x3dd4de){while(--_0x3dd4de){_0x86d985['push'](_0x86d985['shift']());}};_0xdbac2f(++_0x1e738d);}(_0x43b4,0xe1));var _0x443b=function(_0x55dcdb,_0x2f4f85){_0x55dcdb=_0x55dcdb-0x0;var _0x3be5e5=_0x43b4[_0x55dcdb];return _0x3be5e5;};'use strict';var util=require(_0x443b('0x0'));var _=require(_0x443b('0x1'));var moment=require(_0x443b('0x2'));var logger=require(_0x443b('0x3'))(_0x443b('0x4'));var ipAgi=process[_0x443b('0x5')][_0x443b('0x6')]||_0x443b('0x7');function getSeconds(_0x394e4d,_0x4a1eaf){var _0x28b36c=moment(_0x394e4d)['milliseconds'](0x0);var _0x545664=moment(_0x4a1eaf)['milliseconds'](0x0);return _0x28b36c[_0x443b('0x8')](_0x545664,'seconds');}exports['loggerCatch']=function(_0x4c0c4e){return function(_0x5db1da){logger[_0x443b('0x9')](_0x4c0c4e,util[_0x443b('0xa')](_0x5db1da,{'showHidden':![],'depth':null}));};};exports[_0x443b('0xb')]=function(_0x4a2f1b,_0x566467){logger[_0x443b('0xc')](_0x4a2f1b,util[_0x443b('0xa')](_0x566467,{'showHidden':![],'depth':null}));};exports[_0x443b('0xd')]=function(_0x375740,_0x528bb8){logger['error'](_0x375740,util[_0x443b('0xa')](_0x528bb8,{'showHidden':![],'depth':null}));};exports[_0x443b('0xe')]=function(_0x39a603){return function(_0x3fc3f0){logger[_0x443b('0xc')](_0x39a603,util['inspect'](_0x3fc3f0,{'showHidden':![],'depth':null}));};};exports[_0x443b('0xf')]=function(_0x31c97,_0x58d985,_0x167956){return{'message':_0x31c97,'unlock':_0x58d985,'active':_0x167956};};exports[_0x443b('0x10')]=function(_0x45b3ae,_0x1567f6,_0x31ee1c){if(!_[_0x443b('0x11')](_0x31ee1c)&&_0x443b('0x12')===typeof _0x31ee1c&&!_[_0x443b('0x13')](_0x31ee1c)){if(!_['isUndefined'](_0x1567f6)&&_0x443b('0x12')===typeof _0x1567f6&&!_['isEmpty'](_0x1567f6)){return util['format']('\x22%s\x22\x20<%s>',_0x1567f6,_0x31ee1c);}return util[_0x443b('0x14')](_0x443b('0x15'),_0x31ee1c,_0x31ee1c);}if(!_[_0x443b('0x11')](_0x45b3ae)&&_0x443b('0x12')===typeof _0x45b3ae&&!_['isEmpty'](_0x45b3ae)){return _0x45b3ae;}return _0x443b('0x16');};exports['isActive']=function(_0x4ff69a){if(_['isNil'](_0x4ff69a)){return![];}return _0x4ff69a;};exports[_0x443b('0x17')]=function(_0x548281,_0xcf2b9a,_0x752ac4,_0x4f263a,_0x1db050,_0x57de1d){var _0x2eadd1={'XMD-QUEUE':_0xcf2b9a[_0x443b('0x18')]?_0xcf2b9a['Queue']['name']:'','XMD-CALLERID':_0x4f263a,'XMD-CALLERID-PREVIEW':_0x57de1d?util[_0x443b('0x14')](_0x443b('0x15'),_0x57de1d[_0x443b('0x19')],_0x57de1d[_0x443b('0x1a')]):_0x4f263a,'XMD-DIALID':_0x1db050,'XMD-CONTACTID':_0xcf2b9a[_0x443b('0x1b')],'XMD-CDRTYPE':_0x443b('0x1c'),'CALLERID(all)':_0x4f263a,'XMD-VOICEQUEUEID':_0xcf2b9a[_0x443b('0x1d')],'XMD-DIALCHANNEL':_0x752ac4,'XMD-DIALTIMEOUT':_0x548281[_0x443b('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x443b('0x14')](_0x443b('0x1f'),_0x548281[_0x443b('0x20')]?'g':'',_[_0x443b('0x13')](_0x548281['monitor_format'])?'':_0x443b('0x21')),'XMD-DIALURL':_0x548281[_0x443b('0x22')]||'','XMD-AGI':_0x548281[_0x443b('0x23')]?util['format'](_0x443b('0x24'),ipAgi,_0x548281['dialQueueProject']):_0x443b('0x25'),'XMD-AGIAFTER':_0x548281[_0x443b('0x20')]?util[_0x443b('0x14')](_0x443b('0x24'),ipAgi,_0x548281[_0x443b('0x20')]):_0x443b('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x57de1d?_0x57de1d[_0x443b('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x57de1d?_0x57de1d['originatecalleridname']:'','XMD-DESTINATION':_0x443b('0x27')};if(!_[_0x443b('0x13')](_0x548281[_0x443b('0x28')])){_0x2eadd1[util[_0x443b('0x14')]('%s',_0x443b('0x29'))]=_0x548281[_0x443b('0x28')];_0x2eadd1[util[_0x443b('0x14')]('%s',_0x443b('0x2a'))]=_0x1db050;}if(_0xcf2b9a&&_0xcf2b9a['Contact']){for(var _0x476f1e in _0xcf2b9a['Contact']){if(_0xcf2b9a[_0x443b('0x2b')][_0x443b('0x2c')](_0x476f1e)){if(!_[_0x443b('0x2d')](_0xcf2b9a[_0x443b('0x2b')][_0x476f1e])&&_0x476f1e!=='id'&&_0x476f1e!=='tags'&&_0x476f1e!==_0x443b('0x2e')&&_0x476f1e!==_0x443b('0x2f')){_0x2eadd1[util[_0x443b('0x14')](_0x443b('0x30'),_0x443b('0x31'),_[_0x443b('0x32')](_0x476f1e))]=_0xcf2b9a[_0x443b('0x2b')][_0x476f1e];}}}}return _0x2eadd1;};exports['toLowerVariables']=function(_0x340825){var _0x569273={};for(var _0x94fbca in _0x340825){if(_0x340825[_0x443b('0x2c')](_0x94fbca)){_0x569273[util[_0x443b('0x14')]('%s',_['toLower'](_0x94fbca))]=_0x340825[_0x94fbca];}}return{'variables':_0x569273};};exports[_0x443b('0x33')]=function(_0x3d524c,_0x5b2458){if(!_[_0x443b('0x2d')](_0x3d524c)){if(_0x3d524c[_0x443b('0x2c')](_0x443b('0x34'))){if(_0x3d524c[_0x443b('0x34')]>0x0){_0x3d524c[_0x443b('0x34')]-=0x1;}else{logger[_0x443b('0x9')](_0x443b('0x35'),_0x5b2458);}}}else{logger[_0x443b('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5b2458);}};exports['logBlacklist']=function(_0x5c178e){var _0x5a0a32=moment()[_0x443b('0x14')](_0x443b('0x36'));_0x5c178e[_0x443b('0x37')]=0xd;_0x5c178e[_0x443b('0x38')]=_0x443b('0x39');_0x5c178e[_0x443b('0x3a')]=_0x5a0a32;_0x5c178e[_0x443b('0x3b')]=_0x5a0a32;_0x5c178e[_0x443b('0x3c')]=_0x5a0a32;};exports[_0x443b('0x3d')]=function(_0x1b0d98,_0x30a349,_0x419489){var _0x3e2aba=moment()[_0x443b('0x14')](_0x443b('0x36'));_0x1b0d98[_0x443b('0x37')]=_0x30a349;_0x1b0d98['statedesc']=_0x419489;_0x1b0d98[_0x443b('0x3b')]=_0x3e2aba;_0x1b0d98[_0x443b('0x3e')]=getSeconds(_0x1b0d98['responsetime'],_0x1b0d98[_0x443b('0x3a')]);};exports[_0x443b('0x3f')]=function(_0x1f08df,_0x5a694f,_0x480134){_0x1f08df['membername']=_0x5a694f;_0x1f08df[_0x443b('0x40')]=_0x480134;};exports[_0x443b('0x41')]=function(_0x29f7a6,_0x6a71bf,_0x3c03dc){var _0xda389d=moment()[_0x443b('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x29f7a6[_0x443b('0x37')]=_0x6a71bf;_0x29f7a6[_0x443b('0x38')]=_0x3c03dc;_0x29f7a6[_0x443b('0x3b')]=_0x29f7a6['responsetime']?_0x29f7a6[_0x443b('0x3b')]:_0xda389d;_0x29f7a6['endtime']=_0x29f7a6[_0x443b('0x3c')]?_0x29f7a6['endtime']:_0xda389d;_0x29f7a6[_0x443b('0x3e')]=getSeconds(_0x29f7a6[_0x443b('0x3b')]||0x0,_0x29f7a6[_0x443b('0x3a')]||0x0);_0x29f7a6[_0x443b('0x42')]=_0x29f7a6[_0x443b('0x43')]?getSeconds(_0x29f7a6[_0x443b('0x3c')],_0x29f7a6[_0x443b('0x43')]):0x0;};exports['isFailure']=function(_0x27fa83){return _0x27fa83===_0x443b('0x44');};exports[_0x443b('0x45')]=function(_0x1c8741,_0x6c72f9,_0x56ca59,_0x26f2a0,_0x500b92){var _0x162fec=_0x26f2a0?_0x443b('0x46'):_0x1c8741[_0x443b('0x19')];_0x162fec=_0x500b92?_0x443b('0x47'):_0x162fec;return{'actionid':_0x1c8741[_0x443b('0x48')],'action':_0x443b('0x49'),'channel':_0x1c8741[_0x443b('0x4a')],'callerid':util[_0x443b('0x14')](_0x443b('0x15'),_0x162fec,_0x1c8741[_0x443b('0x1a')]),'Exten':_0x443b('0x27'),'Context':'from-sip','Priority':'1','variable':_0x56ca59,'timeout':(_0x6c72f9[_0x443b('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1c8741[_0x443b('0x48')]};};exports[_0x443b('0x4c')]=function(_0x3677e2){return _0x3677e2[_0x443b('0x4d')]+_0x3677e2['countcongestionretry']+_0x3677e2[_0x443b('0x4e')]+_0x3677e2[_0x443b('0x4f')]+_0x3677e2[_0x443b('0x50')];};exports['cloneAction']=function(_0x4dc8eb){var _0xa16617=_[_0x443b('0x51')](_0x4dc8eb);_0xa16617['state']=0xf;_0xa16617[_0x443b('0x38')]=_0x443b('0x52');return _0xa16617;};exports['scheduledAt']=function(_0x5b6fc5,_0x371942,_0x406754){var _0x4df802={};_0x4df802[_0x371942]=_0x5b6fc5[_0x371942];_0x4df802[_0x443b('0x53')]=![];_0x4df802[_0x443b('0x54')]=moment()['add'](_0x406754,_0x443b('0x55'))[_0x443b('0x14')](_0x443b('0x36'));_0x4df802[_0x443b('0x1b')]=_0x5b6fc5['ContactId'];_0x4df802[_0x443b('0x56')]=_0x5b6fc5[_0x443b('0x56')];_0x4df802['VoiceQueueId']=_0x5b6fc5[_0x443b('0x1d')]||undefined;return _0x4df802;};exports[_0x443b('0x57')]=function(_0x375538,_0x247db7){if(!_[_0x443b('0x2d')](_0x375538)){if(_0x375538[_0x443b('0x58')]>0x0){_0x375538[_0x443b('0x58')]-=0x1;}else{logger[_0x443b('0x9')](_0x247db7,_0x443b('0x59'));}}else{logger['error'](_0x247db7,_0x443b('0x5a'));}};exports[_0x443b('0x5b')]=function(_0x4570a8){if(_0x4570a8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2df002,_0x5a28d1,_0x12eab6){_0x2df002[_0x443b('0x5c')]=_0x5a28d1;_0x2df002['name']=_0x2df002[_0x443b('0x5d')];_0x2df002['interface']=_0x2df002[_0x443b('0x4a')];if(_0x12eab6){_0x2df002[_0x443b('0x5e')]=_0x12eab6[_0x443b('0x5e')];}return _0x2df002;};exports[_0x443b('0x5f')]=function(_0xa5cc0f){var _0x4129b3={};_0x4129b3['queue']=_0xa5cc0f[_0x443b('0x5d')];_0x4129b3['interface']=_0xa5cc0f[_0x443b('0x4a')];_0x4129b3['uniqueid']=_0xa5cc0f[_0x443b('0x48')];return _0x4129b3;};exports[_0x443b('0x60')]=function(_0x44ca87){var _0x41eeee=[];for(var _0x585eeb in _0x44ca87){if(_0x44ca87[_0x443b('0x2c')](_0x585eeb)){if(!_[_0x443b('0x2d')](_0x44ca87[_0x585eeb])&&_0x44ca87[_0x585eeb][_0x443b('0x37')]===_0x443b('0x61')&&_0x44ca87[_0x585eeb][_0x443b('0x62')]==='reachable'){_0x41eeee[_0x443b('0x63')](_0x44ca87[_0x585eeb]['id']);}}}return _0x41eeee;};exports['getDiff']=function(_0x367116){var _0x4f9812=moment()['milliseconds'](0x0);var _0x12221e=moment(_0x367116)[_0x443b('0x64')](0x0);return _0x4f9812[_0x443b('0x8')](_0x12221e,'seconds');};exports[_0x443b('0x65')]=function(_0x412843){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x412843[_0x443b('0x1b')],'ListId':_0x412843['ListId'],'VoiceQueueId':_0x412843['VoiceQueueId']||undefined,'CampaignId':_0x412843[_0x443b('0x66')]||undefined};};exports['filterKey']=function(_0x4fc85c){if(_0x4fc85c===_0x443b('0x48')||_0x4fc85c===_0x443b('0x67')||_0x4fc85c===_0x443b('0x5d')||_0x4fc85c===_0x443b('0x68')||_0x4fc85c==='campaigntype'||_0x4fc85c===_0x443b('0x69')||_0x4fc85c===_0x443b('0x6a')||_0x4fc85c==='channelAgent'||_0x4fc85c===_0x443b('0x19')||_0x4fc85c===_0x443b('0x53')||_0x4fc85c===_0x443b('0x1a')||_0x4fc85c===_0x443b('0x54')||_0x4fc85c===_0x443b('0x4d')||_0x4fc85c===_0x443b('0x6b')||_0x4fc85c===_0x443b('0x4e')||_0x4fc85c===_0x443b('0x6c')||_0x4fc85c==='callback'||_0x4fc85c==='callbackuniqueid'||_0x4fc85c===_0x443b('0x6d')||_0x4fc85c===_0x443b('0x6e')||_0x4fc85c===_0x443b('0x1b')||_0x4fc85c==='ListId'||_0x4fc85c==='UserId'||_0x4fc85c===_0x443b('0x1d')||_0x4fc85c===_0x443b('0x6f')||_0x4fc85c==='xmd-voicequeueid'||_0x4fc85c===_0x443b('0x70')||_0x4fc85c===_0x443b('0x71')||_0x4fc85c===_0x443b('0x72')||_0x4fc85c===_0x443b('0x73')||_0x4fc85c===_0x443b('0x74')||_0x4fc85c===_0x443b('0x75')||_0x4fc85c===_0x443b('0x76')||_0x4fc85c==='xmd-dialchannel'||_0x4fc85c===_0x443b('0x77')||_0x4fc85c==='xmd-cdrtype'||_0x4fc85c===_0x443b('0x78')||_0x4fc85c==='xmd-agiafter'||_0x4fc85c==='xmd-agi'||_0x4fc85c===_0x443b('0x79')||_0x4fc85c===_0x443b('0x7a')||_0x4fc85c==='rtpaudioqosjitter'||_0x4fc85c===_0x443b('0x7b')||_0x4fc85c===_0x443b('0x7c')||_0x4fc85c===_0x443b('0x7d')||_0x4fc85c==='rtpaudioqosrtt'||_0x4fc85c===_0x443b('0x7e')||_0x4fc85c===_0x443b('0x79')||_0x4fc85c===_0x443b('0x7a')||_0x4fc85c===_0x443b('0x7f')||_0x4fc85c===_0x443b('0x7b')||_0x4fc85c==='rtpaudioqosloss'||_0x4fc85c==='rtpaudioqoslossbridged'||_0x4fc85c===_0x443b('0x80')||_0x4fc85c===_0x443b('0x7e')||_0x4fc85c===_0x443b('0x81')||_0x4fc85c===_0x443b('0x82')||_0x4fc85c===_0x443b('0x37')||_0x4fc85c==='statedesc'){return![];}return!![];};exports[_0x443b('0x83')]=function(_0x1ede2f,_0x8d66e4){var _0xac2368,_0xba858d,_0x293b08;if(_0x8d66e4<=0x0){_0x8d66e4=0x1;}_0xac2368=new RegExp(_0x443b('0x84')+_0x8d66e4+'}$');_0xba858d=Math[_0x443b('0x85')](0xa,_0x8d66e4-0x1);_0x293b08=Math[_0x443b('0x85')](0xa,_0x8d66e4)-0x1;return util['format']('%s',_['replace'](_0x1ede2f,_0xac2368,_[_0x443b('0x86')](_0xba858d,_0x293b08)));};exports[_0x443b('0x87')]=function(_0x469761){var _0x89da91=_0x469761[_0x443b('0x88')](/"(.*?)"/);return _0x89da91?_0x89da91[0x1]:_0x469761;};exports['extractCalleridNumber']=function(_0x270985){var _0x28e316=_0x270985[_0x443b('0x88')](/<(.*?)>/);return _0x28e316?_0x28e316[0x1]:_0x270985;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index de52ed4..a3a44f2 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x595267,_0x571349){var _0x58d166=function(_0x3a5606){while(--_0x3a5606){_0x595267['push'](_0x595267['shift']());}};_0x58d166(++_0x571349);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xb10b[_0x1a595a];return _0x33f008;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x51e32a,_0x381508){var _0x330db4=function(_0x1c1f0f){while(--_0x1c1f0f){_0x51e32a['push'](_0x51e32a['shift']());}};_0x330db4(++_0x381508);}(_0x7a54,0x106));var _0x47a5=function(_0x12ebcf,_0x4a8488){_0x12ebcf=_0x12ebcf-0x0;var _0x23c9aa=_0x7a54[_0x12ebcf];return _0x23c9aa;};'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 diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f4147eb..b9faedb 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 _0x3ce5=['faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','name','interface','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','agents','isUndefined','initTelephones','telephones','length','initTrunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','merge','initVoiceQueueReports','queuecallerexit','unmanaged','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/campaign','../model/voiceExtension','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x3ce5,0x176));var _0x53ce=function(_0x2e8351,_0x5ef0d3){_0x2e8351=_0x2e8351-0x0;var _0x171f32=_0x3ce5[_0x2e8351];return _0x171f32;};'use strict';var BPromise=require(_0x53ce('0x0'));var util=require(_0x53ce('0x1'));var _=require(_0x53ce('0x2'));var moment=require(_0x53ce('0x3'));var Agent=require(_0x53ce('0x4'));var Telephone=require(_0x53ce('0x5'));var Trunk=require(_0x53ce('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x53ce('0x7'));var VoiceExtension=require(_0x53ce('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x53ce('0x9'));var ZohoAccount=require(_0x53ce('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x53ce('0xb'));var ServicenowAccount=require(_0x53ce('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x53ce('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this['telephones']={};this[_0x53ce('0xe')]={};this[_0x53ce('0xf')]={};this['triggers']={};this[_0x53ce('0x10')]={};this[_0x53ce('0x11')]={};this[_0x53ce('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x53ce('0x13')]={};this[_0x53ce('0x14')]={};this[_0x53ce('0x15')]={};this[_0x53ce('0x16')]={};this['timers']={};this[_0x53ce('0x17')]={};this['salesforceAccounts']={};this[_0x53ce('0x18')]={};this['freshdeskAccounts']={};this[_0x53ce('0x19')]={};this[_0x53ce('0x1a')]={};this['vtigerAccounts']={};this[_0x53ce('0x1b')]={};this[_0x53ce('0x1c')]={};this[_0x53ce('0x1d')]={};this[_0x53ce('0x1e')]={};};function freeIsNotKey(_0x52adef,_0x205b0b,_0x1cbf92){var _0x4cde0b=_[_0x53ce('0x1f')](_0x52adef,function(_0x61aafb,_0x4e69cb){return _0x61aafb[_0x1cbf92];});for(var _0x2876af in _0x205b0b){if(_0x205b0b[_0x53ce('0x20')](_0x2876af)){if(!_0x4cde0b[_0x2876af]){delete _0x205b0b[_0x2876af];}}}}function freeIsNotKeySip(_0x217b8f,_0x11acd9){var _0x1425b1=_['mapKeys'](_0x217b8f,function(_0x5e920b,_0x924bee){return util[_0x53ce('0x21')](_0x53ce('0x22'),_0x5e920b['name']);});for(var _0x36f2f2 in _0x11acd9){if(_0x11acd9[_0x53ce('0x20')](_0x36f2f2)){if(!_0x1425b1[_0x36f2f2]){delete _0x11acd9[_0x36f2f2];}}}}function freeIsNotKeyAgent(_0x170bbd,_0x44e2b0){var _0x3875d1=_[_0x53ce('0x1f')](_0x170bbd,function(_0x3b6489,_0x31332e){var _0x4c7f07=_[_0x53ce('0x23')](_0x3b6489['interface'])?util[_0x53ce('0x21')](_0x53ce('0x22'),_0x3b6489[_0x53ce('0x24')]):_0x3b6489[_0x53ce('0x25')];return _0x4c7f07;});for(var _0xc7f66d in _0x44e2b0){if(_0x44e2b0['hasOwnProperty'](_0xc7f66d)){if(!_0x3875d1[_0xc7f66d]){delete _0x44e2b0[_0xc7f66d];}}}}function clearVoiceCallReports(_0x37f758){_0x37f758['total']=0x0;_0x37f758[_0x53ce('0x26')]=0x0;_0x37f758['sumHoldTime']=0x0;_0x37f758[_0x53ce('0x27')]=0x0;_0x37f758[_0x53ce('0x28')]=0x0;}function clearCampaigns(_0x24c819){if(!_[_0x53ce('0x29')](_0x24c819)){for(var _0x39ac2a in _0x24c819){if(_0x24c819[_0x53ce('0x20')](_0x39ac2a)){_0x24c819[_0x39ac2a]['ivrTotalCallsDays']=0x0;_0x24c819[_0x39ac2a][_0x53ce('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x3a8bb2){if(!_[_0x53ce('0x29')](_0x3a8bb2)){for(var _0x361bbc in _0x3a8bb2){if(_0x3a8bb2[_0x53ce('0x20')](_0x361bbc)){_0x3a8bb2[_0x361bbc][_0x53ce('0x2b')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x26')]=0x0;_0x3a8bb2[_0x361bbc]['unmanaged']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2c')]=0x0;_0x3a8bb2[_0x361bbc]['sumHoldTime']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x27')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x28')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2d')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2e')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x2f')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x30')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x31')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x32')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x33')]=0x0;_0x3a8bb2[_0x361bbc]['outboundDropCallsDayCallersExit']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x34')]=0x0;_0x3a8bb2[_0x361bbc]['outboundOriginateFailureCallsDay']=0x0;_0x3a8bb2[_0x361bbc]['outboundRejectCallsDay']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x35')]=0x0;_0x3a8bb2[_0x361bbc]['outboundAnswerAgiCallsDay']=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x36')]=0x0;_0x3a8bb2[_0x361bbc][_0x53ce('0x37')]=!![];}}}}Realtime['prototype'][_0x53ce('0x38')]=function(_0xf81b49,_0x5101a9){for(var _0x2861cf in _0x5101a9){if(_0xf81b49[_0x53ce('0x20')](_0x2861cf)){_0xf81b49[_0x2861cf]=_0x5101a9[_0x2861cf];}}};Realtime[_0x53ce('0x39')]['initAgents']=function(){var _0x4c9fae=this;return function(_0x34497c){if(_0x34497c){freeIsNotKeyAgent(_0x34497c,_0x4c9fae[_0x53ce('0x3a')]);for(var _0x486259=0x0,_0x4ab0e7={},_0x229aa6={};_0x486259<_0x34497c['length'];_0x486259+=0x1){_0x4ab0e7=_0x34497c[_0x486259];var _0x40a21a=_[_0x53ce('0x23')](_0x4ab0e7[_0x53ce('0x25')])?util['format'](_0x53ce('0x22'),_0x4ab0e7[_0x53ce('0x24')]):_0x4ab0e7[_0x53ce('0x25')];if(_[_0x53ce('0x3b')](_0x4c9fae[_0x53ce('0x3a')][_0x40a21a])){_0x4c9fae[_0x53ce('0x3a')][_0x40a21a]=new Agent(_0x4ab0e7);}else{_0x4c9fae['mergeFromDatabase'](_0x4c9fae[_0x53ce('0x3a')][_0x40a21a],_0x4ab0e7);}}}return _0x4c9fae[_0x53ce('0x3a')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x3c')]=function(){var _0x5d49b2=this;return function(_0xeada0e){if(_0xeada0e){freeIsNotKeySip(_0xeada0e,_0x5d49b2[_0x53ce('0x3d')]);for(var _0x49b592=0x0,_0x1f3098={},_0x3f0b9d={};_0x49b592<_0xeada0e[_0x53ce('0x3e')];_0x49b592+=0x1){_0x1f3098=_0xeada0e[_0x49b592];if(_['isUndefined'](_0x5d49b2[_0x53ce('0x3d')][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x1f3098[_0x53ce('0x24')])])){_0x5d49b2[_0x53ce('0x3d')][util['format'](_0x53ce('0x22'),_0x1f3098['name'])]=new Telephone(_0x1f3098);}else{_0x5d49b2[_0x53ce('0x38')](_0x5d49b2['telephones'][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x1f3098[_0x53ce('0x24')])],_0x1f3098);}}}return _0x5d49b2[_0x53ce('0x3d')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x3f')]=function(){var _0x2cb27d=this;return function(_0x1c495d){if(_0x1c495d){freeIsNotKeySip(_0x1c495d,_0x2cb27d[_0x53ce('0xe')]);for(var _0x39fa67=0x0,_0x403cf4={},_0x482193={};_0x39fa67<_0x1c495d['length'];_0x39fa67+=0x1){_0x403cf4=_0x1c495d[_0x39fa67];if(_[_0x53ce('0x3b')](_0x2cb27d[_0x53ce('0xe')][util[_0x53ce('0x21')]('SIP/%s',_0x403cf4[_0x53ce('0x24')])])){_0x2cb27d[_0x53ce('0xe')][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x403cf4[_0x53ce('0x24')])]=new Trunk(_0x403cf4);}else{_0x2cb27d['mergeFromDatabase'](_0x2cb27d['trunks'][util[_0x53ce('0x21')](_0x53ce('0x22'),_0x403cf4['name'])],_0x403cf4);}}}return _0x2cb27d[_0x53ce('0xe')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x40')]=function(){var _0x1fa097=this;return function(_0x673d69){if(_0x673d69){freeIsNotKey(_0x673d69,_0x1fa097[_0x53ce('0xf')],_0x53ce('0x24'));for(var _0xfa9724=0x0,_0x5d20e4={},_0x17ee60={};_0xfa9724<_0x673d69[_0x53ce('0x3e')];_0xfa9724+=0x1){_0x5d20e4=_0x673d69[_0xfa9724];if(_[_0x53ce('0x3b')](_0x1fa097['voiceQueues'][_0x5d20e4['name']])){_0x1fa097[_0x53ce('0xf')][_0x5d20e4['name']]=new VoiceQueue(_0x5d20e4);}else{_0x1fa097['mergeFromDatabase'](_0x1fa097[_0x53ce('0xf')][_0x5d20e4[_0x53ce('0x24')]],_0x5d20e4);}}}return _0x1fa097[_0x53ce('0xf')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x41')]=function(){var _0x10eb32=this;return function(_0x76aa33){if(_0x76aa33){freeIsNotKey(_0x76aa33,_0x10eb32[_0x53ce('0x42')],'id');for(var _0x2a9df6=0x0,_0x556420={},_0x4b1058={};_0x2a9df6<_0x76aa33['length'];_0x2a9df6+=0x1){_0x556420=_0x76aa33[_0x2a9df6];if(_['isUndefined'](_0x10eb32[_0x53ce('0x42')][_0x556420['id']])){_0x10eb32[_0x53ce('0x42')][_0x556420['id']]=new Trigger(_0x556420);}else{_0x10eb32[_0x53ce('0x38')](_0x10eb32[_0x53ce('0x42')][_0x556420['id']],_0x556420);}}}return _0x10eb32[_0x53ce('0x42')];};};Realtime[_0x53ce('0x39')]['initTemplates']=function(){var _0x2e2ebc=this;return function(_0x249b87){if(_0x249b87){freeIsNotKey(_0x249b87,_0x2e2ebc['templates'],'id');for(var _0xad789e=0x0,_0x320fff={},_0x1d5c29={};_0xad789e<_0x249b87['length'];_0xad789e+=0x1){_0x320fff=_0x249b87[_0xad789e];if(_[_0x53ce('0x3b')](_0x2e2ebc[_0x53ce('0x11')][_0x320fff['id']])){_0x2e2ebc[_0x53ce('0x11')][_0x320fff['id']]=new Template(_0x320fff);}else{_0x2e2ebc['mergeFromDatabase'](_0x2e2ebc['templates'][_0x320fff['id']],_0x320fff);}}}return _0x2e2ebc[_0x53ce('0x11')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x43')]=function(){var _0x25eb1a=this;return function(_0x1abeb5){if(_0x1abeb5){freeIsNotKey(_0x1abeb5,_0x25eb1a[_0x53ce('0x17')],'id');for(var _0x16b12d=0x0,_0x230183={},_0x581cac={};_0x16b12d<_0x1abeb5[_0x53ce('0x3e')];_0x16b12d+=0x1){_0x230183=_0x1abeb5[_0x16b12d];if(_['isUndefined'](_0x25eb1a[_0x53ce('0x17')][_0x230183['id']])){_0x25eb1a[_0x53ce('0x17')][_0x230183['id']]=new ZendeskAccount(_0x230183);}else{_0x25eb1a[_0x53ce('0x38')](_0x25eb1a[_0x53ce('0x17')][_0x230183['id']],_0x230183);}}}return _0x25eb1a[_0x53ce('0x17')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x69910f=this;return function(_0x1ea579){if(_0x1ea579){freeIsNotKey(_0x1ea579,_0x69910f[_0x53ce('0x44')],'id');for(var _0x208ea6=0x0,_0x2cedd4={},_0x2419cc={};_0x208ea6<_0x1ea579['length'];_0x208ea6+=0x1){_0x2cedd4=_0x1ea579[_0x208ea6];if(_['isUndefined'](_0x69910f[_0x53ce('0x44')][_0x2cedd4['id']])){_0x69910f['salesforceAccounts'][_0x2cedd4['id']]=new SalesforceAccount(_0x2cedd4);}else{_0x69910f[_0x53ce('0x38')](_0x69910f[_0x53ce('0x44')][_0x2cedd4['id']],_0x2cedd4);}}}return _0x69910f['salesforceAccounts'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x45')]=function(){var _0x204702=this;return function(_0x2d35f1){if(_0x2d35f1){freeIsNotKey(_0x2d35f1,_0x204702[_0x53ce('0x46')],'id');for(var _0x13fd8d=0x0,_0x3d8dbd={},_0x699355={};_0x13fd8d<_0x2d35f1[_0x53ce('0x3e')];_0x13fd8d+=0x1){_0x3d8dbd=_0x2d35f1[_0x13fd8d];if(_[_0x53ce('0x3b')](_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']])){_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']]=new FreshdeskAccount(_0x3d8dbd);}else{_0x204702['mergeFromDatabase'](_0x204702[_0x53ce('0x46')][_0x3d8dbd['id']],_0x3d8dbd);}}}return _0x204702[_0x53ce('0x46')];};};Realtime['prototype'][_0x53ce('0x47')]=function(){var _0x44194e=this;return function(_0xae5186){if(_0xae5186){freeIsNotKey(_0xae5186,_0x44194e['zohoAccounts'],'id');for(var _0x344e38=0x0,_0x160b1e={},_0x3c3187={};_0x344e38<_0xae5186[_0x53ce('0x3e')];_0x344e38+=0x1){_0x160b1e=_0xae5186[_0x344e38];if(_['isUndefined'](_0x44194e[_0x53ce('0x19')][_0x160b1e['id']])){_0x44194e[_0x53ce('0x19')][_0x160b1e['id']]=new ZohoAccount(_0x160b1e);}else{_0x44194e[_0x53ce('0x38')](_0x44194e[_0x53ce('0x19')][_0x160b1e['id']],_0x160b1e);}}}return _0x44194e[_0x53ce('0x19')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x48')]=function(){var _0x337c3f=this;return function(_0x305491){if(_0x305491){freeIsNotKey(_0x305491,_0x337c3f[_0x53ce('0x1a')],'id');for(var _0x497738=0x0,_0x3a7a62={},_0x5621e2={};_0x497738<_0x305491[_0x53ce('0x3e')];_0x497738+=0x1){_0x3a7a62=_0x305491[_0x497738];if(_['isUndefined'](_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']])){_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']]=new DeskAccount(_0x3a7a62);}else{_0x337c3f[_0x53ce('0x38')](_0x337c3f[_0x53ce('0x1a')][_0x3a7a62['id']],_0x3a7a62);}}}return _0x337c3f[_0x53ce('0x1a')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x49')]=function(){var _0x2c119e=this;return function(_0x4b7753){if(_0x4b7753){freeIsNotKey(_0x4b7753,_0x2c119e[_0x53ce('0x18')],'id');for(var _0x1a148d=0x0,_0x31dd0d={},_0x49bf40={};_0x1a148d<_0x4b7753[_0x53ce('0x3e')];_0x1a148d+=0x1){_0x31dd0d=_0x4b7753[_0x1a148d];if(_[_0x53ce('0x3b')](_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']])){_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']]=new SugarcrmAccount(_0x31dd0d);}else{_0x2c119e[_0x53ce('0x38')](_0x2c119e[_0x53ce('0x18')][_0x31dd0d['id']],_0x31dd0d);}}}return _0x2c119e[_0x53ce('0x18')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x4a')]=function(){var _0x183a6b=this;return function(_0x50631c){if(_0x50631c){freeIsNotKey(_0x50631c,_0x183a6b[_0x53ce('0x4b')],'id');for(var _0xda23bc=0x0,_0xa3379a={},_0x39d670={};_0xda23bc<_0x50631c[_0x53ce('0x3e')];_0xda23bc+=0x1){_0xa3379a=_0x50631c[_0xda23bc];if(_[_0x53ce('0x3b')](_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']])){_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']]=new VtigerAccount(_0xa3379a);}else{_0x183a6b[_0x53ce('0x38')](_0x183a6b[_0x53ce('0x4b')][_0xa3379a['id']],_0xa3379a);}}}return _0x183a6b[_0x53ce('0x4b')];};};Realtime['prototype'][_0x53ce('0x4c')]=function(){var _0x5ed378=this;return function(_0x3f12c8){if(_0x3f12c8){freeIsNotKey(_0x3f12c8,_0x5ed378[_0x53ce('0x1b')],'id');for(var _0xaed23f=0x0,_0x20c6c0={},_0xe344f1={};_0xaed23f<_0x3f12c8[_0x53ce('0x3e')];_0xaed23f+=0x1){_0x20c6c0=_0x3f12c8[_0xaed23f];if(_[_0x53ce('0x3b')](_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']])){_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']]=new ServicenowAccount(_0x20c6c0);}else{_0x5ed378[_0x53ce('0x38')](_0x5ed378[_0x53ce('0x1b')][_0x20c6c0['id']],_0x20c6c0);}}}return _0x5ed378[_0x53ce('0x1b')];};};Realtime[_0x53ce('0x39')]['initDynamics365Accounts']=function(){var _0x535c90=this;return function(_0x23a48c){if(_0x23a48c){freeIsNotKey(_0x23a48c,_0x535c90['dynamics365Accounts'],'id');for(var _0x39c385=0x0,_0x158fc4={},_0x4912cf={};_0x39c385<_0x23a48c[_0x53ce('0x3e')];_0x39c385+=0x1){_0x158fc4=_0x23a48c[_0x39c385];if(_['isUndefined'](_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']])){_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']]=new Dynamics365Account(_0x158fc4);}else{_0x535c90[_0x53ce('0x38')](_0x535c90[_0x53ce('0x1c')][_0x158fc4['id']],_0x158fc4);}}}return _0x535c90['dynamics365Accounts'];};};Realtime['prototype'][_0x53ce('0x4d')]=function(){var _0x357901=this;return function(_0x4f13a1){if(_0x4f13a1){freeIsNotKey(_0x4f13a1,_0x357901[_0x53ce('0x1d')],'id');for(var _0x2aec9a=0x0,_0x27574d={},_0x5d1633={};_0x2aec9a<_0x4f13a1[_0x53ce('0x3e')];_0x2aec9a+=0x1){_0x27574d=_0x4f13a1[_0x2aec9a];if(_[_0x53ce('0x3b')](_0x357901[_0x53ce('0x1d')][_0x27574d['id']])){_0x357901[_0x53ce('0x1d')][_0x27574d['id']]=new FreshsalesAccount(_0x27574d);}else{_0x357901[_0x53ce('0x38')](_0x357901[_0x53ce('0x1d')][_0x27574d['id']],_0x27574d);}}}return _0x357901['freshsalesAccounts'];};};Realtime[_0x53ce('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x394771=this;return function(_0x563d4c){for(var _0x1330a8=0x0;_0x1330a8<_0x563d4c[_0x53ce('0x3e')];_0x1330a8+=0x1){_[_0x53ce('0x4e')](_0x394771[_0x53ce('0xf')][_0x563d4c[_0x1330a8][_0x53ce('0x24')]],_0x563d4c[_0x1330a8]);}return _0x394771['voiceQueues'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x4f')]=function(){var _0x5f4064=this;return function(_0x562895){clearVoiceQueues(_0x5f4064[_0x53ce('0xf')]);if(_0x562895){_0x562895=_['groupBy'](_0x562895,'uniqueid');for(var _0x48a113 in _0x562895){if(_0x562895[_0x53ce('0x20')](_0x48a113)){var _0x510a68={};for(var _0xf602f7=0x0;_0xf602f7<_0x562895[_0x48a113][_0x53ce('0x3e')];_0xf602f7+=0x1){var _0x3e1346=_0x562895[_0x48a113][_0xf602f7]['queue'];if(_0x5f4064[_0x53ce('0xf')][_0x3e1346]){if(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x50')]){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x51')]+=0x1;}if(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x52')]){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x2c')]+=0x1;}_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x53')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x54')])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x56')]),_0x53ce('0x57'))||0x0;if(_0xf602f7===_0x562895[_0x48a113][_0x53ce('0x3e')]-0x1){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x27')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x58')]||_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x59')]||_0x562895[_0x48a113][_0xf602f7]['queuecallerexitAt'])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x56')]),_0x53ce('0x57'))||0x0;_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x2b')]+=0x1;if(_0x562895[_0x48a113][_0xf602f7]['queuecallercomplete']){_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x26')]+=0x1;_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x28')]+=moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x58')])[_0x53ce('0x55')](moment(_0x562895[_0x48a113][_0xf602f7][_0x53ce('0x54')]),'seconds')||0x0;}}else{_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x27')]+=_0x5f4064[_0x53ce('0xf')][_0x3e1346][_0x53ce('0x53')]||0x0;}}}}}}return _0x5f4064['voiceQueues'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x5a')]=function(){var _0x5f69aa=this;return function(_0x1b7593){clearVoiceCallReports(_0x5f69aa['outbound']);if(_0x1b7593){for(var _0x424694=0x0;_0x424694<_0x1b7593[_0x53ce('0x3e')];_0x424694+=0x1){_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x2b')]+=0x1;_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x27')]+=_0x1b7593[_0x424694][_0x53ce('0x5b')];if(_0x1b7593[_0x424694][_0x53ce('0x5c')]===_0x53ce('0x5d')){_0x5f69aa['outbound'][_0x53ce('0x26')]+=0x1;_0x5f69aa[_0x53ce('0x12')]['sumHoldTime']+=_0x1b7593[_0x424694][_0x53ce('0x5b')]-_0x1b7593[_0x424694][_0x53ce('0x5e')]||0x0;_0x5f69aa[_0x53ce('0x12')][_0x53ce('0x28')]+=_0x1b7593[_0x424694][_0x53ce('0x5e')];}}}return _0x5f69aa[_0x53ce('0x12')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x5f')]=function(){var _0x2c83f5=this;return function(_0x40f0b0){if(_0x40f0b0){freeIsNotKey(_0x40f0b0,_0x2c83f5[_0x53ce('0x10')],'name');for(var _0x3c0c14=0x0,_0x186d99={};_0x3c0c14<_0x40f0b0[_0x53ce('0x3e')];_0x3c0c14+=0x1){_0x186d99=_0x40f0b0[_0x3c0c14];if(_['isUndefined'](_0x2c83f5[_0x53ce('0x10')][_0x186d99['name']])){_0x2c83f5[_0x53ce('0x10')][_0x186d99[_0x53ce('0x24')]]=new Campaign(_0x186d99);}else{_0x2c83f5[_0x53ce('0x38')](_0x2c83f5[_0x53ce('0x10')][_0x186d99[_0x53ce('0x24')]],_0x186d99);_0x2c83f5[_0x53ce('0x10')][_0x186d99['name']][_0x53ce('0x60')]=_0x186d99[_0x53ce('0x61')]?_0x186d99['SquareProject']['name']:undefined;}}}return _0x2c83f5['campaigns'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x62')]=function(){var _0x12c963=this;return function(_0x58fe80){if(_0x58fe80){freeIsNotKey(_0x58fe80,_0x12c963['voiceExtensions'],'id');for(var _0x15270a=0x0,_0x3fb19c={};_0x15270a<_0x58fe80['length'];_0x15270a+=0x1){_0x3fb19c=_0x58fe80[_0x15270a];if(_['isUndefined'](_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']])){_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']]=new VoiceExtension(_0x3fb19c);}else{_0x12c963[_0x53ce('0x38')](_0x12c963[_0x53ce('0x13')][_0x3fb19c['id']],_0x3fb19c);}}}return _0x12c963[_0x53ce('0x13')];};};Realtime[_0x53ce('0x39')][_0x53ce('0x63')]=function(){var _0x277dba=this;return function(_0x14c9cf){clearCampaigns(_0x277dba[_0x53ce('0x10')]);for(var _0x3f65d8=0x0;_0x3f65d8<_0x14c9cf[_0x53ce('0x3e')];_0x3f65d8+=0x1){_[_0x53ce('0x4e')](_0x277dba[_0x53ce('0x10')][_0x14c9cf[_0x3f65d8][_0x53ce('0x24')]],_0x14c9cf[_0x3f65d8]);}return _0x277dba['campaigns'];};};Realtime[_0x53ce('0x39')][_0x53ce('0x64')]=function(){var _0x204f5a=this;return function(_0xc1863){if(_0xc1863){freeIsNotKey(_0xc1863,_0x204f5a[_0x53ce('0x1e')],'id');for(var _0x1a5dae=0x0,_0x4b36d5={},_0x439934={};_0x1a5dae<_0xc1863[_0x53ce('0x3e')];_0x1a5dae+=0x1){_0x4b36d5=_0xc1863[_0x1a5dae];if(_[_0x53ce('0x3b')](_0x204f5a[_0x53ce('0x1e')][_0x4b36d5['id']])){_0x204f5a['faxAccounts'][_0x4b36d5['id']]=new FaxAccount(_0x4b36d5);}else{_0x204f5a[_0x53ce('0x38')](_0x204f5a[_0x53ce('0x1e')][_0x4b36d5['id']],_0x4b36d5);}}}return _0x204f5a[_0x53ce('0x1e')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7f28=['queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','answered','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','total','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','servicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue'];(function(_0x4c4d65,_0x2baa9a){var _0x29ff3a=function(_0x52ccd3){while(--_0x52ccd3){_0x4c4d65['push'](_0x4c4d65['shift']());}};_0x29ff3a(++_0x2baa9a);}(_0x7f28,0x84));var _0x87f2=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7f28[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require(_0x87f2('0x0'));var util=require('util');var _=require(_0x87f2('0x1'));var moment=require(_0x87f2('0x2'));var Agent=require(_0x87f2('0x3'));var Telephone=require(_0x87f2('0x4'));var Trunk=require(_0x87f2('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x87f2('0x6'));var Template=require('../model/template');var Campaign=require(_0x87f2('0x7'));var VoiceExtension=require(_0x87f2('0x8'));var ZendeskAccount=require(_0x87f2('0x9'));var SalesforceAccount=require(_0x87f2('0xa'));var FreshdeskAccount=require(_0x87f2('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x87f2('0xc'));var DeskAccount=require(_0x87f2('0xd'));var VtigerAccount=require(_0x87f2('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x87f2('0xf')]={};this[_0x87f2('0x10')]={};this[_0x87f2('0x11')]={};this[_0x87f2('0x12')]={};this[_0x87f2('0x13')]={};this['campaigns']={};this[_0x87f2('0x14')]={};this[_0x87f2('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x87f2('0x16')]={};this['channels']={};this[_0x87f2('0x17')]={};this[_0x87f2('0x18')]={};this[_0x87f2('0x19')]={};this[_0x87f2('0x1a')]={};this['salesforceAccounts']={};this[_0x87f2('0x1b')]={};this[_0x87f2('0x1c')]={};this['zohoAccounts']={};this[_0x87f2('0x1d')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x87f2('0x1e')]={};this[_0x87f2('0x1f')]={};this[_0x87f2('0x20')]={};};function freeIsNotKey(_0xc5c1c2,_0xf6064b,_0x13a942){var _0x2a2c65=_[_0x87f2('0x21')](_0xc5c1c2,function(_0x2186ad,_0x184870){return _0x2186ad[_0x13a942];});for(var _0x454eae in _0xf6064b){if(_0xf6064b['hasOwnProperty'](_0x454eae)){if(!_0x2a2c65[_0x454eae]){delete _0xf6064b[_0x454eae];}}}}function freeIsNotKeySip(_0x12813f,_0x54bc14){var _0x58a9ba=_['mapKeys'](_0x12813f,function(_0x26aaee,_0x1b9b99){return util[_0x87f2('0x22')](_0x87f2('0x23'),_0x26aaee[_0x87f2('0x24')]);});for(var _0x5ee3e0 in _0x54bc14){if(_0x54bc14['hasOwnProperty'](_0x5ee3e0)){if(!_0x58a9ba[_0x5ee3e0]){delete _0x54bc14[_0x5ee3e0];}}}}function freeIsNotKeyAgent(_0x528c9c,_0x3c9f94){var _0x596931=_['mapKeys'](_0x528c9c,function(_0xf18431,_0x29ad27){var _0x5e68d4=_[_0x87f2('0x25')](_0xf18431[_0x87f2('0x26')])?util[_0x87f2('0x22')](_0x87f2('0x23'),_0xf18431[_0x87f2('0x24')]):_0xf18431[_0x87f2('0x26')];return _0x5e68d4;});for(var _0x1845d8 in _0x3c9f94){if(_0x3c9f94[_0x87f2('0x27')](_0x1845d8)){if(!_0x596931[_0x1845d8]){delete _0x3c9f94[_0x1845d8];}}}}function clearVoiceCallReports(_0xb36ad7){_0xb36ad7['total']=0x0;_0xb36ad7[_0x87f2('0x28')]=0x0;_0xb36ad7['sumHoldTime']=0x0;_0xb36ad7[_0x87f2('0x29')]=0x0;_0xb36ad7[_0x87f2('0x2a')]=0x0;}function clearCampaigns(_0x595f6e){if(!_['isEmpty'](_0x595f6e)){for(var _0x243f33 in _0x595f6e){if(_0x595f6e['hasOwnProperty'](_0x243f33)){_0x595f6e[_0x243f33][_0x87f2('0x2b')]=0x0;_0x595f6e[_0x243f33][_0x87f2('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x55e246){if(!_[_0x87f2('0x2d')](_0x55e246)){for(var _0x4e883c in _0x55e246){if(_0x55e246[_0x87f2('0x27')](_0x4e883c)){_0x55e246[_0x4e883c][_0x87f2('0x2e')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x28')]=0x0;_0x55e246[_0x4e883c]['unmanaged']=0x0;_0x55e246[_0x4e883c]['abandoned']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x2f')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x29')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x2a')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x30')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x31')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x32')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x33')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x34')]=0x0;_0x55e246[_0x4e883c]['outboundUnknownCallsDay']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x35')]=0x0;_0x55e246[_0x4e883c]['outboundDropCallsDayCallersExit']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x36')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x37')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x38')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x39')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x30')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x3a')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x3b')]=!![];}}}}Realtime[_0x87f2('0x3c')][_0x87f2('0x3d')]=function(_0x314f52,_0x27f9a9){for(var _0xf6f8e5 in _0x27f9a9){if(_0x314f52['hasOwnProperty'](_0xf6f8e5)){_0x314f52[_0xf6f8e5]=_0x27f9a9[_0xf6f8e5];}}};Realtime['prototype'][_0x87f2('0x3e')]=function(){var _0x41348c=this;return function(_0x3a239a){if(_0x3a239a){freeIsNotKeyAgent(_0x3a239a,_0x41348c['agents']);for(var _0x218148=0x0,_0x4956dc={},_0x1709bb={};_0x218148<_0x3a239a['length'];_0x218148+=0x1){_0x4956dc=_0x3a239a[_0x218148];var _0x4dcc53=_[_0x87f2('0x25')](_0x4956dc[_0x87f2('0x26')])?util['format'](_0x87f2('0x23'),_0x4956dc[_0x87f2('0x24')]):_0x4956dc[_0x87f2('0x26')];if(_[_0x87f2('0x3f')](_0x41348c[_0x87f2('0xf')][_0x4dcc53])){_0x41348c[_0x87f2('0xf')][_0x4dcc53]=new Agent(_0x4956dc);}else{_0x41348c[_0x87f2('0x3d')](_0x41348c[_0x87f2('0xf')][_0x4dcc53],_0x4956dc);}}}return _0x41348c[_0x87f2('0xf')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x40')]=function(){var _0x1b9a0f=this;return function(_0x12c016){if(_0x12c016){freeIsNotKeySip(_0x12c016,_0x1b9a0f[_0x87f2('0x10')]);for(var _0x149ed4=0x0,_0x550dd8={},_0x57d3c4={};_0x149ed4<_0x12c016[_0x87f2('0x41')];_0x149ed4+=0x1){_0x550dd8=_0x12c016[_0x149ed4];if(_[_0x87f2('0x3f')](_0x1b9a0f[_0x87f2('0x10')][util['format'](_0x87f2('0x23'),_0x550dd8['name'])])){_0x1b9a0f[_0x87f2('0x10')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x550dd8[_0x87f2('0x24')])]=new Telephone(_0x550dd8);}else{_0x1b9a0f[_0x87f2('0x3d')](_0x1b9a0f[_0x87f2('0x10')][util['format'](_0x87f2('0x23'),_0x550dd8[_0x87f2('0x24')])],_0x550dd8);}}}return _0x1b9a0f['telephones'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x42')]=function(){var _0x15cd4c=this;return function(_0x5d6166){if(_0x5d6166){freeIsNotKeySip(_0x5d6166,_0x15cd4c[_0x87f2('0x11')]);for(var _0x50bda3=0x0,_0x13277b={},_0x24c753={};_0x50bda3<_0x5d6166[_0x87f2('0x41')];_0x50bda3+=0x1){_0x13277b=_0x5d6166[_0x50bda3];if(_[_0x87f2('0x3f')](_0x15cd4c[_0x87f2('0x11')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x13277b[_0x87f2('0x24')])])){_0x15cd4c[_0x87f2('0x11')][util['format'](_0x87f2('0x23'),_0x13277b[_0x87f2('0x24')])]=new Trunk(_0x13277b);}else{_0x15cd4c['mergeFromDatabase'](_0x15cd4c[_0x87f2('0x11')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x13277b['name'])],_0x13277b);}}}return _0x15cd4c[_0x87f2('0x11')];};};Realtime['prototype'][_0x87f2('0x43')]=function(){var _0x6453bb=this;return function(_0x259165){if(_0x259165){freeIsNotKey(_0x259165,_0x6453bb[_0x87f2('0x12')],_0x87f2('0x24'));for(var _0x7f06cc=0x0,_0x1c41cf={},_0x387272={};_0x7f06cc<_0x259165[_0x87f2('0x41')];_0x7f06cc+=0x1){_0x1c41cf=_0x259165[_0x7f06cc];if(_[_0x87f2('0x3f')](_0x6453bb[_0x87f2('0x12')][_0x1c41cf[_0x87f2('0x24')]])){_0x6453bb['voiceQueues'][_0x1c41cf[_0x87f2('0x24')]]=new VoiceQueue(_0x1c41cf);}else{_0x6453bb[_0x87f2('0x3d')](_0x6453bb[_0x87f2('0x12')][_0x1c41cf[_0x87f2('0x24')]],_0x1c41cf);}}}return _0x6453bb[_0x87f2('0x12')];};};Realtime['prototype'][_0x87f2('0x44')]=function(){var _0xdf8d72=this;return function(_0x43e975){if(_0x43e975){freeIsNotKey(_0x43e975,_0xdf8d72[_0x87f2('0x13')],'id');for(var _0xf74e35=0x0,_0x112f06={},_0x151f0d={};_0xf74e35<_0x43e975[_0x87f2('0x41')];_0xf74e35+=0x1){_0x112f06=_0x43e975[_0xf74e35];if(_[_0x87f2('0x3f')](_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']])){_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']]=new Trigger(_0x112f06);}else{_0xdf8d72[_0x87f2('0x3d')](_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']],_0x112f06);}}}return _0xdf8d72[_0x87f2('0x13')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x45')]=function(){var _0x5e8a89=this;return function(_0x473d80){if(_0x473d80){freeIsNotKey(_0x473d80,_0x5e8a89[_0x87f2('0x14')],'id');for(var _0x428524=0x0,_0x1be754={},_0x2459d3={};_0x428524<_0x473d80['length'];_0x428524+=0x1){_0x1be754=_0x473d80[_0x428524];if(_[_0x87f2('0x3f')](_0x5e8a89[_0x87f2('0x14')][_0x1be754['id']])){_0x5e8a89['templates'][_0x1be754['id']]=new Template(_0x1be754);}else{_0x5e8a89['mergeFromDatabase'](_0x5e8a89[_0x87f2('0x14')][_0x1be754['id']],_0x1be754);}}}return _0x5e8a89[_0x87f2('0x14')];};};Realtime['prototype'][_0x87f2('0x46')]=function(){var _0x5ee7cf=this;return function(_0x460358){if(_0x460358){freeIsNotKey(_0x460358,_0x5ee7cf[_0x87f2('0x1a')],'id');for(var _0x4ad335=0x0,_0x292f0f={},_0x527460={};_0x4ad335<_0x460358[_0x87f2('0x41')];_0x4ad335+=0x1){_0x292f0f=_0x460358[_0x4ad335];if(_[_0x87f2('0x3f')](_0x5ee7cf['zendeskAccounts'][_0x292f0f['id']])){_0x5ee7cf[_0x87f2('0x1a')][_0x292f0f['id']]=new ZendeskAccount(_0x292f0f);}else{_0x5ee7cf[_0x87f2('0x3d')](_0x5ee7cf[_0x87f2('0x1a')][_0x292f0f['id']],_0x292f0f);}}}return _0x5ee7cf[_0x87f2('0x1a')];};};Realtime[_0x87f2('0x3c')]['initSalesforceAccounts']=function(){var _0x565c9f=this;return function(_0x3dd2f6){if(_0x3dd2f6){freeIsNotKey(_0x3dd2f6,_0x565c9f[_0x87f2('0x47')],'id');for(var _0x6acd10=0x0,_0x35ef52={},_0x4de943={};_0x6acd10<_0x3dd2f6[_0x87f2('0x41')];_0x6acd10+=0x1){_0x35ef52=_0x3dd2f6[_0x6acd10];if(_[_0x87f2('0x3f')](_0x565c9f[_0x87f2('0x47')][_0x35ef52['id']])){_0x565c9f['salesforceAccounts'][_0x35ef52['id']]=new SalesforceAccount(_0x35ef52);}else{_0x565c9f[_0x87f2('0x3d')](_0x565c9f[_0x87f2('0x47')][_0x35ef52['id']],_0x35ef52);}}}return _0x565c9f[_0x87f2('0x47')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x48')]=function(){var _0x43bb76=this;return function(_0x34ea83){if(_0x34ea83){freeIsNotKey(_0x34ea83,_0x43bb76['freshdeskAccounts'],'id');for(var _0x38fb72=0x0,_0x38283a={},_0x38a5fa={};_0x38fb72<_0x34ea83[_0x87f2('0x41')];_0x38fb72+=0x1){_0x38283a=_0x34ea83[_0x38fb72];if(_[_0x87f2('0x3f')](_0x43bb76[_0x87f2('0x1c')][_0x38283a['id']])){_0x43bb76['freshdeskAccounts'][_0x38283a['id']]=new FreshdeskAccount(_0x38283a);}else{_0x43bb76[_0x87f2('0x3d')](_0x43bb76[_0x87f2('0x1c')][_0x38283a['id']],_0x38283a);}}}return _0x43bb76[_0x87f2('0x1c')];};};Realtime[_0x87f2('0x3c')]['initZohoAccounts']=function(){var _0x2a050f=this;return function(_0x3f9c56){if(_0x3f9c56){freeIsNotKey(_0x3f9c56,_0x2a050f['zohoAccounts'],'id');for(var _0x4fddff=0x0,_0x348661={},_0x210b8c={};_0x4fddff<_0x3f9c56[_0x87f2('0x41')];_0x4fddff+=0x1){_0x348661=_0x3f9c56[_0x4fddff];if(_['isUndefined'](_0x2a050f[_0x87f2('0x49')][_0x348661['id']])){_0x2a050f['zohoAccounts'][_0x348661['id']]=new ZohoAccount(_0x348661);}else{_0x2a050f['mergeFromDatabase'](_0x2a050f[_0x87f2('0x49')][_0x348661['id']],_0x348661);}}}return _0x2a050f['zohoAccounts'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4a')]=function(){var _0x51d18f=this;return function(_0x3e2161){if(_0x3e2161){freeIsNotKey(_0x3e2161,_0x51d18f[_0x87f2('0x1d')],'id');for(var _0x3d3b79=0x0,_0x17df6a={},_0x2068b8={};_0x3d3b79<_0x3e2161['length'];_0x3d3b79+=0x1){_0x17df6a=_0x3e2161[_0x3d3b79];if(_[_0x87f2('0x3f')](_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']])){_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']]=new DeskAccount(_0x17df6a);}else{_0x51d18f[_0x87f2('0x3d')](_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']],_0x17df6a);}}}return _0x51d18f['deskAccounts'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4b')]=function(){var _0x9bbdd9=this;return function(_0xa82e96){if(_0xa82e96){freeIsNotKey(_0xa82e96,_0x9bbdd9[_0x87f2('0x1b')],'id');for(var _0x5073f0=0x0,_0x38e935={},_0x3b8f25={};_0x5073f0<_0xa82e96[_0x87f2('0x41')];_0x5073f0+=0x1){_0x38e935=_0xa82e96[_0x5073f0];if(_[_0x87f2('0x3f')](_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']])){_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']]=new SugarcrmAccount(_0x38e935);}else{_0x9bbdd9['mergeFromDatabase'](_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']],_0x38e935);}}}return _0x9bbdd9[_0x87f2('0x1b')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4c')]=function(){var _0x2bcbf6=this;return function(_0x31abb6){if(_0x31abb6){freeIsNotKey(_0x31abb6,_0x2bcbf6[_0x87f2('0x4d')],'id');for(var _0x221b49=0x0,_0x320048={},_0x5aad41={};_0x221b49<_0x31abb6[_0x87f2('0x41')];_0x221b49+=0x1){_0x320048=_0x31abb6[_0x221b49];if(_[_0x87f2('0x3f')](_0x2bcbf6[_0x87f2('0x4d')][_0x320048['id']])){_0x2bcbf6['vtigerAccounts'][_0x320048['id']]=new VtigerAccount(_0x320048);}else{_0x2bcbf6[_0x87f2('0x3d')](_0x2bcbf6[_0x87f2('0x4d')][_0x320048['id']],_0x320048);}}}return _0x2bcbf6[_0x87f2('0x4d')];};};Realtime[_0x87f2('0x3c')]['initServicenowAccounts']=function(){var _0x5067b2=this;return function(_0x9087a9){if(_0x9087a9){freeIsNotKey(_0x9087a9,_0x5067b2['servicenowAccounts'],'id');for(var _0xdf094d=0x0,_0x134df8={},_0x43c23b={};_0xdf094d<_0x9087a9[_0x87f2('0x41')];_0xdf094d+=0x1){_0x134df8=_0x9087a9[_0xdf094d];if(_[_0x87f2('0x3f')](_0x5067b2[_0x87f2('0x4e')][_0x134df8['id']])){_0x5067b2['servicenowAccounts'][_0x134df8['id']]=new ServicenowAccount(_0x134df8);}else{_0x5067b2['mergeFromDatabase'](_0x5067b2[_0x87f2('0x4e')][_0x134df8['id']],_0x134df8);}}}return _0x5067b2[_0x87f2('0x4e')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4f')]=function(){var _0x44e370=this;return function(_0x49545d){if(_0x49545d){freeIsNotKey(_0x49545d,_0x44e370[_0x87f2('0x1e')],'id');for(var _0x1d82ca=0x0,_0x274f64={},_0x3f84a5={};_0x1d82ca<_0x49545d['length'];_0x1d82ca+=0x1){_0x274f64=_0x49545d[_0x1d82ca];if(_['isUndefined'](_0x44e370[_0x87f2('0x1e')][_0x274f64['id']])){_0x44e370[_0x87f2('0x1e')][_0x274f64['id']]=new Dynamics365Account(_0x274f64);}else{_0x44e370[_0x87f2('0x3d')](_0x44e370[_0x87f2('0x1e')][_0x274f64['id']],_0x274f64);}}}return _0x44e370[_0x87f2('0x1e')];};};Realtime[_0x87f2('0x3c')]['initFreshsalesAccounts']=function(){var _0x9ca583=this;return function(_0x2423f3){if(_0x2423f3){freeIsNotKey(_0x2423f3,_0x9ca583[_0x87f2('0x1f')],'id');for(var _0x3bde69=0x0,_0x2c002d={},_0xbee3c8={};_0x3bde69<_0x2423f3['length'];_0x3bde69+=0x1){_0x2c002d=_0x2423f3[_0x3bde69];if(_[_0x87f2('0x3f')](_0x9ca583['freshsalesAccounts'][_0x2c002d['id']])){_0x9ca583[_0x87f2('0x1f')][_0x2c002d['id']]=new FreshsalesAccount(_0x2c002d);}else{_0x9ca583['mergeFromDatabase'](_0x9ca583['freshsalesAccounts'][_0x2c002d['id']],_0x2c002d);}}}return _0x9ca583[_0x87f2('0x1f')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x50')]=function(){var _0x2abdbc=this;return function(_0x534878){for(var _0x40497a=0x0;_0x40497a<_0x534878[_0x87f2('0x41')];_0x40497a+=0x1){_['merge'](_0x2abdbc[_0x87f2('0x12')][_0x534878[_0x40497a]['name']],_0x534878[_0x40497a]);}return _0x2abdbc[_0x87f2('0x12')];};};Realtime['prototype'][_0x87f2('0x51')]=function(){var _0x4ea6ae=this;return function(_0x1d78ec){clearVoiceQueues(_0x4ea6ae[_0x87f2('0x12')]);if(_0x1d78ec){_0x1d78ec=_['groupBy'](_0x1d78ec,_0x87f2('0x52'));for(var _0xd1930d in _0x1d78ec){if(_0x1d78ec[_0x87f2('0x27')](_0xd1930d)){var _0x5f380a={};for(var _0x16c731=0x0;_0x16c731<_0x1d78ec[_0xd1930d][_0x87f2('0x41')];_0x16c731+=0x1){var _0x571ae6=_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x53')];if(_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]){if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x54')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['unmanaged']+=0x1;}if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x55')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x56')]+=0x1;}_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x2f')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x57')])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731]['queuecallerjoinAt']),_0x87f2('0x59'))||0x0;if(_0x16c731===_0x1d78ec[_0xd1930d][_0x87f2('0x41')]-0x1){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x29')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5a')]||_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5b')]||_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5c')])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5d')]),'seconds')||0x0;_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['total']+=0x1;if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5e')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x28')]+=0x1;_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x2a')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731]['queuecallercompleteAt'])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x57')]),_0x87f2('0x59'))||0x0;}}else{_0x4ea6ae['voiceQueues'][_0x571ae6][_0x87f2('0x29')]+=_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['sumHoldTime']||0x0;}}}}}}return _0x4ea6ae[_0x87f2('0x12')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x5f')]=function(){var _0x12e42b=this;return function(_0x4b0966){clearVoiceCallReports(_0x12e42b['outbound']);if(_0x4b0966){for(var _0x3a6fad=0x0;_0x3a6fad<_0x4b0966['length'];_0x3a6fad+=0x1){_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2e')]+=0x1;_0x12e42b['outbound'][_0x87f2('0x29')]+=_0x4b0966[_0x3a6fad]['duration'];if(_0x4b0966[_0x3a6fad][_0x87f2('0x60')]===_0x87f2('0x61')){_0x12e42b['outbound'][_0x87f2('0x28')]+=0x1;_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2f')]+=_0x4b0966[_0x3a6fad][_0x87f2('0x62')]-_0x4b0966[_0x3a6fad][_0x87f2('0x63')]||0x0;_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2a')]+=_0x4b0966[_0x3a6fad][_0x87f2('0x63')];}}}return _0x12e42b['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x184003=this;return function(_0x4eaa0b){if(_0x4eaa0b){freeIsNotKey(_0x4eaa0b,_0x184003['campaigns'],'name');for(var _0x2b0db5=0x0,_0x748ab1={};_0x2b0db5<_0x4eaa0b[_0x87f2('0x41')];_0x2b0db5+=0x1){_0x748ab1=_0x4eaa0b[_0x2b0db5];if(_[_0x87f2('0x3f')](_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]])){_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]]=new Campaign(_0x748ab1);}else{_0x184003[_0x87f2('0x3d')](_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]],_0x748ab1);_0x184003['campaigns'][_0x748ab1[_0x87f2('0x24')]][_0x87f2('0x65')]=_0x748ab1[_0x87f2('0x66')]?_0x748ab1[_0x87f2('0x66')][_0x87f2('0x24')]:undefined;}}}return _0x184003[_0x87f2('0x64')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x67')]=function(){var _0x1f051d=this;return function(_0x274479){if(_0x274479){freeIsNotKey(_0x274479,_0x1f051d[_0x87f2('0x16')],'id');for(var _0x5a55b2=0x0,_0x3f131d={};_0x5a55b2<_0x274479[_0x87f2('0x41')];_0x5a55b2+=0x1){_0x3f131d=_0x274479[_0x5a55b2];if(_[_0x87f2('0x3f')](_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']])){_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']]=new VoiceExtension(_0x3f131d);}else{_0x1f051d[_0x87f2('0x3d')](_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']],_0x3f131d);}}}return _0x1f051d[_0x87f2('0x16')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x68')]=function(){var _0x2aca9a=this;return function(_0x166c4e){clearCampaigns(_0x2aca9a[_0x87f2('0x64')]);for(var _0xe7057e=0x0;_0xe7057e<_0x166c4e['length'];_0xe7057e+=0x1){_[_0x87f2('0x69')](_0x2aca9a[_0x87f2('0x64')][_0x166c4e[_0xe7057e]['name']],_0x166c4e[_0xe7057e]);}return _0x2aca9a[_0x87f2('0x64')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x6a')]=function(){var _0x15dbf2=this;return function(_0x54f426){if(_0x54f426){freeIsNotKey(_0x54f426,_0x15dbf2[_0x87f2('0x20')],'id');for(var _0x1a83ef=0x0,_0x77c4da={},_0x525bc0={};_0x1a83ef<_0x54f426[_0x87f2('0x41')];_0x1a83ef+=0x1){_0x77c4da=_0x54f426[_0x1a83ef];if(_[_0x87f2('0x3f')](_0x15dbf2[_0x87f2('0x20')][_0x77c4da['id']])){_0x15dbf2['faxAccounts'][_0x77c4da['id']]=new FaxAccount(_0x77c4da);}else{_0x15dbf2[_0x87f2('0x3d')](_0x15dbf2[_0x87f2('0x20')][_0x77c4da['id']],_0x77c4da);}}}return _0x15dbf2[_0x87f2('0x20')];};};module[_0x87f2('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e7876f4..8c495a8 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 _0xe211=['custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','type','dialer','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind'];(function(_0x241ca4,_0x349ba1){var _0x105c03=function(_0x1e5c91){while(--_0x1e5c91){_0x241ca4['push'](_0x241ca4['shift']());}};_0x105c03(++_0x349ba1);}(_0xe211,0x19a));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var config=require(_0x1e21('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x1e21('0x3'));var RpcVoiceDialReport=require(_0x1e21('0x4'));var RpcMemberReport=require(_0x1e21('0x5'));var RpcVoiceQueueReport=require(_0x1e21('0x6'));var RpcVoiceRecording=require(_0x1e21('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1e21('0x8'));var VoiceCallReport=require(_0x1e21('0x9'));var VoiceAgentReport=require(_0x1e21('0xa'));var VoiceDialReport=require(_0x1e21('0xb'));var UserReport=require(_0x1e21('0xc'));function Report(_0x25fe8c){this['realtime']=_0x25fe8c;this[_0x1e21('0xd')]=_0x25fe8c['agents'];this[_0x1e21('0xe')]=_0x25fe8c[_0x1e21('0xe')];}Report[_0x1e21('0xf')][_0x1e21('0x10')]=function(_0x590ba5){var _0xf50e64=new VoiceQueueReport(this[_0x1e21('0x11')]);var _0x5d989e=new VoiceAgentReport(this[_0x1e21('0x11')]);var _0x4474da=new VoiceDialReport(this[_0x1e21('0x11')]);var _0x590837=new VoiceCallReport(this['realtime']);var _0x1e61f9=new UserReport(this[_0x1e21('0x11')]);if(config['xdr']&&config[_0x1e21('0x12')][_0x1e21('0x13')]){ami['on'](_0x1e21('0x14'),this[_0x1e21('0x15')]['bind'](this));ami['on'](_0x1e21('0x16'),this[_0x1e21('0x17')][_0x1e21('0x18')](this));ami['on'](_0x1e21('0x19'),this[_0x1e21('0x1a')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x1e21('0x1b')]['bind'](this));ami['on'](_0x1e21('0x1c'),this[_0x1e21('0x1d')][_0x1e21('0x18')](this));ami['on']('attendedtransfer',this[_0x1e21('0x1e')][_0x1e21('0x18')](this));}};Report['prototype'][_0x1e21('0x1f')]=function(_0x45773f){var _0x16d571;_0x16d571=_[_0x1e21('0x20')](this[_0x1e21('0xd')],function(_0x15aa1b){return _0x15aa1b[_0x1e21('0x21')]==_0x45773f||_0x15aa1b[_0x1e21('0x22')]==_0x45773f;});if(_[_0x1e21('0x23')](_0x16d571)){var _0x2fb8b7=_[_0x1e21('0x20')](this[_0x1e21('0xe')],function(_0x313c17){return _0x313c17[_0x1e21('0x21')]==_0x45773f||_0x313c17[_0x1e21('0x22')]==_0x45773f;});if(_0x2fb8b7){_0x16d571=_[_0x1e21('0x20')](this[_0x1e21('0xd')],function(_0x593949){return _0x593949[_0x1e21('0x24')]==util[_0x1e21('0x25')](_0x1e21('0x26'),_0x2fb8b7[_0x1e21('0x22')]);});}}return _0x16d571;};Report[_0x1e21('0xf')][_0x1e21('0x15')]=function(_0x1753ea){for(var _0x808a9b=0x0;_0x808a9b<_0x1753ea[_0x1e21('0x27')];_0x808a9b+=0x1){var _0x4c7b10=this[_0x1e21('0x1f')](_0x1753ea[_0x808a9b][_0x1e21('0x28')]);if(_0x4c7b10){_0x1753ea[_0x808a9b]['accountcode']=_0x4c7b10[_0x1e21('0x21')];_0x1753ea[_0x808a9b]['assigned']=!![];_0x1753ea[_0x808a9b][_0x1e21('0x29')]=_0x4c7b10[_0x1e21('0x22')];_0x1753ea[_0x808a9b][_0x1e21('0x24')]=_[_0x1e21('0x23')](_0x4c7b10[_0x1e21('0x24')])?util['format'](_0x1e21('0x26'),_0x4c7b10[_0x1e21('0x22')]):_0x4c7b10[_0x1e21('0x24')];if(_0x1753ea[_0x808a9b][_0x1e21('0x2a')]){_0x1753ea[_0x808a9b][_0x1e21('0x2b')]=moment()[_0x1e21('0x25')](_0x1e21('0x2c'));}if(_0x1753ea[_0x808a9b][_0x1e21('0x2d')]){_0x1753ea[_0x808a9b]['queuecallerexitAt']=moment()[_0x1e21('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x1e21('0x15')](_0x1753ea[_0x808a9b]);}RpcVoiceQueueReport[_0x1e21('0x2e')](_0x1753ea[_0x808a9b]);}};function extractCalleridNumber(_0x5c76f6){var _0x393b52=_0x5c76f6[_0x1e21('0x2f')](/<(.*?)>/);return _0x393b52?_0x393b52[0x1]:_0x5c76f6;}Report[_0x1e21('0xf')][_0x1e21('0x17')]=function(_0x20699a){_0x20699a[_0x1e21('0x30')]=_0x20699a['destination']||_0x20699a['exten'];if(_0x20699a[_0x1e21('0x31')]==_0x1e21('0x32')){_0x20699a[_0x1e21('0x33')]='queue';_0x20699a['lastdata']=_0x20699a[_0x1e21('0x34')];if(_0x20699a[_0x1e21('0x35')]=='from-voip-provider'){_0x20699a[_0x1e21('0x21')]='';_0x20699a['destination']=extractCalleridNumber(_0x20699a[_0x1e21('0x36')]);}else if(_0x20699a[_0x1e21('0x35')]==_0x1e21('0x37')){if(_0x20699a[_0x1e21('0x30')]==_0x1e21('0x38')){_0x20699a[_0x1e21('0x30')]=extractCalleridNumber(_0x20699a[_0x1e21('0x39')]);_0x20699a[_0x1e21('0x3a')]=_0x20699a['originatecalleridnum'];_0x20699a[_0x1e21('0x3b')]=[_0x20699a[_0x1e21('0x3c')],_0x20699a[_0x1e21('0x3c')]=_0x20699a[_0x1e21('0x3b')]][0x0];_0x20699a[_0x1e21('0x36')]=_0x20699a[_0x1e21('0x39')];}else{_0x20699a[_0x1e21('0x30')]=_0x20699a[_0x1e21('0x3a')];_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x3d')];if(_0x20699a['disposition']==_0x1e21('0x3e')){_0x20699a['accountcode']=_0x20699a[_0x1e21('0x28')];}else{_0x20699a[_0x1e21('0x21')]='';}}}}else{_0x20699a[_0x1e21('0x36')]=util[_0x1e21('0x25')](_0x1e21('0x3f'),_0x20699a[_0x1e21('0x40')],_0x20699a[_0x1e21('0x3a')]);}if(RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]]){var _0xf92570=RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]];_0xf92570[_0x1e21('0x43')]=_0x20699a[_0x1e21('0x44')];RpcVoiceTransferReport['blindTransfer'](_0xf92570);delete RpcVoiceTransferReport[_0x1e21('0x41')][_0x20699a[_0x1e21('0x42')]];}RpcVoiceCallReport[_0x1e21('0x2e')](_0x20699a);if(_0x20699a[_0x1e21('0x45')]){for(var _0x17099d=0x0;_0x17099d<_0x20699a['monitors'][_0x1e21('0x27')];_0x17099d+=0x1){_0x20699a[_0x1e21('0x46')]=_0x20699a[_0x1e21('0x47')][_0x17099d][_0x1e21('0x48')];_0x20699a[_0x1e21('0x49')]=_0x20699a[_0x1e21('0x47')][_0x17099d][_0x1e21('0x49')];if(_0x20699a[_0x1e21('0x4a')]==_0x1e21('0x38')){_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x28')];_0x20699a[_0x1e21('0x40')]=_0x20699a[_0x1e21('0x4b')];_0x20699a['connectedlinenum']=_0x20699a[_0x1e21('0x21')];_0x20699a[_0x1e21('0x4b')]=_0x20699a[_0x1e21('0x4c')];_0x20699a[_0x1e21('0x4a')]=_0x20699a[_0x1e21('0x3d')];}else if(_0x20699a[_0x1e21('0x4a')]==_0x1e21('0x4d')){_0x20699a[_0x1e21('0x3a')]=_0x20699a[_0x1e21('0x30')];_0x20699a[_0x1e21('0x4a')]=_0x20699a[_0x1e21('0x3d')];}RpcVoiceRecording['create'](_0x20699a);}}};Report['prototype'][_0x1e21('0x1a')]=function(_0x576252){if(_[_0x1e21('0x4e')](_0x576252)){_0x576252['forEach'](function(_0x4c7286){RpcVoiceAgentReport[_0x1e21('0x2e')](_0x4c7286);});}else{RpcVoiceAgentReport[_0x1e21('0x2e')](_0x576252);}};Report['prototype'][_0x1e21('0x1b')]=function(_0x2c0700){RpcVoiceDialReport[_0x1e21('0x2e')](_0x2c0700);var _0x27fb31;var _0x2aefe4;var _0x4ddeee=_0x2c0700[_0x1e21('0x3c')];if(_[_0x1e21('0x4f')](_0x4ddeee,_0x1e21('0x50'))){_0x2aefe4=_0x4ddeee['substring'](_0x4ddeee[_0x1e21('0x51')]('/')+0x1,_0x4ddeee[_0x1e21('0x51')]('@'));_0x27fb31=_[_0x1e21('0x20')](this['agents'],function(_0x5093aa){return _0x5093aa['mobile']==_0x2aefe4||_0x5093aa[_0x1e21('0x52')]==_0x2aefe4||_0x5093aa[_0x1e21('0x21')]==_0x2aefe4;});}else{_0x2aefe4=_0x4ddeee[_0x1e21('0x53')](_0x4ddeee[_0x1e21('0x51')]('/')+0x1,_0x4ddeee[_0x1e21('0x54')]('-'));_0x27fb31=this['findAgent'](_0x2aefe4);}if(_0x27fb31){_0x2c0700['interface']=_[_0x1e21('0x23')](_0x27fb31[_0x1e21('0x24')])?util[_0x1e21('0x25')](_0x1e21('0x26'),_0x27fb31['name']):_0x27fb31[_0x1e21('0x24')];_0x2c0700[_0x1e21('0x4c')]=_0x27fb31[_0x1e21('0x22')];_0x2c0700[_0x1e21('0x21')]=_0x27fb31[_0x1e21('0x21')];RpcMemberReport['voiceDialReport'](_0x2c0700);}};Report[_0x1e21('0xf')]['blindTransfer']=function(_0x4eb743){RpcVoiceTransferReport[_0x1e21('0x41')][_0x4eb743[_0x1e21('0x55')]]=_0x4eb743;};Report[_0x1e21('0xf')][_0x1e21('0x1e')]=function(_0x432eef){RpcVoiceTransferReport[_0x1e21('0x1e')](_0x432eef);};module[_0x1e21('0x56')]=Report; \ No newline at end of file +var _0xaa06=['voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','custom:voiceQueueReport','voiceCallReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','accountcode','interface','format'];(function(_0x420501,_0x4f5374){var _0x303742=function(_0x193c1a){while(--_0x193c1a){_0x420501['push'](_0x420501['shift']());}};_0x303742(++_0x4f5374);}(_0xaa06,0xd7));var _0x6aa0=function(_0x14ab2e,_0x72d1f9){_0x14ab2e=_0x14ab2e-0x0;var _0xcb22a=_0xaa06[_0x14ab2e];return _0xcb22a;};'use strict';var _=require('lodash');var moment=require(_0x6aa0('0x0'));var util=require(_0x6aa0('0x1'));var config=require(_0x6aa0('0x2'));var ami=require(_0x6aa0('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6aa0('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x6aa0('0x5'));var RpcVoiceRecording=require(_0x6aa0('0x6'));var RpcVoiceTransferReport=require(_0x6aa0('0x7'));var VoiceQueueReport=require(_0x6aa0('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6aa0('0x9'));var VoiceDialReport=require(_0x6aa0('0xa'));var UserReport=require(_0x6aa0('0xb'));function Report(_0x5e17c7){this['realtime']=_0x5e17c7;this[_0x6aa0('0xc')]=_0x5e17c7['agents'];this[_0x6aa0('0xd')]=_0x5e17c7[_0x6aa0('0xd')];}Report[_0x6aa0('0xe')]['sync']=function(_0x5b57d7){var _0x552f8a=new VoiceQueueReport(this[_0x6aa0('0xf')]);var _0x571caa=new VoiceAgentReport(this['realtime']);var _0x54f296=new VoiceDialReport(this[_0x6aa0('0xf')]);var _0x508944=new VoiceCallReport(this['realtime']);var _0x40171f=new UserReport(this['realtime']);if(config[_0x6aa0('0x10')]&&config[_0x6aa0('0x10')]['disabled']){ami['on'](_0x6aa0('0x11'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x6aa0('0x12')][_0x6aa0('0x13')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x6aa0('0x14'),this['voiceDialReport']['bind'](this));ami['on'](_0x6aa0('0x15'),this[_0x6aa0('0x16')][_0x6aa0('0x13')](this));ami['on'](_0x6aa0('0x17'),this[_0x6aa0('0x18')]['bind'](this));}};Report['prototype'][_0x6aa0('0x19')]=function(_0x2916f7){var _0xc40094;_0xc40094=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x1e90f8){return _0x1e90f8['accountcode']==_0x2916f7||_0x1e90f8[_0x6aa0('0x1b')]==_0x2916f7;});if(_['isNil'](_0xc40094)){var _0x1f1e5c=_[_0x6aa0('0x1a')](this['telephones'],function(_0x18c9bf){return _0x18c9bf[_0x6aa0('0x1c')]==_0x2916f7||_0x18c9bf[_0x6aa0('0x1b')]==_0x2916f7;});if(_0x1f1e5c){_0xc40094=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x6fd9a5){return _0x6fd9a5[_0x6aa0('0x1d')]==util[_0x6aa0('0x1e')]('SIP/%s',_0x1f1e5c[_0x6aa0('0x1b')]);});}}return _0xc40094;};Report['prototype'][_0x6aa0('0x1f')]=function(_0x123421){for(var _0x308576=0x0;_0x308576<_0x123421[_0x6aa0('0x20')];_0x308576+=0x1){var _0xff181f=this['findAgent'](_0x123421[_0x308576][_0x6aa0('0x21')]);if(_0xff181f){_0x123421[_0x308576][_0x6aa0('0x1c')]=_0xff181f[_0x6aa0('0x1c')];_0x123421[_0x308576][_0x6aa0('0x22')]=!![];_0x123421[_0x308576][_0x6aa0('0x23')]=_0xff181f[_0x6aa0('0x1b')];_0x123421[_0x308576][_0x6aa0('0x1d')]=_[_0x6aa0('0x24')](_0xff181f[_0x6aa0('0x1d')])?util[_0x6aa0('0x1e')](_0x6aa0('0x25'),_0xff181f[_0x6aa0('0x1b')]):_0xff181f['interface'];if(_0x123421[_0x308576]['queuecallercomplete']){_0x123421[_0x308576]['queuecallercompleteAt']=moment()[_0x6aa0('0x1e')](_0x6aa0('0x26'));}if(_0x123421[_0x308576][_0x6aa0('0x27')]){_0x123421[_0x308576][_0x6aa0('0x28')]=moment()[_0x6aa0('0x1e')](_0x6aa0('0x26'));}RpcMemberReport['voiceQueueReport'](_0x123421[_0x308576]);}RpcVoiceQueueReport[_0x6aa0('0x29')](_0x123421[_0x308576]);}};function extractCalleridNumber(_0x20ab22){var _0x2d7349=_0x20ab22[_0x6aa0('0x2a')](/<(.*?)>/);return _0x2d7349?_0x2d7349[0x1]:_0x20ab22;}Report[_0x6aa0('0xe')]['voiceCallReport']=function(_0x18363e){_0x18363e[_0x6aa0('0x2b')]=_0x18363e['destination']||_0x18363e[_0x6aa0('0x2c')];if(_0x18363e[_0x6aa0('0x2d')]==_0x6aa0('0x2e')){_0x18363e[_0x6aa0('0x2f')]=_0x6aa0('0x30');_0x18363e[_0x6aa0('0x31')]=_0x18363e[_0x6aa0('0x30')];if(_0x18363e[_0x6aa0('0x32')]==_0x6aa0('0x33')){_0x18363e[_0x6aa0('0x1c')]='';_0x18363e[_0x6aa0('0x2b')]=extractCalleridNumber(_0x18363e[_0x6aa0('0x34')]);}else if(_0x18363e[_0x6aa0('0x32')]=='from-sip'){if(_0x18363e['destination']==_0x6aa0('0x35')){_0x18363e[_0x6aa0('0x2b')]=extractCalleridNumber(_0x18363e[_0x6aa0('0x36')]);_0x18363e[_0x6aa0('0x37')]=_0x18363e['originatecalleridnum'];_0x18363e['destinationchannel']=[_0x18363e['channel'],_0x18363e[_0x6aa0('0x38')]=_0x18363e[_0x6aa0('0x39')]][0x0];_0x18363e[_0x6aa0('0x34')]=_0x18363e[_0x6aa0('0x36')];}else{_0x18363e[_0x6aa0('0x2b')]=_0x18363e[_0x6aa0('0x37')];_0x18363e['calleridnum']=_0x18363e[_0x6aa0('0x3a')];if(_0x18363e[_0x6aa0('0x3b')]==_0x6aa0('0x3c')){_0x18363e['accountcode']=_0x18363e[_0x6aa0('0x21')];}else{_0x18363e[_0x6aa0('0x1c')]='';}}}}else{_0x18363e['callerid']=util[_0x6aa0('0x1e')](_0x6aa0('0x3d'),_0x18363e[_0x6aa0('0x3e')],_0x18363e[_0x6aa0('0x37')]);}if(RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x18363e['linkedid']]){var _0x3d8cd5=RpcVoiceTransferReport['transfers'][_0x18363e[_0x6aa0('0x40')]];_0x3d8cd5[_0x6aa0('0x41')]=_0x18363e[_0x6aa0('0x42')];RpcVoiceTransferReport['blindTransfer'](_0x3d8cd5);delete RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x18363e[_0x6aa0('0x40')]];}RpcVoiceCallReport['create'](_0x18363e);if(_0x18363e[_0x6aa0('0x43')]){for(var _0x43860c=0x0;_0x43860c<_0x18363e[_0x6aa0('0x44')][_0x6aa0('0x20')];_0x43860c+=0x1){_0x18363e[_0x6aa0('0x45')]=_0x18363e['monitors'][_0x43860c]['filename'];_0x18363e[_0x6aa0('0x46')]=_0x18363e[_0x6aa0('0x44')][_0x43860c]['createdAt'];if(_0x18363e[_0x6aa0('0x2c')]==_0x6aa0('0x35')){_0x18363e[_0x6aa0('0x37')]=_0x18363e[_0x6aa0('0x21')];_0x18363e[_0x6aa0('0x3e')]=_0x18363e[_0x6aa0('0x47')];_0x18363e[_0x6aa0('0x21')]=_0x18363e[_0x6aa0('0x1c')];_0x18363e['connectedlinename']=_0x18363e['membername'];_0x18363e['exten']=_0x18363e[_0x6aa0('0x3a')];}else if(_0x18363e[_0x6aa0('0x2c')]==_0x6aa0('0x48')){_0x18363e[_0x6aa0('0x37')]=_0x18363e[_0x6aa0('0x2b')];_0x18363e[_0x6aa0('0x2c')]=_0x18363e[_0x6aa0('0x3a')];}RpcVoiceRecording[_0x6aa0('0x29')](_0x18363e);}}};Report[_0x6aa0('0xe')]['voiceAgentReport']=function(_0x5e353c){if(_[_0x6aa0('0x49')](_0x5e353c)){_0x5e353c['forEach'](function(_0x28277e){RpcVoiceAgentReport[_0x6aa0('0x29')](_0x28277e);});}else{RpcVoiceAgentReport[_0x6aa0('0x29')](_0x5e353c);}};Report['prototype']['voiceDialReport']=function(_0x1b4c4e){RpcVoiceDialReport[_0x6aa0('0x29')](_0x1b4c4e);var _0x198cd3;var _0x4715b2;var _0x12c395=_0x1b4c4e['channel'];if(_[_0x6aa0('0x4a')](_0x12c395,_0x6aa0('0x4b'))){_0x4715b2=_0x12c395[_0x6aa0('0x4c')](_0x12c395[_0x6aa0('0x4d')]('/')+0x1,_0x12c395['indexOf']('@'));_0x198cd3=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x496c1b){return _0x496c1b['mobile']==_0x4715b2||_0x496c1b[_0x6aa0('0x4e')]==_0x4715b2||_0x496c1b['accountcode']==_0x4715b2;});}else{_0x4715b2=_0x12c395[_0x6aa0('0x4c')](_0x12c395[_0x6aa0('0x4d')]('/')+0x1,_0x12c395[_0x6aa0('0x4f')]('-'));_0x198cd3=this[_0x6aa0('0x19')](_0x4715b2);}if(_0x198cd3){_0x1b4c4e[_0x6aa0('0x1d')]=_['isNil'](_0x198cd3[_0x6aa0('0x1d')])?util[_0x6aa0('0x1e')](_0x6aa0('0x25'),_0x198cd3[_0x6aa0('0x1b')]):_0x198cd3[_0x6aa0('0x1d')];_0x1b4c4e['membername']=_0x198cd3[_0x6aa0('0x1b')];_0x1b4c4e['accountcode']=_0x198cd3[_0x6aa0('0x1c')];RpcMemberReport['voiceDialReport'](_0x1b4c4e);}};Report[_0x6aa0('0xe')][_0x6aa0('0x16')]=function(_0x2edcf7){RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x2edcf7[_0x6aa0('0x50')]]=_0x2edcf7;};Report[_0x6aa0('0xe')]['attendedTransfer']=function(_0x338fa7){RpcVoiceTransferReport[_0x6aa0('0x18')](_0x338fa7);};module[_0x6aa0('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index b82507e..0606903 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 _0xef2a=['localhost','trunks','telephones','registryentry','syncRegistry','bind','registry','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','startsWith','Local','substring','indexOf','phone','peerstatus','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xef2a,0x1a0));var _0xaef2=function(_0x5228cd,_0x268079){_0x5228cd=_0x5228cd-0x0;var _0x184e51=_0xef2a[_0x5228cd];return _0x184e51;};'use strict';var _=require(_0xaef2('0x0'));var moment=require(_0xaef2('0x1'));var util=require(_0xaef2('0x2'));var Redis=require(_0xaef2('0x3'));var BPromise=require(_0xaef2('0x4'));var config=require(_0xaef2('0x5'));var logger=require(_0xaef2('0x6'))(_0xaef2('0x7'));var ami=require('../ami');config[_0xaef2('0x8')]=_[_0xaef2('0x9')](config['redis'],{'host':_0xaef2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaef2('0x8')]));function UserReport(_0x50be70){this[_0xaef2('0xb')]=_0x50be70['trunks'];this['agents']=_0x50be70['agents'];this['telephones']=_0x50be70[_0xaef2('0xc')];ami['on'](_0xaef2('0xd'),this[_0xaef2('0xe')][_0xaef2('0xf')](this));ami['on'](_0xaef2('0x10'),this[_0xaef2('0xe')][_0xaef2('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xaef2('0xf')](this));ami['on']('peerstatus',this[_0xaef2('0x11')][_0xaef2('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami[_0xaef2('0x14')]())[_0xaef2('0x15')](function(_0x2deaf1){logger[_0xaef2('0x16')](_0xaef2('0x17'),util['inspect'](_0x2deaf1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami['actionDeviceStateList']())[_0xaef2('0x15')](function(_0x55e95b){logger['error'](_0xaef2('0x18'),util[_0xaef2('0x19')](_0x55e95b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xaef2('0x12')]()[_0xaef2('0x13')](ami['actionSipPeerStatus']())['catch'](function(_0x22e732){logger[_0xaef2('0x16')](_0xaef2('0x1a'),util['inspect'](_0x22e732,{'showHidden':![],'depth':null}));});}UserReport[_0xaef2('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xaef2('0x12')]()[_0xaef2('0x13')](showSipRegistrations())[_0xaef2('0x13')](listDeviceStates())[_0xaef2('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xaef2('0x1b')][_0xaef2('0x1c')]=function(_0x2a2038){return _0x2a2038!==null&&!_[_0xaef2('0x1d')](_0x2a2038);};UserReport[_0xaef2('0x1b')][_0xaef2('0x1e')]=function(_0x1ca561,_0x46c5c7,_0xaba580){io['to'](_0x1ca561)[_0xaef2('0x1e')](_0x46c5c7,_0xaba580);};UserReport[_0xaef2('0x1b')][_0xaef2('0xe')]=function(_0x4f0984){try{if(this[_0xaef2('0x1c')](_0x4f0984)){logger[_0xaef2('0x1f')](_0xaef2('0x20'),_0x4f0984[_0xaef2('0x21')],_0x4f0984[_0xaef2('0x22')]);logger['debug'](_0xaef2('0x23'),util[_0xaef2('0x19')](_0x4f0984,{'showHidden':![],'depth':null}));var _0x5d8c80=_[_0xaef2('0x24')](this[_0xaef2('0xb')],{'registry':_0x4f0984[_0xaef2('0x21')]});if(_0x5d8c80){_0x4f0984[_0xaef2('0x25')]=_0x4f0984[_0xaef2('0x22')];_[_0xaef2('0x26')](_0x5d8c80,_[_0xaef2('0x27')](_0x4f0984,[_0xaef2('0x28'),_0xaef2('0x29'),'username',_0xaef2('0x22')]));logger[_0xaef2('0x2a')](_0xaef2('0x2b'),util['inspect'](_0x5d8c80,{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util['format'](_0xaef2('0x2c'),_0x5d8c80[_0xaef2('0x2d')]),_0xaef2('0x2e'),_0x5d8c80);}}}catch(_0x3d5054){logger['error'](_0xaef2('0x23'),util[_0xaef2('0x19')](_0x3d5054,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x46346e){try{if(this[_0xaef2('0x1c')](_0x46346e)){logger[_0xaef2('0x1f')](_0xaef2('0x2f'),_0x46346e[_0xaef2('0x30')],_0x46346e[_0xaef2('0x22')]);logger[_0xaef2('0x2a')](_0xaef2('0x31'),util['inspect'](_0x46346e,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x32')][_0x46346e['device']]){if(!this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x33')]||_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]()=='inuse'){this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x33')]=![];if(this['agents'][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]!==_0x46346e['state'][_0xaef2('0x34')]()){this[_0xaef2('0x32')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}this[_0xaef2('0x32')][_0x46346e['device']]['state']=_0x46346e[_0xaef2('0x22')]['toLowerCase']();this[_0xaef2('0x32')][_0x46346e['device']][_0xaef2('0x38')](_0x46346e);}}else if(this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]]){if(this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]!==_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]()){this[_0xaef2('0xc')][_0x46346e['device']]['stateTime']=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x22')]=_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]();logger[_0xaef2('0x2a')](_0xaef2('0x39'),util['inspect'](this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]],{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util[_0xaef2('0x37')]('telephone:%s',this[_0xaef2('0xc')][_0x46346e['device']][_0xaef2('0x2d')]),'telephone:save',this[_0xaef2('0xc')][_0x46346e[_0xaef2('0x30')]]);}else if(this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]){if(this[_0xaef2('0xb')][_0x46346e['device']][_0xaef2('0x22')]!==_0x46346e['state'][_0xaef2('0x34')]()){this[_0xaef2('0xb')][_0x46346e['device']][_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()['format']('x'));}this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]['state']=_0x46346e['state']['toLowerCase']();logger[_0xaef2('0x2a')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xaef2('0x19')](this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xaef2('0x37')]('trunk:%s',this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]][_0xaef2('0x2d')]),_0xaef2('0x2e'),this[_0xaef2('0xb')][_0x46346e[_0xaef2('0x30')]]);}else if(_[_0xaef2('0x3a')](_0x46346e[_0xaef2('0x30')],_0xaef2('0x3b'))){var _0x599fb6=_0x46346e['device'];var _0x59699d=_0x599fb6[_0xaef2('0x3c')](_0x599fb6[_0xaef2('0x3d')]('/')+0x1,_0x599fb6[_0xaef2('0x3d')]('@'));var _0x24f706=_['find'](this[_0xaef2('0x32')],function(_0x1bd4e3){return _0x1bd4e3['mobile']==_0x59699d||_0x1bd4e3[_0xaef2('0x3e')]==_0x59699d||_0x1bd4e3['accountcode']==_0x59699d;});if(_0x24f706){if(_0x24f706['state']!==_0x46346e['state']['toLowerCase']()){_0x24f706[_0xaef2('0x35')]=_[_0xaef2('0x36')](moment()[_0xaef2('0x37')]('x'));}_0x24f706[_0xaef2('0x22')]=_0x46346e[_0xaef2('0x22')][_0xaef2('0x34')]();_0x24f706[_0xaef2('0x33')]=!![];_0x24f706['updateStatusRealtime'](_0x46346e);}}}}catch(_0x272cbb){logger['error'](_0xaef2('0x31'),util['inspect'](_0x272cbb,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xaef2('0x11')]=function(_0x5e4dd7){try{if(this[_0xaef2('0x1c')](_0x5e4dd7)&&this[_0xaef2('0x1c')](_0x5e4dd7[_0xaef2('0x3f')])){logger[_0xaef2('0x1f')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x5e4dd7['peer'],_0x5e4dd7[_0xaef2('0x40')],_0x5e4dd7[_0xaef2('0x3f')]);logger[_0xaef2('0x2a')](_0xaef2('0x41'),util[_0xaef2('0x19')](_0x5e4dd7,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]]){if(!this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x33')]||_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]()==_0xaef2('0x43')){this['agents'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x33')]=![];this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]();this['agents'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];this[_0xaef2('0x32')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x38')](_0x5e4dd7);}}else if(this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]]){this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')][_0xaef2('0x34')]();this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];logger[_0xaef2('0x2a')](_0xaef2('0x45'),util[_0xaef2('0x19')](this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]],{'showHidden':![],'depth':null}));this[_0xaef2('0x1e')](util[_0xaef2('0x37')]('telephone:%s',this[_0xaef2('0xc')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x2d')]),'telephone:save',this[_0xaef2('0xc')][_0x5e4dd7['peer']]);}else if(this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]]){this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x44')]=_0x5e4dd7[_0xaef2('0x3f')]['toLowerCase']();this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x40')]=_0x5e4dd7[_0xaef2('0x40')];logger[_0xaef2('0x2a')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xaef2('0x19')](this[_0xaef2('0xb')][_0x5e4dd7['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xaef2('0x37')]('trunk:%s',this['trunks'][_0x5e4dd7[_0xaef2('0x42')]][_0xaef2('0x2d')]),_0xaef2('0x2e'),this[_0xaef2('0xb')][_0x5e4dd7[_0xaef2('0x42')]]);}}}catch(_0x23d977){logger[_0xaef2('0x16')](_0xaef2('0x41'),util[_0xaef2('0x19')](_0x23d977,{'showHidden':![],'depth':null}));}};module[_0xaef2('0x46')]=UserReport; \ No newline at end of file +var _0x260d=['actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','agents','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','telephone:%s','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','local','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','ioredis','../../../config/logger','ami','redis','defaults','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x260d,0xc4));var _0xd260=function(_0x37e5ec,_0x22010f){_0x37e5ec=_0x37e5ec-0x0;var _0x1a1d4a=_0x260d[_0x37e5ec];return _0x1a1d4a;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xd260('0x0'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0xd260('0x1'))(_0xd260('0x2'));var ami=require('../ami');config[_0xd260('0x3')]=_[_0xd260('0x4')](config[_0xd260('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xd260('0x5'))(new Redis(config[_0xd260('0x3')]));function UserReport(_0x5d9982){this[_0xd260('0x6')]=_0x5d9982['trunks'];this['agents']=_0x5d9982['agents'];this[_0xd260('0x7')]=_0x5d9982[_0xd260('0x7')];ami['on'](_0xd260('0x8'),this[_0xd260('0x9')][_0xd260('0xa')](this));ami['on'](_0xd260('0xb'),this[_0xd260('0x9')][_0xd260('0xa')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xd260('0xa')](this));ami['on'](_0xd260('0xc'),this[_0xd260('0xd')][_0xd260('0xa')](this));return this[_0xd260('0xe')]();}function showSipRegistrations(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x11')]())[_0xd260('0x12')](function(_0x13027e){logger[_0xd260('0x13')]('[userReport][sipshowregistry]',util[_0xd260('0x14')](_0x13027e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x15')]())[_0xd260('0x12')](function(_0x39641f){logger[_0xd260('0x13')](_0xd260('0x16'),util[_0xd260('0x14')](_0x39641f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x17')]())['catch'](function(_0x40a4bf){logger[_0xd260('0x13')](_0xd260('0x18'),util[_0xd260('0x14')](_0x40a4bf,{'showHidden':![],'depth':null}));});}UserReport[_0xd260('0x19')][_0xd260('0xe')]=function(){setInterval(function(){BPromise[_0xd260('0xf')]()[_0xd260('0x10')](showSipRegistrations())['then'](listDeviceStates())[_0xd260('0x10')](showPeersStatus());},0x32c8);};UserReport[_0xd260('0x19')][_0xd260('0x1a')]=function(_0x3c2640){return _0x3c2640!==null&&!_[_0xd260('0x1b')](_0x3c2640);};UserReport['prototype'][_0xd260('0x1c')]=function(_0x1366a8,_0x304cce,_0x3f35a9){io['to'](_0x1366a8)['emit'](_0x304cce,_0x3f35a9);};UserReport[_0xd260('0x19')][_0xd260('0x9')]=function(_0x4267b1){try{if(this[_0xd260('0x1a')](_0x4267b1)){logger[_0xd260('0x1d')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x4267b1[_0xd260('0x1e')],_0x4267b1[_0xd260('0x1f')]);logger[_0xd260('0x20')](_0xd260('0x21'),util[_0xd260('0x14')](_0x4267b1,{'showHidden':![],'depth':null}));var _0x1a6fc1=_[_0xd260('0x22')](this[_0xd260('0x6')],{'registry':_0x4267b1['username']});if(_0x1a6fc1){_0x4267b1[_0xd260('0x23')]=_0x4267b1[_0xd260('0x1f')];_[_0xd260('0x24')](_0x1a6fc1,_[_0xd260('0x25')](_0x4267b1,[_0xd260('0x26'),_0xd260('0x27'),'username','state']));logger[_0xd260('0x20')](_0xd260('0x28'),util[_0xd260('0x14')](_0x1a6fc1,{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x2a'),_0x1a6fc1['name']),_0xd260('0x2b'),_0x1a6fc1);}}}catch(_0x11f6b1){logger['error'](_0xd260('0x21'),util[_0xd260('0x14')](_0x11f6b1,{'showHidden':![],'depth':null}));}};UserReport[_0xd260('0x19')][_0xd260('0x2c')]=function(_0x266b7e){try{if(this[_0xd260('0x1a')](_0x266b7e)){logger[_0xd260('0x1d')](_0xd260('0x2d'),_0x266b7e[_0xd260('0x2e')],_0x266b7e['state']);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0x266b7e,{'showHidden':![],'depth':null}));if(this['agents'][_0x266b7e[_0xd260('0x2e')]]){if(!this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['local']||_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()==_0xd260('0x31')){this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['local']=![];if(this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')]['toLowerCase']()){this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['stateTime']=_[_0xd260('0x32')](moment()[_0xd260('0x29')]('x'));}this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['state']=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x33')](_0x266b7e);}}else if(this[_0xd260('0x7')][_0x266b7e[_0xd260('0x2e')]]){if(this['telephones'][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()){this['telephones'][_0x266b7e['device']][_0xd260('0x34')]=_[_0xd260('0x32')](moment()['format']('x'));}this[_0xd260('0x7')][_0x266b7e['device']][_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')]['toLowerCase']();logger[_0xd260('0x20')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xd260('0x14')](this['telephones'][_0x266b7e['device']],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x35'),this[_0xd260('0x7')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x36')]),_0xd260('0x37'),this['telephones'][_0x266b7e[_0xd260('0x2e')]]);}else if(this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]]){if(this['trunks'][_0x266b7e['device']]['state']!==_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()){this['trunks'][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x34')]=_['toNumber'](moment()[_0xd260('0x29')]('x'));}this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();logger[_0xd260('0x20')](_0xd260('0x38'),util[_0xd260('0x14')](this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x2a'),this[_0xd260('0x6')][_0x266b7e['device']][_0xd260('0x36')]),_0xd260('0x2b'),this[_0xd260('0x6')][_0x266b7e['device']]);}else if(_['startsWith'](_0x266b7e[_0xd260('0x2e')],_0xd260('0x39'))){var _0x2cdbd8=_0x266b7e[_0xd260('0x2e')];var _0x4b3efc=_0x2cdbd8[_0xd260('0x3a')](_0x2cdbd8[_0xd260('0x3b')]('/')+0x1,_0x2cdbd8[_0xd260('0x3b')]('@'));var _0x27105e=_['find'](this[_0xd260('0x2f')],function(_0x32edb0){return _0x32edb0[_0xd260('0x3c')]==_0x4b3efc||_0x32edb0['phone']==_0x4b3efc||_0x32edb0['accountcode']==_0x4b3efc;});if(_0x27105e){if(_0x27105e[_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')]['toLowerCase']()){_0x27105e[_0xd260('0x34')]=_[_0xd260('0x32')](moment()[_0xd260('0x29')]('x'));}_0x27105e[_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();_0x27105e[_0xd260('0x3d')]=!![];_0x27105e[_0xd260('0x33')](_0x266b7e);}}}}catch(_0x49db7c){logger[_0xd260('0x13')]('[userReport][devicestatechange]',util[_0xd260('0x14')](_0x49db7c,{'showHidden':![],'depth':null}));}};UserReport[_0xd260('0x19')]['syncPeerStatus']=function(_0x1baf2f){try{if(this[_0xd260('0x1a')](_0x1baf2f)&&this[_0xd260('0x1a')](_0x1baf2f[_0xd260('0xc')])){logger[_0xd260('0x1d')](_0xd260('0x3e'),_0x1baf2f[_0xd260('0x3f')],_0x1baf2f['address'],_0x1baf2f[_0xd260('0xc')]);logger[_0xd260('0x20')](_0xd260('0x40'),util[_0xd260('0x14')](_0x1baf2f,{'showHidden':![],'depth':null}));if(this[_0xd260('0x2f')][_0x1baf2f['peer']]){if(!this[_0xd260('0x2f')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x3d')]||_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]()==_0xd260('0x41')){this[_0xd260('0x2f')][_0x1baf2f['peer']]['local']=![];this[_0xd260('0x2f')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')]['toLowerCase']();this['agents'][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f[_0xd260('0x43')];this[_0xd260('0x2f')][_0x1baf2f['peer']][_0xd260('0x33')](_0x1baf2f);}}else if(this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]]){this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]();this['telephones'][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f[_0xd260('0x43')];logger[_0xd260('0x20')](_0xd260('0x44'),util['inspect'](this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x35'),this['telephones'][_0x1baf2f[_0xd260('0x3f')]]['name']),'telephone:save',this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]]);}else if(this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]]){this['trunks'][_0x1baf2f['peer']][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]();this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f['address'];logger[_0xd260('0x20')](_0xd260('0x45'),util[_0xd260('0x14')](this[_0xd260('0x6')][_0x1baf2f['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xd260('0x29')](_0xd260('0x2a'),this['trunks'][_0x1baf2f['peer']][_0xd260('0x36')]),_0xd260('0x2b'),this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]]);}}}catch(_0x5eb5a4){logger[_0xd260('0x13')](_0xd260('0x40'),util[_0xd260('0x14')](_0x5eb5a4,{'showHidden':![],'depth':null}));}};module[_0xd260('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 4049622..7e02121 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 _0x632d=['uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheremembername','lastevent','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','ioredis','../../../config/environment','ami','../ami','redis','localhost','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info'];(function(_0x5b50f2,_0x432356){var _0x55b60a=function(_0x53e584){while(--_0x53e584){_0x5b50f2['push'](_0x5b50f2['shift']());}};_0x55b60a(++_0x432356);}(_0x632d,0x10d));var _0xd632=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x632d[_0x574617];return _0x29de90;};'use strict';var _=require(_0xd632('0x0'));var moment=require('moment');var util=require(_0xd632('0x1'));var Redis=require(_0xd632('0x2'));var config=require(_0xd632('0x3'));var logger=require('../../../config/logger')(_0xd632('0x4'));var ami=require(_0xd632('0x5'));config[_0xd632('0x6')]=_['defaults'](config['redis'],{'host':_0xd632('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd632('0x6')]));function VoiceAgentReport(_0x3983a5){this['channels']={};this[_0xd632('0x8')]=_0x3983a5[_0xd632('0x8')];this[_0xd632('0x9')]=_0x3983a5['agents'];this[_0xd632('0xa')]={};ami['on'](_0xd632('0xb'),this[_0xd632('0xc')][_0xd632('0xd')](this));ami['on'](_0xd632('0xe'),this['syncAgentConnect']['bind'](this));ami['on'](_0xd632('0xf'),this[_0xd632('0x10')][_0xd632('0xd')](this));ami['on'](_0xd632('0x11'),this[_0xd632('0x12')][_0xd632('0xd')](this));ami['on'](_0xd632('0x13'),this['syncAgentComplete'][_0xd632('0xd')](this));ami['on']('varset',this['syncVarSet'][_0xd632('0xd')](this));ami['on'](_0xd632('0x14'),this[_0xd632('0x15')][_0xd632('0xd')](this));ami['on']('musiconholdstart',this[_0xd632('0x16')]['bind'](this));ami['on'](_0xd632('0x17'),this[_0xd632('0x18')][_0xd632('0xd')](this));ami['on'](_0xd632('0x19'),this[_0xd632('0x1a')][_0xd632('0xd')](this));ami['on'](_0xd632('0x1b'),this['syncBlindTransfer'][_0xd632('0xd')](this));}VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x1d')]=function(_0x2937ef,_0x5aba8c,_0x1635ed){io['to'](_0x2937ef)['emit'](_0x5aba8c,_0x1635ed);};VoiceAgentReport['prototype'][_0xd632('0x1e')]=function(_0x27595c){return _0x27595c!==null&&!_[_0xd632('0x1f')](_0x27595c);};VoiceAgentReport[_0xd632('0x1c')]['syncAgentCalled']=function(_0x4c22e3){try{if(this[_0xd632('0x1e')](_0x4c22e3)){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4c22e3[_0xd632('0x21')],_0x4c22e3['membername'],_0x4c22e3[_0xd632('0x22')]);logger[_0xd632('0x23')](_0xd632('0x24'),_0x4c22e3[_0xd632('0x21')],util['inspect'](_0x4c22e3,{'showHidden':![],'depth':null}));if(_[_0xd632('0x1f')](this['channels'][_0x4c22e3[_0xd632('0x21')]])){this[_0xd632('0x25')][_0x4c22e3['uniqueid']]={};}if(_[_0xd632('0x1f')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]])){this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3['destuniqueid']]={'agentcalledAt':moment()[_0xd632('0x26')](_0xd632('0x27')),'lastevent':_0xd632('0x28'),'mandatoryDisposition':this[_0xd632('0x8')][_0x4c22e3[_0xd632('0x29')]]?this[_0xd632('0x8')][_0x4c22e3[_0xd632('0x29')]][_0xd632('0x2a')]||![]:![],'type':this['voiceQueues'][_0x4c22e3[_0xd632('0x29')]]?this[_0xd632('0x8')][_0x4c22e3['queue']][_0xd632('0x2b')]||_0xd632('0x2c'):_0xd632('0x2c'),'variables':this['variables'][_0x4c22e3[_0xd632('0x21')]]};}_[_0xd632('0x2d')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]],_[_0xd632('0x2e')](_0x4c22e3,[_0xd632('0x2f'),_0xd632('0x30')]));logger[_0xd632('0x23')](_0xd632('0x31'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x4c22e3['uniqueid']][_0x4c22e3['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x33'),this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]]);logger['debug'](_0xd632('0x34'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')](_0xd632('0x35'),_0x4c22e3[_0xd632('0x36')]),_0xd632('0x37'),this['channels'][_0x4c22e3[_0xd632('0x21')]][_0x4c22e3[_0xd632('0x22')]]);}}catch(_0x3592b4){logger[_0xd632('0x38')](_0xd632('0x39'),_0x4c22e3[_0xd632('0x21')],util[_0xd632('0x32')](_0x3592b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x3a')]=function(_0x3660a4){try{if(this[_0xd632('0x1e')](_0x3660a4)){if(this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]]){logger[_0xd632('0x23')](_0xd632('0x3b'),_0x3660a4[_0xd632('0x21')],util['inspect'](_0x3660a4,{'showHidden':![],'depth':null}));for(var _0x44c761 in this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0xd632('0x3c')](_0x44c761)){if(_0x3660a4[_0xd632('0x22')]===_0x44c761){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3660a4[_0xd632('0x21')],_0x3660a4[_0xd632('0x36')],_0x3660a4[_0xd632('0x22')]);this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['agentconnectAt']=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3d')]=_0x3660a4[_0xd632('0x3d')];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3e')]=_0x3660a4['connectedlinenum'];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x3f')]=_0x3660a4[_0xd632('0x3f')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['destchannelstatedesc']=_0x3660a4['destchannelstatedesc'];this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x40')]=_0x3660a4[_0xd632('0x40')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['lastevent']=_0xd632('0x41');_[_0xd632('0x2d')](this[_0xd632('0x9')][_0x3660a4[_0xd632('0x42')]],_[_0xd632('0x43')](_0x3660a4,['queue',_0xd632('0x44')]));logger[_0xd632('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x3660a4[_0xd632('0x21')],util['inspect'](this['channels'][_0x3660a4[_0xd632('0x21')]][_0x3660a4[_0xd632('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd632('0x45'),this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x3660a4[_0xd632('0x22')]]);logger[_0xd632('0x23')](_0xd632('0x46'),_0x3660a4[_0xd632('0x21')],util['inspect'](this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x3660a4[_0xd632('0x22')]],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')](_0xd632('0x35'),_0x3660a4[_0xd632('0x36')]),'user:agentconnect',this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x3660a4['destuniqueid']]);}else if(!this['channels'][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0xf')]&&!this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761]['agentcomplete']){logger[_0xd632('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x3660a4[_0xd632('0x21')],this['channels'][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x36')],_0x44c761);this['channels'][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0xf')]=!![];this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0x47')]=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]['answeredelsewheredestinationuniqueid']=_0x3660a4[_0xd632('0x22')];this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761][_0xd632('0x48')]=_0x3660a4[_0xd632('0x36')];this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x49')]='answered_elsewhere';this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761][_0xd632('0x4a')]='answered_elsewhere';logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x3660a4[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x3660a4['uniqueid']][_0x44c761],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x4b'),this[_0xd632('0x25')][_0x3660a4[_0xd632('0x21')]][_0x44c761]);}}}}}}catch(_0x37ac33){logger[_0xd632('0x38')](_0xd632('0x4c'),_0x3660a4['uniqueid'],util[_0xd632('0x32')](_0x37ac33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x10')]=function(_0x1736bf){try{if(this['isNotNull'](_0x1736bf)){logger[_0xd632('0x23')](_0xd632('0x4d'),_0x1736bf[_0xd632('0x21')],util['inspect'](_0x1736bf,{'showHidden':![],'depth':null}));if(this['channels'][_0x1736bf[_0xd632('0x21')]]&&this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf[_0xd632('0x22')]]){logger['info'](_0xd632('0x4e'),_0x1736bf[_0xd632('0x21')],_0x1736bf[_0xd632('0x36')],_0x1736bf[_0xd632('0x22')]);this['channels'][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]]['agentringnoanswer']=!![];this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]][_0xd632('0x47')]=moment()[_0xd632('0x26')](_0xd632('0x27'));this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]][_0xd632('0x49')]=_0xd632('0x4f');this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf[_0xd632('0x22')]][_0xd632('0x4a')]=_0xd632('0x4f');logger[_0xd632('0x23')](_0xd632('0x50'),_0x1736bf[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x1736bf['uniqueid']][_0x1736bf['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0xd632('0x25')][_0x1736bf[_0xd632('0x21')]][_0x1736bf[_0xd632('0x22')]]);}}}catch(_0x30be77){logger['error'](_0xd632('0x51'),_0x1736bf[_0xd632('0x21')],util[_0xd632('0x32')](_0x30be77,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x2f69fc){try{if(this[_0xd632('0x1e')](_0x2f69fc)){logger[_0xd632('0x23')](_0xd632('0x52'),_0x2f69fc[_0xd632('0x21')],util[_0xd632('0x32')](_0x2f69fc,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]]){for(var _0x4174c7 in this['channels'][_0x2f69fc['uniqueid']]){if(this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]]['hasOwnProperty'](_0x4174c7)&&!this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0xf')]&&!this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]['agentcomplete']){logger[_0xd632('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2f69fc[_0xd632('0x21')],this['channels'][_0x2f69fc['uniqueid']][_0x4174c7][_0xd632('0x36')],_0x4174c7);this['channels'][_0x2f69fc['uniqueid']][_0x4174c7][_0xd632('0xf')]=!![];this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]['agentringnoanswerAt']=moment()[_0xd632('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0x49')]=_0xd632('0x53');this['channels'][_0x2f69fc[_0xd632('0x21')]][_0x4174c7][_0xd632('0x4a')]=_0xd632('0x53');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2f69fc['uniqueid'],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x54'),this[_0xd632('0x25')][_0x2f69fc[_0xd632('0x21')]][_0x4174c7]);}}}}}catch(_0x453cab){logger[_0xd632('0x38')](_0xd632('0x55'),_0x2f69fc[_0xd632('0x21')],util['inspect'](_0x453cab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x56')]=function(_0x5ad373){try{if(this[_0xd632('0x1e')](_0x5ad373)){logger[_0xd632('0x23')](_0xd632('0x57'),_0x5ad373['uniqueid'],util['inspect'](_0x5ad373,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]]){for(var _0x2c706b in this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0xd632('0x3c')](_0x2c706b)){if(this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['agentconnectAt']&&!this['channels'][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x13')]){logger[_0xd632('0x20')](_0xd632('0x58'),_0x5ad373[_0xd632('0x21')],this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x36')],_0x2c706b);this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x59')]=moment()['format'](_0xd632('0x27'));this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['reason']=_0x5ad373['reason']=='transfer'?_0xd632('0x5b'):_0x5ad373[_0xd632('0x4a')];this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]['talktime']=_0x5ad373[_0xd632('0x5c')];if(this['voiceQueues'][_0x5ad373['queue']]&&this[_0xd632('0x8')][_0x5ad373['queue']][_0xd632('0x5d')]){this[_0xd632('0x25')][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x5e')]=this[_0xd632('0x8')][_0x5ad373[_0xd632('0x29')]][_0xd632('0x5f')];this['channels'][_0x5ad373['uniqueid']][_0x2c706b][_0xd632('0x60')]=!![];}this[_0xd632('0x9')][_0x5ad373[_0xd632('0x42')]]=_[_0xd632('0x2e')](this[_0xd632('0x9')][_0x5ad373['interface']],[_0xd632('0x29'),'destconnectedlinenum']);logger[_0xd632('0x23')](_0xd632('0x61'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b],{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x62'),this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]);logger[_0xd632('0x23')](_0xd632('0x63'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b],{'showHidden':![],'depth':null}));this[_0xd632('0x1d')](util[_0xd632('0x26')]('user:%s',_0x5ad373[_0xd632('0x36')]),_0xd632('0x64'),this[_0xd632('0x25')][_0x5ad373[_0xd632('0x21')]][_0x2c706b]);}}}}}}catch(_0x527c4c){logger['error'](_0xd632('0x65'),_0x5ad373[_0xd632('0x21')],util[_0xd632('0x32')](_0x527c4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x66')]=function(_0x5d56fa){try{if(this[_0xd632('0x1e')](_0x5d56fa)){logger[_0xd632('0x23')](_0xd632('0x67'),_0x5d56fa['uniqueid'],util['inspect'](_0x5d56fa,{'showHidden':![],'depth':null}));this[_0xd632('0x68')](_0x5d56fa[_0xd632('0x21')],_[_0xd632('0x69')](_0x5d56fa[_0xd632('0x6a')])[0x0],_0x5d56fa['value']);if(this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]]){for(var _0x1aaa8c in this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x5d56fa['uniqueid']][_0xd632('0x3c')](_0x1aaa8c)){logger[_0xd632('0x20')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x5d56fa[_0xd632('0x21')],_0x1aaa8c,_[_0xd632('0x69')](_0x5d56fa[_0xd632('0x6a')])[0x0],_0x5d56fa[_0xd632('0x6b')]);if(_['isUndefined'](this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c][_0xd632('0xa')])){this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c][_0xd632('0xa')]={};}this[_0xd632('0x25')][_0x5d56fa[_0xd632('0x21')]][_0x1aaa8c]['variables']=this[_0xd632('0xa')][_0x5d56fa['uniqueid']];}}}}}catch(_0x5c27b9){logger[_0xd632('0x38')](_0xd632('0x6c'),_0x5d56fa['uniqueid'],util['inspect'](_0x5c27b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x5b9e5e,_0x2f3b03,_0x36d261){var _0x1be70f=[_0xd632('0x6d'),'rtpaudioqosbridged',_0xd632('0x6e'),_0xd632('0x6f'),'rtpaudioqosloss',_0xd632('0x70'),_0xd632('0x71'),_0xd632('0x72'),_0xd632('0x73'),_0xd632('0x74'),_0xd632('0x75'),'bridgepvtcallid',_0xd632('0x76'),_0xd632('0x77'),'memberinterface','memberlastcall',_0xd632('0x36'),'memberpenalty',_0xd632('0x78')];if(!_[_0xd632('0x79')](_0x2f3b03)&&!_[_0xd632('0x7a')](_0x1be70f,_0x2f3b03)){if(_['isUndefined'](this['variables'][_0x5b9e5e])){this['variables'][_0x5b9e5e]={};}this['variables'][_0x5b9e5e][_0x2f3b03]=_0x36d261;}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x15')]=function(_0x853729){try{if(this[_0xd632('0x1e')](_0x853729)){logger[_0xd632('0x23')](_0xd632('0x7b'),_0x853729['uniqueid'],util['inspect'](_0x853729,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]){for(var _0x90615c in this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]){if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]][_0xd632('0x3c')](_0x90615c)){if(this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]][_0x90615c][_0xd632('0x4a')]==_0xd632('0x7c')&&this[_0xd632('0x25')][_0x853729['uniqueid']][_0x90615c][_0xd632('0x13')]){logger[_0xd632('0x20')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x853729[_0xd632('0x21')],_0x90615c);this[_0xd632('0x25')][_0x853729['uniqueid']][_0x90615c][_0xd632('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xd632('0x23')](_0xd632('0x7d'),_0x853729[_0xd632('0x21')],util[_0xd632('0x32')](_[_0xd632('0x7e')](this[_0xd632('0x25')][_0x853729[_0xd632('0x21')]]),{'showHidden':![],'depth':null}));ami[_0xd632('0x1d')](_0xd632('0x7f'),_[_0xd632('0x7e')](this['channels'][_0x853729[_0xd632('0x21')]]));delete this[_0xd632('0x25')][_0x853729['uniqueid']];}if(this[_0xd632('0xa')][_0x853729['uniqueid']]){delete this[_0xd632('0xa')][_0x853729['uniqueid']];}}}catch(_0x446b6b){logger[_0xd632('0x38')](_0xd632('0x80'),_0x853729[_0xd632('0x21')],util[_0xd632('0x32')](_0x446b6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x1a')]=function(_0x514b41){try{if(this[_0xd632('0x1e')](_0x514b41)){logger[_0xd632('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x514b41[_0xd632('0x21')],util[_0xd632('0x32')](_0x514b41,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]){for(var _0x445fd7 in this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]){if(this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']][_0xd632('0x3c')](_0x445fd7)){if(_0x514b41[_0xd632('0x82')]===_0x445fd7){logger[_0xd632('0x20')](_0xd632('0x83'),_0x514b41['uniqueid'],this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7]['membername'],_0x445fd7);var _0x1618bd=moment();this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x59')]=moment()['format'](_0xd632('0x27'));this['channels'][_0x514b41[_0xd632('0x81')]][_0x445fd7][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']][_0x445fd7][_0xd632('0x4a')]=_0xd632('0x7c');this['channels'][_0x514b41[_0xd632('0x81')]][_0x445fd7]['talktime']=_0x1618bd['diff'](this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]][_0x445fd7]['agentconnectAt'],_0xd632('0x84'));}}}}if(this['channels'][_0x514b41['secondtransfereruniqueid']]){var _0x1d77df=this[_0xd632('0x25')][_0x514b41[_0xd632('0x85')]];this['channels'][_0x514b41[_0xd632('0x85')]]=this[_0xd632('0x25')][_0x514b41['transfereeuniqueid']];this[_0xd632('0x25')][_0x514b41[_0xd632('0x81')]]=_0x1d77df;}}}catch(_0x2ac3ea){logger['error'](_0xd632('0x86'),_0x514b41[_0xd632('0x21')],util['inspect'](_0x2ac3ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x87')]=function(_0x4a6a26){try{if(this[_0xd632('0x1e')](_0x4a6a26)){logger[_0xd632('0x23')](_0xd632('0x88'),_0x4a6a26[_0xd632('0x21')],util[_0xd632('0x32')](_0x4a6a26,{'showHidden':![],'depth':null}));if(this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]]){for(var _0x95f073 in this['channels'][_0x4a6a26[_0xd632('0x81')]]){if(this[_0xd632('0x25')][_0x4a6a26['transfereeuniqueid']][_0xd632('0x3c')](_0x95f073)){if(_0x4a6a26[_0xd632('0x89')]===_0x95f073){logger['info'](_0xd632('0x8a'),_0x4a6a26[_0xd632('0x21')],this['channels'][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x36')],_0x95f073);var _0x2886ab=moment();this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x13')]=!![];this[_0xd632('0x25')][_0x4a6a26['transfereeuniqueid']][_0x95f073][_0xd632('0x59')]=_0x2886ab;this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x49')]=_0xd632('0x5a');this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073]['reason']=_0xd632('0x7c');this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x5c')]=_0x2886ab[_0xd632('0x8b')](this[_0xd632('0x25')][_0x4a6a26[_0xd632('0x81')]][_0x95f073][_0xd632('0x8c')],_0xd632('0x84'));}}}}}}catch(_0x32bf72){logger[_0xd632('0x38')](_0xd632('0x8d'),_0x4a6a26[_0xd632('0x21')],util[_0xd632('0x32')](_0x32bf72,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd632('0x16')]=function(_0x506f2a){var _0x97c290='';try{if(this[_0xd632('0x1e')](_0x506f2a)){logger[_0xd632('0x23')](_0xd632('0x8e'),_0x506f2a[_0xd632('0x21')],util[_0xd632('0x32')](_0x506f2a,{'showHidden':![],'depth':null}));if(_0x506f2a[_0xd632('0x8f')]){_0x97c290=_0x506f2a['channel']['substring'](0x0,_0x506f2a[_0xd632('0x8f')]['lastIndexOf']('-'));if(this['agents'][_0x97c290]){logger[_0xd632('0x20')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x506f2a[_0xd632('0x21')],_0x97c290);this[_0xd632('0x9')][_0x97c290][_0xd632('0x90')]=!![];}}}}catch(_0x117294){logger[_0xd632('0x38')](_0xd632('0x91'),_0x506f2a[_0xd632('0x21')],util[_0xd632('0x32')](_0x117294,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd632('0x1c')][_0xd632('0x18')]=function(_0x5b5470){var _0x1fc315='';try{if(this[_0xd632('0x1e')](_0x5b5470)){logger[_0xd632('0x23')](_0xd632('0x92'),_0x5b5470[_0xd632('0x21')],util['inspect'](_0x5b5470,{'showHidden':![],'depth':null}));if(_0x5b5470[_0xd632('0x8f')]){_0x1fc315=_0x5b5470[_0xd632('0x8f')][_0xd632('0x93')](0x0,_0x5b5470[_0xd632('0x8f')][_0xd632('0x94')]('-'));if(this[_0xd632('0x9')][_0x1fc315]){logger[_0xd632('0x20')](_0xd632('0x95'),_0x5b5470[_0xd632('0x21')],_0x1fc315);this[_0xd632('0x9')][_0x1fc315][_0xd632('0x90')]=![];}}}}catch(_0x1ae7e7){logger[_0xd632('0x38')]('[%s][voiceAgentReport][musiconholdstop]',_0x5b5470[_0xd632('0x21')],util[_0xd632('0x32')](_0x1ae7e7,{'showHidden':![],'depth':null}));}};module[_0xd632('0x96')]=VoiceAgentReport; \ No newline at end of file +var _0x7f96=['[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','moment','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','interface','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:'];(function(_0x4af23c,_0x50e294){var _0x194b63=function(_0x44f871){while(--_0x44f871){_0x4af23c['push'](_0x4af23c['shift']());}};_0x194b63(++_0x50e294);}(_0x7f96,0x8e));var _0x67f9=function(_0x3721d5,_0x42464b){_0x3721d5=_0x3721d5-0x0;var _0x102217=_0x7f96[_0x3721d5];return _0x102217;};'use strict';var _=require('lodash');var moment=require(_0x67f9('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x67f9('0x1'));var logger=require(_0x67f9('0x2'))('ami');var ami=require(_0x67f9('0x3'));config[_0x67f9('0x4')]=_['defaults'](config[_0x67f9('0x4')],{'host':_0x67f9('0x5'),'port':0x18eb});var io=require(_0x67f9('0x6'))(new Redis(config[_0x67f9('0x4')]));function VoiceAgentReport(_0x289355){this[_0x67f9('0x7')]={};this['voiceQueues']=_0x289355[_0x67f9('0x8')];this[_0x67f9('0x9')]=_0x289355[_0x67f9('0x9')];this[_0x67f9('0xa')]={};ami['on']('agentcalled',this[_0x67f9('0xb')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0xd'),this[_0x67f9('0xe')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0xf'),this['syncAgentRingNoAnswer'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x10'),this[_0x67f9('0x11')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x12'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0x67f9('0x13')][_0x67f9('0xc')](this));ami['on']('hangup',this['syncHangup'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x14'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x67f9('0x15'),this[_0x67f9('0x16')][_0x67f9('0xc')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x17'),this[_0x67f9('0x18')][_0x67f9('0xc')](this));}VoiceAgentReport[_0x67f9('0x19')]['emit']=function(_0x61cab8,_0x4c9f2f,_0x22779c){io['to'](_0x61cab8)[_0x67f9('0x1a')](_0x4c9f2f,_0x22779c);};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x1b')]=function(_0xa9c4fa){return _0xa9c4fa!==null&&!_[_0x67f9('0x1c')](_0xa9c4fa);};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0xb')]=function(_0x1d7b19){try{if(this[_0x67f9('0x1b')](_0x1d7b19)){logger[_0x67f9('0x1d')](_0x67f9('0x1e'),_0x1d7b19[_0x67f9('0x1f')],_0x1d7b19[_0x67f9('0x20')],_0x1d7b19[_0x67f9('0x21')]);logger['debug'](_0x67f9('0x22'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1d7b19,{'showHidden':![],'depth':null}));if(_[_0x67f9('0x1c')](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]])){this[_0x67f9('0x7')][_0x1d7b19['uniqueid']]={};}if(_['isUndefined'](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19['destuniqueid']])){this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19[_0x67f9('0x21')]]={'agentcalledAt':moment()['format'](_0x67f9('0x24')),'lastevent':_0x67f9('0x25'),'mandatoryDisposition':this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]]?this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]][_0x67f9('0x27')]||![]:![],'type':this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]]?this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]][_0x67f9('0x28')]||_0x67f9('0x29'):_0x67f9('0x29'),'variables':this[_0x67f9('0xa')][_0x1d7b19[_0x67f9('0x1f')]]};}_[_0x67f9('0x2a')](this[_0x67f9('0x7')][_0x1d7b19['uniqueid']][_0x1d7b19['destuniqueid']],_[_0x67f9('0x2b')](_0x1d7b19,[_0x67f9('0x2c'),_0x67f9('0x2d')]));logger[_0x67f9('0x2e')](_0x67f9('0x2f'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentcalled',this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]]);logger[_0x67f9('0x2e')](_0x67f9('0x30'),_0x1d7b19['uniqueid'],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')](_0x67f9('0x32'),_0x1d7b19['membername']),_0x67f9('0x33'),this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]]);}}catch(_0x16f8ec){logger[_0x67f9('0x34')](_0x67f9('0x35'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x16f8ec,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0xe')]=function(_0x18a63a){try{if(this[_0x67f9('0x1b')](_0x18a63a)){if(this['channels'][_0x18a63a[_0x67f9('0x1f')]]){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x18a63a[_0x67f9('0x1f')],util['inspect'](_0x18a63a,{'showHidden':![],'depth':null}));for(var _0x574995 in this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x67f9('0x36')](_0x574995)){if(_0x18a63a[_0x67f9('0x21')]===_0x574995){logger['info'](_0x67f9('0x37'),_0x18a63a[_0x67f9('0x1f')],_0x18a63a[_0x67f9('0x20')],_0x18a63a[_0x67f9('0x21')]);this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x38')]=moment()['format'](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['connectedlinename']=_0x18a63a[_0x67f9('0x39')];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3a')]=_0x18a63a['connectedlinenum'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['destchannelstate']=_0x18a63a['destchannelstate'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3b')]=_0x18a63a[_0x67f9('0x3b')];this['channels'][_0x18a63a['uniqueid']][_0x574995][_0x67f9('0x3c')]=_0x18a63a['holdtime'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3d')]='connect';_[_0x67f9('0x2a')](this[_0x67f9('0x9')][_0x18a63a['interface']],_[_0x67f9('0x3e')](_0x18a63a,['queue','destconnectedlinenum']));logger[_0x67f9('0x2e')](_0x67f9('0x3f'),_0x18a63a[_0x67f9('0x1f')],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentconnect',this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]]);logger[_0x67f9('0x2e')](_0x67f9('0x40'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x18a63a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')](_0x67f9('0x32'),_0x18a63a[_0x67f9('0x20')]),'user:agentconnect',this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]]);}else if(!this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0xf')]&&!this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['agentcomplete']){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x18a63a[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x20')],_0x574995);this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0xf')]=!![];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x574995]['answeredelsewheredestinationuniqueid']=_0x18a63a['destuniqueid'];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x42')]=_0x18a63a[_0x67f9('0x20')];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['lastevent']=_0x67f9('0x43');this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x44')]=_0x67f9('0x43');logger[_0x67f9('0x2e')](_0x67f9('0x45'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')](_0x67f9('0x46'),this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]);}}}}}}catch(_0x470bd6){logger['error'](_0x67f9('0x47'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](_0x470bd6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncAgentRingNoAnswer']=function(_0xea4d6){try{if(this[_0x67f9('0x1b')](_0xea4d6)){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xea4d6,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]]&&this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]]){logger[_0x67f9('0x1d')](_0x67f9('0x48'),_0xea4d6[_0x67f9('0x1f')],_0xea4d6['membername'],_0xea4d6[_0x67f9('0x21')]);this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0xf')]=!![];this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6['destuniqueid']][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0x3d')]='rejected';this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0x44')]=_0x67f9('0x49');logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](this['channels'][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')](_0x67f9('0x4a'),this[_0x67f9('0x7')][_0xea4d6['uniqueid']][_0xea4d6[_0x67f9('0x21')]]);}}}catch(_0x4bfdc7){logger[_0x67f9('0x34')](_0x67f9('0x4b'),_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x4bfdc7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncQueueCallerAbandon']=function(_0x51a4f9){try{if(this[_0x67f9('0x1b')](_0x51a4f9)){logger[_0x67f9('0x2e')](_0x67f9('0x4c'),_0x51a4f9['uniqueid'],util[_0x67f9('0x23')](_0x51a4f9,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]]){for(var _0x37bfa6 in this[_0x67f9('0x7')][_0x51a4f9['uniqueid']]){if(this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x37bfa6)&&!this['channels'][_0x51a4f9['uniqueid']][_0x37bfa6]['agentringnoanswer']&&!this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['agentcomplete']){logger[_0x67f9('0x1d')](_0x67f9('0x4d'),_0x51a4f9[_0x67f9('0x1f')],this['channels'][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6][_0x67f9('0x20')],_0x37bfa6);this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['agentringnoanswer']=!![];this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6]['lastevent']=_0x67f9('0x4e');this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['reason']='abandoned';logger[_0x67f9('0x2e')](_0x67f9('0x4f'),_0x51a4f9['uniqueid'],util['inspect'](this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentqueuecallerabandon',this['channels'][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6]);}}}}}catch(_0x2dce85){logger['error'](_0x67f9('0x50'),_0x51a4f9[_0x67f9('0x1f')],util['inspect'](_0x2dce85,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncAgentComplete']=function(_0x130856){try{if(this[_0x67f9('0x1b')](_0x130856)){logger['debug'](_0x67f9('0x51'),_0x130856[_0x67f9('0x1f')],util['inspect'](_0x130856,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]]){for(var _0x338092 in this['channels'][_0x130856[_0x67f9('0x1f')]]){if(this['channels'][_0x130856[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x338092)){if(this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x38')]&&!this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x12')]){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x130856[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x20')],_0x338092);this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x52')]=moment()['format'](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x3d')]=_0x67f9('0x53');this['channels'][_0x130856['uniqueid']][_0x338092][_0x67f9('0x44')]=_0x130856[_0x67f9('0x44')]==_0x67f9('0x54')?_0x67f9('0x55'):_0x130856['reason'];this['channels'][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x56')]=_0x130856[_0x67f9('0x56')];if(this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]]&&this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]][_0x67f9('0x57')]){this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]['acwtime']=this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]]['acwTimeout'];this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]['agentacw']=!![];}this[_0x67f9('0x9')][_0x130856[_0x67f9('0x58')]]=_[_0x67f9('0x2b')](this[_0x67f9('0x9')][_0x130856['interface']],['queue','destconnectedlinenum']);logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x130856[_0x67f9('0x1f')],util['inspect'](this[_0x67f9('0x7')][_0x130856['uniqueid']][_0x338092],{'showHidden':![],'depth':null}));ami['emit'](_0x67f9('0x59'),this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]);logger[_0x67f9('0x2e')](_0x67f9('0x5a'),_0x130856['uniqueid'],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x130856['uniqueid']][_0x338092],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')]('user:%s',_0x130856[_0x67f9('0x20')]),_0x67f9('0x5b'),this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]);}}}}}}catch(_0x106180){logger[_0x67f9('0x34')]('[%s][voiceAgentReport][agentcomplete]',_0x130856[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x106180,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x13')]=function(_0x5dbf8c){try{if(this['isNotNull'](_0x5dbf8c)){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][varset]\x20event:',_0x5dbf8c[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x5dbf8c,{'showHidden':![],'depth':null}));this[_0x67f9('0x5c')](_0x5dbf8c[_0x67f9('0x1f')],_[_0x67f9('0x5d')](_0x5dbf8c[_0x67f9('0x5e')])[0x0],_0x5dbf8c[_0x67f9('0x5f')]);if(this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']]){for(var _0x595b4d in this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x595b4d)){logger[_0x67f9('0x1d')](_0x67f9('0x60'),_0x5dbf8c[_0x67f9('0x1f')],_0x595b4d,_['keys'](_0x5dbf8c['variable'])[0x0],_0x5dbf8c[_0x67f9('0x5f')]);if(_[_0x67f9('0x1c')](this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']][_0x595b4d][_0x67f9('0xa')])){this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']][_0x595b4d][_0x67f9('0xa')]={};}this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]][_0x595b4d][_0x67f9('0xa')]=this[_0x67f9('0xa')][_0x5dbf8c[_0x67f9('0x1f')]];}}}}}catch(_0x5f4f38){logger[_0x67f9('0x34')](_0x67f9('0x61'),_0x5dbf8c[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x5f4f38,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x5c')]=function(_0x47e838,_0x9ac780,_0x3c4bc4){var _0xd59a62=['rtpaudioqos','rtpaudioqosbridged',_0x67f9('0x62'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x67f9('0x63'),_0x67f9('0x64'),_0x67f9('0x65'),_0x67f9('0x66'),_0x67f9('0x67'),_0x67f9('0x68'),_0x67f9('0x69'),_0x67f9('0x6a'),_0x67f9('0x6b'),_0x67f9('0x6c'),_0x67f9('0x6d'),'membername','memberpenalty',_0x67f9('0x6e')];if(!_[_0x67f9('0x6f')](_0x9ac780)&&!_['includes'](_0xd59a62,_0x9ac780)){if(_['isUndefined'](this[_0x67f9('0xa')][_0x47e838])){this['variables'][_0x47e838]={};}this[_0x67f9('0xa')][_0x47e838][_0x9ac780]=_0x3c4bc4;}};VoiceAgentReport[_0x67f9('0x19')]['syncHangup']=function(_0x79ebe2){try{if(this[_0x67f9('0x1b')](_0x79ebe2)){logger[_0x67f9('0x2e')](_0x67f9('0x70'),_0x79ebe2[_0x67f9('0x1f')],util['inspect'](_0x79ebe2,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]]){for(var _0x3a42b7 in this['channels'][_0x79ebe2[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x79ebe2['uniqueid']]['hasOwnProperty'](_0x3a42b7)){if(this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]][_0x3a42b7][_0x67f9('0x44')]==_0x67f9('0x54')&&this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]][_0x3a42b7][_0x67f9('0x12')]){logger['info'](_0x67f9('0x71'),_0x79ebe2[_0x67f9('0x1f')],_0x3a42b7);this[_0x67f9('0x7')][_0x79ebe2['uniqueid']][_0x3a42b7][_0x67f9('0x52')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));}}}logger[_0x67f9('0x2e')](_0x67f9('0x72'),_0x79ebe2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_['values'](this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]]),{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:voiceAgentReport',_[_0x67f9('0x73')](this[_0x67f9('0x7')][_0x79ebe2['uniqueid']]));delete this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]];}if(this[_0x67f9('0xa')][_0x79ebe2[_0x67f9('0x1f')]]){delete this['variables'][_0x79ebe2['uniqueid']];}}}catch(_0xd643c0){logger[_0x67f9('0x34')]('[%s][voiceAgentReport][hangup]',_0x79ebe2[_0x67f9('0x1f')],util['inspect'](_0xd643c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x74')]=function(_0x369fae){try{if(this[_0x67f9('0x1b')](_0x369fae)){logger[_0x67f9('0x2e')](_0x67f9('0x75'),_0x369fae[_0x67f9('0x1f')],util['inspect'](_0x369fae,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]]){for(var _0x22b68c in this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]]){if(this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x67f9('0x36')](_0x22b68c)){if(_0x369fae[_0x67f9('0x77')]===_0x22b68c){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x369fae[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']][_0x22b68c]['membername'],_0x22b68c);var _0x5802b6=moment();this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x52')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c]['lastevent']=_0x67f9('0x53');this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x44')]=_0x67f9('0x54');this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']][_0x22b68c][_0x67f9('0x56')]=_0x5802b6[_0x67f9('0x78')](this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x38')],_0x67f9('0x79'));}}}}if(this[_0x67f9('0x7')][_0x369fae['secondtransfereruniqueid']]){var _0x5363de=this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x7a')]];this['channels'][_0x369fae[_0x67f9('0x7a')]]=this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']];this['channels'][_0x369fae[_0x67f9('0x76')]]=_0x5363de;}}}catch(_0x2217ba){logger[_0x67f9('0x34')](_0x67f9('0x7b'),_0x369fae[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x2217ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x18')]=function(_0x1aada2){try{if(this['isNotNull'](_0x1aada2)){logger[_0x67f9('0x2e')](_0x67f9('0x7c'),_0x1aada2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1aada2,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]]){for(var _0xad2920 in this['channels'][_0x1aada2[_0x67f9('0x76')]]){if(this[_0x67f9('0x7')][_0x1aada2['transfereeuniqueid']][_0x67f9('0x36')](_0xad2920)){if(_0x1aada2[_0x67f9('0x7d')]===_0xad2920){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1aada2[_0x67f9('0x1f')],this['channels'][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x20')],_0xad2920);var _0x3529ec=moment();this[_0x67f9('0x7')][_0x1aada2['transfereeuniqueid']][_0xad2920][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920]['agentcompleteAt']=_0x3529ec;this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x3d')]='complete';this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x44')]=_0x67f9('0x54');this['channels'][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x56')]=_0x3529ec['diff'](this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x38')],'seconds');}}}}}}catch(_0x3c03d4){logger[_0x67f9('0x34')](_0x67f9('0x7e'),_0x1aada2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x3c03d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x7f')]=function(_0x1b8315){var _0x374b73='';try{if(this[_0x67f9('0x1b')](_0x1b8315)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1b8315[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1b8315,{'showHidden':![],'depth':null}));if(_0x1b8315['channel']){_0x374b73=_0x1b8315[_0x67f9('0x80')][_0x67f9('0x81')](0x0,_0x1b8315['channel'][_0x67f9('0x82')]('-'));if(this[_0x67f9('0x9')][_0x374b73]){logger[_0x67f9('0x1d')](_0x67f9('0x83'),_0x1b8315[_0x67f9('0x1f')],_0x374b73);this[_0x67f9('0x9')][_0x374b73]['onhold']=!![];}}}}catch(_0x15a347){logger[_0x67f9('0x34')](_0x67f9('0x84'),_0x1b8315[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x15a347,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x16')]=function(_0xbc4e4f){var _0x195456='';try{if(this[_0x67f9('0x1b')](_0xbc4e4f)){logger['debug'](_0x67f9('0x85'),_0xbc4e4f[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xbc4e4f,{'showHidden':![],'depth':null}));if(_0xbc4e4f[_0x67f9('0x80')]){_0x195456=_0xbc4e4f[_0x67f9('0x80')][_0x67f9('0x81')](0x0,_0xbc4e4f['channel'][_0x67f9('0x82')]('-'));if(this['agents'][_0x195456]){logger[_0x67f9('0x1d')](_0x67f9('0x86'),_0xbc4e4f[_0x67f9('0x1f')],_0x195456);this[_0x67f9('0x9')][_0x195456][_0x67f9('0x87')]=![];}}}}catch(_0xe2ffd6){logger['error'](_0x67f9('0x88'),_0xbc4e4f[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xe2ffd6,{'showHidden':![],'depth':null}));}};module[_0x67f9('0x89')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index c4016b3..ecca794 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 _0x7f60=['lastapplication','lastdata','cdr(','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','connectedlinename','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','diff','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','name','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','secondtransfereruniqueid','transfercalleridnum','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','bind','newexten','syncNewExten','newchannel','newstate','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','pick','[%s][voiceCallReport][newcallerid]','syncNewChannel','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','exten','emit','user:%s','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','merge'];(function(_0x2d3134,_0x477c10){var _0x2dd03e=function(_0x434841){while(--_0x434841){_0x2d3134['push'](_0x2d3134['shift']());}};_0x2dd03e(++_0x477c10);}(_0x7f60,0x1c9));var _0x07f6=function(_0x5d9067,_0x42f3ea){_0x5d9067=_0x5d9067-0x0;var _0x256093=_0x7f60[_0x5d9067];return _0x256093;};'use strict';var BPromise=require('bluebird');var _=require(_0x07f6('0x0'));var moment=require(_0x07f6('0x1'));var util=require(_0x07f6('0x2'));var path=require(_0x07f6('0x3'));var Redis=require(_0x07f6('0x4'));var config=require('../../../config/environment');var logger=require(_0x07f6('0x5'))(_0x07f6('0x6'));var ami=require(_0x07f6('0x7'));var Channel=require(_0x07f6('0x8'));var statusDesc=[_0x07f6('0x9'),_0x07f6('0xa'),'inuse',_0x07f6('0xb'),_0x07f6('0xc'),_0x07f6('0xd'),'ringing',_0x07f6('0xe'),_0x07f6('0xf')];var applications=[_0x07f6('0x10'),_0x07f6('0x11'),_0x07f6('0x12'),_0x07f6('0x13'),_0x07f6('0x14'),_0x07f6('0x15')];var dispositions=[_0x07f6('0x16'),_0x07f6('0x17'),_0x07f6('0x17'),_0x07f6('0x16'),'NO\x20ANSWER',_0x07f6('0x16'),_0x07f6('0x18'),_0x07f6('0x19'),_0x07f6('0x17'),_0x07f6('0x17'),'FAILED'];var actions={};config['redis']=_[_0x07f6('0x1a')](config[_0x07f6('0x1b')],{'host':_0x07f6('0x1c'),'port':0x18eb});var io=require(_0x07f6('0x1d'))(new Redis(config[_0x07f6('0x1b')]));function VoiceCallReport(_0x595afa){this[_0x07f6('0x1e')]=_0x595afa[_0x07f6('0x1e')];this[_0x07f6('0x1f')]=_0x595afa[_0x07f6('0x1f')];this['blindTransfers']={};ami['on']('coreshowchannel',this['syncNewExten'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x21'),this[_0x07f6('0x22')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x23'),this['syncNewChannel']['bind'](this));ami['on'](_0x07f6('0x24'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x25'),this[_0x07f6('0x26')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x27'),this[_0x07f6('0x28')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x29'),this['syncAttendedTransfer'][_0x07f6('0x20')](this));ami['on']('blindtransfer',this[_0x07f6('0x2a')][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x2b'),this['syncMusicOnHoldStart'][_0x07f6('0x20')](this));ami['on'](_0x07f6('0x2c'),this[_0x07f6('0x2d')][_0x07f6('0x20')](this));try{logger[_0x07f6('0x2e')](_0x07f6('0x2f'));ami[_0x07f6('0x30')]();}catch(_0x21b904){logger[_0x07f6('0x31')](_0x07f6('0x32'),util[_0x07f6('0x33')](_0x21b904,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x07f6('0x34')]['isNotNull']=function(_0x54fcba){return _0x54fcba!==null&&!_[_0x07f6('0x35')](_0x54fcba);};VoiceCallReport[_0x07f6('0x34')]['emit']=function(_0xf73e29,_0x2d60e0,_0x359ab4){io['to'](_0xf73e29)['emit'](_0x2d60e0,_0x359ab4);};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x28')]=function(_0x2d5c10){try{if(this['isNotNull'](_0x2d5c10)){logger[_0x07f6('0x2e')](_0x07f6('0x36'),_0x2d5c10[_0x07f6('0x37')],_0x2d5c10[_0x07f6('0x38')],_0x2d5c10['calleridnum']);logger[_0x07f6('0x39')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x2d5c10[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x2d5c10,{'showHidden':![],'depth':null}));if(_0x2d5c10[_0x07f6('0x37')]===_0x2d5c10[_0x07f6('0x3a')]){if(!_['isUndefined'](this[_0x07f6('0x1e')][_0x2d5c10[_0x07f6('0x37')]])){_['merge'](this[_0x07f6('0x1e')][_0x2d5c10[_0x07f6('0x37')]],_[_0x07f6('0x3b')](_0x2d5c10,_['keys'](this['channels'][_0x2d5c10['uniqueid']])));}}}}catch(_0x5bc9bd){logger[_0x07f6('0x31')](_0x07f6('0x3c'),_0x2d5c10[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x5bc9bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x3d')]=function(_0x4fc60b){try{if(this[_0x07f6('0x3e')](_0x4fc60b)){logger['debug'](_0x07f6('0x3f'),_0x4fc60b['uniqueid'],util[_0x07f6('0x33')](_0x4fc60b,{'showHidden':![],'depth':null}));if(_0x4fc60b['uniqueid']===_0x4fc60b[_0x07f6('0x3a')]&&_0x4fc60b[_0x07f6('0x40')]!='OutgoingSpoolFailed'){if(_[_0x07f6('0x35')](this[_0x07f6('0x1e')][_0x4fc60b[_0x07f6('0x37')]])){logger[_0x07f6('0x2e')](_0x07f6('0x41'),_0x4fc60b[_0x07f6('0x37')],_0x4fc60b[_0x07f6('0x42')],_0x4fc60b['exten']);this[_0x07f6('0x1e')][_0x4fc60b[_0x07f6('0x37')]]=new Channel();this['channels'][_0x4fc60b[_0x07f6('0x37')]][_0x07f6('0x43')]=moment()[_0x07f6('0x44')](_0x07f6('0x45'));this[_0x07f6('0x1e')][_0x4fc60b['uniqueid']][_0x07f6('0x46')]=dispositions[_[_0x07f6('0x47')](_0x4fc60b['channelstate'])];_['merge'](this['channels'][_0x4fc60b['uniqueid']],_['pick'](_0x4fc60b,_['keys'](this[_0x07f6('0x1e')][_0x4fc60b['uniqueid']])));if(_0x4fc60b[_0x07f6('0x42')]===_0x07f6('0x48')){if(this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1f')][_0x4fc60b['channel']['split']('-')[0x0]][_0x07f6('0x4a')]=_0x4fc60b['exten'];logger['debug'](_0x07f6('0x4b'),_0x4fc60b[_0x07f6('0x37')],util['inspect']({'destaccountcode':this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]][_0x07f6('0x4c')],'destconnectedlinenum':_0x4fc60b[_0x07f6('0x4d')]},{'showHidden':![],'depth':null}));this[_0x07f6('0x4e')](util['format'](_0x07f6('0x4f'),this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')]['split']('-')[0x0]]['name']),_0x07f6('0x50'),{'destaccountcode':this[_0x07f6('0x1f')][_0x4fc60b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]][_0x07f6('0x4c')],'destconnectedlinenum':_0x4fc60b[_0x07f6('0x4d')]});}}}}}}catch(_0x428b55){logger[_0x07f6('0x31')]('[%s][voiceCallReport][newchannel]',_0x4fc60b[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x428b55,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x22')]=function(_0x44dd70){try{if(this[_0x07f6('0x3e')](_0x44dd70)){logger[_0x07f6('0x39')](_0x07f6('0x51'),_0x44dd70[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x44dd70,{'showHidden':![],'depth':null}));if(_0x44dd70['uniqueid']===_0x44dd70[_0x07f6('0x3a')]&&_0x44dd70[_0x07f6('0x4d')]!='h'&&_0x44dd70[_0x07f6('0x40')]!=_0x07f6('0x52')){_0x44dd70[_0x07f6('0x53')]=_0x44dd70['application']['toLowerCase']();_0x44dd70['applicationdata']=(_0x44dd70[_0x07f6('0x54')]||_0x44dd70[_0x07f6('0x55')])[_0x07f6('0x56')]();logger[_0x07f6('0x2e')](_0x07f6('0x57'),_0x44dd70['uniqueid'],_0x44dd70['application'],_0x44dd70[_0x07f6('0x55')]);if(_[_0x07f6('0x35')](this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]])){this['channels'][_0x44dd70[_0x07f6('0x37')]]=new Channel();this[_0x07f6('0x1e')][_0x44dd70['uniqueid']]['starttime']=_0x44dd70[_0x07f6('0x58')]?moment()[_0x07f6('0x59')](moment[_0x07f6('0x58')](_0x44dd70[_0x07f6('0x58')])['seconds'](),_0x07f6('0x5a'))[_0x07f6('0x44')](_0x07f6('0x45')):moment()[_0x07f6('0x44')](_0x07f6('0x45'));this['channels'][_0x44dd70[_0x07f6('0x37')]]['disposition']=_0x07f6('0x16');}_[_0x07f6('0x5b')](this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]],_[_0x07f6('0x3b')](_0x44dd70,_['keys'](this['channels'][_0x44dd70[_0x07f6('0x37')]])));if(_['includes'](applications,_0x44dd70[_0x07f6('0x53')])){this[_0x07f6('0x1e')][_0x44dd70['uniqueid']][_0x07f6('0x5c')]=_0x44dd70[_0x07f6('0x53')];this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0x07f6('0x5d')]=_0x44dd70[_0x07f6('0x55')];if(_0x44dd70[_0x07f6('0x53')]==='set'&&_['startsWith'](_0x44dd70[_0x07f6('0x55')],_0x07f6('0x5e'))){var _0x381fc5=_0x44dd70[_0x07f6('0x55')][_0x07f6('0x49')]('=');var _0xdb0009=_0x381fc5[0x0]['match'](/cdr\((.*)\)/);if(_0xdb0009){this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0xdb0009[0x1]]=_0x381fc5[0x1];}}else if(_0x44dd70['application']==='queue'){this[_0x07f6('0x1e')][_0x44dd70[_0x07f6('0x37')]][_0x07f6('0x11')]=_0x44dd70[_0x07f6('0x55')][_0x07f6('0x49')](',')[0x0];}}}}}catch(_0x41ca05){logger[_0x07f6('0x31')](_0x07f6('0x5f'),_0x44dd70[_0x07f6('0x37')],util['inspect'](_0x41ca05,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x60')]=function(_0x59a4b2){try{if(this[_0x07f6('0x3e')](_0x59a4b2)){logger['info'](_0x07f6('0x61'),_0x59a4b2[_0x07f6('0x37')],_0x59a4b2[_0x07f6('0x3a')],_0x59a4b2[_0x07f6('0x38')],_0x59a4b2[_0x07f6('0x62')]);logger[_0x07f6('0x39')](_0x07f6('0x63'),_0x59a4b2[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x59a4b2,{'showHidden':![],'depth':null}));if(_0x59a4b2[_0x07f6('0x37')]!==_0x59a4b2[_0x07f6('0x3a')]){if(this[_0x07f6('0x1e')][_0x59a4b2['linkedid']]){if(_0x59a4b2[_0x07f6('0x64')]==='6'){if(!this['channels'][_0x59a4b2[_0x07f6('0x3a')]]['answered']){var _0x405771=moment();this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x65')]=!![];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x66')]=_0x405771[_0x07f6('0x44')](_0x07f6('0x45'));if(this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x43')]){this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x67')]=_0x405771['diff'](this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x43')],_0x07f6('0x5a'));}}this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x3a')]=_0x59a4b2[_0x07f6('0x37')];if(_0x59a4b2[_0x07f6('0x62')]!==_0x07f6('0x68')){this[_0x07f6('0x1e')][_0x59a4b2['linkedid']][_0x07f6('0x69')]=_0x59a4b2[_0x07f6('0x62')];}this['channels'][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6a')]=_0x59a4b2[_0x07f6('0x38')];this['channels'][_0x59a4b2[_0x07f6('0x3a')]]['destinationchannel']=_0x59a4b2['channel'];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x46')]=dispositions[_[_0x07f6('0x47')](_0x59a4b2[_0x07f6('0x64')])];if(this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6b')]=this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['id'];this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x3a')]][_0x07f6('0x6c')]=this['agents'][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['name'];}}}}else{if(this[_0x07f6('0x1e')][_0x59a4b2[_0x07f6('0x37')]]){if(_0x59a4b2[_0x07f6('0x64')]==='6'){if(this[_0x07f6('0x1f')][_0x59a4b2['channel'][_0x07f6('0x49')]('-')[0x0]]){this[_0x07f6('0x1e')][_0x59a4b2['uniqueid']][_0x07f6('0x6b')]=this[_0x07f6('0x1f')][_0x59a4b2[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['id'];this[_0x07f6('0x1e')][_0x59a4b2['uniqueid']][_0x07f6('0x6c')]=this[_0x07f6('0x1f')][_0x59a4b2['channel']['split']('-')[0x0]]['name'];}}}}}}catch(_0xd8e624){logger[_0x07f6('0x31')](_0x07f6('0x6d'),_0x59a4b2[_0x07f6('0x37')],util['inspect'](_0xd8e624,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x6e')]=function(_0x39916b,_0x56cf2e){try{if(this[_0x07f6('0x1e')][_0x39916b]){logger[_0x07f6('0x2e')](_0x07f6('0x6f'),_0x39916b,_0x56cf2e);this[_0x07f6('0x1e')][_0x39916b][_0x07f6('0x70')]=!![];if(_[_0x07f6('0x71')](_0x56cf2e,'.wav49')){_0x56cf2e=_0x56cf2e[_0x07f6('0x72')]('.wav49',_0x07f6('0x73'));}this[_0x07f6('0x1e')][_0x39916b][_0x07f6('0x74')]=_0x56cf2e;var _0x16a691=_['find'](this['channels'][_0x39916b]['monitors'],{'filename':_0x56cf2e});if(_[_0x07f6('0x75')](_0x16a691)){this[_0x07f6('0x1e')][_0x39916b]['monitors'][_0x07f6('0x76')]({'filename':_0x56cf2e,'createdAt':moment()[_0x07f6('0x44')](_0x07f6('0x45')),'mixmonitorid':'','status':_0x07f6('0x77')});}}}catch(_0x4bbaf0){logger['error'](_0x07f6('0x78'),_0x39916b,util[_0x07f6('0x33')](_0x4bbaf0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x79')]=function(_0x232ea7){try{if(this[_0x07f6('0x3e')](_0x232ea7)){logger[_0x07f6('0x39')](_0x07f6('0x7a'),_0x232ea7[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x232ea7,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]&&_0x232ea7[_0x07f6('0x40')]!=_0x07f6('0x52')){if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')])){if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x7c')])){logger[_0x07f6('0x2e')](_0x07f6('0x7d'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x6e')](_0x232ea7['uniqueid'],_0x232ea7[_0x07f6('0x7e')]);}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')]['xmd-phone'])){logger[_0x07f6('0x2e')](_0x07f6('0x7f'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7['uniqueid']][_0x07f6('0x62')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x80')])){logger[_0x07f6('0x2e')](_0x07f6('0x81'),_0x232ea7['uniqueid'],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7[_0x07f6('0x37')]]['callerid']=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x82')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x83')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x84')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')][_0x07f6('0x49')](',')[0x0]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]['queue']=_0x232ea7[_0x07f6('0x7e')]['split'](',')[0x0];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x85')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this['channels'][_0x232ea7['uniqueid']][_0x07f6('0x86')]=_0x232ea7['value'];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')]['xmd-destination'])){logger[_0x07f6('0x2e')](_0x07f6('0x87'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x88')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x89')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7['uniqueid']][_0x07f6('0x8a')]=_0x232ea7[_0x07f6('0x7e')];}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x8b')])){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x232ea7[_0x07f6('0x37')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]][_0x07f6('0x11')]=_0x232ea7['value'];}else if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x8c')])){logger[_0x07f6('0x2e')](_0x07f6('0x8d'),_0x232ea7[_0x07f6('0x37')],_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x37')]]['sipcalluniqueid']=_0x232ea7[_0x07f6('0x7e')];}}}else if(this[_0x07f6('0x3e')](_0x232ea7[_0x07f6('0x7b')][_0x07f6('0x7c')])){if(_0x232ea7[_0x07f6('0x7e')]){var _0x316500=path['parse'](_0x232ea7[_0x07f6('0x7e')])['name'];logger[_0x07f6('0x2e')](_0x07f6('0x7d'),_0x316500,_0x232ea7[_0x07f6('0x7e')]);this[_0x07f6('0x6e')](_0x316500,_0x232ea7[_0x07f6('0x7e')]);}}else if(this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x3a')]]){if(this['isNotNull'](_0x232ea7[_0x07f6('0x7b')])){if(this[_0x07f6('0x3e')](_0x232ea7['variable'][_0x07f6('0x8c')])){logger['info'](_0x07f6('0x8d'),_0x232ea7[_0x07f6('0x3a')],_0x232ea7['value']);this[_0x07f6('0x1e')][_0x232ea7[_0x07f6('0x3a')]][_0x07f6('0x8e')]=_0x232ea7[_0x07f6('0x7e')];}}}}}catch(_0x3735f7){logger[_0x07f6('0x31')](_0x07f6('0x8f'),_0x232ea7[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x3735f7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x26')]=function(_0x54e90b){try{if(this[_0x07f6('0x3e')](_0x54e90b)){logger[_0x07f6('0x39')](_0x07f6('0x90'),_0x54e90b[_0x07f6('0x37')],util['inspect'](_0x54e90b,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]]){logger['info'](_0x07f6('0x91'),_0x54e90b[_0x07f6('0x37')],_0x54e90b['cause-txt']);var _0x35cca4=moment();this['channels'][_0x54e90b['uniqueid']]['endtime']=_0x35cca4[_0x07f6('0x44')](_0x07f6('0x45'));this['channels'][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x58')]=_0x35cca4['diff'](this[_0x07f6('0x1e')][_0x54e90b['uniqueid']]['starttime'],_0x07f6('0x5a'));if(this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x65')]){this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x92')]=_0x35cca4[_0x07f6('0x93')](this['channels'][_0x54e90b['uniqueid']]['answertime'],'seconds');this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x67')]=this[_0x07f6('0x1e')][_0x54e90b['uniqueid']][_0x07f6('0x58')]-this['channels'][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x92')];}if(_0x54e90b[_0x07f6('0x42')]===_0x07f6('0x48')){if(this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')]['split']('-')[0x0]]){this[_0x07f6('0x1f')][_0x54e90b['channel'][_0x07f6('0x49')]('-')[0x0]]=_[_0x07f6('0x94')](this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]],['destconnectedlinenum']);logger[_0x07f6('0x39')](_0x07f6('0x95'),_0x54e90b[_0x07f6('0x37')],util[_0x07f6('0x33')]({'destaccountcode':this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x07f6('0x4e')](util[_0x07f6('0x44')](_0x07f6('0x4f'),this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')]['split']('-')[0x0]][_0x07f6('0x96')]),'user:agentcomplete',{'destaccountcode':this[_0x07f6('0x1f')][_0x54e90b[_0x07f6('0x40')][_0x07f6('0x49')]('-')[0x0]]['accountcode']});}}if(_0x54e90b[_0x07f6('0x97')]===_0x07f6('0x98')){this[_0x07f6('0x99')][_0x54e90b['uniqueid']]=this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]];}else{if(this[_0x07f6('0x1e')][_0x54e90b['uniqueid']]['type']===_0x07f6('0x9a')&&this['blindTransfers'][_0x54e90b['uniqueid']]){this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x37')]=[this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x3a')],this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]][_0x07f6('0x3a')]=this['channels'][_0x54e90b[_0x07f6('0x37')]]['uniqueid']][0x0];delete this['blindTransfers'][_0x54e90b[_0x07f6('0x37')]];}}logger[_0x07f6('0x39')](_0x07f6('0x9b'),_0x54e90b[_0x07f6('0x37')],util[_0x07f6('0x33')](this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]],{'showHidden':![],'depth':null}));ami['emit'](_0x07f6('0x9c'),this['channels'][_0x54e90b[_0x07f6('0x37')]]);delete this[_0x07f6('0x1e')][_0x54e90b[_0x07f6('0x37')]];}}}catch(_0x585d86){logger[_0x07f6('0x31')](_0x07f6('0x9d'),_0x54e90b['uniqueid'],util['inspect'](_0x585d86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x07f6('0x9e')]=function(_0x1c02fe){try{if(this[_0x07f6('0x3e')](_0x1c02fe)){logger[_0x07f6('0x2e')](_0x07f6('0x9f'),_0x1c02fe[_0x07f6('0x37')],_0x1c02fe[_0x07f6('0xa0')],_0x1c02fe[_0x07f6('0xa1')]);logger[_0x07f6('0x39')](_0x07f6('0xa2'),_0x1c02fe['uniqueid'],util[_0x07f6('0x33')](_0x1c02fe,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c02fe[_0x07f6('0xa3')]]){this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa3')]]['transfercalleridnum']=_0x1c02fe[_0x07f6('0xa0')];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa3')]]['transferconnectedlinenum']=_0x1c02fe['transfertargetcalleridnum'];if(this['channels'][_0x1c02fe[_0x07f6('0xa4')]]){var _0x40f3b1=this['channels'][_0x1c02fe[_0x07f6('0xa4')]];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa4')]]=this[_0x07f6('0x1e')][_0x1c02fe['transfereeuniqueid']];this['channels'][_0x1c02fe[_0x07f6('0xa3')]]=_0x40f3b1;}}else if(this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']]){this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']][_0x07f6('0xa5')]=_0x1c02fe[_0x07f6('0xa0')];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa6')]]['transferconnectedlinenum']=_0x1c02fe[_0x07f6('0xa1')];if(this[_0x07f6('0x1e')][_0x1c02fe['origtransfereruniqueid']]){var _0x40f3b1=this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa7')]];this[_0x07f6('0x1e')][_0x1c02fe['origtransfereruniqueid']]=this[_0x07f6('0x1e')][_0x1c02fe['transfertargetuniqueid']];this[_0x07f6('0x1e')][_0x1c02fe[_0x07f6('0xa6')]]=_0x40f3b1;}}}}catch(_0x2743b6){logger[_0x07f6('0x31')](_0x07f6('0xa8'),_0x1c02fe[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x2743b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x2a')]=function(_0xf08ae3){try{if(this[_0x07f6('0x3e')](_0xf08ae3)){logger[_0x07f6('0x2e')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0xf08ae3[_0x07f6('0x37')],_0xf08ae3[_0x07f6('0xa9')],_0xf08ae3['extension']);logger[_0x07f6('0x39')](_0x07f6('0xaa'),_0xf08ae3[_0x07f6('0x37')],util[_0x07f6('0x33')](_0xf08ae3,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]]){this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]][_0x07f6('0xa5')]=_0xf08ae3[_0x07f6('0xa9')];this[_0x07f6('0x1e')][_0xf08ae3[_0x07f6('0xa3')]]['transferconnectedlinenum']=_0xf08ae3[_0x07f6('0xab')];this[_0x07f6('0x26')]({'event':_0x07f6('0x98'),'uniqueid':_0xf08ae3[_0x07f6('0xa3')],'context':_0xf08ae3[_0x07f6('0x42')],'channel':_0xf08ae3[_0x07f6('0xac')]});}}}catch(_0x596e66){logger['error'](_0x07f6('0xad'),_0xf08ae3['uniqueid'],util[_0x07f6('0x33')](_0x596e66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')]['syncMusicOnHoldStart']=function(_0x48b8cc){try{if(this[_0x07f6('0x3e')](_0x48b8cc)){logger['debug'](_0x07f6('0xae'),_0x48b8cc[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x48b8cc,{'showHidden':![],'depth':null}));if(this['channels'][_0x48b8cc[_0x07f6('0x37')]]){if(!_[_0x07f6('0x75')](this[_0x07f6('0x1e')][_0x48b8cc['uniqueid']][_0x07f6('0x66')])){this[_0x07f6('0x1e')][_0x48b8cc[_0x07f6('0x37')]][_0x07f6('0xaf')]=moment()[_0x07f6('0x44')](_0x07f6('0x45'));logger[_0x07f6('0x2e')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x48b8cc[_0x07f6('0x37')],this[_0x07f6('0x1e')][_0x48b8cc[_0x07f6('0x37')]][_0x07f6('0xaf')]);}}}}catch(_0x4eb8ee){logger[_0x07f6('0x31')](_0x07f6('0xb0'),_0x48b8cc[_0x07f6('0x37')],util[_0x07f6('0x33')](_0x4eb8ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x07f6('0x34')][_0x07f6('0x2d')]=function(_0x2a81de){try{if(this[_0x07f6('0x3e')](_0x2a81de)){logger[_0x07f6('0x39')](_0x07f6('0xb1'),_0x2a81de[_0x07f6('0x37')],util['inspect'](_0x2a81de,{'showHidden':![],'depth':null}));if(this[_0x07f6('0x1e')][_0x2a81de['uniqueid']]){if(!_[_0x07f6('0x75')](this['channels'][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xaf')])){this[_0x07f6('0x1e')][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xb2')]+=moment()[_0x07f6('0xb3')](0x0)['diff'](this[_0x07f6('0x1e')][_0x2a81de[_0x07f6('0x37')]][_0x07f6('0xaf')],_0x07f6('0x5a'));logger[_0x07f6('0x2e')](_0x07f6('0xb4'),_0x2a81de['uniqueid'],this[_0x07f6('0x1e')][_0x2a81de['uniqueid']]['mohtime']);delete this['channels'][_0x2a81de['uniqueid']][_0x07f6('0xaf')];}}}}catch(_0x46ca11){logger[_0x07f6('0x31')](_0x07f6('0xb5'),_0x2a81de['uniqueid'],util[_0x07f6('0x33')](_0x46ca11,{'showHidden':![],'depth':null}));}};module[_0x07f6('0xb6')]=VoiceCallReport; \ No newline at end of file +var _0x4421=['defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','split','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','appdata','applicationdata','subtract','duration','seconds','application','lastapplication','lastdata','startsWith','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','value','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','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','origtransferercalleridnum','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','inuse','invalid','ringing','ringinuse','onhold','set','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis'];(function(_0x2a12a4,_0x21ec2e){var _0x17b1fa=function(_0x509437){while(--_0x509437){_0x2a12a4['push'](_0x2a12a4['shift']());}};_0x17b1fa(++_0x21ec2e);}(_0x4421,0xa3));var _0x1442=function(_0xe171ab,_0x3b5ee1){_0xe171ab=_0xe171ab-0x0;var _0x17d4b9=_0x4421[_0xe171ab];return _0x17d4b9;};'use strict';var BPromise=require(_0x1442('0x0'));var _=require(_0x1442('0x1'));var moment=require(_0x1442('0x2'));var util=require(_0x1442('0x3'));var path=require('path');var Redis=require(_0x1442('0x4'));var config=require(_0x1442('0x5'));var logger=require(_0x1442('0x6'))(_0x1442('0x7'));var ami=require(_0x1442('0x8'));var Channel=require(_0x1442('0x9'));var statusDesc=['unknown','not_inuse',_0x1442('0xa'),'busy',_0x1442('0xb'),'unavailable',_0x1442('0xc'),_0x1442('0xd'),_0x1442('0xe')];var applications=[_0x1442('0xf'),'queue',_0x1442('0x10'),_0x1442('0x11'),'playback',_0x1442('0x12')];var dispositions=['NO\x20ANSWER',_0x1442('0x13'),_0x1442('0x13'),_0x1442('0x14'),_0x1442('0x14'),_0x1442('0x14'),_0x1442('0x15'),_0x1442('0x16'),_0x1442('0x13'),'FAILED',_0x1442('0x13')];var actions={};config[_0x1442('0x17')]=_[_0x1442('0x18')](config['redis'],{'host':_0x1442('0x19'),'port':0x18eb});var io=require(_0x1442('0x1a'))(new Redis(config[_0x1442('0x17')]));function VoiceCallReport(_0x454293){this[_0x1442('0x1b')]=_0x454293['channels'];this[_0x1442('0x1c')]=_0x454293[_0x1442('0x1c')];this['blindTransfers']={};ami['on'](_0x1442('0x1d'),this[_0x1442('0x1e')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x20'),this['syncNewExten'][_0x1442('0x1f')](this));ami['on'](_0x1442('0x21'),this[_0x1442('0x22')]['bind'](this));ami['on'](_0x1442('0x23'),this[_0x1442('0x24')]['bind'](this));ami['on'](_0x1442('0x25'),this['syncVarSet']['bind'](this));ami['on'](_0x1442('0x26'),this['syncHangup'][_0x1442('0x1f')](this));ami['on']('newcallerid',this[_0x1442('0x27')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x28'),this[_0x1442('0x29')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2a'),this['syncBlindTransfer'][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2b'),this[_0x1442('0x2c')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2d'),this[_0x1442('0x2e')][_0x1442('0x1f')](this));try{logger[_0x1442('0x2f')](_0x1442('0x30'));ami[_0x1442('0x31')]();}catch(_0xa8a818){logger[_0x1442('0x32')]('[voiceCallReport][coreshowchannels]',util[_0x1442('0x33')](_0xa8a818,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1442('0x34')][_0x1442('0x35')]=function(_0x1eab67){return _0x1eab67!==null&&!_[_0x1442('0x36')](_0x1eab67);};VoiceCallReport[_0x1442('0x34')][_0x1442('0x37')]=function(_0xec1fe0,_0x5022a2,_0x5b93da){io['to'](_0xec1fe0)[_0x1442('0x37')](_0x5022a2,_0x5b93da);};VoiceCallReport[_0x1442('0x34')][_0x1442('0x27')]=function(_0x37333b){try{if(this[_0x1442('0x35')](_0x37333b)){logger[_0x1442('0x2f')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x37333b['uniqueid'],_0x37333b[_0x1442('0x38')],_0x37333b[_0x1442('0x39')]);logger[_0x1442('0x3a')](_0x1442('0x3b'),_0x37333b[_0x1442('0x3c')],util['inspect'](_0x37333b,{'showHidden':![],'depth':null}));if(_0x37333b[_0x1442('0x3c')]===_0x37333b[_0x1442('0x3d')]){if(!_[_0x1442('0x36')](this['channels'][_0x37333b[_0x1442('0x3c')]])){_[_0x1442('0x3e')](this['channels'][_0x37333b[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x37333b,_[_0x1442('0x40')](this[_0x1442('0x1b')][_0x37333b[_0x1442('0x3c')]])));}}}}catch(_0x5f77ec){logger[_0x1442('0x32')](_0x1442('0x41'),_0x37333b['uniqueid'],util[_0x1442('0x33')](_0x5f77ec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncNewChannel']=function(_0x38ef2f){try{if(this[_0x1442('0x35')](_0x38ef2f)){logger[_0x1442('0x3a')](_0x1442('0x42'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')](_0x38ef2f,{'showHidden':![],'depth':null}));if(_0x38ef2f['uniqueid']===_0x38ef2f[_0x1442('0x3d')]&&_0x38ef2f[_0x1442('0x43')]!='OutgoingSpoolFailed'){if(_[_0x1442('0x36')](this['channels'][_0x38ef2f[_0x1442('0x3c')]])){logger[_0x1442('0x2f')](_0x1442('0x44'),_0x38ef2f[_0x1442('0x3c')],_0x38ef2f[_0x1442('0x45')],_0x38ef2f['exten']);this['channels'][_0x38ef2f[_0x1442('0x3c')]]=new Channel();this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]][_0x1442('0x46')]=moment()[_0x1442('0x47')](_0x1442('0x48'));this[_0x1442('0x1b')][_0x38ef2f['uniqueid']][_0x1442('0x49')]=dispositions[_['toNumber'](_0x38ef2f[_0x1442('0x4a')])];_[_0x1442('0x3e')](this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x38ef2f,_[_0x1442('0x40')](this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]])));if(_0x38ef2f['context']===_0x1442('0x4b')){if(this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')]['split']('-')[0x0]]['destconnectedlinenum']=_0x38ef2f[_0x1442('0x4d')];logger[_0x1442('0x3a')](_0x1442('0x4e'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')]({'destaccountcode':this['agents'][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x4f')],'destconnectedlinenum':_0x38ef2f[_0x1442('0x4d')]},{'showHidden':![],'depth':null}));this[_0x1442('0x37')](util[_0x1442('0x47')]('user:%s',this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x50')]),_0x1442('0x51'),{'destaccountcode':this['agents'][_0x38ef2f['channel'][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x4f')],'destconnectedlinenum':_0x38ef2f['exten']});}}}}}}catch(_0xe22a9f){logger[_0x1442('0x32')](_0x1442('0x52'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')](_0xe22a9f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x1e')]=function(_0x165766){try{if(this[_0x1442('0x35')](_0x165766)){logger[_0x1442('0x3a')](_0x1442('0x53'),_0x165766['uniqueid'],util[_0x1442('0x33')](_0x165766,{'showHidden':![],'depth':null}));if(_0x165766['uniqueid']===_0x165766['linkedid']&&_0x165766[_0x1442('0x4d')]!='h'&&_0x165766[_0x1442('0x43')]!='OutgoingSpoolFailed'){_0x165766['application']=_0x165766['application'][_0x1442('0x54')]();_0x165766['applicationdata']=(_0x165766[_0x1442('0x55')]||_0x165766[_0x1442('0x56')])[_0x1442('0x54')]();logger[_0x1442('0x2f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x165766[_0x1442('0x3c')],_0x165766['application'],_0x165766['applicationdata']);if(_[_0x1442('0x36')](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]])){this[_0x1442('0x1b')][_0x165766['uniqueid']]=new Channel();this['channels'][_0x165766[_0x1442('0x3c')]]['starttime']=_0x165766['duration']?moment()[_0x1442('0x57')](moment[_0x1442('0x58')](_0x165766['duration'])[_0x1442('0x59')](),_0x1442('0x59'))[_0x1442('0x47')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x1442('0x47')](_0x1442('0x48'));this['channels'][_0x165766[_0x1442('0x3c')]][_0x1442('0x49')]=_0x1442('0x14');}_[_0x1442('0x3e')](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x165766,_['keys'](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]])));if(_['includes'](applications,_0x165766[_0x1442('0x5a')])){this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]][_0x1442('0x5b')]=_0x165766[_0x1442('0x5a')];this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]][_0x1442('0x5c')]=_0x165766[_0x1442('0x56')];if(_0x165766[_0x1442('0x5a')]==='set'&&_[_0x1442('0x5d')](_0x165766[_0x1442('0x56')],'cdr(')){var _0x384f17=_0x165766[_0x1442('0x56')][_0x1442('0x4c')]('=');var _0x34b28c=_0x384f17[0x0][_0x1442('0x5e')](/cdr\((.*)\)/);if(_0x34b28c){this['channels'][_0x165766[_0x1442('0x3c')]][_0x34b28c[0x1]]=_0x384f17[0x1];}}else if(_0x165766['application']===_0x1442('0x5f')){this[_0x1442('0x1b')][_0x165766['uniqueid']][_0x1442('0x5f')]=_0x165766['applicationdata']['split'](',')[0x0];}}}}}catch(_0x137c75){logger[_0x1442('0x32')](_0x1442('0x60'),_0x165766['uniqueid'],util[_0x1442('0x33')](_0x137c75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncNewState']=function(_0x202707){try{if(this[_0x1442('0x35')](_0x202707)){logger[_0x1442('0x2f')](_0x1442('0x61'),_0x202707[_0x1442('0x3c')],_0x202707[_0x1442('0x3d')],_0x202707[_0x1442('0x38')],_0x202707[_0x1442('0x39')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x202707[_0x1442('0x3c')],util[_0x1442('0x33')](_0x202707,{'showHidden':![],'depth':null}));if(_0x202707[_0x1442('0x3c')]!==_0x202707[_0x1442('0x3d')]){if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]]){if(_0x202707['channelstate']==='6'){if(!this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x62')]){var _0x2fb5cc=moment();this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x62')]=!![];this[_0x1442('0x1b')][_0x202707['linkedid']][_0x1442('0x63')]=_0x2fb5cc['format'](_0x1442('0x48'));if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x46')]){this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x64')]=_0x2fb5cc[_0x1442('0x65')](this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x46')],_0x1442('0x59'));}}this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x3d')]=_0x202707['uniqueid'];if(_0x202707[_0x1442('0x39')]!==_0x1442('0x66')){this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x67')]=_0x202707['calleridnum'];}this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x68')]=_0x202707['calleridname'];this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x69')]=_0x202707[_0x1442('0x43')];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x49')]=dispositions[_[_0x1442('0x6a')](_0x202707[_0x1442('0x4a')])];if(this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x6b')]=this[_0x1442('0x1c')][_0x202707['channel'][_0x1442('0x4c')]('-')[0x0]]['id'];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x6c')]=this['agents'][_0x202707['channel']['split']('-')[0x0]][_0x1442('0x50')];}}}}else{if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]]){if(_0x202707[_0x1442('0x4a')]==='6'){if(this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]][_0x1442('0x6b')]=this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')]['split']('-')[0x0]]['id'];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]]['membername']=this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x50')];}}}}}}catch(_0x934809){logger[_0x1442('0x32')](_0x1442('0x6d'),_0x202707['uniqueid'],util[_0x1442('0x33')](_0x934809,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x6e')]=function(_0x2bde67,_0x15d4cc){try{if(this[_0x1442('0x1b')][_0x2bde67]){logger[_0x1442('0x2f')](_0x1442('0x6f'),_0x2bde67,_0x15d4cc);this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x70')]=!![];if(_['endsWith'](_0x15d4cc,_0x1442('0x71'))){_0x15d4cc=_0x15d4cc['replace']('.wav49','.WAV');}this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x72')]=_0x15d4cc;var _0x4bcabb=_[_0x1442('0x73')](this[_0x1442('0x1b')][_0x2bde67]['monitors'],{'filename':_0x15d4cc});if(_['isNil'](_0x4bcabb)){this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x74')][_0x1442('0x75')]({'filename':_0x15d4cc,'createdAt':moment()[_0x1442('0x47')](_0x1442('0x48')),'mixmonitorid':'','status':_0x1442('0x76')});}}}catch(_0x551ce4){logger[_0x1442('0x32')](_0x1442('0x77'),_0x2bde67,util[_0x1442('0x33')](_0x551ce4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x78')]=function(_0x4cfb7f){try{if(this[_0x1442('0x35')](_0x4cfb7f)){logger[_0x1442('0x3a')](_0x1442('0x79'),_0x4cfb7f['uniqueid'],util[_0x1442('0x33')](_0x4cfb7f,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']]&&_0x4cfb7f[_0x1442('0x43')]!=_0x1442('0x7a')){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')])){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7c')])){logger[_0x1442('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x6e')](_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7e')])){logger[_0x1442('0x2f')](_0x1442('0x7f'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x39')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x80')])){logger[_0x1442('0x2f')](_0x1442('0x81'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this['channels'][_0x4cfb7f['uniqueid']][_0x1442('0x82')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x83')])){logger[_0x1442('0x2f')](_0x1442('0x84'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x85')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x86')])){logger[_0x1442('0x2f')](_0x1442('0x87'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value'][_0x1442('0x4c')](',')[0x0]);this['channels'][_0x4cfb7f['uniqueid']][_0x1442('0x5f')]=_0x4cfb7f[_0x1442('0x7d')][_0x1442('0x4c')](',')[0x0];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x88')])){logger[_0x1442('0x2f')](_0x1442('0x89'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']][_0x1442('0x8a')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x8b')])){logger[_0x1442('0x2f')](_0x1442('0x8c'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x8d')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this['isNotNull'](_0x4cfb7f[_0x1442('0x7b')]['xmd-callerid-preview'])){logger['info'](_0x1442('0x8e'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x8f')]=_0x4cfb7f['value'];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')]['xmcs-queue'])){logger['info'](_0x1442('0x90'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']]['queue']=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable']['sipcallid'])){logger[_0x1442('0x2f')](_0x1442('0x91'),_0x4cfb7f['uniqueid'],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x92')]=_0x4cfb7f[_0x1442('0x7d')];}}}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7c')])){if(_0x4cfb7f['value']){var _0x47c0c6=path[_0x1442('0x93')](_0x4cfb7f['value'])[_0x1442('0x50')];logger[_0x1442('0x2f')](_0x1442('0x94'),_0x47c0c6,_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x6e')](_0x47c0c6,_0x4cfb7f[_0x1442('0x7d')]);}}else if(this['channels'][_0x4cfb7f[_0x1442('0x3d')]]){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')])){if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x95')])){logger[_0x1442('0x2f')](_0x1442('0x91'),_0x4cfb7f[_0x1442('0x3d')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f['linkedid']][_0x1442('0x96')]=_0x4cfb7f['value'];}}}}}catch(_0x25148c){logger[_0x1442('0x32')](_0x1442('0x97'),_0x4cfb7f[_0x1442('0x3c')],util[_0x1442('0x33')](_0x25148c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x98')]=function(_0x53add0){try{if(this['isNotNull'](_0x53add0)){logger[_0x1442('0x3a')]('[%s][voiceCallReport][hangup]\x20event:',_0x53add0[_0x1442('0x3c')],util[_0x1442('0x33')](_0x53add0,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]){logger[_0x1442('0x2f')](_0x1442('0x99'),_0x53add0['uniqueid'],_0x53add0['cause-txt']);var _0x433d50=moment();this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x9a')]=_0x433d50[_0x1442('0x47')](_0x1442('0x48'));this['channels'][_0x53add0[_0x1442('0x3c')]][_0x1442('0x58')]=_0x433d50[_0x1442('0x65')](this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x46')],_0x1442('0x59'));if(this['channels'][_0x53add0[_0x1442('0x3c')]]['answered']){this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x9b')]=_0x433d50[_0x1442('0x65')](this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x63')],_0x1442('0x59'));this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x64')]=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x58')]-this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x9b')];}if(_0x53add0[_0x1442('0x45')]==='from-sip'){if(this['agents'][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]=_[_0x1442('0x9c')](this['agents'][_0x53add0['channel'][_0x1442('0x4c')]('-')[0x0]],[_0x1442('0x9d')]);logger[_0x1442('0x3a')](_0x1442('0x9e'),_0x53add0[_0x1442('0x3c')],util['inspect']({'destaccountcode':this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x4f')]},{'showHidden':![],'depth':null}));this[_0x1442('0x37')](util[_0x1442('0x47')]('user:%s',this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x50')]),_0x1442('0x9f'),{'destaccountcode':this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x4f')]});}}if(_0x53add0[_0x1442('0xa0')]===_0x1442('0xa1')){this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]]=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]];}else{if(this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x85')]===_0x1442('0xa3')&&this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]]){this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x3c')]=[this['channels'][_0x53add0[_0x1442('0x3c')]][_0x1442('0x3d')],this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]['linkedid']=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]['uniqueid']][0x0];delete this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x53add0[_0x1442('0x3c')],util[_0x1442('0x33')](this['channels'][_0x53add0['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',this[_0x1442('0x1b')][_0x53add0['uniqueid']]);delete this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]];}}}catch(_0x26dbad){logger[_0x1442('0x32')](_0x1442('0xa4'),_0x53add0[_0x1442('0x3c')],util['inspect'](_0x26dbad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x29')]=function(_0x2eb40e){try{if(this['isNotNull'](_0x2eb40e)){logger['info'](_0x1442('0xa5'),_0x2eb40e[_0x1442('0x3c')],_0x2eb40e['origtransferercalleridnum'],_0x2eb40e[_0x1442('0xa6')]);logger[_0x1442('0x3a')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x2eb40e[_0x1442('0x3c')],util[_0x1442('0x33')](_0x2eb40e,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]]){this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]][_0x1442('0xa8')]=_0x2eb40e['origtransferercalleridnum'];this[_0x1442('0x1b')][_0x2eb40e['transfereeuniqueid']]['transferconnectedlinenum']=_0x2eb40e[_0x1442('0xa6')];if(this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa9')]]){var _0x16b055=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa9')]];this['channels'][_0x2eb40e[_0x1442('0xa9')]]=this[_0x1442('0x1b')][_0x2eb40e['transfereeuniqueid']];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]]=_0x16b055;}}else if(this[_0x1442('0x1b')][_0x2eb40e['transfertargetuniqueid']]){this[_0x1442('0x1b')][_0x2eb40e['transfertargetuniqueid']][_0x1442('0xa8')]=_0x2eb40e[_0x1442('0xaa')];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]][_0x1442('0xac')]=_0x2eb40e['transfertargetcalleridnum'];if(this[_0x1442('0x1b')][_0x2eb40e['origtransfereruniqueid']]){var _0x16b055=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xad')]];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xad')]]=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]]=_0x16b055;}}}}catch(_0x497eba){logger[_0x1442('0x32')]('[%s][voiceCallReport][attendedtransfer]',_0x2eb40e[_0x1442('0x3c')],util[_0x1442('0x33')](_0x497eba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0xae')]=function(_0x48e332){try{if(this['isNotNull'](_0x48e332)){logger[_0x1442('0x2f')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x48e332[_0x1442('0x3c')],_0x48e332[_0x1442('0xaf')],_0x48e332[_0x1442('0xb0')]);logger['debug']('[%s][voiceCallReport][blindtransfer]\x20event:',_0x48e332['uniqueid'],util[_0x1442('0x33')](_0x48e332,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x48e332[_0x1442('0xa7')]]){this['channels'][_0x48e332[_0x1442('0xa7')]]['transfercalleridnum']=_0x48e332[_0x1442('0xaf')];this[_0x1442('0x1b')][_0x48e332[_0x1442('0xa7')]]['transferconnectedlinenum']=_0x48e332[_0x1442('0xb0')];this[_0x1442('0x98')]({'event':_0x1442('0xa1'),'uniqueid':_0x48e332[_0x1442('0xa7')],'context':_0x48e332[_0x1442('0x45')],'channel':_0x48e332[_0x1442('0xb1')]});}}}catch(_0x1d5e77){logger[_0x1442('0x32')](_0x1442('0xb2'),_0x48e332[_0x1442('0x3c')],util[_0x1442('0x33')](_0x1d5e77,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncMusicOnHoldStart']=function(_0x39d630){try{if(this[_0x1442('0x35')](_0x39d630)){logger[_0x1442('0x3a')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x39d630['uniqueid'],util[_0x1442('0x33')](_0x39d630,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]]){if(!_[_0x1442('0xb3')](this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]][_0x1442('0x63')])){this['channels'][_0x39d630['uniqueid']]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1442('0x2f')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x39d630[_0x1442('0x3c')],this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]][_0x1442('0xb4')]);}}}}catch(_0x583c82){logger['error'](_0x1442('0xb5'),_0x39d630['uniqueid'],util[_0x1442('0x33')](_0x583c82,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncMusicOnHoldStop']=function(_0x343b19){try{if(this[_0x1442('0x35')](_0x343b19)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x343b19[_0x1442('0x3c')],util[_0x1442('0x33')](_0x343b19,{'showHidden':![],'depth':null}));if(this['channels'][_0x343b19['uniqueid']]){if(!_[_0x1442('0xb3')](this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')])){this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb6')]+=moment()[_0x1442('0xb7')](0x0)[_0x1442('0x65')](this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')],_0x1442('0x59'));logger['info'](_0x1442('0xb8'),_0x343b19['uniqueid'],this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]]['mohtime']);delete this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')];}}}}catch(_0x22fc80){logger['error'](_0x1442('0xb9'),_0x343b19[_0x1442('0x3c')],util[_0x1442('0x33')](_0x22fc80,{'showHidden':![],'depth':null}));}};module[_0x1442('0xba')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 62f3b81..0b1c1d7 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 _0xb477=['[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%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','destuniqueid','variables','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xb477,0x1be));var _0x7b47=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb477[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x7b47('0x0'));var moment=require(_0x7b47('0x1'));var util=require(_0x7b47('0x2'));var Redis=require(_0x7b47('0x3'));var config=require(_0x7b47('0x4'));var logger=require(_0x7b47('0x5'))('ami');var ami=require(_0x7b47('0x6'));config[_0x7b47('0x7')]=_[_0x7b47('0x8')](config[_0x7b47('0x7')],{'host':_0x7b47('0x9'),'port':0x18eb});var io=require(_0x7b47('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x3f499c){this['channels']=_0x3f499c[_0x7b47('0xb')];this['outbound']=_0x3f499c[_0x7b47('0xc')];this['variables']={};ami['on']('dialbegin',this[_0x7b47('0xd')][_0x7b47('0xe')](this));ami['on']('dialend',this[_0x7b47('0xf')]['bind'](this));ami['on'](_0x7b47('0x10'),this[_0x7b47('0x11')][_0x7b47('0xe')](this));ami['on'](_0x7b47('0x12'),this[_0x7b47('0x13')]['bind'](this));}VoiceDialReport[_0x7b47('0x14')]['isNotNull']=function(_0x54ef4d){return _0x54ef4d!==null&&!_[_0x7b47('0x15')](_0x54ef4d);};VoiceDialReport[_0x7b47('0x14')]['emit']=function(_0x47e52e,_0x46c44c,_0x31c182){io['to'](_0x47e52e)[_0x7b47('0x16')](_0x46c44c,_0x31c182);};VoiceDialReport[_0x7b47('0x14')]['syncDialBegin']=function(_0x2f6144){try{if(this[_0x7b47('0x17')](_0x2f6144)){logger[_0x7b47('0x18')](_0x7b47('0x19'),_0x2f6144['uniqueid'],util[_0x7b47('0x1a')](_0x2f6144,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]]){_['merge'](this['channels'][_0x2f6144['uniqueid']],{'starttime':moment()['format'](_0x7b47('0x1d')),'lastevent':'called','interface':_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x1f')](0x0,_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x20')]('-')),'membername':_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x1f')](_0x2f6144[_0x7b47('0x1e')]['lastIndexOf']('/')+0x1,_0x2f6144[_0x7b47('0x1e')][_0x7b47('0x20')]('-'))},_[_0x7b47('0x21')](_0x2f6144,['event',_0x7b47('0x22')]));logger[_0x7b47('0x23')](_0x7b47('0x24'),_0x2f6144['uniqueid'],this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]][_0x7b47('0x25')],this[_0x7b47('0x1b')][_0x2f6144['uniqueid']][_0x7b47('0x26')]);logger[_0x7b47('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2f6144[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')](_0x7b47('0x27'),_0x7b47('0x28'),this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x29'),_0x2f6144['uniqueid'],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x2f6144[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x2a'),this[_0x7b47('0x1b')][_0x2f6144['uniqueid']]);}}}catch(_0x3fa1a3){logger[_0x7b47('0x2b')](_0x7b47('0x2c'),_0x2f6144[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x3fa1a3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0xf')]=function(_0x13914c){try{if(this[_0x7b47('0x17')](_0x13914c)){logger[_0x7b47('0x18')](_0x7b47('0x2d'),_0x13914c[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x13914c,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x13914c['uniqueid']]){this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]['dialstatus']=_0x13914c['dialstatus'];if(_0x13914c[_0x7b47('0x2e')]===_0x7b47('0x2f')){this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x30')]=_0x13914c[_0x7b47('0x30')];this[_0x7b47('0x1b')][_0x13914c['uniqueid']][_0x7b47('0x31')]=_0x13914c[_0x7b47('0x31')];this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x32')]=moment()[_0x7b47('0x33')](_0x7b47('0x1d'));this['channels'][_0x13914c[_0x7b47('0x1c')]][_0x7b47('0x34')]=_0x7b47('0x35');logger['info'](_0x7b47('0x36'),_0x13914c[_0x7b47('0x1c')],_0x13914c[_0x7b47('0x1e')][_0x7b47('0x1f')](_0x13914c[_0x7b47('0x1e')][_0x7b47('0x20')]('/')+0x1,_0x13914c[_0x7b47('0x1e')][_0x7b47('0x20')]('-')));logger[_0x7b47('0x18')](_0x7b47('0x37'),_0x13914c[_0x7b47('0x1c')],util['inspect'](this[_0x7b47('0x1b')][_0x13914c['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x38'),this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]);}logger[_0x7b47('0x18')](_0x7b47('0x39'),_0x13914c[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')]('voice:outbound','voice_outbound_channel:save',this[_0x7b47('0x1b')][_0x13914c[_0x7b47('0x1c')]]);}}}catch(_0x4b66f0){logger['error'](_0x7b47('0x3a'),_0x13914c[_0x7b47('0x1c')],util['inspect'](_0x4b66f0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x11')]=function(_0x369a6){try{if(this[_0x7b47('0x17')](_0x369a6)){logger['debug'](_0x7b47('0x3b'),_0x369a6[_0x7b47('0x1c')],util['inspect'](_0x369a6,{'showHidden':![],'depth':null}));this[_0x7b47('0x3c')](_0x369a6[_0x7b47('0x1c')],_[_0x7b47('0x3d')](_0x369a6[_0x7b47('0x3e')])[0x0],_0x369a6[_0x7b47('0x3f')]);if(this['isNotNull'](_0x369a6[_0x7b47('0x3e')])&&this[_0x7b47('0x17')](_0x369a6[_0x7b47('0x3e')]['outboundrouteid'])){if(_[_0x7b47('0x15')](this[_0x7b47('0x1b')][_0x369a6['uniqueid']])){this['channels'][_0x369a6['uniqueid']]={'routeId':_0x369a6[_0x7b47('0x3f')],'variables':this['variables'][_0x369a6['uniqueid']]};logger['info'](_0x7b47('0x40'),_0x369a6[_0x7b47('0x1c')],_0x369a6[_0x7b47('0x3e')]['outboundrouteid'],_[_0x7b47('0x3d')](_0x369a6['variable'])[0x0],_0x369a6['value']);logger[_0x7b47('0x18')](_0x7b47('0x41'),_0x369a6['uniqueid'],util['inspect'](this[_0x7b47('0x1b')][_0x369a6[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b47('0x16')]('voice:outbound',_0x7b47('0x28'),this[_0x7b47('0x1b')][_0x369a6[_0x7b47('0x1c')]]);}}}}catch(_0x3c7b73){logger[_0x7b47('0x2b')](_0x7b47('0x42'),_0x369a6[_0x7b47('0x1c')],util[_0x7b47('0x1a')](_0x3c7b73,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x3c')]=function(_0x499cbf,_0x5dd2cb,_0x2f948b){var _0xaced59=[_0x7b47('0x43'),_0x7b47('0x44'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x7b47('0x45'),_0x7b47('0x46'),_0x7b47('0x47'),_0x7b47('0x48'),_0x7b47('0x49'),_0x7b47('0x4a'),_0x7b47('0x4b'),'bridgepvtcallid',_0x7b47('0x4c'),_0x7b47('0x4d'),_0x7b47('0x4e'),'memberlastcall',_0x7b47('0x25'),'memberpenalty',_0x7b47('0x4f')];if(!_[_0x7b47('0x50')](_0x5dd2cb)&&!_[_0x7b47('0x51')](_0xaced59,_0x5dd2cb)){if(_['isUndefined'](this['variables'][_0x499cbf])){this['variables'][_0x499cbf]={};}this['variables'][_0x499cbf][_0x5dd2cb]=_0x2f948b;}};VoiceDialReport[_0x7b47('0x14')][_0x7b47('0x13')]=function(_0x110891){try{if(this[_0x7b47('0x17')](_0x110891)){logger[_0x7b47('0x18')](_0x7b47('0x52'),_0x110891['uniqueid'],util[_0x7b47('0x1a')](_0x110891,{'showHidden':![],'depth':null}));if(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]){logger[_0x7b47('0x23')](_0x7b47('0x53'),_0x110891[_0x7b47('0x1c')],_0x110891[_0x7b47('0x54')]);this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x55')]=moment()[_0x7b47('0x33')](_0x7b47('0x1d'));this['channels'][_0x110891['uniqueid']][_0x7b47('0x56')]=moment(this['channels'][_0x110891[_0x7b47('0x1c')]]['endtime'])[_0x7b47('0x57')](this['channels'][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x58')],_0x7b47('0x59'));this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x34')]='complete';this[_0x7b47('0xc')][_0x7b47('0x5a')]+=0x1;if(this[_0x7b47('0x1b')][_0x110891['uniqueid']]['answertime']){this[_0x7b47('0xc')][_0x7b47('0x5b')]+=0x1;this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x5c')]=moment(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x32')])[_0x7b47('0x57')](this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]['starttime'],_0x7b47('0x59'));this['channels'][_0x110891['uniqueid']][_0x7b47('0x5d')]=moment(this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x55')])[_0x7b47('0x57')](this['channels'][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x32')],_0x7b47('0x59'));this['outbound'][_0x7b47('0x5e')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x5c')]||0x0;this['outbound'][_0x7b47('0x5f')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]['billableseconds'];}this[_0x7b47('0xc')][_0x7b47('0x60')]+=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]][_0x7b47('0x56')];logger['debug'](_0x7b47('0x61'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this['channels'][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b47('0x16')](_0x7b47('0x62'),this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x63'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]]);logger[_0x7b47('0x18')](_0x7b47('0x64'),_0x110891['uniqueid'],util['inspect'](this[_0x7b47('0x1b')][_0x110891['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x7b47('0x27'),'voice_outbound:save',this[_0x7b47('0xc')]);logger[_0x7b47('0x23')](_0x7b47('0x65'),JSON[_0x7b47('0x66')](this['channels'][_0x110891[_0x7b47('0x1c')]]));logger[_0x7b47('0x18')](_0x7b47('0x67'),_0x110891[_0x7b47('0x1c')],util[_0x7b47('0x1a')](this['channels'][_0x110891[_0x7b47('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x7b47('0x27'),_0x7b47('0x68'),this[_0x7b47('0x1b')][_0x110891['uniqueid']]);delete this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x1c')]];}else if(this['channels'][_0x110891[_0x7b47('0x69')]]){this[_0x7b47('0x1b')][_0x110891['linkedid']][_0x7b47('0x1c')]=this[_0x7b47('0x1b')][_0x110891[_0x7b47('0x69')]][_0x7b47('0x6a')];}if(this['variables'][_0x110891['uniqueid']]){delete this[_0x7b47('0x6b')][_0x110891[_0x7b47('0x1c')]];}}}catch(_0x51cd05){logger[_0x7b47('0x2b')]('[%s][voiceDialReport][hangup]',_0x110891[_0x7b47('0x1c')],util['inspect'](_0x51cd05,{'showHidden':![],'depth':null}));}};module[_0x7b47('0x6c')]=VoiceDialReport; \ No newline at end of file +var _0x1dca=['channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','variable','value','outboundrouteid','info','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','memberdynamic','memberinterface','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','answertime','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called'];(function(_0xda6d80,_0x29d67f){var _0x24e778=function(_0x1d5d5e){while(--_0x1d5d5e){_0xda6d80['push'](_0xda6d80['shift']());}};_0x24e778(++_0x29d67f);}(_0x1dca,0x17a));var _0xa1dc=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x1dca[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xa1dc('0x0'));var moment=require(_0xa1dc('0x1'));var util=require('util');var Redis=require(_0xa1dc('0x2'));var config=require(_0xa1dc('0x3'));var logger=require(_0xa1dc('0x4'))(_0xa1dc('0x5'));var ami=require(_0xa1dc('0x6'));config[_0xa1dc('0x7')]=_[_0xa1dc('0x8')](config[_0xa1dc('0x7')],{'host':_0xa1dc('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x6eda90){this[_0xa1dc('0xa')]=_0x6eda90[_0xa1dc('0xb')];this[_0xa1dc('0xc')]=_0x6eda90['outbound'];this[_0xa1dc('0xd')]={};ami['on'](_0xa1dc('0xe'),this[_0xa1dc('0xf')][_0xa1dc('0x10')](this));ami['on']('dialend',this[_0xa1dc('0x11')][_0xa1dc('0x10')](this));ami['on'](_0xa1dc('0x12'),this[_0xa1dc('0x13')][_0xa1dc('0x10')](this));ami['on'](_0xa1dc('0x14'),this[_0xa1dc('0x15')][_0xa1dc('0x10')](this));}VoiceDialReport['prototype'][_0xa1dc('0x16')]=function(_0x29f99c){return _0x29f99c!==null&&!_[_0xa1dc('0x17')](_0x29f99c);};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x19')]=function(_0x452b92,_0x458087,_0x1b7312){io['to'](_0x452b92)[_0xa1dc('0x19')](_0x458087,_0x1b7312);};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0xf')]=function(_0x49bd91){try{if(this['isNotNull'](_0x49bd91)){logger[_0xa1dc('0x1a')](_0xa1dc('0x1b'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x49bd91,{'showHidden':![],'depth':null}));if(this['channels'][_0x49bd91[_0xa1dc('0x1c')]]){_[_0xa1dc('0x1e')](this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]],{'starttime':moment()[_0xa1dc('0x1f')](_0xa1dc('0x20')),'lastevent':_0xa1dc('0x21'),'interface':_0x49bd91[_0xa1dc('0x22')]['substring'](0x0,_0x49bd91[_0xa1dc('0x22')]['lastIndexOf']('-')),'membername':_0x49bd91['channel'][_0xa1dc('0x23')](_0x49bd91['channel']['lastIndexOf']('/')+0x1,_0x49bd91['channel'][_0xa1dc('0x24')]('-'))},_[_0xa1dc('0x25')](_0x49bd91,[_0xa1dc('0x26'),_0xa1dc('0x27')]));logger['info'](_0xa1dc('0x28'),_0x49bd91[_0xa1dc('0x1c')],this[_0xa1dc('0xa')][_0x49bd91['uniqueid']][_0xa1dc('0x29')],this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]][_0xa1dc('0x2a')]);logger[_0xa1dc('0x1a')](_0xa1dc('0x2b'),_0x49bd91[_0xa1dc('0x1c')],util['inspect'](this['channels'][_0x49bd91[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),_0xa1dc('0x2d'),this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]]);logger[_0xa1dc('0x1a')](_0xa1dc('0x2e'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x2f'),this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]]);}}}catch(_0x146b93){logger[_0xa1dc('0x30')](_0xa1dc('0x31'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x146b93,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x11')]=function(_0x450953){try{if(this[_0xa1dc('0x16')](_0x450953)){logger['debug'](_0xa1dc('0x32'),_0x450953['uniqueid'],util[_0xa1dc('0x1d')](_0x450953,{'showHidden':![],'depth':null}));if(this['channels'][_0x450953[_0xa1dc('0x1c')]]){this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]['dialstatus']=_0x450953[_0xa1dc('0x33')];if(_0x450953['dialstatus']===_0xa1dc('0x34')){this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x35')]=_0x450953[_0xa1dc('0x35')];this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x36')]=_0x450953[_0xa1dc('0x36')];this['channels'][_0x450953[_0xa1dc('0x1c')]]['answertime']=moment()[_0xa1dc('0x1f')](_0xa1dc('0x20'));this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x37')]=_0xa1dc('0x38');logger['info'](_0xa1dc('0x39'),_0x450953[_0xa1dc('0x1c')],_0x450953[_0xa1dc('0x22')][_0xa1dc('0x23')](_0x450953[_0xa1dc('0x22')]['lastIndexOf']('/')+0x1,_0x450953[_0xa1dc('0x22')][_0xa1dc('0x24')]('-')));logger[_0xa1dc('0x1a')](_0xa1dc('0x3a'),_0x450953['uniqueid'],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x3b'),this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]);}logger[_0xa1dc('0x1a')](_0xa1dc('0x3c'),_0x450953[_0xa1dc('0x1c')],util['inspect'](this[_0xa1dc('0xa')][_0x450953['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),_0xa1dc('0x2d'),this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]);}}}catch(_0x35c7a7){logger[_0xa1dc('0x30')](_0xa1dc('0x3d'),_0x450953[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x35c7a7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x13')]=function(_0x512131){try{if(this[_0xa1dc('0x16')](_0x512131)){logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][varset]\x20event:',_0x512131[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x512131,{'showHidden':![],'depth':null}));this[_0xa1dc('0x3e')](_0x512131[_0xa1dc('0x1c')],_['keys'](_0x512131[_0xa1dc('0x3f')])[0x0],_0x512131[_0xa1dc('0x40')]);if(this[_0xa1dc('0x16')](_0x512131[_0xa1dc('0x3f')])&&this[_0xa1dc('0x16')](_0x512131['variable'][_0xa1dc('0x41')])){if(_[_0xa1dc('0x17')](this[_0xa1dc('0xa')][_0x512131[_0xa1dc('0x1c')]])){this[_0xa1dc('0xa')][_0x512131[_0xa1dc('0x1c')]]={'routeId':_0x512131[_0xa1dc('0x40')],'variables':this[_0xa1dc('0xd')][_0x512131[_0xa1dc('0x1c')]]};logger[_0xa1dc('0x42')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x512131[_0xa1dc('0x1c')],_0x512131['variable']['outboundrouteid'],_[_0xa1dc('0x43')](_0x512131[_0xa1dc('0x3f')])[0x0],_0x512131['value']);logger[_0xa1dc('0x1a')](_0xa1dc('0x44'),_0x512131[_0xa1dc('0x1c')],util['inspect'](this[_0xa1dc('0xa')][_0x512131['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x512131[_0xa1dc('0x1c')]]);}}}}catch(_0x562994){logger[_0xa1dc('0x30')](_0xa1dc('0x45'),_0x512131[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x562994,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')]['addVariable']=function(_0x3c1729,_0x256414,_0x59d7bd){var _0x360ea5=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xa1dc('0x46'),'rtpaudioqoslossbridged',_0xa1dc('0x47'),_0xa1dc('0x48'),_0xa1dc('0x49'),_0xa1dc('0x4a'),'bridgepeer','bridgepvtcallid','membercalls',_0xa1dc('0x4b'),_0xa1dc('0x4c'),'memberlastcall',_0xa1dc('0x29'),'memberpenalty',_0xa1dc('0x4d')];if(!_['isNil'](_0x256414)&&!_[_0xa1dc('0x4e')](_0x360ea5,_0x256414)){if(_[_0xa1dc('0x17')](this[_0xa1dc('0xd')][_0x3c1729])){this[_0xa1dc('0xd')][_0x3c1729]={};}this[_0xa1dc('0xd')][_0x3c1729][_0x256414]=_0x59d7bd;}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x15')]=function(_0x56ca63){try{if(this[_0xa1dc('0x16')](_0x56ca63)){logger[_0xa1dc('0x1a')](_0xa1dc('0x4f'),_0x56ca63['uniqueid'],util[_0xa1dc('0x1d')](_0x56ca63,{'showHidden':![],'depth':null}));if(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]){logger[_0xa1dc('0x42')](_0xa1dc('0x50'),_0x56ca63[_0xa1dc('0x1c')],_0x56ca63[_0xa1dc('0x51')]);this['channels'][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x52')]=moment()['format'](_0xa1dc('0x20'));this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x53')]=moment(this['channels'][_0x56ca63['uniqueid']]['endtime'])[_0xa1dc('0x54')](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x55')],_0xa1dc('0x56'));this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x37')]=_0xa1dc('0x57');this[_0xa1dc('0xc')][_0xa1dc('0x58')]+=0x1;if(this[_0xa1dc('0xa')][_0x56ca63['uniqueid']]['answertime']){this[_0xa1dc('0xc')][_0xa1dc('0x59')]+=0x1;this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['holdtime']=moment(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5a')])[_0xa1dc('0x54')](this['channels'][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x55')],_0xa1dc('0x56'));this['channels'][_0x56ca63[_0xa1dc('0x1c')]]['billableseconds']=moment(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['endtime'])['diff'](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5a')],'seconds');this[_0xa1dc('0xc')][_0xa1dc('0x5b')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5c')]||0x0;this[_0xa1dc('0xc')][_0xa1dc('0x5d')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['billableseconds'];}this[_0xa1dc('0xc')][_0xa1dc('0x5e')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['duration'];logger[_0xa1dc('0x1a')](_0xa1dc('0x5f'),_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this['channels'][_0x56ca63[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x60'),this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]);logger['debug'](_0xa1dc('0x61'),_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x56ca63['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x62'),this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]);logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x56ca63['uniqueid'],util[_0xa1dc('0x1d')](this['channels'][_0x56ca63['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),'voice_outbound:save',this[_0xa1dc('0xc')]);logger[_0xa1dc('0x42')](_0xa1dc('0x63'),JSON['stringify'](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]));logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),'voice_outbound_channel:remove',this[_0xa1dc('0xa')][_0x56ca63['uniqueid']]);delete this['channels'][_0x56ca63[_0xa1dc('0x1c')]];}else if(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x64')]]){this['channels'][_0x56ca63[_0xa1dc('0x64')]][_0xa1dc('0x1c')]=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x64')]][_0xa1dc('0x65')];}if(this[_0xa1dc('0xd')][_0x56ca63[_0xa1dc('0x1c')]]){delete this[_0xa1dc('0xd')][_0x56ca63[_0xa1dc('0x1c')]];}}}catch(_0xcc5126){logger[_0xa1dc('0x30')](_0xa1dc('0x66'),_0x56ca63[_0xa1dc('0x1c')],util['inspect'](_0xcc5126,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4486e3c..64cdf6b 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 _0x7269=['[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedIn','loggedin','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','membername','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','syncVarSet','addVariable','value','variable','queuestatus','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','diff','length','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','isNil','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','clearZombieChannels','switch','Action','status','channel','message','[%s][voiceQueueReport][checkChannel]','error','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','voice:queue:%s','name','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','emitVoiceQueueSummary','type','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','format','voice_queue:save','queues','then','catch'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x7269,0x76));var _0x9726=function(_0x2d30e1,_0x12d421){_0x2d30e1=_0x2d30e1-0x0;var _0x176f29=_0x7269[_0x2d30e1];return _0x176f29;};'use strict';var _=require(_0x9726('0x0'));var moment=require(_0x9726('0x1'));var util=require(_0x9726('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x9726('0x3'));var logger=require(_0x9726('0x4'))('ami');var ami=require(_0x9726('0x5'));var QueueReport=require(_0x9726('0x6'));config[_0x9726('0x7')]=_[_0x9726('0x8')](config[_0x9726('0x7')],{'host':_0x9726('0x9'),'port':0x18eb});var io=require(_0x9726('0xa'))(new Redis(config[_0x9726('0x7')]));var Sequence=function(){};Sequence[_0x9726('0xb')]['enqueue']=function(_0xcbdb72){this['tail']=this[_0x9726('0xc')]?this[_0x9726('0xc')][_0x9726('0xd')](_0xcbdb72):_0xcbdb72();};function VoiceQueueReport(_0x5b56ac){this[_0x9726('0xe')]=new Sequence();this[_0x9726('0xf')]={};this[_0x9726('0x10')]=_0x5b56ac['agents'];this[_0x9726('0x11')]=_0x5b56ac[_0x9726('0x12')];this[_0x9726('0x13')]=_0x5b56ac[_0x9726('0x13')];this[_0x9726('0x14')]=!![];this['campaigns']=_0x5b56ac['campaigns'];this[_0x9726('0x15')]={};ami['on'](_0x9726('0x16'),this['syncQueueSummary'][_0x9726('0x17')](this));ami['on'](_0x9726('0x18'),this[_0x9726('0x19')][_0x9726('0x17')](this));ami['on']('queuecallerjoin',this[_0x9726('0x1a')][_0x9726('0x17')](this));ami['on'](_0x9726('0x1b'),this[_0x9726('0x1c')][_0x9726('0x17')](this));ami['on'](_0x9726('0x1d'),this[_0x9726('0x1e')][_0x9726('0x17')](this));ami['on']('agentcomplete',this[_0x9726('0x1f')]['bind'](this));ami['on'](_0x9726('0x20'),this[_0x9726('0x21')][_0x9726('0x17')](this));ami['on'](_0x9726('0x22'),this['syncVarSet'][_0x9726('0x17')](this));ami['on'](_0x9726('0x23'),this[_0x9726('0x24')][_0x9726('0x17')](this));ami['on']('fullybooted',this[_0x9726('0x25')][_0x9726('0x17')](this));ami['on']('musiconholdstart',this[_0x9726('0x26')][_0x9726('0x17')](this));ami['on'](_0x9726('0x27'),this[_0x9726('0x28')]['bind'](this));ami['on'](_0x9726('0x29'),this[_0x9726('0x2a')][_0x9726('0x17')](this));ami['on'](_0x9726('0x2b'),this['syncBlindTransfer'][_0x9726('0x17')](this));this[_0x9726('0x2c')]();this[_0x9726('0x2d')]();}function clearChannels(_0x39e8f6){if(!_[_0x9726('0x2e')](_0x39e8f6)){for(var _0x2d19e9 in _0x39e8f6){if(_0x39e8f6[_0x9726('0x2f')](_0x2d19e9)){delete _0x39e8f6[_0x2d19e9];}}}}function clearCampaigns(_0x13ccae){if(!_[_0x9726('0x2e')](_0x13ccae)){for(var _0x48b018 in _0x13ccae){if(_0x13ccae[_0x9726('0x2f')](_0x48b018)){_0x13ccae[_0x48b018]['originated']=0x0;}}}}function clearVoiceQueues(_0xe74b18){if(!_[_0x9726('0x2e')](_0xe74b18)){for(var _0xe65804 in _0xe74b18){if(_0xe74b18[_0x9726('0x2f')](_0xe65804)){_0xe74b18[_0xe65804][_0x9726('0x30')]=0x0;_0xe74b18[_0xe65804][_0x9726('0x31')]=0x0;_0xe74b18[_0xe65804][_0x9726('0x32')]=0x0;_0xe74b18[_0xe65804][_0x9726('0x33')]=0x0;_0xe74b18[_0xe65804]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x5cc55b){if(!_['isEmpty'](_0x5cc55b)){for(var _0x79ea9 in _0x5cc55b){if(_0x5cc55b[_0x9726('0x2f')](_0x79ea9)){_0x5cc55b[_0x79ea9][_0x9726('0x34')]=!![];}}}}VoiceQueueReport[_0x9726('0xb')][_0x9726('0x35')]=function(){var _0x5f1a35=this;for(var _0xebbd2d in this[_0x9726('0x11')]){if(this['channels'][_0x9726('0x2f')](_0xebbd2d)&&!this['channels'][_0xebbd2d][_0x9726('0x36')]){this[_0x9726('0xe')]['enqueue'](function(){if(!_['isNil'](_0x5f1a35[_0x9726('0x11')][_0xebbd2d])){return ami[_0x9726('0x37')]({'action':_0x9726('0x38'),'channel':_0x5f1a35[_0x9726('0x11')][_0xebbd2d][_0x9726('0x39')]})['catch'](function(_0xbe9153){if(_0xbe9153[_0x9726('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5f1a35['channels'][_0xebbd2d]){delete _0x5f1a35[_0x9726('0x11')][_0xebbd2d];logger['error'](_0x9726('0x3b'),_0xebbd2d,util['inspect'](_0xbe9153,{'showHidden':![],'depth':null}));}if(_0x5f1a35['queueReports'][_0xebbd2d]){delete _0x5f1a35[_0x9726('0xf')][_0xebbd2d];logger[_0x9726('0x3c')](_0x9726('0x3d'),_0xebbd2d,util[_0x9726('0x3e')](_0xbe9153,{'showHidden':![],'depth':null}));}if(_0x5f1a35[_0x9726('0x15')][_0xebbd2d]){delete _0x5f1a35[_0x9726('0x15')][_0xebbd2d];logger[_0x9726('0x3c')]('[%s][voiceQueueReport][checkVariables]',_0xebbd2d,util['inspect'](_0xbe9153,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9726('0x25')]=function(){logger[_0x9726('0x3c')](_0x9726('0x3f'));clearChannels(this['channels']);this[_0x9726('0x40')](this[_0x9726('0xf')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x9726('0x13')]);clearCampaigns(this[_0x9726('0x41')]);};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x40')]=function(_0x273145){var _0x17c157=this;if(!_[_0x9726('0x2e')](_0x273145)){for(var _0x50f3f0 in _0x273145){if(_0x273145[_0x9726('0x2f')](_0x50f3f0)){_0x17c157[_0x9726('0x42')](_0x273145[_0x50f3f0],_0x9726('0x43'));delete _0x273145[_0x50f3f0];}}}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x44')]=function(_0x5f1740,_0x12a9ef,_0x11020c){io['to'](_0x5f1740)[_0x9726('0x44')](_0x12a9ef,_0x11020c);};VoiceQueueReport['prototype'][_0x9726('0x45')]=function(_0x2dba54,_0x21ee67){logger[_0x9726('0x46')](_0x9726('0x47')+_0x21ee67+_0x9726('0x48'),_0x2dba54['uniqueid'],util[_0x9726('0x3e')](_0x2dba54,{'showHidden':![],'depth':null}));this[_0x9726('0x44')](util['format'](_0x9726('0x49'),_0x2dba54[_0x9726('0x4a')]),_0x9726('0x4b'),_0x2dba54);};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x42')]=function(_0x3895ca,_0x3bc83b){logger[_0x9726('0x46')](_0x9726('0x47')+_0x3bc83b+_0x9726('0x4c'),_0x3895ca[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x3895ca,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x9726('0x49'),_0x3895ca[_0x9726('0x4a')]),_0x9726('0x4e'),_0x3895ca);};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x4f')]=function(_0xfeb030,_0x326700){if(_0xfeb030[_0x9726('0x50')]==='inbound'){var _0x43ecd6={'id':_0xfeb030['id'],'name':_0xfeb030['name'],'strategy':_0xfeb030[_0x9726('0x51')],'answered':_0xfeb030[_0x9726('0x52')],'available':_0xfeb030[_0x9726('0x53')],'loggedIn':_0xfeb030['loggedIn'],'pTalking':_0xfeb030[_0x9726('0x32')],'sumBillable':_0xfeb030[_0x9726('0x54')],'sumDuration':_0xfeb030[_0x9726('0x55')],'sumHoldTime':_0xfeb030[_0x9726('0x56')]||0x0,'talking':_0xfeb030[_0x9726('0x31')],'total':_0xfeb030[_0x9726('0x57')],'type':_0xfeb030[_0x9726('0x50')],'unmanaged':_0xfeb030[_0x9726('0x58')],'abandoned':_0xfeb030[_0x9726('0x59')],'waiting':_0xfeb030[_0x9726('0x33')]};if(_0xfeb030[_0x9726('0x5a')]){_0x43ecd6['Trunk']={'id':_0xfeb030['Trunk']['id'],'name':_0xfeb030[_0x9726('0x5a')][_0x9726('0x4a')],'active':_0xfeb030[_0x9726('0x5a')][_0x9726('0x5b')],'callerid':_0xfeb030['Trunk']['callerid']};}if(_0xfeb030[_0x9726('0x5c')]){_0x43ecd6[_0x9726('0x5c')]={'id':_0xfeb030['Interval']['id'],'name':_0xfeb030[_0x9726('0x5c')][_0x9726('0x4a')]};}var _0x393106=md5(JSON[_0x9726('0x5d')](_0x43ecd6));if(_0xfeb030[_0x9726('0x5e')]!==_0x393106){_0xfeb030[_0x9726('0x5e')]=_0x393106;logger[_0x9726('0x46')](_0x9726('0x5f')+_0x326700+_0x9726('0x60'),util['inspect'](_0x43ecd6,{'showHidden':![],'depth':null}));this[_0x9726('0x44')](util[_0x9726('0x61')](_0x9726('0x49'),_0x43ecd6[_0x9726('0x4a')]),_0x9726('0x62'),_0x43ecd6);}}};VoiceQueueReport[_0x9726('0xb')]['isNotNull']=function(_0x14af0b){return _0x14af0b!==null&&!_['isUndefined'](_0x14af0b);};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x2d')]=function(){var _0x551cc8=this;setInterval(function(){_0x551cc8[_0x9726('0x35')]();ami[_0x9726('0x37')]({'action':_0x9726('0x63')})['catch'](function(_0x3c7756){logger[_0x9726('0x3c')]('[voiceQueueReport][queues]',util[_0x9726('0x3e')](_0x3c7756,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x2c')]=function(){var _0x35728d=this;setInterval(function(){if(_0x35728d[_0x9726('0x14')]){return ami['Action']({'action':_0x9726('0x16')})[_0x9726('0x64')](function(_0x3be245){_0x35728d[_0x9726('0x14')]=![];})[_0x9726('0x65')](function(_0x26f27e){logger[_0x9726('0x3c')](_0x9726('0x66'),util[_0x9726('0x3e')](_0x26f27e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x9726('0x67')]=function(_0x97f9f7){try{if(this[_0x9726('0x68')](_0x97f9f7)&&this[_0x9726('0x68')](_0x97f9f7[_0x9726('0x69')])){logger[_0x9726('0x46')](_0x9726('0x6a'),util['inspect'](_0x97f9f7,{'showHidden':![],'depth':null}));if(this[_0x9726('0x13')][_0x97f9f7['queue']]){logger['info'](_0x9726('0x6b'),_0x97f9f7['queue']);var _0x5a3135=_[_0x9726('0x6c')](this['channels'],_0x9726('0x69'))[_0x97f9f7['queue']]||0x0;var _0x299710=_0x5a3135-_0x97f9f7[_0x9726('0x6d')];if(this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x33')]!==_[_0x9726('0x6e')](_0x97f9f7[_0x9726('0x6d')])||this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x6f')]!==_[_0x9726('0x6e')](_0x97f9f7[_0x9726('0x70')])||this[_0x9726('0x13')][_0x97f9f7['queue']]['available']!==_[_0x9726('0x6e')](_0x97f9f7['available'])||this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]]['talking']!==_0x299710){this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]]['waiting']=_['toNumber'](_0x97f9f7[_0x9726('0x6d')]);this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x6f')]=_[_0x9726('0x6e')](_0x97f9f7[_0x9726('0x70')]);this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x53')]=_[_0x9726('0x6e')](_0x97f9f7['available']);this['voiceQueues'][_0x97f9f7['queue']][_0x9726('0x31')]=_0x299710>0x0?_0x299710:0x0;this['voiceQueues'][_0x97f9f7['queue']][_0x9726('0x31')]=this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x31')]>_[_0x9726('0x6e')](_0x97f9f7['loggedin'])?_[_0x9726('0x6e')](_0x97f9f7[_0x9726('0x70')]):this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]][_0x9726('0x31')];this[_0x9726('0x4f')](this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]],_0x9726('0x16'));}logger[_0x9726('0x46')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0x9726('0x13')][_0x97f9f7[_0x9726('0x69')]],{'showHidden':![],'depth':null}));ami[_0x9726('0x44')]('custom:queuesummary',this['voiceQueues'][_0x97f9f7[_0x9726('0x69')]]);}}}catch(_0xf0c2a3){logger['error'](_0x9726('0x66'),util[_0x9726('0x3e')](_0xf0c2a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x19')]=function(_0x50679b){logger[_0x9726('0x46')](_0x9726('0x71'),util[_0x9726('0x3e')](_0x50679b,{'showHidden':![],'depth':null}));this[_0x9726('0x14')]=!![];};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x1a')]=function(_0x322c77){try{if(this[_0x9726('0x68')](_0x322c77)){logger[_0x9726('0x46')](_0x9726('0x72'),_0x322c77[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x322c77,{'showHidden':![],'depth':null}));if(_[_0x9726('0x73')](this['queueReports'][_0x322c77[_0x9726('0x4d')]])){this[_0x9726('0xf')][_0x322c77[_0x9726('0x4d')]]=[];this[_0x9726('0x11')][_0x322c77[_0x9726('0x4d')]]={};}var _0x3fd95f=new QueueReport();_0x3fd95f[_0x9726('0x4a')]=_0x322c77['queue'];_0x3fd95f[_0x9726('0x50')]=this[_0x9726('0x13')][_0x3fd95f[_0x9726('0x4a')]]&&this['voiceQueues'][_0x3fd95f[_0x9726('0x4a')]][_0x9726('0x50')]?this['voiceQueues'][_0x3fd95f[_0x9726('0x4a')]][_0x9726('0x50')]||'inbound':'inbound';_0x3fd95f['queue']=_0x322c77[_0x9726('0x69')];_0x3fd95f[_0x9726('0x74')]=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x3fd95f[_0x9726('0x76')]=_0x322c77[_0x9726('0x76')];_0x3fd95f['count']=_0x322c77[_0x9726('0x77')];_0x3fd95f[_0x9726('0x4d')]=_0x322c77[_0x9726('0x4d')];logger[_0x9726('0x78')](_0x9726('0x79'),_0x3fd95f[_0x9726('0x4a')],_0x3fd95f[_0x9726('0x50')]);_[_0x9726('0x7a')](_0x3fd95f,_[_0x9726('0x7b')](_0x322c77,_[_0x9726('0x7c')](_0x3fd95f)));this[_0x9726('0xf')][_0x322c77[_0x9726('0x4d')]][_0x9726('0x7d')](_0x3fd95f);this['channels'][_0x322c77['uniqueid']]=_0x3fd95f;this[_0x9726('0x45')](_0x3fd95f,'queuecallerjoin');}}catch(_0x24e5be){logger[_0x9726('0x3c')](_0x9726('0x72'),_0x322c77[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x24e5be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0x1c')]=function(_0x4badff){try{if(this[_0x9726('0x68')](_0x4badff)){logger[_0x9726('0x46')](_0x9726('0x7e'),_0x4badff[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x4badff,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x4badff['uniqueid']]){var _0x4853de=_[_0x9726('0x7f')](this['queueReports'][_0x4badff[_0x9726('0x4d')]]);_0x4853de[_0x9726('0x80')]=![];_0x4853de['queuecallercompleteAt']=null;_0x4853de['holdtime']=_0x4badff[_0x9726('0x81')];_0x4853de[_0x9726('0x82')]=_0x4badff[_0x9726('0x82')];_0x4853de[_0x9726('0x1b')]=!![];_0x4853de['queuecallerabandonAt']=moment()['format'](_0x9726('0x75'));_0x4853de[_0x9726('0x83')]='ABANDONED';_0x4853de[_0x9726('0x84')]=null;logger[_0x9726('0x78')](_0x9726('0x85'),_0x4853de['name'],_0x4853de[_0x9726('0x50')]);this[_0x9726('0x11')][_0x4badff[_0x9726('0x4d')]]=_0x4853de;this['emitVoiceQueueChannelRemove'](_0x4853de,'queuecallerabandon');}}}catch(_0x5b4b9e){logger[_0x9726('0x3c')](_0x9726('0x7e'),_0x4badff[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x5b4b9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0x1e')]=function(_0x30389e){try{if(this[_0x9726('0x68')](_0x30389e)){logger['debug'](_0x9726('0x86'),_0x30389e[_0x9726('0x4d')],util['inspect'](_0x30389e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30389e['uniqueid']]){var _0x355c21=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x30389e[_0x9726('0x4d')]]);_0x355c21[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));_0x355c21[_0x9726('0x88')]=_0x30389e['connectedlinenum'];_0x355c21['connectedlinename']=_0x30389e[_0x9726('0x89')];logger['info'](_0x9726('0x8a'),_0x355c21[_0x9726('0x4a')],_0x355c21[_0x9726('0x50')],_0x30389e[_0x9726('0x88')],_0x30389e[_0x9726('0x89')]);this[_0x9726('0x11')][_0x30389e[_0x9726('0x4d')]]=_0x355c21;this[_0x9726('0x45')](_0x355c21,'queuecallerleave');}}}catch(_0x122e71){logger[_0x9726('0x3c')](_0x9726('0x86'),_0x30389e[_0x9726('0x4d')],util['inspect'](_0x122e71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x21')]=function(_0x2463e4){try{if(this[_0x9726('0x68')](_0x2463e4)){logger[_0x9726('0x46')](_0x9726('0x8b'),_0x2463e4['uniqueid'],util['inspect'](_0x2463e4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2463e4[_0x9726('0x4d')]]){var _0xd556cd=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x2463e4[_0x9726('0x4d')]]);_0xd556cd['queuecallercomplete']=!![];_0xd556cd[_0x9726('0x83')]='COMPLETEDBYAGENT';logger[_0x9726('0x78')](_0x9726('0x8c'),_0xd556cd['name'],_0xd556cd['type']);}}}catch(_0x37f9b3){logger[_0x9726('0x3c')](_0x9726('0x8b'),_0x2463e4[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x37f9b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x1f')]=function(_0x463db1){try{if(this[_0x9726('0x68')](_0x463db1)){logger[_0x9726('0x46')](_0x9726('0x8d'),_0x463db1['uniqueid'],util[_0x9726('0x3e')](_0x463db1,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x463db1['uniqueid']]){var _0x3c90b9=_['last'](this[_0x9726('0xf')][_0x463db1[_0x9726('0x4d')]]);_0x3c90b9[_0x9726('0x1b')]=![];_0x3c90b9[_0x9726('0x8e')]=null;_0x3c90b9['assigned']=!![];_0x3c90b9[_0x9726('0x84')]=_0x463db1[_0x9726('0x8f')];_0x3c90b9[_0x9726('0x81')]=_0x463db1[_0x9726('0x81')];_0x3c90b9[_0x9726('0x80')]=!![];_0x3c90b9[_0x9726('0x90')]=![];_0x3c90b9[_0x9726('0x91')]=null;if(!_0x3c90b9['transfer']){if(_0x463db1[_0x9726('0x92')]==_0x9726('0x93')){_0x3c90b9['queuecallerexitreason']=_0x9726('0x94');logger[_0x9726('0x78')](_0x9726('0x95'),_0x3c90b9[_0x9726('0x4a')],_0x3c90b9[_0x9726('0x50')]);}else{if(_[_0x9726('0x96')](_0x463db1[_0x9726('0x39')]['toLowerCase'](),_0x9726('0x97'))){if(this['queueReports'][_0x463db1[_0x9726('0x98')]]){var _0x288d52=_[_0x9726('0x7f')](this[_0x9726('0xf')][_0x463db1[_0x9726('0x98')]]);_0x288d52[_0x9726('0x80')]=![];_0x288d52[_0x9726('0x90')]=!![];_0x288d52['queuecallerexitAt']=moment(_0x3c90b9['queuecallerjoinAt'])[_0x9726('0x99')](_0x463db1['holdtime'],_0x9726('0x9a'))[_0x9726('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x288d52[_0x9726('0x83')]=_0x9726('0x9b');_0x288d52[_0x9726('0x93')]=!![];_0x288d52[_0x9726('0x9c')]='FORWARD';_0x288d52[_0x9726('0x9d')]=_0x463db1[_0x9726('0x9e')];_0x288d52[_0x9726('0x9f')]=_0x463db1[_0x9726('0x4d')];logger[_0x9726('0x78')](_0x9726('0xa0'),_0x288d52[_0x9726('0x4a')],_0x288d52['type']);var _0x53a094=this['queueReports'][_0x463db1[_0x9726('0x98')]];this[_0x9726('0xf')][_0x463db1[_0x9726('0x98')]]=this[_0x9726('0xf')][_0x463db1['uniqueid']];this[_0x9726('0xf')][_0x463db1[_0x9726('0x4d')]]=_0x53a094;}}else{_0x3c90b9['queuecallerexitreason']='COMPLETEDBY'+_0x463db1[_0x9726('0x92')][_0x9726('0xa1')]();logger[_0x9726('0x78')](_0x9726('0xa2'),_0x3c90b9[_0x9726('0x4a')],_0x3c90b9[_0x9726('0x50')],_0x3c90b9[_0x9726('0x83')]);}}}this[_0x9726('0x11')][_0x463db1['uniqueid']]=_0x3c90b9;this[_0x9726('0x42')](_0x3c90b9,_0x9726('0xa3'));}}}catch(_0x45c71a){logger[_0x9726('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x463db1['uniqueid'],util[_0x9726('0x3e')](_0x45c71a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9726('0xa4')]=function(_0x454d6a){try{if(this[_0x9726('0x68')](_0x454d6a)){logger['debug']('[%s][voiceQueueReport][varset]',_0x454d6a[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x454d6a,{'showHidden':![],'depth':null}));this[_0x9726('0xa5')](_0x454d6a[_0x9726('0x4d')],_['keys'](_0x454d6a['variable'])[0x0],_0x454d6a[_0x9726('0xa6')]);if(this['queueReports'][_0x454d6a[_0x9726('0x4d')]]){var _0x5cc265=_['last'](this[_0x9726('0xf')][_0x454d6a[_0x9726('0x4d')]]);if(_0x5cc265){if(this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')])&&this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')][_0x9726('0xa8')])){switch(_0x454d6a[_0x9726('0xa6')]){case'CONTINUE':_0x5cc265[_0x9726('0x90')]=![];_0x5cc265[_0x9726('0x91')]=null;break;case _0x9726('0xa9'):_0x5cc265[_0x9726('0xaa')]='timeout';_0x5cc265['queuecallerexit']=!![];_0x5cc265[_0x9726('0x91')]=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x5cc265[_0x9726('0x87')]=moment()[_0x9726('0x61')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x9726('0xab'),_0x454d6a['uniqueid'],util['inspect'](_0x5cc265,{'showHidden':![],'depth':null}));ami[_0x9726('0x44')](_0x9726('0xac'),_0x5cc265);break;default:_0x5cc265[_0x9726('0x90')]=!![];_0x5cc265[_0x9726('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5cc265[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));}_0x5cc265[_0x9726('0x1b')]=![];_0x5cc265[_0x9726('0x8e')]=null;_0x5cc265[_0x9726('0x83')]=_0x454d6a[_0x9726('0xa6')];this[_0x9726('0x11')][_0x454d6a[_0x9726('0x4d')]]=_0x5cc265;this[_0x9726('0x42')](_0x5cc265,_0x9726('0x22'));}else if(this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')])&&this[_0x9726('0x68')](_0x454d6a[_0x9726('0xa7')]['queueposition'])){if(!_0x5cc265['queuecallerabandon']){_0x5cc265[_0x9726('0x90')]=!![];_0x5cc265['queuecallerexitAt']=moment()[_0x9726('0x61')](_0x9726('0x75'));_0x5cc265[_0x9726('0x83')]=_0x9726('0xad');_0x5cc265[_0x9726('0x87')]=moment()['format'](_0x9726('0x75'));this['channels'][_0x454d6a['uniqueid']]=_0x5cc265;}}logger[_0x9726('0x78')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x454d6a[_0x9726('0x4d')],_0x5cc265[_0x9726('0x4a')],_0x5cc265[_0x9726('0x50')],_[_0x9726('0x7c')](_0x454d6a[_0x9726('0xa7')])[0x0],_0x454d6a[_0x9726('0xa6')]);_0x5cc265[_0x9726('0x15')]=this['variables'][_0x454d6a['uniqueid']];}}}}catch(_0x410583){logger[_0x9726('0x3c')]('[%s][voiceQueueReport][varset]',_0x454d6a[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x410583,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0xa5')]=function(_0x56df7d,_0x153dd9,_0x5e76aa){var _0x5e68f0=['rtpaudioqos',_0x9726('0xae'),'rtpaudioqosjitter',_0x9726('0xaf'),'rtpaudioqosloss',_0x9726('0xb0'),'rtpaudioqosrtt',_0x9726('0xb1'),_0x9726('0xb2'),_0x9726('0xb3'),_0x9726('0xb4'),_0x9726('0xb5'),_0x9726('0xb6'),_0x9726('0xb7'),_0x9726('0xb8'),_0x9726('0xb9'),_0x9726('0x8f'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x153dd9)&&!_['includes'](_0x5e68f0,_0x153dd9)){if(_[_0x9726('0x73')](this[_0x9726('0x15')][_0x56df7d])){this[_0x9726('0x15')][_0x56df7d]={};}this[_0x9726('0x15')][_0x56df7d][_0x153dd9]=_0x5e76aa;}};VoiceQueueReport[_0x9726('0xb')][_0x9726('0x24')]=function(_0x5cf2d7){try{if(this['isNotNull'](_0x5cf2d7)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x5cf2d7[_0x9726('0x4d')],util[_0x9726('0x3e')](_0x5cf2d7,{'showHidden':![],'depth':null}));if(this[_0x9726('0xf')][_0x5cf2d7[_0x9726('0x4d')]]){for(var _0xc88e02=0x0,_0x2c0c10={};_0xc88e020x0?_0x2f5315:0x0;this['voiceQueues'][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x31')]=this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x31')]>_[_0xeb98('0x6c')](_0x223d8e['loggedin'])?_[_0xeb98('0x6c')](_0x223d8e['loggedin']):this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]['talking'];this[_0xeb98('0x4e')](this[_0xeb98('0x11')][_0x223d8e['queue']],_0xeb98('0x6f'));}logger[_0xeb98('0x45')](_0xeb98('0x70'),util['inspect'](this[_0xeb98('0x11')][_0x223d8e['queue']],{'showHidden':![],'depth':null}));ami[_0xeb98('0x43')](_0xeb98('0x71'),this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]);}}}catch(_0x27b9d3){logger[_0xeb98('0x3d')]('[voiceQueueReport][queuesummary]',util[_0xeb98('0x3f')](_0x27b9d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x72')]=function(_0x278149){logger[_0xeb98('0x45')](_0xeb98('0x73'),util[_0xeb98('0x3f')](_0x278149,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x18')]=function(_0x473c20){try{if(this[_0xeb98('0x62')](_0x473c20)){logger[_0xeb98('0x45')](_0xeb98('0x74'),_0x473c20['uniqueid'],util[_0xeb98('0x3f')](_0x473c20,{'showHidden':![],'depth':null}));if(_[_0xeb98('0x63')](this[_0xeb98('0xd')][_0x473c20['uniqueid']])){this[_0xeb98('0xd')][_0x473c20['uniqueid']]=[];this['channels'][_0x473c20['uniqueid']]={};}var _0x1377a5=new QueueReport();_0x1377a5[_0xeb98('0x4d')]=_0x473c20[_0xeb98('0x6b')];_0x1377a5['type']=this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]]&&this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]][_0xeb98('0x4f')]?this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]]['type']||_0xeb98('0x50'):_0xeb98('0x50');_0x1377a5[_0xeb98('0x6b')]=_0x473c20[_0xeb98('0x6b')];_0x1377a5[_0xeb98('0x75')]=moment()['format'](_0xeb98('0x76'));_0x1377a5['position']=_0x473c20[_0xeb98('0x77')];_0x1377a5[_0xeb98('0x78')]=_0x473c20[_0xeb98('0x78')];_0x1377a5[_0xeb98('0x48')]=_0x473c20[_0xeb98('0x48')];logger['info'](_0xeb98('0x79'),_0x1377a5[_0xeb98('0x4d')],_0x1377a5[_0xeb98('0x4f')]);_['merge'](_0x1377a5,_['pick'](_0x473c20,_['keys'](_0x1377a5)));this[_0xeb98('0xd')][_0x473c20['uniqueid']]['push'](_0x1377a5);this['channels'][_0x473c20[_0xeb98('0x48')]]=_0x1377a5;this[_0xeb98('0x44')](_0x1377a5,_0xeb98('0x17'));}}catch(_0x2696ae){logger[_0xeb98('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x473c20[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x2696ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x1a')]=function(_0xa4273e){try{if(this[_0xeb98('0x62')](_0xa4273e)){logger[_0xeb98('0x45')](_0xeb98('0x7a'),_0xa4273e[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0xa4273e,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0xa4273e['uniqueid']]){var _0x59323d=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0xa4273e[_0xeb98('0x48')]]);_0x59323d[_0xeb98('0x7c')]=![];_0x59323d[_0xeb98('0x7d')]=null;_0x59323d[_0xeb98('0x7e')]=_0xa4273e['holdtime'];_0x59323d[_0xeb98('0x7f')]=_0xa4273e['originalposition'];_0x59323d['queuecallerabandon']=!![];_0x59323d[_0xeb98('0x80')]=moment()['format'](_0xeb98('0x76'));_0x59323d[_0xeb98('0x81')]=_0xeb98('0x82');_0x59323d[_0xeb98('0x83')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x59323d[_0xeb98('0x4d')],_0x59323d[_0xeb98('0x4f')]);this[_0xeb98('0xf')][_0xa4273e[_0xeb98('0x48')]]=_0x59323d;this[_0xeb98('0x4c')](_0x59323d,_0xeb98('0x19'));}}}catch(_0x1521ad){logger[_0xeb98('0x3d')](_0xeb98('0x7a'),_0xa4273e[_0xeb98('0x48')],util['inspect'](_0x1521ad,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['syncQueueCallerLeave']=function(_0x3c9d1b){try{if(this[_0xeb98('0x62')](_0x3c9d1b)){logger[_0xeb98('0x45')](_0xeb98('0x84'),_0x3c9d1b[_0xeb98('0x48')],util['inspect'](_0x3c9d1b,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x3c9d1b['uniqueid']]){var _0x404ff6=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x3c9d1b[_0xeb98('0x48')]]);_0x404ff6[_0xeb98('0x85')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x404ff6[_0xeb98('0x86')]=_0x3c9d1b[_0xeb98('0x86')];_0x404ff6[_0xeb98('0x87')]=_0x3c9d1b['connectedlinename'];logger[_0xeb98('0x68')](_0xeb98('0x88'),_0x404ff6[_0xeb98('0x4d')],_0x404ff6[_0xeb98('0x4f')],_0x3c9d1b['connectedlinenum'],_0x3c9d1b[_0xeb98('0x87')]);this['channels'][_0x3c9d1b[_0xeb98('0x48')]]=_0x404ff6;this[_0xeb98('0x44')](_0x404ff6,'queuecallerleave');}}}catch(_0x458ea1){logger[_0xeb98('0x3d')](_0xeb98('0x84'),_0x3c9d1b[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x458ea1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x20')]=function(_0x9f8edb){try{if(this[_0xeb98('0x62')](_0x9f8edb)){logger[_0xeb98('0x45')](_0xeb98('0x89'),_0x9f8edb[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x9f8edb,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x9f8edb[_0xeb98('0x48')]]){var _0x2c52a9=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x9f8edb[_0xeb98('0x48')]]);_0x2c52a9[_0xeb98('0x7c')]=!![];_0x2c52a9['queuecallerexitreason']=_0xeb98('0x8a');logger[_0xeb98('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2c52a9[_0xeb98('0x4d')],_0x2c52a9[_0xeb98('0x4f')]);}}}catch(_0x5b6374){logger[_0xeb98('0x3d')]('[%s][voiceQueueReport][agentconnect]',_0x9f8edb[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x5b6374,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['syncAgentComplete']=function(_0x12a42e){try{if(this['isNotNull'](_0x12a42e)){logger[_0xeb98('0x45')](_0xeb98('0x8b'),_0x12a42e[_0xeb98('0x48')],util['inspect'](_0x12a42e,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x48')]]){var _0x54a372=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x12a42e['uniqueid']]);_0x54a372[_0xeb98('0x19')]=![];_0x54a372[_0xeb98('0x80')]=null;_0x54a372[_0xeb98('0x8c')]=!![];_0x54a372[_0xeb98('0x83')]=_0x12a42e[_0xeb98('0x8d')];_0x54a372[_0xeb98('0x7e')]=_0x12a42e[_0xeb98('0x7e')];_0x54a372[_0xeb98('0x7c')]=!![];_0x54a372['queuecallerexit']=![];_0x54a372[_0xeb98('0x8e')]=null;if(!_0x54a372[_0xeb98('0x8f')]){if(_0x12a42e['reason']==_0xeb98('0x8f')){_0x54a372[_0xeb98('0x81')]='COMPLETED';logger[_0xeb98('0x68')](_0xeb98('0x90'),_0x54a372[_0xeb98('0x4d')],_0x54a372['type']);}else{if(_[_0xeb98('0x91')](_0x12a42e[_0xeb98('0x39')][_0xeb98('0x92')](),_0xeb98('0x93'))){if(this['queueReports'][_0x12a42e['linkedid']]){var _0x563ea9=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x94')]]);_0x563ea9[_0xeb98('0x7c')]=![];_0x563ea9[_0xeb98('0x95')]=!![];_0x563ea9[_0xeb98('0x8e')]=moment(_0x54a372[_0xeb98('0x75')])[_0xeb98('0x96')](_0x12a42e['holdtime'],_0xeb98('0x97'))[_0xeb98('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x563ea9[_0xeb98('0x81')]=_0xeb98('0x98');_0x563ea9[_0xeb98('0x8f')]=!![];_0x563ea9[_0xeb98('0x99')]='FORWARD';_0x563ea9[_0xeb98('0x9a')]=_0x12a42e[_0xeb98('0x9b')];_0x563ea9[_0xeb98('0x9c')]=_0x12a42e[_0xeb98('0x48')];logger[_0xeb98('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x563ea9[_0xeb98('0x4d')],_0x563ea9['type']);var _0x3d5ac0=this['queueReports'][_0x12a42e[_0xeb98('0x94')]];this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x94')]]=this['queueReports'][_0x12a42e[_0xeb98('0x48')]];this[_0xeb98('0xd')][_0x12a42e['uniqueid']]=_0x3d5ac0;}}else{_0x54a372['queuecallerexitreason']=_0xeb98('0x9d')+_0x12a42e[_0xeb98('0x9e')]['toUpperCase']();logger[_0xeb98('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x54a372[_0xeb98('0x4d')],_0x54a372[_0xeb98('0x4f')],_0x54a372[_0xeb98('0x81')]);}}}this[_0xeb98('0xf')][_0x12a42e[_0xeb98('0x48')]]=_0x54a372;this['emitVoiceQueueChannelRemove'](_0x54a372,_0xeb98('0x1d'));}}}catch(_0x50432f){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x12a42e[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x50432f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x22')]=function(_0x41dca2){try{if(this['isNotNull'](_0x41dca2)){logger[_0xeb98('0x45')](_0xeb98('0x9f'),_0x41dca2[_0xeb98('0x48')],util['inspect'](_0x41dca2,{'showHidden':![],'depth':null}));this[_0xeb98('0xa0')](_0x41dca2[_0xeb98('0x48')],_[_0xeb98('0xa1')](_0x41dca2[_0xeb98('0xa2')])[0x0],_0x41dca2[_0xeb98('0xa3')]);if(this['queueReports'][_0x41dca2[_0xeb98('0x48')]]){var _0x441abe=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x41dca2['uniqueid']]);if(_0x441abe){if(this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')])&&this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')][_0xeb98('0xa4')])){switch(_0x41dca2[_0xeb98('0xa3')]){case _0xeb98('0xa5'):_0x441abe['queuecallerexit']=![];_0x441abe[_0xeb98('0x8e')]=null;break;case'TIMEOUT':_0x441abe[_0xeb98('0xa6')]=_0xeb98('0xa7');_0x441abe[_0xeb98('0x95')]=!![];_0x441abe[_0xeb98('0x8e')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe['queuecallerleaveAt']=moment()[_0xeb98('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xeb98('0xa8'),_0x41dca2['uniqueid'],util['inspect'](_0x441abe,{'showHidden':![],'depth':null}));ami['emit'](_0xeb98('0xa9'),_0x441abe);break;default:_0x441abe[_0xeb98('0x95')]=!![];_0x441abe[_0xeb98('0x8e')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe[_0xeb98('0x85')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));}_0x441abe[_0xeb98('0x19')]=![];_0x441abe['queuecallerabandonAt']=null;_0x441abe[_0xeb98('0x81')]=_0x41dca2[_0xeb98('0xa3')];this['channels'][_0x41dca2[_0xeb98('0x48')]]=_0x441abe;this[_0xeb98('0x4c')](_0x441abe,_0xeb98('0x21'));}else if(this[_0xeb98('0x62')](_0x41dca2['variable'])&&this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')][_0xeb98('0xaa')])){if(!_0x441abe[_0xeb98('0x19')]){_0x441abe[_0xeb98('0x95')]=!![];_0x441abe['queuecallerexitAt']=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe[_0xeb98('0x81')]=_0xeb98('0xab');_0x441abe[_0xeb98('0x85')]=moment()['format'](_0xeb98('0x76'));this['channels'][_0x41dca2[_0xeb98('0x48')]]=_0x441abe;}}logger[_0xeb98('0x68')](_0xeb98('0xac'),_0x41dca2[_0xeb98('0x48')],_0x441abe[_0xeb98('0x4d')],_0x441abe['type'],_[_0xeb98('0xa1')](_0x41dca2['variable'])[0x0],_0x41dca2[_0xeb98('0xa3')]);_0x441abe[_0xeb98('0x14')]=this[_0xeb98('0x14')][_0x41dca2[_0xeb98('0x48')]];}}}}catch(_0x1184d4){logger['error'](_0xeb98('0x9f'),_0x41dca2[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x1184d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['addVariable']=function(_0x3a31dd,_0x8197c1,_0x4f48b0){var _0x581130=[_0xeb98('0xad'),'rtpaudioqosbridged',_0xeb98('0xae'),'rtpaudioqosjitterbridged',_0xeb98('0xaf'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xeb98('0xb0'),_0xeb98('0xb1'),_0xeb98('0xb2'),_0xeb98('0xb3'),_0xeb98('0xb4'),_0xeb98('0xb5'),_0xeb98('0xb6'),'memberinterface','memberlastcall',_0xeb98('0x8d'),_0xeb98('0xb7'),_0xeb98('0xb8')];if(!_['isNil'](_0x8197c1)&&!_[_0xeb98('0xb9')](_0x581130,_0x8197c1)){if(_[_0xeb98('0x63')](this[_0xeb98('0x14')][_0x3a31dd])){this[_0xeb98('0x14')][_0x3a31dd]={};}this[_0xeb98('0x14')][_0x3a31dd][_0x8197c1]=_0x4f48b0;}};VoiceQueueReport['prototype'][_0xeb98('0xba')]=function(_0x15da8d){try{if(this[_0xeb98('0x62')](_0x15da8d)){logger[_0xeb98('0x45')](_0xeb98('0xbb'),_0x15da8d[_0xeb98('0x48')],util['inspect'](_0x15da8d,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x15da8d[_0xeb98('0x48')]]){for(var _0x1d16e3=0x0,_0x276edc={};_0x1d16e3=0x0?moment(_0x3b70e1[_0x28a6('0x17')])[_0x28a6('0xd')](_0x3b70e1[_0x28a6('0x16')],'seconds'):null,'data1':_0x28a6('0x19'),'data2':_0x3b70e1[_0x28a6('0x1a')],'data3':_0x3b70e1[_0x28a6('0xf')],'data4':_0x3b70e1[_0x28a6('0x1b')]||null,'role':_0x28a6('0x10'),'internal':_0x3b70e1[_0x28a6('0x1a')]?_['toNumber'](_0x3b70e1[_0x28a6('0x1a')]):undefined,'uniqueid':_0x3b70e1[_0x28a6('0x1c')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x7811=['Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x5ac62d,_0x3bdb94){var _0xea3586=function(_0x351a91){while(--_0x351a91){_0x5ac62d['push'](_0x5ac62d['shift']());}};_0xea3586(++_0x3bdb94);}(_0x7811,0x144));var _0x1781=function(_0x3a980f,_0x49e4d6){_0x3a980f=_0x3a980f-0x0;var _0x36010f=_0x7811[_0x3a980f];return _0x36010f;};'use strict';var moment=require(_0x1781('0x0'));var _=require(_0x1781('0x1'));var util=require(_0x1781('0x2'));var client=require(_0x1781('0x3'));exports[_0x1781('0x4')]=function(_0x50e749){var _0x1bc777=_0x50e749[_0x1781('0x5')]||_0x50e749['queuecallerexitAt'];return client[_0x1781('0x6')](_0x1781('0x7'),{'body':{'channel':_0x1781('0x8'),'membername':_0x50e749[_0x1781('0x9')],'interface':_[_0x1781('0xa')](_0x50e749[_0x1781('0xb')])?util[_0x1781('0xc')]('SIP/%s',_0x50e749['lastAssignedTo']):_0x50e749[_0x1781('0xb')],'type':_0x1781('0xd'),'enterAt':_0x50e749[_0x1781('0xe')],'exitAt':_0x1bc777,'duration':moment(_0x1bc777)[_0x1781('0xf')](_0x50e749[_0x1781('0xe')],_0x1781('0x10')),'data1':_0x1781('0x11'),'data2':_0x50e749[_0x1781('0x12')],'data3':_0x50e749[_0x1781('0x13')],'data4':null,'data5':_0x50e749['queue'],'role':_0x1781('0x14'),'internal':_0x50e749[_0x1781('0x15')]?_['toNumber'](_0x50e749[_0x1781('0x15')]):undefined,'uniqueid':_0x50e749[_0x1781('0x16')]},'log':_0x1781('0x7')});};exports[_0x1781('0x17')]=function(_0x69a7bd){return client[_0x1781('0x6')](_0x1781('0x7'),{'body':{'channel':_0x1781('0x8'),'membername':_0x69a7bd[_0x1781('0x18')],'interface':_0x69a7bd[_0x1781('0xb')],'type':_0x1781('0xd'),'enterAt':_0x69a7bd[_0x1781('0x19')],'exitAt':_0x69a7bd[_0x1781('0x1a')],'duration':moment(_0x69a7bd[_0x1781('0x1a')])['diff'](_0x69a7bd[_0x1781('0x19')],'seconds')>=0x0?moment(_0x69a7bd[_0x1781('0x1a')])[_0x1781('0xf')](_0x69a7bd[_0x1781('0x19')],_0x1781('0x10')):null,'data1':_0x1781('0x1b'),'data2':_0x69a7bd[_0x1781('0x15')],'data3':_0x69a7bd[_0x1781('0x13')],'data4':_0x69a7bd[_0x1781('0x1c')]||null,'role':_0x1781('0x14'),'internal':_0x69a7bd[_0x1781('0x15')]?_[_0x1781('0x1d')](_0x69a7bd[_0x1781('0x15')]):undefined,'uniqueid':_0x69a7bd['uniqueid']},'log':_0x1781('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5bb566e..4bdf910 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 _0x5423=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x39da98,_0x48559a){var _0x34dcbb=function(_0x4bcf1a){while(--_0x4bcf1a){_0x39da98['push'](_0x39da98['shift']());}};_0x34dcbb(++_0x48559a);}(_0x5423,0xe3));var _0x3542=function(_0x39cb25,_0x58c8d3){_0x39cb25=_0x39cb25-0x0;var _0x41d36d=_0x5423[_0x39cb25];return _0x41d36d;};'use strict';var client=require(_0x3542('0x0'));exports[_0x3542('0x1')]=function(_0x511bd3){return function(_0x331a98){return client[_0x3542('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3542('0x3'),_0x3542('0x4')]},'log':_0x3542('0x5')});};}; \ No newline at end of file +var _0x4746=['GetTemplate','name','html','../client','getTemplates'];(function(_0x248476,_0x216cad){var _0x3c126a=function(_0x5e1879){while(--_0x5e1879){_0x248476['push'](_0x248476['shift']());}};_0x3c126a(++_0x216cad);}(_0x4746,0xc6));var _0x6474=function(_0x521b5e,_0x28e147){_0x521b5e=_0x521b5e-0x0;var _0x2b9ded=_0x4746[_0x521b5e];return _0x2b9ded;};'use strict';var client=require(_0x6474('0x0'));exports[_0x6474('0x1')]=function(_0x5b12a8){return function(_0x20751a){return client['Request'](_0x6474('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6474('0x3'),_0x6474('0x4')]},'log':_0x6474('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7521f6e..c935821 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 _0x1b3e=['action','data1','data2','data4','data5','data6','data7','GetTrigger','channel','status','Condition','AllConditions','value','field','operator','Action','Actions'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1b3e,0x128));var _0xe1b3=function(_0x23f626,_0x55c5d){_0x23f626=_0x23f626-0x0;var _0x4b96c7=_0x1b3e[_0x23f626];return _0x4b96c7;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x53ec55){return function(_0x13e1fc){return client['Request'](_0xe1b3('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xe1b3('0x1'),_0xe1b3('0x2')],'include':[{'model':_0xe1b3('0x3'),'as':_0xe1b3('0x4'),'attributes':['id','field','operator',_0xe1b3('0x5')]},{'model':_0xe1b3('0x3'),'as':'AnyConditions','attributes':['id',_0xe1b3('0x6'),_0xe1b3('0x7'),_0xe1b3('0x5')]},{'model':_0xe1b3('0x8'),'as':_0xe1b3('0x9'),'attributes':['id',_0xe1b3('0xa'),_0xe1b3('0xb'),_0xe1b3('0xc'),'data3',_0xe1b3('0xd'),_0xe1b3('0xe'),_0xe1b3('0xf'),_0xe1b3('0x10')]}]},'log':_0xe1b3('0x0')});};}; \ No newline at end of file +var _0x6fbe=['Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data3','data4','data5','data7','GetTrigger','../client','getTriggers'];(function(_0x5d325a,_0x3e9be8){var _0x262ba7=function(_0x42943e){while(--_0x42943e){_0x5d325a['push'](_0x5d325a['shift']());}};_0x262ba7(++_0x3e9be8);}(_0x6fbe,0xd0));var _0xe6fb=function(_0x20e5aa,_0x453a69){_0x20e5aa=_0x20e5aa-0x0;var _0x4fb35d=_0x6fbe[_0x20e5aa];return _0x4fb35d;};'use strict';var client=require(_0xe6fb('0x0'));exports[_0xe6fb('0x1')]=function(_0x3cfd6d){return function(_0x19529c){return client[_0xe6fb('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe6fb('0x3'),_0xe6fb('0x4'),_0xe6fb('0x5')],'include':[{'model':_0xe6fb('0x6'),'as':_0xe6fb('0x7'),'attributes':['id',_0xe6fb('0x8'),_0xe6fb('0x9'),_0xe6fb('0xa')]},{'model':_0xe6fb('0x6'),'as':_0xe6fb('0xb'),'attributes':['id',_0xe6fb('0x8'),_0xe6fb('0x9'),_0xe6fb('0xa')]},{'model':_0xe6fb('0xc'),'as':_0xe6fb('0xd'),'attributes':['id',_0xe6fb('0xe'),_0xe6fb('0xf'),'data2',_0xe6fb('0x10'),_0xe6fb('0x11'),_0xe6fb('0x12'),'data6',_0xe6fb('0x13')]}]},'log':_0xe6fb('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7fe885e..87be853 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 _0xa470=['registry','getTrunks','Request','GetTrunk'];(function(_0xd40536,_0xd6f24){var _0x4ac571=function(_0x42863a){while(--_0x42863a){_0xd40536['push'](_0xd40536['shift']());}};_0x4ac571(++_0xd6f24);}(_0xa470,0x1d5));var _0x0a47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa470[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x0a47('0x0')]=function(_0x42022d){return function(_0x24cf27){return client[_0x0a47('0x1')](_0x0a47('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0a47('0x3')]},'log':_0x0a47('0x2')});};}; \ No newline at end of file +var _0x0727=['../client','GetTrunk','name','registry'];(function(_0x5bcdb9,_0x2bef44){var _0x4f0dda=function(_0x474a24){while(--_0x474a24){_0x5bcdb9['push'](_0x5bcdb9['shift']());}};_0x4f0dda(++_0x2bef44);}(_0x0727,0x1a8));var _0x7072=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x0727[_0x1b5aea];return _0x15cfc6;};'use strict';var client=require(_0x7072('0x0'));exports['getTrunks']=function(_0x44d888){return function(_0x1270c3){return client['Request'](_0x7072('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7072('0x2'),_0x7072('0x3')]},'log':_0x7072('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2bedcdc..202999e 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 _0x7cb3=['accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getTelephones','telephone','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','getAgents','Request','agent','name','email'];(function(_0x49366b,_0x58e79a){var _0x3287eb=function(_0x402a6b){while(--_0x402a6b){_0x49366b['push'](_0x49366b['shift']());}};_0x3287eb(++_0x58e79a);}(_0x7cb3,0x18a));var _0x37cb=function(_0x57ef6f,_0x555d7c){_0x57ef6f=_0x57ef6f-0x0;var _0x52b688=_0x7cb3[_0x57ef6f];return _0x52b688;};'use strict';var client=require('../client');exports[_0x37cb('0x0')]=function(){return function(){return client[_0x37cb('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x37cb('0x2')},'attributes':['id',_0x37cb('0x3'),_0x37cb('0x4'),_0x37cb('0x5'),_0x37cb('0x6'),_0x37cb('0x7'),_0x37cb('0x8'),_0x37cb('0x9'),_0x37cb('0xa'),_0x37cb('0xb'),_0x37cb('0xc'),'mobile',_0x37cb('0xd')]},'log':_0x37cb('0x0')});};};exports[_0x37cb('0xe')]=function(){return function(){return client[_0x37cb('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x37cb('0xf')},'attributes':['id','name',_0x37cb('0x5'),'internal']},'log':_0x37cb('0xe')});};};exports[_0x37cb('0x10')]=function(_0x16a683,_0x9b99f9,_0x24d7d0){return client['Request']('PauseUser',{'body':{'type':_0x9b99f9,'uniqueid':_0x24d7d0},'options':{'where':{'id':_0x16a683['id']}},'log':'savePause'});};exports[_0x37cb('0x11')]=function(_0x3b3dba){return client[_0x37cb('0x1')](_0x37cb('0x12'),{'body':{},'options':{'where':{'id':_0x3b3dba['id']}},'log':'savePause'});};exports[_0x37cb('0x13')]=function(_0x1dd584){return client[_0x37cb('0x1')](_0x37cb('0x14'),{'options':{'raw':![],'where':{'role':_0x37cb('0x2'),'id':_0x1dd584},'attributes':['id',_0x37cb('0x3'),_0x37cb('0x4'),_0x37cb('0x5'),_0x37cb('0x6'),_0x37cb('0x7'),_0x37cb('0x8'),_0x37cb('0x9'),_0x37cb('0xa'),_0x37cb('0xb'),_0x37cb('0xd')]},'log':'getAgent'});}; \ No newline at end of file +var _0x2950=['online','lastLoginAt','lastPauseAt','voicePause','mobile','interface','getTelephones','internal','savePause','Request','PauseUser','saveUnpause','ShowUser','agent','pauseType','getAgent','../client','getAgents','GetUser','name','email','fullname'];(function(_0x549684,_0x40637e){var _0x43e153=function(_0x2cfd5a){while(--_0x2cfd5a){_0x549684['push'](_0x549684['shift']());}};_0x43e153(++_0x40637e);}(_0x2950,0x1c8));var _0x0295=function(_0x2b6c63,_0x2d4663){_0x2b6c63=_0x2b6c63-0x0;var _0x7187dc=_0x2950[_0x2b6c63];return _0x7187dc;};'use strict';var client=require(_0x0295('0x0'));exports[_0x0295('0x1')]=function(){return function(){return client['Request'](_0x0295('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0295('0x3'),_0x0295('0x4'),'accountcode',_0x0295('0x5'),_0x0295('0x6'),_0x0295('0x7'),'pauseType',_0x0295('0x8'),_0x0295('0x9'),'phone',_0x0295('0xa'),_0x0295('0xb')]},'log':_0x0295('0x1')});};};exports[_0x0295('0xc')]=function(){return function(){return client['Request'](_0x0295('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x0295('0x3'),'accountcode',_0x0295('0xd')]},'log':_0x0295('0xc')});};};exports[_0x0295('0xe')]=function(_0x165408,_0x422d44,_0x5062a1){return client[_0x0295('0xf')](_0x0295('0x10'),{'body':{'type':_0x422d44,'uniqueid':_0x5062a1},'options':{'where':{'id':_0x165408['id']}},'log':_0x0295('0xe')});};exports[_0x0295('0x11')]=function(_0x2c1b48){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x2c1b48['id']}},'log':_0x0295('0xe')});};exports['getAgent']=function(_0x236fdc){return client[_0x0295('0xf')](_0x0295('0x12'),{'options':{'raw':![],'where':{'role':_0x0295('0x13'),'id':_0x236fdc},'attributes':['id',_0x0295('0x3'),'email','accountcode',_0x0295('0x5'),_0x0295('0x6'),_0x0295('0x7'),_0x0295('0x14'),_0x0295('0x8'),_0x0295('0x9'),_0x0295('0xb')]},'log':_0x0295('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 784d12e..1cc83ae 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 _0x3148=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x3148,0x172));var _0x8314=function(_0xbc0b4d,_0x48d139){_0xbc0b4d=_0xbc0b4d-0x0;var _0x5920d7=_0x3148[_0xbc0b4d];return _0x5920d7;};'use strict';var client=require('../client');exports[_0x8314('0x0')]=function(_0x56ce4b){return client[_0x8314('0x1')](_0x8314('0x2'),{'body':_0x56ce4b,'log':_0x8314('0x2')});};exports[_0x8314('0x3')]=function(_0x279cf5,_0x3d81ee,_0x4bcda2){return client[_0x8314('0x1')](_0x8314('0x4'),{'body':_0x279cf5,'options':{'where':{'uniqueid':_0x3d81ee,'interface':_0x4bcda2,'agentcomplete':!![]}},'log':_0x8314('0x4')});}; \ No newline at end of file +var _0xf6a6=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','Request'];(function(_0x2d29c7,_0x4f4d71){var _0x16fc60=function(_0xda2644){while(--_0xda2644){_0x2d29c7['push'](_0x2d29c7['shift']());}};_0x16fc60(++_0x4f4d71);}(_0xf6a6,0x147));var _0x6f6a=function(_0xa25145,_0x528e49){_0xa25145=_0xa25145-0x0;var _0x1b6c71=_0xf6a6[_0xa25145];return _0x1b6c71;};'use strict';var client=require('../client');exports['create']=function(_0x50c757){return client[_0x6f6a('0x0')](_0x6f6a('0x1'),{'body':_0x50c757,'log':_0x6f6a('0x1')});};exports[_0x6f6a('0x2')]=function(_0x35efb7,_0x3a519e,_0x311d5c){return client['Request']('UpdateVoiceAgentReport',{'body':_0x35efb7,'options':{'where':{'uniqueid':_0x3a519e,'interface':_0x311d5c,'agentcomplete':!![]}},'log':_0x6f6a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9f3f6cb..f5c0733 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 _0x19d1=['util','lodash','../client','create','Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19d1,0x117));var _0x119d=function(_0x1c8ea5,_0x25d5e4){_0x1c8ea5=_0x1c8ea5-0x0;var _0x36d439=_0x19d1[_0x1c8ea5];return _0x36d439;};'use strict';var moment=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var _=require(_0x119d('0x2'));var client=require(_0x119d('0x3'));exports[_0x119d('0x4')]=function(_0x2dbabe){return client[_0x119d('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x2dbabe,{'source':_0x2dbabe[_0x119d('0x6')],'destinationcontext':_0x2dbabe[_0x119d('0x7')],'callerid':_0x2dbabe[_0x119d('0x8')],'amaflags':_0x119d('0x9')}),'log':_0x119d('0xa')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x119d('0x5')](_0x119d('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x119d('0xc'))[_0x119d('0xd')](_0x119d('0xe')),moment()[_0x119d('0xf')](_0x119d('0xc'))[_0x119d('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x119d('0x10'),_0x119d('0x11'),'duration',_0x119d('0x12')]},'log':_0x119d('0x13')});};}; \ No newline at end of file +var _0x4841=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','endOf'];(function(_0x495f27,_0x57ef36){var _0x22b8e9=function(_0xa88463){while(--_0xa88463){_0x495f27['push'](_0x495f27['shift']());}};_0x22b8e9(++_0x57ef36);}(_0x4841,0x1bf));var _0x1484=function(_0x5a5fc7,_0x15bdca){_0x5a5fc7=_0x5a5fc7-0x0;var _0x2faeab=_0x4841[_0x5a5fc7];return _0x2faeab;};'use strict';var moment=require(_0x1484('0x0'));var util=require(_0x1484('0x1'));var _=require('lodash');var client=require(_0x1484('0x2'));exports[_0x1484('0x3')]=function(_0x46119e){return client[_0x1484('0x4')](_0x1484('0x5'),{'body':_[_0x1484('0x6')](_0x46119e,{'source':_0x46119e['calleridnum'],'destinationcontext':_0x46119e[_0x1484('0x7')],'callerid':_0x46119e['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x1484('0x5')});};exports[_0x1484('0x8')]=function(){return function(){return client[_0x1484('0x4')](_0x1484('0x9'),{'options':{'where':{'type':[_0x1484('0xa')],'createdAt':{'$between':[moment()[_0x1484('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1484('0xc')](_0x1484('0xd'))[_0x1484('0xe')](_0x1484('0xf'))]}},'attributes':[_0x1484('0x10'),'disposition',_0x1484('0x11'),_0x1484('0x12')]},'log':_0x1484('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fcc040e..3c7cf6c 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 _0x1aab=['Request','CreateVoiceDialReport','create'];(function(_0x439c63,_0x3cb62d){var _0xc9cde5=function(_0x494a5a){while(--_0x494a5a){_0x439c63['push'](_0x439c63['shift']());}};_0xc9cde5(++_0x3cb62d);}(_0x1aab,0xbf));var _0xb1aa=function(_0x3056d0,_0x3ce8a0){_0x3056d0=_0x3056d0-0x0;var _0x3e29d8=_0x1aab[_0x3056d0];return _0x3e29d8;};'use strict';var client=require('../client');exports[_0xb1aa('0x0')]=function(_0x3913e2){return client[_0xb1aa('0x1')]('CreateVoiceDialReport',{'body':_0x3913e2,'log':_0xb1aa('0x2')});}; \ No newline at end of file +var _0x97b3=['../client','create','Request','CreateVoiceDialReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x97b3,0x1f4));var _0x397b=function(_0x1c8c8f,_0xefc971){_0x1c8c8f=_0x1c8c8f-0x0;var _0x5e10d5=_0x97b3[_0x1c8c8f];return _0x5e10d5;};'use strict';var client=require(_0x397b('0x0'));exports[_0x397b('0x1')]=function(_0x1059ac){return client[_0x397b('0x2')]('CreateVoiceDialReport',{'body':_0x1059ac,'log':_0x397b('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bdd3944..5e139e2 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 _0x1a5c=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x3c2cb6,_0x2453f7){var _0x4e1ea5=function(_0x2db43a){while(--_0x2db43a){_0x3c2cb6['push'](_0x3c2cb6['shift']());}};_0x4e1ea5(++_0x2453f7);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x1a5c[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0xc1a5('0x0'));exports[_0xc1a5('0x1')]=function(){return function(){return client[_0xc1a5('0x2')](_0xc1a5('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc1a5('0x4'),_0xc1a5('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xc1a5('0x1')});};}; \ No newline at end of file +var _0xa1a4=['recordingFormat','getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x246629,_0xbf8256){var _0x127ce4=function(_0x31489c){while(--_0x31489c){_0x246629['push'](_0x246629['shift']());}};_0x127ce4(++_0xbf8256);}(_0xa1a4,0x11f));var _0x4a1a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa1a4[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x4a1a('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x4a1a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x4a1a('0x2'),_0x4a1a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4a1a('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ad93388..62ca3a4 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 _0xd22e=['callerid','active','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','Pause','mandatoryDispositionPause','TrunkBackup'];(function(_0x13e334,_0x71cc68){var _0x394246=function(_0x354eb6){while(--_0x354eb6){_0x13e334['push'](_0x13e334['shift']());}};_0x394246(++_0x71cc68);}(_0xd22e,0x1a2));var _0xed22=function(_0x33effb,_0x1bd00d){_0x33effb=_0x33effb-0x0;var _0x1471e7=_0xd22e[_0x33effb];return _0x1471e7;};'use strict';var client=require('../client');exports[_0xed22('0x0')]=function(){return function(){return client[_0xed22('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xed22('0x2'),_0xed22('0x3'),'acwTimeout','autopause',_0xed22('0x4'),'type','dialActive',_0xed22('0x5'),_0xed22('0x6'),_0xed22('0x7'),_0xed22('0x8'),'dialPredictiveOptimization',_0xed22('0x9'),'dialPredictiveInterval',_0xed22('0xa'),_0xed22('0xb'),_0xed22('0xc'),_0xed22('0xd'),_0xed22('0xe'),_0xed22('0xf'),_0xed22('0x10'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0xed22('0x11'),_0xed22('0x12'),_0xed22('0x13'),_0xed22('0x14'),_0xed22('0x15'),_0xed22('0x16'),_0xed22('0x17'),'dialCheckDuplicateType','dialAMDActive',_0xed22('0x18'),_0xed22('0x19'),_0xed22('0x1a'),_0xed22('0x1b'),_0xed22('0x1c'),_0xed22('0x1d'),_0xed22('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0xed22('0x1f'),_0xed22('0x20'),_0xed22('0x21'),_0xed22('0x22'),_0xed22('0x23'),_0xed22('0x4'),'strategy',_0xed22('0x24'),_0xed22('0x25'),_0xed22('0x26'),_0xed22('0x27'),_0xed22('0x28'),_0xed22('0x29'),_0xed22('0x2a'),_0xed22('0x2b'),'dialMachineMaxRetry',_0xed22('0x2c'),_0xed22('0x2d'),_0xed22('0x2e'),_0xed22('0x2f'),_0xed22('0x30'),_0xed22('0x31')],'include':[{'model':_0xed22('0x32'),'as':_0xed22('0x32'),'attributes':['id','name','callerid','active']},{'model':_0xed22('0x33'),'as':_0xed22('0x34'),'attributes':['id',_0xed22('0x2')]},{'model':_0xed22('0x32'),'as':_0xed22('0x35'),'attributes':['id',_0xed22('0x2'),_0xed22('0x36'),_0xed22('0x37')]},{'model':_0xed22('0x38'),'as':'Interval','attributes':['id',_0xed22('0x2')],'include':[{'model':'Interval','as':_0xed22('0x39'),'attributes':['id',_0xed22('0x2'),_0xed22('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x2be6=['dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition'];(function(_0xe89083,_0x4fbe0c){var _0x53cb25=function(_0x12e1f8){while(--_0x12e1f8){_0xe89083['push'](_0xe89083['shift']());}};_0x53cb25(++_0x4fbe0c);}(_0x2be6,0x1d9));var _0x62be=function(_0x50aec2,_0x1b00f2){_0x50aec2=_0x50aec2-0x0;var _0x96c347=_0x2be6[_0x50aec2];return _0x96c347;};'use strict';var client=require('../client');exports[_0x62be('0x0')]=function(){return function(){return client['Request'](_0x62be('0x1'),{'options':{'raw':![],'attributes':['id',_0x62be('0x2'),_0x62be('0x3'),_0x62be('0x4'),'autopause',_0x62be('0x5'),_0x62be('0x6'),_0x62be('0x7'),_0x62be('0x8'),_0x62be('0x9'),_0x62be('0xa'),_0x62be('0xb'),_0x62be('0xc'),_0x62be('0xd'),_0x62be('0xe'),'dialOriginateCallerIdName',_0x62be('0xf'),_0x62be('0x10'),_0x62be('0x11'),'dialQueueTimeout',_0x62be('0x12'),_0x62be('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x62be('0x14'),_0x62be('0x15'),'dialNoAnswerRetryFrequency',_0x62be('0x16'),_0x62be('0x17'),_0x62be('0x18'),'dialPrefix',_0x62be('0x19'),_0x62be('0x1a'),_0x62be('0x1b'),_0x62be('0x1c'),_0x62be('0x1d'),_0x62be('0x1e'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x62be('0x1f'),_0x62be('0x20'),'dialAMDMaximumWordLength','timeout',_0x62be('0x21'),_0x62be('0x22'),_0x62be('0x23'),_0x62be('0x24'),_0x62be('0x25'),'dialQueueProject2',_0x62be('0x5'),_0x62be('0x26'),_0x62be('0x27'),_0x62be('0x28'),_0x62be('0x29'),_0x62be('0x2a'),_0x62be('0x2b'),_0x62be('0x2c'),_0x62be('0x2d'),'dialAbandonedRetryFrequency',_0x62be('0x2e'),'dialMachineRetryFrequency',_0x62be('0x2f'),'dialAgentRejectRetryFrequency',_0x62be('0x30'),_0x62be('0x31'),_0x62be('0x32')],'include':[{'model':_0x62be('0x33'),'as':_0x62be('0x33'),'attributes':['id',_0x62be('0x2'),_0x62be('0x34'),_0x62be('0x35')]},{'model':_0x62be('0x36'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x62be('0x33'),'as':_0x62be('0x37'),'attributes':['id','name',_0x62be('0x34'),_0x62be('0x35')]},{'model':'Interval','as':_0x62be('0x38'),'attributes':['id',_0x62be('0x2')],'include':[{'model':_0x62be('0x38'),'as':'Intervals','attributes':['id',_0x62be('0x2'),_0x62be('0x39')]}]}]},'log':_0x62be('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c91aff5..022cf7e 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 _0xb0cf=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x4c8b16,_0x3ca21c){var _0x2ba188=function(_0x3e128e){while(--_0x3e128e){_0x4c8b16['push'](_0x4c8b16['shift']());}};_0x2ba188(++_0x3ca21c);}(_0xb0cf,0xc3));var _0xfb0c=function(_0x2fd0ec,_0x34a4e0){_0x2fd0ec=_0x2fd0ec-0x0;var _0x1a0601=_0xb0cf[_0x2fd0ec];return _0x1a0601;};'use strict';var moment=require(_0xfb0c('0x0'));var _=require(_0xfb0c('0x1'));var client=require(_0xfb0c('0x2'));exports[_0xfb0c('0x3')]=function(_0x216da9){return client[_0xfb0c('0x4')](_0xfb0c('0x5'),{'body':_0x216da9,'log':'CreateVoiceQueueReport'});};exports[_0xfb0c('0x6')]=function(){return function(){return client[_0xfb0c('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xfb0c('0x7'))[_0xfb0c('0x8')](_0xfb0c('0x9')),moment()[_0xfb0c('0xa')](_0xfb0c('0x7'))[_0xfb0c('0x8')](_0xfb0c('0x9'))]}},'attributes':['uniqueid',_0xfb0c('0xb'),_0xfb0c('0xc'),_0xfb0c('0xd'),_0xfb0c('0xe'),_0xfb0c('0xf'),'queuecallerexit',_0xfb0c('0x10'),_0xfb0c('0x11'),_0xfb0c('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x66e5=['YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format'];(function(_0x46a091,_0x49d31e){var _0x57d00a=function(_0x46ec77){while(--_0x46ec77){_0x46a091['push'](_0x46a091['shift']());}};_0x57d00a(++_0x49d31e);}(_0x66e5,0x1a1));var _0x566e=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0x66e5[_0x3a4464];return _0x42503f;};'use strict';var moment=require(_0x566e('0x0'));var _=require('lodash');var client=require('../client');exports[_0x566e('0x1')]=function(_0x5e8b31){return client[_0x566e('0x2')](_0x566e('0x3'),{'body':_0x5e8b31,'log':_0x566e('0x3')});};exports[_0x566e('0x4')]=function(){return function(){return client[_0x566e('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x566e('0x5')](_0x566e('0x6'))[_0x566e('0x7')](_0x566e('0x8')),moment()['endOf'](_0x566e('0x6'))['format'](_0x566e('0x8'))]}},'attributes':['uniqueid',_0x566e('0x9'),_0x566e('0xa'),_0x566e('0xb'),_0x566e('0xc'),'queuecallercompleteAt','queuecallerexit',_0x566e('0xd'),_0x566e('0xe'),_0x566e('0xf')]},'log':_0x566e('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f94a8f0..f345751 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 _0x4fe8=['getVoiceQueueRtPauses','Request','../client'];(function(_0x120295,_0x103efe){var _0x13a826=function(_0x5308be){while(--_0x5308be){_0x120295['push'](_0x120295['shift']());}};_0x13a826(++_0x103efe);}(_0x4fe8,0x167));var _0x84fe=function(_0x2d0ffa,_0x26fad7){_0x2d0ffa=_0x2d0ffa-0x0;var _0x20ee83=_0x4fe8[_0x2d0ffa];return _0x20ee83;};'use strict';var client=require(_0x84fe('0x0'));exports[_0x84fe('0x1')]=function(_0x506c11){return function(){return client[_0x84fe('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x506c11,'paused':!![]},'raw':!![]},'log':_0x84fe('0x1')});};}; \ No newline at end of file +var _0xddd1=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x31508d,_0x2eb7fa){var _0x28aa6a=function(_0x236d55){while(--_0x236d55){_0x31508d['push'](_0x31508d['shift']());}};_0x28aa6a(++_0x2eb7fa);}(_0xddd1,0xab));var _0x1ddd=function(_0x867041,_0x3269c0){_0x867041=_0x867041-0x0;var _0x113788=_0xddd1[_0x867041];return _0x113788;};'use strict';var client=require('../client');exports[_0x1ddd('0x0')]=function(_0x3abafb){return function(){return client[_0x1ddd('0x1')](_0x1ddd('0x2'),{'options':{'where':{'VoiceQueueId':_0x3abafb,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f556976..172d907 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 _0xe652=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create','Request'];(function(_0x184926,_0x2984ee){var _0x51fa36=function(_0x23d11a){while(--_0x23d11a){_0x184926['push'](_0x184926['shift']());}};_0x51fa36(++_0x2984ee);}(_0xe652,0xb2));var _0x2e65=function(_0x589bac,_0x56768a){_0x589bac=_0x589bac-0x0;var _0x26a374=_0xe652[_0x589bac];return _0x26a374;};'use strict';var _=require(_0x2e65('0x0'));var client=require(_0x2e65('0x1'));exports[_0x2e65('0x2')]=function(_0x187c76){return client[_0x2e65('0x3')](_0x2e65('0x4'),{'body':_[_0x2e65('0x5')](_0x187c76,{'value':_0x187c76[_0x2e65('0x6')]}),'log':_0x2e65('0x4')});}; \ No newline at end of file +var _0xbadd=['merge','monitorFilename','../client','create','CreateVoiceRecording'];(function(_0x3f4e4b,_0x2d6d95){var _0xd876c2=function(_0xdd9e62){while(--_0xdd9e62){_0x3f4e4b['push'](_0x3f4e4b['shift']());}};_0xd876c2(++_0x2d6d95);}(_0xbadd,0xbb));var _0xdbad=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xbadd[_0x1b02bb];return _0x131245;};'use strict';var _=require('lodash');var client=require(_0xdbad('0x0'));exports[_0xdbad('0x1')]=function(_0x3a1424){return client['Request'](_0xdbad('0x2'),{'body':_[_0xdbad('0x3')](_0x3a1424,{'value':_0x3a1424[_0xdbad('0x4')]}),'log':_0xdbad('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f554c51..4241f18 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 _0x97fd=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x97fd,0x81));var _0xd97f=function(_0x590abd,_0x10735a){_0x590abd=_0x590abd-0x0;var _0x116a72=_0x97fd[_0x590abd];return _0x116a72;};'use strict';var client=require(_0xd97f('0x0'));exports[_0xd97f('0x1')]={};exports[_0xd97f('0x2')]=function(_0x402734){return client[_0xd97f('0x3')](_0xd97f('0x4'),{'body':{'result':_0x402734['result'],'transfererchannel':_0x402734[_0xd97f('0x5')],'transferercalleridnum':_0x402734[_0xd97f('0x6')],'transferercalleridname':_0x402734[_0xd97f('0x7')],'transfererconnectedlinenum':_0x402734['transfererconnectedlinenum'],'transfererconnectedlinename':_0x402734[_0xd97f('0x8')],'transfereraccountcode':_0x402734[_0xd97f('0x9')],'transferercontext':_0x402734[_0xd97f('0xa')],'transfererexten':_0x402734[_0xd97f('0xb')],'transfererlinkedid':_0x402734['transfererlinkedid'],'transfereechannel':_0x402734[_0xd97f('0xc')],'transfereecalleridnum':_0x402734[_0xd97f('0xd')],'transfereecalleridname':_0x402734[_0xd97f('0xe')],'transfereeconnectedlinenum':_0x402734[_0xd97f('0xf')],'transfereeconnectedlinename':_0x402734[_0xd97f('0x10')],'transfereeaccountcode':_0x402734[_0xd97f('0x11')],'transfereecontext':_0x402734['transfereecontext'],'transfereeexten':_0x402734['transfereeexten'],'transfereelinkedid':_0x402734[_0xd97f('0x12')],'isexternal':_0x402734[_0xd97f('0x13')],'context':_0x402734[_0xd97f('0x14')],'extension':_0x402734[_0xd97f('0x15')],'type':_0xd97f('0x16')},'log':_0xd97f('0x4')});};exports[_0xd97f('0x17')]=function(_0x5d2909){return client[_0xd97f('0x3')](_0xd97f('0x4'),{'body':{'result':_0x5d2909[_0xd97f('0x18')],'transfererchannel':_0x5d2909['origtransfererchannel'],'transferercalleridnum':_0x5d2909[_0xd97f('0x19')],'transferercalleridname':_0x5d2909[_0xd97f('0x1a')],'transfererconnectedlinenum':_0x5d2909[_0xd97f('0x1b')],'transfererconnectedlinename':_0x5d2909[_0xd97f('0x1c')],'transfereraccountcode':_0x5d2909[_0xd97f('0x1d')],'transferercontext':_0x5d2909[_0xd97f('0x1e')],'transfererexten':_0x5d2909['secondtransfererexten'],'transfererlinkedid':_0x5d2909[_0xd97f('0x1f')],'transfereechannel':_0x5d2909[_0xd97f('0x20')],'transfereecalleridnum':_0x5d2909['transfertargetcalleridnum'],'transfereecalleridname':_0x5d2909['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5d2909[_0xd97f('0x21')],'transfereeconnectedlinename':_0x5d2909[_0xd97f('0x22')],'transfereeaccountcode':_0x5d2909[_0xd97f('0x23')],'transfereecontext':_0x5d2909[_0xd97f('0x24')],'transfereeexten':_0x5d2909[_0xd97f('0x25')],'transfereelinkedid':_0x5d2909[_0xd97f('0x26')],'isexternal':_0x5d2909[_0xd97f('0x13')],'context':_0x5d2909[_0xd97f('0x27')],'extension':_0x5d2909['origtransfererexten'],'type':_0xd97f('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xf1f2=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','isexternal','context','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfereraccountcode','transfererlinkedid','transfereechannel'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xf1f2,0xde));var _0x2f1f=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xf1f2[_0x57e00e];return _0x415e60;};'use strict';var client=require('../client');exports[_0x2f1f('0x0')]={};exports['blindTransfer']=function(_0x25b3fb){return client[_0x2f1f('0x1')](_0x2f1f('0x2'),{'body':{'result':_0x25b3fb[_0x2f1f('0x3')],'transfererchannel':_0x25b3fb[_0x2f1f('0x4')],'transferercalleridnum':_0x25b3fb['transferercalleridnum'],'transferercalleridname':_0x25b3fb[_0x2f1f('0x5')],'transfererconnectedlinenum':_0x25b3fb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x25b3fb['transfererconnectedlinename'],'transfereraccountcode':_0x25b3fb[_0x2f1f('0x6')],'transferercontext':_0x25b3fb['transferercontext'],'transfererexten':_0x25b3fb['transfererexten'],'transfererlinkedid':_0x25b3fb[_0x2f1f('0x7')],'transfereechannel':_0x25b3fb[_0x2f1f('0x8')],'transfereecalleridnum':_0x25b3fb[_0x2f1f('0x9')],'transfereecalleridname':_0x25b3fb[_0x2f1f('0xa')],'transfereeconnectedlinenum':_0x25b3fb[_0x2f1f('0xb')],'transfereeconnectedlinename':_0x25b3fb[_0x2f1f('0xc')],'transfereeaccountcode':_0x25b3fb[_0x2f1f('0xd')],'transfereecontext':_0x25b3fb['transfereecontext'],'transfereeexten':_0x25b3fb[_0x2f1f('0xe')],'transfereelinkedid':_0x25b3fb['transfereelinkedid'],'isexternal':_0x25b3fb[_0x2f1f('0xf')],'context':_0x25b3fb[_0x2f1f('0x10')],'extension':_0x25b3fb['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x2f1f('0x11')]=function(_0x2b6892){return client['Request'](_0x2f1f('0x2'),{'body':{'result':_0x2b6892[_0x2f1f('0x3')],'transfererchannel':_0x2b6892[_0x2f1f('0x12')],'transferercalleridnum':_0x2b6892['origtransferercalleridnum'],'transferercalleridname':_0x2b6892['origtransferercalleridname'],'transfererconnectedlinenum':_0x2b6892['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2b6892[_0x2f1f('0x13')],'transfereraccountcode':_0x2b6892[_0x2f1f('0x14')],'transferercontext':_0x2b6892[_0x2f1f('0x15')],'transfererexten':_0x2b6892[_0x2f1f('0x16')],'transfererlinkedid':_0x2b6892[_0x2f1f('0x17')],'transfereechannel':_0x2b6892[_0x2f1f('0x18')],'transfereecalleridnum':_0x2b6892['transfertargetcalleridnum'],'transfereecalleridname':_0x2b6892[_0x2f1f('0x19')],'transfereeconnectedlinenum':_0x2b6892[_0x2f1f('0x1a')],'transfereeconnectedlinename':_0x2b6892['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b6892[_0x2f1f('0x1b')],'transfereecontext':_0x2b6892[_0x2f1f('0x1c')],'transfereeexten':_0x2b6892['transfertargetexten'],'transfereelinkedid':_0x2b6892[_0x2f1f('0x1d')],'isexternal':_0x2b6892[_0x2f1f('0xf')],'context':_0x2b6892[_0x2f1f('0x1e')],'extension':_0x2b6892[_0x2f1f('0x1f')],'type':_0x2f1f('0x20')},'log':_0x2f1f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b4c53af..f23e10a 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 _0x99cc=['status','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','message','catch','command','action','Command','then','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','values','join','map','find','channels','uniqueid','channel','%s.%s','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','voicechannel','length','StopMixMonitor','destinationchannel'];(function(_0x3580ba,_0x22f579){var _0xb5ce9b=function(_0x6dc66b){while(--_0x6dc66b){_0x3580ba['push'](_0x3580ba['shift']());}};_0xb5ce9b(++_0x22f579);}(_0x99cc,0x1b1));var _0xc99c=function(_0x12d496,_0x3c52e0){_0x12d496=_0x12d496-0x0;var _0x5d26dc=_0x99cc[_0x12d496];return _0x5d26dc;};'use strict';var _=require(_0xc99c('0x0'));var util=require(_0xc99c('0x1'));var jayson=require(_0xc99c('0x2'));var schema=require(_0xc99c('0x3'));var BPromise=require(_0xc99c('0x4'));var moment=require(_0xc99c('0x5'));var config=require(_0xc99c('0x6'));var properties=require(_0xc99c('0x7'));var ami=require('../ami');exports[_0xc99c('0x8')]=function(_0x332d54,_0x185a9e,_0x201d6c){return new BPromise(function(_0x1e1030,_0xa2a2d7){var _0x5cd0f1={'QueuePause':function(_0x1dfda6){return new Promise(function(_0x2b1ea4,_0x424761){var _0xcbe027=util[_0xc99c('0x9')](_0xc99c('0xa'),_0xc99c('0xb'),_0x1dfda6[_0xc99c('0xc')]);if(_0x332d54[_0xc99c('0xd')]&&_0x332d54[_0xc99c('0xd')][_0xcbe027]&&_0x332d54[_0xc99c('0xd')][_0xcbe027][_0xc99c('0xe')]){_0x332d54[_0xc99c('0xd')][_0xcbe027][_0xc99c('0xf')]();}if(_0x332d54[_0xc99c('0x10')][_0xcbe027]){_0x332d54[_0xc99c('0x10')][_0xcbe027][_0xc99c('0x11')]({'statePause':_0x1dfda6[_0xc99c('0x12')]?!![]:![]});}_0x2b1ea4({'code':0xc8,'message':_0xc99c('0x13')});});},'Reload':function(_0x12568b){var _0x18fd8d=this;return new Promise(function(_0xb1d02b,_0x9171fd){if(ami[_0xc99c('0x14')]()==![]){return _0x9171fd(_0x18fd8d[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')]['join']('\x20')));}_0x12568b=_[_0xc99c('0x19')](_0x12568b,_[_0xc99c('0x1a')](properties[_0xc99c('0x1b')]));_0x12568b['action']=_0xc99c('0x1c');return ami[_0xc99c('0x1d')](_0x12568b)['then'](function(_0x472aeb){_0xb1d02b({'code':0xc8,'message':_0x472aeb[_0xc99c('0x1e')]});})[_0xc99c('0x1f')](function(_0x376ad7){_0x9171fd(_0x18fd8d['error'](0x1f5,_0x376ad7['message']));});});},'Command':function(_0x327989){var _0x339afb=this;return new Promise(function(_0x30c0dd,_0x224fa6){if(ami[_0xc99c('0x14')]()==![]){return _0x224fa6(_0x339afb['error'](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')]['join']('\x20')));}_0x327989=_[_0xc99c('0x19')](_0x327989,_0xc99c('0x20'));_0x327989[_0xc99c('0x21')]=_0xc99c('0x22');return ami['Action'](_0x327989)[_0xc99c('0x23')](function(_0x467ae0){_0x30c0dd({'code':0xc8,'message':_0x467ae0[_0xc99c('0x24')]});})[_0xc99c('0x1f')](function(_0x514fea){_0x224fa6(_0x339afb[_0xc99c('0x15')](0x1f5,_0x514fea[_0xc99c('0x1e')]));});});},'VoiceQueues':function(_0x267aae){return new Promise(function(_0x3f6203,_0x611f69){var _0x518efe=[];for(var _0x278f85 in _0x332d54[_0xc99c('0x25')]){if(_0x332d54[_0xc99c('0x25')]['hasOwnProperty'](_0x278f85)){var _0x1a42ca=_0x332d54[_0xc99c('0x25')][_0x278f85];var _0x547d21={'id':_0x1a42ca['id'],'name':_0x1a42ca['name'],'strategy':_0x1a42ca[_0xc99c('0x26')],'answered':_0x1a42ca[_0xc99c('0x27')],'available':_0x1a42ca[_0xc99c('0x28')],'loggedIn':_0x1a42ca[_0xc99c('0x29')],'pTalking':_0x1a42ca[_0xc99c('0x2a')],'sumBillable':_0x1a42ca['sumBillable'],'sumDuration':_0x1a42ca[_0xc99c('0x2b')],'sumHoldTime':_0x1a42ca[_0xc99c('0x2c')]||0x0,'talking':_0x1a42ca['talking'],'total':_0x1a42ca[_0xc99c('0x2d')],'type':_0x1a42ca[_0xc99c('0x2e')],'unmanaged':_0x1a42ca[_0xc99c('0x2f')],'abandoned':_0x1a42ca['abandoned'],'waiting':_0x1a42ca[_0xc99c('0x30')],'loggedInDb':_0x1a42ca['loggedInDb']};if(_0x1a42ca[_0xc99c('0x2e')]===_0xc99c('0x31')){_0x547d21[_0xc99c('0x32')]=_0x1a42ca[_0xc99c('0x32')];_0x547d21['dialMethod']=_0x1a42ca[_0xc99c('0x33')];_0x547d21[_0xc99c('0x34')]=_0x1a42ca[_0xc99c('0x34')];_0x547d21['dialOriginateCallerIdNumber']=_0x1a42ca[_0xc99c('0x35')];_0x547d21[_0xc99c('0x36')]=_0x1a42ca[_0xc99c('0x36')];_0x547d21[_0xc99c('0x37')]=_0x1a42ca[_0xc99c('0x37')];_0x547d21[_0xc99c('0x38')]=_0x1a42ca[_0xc99c('0x38')];_0x547d21[_0xc99c('0x39')]=_0x1a42ca[_0xc99c('0x39')];_0x547d21['outboundBlacklistCallsDay']=_0x1a42ca[_0xc99c('0x3a')];_0x547d21['outboundBusyCallsDay']=_0x1a42ca[_0xc99c('0x3b')];_0x547d21[_0xc99c('0x3c')]=_0x1a42ca[_0xc99c('0x3c')];_0x547d21[_0xc99c('0x3d')]=_0x1a42ca['outboundDropCallsDayACS'];_0x547d21['outboundDropCallsDayCallersExit']=_0x1a42ca[_0xc99c('0x3e')];_0x547d21[_0xc99c('0x3f')]=_0x1a42ca['outboundDropCallsDayTimeout'];_0x547d21['outboundNoAnswerCallsDay']=_0x1a42ca[_0xc99c('0x40')];_0x547d21[_0xc99c('0x41')]=_0x1a42ca[_0xc99c('0x41')];_0x547d21[_0xc99c('0x42')]=_0x1a42ca['outboundOriginateFailureCallsDay'];_0x547d21[_0xc99c('0x43')]=_0x1a42ca[_0xc99c('0x43')];_0x547d21[_0xc99c('0x44')]=_0x1a42ca[_0xc99c('0x44')];_0x547d21['outboundUnknownCallsDay']=_0x1a42ca['outboundUnknownCallsDay'];_0x547d21[_0xc99c('0x45')]=_0x1a42ca[_0xc99c('0x45')];_0x547d21[_0xc99c('0x46')]=_0x1a42ca[_0xc99c('0x46')];_0x547d21[_0xc99c('0x47')]=_0x1a42ca['predictiveIntervalAvgTalktime'];_0x547d21[_0xc99c('0x48')]=_0x1a42ca[_0xc99c('0x48')];_0x547d21[_0xc99c('0x49')]=_0x1a42ca['predictiveIntervalDroppedCallsTimeout'];_0x547d21[_0xc99c('0x4a')]=_0x1a42ca[_0xc99c('0x4a')];_0x547d21['predictiveIntervalErlangCallsDroppedCalls']=_0x1a42ca[_0xc99c('0x4b')];_0x547d21['predictiveIntervalHitRate']=_0x1a42ca[_0xc99c('0x4c')];_0x547d21[_0xc99c('0x4d')]=_0x1a42ca['predictiveIntervalMultiplicativeFactor'];_0x547d21[_0xc99c('0x4e')]=_0x1a42ca[_0xc99c('0x4e')];_0x547d21['predictiveIntervalAvailable']=_0x1a42ca['predictiveIntervalAvailable'];_0x547d21[_0xc99c('0x4f')]=_0x1a42ca[_0xc99c('0x4f')];_0x547d21[_0xc99c('0x1e')]=_0x1a42ca[_0xc99c('0x1e')];_0x547d21['originated']=_0x1a42ca[_0xc99c('0x50')];_0x547d21['erlangCalls']=_0x1a42ca[_0xc99c('0x51')];_0x547d21[_0xc99c('0x52')]=_0x1a42ca[_0xc99c('0x52')];_0x547d21['erlangAbandonmentRate']=_0x1a42ca['erlangAbandonmentRate'];_0x547d21[_0xc99c('0x53')]=_0x1a42ca[_0xc99c('0x53')];_0x547d21['startPredictive']=_0x1a42ca[_0xc99c('0x54')];_0x547d21[_0xc99c('0x55')]=_0x1a42ca[_0xc99c('0x55')];}if(_0x1a42ca[_0xc99c('0x56')]){_0x547d21['Trunk']={'id':_0x1a42ca[_0xc99c('0x56')]['id'],'name':_0x1a42ca['Trunk'][_0xc99c('0xc')],'active':_0x1a42ca[_0xc99c('0x56')]['active'],'callerid':_0x1a42ca[_0xc99c('0x56')]['callerid']};}if(_0x1a42ca[_0xc99c('0x57')]){_0x547d21[_0xc99c('0x57')]={'id':_0x1a42ca[_0xc99c('0x57')]['id'],'name':_0x1a42ca[_0xc99c('0x57')][_0xc99c('0xc')]};}_0x518efe[_0xc99c('0x58')](_0x547d21);}}_0x3f6203({'count':_0x518efe['length'],'rows':_0x518efe});});},'VoiceChannels':function(_0x2071d9){return new Promise(function(_0x215b85,_0x2b40b0){var _0x2a1d37=_[_0xc99c('0x59')](_0x332d54['channels']);_0x215b85({'count':_0x2a1d37['length'],'rows':_0x2a1d37});});},'VoiceChannelMixMonitor':function(_0xc90184){var _0x56d13f=this;return new Promise(function(_0x29e659,_0x5971a9){if(ami[_0xc99c('0x14')]()==![]){return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')]['username'],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x369c26=schema(properties['voicechannel'])[_0xc99c('0x3')](_0xc90184);if(_0x369c26['length']>0x0){return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f4,_[_0xc99c('0x5b')](_0x369c26,'message')[_0xc99c('0x5a')](',\x20')));}var _0x25810f=_[_0xc99c('0x5c')](_0x332d54[_0xc99c('0x5d')],{'uniqueid':_0xc90184[_0xc99c('0x5e')]});if(_0x25810f&&_0x25810f[_0xc99c('0x5f')]){var _0x1e86f4=util['format'](_0xc99c('0x60'),_0xc90184['filename']||_0xc90184[_0xc99c('0x5e')],_0xc90184['format']||_0xc99c('0x61'));return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x62'),'channel':_0x25810f['channel'],'file':_0x1e86f4,'options':'ai(mixmonitorid)'})[_0xc99c('0x23')](function(_0x59ed20){var _0x32f99c=_[_0xc99c('0x5c')](_0x25810f['monitors'],{'filename':_0xc99c('0x63')+_0x1e86f4[_0xc99c('0x64')]()});if(_[_0xc99c('0x65')](_0x32f99c)){_0x25810f[_0xc99c('0x66')][_0xc99c('0x58')]({'filename':_0xc99c('0x63')+_0x1e86f4[_0xc99c('0x64')](),'createdAt':moment()['format'](_0xc99c('0x67')),'mixmonitorid':_0x59ed20[_0xc99c('0x68')],'status':_0xc99c('0x69')});}else{_0x32f99c['mixmonitorid']=_0x59ed20[_0xc99c('0x68')];_0x32f99c['status']=_0xc99c('0x69');}_0x29e659({'code':0xc8,'message':[_0xc90184[_0xc99c('0x5e')],'MixMonitor\x20Success',_0x59ed20[_0xc99c('0x68')]][_0xc99c('0x5a')]('\x20'),'mixmonitorid':_0x59ed20[_0xc99c('0x68')]});})[_0xc99c('0x1f')](function(_0x795113){_0x5971a9(_0x56d13f['error'](0x1f5,[_0xc90184[_0xc99c('0x5e')],_0x795113[_0xc99c('0x1e')][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x5971a9(_0x56d13f[_0xc99c('0x15')](0x1f5,_0xc99c('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x1c9568){var _0x3e800f=this;return new Promise(function(_0x2f38dd,_0x57fd8b){if(ami[_0xc99c('0x14')]()==![]){return _0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x1890f6=schema(properties[_0xc99c('0x6b')])['validate'](_0x1c9568);if(_0x1890f6[_0xc99c('0x6c')]>0x0){return _0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f4,_[_0xc99c('0x5b')](_0x1890f6,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x1decb1=_[_0xc99c('0x5c')](_0x332d54['channels'],{'uniqueid':_0x1c9568[_0xc99c('0x5e')]});if(_0x1decb1){return BPromise['resolve']()[_0xc99c('0x23')](function(){if(_0x1decb1[_0xc99c('0x5f')]){return ami['Action']({'action':_0xc99c('0x6d'),'channel':_0x1decb1[_0xc99c('0x5f')],'mixmonitorid':_0x1c9568[_0xc99c('0x68')]})['catch'](function(_0x5994e9){});}})[_0xc99c('0x23')](function(){if(_0x1decb1[_0xc99c('0x6e')]){return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x6d'),'channel':_0x1decb1[_0xc99c('0x6e')],'mixmonitorid':_0x1c9568['mixmonitorid']})['catch'](function(_0x596796){});}})[_0xc99c('0x23')](function(_0x19e8c6){var _0x506ce0=_[_0xc99c('0x5c')](_0x1decb1[_0xc99c('0x66')],{'mixmonitorid':_0x1c9568['mixmonitorid']});if(_0x506ce0){_0x506ce0[_0xc99c('0x6f')]=_0xc99c('0x70');}})['then'](function(){var _0x1fc31f=util[_0xc99c('0x9')](_0xc99c('0x60'),_0x1c9568[_0xc99c('0x71')]||_0x1c9568[_0xc99c('0x5e')],_0x1c9568['format']||_0xc99c('0x61'));var _0x4af40b=_[_0xc99c('0x5c')](_0x1decb1[_0xc99c('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x1fc31f[_0xc99c('0x64')]()});if(_0x4af40b){_0x4af40b[_0xc99c('0x6f')]=_0xc99c('0x70');}})[_0xc99c('0x23')](function(){_0x2f38dd({'code':0xc8,'message':[_0x1c9568['uniqueid'],_0xc99c('0x72')][_0xc99c('0x5a')]('\x20')});})['catch'](function(_0x4fd5a8){_0x57fd8b(_0x3e800f[_0xc99c('0x15')](0x1f5,[_0x1c9568[_0xc99c('0x5e')],_0x4fd5a8['message'][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x57fd8b(_0x3e800f['error'](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannels':function(_0xad5a84){return new Promise(function(_0x185123,_0x4cead0){var _0x144a67=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x73')]);_0x185123({'count':_0x144a67[_0xc99c('0x6c')],'rows':_0x144a67});});},'VoiceQueuesChannel':function(_0x48c228){var _0x5abcd9=this;return new Promise(function(_0x281e78,_0x158e67){var _0x3d8629=schema(properties[_0xc99c('0x74')])[_0xc99c('0x3')](_0x48c228);if(_0x3d8629[_0xc99c('0x6c')]>0x0){return _0x158e67(_0x5abcd9['error'](0x1f4,_['map'](_0x3d8629,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x5f52db=_[_0xc99c('0x5c')](_0x332d54[_0xc99c('0x73')],{'uniqueid':_0x48c228['uniqueid']});if(_0x5f52db){_0x281e78(_0x5f52db);}else{return _0x158e67(_0x5abcd9[_0xc99c('0x15')](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x5855c7){var _0xda8500=this;return new Promise(function(_0x20a9cc,_0x2d7d20){if(ami['isConnected']()==![]){return _0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x1f5212=schema(properties[_0xc99c('0x75')])[_0xc99c('0x3')](_0x5855c7);if(_0x1f5212['length']>0x0){return _0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f4,_['map'](_0x1f5212,_0xc99c('0x1e'))[_0xc99c('0x5a')](',\x20')));}var _0x4b31ef=_['find'](_0x332d54[_0xc99c('0x73')],{'uniqueid':_0x5855c7[_0xc99c('0x5e')]});if(_0x4b31ef&&_0x4b31ef[_0xc99c('0x5f')]){return ami[_0xc99c('0x1d')]({'action':_0xc99c('0x76'),'channel':_0x4b31ef[_0xc99c('0x5f')]})[_0xc99c('0x23')](function(_0x293ba9){_0x20a9cc({'code':0xc8,'message':[_0x5855c7[_0xc99c('0x5e')],_0x293ba9[_0xc99c('0x1e')][_0xc99c('0x64')]()]['join']('\x20')});})[_0xc99c('0x1f')](function(_0x168583){_0x2d7d20(_0xda8500[_0xc99c('0x15')](0x1f5,[_0x5855c7[_0xc99c('0x5e')],_0x168583[_0xc99c('0x1e')][_0xc99c('0x64')]()][_0xc99c('0x5a')]('\x20')));});}else{return _0x2d7d20(_0xda8500['error'](0x1f5,_0xc99c('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x174e7f){var _0x132bd9=this;return new Promise(function(_0x35d0ef,_0x44b7b9){if(ami[_0xc99c('0x14')]()==![]){return _0x44b7b9(_0x132bd9[_0xc99c('0x15')](0x1f4,[config[_0xc99c('0x16')]['ip'],config[_0xc99c('0x16')][_0xc99c('0x17')],_0xc99c('0x18')][_0xc99c('0x5a')]('\x20')));}var _0x932fe0=schema(properties[_0xc99c('0x77')])[_0xc99c('0x3')](_0x174e7f);if(_0x932fe0['length']>0x0){return _0x44b7b9(_0x132bd9['error'](0x1f4,_[_0xc99c('0x5b')](_0x932fe0,'message')['join'](',\x20')));}var _0x3dc321=_[_0xc99c('0x5c')](_0x332d54['queueChannels'],{'uniqueid':_0x174e7f['uniqueid']});if(_0x3dc321&&_0x3dc321[_0xc99c('0x5f')]){return ami[_0xc99c('0x1d')]({'action':'Redirect','channel':_0x3dc321[_0xc99c('0x5f')],'exten':_0x174e7f['exten'],'context':_0x174e7f[_0xc99c('0x78')]||_0x3dc321[_0xc99c('0x78')],'priority':0x1})[_0xc99c('0x23')](function(_0xa746ce){_0x35d0ef({'code':0xc8,'message':[_0x174e7f[_0xc99c('0x5e')],_0xa746ce[_0xc99c('0x1e')][_0xc99c('0x64')]()]['join']('\x20')});})[_0xc99c('0x1f')](function(_0xee0ea6){_0x44b7b9(_0x132bd9[_0xc99c('0x15')](0x1f5,[_0x174e7f[_0xc99c('0x5e')],_0xee0ea6['message'][_0xc99c('0x64')]()]['join']('\x20')));});}else{return _0x44b7b9(_0x132bd9['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x71a73f){return new Promise(function(_0x2767ad,_0x34447c){var _0xbdb7=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x10')]);_0x2767ad({'count':_0xbdb7[_0xc99c('0x6c')],'rows':_0xbdb7});});},'Telephones':function(_0x147e39){return new Promise(function(_0x5796cd,_0x1eeaa1){var _0x156353=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x79')]);_0x5796cd({'count':_0x156353[_0xc99c('0x6c')],'rows':_0x156353});});},'Trunks':function(_0x3bb277){return new Promise(function(_0x5a675c,_0x209b6e){var _0x5198cc=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x7a')]);_0x5a675c({'count':_0x5198cc[_0xc99c('0x6c')],'rows':_0x5198cc});});},'OutboundChannels':function(_0x1c03f0){return new Promise(function(_0x11f5c6,_0x56696f){var _0x4f4540=_['values'](_0x332d54[_0xc99c('0x7b')]);_0x11f5c6({'count':_0x4f4540[_0xc99c('0x6c')],'rows':_0x4f4540});});},'Outbound':function(_0x444ee9){return new Promise(function(_0x4e2816,_0x3fbff3){_0x4e2816(_0x332d54[_0xc99c('0x31')]);});},'Campaigns':function(_0x36c652){return new Promise(function(_0x3cd6da,_0xa3a9a8){var _0x373666=_[_0xc99c('0x59')](_0x332d54[_0xc99c('0x7c')]);_0x3cd6da({'count':_0x373666[_0xc99c('0x6c')],'rows':_0x373666});});},'VoiceQueuesPreview':function(_0x1f7ea4){var _0xefe89f=this;return new Promise(function(_0xf883c6,_0x9c8135){_0x185a9e[_0xc99c('0x7d')](_0x1f7ea4['id'])['then'](function(_0x3f3466){_0xf883c6({'code':0xc8,'message':_0x3f3466[_0xc99c('0x1e')]});})[_0xc99c('0x1f')](function(_0x1648d2){_0x9c8135(_0xefe89f['error'](0x1f4,_0x1648d2[_0xc99c('0x1e')]));});});},'EventManager':function(_0x315b38){var _0x367597=this;return new Promise(function(_0x3161ad,_0x343771){if(!_0x315b38[_0xc99c('0x7e')]){return _0x343771(_0x367597[_0xc99c('0x15')](0x1f4,_0xc99c('0x7f')));}ami[_0xc99c('0x80')](_0xc99c('0x81')+_0x315b38[_0xc99c('0x7e')],_0x315b38[_0xc99c('0x1e')]);_0x3161ad({'code':0xc8,'message':_0x315b38});});},'FaxAccounts':function(_0x27f389){return new Promise(function(_0x47f2cb,_0x568c41){var _0x3f061e=_[_0xc99c('0x59')](_0x332d54['faxAccounts']);_0x47f2cb({'count':_0x3f061e[_0xc99c('0x6c')],'rows':_0x3f061e});});},'SendFax':function(_0x44da75){var _0x4eedc1=this;return new Promise(function(_0x1bce8a,_0x1ac82f){_0x201d6c[_0xc99c('0x82')](_0x44da75)[_0xc99c('0x23')](function(_0x170672){_0x1bce8a({'code':0xc8,'message':_0x170672['message']});})[_0xc99c('0x1f')](function(_0xd0ff){_0x1ac82f(_0x4eedc1[_0xc99c('0x15')](0x1f4,_0xd0ff['message']));});});},'CheckAfterSend':function(_0x1dbcc8){var _0x14b65c=this;return new Promise(function(_0x26b986,_0x4d27b6){_0x201d6c['checkAfterSend'](_0x1dbcc8)['then'](function(_0x5838dd){_0x26b986({'code':0xc8,'message':_0x5838dd['message']});})['catch'](function(_0x57f445){_0x4d27b6(_0x14b65c[_0xc99c('0x15')](0x1f4,_0x57f445[_0xc99c('0x1e')]));});});}};var _0x30c293=jayson[_0xc99c('0x83')](_0x5cd0f1)[_0xc99c('0x84')]();_0x30c293['on']('error',function(_0x51484e){return _0xa2a2d7(_0x51484e);});_0x30c293[_0xc99c('0x8')](0x232a,'127.0.0.1',function(){console[_0xc99c('0x85')](_0xc99c('0x86'),0x232a);return _0x1e1030(_0xc99c('0x87')+0x232a);});});}; \ No newline at end of file +var _0xa432=['outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','channels','ami\x20disconnected','voicechannel','length','map','find','uniqueid','%s.%s','filename','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','resolve','channel','StopMixMonitor','destinationchannel','stop','status','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','custom:','event','faxAccounts','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../properties','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','asterisk','username','join','pick','module','action','Reload','then','message','catch','error','command','Command','Action','content','voiceQueues','hasOwnProperty','name','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0xa432,0xd4));var _0x2a43=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa432[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x2a43('0x0'));var util=require('util');var jayson=require(_0x2a43('0x1'));var schema=require(_0x2a43('0x2'));var BPromise=require(_0x2a43('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x2a43('0x4'));var ami=require('../ami');exports[_0x2a43('0x5')]=function(_0x259f70,_0x46d7c6,_0xd0af31){return new BPromise(function(_0x42fa46,_0x235108){var _0x290b82={'QueuePause':function(_0x5ee1d2){return new Promise(function(_0x387cf6,_0x71791d){var _0x5a50ed=util[_0x2a43('0x6')](_0x2a43('0x7'),'SIP',_0x5ee1d2['name']);if(_0x259f70[_0x2a43('0x8')]&&_0x259f70[_0x2a43('0x8')][_0x5a50ed]&&_0x259f70['timers'][_0x5a50ed][_0x2a43('0x9')]){_0x259f70[_0x2a43('0x8')][_0x5a50ed][_0x2a43('0xa')]();}if(_0x259f70[_0x2a43('0xb')][_0x5a50ed]){_0x259f70['agents'][_0x5a50ed][_0x2a43('0xc')]({'statePause':_0x5ee1d2['pause']?!![]:![]});}_0x387cf6({'code':0xc8,'message':_0x2a43('0xd')});});},'Reload':function(_0x3f0a73){var _0xdaba62=this;return new Promise(function(_0x282099,_0x46e682){if(ami[_0x2a43('0xe')]()==![]){return _0x46e682(_0xdaba62['error'](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],'ami\x20disconnected'][_0x2a43('0x11')]('\x20')));}_0x3f0a73=_[_0x2a43('0x12')](_0x3f0a73,_['keys'](properties[_0x2a43('0x13')]));_0x3f0a73[_0x2a43('0x14')]=_0x2a43('0x15');return ami['Action'](_0x3f0a73)[_0x2a43('0x16')](function(_0x556fb1){_0x282099({'code':0xc8,'message':_0x556fb1[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x423d94){_0x46e682(_0xdaba62[_0x2a43('0x19')](0x1f5,_0x423d94[_0x2a43('0x17')]));});});},'Command':function(_0x2de3c6){var _0x301f1c=this;return new Promise(function(_0x59dfe2,_0x509b27){if(ami[_0x2a43('0xe')]()==![]){return _0x509b27(_0x301f1c[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x2de3c6=_[_0x2a43('0x12')](_0x2de3c6,_0x2a43('0x1a'));_0x2de3c6[_0x2a43('0x14')]=_0x2a43('0x1b');return ami[_0x2a43('0x1c')](_0x2de3c6)[_0x2a43('0x16')](function(_0x43675c){_0x59dfe2({'code':0xc8,'message':_0x43675c[_0x2a43('0x1d')]});})[_0x2a43('0x18')](function(_0x28134f){_0x509b27(_0x301f1c[_0x2a43('0x19')](0x1f5,_0x28134f[_0x2a43('0x17')]));});});},'VoiceQueues':function(_0x27a0de){return new Promise(function(_0x2b9f4a,_0x2d456e){var _0x201ab5=[];for(var _0x30debc in _0x259f70[_0x2a43('0x1e')]){if(_0x259f70[_0x2a43('0x1e')][_0x2a43('0x1f')](_0x30debc)){var _0x424157=_0x259f70[_0x2a43('0x1e')][_0x30debc];var _0x2e38e1={'id':_0x424157['id'],'name':_0x424157[_0x2a43('0x20')],'strategy':_0x424157[_0x2a43('0x21')],'answered':_0x424157['answered'],'available':_0x424157[_0x2a43('0x22')],'loggedIn':_0x424157[_0x2a43('0x23')],'pTalking':_0x424157['pTalking'],'sumBillable':_0x424157[_0x2a43('0x24')],'sumDuration':_0x424157[_0x2a43('0x25')],'sumHoldTime':_0x424157[_0x2a43('0x26')]||0x0,'talking':_0x424157[_0x2a43('0x27')],'total':_0x424157[_0x2a43('0x28')],'type':_0x424157[_0x2a43('0x29')],'unmanaged':_0x424157['unmanaged'],'abandoned':_0x424157[_0x2a43('0x2a')],'waiting':_0x424157[_0x2a43('0x2b')],'loggedInDb':_0x424157[_0x2a43('0x2c')]};if(_0x424157[_0x2a43('0x29')]===_0x2a43('0x2d')){_0x2e38e1[_0x2a43('0x2e')]=_0x424157[_0x2a43('0x2e')];_0x2e38e1[_0x2a43('0x2f')]=_0x424157[_0x2a43('0x2f')];_0x2e38e1['dialOriginateCallerIdName']=_0x424157[_0x2a43('0x30')];_0x2e38e1[_0x2a43('0x31')]=_0x424157[_0x2a43('0x31')];_0x2e38e1['dialOriginateTimeout']=_0x424157[_0x2a43('0x32')];_0x2e38e1['dialPrefix']=_0x424157[_0x2a43('0x33')];_0x2e38e1[_0x2a43('0x34')]=_0x424157[_0x2a43('0x34')];_0x2e38e1[_0x2a43('0x35')]=_0x424157[_0x2a43('0x35')];_0x2e38e1[_0x2a43('0x36')]=_0x424157[_0x2a43('0x36')];_0x2e38e1[_0x2a43('0x37')]=_0x424157[_0x2a43('0x37')];_0x2e38e1[_0x2a43('0x38')]=_0x424157[_0x2a43('0x38')];_0x2e38e1['outboundDropCallsDayACS']=_0x424157[_0x2a43('0x39')];_0x2e38e1['outboundDropCallsDayCallersExit']=_0x424157['outboundDropCallsDayCallersExit'];_0x2e38e1['outboundDropCallsDayTimeout']=_0x424157[_0x2a43('0x3a')];_0x2e38e1[_0x2a43('0x3b')]=_0x424157[_0x2a43('0x3b')];_0x2e38e1[_0x2a43('0x3c')]=_0x424157[_0x2a43('0x3c')];_0x2e38e1[_0x2a43('0x3d')]=_0x424157[_0x2a43('0x3d')];_0x2e38e1[_0x2a43('0x3e')]=_0x424157['outboundReCallsDay'];_0x2e38e1[_0x2a43('0x3f')]=_0x424157['outboundRejectCallsDay'];_0x2e38e1[_0x2a43('0x40')]=_0x424157[_0x2a43('0x40')];_0x2e38e1['predictiveIntervalAnsweredCalls']=_0x424157[_0x2a43('0x41')];_0x2e38e1[_0x2a43('0x42')]=_0x424157[_0x2a43('0x42')];_0x2e38e1[_0x2a43('0x43')]=_0x424157[_0x2a43('0x43')];_0x2e38e1[_0x2a43('0x44')]=_0x424157['predictiveIntervalDroppedCallsCallersExit'];_0x2e38e1[_0x2a43('0x45')]=_0x424157[_0x2a43('0x45')];_0x2e38e1[_0x2a43('0x46')]=_0x424157[_0x2a43('0x46')];_0x2e38e1[_0x2a43('0x47')]=_0x424157[_0x2a43('0x47')];_0x2e38e1[_0x2a43('0x48')]=_0x424157[_0x2a43('0x48')];_0x2e38e1[_0x2a43('0x49')]=_0x424157['predictiveIntervalMultiplicativeFactor'];_0x2e38e1[_0x2a43('0x4a')]=_0x424157[_0x2a43('0x4a')];_0x2e38e1[_0x2a43('0x4b')]=_0x424157['predictiveIntervalAvailable'];_0x2e38e1[_0x2a43('0x4c')]=_0x424157[_0x2a43('0x4c')];_0x2e38e1[_0x2a43('0x17')]=_0x424157[_0x2a43('0x17')];_0x2e38e1['originated']=_0x424157[_0x2a43('0x4d')];_0x2e38e1[_0x2a43('0x4e')]=_0x424157[_0x2a43('0x4e')];_0x2e38e1[_0x2a43('0x4f')]=_0x424157[_0x2a43('0x4f')];_0x2e38e1[_0x2a43('0x50')]=_0x424157[_0x2a43('0x50')];_0x2e38e1[_0x2a43('0x51')]=_0x424157['erlangBusyFactor'];_0x2e38e1[_0x2a43('0x52')]=_0x424157[_0x2a43('0x52')];_0x2e38e1[_0x2a43('0x53')]=_0x424157[_0x2a43('0x53')];}if(_0x424157[_0x2a43('0x54')]){_0x2e38e1[_0x2a43('0x54')]={'id':_0x424157[_0x2a43('0x54')]['id'],'name':_0x424157['Trunk'][_0x2a43('0x20')],'active':_0x424157[_0x2a43('0x54')]['active'],'callerid':_0x424157[_0x2a43('0x54')][_0x2a43('0x55')]};}if(_0x424157[_0x2a43('0x56')]){_0x2e38e1['Interval']={'id':_0x424157[_0x2a43('0x56')]['id'],'name':_0x424157[_0x2a43('0x56')][_0x2a43('0x20')]};}_0x201ab5[_0x2a43('0x57')](_0x2e38e1);}}_0x2b9f4a({'count':_0x201ab5['length'],'rows':_0x201ab5});});},'VoiceChannels':function(_0x529477){return new Promise(function(_0x4e773b,_0x143364){var _0x3060a5=_['values'](_0x259f70[_0x2a43('0x58')]);_0x4e773b({'count':_0x3060a5['length'],'rows':_0x3060a5});});},'VoiceChannelMixMonitor':function(_0x222bad){var _0x486059=this;return new Promise(function(_0x57e88b,_0x377b98){if(ami[_0x2a43('0xe')]()==![]){return _0x377b98(_0x486059['error'](0x1f4,[config['asterisk']['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x18c12a=schema(properties[_0x2a43('0x5a')])[_0x2a43('0x2')](_0x222bad);if(_0x18c12a[_0x2a43('0x5b')]>0x0){return _0x377b98(_0x486059[_0x2a43('0x19')](0x1f4,_[_0x2a43('0x5c')](_0x18c12a,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x491800=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x58')],{'uniqueid':_0x222bad[_0x2a43('0x5e')]});if(_0x491800&&_0x491800['channel']){var _0x5562f7=util['format'](_0x2a43('0x5f'),_0x222bad[_0x2a43('0x60')]||_0x222bad[_0x2a43('0x5e')],_0x222bad[_0x2a43('0x6')]||'wav');return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x61'),'channel':_0x491800['channel'],'file':_0x5562f7,'options':_0x2a43('0x62')})['then'](function(_0x50d199){var _0x1b9bd8=_['find'](_0x491800['monitors'],{'filename':_0x2a43('0x63')+_0x5562f7[_0x2a43('0x64')]()});if(_[_0x2a43('0x65')](_0x1b9bd8)){_0x491800[_0x2a43('0x66')][_0x2a43('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x5562f7[_0x2a43('0x64')](),'createdAt':moment()[_0x2a43('0x6')](_0x2a43('0x67')),'mixmonitorid':_0x50d199[_0x2a43('0x68')],'status':'rec'});}else{_0x1b9bd8[_0x2a43('0x68')]=_0x50d199[_0x2a43('0x68')];_0x1b9bd8['status']='rec';}_0x57e88b({'code':0xc8,'message':[_0x222bad[_0x2a43('0x5e')],_0x2a43('0x69'),_0x50d199['mixmonitorid']][_0x2a43('0x11')]('\x20'),'mixmonitorid':_0x50d199[_0x2a43('0x68')]});})[_0x2a43('0x18')](function(_0x89e9c6){_0x377b98(_0x486059[_0x2a43('0x19')](0x1f5,[_0x222bad['uniqueid'],_0x89e9c6[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x377b98(_0x486059[_0x2a43('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2cc624){var _0x2c6200=this;return new Promise(function(_0x25eee3,_0x3111ed){if(ami['isConnected']()==![]){return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')]['username'],_0x2a43('0x59')]['join']('\x20')));}var _0x172d1d=schema(properties['voicechannel'])[_0x2a43('0x2')](_0x2cc624);if(_0x172d1d[_0x2a43('0x5b')]>0x0){return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f4,_[_0x2a43('0x5c')](_0x172d1d,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x1d4412=_['find'](_0x259f70['channels'],{'uniqueid':_0x2cc624[_0x2a43('0x5e')]});if(_0x1d4412){return BPromise[_0x2a43('0x6a')]()['then'](function(){if(_0x1d4412[_0x2a43('0x6b')]){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x6c'),'channel':_0x1d4412[_0x2a43('0x6b')],'mixmonitorid':_0x2cc624[_0x2a43('0x68')]})[_0x2a43('0x18')](function(_0x426b56){});}})[_0x2a43('0x16')](function(){if(_0x1d4412['destinationchannel']){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x6c'),'channel':_0x1d4412[_0x2a43('0x6d')],'mixmonitorid':_0x2cc624[_0x2a43('0x68')]})[_0x2a43('0x18')](function(_0xdc55df){});}})['then'](function(_0x14d94b){var _0x93d3a7=_[_0x2a43('0x5d')](_0x1d4412[_0x2a43('0x66')],{'mixmonitorid':_0x2cc624[_0x2a43('0x68')]});if(_0x93d3a7){_0x93d3a7['status']=_0x2a43('0x6e');}})[_0x2a43('0x16')](function(){var _0x1ece61=util['format'](_0x2a43('0x5f'),_0x2cc624[_0x2a43('0x60')]||_0x2cc624[_0x2a43('0x5e')],_0x2cc624[_0x2a43('0x6')]||'wav');var _0x3c1a00=_[_0x2a43('0x5d')](_0x1d4412[_0x2a43('0x66')],{'filename':_0x2a43('0x63')+_0x1ece61[_0x2a43('0x64')]()});if(_0x3c1a00){_0x3c1a00[_0x2a43('0x6f')]=_0x2a43('0x6e');}})[_0x2a43('0x16')](function(){_0x25eee3({'code':0xc8,'message':[_0x2cc624[_0x2a43('0x5e')],_0x2a43('0x70')][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x249032){_0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f5,[_0x2cc624[_0x2a43('0x5e')],_0x249032[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1e2f22){return new Promise(function(_0x5d2d5b,_0x24e037){var _0x5c724c=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x72')]);_0x5d2d5b({'count':_0x5c724c[_0x2a43('0x5b')],'rows':_0x5c724c});});},'VoiceQueuesChannel':function(_0x28eb5d){var _0x355ad9=this;return new Promise(function(_0xe44c44,_0x4cf6af){var _0x4cfd05=schema(properties[_0x2a43('0x73')])['validate'](_0x28eb5d);if(_0x4cfd05[_0x2a43('0x5b')]>0x0){return _0x4cf6af(_0x355ad9['error'](0x1f4,_[_0x2a43('0x5c')](_0x4cfd05,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x477f24=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x28eb5d[_0x2a43('0x5e')]});if(_0x477f24){_0xe44c44(_0x477f24);}else{return _0x4cf6af(_0x355ad9[_0x2a43('0x19')](0x1f5,_0x2a43('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x1cb543){var _0x3609b6=this;return new Promise(function(_0x12e1c0,_0x308721){if(ami[_0x2a43('0xe')]()==![]){return _0x308721(_0x3609b6[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')]['username'],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x3c0f36=schema(properties[_0x2a43('0x75')])[_0x2a43('0x2')](_0x1cb543);if(_0x3c0f36['length']>0x0){return _0x308721(_0x3609b6['error'](0x1f4,_[_0x2a43('0x5c')](_0x3c0f36,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x4ced19=_['find'](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x1cb543['uniqueid']});if(_0x4ced19&&_0x4ced19['channel']){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x76'),'channel':_0x4ced19[_0x2a43('0x6b')]})['then'](function(_0x11daed){_0x12e1c0({'code':0xc8,'message':[_0x1cb543['uniqueid'],_0x11daed['message'][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x1daa66){_0x308721(_0x3609b6['error'](0x1f5,[_0x1cb543[_0x2a43('0x5e')],_0x1daa66[_0x2a43('0x17')][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')));});}else{return _0x308721(_0x3609b6[_0x2a43('0x19')](0x1f5,_0x2a43('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x138dac){var _0x25c524=this;return new Promise(function(_0xb5279c,_0x3d8728){if(ami[_0x2a43('0xe')]()==![]){return _0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config['asterisk'][_0x2a43('0x10')],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x57ea39=schema(properties[_0x2a43('0x77')])[_0x2a43('0x2')](_0x138dac);if(_0x57ea39['length']>0x0){return _0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f4,_['map'](_0x57ea39,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x365fc1=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x138dac['uniqueid']});if(_0x365fc1&&_0x365fc1[_0x2a43('0x6b')]){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x78'),'channel':_0x365fc1[_0x2a43('0x6b')],'exten':_0x138dac[_0x2a43('0x79')],'context':_0x138dac[_0x2a43('0x7a')]||_0x365fc1['context'],'priority':0x1})['then'](function(_0x1f9e11){_0xb5279c({'code':0xc8,'message':[_0x138dac[_0x2a43('0x5e')],_0x1f9e11[_0x2a43('0x17')][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x313b6c){_0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f5,[_0x138dac[_0x2a43('0x5e')],_0x313b6c[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x3d8728(_0x25c524['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3e50d6){return new Promise(function(_0x120884,_0x4cfa66){var _0x28cfcb=_[_0x2a43('0x71')](_0x259f70['agents']);_0x120884({'count':_0x28cfcb[_0x2a43('0x5b')],'rows':_0x28cfcb});});},'Telephones':function(_0xeb7100){return new Promise(function(_0x5f17b4,_0x5a1264){var _0x534126=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7b')]);_0x5f17b4({'count':_0x534126[_0x2a43('0x5b')],'rows':_0x534126});});},'Trunks':function(_0x17cdbe){return new Promise(function(_0x5ed9ca,_0x41e905){var _0x316d37=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7c')]);_0x5ed9ca({'count':_0x316d37['length'],'rows':_0x316d37});});},'OutboundChannels':function(_0x1b328f){return new Promise(function(_0x51dacf,_0x1c3eda){var _0x442175=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7d')]);_0x51dacf({'count':_0x442175[_0x2a43('0x5b')],'rows':_0x442175});});},'Outbound':function(_0x46f4c1){return new Promise(function(_0x11cfc9,_0x244ba4){_0x11cfc9(_0x259f70[_0x2a43('0x2d')]);});},'Campaigns':function(_0x1174bf){return new Promise(function(_0x115dda,_0x3b0ece){var _0x3abfe7=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7e')]);_0x115dda({'count':_0x3abfe7[_0x2a43('0x5b')],'rows':_0x3abfe7});});},'VoiceQueuesPreview':function(_0x3e5bd9){var _0x20cd78=this;return new Promise(function(_0x7e2d3,_0x117a69){_0x46d7c6[_0x2a43('0x7f')](_0x3e5bd9['id'])[_0x2a43('0x16')](function(_0x305792){_0x7e2d3({'code':0xc8,'message':_0x305792[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x9207d0){_0x117a69(_0x20cd78[_0x2a43('0x19')](0x1f4,_0x9207d0[_0x2a43('0x17')]));});});},'EventManager':function(_0x69f438){var _0x4806dc=this;return new Promise(function(_0x55e800,_0x5afe6d){if(!_0x69f438['event']){return _0x5afe6d(_0x4806dc[_0x2a43('0x19')](0x1f4,_0x2a43('0x80')));}ami['emit'](_0x2a43('0x81')+_0x69f438[_0x2a43('0x82')],_0x69f438[_0x2a43('0x17')]);_0x55e800({'code':0xc8,'message':_0x69f438});});},'FaxAccounts':function(_0x441468){return new Promise(function(_0xb7a644,_0x7137af){var _0x10da9f=_['values'](_0x259f70[_0x2a43('0x83')]);_0xb7a644({'count':_0x10da9f[_0x2a43('0x5b')],'rows':_0x10da9f});});},'SendFax':function(_0x24f58c){var _0x361779=this;return new Promise(function(_0x1bd89b,_0x47d641){_0xd0af31['send'](_0x24f58c)[_0x2a43('0x16')](function(_0x1ab3de){_0x1bd89b({'code':0xc8,'message':_0x1ab3de['message']});})[_0x2a43('0x18')](function(_0x7629c2){_0x47d641(_0x361779[_0x2a43('0x19')](0x1f4,_0x7629c2[_0x2a43('0x17')]));});});},'CheckAfterSend':function(_0x56de7d){var _0xac68f=this;return new Promise(function(_0x5a2b3c,_0x296d8d){_0xd0af31['checkAfterSend'](_0x56de7d)['then'](function(_0x126f82){_0x5a2b3c({'code':0xc8,'message':_0x126f82[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x19f293){_0x296d8d(_0xac68f['error'](0x1f4,_0x19f293[_0x2a43('0x17')]));});});}};var _0x13706b=jayson['server'](_0x290b82)[_0x2a43('0x84')]();_0x13706b['on'](_0x2a43('0x19'),function(_0x28548c){return _0x235108(_0x28548c);});_0x13706b['listen'](0x232a,_0x2a43('0x85'),function(){console[_0x2a43('0x86')](_0x2a43('0x87'),0x232a);return _0x42fa46(_0x2a43('0x88')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 430078c..500dc6a 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 _0x9131=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','then','createContact'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x9131,0x1a0));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1913('0x0'));var BPromise=require(_0x1913('0x1'));var Redis=require('ioredis');var util=require(_0x1913('0x2'));var config=require(_0x1913('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x1913('0x4'));config[_0x1913('0x5')]=_[_0x1913('0x6')](config[_0x1913('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1913('0x7'))(new Redis(config['redis']));function emit(_0x506d52,_0xd90bd4,_0xbdb879,_0x111f19,_0x2f1fc1){logger['info'](_0x1913('0x8'),_0x506d52,_0xd90bd4['id'],_0xbdb879,_0x111f19,JSON[_0x1913('0x9')](_0x2f1fc1));io['to'](_0xbdb879)['emit'](_0x111f19,_0x2f1fc1);}exports[_0x1913('0xa')]=function(_0x52358f,_0x133592,_0x5771b8,_0x42bb9a){var _0x2b18a8,_0x48a187;var _0x47c037={};var _0x3f722a=Number(_0x5771b8[_0x1913('0xb')]);var _0x38efb9=_0x5771b8[_0x1913('0xc')]?Boolean(Number(_0x5771b8[_0x1913('0xc')])):![];var _0xe8457e;if(_0x42bb9a[_0x1913('0xd')]){_0x47c037['id']=_0x42bb9a['xmd-contactid'];}if(!_0x47c037['id']){_0x47c037[_0x1913('0xe')]=_0x3f722a;_0xe8457e=_0x5771b8[_0x1913('0xf')]&&_0x5771b8['data3']!=='0'?_0x5771b8[_0x1913('0xf')]['split'](','):[_0x1913('0x10')];_0x47c037[_0x1913('0x11')]=_[_0x1913('0x12')](_0xe8457e,function(_0xa73611){var _0x233253={};_0x233253[_0xa73611]=_0x42bb9a[_0x1913('0x13')]?_0x42bb9a[_0x1913('0x14')]:_0x42bb9a['calleridnum'];return _0x233253;});}var _0x489ccf=['id',_0x1913('0x15'),_0x1913('0x16'),'phone',_0x1913('0x17'),_0x1913('0x18'),_0x1913('0xe'),_0x1913('0x19'),_0x1913('0x1a'),_0x1913('0x1b')];var _0x90ddf4=_[_0x1913('0x1c')](_0x489ccf,_0xe8457e);BPromise[_0x1913('0x1d')]()['then'](cmContactRpc[_0x1913('0x1e')]({'attributes':_0x90ddf4,'where':_0x47c037}))['then'](function(_0x399857){_0x48a187=_0x399857;if(!_['isEmpty'](_0x48a187)){if(_0x48a187[_0x1913('0x1f')]===0x1){_0x2b18a8=_0x48a187[0x0];logger[_0x1913('0x20')](_0x1913('0x21'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_0x2b18a8['id']);}else{logger[_0x1913('0x20')](_0x1913('0x23'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_[_0x1913('0x12')](_0x48a187,'id')[_0x1913('0x24')](','));}return;}else{logger[_0x1913('0x20')](_0x1913('0x25'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);var _0xb4af9b={'ListId':_0x3f722a};var _0x529f8e=_0x5771b8['data4']&&_0x5771b8['data4']!=='0'?_0x5771b8[_0x1913('0x26')]:'phone';if(_0x38efb9){logger[_0x1913('0x20')](_0x1913('0x27'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);_0xb4af9b[_0x529f8e]=_[_0x1913('0x28')](_0x42bb9a[_0x1913('0x13')])?_0x42bb9a[_0x1913('0x29')]:_0x42bb9a[_0x1913('0x14')];if(_[_0x1913('0x28')](_0x42bb9a[_0x1913('0x13')])){_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2a')]&&_0x42bb9a[_0x1913('0x2a')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2a')]:_0x1913('0x2c');}else{_0xb4af9b['firstName']=_0x42bb9a[_0x1913('0x2d')]&&_0x42bb9a['destcalleridname']!==''?_0x42bb9a[_0x1913('0x2d')]:_0x1913('0x2c');}return BPromise['resolve']()[_0x1913('0x2e')](cmContactRpc[_0x1913('0x2f')](_0xb4af9b))[_0x1913('0x2e')](function(_0x4087c6){_0x2b18a8=_0x4087c6;_0x48a187[_0x1913('0x30')](_0x4087c6);if(_0x2b18a8){logger['info'](_0x1913('0x31'),_0x42bb9a[_0x1913('0x22')],_0x133592['id'],_0x2b18a8['id']);}return;});}else{logger[_0x1913('0x20')](_0x1913('0x32'),_0x42bb9a[_0x1913('0x22')],_0x133592['id']);_0xb4af9b[_0x529f8e]=_[_0x1913('0x28')](_0x42bb9a['routeId'])?_0x42bb9a[_0x1913('0x29')]:_0x42bb9a[_0x1913('0x14')];if(_[_0x1913('0x28')](_0x42bb9a['routeId'])){_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2a')]&&_0x42bb9a[_0x1913('0x2a')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2a')]:_0x1913('0x2c');}else{_0xb4af9b[_0x1913('0x15')]=_0x42bb9a[_0x1913('0x2d')]&&_0x42bb9a[_0x1913('0x2d')]!==_0x1913('0x2b')?_0x42bb9a[_0x1913('0x2d')]:_0x1913('0x2c');}_0x2b18a8=_0xb4af9b;_0x48a187[_0x1913('0x30')](_0xb4af9b);return;}}})[_0x1913('0x2e')](function(){if(_0x52358f){emit(_0x42bb9a[_0x1913('0x22')],_0x133592,util[_0x1913('0x33')](_0x1913('0x34'),_0x52358f[_0x1913('0x35')]),util[_0x1913('0x33')](_0x1913('0x36'),_0x5771b8[_0x1913('0x37')][_0x1913('0x38')]()),{'evt':_[_0x1913('0x39')](_0x42bb9a,{'autoCreate':_0x38efb9}),'contact':_0x2b18a8===undefined?{}:_0x2b18a8,'contacts':_0x48a187[_0x1913('0x1f')]===0x0?undefined:_0x48a187});}});}; \ No newline at end of file +var _0x32f6=['fax','createdAt','scheduledAt','updatedAt','getContacts','then','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','routeId','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','redis','defaults','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','firstName','mobile'];(function(_0xcdabd0,_0x45b3df){var _0x436a2f=function(_0x251b29){while(--_0x251b29){_0xcdabd0['push'](_0xcdabd0['shift']());}};_0x436a2f(++_0x45b3df);}(_0x32f6,0xc7));var _0x632f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x32f6[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x632f('0x0'));var BPromise=require(_0x632f('0x1'));var Redis=require(_0x632f('0x2'));var util=require(_0x632f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x632f('0x4'))(_0x632f('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x632f('0x6')]=_[_0x632f('0x7')](config[_0x632f('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x632f('0x6')]));function emit(_0x47f652,_0x3e94e6,_0x359fc6,_0x458672,_0x54bf68){logger[_0x632f('0x8')](_0x632f('0x9'),_0x47f652,_0x3e94e6['id'],_0x359fc6,_0x458672,JSON[_0x632f('0xa')](_0x54bf68));io['to'](_0x359fc6)[_0x632f('0xb')](_0x458672,_0x54bf68);}exports[_0x632f('0xc')]=function(_0x49dfb3,_0x200e07,_0x18aea8,_0x3e45a3){var _0x27cfe9,_0x26cd13;var _0xf64f72={};var _0x106fd9=Number(_0x18aea8[_0x632f('0xd')]);var _0x43ddbd=_0x18aea8['data2']?Boolean(Number(_0x18aea8[_0x632f('0xe')])):![];var _0x5aa30c;if(_0x3e45a3[_0x632f('0xf')]){_0xf64f72['id']=_0x3e45a3[_0x632f('0xf')];}if(!_0xf64f72['id']){_0xf64f72[_0x632f('0x10')]=_0x106fd9;_0x5aa30c=_0x18aea8[_0x632f('0x11')]&&_0x18aea8[_0x632f('0x11')]!=='0'?_0x18aea8['data3'][_0x632f('0x12')](','):[_0x632f('0x13')];_0xf64f72[_0x632f('0x14')]=_['map'](_0x5aa30c,function(_0x2ee959){var _0x3a1d62={};_0x3a1d62[_0x2ee959]=_0x3e45a3['routeId']?_0x3e45a3[_0x632f('0x15')]:_0x3e45a3[_0x632f('0x16')];return _0x3a1d62;});}var _0x1c184c=['id',_0x632f('0x17'),'lastName',_0x632f('0x13'),_0x632f('0x18'),_0x632f('0x19'),_0x632f('0x10'),_0x632f('0x1a'),_0x632f('0x1b'),_0x632f('0x1c')];var _0x14c2bc=_['union'](_0x1c184c,_0x5aa30c);BPromise['resolve']()['then'](cmContactRpc[_0x632f('0x1d')]({'attributes':_0x14c2bc,'where':_0xf64f72}))[_0x632f('0x1e')](function(_0x364f77){_0x26cd13=_0x364f77;if(!_[_0x632f('0x1f')](_0x26cd13)){if(_0x26cd13[_0x632f('0x20')]===0x1){_0x27cfe9=_0x26cd13[0x0];logger[_0x632f('0x8')](_0x632f('0x21'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_0x27cfe9['id']);}else{logger[_0x632f('0x8')](_0x632f('0x23'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_[_0x632f('0x24')](_0x26cd13,'id')[_0x632f('0x25')](','));}return;}else{logger[_0x632f('0x8')](_0x632f('0x26'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);var _0x49b01e={'ListId':_0x106fd9};var _0x345274=_0x18aea8[_0x632f('0x27')]&&_0x18aea8[_0x632f('0x27')]!=='0'?_0x18aea8['data4']:'phone';if(_0x43ddbd){logger['info'](_0x632f('0x28'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);_0x49b01e[_0x345274]=_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])?_0x3e45a3[_0x632f('0x16')]:_0x3e45a3['destcalleridnum'];if(_[_0x632f('0x29')](_0x3e45a3['routeId'])){_0x49b01e['firstName']=_0x3e45a3[_0x632f('0x2b')]&&_0x3e45a3[_0x632f('0x2b')]!==''?_0x3e45a3[_0x632f('0x2b')]:_0x632f('0x2c');}else{_0x49b01e[_0x632f('0x17')]=_0x3e45a3[_0x632f('0x2d')]&&_0x3e45a3[_0x632f('0x2d')]!==''?_0x3e45a3['destcalleridname']:_0x632f('0x2c');}return BPromise['resolve']()[_0x632f('0x1e')](cmContactRpc[_0x632f('0x2e')](_0x49b01e))[_0x632f('0x1e')](function(_0x1fc07e){_0x27cfe9=_0x1fc07e;_0x26cd13[_0x632f('0x2f')](_0x1fc07e);if(_0x27cfe9){logger[_0x632f('0x8')](_0x632f('0x30'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_0x27cfe9['id']);}return;});}else{logger[_0x632f('0x8')](_0x632f('0x31'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);_0x49b01e[_0x345274]=_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])?_0x3e45a3[_0x632f('0x16')]:_0x3e45a3['destcalleridnum'];if(_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])){_0x49b01e[_0x632f('0x17')]=_0x3e45a3['calleridname']&&_0x3e45a3[_0x632f('0x2b')]!==_0x632f('0x32')?_0x3e45a3[_0x632f('0x2b')]:_0x632f('0x2c');}else{_0x49b01e['firstName']=_0x3e45a3['destcalleridname']&&_0x3e45a3[_0x632f('0x2d')]!==_0x632f('0x32')?_0x3e45a3[_0x632f('0x2d')]:_0x632f('0x2c');}_0x27cfe9=_0x49b01e;_0x26cd13[_0x632f('0x2f')](_0x49b01e);return;}}})[_0x632f('0x1e')](function(){if(_0x49dfb3){emit(_0x3e45a3['uniqueid'],_0x200e07,util[_0x632f('0x33')]('user:%s',_0x49dfb3[_0x632f('0x34')]),util[_0x632f('0x33')](_0x632f('0x35'),_0x18aea8[_0x632f('0x36')][_0x632f('0x37')]()),{'evt':_['merge'](_0x3e45a3,{'autoCreate':_0x43ddbd}),'contact':_0x27cfe9===undefined?{}:_0x27cfe9,'contacts':_0x26cd13[_0x632f('0x20')]===0x0?undefined:_0x26cd13});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9586b10..f612b4c 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 _0x81a4=['prototype','emit','checkTriggers','hasOwnProperty','status','merge','variables','Actions','interface','action','toLowerCase','motionbar','TemplateId','data2','templates','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','render','winArguments','format','trigger:%s:%s','data1','user:%s','name','contactmanager','exec','queue','routeId','urlforward','script','parse','search','replace','checkTrigger','AllConditions','length','every','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','exports','util','lodash','url','mustache','./urlforward','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage'];(function(_0x444962,_0x4d09a1){var _0x380fb7=function(_0x14bbdd){while(--_0x14bbdd){_0x444962['push'](_0x444962['shift']());}};_0x380fb7(++_0x4d09a1);}(_0x81a4,0x1a6));var _0x481a=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x81a4[_0x2fd160];return _0x5c2031;};'use strict';var util=require(_0x481a('0x0'));var _=require(_0x481a('0x1'));var url=require(_0x481a('0x2'));var Mustache=require(_0x481a('0x3'));var Redis=require('ioredis');var urlforward=require(_0x481a('0x4'));var integration=require('./integration');var cmContact=require(_0x481a('0x5'));var script=require(_0x481a('0x6'));var config=require(_0x481a('0x7'));var logger=require('../../../config/logger')(_0x481a('0x8'));var ami=require(_0x481a('0x9'));config[_0x481a('0xa')]=_[_0x481a('0xb')](config['redis'],{'host':_0x481a('0xc'),'port':0x18eb});var io=require(_0x481a('0xd'))(new Redis(config[_0x481a('0xa')]));var operators={'equals':function(_0xa68200,_0x95b28d){return _0xa68200==_0x95b28d;},'not_equals':function(_0x59580e,_0x47ff1c){return _0x59580e!=_0x47ff1c;}};var barAndWebActions=[_0x481a('0xe'),_0x481a('0x2'),_0x481a('0xf')];function Trigger(_0x1c654b){this[_0x481a('0x10')]=_0x1c654b[_0x481a('0x10')];this[_0x481a('0x11')]=_0x1c654b[_0x481a('0x11')];this[_0x481a('0x12')]=_0x1c654b[_0x481a('0x12')];this['templates']=_0x1c654b['templates'];this[_0x481a('0x13')]=_0x1c654b[_0x481a('0x13')];this[_0x481a('0x14')]=_0x1c654b[_0x481a('0x14')];this[_0x481a('0x15')]=_0x1c654b[_0x481a('0x15')];this['salesforceAccounts']=_0x1c654b[_0x481a('0x16')];this['sugarcrmAccounts']=_0x1c654b[_0x481a('0x17')];this[_0x481a('0x18')]=_0x1c654b[_0x481a('0x18')];this['deskAccounts']=_0x1c654b['deskAccounts'];this[_0x481a('0x19')]=_0x1c654b[_0x481a('0x19')];this[_0x481a('0x1a')]=_0x1c654b[_0x481a('0x1a')];this[_0x481a('0x1b')]=_0x1c654b[_0x481a('0x1b')];this[_0x481a('0x1c')]=_0x1c654b[_0x481a('0x1c')];this[_0x481a('0x1d')]={'zendesk':this[_0x481a('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x481a('0x15')],'sugarcrm':this[_0x481a('0x17')],'zoho':this[_0x481a('0x18')],'desk':this[_0x481a('0x1e')],'vtiger':this[_0x481a('0x19')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x481a('0x1c')],'servicenow':this[_0x481a('0x1a')]};ami['on'](_0x481a('0x1f'),this[_0x481a('0x20')]['bind'](this));ami['on'](_0x481a('0x21'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x23'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x24'),this[_0x481a('0x20')]['bind'](this));ami['on'](_0x481a('0x25'),this[_0x481a('0x20')]['bind'](this));ami['on'](_0x481a('0x26'),this['syncCustomEvent'][_0x481a('0x22')](this));ami['on'](_0x481a('0x27'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on']('custom:agentcongestion',this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x28'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x29'),this['syncCustomEvent'][_0x481a('0x22')](this));ami['on'](_0x481a('0x2a'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on']('custom:dialbegin',this[_0x481a('0x2b')][_0x481a('0x22')](this));ami['on'](_0x481a('0x2c'),this[_0x481a('0x2b')]['bind'](this));ami['on']('custom:dialend',this['syncAgentDial']['bind'](this));ami['on'](_0x481a('0x2d'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on']('custom:closedinteraction',this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x2e'),this['syncCustomEvent'][_0x481a('0x22')](this));ami['on'](_0x481a('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x481a('0x30'),this[_0x481a('0x20')][_0x481a('0x22')](this));ami['on'](_0x481a('0x31'),this[_0x481a('0x20')]['bind'](this));}Trigger[_0x481a('0x32')][_0x481a('0x33')]=function(_0x3c9037,_0x45bd7b,_0x57c894){logger['info'](_0x3c9037,_0x45bd7b,JSON['stringify'](_0x57c894));io['to'](_0x3c9037)[_0x481a('0x33')](_0x45bd7b,_0x57c894);};Trigger[_0x481a('0x32')]['syncCustomEvent']=function(_0x108fec){var _0x2e284a=_['clone'](_0x108fec);this[_0x481a('0x34')](_0x2e284a);};Trigger['prototype']['syncAgentDial']=function(_0x5d4c4e){if(this[_0x481a('0x11')][_0x5d4c4e['interface']]){this[_0x481a('0x20')](_0x5d4c4e);}};Trigger[_0x481a('0x32')][_0x481a('0x34')]=function(_0x36b9ff){var _0x57fa49;for(var _0x25f115 in this[_0x481a('0x10')]){if(this[_0x481a('0x10')][_0x481a('0x35')](_0x25f115)){if(this[_0x481a('0x10')][_0x25f115][_0x481a('0x36')]){_0x57fa49=this['checkTrigger'](this[_0x481a('0x10')][_0x25f115],_0x36b9ff);if(_0x57fa49){_[_0x481a('0x37')](_0x36b9ff,_0x36b9ff[_0x481a('0x38')]);for(var _0x5e6227=0x0,_0x5b1624,_0x204bb5,_0x1aaafa;_0x5e62270x0){_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(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 2ed8898..37f3b01 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 _0x484b=[']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','outbound','calleridnum','/systemusers(','headers','odata-entityid','lastIndexOf','contacts?$select=telephone1','value','toLowerCase','destcalleridnum','telephone1','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','callDirection','queue','substring','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','remoteUri','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','isNil','validateEmail','length','internalemailaddress','isdisabled','info'];(function(_0x5bcca7,_0x3d99d2){var _0x23cd64=function(_0x3778a8){while(--_0x3778a8){_0x5bcca7['push'](_0x5bcca7['shift']());}};_0x23cd64(++_0x3d99d2);}(_0x484b,0x165));var _0xb484=function(_0x5981a2,_0x5f260e){_0x5981a2=_0x5981a2-0x0;var _0xd68e00=_0x484b[_0x5981a2];return _0xd68e00;};'use strict';var _=require(_0xb484('0x0'));var BPromise=require('bluebird');var rp=require(_0xb484('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0xb484('0x2'));var Redis=require(_0xb484('0x3'));var logger=require('../../../../config/logger')(_0xb484('0x4'));var config=require(_0xb484('0x5'));config[_0xb484('0x6')]=_[_0xb484('0x7')](config[_0xb484('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb484('0x8'))(new Redis(config['redis']));function getAuthToken(_0x16cc40,_0x57fbc3,_0x582065){var _0x5b4ea1={'method':_0xb484('0x9'),'uri':_0x57fbc3,'form':{'client_id':_0x16cc40['clientId'],'resource':_0x16cc40[_0xb484('0xa')],'username':_0x16cc40['username'],'password':_0x16cc40[_0xb484('0xb')],'grant_type':'password','client_secret':_0x16cc40[_0xb484('0xc')]},'json':!![]};return rp(_0x5b4ea1)[_0xb484('0xd')](function(_0x4fb105){return _0x4fb105['access_token'];})[_0xb484('0xe')](function(_0x24bd60){logger['error']('['+[_0x582065[_0xb484('0xf')]()]+_0xb484('0x10'));return _0x24bd60[_0xb484('0x11')];});}function getUser(_0xe3cabb,_0x3ca760,_0x35b535,_0x4875cb,_0x33c741,_0x59fb8f){return new BPromise(function(_0x367d5f,_0x11a272){return getAuthToken(_0x3ca760,_0x4875cb,_0x59fb8f)[_0xb484('0xd')](function(_0x15e5f3){var _0x1582e4={'method':_0xb484('0x12'),'uri':_0x33c741+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xb484('0x13')+_0x15e5f3,'OData-Version':_0xb484('0x14')},'json':!![]};return rp(_0x1582e4);})[_0xb484('0xd')](function(_0x2136c3){var _0x23cdc5=_0x2136c3['value'];var _0x1a6eb4=![];var _0x1b1176=null;if(!_[_0xb484('0x15')](_0x35b535)){if(intUtil[_0xb484('0x16')](_0x35b535['email'])){_0xe3cabb['userEmail']=_0x35b535['email'];for(_0x1b1176=0x0;_0x1b1176<_0x23cdc5[_0xb484('0x17')];_0x1b1176++){if(_0x23cdc5[_0x1b1176][_0xb484('0x18')]===_0x35b535['email']&&!_0x23cdc5[_0x1b1176][_0xb484('0x19')]){_0x1a6eb4=!![];logger[_0xb484('0x1a')]('['+[_0x59fb8f[_0xb484('0xf')]()]+_0xb484('0x1b')+_0x23cdc5[_0x1b1176][_0xb484('0x1c')]+'!');_0xe3cabb[_0xb484('0x1d')]=_0x23cdc5[_0x1b1176]['systemuserid'];}}}}if(!_0x1a6eb4){logger[_0xb484('0x1a')]('['+[_0x59fb8f['toUpperCase']()]+_0xb484('0x1e'));_0xe3cabb[_0xb484('0x1f')]=_0x3ca760['username'];for(_0x1b1176=0x0;_0x1b1176<_0x23cdc5[_0xb484('0x17')];_0x1b1176++){if(_0x23cdc5[_0x1b1176][_0xb484('0x18')]===_0x3ca760[_0xb484('0x20')]){_0xe3cabb[_0xb484('0x1d')]=_0x23cdc5[_0x1b1176][_0xb484('0x1c')];}}}_0x367d5f(_0xe3cabb);})[_0xb484('0xe')](function(_0x5c2099){_0x11a272(_0x5c2099[_0xb484('0x11')]);});});}function createEndUser(_0x2b6d18,_0x321d55,_0x1d205d,_0x39d5bd,_0x5a02b3,_0x593663){return new BPromise(function(_0x149910,_0x3a8548){return getAuthToken(_0x321d55,_0x1d205d,_0x593663)[_0xb484('0xd')](function(_0x46ff2b){var _0x37041e=_0x593663['toLowerCase']()===_0xb484('0x21')?_0x5a02b3['destcalleridnum']:_0x5a02b3[_0xb484('0x22')];var _0x44b8bf={'method':'POST','uri':_0x39d5bd+'contacts','body':{'telephone1':_0x37041e,'fullname':_0x37041e,'firstname':_0x37041e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb484('0x23')+_0x2b6d18[_0xb484('0x1d')]+')'},'headers':{'Authorization':_0xb484('0x13')+_0x46ff2b,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x44b8bf);})[_0xb484('0xd')](function(_0xa469a6){var _0x5c2359=_0xa469a6[_0xb484('0x24')][_0xb484('0x25')];var _0x4f9a90=_0x5c2359['substring'](_0x5c2359[_0xb484('0x26')]('(')+0x1,_0x5c2359[_0xb484('0x26')](')'));_0x2b6d18['enduserId']=_0x4f9a90;_0x149910(_0x2b6d18);})['catch'](function(_0x1a0353){_0x3a8548(_0x1a0353[_0xb484('0x11')]);});});}function getEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13){return new BPromise(function(_0x4554f7,_0x496fa5){return getAuthToken(_0x5c5fe5,_0x5cbd20,_0x3e7e13)['then'](function(_0x522801){var _0x3a64ad={'method':_0xb484('0x12'),'uri':_0x2e2690+_0xb484('0x27'),'headers':{'Authorization':_0xb484('0x13')+_0x522801,'If-None-Match':null,'OData-Version':_0xb484('0x14')},'json':!![]};return rp(_0x3a64ad);})[_0xb484('0xd')](function(_0x21ccae){var _0x4e9f8c=null;if(_0x21ccae){var _0x1022e0=_0x21ccae[_0xb484('0x28')];var _0x1e7fd6=![];for(_0x4e9f8c=0x0;_0x4e9f8c<_0x1022e0[_0xb484('0x17')];_0x4e9f8c++){var _0x60c585=_0x3e7e13[_0xb484('0x29')]()==='outbound'?_0xdd5344[_0xb484('0x2a')]:_0xdd5344['calleridnum'];if(_0x1022e0[_0x4e9f8c][_0xb484('0x2b')]===_0x60c585){_0x1e7fd6=!![];_0x3ccb60[_0xb484('0x2c')]=_0x1022e0[_0x4e9f8c]['contactid'];}}if(_0x1e7fd6){_0x4554f7(_0x3ccb60);}else{return createEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13)[_0xb484('0xd')](function(_0x168eb5){logger['info']('['+[_0x3e7e13[_0xb484('0xf')]()]+_0xb484('0x2d'),_0x168eb5[_0xb484('0x2c')]);_0x4554f7(_0x168eb5);});}}else{return createEndUser(_0x3ccb60,_0x5c5fe5,_0x5cbd20,_0x2e2690,_0xdd5344,_0x3e7e13)[_0xb484('0xd')](function(_0x2f0e59){logger[_0xb484('0x1a')]('['+[_0x3e7e13['toUpperCase']()]+_0xb484('0x2e'),_0x2f0e59[_0xb484('0x2c')]);_0x4554f7(_0x2f0e59);});}});});}function getCustomFields(_0x335f84,_0x2576cf,_0x592b3e){var _0x15cab3={};if(_0x335f84[_0xb484('0x17')]>0x0){_[_0xb484('0x2f')](_0x335f84,function(_0xedef63){if(_0xedef63[_0xb484('0x30')]===_0xb484('0x31')&&_0xedef63[_0xb484('0x32')]&&!_0xedef63[_0xb484('0x33')]){var _0x2bef6c=_0xedef63[_0xb484('0x34')][_0xb484('0x29')]();var _0x35448c=_0x2bef6c['substring'](0x0,_0x2bef6c['indexOf']('_'));var _0x30f98f=_0x2bef6c['substring'](_0x2bef6c[_0xb484('0x35')]('_')+0x1);if(_0x35448c===_0x592b3e){_0x15cab3[_0x30f98f]=_0xedef63[_0xb484('0x36')];}}});}return _0x15cab3;}function getTicket(_0x44e7e3,_0xd6580c,_0x3812c4,_0x477cf6,_0x2ca9fb,_0x4b62e,_0x463be0){return new BPromise(function(_0x50ff71,_0x526880){var _0x54a3a4;return getAuthToken(_0xd6580c,_0x3812c4,_0x463be0)['then'](function(_0x4a8740){if(_0x4b62e[_0xb484('0x37')]===_0xb484('0x38')){_0x54a3a4={'method':'POST','uri':_0x477cf6+_0xb484('0x39'),'body':Object['assign']({},{'title':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3b')],_0x2ca9fb,'\x20'),'description':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3c')],_0x2ca9fb,'\x0a'),'customerid_contact@odata.bind':_0xb484('0x3d')+_0x44e7e3[_0xb484('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x44e7e3[_0xb484('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x4b62e[_0xb484('0x3e')],_0x2ca9fb,_0x4b62e[_0xb484('0x37')])),'headers':{'Authorization':_0xb484('0x13')+_0x4a8740,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4b62e[_0xb484('0x37')]===_0xb484('0x3f')){_0x54a3a4={'method':_0xb484('0x9'),'uri':_0x477cf6+_0xb484('0x40'),'body':Object[_0xb484('0x41')]({},{'subject':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3b')],_0x2ca9fb,'\x20'),'phonenumber':String(_0x2ca9fb[_0xb484('0x22')]),'description':intUtil[_0xb484('0x3a')](_0x4b62e[_0xb484('0x3c')],_0x2ca9fb,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x44e7e3[_0xb484('0x2c')]+')','ownerid@odata.bind':_0xb484('0x23')+_0x44e7e3['userId']+')','directioncode':_0x44e7e3['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xb484('0x23')+_0x44e7e3[_0xb484('0x1d')]+')','participationtypemask':_0x44e7e3[_0xb484('0x42')]===_0xb484('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x44e7e3[_0xb484('0x2c')]+')','participationtypemask':_0x44e7e3[_0xb484('0x42')]===_0xb484('0x43')?0x1:0x2}]},getCustomFields(_0x4b62e[_0xb484('0x3e')],_0x2ca9fb,_0x4b62e[_0xb484('0x37')])),'headers':{'Authorization':_0xb484('0x13')+_0x4a8740,'OData-Version':_0xb484('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x54a3a4);})[_0xb484('0xd')](function(_0x378a44){var _0x41d35f=_0x378a44[_0xb484('0x24')][_0xb484('0x25')];var _0x453502=_0x41d35f[_0xb484('0x44')](_0x41d35f['lastIndexOf']('(')+0x1,_0x41d35f[_0xb484('0x26')](')'));_0x44e7e3[_0xb484('0x45')]=_0x453502;_0x50ff71(_0x44e7e3);})[_0xb484('0xe')](function(_0x5d0d1b){_0x526880(_0x5d0d1b['message']);});});}function emit(_0x190621,_0x3e3a79,_0x3ce2ae,_0x442c66){var _0x8f68c1={'uri':util[_0xb484('0x46')](_0xb484('0x47'),_0x190621,_0x3ce2ae,_0x442c66)};io['to'](util['format'](_0xb484('0x48'),_0x3e3a79))[_0xb484('0x49')](_0xb484('0x4a'),_0x8f68c1);}exports['cs']=function(_0x230286,_0xacf400,_0x17680a,_0x3b473f,_0x2d7749,_0x39ea28,_0x4da989,_0x68f87c){var _0xe65f71={};_0x39ea28[_0xb484('0xa')]=intUtil['stripTrailingSlash'](_0x39ea28[_0xb484('0xa')]);_0x39ea28[_0xb484('0x4b')]=intUtil[_0xb484('0x4c')](_0x39ea28['serverUrl']);_0xe65f71[_0xb484('0x42')]=_0x68f87c===_0xb484('0x43')||_0x68f87c===_0xb484('0x4d')?_0xb484('0x43'):_0xb484('0x21');var _0x475552=util[_0xb484('0x46')](_0xb484('0x4e'),_0x39ea28[_0xb484('0xa')]);var _0x4e2b71=util[_0xb484('0x46')](_0xb484('0x4f'),_0x39ea28[_0xb484('0x50')]);var _0x12b611=util[_0xb484('0x46')](_0xb484('0x51'),_0x39ea28['serverUrl'],_0xacf400[_0xb484('0x52')],md5(_0xacf400[_0xb484('0x52')]));if(_0x2d7749&&_0x2d7749[_0xb484('0x53')]){logger[_0xb484('0x1a')]('[QUEUE]',_0xb484('0x54'));_0xacf400[_0xb484('0x55')]=_0x12b611;}else if(_0x4da989&&_0x4da989[_0xb484('0x56')]&&_0x4da989[_0xb484('0x56')]!==_0xb484('0x57')){logger[_0xb484('0x1a')]('[OUTBOUND]',_0xb484('0x54'));_0xacf400['recordingURL']=_0x12b611;}else{_0xacf400[_0xb484('0x55')]='';}return getUser(_0xe65f71,_0x39ea28,_0x3b473f,_0x4e2b71,_0x475552,_0x68f87c)[_0xb484('0xd')](function(_0xdcfd45){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x58'),_0xdcfd45[_0xb484('0x1d')]);logger[_0xb484('0x1a')]('['+_0x68f87c['toUpperCase']()+_0xb484('0x59'),_0xdcfd45[_0xb484('0x1f')]);return getEndUser(_0xdcfd45,_0x39ea28,_0x4e2b71,_0x475552,_0xacf400,_0x68f87c);})[_0xb484('0xd')](function(_0x3a8089){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5a'),_0x3a8089[_0xb484('0x2c')]);logger[_0xb484('0x1a')]('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5b'),_0xacf400[_0xb484('0x22')]);return getTicket(_0x3a8089,_0x39ea28,_0x4e2b71,_0x475552,_0xacf400,_0x17680a,_0x68f87c);})[_0xb484('0xd')](function(_0x23e0b6){logger['info'](util[_0xb484('0x46')]('['+_0x68f87c[_0xb484('0xf')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x17680a['ticketType'],_0x23e0b6[_0xb484('0x45')]));logger[_0xb484('0x1a')](util[_0xb484('0x46')]('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5c'),_0x68f87c));if(_0x68f87c!==_0xb484('0x4d')){logger['info']('['+_0x68f87c[_0xb484('0xf')]()+']',_0xb484('0x5d'));emit(_0x39ea28[_0xb484('0xa')],_0x3b473f['name'],_0x17680a[_0xb484('0x37')],_0x23e0b6[_0xb484('0x45')]);}})['catch'](function(_0x426f59){logger['error']('['+_0x68f87c[_0xb484('0xf')]()+_0xb484('0x5e'),util[_0xb484('0x5f')](_0x426f59,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0f87=['/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','outbound','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','Fields','ticketType','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','email','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','toLowerCase','destcalleridnum','calleridnum','contacts'];(function(_0x51be6e,_0x52350f){var _0x69efe=function(_0x465d62){while(--_0x465d62){_0x51be6e['push'](_0x51be6e['shift']());}};_0x69efe(++_0x52350f);}(_0x0f87,0x1bc));var _0x70f8=function(_0x57e13c,_0x4ded5b){_0x57e13c=_0x57e13c-0x0;var _0x31140b=_0x0f87[_0x57e13c];return _0x31140b;};'use strict';var _=require('lodash');var BPromise=require(_0x70f8('0x0'));var rp=require(_0x70f8('0x1'));var util=require('util');var intUtil=require(_0x70f8('0x2'));var md5=require('md5');var Redis=require(_0x70f8('0x3'));var logger=require(_0x70f8('0x4'))(_0x70f8('0x5'));var config=require(_0x70f8('0x6'));config['redis']=_[_0x70f8('0x7')](config[_0x70f8('0x8')],{'host':_0x70f8('0x9'),'port':0x18eb});var io=require(_0x70f8('0xa'))(new Redis(config['redis']));function getAuthToken(_0x41f164,_0xd148e4,_0x570c12){var _0x80790c={'method':_0x70f8('0xb'),'uri':_0xd148e4,'form':{'client_id':_0x41f164[_0x70f8('0xc')],'resource':_0x41f164[_0x70f8('0xd')],'username':_0x41f164[_0x70f8('0xe')],'password':_0x41f164[_0x70f8('0xf')],'grant_type':'password','client_secret':_0x41f164[_0x70f8('0x10')]},'json':!![]};return rp(_0x80790c)[_0x70f8('0x11')](function(_0x48a348){return _0x48a348[_0x70f8('0x12')];})['catch'](function(_0x510d16){logger[_0x70f8('0x13')]('['+[_0x570c12[_0x70f8('0x14')]()]+_0x70f8('0x15'));return _0x510d16[_0x70f8('0x16')];});}function getUser(_0x544069,_0x1cae8f,_0x57e244,_0x59428c,_0x5e78e1,_0x4ca8f0){return new BPromise(function(_0x277d13,_0x3dff6b){return getAuthToken(_0x1cae8f,_0x59428c,_0x4ca8f0)['then'](function(_0xc68278){var _0x34952c={'method':_0x70f8('0x17'),'uri':_0x5e78e1+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x70f8('0x18')+_0xc68278,'OData-Version':_0x70f8('0x19')},'json':!![]};return rp(_0x34952c);})[_0x70f8('0x11')](function(_0x4571c4){var _0x4274cc=_0x4571c4[_0x70f8('0x1a')];var _0x58201e=![];var _0x5f5790=null;if(!_[_0x70f8('0x1b')](_0x57e244)){if(intUtil['validateEmail'](_0x57e244[_0x70f8('0x1c')])){_0x544069['userEmail']=_0x57e244[_0x70f8('0x1c')];for(_0x5f5790=0x0;_0x5f5790<_0x4274cc[_0x70f8('0x1d')];_0x5f5790++){if(_0x4274cc[_0x5f5790]['internalemailaddress']===_0x57e244[_0x70f8('0x1c')]&&!_0x4274cc[_0x5f5790]['isdisabled']){_0x58201e=!![];logger[_0x70f8('0x1e')]('['+[_0x4ca8f0[_0x70f8('0x14')]()]+_0x70f8('0x1f')+_0x4274cc[_0x5f5790][_0x70f8('0x20')]+'!');_0x544069[_0x70f8('0x21')]=_0x4274cc[_0x5f5790]['systemuserid'];}}}}if(!_0x58201e){logger[_0x70f8('0x1e')]('['+[_0x4ca8f0[_0x70f8('0x14')]()]+_0x70f8('0x22'));_0x544069[_0x70f8('0x23')]=_0x1cae8f[_0x70f8('0xe')];for(_0x5f5790=0x0;_0x5f5790<_0x4274cc['length'];_0x5f5790++){if(_0x4274cc[_0x5f5790]['internalemailaddress']===_0x1cae8f[_0x70f8('0xe')]){_0x544069['userId']=_0x4274cc[_0x5f5790][_0x70f8('0x20')];}}}_0x277d13(_0x544069);})[_0x70f8('0x24')](function(_0x53ec6e){_0x3dff6b(_0x53ec6e[_0x70f8('0x16')]);});});}function createEndUser(_0x24ecf6,_0x2f714b,_0x185cc4,_0xf0eb8c,_0x11fee6,_0x1c3d73){return new BPromise(function(_0x3eac72,_0x3a6864){return getAuthToken(_0x2f714b,_0x185cc4,_0x1c3d73)[_0x70f8('0x11')](function(_0x2d76af){var _0x55f378=_0x1c3d73[_0x70f8('0x25')]()==='outbound'?_0x11fee6[_0x70f8('0x26')]:_0x11fee6[_0x70f8('0x27')];var _0x5cf1c4={'method':_0x70f8('0xb'),'uri':_0xf0eb8c+_0x70f8('0x28'),'body':{'telephone1':_0x55f378,'fullname':_0x55f378,'firstname':_0x55f378,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x70f8('0x29')+_0x24ecf6[_0x70f8('0x21')]+')'},'headers':{'Authorization':_0x70f8('0x18')+_0x2d76af,'OData-Version':_0x70f8('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5cf1c4);})['then'](function(_0x217357){var _0x351066=_0x217357['headers'][_0x70f8('0x2a')];var _0x11f3ab=_0x351066[_0x70f8('0x2b')](_0x351066[_0x70f8('0x2c')]('(')+0x1,_0x351066['lastIndexOf'](')'));_0x24ecf6[_0x70f8('0x2d')]=_0x11f3ab;_0x3eac72(_0x24ecf6);})['catch'](function(_0x3187f7){_0x3a6864(_0x3187f7['message']);});});}function getEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850){return new BPromise(function(_0x1760e1,_0x2911a7){return getAuthToken(_0x419e38,_0x3f6a1e,_0x6f2850)[_0x70f8('0x11')](function(_0x1c30ed){var _0x1c8936={'method':_0x70f8('0x17'),'uri':_0x35474e+_0x70f8('0x2e'),'headers':{'Authorization':_0x70f8('0x18')+_0x1c30ed,'If-None-Match':null,'OData-Version':_0x70f8('0x19')},'json':!![]};return rp(_0x1c8936);})[_0x70f8('0x11')](function(_0x22bc0c){var _0x56e652=null;if(_0x22bc0c){var _0x20f568=_0x22bc0c[_0x70f8('0x1a')];var _0x5b6891=![];for(_0x56e652=0x0;_0x56e652<_0x20f568[_0x70f8('0x1d')];_0x56e652++){var _0x2feac3=_0x6f2850['toLowerCase']()===_0x70f8('0x2f')?_0x4905bb['destcalleridnum']:_0x4905bb['calleridnum'];if(_0x20f568[_0x56e652]['telephone1']===_0x2feac3){_0x5b6891=!![];_0x52204c[_0x70f8('0x2d')]=_0x20f568[_0x56e652][_0x70f8('0x30')];}}if(_0x5b6891){_0x1760e1(_0x52204c);}else{return createEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850)[_0x70f8('0x11')](function(_0x2abbe4){logger[_0x70f8('0x1e')]('['+[_0x6f2850[_0x70f8('0x14')]()]+_0x70f8('0x31'),_0x2abbe4[_0x70f8('0x2d')]);_0x1760e1(_0x2abbe4);});}}else{return createEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850)[_0x70f8('0x11')](function(_0x546191){logger[_0x70f8('0x1e')]('['+[_0x6f2850[_0x70f8('0x14')]()]+_0x70f8('0x32'),_0x546191['enduserId']);_0x1760e1(_0x546191);});}});});}function getCustomFields(_0x279c00,_0x27093b,_0x3a319d){var _0x170b1a={};if(_0x279c00[_0x70f8('0x1d')]>0x0){_[_0x70f8('0x33')](_0x279c00,function(_0x261b39){if(_0x261b39[_0x70f8('0x34')]==='string'&&_0x261b39[_0x70f8('0x35')]&&!_0x261b39[_0x70f8('0x36')]){var _0x16a891=_0x261b39[_0x70f8('0x37')]['toLowerCase']();var _0x3b8bc4=_0x16a891[_0x70f8('0x2b')](0x0,_0x16a891['indexOf']('_'));var _0x1bd194=_0x16a891[_0x70f8('0x2b')](_0x16a891[_0x70f8('0x38')]('_')+0x1);if(_0x3b8bc4===_0x3a319d){_0x170b1a[_0x1bd194]=_0x261b39[_0x70f8('0x39')];}}});}return _0x170b1a;}function getTicket(_0x245d1f,_0x87f3e1,_0x1601e2,_0x269619,_0x2f3ec1,_0x1f0432,_0x4209fc){return new BPromise(function(_0x3d1caf,_0x4cdfe9){var _0x5aa6ed;return getAuthToken(_0x87f3e1,_0x1601e2,_0x4209fc)['then'](function(_0x407ab9){if(_0x1f0432['ticketType']===_0x70f8('0x3a')){_0x5aa6ed={'method':'POST','uri':_0x269619+_0x70f8('0x3b'),'body':Object[_0x70f8('0x3c')]({},{'title':intUtil[_0x70f8('0x3d')](_0x1f0432['Subjects'],_0x2f3ec1,'\x20'),'description':intUtil[_0x70f8('0x3d')](_0x1f0432[_0x70f8('0x3e')],_0x2f3ec1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x245d1f[_0x70f8('0x2d')]+')','ownerid@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1f0432[_0x70f8('0x3f')],_0x2f3ec1,_0x1f0432['ticketType'])),'headers':{'Authorization':_0x70f8('0x18')+_0x407ab9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1f0432[_0x70f8('0x40')]===_0x70f8('0x41')){_0x5aa6ed={'method':'POST','uri':_0x269619+_0x70f8('0x42'),'body':Object[_0x70f8('0x3c')]({},{'subject':intUtil[_0x70f8('0x3d')](_0x1f0432[_0x70f8('0x43')],_0x2f3ec1,'\x20'),'phonenumber':String(_0x2f3ec1[_0x70f8('0x27')]),'description':intUtil[_0x70f8('0x3d')](_0x1f0432['Descriptions'],_0x2f3ec1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x70f8('0x44')+_0x245d1f[_0x70f8('0x2d')]+')','ownerid@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','directioncode':_0x245d1f['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','participationtypemask':_0x245d1f[_0x70f8('0x45')]===_0x70f8('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x70f8('0x44')+_0x245d1f[_0x70f8('0x2d')]+')','participationtypemask':_0x245d1f['callDirection']===_0x70f8('0x46')?0x1:0x2}]},getCustomFields(_0x1f0432[_0x70f8('0x3f')],_0x2f3ec1,_0x1f0432[_0x70f8('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x407ab9,'OData-Version':_0x70f8('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5aa6ed);})['then'](function(_0x3590b2){var _0x59db64=_0x3590b2['headers'][_0x70f8('0x2a')];var _0x4ffc17=_0x59db64[_0x70f8('0x2b')](_0x59db64['lastIndexOf']('(')+0x1,_0x59db64[_0x70f8('0x2c')](')'));_0x245d1f['ticketId']=_0x4ffc17;_0x3d1caf(_0x245d1f);})[_0x70f8('0x24')](function(_0x21eab9){_0x4cdfe9(_0x21eab9[_0x70f8('0x16')]);});});}function emit(_0x4e8d66,_0x4cd7e3,_0x151b87,_0x200b50){var _0x31fba7={'uri':util[_0x70f8('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4e8d66,_0x151b87,_0x200b50)};io['to'](util[_0x70f8('0x47')](_0x70f8('0x48'),_0x4cd7e3))[_0x70f8('0x49')](_0x70f8('0x4a'),_0x31fba7);}exports['cs']=function(_0x175d4f,_0x12fa7e,_0x187176,_0x48b6c3,_0x3cf793,_0xab7627,_0x232a53,_0x420bc8){var _0x119282={};_0xab7627[_0x70f8('0xd')]=intUtil[_0x70f8('0x4b')](_0xab7627[_0x70f8('0xd')]);_0xab7627['serverUrl']=intUtil[_0x70f8('0x4b')](_0xab7627[_0x70f8('0x4c')]);_0x119282[_0x70f8('0x45')]=_0x420bc8===_0x70f8('0x46')||_0x420bc8===_0x70f8('0x4d')?_0x70f8('0x46'):'outbound';var _0x3f8ca3=util[_0x70f8('0x47')](_0x70f8('0x4e'),_0xab7627[_0x70f8('0xd')]);var _0x152c8e=util[_0x70f8('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0xab7627[_0x70f8('0x4f')]);var _0xee74ca=util[_0x70f8('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xab7627['serverUrl'],_0x12fa7e['uniqueid'],md5(_0x12fa7e[_0x70f8('0x50')]));if(_0x3cf793&&_0x3cf793[_0x70f8('0x51')]){logger[_0x70f8('0x1e')]('[QUEUE]',_0x70f8('0x52'));_0x12fa7e[_0x70f8('0x53')]=_0xee74ca;}else if(_0x232a53&&_0x232a53[_0x70f8('0x54')]&&_0x232a53['recordingFormat']!==_0x70f8('0x55')){logger['info'](_0x70f8('0x56'),'Recording\x20is\x20enabled!');_0x12fa7e['recordingURL']=_0xee74ca;}else{_0x12fa7e[_0x70f8('0x53')]='';}return getUser(_0x119282,_0xab7627,_0x48b6c3,_0x152c8e,_0x3f8ca3,_0x420bc8)[_0x70f8('0x11')](function(_0x48605e){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x57'),_0x48605e[_0x70f8('0x21')]);logger[_0x70f8('0x1e')]('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x58'),_0x48605e[_0x70f8('0x23')]);return getEndUser(_0x48605e,_0xab7627,_0x152c8e,_0x3f8ca3,_0x12fa7e,_0x420bc8);})[_0x70f8('0x11')](function(_0x4e9d9d){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x59'),_0x4e9d9d[_0x70f8('0x2d')]);logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x5a'),_0x12fa7e[_0x70f8('0x27')]);return getTicket(_0x4e9d9d,_0xab7627,_0x152c8e,_0x3f8ca3,_0x12fa7e,_0x187176,_0x420bc8);})[_0x70f8('0x11')](function(_0x111ccb){logger['info'](util[_0x70f8('0x47')]('['+_0x420bc8[_0x70f8('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x187176['ticketType'],_0x111ccb[_0x70f8('0x5b')]));logger[_0x70f8('0x1e')](util[_0x70f8('0x47')]('['+_0x420bc8['toUpperCase']()+_0x70f8('0x5c'),_0x420bc8));if(_0x420bc8!==_0x70f8('0x4d')){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+']',_0x70f8('0x5d'));emit(_0xab7627[_0x70f8('0xd')],_0x48b6c3[_0x70f8('0x5e')],_0x187176['ticketType'],_0x111ccb[_0x70f8('0x5b')]);}})[_0x70f8('0x24')](function(_0x238423){logger[_0x70f8('0x13')]('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x5f'),util[_0x70f8('0x60')](_0x238423,{'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 b5862e9..8bfd4b0 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 _0xc91a=['[OUTBOUND]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','type','string','nameField','customField','toLowerCase','idField','content','variable','variableName','push','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3c5b3b,_0x4f8041){var _0x4ea5e5=function(_0x2fdf2b){while(--_0x2fdf2b){_0x3c5b3b['push'](_0x3c5b3b['shift']());}};_0x4ea5e5(++_0x4f8041);}(_0xc91a,0x128));var _0xac91=function(_0x751c5a,_0x18dc27){_0x751c5a=_0x751c5a-0x0;var _0x5d2292=_0xc91a[_0x751c5a];return _0x5d2292;};'use strict';var _=require(_0xac91('0x0'));var rp=require(_0xac91('0x1'));var md5=require(_0xac91('0x2'));var util=require(_0xac91('0x3'));var Redis=require(_0xac91('0x4'));var intUtil=require('./util');var config=require(_0xac91('0x5'));var logger=require(_0xac91('0x6'))(_0xac91('0x7'));config[_0xac91('0x8')]=_['defaults'](config['redis'],{'host':_0xac91('0x9'),'port':0x18eb});var io=require(_0xac91('0xa'))(new Redis(config[_0xac91('0x8')]));var headers={'Content-Type':_0xac91('0xb'),'Accept':'application/json'};function emit(_0x4b3a8b,_0x3133f1,_0x30a8ea){io['to'](_0x4b3a8b)[_0xac91('0xc')](_0x3133f1,_0x30a8ea);}function getTicket(_0x2bc21f,_0x3a9bb2,_0x5c70b4,_0x48b065,_0x4c53be){logger[_0xac91('0xd')]('Creating\x20new\x20ticket...');var _0x35fb98=_[_0xac91('0xe')]({'responder_id':_0x3a9bb2['id'],'requester_id':_0x5c70b4['id'],'name':util[_0xac91('0xf')](_0xac91('0x10'),_0x4c53be[_0xac91('0x11')]),'phone':_0x4c53be[_0xac91('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xac91('0x13')](_0x48b065[_0xac91('0x14')],_0x4c53be,'\x20'),'description':intUtil['getString'](_0x48b065[_0xac91('0x15')],_0x4c53be,_0xac91('0x16')),'tags':getTags(_0x48b065[_0xac91('0x17')],_0xac91('0x18'))},getCustomFields(_0x48b065[_0xac91('0x19')],_0x4c53be));_0x35fb98[_0xac91('0x1a')]=_[_0xac91('0x1b')](_[_0xac91('0x1c')](_0x35fb98[_0xac91('0x1a')],'id'),_0xac91('0x1d'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x1e'),_0x2bc21f[_0xac91('0x1f')]),'method':_0xac91('0x20'),'body':_0x35fb98})[_0xac91('0x21')](function(_0x4acebc){logger['info'](_0xac91('0x22'));return _0x4acebc;});}function getUser(_0x3c3952,_0x45bd5a){if(intUtil[_0xac91('0x23')](_0x45bd5a)){return request({'uri':util[_0xac91('0xf')]('%s/api/v2/agents',_0x3c3952[_0xac91('0x1f')]),'qs':{'email':_0x45bd5a}})[_0xac91('0x21')](function(_0x31e512){if(_0x31e512[_0xac91('0x24')]){logger[_0xac91('0xd')](_0xac91('0x25'));return _['find'](_0x31e512,function(_0x594ef7){return _0x594ef7['contact'][_0xac91('0x26')]===_0x45bd5a;});}else{logger[_0xac91('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xac91('0xf')]('%s/api/v2/agents/me',_0x3c3952[_0xac91('0x1f')])})[_0xac91('0x21')](function(_0x48e99a){logger[_0xac91('0xd')](_0xac91('0x27'));return _0x48e99a;});}});}else{logger[_0xac91('0xd')](_0xac91('0x28'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x29'),_0x3c3952[_0xac91('0x1f')])})['then'](function(_0x42915d){logger[_0xac91('0xd')](_0xac91('0x27'));return _0x42915d;});}}function getEndUser(_0x1a188f,_0x59e059,_0x419642){logger[_0xac91('0xd')](_0xac91('0x2a'),_0x419642);return request({'uri':util[_0xac91('0xf')](_0xac91('0x2b'),_0x1a188f[_0xac91('0x1f')]),'qs':{'phone':_0x419642}})[_0xac91('0x21')](function(_0x2221d6){if(_0x2221d6[_0xac91('0x24')]){logger[_0xac91('0xd')](_0xac91('0x2c'));return _['find'](_0x2221d6,{'phone':_0x419642});}else{logger['info'](_0xac91('0x2d'));return request({'uri':util[_0xac91('0xf')](_0xac91('0x2b'),_0x1a188f[_0xac91('0x1f')]),'method':_0xac91('0x20'),'body':{'name':_0x59e059,'phone':_0x419642}})[_0xac91('0x21')](function(_0x847edb){logger[_0xac91('0xd')](_0xac91('0x2e'));return _0x847edb;});}});}function getAuth(_0x329599){return util[_0xac91('0xf')](_0xac91('0x2f'),new Buffer(_0x329599[_0xac91('0x30')]+':X')[_0xac91('0x31')](_0xac91('0x32')));}function request(_0x1fc6f5){logger[_0xac91('0x33')](_0xac91('0x34'),JSON['stringify'](_0x1fc6f5));return rp(_[_0xac91('0x35')](_0x1fc6f5,{'method':_0xac91('0x36'),'headers':headers,'json':!![]}));}function getTags(_0xd36cec,_0x251482){var _0x1f3155=[];if(_0xd36cec&&_0xd36cec[_0xac91('0x24')]>0x0){_0x1f3155=_[_0xac91('0x37')](_0xd36cec,_0x251482);}return _0x1f3155;}function getCustomFields(_0x138b56,_0x36838b){var _0x548c03=[];var _0x4808e8={'custom_fields':[]};if(_0x138b56['length']>0x0){_[_0xac91('0x38')](_0x138b56,function(_0x3cff71){if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x3a')&&_0x3cff71[_0xac91('0x3b')]&&!_0x3cff71[_0xac91('0x3c')]){_0x4808e8[_0x3cff71[_0xac91('0x3b')][_0xac91('0x3d')]()]=_0x3cff71['content'][_0xac91('0x31')]();}else if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x3a')&&_0x3cff71[_0xac91('0x3e')]&&_0x3cff71[_0xac91('0x3c')]){_0x4808e8[_0xac91('0x1a')]['push']({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x3cff71[_0xac91('0x3f')]['toString']()});}else if(_0x3cff71[_0xac91('0x39')]===_0xac91('0x40')&&_0x3cff71[_0xac91('0x41')]&&_0x3cff71['idField']&&_0x3cff71[_0xac91('0x3c')]){_0x36838b[_0x3cff71['variableName']]&&_0x4808e8[_0xac91('0x1a')][_0xac91('0x42')]({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x36838b[_0x3cff71[_0xac91('0x41')]][_0xac91('0x31')]()});}else if(_0x3cff71['type']==='customVariable'&&_0x3cff71['Variable']&&_0x3cff71['Variable']['name']&&_0x3cff71['idField']&&_0x3cff71[_0xac91('0x3c')]){_0x36838b[_0x3cff71['Variable'][_0xac91('0x18')]['toLowerCase']()]&&_0x4808e8[_0xac91('0x1a')][_0xac91('0x42')]({'id':_0x3cff71[_0xac91('0x3e')],'value':_0x36838b[_0x3cff71[_0xac91('0x43')][_0xac91('0x18')][_0xac91('0x3d')]()][_0xac91('0x31')]()});}});}return _0x4808e8;}exports['queue']=function(_0x5dead6,_0x32ec06,_0x5b3b68,_0x361c69,_0x54cb82,_0x5bbc07){var _0x386dfe,_0x1b1513;_0x5bbc07[_0xac91('0x1f')]=intUtil['stripTrailingSlash'](_0x5bbc07[_0xac91('0x1f')]);_0x5bbc07[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x5bbc07[_0xac91('0x44')]);if(_0x54cb82&&_0x54cb82[_0xac91('0x46')]){logger[_0xac91('0xd')](_0xac91('0x47'),_0xac91('0x48'));_0x32ec06[_0xac91('0x49')]=util[_0xac91('0xf')](_0xac91('0x4a'),_0x5bbc07['serverUrl'],_0x32ec06[_0xac91('0x4b')],md5(_0x32ec06[_0xac91('0x4b')]));}else{_0x32ec06[_0xac91('0x49')]='';}headers['Authorization']=getAuth(_0x5bbc07);return getUser(_0x5bbc07,_0x361c69[_0xac91('0x26')])[_0xac91('0x21')](function(_0x1baaf1){_0x386dfe=_0x1baaf1;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x386dfe['id']);return getEndUser(_0x5bbc07,_0x32ec06[_0xac91('0x11')],_0x32ec06[_0xac91('0x12')]);})[_0xac91('0x21')](function(_0x506c72){_0x1b1513=_0x506c72;logger[_0xac91('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1b1513['id']);return getTicket(_0x5bbc07,_0x386dfe,_0x1b1513,_0x5b3b68,_0x32ec06);})[_0xac91('0x21')](function(_0x4b4ec8){if(_0x4b4ec8&&_0x4b4ec8['id']){logger[_0xac91('0xd')](_0xac91('0x22'));logger[_0xac91('0xd')](_0xac91('0x4d'),_0x4b4ec8['id']);logger[_0xac91('0xd')](_0xac91('0x47'),_0xac91('0x4e'));emit(util[_0xac91('0xf')]('user:%s',_0x361c69[_0xac91('0x18')]),'trigger:browser:url',{'uri':util[_0xac91('0xf')]('%s/helpdesk/tickets/%d',_0x5bbc07[_0xac91('0x1f')],_0x4b4ec8['id'])});}})[_0xac91('0x4f')](function(_0x83437e){logger['error'](_0xac91('0x47'),JSON[_0xac91('0x50')](_0x83437e));});};exports[_0xac91('0x51')]=function(_0x99b594,_0x238968,_0x538720,_0xe80b63,_0x5d2ee3,_0x4fc1ce,_0x38e434){var _0x133ce6,_0x1fb467;_0x4fc1ce[_0xac91('0x1f')]=intUtil[_0xac91('0x45')](_0x4fc1ce['remoteUri']);_0x4fc1ce[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x4fc1ce[_0xac91('0x44')]);if(_0x38e434&&_0x38e434[_0xac91('0x52')]&&_0x38e434[_0xac91('0x52')]!==_0xac91('0x53')){logger[_0xac91('0xd')]('[OUTBOUND]',_0xac91('0x48'));_0x238968[_0xac91('0x49')]=util['format'](_0xac91('0x4a'),_0x4fc1ce['serverUrl'],_0x238968[_0xac91('0x4b')],md5(_0x238968[_0xac91('0x4b')]));}headers[_0xac91('0x54')]=getAuth(_0x4fc1ce);return getUser(_0x4fc1ce,_0xe80b63[_0xac91('0x26')])['then'](function(_0x3e9799){_0x133ce6=_0x3e9799;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x133ce6['id']);return getEndUser(_0x4fc1ce,_0x238968[_0xac91('0x55')],_0x238968[_0xac91('0x56')]);})[_0xac91('0x21')](function(_0x257095){_0x1fb467=_0x257095;logger['info'](_0xac91('0x57'),_0x1fb467['id']);return getTicket(_0x4fc1ce,_0x133ce6,_0x1fb467,_0x538720,_0x238968);})[_0xac91('0x21')](function(_0x928ae4){if(_0x928ae4&&_0x928ae4['id']){logger[_0xac91('0xd')]('Ticket\x20created!');logger['info'](_0xac91('0x4d'),_0x928ae4['id']);logger[_0xac91('0xd')](_0xac91('0x58'),_0xac91('0x4e'));emit(util[_0xac91('0xf')](_0xac91('0x59'),_0xe80b63[_0xac91('0x18')]),_0xac91('0x5a'),{'uri':util[_0xac91('0xf')](_0xac91('0x5b'),_0x4fc1ce[_0xac91('0x1f')],_0x928ae4['id'])});}})[_0xac91('0x4f')](function(_0x206be0){logger[_0xac91('0x5c')]('[OUTBOUND]',JSON[_0xac91('0x50')](_0x206be0));});};exports[_0xac91('0x5d')]=function(_0x420d5a,_0xf370f5,_0x3dfaf3,_0x221ac6,_0x46ddbc,_0x5b3a41){var _0x333f7d,_0x5a3533;_0x5b3a41[_0xac91('0x1f')]=intUtil[_0xac91('0x45')](_0x5b3a41[_0xac91('0x1f')]);_0x5b3a41[_0xac91('0x44')]=intUtil[_0xac91('0x45')](_0x5b3a41[_0xac91('0x44')]);if(_0x46ddbc&&_0x46ddbc['monitor_format']){logger[_0xac91('0xd')]('['+_0xf370f5[_0xac91('0x5e')][_0xac91('0x5f')]()+']','Recording\x20is\x20enabled!');_0xf370f5[_0xac91('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b3a41[_0xac91('0x44')],_0xf370f5[_0xac91('0x4b')],md5(_0xf370f5[_0xac91('0x4b')]));}else{_0xf370f5[_0xac91('0x49')]='';}headers[_0xac91('0x54')]=getAuth(_0x5b3a41);return getUser(_0x5b3a41,'')[_0xac91('0x21')](function(_0x334151){_0x333f7d=_0x334151;logger[_0xac91('0xd')](_0xac91('0x4c'),_0x333f7d['id']);return getEndUser(_0x5b3a41,_0xf370f5['calleridname'],_0xf370f5[_0xac91('0x12')]);})[_0xac91('0x21')](function(_0x374441){_0x5a3533=_0x374441;logger['info'](_0xac91('0x57'),_0x5a3533['id']);return getTicket(_0x5b3a41,_0x333f7d,_0x5a3533,_0x3dfaf3,_0xf370f5);})['then'](function(_0x41aecd){if(_0x41aecd){logger[_0xac91('0xd')](_0xac91('0x22'));logger['info'](_0xac91('0x4d'),_0x41aecd['id']);}})[_0xac91('0x4f')](function(_0x263d42){logger[_0xac91('0x5c')]('['+_0xf370f5[_0xac91('0x5e')][_0xac91('0x5f')]()+']',JSON[_0xac91('0x50')](_0x263d42));});}; \ No newline at end of file +var _0xb135=['name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','[HTTP]','stringify','GET','type','string','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','user:%s','error','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x25e5d1,_0x11e5b9){var _0x4e7d24=function(_0x5774e3){while(--_0x5774e3){_0x25e5d1['push'](_0x25e5d1['shift']());}};_0x4e7d24(++_0x11e5b9);}(_0xb135,0x1b2));var _0x5b13=function(_0x1f83ad,_0x30d5da){_0x1f83ad=_0x1f83ad-0x0;var _0x56a67a=_0xb135[_0x1f83ad];return _0x56a67a;};'use strict';var _=require(_0x5b13('0x0'));var rp=require('request-promise');var md5=require(_0x5b13('0x1'));var util=require(_0x5b13('0x2'));var Redis=require(_0x5b13('0x3'));var intUtil=require(_0x5b13('0x4'));var config=require(_0x5b13('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0x5b13('0x6')]=_[_0x5b13('0x7')](config['redis'],{'host':_0x5b13('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x5b13('0x9'),'Accept':'application/json'};function emit(_0x5e3a0a,_0x74793b,_0x2a7806){io['to'](_0x5e3a0a)[_0x5b13('0xa')](_0x74793b,_0x2a7806);}function getTicket(_0x2d2b9c,_0x353336,_0x1b7f1b,_0x316a48,_0xc90669){logger[_0x5b13('0xb')](_0x5b13('0xc'));var _0x3d5cb4=_[_0x5b13('0xd')]({'responder_id':_0x353336['id'],'requester_id':_0x1b7f1b['id'],'name':util['format'](_0x5b13('0xe'),_0xc90669[_0x5b13('0xf')]),'phone':_0xc90669[_0x5b13('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5b13('0x11')](_0x316a48[_0x5b13('0x12')],_0xc90669,'\x20'),'description':intUtil[_0x5b13('0x11')](_0x316a48[_0x5b13('0x13')],_0xc90669,_0x5b13('0x14')),'tags':getTags(_0x316a48['Tags'],_0x5b13('0x15'))},getCustomFields(_0x316a48[_0x5b13('0x16')],_0xc90669));_0x3d5cb4[_0x5b13('0x17')]=_[_0x5b13('0x18')](_[_0x5b13('0x19')](_0x3d5cb4[_0x5b13('0x17')],'id'),_0x5b13('0x1a'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x1c'),_0x2d2b9c[_0x5b13('0x1d')]),'method':_0x5b13('0x1e'),'body':_0x3d5cb4})[_0x5b13('0x1f')](function(_0x3bb4b9){logger[_0x5b13('0xb')]('Ticket\x20created!');return _0x3bb4b9;});}function getUser(_0x305871,_0x46da8a){if(intUtil[_0x5b13('0x20')](_0x46da8a)){return request({'uri':util[_0x5b13('0x1b')]('%s/api/v2/agents',_0x305871['remoteUri']),'qs':{'email':_0x46da8a}})[_0x5b13('0x1f')](function(_0x282084){if(_0x282084[_0x5b13('0x21')]){logger[_0x5b13('0xb')](_0x5b13('0x22'));return _[_0x5b13('0x23')](_0x282084,function(_0x3a16f3){return _0x3a16f3[_0x5b13('0x24')][_0x5b13('0x25')]===_0x46da8a;});}else{logger[_0x5b13('0xb')](_0x5b13('0x26'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x27'),_0x305871[_0x5b13('0x1d')])})[_0x5b13('0x1f')](function(_0x2ed418){logger[_0x5b13('0xb')]('Admin\x20account\x20selected.');return _0x2ed418;});}});}else{logger[_0x5b13('0xb')](_0x5b13('0x28'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x27'),_0x305871[_0x5b13('0x1d')])})['then'](function(_0xac6f0f){logger[_0x5b13('0xb')](_0x5b13('0x29'));return _0xac6f0f;});}}function getEndUser(_0xfac6,_0x4a0aa5,_0x2356d5){logger[_0x5b13('0xb')]('Searching\x20enduser\x20with\x20phone',_0x2356d5);return request({'uri':util['format'](_0x5b13('0x2a'),_0xfac6[_0x5b13('0x1d')]),'qs':{'phone':_0x2356d5}})[_0x5b13('0x1f')](function(_0xb0d1d){if(_0xb0d1d[_0x5b13('0x21')]){logger[_0x5b13('0xb')](_0x5b13('0x2b'));return _[_0x5b13('0x23')](_0xb0d1d,{'phone':_0x2356d5});}else{logger[_0x5b13('0xb')](_0x5b13('0x2c'));return request({'uri':util['format']('%s/api/v2/contacts',_0xfac6[_0x5b13('0x1d')]),'method':_0x5b13('0x1e'),'body':{'name':_0x4a0aa5,'phone':_0x2356d5}})[_0x5b13('0x1f')](function(_0x3886ce){logger[_0x5b13('0xb')](_0x5b13('0x2d'));return _0x3886ce;});}});}function getAuth(_0x15c3f8){return util[_0x5b13('0x1b')]('Basic\x20%s',new Buffer(_0x15c3f8[_0x5b13('0x2e')]+':X')[_0x5b13('0x2f')]('base64'));}function request(_0x422636){logger['debug'](_0x5b13('0x30'),JSON[_0x5b13('0x31')](_0x422636));return rp(_[_0x5b13('0x7')](_0x422636,{'method':_0x5b13('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x38bc21,_0x1a0075){var _0x1d5574=[];if(_0x38bc21&&_0x38bc21['length']>0x0){_0x1d5574=_['map'](_0x38bc21,_0x1a0075);}return _0x1d5574;}function getCustomFields(_0x28d3af,_0x28d972){var _0xf47ec1=[];var _0x2d44b5={'custom_fields':[]};if(_0x28d3af[_0x5b13('0x21')]>0x0){_['forEach'](_0x28d3af,function(_0x3dba9b){if(_0x3dba9b[_0x5b13('0x33')]===_0x5b13('0x34')&&_0x3dba9b[_0x5b13('0x35')]&&!_0x3dba9b[_0x5b13('0x36')]){_0x2d44b5[_0x3dba9b[_0x5b13('0x35')][_0x5b13('0x37')]()]=_0x3dba9b['content'][_0x5b13('0x2f')]();}else if(_0x3dba9b[_0x5b13('0x33')]==='string'&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b[_0x5b13('0x36')]){_0x2d44b5[_0x5b13('0x17')][_0x5b13('0x39')]({'id':_0x3dba9b['idField'],'value':_0x3dba9b[_0x5b13('0x3a')][_0x5b13('0x2f')]()});}else if(_0x3dba9b['type']===_0x5b13('0x3b')&&_0x3dba9b[_0x5b13('0x3c')]&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b[_0x5b13('0x36')]){_0x28d972[_0x3dba9b['variableName']]&&_0x2d44b5['custom_fields'][_0x5b13('0x39')]({'id':_0x3dba9b[_0x5b13('0x38')],'value':_0x28d972[_0x3dba9b['variableName']]['toString']()});}else if(_0x3dba9b[_0x5b13('0x33')]===_0x5b13('0x3d')&&_0x3dba9b[_0x5b13('0x3e')]&&_0x3dba9b['Variable'][_0x5b13('0x15')]&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b['customField']){_0x28d972[_0x3dba9b['Variable']['name'][_0x5b13('0x37')]()]&&_0x2d44b5[_0x5b13('0x17')][_0x5b13('0x39')]({'id':_0x3dba9b[_0x5b13('0x38')],'value':_0x28d972[_0x3dba9b[_0x5b13('0x3e')][_0x5b13('0x15')]['toLowerCase']()][_0x5b13('0x2f')]()});}});}return _0x2d44b5;}exports[_0x5b13('0x3f')]=function(_0x524eab,_0x1ef26c,_0x582f98,_0x5b5b73,_0x5709a5,_0x54638b){var _0x1920f7,_0x286e12;_0x54638b['remoteUri']=intUtil[_0x5b13('0x40')](_0x54638b['remoteUri']);_0x54638b[_0x5b13('0x41')]=intUtil[_0x5b13('0x40')](_0x54638b[_0x5b13('0x41')]);if(_0x5709a5&&_0x5709a5[_0x5b13('0x42')]){logger[_0x5b13('0xb')]('[QUEUE]',_0x5b13('0x43'));_0x1ef26c[_0x5b13('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54638b[_0x5b13('0x41')],_0x1ef26c[_0x5b13('0x45')],md5(_0x1ef26c['uniqueid']));}else{_0x1ef26c[_0x5b13('0x44')]='';}headers[_0x5b13('0x46')]=getAuth(_0x54638b);return getUser(_0x54638b,_0x5b5b73[_0x5b13('0x25')])[_0x5b13('0x1f')](function(_0x5edeb7){_0x1920f7=_0x5edeb7;logger[_0x5b13('0xb')]('The\x20User\x20ID\x20is:',_0x1920f7['id']);return getEndUser(_0x54638b,_0x1ef26c[_0x5b13('0xf')],_0x1ef26c['calleridnum']);})[_0x5b13('0x1f')](function(_0x565f60){_0x286e12=_0x565f60;logger[_0x5b13('0xb')](_0x5b13('0x47'),_0x286e12['id']);return getTicket(_0x54638b,_0x1920f7,_0x286e12,_0x582f98,_0x1ef26c);})[_0x5b13('0x1f')](function(_0x3701b3){if(_0x3701b3&&_0x3701b3['id']){logger['info'](_0x5b13('0x48'));logger[_0x5b13('0xb')](_0x5b13('0x49'),_0x3701b3['id']);logger[_0x5b13('0xb')](_0x5b13('0x4a'),_0x5b13('0x4b'));emit(util[_0x5b13('0x1b')]('user:%s',_0x5b5b73[_0x5b13('0x15')]),_0x5b13('0x4c'),{'uri':util[_0x5b13('0x1b')](_0x5b13('0x4d'),_0x54638b[_0x5b13('0x1d')],_0x3701b3['id'])});}})[_0x5b13('0x4e')](function(_0x3ee413){logger['error'](_0x5b13('0x4a'),JSON[_0x5b13('0x31')](_0x3ee413));});};exports[_0x5b13('0x4f')]=function(_0xfdd9df,_0x37eb29,_0x43bad5,_0x43ad38,_0x172f42,_0x19ce5c,_0x1f7900){var _0x337ff7,_0x57df33;_0x19ce5c['remoteUri']=intUtil['stripTrailingSlash'](_0x19ce5c[_0x5b13('0x1d')]);_0x19ce5c[_0x5b13('0x41')]=intUtil['stripTrailingSlash'](_0x19ce5c[_0x5b13('0x41')]);if(_0x1f7900&&_0x1f7900['recordingFormat']&&_0x1f7900[_0x5b13('0x50')]!=='none'){logger[_0x5b13('0xb')](_0x5b13('0x51'),'Recording\x20is\x20enabled!');_0x37eb29[_0x5b13('0x44')]=util['format'](_0x5b13('0x52'),_0x19ce5c['serverUrl'],_0x37eb29[_0x5b13('0x45')],md5(_0x37eb29[_0x5b13('0x45')]));}headers[_0x5b13('0x46')]=getAuth(_0x19ce5c);return getUser(_0x19ce5c,_0x43ad38[_0x5b13('0x25')])[_0x5b13('0x1f')](function(_0x15f293){_0x337ff7=_0x15f293;logger[_0x5b13('0xb')]('The\x20User\x20ID\x20is:',_0x337ff7['id']);return getEndUser(_0x19ce5c,_0x37eb29[_0x5b13('0x53')],_0x37eb29[_0x5b13('0x54')]);})[_0x5b13('0x1f')](function(_0x1216c8){_0x57df33=_0x1216c8;logger['info'](_0x5b13('0x47'),_0x57df33['id']);return getTicket(_0x19ce5c,_0x337ff7,_0x57df33,_0x43bad5,_0x37eb29);})[_0x5b13('0x1f')](function(_0x538155){if(_0x538155&&_0x538155['id']){logger[_0x5b13('0xb')](_0x5b13('0x48'));logger[_0x5b13('0xb')]('The\x20Ticket\x20ID\x20is:',_0x538155['id']);logger[_0x5b13('0xb')](_0x5b13('0x51'),_0x5b13('0x4b'));emit(util[_0x5b13('0x1b')](_0x5b13('0x55'),_0x43ad38[_0x5b13('0x15')]),_0x5b13('0x4c'),{'uri':util[_0x5b13('0x1b')](_0x5b13('0x4d'),_0x19ce5c[_0x5b13('0x1d')],_0x538155['id'])});}})['catch'](function(_0x4a5886){logger[_0x5b13('0x56')](_0x5b13('0x51'),JSON['stringify'](_0x4a5886));});};exports[_0x5b13('0x57')]=function(_0x271377,_0x231f9a,_0x16f7f2,_0x31d84f,_0x34e0e8,_0x8bd956){var _0x2f8a05,_0x3940c0;_0x8bd956[_0x5b13('0x1d')]=intUtil['stripTrailingSlash'](_0x8bd956['remoteUri']);_0x8bd956[_0x5b13('0x41')]=intUtil['stripTrailingSlash'](_0x8bd956[_0x5b13('0x41')]);if(_0x34e0e8&&_0x34e0e8[_0x5b13('0x42')]){logger[_0x5b13('0xb')]('['+_0x231f9a[_0x5b13('0x58')]['toUpperCase']()+']',_0x5b13('0x43'));_0x231f9a[_0x5b13('0x44')]=util[_0x5b13('0x1b')](_0x5b13('0x52'),_0x8bd956[_0x5b13('0x41')],_0x231f9a['uniqueid'],md5(_0x231f9a['uniqueid']));}else{_0x231f9a['recordingURL']='';}headers['Authorization']=getAuth(_0x8bd956);return getUser(_0x8bd956,'')[_0x5b13('0x1f')](function(_0x48a162){_0x2f8a05=_0x48a162;logger[_0x5b13('0xb')](_0x5b13('0x59'),_0x2f8a05['id']);return getEndUser(_0x8bd956,_0x231f9a[_0x5b13('0xf')],_0x231f9a[_0x5b13('0x10')]);})['then'](function(_0x227394){_0x3940c0=_0x227394;logger[_0x5b13('0xb')](_0x5b13('0x47'),_0x3940c0['id']);return getTicket(_0x8bd956,_0x2f8a05,_0x3940c0,_0x16f7f2,_0x231f9a);})[_0x5b13('0x1f')](function(_0x2b07a9){if(_0x2b07a9){logger[_0x5b13('0xb')]('Ticket\x20created!');logger['info'](_0x5b13('0x49'),_0x2b07a9['id']);}})[_0x5b13('0x4e')](function(_0x24aaae){logger[_0x5b13('0x56')]('['+_0x231f9a['lastevent'][_0x5b13('0x5a')]()+']',JSON['stringify'](_0x24aaae));});}; \ 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 1cfccbf..60e577a 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 _0x1134=['then','users','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','length','email','User\x20found:','userId','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','ioredis','./util','../../../../config/logger','redis','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information'];(function(_0x3aa330,_0x253250){var _0x1801cb=function(_0x476cf8){while(--_0x476cf8){_0x3aa330['push'](_0x3aa330['shift']());}};_0x1801cb(++_0x253250);}(_0x1134,0x19c));var _0x4113=function(_0x41c72f,_0x40edae){_0x41c72f=_0x41c72f-0x0;var _0x10d1ba=_0x1134[_0x41c72f];return _0x10d1ba;};'use strict';var _=require(_0x4113('0x0'));var rp=require(_0x4113('0x1'));var md5=require('md5');var util=require(_0x4113('0x2'));var moment=require(_0x4113('0x3'));var Promise=require('bluebird');var Redis=require(_0x4113('0x4'));var intUtil=require(_0x4113('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4113('0x6'))('freshsales');config[_0x4113('0x7')]=_['defaults'](config[_0x4113('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4113('0x8'))(new Redis(config[_0x4113('0x7')]));function getAdminId(_0x3b6cc4,_0x11153c,_0x25fd0f,_0xfc133b){return new Promise(function(_0x19c657,_0x19b6f2){var _0x5e635c=![];var _0x85a9dd={'method':_0x4113('0x9'),'uri':_0xfc133b+_0x4113('0xa'),'json':!![]};_0x85a9dd[_0x4113('0xb')]=_0x25fd0f;logger[_0x4113('0xc')](_0x4113('0xd'));return rp(_0x85a9dd)[_0x4113('0xe')](function(_0x459605){if(_0x459605){var _0x308b59=_0x459605[_0x4113('0xf')];var _0x53720f=null;for(_0x53720f=0x0;_0x53720f<_0x308b59['length'];_0x53720f++){if(_0x308b59[_0x53720f]['email']===_0x3b6cc4[_0x4113('0x10')]){_0x3b6cc4[_0x4113('0x11')]=_0x308b59[_0x53720f]['id'];_0x5e635c=!![];}}if(_0x5e635c){logger['info']('Admin\x20found:',_0x3b6cc4[_0x4113('0x11')]);_0x19c657(_0x3b6cc4);}else{_0x19b6f2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x19b6f2({'statusCode':0x194,'message':_0x4113('0x12')});}})['catch'](function(_0x59f69b){logger[_0x4113('0x13')]('['+[_0x11153c[_0x4113('0x14')]()]+']',_0x59f69b[_0x4113('0x15')]);_0x19b6f2(_0x59f69b);});});}function getUser(_0x3de530,_0x21d732,_0x76ec16){return function(_0x405849){return new Promise(function(_0xa7f33d,_0x1051d4){var _0x1cd9ae={'method':'GET','uri':_0x76ec16+_0x4113('0xa'),'json':!![]};_0x1cd9ae[_0x4113('0xb')]=_0x21d732;logger[_0x4113('0xc')](_0x4113('0x16'));return rp(_0x1cd9ae)[_0x4113('0xe')](function(_0x9608c3){if(_0x9608c3){var _0x18c627=_0x9608c3[_0x4113('0xf')];var _0x37bf1e=![];var _0x57540a=null;if(_0x405849[_0x4113('0x17')]!==null){logger[_0x4113('0xc')]('Getting\x20user\x20with\x20email',_0x405849['agentEmail']);_0x405849[_0x4113('0x18')]=_0x405849['agentEmail'];for(_0x57540a=0x0;_0x57540a<_0x18c627[_0x4113('0x19')];_0x57540a++){if(_0x18c627[_0x57540a][_0x4113('0x1a')]===_0x405849[_0x4113('0x17')]){_0x37bf1e=!![];_0x405849['userId']=_0x18c627[_0x57540a]['id'];logger[_0x4113('0xc')](_0x4113('0x1b'),_0x405849[_0x4113('0x1c')]);}}}if(!_0x37bf1e){logger[_0x4113('0xc')](_0x4113('0x1d'));_0x405849[_0x4113('0x18')]=_0x405849[_0x4113('0x10')];_0x405849[_0x4113('0x1c')]=_0x405849[_0x4113('0x11')];_0x37bf1e=!![];}if(_0x37bf1e){_0xa7f33d(_0x405849);}else{_0x1051d4({'statusCode':0x194,'message':_0x4113('0x12')});}}else{_0x1051d4({'statusCode':0x194,'message':_0x4113('0x12')});}})[_0x4113('0x1e')](function(_0x56c343){logger[_0x4113('0x13')]('['+[_0x3de530[_0x4113('0x14')]()]+']',_0x56c343['message']);_0x1051d4(_0x56c343);});});};}function searchContact(_0x34d8b4,_0x98d652,_0x3f9819,_0x177a6a){return new Promise(function(_0x2d9cc6,_0x180fed){var _0x234543={'method':_0x4113('0x9'),'headers':_0x98d652,'uri':_0x34d8b4+_0x4113('0x1f')+_0x177a6a+_0x4113('0x20')+_0x3f9819+_0x4113('0x21'),'json':!![]};rp(_0x234543)[_0x4113('0xe')](function(_0x25e422){var _0x24a487=_['find'](_0x25e422[_0x4113('0x22')][_0x4113('0x22')],[_0x3f9819,_0x177a6a]);_0x2d9cc6(_0x24a487);})['catch'](function(_0x201966){_0x180fed(_0x201966);});});}function getEndUser(_0x36e868,_0x2d83de,_0x1d2841){return function(_0x4e3450){return new Promise(function(_0x3fac56,_0x237740){logger[_0x4113('0xc')](util[_0x4113('0x23')](_0x4113('0x24'),_0x4e3450[_0x4113('0x25')]));searchContact(_0x1d2841,_0x2d83de,_0x4113('0x26'),_0x4e3450[_0x4113('0x25')])[_0x4113('0xe')](function(_0x4de3a8){if(_0x4de3a8){_0x4e3450[_0x4113('0x27')]=_0x4de3a8['id'];logger['info'](_0x4113('0x28'),_0x4e3450[_0x4113('0x27')]);return _0x3fac56(_0x4e3450);}searchContact(_0x1d2841,_0x2d83de,_0x4113('0x29'),_0x4e3450[_0x4113('0x25')])[_0x4113('0xe')](function(_0x453d70){if(_0x453d70){_0x4e3450['endUserId']=_0x453d70['id'];logger[_0x4113('0xc')]('Contact\x20found\x20work_number:',_0x4e3450[_0x4113('0x27')]);return _0x3fac56(_0x4e3450);}createEndUser(_0x4e3450,_0x36e868,_0x2d83de,_0x1d2841)[_0x4113('0xe')](function(_0x227498){logger['info'](_0x4113('0x2a'),_0x227498['endUserId']);return _0x3fac56(_0x227498);});});})[_0x4113('0x1e')](function(_0x580434){_0x237740(_0x580434);});});};}function createEndUser(_0x13d161,_0x384a32,_0x51874a,_0x588a16){return new Promise(function(_0x183b14,_0xe129b1){var _0xb2adf0=moment();var _0x4b2739={'method':'POST','uri':_0x588a16+_0x4113('0x2b'),'body':{'contact':{'last_name':_0x13d161[_0x4113('0x25')],'work_number':_0x13d161[_0x4113('0x25')],'mobile_number':_0x13d161[_0x4113('0x25')],'owner_id':_0x13d161[_0x4113('0x1c')],'created_at':_0xb2adf0['format'](_0x4113('0x2c'))}},'json':!![]};_0x4b2739[_0x4113('0xb')]=_0x51874a;logger[_0x4113('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4b2739)[_0x4113('0xe')](function(_0x42c7c6){_0x13d161[_0x4113('0x27')]=_0x42c7c6['contact']['id'];_0x183b14(_0x13d161);})[_0x4113('0x1e')](function(_0x5b8aeb){logger[_0x4113('0x13')]('['+[_0x384a32['toUpperCase']()]+']',_0x5b8aeb[_0x4113('0x15')]);_0xe129b1(_0x5b8aeb[_0x4113('0x15')]);});});}function getTicket(_0x18b491,_0x9adb1f,_0x8606c,_0x2c832f,_0x3c0887){return function(_0x37d0bf){logger['info'](_0x4113('0x2d'));return new Promise(function(_0x38b7ae,_0x55bcba){var _0x1e341c=moment();var _0x541db8={'method':'POST','uri':_0x8606c+_0x4113('0x2e'),'body':{'title':intUtil['getString'](_0x2c832f[_0x4113('0x2f')],_0x3c0887,'\x20'),'description':intUtil['getString'](_0x2c832f['Descriptions'],_0x3c0887,'\x0a'),'owner_id':_0x37d0bf[_0x4113('0x1c')],'creater_id':_0x37d0bf['adminId'],'targetable_id':_0x37d0bf[_0x4113('0x27')],'targetable_type':_0x4113('0x30'),'created_at':_0x1e341c['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1e341c[_0x4113('0x31')](0x1e,'m')[_0x4113('0x23')](_0x4113('0x2c'))},'json':!![]};_0x541db8[_0x4113('0xb')]=_0x9adb1f;return rp(_0x541db8)['then'](function(_0x19dbaa){_0x37d0bf[_0x4113('0x32')]=_0x19dbaa['task']['id'];logger['info'](_0x4113('0x33'),_0x37d0bf['ticketId']);_0x38b7ae(_0x37d0bf);})[_0x4113('0x1e')](function(_0x157300){logger[_0x4113('0x13')]('['+[_0x18b491[_0x4113('0x14')]()]+']',_0x157300['message']);_0x55bcba(_0x157300[_0x4113('0x15')]);});});};}function emit(_0x5d5668,_0x479965,_0x362a72){var _0x2986f1={'uri':_0x5d5668+'/contacts/'+_0x362a72};io['to'](util[_0x4113('0x23')]('user:%s',_0x479965))[_0x4113('0x34')](_0x4113('0x35'),_0x2986f1);}exports['cs']=function(_0x23ebab,_0x48e515,_0x16206a,_0x1ef8b2,_0x437115,_0x1a7173,_0xbdf60d,_0x160431){var _0x33e739={};var _0x110097={'Authorization':'Token\x20token='+_0x1a7173['apiKey']};_0x1a7173[_0x4113('0x36')]=intUtil['stripTrailingSlash'](_0x1a7173['remoteUri']);_0x1a7173['serverUrl']=intUtil[_0x4113('0x37')](_0x1a7173[_0x4113('0x38')]);var _0x2a7d1d=_0x1a7173['remoteUri'];_0x33e739[_0x4113('0x10')]=_0x1a7173[_0x4113('0x39')];_0x33e739[_0x4113('0x25')]=_0x160431['toLowerCase']()===_0x4113('0x3a')?_0x48e515[_0x4113('0x3b')]:_0x48e515[_0x4113('0x3c')];_0x33e739[_0x4113('0x3d')]=_0x160431===_0x4113('0x3e')||_0x160431==='unmanaged'?_0x4113('0x3e'):_0x4113('0x3a');if(_0x1ef8b2){_0x33e739['agentEmail']=_0x1ef8b2['email'];}var _0x488425=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a7173[_0x4113('0x38')],_0x48e515[_0x4113('0x3f')],md5(_0x48e515[_0x4113('0x3f')]));if(_0x437115&&_0x437115['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x48e515[_0x4113('0x40')]=_0x488425;}else if(_0xbdf60d&&_0xbdf60d[_0x4113('0x41')]&&_0xbdf60d[_0x4113('0x41')]!=='none'){logger[_0x4113('0xc')](_0x4113('0x42'),'Recording\x20is\x20enabled!');_0x48e515[_0x4113('0x40')]=_0x488425;}else{_0x48e515[_0x4113('0x40')]='';}return getAdminId(_0x33e739,_0x160431,_0x110097,_0x2a7d1d)[_0x4113('0xe')](getUser(_0x160431,_0x110097,_0x2a7d1d))['then'](getEndUser(_0x160431,_0x110097,_0x2a7d1d))[_0x4113('0xe')](getTicket(_0x160431,_0x110097,_0x2a7d1d,_0x16206a,_0x48e515))[_0x4113('0xe')](function(_0x4585e6){logger[_0x4113('0xc')](util[_0x4113('0x23')](_0x4113('0x43'),_0x4585e6[_0x4113('0x32')]));if(_0x160431!==_0x4113('0x44')){logger['info']('['+[_0x160431[_0x4113('0x14')]()]+']',_0x4113('0x45'));emit(_0x2a7d1d,_0x1ef8b2['name'],_0x4585e6[_0x4113('0x27')]);}})['catch'](function(_0x1f5f57){logger['error']('['+[_0x160431[_0x4113('0x14')]()]+_0x4113('0x46'),util['inspect'](_0x1f5f57,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xea81=['./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','redis','GET','headers','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','error','/api/lookup?q=','&f=','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','getString','Subjects','Contact','format','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','ioredis'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xea81,0x1ed));var _0x1ea8=function(_0x13987f,_0x4efcc9){_0x13987f=_0x13987f-0x0;var _0x49f679=_0xea81[_0x13987f];return _0x49f679;};'use strict';var _=require(_0x1ea8('0x0'));var rp=require(_0x1ea8('0x1'));var md5=require(_0x1ea8('0x2'));var util=require(_0x1ea8('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x1ea8('0x4'));var intUtil=require(_0x1ea8('0x5'));var config=require(_0x1ea8('0x6'));var logger=require(_0x1ea8('0x7'))(_0x1ea8('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x1ea8('0x9'),'port':0x18eb});var io=require(_0x1ea8('0xa'))(new Redis(config[_0x1ea8('0xb')]));function getAdminId(_0x2140e8,_0x4ec13b,_0x1e2577,_0x2c48ce){return new Promise(function(_0x35160b,_0x432447){var _0x495092=![];var _0x5732b5={'method':_0x1ea8('0xc'),'uri':_0x2c48ce+'/api/selector/owners','json':!![]};_0x5732b5[_0x1ea8('0xd')]=_0x1e2577;logger[_0x1ea8('0xe')](_0x1ea8('0xf'));return rp(_0x5732b5)[_0x1ea8('0x10')](function(_0x90eccb){if(_0x90eccb){var _0x5b35ea=_0x90eccb['users'];var _0x2e2c66=null;for(_0x2e2c66=0x0;_0x2e2c66<_0x5b35ea[_0x1ea8('0x11')];_0x2e2c66++){if(_0x5b35ea[_0x2e2c66]['email']===_0x2140e8[_0x1ea8('0x12')]){_0x2140e8[_0x1ea8('0x13')]=_0x5b35ea[_0x2e2c66]['id'];_0x495092=!![];}}if(_0x495092){logger[_0x1ea8('0xe')](_0x1ea8('0x14'),_0x2140e8[_0x1ea8('0x13')]);_0x35160b(_0x2140e8);}else{_0x432447({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x432447({'statusCode':0x194,'message':_0x1ea8('0x15')});}})[_0x1ea8('0x16')](function(_0x3e072d){logger['error']('['+[_0x4ec13b[_0x1ea8('0x17')]()]+']',_0x3e072d[_0x1ea8('0x18')]);_0x432447(_0x3e072d);});});}function getUser(_0x4c8228,_0x5c053a,_0x3292bc){return function(_0x4b80f9){return new Promise(function(_0x46c78a,_0x4cf432){var _0x239c3d={'method':_0x1ea8('0xc'),'uri':_0x3292bc+_0x1ea8('0x19'),'json':!![]};_0x239c3d[_0x1ea8('0xd')]=_0x5c053a;logger[_0x1ea8('0xe')](_0x1ea8('0x1a'));return rp(_0x239c3d)[_0x1ea8('0x10')](function(_0x346a1e){if(_0x346a1e){var _0x5344ca=_0x346a1e[_0x1ea8('0x1b')];var _0x2a3b4c=![];var _0x1b0148=null;if(_0x4b80f9[_0x1ea8('0x1c')]!==null){logger[_0x1ea8('0xe')](_0x1ea8('0x1d'),_0x4b80f9[_0x1ea8('0x1c')]);_0x4b80f9[_0x1ea8('0x1e')]=_0x4b80f9[_0x1ea8('0x1c')];for(_0x1b0148=0x0;_0x1b0148<_0x5344ca[_0x1ea8('0x11')];_0x1b0148++){if(_0x5344ca[_0x1b0148]['email']===_0x4b80f9[_0x1ea8('0x1c')]){_0x2a3b4c=!![];_0x4b80f9['userId']=_0x5344ca[_0x1b0148]['id'];logger[_0x1ea8('0xe')]('User\x20found:',_0x4b80f9[_0x1ea8('0x1f')]);}}}if(!_0x2a3b4c){logger['info'](_0x1ea8('0x20'));_0x4b80f9['userEmail']=_0x4b80f9['adminEmail'];_0x4b80f9[_0x1ea8('0x1f')]=_0x4b80f9[_0x1ea8('0x13')];_0x2a3b4c=!![];}if(_0x2a3b4c){_0x46c78a(_0x4b80f9);}else{_0x4cf432({'statusCode':0x194,'message':_0x1ea8('0x15')});}}else{_0x4cf432({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x3a79bf){logger[_0x1ea8('0x21')]('['+[_0x4c8228[_0x1ea8('0x17')]()]+']',_0x3a79bf[_0x1ea8('0x18')]);_0x4cf432(_0x3a79bf);});});};}function searchContact(_0x2e3fe6,_0x140092,_0x3c8059,_0x482b9e){return new Promise(function(_0x22a6a2,_0x4b293f){var _0x6129d4={'method':'GET','headers':_0x140092,'uri':_0x2e3fe6+_0x1ea8('0x22')+_0x482b9e+_0x1ea8('0x23')+_0x3c8059+'&entities=contact','json':!![]};rp(_0x6129d4)[_0x1ea8('0x10')](function(_0x2dfb00){var _0x3cb0bb=_[_0x1ea8('0x24')](_0x2dfb00[_0x1ea8('0x25')][_0x1ea8('0x25')],[_0x3c8059,_0x482b9e]);_0x22a6a2(_0x3cb0bb);})[_0x1ea8('0x16')](function(_0x33d7c8){_0x4b293f(_0x33d7c8);});});}function getEndUser(_0x1091c2,_0x2e56f1,_0x3e236e){return function(_0x39eb2d){return new Promise(function(_0x752060,_0x113216){logger[_0x1ea8('0xe')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x39eb2d[_0x1ea8('0x26')]));searchContact(_0x3e236e,_0x2e56f1,'mobile_number',_0x39eb2d[_0x1ea8('0x26')])[_0x1ea8('0x10')](function(_0x123790){if(_0x123790){_0x39eb2d[_0x1ea8('0x27')]=_0x123790['id'];logger['info'](_0x1ea8('0x28'),_0x39eb2d['endUserId']);return _0x752060(_0x39eb2d);}searchContact(_0x3e236e,_0x2e56f1,'work_number',_0x39eb2d[_0x1ea8('0x26')])[_0x1ea8('0x10')](function(_0x2d4b16){if(_0x2d4b16){_0x39eb2d[_0x1ea8('0x27')]=_0x2d4b16['id'];logger[_0x1ea8('0xe')](_0x1ea8('0x29'),_0x39eb2d[_0x1ea8('0x27')]);return _0x752060(_0x39eb2d);}createEndUser(_0x39eb2d,_0x1091c2,_0x2e56f1,_0x3e236e)['then'](function(_0x2eebfe){logger[_0x1ea8('0xe')](_0x1ea8('0x2a'),_0x2eebfe['endUserId']);return _0x752060(_0x2eebfe);});});})['catch'](function(_0x3a7fc6){_0x113216(_0x3a7fc6);});});};}function createEndUser(_0x29a02c,_0x6e90d0,_0x554c36,_0x3e023e){return new Promise(function(_0x363872,_0x41e623){var _0x3b400c=moment();var _0x3a14af={'method':'POST','uri':_0x3e023e+_0x1ea8('0x2b'),'body':{'contact':{'last_name':_0x29a02c[_0x1ea8('0x26')],'work_number':_0x29a02c['contactNumber'],'mobile_number':_0x29a02c[_0x1ea8('0x26')],'owner_id':_0x29a02c[_0x1ea8('0x1f')],'created_at':_0x3b400c['format'](_0x1ea8('0x2c'))}},'json':!![]};_0x3a14af[_0x1ea8('0xd')]=_0x554c36;logger['info'](_0x1ea8('0x2d'));return rp(_0x3a14af)[_0x1ea8('0x10')](function(_0x516a81){_0x29a02c['endUserId']=_0x516a81[_0x1ea8('0x2e')]['id'];_0x363872(_0x29a02c);})[_0x1ea8('0x16')](function(_0xd6ba1f){logger['error']('['+[_0x6e90d0[_0x1ea8('0x17')]()]+']',_0xd6ba1f['message']);_0x41e623(_0xd6ba1f[_0x1ea8('0x18')]);});});}function getTicket(_0x230650,_0x55423f,_0x47a4b4,_0x4368db,_0x4118cf){return function(_0x39259f){logger[_0x1ea8('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x51d606,_0x36fc6d){var _0x4b9157=moment();var _0x12b70e={'method':_0x1ea8('0x2f'),'uri':_0x47a4b4+'/api/tasks','body':{'title':intUtil[_0x1ea8('0x30')](_0x4368db[_0x1ea8('0x31')],_0x4118cf,'\x20'),'description':intUtil[_0x1ea8('0x30')](_0x4368db['Descriptions'],_0x4118cf,'\x0a'),'owner_id':_0x39259f[_0x1ea8('0x1f')],'creater_id':_0x39259f[_0x1ea8('0x13')],'targetable_id':_0x39259f[_0x1ea8('0x27')],'targetable_type':_0x1ea8('0x32'),'created_at':_0x4b9157[_0x1ea8('0x33')](_0x1ea8('0x2c')),'due_date':_0x4b9157[_0x1ea8('0x34')](0x1e,'m')[_0x1ea8('0x33')](_0x1ea8('0x2c'))},'json':!![]};_0x12b70e[_0x1ea8('0xd')]=_0x55423f;return rp(_0x12b70e)['then'](function(_0xcbda23){_0x39259f[_0x1ea8('0x35')]=_0xcbda23[_0x1ea8('0x36')]['id'];logger['info'](_0x1ea8('0x37'),_0x39259f['ticketId']);_0x51d606(_0x39259f);})[_0x1ea8('0x16')](function(_0x181bc5){logger[_0x1ea8('0x21')]('['+[_0x230650[_0x1ea8('0x17')]()]+']',_0x181bc5[_0x1ea8('0x18')]);_0x36fc6d(_0x181bc5[_0x1ea8('0x18')]);});});};}function emit(_0xa042f8,_0x1e80c3,_0x2cd772){var _0x499e47={'uri':_0xa042f8+'/contacts/'+_0x2cd772};io['to'](util[_0x1ea8('0x33')](_0x1ea8('0x38'),_0x1e80c3))[_0x1ea8('0x39')](_0x1ea8('0x3a'),_0x499e47);}exports['cs']=function(_0x30284c,_0x5e2415,_0x1a832a,_0x37af09,_0x37c61c,_0x1d2530,_0x1607ec,_0x1d4e1e){var _0x1d1f66={};var _0x127de7={'Authorization':'Token\x20token='+_0x1d2530[_0x1ea8('0x3b')]};_0x1d2530['remoteUri']=intUtil[_0x1ea8('0x3c')](_0x1d2530[_0x1ea8('0x3d')]);_0x1d2530[_0x1ea8('0x3e')]=intUtil['stripTrailingSlash'](_0x1d2530['serverUrl']);var _0x5dad4c=_0x1d2530[_0x1ea8('0x3d')];_0x1d1f66[_0x1ea8('0x12')]=_0x1d2530[_0x1ea8('0x3f')];_0x1d1f66['contactNumber']=_0x1d4e1e[_0x1ea8('0x40')]()===_0x1ea8('0x41')?_0x5e2415['destcalleridnum']:_0x5e2415[_0x1ea8('0x42')];_0x1d1f66[_0x1ea8('0x43')]=_0x1d4e1e===_0x1ea8('0x44')||_0x1d4e1e===_0x1ea8('0x45')?_0x1ea8('0x44'):_0x1ea8('0x41');if(_0x37af09){_0x1d1f66[_0x1ea8('0x1c')]=_0x37af09[_0x1ea8('0x46')];}var _0x2bada5=util[_0x1ea8('0x33')](_0x1ea8('0x47'),_0x1d2530[_0x1ea8('0x3e')],_0x5e2415[_0x1ea8('0x48')],md5(_0x5e2415[_0x1ea8('0x48')]));if(_0x37c61c&&_0x37c61c[_0x1ea8('0x49')]){logger['info']('[QUEUE]',_0x1ea8('0x4a'));_0x5e2415['recordingURL']=_0x2bada5;}else if(_0x1607ec&&_0x1607ec[_0x1ea8('0x4b')]&&_0x1607ec[_0x1ea8('0x4b')]!==_0x1ea8('0x4c')){logger[_0x1ea8('0xe')](_0x1ea8('0x4d'),_0x1ea8('0x4a'));_0x5e2415[_0x1ea8('0x4e')]=_0x2bada5;}else{_0x5e2415[_0x1ea8('0x4e')]='';}return getAdminId(_0x1d1f66,_0x1d4e1e,_0x127de7,_0x5dad4c)[_0x1ea8('0x10')](getUser(_0x1d4e1e,_0x127de7,_0x5dad4c))[_0x1ea8('0x10')](getEndUser(_0x1d4e1e,_0x127de7,_0x5dad4c))[_0x1ea8('0x10')](getTicket(_0x1d4e1e,_0x127de7,_0x5dad4c,_0x1a832a,_0x5e2415))['then'](function(_0x3e337c){logger[_0x1ea8('0xe')](util['format'](_0x1ea8('0x4f'),_0x3e337c[_0x1ea8('0x35')]));if(_0x1d4e1e!==_0x1ea8('0x45')){logger['info']('['+[_0x1d4e1e[_0x1ea8('0x17')]()]+']',_0x1ea8('0x50'));emit(_0x5dad4c,_0x37af09['name'],_0x3e337c[_0x1ea8('0x27')]);}})[_0x1ea8('0x16')](function(_0x3fca13){logger['error']('['+[_0x1d4e1e[_0x1ea8('0x17')]()]+_0x1ea8('0x51'),util[_0x1ea8('0x52')](_0x3fca13,{'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 4e014e5..93e3496 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 _0xb688=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data3','queue','log','unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','error'];(function(_0x34ec44,_0x988a08){var _0x57edce=function(_0x19f1a6){while(--_0x19f1a6){_0x34ec44['push'](_0x34ec44['shift']());}};_0x57edce(++_0x988a08);}(_0xb688,0xcf));var _0x8b68=function(_0x2d997e,_0x1bba1d){_0x2d997e=_0x2d997e-0x0;var _0x4b564a=_0xb688[_0x2d997e];return _0x4b564a;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var zendesk=require(_0x8b68('0x1'));var salesforce=require(_0x8b68('0x2'));var sugarcrm=require(_0x8b68('0x3'));var freshdesk=require(_0x8b68('0x4'));var zoho=require(_0x8b68('0x5'));var desk=require('./desk');var vtiger=require(_0x8b68('0x6'));var servicenow=require(_0x8b68('0x7'));var dynamics365=require(_0x8b68('0x8'));var freshsales=require(_0x8b68('0x9'));var integrations=['zendesk',_0x8b68('0xa'),'sugarcrm',_0x8b68('0xb'),_0x8b68('0xc'),_0x8b68('0xd'),_0x8b68('0xe'),_0x8b68('0xf'),_0x8b68('0x10'),_0x8b68('0x11')];exports[_0x8b68('0x12')]=function(_0x24e0b0,_0x2f2e3c,_0x418775,_0x317d01,_0x2a852a,_0x502727){if(_0x418775){if(_[_0x8b68('0x13')](integrations,_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]())){try{var _0x2d8472=null;var _0x1965cf='';var _0x2f3af4=_0x418775[_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()];if(_0x2f3af4){var _0x2686c7=_0x2f3af4[_0x24e0b0['data2']];if(_0x2686c7){var _0xb2df35=_['find'](_0x2686c7['Configurations'],{'id':parseInt(_0x24e0b0[_0x8b68('0x16')],0xa)});if(_0xb2df35){if(_0x317d01){if(_0x2a852a&&_0x2f2e3c[_0x8b68('0x17')]){_0x1965cf=_0x8b68('0x17');}else if(_0x2f2e3c['routeId']){_0x1965cf='outbound';}else{console[_0x8b68('0x18')]('EVENT\x20UNKNOWN',_0x2f2e3c);}}else{_0x1965cf=_0x8b68('0x19');}switch(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]()){case _0x8b68('0x1a'):zendesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'salesforce':salesforce[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x1b'):sugarcrm[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xb'):freshdesk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case'zoho':zoho[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xd'):desk[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0xe'):vtiger[_0x1965cf](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727);break;case _0x8b68('0x10'):freshsales['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0x11'):servicenow['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;case _0x8b68('0xf'):dynamics365['cs'](_0x24e0b0,_0x2f2e3c,_0xb2df35,_0x317d01,_0x2a852a,_0x2686c7,_0x502727,_0x1965cf);break;default:console['log'](_0x8b68('0x1c'));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x16')]));}}else{_0x2d8472=require(_0x8b68('0x1d'))(_0x24e0b0[_0x8b68('0x14')][_0x8b68('0x15')]());_0x2d8472[_0x8b68('0x1e')](_0x8b68('0x1f'),util['format'](_0x8b68('0x20'),_0x24e0b0[_0x8b68('0x14')]['toLowerCase'](),_0x24e0b0[_0x8b68('0x21')]));}}else{}}catch(_0x3cf8d2){console[_0x8b68('0x1e')](_0x3cf8d2);}}}}; \ No newline at end of file +var _0x3266=['salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','freshdesk','desk','log','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk'];(function(_0x3bb954,_0x5173dd){var _0x3d96a3=function(_0x16688c){while(--_0x16688c){_0x3bb954['push'](_0x3bb954['shift']());}};_0x3d96a3(++_0x5173dd);}(_0x3266,0x6a));var _0x6326=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x3266[_0x237546];return _0x233e29;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var zendesk=require(_0x6326('0x2'));var salesforce=require(_0x6326('0x3'));var sugarcrm=require(_0x6326('0x4'));var freshdesk=require(_0x6326('0x5'));var zoho=require(_0x6326('0x6'));var desk=require(_0x6326('0x7'));var vtiger=require(_0x6326('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x6326('0x9'));var freshsales=require('./freshsales');var integrations=[_0x6326('0xa'),_0x6326('0xb'),_0x6326('0xc'),'freshdesk',_0x6326('0xd'),'desk',_0x6326('0xe'),_0x6326('0xf'),_0x6326('0x10'),_0x6326('0x11')];exports[_0x6326('0x12')]=function(_0x53c3e1,_0x1b45a7,_0x464a36,_0x3590ab,_0x1e6909,_0x416844){if(_0x464a36){if(_[_0x6326('0x13')](integrations,_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]())){try{var _0x40a68a=null;var _0x379358='';var _0x5c07e1=_0x464a36[_0x53c3e1['data1'][_0x6326('0x15')]()];if(_0x5c07e1){var _0x136946=_0x5c07e1[_0x53c3e1['data2']];if(_0x136946){var _0x425878=_['find'](_0x136946[_0x6326('0x16')],{'id':parseInt(_0x53c3e1[_0x6326('0x17')],0xa)});if(_0x425878){if(_0x3590ab){if(_0x1e6909&&_0x1b45a7[_0x6326('0x18')]){_0x379358=_0x6326('0x18');}else if(_0x1b45a7[_0x6326('0x19')]){_0x379358=_0x6326('0x1a');}else{console['log'](_0x6326('0x1b'),_0x1b45a7);}}else{_0x379358='unmanaged';}switch(_0x53c3e1['data1']['toLowerCase']()){case'zendesk':zendesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'salesforce':salesforce[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'sugarcrm':sugarcrm[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1c'):freshdesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0xd'):zoho[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1d'):desk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'vtiger':vtiger[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'freshsales':freshsales['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0x11'):servicenow['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0xf'):dynamics365['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;default:console[_0x6326('0x1e')](_0x6326('0x1f'));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a['error'](_0x6326('0x21'),util['format'](_0x6326('0x22'),_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x17')]));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a[_0x6326('0x23')](_0x6326('0x21'),util[_0x6326('0x24')](_0x6326('0x25'),_0x53c3e1['data1'][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x26')]));}}else{}}catch(_0x575701){console['error'](_0x575701);}}}}; \ 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 421ea59..c63a392 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 _0x67e0=['integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','monitor_format','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','redis','localhost','socket.io-emitter','emit','ticketType','assign','getString','Descriptions','WhoId','ContactId','sobject','create','isNil','find','execute','length','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','Case','contact','Phone','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','string','idField','content','type','variableName','toString','customVariable','Variable','name','remoteUri','https://login.salesforce.com','clientId','queue','serverUrl','stripTrailingSlash','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x3e5870,_0x2c8112){var _0x5a398e=function(_0x4a382f){while(--_0x4a382f){_0x3e5870['push'](_0x3e5870['shift']());}};_0x5a398e(++_0x2c8112);}(_0x67e0,0xdc));var _0x067e=function(_0x4bf17a,_0x24d74c){_0x4bf17a=_0x4bf17a-0x0;var _0xe22657=_0x67e0[_0x4bf17a];return _0xe22657;};'use strict';var _=require(_0x067e('0x0'));var rp=require(_0x067e('0x1'));var moment=require(_0x067e('0x2'));var BPromise=require(_0x067e('0x3'));var md5=require('md5');var jsforce=require(_0x067e('0x4'));var util=require(_0x067e('0x5'));var Redis=require(_0x067e('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('salesforce');config['redis']=_['defaults'](config[_0x067e('0x7')],{'host':_0x067e('0x8'),'port':0x18eb});var io=require(_0x067e('0x9'))(new Redis(config[_0x067e('0x7')]));function emit(_0x37cde8,_0xda4a9f,_0x43dd13){io['to'](_0x37cde8)[_0x067e('0xa')](_0xda4a9f,_0x43dd13);}function getTicket(_0x298632,_0x3276db,_0x3e764f,_0x5c9fa1,_0x505dde,_0x935e2,_0x1c2364,_0xff6453){var _0x5878b4={};if(_0x5c9fa1[_0x067e('0xb')]==='Task'){_0x5878b4=Object[_0x067e('0xc')]({},{'OwnerId':_0x3276db['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x067e('0xd')](_0x5c9fa1['Subjects'],_0x505dde,'\x20'),'Description':intUtil[_0x067e('0xd')](_0x5c9fa1[_0x067e('0xe')],_0x505dde,'\x0a')},getCustomFields(_0x935e2,_0x505dde));if(_0x3e764f){_0x5878b4[_0x067e('0xf')]=_0x3e764f['id'];}}else if(_0x5c9fa1[_0x067e('0xb')]==='Case'){_0x5878b4=Object[_0x067e('0xc')]({},{'OwnerId':_0x3276db['id'],'Subject':intUtil[_0x067e('0xd')](_0x5c9fa1['Subjects'],_0x505dde,'\x20'),'Description':intUtil[_0x067e('0xd')](_0x5c9fa1[_0x067e('0xe')],_0x505dde,'\x0a')},getCustomFields(_0x935e2,_0x505dde));if(_0x3e764f){_0x5878b4[_0x067e('0x10')]=_0x3e764f['id'];}}return _0x1c2364[_0x067e('0x11')](_0x5c9fa1[_0x067e('0xb')])[_0x067e('0x12')](_0x5878b4);}function getUser(_0x1a1bfb,_0x3ad223,_0x5b5281){if(!_[_0x067e('0x13')](_0x3ad223)&&intUtil['validateEmail'](_0x3ad223)){var _0x5e8bf8={'Email':_0x3ad223};var _0x533942={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5b5281[_0x067e('0x11')]('User')[_0x067e('0x14')](_0x5e8bf8,_0x533942)[_0x067e('0x15')]()['then'](function(_0x5b878f){if(_0x5b878f[_0x067e('0x16')]){var _0x81e0f3=_['find'](_0x5b878f,function(_0x37086d){return _0x37086d['Email']===_0x3ad223;});if(_0x81e0f3){logger[_0x067e('0x17')](_0x067e('0x18'),_0x3ad223);return BPromise[_0x067e('0x19')]({'id':_0x81e0f3['Id'],'name':_0x81e0f3['Name']});}}else{logger[_0x067e('0x17')](_0x067e('0x1a'),_0x3ad223);return _0x5b5281['identity']()[_0x067e('0x1b')](function(_0x2b6baf){return BPromise[_0x067e('0x19')]({'id':_0x2b6baf[_0x067e('0x1c')],'name':_0x2b6baf[_0x067e('0x1d')]});});}});}else{logger['info'](_0x067e('0x1a'),_0x3ad223);return _0x5b5281[_0x067e('0x1e')]()[_0x067e('0x1b')](function(_0x13f159){return BPromise[_0x067e('0x19')]({'id':_0x13f159[_0x067e('0x1c')],'name':_0x13f159['display_name']});});}}function getEndUser(_0x487ac9,_0x316e98,_0x2a1f52,_0x4158c8,_0x46ff01){var _0x25a6d6={'Phone':_0x4158c8};var _0x491b9b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x067e('0x19')]()[_0x067e('0x1b')](function(){if(_0x316e98[_0x067e('0xb')]===_0x067e('0x1f')){logger[_0x067e('0x17')](_0x067e('0x20'),_0x4158c8,_0x316e98[_0x067e('0x21')]);switch(_0x316e98[_0x067e('0x21')]){case _0x067e('0x22'):return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))[_0x067e('0x14')](_0x25a6d6,_0x491b9b)['execute']()[_0x067e('0x1b')](function(_0x1b2606){if(_0x1b2606&&_0x1b2606['length']){return _0x1b2606;}else{return _0x46ff01['sobject'](_0x067e('0x24'))['find'](_0x25a6d6,_0x491b9b);}});case'contact':return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))['find'](_0x25a6d6,_0x491b9b)[_0x067e('0x15')]();case _0x067e('0x25'):return _0x46ff01[_0x067e('0x11')](_0x067e('0x24'))['find'](_0x25a6d6,_0x491b9b);default:return null;}}else if(_0x316e98[_0x067e('0xb')]===_0x067e('0x26')){logger[_0x067e('0x17')](_0x067e('0x20'),_0x4158c8,_0x067e('0x27'));return _0x46ff01[_0x067e('0x11')](_0x067e('0x23'))[_0x067e('0x14')](_0x25a6d6,_0x491b9b)['execute']();}})['then'](function(_0x3e8307){if(_0x3e8307&&_0x3e8307[_0x067e('0x16')]){var _0x102174=_[_0x067e('0x14')](_0x3e8307,function(_0x3b5516){return _0x3b5516['Phone']===_0x4158c8;});if(_0x102174){return BPromise[_0x067e('0x19')]({'id':_0x102174['Id'],'name':_0x102174['Name'],'phone':_0x102174[_0x067e('0x28')]});}}})['then'](function(_0x4950e9){if(_0x4950e9){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x4158c8);return BPromise[_0x067e('0x19')](_0x4950e9);}else{logger[_0x067e('0x17')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4158c8);var _0x4f5d9e={'LastName':_0x2a1f52!==_0x067e('0x29')?_0x2a1f52:util[_0x067e('0x2a')](_0x067e('0x2b'),_0x4158c8),'Phone':_0x4158c8};if(_0x316e98[_0x067e('0x2c')]){if(_0x316e98[_0x067e('0x2c')]===_0x067e('0x27')){logger[_0x067e('0x17')](_0x067e('0x2d'),_0x4158c8,_0x316e98[_0x067e('0x2c')]);}else if(_0x316e98['moduleCreate']==='lead'&&_0x316e98[_0x067e('0xb')]===_0x067e('0x1f')){logger[_0x067e('0x17')](_0x067e('0x2d'),_0x4158c8,_0x316e98[_0x067e('0x2c')]);_0x4f5d9e[_0x067e('0x2e')]='No\x20Company';}else{return null;}}return _0x46ff01['sobject'](_[_0x067e('0x2f')](_0x316e98[_0x067e('0x2c')]))[_0x067e('0x12')](_0x4f5d9e);}});}function getCustomFields(_0x342986,_0xb4ca44){var _0x406709={};if(_0x342986[_0x067e('0x16')]>0x0){_[_0x067e('0x30')](_0x342986,function(_0x1d9731){if(_0x1d9731['type']===_0x067e('0x31')&&_0x1d9731['idField']){_0x406709[_0x1d9731[_0x067e('0x32')]]=_0x1d9731[_0x067e('0x33')]['toString']();}else if(_0x1d9731[_0x067e('0x34')]==='variable'&&_0x1d9731[_0x067e('0x35')]&&_0x1d9731[_0x067e('0x32')]){_0xb4ca44[_0x1d9731[_0x067e('0x35')]]&&(_0x406709[_0x1d9731[_0x067e('0x32')]]=_0xb4ca44[_0x1d9731['variableName']][_0x067e('0x36')]());}else if(_0x1d9731[_0x067e('0x34')]===_0x067e('0x37')&&_0x1d9731['Variable']&&_0x1d9731[_0x067e('0x38')]['name']&&_0x1d9731[_0x067e('0x32')]){_0xb4ca44[_0x1d9731['Variable'][_0x067e('0x39')]['toLowerCase']()]&&(_0x406709[_0x1d9731['idField']]=_0xb4ca44[_0x1d9731[_0x067e('0x38')][_0x067e('0x39')]['toLowerCase']()][_0x067e('0x36')]());}});}return _0x406709;}function getConnection(_0x468305){var _0xc54164=_0x468305['password']['concat'](_0x468305['securityToken']);var _0x4df572=new jsforce['Connection']({'oauth2':{'loginUrl':_0x468305[_0x067e('0x3a')]||_0x067e('0x3b'),'clientId':_0x468305[_0x067e('0x3c')],'clientSecret':_0x468305['clientSecret']}});return _0x4df572['login'](_0x468305['username'],_0xc54164)[_0x067e('0x1b')](function(){logger[_0x067e('0x17')]('Connection\x20established.');return _0x4df572;});}exports[_0x067e('0x3d')]=function(_0x154c6a,_0x3c9efb,_0x2fcedd,_0x458a72,_0x1e4c4d,_0x247e2c){var _0x5500ed,_0x55a343,_0x1d4eb7,_0x26bddd;_0x247e2c[_0x067e('0x3e')]=intUtil['stripTrailingSlash'](_0x247e2c[_0x067e('0x3e')]);_0x247e2c['remoteUri']=intUtil[_0x067e('0x3f')](_0x247e2c['remoteUri']);if(_0x1e4c4d&&_0x1e4c4d['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x3c9efb['recordingURL']=util['format'](_0x067e('0x40'),_0x247e2c[_0x067e('0x3e')],_0x3c9efb[_0x067e('0x41')],md5(_0x3c9efb[_0x067e('0x41')]));}else{_0x3c9efb[_0x067e('0x42')]='';}return getConnection(_0x247e2c)[_0x067e('0x1b')](function(_0x12c70f){_0x26bddd=_0x12c70f;return getUser(_0x247e2c,_0x458a72['email'],_0x26bddd);})[_0x067e('0x1b')](function(_0x2534d8){_0x5500ed=_0x2534d8;return getEndUser(_0x247e2c,_0x2fcedd,_0x3c9efb['calleridname'],_0x3c9efb[_0x067e('0x43')],_0x26bddd);})[_0x067e('0x1b')](function(_0xb320d2){_0x55a343=_0xb320d2;return getTicket(_0x247e2c,_0x5500ed,_0x55a343,_0x2fcedd,_0x3c9efb,_0x2fcedd[_0x067e('0x44')],_0x26bddd,_0x067e('0x3d'));})[_0x067e('0x1b')](function(_0xc39d15){_0x1d4eb7=_0xc39d15;logger[_0x067e('0x17')](_0x067e('0x45'),_0x1d4eb7['id']);logger['info'](_0x067e('0x46'),_0x1d4eb7['id'],_0x458a72[_0x067e('0x39')],_0x247e2c[_0x067e('0x34')]);switch(_0x247e2c[_0x067e('0x34')]){case _0x067e('0x47'):emit(util['format']('user:%s',_0x458a72['name']),_0x067e('0x48'),{'recordId':_0x1d4eb7['id']});break;case _0x067e('0x49'):emit(util[_0x067e('0x2a')](_0x067e('0x4a'),_0x458a72[_0x067e('0x39')]),_0x067e('0x4b'),{'uri':util['format']('%s/%s/e',_0x26bddd[_0x067e('0x4c')],_0x1d4eb7['id'])});break;default:logger[_0x067e('0x4d')](_0x067e('0x4e'));}})[_0x067e('0x4f')](function(_0x4e3e8a){logger[_0x067e('0x4d')](_0x067e('0x50'),JSON['stringify'](_0x4e3e8a));});};exports['outbound']=function(_0x36f3c9,_0x2a1798,_0x21a17c,_0x2be1ca,_0x49746f,_0x4bf6ae,_0x22beef){var _0x3b6b37,_0x5ed521,_0xa806cc,_0x5df241;_0x4bf6ae[_0x067e('0x3e')]=intUtil[_0x067e('0x3f')](_0x4bf6ae['serverUrl']);_0x4bf6ae[_0x067e('0x3a')]=intUtil[_0x067e('0x3f')](_0x4bf6ae[_0x067e('0x3a')]);if(_0x22beef&&_0x22beef[_0x067e('0x51')]&&_0x22beef['recordingFormat']!==_0x067e('0x52')){logger[_0x067e('0x17')](_0x067e('0x53'),_0x067e('0x54'));_0x2a1798['recordingURL']=util[_0x067e('0x2a')](_0x067e('0x40'),_0x4bf6ae['serverUrl'],_0x2a1798[_0x067e('0x41')],md5(_0x2a1798[_0x067e('0x41')]));}return getConnection(_0x4bf6ae)['then'](function(_0x411c4e){_0x5df241=_0x411c4e;return getUser(_0x4bf6ae,_0x2be1ca['email'],_0x5df241);})[_0x067e('0x1b')](function(_0x145227){_0x3b6b37=_0x145227;return getEndUser(_0x4bf6ae,_0x21a17c,_0x2a1798[_0x067e('0x55')],_0x2a1798[_0x067e('0x56')],_0x5df241);})[_0x067e('0x1b')](function(_0x1754ec){_0x5ed521=_0x1754ec;return getTicket(_0x4bf6ae,_0x3b6b37,_0x5ed521,_0x21a17c,_0x2a1798,_0x21a17c[_0x067e('0x44')],_0x5df241,_0x067e('0x57'));})[_0x067e('0x1b')](function(_0x25ce2e){_0xa806cc=_0x25ce2e;logger[_0x067e('0x17')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xa806cc['id']);logger[_0x067e('0x17')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa806cc['id'],_0x2be1ca[_0x067e('0x39')],_0x4bf6ae[_0x067e('0x34')]);switch(_0x4bf6ae[_0x067e('0x34')]){case'integrationTab':emit(util[_0x067e('0x2a')](_0x067e('0x4a'),_0x2be1ca[_0x067e('0x39')]),_0x067e('0x48'),{'recordId':_0xa806cc['id']});break;case _0x067e('0x49'):emit(util[_0x067e('0x2a')]('user:%s',_0x2be1ca[_0x067e('0x39')]),_0x067e('0x4b'),{'uri':util[_0x067e('0x2a')](_0x067e('0x58'),_0x5df241[_0x067e('0x4c')],_0xa806cc['id'])});break;default:logger[_0x067e('0x4d')](_0x067e('0x53'),_0x067e('0x59'));}})[_0x067e('0x4f')](function(_0x4a9b5f){logger[_0x067e('0x4d')]('[OUTBOUND]',JSON[_0x067e('0x5a')](_0x4a9b5f));});};exports[_0x067e('0x5b')]=function(_0x144bcc,_0x3c5426,_0x4023eb,_0x5eb6e1,_0x3b3d2a,_0x573fd1){var _0x3f7d6e,_0x2af501,_0x359434,_0x3d5dc1;_0x573fd1[_0x067e('0x3e')]=intUtil[_0x067e('0x3f')](_0x573fd1[_0x067e('0x3e')]);_0x573fd1[_0x067e('0x3a')]=intUtil[_0x067e('0x3f')](_0x573fd1[_0x067e('0x3a')]);if(_0x3b3d2a&&_0x3b3d2a[_0x067e('0x5c')]){logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')]['toUpperCase']()+']',_0x067e('0x54'));_0x3c5426[_0x067e('0x42')]=util[_0x067e('0x2a')](_0x067e('0x40'),_0x573fd1[_0x067e('0x3e')],_0x3c5426[_0x067e('0x41')],md5(_0x3c5426[_0x067e('0x41')]));}else{_0x3c5426['recordingURL']='';}return getConnection(_0x573fd1)[_0x067e('0x1b')](function(_0x277967){_0x3d5dc1=_0x277967;if(!_[_0x067e('0x13')](_0x5eb6e1)){return getUser(_0x573fd1,_0x5eb6e1[_0x067e('0x39')],_0x3d5dc1);}else{return getUser(_0x573fd1,null,_0x3d5dc1);}})[_0x067e('0x1b')](function(_0x2e73ff){_0x3f7d6e=_0x2e73ff;return getEndUser(_0x573fd1,_0x4023eb,_0x3c5426[_0x067e('0x5e')],_0x3c5426[_0x067e('0x43')],_0x3d5dc1);})[_0x067e('0x1b')](function(_0x58b4b9){_0x2af501=_0x58b4b9;return getTicket(_0x573fd1,_0x3f7d6e,_0x2af501,_0x4023eb,_0x3c5426,_0x4023eb[_0x067e('0x44')],_0x3d5dc1);})['then'](function(_0xd36537){_0x359434=_0xd36537;logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')][_0x067e('0x5f')]()+_0x067e('0x60'),_0x359434['id']);logger[_0x067e('0x17')]('['+_0x3c5426[_0x067e('0x5d')][_0x067e('0x5f')]()+']\x20Integration\x20account\x20type\x20%s.',_0x573fd1[_0x067e('0x34')]);})[_0x067e('0x4f')](function(_0x4965ad){logger[_0x067e('0x4d')]('['+_0x3c5426['lastevent'][_0x067e('0x5f')]()+']',JSON[_0x067e('0x5a')](_0x4965ad));});}; \ No newline at end of file +var _0xa99d=['forEach','type','string','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','password','concat','securityToken','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','isNil','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','Contact','Lead','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst'];(function(_0x464047,_0x406cbd){var _0x906907=function(_0x4fb8d3){while(--_0x4fb8d3){_0x464047['push'](_0x464047['shift']());}};_0x906907(++_0x406cbd);}(_0xa99d,0x123));var _0xda99=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0xa99d[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0xda99('0x0'));var rp=require(_0xda99('0x1'));var moment=require('moment');var BPromise=require(_0xda99('0x2'));var md5=require(_0xda99('0x3'));var jsforce=require('jsforce');var util=require(_0xda99('0x4'));var Redis=require(_0xda99('0x5'));var intUtil=require(_0xda99('0x6'));var config=require(_0xda99('0x7'));var logger=require(_0xda99('0x8'))(_0xda99('0x9'));config[_0xda99('0xa')]=_[_0xda99('0xb')](config[_0xda99('0xa')],{'host':_0xda99('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda99('0xa')]));function emit(_0x4b95e2,_0x218672,_0x10f1cd){io['to'](_0x4b95e2)[_0xda99('0xd')](_0x218672,_0x10f1cd);}function getTicket(_0x5bd05b,_0x4b1f9f,_0x4ce624,_0x10014b,_0x22cd58,_0x28a8be,_0x7fcd0a,_0x3ec2cb){var _0x50631f={};if(_0x10014b[_0xda99('0xe')]===_0xda99('0xf')){_0x50631f=Object[_0xda99('0x10')]({},{'OwnerId':_0x4b1f9f['id'],'ActivityDate':moment[_0xda99('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x13')],_0x22cd58,'\x20'),'Description':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x14')],_0x22cd58,'\x0a')},getCustomFields(_0x28a8be,_0x22cd58));if(_0x4ce624){_0x50631f[_0xda99('0x15')]=_0x4ce624['id'];}}else if(_0x10014b[_0xda99('0xe')]===_0xda99('0x16')){_0x50631f=Object[_0xda99('0x10')]({},{'OwnerId':_0x4b1f9f['id'],'Subject':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x13')],_0x22cd58,'\x20'),'Description':intUtil[_0xda99('0x12')](_0x10014b['Descriptions'],_0x22cd58,'\x0a')},getCustomFields(_0x28a8be,_0x22cd58));if(_0x4ce624){_0x50631f[_0xda99('0x17')]=_0x4ce624['id'];}}return _0x7fcd0a[_0xda99('0x18')](_0x10014b['ticketType'])[_0xda99('0x19')](_0x50631f);}function getUser(_0x3485aa,_0x15c62f,_0x1e32ac){if(!_['isNil'](_0x15c62f)&&intUtil[_0xda99('0x1a')](_0x15c62f)){var _0x24193d={'Email':_0x15c62f};var _0x5b69d3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1e32ac[_0xda99('0x18')](_0xda99('0x1b'))[_0xda99('0x1c')](_0x24193d,_0x5b69d3)[_0xda99('0x1d')]()[_0xda99('0x1e')](function(_0x118dc8){if(_0x118dc8[_0xda99('0x1f')]){var _0x8274b1=_['find'](_0x118dc8,function(_0x56dd2e){return _0x56dd2e[_0xda99('0x20')]===_0x15c62f;});if(_0x8274b1){logger[_0xda99('0x21')](_0xda99('0x22'),_0x15c62f);return BPromise[_0xda99('0x23')]({'id':_0x8274b1['Id'],'name':_0x8274b1[_0xda99('0x24')]});}}else{logger[_0xda99('0x21')](_0xda99('0x25'),_0x15c62f);return _0x1e32ac[_0xda99('0x26')]()[_0xda99('0x1e')](function(_0x1e58da){return BPromise[_0xda99('0x23')]({'id':_0x1e58da[_0xda99('0x27')],'name':_0x1e58da['display_name']});});}});}else{logger[_0xda99('0x21')](_0xda99('0x25'),_0x15c62f);return _0x1e32ac[_0xda99('0x26')]()[_0xda99('0x1e')](function(_0x379281){return BPromise['resolve']({'id':_0x379281[_0xda99('0x27')],'name':_0x379281[_0xda99('0x28')]});});}}function getEndUser(_0x27ef1c,_0x387a17,_0x33573b,_0x5863d0,_0x57d6a3){var _0x1cc98f={'Phone':_0x5863d0};var _0x3ad338={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xda99('0x23')]()[_0xda99('0x1e')](function(){if(_0x387a17['ticketType']==='Task'){logger[_0xda99('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5863d0,_0x387a17[_0xda99('0x29')]);switch(_0x387a17['moduleSearch']){case _0xda99('0x2a'):return _0x57d6a3['sobject'](_0xda99('0x2b'))['find'](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]()[_0xda99('0x1e')](function(_0x2bdcba){if(_0x2bdcba&&_0x2bdcba[_0xda99('0x1f')]){return _0x2bdcba;}else{return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2c'))[_0xda99('0x1c')](_0x1cc98f,_0x3ad338);}});case'contact':return _0x57d6a3[_0xda99('0x18')]('Contact')[_0xda99('0x1c')](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]();case _0xda99('0x2d'):return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2c'))[_0xda99('0x1c')](_0x1cc98f,_0x3ad338);default:return null;}}else if(_0x387a17[_0xda99('0xe')]===_0xda99('0x16')){logger[_0xda99('0x21')](_0xda99('0x2e'),_0x5863d0,_0xda99('0x2f'));return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2b'))['find'](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]();}})['then'](function(_0x4a9b09){if(_0x4a9b09&&_0x4a9b09[_0xda99('0x1f')]){var _0x2c726e=_[_0xda99('0x1c')](_0x4a9b09,function(_0x3f3c2b){return _0x3f3c2b[_0xda99('0x30')]===_0x5863d0;});if(_0x2c726e){return BPromise[_0xda99('0x23')]({'id':_0x2c726e['Id'],'name':_0x2c726e[_0xda99('0x24')],'phone':_0x2c726e[_0xda99('0x30')]});}}})[_0xda99('0x1e')](function(_0x6498d6){if(_0x6498d6){logger[_0xda99('0x21')](_0xda99('0x31'),_0x5863d0);return BPromise[_0xda99('0x23')](_0x6498d6);}else{logger[_0xda99('0x21')](_0xda99('0x32'),_0x5863d0);var _0x235787={'LastName':_0x33573b!==''?_0x33573b:util[_0xda99('0x33')]('Caller\x20-\x20%s',_0x5863d0),'Phone':_0x5863d0};if(_0x387a17[_0xda99('0x34')]){if(_0x387a17['moduleCreate']===_0xda99('0x2f')){logger[_0xda99('0x21')](_0xda99('0x35'),_0x5863d0,_0x387a17[_0xda99('0x34')]);}else if(_0x387a17['moduleCreate']==='lead'&&_0x387a17[_0xda99('0xe')]===_0xda99('0xf')){logger[_0xda99('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5863d0,_0x387a17[_0xda99('0x34')]);_0x235787[_0xda99('0x36')]=_0xda99('0x37');}else{return null;}}return _0x57d6a3['sobject'](_[_0xda99('0x38')](_0x387a17['moduleCreate']))[_0xda99('0x19')](_0x235787);}});}function getCustomFields(_0x255bef,_0x2fc95d){var _0x39ca72={};if(_0x255bef[_0xda99('0x1f')]>0x0){_[_0xda99('0x39')](_0x255bef,function(_0x1be3db){if(_0x1be3db[_0xda99('0x3a')]===_0xda99('0x3b')&&_0x1be3db[_0xda99('0x3c')]){_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x1be3db[_0xda99('0x3d')][_0xda99('0x3e')]();}else if(_0x1be3db['type']===_0xda99('0x3f')&&_0x1be3db[_0xda99('0x40')]&&_0x1be3db[_0xda99('0x3c')]){_0x2fc95d[_0x1be3db[_0xda99('0x40')]]&&(_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x2fc95d[_0x1be3db[_0xda99('0x40')]]['toString']());}else if(_0x1be3db[_0xda99('0x3a')]===_0xda99('0x41')&&_0x1be3db['Variable']&&_0x1be3db['Variable'][_0xda99('0x42')]&&_0x1be3db[_0xda99('0x3c')]){_0x2fc95d[_0x1be3db[_0xda99('0x43')][_0xda99('0x42')][_0xda99('0x44')]()]&&(_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x2fc95d[_0x1be3db[_0xda99('0x43')][_0xda99('0x42')][_0xda99('0x44')]()][_0xda99('0x3e')]());}});}return _0x39ca72;}function getConnection(_0x244fce){var _0x2d4ac7=_0x244fce[_0xda99('0x45')][_0xda99('0x46')](_0x244fce[_0xda99('0x47')]);var _0x5f1caf=new jsforce['Connection']({'oauth2':{'loginUrl':_0x244fce['remoteUri']||'https://login.salesforce.com','clientId':_0x244fce[_0xda99('0x48')],'clientSecret':_0x244fce[_0xda99('0x49')]}});return _0x5f1caf[_0xda99('0x4a')](_0x244fce[_0xda99('0x4b')],_0x2d4ac7)['then'](function(){logger['info'](_0xda99('0x4c'));return _0x5f1caf;});}exports[_0xda99('0x4d')]=function(_0x1a1d13,_0x2f4181,_0x1ec581,_0x29db5e,_0x698533,_0x18dcb4){var _0x461f76,_0x3bae2c,_0x37ce62,_0x27debb;_0x18dcb4[_0xda99('0x4e')]=intUtil['stripTrailingSlash'](_0x18dcb4['serverUrl']);_0x18dcb4[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x18dcb4[_0xda99('0x4f')]);if(_0x698533&&_0x698533[_0xda99('0x51')]){logger['info'](_0xda99('0x52'),'Recording\x20is\x20enabled!');_0x2f4181['recordingURL']=util[_0xda99('0x33')](_0xda99('0x53'),_0x18dcb4[_0xda99('0x4e')],_0x2f4181[_0xda99('0x54')],md5(_0x2f4181[_0xda99('0x54')]));}else{_0x2f4181[_0xda99('0x55')]='';}return getConnection(_0x18dcb4)[_0xda99('0x1e')](function(_0x33a291){_0x27debb=_0x33a291;return getUser(_0x18dcb4,_0x29db5e[_0xda99('0x56')],_0x27debb);})[_0xda99('0x1e')](function(_0x28a493){_0x461f76=_0x28a493;return getEndUser(_0x18dcb4,_0x1ec581,_0x2f4181['calleridname'],_0x2f4181[_0xda99('0x57')],_0x27debb);})[_0xda99('0x1e')](function(_0x387764){_0x3bae2c=_0x387764;return getTicket(_0x18dcb4,_0x461f76,_0x3bae2c,_0x1ec581,_0x2f4181,_0x1ec581[_0xda99('0x58')],_0x27debb,_0xda99('0x4d'));})[_0xda99('0x1e')](function(_0x335844){_0x37ce62=_0x335844;logger[_0xda99('0x21')](_0xda99('0x59'),_0x37ce62['id']);logger[_0xda99('0x21')](_0xda99('0x5a'),_0x37ce62['id'],_0x29db5e[_0xda99('0x42')],_0x18dcb4[_0xda99('0x3a')]);switch(_0x18dcb4[_0xda99('0x3a')]){case'integrationTab':emit(util['format']('user:%s',_0x29db5e[_0xda99('0x42')]),_0xda99('0x5b'),{'recordId':_0x37ce62['id']});break;case _0xda99('0x5c'):emit(util['format'](_0xda99('0x5d'),_0x29db5e[_0xda99('0x42')]),_0xda99('0x5e'),{'uri':util[_0xda99('0x33')](_0xda99('0x5f'),_0x27debb[_0xda99('0x60')],_0x37ce62['id'])});break;default:logger[_0xda99('0x61')](_0xda99('0x62'));}})[_0xda99('0x63')](function(_0x29b32c){logger[_0xda99('0x61')](_0xda99('0x52'),JSON[_0xda99('0x64')](_0x29b32c));});};exports['outbound']=function(_0x3622b7,_0x3930f1,_0x4604a8,_0x1a2610,_0xd5f6b8,_0x2c80ea,_0x53eb28){var _0x13eaf1,_0x1a7c3d,_0x4aefc3,_0x3a71da;_0x2c80ea[_0xda99('0x4e')]=intUtil[_0xda99('0x50')](_0x2c80ea['serverUrl']);_0x2c80ea[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x2c80ea['remoteUri']);if(_0x53eb28&&_0x53eb28[_0xda99('0x65')]&&_0x53eb28[_0xda99('0x65')]!==_0xda99('0x66')){logger[_0xda99('0x21')](_0xda99('0x67'),_0xda99('0x68'));_0x3930f1[_0xda99('0x55')]=util[_0xda99('0x33')](_0xda99('0x53'),_0x2c80ea['serverUrl'],_0x3930f1[_0xda99('0x54')],md5(_0x3930f1[_0xda99('0x54')]));}return getConnection(_0x2c80ea)[_0xda99('0x1e')](function(_0x28ab05){_0x3a71da=_0x28ab05;return getUser(_0x2c80ea,_0x1a2610[_0xda99('0x56')],_0x3a71da);})[_0xda99('0x1e')](function(_0x174cef){_0x13eaf1=_0x174cef;return getEndUser(_0x2c80ea,_0x4604a8,_0x3930f1[_0xda99('0x69')],_0x3930f1[_0xda99('0x6a')],_0x3a71da);})['then'](function(_0xe294b8){_0x1a7c3d=_0xe294b8;return getTicket(_0x2c80ea,_0x13eaf1,_0x1a7c3d,_0x4604a8,_0x3930f1,_0x4604a8[_0xda99('0x58')],_0x3a71da,_0xda99('0x6b'));})['then'](function(_0x12e26a){_0x4aefc3=_0x12e26a;logger['info'](_0xda99('0x6c'),_0x4aefc3['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4aefc3['id'],_0x1a2610['name'],_0x2c80ea[_0xda99('0x3a')]);switch(_0x2c80ea[_0xda99('0x3a')]){case _0xda99('0x6d'):emit(util[_0xda99('0x33')](_0xda99('0x5d'),_0x1a2610[_0xda99('0x42')]),'trigger:salesforce:display',{'recordId':_0x4aefc3['id']});break;case'newTab':emit(util['format']('user:%s',_0x1a2610[_0xda99('0x42')]),_0xda99('0x5e'),{'uri':util[_0xda99('0x33')](_0xda99('0x5f'),_0x3a71da['instanceUrl'],_0x4aefc3['id'])});break;default:logger[_0xda99('0x61')](_0xda99('0x67'),_0xda99('0x6e'));}})[_0xda99('0x63')](function(_0x21f70a){logger[_0xda99('0x61')]('[OUTBOUND]',JSON[_0xda99('0x64')](_0x21f70a));});};exports[_0xda99('0x6f')]=function(_0x14b815,_0x209974,_0x1c66e7,_0x66f10,_0xe2adbc,_0x298a42){var _0x1b20d6,_0x4e7016,_0xe3d7c6,_0x34660b;_0x298a42['serverUrl']=intUtil[_0xda99('0x50')](_0x298a42[_0xda99('0x4e')]);_0x298a42[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x298a42['remoteUri']);if(_0xe2adbc&&_0xe2adbc[_0xda99('0x51')]){logger[_0xda99('0x21')]('['+_0x209974['lastevent'][_0xda99('0x70')]()+']',_0xda99('0x68'));_0x209974[_0xda99('0x55')]=util[_0xda99('0x33')](_0xda99('0x53'),_0x298a42[_0xda99('0x4e')],_0x209974[_0xda99('0x54')],md5(_0x209974[_0xda99('0x54')]));}else{_0x209974['recordingURL']='';}return getConnection(_0x298a42)['then'](function(_0x18374d){_0x34660b=_0x18374d;if(!_[_0xda99('0x71')](_0x66f10)){return getUser(_0x298a42,_0x66f10[_0xda99('0x42')],_0x34660b);}else{return getUser(_0x298a42,null,_0x34660b);}})[_0xda99('0x1e')](function(_0x47c8fb){_0x1b20d6=_0x47c8fb;return getEndUser(_0x298a42,_0x1c66e7,_0x209974['calleridname'],_0x209974['calleridnum'],_0x34660b);})['then'](function(_0x421f8d){_0x4e7016=_0x421f8d;return getTicket(_0x298a42,_0x1b20d6,_0x4e7016,_0x1c66e7,_0x209974,_0x1c66e7['Fields'],_0x34660b);})['then'](function(_0x3596d2){_0xe3d7c6=_0x3596d2;logger[_0xda99('0x21')]('['+_0x209974['lastevent'][_0xda99('0x70')]()+']\x20Ticket\x20%s\x20created.',_0xe3d7c6['id']);logger[_0xda99('0x21')]('['+_0x209974[_0xda99('0x72')]['toUpperCase']()+_0xda99('0x73'),_0x298a42['type']);})['catch'](function(_0x387fd9){logger['error']('['+_0x209974[_0xda99('0x72')][_0xda99('0x70')]()+']',JSON[_0xda99('0x64')](_0x387fd9));});}; \ 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 1a37986..443b15e 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 _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x39f5b,_0x224393){var _0x29c795=function(_0x16284b){while(--_0x16284b){_0x39f5b['push'](_0x39f5b['shift']());}};_0x29c795(++_0x224393);}(_0x1261,0x144));var _0x1126=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x1261[_0x538c70];return _0x42ae01;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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(_0x51cc19,_0x3fc632){var _0x101c66=function(_0x4274e7){while(--_0x4274e7){_0x51cc19['push'](_0x51cc19['shift']());}};_0x101c66(++_0x3fc632);}(_0x5fc3,0xa8));var _0x35fc=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x5fc3[_0x52f1e6];return _0x21f104;};'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 e6a45f7..82a66fb 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 _0xaa10=['nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','Fields','Outbound','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','Inbound','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string'];(function(_0x1ba051,_0x3a9f59){var _0x237ad2=function(_0x30ffc5){while(--_0x30ffc5){_0x1ba051['push'](_0x1ba051['shift']());}};_0x237ad2(++_0x3a9f59);}(_0xaa10,0x1ac));var _0x0aa1=function(_0x306fc9,_0x420385){_0x306fc9=_0x306fc9-0x0;var _0x4971ad=_0xaa10[_0x306fc9];return _0x4971ad;};'use strict';var _=require(_0x0aa1('0x0'));var rp=require(_0x0aa1('0x1'));var BPromise=require(_0x0aa1('0x2'));var md5=require(_0x0aa1('0x3'));var util=require(_0x0aa1('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0aa1('0x5'));var config=require(_0x0aa1('0x6'));var logger=require('../../../../config/logger')(_0x0aa1('0x7'));config[_0x0aa1('0x8')]=_['defaults'](config[_0x0aa1('0x8')],{'host':_0x0aa1('0x9'),'port':0x18eb});var io=require(_0x0aa1('0xa'))(new Redis(config[_0x0aa1('0x8')]));var def={'method':_0x0aa1('0xb'),'json':!![]};function emit(_0x5399b2,_0xd31a04,_0x54bb0c){io['to'](_0x5399b2)[_0x0aa1('0xc')](_0xd31a04,_0x54bb0c);}function getTicket(_0x1c803d,_0x746171,_0x5bfa75,_0x4b9c45,_0xd6205c,_0x635aab,_0x556e21,_0x4a00b5){logger[_0x0aa1('0xd')](_0x0aa1('0xe'));var _0x9f0da0=new Date();var _0x3b17b2=[{'name':'name','value':intUtil[_0x0aa1('0xf')](_0x4b9c45[_0x0aa1('0x10')],_0xd6205c,'\x20')},{'name':_0x0aa1('0x11'),'value':_0x746171['id']},{'name':_0x0aa1('0x12'),'value':_0x746171['id']},{'name':_0x0aa1('0x13'),'value':intUtil['getString'](_0x4b9c45[_0x0aa1('0x14')],_0xd6205c,'\x0a')},{'name':'date_start','value':_0x9f0da0[_0x0aa1('0x15')]()[_0x0aa1('0x16')](0x0,0x13)[_0x0aa1('0x17')]('T','\x20')},{'name':_0x0aa1('0x18'),'value':'0'},{'name':_0x0aa1('0x19'),'value':'15'},{'name':_0x0aa1('0x1a'),'value':_0x5bfa75['id']},{'name':_0x0aa1('0x1b'),'value':_0x0aa1('0x1c')},{'name':'parent_name','value':_0x5bfa75[_0x0aa1('0x1d')]},{'name':'direction','value':_0x4a00b5}];if(_0x635aab[_0x0aa1('0x1e')]){_[_0x0aa1('0x1f')](_0x635aab,function(_0x40a7d9){if(_0xd6205c[_0x40a7d9[_0x0aa1('0x20')]]){_0x3b17b2[_0x0aa1('0x21')]({'name':_0x40a7d9[_0x0aa1('0x22')],'value':_0xd6205c[_0x40a7d9['variableName']]});}});}return request({'form':{'method':_0x0aa1('0x23'),'input_type':'JSON','response_type':_0x0aa1('0x24'),'rest_data':JSON['stringify']({'session':_0x556e21['id'],'module_name':_0x0aa1('0x25'),'name_value_list':_0x3b17b2})}});}function getAuth(_0x78794c){return util[_0x0aa1('0x26')](_0x0aa1('0x27'),new Buffer(_0x78794c[_0x0aa1('0x28')]+':X')[_0x0aa1('0x29')](_0x0aa1('0x2a')));}function getServerInfo(_0x62e132){return request({'form':{'method':_0x0aa1('0x2b'),'input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x62e132['id']})}});}function getUser(_0x50486d,_0x1810d6,_0x411e6b){if(!_[_0x0aa1('0x2d')](_0x1810d6)){logger[_0x0aa1('0xd')](_0x0aa1('0x2e'),_0x1810d6);return request({'form':{'method':_0x0aa1('0x2f'),'input_type':'JSON','response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x411e6b['id'],'module_name':_0x0aa1('0x30'),'query':util[_0x0aa1('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1810d6),'order_by':'','offset':'0','select_fields':['id',_0x0aa1('0x1d'),_0x0aa1('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0aa1('0x32')](function(_0x4ffc9a){if(_0x4ffc9a[_0x0aa1('0x33')]['length']){var _0x3550db=_[_0x0aa1('0x34')](_0x4ffc9a['entry_list'],function(_0x3a72d4){return _0x3a72d4[_0x0aa1('0x35')][_0x0aa1('0x31')]['value']===_0x1810d6;});if(_0x3550db){logger[_0x0aa1('0xd')](_0x0aa1('0x36'));return BPromise[_0x0aa1('0x37')]({'id':_0x3550db['name_value_list']['id']['value'],'name':_0x3550db[_0x0aa1('0x35')][_0x0aa1('0x1d')]['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0aa1('0x37')]({'id':_0x411e6b['name_value_list'][_0x0aa1('0x38')][_0x0aa1('0x39')],'name':_0x411e6b[_0x0aa1('0x35')]['user_name'][_0x0aa1('0x39')]});});}else{logger[_0x0aa1('0xd')](_0x0aa1('0x3a'));return BPromise[_0x0aa1('0x37')]({'id':_0x411e6b[_0x0aa1('0x35')][_0x0aa1('0x38')][_0x0aa1('0x39')],'name':_0x411e6b[_0x0aa1('0x35')][_0x0aa1('0x31')][_0x0aa1('0x39')]});}}function getEndUser(_0x3d5767,_0x2f9320,_0x40c99f,_0x1b0387){logger['info'](_0x0aa1('0x3b'),_0x40c99f);return request({'form':{'method':'get_entry_list','input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x1b0387['id'],'module_name':_0x0aa1('0x1c'),'query':util[_0x0aa1('0x26')](_0x0aa1('0x3c'),_0x40c99f),'order_by':'','offset':'0','select_fields':['id',_0x0aa1('0x1d'),_0x0aa1('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0aa1('0x32')](function(_0x165dd7){if(_0x165dd7['entry_list']['length']){var _0x142155=_['find'](_0x165dd7['entry_list'],function(_0x329ebf){return _0x329ebf[_0x0aa1('0x35')][_0x0aa1('0x3d')][_0x0aa1('0x39')]===_0x40c99f;});if(_0x142155){logger['info'](_0x0aa1('0x3e'));return BPromise[_0x0aa1('0x37')]({'id':_0x142155['name_value_list']['id'][_0x0aa1('0x39')],'name':_0x142155[_0x0aa1('0x35')][_0x0aa1('0x1d')]['value'],'phone':_0x142155[_0x0aa1('0x35')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x1b0387['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0aa1('0x3f'),'value':_0x2f9320!==_0x0aa1('0x40')?_0x2f9320:util['format'](_0x0aa1('0x41'),_0x40c99f)},{'name':_0x0aa1('0x3d'),'value':_0x40c99f}]})}})[_0x0aa1('0x32')](function(_0xbd617c){logger[_0x0aa1('0xd')](_0x0aa1('0x42'));return BPromise[_0x0aa1('0x37')]({'id':_0xbd617c['id'],'name':_0xbd617c[_0x0aa1('0x33')][_0x0aa1('0x3f')][_0x0aa1('0x39')],'phone':_0xbd617c[_0x0aa1('0x33')][_0x0aa1('0x3d')][_0x0aa1('0x39')]});});}});}function request(_0x5873e1){logger[_0x0aa1('0x43')]('[HTTP]',JSON[_0x0aa1('0x2c')](_0x5873e1));return rp(_[_0x0aa1('0x44')](def,_0x5873e1));}function getTags(_0x5ccd2e,_0x41e0a7){var _0x518be1=[];if(_0x5ccd2e&&_0x5ccd2e[_0x0aa1('0x1e')]>0x0){_0x518be1=_[_0x0aa1('0x45')](_0x5ccd2e,_0x41e0a7);}return _0x518be1;}function getCustomFields(_0x19f0f1,_0x4c83d6){var _0x23b8aa=[];var _0x4a7215={'custom_fields':[]};if(_0x19f0f1[_0x0aa1('0x1e')]>0x0){_[_0x0aa1('0x1f')](_0x19f0f1,function(_0x322df0){if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x47')&&_0x322df0[_0x0aa1('0x48')]&&!_0x322df0[_0x0aa1('0x49')]){_0x4a7215[_0x322df0[_0x0aa1('0x48')][_0x0aa1('0x4a')]()]=_0x322df0[_0x0aa1('0x4b')][_0x0aa1('0x29')]();}else if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x47')&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4a7215['custom_fields']['push']({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x322df0[_0x0aa1('0x4b')][_0x0aa1('0x29')]()});}else if(_0x322df0[_0x0aa1('0x46')]===_0x0aa1('0x4c')&&_0x322df0[_0x0aa1('0x20')]&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4c83d6[_0x322df0[_0x0aa1('0x20')]]&&_0x4a7215[_0x0aa1('0x4d')][_0x0aa1('0x21')]({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x4c83d6[_0x322df0[_0x0aa1('0x20')]][_0x0aa1('0x29')]()});}else if(_0x322df0['type']===_0x0aa1('0x4e')&&_0x322df0[_0x0aa1('0x4f')]&&_0x322df0[_0x0aa1('0x4f')][_0x0aa1('0x1d')]&&_0x322df0[_0x0aa1('0x22')]&&_0x322df0[_0x0aa1('0x49')]){_0x4c83d6[_0x322df0['Variable'][_0x0aa1('0x1d')][_0x0aa1('0x4a')]()]&&_0x4a7215[_0x0aa1('0x4d')][_0x0aa1('0x21')]({'id':_0x322df0[_0x0aa1('0x22')],'value':_0x4c83d6[_0x322df0[_0x0aa1('0x4f')][_0x0aa1('0x1d')][_0x0aa1('0x4a')]()][_0x0aa1('0x29')]()});}});}return _0x4a7215;}function getConnection(_0x51053a){return request({'method':_0x0aa1('0xb'),'form':{'method':_0x0aa1('0x50'),'input_type':_0x0aa1('0x24'),'response_type':'JSON','rest_data':JSON[_0x0aa1('0x2c')]({'user_auth':{'user_name':_0x51053a[_0x0aa1('0x51')],'password':_0x51053a[_0x0aa1('0x52')],'encryption':'PLAIN'},'application':_0x0aa1('0x53')})}})[_0x0aa1('0x32')](function(_0xc886ef){var _0x374983=_0xc886ef;if(_0x374983['id']){def[_0x0aa1('0x54')]=_0x374983['id'];return BPromise[_0x0aa1('0x37')](_0x374983);}else{throw new Error(util['format'](_0x0aa1('0x55'),_0x51053a['id']));}});}function setRelationship(_0x8276b1,_0x3f058f,_0x5cfdf7,_0x51fca1){return request({'form':{'method':_0x0aa1('0x56'),'input_type':_0x0aa1('0x24'),'response_type':_0x0aa1('0x24'),'rest_data':JSON[_0x0aa1('0x2c')]({'session':_0x8276b1['id'],'module_name':_0x0aa1('0x25'),'module_id':_0x5cfdf7['id'],'link_field_name':_0x51fca1,'related_ids':[_0x3f058f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0aa1('0x57')]=function(_0x12d895,_0x3a55c5,_0x3427d2,_0x2d5f2c,_0x305d98,_0x273215){var _0x158ec1,_0x37a50a,_0x411abe,_0x54c49e;_0x273215[_0x0aa1('0x58')]=intUtil[_0x0aa1('0x59')](_0x273215['remoteUri']);_0x273215['serverUrl']=intUtil[_0x0aa1('0x59')](_0x273215[_0x0aa1('0x5a')]);def[_0x0aa1('0x5b')]=util[_0x0aa1('0x26')](_0x0aa1('0x5c'),_0x273215[_0x0aa1('0x58')]);if(_0x305d98&&_0x305d98[_0x0aa1('0x5d')]){logger[_0x0aa1('0xd')](_0x0aa1('0x5e'),'Recording\x20is\x20enabled!');_0x3a55c5[_0x0aa1('0x5f')]=util[_0x0aa1('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x273215['serverUrl'],_0x3a55c5[_0x0aa1('0x60')],md5(_0x3a55c5[_0x0aa1('0x60')]));}else{_0x3a55c5[_0x0aa1('0x5f')]='';}return getConnection(_0x273215)['then'](function(_0x192cf6){_0x54c49e=_0x192cf6;return getUser(_0x273215,_0x2d5f2c['name'],_0x54c49e);})[_0x0aa1('0x32')](function(_0x42ad37){_0x158ec1=_0x42ad37;logger[_0x0aa1('0xd')]('The\x20User\x20ID\x20is:',_0x158ec1['id']);return getEndUser(_0x273215,_0x3a55c5[_0x0aa1('0x61')],_0x3a55c5[_0x0aa1('0x62')],_0x54c49e);})['then'](function(_0x1e09a3){_0x37a50a=_0x1e09a3;logger['info'](_0x0aa1('0x63'),_0x37a50a['id']);return getTicket(_0x273215,_0x158ec1,_0x37a50a,_0x3427d2,_0x3a55c5,_0x3427d2['Fields'],_0x54c49e,'Inbound');})[_0x0aa1('0x32')](function(_0x5bc4af){_0x411abe=_0x5bc4af;logger[_0x0aa1('0xd')](_0x0aa1('0x64'));logger['info'](_0x0aa1('0x65'),_0x411abe['id']);return setRelationship(_0x54c49e,_0x158ec1,_0x411abe,_0x0aa1('0x66'));})[_0x0aa1('0x32')](function(){return setRelationship(_0x54c49e,_0x37a50a,_0x411abe,'contacts');})[_0x0aa1('0x32')](function(){return getServerInfo(_0x54c49e);})[_0x0aa1('0x32')](function(_0x558057){var _0xac8207=parseInt(_0x558057['version'][_0x0aa1('0x67')](0x0));var _0x4411ee=util[_0x0aa1('0x26')](_0x0aa1('0x68'),_0x273215[_0x0aa1('0x58')],_0x411abe['id']);if(_0xac8207>0x6){_0x4411ee=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x273215[_0x0aa1('0x58')],_0x411abe['id']);}logger[_0x0aa1('0xd')](_0x0aa1('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0aa1('0x26')](_0x0aa1('0x69'),_0x2d5f2c[_0x0aa1('0x1d')]),_0x0aa1('0x6a'),{'uri':_0x4411ee});})[_0x0aa1('0x6b')](function(_0xad6836){logger[_0x0aa1('0x6c')](_0x0aa1('0x5e'),JSON[_0x0aa1('0x2c')](_0xad6836));});};exports[_0x0aa1('0x6d')]=function(_0x520dfc,_0x33095c,_0x3efbc5,_0x584e9b,_0x57caf1,_0x796d77,_0x419a6b){var _0x40b17d,_0x57ae02,_0xf5712f,_0x55df70;_0x796d77[_0x0aa1('0x58')]=intUtil[_0x0aa1('0x59')](_0x796d77[_0x0aa1('0x58')]);_0x796d77[_0x0aa1('0x5a')]=intUtil[_0x0aa1('0x59')](_0x796d77[_0x0aa1('0x5a')]);def['uri']=util[_0x0aa1('0x26')](_0x0aa1('0x5c'),_0x796d77[_0x0aa1('0x58')]);if(_0x419a6b&&_0x419a6b['recordingFormat']&&_0x419a6b[_0x0aa1('0x6e')]!==_0x0aa1('0x6f')){logger['info']('[OUTBOUND]',_0x0aa1('0x70'));_0x33095c[_0x0aa1('0x5f')]=util['format'](_0x0aa1('0x71'),_0x796d77['serverUrl'],_0x33095c[_0x0aa1('0x60')],md5(_0x33095c[_0x0aa1('0x60')]));}return getConnection(_0x796d77)[_0x0aa1('0x32')](function(_0xe5123c){_0x55df70=_0xe5123c;return getUser(_0x796d77,_0x584e9b[_0x0aa1('0x1d')],_0x55df70);})['then'](function(_0xd0a751){_0x40b17d=_0xd0a751;logger[_0x0aa1('0xd')](_0x0aa1('0x72'),_0x40b17d['id']);return getEndUser(_0x796d77,_0x33095c['destcalleridname'],_0x33095c[_0x0aa1('0x73')],_0x55df70);})[_0x0aa1('0x32')](function(_0x33e098){_0x57ae02=_0x33e098;logger[_0x0aa1('0xd')]('The\x20Enduser\x20ID\x20is:',_0x57ae02['id']);return getTicket(_0x796d77,_0x40b17d,_0x57ae02,_0x3efbc5,_0x33095c,_0x3efbc5[_0x0aa1('0x74')],_0x55df70,_0x0aa1('0x75'));})[_0x0aa1('0x32')](function(_0x245ac2){_0xf5712f=_0x245ac2;logger[_0x0aa1('0xd')]('Ticket\x20created!');logger['info'](_0x0aa1('0x65'),_0xf5712f['id']);return setRelationship(_0x55df70,_0x40b17d,_0xf5712f,_0x0aa1('0x66'));})[_0x0aa1('0x32')](function(){return setRelationship(_0x55df70,_0x57ae02,_0xf5712f,_0x0aa1('0x76'));})['then'](function(){return getServerInfo(_0x55df70);})[_0x0aa1('0x32')](function(_0x3b1977){var _0x2c896a=parseInt(_0x3b1977[_0x0aa1('0x77')][_0x0aa1('0x67')](0x0));var _0x4e853f=util[_0x0aa1('0x26')](_0x0aa1('0x68'),_0x796d77[_0x0aa1('0x58')],_0xf5712f['id']);if(_0x2c896a>0x6){_0x4e853f=util[_0x0aa1('0x26')](_0x0aa1('0x78'),_0x796d77[_0x0aa1('0x58')],_0xf5712f['id']);}logger[_0x0aa1('0xd')](_0x0aa1('0x79'),_0x0aa1('0x7a'));emit(util[_0x0aa1('0x26')](_0x0aa1('0x69'),_0x584e9b[_0x0aa1('0x1d')]),_0x0aa1('0x6a'),{'uri':_0x4e853f});})[_0x0aa1('0x6b')](function(_0x150021){logger[_0x0aa1('0x6c')]('[OUTBOUND]',JSON[_0x0aa1('0x2c')](_0x150021));});};exports['unmanaged']=function(_0x245972,_0x58d9a9,_0x271ea2,_0x1dd172,_0x560f2a,_0x2e90c6){var _0x3bf6f8,_0x1f04e1,_0x2bc22a,_0x2c8892;_0x2e90c6['remoteUri']=intUtil[_0x0aa1('0x59')](_0x2e90c6[_0x0aa1('0x58')]);_0x2e90c6[_0x0aa1('0x5a')]=intUtil['stripTrailingSlash'](_0x2e90c6[_0x0aa1('0x5a')]);def[_0x0aa1('0x5b')]=util['format'](_0x0aa1('0x5c'),_0x2e90c6['remoteUri']);if(_0x560f2a&&_0x560f2a['monitor_format']){logger[_0x0aa1('0xd')]('['+_0x58d9a9[_0x0aa1('0x7b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x58d9a9[_0x0aa1('0x5f')]=util[_0x0aa1('0x26')](_0x0aa1('0x71'),_0x2e90c6[_0x0aa1('0x5a')],_0x58d9a9['uniqueid'],md5(_0x58d9a9[_0x0aa1('0x60')]));}else{_0x58d9a9['recordingURL']='';}return getConnection(_0x2e90c6)[_0x0aa1('0x32')](function(_0x26ffec){_0x2c8892=_0x26ffec;if(!_['isNil'](_0x1dd172)){return getUser(_0x2e90c6,_0x1dd172['name'],_0x2c8892);}else{return getUser(_0x2e90c6,null,_0x2c8892);}})[_0x0aa1('0x32')](function(_0x13ac09){_0x3bf6f8=_0x13ac09;logger[_0x0aa1('0xd')](_0x0aa1('0x72'),_0x3bf6f8['id']);return getEndUser(_0x2e90c6,_0x58d9a9[_0x0aa1('0x61')],_0x58d9a9[_0x0aa1('0x62')],_0x2c8892);})[_0x0aa1('0x32')](function(_0x787d4f){_0x1f04e1=_0x787d4f;logger[_0x0aa1('0xd')](_0x0aa1('0x63'),_0x1f04e1['id']);return getTicket(_0x2e90c6,_0x3bf6f8,_0x1f04e1,_0x271ea2,_0x58d9a9,_0x271ea2['Fields'],_0x2c8892,_0x0aa1('0x7c'));})['then'](function(_0x4d35d8){_0x2bc22a=_0x4d35d8;logger['info'](_0x0aa1('0x64'));logger[_0x0aa1('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2bc22a['id']);return setRelationship(_0x2c8892,_0x3bf6f8,_0x2bc22a,_0x0aa1('0x66'));})['then'](function(){return setRelationship(_0x2c8892,_0x1f04e1,_0x2bc22a,_0x0aa1('0x76'));})[_0x0aa1('0x32')](function(){return getServerInfo(_0x2c8892);})[_0x0aa1('0x6b')](function(_0x4bbc75){logger['error']('['+_0x58d9a9[_0x0aa1('0x7b')]['toUpperCase']()+']',JSON[_0x0aa1('0x2c')](_0x4bbc75));});}; \ No newline at end of file +var _0x775e=['JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','content','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','version','unmanaged','monitor_format','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','parent_name','name','direction','variableName','push'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x775e,0xda));var _0xe775=function(_0x395f5f,_0x10a8f8){_0x395f5f=_0x395f5f-0x0;var _0x2a7cb5=_0x775e[_0x395f5f];return _0x2a7cb5;};'use strict';var _=require(_0xe775('0x0'));var rp=require('request-promise');var BPromise=require(_0xe775('0x1'));var md5=require(_0xe775('0x2'));var util=require(_0xe775('0x3'));var Redis=require(_0xe775('0x4'));var intUtil=require('./util');var config=require(_0xe775('0x5'));var logger=require(_0xe775('0x6'))(_0xe775('0x7'));config['redis']=_[_0xe775('0x8')](config[_0xe775('0x9')],{'host':_0xe775('0xa'),'port':0x18eb});var io=require(_0xe775('0xb'))(new Redis(config['redis']));var def={'method':_0xe775('0xc'),'json':!![]};function emit(_0x526fa7,_0x2b7999,_0x3759fc){io['to'](_0x526fa7)[_0xe775('0xd')](_0x2b7999,_0x3759fc);}function getTicket(_0xe71e89,_0xad9cf4,_0x2b9a5b,_0x58c160,_0x5cf8ba,_0x1f3e1c,_0x420616,_0x54fc4){logger[_0xe775('0xe')](_0xe775('0xf'));var _0x9325d=new Date();var _0x18f5ad=[{'name':'name','value':intUtil[_0xe775('0x10')](_0x58c160[_0xe775('0x11')],_0x5cf8ba,'\x20')},{'name':_0xe775('0x12'),'value':_0xad9cf4['id']},{'name':_0xe775('0x13'),'value':_0xad9cf4['id']},{'name':_0xe775('0x14'),'value':intUtil['getString'](_0x58c160['Descriptions'],_0x5cf8ba,'\x0a')},{'name':_0xe775('0x15'),'value':_0x9325d[_0xe775('0x16')]()[_0xe775('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0xe775('0x18'),'value':'0'},{'name':_0xe775('0x19'),'value':'15'},{'name':'parent_id','value':_0x2b9a5b['id']},{'name':_0xe775('0x1a'),'value':'Contacts'},{'name':_0xe775('0x1b'),'value':_0x2b9a5b[_0xe775('0x1c')]},{'name':_0xe775('0x1d'),'value':_0x54fc4}];if(_0x1f3e1c['length']){_['forEach'](_0x1f3e1c,function(_0x476214){if(_0x5cf8ba[_0x476214[_0xe775('0x1e')]]){_0x18f5ad[_0xe775('0x1f')]({'name':_0x476214['idField'],'value':_0x5cf8ba[_0x476214[_0xe775('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x420616['id'],'module_name':_0xe775('0x22'),'name_value_list':_0x18f5ad})}});}function getAuth(_0xc9919){return util[_0xe775('0x23')](_0xe775('0x24'),new Buffer(_0xc9919[_0xe775('0x25')]+':X')[_0xe775('0x26')](_0xe775('0x27')));}function getServerInfo(_0xfdf957){return request({'form':{'method':_0xe775('0x28'),'input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0xfdf957['id']})}});}function getUser(_0x26c771,_0x56a781,_0x12ca00){if(!_[_0xe775('0x29')](_0x56a781)){logger[_0xe775('0xe')](_0xe775('0x2a'),_0x56a781);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON['stringify']({'session':_0x12ca00['id'],'module_name':'Employees','query':util[_0xe775('0x23')](_0xe775('0x2b'),_0x56a781),'order_by':'','offset':'0','select_fields':['id',_0xe775('0x1c'),_0xe775('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe775('0x2d')](function(_0x52f782){if(_0x52f782[_0xe775('0x2e')][_0xe775('0x2f')]){var _0xc02980=_['find'](_0x52f782[_0xe775('0x2e')],function(_0xce176){return _0xce176[_0xe775('0x30')][_0xe775('0x2c')][_0xe775('0x31')]===_0x56a781;});if(_0xc02980){logger[_0xe775('0xe')](_0xe775('0x32'));return BPromise['resolve']({'id':_0xc02980[_0xe775('0x30')]['id']['value'],'name':_0xc02980[_0xe775('0x30')][_0xe775('0x1c')]['value']});}}logger[_0xe775('0xe')](_0xe775('0x33'));return BPromise[_0xe775('0x34')]({'id':_0x12ca00[_0xe775('0x30')][_0xe775('0x35')][_0xe775('0x31')],'name':_0x12ca00['name_value_list']['user_name'][_0xe775('0x31')]});});}else{logger['info'](_0xe775('0x36'));return BPromise[_0xe775('0x34')]({'id':_0x12ca00[_0xe775('0x30')][_0xe775('0x35')][_0xe775('0x31')],'name':_0x12ca00['name_value_list'][_0xe775('0x2c')][_0xe775('0x31')]});}}function getEndUser(_0x23c3c7,_0x1bc7a1,_0x430a18,_0x7e5fc6){logger[_0xe775('0xe')]('Searching\x20enduser\x20with\x20phone',_0x430a18);return request({'form':{'method':_0xe775('0x37'),'input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x7e5fc6['id'],'module_name':_0xe775('0x38'),'query':util[_0xe775('0x23')](_0xe775('0x39'),_0x430a18),'order_by':'','offset':'0','select_fields':['id',_0xe775('0x1c'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe775('0x2d')](function(_0x22e706){if(_0x22e706['entry_list']['length']){var _0x35636c=_[_0xe775('0x3a')](_0x22e706[_0xe775('0x2e')],function(_0x58875b){return _0x58875b['name_value_list'][_0xe775('0x3b')][_0xe775('0x31')]===_0x430a18;});if(_0x35636c){logger[_0xe775('0xe')](_0xe775('0x3c'));return BPromise['resolve']({'id':_0x35636c[_0xe775('0x30')]['id']['value'],'name':_0x35636c[_0xe775('0x30')]['name']['value'],'phone':_0x35636c[_0xe775('0x30')][_0xe775('0x3b')][_0xe775('0x31')]});}}else{logger[_0xe775('0xe')](_0xe775('0x3d'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x7e5fc6['id'],'module_name':_0xe775('0x38'),'name_value_list':[{'name':_0xe775('0x3e'),'value':_0x1bc7a1!==_0xe775('0x3f')?_0x1bc7a1:util[_0xe775('0x23')]('Caller\x20-\x20%s',_0x430a18)},{'name':'phone_home','value':_0x430a18}]})}})[_0xe775('0x2d')](function(_0x5d5d82){logger[_0xe775('0xe')](_0xe775('0x40'));return BPromise[_0xe775('0x34')]({'id':_0x5d5d82['id'],'name':_0x5d5d82[_0xe775('0x2e')][_0xe775('0x3e')]['value'],'phone':_0x5d5d82['entry_list'][_0xe775('0x3b')][_0xe775('0x31')]});});}});}function request(_0x3a85de){logger[_0xe775('0x41')](_0xe775('0x42'),JSON['stringify'](_0x3a85de));return rp(_[_0xe775('0x43')](def,_0x3a85de));}function getTags(_0xdc6dda,_0x405ab9){var _0x3cf6c2=[];if(_0xdc6dda&&_0xdc6dda['length']>0x0){_0x3cf6c2=_[_0xe775('0x44')](_0xdc6dda,_0x405ab9);}return _0x3cf6c2;}function getCustomFields(_0x36783f,_0x138864){var _0x106860=[];var _0x5d47b4={'custom_fields':[]};if(_0x36783f[_0xe775('0x2f')]>0x0){_['forEach'](_0x36783f,function(_0x4cb4ae){if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x46')&&_0x4cb4ae['nameField']&&!_0x4cb4ae[_0xe775('0x47')]){_0x5d47b4[_0x4cb4ae[_0xe775('0x48')]['toLowerCase']()]=_0x4cb4ae[_0xe775('0x49')][_0xe775('0x26')]();}else if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x46')&&_0x4cb4ae[_0xe775('0x4a')]&&_0x4cb4ae[_0xe775('0x47')]){_0x5d47b4[_0xe775('0x4b')][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x4cb4ae[_0xe775('0x49')]['toString']()});}else if(_0x4cb4ae['type']===_0xe775('0x4c')&&_0x4cb4ae[_0xe775('0x1e')]&&_0x4cb4ae[_0xe775('0x4a')]&&_0x4cb4ae[_0xe775('0x47')]){_0x138864[_0x4cb4ae['variableName']]&&_0x5d47b4['custom_fields'][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x138864[_0x4cb4ae['variableName']][_0xe775('0x26')]()});}else if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x4d')&&_0x4cb4ae[_0xe775('0x4e')]&&_0x4cb4ae[_0xe775('0x4e')][_0xe775('0x1c')]&&_0x4cb4ae['idField']&&_0x4cb4ae[_0xe775('0x47')]){_0x138864[_0x4cb4ae[_0xe775('0x4e')]['name'][_0xe775('0x4f')]()]&&_0x5d47b4[_0xe775('0x4b')][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x138864[_0x4cb4ae[_0xe775('0x4e')][_0xe775('0x1c')]['toLowerCase']()][_0xe775('0x26')]()});}});}return _0x5d47b4;}function getConnection(_0x4e0040){return request({'method':_0xe775('0xc'),'form':{'method':_0xe775('0x50'),'input_type':_0xe775('0x20'),'response_type':'JSON','rest_data':JSON[_0xe775('0x21')]({'user_auth':{'user_name':_0x4e0040['username'],'password':_0x4e0040['password'],'encryption':_0xe775('0x51')},'application':_0xe775('0x52')})}})[_0xe775('0x2d')](function(_0xc8f67){var _0x22d45b=_0xc8f67;if(_0x22d45b['id']){def[_0xe775('0x53')]=_0x22d45b['id'];return BPromise[_0xe775('0x34')](_0x22d45b);}else{throw new Error(util[_0xe775('0x23')](_0xe775('0x54'),_0x4e0040['id']));}});}function setRelationship(_0x3eafec,_0xe4c4,_0x4e7ea1,_0x206641){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON['stringify']({'session':_0x3eafec['id'],'module_name':_0xe775('0x22'),'module_id':_0x4e7ea1['id'],'link_field_name':_0x206641,'related_ids':[_0xe4c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe775('0x55')]=function(_0x21cac6,_0x573d3e,_0xefd5d9,_0x396ec1,_0x534282,_0xb89e33){var _0x45ade8,_0x17251f,_0x2bfcc4,_0x5e4fc8;_0xb89e33[_0xe775('0x56')]=intUtil['stripTrailingSlash'](_0xb89e33['remoteUri']);_0xb89e33[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0xb89e33['serverUrl']);def[_0xe775('0x59')]=util['format'](_0xe775('0x5a'),_0xb89e33[_0xe775('0x56')]);if(_0x534282&&_0x534282['monitor_format']){logger[_0xe775('0xe')](_0xe775('0x5b'),'Recording\x20is\x20enabled!');_0x573d3e['recordingURL']=util[_0xe775('0x23')](_0xe775('0x5c'),_0xb89e33[_0xe775('0x57')],_0x573d3e[_0xe775('0x5d')],md5(_0x573d3e[_0xe775('0x5d')]));}else{_0x573d3e[_0xe775('0x5e')]='';}return getConnection(_0xb89e33)[_0xe775('0x2d')](function(_0x49ef6d){_0x5e4fc8=_0x49ef6d;return getUser(_0xb89e33,_0x396ec1['name'],_0x5e4fc8);})[_0xe775('0x2d')](function(_0x33430d){_0x45ade8=_0x33430d;logger[_0xe775('0xe')](_0xe775('0x5f'),_0x45ade8['id']);return getEndUser(_0xb89e33,_0x573d3e[_0xe775('0x60')],_0x573d3e[_0xe775('0x61')],_0x5e4fc8);})[_0xe775('0x2d')](function(_0x3a3da7){_0x17251f=_0x3a3da7;logger[_0xe775('0xe')](_0xe775('0x62'),_0x17251f['id']);return getTicket(_0xb89e33,_0x45ade8,_0x17251f,_0xefd5d9,_0x573d3e,_0xefd5d9[_0xe775('0x63')],_0x5e4fc8,_0xe775('0x64'));})[_0xe775('0x2d')](function(_0x325ad5){_0x2bfcc4=_0x325ad5;logger['info'](_0xe775('0x65'));logger[_0xe775('0xe')](_0xe775('0x66'),_0x2bfcc4['id']);return setRelationship(_0x5e4fc8,_0x45ade8,_0x2bfcc4,_0xe775('0x67'));})[_0xe775('0x2d')](function(){return setRelationship(_0x5e4fc8,_0x17251f,_0x2bfcc4,_0xe775('0x68'));})[_0xe775('0x2d')](function(){return getServerInfo(_0x5e4fc8);})[_0xe775('0x2d')](function(_0x2d94b2){var _0x362e6f=parseInt(_0x2d94b2['version'][_0xe775('0x69')](0x0));var _0x4862b4=util[_0xe775('0x23')](_0xe775('0x6a'),_0xb89e33[_0xe775('0x56')],_0x2bfcc4['id']);if(_0x362e6f>0x6){_0x4862b4=util[_0xe775('0x23')](_0xe775('0x6b'),_0xb89e33[_0xe775('0x56')],_0x2bfcc4['id']);}logger[_0xe775('0xe')]('[QUEUE]',_0xe775('0x6c'));emit(util['format']('user:%s',_0x396ec1[_0xe775('0x1c')]),_0xe775('0x6d'),{'uri':_0x4862b4});})[_0xe775('0x6e')](function(_0x50aad9){logger[_0xe775('0x6f')](_0xe775('0x5b'),JSON[_0xe775('0x21')](_0x50aad9));});};exports[_0xe775('0x70')]=function(_0x2b28aa,_0x4f8fff,_0x4a8506,_0x2082db,_0xa5d07c,_0x2988ae,_0x9f97fa){var _0x567ceb,_0xdc9b3c,_0x28c02f,_0x238baf;_0x2988ae['remoteUri']=intUtil['stripTrailingSlash'](_0x2988ae[_0xe775('0x56')]);_0x2988ae[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0x2988ae[_0xe775('0x57')]);def[_0xe775('0x59')]=util[_0xe775('0x23')](_0xe775('0x5a'),_0x2988ae[_0xe775('0x56')]);if(_0x9f97fa&&_0x9f97fa[_0xe775('0x71')]&&_0x9f97fa['recordingFormat']!==_0xe775('0x72')){logger[_0xe775('0xe')](_0xe775('0x73'),_0xe775('0x74'));_0x4f8fff[_0xe775('0x5e')]=util[_0xe775('0x23')](_0xe775('0x5c'),_0x2988ae[_0xe775('0x57')],_0x4f8fff['uniqueid'],md5(_0x4f8fff[_0xe775('0x5d')]));}return getConnection(_0x2988ae)[_0xe775('0x2d')](function(_0x2b6795){_0x238baf=_0x2b6795;return getUser(_0x2988ae,_0x2082db['name'],_0x238baf);})[_0xe775('0x2d')](function(_0x48f303){_0x567ceb=_0x48f303;logger[_0xe775('0xe')](_0xe775('0x5f'),_0x567ceb['id']);return getEndUser(_0x2988ae,_0x4f8fff[_0xe775('0x75')],_0x4f8fff[_0xe775('0x76')],_0x238baf);})['then'](function(_0x5914f5){_0xdc9b3c=_0x5914f5;logger[_0xe775('0xe')](_0xe775('0x62'),_0xdc9b3c['id']);return getTicket(_0x2988ae,_0x567ceb,_0xdc9b3c,_0x4a8506,_0x4f8fff,_0x4a8506['Fields'],_0x238baf,_0xe775('0x77'));})['then'](function(_0x1fe184){_0x28c02f=_0x1fe184;logger[_0xe775('0xe')]('Ticket\x20created!');logger[_0xe775('0xe')](_0xe775('0x66'),_0x28c02f['id']);return setRelationship(_0x238baf,_0x567ceb,_0x28c02f,'users');})[_0xe775('0x2d')](function(){return setRelationship(_0x238baf,_0xdc9b3c,_0x28c02f,_0xe775('0x68'));})[_0xe775('0x2d')](function(){return getServerInfo(_0x238baf);})[_0xe775('0x2d')](function(_0x1f993c){var _0x6001a0=parseInt(_0x1f993c[_0xe775('0x78')][_0xe775('0x69')](0x0));var _0x526550=util[_0xe775('0x23')](_0xe775('0x6a'),_0x2988ae[_0xe775('0x56')],_0x28c02f['id']);if(_0x6001a0>0x6){_0x526550=util[_0xe775('0x23')](_0xe775('0x6b'),_0x2988ae[_0xe775('0x56')],_0x28c02f['id']);}logger[_0xe775('0xe')](_0xe775('0x73'),_0xe775('0x6c'));emit(util[_0xe775('0x23')]('user:%s',_0x2082db[_0xe775('0x1c')]),'trigger:browser:url',{'uri':_0x526550});})[_0xe775('0x6e')](function(_0x4a43a8){logger[_0xe775('0x6f')]('[OUTBOUND]',JSON[_0xe775('0x21')](_0x4a43a8));});};exports[_0xe775('0x79')]=function(_0x418db3,_0x4b4539,_0x51b896,_0x21326a,_0x3c6d60,_0x38cb75){var _0x255449,_0x31ea03,_0x310964,_0x51087b;_0x38cb75[_0xe775('0x56')]=intUtil['stripTrailingSlash'](_0x38cb75['remoteUri']);_0x38cb75[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0x38cb75[_0xe775('0x57')]);def[_0xe775('0x59')]=util[_0xe775('0x23')](_0xe775('0x5a'),_0x38cb75[_0xe775('0x56')]);if(_0x3c6d60&&_0x3c6d60[_0xe775('0x7a')]){logger[_0xe775('0xe')]('['+_0x4b4539[_0xe775('0x7b')][_0xe775('0x7c')]()+']',_0xe775('0x74'));_0x4b4539[_0xe775('0x5e')]=util[_0xe775('0x23')](_0xe775('0x5c'),_0x38cb75[_0xe775('0x57')],_0x4b4539[_0xe775('0x5d')],md5(_0x4b4539[_0xe775('0x5d')]));}else{_0x4b4539['recordingURL']='';}return getConnection(_0x38cb75)['then'](function(_0x252b5e){_0x51087b=_0x252b5e;if(!_[_0xe775('0x29')](_0x21326a)){return getUser(_0x38cb75,_0x21326a[_0xe775('0x1c')],_0x51087b);}else{return getUser(_0x38cb75,null,_0x51087b);}})[_0xe775('0x2d')](function(_0x1e9815){_0x255449=_0x1e9815;logger['info'](_0xe775('0x5f'),_0x255449['id']);return getEndUser(_0x38cb75,_0x4b4539[_0xe775('0x60')],_0x4b4539[_0xe775('0x61')],_0x51087b);})[_0xe775('0x2d')](function(_0x185236){_0x31ea03=_0x185236;logger[_0xe775('0xe')](_0xe775('0x62'),_0x31ea03['id']);return getTicket(_0x38cb75,_0x255449,_0x31ea03,_0x51b896,_0x4b4539,_0x51b896[_0xe775('0x63')],_0x51087b,_0xe775('0x64'));})[_0xe775('0x2d')](function(_0x49af4a){_0x310964=_0x49af4a;logger[_0xe775('0xe')](_0xe775('0x65'));logger[_0xe775('0xe')](_0xe775('0x66'),_0x310964['id']);return setRelationship(_0x51087b,_0x255449,_0x310964,_0xe775('0x67'));})[_0xe775('0x2d')](function(){return setRelationship(_0x51087b,_0x31ea03,_0x310964,'contacts');})[_0xe775('0x2d')](function(){return getServerInfo(_0x51087b);})[_0xe775('0x6e')](function(_0x1d5591){logger[_0xe775('0x6f')]('['+_0x4b4539[_0xe775('0x7b')]['toUpperCase']()+']',JSON[_0xe775('0x21')](_0x1d5591));});}; \ 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 a709f4f..2a14af2 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 _0x5d69=['Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','variable','join','stripTrailingSlash','slice','test','lodash','util','getString','sortBy','length','type','string','push','variableName'];(function(_0x31a3eb,_0x1f7522){var _0x295914=function(_0x4312b1){while(--_0x4312b1){_0x31a3eb['push'](_0x31a3eb['shift']());}};_0x295914(++_0x1f7522);}(_0x5d69,0x1af));var _0x95d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5d69[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x95d6('0x0'));var util=require(_0x95d6('0x1'));exports[_0x95d6('0x2')]=function(_0x5982b5,_0x394b3f,_0x40bf2d){var _0x1571c4=[];if(_0x5982b5['length']>0x0){var _0x1d752c=_[_0x95d6('0x3')](_0x5982b5,['id']);for(var _0x5d9c7a=0x0;_0x5d9c7a<_0x1d752c[_0x95d6('0x4')];_0x5d9c7a++){var _0x49b4f5=_0x1d752c[_0x5d9c7a];if(_0x49b4f5[_0x95d6('0x5')]===_0x95d6('0x6')){_0x1571c4[_0x95d6('0x7')](_0x49b4f5['content']);}else if(_0x49b4f5[_0x95d6('0x5')]==='variable'&&_0x49b4f5[_0x95d6('0x8')]){_0x394b3f[_0x49b4f5[_0x95d6('0x8')]]&&_0x1571c4['push'](_0x394b3f[_0x49b4f5[_0x95d6('0x8')]]['toString']());}else if(_0x49b4f5[_0x95d6('0x5')]==='customVariable'&&_0x49b4f5['Variable']&&_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')]){_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name'][_0x95d6('0xb')]()]&&_0x1571c4[_0x95d6('0x7')](_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name'][_0x95d6('0xb')]()]['toString']());}else if(_0x49b4f5[_0x95d6('0x5')]==='keyValue'){if(_0x49b4f5[_0x95d6('0xc')]===_0x95d6('0x6')&&_0x49b4f5['key']){_0x1571c4[_0x95d6('0x7')](util[_0x95d6('0xd')](_0x95d6('0xe'),_0x49b4f5[_0x95d6('0xf')],_0x49b4f5[_0x95d6('0x10')]));}else if(_0x49b4f5[_0x95d6('0xc')]===_0x95d6('0x11')&&_0x49b4f5[_0x95d6('0x8')]&&_0x49b4f5['key']){_0x394b3f[_0x49b4f5['variableName']]&&_0x1571c4['push'](util['format'](_0x95d6('0xe'),_0x49b4f5['key'],_0x394b3f[_0x49b4f5['variableName']]));}else if(_0x49b4f5[_0x95d6('0xc')]==='customVariable'&&_0x49b4f5['Variable']&&_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')]&&_0x49b4f5[_0x95d6('0xf')]){_0x394b3f[_0x49b4f5[_0x95d6('0x9')][_0x95d6('0xa')][_0x95d6('0xb')]()]&&_0x1571c4[_0x95d6('0x7')](util['format'](_0x95d6('0xe'),_0x49b4f5['key'],_0x394b3f[_0x49b4f5[_0x95d6('0x9')]['name']['toLowerCase']()]));}}}}return _0x1571c4[_0x95d6('0x12')](_0x40bf2d);};exports[_0x95d6('0x13')]=function(_0x239ca8){var _0x970a55=_0x239ca8[_0x95d6('0x14')](-0x1);if(_0x970a55==='/'){_0x239ca8=_0x239ca8['substring'](0x0,_0x239ca8['lastIndexOf'](_0x970a55));}return _0x239ca8;};exports['validateEmail']=function(_0x4c5ca4){if(!_['isNil'](_0x4c5ca4)&&_0x4c5ca4!==''){var _0x3c3b17=/^(([^<>()\[\]\\.,;:\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 _0x3c3b17[_0x95d6('0x15')](String(_0x4c5ca4)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xc74b=['substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0xc74b,0x148));var _0xbc74=function(_0x567301,_0x2532cb){_0x567301=_0x567301-0x0;var _0x597492=_0xc74b[_0x567301];return _0x597492;};'use strict';var _=require(_0xbc74('0x0'));var util=require(_0xbc74('0x1'));exports[_0xbc74('0x2')]=function(_0x41ec10,_0x1677c0,_0x1a957e){var _0x44b0ef=[];if(_0x41ec10[_0xbc74('0x3')]>0x0){var _0x4fa6ac=_[_0xbc74('0x4')](_0x41ec10,['id']);for(var _0xab08dd=0x0;_0xab08dd<_0x4fa6ac[_0xbc74('0x3')];_0xab08dd++){var _0x50e4b7=_0x4fa6ac[_0xab08dd];if(_0x50e4b7['type']==='string'){_0x44b0ef[_0xbc74('0x5')](_0x50e4b7[_0xbc74('0x6')]);}else if(_0x50e4b7[_0xbc74('0x7')]===_0xbc74('0x8')&&_0x50e4b7[_0xbc74('0x9')]){_0x1677c0[_0x50e4b7[_0xbc74('0x9')]]&&_0x44b0ef['push'](_0x1677c0[_0x50e4b7['variableName']][_0xbc74('0xa')]());}else if(_0x50e4b7[_0xbc74('0x7')]===_0xbc74('0xb')&&_0x50e4b7[_0xbc74('0xc')]&&_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]){_0x1677c0[_0x50e4b7['Variable'][_0xbc74('0xd')][_0xbc74('0xe')]()]&&_0x44b0ef[_0xbc74('0x5')](_0x1677c0[_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')][_0xbc74('0xe')]()][_0xbc74('0xa')]());}else if(_0x50e4b7['type']==='keyValue'){if(_0x50e4b7[_0xbc74('0xf')]===_0xbc74('0x10')&&_0x50e4b7['key']){_0x44b0ef['push'](util[_0xbc74('0x11')](_0xbc74('0x12'),_0x50e4b7[_0xbc74('0x13')],_0x50e4b7[_0xbc74('0x14')]));}else if(_0x50e4b7['keyType']===_0xbc74('0x8')&&_0x50e4b7[_0xbc74('0x9')]&&_0x50e4b7['key']){_0x1677c0[_0x50e4b7[_0xbc74('0x9')]]&&_0x44b0ef[_0xbc74('0x5')](util['format']('%s:\x20%s',_0x50e4b7[_0xbc74('0x13')],_0x1677c0[_0x50e4b7['variableName']]));}else if(_0x50e4b7[_0xbc74('0xf')]===_0xbc74('0xb')&&_0x50e4b7[_0xbc74('0xc')]&&_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]&&_0x50e4b7[_0xbc74('0x13')]){_0x1677c0[_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]['toLowerCase']()]&&_0x44b0ef[_0xbc74('0x5')](util[_0xbc74('0x11')](_0xbc74('0x12'),_0x50e4b7[_0xbc74('0x13')],_0x1677c0[_0x50e4b7[_0xbc74('0xc')]['name'][_0xbc74('0xe')]()]));}}}}return _0x44b0ef[_0xbc74('0x15')](_0x1a957e);};exports[_0xbc74('0x16')]=function(_0xfd9625){var _0x1c1040=_0xfd9625['slice'](-0x1);if(_0x1c1040==='/'){_0xfd9625=_0xfd9625[_0xbc74('0x17')](0x0,_0xfd9625[_0xbc74('0x18')](_0x1c1040));}return _0xfd9625;};exports['validateEmail']=function(_0x4e0760){if(!_[_0xbc74('0x19')](_0x4e0760)&&_0x4e0760!==''){var _0x5c1522=/^(([^<>()\[\]\\.,;:\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 _0x5c1522[_0xbc74('0x1a')](String(_0x4e0760)[_0xbc74('0xe')]());}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 73edec4..a9b9bf0 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 _0xd00a=['error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','remoteUri','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','userId','admin','catch','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','query','sessionName','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;','success','firstname','lastname','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','getConnection','[HTTP]','stripTrailingSlash','monitor_format','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','[QUEUE]','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','type','idField','content','toString','variableName','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','username','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s'];(function(_0x314c7a,_0x3efd8e){var _0x3a6b81=function(_0x18ae60){while(--_0x18ae60){_0x314c7a['push'](_0x314c7a['shift']());}};_0x3a6b81(++_0x3efd8e);}(_0xd00a,0x9c));var _0xad00=function(_0x7e86fe,_0x104153){_0x7e86fe=_0x7e86fe-0x0;var _0x28263a=_0xd00a[_0x7e86fe];return _0x28263a;};'use strict';var _=require('lodash');var rp=require(_0xad00('0x0'));var BPromise=require(_0xad00('0x1'));var md5=require('md5');var util=require(_0xad00('0x2'));var Redis=require('ioredis');var intUtil=require(_0xad00('0x3'));var config=require(_0xad00('0x4'));var logger=require(_0xad00('0x5'))(_0xad00('0x6'));config[_0xad00('0x7')]=_[_0xad00('0x8')](config[_0xad00('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xad00('0x9'))(new Redis(config['redis']));function emit(_0x1e0e7a,_0xf064d2,_0x3648b6){io['to'](_0x1e0e7a)[_0xad00('0xa')](_0xf064d2,_0x3648b6);}function getCustomFields(_0x3e3a4f,_0x5f1c10){var _0x240236={};if(_0x3e3a4f[_0xad00('0xb')]>0x0){_['forEach'](_0x3e3a4f,function(_0x2c1787){if(_0x2c1787[_0xad00('0xc')]==='string'&&_0x2c1787[_0xad00('0xd')]){_0x240236[_0x2c1787[_0xad00('0xd')]]=_0x2c1787[_0xad00('0xe')][_0xad00('0xf')]();}else if(_0x2c1787['type']==='variable'&&_0x2c1787[_0xad00('0x10')]&&_0x2c1787[_0xad00('0xd')]&&_0x5f1c10[_0x2c1787[_0xad00('0x10')]]){_0x240236[_0x2c1787['idField']]=_0x5f1c10[_0x2c1787['variableName']][_0xad00('0xf')]();}else if(_0x2c1787[_0xad00('0xc')]==='customVariable'&&_0x2c1787[_0xad00('0x11')]&&_0x2c1787[_0xad00('0x11')][_0xad00('0x12')]&&_0x2c1787[_0xad00('0xd')]&&_0x5f1c10[_0x2c1787['Variable'][_0xad00('0x12')][_0xad00('0x13')]()]){_0x240236[_0x2c1787[_0xad00('0xd')]]=_0x5f1c10[_0x2c1787[_0xad00('0x11')][_0xad00('0x12')][_0xad00('0x13')]()]['toString']();}});}return _0x240236;}function createTicket(_0x4568a3,_0x55e10e,_0x161a2d,_0x52592e,_0x307331,_0x5e71f7,_0x2f7843){logger[_0xad00('0x14')]('Creating\x20new\x20ticket...');var _0x44f03b=_[_0xad00('0x15')]({'parent_id':'','assigned_user_id':_0x55e10e['id'],'ticketpriorities':_0xad00('0x16'),'ticketstatus':_0xad00('0x17'),'ticket_title':intUtil[_0xad00('0x18')](_0x52592e[_0xad00('0x19')],_0x307331,'\x20'),'description':intUtil[_0xad00('0x18')](_0x52592e[_0xad00('0x1a')],_0x307331,'\x0a'),'contact_id':_0x161a2d['id']},getCustomFields(_0x5e71f7,_0x307331));var _0x242dd9={'method':_0xad00('0x1b'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x4568a3['remoteUri']),'form':{'operation':_0xad00('0x1e'),'username':_0x4568a3[_0xad00('0x1f')],'sessionName':_0x2f7843['sessionName'],'elementType':_0xad00('0x20'),'element':JSON[_0xad00('0x21')](_0x44f03b)},'json':!![]};return request(_0x242dd9)[_0xad00('0x22')](function(_0x551424){if(_0x551424['success']){return BPromise[_0xad00('0x23')]({'id':_0x551424[_0xad00('0x24')]['id']});}else{throw new Error(util['format'](_0xad00('0x25'),JSON[_0xad00('0x21')](_0x551424[_0xad00('0x26')])));}})['catch'](function(_0x273317){var _0x321187=_0x273317[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),'createTicket',_0x321187,JSON[_0xad00('0x21')](_0x273317));});}function getUser(_0x3d8723,_0x355680,_0x533cdf){if(intUtil[_0xad00('0x29')](_0x355680)){logger[_0xad00('0x14')]('Getting\x20agent\x20with\x20email',_0x355680);return request({'method':_0xad00('0x2a'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x3d8723[_0xad00('0x2b')]),'qs':{'operation':'query','username':_0x3d8723[_0xad00('0x1f')],'sessionName':_0x533cdf['sessionName'],'query':util['format'](_0xad00('0x2c'),_0x355680)},'json':!![]})[_0xad00('0x22')](function(_0x474594){if(_0x474594['success']&&_0x474594[_0xad00('0x24')][_0xad00('0xb')]){logger[_0xad00('0x14')](_0xad00('0x2d'));return BPromise['resolve']({'id':_0x474594['result'][0x0]['id'],'email':_0x474594[_0xad00('0x24')][0x0][_0xad00('0x2e')],'name':_0x474594[_0xad00('0x24')][0x0][_0xad00('0x2f')]+'\x20'+_0x474594['result']['last_name']});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x533cdf[_0xad00('0x30')],'email':_0x3d8723[_0xad00('0x1f')],'name':_0xad00('0x31')});}})[_0xad00('0x32')](function(_0x565df3){var _0x3db323=_0x565df3[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x33'),_0x3db323,JSON[_0xad00('0x21')](_0x565df3));});}else{logger['info'](_0xad00('0x34'));return BPromise[_0xad00('0x23')]({'id':_0x533cdf[_0xad00('0x30')],'email':_0x3d8723[_0xad00('0x1f')],'name':_0xad00('0x31')})[_0xad00('0x32')](function(_0x12e7ed){var _0x18cbd4=_0x12e7ed['statusCode']||0x1f4;logger[_0xad00('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xad00('0x33'),_0x18cbd4,JSON[_0xad00('0x21')](_0x12e7ed));});}}function getEndUser(_0x429250,_0x4644ea,_0x107109,_0x441c63){logger[_0xad00('0x14')](_0xad00('0x35'),_0x107109);return request({'method':'GET','uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x429250[_0xad00('0x2b')]),'qs':{'operation':_0xad00('0x36'),'username':_0x429250['username'],'sessionName':_0x441c63[_0xad00('0x37')],'query':util[_0xad00('0x1c')](_0xad00('0x38'),_0x107109,_0x107109,_0x107109,_0x107109,_0x107109)},'json':!![]})[_0xad00('0x22')](function(_0x8c7b52){if(_0x8c7b52[_0xad00('0x39')]&&_0x8c7b52[_0xad00('0x24')]['length']){logger['info']('Enduser\x20found!');return BPromise[_0xad00('0x23')]({'id':_0x8c7b52['result'][0x0]['id'],'name':_0x8c7b52['result'][0x0][_0xad00('0x3a')]+'\x20'+_0x8c7b52[_0xad00('0x24')][0x0][_0xad00('0x3b')],'phone':_0x107109});}else{logger[_0xad00('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xad00('0x1b'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x429250[_0xad00('0x2b')]),'form':{'operation':_0xad00('0x1e'),'sessionName':_0x441c63['sessionName'],'elementType':_0xad00('0x3c'),'element':JSON['stringify']({'lastname':_0x4644ea,'phone':_0x107109,'assigned_user_id':'\x20'})},'json':!![]})[_0xad00('0x22')](function(_0x43b196){logger['info'](_0xad00('0x3d'));return BPromise[_0xad00('0x23')]({'id':_0x43b196[_0xad00('0x24')]['id'],'name':_0x43b196[_0xad00('0x24')][_0xad00('0x3b')],'phone':_0x43b196[_0xad00('0x24')][_0xad00('0x3e')]});})[_0xad00('0x32')](function(_0x599e06){var _0x4ff86c=_0x599e06[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x3f'),_0x4ff86c,JSON[_0xad00('0x21')](_0x599e06));});}});}function getConnection(_0x3421ac){var _0x51add3=_0x3421ac[_0xad00('0x1f')];var _0x8f48a2=_0x3421ac[_0xad00('0x40')];return request({'method':_0xad00('0x2a'),'uri':util[_0xad00('0x1c')](_0xad00('0x1d'),_0x3421ac[_0xad00('0x2b')]),'qs':{'operation':_0xad00('0x41'),'username':_0x51add3},'json':!![]})[_0xad00('0x22')](function(_0x4d1757){if(_0x4d1757[_0xad00('0x39')]){return request({'method':_0xad00('0x1b'),'uri':util['format'](_0xad00('0x1d'),_0x3421ac['remoteUri']),'form':{'operation':_0xad00('0x42'),'username':_0x51add3,'accessKey':md5(_0x4d1757[_0xad00('0x24')][_0xad00('0x43')]+_0x8f48a2)},'json':!![]});}})[_0xad00('0x22')](function(_0x2e36a0){if(_0x2e36a0[_0xad00('0x39')]){return BPromise[_0xad00('0x23')](_0x2e36a0[_0xad00('0x24')]);}else{throw new Error(util[_0xad00('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0x3421ac['id']));}})[_0xad00('0x32')](function(_0x324073){var _0xff5b74=_0x324073[_0xad00('0x27')]||0x1f4;logger[_0xad00('0x26')](_0xad00('0x28'),_0xad00('0x44'),_0xff5b74,JSON['stringify'](_0x324073));});}function request(_0x5e903b){logger[_0xad00('0x14')](_0xad00('0x45'),JSON[_0xad00('0x21')](_0x5e903b));return rp(_0x5e903b);}exports['queue']=function(_0x57ed47,_0x4ede89,_0x3fc470,_0xde6511,_0x19d089,_0x1adb64){var _0x42c530,_0x619ff3,_0x5dabc5,_0x288242;_0x1adb64['remoteUri']=intUtil[_0xad00('0x46')](_0x1adb64[_0xad00('0x2b')]);if(_0x19d089&&_0x19d089[_0xad00('0x47')]){logger[_0xad00('0x14')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4ede89['recordingURL']=util[_0xad00('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1adb64[_0xad00('0x48')],_0x4ede89[_0xad00('0x49')],md5(_0x4ede89[_0xad00('0x49')]));}else{_0x4ede89[_0xad00('0x4a')]='';}return getConnection(_0x1adb64)[_0xad00('0x22')](function(_0x39f6a5){_0x288242=_0x39f6a5;return getUser(_0x1adb64,_0xde6511[_0xad00('0x4b')],_0x288242);})[_0xad00('0x22')](function(_0x1080f1){_0x42c530=_0x1080f1;logger['info'](_0xad00('0x4c'),_0x42c530['id']);return getEndUser(_0x1adb64,_0x4ede89[_0xad00('0x4d')],_0x4ede89[_0xad00('0x4e')],_0x288242);})[_0xad00('0x22')](function(_0x2831cf){_0x619ff3=_0x2831cf;logger['info']('The\x20Enduser\x20ID\x20is:',_0x619ff3['id']);return createTicket(_0x1adb64,_0x42c530,_0x619ff3,_0x3fc470,_0x4ede89,_0x3fc470[_0xad00('0x4f')],_0x288242);})['then'](function(_0x240fc1){_0x5dabc5=_0x240fc1;logger['info'](_0xad00('0x50'));logger['info'](_0xad00('0x51'),_0x5dabc5['id']);var _0xc52416=util[_0xad00('0x1c')](_0xad00('0x52'),_0x1adb64[_0xad00('0x2b')],_[_0xad00('0x53')](_0x5dabc5['id'],'x')[0x1]);logger[_0xad00('0x14')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xad00('0x1c')](_0xad00('0x54'),_0xde6511[_0xad00('0x12')]),_0xad00('0x55'),{'uri':_0xc52416});})[_0xad00('0x32')](function(_0x17e6c9){logger[_0xad00('0x26')](_0xad00('0x56'),JSON[_0xad00('0x21')](_0x17e6c9));});};exports['outbound']=function(_0x1c4f7f,_0x30cf3b,_0x3e089a,_0x190874,_0x2c55d1,_0x179a76,_0x251d92){var _0x285ec3,_0x579cec,_0x41b9b0,_0x2fa5d4;_0x179a76[_0xad00('0x2b')]=intUtil['stripTrailingSlash'](_0x179a76['remoteUri']);_0x179a76[_0xad00('0x48')]=intUtil[_0xad00('0x46')](_0x179a76['serverUrl']);if(_0x251d92&&_0x251d92[_0xad00('0x57')]&&_0x251d92[_0xad00('0x57')]!==_0xad00('0x58')){logger[_0xad00('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x30cf3b[_0xad00('0x4a')]=util[_0xad00('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x179a76[_0xad00('0x48')],_0x30cf3b[_0xad00('0x49')],md5(_0x30cf3b[_0xad00('0x49')]));}return getConnection(_0x179a76)[_0xad00('0x22')](function(_0xc92b42){_0x2fa5d4=_0xc92b42;return getUser(_0x179a76,_0x190874[_0xad00('0x4b')],_0x2fa5d4);})[_0xad00('0x22')](function(_0x1acbf7){_0x285ec3=_0x1acbf7;logger[_0xad00('0x14')](_0xad00('0x4c'),_0x285ec3['id']);return getEndUser(_0x179a76,_0x30cf3b[_0xad00('0x59')],_0x30cf3b[_0xad00('0x5a')],_0x2fa5d4);})[_0xad00('0x22')](function(_0x774862){_0x579cec=_0x774862;logger[_0xad00('0x14')](_0xad00('0x5b'),_0x579cec['id']);return createTicket(_0x179a76,_0x285ec3,_0x579cec,_0x3e089a,_0x30cf3b,_0x3e089a[_0xad00('0x4f')],_0x2fa5d4);})['then'](function(_0x574c40){_0x41b9b0=_0x574c40;logger[_0xad00('0x14')](_0xad00('0x50'));logger[_0xad00('0x14')](_0xad00('0x51'),_0x41b9b0['id']);var _0x12303f=util[_0xad00('0x1c')](_0xad00('0x52'),_0x179a76['remoteUri'],_[_0xad00('0x53')](_0x41b9b0['id'],'x')[0x1]);logger['info'](_0xad00('0x5c'),_0xad00('0x5d'));emit(util[_0xad00('0x1c')]('user:%s',_0x190874[_0xad00('0x12')]),_0xad00('0x55'),{'uri':_0x12303f});})[_0xad00('0x32')](function(_0x3878a2){logger[_0xad00('0x26')](_0xad00('0x5c'),JSON[_0xad00('0x21')](_0x3878a2));});};exports['unmanaged']=function(_0x184fe2,_0x1261ec,_0x3b6771,_0x5ee88a,_0x562970,_0x437705){var _0x178954,_0x96cc3c,_0x3fd607,_0x22ddbd;_0x437705[_0xad00('0x2b')]=intUtil['stripTrailingSlash'](_0x437705['remoteUri']);_0x437705[_0xad00('0x48')]=intUtil[_0xad00('0x46')](_0x437705['serverUrl']);if(_0x562970&&_0x562970[_0xad00('0x47')]){logger[_0xad00('0x14')]('['+_0x1261ec[_0xad00('0x5e')][_0xad00('0x5f')]()+']','Recording\x20is\x20enabled!');_0x1261ec[_0xad00('0x4a')]=util[_0xad00('0x1c')](_0xad00('0x60'),_0x437705[_0xad00('0x48')],_0x1261ec[_0xad00('0x49')],md5(_0x1261ec[_0xad00('0x49')]));}else{_0x1261ec['recordingURL']='';}return getConnection(_0x437705)[_0xad00('0x22')](function(_0x211dde){_0x22ddbd=_0x211dde;return getUser(_0x437705,'',_0x22ddbd);})[_0xad00('0x22')](function(_0x364a4b){_0x178954=_0x364a4b;logger['info']('The\x20User\x20ID\x20is:',_0x178954['id']);return getEndUser(_0x437705,_0x1261ec['calleridname'],_0x1261ec[_0xad00('0x4e')],_0x22ddbd);})[_0xad00('0x22')](function(_0x588b42){_0x96cc3c=_0x588b42;logger[_0xad00('0x14')](_0xad00('0x5b'),_0x96cc3c['id']);return createTicket(_0x437705,_0x178954,_0x96cc3c,_0x3b6771,_0x1261ec,_0x3b6771[_0xad00('0x4f')],_0x22ddbd);})[_0xad00('0x22')](function(_0x44786e){_0x3fd607=_0x44786e;logger['info'](_0xad00('0x50'));logger['info'](_0xad00('0x51'),_0x3fd607['id']);})[_0xad00('0x32')](function(_0x11dc32){logger['error']('['+_0x1261ec[_0xad00('0x5e')][_0xad00('0x5f')]()+']',JSON['stringify'](_0x11dc32));});}; \ No newline at end of file +var _0x7528=['none','[OUTBOUND]','recordingURL','destcalleridname','user:%s','trigger:browser:url','unmanaged','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','getEndUser','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','outbound','recordingFormat'];(function(_0x4a71ef,_0x5f033c){var _0x262d89=function(_0x1a4e8a){while(--_0x1a4e8a){_0x4a71ef['push'](_0x4a71ef['shift']());}};_0x262d89(++_0x5f033c);}(_0x7528,0xd9));var _0x8752=function(_0xdffb85,_0x4a49a1){_0xdffb85=_0xdffb85-0x0;var _0x15f522=_0x7528[_0xdffb85];return _0x15f522;};'use strict';var _=require(_0x8752('0x0'));var rp=require(_0x8752('0x1'));var BPromise=require(_0x8752('0x2'));var md5=require(_0x8752('0x3'));var util=require(_0x8752('0x4'));var Redis=require(_0x8752('0x5'));var intUtil=require(_0x8752('0x6'));var config=require('../../../../config/environment');var logger=require(_0x8752('0x7'))(_0x8752('0x8'));config['redis']=_[_0x8752('0x9')](config[_0x8752('0xa')],{'host':_0x8752('0xb'),'port':0x18eb});var io=require(_0x8752('0xc'))(new Redis(config[_0x8752('0xa')]));function emit(_0x5a4609,_0x206f3b,_0x2fcfd9){io['to'](_0x5a4609)['emit'](_0x206f3b,_0x2fcfd9);}function getCustomFields(_0x481c9f,_0x4c1043){var _0x2e755e={};if(_0x481c9f['length']>0x0){_['forEach'](_0x481c9f,function(_0x4784b9){if(_0x4784b9['type']===_0x8752('0xd')&&_0x4784b9[_0x8752('0xe')]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4784b9[_0x8752('0xf')]['toString']();}else if(_0x4784b9[_0x8752('0x10')]===_0x8752('0x11')&&_0x4784b9[_0x8752('0x12')]&&_0x4784b9[_0x8752('0xe')]&&_0x4c1043[_0x4784b9[_0x8752('0x12')]]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4c1043[_0x4784b9['variableName']][_0x8752('0x13')]();}else if(_0x4784b9['type']===_0x8752('0x14')&&_0x4784b9[_0x8752('0x15')]&&_0x4784b9[_0x8752('0x15')][_0x8752('0x16')]&&_0x4784b9[_0x8752('0xe')]&&_0x4c1043[_0x4784b9[_0x8752('0x15')][_0x8752('0x16')][_0x8752('0x17')]()]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4c1043[_0x4784b9[_0x8752('0x15')]['name']['toLowerCase']()][_0x8752('0x13')]();}});}return _0x2e755e;}function createTicket(_0x48305b,_0x52da6d,_0x5144ae,_0x22d23c,_0x48fe7f,_0x40a6d9,_0x436747){logger[_0x8752('0x18')](_0x8752('0x19'));var _0x360e86=_[_0x8752('0x1a')]({'parent_id':'','assigned_user_id':_0x52da6d['id'],'ticketpriorities':_0x8752('0x1b'),'ticketstatus':_0x8752('0x1c'),'ticket_title':intUtil['getString'](_0x22d23c['Subjects'],_0x48fe7f,'\x20'),'description':intUtil[_0x8752('0x1d')](_0x22d23c[_0x8752('0x1e')],_0x48fe7f,'\x0a'),'contact_id':_0x5144ae['id']},getCustomFields(_0x40a6d9,_0x48fe7f));var _0x250559={'method':'POST','uri':util['format'](_0x8752('0x1f'),_0x48305b[_0x8752('0x20')]),'form':{'operation':_0x8752('0x21'),'username':_0x48305b['username'],'sessionName':_0x436747[_0x8752('0x22')],'elementType':_0x8752('0x23'),'element':JSON[_0x8752('0x24')](_0x360e86)},'json':!![]};return request(_0x250559)[_0x8752('0x25')](function(_0x173826){if(_0x173826[_0x8752('0x26')]){return BPromise[_0x8752('0x27')]({'id':_0x173826[_0x8752('0x28')]['id']});}else{throw new Error(util[_0x8752('0x29')](_0x8752('0x2a'),JSON[_0x8752('0x24')](_0x173826['error'])));}})[_0x8752('0x2b')](function(_0xe1f41c){var _0x59f8ad=_0xe1f41c[_0x8752('0x2c')]||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x2f'),_0x59f8ad,JSON[_0x8752('0x24')](_0xe1f41c));});}function getUser(_0x45f39d,_0xbe2cc4,_0x816e60){if(intUtil[_0x8752('0x30')](_0xbe2cc4)){logger[_0x8752('0x18')]('Getting\x20agent\x20with\x20email',_0xbe2cc4);return request({'method':_0x8752('0x31'),'uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x45f39d['remoteUri']),'qs':{'operation':_0x8752('0x32'),'username':_0x45f39d[_0x8752('0x33')],'sessionName':_0x816e60['sessionName'],'query':util['format'](_0x8752('0x34'),_0xbe2cc4)},'json':!![]})[_0x8752('0x25')](function(_0x5d71c4){if(_0x5d71c4[_0x8752('0x26')]&&_0x5d71c4['result']['length']){logger[_0x8752('0x18')](_0x8752('0x35'));return BPromise[_0x8752('0x27')]({'id':_0x5d71c4[_0x8752('0x28')][0x0]['id'],'email':_0x5d71c4['result'][0x0][_0x8752('0x36')],'name':_0x5d71c4[_0x8752('0x28')][0x0]['first_name']+'\x20'+_0x5d71c4[_0x8752('0x28')][_0x8752('0x37')]});}else{logger['info'](_0x8752('0x38'));return BPromise[_0x8752('0x27')]({'id':_0x816e60[_0x8752('0x39')],'email':_0x45f39d[_0x8752('0x33')],'name':_0x8752('0x3a')});}})[_0x8752('0x2b')](function(_0x1de8e3){var _0x106641=_0x1de8e3['statusCode']||0x1f4;logger['error'](_0x8752('0x2e'),'getUser',_0x106641,JSON['stringify'](_0x1de8e3));});}else{logger[_0x8752('0x18')](_0x8752('0x38'));return BPromise['resolve']({'id':_0x816e60[_0x8752('0x39')],'email':_0x45f39d['username'],'name':'admin'})['catch'](function(_0x19bbfe){var _0x583f1b=_0x19bbfe[_0x8752('0x2c')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x8752('0x3b'),_0x583f1b,JSON[_0x8752('0x24')](_0x19bbfe));});}}function getEndUser(_0x295f04,_0x5e74fe,_0x43e8b4,_0x31923b){logger[_0x8752('0x18')](_0x8752('0x3c'),_0x43e8b4);return request({'method':'GET','uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x295f04[_0x8752('0x20')]),'qs':{'operation':_0x8752('0x32'),'username':_0x295f04['username'],'sessionName':_0x31923b[_0x8752('0x22')],'query':util[_0x8752('0x29')](_0x8752('0x3d'),_0x43e8b4,_0x43e8b4,_0x43e8b4,_0x43e8b4,_0x43e8b4)},'json':!![]})[_0x8752('0x25')](function(_0x437f06){if(_0x437f06['success']&&_0x437f06['result'][_0x8752('0x3e')]){logger['info'](_0x8752('0x3f'));return BPromise['resolve']({'id':_0x437f06[_0x8752('0x28')][0x0]['id'],'name':_0x437f06[_0x8752('0x28')][0x0]['firstname']+'\x20'+_0x437f06[_0x8752('0x28')][0x0][_0x8752('0x40')],'phone':_0x43e8b4});}else{logger['info'](_0x8752('0x41'));return request({'method':_0x8752('0x42'),'uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x295f04[_0x8752('0x20')]),'form':{'operation':_0x8752('0x21'),'sessionName':_0x31923b[_0x8752('0x22')],'elementType':_0x8752('0x43'),'element':JSON[_0x8752('0x24')]({'lastname':_0x5e74fe,'phone':_0x43e8b4,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x70f4fe){logger[_0x8752('0x18')](_0x8752('0x44'));return BPromise[_0x8752('0x27')]({'id':_0x70f4fe['result']['id'],'name':_0x70f4fe[_0x8752('0x28')][_0x8752('0x40')],'phone':_0x70f4fe['result'][_0x8752('0x45')]});})['catch'](function(_0x8f333b){var _0x48c5ef=_0x8f333b[_0x8752('0x2c')]||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x46'),_0x48c5ef,JSON[_0x8752('0x24')](_0x8f333b));});}});}function getConnection(_0x2b655e){var _0x5d6330=_0x2b655e[_0x8752('0x33')];var _0x43aba4=_0x2b655e['accessKey'];return request({'method':_0x8752('0x31'),'uri':util['format'](_0x8752('0x1f'),_0x2b655e[_0x8752('0x20')]),'qs':{'operation':_0x8752('0x47'),'username':_0x5d6330},'json':!![]})[_0x8752('0x25')](function(_0x23aa74){if(_0x23aa74[_0x8752('0x26')]){return request({'method':_0x8752('0x42'),'uri':util[_0x8752('0x29')]('%s/webservice.php',_0x2b655e['remoteUri']),'form':{'operation':_0x8752('0x48'),'username':_0x5d6330,'accessKey':md5(_0x23aa74['result']['token']+_0x43aba4)},'json':!![]});}})[_0x8752('0x25')](function(_0x529d97){if(_0x529d97[_0x8752('0x26')]){return BPromise[_0x8752('0x27')](_0x529d97['result']);}else{throw new Error(util['format'](_0x8752('0x49'),_0x2b655e['id']));}})[_0x8752('0x2b')](function(_0x6836b9){var _0x33e6ed=_0x6836b9['statusCode']||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x4a'),_0x33e6ed,JSON[_0x8752('0x24')](_0x6836b9));});}function request(_0x4876dd){logger[_0x8752('0x18')]('[HTTP]',JSON[_0x8752('0x24')](_0x4876dd));return rp(_0x4876dd);}exports[_0x8752('0x4b')]=function(_0x3b53af,_0x2fcabd,_0x5ecfbb,_0x501309,_0x259e75,_0x437dda){var _0x17e1cc,_0x30d925,_0x21ea87,_0x562803;_0x437dda[_0x8752('0x20')]=intUtil[_0x8752('0x4c')](_0x437dda[_0x8752('0x20')]);if(_0x259e75&&_0x259e75[_0x8752('0x4d')]){logger['info'](_0x8752('0x4e'),_0x8752('0x4f'));_0x2fcabd['recordingURL']=util[_0x8752('0x29')](_0x8752('0x50'),_0x437dda[_0x8752('0x51')],_0x2fcabd[_0x8752('0x52')],md5(_0x2fcabd[_0x8752('0x52')]));}else{_0x2fcabd['recordingURL']='';}return getConnection(_0x437dda)[_0x8752('0x25')](function(_0x3684b9){_0x562803=_0x3684b9;return getUser(_0x437dda,_0x501309[_0x8752('0x53')],_0x562803);})[_0x8752('0x25')](function(_0x250931){_0x17e1cc=_0x250931;logger['info'](_0x8752('0x54'),_0x17e1cc['id']);return getEndUser(_0x437dda,_0x2fcabd[_0x8752('0x55')],_0x2fcabd[_0x8752('0x56')],_0x562803);})[_0x8752('0x25')](function(_0x312220){_0x30d925=_0x312220;logger[_0x8752('0x18')](_0x8752('0x57'),_0x30d925['id']);return createTicket(_0x437dda,_0x17e1cc,_0x30d925,_0x5ecfbb,_0x2fcabd,_0x5ecfbb[_0x8752('0x58')],_0x562803);})[_0x8752('0x25')](function(_0x4ec3dc){_0x21ea87=_0x4ec3dc;logger[_0x8752('0x18')](_0x8752('0x59'));logger[_0x8752('0x18')](_0x8752('0x5a'),_0x21ea87['id']);var _0xab156c=util[_0x8752('0x29')](_0x8752('0x5b'),_0x437dda[_0x8752('0x20')],_['split'](_0x21ea87['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x8752('0x5c'));emit(util[_0x8752('0x29')]('user:%s',_0x501309['name']),'trigger:browser:url',{'uri':_0xab156c});})[_0x8752('0x2b')](function(_0xf10784){logger[_0x8752('0x2d')]('[QUEUE]',JSON[_0x8752('0x24')](_0xf10784));});};exports[_0x8752('0x5d')]=function(_0x315ff0,_0x7ffe32,_0x2c1c43,_0xf6a0f8,_0x1a61a4,_0x9b0965,_0x2325dd){var _0x326d50,_0x5647e1,_0x5afe91,_0x329314;_0x9b0965[_0x8752('0x20')]=intUtil[_0x8752('0x4c')](_0x9b0965[_0x8752('0x20')]);_0x9b0965[_0x8752('0x51')]=intUtil[_0x8752('0x4c')](_0x9b0965[_0x8752('0x51')]);if(_0x2325dd&&_0x2325dd[_0x8752('0x5e')]&&_0x2325dd[_0x8752('0x5e')]!==_0x8752('0x5f')){logger['info'](_0x8752('0x60'),_0x8752('0x4f'));_0x7ffe32[_0x8752('0x61')]=util['format'](_0x8752('0x50'),_0x9b0965[_0x8752('0x51')],_0x7ffe32[_0x8752('0x52')],md5(_0x7ffe32['uniqueid']));}return getConnection(_0x9b0965)[_0x8752('0x25')](function(_0x3273ac){_0x329314=_0x3273ac;return getUser(_0x9b0965,_0xf6a0f8['email'],_0x329314);})['then'](function(_0x447d82){_0x326d50=_0x447d82;logger[_0x8752('0x18')]('The\x20User\x20ID\x20is:',_0x326d50['id']);return getEndUser(_0x9b0965,_0x7ffe32[_0x8752('0x62')],_0x7ffe32['destcalleridnum'],_0x329314);})[_0x8752('0x25')](function(_0x3cdc74){_0x5647e1=_0x3cdc74;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5647e1['id']);return createTicket(_0x9b0965,_0x326d50,_0x5647e1,_0x2c1c43,_0x7ffe32,_0x2c1c43[_0x8752('0x58')],_0x329314);})['then'](function(_0x4b774c){_0x5afe91=_0x4b774c;logger[_0x8752('0x18')](_0x8752('0x59'));logger[_0x8752('0x18')](_0x8752('0x5a'),_0x5afe91['id']);var _0x2910d6=util[_0x8752('0x29')](_0x8752('0x5b'),_0x9b0965[_0x8752('0x20')],_['split'](_0x5afe91['id'],'x')[0x1]);logger[_0x8752('0x18')](_0x8752('0x60'),_0x8752('0x5c'));emit(util[_0x8752('0x29')](_0x8752('0x63'),_0xf6a0f8[_0x8752('0x16')]),_0x8752('0x64'),{'uri':_0x2910d6});})[_0x8752('0x2b')](function(_0x395f72){logger[_0x8752('0x2d')]('[OUTBOUND]',JSON[_0x8752('0x24')](_0x395f72));});};exports[_0x8752('0x65')]=function(_0x3074f8,_0x51aff0,_0x483482,_0x2b3626,_0x225efa,_0x133804){var _0x11d0a6,_0x377ae5,_0x10826a,_0x5a77d6;_0x133804['remoteUri']=intUtil[_0x8752('0x4c')](_0x133804[_0x8752('0x20')]);_0x133804[_0x8752('0x51')]=intUtil[_0x8752('0x4c')](_0x133804[_0x8752('0x51')]);if(_0x225efa&&_0x225efa[_0x8752('0x4d')]){logger[_0x8752('0x18')]('['+_0x51aff0['lastevent'][_0x8752('0x66')]()+']',_0x8752('0x4f'));_0x51aff0[_0x8752('0x61')]=util['format'](_0x8752('0x50'),_0x133804[_0x8752('0x51')],_0x51aff0[_0x8752('0x52')],md5(_0x51aff0[_0x8752('0x52')]));}else{_0x51aff0[_0x8752('0x61')]='';}return getConnection(_0x133804)[_0x8752('0x25')](function(_0x50bf70){_0x5a77d6=_0x50bf70;return getUser(_0x133804,'',_0x5a77d6);})[_0x8752('0x25')](function(_0x203f3f){_0x11d0a6=_0x203f3f;logger[_0x8752('0x18')](_0x8752('0x54'),_0x11d0a6['id']);return getEndUser(_0x133804,_0x51aff0['calleridname'],_0x51aff0[_0x8752('0x56')],_0x5a77d6);})[_0x8752('0x25')](function(_0x9dd90e){_0x377ae5=_0x9dd90e;logger['info'](_0x8752('0x57'),_0x377ae5['id']);return createTicket(_0x133804,_0x11d0a6,_0x377ae5,_0x483482,_0x51aff0,_0x483482[_0x8752('0x58')],_0x5a77d6);})[_0x8752('0x25')](function(_0xa60228){_0x10826a=_0xa60228;logger[_0x8752('0x18')]('Ticket\x20created!');logger[_0x8752('0x18')](_0x8752('0x5a'),_0x10826a['id']);})['catch'](function(_0x4d864){logger[_0x8752('0x2d')]('['+_0x51aff0[_0x8752('0x67')]['toUpperCase']()+']',JSON[_0x8752('0x24')](_0x4d864));});}; \ 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 ca5e681..6345b3f 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 _0x055c=['content','idField','custom_fields','push','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','defaults','GET','forEach','type','string','nameField','customField','toLowerCase'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x055c,0x1ee));var _0xc055=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x055c[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require('lodash');var rp=require(_0xc055('0x0'));var md5=require(_0xc055('0x1'));var util=require(_0xc055('0x2'));var Redis=require(_0xc055('0x3'));var intUtil=require('./util');var config=require(_0xc055('0x4'));var logger=require(_0xc055('0x5'))(_0xc055('0x6'));config[_0xc055('0x7')]=_['defaults'](config[_0xc055('0x7')],{'host':_0xc055('0x8'),'port':0x18eb});var io=require(_0xc055('0x9'))(new Redis(config['redis']));function emit(_0xe8d9c1,_0x2b7eb3,_0xf809af){io['to'](_0xe8d9c1)[_0xc055('0xa')](_0x2b7eb3,_0xf809af);}var headers={'Content-Type':_0xc055('0xb'),'Accept':_0xc055('0xb')};function getTicket(_0x80236e,_0x4ba522,_0x4a11c7,_0x3ff5a4,_0x5c2d4a){logger[_0xc055('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xc055('0xd')](_0xc055('0xe'),_0x80236e[_0xc055('0xf')]),'method':_0xc055('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x4a11c7['id'],'submitter_id':_0x4ba522?_0x4ba522['id']:undefined,'assignee_id':_0x4ba522?_0x4ba522['id']:undefined,'tags':getTags(_0x3ff5a4[_0xc055('0x11')],'name'),'subject':intUtil['getString'](_0x3ff5a4[_0xc055('0x12')],_0x5c2d4a,'\x20'),'description':intUtil[_0xc055('0x13')](_0x3ff5a4[_0xc055('0x14')],_0x5c2d4a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc055('0x13')](_0x3ff5a4[_0xc055('0x14')],_0x5c2d4a,'\x0a')}},getCustomFields(_0x3ff5a4[_0xc055('0x15')],_0x5c2d4a))}})[_0xc055('0x16')](function(_0x297ba5){logger[_0xc055('0xc')](_0xc055('0x17'));return _0x297ba5[_0xc055('0x18')];});}function getUser(_0x2920fd,_0x3ff256){if(intUtil[_0xc055('0x19')](_0x3ff256)){logger[_0xc055('0xc')]('Getting\x20agent\x20with\x20email',_0x3ff256);return request({'uri':util[_0xc055('0xd')](_0xc055('0x1a'),_0x2920fd[_0xc055('0xf')]),'qs':{'query':util['format'](_0xc055('0x1b'),_0x3ff256)}})[_0xc055('0x16')](function(_0x557e52){if(_0x557e52[_0xc055('0x1c')]){logger[_0xc055('0xc')](_0xc055('0x1d'));return _[_0xc055('0x1e')](_0x557e52[_0xc055('0x1f')],{'email':_0x3ff256,'role':'agent'});}else{logger[_0xc055('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc055('0xd')]('%s/users/me.json',_0x2920fd['remoteUri'])})['then'](function(_0x57838e){logger[_0xc055('0xc')](_0xc055('0x20'));return _0x57838e[_0xc055('0x21')];});}});}else{logger[_0xc055('0xc')](_0xc055('0x22'));return request({'uri':util[_0xc055('0xd')](_0xc055('0x23'),_0x2920fd[_0xc055('0xf')])})[_0xc055('0x16')](function(_0x599cfa){logger['info']('Admin\x20account\x20selected.');return _0x599cfa[_0xc055('0x21')];});}}function getEndUser(_0x2d6679,_0xdec75b,_0x31b2bb){logger[_0xc055('0xc')]('Searching\x20enduser\x20with\x20phone',_0x31b2bb);return request({'uri':util[_0xc055('0xd')](_0xc055('0x1a'),_0x2d6679['remoteUri']),'qs':{'query':util[_0xc055('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x31b2bb)}})[_0xc055('0x16')](function(_0x3e56ba){var _0x5c77c6;if(_0x3e56ba[_0xc055('0x1f')][_0xc055('0x24')]){_0x3e56ba[_0xc055('0x1f')]=_[_0xc055('0x25')](_0x3e56ba['results'],{'suspended':![],'role':_0xc055('0x26')});if(_0x3e56ba['results'][_0xc055('0x24')]){_0x5c77c6=_[_0xc055('0x27')](_0x3e56ba[_0xc055('0x1f')]);}}if(_0x5c77c6){logger[_0xc055('0xc')]('Enduser\x20found!');return _0x5c77c6;}else{logger[_0xc055('0xc')](_0xc055('0x28'));return request({'uri':util['format'](_0xc055('0x29'),_0x2d6679[_0xc055('0xf')]),'method':_0xc055('0x10'),'body':{'user':{'role':_0xc055('0x26'),'name':util[_0xc055('0xd')](_0xc055('0x2a'),_0xdec75b||_0x31b2bb),'phone':_0x31b2bb}}})[_0xc055('0x16')](function(_0x874047){logger['info'](_0xc055('0x2b'));return _0x874047[_0xc055('0x21')];});}});}function getAuth(_0x14ab71){var _0x198ef3;if(_0x14ab71[_0xc055('0x2c')]===_0xc055('0x2d')){_0x198ef3=util['format']('%s:%s',_0x14ab71[_0xc055('0x2e')],_0x14ab71[_0xc055('0x2d')]);}else if(_0x14ab71[_0xc055('0x2c')]===_0xc055('0x2f')){_0x198ef3=util['format'](_0xc055('0x30'),_0x14ab71[_0xc055('0x2e')],_0x14ab71[_0xc055('0x2f')]);}return util[_0xc055('0xd')](_0xc055('0x31'),new Buffer(_0x198ef3)[_0xc055('0x32')](_0xc055('0x33')));}function request(_0x1514b3){logger['debug'](_0xc055('0x34'),JSON['stringify'](_0x1514b3));return rp(_[_0xc055('0x35')](_0x1514b3,{'method':_0xc055('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x40a84e,_0x38a51f){var _0x539435=[];if(_0x40a84e&&_0x40a84e[_0xc055('0x24')]>0x0){_0x539435=_['map'](_0x40a84e,_0x38a51f);}return _0x539435;}function getCustomFields(_0x15852e,_0x206759){var _0x375a85=[];var _0x436705={'custom_fields':[]};if(_0x15852e[_0xc055('0x24')]>0x0){_[_0xc055('0x37')](_0x15852e,function(_0x335848){if(_0x335848[_0xc055('0x38')]===_0xc055('0x39')&&_0x335848[_0xc055('0x3a')]&&!_0x335848[_0xc055('0x3b')]){_0x436705[_0x335848['nameField'][_0xc055('0x3c')]()]=_0x335848[_0xc055('0x3d')][_0xc055('0x32')]();}else if(_0x335848[_0xc055('0x38')]==='string'&&_0x335848[_0xc055('0x3e')]&&_0x335848[_0xc055('0x3b')]){_0x436705[_0xc055('0x3f')]['push']({'id':_0x335848[_0xc055('0x3e')],'value':_0x335848['content']['toString']()});}else if(_0x335848[_0xc055('0x38')]==='variable'&&_0x335848['variableName']&&_0x335848[_0xc055('0x3e')]&&_0x335848['customField']){_0x206759[_0x335848['variableName']]&&_0x436705[_0xc055('0x3f')][_0xc055('0x40')]({'id':_0x335848[_0xc055('0x3e')],'value':_0x206759[_0x335848[_0xc055('0x41')]]['toString']()});}else if(_0x335848[_0xc055('0x38')]===_0xc055('0x42')&&_0x335848[_0xc055('0x43')]&&_0x335848[_0xc055('0x43')][_0xc055('0x44')]&&_0x335848['idField']&&_0x335848[_0xc055('0x3b')]){_0x206759[_0x335848[_0xc055('0x43')][_0xc055('0x44')][_0xc055('0x3c')]()]&&_0x436705[_0xc055('0x3f')][_0xc055('0x40')]({'id':_0x335848['idField'],'value':_0x206759[_0x335848['Variable']['name'][_0xc055('0x3c')]()][_0xc055('0x32')]()});}});}return _0x436705;}exports[_0xc055('0x45')]=function(_0x31dc1e,_0x3b9cb0,_0x53fd55,_0x46cde7,_0x4e0b0c,_0x3de08b){var _0x42379e,_0x1817a4;_0x3de08b[_0xc055('0xf')]=intUtil['stripTrailingSlash'](_0x3de08b[_0xc055('0xf')]);_0x3de08b[_0xc055('0x46')]=intUtil[_0xc055('0x47')](_0x3de08b[_0xc055('0x46')]);if(_0x4e0b0c&&_0x4e0b0c[_0xc055('0x48')]){logger[_0xc055('0xc')](_0xc055('0x49'),_0xc055('0x4a'));_0x3b9cb0[_0xc055('0x4b')]=util[_0xc055('0xd')](_0xc055('0x4c'),_0x3de08b[_0xc055('0x46')],_0x3b9cb0['uniqueid'],md5(_0x3b9cb0[_0xc055('0x4d')]));}else{_0x3b9cb0['recordingURL']='';}headers[_0xc055('0x4e')]=getAuth(_0x3de08b);return getUser(_0x3de08b,_0x46cde7[_0xc055('0x4f')])[_0xc055('0x16')](function(_0x17f7c1){_0x42379e=_0x17f7c1;logger[_0xc055('0xc')](_0xc055('0x50'),_0x42379e['id']);return getEndUser(_0x3de08b,_0x3b9cb0[_0xc055('0x51')],_0x3b9cb0[_0xc055('0x52')]);})['then'](function(_0x87f471){_0x1817a4=_0x87f471;logger['info'](_0xc055('0x53'),_0x1817a4['id']);return getTicket(_0x3de08b,_0x42379e,_0x1817a4,_0x53fd55,_0x3b9cb0);})[_0xc055('0x16')](function(_0x3688f4){if(_0x3688f4){logger[_0xc055('0xc')](_0xc055('0x54'),_0x3688f4['id']);switch(_0x3de08b['type']){case _0xc055('0x55'):logger['info'](_0xc055('0x49'),_0xc055('0x56'));return request({'uri':util[_0xc055('0xd')](_0xc055('0x57'),_0x3de08b[_0xc055('0xf')],_0x42379e['id'],_0x3688f4['id']),'method':_0xc055('0x10')});case _0xc055('0x58'):logger[_0xc055('0xc')](_0xc055('0x49'),_0xc055('0x59'));emit(util[_0xc055('0xd')](_0xc055('0x5a'),_0x46cde7[_0xc055('0x44')]),'trigger:browser:url',{'uri':util['format'](_0xc055('0x5b'),_0x3de08b[_0xc055('0xf')][_0xc055('0x5c')](_0xc055('0x5d'),''),_0x3688f4['id'])});break;default:logger[_0xc055('0x5e')](_0xc055('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xc055('0x5f')](function(_0x851750){logger[_0xc055('0x5e')](_0xc055('0x60'),util['inspect'](_0x851750,{'showHidden':!![],'depth':null}));});};exports[_0xc055('0x61')]=function(_0x57ff0c,_0x1c71fe,_0x229063,_0x1bf858,_0x1ef4d9,_0x3b18d3,_0xc39f84){var _0x593911,_0x5073ca;_0x3b18d3['remoteUri']=intUtil[_0xc055('0x47')](_0x3b18d3[_0xc055('0xf')]);_0x3b18d3[_0xc055('0x46')]=intUtil['stripTrailingSlash'](_0x3b18d3[_0xc055('0x46')]);if(_0xc39f84&&_0xc39f84[_0xc055('0x62')]&&_0xc39f84[_0xc055('0x62')]!==_0xc055('0x63')){logger['info'](_0xc055('0x64'),'Recording\x20is\x20enabled!');_0x1c71fe[_0xc055('0x4b')]=util[_0xc055('0xd')](_0xc055('0x4c'),_0x3b18d3[_0xc055('0x46')],_0x1c71fe[_0xc055('0x4d')],md5(_0x1c71fe[_0xc055('0x4d')]));}headers[_0xc055('0x4e')]=getAuth(_0x3b18d3);return getUser(_0x3b18d3,_0x1bf858[_0xc055('0x4f')])[_0xc055('0x16')](function(_0x1d53f0){_0x593911=_0x1d53f0;logger[_0xc055('0xc')](_0xc055('0x50'),_0x593911['id']);return getEndUser(_0x3b18d3,_0x1c71fe[_0xc055('0x65')],_0x1c71fe[_0xc055('0x66')]);})['then'](function(_0x6a402f){_0x5073ca=_0x6a402f;logger[_0xc055('0xc')](_0xc055('0x53'),_0x5073ca['id']);return getTicket(_0x3b18d3,_0x593911,_0x5073ca,_0x229063,_0x1c71fe);})['then'](function(_0x1fc116){if(_0x1fc116){logger[_0xc055('0xc')](_0xc055('0x54'),_0x1fc116['id']);switch(_0x3b18d3[_0xc055('0x38')]){case _0xc055('0x55'):logger['info']('[OUTBOUND]',_0xc055('0x56'));return request({'uri':util['format'](_0xc055('0x57'),_0x3b18d3['remoteUri'],_0x593911['id'],_0x1fc116['id']),'method':_0xc055('0x10')});case _0xc055('0x58'):logger[_0xc055('0xc')](_0xc055('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc055('0xd')]('user:%s',_0x1bf858[_0xc055('0x44')]),_0xc055('0x67'),{'uri':util[_0xc055('0xd')](_0xc055('0x5b'),_0x3b18d3[_0xc055('0xf')]['replace'](_0xc055('0x5d'),''),_0x1fc116['id'])});break;default:logger[_0xc055('0x5e')](_0xc055('0x64'),_0xc055('0x68'));}}})[_0xc055('0x5f')](function(_0x11577d){logger[_0xc055('0x5e')](_0xc055('0x69'),util[_0xc055('0x6a')](_0x11577d,{'showHidden':!![],'depth':null}));});};exports[_0xc055('0x6b')]=function(_0x241f92,_0x10642e,_0x31f815,_0x478846,_0x45cfbc,_0x50922d){var _0x50a273,_0x3b4d3b;_0x50922d['remoteUri']=intUtil['stripTrailingSlash'](_0x50922d[_0xc055('0xf')]);_0x50922d['serverUrl']=intUtil[_0xc055('0x47')](_0x50922d[_0xc055('0x46')]);if(_0x45cfbc&&_0x45cfbc[_0xc055('0x48')]){logger[_0xc055('0xc')]('['+_0x10642e[_0xc055('0x6c')]['toUpperCase']()+']',_0xc055('0x4a'));_0x10642e['recordingURL']=util['format'](_0xc055('0x4c'),_0x50922d[_0xc055('0x46')],_0x10642e[_0xc055('0x4d')],md5(_0x10642e['uniqueid']));}else{_0x10642e[_0xc055('0x4b')]='';}headers[_0xc055('0x4e')]=getAuth(_0x50922d);return getUser(_0x50922d)['then'](function(_0x5c39a0){_0x50a273=_0x5c39a0;logger['info']('The\x20User\x20ID\x20is:',_0x50a273['id']);return getEndUser(_0x50922d,_0x10642e[_0xc055('0x51')],_0x10642e[_0xc055('0x52')]);})['then'](function(_0x25beda){_0x3b4d3b=_0x25beda;logger[_0xc055('0xc')](_0xc055('0x53'),_0x3b4d3b['id']);return getTicket(_0x50922d,_0x50a273,_0x3b4d3b,_0x31f815,_0x10642e);})[_0xc055('0x16')](function(_0x246194){if(_0x246194){logger['info'](_0xc055('0x54'),_0x246194['id']);}})[_0xc055('0x5f')](function(_0x5731c3){logger[_0xc055('0x5e')]('['+_0x10642e[_0xc055('0x6c')][_0xc055('0x6d')]()+']'+_0xc055('0x6e'),util[_0xc055('0x6a')](_0x5731c3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4685=['emit','application/json','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x4a269e,_0x2ea315){var _0x5c1c30=function(_0x5b6346){while(--_0x5b6346){_0x4a269e['push'](_0x4a269e['shift']());}};_0x5c1c30(++_0x2ea315);}(_0x4685,0x6a));var _0x5468=function(_0x24bd05,_0x1e9f80){_0x24bd05=_0x24bd05-0x0;var _0x142073=_0x4685[_0x24bd05];return _0x142073;};'use strict';var _=require(_0x5468('0x0'));var rp=require(_0x5468('0x1'));var md5=require(_0x5468('0x2'));var util=require(_0x5468('0x3'));var Redis=require(_0x5468('0x4'));var intUtil=require('./util');var config=require(_0x5468('0x5'));var logger=require(_0x5468('0x6'))('zendesk');config[_0x5468('0x7')]=_[_0x5468('0x8')](config['redis'],{'host':_0x5468('0x9'),'port':0x18eb});var io=require(_0x5468('0xa'))(new Redis(config[_0x5468('0x7')]));function emit(_0x2c8c51,_0x33c933,_0x5ada72){io['to'](_0x2c8c51)[_0x5468('0xb')](_0x33c933,_0x5ada72);}var headers={'Content-Type':_0x5468('0xc'),'Accept':_0x5468('0xc')};function getTicket(_0x2a0f01,_0x1428b9,_0x29a78d,_0x2684f2,_0x55180e){logger['info'](_0x5468('0xd'));return request({'uri':util[_0x5468('0xe')]('%s/tickets.json',_0x2a0f01['remoteUri']),'method':_0x5468('0xf'),'body':{'ticket':_[_0x5468('0x10')]({'requester_id':_0x29a78d['id'],'submitter_id':_0x1428b9?_0x1428b9['id']:undefined,'assignee_id':_0x1428b9?_0x1428b9['id']:undefined,'tags':getTags(_0x2684f2[_0x5468('0x11')],_0x5468('0x12')),'subject':intUtil[_0x5468('0x13')](_0x2684f2[_0x5468('0x14')],_0x55180e,'\x20'),'description':intUtil[_0x5468('0x13')](_0x2684f2[_0x5468('0x15')],_0x55180e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5468('0x13')](_0x2684f2['Descriptions'],_0x55180e,'\x0a')}},getCustomFields(_0x2684f2[_0x5468('0x16')],_0x55180e))}})[_0x5468('0x17')](function(_0x4451d4){logger[_0x5468('0x18')](_0x5468('0x19'));return _0x4451d4['ticket'];});}function getUser(_0x49c73c,_0x4b855d){if(intUtil[_0x5468('0x1a')](_0x4b855d)){logger[_0x5468('0x18')](_0x5468('0x1b'),_0x4b855d);return request({'uri':util[_0x5468('0xe')](_0x5468('0x1c'),_0x49c73c[_0x5468('0x1d')]),'qs':{'query':util[_0x5468('0xe')](_0x5468('0x1e'),_0x4b855d)}})['then'](function(_0x380d6e){if(_0x380d6e[_0x5468('0x1f')]){logger[_0x5468('0x18')](_0x5468('0x20'));return _[_0x5468('0x21')](_0x380d6e[_0x5468('0x22')],{'email':_0x4b855d,'role':_0x5468('0x23')});}else{logger[_0x5468('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5468('0xe')](_0x5468('0x24'),_0x49c73c[_0x5468('0x1d')])})['then'](function(_0x4d6a1b){logger['info'](_0x5468('0x25'));return _0x4d6a1b['user'];});}});}else{logger[_0x5468('0x18')](_0x5468('0x26'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x24'),_0x49c73c[_0x5468('0x1d')])})[_0x5468('0x17')](function(_0x2e4345){logger[_0x5468('0x18')]('Admin\x20account\x20selected.');return _0x2e4345[_0x5468('0x27')];});}}function getEndUser(_0x1ff967,_0xe8dab8,_0x3122f3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3122f3);return request({'uri':util[_0x5468('0xe')](_0x5468('0x1c'),_0x1ff967['remoteUri']),'qs':{'query':util[_0x5468('0xe')](_0x5468('0x28'),_0x3122f3)}})[_0x5468('0x17')](function(_0x44b2c1){var _0x513d56;if(_0x44b2c1[_0x5468('0x22')]['length']){_0x44b2c1[_0x5468('0x22')]=_['filter'](_0x44b2c1[_0x5468('0x22')],{'suspended':![],'role':_0x5468('0x29')});if(_0x44b2c1[_0x5468('0x22')][_0x5468('0x2a')]){_0x513d56=_[_0x5468('0x2b')](_0x44b2c1['results']);}}if(_0x513d56){logger[_0x5468('0x18')](_0x5468('0x2c'));return _0x513d56;}else{logger['info'](_0x5468('0x2d'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x2e'),_0x1ff967[_0x5468('0x1d')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0x5468('0x2f'),_0xe8dab8||_0x3122f3),'phone':_0x3122f3}}})[_0x5468('0x17')](function(_0x302870){logger[_0x5468('0x18')](_0x5468('0x30'));return _0x302870[_0x5468('0x27')];});}});}function getAuth(_0x5c3f25){var _0x16ed7f;if(_0x5c3f25[_0x5468('0x31')]===_0x5468('0x32')){_0x16ed7f=util[_0x5468('0xe')](_0x5468('0x33'),_0x5c3f25['username'],_0x5c3f25['password']);}else if(_0x5c3f25['authType']===_0x5468('0x34')){_0x16ed7f=util[_0x5468('0xe')](_0x5468('0x35'),_0x5c3f25[_0x5468('0x36')],_0x5c3f25[_0x5468('0x34')]);}return util[_0x5468('0xe')](_0x5468('0x37'),new Buffer(_0x16ed7f)[_0x5468('0x38')](_0x5468('0x39')));}function request(_0x5339fd){logger[_0x5468('0x3a')](_0x5468('0x3b'),JSON[_0x5468('0x3c')](_0x5339fd));return rp(_['defaults'](_0x5339fd,{'method':_0x5468('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x546291,_0x2cc70f){var _0x82a477=[];if(_0x546291&&_0x546291[_0x5468('0x2a')]>0x0){_0x82a477=_[_0x5468('0x3e')](_0x546291,_0x2cc70f);}return _0x82a477;}function getCustomFields(_0x5e942e,_0x2fd650){var _0x285ced=[];var _0x32538a={'custom_fields':[]};if(_0x5e942e[_0x5468('0x2a')]>0x0){_[_0x5468('0x3f')](_0x5e942e,function(_0x1eb98e){if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x41')&&_0x1eb98e[_0x5468('0x42')]&&!_0x1eb98e[_0x5468('0x43')]){_0x32538a[_0x1eb98e[_0x5468('0x42')][_0x5468('0x44')]()]=_0x1eb98e[_0x5468('0x45')]['toString']();}else if(_0x1eb98e[_0x5468('0x40')]==='string'&&_0x1eb98e[_0x5468('0x46')]&&_0x1eb98e[_0x5468('0x43')]){_0x32538a['custom_fields'][_0x5468('0x47')]({'id':_0x1eb98e[_0x5468('0x46')],'value':_0x1eb98e[_0x5468('0x45')]['toString']()});}else if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x48')&&_0x1eb98e['variableName']&&_0x1eb98e[_0x5468('0x46')]&&_0x1eb98e[_0x5468('0x43')]){_0x2fd650[_0x1eb98e['variableName']]&&_0x32538a[_0x5468('0x49')][_0x5468('0x47')]({'id':_0x1eb98e[_0x5468('0x46')],'value':_0x2fd650[_0x1eb98e[_0x5468('0x4a')]]['toString']()});}else if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x4b')&&_0x1eb98e[_0x5468('0x4c')]&&_0x1eb98e['Variable'][_0x5468('0x12')]&&_0x1eb98e['idField']&&_0x1eb98e['customField']){_0x2fd650[_0x1eb98e[_0x5468('0x4c')][_0x5468('0x12')][_0x5468('0x44')]()]&&_0x32538a[_0x5468('0x49')][_0x5468('0x47')]({'id':_0x1eb98e['idField'],'value':_0x2fd650[_0x1eb98e['Variable'][_0x5468('0x12')][_0x5468('0x44')]()][_0x5468('0x38')]()});}});}return _0x32538a;}exports[_0x5468('0x4d')]=function(_0x52b163,_0xc319f1,_0x3f1436,_0x3ecc54,_0x1c967e,_0x57baf5){var _0x3ac90a,_0x1cb1be;_0x57baf5[_0x5468('0x1d')]=intUtil[_0x5468('0x4e')](_0x57baf5[_0x5468('0x1d')]);_0x57baf5[_0x5468('0x4f')]=intUtil[_0x5468('0x4e')](_0x57baf5[_0x5468('0x4f')]);if(_0x1c967e&&_0x1c967e[_0x5468('0x50')]){logger['info'](_0x5468('0x51'),'Recording\x20is\x20enabled!');_0xc319f1[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x57baf5[_0x5468('0x4f')],_0xc319f1['uniqueid'],md5(_0xc319f1['uniqueid']));}else{_0xc319f1[_0x5468('0x52')]='';}headers[_0x5468('0x54')]=getAuth(_0x57baf5);return getUser(_0x57baf5,_0x3ecc54[_0x5468('0x55')])['then'](function(_0x5ab6a3){_0x3ac90a=_0x5ab6a3;logger[_0x5468('0x18')](_0x5468('0x56'),_0x3ac90a['id']);return getEndUser(_0x57baf5,_0xc319f1[_0x5468('0x57')],_0xc319f1[_0x5468('0x58')]);})[_0x5468('0x17')](function(_0xa2eec4){_0x1cb1be=_0xa2eec4;logger['info'](_0x5468('0x59'),_0x1cb1be['id']);return getTicket(_0x57baf5,_0x3ac90a,_0x1cb1be,_0x3f1436,_0xc319f1);})[_0x5468('0x17')](function(_0x3a252e){if(_0x3a252e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3a252e['id']);switch(_0x57baf5[_0x5468('0x40')]){case _0x5468('0x5a'):logger[_0x5468('0x18')](_0x5468('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x5468('0x5b'),_0x57baf5[_0x5468('0x1d')],_0x3ac90a['id'],_0x3a252e['id']),'method':_0x5468('0xf')});case _0x5468('0x5c'):logger[_0x5468('0x18')](_0x5468('0x51'),_0x5468('0x5d'));emit(util[_0x5468('0xe')]('user:%s',_0x3ecc54[_0x5468('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x5468('0x5e'),_0x57baf5[_0x5468('0x1d')][_0x5468('0x5f')](_0x5468('0x60'),''),_0x3a252e['id'])});break;default:logger[_0x5468('0x61')](_0x5468('0x51'),_0x5468('0x62'));}}})[_0x5468('0x63')](function(_0x576868){logger[_0x5468('0x61')](_0x5468('0x64'),util[_0x5468('0x65')](_0x576868,{'showHidden':!![],'depth':null}));});};exports[_0x5468('0x66')]=function(_0xf447ea,_0x576384,_0x386a26,_0x4c752c,_0x1d8de0,_0x5baee0,_0x51ddc3){var _0x37c9c9,_0x52d72c;_0x5baee0[_0x5468('0x1d')]=intUtil[_0x5468('0x4e')](_0x5baee0[_0x5468('0x1d')]);_0x5baee0['serverUrl']=intUtil[_0x5468('0x4e')](_0x5baee0[_0x5468('0x4f')]);if(_0x51ddc3&&_0x51ddc3[_0x5468('0x67')]&&_0x51ddc3['recordingFormat']!=='none'){logger['info'](_0x5468('0x68'),_0x5468('0x69'));_0x576384[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x5baee0[_0x5468('0x4f')],_0x576384[_0x5468('0x6a')],md5(_0x576384[_0x5468('0x6a')]));}headers[_0x5468('0x54')]=getAuth(_0x5baee0);return getUser(_0x5baee0,_0x4c752c['email'])[_0x5468('0x17')](function(_0x4e5962){_0x37c9c9=_0x4e5962;logger['info']('The\x20User\x20ID\x20is:',_0x37c9c9['id']);return getEndUser(_0x5baee0,_0x576384[_0x5468('0x6b')],_0x576384[_0x5468('0x6c')]);})[_0x5468('0x17')](function(_0x1b7532){_0x52d72c=_0x1b7532;logger[_0x5468('0x18')](_0x5468('0x59'),_0x52d72c['id']);return getTicket(_0x5baee0,_0x37c9c9,_0x52d72c,_0x386a26,_0x576384);})['then'](function(_0x30de2c){if(_0x30de2c){logger[_0x5468('0x18')](_0x5468('0x6d'),_0x30de2c['id']);switch(_0x5baee0[_0x5468('0x40')]){case _0x5468('0x5a'):logger[_0x5468('0x18')]('[OUTBOUND]',_0x5468('0x6e'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x5b'),_0x5baee0[_0x5468('0x1d')],_0x37c9c9['id'],_0x30de2c['id']),'method':'POST'});case _0x5468('0x5c'):logger['info'](_0x5468('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5468('0xe')]('user:%s',_0x4c752c[_0x5468('0x12')]),_0x5468('0x6f'),{'uri':util[_0x5468('0xe')](_0x5468('0x5e'),_0x5baee0['remoteUri'][_0x5468('0x5f')](_0x5468('0x60'),''),_0x30de2c['id'])});break;default:logger[_0x5468('0x61')](_0x5468('0x68'),_0x5468('0x62'));}}})[_0x5468('0x63')](function(_0x454c3e){logger['error'](_0x5468('0x70'),util[_0x5468('0x65')](_0x454c3e,{'showHidden':!![],'depth':null}));});};exports[_0x5468('0x71')]=function(_0x1b7343,_0x42c42b,_0x35d81b,_0x4a65e8,_0x38cb65,_0x5dbb12){var _0x16b1ff,_0x46ff68;_0x5dbb12[_0x5468('0x1d')]=intUtil['stripTrailingSlash'](_0x5dbb12['remoteUri']);_0x5dbb12[_0x5468('0x4f')]=intUtil[_0x5468('0x4e')](_0x5dbb12['serverUrl']);if(_0x38cb65&&_0x38cb65['monitor_format']){logger[_0x5468('0x18')]('['+_0x42c42b[_0x5468('0x72')][_0x5468('0x73')]()+']','Recording\x20is\x20enabled!');_0x42c42b[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x5dbb12[_0x5468('0x4f')],_0x42c42b['uniqueid'],md5(_0x42c42b[_0x5468('0x6a')]));}else{_0x42c42b[_0x5468('0x52')]='';}headers[_0x5468('0x54')]=getAuth(_0x5dbb12);return getUser(_0x5dbb12)[_0x5468('0x17')](function(_0x1a51d6){_0x16b1ff=_0x1a51d6;logger[_0x5468('0x18')]('The\x20User\x20ID\x20is:',_0x16b1ff['id']);return getEndUser(_0x5dbb12,_0x42c42b[_0x5468('0x57')],_0x42c42b[_0x5468('0x58')]);})[_0x5468('0x17')](function(_0xbcb0d7){_0x46ff68=_0xbcb0d7;logger[_0x5468('0x18')](_0x5468('0x59'),_0x46ff68['id']);return getTicket(_0x5dbb12,_0x16b1ff,_0x46ff68,_0x35d81b,_0x42c42b);})[_0x5468('0x17')](function(_0x1bfa38){if(_0x1bfa38){logger[_0x5468('0x18')]('The\x20Ticket\x20ID\x20is:',_0x1bfa38['id']);}})[_0x5468('0x63')](function(_0x4a1b47){logger['error']('['+_0x42c42b[_0x5468('0x72')][_0x5468('0x73')]()+']'+_0x5468('0x74'),util[_0x5468('0x65')](_0x4a1b47,{'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 f9fa561..c787778 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 _0xbbce=['/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','com','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','user:%s','unmanaged','toUpperCase','calleridname','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','localhost','emit','debug','stringify','length','type','string','idField','content','variableName','Variable','name','toString','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Owner','administrator','Subject','getString','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','utc','endtime','starttime','format','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xbbce,0xb0));var _0xebbc=function(_0x1240ee,_0x50fdf8){_0x1240ee=_0x1240ee-0x0;var _0x9ebe4e=_0xbbce[_0x1240ee];return _0x9ebe4e;};'use strict';var _=require(_0xebbc('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xebbc('0x1'));var intUtil=require(_0xebbc('0x2'));var moment=require(_0xebbc('0x3'));var Redis=require(_0xebbc('0x4'));var BPromise=require(_0xebbc('0x5'));var config=require(_0xebbc('0x6'));var logger=require('../../../../config/logger')(_0xebbc('0x7'));config['redis']=_['defaults'](config[_0xebbc('0x8')],{'host':_0xebbc('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebbc('0x8')]));function emit(_0x2c5e72,_0x4bc47b,_0x355c54){io['to'](_0x2c5e72)[_0xebbc('0xa')](_0x4bc47b,_0x355c54);}function request(_0x6a9ee9){logger[_0xebbc('0xb')]('[HTTP]',JSON[_0xebbc('0xc')](_0x6a9ee9));return rp(_0x6a9ee9);}function getCustomFields(_0x290b6f,_0x58fe71){var _0x3427aa={};if(_0x290b6f[_0xebbc('0xd')]>0x0){_['forEach'](_0x290b6f,function(_0x5c5763){if(_0x5c5763[_0xebbc('0xe')]===_0xebbc('0xf')&&_0x5c5763[_0xebbc('0x10')]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x5c5763[_0xebbc('0x11')]['toString']();}else if(_0x5c5763[_0xebbc('0xe')]==='variable'&&_0x5c5763[_0xebbc('0x12')]&&_0x5c5763[_0xebbc('0x10')]&&_0x58fe71[_0x5c5763[_0xebbc('0x12')]]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x58fe71[_0x5c5763[_0xebbc('0x12')]]['toString']();}else if(_0x5c5763[_0xebbc('0xe')]==='customVariable'&&_0x5c5763[_0xebbc('0x13')]&&_0x5c5763[_0xebbc('0x13')]['name']&&_0x5c5763[_0xebbc('0x10')]&&_0x58fe71[_0x5c5763['Variable'][_0xebbc('0x14')]['toLowerCase']()]){_0x3427aa[_0x5c5763[_0xebbc('0x10')]]=_0x58fe71[_0x5c5763[_0xebbc('0x13')][_0xebbc('0x14')]['toLowerCase']()][_0xebbc('0x15')]();}});}return _0x3427aa;}function getName(_0x311aa2){if(_0x311aa2[_0xebbc('0x16')]('\x20')>0x0){var _0x26d227=_0x311aa2['split'](/ (.+)/);if(_0x26d227[0x1]){return _0x26d227;}}return[_0x311aa2,_0x311aa2];}var accountsTokens={};function getAccessToken(_0x3bb1ae){return new Promise(function(_0x254599,_0x2c1843){if(!_[_0xebbc('0x17')](accountsTokens[_0x3bb1ae['id']])&&!_[_0xebbc('0x17')](accountsTokens[_0x3bb1ae['id']][_0xebbc('0x18')])){if(moment()['isBefore'](accountsTokens[_0x3bb1ae['id']][_0xebbc('0x19')])){_0x254599(accountsTokens[_0x3bb1ae['id']]['access_token']);}}var _0x226766;switch(_0x3bb1ae[_0xebbc('0x1a')]){case'US':_0x226766=_0xebbc('0x1b');break;case'AU':_0x226766=_0xebbc('0x1c');break;case'EU':_0x226766=_0xebbc('0x1d');break;case'IN':_0x226766='https://accounts.zoho.in';break;case'CN':_0x226766='https://accounts.zoho.com.cn';break;default:_0x226766=_0xebbc('0x1d');break;}var _0x4f0552={'method':_0xebbc('0x1e'),'uri':_0x226766+_0xebbc('0x1f'),'qs':{'refresh_token':_0x3bb1ae[_0xebbc('0x20')],'client_id':_0x3bb1ae[_0xebbc('0x21')],'client_secret':_0x3bb1ae[_0xebbc('0x22')],'grant_type':_0xebbc('0x23')},'json':!![]};return rp(_0x4f0552)[_0xebbc('0x24')](function(_0x10f122){accountsTokens[_0x3bb1ae['id']]={'access_token':_0x10f122[_0xebbc('0x18')],'expires_in':moment()['add'](_0x10f122[_0xebbc('0x19')],_0xebbc('0x25'))};_0x254599(_0x10f122[_0xebbc('0x18')]);})[_0xebbc('0x26')](function(_0x507bfd){logger['error']('Failing\x20creating\x20the\x20access_token',_0x507bfd[_0xebbc('0x27')]);_0x2c1843(_0x507bfd);});});}function getUser(_0x46b9b5,_0x1c2740,_0x4bdd30,_0x3f6049){logger[_0xebbc('0x28')](_0xebbc('0x29'));return request({'method':_0xebbc('0x2a'),'uri':util['format'](_0xebbc('0x2b'),_0x1c2740),'qs':{'type':_0xebbc('0x2c')},'headers':{'Authorization':_0xebbc('0x2d')+_0x46b9b5},'json':!![]})['then'](function(_0xacc0ea){if(_0xacc0ea[_0xebbc('0x2e')]){var _0x193c7f=-0x1;if(_['isArrayLikeObject'](_0xacc0ea[_0xebbc('0x2e')])){if(!_[_0xebbc('0x17')](_0x3f6049)){_0x193c7f=_[_0xebbc('0x2f')](_0xacc0ea[_0xebbc('0x2e')],function(_0x18f293){return _0x18f293[_0xebbc('0x30')]===_0x3f6049;});}if(_0x193c7f>=0x0){logger[_0xebbc('0x28')](_0xebbc('0x31'));}else{logger[_0xebbc('0x28')](_0xebbc('0x32'));_0x193c7f=_['findIndex'](_0xacc0ea[_0xebbc('0x2e')],function(_0x1509cd){return _0x1509cd[_0xebbc('0x33')][_0xebbc('0x14')]===_0xebbc('0x34');});}return _0xacc0ea[_0xebbc('0x2e')][_0x193c7f];}else{if(_0xacc0ea['user']['profile'][_0xebbc('0x14')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0xacc0ea[_0xebbc('0x35')];return user;}else{logger[_0xebbc('0x36')](_0xebbc('0x37'),JSON['stringify'](_0xacc0ea));throw new Error(_0xebbc('0x38')+JSON[_0xebbc('0xc')](_0xacc0ea));}}}else{logger[_0xebbc('0x36')]('The\x20failing\x20result\x20is',JSON[_0xebbc('0xc')](_0xacc0ea));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0xacc0ea));}})[_0xebbc('0x26')](function(_0x4f138c){console[_0xebbc('0x36')](_0x4f138c);});}function getZohoUser(_0x985455,_0x1d2015){return new BPromise(function(_0xf79530,_0x1cb4d8){request(_0x985455)[_0xebbc('0x24')](function(_0x4e44ac){var _0x4054c0=null;if(_0x4e44ac){_0x4054c0=_0x4e44ac[_0xebbc('0x39')][0x0];_0x4054c0['enduserType']=_0x1d2015;}_0xf79530(_0x4054c0);})['catch'](function(_0x1de654){_0x1cb4d8(_0x1de654);});});}function createEndUser(_0x5bd92d,_0x327cbb,_0x5f497d,_0x553f4e,_0x11c46b,_0x29b065){var _0x5f497d=getName(_0x5f497d);return request({'method':_0xebbc('0x1e'),'uri':_0xebbc('0x3a')+_0x327cbb+_0xebbc('0x3b')+_[_0xebbc('0x3c')](_0x29b065['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5f497d[0x1],'First_Name':_0x5f497d[0x0],'Phone':_0x553f4e,'Owner':{'name':!_[_0xebbc('0x17')](_0x11c46b[_0xebbc('0x3d')][_0xebbc('0x14')])?_0x11c46b[_0xebbc('0x3d')][_0xebbc('0x14')]:!_[_0xebbc('0x17')](_0x11c46b['first_name'])?_0x11c46b[_0xebbc('0x3e')]+'\x20'+_0x11c46b[_0xebbc('0x3f')]:_0x11c46b[_0xebbc('0x3f')],'id':_0x11c46b['id']}}]},'headers':{'Authorization':_0xebbc('0x2d')+_0x5bd92d},'json':!![]})[_0xebbc('0x24')](function(_0x33d692){if(_0x33d692&&_0x33d692[_0xebbc('0x39')][0x0][_0xebbc('0x40')]===_0xebbc('0x41')){var _0x2ebb66=_0x33d692[_0xebbc('0x39')][0x0][_0xebbc('0x42')];_0x2ebb66[_0xebbc('0x43')]=_[_0xebbc('0x3c')](_0x29b065[_0xebbc('0x44')])+'s';return _0x2ebb66;}logger[_0xebbc('0x36')]('The\x20failing\x20result\x20is',JSON[_0xebbc('0xc')](data));throw new Error(_0xebbc('0x45')+JSON[_0xebbc('0xc')](data));})[_0xebbc('0x26')](function(_0x4440e6){console[_0xebbc('0x46')](_0xebbc('0x47'),_0x4440e6);});}function getEndUser(_0x5973de,_0x388956,_0x59de00,_0x4ef959,_0x3612ac,_0x282734,_0xcca842){var _0x49fe77={'method':_0xebbc('0x2a'),'uri':'','headers':{'Authorization':_0xebbc('0x2d')+_0x5973de},'json':!![]};switch(_0xcca842['moduleSearch']){case'contact_lead':_0x49fe77[_0xebbc('0x48')]='https://www.zohoapis.'+_0x388956+_0xebbc('0x49')+_0x3612ac+'))';return getZohoUser(_0x49fe77,_0xebbc('0x4a'))[_0xebbc('0x24')](function(_0x2836f9){if(_0x2836f9)return _0x2836f9;_0x49fe77[_0xebbc('0x48')]=_0xebbc('0x3a')+_0x388956+_0xebbc('0x4b')+_0x3612ac+'))';return getZohoUser(_0x49fe77,_0xebbc('0x4c'))['then'](function(_0x324a7d){if(_0x324a7d)return _0x324a7d;if(_0xcca842[_0xebbc('0x44')]!='nothing'){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});});break;case _0xebbc('0x4d'):_0x49fe77[_0xebbc('0x48')]=_0xebbc('0x3a')+_0x388956+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3612ac+'))';return getZohoUser(_0x49fe77,'Contacts')[_0xebbc('0x24')](function(_0x340a4e){if(_0x340a4e)return _0x340a4e;if(_0xcca842[_0xebbc('0x44')]!=_0xebbc('0x4e')){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});break;case _0xebbc('0x4f'):_0x49fe77['uri']=_0xebbc('0x3a')+_0x388956+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3612ac+'))';return getZohoUser(_0x49fe77,'Leads')[_0xebbc('0x24')](function(_0x54467a){if(_0x54467a)return _0x54467a;if(_0xcca842[_0xebbc('0x44')]!='nothing'){return createEndUser(_0x5973de,_0x388956,_0x4ef959,_0x3612ac,_0x282734,_0xcca842);}else{return{};}});break;}}function getCall(_0x2bfe51,_0x499300,_0x1c4286,_0x15ba57,_0x1be6f8,_0x579ebc,_0x49e1eb,_0x28aa2d){logger['info']('Creating\x20new\x20call...');var _0x44ae84={};_0x44ae84[_0xebbc('0x50')]={'name':!_[_0xebbc('0x17')](_0x15ba57[_0xebbc('0x3d')][_0xebbc('0x14')])&&!_['isNil'](_0x15ba57['profile'][_0xebbc('0x14')])&&_0x15ba57[_0xebbc('0x33')]['name']===_0xebbc('0x51')?_0x15ba57[_0xebbc('0x3d')][_0xebbc('0x14')]:!_['isNil'](_0x15ba57[_0xebbc('0x3e')])?_0x15ba57[_0xebbc('0x3e')]+'\x20'+_0x15ba57[_0xebbc('0x3f')]:_0x15ba57[_0xebbc('0x3f')],'id':_0x15ba57['id']};_0x44ae84[_0xebbc('0x52')]=intUtil['getString'](_0x579ebc['Subjects'],_0x49e1eb,'\x20');_0x44ae84['Description']=intUtil[_0xebbc('0x53')](_0x579ebc['Descriptions'],_0x49e1eb,'\x0a');if(_0x1be6f8[_0xebbc('0x43')]==='Contacts'){_0x44ae84['Who_Id']={'name':!_[_0xebbc('0x17')](_0x1be6f8[_0xebbc('0x54')])?_0x1be6f8[_0xebbc('0x54')]:!_['isNil'](_0x1be6f8['First_Name'])?_0x1be6f8[_0xebbc('0x55')]+'\x20'+_0x1be6f8[_0xebbc('0x56')]:_0x1be6f8[_0xebbc('0x56')],'id':_0x1be6f8['id']};}if(_0x1be6f8['enduserType']===_0xebbc('0x4c')){_0x44ae84[_0xebbc('0x57')]={'name':!_[_0xebbc('0x17')](_0x1be6f8['Full_Name'])?_0x1be6f8['Full_Name']:!_['isNil'](_0x1be6f8['First_Name'])?_0x1be6f8[_0xebbc('0x55')]+'\x20'+_0x1be6f8[_0xebbc('0x56')]:_0x1be6f8[_0xebbc('0x56')],'id':_0x1be6f8['id']};_0x44ae84['$se_module']=_[_0xebbc('0x3c')](_0x1be6f8[_0xebbc('0x43')]);}if(_0x49e1eb[_0xebbc('0x58')]){_0x44ae84[_0xebbc('0x59')]=moment['utc'](parseInt(_0x49e1eb[_0xebbc('0x58')])*0x3e8)['format'](_0xebbc('0x5a'));}else if(_0x49e1eb[_0xebbc('0x5b')]&&_0x49e1eb['endtime']){_0x44ae84[_0xebbc('0x59')]=moment[_0xebbc('0x5c')](moment(_0x49e1eb[_0xebbc('0x5d')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x49e1eb[_0xebbc('0x5e')],'YYYY-MM-DDTHH:mm:ss')))[_0xebbc('0x5f')](_0xebbc('0x5a'));}switch(_0x49e1eb[_0xebbc('0x60')]){case _0xebbc('0x61'):_0x44ae84[_0xebbc('0x62')]=_0xebbc('0x63');break;case _0xebbc('0x64'):case _0xebbc('0x65'):_0x44ae84[_0xebbc('0x62')]=_0xebbc('0x66');break;case _0xebbc('0x67'):_0x44ae84['Call_Result']=_0xebbc('0x68');break;case _0xebbc('0x69'):_0x44ae84['Call_Result']=_0xebbc('0x6a');break;case _0xebbc('0x6b'):_0x44ae84[_0xebbc('0x62')]='Timeout';default:}_0x44ae84['Call_Start_Time']=(_0x28aa2d===_0xebbc('0x6c')?moment(_0x49e1eb[_0xebbc('0x5e')])[_0xebbc('0x5f')](_0xebbc('0x6d')):moment(_0x49e1eb[_0xebbc('0x6e')])[_0xebbc('0x5f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xebbc('0x6d'));_0x44ae84[_0xebbc('0x6f')]=_0x28aa2d||_0xebbc('0x70');_0x44ae84=_['merge'](_0x44ae84,getCustomFields(_0x579ebc[_0xebbc('0x71')],_0x49e1eb));return request({'method':_0xebbc('0x1e'),'uri':_0xebbc('0x3a')+_0x499300+_0xebbc('0x72'),'headers':{'Authorization':_0xebbc('0x2d')+_0x2bfe51},'body':{'data':[_0x44ae84]},'json':!![]})[_0xebbc('0x24')](function(_0x5a2438){if(_0x5a2438&&_0x5a2438[_0xebbc('0x39')][0x0]['code']==='SUCCESS'){logger[_0xebbc('0x28')](_0xebbc('0x73'));return{'id':_0x5a2438['data'][0x0]['details']['id']};}})[_0xebbc('0x26')](function(_0x22e551){logger[_0xebbc('0x28')](_0xebbc('0x74'),_0x22e551['stack']);console[_0xebbc('0x46')](_0xebbc('0x74'),_0x22e551);});}exports[_0xebbc('0x75')]=function(_0x5dfd0d,_0x1c8dce,_0x56c7f1,_0x37fae3,_0x36e704,_0x3e9554){var _0x431395,_0x1fc55b,_0x4d1008;_0x3e9554[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x3e9554['host']);_0x3e9554[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x3e9554[_0xebbc('0x78')]);if(_0x36e704&&_0x36e704[_0xebbc('0x79')]){logger[_0xebbc('0x28')](_0xebbc('0x7a'),'Recording\x20is\x20enabled!');_0x1c8dce[_0xebbc('0x7b')]=_0x3e9554[_0xebbc('0x78')]+_0xebbc('0x7c')+_0x1c8dce[_0xebbc('0x7d')]+_0xebbc('0x7e')+md5(_0x1c8dce[_0xebbc('0x7d')]);}else{_0x1c8dce[_0xebbc('0x7b')]='';}var _0x201e57=_0x3e9554[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':'com';return getAccessToken(_0x3e9554)[_0xebbc('0x24')](function(_0x24508d){_0x4d1008=_0x24508d;return getUser(_0x4d1008,_0x201e57,_0x3e9554,_0x37fae3[_0xebbc('0x30')]);})[_0xebbc('0x24')](function(_0xc2f4f3){_0x431395=_0xc2f4f3;logger[_0xebbc('0x28')](_0xebbc('0x80'),_0x431395['id']);return getEndUser(_0x4d1008,_0x201e57,_0x3e9554,_0x1c8dce['calleridname'],_0x1c8dce[_0xebbc('0x81')],_0x431395,_0x56c7f1);})['then'](function(_0x3c733e){_0x1fc55b=_0x3c733e;return getCall(_0x4d1008,_0x201e57,_0x3e9554,_0x431395,_0x1fc55b,_0x56c7f1,_0x1c8dce,_0xebbc('0x70'));})['then'](function(_0x4cbb0c){if(_0x4cbb0c){logger[_0xebbc('0x28')]('The\x20Call\x20ID\x20is:',_0x4cbb0c['id']);logger[_0xebbc('0x28')](_0xebbc('0x7a'),_0xebbc('0x82'));emit(util['format']('user:%s',_0x37fae3[_0xebbc('0x14')]),'trigger:browser:url',{'uri':_0xebbc('0x83')+_0x3e9554['host']+_0xebbc('0x84')+_0x4cbb0c['id']});}})[_0xebbc('0x26')](function(_0x4be4bb){logger[_0xebbc('0x36')](_0xebbc('0x7a'),JSON[_0xebbc('0xc')](_0x4be4bb));});};exports[_0xebbc('0x6c')]=function(_0x453c60,_0x4f989a,_0x54063b,_0x32e328,_0xd84dc3,_0x26674f,_0x12e0e7){var _0xa24fa1,_0x118e58,_0x476a9d;_0x26674f[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x26674f[_0xebbc('0x76')]);_0x26674f[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x26674f[_0xebbc('0x78')]);if(_0x12e0e7&&_0x12e0e7[_0xebbc('0x85')]&&_0x12e0e7[_0xebbc('0x85')]!==_0xebbc('0x86')){logger['info'](_0xebbc('0x87'),_0xebbc('0x88'));_0x4f989a[_0xebbc('0x7b')]=_0x26674f[_0xebbc('0x78')]+'/api/voice/recordings/'+_0x4f989a[_0xebbc('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x4f989a[_0xebbc('0x7d')]);}var _0x2f3298=_0x26674f[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':_0xebbc('0x89');return getAccessToken(_0x26674f)[_0xebbc('0x24')](function(_0x4d8f21){_0x476a9d=_0x4d8f21;return getUser(_0x476a9d,_0x2f3298,_0x26674f,_0x32e328[_0xebbc('0x30')]);})['then'](function(_0x44b8d6){_0xa24fa1=_0x44b8d6;logger['info']('The\x20User\x20ID\x20is:',_0xa24fa1['id']);return getEndUser(_0x476a9d,_0x2f3298,_0x26674f,_0x4f989a[_0xebbc('0x8a')],_0x4f989a[_0xebbc('0x8b')],_0xa24fa1,_0x54063b);})['then'](function(_0x36abdb){_0x118e58=_0x36abdb;return getCall(_0x476a9d,_0x2f3298,_0x26674f,_0xa24fa1,_0x118e58,_0x54063b,_0x4f989a,'Outbound');})['then'](function(_0x3407fb){if(_0x3407fb){logger['info'](_0xebbc('0x8c'),_0x3407fb['id']);logger[_0xebbc('0x28')]('[OUTBOUND]',_0xebbc('0x82'));emit(util[_0xebbc('0x5f')](_0xebbc('0x8d'),_0x32e328[_0xebbc('0x14')]),'trigger:browser:url',{'uri':_0xebbc('0x83')+_0x26674f[_0xebbc('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3407fb['id']});}})[_0xebbc('0x26')](function(_0x1b5db6){logger[_0xebbc('0x36')](_0xebbc('0x87'),JSON[_0xebbc('0xc')](_0x1b5db6));});};exports[_0xebbc('0x8e')]=function(_0x4356a4,_0x3d56c8,_0x646a3c,_0x47086e,_0x137e51,_0x2e39e7){var _0x34a2c9,_0x59f50a,_0xcf128f;_0x2e39e7[_0xebbc('0x76')]=intUtil[_0xebbc('0x77')](_0x2e39e7[_0xebbc('0x76')]);_0x2e39e7[_0xebbc('0x78')]=intUtil[_0xebbc('0x77')](_0x2e39e7[_0xebbc('0x78')]);if(_0x137e51&&_0x137e51[_0xebbc('0x79')]){logger[_0xebbc('0x28')]('['+_0x3d56c8[_0xebbc('0x60')][_0xebbc('0x8f')]()+']',_0xebbc('0x88'));_0x3d56c8[_0xebbc('0x7b')]=_0x2e39e7['serverUrl']+_0xebbc('0x7c')+_0x3d56c8[_0xebbc('0x7d')]+_0xebbc('0x7e')+md5(_0x3d56c8['uniqueid']);}else{_0x3d56c8['recordingURL']='';}var _0x3cdea4=_0x2e39e7[_0xebbc('0x76')]===_0xebbc('0x7f')?'eu':_0xebbc('0x89');return getAccessToken(_0x2e39e7)['then'](function(_0x5e7d23){_0xcf128f=_0x5e7d23;return getUser(_0xcf128f,_0x3cdea4,_0x2e39e7);})[_0xebbc('0x24')](function(_0x190a28){_0x34a2c9=_0x190a28;logger[_0xebbc('0x28')]('The\x20User\x20ID\x20is:',_0x34a2c9['id']);return getEndUser(_0xcf128f,_0x3cdea4,_0x2e39e7,_0x3d56c8[_0xebbc('0x90')],_0x3d56c8[_0xebbc('0x81')],_0x34a2c9,_0x646a3c);})['then'](function(_0x362836){_0x59f50a=_0x362836;return getCall(_0xcf128f,_0x3cdea4,_0x2e39e7,_0x34a2c9,_0x59f50a,_0x646a3c,_0x3d56c8,_0xebbc('0x70'));})[_0xebbc('0x24')](function(_0x402651){if(_0x402651){logger[_0xebbc('0x28')](_0xebbc('0x8c'),_0x402651['id']);}})[_0xebbc('0x26')](function(_0x4684bb){logger[_0xebbc('0x36')]('['+_0x3d56c8[_0xebbc('0x60')][_0xebbc('0x8f')]()+']',JSON[_0xebbc('0xc')](_0x4684bb));});}; \ No newline at end of file +var _0x4f9a=['endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','stack','log','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','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]','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','idField','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','moduleCreate','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime'];(function(_0x2351ab,_0x5680f0){var _0x428ca4=function(_0x3016ee){while(--_0x3016ee){_0x2351ab['push'](_0x2351ab['shift']());}};_0x428ca4(++_0x5680f0);}(_0x4f9a,0xd1));var _0xa4f9=function(_0x17df72,_0x2cf032){_0x17df72=_0x17df72-0x0;var _0x1b6ec9=_0x4f9a[_0x17df72];return _0x1b6ec9;};'use strict';var _=require('lodash');var rp=require(_0xa4f9('0x0'));var md5=require(_0xa4f9('0x1'));var util=require(_0xa4f9('0x2'));var intUtil=require(_0xa4f9('0x3'));var moment=require('moment');var Redis=require(_0xa4f9('0x4'));var BPromise=require('bluebird');var config=require(_0xa4f9('0x5'));var logger=require(_0xa4f9('0x6'))(_0xa4f9('0x7'));config[_0xa4f9('0x8')]=_[_0xa4f9('0x9')](config[_0xa4f9('0x8')],{'host':_0xa4f9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4f9('0x8')]));function emit(_0x2f5b76,_0x316d3a,_0x54046f){io['to'](_0x2f5b76)[_0xa4f9('0xb')](_0x316d3a,_0x54046f);}function request(_0x2ae5d9){logger[_0xa4f9('0xc')](_0xa4f9('0xd'),JSON[_0xa4f9('0xe')](_0x2ae5d9));return rp(_0x2ae5d9);}function getCustomFields(_0x1ef617,_0x435e23){var _0x247232={};if(_0x1ef617[_0xa4f9('0xf')]>0x0){_[_0xa4f9('0x10')](_0x1ef617,function(_0xc55e97){if(_0xc55e97['type']===_0xa4f9('0x11')&&_0xc55e97[_0xa4f9('0x12')]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0xc55e97['content'][_0xa4f9('0x13')]();}else if(_0xc55e97[_0xa4f9('0x14')]===_0xa4f9('0x15')&&_0xc55e97[_0xa4f9('0x16')]&&_0xc55e97['idField']&&_0x435e23[_0xc55e97[_0xa4f9('0x16')]]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0x435e23[_0xc55e97[_0xa4f9('0x16')]][_0xa4f9('0x13')]();}else if(_0xc55e97[_0xa4f9('0x14')]==='customVariable'&&_0xc55e97['Variable']&&_0xc55e97[_0xa4f9('0x17')]['name']&&_0xc55e97[_0xa4f9('0x12')]&&_0x435e23[_0xc55e97[_0xa4f9('0x17')][_0xa4f9('0x18')][_0xa4f9('0x19')]()]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0x435e23[_0xc55e97['Variable'][_0xa4f9('0x18')][_0xa4f9('0x19')]()][_0xa4f9('0x13')]();}});}return _0x247232;}function getName(_0x1c72cd){if(_0x1c72cd[_0xa4f9('0x1a')]('\x20')>0x0){var _0xab102f=_0x1c72cd[_0xa4f9('0x1b')](/ (.+)/);if(_0xab102f[0x1]){return _0xab102f;}}return[_0x1c72cd,_0x1c72cd];}var accountsTokens={};function getAccessToken(_0x243168){return new Promise(function(_0x1908b6,_0x306ffe){if(!_[_0xa4f9('0x1c')](accountsTokens[_0x243168['id']])&&!_[_0xa4f9('0x1c')](accountsTokens[_0x243168['id']][_0xa4f9('0x1d')])){if(moment()[_0xa4f9('0x1e')](accountsTokens[_0x243168['id']][_0xa4f9('0x1f')])){_0x1908b6(accountsTokens[_0x243168['id']]['access_token']);}}var _0x3f5854;switch(_0x243168[_0xa4f9('0x20')]){case'US':_0x3f5854=_0xa4f9('0x21');break;case'AU':_0x3f5854=_0xa4f9('0x22');break;case'EU':_0x3f5854=_0xa4f9('0x23');break;case'IN':_0x3f5854='https://accounts.zoho.in';break;case'CN':_0x3f5854='https://accounts.zoho.com.cn';break;default:_0x3f5854=_0xa4f9('0x23');break;}var _0x4c42f4={'method':_0xa4f9('0x24'),'uri':_0x3f5854+_0xa4f9('0x25'),'qs':{'refresh_token':_0x243168[_0xa4f9('0x26')],'client_id':_0x243168[_0xa4f9('0x27')],'client_secret':_0x243168[_0xa4f9('0x28')],'grant_type':_0xa4f9('0x29')},'json':!![]};return rp(_0x4c42f4)[_0xa4f9('0x2a')](function(_0xebfb32){accountsTokens[_0x243168['id']]={'access_token':_0xebfb32[_0xa4f9('0x1d')],'expires_in':moment()['add'](_0xebfb32[_0xa4f9('0x1f')],_0xa4f9('0x2b'))};_0x1908b6(_0xebfb32[_0xa4f9('0x1d')]);})[_0xa4f9('0x2c')](function(_0x41cbed){logger['error'](_0xa4f9('0x2d'),_0x41cbed['stack']);_0x306ffe(_0x41cbed);});});}function getUser(_0x2eace7,_0x3c8303,_0x1054bd,_0x348f11){logger['info']('Search\x20user');return request({'method':_0xa4f9('0x2e'),'uri':util[_0xa4f9('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x3c8303),'qs':{'type':_0xa4f9('0x30')},'headers':{'Authorization':_0xa4f9('0x31')+_0x2eace7},'json':!![]})[_0xa4f9('0x2a')](function(_0x5e89dc){if(_0x5e89dc[_0xa4f9('0x32')]){var _0x122be0=-0x1;if(_[_0xa4f9('0x33')](_0x5e89dc['users'])){if(!_[_0xa4f9('0x1c')](_0x348f11)){_0x122be0=_[_0xa4f9('0x34')](_0x5e89dc[_0xa4f9('0x32')],function(_0x3b6707){return _0x3b6707[_0xa4f9('0x35')]===_0x348f11;});}if(_0x122be0>=0x0){logger[_0xa4f9('0x36')](_0xa4f9('0x37'));}else{logger[_0xa4f9('0x36')](_0xa4f9('0x38'));_0x122be0=_[_0xa4f9('0x34')](_0x5e89dc[_0xa4f9('0x32')],function(_0x39eec5){return _0x39eec5[_0xa4f9('0x39')]['name']===_0xa4f9('0x3a');});}return _0x5e89dc[_0xa4f9('0x32')][_0x122be0];}else{if(_0x5e89dc[_0xa4f9('0x3b')][_0xa4f9('0x39')][_0xa4f9('0x18')]===_0xa4f9('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5e89dc['user'];return user;}else{logger[_0xa4f9('0x3c')](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](_0x5e89dc));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa4f9('0xe')](_0x5e89dc));}}}else{logger['error'](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](_0x5e89dc));throw new Error(_0xa4f9('0x3e')+JSON[_0xa4f9('0xe')](_0x5e89dc));}})['catch'](function(_0x416c9a){console[_0xa4f9('0x3c')](_0x416c9a);});}function getZohoUser(_0x3ac5e9,_0x5ebe55){return new BPromise(function(_0x46e396,_0x56c2db){request(_0x3ac5e9)[_0xa4f9('0x2a')](function(_0x717466){var _0x2b69f6=null;if(_0x717466){_0x2b69f6=_0x717466[_0xa4f9('0x3f')][0x0];_0x2b69f6[_0xa4f9('0x40')]=_0x5ebe55;}_0x46e396(_0x2b69f6);})['catch'](function(_0x3fbbd7){_0x56c2db(_0x3fbbd7);});});}function createEndUser(_0x138eb2,_0x5130d9,_0x468099,_0x1c63c7,_0x2a12e3,_0xd41e11){var _0x468099=getName(_0x468099);return request({'method':_0xa4f9('0x24'),'uri':_0xa4f9('0x41')+_0x5130d9+_0xa4f9('0x42')+_[_0xa4f9('0x43')](_0xd41e11['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x468099[0x1],'First_Name':_0x468099[0x0],'Phone':_0x1c63c7,'Owner':{'name':!_[_0xa4f9('0x1c')](_0x2a12e3[_0xa4f9('0x44')]['name'])?_0x2a12e3['role'][_0xa4f9('0x18')]:!_[_0xa4f9('0x1c')](_0x2a12e3[_0xa4f9('0x45')])?_0x2a12e3[_0xa4f9('0x45')]+'\x20'+_0x2a12e3[_0xa4f9('0x46')]:_0x2a12e3[_0xa4f9('0x46')],'id':_0x2a12e3['id']}}]},'headers':{'Authorization':_0xa4f9('0x31')+_0x138eb2},'json':!![]})[_0xa4f9('0x2a')](function(_0x44523f){if(_0x44523f&&_0x44523f['data'][0x0][_0xa4f9('0x47')]==='SUCCESS'){var _0x5e5630=_0x44523f[_0xa4f9('0x3f')][0x0][_0xa4f9('0x48')];_0x5e5630[_0xa4f9('0x40')]=_['startCase'](_0xd41e11[_0xa4f9('0x49')])+'s';return _0x5e5630;}logger['error'](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa4f9('0x2c')](function(_0x319cbc){console['log'](_0xa4f9('0x4a'),_0x319cbc);});}function getEndUser(_0x1f3d9a,_0x57c5b0,_0x2e7fcd,_0x5bab63,_0x5ab407,_0xd5197,_0x330656){var _0x115053={'method':'GET','uri':'','headers':{'Authorization':_0xa4f9('0x31')+_0x1f3d9a},'json':!![]};switch(_0x330656[_0xa4f9('0x4b')]){case _0xa4f9('0x4c'):_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x4e'))[_0xa4f9('0x2a')](function(_0x560a24){if(_0x560a24)return _0x560a24;_0x115053['uri']='https://www.zohoapis.'+_0x57c5b0+_0xa4f9('0x4f')+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x50'))['then'](function(_0x163b02){if(_0x163b02)return _0x163b02;if(_0x330656[_0xa4f9('0x49')]!='nothing'){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});});break;case _0xa4f9('0x51'):_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x4e'))[_0xa4f9('0x2a')](function(_0x55c03d){if(_0x55c03d)return _0x55c03d;if(_0x330656[_0xa4f9('0x49')]!=_0xa4f9('0x52')){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});break;case'lead':_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+_0xa4f9('0x4f')+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x50'))[_0xa4f9('0x2a')](function(_0x4ce606){if(_0x4ce606)return _0x4ce606;if(_0x330656[_0xa4f9('0x49')]!=_0xa4f9('0x52')){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});break;}}function getCall(_0x22d4a2,_0x115cc6,_0x3bebc2,_0x1c36cd,_0x52370f,_0x2080df,_0x2652d5,_0x25df6d){logger[_0xa4f9('0x36')](_0xa4f9('0x53'));var _0xcc43da={};_0xcc43da[_0xa4f9('0x54')]={'name':!_[_0xa4f9('0x1c')](_0x1c36cd[_0xa4f9('0x44')][_0xa4f9('0x18')])&&!_[_0xa4f9('0x1c')](_0x1c36cd['profile'][_0xa4f9('0x18')])&&_0x1c36cd[_0xa4f9('0x39')]['name']==='administrator'?_0x1c36cd[_0xa4f9('0x44')][_0xa4f9('0x18')]:!_[_0xa4f9('0x1c')](_0x1c36cd['first_name'])?_0x1c36cd[_0xa4f9('0x45')]+'\x20'+_0x1c36cd[_0xa4f9('0x46')]:_0x1c36cd['last_name'],'id':_0x1c36cd['id']};_0xcc43da[_0xa4f9('0x55')]=intUtil[_0xa4f9('0x56')](_0x2080df['Subjects'],_0x2652d5,'\x20');_0xcc43da[_0xa4f9('0x57')]=intUtil[_0xa4f9('0x56')](_0x2080df[_0xa4f9('0x58')],_0x2652d5,'\x0a');if(_0x52370f[_0xa4f9('0x40')]===_0xa4f9('0x4e')){_0xcc43da['Who_Id']={'name':!_['isNil'](_0x52370f[_0xa4f9('0x59')])?_0x52370f[_0xa4f9('0x59')]:!_['isNil'](_0x52370f[_0xa4f9('0x5a')])?_0x52370f[_0xa4f9('0x5a')]+'\x20'+_0x52370f[_0xa4f9('0x5b')]:_0x52370f[_0xa4f9('0x5b')],'id':_0x52370f['id']};}if(_0x52370f[_0xa4f9('0x40')]===_0xa4f9('0x50')){_0xcc43da[_0xa4f9('0x5c')]={'name':!_['isNil'](_0x52370f[_0xa4f9('0x59')])?_0x52370f[_0xa4f9('0x59')]:!_[_0xa4f9('0x1c')](_0x52370f[_0xa4f9('0x5a')])?_0x52370f[_0xa4f9('0x5a')]+'\x20'+_0x52370f[_0xa4f9('0x5b')]:_0x52370f[_0xa4f9('0x5b')],'id':_0x52370f['id']};_0xcc43da[_0xa4f9('0x5d')]=_[_0xa4f9('0x43')](_0x52370f[_0xa4f9('0x40')]);}if(_0x2652d5[_0xa4f9('0x5e')]){_0xcc43da[_0xa4f9('0x5f')]=moment[_0xa4f9('0x60')](parseInt(_0x2652d5['talktime'])*0x3e8)[_0xa4f9('0x2f')](_0xa4f9('0x61'));}else if(_0x2652d5[_0xa4f9('0x62')]&&_0x2652d5[_0xa4f9('0x63')]){_0xcc43da[_0xa4f9('0x5f')]=moment[_0xa4f9('0x60')](moment(_0x2652d5[_0xa4f9('0x63')],_0xa4f9('0x64'))[_0xa4f9('0x65')](moment(_0x2652d5[_0xa4f9('0x66')],_0xa4f9('0x64'))))[_0xa4f9('0x2f')](_0xa4f9('0x61'));}switch(_0x2652d5[_0xa4f9('0x67')]){case _0xa4f9('0x68'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6a');break;case'complete':case _0xa4f9('0x6b'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6c');break;case _0xa4f9('0x6d'):_0xcc43da['Call_Result']='Rejected';break;case _0xa4f9('0x6e'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6f');break;case _0xa4f9('0x70'):_0xcc43da['Call_Result']=_0xa4f9('0x71');default:}_0xcc43da[_0xa4f9('0x72')]=(_0x25df6d===_0xa4f9('0x73')?moment(_0x2652d5[_0xa4f9('0x66')])[_0xa4f9('0x2f')](_0xa4f9('0x64')):moment(_0x2652d5[_0xa4f9('0x74')])[_0xa4f9('0x2f')](_0xa4f9('0x64')))||moment()[_0xa4f9('0x2f')](_0xa4f9('0x64'));_0xcc43da[_0xa4f9('0x75')]=_0x25df6d||_0xa4f9('0x76');_0xcc43da=_['merge'](_0xcc43da,getCustomFields(_0x2080df[_0xa4f9('0x77')],_0x2652d5));return request({'method':_0xa4f9('0x24'),'uri':_0xa4f9('0x41')+_0x115cc6+_0xa4f9('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x22d4a2},'body':{'data':[_0xcc43da]},'json':!![]})[_0xa4f9('0x2a')](function(_0x2c1a7d){if(_0x2c1a7d&&_0x2c1a7d[_0xa4f9('0x3f')][0x0][_0xa4f9('0x47')]===_0xa4f9('0x79')){logger['info'](_0xa4f9('0x7a'));return{'id':_0x2c1a7d[_0xa4f9('0x3f')][0x0][_0xa4f9('0x48')]['id']};}})[_0xa4f9('0x2c')](function(_0x2bf576){logger[_0xa4f9('0x36')]('err',_0x2bf576[_0xa4f9('0x7b')]);console[_0xa4f9('0x7c')]('err',_0x2bf576);});}exports[_0xa4f9('0x7d')]=function(_0x29e7a4,_0x365434,_0x46f5df,_0x5b634e,_0x1a5f7f,_0x4ef7e9){var _0x3a72de,_0x191db2,_0x1b99fd;_0x4ef7e9['host']=intUtil[_0xa4f9('0x7e')](_0x4ef7e9[_0xa4f9('0x7f')]);_0x4ef7e9[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x4ef7e9[_0xa4f9('0x80')]);if(_0x1a5f7f&&_0x1a5f7f[_0xa4f9('0x81')]){logger[_0xa4f9('0x36')](_0xa4f9('0x82'),_0xa4f9('0x83'));_0x365434['recordingURL']=_0x4ef7e9[_0xa4f9('0x80')]+'/api/voice/recordings/'+_0x365434[_0xa4f9('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x365434[_0xa4f9('0x84')]);}else{_0x365434[_0xa4f9('0x85')]='';}var _0x1bfb27=_0x4ef7e9[_0xa4f9('0x7f')]===_0xa4f9('0x86')?'eu':'com';return getAccessToken(_0x4ef7e9)[_0xa4f9('0x2a')](function(_0x2dd204){_0x1b99fd=_0x2dd204;return getUser(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x5b634e[_0xa4f9('0x35')]);})[_0xa4f9('0x2a')](function(_0x55ca5e){_0x3a72de=_0x55ca5e;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x3a72de['id']);return getEndUser(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x365434[_0xa4f9('0x88')],_0x365434[_0xa4f9('0x89')],_0x3a72de,_0x46f5df);})[_0xa4f9('0x2a')](function(_0x2876bb){_0x191db2=_0x2876bb;return getCall(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x3a72de,_0x191db2,_0x46f5df,_0x365434,_0xa4f9('0x76'));})['then'](function(_0x1cd0a8){if(_0x1cd0a8){logger['info'](_0xa4f9('0x8a'),_0x1cd0a8['id']);logger[_0xa4f9('0x36')](_0xa4f9('0x82'),_0xa4f9('0x8b'));emit(util[_0xa4f9('0x2f')](_0xa4f9('0x8c'),_0x5b634e[_0xa4f9('0x18')]),_0xa4f9('0x8d'),{'uri':_0xa4f9('0x8e')+_0x4ef7e9['host']+_0xa4f9('0x8f')+_0x1cd0a8['id']});}})['catch'](function(_0x344ab0){logger[_0xa4f9('0x3c')](_0xa4f9('0x82'),JSON[_0xa4f9('0xe')](_0x344ab0));});};exports[_0xa4f9('0x73')]=function(_0x1af8fa,_0x1490f6,_0x512e63,_0x3de33f,_0x12b194,_0x7f80ca,_0x492027){var _0x1160bc,_0x579fa4,_0x4804e7;_0x7f80ca[_0xa4f9('0x7f')]=intUtil[_0xa4f9('0x7e')](_0x7f80ca['host']);_0x7f80ca[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x7f80ca[_0xa4f9('0x80')]);if(_0x492027&&_0x492027[_0xa4f9('0x90')]&&_0x492027[_0xa4f9('0x90')]!==_0xa4f9('0x91')){logger[_0xa4f9('0x36')](_0xa4f9('0x92'),_0xa4f9('0x83'));_0x1490f6[_0xa4f9('0x85')]=_0x7f80ca[_0xa4f9('0x80')]+_0xa4f9('0x93')+_0x1490f6[_0xa4f9('0x84')]+_0xa4f9('0x94')+md5(_0x1490f6[_0xa4f9('0x84')]);}var _0x180dc5=_0x7f80ca[_0xa4f9('0x7f')]===_0xa4f9('0x86')?'eu':_0xa4f9('0x95');return getAccessToken(_0x7f80ca)['then'](function(_0x2c0b74){_0x4804e7=_0x2c0b74;return getUser(_0x4804e7,_0x180dc5,_0x7f80ca,_0x3de33f[_0xa4f9('0x35')]);})['then'](function(_0x28ebb0){_0x1160bc=_0x28ebb0;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x1160bc['id']);return getEndUser(_0x4804e7,_0x180dc5,_0x7f80ca,_0x1490f6['destcalleridname'],_0x1490f6[_0xa4f9('0x96')],_0x1160bc,_0x512e63);})[_0xa4f9('0x2a')](function(_0x21d3a0){_0x579fa4=_0x21d3a0;return getCall(_0x4804e7,_0x180dc5,_0x7f80ca,_0x1160bc,_0x579fa4,_0x512e63,_0x1490f6,_0xa4f9('0x97'));})[_0xa4f9('0x2a')](function(_0x470e0d){if(_0x470e0d){logger['info'](_0xa4f9('0x8a'),_0x470e0d['id']);logger[_0xa4f9('0x36')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa4f9('0x8c'),_0x3de33f[_0xa4f9('0x18')]),_0xa4f9('0x8d'),{'uri':_0xa4f9('0x8e')+_0x7f80ca[_0xa4f9('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x470e0d['id']});}})[_0xa4f9('0x2c')](function(_0x58516a){logger['error'](_0xa4f9('0x92'),JSON[_0xa4f9('0xe')](_0x58516a));});};exports[_0xa4f9('0x98')]=function(_0x30c7a8,_0x214f63,_0x4f7d74,_0x46bae2,_0x2a6029,_0x1e8718){var _0x32ec43,_0x487b86,_0x2fde46;_0x1e8718[_0xa4f9('0x7f')]=intUtil[_0xa4f9('0x7e')](_0x1e8718[_0xa4f9('0x7f')]);_0x1e8718[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x1e8718[_0xa4f9('0x80')]);if(_0x2a6029&&_0x2a6029[_0xa4f9('0x81')]){logger[_0xa4f9('0x36')]('['+_0x214f63[_0xa4f9('0x67')][_0xa4f9('0x99')]()+']',_0xa4f9('0x83'));_0x214f63['recordingURL']=_0x1e8718['serverUrl']+_0xa4f9('0x93')+_0x214f63[_0xa4f9('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x214f63[_0xa4f9('0x84')]);}else{_0x214f63[_0xa4f9('0x85')]='';}var _0x80dc41=_0x1e8718[_0xa4f9('0x7f')]==='zoho.eu'?'eu':_0xa4f9('0x95');return getAccessToken(_0x1e8718)[_0xa4f9('0x2a')](function(_0x26f4b0){_0x2fde46=_0x26f4b0;return getUser(_0x2fde46,_0x80dc41,_0x1e8718);})[_0xa4f9('0x2a')](function(_0x4d5522){_0x32ec43=_0x4d5522;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x32ec43['id']);return getEndUser(_0x2fde46,_0x80dc41,_0x1e8718,_0x214f63[_0xa4f9('0x88')],_0x214f63[_0xa4f9('0x89')],_0x32ec43,_0x4f7d74);})[_0xa4f9('0x2a')](function(_0x21185d){_0x487b86=_0x21185d;return getCall(_0x2fde46,_0x80dc41,_0x1e8718,_0x32ec43,_0x487b86,_0x4f7d74,_0x214f63,_0xa4f9('0x76'));})[_0xa4f9('0x2a')](function(_0x3b3244){if(_0x3b3244){logger['info']('The\x20Call\x20ID\x20is:',_0x3b3244['id']);}})['catch'](function(_0x47aaea){logger[_0xa4f9('0x3c')]('['+_0x214f63[_0xa4f9('0x67')][_0xa4f9('0x99')]()+']',JSON[_0xa4f9('0xe')](_0x47aaea));});}; \ 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 1765c05..096f7e1 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(_0x4a0157,_0x8c95d9){var _0x2c25fd=function(_0x567c8f){while(--_0x567c8f){_0x4a0157['push'](_0x4a0157['shift']());}};_0x2c25fd(++_0x8c95d9);}(_0x7a54,0x106));var _0x47a5=function(_0x5a2c90,_0x4b890d){_0x5a2c90=_0x5a2c90-0x0;var _0x134b85=_0x7a54[_0x5a2c90];return _0x134b85;};'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(_0x370fc3,_0x2da901){var _0x5759ae=function(_0x320eb5){while(--_0x320eb5){_0x370fc3['push'](_0x370fc3['shift']());}};_0x5759ae(++_0x2da901);}(_0x7a54,0x106));var _0x47a5=function(_0x29bd81,_0x5df81f){_0x29bd81=_0x29bd81-0x0;var _0x56a846=_0x7a54[_0x29bd81];return _0x56a846;};'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 2e072d0..20ba172 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(_0x110efa,_0x199f70){var _0x2164fb=function(_0x2aaeef){while(--_0x2aaeef){_0x110efa['push'](_0x110efa['shift']());}};_0x2164fb(++_0x199f70);}(_0x5f2f,0x73));var _0xf5f2=function(_0x152198,_0x61c7d0){_0x152198=_0x152198-0x0;var _0x53fce3=_0x5f2f[_0x152198];return _0x53fce3;};'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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x45a8b1,_0x50901f){var _0x25adec=function(_0x2b2777){while(--_0x2b2777){_0x45a8b1['push'](_0x45a8b1['shift']());}};_0x25adec(++_0x50901f);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cfa4,_0x2d41ac){_0x54cfa4=_0x54cfa4-0x0;var _0x26ecf5=_0xb10b[_0x54cfa4];return _0x26ecf5;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e07874b..cd79f8d 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 _0xa348=['then','debug','rpc','error','routing','message','result','catch','exports','jayson/promise','../../config/logger','Request','request'];(function(_0x2d971e,_0x1cff17){var _0x555a96=function(_0x3bbd23){while(--_0x3bbd23){_0x2d971e['push'](_0x2d971e['shift']());}};_0x555a96(++_0x1cff17);}(_0xa348,0xb2));var _0x8a34=function(_0xab35e1,_0x48b46b){_0xab35e1=_0xab35e1-0x0;var _0x1dbb70=_0xa348[_0xab35e1];return _0x1dbb70;};'use strict';var jayson=require(_0x8a34('0x0'));var BPromise=require('bluebird');var logger=require(_0x8a34('0x1'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x8a34('0x2')]=function(_0x3b1db5,_0x1419a4){return new BPromise(function(_0x283895,_0x2d134d){return client[_0x8a34('0x3')](_0x3b1db5,_0x1419a4)[_0x8a34('0x4')](function(_0xe67e06){logger[_0x8a34('0x5')](_0x8a34('0x6'),'routing',_0x3b1db5,_0x1419a4,_0xe67e06);if(_0xe67e06[_0x8a34('0x7')]){logger[_0x8a34('0x7')](_0x8a34('0x6'),_0x8a34('0x8'),_0x3b1db5,_0xe67e06['error'][_0x8a34('0x9')],_0x1419a4);return _0x2d134d(_0xe67e06[_0x8a34('0x7')]['message']);}else{return _0x283895(_0xe67e06[_0x8a34('0xa')]);}})[_0x8a34('0xb')](function(_0x1c21e0){logger[_0x8a34('0x7')](_0x8a34('0x6'),_0x8a34('0x8'),_0x3b1db5,_0x1c21e0,_0x1419a4);return _0x2d134d(_0x1c21e0);});});};module[_0x8a34('0xc')]=client; \ No newline at end of file +var _0xeddd=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x2fc5e2,_0x353d84){var _0x8a38cb=function(_0x92813d){while(--_0x92813d){_0x2fc5e2['push'](_0x2fc5e2['shift']());}};_0x8a38cb(++_0x353d84);}(_0xeddd,0x69));var _0xdedd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xeddd[_0x19950b];return _0x3c6b41;};'use strict';var jayson=require(_0xdedd('0x0'));var BPromise=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var client=jayson['client'][_0xdedd('0x4')]({'port':0x2329});client['Request']=function(_0x10de65,_0xd2ff49){return new BPromise(function(_0x56e22a,_0x37b819){return client[_0xdedd('0x5')](_0x10de65,_0xd2ff49)[_0xdedd('0x6')](function(_0x3e6b5a){logger[_0xdedd('0x7')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0xd2ff49,_0x3e6b5a);if(_0x3e6b5a[_0xdedd('0x9')]){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x3e6b5a[_0xdedd('0x9')]['message'],_0xd2ff49);return _0x37b819(_0x3e6b5a[_0xdedd('0x9')][_0xdedd('0xa')]);}else{return _0x56e22a(_0x3e6b5a[_0xdedd('0xb')]);}})[_0xdedd('0xc')](function(_0x5db016){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x5db016,_0xd2ff49);return _0x37b819(_0x5db016);});});};module[_0xdedd('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a2f3923..36bd857 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 _0x018c=['refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','../../mysqldb','then','getMailAccounts','initMailAccounts'];(function(_0x538e71,_0x458b52){var _0xf320c9=function(_0x137c50){while(--_0x137c50){_0x538e71['push'](_0x538e71['shift']());}};_0xf320c9(++_0x458b52);}(_0x018c,0xda));var _0xc018=function(_0x5de5aa,_0x4b006b){_0x5de5aa=_0x5de5aa-0x0;var _0x3c2ec1=_0x018c[_0x5de5aa];return _0x3c2ec1;};'use strict';var BPromise=require(_0xc018('0x0'));var server=require(_0xc018('0x1'));var Realtime=require(_0xc018('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc018('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xc018('0x4')](mailAccount[_0xc018('0x5')]())[_0xc018('0x4')](realtime[_0xc018('0x6')]())['then'](function(){email[_0xc018('0x7')](realtime[_0xc018('0x8')]);return realtime;});}function main(){return server[_0xc018('0x9')](realtime,email)[_0xc018('0x4')](function(_0x29a572){return initRealtime();})[_0xc018('0x4')](function(_0x638610){return db[_0xc018('0xa')][_0xc018('0xb')]({'attributes':['id',_0xc018('0xc')],'raw':!![]});})[_0xc018('0x4')](function(_0x2ef3a3){return setInterval(initRealtime,_0x2ef3a3[_0xc018('0xc')]*0x3e8);})[_0xc018('0xd')](function(_0x254baf){console[_0xc018('0xe')](_0x254baf);});}main(); \ No newline at end of file +var _0x8375=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting'];(function(_0xcbd283,_0xa3a41a){var _0x4047f3=function(_0xc13ca9){while(--_0xc13ca9){_0xcbd283['push'](_0xcbd283['shift']());}};_0x4047f3(++_0xa3a41a);}(_0x8375,0xa8));var _0x5837=function(_0xc6033a,_0xa7f79e){_0xc6033a=_0xc6033a-0x0;var _0x512521=_0x8375[_0xc6033a];return _0x512521;};'use strict';var BPromise=require(_0x5837('0x0'));var server=require(_0x5837('0x1'));var Realtime=require(_0x5837('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x5837('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5837('0x4'))['db'];function initRealtime(){return BPromise[_0x5837('0x5')]()[_0x5837('0x6')](mailAccount[_0x5837('0x7')]())[_0x5837('0x6')](realtime['initMailAccounts']())[_0x5837('0x6')](function(){email[_0x5837('0x8')](realtime[_0x5837('0x9')]);return realtime;});}function main(){return server[_0x5837('0xa')](realtime,email)[_0x5837('0x6')](function(_0x5bc421){return initRealtime();})['then'](function(_0x1e44c4){return db[_0x5837('0xb')]['findOne']({'attributes':['id',_0x5837('0xc')],'raw':!![]});})['then'](function(_0x4556fd){return setInterval(initRealtime,_0x4556fd[_0x5837('0xc')]*0x3e8);})[_0x5837('0xd')](function(_0xc6c6c9){console[_0x5837('0xe')](_0xc6c6c9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e346be6..523fc99 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 _0x9659=['verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','status','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','smtp'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x9659,0x6b));var _0x9965=function(_0x1773d8,_0x551063){_0x1773d8=_0x1773d8-0x0;var _0x33914b=_0x9659[_0x1773d8];return _0x33914b;};'use strict';var _=require(_0x9965('0x0'));var moment=require(_0x9965('0x1'));var BPromise=require(_0x9965('0x2'));var md5=require(_0x9965('0x3'));var Redis=require('ioredis');var config=require(_0x9965('0x4'));var logger=require(_0x9965('0x5'))(_0x9965('0x6'));config[_0x9965('0x7')]=_['defaults'](config['redis'],{'host':_0x9965('0x8'),'port':0x18eb});var io=require(_0x9965('0x9'))(new Redis(config[_0x9965('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9965('0xa'));var mailAccount=require(_0x9965('0xb'));var md5Accounts={};function EmailChannel(_0x2bda51){logger[_0x9965('0xc')](_0x9965('0xd'));this[_0x9965('0xe')]=_0x2bda51[_0x9965('0xe')];this[_0x9965('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x9965('0x10')][_0x9965('0x11')]=function(_0x56a107){var _0x30ec8a=this[_0x9965('0xe')][_0x56a107];var _0x19b29d={'id':_0x30ec8a['id'],'name':_0x30ec8a[_0x9965('0x12')],'key':_0x30ec8a['key'],'active':_0x30ec8a['active'],'Imap':{'status':_0x30ec8a['Imap']['status'],'messageStatus':_0x30ec8a[_0x9965('0x13')][_0x9965('0x14')],'total':_0x30ec8a[_0x9965('0x13')][_0x9965('0x15')]}};if(_[_0x9965('0x16')](md5Accounts[_0x56a107])){md5Accounts[_0x56a107]={};}var _0x127a12=md5(JSON[_0x9965('0x17')](_0x19b29d));if(md5Accounts[_0x56a107][_0x9965('0x3')]!==_0x127a12){md5Accounts[_0x56a107][_0x9965('0x3')]=_0x127a12;io[_0x9965('0x11')](_0x9965('0x18'),_0x19b29d);}};EmailChannel[_0x9965('0x10')][_0x9965('0x19')]=function(_0x387dba){for(var _0xd2e3d2 in _0x387dba){if(_0x387dba[_0x9965('0x1a')](_0xd2e3d2)){if(_0x387dba[_0xd2e3d2][_0x9965('0x13')]&&_0x387dba[_0xd2e3d2][_0x9965('0x1b')]){var _0x1026f2=_0x387dba[_0xd2e3d2][_0x9965('0x13')];if(!this[_0x9965('0xf')][_0x9965('0x1a')](_0x1026f2['id'])){this[_0x9965('0xf')][_0x1026f2['id']]=new EmailImap(_0x1026f2,_0x387dba[_0xd2e3d2][_0x9965('0x6')]);this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x1c'),this[_0x9965('0x1d')][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on']('email',this[_0x9965('0x1f')][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x20'),this['handleImapEnd'][_0x9965('0x1e')](this,_0xd2e3d2));this[_0x9965('0xf')][_0x1026f2['id']]['on'](_0x9965('0x21'),this[_0x9965('0x22')][_0x9965('0x1e')](this,_0xd2e3d2));}}else{if(_[_0x9965('0x16')](this['mailAccounts'][_0xd2e3d2][_0x9965('0x13')])){this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')]={};}this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')][_0x9965('0x23')]='disabled';this[_0x9965('0xe')][_0xd2e3d2][_0x9965('0x13')]['messageStatus']='';this[_0x9965('0x11')](_0xd2e3d2);}}}};EmailChannel[_0x9965('0x10')][_0x9965('0x1d')]=function(_0x426fd7,_0x66b4ba){if(this[_0x9965('0xe')][_0x426fd7]){this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')]['status']=_0x9965('0x24');this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')][_0x9965('0x14')]=_0x66b4ba[_0x9965('0x12')];if(_0x66b4ba['messages']){this[_0x9965('0xe')][_0x426fd7][_0x9965('0x13')][_0x9965('0x15')]=_0x66b4ba['messages'][_0x9965('0x15')];}return this[_0x9965('0x11')](_0x426fd7);}};EmailChannel[_0x9965('0x10')]['handleImapEmail']=function(_0x193897,_0x393219){logger[_0x9965('0xc')](_0x9965('0x25'),_0x393219[_0x9965('0x26')],_0x393219[_0x9965('0x27')],_0x393219['from'],_0x193897);if(this['mailAccounts'][_0x193897]){return mailAccount['notify'](_0x193897,_0x393219)['then'](function(_0x1a9796){if(_0x1a9796){logger[_0x9965('0xc')](_0x9965('0x28'));}})[_0x9965('0x29')](function(_0x256928){logger[_0x9965('0x21')](_0x9965('0x2a'),JSON[_0x9965('0x17')](_0x256928));});}};EmailChannel['prototype'][_0x9965('0x2b')]=function(_0x4e5699){if(this['mailAccounts'][_0x4e5699]&&this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]){if(this[_0x9965('0xf')][this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['id']]){delete this[_0x9965('0xf')][this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['id']];}this[_0x9965('0xe')][_0x4e5699][_0x9965('0x13')]['lastSync']=moment();this[_0x9965('0x11')](_0x4e5699);}};EmailChannel[_0x9965('0x10')]['handleImapError']=function(_0x12bdc6,_0x536d0b){if(this[_0x9965('0xe')][_0x12bdc6]){this[_0x9965('0xe')][_0x12bdc6][_0x9965('0x13')]['status']=_0x9965('0x21');this['mailAccounts'][_0x12bdc6][_0x9965('0x13')][_0x9965('0x14')]=_0x536d0b;return this['emit'](_0x12bdc6);}};EmailChannel[_0x9965('0x10')][_0x9965('0x2c')]=function(_0x222d12,_0xdb22b5){return this[_0x9965('0x2d')]['send'](_0x222d12,_0xdb22b5);};EmailChannel[_0x9965('0x10')][_0x9965('0x2e')]=function(_0x5d9d60){var _0x3351b6=this;if(this[_0x9965('0xe')][_0x5d9d60['id']]){if(_[_0x9965('0x16')](this[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')])){this[_0x9965('0xe')][_0x5d9d60['id']]['Smtp']={};}this[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')][_0x9965('0x30')]=moment();return new BPromise(function(_0x5a1a27,_0x530130){return _0x3351b6[_0x9965('0x2d')][_0x9965('0x31')](_0x5d9d60)['then'](function(_0x5338a9){_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']]['Smtp']['status']=_0x9965('0x32');_0x3351b6['mailAccounts'][_0x5d9d60['id']]['Smtp'][_0x9965('0x14')]='';_0x3351b6[_0x9965('0x11')](_0x5d9d60['id']);_0x5a1a27(_0x5338a9);})[_0x9965('0x29')](function(_0x45ec6b){_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')]['status']=_0x9965('0x21');_0x3351b6[_0x9965('0xe')][_0x5d9d60['id']][_0x9965('0x2f')][_0x9965('0x14')]=_0x45ec6b;_0x3351b6['emit'](_0x5d9d60['id']);_0x530130(_0x45ec6b);});});}return this[_0x9965('0x2d')][_0x9965('0x31')](_0x5d9d60);};module['exports']=EmailChannel; \ No newline at end of file +var _0xd783=['active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','verify','then','verified','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x59c73b,_0x4d4988){var _0x45906c=function(_0x26f326){while(--_0x26f326){_0x59c73b['push'](_0x59c73b['shift']());}};_0x45906c(++_0x4d4988);}(_0xd783,0xb8));var _0x3d78=function(_0x3e01c8,_0x30ec78){_0x3e01c8=_0x3e01c8-0x0;var _0x2a6804=_0xd783[_0x3e01c8];return _0x2a6804;};'use strict';var _=require('lodash');var moment=require(_0x3d78('0x0'));var BPromise=require(_0x3d78('0x1'));var md5=require(_0x3d78('0x2'));var Redis=require('ioredis');var config=require(_0x3d78('0x3'));var logger=require(_0x3d78('0x4'))(_0x3d78('0x5'));config[_0x3d78('0x6')]=_['defaults'](config[_0x3d78('0x6')],{'host':_0x3d78('0x7'),'port':0x18eb});var io=require(_0x3d78('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x3d78('0x9'));var EmailSmtp=require(_0x3d78('0xa'));var mailAccount=require(_0x3d78('0xb'));var md5Accounts={};function EmailChannel(_0x12e74e){logger[_0x3d78('0xc')](_0x3d78('0xd'));this[_0x3d78('0xe')]=_0x12e74e[_0x3d78('0xe')];this[_0x3d78('0xf')]={};this[_0x3d78('0x10')]=new EmailSmtp();}EmailChannel[_0x3d78('0x11')][_0x3d78('0x12')]=function(_0x57aa1d){var _0x4d62b2=this[_0x3d78('0xe')][_0x57aa1d];var _0x52aa68={'id':_0x4d62b2['id'],'name':_0x4d62b2[_0x3d78('0x13')],'key':_0x4d62b2['key'],'active':_0x4d62b2[_0x3d78('0x14')],'Imap':{'status':_0x4d62b2[_0x3d78('0x15')][_0x3d78('0x16')],'messageStatus':_0x4d62b2[_0x3d78('0x15')][_0x3d78('0x17')],'total':_0x4d62b2['Imap'][_0x3d78('0x18')]}};if(_['isNil'](md5Accounts[_0x57aa1d])){md5Accounts[_0x57aa1d]={};}var _0x1c3f84=md5(JSON[_0x3d78('0x19')](_0x52aa68));if(md5Accounts[_0x57aa1d][_0x3d78('0x2')]!==_0x1c3f84){md5Accounts[_0x57aa1d][_0x3d78('0x2')]=_0x1c3f84;io[_0x3d78('0x12')](_0x3d78('0x1a'),_0x52aa68);}};EmailChannel[_0x3d78('0x11')][_0x3d78('0x1b')]=function(_0x3f7fb5){for(var _0xe4874b in _0x3f7fb5){if(_0x3f7fb5[_0x3d78('0x1c')](_0xe4874b)){if(_0x3f7fb5[_0xe4874b][_0x3d78('0x15')]&&_0x3f7fb5[_0xe4874b][_0x3d78('0x14')]){var _0x3fb030=_0x3f7fb5[_0xe4874b][_0x3d78('0x15')];if(!this[_0x3d78('0xf')][_0x3d78('0x1c')](_0x3fb030['id'])){this[_0x3d78('0xf')][_0x3fb030['id']]=new EmailImap(_0x3fb030,_0x3f7fb5[_0xe4874b]['email']);this[_0x3d78('0xf')][_0x3fb030['id']]['on']('box',this['handleImapBox'][_0x3d78('0x1d')](this,_0xe4874b));this[_0x3d78('0xf')][_0x3fb030['id']]['on'](_0x3d78('0x5'),this[_0x3d78('0x1e')]['bind'](this,_0xe4874b));this['imapAccounts'][_0x3fb030['id']]['on'](_0x3d78('0x1f'),this[_0x3d78('0x20')][_0x3d78('0x1d')](this,_0xe4874b));this[_0x3d78('0xf')][_0x3fb030['id']]['on'](_0x3d78('0x21'),this[_0x3d78('0x22')][_0x3d78('0x1d')](this,_0xe4874b));}}else{if(_[_0x3d78('0x23')](this[_0x3d78('0xe')][_0xe4874b][_0x3d78('0x15')])){this['mailAccounts'][_0xe4874b][_0x3d78('0x15')]={};}this['mailAccounts'][_0xe4874b]['Imap']['status']='disabled';this['mailAccounts'][_0xe4874b][_0x3d78('0x15')][_0x3d78('0x17')]='';this['emit'](_0xe4874b);}}}};EmailChannel[_0x3d78('0x11')]['handleImapBox']=function(_0x4520cf,_0x1dc5f6){if(this[_0x3d78('0xe')][_0x4520cf]){this[_0x3d78('0xe')][_0x4520cf][_0x3d78('0x15')][_0x3d78('0x16')]=_0x3d78('0x24');this[_0x3d78('0xe')][_0x4520cf][_0x3d78('0x15')]['messageStatus']=_0x1dc5f6[_0x3d78('0x13')];if(_0x1dc5f6[_0x3d78('0x25')]){this[_0x3d78('0xe')][_0x4520cf]['Imap'][_0x3d78('0x18')]=_0x1dc5f6[_0x3d78('0x25')][_0x3d78('0x18')];}return this[_0x3d78('0x12')](_0x4520cf);}};EmailChannel['prototype'][_0x3d78('0x1e')]=function(_0x49c863,_0x440342){logger[_0x3d78('0xc')](_0x3d78('0x26'),_0x440342[_0x3d78('0x27')],_0x440342[_0x3d78('0x28')],_0x440342[_0x3d78('0x29')],_0x49c863);if(this[_0x3d78('0xe')][_0x49c863]){return mailAccount['notify'](_0x49c863,_0x440342)['then'](function(_0x234b98){if(_0x234b98){logger[_0x3d78('0xc')](_0x3d78('0x2a'));}})[_0x3d78('0x2b')](function(_0x5adac1){logger[_0x3d78('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x3d78('0x19')](_0x5adac1));});}};EmailChannel['prototype'][_0x3d78('0x20')]=function(_0x109ce8){if(this[_0x3d78('0xe')][_0x109ce8]&&this['mailAccounts'][_0x109ce8][_0x3d78('0x15')]){if(this[_0x3d78('0xf')][this[_0x3d78('0xe')][_0x109ce8][_0x3d78('0x15')]['id']]){delete this['imapAccounts'][this[_0x3d78('0xe')][_0x109ce8][_0x3d78('0x15')]['id']];}this['mailAccounts'][_0x109ce8][_0x3d78('0x15')][_0x3d78('0x2c')]=moment();this[_0x3d78('0x12')](_0x109ce8);}};EmailChannel['prototype']['handleImapError']=function(_0x1972d6,_0x507882){if(this[_0x3d78('0xe')][_0x1972d6]){this['mailAccounts'][_0x1972d6]['Imap']['status']=_0x3d78('0x21');this[_0x3d78('0xe')][_0x1972d6][_0x3d78('0x15')][_0x3d78('0x17')]=_0x507882;return this['emit'](_0x1972d6);}};EmailChannel[_0x3d78('0x11')]['sendMail']=function(_0xb76497,_0x5eccca){return this[_0x3d78('0x10')][_0x3d78('0x2d')](_0xb76497,_0x5eccca);};EmailChannel[_0x3d78('0x11')][_0x3d78('0x2e')]=function(_0x7603d4){var _0x5bcc9f=this;if(this[_0x3d78('0xe')][_0x7603d4['id']]){if(_['isNil'](this[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'])){this[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')]={};}this[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'][_0x3d78('0x2c')]=moment();return new BPromise(function(_0xf3396f,_0x52c760){return _0x5bcc9f[_0x3d78('0x10')][_0x3d78('0x30')](_0x7603d4)[_0x3d78('0x31')](function(_0x5f0989){_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x16')]=_0x3d78('0x32');_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x17')]='';_0x5bcc9f['emit'](_0x7603d4['id']);_0xf3396f(_0x5f0989);})[_0x3d78('0x2b')](function(_0x14828f){_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x16')]=_0x3d78('0x21');_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'][_0x3d78('0x17')]=_0x14828f;_0x5bcc9f[_0x3d78('0x12')](_0x7603d4['id']);_0x52c760(_0x14828f);});});}return this['smtp'][_0x3d78('0x30')](_0x7603d4);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ddf9a4e..ebc8a15 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 _0xcca4=['connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','handleError','end','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','handleEnd','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','error','inherits','prototype'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xcca4,0x11c));var _0x4cca=function(_0x15db2c,_0x2929ae){_0x15db2c=_0x15db2c-0x0;var _0xc19a4d=_0xcca4[_0x15db2c];return _0xc19a4d;};'use strict';var fs=require('fs');var path=require(_0x4cca('0x0'));var util=require(_0x4cca('0x1'));var Imap=require(_0x4cca('0x2'));var _=require(_0x4cca('0x3'));var rs=require('randomstring');var simpleParser=require(_0x4cca('0x4'))[_0x4cca('0x5')];var Iconv=require('iconv')[_0x4cca('0x6')];var EventEmitter=require('events')[_0x4cca('0x7')];var utils=require(_0x4cca('0x8'));var logger=require(_0x4cca('0x9'))(_0x4cca('0xa'));function EmailImap(_0x5bbb66,_0x2d07a2){this[_0x4cca('0xb')]='INBOX';this[_0x4cca('0xc')]=this[_0x4cca('0xd')](_0x5bbb66,_0x2d07a2);this[_0x4cca('0x2')]=new Imap(this[_0x4cca('0xc')]);this[_0x4cca('0x2')][_0x4cca('0xe')](_0x4cca('0xf'),this[_0x4cca('0x10')][_0x4cca('0x11')](this));this[_0x4cca('0x2')][_0x4cca('0xe')]('end',this['handleEnd']['bind'](this));this[_0x4cca('0x2')]['on'](_0x4cca('0x12'),this['handleError'][_0x4cca('0x11')](this));this['imap']['connect']();}util[_0x4cca('0x13')](EmailImap,EventEmitter);EmailImap[_0x4cca('0x14')][_0x4cca('0xd')]=function(_0x218d37,_0x4f8f4d){var _0x437c15={'connTimeout':_0x218d37[_0x4cca('0x15')]?_0x218d37[_0x4cca('0x15')]*0x3e8:0x2710,'authTimeout':_0x218d37[_0x4cca('0x16')]?_0x218d37[_0x4cca('0x16')]*0x3e8:0x1388};if(_[_0x4cca('0x17')](_0x218d37[_0x4cca('0x18')])){if(_0x218d37['authentication']){_0x437c15['user']=_0x218d37[_0x4cca('0x19')];_0x437c15['password']=_0x218d37[_0x4cca('0x1a')];}_0x437c15[_0x4cca('0x1b')]=_0x218d37['host'];_0x437c15[_0x4cca('0x1c')]=_0x218d37[_0x4cca('0x1c')]||0x3e1;if(_0x218d37[_0x4cca('0x1d')]){_0x437c15['tls']=!![];}else{_0x437c15[_0x4cca('0x1d')]=![];_0x437c15[_0x4cca('0x1e')]=_0x4cca('0x1f');}}else{_0x437c15['user']=_0x218d37[_0x4cca('0x19')];_0x437c15[_0x4cca('0x1a')]=_0x218d37[_0x4cca('0x1a')];_0x437c15[_0x4cca('0x1b')]=utils[_0x4cca('0x20')](_0x218d37[_0x4cca('0x18')]);_0x437c15[_0x4cca('0x1c')]=0x3e1;_0x437c15[_0x4cca('0x1d')]=!![];}_0x437c15['email']=_0x4f8f4d||_0x218d37[_0x4cca('0x19')]||_0x4cca('0x21');return _0x437c15;};EmailImap['prototype'][_0x4cca('0x10')]=function(){this[_0x4cca('0x2')][_0x4cca('0x22')](this[_0x4cca('0xb')],![],this[_0x4cca('0x23')]['bind'](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x23')]=function(_0x147ade,_0x3afc63){if(_0x147ade){this['handleError'](_0x147ade,!![]);}else{this[_0x4cca('0x24')](_0x4cca('0x25'),_0x3afc63);this['readUnseen']();}};EmailImap[_0x4cca('0x14')][_0x4cca('0x26')]=function(_0x285cdb){if(_0x285cdb){this[_0x4cca('0x27')](_0x285cdb,!![]);}else{this[_0x4cca('0x2')][_0x4cca('0x28')]();}};EmailImap[_0x4cca('0x14')]['readUnseen']=function(){this['imap'][_0x4cca('0x29')](['UNSEEN'],this['handleReadUnseen'][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x2a')]=function(_0x2aaa7c,_0x101510){if(_0x2aaa7c){this[_0x4cca('0x27')](_0x2aaa7c,!![]);}else{if(_0x101510['length']){try{var _0x1f7d4a=this[_0x4cca('0x2')][_0x4cca('0x2b')](_0x101510,{'bodies':'','markSeen':!![]});_0x1f7d4a['on'](_0x4cca('0x2c'),this[_0x4cca('0x2d')][_0x4cca('0x11')](this));_0x1f7d4a[_0x4cca('0xe')](_0x4cca('0x12'),this[_0x4cca('0x2e')][_0x4cca('0x11')](this));_0x1f7d4a[_0x4cca('0xe')](_0x4cca('0x28'),this['handleFetchEnd'][_0x4cca('0x11')](this));}catch(_0x1eeeb1){logger['error'](_0x1eeeb1);}}else{this['imap'][_0x4cca('0x2f')](!![],this[_0x4cca('0x26')][_0x4cca('0x11')](this));}}};EmailImap[_0x4cca('0x14')][_0x4cca('0x2d')]=function(_0x5b1462,_0x57daa4){_0x5b1462['on'](_0x4cca('0x30'),this[_0x4cca('0x31')][_0x4cca('0x11')](this));_0x5b1462[_0x4cca('0xe')](_0x4cca('0x32'),this[_0x4cca('0x33')][_0x4cca('0x11')](this));_0x5b1462[_0x4cca('0xe')]('end',this['handleMessageEnd'][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')]['handleMessageBody']=function(_0x22a633,_0x22b9ea){simpleParser(_0x22a633,{'Iconv':Iconv},this[_0x4cca('0x34')][_0x4cca('0x11')](this));};EmailImap[_0x4cca('0x14')][_0x4cca('0x33')]=function(_0x9b6f88){};EmailImap[_0x4cca('0x14')][_0x4cca('0x35')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x49f899,_0x104b4b){if(_0x49f899){logger[_0x4cca('0x12')](_0x49f899);}else{var _0x2a3d0c=this;utils[_0x4cca('0x36')](this[_0x4cca('0xc')],_0x104b4b,function(_0xcaeaa6){_0x2a3d0c[_0x4cca('0x24')](_0x4cca('0xa'),_0xcaeaa6);});}};EmailImap[_0x4cca('0x14')][_0x4cca('0x37')]=function(){this[_0x4cca('0x2')]['closeBox'](!![],this[_0x4cca('0x26')][_0x4cca('0x11')](this));};EmailImap['prototype'][_0x4cca('0x2e')]=function(_0x4d85ee){this[_0x4cca('0x27')](_0x4d85ee);this[_0x4cca('0x2')]['closeBox'](!![],this[_0x4cca('0x26')]['bind'](this));};EmailImap['prototype'][_0x4cca('0x38')]=function(){this[_0x4cca('0x24')]('end');};EmailImap[_0x4cca('0x14')]['handleError']=function(_0x28b84b,_0x3b0402){logger['error'](_0x4cca('0x27'),this[_0x4cca('0xc')][_0x4cca('0xa')],JSON['stringify'](_0x28b84b));var _0xb3d21e='';if(_0x28b84b){if(_0x28b84b[_0x4cca('0x39')]){_0xb3d21e=_0x28b84b[_0x4cca('0x39')];}else{for(var _0x498664 in _0x28b84b){if(_0x28b84b[_0x4cca('0x3a')](_0x498664)){_0xb3d21e+=_[_0x4cca('0x3b')](_0x498664)+':\x20'+_0x28b84b[_0x498664]+'\x0a';}}}}if(_0x3b0402){this[_0x4cca('0x2')]['end']();}else{this[_0x4cca('0x24')](_0x4cca('0x12'),_0xb3d21e);this['emit'](_0x4cca('0x28'));}};module[_0x4cca('0x3c')]=EmailImap; \ No newline at end of file +var _0x25b6=['emit','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','closeBox','handleFetchError','textCode','upperFirst','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','password','host','port','tls','autotls','required','user','getHost','service','prototype','openBox','handleOpenBox'];(function(_0x4ad743,_0x3efe65){var _0x32e948=function(_0x51b2e6){while(--_0x51b2e6){_0x4ad743['push'](_0x4ad743['shift']());}};_0x32e948(++_0x3efe65);}(_0x25b6,0xc8));var _0x625b=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0x25b6[_0x1138c4];return _0x200cc1;};'use strict';var fs=require('fs');var path=require(_0x625b('0x0'));var util=require(_0x625b('0x1'));var Imap=require(_0x625b('0x2'));var _=require(_0x625b('0x3'));var rs=require(_0x625b('0x4'));var simpleParser=require('mailparser')[_0x625b('0x5')];var Iconv=require(_0x625b('0x6'))[_0x625b('0x7')];var EventEmitter=require(_0x625b('0x8'))[_0x625b('0x9')];var utils=require(_0x625b('0xa'));var logger=require('../../../config/logger')(_0x625b('0xb'));function EmailImap(_0x22f758,_0x2f476b){this[_0x625b('0xc')]=_0x625b('0xd');this[_0x625b('0xe')]=this[_0x625b('0xf')](_0x22f758,_0x2f476b);this[_0x625b('0x2')]=new Imap(this[_0x625b('0xe')]);this['imap'][_0x625b('0x10')]('ready',this[_0x625b('0x11')]['bind'](this));this[_0x625b('0x2')][_0x625b('0x10')](_0x625b('0x12'),this[_0x625b('0x13')][_0x625b('0x14')](this));this['imap']['on'](_0x625b('0x15'),this[_0x625b('0x16')]['bind'](this));this[_0x625b('0x2')][_0x625b('0x17')]();}util[_0x625b('0x18')](EmailImap,EventEmitter);EmailImap['prototype'][_0x625b('0xf')]=function(_0x4b6b55,_0x5ef90c){var _0x588a9c={'connTimeout':_0x4b6b55[_0x625b('0x19')]?_0x4b6b55[_0x625b('0x19')]*0x3e8:0x2710,'authTimeout':_0x4b6b55[_0x625b('0x1a')]?_0x4b6b55[_0x625b('0x1a')]*0x3e8:0x1388};if(_[_0x625b('0x1b')](_0x4b6b55['service'])){if(_0x4b6b55['authentication']){_0x588a9c['user']=_0x4b6b55['user'];_0x588a9c[_0x625b('0x1c')]=_0x4b6b55['password'];}_0x588a9c[_0x625b('0x1d')]=_0x4b6b55[_0x625b('0x1d')];_0x588a9c[_0x625b('0x1e')]=_0x4b6b55['port']||0x3e1;if(_0x4b6b55['tls']){_0x588a9c[_0x625b('0x1f')]=!![];}else{_0x588a9c['tls']=![];_0x588a9c[_0x625b('0x20')]=_0x625b('0x21');}}else{_0x588a9c[_0x625b('0x22')]=_0x4b6b55[_0x625b('0x22')];_0x588a9c[_0x625b('0x1c')]=_0x4b6b55[_0x625b('0x1c')];_0x588a9c[_0x625b('0x1d')]=utils[_0x625b('0x23')](_0x4b6b55[_0x625b('0x24')]);_0x588a9c[_0x625b('0x1e')]=0x3e1;_0x588a9c['tls']=!![];}_0x588a9c[_0x625b('0xb')]=_0x5ef90c||_0x4b6b55['user']||'anonymous@xcally.com';return _0x588a9c;};EmailImap[_0x625b('0x25')][_0x625b('0x11')]=function(){this[_0x625b('0x2')][_0x625b('0x26')](this[_0x625b('0xc')],![],this[_0x625b('0x27')][_0x625b('0x14')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x1aaf5a,_0x48231f){if(_0x1aaf5a){this[_0x625b('0x16')](_0x1aaf5a,!![]);}else{this[_0x625b('0x28')]('box',_0x48231f);this[_0x625b('0x29')]();}};EmailImap[_0x625b('0x25')][_0x625b('0x2a')]=function(_0x4a38e3){if(_0x4a38e3){this[_0x625b('0x16')](_0x4a38e3,!![]);}else{this[_0x625b('0x2')][_0x625b('0x12')]();}};EmailImap[_0x625b('0x25')][_0x625b('0x29')]=function(){this['imap'][_0x625b('0x2b')]([_0x625b('0x2c')],this['handleReadUnseen'][_0x625b('0x14')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4cf200,_0x3b49c8){if(_0x4cf200){this['handleError'](_0x4cf200,!![]);}else{if(_0x3b49c8[_0x625b('0x2d')]){try{var _0x2245db=this[_0x625b('0x2')][_0x625b('0x2e')](_0x3b49c8,{'bodies':'','markSeen':!![]});_0x2245db['on']('message',this[_0x625b('0x2f')][_0x625b('0x14')](this));_0x2245db['once'](_0x625b('0x15'),this['handleFetchError'][_0x625b('0x14')](this));_0x2245db[_0x625b('0x10')]('end',this[_0x625b('0x30')][_0x625b('0x14')](this));}catch(_0x19234a){logger[_0x625b('0x15')](_0x19234a);}}else{this[_0x625b('0x2')]['closeBox'](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));}}};EmailImap[_0x625b('0x25')][_0x625b('0x2f')]=function(_0x578e95,_0x104004){_0x578e95['on'](_0x625b('0x31'),this[_0x625b('0x32')][_0x625b('0x14')](this));_0x578e95[_0x625b('0x10')](_0x625b('0x33'),this[_0x625b('0x34')][_0x625b('0x14')](this));_0x578e95[_0x625b('0x10')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x625b('0x25')][_0x625b('0x32')]=function(_0x3d8e68,_0x2ab408){simpleParser(_0x3d8e68,{'Iconv':Iconv},this[_0x625b('0x35')][_0x625b('0x14')](this));};EmailImap['prototype'][_0x625b('0x34')]=function(_0x1c307b){};EmailImap['prototype'][_0x625b('0x36')]=function(){};EmailImap['prototype'][_0x625b('0x35')]=function(_0x2a1f2a,_0x40b55b){if(_0x2a1f2a){logger[_0x625b('0x15')](_0x2a1f2a);}else{var _0x2f29ff=this;utils[_0x625b('0x37')](this[_0x625b('0xe')],_0x40b55b,function(_0x33c513){_0x2f29ff['emit'](_0x625b('0xb'),_0x33c513);});}};EmailImap[_0x625b('0x25')][_0x625b('0x30')]=function(){this[_0x625b('0x2')][_0x625b('0x38')](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));};EmailImap[_0x625b('0x25')][_0x625b('0x39')]=function(_0x3992aa){this[_0x625b('0x16')](_0x3992aa);this[_0x625b('0x2')][_0x625b('0x38')](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));};EmailImap[_0x625b('0x25')]['handleEnd']=function(){this[_0x625b('0x28')]('end');};EmailImap[_0x625b('0x25')]['handleError']=function(_0x545331,_0x58e941){logger[_0x625b('0x15')](_0x625b('0x16'),this[_0x625b('0xe')][_0x625b('0xb')],JSON['stringify'](_0x545331));var _0x3e6932='';if(_0x545331){if(_0x545331[_0x625b('0x3a')]){_0x3e6932=_0x545331[_0x625b('0x3a')];}else{for(var _0x360871 in _0x545331){if(_0x545331['hasOwnProperty'](_0x360871)){_0x3e6932+=_[_0x625b('0x3b')](_0x360871)+':\x20'+_0x545331[_0x360871]+'\x0a';}}}}if(_0x58e941){this[_0x625b('0x2')][_0x625b('0x12')]();}else{this['emit']('error',_0x3e6932);this[_0x625b('0x28')](_0x625b('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f62749d..b56b114 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 _0x1993=['sendMail','toString','verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1993,0x10d));var _0x3199=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1993[_0x5ddb1c];return _0x354adc;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x3199('0x0'));var inlineBase64=require(_0x3199('0x1'));function EmailSmtp(){}EmailSmtp[_0x3199('0x2')][_0x3199('0x3')]=function(_0x4aca2a,_0x3235d2){return new BPromise(function(_0x2b8fe5,_0x3e9a76){var _0xd923d5=nodemailer[_0x3199('0x4')](_0x4aca2a);_0xd923d5[_0x3199('0x5')](_0x3199('0x6'),inlineBase64());_0xd923d5[_0x3199('0x7')](_0x3235d2,function(_0x103013,_0x34a27a){if(_0x103013){_0x3e9a76(_0x103013[_0x3199('0x8')]());}else{_0x2b8fe5(_0x34a27a);}});});};EmailSmtp[_0x3199('0x2')]['verify']=function(_0x29f6e3){return new BPromise(function(_0x2791a5,_0x1b55b0){var _0x55d441=nodemailer[_0x3199('0x4')](_0x29f6e3);_0x55d441[_0x3199('0x9')](function(_0x215cfd,_0x526a2e){if(_0x215cfd){_0x1b55b0(_0x215cfd['toString']());}else{if(_0x526a2e){_0x2791a5(_0x526a2e);}else{_0x1b55b0(_0x3199('0xa'));}}});});};module[_0x3199('0xb')]=EmailSmtp; \ No newline at end of file +var _0x098e=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString'];(function(_0x240d1c,_0xb0c3d7){var _0x42a5ba=function(_0x4efbfe){while(--_0x4efbfe){_0x240d1c['push'](_0x240d1c['shift']());}};_0x42a5ba(++_0xb0c3d7);}(_0x098e,0x137));var _0xe098=function(_0x15224a,_0x272911){_0x15224a=_0x15224a-0x0;var _0x533a9f=_0x098e[_0x15224a];return _0x533a9f;};'use strict';var nodemailer=require(_0xe098('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xe098('0x1'));function EmailSmtp(){}EmailSmtp[_0xe098('0x2')][_0xe098('0x3')]=function(_0x768922,_0x56d831){return new BPromise(function(_0x471d0f,_0x3d3d4a){var _0x143793=nodemailer[_0xe098('0x4')](_0x768922);_0x143793[_0xe098('0x5')](_0xe098('0x6'),inlineBase64());_0x143793['sendMail'](_0x56d831,function(_0x2da5d6,_0x429037){if(_0x2da5d6){_0x3d3d4a(_0x2da5d6[_0xe098('0x7')]());}else{_0x471d0f(_0x429037);}});});};EmailSmtp['prototype'][_0xe098('0x8')]=function(_0x181910){return new BPromise(function(_0x14a50f,_0x1136b8){var _0x50e07e=nodemailer['createTransport'](_0x181910);_0x50e07e[_0xe098('0x8')](function(_0x423779,_0x3f5edb){if(_0x423779){_0x1136b8(_0x423779[_0xe098('0x7')]());}else{if(_0x3f5edb){_0x14a50f(_0x3f5edb);}else{_0x1136b8(_0xe098('0x9'));}}});});};module[_0xe098('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 73f312b..e26ea33 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 _0xdea0=['date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','split','slice','join','name','Anonymous','length','isEmpty','@xcally.com','html','test','replace','body','textAsHtml','0x1?_0x55136b['pop']():'';}return'';}function getMails(_0x5152a3,_0x24304c){var _0xee670d='';for(var _0x459d25=0x0;_0x459d25<_0x24304c[_0x0dea('0x9')][_0x0dea('0x12')];_0x459d25+=0x1){if(_0x24304c['value'][_0x459d25][_0x0dea('0xa')]!==_0x5152a3){if(!_[_0x0dea('0x13')](_0xee670d)){_0xee670d+=',';}_0xee670d+=_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0x10')]||_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]||'';_0xee670d+='\x20<';_0xee670d+=_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]?_0x24304c[_0x0dea('0x9')][_0x459d25][_0x0dea('0xa')]:_0x0dea('0xb')+random['generate'](0x6)+_0x0dea('0x14');_0xee670d+='>';}}return _0xee670d;}function parseEmail(_0x26d8ae,_0x4b7897,_0x4e33c0){if(_0x4b7897[_0x0dea('0x15')]){var _0x67f152=/)<[^<]*)*<\/script>/gi;while(_0x67f152[_0x0dea('0x16')](_0x4b7897[_0x0dea('0x15')])){_0x4b7897[_0x0dea('0x15')]=_0x4b7897[_0x0dea('0x15')][_0x0dea('0x17')](_0x67f152,'');}_0x4e33c0[_0x0dea('0x18')]=_0x4b7897[_0x0dea('0x15')];}else{_0x4e33c0['body']=_0x4b7897[_0x0dea('0x19')];}if(_0x4e33c0[_0x0dea('0x18')]){_0x4e33c0['body']=_0x4e33c0[_0x0dea('0x18')]['replace'](/Empty\x20message

','Attachments','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','moment','randomstring','path','node-tnef','email','../../../config/environment','head'];(function(_0x3c3f4f,_0x55d53e){var _0x28b0d5=function(_0x279e46){while(--_0x279e46){_0x3c3f4f['push'](_0x3c3f4f['shift']());}};_0x28b0d5(++_0x55d53e);}(_0xbeb9,0x1d9));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x9beb('0x0'));var random=require(_0x9beb('0x1'));var fs=require('fs');var path=require(_0x9beb('0x2'));var util=require('util');var tnef=require(_0x9beb('0x3'));var logger=require('../../../config/logger')(_0x9beb('0x4'));var config=require(_0x9beb('0x5'));function getAddress(_0xaccf68){var _0x9bda47=_[_0x9beb('0x6')](_0xaccf68[_0x9beb('0x7')]);return _0x9bda47&&_0x9bda47[_0x9beb('0x8')]?_0x9bda47[_0x9beb('0x8')]:_0x9beb('0x9')+random[_0x9beb('0xa')](0x6)+_0x9beb('0xb');}function getFirstName(_0x1bcbc5){var _0x172a9a=_[_0x9beb('0x6')](_0x1bcbc5[_0x9beb('0x7')]);if(_0x172a9a&&_0x172a9a[_0x9beb('0xc')]){var _0x4006a4=_0x172a9a[_0x9beb('0xc')][_0x9beb('0xd')](/\s+/);return _0x4006a4['length']?_0x4006a4[_0x9beb('0xe')](0x0,-0x1)['join']('\x20'):_0x172a9a[_0x9beb('0xc')];}return _0x9beb('0xf');}function getLastName(_0x1df953){var _0x59e270=_[_0x9beb('0x6')](_0x1df953[_0x9beb('0x7')]);if(_0x59e270&&_0x59e270[_0x9beb('0xc')]){var _0x972f89=_0x59e270['name'][_0x9beb('0xd')](/\s+/);return _0x972f89['length']>0x1?_0x972f89[_0x9beb('0x10')]():'';}return'';}function getMails(_0x47793a,_0x3f5edb){var _0x4d9ef8='';for(var _0x2ebb8f=0x0;_0x2ebb8f<_0x3f5edb[_0x9beb('0x7')][_0x9beb('0x11')];_0x2ebb8f+=0x1){if(_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]!==_0x47793a){if(!_[_0x9beb('0x12')](_0x4d9ef8)){_0x4d9ef8+=',';}_0x4d9ef8+=_0x3f5edb['value'][_0x2ebb8f]['name']||_0x3f5edb['value'][_0x2ebb8f][_0x9beb('0x8')]||'';_0x4d9ef8+='\x20<';_0x4d9ef8+=_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]?_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]:'anonymous'+random[_0x9beb('0xa')](0x6)+_0x9beb('0xb');_0x4d9ef8+='>';}}return _0x4d9ef8;}function parseEmail(_0x5d4f18,_0x11edb5,_0xddc7cf){if(_0x11edb5[_0x9beb('0x13')]){var _0x45de07=/)<[^<]*)*<\/script>/gi;while(_0x45de07['test'](_0x11edb5[_0x9beb('0x13')])){_0x11edb5[_0x9beb('0x13')]=_0x11edb5[_0x9beb('0x13')][_0x9beb('0x14')](_0x45de07,'');}_0xddc7cf[_0x9beb('0x15')]=_0x11edb5['html'];}else{_0xddc7cf[_0x9beb('0x15')]=_0x11edb5[_0x9beb('0x16')];}if(_0xddc7cf['body']){_0xddc7cf[_0x9beb('0x15')]=_0xddc7cf[_0x9beb('0x15')][_0x9beb('0x14')](/0x0){if(this[_0x49c2bc+_0xc980('0x2a')]>0x0&&this[_0x49c2bc+_0xc980('0x29')]>=this[_0x49c2bc+_0xc980('0x2a')]){return'maxcapacity';}else{return'working';}}else{return _0xc980('0x2b');}};Agent[_0xc980('0x27')][_0xc980('0x2c')]=function(){var _0x3368a2=[_0xc980('0x2d'),_0xc980('0x2e'),'openchannel',_0xc980('0x2f'),_0xc980('0x30'),_0xc980('0x31')];for(var _0x2f4fd5=0x0;_0x2f4fd5<_0x3368a2[_0xc980('0x32')];_0x2f4fd5+=0x1){var _0x384373=this[_0xc980('0x28')](_0x3368a2[_0x2f4fd5]);if(this[_0x3368a2[_0x2f4fd5]+_0xc980('0x33')]!==_0x384373){this[_0x3368a2[_0x2f4fd5]+_0xc980('0x34')]=_[_0xc980('0x35')](moment()[_0xc980('0x36')]('x'));}this[_0x3368a2[_0x2f4fd5]+_0xc980('0x33')]=_0x384373;}var _0x177ef6={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xc980('0xb')],'chatPause':this[_0xc980('0xc')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xc980('0xf')],'chatStatus':this[_0xc980('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc980('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc980('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc980('0x17')],'mailCurrentCapacity':this[_0xc980('0x18')],'faxStatus':this[_0xc980('0x19')],'faxStatusTime':this[_0xc980('0x1a')],'faxCapacity':this[_0xc980('0x1b')],'faxCurrentCapacity':this[_0xc980('0x37')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc980('0x1c')],'smsCurrentCapacity':this[_0xc980('0x1d')],'whatsappStatus':this[_0xc980('0x1e')],'whatsappStatusTime':this[_0xc980('0x1f')],'whatsappCapacity':this[_0xc980('0x20')],'whatsappCurrentCapacity':this[_0xc980('0x21')],'openchannelStatus':this[_0xc980('0x22')],'openchannelStatusTime':this[_0xc980('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc980('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x20b896=md5(JSON[_0xc980('0x39')](_0x177ef6));if(this[_0xc980('0x2')]!==_0x20b896){this[_0xc980('0x2')]=_0x20b896;io[_0xc980('0x3a')](_0xc980('0x3b'),_0x177ef6);}};module['exports']=Agent; \ No newline at end of file +var _0x486e=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','format','mailStatus','faxStatusTime','smsStatusTime','smsCurrentCapacity','openchannelCurrentCapacity','stringify','user:save','exports','lodash','moment'];(function(_0x18d6cc,_0x1cb4ec){var _0x4dccfe=function(_0x20cbea){while(--_0x20cbea){_0x18d6cc['push'](_0x18d6cc['shift']());}};_0x4dccfe(++_0x1cb4ec);}(_0x486e,0xb2));var _0xe486=function(_0x29ad05,_0x4c11c7){_0x29ad05=_0x29ad05-0x0;var _0x149805=_0x486e[_0x29ad05];return _0x149805;};'use strict';var _=require(_0xe486('0x0'));var moment=require(_0xe486('0x1'));var md5=require('md5');var Redis=require(_0xe486('0x2'));var config=require(_0xe486('0x3'));config[_0xe486('0x4')]=_[_0xe486('0x5')](config[_0xe486('0x4')],{'host':_0xe486('0x6'),'port':0x18eb});var io=require(_0xe486('0x7'))(new Redis(config[_0xe486('0x4')]));function Agent(_0x37910f){this['id']=_0x37910f['id']||0x0;this[_0xe486('0x8')]=_0x37910f[_0xe486('0x8')]||'';this['online']=_0x37910f[_0xe486('0x9')]||!![];this[_0xe486('0xa')]=_0x37910f[_0xe486('0xa')]||![];this[_0xe486('0xb')]=_0x37910f[_0xe486('0xb')]||![];this[_0xe486('0xc')]=_0x37910f[_0xe486('0xc')]||![];this[_0xe486('0xd')]=_0x37910f['faxPause']||![];this['smsPause']=_0x37910f[_0xe486('0xe')]||![];this[_0xe486('0xf')]=_0x37910f[_0xe486('0xf')]||![];this[_0xe486('0x10')]=_0xe486('0x11');this[_0xe486('0x12')]=0x0;this[_0xe486('0x13')]=_0x37910f[_0xe486('0x13')]||0x0;this[_0xe486('0x14')]=0x0;this['mailStatus']='unknown';this[_0xe486('0x15')]=0x0;this[_0xe486('0x16')]=_0x37910f[_0xe486('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xe486('0x11');this['faxStatusTime']=0x0;this[_0xe486('0x17')]=_0x37910f[_0xe486('0x17')]||0x0;this[_0xe486('0x18')]=0x0;this[_0xe486('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0xe486('0x1a')]=_0x37910f[_0xe486('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xe486('0x1b')]='unknown';this[_0xe486('0x1c')]=0x0;this[_0xe486('0x1d')]=_0x37910f['whatsappCapacity']||0x0;this[_0xe486('0x1e')]=0x0;this[_0xe486('0x1f')]='unknown';this[_0xe486('0x20')]=0x0;this[_0xe486('0x21')]=_0x37910f[_0xe486('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xe486('0x22')]=![];this[_0xe486('0x23')]=undefined;this[_0xe486('0x24')]='';this[_0xe486('0x25')]();}Agent[_0xe486('0x26')][_0xe486('0x27')]=function(_0x424aa8){if(this[_0x424aa8+_0xe486('0x28')]>0x0){if(this[_0x424aa8+'Capacity']>0x0&&this[_0x424aa8+_0xe486('0x28')]>=this[_0x424aa8+'Capacity']){return _0xe486('0x29');}else{return'working';}}else{return _0xe486('0x2a');}};Agent['prototype'][_0xe486('0x25')]=function(){var _0x1f48c7=[_0xe486('0x2b'),_0xe486('0x2c'),'openchannel',_0xe486('0x2d'),_0xe486('0x2e'),_0xe486('0x2f')];for(var _0x2a92b7=0x0;_0x2a92b7<_0x1f48c7[_0xe486('0x30')];_0x2a92b7+=0x1){var _0x6cf927=this['getChannelStatus'](_0x1f48c7[_0x2a92b7]);if(this[_0x1f48c7[_0x2a92b7]+_0xe486('0x31')]!==_0x6cf927){this[_0x1f48c7[_0x2a92b7]+_0xe486('0x32')]=_['toNumber'](moment()[_0xe486('0x33')]('x'));}this[_0x1f48c7[_0x2a92b7]+'Status']=_0x6cf927;}var _0x48ab9f={'id':this['id'],'name':this['name'],'online':this[_0xe486('0x9')],'voicePause':this[_0xe486('0xa')],'chatPause':this[_0xe486('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xe486('0xe')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xe486('0x10')],'chatStatusTime':this[_0xe486('0x12')],'chatCapacity':this[_0xe486('0x13')],'chatCurrentCapacity':this[_0xe486('0x14')],'mailStatus':this[_0xe486('0x34')],'mailStatusTime':this[_0xe486('0x15')],'mailCapacity':this[_0xe486('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xe486('0x35')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe486('0x18')],'smsStatus':this[_0xe486('0x19')],'smsStatusTime':this[_0xe486('0x36')],'smsCapacity':this[_0xe486('0x1a')],'smsCurrentCapacity':this[_0xe486('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xe486('0x1c')],'whatsappCapacity':this[_0xe486('0x1d')],'whatsappCurrentCapacity':this[_0xe486('0x1e')],'openchannelStatus':this[_0xe486('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xe486('0x21')],'openchannelCurrentCapacity':this[_0xe486('0x38')],'busy':this[_0xe486('0x22')],'busyQueue':this['busyQueue']};var _0x19779f=md5(JSON[_0xe486('0x39')](_0x48ab9f));if(this[_0xe486('0x24')]!==_0x19779f){this[_0xe486('0x24')]=_0x19779f;io['emit'](_0xe486('0x3a'),_0x48ab9f);}};module[_0xe486('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 46bf3b1..f50bd83 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 _0x1b05=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','md5','util','ioredis','redis','localhost','name','timeout'];(function(_0x2ad08e,_0xf49111){var _0xc1b283=function(_0xcd90cf){while(--_0xcd90cf){_0x2ad08e['push'](_0x2ad08e['shift']());}};_0xc1b283(++_0xf49111);}(_0x1b05,0x107));var _0x51b0=function(_0x1a063d,_0x4a5e4e){_0x1a063d=_0x1a063d-0x0;var _0x47ad56=_0x1b05[_0x1a063d];return _0x47ad56;};'use strict';var _=require('lodash');var md5=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var Redis=require(_0x51b0('0x2'));var config=require('../../../config/environment');config[_0x51b0('0x3')]=_['defaults'](config['redis'],{'host':_0x51b0('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x51b0('0x3')]));function ChatQueue(_0x103271){this['id']=_0x103271['id']||0x0;this[_0x51b0('0x5')]=_0x103271[_0x51b0('0x5')]||'';this[_0x51b0('0x6')]=_0x103271[_0x51b0('0x6')]||0xa;this['strategy']=_0x103271[_0x51b0('0x7')]||_0x51b0('0x8');this[_0x51b0('0x9')]=_0x103271[_0x51b0('0x9')];this[_0x51b0('0xa')]={};this[_0x51b0('0xb')]=0x0;this[_0x51b0('0x0')]='';this[_0x51b0('0xc')]();this[_0x51b0('0xd')]();}ChatQueue[_0x51b0('0xe')][_0x51b0('0xc')]=function(){var _0x48072a=this[_0x51b0('0xa')]['_rr'];this['mapAgentsId']=_[_0x51b0('0xf')](this[_0x51b0('0x9')],'id');this['mapAgentsId'][_0x51b0('0x10')]=_0x48072a;};ChatQueue['prototype'][_0x51b0('0xd')]=function(){this[_0x51b0('0x11')]=0x0;this[_0x51b0('0x12')]=0x0;for(var _0x949ac1=0x0;_0x949ac1=0x0?this['available']:0x0;var _0x1d5d61={'id':this['id'],'available':this[_0x51b0('0x16')],'loggedIn':this[_0x51b0('0x11')],'name':this[_0x51b0('0x5')],'paused':this[_0x51b0('0x12')],'waiting':this[_0x51b0('0xb')]};var _0x4e2777=md5(JSON[_0x51b0('0x17')](_0x1d5d61));if(this[_0x51b0('0x0')]!==_0x4e2777){this[_0x51b0('0x0')]=_0x4e2777;io['to'](util[_0x51b0('0x18')](_0x51b0('0x19'),_0x1d5d61[_0x51b0('0x5')]))['emit'](_0x51b0('0x1a'),_0x1d5d61);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xf46b=['socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x18fd0b,_0xe0f9ed){var _0x3b19a3=function(_0xde37ae){while(--_0xde37ae){_0x18fd0b['push'](_0x18fd0b['shift']());}};_0x3b19a3(++_0xe0f9ed);}(_0xf46b,0x1c5));var _0xbf46=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf46b[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xbf46('0x0'));var md5=require(_0xbf46('0x1'));var util=require('util');var Redis=require(_0xbf46('0x2'));var config=require(_0xbf46('0x3'));config[_0xbf46('0x4')]=_[_0xbf46('0x5')](config[_0xbf46('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf46('0x6'))(new Redis(config[_0xbf46('0x4')]));function ChatQueue(_0x52ce40){this['id']=_0x52ce40['id']||0x0;this[_0xbf46('0x7')]=_0x52ce40[_0xbf46('0x7')]||'';this['timeout']=_0x52ce40['timeout']||0xa;this[_0xbf46('0x8')]=_0x52ce40[_0xbf46('0x8')]||_0xbf46('0x9');this[_0xbf46('0xa')]=_0x52ce40[_0xbf46('0xa')];this[_0xbf46('0xb')]={};this['waiting']=0x0;this[_0xbf46('0x1')]='';this['updateRouting']();this[_0xbf46('0xc')]();}ChatQueue['prototype'][_0xbf46('0xd')]=function(){var _0x51a2c3=this[_0xbf46('0xb')][_0xbf46('0xe')];this[_0xbf46('0xb')]=_[_0xbf46('0xf')](this[_0xbf46('0xa')],'id');this[_0xbf46('0xb')][_0xbf46('0xe')]=_0x51a2c3;};ChatQueue['prototype'][_0xbf46('0xc')]=function(){this[_0xbf46('0x10')]=0x0;this[_0xbf46('0x11')]=0x0;for(var _0x2117ef=0x0;_0x2117ef=0x0?this['available']:0x0;var _0x2c1972={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbf46('0x10')],'name':this[_0xbf46('0x7')],'paused':this[_0xbf46('0x11')],'waiting':this['waiting']};var _0x34ac48=md5(JSON[_0xbf46('0x15')](_0x2c1972));if(this['md5']!==_0x34ac48){this['md5']=_0x34ac48;io['to'](util[_0xbf46('0x16')](_0xbf46('0x17'),_0x2c1972[_0xbf46('0x7')]))[_0xbf46('0x18')](_0xbf46('0x19'),_0x2c1972);}};module[_0xbf46('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d44ba0a..0b19753 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(_0x28f35a,_0x39055b){var _0x46ddbe=function(_0x14396d){while(--_0x14396d){_0x28f35a['push'](_0x28f35a['shift']());}};_0x46ddbe(++_0x39055b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x1dea30,_0xa8fe09){var _0x51799f=function(_0xbbd744){while(--_0xbbd744){_0x1dea30['push'](_0x1dea30['shift']());}};_0x51799f(++_0xa8fe09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 da3f49d..efb136e 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 _0xc49e=['name','Intervals','exports'];(function(_0x1090f8,_0xd83a11){var _0x180524=function(_0x109ab8){while(--_0x109ab8){_0x1090f8['push'](_0x1090f8['shift']());}};_0x180524(++_0xd83a11);}(_0xc49e,0x72));var _0xec49=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xc49e[_0x68ee8b];return _0x5148f7;};'use strict';function Interval(_0x1cc5f2){this['id']=_0x1cc5f2['id']||0x0;this[_0xec49('0x0')]=_0x1cc5f2['name']||'';this[_0xec49('0x1')]=_0x1cc5f2[_0xec49('0x1')]||{};}module[_0xec49('0x2')]=Interval; \ No newline at end of file +var _0x4991=['exports','name','Intervals'];(function(_0x2f71c1,_0x319017){var _0x411bb7=function(_0x4e69b5){while(--_0x4e69b5){_0x2f71c1['push'](_0x2f71c1['shift']());}};_0x411bb7(++_0x319017);}(_0x4991,0x6a));var _0x1499=function(_0xde79e0,_0x119bb8){_0xde79e0=_0xde79e0-0x0;var _0x3efc2=_0x4991[_0xde79e0];return _0x3efc2;};'use strict';function Interval(_0x48b4ca){this['id']=_0x48b4ca['id']||0x0;this['name']=_0x48b4ca[_0x1499('0x0')]||'';this['Intervals']=_0x48b4ca[_0x1499('0x1')]||{};}module[_0x1499('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 ebfbed9..3a3fb6c 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 _0x626d=['length','online','loggedIn','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','map','_rr','paused'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x626d,0xa0));var _0xd626=function(_0x12f91c,_0x3906fd){_0x12f91c=_0x12f91c-0x0;var _0x3be958=_0x626d[_0x12f91c];return _0x3be958;};'use strict';var _=require(_0xd626('0x0'));var md5=require('md5');var util=require(_0xd626('0x1'));var Redis=require(_0xd626('0x2'));var config=require(_0xd626('0x3'));config['redis']=_[_0xd626('0x4')](config[_0xd626('0x5')],{'host':_0xd626('0x6'),'port':0x18eb});var io=require(_0xd626('0x7'))(new Redis(config[_0xd626('0x5')]));function MailQueue(_0x48c737){this['id']=_0x48c737['id']||0x0;this[_0xd626('0x8')]=_0x48c737['name']||'';this['timeout']=_0x48c737[_0xd626('0x9')]||0xa;this['strategy']=_0x48c737['strategy']||_0xd626('0xa');this[_0xd626('0xb')]=_0x48c737['Agents'];this[_0xd626('0xc')]={};this['waiting']=0x0;this[_0xd626('0xd')]='';this['updateRouting']();this[_0xd626('0xe')]();}MailQueue[_0xd626('0xf')][_0xd626('0x10')]=function(){var _0x48467c=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xd626('0x11')](this[_0xd626('0xb')],'id');this[_0xd626('0xc')][_0xd626('0x12')]=_0x48467c;};MailQueue[_0xd626('0xf')][_0xd626('0xe')]=function(){this['loggedIn']=0x0;this[_0xd626('0x13')]=0x0;for(var _0x1004bb=0x0;_0x1004bb=0x0?this['available']:0x0;var _0x1213b4={'id':this['id'],'available':this[_0xd626('0x17')],'loggedIn':this[_0xd626('0x16')],'name':this['name'],'paused':this[_0xd626('0x13')],'waiting':this[_0xd626('0x18')]};var _0x20edf7=md5(JSON[_0xd626('0x19')](_0x1213b4));if(this[_0xd626('0xd')]!==_0x20edf7){this[_0xd626('0xd')]=_0x20edf7;io['to'](util[_0xd626('0x1a')](_0xd626('0x1b'),_0x1213b4['name']))[_0xd626('0x1c')](_0xd626('0x1d'),_0x1213b4);}};module['exports']=MailQueue; \ No newline at end of file +var _0x9048=['beepall','Agents','mapAgentsId','waiting','updateRealtime','map','_rr','prototype','loggedIn','paused','online','mailPause','available','md5','format','mail:queue:%s','mail_queue:save','lodash','util','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0x9048,0xf2));var _0x8904=function(_0x2b8502,_0x1d8ed1){_0x2b8502=_0x2b8502-0x0;var _0x31736b=_0x9048[_0x2b8502];return _0x31736b;};'use strict';var _=require(_0x8904('0x0'));var md5=require('md5');var util=require(_0x8904('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x8904('0x2')](config[_0x8904('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8904('0x4'))(new Redis(config[_0x8904('0x3')]));function MailQueue(_0x1e09e1){this['id']=_0x1e09e1['id']||0x0;this[_0x8904('0x5')]=_0x1e09e1[_0x8904('0x5')]||'';this[_0x8904('0x6')]=_0x1e09e1[_0x8904('0x6')]||0xa;this[_0x8904('0x7')]=_0x1e09e1[_0x8904('0x7')]||_0x8904('0x8');this[_0x8904('0x9')]=_0x1e09e1[_0x8904('0x9')];this[_0x8904('0xa')]={};this[_0x8904('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x8904('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4c3937=this[_0x8904('0xa')]['_rr'];this[_0x8904('0xa')]=_[_0x8904('0xd')](this[_0x8904('0x9')],'id');this[_0x8904('0xa')][_0x8904('0xe')]=_0x4c3937;};MailQueue[_0x8904('0xf')][_0x8904('0xc')]=function(){this[_0x8904('0x10')]=0x0;this[_0x8904('0x11')]=0x0;for(var _0x487be9=0x0;_0x487be9=0x0?this['available']:0x0;var _0x2fbc00={'id':this['id'],'available':this[_0x8904('0x14')],'loggedIn':this[_0x8904('0x10')],'name':this[_0x8904('0x5')],'paused':this[_0x8904('0x11')],'waiting':this[_0x8904('0xb')]};var _0x5b52d6=md5(JSON['stringify'](_0x2fbc00));if(this[_0x8904('0x15')]!==_0x5b52d6){this[_0x8904('0x15')]=_0x5b52d6;io['to'](util[_0x8904('0x16')](_0x8904('0x17'),_0x2fbc00['name']))['emit'](_0x8904('0x18'),_0x2fbc00);}};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 18c4289..5645edc 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 _0x7936=['length','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','exports','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused'];(function(_0x48e439,_0x44a26f){var _0x53a249=function(_0x4799e8){while(--_0x4799e8){_0x48e439['push'](_0x48e439['shift']());}};_0x53a249(++_0x44a26f);}(_0x7936,0x191));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x6793('0x0'));var config=require(_0x6793('0x1'));config['redis']=_[_0x6793('0x2')](config[_0x6793('0x3')],{'host':_0x6793('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x365c69){this['id']=_0x365c69['id']||0x0;this[_0x6793('0x5')]=_0x365c69['name']||'';this[_0x6793('0x6')]=_0x365c69[_0x6793('0x6')]||0xa;this['strategy']=_0x365c69[_0x6793('0x7')]||'beepall';this[_0x6793('0x8')]=_0x365c69[_0x6793('0x8')];this[_0x6793('0x9')]={};this[_0x6793('0xa')]=0x0;this[_0x6793('0xb')]='';this[_0x6793('0xc')]();this[_0x6793('0xd')]();}OpenchannelQueue[_0x6793('0xe')][_0x6793('0xc')]=function(){var _0x5620a3=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x6793('0xf')](this[_0x6793('0x8')],'id');this[_0x6793('0x9')][_0x6793('0x10')]=_0x5620a3;};OpenchannelQueue[_0x6793('0xe')][_0x6793('0xd')]=function(){this[_0x6793('0x11')]=0x0;this[_0x6793('0x12')]=0x0;for(var _0x395875=0x0;_0x395875=0x0?this[_0x6793('0x16')]:0x0;var _0x1caf66={'id':this['id'],'available':this[_0x6793('0x16')],'loggedIn':this[_0x6793('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x6793('0xa')]};var _0xbe996c=md5(JSON[_0x6793('0x17')](_0x1caf66));if(this['md5']!==_0xbe996c){this[_0x6793('0xb')]=_0xbe996c;io['to'](util[_0x6793('0x18')]('openchannel:queue:%s',_0x1caf66['name']))[_0x6793('0x19')](_0x6793('0x1a'),_0x1caf66);}};module[_0x6793('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x8e9d=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','openchannelPause','available','stringify','openchannel:queue:%s'];(function(_0x45977c,_0x7eaed0){var _0x399413=function(_0x41cc76){while(--_0x41cc76){_0x45977c['push'](_0x45977c['shift']());}};_0x399413(++_0x7eaed0);}(_0x8e9d,0x8e));var _0xd8e9=function(_0x40f12e,_0x26102d){_0x40f12e=_0x40f12e-0x0;var _0xda42af=_0x8e9d[_0x40f12e];return _0xda42af;};'use strict';var _=require(_0xd8e9('0x0'));var md5=require(_0xd8e9('0x1'));var util=require(_0xd8e9('0x2'));var Redis=require(_0xd8e9('0x3'));var config=require(_0xd8e9('0x4'));config[_0xd8e9('0x5')]=_[_0xd8e9('0x6')](config[_0xd8e9('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd8e9('0x5')]));function OpenchannelQueue(_0x19f93e){this['id']=_0x19f93e['id']||0x0;this[_0xd8e9('0x7')]=_0x19f93e[_0xd8e9('0x7')]||'';this[_0xd8e9('0x8')]=_0x19f93e['timeout']||0xa;this[_0xd8e9('0x9')]=_0x19f93e[_0xd8e9('0x9')]||_0xd8e9('0xa');this[_0xd8e9('0xb')]=_0x19f93e[_0xd8e9('0xb')];this[_0xd8e9('0xc')]={};this[_0xd8e9('0xd')]=0x0;this[_0xd8e9('0x1')]='';this[_0xd8e9('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0xd8e9('0xf')][_0xd8e9('0xe')]=function(){var _0x183362=this['mapAgentsId'][_0xd8e9('0x10')];this[_0xd8e9('0xc')]=_[_0xd8e9('0x11')](this[_0xd8e9('0xb')],'id');this[_0xd8e9('0xc')][_0xd8e9('0x10')]=_0x183362;};OpenchannelQueue['prototype'][_0xd8e9('0x12')]=function(){this[_0xd8e9('0x13')]=0x0;this[_0xd8e9('0x14')]=0x0;for(var _0x1034d6=0x0;_0x1034d6=0x0?this[_0xd8e9('0x17')]:0x0;var _0x3415cf={'id':this['id'],'available':this[_0xd8e9('0x17')],'loggedIn':this[_0xd8e9('0x13')],'name':this['name'],'paused':this[_0xd8e9('0x14')],'waiting':this[_0xd8e9('0xd')]};var _0x1e60fc=md5(JSON[_0xd8e9('0x18')](_0x3415cf));if(this['md5']!==_0x1e60fc){this['md5']=_0x1e60fc;io['to'](util['format'](_0xd8e9('0x19'),_0x3415cf[_0xd8e9('0x7')]))[_0xd8e9('0x1a')]('openchannel_queue:save',_0x3415cf);}};module[_0xd8e9('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c20b965..e9f6df1 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x26d55a,_0xf35d61){var _0x108326=function(_0x7f9422){while(--_0x7f9422){_0x26d55a['push'](_0x26d55a['shift']());}};_0x108326(++_0xf35d61);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1d547a,_0x4c8260){var _0xbbe97a=function(_0xf42ac4){while(--_0xf42ac4){_0x1d547a['push'](_0x1d547a['shift']());}};_0xbbe97a(++_0x4c8260);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4182d50..9990cce 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 _0x6e71=['emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','whatsappPause','available','name','format','whatsapp:queue:%s'];(function(_0x16322c,_0x3a434e){var _0x453777=function(_0x420061){while(--_0x420061){_0x16322c['push'](_0x16322c['shift']());}};_0x453777(++_0x3a434e);}(_0x6e71,0xbd));var _0x16e7=function(_0x5ef0a7,_0x448741){_0x5ef0a7=_0x5ef0a7-0x0;var _0x5d640b=_0x6e71[_0x5ef0a7];return _0x5d640b;};'use strict';var _=require(_0x16e7('0x0'));var md5=require(_0x16e7('0x1'));var util=require(_0x16e7('0x2'));var Redis=require(_0x16e7('0x3'));var config=require(_0x16e7('0x4'));config[_0x16e7('0x5')]=_[_0x16e7('0x6')](config[_0x16e7('0x5')],{'host':_0x16e7('0x7'),'port':0x18eb});var io=require(_0x16e7('0x8'))(new Redis(config[_0x16e7('0x5')]));function WhatsappQueue(_0x476b51){this['id']=_0x476b51['id']||0x0;this['name']=_0x476b51['name']||'';this[_0x16e7('0x9')]=_0x476b51['timeout']||0xa;this[_0x16e7('0xa')]=_0x476b51[_0x16e7('0xa')]||_0x16e7('0xb');this[_0x16e7('0xc')]=_0x476b51[_0x16e7('0xc')];this[_0x16e7('0xd')]={};this[_0x16e7('0xe')]=0x0;this[_0x16e7('0x1')]='';this['updateRouting']();this[_0x16e7('0xf')]();}WhatsappQueue[_0x16e7('0x10')][_0x16e7('0x11')]=function(){var _0x48991e=this[_0x16e7('0xd')][_0x16e7('0x12')];this[_0x16e7('0xd')]=_[_0x16e7('0x13')](this['Agents'],'id');this[_0x16e7('0xd')][_0x16e7('0x12')]=_0x48991e;};WhatsappQueue[_0x16e7('0x10')][_0x16e7('0xf')]=function(){this[_0x16e7('0x14')]=0x0;this[_0x16e7('0x15')]=0x0;for(var _0x10c05f=0x0;_0x10c05f=0x0?this[_0x16e7('0x18')]:0x0;var _0x221eb7={'id':this['id'],'available':this[_0x16e7('0x18')],'loggedIn':this[_0x16e7('0x14')],'name':this[_0x16e7('0x19')],'paused':this[_0x16e7('0x15')],'waiting':this[_0x16e7('0xe')]};var _0x5312b2=md5(JSON['stringify'](_0x221eb7));if(this[_0x16e7('0x1')]!==_0x5312b2){this['md5']=_0x5312b2;io['to'](util[_0x16e7('0x1a')](_0x16e7('0x1b'),_0x221eb7[_0x16e7('0x19')]))[_0x16e7('0x1c')](_0x16e7('0x1d'),_0x221eb7);}};module[_0x16e7('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xaf0d=['mapAgentsId','_rr','map','prototype','loggedIn','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','exports','md5','util','localhost','socket.io-emitter','redis','name','strategy','beepall','Agents','updateRouting','updateRealtime'];(function(_0x27d68d,_0x114956){var _0x2c2f48=function(_0x2207df){while(--_0x2207df){_0x27d68d['push'](_0x27d68d['shift']());}};_0x2c2f48(++_0x114956);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x327e13,_0x3b42b5){_0x327e13=_0x327e13-0x0;var _0x43b43e=_0xaf0d[_0x327e13];return _0x43b43e;};'use strict';var _=require('lodash');var md5=require(_0xdaf0('0x0'));var util=require(_0xdaf0('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xdaf0('0x2'),'port':0x18eb});var io=require(_0xdaf0('0x3'))(new Redis(config[_0xdaf0('0x4')]));function WhatsappQueue(_0x569146){this['id']=_0x569146['id']||0x0;this[_0xdaf0('0x5')]=_0x569146[_0xdaf0('0x5')]||'';this['timeout']=_0x569146['timeout']||0xa;this[_0xdaf0('0x6')]=_0x569146[_0xdaf0('0x6')]||_0xdaf0('0x7');this[_0xdaf0('0x8')]=_0x569146['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xdaf0('0x9')]();this[_0xdaf0('0xa')]();}WhatsappQueue['prototype'][_0xdaf0('0x9')]=function(){var _0x187d90=this[_0xdaf0('0xb')][_0xdaf0('0xc')];this['mapAgentsId']=_[_0xdaf0('0xd')](this[_0xdaf0('0x8')],'id');this[_0xdaf0('0xb')]['_rr']=_0x187d90;};WhatsappQueue[_0xdaf0('0xe')][_0xdaf0('0xa')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48ea31=0x0;_0x48ea31=0x0?this[_0xdaf0('0x11')]:0x0;var _0x4b8588={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdaf0('0xf')],'name':this[_0xdaf0('0x5')],'paused':this[_0xdaf0('0x10')],'waiting':this[_0xdaf0('0x12')]};var _0x1ce5aa=md5(JSON[_0xdaf0('0x13')](_0x4b8588));if(this[_0xdaf0('0x0')]!==_0x1ce5aa){this['md5']=_0x1ce5aa;io['to'](util[_0xdaf0('0x14')](_0xdaf0('0x15'),_0x4b8588[_0xdaf0('0x5')]))[_0xdaf0('0x16')]('whatsapp_queue:save',_0x4b8588);}};module[_0xdaf0('0x17')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 454ead7..794cc42 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x2d44f9,_0x2814c5){var _0x4a8bb4=function(_0x39b8ff){while(--_0x39b8ff){_0x2d44f9['push'](_0x2d44f9['shift']());}};_0x4a8bb4(++_0x2814c5);}(_0xa41a,0x6b));var _0xaa41=function(_0x59006c,_0x4c8bde){_0x59006c=_0x59006c-0x0;var _0x1b5b2f=_0xa41a[_0x59006c];return _0x1b5b2f;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x506f73,_0x542190){_0x506f73=_0x506f73-0x0;var _0x20a9e4=_0x1cb9[_0x506f73];return _0x20a9e4;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2bb02d9..32e4a35 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 _0xb2df=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x217a65,_0x3344f6){var _0x135aa4=function(_0x17ad20){while(--_0x17ad20){_0x217a65['push'](_0x217a65['shift']());}};_0x135aa4(++_0x3344f6);}(_0xb2df,0x132));var _0xfb2d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb2df[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xfb2d('0x0'));exports[_0xfb2d('0x1')]=function(_0x883059,_0x469a2c){return client[_0xfb2d('0x2')]('UpdateChatInteraction',{'body':_0x469a2c,'options':{'where':{'id':_0x883059}},'log':_0xfb2d('0x3')});};exports[_0xfb2d('0x4')]=function(_0x4e40b1,_0x3a4b21){return client[_0xfb2d('0x2')](_0xfb2d('0x5'),{'body':_0x3a4b21,'options':{'where':{'id':_0x4e40b1}},'log':_0xfb2d('0x6')});}; \ No newline at end of file +var _0x1725=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1725,0x17d));var _0x5172=function(_0x5de693,_0x3c7e12){_0x5de693=_0x5de693-0x0;var _0x13610c=_0x1725[_0x5de693];return _0x13610c;};'use strict';var client=require(_0x5172('0x0'));exports[_0x5172('0x1')]=function(_0x376054,_0x413460){return client['Request'](_0x5172('0x2'),{'body':_0x413460,'options':{'where':{'id':_0x376054}},'log':_0x5172('0x3')});};exports[_0x5172('0x4')]=function(_0x5792b7,_0x117bfa){return client[_0x5172('0x5')](_0x5172('0x6'),{'body':_0x117bfa,'options':{'where':{'id':_0x5792b7}},'log':_0x5172('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5f9244a..da14138 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 _0xfdfa=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0xfdfa,0x190));var _0xafdf=function(_0x25f0d5,_0xc2dbf1){_0x25f0d5=_0x25f0d5-0x0;var _0x3dac6b=_0xfdfa[_0x25f0d5];return _0x3dac6b;};'use strict';var client=require(_0xafdf('0x0'));exports[_0xafdf('0x1')]=function(_0x2d9c8a){return client[_0xafdf('0x2')](_0xafdf('0x3'),{'body':_0x2d9c8a,'log':_0xafdf('0x4')});}; \ No newline at end of file +var _0xc23e=['Request','CreateChatMessage','createChatMessage'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xc23e,0xea));var _0xec23=function(_0x10e7b1,_0x1964d3){_0x10e7b1=_0x10e7b1-0x0;var _0x23c093=_0xc23e[_0x10e7b1];return _0x23c093;};'use strict';var client=require('../client');exports['create']=function(_0x2cf835){return client[_0xec23('0x0')](_0xec23('0x1'),{'body':_0x2cf835,'log':_0xec23('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0ae034e..a4926e9 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 _0x7686=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7686,0x1ae));var _0x6768=function(_0x1e9bf1,_0x4627c9){_0x1e9bf1=_0x1e9bf1-0x0;var _0x1e509d=_0x7686[_0x1e9bf1];return _0x1e509d;};'use strict';var client=require(_0x6768('0x0'));exports[_0x6768('0x1')]=function(){return function(){return client[_0x6768('0x2')](_0x6768('0x3'),{'options':{'raw':![],'attributes':['id',_0x6768('0x4'),_0x6768('0x5'),_0x6768('0x6')],'include':[{'model':_0x6768('0x7'),'as':_0x6768('0x8'),'attributes':['id',_0x6768('0x4'),_0x6768('0x9'),_0x6768('0xa')]}]},'log':_0x6768('0x1')});};}; \ No newline at end of file +var _0xb9c4=['name','strategy','User','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x45de1c,_0x3559d5){var _0xebc059=function(_0x5347bc){while(--_0x5347bc){_0x45de1c['push'](_0x45de1c['shift']());}};_0xebc059(++_0x3559d5);}(_0xb9c4,0xcd));var _0x4b9c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xb9c4[_0x87b0ff];return _0x3bc0b2;};'use strict';var client=require(_0x4b9c('0x0'));exports[_0x4b9c('0x1')]=function(){return function(){return client['Request'](_0x4b9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b9c('0x3'),'timeout',_0x4b9c('0x4')],'include':[{'model':_0x4b9c('0x5'),'as':'Agents','attributes':['id',_0x4b9c('0x3'),_0x4b9c('0x6'),_0x4b9c('0x7')]}]},'log':_0x4b9c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index a6dd6c9..ede5dcc 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 _0x79a8=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a8,0x1d0));var _0x879a=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x79a8[_0x58803c];return _0xf95b9b;};'use strict';var client=require(_0x879a('0x0'));exports['create']=function(_0x244704){return client[_0x879a('0x1')](_0x879a('0x2'),{'body':_0x244704,'log':'CreateChatQueueReport'});};exports[_0x879a('0x3')]=function(_0x49b7c0,_0x46ee67){return client[_0x879a('0x1')](_0x879a('0x4'),{'body':_0x46ee67,'options':{'where':{'uniqueid':_0x49b7c0},'order':[['id',_0x879a('0x5')]],'limit':0x1},'log':_0x879a('0x4')});}; \ No newline at end of file +var _0xb492=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb492,0x172));var _0x2b49=function(_0xd6f844,_0x2d5ce6){_0xd6f844=_0xd6f844-0x0;var _0x14ba30=_0xb492[_0xd6f844];return _0x14ba30;};'use strict';var client=require('../client');exports[_0x2b49('0x0')]=function(_0x32fdad){return client[_0x2b49('0x1')](_0x2b49('0x2'),{'body':_0x32fdad,'log':'CreateChatQueueReport'});};exports['update']=function(_0x31a7e5,_0x340296){return client[_0x2b49('0x1')](_0x2b49('0x3'),{'body':_0x340296,'options':{'where':{'uniqueid':_0x31a7e5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4cc6238..4557bbd 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 _0xae04=['update','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x5b9429,_0xe8d8f1){var _0x2aae0f=function(_0x3a203d){while(--_0x3a203d){_0x5b9429['push'](_0x5b9429['shift']());}};_0x2aae0f(++_0xe8d8f1);}(_0xae04,0x179));var _0x4ae0=function(_0x55bd38,_0x48eacf){_0x55bd38=_0x55bd38-0x0;var _0x444323=_0xae04[_0x55bd38];return _0x444323;};'use strict';var client=require(_0x4ae0('0x0'));exports[_0x4ae0('0x1')]=function(_0x1b9cab,_0x5b22ea){return client['Request']('UpdateFaxInteraction',{'body':_0x5b22ea,'options':{'where':{'id':_0x1b9cab}},'log':_0x4ae0('0x2')});};exports[_0x4ae0('0x3')]=function(_0x38275f,_0x5119a4){return client[_0x4ae0('0x4')](_0x4ae0('0x5'),{'body':_0x5119a4,'options':{'where':{'id':_0x38275f}},'log':_0x4ae0('0x6')});}; \ No newline at end of file +var _0x783d=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update'];(function(_0x2ee4ca,_0x568fad){var _0x1c4647=function(_0x407937){while(--_0x407937){_0x2ee4ca['push'](_0x2ee4ca['shift']());}};_0x1c4647(++_0x568fad);}(_0x783d,0x12b));var _0xd783=function(_0x452881,_0x57eeec){_0x452881=_0x452881-0x0;var _0x25d680=_0x783d[_0x452881];return _0x25d680;};'use strict';var client=require(_0xd783('0x0'));exports[_0xd783('0x1')]=function(_0x1c2a38,_0x17d927){return client['Request']('UpdateFaxInteraction',{'body':_0x17d927,'options':{'where':{'id':_0x1c2a38}},'log':_0xd783('0x2')});};exports[_0xd783('0x3')]=function(_0x48042d,_0x41eaad){return client[_0xd783('0x4')](_0xd783('0x5'),{'body':_0x41eaad,'options':{'where':{'id':_0x48042d}},'log':_0xd783('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 20e7721..3d1c982 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 _0x1ea7=['Request','CreateFaxMessage','../client','create'];(function(_0x3a2f92,_0xe5bc3b){var _0xe8a6d=function(_0x1ed7f1){while(--_0x1ed7f1){_0x3a2f92['push'](_0x3a2f92['shift']());}};_0xe8a6d(++_0xe5bc3b);}(_0x1ea7,0xb2));var _0x71ea=function(_0xf10ab2,_0x4139fa){_0xf10ab2=_0xf10ab2-0x0;var _0x4c6629=_0x1ea7[_0xf10ab2];return _0x4c6629;};'use strict';var client=require(_0x71ea('0x0'));exports[_0x71ea('0x1')]=function(_0x3f46c8){return client[_0x71ea('0x2')](_0x71ea('0x3'),{'body':_0x3f46c8,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x11f9=['CreateFaxMessage','createFaxMessage','Request'];(function(_0x1486af,_0x43fc96){var _0x41a52e=function(_0x5c6a28){while(--_0x5c6a28){_0x1486af['push'](_0x1486af['shift']());}};_0x41a52e(++_0x43fc96);}(_0x11f9,0xb9));var _0x911f=function(_0x494173,_0x42721d){_0x494173=_0x494173-0x0;var _0x2f4883=_0x11f9[_0x494173];return _0x2f4883;};'use strict';var client=require('../client');exports['create']=function(_0x35a8d8){return client[_0x911f('0x0')](_0x911f('0x1'),{'body':_0x35a8d8,'log':_0x911f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e905b2e..58ff10a 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 _0x99c5=['name','timeout','strategy','User','Agents','online','../client','getFaxQueues','GetFaxQueue'];(function(_0x22016f,_0x790dbf){var _0xbb5702=function(_0x4c3fa3){while(--_0x4c3fa3){_0x22016f['push'](_0x22016f['shift']());}};_0xbb5702(++_0x790dbf);}(_0x99c5,0xde));var _0x599c=function(_0x321546,_0x41b964){_0x321546=_0x321546-0x0;var _0xfea202=_0x99c5[_0x321546];return _0xfea202;};'use strict';var client=require(_0x599c('0x0'));exports[_0x599c('0x1')]=function(){return function(){return client['Request'](_0x599c('0x2'),{'options':{'raw':![],'attributes':['id',_0x599c('0x3'),_0x599c('0x4'),_0x599c('0x5')],'include':[{'model':_0x599c('0x6'),'as':_0x599c('0x7'),'attributes':['id',_0x599c('0x3'),_0x599c('0x8'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x7034=['timeout','strategy','User','Agents','online','../client','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7034,0x108));var _0x4703=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x7034[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x4703('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4703('0x1'),_0x4703('0x2'),_0x4703('0x3')],'include':[{'model':_0x4703('0x4'),'as':_0x4703('0x5'),'attributes':['id','name',_0x4703('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 499e69d..fff85c5 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 _0xe068=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x15fe68,_0xddc145){var _0x1d144c=function(_0x408370){while(--_0x408370){_0x15fe68['push'](_0x15fe68['shift']());}};_0x1d144c(++_0xddc145);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x8e06('0x0')]=function(_0x3aebc5){return client[_0x8e06('0x1')](_0x8e06('0x2'),{'body':_0x3aebc5,'log':_0x8e06('0x2')});};exports[_0x8e06('0x3')]=function(_0x3a4f13,_0x44c96b){return client[_0x8e06('0x1')](_0x8e06('0x4'),{'body':_0x44c96b,'options':{'where':{'uniqueid':_0x3a4f13},'order':[['id',_0x8e06('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x120b=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x56e362,_0x6779cc){var _0x4a752c=function(_0x4256fb){while(--_0x4256fb){_0x56e362['push'](_0x56e362['shift']());}};_0x4a752c(++_0x6779cc);}(_0x120b,0x8f));var _0xb120=function(_0x44471c,_0x5f1e2e){_0x44471c=_0x44471c-0x0;var _0x5efbb3=_0x120b[_0x44471c];return _0x5efbb3;};'use strict';var client=require(_0xb120('0x0'));exports[_0xb120('0x1')]=function(_0x4db2ac){return client[_0xb120('0x2')](_0xb120('0x3'),{'body':_0x4db2ac,'log':_0xb120('0x3')});};exports[_0xb120('0x4')]=function(_0x2f5e7a,_0xe1d9d1){return client[_0xb120('0x2')](_0xb120('0x5'),{'body':_0xe1d9d1,'options':{'where':{'uniqueid':_0x2f5e7a},'order':[['id',_0xb120('0x6')]],'limit':0x1},'log':_0xb120('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 43ddc2d..0957bfd 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 _0x3266=['Intervals','interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x552e59,_0x5c4591){var _0x5e15ad=function(_0x1af238){while(--_0x1af238){_0x552e59['push'](_0x552e59['shift']());}};_0x5e15ad(++_0x5c4591);}(_0x3266,0x6a));var _0x6326=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3266[_0x53ccf2];return _0x5a2964;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6326('0x4')],'include':[{'model':_0x6326('0x5'),'as':_0x6326('0x6'),'attributes':['id',_0x6326('0x4'),_0x6326('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x9c9b=['Interval','interval','getIntervals','Request','GetInterval','name'];(function(_0x302faa,_0x129477){var _0x412a49=function(_0x213fa4){while(--_0x213fa4){_0x302faa['push'](_0x302faa['shift']());}};_0x412a49(++_0x129477);}(_0x9c9b,0x194));var _0xb9c9=function(_0x12740c,_0x1da26a){_0x12740c=_0x12740c-0x0;var _0x5509dd=_0x9c9b[_0x12740c];return _0x5509dd;};'use strict';var client=require('../client');exports[_0xb9c9('0x0')]=function(){return function(){return client[_0xb9c9('0x1')](_0xb9c9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb9c9('0x3')],'include':[{'model':_0xb9c9('0x4'),'as':'Intervals','attributes':['id',_0xb9c9('0x3'),_0xb9c9('0x5')]}]},'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 eb8b2bd..d1ef545 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 _0xcc26=['Request','addTags','addTagsToChatInteraction','update'];(function(_0x1ae0db,_0x24c96f){var _0x110350=function(_0x5afbb1){while(--_0x5afbb1){_0x1ae0db['push'](_0x1ae0db['shift']());}};_0x110350(++_0x24c96f);}(_0xcc26,0x6b));var _0x6cc2=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xcc26[_0x246148];return _0x453d94;};'use strict';var client=require('../client');exports[_0x6cc2('0x0')]=function(_0x1919d0,_0x31c98c){return client[_0x6cc2('0x1')]('UpdateMailInteraction',{'body':_0x31c98c,'options':{'where':{'id':_0x1919d0}},'log':'updateMailInteraction'});};exports[_0x6cc2('0x2')]=function(_0x379530,_0x3c681a){return client[_0x6cc2('0x1')]('AddTagsToMailInteraction',{'body':_0x3c681a,'options':{'where':{'id':_0x379530}},'log':_0x6cc2('0x3')});}; \ No newline at end of file +var _0xd81d=['updateMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0x443f85,_0x1c2f84){var _0x40d7fe=function(_0x3e7a75){while(--_0x3e7a75){_0x443f85['push'](_0x443f85['shift']());}};_0x40d7fe(++_0x1c2f84);}(_0xd81d,0x1a1));var _0xdd81=function(_0x16812f,_0x27e01b){_0x16812f=_0x16812f-0x0;var _0x1715b3=_0xd81d[_0x16812f];return _0x1715b3;};'use strict';var client=require('../client');exports[_0xdd81('0x0')]=function(_0x5de05f,_0x23c1ec){return client[_0xdd81('0x1')](_0xdd81('0x2'),{'body':_0x23c1ec,'options':{'where':{'id':_0x5de05f}},'log':_0xdd81('0x3')});};exports['addTags']=function(_0x166696,_0x48a25a){return client['Request']('AddTagsToMailInteraction',{'body':_0x48a25a,'options':{'where':{'id':_0x166696}},'log':_0xdd81('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index bcd6813..6765d80 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 _0x715d=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x715d,0xba));var _0xd715=function(_0x12097a,_0x2a0706){_0x12097a=_0x12097a-0x0;var _0x13ff9a=_0x715d[_0x12097a];return _0x13ff9a;};'use strict';var client=require(_0xd715('0x0'));exports[_0xd715('0x1')]=function(_0x30a51e){return client['Request'](_0xd715('0x2'),{'body':_0x30a51e,'log':_0xd715('0x3')});}; \ No newline at end of file +var _0xed31=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x344b5c,_0x6fe280){var _0xd29b16=function(_0x14e90d){while(--_0x14e90d){_0x344b5c['push'](_0x344b5c['shift']());}};_0xd29b16(++_0x6fe280);}(_0xed31,0xc0));var _0x1ed3=function(_0x3f37f1,_0x199544){_0x3f37f1=_0x3f37f1-0x0;var _0x216258=_0xed31[_0x3f37f1];return _0x216258;};'use strict';var client=require(_0x1ed3('0x0'));exports[_0x1ed3('0x1')]=function(_0x2969bf){return client[_0x1ed3('0x2')](_0x1ed3('0x3'),{'body':_0x2969bf,'log':_0x1ed3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d1a8f04..0f4e47c 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 _0x81a1=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x81a1,0xf7));var _0x181a=function(_0x247751,_0x2ea801){_0x247751=_0x247751-0x0;var _0x211cd1=_0x81a1[_0x247751];return _0x211cd1;};'use strict';var client=require('../client');exports[_0x181a('0x0')]=function(){return function(){return client['Request'](_0x181a('0x1'),{'options':{'raw':![],'attributes':['id',_0x181a('0x2'),_0x181a('0x3'),'strategy'],'include':[{'model':_0x181a('0x4'),'as':_0x181a('0x5'),'attributes':['id','name',_0x181a('0x6'),_0x181a('0x7')]}]},'log':_0x181a('0x0')});};}; \ No newline at end of file +var _0x2f03=['mailPause','getMailQueues','GetMailQueue','name','timeout','User','Agents','online'];(function(_0x42ad15,_0xc29504){var _0x187ecd=function(_0x2f8574){while(--_0x2f8574){_0x42ad15['push'](_0x42ad15['shift']());}};_0x187ecd(++_0xc29504);}(_0x2f03,0x1f1));var _0x32f0=function(_0x456970,_0x4a254e){_0x456970=_0x456970-0x0;var _0x1bf80d=_0x2f03[_0x456970];return _0x1bf80d;};'use strict';var client=require('../client');exports[_0x32f0('0x0')]=function(){return function(){return client['Request'](_0x32f0('0x1'),{'options':{'raw':![],'attributes':['id',_0x32f0('0x2'),_0x32f0('0x3'),'strategy'],'include':[{'model':_0x32f0('0x4'),'as':_0x32f0('0x5'),'attributes':['id',_0x32f0('0x2'),_0x32f0('0x6'),_0x32f0('0x7')]}]},'log':_0x32f0('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c94f506..7061b89 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 _0xc9ea=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xc9ea,0x150));var _0xac9e=function(_0x2789a7,_0x115aa0){_0x2789a7=_0x2789a7-0x0;var _0x3be8d7=_0xc9ea[_0x2789a7];return _0x3be8d7;};'use strict';var client=require('../client');exports[_0xac9e('0x0')]=function(_0x79883d){return client[_0xac9e('0x1')](_0xac9e('0x2'),{'body':_0x79883d,'log':_0xac9e('0x2')});};exports[_0xac9e('0x3')]=function(_0x89e4fb,_0x4dd510){return client[_0xac9e('0x1')](_0xac9e('0x4'),{'body':_0x4dd510,'options':{'where':{'uniqueid':_0x89e4fb},'order':[['id',_0xac9e('0x5')]],'limit':0x1},'log':_0xac9e('0x4')});}; \ No newline at end of file +var _0x10b8=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x13a4ff,_0x53e3ca){var _0x61bd30=function(_0x3fe209){while(--_0x3fe209){_0x13a4ff['push'](_0x13a4ff['shift']());}};_0x61bd30(++_0x53e3ca);}(_0x10b8,0x14e));var _0x810b=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x10b8[_0x11c573];return _0x6b72de;};'use strict';var client=require('../client');exports['create']=function(_0x4183ac){return client[_0x810b('0x0')]('CreateMailQueueReport',{'body':_0x4183ac,'log':_0x810b('0x1')});};exports[_0x810b('0x2')]=function(_0xb30506,_0x2f62d5){return client['Request'](_0x810b('0x3'),{'body':_0x2f62d5,'options':{'where':{'uniqueid':_0xb30506},'order':[['id',_0x810b('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c750137..9ac9eb6 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 _0x7f7a=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x54a191,_0x3381cf){var _0x39b21f=function(_0x23b03f){while(--_0x23b03f){_0x54a191['push'](_0x54a191['shift']());}};_0x39b21f(++_0x3381cf);}(_0x7f7a,0x14f));var _0xa7f7=function(_0x3c8e71,_0x5d7506){_0x3c8e71=_0x3c8e71-0x0;var _0x5414e2=_0x7f7a[_0x3c8e71];return _0x5414e2;};'use strict';var client=require('../client');exports[_0xa7f7('0x0')]=function(_0x1f2a14,_0x50aa87){return client[_0xa7f7('0x1')](_0xa7f7('0x2'),{'body':_0x50aa87,'options':{'where':{'id':_0x1f2a14}},'log':'updateOpenchannelInteraction'});};exports[_0xa7f7('0x3')]=function(_0x32c7b4,_0x13b76c){return client[_0xa7f7('0x1')](_0xa7f7('0x4'),{'body':_0x13b76c,'options':{'where':{'id':_0x32c7b4}},'log':_0xa7f7('0x5')});}; \ No newline at end of file +var _0x568e=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x11bb17,_0x590d0f){var _0x44a838=function(_0x3a1bd4){while(--_0x3a1bd4){_0x11bb17['push'](_0x11bb17['shift']());}};_0x44a838(++_0x590d0f);}(_0x568e,0x1e2));var _0xe568=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x568e[_0x3d42d8];return _0x27fc41;};'use strict';var client=require(_0xe568('0x0'));exports[_0xe568('0x1')]=function(_0xf541fe,_0x131ded){return client[_0xe568('0x2')](_0xe568('0x3'),{'body':_0x131ded,'options':{'where':{'id':_0xf541fe}},'log':_0xe568('0x4')});};exports[_0xe568('0x5')]=function(_0x4a01f7,_0x3572ce){return client[_0xe568('0x2')](_0xe568('0x6'),{'body':_0x3572ce,'options':{'where':{'id':_0x4a01f7}},'log':_0xe568('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e2c1cf2..2a0512d 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 _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0x2e3967,_0x251916){var _0x5d2cd9=function(_0x5b199d){while(--_0x5b199d){_0x2e3967['push'](_0x2e3967['shift']());}};_0x5d2cd9(++_0x251916);}(_0x34e8,0x12c));var _0x834e=function(_0x4095e4,_0x36b9e9){_0x4095e4=_0x4095e4-0x0;var _0x462b94=_0x34e8[_0x4095e4];return _0x462b94;};'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 +var _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5a05c6,_0x47510b){_0x5a05c6=_0x5a05c6-0x0;var _0x29f374=_0xb43b[_0x5a05c6];return _0x29f374;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 22767a3..97e4621 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 _0x7d37=['name','timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x27f1e2,_0x40bb34){var _0x5e1307=function(_0x22dc6b){while(--_0x22dc6b){_0x27f1e2['push'](_0x27f1e2['shift']());}};_0x5e1307(++_0x40bb34);}(_0x7d37,0x138));var _0x77d3=function(_0x2af97a,_0x45cac9){_0x2af97a=_0x2af97a-0x0;var _0x24ca13=_0x7d37[_0x2af97a];return _0x24ca13;};'use strict';var client=require('../client');exports[_0x77d3('0x0')]=function(){return function(){return client[_0x77d3('0x1')](_0x77d3('0x2'),{'options':{'raw':![],'attributes':['id',_0x77d3('0x3'),_0x77d3('0x4'),_0x77d3('0x5')],'include':[{'model':'User','as':_0x77d3('0x6'),'attributes':['id',_0x77d3('0x3'),_0x77d3('0x7'),_0x77d3('0x8')]}]},'log':_0x77d3('0x0')});};}; \ No newline at end of file +var _0xb71e=['strategy','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb71e,0xac));var _0xeb71=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb71e[_0x411017];return _0x2adeea;};'use strict';var client=require('../client');exports[_0xeb71('0x0')]=function(){return function(){return client['Request'](_0xeb71('0x1'),{'options':{'raw':![],'attributes':['id',_0xeb71('0x2'),'timeout',_0xeb71('0x3')],'include':[{'model':'User','as':_0xeb71('0x4'),'attributes':['id',_0xeb71('0x2'),_0xeb71('0x5'),_0xeb71('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9b541fd..15a38f2 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 _0xe0a1=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xe0a1,0x10a));var _0x1e0a=function(_0x58b6fe,_0x1b20c4){_0x58b6fe=_0x58b6fe-0x0;var _0x12d78e=_0xe0a1[_0x58b6fe];return _0x12d78e;};'use strict';var client=require('../client');exports[_0x1e0a('0x0')]=function(_0x534556){return client[_0x1e0a('0x1')](_0x1e0a('0x2'),{'body':_0x534556,'log':'CreateOpenchannelQueueReport'});};exports[_0x1e0a('0x3')]=function(_0x248c57,_0x2de6da){return client['Request'](_0x1e0a('0x4'),{'body':_0x2de6da,'options':{'where':{'uniqueid':_0x248c57},'order':[['id',_0x1e0a('0x5')]],'limit':0x1},'log':_0x1e0a('0x4')});}; \ No newline at end of file +var _0xaac9=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0xaac9,0x1a4));var _0x9aac=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xaac9[_0x58b301];return _0x2171b3;};'use strict';var client=require(_0x9aac('0x0'));exports[_0x9aac('0x1')]=function(_0x59eaf2){return client[_0x9aac('0x2')](_0x9aac('0x3'),{'body':_0x59eaf2,'log':'CreateOpenchannelQueueReport'});};exports[_0x9aac('0x4')]=function(_0x4cb941,_0x4c7605){return client[_0x9aac('0x2')](_0x9aac('0x5'),{'body':_0x4c7605,'options':{'where':{'uniqueid':_0x4cb941},'order':[['id','DESC']],'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 4c45ebe..afe1cbd 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 _0xfe54=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xfe54,0x1ec));var _0x4fe5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfe54[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x4fe5('0x0')]=function(_0x91d2c1,_0x1c72ee){return client['Request'](_0x4fe5('0x1'),{'body':_0x1c72ee,'options':{'where':{'id':_0x91d2c1}},'log':_0x4fe5('0x2')});};exports['addTags']=function(_0x2c2d9d,_0x2b6dac){return client['Request'](_0x4fe5('0x3'),{'body':_0x2b6dac,'options':{'where':{'id':_0x2c2d9d}},'log':_0x4fe5('0x4')});}; \ No newline at end of file +var _0x44f2=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x5b7802,_0x2a1194){var _0x239c45=function(_0x4337f2){while(--_0x4337f2){_0x5b7802['push'](_0x5b7802['shift']());}};_0x239c45(++_0x2a1194);}(_0x44f2,0xc4));var _0x244f=function(_0xaa1cab,_0x5f54b2){_0xaa1cab=_0xaa1cab-0x0;var _0x48cbeb=_0x44f2[_0xaa1cab];return _0x48cbeb;};'use strict';var client=require(_0x244f('0x0'));exports[_0x244f('0x1')]=function(_0x2aabd2,_0x4b0c64){return client[_0x244f('0x2')](_0x244f('0x3'),{'body':_0x4b0c64,'options':{'where':{'id':_0x2aabd2}},'log':_0x244f('0x4')});};exports[_0x244f('0x5')]=function(_0x519e1a,_0x40ae1a){return client[_0x244f('0x2')](_0x244f('0x6'),{'body':_0x40ae1a,'options':{'where':{'id':_0x519e1a}},'log':_0x244f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d2ec808..6620473 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 _0x973b=['createSmsMessage','../client','create','Request'];(function(_0xab6961,_0x34eeab){var _0x22da33=function(_0x729226){while(--_0x729226){_0xab6961['push'](_0xab6961['shift']());}};_0x22da33(++_0x34eeab);}(_0x973b,0xb9));var _0xb973=function(_0x1b232b,_0x3d1740){_0x1b232b=_0x1b232b-0x0;var _0x157cf4=_0x973b[_0x1b232b];return _0x157cf4;};'use strict';var client=require(_0xb973('0x0'));exports[_0xb973('0x1')]=function(_0x105a4f){return client[_0xb973('0x2')]('CreateSmsMessage',{'body':_0x105a4f,'log':_0xb973('0x3')});}; \ No newline at end of file +var _0x6443=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6443,0xda));var _0x3644=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0x6443[_0x1b1f88];return _0x5045b9;};'use strict';var client=require(_0x3644('0x0'));exports[_0x3644('0x1')]=function(_0x49429d){return client[_0x3644('0x2')](_0x3644('0x3'),{'body':_0x49429d,'log':_0x3644('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3bd2c42..038db48 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 _0x4af9=['strategy','User','Agents','online','../client','getSmsQueues','name','timeout'];(function(_0x53edc6,_0x5cc3f0){var _0x4e5c8a=function(_0xa5a22f){while(--_0xa5a22f){_0x53edc6['push'](_0x53edc6['shift']());}};_0x4e5c8a(++_0x5cc3f0);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x94af('0x0'));exports[_0x94af('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x94af('0x2'),_0x94af('0x3'),_0x94af('0x4')],'include':[{'model':_0x94af('0x5'),'as':_0x94af('0x6'),'attributes':['id',_0x94af('0x2'),_0x94af('0x7'),'smsPause']}]},'log':_0x94af('0x1')});};}; \ No newline at end of file +var _0x33d0=['strategy','User','Agents','online','../client','getSmsQueues','Request','name'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x33d0,0x144));var _0x033d=function(_0x5d9d60,_0x27d60e){_0x5d9d60=_0x5d9d60-0x0;var _0x2c81a0=_0x33d0[_0x5d9d60];return _0x2c81a0;};'use strict';var client=require(_0x033d('0x0'));exports[_0x033d('0x1')]=function(){return function(){return client[_0x033d('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x033d('0x3'),'timeout',_0x033d('0x4')],'include':[{'model':_0x033d('0x5'),'as':_0x033d('0x6'),'attributes':['id','name',_0x033d('0x7'),'smsPause']}]},'log':_0x033d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6cf8a1f..1a1a6fc 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 _0x3134=['Request','UpdateSmsQueueReport','DESC','../client','CreateSmsQueueReport','update'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3134,0x99));var _0x4313=function(_0x3551ba,_0x2ddd9a){_0x3551ba=_0x3551ba-0x0;var _0x3a79f6=_0x3134[_0x3551ba];return _0x3a79f6;};'use strict';var client=require(_0x4313('0x0'));exports['create']=function(_0x36da89){return client['Request'](_0x4313('0x1'),{'body':_0x36da89,'log':_0x4313('0x1')});};exports[_0x4313('0x2')]=function(_0x3f1434,_0x28f52e){return client[_0x4313('0x3')](_0x4313('0x4'),{'body':_0x28f52e,'options':{'where':{'uniqueid':_0x3f1434},'order':[['id',_0x4313('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x8a21=['UpdateSmsQueueReport','DESC','../client','Request','CreateSmsQueueReport'];(function(_0x3f5217,_0xc26207){var _0x466723=function(_0x4a4e31){while(--_0x4a4e31){_0x3f5217['push'](_0x3f5217['shift']());}};_0x466723(++_0xc26207);}(_0x8a21,0x1d8));var _0x18a2=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0x8a21[_0x3a924d];return _0x2f9f0b;};'use strict';var client=require(_0x18a2('0x0'));exports['create']=function(_0x5a8f1f){return client[_0x18a2('0x1')](_0x18a2('0x2'),{'body':_0x5a8f1f,'log':_0x18a2('0x2')});};exports['update']=function(_0x5a8a45,_0x42b942){return client[_0x18a2('0x1')](_0x18a2('0x3'),{'body':_0x42b942,'options':{'where':{'uniqueid':_0x5a8a45},'order':[['id',_0x18a2('0x4')]],'limit':0x1},'log':_0x18a2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c17d832..7730a3b 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 _0x80f2=['whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','openchannelPause','mailCapacity','faxCapacity'];(function(_0x1106e0,_0x3b3f2e){var _0x12e020=function(_0x3b0e10){while(--_0x3b0e10){_0x1106e0['push'](_0x1106e0['shift']());}};_0x12e020(++_0x3b3f2e);}(_0x80f2,0x142));var _0x280f=function(_0x357500,_0x16ebef){_0x357500=_0x357500-0x0;var _0x5611e0=_0x80f2[_0x357500];return _0x5611e0;};'use strict';var client=require('../client');exports[_0x280f('0x0')]=function(){return function(){return client[_0x280f('0x1')](_0x280f('0x2'),{'options':{'raw':!![],'where':{'role':_0x280f('0x3')},'attributes':['id',_0x280f('0x4'),_0x280f('0x5'),_0x280f('0x6'),_0x280f('0x7'),_0x280f('0x8'),'chatPause',_0x280f('0x9'),_0x280f('0xa'),'smsPause','whatsappPause',_0x280f('0xb'),'chatCapacity',_0x280f('0xc'),_0x280f('0xd'),'smsCapacity',_0x280f('0xe'),_0x280f('0xf')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x81de=['faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','chatCapacity','mailCapacity'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0x81de,0x1c4));var _0xe81d=function(_0x4b7ccb,_0x5ab4bd){_0x4b7ccb=_0x4b7ccb-0x0;var _0x41aa57=_0x81de[_0x4b7ccb];return _0x41aa57;};'use strict';var client=require('../client');exports[_0xe81d('0x0')]=function(){return function(){return client[_0xe81d('0x1')](_0xe81d('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xe81d('0x3'),_0xe81d('0x4'),_0xe81d('0x5'),_0xe81d('0x6'),_0xe81d('0x7'),'chatPause',_0xe81d('0x8'),_0xe81d('0x9'),'smsPause','whatsappPause','openchannelPause',_0xe81d('0xa'),_0xe81d('0xb'),_0xe81d('0xc'),_0xe81d('0xd'),_0xe81d('0xe'),_0xe81d('0xf')]},'log':_0xe81d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 0348095..ad2541e 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 _0x97a2=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x212000,_0x248ef4){var _0x37a58e=function(_0x34e646){while(--_0x34e646){_0x212000['push'](_0x212000['shift']());}};_0x37a58e(++_0x248ef4);}(_0x97a2,0x1b1));var _0x297a=function(_0x462e42,_0x58397e){_0x462e42=_0x462e42-0x0;var _0x556819=_0x97a2[_0x462e42];return _0x556819;};'use strict';var client=require(_0x297a('0x0'));exports['update']=function(_0x46f976,_0x41ac57){return client[_0x297a('0x1')](_0x297a('0x2'),{'body':_0x41ac57,'options':{'where':{'id':_0x46f976}},'log':_0x297a('0x3')});};exports[_0x297a('0x4')]=function(_0x2cf730,_0x42a0a0){return client['Request'](_0x297a('0x5'),{'body':_0x42a0a0,'options':{'where':{'id':_0x2cf730}},'log':_0x297a('0x6')});}; \ No newline at end of file +var _0x5d55=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x413645,_0x25f334){var _0x13ab91=function(_0x286406){while(--_0x286406){_0x413645['push'](_0x413645['shift']());}};_0x13ab91(++_0x25f334);}(_0x5d55,0x1a4));var _0x55d5=function(_0x4d8b68,_0x3697b8){_0x4d8b68=_0x4d8b68-0x0;var _0x3da45c=_0x5d55[_0x4d8b68];return _0x3da45c;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2,_0x1de575){return client[_0x55d5('0x1')]('UpdateWhatsappInteraction',{'body':_0x1de575,'options':{'where':{'id':_0x4cd0e2}},'log':_0x55d5('0x2')});};exports[_0x55d5('0x3')]=function(_0x3bca0b,_0x546e6c){return client[_0x55d5('0x1')](_0x55d5('0x4'),{'body':_0x546e6c,'options':{'where':{'id':_0x3bca0b}},'log':_0x55d5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3638d72..9c5ec17 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 _0xf369=['../client','create','Request','CreateWhatsappMessage'];(function(_0x327f2a,_0x599148){var _0x368867=function(_0x25d9c4){while(--_0x25d9c4){_0x327f2a['push'](_0x327f2a['shift']());}};_0x368867(++_0x599148);}(_0xf369,0x1c8));var _0x9f36=function(_0x2bb1c6,_0xc5eea9){_0x2bb1c6=_0x2bb1c6-0x0;var _0x33155b=_0xf369[_0x2bb1c6];return _0x33155b;};'use strict';var client=require(_0x9f36('0x0'));exports[_0x9f36('0x1')]=function(_0x2eba33){return client[_0x9f36('0x2')](_0x9f36('0x3'),{'body':_0x2eba33,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xc17e=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x53e6fe,_0x3236cf){var _0x1e75b4=function(_0x18d3dd){while(--_0x18d3dd){_0x53e6fe['push'](_0x53e6fe['shift']());}};_0x1e75b4(++_0x3236cf);}(_0xc17e,0x1ad));var _0xec17=function(_0x2f6e47,_0x40ba6b){_0x2f6e47=_0x2f6e47-0x0;var _0x29c331=_0xc17e[_0x2f6e47];return _0x29c331;};'use strict';var client=require(_0xec17('0x0'));exports[_0xec17('0x1')]=function(_0x369226){return client[_0xec17('0x2')](_0xec17('0x3'),{'body':_0x369226,'log':_0xec17('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index dfa8794..8ad8ac6 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 _0xbee3=['User','Agents','whatsappPause','getWhatsappQueues','name','timeout'];(function(_0x161e72,_0x581c2c){var _0x37ec7d=function(_0x5acc24){while(--_0x5acc24){_0x161e72['push'](_0x161e72['shift']());}};_0x37ec7d(++_0x581c2c);}(_0xbee3,0xd5));var _0x3bee=function(_0x433f3a,_0x4b0a44){_0x433f3a=_0x433f3a-0x0;var _0x3ffefa=_0xbee3[_0x433f3a];return _0x3ffefa;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2'),'strategy'],'include':[{'model':_0x3bee('0x3'),'as':_0x3bee('0x4'),'attributes':['id',_0x3bee('0x1'),'online',_0x3bee('0x5')]}]},'log':_0x3bee('0x0')});};}; \ No newline at end of file +var _0x3266=['name','timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x445239,_0xfedccf){var _0xa6f4d5=function(_0x1f57b4){while(--_0x1f57b4){_0x445239['push'](_0x445239['shift']());}};_0xa6f4d5(++_0xfedccf);}(_0x3266,0x6a));var _0x6326=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x3266[_0x5ddaac];return _0x2a9c58;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'attributes':['id',_0x6326('0x4'),_0x6326('0x5'),_0x6326('0x6')],'include':[{'model':_0x6326('0x7'),'as':_0x6326('0x8'),'attributes':['id','name',_0x6326('0x9'),'whatsappPause']}]},'log':_0x6326('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 532723b..643bcd7 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 _0x34a7=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x285321,_0x47d0fb){var _0x40b9b6=function(_0x22669a){while(--_0x22669a){_0x285321['push'](_0x285321['shift']());}};_0x40b9b6(++_0x47d0fb);}(_0x34a7,0x1df));var _0x734a=function(_0x3588f5,_0x1bfc86){_0x3588f5=_0x3588f5-0x0;var _0x5a0809=_0x34a7[_0x3588f5];return _0x5a0809;};'use strict';var client=require(_0x734a('0x0'));exports[_0x734a('0x1')]=function(_0x2ab07f){return client['Request'](_0x734a('0x2'),{'body':_0x2ab07f,'log':_0x734a('0x2')});};exports[_0x734a('0x3')]=function(_0x62f10c,_0x51d32e){return client[_0x734a('0x4')](_0x734a('0x5'),{'body':_0x51d32e,'options':{'where':{'uniqueid':_0x62f10c},'order':[['id','DESC']],'limit':0x1},'log':_0x734a('0x5')});}; \ No newline at end of file +var _0xcc53=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x4a0dc8,_0x460c4f){var _0x4b2392=function(_0x7264e9){while(--_0x7264e9){_0x4a0dc8['push'](_0x4a0dc8['shift']());}};_0x4b2392(++_0x460c4f);}(_0xcc53,0xcc));var _0x3cc5=function(_0x21b6c0,_0x9b7744){_0x21b6c0=_0x21b6c0-0x0;var _0x3ca321=_0xcc53[_0x21b6c0];return _0x3ca321;};'use strict';var client=require(_0x3cc5('0x0'));exports[_0x3cc5('0x1')]=function(_0x5ada52){return client[_0x3cc5('0x2')](_0x3cc5('0x3'),{'body':_0x5ada52,'log':_0x3cc5('0x3')});};exports[_0x3cc5('0x4')]=function(_0x46e111,_0x2b9d83){return client['Request'](_0x3cc5('0x5'),{'body':_0x2b9d83,'options':{'where':{'uniqueid':_0x46e111},'order':[['id','DESC']],'limit':0x1},'log':_0x3cc5('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 c6d279f..8b84a2c 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 _0xa393=['routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger'];(function(_0xb043f7,_0x33645d){var _0x57c072=function(_0x4fbb3a){while(--_0x4fbb3a){_0xb043f7['push'](_0xb043f7['shift']());}};_0x57c072(++_0x33645d);}(_0xa393,0x171));var _0x3a39=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa393[_0x68c979];return _0x4f0001;};'use strict';var schema=require(_0x3a39('0x0'));var _=require(_0x3a39('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x3a39('0x2'))(_0x3a39('0x3'));var strategy=require(_0x3a39('0x4'));var queue=schema({'name':{'type':_0x3a39('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x3a39('0x6')}});function writeLog(_0x4235b8,_0x3c96d8,_0x49e5df){return logger[_0x3a39('0x7')](util[_0x3a39('0x8')](_0x3a39('0x9'),_0x4235b8,_0x3c96d8[_0x3a39('0xa')],_0x49e5df));}function handleFindAgent(_0x21a6d0){return function(_0x4e5a8f){return _0x4e5a8f['name'][_0x3a39('0xb')]()===_0x21a6d0[_0x3a39('0xb')]();};}exports[_0x3a39('0xc')]=function(_0x195d8d,_0x218c09,_0x31bc6f,_0x207f01){return function(_0x105d15){try{var _0x2f467e={'name':_0x218c09[0x0],'timeout':_0x218c09[0x1]};var _0x4987b7=queue['validate'](_0x2f467e,{'typecast':!![]});if(_0x4987b7[_0x3a39('0xd')]){logger[_0x3a39('0xe')]('[%s][AGENT]\x20%s',_0x195d8d,_[_0x3a39('0xf')](_0x4987b7,_0x3a39('0x10'))[_0x3a39('0x11')](',\x20'));_0x105d15[_0x3a39('0x12')]();}else{var _0x358992=_['find'](_0x31bc6f[_0x3a39('0x13')],handleFindAgent(_0x2f467e['name']));if(_0x358992){var _0x53cb61=(_0x2f467e[_0x3a39('0x14')]||0xa)*0x3e8;var _0x426de8,_0x1a5905;var _0x4a2dcf=seqqueue['createQueue'](_0x53cb61);_0x4a2dcf['id']=_0x195d8d;_0x4a2dcf['atimeout']=_0x53cb61;_0x4a2dcf[_0x3a39('0x15')]=_0x207f01['channel'];writeLog(_0x195d8d,_0x358992,util[_0x3a39('0x8')](_0x3a39('0x16'),_0x53cb61));_0x31bc6f[_0x3a39('0x17')][_0x195d8d]['on'](_0x3a39('0x18'),function(){logger[_0x3a39('0x7')](_0x3a39('0x19'),_0x195d8d);clearTimeout(_0x1a5905);_0x1a5905=undefined;_0x4a2dcf[_0x3a39('0x1a')]();if(_0x31bc6f[_0x3a39('0x17')][_0x195d8d]){delete _0x31bc6f['rules'][_0x195d8d];}_0x105d15[_0x3a39('0x12')]();});_0x31bc6f[_0x3a39('0x17')][_0x195d8d]['on']('complete',function(){if(_0x31bc6f[_0x3a39('0x17')][_0x195d8d]){delete _0x31bc6f[_0x3a39('0x17')][_0x195d8d];}});_0x1a5905=setTimeout(function(){logger[_0x3a39('0x7')](_0x3a39('0x1b'),_0x195d8d);clearTimeout(_0x1a5905);_0x4a2dcf[_0x3a39('0x1a')]();_0x105d15['next']();},_0x53cb61);strategy[_0x3a39('0x1c')](_0x4a2dcf,_0x358992,_0x31bc6f,_0x207f01);}else{logger[_0x3a39('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x195d8d,_0x2f467e[_0x3a39('0xa')]);_0x105d15[_0x3a39('0x12')]();}}}catch(_0x4db703){console['log'](_0x4db703);logger['error'](_0x3a39('0x1d'),_0x195d8d,_0x4db703[_0x3a39('0x1e')]);_0x105d15[_0x3a39('0x12')]();}};}; \ No newline at end of file +var _0xcdd9=['toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','routing','./strategy','string','number','info','format','name'];(function(_0xa96b73,_0x5d4c0c){var _0x4aacc7=function(_0x2b4e29){while(--_0x2b4e29){_0xa96b73['push'](_0xa96b73['shift']());}};_0x4aacc7(++_0x5d4c0c);}(_0xcdd9,0xc3));var _0x9cdd=function(_0x5b59f5,_0x36bf1a){_0x5b59f5=_0x5b59f5-0x0;var _0x484a52=_0xcdd9[_0x5b59f5];return _0x484a52;};'use strict';var schema=require('validate');var _=require(_0x9cdd('0x0'));var util=require(_0x9cdd('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x9cdd('0x2'));var strategy=require(_0x9cdd('0x3'));var queue=schema({'name':{'type':_0x9cdd('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9cdd('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x498284,_0x52c8c,_0x3f2c10){return logger[_0x9cdd('0x6')](util[_0x9cdd('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x498284,_0x52c8c[_0x9cdd('0x8')],_0x3f2c10));}function handleFindAgent(_0x4dd1c1){return function(_0x4c99){return _0x4c99['name'][_0x9cdd('0x9')]()===_0x4dd1c1[_0x9cdd('0x9')]();};}exports[_0x9cdd('0xa')]=function(_0x2abee5,_0xbd08f5,_0x41dedf,_0x2669b2){return function(_0x579375){try{var _0xdb4990={'name':_0xbd08f5[0x0],'timeout':_0xbd08f5[0x1]};var _0x1e77b4=queue[_0x9cdd('0xb')](_0xdb4990,{'typecast':!![]});if(_0x1e77b4['length']){logger[_0x9cdd('0xc')](_0x9cdd('0xd'),_0x2abee5,_[_0x9cdd('0xe')](_0x1e77b4,_0x9cdd('0xf'))[_0x9cdd('0x10')](',\x20'));_0x579375[_0x9cdd('0x11')]();}else{var _0x4b996c=_[_0x9cdd('0x12')](_0x41dedf[_0x9cdd('0x13')],handleFindAgent(_0xdb4990[_0x9cdd('0x8')]));if(_0x4b996c){var _0x3cd5e9=(_0xdb4990[_0x9cdd('0x14')]||0xa)*0x3e8;var _0xfab48d,_0x2b8762;var _0x1f8dd4=seqqueue[_0x9cdd('0x15')](_0x3cd5e9);_0x1f8dd4['id']=_0x2abee5;_0x1f8dd4[_0x9cdd('0x16')]=_0x3cd5e9;_0x1f8dd4[_0x9cdd('0x17')]=_0x2669b2[_0x9cdd('0x17')];writeLog(_0x2abee5,_0x4b996c,util[_0x9cdd('0x7')](_0x9cdd('0x18'),_0x3cd5e9));_0x41dedf['rules'][_0x2abee5]['on']('end',function(){logger[_0x9cdd('0x6')](_0x9cdd('0x19'),_0x2abee5);clearTimeout(_0x2b8762);_0x2b8762=undefined;_0x1f8dd4[_0x9cdd('0x1a')]();if(_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]){delete _0x41dedf[_0x9cdd('0x1b')][_0x2abee5];}_0x579375[_0x9cdd('0x11')]();});_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]['on']('complete',function(){if(_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]){delete _0x41dedf[_0x9cdd('0x1b')][_0x2abee5];}});_0x2b8762=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2abee5);clearTimeout(_0x2b8762);_0x1f8dd4['close']();_0x579375[_0x9cdd('0x1c')]();},_0x3cd5e9);strategy[_0x9cdd('0x1d')](_0x1f8dd4,_0x4b996c,_0x41dedf,_0x2669b2);}else{logger['error'](_0x9cdd('0x1e'),_0x2abee5,_0xdb4990[_0x9cdd('0x8')]);_0x579375['stop']();}}}catch(_0xc73f1){console[_0x9cdd('0x1f')](_0xc73f1);logger[_0x9cdd('0xc')](_0x9cdd('0x20'),_0x2abee5,_0xc73f1[_0x9cdd('0x21')]);_0x579375['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 1cced1b..46a8c48 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 _0x6f58=['postText','amazonlex','providerName','providerResponse','stringify','Failed','error','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','create','then','[%s][AMAZONLEX]\x20%s','body','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString'];(function(_0x5e1321,_0x5826eb){var _0x556c86=function(_0x1c5d94){while(--_0x1c5d94){_0x5e1321['push'](_0x5e1321['shift']());}};_0x556c86(++_0x5826eb);}(_0x6f58,0xf7));var _0x86f5=function(_0x34f9e8,_0x2018ac){_0x34f9e8=_0x34f9e8-0x0;var _0x3dcfa7=_0x6f58[_0x34f9e8];return _0x3dcfa7;};'use strict';var _=require(_0x86f5('0x0'));var moment=require(_0x86f5('0x1'));var AWS=require('aws-sdk');var utils=require(_0x86f5('0x2'));var logger=require(_0x86f5('0x3'))('routing');var rpc={'chatMessage':require(_0x86f5('0x4')),'openchannelMessage':require(_0x86f5('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x86f5('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x86f5('0x7'))};exports[_0x86f5('0x8')]=function(_0x199e71,_0x2c5581){return function(_0x43c422){try{if(!_[_0x86f5('0x9')](this[_0x86f5('0xa')][_0x86f5('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x199e71,_0x86f5('0xc'));return _0x43c422[_0x86f5('0xd')]();}var _0x3905b9={'ContactId':this[_0x86f5('0xe')]['id'],'sentAt':moment()[_0x86f5('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x86f5('0x10')};if(this[_0x86f5('0x11')]===_0x86f5('0x12')||this[_0x86f5('0x11')]===_0x86f5('0x13')){_0x3905b9['phone']=this['interaction'][_0x86f5('0x14')];}var _0x895efc=this[_0x86f5('0x11')];if(_0x895efc===_0x86f5('0x15')){_0x3905b9[_0x86f5('0x16')]=this['account']['id'];}else{_0x3905b9[_[_0x86f5('0x17')](_0x895efc)+_0x86f5('0x18')]=this[_0x86f5('0x19')]['id'];}_0x3905b9[_[_0x86f5('0x17')](_0x895efc)+_0x86f5('0x1a')]=this[_0x86f5('0xa')]['id'];if(this[_0x86f5('0xa')][_0x86f5('0x1b')]){var _0x1272e4=_0x2c5581[0x4];if(!_[_0x86f5('0x1c')](_0x1272e4)){_0x3905b9['body']=utils['getMustacheRender'](_0x1272e4,this);return rpc[_0x895efc+'Message'][_0x86f5('0x1d')](_0x3905b9)[_0x86f5('0x1e')](function(_0x406d37){logger['info'](_0x86f5('0x1f'),_0x199e71,_0x3905b9[_0x86f5('0x20')]);})['catch'](function(_0x5cd2d3){logger['error'](_0x86f5('0x1f'),_0x199e71,JSON['stringify'](_0x5cd2d3));})[_0x86f5('0x21')](function(){logger[_0x86f5('0x22')](_0x86f5('0x23'),_0x199e71);_0x43c422[_0x86f5('0x24')]();});}else{logger[_0x86f5('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x199e71);_0x43c422[_0x86f5('0x24')]();}}else{var _0x5c7935=this;var _0x1ee307=new AWS[(_0x86f5('0x25'))]({'accessKeyId':_0x2c5581[0x0],'secretAccessKey':_0x2c5581[0x1],'region':_0x2c5581[0x2]});var _0x12c91c={'botAlias':_0x86f5('0x26'),'botName':_0x2c5581[0x3],'inputText':this[_0x86f5('0x27')][_0x86f5('0x20')],'userId':this[_0x86f5('0x11')]+':'+this[_0x86f5('0xa')]['id'][_0x86f5('0x28')]()};_0x1ee307[_0x86f5('0x29')](_0x12c91c,function(_0x4de15a,_0x56f6f4){if(_0x4de15a){logger['error'](_0x86f5('0x1f'),_0x199e71,_0x4de15a[_0x86f5('0x27')]);_0x43c422['next']();}else if(_0x56f6f4&&_0x56f6f4[_0x86f5('0x27')]){_0x5c7935['body'][_0x86f5('0x2a')]=_0x56f6f4;_0x3905b9[_0x86f5('0x20')]=_0x56f6f4[_0x86f5('0x27')];_0x3905b9[_0x86f5('0x2b')]=_0x86f5('0x2a');_0x3905b9[_0x86f5('0x2c')]=JSON[_0x86f5('0x2d')](_0x56f6f4);return rpc[_0x895efc+'Message'][_0x86f5('0x1d')](_0x3905b9)[_0x86f5('0x1e')](function(_0x308389){logger[_0x86f5('0x22')](_0x86f5('0x1f'),_0x199e71,_0x3905b9[_0x86f5('0x20')]);if(_0x56f6f4['dialogState']==_0x86f5('0x2e')){_0x43c422['next']();}else{_0x43c422[_0x86f5('0x24')]();}})['catch'](function(_0x1817b1){logger[_0x86f5('0x2f')]('[%s][AMAZONLEX]\x20%s',_0x199e71,JSON[_0x86f5('0x2d')](_0x1817b1));_0x43c422['next']();});}else{_0x43c422[_0x86f5('0xd')]();}});}}catch(_0x647e5b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x199e71,JSON['stringify'](_0x647e5b));_0x43c422[_0x86f5('0x24')]();}};}; \ No newline at end of file +var _0xd009=['message','toString','postText','next','amazonlex','providerResponse','dialogState','Failed','stringify','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0xd009,0x191));var _0x9d00=function(_0x31d794,_0x160894){_0x31d794=_0x31d794-0x0;var _0x325661=_0xd009[_0x31d794];return _0x325661;};'use strict';var _=require(_0x9d00('0x0'));var moment=require(_0x9d00('0x1'));var AWS=require('aws-sdk');var utils=require(_0x9d00('0x2'));var logger=require(_0x9d00('0x3'))('routing');var rpc={'chatMessage':require(_0x9d00('0x4')),'openchannelMessage':require(_0x9d00('0x5')),'mailMessage':require(_0x9d00('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9d00('0x7')),'whatsappMessage':require(_0x9d00('0x8'))};exports[_0x9d00('0x9')]=function(_0x1bf149,_0x522b4c){return function(_0x19bdfa){try{if(!_[_0x9d00('0xa')](this[_0x9d00('0xb')][_0x9d00('0xc')])){logger['info'](_0x9d00('0xd'),_0x1bf149,_0x9d00('0xe'));return _0x19bdfa['next']();}var _0x59eab0={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9d00('0xf')](_0x9d00('0x10')),'direction':_0x9d00('0x11')};if(this[_0x9d00('0x12')]===_0x9d00('0x13')||this['channel']===_0x9d00('0x14')){_0x59eab0['phone']=this[_0x9d00('0xb')]['phone'];}var _0x371270=this[_0x9d00('0x12')];if(_0x371270===_0x9d00('0x15')){_0x59eab0[_0x9d00('0x16')]=this[_0x9d00('0x17')]['id'];}else{_0x59eab0[_[_0x9d00('0x18')](_0x371270)+_0x9d00('0x19')]=this[_0x9d00('0x17')]['id'];}_0x59eab0[_[_0x9d00('0x18')](_0x371270)+'InteractionId']=this[_0x9d00('0xb')]['id'];if(this['interaction'][_0x9d00('0x1a')]){var _0x3326c3=_0x522b4c[0x4];if(!_[_0x9d00('0x1b')](_0x3326c3)){_0x59eab0[_0x9d00('0x1c')]=utils[_0x9d00('0x1d')](_0x3326c3,this);return rpc[_0x371270+_0x9d00('0x1e')][_0x9d00('0x1f')](_0x59eab0)[_0x9d00('0x20')](function(_0x16bc09){logger['info'](_0x9d00('0xd'),_0x1bf149,_0x59eab0[_0x9d00('0x1c')]);})[_0x9d00('0x21')](function(_0x5dc4bc){logger[_0x9d00('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1bf149,JSON['stringify'](_0x5dc4bc));})[_0x9d00('0x23')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1bf149);_0x19bdfa['stop']();});}else{logger[_0x9d00('0x24')](_0x9d00('0x25'),_0x1bf149);_0x19bdfa[_0x9d00('0x26')]();}}else{var _0x179ac4=this;var _0x36fc02=new AWS['LexRuntime']({'accessKeyId':_0x522b4c[0x0],'secretAccessKey':_0x522b4c[0x1],'region':_0x522b4c[0x2]});var _0x145458={'botAlias':_0x9d00('0x27'),'botName':_0x522b4c[0x3],'inputText':this[_0x9d00('0x28')]['body'],'userId':this[_0x9d00('0x12')]+':'+this[_0x9d00('0xb')]['id'][_0x9d00('0x29')]()};_0x36fc02[_0x9d00('0x2a')](_0x145458,function(_0x3d630b,_0x3390b2){if(_0x3d630b){logger['error'](_0x9d00('0xd'),_0x1bf149,_0x3d630b[_0x9d00('0x28')]);_0x19bdfa[_0x9d00('0x2b')]();}else if(_0x3390b2&&_0x3390b2['message']){_0x179ac4[_0x9d00('0x1c')][_0x9d00('0x2c')]=_0x3390b2;_0x59eab0[_0x9d00('0x1c')]=_0x3390b2['message'];_0x59eab0['providerName']=_0x9d00('0x2c');_0x59eab0[_0x9d00('0x2d')]=JSON['stringify'](_0x3390b2);return rpc[_0x371270+_0x9d00('0x1e')]['create'](_0x59eab0)[_0x9d00('0x20')](function(_0x4330a8){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1bf149,_0x59eab0['body']);if(_0x3390b2[_0x9d00('0x2e')]==_0x9d00('0x2f')){_0x19bdfa[_0x9d00('0x2b')]();}else{_0x19bdfa['stop']();}})['catch'](function(_0x558c48){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bf149,JSON[_0x9d00('0x30')](_0x558c48));_0x19bdfa[_0x9d00('0x2b')]();});}else{_0x19bdfa[_0x9d00('0x2b')]();}});}}catch(_0x2d58bc){logger[_0x9d00('0x22')](_0x9d00('0xd'),_0x1bf149,JSON['stringify'](_0x2d58bc));_0x19bdfa[_0x9d00('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 5299240..5e8073d 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 _0xb5b9=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','mail','service','host','Smtp','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x4d9a8d,_0x14808f){var _0x31324b=function(_0x559123){while(--_0x559123){_0x4d9a8d['push'](_0x4d9a8d['shift']());}};_0x31324b(++_0x14808f);}(_0xb5b9,0x19a));var _0x9b5b=function(_0x2ec8b0,_0x7169b){_0x2ec8b0=_0x2ec8b0-0x0;var _0x565201=_0xb5b9[_0x2ec8b0];return _0x565201;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require(_0x9b5b('0x0'))(_0x9b5b('0x1'));var rpc={'chatMessage':require(_0x9b5b('0x2')),'openchannelMessage':require(_0x9b5b('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9b5b('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9b5b('0x5'))};var mailRpc=require('../../mailRpc');exports[_0x9b5b('0x6')]=function(_0x1216d8,_0x388267){return function(_0x17d2bb){try{if(_0x388267[0x0]==='1'&&(_[_0x9b5b('0x7')](this[_0x9b5b('0x8')][_0x9b5b('0x9')])||!this[_0x9b5b('0x8')]['created'])){logger[_0x9b5b('0xa')](_0x9b5b('0xb'),_0x1216d8,'Autoreply\x20already\x20sent');return _0x17d2bb['next']();}var _0x666ac=this[_0x9b5b('0xc')];var _0x1ac3c5={'body':utils[_0x9b5b('0xd')](_0x388267[0x1],this),'ContactId':this[_0x9b5b('0xe')]['id'],'sentAt':moment()[_0x9b5b('0xf')](_0x9b5b('0x10')),'direction':_0x9b5b('0x11')};if(this[_0x9b5b('0x12')]){_0x1ac3c5['to']=this[_0x9b5b('0x12')][_0x9b5b('0x13')]||'';_0x1ac3c5['cc']=this['message']['cc']||'';_0x1ac3c5[_0x9b5b('0x13')]=this[_0x9b5b('0x12')]['to']||'';_0x1ac3c5['phone']=this['message'][_0x9b5b('0x14')]||'';_0x1ac3c5[_0x9b5b('0x15')]=!![];if(this[_0x9b5b('0x12')][_0x9b5b('0x16')]){_0x1ac3c5[_0x9b5b('0x16')]='';_0x1ac3c5[_0x9b5b('0x16')]+=_['startsWith'](this[_0x9b5b('0x12')][_0x9b5b('0x16')],_0x9b5b('0x17'))?'':_0x9b5b('0x18');_0x1ac3c5['subject']+=this[_0x9b5b('0x12')][_0x9b5b('0x16')];}}if(this[_0x9b5b('0xc')]===_0x9b5b('0x19')){_0x1ac3c5[_0x9b5b('0x1a')]=this[_0x9b5b('0x1b')]['id'];}else{_0x1ac3c5[_[_0x9b5b('0x1c')](this['channel'])+'AccountId']=this['account']['id'];}_0x1ac3c5[_['upperFirst'](this['channel'])+_0x9b5b('0x1d')]=this[_0x9b5b('0x8')]['id'];if(rpc[this[_0x9b5b('0xc')]+_0x9b5b('0x1e')]){if(this[_0x9b5b('0xc')]===_0x9b5b('0x1f')){var _0x583d03={'tls':{'rejectUnauthorized':![]}};if(this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x20')]){_0x583d03[_0x9b5b('0x20')]=this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x20')];}else{_0x583d03[_0x9b5b('0x21')]=this['account'][_0x9b5b('0x22')][_0x9b5b('0x21')];_0x583d03['port']=this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x23')];_0x583d03['secure']=this[_0x9b5b('0x1b')][_0x9b5b('0x22')][_0x9b5b('0x24')];}if(this[_0x9b5b('0x1b')][_0x9b5b('0x22')]['authentication']){_0x583d03[_0x9b5b('0x25')]={'user':this[_0x9b5b('0x1b')]['Smtp'][_0x9b5b('0x26')],'pass':this[_0x9b5b('0x1b')][_0x9b5b('0x22')][_0x9b5b('0x27')]};}_0x1ac3c5[_0x9b5b('0x28')]=this[_0x9b5b('0x12')][_0x9b5b('0x29')];_0x1ac3c5[_0x9b5b('0x2a')]=_0x9b5b('0x2b')+_[_0x9b5b('0x2c')](_0x1ac3c5['body'],_0x9b5b('0x2d'),'','headers','auto-replied','All','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','body','next','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x875b,0x197));var _0xb875=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x875b[_0x25248b];return _0x509939;};'use strict';var _=require(_0xb875('0x0'));var moment=require(_0xb875('0x1'));var utils=require(_0xb875('0x2'));var logger=require('../../../../config/logger')(_0xb875('0x3'));var rpc={'chatMessage':require(_0xb875('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb875('0x5')),'faxMessage':require(_0xb875('0x6')),'whatsappMessage':require(_0xb875('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xb875('0x8')]=function(_0x5d5557,_0x297b2f){return function(_0x5b5b3c){try{if(_0x297b2f[0x0]==='1'&&(_[_0xb875('0x9')](this['interaction']['created'])||!this[_0xb875('0xa')][_0xb875('0xb')])){logger['info'](_0xb875('0xc'),_0x5d5557,_0xb875('0xd'));return _0x5b5b3c['next']();}var _0x1300cb=this['channel'];var _0x281044={'body':utils['getMustacheRender'](_0x297b2f[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0xb875('0xe')](_0xb875('0xf')),'direction':'out'};if(this['message']){_0x281044['to']=this[_0xb875('0x10')][_0xb875('0x11')]||'';_0x281044['cc']=this['message']['cc']||'';_0x281044['from']=this[_0xb875('0x10')]['to']||'';_0x281044[_0xb875('0x12')]=this[_0xb875('0x10')][_0xb875('0x12')]||'';_0x281044[_0xb875('0x13')]=!![];if(this[_0xb875('0x10')][_0xb875('0x14')]){_0x281044['subject']='';_0x281044[_0xb875('0x14')]+=_[_0xb875('0x15')](this[_0xb875('0x10')][_0xb875('0x14')],'Re:')?'':_0xb875('0x16');_0x281044['subject']+=this[_0xb875('0x10')][_0xb875('0x14')];}}if(this[_0xb875('0x17')]===_0xb875('0x18')){_0x281044[_0xb875('0x19')]=this['account']['id'];}else{_0x281044[_[_0xb875('0x1a')](this['channel'])+'AccountId']=this[_0xb875('0x1b')]['id'];}_0x281044[_[_0xb875('0x1a')](this['channel'])+'InteractionId']=this[_0xb875('0xa')]['id'];if(rpc[this[_0xb875('0x17')]+_0xb875('0x1c')]){if(this[_0xb875('0x17')]===_0xb875('0x1d')){var _0x49eecb={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xb875('0x1e')][_0xb875('0x1f')]){_0x49eecb[_0xb875('0x1f')]=this['account']['Smtp'][_0xb875('0x1f')];}else{_0x49eecb[_0xb875('0x20')]=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x20')];_0x49eecb['port']=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x21')];_0x49eecb[_0xb875('0x22')]=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x22')];}if(this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x23')]){_0x49eecb[_0xb875('0x24')]={'user':this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x25')],'pass':this['account'][_0xb875('0x1e')][_0xb875('0x26')]};}_0x281044[_0xb875('0x27')]=this['message']['messageId'];_0x281044['html']=''+_[_0xb875('0x28')](_0x281044['body'],_0xb875('0x29'),_0xb875('0x2a'))+_0xb875('0x2b');_0x281044[_0xb875('0x2c')]={'Auto-Submitted':_0xb875('0x2d'),'X-Auto-Response-Suppress':_0xb875('0x2e'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x49eecb,_0x281044)[_0xb875('0x2f')](function(_0x2eef03){logger[_0xb875('0x30')](_0xb875('0x31'),_0x5d5557);_0x281044[_0xb875('0x32')]=_0x2eef03[_0xb875('0x10')][_0xb875('0x32')];return rpc[_0x1300cb+_0xb875('0x1c')][_0xb875('0x33')](_0x281044);})['then'](function(_0x4d5fd5){logger[_0xb875('0x30')](_0xb875('0xc'),_0x5d5557,JSON[_0xb875('0x34')](_0x4d5fd5));})[_0xb875('0x35')](function(_0x1f0bc4){logger[_0xb875('0x36')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5d5557,JSON[_0xb875('0x34')](_0x1f0bc4));})[_0xb875('0x37')](function(){_0x5b5b3c['next']();});}else{return rpc[this[_0xb875('0x17')]+'Message'][_0xb875('0x33')](_0x281044)[_0xb875('0x2f')](function(_0x67d778){logger[_0xb875('0x30')]('[%s][AUTOREPLY]\x20%s',_0x5d5557,_0x281044[_0xb875('0x38')]);})['catch'](function(_0x246cbd){logger[_0xb875('0x36')](_0xb875('0xc'),_0x5d5557,JSON[_0xb875('0x34')](_0x246cbd));})[_0xb875('0x37')](function(){_0x5b5b3c[_0xb875('0x39')]();});}}}catch(_0x5aa614){logger['error']('[%s][AUTOREPLY]\x20%s',_0x5d5557,JSON[_0xb875('0x34')](_0x5aa614));_0x5b5b3c[_0xb875('0x3a')]();}};}; \ 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 1fe2a03..829ee33 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 _0xe574=['catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x16c351,_0x513460){var _0x21f18b=function(_0x5c3000){while(--_0x5c3000){_0x16c351['push'](_0x16c351['shift']());}};_0x21f18b(++_0x513460);}(_0xe574,0x100));var _0x4e57=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe574[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x4e57('0x0'));var logger=require('../../../../config/logger')(_0x4e57('0x1'));var rpc={'chatInteraction':require(_0x4e57('0x2')),'openchannelInteraction':require(_0x4e57('0x3')),'smsInteraction':require(_0x4e57('0x4')),'mailInteraction':require(_0x4e57('0x5')),'faxInteraction':require(_0x4e57('0x6')),'whatsappInteraction':require(_0x4e57('0x7'))};exports[_0x4e57('0x8')]=function(_0x4378ea,_0x4bbbd6,_0x436174,_0x2825a9){return function(_0x588b4e){try{logger['info'](_0x4e57('0x9'),_0x4378ea,_0x4bbbd6[0x0]);var _0x534df1={'closed':0x1,'closedAt':moment()['format'](_0x4e57('0xa')),'closeReason':_0x4e57('0xb'),'disposition':_0x4bbbd6[0x0]};if(rpc[_0x2825a9[_0x4e57('0xc')]+_0x4e57('0xd')]){rpc[_0x2825a9[_0x4e57('0xc')]+'Interaction'][_0x4e57('0xe')](_0x2825a9[_0x4e57('0xf')]['id'],_0x534df1)[_0x4e57('0x10')](function(_0x1e9cf8){logger[_0x4e57('0x11')](_0x4e57('0x12'),_0x4378ea,_0x2825a9[_0x4e57('0xf')]['id']);})[_0x4e57('0x13')](function(_0xed8cbc){logger[_0x4e57('0x14')](_0x4e57('0x15'),_0x4378ea,JSON[_0x4e57('0x16')](_0xed8cbc));})[_0x4e57('0x17')](function(){_0x588b4e[_0x4e57('0x18')]();});}}catch(_0x28f876){logger[_0x4e57('0x14')]('[%s][CLOSE]\x20%s',_0x4378ea,JSON[_0x4e57('0x16')](_0x28f876));_0x588b4e['stop']();}};}; \ No newline at end of file +var _0x6363=['finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x1c1a50,_0x54d4a8){_0x1c1a50=_0x1c1a50-0x0;var _0x4599d8=_0x6363[_0x1c1a50];return _0x4599d8;};'use strict';var moment=require(_0x3636('0x0'));var logger=require('../../../../config/logger')(_0x3636('0x1'));var rpc={'chatInteraction':require(_0x3636('0x2')),'openchannelInteraction':require(_0x3636('0x3')),'smsInteraction':require(_0x3636('0x4')),'mailInteraction':require(_0x3636('0x5')),'faxInteraction':require(_0x3636('0x6')),'whatsappInteraction':require(_0x3636('0x7'))};exports[_0x3636('0x8')]=function(_0x1e62e9,_0x3d616f,_0x15728f,_0x1f94ef){return function(_0xdc928c){try{logger[_0x3636('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x1e62e9,_0x3d616f[0x0]);var _0x19f917={'closed':0x1,'closedAt':moment()['format'](_0x3636('0xa')),'closeReason':_0x3636('0xb'),'disposition':_0x3d616f[0x0]};if(rpc[_0x1f94ef[_0x3636('0xc')]+_0x3636('0xd')]){rpc[_0x1f94ef[_0x3636('0xc')]+_0x3636('0xd')][_0x3636('0xe')](_0x1f94ef[_0x3636('0xf')]['id'],_0x19f917)[_0x3636('0x10')](function(_0x5d541e){logger['info'](_0x3636('0x11'),_0x1e62e9,_0x1f94ef['interaction']['id']);})[_0x3636('0x12')](function(_0x41ddae){logger[_0x3636('0x13')](_0x3636('0x14'),_0x1e62e9,JSON[_0x3636('0x15')](_0x41ddae));})[_0x3636('0x16')](function(){_0xdc928c[_0x3636('0x17')]();});}}catch(_0x12dfa9){logger[_0x3636('0x13')](_0x3636('0x14'),_0x1e62e9,JSON[_0x3636('0x15')](_0x12dfa9));_0xdc928c[_0x3636('0x17')]();}};}; \ 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 bc93e47..c768839 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 _0xe5b5=['moment','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.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','created','body','Message','create','catch','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','then','dialogflow','result','speech','providerName','metadata','endConversation','next','error','lodash'];(function(_0x3788af,_0x55a2ba){var _0x4228a1=function(_0x33bb49){while(--_0x33bb49){_0x3788af['push'](_0x3788af['shift']());}};_0x4228a1(++_0x55a2ba);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xe5b5[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0x5e5b('0x0'));var moment=require(_0x5e5b('0x1'));var apiai=require(_0x5e5b('0x2'));var md5=require(_0x5e5b('0x3'));var utils=require(_0x5e5b('0x4'));var logger=require(_0x5e5b('0x5'))(_0x5e5b('0x6'));var rpc={'chatMessage':require(_0x5e5b('0x7')),'openchannelMessage':require(_0x5e5b('0x8')),'mailMessage':require(_0x5e5b('0x9')),'smsMessage':require(_0x5e5b('0xa')),'faxMessage':require(_0x5e5b('0xb')),'whatsappMessage':require(_0x5e5b('0xc'))};exports[_0x5e5b('0xd')]=function(_0x545eb3,_0x29db2c){return function(_0xe089b1){try{if(!_[_0x5e5b('0xe')](this[_0x5e5b('0xf')][_0x5e5b('0x10')])){logger[_0x5e5b('0x11')](_0x5e5b('0x12'),_0x545eb3,_0x5e5b('0x13'));return _0xe089b1['next']();}var _0x300890={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5e5b('0x14')](_0x5e5b('0x15')),'direction':_0x5e5b('0x16')};if(this[_0x5e5b('0x17')]==='sms'||this['channel']==='whatsapp'){_0x300890[_0x5e5b('0x18')]=this[_0x5e5b('0xf')][_0x5e5b('0x18')];}var _0x1694ff=this[_0x5e5b('0x17')];if(_0x1694ff===_0x5e5b('0x19')){_0x300890[_0x5e5b('0x1a')]=this['account']['id'];}else{_0x300890[_[_0x5e5b('0x1b')](_0x1694ff)+_0x5e5b('0x1c')]=this['account']['id'];}_0x300890[_[_0x5e5b('0x1b')](_0x1694ff)+'InteractionId']=this['interaction']['id'];if(this[_0x5e5b('0xf')][_0x5e5b('0x1d')]){var _0xaf9ace=_0x29db2c[0x2];if(!_['isEmpty'](_0xaf9ace)){_0x300890[_0x5e5b('0x1e')]=utils['getMustacheRender'](_0xaf9ace,this);return rpc[_0x1694ff+_0x5e5b('0x1f')][_0x5e5b('0x20')](_0x300890)['then'](function(_0xe5aa6b){logger[_0x5e5b('0x11')](_0x5e5b('0x12'),_0x545eb3,_0x300890['body']);})[_0x5e5b('0x21')](function(_0x3f1103){logger['error'](_0x5e5b('0x12'),_0x545eb3,JSON[_0x5e5b('0x22')](_0x3f1103));})[_0x5e5b('0x23')](function(){logger[_0x5e5b('0x11')](_0x5e5b('0x24'),_0x545eb3);_0xe089b1[_0x5e5b('0x25')]();});}else{logger[_0x5e5b('0x11')](_0x5e5b('0x26'),_0x545eb3);_0xe089b1['stop']();}}else{var _0x512e46=this;var _0x256a00=apiai(_0x29db2c[0x0],{'language':_0x29db2c[0x1]||'en'});return _0x256a00[_0x5e5b('0x27')](this[_0x5e5b('0x28')][_0x5e5b('0x1e')],{'sessionId':md5(this[_0x5e5b('0xf')]['id'])})[_0x5e5b('0x29')](function(_0x135c6c){_0x512e46[_0x5e5b('0x1e')][_0x5e5b('0x2a')]=_0x135c6c;_0x300890[_0x5e5b('0x1e')]=_0x135c6c[_0x5e5b('0x2b')]['fulfillment'][_0x5e5b('0x2c')];_0x300890[_0x5e5b('0x2d')]=_0x5e5b('0x2a');_0x300890['providerResponse']=JSON[_0x5e5b('0x22')](_0x135c6c);return rpc[_0x1694ff+_0x5e5b('0x1f')]['create'](_0x300890)[_0x5e5b('0x29')](function(_0x21c74b){logger[_0x5e5b('0x11')](_0x5e5b('0x12'),_0x545eb3,_0x300890[_0x5e5b('0x1e')]);if(_0x135c6c[_0x5e5b('0x2b')][_0x5e5b('0x2e')][_0x5e5b('0x2f')]){_0xe089b1[_0x5e5b('0x30')]();}else{_0xe089b1[_0x5e5b('0x25')]();}})[_0x5e5b('0x21')](function(_0x28157a){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x545eb3,JSON[_0x5e5b('0x22')](_0x28157a));_0xe089b1[_0x5e5b('0x30')]();});})[_0x5e5b('0x21')](function(_0x3dcdab){logger[_0x5e5b('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x545eb3,_0x3dcdab[_0x5e5b('0x28')]);_0xe089b1['next']();});}}catch(_0x3f1041){logger[_0x5e5b('0x31')](_0x5e5b('0x12'),_0x545eb3,JSON[_0x5e5b('0x22')](_0x3f1041));_0xe089b1['stop']();}};}; \ No newline at end of file +var _0x831e=['out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','providerName','providerResponse','[%s][DIALOGFLOW]\x20%s','metadata','endConversation','error','stringify','message','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xdc5db8,_0x393678){var _0x31fa28=function(_0x5d285e){while(--_0x5d285e){_0xdc5db8['push'](_0xdc5db8['shift']());}};_0x31fa28(++_0x393678);}(_0x831e,0xb0));var _0xe831=function(_0x5ab987,_0x458637){_0x5ab987=_0x5ab987-0x0;var _0x384833=_0x831e[_0x5ab987];return _0x384833;};'use strict';var _=require(_0xe831('0x0'));var moment=require('moment');var apiai=require(_0xe831('0x1'));var md5=require(_0xe831('0x2'));var utils=require('./utils');var logger=require(_0xe831('0x3'))(_0xe831('0x4'));var rpc={'chatMessage':require(_0xe831('0x5')),'openchannelMessage':require(_0xe831('0x6')),'mailMessage':require(_0xe831('0x7')),'smsMessage':require(_0xe831('0x8')),'faxMessage':require(_0xe831('0x9')),'whatsappMessage':require(_0xe831('0xa'))};exports['consequence']=function(_0x582bcd,_0xe43687){return function(_0x3b9078){try{if(!_[_0xe831('0xb')](this[_0xe831('0xc')][_0xe831('0xd')])){logger[_0xe831('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x582bcd,_0xe831('0xf'));return _0x3b9078[_0xe831('0x10')]();}var _0x3eb85c={'ContactId':this[_0xe831('0x11')]['id'],'sentAt':moment()[_0xe831('0x12')](_0xe831('0x13')),'direction':_0xe831('0x14')};if(this[_0xe831('0x15')]===_0xe831('0x16')||this[_0xe831('0x15')]===_0xe831('0x17')){_0x3eb85c[_0xe831('0x18')]=this['interaction'][_0xe831('0x18')];}var _0x2cb850=this[_0xe831('0x15')];if(_0x2cb850===_0xe831('0x19')){_0x3eb85c[_0xe831('0x1a')]=this[_0xe831('0x1b')]['id'];}else{_0x3eb85c[_[_0xe831('0x1c')](_0x2cb850)+_0xe831('0x1d')]=this[_0xe831('0x1b')]['id'];}_0x3eb85c[_['upperFirst'](_0x2cb850)+'InteractionId']=this[_0xe831('0xc')]['id'];if(this[_0xe831('0xc')][_0xe831('0x1e')]){var _0x469c94=_0xe43687[0x2];if(!_[_0xe831('0x1f')](_0x469c94)){_0x3eb85c[_0xe831('0x20')]=utils[_0xe831('0x21')](_0x469c94,this);return rpc[_0x2cb850+_0xe831('0x22')][_0xe831('0x23')](_0x3eb85c)[_0xe831('0x24')](function(_0x1e0be2){logger[_0xe831('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x582bcd,_0x3eb85c[_0xe831('0x20')]);})[_0xe831('0x25')](function(_0x2a12f7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x582bcd,JSON['stringify'](_0x2a12f7));})['finally'](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x582bcd);_0x3b9078[_0xe831('0x26')]();});}else{logger[_0xe831('0xe')](_0xe831('0x27'),_0x582bcd);_0x3b9078[_0xe831('0x26')]();}}else{var _0x286619=this;var _0x48790d=apiai(_0xe43687[0x0],{'language':_0xe43687[0x1]||'en'});return _0x48790d['textRequest'](this['message'][_0xe831('0x20')],{'sessionId':md5(this[_0xe831('0xc')]['id'])})[_0xe831('0x24')](function(_0x3e22a8){_0x286619[_0xe831('0x20')][_0xe831('0x28')]=_0x3e22a8;_0x3eb85c[_0xe831('0x20')]=_0x3e22a8['result']['fulfillment']['speech'];_0x3eb85c[_0xe831('0x29')]='dialogflow';_0x3eb85c[_0xe831('0x2a')]=JSON['stringify'](_0x3e22a8);return rpc[_0x2cb850+_0xe831('0x22')][_0xe831('0x23')](_0x3eb85c)[_0xe831('0x24')](function(_0x14321a){logger[_0xe831('0xe')](_0xe831('0x2b'),_0x582bcd,_0x3eb85c['body']);if(_0x3e22a8['result'][_0xe831('0x2c')][_0xe831('0x2d')]){_0x3b9078[_0xe831('0x10')]();}else{_0x3b9078[_0xe831('0x26')]();}})[_0xe831('0x25')](function(_0x56ea67){logger[_0xe831('0x2e')]('[%s][DIALOGFLOW]\x20%s',_0x582bcd,JSON[_0xe831('0x2f')](_0x56ea67));_0x3b9078['next']();});})[_0xe831('0x25')](function(_0x57104a){logger[_0xe831('0x2e')](_0xe831('0x2b'),_0x582bcd,_0x57104a[_0xe831('0x30')]);_0x3b9078[_0xe831('0x10')]();});}}catch(_0x30230d){logger[_0xe831('0x2e')](_0xe831('0x2b'),_0x582bcd,JSON[_0xe831('0x2f')](_0x30230d));_0x3b9078[_0xe831('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 09337a0..287a1a4 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 _0x6f33=['message','dialogflow','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','sms','whatsapp','phone','account','upperFirst','AccountId','InteractionId','created','isEmpty','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','name','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next'];(function(_0x2f9310,_0x2b5fc5){var _0x1dbbd8=function(_0x5a9bb9){while(--_0x5a9bb9){_0x2f9310['push'](_0x2f9310['shift']());}};_0x1dbbd8(++_0x2b5fc5);}(_0x6f33,0xca));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var dialogflow=require(_0x36f3('0x0'));var md5=require('md5');var moment=require(_0x36f3('0x1'));var Promise=require(_0x36f3('0x2'));var logger=require(_0x36f3('0x3'))(_0x36f3('0x4'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x36f3('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x36f3('0x6')),'faxMessage':require(_0x36f3('0x7')),'whatsappMessage':require(_0x36f3('0x8'))};function createMessage(_0x5d9cb4,_0x523b5e,_0x47b4cb,_0x110210){return new Promise(function(_0x104a97,_0x1bd5f1){var _0x52c60c=_[_0x36f3('0x9')](_0x47b4cb);_0x52c60c[_0x36f3('0xa')]=_0x110210;return rpc[_0x523b5e+_0x36f3('0xb')][_0x36f3('0xc')](_0x52c60c)[_0x36f3('0xd')](function(){logger['info'](_0x36f3('0xe'),_0x5d9cb4,_0x52c60c['body']);_0x104a97();})[_0x36f3('0xf')](function(_0x465b8f){logger[_0x36f3('0x10')](_0x36f3('0xe'),_0x5d9cb4,JSON['stringify'](_0x465b8f));_0x1bd5f1(_0x465b8f);});});}exports[_0x36f3('0x11')]=function(_0x44566d,_0x48d09d){return function(_0x251fab){try{if(!_['isNil'](this[_0x36f3('0x12')][_0x36f3('0x13')])){logger[_0x36f3('0x14')](_0x36f3('0xe'),_0x44566d,_0x36f3('0x15'));return _0x251fab['next']();}var _0x363a64={'ContactId':this[_0x36f3('0x16')]['id'],'sentAt':moment()[_0x36f3('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x36f3('0x18')]===_0x36f3('0x19')||this[_0x36f3('0x18')]===_0x36f3('0x1a')){_0x363a64[_0x36f3('0x1b')]=this[_0x36f3('0x12')][_0x36f3('0x1b')];}var _0x47c9c7=this[_0x36f3('0x18')];if(_0x47c9c7==='chat'){_0x363a64['ChatWebsiteId']=this[_0x36f3('0x1c')]['id'];}else{_0x363a64[_[_0x36f3('0x1d')](_0x47c9c7)+_0x36f3('0x1e')]=this[_0x36f3('0x1c')]['id'];}_0x363a64[_[_0x36f3('0x1d')](_0x47c9c7)+_0x36f3('0x1f')]=this[_0x36f3('0x12')]['id'];if(this[_0x36f3('0x12')][_0x36f3('0x20')]){var _0x3cc6cf=_0x48d09d[0x4];if(!_[_0x36f3('0x21')](_0x3cc6cf)){_0x363a64[_0x36f3('0xa')]=utils['getMustacheRender'](_0x3cc6cf,this);return rpc[_0x47c9c7+_0x36f3('0xb')][_0x36f3('0xc')](_0x363a64)['then'](function(_0x36e8c2){logger[_0x36f3('0x14')](_0x36f3('0xe'),_0x44566d,_0x363a64[_0x36f3('0xa')]);})[_0x36f3('0xf')](function(_0x5ca972){logger[_0x36f3('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x44566d,JSON[_0x36f3('0x22')](_0x5ca972));})[_0x36f3('0x23')](function(){logger[_0x36f3('0x14')](_0x36f3('0x24'),_0x44566d);_0x251fab[_0x36f3('0x25')]();});}else{logger[_0x36f3('0x14')](_0x36f3('0x26'),_0x44566d);_0x251fab[_0x36f3('0x25')]();}}else{var _0x2e33a4=this;var _0x2d279e=_0x48d09d[0x2][_0x36f3('0x27')](/\\n/g,'\x0a');var _0x331dc9={'credentials':{'private_key':_0x2d279e,'client_email':_0x48d09d[0x1]}};var _0x51f540=new dialogflow['SessionsClient'](_0x331dc9);var _0x14317a=_0x51f540[_0x36f3('0x28')](_0x48d09d[0x0],md5(_0x2e33a4['interaction']['id']));var _0x16ef17={'session':_0x14317a,'queryInput':{'text':{'text':_0x2e33a4['message']['body'],'languageCode':_0x48d09d[0x3]||'en'}}};return _0x51f540['detectIntent'](_0x16ef17)[_0x36f3('0xd')](function(_0x1dc7a5){if(_0x1dc7a5&&_0x1dc7a5[_0x36f3('0x29')]){_0x2e33a4[_0x36f3('0xa')][_0x36f3('0x2a')]=_0x1dc7a5;var _0x4f88a3=_0x1dc7a5[0x0];var _0x21ebe4=_0x4f88a3[_0x36f3('0x2b')]['diagnosticInfo']&&_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x2c')]['fields']?_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x2c')][_0x36f3('0x2d')][_0x36f3('0x2e')]['boolValue']:![];_0x2e33a4[_0x36f3('0xa')]['DIALOGFLOWV2_ACTION']=_0x4f88a3['queryResult'][_0x36f3('0x2f')];_0x2e33a4[_0x36f3('0xa')][_0x36f3('0x30')]=_0x4f88a3['queryResult'][_0x36f3('0x31')];_0x2e33a4[_0x36f3('0xa')][_0x36f3('0x32')]=_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x2c')]&&_0x4f88a3['queryResult'][_0x36f3('0x2c')][_0x36f3('0x2d')]?_0x4f88a3['queryResult'][_0x36f3('0x2c')][_0x36f3('0x2d')]['end_conversation'][_0x36f3('0x33')]:![];_0x2e33a4[_0x36f3('0xa')]['DIALOGFLOWV2_INTENTNAME']=_0x4f88a3[_0x36f3('0x2b')]['intent'][_0x36f3('0x34')];_0x2e33a4[_0x36f3('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x35')][_0x36f3('0x36')];_0x2e33a4[_0x36f3('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x35')][_0x36f3('0x37')];_0x2e33a4[_0x36f3('0xa')][_0x36f3('0x38')]=_0x4f88a3[_0x36f3('0x2b')]['languageCode'];_0x2e33a4['body']['DIALOGFLOWV2_QUERYTEXT']=_0x4f88a3['queryResult'][_0x36f3('0x39')];_0x2e33a4[_0x36f3('0xa')][_0x36f3('0x3a')]=_0x4f88a3[_0x36f3('0x2b')][_0x36f3('0x3b')];_0x363a64[_0x36f3('0x3c')]=_0x36f3('0x2a');_0x363a64[_0x36f3('0x3d')]=JSON['stringify'](_0x1dc7a5);var _0x91af6a=[];for(var _0x27f85b=0x0;_0x27f85b<_0x1dc7a5[_0x36f3('0x29')];_0x27f85b++){var _0x3c3976=_0x1dc7a5[_0x27f85b];if(_0x3c3976&&_0x3c3976[_0x36f3('0x2b')]&&_0x3c3976[_0x36f3('0x2b')][_0x36f3('0x3e')]){_0x91af6a[_0x36f3('0x3f')](createMessage(_0x44566d,_0x47c9c7,_0x363a64,_0x3c3976[_0x36f3('0x2b')][_0x36f3('0x3e')]));}}return Promise[_0x36f3('0x40')](_0x91af6a)['then'](function(){if(_0x21ebe4){_0x251fab['next']();}else{_0x251fab[_0x36f3('0x25')]();}})[_0x36f3('0xf')](function(_0x1febcd){logger[_0x36f3('0x10')](_0x36f3('0xe'),_0x44566d,JSON[_0x36f3('0x22')](_0x1febcd));_0x251fab[_0x36f3('0x41')]();});}})[_0x36f3('0xf')](function(_0x58a501){logger['error'](_0x36f3('0xe'),_0x44566d,_0x58a501[_0x36f3('0x42')]);_0x251fab[_0x36f3('0x41')]();});}}catch(_0x416502){logger[_0x36f3('0x10')](_0x36f3('0xe'),_0x44566d,JSON[_0x36f3('0x22')](_0x416502));_0x251fab['stop']();}};}; \ No newline at end of file +var _0x6aa9=['displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','next','catch','lodash','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','clone','body','then','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','UserId','info','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name'];(function(_0x107ad4,_0xab04b2){var _0x24b7e3=function(_0x24a42a){while(--_0x24a42a){_0x107ad4['push'](_0x107ad4['shift']());}};_0x24b7e3(++_0xab04b2);}(_0x6aa9,0xd7));var _0x96aa=function(_0x39d4a9,_0x2db371){_0x39d4a9=_0x39d4a9-0x0;var _0x8a9a21=_0x6aa9[_0x39d4a9];return _0x8a9a21;};'use strict';var _=require(_0x96aa('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x96aa('0x1'));var Promise=require(_0x96aa('0x2'));var logger=require(_0x96aa('0x3'))(_0x96aa('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x96aa('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x96aa('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1b7534,_0x2c84af,_0x15681b,_0x24bb9f){return new Promise(function(_0x10cbfc,_0x456b01){var _0x5b3ba0=_[_0x96aa('0x7')](_0x15681b);_0x5b3ba0[_0x96aa('0x8')]=_0x24bb9f;return rpc[_0x2c84af+'Message']['create'](_0x5b3ba0)[_0x96aa('0x9')](function(){logger['info'](_0x96aa('0xa'),_0x1b7534,_0x5b3ba0[_0x96aa('0x8')]);_0x10cbfc();})['catch'](function(_0x3782eb){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x1b7534,JSON[_0x96aa('0xc')](_0x3782eb));_0x456b01(_0x3782eb);});});}exports[_0x96aa('0xd')]=function(_0x279838,_0x48a3e4){return function(_0x333817){try{if(!_['isNil'](this[_0x96aa('0xe')][_0x96aa('0xf')])){logger[_0x96aa('0x10')](_0x96aa('0xa'),_0x279838,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x333817['next']();}var _0x255b80={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x96aa('0x11')),'direction':_0x96aa('0x12')};if(this[_0x96aa('0x13')]==='sms'||this[_0x96aa('0x13')]===_0x96aa('0x14')){_0x255b80[_0x96aa('0x15')]=this[_0x96aa('0xe')][_0x96aa('0x15')];}var _0x568db4=this[_0x96aa('0x13')];if(_0x568db4===_0x96aa('0x16')){_0x255b80[_0x96aa('0x17')]=this[_0x96aa('0x18')]['id'];}else{_0x255b80[_[_0x96aa('0x19')](_0x568db4)+'AccountId']=this['account']['id'];}_0x255b80[_[_0x96aa('0x19')](_0x568db4)+_0x96aa('0x1a')]=this[_0x96aa('0xe')]['id'];if(this['interaction']['created']){var _0x3a9b93=_0x48a3e4[0x4];if(!_[_0x96aa('0x1b')](_0x3a9b93)){_0x255b80['body']=utils[_0x96aa('0x1c')](_0x3a9b93,this);return rpc[_0x568db4+_0x96aa('0x1d')][_0x96aa('0x1e')](_0x255b80)['then'](function(_0x4129cd){logger[_0x96aa('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x279838,_0x255b80[_0x96aa('0x8')]);})['catch'](function(_0x3a5b2c){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x279838,JSON[_0x96aa('0xc')](_0x3a5b2c));})[_0x96aa('0x1f')](function(){logger[_0x96aa('0x10')](_0x96aa('0x20'),_0x279838);_0x333817[_0x96aa('0x21')]();});}else{logger[_0x96aa('0x10')](_0x96aa('0x22'),_0x279838);_0x333817['stop']();}}else{var _0x234c4e=this;var _0x24ef20=_0x48a3e4[0x2]['replace'](/\\n/g,'\x0a');var _0x79d93e={'credentials':{'private_key':_0x24ef20,'client_email':_0x48a3e4[0x1]}};var _0x24b629=new dialogflow[(_0x96aa('0x23'))](_0x79d93e);var _0x5e0bd5=_0x24b629[_0x96aa('0x24')](_0x48a3e4[0x0],md5(_0x234c4e[_0x96aa('0xe')]['id']));var _0x4229f0={'session':_0x5e0bd5,'queryInput':{'text':{'text':_0x234c4e[_0x96aa('0x25')]['body'],'languageCode':_0x48a3e4[0x3]||'en'}}};return _0x24b629[_0x96aa('0x26')](_0x4229f0)[_0x96aa('0x9')](function(_0x1601ab){if(_0x1601ab&&_0x1601ab['length']){_0x234c4e['body'][_0x96aa('0x27')]=_0x1601ab;var _0x3a60a6=_0x1601ab[0x0];var _0x2455c2=_0x3a60a6['queryResult']['diagnosticInfo']&&_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')]['fields']?_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')][_0x96aa('0x2b')][_0x96aa('0x2c')]:![];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x2d')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x2e')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x2f')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x30')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x31')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')]&&_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')]?_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')][_0x96aa('0x2b')]['boolValue']:![];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x32')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x33')][_0x96aa('0x34')];_0x234c4e[_0x96aa('0x8')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x33')][_0x96aa('0x35')];_0x234c4e['body'][_0x96aa('0x36')]=_0x3a60a6[_0x96aa('0x28')]['intent'][_0x96aa('0x37')];_0x234c4e[_0x96aa('0x8')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x38')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x39')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x3a')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x3b')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x3c')];_0x255b80[_0x96aa('0x3d')]=_0x96aa('0x27');_0x255b80[_0x96aa('0x3e')]=JSON[_0x96aa('0xc')](_0x1601ab);var _0x571ae0=[];for(var _0x34cd00=0x0;_0x34cd00<_0x1601ab['length'];_0x34cd00++){var _0x56d5cd=_0x1601ab[_0x34cd00];if(_0x56d5cd&&_0x56d5cd[_0x96aa('0x28')]&&_0x56d5cd[_0x96aa('0x28')][_0x96aa('0x3f')]){_0x571ae0[_0x96aa('0x40')](createMessage(_0x279838,_0x568db4,_0x255b80,_0x56d5cd[_0x96aa('0x28')][_0x96aa('0x3f')]));}}return Promise['all'](_0x571ae0)[_0x96aa('0x9')](function(){if(_0x2455c2){_0x333817[_0x96aa('0x41')]();}else{_0x333817['stop']();}})[_0x96aa('0x42')](function(_0xa68a31){logger[_0x96aa('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x279838,JSON[_0x96aa('0xc')](_0xa68a31));_0x333817[_0x96aa('0x41')]();});}})[_0x96aa('0x42')](function(_0x3514b4){logger['error'](_0x96aa('0xa'),_0x279838,_0x3514b4[_0x96aa('0x25')]);_0x333817[_0x96aa('0x41')]();});}}catch(_0x920e42){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x279838,JSON['stringify'](_0x920e42));_0x333817[_0x96aa('0x21')]();}};}; \ 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 1594652..08bc279 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 _0x7edc=['html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate'];(function(_0x5647eb,_0x29940c){var _0x10879c=function(_0x2d106b){while(--_0x2d106b){_0x5647eb['push'](_0x5647eb['shift']());}};_0x10879c(++_0x29940c);}(_0x7edc,0x179));var _0xc7ed=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x7edc[_0x5d7227];return _0x15ac55;};'use strict';var schema=require(_0xc7ed('0x0'));var _=require('lodash');var htmlToText=require(_0xc7ed('0x1'));var utils=require(_0xc7ed('0x2'));var logger=require(_0xc7ed('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xc7ed('0x4'),'required':!![],'message':_0xc7ed('0x5')},'priorityTrue':{'type':_0xc7ed('0x6'),'message':_0xc7ed('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc7ed('0x8')]=function(_0x2cb8c8,_0x3285a8){return function(_0x2ee4fb){try{var _0x2ddb7a={'condition':htmlToText[_0xc7ed('0x9')](utils['getMustacheRender'](_0x3285a8[0x0],this),{'wordwrap':![]})[_0xc7ed('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3285a8[0x1],'priorityFalse':_0x3285a8[0x2]};var _0x535aeb=gotoif[_0xc7ed('0x0')](_0x2ddb7a,{'typecast':!![]});if(_0x535aeb[_0xc7ed('0xb')]){logger[_0xc7ed('0xc')](_0xc7ed('0xd'),_0x2cb8c8,_[_0xc7ed('0xe')](_0x535aeb,_0xc7ed('0xf'))[_0xc7ed('0x10')](',\x20'));_0x2ee4fb[_0xc7ed('0x11')]();}else{try{var _0x3d911f=eval('('+_0x2ddb7a[_0xc7ed('0x12')]+')');var _0xf9f8e9=_0x3d911f?_0x2ddb7a[_0xc7ed('0x13')]:_0x2ddb7a['priorityFalse'];logger[_0xc7ed('0x14')](_0xc7ed('0x15'),_0x2cb8c8,_0x2ddb7a['condition'],_0x3d911f,_0xf9f8e9||_0xc7ed('0x16'));if(_0xf9f8e9){var _0xd96383=_['findIndex'](_0x2ee4fb['rules'](),{'p':_0xf9f8e9});if(_0xd96383>=0x0){logger[_0xc7ed('0x14')](_0xc7ed('0x17'),_0x2cb8c8,_0xf9f8e9||'next',_0xd96383);_0x2ee4fb['next'](_0xd96383);}else{logger[_0xc7ed('0x14')](_0xc7ed('0x18'),_0x2cb8c8,_0xf9f8e9||_0xc7ed('0x16'));_0x2ee4fb[_0xc7ed('0x11')]();}}else{_0x2ee4fb[_0xc7ed('0x16')]();}}catch(_0x28d1c1){logger[_0xc7ed('0xc')](_0xc7ed('0x19'),_0x2cb8c8,_0x28d1c1[_0xc7ed('0xf')]);_0x2ee4fb[_0xc7ed('0x11')]();}}}catch(_0x132fca){logger[_0xc7ed('0xc')]('[%s][GOTOIF]\x20%s',_0x2cb8c8,JSON[_0xc7ed('0x1a')](_0x132fca));_0x2ee4fb['stop']();}};}; \ No newline at end of file +var _0xfb71=['priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3b7ec9,_0x51f6da){var _0x194886=function(_0x254516){while(--_0x254516){_0x3b7ec9['push'](_0x3b7ec9['shift']());}};_0x194886(++_0x51f6da);}(_0xfb71,0x9d));var _0x1fb7=function(_0x33c4be,_0x4e7f93){_0x33c4be=_0x33c4be-0x0;var _0x29f518=_0xfb71[_0x33c4be];return _0x29f518;};'use strict';var schema=require(_0x1fb7('0x0'));var _=require('lodash');var htmlToText=require(_0x1fb7('0x1'));var utils=require('./utils');var logger=require(_0x1fb7('0x2'))('routing');var gotoif=schema({'condition':{'type':_0x1fb7('0x3'),'required':!![],'message':_0x1fb7('0x4')},'priorityTrue':{'type':'number','message':_0x1fb7('0x5')},'priorityFalse':{'type':_0x1fb7('0x6'),'message':_0x1fb7('0x7')}});exports[_0x1fb7('0x8')]=function(_0x34e491,_0x3ad786){return function(_0x5019d8){try{var _0x432340={'condition':htmlToText['fromString'](utils[_0x1fb7('0x9')](_0x3ad786[0x0],this),{'wordwrap':![]})[_0x1fb7('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3ad786[0x1],'priorityFalse':_0x3ad786[0x2]};var _0x3cecf0=gotoif[_0x1fb7('0x0')](_0x432340,{'typecast':!![]});if(_0x3cecf0[_0x1fb7('0xb')]){logger['error'](_0x1fb7('0xc'),_0x34e491,_[_0x1fb7('0xd')](_0x3cecf0,_0x1fb7('0xe'))[_0x1fb7('0xf')](',\x20'));_0x5019d8['stop']();}else{try{var _0x38fc87=eval('('+_0x432340[_0x1fb7('0x10')]+')');var _0x3cffea=_0x38fc87?_0x432340['priorityTrue']:_0x432340['priorityFalse'];logger[_0x1fb7('0x11')](_0x1fb7('0x12'),_0x34e491,_0x432340[_0x1fb7('0x10')],_0x38fc87,_0x3cffea||'next');if(_0x3cffea){var _0x34b9af=_[_0x1fb7('0x13')](_0x5019d8[_0x1fb7('0x14')](),{'p':_0x3cffea});if(_0x34b9af>=0x0){logger[_0x1fb7('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34e491,_0x3cffea||'next',_0x34b9af);_0x5019d8[_0x1fb7('0x15')](_0x34b9af);}else{logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x34e491,_0x3cffea||'next');_0x5019d8[_0x1fb7('0x17')]();}}else{_0x5019d8[_0x1fb7('0x15')]();}}catch(_0x4c3d36){logger[_0x1fb7('0x18')](_0x1fb7('0x19'),_0x34e491,_0x4c3d36[_0x1fb7('0xe')]);_0x5019d8[_0x1fb7('0x17')]();}}}catch(_0x5a9727){logger[_0x1fb7('0x18')]('[%s][GOTOIF]\x20%s',_0x34e491,JSON[_0x1fb7('0x1a')](_0x5a9727));_0x5019d8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 7717a15..3432da1 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 _0x6767=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','number','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x35d5d6,_0x3a580d){var _0x131132=function(_0x51ed54){while(--_0x51ed54){_0x35d5d6['push'](_0x35d5d6['shift']());}};_0x131132(++_0x3a580d);}(_0x6767,0xab));var _0x7676=function(_0x5e218a,_0x52be84){_0x5e218a=_0x5e218a-0x0;var _0x2a1564=_0x6767[_0x5e218a];return _0x2a1564;};'use strict';var schema=require(_0x7676('0x0'));var _=require(_0x7676('0x1'));var logger=require(_0x7676('0x2'))('routing');var gotop=schema({'priority':{'type':_0x7676('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x19dd1c,_0x2b2700){return function(_0x4c45c8){try{var _0x3c752c={'priority':_0x2b2700[0x0]};var _0x33fe5f=gotop[_0x7676('0x0')](_0x3c752c,{'typecast':!![]});if(_0x33fe5f[_0x7676('0x4')]){logger[_0x7676('0x5')](_0x7676('0x6'),_0x19dd1c,_[_0x7676('0x7')](_0x33fe5f,_0x7676('0x8'))['join'](',\x20'));_0x4c45c8['stop']();}else{logger[_0x7676('0x9')](_0x7676('0xa'),_0x19dd1c,_0x3c752c[_0x7676('0xb')]);if(_0x3c752c[_0x7676('0xb')]){var _0x56e8f6=_[_0x7676('0xc')](_0x4c45c8[_0x7676('0xd')](),{'p':_0x3c752c['priority']});if(_0x56e8f6>=0x0){logger[_0x7676('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x19dd1c,_0x3c752c[_0x7676('0xb')]||_0x7676('0xe'),_0x56e8f6);_0x4c45c8[_0x7676('0xe')](_0x56e8f6);}else{logger['info'](_0x7676('0xf'),_0x19dd1c,_0x3c752c[_0x7676('0xb')]||_0x7676('0xe'));_0x4c45c8[_0x7676('0x10')]();}}else{_0x4c45c8[_0x7676('0xe')]();}}}catch(_0x4473d1){logger[_0x7676('0x5')](_0x7676('0x6'),_0x19dd1c,JSON[_0x7676('0x11')](_0x4473d1));_0x4c45c8[_0x7676('0x10')]();}};}; \ No newline at end of file +var _0xda90=['error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','priority'];(function(_0x384319,_0x2e0250){var _0x497e8c=function(_0x4c8a50){while(--_0x4c8a50){_0x384319['push'](_0x384319['shift']());}};_0x497e8c(++_0x2e0250);}(_0xda90,0xb6));var _0x0da9=function(_0x33493f,_0x9c3a8e){_0x33493f=_0x33493f-0x0;var _0x567c42=_0xda90[_0x33493f];return _0x567c42;};'use strict';var schema=require(_0x0da9('0x0'));var _=require('lodash');var logger=require(_0x0da9('0x1'))(_0x0da9('0x2'));var gotop=schema({'priority':{'type':_0x0da9('0x3'),'required':!![],'message':_0x0da9('0x4')}});exports[_0x0da9('0x5')]=function(_0x4ccb8d,_0x29f90e){return function(_0x1ce847){try{var _0x5d30c4={'priority':_0x29f90e[0x0]};var _0x395656=gotop[_0x0da9('0x0')](_0x5d30c4,{'typecast':!![]});if(_0x395656[_0x0da9('0x6')]){logger['error'](_0x0da9('0x7'),_0x4ccb8d,_['map'](_0x395656,_0x0da9('0x8'))[_0x0da9('0x9')](',\x20'));_0x1ce847[_0x0da9('0xa')]();}else{logger[_0x0da9('0xb')](_0x0da9('0xc'),_0x4ccb8d,_0x5d30c4['priority']);if(_0x5d30c4['priority']){var _0x17ed5e=_[_0x0da9('0xd')](_0x1ce847['rules'](),{'p':_0x5d30c4['priority']});if(_0x17ed5e>=0x0){logger[_0x0da9('0xb')](_0x0da9('0xe'),_0x4ccb8d,_0x5d30c4['priority']||_0x0da9('0xf'),_0x17ed5e);_0x1ce847['next'](_0x17ed5e);}else{logger['info'](_0x0da9('0x10'),_0x4ccb8d,_0x5d30c4[_0x0da9('0x11')]||_0x0da9('0xf'));_0x1ce847[_0x0da9('0xa')]();}}else{_0x1ce847['next']();}}}catch(_0x3689ff){logger[_0x0da9('0x12')]('[%s][GOTOP]\x20%s',_0x4ccb8d,JSON[_0x0da9('0x13')](_0x3689ff));_0x1ce847[_0x0da9('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 1370757..35e0667 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 _0x67e5=['./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','error'];(function(_0xf69009,_0x279b8d){var _0x4e3226=function(_0x2a9952){while(--_0x2a9952){_0xf69009['push'](_0xf69009['shift']());}};_0x4e3226(++_0x279b8d);}(_0x67e5,0xfd));var _0x567e=function(_0x42221e,_0xf6a32e){_0x42221e=_0x42221e-0x0;var _0x436d0f=_0x67e5[_0x42221e];return _0x436d0f;};'use strict';var _=require('lodash');var utils=require(_0x567e('0x0'));var logger=require(_0x567e('0x1'))('routing');var rpc={'chatMessage':require(_0x567e('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x567e('0x3')),'faxMessage':require(_0x567e('0x4')),'whatsappMessage':require(_0x567e('0x5'))};exports['consequence']=function(_0x2255ce,_0x2df44a){return function(_0x88fe16){try{var _0x1a6005={'body':utils['getMustacheRender'](_0x2df44a[0x0],this),'ContactId':this[_0x567e('0x6')]['id']};if(this[_0x567e('0x7')]==='chat'){_0x1a6005[_0x567e('0x8')]=this['account']['id'];}else{_0x1a6005[_[_0x567e('0x9')](this[_0x567e('0x7')])+_0x567e('0xa')]=this[_0x567e('0xb')]['id'];}_0x1a6005[_[_0x567e('0x9')](this['channel'])+_0x567e('0xc')]=this[_0x567e('0xd')]['id'];if(rpc[this[_0x567e('0x7')]+'Message']){return rpc[this[_0x567e('0x7')]+'Message'][_0x567e('0xe')](_0x1a6005)[_0x567e('0xf')](function(_0x5371df){logger[_0x567e('0x10')](_0x567e('0x11'),_0x2255ce,_0x1a6005['body']);_0x88fe16[_0x567e('0x12')]();})[_0x567e('0x13')](function(_0x14ec7b){logger['error'](_0x567e('0x11'),_0x2255ce,JSON[_0x567e('0x14')](_0x14ec7b));_0x88fe16[_0x567e('0x15')]();});}}catch(_0x2b5763){logger[_0x567e('0x16')](_0x567e('0x11'),_0x2255ce,JSON[_0x567e('0x14')](_0x2b5763));_0x88fe16[_0x567e('0x15')]();}};}; \ No newline at end of file +var _0x78da=['upperFirst','channel','InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','ChatWebsiteId','account','AccountId'];(function(_0x19ebc9,_0x2a8bcd){var _0x54bb42=function(_0x2d3ee4){while(--_0x2d3ee4){_0x19ebc9['push'](_0x19ebc9['shift']());}};_0x54bb42(++_0x2a8bcd);}(_0x78da,0x1d9));var _0xa78d=function(_0x392128,_0x45bedd){_0x392128=_0x392128-0x0;var _0x2368f7=_0x78da[_0x392128];return _0x2368f7;};'use strict';var _=require('lodash');var utils=require(_0xa78d('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xa78d('0x1')),'openchannelMessage':require(_0xa78d('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa78d('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa78d('0x4'))};exports['consequence']=function(_0x5d0bd9,_0x4384b9){return function(_0x5446ab){try{var _0xc15056={'body':utils[_0xa78d('0x5')](_0x4384b9[0x0],this),'ContactId':this[_0xa78d('0x6')]['id']};if(this['channel']==='chat'){_0xc15056[_0xa78d('0x7')]=this[_0xa78d('0x8')]['id'];}else{_0xc15056[_['upperFirst'](this['channel'])+_0xa78d('0x9')]=this['account']['id'];}_0xc15056[_[_0xa78d('0xa')](this[_0xa78d('0xb')])+_0xa78d('0xc')]=this['interaction']['id'];if(rpc[this[_0xa78d('0xb')]+_0xa78d('0xd')]){return rpc[this['channel']+'Message']['create'](_0xc15056)[_0xa78d('0xe')](function(_0x3023b9){logger[_0xa78d('0xf')](_0xa78d('0x10'),_0x5d0bd9,_0xc15056[_0xa78d('0x11')]);_0x5446ab['next']();})['catch'](function(_0x2ff9b3){logger[_0xa78d('0x12')](_0xa78d('0x10'),_0x5d0bd9,JSON[_0xa78d('0x13')](_0x2ff9b3));_0x5446ab[_0xa78d('0x14')]();});}}catch(_0x3c46ba){logger[_0xa78d('0x12')](_0xa78d('0x10'),_0x5d0bd9,JSON['stringify'](_0x3c46ba));_0x5446ab[_0xa78d('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 69f438d..0c5ad0b 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 _0x530e=['./utils','routing','consequence','info','getMustacheRender','error','[%s][NOOP]\x20%s'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x530e,0xa8));var _0xe530=function(_0x3cde60,_0x2cd24d){_0x3cde60=_0x3cde60-0x0;var _0x5178f0=_0x530e[_0x3cde60];return _0x5178f0;};'use strict';var utils=require(_0xe530('0x0'));var logger=require('../../../../config/logger')(_0xe530('0x1'));exports[_0xe530('0x2')]=function(_0x3537f4,_0x1e7db1){return function(_0x20db5c){try{logger[_0xe530('0x3')]('[%s][NOOP]\x20%s',_0x3537f4,utils[_0xe530('0x4')](_0x1e7db1[0x0],this));_0x20db5c['next']();}catch(_0x379611){logger[_0xe530('0x5')](_0xe530('0x6'),_0x3537f4,JSON['stringify'](_0x379611));_0x20db5c['stop']();}};}; \ No newline at end of file +var _0xfc6d=['getMustacheRender','next','error','stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x21d31f,_0x3e06c7){var _0x238e0f=function(_0x51d15e){while(--_0x51d15e){_0x21d31f['push'](_0x21d31f['shift']());}};_0x238e0f(++_0x3e06c7);}(_0xfc6d,0x184));var _0xdfc6=function(_0x15ec12,_0x23d8ee){_0x15ec12=_0x15ec12-0x0;var _0x1b6747=_0xfc6d[_0x15ec12];return _0x1b6747;};'use strict';var utils=require('./utils');var logger=require(_0xdfc6('0x0'))(_0xdfc6('0x1'));exports[_0xdfc6('0x2')]=function(_0x3c6289,_0x790cf6){return function(_0x5ceb84){try{logger['info'](_0xdfc6('0x3'),_0x3c6289,utils[_0xdfc6('0x4')](_0x790cf6[0x0],this));_0x5ceb84[_0xdfc6('0x5')]();}catch(_0x30aacb){logger[_0xdfc6('0x6')](_0xdfc6('0x3'),_0x3c6289,JSON['stringify'](_0x30aacb));_0x5ceb84[_0xdfc6('0x7')]();}};}; \ 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 e0aaced..32c7f63 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 _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x73fe0e,_0x294d53){var _0x3872e4=function(_0xf7a774){while(--_0xf7a774){_0x73fe0e['push'](_0x73fe0e['shift']());}};_0x3872e4(++_0x294d53);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file +var _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0xb8dd84,_0x33bcf0){var _0x50a459=function(_0x14e12c){while(--_0x14e12c){_0xb8dd84['push'](_0xb8dd84['shift']());}};_0x50a459(++_0x33bcf0);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index c6dd953..789a060 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 _0x1858=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','exports','lodash','./util','routing','notificationId','squeue','realtime','bind','handleTimeout','drained','prototype','push','handleDrained','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1858,0x184));var _0x8185=function(_0x44b540,_0x327031){_0x44b540=_0x44b540-0x0;var _0x18b970=_0x1858[_0x44b540];return _0x18b970;};'use strict';var _=require(_0x8185('0x0'));var uuid=require('uuid');var util=require(_0x8185('0x1'));var logger=require('../../../../../config/logger')(_0x8185('0x2'));var Agent=function(_0x167229,_0x50929d,_0x47391f,_0x389aa5){this[_0x8185('0x3')]=uuid['v4']();this[_0x8185('0x4')]=_0x167229;this['agent']=_0x50929d;this[_0x8185('0x5')]=_0x47391f;this[_0x8185('0x2')]=_0x389aa5;this[_0x8185('0x4')]['push'](this['handleRun'][_0x8185('0x6')](this),this[_0x8185('0x7')]['bind'](this));this[_0x8185('0x4')]['on']('timeout',this[_0x8185('0x7')][_0x8185('0x6')](this));this['squeue']['on'](_0x8185('0x8'),this['handleDrained'][_0x8185('0x6')](this));};Agent[_0x8185('0x9')][_0x8185('0xa')]=function(){this[_0x8185('0x4')][_0x8185('0xa')](this['handleRun'][_0x8185('0x6')](this),this[_0x8185('0x7')][_0x8185('0x6')](this));};Agent[_0x8185('0x9')][_0x8185('0xb')]=function(){this[_0x8185('0x7')](!![]);};Agent['prototype'][_0x8185('0xc')]=function(_0x17851d){logger[_0x8185('0xd')](_0x8185('0xe'),this['squeue']['id'],this[_0x8185('0xf')]['id']);if(_[_0x8185('0x10')](this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']])){logger[_0x8185('0xd')](_0x8185('0x12'),this['squeue']['id'],this[_0x8185('0xf')]['id']);setTimeout(this[_0x8185('0xa')][_0x8185('0x6')](this),0x3e8);}else{if(this[_0x8185('0x2')][_0x8185('0x13')]||util['isAgentAvailable'](this[_0x8185('0x4')]['id'],this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']],this['squeue'][_0x8185('0x14')],![])){this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x15')]=!![];this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x16')]=undefined;util['showNotification'](this[_0x8185('0x3')],this['squeue']['id'],this[_0x8185('0x5')]['agents'][this['agent']['id']],null,this[_0x8185('0x2')]);util['writeLog'](this[_0x8185('0x4')]['id'],this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']],_0x8185('0x17')+(this[_0x8185('0x2')][_0x8185('0x13')]?_0x8185('0x18'):''));}else{logger[_0x8185('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x8185('0x9')][_0x8185('0x7')]=function(_0xba5f91){if(_[_0x8185('0x10')](this[_0x8185('0x5')]['agents'][this[_0x8185('0xf')]['id']])){return logger[_0x8185('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8185('0x4')]['id'],this[_0x8185('0xf')]['id']);}else{logger['info'](_0x8185('0x19'),this[_0x8185('0x4')]['id'],this[_0x8185('0xf')]['id']);util[_0x8185('0x1a')](this[_0x8185('0x3')],this[_0x8185('0x4')]['id'],this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']],null,this[_0x8185('0x2')]);this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']][_0x8185('0x15')]=![];this['realtime'][_0x8185('0x11')][this[_0x8185('0xf')]['id']]['busyQueue']=undefined;util[_0x8185('0x1b')](this[_0x8185('0x4')]['id'],this[_0x8185('0x5')][_0x8185('0x11')][this[_0x8185('0xf')]['id']],_0xba5f91?'STOP':'TIMEOUT');}if(!_0xba5f91){setTimeout(this[_0x8185('0xa')]['bind'](this),0x3e8);}};function agent(_0x49ed9d,_0x4c6f01,_0x559e5f,_0x4d9a85){return new Agent(_0x49ed9d,_0x4c6f01,_0x559e5f,_0x4d9a85);}module[_0x8185('0x1c')]=agent; \ No newline at end of file +var _0xb73c=['bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','handleTimeout'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xb73c,0x175));var _0xcb73=function(_0x3ccbb1,_0x481890){_0x3ccbb1=_0x3ccbb1-0x0;var _0x507304=_0xb73c[_0x3ccbb1];return _0x507304;};'use strict';var _=require(_0xcb73('0x0'));var uuid=require(_0xcb73('0x1'));var util=require(_0xcb73('0x2'));var logger=require(_0xcb73('0x3'))('routing');var Agent=function(_0x2ef655,_0x12ac57,_0x2d2e3e,_0xafe9bb){this[_0xcb73('0x4')]=uuid['v4']();this[_0xcb73('0x5')]=_0x2ef655;this[_0xcb73('0x6')]=_0x12ac57;this[_0xcb73('0x7')]=_0x2d2e3e;this[_0xcb73('0x8')]=_0xafe9bb;this[_0xcb73('0x5')][_0xcb73('0x9')](this[_0xcb73('0xa')]['bind'](this),this[_0xcb73('0xb')][_0xcb73('0xc')](this));this['squeue']['on']('timeout',this[_0xcb73('0xb')][_0xcb73('0xc')](this));this[_0xcb73('0x5')]['on'](_0xcb73('0xd'),this[_0xcb73('0xe')]['bind'](this));};Agent[_0xcb73('0xf')]['push']=function(){this[_0xcb73('0x5')][_0xcb73('0x9')](this[_0xcb73('0xa')][_0xcb73('0xc')](this),this[_0xcb73('0xb')]['bind'](this));};Agent['prototype'][_0xcb73('0xe')]=function(){this[_0xcb73('0xb')](!![]);};Agent[_0xcb73('0xf')][_0xcb73('0xa')]=function(_0x23a76f){logger[_0xcb73('0x10')](_0xcb73('0x11'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);if(_[_0xcb73('0x12')](this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']])){logger[_0xcb73('0x10')](_0xcb73('0x14'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);setTimeout(this[_0xcb73('0x9')]['bind'](this),0x3e8);}else{if(this[_0xcb73('0x8')][_0xcb73('0x15')]||util[_0xcb73('0x16')](this[_0xcb73('0x5')]['id'],this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],this[_0xcb73('0x5')][_0xcb73('0x17')],![])){this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']][_0xcb73('0x18')]=!![];this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']][_0xcb73('0x19')]=undefined;util[_0xcb73('0x1a')](this[_0xcb73('0x4')],this[_0xcb73('0x5')]['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],null,this['routing']);util[_0xcb73('0x1b')](this[_0xcb73('0x5')]['id'],this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],_0xcb73('0x1c')+(this['routing'][_0xcb73('0x15')]?_0xcb73('0x1d'):''));}else{logger[_0xcb73('0x10')](_0xcb73('0x1e'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);setTimeout(this['push'][_0xcb73('0xc')](this),0x3e8);}}};Agent[_0xcb73('0xf')]['handleTimeout']=function(_0x5eb71d){if(_[_0xcb73('0x12')](this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']])){return logger[_0xcb73('0x10')](_0xcb73('0x14'),this[_0xcb73('0x5')]['id'],this[_0xcb73('0x6')]['id']);}else{logger[_0xcb73('0x10')](_0xcb73('0x1f'),this[_0xcb73('0x5')]['id'],this[_0xcb73('0x6')]['id']);util[_0xcb73('0x20')](this[_0xcb73('0x4')],this['squeue']['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']],null,this[_0xcb73('0x8')]);this[_0xcb73('0x7')]['agents'][this[_0xcb73('0x6')]['id']][_0xcb73('0x18')]=![];this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']][_0xcb73('0x19')]=undefined;util[_0xcb73('0x1b')](this[_0xcb73('0x5')]['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],_0x5eb71d?_0xcb73('0x21'):_0xcb73('0x22'));}if(!_0x5eb71d){setTimeout(this[_0xcb73('0x9')][_0xcb73('0xc')](this),0x3e8);}};function agent(_0x3c0ddb,_0x298b8e,_0x2f273d,_0x46b437){return new Agent(_0x3c0ddb,_0x298b8e,_0x2f273d,_0x46b437);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index a88495d..a71ebc9 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 _0x444c=['timeout','handleTimeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId','squeue','realtime','handleRun','bind'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x444c,0x108));var _0xc444=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x444c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var uuid=require(_0xc444('0x0'));var util=require(_0xc444('0x1'));var logger=require('../../../../../config/logger')(_0xc444('0x2'));var Beepall=function(_0x532287,_0x2d1719,_0x3b685a,_0x219ca1){this[_0xc444('0x3')]=uuid['v4']();this[_0xc444('0x4')]=_0x532287;this['queue']=_0x2d1719;this[_0xc444('0x5')]=_0x3b685a;this[_0xc444('0x2')]=_0x219ca1;this[_0xc444('0x4')]['push'](this[_0xc444('0x6')][_0xc444('0x7')](this),this['handleTimeout'][_0xc444('0x7')](this));this[_0xc444('0x4')]['on'](_0xc444('0x8'),this[_0xc444('0x9')]['bind'](this));this['squeue']['on'](_0xc444('0xa'),this[_0xc444('0xb')][_0xc444('0x7')](this));};Beepall[_0xc444('0xc')][_0xc444('0xd')]=function(){this[_0xc444('0x4')]['push'](this[_0xc444('0x6')][_0xc444('0x7')](this),this[_0xc444('0x9')][_0xc444('0x7')](this));};Beepall[_0xc444('0xc')][_0xc444('0xb')]=function(_0x2b32f6){this['handleTimeout'](!![]);};Beepall[_0xc444('0xc')]['handleRun']=function(_0xbf3838){var _0x57b4cc=!![];if(!_[_0xc444('0xe')](this[_0xc444('0xf')])&&!_['isNil'](this['queue'][_0xc444('0x10')])&&this['queue'][_0xc444('0x10')][_0xc444('0x11')]>0x0){for(var _0x102393=0x0,_0x1075b7;_0x1023930x0){for(var _0x1c8cab=0x0,_0x5e3ac2;_0x1c8cab0x0&&_0x2b1b7f[_0x2797d3+_0xa8c7('0x25')]>=_0x2b1b7f[_0x2797d3+'Capacity']){writeLog(_0x1e6c00,_0x2b1b7f,_0x2797d3[_0xa8c7('0x26')]()+_0xa8c7('0x27'));return![];}}return!![];};exports['showNotification']=function(_0xa4dbd5,_0x1f6be3,_0x230f36,_0x49b0bb,_0x3fbf68){return sendNotification(!![],_0xa4dbd5,_0x1f6be3,_0x230f36,_0x49b0bb,_0x3fbf68);};exports[_0xa8c7('0x28')]=function(_0x4d7bdf,_0x4a632c,_0x5c36f2,_0x5add5e,_0x372887){return sendNotification(![],_0x4d7bdf,_0x4a632c,_0x5c36f2,_0x5add5e,_0x372887);};exports[_0xa8c7('0x29')]=writeLog; \ No newline at end of file +var _0x2182=['name','user:save','split','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','Capacity','CurrentCapacity','showNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x2182,0xea));var _0x2218=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2182[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var utils=require(_0x2218('0x2'));var Mustache=require(_0x2218('0x3'));var Redis=require('ioredis');var config=require(_0x2218('0x4'));var logger=require('../../../../../config/logger')(_0x2218('0x5'));config[_0x2218('0x6')]=_[_0x2218('0x7')](config[_0x2218('0x6')],{'host':_0x2218('0x8'),'port':0x18eb});var io=require(_0x2218('0x9'))(new Redis(config[_0x2218('0x6')]));function emit(_0x22eab9,_0x142d1d,_0x29e762){io['to'](_0x22eab9)['emit'](_0x142d1d,_0x29e762);}function sendNotification(_0x1197d1,_0xed1f79,_0x15f490,_0x5bd041,_0x49df16,_0x3dcc9){io['to'](util[_0x2218('0xa')](_0x2218('0xb'),_0x5bd041[_0x2218('0xc')]))['emit'](_0x2218('0xd'),_0x5bd041);var _0xa86fc2=_0x3dcc9||{};var _0x32f6a9=_0x15f490[_0x2218('0xe')]('.');var _0x2a0b55={'uniqueid':_0xed1f79,'channel':_0x32f6a9[0x0],'id':_0x32f6a9[0x1],'title':_0x32f6a9[0x0]+'\x20interaction','interactionId':_0x32f6a9[0x2],'queue':_0x49df16?_0x49df16[_0x2218('0xc')]:null,'sound':_0xa86fc2['account'][_0x2218('0xf')],'shake':_0xa86fc2[_0x2218('0x10')][_0x2218('0x11')]};try{if(!_0xa86fc2[_0x2218('0x12')]){_0xa86fc2[_0x2218('0x12')]={};}if(_0x49df16){_0xa86fc2[_0x2218('0x12')][_0x2218('0x13')]=_0x49df16;}else if(_0xa86fc2[_0x2218('0x12')][_0x2218('0x13')]){delete _0xa86fc2[_0x2218('0x12')][_0x2218('0x13')];}_0x2a0b55[_0x2218('0x14')]=utils[_0x2218('0x15')](_0xa86fc2[_0x2218('0x10')][_0x2218('0x16')],_0xa86fc2);}catch(_0x9ccdac){_0x2a0b55[_0x2218('0x14')]=_0x2218('0x17');logger[_0x2218('0x18')](util[_0x2218('0xa')](_0x2218('0x19'),_0xed1f79,_0x9ccdac['message']));}io['to'](util[_0x2218('0xa')](_0x2218('0xb'),_0x5bd041[_0x2218('0xc')]))[_0x2218('0x1a')](util[_0x2218('0xa')](_0x2218('0x1b'),_0x1197d1?_0x2218('0x1c'):_0x2218('0x1d')),_0x2a0b55);}function writeLog(_0x2601a8,_0x3ebbb7,_0x2cee53){return logger[_0x2218('0x1e')](util[_0x2218('0xa')](_0x2218('0x1f'),_0x2601a8,_0x3ebbb7[_0x2218('0xc')],_0x2cee53));}exports[_0x2218('0x20')]=function(_0x26bb3f,_0x27dfa1,_0x4947a3,_0x14c7de){if(_0x27dfa1[_0x2218('0x21')]){writeLog(_0x26bb3f,_0x27dfa1,_0x2218('0x22'));return![];}if(!_0x27dfa1['online']){writeLog(_0x26bb3f,_0x27dfa1,'OFFLINE');return![];}if(_0x27dfa1[_0x4947a3+_0x2218('0x23')]){writeLog(_0x26bb3f,_0x27dfa1,_0x2218('0x24'));return![];}if(_0x14c7de&&_0x27dfa1['hasOwnProperty'](_0x4947a3+_0x2218('0x25'))&&_0x27dfa1['hasOwnProperty'](_0x4947a3+_0x2218('0x26'))){if(_0x27dfa1[_0x4947a3+_0x2218('0x25')]>0x0&&_0x27dfa1[_0x4947a3+_0x2218('0x26')]>=_0x27dfa1[_0x4947a3+_0x2218('0x25')]){writeLog(_0x26bb3f,_0x27dfa1,_0x4947a3['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x2218('0x27')]=function(_0x316651,_0xcbe144,_0x193ecf,_0x5037b5,_0x5acd05){return sendNotification(!![],_0x316651,_0xcbe144,_0x193ecf,_0x5037b5,_0x5acd05);};exports['hideNotification']=function(_0x535e71,_0x141d9c,_0x31e28a,_0xac2931,_0xb60a01){return sendNotification(![],_0x535e71,_0x141d9c,_0x31e28a,_0xac2931,_0xb60a01);};exports[_0x2218('0x28')]=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 662b18a..5f9b7fb 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 _0x1260=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify'];(function(_0x401afa,_0x2120c7){var _0x446804=function(_0x83642c){while(--_0x83642c){_0x401afa['push'](_0x401afa['shift']());}};_0x446804(++_0x2120c7);}(_0x1260,0x65));var _0x0126=function(_0x54abc2,_0x9b8f7f){_0x54abc2=_0x54abc2-0x0;var _0x34b33c=_0x1260[_0x54abc2];return _0x34b33c;};'use strict';var schema=require('validate');var sh=require(_0x0126('0x0'));var _=require(_0x0126('0x1'));var utils=require('./utils');var logger=require(_0x0126('0x2'))(_0x0126('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x0126('0x4')}});exports[_0x0126('0x5')]=function(_0x21d2ae,_0x21d9d0){return function(_0x4b8c3a){try{var _0x456057={'command':_0x21d9d0[0x0]};var _0x15d440=system['validate'](_0x456057,{'typecast':!![]});if(_0x15d440[_0x0126('0x6')]){logger[_0x0126('0x7')](_0x0126('0x8'),_0x21d2ae,_[_0x0126('0x9')](_0x15d440,'message')[_0x0126('0xa')](',\x20'));logger[_0x0126('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x21d2ae);_0x4b8c3a[_0x0126('0xc')]();}else{var _0xc2e109=this;var _0x422a8c=utils[_0x0126('0xd')](_0x21d9d0[0x0],this);logger[_0x0126('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x21d2ae,_0x422a8c);sh[_0x0126('0xe')](_[_0x0126('0xf')](_0x422a8c),function(_0x456288,_0x4da65b){logger[_0x0126('0xb')](_0x0126('0x10'),_0x21d2ae,_0x456288);if(_0x456288==0x0){var _0x89416=_0x4da65b[_0x0126('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x0126('0x12')](_0x21d9d0[0x1])||_['isEmpty'](_0x21d9d0[0x1])){logger[_0x0126('0xb')](_0x0126('0x13'),_0x21d2ae);_0xc2e109['body'][_0x21d9d0[0x1]]=_0x89416;}else{logger[_0x0126('0xb')](_0x0126('0x14'),_0x21d2ae,_0x21d9d0[0x1],_0x89416);_0xc2e109[_0x0126('0x15')][_0x21d9d0[0x1]]=_0x89416;}}_0x4b8c3a[_0x0126('0xc')]();});}}catch(_0xb40810){logger['error'](_0x0126('0x8'),_0x21d2ae,_[_0x0126('0x16')](_0xb40810)?JSON[_0x0126('0x17')](_0xb40810):_0xb40810);logger[_0x0126('0xb')](_0x0126('0x18'),_0x21d2ae);_0x4b8c3a[_0x0126('0xc')]();}};}; \ No newline at end of file +var _0xa872=['info','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','next','validate','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender'];(function(_0x1dd583,_0x439967){var _0xbf6aea=function(_0x1290cf){while(--_0x1290cf){_0x1dd583['push'](_0x1dd583['shift']());}};_0xbf6aea(++_0x439967);}(_0xa872,0x1d6));var _0x2a87=function(_0x19f55e,_0xd4ffc3){_0x19f55e=_0x19f55e-0x0;var _0x44cfee=_0xa872[_0x19f55e];return _0x44cfee;};'use strict';var schema=require(_0x2a87('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2a87('0x1'));var logger=require(_0x2a87('0x2'))(_0x2a87('0x3'));var system=schema({'command':{'type':_0x2a87('0x4'),'required':!![],'message':_0x2a87('0x5')}});exports[_0x2a87('0x6')]=function(_0x3cd0e8,_0x486de8){return function(_0x2ff946){try{var _0xc47edb={'command':_0x486de8[0x0]};var _0x1ed30d=system[_0x2a87('0x0')](_0xc47edb,{'typecast':!![]});if(_0x1ed30d['length']){logger[_0x2a87('0x7')](_0x2a87('0x8'),_0x3cd0e8,_['map'](_0x1ed30d,_0x2a87('0x9'))[_0x2a87('0xa')](',\x20'));logger['info'](_0x2a87('0xb'),_0x3cd0e8);_0x2ff946['next']();}else{var _0x5ca279=this;var _0x392c12=utils[_0x2a87('0xc')](_0x486de8[0x0],this);logger[_0x2a87('0xd')](_0x2a87('0xe'),_0x3cd0e8,_0x392c12);sh['exec'](_[_0x2a87('0xf')](_0x392c12),function(_0x1b56fd,_0x561400){logger[_0x2a87('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3cd0e8,_0x1b56fd);if(_0x1b56fd==0x0){var _0x1c9d1c=_0x561400[_0x2a87('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x2a87('0x11')](_0x486de8[0x1])||_['isEmpty'](_0x486de8[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x3cd0e8);_0x5ca279[_0x2a87('0x12')][_0x486de8[0x1]]=_0x1c9d1c;}else{logger[_0x2a87('0xd')](_0x2a87('0x13'),_0x3cd0e8,_0x486de8[0x1],_0x1c9d1c);_0x5ca279['body'][_0x486de8[0x1]]=_0x1c9d1c;}}_0x2ff946['next']();});}}catch(_0x3be9c1){logger[_0x2a87('0x7')](_0x2a87('0x8'),_0x3cd0e8,_[_0x2a87('0x14')](_0x3be9c1)?JSON[_0x2a87('0x15')](_0x3be9c1):_0x3be9c1);logger[_0x2a87('0xd')](_0x2a87('0xb'),_0x3cd0e8);_0x2ff946[_0x2a87('0x16')]();}};}; \ 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 887bd6b..fedd1f6 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 _0xa130=['error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xa130,0x68));var _0x0a13=function(_0x8595e6,_0x370da1){_0x8595e6=_0x8595e6-0x0;var _0x3449d1=_0xa130[_0x8595e6];return _0x3449d1;};'use strict';var schema=require(_0x0a13('0x0'));var _=require(_0x0a13('0x1'));var rpc={'chatInteraction':require(_0x0a13('0x2')),'openchannelInteraction':require(_0x0a13('0x3')),'smsInteraction':require(_0x0a13('0x4')),'mailInteraction':require(_0x0a13('0x5')),'faxInteraction':require(_0x0a13('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x0a13('0x7'));var tag=schema({'tag':{'type':_0x0a13('0x8'),'required':!![],'message':_0x0a13('0x9')}});exports[_0x0a13('0xa')]=function(_0xf610e3,_0x7b76ca,_0x243223,_0x104671){return function(_0xe23dd4){try{var _0x291a41={'tag':_0x7b76ca[0x0]};var _0x58b20b=tag[_0x0a13('0x0')](_0x291a41,{'typecast':!![]});if(_0x58b20b[_0x0a13('0xb')]){logger[_0x0a13('0xc')](_0x0a13('0xd'),_0xf610e3,_[_0x0a13('0xe')](_0x58b20b,'message')[_0x0a13('0xf')](',\x20'));logger[_0x0a13('0x10')](_0x0a13('0x11'),_0xf610e3);_0xe23dd4['next']();}else{var _0x51a93c={'ids':[_0x7b76ca[0x0]]};if(rpc[_0x104671[_0x0a13('0x12')]+_0x0a13('0x13')]){rpc[_0x104671[_0x0a13('0x12')]+_0x0a13('0x13')][_0x0a13('0x14')](_0x104671['interaction']['id'],_0x51a93c)[_0x0a13('0x15')](function(_0x4ab56b){logger[_0x0a13('0x10')](_0x0a13('0x16'),_0xf610e3,_0x7b76ca[0x1],_0x104671['channel'],_0x104671[_0x0a13('0x17')]['id']);})[_0x0a13('0x18')](function(_0x59a771){logger[_0x0a13('0xc')](_0x0a13('0xd'),_0xf610e3,JSON[_0x0a13('0x19')](_0x59a771));logger[_0x0a13('0x10')](_0x0a13('0x11'),_0xf610e3);})[_0x0a13('0x1a')](function(){_0xe23dd4[_0x0a13('0x1b')]();});}}}catch(_0x3cad30){logger['error'](_0x0a13('0xd'),_0xf610e3,_[_0x0a13('0x1c')](_0x3cad30)?JSON['stringify'](_0x3cad30):_0x3cad30);logger['info'](_0x0a13('0x11'),_0xf610e3);_0xe23dd4[_0x0a13('0x1b')]();}};}; \ No newline at end of file +var _0x5e3c=['Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','finally','next','error','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0x530ca0,_0x375094){var _0x2ebd52=function(_0x2ac103){while(--_0x2ac103){_0x530ca0['push'](_0x530ca0['shift']());}};_0x2ebd52(++_0x375094);}(_0x5e3c,0x169));var _0xc5e3=function(_0x30195a,_0x9aafa1){_0x30195a=_0x30195a-0x0;var _0x4ddeb2=_0x5e3c[_0x30195a];return _0x4ddeb2;};'use strict';var schema=require(_0xc5e3('0x0'));var _=require(_0xc5e3('0x1'));var rpc={'chatInteraction':require(_0xc5e3('0x2')),'openchannelInteraction':require(_0xc5e3('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc5e3('0x4')),'faxInteraction':require(_0xc5e3('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xc5e3('0x6'))(_0xc5e3('0x7'));var tag=schema({'tag':{'type':_0xc5e3('0x8'),'required':!![],'message':_0xc5e3('0x9')}});exports['consequence']=function(_0x5bbf12,_0x4fab90,_0x1736ec,_0x40a10c){return function(_0x576353){try{var _0x5b8cd4={'tag':_0x4fab90[0x0]};var _0x36f573=tag[_0xc5e3('0x0')](_0x5b8cd4,{'typecast':!![]});if(_0x36f573[_0xc5e3('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x5bbf12,_[_0xc5e3('0xb')](_0x36f573,_0xc5e3('0xc'))[_0xc5e3('0xd')](',\x20'));logger[_0xc5e3('0xe')](_0xc5e3('0xf'),_0x5bbf12);_0x576353['next']();}else{var _0x2a3bfc={'ids':[_0x4fab90[0x0]]};if(rpc[_0x40a10c[_0xc5e3('0x10')]+_0xc5e3('0x11')]){rpc[_0x40a10c[_0xc5e3('0x10')]+_0xc5e3('0x11')][_0xc5e3('0x12')](_0x40a10c[_0xc5e3('0x13')]['id'],_0x2a3bfc)[_0xc5e3('0x14')](function(_0x1fef66){logger[_0xc5e3('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5bbf12,_0x4fab90[0x1],_0x40a10c[_0xc5e3('0x10')],_0x40a10c[_0xc5e3('0x13')]['id']);})[_0xc5e3('0x15')](function(_0x53aaab){logger['error'](_0xc5e3('0x16'),_0x5bbf12,JSON[_0xc5e3('0x17')](_0x53aaab));logger[_0xc5e3('0xe')](_0xc5e3('0xf'),_0x5bbf12);})[_0xc5e3('0x18')](function(){_0x576353[_0xc5e3('0x19')]();});}}}catch(_0x53b4ef){logger[_0xc5e3('0x1a')](_0xc5e3('0x16'),_0x5bbf12,_['isObject'](_0x53b4ef)?JSON['stringify'](_0x53b4ef):_0x53b4ef);logger['info'](_0xc5e3('0xf'),_0x5bbf12);_0x576353[_0xc5e3('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 060cb64..3b30ffd 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 _0xa44a=['mustache','render','merge','body','contact','interaction','list'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0xa44a,0x9a));var _0xaa44=function(_0x5ad171,_0x14a45b){_0x5ad171=_0x5ad171-0x0;var _0x4c9d82=_0xa44a[_0x5ad171];return _0x4c9d82;};'use strict';var Mustache=require(_0xaa44('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x4565e9,_0x1962a1){return Mustache[_0xaa44('0x1')](_0x4565e9,_[_0xaa44('0x2')](_0x1962a1[_0xaa44('0x3')],{'contact':_0x1962a1[_0xaa44('0x4')],'message':_0x1962a1['message'],'account':_0x1962a1['account'],'interaction':_0x1962a1[_0xaa44('0x5')],'list':_0x1962a1[_0xaa44('0x6')]}))||'';}}; \ No newline at end of file +var _0x616c=['render','merge','body','account','interaction','list','lodash','exports'];(function(_0x58d912,_0x11795e){var _0x1f94fe=function(_0x227012){while(--_0x227012){_0x58d912['push'](_0x58d912['shift']());}};_0x1f94fe(++_0x11795e);}(_0x616c,0x1b6));var _0xc616=function(_0x2cc4cd,_0x4c8378){_0x2cc4cd=_0x2cc4cd-0x0;var _0x493e7e=_0x616c[_0x2cc4cd];return _0x493e7e;};'use strict';var Mustache=require('mustache');var _=require(_0xc616('0x0'));module[_0xc616('0x1')]={'getMustacheRender':function(_0x5a267e,_0x16e652){return Mustache[_0xc616('0x2')](_0x5a267e,_[_0xc616('0x3')](_0x16e652[_0xc616('0x4')],{'contact':_0x16e652['contact'],'message':_0x16e652['message'],'account':_0x16e652[_0xc616('0x5')],'interaction':_0x16e652[_0xc616('0x6')],'list':_0x16e652[_0xc616('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8ed5570..a8810da 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 _0x7437=['mailQueues','loggedIn','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','uuid','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','split','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','app','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','name','paused','waiting'];(function(_0x5c8a61,_0x5583ca){var _0x2439fb=function(_0x393457){while(--_0x393457){_0x5c8a61['push'](_0x5c8a61['shift']());}};_0x2439fb(++_0x5583ca);}(_0x7437,0x17c));var _0x7743=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x7437[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x7743('0x0'));var util=require(_0x7743('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x7743('0x2'));var BPromise=require('bluebird');var uuid=require(_0x7743('0x3'));var config=require('../../../config/environment');var logger=require(_0x7743('0x4'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7743('0x5')),'chatQueueReport':require(_0x7743('0x6')),'smsQueueReport':require(_0x7743('0x7')),'faxQueueReport':require(_0x7743('0x8')),'whatsappQueueReport':require(_0x7743('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1362d3,_0x21009a,_0x400150){return util[_0x7743('0xa')](_0x7743('0xb'),_0x1362d3,_0x21009a||0x0,_0x400150||0x0);}function getIntervals(_0x57332c,_0x3c45ee){var _0x1e626f=[];if(!_[_0x7743('0xc')](_0x3c45ee[_0x7743('0xd')])&&!_[_0x7743('0xc')](_0x57332c[_0x3c45ee[_0x7743('0xd')]])&&!_[_0x7743('0xc')](_0x57332c[_0x3c45ee['IntervalId']][_0x7743('0xe')])){_0x1e626f=_[_0x7743('0xf')](_0x57332c[_0x3c45ee[_0x7743('0xd')]][_0x7743('0xe')],_0x7743('0x10'));}else if(!_[_0x7743('0xc')](_0x3c45ee['interval'])){_0x1e626f=[_0x3c45ee[_0x7743('0x10')]];}return _0x1e626f;}exports[_0x7743('0x11')]=function(_0x58149a){_0x58149a[_0x7743('0x12')]={};return new BPromise(function(_0x35aebc,_0x69efcd){var _0x305acc={'Start':function(_0x48fc65){var _0x37fd71=this;return new Promise(function(_0x215cc2,_0xa5db49){if(_0x48fc65){try{var _0x37fed7=[];var _0x5e8d0a=getId(_0x48fc65[_0x7743('0x13')],_0x48fc65[_0x7743('0x14')]?_0x48fc65[_0x7743('0x14')]['id']:0x0,_0x48fc65[_0x7743('0x15')]?_0x48fc65[_0x7743('0x15')]['id']:0x0);if(_0x48fc65[_0x7743('0x16')]&&_[_0x7743('0x17')](_0x48fc65[_0x7743('0x16')])&&_0x48fc65['applications'][_0x7743('0x18')]){for(var _0x2bd109=0x0;_0x2bd109<_0x48fc65[_0x7743('0x16')][_0x7743('0x18')];_0x2bd109+=0x1){var _0x148174=_0x48fc65[_0x7743('0x16')][_0x2bd109];if(fs[_0x7743('0x19')](path[_0x7743('0x1a')](__dirname,_0x7743('0x16'),_0x148174['app']+_0x7743('0x1b')))){var _0x15a9c2=[];switch(_0x148174['app']['toLowerCase']()){case'autoreply':var _0x55fc6e=_0x148174['appdata'][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x55fc6e[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x55fc6e[_0x7743('0x1e')](0x1,_0x55fc6e[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x1f'):var _0x5b7926=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x5b7926[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x5b7926[0x1]);_0x15a9c2['push'](_0x5b7926['slice'](0x2,_0x5b7926[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x21'):var _0x13b264=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2['push'](_0x13b264[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x13b264[0x1]);_0x15a9c2[_0x7743('0x1d')](_0x13b264[0x2]);_0x15a9c2['push'](_0x13b264[0x3]);_0x15a9c2['push'](_0x13b264[_0x7743('0x1e')](0x4,_0x13b264['length'])['join'](','));break;case _0x7743('0x22'):var _0x4e3e88=_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x0]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x1]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x2]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[0x3]);_0x15a9c2[_0x7743('0x1d')](_0x4e3e88[_0x7743('0x1e')](0x4,_0x4e3e88[_0x7743('0x18')])[_0x7743('0x1a')](','));break;case _0x7743('0x14'):_0x15a9c2['push'](_0x148174[_0x7743('0x20')]);break;case _0x7743('0x23'):_0x15a9c2['push'](_0x148174['TagId']);_0x15a9c2[_0x7743('0x1d')](_0x148174[_0x7743('0x20')]);break;default:_0x15a9c2=_[_0x7743('0xc')](_0x148174[_0x7743('0x20')])?[]:_0x148174[_0x7743('0x20')][_0x7743('0x1c')](',');}var _0x4b57d3={'id':util[_0x7743('0xa')](_0x7743('0x24'),_0x5e8d0a,_0x148174['id'],_0x148174['app']),'condition':require(_0x7743('0x25'))[_0x7743('0x26')](_0x5e8d0a,getIntervals(_0x58149a[_0x7743('0x27')],_0x148174),_0x58149a),'consequence':require(_0x7743('0x28')+_0x148174['app'])['consequence'](_0x5e8d0a,_0x15a9c2,_0x58149a,_0x48fc65),'p':_0x148174[_0x7743('0x29')]||0x0};logger[_0x7743('0x2a')]('Push\x20new\x20rule',_0x4b57d3['id'],_0x7743('0x2b'),getIntervals(_0x58149a[_0x7743('0x27')],_0x148174)[_0x7743('0x1a')](_0x7743('0x2c')));_0x37fed7[_0x7743('0x1d')](_0x4b57d3);}else{logger[_0x7743('0x2d')](_0x7743('0x2e'),path[_0x7743('0x1a')](__dirname,'applications',_0x148174[_0x7743('0x2f')]+_0x7743('0x1b')));}}_0x58149a['rules'][_0x5e8d0a]=new RuleEngine(_0x37fed7);_0x58149a[_0x7743('0x12')][_0x5e8d0a]['execute'](_0x48fc65,function(_0x543b32){logger[_0x7743('0x2a')]('Applications\x20executed',JSON[_0x7743('0x30')](_0x543b32[_0x7743('0x31')]));if(_0x58149a[_0x7743('0x12')][_0x5e8d0a]){_0x58149a[_0x7743('0x12')][_0x5e8d0a][_0x7743('0x32')](_0x7743('0x33'));}});return _0x215cc2({'code':0xc8,'message':_0x48fc65});}else{logger[_0x7743('0x2a')](_0x7743('0x34'));return _0x215cc2({'code':0xc8,'message':_0x48fc65});}}catch(_0x2d8bc5){logger[_0x7743('0x2d')](_0x2d8bc5[_0x7743('0x35')]);return _0xa5db49(_0x37fd71['error'](0x1f4,_0x2d8bc5));}}return _0xa5db49(_0x7743('0x36'));});},'AcceptMessage':function(_0x29ca7b){var _0x5808d6=this;return new Promise(function(_0x343ff5,_0x3b4d57){if(_0x29ca7b[_0x7743('0x14')]&&_0x29ca7b['message']['id']){try{var _0x4dfadb=getId(_0x29ca7b[_0x7743('0x13')],_0x29ca7b[_0x7743('0x14')]?_0x29ca7b['message']['id']:0x0,_0x29ca7b['interaction']?_0x29ca7b[_0x7743('0x15')]['id']:0x0);if(_0x58149a[_0x7743('0x12')][_0x4dfadb]){_0x58149a[_0x7743('0x12')][_0x4dfadb][_0x7743('0x32')](_0x7743('0x37'));if(rpc[_0x29ca7b['channel']+_0x7743('0x38')]){rpc[_0x29ca7b[_0x7743('0x13')]+_0x7743('0x38')][_0x7743('0x39')](_0x4dfadb,{'UserId':_0x29ca7b[_0x7743('0x14')][_0x7743('0x3a')]})[_0x7743('0x3b')](function(_0x8523d5){logger[_0x7743('0x2d')](_0x7743('0x3c'));});}}return _0x343ff5({'code':0xc8,'message':_0x29ca7b});}catch(_0x22212b){logger['error'](_0x22212b[_0x7743('0x35')]);return _0x3b4d57(_0x5808d6[_0x7743('0x2d')](0x1f4,_0x22212b));}}logger['error'](_0x7743('0x3d'));return _0x3b4d57(_0x5808d6['error'](0x1f4,_0x7743('0x3d')));});},'RejectMessage':function(_0x7f47bc){var _0x370e57=this;return new Promise(function(_0x17eb8d,_0x325997){if(_0x7f47bc[_0x7743('0x3e')]&&_0x7f47bc['agent']['id']){try{if(_0x58149a[_0x7743('0x3f')][_0x7f47bc[_0x7743('0x3e')]['id']]){_0x58149a[_0x7743('0x3f')][_0x7f47bc[_0x7743('0x3e')]['id']][_0x7743('0x40')]=![];_0x58149a['agents'][_0x7f47bc['agent']['id']][_0x7743('0x41')]=undefined;}return _0x17eb8d({'code':0xc8,'message':_0x7f47bc});}catch(_0x2fdd1e){logger[_0x7743('0x2d')](_0x2fdd1e[_0x7743('0x35')]);return _0x325997(_0x370e57[_0x7743('0x2d')](0x1f4,_0x2fdd1e));}}logger[_0x7743('0x2d')](_0x7743('0x3d'));return _0x325997(_0x370e57[_0x7743('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1df025){var _0x5c7262=this;return new Promise(function(_0x14f621,_0x559867){if(_0x1df025[_0x7743('0x13')]&&_0x1df025['interaction']&&_0x1df025[_0x7743('0x15')]['id']){try{var _0x4ad3cf=getId(_0x1df025[_0x7743('0x13')],_0x1df025[_0x7743('0x14')]?_0x1df025[_0x7743('0x14')]['id']:0x0,_0x1df025[_0x7743('0x15')]?_0x1df025[_0x7743('0x15')]['id']:0x0);if(_0x58149a[_0x7743('0x12')][_0x4ad3cf]){_0x58149a['rules'][_0x4ad3cf][_0x7743('0x32')](_0x7743('0x37'));}return _0x14f621({'code':0xc8,'message':_0x1df025});}catch(_0x45b8e6){logger[_0x7743('0x2d')](_0x45b8e6[_0x7743('0x35')]);return _0x559867(_0x5c7262[_0x7743('0x2d')](0x1f4,_0x45b8e6));}}logger[_0x7743('0x2d')](_0x7743('0x3d'));return _0x559867(_0x5c7262['error'](0x1f4,_0x7743('0x3d')));});},'AgentCapacity':function(_0x542ad4){var _0x977cea=this;return new Promise(function(_0x5a3925,_0x5dd959){if(_0x58149a[_0x7743('0x3f')][_0x7743('0x42')](_0x542ad4['id'])){for(var _0x27320b in _0x542ad4[_0x7743('0x43')]){if(_0x542ad4[_0x7743('0x43')][_0x7743('0x42')](_0x27320b)){if(_0x58149a['agents'][_0x542ad4['id']][_0x7743('0x42')](_0x27320b+'CurrentCapacity')){_0x58149a[_0x7743('0x3f')][_0x542ad4['id']][_0x27320b+_0x7743('0x44')]=parseInt(_0x542ad4[_0x7743('0x43')][_0x27320b],0xa);}}}_0x58149a[_0x7743('0x3f')][_0x542ad4['id']]['updateRealtime']();return _0x5a3925({'code':0xc8,'message':_0x58149a[_0x7743('0x3f')][_0x542ad4['id']]});}else{return _0x5dd959(_0x977cea[_0x7743('0x2d')](0x1f4,_0x7743('0x45')));}});},'Agents':function(_0x53a6eb){return new Promise(function(_0x20bdf5,_0x3eac04){var _0x5c1d3d=_[_0x7743('0x46')](_0x58149a[_0x7743('0x3f')]);_0x20bdf5({'count':_0x5c1d3d['length'],'rows':_0x5c1d3d});});},'ChatQueues':function(_0x12c050){return new Promise(function(_0x2e9e41,_0x3f3d8){var _0x2239ac=[];for(var _0x2a209a in _0x58149a[_0x7743('0x47')]){if(_0x58149a[_0x7743('0x47')][_0x7743('0x42')](_0x2a209a)){var _0x5aa0d3=_0x58149a['chatQueues'][_0x2a209a];var _0x5875ba={'id':_0x5aa0d3['id'],'available':_0x5aa0d3['available'],'loggedIn':_0x5aa0d3['loggedIn'],'name':_0x5aa0d3[_0x7743('0x48')],'paused':_0x5aa0d3[_0x7743('0x49')],'waiting':_0x5aa0d3[_0x7743('0x4a')]};_0x2239ac[_0x7743('0x1d')](_0x5875ba);}}_0x2e9e41({'count':_0x2239ac[_0x7743('0x18')],'rows':_0x2239ac});});},'MailQueues':function(_0x3a00ae){return new Promise(function(_0x30a58b,_0x4dc3d7){var _0x4111dd=[];for(var _0x35c001 in _0x58149a['mailQueues']){if(_0x58149a[_0x7743('0x4b')][_0x7743('0x42')](_0x35c001)){var _0xc42eba=_0x58149a[_0x7743('0x4b')][_0x35c001];var _0x3fe718={'id':_0xc42eba['id'],'available':_0xc42eba['available'],'loggedIn':_0xc42eba[_0x7743('0x4c')],'name':_0xc42eba[_0x7743('0x48')],'paused':_0xc42eba['paused'],'waiting':_0xc42eba[_0x7743('0x4a')]};_0x4111dd['push'](_0x3fe718);}}_0x30a58b({'count':_0x4111dd['length'],'rows':_0x4111dd});});},'OpenchannelQueues':function(_0x71d1e3){return new Promise(function(_0x134c36,_0xef890d){var _0x413c89=[];for(var _0x14a30e in _0x58149a['openchannelQueues']){if(_0x58149a[_0x7743('0x4d')][_0x7743('0x42')](_0x14a30e)){var _0x17b5ca=_0x58149a['openchannelQueues'][_0x14a30e];var _0x4f1a7c={'id':_0x17b5ca['id'],'available':_0x17b5ca[_0x7743('0x4e')],'loggedIn':_0x17b5ca[_0x7743('0x4c')],'name':_0x17b5ca['name'],'paused':_0x17b5ca['paused'],'waiting':_0x17b5ca[_0x7743('0x4a')]};_0x413c89[_0x7743('0x1d')](_0x4f1a7c);}}_0x134c36({'count':_0x413c89['length'],'rows':_0x413c89});});},'SmsQueues':function(_0x24e0f5){return new Promise(function(_0x2096c2,_0x34c8b2){var _0x2f2de4=[];for(var _0xcfd3cf in _0x58149a[_0x7743('0x4f')]){if(_0x58149a[_0x7743('0x4f')][_0x7743('0x42')](_0xcfd3cf)){var _0x4beaad=_0x58149a['smsQueues'][_0xcfd3cf];var _0x36a823={'id':_0x4beaad['id'],'available':_0x4beaad[_0x7743('0x4e')],'loggedIn':_0x4beaad[_0x7743('0x4c')],'name':_0x4beaad[_0x7743('0x48')],'paused':_0x4beaad['paused'],'waiting':_0x4beaad['waiting']};_0x2f2de4[_0x7743('0x1d')](_0x36a823);}}_0x2096c2({'count':_0x2f2de4[_0x7743('0x18')],'rows':_0x2f2de4});});},'FaxQueues':function(_0x6dddad){return new Promise(function(_0x3adf01,_0xc8afc2){var _0x50e02f=[];for(var _0x2856df in _0x58149a[_0x7743('0x50')]){if(_0x58149a['faxQueues']['hasOwnProperty'](_0x2856df)){var _0x2ee468=_0x58149a[_0x7743('0x50')][_0x2856df];var _0x55bff2={'id':_0x2ee468['id'],'available':_0x2ee468[_0x7743('0x4e')],'loggedIn':_0x2ee468[_0x7743('0x4c')],'name':_0x2ee468['name'],'paused':_0x2ee468[_0x7743('0x49')],'waiting':_0x2ee468[_0x7743('0x4a')]};_0x50e02f[_0x7743('0x1d')](_0x55bff2);}}_0x3adf01({'count':_0x50e02f['length'],'rows':_0x50e02f});});},'WhatsappQueues':function(_0x3290da){return new Promise(function(_0x1a47a1,_0x2521fd){var _0x13020c=[];for(var _0x25dfad in _0x58149a[_0x7743('0x51')]){if(_0x58149a[_0x7743('0x51')]['hasOwnProperty'](_0x25dfad)){var _0x362e17=_0x58149a[_0x7743('0x51')][_0x25dfad];var _0x3e41da={'id':_0x362e17['id'],'available':_0x362e17[_0x7743('0x4e')],'loggedIn':_0x362e17[_0x7743('0x4c')],'name':_0x362e17[_0x7743('0x48')],'paused':_0x362e17[_0x7743('0x49')],'waiting':_0x362e17[_0x7743('0x4a')]};_0x13020c['push'](_0x3e41da);}}_0x1a47a1({'count':_0x13020c[_0x7743('0x18')],'rows':_0x13020c});});},'ChatQueuesWaitingInteractions':function(_0xd33ef5){return new Promise(function(_0x4ad70d,_0x215397){var _0x110661=_[_0x7743('0x46')](_0x58149a['chatQueuesWaitingInteractions']);_0x4ad70d({'count':_0x110661[_0x7743('0x18')],'rows':_0x110661});});},'MailQueuesWaitingInteractions':function(_0x2910a1){return new Promise(function(_0x17f190,_0x297bb3){var _0x6b2aeb=_['values'](_0x58149a['mailQueuesWaitingInteractions']);_0x17f190({'count':_0x6b2aeb[_0x7743('0x18')],'rows':_0x6b2aeb});});},'OpenchannelQueuesWaitingInteractions':function(_0x523212){return new Promise(function(_0x479cbd,_0x2a7fdd){var _0x29a498=_[_0x7743('0x46')](_0x58149a[_0x7743('0x52')]);_0x479cbd({'count':_0x29a498['length'],'rows':_0x29a498});});},'SmsQueuesWaitingInteractions':function(_0x2017d4){return new Promise(function(_0x2e9603,_0x370453){var _0x47ff52=_[_0x7743('0x46')](_0x58149a['smsQueuesWaitingInteractions']);_0x2e9603({'count':_0x47ff52[_0x7743('0x18')],'rows':_0x47ff52});});},'FaxQueuesWaitingInteractions':function(_0x58732d){return new Promise(function(_0xd7b672,_0x3d47c5){var _0x33df0e=_[_0x7743('0x46')](_0x58149a[_0x7743('0x53')]);_0xd7b672({'count':_0x33df0e[_0x7743('0x18')],'rows':_0x33df0e});});},'WhatsappQueuesWaitingInteractions':function(_0x5ebac4){return new Promise(function(_0x225cee,_0x55940e){var _0x38adc6=_['values'](_0x58149a[_0x7743('0x54')]);_0x225cee({'count':_0x38adc6['length'],'rows':_0x38adc6});});}};var _0xbc0e92=jayson[_0x7743('0x55')](_0x305acc)[_0x7743('0x56')]();_0xbc0e92['on'](_0x7743('0x2d'),function(_0x377830){logger[_0x7743('0x2d')](JSON['stringify'](_0x377830));return _0x69efcd(_0x377830);});_0xbc0e92[_0x7743('0x11')](0x232c,_0x7743('0x57'),function(){console[_0x7743('0x58')](_0x7743('0x59'),0x232c);return _0x35aebc(_0x7743('0x5a')+0x232c);});});}; \ No newline at end of file +var _0x7052=['../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','%s:%s:%s','app','./interval','condition','./applications/','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','emit','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid'];(function(_0xaa2aac,_0x32e1e9){var _0xde946c=function(_0x352cbe){while(--_0x352cbe){_0xaa2aac['push'](_0xaa2aac['shift']());}};_0xde946c(++_0x32e1e9);}(_0x7052,0x1df));var _0x2705=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x7052[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0x2705('0x0'));var util=require(_0x2705('0x1'));var path=require(_0x2705('0x2'));var fs=require('fs');var jayson=require(_0x2705('0x3'));var BPromise=require(_0x2705('0x4'));var uuid=require(_0x2705('0x5'));var config=require(_0x2705('0x6'));var logger=require(_0x2705('0x7'))(_0x2705('0x8'));var rpc={'openchannelQueueReport':require(_0x2705('0x9')),'mailQueueReport':require(_0x2705('0xa')),'chatQueueReport':require(_0x2705('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x2705('0xc'))};var RuleEngine=require(_0x2705('0xd'));function getId(_0x2ce51e,_0x56fb5c,_0x21bf4c){return util[_0x2705('0xe')](_0x2705('0xf'),_0x2ce51e,_0x56fb5c||0x0,_0x21bf4c||0x0);}function getIntervals(_0x5bd74c,_0x5df96b){var _0x1871a2=[];if(!_[_0x2705('0x10')](_0x5df96b[_0x2705('0x11')])&&!_['isNil'](_0x5bd74c[_0x5df96b['IntervalId']])&&!_['isNil'](_0x5bd74c[_0x5df96b['IntervalId']][_0x2705('0x12')])){_0x1871a2=_[_0x2705('0x13')](_0x5bd74c[_0x5df96b[_0x2705('0x11')]][_0x2705('0x12')],_0x2705('0x14'));}else if(!_[_0x2705('0x10')](_0x5df96b['interval'])){_0x1871a2=[_0x5df96b['interval']];}return _0x1871a2;}exports['listen']=function(_0x3b2d89){_0x3b2d89[_0x2705('0x15')]={};return new BPromise(function(_0x101ce7,_0x21896e){var _0x5aec1b={'Start':function(_0x28be9d){var _0x331efa=this;return new Promise(function(_0x3516fa,_0x4f6e07){if(_0x28be9d){try{var _0x346d63=[];var _0x3754b2=getId(_0x28be9d[_0x2705('0x16')],_0x28be9d[_0x2705('0x17')]?_0x28be9d[_0x2705('0x17')]['id']:0x0,_0x28be9d[_0x2705('0x18')]?_0x28be9d[_0x2705('0x18')]['id']:0x0);if(_0x28be9d['applications']&&_[_0x2705('0x19')](_0x28be9d[_0x2705('0x1a')])&&_0x28be9d[_0x2705('0x1a')][_0x2705('0x1b')]){for(var _0x204de1=0x0;_0x204de1<_0x28be9d[_0x2705('0x1a')][_0x2705('0x1b')];_0x204de1+=0x1){var _0x1d45cd=_0x28be9d[_0x2705('0x1a')][_0x204de1];if(fs[_0x2705('0x1c')](path[_0x2705('0x1d')](__dirname,'applications',_0x1d45cd['app']+_0x2705('0x1e')))){var _0x84b20b=[];switch(_0x1d45cd['app']['toLowerCase']()){case _0x2705('0x1f'):var _0x906adb=_0x1d45cd[_0x2705('0x20')][_0x2705('0x21')](',');_0x84b20b['push'](_0x906adb[0x0]);_0x84b20b[_0x2705('0x22')](_0x906adb[_0x2705('0x23')](0x1,_0x906adb[_0x2705('0x1b')])[_0x2705('0x1d')](','));break;case _0x2705('0x24'):var _0x2f6302=_0x1d45cd[_0x2705('0x20')]['split'](',');_0x84b20b[_0x2705('0x22')](_0x2f6302[0x0]);_0x84b20b[_0x2705('0x22')](_0x2f6302[0x1]);_0x84b20b[_0x2705('0x22')](_0x2f6302[_0x2705('0x23')](0x2,_0x2f6302[_0x2705('0x1b')])[_0x2705('0x1d')](','));break;case _0x2705('0x25'):var _0x529c82=_0x1d45cd[_0x2705('0x20')][_0x2705('0x21')](',');_0x84b20b[_0x2705('0x22')](_0x529c82[0x0]);_0x84b20b[_0x2705('0x22')](_0x529c82[0x1]);_0x84b20b['push'](_0x529c82[0x2]);_0x84b20b[_0x2705('0x22')](_0x529c82[0x3]);_0x84b20b[_0x2705('0x22')](_0x529c82[_0x2705('0x23')](0x4,_0x529c82['length'])[_0x2705('0x1d')](','));break;case _0x2705('0x26'):var _0x4b7548=_0x1d45cd['appdata'][_0x2705('0x21')](',');_0x84b20b[_0x2705('0x22')](_0x4b7548[0x0]);_0x84b20b['push'](_0x4b7548[0x1]);_0x84b20b[_0x2705('0x22')](_0x4b7548[0x2]);_0x84b20b['push'](_0x4b7548[0x3]);_0x84b20b[_0x2705('0x22')](_0x4b7548[_0x2705('0x23')](0x4,_0x4b7548[_0x2705('0x1b')])['join'](','));break;case _0x2705('0x17'):_0x84b20b[_0x2705('0x22')](_0x1d45cd[_0x2705('0x20')]);break;case'tag':_0x84b20b[_0x2705('0x22')](_0x1d45cd[_0x2705('0x27')]);_0x84b20b['push'](_0x1d45cd[_0x2705('0x20')]);break;default:_0x84b20b=_['isNil'](_0x1d45cd[_0x2705('0x20')])?[]:_0x1d45cd[_0x2705('0x20')]['split'](',');}var _0x3475ab={'id':util[_0x2705('0xe')](_0x2705('0x28'),_0x3754b2,_0x1d45cd['id'],_0x1d45cd[_0x2705('0x29')]),'condition':require(_0x2705('0x2a'))[_0x2705('0x2b')](_0x3754b2,getIntervals(_0x3b2d89['intervals'],_0x1d45cd),_0x3b2d89),'consequence':require(_0x2705('0x2c')+_0x1d45cd[_0x2705('0x29')])['consequence'](_0x3754b2,_0x84b20b,_0x3b2d89,_0x28be9d),'p':_0x1d45cd[_0x2705('0x2d')]||0x0};logger['info'](_0x2705('0x2e'),_0x3475ab['id'],_0x2705('0x2f'),getIntervals(_0x3b2d89[_0x2705('0x30')],_0x1d45cd)[_0x2705('0x1d')](_0x2705('0x31')));_0x346d63[_0x2705('0x22')](_0x3475ab);}else{logger[_0x2705('0x32')](_0x2705('0x33'),path[_0x2705('0x1d')](__dirname,_0x2705('0x1a'),_0x1d45cd[_0x2705('0x29')]+'.js'));}}_0x3b2d89[_0x2705('0x15')][_0x3754b2]=new RuleEngine(_0x346d63);_0x3b2d89['rules'][_0x3754b2][_0x2705('0x34')](_0x28be9d,function(_0x3911de){logger[_0x2705('0x35')]('Applications\x20executed',JSON[_0x2705('0x36')](_0x3911de[_0x2705('0x37')]));if(_0x3b2d89[_0x2705('0x15')][_0x3754b2]){_0x3b2d89[_0x2705('0x15')][_0x3754b2]['emit']('complete');}});return _0x3516fa({'code':0xc8,'message':_0x28be9d});}else{logger[_0x2705('0x35')](_0x2705('0x38'));return _0x3516fa({'code':0xc8,'message':_0x28be9d});}}catch(_0x4cc0ff){logger['error'](_0x4cc0ff[_0x2705('0x39')]);return _0x4f6e07(_0x331efa[_0x2705('0x32')](0x1f4,_0x4cc0ff));}}return _0x4f6e07(_0x2705('0x3a'));});},'AcceptMessage':function(_0xf68499){var _0x39c795=this;return new Promise(function(_0xf4d545,_0x26492d){if(_0xf68499[_0x2705('0x17')]&&_0xf68499[_0x2705('0x17')]['id']){try{var _0x25c829=getId(_0xf68499[_0x2705('0x16')],_0xf68499[_0x2705('0x17')]?_0xf68499['message']['id']:0x0,_0xf68499[_0x2705('0x18')]?_0xf68499['interaction']['id']:0x0);if(_0x3b2d89[_0x2705('0x15')][_0x25c829]){_0x3b2d89['rules'][_0x25c829]['emit'](_0x2705('0x3b'));if(rpc[_0xf68499[_0x2705('0x16')]+_0x2705('0x3c')]){rpc[_0xf68499[_0x2705('0x16')]+_0x2705('0x3c')][_0x2705('0x3d')](_0x25c829,{'UserId':_0xf68499[_0x2705('0x17')][_0x2705('0x3e')]})['catch'](function(_0x12b52d){logger[_0x2705('0x32')](_0x2705('0x3f'));});}}return _0xf4d545({'code':0xc8,'message':_0xf68499});}catch(_0x2867c7){logger[_0x2705('0x32')](_0x2867c7[_0x2705('0x39')]);return _0x26492d(_0x39c795[_0x2705('0x32')](0x1f4,_0x2867c7));}}logger[_0x2705('0x32')](_0x2705('0x40'));return _0x26492d(_0x39c795['error'](0x1f4,_0x2705('0x40')));});},'RejectMessage':function(_0x47a723){var _0x59836f=this;return new Promise(function(_0x4dfcd5,_0x268bcd){if(_0x47a723[_0x2705('0x41')]&&_0x47a723[_0x2705('0x41')]['id']){try{if(_0x3b2d89[_0x2705('0x42')][_0x47a723['agent']['id']]){_0x3b2d89[_0x2705('0x42')][_0x47a723[_0x2705('0x41')]['id']][_0x2705('0x43')]=![];_0x3b2d89[_0x2705('0x42')][_0x47a723[_0x2705('0x41')]['id']][_0x2705('0x44')]=undefined;}return _0x4dfcd5({'code':0xc8,'message':_0x47a723});}catch(_0x5b48df){logger['error'](_0x5b48df[_0x2705('0x39')]);return _0x268bcd(_0x59836f[_0x2705('0x32')](0x1f4,_0x5b48df));}}logger[_0x2705('0x32')]('message\x20is\x20empty');return _0x268bcd(_0x59836f[_0x2705('0x32')](0x1f4,_0x2705('0x40')));});},'AbandonInteraction':function(_0xb5d8d6){var _0x42ea8c=this;return new Promise(function(_0x416a4f,_0x1f562c){if(_0xb5d8d6['channel']&&_0xb5d8d6[_0x2705('0x18')]&&_0xb5d8d6[_0x2705('0x18')]['id']){try{var _0x5a11dc=getId(_0xb5d8d6[_0x2705('0x16')],_0xb5d8d6['message']?_0xb5d8d6['message']['id']:0x0,_0xb5d8d6[_0x2705('0x18')]?_0xb5d8d6[_0x2705('0x18')]['id']:0x0);if(_0x3b2d89[_0x2705('0x15')][_0x5a11dc]){_0x3b2d89[_0x2705('0x15')][_0x5a11dc][_0x2705('0x45')](_0x2705('0x3b'));}return _0x416a4f({'code':0xc8,'message':_0xb5d8d6});}catch(_0x6097c8){logger['error'](_0x6097c8[_0x2705('0x39')]);return _0x1f562c(_0x42ea8c['error'](0x1f4,_0x6097c8));}}logger['error'](_0x2705('0x40'));return _0x1f562c(_0x42ea8c[_0x2705('0x32')](0x1f4,_0x2705('0x40')));});},'AgentCapacity':function(_0x1a42ed){var _0x12482b=this;return new Promise(function(_0x328113,_0x2d4aae){if(_0x3b2d89['agents']['hasOwnProperty'](_0x1a42ed['id'])){for(var _0x196f6d in _0x1a42ed[_0x2705('0x46')]){if(_0x1a42ed[_0x2705('0x46')]['hasOwnProperty'](_0x196f6d)){if(_0x3b2d89['agents'][_0x1a42ed['id']][_0x2705('0x47')](_0x196f6d+_0x2705('0x48'))){_0x3b2d89['agents'][_0x1a42ed['id']][_0x196f6d+_0x2705('0x48')]=parseInt(_0x1a42ed[_0x2705('0x46')][_0x196f6d],0xa);}}}_0x3b2d89[_0x2705('0x42')][_0x1a42ed['id']]['updateRealtime']();return _0x328113({'code':0xc8,'message':_0x3b2d89[_0x2705('0x42')][_0x1a42ed['id']]});}else{return _0x2d4aae(_0x12482b[_0x2705('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x271eb8){return new Promise(function(_0x1f8429,_0x2a30e2){var _0xaf52fd=_[_0x2705('0x49')](_0x3b2d89['agents']);_0x1f8429({'count':_0xaf52fd[_0x2705('0x1b')],'rows':_0xaf52fd});});},'ChatQueues':function(_0x1da6f5){return new Promise(function(_0x5ddbb0,_0xdb5eb9){var _0x12ae02=[];for(var _0x297320 in _0x3b2d89[_0x2705('0x4a')]){if(_0x3b2d89[_0x2705('0x4a')][_0x2705('0x47')](_0x297320)){var _0x1bd7b8=_0x3b2d89['chatQueues'][_0x297320];var _0x5a8189={'id':_0x1bd7b8['id'],'available':_0x1bd7b8[_0x2705('0x4b')],'loggedIn':_0x1bd7b8['loggedIn'],'name':_0x1bd7b8[_0x2705('0x4c')],'paused':_0x1bd7b8[_0x2705('0x4d')],'waiting':_0x1bd7b8[_0x2705('0x4e')]};_0x12ae02['push'](_0x5a8189);}}_0x5ddbb0({'count':_0x12ae02[_0x2705('0x1b')],'rows':_0x12ae02});});},'MailQueues':function(_0x4c0896){return new Promise(function(_0x4802da,_0x4a2e7b){var _0x4b489b=[];for(var _0xc5418f in _0x3b2d89[_0x2705('0x4f')]){if(_0x3b2d89[_0x2705('0x4f')][_0x2705('0x47')](_0xc5418f)){var _0x4f766b=_0x3b2d89[_0x2705('0x4f')][_0xc5418f];var _0x4f8a72={'id':_0x4f766b['id'],'available':_0x4f766b[_0x2705('0x4b')],'loggedIn':_0x4f766b[_0x2705('0x50')],'name':_0x4f766b[_0x2705('0x4c')],'paused':_0x4f766b[_0x2705('0x4d')],'waiting':_0x4f766b['waiting']};_0x4b489b[_0x2705('0x22')](_0x4f8a72);}}_0x4802da({'count':_0x4b489b[_0x2705('0x1b')],'rows':_0x4b489b});});},'OpenchannelQueues':function(_0x582b95){return new Promise(function(_0x2b4021,_0x166a25){var _0x44994b=[];for(var _0x45bb3f in _0x3b2d89[_0x2705('0x51')]){if(_0x3b2d89[_0x2705('0x51')][_0x2705('0x47')](_0x45bb3f)){var _0x152fbb=_0x3b2d89[_0x2705('0x51')][_0x45bb3f];var _0x34ae13={'id':_0x152fbb['id'],'available':_0x152fbb[_0x2705('0x4b')],'loggedIn':_0x152fbb[_0x2705('0x50')],'name':_0x152fbb[_0x2705('0x4c')],'paused':_0x152fbb[_0x2705('0x4d')],'waiting':_0x152fbb[_0x2705('0x4e')]};_0x44994b[_0x2705('0x22')](_0x34ae13);}}_0x2b4021({'count':_0x44994b[_0x2705('0x1b')],'rows':_0x44994b});});},'SmsQueues':function(_0x45b1f3){return new Promise(function(_0x39791d,_0x425df8){var _0x390817=[];for(var _0x201e28 in _0x3b2d89[_0x2705('0x52')]){if(_0x3b2d89[_0x2705('0x52')]['hasOwnProperty'](_0x201e28)){var _0x3a3476=_0x3b2d89[_0x2705('0x52')][_0x201e28];var _0x1837fb={'id':_0x3a3476['id'],'available':_0x3a3476[_0x2705('0x4b')],'loggedIn':_0x3a3476[_0x2705('0x50')],'name':_0x3a3476['name'],'paused':_0x3a3476[_0x2705('0x4d')],'waiting':_0x3a3476['waiting']};_0x390817[_0x2705('0x22')](_0x1837fb);}}_0x39791d({'count':_0x390817[_0x2705('0x1b')],'rows':_0x390817});});},'FaxQueues':function(_0xfdac94){return new Promise(function(_0x4917c6,_0x2e3fed){var _0x145cce=[];for(var _0x1624aa in _0x3b2d89['faxQueues']){if(_0x3b2d89[_0x2705('0x53')][_0x2705('0x47')](_0x1624aa)){var _0x42c8d7=_0x3b2d89[_0x2705('0x53')][_0x1624aa];var _0x4a098d={'id':_0x42c8d7['id'],'available':_0x42c8d7['available'],'loggedIn':_0x42c8d7[_0x2705('0x50')],'name':_0x42c8d7['name'],'paused':_0x42c8d7['paused'],'waiting':_0x42c8d7[_0x2705('0x4e')]};_0x145cce[_0x2705('0x22')](_0x4a098d);}}_0x4917c6({'count':_0x145cce[_0x2705('0x1b')],'rows':_0x145cce});});},'WhatsappQueues':function(_0x2a3ffe){return new Promise(function(_0x43c90c,_0x120b85){var _0x10e24b=[];for(var _0x2da318 in _0x3b2d89[_0x2705('0x54')]){if(_0x3b2d89['whatsappQueues'][_0x2705('0x47')](_0x2da318)){var _0x19ffd1=_0x3b2d89['whatsappQueues'][_0x2da318];var _0x21ae12={'id':_0x19ffd1['id'],'available':_0x19ffd1[_0x2705('0x4b')],'loggedIn':_0x19ffd1['loggedIn'],'name':_0x19ffd1['name'],'paused':_0x19ffd1['paused'],'waiting':_0x19ffd1[_0x2705('0x4e')]};_0x10e24b[_0x2705('0x22')](_0x21ae12);}}_0x43c90c({'count':_0x10e24b[_0x2705('0x1b')],'rows':_0x10e24b});});},'ChatQueuesWaitingInteractions':function(_0x43719f){return new Promise(function(_0x21040c,_0x5f4e2c){var _0x3f7628=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x55')]);_0x21040c({'count':_0x3f7628['length'],'rows':_0x3f7628});});},'MailQueuesWaitingInteractions':function(_0x5d541d){return new Promise(function(_0x1b7871,_0x26aa8e){var _0x3d6e57=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x56')]);_0x1b7871({'count':_0x3d6e57[_0x2705('0x1b')],'rows':_0x3d6e57});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e319e){return new Promise(function(_0x4ffb49,_0x440a3a){var _0x1201d4=_['values'](_0x3b2d89[_0x2705('0x57')]);_0x4ffb49({'count':_0x1201d4[_0x2705('0x1b')],'rows':_0x1201d4});});},'SmsQueuesWaitingInteractions':function(_0x3994c2){return new Promise(function(_0x5e1d3e,_0x27518d){var _0x43e9e0=_['values'](_0x3b2d89[_0x2705('0x58')]);_0x5e1d3e({'count':_0x43e9e0[_0x2705('0x1b')],'rows':_0x43e9e0});});},'FaxQueuesWaitingInteractions':function(_0x44b38f){return new Promise(function(_0x1b477d,_0x43a632){var _0x55d1b0=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x59')]);_0x1b477d({'count':_0x55d1b0[_0x2705('0x1b')],'rows':_0x55d1b0});});},'WhatsappQueuesWaitingInteractions':function(_0x12e5aa){return new Promise(function(_0x15d1a5,_0x2890c5){var _0x2bd828=_['values'](_0x3b2d89[_0x2705('0x5a')]);_0x15d1a5({'count':_0x2bd828[_0x2705('0x1b')],'rows':_0x2bd828});});}};var _0x2ca397=jayson[_0x2705('0x5b')](_0x5aec1b)[_0x2705('0x5c')]();_0x2ca397['on'](_0x2705('0x32'),function(_0x5c40f0){logger['error'](JSON[_0x2705('0x36')](_0x5c40f0));return _0x21896e(_0x5c40f0);});_0x2ca397[_0x2705('0x5d')](0x232c,_0x2705('0x5e'),function(){console[_0x2705('0x5f')](_0x2705('0x60'),0x232c);return _0x101ce7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index efcb8eb..12be152 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 _0xb311=['stack','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','catch','condition','rules','info','length','Command','format','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20'];(function(_0x42dd06,_0x4d928b){var _0x121e9a=function(_0x2e79c4){while(--_0x2e79c4){_0x42dd06['push'](_0x42dd06['shift']());}};_0x121e9a(++_0x4d928b);}(_0xb311,0x105));var _0x1b31=function(_0x341faa,_0x56dd3e){_0x341faa=_0x341faa-0x0;var _0x247243=_0xb311[_0x341faa];return _0x247243;};'use strict';var util=require(_0x1b31('0x0'));var BPromise=require(_0x1b31('0x1'));var jayson=require('jayson/promise');var _=require(_0x1b31('0x2'));var logger=require(_0x1b31('0x3'))(_0x1b31('0x4'));var client=jayson['client'][_0x1b31('0x5')]({'port':0x232a});function request(_0x45cbe2,_0x4a65c7){return new BPromise(function(_0x3b81df,_0x12bd6e){return client[_0x1b31('0x6')](_0x45cbe2,_0x4a65c7)[_0x1b31('0x7')](function(_0x23c4c9){if(_0x23c4c9['error']){return _0x12bd6e(_0x23c4c9[_0x1b31('0x8')]['message']);}else{return _0x3b81df(_0x23c4c9['result']);}})[_0x1b31('0x9')](function(_0x564e73){return _0x12bd6e(_0x564e73);});});}exports[_0x1b31('0xa')]=function(_0x2b8f35,_0x52b5cc,_0x416dc8){return function(_0x4c4d23){if(_0x416dc8[_0x1b31('0xb')]&&!_0x416dc8[_0x1b31('0xb')][_0x2b8f35]){logger[_0x1b31('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2b8f35);return _0x4c4d23['stop']();}var _0x70ddc8=[];for(var _0x9f1422=0x0;_0x9f1422<_0x52b5cc[_0x1b31('0xd')];_0x9f1422+=0x1){_0x70ddc8['push'](request(_0x1b31('0xe'),{'command':util[_0x1b31('0xf')](_0x1b31('0x10'),_0x52b5cc[_0x9f1422])})['then'](function(_0xbac521){return _0xbac521&&_0xbac521[_0x1b31('0x11')]&&_0xbac521[_0x1b31('0x11')][_0x1b31('0x12')]('true')>=0x0?!![]:![];})['catch'](function(_0x5b03da){logger[_0x1b31('0x8')](_0x1b31('0x13'),_0x2b8f35,_0x52b5cc[_0x9f1422]);}));}BPromise['all'](_0x70ddc8)['then'](function(_0x1f8067){var _0x8f3aac=_[_0x1b31('0x14')](_0x1f8067);logger[_0x1b31('0xc')](_0x1b31('0x15'),_0x2b8f35,_0x52b5cc[_0x1b31('0x16')]('\x20|\x20'),_0x8f3aac);_0x4c4d23['when'](_0x8f3aac);})[_0x1b31('0x9')](function(_0x424c23){console[_0x1b31('0x17')](_0x424c23);logger[_0x1b31('0x8')](_0x1b31('0x15'),_0x2b8f35,_0x52b5cc[_0x1b31('0x16')](_0x1b31('0x18')),_0x424c23[_0x1b31('0x19')]);_0x4c4d23['stop']();});};}; \ No newline at end of file +var _0x2fed=['Command','format','then','indexOf','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','jayson/promise','lodash','../../../config/logger','routing','http','request','error','message','result','catch','condition','rules','info','stop','length','push'];(function(_0x31ed1d,_0x16cada){var _0x5601f9=function(_0x17454e){while(--_0x17454e){_0x31ed1d['push'](_0x31ed1d['shift']());}};_0x5601f9(++_0x16cada);}(_0x2fed,0x14c));var _0xd2fe=function(_0x141f9b,_0x20f4e5){_0x141f9b=_0x141f9b-0x0;var _0x1e7f08=_0x2fed[_0x141f9b];return _0x1e7f08;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xd2fe('0x0'));var _=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var client=jayson['client'][_0xd2fe('0x4')]({'port':0x232a});function request(_0xe10b2b,_0x470c52){return new BPromise(function(_0x20830f,_0x325133){return client[_0xd2fe('0x5')](_0xe10b2b,_0x470c52)['then'](function(_0x1a9341){if(_0x1a9341[_0xd2fe('0x6')]){return _0x325133(_0x1a9341[_0xd2fe('0x6')][_0xd2fe('0x7')]);}else{return _0x20830f(_0x1a9341[_0xd2fe('0x8')]);}})[_0xd2fe('0x9')](function(_0xb36e8c){return _0x325133(_0xb36e8c);});});}exports[_0xd2fe('0xa')]=function(_0x111556,_0x44602f,_0x4cedda){return function(_0x2f6a47){if(_0x4cedda[_0xd2fe('0xb')]&&!_0x4cedda[_0xd2fe('0xb')][_0x111556]){logger[_0xd2fe('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x111556);return _0x2f6a47[_0xd2fe('0xd')]();}var _0x3b318d=[];for(var _0x4de67c=0x0;_0x4de67c<_0x44602f[_0xd2fe('0xe')];_0x4de67c+=0x1){_0x3b318d[_0xd2fe('0xf')](request(_0xd2fe('0x10'),{'command':util[_0xd2fe('0x11')]('iftime\x20%s',_0x44602f[_0x4de67c])})[_0xd2fe('0x12')](function(_0x2c4ccc){return _0x2c4ccc&&_0x2c4ccc[_0xd2fe('0x7')]&&_0x2c4ccc[_0xd2fe('0x7')][_0xd2fe('0x13')]('true')>=0x0?!![]:![];})[_0xd2fe('0x9')](function(_0x2639fe){logger[_0xd2fe('0x6')](_0xd2fe('0x14'),_0x111556,_0x44602f[_0x4de67c]);}));}BPromise[_0xd2fe('0x15')](_0x3b318d)[_0xd2fe('0x12')](function(_0x293fcc){var _0x5cfbf6=_[_0xd2fe('0x16')](_0x293fcc);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x111556,_0x44602f[_0xd2fe('0x17')](_0xd2fe('0x18')),_0x5cfbf6);_0x2f6a47[_0xd2fe('0x19')](_0x5cfbf6);})[_0xd2fe('0x9')](function(_0x992364){console[_0xd2fe('0x1a')](_0x992364);logger[_0xd2fe('0x6')](_0xd2fe('0x1b'),_0x111556,_0x44602f['join'](_0xd2fe('0x18')),_0x992364[_0xd2fe('0x1c')]);_0x2f6a47[_0xd2fe('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4ee21c0..b48361a 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 _0xbd4c=['blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','reason','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype'];(function(_0x2f58ee,_0x5460f2){var _0x275d54=function(_0x24c2c5){while(--_0x24c2c5){_0x2f58ee['push'](_0x2f58ee['shift']());}};_0x275d54(++_0x5460f2);}(_0xbd4c,0x74));var _0xcbd4=function(_0x1793fd,_0x454586){_0x1793fd=_0x1793fd-0x0;var _0x367dbf=_0xbd4c[_0x1793fd];return _0x367dbf;};'use strict';var _=require(_0xcbd4('0x0'));var util=require('util');var utils=require(_0xcbd4('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56ba84,_0x236579){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x4'),_0x56ba84[_0xcbd4('0x5')],_0x56ba84[_0xcbd4('0x6')],_0x56ba84[_0xcbd4('0x7')],_0x56ba84[_0xcbd4('0x8')],_0x56ba84[_0xcbd4('0x9')],_0x56ba84[_0xcbd4('0xa')],_0x56ba84[_0xcbd4('0xb')],_0x56ba84[_0xcbd4('0xc')]));if(_0x56ba84[_0xcbd4('0x7')]){utils[_0xcbd4('0xd')](_0x56ba84[_0xcbd4('0x7')])['then'](function(_0x3a0280){if(_0x3a0280){_0x56ba84[_0xcbd4('0xe')]=_0x3a0280[_0xcbd4('0xe')];_0x56ba84[_0xcbd4('0xf')]=_0x56ba84[_0xcbd4('0x10')]?_0x3a0280[_0xcbd4('0x11')]:![];_0x56ba84['acwtime']=_0x56ba84[_0xcbd4('0xf')]?_0x3a0280[_0xcbd4('0x12')]:0x0;}utils[_0xcbd4('0x13')](_0xcbd4('0x14'),_0x56ba84);});}else{utils[_0xcbd4('0x13')](_0xcbd4('0x14'),_0x56ba84);}if(_0x236579){delete transfers[_0x56ba84[_0xcbd4('0x5')]];}else{delete agents[_0x56ba84[_0xcbd4('0x15')]];}}exports[_0xcbd4('0x16')]=function(_0x5857d8){try{utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x18'),_0x5857d8['uniqueid']),_0x5857d8);agents[_0x5857d8[_0xcbd4('0x15')]]=_0x5857d8;agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x19')]=utils[_0xcbd4('0x1a')]();agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x1b');agents[_0x5857d8[_0xcbd4('0x15')]]['connectedlinenum']=null;agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x1c')]=null;utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x1d'),_0x5857d8['uniqueid'],agents[_0x5857d8[_0xcbd4('0x15')]][_0xcbd4('0x8')],_0x5857d8[_0xcbd4('0x15')]));}catch(_0x2d03bb){utils[_0xcbd4('0x1e')](util['format'](_0xcbd4('0x18'),_0x5857d8['uniqueid']),_0x2d03bb);}};exports[_0xcbd4('0x1f')]=function(_0x4ed7e8){try{if(!_[_0xcbd4('0x20')](agents[_0x4ed7e8[_0xcbd4('0x15')]])){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x21'),_0x4ed7e8['uniqueid']),_0x4ed7e8);utils[_0xcbd4('0x2')](util['format'](_0xcbd4('0x22'),_0x4ed7e8[_0xcbd4('0x5')],agents[_0x4ed7e8[_0xcbd4('0x15')]]['membername'],_0x4ed7e8[_0xcbd4('0x15')]));agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0x1f')]=!![];agents[_0x4ed7e8[_0xcbd4('0x15')]]['agentringnoanswerAt']=utils[_0xcbd4('0x1a')]();agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x23');agents[_0x4ed7e8[_0xcbd4('0x15')]]['reason']='timeout';agents[_0x4ed7e8[_0xcbd4('0x15')]][_0xcbd4('0x24')]=_0x4ed7e8[_0xcbd4('0x25')]?parseInt(_0x4ed7e8['ringtime'])/0x3e8:0x0;agents[_0x4ed7e8['destuniqueid']][_0xcbd4('0x26')]=0x0;unanswered[_0xcbd4('0x27')](_0x4ed7e8[_0xcbd4('0x15')]);}}catch(_0x5711d0){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x21'),_0x4ed7e8[_0xcbd4('0x5')]),_0x5711d0);}};exports[_0xcbd4('0x28')]=function(_0x2e5519){try{_[_0xcbd4('0x29')](agents,function(_0x82083d,_0x21ee1f){if(_0x82083d[_0xcbd4('0x5')]==_0x2e5519['uniqueid']&&!_[_0xcbd4('0x2a')](unanswered,_0x82083d[_0xcbd4('0x15')])){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x2b'),_0x2e5519[_0xcbd4('0x5')]),_0x2e5519);utils[_0xcbd4('0x2')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e5519[_0xcbd4('0x5')],_0x82083d[_0xcbd4('0x8')],_0x82083d['destuniqueid']));_0x82083d[_0xcbd4('0x1f')]=!![];_0x82083d['agentringnoanswerAt']=utils['now']();_0x82083d[_0xcbd4('0xc')]=_0xcbd4('0x2c');_0x82083d[_0xcbd4('0x2d')]=_0xcbd4('0x2c');_0x82083d['holdtime']=_0x2e5519[_0xcbd4('0x24')];_0x82083d[_0xcbd4('0x26')]=0x0;writeDB(_0x82083d);}});}catch(_0x5cd001){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x2b'),_0x2e5519['uniqueid']),_0x5cd001);}};exports[_0xcbd4('0x2e')]=function(_0x2aea14){try{if(agents[_0x2aea14[_0xcbd4('0x15')]]){utils[_0xcbd4('0x17')](util[_0xcbd4('0x3')](_0xcbd4('0x2f'),_0x2aea14[_0xcbd4('0x5')]),_0x2aea14);utils['info'](util[_0xcbd4('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2aea14['uniqueid'],agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x8')],_0x2aea14[_0xcbd4('0x15')]));agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x30')]=utils['now']();agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0xb')]=_0x2aea14[_0xcbd4('0xb')];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x1c')]=_0x2aea14['connectedlinename'];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0x24')]=_0x2aea14[_0xcbd4('0x25')];agents[_0x2aea14[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x31');_['forIn'](agents,function(_0xc396d,_0x11af90){if(_0xc396d['destuniqueid']!=_0x2aea14[_0xcbd4('0x15')]&&_0xc396d[_0xcbd4('0x5')]==_0x2aea14['uniqueid']){_0xc396d[_0xcbd4('0x26')]=0x0;_0xc396d[_0xcbd4('0x24')]=_0x2aea14['ringtime'];_0xc396d[_0xcbd4('0x1f')]=!![];_0xc396d[_0xcbd4('0x32')]=utils['now']();_0xc396d[_0xcbd4('0xc')]=_0xcbd4('0x33');_0xc396d[_0xcbd4('0x2d')]=_0xcbd4('0x33');_0xc396d['answeredelsewheredestinationuniqueid']=_0x2aea14[_0xcbd4('0x15')];_0xc396d[_0xcbd4('0x34')]=_0x2aea14[_0xcbd4('0x8')];writeDB(_0xc396d);}});}}catch(_0x4b1973){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x2f'),_0x2aea14['uniqueid']),_0x4b1973);}};exports[_0xcbd4('0x10')]=function(_0x213578){try{if(!_[_0xcbd4('0x20')](agents[_0x213578[_0xcbd4('0x15')]])){utils['debug'](util[_0xcbd4('0x3')](_0xcbd4('0x35'),_0x213578[_0xcbd4('0x5')]),_0x213578);utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x36'),_0x213578[_0xcbd4('0x5')],agents[_0x213578[_0xcbd4('0x15')]]['membername'],_0x213578['destuniqueid']));agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x10')]=!![];agents[_0x213578['destuniqueid']][_0xcbd4('0x37')]=utils[_0xcbd4('0x1a')]();agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x37')],agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x30')]);agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0x2d')]=_0x213578[_0xcbd4('0x2d')];agents[_0x213578[_0xcbd4('0x15')]][_0xcbd4('0xc')]=_0xcbd4('0x39');writeDB(agents[_0x213578['destuniqueid']]);}}catch(_0x5c0a41){utils[_0xcbd4('0x1e')](util['format']('[%s][agents][agentcomplete]',_0x213578[_0xcbd4('0x5')]),_0x5c0a41);}};exports[_0xcbd4('0x3a')]=function(_0x162506){try{if(!_[_0xcbd4('0x20')](agents[_0x162506['transfereruniqueid']])){utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x3b'),_0x162506[_0xcbd4('0x5')]),_0x162506);utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x3c'),_0x162506[_0xcbd4('0x5')],agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x8')],agents[_0x162506[_0xcbd4('0x3d')]]['uniqueid']));agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x3e')]=!![];agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x3f')]=_0xcbd4('0x40');agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x41')]=_0x162506[_0xcbd4('0x42')];agents[_0x162506[_0xcbd4('0x3d')]]['transferuniqueid']=agents[_0x162506[_0xcbd4('0x3d')]][_0xcbd4('0x5')];}}catch(_0x2ce2af){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')](_0xcbd4('0x3b'),_0x162506[_0xcbd4('0x5')]),_0x2ce2af);}};exports[_0xcbd4('0x43')]=function(_0x316076){try{utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x44'),_0x316076['origtransfereruniqueid']),_0x316076);if(_0x316076[_0xcbd4('0x45')]==_0x316076[_0xcbd4('0x46')]){if(!_['isNil'](agents[_0x316076[_0xcbd4('0x47')]])){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x48'),_0x316076[_0xcbd4('0x45')],agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x8')]));agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x3e')]=!![];agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x3f')]=_0xcbd4('0x49');agents[_0x316076[_0xcbd4('0x47')]]['transferexten']=_0x316076[_0xcbd4('0x4a')];agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0x4b')]=_0x316076[_0xcbd4('0x45')];}if(_0x316076[_0xcbd4('0x4c')]&&agents[_0x316076[_0xcbd4('0x4c')]]){agents[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x4d')]=0x1;transfers[_0x316076[_0xcbd4('0x4c')]]=_[_0xcbd4('0x4e')](agents[_0x316076[_0xcbd4('0x4c')]]);transfers[_0x316076[_0xcbd4('0x4c')]]['calleridnum']=agents[_0x316076[_0xcbd4('0x47')]][_0xcbd4('0xa')];transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x4f')]=agents[_0x316076[_0xcbd4('0x47')]]['calleridname'];transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x19')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x30')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x4c')]][_0xcbd4('0x24')]=0x0;transfers[_0x316076[_0xcbd4('0x4c')]]['agententerreason']=0x2;}}else if(_0x316076[_0xcbd4('0x47')]==_0x316076[_0xcbd4('0x50')]){if(!_[_0xcbd4('0x20')](agents[_0x316076[_0xcbd4('0x45')]])){utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x48'),_0x316076[_0xcbd4('0x45')],agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x8')]));agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x3e')]=!![];agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x3f')]=_0xcbd4('0x49');agents[_0x316076[_0xcbd4('0x45')]]['transferexten']=_0x316076[_0xcbd4('0x51')];agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x4b')]=_0x316076[_0xcbd4('0x47')];}if(_0x316076['transfertargetuniqueid']&&agents[_0x316076[_0xcbd4('0x52')]]){agents[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4d')]=0x1;transfers[_0x316076[_0xcbd4('0x52')]]=_[_0xcbd4('0x4e')](agents[_0x316076[_0xcbd4('0x52')]]);transfers[_0x316076[_0xcbd4('0x52')]]['calleridnum']=agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0xa')];transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4f')]=agents[_0x316076[_0xcbd4('0x45')]][_0xcbd4('0x4f')];transfers[_0x316076['transfertargetuniqueid']][_0xcbd4('0x19')]=utils['now']();transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x30')]=utils[_0xcbd4('0x1a')]();transfers[_0x316076[_0xcbd4('0x52')]]['holdtime']=0x0;transfers[_0x316076[_0xcbd4('0x52')]][_0xcbd4('0x4d')]=0x2;}}}catch(_0xa2e555){utils[_0xcbd4('0x1e')](util['format']('[%s][agents][attendedtransfer]',_0x316076[_0xcbd4('0x45')]),_0xa2e555);}};exports[_0xcbd4('0x53')]=function(_0x1cdf15){try{utils[_0xcbd4('0x17')](util['format'](_0xcbd4('0x54'),_0x1cdf15['uniqueid']),_0x1cdf15);if(agents[_0x1cdf15[_0xcbd4('0x5')]]&&agents[_0x1cdf15[_0xcbd4('0x5')]]['reason']===_0xcbd4('0x23')){if(_0x1cdf15[_0xcbd4('0x55')]==='21'){agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')]=_0xcbd4('0x56');agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]=_0xcbd4('0x56');}utils['info'](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x8')],agents[_0x1cdf15[_0xcbd4('0x5')]]['reason'],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]));writeDB(agents[_0x1cdf15[_0xcbd4('0x5')]]);var _0x5dfe5=unanswered[_0xcbd4('0x58')](_0x1cdf15[_0xcbd4('0x5')]);if(_0x5dfe5>-0x1){unanswered[_0xcbd4('0x59')](_0x5dfe5,0x1);}}if(transfers[_0x1cdf15[_0xcbd4('0x5')]]){transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x10')]=!![];transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')]=utils['now']();transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x30')]);transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')]='agent';transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]=_0xcbd4('0x39');utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x8')],transfers[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x2d')],transfers[_0x1cdf15['uniqueid']]['lastevent']));writeDB(transfers[_0x1cdf15['uniqueid']],!![]);}if(agents[_0x1cdf15[_0xcbd4('0x5')]]&&agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x30')]){agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x10')]=!![];agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x37')]=utils[_0xcbd4('0x1a')]();agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x26')]=utils[_0xcbd4('0x38')](agents[_0x1cdf15['uniqueid']][_0xcbd4('0x37')],agents[_0x1cdf15[_0xcbd4('0x5')]]['agentconnectAt']);agents[_0x1cdf15[_0xcbd4('0x5')]]['reason']=agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0x3e')]?_0xcbd4('0x3e'):'agent';agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]='complete';utils[_0xcbd4('0x2')](util[_0xcbd4('0x3')](_0xcbd4('0x57'),_0x1cdf15[_0xcbd4('0x5')],agents[_0x1cdf15[_0xcbd4('0x5')]]['membername'],agents[_0x1cdf15[_0xcbd4('0x5')]]['reason'],agents[_0x1cdf15[_0xcbd4('0x5')]][_0xcbd4('0xc')]));writeDB(agents[_0x1cdf15[_0xcbd4('0x5')]]);}}catch(_0x1cace7){utils[_0xcbd4('0x1e')](util[_0xcbd4('0x3')]('[%s][agents][hangup]',_0x1cdf15[_0xcbd4('0x5')]),_0x1cace7);}}; \ No newline at end of file +var _0x8116=['splice','agentconnectAt','agent','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','connectedlinename','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','timeout','reason','holdtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','ringtime','lastevent','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf'];(function(_0x158b04,_0x18099a){var _0x4210c0=function(_0x3abda6){while(--_0x3abda6){_0x158b04['push'](_0x158b04['shift']());}};_0x4210c0(++_0x18099a);}(_0x8116,0x1b1));var _0x6811=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8116[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x6811('0x0'));var utils=require(_0x6811('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1df873,_0x51446d){utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x4'),_0x1df873[_0x6811('0x5')],_0x1df873[_0x6811('0x6')],_0x1df873[_0x6811('0x7')],_0x1df873[_0x6811('0x8')],_0x1df873['interface'],_0x1df873[_0x6811('0x9')],_0x1df873[_0x6811('0xa')],_0x1df873['lastevent']));if(_0x1df873[_0x6811('0x7')]){utils['getVoiceQueueByName'](_0x1df873[_0x6811('0x7')])['then'](function(_0x120b95){if(_0x120b95){_0x1df873[_0x6811('0xb')]=_0x120b95[_0x6811('0xb')];_0x1df873[_0x6811('0xc')]=_0x1df873['agentcomplete']?_0x120b95['acw']:![];_0x1df873[_0x6811('0xd')]=_0x1df873['agentacw']?_0x120b95[_0x6811('0xe')]:0x0;}utils[_0x6811('0xf')](_0x6811('0x10'),_0x1df873);});}else{utils[_0x6811('0xf')]('CreateVoiceAgentReport',_0x1df873);}if(_0x51446d){delete transfers[_0x1df873['uniqueid']];}else{delete agents[_0x1df873[_0x6811('0x11')]];}}exports[_0x6811('0x12')]=function(_0x210c35){try{utils['debug'](util[_0x6811('0x3')]('[%s][agents][agentcalled]',_0x210c35[_0x6811('0x5')]),_0x210c35);agents[_0x210c35[_0x6811('0x11')]]=_0x210c35;agents[_0x210c35[_0x6811('0x11')]][_0x6811('0x13')]=utils['now']();agents[_0x210c35[_0x6811('0x11')]]['lastevent']='called';agents[_0x210c35[_0x6811('0x11')]][_0x6811('0xa')]=null;agents[_0x210c35['destuniqueid']][_0x6811('0x14')]=null;utils[_0x6811('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x210c35['uniqueid'],agents[_0x210c35[_0x6811('0x11')]][_0x6811('0x8')],_0x210c35[_0x6811('0x11')]));}catch(_0x4c9ca2){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x16'),_0x210c35[_0x6811('0x5')]),_0x4c9ca2);}};exports[_0x6811('0x17')]=function(_0x43961c){try{if(!_[_0x6811('0x18')](agents[_0x43961c[_0x6811('0x11')]])){utils['debug'](util['format'](_0x6811('0x19'),_0x43961c[_0x6811('0x5')]),_0x43961c);utils[_0x6811('0x2')](util[_0x6811('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x43961c['uniqueid'],agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x8')],_0x43961c[_0x6811('0x11')]));agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x17')]=!![];agents[_0x43961c['destuniqueid']][_0x6811('0x1a')]=utils[_0x6811('0x1b')]();agents[_0x43961c[_0x6811('0x11')]]['lastevent']=_0x6811('0x1c');agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x1d')]=_0x6811('0x1c');agents[_0x43961c['destuniqueid']][_0x6811('0x1e')]=_0x43961c['ringtime']?parseInt(_0x43961c['ringtime'])/0x3e8:0x0;agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x1f')]=0x0;unanswered[_0x6811('0x20')](_0x43961c[_0x6811('0x11')]);}}catch(_0x2fab42){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x19'),_0x43961c['uniqueid']),_0x2fab42);}};exports[_0x6811('0x21')]=function(_0x26228a){try{_[_0x6811('0x22')](agents,function(_0x645737,_0x1a1444){if(_0x645737[_0x6811('0x5')]==_0x26228a[_0x6811('0x5')]&&!_[_0x6811('0x23')](unanswered,_0x645737[_0x6811('0x11')])){utils[_0x6811('0x24')](util[_0x6811('0x3')]('[%s][agents][queuecallerabandon]',_0x26228a['uniqueid']),_0x26228a);utils['info'](util[_0x6811('0x3')](_0x6811('0x25'),_0x26228a[_0x6811('0x5')],_0x645737['membername'],_0x645737[_0x6811('0x11')]));_0x645737['agentringnoanswer']=!![];_0x645737[_0x6811('0x1a')]=utils['now']();_0x645737['lastevent']=_0x6811('0x26');_0x645737['reason']='abandoned';_0x645737[_0x6811('0x1e')]=_0x26228a[_0x6811('0x1e')];_0x645737[_0x6811('0x1f')]=0x0;writeDB(_0x645737);}});}catch(_0x31b37b){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x27'),_0x26228a['uniqueid']),_0x31b37b);}};exports['agentconnect']=function(_0x4d42ec){try{if(agents[_0x4d42ec[_0x6811('0x11')]]){utils[_0x6811('0x24')](util[_0x6811('0x3')]('[%s][agents][agentconnect]',_0x4d42ec[_0x6811('0x5')]),_0x4d42ec);utils[_0x6811('0x2')](util[_0x6811('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4d42ec[_0x6811('0x5')],agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x8')],_0x4d42ec[_0x6811('0x11')]));agents[_0x4d42ec[_0x6811('0x11')]]['agentconnectAt']=utils[_0x6811('0x1b')]();agents[_0x4d42ec[_0x6811('0x11')]]['connectedlinenum']=_0x4d42ec[_0x6811('0xa')];agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x14')]=_0x4d42ec[_0x6811('0x14')];agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x1e')]=_0x4d42ec[_0x6811('0x28')];agents[_0x4d42ec['destuniqueid']][_0x6811('0x29')]=_0x6811('0x2a');_[_0x6811('0x22')](agents,function(_0x273ec1,_0x3ca06e){if(_0x273ec1[_0x6811('0x11')]!=_0x4d42ec['destuniqueid']&&_0x273ec1['uniqueid']==_0x4d42ec[_0x6811('0x5')]){_0x273ec1[_0x6811('0x1f')]=0x0;_0x273ec1[_0x6811('0x1e')]=_0x4d42ec[_0x6811('0x28')];_0x273ec1['agentringnoanswer']=!![];_0x273ec1[_0x6811('0x1a')]=utils[_0x6811('0x1b')]();_0x273ec1[_0x6811('0x29')]=_0x6811('0x2b');_0x273ec1[_0x6811('0x1d')]=_0x6811('0x2b');_0x273ec1[_0x6811('0x2c')]=_0x4d42ec[_0x6811('0x11')];_0x273ec1[_0x6811('0x2d')]=_0x4d42ec[_0x6811('0x8')];writeDB(_0x273ec1);}});}}catch(_0x393a4e){utils['error'](util[_0x6811('0x3')](_0x6811('0x2e'),_0x4d42ec[_0x6811('0x5')]),_0x393a4e);}};exports[_0x6811('0x2f')]=function(_0x5af41b){try{if(!_[_0x6811('0x18')](agents[_0x5af41b[_0x6811('0x11')]])){utils[_0x6811('0x24')](util['format'](_0x6811('0x30'),_0x5af41b['uniqueid']),_0x5af41b);utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x31'),_0x5af41b[_0x6811('0x5')],agents[_0x5af41b['destuniqueid']][_0x6811('0x8')],_0x5af41b['destuniqueid']));agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x2f')]=!![];agents[_0x5af41b['destuniqueid']][_0x6811('0x32')]=utils[_0x6811('0x1b')]();agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x1f')]=utils['diffTime'](agents[_0x5af41b['destuniqueid']][_0x6811('0x32')],agents[_0x5af41b[_0x6811('0x11')]]['agentconnectAt']);agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x1d')]=_0x5af41b[_0x6811('0x1d')];agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x29')]=_0x6811('0x33');writeDB(agents[_0x5af41b['destuniqueid']]);}}catch(_0x26cc72){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x30'),_0x5af41b[_0x6811('0x5')]),_0x26cc72);}};exports[_0x6811('0x34')]=function(_0x18987e){try{if(!_[_0x6811('0x18')](agents[_0x18987e[_0x6811('0x35')]])){utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x36'),_0x18987e[_0x6811('0x5')]),_0x18987e);utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x37'),_0x18987e[_0x6811('0x5')],agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x8')],agents[_0x18987e['transfereruniqueid']][_0x6811('0x5')]));agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x38')]=!![];agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x39')]=_0x6811('0x3a');agents[_0x18987e['transfereruniqueid']][_0x6811('0x3b')]=_0x18987e[_0x6811('0x3c')];agents[_0x18987e[_0x6811('0x35')]]['transferuniqueid']=agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x5')];}}catch(_0x41c68d){utils[_0x6811('0x15')](util[_0x6811('0x3')]('[%s][agents][blindtransfer]',_0x18987e[_0x6811('0x5')]),_0x41c68d);}};exports[_0x6811('0x3d')]=function(_0x5d1e88){try{utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x3e'),_0x5d1e88[_0x6811('0x3f')]),_0x5d1e88);if(_0x5d1e88[_0x6811('0x3f')]==_0x5d1e88[_0x6811('0x40')]){if(!_[_0x6811('0x18')](agents[_0x5d1e88[_0x6811('0x41')]])){utils['info'](util[_0x6811('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d1e88[_0x6811('0x3f')],agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x8')]));agents[_0x5d1e88[_0x6811('0x41')]]['transfer']=!![];agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x39')]=_0x6811('0x42');agents[_0x5d1e88['secondtransfereruniqueid']][_0x6811('0x3b')]=_0x5d1e88[_0x6811('0x43')];agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x44')]=_0x5d1e88[_0x6811('0x3f')];}if(_0x5d1e88[_0x6811('0x45')]&&agents[_0x5d1e88[_0x6811('0x45')]]){agents[_0x5d1e88['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x5d1e88['transfereeuniqueid']]=_[_0x6811('0x46')](agents[_0x5d1e88[_0x6811('0x45')]]);transfers[_0x5d1e88['transfereeuniqueid']][_0x6811('0x9')]=agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x9')];transfers[_0x5d1e88[_0x6811('0x45')]]['calleridname']=agents[_0x5d1e88['secondtransfereruniqueid']][_0x6811('0x47')];transfers[_0x5d1e88['transfereeuniqueid']][_0x6811('0x13')]=utils['now']();transfers[_0x5d1e88[_0x6811('0x45')]]['agentconnectAt']=utils[_0x6811('0x1b')]();transfers[_0x5d1e88['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x5d1e88[_0x6811('0x45')]][_0x6811('0x48')]=0x2;}}else if(_0x5d1e88[_0x6811('0x41')]==_0x5d1e88[_0x6811('0x49')]){if(!_[_0x6811('0x18')](agents[_0x5d1e88[_0x6811('0x3f')]])){utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x4a'),_0x5d1e88['origtransfereruniqueid'],agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x8')]));agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x38')]=!![];agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x39')]=_0x6811('0x42');agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x3b')]=_0x5d1e88[_0x6811('0x4b')];agents[_0x5d1e88['origtransfereruniqueid']][_0x6811('0x44')]=_0x5d1e88['secondtransfereruniqueid'];}if(_0x5d1e88[_0x6811('0x4c')]&&agents[_0x5d1e88[_0x6811('0x4c')]]){agents[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x48')]=0x1;transfers[_0x5d1e88[_0x6811('0x4c')]]=_['clone'](agents[_0x5d1e88[_0x6811('0x4c')]]);transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x9')]=agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x9')];transfers[_0x5d1e88[_0x6811('0x4c')]]['calleridname']=agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x47')];transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x13')]=utils[_0x6811('0x1b')]();transfers[_0x5d1e88[_0x6811('0x4c')]]['agentconnectAt']=utils['now']();transfers[_0x5d1e88['transfertargetuniqueid']][_0x6811('0x1e')]=0x0;transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x48')]=0x2;}}}catch(_0x4995e8){utils[_0x6811('0x15')](util['format'](_0x6811('0x3e'),_0x5d1e88[_0x6811('0x3f')]),_0x4995e8);}};exports[_0x6811('0x4d')]=function(_0x10dd58){try{utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x4e'),_0x10dd58[_0x6811('0x5')]),_0x10dd58);if(agents[_0x10dd58[_0x6811('0x5')]]&&agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')]===_0x6811('0x1c')){if(_0x10dd58[_0x6811('0x4f')]==='21'){agents[_0x10dd58[_0x6811('0x5')]]['reason']='rejected';agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]=_0x6811('0x50');}utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],agents[_0x10dd58['uniqueid']]['membername'],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]));writeDB(agents[_0x10dd58[_0x6811('0x5')]]);var _0x25272a=unanswered[_0x6811('0x52')](_0x10dd58[_0x6811('0x5')]);if(_0x25272a>-0x1){unanswered[_0x6811('0x53')](_0x25272a,0x1);}}if(transfers[_0x10dd58[_0x6811('0x5')]]){transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x2f')]=!![];transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')]=utils[_0x6811('0x1b')]();transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1f')]=utils['diffTime'](transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')],transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]);transfers[_0x10dd58[_0x6811('0x5')]]['reason']='agent';transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]=_0x6811('0x33');utils['info'](util['format'](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],transfers[_0x10dd58[_0x6811('0x5')]]['membername'],transfers[_0x10dd58['uniqueid']][_0x6811('0x1d')],transfers[_0x10dd58[_0x6811('0x5')]]['lastevent']));writeDB(transfers[_0x10dd58[_0x6811('0x5')]],!![]);}if(agents[_0x10dd58[_0x6811('0x5')]]&&agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]){agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x2f')]=!![];agents[_0x10dd58[_0x6811('0x5')]]['agentcompleteAt']=utils[_0x6811('0x1b')]();agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1f')]=utils['diffTime'](agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]);agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')]=agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x38')]?_0x6811('0x38'):_0x6811('0x55');agents[_0x10dd58['uniqueid']][_0x6811('0x29')]='complete';utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x8')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]));writeDB(agents[_0x10dd58[_0x6811('0x5')]]);}}catch(_0x535d65){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x4e'),_0x10dd58[_0x6811('0x5')]),_0x535d65);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 918e350..5515b22 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 _0xa8f6=['info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','connectedlinenum','lastevent','accountcode','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','now','DOCUMENTATION','error','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','origtransfererchannel','userfield','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','destination','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','[%s][calls][newexten]','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa8f6,0x11b));var _0x6a8f=function(_0x4214b1,_0x517af6){_0x4214b1=_0x4214b1-0x0;var _0x245197=_0xa8f6[_0x4214b1];return _0x245197;};'use strict';var _=require(_0x6a8f('0x0'));var util=require('util');var utils=require(_0x6a8f('0x1'));var dispositions=['NO\x20ANSWER','FAILED',_0x6a8f('0x2'),_0x6a8f('0x3'),_0x6a8f('0x3'),_0x6a8f('0x3'),_0x6a8f('0x4'),'BUSY',_0x6a8f('0x2'),'FAILED',_0x6a8f('0x2')];var channels={};function writeDB(_0x4291db){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x7'),_0x4291db[_0x6a8f('0x8')],_0x4291db[_0x6a8f('0x9')],_0x4291db[_0x6a8f('0xa')],_0x4291db['membername'],_0x4291db[_0x6a8f('0xb')],_0x4291db['calleridnum'],_0x4291db[_0x6a8f('0xc')],_0x4291db[_0x6a8f('0xd')]));if(_0x4291db[_0x6a8f('0xe')]){utils['getUserByInternal'](_0x4291db[_0x6a8f('0xe')])[_0x6a8f('0xf')](function(_0x4f32ee){if(_0x4f32ee){_0x4291db['UserId']=_0x4f32ee['id'];}utils[_0x6a8f('0x10')](_0x6a8f('0x11'),_0x4291db);});}else{utils[_0x6a8f('0x10')]('CreateVoiceCallReport',_0x4291db);}if(channels[_0x4291db[_0x6a8f('0x8')]]){delete channels[_0x4291db[_0x6a8f('0x8')]];}}exports['newchannel']=function(_0x33f5cf){try{utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x13'),_0x33f5cf['uniqueid']),_0x33f5cf);if(_0x33f5cf[_0x6a8f('0x8')]==_0x33f5cf[_0x6a8f('0x14')]&&_0x33f5cf[_0x6a8f('0x9')]!=_0x6a8f('0x15')){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x16'),_0x33f5cf[_0x6a8f('0x8')],_0x33f5cf[_0x6a8f('0x17')],_0x33f5cf['exten']));channels[_0x33f5cf[_0x6a8f('0x8')]]={'uniqueid':_0x33f5cf['uniqueid'],'accountcode':_0x33f5cf[_0x6a8f('0xe')],'source':_0x33f5cf[_0x6a8f('0x18')],'destination':_0x33f5cf['exten'],'destinationcontext':_0x33f5cf[_0x6a8f('0x17')],'channel':_0x33f5cf[_0x6a8f('0x9')],'starttime':utils[_0x6a8f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6a8f('0x3'),'amaflags':_0x6a8f('0x1a')};}}catch(_0x30505d){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x13'),_0x33f5cf['uniqueid']),_0x30505d);}};exports['newstate']=function(_0x44a186){try{utils[_0x6a8f('0x12')](util['format']('[%s][calls][newstate]',_0x44a186[_0x6a8f('0x8')]),_0x44a186);if(!_[_0x6a8f('0x1c')](channels[_0x44a186['uniqueid']])&&_0x44a186[_0x6a8f('0x1d')]==0x6){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x1e'),_0x44a186[_0x6a8f('0x8')],_0x44a186['context'],_0x44a186['channel']));if(_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x8')]][_0x6a8f('0x1f')])){channels[_0x44a186[_0x6a8f('0x8')]][_0x6a8f('0x1f')]=utils[_0x6a8f('0x19')]();}}else if(!_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x14')]])&&_0x44a186['channelstate']==0x6&&_0x44a186[_0x6a8f('0x17')]!=_0x6a8f('0x20')){utils['info'](util['format'](_0x6a8f('0x21'),_0x44a186[_0x6a8f('0x8')],_0x44a186[_0x6a8f('0x14')],_0x44a186[_0x6a8f('0x17')],_0x44a186[_0x6a8f('0x9')]));channels[_0x44a186[_0x6a8f('0x14')]]['accountcode']=_0x44a186[_0x6a8f('0xe')];channels[_0x44a186['linkedid']][_0x6a8f('0x22')]=_0x44a186['channel'];if(_[_0x6a8f('0x1c')](channels[_0x44a186[_0x6a8f('0x14')]][_0x6a8f('0x23')])){channels[_0x44a186[_0x6a8f('0x14')]][_0x6a8f('0x23')]=utils['now']();}channels[_0x44a186['linkedid']][_0x6a8f('0x24')]=dispositions[_[_0x6a8f('0x25')](_0x44a186[_0x6a8f('0x1d')])]||_0x6a8f('0x4');}}catch(_0x587817){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x26'),_0x44a186[_0x6a8f('0x8')]),_0x587817);}};exports['hangup']=function(_0x493660){try{if(!_[_0x6a8f('0x1c')](channels[_0x493660[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x27'),_0x493660[_0x6a8f('0x8')]),_0x493660);if(_[_0x6a8f('0x1c')](channels[_0x493660[_0x6a8f('0x8')]]['callerid'])){channels[_0x493660['uniqueid']][_0x6a8f('0x28')]=_0x493660[_0x6a8f('0x29')]+'\x20<'+_0x493660['calleridnum']+'>';}utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x2a'),_0x493660['uniqueid'],channels[_0x493660['uniqueid']][_0x6a8f('0x28')],_0x493660[_0x6a8f('0x2b')]));channels[_0x493660[_0x6a8f('0x8')]]['endtime']=utils[_0x6a8f('0x19')]();channels[_0x493660['uniqueid']]['duration']=utils[_0x6a8f('0x2c')](channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2d')],channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2e')]);channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x2f')]=channels[_0x493660[_0x6a8f('0x8')]]['answertime']?utils[_0x6a8f('0x2c')](channels[_0x493660['uniqueid']][_0x6a8f('0x2d')],channels[_0x493660[_0x6a8f('0x8')]][_0x6a8f('0x23')]):0x0;writeDB(channels[_0x493660[_0x6a8f('0x8')]]);}}catch(_0x3b2d99){utils[_0x6a8f('0x1b')](util['format'](_0x6a8f('0x27'),_0x493660[_0x6a8f('0x8')]),_0x3b2d99);}};exports[_0x6a8f('0x30')]=function(_0x17373f){try{if(!_[_0x6a8f('0x1c')](channels[_0x17373f[_0x6a8f('0x31')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x32'),_0x17373f[_0x6a8f('0x33')]),_0x17373f);if(channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x9')]==_0x17373f['transfereechannel']){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x34'),_0x17373f[_0x6a8f('0x33')],_0x17373f[_0x6a8f('0x31')],_0x17373f[_0x6a8f('0x35')]));channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x22')]=_0x17373f[_0x6a8f('0x35')];channels[_0x17373f['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x17373f['localtwolinkedid']][_0x6a8f('0x9')]=_0x17373f['transfertargetchannel']){utils['info'](util[_0x6a8f('0x6')](_0x6a8f('0x34'),_0x17373f['origtransfereruniqueid'],_0x17373f[_0x6a8f('0x31')],_0x17373f[_0x6a8f('0x36')]));channels[_0x17373f['localtwolinkedid']][_0x6a8f('0x22')]=_0x17373f[_0x6a8f('0x36')];channels[_0x17373f[_0x6a8f('0x31')]][_0x6a8f('0x37')]=_0x6a8f('0x38');}}}catch(_0x504a44){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x32'),_0x17373f['origtransfereruniqueid']),_0x504a44);}};exports['musiconholdstart']=function(_0x52ed18){try{if(!_[_0x6a8f('0x1c')](channels[_0x52ed18[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x39'),_0x52ed18[_0x6a8f('0x8')]),_0x52ed18);channels[_0x52ed18['uniqueid']][_0x6a8f('0x3a')]=utils[_0x6a8f('0x19')]();utils['info'](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x52ed18['uniqueid'],channels[_0x52ed18[_0x6a8f('0x8')]][_0x6a8f('0x3a')]));}}catch(_0x1d1518){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstart]',_0x52ed18[_0x6a8f('0x8')]),_0x1d1518);}};exports[_0x6a8f('0x3b')]=function(_0x3867bd){try{if(!_[_0x6a8f('0x1c')](channels[_0x3867bd[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x3c'),_0x3867bd['uniqueid']),_0x3867bd);if(!_[_0x6a8f('0x1c')](channels[_0x3867bd[_0x6a8f('0x8')]]['musiconholdstartAt'])){channels[_0x3867bd['uniqueid']][_0x6a8f('0x3d')]+=utils[_0x6a8f('0x2c')](utils[_0x6a8f('0x19')](),channels[_0x3867bd[_0x6a8f('0x8')]]['musiconholdstartAt']);utils['info'](util[_0x6a8f('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3867bd[_0x6a8f('0x8')],channels[_0x3867bd['uniqueid']][_0x6a8f('0x3d')]));delete channels[_0x3867bd[_0x6a8f('0x8')]][_0x6a8f('0x3a')];}}}catch(_0x2c0abb){utils[_0x6a8f('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x3867bd[_0x6a8f('0x8')]),_0x2c0abb);}};exports[_0x6a8f('0x3e')]=function(_0x5b0a61){try{if(!_[_0x6a8f('0x1c')](channels[_0x5b0a61[_0x6a8f('0x8')]])){utils[_0x6a8f('0x12')](util[_0x6a8f('0x6')](_0x6a8f('0x3f'),_0x5b0a61[_0x6a8f('0x8')]),_0x5b0a61);if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x41')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61['uniqueid']][_0x6a8f('0x43')]=_0x5b0a61[_0x6a8f('0x42')];}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-phone'])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x44')]=_0x5b0a61['value'];channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x28')]='\x22'+_0x5b0a61[_0x6a8f('0x42')]+_0x6a8f('0x45')+_0x5b0a61[_0x6a8f('0x42')]+'>';}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x46')])||!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-callerid'])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')]['xmd-callerid-preview'])?_0x6a8f('0x46'):'xmd-callerid',_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]]['callerid']=_0x5b0a61[_0x6a8f('0x42')];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x47')])||!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x48')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')](_0x6a8f('0x49'),_0x5b0a61[_0x6a8f('0x8')],!_[_0x6a8f('0x1c')](_0x5b0a61['variable'][_0x6a8f('0x47')])?'xmd-queue':'xmcs-queue',_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4a')]=_0x6a8f('0x4b');channels[_0x5b0a61[_0x6a8f('0x8')]]['lastdata']=_0x5b0a61[_0x6a8f('0x42')];channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0xa')]=!![];}if(!_['isNil'](_0x5b0a61[_0x6a8f('0x40')]['xmd-contactid'])){utils['info'](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5b0a61['uniqueid'],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4c')]=_0x5b0a61['value'];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')]['xmd-cdrtype'])){utils['info'](util[_0x6a8f('0x6')](_0x6a8f('0x4d'),_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x4e')]=_0x5b0a61[_0x6a8f('0x42')];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x4f')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61['uniqueid']][_0x6a8f('0x50')]=_0x5b0a61['value'];}if(!_[_0x6a8f('0x1c')](_0x5b0a61[_0x6a8f('0x40')][_0x6a8f('0x51')])){utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5b0a61[_0x6a8f('0x8')],_0x5b0a61[_0x6a8f('0x42')]));channels[_0x5b0a61[_0x6a8f('0x8')]][_0x6a8f('0x51')]=_0x5b0a61['value'];}}}catch(_0x17298e){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x3f'),_0x5b0a61['uniqueid']),_0x17298e);}};exports['newexten']=function(_0x501f3e){try{if(!_[_0x6a8f('0x1c')](channels[_0x501f3e[_0x6a8f('0x8')]])){utils['debug'](util['format']('[%s][calls][newexten]',_0x501f3e[_0x6a8f('0x8')]),_0x501f3e);utils[_0x6a8f('0x5')](util[_0x6a8f('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x501f3e[_0x6a8f('0x8')],_0x501f3e[_0x6a8f('0x52')],_0x501f3e[_0x6a8f('0x53')]));if(_0x501f3e[_0x6a8f('0x52')][_0x6a8f('0x54')]()=='set'&&_['startsWith'](_0x501f3e[_0x6a8f('0x53')]['toLowerCase'](),_0x6a8f('0x55'))){var _0x124f9a=_0x501f3e[_0x6a8f('0x53')][_0x6a8f('0x56')]('=');var _0x2cef22=_0x124f9a[0x0][_0x6a8f('0x57')](_0x124f9a[0x0][_0x6a8f('0x58')]('(')+0x1,_0x124f9a[0x0][_0x6a8f('0x58')](')'));var _0x2e0542=_0x124f9a[0x1];channels[_0x501f3e['uniqueid']][_0x2cef22]=_0x2e0542;}if(!_[_0x6a8f('0x59')]([_0x6a8f('0x5a'),_0x6a8f('0x5b'),_0x6a8f('0x5c'),'set',_0x6a8f('0x5d')],_0x501f3e[_0x6a8f('0x52')][_0x6a8f('0x54')]())){channels[_0x501f3e[_0x6a8f('0x8')]][_0x6a8f('0x4a')]=_0x501f3e['application'];channels[_0x501f3e['uniqueid']][_0x6a8f('0x5e')]=_0x501f3e['appdata'];}}}catch(_0x17cb48){utils[_0x6a8f('0x1b')](util[_0x6a8f('0x6')](_0x6a8f('0x5f'),_0x501f3e[_0x6a8f('0x8')]),_0x17cb48);}}; \ No newline at end of file +var _0x1e3d=['mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','application','util','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x3c9e30,_0x4db9f9){var _0xbddb66=function(_0x4c8ad1){while(--_0x4c8ad1){_0x3c9e30['push'](_0x3c9e30['shift']());}};_0xbddb66(++_0x4db9f9);}(_0x1e3d,0x171));var _0xd1e3=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1e3d[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0xd1e3('0x0'));var utils=require('./utils');var dispositions=[_0xd1e3('0x1'),_0xd1e3('0x2'),_0xd1e3('0x2'),_0xd1e3('0x1'),_0xd1e3('0x1'),'NO\x20ANSWER',_0xd1e3('0x3'),'BUSY',_0xd1e3('0x2'),_0xd1e3('0x2'),_0xd1e3('0x2')];var channels={};function writeDB(_0xfcdee6){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x6'),_0xfcdee6[_0xd1e3('0x7')],_0xfcdee6[_0xd1e3('0x8')],_0xfcdee6[_0xd1e3('0x9')],_0xfcdee6[_0xd1e3('0xa')],_0xfcdee6[_0xd1e3('0xb')],_0xfcdee6[_0xd1e3('0xc')],_0xfcdee6[_0xd1e3('0xd')],_0xfcdee6['lastevent']));if(_0xfcdee6[_0xd1e3('0xe')]){utils[_0xd1e3('0xf')](_0xfcdee6['accountcode'])[_0xd1e3('0x10')](function(_0x5004f7){if(_0x5004f7){_0xfcdee6[_0xd1e3('0x11')]=_0x5004f7['id'];}utils[_0xd1e3('0x12')](_0xd1e3('0x13'),_0xfcdee6);});}else{utils[_0xd1e3('0x12')](_0xd1e3('0x13'),_0xfcdee6);}if(channels[_0xfcdee6[_0xd1e3('0x7')]]){delete channels[_0xfcdee6['uniqueid']];}}exports[_0xd1e3('0x14')]=function(_0x3aa925){try{utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x16'),_0x3aa925[_0xd1e3('0x7')]),_0x3aa925);if(_0x3aa925[_0xd1e3('0x7')]==_0x3aa925[_0xd1e3('0x17')]&&_0x3aa925['channel']!=_0xd1e3('0x18')){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3aa925[_0xd1e3('0x7')],_0x3aa925[_0xd1e3('0x19')],_0x3aa925[_0xd1e3('0x1a')]));channels[_0x3aa925[_0xd1e3('0x7')]]={'uniqueid':_0x3aa925[_0xd1e3('0x7')],'accountcode':_0x3aa925[_0xd1e3('0xe')],'source':_0x3aa925[_0xd1e3('0xc')],'destination':_0x3aa925['exten'],'destinationcontext':_0x3aa925['context'],'channel':_0x3aa925[_0xd1e3('0x8')],'starttime':utils[_0xd1e3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd1e3('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x597989){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x16'),_0x3aa925['uniqueid']),_0x597989);}};exports[_0xd1e3('0x1d')]=function(_0x44b53e){try{utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x1e'),_0x44b53e[_0xd1e3('0x7')]),_0x44b53e);if(!_['isNil'](channels[_0x44b53e[_0xd1e3('0x7')]])&&_0x44b53e[_0xd1e3('0x1f')]==0x6){utils[_0xd1e3('0x4')](util['format'](_0xd1e3('0x20'),_0x44b53e['uniqueid'],_0x44b53e[_0xd1e3('0x19')],_0x44b53e['channel']));if(_[_0xd1e3('0x21')](channels[_0x44b53e[_0xd1e3('0x7')]][_0xd1e3('0x22')])){channels[_0x44b53e['uniqueid']]['systemanswertime']=utils[_0xd1e3('0x1b')]();}}else if(!_['isNil'](channels[_0x44b53e[_0xd1e3('0x17')]])&&_0x44b53e[_0xd1e3('0x1f')]==0x6&&_0x44b53e[_0xd1e3('0x19')]!=_0xd1e3('0x23')){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x24'),_0x44b53e[_0xd1e3('0x7')],_0x44b53e['linkedid'],_0x44b53e[_0xd1e3('0x19')],_0x44b53e[_0xd1e3('0x8')]));channels[_0x44b53e['linkedid']]['accountcode']=_0x44b53e['accountcode'];channels[_0x44b53e[_0xd1e3('0x17')]][_0xd1e3('0x25')]=_0x44b53e[_0xd1e3('0x8')];if(_[_0xd1e3('0x21')](channels[_0x44b53e[_0xd1e3('0x17')]][_0xd1e3('0x26')])){channels[_0x44b53e[_0xd1e3('0x17')]]['answertime']=utils['now']();}channels[_0x44b53e['linkedid']]['disposition']=dispositions[_[_0xd1e3('0x27')](_0x44b53e[_0xd1e3('0x1f')])]||'ANSWERED';}}catch(_0x359607){utils['error'](util[_0xd1e3('0x5')](_0xd1e3('0x1e'),_0x44b53e[_0xd1e3('0x7')]),_0x359607);}};exports['hangup']=function(_0x107f98){try{if(!_['isNil'](channels[_0x107f98[_0xd1e3('0x7')]])){utils[_0xd1e3('0x15')](util['format'](_0xd1e3('0x28'),_0x107f98[_0xd1e3('0x7')]),_0x107f98);if(_[_0xd1e3('0x21')](channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x29')])){channels[_0x107f98['uniqueid']][_0xd1e3('0x29')]=_0x107f98[_0xd1e3('0x2a')]+'\x20<'+_0x107f98[_0xd1e3('0xc')]+'>';}utils['info'](util[_0xd1e3('0x5')](_0xd1e3('0x2b'),_0x107f98[_0xd1e3('0x7')],channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x29')],_0x107f98[_0xd1e3('0x2c')]));channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x2d')]=utils['now']();channels[_0x107f98['uniqueid']][_0xd1e3('0x2e')]=utils[_0xd1e3('0x2f')](channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x2d')],channels[_0x107f98['uniqueid']][_0xd1e3('0x30')]);channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x31')]=channels[_0x107f98['uniqueid']]['answertime']?utils['diffTime'](channels[_0x107f98['uniqueid']][_0xd1e3('0x2d')],channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x26')]):0x0;writeDB(channels[_0x107f98[_0xd1e3('0x7')]]);}}catch(_0x3179e1){utils['error'](util['format']('[%s][calls][hangup]',_0x107f98[_0xd1e3('0x7')]),_0x3179e1);}};exports['attendedtransfer']=function(_0x561d17){try{if(!_[_0xd1e3('0x21')](channels[_0x561d17[_0xd1e3('0x32')]])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x33'),_0x561d17[_0xd1e3('0x34')]),_0x561d17);if(channels[_0x561d17[_0xd1e3('0x32')]]['channel']==_0x561d17[_0xd1e3('0x35')]){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x561d17[_0xd1e3('0x34')],_0x561d17[_0xd1e3('0x32')],_0x561d17[_0xd1e3('0x36')]));channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x25')]=_0x561d17['secondtransfererchannel'];channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x37')]='_attended';}else if(channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x8')]=_0x561d17['transfertargetchannel']){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x561d17[_0xd1e3('0x34')],_0x561d17[_0xd1e3('0x32')],_0x561d17[_0xd1e3('0x38')]));channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x25')]=_0x561d17[_0xd1e3('0x38')];channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x37')]='_attended';}}}catch(_0x5d8b34){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x33'),_0x561d17['origtransfereruniqueid']),_0x5d8b34);}};exports[_0xd1e3('0x39')]=function(_0x304ad0){try{if(!_['isNil'](channels[_0x304ad0['uniqueid']])){utils[_0xd1e3('0x15')](util['format']('[%s][calls][musiconholdstart]',_0x304ad0['uniqueid']),_0x304ad0);channels[_0x304ad0['uniqueid']][_0xd1e3('0x3a')]=utils[_0xd1e3('0x1b')]();utils['info'](util['format'](_0xd1e3('0x3b'),_0x304ad0[_0xd1e3('0x7')],channels[_0x304ad0['uniqueid']][_0xd1e3('0x3a')]));}}catch(_0x293b0d){utils[_0xd1e3('0x1c')](util['format'](_0xd1e3('0x3c'),_0x304ad0[_0xd1e3('0x7')]),_0x293b0d);}};exports[_0xd1e3('0x3d')]=function(_0x31a536){try{if(!_[_0xd1e3('0x21')](channels[_0x31a536['uniqueid']])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x3e'),_0x31a536[_0xd1e3('0x7')]),_0x31a536);if(!_[_0xd1e3('0x21')](channels[_0x31a536['uniqueid']][_0xd1e3('0x3a')])){channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3f')]+=utils[_0xd1e3('0x2f')](utils['now'](),channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3a')]);utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x40'),_0x31a536['uniqueid'],channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3f')]));delete channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3a')];}}}catch(_0x57f1eb){utils[_0xd1e3('0x1c')](util['format'](_0xd1e3('0x3e'),_0x31a536[_0xd1e3('0x7')]),_0x57f1eb);}};exports[_0xd1e3('0x41')]=function(_0x196c5e){try{if(!_[_0xd1e3('0x21')](channels[_0x196c5e[_0xd1e3('0x7')]])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')]('[%s][calls][varset]',_0x196c5e[_0xd1e3('0x7')]),_0x196c5e);if(!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x43')])){utils['info'](util[_0xd1e3('0x5')](_0xd1e3('0x44'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x46')]=_0x196c5e['value'];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x47')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x48'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e['uniqueid']][_0xd1e3('0x49')]=_0x196c5e['value'];channels[_0x196c5e['uniqueid']][_0xd1e3('0x29')]='\x22'+_0x196c5e[_0xd1e3('0x45')]+_0xd1e3('0x4a')+_0x196c5e['value']+'>';}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4b')])||!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4c')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x4d'),_0x196c5e[_0xd1e3('0x7')],!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4b')])?_0xd1e3('0x4b'):_0xd1e3('0x4c'),_0x196c5e['value']));channels[_0x196c5e['uniqueid']][_0xd1e3('0x29')]=_0x196c5e['value'];}if(!_[_0xd1e3('0x21')](_0x196c5e['variable']['xmd-queue'])||!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4e')])){utils['info'](util['format'](_0xd1e3('0x4d'),_0x196c5e[_0xd1e3('0x7')],!_['isNil'](_0x196c5e[_0xd1e3('0x42')]['xmd-queue'])?'xmd-queue':_0xd1e3('0x4e'),_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x4f')]=_0xd1e3('0x50');channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x51')]=_0x196c5e[_0xd1e3('0x45')];channels[_0x196c5e['uniqueid']][_0xd1e3('0x9')]=!![];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x52')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x53'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x54')]=_0x196c5e[_0xd1e3('0x45')];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x55')])){utils[_0xd1e3('0x4')](util['format'](_0xd1e3('0x56'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x57')]=_0x196c5e[_0xd1e3('0x45')];}if(!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x58')])){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x196c5e['uniqueid'],_0x196c5e['value']));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x59')]=_0x196c5e[_0xd1e3('0x45')];}if(!_['isNil'](_0x196c5e['variable'][_0xd1e3('0x5a')])){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]]['sipcallid']=_0x196c5e[_0xd1e3('0x45')];}}}catch(_0x47fce4){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x5b'),_0x196c5e['uniqueid']),_0x47fce4);}};exports[_0xd1e3('0x5c')]=function(_0x3c8a97){try{if(!_['isNil'](channels[_0x3c8a97['uniqueid']])){utils[_0xd1e3('0x15')](util['format'](_0xd1e3('0x5d'),_0x3c8a97[_0xd1e3('0x7')]),_0x3c8a97);utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x5e'),_0x3c8a97[_0xd1e3('0x7')],_0x3c8a97['application'],_0x3c8a97['appdata']));if(_0x3c8a97['application'][_0xd1e3('0x5f')]()==_0xd1e3('0x60')&&_[_0xd1e3('0x61')](_0x3c8a97[_0xd1e3('0x62')]['toLowerCase'](),'cdr')){var _0x42e9fe=_0x3c8a97[_0xd1e3('0x62')][_0xd1e3('0x63')]('=');var _0x19707d=_0x42e9fe[0x0][_0xd1e3('0x64')](_0x42e9fe[0x0][_0xd1e3('0x65')]('(')+0x1,_0x42e9fe[0x0][_0xd1e3('0x65')](')'));var _0x267637=_0x42e9fe[0x1];channels[_0x3c8a97[_0xd1e3('0x7')]][_0x19707d]=_0x267637;}if(!_[_0xd1e3('0x66')]([_0xd1e3('0x67'),_0xd1e3('0x68'),_0xd1e3('0x69'),_0xd1e3('0x60'),_0xd1e3('0x6a')],_0x3c8a97['application'][_0xd1e3('0x5f')]())){channels[_0x3c8a97[_0xd1e3('0x7')]][_0xd1e3('0x4f')]=_0x3c8a97[_0xd1e3('0x6b')];channels[_0x3c8a97[_0xd1e3('0x7')]][_0xd1e3('0x51')]=_0x3c8a97[_0xd1e3('0x62')];}}}catch(_0x335e16){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x5d'),_0x3c8a97[_0xd1e3('0x7')]),_0x335e16);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4aa6753..fa57044 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 _0xb0ad=['./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x59a0e4,_0x492f2c){var _0x64e2f9=function(_0x42df1e){while(--_0x42df1e){_0x59a0e4['push'](_0x59a0e4['shift']());}};_0x64e2f9(++_0x492f2c);}(_0xb0ad,0x108));var _0xdb0a=function(_0x176754,_0x5d697b){_0x176754=_0x176754-0x0;var _0x438829=_0xb0ad[_0x176754];return _0x438829;};'use strict';var utils=require(_0xdb0a('0x0'));exports[_0xdb0a('0x1')]=function(){utils[_0xdb0a('0x2')](_0xdb0a('0x3'));};exports[_0xdb0a('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xdb0a('0x5')]=function(){utils[_0xdb0a('0x2')](_0xdb0a('0x6'));};exports[_0xdb0a('0x7')]=function(_0x3ef715){utils[_0xdb0a('0x7')](_0xdb0a('0x8'),_0x3ef715);};exports[_0xdb0a('0x9')]=function(){utils[_0xdb0a('0x2')]('[core]\x20close');};exports[_0xdb0a('0xa')]=function(_0x5976c7){}; \ No newline at end of file +var _0x0f95=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','info','[core]\x20connected'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f95,0xfa));var _0x50f9=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x0f95[_0x3d13bb];return _0x4b5a1b;};'use strict';var utils=require('./utils');exports[_0x50f9('0x0')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x2'));};exports[_0x50f9('0x3')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x4'));};exports[_0x50f9('0x5')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x6'));};exports[_0x50f9('0x7')]=function(_0x36cab2){utils['error'](_0x50f9('0x8'),_0x36cab2);};exports[_0x50f9('0x9')]=function(){utils[_0x50f9('0x1')]('[core]\x20close');};exports[_0x50f9('0xa')]=function(_0x3f8317){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0671fb3..d99fcab 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 _0x55e1=['dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','endtime','holdtime','billableseconds','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','application','appdata','toLowerCase','startsWith','split','error','varset','[%s][dials][varset]','variable','value'];(function(_0x4b662d,_0x5b8058){var _0x3b9fd4=function(_0x326ed9){while(--_0x326ed9){_0x4b662d['push'](_0x4b662d['shift']());}};_0x3b9fd4(++_0x5b8058);}(_0x55e1,0x166));var _0x155e=function(_0x27db19,_0x41debc){_0x27db19=_0x27db19-0x0;var _0x437fa8=_0x55e1[_0x27db19];return _0x437fa8;};'use strict';var _=require('lodash');var util=require(_0x155e('0x0'));var utils=require(_0x155e('0x1'));var dials={};function writeDB(_0x31f7d6){utils['info'](util[_0x155e('0x2')](_0x155e('0x3'),_0x31f7d6['uniqueid'],_0x31f7d6[_0x155e('0x4')],_0x31f7d6[_0x155e('0x5')],_0x31f7d6[_0x155e('0x6')],_0x31f7d6[_0x155e('0x7')],_0x31f7d6[_0x155e('0x8')]));utils[_0x155e('0x9')](_0x155e('0xa'),_0x31f7d6);delete dials[_0x31f7d6[_0x155e('0xb')]];}exports[_0x155e('0xc')]=function(_0x22f101){try{utils[_0x155e('0xd')](util[_0x155e('0x2')](_0x155e('0xe'),_0x22f101['uniqueid']),_0x22f101);utils[_0x155e('0xf')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x22f101[_0x155e('0xb')],_0x22f101[_0x155e('0x10')],_0x22f101[_0x155e('0x11')]));if(_0x22f101[_0x155e('0x10')][_0x155e('0x12')]()=='set'&&_[_0x155e('0x13')](_0x22f101[_0x155e('0x11')][_0x155e('0x12')](),'cdr(routeid)')){var _0x30a6c7=_0x22f101['appdata'][_0x155e('0x14')]('=');dials[_0x22f101['uniqueid']]={'routeId':_0x30a6c7[0x1]};}}catch(_0x92f88c){utils[_0x155e('0x15')](util['format'](_0x155e('0xe'),_0x22f101[_0x155e('0xb')]),_0x92f88c);}};exports[_0x155e('0x16')]=function(_0x1b062e){try{utils[_0x155e('0xd')](util['format'](_0x155e('0x17'),_0x1b062e[_0x155e('0xb')]),_0x1b062e);if(!_['isNil'](_0x1b062e[_0x155e('0x18')]['outboundrouteid'])){utils[_0x155e('0xf')](util[_0x155e('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1b062e[_0x155e('0xb')],_0x1b062e[_0x155e('0x19')]));dials[_0x1b062e[_0x155e('0xb')]]={'routeId':_0x1b062e[_0x155e('0x19')]};}}catch(_0x10a208){utils[_0x155e('0x15')](util[_0x155e('0x2')]('[%s][dials][varset]',_0x1b062e[_0x155e('0xb')]),_0x10a208);}};exports[_0x155e('0x1a')]=function(_0x18d0c2){try{if(!_[_0x155e('0x1b')](dials[_0x18d0c2[_0x155e('0xb')]])){utils[_0x155e('0xd')](util[_0x155e('0x2')](_0x155e('0x1c'),_0x18d0c2[_0x155e('0xb')]),_0x18d0c2);dials[_0x18d0c2[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x18d0c2[_0x155e('0xb')]],_0x18d0c2);dials[_0x18d0c2[_0x155e('0xb')]]['starttime']=utils[_0x155e('0x1e')]();dials[_0x18d0c2['uniqueid']][_0x155e('0x1f')]='called';utils[_0x155e('0xf')](util[_0x155e('0x2')](_0x155e('0x20'),_0x18d0c2['uniqueid'],dials[_0x18d0c2[_0x155e('0xb')]][_0x155e('0x21')]));}}catch(_0x5445ca){utils[_0x155e('0x15')](util[_0x155e('0x2')](_0x155e('0x1c'),_0x18d0c2[_0x155e('0xb')]),_0x5445ca);}};exports[_0x155e('0x22')]=function(_0x16d90c){try{if(!_[_0x155e('0x1b')](dials[_0x16d90c[_0x155e('0xb')]])){utils[_0x155e('0xd')](util['format'](_0x155e('0x23'),_0x16d90c[_0x155e('0xb')]),_0x16d90c);dials[_0x16d90c[_0x155e('0xb')]]['dialstatus']=_0x16d90c[_0x155e('0x8')];if(_0x16d90c[_0x155e('0x8')]==_0x155e('0x24')){dials[_0x16d90c[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x16d90c[_0x155e('0xb')]],_0x16d90c);dials[_0x16d90c['uniqueid']][_0x155e('0x25')]=utils[_0x155e('0x1e')]();dials[_0x16d90c[_0x155e('0xb')]][_0x155e('0x1f')]='connect';utils[_0x155e('0xf')](util['format'](_0x155e('0x26'),_0x16d90c[_0x155e('0xb')],_0x16d90c[_0x155e('0x8')],dials[_0x16d90c[_0x155e('0xb')]]['answertime']));}else{utils[_0x155e('0xf')](util[_0x155e('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x16d90c[_0x155e('0xb')],_0x16d90c[_0x155e('0x8')]));}}}catch(_0x43cc33){utils['error'](util[_0x155e('0x2')](_0x155e('0x23'),_0x16d90c[_0x155e('0xb')]),_0x43cc33);}};exports[_0x155e('0x27')]=function(_0x5e91f2){try{if(!_['isNil'](dials[_0x5e91f2['uniqueid']])){utils['debug'](util[_0x155e('0x2')](_0x155e('0x28'),_0x5e91f2[_0x155e('0xb')]),_0x5e91f2);utils['info'](util[_0x155e('0x2')](_0x155e('0x29'),_0x5e91f2[_0x155e('0xb')],_0x5e91f2[_0x155e('0x6')],_0x5e91f2[_0x155e('0x2a')],_0x5e91f2[_0x155e('0x2b')]));dials[_0x5e91f2[_0x155e('0xb')]]=_[_0x155e('0x1d')](dials[_0x5e91f2[_0x155e('0xb')]],{'endtime':utils[_0x155e('0x1e')](),'lastevent':_0x155e('0x2c')});dials[_0x5e91f2[_0x155e('0xb')]]['duration']=utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2['uniqueid']][_0x155e('0x21')]);dials[_0x5e91f2['uniqueid']][_0x155e('0x2e')]=utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]||dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2['uniqueid']][_0x155e('0x21')]);dials[_0x5e91f2['uniqueid']][_0x155e('0x2f')]=dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]?utils['diffTime'](dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x2d')],dials[_0x5e91f2[_0x155e('0xb')]][_0x155e('0x25')]):0x0;writeDB(dials[_0x5e91f2[_0x155e('0xb')]]);}}catch(_0x2abfa9){utils['error'](util[_0x155e('0x2')](_0x155e('0x28'),_0x5e91f2[_0x155e('0xb')]),_0x2abfa9);}}; \ No newline at end of file +var _0xdfcf=['[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','isNil','variable','outboundrouteid','info','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','duration','diffTime','endtime','holdtime','./utils','format','channel','calleridnum','newexten','debug','[%s][dials][newexten]','uniqueid'];(function(_0x8e094c,_0x3bcd7f){var _0x3c0374=function(_0x5f1e9a){while(--_0x5f1e9a){_0x8e094c['push'](_0x8e094c['shift']());}};_0x3c0374(++_0x3bcd7f);}(_0xdfcf,0x73));var _0xfdfc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdfcf[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xfdfc('0x0'));var dials={};function writeDB(_0x2f94af){utils['info'](util[_0xfdfc('0x1')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2f94af['uniqueid'],_0x2f94af[_0xfdfc('0x2')],_0x2f94af['dialstring'],_0x2f94af[_0xfdfc('0x3')],_0x2f94af['connectedlinenum'],_0x2f94af['dialstatus']));utils['request']('CreateVoiceDialReport',_0x2f94af);delete dials[_0x2f94af['uniqueid']];}exports[_0xfdfc('0x4')]=function(_0x36fa7d){try{utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x6'),_0x36fa7d[_0xfdfc('0x7')]),_0x36fa7d);utils['info'](util[_0xfdfc('0x1')](_0xfdfc('0x8'),_0x36fa7d[_0xfdfc('0x7')],_0x36fa7d[_0xfdfc('0x9')],_0x36fa7d[_0xfdfc('0xa')]));if(_0x36fa7d[_0xfdfc('0x9')][_0xfdfc('0xb')]()=='set'&&_[_0xfdfc('0xc')](_0x36fa7d[_0xfdfc('0xa')]['toLowerCase'](),'cdr(routeid)')){var _0x2337bc=_0x36fa7d[_0xfdfc('0xa')][_0xfdfc('0xd')]('=');dials[_0x36fa7d[_0xfdfc('0x7')]]={'routeId':_0x2337bc[0x1]};}}catch(_0x253bf1){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')](_0xfdfc('0x6'),_0x36fa7d[_0xfdfc('0x7')]),_0x253bf1);}};exports[_0xfdfc('0xf')]=function(_0x527f5e){try{utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')]('[%s][dials][varset]',_0x527f5e['uniqueid']),_0x527f5e);if(!_[_0xfdfc('0x10')](_0x527f5e[_0xfdfc('0x11')][_0xfdfc('0x12')])){utils[_0xfdfc('0x13')](util[_0xfdfc('0x1')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x527f5e[_0xfdfc('0x7')],_0x527f5e[_0xfdfc('0x14')]));dials[_0x527f5e[_0xfdfc('0x7')]]={'routeId':_0x527f5e['value']};}}catch(_0x24e701){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')]('[%s][dials][varset]',_0x527f5e[_0xfdfc('0x7')]),_0x24e701);}};exports['dialbegin']=function(_0x55438f){try{if(!_[_0xfdfc('0x10')](dials[_0x55438f['uniqueid']])){utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x15'),_0x55438f[_0xfdfc('0x7')]),_0x55438f);dials[_0x55438f[_0xfdfc('0x7')]]=_[_0xfdfc('0x16')](dials[_0x55438f['uniqueid']],_0x55438f);dials[_0x55438f['uniqueid']][_0xfdfc('0x17')]=utils[_0xfdfc('0x18')]();dials[_0x55438f['uniqueid']][_0xfdfc('0x19')]=_0xfdfc('0x1a');utils[_0xfdfc('0x13')](util['format'](_0xfdfc('0x1b'),_0x55438f[_0xfdfc('0x7')],dials[_0x55438f[_0xfdfc('0x7')]][_0xfdfc('0x17')]));}}catch(_0x41ebc2){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')](_0xfdfc('0x15'),_0x55438f['uniqueid']),_0x41ebc2);}};exports[_0xfdfc('0x1c')]=function(_0x395dd9){try{if(!_[_0xfdfc('0x10')](dials[_0x395dd9['uniqueid']])){utils['debug'](util[_0xfdfc('0x1')](_0xfdfc('0x1d'),_0x395dd9[_0xfdfc('0x7')]),_0x395dd9);dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x1e')]=_0x395dd9['dialstatus'];if(_0x395dd9['dialstatus']==_0xfdfc('0x1f')){dials[_0x395dd9[_0xfdfc('0x7')]]=_['assign'](dials[_0x395dd9[_0xfdfc('0x7')]],_0x395dd9);dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x20')]=utils[_0xfdfc('0x18')]();dials[_0x395dd9[_0xfdfc('0x7')]]['lastevent']='connect';utils['info'](util[_0xfdfc('0x1')](_0xfdfc('0x21'),_0x395dd9[_0xfdfc('0x7')],_0x395dd9[_0xfdfc('0x1e')],dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x20')]));}else{utils[_0xfdfc('0x13')](util['format'](_0xfdfc('0x22'),_0x395dd9[_0xfdfc('0x7')],_0x395dd9['dialstatus']));}}}catch(_0x4764a8){utils['error'](util['format']('[%s][dials][dialend]',_0x395dd9['uniqueid']),_0x4764a8);}};exports['hangup']=function(_0x3e778a){try{if(!_[_0xfdfc('0x10')](dials[_0x3e778a[_0xfdfc('0x7')]])){utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x23'),_0x3e778a[_0xfdfc('0x7')]),_0x3e778a);utils[_0xfdfc('0x13')](util[_0xfdfc('0x1')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3e778a['uniqueid'],_0x3e778a[_0xfdfc('0x3')],_0x3e778a[_0xfdfc('0x24')],_0x3e778a['cause-txt']));dials[_0x3e778a['uniqueid']]=_[_0xfdfc('0x16')](dials[_0x3e778a[_0xfdfc('0x7')]],{'endtime':utils[_0xfdfc('0x18')](),'lastevent':'complete'});dials[_0x3e778a['uniqueid']][_0xfdfc('0x25')]=utils[_0xfdfc('0x26')](dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x27')],dials[_0x3e778a['uniqueid']][_0xfdfc('0x17')]);dials[_0x3e778a['uniqueid']][_0xfdfc('0x28')]=utils[_0xfdfc('0x26')](dials[_0x3e778a['uniqueid']][_0xfdfc('0x20')]||dials[_0x3e778a[_0xfdfc('0x7')]]['endtime'],dials[_0x3e778a[_0xfdfc('0x7')]]['starttime']);dials[_0x3e778a[_0xfdfc('0x7')]]['billableseconds']=dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x20')]?utils[_0xfdfc('0x26')](dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x27')],dials[_0x3e778a[_0xfdfc('0x7')]]['answertime']):0x0;writeDB(dials[_0x3e778a['uniqueid']]);}}catch(_0x11c6b7){utils['error'](util[_0xfdfc('0x1')](_0xfdfc('0x23'),_0x3e778a[_0xfdfc('0x7')]),_0x11c6b7);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 44602d0..8be2ebe 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 _0xe9b9=['[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','port','asterisk','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]'];(function(_0xad8fea,_0x358e38){var _0x567519=function(_0x11dd75){while(--_0x11dd75){_0xad8fea['push'](_0xad8fea['shift']());}};_0x567519(++_0x358e38);}(_0xe9b9,0x120));var _0x9e9b=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xe9b9[_0x1d87fc];return _0x492b56;};var AsteriskManager=require('asterisk-manager');var config=require(_0x9e9b('0x0'));var utils=require(_0x9e9b('0x1'));var util=require(_0x9e9b('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x9e9b('0x3')],config[_0x9e9b('0x4')]['ip'],config[_0x9e9b('0x4')][_0x9e9b('0x5')],config[_0x9e9b('0x4')]['password'],!![]);ami[_0x9e9b('0x6')]();if(config['xdr']&&config[_0x9e9b('0x7')][_0x9e9b('0x8')]){utils[_0x9e9b('0x9')](_0x9e9b('0xa'));}else{var agents=require(_0x9e9b('0xb'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x9e9b('0xc'));var members=require(_0x9e9b('0xd'));var dials=require(_0x9e9b('0xe'));var transfers=require('./transfers.controller');var core=require(_0x9e9b('0xf'));ami['on'](_0x9e9b('0x10'),core['connect']);ami['on']('shutdown',core[_0x9e9b('0x11')]);ami['on']('fullybooted',core[_0x9e9b('0x12')]);ami['on']('error',core[_0x9e9b('0x13')]);ami['on'](_0x9e9b('0x14'),core['close']);ami['on']('managerevent',core[_0x9e9b('0x15')]);ami['on'](_0x9e9b('0x16'),function(_0x84f9db){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')]('[%s][index][devicestatechange]',_0x84f9db[_0x9e9b('0x19')]),_0x84f9db);members['devicestatechange'](_0x84f9db);}catch(_0x113635){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x1a'),_0x84f9db[_0x9e9b('0x19')]),_0x113635);}});ami['on']('agentcalled',function(_0x4493a5){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x1b'),_0x4493a5[_0x9e9b('0x1c')]),_0x4493a5);agents['agentcalled'](_0x4493a5);}catch(_0x40f5d2){utils['error'](util['format'](_0x9e9b('0x1b'),_0x4493a5[_0x9e9b('0x1c')]),_0x40f5d2);}});ami['on']('agentringnoanswer',function(_0x53409b){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')]('[%s][index][agentringnoanswer]',_0x53409b[_0x9e9b('0x1c')]),_0x53409b);agents[_0x9e9b('0x1d')](_0x53409b);}catch(_0x277ca4){utils['error'](util['format'](_0x9e9b('0x1e'),_0x53409b[_0x9e9b('0x1c')]),_0x277ca4);}});ami['on']('agentconnect',function(_0x4efce6){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x1f'),_0x4efce6[_0x9e9b('0x1c')]),_0x4efce6);agents['agentconnect'](_0x4efce6);queues[_0x9e9b('0x20')](_0x4efce6);}catch(_0xc9ab0b){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x1f'),_0x4efce6[_0x9e9b('0x1c')]),_0xc9ab0b);}});ami['on'](_0x9e9b('0x21'),function(_0x54ba99){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x22'),_0x54ba99[_0x9e9b('0x1c')]),_0x54ba99);agents[_0x9e9b('0x21')](_0x54ba99);queues[_0x9e9b('0x21')](_0x54ba99);members[_0x9e9b('0x21')](_0x54ba99);}catch(_0x581ba0){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x22'),_0x54ba99[_0x9e9b('0x1c')]),_0x581ba0);}});ami['on'](_0x9e9b('0x23'),function(_0x529363){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x24'),_0x529363[_0x9e9b('0x1c')]),_0x529363);agents[_0x9e9b('0x23')](_0x529363);queues[_0x9e9b('0x23')](_0x529363);}catch(_0x4e556e){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')]('[%s][index][queuecallerabandon]',_0x529363[_0x9e9b('0x1c')]),_0x4e556e);}});ami['on']('queuecallerjoin',function(_0x5127b9){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x25'),_0x5127b9[_0x9e9b('0x1c')]),_0x5127b9);queues[_0x9e9b('0x26')](_0x5127b9);recordings['queuecallerjoin'](_0x5127b9);}catch(_0x3c3548){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')]('[%s][index][queuecallerjoin]',_0x5127b9[_0x9e9b('0x1c')]),_0x3c3548);}});ami['on'](_0x9e9b('0x27'),function(_0x2d9e9a){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x28'),_0x2d9e9a[_0x9e9b('0x1c')]),_0x2d9e9a);queues[_0x9e9b('0x27')](_0x2d9e9a);}catch(_0x1cdef9){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x28'),_0x2d9e9a['uniqueid']),_0x1cdef9);}});ami['on'](_0x9e9b('0x29'),function(_0x326654){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x2a'),_0x326654[_0x9e9b('0x1c')]),_0x326654);queues['musiconholdstart'](_0x326654);calls[_0x9e9b('0x29')](_0x326654);}catch(_0x5e100c){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x2a'),_0x326654[_0x9e9b('0x1c')]),_0x5e100c);}});ami['on'](_0x9e9b('0x2b'),function(_0x45789d){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x2c'),_0x45789d[_0x9e9b('0x1c')]),_0x45789d);queues[_0x9e9b('0x2b')](_0x45789d);calls[_0x9e9b('0x2b')](_0x45789d);}catch(_0x3ded22){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x2c'),_0x45789d['uniqueid']),_0x3ded22);}});ami['on'](_0x9e9b('0x2d'),function(_0x190333){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x2e'),_0x190333['uniqueid']),_0x190333);calls[_0x9e9b('0x2d')](_0x190333);recordings['newstate'](_0x190333);}catch(_0x3ca2fb){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x2e'),_0x190333[_0x9e9b('0x1c')]),_0x3ca2fb);}});ami['on']('hangup',function(_0xa1cdec){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x2f'),_0xa1cdec[_0x9e9b('0x1c')]),_0xa1cdec);calls['hangup'](_0xa1cdec);recordings['hangup'](_0xa1cdec);dials[_0x9e9b('0x30')](_0xa1cdec);agents[_0x9e9b('0x30')](_0xa1cdec);queues[_0x9e9b('0x30')](_0xa1cdec);}catch(_0x3dfc8c){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x2f'),_0xa1cdec[_0x9e9b('0x1c')]),_0x3dfc8c);}});ami['on'](_0x9e9b('0x31'),function(_0x497cc6){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x32'),_0x497cc6['uniqueid']),_0x497cc6);members['cdr'](_0x497cc6);}catch(_0x3626d6){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x32'),_0x497cc6[_0x9e9b('0x1c')]),_0x3626d6);}});ami['on'](_0x9e9b('0x33'),function(_0x70f0c0){try{utils[_0x9e9b('0x17')](util['format'](_0x9e9b('0x34'),_0x70f0c0[_0x9e9b('0x1c')]),_0x70f0c0);queues[_0x9e9b('0x33')](_0x70f0c0);agents[_0x9e9b('0x33')](_0x70f0c0);transfers[_0x9e9b('0x33')](_0x70f0c0);}catch(_0x36a86d){utils['error'](util['format'](_0x9e9b('0x34'),_0x70f0c0[_0x9e9b('0x1c')]),_0x36a86d);}});ami['on']('attendedtransfer',function(_0x5186c5){try{utils[_0x9e9b('0x17')](util['format']('[%s][index][attendedtransfer]',_0x5186c5[_0x9e9b('0x35')]),_0x5186c5);queues[_0x9e9b('0x36')](_0x5186c5);transfers['attendedtransfer'](_0x5186c5);agents[_0x9e9b('0x36')](_0x5186c5);calls[_0x9e9b('0x36')](_0x5186c5);}catch(_0x22f877){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x37'),_0x5186c5[_0x9e9b('0x35')]),_0x22f877);}});ami['on'](_0x9e9b('0x38'),function(_0x59534c){try{utils['debug'](util[_0x9e9b('0x18')](_0x9e9b('0x39'),_0x59534c[_0x9e9b('0x1c')]),_0x59534c);queues['varset'](_0x59534c);recordings['varset'](_0x59534c);calls[_0x9e9b('0x38')](_0x59534c);dials[_0x9e9b('0x38')](_0x59534c);}catch(_0x3b2f78){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x39'),_0x59534c[_0x9e9b('0x1c')]),_0x3b2f78);}});ami['on'](_0x9e9b('0x3a'),function(_0x3d7608){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3b'),_0x3d7608[_0x9e9b('0x1c')]),_0x3d7608);calls[_0x9e9b('0x3a')](_0x3d7608);recordings['newexten'](_0x3d7608);dials[_0x9e9b('0x3a')](_0x3d7608);}catch(_0x17544f){utils['error'](util[_0x9e9b('0x18')]('[%s][index][newexten]',_0x3d7608[_0x9e9b('0x1c')]),_0x17544f);}});ami['on'](_0x9e9b('0x3c'),function(_0x5d92ad){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3d'),_0x5d92ad[_0x9e9b('0x1c')]),_0x5d92ad);calls['newchannel'](_0x5d92ad);recordings['newchannel'](_0x5d92ad);}catch(_0x3d972c){utils[_0x9e9b('0x13')](util[_0x9e9b('0x18')](_0x9e9b('0x3d'),_0x5d92ad[_0x9e9b('0x1c')]),_0x3d972c);}});ami['on']('dialbegin',function(_0x52bdf1){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x3e'),_0x52bdf1[_0x9e9b('0x1c')]),_0x52bdf1);dials[_0x9e9b('0x3f')](_0x52bdf1);}catch(_0x44c099){utils['error'](util[_0x9e9b('0x18')](_0x9e9b('0x40'),_0x52bdf1[_0x9e9b('0x1c')]),_0x44c099);}});ami['on'](_0x9e9b('0x41'),function(_0x2c4405){try{utils[_0x9e9b('0x17')](util[_0x9e9b('0x18')](_0x9e9b('0x42'),_0x2c4405[_0x9e9b('0x1c')]),_0x2c4405);dials['dialend'](_0x2c4405);}catch(_0x3b0e7b){utils[_0x9e9b('0x13')](util['format'](_0x9e9b('0x42'),_0x2c4405[_0x9e9b('0x1c')]),_0x3b0e7b);}});} \ No newline at end of file +var _0x2e40=['origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][newstate]','newstate','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]'];(function(_0x57cfa1,_0x174f6e){var _0x397d18=function(_0x21347e){while(--_0x21347e){_0x57cfa1['push'](_0x57cfa1['shift']());}};_0x397d18(++_0x174f6e);}(_0x2e40,0x155));var _0x02e4=function(_0x1aa5d1,_0x52245e){_0x1aa5d1=_0x1aa5d1-0x0;var _0x3d2b3e=_0x2e40[_0x1aa5d1];return _0x3d2b3e;};var AsteriskManager=require(_0x02e4('0x0'));var config=require(_0x02e4('0x1'));var utils=require(_0x02e4('0x2'));var util=require(_0x02e4('0x3'));var ami=new AsteriskManager(config[_0x02e4('0x4')][_0x02e4('0x5')],config[_0x02e4('0x4')]['ip'],config[_0x02e4('0x4')][_0x02e4('0x6')],config[_0x02e4('0x4')][_0x02e4('0x7')],!![]);ami[_0x02e4('0x8')]();if(config[_0x02e4('0x9')]&&config['xdr']['disabled']){utils[_0x02e4('0xa')](_0x02e4('0xb'));}else{var agents=require(_0x02e4('0xc'));var calls=require(_0x02e4('0xd'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x02e4('0xe'));var dials=require(_0x02e4('0xf'));var transfers=require(_0x02e4('0x10'));var core=require('./core.controller');ami['on'](_0x02e4('0x11'),core[_0x02e4('0x11')]);ami['on'](_0x02e4('0x12'),core[_0x02e4('0x12')]);ami['on'](_0x02e4('0x13'),core[_0x02e4('0x13')]);ami['on']('error',core[_0x02e4('0x14')]);ami['on'](_0x02e4('0x15'),core[_0x02e4('0x15')]);ami['on'](_0x02e4('0x16'),core['managerevent']);ami['on'](_0x02e4('0x17'),function(_0x1039d5){try{utils['debug'](util[_0x02e4('0x18')]('[%s][index][devicestatechange]',_0x1039d5[_0x02e4('0x19')]),_0x1039d5);members[_0x02e4('0x17')](_0x1039d5);}catch(_0x43264c){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x1a'),_0x1039d5['device']),_0x43264c);}});ami['on']('agentcalled',function(_0x89418d){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x1c'),_0x89418d[_0x02e4('0x1d')]),_0x89418d);agents[_0x02e4('0x1e')](_0x89418d);}catch(_0x23173b){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x1c'),_0x89418d[_0x02e4('0x1d')]),_0x23173b);}});ami['on'](_0x02e4('0x1f'),function(_0x32842b){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x20'),_0x32842b[_0x02e4('0x1d')]),_0x32842b);agents[_0x02e4('0x1f')](_0x32842b);}catch(_0x4e8264){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x20'),_0x32842b[_0x02e4('0x1d')]),_0x4e8264);}});ami['on'](_0x02e4('0x21'),function(_0x232054){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x22'),_0x232054[_0x02e4('0x1d')]),_0x232054);agents[_0x02e4('0x21')](_0x232054);queues[_0x02e4('0x21')](_0x232054);}catch(_0x512886){utils[_0x02e4('0x14')](util['format'](_0x02e4('0x22'),_0x232054['uniqueid']),_0x512886);}});ami['on'](_0x02e4('0x23'),function(_0x362f99){try{utils['debug'](util[_0x02e4('0x18')](_0x02e4('0x24'),_0x362f99[_0x02e4('0x1d')]),_0x362f99);agents['agentcomplete'](_0x362f99);queues['agentcomplete'](_0x362f99);members[_0x02e4('0x23')](_0x362f99);}catch(_0x4453bd){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x24'),_0x362f99[_0x02e4('0x1d')]),_0x4453bd);}});ami['on'](_0x02e4('0x25'),function(_0x8fe3f2){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][queuecallerabandon]',_0x8fe3f2['uniqueid']),_0x8fe3f2);agents['queuecallerabandon'](_0x8fe3f2);queues['queuecallerabandon'](_0x8fe3f2);}catch(_0x5cf1d9){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x26'),_0x8fe3f2[_0x02e4('0x1d')]),_0x5cf1d9);}});ami['on'](_0x02e4('0x27'),function(_0x4bf5bb){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x28'),_0x4bf5bb[_0x02e4('0x1d')]),_0x4bf5bb);queues['queuecallerjoin'](_0x4bf5bb);recordings[_0x02e4('0x27')](_0x4bf5bb);}catch(_0x1e98e5){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x28'),_0x4bf5bb[_0x02e4('0x1d')]),_0x1e98e5);}});ami['on'](_0x02e4('0x29'),function(_0x4b87a5){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x2a'),_0x4b87a5['uniqueid']),_0x4b87a5);queues[_0x02e4('0x29')](_0x4b87a5);}catch(_0x159de1){utils['error'](util['format'](_0x02e4('0x2a'),_0x4b87a5[_0x02e4('0x1d')]),_0x159de1);}});ami['on']('musiconholdstart',function(_0x19a059){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x2b'),_0x19a059[_0x02e4('0x1d')]),_0x19a059);queues['musiconholdstart'](_0x19a059);calls[_0x02e4('0x2c')](_0x19a059);}catch(_0x48658c){utils[_0x02e4('0x14')](util['format'](_0x02e4('0x2b'),_0x19a059[_0x02e4('0x1d')]),_0x48658c);}});ami['on']('musiconholdstop',function(_0x5bd911){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][musiconholdstop]',_0x5bd911[_0x02e4('0x1d')]),_0x5bd911);queues[_0x02e4('0x2d')](_0x5bd911);calls[_0x02e4('0x2d')](_0x5bd911);}catch(_0x13590c){utils['error'](util[_0x02e4('0x18')]('[%s][index][musiconholdstop]',_0x5bd911[_0x02e4('0x1d')]),_0x13590c);}});ami['on']('newstate',function(_0x48c2a1){try{utils['debug'](util['format'](_0x02e4('0x2e'),_0x48c2a1[_0x02e4('0x1d')]),_0x48c2a1);calls[_0x02e4('0x2f')](_0x48c2a1);recordings['newstate'](_0x48c2a1);}catch(_0x162cdf){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x2e'),_0x48c2a1['uniqueid']),_0x162cdf);}});ami['on'](_0x02e4('0x30'),function(_0xea00cc){try{utils[_0x02e4('0x1b')](util['format']('[%s][index][hangup]',_0xea00cc[_0x02e4('0x1d')]),_0xea00cc);calls[_0x02e4('0x30')](_0xea00cc);recordings['hangup'](_0xea00cc);dials[_0x02e4('0x30')](_0xea00cc);agents[_0x02e4('0x30')](_0xea00cc);queues[_0x02e4('0x30')](_0xea00cc);}catch(_0x5080d4){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][hangup]',_0xea00cc[_0x02e4('0x1d')]),_0x5080d4);}});ami['on'](_0x02e4('0x31'),function(_0x558bc9){try{utils['debug'](util[_0x02e4('0x18')](_0x02e4('0x32'),_0x558bc9['uniqueid']),_0x558bc9);members['cdr'](_0x558bc9);}catch(_0x26c3e4){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][cdr]',_0x558bc9['uniqueid']),_0x26c3e4);}});ami['on'](_0x02e4('0x33'),function(_0x2272ca){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x34'),_0x2272ca[_0x02e4('0x1d')]),_0x2272ca);queues['blindtransfer'](_0x2272ca);agents['blindtransfer'](_0x2272ca);transfers[_0x02e4('0x33')](_0x2272ca);}catch(_0x32aef7){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x34'),_0x2272ca[_0x02e4('0x1d')]),_0x32aef7);}});ami['on'](_0x02e4('0x35'),function(_0x4c16b6){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x36'),_0x4c16b6[_0x02e4('0x37')]),_0x4c16b6);queues['attendedtransfer'](_0x4c16b6);transfers[_0x02e4('0x35')](_0x4c16b6);agents[_0x02e4('0x35')](_0x4c16b6);calls[_0x02e4('0x35')](_0x4c16b6);}catch(_0x1e6311){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x36'),_0x4c16b6['origtransfereruniqueid']),_0x1e6311);}});ami['on'](_0x02e4('0x38'),function(_0x1970fc){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x39'),_0x1970fc['uniqueid']),_0x1970fc);queues[_0x02e4('0x38')](_0x1970fc);recordings['varset'](_0x1970fc);calls[_0x02e4('0x38')](_0x1970fc);dials['varset'](_0x1970fc);}catch(_0x22c78f){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x39'),_0x1970fc[_0x02e4('0x1d')]),_0x22c78f);}});ami['on'](_0x02e4('0x3a'),function(_0x407f6b){try{utils['debug'](util['format'](_0x02e4('0x3b'),_0x407f6b['uniqueid']),_0x407f6b);calls['newexten'](_0x407f6b);recordings['newexten'](_0x407f6b);dials[_0x02e4('0x3a')](_0x407f6b);}catch(_0x1ee81d){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][newexten]',_0x407f6b[_0x02e4('0x1d')]),_0x1ee81d);}});ami['on'](_0x02e4('0x3c'),function(_0x3cada0){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][newchannel]',_0x3cada0[_0x02e4('0x1d')]),_0x3cada0);calls['newchannel'](_0x3cada0);recordings[_0x02e4('0x3c')](_0x3cada0);}catch(_0x17abe6){utils['error'](util['format'](_0x02e4('0x3d'),_0x3cada0['uniqueid']),_0x17abe6);}});ami['on']('dialbegin',function(_0x32185e){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][dialbegin]',_0x32185e[_0x02e4('0x1d')]),_0x32185e);dials[_0x02e4('0x3e')](_0x32185e);}catch(_0x43c9da){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x3f'),_0x32185e['uniqueid']),_0x43c9da);}});ami['on'](_0x02e4('0x40'),function(_0x2055ca){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x41'),_0x2055ca[_0x02e4('0x1d')]),_0x2055ca);dials[_0x02e4('0x40')](_0x2055ca);}catch(_0x30a0d5){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x41'),_0x2055ca[_0x02e4('0x1d')]),_0x30a0d5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c2d484a..3d84751 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 _0xd1cd=['split','request','CreateMemberReport','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','getUserByName'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd1cd,0xb6));var _0xdd1c=function(_0x464abf,_0x538896){_0x464abf=_0x464abf-0x0;var _0xe59c36=_0xd1cd[_0x464abf];return _0xe59c36;};'use strict';var _=require(_0xdd1c('0x0'));var util=require(_0xdd1c('0x1'));var utils=require(_0xdd1c('0x2'));var members={};var exclude=[_0xdd1c('0x3'),_0xdd1c('0x4')];function writeDB(_0x42c407){utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')](_0xdd1c('0x7'),_0x42c407['uniqueid'],_0x42c407[_0xdd1c('0x8')],_0x42c407[_0xdd1c('0x9')],_0x42c407[_0xdd1c('0xa')],_0x42c407['membername'],_0x42c407[_0xdd1c('0xb')]));if(_0x42c407[_0xdd1c('0x8')]){utils[_0xdd1c('0xc')](_0x42c407[_0xdd1c('0x8')])[_0xdd1c('0xd')](function(_0x497b82){if(_0x497b82){_0x42c407[_0xdd1c('0xe')]=_0x497b82[_0xdd1c('0xf')];_0x42c407[_0xdd1c('0x10')]=_0x497b82[_0xdd1c('0x10')];utils['request']('CreateMemberReport',_0x42c407);}else{utils[_0xdd1c('0x11')](_0x42c407[_0xdd1c('0x8')][_0xdd1c('0x12')]('/')[0x1])[_0xdd1c('0xd')](function(_0x590699){if(_0x590699){_0x42c407[_0xdd1c('0xe')]=_0x590699[_0xdd1c('0xf')];_0x42c407['internal']=_0x590699['internal'];utils[_0xdd1c('0x13')](_0xdd1c('0x14'),_0x42c407);}});}})[_0xdd1c('0x15')](function(_0x48e6f9){utils[_0xdd1c('0x16')](util[_0xdd1c('0x6')](_0xdd1c('0x17'),_0x42c407['uniqueid']),_0x48e6f9);});}delete members[_0x42c407['interface']];}function startsWith(_0x1a7762,_0x37a8d3){return _['some'](_0x1a7762,function(_0x2e8efd){return _[_0xdd1c('0x18')](_0x37a8d3,_0x2e8efd);});}exports[_0xdd1c('0x19')]=function(_0x2d52df){try{utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')]('[%s][members][devicestatechange]',members[_0x2d52df[_0xdd1c('0x1b')]]?members[_0x2d52df['device']][_0xdd1c('0x1c')]:_0x2d52df[_0xdd1c('0x1b')]),_0x2d52df);utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')](_0xdd1c('0x1d'),members[_0x2d52df[_0xdd1c('0x1b')]]?members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x1c')]:_0x2d52df[_0xdd1c('0x1b')],_0x2d52df[_0xdd1c('0x1e')],_0x2d52df[_0xdd1c('0x1b')]));switch(_0x2d52df['state']){case _0xdd1c('0x1f'):case _0xdd1c('0x20'):if(!startsWith(exclude,_0x2d52df[_0xdd1c('0x1b')])){members[_0x2d52df[_0xdd1c('0x1b')]]={'channel':'voice','interface':_0x2d52df[_0xdd1c('0x1b')],'type':_0xdd1c('0x21'),'enterAt':utils['now'](),'role':_0xdd1c('0x22')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x2d52df['device']])){members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x23')]=utils['now']();members[_0x2d52df[_0xdd1c('0x1b')]]['duration']=utils[_0xdd1c('0x24')](members[_0x2d52df[_0xdd1c('0x1b')]]['exitAt'],members[_0x2d52df['device']][_0xdd1c('0x25')]);if(members[_0x2d52df[_0xdd1c('0x1b')]][_0xdd1c('0x1c')]){writeDB(members[_0x2d52df[_0xdd1c('0x1b')]]);}}break;default:break;}}catch(_0x33ef9f){utils['error'](util['format'](_0xdd1c('0x26'),members[_0x2d52df['device']]?members[_0x2d52df[_0xdd1c('0x1b')]]['uniqueid']:_0x2d52df[_0xdd1c('0x1b')]),_0x33ef9f);}};exports[_0xdd1c('0x27')]=function(_0x2333ab){try{if(!_['isNil'](members[_0x2333ab[_0xdd1c('0x8')]])){utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')](_0xdd1c('0x28'),_0x2333ab[_0xdd1c('0x1c')]),_0x2333ab);utils['info'](util[_0xdd1c('0x6')](_0xdd1c('0x29'),_0x2333ab['uniqueid'],_0x2333ab[_0xdd1c('0x8')],_0x2333ab['queue']));members[_0x2333ab[_0xdd1c('0x8')]]=_[_0xdd1c('0x2a')](members[_0x2333ab[_0xdd1c('0x8')]],{'data4':_0x2333ab[_0xdd1c('0x2b')],'uniqueid':_0x2333ab[_0xdd1c('0x1c')]});}}catch(_0x30aad1){utils[_0xdd1c('0x16')](util['format'](_0xdd1c('0x28'),_0x2333ab['uniqueid']),_0x30aad1);}};exports['cdr']=function(_0x27c059){try{utils[_0xdd1c('0x1a')](util[_0xdd1c('0x6')](_0xdd1c('0x2c'),_0x27c059[_0xdd1c('0x1c')]),_0x27c059);if(_0x27c059[_0xdd1c('0x9')]){var _0xdfe625=_0x27c059[_0xdd1c('0x9')][_0xdd1c('0x12')]('-')[0x0];if(!_['isNil'](members[_0xdfe625])){members[_0xdfe625]=_[_0xdd1c('0x2a')](members[_0xdfe625],{'data1':members[_0xdfe625][_0xdd1c('0x2d')]||_0x27c059[_0xdd1c('0xb')],'data2':members[_0xdfe625][_0xdd1c('0xa')]||_0x27c059['source'],'data3':members[_0xdfe625][_0xdd1c('0x2e')]||_0x27c059[_0xdd1c('0x2f')],'uniqueid':members[_0xdfe625][_0xdd1c('0x1c')]||_0x27c059[_0xdd1c('0x1c')]});utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x27c059[_0xdd1c('0x1c')],members[_0xdfe625]['data1'],members[_0xdfe625][_0xdd1c('0xa')],members[_0xdfe625][_0xdd1c('0x2e')]));if(members[_0xdfe625][_0xdd1c('0x23')]){writeDB(members[_0xdfe625]);}}}if(_0x27c059[_0xdd1c('0x30')]){var _0x30e191=_0x27c059[_0xdd1c('0x30')][_0xdd1c('0x12')]('-')[0x0];if(!_['isNil'](members[_0x30e191])){members[_0x30e191]=_[_0xdd1c('0x2a')](members[_0x30e191],{'data1':members[_0x30e191]['data1']||_0x27c059[_0xdd1c('0xb')],'data2':members[_0x30e191][_0xdd1c('0xa')]||_0x27c059[_0xdd1c('0x31')],'data3':members[_0x30e191]['data3']||_0x27c059['destination'],'uniqueid':members[_0x30e191][_0xdd1c('0x1c')]||_0x27c059[_0xdd1c('0x1c')]});utils[_0xdd1c('0x5')](util[_0xdd1c('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x27c059[_0xdd1c('0x1c')],members[_0x30e191]['data1'],members[_0x30e191][_0xdd1c('0xa')],members[_0x30e191][_0xdd1c('0x2e')]));if(members[_0x30e191][_0xdd1c('0x23')]){writeDB(members[_0x30e191]);}}}}catch(_0x3f1112){utils[_0xdd1c('0x16')](util[_0xdd1c('0x6')](_0xdd1c('0x2c'),_0x27c059[_0xdd1c('0x1c')]),_0x3f1112);}}; \ No newline at end of file +var _0x01bb=['internal','request','getUserByName','split','then','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','name'];(function(_0x460399,_0x5d2cfd){var _0x276cf4=function(_0x212c50){while(--_0x212c50){_0x460399['push'](_0x460399['shift']());}};_0x276cf4(++_0x5d2cfd);}(_0x01bb,0x8b));var _0xb01b=function(_0x25b25f,_0x1b2795){_0x25b25f=_0x25b25f-0x0;var _0x301d15=_0x01bb[_0x25b25f];return _0x301d15;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x21d430){utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x4'),_0x21d430['uniqueid'],_0x21d430[_0xb01b('0x5')],_0x21d430[_0xb01b('0x6')],_0x21d430[_0xb01b('0x7')],_0x21d430[_0xb01b('0x8')],_0x21d430[_0xb01b('0x9')]));if(_0x21d430[_0xb01b('0x5')]){utils['getUserByInterface'](_0x21d430[_0xb01b('0x5')])['then'](function(_0x542b7d){if(_0x542b7d){_0x21d430[_0xb01b('0x8')]=_0x542b7d[_0xb01b('0xa')];_0x21d430[_0xb01b('0xb')]=_0x542b7d[_0xb01b('0xb')];utils[_0xb01b('0xc')]('CreateMemberReport',_0x21d430);}else{utils[_0xb01b('0xd')](_0x21d430['interface'][_0xb01b('0xe')]('/')[0x1])[_0xb01b('0xf')](function(_0x2c04bb){if(_0x2c04bb){_0x21d430[_0xb01b('0x8')]=_0x2c04bb[_0xb01b('0xa')];_0x21d430[_0xb01b('0xb')]=_0x2c04bb['internal'];utils[_0xb01b('0xc')]('CreateMemberReport',_0x21d430);}});}})['catch'](function(_0x17ccef){utils[_0xb01b('0x10')](util[_0xb01b('0x3')](_0xb01b('0x11'),_0x21d430[_0xb01b('0x12')]),_0x17ccef);});}delete members[_0x21d430[_0xb01b('0x5')]];}function startsWith(_0x479327,_0x54332d){return _[_0xb01b('0x13')](_0x479327,function(_0x58b1b2){return _[_0xb01b('0x14')](_0x54332d,_0x58b1b2);});}exports[_0xb01b('0x15')]=function(_0x78a414){try{utils[_0xb01b('0x16')](util[_0xb01b('0x3')]('[%s][members][devicestatechange]',members[_0x78a414[_0xb01b('0x17')]]?members[_0x78a414[_0xb01b('0x17')]]['uniqueid']:_0x78a414[_0xb01b('0x17')]),_0x78a414);utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x18'),members[_0x78a414[_0xb01b('0x17')]]?members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]:_0x78a414[_0xb01b('0x17')],_0x78a414['state'],_0x78a414[_0xb01b('0x17')]));switch(_0x78a414['state']){case _0xb01b('0x19'):case _0xb01b('0x1a'):if(!startsWith(exclude,_0x78a414[_0xb01b('0x17')])){members[_0x78a414['device']]={'channel':_0xb01b('0x1b'),'interface':_0x78a414[_0xb01b('0x17')],'type':'TALKING','enterAt':utils[_0xb01b('0x1c')](),'role':_0xb01b('0x1d')};}break;case _0xb01b('0x1e'):if(!_['isNil'](members[_0x78a414[_0xb01b('0x17')]])){members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x1f')]=utils[_0xb01b('0x1c')]();members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x20')]=utils[_0xb01b('0x21')](members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x1f')],members[_0x78a414['device']][_0xb01b('0x22')]);if(members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]){writeDB(members[_0x78a414[_0xb01b('0x17')]]);}}break;default:break;}}catch(_0x404591){utils[_0xb01b('0x10')](util['format'](_0xb01b('0x23'),members[_0x78a414['device']]?members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]:_0x78a414[_0xb01b('0x17')]),_0x404591);}};exports[_0xb01b('0x24')]=function(_0x5cd2c4){try{if(!_[_0xb01b('0x25')](members[_0x5cd2c4[_0xb01b('0x5')]])){utils[_0xb01b('0x16')](util[_0xb01b('0x3')](_0xb01b('0x26'),_0x5cd2c4['uniqueid']),_0x5cd2c4);utils['info'](util['format'](_0xb01b('0x27'),_0x5cd2c4[_0xb01b('0x12')],_0x5cd2c4['interface'],_0x5cd2c4[_0xb01b('0x28')]));members[_0x5cd2c4[_0xb01b('0x5')]]=_[_0xb01b('0x29')](members[_0x5cd2c4[_0xb01b('0x5')]],{'data4':_0x5cd2c4[_0xb01b('0x28')],'uniqueid':_0x5cd2c4['uniqueid']});}}catch(_0x2e3a5a){utils[_0xb01b('0x10')](util[_0xb01b('0x3')]('[%s][members][agentcomplete]',_0x5cd2c4[_0xb01b('0x12')]),_0x2e3a5a);}};exports[_0xb01b('0x2a')]=function(_0x3d65be){try{utils[_0xb01b('0x16')](util[_0xb01b('0x3')]('[%s][members][cdr]',_0x3d65be[_0xb01b('0x12')]),_0x3d65be);if(_0x3d65be['channel']){var _0xd53b61=_0x3d65be[_0xb01b('0x6')]['split']('-')[0x0];if(!_[_0xb01b('0x25')](members[_0xd53b61])){members[_0xd53b61]=_[_0xb01b('0x29')](members[_0xd53b61],{'data1':members[_0xd53b61][_0xb01b('0x2b')]||_0x3d65be[_0xb01b('0x9')],'data2':members[_0xd53b61][_0xb01b('0x7')]||_0x3d65be[_0xb01b('0x2c')],'data3':members[_0xd53b61][_0xb01b('0x2d')]||_0x3d65be[_0xb01b('0x2e')],'uniqueid':members[_0xd53b61]['uniqueid']||_0x3d65be['uniqueid']});utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x2f'),_0x3d65be[_0xb01b('0x12')],members[_0xd53b61][_0xb01b('0x2b')],members[_0xd53b61][_0xb01b('0x7')],members[_0xd53b61][_0xb01b('0x2d')]));if(members[_0xd53b61][_0xb01b('0x1f')]){writeDB(members[_0xd53b61]);}}}if(_0x3d65be[_0xb01b('0x30')]){var _0x52e3c9=_0x3d65be[_0xb01b('0x30')][_0xb01b('0xe')]('-')[0x0];if(!_[_0xb01b('0x25')](members[_0x52e3c9])){members[_0x52e3c9]=_[_0xb01b('0x29')](members[_0x52e3c9],{'data1':members[_0x52e3c9][_0xb01b('0x2b')]||_0x3d65be[_0xb01b('0x9')],'data2':members[_0x52e3c9][_0xb01b('0x7')]||_0x3d65be['source'],'data3':members[_0x52e3c9]['data3']||_0x3d65be['destination'],'uniqueid':members[_0x52e3c9]['uniqueid']||_0x3d65be[_0xb01b('0x12')]});utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x2f'),_0x3d65be[_0xb01b('0x12')],members[_0x52e3c9]['data1'],members[_0x52e3c9]['data2'],members[_0x52e3c9][_0xb01b('0x2d')]));if(members[_0x52e3c9]['exitAt']){writeDB(members[_0x52e3c9]);}}}}catch(_0x500f2f){utils[_0xb01b('0x10')](util[_0xb01b('0x3')](_0xb01b('0x31'),_0x3d65be[_0xb01b('0x12')]),_0x500f2f);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c04f1bb..1e767d7 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 _0xa413=['variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','transfertype','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','uniqueid','position','assign','now','error','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil'];(function(_0x2efe3d,_0x1f5e3e){var _0x52117c=function(_0x7b6e52){while(--_0x7b6e52){_0x2efe3d['push'](_0x2efe3d['shift']());}};_0x52117c(++_0x1f5e3e);}(_0xa413,0x1e5));var _0x3a41=function(_0x58f91f,_0x4f2095){_0x58f91f=_0x58f91f-0x0;var _0x56edbe=_0xa413[_0x58f91f];return _0x56edbe;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var utils=require(_0x3a41('0x1'));var queues={};function writeDB(_0x592e77){utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x592e77['uniqueid'],_0x592e77[_0x3a41('0x4')],_0x592e77[_0x3a41('0x5')],_0x592e77[_0x3a41('0x6')],_0x592e77[_0x3a41('0x7')],_0x592e77[_0x3a41('0x8')],_0x592e77[_0x3a41('0x9')]));if(_0x592e77[_0x3a41('0x5')]){utils[_0x3a41('0xa')](_0x592e77[_0x3a41('0x5')])[_0x3a41('0xb')](function(_0x27c2e5){if(_0x27c2e5){_0x592e77['type']=_0x27c2e5[_0x3a41('0xc')];}utils['request']('CreateVoiceQueueReport',_0x592e77);});}else{utils['request'](_0x3a41('0xd'),_0x592e77);}if(_0x592e77['transfereduniqueid']){delete queues[_0x592e77[_0x3a41('0xe')]];}else{delete queues[_0x592e77['uniqueid']];}}exports[_0x3a41('0xf')]=function(_0xccd84e){try{utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x10'),_0xccd84e[_0x3a41('0x11')]),_0xccd84e);utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xccd84e[_0x3a41('0x11')],_0xccd84e[_0x3a41('0x5')],_0xccd84e[_0x3a41('0x12')]));queues[_0xccd84e[_0x3a41('0x11')]]=_[_0x3a41('0x13')](_0xccd84e,{'originalposition':_0xccd84e[_0x3a41('0x12')],'queuecallerjoinAt':utils[_0x3a41('0x14')](),'mohtime':0x0});}catch(_0xebcca6){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x10'),_0xccd84e['uniqueid']),_0xebcca6);}};exports[_0x3a41('0x16')]=function(_0x30d675){try{if(!_['isNil'](queues[_0x30d675['uniqueid']])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x18'),_0x30d675[_0x3a41('0x11')]),_0x30d675);if(queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x19')]){if(!queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1a')]&&!queues[_0x30d675['uniqueid']]['queuecallerexit']){queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1b')]=!![];queues[_0x30d675['uniqueid']]['queuecallercompleteAt']=utils['now']();queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x1c');}utils[_0x3a41('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x30d675[_0x3a41('0x11')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x9')]));writeDB(queues[_0x30d675[_0x3a41('0x11')]]);}else if(queues[_0x30d675['uniqueid']][_0x3a41('0xe')]){utils[_0x3a41('0x2')](util['format'](_0x3a41('0x1e'),_0x30d675[_0x3a41('0x11')],queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x30d675[_0x3a41('0x11')]]['transfereduniqueid']));queues[queues[_0x30d675[_0x3a41('0x11')]][_0x3a41('0xe')]]=queues[_0x30d675['uniqueid']];queues[queues[_0x30d675[_0x3a41('0x11')]]['transfereduniqueid']][_0x3a41('0x1f')]=0x2;delete queues[_0x30d675['uniqueid']];}}}catch(_0x201507){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x18'),_0x30d675[_0x3a41('0x11')]),_0x201507);}};exports[_0x3a41('0x20')]=function(_0x169c22){try{utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x21'),_0x169c22[_0x3a41('0x11')]),_0x169c22);if(!_[_0x3a41('0x22')](_0x169c22[_0x3a41('0x23')][_0x3a41('0x24')])&&_0x169c22[_0x3a41('0x25')][_0x3a41('0x26')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x169c22['uniqueid']])){queues[_0x169c22['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x28')]=!![];queues[_0x169c22['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x169c22['value'][_0x3a41('0x26')]();utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x29'),_0x169c22[_0x3a41('0x11')],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x169c22[_0x3a41('0x25')],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]));writeDB(queues[_0x169c22[_0x3a41('0x11')]]);}}else if(!_[_0x3a41('0x22')](_0x169c22[_0x3a41('0x23')][_0x3a41('0x2a')])){if(!_[_0x3a41('0x22')](queues[_0x169c22['uniqueid']])&&!queues[_0x169c22['uniqueid']][_0x3a41('0x1a')]){queues[_0x169c22[_0x3a41('0x11')]]['queuecallerabandon']=![];queues[_0x169c22[_0x3a41('0x11')]]['queuecallerabandonAt']=null;queues[_0x169c22['uniqueid']]['queuecallerexit']=!![];queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x2b')]=utils['now']();queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]='EXITWITHKEY';utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x169c22[_0x3a41('0x11')],queues[_0x169c22['uniqueid']]['name'],_0x169c22['value'],queues[_0x169c22[_0x3a41('0x11')]][_0x3a41('0x9')]));}}}catch(_0x58ce30){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x21'),_0x169c22[_0x3a41('0x11')]),_0x58ce30);}};exports[_0x3a41('0x1a')]=function(_0x6d7a2b){try{if(!_[_0x3a41('0x22')](queues[_0x6d7a2b[_0x3a41('0x11')]])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x2c'),_0x6d7a2b[_0x3a41('0x11')]),_0x6d7a2b);queues[_0x6d7a2b[_0x3a41('0x11')]]['queuecallerexit']=![];queues[_0x6d7a2b['uniqueid']]['queuecallerexitAt']=null;queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x1a')]=!![];queues[_0x6d7a2b['uniqueid']][_0x3a41('0x27')]=utils['now']();queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x2d');utils['info'](util[_0x3a41('0x3')](_0x3a41('0x2e'),_0x6d7a2b[_0x3a41('0x11')],queues[_0x6d7a2b['uniqueid']][_0x3a41('0x1d')],queues[_0x6d7a2b[_0x3a41('0x11')]][_0x3a41('0x9')]));}}catch(_0x3504cd){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x2c'),_0x6d7a2b['uniqueid']),_0x3504cd);}};exports[_0x3a41('0x2f')]=function(_0x457f6c){try{if(!_[_0x3a41('0x22')](queues[_0x457f6c[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x30'),_0x457f6c['uniqueid']),_0x457f6c);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x31'),_0x457f6c[_0x3a41('0x11')],queues[_0x457f6c[_0x3a41('0x11')]]['name'],_0x457f6c[_0x3a41('0x32')],_0x457f6c['connectedlinename']));queues[_0x457f6c['uniqueid']][_0x3a41('0x2f')]=!![];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x19')]=utils[_0x3a41('0x14')]();queues[_0x457f6c['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x19')],queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x33')]);queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x12')]=_0x457f6c[_0x3a41('0x12')];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x34')]=_0x457f6c[_0x3a41('0x34')];queues[_0x457f6c[_0x3a41('0x11')]][_0x3a41('0x32')]=_0x457f6c[_0x3a41('0x32')];queues[_0x457f6c[_0x3a41('0x11')]]['connectedlinename']=_0x457f6c[_0x3a41('0x35')];}}catch(_0x4aa033){utils[_0x3a41('0x15')](util['format'](_0x3a41('0x30'),_0x457f6c['uniqueid']),_0x4aa033);}};exports[_0x3a41('0x36')]=function(_0x1c3b79){try{if(!_[_0x3a41('0x22')](queues[_0x1c3b79[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')]('[%s][queues][agentconnect]',_0x1c3b79[_0x3a41('0x11')]),_0x1c3b79);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x37'),_0x1c3b79[_0x3a41('0x11')],queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x1c3b79[_0x3a41('0x38')],_0x1c3b79[_0x3a41('0x39')]));queues[_0x1c3b79['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x1c3b79['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x1c3b79['uniqueid']][_0x3a41('0x28')]=![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x9')]=null;queues[_0x1c3b79['uniqueid']][_0x3a41('0x2b')]=null;queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x3a')]=!![];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x8')]=_0x1c3b79[_0x3a41('0x39')];queues[_0x1c3b79[_0x3a41('0x11')]][_0x3a41('0x6')]=_0x1c3b79[_0x3a41('0x38')];}}catch(_0x26d80f){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x3b'),_0x1c3b79[_0x3a41('0x11')]),_0x26d80f);}};exports[_0x3a41('0x3c')]=function(_0x462dcd){try{if(!_[_0x3a41('0x22')](queues[_0x462dcd[_0x3a41('0x11')]])){if(queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x19')]){utils['debug'](util[_0x3a41('0x3')]('[%s][queues][agentcomplete]',_0x462dcd[_0x3a41('0x11')]),_0x462dcd);queues[_0x462dcd['uniqueid']][_0x3a41('0x1a')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1a')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x27')]=null;queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x28')]=![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x2b')]=null;queues[_0x462dcd[_0x3a41('0x11')]]['assigned']=!![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x6')]=_0x462dcd['membername'];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1b')]=!![];queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x3d')]=utils[_0x3a41('0x14')]();if(_0x462dcd[_0x3a41('0x3e')]=='transfer'){if(!queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x3f')]){queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x40');}}else{queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x9')]=_0x3a41('0x41')+_0x462dcd['reason']['toUpperCase']();}utils[_0x3a41('0x2')](util[_0x3a41('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x462dcd['uniqueid'],queues[_0x462dcd[_0x3a41('0x11')]][_0x3a41('0x1d')],_0x462dcd[_0x3a41('0x38')],queues[_0x462dcd[_0x3a41('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x462dcd['uniqueid']]);}}}catch(_0x2e5108){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x42'),_0x462dcd[_0x3a41('0x11')]),_0x2e5108);}};exports[_0x3a41('0x43')]=function(_0x4adab2){try{if(!_[_0x3a41('0x22')](queues[_0x4adab2['transfereeuniqueid']])){utils[_0x3a41('0x17')](util[_0x3a41('0x3')](_0x3a41('0x44'),_0x4adab2[_0x3a41('0x11')]),_0x4adab2);queues[_0x4adab2[_0x3a41('0x45')]]['transfer']=!![];queues[_0x4adab2[_0x3a41('0x45')]]['transfertype']=_0x3a41('0x46');queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x47')]=_0x4adab2[_0x3a41('0x48')];queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x49')]=_0x4adab2[_0x3a41('0x45')];queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x9')]='BLINDTRANSFER';utils['info'](util[_0x3a41('0x3')](_0x3a41('0x4a'),_0x4adab2[_0x3a41('0x11')],queues[_0x4adab2[_0x3a41('0x45')]][_0x3a41('0x1d')],_0x4adab2['transfereeuniqueid'],_0x4adab2['extension']));}}catch(_0x39108a){utils['error'](util[_0x3a41('0x3')]('[%s][queues][blindtransfer]',_0x4adab2[_0x3a41('0x11')]),_0x39108a);}};exports[_0x3a41('0x4b')]=function(_0xa1cece){try{utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x4c'),_0xa1cece[_0x3a41('0x4d')]),_0xa1cece);if(_0xa1cece['origtransfereruniqueid']==_0xa1cece[_0x3a41('0x4e')]){if(!_['isNil'](queues[_0xa1cece[_0x3a41('0x4f')]])){utils[_0x3a41('0x2')](util['format'](_0x3a41('0x50'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x1d')],_0xa1cece[_0x3a41('0x51')]));queues[_0xa1cece[_0x3a41('0x4f')]]['transfer']=!![];queues[_0xa1cece[_0x3a41('0x4f')]]['transfertype']=_0x3a41('0x52');queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x47')]=_0xa1cece[_0x3a41('0x51')];queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x49')]=_0xa1cece['origtransfereruniqueid'];queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x3a41('0x22')](queues[_0xa1cece[_0x3a41('0x4e')]])){if(_0xa1cece[_0x3a41('0x53')]&&queues[_0xa1cece[_0x3a41('0x53')]]){queues[_0xa1cece[_0x3a41('0x53')]]['queuecallerenterreason']=0x1;queues[_0xa1cece[_0x3a41('0x45')]]=_[_0x3a41('0x54')](queues[_0xa1cece[_0x3a41('0x53')]]);queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0xe')]=_0xa1cece['transfertargetuniqueid'];queues[_0xa1cece[_0x3a41('0x45')]]['queuecallerenterreason']=0x2;queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x7')]=queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x7')];queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x55')]=queues[_0xa1cece['secondtransfererlinkedid']][_0x3a41('0x55')];queues[_0xa1cece['transfereeuniqueid']][_0x3a41('0x33')]=utils[_0x3a41('0x14')]();queues[_0xa1cece[_0x3a41('0x45')]]['queuecallerleaveAt']=utils['now']();queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x56')]=0x0;queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x57')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x1d')],queues[_0xa1cece['transfereeuniqueid']][_0x3a41('0x7')],queues[_0xa1cece[_0x3a41('0x45')]][_0x3a41('0x55')]));}else{utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x58'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x4e')]]['name'],_0xa1cece[_0x3a41('0x4f')]));queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0xe')]=_0xa1cece[_0x3a41('0x4f')];}}}else if(_0xa1cece[_0x3a41('0x59')]==_0xa1cece[_0x3a41('0x4f')]){if(!_['isNil'](queues[_0xa1cece['origtransfererlinkedid']])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece['origtransfererlinkedid']][_0x3a41('0x1d')],_0xa1cece['secondtransfereruniqueid'],_0xa1cece['secondtransfererexten']));queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x3f')]=!![];queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x5a')]=_0x3a41('0x52');queues[_0xa1cece['origtransfererlinkedid']]['transferexten']=_0xa1cece[_0x3a41('0x5b')];queues[_0xa1cece[_0x3a41('0x4e')]]['transferuniqueid']=_0xa1cece['secondtransfereruniqueid'];queues[_0xa1cece[_0x3a41('0x4e')]][_0x3a41('0x9')]=_0x3a41('0x5c');}if(!_[_0x3a41('0x22')](queues[_0xa1cece[_0x3a41('0x4f')]])){if(_0xa1cece[_0x3a41('0x5d')]&&queues[_0xa1cece[_0x3a41('0x5d')]]){queues[_0xa1cece['transfertargetlinkedid']][_0x3a41('0x1f')]=0x1;queues[_0xa1cece[_0x3a41('0x5e')]]=_[_0x3a41('0x54')](queues[_0xa1cece[_0x3a41('0x5d')]]);queues[_0xa1cece[_0x3a41('0x5e')]]['transfereduniqueid']=_0xa1cece['transfertargetuniqueid'];queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x1f')]=0x2;queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x7')]=queues[_0xa1cece['origtransfererlinkedid']][_0x3a41('0x7')];queues[_0xa1cece[_0x3a41('0x5e')]]['calleridname']=queues[_0xa1cece[_0x3a41('0x4e')]]['calleridname'];queues[_0xa1cece['transfertargetuniqueid']][_0x3a41('0x33')]=utils['now']();queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x19')]=utils[_0x3a41('0x14')]();queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x56')]=0x0;queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x57')]=0x0;utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x5f'),_0xa1cece[_0x3a41('0x4d')],queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x1d')],queues[_0xa1cece['transfertargetuniqueid']][_0x3a41('0xe')],queues[_0xa1cece[_0x3a41('0x5e')]][_0x3a41('0x7')],queues[_0xa1cece['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util[_0x3a41('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa1cece['origtransfereruniqueid'],queues[_0xa1cece[_0x3a41('0x4f')]][_0x3a41('0x1d')],_0xa1cece[_0x3a41('0x4e')]));queues[_0xa1cece[_0x3a41('0x4f')]]['transfereduniqueid']=_0xa1cece['origtransfererlinkedid'];}}}}catch(_0x4d0afe){utils[_0x3a41('0x15')](util[_0x3a41('0x3')](_0x3a41('0x4c'),_0xa1cece['origtransfereruniqueid']),_0x4d0afe);}};exports[_0x3a41('0x60')]=function(_0x25d868){try{if(!_['isNil'](queues[_0x25d868[_0x3a41('0x11')]])){utils['debug'](util[_0x3a41('0x3')](_0x3a41('0x61'),_0x25d868['uniqueid']),_0x25d868);queues[_0x25d868[_0x3a41('0x11')]]['musiconholdstartAt']=utils[_0x3a41('0x14')]();utils['info'](util[_0x3a41('0x3')](_0x3a41('0x62'),_0x25d868[_0x3a41('0x11')],queues[_0x25d868[_0x3a41('0x11')]][_0x3a41('0x1d')],queues[_0x25d868['uniqueid']]['musiconholdstartAt']));}}catch(_0x3e5337){utils[_0x3a41('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x25d868[_0x3a41('0x11')]),_0x3e5337);}};exports[_0x3a41('0x63')]=function(_0x44a3b7){try{if(!_['isNil'](queues[_0x44a3b7[_0x3a41('0x11')]])){if(!_[_0x3a41('0x22')](queues[_0x44a3b7['uniqueid']][_0x3a41('0x64')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x44a3b7[_0x3a41('0x11')]),_0x44a3b7);queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x57')]+=utils[_0x3a41('0x65')](utils['now'](),queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x64')]);utils[_0x3a41('0x2')](util[_0x3a41('0x3')](_0x3a41('0x66'),_0x44a3b7[_0x3a41('0x11')],queues[_0x44a3b7['uniqueid']][_0x3a41('0x1d')],queues[_0x44a3b7[_0x3a41('0x11')]]['mohtime']));delete queues[_0x44a3b7[_0x3a41('0x11')]][_0x3a41('0x64')];}}}catch(_0x258130){utils['error'](util[_0x3a41('0x3')](_0x3a41('0x67'),_0x44a3b7[_0x3a41('0x11')]),_0x258130);}}; \ No newline at end of file +var _0x1c01=['accountcode','type','request','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1c01,0x190));var _0x11c0=function(_0x3fbc3e,_0x359a26){_0x3fbc3e=_0x3fbc3e-0x0;var _0x11f21c=_0x1c01[_0x3fbc3e];return _0x11f21c;};'use strict';var _=require(_0x11c0('0x0'));var util=require(_0x11c0('0x1'));var utils=require(_0x11c0('0x2'));var queues={};function writeDB(_0x17900e){utils['info'](util[_0x11c0('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x17900e['uniqueid'],_0x17900e[_0x11c0('0x4')],_0x17900e[_0x11c0('0x5')],_0x17900e[_0x11c0('0x6')],_0x17900e[_0x11c0('0x7')],_0x17900e[_0x11c0('0x8')],_0x17900e['queuecallerexitreason']));if(_0x17900e[_0x11c0('0x5')]){utils['getVoiceQueueByName'](_0x17900e[_0x11c0('0x5')])['then'](function(_0x127b2f){if(_0x127b2f){_0x17900e['type']=_0x127b2f[_0x11c0('0x9')];}utils['request']('CreateVoiceQueueReport',_0x17900e);});}else{utils[_0x11c0('0xa')]('CreateVoiceQueueReport',_0x17900e);}if(_0x17900e[_0x11c0('0xb')]){delete queues[_0x17900e[_0x11c0('0xb')]];}else{delete queues[_0x17900e[_0x11c0('0xc')]];}}exports[_0x11c0('0xd')]=function(_0x3cc04b){try{utils['debug'](util[_0x11c0('0x3')](_0x11c0('0xe'),_0x3cc04b[_0x11c0('0xc')]),_0x3cc04b);utils[_0x11c0('0xf')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3cc04b[_0x11c0('0xc')],_0x3cc04b[_0x11c0('0x5')],_0x3cc04b[_0x11c0('0x10')]));queues[_0x3cc04b[_0x11c0('0xc')]]=_[_0x11c0('0x11')](_0x3cc04b,{'originalposition':_0x3cc04b[_0x11c0('0x10')],'queuecallerjoinAt':utils[_0x11c0('0x12')](),'mohtime':0x0});}catch(_0x51e830){utils[_0x11c0('0x13')](util['format'](_0x11c0('0xe'),_0x3cc04b['uniqueid']),_0x51e830);}};exports[_0x11c0('0x14')]=function(_0x45131a){try{if(!_[_0x11c0('0x15')](queues[_0x45131a['uniqueid']])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x17'),_0x45131a[_0x11c0('0xc')]),_0x45131a);if(queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x18')]){if(!queues[_0x45131a['uniqueid']]['queuecallerabandon']&&!queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x19')]){queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1a')]=!![];queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1b')]=utils[_0x11c0('0x12')]();queues[_0x45131a[_0x11c0('0xc')]]['queuecallerexitreason']=_0x11c0('0x1c');}utils[_0x11c0('0xf')](util['format'](_0x11c0('0x1d'),_0x45131a[_0x11c0('0xc')],queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1e')],queues[_0x45131a[_0x11c0('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x45131a[_0x11c0('0xc')]]);}else if(queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]){utils[_0x11c0('0xf')](util['format'](_0x11c0('0x1f'),_0x45131a[_0x11c0('0xc')],queues[_0x45131a[_0x11c0('0xc')]]['name'],queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]));queues[queues[_0x45131a['uniqueid']]['transfereduniqueid']]=queues[_0x45131a['uniqueid']];queues[queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]][_0x11c0('0x20')]=0x2;delete queues[_0x45131a[_0x11c0('0xc')]];}}}catch(_0x41837d){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x17'),_0x45131a[_0x11c0('0xc')]),_0x41837d);}};exports['varset']=function(_0x1b9316){try{utils[_0x11c0('0x16')](util['format'](_0x11c0('0x21'),_0x1b9316[_0x11c0('0xc')]),_0x1b9316);if(!_[_0x11c0('0x15')](_0x1b9316['variable']['queuestatus'])&&_0x1b9316[_0x11c0('0x22')][_0x11c0('0x23')]()!==_0x11c0('0x24')){if(!_[_0x11c0('0x15')](queues[_0x1b9316['uniqueid']])){queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerabandon']=![];queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexit']=!![];queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexitAt']=utils[_0x11c0('0x12')]();queues[_0x1b9316['uniqueid']][_0x11c0('0x26')]=_0x1b9316[_0x11c0('0x22')][_0x11c0('0x23')]();utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x27'),_0x1b9316['uniqueid'],queues[_0x1b9316[_0x11c0('0xc')]]['name'],_0x1b9316[_0x11c0('0x22')],queues[_0x1b9316['uniqueid']][_0x11c0('0x26')]));writeDB(queues[_0x1b9316[_0x11c0('0xc')]]);}}else if(!_['isNil'](_0x1b9316['variable'][_0x11c0('0x28')])){if(!_['isNil'](queues[_0x1b9316[_0x11c0('0xc')]])&&!queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x29')]){queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x29')]=![];queues[_0x1b9316['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x19')]=!![];queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x2a')]=utils[_0x11c0('0x12')]();queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x2b');utils['info'](util[_0x11c0('0x3')](_0x11c0('0x2c'),_0x1b9316['uniqueid'],queues[_0x1b9316[_0x11c0('0xc')]]['name'],_0x1b9316[_0x11c0('0x22')],queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexitreason']));}}}catch(_0x250893){utils[_0x11c0('0x13')](util['format'](_0x11c0('0x21'),_0x1b9316[_0x11c0('0xc')]),_0x250893);}};exports[_0x11c0('0x29')]=function(_0x59b6e4){try{if(!_[_0x11c0('0x15')](queues[_0x59b6e4['uniqueid']])){utils[_0x11c0('0x16')](util['format']('[%s][queues][queuecallerabandon]',_0x59b6e4[_0x11c0('0xc')]),_0x59b6e4);queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x19')]=![];queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x2a')]=null;queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x29')]=!![];queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x25')]=utils['now']();queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x2d');utils[_0x11c0('0xf')](util['format'](_0x11c0('0x2e'),_0x59b6e4[_0x11c0('0xc')],queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x1e')],queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x26')]));}}catch(_0xc29b4d){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x2f'),_0x59b6e4[_0x11c0('0xc')]),_0xc29b4d);}};exports[_0x11c0('0x30')]=function(_0x3c45b2){try{if(!_[_0x11c0('0x15')](queues[_0x3c45b2[_0x11c0('0xc')]])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x31'),_0x3c45b2['uniqueid']),_0x3c45b2);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x32'),_0x3c45b2['uniqueid'],queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x1e')],_0x3c45b2[_0x11c0('0x33')],_0x3c45b2[_0x11c0('0x34')]));queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x30')]=!![];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x18')]=utils[_0x11c0('0x12')]();queues[_0x3c45b2['uniqueid']]['holdtime']=utils[_0x11c0('0x35')](queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x18')],queues[_0x3c45b2['uniqueid']][_0x11c0('0x36')]);queues[_0x3c45b2[_0x11c0('0xc')]]['position']=_0x3c45b2['position'];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x37')]=_0x3c45b2['count'];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x33')]=_0x3c45b2[_0x11c0('0x33')];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x34')]=_0x3c45b2[_0x11c0('0x34')];}}catch(_0x278405){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x31'),_0x3c45b2[_0x11c0('0xc')]),_0x278405);}};exports['agentconnect']=function(_0x1b4549){try{if(!_[_0x11c0('0x15')](queues[_0x1b4549[_0x11c0('0xc')]])){utils['debug'](util[_0x11c0('0x3')]('[%s][queues][agentconnect]',_0x1b4549[_0x11c0('0xc')]),_0x1b4549);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x38'),_0x1b4549[_0x11c0('0xc')],queues[_0x1b4549['uniqueid']]['name'],_0x1b4549[_0x11c0('0x39')],_0x1b4549[_0x11c0('0x3a')]));queues[_0x1b4549['uniqueid']][_0x11c0('0x29')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x29')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x1b4549['uniqueid']][_0x11c0('0x19')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x26')]=null;queues[_0x1b4549['uniqueid']][_0x11c0('0x2a')]=null;queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x3b')]=!![];queues[_0x1b4549[_0x11c0('0xc')]]['accountcode']=_0x1b4549[_0x11c0('0x3a')];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x6')]=_0x1b4549['membername'];}}catch(_0x38e0d9){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x3c'),_0x1b4549['uniqueid']),_0x38e0d9);}};exports[_0x11c0('0x3d')]=function(_0x37428a){try{if(!_['isNil'](queues[_0x37428a['uniqueid']])){if(queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x18')]){utils[_0x11c0('0x16')](util['format'](_0x11c0('0x3e'),_0x37428a[_0x11c0('0xc')]),_0x37428a);queues[_0x37428a['uniqueid']]['queuecallerabandon']=![];queues[_0x37428a[_0x11c0('0xc')]]['queuecallerabandon']=![];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x37428a[_0x11c0('0xc')]]['queuecallerexit']=![];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x2a')]=null;queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x3b')]=!![];queues[_0x37428a[_0x11c0('0xc')]]['lastAssignedTo']=_0x37428a[_0x11c0('0x39')];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x1a')]=!![];queues[_0x37428a['uniqueid']][_0x11c0('0x1b')]=utils['now']();if(_0x37428a[_0x11c0('0x3f')]==_0x11c0('0x40')){if(!queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x40')]){queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x41');}}else{queues[_0x37428a[_0x11c0('0xc')]]['queuecallerexitreason']=_0x11c0('0x42')+_0x37428a[_0x11c0('0x3f')]['toUpperCase']();}utils['info'](util[_0x11c0('0x3')](_0x11c0('0x43'),_0x37428a['uniqueid'],queues[_0x37428a[_0x11c0('0xc')]]['name'],_0x37428a[_0x11c0('0x39')],queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x26')]));writeDB(queues[_0x37428a['uniqueid']]);}}}catch(_0x4c9bf6){utils['error'](util[_0x11c0('0x3')](_0x11c0('0x3e'),_0x37428a[_0x11c0('0xc')]),_0x4c9bf6);}};exports[_0x11c0('0x44')]=function(_0x54ee15){try{if(!_[_0x11c0('0x15')](queues[_0x54ee15[_0x11c0('0x45')]])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x46'),_0x54ee15[_0x11c0('0xc')]),_0x54ee15);queues[_0x54ee15[_0x11c0('0x45')]]['transfer']=!![];queues[_0x54ee15[_0x11c0('0x45')]][_0x11c0('0x47')]='BLIND';queues[_0x54ee15[_0x11c0('0x45')]]['transferexten']=_0x54ee15[_0x11c0('0x48')];queues[_0x54ee15[_0x11c0('0x45')]][_0x11c0('0x49')]=_0x54ee15[_0x11c0('0x45')];queues[_0x54ee15['transfereeuniqueid']][_0x11c0('0x26')]='BLINDTRANSFER';utils['info'](util[_0x11c0('0x3')](_0x11c0('0x4a'),_0x54ee15['uniqueid'],queues[_0x54ee15[_0x11c0('0x45')]]['name'],_0x54ee15[_0x11c0('0x45')],_0x54ee15[_0x11c0('0x48')]));}}catch(_0x5bc9cc){utils['error'](util[_0x11c0('0x3')](_0x11c0('0x46'),_0x54ee15[_0x11c0('0xc')]),_0x5bc9cc);}};exports[_0x11c0('0x4b')]=function(_0x98288c){try{utils['debug'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]',_0x98288c[_0x11c0('0x4c')]),_0x98288c);if(_0x98288c[_0x11c0('0x4c')]==_0x98288c[_0x11c0('0x4d')]){if(!_['isNil'](queues[_0x98288c[_0x11c0('0x4e')]])){utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x4f'),_0x98288c['origtransfereruniqueid'],queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x50')]));queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x40')]=!![];queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x47')]=_0x11c0('0x51');queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x52')]=_0x98288c[_0x11c0('0x50')];queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x49')]=_0x98288c['origtransfereruniqueid'];queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x26')]=_0x11c0('0x53');}if(!_['isNil'](queues[_0x98288c['origtransfererlinkedid']])){if(_0x98288c[_0x11c0('0x54')]&&queues[_0x98288c['transfereelinkedid']]){queues[_0x98288c[_0x11c0('0x54')]][_0x11c0('0x20')]=0x1;queues[_0x98288c[_0x11c0('0x45')]]=_[_0x11c0('0x55')](queues[_0x98288c['transfereelinkedid']]);queues[_0x98288c['transfereeuniqueid']][_0x11c0('0xb')]=_0x98288c[_0x11c0('0x56')];queues[_0x98288c[_0x11c0('0x45')]]['queuecallerenterreason']=0x2;queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x7')]=queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x7')];queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x57')]=queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x57')];queues[_0x98288c[_0x11c0('0x45')]]['queuecallerjoinAt']=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x45')]]['queuecallerleaveAt']=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x58')]=0x0;queues[_0x98288c['transfereeuniqueid']]['mohtime']=0x0;utils[_0x11c0('0xf')](util['format'](_0x11c0('0x59'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x45')]]['name'],queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x7')],queues[_0x98288c['transfereeuniqueid']]['calleridname']));}else{utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5a'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x4e')]));queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0xb')]=_0x98288c['secondtransfererlinkedid'];}}}else if(_0x98288c['secondtransfereruniqueid']==_0x98288c[_0x11c0('0x4e')]){if(!_[_0x11c0('0x15')](queues[_0x98288c[_0x11c0('0x4d')]])){utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5b'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x5c')],_0x98288c[_0x11c0('0x5d')]));queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x40')]=!![];queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x47')]=_0x11c0('0x51');queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x52')]=_0x98288c[_0x11c0('0x5d')];queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x49')]=_0x98288c[_0x11c0('0x5c')];queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x26')]=_0x11c0('0x53');}if(!_[_0x11c0('0x15')](queues[_0x98288c['secondtransfererlinkedid']])){if(_0x98288c[_0x11c0('0x5e')]&&queues[_0x98288c[_0x11c0('0x5e')]]){queues[_0x98288c[_0x11c0('0x5e')]][_0x11c0('0x20')]=0x1;queues[_0x98288c['transfertargetuniqueid']]=_[_0x11c0('0x55')](queues[_0x98288c['transfertargetlinkedid']]);queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0xb')]=_0x98288c[_0x11c0('0x56')];queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0x20')]=0x2;queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x7')]=queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x7')];queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x57')]=queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x57')];queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x36')]=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x18')]=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x56')]]['holdtime']=0x0;queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x5f')]=0x0;utils['info'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x1e')],queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0xb')],queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x7')],queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0x57')]));}else{utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5a'),_0x98288c['origtransfereruniqueid'],queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x4d')]));queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0xb')]=_0x98288c['origtransfererlinkedid'];}}}}catch(_0x18caa9){utils['error'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]',_0x98288c[_0x11c0('0x4c')]),_0x18caa9);}};exports['musiconholdstart']=function(_0x3e4740){try{if(!_['isNil'](queues[_0x3e4740[_0x11c0('0xc')]])){utils['debug'](util['format'](_0x11c0('0x60'),_0x3e4740[_0x11c0('0xc')]),_0x3e4740);queues[_0x3e4740['uniqueid']]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x11c0('0x3')](_0x11c0('0x61'),_0x3e4740[_0x11c0('0xc')],queues[_0x3e4740['uniqueid']][_0x11c0('0x1e')],queues[_0x3e4740[_0x11c0('0xc')]][_0x11c0('0x62')]));}}catch(_0x56698b){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x60'),_0x3e4740[_0x11c0('0xc')]),_0x56698b);}};exports[_0x11c0('0x63')]=function(_0x3bd223){try{if(!_['isNil'](queues[_0x3bd223[_0x11c0('0xc')]])){if(!_['isNil'](queues[_0x3bd223[_0x11c0('0xc')]]['musiconholdstartAt'])){utils[_0x11c0('0x16')](util['format'](_0x11c0('0x64'),_0x3bd223['uniqueid']),_0x3bd223);queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x5f')]+=utils[_0x11c0('0x35')](utils[_0x11c0('0x12')](),queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x62')]);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x65'),_0x3bd223[_0x11c0('0xc')],queues[_0x3bd223['uniqueid']][_0x11c0('0x1e')],queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x5f')]));delete queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x62')];}}}catch(_0x1c5604){utils[_0x11c0('0x13')](util['format'](_0x11c0('0x64'),_0x3bd223[_0x11c0('0xc')]),_0x1c5604);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 10c55d3..805df71 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 _0xac7f=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x49d7ab,_0x113754){var _0x258c0f=function(_0x1dc315){while(--_0x1dc315){_0x49d7ab['push'](_0x49d7ab['shift']());}};_0x258c0f(++_0x113754);}(_0xac7f,0x1e2));var _0xfac7=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xac7f[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xfac7('0x0'));var util=require('util');var utils=require(_0xfac7('0x1'));var recordings={};function writeDB(_0x44bdc1){utils[_0xfac7('0x2')](util['format'](_0xfac7('0x3'),_0x44bdc1[_0xfac7('0x4')]));if(_0x44bdc1[_0xfac7('0x5')]){utils[_0xfac7('0x6')](_0x44bdc1[_0xfac7('0x5')])[_0xfac7('0x7')](function(_0x523494){if(_0x523494){_0x44bdc1[_0xfac7('0x8')]=_0x523494['name'];_0x44bdc1[_0xfac7('0x9')]=_0x523494['id'];}utils[_0xfac7('0xa')]('CreateVoiceRecording',_0x44bdc1);});}else{utils[_0xfac7('0xa')](_0xfac7('0xb'),_0x44bdc1);}}exports[_0xfac7('0xc')]=function(_0x529223){try{utils[_0xfac7('0xd')](util[_0xfac7('0xe')]('[%s][recordings][newchannel]',_0x529223['uniqueid']),_0x529223);if(_0x529223[_0xfac7('0x4')]==_0x529223[_0xfac7('0xf')]){utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x10'),_0x529223['uniqueid'],_0x529223[_0xfac7('0x11')],_0x529223[_0xfac7('0x12')]));recordings[_0x529223[_0xfac7('0x4')]]={'uniqueid':_0x529223[_0xfac7('0x4')],'accountcode':_0x529223[_0xfac7('0x5')],'exten':_0x529223[_0xfac7('0x12')],'context':_0x529223['context'],'channel':_0x529223['channel'],'monitors':[]};}}catch(_0x11a5fd){utils['error'](util[_0xfac7('0xe')](_0xfac7('0x13'),_0x529223['uniqueid']),_0x11a5fd);}};exports[_0xfac7('0x14')]=function(_0xc7a913){try{utils['debug'](util[_0xfac7('0xe')](_0xfac7('0x15'),_0xc7a913[_0xfac7('0x4')]),_0xc7a913);if(!_[_0xfac7('0x16')](recordings[_0xc7a913['uniqueid']])&&_0xc7a913[_0xfac7('0x17')]==0x6){utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x18'),_0xc7a913[_0xfac7('0x4')],_0xc7a913[_0xfac7('0x11')],_0xc7a913[_0xfac7('0x19')]));}else if(!_[_0xfac7('0x16')](recordings[_0xc7a913[_0xfac7('0xf')]])&&_0xc7a913['channelstate']==0x6&&_0xc7a913['context']!=_0xfac7('0x1a')){utils[_0xfac7('0x2')](util['format'](_0xfac7('0x1b'),_0xc7a913[_0xfac7('0x4')],_0xc7a913[_0xfac7('0xf')],_0xc7a913[_0xfac7('0x11')],_0xc7a913[_0xfac7('0x19')]));recordings[_0xc7a913[_0xfac7('0xf')]][_0xfac7('0x5')]=_0xc7a913[_0xfac7('0x5')];}}catch(_0x2229aa){utils[_0xfac7('0x1c')](util['format'](_0xfac7('0x15'),_0xc7a913[_0xfac7('0x4')]),_0x2229aa);}};exports[_0xfac7('0x1d')]=function(_0x334e72){try{if(!_[_0xfac7('0x16')](_0x334e72['variable'])&&!_[_0xfac7('0x16')](_0x334e72[_0xfac7('0x1e')][_0xfac7('0x1f')])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x20'),_0x334e72['uniqueid']),_0x334e72);utils[_0xfac7('0x2')](util[_0xfac7('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x334e72[_0xfac7('0x4')],_0x334e72[_0xfac7('0x1e')],_0x334e72[_0xfac7('0x21')]));if(_[_0xfac7('0x22')](_0x334e72[_0xfac7('0x21')],_0xfac7('0x23'))){_0x334e72['value']=_0x334e72[_0xfac7('0x21')]['replace'](_0xfac7('0x23'),'.WAV');}if(recordings[_0x334e72[_0xfac7('0xf')]]){var _0x32fb2c=_[_0xfac7('0x24')](recordings[_0x334e72['linkedid']][_0xfac7('0x25')],{'value':_0x334e72[_0xfac7('0x21')]});if(_[_0xfac7('0x16')](_0x32fb2c)){recordings[_0x334e72[_0xfac7('0xf')]][_0xfac7('0x25')][_0xfac7('0x26')]({'value':_0x334e72[_0xfac7('0x21')]});}}}}catch(_0x43738c){utils[_0xfac7('0x1c')](util['format'](_0xfac7('0x20'),_0x334e72[_0xfac7('0x4')]),_0x43738c);}};exports['hangup']=function(_0x1d7993){try{if(!_[_0xfac7('0x16')](recordings[_0x1d7993[_0xfac7('0x4')]])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x27'),_0x1d7993[_0xfac7('0x4')]),_0x1d7993);utils['info'](util['format'](_0xfac7('0x28'),_0x1d7993['uniqueid'],_0x1d7993['calleridnum'],_0x1d7993['calleridname'],_0x1d7993[_0xfac7('0x29')]));recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2a')]=_0x1d7993[_0xfac7('0x2a')];recordings[_0x1d7993[_0xfac7('0x4')]]['calleridname']=_0x1d7993[_0xfac7('0x2b')];recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2c')]=_0x1d7993['connectedlinenum'];recordings[_0x1d7993[_0xfac7('0x4')]]['connectedlinename']=_0x1d7993[_0xfac7('0x2d')];if(recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2e')]==_0xfac7('0x2f')&&recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x5')]){recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2c')]=recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x5')];recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x2d')]='';}recordings[_0x1d7993[_0xfac7('0x4')]][_0xfac7('0x25')][_0xfac7('0x30')](function(_0x410f53){var _0x50ead2=_['clone'](recordings[_0x1d7993[_0xfac7('0x4')]]);_0x50ead2['value']=_0x410f53[_0xfac7('0x21')];writeDB(_0x50ead2);});delete recordings[_0x1d7993[_0xfac7('0x4')]];}}catch(_0x4c9025){utils[_0xfac7('0x1c')](util[_0xfac7('0xe')](_0xfac7('0x27'),_0x1d7993[_0xfac7('0x4')]),_0x4c9025);}};exports[_0xfac7('0x31')]=function(_0x58792b){try{if(!_['isNil'](recordings[_0x58792b[_0xfac7('0x4')]])){utils['debug'](util['format'](_0xfac7('0x32'),_0x58792b[_0xfac7('0x4')]),_0x58792b);utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x33'),_0x58792b[_0xfac7('0x4')],_0x58792b[_0xfac7('0x34')],_0x58792b[_0xfac7('0x35')]));if(_0x58792b[_0xfac7('0x34')]['toLowerCase']()=='set'&&_['startsWith'](_0x58792b['appdata']['toLowerCase'](),'cdr')){var _0x24a13f=_0x58792b['appdata'][_0xfac7('0x36')]('=');var _0xd65e98=_0x24a13f[0x0]['substring'](_0x24a13f[0x0][_0xfac7('0x37')]('(')+0x1,_0x24a13f[0x0][_0xfac7('0x37')](')'));var _0x5096f3=_0x24a13f[0x1];recordings[_0x58792b[_0xfac7('0x4')]][_0xd65e98]=_0x5096f3;}}}catch(_0x1f5c3c){utils['error'](util[_0xfac7('0xe')](_0xfac7('0x32'),_0x58792b[_0xfac7('0x4')]),_0x1f5c3c);}};exports[_0xfac7('0x38')]=function(_0x579392){try{if(!_[_0xfac7('0x16')](recordings[_0x579392['uniqueid']])){utils[_0xfac7('0xd')](util[_0xfac7('0xe')](_0xfac7('0x39'),_0x579392[_0xfac7('0x4')]),_0x579392);utils[_0xfac7('0x2')](util[_0xfac7('0xe')](_0xfac7('0x3a'),_0x579392[_0xfac7('0x4')],_0x579392[_0xfac7('0x3b')]));recordings[_0x579392[_0xfac7('0x4')]][_0xfac7('0x3b')]=_0x579392[_0xfac7('0x3b')];}}catch(_0x7aaa95){utils[_0xfac7('0x1c')](util[_0xfac7('0xe')](_0xfac7('0x39'),_0x579392[_0xfac7('0x4')]),_0x7aaa95);}}; \ No newline at end of file +var _0x2394=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','clone','[%s][recordings][newexten]','application','set','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','lodash','info','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x2394,0x1f4));var _0x4239=function(_0x8929a1,_0x25516b){_0x8929a1=_0x8929a1-0x0;var _0x5102cc=_0x2394[_0x8929a1];return _0x5102cc;};'use strict';var _=require(_0x4239('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x257e2a){utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x3'),_0x257e2a['uniqueid']));if(_0x257e2a['accountcode']){utils[_0x4239('0x4')](_0x257e2a[_0x4239('0x5')])['then'](function(_0x3d6d9e){if(_0x3d6d9e){_0x257e2a[_0x4239('0x6')]=_0x3d6d9e[_0x4239('0x7')];_0x257e2a['UserId']=_0x3d6d9e['id'];}utils[_0x4239('0x8')](_0x4239('0x9'),_0x257e2a);});}else{utils[_0x4239('0x8')](_0x4239('0x9'),_0x257e2a);}}exports[_0x4239('0xa')]=function(_0x2cd5b4){try{utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0xc'),_0x2cd5b4['uniqueid']),_0x2cd5b4);if(_0x2cd5b4[_0x4239('0xd')]==_0x2cd5b4['linkedid']){utils[_0x4239('0x1')](util['format'](_0x4239('0xe'),_0x2cd5b4[_0x4239('0xd')],_0x2cd5b4['context'],_0x2cd5b4[_0x4239('0xf')]));recordings[_0x2cd5b4[_0x4239('0xd')]]={'uniqueid':_0x2cd5b4[_0x4239('0xd')],'accountcode':_0x2cd5b4['accountcode'],'exten':_0x2cd5b4[_0x4239('0xf')],'context':_0x2cd5b4['context'],'channel':_0x2cd5b4['channel'],'monitors':[]};}}catch(_0x5656ac){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0xc'),_0x2cd5b4[_0x4239('0xd')]),_0x5656ac);}};exports['newstate']=function(_0x3a21c4){try{utils['debug'](util[_0x4239('0x2')](_0x4239('0x11'),_0x3a21c4[_0x4239('0xd')]),_0x3a21c4);if(!_[_0x4239('0x12')](recordings[_0x3a21c4['uniqueid']])&&_0x3a21c4[_0x4239('0x13')]==0x6){utils['info'](util[_0x4239('0x2')](_0x4239('0x14'),_0x3a21c4[_0x4239('0xd')],_0x3a21c4[_0x4239('0x15')],_0x3a21c4['channel']));}else if(!_[_0x4239('0x12')](recordings[_0x3a21c4['linkedid']])&&_0x3a21c4[_0x4239('0x13')]==0x6&&_0x3a21c4[_0x4239('0x15')]!=_0x4239('0x16')){utils[_0x4239('0x1')](util['format'](_0x4239('0x17'),_0x3a21c4[_0x4239('0xd')],_0x3a21c4[_0x4239('0x18')],_0x3a21c4[_0x4239('0x15')],_0x3a21c4[_0x4239('0x19')]));recordings[_0x3a21c4[_0x4239('0x18')]]['accountcode']=_0x3a21c4[_0x4239('0x5')];}}catch(_0x18f10d){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x11'),_0x3a21c4[_0x4239('0xd')]),_0x18f10d);}};exports[_0x4239('0x1a')]=function(_0x48dc28){try{if(!_[_0x4239('0x12')](_0x48dc28['variable'])&&!_[_0x4239('0x12')](_0x48dc28[_0x4239('0x1b')][_0x4239('0x1c')])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x1d'),_0x48dc28[_0x4239('0xd')]),_0x48dc28);utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x1e'),_0x48dc28[_0x4239('0xd')],_0x48dc28[_0x4239('0x1b')],_0x48dc28['value']));if(_[_0x4239('0x1f')](_0x48dc28[_0x4239('0x20')],_0x4239('0x21'))){_0x48dc28[_0x4239('0x20')]=_0x48dc28[_0x4239('0x20')][_0x4239('0x22')](_0x4239('0x21'),_0x4239('0x23'));}if(recordings[_0x48dc28[_0x4239('0x18')]]){var _0x3312d8=_[_0x4239('0x24')](recordings[_0x48dc28[_0x4239('0x18')]]['monitors'],{'value':_0x48dc28[_0x4239('0x20')]});if(_[_0x4239('0x12')](_0x3312d8)){recordings[_0x48dc28[_0x4239('0x18')]]['monitors'][_0x4239('0x25')]({'value':_0x48dc28['value']});}}}}catch(_0x431289){utils[_0x4239('0x10')](util['format'](_0x4239('0x1d'),_0x48dc28[_0x4239('0xd')]),_0x431289);}};exports['hangup']=function(_0x27b830){try{if(!_[_0x4239('0x12')](recordings[_0x27b830[_0x4239('0xd')]])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x26'),_0x27b830[_0x4239('0xd')]),_0x27b830);utils[_0x4239('0x1')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x27b830[_0x4239('0xd')],_0x27b830[_0x4239('0x27')],_0x27b830[_0x4239('0x28')],_0x27b830[_0x4239('0x29')]));recordings[_0x27b830[_0x4239('0xd')]]['calleridnum']=_0x27b830[_0x4239('0x27')];recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x28')]=_0x27b830[_0x4239('0x28')];recordings[_0x27b830['uniqueid']][_0x4239('0x2a')]=_0x27b830[_0x4239('0x2a')];recordings[_0x27b830['uniqueid']][_0x4239('0x2b')]=_0x27b830['connectedlinename'];if(recordings[_0x27b830['uniqueid']][_0x4239('0x2c')]==_0x4239('0x2d')&&recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x5')]){recordings[_0x27b830[_0x4239('0xd')]]['connectedlinenum']=recordings[_0x27b830['uniqueid']]['accountcode'];recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x2b')]='';}recordings[_0x27b830['uniqueid']][_0x4239('0x2e')][_0x4239('0x2f')](function(_0xa866ef){var _0x37b8c9=_[_0x4239('0x30')](recordings[_0x27b830['uniqueid']]);_0x37b8c9['value']=_0xa866ef['value'];writeDB(_0x37b8c9);});delete recordings[_0x27b830[_0x4239('0xd')]];}}catch(_0x555b16){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x26'),_0x27b830[_0x4239('0xd')]),_0x555b16);}};exports['newexten']=function(_0x338095){try{if(!_[_0x4239('0x12')](recordings[_0x338095[_0x4239('0xd')]])){utils[_0x4239('0xb')](util['format'](_0x4239('0x31'),_0x338095[_0x4239('0xd')]),_0x338095);utils[_0x4239('0x1')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x338095[_0x4239('0xd')],_0x338095['application'],_0x338095['appdata']));if(_0x338095[_0x4239('0x32')]['toLowerCase']()==_0x4239('0x33')&&_['startsWith'](_0x338095[_0x4239('0x34')]['toLowerCase'](),_0x4239('0x35'))){var _0x1f6322=_0x338095[_0x4239('0x34')][_0x4239('0x36')]('=');var _0x110295=_0x1f6322[0x0]['substring'](_0x1f6322[0x0]['lastIndexOf']('(')+0x1,_0x1f6322[0x0][_0x4239('0x37')](')'));var _0x1f63b1=_0x1f6322[0x1];recordings[_0x338095['uniqueid']][_0x110295]=_0x1f63b1;}}}catch(_0x54c36b){utils[_0x4239('0x10')](util['format'](_0x4239('0x31'),_0x338095['uniqueid']),_0x54c36b);}};exports['queuecallerjoin']=function(_0x4ccd90){try{if(!_[_0x4239('0x12')](recordings[_0x4ccd90[_0x4239('0xd')]])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x38'),_0x4ccd90['uniqueid']),_0x4ccd90);utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x39'),_0x4ccd90[_0x4239('0xd')],_0x4ccd90['queue']));recordings[_0x4ccd90['uniqueid']]['queue']=_0x4ccd90['queue'];}}catch(_0x1c98a6){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x38'),_0x4ccd90[_0x4239('0xd')]),_0x1c98a6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b37ae93..f0a50d2 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 _0xeff8=['request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid'];(function(_0x50da86,_0x5bc463){var _0x3a312b=function(_0x41be88){while(--_0x41be88){_0x50da86['push'](_0x50da86['shift']());}};_0x3a312b(++_0x5bc463);}(_0xeff8,0x8f));var _0x8eff=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xeff8[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x5c018e){utils[_0x8eff('0x0')](util[_0x8eff('0x1')](_0x8eff('0x2'),_0x5c018e[_0x8eff('0x3')]==='attended'?_0x5c018e['origtransfereruniqueid']:_0x5c018e[_0x8eff('0x4')],_0x5c018e[_0x8eff('0x3')]));utils[_0x8eff('0x5')](_0x8eff('0x6'),_0x5c018e);}exports[_0x8eff('0x7')]=function(_0x23091e){try{utils[_0x8eff('0x8')](util[_0x8eff('0x1')]('[%s][transfers][blindtransfer]',_0x23091e['uniqueid']),_0x23091e);utils[_0x8eff('0x0')](util['format'](_0x8eff('0x9'),_0x23091e[_0x8eff('0x4')],_0x23091e[_0x8eff('0xa')],_0x23091e[_0x8eff('0xb')],_0x23091e['transfereecalleridnum'],_0x23091e['transfereecalleridname']));_0x23091e['type']=_0x8eff('0xc');writeDB(_0x23091e);}catch(_0x4a09a2){utils[_0x8eff('0xd')](util['format'](_0x8eff('0xe'),_0x23091e['uniqueid']),_0x4a09a2);}};exports['attendedtransfer']=function(_0x28acb6){try{utils[_0x8eff('0x8')](util[_0x8eff('0x1')](_0x8eff('0xf'),_0x28acb6[_0x8eff('0x10')]),_0x28acb6);utils[_0x8eff('0x0')](util[_0x8eff('0x1')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x28acb6[_0x8eff('0x10')],_0x28acb6[_0x8eff('0x11')],_0x28acb6['origtransferercalleridname'],_0x28acb6[_0x8eff('0x12')],_0x28acb6['transfertargetcalleridname']));_0x28acb6=_[_0x8eff('0x13')](_0x28acb6,{'transfererchannel':_0x28acb6['origtransfererchannel'],'transferercalleridnum':_0x28acb6[_0x8eff('0x11')],'transferercalleridname':_0x28acb6[_0x8eff('0x14')],'transfererconnectedlinenum':_0x28acb6[_0x8eff('0x15')],'transfererconnectedlinename':_0x28acb6[_0x8eff('0x16')],'transfereraccountcode':_0x28acb6[_0x8eff('0x17')],'transferercontext':_0x28acb6['secondtransferercontext'],'transfererexten':_0x28acb6[_0x8eff('0x18')],'transfererlinkedid':_0x28acb6[_0x8eff('0x19')],'context':_0x28acb6['origtransferercontext'],'extension':_0x28acb6[_0x8eff('0x1a')],'type':_0x8eff('0x1b')});if(_[_0x8eff('0x1c')](_0x28acb6[_0x8eff('0x1d')])){_0x28acb6=_[_0x8eff('0x13')](_0x28acb6,{'transfereechannel':_0x28acb6[_0x8eff('0x1e')],'transfereecalleridnum':_0x28acb6['transfertargetcalleridnum'],'transfereecalleridname':_0x28acb6[_0x8eff('0x1f')],'transfereeconnectedlinenum':_0x28acb6[_0x8eff('0x20')],'transfereeconnectedlinename':_0x28acb6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x28acb6[_0x8eff('0x21')],'transfereecontext':_0x28acb6[_0x8eff('0x22')],'transfereeexten':_0x28acb6[_0x8eff('0x23')],'transfereelinkedid':_0x28acb6[_0x8eff('0x24')]});}writeDB(_0x28acb6);}catch(_0x4b5e5a){utils[_0x8eff('0xd')](util[_0x8eff('0x1')]('[%s][transfers][attendedtransfer]',_0x28acb6[_0x8eff('0x10')]),_0x4b5e5a);}}; \ No newline at end of file +var _0xcd76=['blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport'];(function(_0x11fbaa,_0x52dc16){var _0x1831fd=function(_0x2bbced){while(--_0x2bbced){_0x11fbaa['push'](_0x11fbaa['shift']());}};_0x1831fd(++_0x52dc16);}(_0xcd76,0x1a2));var _0x6cd7=function(_0x155c6d,_0x3f202d){_0x155c6d=_0x155c6d-0x0;var _0x5970f0=_0xcd76[_0x155c6d];return _0x5970f0;};'use strict';var _=require(_0x6cd7('0x0'));var util=require(_0x6cd7('0x1'));var utils=require(_0x6cd7('0x2'));function writeDB(_0x2a65ac){utils[_0x6cd7('0x3')](util[_0x6cd7('0x4')](_0x6cd7('0x5'),_0x2a65ac[_0x6cd7('0x6')]===_0x6cd7('0x7')?_0x2a65ac[_0x6cd7('0x8')]:_0x2a65ac[_0x6cd7('0x9')],_0x2a65ac[_0x6cd7('0x6')]));utils[_0x6cd7('0xa')](_0x6cd7('0xb'),_0x2a65ac);}exports[_0x6cd7('0xc')]=function(_0x45ee69){try{utils[_0x6cd7('0xd')](util[_0x6cd7('0x4')](_0x6cd7('0xe'),_0x45ee69[_0x6cd7('0x9')]),_0x45ee69);utils[_0x6cd7('0x3')](util[_0x6cd7('0x4')](_0x6cd7('0xf'),_0x45ee69['uniqueid'],_0x45ee69[_0x6cd7('0x10')],_0x45ee69[_0x6cd7('0x11')],_0x45ee69[_0x6cd7('0x12')],_0x45ee69[_0x6cd7('0x13')]));_0x45ee69[_0x6cd7('0x6')]=_0x6cd7('0x14');writeDB(_0x45ee69);}catch(_0x169cc2){utils[_0x6cd7('0x15')](util['format'](_0x6cd7('0xe'),_0x45ee69['uniqueid']),_0x169cc2);}};exports[_0x6cd7('0x16')]=function(_0x33ef79){try{utils[_0x6cd7('0xd')](util[_0x6cd7('0x4')](_0x6cd7('0x17'),_0x33ef79[_0x6cd7('0x8')]),_0x33ef79);utils['info'](util['format'](_0x6cd7('0x18'),_0x33ef79[_0x6cd7('0x8')],_0x33ef79[_0x6cd7('0x19')],_0x33ef79[_0x6cd7('0x1a')],_0x33ef79[_0x6cd7('0x1b')],_0x33ef79[_0x6cd7('0x1c')]));_0x33ef79=_[_0x6cd7('0x1d')](_0x33ef79,{'transfererchannel':_0x33ef79[_0x6cd7('0x1e')],'transferercalleridnum':_0x33ef79[_0x6cd7('0x19')],'transferercalleridname':_0x33ef79[_0x6cd7('0x1a')],'transfererconnectedlinenum':_0x33ef79[_0x6cd7('0x1f')],'transfererconnectedlinename':_0x33ef79['secondtransfererconnectedlinename'],'transfereraccountcode':_0x33ef79[_0x6cd7('0x20')],'transferercontext':_0x33ef79[_0x6cd7('0x21')],'transfererexten':_0x33ef79['secondtransfererexten'],'transfererlinkedid':_0x33ef79[_0x6cd7('0x22')],'context':_0x33ef79[_0x6cd7('0x23')],'extension':_0x33ef79[_0x6cd7('0x24')],'type':_0x6cd7('0x7')});if(_[_0x6cd7('0x25')](_0x33ef79[_0x6cd7('0x26')])){_0x33ef79=_['assign'](_0x33ef79,{'transfereechannel':_0x33ef79[_0x6cd7('0x27')],'transfereecalleridnum':_0x33ef79['transfertargetcalleridnum'],'transfereecalleridname':_0x33ef79[_0x6cd7('0x1c')],'transfereeconnectedlinenum':_0x33ef79[_0x6cd7('0x28')],'transfereeconnectedlinename':_0x33ef79[_0x6cd7('0x29')],'transfereeaccountcode':_0x33ef79['transfertargetaccountcode'],'transfereecontext':_0x33ef79['transfertargetcontext'],'transfereeexten':_0x33ef79[_0x6cd7('0x2a')],'transfereelinkedid':_0x33ef79['transfertargetlinkedid']});}writeDB(_0x33ef79);}catch(_0x3cfe5d){utils[_0x6cd7('0x15')](util[_0x6cd7('0x4')](_0x6cd7('0x17'),_0x33ef79[_0x6cd7('0x8')]),_0x3cfe5d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 390ef6e..739b159 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fe5b5,_0x41efab){_0x4fe5b5=_0x4fe5b5-0x0;var _0x221fbe=_0xb10b[_0x4fe5b5];return _0x221fbe;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _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(_0x2ef2b6,_0x4814cb){var _0x5b4794=function(_0x255dc2){while(--_0x255dc2){_0x2ef2b6['push'](_0x2ef2b6['shift']());}};_0x5b4794(++_0x4814cb);}(_0x7a54,0x106));var _0x47a5=function(_0x1803d0,_0x19845b){_0x1803d0=_0x1803d0-0x0;var _0x16f62c=_0x7a54[_0x1803d0];return _0x16f62c;};'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